(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,526456,e=>{"use strict";var t=e.i(699173),n=e.i(592121),r=e.i(747961);let l=(0,n.forwardRef)(({title:e,titleId:n,desc:r,descId:l,...i},a)=>(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",ref:a,"aria-labelledby":n,"aria-describedby":l,...i,children:[r?(0,t.jsx)("desc",{id:l,children:r}):null,void 0===e?(0,t.jsx)("title",{id:n,children:"Current Location"}):e?(0,t.jsx)("title",{id:n,children:e}):null,(0,t.jsx)("path",{fill:"currentColor",d:"M2 6.491a.5.5 0 0 0 .315.473l4.8 1.92 1.92 4.801A.5.5 0 0 0 9.5 14h.008a.5.5 0 0 0 .462-.329l4-11a.5.5 0 0 0-.64-.64l-11 4A.5.5 0 0 0 2 6.49"})]})),i=n.default.forwardRef((e,n)=>(0,t.jsx)(r.BaseIcon,{ref:n,icon:l,...e}));i.displayName="CurrentLocationFilled",e.s(["CurrentLocationFilled",0,i])},75430,77323,e=>{"use strict";var t=e.i(546446),n=e.i(579310),r=e.i(528600),l=e.i(935807),i=e.i(335355),a=e.i(592121),o=e.i(919101),s=e.i(310847);function u(){let e=(0,t.useAtomValue)(n.userLocationsGetAtom),u=(0,t.useAtomValue)(i.userLocaleAtom),c=u?.slice(3)||"US",{user:d}=(0,r.useUser)(),f=d.isUserLoggedIn,h=(0,t.useAtomValue)(s.wxuUserRecentAddressesAtom);return(0,a.useMemo)(()=>({getLocationName:(t,n)=>(0,l.getLocationName)((0,o.getAddressForLocationData)(t,h),e,f,c,n),getLocationContext:(t,n)=>(0,l.getLocationContext)((0,o.getAddressForLocationData)(t,h),e,f,c,n),getLocationPresentationName:t=>(0,l.getLocationPresentationName)((0,o.getAddressForLocationData)(t,h),e,f,c)}),[e,f,c,h])}e.s(["usePresentationName",0,u],77323),e.s(["useBuildSearchItem",0,()=>{let{getLocationName:e,getLocationContext:n,getLocationPresentationName:r}=u(),l=(0,t.useAtomValue)(s.wxuUserRecentAddressesAtom);return{buildSearchItem:(0,a.useCallback)(t=>{let i=(0,o.getAddressForLocationData)(t,l);return{placeId:i.placeId,featureId:i.featureId,temperature:0,iconCode:44,geocode:`${i.latitude},${i.longitude}`,presentationName:r(i),name:e(i),nameContext:n(i),displayName:i.displayName,address:i.address,type:i.type}},[n,e,r,l])}}],75430)},879499,189816,929776,e=>{"use strict";let t;var n,r,l,i,a,o,s,u,c,d,f,h,p,g,m,v,b,y,x,w=e.i(592121),C=e.i(798973);function S(){for(var e=arguments.length,t=Array(e),n=0;ne=>{t.forEach(t=>t(e))},t)}let D="u">typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function I(e){let t=Object.prototype.toString.call(e);return"[object Window]"===t||"[object global]"===t}function E(e){return"nodeType"in e}function R(e){var t,n;return e?I(e)?e:E(e)&&null!=(t=null==(n=e.ownerDocument)?void 0:n.defaultView)?t:window:window}function L(e){let{Document:t}=R(e);return e instanceof t}function j(e){return!I(e)&&e instanceof R(e).HTMLElement}function N(e){return e instanceof R(e).SVGElement}function M(e){return e?I(e)?e.document:E(e)?L(e)?e:j(e)||N(e)?e.ownerDocument:document:document:document}let k=D?w.useLayoutEffect:w.useEffect;function T(e){let t=(0,w.useRef)(e);return k(()=>{t.current=e}),(0,w.useCallback)(function(){for(var e=arguments.length,n=Array(e),r=0;r{e.current=setInterval(t,n)},[]),(0,w.useCallback)(()=>{null!==e.current&&(clearInterval(e.current),e.current=null)},[])]}function B(e,t){void 0===t&&(t=[e]);let n=(0,w.useRef)(e);return k(()=>{n.current!==e&&(n.current=e)},t),n}function O(e,t){let n=(0,w.useRef)();return(0,w.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function F(e){let t=T(e),n=(0,w.useRef)(null),r=(0,w.useCallback)(e=>{e!==n.current&&(null==t||t(e,n.current)),n.current=e},[]);return[n,r]}function P(e){let t=(0,w.useRef)();return(0,w.useEffect)(()=>{t.current=e},[e]),t.current}let U={};function z(e,t){return(0,w.useMemo)(()=>{if(t)return t;let n=null==U[e]?0:U[e]+1;return U[e]=n,e+"-"+n},[e,t])}function K(e){return function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),l=1;l{for(let[r,l]of Object.entries(n)){let n=t[r];null!=n&&(t[r]=n+e*l)}return t},{...t})}}let W=K(1),_=K(-1);function H(e){if(!e)return!1;let{KeyboardEvent:t}=R(e.target);return t&&e instanceof t}function X(e){if(function(e){if(!e)return!1;let{TouchEvent:t}=R(e.target);return t&&e instanceof t}(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return"clientX"in e&&"clientY"in e?{x:e.clientX,y:e.clientY}:null}let Y=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Y.Translate.toString(e),Y.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),V="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function G(e){return e.matches(V)?e:e.querySelector(V)}e.s(["CSS",0,Y,"add",0,W,"canUseDOM",0,D,"findFirstFocusableNode",0,G,"getEventCoordinates",0,X,"getOwnerDocument",0,M,"getWindow",0,R,"isDocument",0,L,"isHTMLElement",0,j,"isKeyboardEvent",0,H,"isNode",0,E,"isSVGElement",0,N,"isWindow",0,I,"subtract",0,_,"useCombinedRefs",0,S,"useEvent",0,T,"useInterval",0,A,"useIsomorphicLayoutEffect",0,k,"useLatestValue",0,B,"useLazyMemo",0,O,"useNodeRef",0,F,"usePrevious",0,P,"useUniqueId",0,z],189816);let q={display:"none"};function J(e){let{id:t,value:n}=e;return w.default.createElement("div",{id:t,style:q},n)}function $(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;return w.default.createElement("div",{id:t,style:{position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":r,"aria-atomic":!0},n)}let Q=(0,w.createContext)(null),Z={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},ee={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function et(e){var t;let n,{announcements:r=ee,container:l,hiddenTextDescribedById:i,screenReaderInstructions:a=Z}=e,{announce:o,announcement:s}=function(){let[e,t]=(0,w.useState)("");return{announce:(0,w.useCallback)(e=>{null!=e&&t(e)},[]),announcement:e}}(),u=z("DndLiveRegion"),[c,d]=(0,w.useState)(!1);if((0,w.useEffect)(()=>{d(!0)},[]),t=(0,w.useMemo)(()=>({onDragStart(e){let{active:t}=e;o(r.onDragStart({active:t}))},onDragMove(e){let{active:t,over:n}=e;r.onDragMove&&o(r.onDragMove({active:t,over:n}))},onDragOver(e){let{active:t,over:n}=e;o(r.onDragOver({active:t,over:n}))},onDragEnd(e){let{active:t,over:n}=e;o(r.onDragEnd({active:t,over:n}))},onDragCancel(e){let{active:t,over:n}=e;o(r.onDragCancel({active:t,over:n}))}}),[o,r]),n=(0,w.useContext)(Q),(0,w.useEffect)(()=>{if(!n)throw Error("useDndMonitor must be used within a children of ");return n(t)},[t,n]),!c)return null;let f=w.default.createElement(w.default.Fragment,null,w.default.createElement(J,{id:i,value:a.draggable}),w.default.createElement($,{id:u,announcement:s}));return l?(0,C.createPortal)(f,l):f}function en(){}(n=d||(d={})).DragStart="dragStart",n.DragMove="dragMove",n.DragEnd="dragEnd",n.DragCancel="dragCancel",n.DragOver="dragOver",n.RegisterDroppable="registerDroppable",n.SetDroppableDisabled="setDroppableDisabled",n.UnregisterDroppable="unregisterDroppable";let er=Object.freeze({x:0,y:0});function el(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function ei(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function ea(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function eo(e){let{left:t,top:n,height:r,width:l}=e;return[{x:t,y:n},{x:t+l,y:n},{x:t,y:n+r},{x:t+l,y:n+r}]}function es(e,t){if(!e||0===e.length)return null;let[n]=e;return t?n[t]:n}function eu(e,t,n){return void 0===t&&(t=e.left),void 0===n&&(n=e.top),{x:t+.5*e.width,y:n+.5*e.height}}let ec=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,l=eo(t),i=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=eo(r),a=Number((l.reduce((e,t,r)=>e+el(n[r],t),0)/4).toFixed(4));i.push({id:t,data:{droppableContainer:e,value:a}})}}return i.sort(ei)},ed=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,l=[];for(let e of r){let{id:r}=e,i=n.get(r);if(i){let n=function(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),l=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height);if(r0&&l.push({id:r,data:{droppableContainer:e,value:n}})}}return l.sort(ea)};function ef(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:er}let eh=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r({...e,top:e.top+ +t.y,bottom:e.bottom+ +t.y,left:e.left+ +t.x,right:e.right+ +t.x}),{...e})},ep={ignoreTransform:!1};function eg(e,t){void 0===t&&(t=ep);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=R(e).getComputedStyle(e);t&&(n=function(e,t,n){let r=function(e){if(e.startsWith("matrix3d(")){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith("matrix(")){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}(t);if(!r)return e;let{scaleX:l,scaleY:i,x:a,y:o}=r,s=e.left-a-(1-l)*parseFloat(n),u=e.top-o-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),c=l?e.width/l:e.width,d=i?e.height/i:e.height;return{width:c,height:d,top:u,right:s+c,bottom:u+d,left:s}}(n,t,r))}let{top:r,left:l,width:i,height:a,bottom:o,right:s}=n;return{top:r,left:l,width:i,height:a,bottom:o,right:s}}function em(e){return eg(e,{ignoreTransform:!0})}function ev(e,t){let n=[];return e?function r(l){var i,a;let o;if(null!=t&&n.length>=t||!l)return n;if(L(l)&&null!=l.scrollingElement&&!n.includes(l.scrollingElement))return n.push(l.scrollingElement),n;if(!j(l)||N(l)||n.includes(l))return n;let s=R(e).getComputedStyle(l);return(l!==e&&(void 0===(i=s)&&(i=R(l).getComputedStyle(l)),o=/(auto|scroll|overlay)/,["overflow","overflowX","overflowY"].some(e=>{let t=i[e];return"string"==typeof t&&o.test(t)}))&&n.push(l),void 0===(a=s)&&(a=R(l).getComputedStyle(l)),"fixed"===a.position)?n:r(l.parentNode)}(e):n}function eb(e){let[t]=ev(e,1);return null!=t?t:null}function ey(e){return D&&e?I(e)?e:E(e)?L(e)||e===M(e).scrollingElement?window:j(e)?e:null:null:null}function ex(e){return I(e)?e.scrollX:e.scrollLeft}function ew(e){return I(e)?e.scrollY:e.scrollTop}function eC(e){return{x:ex(e),y:ew(e)}}function eS(e){return!!D&&!!e&&e===document.scrollingElement}function eD(e){let t={x:0,y:0},n=eS(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},l=e.scrollTop=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}(r=f||(f={}))[r.Forward=1]="Forward",r[r.Backward=-1]="Backward";let eI={x:.2,y:.2};function eE(e){return e.reduce((e,t)=>W(e,eC(t)),er)}let eR=[["x",["left","right"],function(e){return e.reduce((e,t)=>e+ex(t),0)}],["y",["top","bottom"],function(e){return e.reduce((e,t)=>e+ew(t),0)}]];class eL{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=ev(t),r=eE(n);for(const[t,l,i]of(this.rect={...e},this.width=e.width,this.height=e.height,eR))for(const e of l)Object.defineProperty(this,e,{get:()=>{let l=i(n),a=r[t]-l;return this.rect[e]+a},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class ej{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)})},this.target=e}add(e,t,n){var r;null==(r=this.target)||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}}function eN(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return"number"==typeof t?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t&&r>t.y}function eM(e){e.preventDefault()}function ek(e){e.stopPropagation()}(l=h||(h={})).Click="click",l.DragStart="dragstart",l.Keydown="keydown",l.ContextMenu="contextmenu",l.Resize="resize",l.SelectionChange="selectionchange",l.VisibilityChange="visibilitychange",(i=p||(p={})).Space="Space",i.Down="ArrowDown",i.Right="ArrowRight",i.Left="ArrowLeft",i.Up="ArrowUp",i.Esc="Escape",i.Enter="Enter",i.Tab="Tab";let eT={start:[p.Space,p.Enter],cancel:[p.Esc],end:[p.Space,p.Enter,p.Tab]},eA=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case p.Right:return{...n,x:n.x+25};case p.Left:return{...n,x:n.x-25};case p.Down:return{...n,y:n.y+25};case p.Up:return{...n,y:n.y-25}}};class eB{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,this.listeners=new ej(M(t)),this.windowListeners=new ej(R(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(h.Resize,this.handleCancel),this.windowListeners.add(h.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(h.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&function(e,t){if(void 0===t&&(t=eg),!e)return;let{top:n,left:r,bottom:l,right:i}=t(e);eb(e)&&(l=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}(n),t(er)}handleKeyDown(e){if(H(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:l=eT,coordinateGetter:i=eA,scrollBehavior:a="smooth"}=r,{code:o}=e;if(l.end.includes(o))return void this.handleEnd(e);if(l.cancel.includes(o))return void this.handleCancel(e);let{collisionRect:s}=n.current,u=s?{x:s.left,y:s.top}:er;this.referenceCoordinates||(this.referenceCoordinates=u);let c=i(e,{active:t,context:n.current,currentCoordinates:u});if(c){let t=_(c,u),r={x:0,y:0},{scrollableAncestors:l}=n.current;for(let n of l){let l=e.code,{isTop:i,isRight:o,isLeft:s,isBottom:u,maxScroll:d,minScroll:f}=eD(n),h=function(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:l}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:l,width:e.clientWidth,height:e.clientHeight}}(n),g={x:Math.min(l===p.Right?h.right-h.width/2:h.right,Math.max(l===p.Right?h.left:h.left+h.width/2,c.x)),y:Math.min(l===p.Down?h.bottom-h.height/2:h.bottom,Math.max(l===p.Down?h.top:h.top+h.height/2,c.y))},m=l===p.Right&&!o||l===p.Left&&!s,v=l===p.Down&&!u||l===p.Up&&!i;if(m&&g.x!==c.x){let e=n.scrollLeft+t.x,i=l===p.Right&&e=f.x;if(i&&!t.y)return void n.scrollTo({left:e,behavior:a});i?r.x=n.scrollLeft-e:r.x=l===p.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:a});break}if(v&&g.y!==c.y){let e=n.scrollTop+t.y,i=l===p.Down&&e=f.y;if(i&&!t.x)return void n.scrollTo({top:e,behavior:a});i?r.y=n.scrollTop-e:r.y=l===p.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:a});break}}this.handleMove(e,W(_(c,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function eO(e){return!!(e&&"distance"in e)}function eF(e){return!!(e&&"delay"in e)}eB.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=eT,onActivation:l}=t,{active:i}=n,{code:a}=e.nativeEvent;if(r.start.includes(a)){let t=i.activatorNode.current;return(!t||e.target===t)&&(e.preventDefault(),null==l||l({event:e.nativeEvent}),!0)}return!1}}];class eP{constructor(e,t,n){var r;void 0===n&&(n=function(e){let{EventTarget:t}=R(e);return e instanceof t?e:M(e)}(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;const{event:l}=e,{target:i}=l;this.props=e,this.events=t,this.document=M(i),this.documentListeners=new ej(this.document),this.listeners=new ej(n),this.windowListeners=new ej(R(i)),this.initialCoordinates=null!=(r=X(l))?r:er,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(h.Resize,this.handleCancel),this.windowListeners.add(h.DragStart,eM),this.windowListeners.add(h.VisibilityChange,this.handleCancel),this.windowListeners.add(h.ContextMenu,eM),this.documentListeners.add(h.Keydown,this.handleKeydown),t){if(null!=n&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(eF(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(eO(t))return void this.handlePending(t)}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(h.Click,ek,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(h.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;let{activated:n,initialCoordinates:r,props:l}=this,{onMove:i,options:{activationConstraint:a}}=l;if(!r)return;let o=null!=(t=X(e))?t:er,s=_(r,o);if(!n&&a){if(eO(a)){if(null!=a.tolerance&&eN(s,a.tolerance))return this.handleCancel();if(eN(s,a.distance))return this.handleStart()}return eF(a)&&eN(s,a.tolerance)?this.handleCancel():void this.handlePending(a,s)}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===p.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}let eU={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class ez extends eP{constructor(e){const{event:t}=e;super(e,eU,M(t.target))}}ez.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!!n.isPrimary&&0===n.button&&(null==r||r({event:n}),!0)}}];(a=g||(g={}))[a.RightClick=2]="RightClick";(o=m||(m={}))[o.Pointer=0]="Pointer",o[o.DraggableRect=1]="DraggableRect",(s=v||(v={}))[s.TreeOrder=0]="TreeOrder",s[s.ReversedTreeOrder=1]="ReversedTreeOrder";let eK={x:{[f.Backward]:!1,[f.Forward]:!1},y:{[f.Backward]:!1,[f.Forward]:!1}};(u=b||(b={}))[u.Always=0]="Always",u[u.BeforeDragging=1]="BeforeDragging",u[u.WhileDragging=2]="WhileDragging",(y||(y={})).Optimized="optimized";let eW=new Map;function e_(e,t){return O(n=>e?n||("function"==typeof t?t(e):e):null,[t,e])}function eH(e){let{callback:t,disabled:n}=e,r=T(t),l=(0,w.useMemo)(()=>{if(n||"u"()=>null==l?void 0:l.disconnect(),[l]),l}function eX(e){return new eL(eg(e),e)}function eY(e,t,n){void 0===t&&(t=eX);let[r,l]=(0,w.useState)(null);function i(){l(r=>{if(!e)return null;if(!1===e.isConnected){var l;return null!=(l=null!=r?r:n)?l:null}let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let a=function(e){let{callback:t,disabled:n}=e,r=T(t),l=(0,w.useMemo)(()=>{if(n||"u"()=>null==l?void 0:l.disconnect(),[l]),l}({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if("childList"===t&&r instanceof HTMLElement&&r.contains(e)){i();break}}}}),o=eH({callback:i});return k(()=>{i(),e?(null==o||o.observe(e),null==a||a.observe(document.body,{childList:!0,subtree:!0})):(null==o||o.disconnect(),null==a||a.disconnect())},[e]),r}let eV=[];function eG(e,t){void 0===t&&(t=[]);let n=(0,w.useRef)(null);return(0,w.useEffect)(()=>{n.current=null},t),(0,w.useEffect)(()=>{let t=e!==er;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?_(e,n.current):er}function eq(e){return(0,w.useMemo)(()=>{let t,n;return e?(t=e.innerWidth,{top:0,left:0,right:t,bottom:n=e.innerHeight,width:t,height:n}):null},[e])}let eJ=[],e$=[{sensor:ez,options:{}},{sensor:eB,options:{}}],eQ={current:{}},eZ={draggable:{measure:em},droppable:{measure:em,strategy:b.WhileDragging,frequency:y.Optimized},dragOverlay:{measure:eg}};class e0 extends Map{get(e){var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){var t,n;return null!=(t=null==(n=this.get(e))?void 0:n.node.current)?t:void 0}}let e1={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new e0,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:en},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:eZ,measureDroppableContainers:en,windowRect:null,measuringScheduled:!1},e5={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:en,draggableNodes:new Map,over:null,measureDroppableContainers:en},e2=(0,w.createContext)(e5),e4=(0,w.createContext)(e1);function e3(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new e0}}}function e7(e,t){switch(t.type){case d.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case d.DragMove:if(null==e.draggable.active)return e;return{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case d.DragEnd:case d.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case d.RegisterDroppable:{let{element:n}=t,{id:r}=n,l=new e0(e.droppable.containers);return l.set(r,n),{...e,droppable:{...e.droppable,containers:l}}}case d.SetDroppableDisabled:{let{id:n,key:r,disabled:l}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new e0(e.droppable.containers);return a.set(n,{...i,disabled:l}),{...e,droppable:{...e.droppable,containers:a}}}case d.UnregisterDroppable:{let{id:n,key:r}=t,l=e.droppable.containers.get(n);if(!l||r!==l.key)return e;let i=new e0(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function e6(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:l}=(0,w.useContext)(e2),i=P(r),a=P(null==n?void 0:n.id);return(0,w.useEffect)(()=>{if(!t&&!r&&i&&null!=a){if(!H(i)||document.activeElement===i.target)return;let e=l.get(a);if(!e)return;let{activatorNode:t,node:n}=e;(t.current||n.current)&&requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=G(e);if(t){t.focus();break}}})}},[r,t,l,a,i]),null}let e9=(0,w.createContext)({...er,scaleX:1,scaleY:1});(c=x||(x={}))[c.Uninitialized=0]="Uninitialized",c[c.Initializing=1]="Initializing",c[c.Initialized=2]="Initialized";let e8=(0,w.memo)(function(e){var t,n,r,l,i,a,o,s;let u,c,h,p,g,y,S,I,{id:E,accessibility:L,autoScroll:N=!0,children:M,sensors:T=e$,collisionDetection:U=ed,measuring:K,modifiers:_,...H}=e,[Y,V]=(0,w.useReducer)(e7,void 0,e3),[G,q]=function(){let[e]=(0,w.useState)(()=>new Set),t=(0,w.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,w.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>{var t;return null==(t=e[n])?void 0:t.call(e,r)})},[e]),t]}(),[J,$]=(0,w.useState)(x.Uninitialized),Z=J===x.Initialized,{draggable:{active:ee,nodes:en,translate:el},droppable:{containers:ei}}=Y,ea=null!=ee?en.get(ee):null,eo=(0,w.useRef)({initial:null,translated:null}),eu=(0,w.useMemo)(()=>{var e;return null!=ee?{id:ee,data:null!=(e=null==ea?void 0:ea.data)?e:eQ,rect:eo}:null},[ee,ea]),ec=(0,w.useRef)(null),[ep,em]=(0,w.useState)(null),[ex,ew]=(0,w.useState)(null),eR=B(H,Object.values(H)),ej=z("DndDescribedBy",E),eN=(0,w.useMemo)(()=>ei.getEnabled(),[ei]),eM=(0,w.useMemo)(()=>({draggable:{...eZ.draggable,...null==K?void 0:K.draggable},droppable:{...eZ.droppable,...null==K?void 0:K.droppable},dragOverlay:{...eZ.dragOverlay,...null==K?void 0:K.dragOverlay}}),[null==K?void 0:K.draggable,null==K?void 0:K.droppable,null==K?void 0:K.dragOverlay]),{droppableRects:ek,measureDroppableContainers:eT,measuringScheduled:eA}=function(e,t){let{dragging:n,dependencies:r,config:l}=t,[i,a]=(0,w.useState)(null),{frequency:o,measure:s,strategy:u}=l,c=(0,w.useRef)(e),d=function(){switch(u){case b.Always:return!1;case b.BeforeDragging:return n;default:return!n}}(),f=B(d),h=(0,w.useCallback)(function(e){void 0===e&&(e=[]),f.current||a(t=>null===t?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),p=(0,w.useRef)(null),g=O(t=>{if(d&&!n)return eW;if(!t||t===eW||c.current!==e||null!=i){let t=new Map;for(let n of e){if(!n)continue;if(i&&i.length>0&&!i.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new eL(s(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,i,n,d,s]);return(0,w.useEffect)(()=>{c.current=e},[e]),(0,w.useEffect)(()=>{d||h()},[n,d]),(0,w.useEffect)(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),(0,w.useEffect)(()=>{d||"number"!=typeof o||null!==p.current||(p.current=setTimeout(()=>{h(),p.current=null},o))},[o,d,h,...r]),{droppableRects:g,measureDroppableContainers:h,measuringScheduled:null!=i}}(eN,{dragging:Z,dependencies:[el.x,el.y],config:eM.droppable}),eB=O(e=>{var t;return null==ee?null:null!=(t=null!=g?g:e)?t:null},[g=(p=null!=ee?en.get(ee):void 0)?p.node.current:null,ee]),eO=(0,w.useMemo)(()=>ex?X(ex):null,[ex]),eF=(u=(null==ep?void 0:ep.autoScrollEnabled)===!1,c="object"==typeof N?!1===N.enabled:!1===N,h=Z&&!u&&!c,"object"==typeof N?{...N,enabled:h}:{enabled:h}),eP=e_(eB,eM.draggable.measure);!function(e){let{activeNode:t,measure:n,initialRect:r,config:l=!0}=e,i=(0,w.useRef)(!1),{x:a,y:o}="boolean"==typeof l?{x:l,y:l}:l;k(()=>{if(!a&&!o||!t){i.current=!1;return}if(i.current||!r)return;let e=null==t?void 0:t.node.current;if(!e||!1===e.isConnected)return;let l=ef(n(e),r);if(a||(l.x=0),o||(l.y=0),i.current=!0,Math.abs(l.x)>0||Math.abs(l.y)>0){let t=eb(e);t&&t.scrollBy({top:l.y,left:l.x})}},[t,a,o,r,n])}({activeNode:null!=ee?en.get(ee):null,config:eF.layoutShiftCompensation,initialRect:eP,measure:eM.draggable.measure});let eU=eY(eB,eM.draggable.measure,eP),ez=eY(eB?eB.parentElement:null),eX=(0,w.useRef)({activatorEvent:null,active:null,activeNode:eB,collisionRect:null,collisions:null,droppableRects:ek,draggableNodes:en,draggingNode:null,draggingNodeRect:null,droppableContainers:ei,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),e0=ei.getNodeFor(null==(t=eX.current.over)?void 0:t.id),e1=function(e){let{measure:t}=e,[n,r]=(0,w.useState)(null),l=eH({callback:(0,w.useCallback)(e=>{for(let{target:n}of e)if(j(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[i,a]=F((0,w.useCallback)(e=>{let n=function(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return j(t)?t:e}(e);null==l||l.disconnect(),n&&(null==l||l.observe(n)),r(n?t(n):null)},[t,l]));return(0,w.useMemo)(()=>({nodeRef:i,rect:n,setRef:a}),[n,i,a])}({measure:eM.dragOverlay.measure}),e5=null!=(n=e1.nodeRef.current)?n:eB,e8=Z?null!=(r=e1.rect)?r:eU:null,te=!!(e1.nodeRef.current&&e1.rect),tt=(y=e_(i=te?null:eU),ef(i,y)),tn=eq(e5?R(e5):null),tr=(a=Z?null!=e0?e0:eB:null,S=(0,w.useRef)(a),I=O(e=>a?e&&e!==eV&&a&&S.current&&a.parentNode===S.current.parentNode?e:ev(a):eV,[a]),(0,w.useEffect)(()=>{S.current=a},[a]),I),tl=function(e,t){void 0===t&&(t=eg);let[n]=e,r=eq(n?R(n):null),[l,i]=(0,w.useState)(eJ);function a(){i(()=>e.length?e.map(e=>eS(e)?r:new eL(t(e),e)):eJ)}let o=eH({callback:a});return k(()=>{null==o||o.disconnect(),a(),e.forEach(e=>null==o?void 0:o.observe(e))},[e]),l}(tr),ti=function(e,t){let{transform:n,...r}=t;return null!=e&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}(_,{transform:{x:el.x-tt.x,y:el.y-tt.y,scaleX:1,scaleY:1},activatorEvent:ex,active:eu,activeNodeRect:eU,containerNodeRect:ez,draggingNodeRect:e8,over:eX.current.over,overlayNodeRect:e1.rect,scrollableAncestors:tr,scrollableAncestorRects:tl,windowRect:tn}),ta=eO?W(eO,el):null,to=function(e){let[t,n]=(0,w.useState)(null),r=(0,w.useRef)(e),l=(0,w.useCallback)(e=>{let t=ey(e.target);t&&n(e=>e?(e.set(t,eC(t)),new Map(e)):null)},[]);return(0,w.useEffect)(()=>{let t=r.current;if(e!==t){i(t);let a=e.map(e=>{let t=ey(e);return t?(t.addEventListener("scroll",l,{passive:!0}),[t,eC(t)]):null}).filter(e=>null!=e);n(a.length?new Map(a):null),r.current=e}return()=>{i(e),i(t)};function i(e){e.forEach(e=>{let t=ey(e);null==t||t.removeEventListener("scroll",l)})}},[l,e]),(0,w.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>W(e,t),er):eE(e):er,[e,t])}(tr),ts=eG(to),tu=eG(to,[eU]),tc=W(ti,ts),td=e8?eh(e8,ti):null,tf=eu&&td?U({active:eu,collisionRect:td,droppableRects:ek,droppableContainers:eN,pointerCoordinates:ta}):null,th=es(tf,"id"),[tp,tg]=(0,w.useState)(null),tm=(o=te?ti:W(ti,tu),s=null!=(l=null==tp?void 0:tp.rect)?l:null,{...o,scaleX:s&&eU?s.width/eU.width:1,scaleY:s&&eU?s.height/eU.height:1}),tv=(0,w.useRef)(null),tb=(0,w.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(null==ec.current)return;let l=en.get(ec.current);if(!l)return;let i=e.nativeEvent,a=new n({active:ec.current,activeNode:l,event:i,options:r,context:eX,onAbort(e){if(!en.get(e))return;let{onDragAbort:t}=eR.current,n={id:e};null==t||t(n),G({type:"onDragAbort",event:n})},onPending(e,t,n,r){if(!en.get(e))return;let{onDragPending:l}=eR.current,i={id:e,constraint:t,initialCoordinates:n,offset:r};null==l||l(i),G({type:"onDragPending",event:i})},onStart(e){let t=ec.current;if(null==t)return;let n=en.get(t);if(!n)return;let{onDragStart:r}=eR.current,l={activatorEvent:i,active:{id:t,data:n.data,rect:eo}};(0,C.unstable_batchedUpdates)(()=>{null==r||r(l),$(x.Initializing),V({type:d.DragStart,initialCoordinates:e,active:t}),G({type:"onDragStart",event:l}),em(tv.current),ew(i)})},onMove(e){V({type:d.DragMove,coordinates:e})},onEnd:o(d.DragEnd),onCancel:o(d.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:l}=eX.current,a=null;if(t&&l){let{cancelDrop:o}=eR.current;a={activatorEvent:i,active:t,collisions:n,delta:l,over:r},e===d.DragEnd&&"function"==typeof o&&await Promise.resolve(o(a))&&(e=d.DragCancel)}ec.current=null,(0,C.unstable_batchedUpdates)(()=>{V({type:e}),$(x.Uninitialized),tg(null),em(null),ew(null),tv.current=null;let t=e===d.DragEnd?"onDragEnd":"onDragCancel";if(a){let e=eR.current[t];null==e||e(a),G({type:t,event:a})}})}}tv.current=a},[en]),ty=(0,w.useCallback)((e,t)=>(n,r)=>{let l=n.nativeEvent,i=en.get(r);null!==ec.current||!i||l.dndKit||l.defaultPrevented||!0===e(n,t.options,{active:i})&&(l.dndKit={capturedBy:t.sensor},ec.current=r,tb(n,t))},[en,tb]),tx=(0,w.useMemo)(()=>T.reduce((e,t)=>{let{sensor:n}=t;return[...e,...n.activators.map(e=>({eventName:e.eventName,handler:ty(e.handler,t)}))]},[]),[T,ty]);(0,w.useEffect)(()=>{if(!D)return;let e=T.map(e=>{let{sensor:t}=e;return null==t.setup?void 0:t.setup()});return()=>{for(let t of e)null==t||t()}},T.map(e=>{let{sensor:t}=e;return t})),k(()=>{eU&&J===x.Initializing&&$(x.Initialized)},[eU,J]),(0,w.useEffect)(()=>{let{onDragMove:e}=eR.current,{active:t,activatorEvent:n,collisions:r,over:l}=eX.current;if(!t||!n)return;let i={active:t,activatorEvent:n,collisions:r,delta:{x:tc.x,y:tc.y},over:l};(0,C.unstable_batchedUpdates)(()=>{null==e||e(i),G({type:"onDragMove",event:i})})},[tc.x,tc.y]),(0,w.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:l}=eX.current;if(!e||null==ec.current||!t||!l)return;let{onDragOver:i}=eR.current,a=r.get(th),o=a&&a.rect.current?{id:a.id,rect:a.rect.current,data:a.data,disabled:a.disabled}:null,s={active:e,activatorEvent:t,collisions:n,delta:{x:l.x,y:l.y},over:o};(0,C.unstable_batchedUpdates)(()=>{tg(o),null==i||i(s),G({type:"onDragOver",event:s})})},[th]),k(()=>{eX.current={activatorEvent:ex,active:eu,activeNode:eB,collisionRect:td,collisions:tf,droppableRects:ek,draggableNodes:en,draggingNode:e5,draggingNodeRect:e8,droppableContainers:ei,over:tp,scrollableAncestors:tr,scrollAdjustedTranslate:tc},eo.current={initial:e8,translated:td}},[eu,eB,tf,td,en,e5,e8,ek,ei,tp,tr,tc]),function(e){let{acceleration:t,activator:n=m.Pointer,canScroll:r,draggingRect:l,enabled:i,interval:a=5,order:o=v.TreeOrder,pointerCoordinates:s,scrollableAncestors:u,scrollableAncestorRects:c,delta:d,threshold:h}=e,p=function(e){let{delta:t,disabled:n}=e,r=P(t);return O(e=>{if(n||!r||!e)return eK;let l={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[f.Backward]:e.x[f.Backward]||-1===l.x,[f.Forward]:e.x[f.Forward]||1===l.x},y:{[f.Backward]:e.y[f.Backward]||-1===l.y,[f.Forward]:e.y[f.Forward]||1===l.y}}},[n,t,r])}({delta:d,disabled:!i}),[g,b]=A(),y=(0,w.useRef)({x:0,y:0}),x=(0,w.useRef)({x:0,y:0}),C=(0,w.useMemo)(()=>{switch(n){case m.Pointer:return s?{top:s.y,bottom:s.y,left:s.x,right:s.x}:null;case m.DraggableRect:return l}},[n,l,s]),S=(0,w.useRef)(null),D=(0,w.useCallback)(()=>{let e=S.current;if(!e)return;let t=y.current.x*x.current.x,n=y.current.y*x.current.y;e.scrollBy(t,n)},[]),I=(0,w.useMemo)(()=>o===v.TreeOrder?[...u].reverse():u,[o,u]);(0,w.useEffect)(()=>{if(!i||!u.length||!C)return void b();for(let e of I){if((null==r?void 0:r(e))===!1)continue;let n=c[u.indexOf(e)];if(!n)continue;let{direction:l,speed:i}=function(e,t,n,r,l){let{top:i,left:a,right:o,bottom:s}=n;void 0===r&&(r=10),void 0===l&&(l=eI);let{isTop:u,isBottom:c,isLeft:d,isRight:h}=eD(e),p={x:0,y:0},g={x:0,y:0},m={height:t.height*l.y,width:t.width*l.x};return!u&&i=t.bottom-m.height&&(p.y=f.Forward,g.y=r*Math.abs((t.bottom-m.height-s)/m.height)),!h&&o>=t.right-m.width?(p.x=f.Forward,g.x=r*Math.abs((t.right-m.width-o)/m.width)):!d&&a0||i.y>0){b(),S.current=e,g(D,a),y.current=i,x.current=l;return}}y.current={x:0,y:0},x.current={x:0,y:0},b()},[t,D,r,b,i,a,JSON.stringify(C),JSON.stringify(p),g,u,I,c,JSON.stringify(h)])}({...eF,delta:el,draggingRect:td,pointerCoordinates:ta,scrollableAncestors:tr,scrollableAncestorRects:tl});let tw=(0,w.useMemo)(()=>({active:eu,activeNode:eB,activeNodeRect:eU,activatorEvent:ex,collisions:tf,containerNodeRect:ez,dragOverlay:e1,draggableNodes:en,droppableContainers:ei,droppableRects:ek,over:tp,measureDroppableContainers:eT,scrollableAncestors:tr,scrollableAncestorRects:tl,measuringConfiguration:eM,measuringScheduled:eA,windowRect:tn}),[eu,eB,eU,ex,tf,ez,e1,en,ei,ek,tp,eT,tr,tl,eM,eA,tn]),tC=(0,w.useMemo)(()=>({activatorEvent:ex,activators:tx,active:eu,activeNodeRect:eU,ariaDescribedById:{draggable:ej},dispatch:V,draggableNodes:en,over:tp,measureDroppableContainers:eT}),[ex,tx,eu,eU,V,ej,en,tp,eT]);return w.default.createElement(Q.Provider,{value:q},w.default.createElement(e2.Provider,{value:tC},w.default.createElement(e4.Provider,{value:tw},w.default.createElement(e9.Provider,{value:tm},M)),w.default.createElement(e6,{disabled:(null==L?void 0:L.restoreFocus)===!1})),w.default.createElement(et,{...L,hiddenTextDescribedById:ej}))}),te=(0,w.createContext)(null),tt="button";function tn(e){let{id:t,data:n,disabled:r=!1,attributes:l}=e,i=z("Draggable"),{activators:a,activatorEvent:o,active:s,activeNodeRect:u,ariaDescribedById:c,draggableNodes:d,over:f}=(0,w.useContext)(e2),{role:h=tt,roleDescription:p="draggable",tabIndex:g=0}=null!=l?l:{},m=(null==s?void 0:s.id)===t,v=(0,w.useContext)(m?e9:te),[b,y]=F(),[x,C]=F(),S=(0,w.useMemo)(()=>a.reduce((e,n)=>{let{eventName:r,handler:l}=n;return e[r]=e=>{l(e,t)},e},{}),[a,t]),D=B(n);return k(()=>(d.set(t,{id:t,key:i,node:b,activatorNode:x,data:D}),()=>{let e=d.get(t);e&&e.key===i&&d.delete(t)}),[d,t]),{active:s,activatorEvent:o,activeNodeRect:u,attributes:(0,w.useMemo)(()=>({role:h,tabIndex:g,"aria-disabled":r,"aria-pressed":!!m&&h===tt||void 0,"aria-roledescription":p,"aria-describedby":c.draggable}),[r,h,g,m,p,c.draggable]),isDragging:m,listeners:r?void 0:S,node:b,over:f,setNodeRef:y,setActivatorNodeRef:C,transform:v}}function tr(){return(0,w.useContext)(e4)}let tl={timeout:25};function ti(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:l}=e,i=z("Droppable"),{active:a,dispatch:o,over:s,measureDroppableContainers:u}=(0,w.useContext)(e2),c=(0,w.useRef)({disabled:n}),f=(0,w.useRef)(!1),h=(0,w.useRef)(null),p=(0,w.useRef)(null),{disabled:g,updateMeasurementsFor:m,timeout:v}={...tl,...l},b=B(null!=m?m:r),y=eH({callback:(0,w.useCallback)(()=>{if(!f.current){f.current=!0;return}null!=p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{u(Array.isArray(b.current)?b.current:[b.current]),p.current=null},v)},[v]),disabled:g||!a}),[x,C]=F((0,w.useCallback)((e,t)=>{y&&(t&&(y.unobserve(t),f.current=!1),e&&y.observe(e))},[y])),S=B(t);return(0,w.useEffect)(()=>{y&&x.current&&(y.disconnect(),f.current=!1,y.observe(x.current))},[x,y]),(0,w.useEffect)(()=>(o({type:d.RegisterDroppable,element:{id:r,key:i,disabled:n,node:x,rect:h,data:S}}),()=>o({type:d.UnregisterDroppable,key:i,id:r})),[r]),(0,w.useEffect)(()=>{n!==c.current.disabled&&(o({type:d.SetDroppableDisabled,id:r,key:i,disabled:n}),c.current.disabled=n)},[r,i,n,o]),{active:a,rect:h,isOver:(null==s?void 0:s.id)===r,node:x,over:s,setNodeRef:C}}let ta={position:"fixed",touchAction:"none"},to=e=>H(e)?"transform 250ms ease":void 0;function ts(e,t,n){let r=e.slice();return r.splice(n=0}t={styles:{active:{opacity:"0"}}},e.s(["DndContext",0,e8,"KeyboardCode",0,p,"KeyboardSensor",0,eB,"PointerSensor",0,ez,"closestCenter",0,e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,l=eu(t,t.left,t.top),i=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=el(eu(r),l);i.push({id:t,data:{droppableContainer:e,value:n}})}}return i.sort(ei)},"closestCorners",0,ec,"getClientRect",0,eg,"getFirstCollision",0,es,"getScrollableAncestors",0,ev,"useDndContext",0,tr,"useDraggable",0,tn,"useDroppable",0,ti,"useSensor",0,function(e,t){return(0,w.useMemo)(()=>({sensor:e,options:null!=t?t:{}}),[e,t])},"useSensors",0,function(){for(var e=arguments.length,t=Array(e),n=0;n[...t].filter(e=>null!=e),[...t])}],879499);let tc=e=>{let{rects:t,activeIndex:n,overIndex:r,index:l}=e,i=ts(t,r,n),a=t[l],o=i[l];return o&&a?{x:o.left-a.left,y:o.top-a.top,scaleX:o.width/a.width,scaleY:o.height/a.height}:null},td={scaleX:1,scaleY:1},tf="Sortable",th=w.default.createContext({activeIndex:-1,containerId:tf,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:tc,disabled:{draggable:!1,droppable:!1}}),tp=e=>{let{id:t,items:n,activeIndex:r,overIndex:l}=e;return ts(n,r,l).indexOf(t)},tg=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:l,items:i,newIndex:a,previousItems:o,previousContainerId:s,transition:u}=e;return!!u&&!!r&&(o===i||l!==a)&&(!!n||a!==l&&t===s)},tm={duration:200,easing:"ease"},tv="transform",tb=Y.Transition.toString({property:tv,duration:0,easing:"linear"}),ty={roleDescription:"sortable"};function tx(e){if(!e)return!1;let t=e.data.current;return!!t&&"sortable"in t&&"object"==typeof t.sortable&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable}let tw=[p.Down,p.Right,p.Up,p.Left];function tC(e,t){return!!tx(e)&&!!tx(t)&&e.data.current.sortable.containerId===t.data.current.sortable.containerId}e.s(["SortableContext",0,function(e){let{children:t,id:n,items:r,strategy:l=tc,disabled:i=!1}=e,{active:a,dragOverlay:o,droppableRects:s,over:u,measureDroppableContainers:c}=tr(),d=z(tf,n),f=null!==o.rect,h=(0,w.useMemo)(()=>r.map(e=>"object"==typeof e&&"id"in e?e.id:e),[r]),p=null!=a,g=a?h.indexOf(a.id):-1,m=u?h.indexOf(u.id):-1,v=(0,w.useRef)(h),b=!function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n{b&&p&&c(h)},[b,h,p,c]),(0,w.useEffect)(()=>{v.current=h},[h]);let C=(0,w.useMemo)(()=>({activeIndex:g,containerId:d,disabled:x,disableTransforms:y,items:h,overIndex:m,useDragOverlay:f,sortedRects:h.reduce((e,t,n)=>{let r=s.get(t);return r&&(e[n]=r),e},Array(h.length)),strategy:l}),[g,d,x.draggable,x.droppable,y,h,m,s,f,l]);return w.default.createElement(th.Provider,{value:C},t)},"arrayMove",0,ts,"sortableKeyboardCoordinates",0,(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:l,droppableContainers:i,over:a,scrollableAncestors:o}}=t;if(tw.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];i.getEnabled().forEach(n=>{if(!n||null!=n&&n.disabled)return;let i=l.get(n.id);if(i)switch(e.code){case p.Down:r.topi.top&&t.push(n);break;case p.Left:r.left>i.left&&t.push(n);break;case p.Right:r.left1&&(d=c[1].id),null!=d){let e=i.get(n.id),t=i.get(d),a=t?l.get(t.id):null,c=null==t?void 0:t.node.current;if(c&&a&&e&&t){var s,u;let n=ev(c).some((e,t)=>o[t]!==e),l=tC(e,t),i=(s=e,u=t,!!tx(s)&&!!tx(u)&&!!tC(s,u)&&s.data.current.sortable.index({sortable:{containerId:g,index:E,items:p},...s}),[g,s,E,p]),L=(0,w.useMemo)(()=>p.slice(p.indexOf(c)),[p,c]),{rect:j,node:N,isOver:M,setNodeRef:T}=ti({id:c,data:R,disabled:I.droppable,resizeObserverConfig:{updateMeasurementsFor:L,...f}}),{active:A,activatorEvent:B,activeNodeRect:O,attributes:F,setNodeRef:P,listeners:U,isDragging:z,over:K,setActivatorNodeRef:W,transform:_}=tn({id:c,data:R,attributes:{...ty,...a},disabled:I.draggable}),X=S(T,P),V=!!A,G=V&&!b&&tu(m)&&tu(x),q=!C&&z,J=q&&G?_:null,$=G?null!=J?J:(null!=d?d:D)({rects:y,activeNodeRect:O,activeIndex:m,overIndex:x,index:E}):null,Q=tu(m)&&tu(x)?u({id:c,items:p,activeIndex:m,overIndex:x}):E,Z=null==A?void 0:A.id,ee=(0,w.useRef)({activeId:Z,items:p,newIndex:Q,containerId:g}),et=p!==ee.current.items,en=i({active:A,containerId:g,isDragging:z,isSorting:V,id:c,index:E,items:p,newIndex:ee.current.newIndex,previousItems:ee.current.items,previousContainerId:ee.current.containerId,transition:h,wasDragging:null!=ee.current.activeId}),er=function(e){let{disabled:t,index:n,node:r,rect:l}=e,[i,a]=(0,w.useState)(null),o=(0,w.useRef)(n);return k(()=>{if(!t&&n!==o.current&&r.current){let e=l.current;if(e){let t=eg(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&a(n)}}n!==o.current&&(o.current=n)},[t,n,r,l]),(0,w.useEffect)(()=>{i&&a(null)},[i]),i}({disabled:!en,index:E,node:N,rect:j});return(0,w.useEffect)(()=>{V&&ee.current.newIndex!==Q&&(ee.current.newIndex=Q),g!==ee.current.containerId&&(ee.current.containerId=g),p!==ee.current.items&&(ee.current.items=p)},[V,Q,g,p]),(0,w.useEffect)(()=>{if(Z===ee.current.activeId)return;if(null!=Z&&null==ee.current.activeId){ee.current.activeId=Z;return}let e=setTimeout(()=>{ee.current.activeId=Z},50);return()=>clearTimeout(e)},[Z]),{active:A,activeIndex:m,attributes:F,data:R,rect:j,index:E,newIndex:Q,items:p,isOver:M,isSorting:V,isDragging:z,listeners:U,node:N,overIndex:x,over:K,setNodeRef:X,setActivatorNodeRef:W,setDroppableNodeRef:T,setDraggableNodeRef:P,transform:null!=er?er:$,transition:er||et&&ee.current.newIndex===E?tb:(!q||H(B))&&h&&(V||en)?Y.Transition.toString({...h,property:tv}):void 0}},"verticalListSortingStrategy",0,e=>{var t,n,r,l;let i,a,o,{activeIndex:s,activeNodeRect:u,index:c,rects:d,overIndex:f}=e,h=null!=(t=d[s])?t:u;if(!h)return null;if(c===s){let e=d[f];return e?{x:0,y:ss&&c=f?{x:0,y:h.height+p,...td}:{x:0,y:0,...td}}],929776)},143884,441667,544361,803586,e=>{"use strict";var t=e.i(699173),n=e.i(592121),r=e.i(929776),l=e.i(189816),i=e.i(925209),a=e.i(226602),o=e.i(683903),s=e.i(368847),u=e.i(632137),c=e.i(75430),d=e.i(747961);let f=(0,n.forwardRef)(({title:e,titleId:n,desc:r,descId:l,...i},a)=>(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",ref:a,"aria-labelledby":n,"aria-describedby":l,...i,children:[r?(0,t.jsx)("desc",{id:l,children:r}):null,void 0===e?(0,t.jsx)("title",{id:n,children:"Star"}):e?(0,t.jsx)("title",{id:n,children:e}):null,(0,t.jsx)("path",{fill:"currentColor",d:"m8 3.26 1.38 2.79.23.5.5.075 3.08.445L11 9.22l-.374.365.09.5.525 3.065-2.755-1.445L8 11.5l-.465.245L4.78 13.17l.5-3.065.09-.5L5 9.22 2.79 7.045 5.87 6.6l.5-.075.23-.5zM8 1 5.727 5.61.64 6.345l3.68 3.59L3.45 15 8 12.61 12.55 15l-.87-5.065 3.68-3.585-5.085-.74z"})]})),h=n.default.forwardRef((e,n)=>(0,t.jsx)(d.BaseIcon,{ref:n,icon:f,...e}));h.displayName="Star";let p=(0,n.forwardRef)(({title:e,titleId:n,desc:r,descId:l,...i},a)=>(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",ref:a,"aria-labelledby":n,"aria-describedby":l,...i,children:[r?(0,t.jsx)("desc",{id:l,children:r}):null,void 0===e?(0,t.jsx)("title",{id:n,children:"Star"}):e?(0,t.jsx)("title",{id:n,children:e}):null,(0,t.jsx)("path",{fill:"currentColor",d:"M8 1 5.727 5.61.64 6.345l3.68 3.59L3.45 15 8 12.61 12.55 15l-.87-5.065 3.68-3.585-5.085-.74z"})]})),g=n.default.forwardRef((e,n)=>(0,t.jsx)(d.BaseIcon,{ref:n,icon:p,...e}));function m({isFavorite:e,onClick:n}){let r=(0,o.useTranslations)("Header");return(0,t.jsxs)("div",{className:"group/favorite flex shrink-0 items-center",children:[(0,t.jsx)("span",{className:(0,u.cn)("w-0 overflow-hidden pl-2 text-xs text-nowrap capitalize opacity-0 transition-all group-hover/favorite:opacity-100",{"group-hover/favorite:w-22":!e,"group-hover/favorite:w-26.5":e}),children:r(e?"removeLocation":"saveLocation")}),(0,t.jsx)("button",{onClick:n,className:"flex cursor-pointer items-center justify-center p-1",children:e?(0,t.jsx)(g,{className:"size-6 text-[#fdc107]",title:r("removeLocation")}):(0,t.jsx)(h,{className:"size-6 text-inherit hover:text-[#fdc107]",title:"Favorite"})})]})}g.displayName="StarFilled";var v=e.i(316078),b=e.i(180193),y=e.i(546446),x=e.i(381477),w=e.i(889951),C=e.i(726249),S=e.i(674885),D=e.i(617874),I=e.i(942400);let E=e=>{let t=(0,y.useAtomValue)(S.userUnitPreferenceAtom),n=(0,D.unitsSystemByName)(t)?.code,r=(0,I.usePageLocale)(),l=e?(0,C.formatGeocode)(e):null,{data:i}=(0,x.default)(l?["currentObservations",l,n,r]:null,async([,e,t,n])=>(0,w.getCurrentObservations)({geocode:e,units:t,language:n}),{revalidateIfStale:!0,revalidateOnFocus:!0,dedupingInterval:3e5});return i};function R({search:e}){let n=E(e.geocode),r=n?.iconCode??e.iconCode,l=n?n.temperature:e.temperature;return(0,t.jsxs)("div",{className:"flex items-center gap-1","data-testid":"location-search-weather",children:[(0,t.jsx)("div",{className:"flex items-center justify-center text-gray-400",children:(0,t.jsx)(v.WxIcon,{iconCode:r,className:"lightBG h-5 w-5",iconTheme:"lightBG"})}),(0,t.jsx)("div",{className:"text-l min-w-9 text-inherit",children:(0,t.jsx)(b.Temperature,{value:l})})]})}e.s(["useLocationWeather",0,E],441667),e.s(["WeatherDisplay",0,R],544361);var L=e.i(586754),j=e.i(525936),N=e.i(671525),M=e.i(145651),k=e.i(249725),T=e.i(292980),A=e.i(310847);function B({placeId:e,locationData:r,featureId:l,onSelect:d,onToggleSave:f,onRemove:h,disabledFavorites:p,isFavorite:g,showWeather:v,attributes:b,isFocused:x,isSelected:w,isSortable:C,firstItemActionRef:S}){let D=(0,o.useTranslations)("Header"),E=(0,I.usePageLocale)(),{addRecentLocation:O}=(0,M.default)(),{recordFeatureId:F}=(0,k.useLocationFeatureIds)(),{recordDetails:P}=(0,T.useRecentLocationDetails)(),{navigate:U}=(0,N.default)(),z=r?.featureId??l,K=(0,L.useGetLocationById)(r?.nameContext?null:e,E),{isGeolocationLoading:W,resolvePath:_}=(0,j.default)(e,{defer:!0,featureId:z}),[H,X]=(0,n.useState)(!1),{buildSearchItem:Y}=(0,c.useBuildSearchItem)(),V=(0,n.useRef)(null),[,G]=(0,y.useAtom)(A.wxuUserRecentAddressesAtom),q=(0,n.useCallback)(e=>{"address"===e.type&&G(t=>{let n={address:e?.address?.split(",")[0]?.trim()||e.displayName,placeId:e?.placeId,type:e?.type},r=t?.filter(e=>e.placeId!==n.placeId)||[];return[n,...r].slice(0,5)})},[G]),J=(0,n.useMemo)(()=>r||(K?Y(K):null),[Y,K,r]);(0,n.useEffect)(()=>{let e=V.current;return x&&e?.focus(),()=>e?.blur()},[x]);let $=(0,n.useCallback)(async()=>{J&&(O(e),q(J),r&&(P(e,{name:r.name,nameContext:r.nameContext,geocode:r.geocode,featureId:r.featureId,type:r.type,presentationName:r.presentationName,displayName:r.displayName,address:r.address}),r.featureId&&F({placeId:e,geocode:r.geocode},r.featureId)),U(await _()),d?.())},[J,O,q,e,r,P,F,_,U,d]);(0,n.useEffect)(()=>{H&&!W&&J&&(X(!1),$())},[H,W,J,$]);let Q=(0,n.useCallback)(()=>{if(J){if(W)return void X(!0);$()}},[J,W,$]);return((0,n.useEffect)(()=>{if(S)return S.current=Q,()=>{S.current=null}},[S,Q]),J)?(0,t.jsxs)("div",{className:(0,u.cn)("group flex h-16 w-full flex-1 items-center rounded-2xl px-4 transition-colors","hover:bg-gray-100",(x||w)&&"bg-gray-100"),children:[(0,t.jsxs)("div",{role:"button",tabIndex:0,"aria-current":w?"true":void 0,...b,"data-testid":"location-search-result","data-selected":String(!!w),ref:V,className:(0,u.cn)("flex min-w-0 flex-1 shrink-1 cursor-pointer items-center gap-3 md:gap-4",x&&"outline-0",b?.className),onClick:Q,onKeyDown:e=>{b?.onKeyDown?.(e),("Enter"===e.key||" "===e.key)&&(" "!==e.key||!C)&&J&&(e.preventDefault(),Q())},children:[v?(0,t.jsx)(R,{search:J}):(0,t.jsx)(i.Location,{className:"size-4 shrink-0 text-current md:size-6","aria-hidden":"true",title:""}),(0,t.jsxs)("div",{className:"text-left",children:[(0,t.jsx)(s.default,{variant:"Body.M",className:(0,u.cn)("text-inherit",w&&"text-blue-500"),lineClamp:1,children:J.name}),(0,t.jsx)(s.default,{variant:"Body.S",color:"secondary",className:"pb-0",lineClamp:1,children:J.nameContext})]})]}),!p&&(0,t.jsx)(m,{isFavorite:g,onClick:()=>f?.(J)}),h&&(0,t.jsx)("button",{type:"button","aria-label":D("removeLocation"),"data-testid":"location-search-remove",onClick:t=>{t.stopPropagation(),h(e)},onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&e.stopPropagation()},className:"flex shrink-0 cursor-pointer items-center justify-center rounded-full p-1 text-gray-400 transition-colors hover:text-gray-700 focus-visible:ring-2 focus-visible:ring-gray-400 focus-visible:ring-offset-2 focus-visible:outline-none",children:(0,t.jsx)(a.Close,{className:"size-5","aria-hidden":"true",title:""})})]}):null}e.s(["LocationItem",0,B],803586),e.s(["SortableFavoriteItem",0,function({location:e,onSelect:i,onToggleSave:a,isFocused:o=!1,isSelected:s=!1,firstItemActionRef:u}){let d=(0,I.usePageLocale)(),{buildSearchItem:f}=(0,c.useBuildSearchItem)(),h=(0,L.useGetLocationById)(e.placeID||null,d),p=(0,n.useMemo)(()=>h?f(h):null,[f,h]),{attributes:g,listeners:m,setNodeRef:v,transform:b,transition:y,isDragging:x}=(0,r.useSortable)({id:e.placeID||""}),w={transform:l.CSS.Transform.toString(b),transition:y};return p?(0,t.jsx)("div",{ref:v,style:w,className:x?"relative z-10 bg-gray-50 opacity-50 shadow-lg":void 0,children:(0,t.jsx)(B,{placeId:e.placeID,locationData:p,disabledFavorites:!1,onSelect:i,onToggleSave:a,showWeather:!0,isFavorite:!0,attributes:{...g,...m},isFocused:o,isSelected:s,firstItemActionRef:u,isSortable:!0})}):null}],143884)},24959,686557,e=>{"use strict";var t=e.i(699173),n=e.i(592121),r=e.i(683903),l=e.i(985542),i=e.i(381477),a=e.i(612977),o=e.i(75430),s=e.i(498076),u=e.i(935331),c=e.i(879499),d=e.i(929776),f=e.i(776169),h=e.i(343277),p=e.i(143884),g=e.i(803586),m=e.i(64412),v=e.i(262453),b=e.i(214008),y=e.i(352711),x=e.i(616448),w=e.i(526456),C=e.i(747961);let S=(0,n.forwardRef)(({title:e,titleId:n,desc:r,descId:l,...i},a)=>(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 12 12",ref:a,"aria-labelledby":n,"aria-describedby":l,...i,children:[r?(0,t.jsx)("desc",{id:l,children:r}):null,e?(0,t.jsx)("title",{id:n,children:e}):null,(0,t.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M6 4.125a1.875 1.875 0 1 1 0 3.75 1.875 1.875 0 0 1 0-3.75m0 .75a1.125 1.125 0 1 0 0 2.25 1.125 1.125 0 0 0 0-2.25",clipRule:"evenodd"}),(0,t.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M6.375 1.893a4.125 4.125 0 0 1 3.732 3.732h1.143v.75h-1.143a4.124 4.124 0 0 1-3.732 3.732v1.143h-.75v-1.143a4.124 4.124 0 0 1-3.732-3.732H.75v-.75h1.143a4.125 4.125 0 0 1 3.732-3.732V.75h.75zM6 2.625a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75",clipRule:"evenodd"})]})),D=n.default.forwardRef((e,n)=>(0,t.jsx)(C.BaseIcon,{ref:n,icon:S,...e}));D.displayName="Crosshair";var I=e.i(368847),E=e.i(632137),R=e.i(671525),L=e.i(145651),j=e.i(525936),N=e.i(544361);function M({onSelect:e,onImprovePrecision:l}){let i=(0,r.useTranslations)("Header"),{location:a}=(0,m.useLocation)("geolocation"),{location:o}=(0,m.useLocation)(),s=(0,v.usePreciseGeocode)(),u=(0,y.useImprovePrecisionFlow)({unavailableTitle:i("locationUnavailable"),unavailableBody:i("locationUnavailableHelp")}),{navigate:c}=(0,R.default)(),{addRecentLocation:d}=(0,L.default)(),f=a?.placeId,{isGeolocationLoading:h,resolvePath:p}=(0,j.default)(f??"",{defer:!0}),[g,C]=(0,n.useState)(!1),S=!s,k=(0,b.isSameLocation)(a,o),T=(0,n.useMemo)(()=>a?.placeId?{placeId:a.placeId,geocode:a.geocode,name:a.city||a.displayName,nameContext:a.adminDistrict,displayName:a.displayName,temperature:0,iconCode:44,address:"",type:a.type??""}:null,[a]),A=(0,n.useCallback)(async()=>{f&&(d(f),c(await p()),e())},[f,d,p,c,e]);(0,n.useEffect)(()=>{g&&!h&&f&&(C(!1),A())},[g,h,f,A]);let B=(0,n.useCallback)(()=>{if(f){if(h)return void C(!0);A()}},[f,h,A]),O=(0,n.useCallback)(e=>{e.target===e.currentTarget&&("Enter"===e.key||" "===e.key)&&(e.preventDefault(),B())},[B]),F=(0,n.useCallback)(e=>{e.stopPropagation(),l?.(),u()},[l,u]);return a?.placeId&&T?(0,t.jsx)("div",{className:(0,E.cn)("flex w-full flex-col gap-2 rounded-2xl p-4 transition-colors",k?"bg-gray-100":"hover:bg-gray-100"),"data-testid":"detected-location-row","data-selected":String(k),children:(0,t.jsxs)("div",{className:"flex items-center gap-3 md:gap-4",children:[(0,t.jsxs)("div",{role:"button",tabIndex:0,onClick:B,onKeyDown:O,"aria-label":T.name,"aria-current":k?"true":void 0,"data-testid":"detected-location-navigate",className:"flex min-w-0 flex-1 cursor-pointer items-center gap-3 text-left focus-visible:outline-none md:gap-4",children:[(0,t.jsx)(N.WeatherDisplay,{search:T}),(0,t.jsxs)("div",{className:"grow-1",children:[(0,t.jsx)(I.default,{variant:"Body.M.Bold",className:(0,E.cn)("pb-0 text-inherit",k&&"text-blue-500"),lineClamp:1,children:T.name}),(0,t.jsx)(I.default,{variant:"Body.S",color:"secondary",lineClamp:1,className:"pb-0",children:T.nameContext}),S&&(0,t.jsxs)("button",{type:"button",onClick:F,"data-testid":"improve-precision-cta",className:"mt-2 flex cursor-pointer items-center gap-1.5 self-start rounded-md text-xs font-medium text-gray-700 transition-colors hover:text-gray-900 hover:underline focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:outline-none",children:[(0,t.jsx)(D,{className:"size-3 shrink-0","aria-hidden":"true",title:""}),i("improvePrecision")]})]})]}),S?(0,t.jsx)("button",{type:"button",onClick:F,"aria-label":i("improvePrecision"),className:"flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-full bg-transparent transition-all duration-150 ease-in-out hover:bg-gray-200 active:bg-gray-300 active:duration-100",children:(0,t.jsx)(x.CurrentLocation,{className:"size-4 shrink-0 text-gray-500","aria-hidden":"true",title:""})}):(0,t.jsx)("span",{"data-testid":"detected-location-precise-indicator",className:"flex size-8 shrink-0 items-center justify-center",children:(0,t.jsx)(w.CurrentLocationFilled,{className:"size-4 shrink-0 text-gray-900","aria-hidden":"true",title:""})})]})}):null}var k=e.i(942400),T=e.i(611540),A=e.i(919101),B=e.i(546446),O=e.i(310847),F=e.i(249725),P=e.i(292980),U=e.i(77323),z=e.i(439766);function K({title:e,onClearAll:n,testId:l}){let i=(0,r.useTranslations)("Header");return(0,t.jsxs)("div",{className:"flex h-10 items-center justify-between px-4","data-testid":l,children:[(0,t.jsx)(I.default,{elementType:"h2",variant:"Body.S.Bold",children:e}),n&&(0,t.jsx)("button",{onClick:n,className:"cursor-pointer text-sm font-medium",children:i("clearEntries")})]})}function W({searches:e,searching:l,onSelectSearch:i,showFavorites:a=!0,recentLocations:o=[],favoriteLocations:s,isUserLoggedIn:u,firstItemActionRef:v,onClearRecentLocations:y,onRemoveRecentSearchLocation:x,focusedIndex:w=-1}){let C=(0,r.useTranslations)("Header"),{updatePreferences:S}=(0,f.usePreferences)(),{navigate:D}=(0,R.default)(),{addFavoriteLocation:E,deleteLocation:j}=(0,L.default)(),{resolveFeatureId:N,recordFeatureId:_}=(0,F.useLocationFeatureIds)(),{resolveDetails:H,recordDetails:X}=(0,P.useRecentLocationDetails)(),Y=(0,B.useAtomValue)(z.activeLocationAtom),V=(0,B.useSetAtom)(z.activeLocationAtom),{location:G}=(0,m.useLocation)(),{location:q}=(0,m.useLocation)("geolocation"),J=q?.placeId,{getLocationName:$}=(0,U.usePresentationName)(),Q=(0,k.usePageLocale)(),Z=(0,T.interpolateUrl)(T.URLS.memberSignup,{locale:Q}),[ee,et]=(0,B.useAtom)(O.wxuUserRecentAddressesAtom),en=(0,n.useMemo)(()=>u&&s?.map(e=>({...e,geocode:e.coordinate,placeId:e.placeID})).sort((e,t)=>(e.position||0)-(t.position||0))||[],[u,s]),er=(0,n.useMemo)(()=>o.filter(e=>!en.some(t=>t.placeID===e)),[o,en]),el=(0,c.useSensors)((0,c.useSensor)(c.PointerSensor,{activationConstraint:{distance:8}}),(0,c.useSensor)(c.KeyboardSensor,{coordinateGetter:d.sortableKeyboardCoordinates})),ei=e=>{let{active:t,over:n}=e;if(n&&t.id!==n.id){let e=en.findIndex(e=>e.placeID===t.id),r=en.findIndex(e=>e.placeID===n.id);S({locations:(0,d.arrayMove)([...en],e,r)})}},ea=async e=>{if(!u)return void D(Z);if(en.some(t=>t.placeID===e.placeId))j(e.placeId),Y?.placeId===e.placeId&&V(null);else{let t=e.geocode,n=e.name;if(!t)try{let r=e.featureId?await (0,h.getLocationPointByFeatureId)(e.featureId,"en-US"):e.placeId?await (0,h.getLocationPointByPlaceId)(e.placeId,"en-US"):null;if(r?.location){let e=(0,A.getAddressForLocationData)(r.location,ee);t=`${e.latitude},${e.longitude}`,n=$(e)}}catch(e){console.error("Failed to fetch location data for favoriting:",e)}if(t)E({placeID:e.placeId,coordinate:t,name:n,..."address"===e.type&&e.address?{streetAddress:e.address}:{}}),e.featureId&&(_({placeId:e.placeId,geocode:t},e.featureId),X(e.placeId,{name:n,nameContext:e.nameContext,geocode:t,featureId:e.featureId,type:e.type,presentationName:e.presentationName,displayName:e.displayName,address:e.address})),"address"===e.type&&"address"===e.type&&et(t=>{let n={address:e?.address?.split(",")[0]?.trim()||e.displayName,placeId:e?.placeId,type:e?.type},r=t?.filter(e=>e.placeId!==n.placeId)||[];return[n,...r].slice(0,5)});else console.debug("Unable to get geocode for location:",e.name||e.placeId)}};return(0,t.jsx)("div",{"data-testid":"location-search-results-dropdown",className:"overflow-x-hidden",children:l?(0,t.jsx)(I.default,{className:"p-6 text-center",children:C("loadingResults")}):a?J||0!==en.length||0!==o.length?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(K,{title:C("favoritesTitle"),testId:"location-search-favorites-header"}),(0,t.jsx)(M,{onSelect:i}),en.length>0&&(0,t.jsx)(c.DndContext,{sensors:el,collisionDetection:c.closestCenter,onDragEnd:ei,children:(0,t.jsx)(d.SortableContext,{items:en.map(e=>e.placeID||""),children:(0,t.jsx)("div",{"data-testid":"location-search-favorites-list",children:en.map((e,n)=>(0,t.jsx)(p.SortableFavoriteItem,{location:e,onToggleSave:ea,onSelect:i,isFocused:n===w,isSelected:(0,b.isSameLocation)({placeId:e.placeID,featureId:N({placeId:e.placeID})},G),firstItemActionRef:0===n?v:void 0},e.placeID))})})}),er.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(K,{title:C("recentLocationsTitle"),onClearAll:y,testId:"location-search-recent-header"}),(0,t.jsx)("div",{"data-testid":"location-search-recent-list",children:er.map((e,n)=>{let r=en.length+n,l=H(e),a=l?{placeId:e,featureId:l.featureId,geocode:l.geocode,presentationName:l.presentationName,name:l.name,nameContext:l.nameContext,displayName:l.displayName??l.name,type:l.type,address:l.address??""}:void 0;return(0,t.jsx)(g.LocationItem,{placeId:e,locationData:a,featureId:N({placeId:e}),onSelect:i,onToggleSave:ea,onRemove:x,isFocused:r===w,isSelected:(0,b.isSameLocation)({placeId:e,featureId:a?.featureId,geocode:a?.geocode},G),firstItemActionRef:0===r?v:void 0},e)})})]})]}):(0,t.jsx)("div",{className:"p-6 text-center text-gray-500","data-testid":"location-search-empty-message",children:C("noRecentLocations")}):0===e.length?(0,t.jsx)(I.default,{children:C("noResults")}):(0,t.jsx)("div",{"data-testid":"location-search-results-list",children:e.map((e,n)=>{let r=en.some(t=>t.placeID===e.placeId);return(0,t.jsx)(g.LocationItem,{placeId:e.placeId,locationData:e,onSelect:i,onToggleSave:ea,isFavorite:r,isFocused:n===w,firstItemActionRef:0===n?v:void 0},e.placeId)})})})}var _=e.i(274432),H=e.i(877957),X=e.i(523084),Y=e.i(768864),V=e.i(528600),G=e.i(909232),q=e.i(870393);let J=(0,n.memo)(({recentLocationsLength:e})=>{let n=(0,r.useTranslations)("Header"),{navigate:l}=(0,R.default)(),i=(0,k.usePageLocale)(),a=((0,G.useClientMobileMedia)(),(0,T.interpolateUrl)(T.URLS.memberSignup,{locale:i})),{user:{isUserLoggedIn:o}}=(0,V.useUser)();return o||e{l(a)},children:[(0,t.jsxs)("div",{className:"items-center justify-between",children:[(0,t.jsx)(I.Text,{variant:"Body.M.Bold",children:n(`upsellTitle${e>=4?"2":"1"}`)}),(0,t.jsx)(I.Text,{variant:"Body.S",children:n(`upsellSubtitle${e>=4?"2":"1"}`)})]}),(0,t.jsx)(q.ChevronRight,{className:"size-5"})]})});function $({className:e,searchContainerRef:r,searchInputRef:l,searchQuery:i,placeholderText:a,searchOpen:o,isMobile:s,canSearch:c,showFavorites:d,searching:f,recentSearches:h,recentLocations:p,favoriteLocations:g,isUserLoggedIn:m=!1,setSearchQuery:v,onSearchOpen:b,onSelectSearch:y,onClearRecentLocations:x,onRemoveRecentSearchLocation:w}){let[C,S]=(0,n.useState)(-1),[D,I]=(0,n.useState)(!1),R=(0,n.useRef)(null),L=(0,n.useMemo)(()=>{if(!d)return h.length;let e=m&&g?.length||0,t=new Set(g?.map(e=>e.placeID));return e+(p?.filter(e=>!t.has(e)).length||0)},[d,h.length,m,g,p]);(0,n.useEffect)(()=>{S(-1)},[i,o,L]);let j=(0,n.useCallback)(e=>{o&&0!==L&&("ArrowDown"===e.key?(e.preventDefault(),S(e=>{if(-1===e)return 0;let t=e+1;return t>=L?L-1:t})):"ArrowUp"===e.key&&(e.preventDefault(),S(e=>{let t=e-1;return t{v(""),b(!1),S(-1)},[b,v]),M=(0,n.useCallback)(e=>{"Enter"===e.key&&o&&R.current?(e.preventDefault(),R.current()):"Escape"===e.key&&(e.stopPropagation(),N())},[o,N]);return((0,n.useEffect)(()=>{o&&!s&&l?.current?.focus()},[o,s,l]),(0,n.useEffect)(()=>{if(!o)return;let e=e=>{"ArrowDown"===e.key||"ArrowUp"===e.key?(I(!1),j(e)):"Tab"===e.key?I(!0):"Escape"===e.key&&N()};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[o,j,N]),o)?(0,t.jsxs)("div",{ref:r,className:(0,E.cn)("z-110 w-full bg-white text-gray-800",s&&"fixed top-0 right-0 bottom-0 left-0 h-full overflow-auto",!s&&"rounded-3xl shadow-[0_4px_16px_0_rgba(0,0,0,0.10),0_0_32px_0_rgba(0,0,0,0.10)]",e),"data-testid":"header-search",children:[(0,t.jsxs)("div",{className:(0,E.cn)("flex w-full items-center gap-2",s?"p-3 pt-4":"p-2"),children:[s&&(0,t.jsx)(H.Button,{variant:"ghostUI",className:"m-0 p-1",onClick:()=>b(!1),"aria-label":"Close search",children:(0,t.jsx)(X.ChevronLeft,{className:"size-6"})}),(0,t.jsxs)("div",{className:"relative grow",children:[(0,t.jsx)(u.Input,{ref:l,value:i,placeholder:a,"data-testid":"location-search-input",onChange:e=>v(e.target.value),onKeyDown:M,className:(0,E.cn)("relative box-border h-12 rounded-3xl border-2 border-transparent bg-white! ps-9.5 pe-10 shadow-[0_4px_16px_0_rgba(0,0,0,0.08),0_0_32px_0_rgba(0,0,0,0.12)] transition-all placeholder:text-gray-900 placeholder:transition-all hover:border-blue-500 focus:placeholder:text-gray-400 focus-visible:border-blue-500")}),(0,t.jsx)(_.Search,{className:"pointer-events-none absolute start-4 top-1/2 flex size-4 -translate-y-1/2 transform items-center text-gray-900"}),(0,t.jsx)("button",{className:(0,E.cn)("absolute end-3.5 top-1/2 flex -translate-y-1/2 transform items-center opacity-0 transition-all",{"cursor-pointer opacity-100":!!i}),onClick:()=>v(""),disabled:!i,"aria-label":"Clear search",children:(0,t.jsx)(Y.CloseFilled,{className:"size-5 text-gray-900"})})]})]}),(c||d)&&(0,t.jsxs)("div",{className:(0,E.cn)("px-2 pb-2",s?"overflow-auto":"max-h-130 overflow-y-auto"),children:[(0,t.jsx)(W,{searches:h,searching:f,showFavorites:d,recentLocations:p,onClearAll:()=>v(""),favoriteLocations:g||[],isUserLoggedIn:m,firstItemActionRef:R,onSelectSearch:y,onClearRecentLocations:x,onRemoveRecentSearchLocation:w,focusedIndex:D?-1:C}),d&&(0,t.jsx)(J,{recentLocationsLength:p?.length??0})]})]}):null}var Q=e.i(800462);e.s([],24959),e.s(["Search",0,function({locale:e,className:u,open:c,onOpenChange:d}){let[f,h]=(0,n.useState)(""),p=(0,a.useDebounce)(f,300),g=(0,s.useIsMobile)(),m=(0,n.useRef)(null),v=(0,n.useRef)(null),b=(0,r.useTranslations)("Header"),{recentLocations:y,favoriteLocations:x,clearRecentLocations:w,removeRecentLocation:C,removeRecentAddress:S}=(0,L.default)(),{user:D}=(0,V.useUser)(),{isUserLoggedIn:I}=D,E=(0,B.useSetAtom)(Q.fromSearchResultAtom),R=b("searchPlaceholderText"),j=p.length>=3,N=!p,{data:M,isLoading:k}=(0,i.default)(j?["locations",p,"city,locality,neighborhood,postal,airport,address",e]:null,([e,t,n,r])=>(0,l.getLocationsByQueryAndType)(t,n,r),{revalidateOnFocus:!1,dedupingInterval:2e3}),{buildSearchItem:T}=(0,o.useBuildSearchItem)(),A=(0,n.useMemo)(()=>M?M.map(e=>T(e)):[],[T,M]);(0,n.useEffect)(()=>(document.body.style.overflow=g&&c?"hidden":"",g&&c&&v.current?.focus(),()=>{document.body.style.overflow=""}),[g,c]),(0,n.useEffect)(()=>{c||h("")},[c]);let O=(0,n.useCallback)(e=>{C(e),S(e)},[C,S]),F=(0,n.useCallback)(()=>{d(!1),E(f)},[d,E,f]);return(0,t.jsx)($,{className:u,searchContainerRef:m,searchInputRef:v,searchQuery:f,placeholderText:R,searchOpen:c,isMobile:g,canSearch:j,showFavorites:N,searching:k,recentSearches:A,recentLocations:y,favoriteLocations:x,isUserLoggedIn:I,setSearchQuery:h,onSearchOpen:d,onSelectSearch:F,onClearRecentLocations:w,onRemoveRecentSearchLocation:O})}],686557)}]);