@embedreach/components 0.2.15 → 0.2.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/index.js +15 -15
- package/dist/index.umd.js +2 -2
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -72,7 +72,7 @@ function YZ(e,t){return"function"==typeof e?e(t):e}function XZ(e,t){return n=>{t
|
|
|
72
72
|
*
|
|
73
73
|
* @license MIT
|
|
74
74
|
*/
|
|
75
|
-
function IQ(e,t){return e?function(e){return"function"==typeof e&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}(n=e)||"function"==typeof n||function(e){return"object"==typeof e&&"symbol"==typeof e.$$typeof&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}(n)?i.createElement(e,t):e:null;var n}function FQ(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),!1===n||!r.defaultPrevented)return t?.(r)}}function UQ(e,n=[]){let r=[];const o=()=>{const t=r.map((e=>i.createContext(e)));return function(n){const r=n?.[e]||t;return i.useMemo((()=>({[`__scope${e}`]:{...n,[e]:r}})),[n,r])}};return o.scopeName=e,[function(n,o){const a=i.createContext(o),s=r.length;r=[...r,o];const l=n=>{const{scope:r,children:o,...l}=n,c=r?.[e]?.[s]||a,u=i.useMemo((()=>l),Object.values(l));return t.jsx(c.Provider,{value:u,children:o})};return l.displayName=n+"Provider",[l,function(t,r){const l=i.useContext(r?.[e]?.[s]||a);if(l)return l;if(void 0!==o)return o;throw new Error(`\`${t}\` must be used within \`${n}\``)}]},$Q(o,...n)]}function $Q(...e){const t=e[0];if(1===e.length)return t;const n=()=>{const n=e.map((e=>({useScope:e(),scopeName:e.scopeName})));return function(e){const r=n.reduce(((t,{useScope:n,scopeName:r})=>({...t,...n(e)[`__scope${r}`]})),{});return i.useMemo((()=>({[`__scope${t.scopeName}`]:r})),[r])}};return n.scopeName=t.scopeName,n}function VQ(e){const t=i.useRef(e);return i.useEffect((()=>{t.current=e})),i.useMemo((()=>(...e)=>t.current?.(...e)),[])}function BQ({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=function({defaultProp:e,onChange:t}){const n=i.useState(e),[r]=n,o=i.useRef(r),a=VQ(t);return i.useEffect((()=>{o.current!==r&&(a(r),o.current=r)}),[r,o,a]),n}({defaultProp:t,onChange:n}),a=void 0!==e,s=a?e:r,l=VQ(n);return[s,i.useCallback((t=>{if(a){const n="function"==typeof t?t(e):t;n!==e&&l(n)}else o(t)}),[a,e,o,l])]}var zQ=i.forwardRef(((e,n)=>{const{children:r,...o}=e,a=i.Children.toArray(r),s=a.find(GQ);if(s){const e=s.props.children,r=a.map((t=>t===s?i.Children.count(e)>1?i.Children.only(null):i.isValidElement(e)?e.props.children:null:t));return t.jsx(HQ,{...o,ref:n,children:i.isValidElement(e)?i.cloneElement(e,void 0,r):null})}return t.jsx(HQ,{...o,ref:n,children:r})}));zQ.displayName="Slot";var HQ=i.forwardRef(((e,t)=>{const{children:n,...r}=e;if(i.isValidElement(n)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(n);return i.cloneElement(n,{...KQ(r,n.props),ref:t?YU(t,e):e})}return i.Children.count(n)>1?i.Children.only(null):null}));HQ.displayName="SlotClone";var qQ=({children:e})=>t.jsx(t.Fragment,{children:e});function GQ(e){return i.isValidElement(e)&&e.type===qQ}function KQ(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{i(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]={...o,...i}:"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}var WQ=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"].reduce(((e,n)=>{const r=i.forwardRef(((e,r)=>{const{asChild:o,...i}=e,a=o?zQ:n;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t.jsx(a,{...i,ref:r})}));return r.displayName=`Primitive.${n}`,{...e,[n]:r}}),{});function YQ(e,t){e&&a.flushSync((()=>e.dispatchEvent(t)))}function XQ(e){const r=e+"CollectionProvider",[o,i]=UQ(r),[a,s]=o(r,{collectionRef:{current:null},itemMap:new Map}),l=e=>{const{scope:r,children:o}=e,i=n.useRef(null),s=n.useRef(new Map).current;return t.jsx(a,{scope:r,itemMap:s,collectionRef:i,children:o})};l.displayName=r;const c=e+"CollectionSlot",u=n.forwardRef(((e,n)=>{const{scope:r,children:o}=e,i=XU(n,s(c,r).collectionRef);return t.jsx(zQ,{ref:i,children:o})}));u.displayName=c;const d=e+"CollectionItemSlot",p="data-radix-collection-item",f=n.forwardRef(((e,r)=>{const{scope:o,children:i,...a}=e,l=n.useRef(null),c=XU(r,l),u=s(d,o);return n.useEffect((()=>(u.itemMap.set(l,{ref:l,...a}),()=>{u.itemMap.delete(l)}))),t.jsx(zQ,{[p]:"",ref:c,children:i})}));return f.displayName=d,[{Provider:l,Slot:u,ItemSlot:f},function(t){const r=s(e+"CollectionConsumer",t);return n.useCallback((()=>{const e=r.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${p}]`));return Array.from(r.itemMap.values()).sort(((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current)))}),[r.collectionRef,r.itemMap])},i]}var ZQ=i.createContext(void 0);function QQ(e){const t=i.useContext(ZQ);return e||t||"ltr"}function JQ(e,t=globalThis?.document){const n=VQ(e);i.useEffect((()=>{const e=e=>{"Escape"===e.key&&n(e)};return t.addEventListener("keydown",e,{capture:!0}),()=>t.removeEventListener("keydown",e,{capture:!0})}),[n,t])}var eJ,tJ="dismissableLayer.update",nJ="dismissableLayer.pointerDownOutside",rJ="dismissableLayer.focusOutside",oJ=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),iJ=i.forwardRef(((e,n)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:s,onInteractOutside:l,onDismiss:c,...u}=e,d=i.useContext(oJ),[p,f]=i.useState(null),h=p?.ownerDocument??globalThis?.document,[,m]=i.useState({}),g=XU(n,(e=>f(e))),v=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=v.indexOf(y),x=p?v.indexOf(p):-1,w=d.layersWithOutsidePointerEventsDisabled.size>0,_=x>=b,S=function(e,t=globalThis?.document){const n=VQ(e),r=i.useRef(!1),o=i.useRef((()=>{}));return i.useEffect((()=>{const e=e=>{if(e.target&&!r.current){let r=function(){sJ(nJ,n,i,{discrete:!0})};const i={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",o.current),o.current=r,t.addEventListener("click",o.current,{once:!0})):r()}else t.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout((()=>{t.addEventListener("pointerdown",e)}),0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",e),t.removeEventListener("click",o.current)}}),[t,n]),{onPointerDownCapture:()=>r.current=!0}}((e=>{const t=e.target,n=[...d.branches].some((e=>e.contains(t)));_&&!n&&(a?.(e),l?.(e),e.defaultPrevented||c?.())}),h),E=function(e,t=globalThis?.document){const n=VQ(e),r=i.useRef(!1);return i.useEffect((()=>{const e=e=>{if(e.target&&!r.current){sJ(rJ,n,{originalEvent:e},{discrete:!1})}};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)}),[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}((e=>{const t=e.target;[...d.branches].some((e=>e.contains(t)))||(s?.(e),l?.(e),e.defaultPrevented||c?.())}),h);return JQ((e=>{x===d.layers.size-1&&(o?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))}),h),i.useEffect((()=>{if(p)return r&&(0===d.layersWithOutsidePointerEventsDisabled.size&&(eJ=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(p)),d.layers.add(p),aJ(),()=>{r&&1===d.layersWithOutsidePointerEventsDisabled.size&&(h.body.style.pointerEvents=eJ)}}),[p,h,r,d]),i.useEffect((()=>()=>{p&&(d.layers.delete(p),d.layersWithOutsidePointerEventsDisabled.delete(p),aJ())}),[p,d]),i.useEffect((()=>{const e=()=>m({});return document.addEventListener(tJ,e),()=>document.removeEventListener(tJ,e)}),[]),t.jsx(WQ.div,{...u,ref:g,style:{pointerEvents:w?_?"auto":"none":void 0,...e.style},onFocusCapture:FQ(e.onFocusCapture,E.onFocusCapture),onBlurCapture:FQ(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:FQ(e.onPointerDownCapture,S.onPointerDownCapture)})}));iJ.displayName="DismissableLayer";function aJ(){const e=new CustomEvent(tJ);document.dispatchEvent(e)}function sJ(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?YQ(o,i):o.dispatchEvent(i)}i.forwardRef(((e,n)=>{const r=i.useContext(oJ),o=i.useRef(null),a=XU(n,o);return i.useEffect((()=>{const e=o.current;if(e)return r.branches.add(e),()=>{r.branches.delete(e)}}),[r.branches]),t.jsx(WQ.div,{...e,ref:a})})).displayName="DismissableLayerBranch";var lJ=0;function cJ(){i.useEffect((()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??uJ()),document.body.insertAdjacentElement("beforeend",e[1]??uJ()),lJ++,()=>{1===lJ&&document.querySelectorAll("[data-radix-focus-guard]").forEach((e=>e.remove())),lJ--}}),[])}function uJ(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var dJ="focusScope.autoFocusOnMount",pJ="focusScope.autoFocusOnUnmount",fJ={bubbles:!1,cancelable:!0},hJ=i.forwardRef(((e,n)=>{const{loop:r=!1,trapped:o=!1,onMountAutoFocus:a,onUnmountAutoFocus:s,...l}=e,[c,u]=i.useState(null),d=VQ(a),p=VQ(s),f=i.useRef(null),h=XU(n,(e=>u(e))),m=i.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;i.useEffect((()=>{if(o){let e=function(e){if(m.paused||!c)return;const t=e.target;c.contains(t)?f.current=t:yJ(f.current,{select:!0})},t=function(e){if(m.paused||!c)return;const t=e.relatedTarget;null!==t&&(c.contains(t)||yJ(f.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&yJ(c)};document.addEventListener("focusin",e),document.addEventListener("focusout",t);const r=new MutationObserver(n);return c&&r.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),r.disconnect()}}}),[o,c,m.paused]),i.useEffect((()=>{if(c){bJ.add(m);const t=document.activeElement;if(!c.contains(t)){const n=new CustomEvent(dJ,fJ);c.addEventListener(dJ,d),c.dispatchEvent(n),n.defaultPrevented||(!function(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(yJ(r,{select:t}),document.activeElement!==n)return}((e=mJ(c),e.filter((e=>"A"!==e.tagName))),{select:!0}),document.activeElement===t&&yJ(c))}return()=>{c.removeEventListener(dJ,d),setTimeout((()=>{const e=new CustomEvent(pJ,fJ);c.addEventListener(pJ,p),c.dispatchEvent(e),e.defaultPrevented||yJ(t??document.body,{select:!0}),c.removeEventListener(pJ,p),bJ.remove(m)}),0)}}var e}),[c,d,p,m]);const g=i.useCallback((e=>{if(!r&&!o)return;if(m.paused)return;const t=document.activeElement;if("Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&t){const n=e.currentTarget,[o,i]=function(e){const t=mJ(e),n=gJ(t,e),r=gJ(t.reverse(),e);return[n,r]}(n);o&&i?e.shiftKey||t!==i?e.shiftKey&&t===o&&(e.preventDefault(),r&&yJ(i,{select:!0})):(e.preventDefault(),r&&yJ(o,{select:!0})):t===n&&e.preventDefault()}}),[r,o,m.paused]);return t.jsx(WQ.div,{tabIndex:-1,...l,ref:h,onKeyDown:g})}));function mJ(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>e.disabled||e.hidden||"INPUT"===e.tagName&&"hidden"===e.type?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;n.nextNode();)t.push(n.currentNode);return t}function gJ(e,t){for(const n of e)if(!vJ(n,{upTo:t}))return n}function vJ(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==t&&e===t)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function yJ(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&t&&e.select()}}hJ.displayName="FocusScope";var bJ=function(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=xJ(e,t),e.unshift(t)},remove(t){e=xJ(e,t),e[0]?.resume()}}}();function xJ(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}var wJ=Boolean(globalThis?.document)?i.useLayoutEffect:()=>{},_J=i["useId".toString()]||(()=>{}),SJ=0;function EJ(e){const[t,n]=i.useState(_J());return wJ((()=>{n((e=>e??String(SJ++)))}),[e]),t?`radix-${t}`:""}const TJ=["top","right","bottom","left"],CJ=Math.min,AJ=Math.max,NJ=Math.round,RJ=Math.floor,OJ=e=>({x:e,y:e}),PJ={left:"right",right:"left",bottom:"top",top:"bottom"},kJ={start:"end",end:"start"};function MJ(e,t,n){return AJ(e,CJ(t,n))}function jJ(e,t){return"function"==typeof e?e(t):e}function LJ(e){return e.split("-")[0]}function DJ(e){return e.split("-")[1]}function IJ(e){return"x"===e?"y":"x"}function FJ(e){return"y"===e?"height":"width"}function UJ(e){return["top","bottom"].includes(LJ(e))?"y":"x"}function $J(e){return IJ(UJ(e))}function VJ(e){return e.replace(/start|end/g,(e=>kJ[e]))}function BJ(e){return e.replace(/left|right|bottom|top/g,(e=>PJ[e]))}function zJ(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function HJ(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function qJ(e,t,n){let{reference:r,floating:o}=e;const i=UJ(t),a=$J(t),s=FJ(a),l=LJ(t),c="y"===i,u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,p=r[s]/2-o[s]/2;let f;switch(l){case"top":f={x:u,y:r.y-o.height};break;case"bottom":f={x:u,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:d};break;case"left":f={x:r.x-o.width,y:d};break;default:f={x:r.x,y:r.y}}switch(DJ(t)){case"start":f[a]-=p*(n&&c?-1:1);break;case"end":f[a]+=p*(n&&c?-1:1)}return f}async function GJ(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:a,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:p=!1,padding:f=0}=jJ(t,e),h=zJ(f),m=s[p?"floating"===d?"reference":"floating":d],g=HJ(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(m)))||n?m:m.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(s.floating)),boundary:c,rootBoundary:u,strategy:l})),v="floating"===d?{x:r,y:o,width:a.floating.width,height:a.floating.height}:a.reference,y=await(null==i.getOffsetParent?void 0:i.getOffsetParent(s.floating)),b=await(null==i.isElement?void 0:i.isElement(y))&&await(null==i.getScale?void 0:i.getScale(y))||{x:1,y:1},x=HJ(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:v,offsetParent:y,strategy:l}):v);return{top:(g.top-x.top+h.top)/b.y,bottom:(x.bottom-g.bottom+h.bottom)/b.y,left:(g.left-x.left+h.left)/b.x,right:(x.right-g.right+h.right)/b.x}}function KJ(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function WJ(e){return TJ.some((t=>e[t]>=0))}function YJ(){return"undefined"!=typeof window}function XJ(e){return JJ(e)?(e.nodeName||"").toLowerCase():"#document"}function ZJ(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function QJ(e){var t;return null==(t=(JJ(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function JJ(e){return!!YJ()&&(e instanceof Node||e instanceof ZJ(e).Node)}function e0(e){return!!YJ()&&(e instanceof Element||e instanceof ZJ(e).Element)}function t0(e){return!!YJ()&&(e instanceof HTMLElement||e instanceof ZJ(e).HTMLElement)}function n0(e){return!(!YJ()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof ZJ(e).ShadowRoot)}function r0(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=c0(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function o0(e){return["table","td","th"].includes(XJ(e))}function i0(e){return[":popover-open",":modal"].some((t=>{try{return e.matches(t)}catch(JSe){return!1}}))}function a0(e){const t=s0(),n=e0(e)?c0(e):e;return"none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||["transform","perspective","filter"].some((e=>(n.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(n.contain||"").includes(e)))}function s0(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function l0(e){return["html","body","#document"].includes(XJ(e))}function c0(e){return ZJ(e).getComputedStyle(e)}function u0(e){return e0(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function d0(e){if("html"===XJ(e))return e;const t=e.assignedSlot||e.parentNode||n0(e)&&e.host||QJ(e);return n0(t)?t.host:t}function p0(e){const t=d0(e);return l0(t)?e.ownerDocument?e.ownerDocument.body:e.body:t0(t)&&r0(t)?t:p0(t)}function f0(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=p0(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),a=ZJ(o);if(i){const e=h0(a);return t.concat(a,a.visualViewport||[],r0(o)?o:[],e&&n?f0(e):[])}return t.concat(o,f0(o,[],n))}function h0(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function m0(e){const t=c0(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=t0(e),i=o?e.offsetWidth:n,a=o?e.offsetHeight:r,s=NJ(n)!==i||NJ(r)!==a;return s&&(n=i,r=a),{width:n,height:r,$:s}}function g0(e){return e0(e)?e:e.contextElement}function v0(e){const t=g0(e);if(!t0(t))return OJ(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=m0(t);let a=(i?NJ(n.width):n.width)/r,s=(i?NJ(n.height):n.height)/o;return a&&Number.isFinite(a)||(a=1),s&&Number.isFinite(s)||(s=1),{x:a,y:s}}const y0=OJ(0);function b0(e){const t=ZJ(e);return s0()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:y0}function x0(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=g0(e);let a=OJ(1);t&&(r?e0(r)&&(a=v0(r)):a=v0(e));const s=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==ZJ(e))&&t}(i,n,r)?b0(i):OJ(0);let l=(o.left+s.x)/a.x,c=(o.top+s.y)/a.y,u=o.width/a.x,d=o.height/a.y;if(i){const e=ZJ(i),t=r&&e0(r)?ZJ(r):r;let n=e,o=h0(n);for(;o&&r&&t!==n;){const e=v0(o),t=o.getBoundingClientRect(),r=c0(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,a=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,c*=e.y,u*=e.x,d*=e.y,l+=i,c+=a,n=ZJ(o),o=h0(n)}}return HJ({width:u,height:d,x:l,y:c})}function w0(e,t){const n=u0(e).scrollLeft;return t?t.left+n:x0(QJ(e)).left+n}function _0(e,t,n){void 0===n&&(n=!1);const r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-(n?0:w0(e,r)),y:r.top+t.scrollTop}}function S0(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=ZJ(e),r=QJ(e),o=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,s=0,l=0;if(o){i=o.width,a=o.height;const e=s0();(!e||e&&"fixed"===t)&&(s=o.offsetLeft,l=o.offsetTop)}return{width:i,height:a,x:s,y:l}}(e,n);else if("document"===t)r=function(e){const t=QJ(e),n=u0(e),r=e.ownerDocument.body,o=AJ(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=AJ(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+w0(e);const s=-n.scrollTop;return"rtl"===c0(r).direction&&(a+=AJ(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:a,y:s}}(QJ(e));else if(e0(t))r=function(e,t){const n=x0(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=t0(e)?v0(e):OJ(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n);else{const n=b0(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return HJ(r)}function E0(e,t){const n=d0(e);return!(n===t||!e0(n)||l0(n))&&("fixed"===c0(n).position||E0(n,t))}function T0(e,t,n){const r=t0(t),o=QJ(t),i="fixed"===n,a=x0(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const l=OJ(0);if(r||!r&&!i)if(("body"!==XJ(t)||r0(o))&&(s=u0(t)),r){const e=x0(t,!0,i,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else o&&(l.x=w0(o));const c=!o||r||i?OJ(0):_0(o,s);return{x:a.left+s.scrollLeft-l.x-c.x,y:a.top+s.scrollTop-l.y-c.y,width:a.width,height:a.height}}function C0(e){return"static"===c0(e).position}function A0(e,t){if(!t0(e)||"fixed"===c0(e).position)return null;if(t)return t(e);let n=e.offsetParent;return QJ(e)===n&&(n=n.ownerDocument.body),n}function N0(e,t){const n=ZJ(e);if(i0(e))return n;if(!t0(e)){let t=d0(e);for(;t&&!l0(t);){if(e0(t)&&!C0(t))return t;t=d0(t)}return n}let r=A0(e,t);for(;r&&o0(r)&&C0(r);)r=A0(r,t);return r&&l0(r)&&C0(r)&&!a0(r)?n:r||function(e){let t=d0(e);for(;t0(t)&&!l0(t);){if(a0(t))return t;if(i0(t))return null;t=d0(t)}return null}(e)||n}const R0={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,a=QJ(r),s=!!t&&i0(t.floating);if(r===a||s&&i)return n;let l={scrollLeft:0,scrollTop:0},c=OJ(1);const u=OJ(0),d=t0(r);if((d||!d&&!i)&&(("body"!==XJ(r)||r0(a))&&(l=u0(r)),t0(r))){const e=x0(r);c=v0(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}const p=!a||d||i?OJ(0):_0(a,l,!0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+p.x,y:n.y*c.y-l.scrollTop*c.y+u.y+p.y}},getDocumentElement:QJ,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?i0(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=f0(e,[],!1).filter((e=>e0(e)&&"body"!==XJ(e))),o=null;const i="fixed"===c0(e).position;let a=i?d0(e):e;for(;e0(a)&&!l0(a);){const t=c0(a),n=a0(a);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||r0(a)&&!n&&E0(e,a))?r=r.filter((e=>e!==a)):o=t,a=d0(a)}return t.set(e,r),r}(t,this._c):[].concat(n),r],a=i.reduce(((e,n)=>{const r=S0(t,n,o);return e.top=AJ(r.top,e.top),e.right=CJ(r.right,e.right),e.bottom=CJ(r.bottom,e.bottom),e.left=AJ(r.left,e.left),e}),S0(t,i[0],o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:N0,getElementRects:async function(e){const t=this.getOffsetParent||N0,n=this.getDimensions,r=await n(e.floating);return{reference:T0(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=m0(e);return{width:t,height:n}},getScale:v0,isElement:e0,isRTL:function(e){return"rtl"===c0(e).direction}};function O0(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:l=!1}=r,c=g0(e),u=o||i?[...c?f0(c):[],...f0(t)]:[];u.forEach((e=>{o&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)}));const d=c&&s?function(e,t){let n,r=null;const o=QJ(e);function i(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function a(s,l){void 0===s&&(s=!1),void 0===l&&(l=1),i();const{left:c,top:u,width:d,height:p}=e.getBoundingClientRect();if(s||t(),!d||!p)return;const f={rootMargin:-RJ(u)+"px "+-RJ(o.clientWidth-(c+d))+"px "+-RJ(o.clientHeight-(u+p))+"px "+-RJ(c)+"px",threshold:AJ(0,CJ(1,l))||1};let h=!0;function m(e){const t=e[0].intersectionRatio;if(t!==l){if(!h)return a();t?a(!1,t):n=setTimeout((()=>{a(!1,1e-7)}),1e3)}h=!1}try{r=new IntersectionObserver(m,{...f,root:o.ownerDocument})}catch(JSe){r=new IntersectionObserver(m,f)}r.observe(e)}(!0),i}(c,n):null;let p,f=-1,h=null;a&&(h=new ResizeObserver((e=>{let[r]=e;r&&r.target===c&&h&&(h.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame((()=>{var e;null==(e=h)||e.observe(t)}))),n()})),c&&!l&&h.observe(c),h.observe(t));let m=l?x0(e):null;return l&&function t(){const r=x0(e);!m||r.x===m.x&&r.y===m.y&&r.width===m.width&&r.height===m.height||n();m=r,p=requestAnimationFrame(t)}(),n(),()=>{var e;u.forEach((e=>{o&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)})),null==d||d(),null==(e=h)||e.disconnect(),h=null,l&&cancelAnimationFrame(p)}}const P0=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:a,middlewareData:s}=t,l=await async function(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),a=LJ(n),s=DJ(n),l="y"===UJ(n),c=["left","top"].includes(a)?-1:1,u=i&&l?-1:1,d=jJ(t,e);let{mainAxis:p,crossAxis:f,alignmentAxis:h}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&"number"==typeof h&&(f="end"===s?-1*h:h),l?{x:f*u,y:p*c}:{x:p*c,y:f*u}}(t,e);return a===(null==(n=s.offset)?void 0:n.placement)&&null!=(r=s.arrow)&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:a}}}}},k0=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=jJ(e,t),c={x:n,y:r},u=await GJ(t,l),d=UJ(LJ(o)),p=IJ(d);let f=c[p],h=c[d];if(i){f=MJ(f+u["y"===p?"top":"left"],f,f-u["y"===p?"bottom":"right"])}if(a){h=MJ(h+u["y"===d?"top":"left"],h,h-u["y"===d?"bottom":"right"])}const m=s.fn({...t,[p]:f,[d]:h});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[p]:i,[d]:a}}}}}},M0=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:a,initialPlacement:s,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:p,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...g}=jJ(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const v=LJ(o),y=UJ(s),b=LJ(s)===s,x=await(null==l.isRTL?void 0:l.isRTL(c.floating)),w=p||(b||!m?[BJ(s)]:function(e){const t=BJ(e);return[VJ(e),t,VJ(t)]}(s)),_="none"!==h;!p&&_&&w.push(...function(e,t,n,r){const o=DJ(e);let i=function(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],a=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:a;default:return[]}}(LJ(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(VJ)))),i}(s,m,h,x));const S=[s,...w],E=await GJ(t,g),T=[];let C=(null==(r=i.flip)?void 0:r.overflows)||[];if(u&&T.push(E[v]),d){const e=function(e,t,n){void 0===n&&(n=!1);const r=DJ(e),o=$J(e),i=FJ(o);let a="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=BJ(a)),[a,BJ(a)]}(o,a,x);T.push(E[e[0]],E[e[1]])}if(C=[...C,{placement:o,overflows:T}],!T.every((e=>e<=0))){var A,N;const e=((null==(A=i.flip)?void 0:A.index)||0)+1,t=S[e];if(t)return{data:{index:e,overflows:C},reset:{placement:t}};let n=null==(N=C.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:N.placement;if(!n)switch(f){case"bestFit":{var R;const e=null==(R=C.filter((e=>{if(_){const t=UJ(e.placement);return t===y||"y"===t}return!0})).map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:R[0];e&&(n=e);break}case"initialPlacement":n=s}if(o!==n)return{reset:{placement:n}}}return{}}}},j0=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:i,platform:a,elements:s}=t,{apply:l=()=>{},...c}=jJ(e,t),u=await GJ(t,c),d=LJ(o),p=DJ(o),f="y"===UJ(o),{width:h,height:m}=i.floating;let g,v;"top"===d||"bottom"===d?(g=d,v=p===(await(null==a.isRTL?void 0:a.isRTL(s.floating))?"start":"end")?"left":"right"):(v=d,g="end"===p?"top":"bottom");const y=m-u.top-u.bottom,b=h-u.left-u.right;let x=CJ(m-u[g],y),w=CJ(h-u[v],b);if(null!=(n=t.middlewareData.shift)&&n.enabled.x&&(w=b),null!=(r=t.middlewareData.shift)&&r.enabled.y&&(x=y),!t.middlewareData.shift&&!p){const e=AJ(u.left,0),t=AJ(u.right,0),n=AJ(u.top,0),r=AJ(u.bottom,0);f?w=h-2*(0!==e||0!==t?e+t:AJ(u.left,u.right)):x=m-2*(0!==n||0!==r?n+r:AJ(u.top,u.bottom))}await l({...t,availableWidth:w,availableHeight:x});const _=await a.getDimensions(s.floating);return h!==_.width||m!==_.height?{reset:{rects:!0}}:{}}}},L0=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=jJ(e,t);switch(r){case"referenceHidden":{const e=KJ(await GJ(t,{...o,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:WJ(e)}}}case"escaped":{const e=KJ(await GJ(t,{...o,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:WJ(e)}}}default:return{}}}}},D0=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:a,elements:s,middlewareData:l}=t,{element:c,padding:u=0}=jJ(e,t)||{};if(null==c)return{};const d=zJ(u),p={x:n,y:r},f=$J(o),h=FJ(f),m=await a.getDimensions(c),g="y"===f,v=g?"top":"left",y=g?"bottom":"right",b=g?"clientHeight":"clientWidth",x=i.reference[h]+i.reference[f]-p[f]-i.floating[h],w=p[f]-i.reference[f],_=await(null==a.getOffsetParent?void 0:a.getOffsetParent(c));let S=_?_[b]:0;S&&await(null==a.isElement?void 0:a.isElement(_))||(S=s.floating[b]||i.floating[h]);const E=x/2-w/2,T=S/2-m[h]/2-1,C=CJ(d[v],T),A=CJ(d[y],T),N=C,R=S-m[h]-A,O=S/2-m[h]/2+E,P=MJ(N,O,R),k=!l.arrow&&null!=DJ(o)&&O!==P&&i.reference[h]/2-(O<N?C:A)-m[h]/2<0,M=k?O<N?O-N:O-R:0;return{[f]:p[f]+M,data:{[f]:P,centerOffset:O-P-M,...k&&{alignmentOffset:M}},reset:k}}}),I0=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:a}=t,{offset:s=0,mainAxis:l=!0,crossAxis:c=!0}=jJ(e,t),u={x:n,y:r},d=UJ(o),p=IJ(d);let f=u[p],h=u[d];const m=jJ(s,t),g="number"==typeof m?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const e="y"===p?"height":"width",t=i.reference[p]-i.floating[e]+g.mainAxis,n=i.reference[p]+i.reference[e]-g.mainAxis;f<t?f=t:f>n&&(f=n)}if(c){var v,y;const e="y"===p?"width":"height",t=["top","left"].includes(LJ(o)),n=i.reference[d]-i.floating[e]+(t&&(null==(v=a.offset)?void 0:v[d])||0)+(t?0:g.crossAxis),r=i.reference[d]+i.reference[e]+(t?0:(null==(y=a.offset)?void 0:y[d])||0)-(t?g.crossAxis:0);h<n?h=n:h>r&&(h=r)}return{[p]:f,[d]:h}}}},F0=(e,t,n)=>{const r={platform:R0,...n},o={...r.platform,_c:new Map};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:a}=n,s=i.filter(Boolean),l=await(null==a.isRTL?void 0:a.isRTL(t));let c=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:d}=qJ(c,r,l),p=r,f={},h=0;for(let m=0;m<s.length;m++){const{name:n,fn:i}=s[m],{x:g,y:v,data:y,reset:b}=await i({x:u,y:d,initialPlacement:r,placement:p,strategy:o,middlewareData:f,rects:c,platform:a,elements:{reference:e,floating:t}});u=null!=g?g:u,d=null!=v?v:d,f={...f,[n]:{...f[n],...y}},b&&h<=50&&(h++,"object"==typeof b&&(b.placement&&(p=b.placement),b.rects&&(c=!0===b.rects?await a.getElementRects({reference:e,floating:t,strategy:o}):b.rects),({x:u,y:d}=qJ(c,p,l))),m=-1)}return{x:u,y:d,placement:p,strategy:o,middlewareData:f}})(e,t,{...r,platform:o})};var U0="undefined"!=typeof document?n.useLayoutEffect:n.useEffect;function $0(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!=r--;)if(!$0(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!=r--;){const n=o[r];if(("_owner"!==n||!e.$$typeof)&&!$0(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function V0(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function B0(e,t){const n=V0(e);return Math.round(t*n)/n}function z0(e){const t=i.useRef(e);return U0((()=>{t.current=e})),t}function H0(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:l}={},transform:c=!0,whileElementsMounted:u,open:d}=e,[p,f]=i.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,m]=i.useState(r);$0(h,r)||m(r);const[g,v]=i.useState(null),[y,b]=i.useState(null),x=i.useCallback((e=>{e!==E.current&&(E.current=e,v(e))}),[]),w=i.useCallback((e=>{e!==T.current&&(T.current=e,b(e))}),[]),_=s||g,S=l||y,E=i.useRef(null),T=i.useRef(null),C=i.useRef(p),A=null!=u,N=z0(u),R=z0(o),O=z0(d),P=i.useCallback((()=>{if(!E.current||!T.current)return;const e={placement:t,strategy:n,middleware:h};R.current&&(e.platform=R.current),F0(E.current,T.current,e).then((e=>{const t={...e,isPositioned:!1!==O.current};k.current&&!$0(C.current,t)&&(C.current=t,a.flushSync((()=>{f(t)})))}))}),[h,t,n,R,O]);U0((()=>{!1===d&&C.current.isPositioned&&(C.current.isPositioned=!1,f((e=>({...e,isPositioned:!1}))))}),[d]);const k=i.useRef(!1);U0((()=>(k.current=!0,()=>{k.current=!1})),[]),U0((()=>{if(_&&(E.current=_),S&&(T.current=S),_&&S){if(N.current)return N.current(_,S,P);P()}}),[_,S,P,N,A]);const M=i.useMemo((()=>({reference:E,floating:T,setReference:x,setFloating:w})),[x,w]),j=i.useMemo((()=>({reference:_,floating:S})),[_,S]),L=i.useMemo((()=>{const e={position:n,left:0,top:0};if(!j.floating)return e;const t=B0(j.floating,p.x),r=B0(j.floating,p.y);return c?{...e,transform:"translate("+t+"px, "+r+"px)",...V0(j.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}}),[n,c,j.floating,p.x,p.y]);return i.useMemo((()=>({...p,update:P,refs:M,elements:j,floatingStyles:L})),[p,P,M,j,L])}const q0=e=>({name:"arrow",options:e,fn(t){const{element:n,padding:r}="function"==typeof e?e(t):e;return n&&{}.hasOwnProperty.call(n,"current")?null!=n.current?D0({element:n.current,padding:r}).fn(t):{}:n?D0({element:n,padding:r}).fn(t):{}}}),G0=(e,t)=>({...P0(e),options:[e,t]}),K0=(e,t)=>({...k0(e),options:[e,t]}),W0=(e,t)=>({...I0(e),options:[e,t]}),Y0=(e,t)=>({...M0(e),options:[e,t]}),X0=(e,t)=>({...j0(e),options:[e,t]}),Z0=(e,t)=>({...L0(e),options:[e,t]}),Q0=(e,t)=>({...q0(e),options:[e,t]});var J0=i.forwardRef(((e,n)=>{const{children:r,width:o=10,height:i=5,...a}=e;return t.jsx(WQ.svg,{...a,ref:n,width:o,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:t.jsx("polygon",{points:"0,0 30,0 15,10"})})}));J0.displayName="Arrow";var e1=J0;function t1(e){const[t,n]=i.useState(void 0);return wJ((()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const t=new ResizeObserver((t=>{if(!Array.isArray(t))return;if(!t.length)return;const r=t[0];let o,i;if("borderBoxSize"in r){const e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;o=t.inlineSize,i=t.blockSize}else o=e.offsetWidth,i=e.offsetHeight;n({width:o,height:i})}));return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}n(void 0)}),[e]),t}var n1="Popper",[r1,o1]=UQ(n1),[i1,a1]=r1(n1),s1=e=>{const{__scopePopper:n,children:r}=e,[o,a]=i.useState(null);return t.jsx(i1,{scope:n,anchor:o,onAnchorChange:a,children:r})};s1.displayName=n1;var l1="PopperAnchor",c1=i.forwardRef(((e,n)=>{const{__scopePopper:r,virtualRef:o,...a}=e,s=a1(l1,r),l=i.useRef(null),c=XU(n,l);return i.useEffect((()=>{s.onAnchorChange(o?.current||l.current)})),o?null:t.jsx(WQ.div,{...a,ref:c})}));c1.displayName=l1;var u1="PopperContent",[d1,p1]=r1(u1),f1=i.forwardRef(((e,n)=>{const{__scopePopper:r,side:o="bottom",sideOffset:a=0,align:s="center",alignOffset:l=0,arrowPadding:c=0,avoidCollisions:u=!0,collisionBoundary:d=[],collisionPadding:p=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:m="optimized",onPlaced:g,...v}=e,y=a1(u1,r),[b,x]=i.useState(null),w=XU(n,(e=>x(e))),[_,S]=i.useState(null),E=t1(_),T=E?.width??0,C=E?.height??0,A=o+("center"!==s?"-"+s:""),N="number"==typeof p?p:{top:0,right:0,bottom:0,left:0,...p},R=Array.isArray(d)?d:[d],O=R.length>0,P={padding:N,boundary:R.filter(v1),altBoundary:O},{refs:k,floatingStyles:M,placement:j,isPositioned:L,middlewareData:D}=H0({strategy:"fixed",placement:A,whileElementsMounted:(...e)=>O0(...e,{animationFrame:"always"===m}),elements:{reference:y.anchor},middleware:[G0({mainAxis:a+C,alignmentAxis:l}),u&&K0({mainAxis:!0,crossAxis:!1,limiter:"partial"===f?W0():void 0,...P}),u&&Y0({...P}),X0({...P,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{const{width:o,height:i}=t.reference,a=e.floating.style;a.setProperty("--radix-popper-available-width",`${n}px`),a.setProperty("--radix-popper-available-height",`${r}px`),a.setProperty("--radix-popper-anchor-width",`${o}px`),a.setProperty("--radix-popper-anchor-height",`${i}px`)}}),_&&Q0({element:_,padding:c}),y1({arrowWidth:T,arrowHeight:C}),h&&Z0({strategy:"referenceHidden",...P})]}),[I,F]=b1(j),U=VQ(g);wJ((()=>{L&&U?.()}),[L,U]);const $=D.arrow?.x,V=D.arrow?.y,B=0!==D.arrow?.centerOffset,[z,H]=i.useState();return wJ((()=>{b&&H(window.getComputedStyle(b).zIndex)}),[b]),t.jsx("div",{ref:k.setFloating,"data-radix-popper-content-wrapper":"",style:{...M,transform:L?M.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:z,"--radix-popper-transform-origin":[D.transformOrigin?.x,D.transformOrigin?.y].join(" "),...D.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:t.jsx(d1,{scope:r,placedSide:I,onArrowChange:S,arrowX:$,arrowY:V,shouldHideArrow:B,children:t.jsx(WQ.div,{"data-side":I,"data-align":F,...v,ref:w,style:{...v.style,animation:L?void 0:"none"}})})})}));f1.displayName=u1;var h1="PopperArrow",m1={top:"bottom",right:"left",bottom:"top",left:"right"},g1=i.forwardRef((function(e,n){const{__scopePopper:r,...o}=e,i=p1(h1,r),a=m1[i.placedSide];return t.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:t.jsx(e1,{...o,ref:n,style:{...o.style,display:"block"}})})}));function v1(e){return null!==e}g1.displayName=h1;var y1=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:o}=t,i=0!==o.arrow?.centerOffset,a=i?0:e.arrowWidth,s=i?0:e.arrowHeight,[l,c]=b1(n),u={start:"0%",center:"50%",end:"100%"}[c],d=(o.arrow?.x??0)+a/2,p=(o.arrow?.y??0)+s/2;let f="",h="";return"bottom"===l?(f=i?u:`${d}px`,h=-s+"px"):"top"===l?(f=i?u:`${d}px`,h=`${r.floating.height+s}px`):"right"===l?(f=-s+"px",h=i?u:`${p}px`):"left"===l&&(f=`${r.floating.width+s}px`,h=i?u:`${p}px`),{data:{x:f,y:h}}}});function b1(e){const[t,n="center"]=e.split("-");return[t,n]}var x1=s1,w1=c1,_1=f1,S1=g1,E1=i.forwardRef(((e,n)=>{const{container:o,...a}=e,[s,l]=i.useState(!1);wJ((()=>l(!0)),[]);const c=o||s&&globalThis?.document?.body;return c?r.createPortal(t.jsx(WQ.div,{...a,ref:n}),c):null}));E1.displayName="Portal";var T1=e=>{const{present:t,children:n}=e,r=function(e){const[t,n]=i.useState(),r=i.useRef({}),o=i.useRef(e),a=i.useRef("none"),s=e?"mounted":"unmounted",[l,c]=function(e,t){return i.useReducer(((e,n)=>t[e][n]??e),e)}(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return i.useEffect((()=>{const e=C1(r.current);a.current="mounted"===l?e:"none"}),[l]),wJ((()=>{const t=r.current,n=o.current;if(n!==e){const r=a.current,i=C1(t);if(e)c("MOUNT");else if("none"===i||"none"===t?.display)c("UNMOUNT");else{c(n&&r!==i?"ANIMATION_OUT":"UNMOUNT")}o.current=e}}),[e,c]),wJ((()=>{if(t){let e;const n=t.ownerDocument.defaultView??window,i=i=>{const a=C1(r.current).includes(i.animationName);if(i.target===t&&a&&(c("ANIMATION_END"),!o.current)){const r=t.style.animationFillMode;t.style.animationFillMode="forwards",e=n.setTimeout((()=>{"forwards"===t.style.animationFillMode&&(t.style.animationFillMode=r)}))}},s=e=>{e.target===t&&(a.current=C1(r.current))};return t.addEventListener("animationstart",s),t.addEventListener("animationcancel",i),t.addEventListener("animationend",i),()=>{n.clearTimeout(e),t.removeEventListener("animationstart",s),t.removeEventListener("animationcancel",i),t.removeEventListener("animationend",i)}}c("ANIMATION_END")}),[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:i.useCallback((e=>{e&&(r.current=getComputedStyle(e)),n(e)}),[])}}(t),o="function"==typeof n?n({present:r.isPresent}):i.Children.only(n),a=XU(r.ref,function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(o));return"function"==typeof n||r.isPresent?i.cloneElement(o,{ref:a}):null};function C1(e){return e?.animationName||"none"}T1.displayName="Presence";var A1="rovingFocusGroup.onEntryFocus",N1={bubbles:!1,cancelable:!0},R1="RovingFocusGroup",[O1,P1,k1]=XQ(R1),[M1,j1]=UQ(R1,[k1]),[L1,D1]=M1(R1),I1=i.forwardRef(((e,n)=>t.jsx(O1.Provider,{scope:e.__scopeRovingFocusGroup,children:t.jsx(O1.Slot,{scope:e.__scopeRovingFocusGroup,children:t.jsx(F1,{...e,ref:n})})})));I1.displayName=R1;var F1=i.forwardRef(((e,n)=>{const{__scopeRovingFocusGroup:r,orientation:o,loop:a=!1,dir:s,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:d,preventScrollOnEntryFocus:p=!1,...f}=e,h=i.useRef(null),m=XU(n,h),g=QQ(s),[v=null,y]=BQ({prop:l,defaultProp:c,onChange:u}),[b,x]=i.useState(!1),w=VQ(d),_=P1(r),S=i.useRef(!1),[E,T]=i.useState(0);return i.useEffect((()=>{const e=h.current;if(e)return e.addEventListener(A1,w),()=>e.removeEventListener(A1,w)}),[w]),t.jsx(L1,{scope:r,orientation:o,dir:g,loop:a,currentTabStopId:v,onItemFocus:i.useCallback((e=>y(e)),[y]),onItemShiftTab:i.useCallback((()=>x(!0)),[]),onFocusableItemAdd:i.useCallback((()=>T((e=>e+1))),[]),onFocusableItemRemove:i.useCallback((()=>T((e=>e-1))),[]),children:t.jsx(WQ.div,{tabIndex:b||0===E?-1:0,"data-orientation":o,...f,ref:m,style:{outline:"none",...e.style},onMouseDown:FQ(e.onMouseDown,(()=>{S.current=!0})),onFocus:FQ(e.onFocus,(e=>{if(e.target===e.currentTarget&&!S.current&&!b){const t=new CustomEvent(A1,N1);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=_().filter((e=>e.focusable));B1([e.find((e=>e.active)),e.find((e=>e.id===v)),...e].filter(Boolean).map((e=>e.ref.current)),p)}}S.current=!1})),onBlur:FQ(e.onBlur,(()=>x(!1)))})})})),U1="RovingFocusGroupItem",$1=i.forwardRef(((e,n)=>{const{__scopeRovingFocusGroup:r,focusable:o=!0,active:a=!1,tabStopId:s,...l}=e,c=EJ(),u=s||c,d=D1(U1,r),p=d.currentTabStopId===u,f=P1(r),{onFocusableItemAdd:h,onFocusableItemRemove:m}=d;return i.useEffect((()=>{if(o)return h(),()=>m()}),[o,h,m]),t.jsx(O1.ItemSlot,{scope:r,id:u,focusable:o,active:a,children:t.jsx(WQ.span,{tabIndex:p?0:-1,"data-orientation":d.orientation,...l,ref:n,onMouseDown:FQ(e.onMouseDown,(e=>{o?d.onItemFocus(u):e.preventDefault()})),onFocus:FQ(e.onFocus,(()=>d.onItemFocus(u))),onKeyDown:FQ(e.onKeyDown,(e=>{if("Tab"===e.key&&e.shiftKey)return void d.onItemShiftTab();if(e.target!==e.currentTarget)return;const t=function(e,t,n){const r=function(e,t){return"rtl"!==t?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}(e.key,n);return"vertical"===t&&["ArrowLeft","ArrowRight"].includes(r)||"horizontal"===t&&["ArrowUp","ArrowDown"].includes(r)?void 0:V1[r]}(e,d.orientation,d.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let o=f().filter((e=>e.focusable)).map((e=>e.ref.current));if("last"===t)o.reverse();else if("prev"===t||"next"===t){"prev"===t&&o.reverse();const i=o.indexOf(e.currentTarget);o=d.loop?(r=i+1,(n=o).map(((e,t)=>n[(r+t)%n.length]))):o.slice(i+1)}setTimeout((()=>B1(o)))}var n,r}))})})}));$1.displayName=U1;var V1={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function B1(e,t=!1){const n=document.activeElement;for(const r of e){if(r===n)return;if(r.focus({preventScroll:t}),document.activeElement!==n)return}}var z1=I1,H1=$1,q1=["Enter"," "],G1=["ArrowUp","PageDown","End"],K1=["ArrowDown","PageUp","Home",...G1],W1={ltr:[...q1,"ArrowRight"],rtl:[...q1,"ArrowLeft"]},Y1={ltr:["ArrowLeft"],rtl:["ArrowRight"]},X1="Menu",[Z1,Q1,J1]=XQ(X1),[e2,t2]=UQ(X1,[J1,o1,j1]),n2=o1(),r2=j1(),[o2,i2]=e2(X1),[a2,s2]=e2(X1),l2=e=>{const{__scopeMenu:n,open:r=!1,children:o,dir:a,onOpenChange:s,modal:l=!0}=e,c=n2(n),[u,d]=i.useState(null),p=i.useRef(!1),f=VQ(s),h=QQ(a);return i.useEffect((()=>{const e=()=>{p.current=!0,document.addEventListener("pointerdown",t,{capture:!0,once:!0}),document.addEventListener("pointermove",t,{capture:!0,once:!0})},t=()=>p.current=!1;return document.addEventListener("keydown",e,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",t,{capture:!0}),document.removeEventListener("pointermove",t,{capture:!0})}}),[]),t.jsx(x1,{...c,children:t.jsx(o2,{scope:n,open:r,onOpenChange:f,content:u,onContentChange:d,children:t.jsx(a2,{scope:n,onClose:i.useCallback((()=>f(!1)),[f]),isUsingKeyboardRef:p,dir:h,modal:l,children:o})})})};l2.displayName=X1;var c2=i.forwardRef(((e,n)=>{const{__scopeMenu:r,...o}=e,i=n2(r);return t.jsx(w1,{...i,...o,ref:n})}));c2.displayName="MenuAnchor";var u2="MenuPortal",[d2,p2]=e2(u2,{forceMount:void 0}),f2=e=>{const{__scopeMenu:n,forceMount:r,children:o,container:i}=e,a=i2(u2,n);return t.jsx(d2,{scope:n,forceMount:r,children:t.jsx(T1,{present:r||a.open,children:t.jsx(E1,{asChild:!0,container:i,children:o})})})};f2.displayName=u2;var h2="MenuContent",[m2,g2]=e2(h2),v2=i.forwardRef(((e,n)=>{const r=p2(h2,e.__scopeMenu),{forceMount:o=r.forceMount,...i}=e,a=i2(h2,e.__scopeMenu),s=s2(h2,e.__scopeMenu);return t.jsx(Z1.Provider,{scope:e.__scopeMenu,children:t.jsx(T1,{present:o||a.open,children:t.jsx(Z1.Slot,{scope:e.__scopeMenu,children:t.jsx(s.modal?y2:b2,{...i,ref:n})})})})})),y2=i.forwardRef(((e,n)=>{const r=i2(h2,e.__scopeMenu),o=i.useRef(null),a=XU(n,o);return i.useEffect((()=>{const e=o.current;if(e)return LV(e)}),[]),t.jsx(x2,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:FQ(e.onFocusOutside,(e=>e.preventDefault()),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})})),b2=i.forwardRef(((e,n)=>{const r=i2(h2,e.__scopeMenu);return t.jsx(x2,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})})),x2=i.forwardRef(((e,n)=>{const{__scopeMenu:r,loop:o=!1,trapFocus:a,onOpenAutoFocus:s,onCloseAutoFocus:l,disableOutsidePointerEvents:c,onEntryFocus:u,onEscapeKeyDown:d,onPointerDownOutside:p,onFocusOutside:f,onInteractOutside:h,onDismiss:m,disableOutsideScroll:g,...v}=e,y=i2(h2,r),b=s2(h2,r),x=n2(r),w=r2(r),_=Q1(r),[S,E]=i.useState(null),T=i.useRef(null),C=XU(n,T,y.onContentChange),A=i.useRef(0),N=i.useRef(""),R=i.useRef(0),O=i.useRef(null),P=i.useRef("right"),k=i.useRef(0),M=g?NV:i.Fragment,j=g?{as:zQ,allowPinchZoom:!0}:void 0,L=e=>{const t=N.current+e,n=_().filter((e=>!e.disabled)),r=document.activeElement,o=n.find((e=>e.ref.current===r))?.textValue,i=function(e,t,n){const r=t.length>1&&Array.from(t).every((e=>e===t[0])),o=r?t[0]:t,i=n?e.indexOf(n):-1;let a=(s=e,l=Math.max(i,0),s.map(((e,t)=>s[(l+t)%s.length])));var s,l;1===o.length&&(a=a.filter((e=>e!==n)));const c=a.find((e=>e.toLowerCase().startsWith(o.toLowerCase())));return c!==n?c:void 0}(n.map((e=>e.textValue)),t,o),a=n.find((e=>e.textValue===i))?.ref.current;!function e(t){N.current=t,window.clearTimeout(A.current),""!==t&&(A.current=window.setTimeout((()=>e("")),1e3))}(t),a&&setTimeout((()=>a.focus()))};i.useEffect((()=>()=>window.clearTimeout(A.current)),[]),cJ();const D=i.useCallback((e=>P.current===O.current?.side&&function(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return function(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,a=t.length-1;i<t.length;a=i++){const e=t[i].x,s=t[i].y,l=t[a].y;s>r!=l>r&&n<(t[a].x-e)*(r-s)/(l-s)+e&&(o=!o)}return o}(n,t)}(e,O.current?.area)),[]);return t.jsx(m2,{scope:r,searchRef:N,onItemEnter:i.useCallback((e=>{D(e)&&e.preventDefault()}),[D]),onItemLeave:i.useCallback((e=>{D(e)||(T.current?.focus(),E(null))}),[D]),onTriggerLeave:i.useCallback((e=>{D(e)&&e.preventDefault()}),[D]),pointerGraceTimerRef:R,onPointerGraceIntentChange:i.useCallback((e=>{O.current=e}),[]),children:t.jsx(M,{...j,children:t.jsx(hJ,{asChild:!0,trapped:a,onMountAutoFocus:FQ(s,(e=>{e.preventDefault(),T.current?.focus({preventScroll:!0})})),onUnmountAutoFocus:l,children:t.jsx(iJ,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:d,onPointerDownOutside:p,onFocusOutside:f,onInteractOutside:h,onDismiss:m,children:t.jsx(z1,{asChild:!0,...w,dir:b.dir,orientation:"vertical",loop:o,currentTabStopId:S,onCurrentTabStopIdChange:E,onEntryFocus:FQ(u,(e=>{b.isUsingKeyboardRef.current||e.preventDefault()})),preventScrollOnEntryFocus:!0,children:t.jsx(_1,{role:"menu","aria-orientation":"vertical","data-state":G2(y.open),"data-radix-menu-content":"",dir:b.dir,...x,...v,ref:C,style:{outline:"none",...v.style},onKeyDown:FQ(v.onKeyDown,(e=>{const t=e.target.closest("[data-radix-menu-content]")===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=1===e.key.length;t&&("Tab"===e.key&&e.preventDefault(),!n&&r&&L(e.key));if(e.target!==T.current)return;if(!K1.includes(e.key))return;e.preventDefault();const o=_().filter((e=>!e.disabled)).map((e=>e.ref.current));G1.includes(e.key)&&o.reverse(),function(e){const t=document.activeElement;for(const n of e){if(n===t)return;if(n.focus(),document.activeElement!==t)return}}(o)})),onBlur:FQ(e.onBlur,(e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(A.current),N.current="")})),onPointerMove:FQ(e.onPointerMove,Y2((e=>{const t=k.current!==e.clientX;if(e.currentTarget.contains(e.target)&&t){P.current=e.clientX>k.current?"right":"left",k.current=e.clientX}})))})})})})})})}));v2.displayName=h2;var w2=i.forwardRef(((e,n)=>{const{__scopeMenu:r,...o}=e;return t.jsx(WQ.div,{role:"group",...o,ref:n})}));w2.displayName="MenuGroup";var _2=i.forwardRef(((e,n)=>{const{__scopeMenu:r,...o}=e;return t.jsx(WQ.div,{...o,ref:n})}));_2.displayName="MenuLabel";var S2="MenuItem",E2="menu.itemSelect",T2=i.forwardRef(((e,n)=>{const{disabled:r=!1,onSelect:o,...a}=e,s=i.useRef(null),l=s2(S2,e.__scopeMenu),c=g2(S2,e.__scopeMenu),u=XU(n,s),d=i.useRef(!1);return t.jsx(C2,{...a,ref:u,disabled:r,onClick:FQ(e.onClick,(()=>{const e=s.current;if(!r&&e){const t=new CustomEvent(E2,{bubbles:!0,cancelable:!0});e.addEventListener(E2,(e=>o?.(e)),{once:!0}),YQ(e,t),t.defaultPrevented?d.current=!1:l.onClose()}})),onPointerDown:t=>{e.onPointerDown?.(t),d.current=!0},onPointerUp:FQ(e.onPointerUp,(e=>{d.current||e.currentTarget?.click()})),onKeyDown:FQ(e.onKeyDown,(e=>{r||""!==c.searchRef.current&&" "===e.key||q1.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())}))})}));T2.displayName=S2;var C2=i.forwardRef(((e,n)=>{const{__scopeMenu:r,disabled:o=!1,textValue:a,...s}=e,l=g2(S2,r),c=r2(r),u=i.useRef(null),d=XU(n,u),[p,f]=i.useState(!1),[h,m]=i.useState("");return i.useEffect((()=>{const e=u.current;e&&m((e.textContent??"").trim())}),[s.children]),t.jsx(Z1.ItemSlot,{scope:r,disabled:o,textValue:a??h,children:t.jsx(H1,{asChild:!0,...c,focusable:!o,children:t.jsx(WQ.div,{role:"menuitem","data-highlighted":p?"":void 0,"aria-disabled":o||void 0,"data-disabled":o?"":void 0,...s,ref:d,onPointerMove:FQ(e.onPointerMove,Y2((e=>{if(o)l.onItemLeave(e);else if(l.onItemEnter(e),!e.defaultPrevented){e.currentTarget.focus({preventScroll:!0})}}))),onPointerLeave:FQ(e.onPointerLeave,Y2((e=>l.onItemLeave(e)))),onFocus:FQ(e.onFocus,(()=>f(!0))),onBlur:FQ(e.onBlur,(()=>f(!1)))})})})})),A2=i.forwardRef(((e,n)=>{const{checked:r=!1,onCheckedChange:o,...i}=e;return t.jsx(L2,{scope:e.__scopeMenu,checked:r,children:t.jsx(T2,{role:"menuitemcheckbox","aria-checked":K2(r)?"mixed":r,...i,ref:n,"data-state":W2(r),onSelect:FQ(i.onSelect,(()=>o?.(!!K2(r)||!r)),{checkForDefaultPrevented:!1})})})}));A2.displayName="MenuCheckboxItem";var N2="MenuRadioGroup",[R2,O2]=e2(N2,{value:void 0,onValueChange:()=>{}}),P2=i.forwardRef(((e,n)=>{const{value:r,onValueChange:o,...i}=e,a=VQ(o);return t.jsx(R2,{scope:e.__scopeMenu,value:r,onValueChange:a,children:t.jsx(w2,{...i,ref:n})})}));P2.displayName=N2;var k2="MenuRadioItem",M2=i.forwardRef(((e,n)=>{const{value:r,...o}=e,i=O2(k2,e.__scopeMenu),a=r===i.value;return t.jsx(L2,{scope:e.__scopeMenu,checked:a,children:t.jsx(T2,{role:"menuitemradio","aria-checked":a,...o,ref:n,"data-state":W2(a),onSelect:FQ(o.onSelect,(()=>i.onValueChange?.(r)),{checkForDefaultPrevented:!1})})})}));M2.displayName=k2;var j2="MenuItemIndicator",[L2,D2]=e2(j2,{checked:!1}),I2=i.forwardRef(((e,n)=>{const{__scopeMenu:r,forceMount:o,...i}=e,a=D2(j2,r);return t.jsx(T1,{present:o||K2(a.checked)||!0===a.checked,children:t.jsx(WQ.span,{...i,ref:n,"data-state":W2(a.checked)})})}));I2.displayName=j2;var F2=i.forwardRef(((e,n)=>{const{__scopeMenu:r,...o}=e;return t.jsx(WQ.div,{role:"separator","aria-orientation":"horizontal",...o,ref:n})}));F2.displayName="MenuSeparator";var U2=i.forwardRef(((e,n)=>{const{__scopeMenu:r,...o}=e,i=n2(r);return t.jsx(S1,{...i,...o,ref:n})}));U2.displayName="MenuArrow";var[$2,V2]=e2("MenuSub"),B2="MenuSubTrigger",z2=i.forwardRef(((e,n)=>{const r=i2(B2,e.__scopeMenu),o=s2(B2,e.__scopeMenu),a=V2(B2,e.__scopeMenu),s=g2(B2,e.__scopeMenu),l=i.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:u}=s,d={__scopeMenu:e.__scopeMenu},p=i.useCallback((()=>{l.current&&window.clearTimeout(l.current),l.current=null}),[]);return i.useEffect((()=>p),[p]),i.useEffect((()=>{const e=c.current;return()=>{window.clearTimeout(e),u(null)}}),[c,u]),t.jsx(c2,{asChild:!0,...d,children:t.jsx(C2,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":a.contentId,"data-state":G2(r.open),...e,ref:YU(n,a.onTriggerChange),onClick:t=>{e.onClick?.(t),e.disabled||t.defaultPrevented||(t.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:FQ(e.onPointerMove,Y2((t=>{s.onItemEnter(t),t.defaultPrevented||e.disabled||r.open||l.current||(s.onPointerGraceIntentChange(null),l.current=window.setTimeout((()=>{r.onOpenChange(!0),p()}),100))}))),onPointerLeave:FQ(e.onPointerLeave,Y2((e=>{p();const t=r.content?.getBoundingClientRect();if(t){const n=r.content?.dataset.side,o="right"===n,i=t[o?"left":"right"],a=t[o?"right":"left"];s.onPointerGraceIntentChange({area:[{x:e.clientX+(o?-5:5),y:e.clientY},{x:i,y:t.top},{x:a,y:t.top},{x:a,y:t.bottom},{x:i,y:t.bottom}],side:n}),window.clearTimeout(c.current),c.current=window.setTimeout((()=>s.onPointerGraceIntentChange(null)),300)}else{if(s.onTriggerLeave(e),e.defaultPrevented)return;s.onPointerGraceIntentChange(null)}}))),onKeyDown:FQ(e.onKeyDown,(t=>{e.disabled||""!==s.searchRef.current&&" "===t.key||W1[o.dir].includes(t.key)&&(r.onOpenChange(!0),r.content?.focus(),t.preventDefault())}))})})}));z2.displayName=B2;var H2="MenuSubContent",q2=i.forwardRef(((e,n)=>{const r=p2(h2,e.__scopeMenu),{forceMount:o=r.forceMount,...a}=e,s=i2(h2,e.__scopeMenu),l=s2(h2,e.__scopeMenu),c=V2(H2,e.__scopeMenu),u=i.useRef(null),d=XU(n,u);return t.jsx(Z1.Provider,{scope:e.__scopeMenu,children:t.jsx(T1,{present:o||s.open,children:t.jsx(Z1.Slot,{scope:e.__scopeMenu,children:t.jsx(x2,{id:c.contentId,"aria-labelledby":c.triggerId,...a,ref:d,align:"start",side:"rtl"===l.dir?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{l.isUsingKeyboardRef.current&&u.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:FQ(e.onFocusOutside,(e=>{e.target!==c.trigger&&s.onOpenChange(!1)})),onEscapeKeyDown:FQ(e.onEscapeKeyDown,(e=>{l.onClose(),e.preventDefault()})),onKeyDown:FQ(e.onKeyDown,(e=>{const t=e.currentTarget.contains(e.target),n=Y1[l.dir].includes(e.key);t&&n&&(s.onOpenChange(!1),c.trigger?.focus(),e.preventDefault())}))})})})})}));function G2(e){return e?"open":"closed"}function K2(e){return"indeterminate"===e}function W2(e){return K2(e)?"indeterminate":e?"checked":"unchecked"}function Y2(e){return t=>"mouse"===t.pointerType?e(t):void 0}q2.displayName=H2;var X2=l2,Z2=c2,Q2=f2,J2=v2,e3=w2,t3=_2,n3=T2,r3=A2,o3=P2,i3=M2,a3=I2,s3=F2,l3=U2,c3=z2,u3=q2,d3="DropdownMenu",[p3,f3]=UQ(d3,[t2]),h3=t2(),[m3,g3]=p3(d3),v3=e=>{const{__scopeDropdownMenu:n,children:r,dir:o,open:a,defaultOpen:s,onOpenChange:l,modal:c=!0}=e,u=h3(n),d=i.useRef(null),[p=!1,f]=BQ({prop:a,defaultProp:s,onChange:l});return t.jsx(m3,{scope:n,triggerId:EJ(),triggerRef:d,contentId:EJ(),open:p,onOpenChange:f,onOpenToggle:i.useCallback((()=>f((e=>!e))),[f]),modal:c,children:t.jsx(X2,{...u,open:p,onOpenChange:f,dir:o,modal:c,children:r})})};v3.displayName=d3;var y3="DropdownMenuTrigger",b3=i.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,disabled:o=!1,...i}=e,a=g3(y3,r),s=h3(r);return t.jsx(Z2,{asChild:!0,...s,children:t.jsx(WQ.button,{type:"button",id:a.triggerId,"aria-haspopup":"menu","aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?"open":"closed","data-disabled":o?"":void 0,disabled:o,...i,ref:YU(n,a.triggerRef),onPointerDown:FQ(e.onPointerDown,(e=>{o||0!==e.button||!1!==e.ctrlKey||(a.onOpenToggle(),a.open||e.preventDefault())})),onKeyDown:FQ(e.onKeyDown,(e=>{o||(["Enter"," "].includes(e.key)&&a.onOpenToggle(),"ArrowDown"===e.key&&a.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(e.key)&&e.preventDefault())}))})})}));b3.displayName=y3;var x3=e=>{const{__scopeDropdownMenu:n,...r}=e,o=h3(n);return t.jsx(Q2,{...o,...r})};x3.displayName="DropdownMenuPortal";var w3="DropdownMenuContent",_3=i.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,a=g3(w3,r),s=h3(r),l=i.useRef(!1);return t.jsx(J2,{id:a.contentId,"aria-labelledby":a.triggerId,...s,...o,ref:n,onCloseAutoFocus:FQ(e.onCloseAutoFocus,(e=>{l.current||a.triggerRef.current?.focus(),l.current=!1,e.preventDefault()})),onInteractOutside:FQ(e.onInteractOutside,(e=>{const t=e.detail.originalEvent;a.modal&&!(2===t.button||0===t.button&&!0===t.ctrlKey)||(l.current=!0)})),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})}));_3.displayName=w3;i.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=h3(r);return t.jsx(e3,{...i,...o,ref:n})})).displayName="DropdownMenuGroup";var S3=i.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=h3(r);return t.jsx(t3,{...i,...o,ref:n})}));S3.displayName="DropdownMenuLabel";var E3=i.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=h3(r);return t.jsx(n3,{...i,...o,ref:n})}));E3.displayName="DropdownMenuItem";var T3=i.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=h3(r);return t.jsx(r3,{...i,...o,ref:n})}));T3.displayName="DropdownMenuCheckboxItem";i.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=h3(r);return t.jsx(o3,{...i,...o,ref:n})})).displayName="DropdownMenuRadioGroup";var C3=i.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=h3(r);return t.jsx(i3,{...i,...o,ref:n})}));C3.displayName="DropdownMenuRadioItem";var A3=i.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=h3(r);return t.jsx(a3,{...i,...o,ref:n})}));A3.displayName="DropdownMenuItemIndicator";var N3=i.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=h3(r);return t.jsx(s3,{...i,...o,ref:n})}));N3.displayName="DropdownMenuSeparator";i.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=h3(r);return t.jsx(l3,{...i,...o,ref:n})})).displayName="DropdownMenuArrow";var R3=i.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=h3(r);return t.jsx(c3,{...i,...o,ref:n})}));R3.displayName="DropdownMenuSubTrigger";var O3=i.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=h3(r);return t.jsx(u3,{...i,...o,ref:n,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})}));O3.displayName="DropdownMenuSubContent";var P3=x3,k3=_3,M3=S3,j3=E3,L3=T3,D3=C3,I3=A3,F3=N3,U3=R3,$3=O3;const V3=v3,B3=b3;i.forwardRef((({className:e,inset:n,children:r,...o},i)=>t.jsxs(U3,{ref:i,className:Zd("flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",n&&"pl-8",e),...o,children:[r,t.jsx(mu,{className:"ml-auto"})]}))).displayName=U3.displayName;i.forwardRef((({className:e,...n},r)=>t.jsx($3,{ref:r,className:Zd("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n}))).displayName=$3.displayName;const z3=i.forwardRef((({className:e,sideOffset:n=4,...r},o)=>t.jsx(P3,{children:t.jsx(k3,{ref:o,sideOffset:n,className:Zd("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})})));z3.displayName=k3.displayName;const H3=i.forwardRef((({className:e,inset:n,...r},o)=>t.jsx(j3,{ref:o,className:Zd("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",n&&"pl-8",e),...r})));H3.displayName=j3.displayName;i.forwardRef((({className:e,children:n,checked:r,...o},i)=>t.jsxs(L3,{ref:i,className:Zd("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:r,...o,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(I3,{children:t.jsx(pu,{className:"h-4 w-4"})})}),n]}))).displayName=L3.displayName;i.forwardRef((({className:e,children:n,...r},o)=>t.jsxs(D3,{ref:o,className:Zd("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(I3,{children:t.jsx(wu,{className:"h-2 w-2 fill-current"})})}),n]}))).displayName=D3.displayName;i.forwardRef((({className:e,inset:n,...r},o)=>t.jsx(M3,{ref:o,className:Zd("px-2 py-1.5 text-sm font-semibold",n&&"pl-8",e),...r}))).displayName=M3.displayName;i.forwardRef((({className:e,...n},r)=>t.jsx(F3,{ref:r,className:Zd("-mx-1 my-1 h-px bg-muted",e),...n}))).displayName=F3.displayName;const q3=i.forwardRef((({className:e,type:n,...r},o)=>t.jsx("input",{type:n,className:Zd("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:o,...r})));function G3({data:e,columns:t,enableDebug:r=!1,paginationMode:o="none",initialPageSize:a=10,initialPageIndex:s=0,cursorPaginationQueryResult:l,onQueryParametersChange:c,manualPageCount:u}){const d=n.useMemo((()=>e),[e]),p=n.useMemo((()=>t),[t]),f="cursor"===o,h=l,[m,g]=n.useState(s),[v,y]=n.useState([void 0]),[b,x]=n.useState(a);n.useEffect((()=>{if(f&&h){const{isLoading:e,isFetching:t,isPlaceholderData:n,nextCursor:r}=h;e||t||n||!r||""===r?e||t||n||r&&""!==r||!(v.length>m+1)||y((e=>e.slice(0,m+1))):v.length===m+1&&y((e=>[...e,r]))}}),[f,h,m,v]);const w=n.useCallback((()=>{f&&(g(s),y([void 0]),x(a),c&&c({cursor:void 0,pageSize:a}))}),[f,c,a,s]),[_,S]=n.useState({pageIndex:f?m:s,pageSize:b});n.useEffect((()=>{f&&_.pageIndex!==m&&S((e=>({...e,pageIndex:m})))}),[m,_.pageIndex,f]);const E=n.useCallback((e=>{if(!f||!c)return;let t,n=m,r=b;"object"==typeof e?(r=e.newPageSize,n=0,x(r),g(n),y([void 0]),c({cursor:void 0,pageSize:r})):"prev"===e?(n=Math.max(m-1,0),t=v[n],g(n),c({cursor:t,pageSize:b})):"next"===e&&h&&h.nextCursor&&""!==h.nextCursor&&(n=m+1,t=h.nextCursor,g(n),c({cursor:t,pageSize:b}))}),[f,c,m,v,b,h]),T=f&&m>0,C=!!(f&&h&&h.nextCursor&&""!==h.nextCursor),[A,N]=n.useState(""),R=function(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=i.useState((()=>({current:LQ(t)}))),[r,o]=i.useState((()=>n.current.initialState));return n.current.setOptions((t=>({...t,...e,state:{...r,...e.state},onStateChange:t=>{o(t),null==e.onStateChange||e.onStateChange(t)}}))),n.current}({data:d,columns:p,state:{globalFilter:A,pagination:_},getCoreRowModel:e=>QZ((()=>[e.options.data]),(t=>{const n={rows:[],flatRows:[],rowsById:{}},r=function(t,o,i){void 0===o&&(o=0);const a=[];for(let l=0;l<t.length;l++){const c=oQ(e,e._getRowId(t[l],l,i),t[l],l,o,0,null==i?void 0:i.id);var s;n.flatRows.push(c),n.rowsById[c.id]=c,a.push(c),e.options.getSubRows&&(c.originalSubRows=e.options.getSubRows(t[l],l),null!=(s=c.originalSubRows)&&s.length&&(c.subRows=r(c.originalSubRows,o+1,c)))}return a};return n.rows=r(t),n}),JZ(e.options,"debugTable","getRowModel",(()=>e._autoResetPageIndex()))),getFilteredRowModel:e=>QZ((()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter]),((t,n,r)=>{if(!t.rows.length||(null==n||!n.length)&&!r){for(let e=0;e<t.flatRows.length;e++)t.flatRows[e].columnFilters={},t.flatRows[e].columnFiltersMeta={};return t}const o=[],i=[];(null!=n?n:[]).forEach((t=>{var n;const r=e.getColumn(t.id);if(!r)return;const i=r.getFilterFn();i?o.push({id:t.id,filterFn:i,resolvedValue:null!=(n=null==i.resolveFilterValue?void 0:i.resolveFilterValue(t.value))?n:t.value}):process}));const a=(null!=n?n:[]).map((e=>e.id)),s=e.getGlobalFilterFn(),l=e.getAllLeafColumns().filter((e=>e.getCanGlobalFilter()));let c,u;r&&s&&l.length&&(a.push("__global__"),l.forEach((e=>{var t;i.push({id:e.id,filterFn:s,resolvedValue:null!=(t=null==s.resolveFilterValue?void 0:s.resolveFilterValue(r))?t:r})})));for(let e=0;e<t.flatRows.length;e++){const n=t.flatRows[e];if(n.columnFilters={},o.length)for(let e=0;e<o.length;e++){c=o[e];const t=c.id;n.columnFilters[t]=c.filterFn(n,t,c.resolvedValue,(e=>{n.columnFiltersMeta[t]=e}))}if(i.length){for(let e=0;e<i.length;e++){u=i[e];const t=u.id;if(u.filterFn(n,t,u.resolvedValue,(e=>{n.columnFiltersMeta[t]=e}))){n.columnFilters.__global__=!0;break}}!0!==n.columnFilters.__global__&&(n.columnFilters.__global__=!1)}}return DQ(t.rows,(e=>{for(let t=0;t<a.length;t++)if(!1===e.columnFilters[a[t]])return!1;return!0}),e)}),JZ(e.options,"debugTable","getFilteredRowModel",(()=>e._autoResetPageIndex()))),onGlobalFilterChange:N,onPaginationChange:S,..."standard"===o&&{getPaginationRowModel:e=>QZ((()=>[e.getState().pagination,e.getPrePaginationRowModel(),e.options.paginateExpandedRows?void 0:e.getState().expanded]),((t,n)=>{if(!n.rows.length)return n;const{pageSize:r,pageIndex:o}=t;let{rows:i,flatRows:a,rowsById:s}=n;const l=r*o;let c;i=i.slice(l,l+r),c=e.options.paginateExpandedRows?{rows:i,flatRows:a,rowsById:s}:function(e){const t=[],n=e=>{var r;t.push(e),null!=(r=e.subRows)&&r.length&&e.getIsExpanded()&&e.subRows.forEach(n)};return e.rows.forEach(n),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}({rows:i,flatRows:a,rowsById:s}),c.flatRows=[];const u=e=>{c.flatRows.push(e),e.subRows.length&&e.subRows.forEach(u)};return c.rows.forEach(u),c}),JZ(e.options,"debugTable","getPaginationRowModel")),pageCount:void 0!==u?u:void 0},...f&&{manualPagination:!0,pageCount:void 0!==u?u:-1},debugTable:r,debugHeaders:r,debugColumns:r});n.useEffect((()=>{!f&&R&&R.getState().pagination.pageIndex!==s&&R.setPageIndex(s)}),[s,R,f]),n.useEffect((()=>{R&&R.getState().pagination.pageSize!==b&&R.setPageSize(b)}),[b,R]);const O=f?v[m]:void 0;return{...R,setGlobalFilter:N,globalFilter:A,...f&&{currentApiCursor:O,handleCursorNavigation:E,canGoPreviousForCursor:T,canGoNextForCursor:C,resetCursorPagination:w,logicalPage:m}}}function K3({data:e,columns:r,enableDebug:o=!1,paginationMode:i="none",initialPageSize:a=10,initialPageIndex:s=0,headerActions:l,isLoading:c=!1,cursorPaginationQueryResult:u,onQueryParametersChange:d,searchValue:p,onSearchChange:f,onRowClick:h}){const m=G3({data:e??[],columns:r,enableDebug:o,paginationMode:i,initialPageSize:a,initialPageIndex:s,cursorPaginationQueryResult:u,onQueryParametersChange:d}),g=n.useRef(null),[v,y]=n.useState(!1),b="standard"===i,x="cursor"===i,w=x?m.canGoPreviousForCursor??!1:m.getCanPreviousPage(),_=x?m.canGoNextForCursor??!1:m.getCanNextPage(),S=!b&&!x||c?null:t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx(vZ,{"data-testid":"previous-button",variant:"outline",size:"sm",className:"bg-card",onClick:()=>{x&&m.handleCursorNavigation?m.handleCursorNavigation("prev"):m.previousPage()},disabled:!w||c,children:t.jsx(hu,{className:"h-4 w-4 mr-1"})}),b&&t.jsxs("span",{className:"text-sm text-muted-foreground",children:["Page ",m.getState().pagination.pageIndex+1," of"," ",-1===m.getPageCount()?"many":m.getPageCount()]}),t.jsx(vZ,{"data-testid":"next-button",variant:"outline",size:"sm",className:"bg-card",onClick:()=>{x&&m.handleCursorNavigation?m.handleCursorNavigation("next"):m.nextPage()},disabled:!_||c,children:t.jsx(mu,{className:"h-4 w-4 ml-1"})}),t.jsxs(V3,{children:[t.jsx(B3,{asChild:!0,children:t.jsxs(vZ,{variant:"outline",size:"sm",className:"bg-card",disabled:c,children:[m.getState().pagination.pageSize," rows",t.jsx(fu,{className:"ml-1 h-4 w-4"})]})}),t.jsx(z3,{align:"end",children:[5,10,20,30,50].map((e=>t.jsxs(H3,{onClick:()=>{x&&m.handleCursorNavigation?m.handleCursorNavigation({newPageSize:e}):m.setPageSize(e)},children:[e," rows"]},e)))})]})]}),E=()=>t.jsxs(zZ,{className:"flex-grow min-h-0 relative",children:[t.jsx(HZ,{className:Zd("sticky top-0 z-10",v&&"shadow-md border-b border-slate-200"),children:m.getHeaderGroups().map((e=>t.jsx(GZ,{children:e.headers.map((e=>t.jsx(KZ,{colSpan:e.colSpan,children:e.isPlaceholder?null:IQ(e.column.columnDef.header,e.getContext())},e.id)))},e.id)))}),t.jsx(qZ,{children:m.getRowModel().rows.length?m.getRowModel().rows.map((e=>t.jsx(GZ,{className:Zd("rounded-b-md",h&&"cursor-pointer hover:bg-muted/90 transition-colors"),"data-state":e.getIsSelected()&&"selected",onClick:()=>h?.(e.original),children:e.getVisibleCells().map((e=>t.jsx(WZ,{children:IQ(e.column.columnDef.cell,e.getContext())},e.id)))},e.id))):t.jsx(GZ,{children:t.jsx(WZ,{colSpan:r.length,className:"h-24 text-center",children:"No results found"})})})]}),T=()=>t.jsx("div",{className:"h-full w-full flex items-center justify-center",children:t.jsx(hZ,{})});return t.jsxs("div",{className:"flex flex-col h-full border rounded-lg shadow-sm hover:shadow-md transition-shadow duration-300 overflow-hidden",children:[t.jsxs("div",{className:"flex flex-col items-start gap-3 py-4 px-2 sticky top-0 z-20 bg-primary/5 border-b rounded-t-md md:flex-row md:items-center md:justify-between",children:[t.jsx("div",{className:"w-full md:w-1/4",children:t.jsx(q3,{placeholder:"Search...",value:p??m.getState().globalFilter??"",onChange:e=>{const t=e.target.value;f?f(t):m.setGlobalFilter(t)},className:"max-w-sm bg-card",disabled:c})}),t.jsxs("div",{className:"flex items-center space-x-4",children:[S,l&&t.jsx("div",{children:l})]})]}),t.jsx("div",{ref:g,className:"w-full overflow-x-auto h-full",onScroll:()=>{g.current&&y(g.current.scrollTop>0)},children:t.jsx(c?T:E,{})}),o&&t.jsx("div",{className:"mt-4",children:t.jsx("pre",{className:"p-2 bg-gray-50 text-xs overflow-x-auto",children:t.jsx("code",{children:JSON.stringify(m.getState(),null,2)})})})]})}q3.displayName="Input";var W3={};Object.defineProperty(W3,"__esModule",{value:!0}),W3.parse=function(e,t){const n=new e5,r=e.length;if(r<2)return n;const o=t?.decode||r5;let i=0;do{const t=e.indexOf("=",i);if(-1===t)break;const a=e.indexOf(";",i),s=-1===a?r:a;if(t>s){i=e.lastIndexOf(";",t-1)+1;continue}const l=t5(e,i,t),c=n5(e,t,l),u=e.slice(l,c);if(void 0===n[u]){let r=t5(e,t+1,s),i=n5(e,s,r);const a=o(e.slice(r,i));n[u]=a}i=s+1}while(i<r);return n},W3.serialize=function(e,t,n){const r=n?.encode||encodeURIComponent;if(!Y3.test(e))throw new TypeError(`argument name is invalid: ${e}`);const o=r(t);if(!X3.test(o))throw new TypeError(`argument val is invalid: ${t}`);let i=e+"="+o;if(!n)return i;if(void 0!==n.maxAge){if(!Number.isInteger(n.maxAge))throw new TypeError(`option maxAge is invalid: ${n.maxAge}`);i+="; Max-Age="+n.maxAge}if(n.domain){if(!Z3.test(n.domain))throw new TypeError(`option domain is invalid: ${n.domain}`);i+="; Domain="+n.domain}if(n.path){if(!Q3.test(n.path))throw new TypeError(`option path is invalid: ${n.path}`);i+="; Path="+n.path}if(n.expires){if(!function(e){return"[object Date]"===J3.call(e)}
|
|
75
|
+
function IQ(e,t){return e?function(e){return"function"==typeof e&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}(n=e)||"function"==typeof n||function(e){return"object"==typeof e&&"symbol"==typeof e.$$typeof&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}(n)?i.createElement(e,t):e:null;var n}function FQ(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),!1===n||!r.defaultPrevented)return t?.(r)}}function UQ(e,n=[]){let r=[];const o=()=>{const t=r.map((e=>i.createContext(e)));return function(n){const r=n?.[e]||t;return i.useMemo((()=>({[`__scope${e}`]:{...n,[e]:r}})),[n,r])}};return o.scopeName=e,[function(n,o){const a=i.createContext(o),s=r.length;r=[...r,o];const l=n=>{const{scope:r,children:o,...l}=n,c=r?.[e]?.[s]||a,u=i.useMemo((()=>l),Object.values(l));return t.jsx(c.Provider,{value:u,children:o})};return l.displayName=n+"Provider",[l,function(t,r){const l=i.useContext(r?.[e]?.[s]||a);if(l)return l;if(void 0!==o)return o;throw new Error(`\`${t}\` must be used within \`${n}\``)}]},$Q(o,...n)]}function $Q(...e){const t=e[0];if(1===e.length)return t;const n=()=>{const n=e.map((e=>({useScope:e(),scopeName:e.scopeName})));return function(e){const r=n.reduce(((t,{useScope:n,scopeName:r})=>({...t,...n(e)[`__scope${r}`]})),{});return i.useMemo((()=>({[`__scope${t.scopeName}`]:r})),[r])}};return n.scopeName=t.scopeName,n}function VQ(e){const t=i.useRef(e);return i.useEffect((()=>{t.current=e})),i.useMemo((()=>(...e)=>t.current?.(...e)),[])}function BQ({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=function({defaultProp:e,onChange:t}){const n=i.useState(e),[r]=n,o=i.useRef(r),a=VQ(t);return i.useEffect((()=>{o.current!==r&&(a(r),o.current=r)}),[r,o,a]),n}({defaultProp:t,onChange:n}),a=void 0!==e,s=a?e:r,l=VQ(n);return[s,i.useCallback((t=>{if(a){const n="function"==typeof t?t(e):t;n!==e&&l(n)}else o(t)}),[a,e,o,l])]}var zQ=i.forwardRef(((e,n)=>{const{children:r,...o}=e,a=i.Children.toArray(r),s=a.find(GQ);if(s){const e=s.props.children,r=a.map((t=>t===s?i.Children.count(e)>1?i.Children.only(null):i.isValidElement(e)?e.props.children:null:t));return t.jsx(HQ,{...o,ref:n,children:i.isValidElement(e)?i.cloneElement(e,void 0,r):null})}return t.jsx(HQ,{...o,ref:n,children:r})}));zQ.displayName="Slot";var HQ=i.forwardRef(((e,t)=>{const{children:n,...r}=e;if(i.isValidElement(n)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(n);return i.cloneElement(n,{...KQ(r,n.props),ref:t?YU(t,e):e})}return i.Children.count(n)>1?i.Children.only(null):null}));HQ.displayName="SlotClone";var qQ=({children:e})=>t.jsx(t.Fragment,{children:e});function GQ(e){return i.isValidElement(e)&&e.type===qQ}function KQ(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{i(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]={...o,...i}:"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}var WQ=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"].reduce(((e,n)=>{const r=i.forwardRef(((e,r)=>{const{asChild:o,...i}=e,a=o?zQ:n;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t.jsx(a,{...i,ref:r})}));return r.displayName=`Primitive.${n}`,{...e,[n]:r}}),{});function YQ(e,t){e&&a.flushSync((()=>e.dispatchEvent(t)))}function XQ(e){const r=e+"CollectionProvider",[o,i]=UQ(r),[a,s]=o(r,{collectionRef:{current:null},itemMap:new Map}),l=e=>{const{scope:r,children:o}=e,i=n.useRef(null),s=n.useRef(new Map).current;return t.jsx(a,{scope:r,itemMap:s,collectionRef:i,children:o})};l.displayName=r;const c=e+"CollectionSlot",u=n.forwardRef(((e,n)=>{const{scope:r,children:o}=e,i=XU(n,s(c,r).collectionRef);return t.jsx(zQ,{ref:i,children:o})}));u.displayName=c;const d=e+"CollectionItemSlot",p="data-radix-collection-item",f=n.forwardRef(((e,r)=>{const{scope:o,children:i,...a}=e,l=n.useRef(null),c=XU(r,l),u=s(d,o);return n.useEffect((()=>(u.itemMap.set(l,{ref:l,...a}),()=>{u.itemMap.delete(l)}))),t.jsx(zQ,{[p]:"",ref:c,children:i})}));return f.displayName=d,[{Provider:l,Slot:u,ItemSlot:f},function(t){const r=s(e+"CollectionConsumer",t);return n.useCallback((()=>{const e=r.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${p}]`));return Array.from(r.itemMap.values()).sort(((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current)))}),[r.collectionRef,r.itemMap])},i]}var ZQ=i.createContext(void 0);function QQ(e){const t=i.useContext(ZQ);return e||t||"ltr"}function JQ(e,t=globalThis?.document){const n=VQ(e);i.useEffect((()=>{const e=e=>{"Escape"===e.key&&n(e)};return t.addEventListener("keydown",e,{capture:!0}),()=>t.removeEventListener("keydown",e,{capture:!0})}),[n,t])}var eJ,tJ="dismissableLayer.update",nJ="dismissableLayer.pointerDownOutside",rJ="dismissableLayer.focusOutside",oJ=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),iJ=i.forwardRef(((e,n)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:s,onInteractOutside:l,onDismiss:c,...u}=e,d=i.useContext(oJ),[p,f]=i.useState(null),h=p?.ownerDocument??globalThis?.document,[,m]=i.useState({}),g=XU(n,(e=>f(e))),v=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=v.indexOf(y),x=p?v.indexOf(p):-1,w=d.layersWithOutsidePointerEventsDisabled.size>0,_=x>=b,S=function(e,t=globalThis?.document){const n=VQ(e),r=i.useRef(!1),o=i.useRef((()=>{}));return i.useEffect((()=>{const e=e=>{if(e.target&&!r.current){let r=function(){sJ(nJ,n,i,{discrete:!0})};const i={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",o.current),o.current=r,t.addEventListener("click",o.current,{once:!0})):r()}else t.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout((()=>{t.addEventListener("pointerdown",e)}),0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",e),t.removeEventListener("click",o.current)}}),[t,n]),{onPointerDownCapture:()=>r.current=!0}}((e=>{const t=e.target,n=[...d.branches].some((e=>e.contains(t)));_&&!n&&(a?.(e),l?.(e),e.defaultPrevented||c?.())}),h),E=function(e,t=globalThis?.document){const n=VQ(e),r=i.useRef(!1);return i.useEffect((()=>{const e=e=>{if(e.target&&!r.current){sJ(rJ,n,{originalEvent:e},{discrete:!1})}};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)}),[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}((e=>{const t=e.target;[...d.branches].some((e=>e.contains(t)))||(s?.(e),l?.(e),e.defaultPrevented||c?.())}),h);return JQ((e=>{x===d.layers.size-1&&(o?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))}),h),i.useEffect((()=>{if(p)return r&&(0===d.layersWithOutsidePointerEventsDisabled.size&&(eJ=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(p)),d.layers.add(p),aJ(),()=>{r&&1===d.layersWithOutsidePointerEventsDisabled.size&&(h.body.style.pointerEvents=eJ)}}),[p,h,r,d]),i.useEffect((()=>()=>{p&&(d.layers.delete(p),d.layersWithOutsidePointerEventsDisabled.delete(p),aJ())}),[p,d]),i.useEffect((()=>{const e=()=>m({});return document.addEventListener(tJ,e),()=>document.removeEventListener(tJ,e)}),[]),t.jsx(WQ.div,{...u,ref:g,style:{pointerEvents:w?_?"auto":"none":void 0,...e.style},onFocusCapture:FQ(e.onFocusCapture,E.onFocusCapture),onBlurCapture:FQ(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:FQ(e.onPointerDownCapture,S.onPointerDownCapture)})}));iJ.displayName="DismissableLayer";function aJ(){const e=new CustomEvent(tJ);document.dispatchEvent(e)}function sJ(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?YQ(o,i):o.dispatchEvent(i)}i.forwardRef(((e,n)=>{const r=i.useContext(oJ),o=i.useRef(null),a=XU(n,o);return i.useEffect((()=>{const e=o.current;if(e)return r.branches.add(e),()=>{r.branches.delete(e)}}),[r.branches]),t.jsx(WQ.div,{...e,ref:a})})).displayName="DismissableLayerBranch";var lJ=0;function cJ(){i.useEffect((()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??uJ()),document.body.insertAdjacentElement("beforeend",e[1]??uJ()),lJ++,()=>{1===lJ&&document.querySelectorAll("[data-radix-focus-guard]").forEach((e=>e.remove())),lJ--}}),[])}function uJ(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var dJ="focusScope.autoFocusOnMount",pJ="focusScope.autoFocusOnUnmount",fJ={bubbles:!1,cancelable:!0},hJ=i.forwardRef(((e,n)=>{const{loop:r=!1,trapped:o=!1,onMountAutoFocus:a,onUnmountAutoFocus:s,...l}=e,[c,u]=i.useState(null),d=VQ(a),p=VQ(s),f=i.useRef(null),h=XU(n,(e=>u(e))),m=i.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;i.useEffect((()=>{if(o){let e=function(e){if(m.paused||!c)return;const t=e.target;c.contains(t)?f.current=t:yJ(f.current,{select:!0})},t=function(e){if(m.paused||!c)return;const t=e.relatedTarget;null!==t&&(c.contains(t)||yJ(f.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&yJ(c)};document.addEventListener("focusin",e),document.addEventListener("focusout",t);const r=new MutationObserver(n);return c&&r.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),r.disconnect()}}}),[o,c,m.paused]),i.useEffect((()=>{if(c){bJ.add(m);const t=document.activeElement;if(!c.contains(t)){const n=new CustomEvent(dJ,fJ);c.addEventListener(dJ,d),c.dispatchEvent(n),n.defaultPrevented||(!function(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(yJ(r,{select:t}),document.activeElement!==n)return}((e=mJ(c),e.filter((e=>"A"!==e.tagName))),{select:!0}),document.activeElement===t&&yJ(c))}return()=>{c.removeEventListener(dJ,d),setTimeout((()=>{const e=new CustomEvent(pJ,fJ);c.addEventListener(pJ,p),c.dispatchEvent(e),e.defaultPrevented||yJ(t??document.body,{select:!0}),c.removeEventListener(pJ,p),bJ.remove(m)}),0)}}var e}),[c,d,p,m]);const g=i.useCallback((e=>{if(!r&&!o)return;if(m.paused)return;const t=document.activeElement;if("Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&t){const n=e.currentTarget,[o,i]=function(e){const t=mJ(e),n=gJ(t,e),r=gJ(t.reverse(),e);return[n,r]}(n);o&&i?e.shiftKey||t!==i?e.shiftKey&&t===o&&(e.preventDefault(),r&&yJ(i,{select:!0})):(e.preventDefault(),r&&yJ(o,{select:!0})):t===n&&e.preventDefault()}}),[r,o,m.paused]);return t.jsx(WQ.div,{tabIndex:-1,...l,ref:h,onKeyDown:g})}));function mJ(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>e.disabled||e.hidden||"INPUT"===e.tagName&&"hidden"===e.type?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;n.nextNode();)t.push(n.currentNode);return t}function gJ(e,t){for(const n of e)if(!vJ(n,{upTo:t}))return n}function vJ(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==t&&e===t)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function yJ(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&t&&e.select()}}hJ.displayName="FocusScope";var bJ=function(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=xJ(e,t),e.unshift(t)},remove(t){e=xJ(e,t),e[0]?.resume()}}}();function xJ(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}var wJ=Boolean(globalThis?.document)?i.useLayoutEffect:()=>{},_J=i["useId".toString()]||(()=>{}),SJ=0;function EJ(e){const[t,n]=i.useState(_J());return wJ((()=>{n((e=>e??String(SJ++)))}),[e]),t?`radix-${t}`:""}const TJ=["top","right","bottom","left"],CJ=Math.min,AJ=Math.max,NJ=Math.round,RJ=Math.floor,OJ=e=>({x:e,y:e}),PJ={left:"right",right:"left",bottom:"top",top:"bottom"},kJ={start:"end",end:"start"};function MJ(e,t,n){return AJ(e,CJ(t,n))}function jJ(e,t){return"function"==typeof e?e(t):e}function LJ(e){return e.split("-")[0]}function DJ(e){return e.split("-")[1]}function IJ(e){return"x"===e?"y":"x"}function FJ(e){return"y"===e?"height":"width"}function UJ(e){return["top","bottom"].includes(LJ(e))?"y":"x"}function $J(e){return IJ(UJ(e))}function VJ(e){return e.replace(/start|end/g,(e=>kJ[e]))}function BJ(e){return e.replace(/left|right|bottom|top/g,(e=>PJ[e]))}function zJ(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function HJ(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function qJ(e,t,n){let{reference:r,floating:o}=e;const i=UJ(t),a=$J(t),s=FJ(a),l=LJ(t),c="y"===i,u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,p=r[s]/2-o[s]/2;let f;switch(l){case"top":f={x:u,y:r.y-o.height};break;case"bottom":f={x:u,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:d};break;case"left":f={x:r.x-o.width,y:d};break;default:f={x:r.x,y:r.y}}switch(DJ(t)){case"start":f[a]-=p*(n&&c?-1:1);break;case"end":f[a]+=p*(n&&c?-1:1)}return f}async function GJ(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:a,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:p=!1,padding:f=0}=jJ(t,e),h=zJ(f),m=s[p?"floating"===d?"reference":"floating":d],g=HJ(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(m)))||n?m:m.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(s.floating)),boundary:c,rootBoundary:u,strategy:l})),v="floating"===d?{x:r,y:o,width:a.floating.width,height:a.floating.height}:a.reference,y=await(null==i.getOffsetParent?void 0:i.getOffsetParent(s.floating)),b=await(null==i.isElement?void 0:i.isElement(y))&&await(null==i.getScale?void 0:i.getScale(y))||{x:1,y:1},x=HJ(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:v,offsetParent:y,strategy:l}):v);return{top:(g.top-x.top+h.top)/b.y,bottom:(x.bottom-g.bottom+h.bottom)/b.y,left:(g.left-x.left+h.left)/b.x,right:(x.right-g.right+h.right)/b.x}}function KJ(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function WJ(e){return TJ.some((t=>e[t]>=0))}function YJ(){return"undefined"!=typeof window}function XJ(e){return JJ(e)?(e.nodeName||"").toLowerCase():"#document"}function ZJ(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function QJ(e){var t;return null==(t=(JJ(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function JJ(e){return!!YJ()&&(e instanceof Node||e instanceof ZJ(e).Node)}function e0(e){return!!YJ()&&(e instanceof Element||e instanceof ZJ(e).Element)}function t0(e){return!!YJ()&&(e instanceof HTMLElement||e instanceof ZJ(e).HTMLElement)}function n0(e){return!(!YJ()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof ZJ(e).ShadowRoot)}function r0(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=c0(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function o0(e){return["table","td","th"].includes(XJ(e))}function i0(e){return[":popover-open",":modal"].some((t=>{try{return e.matches(t)}catch(JSe){return!1}}))}function a0(e){const t=s0(),n=e0(e)?c0(e):e;return"none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||["transform","perspective","filter"].some((e=>(n.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(n.contain||"").includes(e)))}function s0(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function l0(e){return["html","body","#document"].includes(XJ(e))}function c0(e){return ZJ(e).getComputedStyle(e)}function u0(e){return e0(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function d0(e){if("html"===XJ(e))return e;const t=e.assignedSlot||e.parentNode||n0(e)&&e.host||QJ(e);return n0(t)?t.host:t}function p0(e){const t=d0(e);return l0(t)?e.ownerDocument?e.ownerDocument.body:e.body:t0(t)&&r0(t)?t:p0(t)}function f0(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=p0(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),a=ZJ(o);if(i){const e=h0(a);return t.concat(a,a.visualViewport||[],r0(o)?o:[],e&&n?f0(e):[])}return t.concat(o,f0(o,[],n))}function h0(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function m0(e){const t=c0(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=t0(e),i=o?e.offsetWidth:n,a=o?e.offsetHeight:r,s=NJ(n)!==i||NJ(r)!==a;return s&&(n=i,r=a),{width:n,height:r,$:s}}function g0(e){return e0(e)?e:e.contextElement}function v0(e){const t=g0(e);if(!t0(t))return OJ(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=m0(t);let a=(i?NJ(n.width):n.width)/r,s=(i?NJ(n.height):n.height)/o;return a&&Number.isFinite(a)||(a=1),s&&Number.isFinite(s)||(s=1),{x:a,y:s}}const y0=OJ(0);function b0(e){const t=ZJ(e);return s0()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:y0}function x0(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=g0(e);let a=OJ(1);t&&(r?e0(r)&&(a=v0(r)):a=v0(e));const s=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==ZJ(e))&&t}(i,n,r)?b0(i):OJ(0);let l=(o.left+s.x)/a.x,c=(o.top+s.y)/a.y,u=o.width/a.x,d=o.height/a.y;if(i){const e=ZJ(i),t=r&&e0(r)?ZJ(r):r;let n=e,o=h0(n);for(;o&&r&&t!==n;){const e=v0(o),t=o.getBoundingClientRect(),r=c0(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,a=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,c*=e.y,u*=e.x,d*=e.y,l+=i,c+=a,n=ZJ(o),o=h0(n)}}return HJ({width:u,height:d,x:l,y:c})}function w0(e,t){const n=u0(e).scrollLeft;return t?t.left+n:x0(QJ(e)).left+n}function _0(e,t,n){void 0===n&&(n=!1);const r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-(n?0:w0(e,r)),y:r.top+t.scrollTop}}function S0(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=ZJ(e),r=QJ(e),o=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,s=0,l=0;if(o){i=o.width,a=o.height;const e=s0();(!e||e&&"fixed"===t)&&(s=o.offsetLeft,l=o.offsetTop)}return{width:i,height:a,x:s,y:l}}(e,n);else if("document"===t)r=function(e){const t=QJ(e),n=u0(e),r=e.ownerDocument.body,o=AJ(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=AJ(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+w0(e);const s=-n.scrollTop;return"rtl"===c0(r).direction&&(a+=AJ(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:a,y:s}}(QJ(e));else if(e0(t))r=function(e,t){const n=x0(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=t0(e)?v0(e):OJ(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n);else{const n=b0(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return HJ(r)}function E0(e,t){const n=d0(e);return!(n===t||!e0(n)||l0(n))&&("fixed"===c0(n).position||E0(n,t))}function T0(e,t,n){const r=t0(t),o=QJ(t),i="fixed"===n,a=x0(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const l=OJ(0);if(r||!r&&!i)if(("body"!==XJ(t)||r0(o))&&(s=u0(t)),r){const e=x0(t,!0,i,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else o&&(l.x=w0(o));const c=!o||r||i?OJ(0):_0(o,s);return{x:a.left+s.scrollLeft-l.x-c.x,y:a.top+s.scrollTop-l.y-c.y,width:a.width,height:a.height}}function C0(e){return"static"===c0(e).position}function A0(e,t){if(!t0(e)||"fixed"===c0(e).position)return null;if(t)return t(e);let n=e.offsetParent;return QJ(e)===n&&(n=n.ownerDocument.body),n}function N0(e,t){const n=ZJ(e);if(i0(e))return n;if(!t0(e)){let t=d0(e);for(;t&&!l0(t);){if(e0(t)&&!C0(t))return t;t=d0(t)}return n}let r=A0(e,t);for(;r&&o0(r)&&C0(r);)r=A0(r,t);return r&&l0(r)&&C0(r)&&!a0(r)?n:r||function(e){let t=d0(e);for(;t0(t)&&!l0(t);){if(a0(t))return t;if(i0(t))return null;t=d0(t)}return null}(e)||n}const R0={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,a=QJ(r),s=!!t&&i0(t.floating);if(r===a||s&&i)return n;let l={scrollLeft:0,scrollTop:0},c=OJ(1);const u=OJ(0),d=t0(r);if((d||!d&&!i)&&(("body"!==XJ(r)||r0(a))&&(l=u0(r)),t0(r))){const e=x0(r);c=v0(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}const p=!a||d||i?OJ(0):_0(a,l,!0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+p.x,y:n.y*c.y-l.scrollTop*c.y+u.y+p.y}},getDocumentElement:QJ,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?i0(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=f0(e,[],!1).filter((e=>e0(e)&&"body"!==XJ(e))),o=null;const i="fixed"===c0(e).position;let a=i?d0(e):e;for(;e0(a)&&!l0(a);){const t=c0(a),n=a0(a);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||r0(a)&&!n&&E0(e,a))?r=r.filter((e=>e!==a)):o=t,a=d0(a)}return t.set(e,r),r}(t,this._c):[].concat(n),r],a=i.reduce(((e,n)=>{const r=S0(t,n,o);return e.top=AJ(r.top,e.top),e.right=CJ(r.right,e.right),e.bottom=CJ(r.bottom,e.bottom),e.left=AJ(r.left,e.left),e}),S0(t,i[0],o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:N0,getElementRects:async function(e){const t=this.getOffsetParent||N0,n=this.getDimensions,r=await n(e.floating);return{reference:T0(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=m0(e);return{width:t,height:n}},getScale:v0,isElement:e0,isRTL:function(e){return"rtl"===c0(e).direction}};function O0(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:l=!1}=r,c=g0(e),u=o||i?[...c?f0(c):[],...f0(t)]:[];u.forEach((e=>{o&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)}));const d=c&&s?function(e,t){let n,r=null;const o=QJ(e);function i(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function a(s,l){void 0===s&&(s=!1),void 0===l&&(l=1),i();const{left:c,top:u,width:d,height:p}=e.getBoundingClientRect();if(s||t(),!d||!p)return;const f={rootMargin:-RJ(u)+"px "+-RJ(o.clientWidth-(c+d))+"px "+-RJ(o.clientHeight-(u+p))+"px "+-RJ(c)+"px",threshold:AJ(0,CJ(1,l))||1};let h=!0;function m(e){const t=e[0].intersectionRatio;if(t!==l){if(!h)return a();t?a(!1,t):n=setTimeout((()=>{a(!1,1e-7)}),1e3)}h=!1}try{r=new IntersectionObserver(m,{...f,root:o.ownerDocument})}catch(JSe){r=new IntersectionObserver(m,f)}r.observe(e)}(!0),i}(c,n):null;let p,f=-1,h=null;a&&(h=new ResizeObserver((e=>{let[r]=e;r&&r.target===c&&h&&(h.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame((()=>{var e;null==(e=h)||e.observe(t)}))),n()})),c&&!l&&h.observe(c),h.observe(t));let m=l?x0(e):null;return l&&function t(){const r=x0(e);!m||r.x===m.x&&r.y===m.y&&r.width===m.width&&r.height===m.height||n();m=r,p=requestAnimationFrame(t)}(),n(),()=>{var e;u.forEach((e=>{o&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)})),null==d||d(),null==(e=h)||e.disconnect(),h=null,l&&cancelAnimationFrame(p)}}const P0=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:a,middlewareData:s}=t,l=await async function(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),a=LJ(n),s=DJ(n),l="y"===UJ(n),c=["left","top"].includes(a)?-1:1,u=i&&l?-1:1,d=jJ(t,e);let{mainAxis:p,crossAxis:f,alignmentAxis:h}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&"number"==typeof h&&(f="end"===s?-1*h:h),l?{x:f*u,y:p*c}:{x:p*c,y:f*u}}(t,e);return a===(null==(n=s.offset)?void 0:n.placement)&&null!=(r=s.arrow)&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:a}}}}},k0=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=jJ(e,t),c={x:n,y:r},u=await GJ(t,l),d=UJ(LJ(o)),p=IJ(d);let f=c[p],h=c[d];if(i){f=MJ(f+u["y"===p?"top":"left"],f,f-u["y"===p?"bottom":"right"])}if(a){h=MJ(h+u["y"===d?"top":"left"],h,h-u["y"===d?"bottom":"right"])}const m=s.fn({...t,[p]:f,[d]:h});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[p]:i,[d]:a}}}}}},M0=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:a,initialPlacement:s,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:p,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...g}=jJ(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const v=LJ(o),y=UJ(s),b=LJ(s)===s,x=await(null==l.isRTL?void 0:l.isRTL(c.floating)),w=p||(b||!m?[BJ(s)]:function(e){const t=BJ(e);return[VJ(e),t,VJ(t)]}(s)),_="none"!==h;!p&&_&&w.push(...function(e,t,n,r){const o=DJ(e);let i=function(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],a=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:a;default:return[]}}(LJ(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(VJ)))),i}(s,m,h,x));const S=[s,...w],E=await GJ(t,g),T=[];let C=(null==(r=i.flip)?void 0:r.overflows)||[];if(u&&T.push(E[v]),d){const e=function(e,t,n){void 0===n&&(n=!1);const r=DJ(e),o=$J(e),i=FJ(o);let a="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=BJ(a)),[a,BJ(a)]}(o,a,x);T.push(E[e[0]],E[e[1]])}if(C=[...C,{placement:o,overflows:T}],!T.every((e=>e<=0))){var A,N;const e=((null==(A=i.flip)?void 0:A.index)||0)+1,t=S[e];if(t)return{data:{index:e,overflows:C},reset:{placement:t}};let n=null==(N=C.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:N.placement;if(!n)switch(f){case"bestFit":{var R;const e=null==(R=C.filter((e=>{if(_){const t=UJ(e.placement);return t===y||"y"===t}return!0})).map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:R[0];e&&(n=e);break}case"initialPlacement":n=s}if(o!==n)return{reset:{placement:n}}}return{}}}},j0=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:i,platform:a,elements:s}=t,{apply:l=()=>{},...c}=jJ(e,t),u=await GJ(t,c),d=LJ(o),p=DJ(o),f="y"===UJ(o),{width:h,height:m}=i.floating;let g,v;"top"===d||"bottom"===d?(g=d,v=p===(await(null==a.isRTL?void 0:a.isRTL(s.floating))?"start":"end")?"left":"right"):(v=d,g="end"===p?"top":"bottom");const y=m-u.top-u.bottom,b=h-u.left-u.right;let x=CJ(m-u[g],y),w=CJ(h-u[v],b);if(null!=(n=t.middlewareData.shift)&&n.enabled.x&&(w=b),null!=(r=t.middlewareData.shift)&&r.enabled.y&&(x=y),!t.middlewareData.shift&&!p){const e=AJ(u.left,0),t=AJ(u.right,0),n=AJ(u.top,0),r=AJ(u.bottom,0);f?w=h-2*(0!==e||0!==t?e+t:AJ(u.left,u.right)):x=m-2*(0!==n||0!==r?n+r:AJ(u.top,u.bottom))}await l({...t,availableWidth:w,availableHeight:x});const _=await a.getDimensions(s.floating);return h!==_.width||m!==_.height?{reset:{rects:!0}}:{}}}},L0=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=jJ(e,t);switch(r){case"referenceHidden":{const e=KJ(await GJ(t,{...o,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:WJ(e)}}}case"escaped":{const e=KJ(await GJ(t,{...o,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:WJ(e)}}}default:return{}}}}},D0=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:a,elements:s,middlewareData:l}=t,{element:c,padding:u=0}=jJ(e,t)||{};if(null==c)return{};const d=zJ(u),p={x:n,y:r},f=$J(o),h=FJ(f),m=await a.getDimensions(c),g="y"===f,v=g?"top":"left",y=g?"bottom":"right",b=g?"clientHeight":"clientWidth",x=i.reference[h]+i.reference[f]-p[f]-i.floating[h],w=p[f]-i.reference[f],_=await(null==a.getOffsetParent?void 0:a.getOffsetParent(c));let S=_?_[b]:0;S&&await(null==a.isElement?void 0:a.isElement(_))||(S=s.floating[b]||i.floating[h]);const E=x/2-w/2,T=S/2-m[h]/2-1,C=CJ(d[v],T),A=CJ(d[y],T),N=C,R=S-m[h]-A,O=S/2-m[h]/2+E,P=MJ(N,O,R),k=!l.arrow&&null!=DJ(o)&&O!==P&&i.reference[h]/2-(O<N?C:A)-m[h]/2<0,M=k?O<N?O-N:O-R:0;return{[f]:p[f]+M,data:{[f]:P,centerOffset:O-P-M,...k&&{alignmentOffset:M}},reset:k}}}),I0=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:a}=t,{offset:s=0,mainAxis:l=!0,crossAxis:c=!0}=jJ(e,t),u={x:n,y:r},d=UJ(o),p=IJ(d);let f=u[p],h=u[d];const m=jJ(s,t),g="number"==typeof m?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const e="y"===p?"height":"width",t=i.reference[p]-i.floating[e]+g.mainAxis,n=i.reference[p]+i.reference[e]-g.mainAxis;f<t?f=t:f>n&&(f=n)}if(c){var v,y;const e="y"===p?"width":"height",t=["top","left"].includes(LJ(o)),n=i.reference[d]-i.floating[e]+(t&&(null==(v=a.offset)?void 0:v[d])||0)+(t?0:g.crossAxis),r=i.reference[d]+i.reference[e]+(t?0:(null==(y=a.offset)?void 0:y[d])||0)-(t?g.crossAxis:0);h<n?h=n:h>r&&(h=r)}return{[p]:f,[d]:h}}}},F0=(e,t,n)=>{const r={platform:R0,...n},o={...r.platform,_c:new Map};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:a}=n,s=i.filter(Boolean),l=await(null==a.isRTL?void 0:a.isRTL(t));let c=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:d}=qJ(c,r,l),p=r,f={},h=0;for(let m=0;m<s.length;m++){const{name:n,fn:i}=s[m],{x:g,y:v,data:y,reset:b}=await i({x:u,y:d,initialPlacement:r,placement:p,strategy:o,middlewareData:f,rects:c,platform:a,elements:{reference:e,floating:t}});u=null!=g?g:u,d=null!=v?v:d,f={...f,[n]:{...f[n],...y}},b&&h<=50&&(h++,"object"==typeof b&&(b.placement&&(p=b.placement),b.rects&&(c=!0===b.rects?await a.getElementRects({reference:e,floating:t,strategy:o}):b.rects),({x:u,y:d}=qJ(c,p,l))),m=-1)}return{x:u,y:d,placement:p,strategy:o,middlewareData:f}})(e,t,{...r,platform:o})};var U0="undefined"!=typeof document?n.useLayoutEffect:n.useEffect;function $0(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!=r--;)if(!$0(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!=r--;){const n=o[r];if(("_owner"!==n||!e.$$typeof)&&!$0(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function V0(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function B0(e,t){const n=V0(e);return Math.round(t*n)/n}function z0(e){const t=i.useRef(e);return U0((()=>{t.current=e})),t}function H0(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:l}={},transform:c=!0,whileElementsMounted:u,open:d}=e,[p,f]=i.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,m]=i.useState(r);$0(h,r)||m(r);const[g,v]=i.useState(null),[y,b]=i.useState(null),x=i.useCallback((e=>{e!==E.current&&(E.current=e,v(e))}),[]),w=i.useCallback((e=>{e!==T.current&&(T.current=e,b(e))}),[]),_=s||g,S=l||y,E=i.useRef(null),T=i.useRef(null),C=i.useRef(p),A=null!=u,N=z0(u),R=z0(o),O=z0(d),P=i.useCallback((()=>{if(!E.current||!T.current)return;const e={placement:t,strategy:n,middleware:h};R.current&&(e.platform=R.current),F0(E.current,T.current,e).then((e=>{const t={...e,isPositioned:!1!==O.current};k.current&&!$0(C.current,t)&&(C.current=t,a.flushSync((()=>{f(t)})))}))}),[h,t,n,R,O]);U0((()=>{!1===d&&C.current.isPositioned&&(C.current.isPositioned=!1,f((e=>({...e,isPositioned:!1}))))}),[d]);const k=i.useRef(!1);U0((()=>(k.current=!0,()=>{k.current=!1})),[]),U0((()=>{if(_&&(E.current=_),S&&(T.current=S),_&&S){if(N.current)return N.current(_,S,P);P()}}),[_,S,P,N,A]);const M=i.useMemo((()=>({reference:E,floating:T,setReference:x,setFloating:w})),[x,w]),j=i.useMemo((()=>({reference:_,floating:S})),[_,S]),L=i.useMemo((()=>{const e={position:n,left:0,top:0};if(!j.floating)return e;const t=B0(j.floating,p.x),r=B0(j.floating,p.y);return c?{...e,transform:"translate("+t+"px, "+r+"px)",...V0(j.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}}),[n,c,j.floating,p.x,p.y]);return i.useMemo((()=>({...p,update:P,refs:M,elements:j,floatingStyles:L})),[p,P,M,j,L])}const q0=e=>({name:"arrow",options:e,fn(t){const{element:n,padding:r}="function"==typeof e?e(t):e;return n&&{}.hasOwnProperty.call(n,"current")?null!=n.current?D0({element:n.current,padding:r}).fn(t):{}:n?D0({element:n,padding:r}).fn(t):{}}}),G0=(e,t)=>({...P0(e),options:[e,t]}),K0=(e,t)=>({...k0(e),options:[e,t]}),W0=(e,t)=>({...I0(e),options:[e,t]}),Y0=(e,t)=>({...M0(e),options:[e,t]}),X0=(e,t)=>({...j0(e),options:[e,t]}),Z0=(e,t)=>({...L0(e),options:[e,t]}),Q0=(e,t)=>({...q0(e),options:[e,t]});var J0=i.forwardRef(((e,n)=>{const{children:r,width:o=10,height:i=5,...a}=e;return t.jsx(WQ.svg,{...a,ref:n,width:o,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:t.jsx("polygon",{points:"0,0 30,0 15,10"})})}));J0.displayName="Arrow";var e1=J0;function t1(e){const[t,n]=i.useState(void 0);return wJ((()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const t=new ResizeObserver((t=>{if(!Array.isArray(t))return;if(!t.length)return;const r=t[0];let o,i;if("borderBoxSize"in r){const e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;o=t.inlineSize,i=t.blockSize}else o=e.offsetWidth,i=e.offsetHeight;n({width:o,height:i})}));return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}n(void 0)}),[e]),t}var n1="Popper",[r1,o1]=UQ(n1),[i1,a1]=r1(n1),s1=e=>{const{__scopePopper:n,children:r}=e,[o,a]=i.useState(null);return t.jsx(i1,{scope:n,anchor:o,onAnchorChange:a,children:r})};s1.displayName=n1;var l1="PopperAnchor",c1=i.forwardRef(((e,n)=>{const{__scopePopper:r,virtualRef:o,...a}=e,s=a1(l1,r),l=i.useRef(null),c=XU(n,l);return i.useEffect((()=>{s.onAnchorChange(o?.current||l.current)})),o?null:t.jsx(WQ.div,{...a,ref:c})}));c1.displayName=l1;var u1="PopperContent",[d1,p1]=r1(u1),f1=i.forwardRef(((e,n)=>{const{__scopePopper:r,side:o="bottom",sideOffset:a=0,align:s="center",alignOffset:l=0,arrowPadding:c=0,avoidCollisions:u=!0,collisionBoundary:d=[],collisionPadding:p=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:m="optimized",onPlaced:g,...v}=e,y=a1(u1,r),[b,x]=i.useState(null),w=XU(n,(e=>x(e))),[_,S]=i.useState(null),E=t1(_),T=E?.width??0,C=E?.height??0,A=o+("center"!==s?"-"+s:""),N="number"==typeof p?p:{top:0,right:0,bottom:0,left:0,...p},R=Array.isArray(d)?d:[d],O=R.length>0,P={padding:N,boundary:R.filter(v1),altBoundary:O},{refs:k,floatingStyles:M,placement:j,isPositioned:L,middlewareData:D}=H0({strategy:"fixed",placement:A,whileElementsMounted:(...e)=>O0(...e,{animationFrame:"always"===m}),elements:{reference:y.anchor},middleware:[G0({mainAxis:a+C,alignmentAxis:l}),u&&K0({mainAxis:!0,crossAxis:!1,limiter:"partial"===f?W0():void 0,...P}),u&&Y0({...P}),X0({...P,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{const{width:o,height:i}=t.reference,a=e.floating.style;a.setProperty("--radix-popper-available-width",`${n}px`),a.setProperty("--radix-popper-available-height",`${r}px`),a.setProperty("--radix-popper-anchor-width",`${o}px`),a.setProperty("--radix-popper-anchor-height",`${i}px`)}}),_&&Q0({element:_,padding:c}),y1({arrowWidth:T,arrowHeight:C}),h&&Z0({strategy:"referenceHidden",...P})]}),[I,F]=b1(j),U=VQ(g);wJ((()=>{L&&U?.()}),[L,U]);const $=D.arrow?.x,V=D.arrow?.y,B=0!==D.arrow?.centerOffset,[z,H]=i.useState();return wJ((()=>{b&&H(window.getComputedStyle(b).zIndex)}),[b]),t.jsx("div",{ref:k.setFloating,"data-radix-popper-content-wrapper":"",style:{...M,transform:L?M.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:z,"--radix-popper-transform-origin":[D.transformOrigin?.x,D.transformOrigin?.y].join(" "),...D.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:t.jsx(d1,{scope:r,placedSide:I,onArrowChange:S,arrowX:$,arrowY:V,shouldHideArrow:B,children:t.jsx(WQ.div,{"data-side":I,"data-align":F,...v,ref:w,style:{...v.style,animation:L?void 0:"none"}})})})}));f1.displayName=u1;var h1="PopperArrow",m1={top:"bottom",right:"left",bottom:"top",left:"right"},g1=i.forwardRef((function(e,n){const{__scopePopper:r,...o}=e,i=p1(h1,r),a=m1[i.placedSide];return t.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:t.jsx(e1,{...o,ref:n,style:{...o.style,display:"block"}})})}));function v1(e){return null!==e}g1.displayName=h1;var y1=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:o}=t,i=0!==o.arrow?.centerOffset,a=i?0:e.arrowWidth,s=i?0:e.arrowHeight,[l,c]=b1(n),u={start:"0%",center:"50%",end:"100%"}[c],d=(o.arrow?.x??0)+a/2,p=(o.arrow?.y??0)+s/2;let f="",h="";return"bottom"===l?(f=i?u:`${d}px`,h=-s+"px"):"top"===l?(f=i?u:`${d}px`,h=`${r.floating.height+s}px`):"right"===l?(f=-s+"px",h=i?u:`${p}px`):"left"===l&&(f=`${r.floating.width+s}px`,h=i?u:`${p}px`),{data:{x:f,y:h}}}});function b1(e){const[t,n="center"]=e.split("-");return[t,n]}var x1=s1,w1=c1,_1=f1,S1=g1,E1=i.forwardRef(((e,n)=>{const{container:o,...a}=e,[s,l]=i.useState(!1);wJ((()=>l(!0)),[]);const c=o||s&&globalThis?.document?.body;return c?r.createPortal(t.jsx(WQ.div,{...a,ref:n}),c):null}));E1.displayName="Portal";var T1=e=>{const{present:t,children:n}=e,r=function(e){const[t,n]=i.useState(),r=i.useRef({}),o=i.useRef(e),a=i.useRef("none"),s=e?"mounted":"unmounted",[l,c]=function(e,t){return i.useReducer(((e,n)=>t[e][n]??e),e)}(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return i.useEffect((()=>{const e=C1(r.current);a.current="mounted"===l?e:"none"}),[l]),wJ((()=>{const t=r.current,n=o.current;if(n!==e){const r=a.current,i=C1(t);if(e)c("MOUNT");else if("none"===i||"none"===t?.display)c("UNMOUNT");else{c(n&&r!==i?"ANIMATION_OUT":"UNMOUNT")}o.current=e}}),[e,c]),wJ((()=>{if(t){let e;const n=t.ownerDocument.defaultView??window,i=i=>{const a=C1(r.current).includes(i.animationName);if(i.target===t&&a&&(c("ANIMATION_END"),!o.current)){const r=t.style.animationFillMode;t.style.animationFillMode="forwards",e=n.setTimeout((()=>{"forwards"===t.style.animationFillMode&&(t.style.animationFillMode=r)}))}},s=e=>{e.target===t&&(a.current=C1(r.current))};return t.addEventListener("animationstart",s),t.addEventListener("animationcancel",i),t.addEventListener("animationend",i),()=>{n.clearTimeout(e),t.removeEventListener("animationstart",s),t.removeEventListener("animationcancel",i),t.removeEventListener("animationend",i)}}c("ANIMATION_END")}),[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:i.useCallback((e=>{e&&(r.current=getComputedStyle(e)),n(e)}),[])}}(t),o="function"==typeof n?n({present:r.isPresent}):i.Children.only(n),a=XU(r.ref,function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(o));return"function"==typeof n||r.isPresent?i.cloneElement(o,{ref:a}):null};function C1(e){return e?.animationName||"none"}T1.displayName="Presence";var A1="rovingFocusGroup.onEntryFocus",N1={bubbles:!1,cancelable:!0},R1="RovingFocusGroup",[O1,P1,k1]=XQ(R1),[M1,j1]=UQ(R1,[k1]),[L1,D1]=M1(R1),I1=i.forwardRef(((e,n)=>t.jsx(O1.Provider,{scope:e.__scopeRovingFocusGroup,children:t.jsx(O1.Slot,{scope:e.__scopeRovingFocusGroup,children:t.jsx(F1,{...e,ref:n})})})));I1.displayName=R1;var F1=i.forwardRef(((e,n)=>{const{__scopeRovingFocusGroup:r,orientation:o,loop:a=!1,dir:s,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:d,preventScrollOnEntryFocus:p=!1,...f}=e,h=i.useRef(null),m=XU(n,h),g=QQ(s),[v=null,y]=BQ({prop:l,defaultProp:c,onChange:u}),[b,x]=i.useState(!1),w=VQ(d),_=P1(r),S=i.useRef(!1),[E,T]=i.useState(0);return i.useEffect((()=>{const e=h.current;if(e)return e.addEventListener(A1,w),()=>e.removeEventListener(A1,w)}),[w]),t.jsx(L1,{scope:r,orientation:o,dir:g,loop:a,currentTabStopId:v,onItemFocus:i.useCallback((e=>y(e)),[y]),onItemShiftTab:i.useCallback((()=>x(!0)),[]),onFocusableItemAdd:i.useCallback((()=>T((e=>e+1))),[]),onFocusableItemRemove:i.useCallback((()=>T((e=>e-1))),[]),children:t.jsx(WQ.div,{tabIndex:b||0===E?-1:0,"data-orientation":o,...f,ref:m,style:{outline:"none",...e.style},onMouseDown:FQ(e.onMouseDown,(()=>{S.current=!0})),onFocus:FQ(e.onFocus,(e=>{if(e.target===e.currentTarget&&!S.current&&!b){const t=new CustomEvent(A1,N1);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=_().filter((e=>e.focusable));B1([e.find((e=>e.active)),e.find((e=>e.id===v)),...e].filter(Boolean).map((e=>e.ref.current)),p)}}S.current=!1})),onBlur:FQ(e.onBlur,(()=>x(!1)))})})})),U1="RovingFocusGroupItem",$1=i.forwardRef(((e,n)=>{const{__scopeRovingFocusGroup:r,focusable:o=!0,active:a=!1,tabStopId:s,...l}=e,c=EJ(),u=s||c,d=D1(U1,r),p=d.currentTabStopId===u,f=P1(r),{onFocusableItemAdd:h,onFocusableItemRemove:m}=d;return i.useEffect((()=>{if(o)return h(),()=>m()}),[o,h,m]),t.jsx(O1.ItemSlot,{scope:r,id:u,focusable:o,active:a,children:t.jsx(WQ.span,{tabIndex:p?0:-1,"data-orientation":d.orientation,...l,ref:n,onMouseDown:FQ(e.onMouseDown,(e=>{o?d.onItemFocus(u):e.preventDefault()})),onFocus:FQ(e.onFocus,(()=>d.onItemFocus(u))),onKeyDown:FQ(e.onKeyDown,(e=>{if("Tab"===e.key&&e.shiftKey)return void d.onItemShiftTab();if(e.target!==e.currentTarget)return;const t=function(e,t,n){const r=function(e,t){return"rtl"!==t?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}(e.key,n);return"vertical"===t&&["ArrowLeft","ArrowRight"].includes(r)||"horizontal"===t&&["ArrowUp","ArrowDown"].includes(r)?void 0:V1[r]}(e,d.orientation,d.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let o=f().filter((e=>e.focusable)).map((e=>e.ref.current));if("last"===t)o.reverse();else if("prev"===t||"next"===t){"prev"===t&&o.reverse();const i=o.indexOf(e.currentTarget);o=d.loop?(r=i+1,(n=o).map(((e,t)=>n[(r+t)%n.length]))):o.slice(i+1)}setTimeout((()=>B1(o)))}var n,r}))})})}));$1.displayName=U1;var V1={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function B1(e,t=!1){const n=document.activeElement;for(const r of e){if(r===n)return;if(r.focus({preventScroll:t}),document.activeElement!==n)return}}var z1=I1,H1=$1,q1=["Enter"," "],G1=["ArrowUp","PageDown","End"],K1=["ArrowDown","PageUp","Home",...G1],W1={ltr:[...q1,"ArrowRight"],rtl:[...q1,"ArrowLeft"]},Y1={ltr:["ArrowLeft"],rtl:["ArrowRight"]},X1="Menu",[Z1,Q1,J1]=XQ(X1),[e2,t2]=UQ(X1,[J1,o1,j1]),n2=o1(),r2=j1(),[o2,i2]=e2(X1),[a2,s2]=e2(X1),l2=e=>{const{__scopeMenu:n,open:r=!1,children:o,dir:a,onOpenChange:s,modal:l=!0}=e,c=n2(n),[u,d]=i.useState(null),p=i.useRef(!1),f=VQ(s),h=QQ(a);return i.useEffect((()=>{const e=()=>{p.current=!0,document.addEventListener("pointerdown",t,{capture:!0,once:!0}),document.addEventListener("pointermove",t,{capture:!0,once:!0})},t=()=>p.current=!1;return document.addEventListener("keydown",e,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",t,{capture:!0}),document.removeEventListener("pointermove",t,{capture:!0})}}),[]),t.jsx(x1,{...c,children:t.jsx(o2,{scope:n,open:r,onOpenChange:f,content:u,onContentChange:d,children:t.jsx(a2,{scope:n,onClose:i.useCallback((()=>f(!1)),[f]),isUsingKeyboardRef:p,dir:h,modal:l,children:o})})})};l2.displayName=X1;var c2=i.forwardRef(((e,n)=>{const{__scopeMenu:r,...o}=e,i=n2(r);return t.jsx(w1,{...i,...o,ref:n})}));c2.displayName="MenuAnchor";var u2="MenuPortal",[d2,p2]=e2(u2,{forceMount:void 0}),f2=e=>{const{__scopeMenu:n,forceMount:r,children:o,container:i}=e,a=i2(u2,n);return t.jsx(d2,{scope:n,forceMount:r,children:t.jsx(T1,{present:r||a.open,children:t.jsx(E1,{asChild:!0,container:i,children:o})})})};f2.displayName=u2;var h2="MenuContent",[m2,g2]=e2(h2),v2=i.forwardRef(((e,n)=>{const r=p2(h2,e.__scopeMenu),{forceMount:o=r.forceMount,...i}=e,a=i2(h2,e.__scopeMenu),s=s2(h2,e.__scopeMenu);return t.jsx(Z1.Provider,{scope:e.__scopeMenu,children:t.jsx(T1,{present:o||a.open,children:t.jsx(Z1.Slot,{scope:e.__scopeMenu,children:t.jsx(s.modal?y2:b2,{...i,ref:n})})})})})),y2=i.forwardRef(((e,n)=>{const r=i2(h2,e.__scopeMenu),o=i.useRef(null),a=XU(n,o);return i.useEffect((()=>{const e=o.current;if(e)return LV(e)}),[]),t.jsx(x2,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:FQ(e.onFocusOutside,(e=>e.preventDefault()),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})})),b2=i.forwardRef(((e,n)=>{const r=i2(h2,e.__scopeMenu);return t.jsx(x2,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})})),x2=i.forwardRef(((e,n)=>{const{__scopeMenu:r,loop:o=!1,trapFocus:a,onOpenAutoFocus:s,onCloseAutoFocus:l,disableOutsidePointerEvents:c,onEntryFocus:u,onEscapeKeyDown:d,onPointerDownOutside:p,onFocusOutside:f,onInteractOutside:h,onDismiss:m,disableOutsideScroll:g,...v}=e,y=i2(h2,r),b=s2(h2,r),x=n2(r),w=r2(r),_=Q1(r),[S,E]=i.useState(null),T=i.useRef(null),C=XU(n,T,y.onContentChange),A=i.useRef(0),N=i.useRef(""),R=i.useRef(0),O=i.useRef(null),P=i.useRef("right"),k=i.useRef(0),M=g?NV:i.Fragment,j=g?{as:zQ,allowPinchZoom:!0}:void 0,L=e=>{const t=N.current+e,n=_().filter((e=>!e.disabled)),r=document.activeElement,o=n.find((e=>e.ref.current===r))?.textValue,i=function(e,t,n){const r=t.length>1&&Array.from(t).every((e=>e===t[0])),o=r?t[0]:t,i=n?e.indexOf(n):-1;let a=(s=e,l=Math.max(i,0),s.map(((e,t)=>s[(l+t)%s.length])));var s,l;1===o.length&&(a=a.filter((e=>e!==n)));const c=a.find((e=>e.toLowerCase().startsWith(o.toLowerCase())));return c!==n?c:void 0}(n.map((e=>e.textValue)),t,o),a=n.find((e=>e.textValue===i))?.ref.current;!function e(t){N.current=t,window.clearTimeout(A.current),""!==t&&(A.current=window.setTimeout((()=>e("")),1e3))}(t),a&&setTimeout((()=>a.focus()))};i.useEffect((()=>()=>window.clearTimeout(A.current)),[]),cJ();const D=i.useCallback((e=>P.current===O.current?.side&&function(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return function(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,a=t.length-1;i<t.length;a=i++){const e=t[i].x,s=t[i].y,l=t[a].y;s>r!=l>r&&n<(t[a].x-e)*(r-s)/(l-s)+e&&(o=!o)}return o}(n,t)}(e,O.current?.area)),[]);return t.jsx(m2,{scope:r,searchRef:N,onItemEnter:i.useCallback((e=>{D(e)&&e.preventDefault()}),[D]),onItemLeave:i.useCallback((e=>{D(e)||(T.current?.focus(),E(null))}),[D]),onTriggerLeave:i.useCallback((e=>{D(e)&&e.preventDefault()}),[D]),pointerGraceTimerRef:R,onPointerGraceIntentChange:i.useCallback((e=>{O.current=e}),[]),children:t.jsx(M,{...j,children:t.jsx(hJ,{asChild:!0,trapped:a,onMountAutoFocus:FQ(s,(e=>{e.preventDefault(),T.current?.focus({preventScroll:!0})})),onUnmountAutoFocus:l,children:t.jsx(iJ,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:d,onPointerDownOutside:p,onFocusOutside:f,onInteractOutside:h,onDismiss:m,children:t.jsx(z1,{asChild:!0,...w,dir:b.dir,orientation:"vertical",loop:o,currentTabStopId:S,onCurrentTabStopIdChange:E,onEntryFocus:FQ(u,(e=>{b.isUsingKeyboardRef.current||e.preventDefault()})),preventScrollOnEntryFocus:!0,children:t.jsx(_1,{role:"menu","aria-orientation":"vertical","data-state":G2(y.open),"data-radix-menu-content":"",dir:b.dir,...x,...v,ref:C,style:{outline:"none",...v.style},onKeyDown:FQ(v.onKeyDown,(e=>{const t=e.target.closest("[data-radix-menu-content]")===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=1===e.key.length;t&&("Tab"===e.key&&e.preventDefault(),!n&&r&&L(e.key));if(e.target!==T.current)return;if(!K1.includes(e.key))return;e.preventDefault();const o=_().filter((e=>!e.disabled)).map((e=>e.ref.current));G1.includes(e.key)&&o.reverse(),function(e){const t=document.activeElement;for(const n of e){if(n===t)return;if(n.focus(),document.activeElement!==t)return}}(o)})),onBlur:FQ(e.onBlur,(e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(A.current),N.current="")})),onPointerMove:FQ(e.onPointerMove,Y2((e=>{const t=k.current!==e.clientX;if(e.currentTarget.contains(e.target)&&t){P.current=e.clientX>k.current?"right":"left",k.current=e.clientX}})))})})})})})})}));v2.displayName=h2;var w2=i.forwardRef(((e,n)=>{const{__scopeMenu:r,...o}=e;return t.jsx(WQ.div,{role:"group",...o,ref:n})}));w2.displayName="MenuGroup";var _2=i.forwardRef(((e,n)=>{const{__scopeMenu:r,...o}=e;return t.jsx(WQ.div,{...o,ref:n})}));_2.displayName="MenuLabel";var S2="MenuItem",E2="menu.itemSelect",T2=i.forwardRef(((e,n)=>{const{disabled:r=!1,onSelect:o,...a}=e,s=i.useRef(null),l=s2(S2,e.__scopeMenu),c=g2(S2,e.__scopeMenu),u=XU(n,s),d=i.useRef(!1);return t.jsx(C2,{...a,ref:u,disabled:r,onClick:FQ(e.onClick,(()=>{const e=s.current;if(!r&&e){const t=new CustomEvent(E2,{bubbles:!0,cancelable:!0});e.addEventListener(E2,(e=>o?.(e)),{once:!0}),YQ(e,t),t.defaultPrevented?d.current=!1:l.onClose()}})),onPointerDown:t=>{e.onPointerDown?.(t),d.current=!0},onPointerUp:FQ(e.onPointerUp,(e=>{d.current||e.currentTarget?.click()})),onKeyDown:FQ(e.onKeyDown,(e=>{r||""!==c.searchRef.current&&" "===e.key||q1.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())}))})}));T2.displayName=S2;var C2=i.forwardRef(((e,n)=>{const{__scopeMenu:r,disabled:o=!1,textValue:a,...s}=e,l=g2(S2,r),c=r2(r),u=i.useRef(null),d=XU(n,u),[p,f]=i.useState(!1),[h,m]=i.useState("");return i.useEffect((()=>{const e=u.current;e&&m((e.textContent??"").trim())}),[s.children]),t.jsx(Z1.ItemSlot,{scope:r,disabled:o,textValue:a??h,children:t.jsx(H1,{asChild:!0,...c,focusable:!o,children:t.jsx(WQ.div,{role:"menuitem","data-highlighted":p?"":void 0,"aria-disabled":o||void 0,"data-disabled":o?"":void 0,...s,ref:d,onPointerMove:FQ(e.onPointerMove,Y2((e=>{if(o)l.onItemLeave(e);else if(l.onItemEnter(e),!e.defaultPrevented){e.currentTarget.focus({preventScroll:!0})}}))),onPointerLeave:FQ(e.onPointerLeave,Y2((e=>l.onItemLeave(e)))),onFocus:FQ(e.onFocus,(()=>f(!0))),onBlur:FQ(e.onBlur,(()=>f(!1)))})})})})),A2=i.forwardRef(((e,n)=>{const{checked:r=!1,onCheckedChange:o,...i}=e;return t.jsx(L2,{scope:e.__scopeMenu,checked:r,children:t.jsx(T2,{role:"menuitemcheckbox","aria-checked":K2(r)?"mixed":r,...i,ref:n,"data-state":W2(r),onSelect:FQ(i.onSelect,(()=>o?.(!!K2(r)||!r)),{checkForDefaultPrevented:!1})})})}));A2.displayName="MenuCheckboxItem";var N2="MenuRadioGroup",[R2,O2]=e2(N2,{value:void 0,onValueChange:()=>{}}),P2=i.forwardRef(((e,n)=>{const{value:r,onValueChange:o,...i}=e,a=VQ(o);return t.jsx(R2,{scope:e.__scopeMenu,value:r,onValueChange:a,children:t.jsx(w2,{...i,ref:n})})}));P2.displayName=N2;var k2="MenuRadioItem",M2=i.forwardRef(((e,n)=>{const{value:r,...o}=e,i=O2(k2,e.__scopeMenu),a=r===i.value;return t.jsx(L2,{scope:e.__scopeMenu,checked:a,children:t.jsx(T2,{role:"menuitemradio","aria-checked":a,...o,ref:n,"data-state":W2(a),onSelect:FQ(o.onSelect,(()=>i.onValueChange?.(r)),{checkForDefaultPrevented:!1})})})}));M2.displayName=k2;var j2="MenuItemIndicator",[L2,D2]=e2(j2,{checked:!1}),I2=i.forwardRef(((e,n)=>{const{__scopeMenu:r,forceMount:o,...i}=e,a=D2(j2,r);return t.jsx(T1,{present:o||K2(a.checked)||!0===a.checked,children:t.jsx(WQ.span,{...i,ref:n,"data-state":W2(a.checked)})})}));I2.displayName=j2;var F2=i.forwardRef(((e,n)=>{const{__scopeMenu:r,...o}=e;return t.jsx(WQ.div,{role:"separator","aria-orientation":"horizontal",...o,ref:n})}));F2.displayName="MenuSeparator";var U2=i.forwardRef(((e,n)=>{const{__scopeMenu:r,...o}=e,i=n2(r);return t.jsx(S1,{...i,...o,ref:n})}));U2.displayName="MenuArrow";var[$2,V2]=e2("MenuSub"),B2="MenuSubTrigger",z2=i.forwardRef(((e,n)=>{const r=i2(B2,e.__scopeMenu),o=s2(B2,e.__scopeMenu),a=V2(B2,e.__scopeMenu),s=g2(B2,e.__scopeMenu),l=i.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:u}=s,d={__scopeMenu:e.__scopeMenu},p=i.useCallback((()=>{l.current&&window.clearTimeout(l.current),l.current=null}),[]);return i.useEffect((()=>p),[p]),i.useEffect((()=>{const e=c.current;return()=>{window.clearTimeout(e),u(null)}}),[c,u]),t.jsx(c2,{asChild:!0,...d,children:t.jsx(C2,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":a.contentId,"data-state":G2(r.open),...e,ref:YU(n,a.onTriggerChange),onClick:t=>{e.onClick?.(t),e.disabled||t.defaultPrevented||(t.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:FQ(e.onPointerMove,Y2((t=>{s.onItemEnter(t),t.defaultPrevented||e.disabled||r.open||l.current||(s.onPointerGraceIntentChange(null),l.current=window.setTimeout((()=>{r.onOpenChange(!0),p()}),100))}))),onPointerLeave:FQ(e.onPointerLeave,Y2((e=>{p();const t=r.content?.getBoundingClientRect();if(t){const n=r.content?.dataset.side,o="right"===n,i=t[o?"left":"right"],a=t[o?"right":"left"];s.onPointerGraceIntentChange({area:[{x:e.clientX+(o?-5:5),y:e.clientY},{x:i,y:t.top},{x:a,y:t.top},{x:a,y:t.bottom},{x:i,y:t.bottom}],side:n}),window.clearTimeout(c.current),c.current=window.setTimeout((()=>s.onPointerGraceIntentChange(null)),300)}else{if(s.onTriggerLeave(e),e.defaultPrevented)return;s.onPointerGraceIntentChange(null)}}))),onKeyDown:FQ(e.onKeyDown,(t=>{e.disabled||""!==s.searchRef.current&&" "===t.key||W1[o.dir].includes(t.key)&&(r.onOpenChange(!0),r.content?.focus(),t.preventDefault())}))})})}));z2.displayName=B2;var H2="MenuSubContent",q2=i.forwardRef(((e,n)=>{const r=p2(h2,e.__scopeMenu),{forceMount:o=r.forceMount,...a}=e,s=i2(h2,e.__scopeMenu),l=s2(h2,e.__scopeMenu),c=V2(H2,e.__scopeMenu),u=i.useRef(null),d=XU(n,u);return t.jsx(Z1.Provider,{scope:e.__scopeMenu,children:t.jsx(T1,{present:o||s.open,children:t.jsx(Z1.Slot,{scope:e.__scopeMenu,children:t.jsx(x2,{id:c.contentId,"aria-labelledby":c.triggerId,...a,ref:d,align:"start",side:"rtl"===l.dir?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{l.isUsingKeyboardRef.current&&u.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:FQ(e.onFocusOutside,(e=>{e.target!==c.trigger&&s.onOpenChange(!1)})),onEscapeKeyDown:FQ(e.onEscapeKeyDown,(e=>{l.onClose(),e.preventDefault()})),onKeyDown:FQ(e.onKeyDown,(e=>{const t=e.currentTarget.contains(e.target),n=Y1[l.dir].includes(e.key);t&&n&&(s.onOpenChange(!1),c.trigger?.focus(),e.preventDefault())}))})})})})}));function G2(e){return e?"open":"closed"}function K2(e){return"indeterminate"===e}function W2(e){return K2(e)?"indeterminate":e?"checked":"unchecked"}function Y2(e){return t=>"mouse"===t.pointerType?e(t):void 0}q2.displayName=H2;var X2=l2,Z2=c2,Q2=f2,J2=v2,e3=w2,t3=_2,n3=T2,r3=A2,o3=P2,i3=M2,a3=I2,s3=F2,l3=U2,c3=z2,u3=q2,d3="DropdownMenu",[p3,f3]=UQ(d3,[t2]),h3=t2(),[m3,g3]=p3(d3),v3=e=>{const{__scopeDropdownMenu:n,children:r,dir:o,open:a,defaultOpen:s,onOpenChange:l,modal:c=!0}=e,u=h3(n),d=i.useRef(null),[p=!1,f]=BQ({prop:a,defaultProp:s,onChange:l});return t.jsx(m3,{scope:n,triggerId:EJ(),triggerRef:d,contentId:EJ(),open:p,onOpenChange:f,onOpenToggle:i.useCallback((()=>f((e=>!e))),[f]),modal:c,children:t.jsx(X2,{...u,open:p,onOpenChange:f,dir:o,modal:c,children:r})})};v3.displayName=d3;var y3="DropdownMenuTrigger",b3=i.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,disabled:o=!1,...i}=e,a=g3(y3,r),s=h3(r);return t.jsx(Z2,{asChild:!0,...s,children:t.jsx(WQ.button,{type:"button",id:a.triggerId,"aria-haspopup":"menu","aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?"open":"closed","data-disabled":o?"":void 0,disabled:o,...i,ref:YU(n,a.triggerRef),onPointerDown:FQ(e.onPointerDown,(e=>{o||0!==e.button||!1!==e.ctrlKey||(a.onOpenToggle(),a.open||e.preventDefault())})),onKeyDown:FQ(e.onKeyDown,(e=>{o||(["Enter"," "].includes(e.key)&&a.onOpenToggle(),"ArrowDown"===e.key&&a.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(e.key)&&e.preventDefault())}))})})}));b3.displayName=y3;var x3=e=>{const{__scopeDropdownMenu:n,...r}=e,o=h3(n);return t.jsx(Q2,{...o,...r})};x3.displayName="DropdownMenuPortal";var w3="DropdownMenuContent",_3=i.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,a=g3(w3,r),s=h3(r),l=i.useRef(!1);return t.jsx(J2,{id:a.contentId,"aria-labelledby":a.triggerId,...s,...o,ref:n,onCloseAutoFocus:FQ(e.onCloseAutoFocus,(e=>{l.current||a.triggerRef.current?.focus(),l.current=!1,e.preventDefault()})),onInteractOutside:FQ(e.onInteractOutside,(e=>{const t=e.detail.originalEvent;a.modal&&!(2===t.button||0===t.button&&!0===t.ctrlKey)||(l.current=!0)})),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})}));_3.displayName=w3;i.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=h3(r);return t.jsx(e3,{...i,...o,ref:n})})).displayName="DropdownMenuGroup";var S3=i.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=h3(r);return t.jsx(t3,{...i,...o,ref:n})}));S3.displayName="DropdownMenuLabel";var E3=i.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=h3(r);return t.jsx(n3,{...i,...o,ref:n})}));E3.displayName="DropdownMenuItem";var T3=i.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=h3(r);return t.jsx(r3,{...i,...o,ref:n})}));T3.displayName="DropdownMenuCheckboxItem";i.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=h3(r);return t.jsx(o3,{...i,...o,ref:n})})).displayName="DropdownMenuRadioGroup";var C3=i.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=h3(r);return t.jsx(i3,{...i,...o,ref:n})}));C3.displayName="DropdownMenuRadioItem";var A3=i.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=h3(r);return t.jsx(a3,{...i,...o,ref:n})}));A3.displayName="DropdownMenuItemIndicator";var N3=i.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=h3(r);return t.jsx(s3,{...i,...o,ref:n})}));N3.displayName="DropdownMenuSeparator";i.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=h3(r);return t.jsx(l3,{...i,...o,ref:n})})).displayName="DropdownMenuArrow";var R3=i.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=h3(r);return t.jsx(c3,{...i,...o,ref:n})}));R3.displayName="DropdownMenuSubTrigger";var O3=i.forwardRef(((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=h3(r);return t.jsx(u3,{...i,...o,ref:n,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})}));O3.displayName="DropdownMenuSubContent";var P3=x3,k3=_3,M3=S3,j3=E3,L3=T3,D3=C3,I3=A3,F3=N3,U3=R3,$3=O3;const V3=v3,B3=b3;i.forwardRef((({className:e,inset:n,children:r,...o},i)=>t.jsxs(U3,{ref:i,className:Zd("flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",n&&"pl-8",e),...o,children:[r,t.jsx(mu,{className:"ml-auto"})]}))).displayName=U3.displayName;i.forwardRef((({className:e,...n},r)=>t.jsx($3,{ref:r,className:Zd("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n}))).displayName=$3.displayName;const z3=i.forwardRef((({className:e,sideOffset:n=4,...r},o)=>t.jsx(P3,{children:t.jsx(k3,{ref:o,sideOffset:n,className:Zd("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})})));z3.displayName=k3.displayName;const H3=i.forwardRef((({className:e,inset:n,...r},o)=>t.jsx(j3,{ref:o,className:Zd("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",n&&"pl-8",e),...r})));H3.displayName=j3.displayName;i.forwardRef((({className:e,children:n,checked:r,...o},i)=>t.jsxs(L3,{ref:i,className:Zd("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:r,...o,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(I3,{children:t.jsx(pu,{className:"h-4 w-4"})})}),n]}))).displayName=L3.displayName;i.forwardRef((({className:e,children:n,...r},o)=>t.jsxs(D3,{ref:o,className:Zd("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(I3,{children:t.jsx(wu,{className:"h-2 w-2 fill-current"})})}),n]}))).displayName=D3.displayName;i.forwardRef((({className:e,inset:n,...r},o)=>t.jsx(M3,{ref:o,className:Zd("px-2 py-1.5 text-sm font-semibold",n&&"pl-8",e),...r}))).displayName=M3.displayName;i.forwardRef((({className:e,...n},r)=>t.jsx(F3,{ref:r,className:Zd("-mx-1 my-1 h-px bg-muted",e),...n}))).displayName=F3.displayName;const q3=i.forwardRef((({className:e,type:n,...r},o)=>t.jsx("input",{type:n,className:Zd("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:o,...r})));function G3({data:e,columns:t,enableDebug:r=!1,paginationMode:o="none",initialPageSize:a=10,initialPageIndex:s=0,cursorPaginationQueryResult:l,onQueryParametersChange:c,manualPageCount:u}){const d=n.useMemo((()=>e),[e]),p=n.useMemo((()=>t),[t]),f="cursor"===o,h=l,[m,g]=n.useState(s),[v,y]=n.useState([void 0]),[b,x]=n.useState(a);n.useEffect((()=>{if(f&&h){const{isLoading:e,isFetching:t,isPlaceholderData:n,nextCursor:r}=h;e||t||n||!r||""===r?e||t||n||r&&""!==r||!(v.length>m+1)||y((e=>e.slice(0,m+1))):v.length===m+1&&y((e=>[...e,r]))}}),[f,h,m,v]);const w=n.useCallback((()=>{f&&(g(s),y([void 0]),x(a),c&&c({cursor:void 0,pageSize:a}))}),[f,c,a,s]),[_,S]=n.useState({pageIndex:f?m:s,pageSize:b});n.useEffect((()=>{f&&_.pageIndex!==m&&S((e=>({...e,pageIndex:m})))}),[m,_.pageIndex,f]);const E=n.useCallback((e=>{if(!f||!c)return;let t,n=m,r=b;"object"==typeof e?(r=e.newPageSize,n=0,x(r),g(n),y([void 0]),c({cursor:void 0,pageSize:r})):"prev"===e?(n=Math.max(m-1,0),t=v[n],g(n),c({cursor:t,pageSize:b})):"next"===e&&h&&h.nextCursor&&""!==h.nextCursor&&(n=m+1,t=h.nextCursor,g(n),c({cursor:t,pageSize:b}))}),[f,c,m,v,b,h]),T=f&&m>0,C=!!(f&&h&&h.nextCursor&&""!==h.nextCursor),[A,N]=n.useState(""),R=function(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=i.useState((()=>({current:LQ(t)}))),[r,o]=i.useState((()=>n.current.initialState));return n.current.setOptions((t=>({...t,...e,state:{...r,...e.state},onStateChange:t=>{o(t),null==e.onStateChange||e.onStateChange(t)}}))),n.current}({data:d,columns:p,state:{globalFilter:A,pagination:_},getCoreRowModel:e=>QZ((()=>[e.options.data]),(t=>{const n={rows:[],flatRows:[],rowsById:{}},r=function(t,o,i){void 0===o&&(o=0);const a=[];for(let l=0;l<t.length;l++){const c=oQ(e,e._getRowId(t[l],l,i),t[l],l,o,0,null==i?void 0:i.id);var s;n.flatRows.push(c),n.rowsById[c.id]=c,a.push(c),e.options.getSubRows&&(c.originalSubRows=e.options.getSubRows(t[l],l),null!=(s=c.originalSubRows)&&s.length&&(c.subRows=r(c.originalSubRows,o+1,c)))}return a};return n.rows=r(t),n}),JZ(e.options,"debugTable","getRowModel",(()=>e._autoResetPageIndex()))),getFilteredRowModel:e=>QZ((()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter]),((t,n,r)=>{if(!t.rows.length||(null==n||!n.length)&&!r){for(let e=0;e<t.flatRows.length;e++)t.flatRows[e].columnFilters={},t.flatRows[e].columnFiltersMeta={};return t}const o=[],i=[];(null!=n?n:[]).forEach((t=>{var n;const r=e.getColumn(t.id);if(!r)return;const i=r.getFilterFn();i?o.push({id:t.id,filterFn:i,resolvedValue:null!=(n=null==i.resolveFilterValue?void 0:i.resolveFilterValue(t.value))?n:t.value}):process}));const a=(null!=n?n:[]).map((e=>e.id)),s=e.getGlobalFilterFn(),l=e.getAllLeafColumns().filter((e=>e.getCanGlobalFilter()));let c,u;r&&s&&l.length&&(a.push("__global__"),l.forEach((e=>{var t;i.push({id:e.id,filterFn:s,resolvedValue:null!=(t=null==s.resolveFilterValue?void 0:s.resolveFilterValue(r))?t:r})})));for(let e=0;e<t.flatRows.length;e++){const n=t.flatRows[e];if(n.columnFilters={},o.length)for(let e=0;e<o.length;e++){c=o[e];const t=c.id;n.columnFilters[t]=c.filterFn(n,t,c.resolvedValue,(e=>{n.columnFiltersMeta[t]=e}))}if(i.length){for(let e=0;e<i.length;e++){u=i[e];const t=u.id;if(u.filterFn(n,t,u.resolvedValue,(e=>{n.columnFiltersMeta[t]=e}))){n.columnFilters.__global__=!0;break}}!0!==n.columnFilters.__global__&&(n.columnFilters.__global__=!1)}}return DQ(t.rows,(e=>{for(let t=0;t<a.length;t++)if(!1===e.columnFilters[a[t]])return!1;return!0}),e)}),JZ(e.options,"debugTable","getFilteredRowModel",(()=>e._autoResetPageIndex()))),onGlobalFilterChange:N,onPaginationChange:S,..."standard"===o&&{getPaginationRowModel:e=>QZ((()=>[e.getState().pagination,e.getPrePaginationRowModel(),e.options.paginateExpandedRows?void 0:e.getState().expanded]),((t,n)=>{if(!n.rows.length)return n;const{pageSize:r,pageIndex:o}=t;let{rows:i,flatRows:a,rowsById:s}=n;const l=r*o;let c;i=i.slice(l,l+r),c=e.options.paginateExpandedRows?{rows:i,flatRows:a,rowsById:s}:function(e){const t=[],n=e=>{var r;t.push(e),null!=(r=e.subRows)&&r.length&&e.getIsExpanded()&&e.subRows.forEach(n)};return e.rows.forEach(n),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}({rows:i,flatRows:a,rowsById:s}),c.flatRows=[];const u=e=>{c.flatRows.push(e),e.subRows.length&&e.subRows.forEach(u)};return c.rows.forEach(u),c}),JZ(e.options,"debugTable","getPaginationRowModel")),pageCount:void 0!==u?u:void 0},...f&&{manualPagination:!0,pageCount:void 0!==u?u:-1},debugTable:r,debugHeaders:r,debugColumns:r});n.useEffect((()=>{!f&&R&&R.getState().pagination.pageIndex!==s&&R.setPageIndex(s)}),[s,R,f]),n.useEffect((()=>{R&&R.getState().pagination.pageSize!==b&&R.setPageSize(b)}),[b,R]);const O=f?v[m]:void 0;return{...R,setGlobalFilter:N,globalFilter:A,...f&&{currentApiCursor:O,handleCursorNavigation:E,canGoPreviousForCursor:T,canGoNextForCursor:C,resetCursorPagination:w,logicalPage:m}}}function K3({data:e,columns:r,enableDebug:o=!1,paginationMode:i="none",initialPageSize:a=10,initialPageIndex:s=0,headerActions:l,isLoading:c=!1,cursorPaginationQueryResult:u,onQueryParametersChange:d,searchValue:p,onSearchChange:f,onRowClick:h}){const m=G3({data:e??[],columns:r,enableDebug:o,paginationMode:i,initialPageSize:a,initialPageIndex:s,cursorPaginationQueryResult:u,onQueryParametersChange:d}),g=n.useRef(null),[v,y]=n.useState(!1),b="standard"===i,x="cursor"===i,w=x?m.canGoPreviousForCursor??!1:m.getCanPreviousPage(),_=x?m.canGoNextForCursor??!1:m.getCanNextPage(),S=!b&&!x||c?null:t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx(vZ,{"data-testid":"previous-button",variant:"outline",size:"sm",className:"bg-card",onClick:()=>{x&&m.handleCursorNavigation?m.handleCursorNavigation("prev"):m.previousPage()},disabled:!w||c,children:t.jsx(hu,{className:"h-4 w-4 mr-1"})}),b&&t.jsxs("span",{className:"text-sm text-muted-foreground",children:["Page ",m.getState().pagination.pageIndex+1," of"," ",-1===m.getPageCount()?"many":m.getPageCount()]}),t.jsx(vZ,{"data-testid":"next-button",variant:"outline",size:"sm",className:"bg-card",onClick:()=>{x&&m.handleCursorNavigation?m.handleCursorNavigation("next"):m.nextPage()},disabled:!_||c,children:t.jsx(mu,{className:"h-4 w-4 ml-1"})}),t.jsxs(V3,{children:[t.jsx(B3,{asChild:!0,children:t.jsxs(vZ,{variant:"outline",size:"sm",className:"bg-card",disabled:c,children:[m.getState().pagination.pageSize," rows",t.jsx(fu,{className:"ml-1 h-4 w-4"})]})}),t.jsx(z3,{align:"end",children:[5,10,20,30,50].map((e=>t.jsxs(H3,{onClick:()=>{x&&m.handleCursorNavigation?m.handleCursorNavigation({newPageSize:e}):m.setPageSize(e)},children:[e," rows"]},e)))})]})]}),E=()=>t.jsxs(zZ,{className:"flex-grow min-h-0 relative",children:[t.jsx(HZ,{className:Zd("sticky top-0 z-10",v&&"shadow-md border-b border-slate-200"),children:m.getHeaderGroups().map((e=>t.jsx(GZ,{children:e.headers.map((e=>t.jsx(KZ,{colSpan:e.colSpan,children:e.isPlaceholder?null:IQ(e.column.columnDef.header,e.getContext())},e.id)))},e.id)))}),t.jsx(qZ,{children:m.getRowModel().rows.length?m.getRowModel().rows.map((e=>t.jsx(GZ,{className:Zd("rounded-b-md",h&&"cursor-pointer hover:bg-muted/90 transition-colors"),"data-state":e.getIsSelected()&&"selected",onClick:()=>h?.(e.original),children:e.getVisibleCells().map((e=>t.jsx(WZ,{children:IQ(e.column.columnDef.cell,e.getContext())},e.id)))},e.id))):t.jsx(GZ,{children:t.jsx(WZ,{colSpan:r.length,className:"h-24 text-center",children:"No results found"})})})]}),T=()=>t.jsx("div",{className:"h-full w-full flex items-center justify-center",children:t.jsx(hZ,{})});return t.jsxs("div",{className:"flex flex-col h-full border rounded-lg shadow-sm hover:shadow-md transition-shadow duration-300 overflow-hidden",children:[t.jsxs("div",{className:"flex flex-col items-start gap-3 py-4 px-2 sticky top-0 z-20 bg-primary/5 border-b rounded-t-md md:flex-row md:items-center md:justify-between",children:[t.jsx("div",{className:"md:w-1/4",children:t.jsx(q3,{placeholder:"Search...",value:p??m.getState().globalFilter??"",onChange:e=>{const t=e.target.value;f?f(t):m.setGlobalFilter(t)},className:"max-w-sm bg-card",disabled:c})}),t.jsxs("div",{className:"flex items-center space-x-4",children:[S,l&&t.jsx("div",{children:l})]})]}),t.jsx("div",{ref:g,className:"w-full overflow-x-auto h-full",onScroll:()=>{g.current&&y(g.current.scrollTop>0)},children:t.jsx(c?T:E,{})}),o&&t.jsx("div",{className:"mt-4",children:t.jsx("pre",{className:"p-2 bg-gray-50 text-xs overflow-x-auto",children:t.jsx("code",{children:JSON.stringify(m.getState(),null,2)})})})]})}q3.displayName="Input";var W3={};Object.defineProperty(W3,"__esModule",{value:!0}),W3.parse=function(e,t){const n=new e5,r=e.length;if(r<2)return n;const o=t?.decode||r5;let i=0;do{const t=e.indexOf("=",i);if(-1===t)break;const a=e.indexOf(";",i),s=-1===a?r:a;if(t>s){i=e.lastIndexOf(";",t-1)+1;continue}const l=t5(e,i,t),c=n5(e,t,l),u=e.slice(l,c);if(void 0===n[u]){let r=t5(e,t+1,s),i=n5(e,s,r);const a=o(e.slice(r,i));n[u]=a}i=s+1}while(i<r);return n},W3.serialize=function(e,t,n){const r=n?.encode||encodeURIComponent;if(!Y3.test(e))throw new TypeError(`argument name is invalid: ${e}`);const o=r(t);if(!X3.test(o))throw new TypeError(`argument val is invalid: ${t}`);let i=e+"="+o;if(!n)return i;if(void 0!==n.maxAge){if(!Number.isInteger(n.maxAge))throw new TypeError(`option maxAge is invalid: ${n.maxAge}`);i+="; Max-Age="+n.maxAge}if(n.domain){if(!Z3.test(n.domain))throw new TypeError(`option domain is invalid: ${n.domain}`);i+="; Domain="+n.domain}if(n.path){if(!Q3.test(n.path))throw new TypeError(`option path is invalid: ${n.path}`);i+="; Path="+n.path}if(n.expires){if(!function(e){return"[object Date]"===J3.call(e)}
|
|
76
76
|
/**
|
|
77
77
|
* react-router v7.5.2
|
|
78
78
|
*
|
|
@@ -82,7 +82,7 @@ function IQ(e,t){return e?function(e){return"function"==typeof e&&(()=>{const t=
|
|
|
82
82
|
* LICENSE.md file in the root directory of this source tree.
|
|
83
83
|
*
|
|
84
84
|
* @license MIT
|
|
85
|
-
*/(n.expires)||!Number.isFinite(n.expires.valueOf()))throw new TypeError(`option expires is invalid: ${n.expires}`);i+="; Expires="+n.expires.toUTCString()}n.httpOnly&&(i+="; HttpOnly");n.secure&&(i+="; Secure");n.partitioned&&(i+="; Partitioned");if(n.priority){switch("string"==typeof n.priority?n.priority.toLowerCase():void 0){case"low":i+="; Priority=Low";break;case"medium":i+="; Priority=Medium";break;case"high":i+="; Priority=High";break;default:throw new TypeError(`option priority is invalid: ${n.priority}`)}}if(n.sameSite){switch("string"==typeof n.sameSite?n.sameSite.toLowerCase():n.sameSite){case!0:case"strict":i+="; SameSite=Strict";break;case"lax":i+="; SameSite=Lax";break;case"none":i+="; SameSite=None";break;default:throw new TypeError(`option sameSite is invalid: ${n.sameSite}`)}}return i};const Y3=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,X3=/^[\u0021-\u003A\u003C-\u007E]*$/,Z3=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,Q3=/^[\u0020-\u003A\u003D-\u007E]*$/,J3=Object.prototype.toString,e5=(()=>{const e=function(){};return e.prototype=Object.create(null),e})();function t5(e,t,n){do{const n=e.charCodeAt(t);if(32!==n&&9!==n)return t}while(++t<n);return n}function n5(e,t,n){for(;t>n;){const n=e.charCodeAt(--t);if(32!==n&&9!==n)return t+1}return n}function r5(e){if(-1===e.indexOf("%"))return e;try{return decodeURIComponent(e)}catch(JSe){return e}}function o5(e={}){let t,{initialEntries:n=["/"],initialIndex:r,v5Compat:o=!1}=e;t=n.map(((e,t)=>u(e,"string"==typeof e?null:e.state,0===t?"default":void 0)));let i=l(null==r?t.length-1:r),a="POP",s=null;function l(e){return Math.min(Math.max(e,0),t.length-1)}function c(){return t[i]}function u(e,n=null,r){let o=function(e,t,n=null,r){let o={pathname:"string"==typeof e?e:e.pathname,search:"",hash:"",..."string"==typeof t?c5(t):t,state:n,key:t&&t.key||r||s5()};return o}(t?c().pathname:"/",e,n,r);return a5("/"===o.pathname.charAt(0),`relative pathnames are not supported in memory history: ${JSON.stringify(e)}`),o}function d(e){return"string"==typeof e?e:l5(e)}return{get index(){return i},get action(){return a},get location(){return c()},createHref:d,createURL:e=>new URL(d(e),"http://localhost"),encodeLocation(e){let t="string"==typeof e?c5(e):e;return{pathname:t.pathname||"",search:t.search||"",hash:t.hash||""}},push(e,n){a="PUSH";let r=u(e,n);i+=1,t.splice(i,t.length,r),o&&s&&s({action:a,location:r,delta:1})},replace(e,n){a="REPLACE";let r=u(e,n);t[i]=r,o&&s&&s({action:a,location:r,delta:0})},go(e){a="POP";let n=l(i+e);i=n,s&&s({action:a,location:t[n],delta:e})},listen:e=>(s=e,()=>{s=null})}}function i5(e,t){if(!1===e||null==e)throw new Error(t)}function a5(e,t){if(!e)try{throw new Error(t)}catch(JSe){}}function s5(){return Math.random().toString(36).substring(2,10)}function l5({pathname:e="/",search:t="",hash:n=""}){return t&&"?"!==t&&(e+="?"===t.charAt(0)?t:"?"+t),n&&"#"!==n&&(e+="#"===n.charAt(0)?n:"#"+n),e}function c5(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function u5(e,t,n="/"){return function(e,t,n,r){let o="string"==typeof t?c5(t):t,i=E5(o.pathname||"/",n);if(null==i)return null;let a=d5(e);!function(e){e.sort(((e,t)=>e.score!==t.score?t.score-e.score:function(e,t){let n=e.length===t.length&&e.slice(0,-1).every(((e,n)=>e===t[n]));return n?e[e.length-1]-t[t.length-1]:0}(e.routesMeta.map((e=>e.childrenIndex)),t.routesMeta.map((e=>e.childrenIndex)))))}(a);let s=null;for(let l=0;null==s&&l<a.length;++l){let e=S5(i);s=w5(a[l],e,r)}return s}(e,t,n,!1)}function d5(e,t=[],n=[],r=""){let o=(e,o,i)=>{let a={relativePath:void 0===i?e.path||"":i,caseSensitive:!0===e.caseSensitive,childrenIndex:o,route:e};a.relativePath.startsWith("/")&&(i5(a.relativePath.startsWith(r),`Absolute route path "${a.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),a.relativePath=a.relativePath.slice(r.length));let s=N5([r,a.relativePath]),l=n.concat(a);e.children&&e.children.length>0&&(i5(!0!==e.index,`Index routes must not have child routes. Please remove all child routes from route path "${s}".`),d5(e.children,t,l,s)),(null!=e.path||e.index)&&t.push({path:s,score:x5(s,e.index),routesMeta:l})};return e.forEach(((e,t)=>{if(""!==e.path&&e.path?.includes("?"))for(let n of p5(e.path))o(e,t,n);else o(e,t)})),t}function p5(e){let t=e.split("/");if(0===t.length)return[];let[n,...r]=t,o=n.endsWith("?"),i=n.replace(/\?$/,"");if(0===r.length)return o?[i,""]:[i];let a=p5(r.join("/")),s=[];return s.push(...a.map((e=>""===e?i:[i,e].join("/")))),o&&s.push(...a),s.map((t=>e.startsWith("/")&&""===t?"/":t))}var f5=/^:[\w-]+$/,h5=3,m5=2,g5=1,v5=10,y5=-2,b5=e=>"*"===e;function x5(e,t){let n=e.split("/"),r=n.length;return n.some(b5)&&(r+=y5),t&&(r+=m5),n.filter((e=>!b5(e))).reduce(((e,t)=>e+(f5.test(t)?h5:""===t?g5:v5)),r)}function w5(e,t,n=!1){let{routesMeta:r}=e,o={},i="/",a=[];for(let s=0;s<r.length;++s){let e=r[s],l=s===r.length-1,c="/"===i?t:t.slice(i.length)||"/",u=_5({path:e.relativePath,caseSensitive:e.caseSensitive,end:l},c),d=e.route;if(!u&&l&&n&&!r[r.length-1].route.index&&(u=_5({path:e.relativePath,caseSensitive:e.caseSensitive,end:!1},c)),!u)return null;Object.assign(o,u.params),a.push({params:o,pathname:N5([i,u.pathname]),pathnameBase:R5(N5([i,u.pathnameBase])),route:d}),"/"!==u.pathnameBase&&(i=N5([i,u.pathnameBase]))}return a}function _5(e,t){"string"==typeof e&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=function(e,t=!1,n=!0){a5("*"===e||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,((e,t,n)=>(r.push({paramName:t,isOptional:null!=n}),n?"/?([^\\/]+)?":"/([^\\/]+)")));e.endsWith("*")?(r.push({paramName:"*"}),o+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":""!==e&&"/"!==e&&(o+="(?:(?=\\/|$))");let i=new RegExp(o,t?void 0:"i");return[i,r]}(e.path,e.caseSensitive,e.end),o=t.match(n);if(!o)return null;let i=o[0],a=i.replace(/(.)\/+$/,"$1"),s=o.slice(1);return{params:r.reduce(((e,{paramName:t,isOptional:n},r)=>{if("*"===t){a=i.slice(0,i.length-(s[r]||"").length).replace(/(.)\/+$/,"$1")}const o=s[r];return e[t]=n&&!o?void 0:(o||"").replace(/%2F/g,"/"),e}),{}),pathname:i,pathnameBase:a,pattern:e}}function S5(e){try{return e.split("/").map((e=>decodeURIComponent(e).replace(/\//g,"%2F"))).join("/")}catch(t){return a5(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function E5(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&"/"!==r?null:e.slice(n)||"/"}function T5(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function C5(e){let t=function(e){return e.filter(((e,t)=>0===t||e.route.path&&e.route.path.length>0))}(e);return t.map(((e,n)=>n===t.length-1?e.pathname:e.pathnameBase))}function A5(e,t,n,r=!1){let o;"string"==typeof e?o=c5(e):(o={...e},i5(!o.pathname||!o.pathname.includes("?"),T5("?","pathname","search",o)),i5(!o.pathname||!o.pathname.includes("#"),T5("#","pathname","hash",o)),i5(!o.search||!o.search.includes("#"),T5("#","search","hash",o)));let i,a=""===e||""===o.pathname,s=a?"/":o.pathname;if(null==s)i=n;else{let e=t.length-1;if(!r&&s.startsWith("..")){let t=s.split("/");for(;".."===t[0];)t.shift(),e-=1;o.pathname=t.join("/")}i=e>=0?t[e]:"/"}let l=function(e,t="/"){let{pathname:n,search:r="",hash:o=""}="string"==typeof e?c5(e):e,i=n?n.startsWith("/")?n:function(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach((e=>{".."===e?n.length>1&&n.pop():"."!==e&&n.push(e)})),n.length>1?n.join("/"):"/"}(n,t):t;return{pathname:i,search:O5(r),hash:P5(o)}}(o,i),c=s&&"/"!==s&&s.endsWith("/"),u=(a||"."===s)&&n.endsWith("/");return l.pathname.endsWith("/")||!c&&!u||(l.pathname+="/"),l}var N5=e=>e.join("/").replace(/\/\/+/g,"/"),R5=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),O5=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",P5=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";var k5=["POST","PUT","PATCH","DELETE"];new Set(k5);var M5=["GET",...k5];new Set(M5);var j5=i.createContext(null);j5.displayName="DataRouter";var L5=i.createContext(null);L5.displayName="DataRouterState";var D5=i.createContext({isTransitioning:!1});D5.displayName="ViewTransition",i.createContext(new Map).displayName="Fetchers",i.createContext(null).displayName="Await";var I5=i.createContext(null);I5.displayName="Navigation";var F5=i.createContext(null);F5.displayName="Location";var U5=i.createContext({outlet:null,matches:[],isDataRoute:!1});U5.displayName="Route";var $5=i.createContext(null);function V5(){return null!=i.useContext(F5)}function B5(){return i5(V5(),"useLocation() may be used only in the context of a <Router> component."),i.useContext(F5).location}$5.displayName="RouteError";var z5="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function H5(e){i.useContext(I5).static||i.useLayoutEffect(e)}function q5(){let{isDataRoute:e}=i.useContext(U5);return e?function(){let{router:e}=function(e){let t=i.useContext(j5);return i5(t,Q5(e)),t}("useNavigate"),t=J5("useNavigate"),n=i.useRef(!1);return H5((()=>{n.current=!0})),i.useCallback((async(r,o={})=>{a5(n.current,z5),n.current&&("number"==typeof r?e.navigate(r):await e.navigate(r,{fromRouteId:t,...o}))}),[e,t])}():function(){i5(V5(),"useNavigate() may be used only in the context of a <Router> component.");let e=i.useContext(j5),{basename:t,navigator:n}=i.useContext(I5),{matches:r}=i.useContext(U5),{pathname:o}=B5(),a=JSON.stringify(C5(r)),s=i.useRef(!1);return H5((()=>{s.current=!0})),i.useCallback(((r,i={})=>{if(a5(s.current,z5),!s.current)return;if("number"==typeof r)return void n.go(r);let l=A5(r,JSON.parse(a),o,"path"===i.relative);null==e&&"/"!==t&&(l.pathname="/"===l.pathname?t:N5([t,l.pathname])),(i.replace?n.replace:n.push)(l,i.state,i)}),[t,n,a,o,e])}()}function G5(e,{relative:t}={}){let{matches:n}=i.useContext(U5),{pathname:r}=B5(),o=JSON.stringify(C5(n));return i.useMemo((()=>A5(e,JSON.parse(o),r,"path"===t)),[e,o,r,t])}function K5(e,t,n,r){i5(V5(),"useRoutes() may be used only in the context of a <Router> component.");let o,{navigator:a,static:s}=i.useContext(I5),{matches:l}=i.useContext(U5),c=l[l.length-1],u=c?c.params:{},d=c?c.pathname:"/",p=c?c.pathnameBase:"/",f=c&&c.route;{let e=f&&f.path||"";t4(d,!f||e.endsWith("*")||e.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${d}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.\n\nPlease change the parent <Route path="${e}"> to <Route path="${"/"===e?"*":`${e}/*`}">.`)}o=B5();let h=o.pathname||"/",m=h;if("/"!==p){let e=p.replace(/^\//,"").split("/");m="/"+h.replace(/^\//,"").split("/").slice(e.length).join("/")}let g=!s&&n&&n.matches&&n.matches.length>0?n.matches:u5(e,{pathname:m});a5(f||null!=g,`No routes matched location "${o.pathname}${o.search}${o.hash}" `),a5(null==g||void 0!==g[g.length-1].route.element||void 0!==g[g.length-1].route.Component||void 0!==g[g.length-1].route.lazy,`Matched leaf route at location "${o.pathname}${o.search}${o.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let v=function(e,t=[],n=null){if(null==e){if(!n)return null;if(n.errors)e=n.matches;else{if(0!==t.length||n.initialized||!(n.matches.length>0))return null;e=n.matches}}let r=e,o=n?.errors;if(null!=o){let e=r.findIndex((e=>e.route.id&&void 0!==o?.[e.route.id]));i5(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),r=r.slice(0,Math.min(r.length,e+1))}let a=!1,s=-1;if(n)for(let i=0;i<r.length;i++){let e=r[i];if((e.route.HydrateFallback||e.route.hydrateFallbackElement)&&(s=i),e.route.id){let{loaderData:t,errors:o}=n,i=e.route.loader&&!t.hasOwnProperty(e.route.id)&&(!o||void 0===o[e.route.id]);if(e.route.lazy||i){a=!0,r=s>=0?r.slice(0,s+1):[r[0]];break}}}return r.reduceRight(((e,l,c)=>{let u,d=!1,p=null,f=null;n&&(u=o&&l.route.id?o[l.route.id]:void 0,p=l.route.errorElement||Y5,a&&(s<0&&0===c?(t4("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,f=null):s===c&&(d=!0,f=l.route.hydrateFallbackElement||null)));let h=t.concat(r.slice(0,c+1)),m=()=>{let t;return t=u?p:d?f:l.route.Component?i.createElement(l.route.Component,null):l.route.element?l.route.element:e,i.createElement(Z5,{match:l,routeContext:{outlet:e,matches:h,isDataRoute:null!=n},children:t})};return n&&(l.route.ErrorBoundary||l.route.errorElement||0===c)?i.createElement(X5,{location:n.location,revalidation:n.revalidation,component:p,error:u,children:m(),routeContext:{outlet:null,matches:h,isDataRoute:!0}}):m()}),null)}(g&&g.map((e=>Object.assign({},e,{params:Object.assign({},u,e.params),pathname:N5([p,a.encodeLocation?a.encodeLocation(e.pathname).pathname:e.pathname]),pathnameBase:"/"===e.pathnameBase?p:N5([p,a.encodeLocation?a.encodeLocation(e.pathnameBase).pathname:e.pathnameBase])}))),l,n,r);return v}function W5(){let e=function(){let e=i.useContext($5),t=function(e){let t=i.useContext(L5);return i5(t,Q5(e)),t}("useRouteError"),n=J5("useRouteError");if(void 0!==e)return e;return t.errors?.[n]}(),t=function(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"boolean"==typeof e.internal&&"data"in e}(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:r},a={padding:"2px 4px",backgroundColor:r},s=null;return s=i.createElement(i.Fragment,null,i.createElement("p",null,"💿 Hey developer 👋"),i.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",i.createElement("code",{style:a},"ErrorBoundary")," or"," ",i.createElement("code",{style:a},"errorElement")," prop on your route.")),i.createElement(i.Fragment,null,i.createElement("h2",null,"Unexpected Application Error!"),i.createElement("h3",{style:{fontStyle:"italic"}},t),n?i.createElement("pre",{style:o},n):null,s)}i.createContext(null);var Y5=i.createElement(W5,null),X5=class extends i.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||"idle"!==t.revalidation&&"idle"===e.revalidation?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:void 0!==e.error?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){}render(){return void 0!==this.state.error?i.createElement(U5.Provider,{value:this.props.routeContext},i.createElement($5.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function Z5({routeContext:e,match:t,children:n}){let r=i.useContext(j5);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),i.createElement(U5.Provider,{value:e},n)}function Q5(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function J5(e){let t=function(e){let t=i.useContext(U5);return i5(t,Q5(e)),t}(e),n=t.matches[t.matches.length-1];return i5(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}var e4={};function t4(e,t,n){t||e4[e]||(e4[e]=!0,a5(!1,n))}function n4({basename:e,children:t,initialEntries:n,initialIndex:r}){let o=i.useRef();null==o.current&&(o.current=o5({initialEntries:n,initialIndex:r,v5Compat:!0}));let a=o.current,[s,l]=i.useState({action:a.action,location:a.location}),c=i.useCallback((e=>{i.startTransition((()=>l(e)))}),[l]);return i.useLayoutEffect((()=>a.listen(c)),[a,c]),i.createElement(r4,{basename:e,children:t,location:s.location,navigationType:s.action,navigator:a})}function r4({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:o,static:a=!1}){i5(!V5(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let s=e.replace(/^\/*/,"/"),l=i.useMemo((()=>({basename:s,navigator:o,static:a,future:{}})),[s,o,a]);"string"==typeof n&&(n=c5(n));let{pathname:c="/",search:u="",hash:d="",state:p=null,key:f="default"}=n,h=i.useMemo((()=>{let e=E5(c,s);return null==e?null:{location:{pathname:e,search:u,hash:d,state:p,key:f},navigationType:r}}),[s,c,u,d,p,f,r]);return a5(null!=h,`<Router basename="${s}"> is not able to match the URL "${c}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),null==h?null:i.createElement(I5.Provider,{value:l},i.createElement(F5.Provider,{children:t,value:h}))}i.memo((function({routes:e,future:t,state:n}){return K5(e,0,n,t)}));var o4="get",i4="application/x-www-form-urlencoded";function a4(e){return null!=e&&"string"==typeof e.tagName}function s4(e=""){return new URLSearchParams("string"==typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce(((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map((e=>[n,e])):[[n,r]])}),[]))}var l4=null;var c4=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function u4(e){return null==e||c4.has(e)?e:(a5(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${i4}"`),null)}function d4(e,t){let n,r,o,i,a;if(function(e){return a4(e)&&"form"===e.tagName.toLowerCase()}(e)){let a=e.getAttribute("action");r=a?E5(a,t):null,n=e.getAttribute("method")||o4,o=u4(e.getAttribute("enctype"))||i4,i=new FormData(e)}else if(function(e){return a4(e)&&"button"===e.tagName.toLowerCase()}(e)||function(e){return a4(e)&&"input"===e.tagName.toLowerCase()}(e)&&("submit"===e.type||"image"===e.type)){let a=e.form;if(null==a)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let s=e.getAttribute("formaction")||a.getAttribute("action");if(r=s?E5(s,t):null,n=e.getAttribute("formmethod")||a.getAttribute("method")||o4,o=u4(e.getAttribute("formenctype"))||u4(a.getAttribute("enctype"))||i4,i=new FormData(a,e),!function(){if(null===l4)try{new FormData(document.createElement("form"),0),l4=!1}catch(JSe){l4=!0}return l4}()){let{name:t,type:n,value:r}=e;if("image"===n){let e=t?`${t}.`:"";i.append(`${e}x`,"0"),i.append(`${e}y`,"0")}else t&&i.append(t,r)}}else{if(a4(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=o4,r=null,o=i4,a=e}return i&&"text/plain"===o&&(a=i,i=void 0),{action:r,method:n.toLowerCase(),encType:o,formData:i,body:a}}function p4(e,t){if(!1===e||null==e)throw new Error(t)}function f4(e){return null!=e&&(null==e.href?"preload"===e.rel&&"string"==typeof e.imageSrcSet&&"string"==typeof e.imageSizes:"string"==typeof e.rel&&"string"==typeof e.href)}async function h4(e,t,n){return function(e,t){let n=new Set;return new Set(t),e.reduce(((e,t)=>{let r=JSON.stringify(function(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}(t));return n.has(r)||(n.add(r),e.push({key:r,link:t})),e}),[])}((await Promise.all(e.map((async e=>{let r=t.routes[e.route.id];if(r){let e=await async function(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return window.__reactRouterContext&&window,window.location.reload(),new Promise((()=>{}))}}(r,n);return e.links?e.links():[]}return[]})))).flat(1).filter(f4).filter((e=>"stylesheet"===e.rel||"preload"===e.rel)).map((e=>"stylesheet"===e.rel?{...e,rel:"prefetch",as:"style"}:{...e,rel:"prefetch"})))}function m4(e,t,n,r,o,i){let a=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith("*")&&n[t].params["*"]!==e.params["*"];return"assets"===i?t.filter(((e,t)=>a(e,t)||s(e,t))):"data"===i?t.filter(((t,i)=>{let l=r.routes[t.route.id];if(!l||!l.hasLoader)return!1;if(a(t,i)||s(t,i))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if("boolean"==typeof r)return r}return!0})):[]}function g4(e,t,{includeHydrateFallback:n}={}){return r=e.map((e=>{let r=t.routes[e.route.id];if(!r)return[];let o=[r.module];return r.clientActionModule&&(o=o.concat(r.clientActionModule)),r.clientLoaderModule&&(o=o.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(o=o.concat(r.hydrateFallbackModule)),r.imports&&(o=o.concat(r.imports)),o})).flat(1),[...new Set(r)];var r}function v4(){let e=i.useContext(j5);return p4(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}var y4=i.createContext(void 0);function b4(){let e=i.useContext(y4);return p4(e,"You must render this element inside a <HydratedRouter> element"),e}function x4(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function w4({page:e,...t}){let{router:n}=v4(),r=i.useMemo((()=>u5(n.routes,e,n.basename)),[n.routes,e,n.basename]);return r?i.createElement(_4,{page:e,matches:r,...t}):null}function _4({page:e,matches:t,...n}){let r=B5(),{manifest:o,routeModules:a}=b4(),{basename:s}=v4(),{loaderData:l,matches:c}=function(){let e=i.useContext(L5);return p4(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}(),u=i.useMemo((()=>m4(e,t,c,o,r,"data")),[e,t,c,o,r]),d=i.useMemo((()=>m4(e,t,c,o,r,"assets")),[e,t,c,o,r]),p=i.useMemo((()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,i=!1;if(t.forEach((e=>{let t=o.routes[e.route.id];t&&t.hasLoader&&(!u.some((t=>t.route.id===e.route.id))&&e.route.id in l&&a[e.route.id]?.shouldRevalidate||t.hasClientLoader?i=!0:n.add(e.route.id))})),0===n.size)return[];let c=function(e,t){let n="string"==typeof e?new URL(e,"undefined"==typeof window?"server://singlefetch/":window.location.origin):e;return n.pathname="/"===n.pathname?"_root.data":t&&"/"===E5(n.pathname,t)?`${t.replace(/\/$/,"")}/_root.data`:`${n.pathname.replace(/\/$/,"")}.data`,n}(e,s);return i&&n.size>0&&c.searchParams.set("_routes",t.filter((e=>n.has(e.route.id))).map((e=>e.route.id)).join(",")),[c.pathname+c.search]}),[s,l,r,o,u,t,e,a]),f=i.useMemo((()=>g4(d,o)),[d,o]),h=function(e){let{manifest:t,routeModules:n}=b4(),[r,o]=i.useState([]);return i.useEffect((()=>{let r=!1;return h4(e,t,n).then((e=>{r||o(e)})),()=>{r=!0}}),[e,t,n]),r}(d);return i.createElement(i.Fragment,null,p.map((e=>i.createElement("link",{key:e,rel:"prefetch",as:"fetch",href:e,...n}))),f.map((e=>i.createElement("link",{key:e,rel:"modulepreload",href:e,...n}))),h.map((({key:e,link:t})=>i.createElement("link",{key:e,...t}))))}function S4(...e){return t=>{e.forEach((e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)}))}}y4.displayName="FrameworkContext";var E4="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;try{E4&&(window.__reactRouterVersion="7.5.2")}catch(JSe){}var T4=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,C4=i.forwardRef((function({onClick:e,discover:t="render",prefetch:n="none",relative:r,reloadDocument:o,replace:a,state:s,target:l,to:c,preventScrollReset:u,viewTransition:d,...p},f){let h,{basename:m}=i.useContext(I5),g="string"==typeof c&&T4.test(c),v=!1;if("string"==typeof c&&g&&(h=c,E4))try{let e=new URL(window.location.href),t=c.startsWith("//")?new URL(e.protocol+c):new URL(c),n=E5(t.pathname,m);t.origin===e.origin&&null!=n?c=n+t.search+t.hash:v=!0}catch(JSe){a5(!1,`<Link to="${c}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let y=function(e,{relative:t}={}){i5(V5(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=i.useContext(I5),{hash:o,pathname:a,search:s}=G5(e,{relative:t}),l=a;return"/"!==n&&(l="/"===a?n:N5([n,a])),r.createHref({pathname:l,search:s,hash:o})}(c,{relative:r}),[b,x,w]=function(e,t){let n=i.useContext(y4),[r,o]=i.useState(!1),[a,s]=i.useState(!1),{onFocus:l,onBlur:c,onMouseEnter:u,onMouseLeave:d,onTouchStart:p}=t,f=i.useRef(null);i.useEffect((()=>{if("render"===e&&s(!0),"viewport"===e){let e=new IntersectionObserver((e=>{e.forEach((e=>{s(e.isIntersecting)}))}),{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}}),[e]),i.useEffect((()=>{if(r){let e=setTimeout((()=>{s(!0)}),100);return()=>{clearTimeout(e)}}}),[r]);let h=()=>{o(!0)},m=()=>{o(!1),s(!1)};return n?"intent"!==e?[a,f,{}]:[a,f,{onFocus:x4(l,h),onBlur:x4(c,m),onMouseEnter:x4(u,h),onMouseLeave:x4(d,m),onTouchStart:x4(p,h)}]:[!1,f,{}]}(n,p),_=function(e,{target:t,replace:n,state:r,preventScrollReset:o,relative:a,viewTransition:s}={}){let l=q5(),c=B5(),u=G5(e,{relative:a});return i.useCallback((i=>{if(function(e,t){return!(0!==e.button||t&&"_self"!==t||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e))}(i,t)){i.preventDefault();let t=void 0!==n?n:l5(c)===l5(u);l(e,{replace:t,state:r,preventScrollReset:o,relative:a,viewTransition:s})}}),[c,l,u,n,r,t,e,o,a,s])}(c,{replace:a,state:s,target:l,preventScrollReset:u,relative:r,viewTransition:d});let S=i.createElement("a",{...p,...w,href:h||y,onClick:v||o?e:function(t){e&&e(t),t.defaultPrevented||_(t)},ref:S4(f,x),target:l,"data-discover":g||"render"!==t?void 0:"true"});return b&&!g?i.createElement(i.Fragment,null,S,i.createElement(w4,{page:y})):S}));function A4(e){let t=i.useContext(j5);return i5(t,function(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}(e)),t}function N4(e){a5("undefined"!=typeof URLSearchParams,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=i.useRef(s4(e)),n=i.useRef(!1),r=B5(),o=i.useMemo((()=>function(e,t){let n=s4(e);return t&&t.forEach(((e,r)=>{n.has(r)||t.getAll(r).forEach((e=>{n.append(r,e)}))})),n}(r.search,n.current?null:t.current)),[r.search]),a=q5(),s=i.useCallback(((e,t)=>{const r=s4("function"==typeof e?e(o):e);n.current=!0,a("?"+r,t)}),[a,o]);return[o,s]}C4.displayName="Link",i.forwardRef((function({"aria-current":e="page",caseSensitive:t=!1,className:n="",end:r=!1,style:o,to:a,viewTransition:s,children:l,...c},u){let d=G5(a,{relative:c.relative}),p=B5(),f=i.useContext(L5),{navigator:h,basename:m}=i.useContext(I5),g=null!=f&&function(e,t={}){let n=i.useContext(D5);i5(null!=n,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=A4("useViewTransitionState"),o=G5(e,{relative:t.relative});if(!n.isTransitioning)return!1;let a=E5(n.currentLocation.pathname,r)||n.currentLocation.pathname,s=E5(n.nextLocation.pathname,r)||n.nextLocation.pathname;return null!=_5(o.pathname,s)||null!=_5(o.pathname,a)}(d)&&!0===s,v=h.encodeLocation?h.encodeLocation(d).pathname:d.pathname,y=p.pathname,b=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(y=y.toLowerCase(),b=b?b.toLowerCase():null,v=v.toLowerCase()),b&&m&&(b=E5(b,m)||b);const x="/"!==v&&v.endsWith("/")?v.length-1:v.length;let w,_=y===v||!r&&y.startsWith(v)&&"/"===y.charAt(x),S=null!=b&&(b===v||!r&&b.startsWith(v)&&"/"===b.charAt(v.length)),E={isActive:_,isPending:S,isTransitioning:g},T=_?e:void 0;w="function"==typeof n?n(E):[n,_?"active":null,S?"pending":null,g?"transitioning":null].filter(Boolean).join(" ");let C="function"==typeof o?o(E):o;return i.createElement(C4,{...c,"aria-current":T,className:w,ref:u,style:C,to:a,viewTransition:s},"function"==typeof l?l(E):l)})).displayName="NavLink",i.forwardRef((({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:o,state:a,method:s=o4,action:l,onSubmit:c,relative:u,preventScrollReset:d,viewTransition:p,...f},h)=>{let m=function(){let{router:e}=A4("useSubmit"),{basename:t}=i.useContext(I5),n=J5("useRouteId");return i.useCallback((async(r,o={})=>{let{action:i,method:a,encType:s,formData:l,body:c}=d4(r,t);if(!1===o.navigate){let t=o.fetcherKey||O4();await e.fetch(t,n,o.action||i,{preventScrollReset:o.preventScrollReset,formData:l,body:c,formMethod:o.method||a,formEncType:o.encType||s,flushSync:o.flushSync})}else await e.navigate(o.action||i,{preventScrollReset:o.preventScrollReset,formData:l,body:c,formMethod:o.method||a,formEncType:o.encType||s,replace:o.replace,state:o.state,fromRouteId:n,flushSync:o.flushSync,viewTransition:o.viewTransition})}),[e,t,n])}(),g=function(e,{relative:t}={}){let{basename:n}=i.useContext(I5),r=i.useContext(U5);i5(r,"useFormAction must be used inside a RouteContext");let[o]=r.matches.slice(-1),a={...G5(e||".",{relative:t})},s=B5();if(null==e){a.search=s.search;let e=new URLSearchParams(a.search),t=e.getAll("index");if(t.some((e=>""===e))){e.delete("index"),t.filter((e=>e)).forEach((t=>e.append("index",t)));let n=e.toString();a.search=n?`?${n}`:""}}e&&"."!==e||!o.route.index||(a.search=a.search?a.search.replace(/^\?/,"?index&"):"?index");"/"!==n&&(a.pathname="/"===a.pathname?n:N5([n,a.pathname]));return l5(a)}(l,{relative:u}),v="get"===s.toLowerCase()?"get":"post",y="string"==typeof l&&T4.test(l);return i.createElement("form",{ref:h,method:v,action:g,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,i=r?.getAttribute("formmethod")||s;m(r||e.currentTarget,{fetcherKey:t,method:i,navigate:n,replace:o,state:a,relative:u,preventScrollReset:d,viewTransition:p})},...f,"data-discover":y||"render"!==e?void 0:"true"})})).displayName="Form";var R4=0,O4=()=>`__${String(++R4)}__`;new TextEncoder;var P4,k4="dismissableLayer.update",M4="dismissableLayer.pointerDownOutside",j4="dismissableLayer.focusOutside",L4=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),D4=i.forwardRef(((e,n)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:s,onInteractOutside:l,onDismiss:c,...u}=e,d=i.useContext(L4),[p,f]=i.useState(null),h=p?.ownerDocument??globalThis?.document,[,m]=i.useState({}),g=XU(n,(e=>f(e))),v=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=v.indexOf(y),x=p?v.indexOf(p):-1,w=d.layersWithOutsidePointerEventsDisabled.size>0,_=x>=b,S=function(e,t=globalThis?.document){const n=VQ(e),r=i.useRef(!1),o=i.useRef((()=>{}));return i.useEffect((()=>{const e=e=>{if(e.target&&!r.current){let r=function(){F4(M4,n,i,{discrete:!0})};const i={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",o.current),o.current=r,t.addEventListener("click",o.current,{once:!0})):r()}else t.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout((()=>{t.addEventListener("pointerdown",e)}),0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",e),t.removeEventListener("click",o.current)}}),[t,n]),{onPointerDownCapture:()=>r.current=!0}}((e=>{const t=e.target,n=[...d.branches].some((e=>e.contains(t)));_&&!n&&(a?.(e),l?.(e),e.defaultPrevented||c?.())}),h),E=function(e,t=globalThis?.document){const n=VQ(e),r=i.useRef(!1);return i.useEffect((()=>{const e=e=>{if(e.target&&!r.current){F4(j4,n,{originalEvent:e},{discrete:!1})}};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)}),[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}((e=>{const t=e.target;[...d.branches].some((e=>e.contains(t)))||(s?.(e),l?.(e),e.defaultPrevented||c?.())}),h);return JQ((e=>{x===d.layers.size-1&&(o?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))}),h),i.useEffect((()=>{if(p)return r&&(0===d.layersWithOutsidePointerEventsDisabled.size&&(P4=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(p)),d.layers.add(p),I4(),()=>{r&&1===d.layersWithOutsidePointerEventsDisabled.size&&(h.body.style.pointerEvents=P4)}}),[p,h,r,d]),i.useEffect((()=>()=>{p&&(d.layers.delete(p),d.layersWithOutsidePointerEventsDisabled.delete(p),I4())}),[p,d]),i.useEffect((()=>{const e=()=>m({});return document.addEventListener(k4,e),()=>document.removeEventListener(k4,e)}),[]),t.jsx(WQ.div,{...u,ref:g,style:{pointerEvents:w?_?"auto":"none":void 0,...e.style},onFocusCapture:FQ(e.onFocusCapture,E.onFocusCapture),onBlurCapture:FQ(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:FQ(e.onPointerDownCapture,S.onPointerDownCapture)})}));D4.displayName="DismissableLayer";function I4(){const e=new CustomEvent(k4);document.dispatchEvent(e)}function F4(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?YQ(o,i):o.dispatchEvent(i)}i.forwardRef(((e,n)=>{const r=i.useContext(L4),o=i.useRef(null),a=XU(n,o);return i.useEffect((()=>{const e=o.current;if(e)return r.branches.add(e),()=>{r.branches.delete(e)}}),[r.branches]),t.jsx(WQ.div,{...e,ref:a})})).displayName="DismissableLayerBranch";var U4=i.forwardRef(((e,n)=>t.jsx(WQ.span,{...e,ref:n,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}})));U4.displayName="VisuallyHidden";var $4=U4,[V4,B4]=UQ("Tooltip",[o1]),z4=o1(),H4="TooltipProvider",q4=700,G4="tooltip.open",[K4,W4]=V4(H4),Y4=e=>{const{__scopeTooltip:n,delayDuration:r=q4,skipDelayDuration:o=300,disableHoverableContent:a=!1,children:s}=e,[l,c]=i.useState(!0),u=i.useRef(!1),d=i.useRef(0);return i.useEffect((()=>{const e=d.current;return()=>window.clearTimeout(e)}),[]),t.jsx(K4,{scope:n,isOpenDelayed:l,delayDuration:r,onOpen:i.useCallback((()=>{window.clearTimeout(d.current),c(!1)}),[]),onClose:i.useCallback((()=>{window.clearTimeout(d.current),d.current=window.setTimeout((()=>c(!0)),o)}),[o]),isPointerInTransitRef:u,onPointerInTransitChange:i.useCallback((e=>{u.current=e}),[]),disableHoverableContent:a,children:s})};Y4.displayName=H4;var X4="Tooltip",[Z4,Q4]=V4(X4),J4=e=>{const{__scopeTooltip:n,children:r,open:o,defaultOpen:a=!1,onOpenChange:s,disableHoverableContent:l,delayDuration:c}=e,u=W4(X4,e.__scopeTooltip),d=z4(n),[p,f]=i.useState(null),h=EJ(),m=i.useRef(0),g=l??u.disableHoverableContent,v=c??u.delayDuration,y=i.useRef(!1),[b=!1,x]=BQ({prop:o,defaultProp:a,onChange:e=>{e?(u.onOpen(),document.dispatchEvent(new CustomEvent(G4))):u.onClose(),s?.(e)}}),w=i.useMemo((()=>b?y.current?"delayed-open":"instant-open":"closed"),[b]),_=i.useCallback((()=>{window.clearTimeout(m.current),m.current=0,y.current=!1,x(!0)}),[x]),S=i.useCallback((()=>{window.clearTimeout(m.current),m.current=0,x(!1)}),[x]),E=i.useCallback((()=>{window.clearTimeout(m.current),m.current=window.setTimeout((()=>{y.current=!0,x(!0),m.current=0}),v)}),[v,x]);return i.useEffect((()=>()=>{m.current&&(window.clearTimeout(m.current),m.current=0)}),[]),t.jsx(x1,{...d,children:t.jsx(Z4,{scope:n,contentId:h,open:b,stateAttribute:w,trigger:p,onTriggerChange:f,onTriggerEnter:i.useCallback((()=>{u.isOpenDelayed?E():_()}),[u.isOpenDelayed,E,_]),onTriggerLeave:i.useCallback((()=>{g?S():(window.clearTimeout(m.current),m.current=0)}),[S,g]),onOpen:_,onClose:S,disableHoverableContent:g,children:r})})};J4.displayName=X4;var e6="TooltipTrigger",t6=i.forwardRef(((e,n)=>{const{__scopeTooltip:r,...o}=e,a=Q4(e6,r),s=W4(e6,r),l=z4(r),c=XU(n,i.useRef(null),a.onTriggerChange),u=i.useRef(!1),d=i.useRef(!1),p=i.useCallback((()=>u.current=!1),[]);return i.useEffect((()=>()=>document.removeEventListener("pointerup",p)),[p]),t.jsx(w1,{asChild:!0,...l,children:t.jsx(WQ.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...o,ref:c,onPointerMove:FQ(e.onPointerMove,(e=>{"touch"!==e.pointerType&&(d.current||s.isPointerInTransitRef.current||(a.onTriggerEnter(),d.current=!0))})),onPointerLeave:FQ(e.onPointerLeave,(()=>{a.onTriggerLeave(),d.current=!1})),onPointerDown:FQ(e.onPointerDown,(()=>{u.current=!0,document.addEventListener("pointerup",p,{once:!0})})),onFocus:FQ(e.onFocus,(()=>{u.current||a.onOpen()})),onBlur:FQ(e.onBlur,a.onClose),onClick:FQ(e.onClick,a.onClose)})})}));t6.displayName=e6;var n6="TooltipPortal",[r6,o6]=V4(n6,{forceMount:void 0}),i6=e=>{const{__scopeTooltip:n,forceMount:r,children:o,container:i}=e,a=Q4(n6,n);return t.jsx(r6,{scope:n,forceMount:r,children:t.jsx(T1,{present:r||a.open,children:t.jsx(E1,{asChild:!0,container:i,children:o})})})};i6.displayName=n6;var a6="TooltipContent",s6=i.forwardRef(((e,n)=>{const r=o6(a6,e.__scopeTooltip),{forceMount:o=r.forceMount,side:i="top",...a}=e,s=Q4(a6,e.__scopeTooltip);return t.jsx(T1,{present:o||s.open,children:t.jsx(s.disableHoverableContent?d6:l6,{side:i,...a,ref:n})})})),l6=i.forwardRef(((e,n)=>{const r=Q4(a6,e.__scopeTooltip),o=W4(a6,e.__scopeTooltip),a=i.useRef(null),s=XU(n,a),[l,c]=i.useState(null),{trigger:u,onClose:d}=r,p=a.current,{onPointerInTransitChange:f}=o,h=i.useCallback((()=>{c(null),f(!1)}),[f]),m=i.useCallback(((e,t)=>{const n={x:e.clientX,y:e.clientY},r=function(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n})}return r}(n,function(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,o,i)){case i:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}(n,e.currentTarget.getBoundingClientRect())),o=function(e){const t=e.slice();return t.sort(((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:e.y>t.y?1:0)),function(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const n=e[r];for(;t.length>=2;){const e=t[t.length-1],r=t[t.length-2];if(!((e.x-r.x)*(n.y-r.y)>=(e.y-r.y)*(n.x-r.x)))break;t.pop()}t.push(n)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const t=e[r];for(;n.length>=2;){const e=n[n.length-1],r=n[n.length-2];if(!((e.x-r.x)*(t.y-r.y)>=(e.y-r.y)*(t.x-r.x)))break;n.pop()}n.push(t)}return n.pop(),1===t.length&&1===n.length&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}(t)}([...r,...function(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}(t.getBoundingClientRect())]);c(o),f(!0)}),[f]);return i.useEffect((()=>()=>h()),[h]),i.useEffect((()=>{if(u&&p){const e=e=>m(e,p),t=e=>m(e,u);return u.addEventListener("pointerleave",e),p.addEventListener("pointerleave",t),()=>{u.removeEventListener("pointerleave",e),p.removeEventListener("pointerleave",t)}}}),[u,p,m,h]),i.useEffect((()=>{if(l){const e=e=>{const t=e.target,n={x:e.clientX,y:e.clientY},r=u?.contains(t)||p?.contains(t),o=!function(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,a=t.length-1;i<t.length;a=i++){const e=t[i].x,s=t[i].y,l=t[a].y;s>r!=l>r&&n<(t[a].x-e)*(r-s)/(l-s)+e&&(o=!o)}return o}(n,l);r?h():o&&(h(),d())};return document.addEventListener("pointermove",e),()=>document.removeEventListener("pointermove",e)}}),[u,p,l,d,h]),t.jsx(d6,{...e,ref:s})})),[c6,u6]=V4(X4,{isInside:!1}),d6=i.forwardRef(((e,n)=>{const{__scopeTooltip:r,children:o,"aria-label":a,onEscapeKeyDown:s,onPointerDownOutside:l,...c}=e,u=Q4(a6,r),d=z4(r),{onClose:p}=u;return i.useEffect((()=>(document.addEventListener(G4,p),()=>document.removeEventListener(G4,p))),[p]),i.useEffect((()=>{if(u.trigger){const e=e=>{const t=e.target;t?.contains(u.trigger)&&p()};return window.addEventListener("scroll",e,{capture:!0}),()=>window.removeEventListener("scroll",e,{capture:!0})}}),[u.trigger,p]),t.jsx(D4,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:e=>e.preventDefault(),onDismiss:p,children:t.jsxs(_1,{"data-state":u.stateAttribute,...d,...c,ref:n,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[t.jsx(qQ,{children:o}),t.jsx(c6,{scope:r,isInside:!0,children:t.jsx($4,{id:u.contentId,role:"tooltip",children:a||o})})]})})}));s6.displayName=a6;var p6="TooltipArrow";i.forwardRef(((e,n)=>{const{__scopeTooltip:r,...o}=e,i=z4(r);return u6(p6,r).isInside?null:t.jsx(S1,{...i,...o,ref:n})})).displayName=p6;var f6=i6,h6=s6;const m6=Y4,g6=J4,v6=t6,y6=i.forwardRef((({className:e,sideOffset:n=4,...r},o)=>t.jsx(f6,{children:t.jsx(h6,{ref:o,sideOffset:n,className:Zd("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})})));y6.displayName=h6.displayName;const b6=({rowOriginal:e,constructNavigationUrl:n,cellText:r,cellIcon:o=null,tooltipIcon:i=null,tooltipText:a=null})=>{const s=q5();return a?t.jsx(m6,{children:t.jsx("div",{className:"text-sm h-8 flex items-center justify-end",children:t.jsxs(g6,{children:[t.jsx(v6,{asChild:!0,children:t.jsxs(vZ,{variant:"outline",onClick:()=>s(n(e.id)),children:[o,r,i]})}),t.jsx(y6,{className:"max-w-[300px] text-sm bg-white border border-gray-200 rounded-lg p-4",children:t.jsx("p",{className:"text-muted-foreground",children:a})})]})})}):t.jsx("div",{className:"text-sm h-8 flex items-center justify-end",children:t.jsxs(vZ,{variant:"outline",onClick:()=>s(n(e.id)),children:[o,r,i]})})};var x6,w6="dismissableLayer.update",_6="dismissableLayer.pointerDownOutside",S6="dismissableLayer.focusOutside",E6=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),T6=i.forwardRef(((e,n)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:s,onInteractOutside:l,onDismiss:c,...u}=e,d=i.useContext(E6),[p,f]=i.useState(null),h=p?.ownerDocument??globalThis?.document,[,m]=i.useState({}),g=XU(n,(e=>f(e))),v=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=v.indexOf(y),x=p?v.indexOf(p):-1,w=d.layersWithOutsidePointerEventsDisabled.size>0,_=x>=b,S=function(e,t=globalThis?.document){const n=VQ(e),r=i.useRef(!1),o=i.useRef((()=>{}));return i.useEffect((()=>{const e=e=>{if(e.target&&!r.current){let r=function(){A6(_6,n,i,{discrete:!0})};const i={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",o.current),o.current=r,t.addEventListener("click",o.current,{once:!0})):r()}else t.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout((()=>{t.addEventListener("pointerdown",e)}),0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",e),t.removeEventListener("click",o.current)}}),[t,n]),{onPointerDownCapture:()=>r.current=!0}}((e=>{const t=e.target,n=[...d.branches].some((e=>e.contains(t)));_&&!n&&(a?.(e),l?.(e),e.defaultPrevented||c?.())}),h),E=function(e,t=globalThis?.document){const n=VQ(e),r=i.useRef(!1);return i.useEffect((()=>{const e=e=>{if(e.target&&!r.current){A6(S6,n,{originalEvent:e},{discrete:!1})}};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)}),[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}((e=>{const t=e.target;[...d.branches].some((e=>e.contains(t)))||(s?.(e),l?.(e),e.defaultPrevented||c?.())}),h);return JQ((e=>{x===d.layers.size-1&&(o?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))}),h),i.useEffect((()=>{if(p)return r&&(0===d.layersWithOutsidePointerEventsDisabled.size&&(x6=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(p)),d.layers.add(p),C6(),()=>{r&&1===d.layersWithOutsidePointerEventsDisabled.size&&(h.body.style.pointerEvents=x6)}}),[p,h,r,d]),i.useEffect((()=>()=>{p&&(d.layers.delete(p),d.layersWithOutsidePointerEventsDisabled.delete(p),C6())}),[p,d]),i.useEffect((()=>{const e=()=>m({});return document.addEventListener(w6,e),()=>document.removeEventListener(w6,e)}),[]),t.jsx(WQ.div,{...u,ref:g,style:{pointerEvents:w?_?"auto":"none":void 0,...e.style},onFocusCapture:FQ(e.onFocusCapture,E.onFocusCapture),onBlurCapture:FQ(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:FQ(e.onPointerDownCapture,S.onPointerDownCapture)})}));T6.displayName="DismissableLayer";function C6(){const e=new CustomEvent(w6);document.dispatchEvent(e)}function A6(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?YQ(o,i):o.dispatchEvent(i)}i.forwardRef(((e,n)=>{const r=i.useContext(E6),o=i.useRef(null),a=XU(n,o);return i.useEffect((()=>{const e=o.current;if(e)return r.branches.add(e),()=>{r.branches.delete(e)}}),[r.branches]),t.jsx(WQ.div,{...e,ref:a})})).displayName="DismissableLayerBranch";var N6="Popover",[R6,O6]=UQ(N6,[o1]),P6=o1(),[k6,M6]=R6(N6),j6=e=>{const{__scopePopover:n,children:r,open:o,defaultOpen:a,onOpenChange:s,modal:l=!1}=e,c=P6(n),u=i.useRef(null),[d,p]=i.useState(!1),[f=!1,h]=BQ({prop:o,defaultProp:a,onChange:s});return t.jsx(x1,{...c,children:t.jsx(k6,{scope:n,contentId:EJ(),triggerRef:u,open:f,onOpenChange:h,onOpenToggle:i.useCallback((()=>h((e=>!e))),[h]),hasCustomAnchor:d,onCustomAnchorAdd:i.useCallback((()=>p(!0)),[]),onCustomAnchorRemove:i.useCallback((()=>p(!1)),[]),modal:l,children:r})})};j6.displayName=N6;var L6="PopoverAnchor";i.forwardRef(((e,n)=>{const{__scopePopover:r,...o}=e,a=M6(L6,r),s=P6(r),{onCustomAnchorAdd:l,onCustomAnchorRemove:c}=a;return i.useEffect((()=>(l(),()=>c())),[l,c]),t.jsx(w1,{...s,...o,ref:n})})).displayName=L6;var D6="PopoverTrigger",I6=i.forwardRef(((e,n)=>{const{__scopePopover:r,...o}=e,i=M6(D6,r),a=P6(r),s=XU(n,i.triggerRef),l=t.jsx(WQ.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":W6(i.open),...o,ref:s,onClick:FQ(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?l:t.jsx(w1,{asChild:!0,...a,children:l})}));I6.displayName=D6;var F6="PopoverPortal",[U6,$6]=R6(F6,{forceMount:void 0}),V6=e=>{const{__scopePopover:n,forceMount:r,children:o,container:i}=e,a=M6(F6,n);return t.jsx(U6,{scope:n,forceMount:r,children:t.jsx(T1,{present:r||a.open,children:t.jsx(E1,{asChild:!0,container:i,children:o})})})};V6.displayName=F6;var B6="PopoverContent",z6=i.forwardRef(((e,n)=>{const r=$6(B6,e.__scopePopover),{forceMount:o=r.forceMount,...i}=e,a=M6(B6,e.__scopePopover);return t.jsx(T1,{present:o||a.open,children:t.jsx(a.modal?H6:q6,{...i,ref:n})})}));z6.displayName=B6;var H6=i.forwardRef(((e,n)=>{const r=M6(B6,e.__scopePopover),o=i.useRef(null),a=XU(n,o),s=i.useRef(!1);return i.useEffect((()=>{const e=o.current;if(e)return LV(e)}),[]),t.jsx(NV,{as:zQ,allowPinchZoom:!0,children:t.jsx(G6,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:FQ(e.onCloseAutoFocus,(e=>{e.preventDefault(),s.current||r.triggerRef.current?.focus()})),onPointerDownOutside:FQ(e.onPointerDownOutside,(e=>{const t=e.detail.originalEvent;s.current=2===t.button||0===t.button&&!0===t.ctrlKey}),{checkForDefaultPrevented:!1}),onFocusOutside:FQ(e.onFocusOutside,(e=>e.preventDefault()),{checkForDefaultPrevented:!1})})})})),q6=i.forwardRef(((e,n)=>{const r=M6(B6,e.__scopePopover),o=i.useRef(!1),a=i.useRef(!1);return t.jsx(G6,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(o.current||r.triggerRef.current?.focus(),t.preventDefault()),o.current=!1,a.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(o.current=!0,"pointerdown"===t.detail.originalEvent.type&&(a.current=!0));const n=t.target,i=r.triggerRef.current?.contains(n);i&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&a.current&&t.preventDefault()}})})),G6=i.forwardRef(((e,n)=>{const{__scopePopover:r,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onInteractOutside:d,...p}=e,f=M6(B6,r),h=P6(r);return cJ(),t.jsx(hJ,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:i,onUnmountAutoFocus:a,children:t.jsx(T6,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:d,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onDismiss:()=>f.onOpenChange(!1),children:t.jsx(_1,{"data-state":W6(f.open),role:"dialog",id:f.contentId,...h,...p,ref:n,style:{...p.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})})),K6="PopoverClose";i.forwardRef(((e,n)=>{const{__scopePopover:r,...o}=e,i=M6(K6,r);return t.jsx(WQ.button,{type:"button",...o,ref:n,onClick:FQ(e.onClick,(()=>i.onOpenChange(!1)))})})).displayName=K6;function W6(e){return e?"open":"closed"}i.forwardRef(((e,n)=>{const{__scopePopover:r,...o}=e,i=P6(r);return t.jsx(S1,{...i,...o,ref:n})})).displayName="PopoverArrow";var Y6=V6,X6=z6;const Z6=j6,Q6=I6,J6=n.forwardRef((({className:e,align:n="center",sideOffset:r=4,...o},i)=>t.jsx(Y6,{children:t.jsx(X6,{ref:i,align:n,sideOffset:r,className:Zd("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...o})})));J6.displayName=X6.displayName;const e8={[Ve.DRAFT]:"Draft",[Ve.ACTIVE]:"Active",[Ve.RUNNING]:"Running",[Ve.COMPLETED]:"Completed",[Ve.FAILED]:"Failed",[Ve.DEACTIVATED]:"Deactivated"},t8={[Ve.DRAFT]:"bg-gray-500",[Ve.ACTIVE]:"bg-blue-500",[Ve.RUNNING]:"bg-yellow-500",[Ve.COMPLETED]:"bg-green-500",[Ve.FAILED]:"bg-red-500",[Ve.DEACTIVATED]:"bg-red-500"},n8={[Ve.DRAFT]:"bg-gray-100 text-gray-700 px-2 py-1",[Ve.ACTIVE]:"bg-blue-100 text-blue-700 px-2 py-1",[Ve.RUNNING]:"bg-yellow-100 text-yellow-700 px-2 py-1",[Ve.COMPLETED]:"bg-green-100 text-green-700 px-2 py-1",[Ve.FAILED]:"bg-red-100 text-red-700 px-2 py-1",[Ve.DEACTIVATED]:"bg-red-100 text-red-700 px-2 py-1"},r8={[Ve.DRAFT]:`Draft ${ff("engage:automation")?.toLowerCase()} can be activated or deactivated`,[Ve.ACTIVE]:`Active ${ff("engage:automation")?.toLowerCase()} can be drafted, deactivated, run, or marked as failed`,[Ve.RUNNING]:`Running ${ff("engage:automation")?.toLowerCase()} can be completed or marked as failed`,[Ve.COMPLETED]:`Completed ${ff("engage:automation")?.toLowerCase()} can only be marked as failed`,[Ve.FAILED]:`Failed ${ff("engage:automation")?.toLowerCase()} requires manual intervention to change state`,[Ve.DEACTIVATED]:`Deactivated ${ff("engage:automation")?.toLowerCase()} cannot be reactivated - create a new one instead`},o8={[Ve.DRAFT]:[Ve.ACTIVE,Ve.DEACTIVATED],[Ve.ACTIVE]:[Ve.DRAFT],[Ve.RUNNING]:[],[Ve.COMPLETED]:[],[Ve.FAILED]:[],[Ve.DEACTIVATED]:[]},i8=({rowOriginal:e,id:r,onToggle:o,className:i="",vsaasManaged:a=!1})=>{const[s,l]=n.useState(!1),c=e.status,u=(o8[c]||[]).filter((e=>!1===a||e!==Ve.DEACTIVATED)),d=u.length>0;return t.jsx("div",{className:`${i}`,onClick:e=>e.stopPropagation(),children:t.jsx(m6,{children:t.jsxs(Z6,{open:!!d&&s,onOpenChange:l,children:[t.jsx(Q6,{asChild:!0,children:t.jsx("div",{className:"relative",children:t.jsxs(vZ,{variant:"outline",className:`flex items-center justify-between px-4 py-2 rounded-md w-full ${n8[c]} ${d?"":"cursor-not-allowed opacity-80"}`,onClick:e=>{e.stopPropagation(),d&&l(!s)},children:[t.jsxs("div",{className:"flex items-center",children:[t.jsx("div",{className:`w-2 h-2 rounded-full mr-2 ${t8[c]}`}),t.jsx("span",{children:e8[c]})]}),d?t.jsx(fu,{className:"h-4 w-4 ml-2"}):t.jsxs(g6,{children:[t.jsx(v6,{asChild:!0,children:t.jsx(Cu,{className:"h-4 w-4 ml-2 text-gray-500"})}),t.jsx(y6,{className:"max-w-xs p-2",children:t.jsx("p",{children:r8[c]})})]})]})})}),d&&t.jsx(J6,{className:"w-full p-2",align:"center",sideOffset:5,children:t.jsx("div",{className:"py-1 flex flex-col gap-2 justify-start items-center",onClick:e=>e.stopPropagation(),children:u.map((e=>t.jsxs(vZ,{variant:"ghost",className:"flex justify-start items-center px-4 py-2 text-sm w-full text-left hover:bg-gray-100 rounded-none "+(c===e?"font-medium":""),onClick:()=>(o(r,e),void l(!1)),children:[t.jsx("div",{className:`w-2 h-2 rounded-full ${t8[e]} mr-2`}),e8[e]]},e)))})})]})})})};function a8(e){const t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new e.constructor(+e):"number"==typeof e||"[object Number]"===t||"string"==typeof e||"[object String]"===t?new Date(e):new Date(NaN)}function s8(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}const l8=6048e5,c8=43200;let u8={};function d8(){return u8}function p8(e,t){const n=d8(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,o=a8(e),i=o.getDay(),a=(i<r?7:0)+i-r;return o.setDate(o.getDate()-a),o.setHours(0,0,0,0),o}function f8(e){return p8(e,{weekStartsOn:1})}function h8(e){const t=a8(e),n=t.getFullYear(),r=s8(e,0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);const o=f8(r),i=s8(e,0);i.setFullYear(n,0,4),i.setHours(0,0,0,0);const a=f8(i);return t.getTime()>=o.getTime()?n+1:t.getTime()>=a.getTime()?n:n-1}function m8(e){const t=a8(e);return t.setHours(0,0,0,0),t}function g8(e){const t=a8(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function v8(e,t){return function(e,t){return s8(e,+a8(e)+t)}(e,6e4*t)}function y8(e,t){const n=a8(e),r=a8(t),o=n.getTime()-r.getTime();return o<0?-1:o>0?1:o}function b8(e){if(!(t=e,t instanceof Date||"object"==typeof t&&"[object Date]"===Object.prototype.toString.call(t)||"number"==typeof e))return!1;var t;const n=a8(e);return!isNaN(Number(n))}function x8(e){const t=a8(e);return+function(e){const t=a8(e);return t.setHours(23,59,59,999),t}(t)==+function(e){const t=a8(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}(t)}function w8(e,t){const n=a8(e),r=a8(t),o=y8(n,r),i=Math.abs(function(e,t){const n=a8(e),r=a8(t);return 12*(n.getFullYear()-r.getFullYear())+(n.getMonth()-r.getMonth())}(n,r));let a;if(i<1)a=0;else{1===n.getMonth()&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-o*i);let t=y8(n,r)===-o;x8(a8(e))&&1===i&&1===y8(e,r)&&(t=!1),a=o*(i-Number(t))}return 0===a?0:a}function _8(e,t,n){const r=function(e,t){return+a8(e)-+a8(t)}(e,t)/1e3;return(o=n?.roundingMethod,e=>{const t=(o?Math[o]:Math.trunc)(e);return 0===t?0:t})(r);var o}const S8={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function E8(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const T8={date:E8({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:E8({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:E8({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},C8={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function A8(e){return(t,n)=>{let r;if("formatting"===(n?.context?String(n.context):"standalone")&&e.formattingValues){const t=e.defaultFormattingWidth||e.defaultWidth,o=n?.width?String(n.width):t;r=e.formattingValues[o]||e.formattingValues[t]}else{const t=e.defaultWidth,o=n?.width?String(n.width):e.defaultWidth;r=e.values[o]||e.values[t]}return r[e.argumentCallback?e.argumentCallback(t):t]}}function N8(e){return(t,n={})=>{const r=n.width,o=t.match(r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth]);if(!o)return null;const i=o[0],a=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],s=Array.isArray(a)?function(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n;return}(a,(e=>e.test(i))):function(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n;return}(a,(e=>e.test(i)));let l;l=e.valueCallback?e.valueCallback(s):s,l=n.valueCallback?n.valueCallback(l):l;return{value:l,rest:t.slice(i.length)}}}var R8;const O8={code:"en-US",formatDistance:(e,t,n)=>{let r;const o=S8[e];return r="string"==typeof o?o:1===t?o.one:o.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r},formatLong:T8,formatRelative:(e,t,n,r)=>C8[e],localize:{ordinalNumber:(e,t)=>{const n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:A8({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:A8({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:A8({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:A8({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:A8({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(R8={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)},(e,t={})=>{const n=e.match(R8.matchPattern);if(!n)return null;const r=n[0],o=e.match(R8.parsePattern);if(!o)return null;let i=R8.valueCallback?R8.valueCallback(o[0]):o[0];return i=t.valueCallback?t.valueCallback(i):i,{value:i,rest:e.slice(r.length)}}),era:N8({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:N8({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:N8({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:N8({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:N8({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function P8(e){const t=a8(e),n=function(e,t){const n=m8(e),r=m8(t),o=+n-g8(n),i=+r-g8(r);return Math.round((o-i)/864e5)}(t,function(e){const t=a8(e),n=s8(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}(t));return n+1}function k8(e){const t=a8(e),n=+f8(t)-+function(e){const t=h8(e),n=s8(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),f8(n)}(t);return Math.round(n/l8)+1}function M8(e,t){const n=a8(e),r=n.getFullYear(),o=d8(),i=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??o.firstWeekContainsDate??o.locale?.options?.firstWeekContainsDate??1,a=s8(e,0);a.setFullYear(r+1,0,i),a.setHours(0,0,0,0);const s=p8(a,t),l=s8(e,0);l.setFullYear(r,0,i),l.setHours(0,0,0,0);const c=p8(l,t);return n.getTime()>=s.getTime()?r+1:n.getTime()>=c.getTime()?r:r-1}function j8(e,t){const n=a8(e),r=+p8(n,t)-+function(e,t){const n=d8(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,o=M8(e,t),i=s8(e,0);return i.setFullYear(o,0,r),i.setHours(0,0,0,0),p8(i,t)}(n,t);return Math.round(r/l8)+1}function L8(e,t){return(e<0?"-":"")+Math.abs(e).toString().padStart(t,"0")}const D8={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return L8("yy"===t?r%100:r,t.length)},M(e,t){const n=e.getMonth();return"M"===t?String(n+1):L8(n+1,2)},d:(e,t)=>L8(e.getDate(),t.length),a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return"am"===n?"a.m.":"p.m."}},h:(e,t)=>L8(e.getHours()%12||12,t.length),H:(e,t)=>L8(e.getHours(),t.length),m:(e,t)=>L8(e.getMinutes(),t.length),s:(e,t)=>L8(e.getSeconds(),t.length),S(e,t){const n=t.length,r=e.getMilliseconds();return L8(Math.trunc(r*Math.pow(10,n-3)),t.length)}},I8="midnight",F8="noon",U8="morning",$8="afternoon",V8="evening",B8="night",z8={G:function(e,t,n){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if("yo"===t){const t=e.getFullYear();return n.ordinalNumber(t>0?t:1-t,{unit:"year"})}return D8.y(e,t)},Y:function(e,t,n,r){const o=M8(e,r),i=o>0?o:1-o;if("YY"===t){return L8(i%100,2)}return"Yo"===t?n.ordinalNumber(i,{unit:"year"}):L8(i,t.length)},R:function(e,t){return L8(h8(e),t.length)},u:function(e,t){return L8(e.getFullYear(),t.length)},Q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return L8(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return L8(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){const r=e.getMonth();switch(t){case"M":case"MM":return D8.M(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return L8(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){const o=j8(e,r);return"wo"===t?n.ordinalNumber(o,{unit:"week"}):L8(o,t.length)},I:function(e,t,n){const r=k8(e);return"Io"===t?n.ordinalNumber(r,{unit:"week"}):L8(r,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getDate(),{unit:"date"}):D8.d(e,t)},D:function(e,t,n){const r=P8(e);return"Do"===t?n.ordinalNumber(r,{unit:"dayOfYear"}):L8(r,t.length)},E:function(e,t,n){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){const o=e.getDay(),i=(o-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return L8(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(o,{width:"short",context:"formatting"});default:return n.day(o,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){const o=e.getDay(),i=(o-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return L8(i,t.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(o,{width:"narrow",context:"standalone"});case"cccccc":return n.day(o,{width:"short",context:"standalone"});default:return n.day(o,{width:"wide",context:"standalone"})}},i:function(e,t,n){const r=e.getDay(),o=0===r?7:r;switch(t){case"i":return String(o);case"ii":return L8(o,t.length);case"io":return n.ordinalNumber(o,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){const r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(e,t,n){const r=e.getHours();let o;switch(o=12===r?F8:0===r?I8:r/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(o,{width:"narrow",context:"formatting"});default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(e,t,n){const r=e.getHours();let o;switch(o=r>=17?V8:r>=12?$8:r>=4?U8:B8,t){case"B":case"BB":case"BBB":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(o,{width:"narrow",context:"formatting"});default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){let t=e.getHours()%12;return 0===t&&(t=12),n.ordinalNumber(t,{unit:"hour"})}return D8.h(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getHours(),{unit:"hour"}):D8.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return"Ko"===t?n.ordinalNumber(r,{unit:"hour"}):L8(r,t.length)},k:function(e,t,n){let r=e.getHours();return 0===r&&(r=24),"ko"===t?n.ordinalNumber(r,{unit:"hour"}):L8(r,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):D8.m(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getSeconds(),{unit:"second"}):D8.s(e,t)},S:function(e,t){return D8.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(0===r)return"Z";switch(t){case"X":return q8(r);case"XXXX":case"XX":return G8(r);default:return G8(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return q8(r);case"xxxx":case"xx":return G8(r);default:return G8(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+H8(r,":");default:return"GMT"+G8(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+H8(r,":");default:return"GMT"+G8(r,":")}},t:function(e,t,n){return L8(Math.trunc(e.getTime()/1e3),t.length)},T:function(e,t,n){return L8(e.getTime(),t.length)}};function H8(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),o=Math.trunc(r/60),i=r%60;return 0===i?n+String(o):n+String(o)+t+L8(i,2)}function q8(e,t){if(e%60==0){return(e>0?"-":"+")+L8(Math.abs(e)/60,2)}return G8(e,t)}function G8(e,t=""){const n=e>0?"-":"+",r=Math.abs(e);return n+L8(Math.trunc(r/60),2)+t+L8(r%60,2)}const K8=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},W8=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},Y8={p:W8,P:(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],o=n[2];if(!o)return K8(e,t);let i;switch(r){case"P":i=t.dateTime({width:"short"});break;case"PP":i=t.dateTime({width:"medium"});break;case"PPP":i=t.dateTime({width:"long"});break;default:i=t.dateTime({width:"full"})}return i.replace("{{date}}",K8(r,t)).replace("{{time}}",W8(o,t))}},X8=/^D+$/,Z8=/^Y+$/,Q8=["D","DD","YY","YYYY"];const J8=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,e9=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,t9=/^'([^]*?)'?$/,n9=/''/g,r9=/[a-zA-Z]/;function o9(e,t,n){const r=d8(),o=r.locale??O8,i=r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,a=r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=a8(e);if(!b8(s))throw new RangeError("Invalid time value");let l=t.match(e9).map((e=>{const t=e[0];if("p"===t||"P"===t){return(0,Y8[t])(e,o.formatLong)}return e})).join("").match(J8).map((e=>{if("''"===e)return{isToken:!1,value:"'"};const t=e[0];if("'"===t)return{isToken:!1,value:i9(e)};if(z8[t])return{isToken:!0,value:e};if(t.match(r9))throw new RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}}));o.localize.preprocessor&&(l=o.localize.preprocessor(s,l));const c={firstWeekContainsDate:i,weekStartsOn:a,locale:o};return l.map((n=>{if(!n.isToken)return n.value;const r=n.value;(function(e){return Z8.test(e)}(r)||function(e){return X8.test(e)}(r))&&function(e,t,n){const r=function(e,t,n){const r="Y"===e[0]?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}(e,t,n);if(Q8.includes(e))throw new RangeError(r)}(r,t,String(e));return(0,z8[r[0]])(s,r,o.localize,c)})).join("")}function i9(e){const t=e.match(t9);return t?t[1].replace(n9,"'"):e}function a9(e,t){return function(e,t,n){const r=d8(),o=n?.locale??r.locale??O8,i=y8(e,t);if(isNaN(i))throw new RangeError("Invalid time value");const a=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:i});let s,l;i>0?(s=a8(t),l=a8(e)):(s=a8(e),l=a8(t));const c=_8(l,s),u=(g8(l)-g8(s))/1e3,d=Math.round((c-u)/60);let p;if(d<2)return n?.includeSeconds?c<5?o.formatDistance("lessThanXSeconds",5,a):c<10?o.formatDistance("lessThanXSeconds",10,a):c<20?o.formatDistance("lessThanXSeconds",20,a):c<40?o.formatDistance("halfAMinute",0,a):o.formatDistance(c<60?"lessThanXMinutes":"xMinutes",1,a):0===d?o.formatDistance("lessThanXMinutes",1,a):o.formatDistance("xMinutes",d,a);if(d<45)return o.formatDistance("xMinutes",d,a);if(d<90)return o.formatDistance("aboutXHours",1,a);if(d<1440){const e=Math.round(d/60);return o.formatDistance("aboutXHours",e,a)}if(d<2520)return o.formatDistance("xDays",1,a);if(d<c8){const e=Math.round(d/1440);return o.formatDistance("xDays",e,a)}if(d<86400)return p=Math.round(d/c8),o.formatDistance("aboutXMonths",p,a);if(p=w8(l,s),p<12){const e=Math.round(d/c8);return o.formatDistance("xMonths",e,a)}{const e=p%12,t=Math.trunc(p/12);return e<3?o.formatDistance("aboutXYears",t,a):e<9?o.formatDistance("overXYears",t,a):o.formatDistance("almostXYears",t+1,a)}}(e,function(e){return s8(e,Date.now())}(e),t)}function s9({accessorKey:e,header:n,meta:r,size:o,minSize:i,maxSize:a,enableSorting:s=!0,enableHiding:l=!0,headerClassName:c,cellClassName:u,cellFormatter:d}){return{accessorKey:e,header:()=>t.jsx("div",{className:`flex items-center h-8 px-3 font-medium whitespace-nowrap text-muted-foreground ${"right"===r?.align?"justify-end float-right":"center"===r?.align?"justify-center":"justify-start"} ${c||""}`.trim(),children:"function"==typeof n?n():t.jsx("span",{children:n})}),cell:e=>t.jsx("div",{className:`flex items-center h-8 ${"right"===r?.align?"justify-end":"center"===r?.align?"justify-center":"justify-start"} ${u||""} ${r?.className||""}`.trim(),children:d?d(e):e.getValue()}),size:o,minSize:i,maxSize:a,enableSorting:s,enableHiding:l,meta:r}}const l9=(e,t,n,r="Error",o="Please try again")=>{e(!1),"error"===n&&t({title:r,description:o,variant:"destructive"})},c9=e=>{switch(e){case Ve.ACTIVE:return"statusActive";case Ve.COMPLETED:return"statusCompleted";case Ve.DRAFT:return"statusDraft";case Ve.DEACTIVATED:return"statusDeactivated";case Ve.FAILED:return"statusFailed";case Ve.RUNNING:return"statusRunning";default:throw LX(e,Ve)}},u9=e=>{switch(e){case rZ.ALL_USERS:return`Default ${ff("engage:segment").toLowerCase()} that contains all ${ff("engage:user").toLowerCase()}}. This is not editable or deletable.`;case rZ.MANAGED:return`System-defined ${ff("engage:segment").toLowerCase()} that are not editable or deletable.`;case rZ.CUSTOM:return`Custom ${ff("engage:segment").toLowerCase()} that you can edit and delete as needed.`;default:throw LX(e,rZ)}};function d9(e="name",n,r=!1){return s9({accessorKey:e,header:n,meta:{align:"left",displayName:n,className:"min-w-[240px] w-full"},cellClassName:"pl-3 pr-2",cellFormatter:e=>{const n=e.getValue(),{original:o}=e.row,i=o.status,a=o.type,s=i?i[0].toUpperCase()+i.slice(1):"",l={[Ve.ACTIVE]:"bg-blue-500",[Ve.COMPLETED]:"bg-green-500",[Ve.DRAFT]:"bg-gray-500",[Ve.DEACTIVATED]:"bg-red-500",[Ve.FAILED]:"bg-red-500",[Ve.RUNNING]:"bg-yellow-500"};return t.jsxs("div",{className:"w-full flex gap-6 justify-between items-center",children:[t.jsxs("div",{className:"flex gap-1 items-center w-full",children:[t.jsx("div",{className:`w-2 h-2 rounded-full mr-3 flex-shrink-0 ${a?{[rZ.ALL_USERS]:"bg-purple-500",[rZ.MANAGED]:"bg-teal-500",[rZ.CUSTOM]:"bg-amber-500"}[a]:i?l[i]:"bg-blue-500"}`}),t.jsxs("div",{className:"flex-1 flex flex-col gap-0.5",children:[t.jsx("span",{className:"leading-tight font-medium text-sm overflow-hidden text-ellipsis",children:n}),r&&o?.description&&t.jsx("div",{className:"relative h-4",children:t.jsx("div",{className:"absolute inset-0 text-muted-foreground text-xs truncate whitespace-nowrap overflow-hidden w-full",children:o?.description})})]})]}),i&&t.jsx("div",{className:"flex-shrink-0",children:t.jsx(kZ,{variant:c9(i),children:s})})]})}})}function p9(){return s9({accessorKey:"type",header:"Type",meta:{align:"right",displayName:`${ff("engage:segment")} type`},cellClassName:"pr-4",cellFormatter:e=>{const n=e.getValue(),r=n?n.split("_").map((e=>e[0].toUpperCase()+e.slice(1).toLowerCase())).join(" "):"Unknown";let o;if(!n||n!==rZ.ALL_USERS&&n!==rZ.MANAGED&&n!==rZ.CUSTOM)o="statusDraft";else try{o=(e=>{switch(e){case rZ.ALL_USERS:return"segmentAllUsers";case rZ.MANAGED:return"segmentManaged";case rZ.CUSTOM:return"segmentCustom";default:throw LX(e,rZ)}})(n)}catch(JSe){if(!(JSe instanceof LX))throw JSe;o="statusDraft"}return t.jsx(m6,{children:t.jsxs(g6,{children:[t.jsx(v6,{asChild:!0,children:t.jsx(kZ,{variant:o,className:"cursor-help",children:r})}),t.jsx(y6,{side:"top",className:"max-w-[250px] text-sm bg-white border border-gray-200 rounded-lg p-3",children:t.jsx("p",{className:"text-muted-foreground",children:n&&u9(n)||`Unknown ${ff("engage:segment").toLowerCase()} type`})})]})})}})}function f9(e="updated_at"){return function({accessorKey:e,header:n,meta:r={align:"right"},size:o=160,minSize:i,maxSize:a,enableSorting:s=!0,enableHiding:l=!0,headerClassName:c,cellClassName:u,formatType:d="relative"}){return{accessorKey:e,header:()=>t.jsx("div",{className:`float-right h-8 flex items-center justify-end px-3 font-medium whitespace-nowrap text-muted-foreground ${c||""}`.trim(),children:t.jsx("span",{children:n})}),cell:e=>{const n=e.getValue();let o="N/A";return n&&(o="relative"===d?a9(new Date(n),{addSuffix:!0}):new Date(n).toLocaleDateString()),t.jsx("div",{className:`font-variant-numeric w-full h-8 flex items-center justify-end pr-4 whitespace-nowrap ${u||""} ${r?.className||""}`.trim(),children:o})},size:o,minSize:i,maxSize:a,enableSorting:s,enableHiding:l,meta:r}}({accessorKey:e,header:"Last Modified",formatType:"relative",size:160,meta:{align:"right",displayName:"Last Modified"}})}function h9(e,n,r){return function({accessorKey:e,header:n,meta:r={align:"right"},size:o,minSize:i,maxSize:a=120,enableSorting:s=!0,enableHiding:l=!0,headerClassName:c,cellClassName:u,prefix:d="",suffix:p="",localeStringOptions:f}){return{accessorKey:e,header:()=>t.jsx("div",{className:`float-right h-8 flex items-center justify-end px-3 font-medium whitespace-nowrap text-muted-foreground ${c||""}`.trim(),children:"function"==typeof n?n():t.jsx("span",{children:n})}),cell:e=>{const n=e.getValue()??0;return t.jsxs("div",{className:`font-variant-numeric h-8 flex items-center justify-end pr-4 ${u||""} ${r?.className||""}`.trim(),children:[d,n.toLocaleString(void 0,f),p]})},size:o||(r?.className?.includes("w-")?void 0:100),minSize:i,maxSize:a,enableSorting:s,enableHiding:l,meta:r}}({accessorKey:e,header:n,prefix:r,meta:{align:"right",displayName:n}})}function m9(e){const{setUrl:n,onToggle:r,automationName:o,vsaasManaged:i}=e;return s9({accessorKey:"status",header:"Status",enableHiding:!1,size:180,maxSize:200,meta:{align:"right"},cellClassName:"pr-4",cellFormatter:e=>{const{original:a}=e.row;return(a.status??null)===Ve.DRAFT&&n&&!1===i?t.jsx(b6,{rowOriginal:a,constructNavigationUrl:()=>n(a.id),cellText:"Action Required",tooltipIcon:t.jsx(Cu,{className:"h-4 w-4 text-muted-foreground !cursor-help z-99"}),tooltipText:`Your ${o?.toLowerCase()} is currently in draft mode. Please review and activate it to begin sending messages.`}):t.jsx(i8,{className:"flex items-center justify-end",rowOriginal:a,id:a.id,onToggle:r||(()=>{}),vsaasManaged:i})}})}function g9(e){const n={align:"right",displayName:`Update ${ff("engage:segment").toLowerCase()}`};return function({id:e="actions",header:n,meta:r={align:"center"},text:o,size:i=80,minSize:a=80,maxSize:s=80,enableSorting:l=!1,enableHiding:c=!1,headerClassName:u,icon:d,onAction:p,actionButtonVariant:f="outline",actionButtonSize:h="default"}){return{id:e,header:()=>t.jsx("div",{className:`float-right h-8 flex items-center justify-end px-3 font-medium whitespace-nowrap text-muted-foreground ${u||""}`.trim(),children:"function"==typeof n?n():t.jsx("span",{children:n})}),cell:e=>{const n=e.row.original,i=n?.type,a="custom"!==i;return t.jsx("div",{className:`flex items-center h-8 pr-3 ${"right"===r?.align?"justify-end":"center"===r?.align?"justify-center":"justify-start"} ${r?.className||""}`.trim(),children:t.jsxs(vZ,{variant:f,size:h,disabled:a,onClick:()=>p(n),children:[t.jsx(d,{className:"h-4 w-4"}),t.jsx("span",{children:o})]})})},size:i,minSize:a,maxSize:s,enableSorting:l,enableHiding:c,meta:r}}({id:"edit",header:`${ff("engage:segment")} actions`,icon:Uu,onAction:t=>{e(t.id)},text:"Edit",enableHiding:!1,size:80,meta:n})}function v9(e){const{automationName:t,setUrl:n,onToggle:r,vsaasManaged:o=!1}=e;return[d9("name","Name",!0),h9("derivedRevenue","Sales","$"),h9("emailsSent","Email Sent"),h9("smsSent","SMS Sent"),f9(),m9({setUrl:n,onToggle:r,automationName:t,vsaasManaged:o})]}const y9=({handleBack:e,handleNext:n,handleSkipAndSaveAsDraft:r,backText:o,nextText:i,backDisabled:a,nextDisabled:s,hideBack:l})=>t.jsxs("div",{className:"flex gap-4 py-2",children:[!l&&t.jsxs(vZ,{onClick:e,disabled:a,variant:"secondary",className:Zd("flex items-center gap-2",a&&"opacity-50 cursor-not-allowed"),children:[t.jsx(wZ.BackButton,{}),t.jsx("span",{children:o})]}),t.jsx(vZ,{onClick:r,variant:"secondary",className:"flex items-center gap-2",children:"Skip & Save as Draft"}),t.jsxs(vZ,{onClick:n,disabled:s,className:Zd("flex items-center gap-2 --reach-destructive",s&&"opacity-50 cursor-not-allowed"),children:[t.jsx("span",{children:i}),t.jsx(wZ.NextButton,{})]})]}),b9=()=>{const e=ve({queryKey:["channel-accounts"],queryFn:()=>(async()=>(await Re("/channel/accounts",{method:"GET"})).data)()});return{channelAccounts:e.data,isFetching:e.isFetching,isLoading:e.isLoading,fetchError:e.error,refetchChannelAccounts:e.refetch}};var x9=(e=>(e.REACH_MANAGED="reach-managed",e.TWILLIO="twillio",e))(x9||{});const w9=()=>{const e=ve({queryKey:["channel-senders"],queryFn:()=>(async()=>(await Re(`${u}`,{method:"GET"})).data)()});return{channelSenders:e.data,isFetching:e.isFetching,isLoading:e.isLoading,fetchError:e.error,refetchChannelSenders:e.refetch}},_9=()=>{const e=ce(),t=ye({mutationFn:e=>(async(e,t)=>(await Re(`${u}/${t}`,{method:"PATCH",body:JSON.stringify(e)})).data)(e.toUpdate,e.id),onSuccess:()=>{e.invalidateQueries({queryKey:["channel-senders"]})}});return{updateChannelSender:t.mutate,isUpdating:t.isPending,updateError:t.error}},S9=(e,t)=>{const[r,o]=n.useState(e);return n.useEffect((()=>{const n=setTimeout((()=>{o(e)}),t);return()=>clearTimeout(n)}),[e,t]),r},E9=({className:e})=>t.jsx("div",{className:Zd("bg-red-500/10 p-2 rounded-full text-red-500",e),children:t.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),T9=({title:e,alertText:r,Icon:o=Cu,onClick:i,asChild:a=!0})=>{const[s,l]=n.useState(!1);return t.jsx(m6,{children:t.jsxs(g6,{open:s,onOpenChange:l,children:[t.jsx(v6,{asChild:a,onClick:e=>{e.stopPropagation(),i?(i(),l(!1)):l(!s)},children:t.jsx(o,{className:"h-3.5 w-3.5 cursor-pointer transition-colors"})}),t.jsx(y6,{className:"text-left",children:t.jsxs("div",{className:"flex flex-col items-start gap-2 max-w-[300px]",children:[r&&t.jsxs(t.Fragment,{children:[t.jsx(E9,{}),t.jsx("p",{className:"font-semibold text-amber-500",children:r})]}),t.jsx("p",{className:"text-[13px] leading-relaxed text-primary-foreground/90 text-left",children:e})]})})]})})};function C9(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function A9(e){const n=N9(e),r=i.forwardRef(((e,r)=>{const{children:o,...a}=e,s=i.Children.toArray(o),l=s.find(O9);if(l){const e=l.props.children,o=s.map((t=>t===l?i.Children.count(e)>1?i.Children.only(null):i.isValidElement(e)?e.props.children:null:t));return t.jsx(n,{...a,ref:r,children:i.isValidElement(e)?i.cloneElement(e,void 0,o):null})}return t.jsx(n,{...a,ref:r,children:o})}));return r.displayName=`${e}.Slot`,r}function N9(e){const t=i.forwardRef(((e,t)=>{const{children:n,...r}=e;if(i.isValidElement(n)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(n),o=function(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{i(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]={...o,...i}:"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==i.Fragment&&(o.ref=t?function(...e){return t=>{let n=!1;const r=e.map((e=>{const r=C9(e,t);return n||"function"!=typeof r||(n=!0),r}));if(n)return()=>{for(let t=0;t<r.length;t++){const n=r[t];"function"==typeof n?n():C9(e[t],null)}}}}(t,e):e),i.cloneElement(n,o)}return i.Children.count(n)>1?i.Children.only(null):null}));return t.displayName=`${e}.SlotClone`,t}var R9=Symbol("radix.slottable");function O9(e){return i.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===R9}var P9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce(((e,n)=>{const r=A9(`Primitive.${n}`),o=i.forwardRef(((e,o)=>{const{asChild:i,...a}=e,s=i?r:n;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t.jsx(s,{...a,ref:o})}));return o.displayName=`Primitive.${n}`,{...e,[n]:o}}),{}),k9=i.forwardRef(((e,n)=>t.jsx(P9.label,{...e,ref:n,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}})));k9.displayName="Label";var M9=k9;const j9=ru("text-foreground text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),L9=i.forwardRef((({className:e,...n},r)=>t.jsx(M9,{ref:r,className:Zd(j9(),e),...n})));function D9(e,[t,n]){return Math.min(n,Math.max(t,e))}function I9(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),!1===n||!r.defaultPrevented)return t?.(r)}}function F9(e,n=[]){let r=[];const o=()=>{const t=r.map((e=>i.createContext(e)));return function(n){const r=n?.[e]||t;return i.useMemo((()=>({[`__scope${e}`]:{...n,[e]:r}})),[n,r])}};return o.scopeName=e,[function(n,o){const a=i.createContext(o),s=r.length;r=[...r,o];const l=n=>{const{scope:r,children:o,...l}=n,c=r?.[e]?.[s]||a,u=i.useMemo((()=>l),Object.values(l));return t.jsx(c.Provider,{value:u,children:o})};return l.displayName=n+"Provider",[l,function(t,r){const l=i.useContext(r?.[e]?.[s]||a);if(l)return l;if(void 0!==o)return o;throw new Error(`\`${t}\` must be used within \`${n}\``)}]},U9(o,...n)]}function U9(...e){const t=e[0];if(1===e.length)return t;const n=()=>{const n=e.map((e=>({useScope:e(),scopeName:e.scopeName})));return function(e){const r=n.reduce(((t,{useScope:n,scopeName:r})=>({...t,...n(e)[`__scope${r}`]})),{});return i.useMemo((()=>({[`__scope${t.scopeName}`]:r})),[r])}};return n.scopeName=t.scopeName,n}function $9(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function V9(...e){return t=>{let n=!1;const r=e.map((e=>{const r=$9(e,t);return n||"function"!=typeof r||(n=!0),r}));if(n)return()=>{for(let t=0;t<r.length;t++){const n=r[t];"function"==typeof n?n():$9(e[t],null)}}}}function B9(...e){return i.useCallback(V9(...e),e)}function z9(e){const n=H9(e),r=i.forwardRef(((e,r)=>{const{children:o,...a}=e,s=i.Children.toArray(o),l=s.find(G9);if(l){const e=l.props.children,o=s.map((t=>t===l?i.Children.count(e)>1?i.Children.only(null):i.isValidElement(e)?e.props.children:null:t));return t.jsx(n,{...a,ref:r,children:i.isValidElement(e)?i.cloneElement(e,void 0,o):null})}return t.jsx(n,{...a,ref:r,children:o})}));return r.displayName=`${e}.Slot`,r}function H9(e){const t=i.forwardRef(((e,t)=>{const{children:n,...r}=e;if(i.isValidElement(n)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(n),o=function(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{i(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]={...o,...i}:"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==i.Fragment&&(o.ref=t?V9(t,e):e),i.cloneElement(n,o)}return i.Children.count(n)>1?i.Children.only(null):null}));return t.displayName=`${e}.SlotClone`,t}L9.displayName=M9.displayName;var q9=Symbol("radix.slottable");function G9(e){return i.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===q9}var K9=i.createContext(void 0);var W9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce(((e,n)=>{const r=z9(`Primitive.${n}`),o=i.forwardRef(((e,o)=>{const{asChild:i,...a}=e,s=i?r:n;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t.jsx(s,{...a,ref:o})}));return o.displayName=`Primitive.${n}`,{...e,[n]:o}}),{});function Y9(e){const t=i.useRef(e);return i.useEffect((()=>{t.current=e})),i.useMemo((()=>(...e)=>t.current?.(...e)),[])}var X9,Z9="dismissableLayer.update",Q9="dismissableLayer.pointerDownOutside",J9="dismissableLayer.focusOutside",e7=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),t7=i.forwardRef(((e,n)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:s,onInteractOutside:l,onDismiss:c,...u}=e,d=i.useContext(e7),[p,f]=i.useState(null),h=p?.ownerDocument??globalThis?.document,[,m]=i.useState({}),g=B9(n,(e=>f(e))),v=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=v.indexOf(y),x=p?v.indexOf(p):-1,w=d.layersWithOutsidePointerEventsDisabled.size>0,_=x>=b,S=function(e,t=globalThis?.document){const n=Y9(e),r=i.useRef(!1),o=i.useRef((()=>{}));return i.useEffect((()=>{const e=e=>{if(e.target&&!r.current){let r=function(){r7(Q9,n,i,{discrete:!0})};const i={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",o.current),o.current=r,t.addEventListener("click",o.current,{once:!0})):r()}else t.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout((()=>{t.addEventListener("pointerdown",e)}),0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",e),t.removeEventListener("click",o.current)}}),[t,n]),{onPointerDownCapture:()=>r.current=!0}}((e=>{const t=e.target,n=[...d.branches].some((e=>e.contains(t)));_&&!n&&(a?.(e),l?.(e),e.defaultPrevented||c?.())}),h),E=function(e,t=globalThis?.document){const n=Y9(e),r=i.useRef(!1);return i.useEffect((()=>{const e=e=>{if(e.target&&!r.current){r7(J9,n,{originalEvent:e},{discrete:!1})}};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)}),[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}((e=>{const t=e.target;[...d.branches].some((e=>e.contains(t)))||(s?.(e),l?.(e),e.defaultPrevented||c?.())}),h);return function(e,t=globalThis?.document){const n=Y9(e);i.useEffect((()=>{const e=e=>{"Escape"===e.key&&n(e)};return t.addEventListener("keydown",e,{capture:!0}),()=>t.removeEventListener("keydown",e,{capture:!0})}),[n,t])}((e=>{x===d.layers.size-1&&(o?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))}),h),i.useEffect((()=>{if(p)return r&&(0===d.layersWithOutsidePointerEventsDisabled.size&&(X9=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(p)),d.layers.add(p),n7(),()=>{r&&1===d.layersWithOutsidePointerEventsDisabled.size&&(h.body.style.pointerEvents=X9)}}),[p,h,r,d]),i.useEffect((()=>()=>{p&&(d.layers.delete(p),d.layersWithOutsidePointerEventsDisabled.delete(p),n7())}),[p,d]),i.useEffect((()=>{const e=()=>m({});return document.addEventListener(Z9,e),()=>document.removeEventListener(Z9,e)}),[]),t.jsx(W9.div,{...u,ref:g,style:{pointerEvents:w?_?"auto":"none":void 0,...e.style},onFocusCapture:I9(e.onFocusCapture,E.onFocusCapture),onBlurCapture:I9(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:I9(e.onPointerDownCapture,S.onPointerDownCapture)})}));t7.displayName="DismissableLayer";function n7(){const e=new CustomEvent(Z9);document.dispatchEvent(e)}function r7(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?function(e,t){e&&a.flushSync((()=>e.dispatchEvent(t)))}(o,i):o.dispatchEvent(i)}i.forwardRef(((e,n)=>{const r=i.useContext(e7),o=i.useRef(null),a=B9(n,o);return i.useEffect((()=>{const e=o.current;if(e)return r.branches.add(e),()=>{r.branches.delete(e)}}),[r.branches]),t.jsx(W9.div,{...e,ref:a})})).displayName="DismissableLayerBranch";var o7=0;function i7(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var a7="focusScope.autoFocusOnMount",s7="focusScope.autoFocusOnUnmount",l7={bubbles:!1,cancelable:!0},c7=i.forwardRef(((e,n)=>{const{loop:r=!1,trapped:o=!1,onMountAutoFocus:a,onUnmountAutoFocus:s,...l}=e,[c,u]=i.useState(null),d=Y9(a),p=Y9(s),f=i.useRef(null),h=B9(n,(e=>u(e))),m=i.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;i.useEffect((()=>{if(o){let e=function(e){if(m.paused||!c)return;const t=e.target;c.contains(t)?f.current=t:f7(f.current,{select:!0})},t=function(e){if(m.paused||!c)return;const t=e.relatedTarget;null!==t&&(c.contains(t)||f7(f.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&f7(c)};document.addEventListener("focusin",e),document.addEventListener("focusout",t);const r=new MutationObserver(n);return c&&r.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),r.disconnect()}}}),[o,c,m.paused]),i.useEffect((()=>{if(c){h7.add(m);const t=document.activeElement;if(!c.contains(t)){const n=new CustomEvent(a7,l7);c.addEventListener(a7,d),c.dispatchEvent(n),n.defaultPrevented||(!function(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(f7(r,{select:t}),document.activeElement!==n)return}((e=u7(c),e.filter((e=>"A"!==e.tagName))),{select:!0}),document.activeElement===t&&f7(c))}return()=>{c.removeEventListener(a7,d),setTimeout((()=>{const e=new CustomEvent(s7,l7);c.addEventListener(s7,p),c.dispatchEvent(e),e.defaultPrevented||f7(t??document.body,{select:!0}),c.removeEventListener(s7,p),h7.remove(m)}),0)}}var e}),[c,d,p,m]);const g=i.useCallback((e=>{if(!r&&!o)return;if(m.paused)return;const t=document.activeElement;if("Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&t){const n=e.currentTarget,[o,i]=function(e){const t=u7(e),n=d7(t,e),r=d7(t.reverse(),e);return[n,r]}(n);o&&i?e.shiftKey||t!==i?e.shiftKey&&t===o&&(e.preventDefault(),r&&f7(i,{select:!0})):(e.preventDefault(),r&&f7(o,{select:!0})):t===n&&e.preventDefault()}}),[r,o,m.paused]);return t.jsx(W9.div,{tabIndex:-1,...l,ref:h,onKeyDown:g})}));function u7(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>e.disabled||e.hidden||"INPUT"===e.tagName&&"hidden"===e.type?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;n.nextNode();)t.push(n.currentNode);return t}function d7(e,t){for(const n of e)if(!p7(n,{upTo:t}))return n}function p7(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==t&&e===t)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function f7(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&t&&e.select()}}c7.displayName="FocusScope";var h7=function(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=m7(e,t),e.unshift(t)},remove(t){e=m7(e,t),e[0]?.resume()}}}();function m7(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}var g7=globalThis?.document?i.useLayoutEffect:()=>{},v7=i[" useId ".trim().toString()]||(()=>{}),y7=0;function b7(e){const[t,n]=i.useState(v7());return g7((()=>{n((e=>e??String(y7++)))}),[e]),e||(t?`radix-${t}`:"")}var x7=i.forwardRef(((e,n)=>{const{children:r,width:o=10,height:i=5,...a}=e;return t.jsx(W9.svg,{...a,ref:n,width:o,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:t.jsx("polygon",{points:"0,0 30,0 15,10"})})}));x7.displayName="Arrow";var w7=x7;var _7="Popper",[S7,E7]=F9(_7),[T7,C7]=S7(_7),A7=e=>{const{__scopePopper:n,children:r}=e,[o,a]=i.useState(null);return t.jsx(T7,{scope:n,anchor:o,onAnchorChange:a,children:r})};A7.displayName=_7;var N7="PopperAnchor",R7=i.forwardRef(((e,n)=>{const{__scopePopper:r,virtualRef:o,...a}=e,s=C7(N7,r),l=i.useRef(null),c=B9(n,l);return i.useEffect((()=>{s.onAnchorChange(o?.current||l.current)})),o?null:t.jsx(W9.div,{...a,ref:c})}));R7.displayName=N7;var O7="PopperContent",[P7,k7]=S7(O7),M7=i.forwardRef(((e,n)=>{const{__scopePopper:r,side:o="bottom",sideOffset:a=0,align:s="center",alignOffset:l=0,arrowPadding:c=0,avoidCollisions:u=!0,collisionBoundary:d=[],collisionPadding:p=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:m="optimized",onPlaced:g,...v}=e,y=C7(O7,r),[b,x]=i.useState(null),w=B9(n,(e=>x(e))),[_,S]=i.useState(null),E=function(e){const[t,n]=i.useState(void 0);return g7((()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const t=new ResizeObserver((t=>{if(!Array.isArray(t))return;if(!t.length)return;const r=t[0];let o,i;if("borderBoxSize"in r){const e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;o=t.inlineSize,i=t.blockSize}else o=e.offsetWidth,i=e.offsetHeight;n({width:o,height:i})}));return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}n(void 0)}),[e]),t}(_),T=E?.width??0,C=E?.height??0,A=o+("center"!==s?"-"+s:""),N="number"==typeof p?p:{top:0,right:0,bottom:0,left:0,...p},R=Array.isArray(d)?d:[d],O=R.length>0,P={padding:N,boundary:R.filter(I7),altBoundary:O},{refs:k,floatingStyles:M,placement:j,isPositioned:L,middlewareData:D}=H0({strategy:"fixed",placement:A,whileElementsMounted:(...e)=>O0(...e,{animationFrame:"always"===m}),elements:{reference:y.anchor},middleware:[G0({mainAxis:a+C,alignmentAxis:l}),u&&K0({mainAxis:!0,crossAxis:!1,limiter:"partial"===f?W0():void 0,...P}),u&&Y0({...P}),X0({...P,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{const{width:o,height:i}=t.reference,a=e.floating.style;a.setProperty("--radix-popper-available-width",`${n}px`),a.setProperty("--radix-popper-available-height",`${r}px`),a.setProperty("--radix-popper-anchor-width",`${o}px`),a.setProperty("--radix-popper-anchor-height",`${i}px`)}}),_&&Q0({element:_,padding:c}),F7({arrowWidth:T,arrowHeight:C}),h&&Z0({strategy:"referenceHidden",...P})]}),[I,F]=U7(j),U=Y9(g);g7((()=>{L&&U?.()}),[L,U]);const $=D.arrow?.x,V=D.arrow?.y,B=0!==D.arrow?.centerOffset,[z,H]=i.useState();return g7((()=>{b&&H(window.getComputedStyle(b).zIndex)}),[b]),t.jsx("div",{ref:k.setFloating,"data-radix-popper-content-wrapper":"",style:{...M,transform:L?M.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:z,"--radix-popper-transform-origin":[D.transformOrigin?.x,D.transformOrigin?.y].join(" "),...D.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:t.jsx(P7,{scope:r,placedSide:I,onArrowChange:S,arrowX:$,arrowY:V,shouldHideArrow:B,children:t.jsx(W9.div,{"data-side":I,"data-align":F,...v,ref:w,style:{...v.style,animation:L?void 0:"none"}})})})}));M7.displayName=O7;var j7="PopperArrow",L7={top:"bottom",right:"left",bottom:"top",left:"right"},D7=i.forwardRef((function(e,n){const{__scopePopper:r,...o}=e,i=k7(j7,r),a=L7[i.placedSide];return t.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:t.jsx(w7,{...o,ref:n,style:{...o.style,display:"block"}})})}));function I7(e){return null!==e}D7.displayName=j7;var F7=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:o}=t,i=0!==o.arrow?.centerOffset,a=i?0:e.arrowWidth,s=i?0:e.arrowHeight,[l,c]=U7(n),u={start:"0%",center:"50%",end:"100%"}[c],d=(o.arrow?.x??0)+a/2,p=(o.arrow?.y??0)+s/2;let f="",h="";return"bottom"===l?(f=i?u:`${d}px`,h=-s+"px"):"top"===l?(f=i?u:`${d}px`,h=`${r.floating.height+s}px`):"right"===l?(f=-s+"px",h=i?u:`${p}px`):"left"===l&&(f=`${r.floating.width+s}px`,h=i?u:`${p}px`),{data:{x:f,y:h}}}});function U7(e){const[t,n="center"]=e.split("-");return[t,n]}var $7=A7,V7=R7,B7=M7,z7=D7,H7=i.forwardRef(((e,n)=>{const{container:o,...a}=e,[s,l]=i.useState(!1);g7((()=>l(!0)),[]);const c=o||s&&globalThis?.document?.body;return c?r.createPortal(t.jsx(W9.div,{...a,ref:n}),c):null}));H7.displayName="Portal";var q7=i[" useInsertionEffect ".trim().toString()]||g7;function G7({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,a,s]=function({defaultProp:e,onChange:t}){const[n,r]=i.useState(e),o=i.useRef(n),a=i.useRef(t);return q7((()=>{a.current=t}),[t]),i.useEffect((()=>{o.current!==n&&(a.current?.(n),o.current=n)}),[n,o]),[n,r,a]}({defaultProp:t,onChange:n}),l=void 0!==e,c=l?e:o;{const t=i.useRef(void 0!==e);i.useEffect((()=>{const e=t.current;if(e!==l){}t.current=l}),[l,r])}const u=i.useCallback((t=>{if(l){const n=function(e){return"function"==typeof e}(t)?t(e):t;n!==e&&s.current?.(n)}else a(t)}),[l,e,a,s]);return[c,u]}var K7=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"});i.forwardRef(((e,n)=>t.jsx(W9.span,{...e,ref:n,style:{...K7,...e.style}}))).displayName="VisuallyHidden";var W7=[" ","Enter","ArrowUp","ArrowDown"],Y7=[" ","Enter"],X7="Select",[Z7,Q7,J7]=function(e){const r=e+"CollectionProvider",[o,i]=F9(r),[a,s]=o(r,{collectionRef:{current:null},itemMap:new Map}),l=e=>{const{scope:r,children:o}=e,i=n.useRef(null),s=n.useRef(new Map).current;return t.jsx(a,{scope:r,itemMap:s,collectionRef:i,children:o})};l.displayName=r;const c=e+"CollectionSlot",u=z9(c),d=n.forwardRef(((e,n)=>{const{scope:r,children:o}=e,i=B9(n,s(c,r).collectionRef);return t.jsx(u,{ref:i,children:o})}));d.displayName=c;const p=e+"CollectionItemSlot",f="data-radix-collection-item",h=z9(p),m=n.forwardRef(((e,r)=>{const{scope:o,children:i,...a}=e,l=n.useRef(null),c=B9(r,l),u=s(p,o);return n.useEffect((()=>(u.itemMap.set(l,{ref:l,...a}),()=>{u.itemMap.delete(l)}))),t.jsx(h,{[f]:"",ref:c,children:i})}));return m.displayName=p,[{Provider:l,Slot:d,ItemSlot:m},function(t){const r=s(e+"CollectionConsumer",t);return n.useCallback((()=>{const e=r.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${f}]`));return Array.from(r.itemMap.values()).sort(((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current)))}),[r.collectionRef,r.itemMap])},i]}(X7),[eee,tee]=F9(X7,[J7,E7]),nee=E7(),[ree,oee]=eee(X7),[iee,aee]=eee(X7),see=e=>{const{__scopeSelect:n,children:r,open:o,defaultOpen:a,onOpenChange:s,value:l,defaultValue:c,onValueChange:u,dir:d,name:p,autoComplete:f,disabled:h,required:m,form:g}=e,v=nee(n),[y,b]=i.useState(null),[x,w]=i.useState(null),[_,S]=i.useState(!1),E=function(e){const t=i.useContext(K9);return e||t||"ltr"}(d),[T,C]=G7({prop:o,defaultProp:a??!1,onChange:s,caller:X7}),[A,N]=G7({prop:l,defaultProp:c,onChange:u,caller:X7}),R=i.useRef(null),O=!y||(g||!!y.closest("form")),[P,k]=i.useState(new Set),M=Array.from(P).map((e=>e.props.value)).join(";");return t.jsx($7,{...v,children:t.jsxs(ree,{required:m,scope:n,trigger:y,onTriggerChange:b,valueNode:x,onValueNodeChange:w,valueNodeHasChildren:_,onValueNodeHasChildrenChange:S,contentId:b7(),value:A,onValueChange:N,open:T,onOpenChange:C,dir:E,triggerPointerDownPosRef:R,disabled:h,children:[t.jsx(Z7.Provider,{scope:n,children:t.jsx(iee,{scope:e.__scopeSelect,onNativeOptionAdd:i.useCallback((e=>{k((t=>new Set(t).add(e)))}),[]),onNativeOptionRemove:i.useCallback((e=>{k((t=>{const n=new Set(t);return n.delete(e),n}))}),[]),children:r})}),O?t.jsxs(Kee,{"aria-hidden":!0,required:m,tabIndex:-1,name:p,autoComplete:f,value:A,onChange:e=>N(e.target.value),disabled:h,form:g,children:[void 0===A?t.jsx("option",{value:""}):null,Array.from(P)]},M):null]})})};see.displayName=X7;var lee="SelectTrigger",cee=i.forwardRef(((e,n)=>{const{__scopeSelect:r,disabled:o=!1,...a}=e,s=nee(r),l=oee(lee,r),c=l.disabled||o,u=B9(n,l.onTriggerChange),d=Q7(r),p=i.useRef("touch"),[f,h,m]=Yee((e=>{const t=d().filter((e=>!e.disabled)),n=t.find((e=>e.value===l.value)),r=Xee(t,e,n);void 0!==r&&l.onValueChange(r.value)})),g=e=>{c||(l.onOpenChange(!0),m()),e&&(l.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return t.jsx(V7,{asChild:!0,...s,children:t.jsx(W9.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":Wee(l.value)?"":void 0,...a,ref:u,onClick:I9(a.onClick,(e=>{e.currentTarget.focus(),"mouse"!==p.current&&g(e)})),onPointerDown:I9(a.onPointerDown,(e=>{p.current=e.pointerType;const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(g(e),e.preventDefault())})),onKeyDown:I9(a.onKeyDown,(e=>{const t=""!==f.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||h(e.key),t&&" "===e.key||W7.includes(e.key)&&(g(),e.preventDefault())}))})})}));cee.displayName=lee;var uee="SelectValue",dee=i.forwardRef(((e,n)=>{const{__scopeSelect:r,className:o,style:i,children:a,placeholder:s="",...l}=e,c=oee(uee,r),{onValueNodeHasChildrenChange:u}=c,d=void 0!==a,p=B9(n,c.onValueNodeChange);return g7((()=>{u(d)}),[u,d]),t.jsx(W9.span,{...l,ref:p,style:{pointerEvents:"none"},children:Wee(c.value)?t.jsx(t.Fragment,{children:s}):a})}));dee.displayName=uee;var pee=i.forwardRef(((e,n)=>{const{__scopeSelect:r,children:o,...i}=e;return t.jsx(W9.span,{"aria-hidden":!0,...i,ref:n,children:o||"▼"})}));pee.displayName="SelectIcon";var fee=e=>t.jsx(H7,{asChild:!0,...e});fee.displayName="SelectPortal";var hee="SelectContent",mee=i.forwardRef(((e,n)=>{const r=oee(hee,e.__scopeSelect),[o,s]=i.useState();if(g7((()=>{s(new DocumentFragment)}),[]),!r.open){const n=o;return n?a.createPortal(t.jsx(vee,{scope:e.__scopeSelect,children:t.jsx(Z7.Slot,{scope:e.__scopeSelect,children:t.jsx("div",{children:e.children})})}),n):null}return t.jsx(xee,{...e,ref:n})}));mee.displayName=hee;var gee=10,[vee,yee]=eee(hee),bee=z9("SelectContent.RemoveScroll"),xee=i.forwardRef(((e,n)=>{const{__scopeSelect:r,position:o="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:s,onPointerDownOutside:l,side:c,sideOffset:u,align:d,alignOffset:p,arrowPadding:f,collisionBoundary:h,collisionPadding:m,sticky:g,hideWhenDetached:v,avoidCollisions:y,...b}=e,x=oee(hee,r),[w,_]=i.useState(null),[S,E]=i.useState(null),T=B9(n,(e=>_(e))),[C,A]=i.useState(null),[N,R]=i.useState(null),O=Q7(r),[P,k]=i.useState(!1),M=i.useRef(!1);i.useEffect((()=>{if(w)return LV(w)}),[w]),i.useEffect((()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??i7()),document.body.insertAdjacentElement("beforeend",e[1]??i7()),o7++,()=>{1===o7&&document.querySelectorAll("[data-radix-focus-guard]").forEach((e=>e.remove())),o7--}}),[]);const j=i.useCallback((e=>{const[t,...n]=O().map((e=>e.ref.current)),[r]=n.slice(-1),o=document.activeElement;for(const i of e){if(i===o)return;if(i?.scrollIntoView({block:"nearest"}),i===t&&S&&(S.scrollTop=0),i===r&&S&&(S.scrollTop=S.scrollHeight),i?.focus(),document.activeElement!==o)return}}),[O,S]),L=i.useCallback((()=>j([C,w])),[j,C,w]);i.useEffect((()=>{P&&L()}),[P,L]);const{onOpenChange:D,triggerPointerDownPosRef:I}=x;i.useEffect((()=>{if(w){let e={x:0,y:0};const t=t=>{e={x:Math.abs(Math.round(t.pageX)-(I.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(I.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():w.contains(n.target)||D(!1),document.removeEventListener("pointermove",t),I.current=null};return null!==I.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",n,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",n,{capture:!0})}}}),[w,D,I]),i.useEffect((()=>{const e=()=>D(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}}),[D]);const[F,U]=Yee((e=>{const t=O().filter((e=>!e.disabled)),n=t.find((e=>e.ref.current===document.activeElement)),r=Xee(t,e,n);r&&setTimeout((()=>r.ref.current.focus()))})),$=i.useCallback(((e,t,n)=>{const r=!M.current&&!n;(void 0!==x.value&&x.value===t||r)&&(A(e),r&&(M.current=!0))}),[x.value]),V=i.useCallback((()=>w?.focus()),[w]),B=i.useCallback(((e,t,n)=>{(void 0!==x.value&&x.value===t||!M.current&&!n)&&R(e)}),[x.value]),z="popper"===o?_ee:wee,H=z===_ee?{side:c,sideOffset:u,align:d,alignOffset:p,arrowPadding:f,collisionBoundary:h,collisionPadding:m,sticky:g,hideWhenDetached:v,avoidCollisions:y}:{};return t.jsx(vee,{scope:r,content:w,viewport:S,onViewportChange:E,itemRefCallback:$,selectedItem:C,onItemLeave:V,itemTextRefCallback:B,focusSelectedItem:L,selectedItemText:N,position:o,isPositioned:P,searchRef:F,children:t.jsx(NV,{as:bee,allowPinchZoom:!0,children:t.jsx(c7,{asChild:!0,trapped:x.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:I9(a,(e=>{x.trigger?.focus({preventScroll:!0}),e.preventDefault()})),children:t.jsx(t7,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:t.jsx(z,{role:"listbox",id:x.contentId,"data-state":x.open?"open":"closed",dir:x.dir,onContextMenu:e=>e.preventDefault(),...b,...H,onPlaced:()=>k(!0),ref:T,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:I9(b.onKeyDown,(e=>{const t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||U(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=O().filter((e=>!e.disabled)).map((e=>e.ref.current));if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){const n=t.indexOf(e.target);t=t.slice(n+1)}setTimeout((()=>j(t))),e.preventDefault()}}))})})})})})}));xee.displayName="SelectContentImpl";var wee=i.forwardRef(((e,n)=>{const{__scopeSelect:r,onPlaced:o,...a}=e,s=oee(hee,r),l=yee(hee,r),[c,u]=i.useState(null),[d,p]=i.useState(null),f=B9(n,(e=>p(e))),h=Q7(r),m=i.useRef(!1),g=i.useRef(!0),{viewport:v,selectedItem:y,selectedItemText:b,focusSelectedItem:x}=l,w=i.useCallback((()=>{if(s.trigger&&s.valueNode&&c&&d&&v&&y&&b){const e=s.trigger.getBoundingClientRect(),t=d.getBoundingClientRect(),n=s.valueNode.getBoundingClientRect(),r=b.getBoundingClientRect();if("rtl"!==s.dir){const o=n.left-(r.left-t.left),i=e.width+(e.left-o),a=Math.max(i,t.width),s=window.innerWidth-gee,l=D9(o,[gee,Math.max(gee,s-a)]);c.style.minWidth=i+"px",c.style.left=l+"px"}else{const o=window.innerWidth-n.right-(t.right-r.right),i=window.innerWidth-e.right-o,a=e.width+i,s=Math.max(a,t.width),l=window.innerWidth-gee,u=D9(o,[gee,Math.max(gee,l-s)]);c.style.minWidth=a+"px",c.style.right=u+"px"}const i=h(),a=window.innerHeight-2*gee,l=v.scrollHeight,u=window.getComputedStyle(d),p=parseInt(u.borderTopWidth,10),f=parseInt(u.paddingTop,10),g=parseInt(u.borderBottomWidth,10),x=p+f+l+parseInt(u.paddingBottom,10)+g,w=Math.min(5*y.offsetHeight,x),_=window.getComputedStyle(v),S=parseInt(_.paddingTop,10),E=parseInt(_.paddingBottom,10),T=e.top+e.height/2-gee,C=a-T,A=y.offsetHeight/2,N=p+f+(y.offsetTop+A),R=x-N;if(N<=T){const e=i.length>0&&y===i[i.length-1].ref.current;c.style.bottom="0px";const t=Math.max(C,A+(e?E:0)+(d.clientHeight-v.offsetTop-v.offsetHeight)+g);c.style.height=N+t+"px"}else{const e=i.length>0&&y===i[0].ref.current;c.style.top="0px";const t=Math.max(T,p+v.offsetTop+(e?S:0)+A);c.style.height=t+R+"px",v.scrollTop=N-T+v.offsetTop}c.style.margin=`${gee}px 0`,c.style.minHeight=w+"px",c.style.maxHeight=a+"px",o?.(),requestAnimationFrame((()=>m.current=!0))}}),[h,s.trigger,s.valueNode,c,d,v,y,b,s.dir,o]);g7((()=>w()),[w]);const[_,S]=i.useState();g7((()=>{d&&S(window.getComputedStyle(d).zIndex)}),[d]);const E=i.useCallback((e=>{e&&!0===g.current&&(w(),x?.(),g.current=!1)}),[w,x]);return t.jsx(See,{scope:r,contentWrapper:c,shouldExpandOnScrollRef:m,onScrollButtonChange:E,children:t.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:_},children:t.jsx(W9.div,{...a,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})}));wee.displayName="SelectItemAlignedPosition";var _ee=i.forwardRef(((e,n)=>{const{__scopeSelect:r,align:o="start",collisionPadding:i=gee,...a}=e,s=nee(r);return t.jsx(B7,{...s,...a,ref:n,align:o,collisionPadding:i,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})}));_ee.displayName="SelectPopperPosition";var[See,Eee]=eee(hee,{}),Tee="SelectViewport",Cee=i.forwardRef(((e,n)=>{const{__scopeSelect:r,nonce:o,...a}=e,s=yee(Tee,r),l=Eee(Tee,r),c=B9(n,s.onViewportChange),u=i.useRef(0);return t.jsxs(t.Fragment,{children:[t.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),t.jsx(Z7.Slot,{scope:r,children:t.jsx(W9.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:I9(a.onScroll,(e=>{const t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=l;if(r?.current&&n){const e=Math.abs(u.current-t.scrollTop);if(e>0){const r=window.innerHeight-2*gee,o=parseFloat(n.style.minHeight),i=parseFloat(n.style.height),a=Math.max(o,i);if(a<r){const o=a+e,i=Math.min(r,o),s=o-i;n.style.height=i+"px","0px"===n.style.bottom&&(t.scrollTop=s>0?s:0,n.style.justifyContent="flex-end")}}}u.current=t.scrollTop}))})})]})}));Cee.displayName=Tee;var Aee="SelectGroup",[Nee,Ree]=eee(Aee);i.forwardRef(((e,n)=>{const{__scopeSelect:r,...o}=e,i=b7();return t.jsx(Nee,{scope:r,id:i,children:t.jsx(W9.div,{role:"group","aria-labelledby":i,...o,ref:n})})})).displayName=Aee;var Oee="SelectLabel",Pee=i.forwardRef(((e,n)=>{const{__scopeSelect:r,...o}=e,i=Ree(Oee,r);return t.jsx(W9.div,{id:i.id,...o,ref:n})}));Pee.displayName=Oee;var kee="SelectItem",[Mee,jee]=eee(kee),Lee=i.forwardRef(((e,n)=>{const{__scopeSelect:r,value:o,disabled:a=!1,textValue:s,...l}=e,c=oee(kee,r),u=yee(kee,r),d=c.value===o,[p,f]=i.useState(s??""),[h,m]=i.useState(!1),g=B9(n,(e=>u.itemRefCallback?.(e,o,a))),v=b7(),y=i.useRef("touch"),b=()=>{a||(c.onValueChange(o),c.onOpenChange(!1))};if(""===o)throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return t.jsx(Mee,{scope:r,value:o,disabled:a,textId:v,isSelected:d,onItemTextChange:i.useCallback((e=>{f((t=>t||(e?.textContent??"").trim()))}),[]),children:t.jsx(Z7.ItemSlot,{scope:r,value:o,disabled:a,textValue:p,children:t.jsx(W9.div,{role:"option","aria-labelledby":v,"data-highlighted":h?"":void 0,"aria-selected":d&&h,"data-state":d?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...l,ref:g,onFocus:I9(l.onFocus,(()=>m(!0))),onBlur:I9(l.onBlur,(()=>m(!1))),onClick:I9(l.onClick,(()=>{"mouse"!==y.current&&b()})),onPointerUp:I9(l.onPointerUp,(()=>{"mouse"===y.current&&b()})),onPointerDown:I9(l.onPointerDown,(e=>{y.current=e.pointerType})),onPointerMove:I9(l.onPointerMove,(e=>{y.current=e.pointerType,a?u.onItemLeave?.():"mouse"===y.current&&e.currentTarget.focus({preventScroll:!0})})),onPointerLeave:I9(l.onPointerLeave,(e=>{e.currentTarget===document.activeElement&&u.onItemLeave?.()})),onKeyDown:I9(l.onKeyDown,(e=>{""!==u.searchRef?.current&&" "===e.key||(Y7.includes(e.key)&&b()," "===e.key&&e.preventDefault())}))})})})}));Lee.displayName=kee;var Dee="SelectItemText",Iee=i.forwardRef(((e,n)=>{const{__scopeSelect:r,className:o,style:s,...l}=e,c=oee(Dee,r),u=yee(Dee,r),d=jee(Dee,r),p=aee(Dee,r),[f,h]=i.useState(null),m=B9(n,(e=>h(e)),d.onItemTextChange,(e=>u.itemTextRefCallback?.(e,d.value,d.disabled))),g=f?.textContent,v=i.useMemo((()=>t.jsx("option",{value:d.value,disabled:d.disabled,children:g},d.value)),[d.disabled,d.value,g]),{onNativeOptionAdd:y,onNativeOptionRemove:b}=p;return g7((()=>(y(v),()=>b(v))),[y,b,v]),t.jsxs(t.Fragment,{children:[t.jsx(W9.span,{id:d.textId,...l,ref:m}),d.isSelected&&c.valueNode&&!c.valueNodeHasChildren?a.createPortal(l.children,c.valueNode):null]})}));Iee.displayName=Dee;var Fee="SelectItemIndicator",Uee=i.forwardRef(((e,n)=>{const{__scopeSelect:r,...o}=e;return jee(Fee,r).isSelected?t.jsx(W9.span,{"aria-hidden":!0,...o,ref:n}):null}));Uee.displayName=Fee;var $ee="SelectScrollUpButton",Vee=i.forwardRef(((e,n)=>{const r=yee($ee,e.__scopeSelect),o=Eee($ee,e.__scopeSelect),[a,s]=i.useState(!1),l=B9(n,o.onScrollButtonChange);return g7((()=>{if(r.viewport&&r.isPositioned){let e=function(){s(t.scrollTop>0)};const t=r.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}}),[r.viewport,r.isPositioned]),a?t.jsx(Hee,{...e,ref:l,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=r;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null}));Vee.displayName=$ee;var Bee="SelectScrollDownButton",zee=i.forwardRef(((e,n)=>{const r=yee(Bee,e.__scopeSelect),o=Eee(Bee,e.__scopeSelect),[a,s]=i.useState(!1),l=B9(n,o.onScrollButtonChange);return g7((()=>{if(r.viewport&&r.isPositioned){let e=function(){const e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;s(n)};const t=r.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}}),[r.viewport,r.isPositioned]),a?t.jsx(Hee,{...e,ref:l,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=r;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null}));zee.displayName=Bee;var Hee=i.forwardRef(((e,n)=>{const{__scopeSelect:r,onAutoScroll:o,...a}=e,s=yee("SelectScrollButton",r),l=i.useRef(null),c=Q7(r),u=i.useCallback((()=>{null!==l.current&&(window.clearInterval(l.current),l.current=null)}),[]);return i.useEffect((()=>()=>u()),[u]),g7((()=>{const e=c().find((e=>e.ref.current===document.activeElement));e?.ref.current?.scrollIntoView({block:"nearest"})}),[c]),t.jsx(W9.div,{"aria-hidden":!0,...a,ref:n,style:{flexShrink:0,...a.style},onPointerDown:I9(a.onPointerDown,(()=>{null===l.current&&(l.current=window.setInterval(o,50))})),onPointerMove:I9(a.onPointerMove,(()=>{s.onItemLeave?.(),null===l.current&&(l.current=window.setInterval(o,50))})),onPointerLeave:I9(a.onPointerLeave,(()=>{u()}))})})),qee=i.forwardRef(((e,n)=>{const{__scopeSelect:r,...o}=e;return t.jsx(W9.div,{"aria-hidden":!0,...o,ref:n})}));qee.displayName="SelectSeparator";var Gee="SelectArrow";i.forwardRef(((e,n)=>{const{__scopeSelect:r,...o}=e,i=nee(r),a=oee(Gee,r),s=yee(Gee,r);return a.open&&"popper"===s.position?t.jsx(z7,{...i,...o,ref:n}):null})).displayName=Gee;var Kee=i.forwardRef((({__scopeSelect:e,value:n,...r},o)=>{const a=i.useRef(null),s=B9(o,a),l=function(e){const t=i.useRef({value:e,previous:e});return i.useMemo((()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous)),[e])}(n);return i.useEffect((()=>{const e=a.current;if(!e)return;const t=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(t,"value").set;if(l!==n&&r){const t=new Event("change",{bubbles:!0});r.call(e,n),e.dispatchEvent(t)}}),[l,n]),t.jsx(W9.select,{...r,style:{...K7,...r.style},ref:s,defaultValue:n})}));function Wee(e){return""===e||void 0===e}function Yee(e){const t=Y9(e),n=i.useRef(""),r=i.useRef(0),o=i.useCallback((e=>{const o=n.current+e;t(o),function e(t){n.current=t,window.clearTimeout(r.current),""!==t&&(r.current=window.setTimeout((()=>e("")),1e3))}(o)}),[t]),a=i.useCallback((()=>{n.current="",window.clearTimeout(r.current)}),[]);return i.useEffect((()=>()=>window.clearTimeout(r.current)),[]),[n,o,a]}function Xee(e,t,n){const r=t.length>1&&Array.from(t).every((e=>e===t[0]))?t[0]:t,o=n?e.indexOf(n):-1;let i=(a=e,s=Math.max(o,0),a.map(((e,t)=>a[(s+t)%a.length])));var a,s;1===r.length&&(i=i.filter((e=>e!==n)));const l=i.find((e=>e.textValue.toLowerCase().startsWith(r.toLowerCase())));return l!==n?l:void 0}Kee.displayName="SelectBubbleInput";var Zee=cee,Qee=pee,Jee=fee,ete=mee,tte=Cee,nte=Pee,rte=Lee,ote=Iee,ite=Uee,ate=Vee,ste=zee,lte=qee;const cte=see,ute=dee,dte=i.forwardRef((({className:e,children:n,...r},o)=>t.jsxs(Zee,{ref:o,className:Zd("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-border/10 px-3 py-2 text-sm shadow-sm ring-offset-background !placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r,children:[n,t.jsx(Qee,{asChild:!0,children:t.jsx(fu,{className:"h-4 w-4 opacity-50"})})]})));dte.displayName=Zee.displayName;const pte=i.forwardRef((({className:e,...n},r)=>t.jsx(ate,{ref:r,className:Zd("flex cursor-default items-center justify-center py-1",e),...n,children:t.jsx(gu,{className:"h-4 w-4"})})));pte.displayName=ate.displayName;const fte=i.forwardRef((({className:e,...n},r)=>t.jsx(ste,{ref:r,className:Zd("flex cursor-default items-center justify-center py-1",e),...n,children:t.jsx(fu,{className:"h-4 w-4"})})));fte.displayName=ste.displayName;const hte=i.forwardRef((({className:e,children:n,position:r="popper",...o},i)=>t.jsx(Jee,{children:t.jsxs(ete,{ref:i,className:Zd("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===r&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...o,children:[t.jsx(pte,{}),t.jsx(tte,{className:Zd("p-1","popper"===r&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:n}),t.jsx(fte,{})]})})));hte.displayName=ete.displayName;i.forwardRef((({className:e,...n},r)=>t.jsx(nte,{ref:r,className:Zd("px-2 py-1.5 text-sm font-semibold text-muted-foreground",e),...n}))).displayName=nte.displayName;const mte=i.forwardRef((({className:e,children:n,...r},o)=>t.jsxs(rte,{ref:o,className:Zd("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[t.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(ite,{children:t.jsx(pu,{className:"h-4 w-4"})})}),t.jsx(ote,{children:n})]})));mte.displayName=rte.displayName;i.forwardRef((({className:e,...n},r)=>t.jsx(lte,{ref:r,className:Zd("-mx-1 my-1 h-px bg-muted",e),...n}))).displayName=lte.displayName;const gte=({type:e})=>t.jsxs("div",{className:"w-full h-full min-h-[300px] flex flex-col items-center justify-center bg-gradient-to-b from-gray-50 to-white p-8",children:[t.jsx("div",{className:"mb-4 text-gray-300",children:t.jsx("svg",{className:"w-16 h-16",fill:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{d:"M20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 14H4V8l8 5 8-5v10zm-8-7L4 6h16l-8 5z"})})}),t.jsxs("p",{className:"text-gray-400 font-medium text-lg text-center mb-2",children:["No ","email"===e?"Email":"SMS"," Preview Available"]}),t.jsxs("p",{className:"text-gray-400 text-sm text-center",children:["Edit your ","email"===e?"Email":"SMS"," template to see a preview here"]})]}),vte=({html:e,height:n,width:r})=>t.jsx("div",{className:"w-full h-full bg-white rounded-lg border-0 overflow-hidden transition-all duration-300 ease-in-out flex flex-col items-center justify-center",children:e?t.jsx("div",{className:"w-full h-full flex items-center justify-center",children:t.jsx("iframe",{title:"Email Preview",srcDoc:e,className:"transition-opacity duration-300",style:{border:"none",backgroundColor:"white",height:n||"100%",width:r||"100%",maxWidth:"100%",maxHeight:"100%"}})}):t.jsx(gte,{type:"email"})}),yte=()=>t.jsxs("div",{className:"p-6 overflow-y-auto",children:[t.jsxs("div",{className:"mb-8 text-center",children:[t.jsx("h2",{className:"text-2xl font-semibold mb-2",children:"Email Editor Help Center"}),t.jsx("p",{className:"text-gray-500",children:"Learn how to use our email editor's powerful features"})]}),t.jsxs("div",{className:"space-y-4 max-w-xl mx-auto",children:[t.jsx("h3",{className:"text-lg font-medium",children:"Using Dynamic Content"}),t.jsxs("div",{className:"relative rounded-lg overflow-hidden bg-gray-50",children:[t.jsx("img",{src:"https://cdn.embedreach.com/assets/engage/merge-tags-demo.gif",alt:"Merge Tags Demo",className:"w-full shadow-lg max-w-md mx-auto"}),t.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/50 to-transparent p-4",children:t.jsx("p",{className:"text-white text-sm",children:"Demonstration: Adding merge tags to personalize your emails"})})]}),t.jsx("div",{className:"px-2",children:t.jsx(xZ,{onClick:()=>{},title:"Dynamic Content",subtitle:"Dynamic content is a way to insert dynamic content into your email such as the customer's name, email, or other details.",icon:t.jsx(ku,{}),selected:!0})})]})]}),bte=({type:e})=>t.jsxs("div",{className:"flex items-start space-x-2 text-sm text-gray-600",children:[t.jsx("svg",{className:"w-5 h-5 text-amber-500 flex-shrink-0 mt-0.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),t.jsxs("span",{children:["Please configure at least one ",e," sender before editing the template"]})]}),xte=({containerRef:e,stripoDialogDimensions:r,showSaving:o})=>(n.useEffect((()=>{const t=t=>{const n=e.current;if(!n)return;const r=n.querySelector("ui-editor");if(!r)return;const o=r.shadowRoot;if(!o)return;const i=o.host.getBoundingClientRect();const a=function(e){for(;e;){const t=getComputedStyle(e);if(("auto"===t.overflowY||"scroll"===t.overflowY)&&e.scrollHeight>e.clientHeight)return e;e=e.parentElement}return null}(o.elementFromPoint(t.clientX-i.left,t.clientY-i.top))||o.firstElementChild;a&&(a.scrollTop+=t.deltaY,a.scrollLeft+=t.deltaX,t.preventDefault())},n=e.current;return n&&n.addEventListener("wheel",t,{passive:!1}),()=>{n&&n.removeEventListener("wheel",t)}}),[e]),t.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center",children:[t.jsx("div",{id:"externalSystemContainer",className:"flex items-center px-4 py-2"}),o&&t.jsx("div",{className:"absolute top-0 left-0 w-full h-full bg-black/50 flex items-center justify-center z-50",children:t.jsx(hZ,{textColor:"text-white",text:["Saving..."]})}),t.jsx("div",{id:"stripoEditorContainer",ref:e,style:{width:r.width-75,height:r.height-75},className:"z-10"})]})),wte="UiEditorScript",_te=e=>new Promise(((t,n)=>{const r=()=>{let n=!0;e.updatedFromDefault&&(n=!1),window.UIEditor&&(window.UIEditor.initEditor(e.container,{forceRecreate:n,metadata:{emailId:e.emailId},html:e.html,css:e.css,locale:"en",onTokenRefreshRequest:e=>{Promise.resolve().then((async()=>{try{const{token:t}=await(async()=>(await Re(`${p}/token`)).data)();e(t)}catch(t){}}))},messageSettingsEnabled:!1,conditionsEnabled:!1,syncModulesEnabled:!1,notifications:{info:console.info,error:console.error,warn:console.warn,success:console.log},mergeTags:e.mergeFields}),t(void 0))};if(document.getElementById(wte))r();else{const e=document.createElement("script");e.id=wte,e.type="module",e.src="https://plugins.stripo.email/resources/uieditor/latest/UIEditor.js",e.onload=()=>{window.UIEditor?r():n(new Error("UIEditor not found after script load"))},e.onerror=e=>{n(e)},document.head.appendChild(e)}})),Ste=({automation:e,setShowStripoEditor:r,saveClicked:o,setSaveClicked:i,stripoDialogDimensions:a,mergeFieldsResponse:s,cancelClicked:l,setCancelClicked:c,actionId:u})=>{const d=n.useRef(!1),p=n.useRef(null),{data:f,isLoading:h}=(e=>{const{automationId:t,actionId:n}=e;return ve({queryKey:["stripo","templates",t,n],queryFn:()=>fZ({automationId:t,actionId:n}),..._e})})({automationId:e.id,actionId:u}),{data:m,isLoading:g}=(()=>{const e=ce();return{...ve({queryKey:dZ.editorData(),queryFn:pZ,..._e}),invalidateEditorData:()=>e.invalidateQueries({queryKey:dZ.editorData()})}})(),[v,y]=n.useState(!1),[b,x]=n.useState(!1),{updateCommunicationGroup:w}=KX(),_=n.useCallback((()=>{i(!1),c(!1),y(!1),x(!1),r(!1)}),[i,c,y,x,r]);return n.useEffect((()=>{if(o&&window.UIEditor&&f?.communicationGroupId&&window.StripoEditorApi?.actionsApi){window.StripoEditorApi.actionsApi.compileEmail({callback:function(e,t){e||(w({groupId:f.communicationGroupId,params:{emailHtmlBody:t}}),x(!0))},minimize:!0,mergeTags:[],forceAmp:!1,resetDataSavedFlag:!1,disableLineHeightsReplace:!0});window.StripoEditorApi.actionsApi.save((function(e){e||y(!0)}))}}),[o,p,i,r,f,w]),n.useEffect((()=>{(async()=>{v&&b&&(window.UIEditor&&window.UIEditor.removeEditor(),_())})()}),[v,b,r,i,_]),n.useEffect((()=>{l&&(window.UIEditor&&window.UIEditor.removeEditor(),_())}),[l,_]),n.useEffect((()=>{m?.businessId&&p.current&&f&&(d.current||(_te({emailId:f.communicationGroupId,html:f.html||"<div></div>",css:f.css||"",container:p.current,businessId:m.businessId,mergeFields:s.mergeFields||[],updatedFromDefault:f.updatedFromDefault}).catch((e=>{})),d.current=!0))}),[m,s,f]),t.jsx("div",h||g||!m||!f?{className:"w-full h-full flex flex-col items-center justify-center",children:t.jsx(hZ,{text:["Loading editor..."]})}:{className:"w-full h-full flex flex-col",children:t.jsx(xte,{containerRef:p,stripoDialogDimensions:a,showSaving:o})})},Ete=({mergeFieldsResponse:e})=>{const r=sZ(),o=aZ(),{updateCommunicationGroup:i}=KX(),{refetchAutomation:a}=ke(o?.id||""),{channelSenders:s}=w9(),{channelAccounts:l}=b9(),{updateChannelSender:c}=_9(),{state:{selectedActionId:u}}=n.useContext(VX),[d,p]=n.useState(!1),[f,h]=n.useState(r?.emailChannelSenderId||null),[m,g]=n.useState(r?.emailSubject||null),[v,y]=n.useState(r?.emailPreviewText||null),[b,x]=n.useState(r?.emailHtmlBody||null),[w,_]=n.useState(!1),[S,E]=n.useState(!1),[T,C]=n.useState(!1),[A,N]=n.useState(""),[R,O]=n.useState(""),[P,k]=n.useState(null),[M,j]=n.useState(!1),L=n.useRef(!0),[D,I]=n.useState(!0),[F,U]=n.useState(!1),[$,V]=n.useState({width:0,height:0}),[B,z]=n.useState(null),H=S9(m,500),q=S9(v,500),G=S9(A,500),K=S9(R,500),W=n.useMemo((()=>s?.results?.filter((e=>e.channelSenderMetadata.userPart))?.flatMap((e=>{const t=l?.results?.find((t=>t.id===e.channelAccountId));return t&&t.channelAccountMetadata.type===x9.REACH_MANAGED?[{channelSenderId:e.id,fullDomain:`${e.channelSenderMetadata.userPart}@${e.channelSenderMetadata.baseDomain}`}]:[]}))||[]),[s?.results,l?.results]),Y=n.useMemo((()=>({width:800,height:400})),[]),X=n.useRef(null);return n.useEffect((()=>{const e=setTimeout((()=>{L.current=!1}),500);return()=>clearTimeout(e)}),[]),n.useEffect((()=>{r?.emailHtmlBody&&x(r.emailHtmlBody)}),[r?.emailHtmlBody,a]),n.useEffect((()=>{if(d){const e=setTimeout((()=>{p(!1)}),2e3);return()=>clearTimeout(e)}}),[d]),n.useEffect((()=>{const e=()=>{V({width:window.innerWidth,height:window.innerHeight})};return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]),n.useEffect((()=>{if(!L.current&&f&&H&&b&&r?.id){p(!0);(async()=>{try{i({groupId:r.id,params:{emailChannelSenderId:f,emailHtmlBody:b,emailSubject:H,...q&&{emailPreviewText:q}}})}catch(e){}finally{p(!1)}})()}}),[f,H,q,b,r?.id,i]),n.useEffect((()=>{if(s?.results&&f){const e=s.results.find((e=>e.id===f));e&&(F&&!D||O(e.channelSenderMetadata.emailReplyTo),D&&N(e.channelSenderMetadata.emailFromName),I(!1))}}),[s?.results,f,F,D]),n.useEffect((()=>{if(s?.results&&!f){const e=s.results.filter((e=>e.channelSenderMetadata.userPart));if(e[0]){const t=e[0];h(t.id),i({groupId:r?.id||"",params:{emailChannelSenderId:t.id}})}}}),[s?.results,f,r?.id,i]),n.useEffect((()=>{if(!L.current&&G&&f){z("fromName");(async()=>{try{const e=s?.results?.find((e=>e.id===f));e&&await c({id:f,toUpdate:{channelSenderMetadata:{...e.channelSenderMetadata,emailFromName:G}}})}catch(e){}finally{z(null)}})()}}),[G,s?.results,f,c]),n.useEffect((()=>{if(K){const e=/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(K),t=/\p{Emoji}/u.test(K);k(t?"Emojis are not allowed in email addresses":e?null:"Please enter a valid email address")}else k(null)}),[K]),n.useEffect((()=>{const e=async e=>{try{const t=s?.results?.find((t=>t.id===e.fromEmail));t&&c({id:e.fromEmail,toUpdate:{channelSenderMetadata:{...t.channelSenderMetadata,emailReplyTo:e.debouncedReplyToEmail}}})}catch(t){}finally{z(null)}};L.current||!f||P||(z("replyToEmail"),e(K?{fromEmail:f,debouncedReplyToEmail:K}:{fromEmail:f,debouncedReplyToEmail:null}))}),[K,s?.results,f,c,P]),n.useEffect((()=>{!1===w&&r?.id&&a()}),[w,r?.id,a]),l&&s&&u?t.jsxs("div",{className:"relative",children:[t.jsx(_B,{open:M,onOpenChange:j,children:t.jsxs(TB,{className:"max-h-[86vh] gap-0 overflow-visible max-w-3xl w-full h-full",children:[t.jsxs(n$,{children:[t.jsx(NB,{children:"Email Preview Help"}),t.jsx(RB,{children:"Learn more about the email preview and how to use it to create your email."})]}),t.jsx(yte,{})]})}),t.jsx(_B,{open:w,onOpenChange:_,children:t.jsxs(TB,{className:"min-w-[100vw] min-h-[100vh]",hideCloseButton:!0,onEscapeKeyDown:e=>{e.preventDefault()},children:[t.jsxs(n$,{children:[t.jsx(NB,{children:"Email Editor"}),t.jsx(RB,{children:"Learn more about the email editor and how to use it to create your email."})]}),t.jsxs("div",{className:"w-full h-full",children:[t.jsxs("div",{className:"flex justify-between items-center p-1 border-b",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("h2",{className:"text-lg font-medium",children:"Email Editor"}),t.jsx(T9,{title:"Click to learn more about email template ",onClick:()=>j(!0)})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(vZ,{variant:"destructive",onClick:()=>{C(!0)},className:"text-sm px-3 py-1 rounded",children:"Cancel"}),t.jsx(vZ,{onClick:()=>E(!0),className:"text-sm px-3 py-1 rounded",children:"Save"})]})]}),t.jsx("div",{className:" w-full",children:o&&t.jsx(Ste,{cancelClicked:T,setCancelClicked:C,showStripoEditor:w,automation:o,setShowStripoEditor:_,saveClicked:S,setSaveClicked:E,stripoDialogDimensions:$,mergeFieldsResponse:e,actionId:u})})]})]})}),t.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx(L9,{className:"text-primary",children:"From Email"}),t.jsxs(cte,{onValueChange:e=>{h(e),I(!0),U(!1)},value:f??void 0,disabled:d,children:[t.jsx(dte,{children:t.jsx(ute,{placeholder:"Select email",className:"text-muted-foreground",children:f?W?.find((e=>e.channelSenderId===f))?.fullDomain:""})}),t.jsx(hte,{children:W?.map((e=>t.jsx(mte,{value:e.channelSenderId,children:e.fullDomain},e.channelSenderId)))})]})]}),t.jsxs("div",{children:[t.jsx(L9,{className:"text-primary",children:t.jsxs("div",{className:"flex items-center gap-2 py-1",children:["From Name",t.jsx(T9,{title:"This will be the friendly name of the sender that the customer will see in the inbox",alertText:"Changes to the sender name will be applied across all emails using this address"})]})}),t.jsx(q3,{placeholder:"Enter from name",value:A??"",onChange:e=>N(e.target.value),className:"text-muted-foreground",disabled:d&&"fromName"!==B||!f||D})]}),t.jsxs("div",{children:[t.jsx(L9,{className:"text-primary",children:t.jsxs("div",{className:"flex items-center gap-2 py-1",children:["Reply To Email",t.jsx(T9,{title:"This will be the email address that customer can reply to on the email",alertText:"Changes to the reply to email will be applied across all emails using this address"})]})}),t.jsx(q3,{placeholder:"Enter reply to email",value:R??"",className:"text-muted-foreground",onChange:e=>{O(e.target.value),F||U(!0)},disabled:d&&"replyToEmail"!==B||!f||D}),P&&t.jsx("p",{className:"text-sm text-red-500 mt-1",children:P})]}),t.jsxs("div",{children:[t.jsx(L9,{className:"text-primary",children:"Subject"}),t.jsx(q3,{placeholder:"Enter email subject",className:"text-muted-foreground",value:m??"",onChange:e=>g(e.target.value),disabled:d||D})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-2 py-1",children:[t.jsx(L9,{className:"text-primary",children:"Preview Text"}),t.jsx(T9,{title:"This text will be used for the preview text of the email in the inbox"})]}),t.jsx(q3,{placeholder:"Enter preview text",className:"text-muted-foreground",value:v??"",onChange:e=>y(e.target.value),disabled:d||D})]})]}),t.jsxs("div",{className:"border rounded-lg p-4 h-full flex flex-col",children:[t.jsxs("div",{className:"flex justify-between items-center mb-4",children:[t.jsx("h3",{className:"font-medium text-primary",children:"Preview"}),t.jsxs("div",{children:[t.jsx(vZ,{onClick:()=>_(!0),className:"text-sm px-3 py-1 rounded",disabled:d||0===(W?.length??0),children:"Edit"}),0===(W?.length??0)&&t.jsx("div",{className:"relative inline-block",children:t.jsx("div",{className:"absolute right-0 top-full mt-2 w-64 p-3 bg-white border rounded-lg shadow-lg z-10",children:t.jsx(bte,{type:"email"})})})]})]}),t.jsx("div",{className:"flex-1 w-full overflow-auto",ref:X,style:{height:"400px"},children:t.jsx(vte,{html:b??"",height:Y.height,width:Y.width})})]})]})]}):t.jsx("div",{className:"flex justify-center items-center flex-1 h-full bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative",children:t.jsx(hZ,{text:["Fetching Email Preview..."]})})};function Tte(e){const t=i.useRef({value:e,previous:e});return i.useMemo((()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous)),[e])}var Cte="Checkbox",[Ate,Nte]=UQ(Cte),[Rte,Ote]=Ate(Cte),Pte=i.forwardRef(((e,n)=>{const{__scopeCheckbox:r,name:o,checked:a,defaultChecked:s,required:l,disabled:c,value:u="on",onCheckedChange:d,form:p,...f}=e,[h,m]=i.useState(null),g=XU(n,(e=>m(e))),v=i.useRef(!1),y=!h||(p||!!h.closest("form")),[b=!1,x]=BQ({prop:a,defaultProp:s,onChange:d}),w=i.useRef(b);return i.useEffect((()=>{const e=h?.form;if(e){const t=()=>x(w.current);return e.addEventListener("reset",t),()=>e.removeEventListener("reset",t)}}),[h,x]),t.jsxs(Rte,{scope:r,state:b,disabled:c,children:[t.jsx(WQ.button,{type:"button",role:"checkbox","aria-checked":Lte(b)?"mixed":b,"aria-required":l,"data-state":Dte(b),"data-disabled":c?"":void 0,disabled:c,value:u,...f,ref:g,onKeyDown:FQ(e.onKeyDown,(e=>{"Enter"===e.key&&e.preventDefault()})),onClick:FQ(e.onClick,(e=>{x((e=>!!Lte(e)||!e)),y&&(v.current=e.isPropagationStopped(),v.current||e.stopPropagation())}))}),y&&t.jsx(jte,{control:h,bubbles:!v.current,name:o,value:u,checked:b,required:l,disabled:c,form:p,style:{transform:"translateX(-100%)"},defaultChecked:!Lte(s)&&s})]})}));Pte.displayName=Cte;var kte="CheckboxIndicator",Mte=i.forwardRef(((e,n)=>{const{__scopeCheckbox:r,forceMount:o,...i}=e,a=Ote(kte,r);return t.jsx(T1,{present:o||Lte(a.state)||!0===a.state,children:t.jsx(WQ.span,{"data-state":Dte(a.state),"data-disabled":a.disabled?"":void 0,...i,ref:n,style:{pointerEvents:"none",...e.style}})})}));Mte.displayName=kte;var jte=e=>{const{control:n,checked:r,bubbles:o=!0,defaultChecked:a,...s}=e,l=i.useRef(null),c=Tte(r),u=t1(n);i.useEffect((()=>{const e=l.current,t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,"checked").set;if(c!==r&&n){const t=new Event("click",{bubbles:o});e.indeterminate=Lte(r),n.call(e,!Lte(r)&&r),e.dispatchEvent(t)}}),[c,r,o]);const d=i.useRef(!Lte(r)&&r);return t.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:a??d.current,...s,tabIndex:-1,ref:l,style:{...e.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Lte(e){return"indeterminate"===e}function Dte(e){return Lte(e)?"indeterminate":e?"checked":"unchecked"}var Ite=Pte,Fte=Mte;const Ute=({selectedChannels:e,setSelectedChannels:n,hasEmailChannelSenders:r,hasSmsChannelSenders:o,automationType:i})=>{const{toast:a}=jl(),s=[...r?[{label:"Email",value:"email",icon:wZ.EmailIcon,checked:e.includes("email")}]:[],...o?[{label:"SMS",value:"sms",icon:wZ.SmsIcon,checked:e.includes("sms")}]:[]];return t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-xl text-primary",children:"Message Types"}),t.jsx("p",{className:"text-gray-600 mb-2 text-sm",children:"Select the channels you want to use in this automation"})]}),t.jsx("div",{className:"w-full grid grid-cols-2 gap-3",children:s.map((r=>t.jsxs(Ite,{checked:r.checked,onCheckedChange:()=>{"email"===r.value?e.includes("email")?e.includes("sms")?n(["sms"]):a({title:"Cant Remove Email",description:`At least one channel is required for an ${i===Fe.ONE_TIME?ff("engage:one_time").toLowerCase():ff("engage:automation").toLowerCase()}`,variant:"destructive"}):n([...e,"email"]):e.includes("sms")?e.includes("email")?n(["email"]):a({title:"Cant Remove SMS",description:`At least one channel is required for an ${i===Fe.ONE_TIME?ff("engage:one_time").toLowerCase():ff("engage:automation").toLowerCase()}`,variant:"destructive"}):n([...e,"sms"])},className:"relative ring-[1px] ring-border rounded-lg px-4 py-3 text-start text-muted-foreground data-[state=checked]:ring-2 data-[state=checked]:ring-primary data-[state=checked]:text-primary",children:[t.jsx(r.icon,{className:"mb-3",size:20}),t.jsx("span",{className:"font-medium tracking-tight",children:r.label}),t.jsx(Fte,{className:"absolute top-2 right-2",children:t.jsx(bu,{className:"fill-primary text-primary-foreground"})})]},r.value)))})]})},$te=async()=>(await Re(s)).data,Vte=["me"],Bte=()=>ve({queryKey:Vte,queryFn:$te,..._e}),zte=()=>{const e=ce(),t=Bte(),n=ye({mutationFn:e=>(async e=>(await Re(s,{method:"PATCH",body:JSON.stringify({website:e})})).data)(e),onSuccess:()=>{e.invalidateQueries({queryKey:Vte})}}),r=ye({mutationFn:e=>(async e=>(await Re(s,{method:"PATCH",body:JSON.stringify({locations:e})})).data)(e),onSuccess:()=>{e.invalidateQueries({queryKey:Vte})}}),o=ye({mutationFn:e=>(async e=>(await Re(s,{method:"PATCH",body:JSON.stringify({branding:e})})).data)(e),onSuccess:()=>{e.invalidateQueries({queryKey:Vte})}});return{data:t.data,isLoading:t.isLoading,error:t.error,refetch:t.refetch,updateWebsite:n.mutate,updateLocations:r.mutate,updateBrandSettings:o.mutate,isUpdatingWebsite:n.isPending,isUpdatingLocations:r.isPending,isUpdatingBrandSettings:o.isPending}},Hte=i.forwardRef((({className:e,...n},r)=>t.jsx("textarea",{className:Zd("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:r,...n})));Hte.displayName="Textarea";const qte=e=>{const{companyName:t,smsBody:n}=e;return t&&n?`${t}:\n${n}`:n??""},Gte=({body:e})=>t.jsx("div",{className:"sms-preview-outer @container",children:t.jsxs("div",{className:"sms-phone-mockup",children:[t.jsx("div",{className:"sms-phone-notch"}),t.jsx("div",{className:"sms-phone-inner",children:t.jsx("div",{className:"sms-message-row",children:t.jsx("div",{className:"sms-message-bubble",children:e})})}),t.jsx("div",{className:"sms-phone-home-indicator"})]})}),Kte=({mergeFieldsResponse:e,smsChannelSenders:r})=>{const o=aZ(),i=sZ(),a=n.useCallback((()=>{const e=o?.actionData?.find((e=>"send_communication"===e.actionType&&e.actionMetadata.communicationGroupId===i?.id));return e?.actionMetadata.communicationGroupId}),[o?.actionData,i?.id]),{channelSenders:s}=w9(),{data:l,isLoading:c}=Bte(),{channelAccounts:u}=b9(),{updateCommunicationGroup:d}=KX(),[p,f]=n.useState(!1),[h,m]=n.useState(""),[g,v]=n.useState(null),[y,b]=n.useState(!1),[x,w]=n.useState(null),[_,S]=n.useState(null),[E,T]=n.useState(!1),C=n.useRef(null),A=S9(_,1e3),N=S9(g,1e3),R=S9(x,1e3);n.useEffect((()=>{if(null!==N&&null!==A&&!p){f(!0);const e=a();e&&d({groupId:e,params:{smsChannelSenderId:N,smsMessageBody:A,textMessageCompanyName:R}}),f(!1)}}),[N,A,R,p,d,a]),n.useEffect((()=>{i&&(v(i.smsChannelSenderId),S(i.smsMessageBody),i.textMessageCompanyName&&w(i.textMessageCompanyName))}),[i]);return n.useEffect((()=>{if(void 0!==s&&!g){const e=s.results.filter((e=>e.channelSenderMetadata.from||e.channelSenderMetadata.messageServiceSid));e?.[0]&&(v(e[0].id),i?.id&&d({groupId:i.id,params:{smsChannelSenderId:e[0].id}}))}}),[s,g,i?.id,d]),n.useEffect((()=>{x||!l?.name||y||(b(!0),w(l.name))}),[x,l?.name,y]),u&&s&&!c?t.jsxs("div",{children:[t.jsx(_B,{open:E,onOpenChange:T,children:t.jsxs(TB,{children:[t.jsxs(n$,{children:[t.jsx(NB,{children:"SMS Editor"}),t.jsx(RB,{children:"Learn more about the SMS editor and how to use it to create your SMS."})]}),t.jsxs("div",{className:"",children:[t.jsx(Hte,{ref:C,className:"min-h-[300px]",placeholder:"Text message content...",value:_??"",onChange:e=>{S(e.target.value)},maxLength:1600-(x?.length||0)}),t.jsxs("div",{className:"mt-2 flex items-center justify-end gap-2",children:[t.jsxs(cte,{value:h,onValueChange:e=>{const t=C.current,n=_||"",r=t?.selectionStart??n.length,o=t?.selectionEnd??n.length,i=n.slice(0,r)+e+n.slice(o);S(i),m(""),setTimeout((()=>{const n=r+e.length;t?.focus(),t?.setSelectionRange(n,n)}),0)},children:[t.jsx(dte,{className:"w-[50px]",children:t.jsx(wZ.MergeField,{className:"w-4 h-4 text-primary"})}),t.jsx(hte,{children:e?.mergeFields?.map((e=>e.entries.map((e=>t.jsx(mte,{value:e.value,children:e.label},e.value))))).flat()})]}),t.jsx(T9,{title:"Dynamic content is a way to insert dynamic content into your messages such as the customer's name, email, or other details."})]}),t.jsxs("div",{className:"flex justify-end mt-2 text-sm transition-colors duration-300 "+(_&&_.length>1400?_.length>=1600?"text-red-500":"text-amber-500":"text-gray-500"),children:[_?_.length:0,"/",1600-(x?.length||0)," ","characters"]})]})]})}),t.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx(L9,{className:"text-primary",children:"From Number"}),t.jsxs(cte,{onValueChange:e=>{v(e)},value:g??void 0,children:[t.jsx(dte,{children:t.jsx(ute,{placeholder:"Select number",children:g?(O=g,r?.find((e=>e.id===O))?.channelSenderMetadata.friendlyName??r?.find((e=>e.id===O))?.channelSenderMetadata.from??O):"Select number"})}),t.jsx(hte,{children:r?.map((e=>t.jsx(mte,{value:e.id,children:e.channelSenderMetadata.friendlyName??e.channelSenderMetadata.from??"Select number"},e.id)))})]})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-2 py-1",children:[t.jsx(L9,{className:"text-primary",children:"Company Name"}),t.jsx(T9,{title:"Adding your company name can help customers identify who they are talking to"})]}),t.jsx(q3,{placeholder:"Enter company name",value:x??"",className:"text-muted-foreground",onChange:e=>{w(e.target.value??null)},disabled:!g})]})]}),t.jsxs("div",{className:"border rounded-lg p-4",children:[t.jsxs("div",{className:"flex justify-between items-center mb-4",children:[t.jsx("h3",{className:"font-medium text-primary",children:"Preview"}),t.jsx("div",{children:t.jsx(vZ,{onClick:()=>T(!0),className:"text-sm px-3 py-1 rounded ",disabled:0===(r?.length??0),children:"Edit"})})]}),t.jsx("div",{children:g?t.jsx(t.Fragment,{children:g&&_?t.jsx(Gte,{body:qte({companyName:x??void 0,smsBody:_})}):t.jsx(gte,{type:"sms"})}):t.jsx(bte,{type:"sms"})})]})]})]}):t.jsx("div",{children:t.jsx(hZ,{text:["Loading..."]})});var O};var Wte=(e=>(e.CUSTOM="custom",e.MANAGED="managed",e))(Wte||{}),Yte=(e=>(e.EditAudience="edit-audience",e.EditTime="edit-time",e))(Yte||{});const Xte=({title:e,type:r})=>{const o=sZ(),i=aZ(),{toast:a}=jl(),s=ce(),[l,c]=n.useState(!1),[u,p]=n.useState(!1),f=!!o&&(o.type===Wte.MANAGED&&("sms"===r?o.updatedFromDefault?.text_message_body:o.updatedFromDefault?.email_text_body||o.updatedFromDefault?.email_html_body));return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h4",{className:"text-xl text-primary",children:e}),t.jsx("div",{className:"flex items-center gap-2",children:f&&t.jsx(t.Fragment,{children:l?t.jsx(hZ,{}):t.jsx(vZ,{variant:"outline",size:"sm",onClick:()=>p(!0),children:"Reset To Default"})})})]}),t.jsx(_B,{open:u,onOpenChange:p,children:t.jsxs(TB,{className:"sm:max-w-[425px]",children:[t.jsxs(CB,{children:[t.jsx(NB,{className:"text-xl font-semibold",children:"Reset to Default"}),t.jsxs(RB,{className:"text-base text-muted-foreground",children:["Are you sure you want to reset this"," ","email"===r?"email":"SMS"," template to its default state? This action cannot be undone."]})]}),t.jsxs(AB,{className:"flex flex-row justify-end gap-3 mt-6",children:[t.jsx(vZ,{variant:"outline",onClick:()=>p(!1),children:"Cancel"}),t.jsx(vZ,{variant:"destructive",onClick:async()=>{o&&i?(c(!0),await(async e=>{const{communicationGroupId:t,automationId:n,type:r}=e;return(await Re(`${d}/${t}/${n}/reset`,{method:"POST",body:JSON.stringify({type:r})})).data})({communicationGroupId:o.id,automationId:i.id,type:r}),s.invalidateQueries({queryKey:qX.all}),a({title:"Communication reset to default!"}),c(!1),p(!1)):a({title:"Error resetting communication",description:"Please contact your administrator",variant:"destructive"})},children:"Reset to Default"})]})]})})]})},Zte=({getExtraMergeFields:e})=>{const[r,o]=n.useState(null),i=n.useRef(null),{toast:a}=jl(),s=sZ(),{channelSenders:l}=w9(),{channelAccounts:c}=b9(),{updateCommunicationGroup:u}=KX(),d=aZ(),{getMergeFields:p,isGetting:f}=(e=>{const t=ve({queryKey:["merge-fields",e],queryFn:()=>HX(e)});return{getMergeFields:t.data,isGetting:t.isPending,getError:t.error,isGetSuccess:t.isSuccess}})(s?.id??void 0),[h,m]=n.useState(void 0);n.useEffect((()=>{const e=s?.id;e&&r&&(r.includes("email")||null===s?.emailChannelSenderId||u({groupId:e,params:{emailChannelSenderId:null}}),r.includes("sms")||null===s?.smsChannelSenderId||u({groupId:e,params:{smsChannelSenderId:null}}))}),[r,u,s]),n.useEffect((()=>{const e=s?.id;e||r||o(["email"])}),[d,s,r]);const g=n.useCallback((e=>{const t=[];e.emailChannelSenderId&&t.push("email"),e.smsChannelSenderId&&t.push("sms"),0===t.length&&t.push("email"),o(t)}),[]);n.useEffect((()=>{s&&!r&&g(s)}),[s,g,r]),n.useEffect((()=>{f||void 0===h&&(e?e().then((e=>{s?.id&&(g(s),u({groupId:s?.id,params:{extraMergeFields:e}},{onSuccess:async()=>{try{const e=await HX(s?.id);m(e)}catch{a({title:"Error saving merge fields!",description:"Please contact your administrator if this issue persists.",variant:"destructive"})}},onError:e=>{a({title:"Error saving merge fields!",description:"Please contact your administrator if this issue persists.",variant:"destructive"})}}))})):m(p))}),[e,u,s,a,f,p,h,g]);const v=n.useMemo((()=>l?.results?.filter((e=>e.channelSenderMetadata.userPart))?.flatMap((e=>{const t=c?.results?.find((t=>t.id===e.channelAccountId));return t&&t.channelAccountMetadata.type===x9.REACH_MANAGED?[{channelSenderId:e.id,fullDomain:`${e.channelSenderMetadata.userPart}@${e.channelSenderMetadata.baseDomain}`}]:[]}))||[]),[l?.results,c?.results]),y=n.useMemo((()=>l?.results.filter((e=>e.channelSenderMetadata.from||e.channelSenderMetadata.messageServiceSid))),[l?.results]);if(!r||f||!h||!v||!y)return t.jsx("div",{className:"flex justify-center items-center flex-1 h-full bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative",children:t.jsx(hZ,{text:["Fetching Content..."]})});const b=v.length>0,x=y.length>0;return t.jsxs("div",{className:"flex flex-col gap-4 flex-shrink-0",children:[t.jsx("div",{className:"bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative",children:t.jsx(Ute,{automationType:d?.triggerMetadata?.triggerType,selectedChannels:r,setSelectedChannels:o,hasEmailChannelSenders:b,hasSmsChannelSenders:x})}),r.includes("email")&&t.jsxs("div",{className:"bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative",ref:i,children:[t.jsx(Xte,{title:"Email Campaign",type:"email"}),t.jsx(Ete,{mergeFieldsResponse:h,emailChannelSendersWithChannelAccounts:v})]}),r.includes("sms")&&t.jsxs("div",{className:"bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative",children:[t.jsx(Xte,{title:"SMS Campaign",type:"sms"}),t.jsx(Kte,{mergeFieldsResponse:h,smsChannelSenders:y})]})]})},Qte=({content:e,className:n})=>t.jsx("div",{className:wB("flex flex-col gap-4 w-full p-6",n),children:t.jsx("div",{className:"bg-white rounded-2xl w-full border border-gray-200 p-6 relative",children:e})}),Jte=e=>e.friendlyName||e.from||e.messageServiceSid||"Unknown Sender";function ene(e,t){throw new Error(`Unreachable case statement: ${JSON.stringify(e)}. Valid values are: ${Object.values(t).join(", ")}`)}function tne(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),!1===n||!r.defaultPrevented)return t?.(r)}}function nne(e,n=[]){let r=[];const o=()=>{const t=r.map((e=>i.createContext(e)));return function(n){const r=n?.[e]||t;return i.useMemo((()=>({[`__scope${e}`]:{...n,[e]:r}})),[n,r])}};return o.scopeName=e,[function(n,o){const a=i.createContext(o),s=r.length;r=[...r,o];const l=n=>{const{scope:r,children:o,...l}=n,c=r?.[e]?.[s]||a,u=i.useMemo((()=>l),Object.values(l));return t.jsx(c.Provider,{value:u,children:o})};return l.displayName=n+"Provider",[l,function(t,r){const l=i.useContext(r?.[e]?.[s]||a);if(l)return l;if(void 0!==o)return o;throw new Error(`\`${t}\` must be used within \`${n}\``)}]},rne(o,...n)]}function rne(...e){const t=e[0];if(1===e.length)return t;const n=()=>{const n=e.map((e=>({useScope:e(),scopeName:e.scopeName})));return function(e){const r=n.reduce(((t,{useScope:n,scopeName:r})=>({...t,...n(e)[`__scope${r}`]})),{});return i.useMemo((()=>({[`__scope${t.scopeName}`]:r})),[r])}};return n.scopeName=t.scopeName,n}function one(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function ine(...e){return t=>{let n=!1;const r=e.map((e=>{const r=one(e,t);return n||"function"!=typeof r||(n=!0),r}));if(n)return()=>{for(let t=0;t<r.length;t++){const n=r[t];"function"==typeof n?n():one(e[t],null)}}}}function ane(...e){return i.useCallback(ine(...e),e)}function sne(e){const n=lne(e),r=i.forwardRef(((e,r)=>{const{children:o,...a}=e,s=i.Children.toArray(o),l=s.find(une);if(l){const e=l.props.children,o=s.map((t=>t===l?i.Children.count(e)>1?i.Children.only(null):i.isValidElement(e)?e.props.children:null:t));return t.jsx(n,{...a,ref:r,children:i.isValidElement(e)?i.cloneElement(e,void 0,o):null})}return t.jsx(n,{...a,ref:r,children:o})}));return r.displayName=`${e}.Slot`,r}function lne(e){const t=i.forwardRef(((e,t)=>{const{children:n,...r}=e;if(i.isValidElement(n)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(n),o=function(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{i(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]={...o,...i}:"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==i.Fragment&&(o.ref=t?ine(t,e):e),i.cloneElement(n,o)}return i.Children.count(n)>1?i.Children.only(null):null}));return t.displayName=`${e}.SlotClone`,t}var cne=Symbol("radix.slottable");function une(e){return i.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===cne}var dne=globalThis?.document?i.useLayoutEffect:()=>{},pne=i[" useId ".trim().toString()]||(()=>{}),fne=0;function hne(e){const[t,n]=i.useState(pne());return dne((()=>{n((e=>e??String(fne++)))}),[e]),e||(t?`radix-${t}`:"")}var mne=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce(((e,n)=>{const r=sne(`Primitive.${n}`),o=i.forwardRef(((e,o)=>{const{asChild:i,...a}=e,s=i?r:n;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t.jsx(s,{...a,ref:o})}));return o.displayName=`Primitive.${n}`,{...e,[n]:o}}),{});var gne=i[" useInsertionEffect ".trim().toString()]||dne;function vne({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,a,s]=function({defaultProp:e,onChange:t}){const[n,r]=i.useState(e),o=i.useRef(n),a=i.useRef(t);return gne((()=>{a.current=t}),[t]),i.useEffect((()=>{o.current!==n&&(a.current?.(n),o.current=n)}),[n,o]),[n,r,a]}({defaultProp:t,onChange:n}),l=void 0!==e,c=l?e:o;{const t=i.useRef(void 0!==e);i.useEffect((()=>{const e=t.current;if(e!==l){}t.current=l}),[l,r])}const u=i.useCallback((t=>{if(l){const n=function(e){return"function"==typeof e}(t)?t(e):t;n!==e&&s.current?.(n)}else a(t)}),[l,e,a,s]);return[c,u]}var yne=i.createContext(void 0);function bne(e){const t=i.useContext(yne);return e||t||"ltr"}var xne="rovingFocusGroup.onEntryFocus",wne={bubbles:!1,cancelable:!0},_ne="RovingFocusGroup",[Sne,Ene,Tne]=function(e){const r=e+"CollectionProvider",[o,i]=nne(r),[a,s]=o(r,{collectionRef:{current:null},itemMap:new Map}),l=e=>{const{scope:r,children:o}=e,i=n.useRef(null),s=n.useRef(new Map).current;return t.jsx(a,{scope:r,itemMap:s,collectionRef:i,children:o})};l.displayName=r;const c=e+"CollectionSlot",u=sne(c),d=n.forwardRef(((e,n)=>{const{scope:r,children:o}=e,i=ane(n,s(c,r).collectionRef);return t.jsx(u,{ref:i,children:o})}));d.displayName=c;const p=e+"CollectionItemSlot",f="data-radix-collection-item",h=sne(p),m=n.forwardRef(((e,r)=>{const{scope:o,children:i,...a}=e,l=n.useRef(null),c=ane(r,l),u=s(p,o);return n.useEffect((()=>(u.itemMap.set(l,{ref:l,...a}),()=>{u.itemMap.delete(l)}))),t.jsx(h,{[f]:"",ref:c,children:i})}));return m.displayName=p,[{Provider:l,Slot:d,ItemSlot:m},function(t){const r=s(e+"CollectionConsumer",t);return n.useCallback((()=>{const e=r.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${f}]`));return Array.from(r.itemMap.values()).sort(((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current)))}),[r.collectionRef,r.itemMap])},i]}(_ne),[Cne,Ane]=nne(_ne,[Tne]),[Nne,Rne]=Cne(_ne),One=i.forwardRef(((e,n)=>t.jsx(Sne.Provider,{scope:e.__scopeRovingFocusGroup,children:t.jsx(Sne.Slot,{scope:e.__scopeRovingFocusGroup,children:t.jsx(Pne,{...e,ref:n})})})));One.displayName=_ne;var Pne=i.forwardRef(((e,n)=>{const{__scopeRovingFocusGroup:r,orientation:o,loop:a=!1,dir:s,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:d,preventScrollOnEntryFocus:p=!1,...f}=e,h=i.useRef(null),m=ane(n,h),g=bne(s),[v,y]=vne({prop:l,defaultProp:c??null,onChange:u,caller:_ne}),[b,x]=i.useState(!1),w=function(e){const t=i.useRef(e);return i.useEffect((()=>{t.current=e})),i.useMemo((()=>(...e)=>t.current?.(...e)),[])}(d),_=Ene(r),S=i.useRef(!1),[E,T]=i.useState(0);return i.useEffect((()=>{const e=h.current;if(e)return e.addEventListener(xne,w),()=>e.removeEventListener(xne,w)}),[w]),t.jsx(Nne,{scope:r,orientation:o,dir:g,loop:a,currentTabStopId:v,onItemFocus:i.useCallback((e=>y(e)),[y]),onItemShiftTab:i.useCallback((()=>x(!0)),[]),onFocusableItemAdd:i.useCallback((()=>T((e=>e+1))),[]),onFocusableItemRemove:i.useCallback((()=>T((e=>e-1))),[]),children:t.jsx(mne.div,{tabIndex:b||0===E?-1:0,"data-orientation":o,...f,ref:m,style:{outline:"none",...e.style},onMouseDown:tne(e.onMouseDown,(()=>{S.current=!0})),onFocus:tne(e.onFocus,(e=>{if(e.target===e.currentTarget&&!S.current&&!b){const t=new CustomEvent(xne,wne);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=_().filter((e=>e.focusable));Lne([e.find((e=>e.active)),e.find((e=>e.id===v)),...e].filter(Boolean).map((e=>e.ref.current)),p)}}S.current=!1})),onBlur:tne(e.onBlur,(()=>x(!1)))})})})),kne="RovingFocusGroupItem",Mne=i.forwardRef(((e,n)=>{const{__scopeRovingFocusGroup:r,focusable:o=!0,active:a=!1,tabStopId:s,children:l,...c}=e,u=hne(),d=s||u,p=Rne(kne,r),f=p.currentTabStopId===d,h=Ene(r),{onFocusableItemAdd:m,onFocusableItemRemove:g,currentTabStopId:v}=p;return i.useEffect((()=>{if(o)return m(),()=>g()}),[o,m,g]),t.jsx(Sne.ItemSlot,{scope:r,id:d,focusable:o,active:a,children:t.jsx(mne.span,{tabIndex:f?0:-1,"data-orientation":p.orientation,...c,ref:n,onMouseDown:tne(e.onMouseDown,(e=>{o?p.onItemFocus(d):e.preventDefault()})),onFocus:tne(e.onFocus,(()=>p.onItemFocus(d))),onKeyDown:tne(e.onKeyDown,(e=>{if("Tab"===e.key&&e.shiftKey)return void p.onItemShiftTab();if(e.target!==e.currentTarget)return;const t=function(e,t,n){const r=function(e,t){return"rtl"!==t?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}(e.key,n);return"vertical"===t&&["ArrowLeft","ArrowRight"].includes(r)||"horizontal"===t&&["ArrowUp","ArrowDown"].includes(r)?void 0:jne[r]}(e,p.orientation,p.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let o=h().filter((e=>e.focusable)).map((e=>e.ref.current));if("last"===t)o.reverse();else if("prev"===t||"next"===t){"prev"===t&&o.reverse();const i=o.indexOf(e.currentTarget);o=p.loop?(r=i+1,(n=o).map(((e,t)=>n[(r+t)%n.length]))):o.slice(i+1)}setTimeout((()=>Lne(o)))}var n,r})),children:"function"==typeof l?l({isCurrentTabStop:f,hasTabStop:null!=v}):l})})}));Mne.displayName=kne;var jne={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Lne(e,t=!1){const n=document.activeElement;for(const r of e){if(r===n)return;if(r.focus({preventScroll:t}),document.activeElement!==n)return}}var Dne=One,Ine=Mne;var Fne=e=>{const{present:t,children:n}=e,r=function(e){const[t,n]=i.useState(),r=i.useRef(null),o=i.useRef(e),a=i.useRef("none"),s=e?"mounted":"unmounted",[l,c]=function(e,t){return i.useReducer(((e,n)=>t[e][n]??e),e)}(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return i.useEffect((()=>{const e=Une(r.current);a.current="mounted"===l?e:"none"}),[l]),dne((()=>{const t=r.current,n=o.current;if(n!==e){const r=a.current,i=Une(t);if(e)c("MOUNT");else if("none"===i||"none"===t?.display)c("UNMOUNT");else{c(n&&r!==i?"ANIMATION_OUT":"UNMOUNT")}o.current=e}}),[e,c]),dne((()=>{if(t){let e;const n=t.ownerDocument.defaultView??window,i=i=>{const a=Une(r.current).includes(i.animationName);if(i.target===t&&a&&(c("ANIMATION_END"),!o.current)){const r=t.style.animationFillMode;t.style.animationFillMode="forwards",e=n.setTimeout((()=>{"forwards"===t.style.animationFillMode&&(t.style.animationFillMode=r)}))}},s=e=>{e.target===t&&(a.current=Une(r.current))};return t.addEventListener("animationstart",s),t.addEventListener("animationcancel",i),t.addEventListener("animationend",i),()=>{n.clearTimeout(e),t.removeEventListener("animationstart",s),t.removeEventListener("animationcancel",i),t.removeEventListener("animationend",i)}}c("ANIMATION_END")}),[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:i.useCallback((e=>{r.current=e?getComputedStyle(e):null,n(e)}),[])}}(t),o="function"==typeof n?n({present:r.isPresent}):i.Children.only(n),a=ane(r.ref,function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(o));return"function"==typeof n||r.isPresent?i.cloneElement(o,{ref:a}):null};function Une(e){return e?.animationName||"none"}Fne.displayName="Presence";var $ne="Tabs",[Vne,Bne]=nne($ne,[Ane]),zne=Ane(),[Hne,qne]=Vne($ne),Gne=i.forwardRef(((e,n)=>{const{__scopeTabs:r,value:o,onValueChange:i,defaultValue:a,orientation:s="horizontal",dir:l,activationMode:c="automatic",...u}=e,d=bne(l),[p,f]=vne({prop:o,onChange:i,defaultProp:a??"",caller:$ne});return t.jsx(Hne,{scope:r,baseId:hne(),value:p,onValueChange:f,orientation:s,dir:d,activationMode:c,children:t.jsx(mne.div,{dir:d,"data-orientation":s,...u,ref:n})})}));Gne.displayName=$ne;var Kne="TabsList",Wne=i.forwardRef(((e,n)=>{const{__scopeTabs:r,loop:o=!0,...i}=e,a=qne(Kne,r),s=zne(r);return t.jsx(Dne,{asChild:!0,...s,orientation:a.orientation,dir:a.dir,loop:o,children:t.jsx(mne.div,{role:"tablist","aria-orientation":a.orientation,...i,ref:n})})}));Wne.displayName=Kne;var Yne="TabsTrigger",Xne=i.forwardRef(((e,n)=>{const{__scopeTabs:r,value:o,disabled:i=!1,...a}=e,s=qne(Yne,r),l=zne(r),c=Jne(s.baseId,o),u=ere(s.baseId,o),d=o===s.value;return t.jsx(Ine,{asChild:!0,...l,focusable:!i,active:d,children:t.jsx(mne.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:c,...a,ref:n,onMouseDown:tne(e.onMouseDown,(e=>{i||0!==e.button||!1!==e.ctrlKey?e.preventDefault():s.onValueChange(o)})),onKeyDown:tne(e.onKeyDown,(e=>{[" ","Enter"].includes(e.key)&&s.onValueChange(o)})),onFocus:tne(e.onFocus,(()=>{d||i||!("manual"!==s.activationMode)||s.onValueChange(o)}))})})}));Xne.displayName=Yne;var Zne="TabsContent",Qne=i.forwardRef(((e,n)=>{const{__scopeTabs:r,value:o,forceMount:a,children:s,...l}=e,c=qne(Zne,r),u=Jne(c.baseId,o),d=ere(c.baseId,o),p=o===c.value,f=i.useRef(p);return i.useEffect((()=>{const e=requestAnimationFrame((()=>f.current=!1));return()=>cancelAnimationFrame(e)}),[]),t.jsx(Fne,{present:a||p,children:({present:r})=>t.jsx(mne.div,{"data-state":p?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":u,hidden:!r,id:d,tabIndex:0,...l,ref:n,style:{...e.style,animationDuration:f.current?"0s":void 0},children:r&&s})})}));function Jne(e,t){return`${e}-trigger-${t}`}function ere(e,t){return`${e}-content-${t}`}Qne.displayName=Zne;var tre=Wne,nre=Xne,rre=Qne;const ore=Gne,ire=i.forwardRef((({className:e,...n},r)=>t.jsx(tre,{ref:r,className:Zd("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...n})));ire.displayName=tre.displayName;const are=i.forwardRef((({className:e,...n},r)=>t.jsx(nre,{ref:r,className:Zd("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...n})));are.displayName=nre.displayName;const sre=i.forwardRef((({className:e,...n},r)=>t.jsx(rre,{ref:r,className:Zd("ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...n})));sre.displayName=rre.displayName;const lre=({open:e,onOpenChange:n})=>t.jsx(_B,{open:e,onOpenChange:n,children:t.jsxs(TB,{className:"max-w-[75vw] min-h-[75vh] overflow-y-auto max-h-[90vh]",children:[t.jsxs(n$,{children:[t.jsx(NB,{children:"Edit Campaign Content"}),t.jsx(RB,{children:"Edit the content of the campaign"})]}),t.jsx(Zte,{})]})}),cre=()=>t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx("span",{className:"w-3 h-3 rounded-full bg-zinc-300 border border-zinc-300 shadow-sm"}),t.jsx("span",{className:"w-3 h-3 rounded-full bg-zinc-300 border border-zinc-300 shadow-sm"}),t.jsx("span",{className:"w-3 h-3 rounded-full bg-zinc-300 border border-zinc-300 shadow-sm"})]}),ure=({children:e,actionButtons:n})=>t.jsxs("div",{className:"flex-1 w-full relative overflow-hidden",children:[t.jsxs("div",{className:"h-full relative w-full rounded-2xl shadow-xl bg-white border border-zinc-200 overflow-hidden min-h-[500px] flex flex-col",style:{containerType:"inline-size"},children:[t.jsxs("div",{className:"flex items-center space-x-3 pt-3 px-4 z-10 w-full justify-between",children:[t.jsx(cre,{}),n&&t.jsx("div",{className:"flex items-center space-x-2",children:n})]}),e]}),t.jsx("div",{className:"text-center text-sm text-muted-foreground mt-4",children:t.jsx("p",{children:"These previews show exactly how your messages will appear to your customers"})})]}),dre=()=>{const e=aZ(),r=sZ(),{channelSenders:o}=w9(),{channelAccounts:i}=b9(),a=n.useMemo((()=>o?.results?.filter((e=>e.channelSenderMetadata.userPart))?.flatMap((e=>{const t=i?.results?.find((t=>t.id===e.channelAccountId));return t&&t.channelAccountMetadata.type===x9.REACH_MANAGED?[{channelSenderId:e.id,fullDomain:`${e.channelSenderMetadata.userPart}@${e.channelSenderMetadata.baseDomain}`,channelSenderMetadata:e.channelSenderMetadata}]:[]}))||[]),[o?.results,i?.results]),s=r?.emailChannelSenderId;if(!(e&&r&&a&&s))return null;const l=a.find((e=>e.channelSenderId===s)),c=l?.fullDomain,u=l?.channelSenderMetadata.emailReplyTo,d=r.emailSubject,p=r.emailPreviewText,f=l?.channelSenderMetadata.emailFromName;return t.jsxs("div",{className:"space-y-1 overflow-hidden",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsx("div",{className:"text-xs text-muted-foreground leading-none",children:"From"}),t.jsxs("div",{className:"text-base font-medium",children:[c,f&&t.jsxs("span",{className:"text-muted-foreground",children:["<",c,">"]})]})]}),u&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("div",{className:"text-xs text-muted-foreground leading-none",children:"Reply-To"}),t.jsx("div",{className:"text-base font-medium",children:u})]}),d&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("div",{className:"text-xs text-muted-foreground leading-none",children:"Subject"}),t.jsx("div",{className:"text-base font-medium",children:d})]}),p&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("div",{className:"text-xs text-muted-foreground leading-none",children:"Preview Text"}),t.jsx("div",{className:"text-sm font-medium line-clamp-2",children:p})]})]})},pre=({emailBody:e})=>{const[r,o]=n.useState({width:0,height:0}),i=n.useRef(null);return n.useEffect((()=>{const e=()=>{i.current&&requestAnimationFrame((()=>{o({width:i.current?i.current.offsetWidth-75:0,height:i.current?i.current.offsetHeight-75:0})}))};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}),[i]),t.jsxs(ure,{children:[t.jsx("div",{className:"pt-4 pb-2 px-6 flex flex-col gap-1",children:t.jsx("div",{className:"rounded-xl bg-zinc-50/80 shadow-sm border border-zinc-100 p-4",children:t.jsx(dre,{})})}),t.jsx("div",{className:"rounded-lg p-6 bg-white flex-1 min-h-0 flex items-center justify-center",ref:i,children:t.jsx(vte,{html:e,height:r.height,width:r.width})})]})},fre=({expandDialogContent:e})=>{const[r,o]=n.useState(!1);return t.jsxs(t.Fragment,{children:[t.jsx(_B,{open:r,onOpenChange:o,children:t.jsxs(TB,{hideCloseButton:!0,className:"w-[80vw] h-[80vh] max-w-none max-h-none bg-transparent border-none",children:[t.jsxs(n$,{children:[t.jsx(NB,{children:"Expanded Preview"}),t.jsx(RB,{children:"Expanded view of communication content"})]}),t.jsxs("div",{className:"h-full flex flex-col overflow-hidden rounded-xl",children:[e,t.jsx("div",{className:"absolute top-7 right-7 z-10",children:t.jsx(vZ,{variant:"ghost",size:"sm",onClick:()=>o(!1),children:t.jsx(wZ.CloseButton,{className:"w-4 h-4 text-primary"})})})]})]})}),t.jsx(vZ,{variant:"outline",size:"sm",className:"rounded-lg px-3 py-2 flex items-center gap-2 shadow-sm bg-white/80 hover:bg-zinc-100 border border-zinc-200",onClick:()=>o(!0),children:t.jsx(wZ.ExpandIcon,{className:"w-4 h-4 text-muted-foreground"})})]})},hre=({type:e,disablePreviewSubtext:n=!1})=>{const r="sms"===e?"SMS":"Email";return t.jsx("div",{className:"flex flex-1 w-full h-full items-center justify-center",children:t.jsxs("div",{className:"flex flex-col items-center justify-center bg-zinc-50/80 border border-zinc-100 rounded-2xl shadow-md px-6 py-12 max-w-[90vw] w-full sm:max-w-md mx-auto text-center",style:{containerType:"inline-size"},children:[t.jsx("sms"===e?wZ.SmsIcon:wZ.EmailIcon,{className:"w-12 h-12 text-zinc-500 mb-4"}),t.jsxs("h2",{className:"text-xl font-semibold text-zinc-800 mb-2",children:["No ",r," Content Yet"]}),!n&&t.jsxs("p",{className:"text-zinc-500 text-base mb-1",children:["Click"," ",t.jsx("span",{className:"font-medium text-zinc-700",children:"Edit content"})," to start crafting your ",r," message."]})]})})},mre=({onClick:e})=>t.jsxs(vZ,{variant:"outline",size:"sm",className:"rounded-lg px-3 py-2 flex items-center gap-2 shadow-sm bg-white/80 hover:bg-zinc-100 border border-zinc-200",onClick:e,children:[t.jsx(wZ.PreviewButton,{className:"w-4 h-4 text-primary"}),t.jsx("span",{className:"font-medium text-sm text-muted-foreground",children:"Preview"})]}),gre=e=>/^[^\s@.]+(?:\.[^\s@.]+)*@[^\s@.]+(?:\.[^\s@.]+)+$/.test(e),vre=e=>{if(!/^[0-9\s()+.-]+$/.test(e))return!1;const t=e.replace(/\D/g,"");return e.startsWith("+")?t.length>=10&&t.length<=15:10===t.length||!(11!==t.length||!t.startsWith("1"))},yre=({automation:e,type:r,setOpenSendPreviewPopup:o})=>{const[i,a]=n.useState(""),[s,l]=n.useState(""),[c,u]=n.useState(null),[d,p]=n.useState(!1),{sendTestCommunication:f,sendError:h,isSendSuccess:m}=WX(),{toast:g}=jl(),v=e.actionData?.find((e=>"send_communication"===e.actionType)),y=v?.actionMetadata.communicationGroupId,{communicationGroup:b,isGetting:x}=GX(y??void 0),w=n.useCallback((()=>{if(!y)return Promise.resolve(null);if(!b)return Promise.reject(new Error("Communication group not loaded"));switch(r){case"email":return Promise.resolve(b.emailChannelSenderId);case"sms":return Promise.resolve(b.smsChannelSenderId);default:return Promise.reject(new Error(`Unsupported type: ${r}`))}}),[b,r,y]);n.useEffect((()=>{(async()=>{try{const e=await w();u(e)}catch(e){u(null)}finally{p(!0)}})()}),[w]),n.useEffect((()=>{m&&(g({title:"Success",description:`Preview ${"email"===r?"email":"SMS"} sent successfully!`}),o(!1))}),[m,r,o,g]),n.useEffect((()=>{h&&(g({title:"Error",description:`Failed to send preview: ${h.message}`,variant:"destructive"}),o(!1))}),[h,g,o]);return!d||x?t.jsx("div",{className:"flex justify-center items-center h-full",children:t.jsx(hZ,{text:["Fetching sender id","Finishing up"]})}):c?t.jsxs("div",{className:"",children:[t.jsxs("h3",{className:"text-xl font-semibold text-gray-900 mb-4",children:["Send Preview ","email"===r?"Email":"SMS"]}),t.jsx(q3,{type:"email"===r?"email":"tel",placeholder:"email"===r?"Enter email address":"Enter phone number",value:i,onChange:e=>{a(e.target.value),l("")},className:"w-full px-3 py-3 border border-gray-300 rounded-lg text-base mb-4 \n focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent\n placeholder-gray-400"}),s&&t.jsx("p",{className:"text-red-500 text-sm mb-4 -mt-2",children:s}),t.jsx(vZ,{onClick:()=>{if(!("email"===r?gre(i):vre(i)))return void l("Please enter a valid "+("email"===r?"email address":"phone number"));if(!c)return void l("No sender found, please update the automation first!");const t=e.actionData?.find((e=>"send_communication"===e.actionType)),n=t?.actionMetadata.communicationGroupId;if(!n)return Promise.resolve(null);f({id:n,params:"email"===r?{emailAddress:i}:{phoneNumber:i}})},disabled:!i,className:"w-full bg-blue-600 text-white py-3 px-6 rounded-lg font-medium\n hover:bg-blue-700 transition-colors duration-200\n disabled:bg-gray-400 disabled:cursor-not-allowed",children:"Send Preview"})]}):t.jsx("div",{className:"flex justify-center items-center h-full",children:t.jsxs("div",{className:"text-center flex flex-col justify-center items-center gap-2",children:[t.jsx(wZ.AlertCircleIcon,{className:"h-12 w-12 text-gray-400 mb-4"}),t.jsx("h3",{className:"text-lg font-semibold text-gray-700 mb-2",children:"No sender found"}),t.jsx("p",{className:"text-gray-500",children:"Please update the automation to include a sender for this type"})]})})},bre=({open:e,onOpenChange:n,automation:r})=>t.jsx(_B,{open:e,onOpenChange:n,children:t.jsxs(TB,{children:[t.jsxs(n$,{children:[t.jsx(NB,{children:"Send Preview Email"}),t.jsx(RB,{children:"Send a preview email to the automation."})]}),t.jsx(yre,{automation:r,type:"email",setOpenSendPreviewPopup:n})]})}),xre=({disablePreview:e=!1,disableEditContent:r=!1,disablePreviewSubtext:o=!1})=>{const i=aZ(),a=sZ(),[s,l]=n.useState({width:0,height:0}),[c,u]=n.useState(!1),[d,p]=n.useState(!1),f=n.useRef(null);if(n.useEffect((()=>{const e=()=>{f.current&&requestAnimationFrame((()=>{l({width:f.current?f.current.offsetWidth-75:0,height:f.current?f.current.offsetHeight-75:0})}))};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}),[f]),!i||!a)return null;const h=a?.emailHtmlBody||"",m=a?.emailChannelSenderId&&h.length>0;return t.jsxs("div",{className:"flex-1 flex flex-col items-center w-full",children:[t.jsx(lre,{open:d,onOpenChange:p}),t.jsx(bre,{open:c,onOpenChange:u,automation:i}),t.jsx(ure,{actionButtons:t.jsx(t.Fragment,{children:t.jsxs("div",{className:"flex items-center space-x-2",children:[!e&&m&&t.jsx(mre,{onClick:()=>u(!0)}),(i.status===Ve.DRAFT||!r)&&t.jsx(vZ,{variant:"outline",size:"sm",className:"rounded-lg px-3 py-2 font-medium text-sm shadow-sm bg-white/80 hover:bg-zinc-100 border border-zinc-200",onClick:()=>p(!0),children:"Edit content"}),m&&t.jsx(fre,{expandDialogContent:t.jsx(pre,{emailBody:h})})]})}),children:m?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"pt-4 pb-2 px-6 flex flex-col gap-1",children:t.jsx("div",{className:"rounded-xl bg-zinc-50/80 shadow-sm border border-zinc-100 p-4",children:t.jsx(dre,{})})}),t.jsx("div",{className:"w-full h-[1.5px] bg-zinc-200 my-2"}),t.jsx("div",{className:"flex-1 w-full overflow-auto h-full min-h-[500px]",ref:f,children:t.jsx(vte,{html:h,height:s.height,width:s.width})})]}):t.jsx(hre,{type:"email",disablePreviewSubtext:o})})]})},wre=()=>{const e=aZ(),r=sZ(),{channelSenders:o}=w9(),{channelAccounts:i}=b9(),a=n.useMemo((()=>o?.results.filter((e=>e.channelSenderMetadata.from||e.channelSenderMetadata.messageServiceSid))),[o?.results]),s=a?.find((e=>e.id===r?.smsChannelSenderId));if(!s)return null;if(!(e&&r&&o&&i&&a&&s))return null;const l=s.channelSenderMetadata.friendlyName||s.channelSenderMetadata.from||s.channelSenderMetadata.messageServiceSid;return t.jsx("div",{className:"space-y-4",children:t.jsxs("div",{className:"space-y-1",children:[t.jsx("div",{className:"text-xs text-muted-foreground leading-none",children:"From"}),t.jsx("div",{className:"text-base font-medium font-mono text-zinc-800",children:l})]})})},_re=({smsBody:e})=>t.jsxs(ure,{children:[t.jsx("div",{className:"pt-4 pb-2 px-6 flex flex-col gap-1",children:t.jsx("div",{className:"rounded-xl bg-zinc-50/80 shadow-sm border border-zinc-100 p-4",children:t.jsx(wre,{})})}),t.jsx("div",{className:"rounded-lg p-6 bg-white flex-1 min-h-0 flex items-center justify-center",children:t.jsx(Gte,{body:e})})]}),Sre=({open:e,onOpenChange:n,automation:r})=>t.jsx(_B,{open:e,onOpenChange:n,children:t.jsxs(TB,{children:[t.jsxs(n$,{children:[t.jsx(NB,{children:"Send Preview SMS"}),t.jsx(RB,{children:"Send a preview SMS to the automation."})]}),t.jsx(yre,{automation:r,type:"sms",setOpenSendPreviewPopup:n})]})}),Ere=({disablePreview:e=!1,disableEditContent:r=!1,disablePreviewSubtext:o=!1})=>{const[i,a]=n.useState(!1),s=aZ(),l=sZ(),[c,u]=n.useState(!1);if(!s)return null;const d=l?.smsMessageBody||"",p=l?.smsChannelSenderId&&d.length>0,f=qte({companyName:l?.textMessageCompanyName??void 0,smsBody:d});return t.jsxs("div",{className:"flex flex-col items-center w-full h-full",children:[t.jsx(lre,{open:c,onOpenChange:u}),t.jsx(Sre,{open:i,onOpenChange:a,automation:s}),t.jsx(ure,{actionButtons:t.jsxs(t.Fragment,{children:[!e&&p&&t.jsx(mre,{onClick:()=>a(!0)}),(s.status===Ve.DRAFT||!r)&&t.jsx(vZ,{variant:"outline",size:"sm",className:"rounded-lg px-3 py-2 font-medium text-sm shadow-sm bg-white/80 hover:bg-zinc-100 border border-zinc-200",onClick:()=>u(!0),children:"Edit content"}),p&&t.jsx(fre,{expandDialogContent:t.jsx(_re,{smsBody:f})})]}),children:p?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"pt-4 pb-2 px-6 flex flex-col gap-1",children:t.jsx("div",{className:"rounded-xl bg-zinc-50/80 shadow-sm border border-zinc-100 p-4",children:t.jsx(wre,{})})}),t.jsx("div",{className:"w-full h-[1.5px] bg-zinc-200 my-2"}),t.jsx("div",{className:"flex-1 w-full overflow-auto h-full flex items-center justify-center",children:t.jsx(Gte,{body:f})})]}):t.jsx(hre,{type:"sms",disablePreviewSubtext:o})})]})},Tre=({disablePreview:e=!1,disableEditContent:r=!1,disablePreviewSubtext:o=!1,hideSms:i=!1})=>{const[a,s]=n.useState("email"),[l,c]=n.useState(!1),u=sZ();return n.useEffect((()=>{u&&!l&&(s(u.emailChannelSenderId?"email":u.smsChannelSenderId?"sms":"email"),c(!0))}),[u,l]),u?t.jsxs(ore,{value:a,onValueChange:e=>{s(e)},defaultValue:"email",className:"flex flex-col gap-4 pt-4 flex-1 bg-muted rounded-md",children:[t.jsx("div",{className:"max-w-[640px] mx-auto w-full",children:t.jsxs(ire,{className:"grid w-full "+(i?"grid-cols-1":"grid-cols-2"),children:[t.jsx(are,{value:"email",className:"group",children:t.jsxs("div",{className:"flex items-center",children:[t.jsx("img",{src:"data:image/svg+xml,%3csvg%20width='17'%20height='16'%20viewBox='0%200%2017%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20opacity='0.32'%20d='M6.66683%201.5C4.79999%201.5%203.86657%201.5%203.15353%201.86331C2.52632%202.18289%202.01639%202.69282%201.69681%203.32003C1.3335%204.03307%201.3335%204.96649%201.3335%206.83333V9.16667C1.3335%2011.0335%201.3335%2011.9669%201.69681%2012.68C2.01639%2013.3072%202.52632%2013.8171%203.15353%2014.1367C3.86657%2014.5%204.79999%2014.5%206.66683%2014.5H10.3335C12.2003%2014.5%2013.1338%2014.5%2013.8468%2014.1367C14.474%2013.8171%2014.9839%2013.3072%2015.3035%2012.68C15.6668%2011.9669%2015.6668%2011.0335%2015.6668%209.16667V6.83333C15.6668%204.96649%2015.6668%204.03307%2015.3035%203.32003C14.9839%202.69282%2014.474%202.18289%2013.8468%201.86331C13.1338%201.5%2012.2003%201.5%2010.3335%201.5H6.66683Z'%20fill='%230B66E4'%20/%3e%3cpath%20d='M12.3125%204.86981C12.5278%204.7825%2012.7821%204.85543%2012.916%205.05633C13.05%205.25736%2013.0191%205.52008%2012.8554%205.68524L12.7773%205.74969L12.1103%206.19403C11.0645%206.89127%2010.4559%207.30338%209.79783%207.50164C9.05705%207.72477%208.27301%207.75304%207.52146%207.58563L7.20212%207.50164C6.7086%207.35295%206.24273%207.08397%205.59958%206.66473L4.88962%206.19403L4.22263%205.74969L4.14451%205.68524C3.98082%205.52008%203.95%205.25736%204.08396%205.05633C4.21789%204.85543%204.47213%204.7825%204.68747%204.86981L4.77732%204.91766L5.44431%205.36199L6.16013%205.83563C6.77757%206.23725%207.12913%206.43582%207.49021%206.54461L7.73923%206.60906C8.32376%206.73923%208.93361%206.71818%209.50974%206.54461C9.99112%206.39957%2010.4556%206.09534%2011.5556%205.36199L12.2226%204.91766L12.3125%204.86981Z'%20fill='%230B66E4'%20/%3e%3c/svg%3e",alt:"Email",className:"w-4 h-4 mr-2 hidden group-data-[state=active]:block"}),t.jsx("img",{src:"data:image/svg+xml,%3csvg%20width='17'%20height='16'%20viewBox='0%200%2017%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20opacity='0.32'%20d='M6.66683%201.5C4.79999%201.5%203.86657%201.5%203.15353%201.86331C2.52632%202.18289%202.01639%202.69282%201.69681%203.32003C1.3335%204.03307%201.3335%204.96649%201.3335%206.83333V9.16667C1.3335%2011.0335%201.3335%2011.9669%201.69681%2012.68C2.01639%2013.3072%202.52632%2013.8171%203.15353%2014.1367C3.86657%2014.5%204.79999%2014.5%206.66683%2014.5H10.3335C12.2003%2014.5%2013.1338%2014.5%2013.8468%2014.1367C14.474%2013.8171%2014.9839%2013.3072%2015.3035%2012.68C15.6668%2011.9669%2015.6668%2011.0335%2015.6668%209.16667V6.83333C15.6668%204.96649%2015.6668%204.03307%2015.3035%203.32003C14.9839%202.69282%2014.474%202.18289%2013.8468%201.86331C13.1338%201.5%2012.2003%201.5%2010.3335%201.5H6.66683Z'%20fill='%237A8599'%20/%3e%3cpath%20d='M12.3125%204.86981C12.5278%204.7825%2012.7821%204.85543%2012.916%205.05633C13.05%205.25736%2013.0191%205.52008%2012.8554%205.68524L12.7773%205.74969L12.1103%206.19403C11.0645%206.89127%2010.4559%207.30338%209.79783%207.50164C9.05705%207.72477%208.27301%207.75304%207.52146%207.58563L7.20212%207.50164C6.7086%207.35295%206.24273%207.08397%205.59958%206.66473L4.88962%206.19403L4.22263%205.74969L4.14451%205.68524C3.98082%205.52008%203.95%205.25736%204.08396%205.05633C4.21789%204.85543%204.47213%204.7825%204.68747%204.86981L4.77732%204.91766L5.44431%205.36199L6.16013%205.83563C6.77757%206.23725%207.12913%206.43582%207.49021%206.54461L7.73923%206.60906C8.32376%206.73923%208.93361%206.71818%209.50974%206.54461C9.99112%206.39957%2010.4556%206.09534%2011.5556%205.36199L12.2226%204.91766L12.3125%204.86981Z'%20fill='%237A8599'%20/%3e%3c/svg%3e",alt:"Email",className:"w-4 h-4 mr-2 block group-data-[state=active]:hidden"}),"Email"]})}),!i&&t.jsx(are,{value:"sms",className:"group",children:t.jsxs("div",{className:"flex items-center",children:[t.jsx("img",{src:"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20opacity='0.32'%20d='M7.09967%200.833328C5.6062%200.833328%204.85946%200.833328%204.28903%201.12398C3.78727%201.37964%203.37932%201.78759%203.12366%202.28935C2.83301%202.85978%202.83301%203.60652%202.83301%205.09999V10.9C2.83301%2012.3935%202.83301%2013.1402%203.12366%2013.7106C3.37932%2014.2124%203.78727%2014.6204%204.28903%2014.876C4.85946%2015.1667%205.6062%2015.1667%207.09967%2015.1667H8.89967C10.3931%2015.1667%2011.1399%2015.1667%2011.7103%2014.876C12.2121%2014.6204%2012.62%2014.2124%2012.8757%2013.7106C13.1663%2013.1402%2013.1663%2012.3935%2013.1663%2010.9V5.1C13.1663%203.60652%2013.1663%202.85978%2012.8757%202.28935C12.62%201.78759%2012.2121%201.37964%2011.7103%201.12398C11.1399%200.833328%2010.3931%200.833328%208.89968%200.833328H7.09967Z'%20fill='%230B66E4'%20/%3e%3cpath%20d='M9.43457%2012.1764C9.66223%2012.2232%209.83398%2012.4252%209.83398%2012.6667C9.83398%2012.9082%209.66223%2013.1101%209.43457%2013.1569L9.33398%2013.1667H6.66699C6.39085%2013.1667%206.16699%2012.9428%206.16699%2012.6667C6.16699%2012.3905%206.39085%2012.1667%206.66699%2012.1667H9.33398L9.43457%2012.1764ZM8.08594%203.17058C8.50572%203.21356%208.83382%203.56859%208.83398%203.99968C8.83398%204.45981%208.46009%204.83349%208%204.83366C7.56881%204.8335%207.21375%204.50553%207.1709%204.08562L7.16699%203.99968L7.1709%203.91472C7.2136%203.49464%207.5687%203.16684%208%203.16667L8.08594%203.17058Z'%20fill='%230B66E4'%20/%3e%3c/svg%3e",alt:"SMS",className:"w-4 h-4 mr-2 hidden group-data-[state=active]:block"}),t.jsx("img",{src:"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20opacity='0.32'%20d='M7.09967%200.833328C5.6062%200.833328%204.85946%200.833328%204.28903%201.12398C3.78727%201.37964%203.37932%201.78759%203.12366%202.28935C2.83301%202.85978%202.83301%203.60652%202.83301%205.09999V10.9C2.83301%2012.3935%202.83301%2013.1402%203.12366%2013.7106C3.37932%2014.2124%203.78727%2014.6204%204.28903%2014.876C4.85946%2015.1667%205.6062%2015.1667%207.09967%2015.1667H8.89967C10.3931%2015.1667%2011.1399%2015.1667%2011.7103%2014.876C12.2121%2014.6204%2012.62%2014.2124%2012.8757%2013.7106C13.1663%2013.1402%2013.1663%2012.3935%2013.1663%2010.9V5.1C13.1663%203.60652%2013.1663%202.85978%2012.8757%202.28935C12.62%201.78759%2012.2121%201.37964%2011.7103%201.12398C11.1399%200.833328%2010.3931%200.833328%208.89968%200.833328H7.09967Z'%20fill='%237A8599'%20/%3e%3cpath%20d='M9.43457%2012.1764C9.66223%2012.2232%209.83398%2012.4252%209.83398%2012.6667C9.83398%2012.9082%209.66223%2013.1101%209.43457%2013.1569L9.33398%2013.1667H6.66699C6.39085%2013.1667%206.16699%2012.9428%206.16699%2012.6667C6.16699%2012.3905%206.39085%2012.1667%206.66699%2012.1667H9.33398L9.43457%2012.1764ZM8.08594%203.17058C8.50572%203.21356%208.83382%203.56859%208.83398%203.99968C8.83398%204.45981%208.46009%204.83349%208%204.83366C7.56881%204.8335%207.21375%204.50553%207.1709%204.08562L7.16699%203.99968L7.1709%203.91472C7.2136%203.49464%207.5687%203.16684%208%203.16667L8.08594%203.17058Z'%20fill='%237A8599'%20/%3e%3c/svg%3e",alt:"SMS",className:"w-4 h-4 mr-2 block group-data-[state=active]:hidden"}),"SMS"]})})]})}),t.jsxs("div",{className:"max-w-[1000px] mx-auto w-full flex-1",children:[t.jsx(sre,{value:"sms",children:t.jsx(Ere,{disablePreview:e,disableEditContent:r,disablePreviewSubtext:o})}),t.jsx(sre,{value:"email",className:"flex flex-col h-full",children:t.jsx(xre,{disablePreview:e,disableEditContent:r,disablePreviewSubtext:o})})]})]}):t.jsx("div",{className:"flex flex-col gap-4 pt-4 flex-1 bg-muted rounded-md",children:t.jsx(hZ,{text:["Loading..."]})})},Cre="reach-styles-module__h2___J-48W",Are="reach-styles-module__minorText___1TEN6",Nre=({children:e,className:n})=>t.jsx("h2",{className:Zd(Cre,n),children:e}),Rre=({children:e,className:n})=>t.jsx("p",{className:Zd(Are,n),children:e}),Ore=({title:e,children:n,headerActions:r})=>t.jsxs("div",{className:"max-w-[1000px] mx-auto w-full flex-1 flex flex-col gap-4 pt-4",children:[t.jsxs("div",{className:"px-4 flex",children:[t.jsx(Nre,{className:"text-primary",children:e}),r&&t.jsx("div",{className:"ml-auto",children:r})]}),n]}),Pre=()=>t.jsx(Ore,{title:"Preview & Schedule",children:t.jsx(Tre,{disablePreview:!0,disableEditContent:!0,disablePreviewSubtext:!0})}),kre=()=>{const e=aZ(),r=sZ(),{channelSenders:o}=w9(),{channelAccounts:i}=b9(),[a,s]=n.useState(null),[l,c]=n.useState(null),[u,d]=n.useState(null),[p,f]=n.useState(null);return n.useEffect((()=>{o&&d(o),i&&f(i)}),[o,i]),n.useEffect((()=>{if(r&&u&&p){const e=r.emailChannelSenderId,t=r.smsChannelSenderId,n=u.results.find((t=>t.id===e)),o=u.results.find((e=>e.id===t));if(n&&r.emailSubject&&r.emailHtmlBody){const e=n.channelSenderMetadata?.userPart,t=p.results.find((e=>e.id===n.channelAccountId));if(t)switch(t.channelAccountMetadata.type){case x9.REACH_MANAGED:s({fromEmail:`${e}@${t.channelAccountMetadata.baseDomain}.embedreach.com`,fromName:n.channelSenderMetadata?.emailFromName,subject:r.emailSubject,previewText:r.emailPreviewText,body:r.emailHtmlBody});break;case x9.TWILLIO:break;default:throw ene(t.channelAccountMetadata.type,x9)}}o&&r.smsMessageBody&&c({fromPhone:Jte(o.channelSenderMetadata),body:r.smsMessageBody,companyName:r.textMessageCompanyName})}}),[r,u,p]),e?t.jsx("div",a||l?{className:"w-full",children:t.jsx("div",{className:"flex flex-col gap-4 w-full",children:t.jsx(Pre,{})})}:{className:"flex justify-center items-center h-full",children:t.jsx("div",{children:"No preview data Please complete previous steps"})}):t.jsx(hZ,{text:["Loading..."]})};function Mre(e){return(Mre="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function jre(e){if(null===e||!0===e||!1===e)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function Lre(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function Dre(e){Lre(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||"object"===Mre(e)&&"[object Date]"===t?new Date(e.getTime()):"number"==typeof e||"[object Number]"===t?new Date(e):new Date(NaN)}function Ire(e,t){Lre(2,arguments);var n=Dre(e),r=jre(t);return isNaN(r)?new Date(NaN):r?(n.setDate(n.getDate()+r),n):n}function Fre(e,t){Lre(2,arguments);var n=Dre(e),r=jre(t);if(isNaN(r))return new Date(NaN);if(!r)return n;var o=n.getDate(),i=new Date(n.getTime());return i.setMonth(n.getMonth()+r+1,0),o>=i.getDate()?i:(n.setFullYear(i.getFullYear(),i.getMonth(),o),n)}var Ure={};function $re(){return Ure}function Vre(e,t){var n,r,o,i,a,s,l,c;Lre(1,arguments);var u=$re(),d=jre(null!==(n=null!==(r=null!==(o=null!==(i=null==t?void 0:t.weekStartsOn)&&void 0!==i?i:null==t||null===(a=t.locale)||void 0===a||null===(s=a.options)||void 0===s?void 0:s.weekStartsOn)&&void 0!==o?o:u.weekStartsOn)&&void 0!==r?r:null===(l=u.locale)||void 0===l||null===(c=l.options)||void 0===c?void 0:c.weekStartsOn)&&void 0!==n?n:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var p=Dre(e),f=p.getDay(),h=(f<d?7:0)+f-d;return p.setDate(p.getDate()-h),p.setHours(0,0,0,0),p}function Bre(e){return Lre(1,arguments),Vre(e,{weekStartsOn:1})}function zre(e){Lre(1,arguments);var t=function(e){Lre(1,arguments);var t=Dre(e),n=t.getFullYear(),r=new Date(0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);var o=Bre(r),i=new Date(0);i.setFullYear(n,0,4),i.setHours(0,0,0,0);var a=Bre(i);return t.getTime()>=o.getTime()?n+1:t.getTime()>=a.getTime()?n:n-1}(e),n=new Date(0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),Bre(n)}function Hre(e){var t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()}function qre(e){Lre(1,arguments);var t=Dre(e);return t.setHours(0,0,0,0),t}function Gre(e,t){Lre(2,arguments);var n=qre(e),r=qre(t),o=n.getTime()-Hre(n),i=r.getTime()-Hre(r);return Math.round((o-i)/864e5)}function Kre(e,t){return Lre(2,arguments),Ire(e,7*jre(t))}function Wre(e,t){return Lre(2,arguments),Fre(e,12*jre(t))}function Yre(e,t){Lre(2,arguments);var n=qre(e),r=qre(t);return n.getTime()===r.getTime()}function Xre(e){return Lre(1,arguments),e instanceof Date||"object"===Mre(e)&&"[object Date]"===Object.prototype.toString.call(e)}function Zre(e,t){Lre(2,arguments);var n=Dre(e),r=Dre(t);return 12*(n.getFullYear()-r.getFullYear())+(n.getMonth()-r.getMonth())}function Qre(e){Lre(1,arguments);var t=Dre(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function Jre(e){Lre(1,arguments);var t=Dre(e);return t.setDate(1),t.setHours(0,0,0,0),t}function eoe(e){Lre(1,arguments);var t=Dre(e),n=new Date(0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}function toe(e,t){var n,r,o,i,a,s,l,c;Lre(1,arguments);var u=$re(),d=jre(null!==(n=null!==(r=null!==(o=null!==(i=null==t?void 0:t.weekStartsOn)&&void 0!==i?i:null==t||null===(a=t.locale)||void 0===a||null===(s=a.options)||void 0===s?void 0:s.weekStartsOn)&&void 0!==o?o:u.weekStartsOn)&&void 0!==r?r:null===(l=u.locale)||void 0===l||null===(c=l.options)||void 0===c?void 0:c.weekStartsOn)&&void 0!==n?n:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var p=Dre(e),f=p.getDay(),h=6+(f<d?-7:0)-(f-d);return p.setDate(p.getDate()+h),p.setHours(23,59,59,999),p}function noe(e){return Lre(1,arguments),toe(e,{weekStartsOn:1})}function roe(e,t){return Lre(2,arguments),function(e,t){Lre(2,arguments);var n=Dre(e).getTime(),r=jre(t);return new Date(n+r)}(e,-jre(t))}function ooe(e){Lre(1,arguments);var t=Dre(e),n=t.getUTCDay(),r=(n<1?7:0)+n-1;return t.setUTCDate(t.getUTCDate()-r),t.setUTCHours(0,0,0,0),t}function ioe(e){Lre(1,arguments);var t=Dre(e),n=t.getUTCFullYear(),r=new Date(0);r.setUTCFullYear(n+1,0,4),r.setUTCHours(0,0,0,0);var o=ooe(r),i=new Date(0);i.setUTCFullYear(n,0,4),i.setUTCHours(0,0,0,0);var a=ooe(i);return t.getTime()>=o.getTime()?n+1:t.getTime()>=a.getTime()?n:n-1}function aoe(e){Lre(1,arguments);var t=Dre(e),n=ooe(t).getTime()-function(e){Lre(1,arguments);var t=ioe(e),n=new Date(0);return n.setUTCFullYear(t,0,4),n.setUTCHours(0,0,0,0),ooe(n)}(t).getTime();return Math.round(n/6048e5)+1}function soe(e,t){var n,r,o,i,a,s,l,c;Lre(1,arguments);var u=$re(),d=jre(null!==(n=null!==(r=null!==(o=null!==(i=null==t?void 0:t.weekStartsOn)&&void 0!==i?i:null==t||null===(a=t.locale)||void 0===a||null===(s=a.options)||void 0===s?void 0:s.weekStartsOn)&&void 0!==o?o:u.weekStartsOn)&&void 0!==r?r:null===(l=u.locale)||void 0===l||null===(c=l.options)||void 0===c?void 0:c.weekStartsOn)&&void 0!==n?n:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var p=Dre(e),f=p.getUTCDay(),h=(f<d?7:0)+f-d;return p.setUTCDate(p.getUTCDate()-h),p.setUTCHours(0,0,0,0),p}function loe(e,t){var n,r,o,i,a,s,l,c;Lre(1,arguments);var u=Dre(e),d=u.getUTCFullYear(),p=$re(),f=jre(null!==(n=null!==(r=null!==(o=null!==(i=null==t?void 0:t.firstWeekContainsDate)&&void 0!==i?i:null==t||null===(a=t.locale)||void 0===a||null===(s=a.options)||void 0===s?void 0:s.firstWeekContainsDate)&&void 0!==o?o:p.firstWeekContainsDate)&&void 0!==r?r:null===(l=p.locale)||void 0===l||null===(c=l.options)||void 0===c?void 0:c.firstWeekContainsDate)&&void 0!==n?n:1);if(!(f>=1&&f<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var h=new Date(0);h.setUTCFullYear(d+1,0,f),h.setUTCHours(0,0,0,0);var m=soe(h,t),g=new Date(0);g.setUTCFullYear(d,0,f),g.setUTCHours(0,0,0,0);var v=soe(g,t);return u.getTime()>=m.getTime()?d+1:u.getTime()>=v.getTime()?d:d-1}function coe(e,t){Lre(1,arguments);var n=Dre(e),r=soe(n,t).getTime()-function(e,t){var n,r,o,i,a,s,l,c;Lre(1,arguments);var u=$re(),d=jre(null!==(n=null!==(r=null!==(o=null!==(i=null==t?void 0:t.firstWeekContainsDate)&&void 0!==i?i:null==t||null===(a=t.locale)||void 0===a||null===(s=a.options)||void 0===s?void 0:s.firstWeekContainsDate)&&void 0!==o?o:u.firstWeekContainsDate)&&void 0!==r?r:null===(l=u.locale)||void 0===l||null===(c=l.options)||void 0===c?void 0:c.firstWeekContainsDate)&&void 0!==n?n:1),p=loe(e,t),f=new Date(0);return f.setUTCFullYear(p,0,d),f.setUTCHours(0,0,0,0),soe(f,t)}(n,t).getTime();return Math.round(r/6048e5)+1}function uoe(e,t){for(var n=e<0?"-":"",r=Math.abs(e).toString();r.length<t;)r="0"+r;return n+r}var doe=function(e,t){var n=e.getUTCFullYear(),r=n>0?n:1-n;return uoe("yy"===t?r%100:r,t.length)},poe=function(e,t){var n=e.getUTCMonth();return"M"===t?String(n+1):uoe(n+1,2)},foe=function(e,t){return uoe(e.getUTCDate(),t.length)},hoe=function(e,t){return uoe(e.getUTCHours()%12||12,t.length)},moe=function(e,t){return uoe(e.getUTCHours(),t.length)},goe=function(e,t){return uoe(e.getUTCMinutes(),t.length)},voe=function(e,t){return uoe(e.getUTCSeconds(),t.length)},yoe=function(e,t){var n=t.length,r=e.getUTCMilliseconds();return uoe(Math.floor(r*Math.pow(10,n-3)),t.length)},boe="midnight",xoe="noon",woe="morning",_oe="afternoon",Soe="evening",Eoe="night",Toe={G:function(e,t,n){var r=e.getUTCFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if("yo"===t){var r=e.getUTCFullYear();return n.ordinalNumber(r>0?r:1-r,{unit:"year"})}return doe(e,t)},Y:function(e,t,n,r){var o=loe(e,r),i=o>0?o:1-o;return"YY"===t?uoe(i%100,2):"Yo"===t?n.ordinalNumber(i,{unit:"year"}):uoe(i,t.length)},R:function(e,t){return uoe(ioe(e),t.length)},u:function(e,t){return uoe(e.getUTCFullYear(),t.length)},Q:function(e,t,n){var r=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return uoe(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){var r=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return uoe(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){var r=e.getUTCMonth();switch(t){case"M":case"MM":return poe(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){var r=e.getUTCMonth();switch(t){case"L":return String(r+1);case"LL":return uoe(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){var o=coe(e,r);return"wo"===t?n.ordinalNumber(o,{unit:"week"}):uoe(o,t.length)},I:function(e,t,n){var r=aoe(e);return"Io"===t?n.ordinalNumber(r,{unit:"week"}):uoe(r,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getUTCDate(),{unit:"date"}):foe(e,t)},D:function(e,t,n){var r=function(e){Lre(1,arguments);var t=Dre(e),n=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var r=t.getTime();return Math.floor((n-r)/864e5)+1}(e);return"Do"===t?n.ordinalNumber(r,{unit:"dayOfYear"}):uoe(r,t.length)},E:function(e,t,n){var r=e.getUTCDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){var o=e.getUTCDay(),i=(o-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return uoe(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(o,{width:"short",context:"formatting"});default:return n.day(o,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){var o=e.getUTCDay(),i=(o-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return uoe(i,t.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(o,{width:"narrow",context:"standalone"});case"cccccc":return n.day(o,{width:"short",context:"standalone"});default:return n.day(o,{width:"wide",context:"standalone"})}},i:function(e,t,n){var r=e.getUTCDay(),o=0===r?7:r;switch(t){case"i":return String(o);case"ii":return uoe(o,t.length);case"io":return n.ordinalNumber(o,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){var r=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(e,t,n){var r,o=e.getUTCHours();switch(r=12===o?xoe:0===o?boe:o/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},B:function(e,t,n){var r,o=e.getUTCHours();switch(r=o>=17?Soe:o>=12?_oe:o>=4?woe:Eoe,t){case"B":case"BB":case"BBB":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){var r=e.getUTCHours()%12;return 0===r&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return hoe(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getUTCHours(),{unit:"hour"}):moe(e,t)},K:function(e,t,n){var r=e.getUTCHours()%12;return"Ko"===t?n.ordinalNumber(r,{unit:"hour"}):uoe(r,t.length)},k:function(e,t,n){var r=e.getUTCHours();return 0===r&&(r=24),"ko"===t?n.ordinalNumber(r,{unit:"hour"}):uoe(r,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):goe(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):voe(e,t)},S:function(e,t){return yoe(e,t)},X:function(e,t,n,r){var o=(r._originalDate||e).getTimezoneOffset();if(0===o)return"Z";switch(t){case"X":return Aoe(o);case"XXXX":case"XX":return Noe(o);default:return Noe(o,":")}},x:function(e,t,n,r){var o=(r._originalDate||e).getTimezoneOffset();switch(t){case"x":return Aoe(o);case"xxxx":case"xx":return Noe(o);default:return Noe(o,":")}},O:function(e,t,n,r){var o=(r._originalDate||e).getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Coe(o,":");default:return"GMT"+Noe(o,":")}},z:function(e,t,n,r){var o=(r._originalDate||e).getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Coe(o,":");default:return"GMT"+Noe(o,":")}},t:function(e,t,n,r){return uoe(Math.floor((r._originalDate||e).getTime()/1e3),t.length)},T:function(e,t,n,r){return uoe((r._originalDate||e).getTime(),t.length)}};function Coe(e,t){var n=e>0?"-":"+",r=Math.abs(e),o=Math.floor(r/60),i=r%60;if(0===i)return n+String(o);var a=t;return n+String(o)+a+uoe(i,2)}function Aoe(e,t){return e%60==0?(e>0?"-":"+")+uoe(Math.abs(e)/60,2):Noe(e,t)}function Noe(e,t){var n=t||"",r=e>0?"-":"+",o=Math.abs(e);return r+uoe(Math.floor(o/60),2)+n+uoe(o%60,2)}var Roe=function(e,t){switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},Ooe=function(e,t){switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},Poe={p:Ooe,P:function(e,t){var n,r=e.match(/(P+)(p+)?/)||[],o=r[1],i=r[2];if(!i)return Roe(e,t);switch(o){case"P":n=t.dateTime({width:"short"});break;case"PP":n=t.dateTime({width:"medium"});break;case"PPP":n=t.dateTime({width:"long"});break;default:n=t.dateTime({width:"full"})}return n.replace("{{date}}",Roe(o,t)).replace("{{time}}",Ooe(i,t))}},koe=["D","DD"],Moe=["YY","YYYY"];function joe(e,t,n){if("YYYY"===e)throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("YY"===e)throw new RangeError("Use `yy` instead of `YY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("D"===e)throw new RangeError("Use `d` instead of `D` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("DD"===e)throw new RangeError("Use `dd` instead of `DD` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var Loe={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function Doe(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var Ioe={date:Doe({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:Doe({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:Doe({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},Foe={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function Uoe(e){return function(t,n){var r;if("formatting"===(null!=n&&n.context?String(n.context):"standalone")&&e.formattingValues){var o=e.defaultFormattingWidth||e.defaultWidth,i=null!=n&&n.width?String(n.width):o;r=e.formattingValues[i]||e.formattingValues[o]}else{var a=e.defaultWidth,s=null!=n&&n.width?String(n.width):e.defaultWidth;r=e.values[s]||e.values[a]}return r[e.argumentCallback?e.argumentCallback(t):t]}}var $oe={ordinalNumber:function(e,t){var n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:Uoe({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:Uoe({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:function(e){return e-1}}),month:Uoe({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:Uoe({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:Uoe({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})};function Voe(e){return function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.width,o=t.match(r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth]);if(!o)return null;var i,a=o[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(s)?function(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return n;return}(s,(function(e){return e.test(a)})):function(e,t){for(var n in e)if(e.hasOwnProperty(n)&&t(e[n]))return n;return}(s,(function(e){return e.test(a)}));return i=e.valueCallback?e.valueCallback(l):l,{value:i=n.valueCallback?n.valueCallback(i):i,rest:t.slice(a.length)}}}var Boe={ordinalNumber:function(e){return function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.match(e.matchPattern);if(!r)return null;var o=r[0],i=t.match(e.parsePattern);if(!i)return null;var a=e.valueCallback?e.valueCallback(i[0]):i[0];return{value:a=n.valueCallback?n.valueCallback(a):a,rest:t.slice(o.length)}}}({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}}),era:Voe({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:Voe({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:function(e){return e+1}}),month:Voe({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:Voe({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:Voe({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},zoe={code:"en-US",formatDistance:function(e,t,n){var r,o=Loe[e];return r="string"==typeof o?o:1===t?o.one:o.other.replace("{{count}}",t.toString()),null!=n&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r},formatLong:Ioe,formatRelative:function(e,t,n,r){return Foe[e]},localize:$oe,match:Boe,options:{weekStartsOn:0,firstWeekContainsDate:1}},Hoe=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,qoe=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Goe=/^'([^]*?)'?$/,Koe=/''/g,Woe=/[a-zA-Z]/;function Yoe(e,t,n){var r,o,i,a,s,l,c,u,d,p,f,h,m,g,v,y,b,x;Lre(2,arguments);var w=String(t),_=$re(),S=null!==(r=null!==(o=null==n?void 0:n.locale)&&void 0!==o?o:_.locale)&&void 0!==r?r:zoe,E=jre(null!==(i=null!==(a=null!==(s=null!==(l=null==n?void 0:n.firstWeekContainsDate)&&void 0!==l?l:null==n||null===(c=n.locale)||void 0===c||null===(u=c.options)||void 0===u?void 0:u.firstWeekContainsDate)&&void 0!==s?s:_.firstWeekContainsDate)&&void 0!==a?a:null===(d=_.locale)||void 0===d||null===(p=d.options)||void 0===p?void 0:p.firstWeekContainsDate)&&void 0!==i?i:1);if(!(E>=1&&E<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var T=jre(null!==(f=null!==(h=null!==(m=null!==(g=null==n?void 0:n.weekStartsOn)&&void 0!==g?g:null==n||null===(v=n.locale)||void 0===v||null===(y=v.options)||void 0===y?void 0:y.weekStartsOn)&&void 0!==m?m:_.weekStartsOn)&&void 0!==h?h:null===(b=_.locale)||void 0===b||null===(x=b.options)||void 0===x?void 0:x.weekStartsOn)&&void 0!==f?f:0);if(!(T>=0&&T<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!S.localize)throw new RangeError("locale must contain localize property");if(!S.formatLong)throw new RangeError("locale must contain formatLong property");var C=Dre(e);if(!function(e){if(Lre(1,arguments),!Xre(e)&&"number"!=typeof e)return!1;var t=Dre(e);return!isNaN(Number(t))}(C))throw new RangeError("Invalid time value");var A=roe(C,Hre(C)),N={firstWeekContainsDate:E,weekStartsOn:T,locale:S,_originalDate:C};return w.match(qoe).map((function(e){var t=e[0];return"p"===t||"P"===t?(0,Poe[t])(e,S.formatLong):e})).join("").match(Hoe).map((function(r){if("''"===r)return"'";var o=r[0];if("'"===o)return function(e){var t=e.match(Goe);if(!t)return e;return t[1].replace(Koe,"'")}(r);var i=Toe[o];if(i)return null!=n&&n.useAdditionalWeekYearTokens||-1===Moe.indexOf(r)||joe(r,t,String(e)),null!=n&&n.useAdditionalDayOfYearTokens||!function(e){return-1!==koe.indexOf(e)}(r)||joe(r,t,String(e)),i(A,r,S.localize,N);if(o.match(Woe))throw new RangeError("Format string contains an unescaped latin alphabet character `"+o+"`");return r})).join("")}function Xoe(e){return Lre(1,arguments),Math.floor(function(e){return Lre(1,arguments),Dre(e).getTime()}(e)/1e3)}function Zoe(e,t){var n,r,o,i,a,s,l,c;Lre(1,arguments);var u=$re(),d=jre(null!==(n=null!==(r=null!==(o=null!==(i=null==t?void 0:t.firstWeekContainsDate)&&void 0!==i?i:null==t||null===(a=t.locale)||void 0===a||null===(s=a.options)||void 0===s?void 0:s.firstWeekContainsDate)&&void 0!==o?o:u.firstWeekContainsDate)&&void 0!==r?r:null===(l=u.locale)||void 0===l||null===(c=l.options)||void 0===c?void 0:c.firstWeekContainsDate)&&void 0!==n?n:1),p=function(e,t){var n,r,o,i,a,s,l,c;Lre(1,arguments);var u=Dre(e),d=u.getFullYear(),p=$re(),f=jre(null!==(n=null!==(r=null!==(o=null!==(i=null==t?void 0:t.firstWeekContainsDate)&&void 0!==i?i:null==t||null===(a=t.locale)||void 0===a||null===(s=a.options)||void 0===s?void 0:s.firstWeekContainsDate)&&void 0!==o?o:p.firstWeekContainsDate)&&void 0!==r?r:null===(l=p.locale)||void 0===l||null===(c=l.options)||void 0===c?void 0:c.firstWeekContainsDate)&&void 0!==n?n:1);if(!(f>=1&&f<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var h=new Date(0);h.setFullYear(d+1,0,f),h.setHours(0,0,0,0);var m=Vre(h,t),g=new Date(0);g.setFullYear(d,0,f),g.setHours(0,0,0,0);var v=Vre(g,t);return u.getTime()>=m.getTime()?d+1:u.getTime()>=v.getTime()?d:d-1}(e,t),f=new Date(0);return f.setFullYear(p,0,d),f.setHours(0,0,0,0),Vre(f,t)}function Qoe(e,t){return Lre(1,arguments),function(e,t,n){Lre(2,arguments);var r=Vre(e,n),o=Vre(t,n),i=r.getTime()-Hre(r),a=o.getTime()-Hre(o);return Math.round((i-a)/6048e5)}(function(e){Lre(1,arguments);var t=Dre(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(0,0,0,0),t}(e),Jre(e),t)+1}function Joe(e,t){Lre(2,arguments);var n=Dre(e),r=Dre(t);return n.getTime()>r.getTime()}function eie(e,t){Lre(2,arguments);var n=Dre(e),r=Dre(t);return n.getTime()<r.getTime()}function tie(e,t){Lre(2,arguments);var n=Dre(e),r=Dre(t);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()}function nie(e,t){return Lre(2,arguments),Ire(e,-jre(t))}function rie(e,t){Lre(2,arguments);var n=Dre(e),r=jre(t),o=n.getFullYear(),i=n.getDate(),a=new Date(0);a.setFullYear(o,r,15),a.setHours(0,0,0,0);var s=function(e){Lre(1,arguments);var t=Dre(e),n=t.getFullYear(),r=t.getMonth(),o=new Date(0);return o.setFullYear(n,r+1,0),o.setHours(0,0,0,0),o.getDate()}(a);return n.setMonth(r,Math.min(i,s)),n}function oie(e,t){Lre(2,arguments);var n=Dre(e),r=jre(t);return isNaN(n.getTime())?new Date(NaN):(n.setFullYear(r),n)}var iie=function(){return iie=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},iie.apply(this,arguments)};function aie(e,t,n){for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}function sie(e){return"multiple"===e.mode}function lie(e){return"range"===e.mode}function cie(e){return"single"===e.mode}"function"==typeof SuppressedError&&SuppressedError;var uie={root:"rdp",multiple_months:"rdp-multiple_months",with_weeknumber:"rdp-with_weeknumber",vhidden:"rdp-vhidden",button_reset:"rdp-button_reset",button:"rdp-button",caption:"rdp-caption",caption_start:"rdp-caption_start",caption_end:"rdp-caption_end",caption_between:"rdp-caption_between",caption_label:"rdp-caption_label",caption_dropdowns:"rdp-caption_dropdowns",dropdown:"rdp-dropdown",dropdown_month:"rdp-dropdown_month",dropdown_year:"rdp-dropdown_year",dropdown_icon:"rdp-dropdown_icon",months:"rdp-months",month:"rdp-month",table:"rdp-table",tbody:"rdp-tbody",tfoot:"rdp-tfoot",head:"rdp-head",head_row:"rdp-head_row",head_cell:"rdp-head_cell",nav:"rdp-nav",nav_button:"rdp-nav_button",nav_button_previous:"rdp-nav_button_previous",nav_button_next:"rdp-nav_button_next",nav_icon:"rdp-nav_icon",row:"rdp-row",weeknumber:"rdp-weeknumber",cell:"rdp-cell",day:"rdp-day",day_today:"rdp-day_today",day_outside:"rdp-day_outside",day_selected:"rdp-day_selected",day_disabled:"rdp-day_disabled",day_hidden:"rdp-day_hidden",day_range_start:"rdp-day_range_start",day_range_end:"rdp-day_range_end",day_range_middle:"rdp-day_range_middle"};var die=Object.freeze({__proto__:null,formatCaption:function(e,t){return Yoe(e,"LLLL y",t)},formatDay:function(e,t){return Yoe(e,"d",t)},formatMonthCaption:function(e,t){return Yoe(e,"LLLL",t)},formatWeekNumber:function(e){return"".concat(e)},formatWeekdayName:function(e,t){return Yoe(e,"cccccc",t)},formatYearCaption:function(e,t){return Yoe(e,"yyyy",t)}}),pie=Object.freeze({__proto__:null,labelDay:function(e,t,n){return Yoe(e,"do MMMM (EEEE)",n)},labelMonthDropdown:function(){return"Month: "},labelNext:function(){return"Go to next month"},labelPrevious:function(){return"Go to previous month"},labelWeekNumber:function(e){return"Week n. ".concat(e)},labelWeekday:function(e,t){return Yoe(e,"cccc",t)},labelYearDropdown:function(){return"Year: "}});var fie=n.createContext(void 0);function hie(e){var n,r,o=e.initialProps,i={captionLayout:"buttons",classNames:uie,formatters:die,labels:pie,locale:zoe,modifiersClassNames:{},modifiers:{},numberOfMonths:1,styles:{},today:new Date,mode:"default"},a=function(e){var t=e.fromYear,n=e.toYear,r=e.fromMonth,o=e.toMonth,i=e.fromDate,a=e.toDate;return r?i=Jre(r):t&&(i=new Date(t,0,1)),o?a=Qre(o):n&&(a=new Date(n,11,31)),{fromDate:i?qre(i):void 0,toDate:a?qre(a):void 0}}(o),s=a.fromDate,l=a.toDate,c=null!==(n=o.captionLayout)&&void 0!==n?n:i.captionLayout;"buttons"===c||s&&l||(c="buttons"),(cie(o)||sie(o)||lie(o))&&(r=o.onSelect);var u=iie(iie(iie({},i),o),{captionLayout:c,classNames:iie(iie({},i.classNames),o.classNames),components:iie({},o.components),formatters:iie(iie({},i.formatters),o.formatters),fromDate:s,labels:iie(iie({},i.labels),o.labels),mode:o.mode||i.mode,modifiers:iie(iie({},i.modifiers),o.modifiers),modifiersClassNames:iie(iie({},i.modifiersClassNames),o.modifiersClassNames),onSelect:r,styles:iie(iie({},i.styles),o.styles),toDate:l});return t.jsx(fie.Provider,{value:u,children:e.children})}function mie(){var e=n.useContext(fie);if(!e)throw new Error("useDayPicker must be used within a DayPickerProvider.");return e}function gie(e){var n=mie();return t.jsx("div",{className:n.classNames.caption_label,style:n.styles.caption_label,"aria-live":"polite",role:"presentation",id:e.id,children:(0,n.formatters.formatCaption)(e.displayMonth,{locale:n.locale})})}function vie(e){return t.jsx("svg",iie({width:"8px",height:"8px",viewBox:"0 0 120 120","data-testid":"iconDropdown"},e,{children:t.jsx("path",{d:"M4.22182541,48.2218254 C8.44222828,44.0014225 15.2388494,43.9273804 19.5496459,47.9996989 L19.7781746,48.2218254 L60,88.443 L100.221825,48.2218254 C104.442228,44.0014225 111.238849,43.9273804 115.549646,47.9996989 L115.778175,48.2218254 C119.998577,52.4422283 120.07262,59.2388494 116.000301,63.5496459 L115.778175,63.7781746 L67.7781746,111.778175 C63.5577717,115.998577 56.7611506,116.07262 52.4503541,112.000301 L52.2218254,111.778175 L4.22182541,63.7781746 C-0.0739418023,59.4824074 -0.0739418023,52.5175926 4.22182541,48.2218254 Z",fill:"currentColor",fillRule:"nonzero"})}))}function yie(e){var n,r,o=e.onChange,i=e.value,a=e.children,s=e.caption,l=e.className,c=e.style,u=mie(),d=null!==(r=null===(n=u.components)||void 0===n?void 0:n.IconDropdown)&&void 0!==r?r:vie;return t.jsxs("div",{className:l,style:c,children:[t.jsx("span",{className:u.classNames.vhidden,children:e["aria-label"]}),t.jsx("select",{name:e.name,"aria-label":e["aria-label"],className:u.classNames.dropdown,style:u.styles.dropdown,value:i,onChange:o,children:a}),t.jsxs("div",{className:u.classNames.caption_label,style:u.styles.caption_label,"aria-hidden":"true",children:[s,t.jsx(d,{className:u.classNames.dropdown_icon,style:u.styles.dropdown_icon})]})]})}function bie(e){var n,r=mie(),o=r.fromDate,i=r.toDate,a=r.styles,s=r.locale,l=r.formatters.formatMonthCaption,c=r.classNames,u=r.components,d=r.labels.labelMonthDropdown;if(!o)return t.jsx(t.Fragment,{});if(!i)return t.jsx(t.Fragment,{});var p=[];if(function(e,t){Lre(2,arguments);var n=Dre(e),r=Dre(t);return n.getFullYear()===r.getFullYear()}(o,i))for(var f=Jre(o),h=o.getMonth();h<=i.getMonth();h++)p.push(rie(f,h));else for(f=Jre(new Date),h=0;h<=11;h++)p.push(rie(f,h));var m=null!==(n=null==u?void 0:u.Dropdown)&&void 0!==n?n:yie;return t.jsx(m,{name:"months","aria-label":d(),className:c.dropdown_month,style:a.dropdown_month,onChange:function(t){var n=Number(t.target.value),r=rie(Jre(e.displayMonth),n);e.onChange(r)},value:e.displayMonth.getMonth(),caption:l(e.displayMonth,{locale:s}),children:p.map((function(e){return t.jsx("option",{value:e.getMonth(),children:l(e,{locale:s})},e.getMonth())}))})}function xie(e){var n,r=e.displayMonth,o=mie(),i=o.fromDate,a=o.toDate,s=o.locale,l=o.styles,c=o.classNames,u=o.components,d=o.formatters.formatYearCaption,p=o.labels.labelYearDropdown,f=[];if(!i)return t.jsx(t.Fragment,{});if(!a)return t.jsx(t.Fragment,{});for(var h=i.getFullYear(),m=a.getFullYear(),g=h;g<=m;g++)f.push(oie(eoe(new Date),g));var v=null!==(n=null==u?void 0:u.Dropdown)&&void 0!==n?n:yie;return t.jsx(v,{name:"years","aria-label":p(),className:c.dropdown_year,style:l.dropdown_year,onChange:function(t){var n=oie(Jre(r),Number(t.target.value));e.onChange(n)},value:r.getFullYear(),caption:d(r,{locale:s}),children:f.map((function(e){return t.jsx("option",{value:e.getFullYear(),children:d(e,{locale:s})},e.getFullYear())}))})}function wie(){var e=mie(),t=function(e){var t=e.month||e.defaultMonth||e.today||new Date,n=e.toDate,r=e.fromDate,o=e.numberOfMonths,i=void 0===o?1:o;return n&&Zre(n,t)<0&&(t=Fre(n,-1*(i-1))),r&&Zre(t,r)<0&&(t=r),Jre(t)}(e),r=function(e,t){var r=n.useState(e);return[void 0===t?r[0]:t,r[1]]}(t,e.month),o=r[1];return[r[0],function(t){var n;if(!e.disableNavigation){var r=Jre(t);o(r),null===(n=e.onMonthChange)||void 0===n||n.call(e,r)}}]}var _ie=n.createContext(void 0);function Sie(e){var n=mie(),r=wie(),o=r[0],i=r[1],a=function(e,t){for(var n=t.reverseMonths,r=t.numberOfMonths,o=Jre(e),i=Zre(Jre(Fre(o,r)),o),a=[],s=0;s<i;s++){var l=Fre(o,s);a.push(l)}return n&&(a=a.reverse()),a}(o,n),s=function(e,t){if(!t.disableNavigation){var n=t.toDate,r=t.numberOfMonths,o=void 0===r?1:r,i=t.pagedNavigation?o:1,a=Jre(e);if(!n)return Fre(a,i);if(!(Zre(n,e)<o))return Fre(a,i)}}(o,n),l=function(e,t){if(!t.disableNavigation){var n=t.fromDate,r=t.numberOfMonths,o=t.pagedNavigation?void 0===r?1:r:1,i=Jre(e);if(!n)return Fre(i,-o);if(!(Zre(i,n)<=0))return Fre(i,-o)}}(o,n),c=function(e){return a.some((function(t){return tie(e,t)}))};return t.jsx(_ie.Provider,{value:{currentMonth:o,displayMonths:a,goToMonth:i,goToDate:function(e,t){c(e)||(t&&eie(e,t)?i(Fre(e,1+-1*n.numberOfMonths)):i(e))},previousMonth:l,nextMonth:s,isDateDisplayed:c},children:e.children})}function Eie(){var e=n.useContext(_ie);if(!e)throw new Error("useNavigation must be used within a NavigationProvider");return e}function Tie(e){var n,r=mie(),o=r.classNames,i=r.styles,a=r.components,s=Eie().goToMonth,l=function(t){s(Fre(t,e.displayIndex?-e.displayIndex:0))},c=null!==(n=null==a?void 0:a.CaptionLabel)&&void 0!==n?n:gie,u=t.jsx(c,{id:e.id,displayMonth:e.displayMonth});return t.jsxs("div",{className:o.caption_dropdowns,style:i.caption_dropdowns,children:[t.jsx("div",{className:o.vhidden,children:u}),t.jsx(bie,{onChange:l,displayMonth:e.displayMonth}),t.jsx(xie,{onChange:l,displayMonth:e.displayMonth})]})}function Cie(e){return t.jsx("svg",iie({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:t.jsx("path",{d:"M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z",fill:"currentColor",fillRule:"nonzero"})}))}function Aie(e){return t.jsx("svg",iie({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:t.jsx("path",{d:"M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z",fill:"currentColor"})}))}var Nie=n.forwardRef((function(e,n){var r=mie(),o=r.classNames,i=r.styles,a=[o.button_reset,o.button];e.className&&a.push(e.className);var s=a.join(" "),l=iie(iie({},i.button_reset),i.button);return e.style&&Object.assign(l,e.style),t.jsx("button",iie({},e,{ref:n,type:"button",className:s,style:l}))}));function Rie(e){var n,r,o=mie(),i=o.dir,a=o.locale,s=o.classNames,l=o.styles,c=o.labels,u=c.labelPrevious,d=c.labelNext,p=o.components;if(!e.nextMonth&&!e.previousMonth)return t.jsx(t.Fragment,{});var f=u(e.previousMonth,{locale:a}),h=[s.nav_button,s.nav_button_previous].join(" "),m=d(e.nextMonth,{locale:a}),g=[s.nav_button,s.nav_button_next].join(" "),v=null!==(n=null==p?void 0:p.IconRight)&&void 0!==n?n:Aie,y=null!==(r=null==p?void 0:p.IconLeft)&&void 0!==r?r:Cie;return t.jsxs("div",{className:s.nav,style:l.nav,children:[!e.hidePrevious&&t.jsx(Nie,{name:"previous-month","aria-label":f,className:h,style:l.nav_button_previous,disabled:!e.previousMonth,onClick:e.onPreviousClick,children:t.jsx("rtl"===i?v:y,{className:s.nav_icon,style:l.nav_icon})}),!e.hideNext&&t.jsx(Nie,{name:"next-month","aria-label":m,className:g,style:l.nav_button_next,disabled:!e.nextMonth,onClick:e.onNextClick,children:t.jsx("rtl"===i?y:v,{className:s.nav_icon,style:l.nav_icon})})]})}function Oie(e){var n=mie().numberOfMonths,r=Eie(),o=r.previousMonth,i=r.nextMonth,a=r.goToMonth,s=r.displayMonths,l=s.findIndex((function(t){return tie(e.displayMonth,t)})),c=0===l,u=l===s.length-1;return t.jsx(Rie,{displayMonth:e.displayMonth,hideNext:n>1&&(c||!u),hidePrevious:n>1&&(u||!c),nextMonth:i,previousMonth:o,onPreviousClick:function(){o&&a(o)},onNextClick:function(){i&&a(i)}})}function Pie(e){var n,r,o=mie(),i=o.classNames,a=o.styles,s=o.captionLayout,l=o.components,c=null!==(n=null==l?void 0:l.CaptionLabel)&&void 0!==n?n:gie;return r=o.disableNavigation?t.jsx(c,{id:e.id,displayMonth:e.displayMonth}):"dropdown"===s?t.jsx(Tie,{displayMonth:e.displayMonth,id:e.id}):t.jsxs(t.Fragment,"dropdown-buttons"===s?{children:[t.jsx(Tie,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id}),t.jsx(Oie,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id})]}:{children:[t.jsx(c,{id:e.id,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),t.jsx(Oie,{displayMonth:e.displayMonth,id:e.id})]}),t.jsx("div",{className:i.caption,style:a.caption,children:r})}function kie(e){var n=mie(),r=n.footer;return r?t.jsx("tfoot",{className:n.classNames.tfoot,style:n.styles.tfoot,children:t.jsx("tr",{children:t.jsx("td",{colSpan:8,children:r})})}):t.jsx(t.Fragment,{})}function Mie(){var e=mie(),n=e.classNames,r=e.styles,o=e.showWeekNumber,i=e.locale,a=e.formatters.formatWeekdayName,s=e.labels.labelWeekday,l=function(e,t,n){for(var r=n?Bre(new Date):Vre(new Date,{locale:e,weekStartsOn:t}),o=[],i=0;i<7;i++){var a=Ire(r,i);o.push(a)}return o}(i,e.weekStartsOn,e.ISOWeek);return t.jsxs("tr",{style:r.head_row,className:n.head_row,children:[o&&t.jsx("td",{style:r.head_cell,className:n.head_cell}),l.map((function(e,o){return t.jsx("th",{scope:"col",className:n.head_cell,style:r.head_cell,"aria-label":s(e,{locale:i}),children:a(e,{locale:i})},o)}))]})}function jie(){var e,n=mie(),r=n.components,o=null!==(e=null==r?void 0:r.HeadRow)&&void 0!==e?e:Mie;return t.jsx("thead",{style:n.styles.head,className:n.classNames.head,children:t.jsx(o,{})})}function Lie(e){var n=mie();return t.jsx(t.Fragment,{children:(0,n.formatters.formatDay)(e.date,{locale:n.locale})})}var Die=n.createContext(void 0);function Iie(e){if(!sie(e.initialProps)){return t.jsx(Die.Provider,{value:{selected:void 0,modifiers:{disabled:[]}},children:e.children})}return t.jsx(Fie,{initialProps:e.initialProps,children:e.children})}function Fie(e){var n=e.initialProps,r=e.children,o=n.selected,i=n.min,a=n.max,s={disabled:[]};return o&&s.disabled.push((function(e){var t=a&&o.length>a-1,n=o.some((function(t){return Yre(t,e)}));return Boolean(t&&!n)})),t.jsx(Die.Provider,{value:{selected:o,onDayClick:function(e,t,r){var s,l;if((null===(s=n.onDayClick)||void 0===s||s.call(n,e,t,r),!Boolean(t.selected&&i&&(null==o?void 0:o.length)===i))&&!Boolean(!t.selected&&a&&(null==o?void 0:o.length)===a)){var c=o?aie([],o):[];if(t.selected){var u=c.findIndex((function(t){return Yre(e,t)}));c.splice(u,1)}else c.push(e);null===(l=n.onSelect)||void 0===l||l.call(n,c,e,t,r)}},modifiers:s},children:r})}function Uie(){var e=n.useContext(Die);if(!e)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return e}var $ie,Vie,Bie=n.createContext(void 0);function zie(e){if(!lie(e.initialProps)){return t.jsx(Bie.Provider,{value:{selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}},children:e.children})}return t.jsx(Hie,{initialProps:e.initialProps,children:e.children})}function Hie(e){var n=e.initialProps,r=e.children,o=n.selected,i=o||{},a=i.from,s=i.to,l=n.min,c=n.max,u={range_start:[],range_end:[],range_middle:[],disabled:[]};if(a?(u.range_start=[a],s?(u.range_end=[s],Yre(a,s)||(u.range_middle=[{after:a,before:s}])):u.range_end=[a]):s&&(u.range_start=[s],u.range_end=[s]),l&&(a&&!s&&u.disabled.push({after:nie(a,l-1),before:Ire(a,l-1)}),a&&s&&u.disabled.push({after:a,before:Ire(a,l-1)}),!a&&s&&u.disabled.push({after:nie(s,l-1),before:Ire(s,l-1)})),c){if(a&&!s&&(u.disabled.push({before:Ire(a,1-c)}),u.disabled.push({after:Ire(a,c-1)})),a&&s){var d=c-(Gre(s,a)+1);u.disabled.push({before:nie(a,d)}),u.disabled.push({after:Ire(s,d)})}!a&&s&&(u.disabled.push({before:Ire(s,1-c)}),u.disabled.push({after:Ire(s,c-1)}))}return t.jsx(Bie.Provider,{value:{selected:o,onDayClick:function(e,t,r){var i,a;null===(i=n.onDayClick)||void 0===i||i.call(n,e,t,r);var s=function(e,t){var n=t||{},r=n.from,o=n.to;if(r&&o){if(Yre(o,e)&&Yre(r,e))return;if(Yre(o,e))return{from:o,to:void 0};if(Yre(r,e))return;return Joe(r,e)?{from:e,to:o}:{from:r,to:e}}return o?Joe(e,o)?{from:o,to:e}:{from:e,to:o}:r?eie(e,r)?{from:e,to:r}:{from:r,to:e}:{from:e,to:void 0}}(e,o);null===(a=n.onSelect)||void 0===a||a.call(n,s,e,t,r)},modifiers:u},children:r})}function qie(){var e=n.useContext(Bie);if(!e)throw new Error("useSelectRange must be used within a SelectRangeProvider");return e}function Gie(e){return Array.isArray(e)?aie([],e):void 0!==e?[e]:[]}(Vie=$ie||($ie={})).Outside="outside",Vie.Disabled="disabled",Vie.Selected="selected",Vie.Hidden="hidden",Vie.Today="today",Vie.RangeStart="range_start",Vie.RangeEnd="range_end",Vie.RangeMiddle="range_middle";var Kie=$ie.Selected,Wie=$ie.Disabled,Yie=$ie.Hidden,Xie=$ie.Today,Zie=$ie.RangeEnd,Qie=$ie.RangeMiddle,Jie=$ie.RangeStart,eae=$ie.Outside;var tae=n.createContext(void 0);function nae(e){var n=mie(),r=function(e,t,n){var r,o=((r={})[Kie]=Gie(e.selected),r[Wie]=Gie(e.disabled),r[Yie]=Gie(e.hidden),r[Xie]=[e.today],r[Zie]=[],r[Qie]=[],r[Jie]=[],r[eae]=[],r);return e.fromDate&&o[Wie].push({before:e.fromDate}),e.toDate&&o[Wie].push({after:e.toDate}),sie(e)?o[Wie]=o[Wie].concat(t.modifiers[Wie]):lie(e)&&(o[Wie]=o[Wie].concat(n.modifiers[Wie]),o[Jie]=n.modifiers[Jie],o[Qie]=n.modifiers[Qie],o[Zie]=n.modifiers[Zie]),o}(n,Uie(),qie()),o=function(e){var t={};return Object.entries(e).forEach((function(e){t[e[0]]=Gie(e[1])})),t}(n.modifiers),i=iie(iie({},r),o);return t.jsx(tae.Provider,{value:i,children:e.children})}function rae(){var e=n.useContext(tae);if(!e)throw new Error("useModifiers must be used within a ModifiersProvider");return e}function oae(e,t){return t.some((function(t){if("boolean"==typeof t)return t;if(Xre(t))return Yre(e,t);var n,r,o,i,a;if(function(e){return Array.isArray(e)&&e.every(Xre)}(t))return t.includes(e);if(function(e){return Boolean(e&&"object"==typeof e&&"from"in e)}(t))return n=e,a=(r=t).to,(i=r.from)&&a?(Gre(a,i)<0&&(i=(o=[a,i])[0],a=o[1]),Gre(n,i)>=0&&Gre(a,n)>=0):a?Yre(a,n):!!i&&Yre(i,n);if(function(e){return Boolean(e&&"object"==typeof e&&"dayOfWeek"in e)}(t))return t.dayOfWeek.includes(e.getDay());if(function(e){return Boolean(e&&"object"==typeof e&&"before"in e&&"after"in e)}(t)){var s=Gre(t.before,e)>0,l=Gre(t.after,e)<0;return Joe(t.before,t.after)?l&&s:s||l}return function(e){return Boolean(e&&"object"==typeof e&&"after"in e)}(t)?Gre(e,t.after)>0:function(e){return Boolean(e&&"object"==typeof e&&"before"in e)}(t)?Gre(t.before,e)>0:"function"==typeof t&&t(e)}))}function iae(e,t,n){var r=Object.keys(t).reduce((function(n,r){return oae(e,t[r])&&n.push(r),n}),[]),o={};return r.forEach((function(e){return o[e]=!0})),n&&!tie(e,n)&&(o.outside=!0),o}function aae(e,t){var n=t.moveBy,r=t.direction,o=t.context,i=t.modifiers,a=t.retry,s=void 0===a?{count:0,lastFocused:e}:a,l=o.weekStartsOn,c=o.fromDate,u=o.toDate,d=o.locale,p={day:Ire,week:Kre,month:Fre,year:Wre,startOfWeek:function(e){return o.ISOWeek?Bre(e):Vre(e,{locale:d,weekStartsOn:l})},endOfWeek:function(e){return o.ISOWeek?noe(e):toe(e,{locale:d,weekStartsOn:l})}}[n](e,"after"===r?1:-1);"before"===r&&c?p=function(e){var t,n;if(Lre(1,arguments),e&&"function"==typeof e.forEach)t=e;else{if("object"!==Mre(e)||null===e)return new Date(NaN);t=Array.prototype.slice.call(e)}return t.forEach((function(e){var t=Dre(e);(void 0===n||n<t||isNaN(Number(t)))&&(n=t)})),n||new Date(NaN)}([c,p]):"after"===r&&u&&(p=function(e){var t,n;if(Lre(1,arguments),e&&"function"==typeof e.forEach)t=e;else{if("object"!==Mre(e)||null===e)return new Date(NaN);t=Array.prototype.slice.call(e)}return t.forEach((function(e){var t=Dre(e);(void 0===n||n>t||isNaN(t.getDate()))&&(n=t)})),n||new Date(NaN)}([u,p]));var f=!0;if(i){var h=iae(p,i);f=!h.disabled&&!h.hidden}return f?p:s.count>365?s.lastFocused:aae(p,{moveBy:n,direction:r,context:o,modifiers:i,retry:iie(iie({},s),{count:s.count+1})})}var sae=n.createContext(void 0);function lae(e){var r=Eie(),o=rae(),i=n.useState(),a=i[0],s=i[1],l=n.useState(),c=l[0],u=l[1],d=function(e,t){for(var n,r,o=Jre(e[0]),i=Qre(e[e.length-1]),a=o;a<=i;){var s=iae(a,t);if(s.disabled||s.hidden)a=Ire(a,1);else{if(s.selected)return a;s.today&&!r&&(r=a),n||(n=a),a=Ire(a,1)}}return r||n}(r.displayMonths,o),p=(null!=a?a:c&&r.isDateDisplayed(c))?c:d,f=function(e){s(e)},h=mie(),m=function(e,t){if(a){var n=aae(a,{moveBy:e,direction:t,context:h,modifiers:o});Yre(a,n)||(r.goToDate(n,a),f(n))}};return t.jsx(sae.Provider,{value:{focusedDay:a,focusTarget:p,blur:function(){u(a),s(void 0)},focus:f,focusDayAfter:function(){return m("day","after")},focusDayBefore:function(){return m("day","before")},focusWeekAfter:function(){return m("week","after")},focusWeekBefore:function(){return m("week","before")},focusMonthBefore:function(){return m("month","before")},focusMonthAfter:function(){return m("month","after")},focusYearBefore:function(){return m("year","before")},focusYearAfter:function(){return m("year","after")},focusStartOfWeek:function(){return m("startOfWeek","before")},focusEndOfWeek:function(){return m("endOfWeek","after")}},children:e.children})}function cae(){var e=n.useContext(sae);if(!e)throw new Error("useFocusContext must be used within a FocusProvider");return e}var uae=n.createContext(void 0);function dae(e){if(!cie(e.initialProps)){return t.jsx(uae.Provider,{value:{selected:void 0},children:e.children})}return t.jsx(pae,{initialProps:e.initialProps,children:e.children})}function pae(e){var n=e.initialProps;return t.jsx(uae.Provider,{value:{selected:n.selected,onDayClick:function(e,t,r){var o,i,a;null===(o=n.onDayClick)||void 0===o||o.call(n,e,t,r),!t.selected||n.required?null===(a=n.onSelect)||void 0===a||a.call(n,e,e,t,r):null===(i=n.onSelect)||void 0===i||i.call(n,void 0,e,t,r)}},children:e.children})}function fae(){var e=n.useContext(uae);if(!e)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return e}function hae(e,t){var n=[e.classNames.day];return Object.keys(t).forEach((function(t){var r=e.modifiersClassNames[t];if(r)n.push(r);else if(function(e){return Object.values($ie).includes(e)}(t)){var o=e.classNames["day_".concat(t)];o&&n.push(o)}})),n}function mae(e,r,o){var i,a,s,l=mie(),c=cae(),u=function(e,t){return iae(e,rae(),t)}(e,r),d=function(e,t){var n=mie(),r=fae(),o=Uie(),i=qie(),a=cae(),s=a.focusDayAfter,l=a.focusDayBefore,c=a.focusWeekAfter,u=a.focusWeekBefore,d=a.blur,p=a.focus,f=a.focusMonthBefore,h=a.focusMonthAfter,m=a.focusYearBefore,g=a.focusYearAfter,v=a.focusStartOfWeek,y=a.focusEndOfWeek;return{onClick:function(a){var s,l,c,u;cie(n)?null===(s=r.onDayClick)||void 0===s||s.call(r,e,t,a):sie(n)?null===(l=o.onDayClick)||void 0===l||l.call(o,e,t,a):lie(n)?null===(c=i.onDayClick)||void 0===c||c.call(i,e,t,a):null===(u=n.onDayClick)||void 0===u||u.call(n,e,t,a)},onFocus:function(r){var o;p(e),null===(o=n.onDayFocus)||void 0===o||o.call(n,e,t,r)},onBlur:function(r){var o;d(),null===(o=n.onDayBlur)||void 0===o||o.call(n,e,t,r)},onKeyDown:function(r){var o;switch(r.key){case"ArrowLeft":r.preventDefault(),r.stopPropagation(),"rtl"===n.dir?s():l();break;case"ArrowRight":r.preventDefault(),r.stopPropagation(),"rtl"===n.dir?l():s();break;case"ArrowDown":r.preventDefault(),r.stopPropagation(),c();break;case"ArrowUp":r.preventDefault(),r.stopPropagation(),u();break;case"PageUp":r.preventDefault(),r.stopPropagation(),r.shiftKey?m():f();break;case"PageDown":r.preventDefault(),r.stopPropagation(),r.shiftKey?g():h();break;case"Home":r.preventDefault(),r.stopPropagation(),v();break;case"End":r.preventDefault(),r.stopPropagation(),y()}null===(o=n.onDayKeyDown)||void 0===o||o.call(n,e,t,r)},onKeyUp:function(r){var o;null===(o=n.onDayKeyUp)||void 0===o||o.call(n,e,t,r)},onMouseEnter:function(r){var o;null===(o=n.onDayMouseEnter)||void 0===o||o.call(n,e,t,r)},onMouseLeave:function(r){var o;null===(o=n.onDayMouseLeave)||void 0===o||o.call(n,e,t,r)},onPointerEnter:function(r){var o;null===(o=n.onDayPointerEnter)||void 0===o||o.call(n,e,t,r)},onPointerLeave:function(r){var o;null===(o=n.onDayPointerLeave)||void 0===o||o.call(n,e,t,r)},onTouchCancel:function(r){var o;null===(o=n.onDayTouchCancel)||void 0===o||o.call(n,e,t,r)},onTouchEnd:function(r){var o;null===(o=n.onDayTouchEnd)||void 0===o||o.call(n,e,t,r)},onTouchMove:function(r){var o;null===(o=n.onDayTouchMove)||void 0===o||o.call(n,e,t,r)},onTouchStart:function(r){var o;null===(o=n.onDayTouchStart)||void 0===o||o.call(n,e,t,r)}}}(e,u),p=function(){var e=mie(),t=fae(),n=Uie(),r=qie();return cie(e)?t.selected:sie(e)?n.selected:lie(e)?r.selected:void 0}(),f=Boolean(l.onDayClick||"default"!==l.mode);n.useEffect((function(){var t;u.outside||c.focusedDay&&f&&Yre(c.focusedDay,e)&&(null===(t=o.current)||void 0===t||t.focus())}),[c.focusedDay,e,o,f,u.outside]);var h=hae(l,u).join(" "),m=function(e,t){var n=iie({},e.styles.day);return Object.keys(t).forEach((function(t){var r;n=iie(iie({},n),null===(r=e.modifiersStyles)||void 0===r?void 0:r[t])})),n}(l,u),g=Boolean(u.outside&&!l.showOutsideDays||u.hidden),v=null!==(s=null===(a=l.components)||void 0===a?void 0:a.DayContent)&&void 0!==s?s:Lie,y={style:m,className:h,children:t.jsx(v,{date:e,displayMonth:r,activeModifiers:u}),role:"gridcell"},b=c.focusTarget&&Yre(c.focusTarget,e)&&!u.outside,x=c.focusedDay&&Yre(c.focusedDay,e),w=iie(iie(iie({},y),((i={disabled:u.disabled,role:"gridcell"})["aria-selected"]=u.selected,i.tabIndex=x||b?0:-1,i)),d);return{isButton:f,isHidden:g,activeModifiers:u,selectedDays:p,buttonProps:w,divProps:y}}function gae(e){var r=n.useRef(null),o=mae(e.date,e.displayMonth,r);return o.isHidden?t.jsx("div",{role:"gridcell"}):o.isButton?t.jsx(Nie,iie({name:"day",ref:r},o.buttonProps)):t.jsx("div",iie({},o.divProps))}function vae(e){var n=e.number,r=e.dates,o=mie(),i=o.onWeekNumberClick,a=o.styles,s=o.classNames,l=o.locale,c=o.labels.labelWeekNumber,u=(0,o.formatters.formatWeekNumber)(Number(n),{locale:l});if(!i)return t.jsx("span",{className:s.weeknumber,style:a.weeknumber,children:u});var d=c(Number(n),{locale:l});return t.jsx(Nie,{name:"week-number","aria-label":d,className:s.weeknumber,style:a.weeknumber,onClick:function(e){i(n,r,e)},children:u})}function yae(e){var n,r,o,i=mie(),a=i.styles,s=i.classNames,l=i.components,c=null!==(n=null==l?void 0:l.Day)&&void 0!==n?n:gae,u=null!==(r=null==l?void 0:l.WeekNumber)&&void 0!==r?r:vae;return i.showWeekNumber&&(o=t.jsx("td",{className:s.cell,style:a.cell,children:t.jsx(u,{number:e.weekNumber,dates:e.dates})})),t.jsxs("tr",{className:s.row,style:a.row,children:[o,e.dates.map((function(n){return t.jsx("td",{className:s.cell,style:a.cell,role:"presentation",children:t.jsx(c,{displayMonth:e.displayMonth,date:n})},Xoe(n))}))]})}function bae(e,t,n){for(var r=(null==n?void 0:n.ISOWeek)?noe(t):toe(t,n),o=(null==n?void 0:n.ISOWeek)?Bre(e):Vre(e,n),i=Gre(r,o),a=[],s=0;s<=i;s++)a.push(Ire(o,s));var l=a.reduce((function(e,t){var r=(null==n?void 0:n.ISOWeek)?function(e){Lre(1,arguments);var t=Dre(e),n=Bre(t).getTime()-zre(t).getTime();return Math.round(n/6048e5)+1}(t):function(e,t){Lre(1,arguments);var n=Dre(e),r=Vre(n,t).getTime()-Zoe(n,t).getTime();return Math.round(r/6048e5)+1}(t,n),o=e.find((function(e){return e.weekNumber===r}));return o?(o.dates.push(t),e):(e.push({weekNumber:r,dates:[t]}),e)}),[]);return l}function xae(e){var n,r,o,i=mie(),a=i.locale,s=i.classNames,l=i.styles,c=i.hideHead,u=i.components,d=i.weekStartsOn,p=i.firstWeekContainsDate,f=i.ISOWeek,h=function(e,t){var n=bae(Jre(e),Qre(e),t);if(null==t?void 0:t.useFixedWeeks){var r=Qoe(e,t);if(r<6){var o=n[n.length-1],i=o.dates[o.dates.length-1],a=Kre(i,6-r),s=bae(Kre(i,1),a,t);n.push.apply(n,s)}}return n}(e.displayMonth,{useFixedWeeks:Boolean(i.fixedWeeks),ISOWeek:f,locale:a,weekStartsOn:d,firstWeekContainsDate:p}),m=null!==(n=null==u?void 0:u.Head)&&void 0!==n?n:jie,g=null!==(r=null==u?void 0:u.Row)&&void 0!==r?r:yae,v=null!==(o=null==u?void 0:u.Footer)&&void 0!==o?o:kie;return t.jsxs("table",{id:e.id,className:s.table,style:l.table,role:"grid","aria-labelledby":e["aria-labelledby"],children:[!c&&t.jsx(m,{}),t.jsx("tbody",{className:s.tbody,style:l.tbody,children:h.map((function(n){return t.jsx(g,{displayMonth:e.displayMonth,dates:n.dates,weekNumber:n.weekNumber},n.weekNumber)}))}),t.jsx(v,{displayMonth:e.displayMonth})]})}var wae="undefined"!=typeof window&&window.document&&window.document.createElement?n.useLayoutEffect:n.useEffect,_ae=!1,Sae=0;function Eae(){return"react-day-picker-".concat(++Sae)}function Tae(e){var r,o,i=mie(),a=i.dir,s=i.classNames,l=i.styles,c=i.components,u=Eie().displayMonths,d=function(e){var t,r=null!=e?e:_ae?Eae():null,o=n.useState(r),i=o[0],a=o[1];return wae((function(){null===i&&a(Eae())}),[]),n.useEffect((function(){!1===_ae&&(_ae=!0)}),[]),null!==(t=null!=e?e:i)&&void 0!==t?t:void 0}(i.id?"".concat(i.id,"-").concat(e.displayIndex):void 0),p=i.id?"".concat(i.id,"-grid-").concat(e.displayIndex):void 0,f=[s.month],h=l.month,m=0===e.displayIndex,g=e.displayIndex===u.length-1,v=!m&&!g;"rtl"===a&&(g=(r=[m,g])[0],m=r[1]),m&&(f.push(s.caption_start),h=iie(iie({},h),l.caption_start)),g&&(f.push(s.caption_end),h=iie(iie({},h),l.caption_end)),v&&(f.push(s.caption_between),h=iie(iie({},h),l.caption_between));var y=null!==(o=null==c?void 0:c.Caption)&&void 0!==o?o:Pie;return t.jsxs("div",{className:f.join(" "),style:h,children:[t.jsx(y,{id:d,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),t.jsx(xae,{id:p,"aria-labelledby":d,displayMonth:e.displayMonth})]},e.displayIndex)}function Cae(e){var n=mie();return t.jsx("div",{className:n.classNames.months,style:n.styles.months,children:e.children})}function Aae(e){var r,o,i=e.initialProps,a=mie(),s=cae(),l=Eie(),c=n.useState(!1),u=c[0],d=c[1];n.useEffect((function(){a.initialFocus&&s.focusTarget&&(u||(s.focus(s.focusTarget),d(!0)))}),[a.initialFocus,u,s.focus,s.focusTarget,s]);var p=[a.classNames.root,a.className];a.numberOfMonths>1&&p.push(a.classNames.multiple_months),a.showWeekNumber&&p.push(a.classNames.with_weeknumber);var f=iie(iie({},a.styles.root),a.style),h=Object.keys(i).filter((function(e){return e.startsWith("data-")})).reduce((function(e,t){var n;return iie(iie({},e),((n={})[t]=i[t],n))}),{}),m=null!==(o=null===(r=i.components)||void 0===r?void 0:r.Months)&&void 0!==o?o:Cae;return t.jsx("div",iie({className:p.join(" "),style:f,dir:a.dir,id:a.id,nonce:i.nonce,title:i.title,lang:i.lang},h,{children:t.jsx(m,{children:l.displayMonths.map((function(e,n){return t.jsx(Tae,{displayIndex:n,displayMonth:e},n)}))})}))}function Nae(e){var n=e.children,r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["children"]);return t.jsx(hie,{initialProps:r,children:t.jsx(Sie,{children:t.jsx(dae,{initialProps:r,children:t.jsx(Iie,{initialProps:r,children:t.jsx(zie,{initialProps:r,children:t.jsx(nae,{children:t.jsx(lae,{children:n})})})})})})})}function Rae(e){return t.jsx(Nae,iie({},e,{children:t.jsx(Aae,{initialProps:e})}))}function Oae({className:e,classNames:n,showOutsideDays:r=!0,...o}){return t.jsx(Rae,{showOutsideDays:r,className:Zd("p-3",e),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:Zd(gZ({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:Zd("relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected].day-range-end)]:rounded-r-md","range"===o.mode?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md"),day:Zd(gZ({variant:"ghost"}),"h-8 w-8 p-0 font-normal aria-selected:opacity-100"),day_range_start:"day-range-start",day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground aria-selected:bg-accent/50 aria-selected:text-muted-foreground",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...n},components:{IconLeft:()=>t.jsx(hu,{className:"h-4 w-4"}),IconRight:()=>t.jsx(mu,{className:"h-4 w-4"})},...o})}Oae.displayName="Calendar";var Pae=.999,kae=/[\\\/_+.#"@\[\(\{&]/,Mae=/[\\\/_+.#"@\[\(\{&]/g,jae=/[\s-]/,Lae=/[\s-]/g;function Dae(e,t,n,r,o,i,a){if(i===t.length)return o===e.length?1:.99;var s=`${o},${i}`;if(void 0!==a[s])return a[s];for(var l,c,u,d,p=r.charAt(i),f=n.indexOf(p,o),h=0;f>=0;)(l=Dae(e,t,n,r,f+1,i+1,a))>h&&(f===o?l*=1:kae.test(e.charAt(f-1))?(l*=.8,(u=e.slice(o,f-1).match(Mae))&&o>0&&(l*=Math.pow(Pae,u.length))):jae.test(e.charAt(f-1))?(l*=.9,(d=e.slice(o,f-1).match(Lae))&&o>0&&(l*=Math.pow(Pae,d.length))):(l*=.17,o>0&&(l*=Math.pow(Pae,f-o))),e.charAt(f)!==t.charAt(i)&&(l*=.9999)),(l<.1&&n.charAt(f-1)===r.charAt(i+1)||r.charAt(i+1)===r.charAt(i)&&n.charAt(f-1)!==r.charAt(i))&&(.1*(c=Dae(e,t,n,r,f+1,i+2,a))>l&&(l=.1*c)),l>h&&(h=l),f=n.indexOf(p,f+1);return a[s]=h,h}function Iae(e){return e.toLowerCase().replace(Lae," ")}function Fae(e,t,n){return Dae(e=n&&n.length>0?""+(e+" "+n.join(" ")):e,t,Iae(e),Iae(t),0,0,{})}var Uae,$ae={exports:{}},Vae={};var Bae,zae={};
|
|
85
|
+
*/(n.expires)||!Number.isFinite(n.expires.valueOf()))throw new TypeError(`option expires is invalid: ${n.expires}`);i+="; Expires="+n.expires.toUTCString()}n.httpOnly&&(i+="; HttpOnly");n.secure&&(i+="; Secure");n.partitioned&&(i+="; Partitioned");if(n.priority){switch("string"==typeof n.priority?n.priority.toLowerCase():void 0){case"low":i+="; Priority=Low";break;case"medium":i+="; Priority=Medium";break;case"high":i+="; Priority=High";break;default:throw new TypeError(`option priority is invalid: ${n.priority}`)}}if(n.sameSite){switch("string"==typeof n.sameSite?n.sameSite.toLowerCase():n.sameSite){case!0:case"strict":i+="; SameSite=Strict";break;case"lax":i+="; SameSite=Lax";break;case"none":i+="; SameSite=None";break;default:throw new TypeError(`option sameSite is invalid: ${n.sameSite}`)}}return i};const Y3=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,X3=/^[\u0021-\u003A\u003C-\u007E]*$/,Z3=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,Q3=/^[\u0020-\u003A\u003D-\u007E]*$/,J3=Object.prototype.toString,e5=(()=>{const e=function(){};return e.prototype=Object.create(null),e})();function t5(e,t,n){do{const n=e.charCodeAt(t);if(32!==n&&9!==n)return t}while(++t<n);return n}function n5(e,t,n){for(;t>n;){const n=e.charCodeAt(--t);if(32!==n&&9!==n)return t+1}return n}function r5(e){if(-1===e.indexOf("%"))return e;try{return decodeURIComponent(e)}catch(JSe){return e}}function o5(e={}){let t,{initialEntries:n=["/"],initialIndex:r,v5Compat:o=!1}=e;t=n.map(((e,t)=>u(e,"string"==typeof e?null:e.state,0===t?"default":void 0)));let i=l(null==r?t.length-1:r),a="POP",s=null;function l(e){return Math.min(Math.max(e,0),t.length-1)}function c(){return t[i]}function u(e,n=null,r){let o=function(e,t,n=null,r){let o={pathname:"string"==typeof e?e:e.pathname,search:"",hash:"",..."string"==typeof t?c5(t):t,state:n,key:t&&t.key||r||s5()};return o}(t?c().pathname:"/",e,n,r);return a5("/"===o.pathname.charAt(0),`relative pathnames are not supported in memory history: ${JSON.stringify(e)}`),o}function d(e){return"string"==typeof e?e:l5(e)}return{get index(){return i},get action(){return a},get location(){return c()},createHref:d,createURL:e=>new URL(d(e),"http://localhost"),encodeLocation(e){let t="string"==typeof e?c5(e):e;return{pathname:t.pathname||"",search:t.search||"",hash:t.hash||""}},push(e,n){a="PUSH";let r=u(e,n);i+=1,t.splice(i,t.length,r),o&&s&&s({action:a,location:r,delta:1})},replace(e,n){a="REPLACE";let r=u(e,n);t[i]=r,o&&s&&s({action:a,location:r,delta:0})},go(e){a="POP";let n=l(i+e);i=n,s&&s({action:a,location:t[n],delta:e})},listen:e=>(s=e,()=>{s=null})}}function i5(e,t){if(!1===e||null==e)throw new Error(t)}function a5(e,t){if(!e)try{throw new Error(t)}catch(JSe){}}function s5(){return Math.random().toString(36).substring(2,10)}function l5({pathname:e="/",search:t="",hash:n=""}){return t&&"?"!==t&&(e+="?"===t.charAt(0)?t:"?"+t),n&&"#"!==n&&(e+="#"===n.charAt(0)?n:"#"+n),e}function c5(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function u5(e,t,n="/"){return function(e,t,n,r){let o="string"==typeof t?c5(t):t,i=E5(o.pathname||"/",n);if(null==i)return null;let a=d5(e);!function(e){e.sort(((e,t)=>e.score!==t.score?t.score-e.score:function(e,t){let n=e.length===t.length&&e.slice(0,-1).every(((e,n)=>e===t[n]));return n?e[e.length-1]-t[t.length-1]:0}(e.routesMeta.map((e=>e.childrenIndex)),t.routesMeta.map((e=>e.childrenIndex)))))}(a);let s=null;for(let l=0;null==s&&l<a.length;++l){let e=S5(i);s=w5(a[l],e,r)}return s}(e,t,n,!1)}function d5(e,t=[],n=[],r=""){let o=(e,o,i)=>{let a={relativePath:void 0===i?e.path||"":i,caseSensitive:!0===e.caseSensitive,childrenIndex:o,route:e};a.relativePath.startsWith("/")&&(i5(a.relativePath.startsWith(r),`Absolute route path "${a.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),a.relativePath=a.relativePath.slice(r.length));let s=N5([r,a.relativePath]),l=n.concat(a);e.children&&e.children.length>0&&(i5(!0!==e.index,`Index routes must not have child routes. Please remove all child routes from route path "${s}".`),d5(e.children,t,l,s)),(null!=e.path||e.index)&&t.push({path:s,score:x5(s,e.index),routesMeta:l})};return e.forEach(((e,t)=>{if(""!==e.path&&e.path?.includes("?"))for(let n of p5(e.path))o(e,t,n);else o(e,t)})),t}function p5(e){let t=e.split("/");if(0===t.length)return[];let[n,...r]=t,o=n.endsWith("?"),i=n.replace(/\?$/,"");if(0===r.length)return o?[i,""]:[i];let a=p5(r.join("/")),s=[];return s.push(...a.map((e=>""===e?i:[i,e].join("/")))),o&&s.push(...a),s.map((t=>e.startsWith("/")&&""===t?"/":t))}var f5=/^:[\w-]+$/,h5=3,m5=2,g5=1,v5=10,y5=-2,b5=e=>"*"===e;function x5(e,t){let n=e.split("/"),r=n.length;return n.some(b5)&&(r+=y5),t&&(r+=m5),n.filter((e=>!b5(e))).reduce(((e,t)=>e+(f5.test(t)?h5:""===t?g5:v5)),r)}function w5(e,t,n=!1){let{routesMeta:r}=e,o={},i="/",a=[];for(let s=0;s<r.length;++s){let e=r[s],l=s===r.length-1,c="/"===i?t:t.slice(i.length)||"/",u=_5({path:e.relativePath,caseSensitive:e.caseSensitive,end:l},c),d=e.route;if(!u&&l&&n&&!r[r.length-1].route.index&&(u=_5({path:e.relativePath,caseSensitive:e.caseSensitive,end:!1},c)),!u)return null;Object.assign(o,u.params),a.push({params:o,pathname:N5([i,u.pathname]),pathnameBase:R5(N5([i,u.pathnameBase])),route:d}),"/"!==u.pathnameBase&&(i=N5([i,u.pathnameBase]))}return a}function _5(e,t){"string"==typeof e&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=function(e,t=!1,n=!0){a5("*"===e||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,((e,t,n)=>(r.push({paramName:t,isOptional:null!=n}),n?"/?([^\\/]+)?":"/([^\\/]+)")));e.endsWith("*")?(r.push({paramName:"*"}),o+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":""!==e&&"/"!==e&&(o+="(?:(?=\\/|$))");let i=new RegExp(o,t?void 0:"i");return[i,r]}(e.path,e.caseSensitive,e.end),o=t.match(n);if(!o)return null;let i=o[0],a=i.replace(/(.)\/+$/,"$1"),s=o.slice(1);return{params:r.reduce(((e,{paramName:t,isOptional:n},r)=>{if("*"===t){a=i.slice(0,i.length-(s[r]||"").length).replace(/(.)\/+$/,"$1")}const o=s[r];return e[t]=n&&!o?void 0:(o||"").replace(/%2F/g,"/"),e}),{}),pathname:i,pathnameBase:a,pattern:e}}function S5(e){try{return e.split("/").map((e=>decodeURIComponent(e).replace(/\//g,"%2F"))).join("/")}catch(t){return a5(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function E5(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&"/"!==r?null:e.slice(n)||"/"}function T5(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function C5(e){let t=function(e){return e.filter(((e,t)=>0===t||e.route.path&&e.route.path.length>0))}(e);return t.map(((e,n)=>n===t.length-1?e.pathname:e.pathnameBase))}function A5(e,t,n,r=!1){let o;"string"==typeof e?o=c5(e):(o={...e},i5(!o.pathname||!o.pathname.includes("?"),T5("?","pathname","search",o)),i5(!o.pathname||!o.pathname.includes("#"),T5("#","pathname","hash",o)),i5(!o.search||!o.search.includes("#"),T5("#","search","hash",o)));let i,a=""===e||""===o.pathname,s=a?"/":o.pathname;if(null==s)i=n;else{let e=t.length-1;if(!r&&s.startsWith("..")){let t=s.split("/");for(;".."===t[0];)t.shift(),e-=1;o.pathname=t.join("/")}i=e>=0?t[e]:"/"}let l=function(e,t="/"){let{pathname:n,search:r="",hash:o=""}="string"==typeof e?c5(e):e,i=n?n.startsWith("/")?n:function(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach((e=>{".."===e?n.length>1&&n.pop():"."!==e&&n.push(e)})),n.length>1?n.join("/"):"/"}(n,t):t;return{pathname:i,search:O5(r),hash:P5(o)}}(o,i),c=s&&"/"!==s&&s.endsWith("/"),u=(a||"."===s)&&n.endsWith("/");return l.pathname.endsWith("/")||!c&&!u||(l.pathname+="/"),l}var N5=e=>e.join("/").replace(/\/\/+/g,"/"),R5=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),O5=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",P5=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";var k5=["POST","PUT","PATCH","DELETE"];new Set(k5);var M5=["GET",...k5];new Set(M5);var j5=i.createContext(null);j5.displayName="DataRouter";var L5=i.createContext(null);L5.displayName="DataRouterState";var D5=i.createContext({isTransitioning:!1});D5.displayName="ViewTransition",i.createContext(new Map).displayName="Fetchers",i.createContext(null).displayName="Await";var I5=i.createContext(null);I5.displayName="Navigation";var F5=i.createContext(null);F5.displayName="Location";var U5=i.createContext({outlet:null,matches:[],isDataRoute:!1});U5.displayName="Route";var $5=i.createContext(null);function V5(){return null!=i.useContext(F5)}function B5(){return i5(V5(),"useLocation() may be used only in the context of a <Router> component."),i.useContext(F5).location}$5.displayName="RouteError";var z5="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function H5(e){i.useContext(I5).static||i.useLayoutEffect(e)}function q5(){let{isDataRoute:e}=i.useContext(U5);return e?function(){let{router:e}=function(e){let t=i.useContext(j5);return i5(t,Q5(e)),t}("useNavigate"),t=J5("useNavigate"),n=i.useRef(!1);return H5((()=>{n.current=!0})),i.useCallback((async(r,o={})=>{a5(n.current,z5),n.current&&("number"==typeof r?e.navigate(r):await e.navigate(r,{fromRouteId:t,...o}))}),[e,t])}():function(){i5(V5(),"useNavigate() may be used only in the context of a <Router> component.");let e=i.useContext(j5),{basename:t,navigator:n}=i.useContext(I5),{matches:r}=i.useContext(U5),{pathname:o}=B5(),a=JSON.stringify(C5(r)),s=i.useRef(!1);return H5((()=>{s.current=!0})),i.useCallback(((r,i={})=>{if(a5(s.current,z5),!s.current)return;if("number"==typeof r)return void n.go(r);let l=A5(r,JSON.parse(a),o,"path"===i.relative);null==e&&"/"!==t&&(l.pathname="/"===l.pathname?t:N5([t,l.pathname])),(i.replace?n.replace:n.push)(l,i.state,i)}),[t,n,a,o,e])}()}function G5(e,{relative:t}={}){let{matches:n}=i.useContext(U5),{pathname:r}=B5(),o=JSON.stringify(C5(n));return i.useMemo((()=>A5(e,JSON.parse(o),r,"path"===t)),[e,o,r,t])}function K5(e,t,n,r){i5(V5(),"useRoutes() may be used only in the context of a <Router> component.");let o,{navigator:a,static:s}=i.useContext(I5),{matches:l}=i.useContext(U5),c=l[l.length-1],u=c?c.params:{},d=c?c.pathname:"/",p=c?c.pathnameBase:"/",f=c&&c.route;{let e=f&&f.path||"";t4(d,!f||e.endsWith("*")||e.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${d}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.\n\nPlease change the parent <Route path="${e}"> to <Route path="${"/"===e?"*":`${e}/*`}">.`)}o=B5();let h=o.pathname||"/",m=h;if("/"!==p){let e=p.replace(/^\//,"").split("/");m="/"+h.replace(/^\//,"").split("/").slice(e.length).join("/")}let g=!s&&n&&n.matches&&n.matches.length>0?n.matches:u5(e,{pathname:m});a5(f||null!=g,`No routes matched location "${o.pathname}${o.search}${o.hash}" `),a5(null==g||void 0!==g[g.length-1].route.element||void 0!==g[g.length-1].route.Component||void 0!==g[g.length-1].route.lazy,`Matched leaf route at location "${o.pathname}${o.search}${o.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let v=function(e,t=[],n=null){if(null==e){if(!n)return null;if(n.errors)e=n.matches;else{if(0!==t.length||n.initialized||!(n.matches.length>0))return null;e=n.matches}}let r=e,o=n?.errors;if(null!=o){let e=r.findIndex((e=>e.route.id&&void 0!==o?.[e.route.id]));i5(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),r=r.slice(0,Math.min(r.length,e+1))}let a=!1,s=-1;if(n)for(let i=0;i<r.length;i++){let e=r[i];if((e.route.HydrateFallback||e.route.hydrateFallbackElement)&&(s=i),e.route.id){let{loaderData:t,errors:o}=n,i=e.route.loader&&!t.hasOwnProperty(e.route.id)&&(!o||void 0===o[e.route.id]);if(e.route.lazy||i){a=!0,r=s>=0?r.slice(0,s+1):[r[0]];break}}}return r.reduceRight(((e,l,c)=>{let u,d=!1,p=null,f=null;n&&(u=o&&l.route.id?o[l.route.id]:void 0,p=l.route.errorElement||Y5,a&&(s<0&&0===c?(t4("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,f=null):s===c&&(d=!0,f=l.route.hydrateFallbackElement||null)));let h=t.concat(r.slice(0,c+1)),m=()=>{let t;return t=u?p:d?f:l.route.Component?i.createElement(l.route.Component,null):l.route.element?l.route.element:e,i.createElement(Z5,{match:l,routeContext:{outlet:e,matches:h,isDataRoute:null!=n},children:t})};return n&&(l.route.ErrorBoundary||l.route.errorElement||0===c)?i.createElement(X5,{location:n.location,revalidation:n.revalidation,component:p,error:u,children:m(),routeContext:{outlet:null,matches:h,isDataRoute:!0}}):m()}),null)}(g&&g.map((e=>Object.assign({},e,{params:Object.assign({},u,e.params),pathname:N5([p,a.encodeLocation?a.encodeLocation(e.pathname).pathname:e.pathname]),pathnameBase:"/"===e.pathnameBase?p:N5([p,a.encodeLocation?a.encodeLocation(e.pathnameBase).pathname:e.pathnameBase])}))),l,n,r);return v}function W5(){let e=function(){let e=i.useContext($5),t=function(e){let t=i.useContext(L5);return i5(t,Q5(e)),t}("useRouteError"),n=J5("useRouteError");if(void 0!==e)return e;return t.errors?.[n]}(),t=function(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"boolean"==typeof e.internal&&"data"in e}(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:r},a={padding:"2px 4px",backgroundColor:r},s=null;return s=i.createElement(i.Fragment,null,i.createElement("p",null,"💿 Hey developer 👋"),i.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",i.createElement("code",{style:a},"ErrorBoundary")," or"," ",i.createElement("code",{style:a},"errorElement")," prop on your route.")),i.createElement(i.Fragment,null,i.createElement("h2",null,"Unexpected Application Error!"),i.createElement("h3",{style:{fontStyle:"italic"}},t),n?i.createElement("pre",{style:o},n):null,s)}i.createContext(null);var Y5=i.createElement(W5,null),X5=class extends i.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||"idle"!==t.revalidation&&"idle"===e.revalidation?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:void 0!==e.error?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){}render(){return void 0!==this.state.error?i.createElement(U5.Provider,{value:this.props.routeContext},i.createElement($5.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function Z5({routeContext:e,match:t,children:n}){let r=i.useContext(j5);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),i.createElement(U5.Provider,{value:e},n)}function Q5(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function J5(e){let t=function(e){let t=i.useContext(U5);return i5(t,Q5(e)),t}(e),n=t.matches[t.matches.length-1];return i5(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}var e4={};function t4(e,t,n){t||e4[e]||(e4[e]=!0,a5(!1,n))}function n4({basename:e,children:t,initialEntries:n,initialIndex:r}){let o=i.useRef();null==o.current&&(o.current=o5({initialEntries:n,initialIndex:r,v5Compat:!0}));let a=o.current,[s,l]=i.useState({action:a.action,location:a.location}),c=i.useCallback((e=>{i.startTransition((()=>l(e)))}),[l]);return i.useLayoutEffect((()=>a.listen(c)),[a,c]),i.createElement(r4,{basename:e,children:t,location:s.location,navigationType:s.action,navigator:a})}function r4({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:o,static:a=!1}){i5(!V5(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let s=e.replace(/^\/*/,"/"),l=i.useMemo((()=>({basename:s,navigator:o,static:a,future:{}})),[s,o,a]);"string"==typeof n&&(n=c5(n));let{pathname:c="/",search:u="",hash:d="",state:p=null,key:f="default"}=n,h=i.useMemo((()=>{let e=E5(c,s);return null==e?null:{location:{pathname:e,search:u,hash:d,state:p,key:f},navigationType:r}}),[s,c,u,d,p,f,r]);return a5(null!=h,`<Router basename="${s}"> is not able to match the URL "${c}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),null==h?null:i.createElement(I5.Provider,{value:l},i.createElement(F5.Provider,{children:t,value:h}))}i.memo((function({routes:e,future:t,state:n}){return K5(e,0,n,t)}));var o4="get",i4="application/x-www-form-urlencoded";function a4(e){return null!=e&&"string"==typeof e.tagName}function s4(e=""){return new URLSearchParams("string"==typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce(((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map((e=>[n,e])):[[n,r]])}),[]))}var l4=null;var c4=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function u4(e){return null==e||c4.has(e)?e:(a5(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${i4}"`),null)}function d4(e,t){let n,r,o,i,a;if(function(e){return a4(e)&&"form"===e.tagName.toLowerCase()}(e)){let a=e.getAttribute("action");r=a?E5(a,t):null,n=e.getAttribute("method")||o4,o=u4(e.getAttribute("enctype"))||i4,i=new FormData(e)}else if(function(e){return a4(e)&&"button"===e.tagName.toLowerCase()}(e)||function(e){return a4(e)&&"input"===e.tagName.toLowerCase()}(e)&&("submit"===e.type||"image"===e.type)){let a=e.form;if(null==a)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let s=e.getAttribute("formaction")||a.getAttribute("action");if(r=s?E5(s,t):null,n=e.getAttribute("formmethod")||a.getAttribute("method")||o4,o=u4(e.getAttribute("formenctype"))||u4(a.getAttribute("enctype"))||i4,i=new FormData(a,e),!function(){if(null===l4)try{new FormData(document.createElement("form"),0),l4=!1}catch(JSe){l4=!0}return l4}()){let{name:t,type:n,value:r}=e;if("image"===n){let e=t?`${t}.`:"";i.append(`${e}x`,"0"),i.append(`${e}y`,"0")}else t&&i.append(t,r)}}else{if(a4(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=o4,r=null,o=i4,a=e}return i&&"text/plain"===o&&(a=i,i=void 0),{action:r,method:n.toLowerCase(),encType:o,formData:i,body:a}}function p4(e,t){if(!1===e||null==e)throw new Error(t)}function f4(e){return null!=e&&(null==e.href?"preload"===e.rel&&"string"==typeof e.imageSrcSet&&"string"==typeof e.imageSizes:"string"==typeof e.rel&&"string"==typeof e.href)}async function h4(e,t,n){return function(e,t){let n=new Set;return new Set(t),e.reduce(((e,t)=>{let r=JSON.stringify(function(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}(t));return n.has(r)||(n.add(r),e.push({key:r,link:t})),e}),[])}((await Promise.all(e.map((async e=>{let r=t.routes[e.route.id];if(r){let e=await async function(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return window.__reactRouterContext&&window,window.location.reload(),new Promise((()=>{}))}}(r,n);return e.links?e.links():[]}return[]})))).flat(1).filter(f4).filter((e=>"stylesheet"===e.rel||"preload"===e.rel)).map((e=>"stylesheet"===e.rel?{...e,rel:"prefetch",as:"style"}:{...e,rel:"prefetch"})))}function m4(e,t,n,r,o,i){let a=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith("*")&&n[t].params["*"]!==e.params["*"];return"assets"===i?t.filter(((e,t)=>a(e,t)||s(e,t))):"data"===i?t.filter(((t,i)=>{let l=r.routes[t.route.id];if(!l||!l.hasLoader)return!1;if(a(t,i)||s(t,i))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if("boolean"==typeof r)return r}return!0})):[]}function g4(e,t,{includeHydrateFallback:n}={}){return r=e.map((e=>{let r=t.routes[e.route.id];if(!r)return[];let o=[r.module];return r.clientActionModule&&(o=o.concat(r.clientActionModule)),r.clientLoaderModule&&(o=o.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(o=o.concat(r.hydrateFallbackModule)),r.imports&&(o=o.concat(r.imports)),o})).flat(1),[...new Set(r)];var r}function v4(){let e=i.useContext(j5);return p4(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}var y4=i.createContext(void 0);function b4(){let e=i.useContext(y4);return p4(e,"You must render this element inside a <HydratedRouter> element"),e}function x4(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function w4({page:e,...t}){let{router:n}=v4(),r=i.useMemo((()=>u5(n.routes,e,n.basename)),[n.routes,e,n.basename]);return r?i.createElement(_4,{page:e,matches:r,...t}):null}function _4({page:e,matches:t,...n}){let r=B5(),{manifest:o,routeModules:a}=b4(),{basename:s}=v4(),{loaderData:l,matches:c}=function(){let e=i.useContext(L5);return p4(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}(),u=i.useMemo((()=>m4(e,t,c,o,r,"data")),[e,t,c,o,r]),d=i.useMemo((()=>m4(e,t,c,o,r,"assets")),[e,t,c,o,r]),p=i.useMemo((()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,i=!1;if(t.forEach((e=>{let t=o.routes[e.route.id];t&&t.hasLoader&&(!u.some((t=>t.route.id===e.route.id))&&e.route.id in l&&a[e.route.id]?.shouldRevalidate||t.hasClientLoader?i=!0:n.add(e.route.id))})),0===n.size)return[];let c=function(e,t){let n="string"==typeof e?new URL(e,"undefined"==typeof window?"server://singlefetch/":window.location.origin):e;return n.pathname="/"===n.pathname?"_root.data":t&&"/"===E5(n.pathname,t)?`${t.replace(/\/$/,"")}/_root.data`:`${n.pathname.replace(/\/$/,"")}.data`,n}(e,s);return i&&n.size>0&&c.searchParams.set("_routes",t.filter((e=>n.has(e.route.id))).map((e=>e.route.id)).join(",")),[c.pathname+c.search]}),[s,l,r,o,u,t,e,a]),f=i.useMemo((()=>g4(d,o)),[d,o]),h=function(e){let{manifest:t,routeModules:n}=b4(),[r,o]=i.useState([]);return i.useEffect((()=>{let r=!1;return h4(e,t,n).then((e=>{r||o(e)})),()=>{r=!0}}),[e,t,n]),r}(d);return i.createElement(i.Fragment,null,p.map((e=>i.createElement("link",{key:e,rel:"prefetch",as:"fetch",href:e,...n}))),f.map((e=>i.createElement("link",{key:e,rel:"modulepreload",href:e,...n}))),h.map((({key:e,link:t})=>i.createElement("link",{key:e,...t}))))}function S4(...e){return t=>{e.forEach((e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)}))}}y4.displayName="FrameworkContext";var E4="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;try{E4&&(window.__reactRouterVersion="7.5.2")}catch(JSe){}var T4=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,C4=i.forwardRef((function({onClick:e,discover:t="render",prefetch:n="none",relative:r,reloadDocument:o,replace:a,state:s,target:l,to:c,preventScrollReset:u,viewTransition:d,...p},f){let h,{basename:m}=i.useContext(I5),g="string"==typeof c&&T4.test(c),v=!1;if("string"==typeof c&&g&&(h=c,E4))try{let e=new URL(window.location.href),t=c.startsWith("//")?new URL(e.protocol+c):new URL(c),n=E5(t.pathname,m);t.origin===e.origin&&null!=n?c=n+t.search+t.hash:v=!0}catch(JSe){a5(!1,`<Link to="${c}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let y=function(e,{relative:t}={}){i5(V5(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=i.useContext(I5),{hash:o,pathname:a,search:s}=G5(e,{relative:t}),l=a;return"/"!==n&&(l="/"===a?n:N5([n,a])),r.createHref({pathname:l,search:s,hash:o})}(c,{relative:r}),[b,x,w]=function(e,t){let n=i.useContext(y4),[r,o]=i.useState(!1),[a,s]=i.useState(!1),{onFocus:l,onBlur:c,onMouseEnter:u,onMouseLeave:d,onTouchStart:p}=t,f=i.useRef(null);i.useEffect((()=>{if("render"===e&&s(!0),"viewport"===e){let e=new IntersectionObserver((e=>{e.forEach((e=>{s(e.isIntersecting)}))}),{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}}),[e]),i.useEffect((()=>{if(r){let e=setTimeout((()=>{s(!0)}),100);return()=>{clearTimeout(e)}}}),[r]);let h=()=>{o(!0)},m=()=>{o(!1),s(!1)};return n?"intent"!==e?[a,f,{}]:[a,f,{onFocus:x4(l,h),onBlur:x4(c,m),onMouseEnter:x4(u,h),onMouseLeave:x4(d,m),onTouchStart:x4(p,h)}]:[!1,f,{}]}(n,p),_=function(e,{target:t,replace:n,state:r,preventScrollReset:o,relative:a,viewTransition:s}={}){let l=q5(),c=B5(),u=G5(e,{relative:a});return i.useCallback((i=>{if(function(e,t){return!(0!==e.button||t&&"_self"!==t||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e))}(i,t)){i.preventDefault();let t=void 0!==n?n:l5(c)===l5(u);l(e,{replace:t,state:r,preventScrollReset:o,relative:a,viewTransition:s})}}),[c,l,u,n,r,t,e,o,a,s])}(c,{replace:a,state:s,target:l,preventScrollReset:u,relative:r,viewTransition:d});let S=i.createElement("a",{...p,...w,href:h||y,onClick:v||o?e:function(t){e&&e(t),t.defaultPrevented||_(t)},ref:S4(f,x),target:l,"data-discover":g||"render"!==t?void 0:"true"});return b&&!g?i.createElement(i.Fragment,null,S,i.createElement(w4,{page:y})):S}));function A4(e){let t=i.useContext(j5);return i5(t,function(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}(e)),t}function N4(e){a5("undefined"!=typeof URLSearchParams,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=i.useRef(s4(e)),n=i.useRef(!1),r=B5(),o=i.useMemo((()=>function(e,t){let n=s4(e);return t&&t.forEach(((e,r)=>{n.has(r)||t.getAll(r).forEach((e=>{n.append(r,e)}))})),n}(r.search,n.current?null:t.current)),[r.search]),a=q5(),s=i.useCallback(((e,t)=>{const r=s4("function"==typeof e?e(o):e);n.current=!0,a("?"+r,t)}),[a,o]);return[o,s]}C4.displayName="Link",i.forwardRef((function({"aria-current":e="page",caseSensitive:t=!1,className:n="",end:r=!1,style:o,to:a,viewTransition:s,children:l,...c},u){let d=G5(a,{relative:c.relative}),p=B5(),f=i.useContext(L5),{navigator:h,basename:m}=i.useContext(I5),g=null!=f&&function(e,t={}){let n=i.useContext(D5);i5(null!=n,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=A4("useViewTransitionState"),o=G5(e,{relative:t.relative});if(!n.isTransitioning)return!1;let a=E5(n.currentLocation.pathname,r)||n.currentLocation.pathname,s=E5(n.nextLocation.pathname,r)||n.nextLocation.pathname;return null!=_5(o.pathname,s)||null!=_5(o.pathname,a)}(d)&&!0===s,v=h.encodeLocation?h.encodeLocation(d).pathname:d.pathname,y=p.pathname,b=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(y=y.toLowerCase(),b=b?b.toLowerCase():null,v=v.toLowerCase()),b&&m&&(b=E5(b,m)||b);const x="/"!==v&&v.endsWith("/")?v.length-1:v.length;let w,_=y===v||!r&&y.startsWith(v)&&"/"===y.charAt(x),S=null!=b&&(b===v||!r&&b.startsWith(v)&&"/"===b.charAt(v.length)),E={isActive:_,isPending:S,isTransitioning:g},T=_?e:void 0;w="function"==typeof n?n(E):[n,_?"active":null,S?"pending":null,g?"transitioning":null].filter(Boolean).join(" ");let C="function"==typeof o?o(E):o;return i.createElement(C4,{...c,"aria-current":T,className:w,ref:u,style:C,to:a,viewTransition:s},"function"==typeof l?l(E):l)})).displayName="NavLink",i.forwardRef((({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:o,state:a,method:s=o4,action:l,onSubmit:c,relative:u,preventScrollReset:d,viewTransition:p,...f},h)=>{let m=function(){let{router:e}=A4("useSubmit"),{basename:t}=i.useContext(I5),n=J5("useRouteId");return i.useCallback((async(r,o={})=>{let{action:i,method:a,encType:s,formData:l,body:c}=d4(r,t);if(!1===o.navigate){let t=o.fetcherKey||O4();await e.fetch(t,n,o.action||i,{preventScrollReset:o.preventScrollReset,formData:l,body:c,formMethod:o.method||a,formEncType:o.encType||s,flushSync:o.flushSync})}else await e.navigate(o.action||i,{preventScrollReset:o.preventScrollReset,formData:l,body:c,formMethod:o.method||a,formEncType:o.encType||s,replace:o.replace,state:o.state,fromRouteId:n,flushSync:o.flushSync,viewTransition:o.viewTransition})}),[e,t,n])}(),g=function(e,{relative:t}={}){let{basename:n}=i.useContext(I5),r=i.useContext(U5);i5(r,"useFormAction must be used inside a RouteContext");let[o]=r.matches.slice(-1),a={...G5(e||".",{relative:t})},s=B5();if(null==e){a.search=s.search;let e=new URLSearchParams(a.search),t=e.getAll("index");if(t.some((e=>""===e))){e.delete("index"),t.filter((e=>e)).forEach((t=>e.append("index",t)));let n=e.toString();a.search=n?`?${n}`:""}}e&&"."!==e||!o.route.index||(a.search=a.search?a.search.replace(/^\?/,"?index&"):"?index");"/"!==n&&(a.pathname="/"===a.pathname?n:N5([n,a.pathname]));return l5(a)}(l,{relative:u}),v="get"===s.toLowerCase()?"get":"post",y="string"==typeof l&&T4.test(l);return i.createElement("form",{ref:h,method:v,action:g,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,i=r?.getAttribute("formmethod")||s;m(r||e.currentTarget,{fetcherKey:t,method:i,navigate:n,replace:o,state:a,relative:u,preventScrollReset:d,viewTransition:p})},...f,"data-discover":y||"render"!==e?void 0:"true"})})).displayName="Form";var R4=0,O4=()=>`__${String(++R4)}__`;new TextEncoder;var P4,k4="dismissableLayer.update",M4="dismissableLayer.pointerDownOutside",j4="dismissableLayer.focusOutside",L4=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),D4=i.forwardRef(((e,n)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:s,onInteractOutside:l,onDismiss:c,...u}=e,d=i.useContext(L4),[p,f]=i.useState(null),h=p?.ownerDocument??globalThis?.document,[,m]=i.useState({}),g=XU(n,(e=>f(e))),v=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=v.indexOf(y),x=p?v.indexOf(p):-1,w=d.layersWithOutsidePointerEventsDisabled.size>0,_=x>=b,S=function(e,t=globalThis?.document){const n=VQ(e),r=i.useRef(!1),o=i.useRef((()=>{}));return i.useEffect((()=>{const e=e=>{if(e.target&&!r.current){let r=function(){F4(M4,n,i,{discrete:!0})};const i={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",o.current),o.current=r,t.addEventListener("click",o.current,{once:!0})):r()}else t.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout((()=>{t.addEventListener("pointerdown",e)}),0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",e),t.removeEventListener("click",o.current)}}),[t,n]),{onPointerDownCapture:()=>r.current=!0}}((e=>{const t=e.target,n=[...d.branches].some((e=>e.contains(t)));_&&!n&&(a?.(e),l?.(e),e.defaultPrevented||c?.())}),h),E=function(e,t=globalThis?.document){const n=VQ(e),r=i.useRef(!1);return i.useEffect((()=>{const e=e=>{if(e.target&&!r.current){F4(j4,n,{originalEvent:e},{discrete:!1})}};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)}),[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}((e=>{const t=e.target;[...d.branches].some((e=>e.contains(t)))||(s?.(e),l?.(e),e.defaultPrevented||c?.())}),h);return JQ((e=>{x===d.layers.size-1&&(o?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))}),h),i.useEffect((()=>{if(p)return r&&(0===d.layersWithOutsidePointerEventsDisabled.size&&(P4=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(p)),d.layers.add(p),I4(),()=>{r&&1===d.layersWithOutsidePointerEventsDisabled.size&&(h.body.style.pointerEvents=P4)}}),[p,h,r,d]),i.useEffect((()=>()=>{p&&(d.layers.delete(p),d.layersWithOutsidePointerEventsDisabled.delete(p),I4())}),[p,d]),i.useEffect((()=>{const e=()=>m({});return document.addEventListener(k4,e),()=>document.removeEventListener(k4,e)}),[]),t.jsx(WQ.div,{...u,ref:g,style:{pointerEvents:w?_?"auto":"none":void 0,...e.style},onFocusCapture:FQ(e.onFocusCapture,E.onFocusCapture),onBlurCapture:FQ(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:FQ(e.onPointerDownCapture,S.onPointerDownCapture)})}));D4.displayName="DismissableLayer";function I4(){const e=new CustomEvent(k4);document.dispatchEvent(e)}function F4(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?YQ(o,i):o.dispatchEvent(i)}i.forwardRef(((e,n)=>{const r=i.useContext(L4),o=i.useRef(null),a=XU(n,o);return i.useEffect((()=>{const e=o.current;if(e)return r.branches.add(e),()=>{r.branches.delete(e)}}),[r.branches]),t.jsx(WQ.div,{...e,ref:a})})).displayName="DismissableLayerBranch";var U4=i.forwardRef(((e,n)=>t.jsx(WQ.span,{...e,ref:n,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}})));U4.displayName="VisuallyHidden";var $4=U4,[V4,B4]=UQ("Tooltip",[o1]),z4=o1(),H4="TooltipProvider",q4=700,G4="tooltip.open",[K4,W4]=V4(H4),Y4=e=>{const{__scopeTooltip:n,delayDuration:r=q4,skipDelayDuration:o=300,disableHoverableContent:a=!1,children:s}=e,[l,c]=i.useState(!0),u=i.useRef(!1),d=i.useRef(0);return i.useEffect((()=>{const e=d.current;return()=>window.clearTimeout(e)}),[]),t.jsx(K4,{scope:n,isOpenDelayed:l,delayDuration:r,onOpen:i.useCallback((()=>{window.clearTimeout(d.current),c(!1)}),[]),onClose:i.useCallback((()=>{window.clearTimeout(d.current),d.current=window.setTimeout((()=>c(!0)),o)}),[o]),isPointerInTransitRef:u,onPointerInTransitChange:i.useCallback((e=>{u.current=e}),[]),disableHoverableContent:a,children:s})};Y4.displayName=H4;var X4="Tooltip",[Z4,Q4]=V4(X4),J4=e=>{const{__scopeTooltip:n,children:r,open:o,defaultOpen:a=!1,onOpenChange:s,disableHoverableContent:l,delayDuration:c}=e,u=W4(X4,e.__scopeTooltip),d=z4(n),[p,f]=i.useState(null),h=EJ(),m=i.useRef(0),g=l??u.disableHoverableContent,v=c??u.delayDuration,y=i.useRef(!1),[b=!1,x]=BQ({prop:o,defaultProp:a,onChange:e=>{e?(u.onOpen(),document.dispatchEvent(new CustomEvent(G4))):u.onClose(),s?.(e)}}),w=i.useMemo((()=>b?y.current?"delayed-open":"instant-open":"closed"),[b]),_=i.useCallback((()=>{window.clearTimeout(m.current),m.current=0,y.current=!1,x(!0)}),[x]),S=i.useCallback((()=>{window.clearTimeout(m.current),m.current=0,x(!1)}),[x]),E=i.useCallback((()=>{window.clearTimeout(m.current),m.current=window.setTimeout((()=>{y.current=!0,x(!0),m.current=0}),v)}),[v,x]);return i.useEffect((()=>()=>{m.current&&(window.clearTimeout(m.current),m.current=0)}),[]),t.jsx(x1,{...d,children:t.jsx(Z4,{scope:n,contentId:h,open:b,stateAttribute:w,trigger:p,onTriggerChange:f,onTriggerEnter:i.useCallback((()=>{u.isOpenDelayed?E():_()}),[u.isOpenDelayed,E,_]),onTriggerLeave:i.useCallback((()=>{g?S():(window.clearTimeout(m.current),m.current=0)}),[S,g]),onOpen:_,onClose:S,disableHoverableContent:g,children:r})})};J4.displayName=X4;var e6="TooltipTrigger",t6=i.forwardRef(((e,n)=>{const{__scopeTooltip:r,...o}=e,a=Q4(e6,r),s=W4(e6,r),l=z4(r),c=XU(n,i.useRef(null),a.onTriggerChange),u=i.useRef(!1),d=i.useRef(!1),p=i.useCallback((()=>u.current=!1),[]);return i.useEffect((()=>()=>document.removeEventListener("pointerup",p)),[p]),t.jsx(w1,{asChild:!0,...l,children:t.jsx(WQ.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...o,ref:c,onPointerMove:FQ(e.onPointerMove,(e=>{"touch"!==e.pointerType&&(d.current||s.isPointerInTransitRef.current||(a.onTriggerEnter(),d.current=!0))})),onPointerLeave:FQ(e.onPointerLeave,(()=>{a.onTriggerLeave(),d.current=!1})),onPointerDown:FQ(e.onPointerDown,(()=>{u.current=!0,document.addEventListener("pointerup",p,{once:!0})})),onFocus:FQ(e.onFocus,(()=>{u.current||a.onOpen()})),onBlur:FQ(e.onBlur,a.onClose),onClick:FQ(e.onClick,a.onClose)})})}));t6.displayName=e6;var n6="TooltipPortal",[r6,o6]=V4(n6,{forceMount:void 0}),i6=e=>{const{__scopeTooltip:n,forceMount:r,children:o,container:i}=e,a=Q4(n6,n);return t.jsx(r6,{scope:n,forceMount:r,children:t.jsx(T1,{present:r||a.open,children:t.jsx(E1,{asChild:!0,container:i,children:o})})})};i6.displayName=n6;var a6="TooltipContent",s6=i.forwardRef(((e,n)=>{const r=o6(a6,e.__scopeTooltip),{forceMount:o=r.forceMount,side:i="top",...a}=e,s=Q4(a6,e.__scopeTooltip);return t.jsx(T1,{present:o||s.open,children:t.jsx(s.disableHoverableContent?d6:l6,{side:i,...a,ref:n})})})),l6=i.forwardRef(((e,n)=>{const r=Q4(a6,e.__scopeTooltip),o=W4(a6,e.__scopeTooltip),a=i.useRef(null),s=XU(n,a),[l,c]=i.useState(null),{trigger:u,onClose:d}=r,p=a.current,{onPointerInTransitChange:f}=o,h=i.useCallback((()=>{c(null),f(!1)}),[f]),m=i.useCallback(((e,t)=>{const n={x:e.clientX,y:e.clientY},r=function(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n})}return r}(n,function(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,o,i)){case i:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}(n,e.currentTarget.getBoundingClientRect())),o=function(e){const t=e.slice();return t.sort(((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:e.y>t.y?1:0)),function(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const n=e[r];for(;t.length>=2;){const e=t[t.length-1],r=t[t.length-2];if(!((e.x-r.x)*(n.y-r.y)>=(e.y-r.y)*(n.x-r.x)))break;t.pop()}t.push(n)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const t=e[r];for(;n.length>=2;){const e=n[n.length-1],r=n[n.length-2];if(!((e.x-r.x)*(t.y-r.y)>=(e.y-r.y)*(t.x-r.x)))break;n.pop()}n.push(t)}return n.pop(),1===t.length&&1===n.length&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}(t)}([...r,...function(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}(t.getBoundingClientRect())]);c(o),f(!0)}),[f]);return i.useEffect((()=>()=>h()),[h]),i.useEffect((()=>{if(u&&p){const e=e=>m(e,p),t=e=>m(e,u);return u.addEventListener("pointerleave",e),p.addEventListener("pointerleave",t),()=>{u.removeEventListener("pointerleave",e),p.removeEventListener("pointerleave",t)}}}),[u,p,m,h]),i.useEffect((()=>{if(l){const e=e=>{const t=e.target,n={x:e.clientX,y:e.clientY},r=u?.contains(t)||p?.contains(t),o=!function(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,a=t.length-1;i<t.length;a=i++){const e=t[i].x,s=t[i].y,l=t[a].y;s>r!=l>r&&n<(t[a].x-e)*(r-s)/(l-s)+e&&(o=!o)}return o}(n,l);r?h():o&&(h(),d())};return document.addEventListener("pointermove",e),()=>document.removeEventListener("pointermove",e)}}),[u,p,l,d,h]),t.jsx(d6,{...e,ref:s})})),[c6,u6]=V4(X4,{isInside:!1}),d6=i.forwardRef(((e,n)=>{const{__scopeTooltip:r,children:o,"aria-label":a,onEscapeKeyDown:s,onPointerDownOutside:l,...c}=e,u=Q4(a6,r),d=z4(r),{onClose:p}=u;return i.useEffect((()=>(document.addEventListener(G4,p),()=>document.removeEventListener(G4,p))),[p]),i.useEffect((()=>{if(u.trigger){const e=e=>{const t=e.target;t?.contains(u.trigger)&&p()};return window.addEventListener("scroll",e,{capture:!0}),()=>window.removeEventListener("scroll",e,{capture:!0})}}),[u.trigger,p]),t.jsx(D4,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:e=>e.preventDefault(),onDismiss:p,children:t.jsxs(_1,{"data-state":u.stateAttribute,...d,...c,ref:n,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[t.jsx(qQ,{children:o}),t.jsx(c6,{scope:r,isInside:!0,children:t.jsx($4,{id:u.contentId,role:"tooltip",children:a||o})})]})})}));s6.displayName=a6;var p6="TooltipArrow";i.forwardRef(((e,n)=>{const{__scopeTooltip:r,...o}=e,i=z4(r);return u6(p6,r).isInside?null:t.jsx(S1,{...i,...o,ref:n})})).displayName=p6;var f6=i6,h6=s6;const m6=Y4,g6=J4,v6=t6,y6=i.forwardRef((({className:e,sideOffset:n=4,...r},o)=>t.jsx(f6,{children:t.jsx(h6,{ref:o,sideOffset:n,className:Zd("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})})));y6.displayName=h6.displayName;const b6=({rowOriginal:e,constructNavigationUrl:n,cellText:r,cellIcon:o=null,tooltipIcon:i=null,tooltipText:a=null})=>{const s=q5();return a?t.jsx(m6,{children:t.jsx("div",{className:"text-sm h-8 flex items-center justify-end",children:t.jsxs(g6,{children:[t.jsx(v6,{asChild:!0,children:t.jsxs(vZ,{variant:"outline",onClick:()=>s(n(e.id)),children:[o,r,i]})}),t.jsx(y6,{className:"max-w-[300px] text-sm bg-white border border-gray-200 rounded-lg p-4",children:t.jsx("p",{className:"text-muted-foreground",children:a})})]})})}):t.jsx("div",{className:"text-sm h-8 flex items-center justify-end",children:t.jsxs(vZ,{variant:"outline",onClick:()=>s(n(e.id)),children:[o,r,i]})})};var x6,w6="dismissableLayer.update",_6="dismissableLayer.pointerDownOutside",S6="dismissableLayer.focusOutside",E6=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),T6=i.forwardRef(((e,n)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:s,onInteractOutside:l,onDismiss:c,...u}=e,d=i.useContext(E6),[p,f]=i.useState(null),h=p?.ownerDocument??globalThis?.document,[,m]=i.useState({}),g=XU(n,(e=>f(e))),v=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=v.indexOf(y),x=p?v.indexOf(p):-1,w=d.layersWithOutsidePointerEventsDisabled.size>0,_=x>=b,S=function(e,t=globalThis?.document){const n=VQ(e),r=i.useRef(!1),o=i.useRef((()=>{}));return i.useEffect((()=>{const e=e=>{if(e.target&&!r.current){let r=function(){A6(_6,n,i,{discrete:!0})};const i={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",o.current),o.current=r,t.addEventListener("click",o.current,{once:!0})):r()}else t.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout((()=>{t.addEventListener("pointerdown",e)}),0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",e),t.removeEventListener("click",o.current)}}),[t,n]),{onPointerDownCapture:()=>r.current=!0}}((e=>{const t=e.target,n=[...d.branches].some((e=>e.contains(t)));_&&!n&&(a?.(e),l?.(e),e.defaultPrevented||c?.())}),h),E=function(e,t=globalThis?.document){const n=VQ(e),r=i.useRef(!1);return i.useEffect((()=>{const e=e=>{if(e.target&&!r.current){A6(S6,n,{originalEvent:e},{discrete:!1})}};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)}),[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}((e=>{const t=e.target;[...d.branches].some((e=>e.contains(t)))||(s?.(e),l?.(e),e.defaultPrevented||c?.())}),h);return JQ((e=>{x===d.layers.size-1&&(o?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))}),h),i.useEffect((()=>{if(p)return r&&(0===d.layersWithOutsidePointerEventsDisabled.size&&(x6=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(p)),d.layers.add(p),C6(),()=>{r&&1===d.layersWithOutsidePointerEventsDisabled.size&&(h.body.style.pointerEvents=x6)}}),[p,h,r,d]),i.useEffect((()=>()=>{p&&(d.layers.delete(p),d.layersWithOutsidePointerEventsDisabled.delete(p),C6())}),[p,d]),i.useEffect((()=>{const e=()=>m({});return document.addEventListener(w6,e),()=>document.removeEventListener(w6,e)}),[]),t.jsx(WQ.div,{...u,ref:g,style:{pointerEvents:w?_?"auto":"none":void 0,...e.style},onFocusCapture:FQ(e.onFocusCapture,E.onFocusCapture),onBlurCapture:FQ(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:FQ(e.onPointerDownCapture,S.onPointerDownCapture)})}));T6.displayName="DismissableLayer";function C6(){const e=new CustomEvent(w6);document.dispatchEvent(e)}function A6(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?YQ(o,i):o.dispatchEvent(i)}i.forwardRef(((e,n)=>{const r=i.useContext(E6),o=i.useRef(null),a=XU(n,o);return i.useEffect((()=>{const e=o.current;if(e)return r.branches.add(e),()=>{r.branches.delete(e)}}),[r.branches]),t.jsx(WQ.div,{...e,ref:a})})).displayName="DismissableLayerBranch";var N6="Popover",[R6,O6]=UQ(N6,[o1]),P6=o1(),[k6,M6]=R6(N6),j6=e=>{const{__scopePopover:n,children:r,open:o,defaultOpen:a,onOpenChange:s,modal:l=!1}=e,c=P6(n),u=i.useRef(null),[d,p]=i.useState(!1),[f=!1,h]=BQ({prop:o,defaultProp:a,onChange:s});return t.jsx(x1,{...c,children:t.jsx(k6,{scope:n,contentId:EJ(),triggerRef:u,open:f,onOpenChange:h,onOpenToggle:i.useCallback((()=>h((e=>!e))),[h]),hasCustomAnchor:d,onCustomAnchorAdd:i.useCallback((()=>p(!0)),[]),onCustomAnchorRemove:i.useCallback((()=>p(!1)),[]),modal:l,children:r})})};j6.displayName=N6;var L6="PopoverAnchor";i.forwardRef(((e,n)=>{const{__scopePopover:r,...o}=e,a=M6(L6,r),s=P6(r),{onCustomAnchorAdd:l,onCustomAnchorRemove:c}=a;return i.useEffect((()=>(l(),()=>c())),[l,c]),t.jsx(w1,{...s,...o,ref:n})})).displayName=L6;var D6="PopoverTrigger",I6=i.forwardRef(((e,n)=>{const{__scopePopover:r,...o}=e,i=M6(D6,r),a=P6(r),s=XU(n,i.triggerRef),l=t.jsx(WQ.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":W6(i.open),...o,ref:s,onClick:FQ(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?l:t.jsx(w1,{asChild:!0,...a,children:l})}));I6.displayName=D6;var F6="PopoverPortal",[U6,$6]=R6(F6,{forceMount:void 0}),V6=e=>{const{__scopePopover:n,forceMount:r,children:o,container:i}=e,a=M6(F6,n);return t.jsx(U6,{scope:n,forceMount:r,children:t.jsx(T1,{present:r||a.open,children:t.jsx(E1,{asChild:!0,container:i,children:o})})})};V6.displayName=F6;var B6="PopoverContent",z6=i.forwardRef(((e,n)=>{const r=$6(B6,e.__scopePopover),{forceMount:o=r.forceMount,...i}=e,a=M6(B6,e.__scopePopover);return t.jsx(T1,{present:o||a.open,children:t.jsx(a.modal?H6:q6,{...i,ref:n})})}));z6.displayName=B6;var H6=i.forwardRef(((e,n)=>{const r=M6(B6,e.__scopePopover),o=i.useRef(null),a=XU(n,o),s=i.useRef(!1);return i.useEffect((()=>{const e=o.current;if(e)return LV(e)}),[]),t.jsx(NV,{as:zQ,allowPinchZoom:!0,children:t.jsx(G6,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:FQ(e.onCloseAutoFocus,(e=>{e.preventDefault(),s.current||r.triggerRef.current?.focus()})),onPointerDownOutside:FQ(e.onPointerDownOutside,(e=>{const t=e.detail.originalEvent;s.current=2===t.button||0===t.button&&!0===t.ctrlKey}),{checkForDefaultPrevented:!1}),onFocusOutside:FQ(e.onFocusOutside,(e=>e.preventDefault()),{checkForDefaultPrevented:!1})})})})),q6=i.forwardRef(((e,n)=>{const r=M6(B6,e.__scopePopover),o=i.useRef(!1),a=i.useRef(!1);return t.jsx(G6,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(o.current||r.triggerRef.current?.focus(),t.preventDefault()),o.current=!1,a.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(o.current=!0,"pointerdown"===t.detail.originalEvent.type&&(a.current=!0));const n=t.target,i=r.triggerRef.current?.contains(n);i&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&a.current&&t.preventDefault()}})})),G6=i.forwardRef(((e,n)=>{const{__scopePopover:r,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onInteractOutside:d,...p}=e,f=M6(B6,r),h=P6(r);return cJ(),t.jsx(hJ,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:i,onUnmountAutoFocus:a,children:t.jsx(T6,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:d,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onDismiss:()=>f.onOpenChange(!1),children:t.jsx(_1,{"data-state":W6(f.open),role:"dialog",id:f.contentId,...h,...p,ref:n,style:{...p.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})})),K6="PopoverClose";i.forwardRef(((e,n)=>{const{__scopePopover:r,...o}=e,i=M6(K6,r);return t.jsx(WQ.button,{type:"button",...o,ref:n,onClick:FQ(e.onClick,(()=>i.onOpenChange(!1)))})})).displayName=K6;function W6(e){return e?"open":"closed"}i.forwardRef(((e,n)=>{const{__scopePopover:r,...o}=e,i=P6(r);return t.jsx(S1,{...i,...o,ref:n})})).displayName="PopoverArrow";var Y6=V6,X6=z6;const Z6=j6,Q6=I6,J6=n.forwardRef((({className:e,align:n="center",sideOffset:r=4,...o},i)=>t.jsx(Y6,{children:t.jsx(X6,{ref:i,align:n,sideOffset:r,className:Zd("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...o})})));J6.displayName=X6.displayName;const e8={[Ve.DRAFT]:"Draft",[Ve.ACTIVE]:"Active",[Ve.RUNNING]:"Running",[Ve.COMPLETED]:"Completed",[Ve.FAILED]:"Failed",[Ve.DEACTIVATED]:"Deactivated"},t8={[Ve.DRAFT]:"bg-gray-500",[Ve.ACTIVE]:"bg-blue-500",[Ve.RUNNING]:"bg-yellow-500",[Ve.COMPLETED]:"bg-green-500",[Ve.FAILED]:"bg-red-500",[Ve.DEACTIVATED]:"bg-red-500"},n8={[Ve.DRAFT]:"bg-gray-100 text-gray-700 px-2 py-1",[Ve.ACTIVE]:"bg-blue-100 text-blue-700 px-2 py-1",[Ve.RUNNING]:"bg-yellow-100 text-yellow-700 px-2 py-1",[Ve.COMPLETED]:"bg-green-100 text-green-700 px-2 py-1",[Ve.FAILED]:"bg-red-100 text-red-700 px-2 py-1",[Ve.DEACTIVATED]:"bg-red-100 text-red-700 px-2 py-1"},r8={[Ve.DRAFT]:`Draft ${ff("engage:automation")?.toLowerCase()} can be activated or deactivated`,[Ve.ACTIVE]:`Active ${ff("engage:automation")?.toLowerCase()} can be drafted, deactivated, run, or marked as failed`,[Ve.RUNNING]:`Running ${ff("engage:automation")?.toLowerCase()} can be completed or marked as failed`,[Ve.COMPLETED]:`Completed ${ff("engage:automation")?.toLowerCase()} can only be marked as failed`,[Ve.FAILED]:`Failed ${ff("engage:automation")?.toLowerCase()} requires manual intervention to change state`,[Ve.DEACTIVATED]:`Deactivated ${ff("engage:automation")?.toLowerCase()} cannot be reactivated - create a new one instead`},o8={[Ve.DRAFT]:[Ve.ACTIVE,Ve.DEACTIVATED],[Ve.ACTIVE]:[Ve.DRAFT],[Ve.RUNNING]:[],[Ve.COMPLETED]:[],[Ve.FAILED]:[],[Ve.DEACTIVATED]:[]},i8=({rowOriginal:e,id:r,onToggle:o,className:i="",vsaasManaged:a=!1})=>{const[s,l]=n.useState(!1),c=e.status,u=(o8[c]||[]).filter((e=>!1===a||e!==Ve.DEACTIVATED)),d=u.length>0;return t.jsx("div",{className:`${i}`,onClick:e=>e.stopPropagation(),children:t.jsx(m6,{children:t.jsxs(Z6,{open:!!d&&s,onOpenChange:l,children:[t.jsx(Q6,{asChild:!0,children:t.jsx("div",{className:"relative",children:t.jsxs(vZ,{variant:"outline",className:`flex items-center justify-between px-4 py-2 rounded-md w-full ${n8[c]} ${d?"":"cursor-not-allowed opacity-80"}`,onClick:e=>{e.stopPropagation(),d&&l(!s)},children:[t.jsxs("div",{className:"flex items-center",children:[t.jsx("div",{className:`w-2 h-2 rounded-full mr-2 ${t8[c]}`}),t.jsx("span",{children:e8[c]})]}),d?t.jsx(fu,{className:"h-4 w-4 ml-2"}):t.jsxs(g6,{children:[t.jsx(v6,{asChild:!0,children:t.jsx(Cu,{className:"h-4 w-4 ml-2 text-gray-500"})}),t.jsx(y6,{className:"max-w-xs p-2",children:t.jsx("p",{children:r8[c]})})]})]})})}),d&&t.jsx(J6,{className:"w-full p-2",align:"center",sideOffset:5,children:t.jsx("div",{className:"py-1 flex flex-col gap-2 justify-start items-center",onClick:e=>e.stopPropagation(),children:u.map((e=>t.jsxs(vZ,{variant:"ghost",className:"flex justify-start items-center px-4 py-2 text-sm w-full text-left hover:bg-gray-100 rounded-none "+(c===e?"font-medium":""),onClick:()=>(o(r,e),void l(!1)),children:[t.jsx("div",{className:`w-2 h-2 rounded-full ${t8[e]} mr-2`}),e8[e]]},e)))})})]})})})};function a8(e){const t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new e.constructor(+e):"number"==typeof e||"[object Number]"===t||"string"==typeof e||"[object String]"===t?new Date(e):new Date(NaN)}function s8(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}const l8=6048e5,c8=43200;let u8={};function d8(){return u8}function p8(e,t){const n=d8(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,o=a8(e),i=o.getDay(),a=(i<r?7:0)+i-r;return o.setDate(o.getDate()-a),o.setHours(0,0,0,0),o}function f8(e){return p8(e,{weekStartsOn:1})}function h8(e){const t=a8(e),n=t.getFullYear(),r=s8(e,0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);const o=f8(r),i=s8(e,0);i.setFullYear(n,0,4),i.setHours(0,0,0,0);const a=f8(i);return t.getTime()>=o.getTime()?n+1:t.getTime()>=a.getTime()?n:n-1}function m8(e){const t=a8(e);return t.setHours(0,0,0,0),t}function g8(e){const t=a8(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function v8(e,t){return function(e,t){return s8(e,+a8(e)+t)}(e,6e4*t)}function y8(e,t){const n=a8(e),r=a8(t),o=n.getTime()-r.getTime();return o<0?-1:o>0?1:o}function b8(e){if(!(t=e,t instanceof Date||"object"==typeof t&&"[object Date]"===Object.prototype.toString.call(t)||"number"==typeof e))return!1;var t;const n=a8(e);return!isNaN(Number(n))}function x8(e){const t=a8(e);return+function(e){const t=a8(e);return t.setHours(23,59,59,999),t}(t)==+function(e){const t=a8(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}(t)}function w8(e,t){const n=a8(e),r=a8(t),o=y8(n,r),i=Math.abs(function(e,t){const n=a8(e),r=a8(t);return 12*(n.getFullYear()-r.getFullYear())+(n.getMonth()-r.getMonth())}(n,r));let a;if(i<1)a=0;else{1===n.getMonth()&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-o*i);let t=y8(n,r)===-o;x8(a8(e))&&1===i&&1===y8(e,r)&&(t=!1),a=o*(i-Number(t))}return 0===a?0:a}function _8(e,t,n){const r=function(e,t){return+a8(e)-+a8(t)}(e,t)/1e3;return(o=n?.roundingMethod,e=>{const t=(o?Math[o]:Math.trunc)(e);return 0===t?0:t})(r);var o}const S8={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function E8(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const T8={date:E8({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:E8({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:E8({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},C8={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function A8(e){return(t,n)=>{let r;if("formatting"===(n?.context?String(n.context):"standalone")&&e.formattingValues){const t=e.defaultFormattingWidth||e.defaultWidth,o=n?.width?String(n.width):t;r=e.formattingValues[o]||e.formattingValues[t]}else{const t=e.defaultWidth,o=n?.width?String(n.width):e.defaultWidth;r=e.values[o]||e.values[t]}return r[e.argumentCallback?e.argumentCallback(t):t]}}function N8(e){return(t,n={})=>{const r=n.width,o=t.match(r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth]);if(!o)return null;const i=o[0],a=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],s=Array.isArray(a)?function(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n;return}(a,(e=>e.test(i))):function(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n;return}(a,(e=>e.test(i)));let l;l=e.valueCallback?e.valueCallback(s):s,l=n.valueCallback?n.valueCallback(l):l;return{value:l,rest:t.slice(i.length)}}}var R8;const O8={code:"en-US",formatDistance:(e,t,n)=>{let r;const o=S8[e];return r="string"==typeof o?o:1===t?o.one:o.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r},formatLong:T8,formatRelative:(e,t,n,r)=>C8[e],localize:{ordinalNumber:(e,t)=>{const n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:A8({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:A8({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:A8({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:A8({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:A8({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(R8={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)},(e,t={})=>{const n=e.match(R8.matchPattern);if(!n)return null;const r=n[0],o=e.match(R8.parsePattern);if(!o)return null;let i=R8.valueCallback?R8.valueCallback(o[0]):o[0];return i=t.valueCallback?t.valueCallback(i):i,{value:i,rest:e.slice(r.length)}}),era:N8({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:N8({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:N8({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:N8({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:N8({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function P8(e){const t=a8(e),n=function(e,t){const n=m8(e),r=m8(t),o=+n-g8(n),i=+r-g8(r);return Math.round((o-i)/864e5)}(t,function(e){const t=a8(e),n=s8(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}(t));return n+1}function k8(e){const t=a8(e),n=+f8(t)-+function(e){const t=h8(e),n=s8(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),f8(n)}(t);return Math.round(n/l8)+1}function M8(e,t){const n=a8(e),r=n.getFullYear(),o=d8(),i=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??o.firstWeekContainsDate??o.locale?.options?.firstWeekContainsDate??1,a=s8(e,0);a.setFullYear(r+1,0,i),a.setHours(0,0,0,0);const s=p8(a,t),l=s8(e,0);l.setFullYear(r,0,i),l.setHours(0,0,0,0);const c=p8(l,t);return n.getTime()>=s.getTime()?r+1:n.getTime()>=c.getTime()?r:r-1}function j8(e,t){const n=a8(e),r=+p8(n,t)-+function(e,t){const n=d8(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,o=M8(e,t),i=s8(e,0);return i.setFullYear(o,0,r),i.setHours(0,0,0,0),p8(i,t)}(n,t);return Math.round(r/l8)+1}function L8(e,t){return(e<0?"-":"")+Math.abs(e).toString().padStart(t,"0")}const D8={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return L8("yy"===t?r%100:r,t.length)},M(e,t){const n=e.getMonth();return"M"===t?String(n+1):L8(n+1,2)},d:(e,t)=>L8(e.getDate(),t.length),a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return"am"===n?"a.m.":"p.m."}},h:(e,t)=>L8(e.getHours()%12||12,t.length),H:(e,t)=>L8(e.getHours(),t.length),m:(e,t)=>L8(e.getMinutes(),t.length),s:(e,t)=>L8(e.getSeconds(),t.length),S(e,t){const n=t.length,r=e.getMilliseconds();return L8(Math.trunc(r*Math.pow(10,n-3)),t.length)}},I8="midnight",F8="noon",U8="morning",$8="afternoon",V8="evening",B8="night",z8={G:function(e,t,n){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if("yo"===t){const t=e.getFullYear();return n.ordinalNumber(t>0?t:1-t,{unit:"year"})}return D8.y(e,t)},Y:function(e,t,n,r){const o=M8(e,r),i=o>0?o:1-o;if("YY"===t){return L8(i%100,2)}return"Yo"===t?n.ordinalNumber(i,{unit:"year"}):L8(i,t.length)},R:function(e,t){return L8(h8(e),t.length)},u:function(e,t){return L8(e.getFullYear(),t.length)},Q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return L8(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return L8(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){const r=e.getMonth();switch(t){case"M":case"MM":return D8.M(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return L8(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){const o=j8(e,r);return"wo"===t?n.ordinalNumber(o,{unit:"week"}):L8(o,t.length)},I:function(e,t,n){const r=k8(e);return"Io"===t?n.ordinalNumber(r,{unit:"week"}):L8(r,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getDate(),{unit:"date"}):D8.d(e,t)},D:function(e,t,n){const r=P8(e);return"Do"===t?n.ordinalNumber(r,{unit:"dayOfYear"}):L8(r,t.length)},E:function(e,t,n){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){const o=e.getDay(),i=(o-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return L8(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(o,{width:"short",context:"formatting"});default:return n.day(o,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){const o=e.getDay(),i=(o-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return L8(i,t.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(o,{width:"narrow",context:"standalone"});case"cccccc":return n.day(o,{width:"short",context:"standalone"});default:return n.day(o,{width:"wide",context:"standalone"})}},i:function(e,t,n){const r=e.getDay(),o=0===r?7:r;switch(t){case"i":return String(o);case"ii":return L8(o,t.length);case"io":return n.ordinalNumber(o,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){const r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(e,t,n){const r=e.getHours();let o;switch(o=12===r?F8:0===r?I8:r/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(o,{width:"narrow",context:"formatting"});default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(e,t,n){const r=e.getHours();let o;switch(o=r>=17?V8:r>=12?$8:r>=4?U8:B8,t){case"B":case"BB":case"BBB":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(o,{width:"narrow",context:"formatting"});default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){let t=e.getHours()%12;return 0===t&&(t=12),n.ordinalNumber(t,{unit:"hour"})}return D8.h(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getHours(),{unit:"hour"}):D8.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return"Ko"===t?n.ordinalNumber(r,{unit:"hour"}):L8(r,t.length)},k:function(e,t,n){let r=e.getHours();return 0===r&&(r=24),"ko"===t?n.ordinalNumber(r,{unit:"hour"}):L8(r,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):D8.m(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getSeconds(),{unit:"second"}):D8.s(e,t)},S:function(e,t){return D8.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(0===r)return"Z";switch(t){case"X":return q8(r);case"XXXX":case"XX":return G8(r);default:return G8(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return q8(r);case"xxxx":case"xx":return G8(r);default:return G8(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+H8(r,":");default:return"GMT"+G8(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+H8(r,":");default:return"GMT"+G8(r,":")}},t:function(e,t,n){return L8(Math.trunc(e.getTime()/1e3),t.length)},T:function(e,t,n){return L8(e.getTime(),t.length)}};function H8(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),o=Math.trunc(r/60),i=r%60;return 0===i?n+String(o):n+String(o)+t+L8(i,2)}function q8(e,t){if(e%60==0){return(e>0?"-":"+")+L8(Math.abs(e)/60,2)}return G8(e,t)}function G8(e,t=""){const n=e>0?"-":"+",r=Math.abs(e);return n+L8(Math.trunc(r/60),2)+t+L8(r%60,2)}const K8=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},W8=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},Y8={p:W8,P:(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],o=n[2];if(!o)return K8(e,t);let i;switch(r){case"P":i=t.dateTime({width:"short"});break;case"PP":i=t.dateTime({width:"medium"});break;case"PPP":i=t.dateTime({width:"long"});break;default:i=t.dateTime({width:"full"})}return i.replace("{{date}}",K8(r,t)).replace("{{time}}",W8(o,t))}},X8=/^D+$/,Z8=/^Y+$/,Q8=["D","DD","YY","YYYY"];const J8=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,e9=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,t9=/^'([^]*?)'?$/,n9=/''/g,r9=/[a-zA-Z]/;function o9(e,t,n){const r=d8(),o=r.locale??O8,i=r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,a=r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=a8(e);if(!b8(s))throw new RangeError("Invalid time value");let l=t.match(e9).map((e=>{const t=e[0];if("p"===t||"P"===t){return(0,Y8[t])(e,o.formatLong)}return e})).join("").match(J8).map((e=>{if("''"===e)return{isToken:!1,value:"'"};const t=e[0];if("'"===t)return{isToken:!1,value:i9(e)};if(z8[t])return{isToken:!0,value:e};if(t.match(r9))throw new RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}}));o.localize.preprocessor&&(l=o.localize.preprocessor(s,l));const c={firstWeekContainsDate:i,weekStartsOn:a,locale:o};return l.map((n=>{if(!n.isToken)return n.value;const r=n.value;(function(e){return Z8.test(e)}(r)||function(e){return X8.test(e)}(r))&&function(e,t,n){const r=function(e,t,n){const r="Y"===e[0]?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}(e,t,n);if(Q8.includes(e))throw new RangeError(r)}(r,t,String(e));return(0,z8[r[0]])(s,r,o.localize,c)})).join("")}function i9(e){const t=e.match(t9);return t?t[1].replace(n9,"'"):e}function a9(e,t){return function(e,t,n){const r=d8(),o=n?.locale??r.locale??O8,i=y8(e,t);if(isNaN(i))throw new RangeError("Invalid time value");const a=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:i});let s,l;i>0?(s=a8(t),l=a8(e)):(s=a8(e),l=a8(t));const c=_8(l,s),u=(g8(l)-g8(s))/1e3,d=Math.round((c-u)/60);let p;if(d<2)return n?.includeSeconds?c<5?o.formatDistance("lessThanXSeconds",5,a):c<10?o.formatDistance("lessThanXSeconds",10,a):c<20?o.formatDistance("lessThanXSeconds",20,a):c<40?o.formatDistance("halfAMinute",0,a):o.formatDistance(c<60?"lessThanXMinutes":"xMinutes",1,a):0===d?o.formatDistance("lessThanXMinutes",1,a):o.formatDistance("xMinutes",d,a);if(d<45)return o.formatDistance("xMinutes",d,a);if(d<90)return o.formatDistance("aboutXHours",1,a);if(d<1440){const e=Math.round(d/60);return o.formatDistance("aboutXHours",e,a)}if(d<2520)return o.formatDistance("xDays",1,a);if(d<c8){const e=Math.round(d/1440);return o.formatDistance("xDays",e,a)}if(d<86400)return p=Math.round(d/c8),o.formatDistance("aboutXMonths",p,a);if(p=w8(l,s),p<12){const e=Math.round(d/c8);return o.formatDistance("xMonths",e,a)}{const e=p%12,t=Math.trunc(p/12);return e<3?o.formatDistance("aboutXYears",t,a):e<9?o.formatDistance("overXYears",t,a):o.formatDistance("almostXYears",t+1,a)}}(e,function(e){return s8(e,Date.now())}(e),t)}function s9({accessorKey:e,header:n,meta:r,size:o,minSize:i,maxSize:a,enableSorting:s=!0,enableHiding:l=!0,headerClassName:c,cellClassName:u,cellFormatter:d}){return{accessorKey:e,header:()=>t.jsx("div",{className:`flex items-center h-8 px-3 font-medium whitespace-nowrap text-muted-foreground ${"right"===r?.align?"justify-end float-right":"center"===r?.align?"justify-center":"justify-start"} ${c||""}`.trim(),children:"function"==typeof n?n():t.jsx("span",{children:n})}),cell:e=>t.jsx("div",{className:`flex items-center h-8 ${"right"===r?.align?"justify-end":"center"===r?.align?"justify-center":"justify-start"} ${u||""} ${r?.className||""}`.trim(),children:d?d(e):e.getValue()}),size:o,minSize:i,maxSize:a,enableSorting:s,enableHiding:l,meta:r}}const l9=(e,t,n,r="Error",o="Please try again")=>{e(!1),"error"===n&&t({title:r,description:o,variant:"destructive"})},c9=e=>{switch(e){case Ve.ACTIVE:return"statusActive";case Ve.COMPLETED:return"statusCompleted";case Ve.DRAFT:return"statusDraft";case Ve.DEACTIVATED:return"statusDeactivated";case Ve.FAILED:return"statusFailed";case Ve.RUNNING:return"statusRunning";default:throw LX(e,Ve)}},u9=e=>{switch(e){case rZ.ALL_USERS:return`Default ${ff("engage:segment").toLowerCase()} that contains all ${ff("engage:user").toLowerCase()}}. This is not editable or deletable.`;case rZ.MANAGED:return`System-defined ${ff("engage:segment").toLowerCase()} that are not editable or deletable.`;case rZ.CUSTOM:return`Custom ${ff("engage:segment").toLowerCase()} that you can edit and delete as needed.`;default:throw LX(e,rZ)}};function d9(e="name",n,r=!1){return s9({accessorKey:e,header:n,meta:{align:"left",displayName:n,className:"min-w-[240px] w-full"},cellClassName:"pl-3 pr-2",cellFormatter:e=>{const n=e.getValue(),{original:o}=e.row,i=o.status,a=o.type,s=i?i[0].toUpperCase()+i.slice(1):"",l={[Ve.ACTIVE]:"bg-blue-500",[Ve.COMPLETED]:"bg-green-500",[Ve.DRAFT]:"bg-gray-500",[Ve.DEACTIVATED]:"bg-red-500",[Ve.FAILED]:"bg-red-500",[Ve.RUNNING]:"bg-yellow-500"};return t.jsxs("div",{className:"w-full flex gap-6 justify-between items-center",children:[t.jsxs("div",{className:"flex gap-1 items-center w-full",children:[t.jsx("div",{className:`w-2 h-2 rounded-full mr-3 flex-shrink-0 ${a?{[rZ.ALL_USERS]:"bg-purple-500",[rZ.MANAGED]:"bg-teal-500",[rZ.CUSTOM]:"bg-amber-500"}[a]:i?l[i]:"bg-blue-500"}`}),t.jsxs("div",{className:"flex-1 flex flex-col gap-0.5",children:[t.jsx("span",{className:"leading-tight font-medium text-sm overflow-hidden text-ellipsis",children:n}),r&&o?.description&&t.jsx("div",{className:"relative h-4",children:t.jsx("div",{className:"absolute inset-0 text-muted-foreground text-xs truncate whitespace-nowrap overflow-hidden w-full",children:o?.description})})]})]}),i&&t.jsx("div",{className:"flex-shrink-0",children:t.jsx(kZ,{variant:c9(i),children:s})})]})}})}function p9(){return s9({accessorKey:"type",header:"Type",meta:{align:"right",displayName:`${ff("engage:segment")} type`},cellClassName:"pr-4",cellFormatter:e=>{const n=e.getValue(),r=n?n.split("_").map((e=>e[0].toUpperCase()+e.slice(1).toLowerCase())).join(" "):"Unknown";let o;if(!n||n!==rZ.ALL_USERS&&n!==rZ.MANAGED&&n!==rZ.CUSTOM)o="statusDraft";else try{o=(e=>{switch(e){case rZ.ALL_USERS:return"segmentAllUsers";case rZ.MANAGED:return"segmentManaged";case rZ.CUSTOM:return"segmentCustom";default:throw LX(e,rZ)}})(n)}catch(JSe){if(!(JSe instanceof LX))throw JSe;o="statusDraft"}return t.jsx(m6,{children:t.jsxs(g6,{children:[t.jsx(v6,{asChild:!0,children:t.jsx(kZ,{variant:o,className:"cursor-help",children:r})}),t.jsx(y6,{side:"top",className:"max-w-[250px] text-sm bg-white border border-gray-200 rounded-lg p-3",children:t.jsx("p",{className:"text-muted-foreground",children:n&&u9(n)||`Unknown ${ff("engage:segment").toLowerCase()} type`})})]})})}})}function f9(e="updated_at"){return function({accessorKey:e,header:n,meta:r={align:"right"},size:o=160,minSize:i,maxSize:a,enableSorting:s=!0,enableHiding:l=!0,headerClassName:c,cellClassName:u,formatType:d="relative"}){return{accessorKey:e,header:()=>t.jsx("div",{className:`float-right h-8 flex items-center justify-end px-3 font-medium whitespace-nowrap text-muted-foreground ${c||""}`.trim(),children:t.jsx("span",{children:n})}),cell:e=>{const n=e.getValue();let o="N/A";return n&&(o="relative"===d?a9(new Date(n),{addSuffix:!0}):new Date(n).toLocaleDateString()),t.jsx("div",{className:`font-variant-numeric w-full h-8 flex items-center justify-end pr-4 whitespace-nowrap ${u||""} ${r?.className||""}`.trim(),children:o})},size:o,minSize:i,maxSize:a,enableSorting:s,enableHiding:l,meta:r}}({accessorKey:e,header:"Last Modified",formatType:"relative",size:160,meta:{align:"right",displayName:"Last Modified"}})}function h9(e,n,r){return function({accessorKey:e,header:n,meta:r={align:"right"},size:o,minSize:i,maxSize:a=120,enableSorting:s=!0,enableHiding:l=!0,headerClassName:c,cellClassName:u,prefix:d="",suffix:p="",localeStringOptions:f}){return{accessorKey:e,header:()=>t.jsx("div",{className:`float-right h-8 flex items-center justify-end px-3 font-medium whitespace-nowrap text-muted-foreground ${c||""}`.trim(),children:"function"==typeof n?n():t.jsx("span",{children:n})}),cell:e=>{const n=e.getValue()??0;return t.jsxs("div",{className:`font-variant-numeric h-8 flex items-center justify-end pr-4 ${u||""} ${r?.className||""}`.trim(),children:[d,n.toLocaleString(void 0,f),p]})},size:o||(r?.className?.includes("w-")?void 0:100),minSize:i,maxSize:a,enableSorting:s,enableHiding:l,meta:r}}({accessorKey:e,header:n,prefix:r,meta:{align:"right",displayName:n}})}function m9(e){const{setUrl:n,onToggle:r,automationName:o,vsaasManaged:i}=e;return s9({accessorKey:"status",header:"Status",enableHiding:!1,size:180,maxSize:200,meta:{align:"right"},cellClassName:"pr-4",cellFormatter:e=>{const{original:a}=e.row;return(a.status??null)===Ve.DRAFT&&n&&!1===i?t.jsx(b6,{rowOriginal:a,constructNavigationUrl:()=>n(a.id),cellText:"Action Required",tooltipIcon:t.jsx(Cu,{className:"h-4 w-4 text-muted-foreground !cursor-help z-99"}),tooltipText:`Your ${o?.toLowerCase()} is currently in draft mode. Please review and activate it to begin sending messages.`}):t.jsx(i8,{className:"flex items-center justify-end",rowOriginal:a,id:a.id,onToggle:r||(()=>{}),vsaasManaged:i})}})}function g9(e){const n={align:"right",displayName:`Update ${ff("engage:segment").toLowerCase()}`};return function({id:e="actions",header:n,meta:r={align:"center"},text:o,size:i=80,minSize:a=80,maxSize:s=80,enableSorting:l=!1,enableHiding:c=!1,headerClassName:u,icon:d,onAction:p,actionButtonVariant:f="outline",actionButtonSize:h="default"}){return{id:e,header:()=>t.jsx("div",{className:`float-right h-8 flex items-center justify-end px-3 font-medium whitespace-nowrap text-muted-foreground ${u||""}`.trim(),children:"function"==typeof n?n():t.jsx("span",{children:n})}),cell:e=>{const n=e.row.original,i=n?.type,a="custom"!==i;return t.jsx("div",{className:`flex items-center h-8 pr-3 ${"right"===r?.align?"justify-end":"center"===r?.align?"justify-center":"justify-start"} ${r?.className||""}`.trim(),children:t.jsxs(vZ,{variant:f,size:h,disabled:a,onClick:()=>p(n),children:[t.jsx(d,{className:"h-4 w-4"}),t.jsx("span",{children:o})]})})},size:i,minSize:a,maxSize:s,enableSorting:l,enableHiding:c,meta:r}}({id:"edit",header:`${ff("engage:segment")} actions`,icon:Uu,onAction:t=>{e(t.id)},text:"Edit",enableHiding:!1,size:80,meta:n})}function v9(e){const{automationName:t,setUrl:n,onToggle:r,vsaasManaged:o=!1}=e;return[d9("name","Name",!0),h9("derivedRevenue","Sales","$"),h9("emailsSent","Email Sent"),h9("smsSent","SMS Sent"),f9(),m9({setUrl:n,onToggle:r,automationName:t,vsaasManaged:o})]}const y9=({handleBack:e,handleNext:n,handleSkipAndSaveAsDraft:r,backText:o,nextText:i,backDisabled:a,nextDisabled:s,hideBack:l})=>t.jsxs("div",{className:"flex gap-4 py-2",children:[!l&&t.jsxs(vZ,{onClick:e,disabled:a,variant:"secondary",className:Zd("flex items-center gap-2",a&&"opacity-50 cursor-not-allowed"),children:[t.jsx(wZ.BackButton,{}),t.jsx("span",{children:o})]}),t.jsx(vZ,{onClick:r,variant:"secondary",className:"flex items-center gap-2",children:"Skip & Save as Draft"}),t.jsxs(vZ,{onClick:n,disabled:s,className:Zd("flex items-center gap-2 --reach-destructive",s&&"opacity-50 cursor-not-allowed"),children:[t.jsx("span",{children:i}),t.jsx(wZ.NextButton,{})]})]}),b9=()=>{const e=ve({queryKey:["channel-accounts"],queryFn:()=>(async()=>(await Re("/channel/accounts",{method:"GET"})).data)()});return{channelAccounts:e.data,isFetching:e.isFetching,isLoading:e.isLoading,fetchError:e.error,refetchChannelAccounts:e.refetch}};var x9=(e=>(e.REACH_MANAGED="reach-managed",e.TWILLIO="twillio",e))(x9||{});const w9=()=>{const e=ve({queryKey:["channel-senders"],queryFn:()=>(async()=>(await Re(`${u}`,{method:"GET"})).data)()});return{channelSenders:e.data,isFetching:e.isFetching,isLoading:e.isLoading,fetchError:e.error,refetchChannelSenders:e.refetch}},_9=()=>{const e=ce(),t=ye({mutationFn:e=>(async(e,t)=>(await Re(`${u}/${t}`,{method:"PATCH",body:JSON.stringify(e)})).data)(e.toUpdate,e.id),onSuccess:()=>{e.invalidateQueries({queryKey:["channel-senders"]})}});return{updateChannelSender:t.mutate,isUpdating:t.isPending,updateError:t.error}},S9=(e,t)=>{const[r,o]=n.useState(e);return n.useEffect((()=>{const n=setTimeout((()=>{o(e)}),t);return()=>clearTimeout(n)}),[e,t]),r},E9=({className:e})=>t.jsx("div",{className:Zd("bg-red-500/10 p-2 rounded-full text-red-500",e),children:t.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),T9=({title:e,alertText:r,Icon:o=Cu,onClick:i,asChild:a=!0})=>{const[s,l]=n.useState(!1);return t.jsx(m6,{children:t.jsxs(g6,{open:s,onOpenChange:l,children:[t.jsx(v6,{asChild:a,onClick:e=>{e.stopPropagation(),i?(i(),l(!1)):l(!s)},children:t.jsx(o,{className:"h-3.5 w-3.5 cursor-pointer transition-colors"})}),t.jsx(y6,{className:"text-left",children:t.jsxs("div",{className:"flex flex-col items-start gap-2 max-w-[300px]",children:[r&&t.jsxs(t.Fragment,{children:[t.jsx(E9,{}),t.jsx("p",{className:"font-semibold text-amber-500",children:r})]}),t.jsx("p",{className:"text-[13px] leading-relaxed text-primary-foreground/90 text-left",children:e})]})})]})})};function C9(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function A9(e){const n=N9(e),r=i.forwardRef(((e,r)=>{const{children:o,...a}=e,s=i.Children.toArray(o),l=s.find(O9);if(l){const e=l.props.children,o=s.map((t=>t===l?i.Children.count(e)>1?i.Children.only(null):i.isValidElement(e)?e.props.children:null:t));return t.jsx(n,{...a,ref:r,children:i.isValidElement(e)?i.cloneElement(e,void 0,o):null})}return t.jsx(n,{...a,ref:r,children:o})}));return r.displayName=`${e}.Slot`,r}function N9(e){const t=i.forwardRef(((e,t)=>{const{children:n,...r}=e;if(i.isValidElement(n)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(n),o=function(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{i(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]={...o,...i}:"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==i.Fragment&&(o.ref=t?function(...e){return t=>{let n=!1;const r=e.map((e=>{const r=C9(e,t);return n||"function"!=typeof r||(n=!0),r}));if(n)return()=>{for(let t=0;t<r.length;t++){const n=r[t];"function"==typeof n?n():C9(e[t],null)}}}}(t,e):e),i.cloneElement(n,o)}return i.Children.count(n)>1?i.Children.only(null):null}));return t.displayName=`${e}.SlotClone`,t}var R9=Symbol("radix.slottable");function O9(e){return i.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===R9}var P9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce(((e,n)=>{const r=A9(`Primitive.${n}`),o=i.forwardRef(((e,o)=>{const{asChild:i,...a}=e,s=i?r:n;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t.jsx(s,{...a,ref:o})}));return o.displayName=`Primitive.${n}`,{...e,[n]:o}}),{}),k9=i.forwardRef(((e,n)=>t.jsx(P9.label,{...e,ref:n,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}})));k9.displayName="Label";var M9=k9;const j9=ru("text-foreground text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),L9=i.forwardRef((({className:e,...n},r)=>t.jsx(M9,{ref:r,className:Zd(j9(),e),...n})));function D9(e,[t,n]){return Math.min(n,Math.max(t,e))}function I9(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),!1===n||!r.defaultPrevented)return t?.(r)}}function F9(e,n=[]){let r=[];const o=()=>{const t=r.map((e=>i.createContext(e)));return function(n){const r=n?.[e]||t;return i.useMemo((()=>({[`__scope${e}`]:{...n,[e]:r}})),[n,r])}};return o.scopeName=e,[function(n,o){const a=i.createContext(o),s=r.length;r=[...r,o];const l=n=>{const{scope:r,children:o,...l}=n,c=r?.[e]?.[s]||a,u=i.useMemo((()=>l),Object.values(l));return t.jsx(c.Provider,{value:u,children:o})};return l.displayName=n+"Provider",[l,function(t,r){const l=i.useContext(r?.[e]?.[s]||a);if(l)return l;if(void 0!==o)return o;throw new Error(`\`${t}\` must be used within \`${n}\``)}]},U9(o,...n)]}function U9(...e){const t=e[0];if(1===e.length)return t;const n=()=>{const n=e.map((e=>({useScope:e(),scopeName:e.scopeName})));return function(e){const r=n.reduce(((t,{useScope:n,scopeName:r})=>({...t,...n(e)[`__scope${r}`]})),{});return i.useMemo((()=>({[`__scope${t.scopeName}`]:r})),[r])}};return n.scopeName=t.scopeName,n}function $9(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function V9(...e){return t=>{let n=!1;const r=e.map((e=>{const r=$9(e,t);return n||"function"!=typeof r||(n=!0),r}));if(n)return()=>{for(let t=0;t<r.length;t++){const n=r[t];"function"==typeof n?n():$9(e[t],null)}}}}function B9(...e){return i.useCallback(V9(...e),e)}function z9(e){const n=H9(e),r=i.forwardRef(((e,r)=>{const{children:o,...a}=e,s=i.Children.toArray(o),l=s.find(G9);if(l){const e=l.props.children,o=s.map((t=>t===l?i.Children.count(e)>1?i.Children.only(null):i.isValidElement(e)?e.props.children:null:t));return t.jsx(n,{...a,ref:r,children:i.isValidElement(e)?i.cloneElement(e,void 0,o):null})}return t.jsx(n,{...a,ref:r,children:o})}));return r.displayName=`${e}.Slot`,r}function H9(e){const t=i.forwardRef(((e,t)=>{const{children:n,...r}=e;if(i.isValidElement(n)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(n),o=function(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{i(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]={...o,...i}:"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==i.Fragment&&(o.ref=t?V9(t,e):e),i.cloneElement(n,o)}return i.Children.count(n)>1?i.Children.only(null):null}));return t.displayName=`${e}.SlotClone`,t}L9.displayName=M9.displayName;var q9=Symbol("radix.slottable");function G9(e){return i.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===q9}var K9=i.createContext(void 0);var W9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce(((e,n)=>{const r=z9(`Primitive.${n}`),o=i.forwardRef(((e,o)=>{const{asChild:i,...a}=e,s=i?r:n;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t.jsx(s,{...a,ref:o})}));return o.displayName=`Primitive.${n}`,{...e,[n]:o}}),{});function Y9(e){const t=i.useRef(e);return i.useEffect((()=>{t.current=e})),i.useMemo((()=>(...e)=>t.current?.(...e)),[])}var X9,Z9="dismissableLayer.update",Q9="dismissableLayer.pointerDownOutside",J9="dismissableLayer.focusOutside",e7=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),t7=i.forwardRef(((e,n)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:s,onInteractOutside:l,onDismiss:c,...u}=e,d=i.useContext(e7),[p,f]=i.useState(null),h=p?.ownerDocument??globalThis?.document,[,m]=i.useState({}),g=B9(n,(e=>f(e))),v=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=v.indexOf(y),x=p?v.indexOf(p):-1,w=d.layersWithOutsidePointerEventsDisabled.size>0,_=x>=b,S=function(e,t=globalThis?.document){const n=Y9(e),r=i.useRef(!1),o=i.useRef((()=>{}));return i.useEffect((()=>{const e=e=>{if(e.target&&!r.current){let r=function(){r7(Q9,n,i,{discrete:!0})};const i={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",o.current),o.current=r,t.addEventListener("click",o.current,{once:!0})):r()}else t.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout((()=>{t.addEventListener("pointerdown",e)}),0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",e),t.removeEventListener("click",o.current)}}),[t,n]),{onPointerDownCapture:()=>r.current=!0}}((e=>{const t=e.target,n=[...d.branches].some((e=>e.contains(t)));_&&!n&&(a?.(e),l?.(e),e.defaultPrevented||c?.())}),h),E=function(e,t=globalThis?.document){const n=Y9(e),r=i.useRef(!1);return i.useEffect((()=>{const e=e=>{if(e.target&&!r.current){r7(J9,n,{originalEvent:e},{discrete:!1})}};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)}),[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}((e=>{const t=e.target;[...d.branches].some((e=>e.contains(t)))||(s?.(e),l?.(e),e.defaultPrevented||c?.())}),h);return function(e,t=globalThis?.document){const n=Y9(e);i.useEffect((()=>{const e=e=>{"Escape"===e.key&&n(e)};return t.addEventListener("keydown",e,{capture:!0}),()=>t.removeEventListener("keydown",e,{capture:!0})}),[n,t])}((e=>{x===d.layers.size-1&&(o?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))}),h),i.useEffect((()=>{if(p)return r&&(0===d.layersWithOutsidePointerEventsDisabled.size&&(X9=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(p)),d.layers.add(p),n7(),()=>{r&&1===d.layersWithOutsidePointerEventsDisabled.size&&(h.body.style.pointerEvents=X9)}}),[p,h,r,d]),i.useEffect((()=>()=>{p&&(d.layers.delete(p),d.layersWithOutsidePointerEventsDisabled.delete(p),n7())}),[p,d]),i.useEffect((()=>{const e=()=>m({});return document.addEventListener(Z9,e),()=>document.removeEventListener(Z9,e)}),[]),t.jsx(W9.div,{...u,ref:g,style:{pointerEvents:w?_?"auto":"none":void 0,...e.style},onFocusCapture:I9(e.onFocusCapture,E.onFocusCapture),onBlurCapture:I9(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:I9(e.onPointerDownCapture,S.onPointerDownCapture)})}));t7.displayName="DismissableLayer";function n7(){const e=new CustomEvent(Z9);document.dispatchEvent(e)}function r7(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?function(e,t){e&&a.flushSync((()=>e.dispatchEvent(t)))}(o,i):o.dispatchEvent(i)}i.forwardRef(((e,n)=>{const r=i.useContext(e7),o=i.useRef(null),a=B9(n,o);return i.useEffect((()=>{const e=o.current;if(e)return r.branches.add(e),()=>{r.branches.delete(e)}}),[r.branches]),t.jsx(W9.div,{...e,ref:a})})).displayName="DismissableLayerBranch";var o7=0;function i7(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var a7="focusScope.autoFocusOnMount",s7="focusScope.autoFocusOnUnmount",l7={bubbles:!1,cancelable:!0},c7=i.forwardRef(((e,n)=>{const{loop:r=!1,trapped:o=!1,onMountAutoFocus:a,onUnmountAutoFocus:s,...l}=e,[c,u]=i.useState(null),d=Y9(a),p=Y9(s),f=i.useRef(null),h=B9(n,(e=>u(e))),m=i.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;i.useEffect((()=>{if(o){let e=function(e){if(m.paused||!c)return;const t=e.target;c.contains(t)?f.current=t:f7(f.current,{select:!0})},t=function(e){if(m.paused||!c)return;const t=e.relatedTarget;null!==t&&(c.contains(t)||f7(f.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&f7(c)};document.addEventListener("focusin",e),document.addEventListener("focusout",t);const r=new MutationObserver(n);return c&&r.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),r.disconnect()}}}),[o,c,m.paused]),i.useEffect((()=>{if(c){h7.add(m);const t=document.activeElement;if(!c.contains(t)){const n=new CustomEvent(a7,l7);c.addEventListener(a7,d),c.dispatchEvent(n),n.defaultPrevented||(!function(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(f7(r,{select:t}),document.activeElement!==n)return}((e=u7(c),e.filter((e=>"A"!==e.tagName))),{select:!0}),document.activeElement===t&&f7(c))}return()=>{c.removeEventListener(a7,d),setTimeout((()=>{const e=new CustomEvent(s7,l7);c.addEventListener(s7,p),c.dispatchEvent(e),e.defaultPrevented||f7(t??document.body,{select:!0}),c.removeEventListener(s7,p),h7.remove(m)}),0)}}var e}),[c,d,p,m]);const g=i.useCallback((e=>{if(!r&&!o)return;if(m.paused)return;const t=document.activeElement;if("Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&t){const n=e.currentTarget,[o,i]=function(e){const t=u7(e),n=d7(t,e),r=d7(t.reverse(),e);return[n,r]}(n);o&&i?e.shiftKey||t!==i?e.shiftKey&&t===o&&(e.preventDefault(),r&&f7(i,{select:!0})):(e.preventDefault(),r&&f7(o,{select:!0})):t===n&&e.preventDefault()}}),[r,o,m.paused]);return t.jsx(W9.div,{tabIndex:-1,...l,ref:h,onKeyDown:g})}));function u7(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>e.disabled||e.hidden||"INPUT"===e.tagName&&"hidden"===e.type?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;n.nextNode();)t.push(n.currentNode);return t}function d7(e,t){for(const n of e)if(!p7(n,{upTo:t}))return n}function p7(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==t&&e===t)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function f7(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&t&&e.select()}}c7.displayName="FocusScope";var h7=function(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=m7(e,t),e.unshift(t)},remove(t){e=m7(e,t),e[0]?.resume()}}}();function m7(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}var g7=globalThis?.document?i.useLayoutEffect:()=>{},v7=i[" useId ".trim().toString()]||(()=>{}),y7=0;function b7(e){const[t,n]=i.useState(v7());return g7((()=>{n((e=>e??String(y7++)))}),[e]),e||(t?`radix-${t}`:"")}var x7=i.forwardRef(((e,n)=>{const{children:r,width:o=10,height:i=5,...a}=e;return t.jsx(W9.svg,{...a,ref:n,width:o,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:t.jsx("polygon",{points:"0,0 30,0 15,10"})})}));x7.displayName="Arrow";var w7=x7;var _7="Popper",[S7,E7]=F9(_7),[T7,C7]=S7(_7),A7=e=>{const{__scopePopper:n,children:r}=e,[o,a]=i.useState(null);return t.jsx(T7,{scope:n,anchor:o,onAnchorChange:a,children:r})};A7.displayName=_7;var N7="PopperAnchor",R7=i.forwardRef(((e,n)=>{const{__scopePopper:r,virtualRef:o,...a}=e,s=C7(N7,r),l=i.useRef(null),c=B9(n,l);return i.useEffect((()=>{s.onAnchorChange(o?.current||l.current)})),o?null:t.jsx(W9.div,{...a,ref:c})}));R7.displayName=N7;var O7="PopperContent",[P7,k7]=S7(O7),M7=i.forwardRef(((e,n)=>{const{__scopePopper:r,side:o="bottom",sideOffset:a=0,align:s="center",alignOffset:l=0,arrowPadding:c=0,avoidCollisions:u=!0,collisionBoundary:d=[],collisionPadding:p=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:m="optimized",onPlaced:g,...v}=e,y=C7(O7,r),[b,x]=i.useState(null),w=B9(n,(e=>x(e))),[_,S]=i.useState(null),E=function(e){const[t,n]=i.useState(void 0);return g7((()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const t=new ResizeObserver((t=>{if(!Array.isArray(t))return;if(!t.length)return;const r=t[0];let o,i;if("borderBoxSize"in r){const e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;o=t.inlineSize,i=t.blockSize}else o=e.offsetWidth,i=e.offsetHeight;n({width:o,height:i})}));return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}n(void 0)}),[e]),t}(_),T=E?.width??0,C=E?.height??0,A=o+("center"!==s?"-"+s:""),N="number"==typeof p?p:{top:0,right:0,bottom:0,left:0,...p},R=Array.isArray(d)?d:[d],O=R.length>0,P={padding:N,boundary:R.filter(I7),altBoundary:O},{refs:k,floatingStyles:M,placement:j,isPositioned:L,middlewareData:D}=H0({strategy:"fixed",placement:A,whileElementsMounted:(...e)=>O0(...e,{animationFrame:"always"===m}),elements:{reference:y.anchor},middleware:[G0({mainAxis:a+C,alignmentAxis:l}),u&&K0({mainAxis:!0,crossAxis:!1,limiter:"partial"===f?W0():void 0,...P}),u&&Y0({...P}),X0({...P,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{const{width:o,height:i}=t.reference,a=e.floating.style;a.setProperty("--radix-popper-available-width",`${n}px`),a.setProperty("--radix-popper-available-height",`${r}px`),a.setProperty("--radix-popper-anchor-width",`${o}px`),a.setProperty("--radix-popper-anchor-height",`${i}px`)}}),_&&Q0({element:_,padding:c}),F7({arrowWidth:T,arrowHeight:C}),h&&Z0({strategy:"referenceHidden",...P})]}),[I,F]=U7(j),U=Y9(g);g7((()=>{L&&U?.()}),[L,U]);const $=D.arrow?.x,V=D.arrow?.y,B=0!==D.arrow?.centerOffset,[z,H]=i.useState();return g7((()=>{b&&H(window.getComputedStyle(b).zIndex)}),[b]),t.jsx("div",{ref:k.setFloating,"data-radix-popper-content-wrapper":"",style:{...M,transform:L?M.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:z,"--radix-popper-transform-origin":[D.transformOrigin?.x,D.transformOrigin?.y].join(" "),...D.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:t.jsx(P7,{scope:r,placedSide:I,onArrowChange:S,arrowX:$,arrowY:V,shouldHideArrow:B,children:t.jsx(W9.div,{"data-side":I,"data-align":F,...v,ref:w,style:{...v.style,animation:L?void 0:"none"}})})})}));M7.displayName=O7;var j7="PopperArrow",L7={top:"bottom",right:"left",bottom:"top",left:"right"},D7=i.forwardRef((function(e,n){const{__scopePopper:r,...o}=e,i=k7(j7,r),a=L7[i.placedSide];return t.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:t.jsx(w7,{...o,ref:n,style:{...o.style,display:"block"}})})}));function I7(e){return null!==e}D7.displayName=j7;var F7=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:o}=t,i=0!==o.arrow?.centerOffset,a=i?0:e.arrowWidth,s=i?0:e.arrowHeight,[l,c]=U7(n),u={start:"0%",center:"50%",end:"100%"}[c],d=(o.arrow?.x??0)+a/2,p=(o.arrow?.y??0)+s/2;let f="",h="";return"bottom"===l?(f=i?u:`${d}px`,h=-s+"px"):"top"===l?(f=i?u:`${d}px`,h=`${r.floating.height+s}px`):"right"===l?(f=-s+"px",h=i?u:`${p}px`):"left"===l&&(f=`${r.floating.width+s}px`,h=i?u:`${p}px`),{data:{x:f,y:h}}}});function U7(e){const[t,n="center"]=e.split("-");return[t,n]}var $7=A7,V7=R7,B7=M7,z7=D7,H7=i.forwardRef(((e,n)=>{const{container:o,...a}=e,[s,l]=i.useState(!1);g7((()=>l(!0)),[]);const c=o||s&&globalThis?.document?.body;return c?r.createPortal(t.jsx(W9.div,{...a,ref:n}),c):null}));H7.displayName="Portal";var q7=i[" useInsertionEffect ".trim().toString()]||g7;function G7({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,a,s]=function({defaultProp:e,onChange:t}){const[n,r]=i.useState(e),o=i.useRef(n),a=i.useRef(t);return q7((()=>{a.current=t}),[t]),i.useEffect((()=>{o.current!==n&&(a.current?.(n),o.current=n)}),[n,o]),[n,r,a]}({defaultProp:t,onChange:n}),l=void 0!==e,c=l?e:o;{const t=i.useRef(void 0!==e);i.useEffect((()=>{const e=t.current;if(e!==l){}t.current=l}),[l,r])}const u=i.useCallback((t=>{if(l){const n=function(e){return"function"==typeof e}(t)?t(e):t;n!==e&&s.current?.(n)}else a(t)}),[l,e,a,s]);return[c,u]}var K7=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"});i.forwardRef(((e,n)=>t.jsx(W9.span,{...e,ref:n,style:{...K7,...e.style}}))).displayName="VisuallyHidden";var W7=[" ","Enter","ArrowUp","ArrowDown"],Y7=[" ","Enter"],X7="Select",[Z7,Q7,J7]=function(e){const r=e+"CollectionProvider",[o,i]=F9(r),[a,s]=o(r,{collectionRef:{current:null},itemMap:new Map}),l=e=>{const{scope:r,children:o}=e,i=n.useRef(null),s=n.useRef(new Map).current;return t.jsx(a,{scope:r,itemMap:s,collectionRef:i,children:o})};l.displayName=r;const c=e+"CollectionSlot",u=z9(c),d=n.forwardRef(((e,n)=>{const{scope:r,children:o}=e,i=B9(n,s(c,r).collectionRef);return t.jsx(u,{ref:i,children:o})}));d.displayName=c;const p=e+"CollectionItemSlot",f="data-radix-collection-item",h=z9(p),m=n.forwardRef(((e,r)=>{const{scope:o,children:i,...a}=e,l=n.useRef(null),c=B9(r,l),u=s(p,o);return n.useEffect((()=>(u.itemMap.set(l,{ref:l,...a}),()=>{u.itemMap.delete(l)}))),t.jsx(h,{[f]:"",ref:c,children:i})}));return m.displayName=p,[{Provider:l,Slot:d,ItemSlot:m},function(t){const r=s(e+"CollectionConsumer",t);return n.useCallback((()=>{const e=r.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${f}]`));return Array.from(r.itemMap.values()).sort(((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current)))}),[r.collectionRef,r.itemMap])},i]}(X7),[eee,tee]=F9(X7,[J7,E7]),nee=E7(),[ree,oee]=eee(X7),[iee,aee]=eee(X7),see=e=>{const{__scopeSelect:n,children:r,open:o,defaultOpen:a,onOpenChange:s,value:l,defaultValue:c,onValueChange:u,dir:d,name:p,autoComplete:f,disabled:h,required:m,form:g}=e,v=nee(n),[y,b]=i.useState(null),[x,w]=i.useState(null),[_,S]=i.useState(!1),E=function(e){const t=i.useContext(K9);return e||t||"ltr"}(d),[T,C]=G7({prop:o,defaultProp:a??!1,onChange:s,caller:X7}),[A,N]=G7({prop:l,defaultProp:c,onChange:u,caller:X7}),R=i.useRef(null),O=!y||(g||!!y.closest("form")),[P,k]=i.useState(new Set),M=Array.from(P).map((e=>e.props.value)).join(";");return t.jsx($7,{...v,children:t.jsxs(ree,{required:m,scope:n,trigger:y,onTriggerChange:b,valueNode:x,onValueNodeChange:w,valueNodeHasChildren:_,onValueNodeHasChildrenChange:S,contentId:b7(),value:A,onValueChange:N,open:T,onOpenChange:C,dir:E,triggerPointerDownPosRef:R,disabled:h,children:[t.jsx(Z7.Provider,{scope:n,children:t.jsx(iee,{scope:e.__scopeSelect,onNativeOptionAdd:i.useCallback((e=>{k((t=>new Set(t).add(e)))}),[]),onNativeOptionRemove:i.useCallback((e=>{k((t=>{const n=new Set(t);return n.delete(e),n}))}),[]),children:r})}),O?t.jsxs(Kee,{"aria-hidden":!0,required:m,tabIndex:-1,name:p,autoComplete:f,value:A,onChange:e=>N(e.target.value),disabled:h,form:g,children:[void 0===A?t.jsx("option",{value:""}):null,Array.from(P)]},M):null]})})};see.displayName=X7;var lee="SelectTrigger",cee=i.forwardRef(((e,n)=>{const{__scopeSelect:r,disabled:o=!1,...a}=e,s=nee(r),l=oee(lee,r),c=l.disabled||o,u=B9(n,l.onTriggerChange),d=Q7(r),p=i.useRef("touch"),[f,h,m]=Yee((e=>{const t=d().filter((e=>!e.disabled)),n=t.find((e=>e.value===l.value)),r=Xee(t,e,n);void 0!==r&&l.onValueChange(r.value)})),g=e=>{c||(l.onOpenChange(!0),m()),e&&(l.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return t.jsx(V7,{asChild:!0,...s,children:t.jsx(W9.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":Wee(l.value)?"":void 0,...a,ref:u,onClick:I9(a.onClick,(e=>{e.currentTarget.focus(),"mouse"!==p.current&&g(e)})),onPointerDown:I9(a.onPointerDown,(e=>{p.current=e.pointerType;const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(g(e),e.preventDefault())})),onKeyDown:I9(a.onKeyDown,(e=>{const t=""!==f.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||h(e.key),t&&" "===e.key||W7.includes(e.key)&&(g(),e.preventDefault())}))})})}));cee.displayName=lee;var uee="SelectValue",dee=i.forwardRef(((e,n)=>{const{__scopeSelect:r,className:o,style:i,children:a,placeholder:s="",...l}=e,c=oee(uee,r),{onValueNodeHasChildrenChange:u}=c,d=void 0!==a,p=B9(n,c.onValueNodeChange);return g7((()=>{u(d)}),[u,d]),t.jsx(W9.span,{...l,ref:p,style:{pointerEvents:"none"},children:Wee(c.value)?t.jsx(t.Fragment,{children:s}):a})}));dee.displayName=uee;var pee=i.forwardRef(((e,n)=>{const{__scopeSelect:r,children:o,...i}=e;return t.jsx(W9.span,{"aria-hidden":!0,...i,ref:n,children:o||"▼"})}));pee.displayName="SelectIcon";var fee=e=>t.jsx(H7,{asChild:!0,...e});fee.displayName="SelectPortal";var hee="SelectContent",mee=i.forwardRef(((e,n)=>{const r=oee(hee,e.__scopeSelect),[o,s]=i.useState();if(g7((()=>{s(new DocumentFragment)}),[]),!r.open){const n=o;return n?a.createPortal(t.jsx(vee,{scope:e.__scopeSelect,children:t.jsx(Z7.Slot,{scope:e.__scopeSelect,children:t.jsx("div",{children:e.children})})}),n):null}return t.jsx(xee,{...e,ref:n})}));mee.displayName=hee;var gee=10,[vee,yee]=eee(hee),bee=z9("SelectContent.RemoveScroll"),xee=i.forwardRef(((e,n)=>{const{__scopeSelect:r,position:o="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:s,onPointerDownOutside:l,side:c,sideOffset:u,align:d,alignOffset:p,arrowPadding:f,collisionBoundary:h,collisionPadding:m,sticky:g,hideWhenDetached:v,avoidCollisions:y,...b}=e,x=oee(hee,r),[w,_]=i.useState(null),[S,E]=i.useState(null),T=B9(n,(e=>_(e))),[C,A]=i.useState(null),[N,R]=i.useState(null),O=Q7(r),[P,k]=i.useState(!1),M=i.useRef(!1);i.useEffect((()=>{if(w)return LV(w)}),[w]),i.useEffect((()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??i7()),document.body.insertAdjacentElement("beforeend",e[1]??i7()),o7++,()=>{1===o7&&document.querySelectorAll("[data-radix-focus-guard]").forEach((e=>e.remove())),o7--}}),[]);const j=i.useCallback((e=>{const[t,...n]=O().map((e=>e.ref.current)),[r]=n.slice(-1),o=document.activeElement;for(const i of e){if(i===o)return;if(i?.scrollIntoView({block:"nearest"}),i===t&&S&&(S.scrollTop=0),i===r&&S&&(S.scrollTop=S.scrollHeight),i?.focus(),document.activeElement!==o)return}}),[O,S]),L=i.useCallback((()=>j([C,w])),[j,C,w]);i.useEffect((()=>{P&&L()}),[P,L]);const{onOpenChange:D,triggerPointerDownPosRef:I}=x;i.useEffect((()=>{if(w){let e={x:0,y:0};const t=t=>{e={x:Math.abs(Math.round(t.pageX)-(I.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(I.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():w.contains(n.target)||D(!1),document.removeEventListener("pointermove",t),I.current=null};return null!==I.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",n,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",n,{capture:!0})}}}),[w,D,I]),i.useEffect((()=>{const e=()=>D(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}}),[D]);const[F,U]=Yee((e=>{const t=O().filter((e=>!e.disabled)),n=t.find((e=>e.ref.current===document.activeElement)),r=Xee(t,e,n);r&&setTimeout((()=>r.ref.current.focus()))})),$=i.useCallback(((e,t,n)=>{const r=!M.current&&!n;(void 0!==x.value&&x.value===t||r)&&(A(e),r&&(M.current=!0))}),[x.value]),V=i.useCallback((()=>w?.focus()),[w]),B=i.useCallback(((e,t,n)=>{(void 0!==x.value&&x.value===t||!M.current&&!n)&&R(e)}),[x.value]),z="popper"===o?_ee:wee,H=z===_ee?{side:c,sideOffset:u,align:d,alignOffset:p,arrowPadding:f,collisionBoundary:h,collisionPadding:m,sticky:g,hideWhenDetached:v,avoidCollisions:y}:{};return t.jsx(vee,{scope:r,content:w,viewport:S,onViewportChange:E,itemRefCallback:$,selectedItem:C,onItemLeave:V,itemTextRefCallback:B,focusSelectedItem:L,selectedItemText:N,position:o,isPositioned:P,searchRef:F,children:t.jsx(NV,{as:bee,allowPinchZoom:!0,children:t.jsx(c7,{asChild:!0,trapped:x.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:I9(a,(e=>{x.trigger?.focus({preventScroll:!0}),e.preventDefault()})),children:t.jsx(t7,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:t.jsx(z,{role:"listbox",id:x.contentId,"data-state":x.open?"open":"closed",dir:x.dir,onContextMenu:e=>e.preventDefault(),...b,...H,onPlaced:()=>k(!0),ref:T,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:I9(b.onKeyDown,(e=>{const t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||U(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=O().filter((e=>!e.disabled)).map((e=>e.ref.current));if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){const n=t.indexOf(e.target);t=t.slice(n+1)}setTimeout((()=>j(t))),e.preventDefault()}}))})})})})})}));xee.displayName="SelectContentImpl";var wee=i.forwardRef(((e,n)=>{const{__scopeSelect:r,onPlaced:o,...a}=e,s=oee(hee,r),l=yee(hee,r),[c,u]=i.useState(null),[d,p]=i.useState(null),f=B9(n,(e=>p(e))),h=Q7(r),m=i.useRef(!1),g=i.useRef(!0),{viewport:v,selectedItem:y,selectedItemText:b,focusSelectedItem:x}=l,w=i.useCallback((()=>{if(s.trigger&&s.valueNode&&c&&d&&v&&y&&b){const e=s.trigger.getBoundingClientRect(),t=d.getBoundingClientRect(),n=s.valueNode.getBoundingClientRect(),r=b.getBoundingClientRect();if("rtl"!==s.dir){const o=n.left-(r.left-t.left),i=e.width+(e.left-o),a=Math.max(i,t.width),s=window.innerWidth-gee,l=D9(o,[gee,Math.max(gee,s-a)]);c.style.minWidth=i+"px",c.style.left=l+"px"}else{const o=window.innerWidth-n.right-(t.right-r.right),i=window.innerWidth-e.right-o,a=e.width+i,s=Math.max(a,t.width),l=window.innerWidth-gee,u=D9(o,[gee,Math.max(gee,l-s)]);c.style.minWidth=a+"px",c.style.right=u+"px"}const i=h(),a=window.innerHeight-2*gee,l=v.scrollHeight,u=window.getComputedStyle(d),p=parseInt(u.borderTopWidth,10),f=parseInt(u.paddingTop,10),g=parseInt(u.borderBottomWidth,10),x=p+f+l+parseInt(u.paddingBottom,10)+g,w=Math.min(5*y.offsetHeight,x),_=window.getComputedStyle(v),S=parseInt(_.paddingTop,10),E=parseInt(_.paddingBottom,10),T=e.top+e.height/2-gee,C=a-T,A=y.offsetHeight/2,N=p+f+(y.offsetTop+A),R=x-N;if(N<=T){const e=i.length>0&&y===i[i.length-1].ref.current;c.style.bottom="0px";const t=Math.max(C,A+(e?E:0)+(d.clientHeight-v.offsetTop-v.offsetHeight)+g);c.style.height=N+t+"px"}else{const e=i.length>0&&y===i[0].ref.current;c.style.top="0px";const t=Math.max(T,p+v.offsetTop+(e?S:0)+A);c.style.height=t+R+"px",v.scrollTop=N-T+v.offsetTop}c.style.margin=`${gee}px 0`,c.style.minHeight=w+"px",c.style.maxHeight=a+"px",o?.(),requestAnimationFrame((()=>m.current=!0))}}),[h,s.trigger,s.valueNode,c,d,v,y,b,s.dir,o]);g7((()=>w()),[w]);const[_,S]=i.useState();g7((()=>{d&&S(window.getComputedStyle(d).zIndex)}),[d]);const E=i.useCallback((e=>{e&&!0===g.current&&(w(),x?.(),g.current=!1)}),[w,x]);return t.jsx(See,{scope:r,contentWrapper:c,shouldExpandOnScrollRef:m,onScrollButtonChange:E,children:t.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:_},children:t.jsx(W9.div,{...a,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})}));wee.displayName="SelectItemAlignedPosition";var _ee=i.forwardRef(((e,n)=>{const{__scopeSelect:r,align:o="start",collisionPadding:i=gee,...a}=e,s=nee(r);return t.jsx(B7,{...s,...a,ref:n,align:o,collisionPadding:i,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})}));_ee.displayName="SelectPopperPosition";var[See,Eee]=eee(hee,{}),Tee="SelectViewport",Cee=i.forwardRef(((e,n)=>{const{__scopeSelect:r,nonce:o,...a}=e,s=yee(Tee,r),l=Eee(Tee,r),c=B9(n,s.onViewportChange),u=i.useRef(0);return t.jsxs(t.Fragment,{children:[t.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),t.jsx(Z7.Slot,{scope:r,children:t.jsx(W9.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:I9(a.onScroll,(e=>{const t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=l;if(r?.current&&n){const e=Math.abs(u.current-t.scrollTop);if(e>0){const r=window.innerHeight-2*gee,o=parseFloat(n.style.minHeight),i=parseFloat(n.style.height),a=Math.max(o,i);if(a<r){const o=a+e,i=Math.min(r,o),s=o-i;n.style.height=i+"px","0px"===n.style.bottom&&(t.scrollTop=s>0?s:0,n.style.justifyContent="flex-end")}}}u.current=t.scrollTop}))})})]})}));Cee.displayName=Tee;var Aee="SelectGroup",[Nee,Ree]=eee(Aee);i.forwardRef(((e,n)=>{const{__scopeSelect:r,...o}=e,i=b7();return t.jsx(Nee,{scope:r,id:i,children:t.jsx(W9.div,{role:"group","aria-labelledby":i,...o,ref:n})})})).displayName=Aee;var Oee="SelectLabel",Pee=i.forwardRef(((e,n)=>{const{__scopeSelect:r,...o}=e,i=Ree(Oee,r);return t.jsx(W9.div,{id:i.id,...o,ref:n})}));Pee.displayName=Oee;var kee="SelectItem",[Mee,jee]=eee(kee),Lee=i.forwardRef(((e,n)=>{const{__scopeSelect:r,value:o,disabled:a=!1,textValue:s,...l}=e,c=oee(kee,r),u=yee(kee,r),d=c.value===o,[p,f]=i.useState(s??""),[h,m]=i.useState(!1),g=B9(n,(e=>u.itemRefCallback?.(e,o,a))),v=b7(),y=i.useRef("touch"),b=()=>{a||(c.onValueChange(o),c.onOpenChange(!1))};if(""===o)throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return t.jsx(Mee,{scope:r,value:o,disabled:a,textId:v,isSelected:d,onItemTextChange:i.useCallback((e=>{f((t=>t||(e?.textContent??"").trim()))}),[]),children:t.jsx(Z7.ItemSlot,{scope:r,value:o,disabled:a,textValue:p,children:t.jsx(W9.div,{role:"option","aria-labelledby":v,"data-highlighted":h?"":void 0,"aria-selected":d&&h,"data-state":d?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...l,ref:g,onFocus:I9(l.onFocus,(()=>m(!0))),onBlur:I9(l.onBlur,(()=>m(!1))),onClick:I9(l.onClick,(()=>{"mouse"!==y.current&&b()})),onPointerUp:I9(l.onPointerUp,(()=>{"mouse"===y.current&&b()})),onPointerDown:I9(l.onPointerDown,(e=>{y.current=e.pointerType})),onPointerMove:I9(l.onPointerMove,(e=>{y.current=e.pointerType,a?u.onItemLeave?.():"mouse"===y.current&&e.currentTarget.focus({preventScroll:!0})})),onPointerLeave:I9(l.onPointerLeave,(e=>{e.currentTarget===document.activeElement&&u.onItemLeave?.()})),onKeyDown:I9(l.onKeyDown,(e=>{""!==u.searchRef?.current&&" "===e.key||(Y7.includes(e.key)&&b()," "===e.key&&e.preventDefault())}))})})})}));Lee.displayName=kee;var Dee="SelectItemText",Iee=i.forwardRef(((e,n)=>{const{__scopeSelect:r,className:o,style:s,...l}=e,c=oee(Dee,r),u=yee(Dee,r),d=jee(Dee,r),p=aee(Dee,r),[f,h]=i.useState(null),m=B9(n,(e=>h(e)),d.onItemTextChange,(e=>u.itemTextRefCallback?.(e,d.value,d.disabled))),g=f?.textContent,v=i.useMemo((()=>t.jsx("option",{value:d.value,disabled:d.disabled,children:g},d.value)),[d.disabled,d.value,g]),{onNativeOptionAdd:y,onNativeOptionRemove:b}=p;return g7((()=>(y(v),()=>b(v))),[y,b,v]),t.jsxs(t.Fragment,{children:[t.jsx(W9.span,{id:d.textId,...l,ref:m}),d.isSelected&&c.valueNode&&!c.valueNodeHasChildren?a.createPortal(l.children,c.valueNode):null]})}));Iee.displayName=Dee;var Fee="SelectItemIndicator",Uee=i.forwardRef(((e,n)=>{const{__scopeSelect:r,...o}=e;return jee(Fee,r).isSelected?t.jsx(W9.span,{"aria-hidden":!0,...o,ref:n}):null}));Uee.displayName=Fee;var $ee="SelectScrollUpButton",Vee=i.forwardRef(((e,n)=>{const r=yee($ee,e.__scopeSelect),o=Eee($ee,e.__scopeSelect),[a,s]=i.useState(!1),l=B9(n,o.onScrollButtonChange);return g7((()=>{if(r.viewport&&r.isPositioned){let e=function(){s(t.scrollTop>0)};const t=r.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}}),[r.viewport,r.isPositioned]),a?t.jsx(Hee,{...e,ref:l,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=r;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null}));Vee.displayName=$ee;var Bee="SelectScrollDownButton",zee=i.forwardRef(((e,n)=>{const r=yee(Bee,e.__scopeSelect),o=Eee(Bee,e.__scopeSelect),[a,s]=i.useState(!1),l=B9(n,o.onScrollButtonChange);return g7((()=>{if(r.viewport&&r.isPositioned){let e=function(){const e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;s(n)};const t=r.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}}),[r.viewport,r.isPositioned]),a?t.jsx(Hee,{...e,ref:l,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=r;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null}));zee.displayName=Bee;var Hee=i.forwardRef(((e,n)=>{const{__scopeSelect:r,onAutoScroll:o,...a}=e,s=yee("SelectScrollButton",r),l=i.useRef(null),c=Q7(r),u=i.useCallback((()=>{null!==l.current&&(window.clearInterval(l.current),l.current=null)}),[]);return i.useEffect((()=>()=>u()),[u]),g7((()=>{const e=c().find((e=>e.ref.current===document.activeElement));e?.ref.current?.scrollIntoView({block:"nearest"})}),[c]),t.jsx(W9.div,{"aria-hidden":!0,...a,ref:n,style:{flexShrink:0,...a.style},onPointerDown:I9(a.onPointerDown,(()=>{null===l.current&&(l.current=window.setInterval(o,50))})),onPointerMove:I9(a.onPointerMove,(()=>{s.onItemLeave?.(),null===l.current&&(l.current=window.setInterval(o,50))})),onPointerLeave:I9(a.onPointerLeave,(()=>{u()}))})})),qee=i.forwardRef(((e,n)=>{const{__scopeSelect:r,...o}=e;return t.jsx(W9.div,{"aria-hidden":!0,...o,ref:n})}));qee.displayName="SelectSeparator";var Gee="SelectArrow";i.forwardRef(((e,n)=>{const{__scopeSelect:r,...o}=e,i=nee(r),a=oee(Gee,r),s=yee(Gee,r);return a.open&&"popper"===s.position?t.jsx(z7,{...i,...o,ref:n}):null})).displayName=Gee;var Kee=i.forwardRef((({__scopeSelect:e,value:n,...r},o)=>{const a=i.useRef(null),s=B9(o,a),l=function(e){const t=i.useRef({value:e,previous:e});return i.useMemo((()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous)),[e])}(n);return i.useEffect((()=>{const e=a.current;if(!e)return;const t=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(t,"value").set;if(l!==n&&r){const t=new Event("change",{bubbles:!0});r.call(e,n),e.dispatchEvent(t)}}),[l,n]),t.jsx(W9.select,{...r,style:{...K7,...r.style},ref:s,defaultValue:n})}));function Wee(e){return""===e||void 0===e}function Yee(e){const t=Y9(e),n=i.useRef(""),r=i.useRef(0),o=i.useCallback((e=>{const o=n.current+e;t(o),function e(t){n.current=t,window.clearTimeout(r.current),""!==t&&(r.current=window.setTimeout((()=>e("")),1e3))}(o)}),[t]),a=i.useCallback((()=>{n.current="",window.clearTimeout(r.current)}),[]);return i.useEffect((()=>()=>window.clearTimeout(r.current)),[]),[n,o,a]}function Xee(e,t,n){const r=t.length>1&&Array.from(t).every((e=>e===t[0]))?t[0]:t,o=n?e.indexOf(n):-1;let i=(a=e,s=Math.max(o,0),a.map(((e,t)=>a[(s+t)%a.length])));var a,s;1===r.length&&(i=i.filter((e=>e!==n)));const l=i.find((e=>e.textValue.toLowerCase().startsWith(r.toLowerCase())));return l!==n?l:void 0}Kee.displayName="SelectBubbleInput";var Zee=cee,Qee=pee,Jee=fee,ete=mee,tte=Cee,nte=Pee,rte=Lee,ote=Iee,ite=Uee,ate=Vee,ste=zee,lte=qee;const cte=see,ute=dee,dte=i.forwardRef((({className:e,children:n,...r},o)=>t.jsxs(Zee,{ref:o,className:Zd("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-border/10 px-3 py-2 text-sm shadow-sm ring-offset-background !placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r,children:[n,t.jsx(Qee,{asChild:!0,children:t.jsx(fu,{className:"h-4 w-4 opacity-50"})})]})));dte.displayName=Zee.displayName;const pte=i.forwardRef((({className:e,...n},r)=>t.jsx(ate,{ref:r,className:Zd("flex cursor-default items-center justify-center py-1",e),...n,children:t.jsx(gu,{className:"h-4 w-4"})})));pte.displayName=ate.displayName;const fte=i.forwardRef((({className:e,...n},r)=>t.jsx(ste,{ref:r,className:Zd("flex cursor-default items-center justify-center py-1",e),...n,children:t.jsx(fu,{className:"h-4 w-4"})})));fte.displayName=ste.displayName;const hte=i.forwardRef((({className:e,children:n,position:r="popper",...o},i)=>t.jsx(Jee,{children:t.jsxs(ete,{ref:i,className:Zd("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===r&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...o,children:[t.jsx(pte,{}),t.jsx(tte,{className:Zd("p-1","popper"===r&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:n}),t.jsx(fte,{})]})})));hte.displayName=ete.displayName;i.forwardRef((({className:e,...n},r)=>t.jsx(nte,{ref:r,className:Zd("px-2 py-1.5 text-sm font-semibold text-muted-foreground",e),...n}))).displayName=nte.displayName;const mte=i.forwardRef((({className:e,children:n,...r},o)=>t.jsxs(rte,{ref:o,className:Zd("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[t.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(ite,{children:t.jsx(pu,{className:"h-4 w-4"})})}),t.jsx(ote,{children:n})]})));mte.displayName=rte.displayName;i.forwardRef((({className:e,...n},r)=>t.jsx(lte,{ref:r,className:Zd("-mx-1 my-1 h-px bg-muted",e),...n}))).displayName=lte.displayName;const gte=({type:e})=>t.jsxs("div",{className:"w-full h-full min-h-[300px] flex flex-col items-center justify-center bg-gradient-to-b from-gray-50 to-white p-8",children:[t.jsx("div",{className:"mb-4 text-gray-300",children:t.jsx("svg",{className:"w-16 h-16",fill:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{d:"M20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 14H4V8l8 5 8-5v10zm-8-7L4 6h16l-8 5z"})})}),t.jsxs("p",{className:"text-gray-400 font-medium text-lg text-center mb-2",children:["No ","email"===e?"Email":"SMS"," Preview Available"]}),t.jsxs("p",{className:"text-gray-400 text-sm text-center",children:["Edit your ","email"===e?"Email":"SMS"," template to see a preview here"]})]}),vte=({html:e,height:n,width:r})=>t.jsx("div",{className:"w-full h-full bg-white rounded-lg border-0 overflow-hidden transition-all duration-300 ease-in-out flex flex-col items-center justify-center",children:e?t.jsx("div",{className:"w-full h-full flex items-center justify-center",children:t.jsx("iframe",{title:"Email Preview",srcDoc:e,className:"transition-opacity duration-300",style:{border:"none",backgroundColor:"white",height:n||"100%",width:r||"100%",maxWidth:"100%",maxHeight:"100%"}})}):t.jsx(gte,{type:"email"})}),yte=()=>t.jsxs("div",{className:"p-6 overflow-y-auto",children:[t.jsxs("div",{className:"mb-8 text-center",children:[t.jsx("h2",{className:"text-2xl font-semibold mb-2",children:"Email Editor Help Center"}),t.jsx("p",{className:"text-gray-500",children:"Learn how to use our email editor's powerful features"})]}),t.jsxs("div",{className:"space-y-4 max-w-xl mx-auto",children:[t.jsx("h3",{className:"text-lg font-medium",children:"Using Dynamic Content"}),t.jsxs("div",{className:"relative rounded-lg overflow-hidden bg-gray-50",children:[t.jsx("img",{src:"https://cdn.embedreach.com/assets/engage/merge-tags-demo.gif",alt:"Merge Tags Demo",className:"w-full shadow-lg max-w-md mx-auto"}),t.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/50 to-transparent p-4",children:t.jsx("p",{className:"text-white text-sm",children:"Demonstration: Adding merge tags to personalize your emails"})})]}),t.jsx("div",{className:"px-2",children:t.jsx(xZ,{onClick:()=>{},title:"Dynamic Content",subtitle:"Dynamic content is a way to insert dynamic content into your email such as the customer's name, email, or other details.",icon:t.jsx(ku,{}),selected:!0})})]})]}),bte=({type:e})=>t.jsxs("div",{className:"flex items-start space-x-2 text-sm text-gray-600",children:[t.jsx("svg",{className:"w-5 h-5 text-amber-500 flex-shrink-0 mt-0.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),t.jsxs("span",{children:["Please configure at least one ",e," sender before editing the template"]})]}),xte=({containerRef:e,stripoDialogDimensions:r,showSaving:o})=>(n.useEffect((()=>{const t=t=>{const n=e.current;if(!n)return;const r=n.querySelector("ui-editor");if(!r)return;const o=r.shadowRoot;if(!o)return;const i=o.host.getBoundingClientRect();const a=function(e){for(;e;){const t=getComputedStyle(e);if(("auto"===t.overflowY||"scroll"===t.overflowY)&&e.scrollHeight>e.clientHeight)return e;e=e.parentElement}return null}(o.elementFromPoint(t.clientX-i.left,t.clientY-i.top))||o.firstElementChild;a&&(a.scrollTop+=t.deltaY,a.scrollLeft+=t.deltaX,t.preventDefault())},n=e.current;return n&&n.addEventListener("wheel",t,{passive:!1}),()=>{n&&n.removeEventListener("wheel",t)}}),[e]),t.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center",children:[t.jsx("div",{id:"externalSystemContainer",className:"flex items-center px-4 py-2"}),o&&t.jsx("div",{className:"absolute top-0 left-0 w-full h-full bg-black/50 flex items-center justify-center z-50",children:t.jsx(hZ,{textColor:"text-white",text:["Saving..."]})}),t.jsx("div",{id:"stripoEditorContainer",ref:e,style:{width:r.width-75,height:r.height-75},className:"z-10"})]})),wte="UiEditorScript",_te=e=>new Promise(((t,n)=>{const r=()=>{let n=!0;e.updatedFromDefault&&(n=!1),window.UIEditor&&(window.UIEditor.initEditor(e.container,{forceRecreate:n,metadata:{emailId:e.emailId},html:e.html,css:e.css,locale:"en",onTokenRefreshRequest:e=>{Promise.resolve().then((async()=>{try{const{token:t}=await(async()=>(await Re(`${p}/token`)).data)();e(t)}catch(t){}}))},messageSettingsEnabled:!1,conditionsEnabled:!1,syncModulesEnabled:!1,notifications:{info:console.info,error:console.error,warn:console.warn,success:console.log},mergeTags:e.mergeFields}),t(void 0))};if(document.getElementById(wte))r();else{const e=document.createElement("script");e.id=wte,e.type="module",e.src="https://plugins.stripo.email/resources/uieditor/latest/UIEditor.js",e.onload=()=>{window.UIEditor?r():n(new Error("UIEditor not found after script load"))},e.onerror=e=>{n(e)},document.head.appendChild(e)}})),Ste=({automation:e,setShowStripoEditor:r,saveClicked:o,setSaveClicked:i,stripoDialogDimensions:a,mergeFieldsResponse:s,cancelClicked:l,setCancelClicked:c,actionId:u})=>{const d=n.useRef(!1),p=n.useRef(null),{data:f,isLoading:h}=(e=>{const{automationId:t,actionId:n}=e;return ve({queryKey:["stripo","templates",t,n],queryFn:()=>fZ({automationId:t,actionId:n}),..._e})})({automationId:e.id,actionId:u}),{data:m,isLoading:g}=(()=>{const e=ce();return{...ve({queryKey:dZ.editorData(),queryFn:pZ,..._e}),invalidateEditorData:()=>e.invalidateQueries({queryKey:dZ.editorData()})}})(),[v,y]=n.useState(!1),[b,x]=n.useState(!1),{updateCommunicationGroup:w}=KX(),_=n.useCallback((()=>{i(!1),c(!1),y(!1),x(!1),r(!1)}),[i,c,y,x,r]);return n.useEffect((()=>{if(o&&window.UIEditor&&f?.communicationGroupId&&window.StripoEditorApi?.actionsApi){window.StripoEditorApi.actionsApi.compileEmail({callback:function(e,t){e||(w({groupId:f.communicationGroupId,params:{emailHtmlBody:t}}),x(!0))},minimize:!0,mergeTags:[],forceAmp:!1,resetDataSavedFlag:!1,disableLineHeightsReplace:!0});window.StripoEditorApi.actionsApi.save((function(e){e||y(!0)}))}}),[o,p,i,r,f,w]),n.useEffect((()=>{(async()=>{v&&b&&(window.UIEditor&&window.UIEditor.removeEditor(),_())})()}),[v,b,r,i,_]),n.useEffect((()=>{l&&(window.UIEditor&&window.UIEditor.removeEditor(),_())}),[l,_]),n.useEffect((()=>{m?.businessId&&p.current&&f&&(d.current||(_te({emailId:f.communicationGroupId,html:f.html||"<div></div>",css:f.css||"",container:p.current,businessId:m.businessId,mergeFields:s.mergeFields||[],updatedFromDefault:f.updatedFromDefault}).catch((e=>{})),d.current=!0))}),[m,s,f]),t.jsx("div",h||g||!m||!f?{className:"w-full h-full flex flex-col items-center justify-center",children:t.jsx(hZ,{text:["Loading editor..."]})}:{className:"w-full h-full flex flex-col",children:t.jsx(xte,{containerRef:p,stripoDialogDimensions:a,showSaving:o})})},Ete=({mergeFieldsResponse:e})=>{const r=sZ(),o=aZ(),{updateCommunicationGroup:i}=KX(),{refetchAutomation:a}=ke(o?.id||""),{channelSenders:s}=w9(),{channelAccounts:l}=b9(),{updateChannelSender:c}=_9(),{state:{selectedActionId:u}}=n.useContext(VX),[d,p]=n.useState(!1),[f,h]=n.useState(r?.emailChannelSenderId||null),[m,g]=n.useState(r?.emailSubject||null),[v,y]=n.useState(r?.emailPreviewText||null),[b,x]=n.useState(r?.emailHtmlBody||null),[w,_]=n.useState(!1),[S,E]=n.useState(!1),[T,C]=n.useState(!1),[A,N]=n.useState(""),[R,O]=n.useState(""),[P,k]=n.useState(null),[M,j]=n.useState(!1),L=n.useRef(!0),[D,I]=n.useState(!0),[F,U]=n.useState(!1),[$,V]=n.useState({width:0,height:0}),[B,z]=n.useState(null),H=S9(m,500),q=S9(v,500),G=S9(A,500),K=S9(R,500),W=n.useMemo((()=>s?.results?.filter((e=>e.channelSenderMetadata.userPart))?.flatMap((e=>{const t=l?.results?.find((t=>t.id===e.channelAccountId));return t&&t.channelAccountMetadata.type===x9.REACH_MANAGED?[{channelSenderId:e.id,fullDomain:`${e.channelSenderMetadata.userPart}@${e.channelSenderMetadata.baseDomain}`}]:[]}))||[]),[s?.results,l?.results]),Y=n.useMemo((()=>({width:800,height:400})),[]),X=n.useRef(null);return n.useEffect((()=>{const e=setTimeout((()=>{L.current=!1}),500);return()=>clearTimeout(e)}),[]),n.useEffect((()=>{r?.emailHtmlBody&&x(r.emailHtmlBody)}),[r?.emailHtmlBody,a]),n.useEffect((()=>{if(d){const e=setTimeout((()=>{p(!1)}),2e3);return()=>clearTimeout(e)}}),[d]),n.useEffect((()=>{const e=()=>{V({width:window.innerWidth,height:window.innerHeight})};return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]),n.useEffect((()=>{if(!L.current&&f&&H&&b&&r?.id){p(!0);(async()=>{try{i({groupId:r.id,params:{emailChannelSenderId:f,emailHtmlBody:b,emailSubject:H,...q&&{emailPreviewText:q}}})}catch(e){}finally{p(!1)}})()}}),[f,H,q,b,r?.id,i]),n.useEffect((()=>{if(s?.results&&f){const e=s.results.find((e=>e.id===f));e&&(F&&!D||O(e.channelSenderMetadata.emailReplyTo),D&&N(e.channelSenderMetadata.emailFromName),I(!1))}}),[s?.results,f,F,D]),n.useEffect((()=>{if(s?.results&&!f){const e=s.results.filter((e=>e.channelSenderMetadata.userPart));if(e[0]){const t=e[0];h(t.id),i({groupId:r?.id||"",params:{emailChannelSenderId:t.id}})}}}),[s?.results,f,r?.id,i]),n.useEffect((()=>{if(!L.current&&G&&f){z("fromName");(async()=>{try{const e=s?.results?.find((e=>e.id===f));e&&await c({id:f,toUpdate:{channelSenderMetadata:{...e.channelSenderMetadata,emailFromName:G}}})}catch(e){}finally{z(null)}})()}}),[G,s?.results,f,c]),n.useEffect((()=>{if(K){const e=/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(K),t=/\p{Emoji}/u.test(K);k(t?"Emojis are not allowed in email addresses":e?null:"Please enter a valid email address")}else k(null)}),[K]),n.useEffect((()=>{const e=async e=>{try{const t=s?.results?.find((t=>t.id===e.fromEmail));t&&c({id:e.fromEmail,toUpdate:{channelSenderMetadata:{...t.channelSenderMetadata,emailReplyTo:e.debouncedReplyToEmail}}})}catch(t){}finally{z(null)}};L.current||!f||P||(z("replyToEmail"),e(K?{fromEmail:f,debouncedReplyToEmail:K}:{fromEmail:f,debouncedReplyToEmail:null}))}),[K,s?.results,f,c,P]),n.useEffect((()=>{!1===w&&r?.id&&a()}),[w,r?.id,a]),l&&s&&u?t.jsxs("div",{className:"relative",children:[t.jsx(_B,{open:M,onOpenChange:j,children:t.jsxs(TB,{className:"max-h-[86vh] gap-0 overflow-visible max-w-3xl w-full h-full",children:[t.jsxs(n$,{children:[t.jsx(NB,{children:"Email Preview Help"}),t.jsx(RB,{children:"Learn more about the email preview and how to use it to create your email."})]}),t.jsx(yte,{})]})}),t.jsx(_B,{open:w,onOpenChange:_,children:t.jsxs(TB,{className:"min-w-[100vw] min-h-[100vh]",hideCloseButton:!0,onEscapeKeyDown:e=>{e.preventDefault()},children:[t.jsxs(n$,{children:[t.jsx(NB,{children:"Email Editor"}),t.jsx(RB,{children:"Learn more about the email editor and how to use it to create your email."})]}),t.jsxs("div",{className:"w-full h-full",children:[t.jsxs("div",{className:"flex justify-between items-center p-1 border-b",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("h2",{className:"text-lg font-medium",children:"Email Editor"}),t.jsx(T9,{title:"Click to learn more about email template ",onClick:()=>j(!0)})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(vZ,{variant:"destructive",onClick:()=>{C(!0)},className:"text-sm px-3 py-1 rounded",children:"Cancel"}),t.jsx(vZ,{onClick:()=>E(!0),className:"text-sm px-3 py-1 rounded",children:"Save"})]})]}),t.jsx("div",{className:" w-full",children:o&&t.jsx(Ste,{cancelClicked:T,setCancelClicked:C,showStripoEditor:w,automation:o,setShowStripoEditor:_,saveClicked:S,setSaveClicked:E,stripoDialogDimensions:$,mergeFieldsResponse:e,actionId:u})})]})]})}),t.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx(L9,{children:"From Email"}),t.jsxs(cte,{onValueChange:e=>{h(e),I(!0),U(!1)},value:f??void 0,disabled:d,children:[t.jsx(dte,{children:t.jsx(ute,{placeholder:"Select email",className:"text-muted-foreground",children:f?W?.find((e=>e.channelSenderId===f))?.fullDomain:""})}),t.jsx(hte,{children:W?.map((e=>t.jsx(mte,{value:e.channelSenderId,children:e.fullDomain},e.channelSenderId)))})]})]}),t.jsxs("div",{children:[t.jsx(L9,{className:"",children:t.jsxs("div",{className:"flex items-center gap-2 py-1",children:["From Name",t.jsx(T9,{title:"This will be the friendly name of the sender that the customer will see in the inbox",alertText:"Changes to the sender name will be applied across all emails using this address"})]})}),t.jsx(q3,{placeholder:"Enter from name",value:A??"",onChange:e=>N(e.target.value),className:"text-muted-foreground",disabled:d&&"fromName"!==B||!f||D})]}),t.jsxs("div",{children:[t.jsx(L9,{className:"",children:t.jsxs("div",{className:"flex items-center gap-2 py-1",children:["Reply To Email",t.jsx(T9,{title:"This will be the email address that customer can reply to on the email",alertText:"Changes to the reply to email will be applied across all emails using this address"})]})}),t.jsx(q3,{placeholder:"Enter reply to email",value:R??"",className:"text-muted-foreground",onChange:e=>{O(e.target.value),F||U(!0)},disabled:d&&"replyToEmail"!==B||!f||D}),P&&t.jsx("p",{className:"text-sm text-red-500 mt-1",children:P})]}),t.jsxs("div",{children:[t.jsx(L9,{children:"Subject"}),t.jsx(q3,{placeholder:"Enter email subject",className:"text-muted-foreground",value:m??"",onChange:e=>g(e.target.value),disabled:d||D})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-2 py-1",children:[t.jsx(L9,{children:"Preview Text"}),t.jsx(T9,{title:"This text will be used for the preview text of the email in the inbox"})]}),t.jsx(q3,{placeholder:"Enter preview text",className:"text-muted-foreground",value:v??"",onChange:e=>y(e.target.value),disabled:d||D})]})]}),t.jsxs("div",{className:"border rounded-lg p-4 h-full flex flex-col",children:[t.jsxs("div",{className:"flex justify-between items-center mb-4",children:[t.jsx("h3",{className:"font-medium",children:"Preview"}),t.jsxs("div",{children:[t.jsx(vZ,{onClick:()=>_(!0),className:"text-sm px-3 py-1 rounded",disabled:d||0===(W?.length??0),children:"Edit"}),0===(W?.length??0)&&t.jsx("div",{className:"relative inline-block",children:t.jsx("div",{className:"absolute right-0 top-full mt-2 w-64 p-3 bg-white border rounded-lg shadow-lg z-10",children:t.jsx(bte,{type:"email"})})})]})]}),t.jsx("div",{className:"flex-1 w-full overflow-auto",ref:X,style:{height:"400px"},children:t.jsx(vte,{html:b??"",height:Y.height,width:Y.width})})]})]})]}):t.jsx("div",{className:"flex justify-center items-center flex-1 h-full bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative",children:t.jsx(hZ,{text:["Fetching Email Preview..."]})})};function Tte(e){const t=i.useRef({value:e,previous:e});return i.useMemo((()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous)),[e])}var Cte="Checkbox",[Ate,Nte]=UQ(Cte),[Rte,Ote]=Ate(Cte),Pte=i.forwardRef(((e,n)=>{const{__scopeCheckbox:r,name:o,checked:a,defaultChecked:s,required:l,disabled:c,value:u="on",onCheckedChange:d,form:p,...f}=e,[h,m]=i.useState(null),g=XU(n,(e=>m(e))),v=i.useRef(!1),y=!h||(p||!!h.closest("form")),[b=!1,x]=BQ({prop:a,defaultProp:s,onChange:d}),w=i.useRef(b);return i.useEffect((()=>{const e=h?.form;if(e){const t=()=>x(w.current);return e.addEventListener("reset",t),()=>e.removeEventListener("reset",t)}}),[h,x]),t.jsxs(Rte,{scope:r,state:b,disabled:c,children:[t.jsx(WQ.button,{type:"button",role:"checkbox","aria-checked":Lte(b)?"mixed":b,"aria-required":l,"data-state":Dte(b),"data-disabled":c?"":void 0,disabled:c,value:u,...f,ref:g,onKeyDown:FQ(e.onKeyDown,(e=>{"Enter"===e.key&&e.preventDefault()})),onClick:FQ(e.onClick,(e=>{x((e=>!!Lte(e)||!e)),y&&(v.current=e.isPropagationStopped(),v.current||e.stopPropagation())}))}),y&&t.jsx(jte,{control:h,bubbles:!v.current,name:o,value:u,checked:b,required:l,disabled:c,form:p,style:{transform:"translateX(-100%)"},defaultChecked:!Lte(s)&&s})]})}));Pte.displayName=Cte;var kte="CheckboxIndicator",Mte=i.forwardRef(((e,n)=>{const{__scopeCheckbox:r,forceMount:o,...i}=e,a=Ote(kte,r);return t.jsx(T1,{present:o||Lte(a.state)||!0===a.state,children:t.jsx(WQ.span,{"data-state":Dte(a.state),"data-disabled":a.disabled?"":void 0,...i,ref:n,style:{pointerEvents:"none",...e.style}})})}));Mte.displayName=kte;var jte=e=>{const{control:n,checked:r,bubbles:o=!0,defaultChecked:a,...s}=e,l=i.useRef(null),c=Tte(r),u=t1(n);i.useEffect((()=>{const e=l.current,t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,"checked").set;if(c!==r&&n){const t=new Event("click",{bubbles:o});e.indeterminate=Lte(r),n.call(e,!Lte(r)&&r),e.dispatchEvent(t)}}),[c,r,o]);const d=i.useRef(!Lte(r)&&r);return t.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:a??d.current,...s,tabIndex:-1,ref:l,style:{...e.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Lte(e){return"indeterminate"===e}function Dte(e){return Lte(e)?"indeterminate":e?"checked":"unchecked"}var Ite=Pte,Fte=Mte;const Ute=({selectedChannels:e,setSelectedChannels:n,hasEmailChannelSenders:r,hasSmsChannelSenders:o,automationType:i})=>{const{toast:a}=jl(),s=[...r?[{label:"Email",value:"email",icon:wZ.EmailIcon,checked:e.includes("email")}]:[],...o?[{label:"SMS",value:"sms",icon:wZ.SmsIcon,checked:e.includes("sms")}]:[]];return t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-xl font-medium",children:"Message Types"}),t.jsx("p",{className:"text-gray-600 mb-2 text-sm",children:"Select the channels you want to use in this automation"})]}),t.jsx("div",{className:"w-full grid grid-cols-2 gap-3",children:s.map((r=>t.jsxs(Ite,{checked:r.checked,onCheckedChange:()=>{"email"===r.value?e.includes("email")?e.includes("sms")?n(["sms"]):a({title:"Cant Remove Email",description:`At least one channel is required for an ${i===Fe.ONE_TIME?ff("engage:one_time").toLowerCase():ff("engage:automation").toLowerCase()}`,variant:"destructive"}):n([...e,"email"]):e.includes("sms")?e.includes("email")?n(["email"]):a({title:"Cant Remove SMS",description:`At least one channel is required for an ${i===Fe.ONE_TIME?ff("engage:one_time").toLowerCase():ff("engage:automation").toLowerCase()}`,variant:"destructive"}):n([...e,"sms"])},className:"relative ring-[1px] ring-border rounded-lg px-4 py-3 text-start text-muted-foreground data-[state=checked]:ring-2 data-[state=checked]:ring-primary data-[state=checked]:font-medium",children:[t.jsx(r.icon,{className:"mb-3",size:20}),t.jsx("span",{className:"font-medium tracking-tight",children:r.label}),t.jsx(Fte,{className:"absolute top-2 right-2",children:t.jsx(bu,{className:"fill-primary text-primary-foreground"})})]},r.value)))})]})},$te=async()=>(await Re(s)).data,Vte=["me"],Bte=()=>ve({queryKey:Vte,queryFn:$te,..._e}),zte=()=>{const e=ce(),t=Bte(),n=ye({mutationFn:e=>(async e=>(await Re(s,{method:"PATCH",body:JSON.stringify({website:e})})).data)(e),onSuccess:()=>{e.invalidateQueries({queryKey:Vte})}}),r=ye({mutationFn:e=>(async e=>(await Re(s,{method:"PATCH",body:JSON.stringify({locations:e})})).data)(e),onSuccess:()=>{e.invalidateQueries({queryKey:Vte})}}),o=ye({mutationFn:e=>(async e=>(await Re(s,{method:"PATCH",body:JSON.stringify({branding:e})})).data)(e),onSuccess:()=>{e.invalidateQueries({queryKey:Vte})}});return{data:t.data,isLoading:t.isLoading,error:t.error,refetch:t.refetch,updateWebsite:n.mutate,updateLocations:r.mutate,updateBrandSettings:o.mutate,isUpdatingWebsite:n.isPending,isUpdatingLocations:r.isPending,isUpdatingBrandSettings:o.isPending}},Hte=i.forwardRef((({className:e,...n},r)=>t.jsx("textarea",{className:Zd("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:r,...n})));Hte.displayName="Textarea";const qte=e=>{const{companyName:t,smsBody:n}=e;return t&&n?`${t}:\n${n}`:n??""},Gte=({body:e})=>t.jsx("div",{className:"sms-preview-outer @container",children:t.jsxs("div",{className:"sms-phone-mockup",children:[t.jsx("div",{className:"sms-phone-notch"}),t.jsx("div",{className:"sms-phone-inner",children:t.jsx("div",{className:"sms-message-row",children:t.jsx("div",{className:"sms-message-bubble",children:e})})}),t.jsx("div",{className:"sms-phone-home-indicator"})]})}),Kte=({mergeFieldsResponse:e,smsChannelSenders:r})=>{const o=aZ(),i=sZ(),a=n.useCallback((()=>{const e=o?.actionData?.find((e=>"send_communication"===e.actionType&&e.actionMetadata.communicationGroupId===i?.id));return e?.actionMetadata.communicationGroupId}),[o?.actionData,i?.id]),{channelSenders:s}=w9(),{data:l,isLoading:c}=Bte(),{channelAccounts:u}=b9(),{updateCommunicationGroup:d}=KX(),[p,f]=n.useState(!1),[h,m]=n.useState(""),[g,v]=n.useState(null),[y,b]=n.useState(!1),[x,w]=n.useState(null),[_,S]=n.useState(null),[E,T]=n.useState(!1),C=n.useRef(null),A=S9(_,1e3),N=S9(g,1e3),R=S9(x,1e3);n.useEffect((()=>{if(null!==N&&null!==A&&!p){f(!0);const e=a();e&&d({groupId:e,params:{smsChannelSenderId:N,smsMessageBody:A,textMessageCompanyName:R}}),f(!1)}}),[N,A,R,p,d,a]),n.useEffect((()=>{i&&(v(i.smsChannelSenderId),S(i.smsMessageBody),i.textMessageCompanyName&&w(i.textMessageCompanyName))}),[i]);return n.useEffect((()=>{if(void 0!==s&&!g){const e=s.results.filter((e=>e.channelSenderMetadata.from||e.channelSenderMetadata.messageServiceSid));e?.[0]&&(v(e[0].id),i?.id&&d({groupId:i.id,params:{smsChannelSenderId:e[0].id}}))}}),[s,g,i?.id,d]),n.useEffect((()=>{x||!l?.name||y||(b(!0),w(l.name))}),[x,l?.name,y]),u&&s&&!c?t.jsxs("div",{children:[t.jsx(_B,{open:E,onOpenChange:T,children:t.jsxs(TB,{children:[t.jsxs(n$,{children:[t.jsx(NB,{children:"SMS Editor"}),t.jsx(RB,{children:"Learn more about the SMS editor and how to use it to create your SMS."})]}),t.jsxs("div",{className:"",children:[t.jsx(Hte,{ref:C,className:"min-h-[300px]",placeholder:"Text message content...",value:_??"",onChange:e=>{S(e.target.value)},maxLength:1600-(x?.length||0)}),t.jsxs("div",{className:"mt-2 flex items-center justify-end gap-2",children:[t.jsxs(cte,{value:h,onValueChange:e=>{const t=C.current,n=_||"",r=t?.selectionStart??n.length,o=t?.selectionEnd??n.length,i=n.slice(0,r)+e+n.slice(o);S(i),m(""),setTimeout((()=>{const n=r+e.length;t?.focus(),t?.setSelectionRange(n,n)}),0)},children:[t.jsx(dte,{className:"w-[50px]",children:t.jsx(wZ.MergeField,{className:"w-4 h-4 text-primary"})}),t.jsx(hte,{children:e?.mergeFields?.map((e=>e.entries.map((e=>t.jsx(mte,{value:e.value,children:e.label},e.value))))).flat()})]}),t.jsx(T9,{title:"Dynamic content is a way to insert dynamic content into your messages such as the customer's name, email, or other details."})]}),t.jsxs("div",{className:"flex justify-end mt-2 text-sm transition-colors duration-300 "+(_&&_.length>1400?_.length>=1600?"text-red-500":"text-amber-500":"text-gray-500"),children:[_?_.length:0,"/",1600-(x?.length||0)," ","characters"]})]})]})}),t.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx(L9,{children:"From Number"}),t.jsxs(cte,{onValueChange:e=>{v(e)},value:g??void 0,children:[t.jsx(dte,{children:t.jsx(ute,{placeholder:"Select number",children:g?(O=g,r?.find((e=>e.id===O))?.channelSenderMetadata.friendlyName??r?.find((e=>e.id===O))?.channelSenderMetadata.from??O):"Select number"})}),t.jsx(hte,{children:r?.map((e=>t.jsx(mte,{value:e.id,children:e.channelSenderMetadata.friendlyName??e.channelSenderMetadata.from??"Select number"},e.id)))})]})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-2 py-1",children:[t.jsx(L9,{children:"Company Name"}),t.jsx(T9,{title:"Adding your company name can help customers identify who they are talking to"})]}),t.jsx(q3,{placeholder:"Enter company name",value:x??"",className:"text-muted-foreground",onChange:e=>{w(e.target.value??null)},disabled:!g})]})]}),t.jsxs("div",{className:"border rounded-lg p-4",children:[t.jsxs("div",{className:"flex justify-between items-center mb-4",children:[t.jsx("h3",{className:"font-medium",children:"Preview"}),t.jsx("div",{children:t.jsx(vZ,{onClick:()=>T(!0),className:"text-sm px-3 py-1 rounded ",disabled:0===(r?.length??0),children:"Edit"})})]}),t.jsx("div",{children:g?t.jsx(t.Fragment,{children:g&&_?t.jsx(Gte,{body:qte({companyName:x??void 0,smsBody:_})}):t.jsx(gte,{type:"sms"})}):t.jsx(bte,{type:"sms"})})]})]})]}):t.jsx("div",{children:t.jsx(hZ,{text:["Loading..."]})});var O};var Wte=(e=>(e.CUSTOM="custom",e.MANAGED="managed",e))(Wte||{}),Yte=(e=>(e.EditAudience="edit-audience",e.EditTime="edit-time",e))(Yte||{});const Xte=({title:e,type:r})=>{const o=sZ(),i=aZ(),{toast:a}=jl(),s=ce(),[l,c]=n.useState(!1),[u,p]=n.useState(!1),f=!!o&&(o.type===Wte.MANAGED&&("sms"===r?o.updatedFromDefault?.text_message_body:o.updatedFromDefault?.email_text_body||o.updatedFromDefault?.email_html_body));return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h4",{className:"text-xl font-medium",children:e}),t.jsx("div",{className:"flex items-center gap-2",children:f&&t.jsx(t.Fragment,{children:l?t.jsx(hZ,{}):t.jsx(vZ,{variant:"outline",size:"sm",onClick:()=>p(!0),children:"Reset To Default"})})})]}),t.jsx(_B,{open:u,onOpenChange:p,children:t.jsxs(TB,{className:"sm:max-w-[425px]",children:[t.jsxs(CB,{children:[t.jsx(NB,{className:"text-xl font-semibold",children:"Reset to Default"}),t.jsxs(RB,{className:"text-base text-muted-foreground",children:["Are you sure you want to reset this"," ","email"===r?"email":"SMS"," template to its default state? This action cannot be undone."]})]}),t.jsxs(AB,{className:"flex flex-row justify-end gap-3 mt-6",children:[t.jsx(vZ,{variant:"outline",onClick:()=>p(!1),children:"Cancel"}),t.jsx(vZ,{variant:"destructive",onClick:async()=>{o&&i?(c(!0),await(async e=>{const{communicationGroupId:t,automationId:n,type:r}=e;return(await Re(`${d}/${t}/${n}/reset`,{method:"POST",body:JSON.stringify({type:r})})).data})({communicationGroupId:o.id,automationId:i.id,type:r}),s.invalidateQueries({queryKey:qX.all}),a({title:"Communication reset to default!"}),c(!1),p(!1)):a({title:"Error resetting communication",description:"Please contact your administrator",variant:"destructive"})},children:"Reset to Default"})]})]})})]})},Zte=({getExtraMergeFields:e})=>{const[r,o]=n.useState(null),i=n.useRef(null),{toast:a}=jl(),s=sZ(),{channelSenders:l}=w9(),{channelAccounts:c}=b9(),{updateCommunicationGroup:u}=KX(),d=aZ(),{getMergeFields:p,isGetting:f}=(e=>{const t=ve({queryKey:["merge-fields",e],queryFn:()=>HX(e)});return{getMergeFields:t.data,isGetting:t.isPending,getError:t.error,isGetSuccess:t.isSuccess}})(s?.id??void 0),[h,m]=n.useState(void 0);n.useEffect((()=>{const e=s?.id;e&&r&&(r.includes("email")||null===s?.emailChannelSenderId||u({groupId:e,params:{emailChannelSenderId:null}}),r.includes("sms")||null===s?.smsChannelSenderId||u({groupId:e,params:{smsChannelSenderId:null}}))}),[r,u,s]),n.useEffect((()=>{const e=s?.id;e||r||o(["email"])}),[d,s,r]);const g=n.useCallback((e=>{const t=[];e.emailChannelSenderId&&t.push("email"),e.smsChannelSenderId&&t.push("sms"),0===t.length&&t.push("email"),o(t)}),[]);n.useEffect((()=>{s&&!r&&g(s)}),[s,g,r]),n.useEffect((()=>{f||void 0===h&&(e?e().then((e=>{s?.id&&(g(s),u({groupId:s?.id,params:{extraMergeFields:e}},{onSuccess:async()=>{try{const e=await HX(s?.id);m(e)}catch{a({title:"Error saving merge fields!",description:"Please contact your administrator if this issue persists.",variant:"destructive"})}},onError:e=>{a({title:"Error saving merge fields!",description:"Please contact your administrator if this issue persists.",variant:"destructive"})}}))})):m(p))}),[e,u,s,a,f,p,h,g]);const v=n.useMemo((()=>l?.results?.filter((e=>e.channelSenderMetadata.userPart))?.flatMap((e=>{const t=c?.results?.find((t=>t.id===e.channelAccountId));return t&&t.channelAccountMetadata.type===x9.REACH_MANAGED?[{channelSenderId:e.id,fullDomain:`${e.channelSenderMetadata.userPart}@${e.channelSenderMetadata.baseDomain}`}]:[]}))||[]),[l?.results,c?.results]),y=n.useMemo((()=>l?.results.filter((e=>e.channelSenderMetadata.from||e.channelSenderMetadata.messageServiceSid))),[l?.results]);if(!r||f||!h||!v||!y)return t.jsx("div",{className:"flex justify-center items-center flex-1 h-full bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative",children:t.jsx(hZ,{text:["Fetching Content..."]})});const b=v.length>0,x=y.length>0;return t.jsxs("div",{className:"flex flex-col gap-4 flex-shrink-0",children:[t.jsx("div",{className:"bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative",children:t.jsx(Ute,{automationType:d?.triggerMetadata?.triggerType,selectedChannels:r,setSelectedChannels:o,hasEmailChannelSenders:b,hasSmsChannelSenders:x})}),r.includes("email")&&t.jsxs("div",{className:"bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative",ref:i,children:[t.jsx(Xte,{title:"Email Campaign",type:"email"}),t.jsx(Ete,{mergeFieldsResponse:h,emailChannelSendersWithChannelAccounts:v})]}),r.includes("sms")&&t.jsxs("div",{className:"bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative",children:[t.jsx(Xte,{title:"SMS Campaign",type:"sms"}),t.jsx(Kte,{mergeFieldsResponse:h,smsChannelSenders:y})]})]})},Qte=({content:e,className:n})=>t.jsx("div",{className:wB("flex flex-col gap-4 w-full p-6",n),children:t.jsx("div",{className:"bg-white rounded-2xl w-full border border-gray-200 p-6 relative",children:e})}),Jte=e=>e.friendlyName||e.from||e.messageServiceSid||"Unknown Sender";function ene(e,t){throw new Error(`Unreachable case statement: ${JSON.stringify(e)}. Valid values are: ${Object.values(t).join(", ")}`)}function tne(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),!1===n||!r.defaultPrevented)return t?.(r)}}function nne(e,n=[]){let r=[];const o=()=>{const t=r.map((e=>i.createContext(e)));return function(n){const r=n?.[e]||t;return i.useMemo((()=>({[`__scope${e}`]:{...n,[e]:r}})),[n,r])}};return o.scopeName=e,[function(n,o){const a=i.createContext(o),s=r.length;r=[...r,o];const l=n=>{const{scope:r,children:o,...l}=n,c=r?.[e]?.[s]||a,u=i.useMemo((()=>l),Object.values(l));return t.jsx(c.Provider,{value:u,children:o})};return l.displayName=n+"Provider",[l,function(t,r){const l=i.useContext(r?.[e]?.[s]||a);if(l)return l;if(void 0!==o)return o;throw new Error(`\`${t}\` must be used within \`${n}\``)}]},rne(o,...n)]}function rne(...e){const t=e[0];if(1===e.length)return t;const n=()=>{const n=e.map((e=>({useScope:e(),scopeName:e.scopeName})));return function(e){const r=n.reduce(((t,{useScope:n,scopeName:r})=>({...t,...n(e)[`__scope${r}`]})),{});return i.useMemo((()=>({[`__scope${t.scopeName}`]:r})),[r])}};return n.scopeName=t.scopeName,n}function one(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function ine(...e){return t=>{let n=!1;const r=e.map((e=>{const r=one(e,t);return n||"function"!=typeof r||(n=!0),r}));if(n)return()=>{for(let t=0;t<r.length;t++){const n=r[t];"function"==typeof n?n():one(e[t],null)}}}}function ane(...e){return i.useCallback(ine(...e),e)}function sne(e){const n=lne(e),r=i.forwardRef(((e,r)=>{const{children:o,...a}=e,s=i.Children.toArray(o),l=s.find(une);if(l){const e=l.props.children,o=s.map((t=>t===l?i.Children.count(e)>1?i.Children.only(null):i.isValidElement(e)?e.props.children:null:t));return t.jsx(n,{...a,ref:r,children:i.isValidElement(e)?i.cloneElement(e,void 0,o):null})}return t.jsx(n,{...a,ref:r,children:o})}));return r.displayName=`${e}.Slot`,r}function lne(e){const t=i.forwardRef(((e,t)=>{const{children:n,...r}=e;if(i.isValidElement(n)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(n),o=function(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{i(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]={...o,...i}:"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==i.Fragment&&(o.ref=t?ine(t,e):e),i.cloneElement(n,o)}return i.Children.count(n)>1?i.Children.only(null):null}));return t.displayName=`${e}.SlotClone`,t}var cne=Symbol("radix.slottable");function une(e){return i.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===cne}var dne=globalThis?.document?i.useLayoutEffect:()=>{},pne=i[" useId ".trim().toString()]||(()=>{}),fne=0;function hne(e){const[t,n]=i.useState(pne());return dne((()=>{n((e=>e??String(fne++)))}),[e]),e||(t?`radix-${t}`:"")}var mne=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce(((e,n)=>{const r=sne(`Primitive.${n}`),o=i.forwardRef(((e,o)=>{const{asChild:i,...a}=e,s=i?r:n;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t.jsx(s,{...a,ref:o})}));return o.displayName=`Primitive.${n}`,{...e,[n]:o}}),{});var gne=i[" useInsertionEffect ".trim().toString()]||dne;function vne({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,a,s]=function({defaultProp:e,onChange:t}){const[n,r]=i.useState(e),o=i.useRef(n),a=i.useRef(t);return gne((()=>{a.current=t}),[t]),i.useEffect((()=>{o.current!==n&&(a.current?.(n),o.current=n)}),[n,o]),[n,r,a]}({defaultProp:t,onChange:n}),l=void 0!==e,c=l?e:o;{const t=i.useRef(void 0!==e);i.useEffect((()=>{const e=t.current;if(e!==l){}t.current=l}),[l,r])}const u=i.useCallback((t=>{if(l){const n=function(e){return"function"==typeof e}(t)?t(e):t;n!==e&&s.current?.(n)}else a(t)}),[l,e,a,s]);return[c,u]}var yne=i.createContext(void 0);function bne(e){const t=i.useContext(yne);return e||t||"ltr"}var xne="rovingFocusGroup.onEntryFocus",wne={bubbles:!1,cancelable:!0},_ne="RovingFocusGroup",[Sne,Ene,Tne]=function(e){const r=e+"CollectionProvider",[o,i]=nne(r),[a,s]=o(r,{collectionRef:{current:null},itemMap:new Map}),l=e=>{const{scope:r,children:o}=e,i=n.useRef(null),s=n.useRef(new Map).current;return t.jsx(a,{scope:r,itemMap:s,collectionRef:i,children:o})};l.displayName=r;const c=e+"CollectionSlot",u=sne(c),d=n.forwardRef(((e,n)=>{const{scope:r,children:o}=e,i=ane(n,s(c,r).collectionRef);return t.jsx(u,{ref:i,children:o})}));d.displayName=c;const p=e+"CollectionItemSlot",f="data-radix-collection-item",h=sne(p),m=n.forwardRef(((e,r)=>{const{scope:o,children:i,...a}=e,l=n.useRef(null),c=ane(r,l),u=s(p,o);return n.useEffect((()=>(u.itemMap.set(l,{ref:l,...a}),()=>{u.itemMap.delete(l)}))),t.jsx(h,{[f]:"",ref:c,children:i})}));return m.displayName=p,[{Provider:l,Slot:d,ItemSlot:m},function(t){const r=s(e+"CollectionConsumer",t);return n.useCallback((()=>{const e=r.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${f}]`));return Array.from(r.itemMap.values()).sort(((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current)))}),[r.collectionRef,r.itemMap])},i]}(_ne),[Cne,Ane]=nne(_ne,[Tne]),[Nne,Rne]=Cne(_ne),One=i.forwardRef(((e,n)=>t.jsx(Sne.Provider,{scope:e.__scopeRovingFocusGroup,children:t.jsx(Sne.Slot,{scope:e.__scopeRovingFocusGroup,children:t.jsx(Pne,{...e,ref:n})})})));One.displayName=_ne;var Pne=i.forwardRef(((e,n)=>{const{__scopeRovingFocusGroup:r,orientation:o,loop:a=!1,dir:s,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:d,preventScrollOnEntryFocus:p=!1,...f}=e,h=i.useRef(null),m=ane(n,h),g=bne(s),[v,y]=vne({prop:l,defaultProp:c??null,onChange:u,caller:_ne}),[b,x]=i.useState(!1),w=function(e){const t=i.useRef(e);return i.useEffect((()=>{t.current=e})),i.useMemo((()=>(...e)=>t.current?.(...e)),[])}(d),_=Ene(r),S=i.useRef(!1),[E,T]=i.useState(0);return i.useEffect((()=>{const e=h.current;if(e)return e.addEventListener(xne,w),()=>e.removeEventListener(xne,w)}),[w]),t.jsx(Nne,{scope:r,orientation:o,dir:g,loop:a,currentTabStopId:v,onItemFocus:i.useCallback((e=>y(e)),[y]),onItemShiftTab:i.useCallback((()=>x(!0)),[]),onFocusableItemAdd:i.useCallback((()=>T((e=>e+1))),[]),onFocusableItemRemove:i.useCallback((()=>T((e=>e-1))),[]),children:t.jsx(mne.div,{tabIndex:b||0===E?-1:0,"data-orientation":o,...f,ref:m,style:{outline:"none",...e.style},onMouseDown:tne(e.onMouseDown,(()=>{S.current=!0})),onFocus:tne(e.onFocus,(e=>{if(e.target===e.currentTarget&&!S.current&&!b){const t=new CustomEvent(xne,wne);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=_().filter((e=>e.focusable));Lne([e.find((e=>e.active)),e.find((e=>e.id===v)),...e].filter(Boolean).map((e=>e.ref.current)),p)}}S.current=!1})),onBlur:tne(e.onBlur,(()=>x(!1)))})})})),kne="RovingFocusGroupItem",Mne=i.forwardRef(((e,n)=>{const{__scopeRovingFocusGroup:r,focusable:o=!0,active:a=!1,tabStopId:s,children:l,...c}=e,u=hne(),d=s||u,p=Rne(kne,r),f=p.currentTabStopId===d,h=Ene(r),{onFocusableItemAdd:m,onFocusableItemRemove:g,currentTabStopId:v}=p;return i.useEffect((()=>{if(o)return m(),()=>g()}),[o,m,g]),t.jsx(Sne.ItemSlot,{scope:r,id:d,focusable:o,active:a,children:t.jsx(mne.span,{tabIndex:f?0:-1,"data-orientation":p.orientation,...c,ref:n,onMouseDown:tne(e.onMouseDown,(e=>{o?p.onItemFocus(d):e.preventDefault()})),onFocus:tne(e.onFocus,(()=>p.onItemFocus(d))),onKeyDown:tne(e.onKeyDown,(e=>{if("Tab"===e.key&&e.shiftKey)return void p.onItemShiftTab();if(e.target!==e.currentTarget)return;const t=function(e,t,n){const r=function(e,t){return"rtl"!==t?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}(e.key,n);return"vertical"===t&&["ArrowLeft","ArrowRight"].includes(r)||"horizontal"===t&&["ArrowUp","ArrowDown"].includes(r)?void 0:jne[r]}(e,p.orientation,p.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let o=h().filter((e=>e.focusable)).map((e=>e.ref.current));if("last"===t)o.reverse();else if("prev"===t||"next"===t){"prev"===t&&o.reverse();const i=o.indexOf(e.currentTarget);o=p.loop?(r=i+1,(n=o).map(((e,t)=>n[(r+t)%n.length]))):o.slice(i+1)}setTimeout((()=>Lne(o)))}var n,r})),children:"function"==typeof l?l({isCurrentTabStop:f,hasTabStop:null!=v}):l})})}));Mne.displayName=kne;var jne={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Lne(e,t=!1){const n=document.activeElement;for(const r of e){if(r===n)return;if(r.focus({preventScroll:t}),document.activeElement!==n)return}}var Dne=One,Ine=Mne;var Fne=e=>{const{present:t,children:n}=e,r=function(e){const[t,n]=i.useState(),r=i.useRef(null),o=i.useRef(e),a=i.useRef("none"),s=e?"mounted":"unmounted",[l,c]=function(e,t){return i.useReducer(((e,n)=>t[e][n]??e),e)}(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return i.useEffect((()=>{const e=Une(r.current);a.current="mounted"===l?e:"none"}),[l]),dne((()=>{const t=r.current,n=o.current;if(n!==e){const r=a.current,i=Une(t);if(e)c("MOUNT");else if("none"===i||"none"===t?.display)c("UNMOUNT");else{c(n&&r!==i?"ANIMATION_OUT":"UNMOUNT")}o.current=e}}),[e,c]),dne((()=>{if(t){let e;const n=t.ownerDocument.defaultView??window,i=i=>{const a=Une(r.current).includes(i.animationName);if(i.target===t&&a&&(c("ANIMATION_END"),!o.current)){const r=t.style.animationFillMode;t.style.animationFillMode="forwards",e=n.setTimeout((()=>{"forwards"===t.style.animationFillMode&&(t.style.animationFillMode=r)}))}},s=e=>{e.target===t&&(a.current=Une(r.current))};return t.addEventListener("animationstart",s),t.addEventListener("animationcancel",i),t.addEventListener("animationend",i),()=>{n.clearTimeout(e),t.removeEventListener("animationstart",s),t.removeEventListener("animationcancel",i),t.removeEventListener("animationend",i)}}c("ANIMATION_END")}),[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:i.useCallback((e=>{r.current=e?getComputedStyle(e):null,n(e)}),[])}}(t),o="function"==typeof n?n({present:r.isPresent}):i.Children.only(n),a=ane(r.ref,function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(o));return"function"==typeof n||r.isPresent?i.cloneElement(o,{ref:a}):null};function Une(e){return e?.animationName||"none"}Fne.displayName="Presence";var $ne="Tabs",[Vne,Bne]=nne($ne,[Ane]),zne=Ane(),[Hne,qne]=Vne($ne),Gne=i.forwardRef(((e,n)=>{const{__scopeTabs:r,value:o,onValueChange:i,defaultValue:a,orientation:s="horizontal",dir:l,activationMode:c="automatic",...u}=e,d=bne(l),[p,f]=vne({prop:o,onChange:i,defaultProp:a??"",caller:$ne});return t.jsx(Hne,{scope:r,baseId:hne(),value:p,onValueChange:f,orientation:s,dir:d,activationMode:c,children:t.jsx(mne.div,{dir:d,"data-orientation":s,...u,ref:n})})}));Gne.displayName=$ne;var Kne="TabsList",Wne=i.forwardRef(((e,n)=>{const{__scopeTabs:r,loop:o=!0,...i}=e,a=qne(Kne,r),s=zne(r);return t.jsx(Dne,{asChild:!0,...s,orientation:a.orientation,dir:a.dir,loop:o,children:t.jsx(mne.div,{role:"tablist","aria-orientation":a.orientation,...i,ref:n})})}));Wne.displayName=Kne;var Yne="TabsTrigger",Xne=i.forwardRef(((e,n)=>{const{__scopeTabs:r,value:o,disabled:i=!1,...a}=e,s=qne(Yne,r),l=zne(r),c=Jne(s.baseId,o),u=ere(s.baseId,o),d=o===s.value;return t.jsx(Ine,{asChild:!0,...l,focusable:!i,active:d,children:t.jsx(mne.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:c,...a,ref:n,onMouseDown:tne(e.onMouseDown,(e=>{i||0!==e.button||!1!==e.ctrlKey?e.preventDefault():s.onValueChange(o)})),onKeyDown:tne(e.onKeyDown,(e=>{[" ","Enter"].includes(e.key)&&s.onValueChange(o)})),onFocus:tne(e.onFocus,(()=>{d||i||!("manual"!==s.activationMode)||s.onValueChange(o)}))})})}));Xne.displayName=Yne;var Zne="TabsContent",Qne=i.forwardRef(((e,n)=>{const{__scopeTabs:r,value:o,forceMount:a,children:s,...l}=e,c=qne(Zne,r),u=Jne(c.baseId,o),d=ere(c.baseId,o),p=o===c.value,f=i.useRef(p);return i.useEffect((()=>{const e=requestAnimationFrame((()=>f.current=!1));return()=>cancelAnimationFrame(e)}),[]),t.jsx(Fne,{present:a||p,children:({present:r})=>t.jsx(mne.div,{"data-state":p?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":u,hidden:!r,id:d,tabIndex:0,...l,ref:n,style:{...e.style,animationDuration:f.current?"0s":void 0},children:r&&s})})}));function Jne(e,t){return`${e}-trigger-${t}`}function ere(e,t){return`${e}-content-${t}`}Qne.displayName=Zne;var tre=Wne,nre=Xne,rre=Qne;const ore=Gne,ire=i.forwardRef((({className:e,...n},r)=>t.jsx(tre,{ref:r,className:Zd("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...n})));ire.displayName=tre.displayName;const are=i.forwardRef((({className:e,...n},r)=>t.jsx(nre,{ref:r,className:Zd("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...n})));are.displayName=nre.displayName;const sre=i.forwardRef((({className:e,...n},r)=>t.jsx(rre,{ref:r,className:Zd("ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...n})));sre.displayName=rre.displayName;const lre=({open:e,onOpenChange:n})=>t.jsx(_B,{open:e,onOpenChange:n,children:t.jsxs(TB,{className:"max-w-[75vw] min-h-[75vh] overflow-y-auto max-h-[90vh]",children:[t.jsxs(n$,{children:[t.jsx(NB,{children:"Edit Campaign Content"}),t.jsx(RB,{children:"Edit the content of the campaign"})]}),t.jsx(Zte,{})]})}),cre=()=>t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx("span",{className:"w-3 h-3 rounded-full bg-zinc-300 border border-zinc-300 shadow-sm"}),t.jsx("span",{className:"w-3 h-3 rounded-full bg-zinc-300 border border-zinc-300 shadow-sm"}),t.jsx("span",{className:"w-3 h-3 rounded-full bg-zinc-300 border border-zinc-300 shadow-sm"})]}),ure=({children:e,actionButtons:n})=>t.jsxs("div",{className:"flex-1 w-full relative overflow-hidden",children:[t.jsxs("div",{className:"h-full relative w-full rounded-2xl shadow-xl bg-white border border-zinc-200 overflow-hidden min-h-[500px] flex flex-col",style:{containerType:"inline-size"},children:[t.jsxs("div",{className:"flex items-center space-x-3 pt-3 px-4 z-10 w-full justify-between",children:[t.jsx(cre,{}),n&&t.jsx("div",{className:"flex items-center space-x-2",children:n})]}),e]}),t.jsx("div",{className:"text-center text-sm text-muted-foreground mt-4",children:t.jsx("p",{children:"These previews show exactly how your messages will appear to your customers"})})]}),dre=()=>{const e=aZ(),r=sZ(),{channelSenders:o}=w9(),{channelAccounts:i}=b9(),a=n.useMemo((()=>o?.results?.filter((e=>e.channelSenderMetadata.userPart))?.flatMap((e=>{const t=i?.results?.find((t=>t.id===e.channelAccountId));return t&&t.channelAccountMetadata.type===x9.REACH_MANAGED?[{channelSenderId:e.id,fullDomain:`${e.channelSenderMetadata.userPart}@${e.channelSenderMetadata.baseDomain}`,channelSenderMetadata:e.channelSenderMetadata}]:[]}))||[]),[o?.results,i?.results]),s=r?.emailChannelSenderId;if(!(e&&r&&a&&s))return null;const l=a.find((e=>e.channelSenderId===s)),c=l?.fullDomain,u=l?.channelSenderMetadata.emailReplyTo,d=r.emailSubject,p=r.emailPreviewText,f=l?.channelSenderMetadata.emailFromName;return t.jsxs("div",{className:"space-y-1 overflow-hidden",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsx("div",{className:"text-xs text-muted-foreground leading-none",children:"From"}),t.jsxs("div",{className:"text-base font-medium",children:[c,f&&t.jsxs("span",{className:"text-muted-foreground",children:["<",c,">"]})]})]}),u&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("div",{className:"text-xs text-muted-foreground leading-none",children:"Reply-To"}),t.jsx("div",{className:"text-base font-medium",children:u})]}),d&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("div",{className:"text-xs text-muted-foreground leading-none",children:"Subject"}),t.jsx("div",{className:"text-base font-medium",children:d})]}),p&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("div",{className:"text-xs text-muted-foreground leading-none",children:"Preview Text"}),t.jsx("div",{className:"text-sm font-medium line-clamp-2",children:p})]})]})},pre=({emailBody:e})=>{const[r,o]=n.useState({width:0,height:0}),i=n.useRef(null);return n.useEffect((()=>{const e=()=>{i.current&&requestAnimationFrame((()=>{o({width:i.current?i.current.offsetWidth-75:0,height:i.current?i.current.offsetHeight-75:0})}))};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}),[i]),t.jsxs(ure,{children:[t.jsx("div",{className:"pt-4 pb-2 px-6 flex flex-col gap-1",children:t.jsx("div",{className:"rounded-xl bg-zinc-50/80 shadow-sm border border-zinc-100 p-4",children:t.jsx(dre,{})})}),t.jsx("div",{className:"rounded-lg p-6 bg-white flex-1 min-h-0 flex items-center justify-center",ref:i,children:t.jsx(vte,{html:e,height:r.height,width:r.width})})]})},fre=({expandDialogContent:e})=>{const[r,o]=n.useState(!1);return t.jsxs(t.Fragment,{children:[t.jsx(_B,{open:r,onOpenChange:o,children:t.jsxs(TB,{hideCloseButton:!0,className:"w-[80vw] h-[80vh] max-w-none max-h-none bg-transparent border-none",children:[t.jsxs(n$,{children:[t.jsx(NB,{children:"Expanded Preview"}),t.jsx(RB,{children:"Expanded view of communication content"})]}),t.jsxs("div",{className:"h-full flex flex-col overflow-hidden rounded-xl",children:[e,t.jsx("div",{className:"absolute top-7 right-7 z-10",children:t.jsx(vZ,{variant:"ghost",size:"sm",onClick:()=>o(!1),children:t.jsx(wZ.CloseButton,{className:"w-4 h-4 text-primary"})})})]})]})}),t.jsx(vZ,{variant:"outline",size:"sm",className:"rounded-lg px-3 py-2 flex items-center gap-2 shadow-sm bg-white/80 hover:bg-zinc-100 border border-zinc-200",onClick:()=>o(!0),children:t.jsx(wZ.ExpandIcon,{className:"w-4 h-4 text-muted-foreground"})})]})},hre=({type:e,disablePreviewSubtext:n=!1})=>{const r="sms"===e?"SMS":"Email";return t.jsx("div",{className:"flex flex-1 w-full h-full items-center justify-center",children:t.jsxs("div",{className:"flex flex-col items-center justify-center bg-zinc-50/80 border border-zinc-100 rounded-2xl shadow-md px-6 py-12 max-w-[90vw] w-full sm:max-w-md mx-auto text-center",style:{containerType:"inline-size"},children:[t.jsx("sms"===e?wZ.SmsIcon:wZ.EmailIcon,{className:"w-12 h-12 text-zinc-500 mb-4"}),t.jsxs("h2",{className:"text-xl font-semibold text-zinc-800 mb-2",children:["No ",r," Content Yet"]}),!n&&t.jsxs("p",{className:"text-zinc-500 text-base mb-1",children:["Click"," ",t.jsx("span",{className:"font-medium text-zinc-700",children:"Edit content"})," to start crafting your ",r," message."]})]})})},mre=({onClick:e})=>t.jsxs(vZ,{variant:"outline",size:"sm",className:"rounded-lg px-3 py-2 flex items-center gap-2 shadow-sm bg-white/80 hover:bg-zinc-100 border border-zinc-200",onClick:e,children:[t.jsx(wZ.PreviewButton,{className:"w-4 h-4"}),t.jsx("span",{className:"font-medium text-sm",children:"Preview"})]}),gre=e=>/^[^\s@.]+(?:\.[^\s@.]+)*@[^\s@.]+(?:\.[^\s@.]+)+$/.test(e),vre=e=>{if(!/^[0-9\s()+.-]+$/.test(e))return!1;const t=e.replace(/\D/g,"");return e.startsWith("+")?t.length>=10&&t.length<=15:10===t.length||!(11!==t.length||!t.startsWith("1"))},yre=({automation:e,type:r,setOpenSendPreviewPopup:o})=>{const[i,a]=n.useState(""),[s,l]=n.useState(""),[c,u]=n.useState(null),[d,p]=n.useState(!1),{sendTestCommunication:f,sendError:h,isSendSuccess:m}=WX(),{toast:g}=jl(),v=e.actionData?.find((e=>"send_communication"===e.actionType)),y=v?.actionMetadata.communicationGroupId,{communicationGroup:b,isGetting:x}=GX(y??void 0),w=n.useCallback((()=>{if(!y)return Promise.resolve(null);if(!b)return Promise.reject(new Error("Communication group not loaded"));switch(r){case"email":return Promise.resolve(b.emailChannelSenderId);case"sms":return Promise.resolve(b.smsChannelSenderId);default:return Promise.reject(new Error(`Unsupported type: ${r}`))}}),[b,r,y]);n.useEffect((()=>{(async()=>{try{const e=await w();u(e)}catch(e){u(null)}finally{p(!0)}})()}),[w]),n.useEffect((()=>{m&&(g({title:"Success",description:`Preview ${"email"===r?"email":"SMS"} sent successfully!`}),o(!1))}),[m,r,o,g]),n.useEffect((()=>{h&&(g({title:"Error",description:`Failed to send preview: ${h.message}`,variant:"destructive"}),o(!1))}),[h,g,o]);return!d||x?t.jsx("div",{className:"flex justify-center items-center h-full",children:t.jsx(hZ,{text:["Fetching sender id","Finishing up"]})}):c?t.jsxs("div",{className:"",children:[t.jsxs("h3",{className:"text-xl font-semibold text-gray-900 mb-4",children:["Send Preview ","email"===r?"Email":"SMS"]}),t.jsx(q3,{type:"email"===r?"email":"tel",placeholder:"email"===r?"Enter email address":"Enter phone number",value:i,onChange:e=>{a(e.target.value),l("")},className:"w-full px-3 py-3 border border-gray-300 rounded-lg text-base mb-4 \n focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent\n placeholder-gray-400"}),s&&t.jsx("p",{className:"text-red-500 text-sm mb-4 -mt-2",children:s}),t.jsx(vZ,{onClick:()=>{if(!("email"===r?gre(i):vre(i)))return void l("Please enter a valid "+("email"===r?"email address":"phone number"));if(!c)return void l("No sender found, please update the automation first!");const t=e.actionData?.find((e=>"send_communication"===e.actionType)),n=t?.actionMetadata.communicationGroupId;if(!n)return Promise.resolve(null);f({id:n,params:"email"===r?{emailAddress:i}:{phoneNumber:i}})},disabled:!i,className:"w-full bg-blue-600 text-white py-3 px-6 rounded-lg font-medium\n hover:bg-blue-700 transition-colors duration-200\n disabled:bg-gray-400 disabled:cursor-not-allowed",children:"Send Preview"})]}):t.jsx("div",{className:"flex justify-center items-center h-full",children:t.jsxs("div",{className:"text-center flex flex-col justify-center items-center gap-2",children:[t.jsx(wZ.AlertCircleIcon,{className:"h-12 w-12 text-gray-400 mb-4"}),t.jsx("h3",{className:"text-lg font-semibold text-gray-700 mb-2",children:"No sender found"}),t.jsx("p",{className:"text-gray-500",children:"Please update the automation to include a sender for this type"})]})})},bre=({open:e,onOpenChange:n,automation:r})=>t.jsx(_B,{open:e,onOpenChange:n,children:t.jsxs(TB,{children:[t.jsxs(n$,{children:[t.jsx(NB,{children:"Send Preview Email"}),t.jsx(RB,{children:"Send a preview email to the automation."})]}),t.jsx(yre,{automation:r,type:"email",setOpenSendPreviewPopup:n})]})}),xre=({disablePreview:e=!1,disableEditContent:r=!1,disablePreviewSubtext:o=!1})=>{const i=aZ(),a=sZ(),[s,l]=n.useState({width:0,height:0}),[c,u]=n.useState(!1),[d,p]=n.useState(!1),f=n.useRef(null);if(n.useEffect((()=>{const e=()=>{f.current&&requestAnimationFrame((()=>{l({width:f.current?f.current.offsetWidth-75:0,height:f.current?f.current.offsetHeight-75:0})}))};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}),[f]),!i||!a)return null;const h=a?.emailHtmlBody||"",m=a?.emailChannelSenderId&&h.length>0;return t.jsxs("div",{className:"flex-1 flex flex-col items-center w-full",children:[t.jsx(lre,{open:d,onOpenChange:p}),t.jsx(bre,{open:c,onOpenChange:u,automation:i}),t.jsx(ure,{actionButtons:t.jsx(t.Fragment,{children:t.jsxs("div",{className:"flex items-center space-x-2",children:[!e&&m&&t.jsx(mre,{onClick:()=>u(!0)}),(i.status===Ve.DRAFT||!r)&&t.jsx(vZ,{variant:"outline",size:"sm",className:"rounded-lg px-3 py-2 font-medium text-sm shadow-sm bg-white/80 hover:bg-zinc-100 border border-zinc-200",onClick:()=>p(!0),children:"Edit content"}),m&&t.jsx(fre,{expandDialogContent:t.jsx(pre,{emailBody:h})})]})}),children:m?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"pt-4 pb-2 px-6 flex flex-col gap-1",children:t.jsx("div",{className:"rounded-xl bg-zinc-50/80 shadow-sm border border-zinc-100 p-4",children:t.jsx(dre,{})})}),t.jsx("div",{className:"w-full h-[1.5px] bg-zinc-200 my-2"}),t.jsx("div",{className:"flex-1 w-full overflow-auto h-full min-h-[500px]",ref:f,children:t.jsx(vte,{html:h,height:s.height,width:s.width})})]}):t.jsx(hre,{type:"email",disablePreviewSubtext:o})})]})},wre=()=>{const e=aZ(),r=sZ(),{channelSenders:o}=w9(),{channelAccounts:i}=b9(),a=n.useMemo((()=>o?.results.filter((e=>e.channelSenderMetadata.from||e.channelSenderMetadata.messageServiceSid))),[o?.results]),s=a?.find((e=>e.id===r?.smsChannelSenderId));if(!s)return null;if(!(e&&r&&o&&i&&a&&s))return null;const l=s.channelSenderMetadata.friendlyName||s.channelSenderMetadata.from||s.channelSenderMetadata.messageServiceSid;return t.jsx("div",{className:"space-y-4",children:t.jsxs("div",{className:"space-y-1",children:[t.jsx("div",{className:"text-xs text-muted-foreground leading-none",children:"From"}),t.jsx("div",{className:"text-base font-medium font-mono text-zinc-800",children:l})]})})},_re=({smsBody:e})=>t.jsxs(ure,{children:[t.jsx("div",{className:"pt-4 pb-2 px-6 flex flex-col gap-1",children:t.jsx("div",{className:"rounded-xl bg-zinc-50/80 shadow-sm border border-zinc-100 p-4",children:t.jsx(wre,{})})}),t.jsx("div",{className:"rounded-lg p-6 bg-white flex-1 min-h-0 flex items-center justify-center",children:t.jsx(Gte,{body:e})})]}),Sre=({open:e,onOpenChange:n,automation:r})=>t.jsx(_B,{open:e,onOpenChange:n,children:t.jsxs(TB,{children:[t.jsxs(n$,{children:[t.jsx(NB,{children:"Send Preview SMS"}),t.jsx(RB,{children:"Send a preview SMS to the automation."})]}),t.jsx(yre,{automation:r,type:"sms",setOpenSendPreviewPopup:n})]})}),Ere=({disablePreview:e=!1,disableEditContent:r=!1,disablePreviewSubtext:o=!1})=>{const[i,a]=n.useState(!1),s=aZ(),l=sZ(),[c,u]=n.useState(!1);if(!s)return null;const d=l?.smsMessageBody||"",p=l?.smsChannelSenderId&&d.length>0,f=qte({companyName:l?.textMessageCompanyName??void 0,smsBody:d});return t.jsxs("div",{className:"flex flex-col items-center w-full h-full",children:[t.jsx(lre,{open:c,onOpenChange:u}),t.jsx(Sre,{open:i,onOpenChange:a,automation:s}),t.jsx(ure,{actionButtons:t.jsxs(t.Fragment,{children:[!e&&p&&t.jsx(mre,{onClick:()=>a(!0)}),(s.status===Ve.DRAFT||!r)&&t.jsx(vZ,{variant:"outline",size:"sm",className:"rounded-lg px-3 py-2 font-medium text-sm shadow-sm bg-white/80 hover:bg-zinc-100 border border-zinc-200",onClick:()=>u(!0),children:"Edit content"}),p&&t.jsx(fre,{expandDialogContent:t.jsx(_re,{smsBody:f})})]}),children:p?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"pt-4 pb-2 px-6 flex flex-col gap-1",children:t.jsx("div",{className:"rounded-xl bg-zinc-50/80 shadow-sm border border-zinc-100 p-4",children:t.jsx(wre,{})})}),t.jsx("div",{className:"w-full h-[1.5px] bg-zinc-200 my-2"}),t.jsx("div",{className:"flex-1 w-full overflow-auto h-full flex items-center justify-center",children:t.jsx(Gte,{body:f})})]}):t.jsx(hre,{type:"sms",disablePreviewSubtext:o})})]})},Tre=({disablePreview:e=!1,disableEditContent:r=!1,disablePreviewSubtext:o=!1,hideSms:i=!1})=>{const[a,s]=n.useState("email"),[l,c]=n.useState(!1),u=sZ();return n.useEffect((()=>{u&&!l&&(s(u.emailChannelSenderId?"email":u.smsChannelSenderId?"sms":"email"),c(!0))}),[u,l]),u?t.jsxs(ore,{value:a,onValueChange:e=>{s(e)},defaultValue:"email",className:"flex flex-col gap-4 pt-4 flex-1 bg-muted rounded-md",children:[t.jsx("div",{className:"max-w-[640px] mx-auto w-full",children:t.jsxs(ire,{className:"grid w-full "+(i?"grid-cols-1":"grid-cols-2"),children:[t.jsx(are,{value:"email",className:"group",children:t.jsxs("div",{className:"flex items-center",children:[t.jsx("img",{src:"data:image/svg+xml,%3csvg%20width='17'%20height='16'%20viewBox='0%200%2017%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20opacity='0.32'%20d='M6.66683%201.5C4.79999%201.5%203.86657%201.5%203.15353%201.86331C2.52632%202.18289%202.01639%202.69282%201.69681%203.32003C1.3335%204.03307%201.3335%204.96649%201.3335%206.83333V9.16667C1.3335%2011.0335%201.3335%2011.9669%201.69681%2012.68C2.01639%2013.3072%202.52632%2013.8171%203.15353%2014.1367C3.86657%2014.5%204.79999%2014.5%206.66683%2014.5H10.3335C12.2003%2014.5%2013.1338%2014.5%2013.8468%2014.1367C14.474%2013.8171%2014.9839%2013.3072%2015.3035%2012.68C15.6668%2011.9669%2015.6668%2011.0335%2015.6668%209.16667V6.83333C15.6668%204.96649%2015.6668%204.03307%2015.3035%203.32003C14.9839%202.69282%2014.474%202.18289%2013.8468%201.86331C13.1338%201.5%2012.2003%201.5%2010.3335%201.5H6.66683Z'%20fill='%230B66E4'%20/%3e%3cpath%20d='M12.3125%204.86981C12.5278%204.7825%2012.7821%204.85543%2012.916%205.05633C13.05%205.25736%2013.0191%205.52008%2012.8554%205.68524L12.7773%205.74969L12.1103%206.19403C11.0645%206.89127%2010.4559%207.30338%209.79783%207.50164C9.05705%207.72477%208.27301%207.75304%207.52146%207.58563L7.20212%207.50164C6.7086%207.35295%206.24273%207.08397%205.59958%206.66473L4.88962%206.19403L4.22263%205.74969L4.14451%205.68524C3.98082%205.52008%203.95%205.25736%204.08396%205.05633C4.21789%204.85543%204.47213%204.7825%204.68747%204.86981L4.77732%204.91766L5.44431%205.36199L6.16013%205.83563C6.77757%206.23725%207.12913%206.43582%207.49021%206.54461L7.73923%206.60906C8.32376%206.73923%208.93361%206.71818%209.50974%206.54461C9.99112%206.39957%2010.4556%206.09534%2011.5556%205.36199L12.2226%204.91766L12.3125%204.86981Z'%20fill='%230B66E4'%20/%3e%3c/svg%3e",alt:"Email",className:"w-4 h-4 mr-2 hidden group-data-[state=active]:block"}),t.jsx("img",{src:"data:image/svg+xml,%3csvg%20width='17'%20height='16'%20viewBox='0%200%2017%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20opacity='0.32'%20d='M6.66683%201.5C4.79999%201.5%203.86657%201.5%203.15353%201.86331C2.52632%202.18289%202.01639%202.69282%201.69681%203.32003C1.3335%204.03307%201.3335%204.96649%201.3335%206.83333V9.16667C1.3335%2011.0335%201.3335%2011.9669%201.69681%2012.68C2.01639%2013.3072%202.52632%2013.8171%203.15353%2014.1367C3.86657%2014.5%204.79999%2014.5%206.66683%2014.5H10.3335C12.2003%2014.5%2013.1338%2014.5%2013.8468%2014.1367C14.474%2013.8171%2014.9839%2013.3072%2015.3035%2012.68C15.6668%2011.9669%2015.6668%2011.0335%2015.6668%209.16667V6.83333C15.6668%204.96649%2015.6668%204.03307%2015.3035%203.32003C14.9839%202.69282%2014.474%202.18289%2013.8468%201.86331C13.1338%201.5%2012.2003%201.5%2010.3335%201.5H6.66683Z'%20fill='%237A8599'%20/%3e%3cpath%20d='M12.3125%204.86981C12.5278%204.7825%2012.7821%204.85543%2012.916%205.05633C13.05%205.25736%2013.0191%205.52008%2012.8554%205.68524L12.7773%205.74969L12.1103%206.19403C11.0645%206.89127%2010.4559%207.30338%209.79783%207.50164C9.05705%207.72477%208.27301%207.75304%207.52146%207.58563L7.20212%207.50164C6.7086%207.35295%206.24273%207.08397%205.59958%206.66473L4.88962%206.19403L4.22263%205.74969L4.14451%205.68524C3.98082%205.52008%203.95%205.25736%204.08396%205.05633C4.21789%204.85543%204.47213%204.7825%204.68747%204.86981L4.77732%204.91766L5.44431%205.36199L6.16013%205.83563C6.77757%206.23725%207.12913%206.43582%207.49021%206.54461L7.73923%206.60906C8.32376%206.73923%208.93361%206.71818%209.50974%206.54461C9.99112%206.39957%2010.4556%206.09534%2011.5556%205.36199L12.2226%204.91766L12.3125%204.86981Z'%20fill='%237A8599'%20/%3e%3c/svg%3e",alt:"Email",className:"w-4 h-4 mr-2 block group-data-[state=active]:hidden"}),"Email"]})}),!i&&t.jsx(are,{value:"sms",className:"group",children:t.jsxs("div",{className:"flex items-center",children:[t.jsx("img",{src:"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20opacity='0.32'%20d='M7.09967%200.833328C5.6062%200.833328%204.85946%200.833328%204.28903%201.12398C3.78727%201.37964%203.37932%201.78759%203.12366%202.28935C2.83301%202.85978%202.83301%203.60652%202.83301%205.09999V10.9C2.83301%2012.3935%202.83301%2013.1402%203.12366%2013.7106C3.37932%2014.2124%203.78727%2014.6204%204.28903%2014.876C4.85946%2015.1667%205.6062%2015.1667%207.09967%2015.1667H8.89967C10.3931%2015.1667%2011.1399%2015.1667%2011.7103%2014.876C12.2121%2014.6204%2012.62%2014.2124%2012.8757%2013.7106C13.1663%2013.1402%2013.1663%2012.3935%2013.1663%2010.9V5.1C13.1663%203.60652%2013.1663%202.85978%2012.8757%202.28935C12.62%201.78759%2012.2121%201.37964%2011.7103%201.12398C11.1399%200.833328%2010.3931%200.833328%208.89968%200.833328H7.09967Z'%20fill='%230B66E4'%20/%3e%3cpath%20d='M9.43457%2012.1764C9.66223%2012.2232%209.83398%2012.4252%209.83398%2012.6667C9.83398%2012.9082%209.66223%2013.1101%209.43457%2013.1569L9.33398%2013.1667H6.66699C6.39085%2013.1667%206.16699%2012.9428%206.16699%2012.6667C6.16699%2012.3905%206.39085%2012.1667%206.66699%2012.1667H9.33398L9.43457%2012.1764ZM8.08594%203.17058C8.50572%203.21356%208.83382%203.56859%208.83398%203.99968C8.83398%204.45981%208.46009%204.83349%208%204.83366C7.56881%204.8335%207.21375%204.50553%207.1709%204.08562L7.16699%203.99968L7.1709%203.91472C7.2136%203.49464%207.5687%203.16684%208%203.16667L8.08594%203.17058Z'%20fill='%230B66E4'%20/%3e%3c/svg%3e",alt:"SMS",className:"w-4 h-4 mr-2 hidden group-data-[state=active]:block"}),t.jsx("img",{src:"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20opacity='0.32'%20d='M7.09967%200.833328C5.6062%200.833328%204.85946%200.833328%204.28903%201.12398C3.78727%201.37964%203.37932%201.78759%203.12366%202.28935C2.83301%202.85978%202.83301%203.60652%202.83301%205.09999V10.9C2.83301%2012.3935%202.83301%2013.1402%203.12366%2013.7106C3.37932%2014.2124%203.78727%2014.6204%204.28903%2014.876C4.85946%2015.1667%205.6062%2015.1667%207.09967%2015.1667H8.89967C10.3931%2015.1667%2011.1399%2015.1667%2011.7103%2014.876C12.2121%2014.6204%2012.62%2014.2124%2012.8757%2013.7106C13.1663%2013.1402%2013.1663%2012.3935%2013.1663%2010.9V5.1C13.1663%203.60652%2013.1663%202.85978%2012.8757%202.28935C12.62%201.78759%2012.2121%201.37964%2011.7103%201.12398C11.1399%200.833328%2010.3931%200.833328%208.89968%200.833328H7.09967Z'%20fill='%237A8599'%20/%3e%3cpath%20d='M9.43457%2012.1764C9.66223%2012.2232%209.83398%2012.4252%209.83398%2012.6667C9.83398%2012.9082%209.66223%2013.1101%209.43457%2013.1569L9.33398%2013.1667H6.66699C6.39085%2013.1667%206.16699%2012.9428%206.16699%2012.6667C6.16699%2012.3905%206.39085%2012.1667%206.66699%2012.1667H9.33398L9.43457%2012.1764ZM8.08594%203.17058C8.50572%203.21356%208.83382%203.56859%208.83398%203.99968C8.83398%204.45981%208.46009%204.83349%208%204.83366C7.56881%204.8335%207.21375%204.50553%207.1709%204.08562L7.16699%203.99968L7.1709%203.91472C7.2136%203.49464%207.5687%203.16684%208%203.16667L8.08594%203.17058Z'%20fill='%237A8599'%20/%3e%3c/svg%3e",alt:"SMS",className:"w-4 h-4 mr-2 block group-data-[state=active]:hidden"}),"SMS"]})})]})}),t.jsxs("div",{className:"max-w-[1000px] mx-auto w-full flex-1",children:[t.jsx(sre,{value:"sms",children:t.jsx(Ere,{disablePreview:e,disableEditContent:r,disablePreviewSubtext:o})}),t.jsx(sre,{value:"email",className:"flex flex-col h-full",children:t.jsx(xre,{disablePreview:e,disableEditContent:r,disablePreviewSubtext:o})})]})]}):t.jsx("div",{className:"flex flex-col gap-4 pt-4 flex-1 bg-muted rounded-md",children:t.jsx(hZ,{text:["Loading..."]})})},Cre="reach-styles-module__h2___J-48W",Are="reach-styles-module__minorText___1TEN6",Nre=({children:e,className:n})=>t.jsx("h2",{className:Zd(Cre,n),children:e}),Rre=({children:e,className:n})=>t.jsx("p",{className:Zd(Are,n),children:e}),Ore=({title:e,children:n,headerActions:r})=>t.jsxs("div",{className:"max-w-[1000px] mx-auto w-full flex-1 flex flex-col gap-4 pt-4",children:[t.jsxs("div",{className:"px-4 flex",children:[t.jsx(Nre,{className:"text-primary",children:e}),r&&t.jsx("div",{className:"ml-auto",children:r})]}),n]}),Pre=()=>t.jsx(Ore,{title:"Preview & Schedule",children:t.jsx(Tre,{disablePreview:!0,disableEditContent:!0,disablePreviewSubtext:!0})}),kre=()=>{const e=aZ(),r=sZ(),{channelSenders:o}=w9(),{channelAccounts:i}=b9(),[a,s]=n.useState(null),[l,c]=n.useState(null),[u,d]=n.useState(null),[p,f]=n.useState(null);return n.useEffect((()=>{o&&d(o),i&&f(i)}),[o,i]),n.useEffect((()=>{if(r&&u&&p){const e=r.emailChannelSenderId,t=r.smsChannelSenderId,n=u.results.find((t=>t.id===e)),o=u.results.find((e=>e.id===t));if(n&&r.emailSubject&&r.emailHtmlBody){const e=n.channelSenderMetadata?.userPart,t=p.results.find((e=>e.id===n.channelAccountId));if(t)switch(t.channelAccountMetadata.type){case x9.REACH_MANAGED:s({fromEmail:`${e}@${t.channelAccountMetadata.baseDomain}.embedreach.com`,fromName:n.channelSenderMetadata?.emailFromName,subject:r.emailSubject,previewText:r.emailPreviewText,body:r.emailHtmlBody});break;case x9.TWILLIO:break;default:throw ene(t.channelAccountMetadata.type,x9)}}o&&r.smsMessageBody&&c({fromPhone:Jte(o.channelSenderMetadata),body:r.smsMessageBody,companyName:r.textMessageCompanyName})}}),[r,u,p]),e?t.jsx("div",a||l?{className:"w-full",children:t.jsx("div",{className:"flex flex-col gap-4 w-full",children:t.jsx(Pre,{})})}:{className:"flex justify-center items-center h-full",children:t.jsx("div",{children:"No preview data Please complete previous steps"})}):t.jsx(hZ,{text:["Loading..."]})};function Mre(e){return(Mre="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function jre(e){if(null===e||!0===e||!1===e)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function Lre(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function Dre(e){Lre(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||"object"===Mre(e)&&"[object Date]"===t?new Date(e.getTime()):"number"==typeof e||"[object Number]"===t?new Date(e):new Date(NaN)}function Ire(e,t){Lre(2,arguments);var n=Dre(e),r=jre(t);return isNaN(r)?new Date(NaN):r?(n.setDate(n.getDate()+r),n):n}function Fre(e,t){Lre(2,arguments);var n=Dre(e),r=jre(t);if(isNaN(r))return new Date(NaN);if(!r)return n;var o=n.getDate(),i=new Date(n.getTime());return i.setMonth(n.getMonth()+r+1,0),o>=i.getDate()?i:(n.setFullYear(i.getFullYear(),i.getMonth(),o),n)}var Ure={};function $re(){return Ure}function Vre(e,t){var n,r,o,i,a,s,l,c;Lre(1,arguments);var u=$re(),d=jre(null!==(n=null!==(r=null!==(o=null!==(i=null==t?void 0:t.weekStartsOn)&&void 0!==i?i:null==t||null===(a=t.locale)||void 0===a||null===(s=a.options)||void 0===s?void 0:s.weekStartsOn)&&void 0!==o?o:u.weekStartsOn)&&void 0!==r?r:null===(l=u.locale)||void 0===l||null===(c=l.options)||void 0===c?void 0:c.weekStartsOn)&&void 0!==n?n:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var p=Dre(e),f=p.getDay(),h=(f<d?7:0)+f-d;return p.setDate(p.getDate()-h),p.setHours(0,0,0,0),p}function Bre(e){return Lre(1,arguments),Vre(e,{weekStartsOn:1})}function zre(e){Lre(1,arguments);var t=function(e){Lre(1,arguments);var t=Dre(e),n=t.getFullYear(),r=new Date(0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);var o=Bre(r),i=new Date(0);i.setFullYear(n,0,4),i.setHours(0,0,0,0);var a=Bre(i);return t.getTime()>=o.getTime()?n+1:t.getTime()>=a.getTime()?n:n-1}(e),n=new Date(0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),Bre(n)}function Hre(e){var t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()}function qre(e){Lre(1,arguments);var t=Dre(e);return t.setHours(0,0,0,0),t}function Gre(e,t){Lre(2,arguments);var n=qre(e),r=qre(t),o=n.getTime()-Hre(n),i=r.getTime()-Hre(r);return Math.round((o-i)/864e5)}function Kre(e,t){return Lre(2,arguments),Ire(e,7*jre(t))}function Wre(e,t){return Lre(2,arguments),Fre(e,12*jre(t))}function Yre(e,t){Lre(2,arguments);var n=qre(e),r=qre(t);return n.getTime()===r.getTime()}function Xre(e){return Lre(1,arguments),e instanceof Date||"object"===Mre(e)&&"[object Date]"===Object.prototype.toString.call(e)}function Zre(e,t){Lre(2,arguments);var n=Dre(e),r=Dre(t);return 12*(n.getFullYear()-r.getFullYear())+(n.getMonth()-r.getMonth())}function Qre(e){Lre(1,arguments);var t=Dre(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function Jre(e){Lre(1,arguments);var t=Dre(e);return t.setDate(1),t.setHours(0,0,0,0),t}function eoe(e){Lre(1,arguments);var t=Dre(e),n=new Date(0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}function toe(e,t){var n,r,o,i,a,s,l,c;Lre(1,arguments);var u=$re(),d=jre(null!==(n=null!==(r=null!==(o=null!==(i=null==t?void 0:t.weekStartsOn)&&void 0!==i?i:null==t||null===(a=t.locale)||void 0===a||null===(s=a.options)||void 0===s?void 0:s.weekStartsOn)&&void 0!==o?o:u.weekStartsOn)&&void 0!==r?r:null===(l=u.locale)||void 0===l||null===(c=l.options)||void 0===c?void 0:c.weekStartsOn)&&void 0!==n?n:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var p=Dre(e),f=p.getDay(),h=6+(f<d?-7:0)-(f-d);return p.setDate(p.getDate()+h),p.setHours(23,59,59,999),p}function noe(e){return Lre(1,arguments),toe(e,{weekStartsOn:1})}function roe(e,t){return Lre(2,arguments),function(e,t){Lre(2,arguments);var n=Dre(e).getTime(),r=jre(t);return new Date(n+r)}(e,-jre(t))}function ooe(e){Lre(1,arguments);var t=Dre(e),n=t.getUTCDay(),r=(n<1?7:0)+n-1;return t.setUTCDate(t.getUTCDate()-r),t.setUTCHours(0,0,0,0),t}function ioe(e){Lre(1,arguments);var t=Dre(e),n=t.getUTCFullYear(),r=new Date(0);r.setUTCFullYear(n+1,0,4),r.setUTCHours(0,0,0,0);var o=ooe(r),i=new Date(0);i.setUTCFullYear(n,0,4),i.setUTCHours(0,0,0,0);var a=ooe(i);return t.getTime()>=o.getTime()?n+1:t.getTime()>=a.getTime()?n:n-1}function aoe(e){Lre(1,arguments);var t=Dre(e),n=ooe(t).getTime()-function(e){Lre(1,arguments);var t=ioe(e),n=new Date(0);return n.setUTCFullYear(t,0,4),n.setUTCHours(0,0,0,0),ooe(n)}(t).getTime();return Math.round(n/6048e5)+1}function soe(e,t){var n,r,o,i,a,s,l,c;Lre(1,arguments);var u=$re(),d=jre(null!==(n=null!==(r=null!==(o=null!==(i=null==t?void 0:t.weekStartsOn)&&void 0!==i?i:null==t||null===(a=t.locale)||void 0===a||null===(s=a.options)||void 0===s?void 0:s.weekStartsOn)&&void 0!==o?o:u.weekStartsOn)&&void 0!==r?r:null===(l=u.locale)||void 0===l||null===(c=l.options)||void 0===c?void 0:c.weekStartsOn)&&void 0!==n?n:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var p=Dre(e),f=p.getUTCDay(),h=(f<d?7:0)+f-d;return p.setUTCDate(p.getUTCDate()-h),p.setUTCHours(0,0,0,0),p}function loe(e,t){var n,r,o,i,a,s,l,c;Lre(1,arguments);var u=Dre(e),d=u.getUTCFullYear(),p=$re(),f=jre(null!==(n=null!==(r=null!==(o=null!==(i=null==t?void 0:t.firstWeekContainsDate)&&void 0!==i?i:null==t||null===(a=t.locale)||void 0===a||null===(s=a.options)||void 0===s?void 0:s.firstWeekContainsDate)&&void 0!==o?o:p.firstWeekContainsDate)&&void 0!==r?r:null===(l=p.locale)||void 0===l||null===(c=l.options)||void 0===c?void 0:c.firstWeekContainsDate)&&void 0!==n?n:1);if(!(f>=1&&f<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var h=new Date(0);h.setUTCFullYear(d+1,0,f),h.setUTCHours(0,0,0,0);var m=soe(h,t),g=new Date(0);g.setUTCFullYear(d,0,f),g.setUTCHours(0,0,0,0);var v=soe(g,t);return u.getTime()>=m.getTime()?d+1:u.getTime()>=v.getTime()?d:d-1}function coe(e,t){Lre(1,arguments);var n=Dre(e),r=soe(n,t).getTime()-function(e,t){var n,r,o,i,a,s,l,c;Lre(1,arguments);var u=$re(),d=jre(null!==(n=null!==(r=null!==(o=null!==(i=null==t?void 0:t.firstWeekContainsDate)&&void 0!==i?i:null==t||null===(a=t.locale)||void 0===a||null===(s=a.options)||void 0===s?void 0:s.firstWeekContainsDate)&&void 0!==o?o:u.firstWeekContainsDate)&&void 0!==r?r:null===(l=u.locale)||void 0===l||null===(c=l.options)||void 0===c?void 0:c.firstWeekContainsDate)&&void 0!==n?n:1),p=loe(e,t),f=new Date(0);return f.setUTCFullYear(p,0,d),f.setUTCHours(0,0,0,0),soe(f,t)}(n,t).getTime();return Math.round(r/6048e5)+1}function uoe(e,t){for(var n=e<0?"-":"",r=Math.abs(e).toString();r.length<t;)r="0"+r;return n+r}var doe=function(e,t){var n=e.getUTCFullYear(),r=n>0?n:1-n;return uoe("yy"===t?r%100:r,t.length)},poe=function(e,t){var n=e.getUTCMonth();return"M"===t?String(n+1):uoe(n+1,2)},foe=function(e,t){return uoe(e.getUTCDate(),t.length)},hoe=function(e,t){return uoe(e.getUTCHours()%12||12,t.length)},moe=function(e,t){return uoe(e.getUTCHours(),t.length)},goe=function(e,t){return uoe(e.getUTCMinutes(),t.length)},voe=function(e,t){return uoe(e.getUTCSeconds(),t.length)},yoe=function(e,t){var n=t.length,r=e.getUTCMilliseconds();return uoe(Math.floor(r*Math.pow(10,n-3)),t.length)},boe="midnight",xoe="noon",woe="morning",_oe="afternoon",Soe="evening",Eoe="night",Toe={G:function(e,t,n){var r=e.getUTCFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if("yo"===t){var r=e.getUTCFullYear();return n.ordinalNumber(r>0?r:1-r,{unit:"year"})}return doe(e,t)},Y:function(e,t,n,r){var o=loe(e,r),i=o>0?o:1-o;return"YY"===t?uoe(i%100,2):"Yo"===t?n.ordinalNumber(i,{unit:"year"}):uoe(i,t.length)},R:function(e,t){return uoe(ioe(e),t.length)},u:function(e,t){return uoe(e.getUTCFullYear(),t.length)},Q:function(e,t,n){var r=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return uoe(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){var r=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return uoe(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){var r=e.getUTCMonth();switch(t){case"M":case"MM":return poe(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){var r=e.getUTCMonth();switch(t){case"L":return String(r+1);case"LL":return uoe(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){var o=coe(e,r);return"wo"===t?n.ordinalNumber(o,{unit:"week"}):uoe(o,t.length)},I:function(e,t,n){var r=aoe(e);return"Io"===t?n.ordinalNumber(r,{unit:"week"}):uoe(r,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getUTCDate(),{unit:"date"}):foe(e,t)},D:function(e,t,n){var r=function(e){Lre(1,arguments);var t=Dre(e),n=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var r=t.getTime();return Math.floor((n-r)/864e5)+1}(e);return"Do"===t?n.ordinalNumber(r,{unit:"dayOfYear"}):uoe(r,t.length)},E:function(e,t,n){var r=e.getUTCDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){var o=e.getUTCDay(),i=(o-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return uoe(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(o,{width:"short",context:"formatting"});default:return n.day(o,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){var o=e.getUTCDay(),i=(o-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return uoe(i,t.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(o,{width:"narrow",context:"standalone"});case"cccccc":return n.day(o,{width:"short",context:"standalone"});default:return n.day(o,{width:"wide",context:"standalone"})}},i:function(e,t,n){var r=e.getUTCDay(),o=0===r?7:r;switch(t){case"i":return String(o);case"ii":return uoe(o,t.length);case"io":return n.ordinalNumber(o,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){var r=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(e,t,n){var r,o=e.getUTCHours();switch(r=12===o?xoe:0===o?boe:o/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},B:function(e,t,n){var r,o=e.getUTCHours();switch(r=o>=17?Soe:o>=12?_oe:o>=4?woe:Eoe,t){case"B":case"BB":case"BBB":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){var r=e.getUTCHours()%12;return 0===r&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return hoe(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getUTCHours(),{unit:"hour"}):moe(e,t)},K:function(e,t,n){var r=e.getUTCHours()%12;return"Ko"===t?n.ordinalNumber(r,{unit:"hour"}):uoe(r,t.length)},k:function(e,t,n){var r=e.getUTCHours();return 0===r&&(r=24),"ko"===t?n.ordinalNumber(r,{unit:"hour"}):uoe(r,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):goe(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):voe(e,t)},S:function(e,t){return yoe(e,t)},X:function(e,t,n,r){var o=(r._originalDate||e).getTimezoneOffset();if(0===o)return"Z";switch(t){case"X":return Aoe(o);case"XXXX":case"XX":return Noe(o);default:return Noe(o,":")}},x:function(e,t,n,r){var o=(r._originalDate||e).getTimezoneOffset();switch(t){case"x":return Aoe(o);case"xxxx":case"xx":return Noe(o);default:return Noe(o,":")}},O:function(e,t,n,r){var o=(r._originalDate||e).getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Coe(o,":");default:return"GMT"+Noe(o,":")}},z:function(e,t,n,r){var o=(r._originalDate||e).getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Coe(o,":");default:return"GMT"+Noe(o,":")}},t:function(e,t,n,r){return uoe(Math.floor((r._originalDate||e).getTime()/1e3),t.length)},T:function(e,t,n,r){return uoe((r._originalDate||e).getTime(),t.length)}};function Coe(e,t){var n=e>0?"-":"+",r=Math.abs(e),o=Math.floor(r/60),i=r%60;if(0===i)return n+String(o);var a=t;return n+String(o)+a+uoe(i,2)}function Aoe(e,t){return e%60==0?(e>0?"-":"+")+uoe(Math.abs(e)/60,2):Noe(e,t)}function Noe(e,t){var n=t||"",r=e>0?"-":"+",o=Math.abs(e);return r+uoe(Math.floor(o/60),2)+n+uoe(o%60,2)}var Roe=function(e,t){switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},Ooe=function(e,t){switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},Poe={p:Ooe,P:function(e,t){var n,r=e.match(/(P+)(p+)?/)||[],o=r[1],i=r[2];if(!i)return Roe(e,t);switch(o){case"P":n=t.dateTime({width:"short"});break;case"PP":n=t.dateTime({width:"medium"});break;case"PPP":n=t.dateTime({width:"long"});break;default:n=t.dateTime({width:"full"})}return n.replace("{{date}}",Roe(o,t)).replace("{{time}}",Ooe(i,t))}},koe=["D","DD"],Moe=["YY","YYYY"];function joe(e,t,n){if("YYYY"===e)throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("YY"===e)throw new RangeError("Use `yy` instead of `YY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("D"===e)throw new RangeError("Use `d` instead of `D` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("DD"===e)throw new RangeError("Use `dd` instead of `DD` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var Loe={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function Doe(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var Ioe={date:Doe({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:Doe({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:Doe({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},Foe={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function Uoe(e){return function(t,n){var r;if("formatting"===(null!=n&&n.context?String(n.context):"standalone")&&e.formattingValues){var o=e.defaultFormattingWidth||e.defaultWidth,i=null!=n&&n.width?String(n.width):o;r=e.formattingValues[i]||e.formattingValues[o]}else{var a=e.defaultWidth,s=null!=n&&n.width?String(n.width):e.defaultWidth;r=e.values[s]||e.values[a]}return r[e.argumentCallback?e.argumentCallback(t):t]}}var $oe={ordinalNumber:function(e,t){var n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:Uoe({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:Uoe({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:function(e){return e-1}}),month:Uoe({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:Uoe({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:Uoe({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})};function Voe(e){return function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.width,o=t.match(r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth]);if(!o)return null;var i,a=o[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(s)?function(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return n;return}(s,(function(e){return e.test(a)})):function(e,t){for(var n in e)if(e.hasOwnProperty(n)&&t(e[n]))return n;return}(s,(function(e){return e.test(a)}));return i=e.valueCallback?e.valueCallback(l):l,{value:i=n.valueCallback?n.valueCallback(i):i,rest:t.slice(a.length)}}}var Boe={ordinalNumber:function(e){return function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.match(e.matchPattern);if(!r)return null;var o=r[0],i=t.match(e.parsePattern);if(!i)return null;var a=e.valueCallback?e.valueCallback(i[0]):i[0];return{value:a=n.valueCallback?n.valueCallback(a):a,rest:t.slice(o.length)}}}({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}}),era:Voe({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:Voe({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:function(e){return e+1}}),month:Voe({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:Voe({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:Voe({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},zoe={code:"en-US",formatDistance:function(e,t,n){var r,o=Loe[e];return r="string"==typeof o?o:1===t?o.one:o.other.replace("{{count}}",t.toString()),null!=n&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r},formatLong:Ioe,formatRelative:function(e,t,n,r){return Foe[e]},localize:$oe,match:Boe,options:{weekStartsOn:0,firstWeekContainsDate:1}},Hoe=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,qoe=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Goe=/^'([^]*?)'?$/,Koe=/''/g,Woe=/[a-zA-Z]/;function Yoe(e,t,n){var r,o,i,a,s,l,c,u,d,p,f,h,m,g,v,y,b,x;Lre(2,arguments);var w=String(t),_=$re(),S=null!==(r=null!==(o=null==n?void 0:n.locale)&&void 0!==o?o:_.locale)&&void 0!==r?r:zoe,E=jre(null!==(i=null!==(a=null!==(s=null!==(l=null==n?void 0:n.firstWeekContainsDate)&&void 0!==l?l:null==n||null===(c=n.locale)||void 0===c||null===(u=c.options)||void 0===u?void 0:u.firstWeekContainsDate)&&void 0!==s?s:_.firstWeekContainsDate)&&void 0!==a?a:null===(d=_.locale)||void 0===d||null===(p=d.options)||void 0===p?void 0:p.firstWeekContainsDate)&&void 0!==i?i:1);if(!(E>=1&&E<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var T=jre(null!==(f=null!==(h=null!==(m=null!==(g=null==n?void 0:n.weekStartsOn)&&void 0!==g?g:null==n||null===(v=n.locale)||void 0===v||null===(y=v.options)||void 0===y?void 0:y.weekStartsOn)&&void 0!==m?m:_.weekStartsOn)&&void 0!==h?h:null===(b=_.locale)||void 0===b||null===(x=b.options)||void 0===x?void 0:x.weekStartsOn)&&void 0!==f?f:0);if(!(T>=0&&T<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!S.localize)throw new RangeError("locale must contain localize property");if(!S.formatLong)throw new RangeError("locale must contain formatLong property");var C=Dre(e);if(!function(e){if(Lre(1,arguments),!Xre(e)&&"number"!=typeof e)return!1;var t=Dre(e);return!isNaN(Number(t))}(C))throw new RangeError("Invalid time value");var A=roe(C,Hre(C)),N={firstWeekContainsDate:E,weekStartsOn:T,locale:S,_originalDate:C};return w.match(qoe).map((function(e){var t=e[0];return"p"===t||"P"===t?(0,Poe[t])(e,S.formatLong):e})).join("").match(Hoe).map((function(r){if("''"===r)return"'";var o=r[0];if("'"===o)return function(e){var t=e.match(Goe);if(!t)return e;return t[1].replace(Koe,"'")}(r);var i=Toe[o];if(i)return null!=n&&n.useAdditionalWeekYearTokens||-1===Moe.indexOf(r)||joe(r,t,String(e)),null!=n&&n.useAdditionalDayOfYearTokens||!function(e){return-1!==koe.indexOf(e)}(r)||joe(r,t,String(e)),i(A,r,S.localize,N);if(o.match(Woe))throw new RangeError("Format string contains an unescaped latin alphabet character `"+o+"`");return r})).join("")}function Xoe(e){return Lre(1,arguments),Math.floor(function(e){return Lre(1,arguments),Dre(e).getTime()}(e)/1e3)}function Zoe(e,t){var n,r,o,i,a,s,l,c;Lre(1,arguments);var u=$re(),d=jre(null!==(n=null!==(r=null!==(o=null!==(i=null==t?void 0:t.firstWeekContainsDate)&&void 0!==i?i:null==t||null===(a=t.locale)||void 0===a||null===(s=a.options)||void 0===s?void 0:s.firstWeekContainsDate)&&void 0!==o?o:u.firstWeekContainsDate)&&void 0!==r?r:null===(l=u.locale)||void 0===l||null===(c=l.options)||void 0===c?void 0:c.firstWeekContainsDate)&&void 0!==n?n:1),p=function(e,t){var n,r,o,i,a,s,l,c;Lre(1,arguments);var u=Dre(e),d=u.getFullYear(),p=$re(),f=jre(null!==(n=null!==(r=null!==(o=null!==(i=null==t?void 0:t.firstWeekContainsDate)&&void 0!==i?i:null==t||null===(a=t.locale)||void 0===a||null===(s=a.options)||void 0===s?void 0:s.firstWeekContainsDate)&&void 0!==o?o:p.firstWeekContainsDate)&&void 0!==r?r:null===(l=p.locale)||void 0===l||null===(c=l.options)||void 0===c?void 0:c.firstWeekContainsDate)&&void 0!==n?n:1);if(!(f>=1&&f<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var h=new Date(0);h.setFullYear(d+1,0,f),h.setHours(0,0,0,0);var m=Vre(h,t),g=new Date(0);g.setFullYear(d,0,f),g.setHours(0,0,0,0);var v=Vre(g,t);return u.getTime()>=m.getTime()?d+1:u.getTime()>=v.getTime()?d:d-1}(e,t),f=new Date(0);return f.setFullYear(p,0,d),f.setHours(0,0,0,0),Vre(f,t)}function Qoe(e,t){return Lre(1,arguments),function(e,t,n){Lre(2,arguments);var r=Vre(e,n),o=Vre(t,n),i=r.getTime()-Hre(r),a=o.getTime()-Hre(o);return Math.round((i-a)/6048e5)}(function(e){Lre(1,arguments);var t=Dre(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(0,0,0,0),t}(e),Jre(e),t)+1}function Joe(e,t){Lre(2,arguments);var n=Dre(e),r=Dre(t);return n.getTime()>r.getTime()}function eie(e,t){Lre(2,arguments);var n=Dre(e),r=Dre(t);return n.getTime()<r.getTime()}function tie(e,t){Lre(2,arguments);var n=Dre(e),r=Dre(t);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()}function nie(e,t){return Lre(2,arguments),Ire(e,-jre(t))}function rie(e,t){Lre(2,arguments);var n=Dre(e),r=jre(t),o=n.getFullYear(),i=n.getDate(),a=new Date(0);a.setFullYear(o,r,15),a.setHours(0,0,0,0);var s=function(e){Lre(1,arguments);var t=Dre(e),n=t.getFullYear(),r=t.getMonth(),o=new Date(0);return o.setFullYear(n,r+1,0),o.setHours(0,0,0,0),o.getDate()}(a);return n.setMonth(r,Math.min(i,s)),n}function oie(e,t){Lre(2,arguments);var n=Dre(e),r=jre(t);return isNaN(n.getTime())?new Date(NaN):(n.setFullYear(r),n)}var iie=function(){return iie=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},iie.apply(this,arguments)};function aie(e,t,n){for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}function sie(e){return"multiple"===e.mode}function lie(e){return"range"===e.mode}function cie(e){return"single"===e.mode}"function"==typeof SuppressedError&&SuppressedError;var uie={root:"rdp",multiple_months:"rdp-multiple_months",with_weeknumber:"rdp-with_weeknumber",vhidden:"rdp-vhidden",button_reset:"rdp-button_reset",button:"rdp-button",caption:"rdp-caption",caption_start:"rdp-caption_start",caption_end:"rdp-caption_end",caption_between:"rdp-caption_between",caption_label:"rdp-caption_label",caption_dropdowns:"rdp-caption_dropdowns",dropdown:"rdp-dropdown",dropdown_month:"rdp-dropdown_month",dropdown_year:"rdp-dropdown_year",dropdown_icon:"rdp-dropdown_icon",months:"rdp-months",month:"rdp-month",table:"rdp-table",tbody:"rdp-tbody",tfoot:"rdp-tfoot",head:"rdp-head",head_row:"rdp-head_row",head_cell:"rdp-head_cell",nav:"rdp-nav",nav_button:"rdp-nav_button",nav_button_previous:"rdp-nav_button_previous",nav_button_next:"rdp-nav_button_next",nav_icon:"rdp-nav_icon",row:"rdp-row",weeknumber:"rdp-weeknumber",cell:"rdp-cell",day:"rdp-day",day_today:"rdp-day_today",day_outside:"rdp-day_outside",day_selected:"rdp-day_selected",day_disabled:"rdp-day_disabled",day_hidden:"rdp-day_hidden",day_range_start:"rdp-day_range_start",day_range_end:"rdp-day_range_end",day_range_middle:"rdp-day_range_middle"};var die=Object.freeze({__proto__:null,formatCaption:function(e,t){return Yoe(e,"LLLL y",t)},formatDay:function(e,t){return Yoe(e,"d",t)},formatMonthCaption:function(e,t){return Yoe(e,"LLLL",t)},formatWeekNumber:function(e){return"".concat(e)},formatWeekdayName:function(e,t){return Yoe(e,"cccccc",t)},formatYearCaption:function(e,t){return Yoe(e,"yyyy",t)}}),pie=Object.freeze({__proto__:null,labelDay:function(e,t,n){return Yoe(e,"do MMMM (EEEE)",n)},labelMonthDropdown:function(){return"Month: "},labelNext:function(){return"Go to next month"},labelPrevious:function(){return"Go to previous month"},labelWeekNumber:function(e){return"Week n. ".concat(e)},labelWeekday:function(e,t){return Yoe(e,"cccc",t)},labelYearDropdown:function(){return"Year: "}});var fie=n.createContext(void 0);function hie(e){var n,r,o=e.initialProps,i={captionLayout:"buttons",classNames:uie,formatters:die,labels:pie,locale:zoe,modifiersClassNames:{},modifiers:{},numberOfMonths:1,styles:{},today:new Date,mode:"default"},a=function(e){var t=e.fromYear,n=e.toYear,r=e.fromMonth,o=e.toMonth,i=e.fromDate,a=e.toDate;return r?i=Jre(r):t&&(i=new Date(t,0,1)),o?a=Qre(o):n&&(a=new Date(n,11,31)),{fromDate:i?qre(i):void 0,toDate:a?qre(a):void 0}}(o),s=a.fromDate,l=a.toDate,c=null!==(n=o.captionLayout)&&void 0!==n?n:i.captionLayout;"buttons"===c||s&&l||(c="buttons"),(cie(o)||sie(o)||lie(o))&&(r=o.onSelect);var u=iie(iie(iie({},i),o),{captionLayout:c,classNames:iie(iie({},i.classNames),o.classNames),components:iie({},o.components),formatters:iie(iie({},i.formatters),o.formatters),fromDate:s,labels:iie(iie({},i.labels),o.labels),mode:o.mode||i.mode,modifiers:iie(iie({},i.modifiers),o.modifiers),modifiersClassNames:iie(iie({},i.modifiersClassNames),o.modifiersClassNames),onSelect:r,styles:iie(iie({},i.styles),o.styles),toDate:l});return t.jsx(fie.Provider,{value:u,children:e.children})}function mie(){var e=n.useContext(fie);if(!e)throw new Error("useDayPicker must be used within a DayPickerProvider.");return e}function gie(e){var n=mie();return t.jsx("div",{className:n.classNames.caption_label,style:n.styles.caption_label,"aria-live":"polite",role:"presentation",id:e.id,children:(0,n.formatters.formatCaption)(e.displayMonth,{locale:n.locale})})}function vie(e){return t.jsx("svg",iie({width:"8px",height:"8px",viewBox:"0 0 120 120","data-testid":"iconDropdown"},e,{children:t.jsx("path",{d:"M4.22182541,48.2218254 C8.44222828,44.0014225 15.2388494,43.9273804 19.5496459,47.9996989 L19.7781746,48.2218254 L60,88.443 L100.221825,48.2218254 C104.442228,44.0014225 111.238849,43.9273804 115.549646,47.9996989 L115.778175,48.2218254 C119.998577,52.4422283 120.07262,59.2388494 116.000301,63.5496459 L115.778175,63.7781746 L67.7781746,111.778175 C63.5577717,115.998577 56.7611506,116.07262 52.4503541,112.000301 L52.2218254,111.778175 L4.22182541,63.7781746 C-0.0739418023,59.4824074 -0.0739418023,52.5175926 4.22182541,48.2218254 Z",fill:"currentColor",fillRule:"nonzero"})}))}function yie(e){var n,r,o=e.onChange,i=e.value,a=e.children,s=e.caption,l=e.className,c=e.style,u=mie(),d=null!==(r=null===(n=u.components)||void 0===n?void 0:n.IconDropdown)&&void 0!==r?r:vie;return t.jsxs("div",{className:l,style:c,children:[t.jsx("span",{className:u.classNames.vhidden,children:e["aria-label"]}),t.jsx("select",{name:e.name,"aria-label":e["aria-label"],className:u.classNames.dropdown,style:u.styles.dropdown,value:i,onChange:o,children:a}),t.jsxs("div",{className:u.classNames.caption_label,style:u.styles.caption_label,"aria-hidden":"true",children:[s,t.jsx(d,{className:u.classNames.dropdown_icon,style:u.styles.dropdown_icon})]})]})}function bie(e){var n,r=mie(),o=r.fromDate,i=r.toDate,a=r.styles,s=r.locale,l=r.formatters.formatMonthCaption,c=r.classNames,u=r.components,d=r.labels.labelMonthDropdown;if(!o)return t.jsx(t.Fragment,{});if(!i)return t.jsx(t.Fragment,{});var p=[];if(function(e,t){Lre(2,arguments);var n=Dre(e),r=Dre(t);return n.getFullYear()===r.getFullYear()}(o,i))for(var f=Jre(o),h=o.getMonth();h<=i.getMonth();h++)p.push(rie(f,h));else for(f=Jre(new Date),h=0;h<=11;h++)p.push(rie(f,h));var m=null!==(n=null==u?void 0:u.Dropdown)&&void 0!==n?n:yie;return t.jsx(m,{name:"months","aria-label":d(),className:c.dropdown_month,style:a.dropdown_month,onChange:function(t){var n=Number(t.target.value),r=rie(Jre(e.displayMonth),n);e.onChange(r)},value:e.displayMonth.getMonth(),caption:l(e.displayMonth,{locale:s}),children:p.map((function(e){return t.jsx("option",{value:e.getMonth(),children:l(e,{locale:s})},e.getMonth())}))})}function xie(e){var n,r=e.displayMonth,o=mie(),i=o.fromDate,a=o.toDate,s=o.locale,l=o.styles,c=o.classNames,u=o.components,d=o.formatters.formatYearCaption,p=o.labels.labelYearDropdown,f=[];if(!i)return t.jsx(t.Fragment,{});if(!a)return t.jsx(t.Fragment,{});for(var h=i.getFullYear(),m=a.getFullYear(),g=h;g<=m;g++)f.push(oie(eoe(new Date),g));var v=null!==(n=null==u?void 0:u.Dropdown)&&void 0!==n?n:yie;return t.jsx(v,{name:"years","aria-label":p(),className:c.dropdown_year,style:l.dropdown_year,onChange:function(t){var n=oie(Jre(r),Number(t.target.value));e.onChange(n)},value:r.getFullYear(),caption:d(r,{locale:s}),children:f.map((function(e){return t.jsx("option",{value:e.getFullYear(),children:d(e,{locale:s})},e.getFullYear())}))})}function wie(){var e=mie(),t=function(e){var t=e.month||e.defaultMonth||e.today||new Date,n=e.toDate,r=e.fromDate,o=e.numberOfMonths,i=void 0===o?1:o;return n&&Zre(n,t)<0&&(t=Fre(n,-1*(i-1))),r&&Zre(t,r)<0&&(t=r),Jre(t)}(e),r=function(e,t){var r=n.useState(e);return[void 0===t?r[0]:t,r[1]]}(t,e.month),o=r[1];return[r[0],function(t){var n;if(!e.disableNavigation){var r=Jre(t);o(r),null===(n=e.onMonthChange)||void 0===n||n.call(e,r)}}]}var _ie=n.createContext(void 0);function Sie(e){var n=mie(),r=wie(),o=r[0],i=r[1],a=function(e,t){for(var n=t.reverseMonths,r=t.numberOfMonths,o=Jre(e),i=Zre(Jre(Fre(o,r)),o),a=[],s=0;s<i;s++){var l=Fre(o,s);a.push(l)}return n&&(a=a.reverse()),a}(o,n),s=function(e,t){if(!t.disableNavigation){var n=t.toDate,r=t.numberOfMonths,o=void 0===r?1:r,i=t.pagedNavigation?o:1,a=Jre(e);if(!n)return Fre(a,i);if(!(Zre(n,e)<o))return Fre(a,i)}}(o,n),l=function(e,t){if(!t.disableNavigation){var n=t.fromDate,r=t.numberOfMonths,o=t.pagedNavigation?void 0===r?1:r:1,i=Jre(e);if(!n)return Fre(i,-o);if(!(Zre(i,n)<=0))return Fre(i,-o)}}(o,n),c=function(e){return a.some((function(t){return tie(e,t)}))};return t.jsx(_ie.Provider,{value:{currentMonth:o,displayMonths:a,goToMonth:i,goToDate:function(e,t){c(e)||(t&&eie(e,t)?i(Fre(e,1+-1*n.numberOfMonths)):i(e))},previousMonth:l,nextMonth:s,isDateDisplayed:c},children:e.children})}function Eie(){var e=n.useContext(_ie);if(!e)throw new Error("useNavigation must be used within a NavigationProvider");return e}function Tie(e){var n,r=mie(),o=r.classNames,i=r.styles,a=r.components,s=Eie().goToMonth,l=function(t){s(Fre(t,e.displayIndex?-e.displayIndex:0))},c=null!==(n=null==a?void 0:a.CaptionLabel)&&void 0!==n?n:gie,u=t.jsx(c,{id:e.id,displayMonth:e.displayMonth});return t.jsxs("div",{className:o.caption_dropdowns,style:i.caption_dropdowns,children:[t.jsx("div",{className:o.vhidden,children:u}),t.jsx(bie,{onChange:l,displayMonth:e.displayMonth}),t.jsx(xie,{onChange:l,displayMonth:e.displayMonth})]})}function Cie(e){return t.jsx("svg",iie({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:t.jsx("path",{d:"M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z",fill:"currentColor",fillRule:"nonzero"})}))}function Aie(e){return t.jsx("svg",iie({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:t.jsx("path",{d:"M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z",fill:"currentColor"})}))}var Nie=n.forwardRef((function(e,n){var r=mie(),o=r.classNames,i=r.styles,a=[o.button_reset,o.button];e.className&&a.push(e.className);var s=a.join(" "),l=iie(iie({},i.button_reset),i.button);return e.style&&Object.assign(l,e.style),t.jsx("button",iie({},e,{ref:n,type:"button",className:s,style:l}))}));function Rie(e){var n,r,o=mie(),i=o.dir,a=o.locale,s=o.classNames,l=o.styles,c=o.labels,u=c.labelPrevious,d=c.labelNext,p=o.components;if(!e.nextMonth&&!e.previousMonth)return t.jsx(t.Fragment,{});var f=u(e.previousMonth,{locale:a}),h=[s.nav_button,s.nav_button_previous].join(" "),m=d(e.nextMonth,{locale:a}),g=[s.nav_button,s.nav_button_next].join(" "),v=null!==(n=null==p?void 0:p.IconRight)&&void 0!==n?n:Aie,y=null!==(r=null==p?void 0:p.IconLeft)&&void 0!==r?r:Cie;return t.jsxs("div",{className:s.nav,style:l.nav,children:[!e.hidePrevious&&t.jsx(Nie,{name:"previous-month","aria-label":f,className:h,style:l.nav_button_previous,disabled:!e.previousMonth,onClick:e.onPreviousClick,children:t.jsx("rtl"===i?v:y,{className:s.nav_icon,style:l.nav_icon})}),!e.hideNext&&t.jsx(Nie,{name:"next-month","aria-label":m,className:g,style:l.nav_button_next,disabled:!e.nextMonth,onClick:e.onNextClick,children:t.jsx("rtl"===i?y:v,{className:s.nav_icon,style:l.nav_icon})})]})}function Oie(e){var n=mie().numberOfMonths,r=Eie(),o=r.previousMonth,i=r.nextMonth,a=r.goToMonth,s=r.displayMonths,l=s.findIndex((function(t){return tie(e.displayMonth,t)})),c=0===l,u=l===s.length-1;return t.jsx(Rie,{displayMonth:e.displayMonth,hideNext:n>1&&(c||!u),hidePrevious:n>1&&(u||!c),nextMonth:i,previousMonth:o,onPreviousClick:function(){o&&a(o)},onNextClick:function(){i&&a(i)}})}function Pie(e){var n,r,o=mie(),i=o.classNames,a=o.styles,s=o.captionLayout,l=o.components,c=null!==(n=null==l?void 0:l.CaptionLabel)&&void 0!==n?n:gie;return r=o.disableNavigation?t.jsx(c,{id:e.id,displayMonth:e.displayMonth}):"dropdown"===s?t.jsx(Tie,{displayMonth:e.displayMonth,id:e.id}):t.jsxs(t.Fragment,"dropdown-buttons"===s?{children:[t.jsx(Tie,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id}),t.jsx(Oie,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id})]}:{children:[t.jsx(c,{id:e.id,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),t.jsx(Oie,{displayMonth:e.displayMonth,id:e.id})]}),t.jsx("div",{className:i.caption,style:a.caption,children:r})}function kie(e){var n=mie(),r=n.footer;return r?t.jsx("tfoot",{className:n.classNames.tfoot,style:n.styles.tfoot,children:t.jsx("tr",{children:t.jsx("td",{colSpan:8,children:r})})}):t.jsx(t.Fragment,{})}function Mie(){var e=mie(),n=e.classNames,r=e.styles,o=e.showWeekNumber,i=e.locale,a=e.formatters.formatWeekdayName,s=e.labels.labelWeekday,l=function(e,t,n){for(var r=n?Bre(new Date):Vre(new Date,{locale:e,weekStartsOn:t}),o=[],i=0;i<7;i++){var a=Ire(r,i);o.push(a)}return o}(i,e.weekStartsOn,e.ISOWeek);return t.jsxs("tr",{style:r.head_row,className:n.head_row,children:[o&&t.jsx("td",{style:r.head_cell,className:n.head_cell}),l.map((function(e,o){return t.jsx("th",{scope:"col",className:n.head_cell,style:r.head_cell,"aria-label":s(e,{locale:i}),children:a(e,{locale:i})},o)}))]})}function jie(){var e,n=mie(),r=n.components,o=null!==(e=null==r?void 0:r.HeadRow)&&void 0!==e?e:Mie;return t.jsx("thead",{style:n.styles.head,className:n.classNames.head,children:t.jsx(o,{})})}function Lie(e){var n=mie();return t.jsx(t.Fragment,{children:(0,n.formatters.formatDay)(e.date,{locale:n.locale})})}var Die=n.createContext(void 0);function Iie(e){if(!sie(e.initialProps)){return t.jsx(Die.Provider,{value:{selected:void 0,modifiers:{disabled:[]}},children:e.children})}return t.jsx(Fie,{initialProps:e.initialProps,children:e.children})}function Fie(e){var n=e.initialProps,r=e.children,o=n.selected,i=n.min,a=n.max,s={disabled:[]};return o&&s.disabled.push((function(e){var t=a&&o.length>a-1,n=o.some((function(t){return Yre(t,e)}));return Boolean(t&&!n)})),t.jsx(Die.Provider,{value:{selected:o,onDayClick:function(e,t,r){var s,l;if((null===(s=n.onDayClick)||void 0===s||s.call(n,e,t,r),!Boolean(t.selected&&i&&(null==o?void 0:o.length)===i))&&!Boolean(!t.selected&&a&&(null==o?void 0:o.length)===a)){var c=o?aie([],o):[];if(t.selected){var u=c.findIndex((function(t){return Yre(e,t)}));c.splice(u,1)}else c.push(e);null===(l=n.onSelect)||void 0===l||l.call(n,c,e,t,r)}},modifiers:s},children:r})}function Uie(){var e=n.useContext(Die);if(!e)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return e}var $ie,Vie,Bie=n.createContext(void 0);function zie(e){if(!lie(e.initialProps)){return t.jsx(Bie.Provider,{value:{selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}},children:e.children})}return t.jsx(Hie,{initialProps:e.initialProps,children:e.children})}function Hie(e){var n=e.initialProps,r=e.children,o=n.selected,i=o||{},a=i.from,s=i.to,l=n.min,c=n.max,u={range_start:[],range_end:[],range_middle:[],disabled:[]};if(a?(u.range_start=[a],s?(u.range_end=[s],Yre(a,s)||(u.range_middle=[{after:a,before:s}])):u.range_end=[a]):s&&(u.range_start=[s],u.range_end=[s]),l&&(a&&!s&&u.disabled.push({after:nie(a,l-1),before:Ire(a,l-1)}),a&&s&&u.disabled.push({after:a,before:Ire(a,l-1)}),!a&&s&&u.disabled.push({after:nie(s,l-1),before:Ire(s,l-1)})),c){if(a&&!s&&(u.disabled.push({before:Ire(a,1-c)}),u.disabled.push({after:Ire(a,c-1)})),a&&s){var d=c-(Gre(s,a)+1);u.disabled.push({before:nie(a,d)}),u.disabled.push({after:Ire(s,d)})}!a&&s&&(u.disabled.push({before:Ire(s,1-c)}),u.disabled.push({after:Ire(s,c-1)}))}return t.jsx(Bie.Provider,{value:{selected:o,onDayClick:function(e,t,r){var i,a;null===(i=n.onDayClick)||void 0===i||i.call(n,e,t,r);var s=function(e,t){var n=t||{},r=n.from,o=n.to;if(r&&o){if(Yre(o,e)&&Yre(r,e))return;if(Yre(o,e))return{from:o,to:void 0};if(Yre(r,e))return;return Joe(r,e)?{from:e,to:o}:{from:r,to:e}}return o?Joe(e,o)?{from:o,to:e}:{from:e,to:o}:r?eie(e,r)?{from:e,to:r}:{from:r,to:e}:{from:e,to:void 0}}(e,o);null===(a=n.onSelect)||void 0===a||a.call(n,s,e,t,r)},modifiers:u},children:r})}function qie(){var e=n.useContext(Bie);if(!e)throw new Error("useSelectRange must be used within a SelectRangeProvider");return e}function Gie(e){return Array.isArray(e)?aie([],e):void 0!==e?[e]:[]}(Vie=$ie||($ie={})).Outside="outside",Vie.Disabled="disabled",Vie.Selected="selected",Vie.Hidden="hidden",Vie.Today="today",Vie.RangeStart="range_start",Vie.RangeEnd="range_end",Vie.RangeMiddle="range_middle";var Kie=$ie.Selected,Wie=$ie.Disabled,Yie=$ie.Hidden,Xie=$ie.Today,Zie=$ie.RangeEnd,Qie=$ie.RangeMiddle,Jie=$ie.RangeStart,eae=$ie.Outside;var tae=n.createContext(void 0);function nae(e){var n=mie(),r=function(e,t,n){var r,o=((r={})[Kie]=Gie(e.selected),r[Wie]=Gie(e.disabled),r[Yie]=Gie(e.hidden),r[Xie]=[e.today],r[Zie]=[],r[Qie]=[],r[Jie]=[],r[eae]=[],r);return e.fromDate&&o[Wie].push({before:e.fromDate}),e.toDate&&o[Wie].push({after:e.toDate}),sie(e)?o[Wie]=o[Wie].concat(t.modifiers[Wie]):lie(e)&&(o[Wie]=o[Wie].concat(n.modifiers[Wie]),o[Jie]=n.modifiers[Jie],o[Qie]=n.modifiers[Qie],o[Zie]=n.modifiers[Zie]),o}(n,Uie(),qie()),o=function(e){var t={};return Object.entries(e).forEach((function(e){t[e[0]]=Gie(e[1])})),t}(n.modifiers),i=iie(iie({},r),o);return t.jsx(tae.Provider,{value:i,children:e.children})}function rae(){var e=n.useContext(tae);if(!e)throw new Error("useModifiers must be used within a ModifiersProvider");return e}function oae(e,t){return t.some((function(t){if("boolean"==typeof t)return t;if(Xre(t))return Yre(e,t);var n,r,o,i,a;if(function(e){return Array.isArray(e)&&e.every(Xre)}(t))return t.includes(e);if(function(e){return Boolean(e&&"object"==typeof e&&"from"in e)}(t))return n=e,a=(r=t).to,(i=r.from)&&a?(Gre(a,i)<0&&(i=(o=[a,i])[0],a=o[1]),Gre(n,i)>=0&&Gre(a,n)>=0):a?Yre(a,n):!!i&&Yre(i,n);if(function(e){return Boolean(e&&"object"==typeof e&&"dayOfWeek"in e)}(t))return t.dayOfWeek.includes(e.getDay());if(function(e){return Boolean(e&&"object"==typeof e&&"before"in e&&"after"in e)}(t)){var s=Gre(t.before,e)>0,l=Gre(t.after,e)<0;return Joe(t.before,t.after)?l&&s:s||l}return function(e){return Boolean(e&&"object"==typeof e&&"after"in e)}(t)?Gre(e,t.after)>0:function(e){return Boolean(e&&"object"==typeof e&&"before"in e)}(t)?Gre(t.before,e)>0:"function"==typeof t&&t(e)}))}function iae(e,t,n){var r=Object.keys(t).reduce((function(n,r){return oae(e,t[r])&&n.push(r),n}),[]),o={};return r.forEach((function(e){return o[e]=!0})),n&&!tie(e,n)&&(o.outside=!0),o}function aae(e,t){var n=t.moveBy,r=t.direction,o=t.context,i=t.modifiers,a=t.retry,s=void 0===a?{count:0,lastFocused:e}:a,l=o.weekStartsOn,c=o.fromDate,u=o.toDate,d=o.locale,p={day:Ire,week:Kre,month:Fre,year:Wre,startOfWeek:function(e){return o.ISOWeek?Bre(e):Vre(e,{locale:d,weekStartsOn:l})},endOfWeek:function(e){return o.ISOWeek?noe(e):toe(e,{locale:d,weekStartsOn:l})}}[n](e,"after"===r?1:-1);"before"===r&&c?p=function(e){var t,n;if(Lre(1,arguments),e&&"function"==typeof e.forEach)t=e;else{if("object"!==Mre(e)||null===e)return new Date(NaN);t=Array.prototype.slice.call(e)}return t.forEach((function(e){var t=Dre(e);(void 0===n||n<t||isNaN(Number(t)))&&(n=t)})),n||new Date(NaN)}([c,p]):"after"===r&&u&&(p=function(e){var t,n;if(Lre(1,arguments),e&&"function"==typeof e.forEach)t=e;else{if("object"!==Mre(e)||null===e)return new Date(NaN);t=Array.prototype.slice.call(e)}return t.forEach((function(e){var t=Dre(e);(void 0===n||n>t||isNaN(t.getDate()))&&(n=t)})),n||new Date(NaN)}([u,p]));var f=!0;if(i){var h=iae(p,i);f=!h.disabled&&!h.hidden}return f?p:s.count>365?s.lastFocused:aae(p,{moveBy:n,direction:r,context:o,modifiers:i,retry:iie(iie({},s),{count:s.count+1})})}var sae=n.createContext(void 0);function lae(e){var r=Eie(),o=rae(),i=n.useState(),a=i[0],s=i[1],l=n.useState(),c=l[0],u=l[1],d=function(e,t){for(var n,r,o=Jre(e[0]),i=Qre(e[e.length-1]),a=o;a<=i;){var s=iae(a,t);if(s.disabled||s.hidden)a=Ire(a,1);else{if(s.selected)return a;s.today&&!r&&(r=a),n||(n=a),a=Ire(a,1)}}return r||n}(r.displayMonths,o),p=(null!=a?a:c&&r.isDateDisplayed(c))?c:d,f=function(e){s(e)},h=mie(),m=function(e,t){if(a){var n=aae(a,{moveBy:e,direction:t,context:h,modifiers:o});Yre(a,n)||(r.goToDate(n,a),f(n))}};return t.jsx(sae.Provider,{value:{focusedDay:a,focusTarget:p,blur:function(){u(a),s(void 0)},focus:f,focusDayAfter:function(){return m("day","after")},focusDayBefore:function(){return m("day","before")},focusWeekAfter:function(){return m("week","after")},focusWeekBefore:function(){return m("week","before")},focusMonthBefore:function(){return m("month","before")},focusMonthAfter:function(){return m("month","after")},focusYearBefore:function(){return m("year","before")},focusYearAfter:function(){return m("year","after")},focusStartOfWeek:function(){return m("startOfWeek","before")},focusEndOfWeek:function(){return m("endOfWeek","after")}},children:e.children})}function cae(){var e=n.useContext(sae);if(!e)throw new Error("useFocusContext must be used within a FocusProvider");return e}var uae=n.createContext(void 0);function dae(e){if(!cie(e.initialProps)){return t.jsx(uae.Provider,{value:{selected:void 0},children:e.children})}return t.jsx(pae,{initialProps:e.initialProps,children:e.children})}function pae(e){var n=e.initialProps;return t.jsx(uae.Provider,{value:{selected:n.selected,onDayClick:function(e,t,r){var o,i,a;null===(o=n.onDayClick)||void 0===o||o.call(n,e,t,r),!t.selected||n.required?null===(a=n.onSelect)||void 0===a||a.call(n,e,e,t,r):null===(i=n.onSelect)||void 0===i||i.call(n,void 0,e,t,r)}},children:e.children})}function fae(){var e=n.useContext(uae);if(!e)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return e}function hae(e,t){var n=[e.classNames.day];return Object.keys(t).forEach((function(t){var r=e.modifiersClassNames[t];if(r)n.push(r);else if(function(e){return Object.values($ie).includes(e)}(t)){var o=e.classNames["day_".concat(t)];o&&n.push(o)}})),n}function mae(e,r,o){var i,a,s,l=mie(),c=cae(),u=function(e,t){return iae(e,rae(),t)}(e,r),d=function(e,t){var n=mie(),r=fae(),o=Uie(),i=qie(),a=cae(),s=a.focusDayAfter,l=a.focusDayBefore,c=a.focusWeekAfter,u=a.focusWeekBefore,d=a.blur,p=a.focus,f=a.focusMonthBefore,h=a.focusMonthAfter,m=a.focusYearBefore,g=a.focusYearAfter,v=a.focusStartOfWeek,y=a.focusEndOfWeek;return{onClick:function(a){var s,l,c,u;cie(n)?null===(s=r.onDayClick)||void 0===s||s.call(r,e,t,a):sie(n)?null===(l=o.onDayClick)||void 0===l||l.call(o,e,t,a):lie(n)?null===(c=i.onDayClick)||void 0===c||c.call(i,e,t,a):null===(u=n.onDayClick)||void 0===u||u.call(n,e,t,a)},onFocus:function(r){var o;p(e),null===(o=n.onDayFocus)||void 0===o||o.call(n,e,t,r)},onBlur:function(r){var o;d(),null===(o=n.onDayBlur)||void 0===o||o.call(n,e,t,r)},onKeyDown:function(r){var o;switch(r.key){case"ArrowLeft":r.preventDefault(),r.stopPropagation(),"rtl"===n.dir?s():l();break;case"ArrowRight":r.preventDefault(),r.stopPropagation(),"rtl"===n.dir?l():s();break;case"ArrowDown":r.preventDefault(),r.stopPropagation(),c();break;case"ArrowUp":r.preventDefault(),r.stopPropagation(),u();break;case"PageUp":r.preventDefault(),r.stopPropagation(),r.shiftKey?m():f();break;case"PageDown":r.preventDefault(),r.stopPropagation(),r.shiftKey?g():h();break;case"Home":r.preventDefault(),r.stopPropagation(),v();break;case"End":r.preventDefault(),r.stopPropagation(),y()}null===(o=n.onDayKeyDown)||void 0===o||o.call(n,e,t,r)},onKeyUp:function(r){var o;null===(o=n.onDayKeyUp)||void 0===o||o.call(n,e,t,r)},onMouseEnter:function(r){var o;null===(o=n.onDayMouseEnter)||void 0===o||o.call(n,e,t,r)},onMouseLeave:function(r){var o;null===(o=n.onDayMouseLeave)||void 0===o||o.call(n,e,t,r)},onPointerEnter:function(r){var o;null===(o=n.onDayPointerEnter)||void 0===o||o.call(n,e,t,r)},onPointerLeave:function(r){var o;null===(o=n.onDayPointerLeave)||void 0===o||o.call(n,e,t,r)},onTouchCancel:function(r){var o;null===(o=n.onDayTouchCancel)||void 0===o||o.call(n,e,t,r)},onTouchEnd:function(r){var o;null===(o=n.onDayTouchEnd)||void 0===o||o.call(n,e,t,r)},onTouchMove:function(r){var o;null===(o=n.onDayTouchMove)||void 0===o||o.call(n,e,t,r)},onTouchStart:function(r){var o;null===(o=n.onDayTouchStart)||void 0===o||o.call(n,e,t,r)}}}(e,u),p=function(){var e=mie(),t=fae(),n=Uie(),r=qie();return cie(e)?t.selected:sie(e)?n.selected:lie(e)?r.selected:void 0}(),f=Boolean(l.onDayClick||"default"!==l.mode);n.useEffect((function(){var t;u.outside||c.focusedDay&&f&&Yre(c.focusedDay,e)&&(null===(t=o.current)||void 0===t||t.focus())}),[c.focusedDay,e,o,f,u.outside]);var h=hae(l,u).join(" "),m=function(e,t){var n=iie({},e.styles.day);return Object.keys(t).forEach((function(t){var r;n=iie(iie({},n),null===(r=e.modifiersStyles)||void 0===r?void 0:r[t])})),n}(l,u),g=Boolean(u.outside&&!l.showOutsideDays||u.hidden),v=null!==(s=null===(a=l.components)||void 0===a?void 0:a.DayContent)&&void 0!==s?s:Lie,y={style:m,className:h,children:t.jsx(v,{date:e,displayMonth:r,activeModifiers:u}),role:"gridcell"},b=c.focusTarget&&Yre(c.focusTarget,e)&&!u.outside,x=c.focusedDay&&Yre(c.focusedDay,e),w=iie(iie(iie({},y),((i={disabled:u.disabled,role:"gridcell"})["aria-selected"]=u.selected,i.tabIndex=x||b?0:-1,i)),d);return{isButton:f,isHidden:g,activeModifiers:u,selectedDays:p,buttonProps:w,divProps:y}}function gae(e){var r=n.useRef(null),o=mae(e.date,e.displayMonth,r);return o.isHidden?t.jsx("div",{role:"gridcell"}):o.isButton?t.jsx(Nie,iie({name:"day",ref:r},o.buttonProps)):t.jsx("div",iie({},o.divProps))}function vae(e){var n=e.number,r=e.dates,o=mie(),i=o.onWeekNumberClick,a=o.styles,s=o.classNames,l=o.locale,c=o.labels.labelWeekNumber,u=(0,o.formatters.formatWeekNumber)(Number(n),{locale:l});if(!i)return t.jsx("span",{className:s.weeknumber,style:a.weeknumber,children:u});var d=c(Number(n),{locale:l});return t.jsx(Nie,{name:"week-number","aria-label":d,className:s.weeknumber,style:a.weeknumber,onClick:function(e){i(n,r,e)},children:u})}function yae(e){var n,r,o,i=mie(),a=i.styles,s=i.classNames,l=i.components,c=null!==(n=null==l?void 0:l.Day)&&void 0!==n?n:gae,u=null!==(r=null==l?void 0:l.WeekNumber)&&void 0!==r?r:vae;return i.showWeekNumber&&(o=t.jsx("td",{className:s.cell,style:a.cell,children:t.jsx(u,{number:e.weekNumber,dates:e.dates})})),t.jsxs("tr",{className:s.row,style:a.row,children:[o,e.dates.map((function(n){return t.jsx("td",{className:s.cell,style:a.cell,role:"presentation",children:t.jsx(c,{displayMonth:e.displayMonth,date:n})},Xoe(n))}))]})}function bae(e,t,n){for(var r=(null==n?void 0:n.ISOWeek)?noe(t):toe(t,n),o=(null==n?void 0:n.ISOWeek)?Bre(e):Vre(e,n),i=Gre(r,o),a=[],s=0;s<=i;s++)a.push(Ire(o,s));var l=a.reduce((function(e,t){var r=(null==n?void 0:n.ISOWeek)?function(e){Lre(1,arguments);var t=Dre(e),n=Bre(t).getTime()-zre(t).getTime();return Math.round(n/6048e5)+1}(t):function(e,t){Lre(1,arguments);var n=Dre(e),r=Vre(n,t).getTime()-Zoe(n,t).getTime();return Math.round(r/6048e5)+1}(t,n),o=e.find((function(e){return e.weekNumber===r}));return o?(o.dates.push(t),e):(e.push({weekNumber:r,dates:[t]}),e)}),[]);return l}function xae(e){var n,r,o,i=mie(),a=i.locale,s=i.classNames,l=i.styles,c=i.hideHead,u=i.components,d=i.weekStartsOn,p=i.firstWeekContainsDate,f=i.ISOWeek,h=function(e,t){var n=bae(Jre(e),Qre(e),t);if(null==t?void 0:t.useFixedWeeks){var r=Qoe(e,t);if(r<6){var o=n[n.length-1],i=o.dates[o.dates.length-1],a=Kre(i,6-r),s=bae(Kre(i,1),a,t);n.push.apply(n,s)}}return n}(e.displayMonth,{useFixedWeeks:Boolean(i.fixedWeeks),ISOWeek:f,locale:a,weekStartsOn:d,firstWeekContainsDate:p}),m=null!==(n=null==u?void 0:u.Head)&&void 0!==n?n:jie,g=null!==(r=null==u?void 0:u.Row)&&void 0!==r?r:yae,v=null!==(o=null==u?void 0:u.Footer)&&void 0!==o?o:kie;return t.jsxs("table",{id:e.id,className:s.table,style:l.table,role:"grid","aria-labelledby":e["aria-labelledby"],children:[!c&&t.jsx(m,{}),t.jsx("tbody",{className:s.tbody,style:l.tbody,children:h.map((function(n){return t.jsx(g,{displayMonth:e.displayMonth,dates:n.dates,weekNumber:n.weekNumber},n.weekNumber)}))}),t.jsx(v,{displayMonth:e.displayMonth})]})}var wae="undefined"!=typeof window&&window.document&&window.document.createElement?n.useLayoutEffect:n.useEffect,_ae=!1,Sae=0;function Eae(){return"react-day-picker-".concat(++Sae)}function Tae(e){var r,o,i=mie(),a=i.dir,s=i.classNames,l=i.styles,c=i.components,u=Eie().displayMonths,d=function(e){var t,r=null!=e?e:_ae?Eae():null,o=n.useState(r),i=o[0],a=o[1];return wae((function(){null===i&&a(Eae())}),[]),n.useEffect((function(){!1===_ae&&(_ae=!0)}),[]),null!==(t=null!=e?e:i)&&void 0!==t?t:void 0}(i.id?"".concat(i.id,"-").concat(e.displayIndex):void 0),p=i.id?"".concat(i.id,"-grid-").concat(e.displayIndex):void 0,f=[s.month],h=l.month,m=0===e.displayIndex,g=e.displayIndex===u.length-1,v=!m&&!g;"rtl"===a&&(g=(r=[m,g])[0],m=r[1]),m&&(f.push(s.caption_start),h=iie(iie({},h),l.caption_start)),g&&(f.push(s.caption_end),h=iie(iie({},h),l.caption_end)),v&&(f.push(s.caption_between),h=iie(iie({},h),l.caption_between));var y=null!==(o=null==c?void 0:c.Caption)&&void 0!==o?o:Pie;return t.jsxs("div",{className:f.join(" "),style:h,children:[t.jsx(y,{id:d,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),t.jsx(xae,{id:p,"aria-labelledby":d,displayMonth:e.displayMonth})]},e.displayIndex)}function Cae(e){var n=mie();return t.jsx("div",{className:n.classNames.months,style:n.styles.months,children:e.children})}function Aae(e){var r,o,i=e.initialProps,a=mie(),s=cae(),l=Eie(),c=n.useState(!1),u=c[0],d=c[1];n.useEffect((function(){a.initialFocus&&s.focusTarget&&(u||(s.focus(s.focusTarget),d(!0)))}),[a.initialFocus,u,s.focus,s.focusTarget,s]);var p=[a.classNames.root,a.className];a.numberOfMonths>1&&p.push(a.classNames.multiple_months),a.showWeekNumber&&p.push(a.classNames.with_weeknumber);var f=iie(iie({},a.styles.root),a.style),h=Object.keys(i).filter((function(e){return e.startsWith("data-")})).reduce((function(e,t){var n;return iie(iie({},e),((n={})[t]=i[t],n))}),{}),m=null!==(o=null===(r=i.components)||void 0===r?void 0:r.Months)&&void 0!==o?o:Cae;return t.jsx("div",iie({className:p.join(" "),style:f,dir:a.dir,id:a.id,nonce:i.nonce,title:i.title,lang:i.lang},h,{children:t.jsx(m,{children:l.displayMonths.map((function(e,n){return t.jsx(Tae,{displayIndex:n,displayMonth:e},n)}))})}))}function Nae(e){var n=e.children,r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["children"]);return t.jsx(hie,{initialProps:r,children:t.jsx(Sie,{children:t.jsx(dae,{initialProps:r,children:t.jsx(Iie,{initialProps:r,children:t.jsx(zie,{initialProps:r,children:t.jsx(nae,{children:t.jsx(lae,{children:n})})})})})})})}function Rae(e){return t.jsx(Nae,iie({},e,{children:t.jsx(Aae,{initialProps:e})}))}function Oae({className:e,classNames:n,showOutsideDays:r=!0,...o}){return t.jsx(Rae,{showOutsideDays:r,className:Zd("p-3",e),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:Zd(gZ({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:Zd("relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected].day-range-end)]:rounded-r-md","range"===o.mode?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md"),day:Zd(gZ({variant:"ghost"}),"h-8 w-8 p-0 font-normal aria-selected:opacity-100"),day_range_start:"day-range-start",day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground aria-selected:bg-accent/50 aria-selected:text-muted-foreground",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...n},components:{IconLeft:()=>t.jsx(hu,{className:"h-4 w-4"}),IconRight:()=>t.jsx(mu,{className:"h-4 w-4"})},...o})}Oae.displayName="Calendar";var Pae=.999,kae=/[\\\/_+.#"@\[\(\{&]/,Mae=/[\\\/_+.#"@\[\(\{&]/g,jae=/[\s-]/,Lae=/[\s-]/g;function Dae(e,t,n,r,o,i,a){if(i===t.length)return o===e.length?1:.99;var s=`${o},${i}`;if(void 0!==a[s])return a[s];for(var l,c,u,d,p=r.charAt(i),f=n.indexOf(p,o),h=0;f>=0;)(l=Dae(e,t,n,r,f+1,i+1,a))>h&&(f===o?l*=1:kae.test(e.charAt(f-1))?(l*=.8,(u=e.slice(o,f-1).match(Mae))&&o>0&&(l*=Math.pow(Pae,u.length))):jae.test(e.charAt(f-1))?(l*=.9,(d=e.slice(o,f-1).match(Lae))&&o>0&&(l*=Math.pow(Pae,d.length))):(l*=.17,o>0&&(l*=Math.pow(Pae,f-o))),e.charAt(f)!==t.charAt(i)&&(l*=.9999)),(l<.1&&n.charAt(f-1)===r.charAt(i+1)||r.charAt(i+1)===r.charAt(i)&&n.charAt(f-1)!==r.charAt(i))&&(.1*(c=Dae(e,t,n,r,f+1,i+2,a))>l&&(l=.1*c)),l>h&&(h=l),f=n.indexOf(p,f+1);return a[s]=h,h}function Iae(e){return e.toLowerCase().replace(Lae," ")}function Fae(e,t,n){return Dae(e=n&&n.length>0?""+(e+" "+n.join(" ")):e,t,Iae(e),Iae(t),0,0,{})}var Uae,$ae={exports:{}},Vae={};var Bae,zae={};
|
|
86
86
|
/**
|
|
87
87
|
* @license React
|
|
88
88
|
* use-sync-external-store-shim.development.js
|