P&&(y=P)}if(d){var S,b;const E=g==="y"?"width":"height",k=["top","left"].includes(wi(o)),P=i.reference[m]-i.floating[E]+(k&&((S=s.offset)==null?void 0:S[m])||0)+(k?0:C.crossAxis),M=i.reference[m]+i.reference[E]+(k?0:((b=s.offset)==null?void 0:b[m])||0)-(k?C.crossAxis:0);xM&&(x=M)}return{[g]:y,[m]:x}}}},zB=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:i}=t,{apply:s=()=>{},...l}=yi(e,t),u=await td(t,l),d=wi(n),h=wc(n),m=xc(n)==="y",{width:g,height:y}=r.floating;let x,_;d==="top"||d==="bottom"?(x=d,_=h===(await(o.isRTL==null?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(_=d,x=h==="end"?"top":"bottom");const C=y-u[x],S=g-u[_],b=!t.middlewareData.shift;let E=C,k=S;if(m){const M=g-u.left-u.right;k=h||b?Cs(S,M):M}else{const M=y-u.top-u.bottom;E=h||b?Cs(C,M):M}if(b&&!h){const M=pr(u.left,0),A=pr(u.right,0),O=pr(u.top,0),F=pr(u.bottom,0);m?k=g-2*(M!==0||A!==0?M+A:pr(u.left,u.right)):E=y-2*(O!==0||F!==0?O+F:pr(u.top,u.bottom))}await s({...t,availableWidth:k,availableHeight:E});const P=await o.getDimensions(i.floating);return g!==P.width||y!==P.height?{reset:{rects:!0}}:{}}}};function ks(e){return OT(e)?(e.nodeName||"").toLowerCase():"#document"}function vr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ci(e){var t;return(t=(OT(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function OT(e){return e instanceof Node||e instanceof vr(e).Node}function xi(e){return e instanceof Element||e instanceof vr(e).Element}function Ho(e){return e instanceof HTMLElement||e instanceof vr(e).HTMLElement}function LC(e){return typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof vr(e).ShadowRoot}function Ad(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Xr(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function BB(e){return["table","td","th"].includes(ks(e))}function px(e){const t=hx(),n=Xr(e);return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function UB(e){let t=rc(e);for(;Ho(t)&&!Fm(t);){if(px(t))return t;t=rc(t)}return null}function hx(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Fm(e){return["html","body","#document"].includes(ks(e))}function Xr(e){return vr(e).getComputedStyle(e)}function jm(e){return xi(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function rc(e){if(ks(e)==="html")return e;const t=e.assignedSlot||e.parentNode||LC(e)&&e.host||Ci(e);return LC(t)?t.host:t}function MT(e){const t=rc(e);return Fm(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ho(t)&&Ad(t)?t:MT(t)}function nd(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=MT(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=vr(o);return i?t.concat(s,s.visualViewport||[],Ad(o)?o:[],s.frameElement&&n?nd(s.frameElement):[]):t.concat(o,nd(o,[],n))}function NT(e){const t=Xr(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Ho(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,l=Mh(n)!==i||Mh(r)!==s;return l&&(n=i,r=s),{width:n,height:r,$:l}}function mx(e){return xi(e)?e:e.contextElement}function Rl(e){const t=mx(e);if(!Ho(t))return $s(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=NT(t);let s=(i?Mh(n.width):n.width)/r,l=(i?Mh(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}const VB=$s(0);function DT(e){const t=vr(e);return!hx()||!t.visualViewport?VB:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function WB(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==vr(e)?!1:t}function Ra(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=mx(e);let s=$s(1);t&&(r?xi(r)&&(s=Rl(r)):s=Rl(e));const l=WB(i,n,r)?DT(i):$s(0);let u=(o.left+l.x)/s.x,d=(o.top+l.y)/s.y,h=o.width/s.x,m=o.height/s.y;if(i){const g=vr(i),y=r&&xi(r)?vr(r):r;let x=g.frameElement;for(;x&&r&&y!==g;){const _=Rl(x),C=x.getBoundingClientRect(),S=Xr(x),b=C.left+(x.clientLeft+parseFloat(S.paddingLeft))*_.x,E=C.top+(x.clientTop+parseFloat(S.paddingTop))*_.y;u*=_.x,d*=_.y,h*=_.x,m*=_.y,u+=b,d+=E,x=vr(x).frameElement}}return Dh({width:h,height:m,x:u,y:d})}function HB(e){let{rect:t,offsetParent:n,strategy:r}=e;const o=Ho(n),i=Ci(n);if(n===i)return t;let s={scrollLeft:0,scrollTop:0},l=$s(1);const u=$s(0);if((o||!o&&r!=="fixed")&&((ks(n)!=="body"||Ad(i))&&(s=jm(n)),Ho(n))){const d=Ra(n);l=Rl(n),u.x=d.x+n.clientLeft,u.y=d.y+n.clientTop}return{width:t.width*l.x,height:t.height*l.y,x:t.x*l.x-s.scrollLeft*l.x+u.x,y:t.y*l.y-s.scrollTop*l.y+u.y}}function KB(e){return Array.from(e.getClientRects())}function IT(e){return Ra(Ci(e)).left+jm(e).scrollLeft}function YB(e){const t=Ci(e),n=jm(e),r=e.ownerDocument.body,o=pr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=pr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+IT(e);const l=-n.scrollTop;return Xr(r).direction==="rtl"&&(s+=pr(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:l}}function GB(e,t){const n=vr(e),r=Ci(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,l=0,u=0;if(o){i=o.width,s=o.height;const d=hx();(!d||d&&t==="fixed")&&(l=o.offsetLeft,u=o.offsetTop)}return{width:i,height:s,x:l,y:u}}function XB(e,t){const n=Ra(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Ho(e)?Rl(e):$s(1),s=e.clientWidth*i.x,l=e.clientHeight*i.y,u=o*i.x,d=r*i.y;return{width:s,height:l,x:u,y:d}}function FC(e,t,n){let r;if(t==="viewport")r=GB(e,n);else if(t==="document")r=YB(Ci(e));else if(xi(t))r=XB(t,n);else{const o=DT(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return Dh(r)}function LT(e,t){const n=rc(e);return n===t||!xi(n)||Fm(n)?!1:Xr(n).position==="fixed"||LT(n,t)}function ZB(e,t){const n=t.get(e);if(n)return n;let r=nd(e,[],!1).filter(l=>xi(l)&&ks(l)!=="body"),o=null;const i=Xr(e).position==="fixed";let s=i?rc(e):e;for(;xi(s)&&!Fm(s);){const l=Xr(s),u=px(s);!u&&l.position==="fixed"&&(o=null),(i?!u&&!o:!u&&l.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||Ad(s)&&!u&<(e,s))?r=r.filter(h=>h!==s):o=l,s=rc(s)}return t.set(e,r),r}function qB(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?ZB(t,this._c):[].concat(n),r],l=s[0],u=s.reduce((d,h)=>{const m=FC(t,h,o);return d.top=pr(m.top,d.top),d.right=Cs(m.right,d.right),d.bottom=Cs(m.bottom,d.bottom),d.left=pr(m.left,d.left),d},FC(t,l,o));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function QB(e){return NT(e)}function JB(e,t,n){const r=Ho(t),o=Ci(t),i=n==="fixed",s=Ra(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const u=$s(0);if(r||!r&&!i)if((ks(t)!=="body"||Ad(o))&&(l=jm(t)),r){const d=Ra(t,!0,i,t);u.x=d.x+t.clientLeft,u.y=d.y+t.clientTop}else o&&(u.x=IT(o));return{x:s.left+l.scrollLeft-u.x,y:s.top+l.scrollTop-u.y,width:s.width,height:s.height}}function jC(e,t){return!Ho(e)||Xr(e).position==="fixed"?null:t?t(e):e.offsetParent}function FT(e,t){const n=vr(e);if(!Ho(e))return n;let r=jC(e,t);for(;r&&BB(r)&&Xr(r).position==="static";)r=jC(r,t);return r&&(ks(r)==="html"||ks(r)==="body"&&Xr(r).position==="static"&&!px(r))?n:r||UB(e)||n}const eU=async function(e){let{reference:t,floating:n,strategy:r}=e;const o=this.getOffsetParent||FT,i=this.getDimensions;return{reference:JB(t,await o(n),r),floating:{x:0,y:0,...await i(n)}}};function tU(e){return Xr(e).direction==="rtl"}const nU={convertOffsetParentRelativeRectToViewportRelativeRect:HB,getDocumentElement:Ci,getClippingRect:qB,getOffsetParent:FT,getElementRects:eU,getClientRects:KB,getDimensions:QB,getScale:Rl,isElement:xi,isRTL:tU};function rU(e,t){let n=null,r;const o=Ci(e);function i(){clearTimeout(r),n&&n.disconnect(),n=null}function s(l,u){l===void 0&&(l=!1),u===void 0&&(u=1),i();const{left:d,top:h,width:m,height:g}=e.getBoundingClientRect();if(l||t(),!m||!g)return;const y=ip(h),x=ip(o.clientWidth-(d+m)),_=ip(o.clientHeight-(h+g)),C=ip(d),b={rootMargin:-y+"px "+-x+"px "+-_+"px "+-C+"px",threshold:pr(0,Cs(1,u))||1};let E=!0;function k(P){const M=P[0].intersectionRatio;if(M!==u){if(!E)return s();M?s(!1,M):r=setTimeout(()=>{s(!1,1e-7)},100)}E=!1}try{n=new IntersectionObserver(k,{...b,root:o.ownerDocument})}catch{n=new IntersectionObserver(k,b)}n.observe(e)}return s(!0),i}function oU(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,d=mx(e),h=o||i?[...d?nd(d):[],...nd(t)]:[];h.forEach(S=>{o&&S.addEventListener("scroll",n,{passive:!0}),i&&S.addEventListener("resize",n)});const m=d&&l?rU(d,n):null;let g=-1,y=null;s&&(y=new ResizeObserver(S=>{let[b]=S;b&&b.target===d&&y&&(y.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{y&&y.observe(t)})),n()}),d&&!u&&y.observe(d),y.observe(t));let x,_=u?Ra(e):null;u&&C();function C(){const S=Ra(e);_&&(S.x!==_.x||S.y!==_.y||S.width!==_.width||S.height!==_.height)&&n(),_=S,x=requestAnimationFrame(C)}return n(),()=>{h.forEach(S=>{o&&S.removeEventListener("scroll",n),i&&S.removeEventListener("resize",n)}),m&&m(),y&&y.disconnect(),y=null,u&&cancelAnimationFrame(x)}}const iU=(e,t,n)=>{const r=new Map,o={platform:nU,...n},i={...o.platform,_c:r};return MB(e,t,{...o,platform:i})},sU=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?NC({element:r.current,padding:o}).fn(n):{}:r?NC({element:r,padding:o}).fn(n):{}}}};var Vp=typeof document<"u"?f.useLayoutEffect:f.useEffect;function Ih(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!Ih(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;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!Ih(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function jT(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function zC(e,t){const n=jT(e);return Math.round(t*n)/n}function BC(e){const t=f.useRef(e);return Vp(()=>{t.current=e}),t}function aU(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:l=!0,whileElementsMounted:u,open:d}=e,[h,m]=f.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,y]=f.useState(r);Ih(g,r)||y(r);const[x,_]=f.useState(null),[C,S]=f.useState(null),b=f.useCallback(L=>{L!=M.current&&(M.current=L,_(L))},[_]),E=f.useCallback(L=>{L!==A.current&&(A.current=L,S(L))},[S]),k=i||x,P=s||C,M=f.useRef(null),A=f.useRef(null),O=f.useRef(h),F=BC(u),V=BC(o),J=f.useCallback(()=>{if(!M.current||!A.current)return;const L={placement:t,strategy:n,middleware:g};V.current&&(L.platform=V.current),iU(M.current,A.current,L).then(ie=>{const K={...ie,isPositioned:!0};G.current&&!Ih(O.current,K)&&(O.current=K,Os.flushSync(()=>{m(K)}))})},[g,t,n,V]);Vp(()=>{d===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,m(L=>({...L,isPositioned:!1})))},[d]);const G=f.useRef(!1);Vp(()=>(G.current=!0,()=>{G.current=!1}),[]),Vp(()=>{if(k&&(M.current=k),P&&(A.current=P),k&&P){if(F.current)return F.current(k,P,J);J()}},[k,P,J,F]);const ae=f.useMemo(()=>({reference:M,floating:A,setReference:b,setFloating:E}),[b,E]),U=f.useMemo(()=>({reference:k,floating:P}),[k,P]),te=f.useMemo(()=>{const L={position:n,left:0,top:0};if(!U.floating)return L;const ie=zC(U.floating,h.x),K=zC(U.floating,h.y);return l?{...L,transform:"translate("+ie+"px, "+K+"px)",...jT(U.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:ie,top:K}},[n,l,U.floating,h.x,h.y]);return f.useMemo(()=>({...h,update:J,refs:ae,elements:U,floatingStyles:te}),[h,J,ae,U,te])}function gx(e){const[t,n]=f.useState(void 0);return Pn(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let s,l;if("borderBoxSize"in i){const u=i.borderBoxSize,d=Array.isArray(u)?u[0]:u;s=d.inlineSize,l=d.blockSize}else s=e.offsetWidth,l=e.offsetHeight;n({width:s,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}const zT="Popper",[BT,Ns]=An(zT),[lU,UT]=BT(zT),cU=e=>{const{__scopePopper:t,children:n}=e,[r,o]=f.useState(null);return f.createElement(lU,{scope:t,anchor:r,onAnchorChange:o},n)},uU="PopperAnchor",dU=f.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=UT(uU,n),s=f.useRef(null),l=Be(t,s);return f.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:f.createElement(Pe.div,Y({},o,{ref:l}))}),VT="PopperContent",[fU,hte]=BT(VT),pU=f.forwardRef((e,t)=>{var n,r,o,i,s,l,u,d;const{__scopePopper:h,side:m="bottom",sideOffset:g=0,align:y="center",alignOffset:x=0,arrowPadding:_=0,avoidCollisions:C=!0,collisionBoundary:S=[],collisionPadding:b=0,sticky:E="partial",hideWhenDetached:k=!1,updatePositionStrategy:P="optimized",onPlaced:M,...A}=e,O=UT(VT,h),[F,V]=f.useState(null),J=Be(t,Yt=>V(Yt)),[G,ae]=f.useState(null),U=gx(G),te=(n=U==null?void 0:U.width)!==null&&n!==void 0?n:0,L=(r=U==null?void 0:U.height)!==null&&r!==void 0?r:0,ie=m+(y!=="center"?"-"+y:""),K=typeof b=="number"?b:{top:0,right:0,bottom:0,left:0,...b},Q=Array.isArray(S)?S:[S],W=Q.length>0,le={padding:K,boundary:Q.filter(hU),altBoundary:W},{refs:ge,floatingStyles:Ve,placement:Ue,isPositioned:We,middlewareData:Me}=aU({strategy:"fixed",placement:ie,whileElementsMounted:(...Yt)=>oU(...Yt,{animationFrame:P==="always"}),elements:{reference:O.anchor},middleware:[LB({mainAxis:g+L,alignmentAxis:x}),C&&FB({mainAxis:!0,crossAxis:!1,limiter:E==="partial"?jB():void 0,...le}),C&&NB({...le}),zB({...le,apply:({elements:Yt,rects:Er,availableWidth:gt,availableHeight:js})=>{const{width:I,height:X}=Er.reference,Z=Yt.floating.style;Z.setProperty("--radix-popper-available-width",`${gt}px`),Z.setProperty("--radix-popper-available-height",`${js}px`),Z.setProperty("--radix-popper-anchor-width",`${I}px`),Z.setProperty("--radix-popper-anchor-height",`${X}px`)}}),G&&sU({element:G,padding:_}),mU({arrowWidth:te,arrowHeight:L}),k&&DB({strategy:"referenceHidden",...le})]}),[fe,xe]=WT(Ue),$e=Ft(M);Pn(()=>{We&&($e==null||$e())},[We,$e]);const Ae=(o=Me.arrow)===null||o===void 0?void 0:o.x,Oe=(i=Me.arrow)===null||i===void 0?void 0:i.y,je=((s=Me.arrow)===null||s===void 0?void 0:s.centerOffset)!==0,[Ot,ct]=f.useState();return Pn(()=>{F&&ct(window.getComputedStyle(F).zIndex)},[F]),f.createElement("div",{ref:ge.setFloating,"data-radix-popper-content-wrapper":"",style:{...Ve,transform:We?Ve.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Ot,"--radix-popper-transform-origin":[(l=Me.transformOrigin)===null||l===void 0?void 0:l.x,(u=Me.transformOrigin)===null||u===void 0?void 0:u.y].join(" ")},dir:e.dir},f.createElement(fU,{scope:h,placedSide:fe,onArrowChange:ae,arrowX:Ae,arrowY:Oe,shouldHideArrow:je},f.createElement(Pe.div,Y({"data-side":fe,"data-align":xe},A,{ref:J,style:{...A.style,animation:We?void 0:"none",opacity:(d=Me.hide)!==null&&d!==void 0&&d.referenceHidden?0:void 0}}))))});function hU(e){return e!==null}const mU=e=>({name:"transformOrigin",options:e,fn(t){var n,r,o,i,s;const{placement:l,rects:u,middlewareData:d}=t,m=((n=d.arrow)===null||n===void 0?void 0:n.centerOffset)!==0,g=m?0:e.arrowWidth,y=m?0:e.arrowHeight,[x,_]=WT(l),C={start:"0%",center:"50%",end:"100%"}[_],S=((r=(o=d.arrow)===null||o===void 0?void 0:o.x)!==null&&r!==void 0?r:0)+g/2,b=((i=(s=d.arrow)===null||s===void 0?void 0:s.y)!==null&&i!==void 0?i:0)+y/2;let E="",k="";return x==="bottom"?(E=m?C:`${S}px`,k=`${-y}px`):x==="top"?(E=m?C:`${S}px`,k=`${u.floating.height+y}px`):x==="right"?(E=`${-y}px`,k=m?C:`${b}px`):x==="left"&&(E=`${u.floating.width+y}px`,k=m?C:`${b}px`),{data:{x:E,y:k}}}});function WT(e){const[t,n="center"]=e.split("-");return[t,n]}const Od=cU,zm=dU,Bm=pU,Md=f.forwardRef((e,t)=>{var n;const{container:r=globalThis==null||(n=globalThis.document)===null||n===void 0?void 0:n.body,...o}=e;return r?XI.createPortal(f.createElement(Pe.div,Y({},o,{ref:t})),r):null});function gU(e,t){return f.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const xn=e=>{const{present:t,children:n}=e,r=vU(t),o=typeof n=="function"?n({present:r.isPresent}):f.Children.only(n),i=Be(r.ref,o.ref);return typeof n=="function"||r.isPresent?f.cloneElement(o,{ref:i}):null};xn.displayName="Presence";function vU(e){const[t,n]=f.useState(),r=f.useRef({}),o=f.useRef(e),i=f.useRef("none"),s=e?"mounted":"unmounted",[l,u]=gU(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return f.useEffect(()=>{const d=sp(r.current);i.current=l==="mounted"?d:"none"},[l]),Pn(()=>{const d=r.current,h=o.current;if(h!==e){const g=i.current,y=sp(d);e?u("MOUNT"):y==="none"||(d==null?void 0:d.display)==="none"?u("UNMOUNT"):u(h&&g!==y?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,u]),Pn(()=>{if(t){const d=m=>{const y=sp(r.current).includes(m.animationName);m.target===t&&y&&Os.flushSync(()=>u("ANIMATION_END"))},h=m=>{m.target===t&&(i.current=sp(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:f.useCallback(d=>{d&&(r.current=getComputedStyle(d)),n(d)},[])}}function sp(e){return(e==null?void 0:e.animationName)||"none"}function Zr({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=yU({defaultProp:t,onChange:n}),i=e!==void 0,s=i?e:r,l=Ft(n),u=f.useCallback(d=>{if(i){const m=typeof d=="function"?d(e):d;m!==e&&l(m)}else o(d)},[i,e,o,l]);return[s,u]}function yU({defaultProp:e,onChange:t}){const n=f.useState(e),[r]=n,o=f.useRef(r),i=Ft(t);return f.useEffect(()=>{o.current!==r&&(i(r),o.current=r)},[r,o,i]),n}const Um=f.forwardRef((e,t)=>f.createElement(Pe.span,Y({},e,{ref:t,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}}))),wU=Um,[Vm,mte]=An("Tooltip",[Ns]),vx=Ns(),xU="TooltipProvider",bU=700,l1="tooltip.open",[_U,yx]=Vm(xU),SU=e=>{const{__scopeTooltip:t,delayDuration:n=bU,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:i}=e,[s,l]=f.useState(!0),u=f.useRef(!1),d=f.useRef(0);return f.useEffect(()=>{const h=d.current;return()=>window.clearTimeout(h)},[]),f.createElement(_U,{scope:t,isOpenDelayed:s,delayDuration:n,onOpen:f.useCallback(()=>{window.clearTimeout(d.current),l(!1)},[]),onClose:f.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>l(!0),r)},[r]),isPointerInTransitRef:u,onPointerInTransitChange:f.useCallback(h=>{u.current=h},[]),disableHoverableContent:o},i)},wx="Tooltip",[EU,Wm]=Vm(wx),CU=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o=!1,onOpenChange:i,disableHoverableContent:s,delayDuration:l}=e,u=yx(wx,e.__scopeTooltip),d=vx(t),[h,m]=f.useState(null),g=nr(),y=f.useRef(0),x=s??u.disableHoverableContent,_=l??u.delayDuration,C=f.useRef(!1),[S=!1,b]=Zr({prop:r,defaultProp:o,onChange:A=>{A?(u.onOpen(),document.dispatchEvent(new CustomEvent(l1))):u.onClose(),i==null||i(A)}}),E=f.useMemo(()=>S?C.current?"delayed-open":"instant-open":"closed",[S]),k=f.useCallback(()=>{window.clearTimeout(y.current),C.current=!1,b(!0)},[b]),P=f.useCallback(()=>{window.clearTimeout(y.current),b(!1)},[b]),M=f.useCallback(()=>{window.clearTimeout(y.current),y.current=window.setTimeout(()=>{C.current=!0,b(!0)},_)},[_,b]);return f.useEffect(()=>()=>window.clearTimeout(y.current),[]),f.createElement(Od,d,f.createElement(EU,{scope:t,contentId:g,open:S,stateAttribute:E,trigger:h,onTriggerChange:m,onTriggerEnter:f.useCallback(()=>{u.isOpenDelayed?M():k()},[u.isOpenDelayed,M,k]),onTriggerLeave:f.useCallback(()=>{x?P():window.clearTimeout(y.current)},[P,x]),onOpen:k,onClose:P,disableHoverableContent:x},n))},UC="TooltipTrigger",$U=f.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Wm(UC,n),i=yx(UC,n),s=vx(n),l=f.useRef(null),u=Be(t,l,o.onTriggerChange),d=f.useRef(!1),h=f.useRef(!1),m=f.useCallback(()=>d.current=!1,[]);return f.useEffect(()=>()=>document.removeEventListener("pointerup",m),[m]),f.createElement(zm,Y({asChild:!0},s),f.createElement(Pe.button,Y({"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute},r,{ref:u,onPointerMove:ue(e.onPointerMove,g=>{g.pointerType!=="touch"&&!h.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),h.current=!0)}),onPointerLeave:ue(e.onPointerLeave,()=>{o.onTriggerLeave(),h.current=!1}),onPointerDown:ue(e.onPointerDown,()=>{d.current=!0,document.addEventListener("pointerup",m,{once:!0})}),onFocus:ue(e.onFocus,()=>{d.current||o.onOpen()}),onBlur:ue(e.onBlur,o.onClose),onClick:ue(e.onClick,o.onClose)})))}),kU="TooltipPortal",[gte,RU]=Vm(kU,{forceMount:void 0}),rd="TooltipContent",TU=f.forwardRef((e,t)=>{const n=RU(rd,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...i}=e,s=Wm(rd,e.__scopeTooltip);return f.createElement(xn,{present:r||s.open},s.disableHoverableContent?f.createElement(HT,Y({side:o},i,{ref:t})):f.createElement(PU,Y({side:o},i,{ref:t})))}),PU=f.forwardRef((e,t)=>{const n=Wm(rd,e.__scopeTooltip),r=yx(rd,e.__scopeTooltip),o=f.useRef(null),i=Be(t,o),[s,l]=f.useState(null),{trigger:u,onClose:d}=n,h=o.current,{onPointerInTransitChange:m}=r,g=f.useCallback(()=>{l(null),m(!1)},[m]),y=f.useCallback((x,_)=>{const C=x.currentTarget,S={x:x.clientX,y:x.clientY},b=OU(S,C.getBoundingClientRect()),E=MU(S,b),k=NU(_.getBoundingClientRect()),P=IU([...E,...k]);l(P),m(!0)},[m]);return f.useEffect(()=>()=>g(),[g]),f.useEffect(()=>{if(u&&h){const x=C=>y(C,h),_=C=>y(C,u);return u.addEventListener("pointerleave",x),h.addEventListener("pointerleave",_),()=>{u.removeEventListener("pointerleave",x),h.removeEventListener("pointerleave",_)}}},[u,h,y,g]),f.useEffect(()=>{if(s){const x=_=>{const C=_.target,S={x:_.clientX,y:_.clientY},b=(u==null?void 0:u.contains(C))||(h==null?void 0:h.contains(C)),E=!DU(S,s);b?g():E&&(g(),d())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[u,h,s,d,g]),f.createElement(HT,Y({},e,{ref:i}))}),[AU,vte]=Vm(wx,{isInside:!1}),HT=f.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:s,...l}=e,u=Wm(rd,n),d=vx(n),{onClose:h}=u;return f.useEffect(()=>(document.addEventListener(l1,h),()=>document.removeEventListener(l1,h)),[h]),f.useEffect(()=>{if(u.trigger){const m=g=>{const y=g.target;y!=null&&y.contains(u.trigger)&&h()};return window.addEventListener("scroll",m,{capture:!0}),()=>window.removeEventListener("scroll",m,{capture:!0})}},[u.trigger,h]),f.createElement(yc,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:m=>m.preventDefault(),onDismiss:h},f.createElement(Bm,Y({"data-state":u.stateAttribute},d,l,{ref:t,style:{...l.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)"}}),f.createElement(sx,null,r),f.createElement(AU,{scope:n,isInside:!0},f.createElement(wU,{id:u.contentId,role:"tooltip"},o||r))))});function OU(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")}}function MU(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});break}return r}function NU(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}]}function DU(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,s=t.length-1;ir!=h>r&&n<(d-l)*(r-u)/(h-u)+l&&(o=!o)}return o}function IU(e){const t=e.slice();return t.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),LU(t)}function LU(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r=2;){const i=t[t.length-1],s=t[t.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const i=n[n.length-1],s=n[n.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}const FU=SU,jU=CU,zU=$U,KT=TU,BU=FU,YT=jU,GT=zU,xx=f.forwardRef(({className:e,sideOffset:t=4,...n},r)=>v.jsx(KT,{ref:r,sideOffset:t,className:Ce("z-50 border overflow-hidden rounded-md bg-background text-foreground px-3 py-1.5 text-xs 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),...n}));xx.displayName=KT.displayName;const bx=Om("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-transparent shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),Rn=f.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...o},i)=>{const s=r?Wo:"button";return v.jsx(s,{className:Ce(bx({variant:t,size:n,className:e}),"outline-none cursor-default"),ref:i,tabIndex:-1,...o})});Rn.displayName="Button";const vn=f.forwardRef(({tooltip:e,children:t,...n},r)=>v.jsxs(YT,{children:[v.jsx(GT,{asChild:!0,children:v.jsx(Rn,{variant:"ghost",size:"icon",...n,ref:r,tabIndex:-1,className:"cursor-default bg-background",children:v.jsx("div",{className:"icon-button-icon-wrapper",children:t})})}),v.jsx(xx,{children:v.jsx("p",{children:e})})]})),c1=e=>{const{onFileUpload:t,children:n,...r}=e,[o]=f.useState(`file-upload-${Math.random().toString()}`),i=s=>{var u;const l=(u=s.currentTarget.files)==null?void 0:u[0];l&&t(l)};return v.jsxs(v.Fragment,{children:[v.jsx("label",{htmlFor:o,children:v.jsx(vn,{...r,asChild:!0,children:n})}),v.jsx(Pd,{style:{display:"none"},id:o,name:o,type:"file",onChange:i,accept:"image/png, image/jpeg"})]})};var UU={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const VU=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Kt=(e,t)=>{const n=f.forwardRef(({color:r="currentColor",size:o=24,strokeWidth:i=2,absoluteStrokeWidth:s,children:l,...u},d)=>f.createElement("svg",{ref:d,...UU,width:o,height:o,stroke:r,strokeWidth:s?Number(i)*24/Number(o):i,className:`lucide lucide-${VU(e)}`,...u},[...t.map(([h,m])=>f.createElement(h,m)),...(Array.isArray(l)?l:[l])||[]]));return n.displayName=`${e}`,n},WU=Kt("Blocks",[["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["path",{d:"M10 21V8a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-5a1 1 0 0 0-1-1H3",key:"1fpvtg"}]]),HU=Kt("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),KU=Kt("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),YU=Kt("Coffee",[["path",{d:"M17 8h1a4 4 0 1 1 0 8h-1",key:"jx4kbh"}],["path",{d:"M3 8h14v9a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4Z",key:"1bxrl0"}],["line",{x1:"6",x2:"6",y1:"2",y2:"4",key:"1cr9l3"}],["line",{x1:"10",x2:"10",y1:"2",y2:"4",key:"170wym"}],["line",{x1:"14",x2:"14",y1:"2",y2:"4",key:"1c5f70"}]]),GU=Kt("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]),XU=Kt("Eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]),ZU=Kt("Expand",[["path",{d:"m21 21-6-6m6 6v-4.8m0 4.8h-4.8",key:"1c15vz"}],["path",{d:"M3 16.2V21m0 0h4.8M3 21l6-6",key:"1fsnz2"}],["path",{d:"M21 7.8V3m0 0h-4.8M21 3l-6 6",key:"hawz9i"}],["path",{d:"M3 7.8V3m0 0h4.8M3 3l6 6",key:"u9ee12"}]]),qU=Kt("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),QU=Kt("FolderClosed",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M2 10h20",key:"1ir3d8"}]]),XT=Kt("Fullscreen",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["rect",{width:"10",height:"8",x:"7",y:"8",rx:"1",key:"vys8me"}]]),JU=Kt("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]),eV=Kt("Keyboard",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",ry:"2",key:"15u882"}],["path",{d:"M6 8h.001",key:"1ej0i3"}],["path",{d:"M10 8h.001",key:"1x2st2"}],["path",{d:"M14 8h.001",key:"1vkmyp"}],["path",{d:"M18 8h.001",key:"kfsenl"}],["path",{d:"M8 12h.001",key:"1sjpby"}],["path",{d:"M12 12h.001",key:"al75ts"}],["path",{d:"M16 12h.001",key:"931bgk"}],["path",{d:"M7 16h10",key:"wp8him"}]]),tV=Kt("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]),nV=Kt("MousePointerClick",[["path",{d:"m9 9 5 12 1.8-5.2L21 14Z",key:"1b76lo"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}]]),rV=Kt("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),oV=Kt("Redo",[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]]),iV=Kt("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]),sV=Kt("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),VC=Kt("Slice",[["path",{d:"m8 14-6 6h9v-3",key:"zo3j9a"}],["path",{d:"M18.37 3.63 8 14l3 3L21.37 6.63a2.12 2.12 0 1 0-3-3Z",key:"1dzx0j"}]]),WC=Kt("Smile",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]),aV=Kt("Undo",[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]]),ZT=Kt("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);function lV(e,t){const[n,r]=f.useState(e);return f.useEffect(()=>{const o=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(o)}},[e,t]),n}function u1(e){const[t,n]=f.useState(()=>typeof e=="boolean"?e:!!e),r=f.useCallback(o=>n(typeof o=="boolean"?o:i=>!i),[]);return[t,r]}const w0="focusScope.autoFocusOnMount",x0="focusScope.autoFocusOnUnmount",HC={bubbles:!1,cancelable:!0},Hm=f.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...s}=e,[l,u]=f.useState(null),d=Ft(o),h=Ft(i),m=f.useRef(null),g=Be(t,_=>u(_)),y=f.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;f.useEffect(()=>{if(r){let b=function(M){if(y.paused||!l)return;const A=M.target;l.contains(A)?m.current=A:Hi(m.current,{select:!0})},E=function(M){if(y.paused||!l)return;const A=M.relatedTarget;A!==null&&(l.contains(A)||Hi(m.current,{select:!0}))},k=function(M){if(document.activeElement===document.body)for(const O of M)O.removedNodes.length>0&&Hi(l)};var _=b,C=E,S=k;document.addEventListener("focusin",b),document.addEventListener("focusout",E);const P=new MutationObserver(k);return l&&P.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",E),P.disconnect()}}},[r,l,y.paused]),f.useEffect(()=>{if(l){YC.add(y);const _=document.activeElement;if(!l.contains(_)){const S=new CustomEvent(w0,HC);l.addEventListener(w0,d),l.dispatchEvent(S),S.defaultPrevented||(cV(hV(qT(l)),{select:!0}),document.activeElement===_&&Hi(l))}return()=>{l.removeEventListener(w0,d),setTimeout(()=>{const S=new CustomEvent(x0,HC);l.addEventListener(x0,h),l.dispatchEvent(S),S.defaultPrevented||Hi(_??document.body,{select:!0}),l.removeEventListener(x0,h),YC.remove(y)},0)}}},[l,d,h,y]);const x=f.useCallback(_=>{if(!n&&!r||y.paused)return;const C=_.key==="Tab"&&!_.altKey&&!_.ctrlKey&&!_.metaKey,S=document.activeElement;if(C&&S){const b=_.currentTarget,[E,k]=uV(b);E&&k?!_.shiftKey&&S===k?(_.preventDefault(),n&&Hi(E,{select:!0})):_.shiftKey&&S===E&&(_.preventDefault(),n&&Hi(k,{select:!0})):S===b&&_.preventDefault()}},[n,r,y.paused]);return f.createElement(Pe.div,Y({tabIndex:-1},s,{ref:g,onKeyDown:x}))});function cV(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Hi(r,{select:t}),document.activeElement!==n)return}function uV(e){const t=qT(e),n=KC(t,e),r=KC(t.reverse(),e);return[n,r]}function qT(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function KC(e,t){for(const n of e)if(!dV(n,{upTo:t}))return n}function dV(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function fV(e){return e instanceof HTMLInputElement&&"select"in e}function Hi(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&fV(e)&&t&&e.select()}}const YC=pV();function pV(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=GC(e,t),e.unshift(t)},remove(t){var n;e=GC(e,t),(n=e[0])===null||n===void 0||n.resume()}}}function GC(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function hV(e){return e.filter(t=>t.tagName!=="A")}let b0=0;function Km(){f.useEffect(()=>{var e,t;const n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",(e=n[0])!==null&&e!==void 0?e:XC()),document.body.insertAdjacentElement("beforeend",(t=n[1])!==null&&t!==void 0?t:XC()),b0++,()=>{b0===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(r=>r.remove()),b0--}},[])}function XC(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",e}var Mo=function(){return Mo=Object.assign||function(t){for(var n,r=1,o=arguments.length;r"u")return AV;var t=OV(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},NV=tP(),DV=function(e,t,n,r){var o=e.left,i=e.top,s=e.right,l=e.gap;return n===void 0&&(n="margin"),`
- .`.concat(gV,` {
- overflow: hidden `).concat(r,`;
- padding-right: `).concat(l,"px ").concat(r,`;
- }
- body {
- overflow: hidden `).concat(r,`;
- overscroll-behavior: contain;
- `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
- padding-left: `.concat(o,`px;
- padding-top: `).concat(i,`px;
- padding-right: `).concat(s,`px;
- margin-left:0;
- margin-top:0;
- margin-right: `).concat(l,"px ").concat(r,`;
- `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),`
- }
-
- .`).concat(Wp,` {
- right: `).concat(l,"px ").concat(r,`;
- }
-
- .`).concat(Hp,` {
- margin-right: `).concat(l,"px ").concat(r,`;
- }
-
- .`).concat(Wp," .").concat(Wp,` {
- right: 0 `).concat(r,`;
- }
-
- .`).concat(Hp," .").concat(Hp,` {
- margin-right: 0 `).concat(r,`;
- }
-
- body {
- `).concat(vV,": ").concat(l,`px;
- }
-`)},IV=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r,i=f.useMemo(function(){return MV(o)},[o]);return f.createElement(NV,{styles:DV(i,!t,o,n?"":"!important")})},d1=!1;if(typeof window<"u")try{var ap=Object.defineProperty({},"passive",{get:function(){return d1=!0,!0}});window.addEventListener("test",ap,ap),window.removeEventListener("test",ap,ap)}catch{d1=!1}var qa=d1?{passive:!1}:!1,LV=function(e){return e.tagName==="TEXTAREA"},nP=function(e,t){var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!LV(e)&&n[t]==="visible")},FV=function(e){return nP(e,"overflowY")},jV=function(e){return nP(e,"overflowX")},qC=function(e,t){var n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var r=rP(e,n);if(r){var o=oP(e,n),i=o[1],s=o[2];if(i>s)return!0}n=n.parentNode}while(n&&n!==document.body);return!1},zV=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},BV=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},rP=function(e,t){return e==="v"?FV(t):jV(t)},oP=function(e,t){return e==="v"?zV(t):BV(t)},UV=function(e,t){return e==="h"&&t==="rtl"?-1:1},VV=function(e,t,n,r,o){var i=UV(e,window.getComputedStyle(t).direction),s=i*r,l=n.target,u=t.contains(l),d=!1,h=s>0,m=0,g=0;do{var y=oP(e,l),x=y[0],_=y[1],C=y[2],S=_-C-i*x;(x||S)&&rP(e,l)&&(m+=S,g+=x),l=l.parentNode}while(!u&&l!==document.body||u&&(t.contains(l)||t===l));return(h&&(o&&m===0||!o&&s>m)||!h&&(o&&g===0||!o&&-s>g))&&(d=!0),d},lp=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},QC=function(e){return[e.deltaX,e.deltaY]},JC=function(e){return e&&"current"in e?e.current:e},WV=function(e,t){return e[0]===t[0]&&e[1]===t[1]},HV=function(e){return`
- .block-interactivity-`.concat(e,` {pointer-events: none;}
- .allow-interactivity-`).concat(e,` {pointer-events: all;}
-`)},KV=0,Qa=[];function YV(e){var t=f.useRef([]),n=f.useRef([0,0]),r=f.useRef(),o=f.useState(KV++)[0],i=f.useState(function(){return tP()})[0],s=f.useRef(e);f.useEffect(function(){s.current=e},[e]),f.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var _=mV([e.lockRef.current],(e.shards||[]).map(JC),!0).filter(Boolean);return _.forEach(function(C){return C.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),_.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var l=f.useCallback(function(_,C){if("touches"in _&&_.touches.length===2)return!s.current.allowPinchZoom;var S=lp(_),b=n.current,E="deltaX"in _?_.deltaX:b[0]-S[0],k="deltaY"in _?_.deltaY:b[1]-S[1],P,M=_.target,A=Math.abs(E)>Math.abs(k)?"h":"v";if("touches"in _&&A==="h"&&M.type==="range")return!1;var O=qC(A,M);if(!O)return!0;if(O?P=A:(P=A==="v"?"h":"v",O=qC(A,M)),!O)return!1;if(!r.current&&"changedTouches"in _&&(E||k)&&(r.current=P),!P)return!0;var F=r.current||P;return VV(F,C,_,F==="h"?E:k,!0)},[]),u=f.useCallback(function(_){var C=_;if(!(!Qa.length||Qa[Qa.length-1]!==i)){var S="deltaY"in C?QC(C):lp(C),b=t.current.filter(function(P){return P.name===C.type&&P.target===C.target&&WV(P.delta,S)})[0];if(b&&b.should){C.cancelable&&C.preventDefault();return}if(!b){var E=(s.current.shards||[]).map(JC).filter(Boolean).filter(function(P){return P.contains(C.target)}),k=E.length>0?l(C,E[0]):!s.current.noIsolation;k&&C.cancelable&&C.preventDefault()}}},[]),d=f.useCallback(function(_,C,S,b){var E={name:_,delta:C,target:S,should:b};t.current.push(E),setTimeout(function(){t.current=t.current.filter(function(k){return k!==E})},1)},[]),h=f.useCallback(function(_){n.current=lp(_),r.current=void 0},[]),m=f.useCallback(function(_){d(_.type,QC(_),_.target,l(_,e.lockRef.current))},[]),g=f.useCallback(function(_){d(_.type,lp(_),_.target,l(_,e.lockRef.current))},[]);f.useEffect(function(){return Qa.push(i),e.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:g}),document.addEventListener("wheel",u,qa),document.addEventListener("touchmove",u,qa),document.addEventListener("touchstart",h,qa),function(){Qa=Qa.filter(function(_){return _!==i}),document.removeEventListener("wheel",u,qa),document.removeEventListener("touchmove",u,qa),document.removeEventListener("touchstart",h,qa)}},[]);var y=e.removeScrollBar,x=e.inert;return f.createElement(f.Fragment,null,x?f.createElement(i,{styles:HV(o)}):null,y?f.createElement(IV,{gapMode:"margin"}):null)}const GV=EV(eP,YV);var iP=f.forwardRef(function(e,t){return f.createElement(Ym,Mo({},e,{ref:t,sideCar:GV}))});iP.classNames=Ym.classNames;const Gm=iP;var XV=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ja=new WeakMap,cp=new WeakMap,up={},E0=0,sP=function(e){return e&&(e.host||sP(e.parentNode))},ZV=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=sP(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},qV=function(e,t,n,r){var o=ZV(t,Array.isArray(e)?e:[e]);up[n]||(up[n]=new WeakMap);var i=up[n],s=[],l=new Set,u=new Set(o),d=function(m){!m||l.has(m)||(l.add(m),d(m.parentNode))};o.forEach(d);var h=function(m){!m||u.has(m)||Array.prototype.forEach.call(m.children,function(g){if(l.has(g))h(g);else{var y=g.getAttribute(r),x=y!==null&&y!=="false",_=(Ja.get(g)||0)+1,C=(i.get(g)||0)+1;Ja.set(g,_),i.set(g,C),s.push(g),_===1&&x&&cp.set(g,!0),C===1&&g.setAttribute(n,"true"),x||g.setAttribute(r,"true")}})};return h(t),l.clear(),E0++,function(){s.forEach(function(m){var g=Ja.get(m)-1,y=i.get(m)-1;Ja.set(m,g),i.set(m,y),g||(cp.has(m)||m.removeAttribute(r),cp.delete(m)),y||m.removeAttribute(n)}),E0--,E0||(Ja=new WeakMap,Ja=new WeakMap,cp=new WeakMap,up={})}},Xm=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=t||XV(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live]"))),qV(r,o,n,"aria-hidden")):function(){return null}};const aP="Dialog",[lP,cP]=An(aP),[QV,bo]=lP(aP),JV=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:s=!0}=e,l=f.useRef(null),u=f.useRef(null),[d=!1,h]=Zr({prop:r,defaultProp:o,onChange:i});return f.createElement(QV,{scope:t,triggerRef:l,contentRef:u,contentId:nr(),titleId:nr(),descriptionId:nr(),open:d,onOpenChange:h,onOpenToggle:f.useCallback(()=>h(m=>!m),[h]),modal:s},n)},eW="DialogTrigger",uP=f.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=bo(eW,n),i=Be(t,o.triggerRef);return f.createElement(Pe.button,Y({type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":_x(o.open)},r,{ref:i,onClick:ue(e.onClick,o.onOpenToggle)}))}),dP="DialogPortal",[tW,fP]=lP(dP,{forceMount:void 0}),nW=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,i=bo(dP,t);return f.createElement(tW,{scope:t,forceMount:n},f.Children.map(r,s=>f.createElement(xn,{present:n||i.open},f.createElement(Md,{asChild:!0,container:o},s))))},f1="DialogOverlay",rW=f.forwardRef((e,t)=>{const n=fP(f1,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=bo(f1,e.__scopeDialog);return i.modal?f.createElement(xn,{present:r||i.open},f.createElement(oW,Y({},o,{ref:t}))):null}),oW=f.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=bo(f1,n);return f.createElement(Gm,{as:Wo,allowPinchZoom:!0,shards:[o.contentRef]},f.createElement(Pe.div,Y({"data-state":_x(o.open)},r,{ref:t,style:{pointerEvents:"auto",...r.style}})))}),oc="DialogContent",iW=f.forwardRef((e,t)=>{const n=fP(oc,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=bo(oc,e.__scopeDialog);return f.createElement(xn,{present:r||i.open},i.modal?f.createElement(sW,Y({},o,{ref:t})):f.createElement(aW,Y({},o,{ref:t})))}),sW=f.forwardRef((e,t)=>{const n=bo(oc,e.__scopeDialog),r=f.useRef(null),o=Be(t,n.contentRef,r);return f.useEffect(()=>{const i=r.current;if(i)return Xm(i)},[]),f.createElement(pP,Y({},e,{ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ue(e.onCloseAutoFocus,i=>{var s;i.preventDefault(),(s=n.triggerRef.current)===null||s===void 0||s.focus()}),onPointerDownOutside:ue(e.onPointerDownOutside,i=>{const s=i.detail.originalEvent,l=s.button===0&&s.ctrlKey===!0;(s.button===2||l)&&i.preventDefault()}),onFocusOutside:ue(e.onFocusOutside,i=>i.preventDefault())}))}),aW=f.forwardRef((e,t)=>{const n=bo(oc,e.__scopeDialog),r=f.useRef(!1),o=f.useRef(!1);return f.createElement(pP,Y({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var s;if((s=e.onCloseAutoFocus)===null||s===void 0||s.call(e,i),!i.defaultPrevented){var l;r.current||(l=n.triggerRef.current)===null||l===void 0||l.focus(),i.preventDefault()}r.current=!1,o.current=!1},onInteractOutside:i=>{var s,l;(s=e.onInteractOutside)===null||s===void 0||s.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const u=i.target;((l=n.triggerRef.current)===null||l===void 0?void 0:l.contains(u))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}}))}),pP=f.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,...s}=e,l=bo(oc,n),u=f.useRef(null),d=Be(t,u);return Km(),f.createElement(f.Fragment,null,f.createElement(Hm,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i},f.createElement(yc,Y({role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":_x(l.open)},s,{ref:d,onDismiss:()=>l.onOpenChange(!1)}))),!1)}),hP="DialogTitle",lW=f.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=bo(hP,n);return f.createElement(Pe.h2,Y({id:o.titleId},r,{ref:t}))}),cW="DialogDescription",mP=f.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=bo(cW,n);return f.createElement(Pe.p,Y({id:o.descriptionId},r,{ref:t}))}),uW="DialogClose",dW=f.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=bo(uW,n);return f.createElement(Pe.button,Y({type:"button"},r,{ref:t,onClick:ue(e.onClick,()=>o.onOpenChange(!1))}))});function _x(e){return e?"open":"closed"}const fW="DialogTitleWarning",[pW,yte]=fB(fW,{contentName:oc,titleName:hP,docsSlug:"dialog"}),Sx=JV,gP=uP,Ex=nW,Nd=rW,Dd=iW,Id=lW,Ld=mP,Cx=dW,Zm=Sx,$x=gP,hW=Ex,vP=f.forwardRef(({className:e,...t},n)=>v.jsx(Nd,{ref:n,className:Ce("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));vP.displayName=Nd.displayName;const Fd=f.forwardRef(({className:e,children:t,...n},r)=>v.jsxs(hW,{children:[v.jsx(vP,{}),v.jsxs(Dd,{ref:r,className:Ce("fixed left-[50%] top-[50%] z-50 flex flex-col w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e,"outline-none"),onCloseAutoFocus:o=>o.preventDefault(),...n,children:[t,v.jsxs(Cx,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[v.jsx(yT,{className:"h-4 w-4"}),v.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Fd.displayName=Dd.displayName;const yP=({className:e,...t})=>v.jsx("div",{className:Ce("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});yP.displayName="DialogHeader";const jd=f.forwardRef(({className:e,...t},n)=>v.jsx(Id,{ref:n,className:Ce("text-2xl font-semibold leading-none tracking-tight",e),...t}));jd.displayName=Id.displayName;const mW=f.forwardRef(({className:e,...t},n)=>v.jsx(Ld,{ref:n,className:Ce("text-sm text-muted-foreground",e),...t}));mW.displayName=Ld.displayName;function p1(){return p1=Object.assign?Object.assign.bind():function(e){for(var t=1;t'),!0):t?e.some(function(n){return t.includes(n)})||e.includes("*"):!0}var SW=function(t,n,r){r===void 0&&(r=!1);var o=n.alt,i=n.meta,s=n.mod,l=n.shift,u=n.ctrl,d=n.keys,h=t.key,m=t.code,g=t.ctrlKey,y=t.metaKey,x=t.shiftKey,_=t.altKey,C=ss(m),S=h.toLowerCase();if(!r){if(o===!_&&S!=="alt"||l===!x&&S!=="shift")return!1;if(s){if(!y&&!g)return!1}else if(i===!y&&S!=="meta"&&S!=="os"||u===!g&&S!=="ctrl"&&S!=="control")return!1}return d&&d.length===1&&(d.includes(S)||d.includes(C))?!0:d?yW(d):!d},EW=f.createContext(void 0),CW=function(){return f.useContext(EW)};function SP(e,t){return e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(e).length===Object.keys(t).length&&Object.keys(e).reduce(function(n,r){return n&&SP(e[r],t[r])},!0):e===t}var $W=f.createContext({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),kW=function(){return f.useContext($W)};function RW(e){var t=f.useRef(void 0);return SP(t.current,e)||(t.current=e),t.current}var e2=function(t){t.stopPropagation(),t.preventDefault(),t.stopImmediatePropagation()},TW=typeof window<"u"?f.useLayoutEffect:f.useEffect;function PW(e,t,n,r){var o=f.useRef(null),i=f.useRef(!1),s=n instanceof Array?r instanceof Array?void 0:r:n,l=kx(e)?e.join(s==null?void 0:s.splitKey):e,u=n instanceof Array?n:r instanceof Array?r:void 0,d=f.useCallback(t,u??[]),h=f.useRef(d);u?h.current=d:h.current=t;var m=RW(s),g=kW(),y=g.enabledScopes,x=CW();return TW(function(){if(!((m==null?void 0:m.enabled)===!1||!_W(y,m==null?void 0:m.scopes))){var _=function(k,P){var M;if(P===void 0&&(P=!1),!(bW(k)&&!_P(k,m==null?void 0:m.enableOnFormTags))&&!(m!=null&&m.ignoreEventWhen!=null&&m.ignoreEventWhen(k))){if(o.current!==null&&document.activeElement!==o.current&&!o.current.contains(document.activeElement)){e2(k);return}(M=k.target)!=null&&M.isContentEditable&&!(m!=null&&m.enableOnContentEditable)||C0(l,m==null?void 0:m.splitKey).forEach(function(A){var O,F=$0(A,m==null?void 0:m.combinationKey);if(SW(k,F,m==null?void 0:m.ignoreModifiers)||(O=F.keys)!=null&&O.includes("*")){if(P&&i.current)return;if(wW(k,F,m==null?void 0:m.preventDefault),!xW(k,F,m==null?void 0:m.enabled)){e2(k);return}h.current(k,F),P||(i.current=!0)}})}},C=function(k){k.key!==void 0&&(xP(ss(k.code)),((m==null?void 0:m.keydown)===void 0&&(m==null?void 0:m.keyup)!==!0||m!=null&&m.keydown)&&_(k))},S=function(k){k.key!==void 0&&(bP(ss(k.code)),i.current=!1,m!=null&&m.keyup&&_(k,!0))},b=o.current||(s==null?void 0:s.document)||document;return b.addEventListener("keyup",S),b.addEventListener("keydown",C),x&&C0(l,m==null?void 0:m.splitKey).forEach(function(E){return x.addHotkey($0(E,m==null?void 0:m.combinationKey,m==null?void 0:m.description))}),function(){b.removeEventListener("keyup",S),b.removeEventListener("keydown",C),x&&C0(l,m==null?void 0:m.splitKey).forEach(function(E){return x.removeHotkey($0(E,m==null?void 0:m.combinationKey,m==null?void 0:m.description))})}}},[l,m,y]),o}const Zn=(e,t,n)=>{const r=bt(i=>i.disableShortCuts);return PW(e,t,{enabled:!r},n)};function ur(e){const{content:t,keys:n}=e;return v.jsxs("div",{className:"flex justify-between",children:[v.jsx("div",{children:t}),v.jsx("div",{className:"flex gap-[8px]",children:n.map(r=>v.jsx("div",{className:"border px-2 py-1 rounded-lg",children:r},r))})]})}const AW=function(){return/macintosh|mac os x/i.test(navigator.userAgent)},dp=()=>AW()?"Cmd":"Ctrl";function OW(){const[e,t]=u1(!1);return Zn("h",()=>{t()}),v.jsxs(Zm,{open:e,onOpenChange:t,children:[v.jsx($x,{asChild:!0,children:v.jsx(vn,{tooltip:"Hotkeys",children:v.jsx(eV,{})})}),v.jsx(Fd,{children:v.jsxs(yP,{children:[v.jsx(jd,{children:"Hotkeys"}),v.jsxs("div",{className:"flex gap-2 flex-col pt-4",children:[v.jsx(ur,{content:"Pan",keys:["Space + Drag"]}),v.jsx(ur,{content:"Reset Zoom/Pan",keys:["Esc"]}),v.jsx(ur,{content:"Decrease Brush Size",keys:["["]}),v.jsx(ur,{content:"Increase Brush Size",keys:["]"]}),v.jsx(ur,{content:"View Original Image",keys:["Hold Tab"]}),v.jsx(ur,{content:"Undo",keys:[dp(),"Z"]}),v.jsx(ur,{content:"Redo",keys:[dp(),"Shift","Z"]}),v.jsx(ur,{content:"Copy Result",keys:[dp(),"C"]}),v.jsx(ur,{content:"Paste Image",keys:[dp(),"V"]}),v.jsx(ur,{content:"Trigger Manually Inpainting",keys:["Shift","R"]}),v.jsx(ur,{content:"Toggle Hotkeys Dialog",keys:["H"]}),v.jsx(ur,{content:"Toggle Settings Dialog",keys:["S"]}),v.jsx(ur,{content:"Toggle File Manager",keys:["F"]})]})]})})]})}function Rx(e){const[t]=f.useState(new Image),[n,r]=f.useState(!1);return f.useEffect(()=>{if(e)return t.onload=()=>{r(!0)},r(!1),t.src=URL.createObjectURL(e),()=>{t.onload=null}},[e,t]),[t,n]}const EP="Popover",[CP,wte]=An(EP,[Ns]),Tx=Ns(),[MW,bc]=CP(EP),NW=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:s=!1}=e,l=Tx(t),u=f.useRef(null),[d,h]=f.useState(!1),[m=!1,g]=Zr({prop:r,defaultProp:o,onChange:i});return f.createElement(Od,l,f.createElement(MW,{scope:t,contentId:nr(),triggerRef:u,open:m,onOpenChange:g,onOpenToggle:f.useCallback(()=>g(y=>!y),[g]),hasCustomAnchor:d,onCustomAnchorAdd:f.useCallback(()=>h(!0),[]),onCustomAnchorRemove:f.useCallback(()=>h(!1),[]),modal:s},n))},DW="PopoverTrigger",IW=f.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=bc(DW,n),i=Tx(n),s=Be(t,o.triggerRef),l=f.createElement(Pe.button,Y({type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":RP(o.open)},r,{ref:s,onClick:ue(e.onClick,o.onOpenToggle)}));return o.hasCustomAnchor?l:f.createElement(zm,Y({asChild:!0},i),l)}),$P="PopoverPortal",[LW,FW]=CP($P,{forceMount:void 0}),jW=e=>{const{__scopePopover:t,forceMount:n,children:r,container:o}=e,i=bc($P,t);return f.createElement(LW,{scope:t,forceMount:n},f.createElement(xn,{present:n||i.open},f.createElement(Md,{asChild:!0,container:o},r)))},od="PopoverContent",zW=f.forwardRef((e,t)=>{const n=FW(od,e.__scopePopover),{forceMount:r=n.forceMount,...o}=e,i=bc(od,e.__scopePopover);return f.createElement(xn,{present:r||i.open},i.modal?f.createElement(BW,Y({},o,{ref:t})):f.createElement(UW,Y({},o,{ref:t})))}),BW=f.forwardRef((e,t)=>{const n=bc(od,e.__scopePopover),r=f.useRef(null),o=Be(t,r),i=f.useRef(!1);return f.useEffect(()=>{const s=r.current;if(s)return Xm(s)},[]),f.createElement(Gm,{as:Wo,allowPinchZoom:!0},f.createElement(kP,Y({},e,{ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ue(e.onCloseAutoFocus,s=>{var l;s.preventDefault(),i.current||(l=n.triggerRef.current)===null||l===void 0||l.focus()}),onPointerDownOutside:ue(e.onPointerDownOutside,s=>{const l=s.detail.originalEvent,u=l.button===0&&l.ctrlKey===!0,d=l.button===2||u;i.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:ue(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})))}),UW=f.forwardRef((e,t)=>{const n=bc(od,e.__scopePopover),r=f.useRef(!1),o=f.useRef(!1);return f.createElement(kP,Y({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var s;if((s=e.onCloseAutoFocus)===null||s===void 0||s.call(e,i),!i.defaultPrevented){var l;r.current||(l=n.triggerRef.current)===null||l===void 0||l.focus(),i.preventDefault()}r.current=!1,o.current=!1},onInteractOutside:i=>{var s,l;(s=e.onInteractOutside)===null||s===void 0||s.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const u=i.target;((l=n.triggerRef.current)===null||l===void 0?void 0:l.contains(u))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}}))}),kP=f.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:h,...m}=e,g=bc(od,n),y=Tx(n);return Km(),f.createElement(Hm,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i},f.createElement(yc,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:h,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onDismiss:()=>g.onOpenChange(!1)},f.createElement(Bm,Y({"data-state":RP(g.open),role:"dialog",id:g.contentId},y,m,{ref:t,style:{...m.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)"}}))))});function RP(e){return e?"open":"closed"}const VW=NW,WW=IW,HW=jW,TP=zW,KW=VW,YW=WW,PP=f.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},o)=>v.jsx(HW,{children:v.jsx(TP,{ref:o,align:t,tabIndex:-1,sideOffset:n,className:Ce("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),...r})}));PP.displayName=TP.displayName;function GW(){var e=f.useRef(!0);return e.current?(e.current=!1,!0):e.current}var XW=function(e,t){var n=GW();f.useEffect(function(){if(!n)return e()},t)};const ZW=XW;var qW=function(){};function Px(e){for(var t=[],n=1;n{const[e,t,n,r,o,i]=bt(g=>[g.getIsProcessing(),g.settings.prompt,g.updateSettings,g.runInpainting,g.showPrevMask,g.hidePrevMask]),s=f.useRef(null);OP(s,()=>{s!=null&&s.current&&s.current.blur()});const l=g=>{g.preventDefault(),g.stopPropagation();const y=g.target;n({prompt:y.value})},u=()=>{e||r()},d=g=>{g.key==="Enter"&&!e&&u()},h=()=>{o()},m=()=>{i()};return v.jsxs("div",{className:"flex gap-4 items-center",children:[v.jsx(Pd,{ref:s,className:"min-w-[500px]",value:t,onInput:l,onKeyUp:d,placeholder:"I want to repaint of..."}),v.jsx(Rn,{size:"sm",onClick:u,disabled:e,onMouseEnter:h,onMouseLeave:m,children:"Dream"})]})};var Lh={exports:{}};/**
- * @license
- * Lodash
- * Copyright OpenJS Foundation and other contributors
- * Released under MIT license
- * Based on Underscore.js 1.8.3
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
- */Lh.exports;(function(e,t){(function(){var n,r="4.17.21",o=200,i="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",s="Expected a function",l="Invalid `variable` option passed into `_.template`",u="__lodash_hash_undefined__",d=500,h="__lodash_placeholder__",m=1,g=2,y=4,x=1,_=2,C=1,S=2,b=4,E=8,k=16,P=32,M=64,A=128,O=256,F=512,V=30,J="...",G=800,ae=16,U=1,te=2,L=3,ie=1/0,K=9007199254740991,Q=17976931348623157e292,W=NaN,le=4294967295,ge=le-1,Ve=le>>>1,Ue=[["ary",A],["bind",C],["bindKey",S],["curry",E],["curryRight",k],["flip",F],["partial",P],["partialRight",M],["rearg",O]],We="[object Arguments]",Me="[object Array]",fe="[object AsyncFunction]",xe="[object Boolean]",$e="[object Date]",Ae="[object DOMException]",Oe="[object Error]",je="[object Function]",Ot="[object GeneratorFunction]",ct="[object Map]",Yt="[object Number]",Er="[object Null]",gt="[object Object]",js="[object Promise]",I="[object Proxy]",X="[object RegExp]",Z="[object Set]",we="[object String]",he="[object Symbol]",de="[object Undefined]",ke="[object WeakMap]",ft="[object WeakSet]",pt="[object ArrayBuffer]",bn="[object DataView]",Cr="[object Float32Array]",ki="[object Float64Array]",_o="[object Int8Array]",Vn="[object Int16Array]",Da="[object Int32Array]",Ri="[object Uint8Array]",zs="[object Uint8ClampedArray]",Ti="[object Uint16Array]",$c="[object Uint32Array]",yg=/\b__p \+= '';/g,wg=/\b(__p \+=) '' \+/g,Kd=/(__e\(.*?\)|\b__t\)) \+\n'';/g,kc=/&(?:amp|lt|gt|quot|#39);/g,Rc=/[&<>"']/g,Tc=RegExp(kc.source),xg=RegExp(Rc.source),Pc=/<%-([\s\S]+?)%>/g,Yd=/<%([\s\S]+?)%>/g,Ac=/<%=([\s\S]+?)%>/g,bg=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,_g=/^\w*$/,Sg=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,H=/[\\^$.*+?()[\]{}|]/g,Ge=RegExp(H.source),st=/^\s+/,Qr=/\s/,an=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Gd=/\{\n\/\* \[wrapped with (.+)\] \*/,oO=/,? & /,iO=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,sO=/[()=,{}\[\]\/\s]/,aO=/\\(\\)?/g,lO=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,db=/\w*$/,cO=/^[-+]0x[0-9a-f]+$/i,uO=/^0b[01]+$/i,dO=/^\[object .+?Constructor\]$/,fO=/^0o[0-7]+$/i,pO=/^(?:0|[1-9]\d*)$/,hO=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Xd=/($^)/,mO=/['\n\r\u2028\u2029\\]/g,Zd="\\ud800-\\udfff",gO="\\u0300-\\u036f",vO="\\ufe20-\\ufe2f",yO="\\u20d0-\\u20ff",fb=gO+vO+yO,pb="\\u2700-\\u27bf",hb="a-z\\xdf-\\xf6\\xf8-\\xff",wO="\\xac\\xb1\\xd7\\xf7",xO="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",bO="\\u2000-\\u206f",_O=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",mb="A-Z\\xc0-\\xd6\\xd8-\\xde",gb="\\ufe0e\\ufe0f",vb=wO+xO+bO+_O,Eg="['’]",SO="["+Zd+"]",yb="["+vb+"]",qd="["+fb+"]",wb="\\d+",EO="["+pb+"]",xb="["+hb+"]",bb="[^"+Zd+vb+wb+pb+hb+mb+"]",Cg="\\ud83c[\\udffb-\\udfff]",CO="(?:"+qd+"|"+Cg+")",_b="[^"+Zd+"]",$g="(?:\\ud83c[\\udde6-\\uddff]){2}",kg="[\\ud800-\\udbff][\\udc00-\\udfff]",Ia="["+mb+"]",Sb="\\u200d",Eb="(?:"+xb+"|"+bb+")",$O="(?:"+Ia+"|"+bb+")",Cb="(?:"+Eg+"(?:d|ll|m|re|s|t|ve))?",$b="(?:"+Eg+"(?:D|LL|M|RE|S|T|VE))?",kb=CO+"?",Rb="["+gb+"]?",kO="(?:"+Sb+"(?:"+[_b,$g,kg].join("|")+")"+Rb+kb+")*",RO="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",TO="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Tb=Rb+kb+kO,PO="(?:"+[EO,$g,kg].join("|")+")"+Tb,AO="(?:"+[_b+qd+"?",qd,$g,kg,SO].join("|")+")",OO=RegExp(Eg,"g"),MO=RegExp(qd,"g"),Rg=RegExp(Cg+"(?="+Cg+")|"+AO+Tb,"g"),NO=RegExp([Ia+"?"+xb+"+"+Cb+"(?="+[yb,Ia,"$"].join("|")+")",$O+"+"+$b+"(?="+[yb,Ia+Eb,"$"].join("|")+")",Ia+"?"+Eb+"+"+Cb,Ia+"+"+$b,TO,RO,wb,PO].join("|"),"g"),DO=RegExp("["+Sb+Zd+fb+gb+"]"),IO=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,LO=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],FO=-1,kt={};kt[Cr]=kt[ki]=kt[_o]=kt[Vn]=kt[Da]=kt[Ri]=kt[zs]=kt[Ti]=kt[$c]=!0,kt[We]=kt[Me]=kt[pt]=kt[xe]=kt[bn]=kt[$e]=kt[Oe]=kt[je]=kt[ct]=kt[Yt]=kt[gt]=kt[X]=kt[Z]=kt[we]=kt[ke]=!1;var Et={};Et[We]=Et[Me]=Et[pt]=Et[bn]=Et[xe]=Et[$e]=Et[Cr]=Et[ki]=Et[_o]=Et[Vn]=Et[Da]=Et[ct]=Et[Yt]=Et[gt]=Et[X]=Et[Z]=Et[we]=Et[he]=Et[Ri]=Et[zs]=Et[Ti]=Et[$c]=!0,Et[Oe]=Et[je]=Et[ke]=!1;var jO={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},zO={"&":"&","<":"<",">":">",'"':""","'":"'"},BO={"&":"&","<":"<",">":">",""":'"',"'":"'"},UO={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},VO=parseFloat,WO=parseInt,Pb=typeof Yc=="object"&&Yc&&Yc.Object===Object&&Yc,HO=typeof self=="object"&&self&&self.Object===Object&&self,fn=Pb||HO||Function("return this")(),Tg=t&&!t.nodeType&&t,Bs=Tg&&!0&&e&&!e.nodeType&&e,Ab=Bs&&Bs.exports===Tg,Pg=Ab&&Pb.process,$r=function(){try{var j=Bs&&Bs.require&&Bs.require("util").types;return j||Pg&&Pg.binding&&Pg.binding("util")}catch{}}(),Ob=$r&&$r.isArrayBuffer,Mb=$r&&$r.isDate,Nb=$r&&$r.isMap,Db=$r&&$r.isRegExp,Ib=$r&&$r.isSet,Lb=$r&&$r.isTypedArray;function or(j,ee,q){switch(q.length){case 0:return j.call(ee);case 1:return j.call(ee,q[0]);case 2:return j.call(ee,q[0],q[1]);case 3:return j.call(ee,q[0],q[1],q[2])}return j.apply(ee,q)}function KO(j,ee,q,_e){for(var Ke=-1,ht=j==null?0:j.length;++Ke-1}function Ag(j,ee,q){for(var _e=-1,Ke=j==null?0:j.length;++_e-1;);return q}function Hb(j,ee){for(var q=j.length;q--&&La(ee,j[q],0)>-1;);return q}function t6(j,ee){for(var q=j.length,_e=0;q--;)j[q]===ee&&++_e;return _e}var n6=Dg(jO),r6=Dg(zO);function o6(j){return"\\"+UO[j]}function i6(j,ee){return j==null?n:j[ee]}function Fa(j){return DO.test(j)}function s6(j){return IO.test(j)}function a6(j){for(var ee,q=[];!(ee=j.next()).done;)q.push(ee.value);return q}function jg(j){var ee=-1,q=Array(j.size);return j.forEach(function(_e,Ke){q[++ee]=[Ke,_e]}),q}function Kb(j,ee){return function(q){return j(ee(q))}}function Oi(j,ee){for(var q=-1,_e=j.length,Ke=0,ht=[];++q<_e;){var en=j[q];(en===ee||en===h)&&(j[q]=h,ht[Ke++]=q)}return ht}function ef(j){var ee=-1,q=Array(j.size);return j.forEach(function(_e){q[++ee]=_e}),q}function l6(j){var ee=-1,q=Array(j.size);return j.forEach(function(_e){q[++ee]=[_e,_e]}),q}function c6(j,ee,q){for(var _e=q-1,Ke=j.length;++_e-1}function G6(a,c){var p=this.__data__,w=gf(p,a);return w<0?(++this.size,p.push([a,c])):p[w][1]=c,this}Xo.prototype.clear=W6,Xo.prototype.delete=H6,Xo.prototype.get=K6,Xo.prototype.has=Y6,Xo.prototype.set=G6;function Zo(a){var c=-1,p=a==null?0:a.length;for(this.clear();++c=c?a:c)),a}function Pr(a,c,p,w,$,T){var N,D=c&m,B=c&g,ne=c&y;if(p&&(N=$?p(a,w,$,T):p(a)),N!==n)return N;if(!It(a))return a;var re=Ye(a);if(re){if(N=QM(a),!D)return Wn(a,N)}else{var se=Sn(a),me=se==je||se==Ot;if(Fi(a))return R_(a,D);if(se==gt||se==We||me&&!$){if(N=B||me?{}:Y_(a),!D)return B?BM(a,uM(N,a)):zM(a,o_(N,a))}else{if(!Et[se])return $?a:{};N=JM(a,se,D)}}T||(T=new eo);var Re=T.get(a);if(Re)return Re;T.set(a,N),_S(a)?a.forEach(function(Le){N.add(Pr(Le,c,p,Le,a,T))}):xS(a)&&a.forEach(function(Le,nt){N.set(nt,Pr(Le,c,p,nt,a,T))});var Ie=ne?B?dv:uv:B?Kn:ln,Qe=re?n:Ie(a);return kr(Qe||a,function(Le,nt){Qe&&(nt=Le,Le=a[nt]),Fc(N,nt,Pr(Le,c,p,nt,a,T))}),N}function dM(a){var c=ln(a);return function(p){return i_(p,a,c)}}function i_(a,c,p){var w=p.length;if(a==null)return!w;for(a=_t(a);w--;){var $=p[w],T=c[$],N=a[$];if(N===n&&!($ in a)||!T(N))return!1}return!0}function s_(a,c,p){if(typeof a!="function")throw new Rr(s);return Hc(function(){a.apply(n,p)},c)}function jc(a,c,p,w){var $=-1,T=Qd,N=!0,D=a.length,B=[],ne=c.length;if(!D)return B;p&&(c=Mt(c,ir(p))),w?(T=Ag,N=!1):c.length>=o&&(T=Oc,N=!1,c=new Ws(c));e:for(;++$$?0:$+p),w=w===n||w>$?$:qe(w),w<0&&(w+=$),w=p>w?0:ES(w);p0&&p(D)?c>1?pn(D,c-1,p,w,$):Ai($,D):w||($[$.length]=D)}return $}var Kg=N_(),c_=N_(!0);function So(a,c){return a&&Kg(a,c,ln)}function Yg(a,c){return a&&c_(a,c,ln)}function yf(a,c){return Pi(c,function(p){return ti(a[p])})}function Ks(a,c){c=Ii(c,a);for(var p=0,w=c.length;a!=null&&pc}function hM(a,c){return a!=null&&yt.call(a,c)}function mM(a,c){return a!=null&&c in _t(a)}function gM(a,c,p){return a>=_n(c,p)&&a=120&&re.length>=120)?new Ws(N&&re):n}re=a[0];var se=-1,me=D[0];e:for(;++se<$&&ne.length-1;)D!==a&&cf.call(D,B,1),cf.call(a,B,1);return a}function x_(a,c){for(var p=a?c.length:0,w=p-1;p--;){var $=c[p];if(p==w||$!==T){var T=$;ei($)?cf.call(a,$,1):rv(a,$)}}return a}function ev(a,c){return a+ff(e_()*(c-a+1))}function TM(a,c,p,w){for(var $=-1,T=tn(df((c-a)/(p||1)),0),N=q(T);T--;)N[w?T:++$]=a,a+=p;return N}function tv(a,c){var p="";if(!a||c<1||c>K)return p;do c%2&&(p+=a),c=ff(c/2),c&&(a+=a);while(c);return p}function et(a,c){return yv(Z_(a,c,Yn),a+"")}function PM(a){return r_(Xa(a))}function AM(a,c){var p=Xa(a);return Tf(p,Hs(c,0,p.length))}function Uc(a,c,p,w){if(!It(a))return a;c=Ii(c,a);for(var $=-1,T=c.length,N=T-1,D=a;D!=null&&++$$?0:$+c),p=p>$?$:p,p<0&&(p+=$),$=c>p?0:p-c>>>0,c>>>=0;for(var T=q($);++w<$;)T[w]=a[w+c];return T}function NM(a,c){var p;return Ni(a,function(w,$,T){return p=c(w,$,T),!p}),!!p}function xf(a,c,p){var w=0,$=a==null?w:a.length;if(typeof c=="number"&&c===c&&$<=Ve){for(;w<$;){var T=w+$>>>1,N=a[T];N!==null&&!ar(N)&&(p?N<=c:N=o){var ne=c?null:HM(a);if(ne)return ef(ne);N=!1,$=Oc,B=new Ws}else B=c?[]:D;e:for(;++w=w?a:Ar(a,c,p)}var k_=_6||function(a){return fn.clearTimeout(a)};function R_(a,c){if(c)return a.slice();var p=a.length,w=Xb?Xb(p):new a.constructor(p);return a.copy(w),w}function av(a){var c=new a.constructor(a.byteLength);return new af(c).set(new af(a)),c}function IM(a,c){var p=c?av(a.buffer):a.buffer;return new a.constructor(p,a.byteOffset,a.byteLength)}function LM(a){var c=new a.constructor(a.source,db.exec(a));return c.lastIndex=a.lastIndex,c}function FM(a){return Lc?_t(Lc.call(a)):{}}function T_(a,c){var p=c?av(a.buffer):a.buffer;return new a.constructor(p,a.byteOffset,a.length)}function P_(a,c){if(a!==c){var p=a!==n,w=a===null,$=a===a,T=ar(a),N=c!==n,D=c===null,B=c===c,ne=ar(c);if(!D&&!ne&&!T&&a>c||T&&N&&B&&!D&&!ne||w&&N&&B||!p&&B||!$)return 1;if(!w&&!T&&!ne&&a=D)return B;var ne=p[w];return B*(ne=="desc"?-1:1)}}return a.index-c.index}function A_(a,c,p,w){for(var $=-1,T=a.length,N=p.length,D=-1,B=c.length,ne=tn(T-N,0),re=q(B+ne),se=!w;++D1?p[$-1]:n,N=$>2?p[2]:n;for(T=a.length>3&&typeof T=="function"?($--,T):n,N&&Mn(p[0],p[1],N)&&(T=$<3?n:T,$=1),c=_t(c);++w<$;){var D=p[w];D&&a(c,D,w,T)}return c})}function M_(a,c){return function(p,w){if(p==null)return p;if(!Hn(p))return a(p,w);for(var $=p.length,T=c?$:-1,N=_t(p);(c?T--:++T<$)&&w(N[T],T,N)!==!1;);return p}}function N_(a){return function(c,p,w){for(var $=-1,T=_t(c),N=w(c),D=N.length;D--;){var B=N[a?D:++$];if(p(T[B],B,T)===!1)break}return c}}function UM(a,c,p){var w=c&C,$=Vc(a);function T(){var N=this&&this!==fn&&this instanceof T?$:a;return N.apply(w?p:this,arguments)}return T}function D_(a){return function(c){c=vt(c);var p=Fa(c)?Jr(c):n,w=p?p[0]:c.charAt(0),$=p?Li(p,1).join(""):c.slice(1);return w[a]()+$}}function Ka(a){return function(c){return Og(MS(OS(c).replace(OO,"")),a,"")}}function Vc(a){return function(){var c=arguments;switch(c.length){case 0:return new a;case 1:return new a(c[0]);case 2:return new a(c[0],c[1]);case 3:return new a(c[0],c[1],c[2]);case 4:return new a(c[0],c[1],c[2],c[3]);case 5:return new a(c[0],c[1],c[2],c[3],c[4]);case 6:return new a(c[0],c[1],c[2],c[3],c[4],c[5]);case 7:return new a(c[0],c[1],c[2],c[3],c[4],c[5],c[6])}var p=Wa(a.prototype),w=a.apply(p,c);return It(w)?w:p}}function VM(a,c,p){var w=Vc(a);function $(){for(var T=arguments.length,N=q(T),D=T,B=Ya($);D--;)N[D]=arguments[D];var ne=T<3&&N[0]!==B&&N[T-1]!==B?[]:Oi(N,B);if(T-=ne.length,T-1?$[T?c[N]:N]:n}}function L_(a){return Jo(function(c){var p=c.length,w=p,$=Tr.prototype.thru;for(a&&c.reverse();w--;){var T=c[w];if(typeof T!="function")throw new Rr(s);if($&&!N&&kf(T)=="wrapper")var N=new Tr([],!0)}for(w=N?w:p;++w
1&&at.reverse(),re&&BD))return!1;var ne=T.get(a),re=T.get(c);if(ne&&re)return ne==c&&re==a;var se=-1,me=!0,Re=p&_?new Ws:n;for(T.set(a,c),T.set(c,a);++se1?"& ":"")+c[w],c=c.join(p>2?", ":" "),a.replace(an,`{
-/* [wrapped with `+c+`] */
-`)}function tN(a){return Ye(a)||Xs(a)||!!(Qb&&a&&a[Qb])}function ei(a,c){var p=typeof a;return c=c??K,!!c&&(p=="number"||p!="symbol"&&pO.test(a))&&a>-1&&a%1==0&&a0){if(++c>=G)return arguments[0]}else c=0;return a.apply(n,arguments)}}function Tf(a,c){var p=-1,w=a.length,$=w-1;for(c=c===n?w:c;++p1?a[c-1]:n;return p=typeof p=="function"?(a.pop(),p):n,lS(a,p)});function cS(a){var c=R(a);return c.__chain__=!0,c}function f7(a,c){return c(a),a}function Pf(a,c){return c(a)}var p7=Jo(function(a){var c=a.length,p=c?a[0]:0,w=this.__wrapped__,$=function(T){return Hg(T,a)};return c>1||this.__actions__.length||!(w instanceof ot)||!ei(p)?this.thru($):(w=w.slice(p,+p+(c?1:0)),w.__actions__.push({func:Pf,args:[$],thisArg:n}),new Tr(w,this.__chain__).thru(function(T){return c&&!T.length&&T.push(n),T}))});function h7(){return cS(this)}function m7(){return new Tr(this.value(),this.__chain__)}function g7(){this.__values__===n&&(this.__values__=SS(this.value()));var a=this.__index__>=this.__values__.length,c=a?n:this.__values__[this.__index__++];return{done:a,value:c}}function v7(){return this}function y7(a){for(var c,p=this;p instanceof mf;){var w=nS(p);w.__index__=0,w.__values__=n,c?$.__wrapped__=w:c=w;var $=w;p=p.__wrapped__}return $.__wrapped__=a,c}function w7(){var a=this.__wrapped__;if(a instanceof ot){var c=a;return this.__actions__.length&&(c=new ot(this)),c=c.reverse(),c.__actions__.push({func:Pf,args:[wv],thisArg:n}),new Tr(c,this.__chain__)}return this.thru(wv)}function x7(){return C_(this.__wrapped__,this.__actions__)}var b7=_f(function(a,c,p){yt.call(a,p)?++a[p]:qo(a,p,1)});function _7(a,c,p){var w=Ye(a)?Fb:fM;return p&&Mn(a,c,p)&&(c=n),w(a,De(c,3))}function S7(a,c){var p=Ye(a)?Pi:l_;return p(a,De(c,3))}var E7=I_(rS),C7=I_(oS);function $7(a,c){return pn(Af(a,c),1)}function k7(a,c){return pn(Af(a,c),ie)}function R7(a,c,p){return p=p===n?1:qe(p),pn(Af(a,c),p)}function uS(a,c){var p=Ye(a)?kr:Ni;return p(a,De(c,3))}function dS(a,c){var p=Ye(a)?YO:a_;return p(a,De(c,3))}var T7=_f(function(a,c,p){yt.call(a,p)?a[p].push(c):qo(a,p,[c])});function P7(a,c,p,w){a=Hn(a)?a:Xa(a),p=p&&!w?qe(p):0;var $=a.length;return p<0&&(p=tn($+p,0)),If(a)?p<=$&&a.indexOf(c,p)>-1:!!$&&La(a,c,p)>-1}var A7=et(function(a,c,p){var w=-1,$=typeof c=="function",T=Hn(a)?q(a.length):[];return Ni(a,function(N){T[++w]=$?or(c,N,p):zc(N,c,p)}),T}),O7=_f(function(a,c,p){qo(a,p,c)});function Af(a,c){var p=Ye(a)?Mt:h_;return p(a,De(c,3))}function M7(a,c,p,w){return a==null?[]:(Ye(c)||(c=c==null?[]:[c]),p=w?n:p,Ye(p)||(p=p==null?[]:[p]),y_(a,c,p))}var N7=_f(function(a,c,p){a[p?0:1].push(c)},function(){return[[],[]]});function D7(a,c,p){var w=Ye(a)?Og:Ub,$=arguments.length<3;return w(a,De(c,4),p,$,Ni)}function I7(a,c,p){var w=Ye(a)?GO:Ub,$=arguments.length<3;return w(a,De(c,4),p,$,a_)}function L7(a,c){var p=Ye(a)?Pi:l_;return p(a,Nf(De(c,3)))}function F7(a){var c=Ye(a)?r_:PM;return c(a)}function j7(a,c,p){(p?Mn(a,c,p):c===n)?c=1:c=qe(c);var w=Ye(a)?aM:AM;return w(a,c)}function z7(a){var c=Ye(a)?lM:MM;return c(a)}function B7(a){if(a==null)return 0;if(Hn(a))return If(a)?ja(a):a.length;var c=Sn(a);return c==ct||c==Z?a.size:qg(a).length}function U7(a,c,p){var w=Ye(a)?Mg:NM;return p&&Mn(a,c,p)&&(c=n),w(a,De(c,3))}var V7=et(function(a,c){if(a==null)return[];var p=c.length;return p>1&&Mn(a,c[0],c[1])?c=[]:p>2&&Mn(c[0],c[1],c[2])&&(c=[c[0]]),y_(a,pn(c,1),[])}),Of=S6||function(){return fn.Date.now()};function W7(a,c){if(typeof c!="function")throw new Rr(s);return a=qe(a),function(){if(--a<1)return c.apply(this,arguments)}}function fS(a,c,p){return c=p?n:c,c=a&&c==null?a.length:c,Qo(a,A,n,n,n,n,c)}function pS(a,c){var p;if(typeof c!="function")throw new Rr(s);return a=qe(a),function(){return--a>0&&(p=c.apply(this,arguments)),a<=1&&(c=n),p}}var bv=et(function(a,c,p){var w=C;if(p.length){var $=Oi(p,Ya(bv));w|=P}return Qo(a,w,c,p,$)}),hS=et(function(a,c,p){var w=C|S;if(p.length){var $=Oi(p,Ya(hS));w|=P}return Qo(c,w,a,p,$)});function mS(a,c,p){c=p?n:c;var w=Qo(a,E,n,n,n,n,n,c);return w.placeholder=mS.placeholder,w}function gS(a,c,p){c=p?n:c;var w=Qo(a,k,n,n,n,n,n,c);return w.placeholder=gS.placeholder,w}function vS(a,c,p){var w,$,T,N,D,B,ne=0,re=!1,se=!1,me=!0;if(typeof a!="function")throw new Rr(s);c=Mr(c)||0,It(p)&&(re=!!p.leading,se="maxWait"in p,T=se?tn(Mr(p.maxWait)||0,c):T,me="trailing"in p?!!p.trailing:me);function Re(Xt){var no=w,ri=$;return w=$=n,ne=Xt,N=a.apply(ri,no),N}function Ie(Xt){return ne=Xt,D=Hc(nt,c),re?Re(Xt):N}function Qe(Xt){var no=Xt-B,ri=Xt-ne,IS=c-no;return se?_n(IS,T-ri):IS}function Le(Xt){var no=Xt-B,ri=Xt-ne;return B===n||no>=c||no<0||se&&ri>=T}function nt(){var Xt=Of();if(Le(Xt))return at(Xt);D=Hc(nt,Qe(Xt))}function at(Xt){return D=n,me&&w?Re(Xt):(w=$=n,N)}function lr(){D!==n&&k_(D),ne=0,w=B=$=D=n}function Nn(){return D===n?N:at(Of())}function cr(){var Xt=Of(),no=Le(Xt);if(w=arguments,$=this,B=Xt,no){if(D===n)return Ie(B);if(se)return k_(D),D=Hc(nt,c),Re(B)}return D===n&&(D=Hc(nt,c)),N}return cr.cancel=lr,cr.flush=Nn,cr}var H7=et(function(a,c){return s_(a,1,c)}),K7=et(function(a,c,p){return s_(a,Mr(c)||0,p)});function Y7(a){return Qo(a,F)}function Mf(a,c){if(typeof a!="function"||c!=null&&typeof c!="function")throw new Rr(s);var p=function(){var w=arguments,$=c?c.apply(this,w):w[0],T=p.cache;if(T.has($))return T.get($);var N=a.apply(this,w);return p.cache=T.set($,N)||T,N};return p.cache=new(Mf.Cache||Zo),p}Mf.Cache=Zo;function Nf(a){if(typeof a!="function")throw new Rr(s);return function(){var c=arguments;switch(c.length){case 0:return!a.call(this);case 1:return!a.call(this,c[0]);case 2:return!a.call(this,c[0],c[1]);case 3:return!a.call(this,c[0],c[1],c[2])}return!a.apply(this,c)}}function G7(a){return pS(2,a)}var X7=DM(function(a,c){c=c.length==1&&Ye(c[0])?Mt(c[0],ir(De())):Mt(pn(c,1),ir(De()));var p=c.length;return et(function(w){for(var $=-1,T=_n(w.length,p);++$=c}),Xs=d_(function(){return arguments}())?d_:function(a){return Bt(a)&&yt.call(a,"callee")&&!qb.call(a,"callee")},Ye=q.isArray,u4=Ob?ir(Ob):yM;function Hn(a){return a!=null&&Df(a.length)&&!ti(a)}function Gt(a){return Bt(a)&&Hn(a)}function d4(a){return a===!0||a===!1||Bt(a)&&On(a)==xe}var Fi=C6||Mv,f4=Mb?ir(Mb):wM;function p4(a){return Bt(a)&&a.nodeType===1&&!Kc(a)}function h4(a){if(a==null)return!0;if(Hn(a)&&(Ye(a)||typeof a=="string"||typeof a.splice=="function"||Fi(a)||Ga(a)||Xs(a)))return!a.length;var c=Sn(a);if(c==ct||c==Z)return!a.size;if(Wc(a))return!qg(a).length;for(var p in a)if(yt.call(a,p))return!1;return!0}function m4(a,c){return Bc(a,c)}function g4(a,c,p){p=typeof p=="function"?p:n;var w=p?p(a,c):n;return w===n?Bc(a,c,n,p):!!w}function Sv(a){if(!Bt(a))return!1;var c=On(a);return c==Oe||c==Ae||typeof a.message=="string"&&typeof a.name=="string"&&!Kc(a)}function v4(a){return typeof a=="number"&&Jb(a)}function ti(a){if(!It(a))return!1;var c=On(a);return c==je||c==Ot||c==fe||c==I}function wS(a){return typeof a=="number"&&a==qe(a)}function Df(a){return typeof a=="number"&&a>-1&&a%1==0&&a<=K}function It(a){var c=typeof a;return a!=null&&(c=="object"||c=="function")}function Bt(a){return a!=null&&typeof a=="object"}var xS=Nb?ir(Nb):bM;function y4(a,c){return a===c||Zg(a,c,pv(c))}function w4(a,c,p){return p=typeof p=="function"?p:n,Zg(a,c,pv(c),p)}function x4(a){return bS(a)&&a!=+a}function b4(a){if(oN(a))throw new Ke(i);return f_(a)}function _4(a){return a===null}function S4(a){return a==null}function bS(a){return typeof a=="number"||Bt(a)&&On(a)==Yt}function Kc(a){if(!Bt(a)||On(a)!=gt)return!1;var c=lf(a);if(c===null)return!0;var p=yt.call(c,"constructor")&&c.constructor;return typeof p=="function"&&p instanceof p&&rf.call(p)==w6}var Ev=Db?ir(Db):_M;function E4(a){return wS(a)&&a>=-K&&a<=K}var _S=Ib?ir(Ib):SM;function If(a){return typeof a=="string"||!Ye(a)&&Bt(a)&&On(a)==we}function ar(a){return typeof a=="symbol"||Bt(a)&&On(a)==he}var Ga=Lb?ir(Lb):EM;function C4(a){return a===n}function $4(a){return Bt(a)&&Sn(a)==ke}function k4(a){return Bt(a)&&On(a)==ft}var R4=$f(Qg),T4=$f(function(a,c){return a<=c});function SS(a){if(!a)return[];if(Hn(a))return If(a)?Jr(a):Wn(a);if(Mc&&a[Mc])return a6(a[Mc]());var c=Sn(a),p=c==ct?jg:c==Z?ef:Xa;return p(a)}function ni(a){if(!a)return a===0?a:0;if(a=Mr(a),a===ie||a===-ie){var c=a<0?-1:1;return c*Q}return a===a?a:0}function qe(a){var c=ni(a),p=c%1;return c===c?p?c-p:c:0}function ES(a){return a?Hs(qe(a),0,le):0}function Mr(a){if(typeof a=="number")return a;if(ar(a))return W;if(It(a)){var c=typeof a.valueOf=="function"?a.valueOf():a;a=It(c)?c+"":c}if(typeof a!="string")return a===0?a:+a;a=Vb(a);var p=uO.test(a);return p||fO.test(a)?WO(a.slice(2),p?2:8):cO.test(a)?W:+a}function CS(a){return Eo(a,Kn(a))}function P4(a){return a?Hs(qe(a),-K,K):a===0?a:0}function vt(a){return a==null?"":sr(a)}var A4=Ha(function(a,c){if(Wc(c)||Hn(c)){Eo(c,ln(c),a);return}for(var p in c)yt.call(c,p)&&Fc(a,p,c[p])}),$S=Ha(function(a,c){Eo(c,Kn(c),a)}),Lf=Ha(function(a,c,p,w){Eo(c,Kn(c),a,w)}),O4=Ha(function(a,c,p,w){Eo(c,ln(c),a,w)}),M4=Jo(Hg);function N4(a,c){var p=Wa(a);return c==null?p:o_(p,c)}var D4=et(function(a,c){a=_t(a);var p=-1,w=c.length,$=w>2?c[2]:n;for($&&Mn(c[0],c[1],$)&&(w=1);++p1),T}),Eo(a,dv(a),p),w&&(p=Pr(p,m|g|y,KM));for(var $=c.length;$--;)rv(p,c[$]);return p});function J4(a,c){return RS(a,Nf(De(c)))}var e8=Jo(function(a,c){return a==null?{}:kM(a,c)});function RS(a,c){if(a==null)return{};var p=Mt(dv(a),function(w){return[w]});return c=De(c),w_(a,p,function(w,$){return c(w,$[0])})}function t8(a,c,p){c=Ii(c,a);var w=-1,$=c.length;for($||($=1,a=n);++w<$;){var T=a==null?n:a[Co(c[w])];T===n&&(w=$,T=p),a=ti(T)?T.call(a):T}return a}function n8(a,c,p){return a==null?a:Uc(a,c,p)}function r8(a,c,p,w){return w=typeof w=="function"?w:n,a==null?a:Uc(a,c,p,w)}var TS=B_(ln),PS=B_(Kn);function o8(a,c,p){var w=Ye(a),$=w||Fi(a)||Ga(a);if(c=De(c,4),p==null){var T=a&&a.constructor;$?p=w?new T:[]:It(a)?p=ti(T)?Wa(lf(a)):{}:p={}}return($?kr:So)(a,function(N,D,B){return c(p,N,D,B)}),p}function i8(a,c){return a==null?!0:rv(a,c)}function s8(a,c,p){return a==null?a:E_(a,c,sv(p))}function a8(a,c,p,w){return w=typeof w=="function"?w:n,a==null?a:E_(a,c,sv(p),w)}function Xa(a){return a==null?[]:Fg(a,ln(a))}function l8(a){return a==null?[]:Fg(a,Kn(a))}function c8(a,c,p){return p===n&&(p=c,c=n),p!==n&&(p=Mr(p),p=p===p?p:0),c!==n&&(c=Mr(c),c=c===c?c:0),Hs(Mr(a),c,p)}function u8(a,c,p){return c=ni(c),p===n?(p=c,c=0):p=ni(p),a=Mr(a),gM(a,c,p)}function d8(a,c,p){if(p&&typeof p!="boolean"&&Mn(a,c,p)&&(c=p=n),p===n&&(typeof c=="boolean"?(p=c,c=n):typeof a=="boolean"&&(p=a,a=n)),a===n&&c===n?(a=0,c=1):(a=ni(a),c===n?(c=a,a=0):c=ni(c)),a>c){var w=a;a=c,c=w}if(p||a%1||c%1){var $=e_();return _n(a+$*(c-a+VO("1e-"+(($+"").length-1))),c)}return ev(a,c)}var f8=Ka(function(a,c,p){return c=c.toLowerCase(),a+(p?AS(c):c)});function AS(a){return kv(vt(a).toLowerCase())}function OS(a){return a=vt(a),a&&a.replace(hO,n6).replace(MO,"")}function p8(a,c,p){a=vt(a),c=sr(c);var w=a.length;p=p===n?w:Hs(qe(p),0,w);var $=p;return p-=c.length,p>=0&&a.slice(p,$)==c}function h8(a){return a=vt(a),a&&xg.test(a)?a.replace(Rc,r6):a}function m8(a){return a=vt(a),a&&Ge.test(a)?a.replace(H,"\\$&"):a}var g8=Ka(function(a,c,p){return a+(p?"-":"")+c.toLowerCase()}),v8=Ka(function(a,c,p){return a+(p?" ":"")+c.toLowerCase()}),y8=D_("toLowerCase");function w8(a,c,p){a=vt(a),c=qe(c);var w=c?ja(a):0;if(!c||w>=c)return a;var $=(c-w)/2;return Cf(ff($),p)+a+Cf(df($),p)}function x8(a,c,p){a=vt(a),c=qe(c);var w=c?ja(a):0;return c&&w>>0,p?(a=vt(a),a&&(typeof c=="string"||c!=null&&!Ev(c))&&(c=sr(c),!c&&Fa(a))?Li(Jr(a),0,p):a.split(c,p)):[]}var k8=Ka(function(a,c,p){return a+(p?" ":"")+kv(c)});function R8(a,c,p){return a=vt(a),p=p==null?0:Hs(qe(p),0,a.length),c=sr(c),a.slice(p,p+c.length)==c}function T8(a,c,p){var w=R.templateSettings;p&&Mn(a,c,p)&&(c=n),a=vt(a),c=Lf({},c,w,U_);var $=Lf({},c.imports,w.imports,U_),T=ln($),N=Fg($,T),D,B,ne=0,re=c.interpolate||Xd,se="__p += '",me=zg((c.escape||Xd).source+"|"+re.source+"|"+(re===Ac?lO:Xd).source+"|"+(c.evaluate||Xd).source+"|$","g"),Re="//# sourceURL="+(yt.call(c,"sourceURL")?(c.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++FO+"]")+`
-`;a.replace(me,function(Le,nt,at,lr,Nn,cr){return at||(at=lr),se+=a.slice(ne,cr).replace(mO,o6),nt&&(D=!0,se+=`' +
-__e(`+nt+`) +
-'`),Nn&&(B=!0,se+=`';
-`+Nn+`;
-__p += '`),at&&(se+=`' +
-((__t = (`+at+`)) == null ? '' : __t) +
-'`),ne=cr+Le.length,Le}),se+=`';
-`;var Ie=yt.call(c,"variable")&&c.variable;if(!Ie)se=`with (obj) {
-`+se+`
-}
-`;else if(sO.test(Ie))throw new Ke(l);se=(B?se.replace(yg,""):se).replace(wg,"$1").replace(Kd,"$1;"),se="function("+(Ie||"obj")+`) {
-`+(Ie?"":`obj || (obj = {});
-`)+"var __t, __p = ''"+(D?", __e = _.escape":"")+(B?`, __j = Array.prototype.join;
-function print() { __p += __j.call(arguments, '') }
-`:`;
-`)+se+`return __p
-}`;var Qe=NS(function(){return ht(T,Re+"return "+se).apply(n,N)});if(Qe.source=se,Sv(Qe))throw Qe;return Qe}function P8(a){return vt(a).toLowerCase()}function A8(a){return vt(a).toUpperCase()}function O8(a,c,p){if(a=vt(a),a&&(p||c===n))return Vb(a);if(!a||!(c=sr(c)))return a;var w=Jr(a),$=Jr(c),T=Wb(w,$),N=Hb(w,$)+1;return Li(w,T,N).join("")}function M8(a,c,p){if(a=vt(a),a&&(p||c===n))return a.slice(0,Yb(a)+1);if(!a||!(c=sr(c)))return a;var w=Jr(a),$=Hb(w,Jr(c))+1;return Li(w,0,$).join("")}function N8(a,c,p){if(a=vt(a),a&&(p||c===n))return a.replace(st,"");if(!a||!(c=sr(c)))return a;var w=Jr(a),$=Wb(w,Jr(c));return Li(w,$).join("")}function D8(a,c){var p=V,w=J;if(It(c)){var $="separator"in c?c.separator:$;p="length"in c?qe(c.length):p,w="omission"in c?sr(c.omission):w}a=vt(a);var T=a.length;if(Fa(a)){var N=Jr(a);T=N.length}if(p>=T)return a;var D=p-ja(w);if(D<1)return w;var B=N?Li(N,0,D).join(""):a.slice(0,D);if($===n)return B+w;if(N&&(D+=B.length-D),Ev($)){if(a.slice(D).search($)){var ne,re=B;for($.global||($=zg($.source,vt(db.exec($))+"g")),$.lastIndex=0;ne=$.exec(re);)var se=ne.index;B=B.slice(0,se===n?D:se)}}else if(a.indexOf(sr($),D)!=D){var me=B.lastIndexOf($);me>-1&&(B=B.slice(0,me))}return B+w}function I8(a){return a=vt(a),a&&Tc.test(a)?a.replace(kc,d6):a}var L8=Ka(function(a,c,p){return a+(p?" ":"")+c.toUpperCase()}),kv=D_("toUpperCase");function MS(a,c,p){return a=vt(a),c=p?n:c,c===n?s6(a)?h6(a):qO(a):a.match(c)||[]}var NS=et(function(a,c){try{return or(a,n,c)}catch(p){return Sv(p)?p:new Ke(p)}}),F8=Jo(function(a,c){return kr(c,function(p){p=Co(p),qo(a,p,bv(a[p],a))}),a});function j8(a){var c=a==null?0:a.length,p=De();return a=c?Mt(a,function(w){if(typeof w[1]!="function")throw new Rr(s);return[p(w[0]),w[1]]}):[],et(function(w){for(var $=-1;++$K)return[];var p=le,w=_n(a,le);c=De(c),a-=le;for(var $=Lg(w,c);++p0||c<0)?new ot(p):(a<0?p=p.takeRight(-a):a&&(p=p.drop(a)),c!==n&&(c=qe(c),p=c<0?p.dropRight(-c):p.take(c-a)),p)},ot.prototype.takeRightWhile=function(a){return this.reverse().takeWhile(a).reverse()},ot.prototype.toArray=function(){return this.take(le)},So(ot.prototype,function(a,c){var p=/^(?:filter|find|map|reject)|While$/.test(c),w=/^(?:head|last)$/.test(c),$=R[w?"take"+(c=="last"?"Right":""):c],T=w||/^find/.test(c);$&&(R.prototype[c]=function(){var N=this.__wrapped__,D=w?[1]:arguments,B=N instanceof ot,ne=D[0],re=B||Ye(N),se=function(nt){var at=$.apply(R,Ai([nt],D));return w&&me?at[0]:at};re&&p&&typeof ne=="function"&&ne.length!=1&&(B=re=!1);var me=this.__chain__,Re=!!this.__actions__.length,Ie=T&&!me,Qe=B&&!Re;if(!T&&re){N=Qe?N:new ot(this);var Le=a.apply(N,D);return Le.__actions__.push({func:Pf,args:[se],thisArg:n}),new Tr(Le,me)}return Ie&&Qe?a.apply(this,D):(Le=this.thru(se),Ie?w?Le.value()[0]:Le.value():Le)})}),kr(["pop","push","shift","sort","splice","unshift"],function(a){var c=tf[a],p=/^(?:push|sort|unshift)$/.test(a)?"tap":"thru",w=/^(?:pop|shift)$/.test(a);R.prototype[a]=function(){var $=arguments;if(w&&!this.__chain__){var T=this.value();return c.apply(Ye(T)?T:[],$)}return this[p](function(N){return c.apply(Ye(N)?N:[],$)})}}),So(ot.prototype,function(a,c){var p=R[c];if(p){var w=p.name+"";yt.call(Va,w)||(Va[w]=[]),Va[w].push({name:c,func:p})}}),Va[Sf(n,S).name]=[{name:"wrapper",func:n}],ot.prototype.clone=I6,ot.prototype.reverse=L6,ot.prototype.value=F6,R.prototype.at=p7,R.prototype.chain=h7,R.prototype.commit=m7,R.prototype.next=g7,R.prototype.plant=y7,R.prototype.reverse=w7,R.prototype.toJSON=R.prototype.valueOf=R.prototype.value=x7,R.prototype.first=R.prototype.head,Mc&&(R.prototype[Mc]=v7),R},za=m6();Bs?((Bs.exports=za)._=za,Tg._=za):fn._=za}).call(Yc)})(Lh,Lh.exports);var wH=Lh.exports;const xH=lm(wH);function Vr({width:e,height:t}){return e/t}function Fh(e,t=0){const n=10**t;return Math.round((e+Number.EPSILON)*n)/n}function bH(e){return(t,n)=>e(n)-e(t)}class _H{constructor(t){this.comparator=t,this.heap=[],this.n=0}greater(t,n){return this.comparator(this.heap[t],this.heap[n])<0}swap(t,n){const r=this.heap[t];this.heap[t]=this.heap[n],this.heap[n]=r}swim(t){let n=t,r=Math.floor(n/2);for(;n>1&&this.greater(r,n);)this.swap(r,n),n=r,r=Math.floor(n/2)}sink(t){let n=t,r=n*2;for(;r<=this.n&&(rl.weight));for(s.push({id:t,weight:0});s.size()>0;){const{id:l,weight:u}=s.pop();if(!o.has(l)){const d=e(l);o.add(l),d.forEach((h,m)=>{const g=u+h,y=r.get(m),x=i.get(m);(x===void 0||x>g&&(x/g>1.005||y!==void 0&&yMath.min(Vr(i),o),Number.MAX_VALUE);return Fh(n/t/r)+2}function MP(e,t,n,r){const o=t-(e.length-1)*n-2*r*e.length,i=e.reduce((s,l)=>s+Vr(l),0);return o/i}function kH(e,t,n,r,o,i,s){const l=e.slice(t,n),u=MP(l,r,i,s);return u>0?(u-o)**2*l.length:void 0}function RH({photos:e,layoutOptions:t,targetRowHeight:n,limitNodeSearch:r,rowConstraints:o}){return i=>{var s,l;const{containerWidth:u,spacing:d,padding:h}=t,m=new Map;m.set(i,0);const g=(s=o==null?void 0:o.minPhotos)!=null?s:1,y=Math.min(r,(l=o==null?void 0:o.maxPhotos)!=null?l:1/0);for(let x=i+g;xy);x+=1){const _=kH(e,i,x,u,n,d,h);if(_===void 0)break;m.set(x,_)}return m}}function TH({photos:e,layoutOptions:t}){const{spacing:n,padding:r,containerWidth:o,targetRowHeight:i,rowConstraints:s}=t,l=$H({photos:e,containerWidth:o,targetRowHeight:i}),u=RH({photos:e,layoutOptions:t,targetRowHeight:i,limitNodeSearch:l,rowConstraints:s}),d=CH(u,0,e.length);if(d===void 0)return;const h=[];for(let m=1;m({photo:x,index:_})).slice(d[m-1],d[m]),y=MP(g.map(({photo:x})=>x),o,n,r);h.push(g.map(({photo:x,index:_},C)=>({photo:x,layout:{height:y,width:y*Vr(x),index:_,photoIndex:C,photosCount:g.length}})))}return h}function qm(...e){return[...e].filter(t=>!!t).join(" ")}function NP(e,{width:t,photosCount:n},{spacing:r,padding:o,containerWidth:i}){const s=r*(n-1)+2*o*n;return`calc((${e} - ${s}px) / ${Fh((i-s)/t,5)})`}function PH(e,t){return t.layout!=="rows"?`calc(100% - ${2*t.padding}px)`:NP("100%",e,t)}function i2(e,t,n){var r,o;return NP((o=(r=e.match(/calc\((.*)\)/))==null?void 0:r[1])!=null?o:e,t,n)}function AH(e,t,n){let r,o;const i=e.srcSet||e.images;return i&&i.length>0&&(r=i.concat(i.find(({width:s})=>s===e.width)?[]:[{src:e.src,width:e.width,height:e.height}]).sort((s,l)=>s.width-l.width).map(s=>`${s.src} ${s.width}w`).join(", ")),n.sizes?o=(n.sizes.sizes||[]).map(({viewport:s,size:l})=>`${s} ${i2(l,t,n)}`).concat(i2(n.sizes.size,t,n)).join(", "):r&&(o=`${Math.ceil(t.width/n.containerWidth*100)}vw`),{srcSet:r,sizes:o}}function Ox(e){var t,n;const{photo:r,layout:o,layoutOptions:i,imageProps:{style:s,className:l,...u}={},renderPhoto:d}=e,{onClick:h}=i,m={display:"block",boxSizing:"content-box",width:PH(o,i),height:"auto",aspectRatio:`${r.width} / ${r.height}`,...i.padding?{padding:`${i.padding}px`}:null,...(i.layout==="columns"||i.layout==="masonry")&&o.photoIndex{h({event:C,photo:r,index:o.index})}:void 0,y={src:r.src,alt:(t=r.alt)!=null?t:"",title:r.title,onClick:g,style:m,className:qm("react-photo-album--photo",l),loading:"lazy",decoding:"async",...AH(r,o,i),...u},x=C=>{const{src:S,alt:b,srcSet:E,sizes:k,style:P,...M}=y;return f.createElement("img",{alt:b,...E?{srcSet:E,sizes:k}:null,src:S,style:C!=null&&C.wrapped?{display:"block",width:"100%",height:"100%"}:P,...M})},_=(({display:C,boxSizing:S,width:b,aspectRatio:E,padding:k,marginBottom:P,cursor:M})=>({display:C,boxSizing:S,width:b,aspectRatio:E,padding:k,marginBottom:P,cursor:M}))(m);return f.createElement(f.Fragment,null,(n=d==null?void 0:d({photo:r,layout:o,layoutOptions:i,imageProps:y,renderDefaultPhoto:x,wrapperStyle:_}))!=null?n:x())}function OH({rowContainerProps:e,children:t}){return f.createElement("div",{...e},t)}function MH(e){const{layoutOptions:t,rowIndex:n,rowsCount:r,renderRowContainer:o,rowContainerProps:{style:i,className:s,...l}={},children:u}=e,d={className:qm("react-photo-album--row",s),style:{display:"flex",flexDirection:"row",flexWrap:"nowrap",alignItems:"flex-start",justifyContent:"space-between",...nf.createElement(MH,{key:`row-${d}`,layoutOptions:n,rowIndex:d,rowsCount:l.length,renderRowContainer:o,rowContainerProps:s},u.map(({photo:h,layout:m})=>f.createElement(Ox,{key:h.key||h.src,photo:h,layout:m,layoutOptions:n,renderPhoto:r,imageProps:i}))))):null}function DH(e,t,n,r){const o=new Map,i=new Set;i.add(n);for(let s=0;s{const d=s>0?o.get(u)[s].weight:0;e(u).forEach(({neighbor:h,weight:m})=>{let g=o.get(h);g||(g=[],o.set(h,g));const y=d+m,x=g[s+1];(!x||x.weight>y&&(x.weight/y>1.0001||u0;i-=1)o=e.get(o)[i].node,r.push(o);return r.reverse()}function LH(e,t,n,r){return IH(DH(e,t,n,r),t,r)}function FH({photos:e,spacing:t,padding:n,targetColumnWidth:r,targetColumnHeight:o}){return i=>{const s=[],l=o*1.5;let u=r/Vr(e[i])+2*n;for(let d=i+1;dl||d===e.length));d+=1)u+=r/Vr(e[d])+t+2*n;return s}}function s2({path:e,photos:t,containerWidth:n,columnsGaps:r,columnsRatios:o,spacing:i,padding:s}){const l=[],u=o.reduce((d,h)=>d+h,0);for(let d=0;d({photo:y,index:x})).slice(e[d],e[d+1]),m=o.reduce((y,x,_)=>y+(r[d]-r[_])*x,0),g=(n-(e.length-2)*i-2*(e.length-1)*s-m)*o[d]/u;l.push(h.map(({photo:y,index:x},_)=>({photo:y,layout:{width:g,height:g/Vr(y),index:x,photoIndex:_,photosCount:h.length}})))}return l}function jH({photos:e,layoutOptions:t,targetColumnWidth:n}){const{columns:r,spacing:o,padding:i,containerWidth:s}=t,l=[],u=[];if(e.length<=r){const y=e.length>0?e.reduce((_,C)=>_+Vr(C),0)/e.length:1;for(let _=0;_Math.min(C,e.length)),photos:e,columnsRatios:u,columnsGaps:l,containerWidth:s,spacing:o,padding:i});return{columnsGaps:l,columnsRatios:u,columnsModel:x}}const d=(e.reduce((y,x)=>y+n/Vr(x),0)+o*(e.length-r)+2*i*e.length)/r,h=FH({photos:e,targetColumnWidth:n,targetColumnHeight:d,spacing:o,padding:i}),m=LH(h,r,0,e.length);for(let y=0;y_+1/Vr(C),0)}const g=s2({path:m,photos:e,columnsRatios:u,columnsGaps:l,containerWidth:s,spacing:o,padding:i});return{columnsGaps:l,columnsRatios:u,columnsModel:g}}function DP(e){const{photos:t,layoutOptions:n}=e,{columns:r,spacing:o,padding:i,containerWidth:s}=n,l=(s-o*(r-1)-2*i*r)/r,{columnsGaps:u,columnsRatios:d,columnsModel:h}=jH({photos:t,layoutOptions:n,targetColumnWidth:l});return h.findIndex(m=>m.findIndex(({layout:{width:g,height:y}})=>g<0||y<0)>=0)>=0?r>1?DP({photos:t,layoutOptions:{...n,columns:r-1}}):void 0:{columnsModel:h,columnsGaps:u,columnsRatios:d}}function zH({photos:e,layoutOptions:t}){return DP({photos:e,layoutOptions:t})}function BH({columnContainerProps:e,children:t}){return f.createElement("div",{...e},t)}function UH(e){const{layoutOptions:t,columnIndex:n,columnsCount:r,columnsGaps:o,columnsRatios:i}=e,{layout:s,spacing:l,padding:u}=t;if(s==="masonry"||!o||!i)return`calc((100% - ${l*(r-1)}px) / ${r})`;const d=i.reduce((m,g)=>m+g,0),h=i.reduce((m,g,y)=>m+(o[n]-o[y])*g,0);return`calc((100% - ${Fh((r-1)*l+2*r*u+h,3)}px) * ${Fh(i[n]/d,5)} + ${2*u}px)`}function IP(e){const{layoutOptions:t,renderColumnContainer:n,children:r,columnContainerProps:{style:o,className:i,...s}={},...l}=e,u={className:qm("react-photo-album--column",i),style:{display:"flex",flexDirection:"column",flexWrap:"nowrap",alignItems:"flex-start",width:UH(e),justifyContent:t.layout==="columns"?"space-between":"flex-start",...o},...s};return f.createElement(f.Fragment,null,(n??BH)({layoutOptions:t,columnContainerProps:u,children:r,...l}))}function VH(e){const{photos:t,layoutOptions:n,renderPhoto:r,renderColumnContainer:o,componentsProps:{imageProps:i,columnContainerProps:s}}=e,l=zH({photos:t,layoutOptions:n});if(!l)return null;const{columnsModel:u,columnsRatios:d,columnsGaps:h}=l;return f.createElement(f.Fragment,null,u.map((m,g)=>f.createElement(IP,{key:`column-${g}`,layoutOptions:n,columnIndex:g,columnsCount:u.length,columnsGaps:h,columnsRatios:d,renderColumnContainer:o,columnContainerProps:s},m.map(({photo:y,layout:x})=>f.createElement(Ox,{key:y.key||y.src,photo:y,layout:x,layoutOptions:n,renderPhoto:r,imageProps:i})))))}function LP(e){const{photos:t,layoutOptions:n}=e,{columns:r,spacing:o,padding:i,containerWidth:s}=n,l=(s-o*(r-1)-2*i*r)/r;if(l<=0)return r>1?LP({...e,layoutOptions:{...n,columns:r-1}}):void 0;const u=[];for(let h=0;h{const y=u.reduce((x,_,C)=>_[])).map(h=>h.map(({photo:m,index:g},y)=>({photo:m,layout:{width:l,height:l/Vr(m),index:g,photoIndex:y,photosCount:h.length}})))}function WH(e){const{photos:t,layoutOptions:n,renderPhoto:r,renderColumnContainer:o,componentsProps:{imageProps:i,columnContainerProps:s}}=e,l=LP({photos:t,layoutOptions:n});return l?f.createElement(f.Fragment,null,l.map((u,d)=>f.createElement(IP,{key:`masonry-column-${d}`,layoutOptions:n,columnsCount:l.length,columnIndex:d,renderColumnContainer:o,columnContainerProps:s},u.map(({photo:h,layout:m})=>f.createElement(Ox,{key:h.key||h.src,photo:h,layout:m,layoutOptions:n,renderPhoto:r,imageProps:i}))))):null}function HH({containerProps:e,children:t,containerRef:n}){return f.createElement("div",{ref:n,...e},t)}function KH(e){const{layout:t,renderContainer:n,children:r,containerRef:o,containerProps:{style:i,className:s,...l}={}}=e,u={className:qm("react-photo-album",`react-photo-album--${t}`,s),style:{display:"flex",flexWrap:"nowrap",justifyContent:"space-between",flexDirection:t==="rows"?"column":"row",...i},...l};return f.createElement(f.Fragment,null,(n??HH)({containerProps:u,containerRef:o,layout:t,children:r}))}function YH(e){const t=f.useRef(e);return(!e||!t.current||e.join()!==t.current.join())&&(t.current=e),t.current}function GH(e,{newContainerWidth:t,newScrollbarWidth:n}){const{containerWidth:r,scrollbarWidth:o}=e;return r!==void 0&&o!==void 0&&t!==void 0&&n!==void 0&&t>r&&t-r<=20&&n0){const r=[...t.filter(i=>i>0)].sort((i,s)=>s-i);r.push(Math.floor(r[r.length-1]/2));const o=n;n=r.find((i,s)=>i<=o||s===r.length-1)}return n}function ZH(e,t){const[{containerWidth:n},r]=f.useReducer(GH,{containerWidth:t}),o=f.useRef(null),i=f.useRef();return{containerRef:f.useCallback(l=>{var u;(u=i.current)==null||u.disconnect(),i.current=void 0,o.current=l;const d=()=>r({newContainerWidth:XH(o.current,e),newScrollbarWidth:window.innerWidth-document.documentElement.clientWidth});d(),l&&typeof ResizeObserver<"u"&&(i.current=new ResizeObserver(d),i.current.observe(l))},[e]),containerWidth:n}}const qH=Object.freeze([1200,600,300,0]);function Mx(e,t){return typeof e=="function"?e(t):e}function FP(e,t){return typeof e<"u"?Mx(e,t):void 0}function QH(e,t){const n=qH.findIndex(r=>r<=t);return Mx(e[n>=0?n:0],t)}function fp(e,t,n,r=0){const o=FP(e,t);return Math.round(Math.max(o===void 0?QH(n,t):o,r))}function JH({layout:e,onClick:t,containerWidth:n,targetRowHeight:r,rowConstraints:o,columns:i,spacing:s,padding:l,sizes:u}){return{layout:e,onClick:t,containerWidth:n,columns:fp(i,n,[5,4,3,2],1),spacing:fp(s,n,[20,15,10,5]),padding:fp(l,n,[0,0,0,0,0]),targetRowHeight:fp(r,n,[d=>d/5,d=>d/4,d=>d/3,d=>d/2]),rowConstraints:FP(o,n),sizes:u}}function eK(e,t,n){const{photos:r,componentsProps:o}=e,i=Mx(o,t)||{};if(n){const{layout:s,spacing:l,padding:u,rowConstraints:d}=n;if(s==="rows"){const{singleRowMaxHeight:h}=d||{};if(h){const m=Math.floor(r.reduce((g,{width:y,height:x})=>g+y/x*h-2*u,u*r.length*2+l*(r.length-1)));m>0&&(i.containerProps=i.containerProps||{},i.containerProps.style={maxWidth:m,...i.containerProps.style})}}}return i}function tK(e,t,n){const{photos:r,layout:o,renderPhoto:i,renderRowContainer:s,renderColumnContainer:l}=e,u={photos:r,renderPhoto:i,componentsProps:t};return o==="rows"?f.createElement(NH,{layoutOptions:n,renderRowContainer:s,...u}):o==="columns"?f.createElement(VH,{layoutOptions:n,renderColumnContainer:l,...u}):f.createElement(WH,{layoutOptions:n,renderColumnContainer:l,...u})}function nK(e){const{photos:t,layout:n,renderContainer:r,defaultContainerWidth:o,breakpoints:i}=e,{containerRef:s,containerWidth:l}=ZH(YH(i),o);if(!n||!["rows","columns","masonry"].includes(n)||!Array.isArray(t))return null;const u=l?JH({containerWidth:l,...e}):void 0,d=eK(e,l,u);return f.createElement(KH,{layout:n,containerRef:s,renderContainer:r,containerProps:d.containerProps},u&&tK(e,d,u))}function rK({title:e,titleId:t,...n},r){return f.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true",ref:r,"aria-labelledby":t},n),e?f.createElement("title",{id:t},e):null,f.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 4.5h14.25M3 9h9.75M3 13.5h9.75m4.5-4.5v12m0 0l-3.75-3.75M17.25 21L21 17.25"}))}const oK=f.forwardRef(rK),iK=oK;function sK({title:e,titleId:t,...n},r){return f.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true",ref:r,"aria-labelledby":t},n),e?f.createElement("title",{id:t},e):null,f.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 4.5h14.25M3 9h9.75M3 13.5h5.25m5.25-.75L17.25 9m0 0L21 12.75M17.25 9v12"}))}const aK=f.forwardRef(sK),lK=aK;function cK({title:e,titleId:t,...n},r){return f.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true",ref:r,"aria-labelledby":t},n),e?f.createElement("title",{id:t},e):null,f.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.042 21.672L13.684 16.6m0 0l-2.51 2.225.569-9.47 5.227 7.917-3.286-.672zM12 2.25V4.5m5.834.166l-1.591 1.591M20.25 10.5H18M7.757 14.743l-1.59 1.59M6 10.5H3.75m4.007-4.243l-1.59-1.59"}))}const uK=f.forwardRef(cK),dK=uK;function bi(e){return Array.isArray?Array.isArray(e):BP(e)==="[object Array]"}const fK=1/0;function pK(e){if(typeof e=="string")return e;let t=e+"";return t=="0"&&1/e==-fK?"-0":t}function hK(e){return e==null?"":pK(e)}function Lo(e){return typeof e=="string"}function jP(e){return typeof e=="number"}function mK(e){return e===!0||e===!1||gK(e)&&BP(e)=="[object Boolean]"}function zP(e){return typeof e=="object"}function gK(e){return zP(e)&&e!==null}function hr(e){return e!=null}function k0(e){return!e.trim().length}function BP(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const vK="Incorrect 'index' type",yK=e=>`Invalid value for key ${e}`,wK=e=>`Pattern length exceeds max of ${e}.`,xK=e=>`Missing ${e} property in key`,bK=e=>`Property 'weight' in key '${e}' must be a positive integer`,a2=Object.prototype.hasOwnProperty;class _K{constructor(t){this._keys=[],this._keyMap={};let n=0;t.forEach(r=>{let o=UP(r);this._keys.push(o),this._keyMap[o.id]=o,n+=o.weight}),this._keys.forEach(r=>{r.weight/=n})}get(t){return this._keyMap[t]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function UP(e){let t=null,n=null,r=null,o=1,i=null;if(Lo(e)||bi(e))r=e,t=l2(e),n=h1(e);else{if(!a2.call(e,"name"))throw new Error(xK("name"));const s=e.name;if(r=s,a2.call(e,"weight")&&(o=e.weight,o<=0))throw new Error(bK(s));t=l2(s),n=h1(s),i=e.getFn}return{path:t,id:n,weight:o,src:r,getFn:i}}function l2(e){return bi(e)?e:e.split(".")}function h1(e){return bi(e)?e.join("."):e}function SK(e,t){let n=[],r=!1;const o=(i,s,l)=>{if(hr(i))if(!s[l])n.push(i);else{let u=s[l];const d=i[u];if(!hr(d))return;if(l===s.length-1&&(Lo(d)||jP(d)||mK(d)))n.push(hK(d));else if(bi(d)){r=!0;for(let h=0,m=d.length;he.score===t.score?e.idx{this._keysMap[n.id]=r})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,Lo(this.docs[0])?this.docs.forEach((t,n)=>{this._addString(t,n)}):this.docs.forEach((t,n)=>{this._addObject(t,n)}),this.norm.clear())}add(t){const n=this.size();Lo(t)?this._addString(t,n):this._addObject(t,n)}removeAt(t){this.records.splice(t,1);for(let n=t,r=this.size();n{let s=o.getFn?o.getFn(t):this.getFn(t,o.path);if(hr(s)){if(bi(s)){let l=[];const u=[{nestedArrIndex:-1,value:s}];for(;u.length;){const{nestedArrIndex:d,value:h}=u.pop();if(hr(h))if(Lo(h)&&!k0(h)){let m={v:h,i:d,n:this.norm.get(h)};l.push(m)}else bi(h)&&h.forEach((m,g)=>{u.push({nestedArrIndex:g,value:m})})}r.$[i]=l}else if(Lo(s)&&!k0(s)){let l={v:s,n:this.norm.get(s)};r.$[i]=l}}}),this.records.push(r)}toJSON(){return{keys:this.keys,records:this.records}}}function VP(e,t,{getFn:n=He.getFn,fieldNormWeight:r=He.fieldNormWeight}={}){const o=new Nx({getFn:n,fieldNormWeight:r});return o.setKeys(e.map(UP)),o.setSources(t),o.create(),o}function PK(e,{getFn:t=He.getFn,fieldNormWeight:n=He.fieldNormWeight}={}){const{keys:r,records:o}=e,i=new Nx({getFn:t,fieldNormWeight:n});return i.setKeys(r),i.setIndexRecords(o),i}function pp(e,{errors:t=0,currentLocation:n=0,expectedLocation:r=0,distance:o=He.distance,ignoreLocation:i=He.ignoreLocation}={}){const s=t/e.length;if(i)return s;const l=Math.abs(r-n);return o?s+l/o:l?1:s}function AK(e=[],t=He.minMatchCharLength){let n=[],r=-1,o=-1,i=0;for(let s=e.length;i=t&&n.push([r,o]),r=-1)}return e[i-1]&&i-r>=t&&n.push([r,i-1]),n}const ea=32;function OK(e,t,n,{location:r=He.location,distance:o=He.distance,threshold:i=He.threshold,findAllMatches:s=He.findAllMatches,minMatchCharLength:l=He.minMatchCharLength,includeMatches:u=He.includeMatches,ignoreLocation:d=He.ignoreLocation}={}){if(t.length>ea)throw new Error(wK(ea));const h=t.length,m=e.length,g=Math.max(0,Math.min(r,m));let y=i,x=g;const _=l>1||u,C=_?Array(m):[];let S;for(;(S=e.indexOf(t,x))>-1;){let A=pp(t,{currentLocation:S,expectedLocation:g,distance:o,ignoreLocation:d});if(y=Math.min(A,y),x=S+h,_){let O=0;for(;O=V;U-=1){let te=U-1,L=n[e.charAt(te)];if(_&&(C[te]=+!!L),G[U]=(G[U+1]<<1|1)&L,A&&(G[U]|=(b[U+1]|b[U])<<1|1|b[U+1]),G[U]&P&&(E=pp(t,{errors:A,currentLocation:te,expectedLocation:g,distance:o,ignoreLocation:d}),E<=y)){if(y=E,x=te,x<=g)break;V=Math.max(1,2*g-x)}}if(pp(t,{errors:A+1,currentLocation:g,expectedLocation:g,distance:o,ignoreLocation:d})>y)break;b=G}const M={isMatch:x>=0,score:Math.max(.001,E)};if(_){const A=AK(C,l);A.length?u&&(M.indices=A):M.isMatch=!1}return M}function MK(e){let t={};for(let n=0,r=e.length;n{this.chunks.push({pattern:g,alphabet:MK(g),startIndex:y})},m=this.pattern.length;if(m>ea){let g=0;const y=m%ea,x=m-y;for(;g{const{isMatch:S,score:b,indices:E}=OK(t,x,_,{location:o+C,distance:i,threshold:s,findAllMatches:l,minMatchCharLength:u,includeMatches:r,ignoreLocation:d});S&&(g=!0),m+=b,S&&E&&(h=[...h,...E])});let y={isMatch:g,score:g?m/this.chunks.length:1};return g&&r&&(y.indices=h),y}}class Ds{constructor(t){this.pattern=t}static isMultiMatch(t){return c2(t,this.multiRegex)}static isSingleMatch(t){return c2(t,this.singleRegex)}search(){}}function c2(e,t){const n=e.match(t);return n?n[1]:null}class NK extends Ds{constructor(t){super(t)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(t){const n=t===this.pattern;return{isMatch:n,score:n?0:1,indices:[0,this.pattern.length-1]}}}class DK extends Ds{constructor(t){super(t)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(t){const r=t.indexOf(this.pattern)===-1;return{isMatch:r,score:r?0:1,indices:[0,t.length-1]}}}class IK extends Ds{constructor(t){super(t)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(t){const n=t.startsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[0,this.pattern.length-1]}}}class LK extends Ds{constructor(t){super(t)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(t){const n=!t.startsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[0,t.length-1]}}}class FK extends Ds{constructor(t){super(t)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(t){const n=t.endsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[t.length-this.pattern.length,t.length-1]}}}class jK extends Ds{constructor(t){super(t)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(t){const n=!t.endsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[0,t.length-1]}}}class HP extends Ds{constructor(t,{location:n=He.location,threshold:r=He.threshold,distance:o=He.distance,includeMatches:i=He.includeMatches,findAllMatches:s=He.findAllMatches,minMatchCharLength:l=He.minMatchCharLength,isCaseSensitive:u=He.isCaseSensitive,ignoreLocation:d=He.ignoreLocation}={}){super(t),this._bitapSearch=new WP(t,{location:n,threshold:r,distance:o,includeMatches:i,findAllMatches:s,minMatchCharLength:l,isCaseSensitive:u,ignoreLocation:d})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}}class KP extends Ds{constructor(t){super(t)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(t){let n=0,r;const o=[],i=this.pattern.length;for(;(r=t.indexOf(this.pattern,n))>-1;)n=r+i,o.push([r,n-1]);const s=!!o.length;return{isMatch:s,score:s?0:1,indices:o}}}const m1=[NK,KP,IK,LK,jK,FK,DK,HP],u2=m1.length,zK=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,BK="|";function UK(e,t={}){return e.split(BK).map(n=>{let r=n.trim().split(zK).filter(i=>i&&!!i.trim()),o=[];for(let i=0,s=r.length;i!!(e[jh.AND]||e[jh.OR]),KK=e=>!!e[y1.PATH],YK=e=>!bi(e)&&zP(e)&&!w1(e),d2=e=>({[jh.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function YP(e,t,{auto:n=!0}={}){const r=o=>{let i=Object.keys(o);const s=KK(o);if(!s&&i.length>1&&!w1(o))return r(d2(o));if(YK(o)){const u=s?o[y1.PATH]:i[0],d=s?o[y1.PATTERN]:o[u];if(!Lo(d))throw new Error(yK(u));const h={keyId:h1(u),pattern:d};return n&&(h.searcher=v1(d,t)),h}let l={children:[],operator:i[0]};return i.forEach(u=>{const d=o[u];bi(d)&&d.forEach(h=>{l.children.push(r(h))})}),l};return w1(e)||(e=d2(e)),r(e)}function GK(e,{ignoreFieldNorm:t=He.ignoreFieldNorm}){e.forEach(n=>{let r=1;n.matches.forEach(({key:o,norm:i,score:s})=>{const l=o?o.weight:null;r*=Math.pow(s===0&&l?Number.EPSILON:s,(l||1)*(t?1:i))}),n.score=r})}function XK(e,t){const n=e.matches;t.matches=[],hr(n)&&n.forEach(r=>{if(!hr(r.indices)||!r.indices.length)return;const{indices:o,value:i}=r;let s={indices:o,value:i};r.key&&(s.key=r.key.src),r.idx>-1&&(s.refIndex=r.idx),t.matches.push(s)})}function ZK(e,t){t.score=e.score}function qK(e,t,{includeMatches:n=He.includeMatches,includeScore:r=He.includeScore}={}){const o=[];return n&&o.push(XK),r&&o.push(ZK),e.map(i=>{const{idx:s}=i,l={item:t[s],refIndex:s};return o.length&&o.forEach(u=>{u(i,l)}),l})}class _c{constructor(t,n={},r){this.options={...He,...n},this.options.useExtendedSearch,this._keyStore=new _K(this.options.keys),this.setCollection(t,r)}setCollection(t,n){if(this._docs=t,n&&!(n instanceof Nx))throw new Error(vK);this._myIndex=n||VP(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(t){hr(t)&&(this._docs.push(t),this._myIndex.add(t))}remove(t=()=>!1){const n=[];for(let r=0,o=this._docs.length;r-1&&(u=u.slice(0,n)),qK(u,this._docs,{includeMatches:r,includeScore:o})}_searchStringList(t){const n=v1(t,this.options),{records:r}=this._myIndex,o=[];return r.forEach(({v:i,i:s,n:l})=>{if(!hr(i))return;const{isMatch:u,score:d,indices:h}=n.searchIn(i);u&&o.push({item:i,idx:s,matches:[{score:d,value:i,norm:l,indices:h}]})}),o}_searchLogical(t){const n=YP(t,this.options),r=(l,u,d)=>{if(!l.children){const{keyId:m,searcher:g}=l,y=this._findMatches({key:this._keyStore.get(m),value:this._myIndex.getValueForItemAtKeyId(u,m),searcher:g});return y&&y.length?[{idx:d,item:u,matches:y}]:[]}const h=[];for(let m=0,g=l.children.length;m{if(hr(l)){let d=r(n,l,u);d.length&&(i[u]||(i[u]={idx:u,item:l,matches:[]},s.push(i[u])),d.forEach(({matches:h})=>{i[u].matches.push(...h)}))}}),s}_searchObjectList(t){const n=v1(t,this.options),{keys:r,records:o}=this._myIndex,i=[];return o.forEach(({$:s,i:l})=>{if(!hr(s))return;let u=[];r.forEach((d,h)=>{u.push(...this._findMatches({key:d,value:s[h],searcher:n}))}),u.length&&i.push({idx:l,item:s,matches:u})}),i}_findMatches({key:t,value:n,searcher:r}){if(!hr(n))return[];let o=[];if(bi(n))n.forEach(({v:i,i:s,n:l})=>{if(!hr(i))return;const{isMatch:u,score:d,indices:h}=r.searchIn(i);u&&o.push({score:d,key:t,value:i,idx:s,norm:l,indices:h})});else{const{v:i,n:s}=n,{isMatch:l,score:u,indices:d}=r.searchIn(i);l&&o.push({score:u,key:t,value:i,norm:s,indices:d})}return o}}_c.version="7.0.0";_c.createIndex=VP;_c.parseIndex=PK;_c.config=He;_c.parseQuery=YP;HK(WK);function zd(e){const t=e+"CollectionProvider",[n,r]=An(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=y=>{const{scope:x,children:_}=y,C=Fe.useRef(null),S=Fe.useRef(new Map).current;return Fe.createElement(o,{scope:x,itemMap:S,collectionRef:C},_)},l=e+"CollectionSlot",u=Fe.forwardRef((y,x)=>{const{scope:_,children:C}=y,S=i(l,_),b=Be(x,S.collectionRef);return Fe.createElement(Wo,{ref:b},C)}),d=e+"CollectionItemSlot",h="data-radix-collection-item",m=Fe.forwardRef((y,x)=>{const{scope:_,children:C,...S}=y,b=Fe.useRef(null),E=Be(x,b),k=i(d,_);return Fe.useEffect(()=>(k.itemMap.set(b,{ref:b,...S}),()=>void k.itemMap.delete(b))),Fe.createElement(Wo,{[h]:"",ref:E},C)});function g(y){const x=i(e+"CollectionConsumer",y);return Fe.useCallback(()=>{const C=x.collectionRef.current;if(!C)return[];const S=Array.from(C.querySelectorAll(`[${h}]`));return Array.from(x.itemMap.values()).sort((k,P)=>S.indexOf(k.ref.current)-S.indexOf(P.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:s,Slot:u,ItemSlot:m},g,r]}const QK=f.createContext(void 0);function Sc(e){const t=f.useContext(QK);return e||t||"ltr"}const R0="rovingFocusGroup.onEntryFocus",JK={bubbles:!1,cancelable:!0},Dx="RovingFocusGroup",[x1,GP,eY]=zd(Dx),[tY,Qm]=An(Dx,[eY]),[nY,rY]=tY(Dx),oY=f.forwardRef((e,t)=>f.createElement(x1.Provider,{scope:e.__scopeRovingFocusGroup},f.createElement(x1.Slot,{scope:e.__scopeRovingFocusGroup},f.createElement(iY,Y({},e,{ref:t}))))),iY=f.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:u,onEntryFocus:d,...h}=e,m=f.useRef(null),g=Be(t,m),y=Sc(i),[x=null,_]=Zr({prop:s,defaultProp:l,onChange:u}),[C,S]=f.useState(!1),b=Ft(d),E=GP(n),k=f.useRef(!1),[P,M]=f.useState(0);return f.useEffect(()=>{const A=m.current;if(A)return A.addEventListener(R0,b),()=>A.removeEventListener(R0,b)},[b]),f.createElement(nY,{scope:n,orientation:r,dir:y,loop:o,currentTabStopId:x,onItemFocus:f.useCallback(A=>_(A),[_]),onItemShiftTab:f.useCallback(()=>S(!0),[]),onFocusableItemAdd:f.useCallback(()=>M(A=>A+1),[]),onFocusableItemRemove:f.useCallback(()=>M(A=>A-1),[])},f.createElement(Pe.div,Y({tabIndex:C||P===0?-1:0,"data-orientation":r},h,{ref:g,style:{outline:"none",...e.style},onMouseDown:ue(e.onMouseDown,()=>{k.current=!0}),onFocus:ue(e.onFocus,A=>{const O=!k.current;if(A.target===A.currentTarget&&O&&!C){const F=new CustomEvent(R0,JK);if(A.currentTarget.dispatchEvent(F),!F.defaultPrevented){const V=E().filter(te=>te.focusable),J=V.find(te=>te.active),G=V.find(te=>te.id===x),U=[J,G,...V].filter(Boolean).map(te=>te.ref.current);XP(U)}}k.current=!1}),onBlur:ue(e.onBlur,()=>S(!1))})))}),sY="RovingFocusGroupItem",aY=f.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,...s}=e,l=nr(),u=i||l,d=rY(sY,n),h=d.currentTabStopId===u,m=GP(n),{onFocusableItemAdd:g,onFocusableItemRemove:y}=d;return f.useEffect(()=>{if(r)return g(),()=>y()},[r,g,y]),f.createElement(x1.ItemSlot,{scope:n,id:u,focusable:r,active:o},f.createElement(Pe.span,Y({tabIndex:h?0:-1,"data-orientation":d.orientation},s,{ref:t,onMouseDown:ue(e.onMouseDown,x=>{r?d.onItemFocus(u):x.preventDefault()}),onFocus:ue(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:ue(e.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){d.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const _=uY(x,d.orientation,d.dir);if(_!==void 0){x.preventDefault();let S=m().filter(b=>b.focusable).map(b=>b.ref.current);if(_==="last")S.reverse();else if(_==="prev"||_==="next"){_==="prev"&&S.reverse();const b=S.indexOf(x.currentTarget);S=d.loop?dY(S,b+1):S.slice(b+1)}setTimeout(()=>XP(S))}})})))}),lY={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function cY(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function uY(e,t,n){const r=cY(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return lY[r]}function XP(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function dY(e,t){return e.map((n,r)=>e[(t+r)%e.length])}const ZP=oY,qP=aY,QP="Tabs",[fY,xte]=An(QP,[Qm]),JP=Qm(),[pY,Ix]=fY(QP),hY=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:l,activationMode:u="automatic",...d}=e,h=Sc(l),[m,g]=Zr({prop:r,onChange:o,defaultProp:i});return f.createElement(pY,{scope:n,baseId:nr(),value:m,onValueChange:g,orientation:s,dir:h,activationMode:u},f.createElement(Pe.div,Y({dir:h,"data-orientation":s},d,{ref:t})))}),mY="TabsList",gY=f.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=Ix(mY,n),s=JP(n);return f.createElement(ZP,Y({asChild:!0},s,{orientation:i.orientation,dir:i.dir,loop:r}),f.createElement(Pe.div,Y({role:"tablist","aria-orientation":i.orientation},o,{ref:t})))}),vY="TabsTrigger",yY=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=Ix(vY,n),l=JP(n),u=e5(s.baseId,r),d=t5(s.baseId,r),h=r===s.value;return f.createElement(qP,Y({asChild:!0},l,{focusable:!o,active:h}),f.createElement(Pe.button,Y({type:"button",role:"tab","aria-selected":h,"aria-controls":d,"data-state":h?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:u},i,{ref:t,onMouseDown:ue(e.onMouseDown,m=>{!o&&m.button===0&&m.ctrlKey===!1?s.onValueChange(r):m.preventDefault()}),onKeyDown:ue(e.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&s.onValueChange(r)}),onFocus:ue(e.onFocus,()=>{const m=s.activationMode!=="manual";!h&&!o&&m&&s.onValueChange(r)})})))}),wY="TabsContent",xY=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,l=Ix(wY,n),u=e5(l.baseId,r),d=t5(l.baseId,r),h=r===l.value,m=f.useRef(h);return f.useEffect(()=>{const g=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(g)},[]),f.createElement(xn,{present:o||h},({present:g})=>f.createElement(Pe.div,Y({"data-state":h?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":u,hidden:!g,id:d,tabIndex:0},s,{ref:t,style:{...e.style,animationDuration:m.current?"0s":void 0}}),g&&i))});function e5(e,t){return`${e}-trigger-${t}`}function t5(e,t){return`${e}-content-${t}`}const bY=hY,n5=gY,r5=yY,o5=xY,i5=bY,Lx=f.forwardRef(({className:e,...t},n)=>v.jsx(n5,{ref:n,className:Ce("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),tabIndex:-1,...t}));Lx.displayName=n5.displayName;const sa=f.forwardRef(({className:e,...t},n)=>v.jsx(r5,{ref:n,className:Ce("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 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",e),tabIndex:-1,...t}));sa.displayName=r5.displayName;const mu=f.forwardRef(({className:e,...t},n)=>v.jsx(o5,{ref:n,className:Ce("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),tabIndex:-1,...t}));mu.displayName=o5.displayName;function id(e,[t,n]){return Math.min(n,Math.max(t,e))}function Fx(e){const t=f.useRef({value:e,previous:e});return f.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}const _Y=[" ","Enter","ArrowUp","ArrowDown"],SY=[" ","Enter"],Jm="Select",[eg,tg,EY]=zd(Jm),[Ec,bte]=An(Jm,[EY,Ns]),jx=Ns(),[CY,Oa]=Ec(Jm),[$Y,kY]=Ec(Jm),RY=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:i,value:s,defaultValue:l,onValueChange:u,dir:d,name:h,autoComplete:m,disabled:g,required:y}=e,x=jx(t),[_,C]=f.useState(null),[S,b]=f.useState(null),[E,k]=f.useState(!1),P=Sc(d),[M=!1,A]=Zr({prop:r,defaultProp:o,onChange:i}),[O,F]=Zr({prop:s,defaultProp:l,onChange:u}),V=f.useRef(null),J=_?!!_.closest("form"):!0,[G,ae]=f.useState(new Set),U=Array.from(G).map(te=>te.props.value).join(";");return f.createElement(Od,x,f.createElement(CY,{required:y,scope:t,trigger:_,onTriggerChange:C,valueNode:S,onValueNodeChange:b,valueNodeHasChildren:E,onValueNodeHasChildrenChange:k,contentId:nr(),value:O,onValueChange:F,open:M,onOpenChange:A,dir:P,triggerPointerDownPosRef:V,disabled:g},f.createElement(eg.Provider,{scope:t},f.createElement($Y,{scope:e.__scopeSelect,onNativeOptionAdd:f.useCallback(te=>{ae(L=>new Set(L).add(te))},[]),onNativeOptionRemove:f.useCallback(te=>{ae(L=>{const ie=new Set(L);return ie.delete(te),ie})},[])},n)),J?f.createElement(u5,{key:U,"aria-hidden":!0,required:y,tabIndex:-1,name:h,autoComplete:m,value:O,onChange:te=>F(te.target.value),disabled:g},O===void 0?f.createElement("option",{value:""}):null,Array.from(G)):null))},TY="SelectTrigger",PY=f.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,i=jx(n),s=Oa(TY,n),l=s.disabled||r,u=Be(t,s.onTriggerChange),d=tg(n),[h,m,g]=d5(x=>{const _=d().filter(b=>!b.disabled),C=_.find(b=>b.value===s.value),S=f5(_,x,C);S!==void 0&&s.onValueChange(S.value)}),y=()=>{l||(s.onOpenChange(!0),g())};return f.createElement(zm,Y({asChild:!0},i),f.createElement(Pe.button,Y({type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":c5(s.value)?"":void 0},o,{ref:u,onClick:ue(o.onClick,x=>{x.currentTarget.focus()}),onPointerDown:ue(o.onPointerDown,x=>{const _=x.target;_.hasPointerCapture(x.pointerId)&&_.releasePointerCapture(x.pointerId),x.button===0&&x.ctrlKey===!1&&(y(),s.triggerPointerDownPosRef.current={x:Math.round(x.pageX),y:Math.round(x.pageY)},x.preventDefault())}),onKeyDown:ue(o.onKeyDown,x=>{const _=h.current!=="";!(x.ctrlKey||x.altKey||x.metaKey)&&x.key.length===1&&m(x.key),!(_&&x.key===" ")&&_Y.includes(x.key)&&(y(),x.preventDefault())})})))}),AY="SelectValue",OY=f.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:i,placeholder:s="",...l}=e,u=Oa(AY,n),{onValueNodeHasChildrenChange:d}=u,h=i!==void 0,m=Be(t,u.onValueNodeChange);return Pn(()=>{d(h)},[d,h]),f.createElement(Pe.span,Y({},l,{ref:m,style:{pointerEvents:"none"}}),c5(u.value)?f.createElement(f.Fragment,null,s):i)}),MY=f.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return f.createElement(Pe.span,Y({"aria-hidden":!0},o,{ref:t}),r||"▼")}),NY=e=>f.createElement(Md,Y({asChild:!0},e)),ic="SelectContent",DY=f.forwardRef((e,t)=>{const n=Oa(ic,e.__scopeSelect),[r,o]=f.useState();if(Pn(()=>{o(new DocumentFragment)},[]),!n.open){const i=r;return i?Os.createPortal(f.createElement(s5,{scope:e.__scopeSelect},f.createElement(eg.Slot,{scope:e.__scopeSelect},f.createElement("div",null,e.children))),i):null}return f.createElement(IY,Y({},e,{ref:t}))}),ai=10,[s5,Ma]=Ec(ic),IY=f.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:i,onPointerDownOutside:s,side:l,sideOffset:u,align:d,alignOffset:h,arrowPadding:m,collisionBoundary:g,collisionPadding:y,sticky:x,hideWhenDetached:_,avoidCollisions:C,...S}=e,b=Oa(ic,n),[E,k]=f.useState(null),[P,M]=f.useState(null),A=Be(t,fe=>k(fe)),[O,F]=f.useState(null),[V,J]=f.useState(null),G=tg(n),[ae,U]=f.useState(!1),te=f.useRef(!1);f.useEffect(()=>{if(E)return Xm(E)},[E]),Km();const L=f.useCallback(fe=>{const[xe,...$e]=G().map(je=>je.ref.current),[Ae]=$e.slice(-1),Oe=document.activeElement;for(const je of fe)if(je===Oe||(je==null||je.scrollIntoView({block:"nearest"}),je===xe&&P&&(P.scrollTop=0),je===Ae&&P&&(P.scrollTop=P.scrollHeight),je==null||je.focus(),document.activeElement!==Oe))return},[G,P]),ie=f.useCallback(()=>L([O,E]),[L,O,E]);f.useEffect(()=>{ae&&ie()},[ae,ie]);const{onOpenChange:K,triggerPointerDownPosRef:Q}=b;f.useEffect(()=>{if(E){let fe={x:0,y:0};const xe=Ae=>{var Oe,je,Ot,ct;fe={x:Math.abs(Math.round(Ae.pageX)-((Oe=(je=Q.current)===null||je===void 0?void 0:je.x)!==null&&Oe!==void 0?Oe:0)),y:Math.abs(Math.round(Ae.pageY)-((Ot=(ct=Q.current)===null||ct===void 0?void 0:ct.y)!==null&&Ot!==void 0?Ot:0))}},$e=Ae=>{fe.x<=10&&fe.y<=10?Ae.preventDefault():E.contains(Ae.target)||K(!1),document.removeEventListener("pointermove",xe),Q.current=null};return Q.current!==null&&(document.addEventListener("pointermove",xe),document.addEventListener("pointerup",$e,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",xe),document.removeEventListener("pointerup",$e,{capture:!0})}}},[E,K,Q]),f.useEffect(()=>{const fe=()=>K(!1);return window.addEventListener("blur",fe),window.addEventListener("resize",fe),()=>{window.removeEventListener("blur",fe),window.removeEventListener("resize",fe)}},[K]);const[W,le]=d5(fe=>{const xe=G().filter(Oe=>!Oe.disabled),$e=xe.find(Oe=>Oe.ref.current===document.activeElement),Ae=f5(xe,fe,$e);Ae&&setTimeout(()=>Ae.ref.current.focus())}),ge=f.useCallback((fe,xe,$e)=>{const Ae=!te.current&&!$e;(b.value!==void 0&&b.value===xe||Ae)&&(F(fe),Ae&&(te.current=!0))},[b.value]),Ve=f.useCallback(()=>E==null?void 0:E.focus(),[E]),Ue=f.useCallback((fe,xe,$e)=>{const Ae=!te.current&&!$e;(b.value!==void 0&&b.value===xe||Ae)&&J(fe)},[b.value]),We=r==="popper"?f2:LY,Me=We===f2?{side:l,sideOffset:u,align:d,alignOffset:h,arrowPadding:m,collisionBoundary:g,collisionPadding:y,sticky:x,hideWhenDetached:_,avoidCollisions:C}:{};return f.createElement(s5,{scope:n,content:E,viewport:P,onViewportChange:M,itemRefCallback:ge,selectedItem:O,onItemLeave:Ve,itemTextRefCallback:Ue,focusSelectedItem:ie,selectedItemText:V,position:r,isPositioned:ae,searchRef:W},f.createElement(Gm,{as:Wo,allowPinchZoom:!0},f.createElement(Hm,{asChild:!0,trapped:b.open,onMountAutoFocus:fe=>{fe.preventDefault()},onUnmountAutoFocus:ue(o,fe=>{var xe;(xe=b.trigger)===null||xe===void 0||xe.focus({preventScroll:!0}),fe.preventDefault()})},f.createElement(yc,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:fe=>fe.preventDefault(),onDismiss:()=>b.onOpenChange(!1)},f.createElement(We,Y({role:"listbox",id:b.contentId,"data-state":b.open?"open":"closed",dir:b.dir,onContextMenu:fe=>fe.preventDefault()},S,Me,{onPlaced:()=>U(!0),ref:A,style:{display:"flex",flexDirection:"column",outline:"none",...S.style},onKeyDown:ue(S.onKeyDown,fe=>{const xe=fe.ctrlKey||fe.altKey||fe.metaKey;if(fe.key==="Tab"&&fe.preventDefault(),!xe&&fe.key.length===1&&le(fe.key),["ArrowUp","ArrowDown","Home","End"].includes(fe.key)){let Ae=G().filter(Oe=>!Oe.disabled).map(Oe=>Oe.ref.current);if(["ArrowUp","End"].includes(fe.key)&&(Ae=Ae.slice().reverse()),["ArrowUp","ArrowDown"].includes(fe.key)){const Oe=fe.target,je=Ae.indexOf(Oe);Ae=Ae.slice(je+1)}setTimeout(()=>L(Ae)),fe.preventDefault()}})}))))))}),LY=f.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,i=Oa(ic,n),s=Ma(ic,n),[l,u]=f.useState(null),[d,h]=f.useState(null),m=Be(t,A=>h(A)),g=tg(n),y=f.useRef(!1),x=f.useRef(!0),{viewport:_,selectedItem:C,selectedItemText:S,focusSelectedItem:b}=s,E=f.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&d&&_&&C&&S){const A=i.trigger.getBoundingClientRect(),O=d.getBoundingClientRect(),F=i.valueNode.getBoundingClientRect(),V=S.getBoundingClientRect();if(i.dir!=="rtl"){const Oe=V.left-O.left,je=F.left-Oe,Ot=A.left-je,ct=A.width+Ot,Yt=Math.max(ct,O.width),Er=window.innerWidth-ai,gt=id(je,[ai,Er-Yt]);l.style.minWidth=ct+"px",l.style.left=gt+"px"}else{const Oe=O.right-V.right,je=window.innerWidth-F.right-Oe,Ot=window.innerWidth-A.right-je,ct=A.width+Ot,Yt=Math.max(ct,O.width),Er=window.innerWidth-ai,gt=id(je,[ai,Er-Yt]);l.style.minWidth=ct+"px",l.style.right=gt+"px"}const J=g(),G=window.innerHeight-ai*2,ae=_.scrollHeight,U=window.getComputedStyle(d),te=parseInt(U.borderTopWidth,10),L=parseInt(U.paddingTop,10),ie=parseInt(U.borderBottomWidth,10),K=parseInt(U.paddingBottom,10),Q=te+L+ae+K+ie,W=Math.min(C.offsetHeight*5,Q),le=window.getComputedStyle(_),ge=parseInt(le.paddingTop,10),Ve=parseInt(le.paddingBottom,10),Ue=A.top+A.height/2-ai,We=G-Ue,Me=C.offsetHeight/2,fe=C.offsetTop+Me,xe=te+L+fe,$e=Q-xe;if(xe<=Ue){const Oe=C===J[J.length-1].ref.current;l.style.bottom="0px";const je=d.clientHeight-_.offsetTop-_.offsetHeight,Ot=Math.max(We,Me+(Oe?Ve:0)+je+ie),ct=xe+Ot;l.style.height=ct+"px"}else{const Oe=C===J[0].ref.current;l.style.top="0px";const Ot=Math.max(Ue,te+_.offsetTop+(Oe?ge:0)+Me)+$e;l.style.height=Ot+"px",_.scrollTop=xe-Ue+_.offsetTop}l.style.margin=`${ai}px 0`,l.style.minHeight=W+"px",l.style.maxHeight=G+"px",r==null||r(),requestAnimationFrame(()=>y.current=!0)}},[g,i.trigger,i.valueNode,l,d,_,C,S,i.dir,r]);Pn(()=>E(),[E]);const[k,P]=f.useState();Pn(()=>{d&&P(window.getComputedStyle(d).zIndex)},[d]);const M=f.useCallback(A=>{A&&x.current===!0&&(E(),b==null||b(),x.current=!1)},[E,b]);return f.createElement(FY,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:y,onScrollButtonChange:M},f.createElement("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k}},f.createElement(Pe.div,Y({},o,{ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}}))))}),f2=f.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=ai,...i}=e,s=jx(n);return f.createElement(Bm,Y({},s,i,{ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...i.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)"}}))}),[FY,zx]=Ec(ic,{}),p2="SelectViewport",jY=f.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Ma(p2,n),i=zx(p2,n),s=Be(t,o.onViewportChange),l=f.useRef(0);return f.createElement(f.Fragment,null,f.createElement("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}"}}),f.createElement(eg.Slot,{scope:n},f.createElement(Pe.div,Y({"data-radix-select-viewport":"",role:"presentation"},r,{ref:s,style:{position:"relative",flex:1,overflow:"auto",...r.style},onScroll:ue(r.onScroll,u=>{const d=u.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:m}=i;if(m!=null&&m.current&&h){const g=Math.abs(l.current-d.scrollTop);if(g>0){const y=window.innerHeight-ai*2,x=parseFloat(h.style.minHeight),_=parseFloat(h.style.height),C=Math.max(x,_);if(C0?E:0,h.style.justifyContent="flex-end")}}}l.current=d.scrollTop})}))))}),zY="SelectGroup",[BY,UY]=Ec(zY),VY=f.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=nr();return f.createElement(BY,{scope:n,id:o},f.createElement(Pe.div,Y({role:"group","aria-labelledby":o},r,{ref:t})))}),WY="SelectLabel",HY=f.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=UY(WY,n);return f.createElement(Pe.div,Y({id:o.id},r,{ref:t}))}),b1="SelectItem",[KY,a5]=Ec(b1),YY=f.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:i,...s}=e,l=Oa(b1,n),u=Ma(b1,n),d=l.value===r,[h,m]=f.useState(i??""),[g,y]=f.useState(!1),x=Be(t,S=>{var b;return(b=u.itemRefCallback)===null||b===void 0?void 0:b.call(u,S,r,o)}),_=nr(),C=()=>{o||(l.onValueChange(r),l.onOpenChange(!1))};if(r==="")throw new Error("A 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 f.createElement(KY,{scope:n,value:r,disabled:o,textId:_,isSelected:d,onItemTextChange:f.useCallback(S=>{m(b=>{var E;return b||((E=S==null?void 0:S.textContent)!==null&&E!==void 0?E:"").trim()})},[])},f.createElement(eg.ItemSlot,{scope:n,value:r,disabled:o,textValue:h},f.createElement(Pe.div,Y({role:"option","aria-labelledby":_,"data-highlighted":g?"":void 0,"aria-selected":d&&g,"data-state":d?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1},s,{ref:x,onFocus:ue(s.onFocus,()=>y(!0)),onBlur:ue(s.onBlur,()=>y(!1)),onPointerUp:ue(s.onPointerUp,C),onPointerMove:ue(s.onPointerMove,S=>{if(o){var b;(b=u.onItemLeave)===null||b===void 0||b.call(u)}else S.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ue(s.onPointerLeave,S=>{if(S.currentTarget===document.activeElement){var b;(b=u.onItemLeave)===null||b===void 0||b.call(u)}}),onKeyDown:ue(s.onKeyDown,S=>{var b;((b=u.searchRef)===null||b===void 0?void 0:b.current)!==""&&S.key===" "||(SY.includes(S.key)&&C(),S.key===" "&&S.preventDefault())})}))))}),hp="SelectItemText",GY=f.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...i}=e,s=Oa(hp,n),l=Ma(hp,n),u=a5(hp,n),d=kY(hp,n),[h,m]=f.useState(null),g=Be(t,S=>m(S),u.onItemTextChange,S=>{var b;return(b=l.itemTextRefCallback)===null||b===void 0?void 0:b.call(l,S,u.value,u.disabled)}),y=h==null?void 0:h.textContent,x=f.useMemo(()=>f.createElement("option",{key:u.value,value:u.value,disabled:u.disabled},y),[u.disabled,u.value,y]),{onNativeOptionAdd:_,onNativeOptionRemove:C}=d;return Pn(()=>(_(x),()=>C(x)),[_,C,x]),f.createElement(f.Fragment,null,f.createElement(Pe.span,Y({id:u.textId},i,{ref:g})),u.isSelected&&s.valueNode&&!s.valueNodeHasChildren?Os.createPortal(i.children,s.valueNode):null)}),XY="SelectItemIndicator",ZY=f.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return a5(XY,n).isSelected?f.createElement(Pe.span,Y({"aria-hidden":!0},r,{ref:t})):null}),h2="SelectScrollUpButton",qY=f.forwardRef((e,t)=>{const n=Ma(h2,e.__scopeSelect),r=zx(h2,e.__scopeSelect),[o,i]=f.useState(!1),s=Be(t,r.onScrollButtonChange);return Pn(()=>{if(n.viewport&&n.isPositioned){let d=function(){const h=u.scrollTop>0;i(h)};var l=d;const u=n.viewport;return d(),u.addEventListener("scroll",d),()=>u.removeEventListener("scroll",d)}},[n.viewport,n.isPositioned]),o?f.createElement(l5,Y({},e,{ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:u}=n;l&&u&&(l.scrollTop=l.scrollTop-u.offsetHeight)}})):null}),m2="SelectScrollDownButton",QY=f.forwardRef((e,t)=>{const n=Ma(m2,e.__scopeSelect),r=zx(m2,e.__scopeSelect),[o,i]=f.useState(!1),s=Be(t,r.onScrollButtonChange);return Pn(()=>{if(n.viewport&&n.isPositioned){let d=function(){const h=u.scrollHeight-u.clientHeight,m=Math.ceil(u.scrollTop)u.removeEventListener("scroll",d)}},[n.viewport,n.isPositioned]),o?f.createElement(l5,Y({},e,{ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:u}=n;l&&u&&(l.scrollTop=l.scrollTop+u.offsetHeight)}})):null}),l5=f.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,i=Ma("SelectScrollButton",n),s=f.useRef(null),l=tg(n),u=f.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return f.useEffect(()=>()=>u(),[u]),Pn(()=>{var d;const h=l().find(m=>m.ref.current===document.activeElement);h==null||(d=h.ref.current)===null||d===void 0||d.scrollIntoView({block:"nearest"})},[l]),f.createElement(Pe.div,Y({"aria-hidden":!0},o,{ref:t,style:{flexShrink:0,...o.style},onPointerDown:ue(o.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(r,50))}),onPointerMove:ue(o.onPointerMove,()=>{var d;(d=i.onItemLeave)===null||d===void 0||d.call(i),s.current===null&&(s.current=window.setInterval(r,50))}),onPointerLeave:ue(o.onPointerLeave,()=>{u()})}))}),JY=f.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return f.createElement(Pe.div,Y({"aria-hidden":!0},r,{ref:t}))});function c5(e){return e===""||e===void 0}const u5=f.forwardRef((e,t)=>{const{value:n,...r}=e,o=f.useRef(null),i=Be(t,o),s=Fx(n);return f.useEffect(()=>{const l=o.current,u=window.HTMLSelectElement.prototype,h=Object.getOwnPropertyDescriptor(u,"value").set;if(s!==n&&h){const m=new Event("change",{bubbles:!0});h.call(l,n),l.dispatchEvent(m)}},[s,n]),f.createElement(Um,{asChild:!0},f.createElement("select",Y({},r,{ref:i,defaultValue:n})))});u5.displayName="BubbleSelect";function d5(e){const t=Ft(e),n=f.useRef(""),r=f.useRef(0),o=f.useCallback(s=>{const l=n.current+s;t(l),function u(d){n.current=d,window.clearTimeout(r.current),d!==""&&(r.current=window.setTimeout(()=>u(""),1e3))}(l)},[t]),i=f.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return f.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,i]}function f5(e,t,n){const o=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=eG(e,Math.max(i,0));o.length===1&&(s=s.filter(d=>d!==n));const u=s.find(d=>d.textValue.toLowerCase().startsWith(o.toLowerCase()));return u!==n?u:void 0}function eG(e,t){return e.map((n,r)=>e[(t+r)%e.length])}const tG=RY,p5=PY,nG=OY,rG=MY,oG=NY,h5=DY,iG=jY,sG=VY,m5=HY,g5=YY,aG=GY,lG=ZY,v5=qY,y5=QY,w5=JY,aa=tG,wl=sG,la=nG,ls=f.forwardRef(({className:e,children:t,...n},r)=>v.jsxs(p5,{ref:r,className:Ce("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent 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),tabIndex:-1,...n,children:[t,v.jsx(rG,{asChild:!0,children:v.jsx(Gj,{className:"h-4 w-4 opacity-50"})})]}));ls.displayName=p5.displayName;const x5=f.forwardRef(({className:e,...t},n)=>v.jsx(v5,{ref:n,className:Ce("flex cursor-default items-center justify-center py-1",e),...t,children:v.jsx(tz,{})}));x5.displayName=v5.displayName;const b5=f.forwardRef(({className:e,...t},n)=>v.jsx(y5,{ref:n,className:Ce("flex cursor-default items-center justify-center py-1",e),...t,children:v.jsx(qj,{})}));b5.displayName=y5.displayName;const cs=f.forwardRef(({className:e,children:t,position:n="popper",...r},o)=>v.jsx(oG,{children:v.jsxs(h5,{ref:o,className:Ce("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",n==="popper"&&"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:n,onCloseAutoFocus:i=>i.preventDefault(),...r,children:[v.jsx(x5,{}),v.jsx(iG,{className:Ce("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),v.jsx(b5,{})]})}));cs.displayName=h5.displayName;const cG=f.forwardRef(({className:e,...t},n)=>v.jsx(m5,{ref:n,className:Ce("px-2 py-1.5 text-sm font-semibold",e),...t}));cG.displayName=m5.displayName;const us=f.forwardRef(({className:e,children:t,...n},r)=>v.jsxs(g5,{ref:r,className:Ce("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),...n,children:[v.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:v.jsx(lG,{children:v.jsx(vT,{className:"h-4 w-4"})})}),v.jsx(aG,{children:t})]}));us.displayName=g5.displayName;const uG=f.forwardRef(({className:e,...t},n)=>v.jsx(w5,{ref:n,className:Ce("-mx-1 my-1 h-px bg-muted",e),...t}));uG.displayName=w5.displayName;function dG(e,t){return f.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const _5="ScrollArea",[S5,_te]=An(_5),[fG,qr]=S5(_5),pG=f.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:o,scrollHideDelay:i=600,...s}=e,[l,u]=f.useState(null),[d,h]=f.useState(null),[m,g]=f.useState(null),[y,x]=f.useState(null),[_,C]=f.useState(null),[S,b]=f.useState(0),[E,k]=f.useState(0),[P,M]=f.useState(!1),[A,O]=f.useState(!1),F=Be(t,J=>u(J)),V=Sc(o);return f.createElement(fG,{scope:n,type:r,dir:V,scrollHideDelay:i,scrollArea:l,viewport:d,onViewportChange:h,content:m,onContentChange:g,scrollbarX:y,onScrollbarXChange:x,scrollbarXEnabled:P,onScrollbarXEnabledChange:M,scrollbarY:_,onScrollbarYChange:C,scrollbarYEnabled:A,onScrollbarYEnabledChange:O,onCornerWidthChange:b,onCornerHeightChange:k},f.createElement(Pe.div,Y({dir:V},s,{ref:F,style:{position:"relative","--radix-scroll-area-corner-width":S+"px","--radix-scroll-area-corner-height":E+"px",...e.style}})))}),hG="ScrollAreaViewport",mG=f.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,...o}=e,i=qr(hG,n),s=f.useRef(null),l=Be(t,s,i.onViewportChange);return f.createElement(f.Fragment,null,f.createElement("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"}}),f.createElement(Pe.div,Y({"data-radix-scroll-area-viewport":""},o,{ref:l,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style}}),f.createElement("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"}},r)))}),$i="ScrollAreaScrollbar",E5=f.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=qr($i,e.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:s}=o,l=e.orientation==="horizontal";return f.useEffect(()=>(l?i(!0):s(!0),()=>{l?i(!1):s(!1)}),[l,i,s]),o.type==="hover"?f.createElement(gG,Y({},r,{ref:t,forceMount:n})):o.type==="scroll"?f.createElement(vG,Y({},r,{ref:t,forceMount:n})):o.type==="auto"?f.createElement(C5,Y({},r,{ref:t,forceMount:n})):o.type==="always"?f.createElement(Bx,Y({},r,{ref:t})):null}),gG=f.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=qr($i,e.__scopeScrollArea),[i,s]=f.useState(!1);return f.useEffect(()=>{const l=o.scrollArea;let u=0;if(l){const d=()=>{window.clearTimeout(u),s(!0)},h=()=>{u=window.setTimeout(()=>s(!1),o.scrollHideDelay)};return l.addEventListener("pointerenter",d),l.addEventListener("pointerleave",h),()=>{window.clearTimeout(u),l.removeEventListener("pointerenter",d),l.removeEventListener("pointerleave",h)}}},[o.scrollArea,o.scrollHideDelay]),f.createElement(xn,{present:n||i},f.createElement(C5,Y({"data-state":i?"visible":"hidden"},r,{ref:t})))}),vG=f.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=qr($i,e.__scopeScrollArea),i=e.orientation==="horizontal",s=rg(()=>u("SCROLL_END"),100),[l,u]=dG("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return f.useEffect(()=>{if(l==="idle"){const d=window.setTimeout(()=>u("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(d)}},[l,o.scrollHideDelay,u]),f.useEffect(()=>{const d=o.viewport,h=i?"scrollLeft":"scrollTop";if(d){let m=d[h];const g=()=>{const y=d[h];m!==y&&(u("SCROLL"),s()),m=y};return d.addEventListener("scroll",g),()=>d.removeEventListener("scroll",g)}},[o.viewport,i,u,s]),f.createElement(xn,{present:n||l!=="hidden"},f.createElement(Bx,Y({"data-state":l==="hidden"?"hidden":"visible"},r,{ref:t,onPointerEnter:ue(e.onPointerEnter,()=>u("POINTER_ENTER")),onPointerLeave:ue(e.onPointerLeave,()=>u("POINTER_LEAVE"))})))}),C5=f.forwardRef((e,t)=>{const n=qr($i,e.__scopeScrollArea),{forceMount:r,...o}=e,[i,s]=f.useState(!1),l=e.orientation==="horizontal",u=rg(()=>{if(n.viewport){const d=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=e,o=qr($i,e.__scopeScrollArea),i=f.useRef(null),s=f.useRef(0),[l,u]=f.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),d=T5(l.viewport,l.content),h={...r,sizes:l,onSizesChange:u,hasThumb:d>0&&d<1,onThumbChange:g=>i.current=g,onThumbPointerUp:()=>s.current=0,onThumbPointerDown:g=>s.current=g};function m(g,y){return CG(g,s.current,l,y)}return n==="horizontal"?f.createElement(yG,Y({},h,{ref:t,onThumbPositionChange:()=>{if(o.viewport&&i.current){const g=o.viewport.scrollLeft,y=g2(g,l,o.dir);i.current.style.transform=`translate3d(${y}px, 0, 0)`}},onWheelScroll:g=>{o.viewport&&(o.viewport.scrollLeft=g)},onDragScroll:g=>{o.viewport&&(o.viewport.scrollLeft=m(g,o.dir))}})):n==="vertical"?f.createElement(wG,Y({},h,{ref:t,onThumbPositionChange:()=>{if(o.viewport&&i.current){const g=o.viewport.scrollTop,y=g2(g,l);i.current.style.transform=`translate3d(0, ${y}px, 0)`}},onWheelScroll:g=>{o.viewport&&(o.viewport.scrollTop=g)},onDragScroll:g=>{o.viewport&&(o.viewport.scrollTop=m(g))}})):null}),yG=f.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,i=qr($i,e.__scopeScrollArea),[s,l]=f.useState(),u=f.useRef(null),d=Be(t,u,i.onScrollbarXChange);return f.useEffect(()=>{u.current&&l(getComputedStyle(u.current))},[u]),f.createElement(k5,Y({"data-orientation":"horizontal"},o,{ref:d,sizes:n,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":ng(n)+"px",...e.style},onThumbPointerDown:h=>e.onThumbPointerDown(h.x),onDragScroll:h=>e.onDragScroll(h.x),onWheelScroll:(h,m)=>{if(i.viewport){const g=i.viewport.scrollLeft+h.deltaX;e.onWheelScroll(g),A5(g,m)&&h.preventDefault()}},onResize:()=>{u.current&&i.viewport&&s&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:u.current.clientWidth,paddingStart:zh(s.paddingLeft),paddingEnd:zh(s.paddingRight)}})}}))}),wG=f.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,i=qr($i,e.__scopeScrollArea),[s,l]=f.useState(),u=f.useRef(null),d=Be(t,u,i.onScrollbarYChange);return f.useEffect(()=>{u.current&&l(getComputedStyle(u.current))},[u]),f.createElement(k5,Y({"data-orientation":"vertical"},o,{ref:d,sizes:n,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":ng(n)+"px",...e.style},onThumbPointerDown:h=>e.onThumbPointerDown(h.y),onDragScroll:h=>e.onDragScroll(h.y),onWheelScroll:(h,m)=>{if(i.viewport){const g=i.viewport.scrollTop+h.deltaY;e.onWheelScroll(g),A5(g,m)&&h.preventDefault()}},onResize:()=>{u.current&&i.viewport&&s&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:u.current.clientHeight,paddingStart:zh(s.paddingTop),paddingEnd:zh(s.paddingBottom)}})}}))}),[xG,$5]=S5($i),k5=f.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:o,onThumbChange:i,onThumbPointerUp:s,onThumbPointerDown:l,onThumbPositionChange:u,onDragScroll:d,onWheelScroll:h,onResize:m,...g}=e,y=qr($i,n),[x,_]=f.useState(null),C=Be(t,F=>_(F)),S=f.useRef(null),b=f.useRef(""),E=y.viewport,k=r.content-r.viewport,P=Ft(h),M=Ft(u),A=rg(m,10);function O(F){if(S.current){const V=F.clientX-S.current.left,J=F.clientY-S.current.top;d({x:V,y:J})}}return f.useEffect(()=>{const F=V=>{const J=V.target;(x==null?void 0:x.contains(J))&&P(V,k)};return document.addEventListener("wheel",F,{passive:!1}),()=>document.removeEventListener("wheel",F,{passive:!1})},[E,x,k,P]),f.useEffect(M,[r,M]),sc(x,A),sc(y.content,A),f.createElement(xG,{scope:n,scrollbar:x,hasThumb:o,onThumbChange:Ft(i),onThumbPointerUp:Ft(s),onThumbPositionChange:M,onThumbPointerDown:Ft(l)},f.createElement(Pe.div,Y({},g,{ref:C,style:{position:"absolute",...g.style},onPointerDown:ue(e.onPointerDown,F=>{F.button===0&&(F.target.setPointerCapture(F.pointerId),S.current=x.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",y.viewport&&(y.viewport.style.scrollBehavior="auto"),O(F))}),onPointerMove:ue(e.onPointerMove,O),onPointerUp:ue(e.onPointerUp,F=>{const V=F.target;V.hasPointerCapture(F.pointerId)&&V.releasePointerCapture(F.pointerId),document.body.style.webkitUserSelect=b.current,y.viewport&&(y.viewport.style.scrollBehavior=""),S.current=null})})))}),_1="ScrollAreaThumb",bG=f.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=$5(_1,e.__scopeScrollArea);return f.createElement(xn,{present:n||o.hasThumb},f.createElement(_G,Y({ref:t},r)))}),_G=f.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,i=qr(_1,n),s=$5(_1,n),{onThumbPositionChange:l}=s,u=Be(t,m=>s.onThumbChange(m)),d=f.useRef(),h=rg(()=>{d.current&&(d.current(),d.current=void 0)},100);return f.useEffect(()=>{const m=i.viewport;if(m){const g=()=>{if(h(),!d.current){const y=$G(m,l);d.current=y,l()}};return l(),m.addEventListener("scroll",g),()=>m.removeEventListener("scroll",g)}},[i.viewport,h,l]),f.createElement(Pe.div,Y({"data-state":s.hasThumb?"visible":"hidden"},o,{ref:u,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:ue(e.onPointerDownCapture,m=>{const y=m.target.getBoundingClientRect(),x=m.clientX-y.left,_=m.clientY-y.top;s.onThumbPointerDown({x,y:_})}),onPointerUp:ue(e.onPointerUp,s.onThumbPointerUp)}))}),R5="ScrollAreaCorner",SG=f.forwardRef((e,t)=>{const n=qr(R5,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?f.createElement(EG,Y({},e,{ref:t})):null}),EG=f.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=qr(R5,n),[i,s]=f.useState(0),[l,u]=f.useState(0),d=!!(i&&l);return sc(o.scrollbarX,()=>{var h;const m=((h=o.scrollbarX)===null||h===void 0?void 0:h.offsetHeight)||0;o.onCornerHeightChange(m),u(m)}),sc(o.scrollbarY,()=>{var h;const m=((h=o.scrollbarY)===null||h===void 0?void 0:h.offsetWidth)||0;o.onCornerWidthChange(m),s(m)}),d?f.createElement(Pe.div,Y({},r,{ref:t,style:{width:i,height:l,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...e.style}})):null});function zh(e){return e?parseInt(e,10):0}function T5(e,t){const n=e/t;return isNaN(n)?0:n}function ng(e){const t=T5(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function CG(e,t,n,r="ltr"){const o=ng(n),i=o/2,s=t||i,l=o-s,u=n.scrollbar.paddingStart+s,d=n.scrollbar.size-n.scrollbar.paddingEnd-l,h=n.content-n.viewport,m=r==="ltr"?[0,h]:[h*-1,0];return P5([u,d],m)(e)}function g2(e,t,n="ltr"){const r=ng(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-o,s=t.content-t.viewport,l=i-r,u=n==="ltr"?[0,s]:[s*-1,0],d=id(e,u);return P5([0,s],[0,l])(d)}function P5(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function A5(e,t){return e>0&&e{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function o(){const i={left:e.scrollLeft,top:e.scrollTop},s=n.left!==i.left,l=n.top!==i.top;(s||l)&&t(),n=i,r=window.requestAnimationFrame(o)}(),()=>window.cancelAnimationFrame(r)};function rg(e,t){const n=Ft(e),r=f.useRef(0);return f.useEffect(()=>()=>window.clearTimeout(r.current),[]),f.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function sc(e,t){const n=Ft(t);Pn(()=>{let r=0;if(e){const o=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return o.observe(e),()=>{window.cancelAnimationFrame(r),o.unobserve(e)}}},[e,n])}const O5=pG,kG=mG,RG=SG,og=f.forwardRef(({className:e,children:t,...n},r)=>v.jsxs(O5,{ref:r,className:Ce("relative overflow-hidden",e),scrollHideDelay:400,...n,children:[v.jsx(kG,{className:"h-full w-full rounded-[inherit]",children:t}),v.jsx(M5,{}),v.jsx(RG,{})]}));og.displayName=O5.displayName;const M5=f.forwardRef(({className:e,orientation:t="vertical",...n},r)=>v.jsx(E5,{ref:r,orientation:t,className:Ce("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:v.jsx(bG,{className:"relative flex-1 rounded-full bg-border"})}));M5.displayName=E5.displayName;const N5="Name",D5="Created time",I5="Modified time",v2="input",TG="output",y2={[xs.NAME]:N5,[xs.CTIME]:D5,[xs.MTIME]:I5};function PG(e){const{onPhotoClick:t,photoWidth:n}=e,[r,o]=AP(!1),[i,s]=bt(V=>[V.fileManagerState,V.updateFileManagerState]),{toast:l}=Td(),[u,d]=f.useState(0),[h,m]=f.useState(0),g=f.useRef(null),y=lV(i.searchText,300),[x,_]=f.useState(v2),[C,S]=f.useState([]),[b,E]=f.useState([]),[k,P]=f.useState(0);Zn("f",()=>{o()}),Zn("left",()=>{let V=k;k>0&&(V=k-1),P(V),t(x,b[V].name)},[k,b]),Zn("right",()=>{let V=k;k{r||m(u)},[r,u]);const M=f.useCallback(V=>{V!==null&&r&&setTimeout(()=>{V.scrollTo({top:h,left:0})},100)},[r,h]);f.useEffect(()=>{(async()=>{try{const J=await Uj(x);S(J)}catch(J){l({variant:"destructive",title:"Uh oh! Something went wrong.",description:J.message?J.message:J.toString()})}})()},[x]),f.useEffect(()=>{if(!r)return;(async()=>{try{let J=C;y&&(J=new _c(J,{keys:["name"]}).search(y).map(te=>J[te.refIndex])),J=xH.orderBy(J,i.sortBy,i.sortOrder);const G=J.map(ae=>{const U=n,te=ae.height*(U/ae.width);return{src:`${Ms}/media_thumbnail_file?tab=${x}&filename=${encodeURIComponent(ae.name)}&width=${Math.ceil(U)}&height=${Math.ceil(te)}`,height:te,width:U,name:ae.name}});E(G)}catch(J){l({variant:"destructive",title:"Uh oh! Something went wrong.",description:J.message?J.message:J.toString()})}})()},[C,y,i,n,r]);const A=V=>{d(V.currentTarget.scrollTop)},O=({index:V})=>{o(),P(V),t(x,b[V].name)},F=()=>v.jsxs("div",{className:"flex justify-start items-center gap-[12px]",children:[v.jsx("div",{children:`Images (${b.length})`}),v.jsxs("div",{className:"flex",children:[v.jsx(vn,{tooltip:"Rows layout",onClick:()=>{s({layout:"rows"})},children:v.jsx(fz,{className:i.layout!=="rows"?"opacity-50":""})}),v.jsx(vn,{tooltip:"Grid layout",onClick:()=>{s({layout:"masonry"})},children:v.jsx(uz,{className:i.layout!=="masonry"?"opacity-50":""})})]})]});return v.jsxs(Zm,{open:r,onOpenChange:o,children:[v.jsx(uP,{asChild:!0,children:v.jsx(vn,{tooltip:"File Manager",children:v.jsx(QU,{})})}),v.jsxs(Fd,{className:"h-4/5 max-w-6xl",children:[v.jsx(jd,{children:F()}),v.jsxs("div",{className:"flex justify-between gap-8 items-center",children:[v.jsxs("div",{className:"flex relative justify-start items-center",children:[v.jsx(sz,{className:"absolute left-[8px]"}),v.jsx(Pd,{ref:g,value:i.searchText,className:"w-[250px] pl-[30px]",tabIndex:-1,onInput:V=>{V.preventDefault(),V.stopPropagation();const J=V.target;s({searchText:J.value})},placeholder:"Search by file name"})]}),v.jsx(i5,{defaultValue:x,onValueChange:V=>_(V),children:v.jsxs(Lx,{"aria-label":"Manage your account",children:[v.jsx(sa,{value:v2,children:"Image Directory"}),v.jsx(sa,{value:TG,children:"Output Directory"})]})}),v.jsx("div",{className:"flex gap-2",children:v.jsxs("div",{className:"flex gap-1",children:[v.jsxs(aa,{value:y2[i.sortBy],onValueChange:V=>{switch(V){case N5:s({sortBy:xs.NAME});break;case D5:s({sortBy:xs.CTIME});break;case I5:s({sortBy:xs.MTIME});break}},children:[v.jsx(ls,{className:"w-[140px]",children:v.jsx(la,{})}),v.jsx(cs,{children:Object.values(y2).map(V=>v.jsx(us,{value:V,children:V},V))})]}),i.sortOrder===$u.DESCENDING?v.jsx(vn,{tooltip:"Descending Order",onClick:()=>{s({sortOrder:$u.ASCENDING})},children:v.jsx(iK,{})}):v.jsx(vn,{tooltip:"Ascending Order",onClick:()=>{s({sortOrder:$u.DESCENDING})},children:v.jsx(lK,{})})]})})]}),v.jsx(og,{className:"w-full h-full rounded-md",onScroll:A,ref:M,children:v.jsx(nK,{layout:i.layout,photos:b,spacing:12,padding:0,onClick:O})})]})]})}var Bd=e=>e.type==="checkbox",xl=e=>e instanceof Date,Ln=e=>e==null;const L5=e=>typeof e=="object";var sn=e=>!Ln(e)&&!Array.isArray(e)&&L5(e)&&!xl(e),F5=e=>sn(e)&&e.target?Bd(e.target)?e.target.checked:e.target.value:e,AG=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,j5=(e,t)=>e.has(AG(t)),OG=e=>{const t=e.constructor&&e.constructor.prototype;return sn(t)&&t.hasOwnProperty("isPrototypeOf")},Ux=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function so(e){let t;const n=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(Ux&&(e instanceof Blob||e instanceof FileList))&&(n||sn(e)))if(t=n?[]:{},!n&&!OG(e))t=e;else for(const r in e)e.hasOwnProperty(r)&&(t[r]=so(e[r]));else return e;return t}var Ud=e=>Array.isArray(e)?e.filter(Boolean):[],Ht=e=>e===void 0,ve=(e,t,n)=>{if(!t||!sn(e))return n;const r=Ud(t.split(/[,[\].]+?/)).reduce((o,i)=>Ln(o)?o:o[i],e);return Ht(r)||r===e?Ht(e[t])?n:e[t]:r},No=e=>typeof e=="boolean";const Bh={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},mo={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},oi={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},z5=Fe.createContext(null),ig=()=>Fe.useContext(z5),MG=e=>{const{children:t,...n}=e;return Fe.createElement(z5.Provider,{value:n},t)};var B5=(e,t,n,r=!0)=>{const o={defaultValues:t._defaultValues};for(const i in e)Object.defineProperty(o,i,{get:()=>{const s=i;return t._proxyFormState[s]!==mo.all&&(t._proxyFormState[s]=!r||mo.all),n&&(n[s]=!0),e[s]}});return o},Fr=e=>sn(e)&&!Object.keys(e).length,U5=(e,t,n,r)=>{n(e);const{name:o,...i}=e;return Fr(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(s=>t[s]===(!r||mo.all))},Yp=e=>Array.isArray(e)?e:[e],V5=(e,t,n)=>!e||!t||e===t||Yp(e).some(r=>r&&(n?r===t:r.startsWith(t)||t.startsWith(r)));function Vx(e){const t=Fe.useRef(e);t.current=e,Fe.useEffect(()=>{const n=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{n&&n.unsubscribe()}},[e.disabled])}function NG(e){const t=ig(),{control:n=t.control,disabled:r,name:o,exact:i}=e||{},[s,l]=Fe.useState(n._formState),u=Fe.useRef(!0),d=Fe.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1}),h=Fe.useRef(o);return h.current=o,Vx({disabled:r,next:m=>u.current&&V5(h.current,m.name,i)&&U5(m,d.current,n._updateFormState)&&l({...n._formState,...m}),subject:n._subjects.state}),Fe.useEffect(()=>(u.current=!0,d.current.isValid&&n._updateValid(!0),()=>{u.current=!1}),[n]),B5(s,n,d.current,!1)}var Fo=e=>typeof e=="string",W5=(e,t,n,r,o)=>Fo(e)?(r&&t.watch.add(e),ve(n,e,o)):Array.isArray(e)?e.map(i=>(r&&t.watch.add(i),ve(n,i))):(r&&(t.watchAll=!0),n);function DG(e){const t=ig(),{control:n=t.control,name:r,defaultValue:o,disabled:i,exact:s}=e||{},l=Fe.useRef(r);l.current=r,Vx({disabled:i,subject:n._subjects.values,next:h=>{V5(l.current,h.name,s)&&d(so(W5(l.current,n._names,h.values||n._formValues,!1,o)))}});const[u,d]=Fe.useState(n._getWatch(r,o));return Fe.useEffect(()=>n._removeUnmounted()),u}var Wx=e=>/^\w*$/.test(e),H5=e=>Ud(e.replace(/["|']|\]/g,"").split(/\.|\[/));function wt(e,t,n){let r=-1;const o=Wx(t)?[t]:H5(t),i=o.length,s=i-1;for(;++r{const h=o._options.shouldUnregister||i,m=(g,y)=>{const x=ve(o._fields,g);x&&(x._f.mount=y)};if(m(n,!0),h){const g=so(ve(o._options.defaultValues,n));wt(o._defaultValues,n,g),Ht(ve(o._formValues,n))&&wt(o._formValues,n,g)}return()=>{(s?h&&!o._state.action:h)?o.unregister(n):m(n,!1)}},[n,o,s,i]),Fe.useEffect(()=>{ve(o._fields,n)&&o._updateDisabledField({disabled:r,fields:o._fields,name:n,value:ve(o._fields,n)._f.value})},[r,n,o]),{field:{name:n,value:l,...No(r)||No(u.disabled)?{disabled:u.disabled||r}:{},onChange:Fe.useCallback(h=>d.current.onChange({target:{value:F5(h),name:n},type:Bh.CHANGE}),[n]),onBlur:Fe.useCallback(()=>d.current.onBlur({target:{value:ve(o._formValues,n),name:n},type:Bh.BLUR}),[n,o]),ref:h=>{const m=ve(o._fields,n);m&&h&&(m._f.ref={focus:()=>h.focus(),select:()=>h.select(),setCustomValidity:g=>h.setCustomValidity(g),reportValidity:()=>h.reportValidity()})}},formState:u,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!ve(u.errors,n)},isDirty:{enumerable:!0,get:()=>!!ve(u.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!ve(u.touchedFields,n)},error:{enumerable:!0,get:()=>ve(u.errors,n)}})}}const LG=e=>e.render(IG(e));var K5=(e,t,n,r,o)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:o||!0}}:{},w2=e=>({isOnSubmit:!e||e===mo.onSubmit,isOnBlur:e===mo.onBlur,isOnChange:e===mo.onChange,isOnAll:e===mo.all,isOnTouch:e===mo.onTouched}),x2=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length))));const Gp=(e,t,n,r)=>{for(const o of n||Object.keys(e)){const i=ve(e,o);if(i){const{_f:s,...l}=i;if(s){if(s.refs&&s.refs[0]&&t(s.refs[0],o)&&!r)break;if(s.ref&&t(s.ref,s.name)&&!r)break}else sn(l)&&Gp(l,t)}}};var FG=(e,t,n)=>{const r=Ud(ve(e,n));return wt(r,"root",t[n]),wt(e,n,r),e},Hx=e=>e.type==="file",ds=e=>typeof e=="function",Uh=e=>{if(!Ux)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Xp=e=>Fo(e),Kx=e=>e.type==="radio",Vh=e=>e instanceof RegExp;const b2={value:!1,isValid:!1},_2={value:!0,isValid:!0};var Y5=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Ht(e[0].attributes.value)?Ht(e[0].value)||e[0].value===""?_2:{value:e[0].value,isValid:!0}:_2:b2}return b2};const S2={isValid:!1,value:null};var G5=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,S2):S2;function E2(e,t,n="validate"){if(Xp(e)||Array.isArray(e)&&e.every(Xp)||No(e)&&!e)return{type:n,message:Xp(e)?e:"",ref:t}}var el=e=>sn(e)&&!Vh(e)?e:{value:e,message:""},C2=async(e,t,n,r,o)=>{const{ref:i,refs:s,required:l,maxLength:u,minLength:d,min:h,max:m,pattern:g,validate:y,name:x,valueAsNumber:_,mount:C,disabled:S}=e._f,b=ve(t,x);if(!C||S)return{};const E=s?s[0]:i,k=G=>{r&&E.reportValidity&&(E.setCustomValidity(No(G)?"":G||""),E.reportValidity())},P={},M=Kx(i),A=Bd(i),O=M||A,F=(_||Hx(i))&&Ht(i.value)&&Ht(b)||Uh(i)&&i.value===""||b===""||Array.isArray(b)&&!b.length,V=K5.bind(null,x,n,P),J=(G,ae,U,te=oi.maxLength,L=oi.minLength)=>{const ie=G?ae:U;P[x]={type:G?te:L,message:ie,ref:i,...V(G?te:L,ie)}};if(o?!Array.isArray(b)||!b.length:l&&(!O&&(F||Ln(b))||No(b)&&!b||A&&!Y5(s).isValid||M&&!G5(s).isValid)){const{value:G,message:ae}=Xp(l)?{value:!!l,message:l}:el(l);if(G&&(P[x]={type:oi.required,message:ae,ref:E,...V(oi.required,ae)},!n))return k(ae),P}if(!F&&(!Ln(h)||!Ln(m))){let G,ae;const U=el(m),te=el(h);if(!Ln(b)&&!isNaN(b)){const L=i.valueAsNumber||b&&+b;Ln(U.value)||(G=L>U.value),Ln(te.value)||(ae=Lnew Date(new Date().toDateString()+" "+W),K=i.type=="time",Q=i.type=="week";Fo(U.value)&&b&&(G=K?ie(b)>ie(U.value):Q?b>U.value:L>new Date(U.value)),Fo(te.value)&&b&&(ae=K?ie(b)+G.value,te=!Ln(ae.value)&&b.length<+ae.value;if((U||te)&&(J(U,G.message,ae.message),!n))return k(P[x].message),P}if(g&&!F&&Fo(b)){const{value:G,message:ae}=el(g);if(Vh(G)&&!b.match(G)&&(P[x]={type:oi.pattern,message:ae,ref:i,...V(oi.pattern,ae)},!n))return k(ae),P}if(y){if(ds(y)){const G=await y(b,t),ae=E2(G,E);if(ae&&(P[x]={...ae,...V(oi.validate,ae.message)},!n))return k(ae.message),P}else if(sn(y)){let G={};for(const ae in y){if(!Fr(G)&&!n)break;const U=E2(await y[ae](b,t),E,ae);U&&(G={...U,...V(ae,U.message)},k(U.message),n&&(P[x]=G))}if(!Fr(G)&&(P[x]={ref:E,...G},!n))return P}}return k(!0),P};function jG(e,t){const n=t.slice(0,-1).length;let r=0;for(;r{for(const i of e)i.next&&i.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(i=>i!==o)}}),unsubscribe:()=>{e=[]}}}var Wh=e=>Ln(e)||!L5(e);function ca(e,t){if(Wh(e)||Wh(t))return e===t;if(xl(e)&&xl(t))return e.getTime()===t.getTime();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n){const i=e[o];if(!r.includes(o))return!1;if(o!=="ref"){const s=t[o];if(xl(i)&&xl(s)||sn(i)&&sn(s)||Array.isArray(i)&&Array.isArray(s)?!ca(i,s):i!==s)return!1}}return!0}var X5=e=>e.type==="select-multiple",BG=e=>Kx(e)||Bd(e),P0=e=>Uh(e)&&e.isConnected,Z5=e=>{for(const t in e)if(ds(e[t]))return!0;return!1};function Hh(e,t={}){const n=Array.isArray(e);if(sn(e)||n)for(const r in e)Array.isArray(e[r])||sn(e[r])&&!Z5(e[r])?(t[r]=Array.isArray(e[r])?[]:{},Hh(e[r],t[r])):Ln(e[r])||(t[r]=!0);return t}function q5(e,t,n){const r=Array.isArray(e);if(sn(e)||r)for(const o in e)Array.isArray(e[o])||sn(e[o])&&!Z5(e[o])?Ht(t)||Wh(n[o])?n[o]=Array.isArray(e[o])?Hh(e[o],[]):{...Hh(e[o])}:q5(e[o],Ln(t)?{}:t[o],n[o]):n[o]=!ca(e[o],t[o]);return n}var A0=(e,t)=>q5(e,t,Hh(t)),Q5=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>Ht(e)?e:t?e===""?NaN:e&&+e:n&&Fo(e)?new Date(e):r?r(e):e;function O0(e){const t=e.ref;if(!(e.refs?e.refs.every(n=>n.disabled):t.disabled))return Hx(t)?t.files:Kx(t)?G5(e.refs).value:X5(t)?[...t.selectedOptions].map(({value:n})=>n):Bd(t)?Y5(e.refs).value:Q5(Ht(t.value)?e.ref.value:t.value,e)}var UG=(e,t,n,r)=>{const o={};for(const i of e){const s=ve(t,i);s&&wt(o,i,s._f)}return{criteriaMode:n,names:[...e],fields:o,shouldUseNativeValidation:r}},iu=e=>Ht(e)?e:Vh(e)?e.source:sn(e)?Vh(e.value)?e.value.source:e.value:e,VG=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function $2(e,t,n){const r=ve(e,n);if(r||Wx(n))return{error:r,name:n};const o=n.split(".");for(;o.length;){const i=o.join("."),s=ve(t,i),l=ve(e,i);if(s&&!Array.isArray(s)&&n!==i)return{name:n};if(l&&l.type)return{name:i,error:l};o.pop()}return{name:n}}var WG=(e,t,n,r,o)=>o.isOnAll?!1:!n&&o.isOnTouch?!(t||e):(n?r.isOnBlur:o.isOnBlur)?!e:(n?r.isOnChange:o.isOnChange)?e:!0,HG=(e,t)=>!Ud(ve(e,t)).length&&hn(e,t);const KG={mode:mo.onSubmit,reValidateMode:mo.onChange,shouldFocusError:!0};function YG(e={},t){let n={...KG,...e},r={submitCount:0,isDirty:!1,isLoading:ds(n.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},errors:{},disabled:!1},o={},i=sn(n.defaultValues)||sn(n.values)?so(n.defaultValues||n.values)||{}:{},s=n.shouldUnregister?{}:so(i),l={action:!1,mount:!1,watch:!1},u={mount:new Set,unMount:new Set,array:new Set,watch:new Set},d,h=0;const m={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},g={values:T0(),array:T0(),state:T0()},y=e.resetOptions&&e.resetOptions.keepDirtyValues,x=w2(n.mode),_=w2(n.reValidateMode),C=n.criteriaMode===mo.all,S=I=>X=>{clearTimeout(h),h=setTimeout(I,X)},b=async I=>{if(m.isValid||I){const X=n.resolver?Fr((await F()).errors):await J(o,!0);X!==r.isValid&&g.state.next({isValid:X})}},E=I=>m.isValidating&&g.state.next({isValidating:I}),k=(I,X=[],Z,we,he=!0,de=!0)=>{if(we&&Z){if(l.action=!0,de&&Array.isArray(ve(o,I))){const ke=Z(ve(o,I),we.argA,we.argB);he&&wt(o,I,ke)}if(de&&Array.isArray(ve(r.errors,I))){const ke=Z(ve(r.errors,I),we.argA,we.argB);he&&wt(r.errors,I,ke),HG(r.errors,I)}if(m.touchedFields&&de&&Array.isArray(ve(r.touchedFields,I))){const ke=Z(ve(r.touchedFields,I),we.argA,we.argB);he&&wt(r.touchedFields,I,ke)}m.dirtyFields&&(r.dirtyFields=A0(i,s)),g.state.next({name:I,isDirty:ae(I,X),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else wt(s,I,X)},P=(I,X)=>{wt(r.errors,I,X),g.state.next({errors:r.errors})},M=(I,X,Z,we)=>{const he=ve(o,I);if(he){const de=ve(s,I,Ht(Z)?ve(i,I):Z);Ht(de)||we&&we.defaultChecked||X?wt(s,I,X?de:O0(he._f)):L(I,de),l.mount&&b()}},A=(I,X,Z,we,he)=>{let de=!1,ke=!1;const ft={name:I};if(!Z||we){m.isDirty&&(ke=r.isDirty,r.isDirty=ft.isDirty=ae(),de=ke!==ft.isDirty);const pt=ca(ve(i,I),X);ke=ve(r.dirtyFields,I),pt?hn(r.dirtyFields,I):wt(r.dirtyFields,I,!0),ft.dirtyFields=r.dirtyFields,de=de||m.dirtyFields&&ke!==!pt}if(Z){const pt=ve(r.touchedFields,I);pt||(wt(r.touchedFields,I,Z),ft.touchedFields=r.touchedFields,de=de||m.touchedFields&&pt!==Z)}return de&&he&&g.state.next(ft),de?ft:{}},O=(I,X,Z,we)=>{const he=ve(r.errors,I),de=m.isValid&&No(X)&&r.isValid!==X;if(e.delayError&&Z?(d=S(()=>P(I,Z)),d(e.delayError)):(clearTimeout(h),d=null,Z?wt(r.errors,I,Z):hn(r.errors,I)),(Z?!ca(he,Z):he)||!Fr(we)||de){const ke={...we,...de&&No(X)?{isValid:X}:{},errors:r.errors,name:I};r={...r,...ke},g.state.next(ke)}E(!1)},F=async I=>n.resolver(s,n.context,UG(I||u.mount,o,n.criteriaMode,n.shouldUseNativeValidation)),V=async I=>{const{errors:X}=await F(I);if(I)for(const Z of I){const we=ve(X,Z);we?wt(r.errors,Z,we):hn(r.errors,Z)}else r.errors=X;return X},J=async(I,X,Z={valid:!0})=>{for(const we in I){const he=I[we];if(he){const{_f:de,...ke}=he;if(de){const ft=u.array.has(de.name),pt=await C2(he,s,C,n.shouldUseNativeValidation&&!X,ft);if(pt[de.name]&&(Z.valid=!1,X))break;!X&&(ve(pt,de.name)?ft?FG(r.errors,pt,de.name):wt(r.errors,de.name,pt[de.name]):hn(r.errors,de.name))}ke&&await J(ke,X,Z)}}return Z.valid},G=()=>{for(const I of u.unMount){const X=ve(o,I);X&&(X._f.refs?X._f.refs.every(Z=>!P0(Z)):!P0(X._f.ref))&&fe(I)}u.unMount=new Set},ae=(I,X)=>(I&&X&&wt(s,I,X),!ca(ge(),i)),U=(I,X,Z)=>W5(I,u,{...l.mount?s:Ht(X)?i:Fo(I)?{[I]:X}:X},Z,X),te=I=>Ud(ve(l.mount?s:i,I,e.shouldUnregister?ve(i,I,[]):[])),L=(I,X,Z={})=>{const we=ve(o,I);let he=X;if(we){const de=we._f;de&&(!de.disabled&&wt(s,I,Q5(X,de)),he=Uh(de.ref)&&Ln(X)?"":X,X5(de.ref)?[...de.ref.options].forEach(ke=>ke.selected=he.includes(ke.value)):de.refs?Bd(de.ref)?de.refs.length>1?de.refs.forEach(ke=>(!ke.defaultChecked||!ke.disabled)&&(ke.checked=Array.isArray(he)?!!he.find(ft=>ft===ke.value):he===ke.value)):de.refs[0]&&(de.refs[0].checked=!!he):de.refs.forEach(ke=>ke.checked=ke.value===he):Hx(de.ref)?de.ref.value="":(de.ref.value=he,de.ref.type||g.values.next({name:I,values:{...s}})))}(Z.shouldDirty||Z.shouldTouch)&&A(I,he,Z.shouldTouch,Z.shouldDirty,!0),Z.shouldValidate&&le(I)},ie=(I,X,Z)=>{for(const we in X){const he=X[we],de=`${I}.${we}`,ke=ve(o,de);(u.array.has(I)||!Wh(he)||ke&&!ke._f)&&!xl(he)?ie(de,he,Z):L(de,he,Z)}},K=(I,X,Z={})=>{const we=ve(o,I),he=u.array.has(I),de=so(X);wt(s,I,de),he?(g.array.next({name:I,values:{...s}}),(m.isDirty||m.dirtyFields)&&Z.shouldDirty&&g.state.next({name:I,dirtyFields:A0(i,s),isDirty:ae(I,de)})):we&&!we._f&&!Ln(de)?ie(I,de,Z):L(I,de,Z),x2(I,u)&&g.state.next({...r}),g.values.next({name:I,values:{...s}}),!l.mount&&t()},Q=async I=>{const X=I.target;let Z=X.name,we=!0;const he=ve(o,Z),de=()=>X.type?O0(he._f):F5(I),ke=ft=>{we=Number.isNaN(ft)||ft===ve(s,Z,ft)};if(he){let ft,pt;const bn=de(),Cr=I.type===Bh.BLUR||I.type===Bh.FOCUS_OUT,ki=!VG(he._f)&&!n.resolver&&!ve(r.errors,Z)&&!he._f.deps||WG(Cr,ve(r.touchedFields,Z),r.isSubmitted,_,x),_o=x2(Z,u,Cr);wt(s,Z,bn),Cr?(he._f.onBlur&&he._f.onBlur(I),d&&d(0)):he._f.onChange&&he._f.onChange(I);const Vn=A(Z,bn,Cr,!1),Da=!Fr(Vn)||_o;if(!Cr&&g.values.next({name:Z,type:I.type,values:{...s}}),ki)return m.isValid&&b(),Da&&g.state.next({name:Z,..._o?{}:Vn});if(!Cr&&_o&&g.state.next({...r}),E(!0),n.resolver){const{errors:Ri}=await F([Z]);if(ke(bn),we){const zs=$2(r.errors,o,Z),Ti=$2(Ri,o,zs.name||Z);ft=Ti.error,Z=Ti.name,pt=Fr(Ri)}}else ft=(await C2(he,s,C,n.shouldUseNativeValidation))[Z],ke(bn),we&&(ft?pt=!1:m.isValid&&(pt=await J(o,!0)));we&&(he._f.deps&&le(he._f.deps),O(Z,pt,ft,Vn))}},W=(I,X)=>{if(ve(r.errors,X)&&I.focus)return I.focus(),1},le=async(I,X={})=>{let Z,we;const he=Yp(I);if(E(!0),n.resolver){const de=await V(Ht(I)?I:he);Z=Fr(de),we=I?!he.some(ke=>ve(de,ke)):Z}else I?(we=(await Promise.all(he.map(async de=>{const ke=ve(o,de);return await J(ke&&ke._f?{[de]:ke}:ke)}))).every(Boolean),!(!we&&!r.isValid)&&b()):we=Z=await J(o);return g.state.next({...!Fo(I)||m.isValid&&Z!==r.isValid?{}:{name:I},...n.resolver||!I?{isValid:Z}:{},errors:r.errors,isValidating:!1}),X.shouldFocus&&!we&&Gp(o,W,I?he:u.mount),we},ge=I=>{const X={...i,...l.mount?s:{}};return Ht(I)?X:Fo(I)?ve(X,I):I.map(Z=>ve(X,Z))},Ve=(I,X)=>({invalid:!!ve((X||r).errors,I),isDirty:!!ve((X||r).dirtyFields,I),isTouched:!!ve((X||r).touchedFields,I),error:ve((X||r).errors,I)}),Ue=I=>{I&&Yp(I).forEach(X=>hn(r.errors,X)),g.state.next({errors:I?r.errors:{}})},We=(I,X,Z)=>{const we=(ve(o,I,{_f:{}})._f||{}).ref;wt(r.errors,I,{...X,ref:we}),g.state.next({name:I,errors:r.errors,isValid:!1}),Z&&Z.shouldFocus&&we&&we.focus&&we.focus()},Me=(I,X)=>ds(I)?g.values.subscribe({next:Z=>I(U(void 0,X),Z)}):U(I,X,!0),fe=(I,X={})=>{for(const Z of I?Yp(I):u.mount)u.mount.delete(Z),u.array.delete(Z),X.keepValue||(hn(o,Z),hn(s,Z)),!X.keepError&&hn(r.errors,Z),!X.keepDirty&&hn(r.dirtyFields,Z),!X.keepTouched&&hn(r.touchedFields,Z),!n.shouldUnregister&&!X.keepDefaultValue&&hn(i,Z);g.values.next({values:{...s}}),g.state.next({...r,...X.keepDirty?{isDirty:ae()}:{}}),!X.keepIsValid&&b()},xe=({disabled:I,name:X,field:Z,fields:we,value:he})=>{if(No(I)){const de=I?void 0:Ht(he)?O0(Z?Z._f:ve(we,X)._f):he;wt(s,X,de),A(X,de,!1,!1,!0)}},$e=(I,X={})=>{let Z=ve(o,I);const we=No(X.disabled);return wt(o,I,{...Z||{},_f:{...Z&&Z._f?Z._f:{ref:{name:I}},name:I,mount:!0,...X}}),u.mount.add(I),Z?xe({field:Z,disabled:X.disabled,name:I}):M(I,!0,X.value),{...we?{disabled:X.disabled}:{},...n.progressive?{required:!!X.required,min:iu(X.min),max:iu(X.max),minLength:iu(X.minLength),maxLength:iu(X.maxLength),pattern:iu(X.pattern)}:{},name:I,onChange:Q,onBlur:Q,ref:he=>{if(he){$e(I,X),Z=ve(o,I);const de=Ht(he.value)&&he.querySelectorAll&&he.querySelectorAll("input,select,textarea")[0]||he,ke=BG(de),ft=Z._f.refs||[];if(ke?ft.find(pt=>pt===de):de===Z._f.ref)return;wt(o,I,{_f:{...Z._f,...ke?{refs:[...ft.filter(P0),de,...Array.isArray(ve(i,I))?[{}]:[]],ref:{type:de.type,name:I}}:{ref:de}}}),M(I,!1,void 0,de)}else Z=ve(o,I,{}),Z._f&&(Z._f.mount=!1),(n.shouldUnregister||X.shouldUnregister)&&!(j5(u.array,I)&&l.action)&&u.unMount.add(I)}}},Ae=()=>n.shouldFocusError&&Gp(o,W,u.mount),Oe=I=>{No(I)&&(g.state.next({disabled:I}),Gp(o,X=>{X.disabled=I},0,!1))},je=(I,X)=>async Z=>{Z&&(Z.preventDefault&&Z.preventDefault(),Z.persist&&Z.persist());let we=so(s);if(g.state.next({isSubmitting:!0}),n.resolver){const{errors:he,values:de}=await F();r.errors=he,we=de}else await J(o);hn(r.errors,"root"),Fr(r.errors)?(g.state.next({errors:{}}),await I(we,Z)):(X&&await X({...r.errors},Z),Ae(),setTimeout(Ae)),g.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Fr(r.errors),submitCount:r.submitCount+1,errors:r.errors})},Ot=(I,X={})=>{ve(o,I)&&(Ht(X.defaultValue)?K(I,ve(i,I)):(K(I,X.defaultValue),wt(i,I,X.defaultValue)),X.keepTouched||hn(r.touchedFields,I),X.keepDirty||(hn(r.dirtyFields,I),r.isDirty=X.defaultValue?ae(I,ve(i,I)):ae()),X.keepError||(hn(r.errors,I),m.isValid&&b()),g.state.next({...r}))},ct=(I,X={})=>{const Z=I?so(I):i,we=so(Z),he=I&&!Fr(I)?we:i;if(X.keepDefaultValues||(i=Z),!X.keepValues){if(X.keepDirtyValues||y)for(const de of u.mount)ve(r.dirtyFields,de)?wt(he,de,ve(s,de)):K(de,ve(he,de));else{if(Ux&&Ht(I))for(const de of u.mount){const ke=ve(o,de);if(ke&&ke._f){const ft=Array.isArray(ke._f.refs)?ke._f.refs[0]:ke._f.ref;if(Uh(ft)){const pt=ft.closest("form");if(pt){pt.reset();break}}}}o={}}s=e.shouldUnregister?X.keepDefaultValues?so(i):{}:so(he),g.array.next({values:{...he}}),g.values.next({values:{...he}})}u={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},!l.mount&&t(),l.mount=!m.isValid||!!X.keepIsValid,l.watch=!!e.shouldUnregister,g.state.next({submitCount:X.keepSubmitCount?r.submitCount:0,isDirty:X.keepDirty?r.isDirty:!!(X.keepDefaultValues&&!ca(I,i)),isSubmitted:X.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:X.keepDirtyValues?r.dirtyFields:X.keepDefaultValues&&I?A0(i,I):{},touchedFields:X.keepTouched?r.touchedFields:{},errors:X.keepErrors?r.errors:{},isSubmitSuccessful:X.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1})},Yt=(I,X)=>ct(ds(I)?I(s):I,X);return{control:{register:$e,unregister:fe,getFieldState:Ve,handleSubmit:je,setError:We,_executeSchema:F,_getWatch:U,_getDirty:ae,_updateValid:b,_removeUnmounted:G,_updateFieldArray:k,_updateDisabledField:xe,_getFieldArray:te,_reset:ct,_resetDefaultValues:()=>ds(n.defaultValues)&&n.defaultValues().then(I=>{Yt(I,n.resetOptions),g.state.next({isLoading:!1})}),_updateFormState:I=>{r={...r,...I}},_disableForm:Oe,_subjects:g,_proxyFormState:m,get _fields(){return o},get _formValues(){return s},get _state(){return l},set _state(I){l=I},get _defaultValues(){return i},get _names(){return u},set _names(I){u=I},get _formState(){return r},set _formState(I){r=I},get _options(){return n},set _options(I){n={...n,...I}}},trigger:le,register:$e,handleSubmit:je,watch:Me,setValue:K,getValues:ge,reset:Yt,resetField:Ot,clearErrors:Ue,unregister:fe,setError:We,setFocus:(I,X={})=>{const Z=ve(o,I),we=Z&&Z._f;if(we){const he=we.refs?we.refs[0]:we.ref;he.focus&&(he.focus(),X.shouldSelect&&he.select())}},getFieldState:Ve}}function GG(e={}){const t=Fe.useRef(),n=Fe.useRef(),[r,o]=Fe.useState({isDirty:!1,isValidating:!1,isLoading:ds(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},errors:{},disabled:!1,defaultValues:ds(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...YG(e,()=>o(s=>({...s}))),formState:r});const i=t.current.control;return i._options=e,Vx({subject:i._subjects.state,next:s=>{U5(s,i._proxyFormState,i._updateFormState,!0)&&o({...i._formState})}}),Fe.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),Fe.useEffect(()=>{if(i._proxyFormState.isDirty){const s=i._getDirty();s!==r.isDirty&&i._subjects.state.next({isDirty:s})}},[i,r.isDirty]),Fe.useEffect(()=>{e.values&&!ca(e.values,n.current)?(i._reset(e.values,i._options.resetOptions),n.current=e.values):i._resetDefaultValues()},[e.values,i]),Fe.useEffect(()=>{i._state.mount||(i._updateValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),t.current.formState=B5(r,i),t.current}var k2=function(e,t,n){if(e&&"reportValidity"in e){var r=ve(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},J5=function(e,t){var n=function(o){var i=t.fields[o];i&&i.ref&&"reportValidity"in i.ref?k2(i.ref,o,e):i.refs&&i.refs.forEach(function(s){return k2(s,o,e)})};for(var r in t.fields)n(r)},XG=function(e,t){t.shouldUseNativeValidation&&J5(e,t);var n={};for(var r in e){var o=ve(t.fields,r),i=Object.assign(e[r]||{},{ref:o&&o.ref});if(qG(t.names||Object.keys(e),r)){var s=Object.assign({},ZG(ve(n,r)));wt(s,"root",i),wt(n,r,s)}else wt(n,r,i)}return n},ZG=function(e){return Array.isArray(e)?e.filter(Boolean):[]},qG=function(e,t){return e.some(function(n){return n.startsWith(t+".")})},QG=function(e,t){for(var n={};e.length;){var r=e[0],o=r.code,i=r.message,s=r.path.join(".");if(!n[s])if("unionErrors"in r){var l=r.unionErrors[0].errors[0];n[s]={message:l.message,type:l.code}}else n[s]={message:i,type:o};if("unionErrors"in r&&r.unionErrors.forEach(function(h){return h.errors.forEach(function(m){return e.push(m)})}),t){var u=n[s].types,d=u&&u[r.code];n[s]=K5(s,t,n,o,d?[].concat(d,r.message):r.message)}e.shift()}return n},JG=function(e,t,n){return n===void 0&&(n={}),function(r,o,i){try{return Promise.resolve(function(s,l){try{var u=Promise.resolve(e[n.mode==="sync"?"parse":"parseAsync"](r,t)).then(function(d){return i.shouldUseNativeValidation&&J5({},i),{errors:{},values:n.raw?r:d}})}catch(d){return l(d)}return u&&u.then?u.then(void 0,l):u}(0,function(s){if(function(l){return l.errors!=null}(s))return{values:{},errors:XG(QG(s.errors,!i.shouldUseNativeValidation&&i.criteriaMode==="all"),i)};throw s}))}catch(s){return Promise.reject(s)}}},mt;(function(e){e.assertEqual=o=>o;function t(o){}e.assertIs=t;function n(o){throw new Error}e.assertNever=n,e.arrayToEnum=o=>{const i={};for(const s of o)i[s]=s;return i},e.getValidEnumValues=o=>{const i=e.objectKeys(o).filter(l=>typeof o[o[l]]!="number"),s={};for(const l of i)s[l]=o[l];return e.objectValues(s)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const i=[];for(const s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},e.find=(o,i)=>{for(const s of o)if(i(s))return s},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&isFinite(o)&&Math.floor(o)===o;function r(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}e.joinValues=r,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(mt||(mt={}));var R2;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(R2||(R2={}));const be=mt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ta=e=>{switch(typeof e){case"undefined":return be.undefined;case"string":return be.string;case"number":return isNaN(e)?be.nan:be.number;case"boolean":return be.boolean;case"function":return be.function;case"bigint":return be.bigint;case"symbol":return be.symbol;case"object":return Array.isArray(e)?be.array:e===null?be.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?be.promise:typeof Map<"u"&&e instanceof Map?be.map:typeof Set<"u"&&e instanceof Set?be.set:typeof Date<"u"&&e instanceof Date?be.date:be.object;default:return be.unknown}},pe=mt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Bo extends Error{constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const n=t||function(i){return i.message},r={_errors:[]},o=i=>{for(const s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let l=r,u=0;for(;un.message){const n={},r=[];for(const o of this.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Bo.create=e=>new Bo(e);const Kh=(e,t)=>{let n;switch(e.code){case pe.invalid_type:e.received===be.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case pe.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,mt.jsonStringifyReplacer)}`;break;case pe.unrecognized_keys:n=`Unrecognized key(s) in object: ${mt.joinValues(e.keys,", ")}`;break;case pe.invalid_union:n="Invalid input";break;case pe.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${mt.joinValues(e.options)}`;break;case pe.invalid_enum_value:n=`Invalid enum value. Expected ${mt.joinValues(e.options)}, received '${e.received}'`;break;case pe.invalid_arguments:n="Invalid function arguments";break;case pe.invalid_return_type:n="Invalid function return type";break;case pe.invalid_date:n="Invalid date";break;case pe.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:mt.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case pe.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case pe.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case pe.custom:n="Invalid input";break;case pe.invalid_intersection_types:n="Intersection results could not be merged";break;case pe.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case pe.not_finite:n="Number must be finite";break;default:n=t.defaultError,mt.assertNever(e)}return{message:n}};let eX=Kh;function S1(){return eX}const E1=e=>{const{data:t,path:n,errorMaps:r,issueData:o}=e,i=[...n,...o.path||[]],s={...o,path:i};let l="";const u=r.filter(d=>!!d).slice().reverse();for(const d of u)l=d(s,{data:t,defaultError:l}).message;return{...o,path:i,message:o.message||l}};function Ee(e,t){const n=E1({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,S1(),Kh].filter(r=>!!r)});e.common.issues.push(n)}class zn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const o of n){if(o.status==="aborted")return Ze;o.status==="dirty"&&t.dirty(),r.push(o.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const o of n)r.push({key:await o.key,value:await o.value});return zn.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const o of n){const{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return Ze;i.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(r[i.value]=s.value)}return{status:t.value,value:r}}}const Ze=Object.freeze({status:"aborted"}),tX=e=>({status:"dirty",value:e}),rr=e=>({status:"valid",value:e}),T2=e=>e.status==="aborted",P2=e=>e.status==="dirty",Yh=e=>e.status==="valid",C1=e=>typeof Promise<"u"&&e instanceof Promise;var Ne;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(Ne||(Ne={}));class Ko{constructor(t,n,r,o){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=o}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const A2=(e,t)=>{if(Yh(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Bo(e.common.issues);return this._error=n,this._error}}};function Xe(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:o}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(s,l)=>s.code!=="invalid_type"?{message:l.defaultError}:typeof l.data>"u"?{message:r??l.defaultError}:{message:n??l.defaultError},description:o}}class rt{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return ta(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:ta(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new zn,ctx:{common:t.parent.common,data:t.data,parsedType:ta(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(C1(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){var r;const o={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ta(t)},i=this._parseSync({data:t,path:o.path,parent:o});return A2(o,i)}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ta(t)},o=this._parse({data:t,path:r.path,parent:r}),i=await(C1(o)?o:Promise.resolve(o));return A2(r,i)}refine(t,n){const r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,i)=>{const s=t(o),l=()=>i.addIssue({code:pe.custom,...r(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(u=>u?!0:(l(),!1)):s?!0:(l(),!1)})}refinement(t,n){return this._refinement((r,o)=>t(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(t){return new Si({schema:this,typeName:ze.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return bs.create(this,this._def)}nullable(){return uc.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Uo.create(this,this._def)}promise(){return ad.create(this,this._def)}or(t){return Zh.create([this,t],this._def)}and(t){return qh.create(this,t,this._def)}transform(t){return new Si({...Xe(this._def),schema:this,typeName:ze.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new nm({...Xe(this._def),innerType:this,defaultValue:n,typeName:ze.ZodDefault})}brand(){return new pX({typeName:ze.ZodBranded,type:this,...Xe(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new O1({...Xe(this._def),innerType:this,catchValue:n,typeName:ze.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return sg.create(this,t)}readonly(){return N1.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const nX=/^c[^\s-]{8,}$/i,rX=/^[a-z][a-z0-9]*$/,oX=/^[0-9A-HJKMNP-TV-Z]{26}$/,iX=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,sX=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,aX="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let M0;const lX=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,cX=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,uX=e=>e.precision?e.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}Z$`):e.precision===0?e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function dX(e,t){return!!((t==="v4"||!t)&&lX.test(e)||(t==="v6"||!t)&&cX.test(e))}class di extends rt{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==be.string){const i=this._getOrReturnCtx(t);return Ee(i,{code:pe.invalid_type,expected:be.string,received:i.parsedType}),Ze}const r=new zn;let o;for(const i of this._def.checks)if(i.kind==="min")t.data.lengthi.value&&(o=this._getOrReturnCtx(t,o),Ee(o,{code:pe.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const s=t.data.length>i.value,l=t.data.lengtht.test(o),{validation:n,code:pe.invalid_string,...Ne.errToObj(r)})}_addCheck(t){return new di({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Ne.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Ne.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Ne.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Ne.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Ne.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Ne.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Ne.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Ne.errToObj(t)})}datetime(t){var n;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(n=t==null?void 0:t.offset)!==null&&n!==void 0?n:!1,...Ne.errToObj(t==null?void 0:t.message)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...Ne.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...Ne.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...Ne.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...Ne.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...Ne.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...Ne.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...Ne.errToObj(n)})}nonempty(t){return this.min(1,Ne.errToObj(t))}trim(){return new di({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new di({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new di({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new di({checks:[],typeName:ze.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Xe(e)})};function fX(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r,i=parseInt(e.toFixed(o).replace(".","")),s=parseInt(t.toFixed(o).replace(".",""));return i%s/Math.pow(10,o)}class ac extends rt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==be.number){const i=this._getOrReturnCtx(t);return Ee(i,{code:pe.invalid_type,expected:be.number,received:i.parsedType}),Ze}let r;const o=new zn;for(const i of this._def.checks)i.kind==="int"?mt.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),Ee(r,{code:pe.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.datai.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),Ee(r,{code:pe.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?fX(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),Ee(r,{code:pe.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),Ee(r,{code:pe.not_finite,message:i.message}),o.dirty()):mt.assertNever(i);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,Ne.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Ne.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Ne.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Ne.toString(n))}setLimit(t,n,r,o){return new ac({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Ne.toString(o)}]})}_addCheck(t){return new ac({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Ne.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ne.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ne.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ne.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ne.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Ne.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:Ne.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ne.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ne.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuet.kind==="int"||t.kind==="multipleOf"&&mt.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.valuenew ac({checks:[],typeName:ze.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Xe(e)});class lc extends rt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==be.bigint){const i=this._getOrReturnCtx(t);return Ee(i,{code:pe.invalid_type,expected:be.bigint,received:i.parsedType}),Ze}let r;const o=new zn;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?t.datai.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),Ee(r,{code:pe.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),Ee(r,{code:pe.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):mt.assertNever(i);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,Ne.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Ne.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Ne.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Ne.toString(n))}setLimit(t,n,r,o){return new lc({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Ne.toString(o)}]})}_addCheck(t){return new lc({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ne.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ne.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ne.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ne.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Ne.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new lc({checks:[],typeName:ze.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Xe(e)})};class $1 extends rt{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==be.boolean){const r=this._getOrReturnCtx(t);return Ee(r,{code:pe.invalid_type,expected:be.boolean,received:r.parsedType}),Ze}return rr(t.data)}}$1.create=e=>new $1({typeName:ze.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Xe(e)});class sd extends rt{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==be.date){const i=this._getOrReturnCtx(t);return Ee(i,{code:pe.invalid_type,expected:be.date,received:i.parsedType}),Ze}if(isNaN(t.data.getTime())){const i=this._getOrReturnCtx(t);return Ee(i,{code:pe.invalid_date}),Ze}const r=new zn;let o;for(const i of this._def.checks)i.kind==="min"?t.data.getTime()i.value&&(o=this._getOrReturnCtx(t,o),Ee(o,{code:pe.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):mt.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new sd({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:Ne.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:Ne.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuenew sd({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:ze.ZodDate,...Xe(e)});class k1 extends rt{_parse(t){if(this._getType(t)!==be.symbol){const r=this._getOrReturnCtx(t);return Ee(r,{code:pe.invalid_type,expected:be.symbol,received:r.parsedType}),Ze}return rr(t.data)}}k1.create=e=>new k1({typeName:ze.ZodSymbol,...Xe(e)});class Gh extends rt{_parse(t){if(this._getType(t)!==be.undefined){const r=this._getOrReturnCtx(t);return Ee(r,{code:pe.invalid_type,expected:be.undefined,received:r.parsedType}),Ze}return rr(t.data)}}Gh.create=e=>new Gh({typeName:ze.ZodUndefined,...Xe(e)});class Xh extends rt{_parse(t){if(this._getType(t)!==be.null){const r=this._getOrReturnCtx(t);return Ee(r,{code:pe.invalid_type,expected:be.null,received:r.parsedType}),Ze}return rr(t.data)}}Xh.create=e=>new Xh({typeName:ze.ZodNull,...Xe(e)});class R1 extends rt{constructor(){super(...arguments),this._any=!0}_parse(t){return rr(t.data)}}R1.create=e=>new R1({typeName:ze.ZodAny,...Xe(e)});class Tl extends rt{constructor(){super(...arguments),this._unknown=!0}_parse(t){return rr(t.data)}}Tl.create=e=>new Tl({typeName:ze.ZodUnknown,...Xe(e)});class Rs extends rt{_parse(t){const n=this._getOrReturnCtx(t);return Ee(n,{code:pe.invalid_type,expected:be.never,received:n.parsedType}),Ze}}Rs.create=e=>new Rs({typeName:ze.ZodNever,...Xe(e)});class T1 extends rt{_parse(t){if(this._getType(t)!==be.undefined){const r=this._getOrReturnCtx(t);return Ee(r,{code:pe.invalid_type,expected:be.void,received:r.parsedType}),Ze}return rr(t.data)}}T1.create=e=>new T1({typeName:ze.ZodVoid,...Xe(e)});class Uo extends rt{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),o=this._def;if(n.parsedType!==be.array)return Ee(n,{code:pe.invalid_type,expected:be.array,received:n.parsedType}),Ze;if(o.exactLength!==null){const s=n.data.length>o.exactLength.value,l=n.data.lengtho.maxLength.value&&(Ee(n,{code:pe.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((s,l)=>o.type._parseAsync(new Ko(n,s,n.path,l)))).then(s=>zn.mergeArray(r,s));const i=[...n.data].map((s,l)=>o.type._parseSync(new Ko(n,s,n.path,l)));return zn.mergeArray(r,i)}get element(){return this._def.type}min(t,n){return new Uo({...this._def,minLength:{value:t,message:Ne.toString(n)}})}max(t,n){return new Uo({...this._def,maxLength:{value:t,message:Ne.toString(n)}})}length(t,n){return new Uo({...this._def,exactLength:{value:t,message:Ne.toString(n)}})}nonempty(t){return this.min(1,t)}}Uo.create=(e,t)=>new Uo({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ze.ZodArray,...Xe(t)});function ol(e){if(e instanceof Vt){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=bs.create(ol(r))}return new Vt({...e._def,shape:()=>t})}else return e instanceof Uo?new Uo({...e._def,type:ol(e.element)}):e instanceof bs?bs.create(ol(e.unwrap())):e instanceof uc?uc.create(ol(e.unwrap())):e instanceof _i?_i.create(e.items.map(t=>ol(t))):e}class Vt extends rt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=mt.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==be.object){const d=this._getOrReturnCtx(t);return Ee(d,{code:pe.invalid_type,expected:be.object,received:d.parsedType}),Ze}const{status:r,ctx:o}=this._processInputParams(t),{shape:i,keys:s}=this._getCached(),l=[];if(!(this._def.catchall instanceof Rs&&this._def.unknownKeys==="strip"))for(const d in o.data)s.includes(d)||l.push(d);const u=[];for(const d of s){const h=i[d],m=o.data[d];u.push({key:{status:"valid",value:d},value:h._parse(new Ko(o,m,o.path,d)),alwaysSet:d in o.data})}if(this._def.catchall instanceof Rs){const d=this._def.unknownKeys;if(d==="passthrough")for(const h of l)u.push({key:{status:"valid",value:h},value:{status:"valid",value:o.data[h]}});else if(d==="strict")l.length>0&&(Ee(o,{code:pe.unrecognized_keys,keys:l}),r.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const h of l){const m=o.data[h];u.push({key:{status:"valid",value:h},value:d._parse(new Ko(o,m,o.path,h)),alwaysSet:h in o.data})}}return o.common.async?Promise.resolve().then(async()=>{const d=[];for(const h of u){const m=await h.key;d.push({key:m,value:await h.value,alwaysSet:h.alwaysSet})}return d}).then(d=>zn.mergeObjectSync(r,d)):zn.mergeObjectSync(r,u)}get shape(){return this._def.shape()}strict(t){return Ne.errToObj,new Vt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var o,i,s,l;const u=(s=(i=(o=this._def).errorMap)===null||i===void 0?void 0:i.call(o,n,r).message)!==null&&s!==void 0?s:r.defaultError;return n.code==="unrecognized_keys"?{message:(l=Ne.errToObj(t).message)!==null&&l!==void 0?l:u}:{message:u}}}:{}})}strip(){return new Vt({...this._def,unknownKeys:"strip"})}passthrough(){return new Vt({...this._def,unknownKeys:"passthrough"})}extend(t){return new Vt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Vt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:ze.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new Vt({...this._def,catchall:t})}pick(t){const n={};return mt.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new Vt({...this._def,shape:()=>n})}omit(t){const n={};return mt.objectKeys(this.shape).forEach(r=>{t[r]||(n[r]=this.shape[r])}),new Vt({...this._def,shape:()=>n})}deepPartial(){return ol(this)}partial(t){const n={};return mt.objectKeys(this.shape).forEach(r=>{const o=this.shape[r];t&&!t[r]?n[r]=o:n[r]=o.optional()}),new Vt({...this._def,shape:()=>n})}required(t){const n={};return mt.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof bs;)i=i._def.innerType;n[r]=i}}),new Vt({...this._def,shape:()=>n})}keyof(){return e3(mt.objectKeys(this.shape))}}Vt.create=(e,t)=>new Vt({shape:()=>e,unknownKeys:"strip",catchall:Rs.create(),typeName:ze.ZodObject,...Xe(t)});Vt.strictCreate=(e,t)=>new Vt({shape:()=>e,unknownKeys:"strict",catchall:Rs.create(),typeName:ze.ZodObject,...Xe(t)});Vt.lazycreate=(e,t)=>new Vt({shape:e,unknownKeys:"strip",catchall:Rs.create(),typeName:ze.ZodObject,...Xe(t)});class Zh extends rt{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function o(i){for(const l of i)if(l.result.status==="valid")return l.result;for(const l of i)if(l.result.status==="dirty")return n.common.issues.push(...l.ctx.common.issues),l.result;const s=i.map(l=>new Bo(l.ctx.common.issues));return Ee(n,{code:pe.invalid_union,unionErrors:s}),Ze}if(n.common.async)return Promise.all(r.map(async i=>{const s={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(o);{let i;const s=[];for(const u of r){const d={...n,common:{...n.common,issues:[]},parent:null},h=u._parseSync({data:n.data,path:n.path,parent:d});if(h.status==="valid")return h;h.status==="dirty"&&!i&&(i={result:h,ctx:d}),d.common.issues.length&&s.push(d.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const l=s.map(u=>new Bo(u));return Ee(n,{code:pe.invalid_union,unionErrors:l}),Ze}}get options(){return this._def.options}}Zh.create=(e,t)=>new Zh({options:e,typeName:ze.ZodUnion,...Xe(t)});const Zp=e=>e instanceof Jh?Zp(e.schema):e instanceof Si?Zp(e.innerType()):e instanceof em?[e.value]:e instanceof Ta?e.options:e instanceof tm?Object.keys(e.enum):e instanceof nm?Zp(e._def.innerType):e instanceof Gh?[void 0]:e instanceof Xh?[null]:null;class Yx extends rt{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==be.object)return Ee(n,{code:pe.invalid_type,expected:be.object,received:n.parsedType}),Ze;const r=this.discriminator,o=n.data[r],i=this.optionsMap.get(o);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(Ee(n,{code:pe.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Ze)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const o=new Map;for(const i of n){const s=Zp(i.shape[t]);if(!s)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const l of s){if(o.has(l))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(l)}`);o.set(l,i)}}return new Yx({typeName:ze.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:o,...Xe(r)})}}function P1(e,t){const n=ta(e),r=ta(t);if(e===t)return{valid:!0,data:e};if(n===be.object&&r===be.object){const o=mt.objectKeys(t),i=mt.objectKeys(e).filter(l=>o.indexOf(l)!==-1),s={...e,...t};for(const l of i){const u=P1(e[l],t[l]);if(!u.valid)return{valid:!1};s[l]=u.data}return{valid:!0,data:s}}else if(n===be.array&&r===be.array){if(e.length!==t.length)return{valid:!1};const o=[];for(let i=0;i{if(T2(i)||T2(s))return Ze;const l=P1(i.value,s.value);return l.valid?((P2(i)||P2(s))&&n.dirty(),{status:n.value,value:l.data}):(Ee(r,{code:pe.invalid_intersection_types}),Ze)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,s])=>o(i,s)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}qh.create=(e,t,n)=>new qh({left:e,right:t,typeName:ze.ZodIntersection,...Xe(n)});class _i extends rt{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==be.array)return Ee(r,{code:pe.invalid_type,expected:be.array,received:r.parsedType}),Ze;if(r.data.lengththis._def.items.length&&(Ee(r,{code:pe.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((s,l)=>{const u=this._def.items[l]||this._def.rest;return u?u._parse(new Ko(r,s,r.path,l)):null}).filter(s=>!!s);return r.common.async?Promise.all(i).then(s=>zn.mergeArray(n,s)):zn.mergeArray(n,i)}get items(){return this._def.items}rest(t){return new _i({...this._def,rest:t})}}_i.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new _i({items:e,typeName:ze.ZodTuple,rest:null,...Xe(t)})};class Qh extends rt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==be.object)return Ee(r,{code:pe.invalid_type,expected:be.object,received:r.parsedType}),Ze;const o=[],i=this._def.keyType,s=this._def.valueType;for(const l in r.data)o.push({key:i._parse(new Ko(r,l,r.path,l)),value:s._parse(new Ko(r,r.data[l],r.path,l))});return r.common.async?zn.mergeObjectAsync(n,o):zn.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof rt?new Qh({keyType:t,valueType:n,typeName:ze.ZodRecord,...Xe(r)}):new Qh({keyType:di.create(),valueType:t,typeName:ze.ZodRecord,...Xe(n)})}}class A1 extends rt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==be.map)return Ee(r,{code:pe.invalid_type,expected:be.map,received:r.parsedType}),Ze;const o=this._def.keyType,i=this._def.valueType,s=[...r.data.entries()].map(([l,u],d)=>({key:o._parse(new Ko(r,l,r.path,[d,"key"])),value:i._parse(new Ko(r,u,r.path,[d,"value"]))}));if(r.common.async){const l=new Map;return Promise.resolve().then(async()=>{for(const u of s){const d=await u.key,h=await u.value;if(d.status==="aborted"||h.status==="aborted")return Ze;(d.status==="dirty"||h.status==="dirty")&&n.dirty(),l.set(d.value,h.value)}return{status:n.value,value:l}})}else{const l=new Map;for(const u of s){const d=u.key,h=u.value;if(d.status==="aborted"||h.status==="aborted")return Ze;(d.status==="dirty"||h.status==="dirty")&&n.dirty(),l.set(d.value,h.value)}return{status:n.value,value:l}}}}A1.create=(e,t,n)=>new A1({valueType:t,keyType:e,typeName:ze.ZodMap,...Xe(n)});class cc extends rt{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==be.set)return Ee(r,{code:pe.invalid_type,expected:be.set,received:r.parsedType}),Ze;const o=this._def;o.minSize!==null&&r.data.sizeo.maxSize.value&&(Ee(r,{code:pe.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());const i=this._def.valueType;function s(u){const d=new Set;for(const h of u){if(h.status==="aborted")return Ze;h.status==="dirty"&&n.dirty(),d.add(h.value)}return{status:n.value,value:d}}const l=[...r.data.values()].map((u,d)=>i._parse(new Ko(r,u,r.path,d)));return r.common.async?Promise.all(l).then(u=>s(u)):s(l)}min(t,n){return new cc({...this._def,minSize:{value:t,message:Ne.toString(n)}})}max(t,n){return new cc({...this._def,maxSize:{value:t,message:Ne.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}cc.create=(e,t)=>new cc({valueType:e,minSize:null,maxSize:null,typeName:ze.ZodSet,...Xe(t)});class Pu extends rt{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==be.function)return Ee(n,{code:pe.invalid_type,expected:be.function,received:n.parsedType}),Ze;function r(l,u){return E1({data:l,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,S1(),Kh].filter(d=>!!d),issueData:{code:pe.invalid_arguments,argumentsError:u}})}function o(l,u){return E1({data:l,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,S1(),Kh].filter(d=>!!d),issueData:{code:pe.invalid_return_type,returnTypeError:u}})}const i={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof ad){const l=this;return rr(async function(...u){const d=new Bo([]),h=await l._def.args.parseAsync(u,i).catch(y=>{throw d.addIssue(r(u,y)),d}),m=await Reflect.apply(s,this,h);return await l._def.returns._def.type.parseAsync(m,i).catch(y=>{throw d.addIssue(o(m,y)),d})})}else{const l=this;return rr(function(...u){const d=l._def.args.safeParse(u,i);if(!d.success)throw new Bo([r(u,d.error)]);const h=Reflect.apply(s,this,d.data),m=l._def.returns.safeParse(h,i);if(!m.success)throw new Bo([o(h,m.error)]);return m.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new Pu({...this._def,args:_i.create(t).rest(Tl.create())})}returns(t){return new Pu({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new Pu({args:t||_i.create([]).rest(Tl.create()),returns:n||Tl.create(),typeName:ze.ZodFunction,...Xe(r)})}}class Jh extends rt{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Jh.create=(e,t)=>new Jh({getter:e,typeName:ze.ZodLazy,...Xe(t)});class em extends rt{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return Ee(n,{received:n.data,code:pe.invalid_literal,expected:this._def.value}),Ze}return{status:"valid",value:t.data}}get value(){return this._def.value}}em.create=(e,t)=>new em({value:e,typeName:ze.ZodLiteral,...Xe(t)});function e3(e,t){return new Ta({values:e,typeName:ze.ZodEnum,...Xe(t)})}class Ta extends rt{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return Ee(n,{expected:mt.joinValues(r),received:n.parsedType,code:pe.invalid_type}),Ze}if(this._def.values.indexOf(t.data)===-1){const n=this._getOrReturnCtx(t),r=this._def.values;return Ee(n,{received:n.data,code:pe.invalid_enum_value,options:r}),Ze}return rr(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t){return Ta.create(t)}exclude(t){return Ta.create(this.options.filter(n=>!t.includes(n)))}}Ta.create=e3;class tm extends rt{_parse(t){const n=mt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==be.string&&r.parsedType!==be.number){const o=mt.objectValues(n);return Ee(r,{expected:mt.joinValues(o),received:r.parsedType,code:pe.invalid_type}),Ze}if(n.indexOf(t.data)===-1){const o=mt.objectValues(n);return Ee(r,{received:r.data,code:pe.invalid_enum_value,options:o}),Ze}return rr(t.data)}get enum(){return this._def.values}}tm.create=(e,t)=>new tm({values:e,typeName:ze.ZodNativeEnum,...Xe(t)});class ad extends rt{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==be.promise&&n.common.async===!1)return Ee(n,{code:pe.invalid_type,expected:be.promise,received:n.parsedType}),Ze;const r=n.parsedType===be.promise?n.data:Promise.resolve(n.data);return rr(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}}ad.create=(e,t)=>new ad({type:e,typeName:ze.ZodPromise,...Xe(t)});class Si extends rt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ze.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:s=>{Ee(r,s),s.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){const s=o.transform(r.data,i);return r.common.issues.length?{status:"dirty",value:r.data}:r.common.async?Promise.resolve(s).then(l=>this._def.schema._parseAsync({data:l,path:r.path,parent:r})):this._def.schema._parseSync({data:s,path:r.path,parent:r})}if(o.type==="refinement"){const s=l=>{const u=o.refinement(l,i);if(r.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l};if(r.common.async===!1){const l=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return l.status==="aborted"?Ze:(l.status==="dirty"&&n.dirty(),s(l.value),{status:n.value,value:l.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(l=>l.status==="aborted"?Ze:(l.status==="dirty"&&n.dirty(),s(l.value).then(()=>({status:n.value,value:l.value}))))}if(o.type==="transform")if(r.common.async===!1){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Yh(s))return s;const l=o.transform(s.value,i);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:l}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>Yh(s)?Promise.resolve(o.transform(s.value,i)).then(l=>({status:n.value,value:l})):s);mt.assertNever(o)}}Si.create=(e,t,n)=>new Si({schema:e,typeName:ze.ZodEffects,effect:t,...Xe(n)});Si.createWithPreprocess=(e,t,n)=>new Si({schema:t,effect:{type:"preprocess",transform:e},typeName:ze.ZodEffects,...Xe(n)});class bs extends rt{_parse(t){return this._getType(t)===be.undefined?rr(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}bs.create=(e,t)=>new bs({innerType:e,typeName:ze.ZodOptional,...Xe(t)});class uc extends rt{_parse(t){return this._getType(t)===be.null?rr(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}uc.create=(e,t)=>new uc({innerType:e,typeName:ze.ZodNullable,...Xe(t)});class nm extends rt{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===be.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}nm.create=(e,t)=>new nm({innerType:e,typeName:ze.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Xe(t)});class O1 extends rt{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return C1(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Bo(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Bo(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}O1.create=(e,t)=>new O1({innerType:e,typeName:ze.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Xe(t)});class M1 extends rt{_parse(t){if(this._getType(t)!==be.nan){const r=this._getOrReturnCtx(t);return Ee(r,{code:pe.invalid_type,expected:be.nan,received:r.parsedType}),Ze}return{status:"valid",value:t.data}}}M1.create=e=>new M1({typeName:ze.ZodNaN,...Xe(e)});class pX extends rt{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class sg extends rt{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Ze:i.status==="dirty"?(n.dirty(),tX(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?Ze:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(t,n){return new sg({in:t,out:n,typeName:ze.ZodPipeline})}}class N1 extends rt{_parse(t){const n=this._def.innerType._parse(t);return Yh(n)&&(n.value=Object.freeze(n.value)),n}}N1.create=(e,t)=>new N1({innerType:e,typeName:ze.ZodReadonly,...Xe(t)});Vt.lazycreate;var ze;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(ze||(ze={}));const O2=di.create;ac.create;M1.create;lc.create;const su=$1.create;sd.create;k1.create;Gh.create;Xh.create;R1.create;Tl.create;Rs.create;T1.create;Uo.create;const hX=Vt.create;Vt.strictCreate;Zh.create;Yx.create;qh.create;_i.create;Qh.create;A1.create;cc.create;Pu.create;Jh.create;em.create;Ta.create;tm.create;ad.create;Si.create;bs.create;uc.create;Si.createWithPreprocess;sg.create;const D1="horizontal",mX=["horizontal","vertical"],t3=f.forwardRef((e,t)=>{const{decorative:n,orientation:r=D1,...o}=e,i=n3(r)?r:D1,l=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return f.createElement(Pe.div,Y({"data-orientation":i},l,o,{ref:t}))});t3.propTypes={orientation(e,t,n){const r=e[t],o=String(r);return r&&!n3(r)?new Error(gX(o,n)):null}};function gX(e,t){return`Invalid prop \`orientation\` of value \`${e}\` supplied to \`${t}\`, expected one of:
- - horizontal
- - vertical
-
-Defaulting to \`${D1}\`.`}function n3(e){return mX.includes(e)}const r3=t3,Fn=f.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...r},o)=>v.jsx(r3,{ref:o,decorative:n,orientation:t,className:Ce("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...r}));Fn.displayName=r3.displayName;const vX=f.forwardRef((e,t)=>f.createElement(Pe.label,Y({},e,{ref:t,onMouseDown:n=>{var r;(r=e.onMouseDown)===null||r===void 0||r.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault()}}))),o3=vX,yX=Om("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Gx=f.forwardRef(({className:e,disabled:t,...n},r)=>v.jsx(o3,{ref:r,className:Ce(yX(),e,t?"opacity-50":"","select-none"),...n}));Gx.displayName=o3.displayName;const wX=MG,i3=f.createContext({}),N0=({...e})=>v.jsx(i3.Provider,{value:{name:e.name},children:v.jsx(LG,{...e})}),ag=()=>{const e=f.useContext(i3),t=f.useContext(s3),{getFieldState:n,formState:r}=ig(),o=n(e.name,r);if(!e)throw new Error("useFormField should be used within ");const{id:i}=t;return{id:i,name:e.name,formItemId:`${i}-form-item`,formDescriptionId:`${i}-form-item-description`,formMessageId:`${i}-form-item-message`,...o}},s3=f.createContext({}),qp=f.forwardRef(({className:e,...t},n)=>{const r=f.useId();return v.jsx(s3.Provider,{value:{id:r},children:v.jsx("div",{ref:n,className:Ce("space-y-2",e),...t})})});qp.displayName="FormItem";const Qp=f.forwardRef(({className:e,...t},n)=>{const{error:r,formItemId:o}=ag();return v.jsx(Gx,{ref:n,className:Ce(r&&"text-destructive","text-sm",e),htmlFor:o,...t})});Qp.displayName="FormLabel";const Jp=f.forwardRef(({...e},t)=>{const{error:n,formItemId:r,formDescriptionId:o,formMessageId:i}=ag();return v.jsx(Wo,{ref:t,id:r,"aria-describedby":n?`${o} ${i}`:`${o}`,"aria-invalid":!!n,...e})});Jp.displayName="FormControl";const eh=f.forwardRef(({className:e,...t},n)=>{const{formDescriptionId:r}=ag();return v.jsx("p",{ref:n,id:r,className:Ce("text-[0.8rem] text-muted-foreground",e),...t})});eh.displayName="FormDescription";const xX=f.forwardRef(({className:e,children:t,...n},r)=>{const{error:o,formMessageId:i}=ag(),s=o?String(o==null?void 0:o.message):t;return s?v.jsx("p",{ref:r,id:i,className:Ce("text-[0.8rem] font-medium text-destructive",e),...n,children:s}):null});xX.displayName="FormMessage";const a3="Switch",[bX,Ste]=An(a3),[_X,SX]=bX(a3),EX=f.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:o,defaultChecked:i,required:s,disabled:l,value:u="on",onCheckedChange:d,...h}=e,[m,g]=f.useState(null),y=Be(t,b=>g(b)),x=f.useRef(!1),_=m?!!m.closest("form"):!0,[C=!1,S]=Zr({prop:o,defaultProp:i,onChange:d});return f.createElement(_X,{scope:n,checked:C,disabled:l},f.createElement(Pe.button,Y({type:"button",role:"switch","aria-checked":C,"aria-required":s,"data-state":l3(C),"data-disabled":l?"":void 0,disabled:l,value:u},h,{ref:y,onClick:ue(e.onClick,b=>{S(E=>!E),_&&(x.current=b.isPropagationStopped(),x.current||b.stopPropagation())})})),_&&f.createElement(kX,{control:m,bubbles:!x.current,name:r,value:u,checked:C,required:s,disabled:l,style:{transform:"translateX(-100%)"}}))}),CX="SwitchThumb",$X=f.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,o=SX(CX,n);return f.createElement(Pe.span,Y({"data-state":l3(o.checked),"data-disabled":o.disabled?"":void 0},r,{ref:t}))}),kX=e=>{const{control:t,checked:n,bubbles:r=!0,...o}=e,i=f.useRef(null),s=Fx(n),l=gx(t);return f.useEffect(()=>{const u=i.current,d=window.HTMLInputElement.prototype,m=Object.getOwnPropertyDescriptor(d,"checked").set;if(s!==n&&m){const g=new Event("click",{bubbles:r});m.call(u,n),u.dispatchEvent(g)}},[s,n,r]),f.createElement("input",Y({type:"checkbox","aria-hidden":!0,defaultChecked:n},o,{tabIndex:-1,ref:i,style:{...e.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function l3(e){return e?"checked":"unchecked"}const c3=EX,RX=$X,co=f.forwardRef(({className:e,...t},n)=>v.jsx(c3,{className:Ce("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),tabIndex:-1,...t,ref:n,children:v.jsx(RX,{className:Ce("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));co.displayName=c3.displayName;const TX="AlertDialog",[PX,Ete]=An(TX,[cP]),Is=cP(),AX=e=>{const{__scopeAlertDialog:t,...n}=e,r=Is(t);return f.createElement(Sx,Y({},r,n,{modal:!0}))},OX=e=>{const{__scopeAlertDialog:t,...n}=e,r=Is(t);return f.createElement(Ex,Y({},r,n))},MX=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=Is(n);return f.createElement(Nd,Y({},o,r,{ref:t}))}),u3="AlertDialogContent",[NX,DX]=PX(u3),IX=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...o}=e,i=Is(n),s=f.useRef(null),l=Be(t,s),u=f.useRef(null);return f.createElement(pW,{contentName:u3,titleName:LX,docsSlug:"alert-dialog"},f.createElement(NX,{scope:n,cancelRef:u},f.createElement(Dd,Y({role:"alertdialog"},i,o,{ref:l,onOpenAutoFocus:ue(o.onOpenAutoFocus,d=>{var h;d.preventDefault(),(h=u.current)===null||h===void 0||h.focus({preventScroll:!0})}),onPointerDownOutside:d=>d.preventDefault(),onInteractOutside:d=>d.preventDefault()}),f.createElement(sx,null,r),!1)))}),LX="AlertDialogTitle",FX=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=Is(n);return f.createElement(Id,Y({},o,r,{ref:t}))}),jX=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=Is(n);return f.createElement(Ld,Y({},o,r,{ref:t}))}),zX=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=Is(n);return f.createElement(Cx,Y({},o,r,{ref:t}))}),BX="AlertDialogCancel",UX=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:o}=DX(BX,n),i=Is(n),s=Be(t,o);return f.createElement(Cx,Y({},i,r,{ref:s}))}),VX=AX,WX=OX,d3=MX,f3=IX,p3=zX,h3=UX,m3=FX,g3=jX,HX=VX,KX=WX,v3=f.forwardRef(({className:e,...t},n)=>v.jsx(d3,{className:Ce("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));v3.displayName=d3.displayName;const y3=f.forwardRef(({className:e,...t},n)=>v.jsxs(KX,{children:[v.jsx(v3,{}),v.jsx(f3,{ref:n,className:Ce("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...t})]}));y3.displayName=f3.displayName;const w3=({className:e,...t})=>v.jsx("div",{className:Ce("flex flex-col space-y-2 text-center sm:text-left",e),...t});w3.displayName="AlertDialogHeader";const YX=f.forwardRef(({className:e,...t},n)=>v.jsx(m3,{ref:n,className:Ce("text-lg font-semibold",e),...t}));YX.displayName=m3.displayName;const GX=f.forwardRef(({className:e,...t},n)=>v.jsx(g3,{ref:n,className:Ce("text-sm text-muted-foreground",e),...t}));GX.displayName=g3.displayName;const XX=f.forwardRef(({className:e,...t},n)=>v.jsx(p3,{ref:n,className:Ce(bx(),e),...t}));XX.displayName=p3.displayName;const ZX=f.forwardRef(({className:e,...t},n)=>v.jsx(h3,{ref:n,className:Ce(bx({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));ZX.displayName=h3.displayName;const qX=hX({enableFileManager:su(),inputDirectory:O2(),outputDirectory:O2(),enableDownloadMask:su(),enableManualInpainting:su(),enableUploadMask:su(),enableAutoExtractPrompt:su()}),x3="General",I1="Model",QX=[I1,x3];function JX(){const[e,t]=u1(!1),[n,r]=u1(!1),[o,i]=f.useState(I1),[s,l,u,d,h,m]=bt(O=>[O.updateAppState,O.settings,O.updateSettings,O.fileManagerState,O.updateFileManagerState,O.setModel]),{toast:g}=Td(),[y,x]=f.useState(l.model);f.useEffect(()=>{x(l.model)},[l.model]);const{data:_,status:C}=TL({queryKey:["modelInfos"],queryFn:zj}),S=GG({resolver:JG(qX),defaultValues:{enableDownloadMask:l.enableDownloadMask,enableManualInpainting:l.enableManualInpainting,enableUploadMask:l.enableUploadMask,enableAutoExtractPrompt:l.enableAutoExtractPrompt,inputDirectory:d.inputDirectory,outputDirectory:d.outputDirectory}});async function b(O){if(u({enableDownloadMask:O.enableDownloadMask,enableManualInpainting:O.enableManualInpainting,enableUploadMask:O.enableUploadMask,enableAutoExtractPrompt:O.enableAutoExtractPrompt}),h({inputDirectory:O.inputDirectory,outputDirectory:O.outputDirectory}),y.name!==l.model.name){r(),s({disableShortCuts:!0});try{const F=await Fj(y.name);g({title:`Switch to ${F.name} success`}),m(y)}catch(F){g({variant:"destructive",title:`Switch to ${y.name} failed: ${F}`}),x(l.model)}finally{r(),s({disableShortCuts:!1})}}}Zn("s",()=>{t(),e&&b(S.getValues())},[e,S,y]);function E(O){t(),O||b(S.getValues())}function k(O){x(O)}function P(O){return _?_.filter(F=>O.includes(F.model_type)).map(F=>v.jsxs("div",{onClick:()=>k(F),className:"px-2",children:[v.jsx("div",{className:Ce([F.name===y.name?"bg-muted":"hover:bg-muted","rounded-md px-2 py-2","cursor-default"]),children:v.jsx("div",{className:"text-base",children:F.name})}),v.jsx(Fn,{className:"my-1"})]},F.name)):v.jsx("div",{children:"Please download model first"})}function M(){if(C!=="success")return v.jsx(v.Fragment,{});let O=is;for(let F of _)if(y.name===F.name){O=F.model_type,O===nC&&(O=rp),O===rC&&(O=op);break}return v.jsxs("div",{className:"flex flex-col gap-4 w-[510px]",children:[v.jsxs("div",{className:"flex flex-col gap-4 rounded-md",children:[v.jsx("div",{className:"font-medium",children:"Current Model"}),v.jsx("div",{children:y.name})]}),v.jsx(Fn,{}),v.jsxs("div",{className:"space-y-4 rounded-md",children:[v.jsx("div",{className:"flex gap-1 items-center justify-start",children:v.jsx("div",{className:"font-medium",children:"Available models"})}),v.jsxs(i5,{defaultValue:O,children:[v.jsxs(Lx,{children:[v.jsx(sa,{value:is,children:"Inpaint"}),v.jsx(sa,{value:rp,children:"Stable Diffusion"}),v.jsx(sa,{value:op,children:"Stable Diffusion Inpaint"}),v.jsx(sa,{value:l0,children:"Other Diffusion"})]}),v.jsxs(og,{className:"h-[240px] w-full mt-2 outline-none border rounded-lg",children:[v.jsx(mu,{value:is,children:P([is])}),v.jsx(mu,{value:rp,children:P([rp,nC])}),v.jsx(mu,{value:op,children:P([op,rC])}),v.jsx(mu,{value:l0,children:P([l0])})]})]})]})]})}function A(){return v.jsxs("div",{className:"space-y-4 w-[510px]",children:[v.jsx(N0,{control:S.control,name:"enableManualInpainting",render:({field:O})=>v.jsxs(qp,{className:"flex items-center justify-between",children:[v.jsxs("div",{className:"space-y-0.5",children:[v.jsx(Qp,{children:"Enable manual inpainting"}),v.jsx(eh,{children:"For erase model, click a button to trigger inpainting after draw mask."})]}),v.jsx(Jp,{children:v.jsx(co,{checked:O.value,onCheckedChange:O.onChange})})]})}),v.jsx(Fn,{}),v.jsx(N0,{control:S.control,name:"enableDownloadMask",render:({field:O})=>v.jsxs(qp,{className:"flex items-center justify-between",children:[v.jsxs("div",{className:"space-y-0.5",children:[v.jsx(Qp,{children:"Enable download mask"}),v.jsx(eh,{children:"Also download the mask after save the inpainting result."})]}),v.jsx(Jp,{children:v.jsx(co,{checked:O.value,onCheckedChange:O.onChange})})]})}),v.jsx(Fn,{}),v.jsx(N0,{control:S.control,name:"enableAutoExtractPrompt",render:({field:O})=>v.jsxs(qp,{className:"flex items-center justify-between",children:[v.jsxs("div",{className:"space-y-0.5",children:[v.jsx(Qp,{children:"Enable auto extract prompt"}),v.jsx(eh,{children:"Automatically extract prompt/negativate prompt from the image meta."})]}),v.jsx(Jp,{children:v.jsx(co,{checked:O.value,onCheckedChange:O.onChange})})]})})]})}return v.jsxs(v.Fragment,{children:[v.jsx(HX,{open:n,children:v.jsx(y3,{children:v.jsx(w3,{children:v.jsxs("div",{className:"flex flex-col justify-center items-center gap-4",children:[v.jsxs("div",{role:"status",children:[v.jsxs("svg",{"aria-hidden":"true",className:"w-8 h-8 text-gray-200 animate-spin dark:text-gray-600 fill-primary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[v.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),v.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),v.jsx("span",{className:"sr-only",children:"Loading..."})]}),v.jsxs("div",{children:["Switching to ",y.name]})]})})})}),v.jsxs(Zm,{open:e,onOpenChange:E,children:[v.jsx($x,{asChild:!0,children:v.jsx(vn,{tooltip:"Settings",children:v.jsx(sV,{})})}),v.jsxs(Fd,{className:"max-w-3xl h-[600px]",onOpenAutoFocus:O=>O.preventDefault(),children:[v.jsx(jd,{children:"Settings"}),v.jsx(Fn,{}),v.jsxs("div",{className:"flex flex-row space-x-8 h-full",children:[v.jsx("div",{className:"flex flex-col space-y-1",children:QX.map(O=>v.jsx(Rn,{variant:"ghost",onClick:()=>i(O),className:Ce(o===O?"bg-muted ":"hover:bg-muted","justify-start"),children:O},O))}),v.jsx(Fn,{orientation:"vertical"}),v.jsx(wX,{...S,children:v.jsx("div",{className:"flex w-full justify-center",children:v.jsxs("form",{onSubmit:S.handleSubmit(b),children:[o===I1?M():v.jsx(v.Fragment,{}),o===x3?A():v.jsx(v.Fragment,{}),v.jsx("div",{className:"absolute right-10 bottom-6",children:v.jsx(Rn,{onClick:()=>E(!1),children:"Ok"})})]})})})]})]})]})]})}const eZ="/assets/kofi_button_black-XI_Dr2zg.png";function tZ(){return v.jsxs(Zm,{children:[v.jsx($x,{asChild:!0,children:v.jsx(vn,{tooltip:"Buy me a coffee",children:v.jsx(YU,{})})}),v.jsxs(Fd,{children:[v.jsx(jd,{children:"Buy me a coffee"}),v.jsx(mP,{className:"mb-8",children:"Hi, if you found my project is useful, please conside buy me a coffee to support my work. Thanks!"}),v.jsx("div",{className:"w-full flex items-center justify-center",children:v.jsx("a",{href:"https://ko-fi.com/Z8Z1CZJGY",target:"_blank",rel:"noreferrer",children:v.jsx("img",{src:eZ,className:"h-[32px]"})})})]})]})}const nZ=()=>{const[e,t,n,r,o,i,s,l,u,d,h,m,g,y]=bt(M=>[M.file,M.customMask,M.isInpainting,M.serverConfig,M.runMannually(),M.settings.enableUploadMask,M.settings.model,M.setFile,M.setCustomFile,M.runInpainting,M.showPrevMask,M.hidePrevMask,M.imageHeight,M.imageWidth]),{toast:x}=Td(),[_,C]=Rx(t),[S,b]=f.useState(!1),E=()=>{d()},k=()=>{h()},P=()=>{m()};return v.jsxs("header",{className:"h-[60px] px-6 py-4 absolute top-[0] flex justify-between items-center w-full z-20 border-b backdrop-filter backdrop-blur-md bg-background/70",children:[v.jsxs("div",{className:"flex items-center gap-1",children:[r.enableFileManager?v.jsx(PG,{photoWidth:512,onPhotoClick:async(M,A)=>{try{const O=await Bj(M,A);l(O)}catch(O){x({variant:"destructive",description:O.message?O.message:O.toString()});return}}}):v.jsx(v.Fragment,{}),v.jsx(c1,{disabled:n,tooltip:"Upload image",onFileUpload:M=>{l(M)},children:v.jsx(JU,{})}),v.jsxs("div",{className:Ce(["flex items-center gap-1",e&&i?"visible":"hidden"]),children:[v.jsx(c1,{disabled:n,tooltip:"Upload custom mask",onFileUpload:async M=>{let A=null;try{A=await fF(M)}catch(O){x({variant:"destructive",description:O.message?O.message:O.toString()});return}if(A.naturalHeight!==g||A.naturalWidth!==y){x({variant:"destructive",description:`The size of the mask must same as image: ${y}x${g}`});return}u(M),o||d()},children:v.jsx(ZT,{})}),t?v.jsxs(KW,{open:S,children:[v.jsx(YW,{className:"btn-primary side-panel-trigger",onMouseEnter:()=>b(!0),onMouseLeave:()=>b(!1),style:{visibility:t?"visible":"hidden",outline:"none"},onClick:()=>{},children:v.jsx(vn,{tooltip:"Run custom mask",children:v.jsx(lz,{})})}),v.jsx(PP,{children:C?v.jsx("img",{src:_.src,alt:"Custom mask"}):v.jsx(v.Fragment,{})})]}):v.jsx(v.Fragment,{})]}),e&&!s.need_prompt?v.jsx(vn,{disabled:n,tooltip:"Rerun previous mask",onClick:E,onMouseEnter:k,onMouseLeave:P,children:v.jsx(iV,{})}):v.jsx(v.Fragment,{})]}),s.need_prompt?v.jsx(yH,{}):v.jsx(v.Fragment,{}),v.jsxs("div",{className:"flex gap-1",children:[v.jsx(tZ,{}),v.jsx(OW,{}),r.disableModelSwitch?v.jsx(v.Fragment,{}):v.jsx(JX,{})]})]})};var Wr=function(e,t){return Number(e.toFixed(t))},rZ=function(e,t){return typeof e=="number"?e:t},Nt=function(e,t,n){n&&typeof n=="function"&&n(e,t)},oZ=function(e){return-Math.cos(e*Math.PI)/2+.5},iZ=function(e){return e},sZ=function(e){return e*e},aZ=function(e){return e*(2-e)},lZ=function(e){return e<.5?2*e*e:-1+(4-2*e)*e},cZ=function(e){return e*e*e},uZ=function(e){return--e*e*e+1},dZ=function(e){return e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1},fZ=function(e){return e*e*e*e},pZ=function(e){return 1- --e*e*e*e},hZ=function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},mZ=function(e){return e*e*e*e*e},gZ=function(e){return 1+--e*e*e*e*e},vZ=function(e){return e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e},b3={easeOut:oZ,linear:iZ,easeInQuad:sZ,easeOutQuad:aZ,easeInOutQuad:lZ,easeInCubic:cZ,easeOutCubic:uZ,easeInOutCubic:dZ,easeInQuart:fZ,easeOutQuart:pZ,easeInOutQuart:hZ,easeInQuint:mZ,easeOutQuint:gZ,easeInOutQuint:vZ},_3=function(e){typeof e=="number"&&cancelAnimationFrame(e)},Do=function(e){e.mounted&&(_3(e.animation),e.animate=!1,e.animation=null,e.velocity=null)};function S3(e,t,n,r){if(e.mounted){var o=new Date().getTime(),i=1;Do(e),e.animation=function(){if(!e.mounted)return _3(e.animation);var s=new Date().getTime()-o,l=s/n,u=b3[t],d=u(l);s>=n?(r(i),e.animation=null):e.animation&&(r(d),requestAnimationFrame(e.animation))},requestAnimationFrame(e.animation)}}function yZ(e){var t=e.scale,n=e.positionX,r=e.positionY;return!(Number.isNaN(t)||Number.isNaN(n)||Number.isNaN(r))}function Ls(e,t,n,r){var o=yZ(t);if(!(!e.mounted||!o)){var i=e.setTransformState,s=e.transformState,l=s.scale,u=s.positionX,d=s.positionY,h=t.scale-l,m=t.positionX-u,g=t.positionY-d;n===0?i(t.scale,t.positionX,t.positionY):S3(e,r,n,function(y){var x=l+h*y,_=u+m*y,C=d+g*y;i(x,_,C)})}}function wZ(e,t,n){var r=e.offsetWidth,o=e.offsetHeight,i=t.offsetWidth,s=t.offsetHeight,l=i*n,u=s*n,d=r-l,h=o-u;return{wrapperWidth:r,wrapperHeight:o,newContentWidth:l,newDiffWidth:d,newContentHeight:u,newDiffHeight:h}}var xZ=function(e,t,n,r,o,i,s){var l=e>t?n*(s?1:.5):0,u=r>o?i*(s?1:.5):0,d=e-t-l,h=l,m=r-o-u,g=u;return{minPositionX:d,maxPositionX:h,minPositionY:m,maxPositionY:g}},Xx=function(e,t){var n=e.wrapperComponent,r=e.contentComponent,o=e.setup.centerZoomedOut;if(!n||!r)throw new Error("Components are not mounted");var i=wZ(n,r,t),s=i.wrapperWidth,l=i.wrapperHeight,u=i.newContentWidth,d=i.newDiffWidth,h=i.newContentHeight,m=i.newDiffHeight,g=xZ(s,u,d,l,h,m,!!o);return g},L1=function(e,t,n,r){return r?en?Wr(n,2):Wr(e,2):Wr(e,2)},dc=function(e,t){var n=Xx(e,t);return e.bounds=n,n};function lg(e,t,n,r,o,i,s){var l=n.minPositionX,u=n.minPositionY,d=n.maxPositionX,h=n.maxPositionY,m=0,g=0;s&&(m=o,g=i);var y=L1(e,l-m,d+m,r),x=L1(t,u-g,h+g,r);return{x:y,y:x}}function cg(e,t,n,r,o,i){var s=e.transformState,l=s.scale,u=s.positionX,d=s.positionY,h=r-l;if(typeof t!="number"||typeof n!="number")return console.error("Mouse X and Y position were not provided!"),{x:u,y:d};var m=u-t*h,g=d-n*h,y=lg(m,g,o,i,0,0,null);return y}function Vd(e,t,n,r,o){var i=o?r:0,s=t-i;return!Number.isNaN(n)&&e>=n?n:!Number.isNaN(t)&&e<=s?s:e}var M2=function(e,t){var n=e.setup.panning.excluded,r=e.isInitialized,o=e.wrapperComponent,i=t.target,s=o==null?void 0:o.contains(i),l=r&&i&&s;if(!l)return!1;var u=ug(i,n);return!u},N2=function(e){var t=e.isInitialized,n=e.isPanning,r=e.setup,o=r.panning.disabled,i=t&&n&&!o;return!!i},bZ=function(e,t){var n=e.transformState,r=n.positionX,o=n.positionY;e.isPanning=!0;var i=t.clientX,s=t.clientY;e.startCoords={x:i-r,y:s-o}},_Z=function(e,t){var n=t.touches,r=e.transformState,o=r.positionX,i=r.positionY;e.isPanning=!0;var s=n.length===1;if(s){var l=n[0].clientX,u=n[0].clientY;e.startCoords={x:l-o,y:u-i}}};function SZ(e){var t=e.transformState,n=t.positionX,r=t.positionY,o=t.scale,i=e.setup,s=i.disabled,l=i.limitToBounds,u=i.centerZoomedOut,d=e.wrapperComponent;if(!(s||!d||!e.bounds)){var h=e.bounds,m=h.maxPositionX,g=h.minPositionX,y=h.maxPositionY,x=h.minPositionY,_=n>m||ny||rm?d.offsetWidth:e.setup.minPositionX||0,b=r>y?d.offsetHeight:e.setup.minPositionY||0,E=cg(e,S,b,o,e.bounds,l||u),k=E.x,P=E.y;return{scale:o,positionX:_?k:n,positionY:C?P:r}}}function EZ(e,t,n,r,o){var i=e.setup.limitToBounds,s=e.wrapperComponent,l=e.bounds,u=e.transformState,d=u.scale,h=u.positionX,m=u.positionY;if(!(s===null||l===null||t===h&&n===m)){var g=lg(t,n,l,i,r,o,s),y=g.x,x=g.y;e.setTransformState(d,y,x)}}var CZ=function(e,t,n){var r=e.startCoords,o=e.transformState,i=e.setup.panning,s=i.lockAxisX,l=i.lockAxisY,u=o.positionX,d=o.positionY;if(!r)return{x:u,y:d};var h=t-r.x,m=n-r.y,g=s?u:h,y=l?d:m;return{x:g,y}},rm=function(e,t){var n=e.setup,r=e.transformState,o=r.scale,i=n.minScale,s=n.disablePadding;return t>0&&o>=i&&!s?t:0},$Z=function(e){var t=e.mounted,n=e.setup,r=n.disabled,o=n.velocityAnimation,i=e.transformState.scale,s=o.disabled,l=!s||i>1||!r||t;return!!l},kZ=function(e){var t=e.mounted,n=e.velocity,r=e.bounds,o=e.setup,i=o.disabled,s=o.velocityAnimation,l=e.transformState.scale,u=s.disabled,d=!u||l>1||!i||t;return!(!d||!n||!r)};function RZ(e,t){var n=e.setup.velocityAnimation,r=n.equalToMove,o=n.animationTime,i=n.sensitivity;return r?o*t*i:o}function D2(e,t,n,r,o,i,s,l,u,d){if(o){if(t>s&&n>s){var h=s+(e-s)*d;return h>u?u:hi?i:h}}return r?t:L1(e,i,s,o)}function TZ(e,t){var n=1;return t?Math.min(n,e.offsetWidth/window.innerWidth):n}function PZ(e,t){var n=$Z(e);if(n){var r=e.lastMousePosition,o=e.velocityTime,i=e.setup,s=e.wrapperComponent,l=i.velocityAnimation.equalToMove,u=Date.now();if(r&&o&&s){var d=TZ(s,l),h=t.x-r.x,m=t.y-r.y,g=h/d,y=m/d,x=u-o,_=h*h+m*m,C=Math.sqrt(_)/x;e.velocity={velocityX:g,velocityY:y,total:C}}e.lastMousePosition=t,e.velocityTime=u}}function AZ(e){var t=e.velocity,n=e.bounds,r=e.setup,o=e.wrapperComponent,i=kZ(e);if(!(!i||!t||!n||!o)){var s=t.velocityX,l=t.velocityY,u=t.total,d=n.maxPositionX,h=n.minPositionX,m=n.maxPositionY,g=n.minPositionY,y=r.limitToBounds,x=r.alignmentAnimation,_=r.zoomAnimation,C=r.panning,S=C.lockAxisY,b=C.lockAxisX,E=_.animationType,k=x.sizeX,P=x.sizeY,M=x.velocityAlignmentTime,A=M,O=RZ(e,u),F=Math.max(O,A),V=rm(e,k),J=rm(e,P),G=V*o.offsetWidth/100,ae=J*o.offsetHeight/100,U=d+G,te=h-G,L=m+ae,ie=g-ae,K=e.transformState,Q=new Date().getTime();S3(e,E,F,function(W){var le=e.transformState,ge=le.scale,Ve=le.positionX,Ue=le.positionY,We=new Date().getTime()-Q,Me=We/A,fe=b3[x.animationType],xe=1-fe(Math.min(1,Me)),$e=1-W,Ae=Ve+s*$e,Oe=Ue+l*$e,je=D2(Ae,K.positionX,Ve,b,y,h,d,te,U,xe),Ot=D2(Oe,K.positionY,Ue,S,y,g,m,ie,L,xe);(Ve!==Ae||Ue!==Oe)&&e.setTransformState(ge,je,Ot)})}}function I2(e,t){var n=e.transformState.scale;Do(e),dc(e,n),window.TouchEvent!==void 0&&t instanceof TouchEvent?_Z(e,t):bZ(e,t)}function E3(e){var t=e.transformState.scale,n=e.setup,r=n.minScale,o=n.alignmentAnimation,i=o.disabled,s=o.sizeX,l=o.sizeY,u=o.animationTime,d=o.animationType,h=i||t.1&&m;g?AZ(e):E3(e)}}function Zx(e,t,n,r){var o=e.setup,i=o.minScale,s=o.maxScale,l=o.limitToBounds,u=Vd(Wr(t,2),i,s,0,!1),d=dc(e,u),h=cg(e,n,r,u,d,l),m=h.x,g=h.y;return{scale:u,positionX:m,positionY:g}}function C3(e,t,n){var r=e.transformState.scale,o=e.wrapperComponent,i=e.setup,s=i.minScale,l=i.limitToBounds,u=i.zoomAnimation,d=u.disabled,h=u.animationTime,m=u.animationType,g=d||r>=s;if((r>=1||l)&&E3(e),!(g||!o||!e.mounted)){var y=t||o.offsetWidth/2,x=n||o.offsetHeight/2,_=Zx(e,s,y,x);_&&Ls(e,_,h,m)}}var _s=function(){return _s=Object.assign||function(t){for(var n,r=1,o=arguments.length;rs||Math.sign(n.deltaY)!==Math.sign(t.deltaY)||n.deltaY>0&&n.deltaYt.deltaY||Math.sign(n.deltaY)!==Math.sign(t.deltaY):!1},XZ=function(e,t){var n=e.setup.pinch,r=n.disabled,o=n.excluded,i=e.isInitialized,s=t.target,l=i&&!r&&s;if(!l)return!1;var u=ug(s,o);return!u},ZZ=function(e){var t=e.setup.pinch.disabled,n=e.isInitialized,r=e.pinchStartDistance,o=n&&!t&&r;return!!o},qZ=function(e,t,n){var r=n.getBoundingClientRect(),o=e.touches,i=Wr(o[0].clientX-r.left,5),s=Wr(o[0].clientY-r.top,5),l=Wr(o[1].clientX-r.left,5),u=Wr(o[1].clientY-r.top,5);return{x:(i+l)/2/t,y:(s+u)/2/t}},O3=function(e){return Math.sqrt(Math.pow(e.touches[0].pageX-e.touches[1].pageX,2)+Math.pow(e.touches[0].pageY-e.touches[1].pageY,2))},QZ=function(e,t){var n=e.pinchStartScale,r=e.pinchStartDistance,o=e.setup,i=o.maxScale,s=o.minScale,l=o.zoomAnimation,u=o.disablePadding,d=l.size,h=l.disabled;if(!n||r===null||!t)throw new Error("Pinch touches distance was not provided");if(t<0)return e.transformState.scale;var m=t/r,g=m*n;return Vd(Wr(g,2),s,i,d,!h&&!u)},JZ=160,eq=100,tq=function(e,t){var n=e.props,r=n.onWheelStart,o=n.onZoomStart;e.wheelStopEventTimer||(Do(e),Nt(St(e),t,r),Nt(St(e),t,o))},nq=function(e,t){var n=e.props,r=n.onWheel,o=n.onZoom,i=e.contentComponent,s=e.setup,l=e.transformState,u=l.scale,d=s.limitToBounds,h=s.centerZoomedOut,m=s.zoomAnimation,g=s.wheel,y=s.disablePadding,x=s.smooth,_=m.size,C=m.disabled,S=g.step,b=g.smoothStep;if(!i)throw new Error("Component not mounted");t.preventDefault(),t.stopPropagation();var E=KZ(t,null),k=x?b*Math.abs(t.deltaY):S,P=YZ(e,E,k,!t.ctrlKey);if(u!==P){var M=dc(e,P),A=A3(t,i,u),O=C||_===0||h||y,F=d&&O,V=cg(e,A.x,A.y,P,M,F),J=V.x,G=V.y;e.previousWheelEvent=t,e.setTransformState(P,J,G),Nt(St(e),t,r),Nt(St(e),t,o)}},rq=function(e,t){var n=e.props,r=n.onWheelStop,o=n.onZoomStop;j1(e.wheelAnimationTimer),e.wheelAnimationTimer=setTimeout(function(){e.mounted&&(C3(e,t.x,t.y),e.wheelAnimationTimer=null)},eq);var i=GZ(e,t);i&&(j1(e.wheelStopEventTimer),e.wheelStopEventTimer=setTimeout(function(){e.mounted&&(e.wheelStopEventTimer=null,Nt(St(e),t,r),Nt(St(e),t,o))},JZ))},oq=function(e,t){var n=O3(t);e.pinchStartDistance=n,e.lastDistance=n,e.pinchStartScale=e.transformState.scale,e.isPanning=!1,Do(e)},iq=function(e,t){var n=e.contentComponent,r=e.pinchStartDistance,o=e.transformState.scale,i=e.setup,s=i.limitToBounds,l=i.centerZoomedOut,u=i.zoomAnimation,d=u.disabled,h=u.size;if(!(r===null||!n)){var m=qZ(t,o,n);if(!(!Number.isFinite(m.x)||!Number.isFinite(m.y))){var g=O3(t),y=QZ(e,g);if(y!==o){var x=dc(e,y),_=d||h===0||l,C=s&&_,S=cg(e,m.x,m.y,y,x,C),b=S.x,E=S.y;e.pinchMidpoint=m,e.lastDistance=g,e.setTransformState(y,b,E)}}}},sq=function(e){var t=e.pinchMidpoint;e.velocity=null,e.lastDistance=null,e.pinchMidpoint=null,e.pinchStartScale=null,e.pinchStartDistance=null,C3(e,t==null?void 0:t.x,t==null?void 0:t.y)},M3=function(e,t){var n=e.props.onZoomStop,r=e.setup.doubleClick.animationTime;j1(e.doubleClickStopEventTimer),e.doubleClickStopEventTimer=setTimeout(function(){e.doubleClickStopEventTimer=null,Nt(St(e),t,n)},r)},aq=function(e,t){var n=e.props,r=n.onZoomStart,o=n.onZoom,i=e.setup.doubleClick,s=i.animationTime,l=i.animationType;Nt(St(e),t,r),T3(e,s,l,function(){return Nt(St(e),t,o)}),M3(e,t)};function lq(e,t){var n=e.setup,r=e.doubleClickStopEventTimer,o=e.transformState,i=e.contentComponent,s=o.scale,l=e.props,u=l.onZoomStart,d=l.onZoom,h=n.doubleClick,m=h.disabled,g=h.mode,y=h.step,x=h.animationTime,_=h.animationType;if(!m&&!r){if(g==="reset")return aq(e,t);if(!i)return console.error("No ContentComponent found");var C=g==="zoomOut"?-1:1,S=k3(e,C,y);if(s!==S){Nt(St(e),t,u);var b=A3(t,i,s),E=Zx(e,S,b.x,b.y);if(!E)return console.error("Error during zoom event. New transformation state was not calculated.");Nt(St(e),t,d),Ls(e,E,x,_),M3(e,t)}}}var cq=function(e,t){var n=e.isInitialized,r=e.setup,o=e.wrapperComponent,i=r.doubleClick,s=i.disabled,l=i.excluded,u=t.target,d=o==null?void 0:o.contains(u),h=n&&u&&d&&!s;if(!h)return!1;var m=ug(u,l);return!m},uq=function(){function e(t){var n=this;this.mounted=!0,this.onChangeCallbacks=new Set,this.onInitCallbacks=new Set,this.wrapperComponent=null,this.contentComponent=null,this.isInitialized=!1,this.bounds=null,this.previousWheelEvent=null,this.wheelStopEventTimer=null,this.wheelAnimationTimer=null,this.isPanning=!1,this.startCoords=null,this.lastTouch=null,this.distance=null,this.lastDistance=null,this.pinchStartDistance=null,this.pinchStartScale=null,this.pinchMidpoint=null,this.doubleClickStopEventTimer=null,this.velocity=null,this.velocityTime=null,this.lastMousePosition=null,this.animate=!1,this.animation=null,this.maxBounds=null,this.pressedKeys={},this.mount=function(){n.initializeWindowEvents()},this.unmount=function(){n.cleanupWindowEvents()},this.update=function(r){dc(n,n.transformState.scale),n.setup=j2(r)},this.initializeWindowEvents=function(){var r,o=I0(),i=(r=n.wrapperComponent)===null||r===void 0?void 0:r.ownerDocument,s=i==null?void 0:i.defaultView;s==null||s.addEventListener("mousedown",n.onPanningStart,o),s==null||s.addEventListener("mousemove",n.onPanning,o),s==null||s.addEventListener("mouseup",n.onPanningStop,o),i==null||i.addEventListener("mouseleave",n.clearPanning,o),s==null||s.addEventListener("keyup",n.setKeyUnPressed,o),s==null||s.addEventListener("keydown",n.setKeyPressed,o)},this.cleanupWindowEvents=function(){var r,o,i=I0(),s=(r=n.wrapperComponent)===null||r===void 0?void 0:r.ownerDocument,l=s==null?void 0:s.defaultView;l==null||l.removeEventListener("mousedown",n.onPanningStart,i),l==null||l.removeEventListener("mousemove",n.onPanning,i),l==null||l.removeEventListener("mouseup",n.onPanningStop,i),s==null||s.removeEventListener("mouseleave",n.clearPanning,i),l==null||l.removeEventListener("keyup",n.setKeyUnPressed,i),l==null||l.removeEventListener("keydown",n.setKeyPressed,i),document.removeEventListener("mouseleave",n.clearPanning,i),Do(n),(o=n.observer)===null||o===void 0||o.disconnect()},this.handleInitializeWrapperEvents=function(r){var o=I0();r.addEventListener("wheel",n.onWheelZoom,o),r.addEventListener("dblclick",n.onDoubleClick,o),r.addEventListener("touchstart",n.onTouchPanningStart,o),r.addEventListener("touchmove",n.onTouchPanning,o),r.addEventListener("touchend",n.onTouchPanningStop,o)},this.handleInitialize=function(r){var o=n.setup.centerOnInit;n.applyTransformation(),n.onInitCallbacks.forEach(function(i){return i(St(n))}),o&&(n.setCenter(),n.observer=new ResizeObserver(function(){var i;n.onInitCallbacks.forEach(function(s){return s(St(n))}),n.setCenter(),(i=n.observer)===null||i===void 0||i.disconnect()}),n.observer.observe(r))},this.onWheelZoom=function(r){var o=n.setup.disabled;if(!o){var i=WZ(n,r);if(i){var s=n.isPressingKeys(n.setup.wheel.activationKeys);s&&(tq(n,r),nq(n,r),rq(n,r))}}},this.onPanningStart=function(r){var o=n.setup.disabled,i=n.props.onPanningStart;if(!o){var s=M2(n,r);if(s){var l=n.isPressingKeys(n.setup.panning.activationKeys);l&&(r.button===0&&!n.setup.panning.allowLeftClickPan||r.button===1&&!n.setup.panning.allowMiddleClickPan||r.button===2&&!n.setup.panning.allowRightClickPan||(r.preventDefault(),r.stopPropagation(),Do(n),I2(n,r),Nt(St(n),r,i)))}}},this.onPanning=function(r){var o=n.setup.disabled,i=n.props.onPanning;if(!o){var s=N2(n);if(s){var l=n.isPressingKeys(n.setup.panning.activationKeys);l&&(r.preventDefault(),r.stopPropagation(),L2(n,r.clientX,r.clientY),Nt(St(n),r,i))}}},this.onPanningStop=function(r){var o=n.props.onPanningStop;n.isPanning&&(OZ(n),Nt(St(n),r,o))},this.onPinchStart=function(r){var o=n.setup.disabled,i=n.props,s=i.onPinchingStart,l=i.onZoomStart;if(!o){var u=XZ(n,r);u&&(oq(n,r),Do(n),Nt(St(n),r,s),Nt(St(n),r,l))}},this.onPinch=function(r){var o=n.setup.disabled,i=n.props,s=i.onPinching,l=i.onZoom;if(!o){var u=ZZ(n);u&&(r.preventDefault(),r.stopPropagation(),iq(n,r),Nt(St(n),r,s),Nt(St(n),r,l))}},this.onPinchStop=function(r){var o=n.props,i=o.onPinchingStop,s=o.onZoomStop;n.pinchStartScale&&(sq(n),Nt(St(n),r,i),Nt(St(n),r,s))},this.onTouchPanningStart=function(r){var o=n.setup.disabled,i=n.props.onPanningStart;if(!o){var s=M2(n,r);if(s){var l=n.lastTouch&&+new Date-n.lastTouch<200;if(l&&r.touches.length===1)n.onDoubleClick(r);else{n.lastTouch=+new Date,Do(n);var u=r.touches,d=u.length===1,h=u.length===2;d&&(Do(n),I2(n,r),Nt(St(n),r,i)),h&&n.onPinchStart(r)}}}},this.onTouchPanning=function(r){var o=n.setup.disabled,i=n.props.onPanning;if(n.isPanning&&r.touches.length===1){if(o)return;var s=N2(n);if(!s)return;r.preventDefault(),r.stopPropagation();var l=r.touches[0];L2(n,l.clientX,l.clientY),Nt(St(n),r,i)}else r.touches.length>1&&n.onPinch(r)},this.onTouchPanningStop=function(r){n.onPanningStop(r),n.onPinchStop(r)},this.onDoubleClick=function(r){var o=n.setup.disabled;if(!o){var i=cq(n,r);i&&lq(n,r)}},this.clearPanning=function(r){n.isPanning&&n.onPanningStop(r)},this.setKeyPressed=function(r){n.pressedKeys[r.key]=!0},this.setKeyUnPressed=function(r){n.pressedKeys[r.key]=!1},this.isPressingKeys=function(r){return r.length?!!r.find(function(o){return n.pressedKeys[o]}):!0},this.setTransformState=function(r,o,i){var s=n.props.onTransformed;if(!Number.isNaN(r)&&!Number.isNaN(o)&&!Number.isNaN(i)){r!==n.transformState.scale&&(n.transformState.previousScale=n.transformState.scale,n.transformState.scale=r),n.transformState.positionX=o,n.transformState.positionY=i,n.applyTransformation();var l=St(n);n.onChangeCallbacks.forEach(function(u){return u(l)}),Nt(l,{scale:r,positionX:o,positionY:i},s)}else console.error("Detected NaN set state values")},this.setCenter=function(){if(n.wrapperComponent&&n.contentComponent){var r=P3(n.transformState.scale,n.wrapperComponent,n.contentComponent);n.setTransformState(r.scale,r.positionX,r.positionY)}},this.handleTransformStyles=function(r,o,i){return n.props.customTransform?n.props.customTransform(r,o,i):UZ(r,o,i)},this.applyTransformation=function(){if(!(!n.mounted||!n.contentComponent)){var r=n.transformState,o=r.scale,i=r.positionX,s=r.positionY,l=n.handleTransformStyles(i,s,o);n.contentComponent.style.transform=l}},this.getContext=function(){return St(n)},this.onChange=function(r){return n.onChangeCallbacks.has(r)||n.onChangeCallbacks.add(r),function(){n.onChangeCallbacks.delete(r)}},this.onInit=function(r){return n.onInitCallbacks.has(r)||n.onInitCallbacks.add(r),function(){n.onInitCallbacks.delete(r)}},this.init=function(r,o){n.cleanupWindowEvents(),n.wrapperComponent=r,n.contentComponent=o,dc(n,n.transformState.scale),n.handleInitializeWrapperEvents(r),n.handleInitialize(o),n.initializeWindowEvents(),n.isInitialized=!0;var i=St(n);Nt(i,void 0,n.props.onInit)},this.props=t,this.setup=j2(this.props),this.transformState=$3(this.props)}return e}(),qx=Fe.createContext(null),dq=function(e,t){return typeof e=="function"?e(t):e},fq=Fe.forwardRef(function(e,t){var n=f.useRef(new uq(e)).current,r=dq(e.children,F1(n));return f.useImperativeHandle(t,function(){return F1(n)},[n]),f.useEffect(function(){n.update(e)},[n,e]),Fe.createElement(qx.Provider,{value:n},r)});Fe.forwardRef(function(e,t){var n=f.useRef(null),r=f.useContext(qx);return f.useEffect(function(){return r.onChange(function(o){if(n.current){var i=0,s=0;n.current.style.transform=r.handleTransformStyles(i,s,1/o.instance.transformState.scale)}})},[r]),Fe.createElement("div",_s({},e,{ref:VZ([n,t])}))});function pq(e,t){t===void 0&&(t={});var n=t.insertAt;if(!(!e||typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css",n==="top"&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}var hq=`.transform-component-module_wrapper__SPB86 {
- position: relative;
- width: -moz-fit-content;
- width: fit-content;
- height: -moz-fit-content;
- height: fit-content;
- overflow: hidden;
- -webkit-touch-callout: none; /* iOS Safari */
- -webkit-user-select: none; /* Safari */
- -khtml-user-select: none; /* Konqueror HTML */
- -moz-user-select: none; /* Firefox */
- -ms-user-select: none; /* Internet Explorer/Edge */
- user-select: none;
- margin: 0;
- padding: 0;
-}
-.transform-component-module_content__FBWxo {
- display: flex;
- flex-wrap: wrap;
- width: -moz-fit-content;
- width: fit-content;
- height: -moz-fit-content;
- height: fit-content;
- margin: 0;
- padding: 0;
- transform-origin: 0% 0%;
-}
-.transform-component-module_content__FBWxo img {
- pointer-events: none;
-}
-`,z2={wrapper:"transform-component-module_wrapper__SPB86",content:"transform-component-module_content__FBWxo"};pq(hq);var mq=function(e){var t=e.children,n=e.wrapperClass,r=n===void 0?"":n,o=e.contentClass,i=o===void 0?"":o,s=e.wrapperStyle,l=e.contentStyle,u=e.wrapperProps,d=u===void 0?{}:u,h=e.contentProps,m=h===void 0?{}:h,g=f.useContext(qx),y=g.init,x=g.cleanupWindowEvents,_=f.useRef(null),C=f.useRef(null);return f.useEffect(function(){var S=_.current,b=C.current;return S!==null&&b!==null&&y&&(y==null||y(S,b)),function(){x==null||x()}},[]),Fe.createElement("div",_s({},d,{ref:_,className:"react-transform-wrapper ".concat(z2.wrapper," ").concat(r),style:s}),Fe.createElement("div",_s({},m,{ref:C,className:"react-transform-component ".concat(z2.content," ").concat(i),style:l}),t))};const N3=["PageUp","PageDown"],D3=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],I3={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Wd="Slider",[z1,gq,vq]=zd(Wd),[L3,Cte]=An(Wd,[vq]),[yq,dg]=L3(Wd),wq=f.forwardRef((e,t)=>{const{name:n,min:r=0,max:o=100,step:i=1,orientation:s="horizontal",disabled:l=!1,minStepsBetweenThumbs:u=0,defaultValue:d=[r],value:h,onValueChange:m=()=>{},onValueCommit:g=()=>{},inverted:y=!1,...x}=e,[_,C]=f.useState(null),S=Be(t,U=>C(U)),b=f.useRef(new Set),E=f.useRef(0),k=s==="horizontal",P=_?!!_.closest("form"):!0,M=k?xq:bq,[A=[],O]=Zr({prop:h,defaultProp:d,onChange:U=>{var te;(te=[...b.current][E.current])===null||te===void 0||te.focus(),m(U)}}),F=f.useRef(A);function V(U){const te=Pq(A,U);ae(U,te)}function J(U){ae(U,E.current)}function G(){const U=F.current[E.current];A[E.current]!==U&&g(A)}function ae(U,te,{commit:L}={commit:!1}){const ie=Nq(i),K=Dq(Math.round((U-r)/i)*i+r,ie),Q=id(K,[r,o]);O((W=[])=>{const le=Rq(W,Q,te);if(Mq(le,u*i)){E.current=le.indexOf(Q);const ge=String(le)!==String(W);return ge&&L&&g(le),ge?le:W}else return W})}return f.createElement(yq,{scope:e.__scopeSlider,disabled:l,min:r,max:o,valueIndexToChangeRef:E,thumbs:b.current,values:A,orientation:s},f.createElement(z1.Provider,{scope:e.__scopeSlider},f.createElement(z1.Slot,{scope:e.__scopeSlider},f.createElement(M,Y({"aria-disabled":l,"data-disabled":l?"":void 0},x,{ref:S,onPointerDown:ue(x.onPointerDown,()=>{l||(F.current=A)}),min:r,max:o,inverted:y,onSlideStart:l?void 0:V,onSlideMove:l?void 0:J,onSlideEnd:l?void 0:G,onHomeKeyDown:()=>!l&&ae(r,0,{commit:!0}),onEndKeyDown:()=>!l&&ae(o,A.length-1,{commit:!0}),onStepKeyDown:({event:U,direction:te})=>{if(!l){const K=N3.includes(U.key)||U.shiftKey&&D3.includes(U.key)?10:1,Q=E.current,W=A[Q],le=i*K*te;ae(W+le,Q,{commit:!0})}}})))),P&&A.map((U,te)=>f.createElement(kq,{key:te,name:n?n+(A.length>1?"[]":""):void 0,value:U})))}),[F3,j3]=L3(Wd,{startEdge:"left",endEdge:"right",size:"width",direction:1}),xq=f.forwardRef((e,t)=>{const{min:n,max:r,dir:o,inverted:i,onSlideStart:s,onSlideMove:l,onSlideEnd:u,onStepKeyDown:d,...h}=e,[m,g]=f.useState(null),y=Be(t,E=>g(E)),x=f.useRef(),_=Sc(o),C=_==="ltr",S=C&&!i||!C&&i;function b(E){const k=x.current||m.getBoundingClientRect(),P=[0,k.width],A=Qx(P,S?[n,r]:[r,n]);return x.current=k,A(E-k.left)}return f.createElement(F3,{scope:e.__scopeSlider,startEdge:S?"left":"right",endEdge:S?"right":"left",direction:S?1:-1,size:"width"},f.createElement(z3,Y({dir:_,"data-orientation":"horizontal"},h,{ref:y,style:{...h.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:E=>{const k=b(E.clientX);s==null||s(k)},onSlideMove:E=>{const k=b(E.clientX);l==null||l(k)},onSlideEnd:()=>{x.current=void 0,u==null||u()},onStepKeyDown:E=>{const P=I3[S?"from-left":"from-right"].includes(E.key);d==null||d({event:E,direction:P?-1:1})}})))}),bq=f.forwardRef((e,t)=>{const{min:n,max:r,inverted:o,onSlideStart:i,onSlideMove:s,onSlideEnd:l,onStepKeyDown:u,...d}=e,h=f.useRef(null),m=Be(t,h),g=f.useRef(),y=!o;function x(_){const C=g.current||h.current.getBoundingClientRect(),S=[0,C.height],E=Qx(S,y?[r,n]:[n,r]);return g.current=C,E(_-C.top)}return f.createElement(F3,{scope:e.__scopeSlider,startEdge:y?"bottom":"top",endEdge:y?"top":"bottom",size:"height",direction:y?1:-1},f.createElement(z3,Y({"data-orientation":"vertical"},d,{ref:m,style:{...d.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:_=>{const C=x(_.clientY);i==null||i(C)},onSlideMove:_=>{const C=x(_.clientY);s==null||s(C)},onSlideEnd:()=>{g.current=void 0,l==null||l()},onStepKeyDown:_=>{const S=I3[y?"from-bottom":"from-top"].includes(_.key);u==null||u({event:_,direction:S?-1:1})}})))}),z3=f.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:o,onSlideEnd:i,onHomeKeyDown:s,onEndKeyDown:l,onStepKeyDown:u,...d}=e,h=dg(Wd,n);return f.createElement(Pe.span,Y({},d,{ref:t,onKeyDown:ue(e.onKeyDown,m=>{m.key==="Home"?(s(m),m.preventDefault()):m.key==="End"?(l(m),m.preventDefault()):N3.concat(D3).includes(m.key)&&(u(m),m.preventDefault())}),onPointerDown:ue(e.onPointerDown,m=>{const g=m.target;g.setPointerCapture(m.pointerId),m.preventDefault(),h.thumbs.has(g)?g.focus():r(m)}),onPointerMove:ue(e.onPointerMove,m=>{m.target.hasPointerCapture(m.pointerId)&&o(m)}),onPointerUp:ue(e.onPointerUp,m=>{const g=m.target;g.hasPointerCapture(m.pointerId)&&(g.releasePointerCapture(m.pointerId),i(m))})}))}),_q="SliderTrack",Sq=f.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,o=dg(_q,n);return f.createElement(Pe.span,Y({"data-disabled":o.disabled?"":void 0,"data-orientation":o.orientation},r,{ref:t}))}),B2="SliderRange",Eq=f.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,o=dg(B2,n),i=j3(B2,n),s=f.useRef(null),l=Be(t,s),u=o.values.length,d=o.values.map(g=>B3(g,o.min,o.max)),h=u>1?Math.min(...d):0,m=100-Math.max(...d);return f.createElement(Pe.span,Y({"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0},r,{ref:l,style:{...e.style,[i.startEdge]:h+"%",[i.endEdge]:m+"%"}}))}),U2="SliderThumb",Cq=f.forwardRef((e,t)=>{const n=gq(e.__scopeSlider),[r,o]=f.useState(null),i=Be(t,l=>o(l)),s=f.useMemo(()=>r?n().findIndex(l=>l.ref.current===r):-1,[n,r]);return f.createElement($q,Y({},e,{ref:i,index:s}))}),$q=f.forwardRef((e,t)=>{const{__scopeSlider:n,index:r,...o}=e,i=dg(U2,n),s=j3(U2,n),[l,u]=f.useState(null),d=Be(t,C=>u(C)),h=gx(l),m=i.values[r],g=m===void 0?0:B3(m,i.min,i.max),y=Tq(r,i.values.length),x=h==null?void 0:h[s.size],_=x?Aq(x,g,s.direction):0;return f.useEffect(()=>{if(l)return i.thumbs.add(l),()=>{i.thumbs.delete(l)}},[l,i.thumbs]),f.createElement("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[s.startEdge]:`calc(${g}% + ${_}px)`}},f.createElement(z1.ItemSlot,{scope:e.__scopeSlider},f.createElement(Pe.span,Y({role:"slider","aria-label":e["aria-label"]||y,"aria-valuemin":i.min,"aria-valuenow":m,"aria-valuemax":i.max,"aria-orientation":i.orientation,"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,tabIndex:i.disabled?void 0:0},o,{ref:d,style:m===void 0?{display:"none"}:e.style,onFocus:ue(e.onFocus,()=>{i.valueIndexToChangeRef.current=r})}))))}),kq=e=>{const{value:t,...n}=e,r=f.useRef(null),o=Fx(t);return f.useEffect(()=>{const i=r.current,s=window.HTMLInputElement.prototype,u=Object.getOwnPropertyDescriptor(s,"value").set;if(o!==t&&u){const d=new Event("input",{bubbles:!0});u.call(i,t),i.dispatchEvent(d)}},[o,t]),f.createElement("input",Y({style:{display:"none"}},n,{ref:r,defaultValue:t}))};function Rq(e=[],t,n){const r=[...e];return r[n]=t,r.sort((o,i)=>o-i)}function B3(e,t,n){const i=100/(n-t)*(e-t);return id(i,[0,100])}function Tq(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function Pq(e,t){if(e.length===1)return 0;const n=e.map(o=>Math.abs(o-t)),r=Math.min(...n);return n.indexOf(r)}function Aq(e,t,n){const r=e/2,i=Qx([0,50],[0,r]);return(r-i(t)*n)*n}function Oq(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function Mq(e,t){if(t>0){const n=Oq(e);return Math.min(...n)>=t}return!0}function Qx(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function Nq(e){return(String(e).split(".")[1]||"").length}function Dq(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}const U3=wq,Iq=Sq,Lq=Eq,Fq=Cq,uo=f.forwardRef(({className:e,...t},n)=>v.jsxs(U3,{ref:n,className:Ce("relative flex w-full touch-none select-none items-center",e),tabIndex:-1,...t,children:[v.jsx(Iq,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20 data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50",children:v.jsx(Lq,{className:"absolute h-full bg-primary data-[disabled]:cursor-not-allowed "})}),v.jsx(Fq,{tabIndex:-1,className:"block h-4 w-4 rounded-full border border-primary/60 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring data-[disabled]:cursor-not-allowed"})]}));uo.displayName=U3.displayName;const tl={capture:!0,passive:!1},jq=2,V2=(e,t,n,r,o,i)=>{if(e!==n&&t===r){if(e<0)return[0,r];if(e+t>i)return[i-r,r]}else{if(ti)return[e,i-e]}return[e,t]},zq=e=>{const{minHeight:t,minWidth:n,maxHeight:r,maxWidth:o,scale:i,show:s}=e,[l,u,d,h,{x:m,y:g,width:y,height:x},_,C,S,b,E,k]=bt(W=>[W.imageWidth,W.imageHeight,W.isInpainting,W.isSD(),W.cropperState,W.setCropperX,W.setCropperY,W.setCropperWidth,W.setCropperHeight,W.isCropperExtenderResizing,W.setIsCropperExtenderResizing]),[P,M]=f.useState(!1);f.useEffect(()=>{_(Math.round((o-512)/2)),C(Math.round((r-512)/2))},[r,o,l,u]);const[A,O]=f.useState({initX:0,initY:0,initHeight:0,initWidth:0,startResizeX:0,startResizeY:0,ord:"top"}),F=()=>{},V=(W,le)=>V2(W,le,m,y,n,o),J=(W,le)=>V2(W,le,g,x,t,r),G=W=>{if(d)return;const le=W.clientX,ge=W.clientY,Ve=Math.round((ge-A.startResizeY)/i),Ue=Math.round((le-A.startResizeX)/i),We=()=>{const $e=A.initHeight-Ve,Ae=A.initY+Ve,[Oe,je]=J(Ae,$e);b(je),C(Oe)},Me=()=>{const $e=A.initHeight+Ve,[Ae,Oe]=J(A.initY,$e);b(Oe),C(Ae)},fe=()=>{const $e=A.initWidth-Ue,Ae=A.initX+Ue,[Oe,je]=V(Ae,$e);S(je),_(Oe)},xe=()=>{const $e=A.initWidth+Ue,[Ae,Oe]=V(A.initX,$e);S(Oe),_(Ae)};if(E)switch(A.ord){case"topleft":{We(),fe();break}case"topright":{We(),xe();break}case"bottomleft":{Me(),fe();break}case"bottomright":{Me(),xe();break}case"top":{We();break}case"right":{xe();break}case"bottom":{Me();break}case"left":{fe();break}}if(P){const $e=A.initX+Ue,Ae=A.initY+Ve,[Oe,je]=V($e,A.initWidth),[Ot,ct]=J(Ae,A.initHeight);S(je),b(ct),_(Oe),C(Ot)}},ae=()=>{E&&k(!1),P&&M(!1)};f.useEffect(()=>{if(E||P)return document.addEventListener("pointermove",G,tl),document.addEventListener("pointerup",ae,tl),document.addEventListener("pointercancel",ae,tl),()=>{document.removeEventListener("pointermove",G,tl),document.removeEventListener("pointerup",ae,tl),document.removeEventListener("pointercancel",ae,tl)}},[E,P,y,x,A]);const U=W=>{const{ord:le}=W.target.dataset;le&&(k(!0),O({initX:m,initY:g,initHeight:x,initWidth:y,startResizeX:W.clientX,startResizeY:W.clientY,ord:le}))},te=(W,le,ge)=>{const We="w-[12px] h-[12px] z-[4] absolute content-[''] block border-2 border-primary borde pointer-events-auto hover:bg-primary";let Me="0",fe="0",xe=ge,$e="-6px";return ge===""&&($e="50%",le==="left"||le==="right"?(xe="top",fe="-50%"):(xe="left",Me="-50%")),v.jsx("div",{className:Ce(We,W),style:{[le]:-6,[xe]:$e,transform:`translate(${Me}, ${fe}) scale(${1/i})`},"data-ord":le+ge,"aria-label":le+ge,tabIndex:-1,role:"button"})},L=()=>v.jsxs("div",{onFocus:F,onPointerDown:U,className:"absolute top-0 h-full w-full",children:[v.jsx("div",{className:"absolute pointer-events-auto top-0 left-0 w-full cursor-ns-resize h-[12px] mt-[-6px]","data-ord":"top"}),v.jsx("div",{className:"absolute pointer-events-auto top-0 right-0 h-full cursor-ew-resize w-[12px] mr-[-6px]","data-ord":"right"}),v.jsx("div",{className:"absolute pointer-events-auto bottom-0 left-0 w-full cursor-ns-resize h-[12px] mb-[-6px]","data-ord":"bottom"}),v.jsx("div",{className:"absolute pointer-events-auto top-0 left-0 h-full cursor-ew-resize w-[12px] ml-[-6px]","data-ord":"left"}),te("cursor-nw-resize","top","left"),te("cursor-ne-resize","top","right"),te("cursor-sw-resize","bottom","left"),te("cursor-se-resize","bottom","right"),te("cursor-ns-resize","top",""),te("cursor-ns-resize","bottom",""),te("cursor-ew-resize","left",""),te("cursor-ew-resize","right","")]}),ie=W=>{M(!0),O({initX:m,initY:g,initHeight:x,initWidth:y,startResizeX:W.clientX,startResizeY:W.clientY,ord:""})},K=()=>v.jsxs("div",{className:Jw("border absolute pointer-events-auto px-2 py-1 rounded-full hover:cursor-move bg-background","origin-top-left top-0 left-0"),style:{transform:`scale(${1/i*.8})`},onPointerDown:ie,children:[y," x ",x]}),Q=()=>v.jsx("div",{className:"outline-dashed outline-primary",style:{height:x,width:y,outlineWidth:`${jq/i*1.3}px`}});return s===!1||!h?null:v.jsx("div",{className:"absolute h-full w-full overflow-hidden pointer-events-none z-[2]",children:v.jsxs("div",{className:"relative pointer-events-none z-[2] [box-shadow:0_0_0_9999px_rgba(0,_0,_0,_0.5)]",style:{height:x,width:y,left:m,top:g},children:[Q(),K(),L()]})})},Bq=()=>{const[e,t,n]=bt(r=>[r.interactiveSegState,r.resetInteractiveSegState,r.handleInteractiveSegAccept]);return e.isInteractiveSeg?v.jsxs("div",{className:"z-10 absolute top-[68px] rounded-xl border-solid border p-[8px] left-1/2 translate-x-[-50%] flex justify-center items-center gap-[8px] bg-background",children:[v.jsx(Rn,{onClick:()=>{t()},size:"sm",variant:"secondary",children:"Cancel"}),v.jsx(Rn,{size:"sm",onClick:()=>{n()},children:"Accept"})]}):null},Uq=e=>{const{x:t,y:n,positive:r}=e,o=r?"bg-[rgba(21,_215,_121,_0.936)] outline-[rgba(98,255,179,0.31)]":"bg-[rgba(237,_49,_55,_0.942)] outline-[rgba(255,89,95,0.31)]";return v.jsx("div",{className:`absolute h-[10px] w-[10px] rounded-[50%] ${o} outline-8 outline`,style:{left:t,top:n,transform:"translate(-50%, -50%)"}})},Vq=()=>{const e=bt(t=>t.interactiveSegState.clicks);return v.jsx("div",{className:"absolute h-full w-full overflow-hidden pointer-events-none",children:e.map(t=>v.jsx(Uq,{x:t[0],y:t[1],positive:t[2]===1},t[3]))})},Wq=()=>v.jsx("div",{children:v.jsx(Bq,{})}),nl={capture:!0,passive:!1},Hq=2,W2=(e,t,n,r)=>t{const{minHeight:t,minWidth:n,scale:r,show:o}=e,[i,s,l,u,{x:d,y:h,width:m,height:g},y,x,_,C,S,b,E]=bt(ie=>[ie.isInpainting,ie.imageHeight,ie.imageWidth,ie.isSD(),ie.extenderState,ie.setExtenderX,ie.setExtenderY,ie.setExtenderWidth,ie.setExtenderHeight,ie.settings.extenderDirection,ie.isCropperExtenderResizing,ie.setIsCropperExtenderResizing]),[k,P]=f.useState({initX:0,initY:0,initHeight:0,initWidth:0,startResizeX:0,startResizeY:0,ord:"top"}),M=()=>{},A=(ie,K)=>W2(ie,K,d,n),O=(ie,K)=>W2(ie,K,h,t),F=ie=>{if(i)return;const K=ie.clientX,Q=ie.clientY,W=Math.round((Q-k.startResizeY)/r),le=Math.round((K-k.startResizeX)/r),ge=()=>{const Me=k.initHeight-W,fe=k.initY+W;let xe=fe,$e=Me;if(S===In.xy)xe>0&&(xe=0,$e=k.initHeight-Math.abs(k.initY));else{const Ae=O(fe,Me);xe=Ae[0],$e=Ae[1]}C($e),x(xe)},Ve=()=>{const Me=k.initHeight+W;let[fe,xe]=O(k.initY,Me);S===In.xy&&xe{const Me=k.initWidth-le,fe=k.initX+le;let xe=fe,$e=Me;if(S===In.xy)xe>0&&(xe=0,$e=k.initWidth-Math.abs(k.initX));else{const Ae=A(fe,Me);xe=Ae[0],$e=Ae[1]}_($e),y(xe)},We=()=>{const Me=k.initWidth+le;let[fe,xe]=A(k.initX,Me);S===In.xy&&xe{b&&E(!1)};f.useEffect(()=>{if(b)return document.addEventListener("pointermove",F,nl),document.addEventListener("pointerup",V,nl),document.addEventListener("pointercancel",V,nl),()=>{document.removeEventListener("pointermove",F,nl),document.removeEventListener("pointerup",V,nl),document.removeEventListener("pointercancel",V,nl)}},[b,m,g,k]);const J=ie=>{const{ord:K}=ie.target.dataset;K&&(E(!0),P({initX:d,initY:h,initHeight:g,initWidth:m,startResizeX:ie.clientX,startResizeY:ie.clientY,ord:K}))},G=(ie,K,Q)=>{const ge="w-[12px] h-[12px] z-[4] absolute content-[''] block border-2 border-primary borde pointer-events-auto hover:bg-primary";let Ve="0",Ue="0",We=Q,Me="-6px";return Q===""&&(Me="50%",K==="left"||K==="right"?(We="top",Ue="-50%"):(We="left",Ve="-50%")),v.jsx("div",{className:Ce(ge,ie),style:{[K]:-6,[We]:Me,transform:`translate(${Ve}, ${Ue}) scale(${1/r})`},"data-ord":K+Q,"aria-label":K+Q,tabIndex:-1,role:"button"})},ae=()=>v.jsxs("div",{onFocus:M,onPointerDown:J,className:"absolute top-0 h-full w-full",children:[[In.y,In.xy].includes(S)?v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"absolute pointer-events-auto top-0 left-0 w-full cursor-ns-resize h-[12px] mt-[-6px]","data-ord":"top"}),v.jsx("div",{className:"absolute pointer-events-auto bottom-0 left-0 w-full cursor-ns-resize h-[12px] mb-[-6px]","data-ord":"bottom"}),G("cursor-ns-resize","top",""),G("cursor-ns-resize","bottom","")]}):v.jsx(v.Fragment,{}),[In.x,In.xy].includes(S)?v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"absolute pointer-events-auto top-0 right-0 h-full cursor-ew-resize w-[12px] mr-[-6px]","data-ord":"right"}),v.jsx("div",{className:"absolute pointer-events-auto top-0 left-0 h-full cursor-ew-resize w-[12px] ml-[-6px]","data-ord":"left"}),G("cursor-ew-resize","left",""),G("cursor-ew-resize","right","")]}):v.jsx(v.Fragment,{}),S===In.xy?v.jsxs(v.Fragment,{children:[G("cursor-nw-resize","top","left"),G("cursor-ne-resize","top","right"),G("cursor-sw-resize","bottom","left"),G("cursor-se-resize","bottom","right")]}):v.jsx(v.Fragment,{})]}),U=ie=>{P({initX:d,initY:h,initHeight:g,initWidth:m,startResizeX:ie.clientX,startResizeY:ie.clientY,ord:""})},te=()=>v.jsxs("div",{className:Jw("border absolute pointer-events-auto px-2 py-1 rounded-full bg-background","origin-top-left top-0 left-0"),style:{transform:`scale(${1/r*.8})`},onPointerDown:U,children:[m," x ",g]}),L=()=>v.jsx("div",{className:Ce("outline-dashed outline-primary"),style:{height:g,width:m,outlineWidth:`${Hq/r*1.3}px`}});return o===!1||!u?null:v.jsx("div",{className:"absolute h-full w-full pointer-events-none z-[2]",children:v.jsxs("div",{className:"relative pointer-events-none z-[2] [box-shadow:0_0_0_9999px_rgba(0,_0,_0,_0.5)]",style:{height:g,width:m,left:d,top:h},children:[L(),te(),ae()]})})},Yq=200,Gq=10,Xq=200,lu=300;function Zq(e){const{file:t}=e,{toast:n}=Td(),[r,o,i,s,l,u,d,h,m,g,y,x,_,C,S,b,E,k,P,M,A,O]=bt(H=>[H.disableShortCuts,H.windowSize,H.isInpainting,H.imageWidth,H.imageHeight,H.settings,H.serverConfig.enableAutoSaving,H.setImageSize,H.setBaseBrushSize,H.interactiveSegState,H.updateInteractiveSegState,H.handleCanvasMouseDown,H.handleCanvasMouseMove,H.undo,H.redo,H.undoDisabled(),H.redoDisabled(),H.getIsProcessing(),H.updateAppState,H.runMannually(),H.runInpainting,H.isCropperExtenderResizing]),F=bt(H=>H.editorState.baseBrushSize),V=bt(H=>H.getBrushSize()),J=bt(H=>H.editorState.renders),G=bt(H=>H.editorState.extraMasks),ae=bt(H=>H.editorState.temporaryMasks),U=bt(H=>H.editorState.lineGroups),te=bt(H=>H.editorState.curLineGroup),[L,ie]=f.useState(!1),[K,Q]=Rx(t),[W,le]=f.useState(),[ge,Ve]=f.useState(),[{x:Ue,y:We},Me]=f.useState({x:-1,y:-1}),[fe,xe]=f.useState(!1),[$e,Ae]=f.useState(!1),[Oe,je]=f.useState(!1),[Ot,ct]=f.useState(1),[Yt,Er]=f.useState(!1),[gt,js]=f.useState(1),I=o.width/2,X=o.height/2,Z=f.useRef(null),[we,he]=f.useState(!1),[de,ke]=f.useState(!1),[ft,pt]=f.useState(0),bn=f.useCallback(()=>te.length!==0,[te]);f.useEffect(()=>{if(!ge||!Q||s===0||l===0)return;const H=J.length===0?K:J[J.length-1];ge.canvas.width=s,ge.canvas.height=l,ge.clearRect(0,0,ge.canvas.width,ge.canvas.height),ge.drawImage(H,0,0,s,l)},[J,K,Q,ge,l,s]),f.useEffect(()=>{!W||!Q||s===0||l===0||(W.canvas.width=s,W.canvas.height=l,W.clearRect(0,0,W.canvas.width,W.canvas.height),ae.forEach(H=>{W.drawImage(H,0,0,s,l)}),G.forEach(H=>{W.drawImage(H,0,0,s,l)}),g.isInteractiveSeg&&g.tmpInteractiveSegMask&&W.drawImage(g.tmpInteractiveSegMask,0,0,s,l),GR(W,te))},[ae,G,Q,g,W,te,l,s]);const Cr=f.useCallback(async()=>{let H=t;if(J.length>0){const Ge=J[J.length-1];H=await ku(Ge.currentSrc,t.name,t.type)}return H},[t,J]),ki=()=>J.length!==0,_o=f.useCallback(()=>{let H=512,Ge=512;return Q?(J.length===0?(H=K.naturalWidth,Ge=K.naturalHeight):J.length!==0&&(H=J[J.length-1].width,Ge=J[J.length-1].height),[H,Ge]):[H,Ge]},[K,Q,J]);f.useEffect(()=>{var Gd;if(!Q)return;const[H,Ge]=_o();(H!==s||Ge!==l)&&h(H,Ge);const st=o.width/H,Qr=(o.height-Yq)/Ge;let an=1;(st<1||Qr<1)&&(an=Math.min(st,Qr)),js(an),ct(an),console.log(`[on file load] image size: ${H}x${Ge}, scale: ${an}, initialCentered: ${we}`),W!=null&&W.canvas&&(console.log("[on file load] set canvas size"),H!=W.canvas.width&&(W.canvas.width=H),Ge!=W.canvas.height&&(W.canvas.height=Ge)),we||((Gd=Z.current)==null||Gd.centerView(an,1),console.log("[on file load] centerView"),he(!0))},[Z,l,s,K,Q,o,we,_o]),f.useEffect(()=>{var H;console.log("[useEffect] centerView"),(H=Z==null?void 0:Z.current)==null||H.centerView(gt,1)},[l,s,Z,gt]);const Vn=f.useCallback(()=>{if(!gt||!o)return;const H=Z.current;if(!H)return;const Ge=(o.width-s*gt)/2,st=(o.height-l*gt)/2;H.setTransform(Ge,st,gt,200,"easeOutQuad"),H.instance.transformState.scale&&(H.instance.transformState.scale=gt),ct(gt),Er(!1)},[Z,o,l,s,o.height,gt]);f.useEffect(()=>(window.addEventListener("resize",()=>{Vn()}),()=>{window.removeEventListener("resize",()=>{Vn()})}),[o,Vn]),Zn("Escape",()=>{k||(de?ke(!1):Vn())},[de,i,Vn]);const Ri=H=>{const Ge=H.nativeEvent;Me({x:Ge.pageX,y:Ge.pageY})},zs=H=>{k||g.isInteractiveSeg||Oe||de&&te.length!==0&&_(c0(H))},Ti=async H=>{P({isPluginRunning:!0});const Ge=await Cr();try{const st=await gT(!0,jR.InteractiveSeg,Ge,void 0,H),{blob:Qr}=st,an=new Image;an.onload=()=>{y({tmpInteractiveSegMask:an})},an.src=Qr}catch(st){n({variant:"destructive",description:st.message?st.message:st.toString()})}P({isPluginRunning:!1})},$c=H=>{if(!bn())return;if(cC(H)){je(!1);return}g.isInteractiveSeg||Oe||!K.src||!(W!=null&&W.canvas)||i||de&&(M?ke(!1):A())},yg=H=>{if(g.isInteractiveSeg){const Ge=c0(H),st=[...g.clicks];lC(H)?st.push([Ge.x,Ge.y,0,st.length]):st.push([Ge.x,Ge.y,1,st.length]),Ti(st),y({clicks:st})}},wg=H=>{if(!(k||g.isInteractiveSeg||Oe||!Q||!(W!=null&&W.canvas))&&!lC(H)){if(cC(H)){je(!0);return}ke(!0),x(c0(H))}},Kd=H=>{H.preventDefault(),C()};Zn("meta+z,ctrl+z",Kd);const kc=H=>{H.preventDefault(),S()};Zn("shift+ctrl+z,shift+meta+z",kc),o2("Tab",H=>{H==null||H.preventDefault(),H==null||H.stopPropagation(),ki()&&ie(()=>(window.setTimeout(()=>{pt(100)},10),!0))},H=>{H==null||H.preventDefault(),H==null||H.stopPropagation(),ki()&&(window.setTimeout(()=>{pt(0)},10),window.setTimeout(()=>{ie(!1)},lu))});const Rc=f.useCallback(async()=>{if(t===void 0)return;if(d&&J.length>0){try{await Vj(J[J.length-1],t.name,t.type),n({description:"Save image success"})}catch(st){n({variant:"destructive",title:"Uh oh! Something went wrong.",description:st.message?st.message:st.toString()})}return}const H=t.name.replace(/(\.[\w\d_-]+)$/i,"_cleanup$1"),Ge=J[J.length-1];if(vF(Ge.currentSrc,H),u.enableDownloadMask){let st=t.name.replace(/(\.[\w\d_-]+)$/i,"_mask$1");st=st.replace(/\.[^/.]+$/,".jpg");const Qr=Lp(s,l,U),an=document.createElement("a");an.download=st,an.href=Qr.toDataURL("image/jpeg"),an.click()}},[t,d,J,u,l,s,U]);Zn("meta+s,ctrl+s",Rc);const Tc=H=>{H!==fe&&!Oe&&!O&&xe(H)},xg=f.useCallback(()=>{if(k)return"default";if(Oe)return"grab";if(fe)return"none"},[fe,Oe,k]);Zn("[",()=>{let H=F;F>10&&(H=F-10),F<=10&&F>0&&(H=F-5),m(H)},[F]),Zn("]",()=>{m(F+10)},[F]),Zn("shift+r",()=>{M&&bn()&&A()},[M,A,bn]),Zn("ctrl+c,meta+c",async()=>{await pF()&&J.length>0&&W!=null&&W.canvas&&(await gF(W==null?void 0:W.canvas),n({title:"Copy inpainting result to clipboard"}))},[J,W]),o2(" ",H=>{r||(H==null||H.preventDefault(),H==null||H.stopPropagation(),xe(!1),je(!0))},H=>{r||(H==null||H.preventDefault(),H==null||H.stopPropagation(),xe(!0),je(!1))});const Pc=()=>{var Ge,st,Qr,an;let H=gt;return((st=(Ge=Z.current)==null?void 0:Ge.instance)==null?void 0:st.transformState.scale)!==void 0&&(H=(an=(Qr=Z.current)==null?void 0:Qr.instance)==null?void 0:an.transformState.scale),H},Yd=(H,Ge)=>{const st=Pc();return{width:`${V*st}px`,height:`${V*st}px`,left:`${H}px`,top:`${Ge}px`,transform:"translate(-50%, -50%)"}},Ac=H=>v.jsx("div",{className:"absolute rounded-[50%] border-[1px] border-[solid] border-[#ffcc00] pointer-events-none bg-[#ffcc00bb]",style:H}),bg=H=>{m(H),$e||(Ae(!0),window.setTimeout(()=>{Ae(!1)},1e4))},_g=()=>v.jsx("div",{className:"absolute h-[20px] w-[20px] pointer-events-none rounded-[50%] bg-[rgba(21,_215,_121,_0.936)] [box-shadow:0_0_0_0_rgba(21,_215,_121,_0.936)] animate-pulse",style:{left:`${Ue}px`,top:`${We}px`,transform:"translate(-50%, -50%)"},children:v.jsx(dK,{})}),Sg=()=>v.jsx(fq,{ref:H=>{H&&(Z.current=H)},panning:{disabled:!Oe,velocityDisabled:!0},wheel:{step:.05},centerZoomedOut:!0,alignmentAnimation:{disabled:!0},centerOnInit:!0,limitToBounds:!1,doubleClick:{disabled:!0},initialScale:gt,minScale:gt*.3,onPanning:()=>{Yt||Er(!0)},onZoom:H=>{ct(H.state.scale)},children:v.jsxs(mq,{contentStyle:{visibility:we?"visible":"hidden"},children:[v.jsxs("div",{className:"grid [grid-template-areas:'editor-content'] gap-y-4",children:[v.jsx("canvas",{className:"[grid-area:editor-content]",style:{clipPath:`inset(0 ${ft}% 0 0)`,transition:`clip-path ${lu}ms`},ref:H=>{if(H&&!ge){const Ge=H.getContext("2d");Ge&&Ve(Ge)}}}),v.jsx("canvas",{className:Ce("[grid-area:editor-content]",k?"pointer-events-none animate-pulse duration-600":""),style:{cursor:xg(),clipPath:`inset(0 ${ft}% 0 0)`,transition:`clip-path ${lu}ms`},onContextMenu:H=>{H.preventDefault()},onMouseOver:()=>{Tc(!0),Ae(!1)},onFocus:()=>Tc(!0),onMouseLeave:()=>Tc(!1),onMouseDown:wg,onMouseUp:yg,onMouseMove:zs,ref:H=>{if(H&&!W){const Ge=H.getContext("2d");Ge&&le(Ge)}}}),v.jsx("div",{className:"[grid-area:editor-content] pointer-events-none grid [grid-template-areas:'original-image-content']",style:{width:`${s}px`,height:`${l}px`},children:L&&v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"[grid-area:original-image-content] z-10 bg-primary h-full w-[6px] justify-self-end",style:{marginRight:`${ft}%`,transition:`margin-right ${lu}ms`}}),v.jsx("img",{className:"[grid-area:original-image-content]",src:K.src,alt:"original",style:{width:`${s}px`,height:`${l}px`}})]})})]}),v.jsx(zq,{maxHeight:l,maxWidth:s,minHeight:Math.min(512,l),minWidth:Math.min(512,s),scale:Pc(),show:u.showCropper}),v.jsx(Kq,{minHeight:Math.min(512,l),minWidth:Math.min(512,s),scale:Pc(),show:u.showExtender}),g.isInteractiveSeg?v.jsx(Vq,{}):v.jsx(v.Fragment,{})]})});return v.jsxs("div",{className:"flex w-screen h-screen justify-center items-center","aria-hidden":"true",onMouseMove:Ri,onMouseUp:$c,children:[Sg(),fe&&!i&&!Oe&&(g.isInteractiveSeg?_g():Ac(Yd(Ue,We))),$e&&Ac(Yd(I,X)),v.jsxs("div",{className:" overflow-hidden fixed flex bottom-5 border px-4 py-2 rounded-[3rem] gap-8 items-center justify-center backdrop-filter backdrop-blur-md bg-background/70",children:[v.jsx(uo,{className:"w-48",defaultValue:[50],min:Gq,max:Xq,step:1,tabIndex:-1,value:[F],onValueChange:H=>bg(H[0]),onClick:()=>Ae(!1)}),v.jsxs("div",{className:"flex gap-2",children:[v.jsx(vn,{tooltip:"Reset zoom & pan",disabled:Ot===gt&&Yt===!1,onClick:Vn,children:v.jsx(ZU,{})}),v.jsx(vn,{tooltip:"Undo",onClick:Kd,disabled:b,children:v.jsx(aV,{})}),v.jsx(vn,{tooltip:"Redo",onClick:kc,disabled:E,children:v.jsx(oV,{})}),v.jsx(vn,{tooltip:"Show original image",onPointerDown:H=>{H.preventDefault(),ie(()=>(window.setTimeout(()=>{pt(100)},10),!0))},onPointerUp:()=>{window.setTimeout(()=>{pt(0)},10),window.setTimeout(()=>{ie(!1)},lu)},disabled:J.length===0,children:v.jsx(qU,{})}),v.jsx(vn,{tooltip:"Save Image",disabled:!J.length,onClick:Rc,children:v.jsx(GU,{})}),u.enableManualInpainting&&u.model.model_type==="inpaint"?v.jsx(vn,{tooltip:"Run Inpainting",disabled:k||!bn()&&G.length===0,onClick:()=>{A()},children:v.jsx(XU,{})}):v.jsx(v.Fragment,{})]})]})]})}const qq=()=>{const[e,t]=bt(n=>[n.imageWidth,n.imageHeight]);return!e||!t?null:v.jsxs("div",{className:"border rounded-lg px-2 py-[6px] z-10 bg-background",children:[e,"x",t]})},B1=["Enter"," "],Qq=["ArrowDown","PageUp","Home"],V3=["ArrowUp","PageDown","End"],Jq=[...Qq,...V3],eQ={ltr:[...B1,"ArrowRight"],rtl:[...B1,"ArrowLeft"]},tQ={ltr:["ArrowLeft"],rtl:["ArrowRight"]},fg="Menu",[ld,nQ,rQ]=zd(fg),[Na,W3]=An(fg,[rQ,Ns,Qm]),pg=Ns(),H3=Qm(),[K3,Fs]=Na(fg),[oQ,Hd]=Na(fg),iQ=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:i,modal:s=!0}=e,l=pg(t),[u,d]=f.useState(null),h=f.useRef(!1),m=Ft(i),g=Sc(o);return f.useEffect(()=>{const y=()=>{h.current=!0,document.addEventListener("pointerdown",x,{capture:!0,once:!0}),document.addEventListener("pointermove",x,{capture:!0,once:!0})},x=()=>h.current=!1;return document.addEventListener("keydown",y,{capture:!0}),()=>{document.removeEventListener("keydown",y,{capture:!0}),document.removeEventListener("pointerdown",x,{capture:!0}),document.removeEventListener("pointermove",x,{capture:!0})}},[]),f.createElement(Od,l,f.createElement(K3,{scope:t,open:n,onOpenChange:m,content:u,onContentChange:d},f.createElement(oQ,{scope:t,onClose:f.useCallback(()=>m(!1),[m]),isUsingKeyboardRef:h,dir:g,modal:s},r)))},Y3=f.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=pg(n);return f.createElement(zm,Y({},o,r,{ref:t}))}),G3="MenuPortal",[sQ,X3]=Na(G3,{forceMount:void 0}),aQ=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,i=Fs(G3,t);return f.createElement(sQ,{scope:t,forceMount:n},f.createElement(xn,{present:n||i.open},f.createElement(Md,{asChild:!0,container:o},r)))},yo="MenuContent",[lQ,Jx]=Na(yo),cQ=f.forwardRef((e,t)=>{const n=X3(yo,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,i=Fs(yo,e.__scopeMenu),s=Hd(yo,e.__scopeMenu);return f.createElement(ld.Provider,{scope:e.__scopeMenu},f.createElement(xn,{present:r||i.open},f.createElement(ld.Slot,{scope:e.__scopeMenu},s.modal?f.createElement(uQ,Y({},o,{ref:t})):f.createElement(dQ,Y({},o,{ref:t})))))}),uQ=f.forwardRef((e,t)=>{const n=Fs(yo,e.__scopeMenu),r=f.useRef(null),o=Be(t,r);return f.useEffect(()=>{const i=r.current;if(i)return Xm(i)},[]),f.createElement(eb,Y({},e,{ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:ue(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)}))}),dQ=f.forwardRef((e,t)=>{const n=Fs(yo,e.__scopeMenu);return f.createElement(eb,Y({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)}))}),eb=f.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:l,onEntryFocus:u,onEscapeKeyDown:d,onPointerDownOutside:h,onFocusOutside:m,onInteractOutside:g,onDismiss:y,disableOutsideScroll:x,..._}=e,C=Fs(yo,n),S=Hd(yo,n),b=pg(n),E=H3(n),k=nQ(n),[P,M]=f.useState(null),A=f.useRef(null),O=Be(t,A,C.onContentChange),F=f.useRef(0),V=f.useRef(""),J=f.useRef(0),G=f.useRef(null),ae=f.useRef("right"),U=f.useRef(0),te=x?Gm:f.Fragment,L=x?{as:Wo,allowPinchZoom:!0}:void 0,ie=Q=>{var W,le;const ge=V.current+Q,Ve=k().filter($e=>!$e.disabled),Ue=document.activeElement,We=(W=Ve.find($e=>$e.ref.current===Ue))===null||W===void 0?void 0:W.textValue,Me=Ve.map($e=>$e.textValue),fe=RQ(Me,ge,We),xe=(le=Ve.find($e=>$e.textValue===fe))===null||le===void 0?void 0:le.ref.current;(function $e(Ae){V.current=Ae,window.clearTimeout(F.current),Ae!==""&&(F.current=window.setTimeout(()=>$e(""),1e3))})(ge),xe&&setTimeout(()=>xe.focus())};f.useEffect(()=>()=>window.clearTimeout(F.current),[]),Km();const K=f.useCallback(Q=>{var W,le;return ae.current===((W=G.current)===null||W===void 0?void 0:W.side)&&PQ(Q,(le=G.current)===null||le===void 0?void 0:le.area)},[]);return f.createElement(lQ,{scope:n,searchRef:V,onItemEnter:f.useCallback(Q=>{K(Q)&&Q.preventDefault()},[K]),onItemLeave:f.useCallback(Q=>{var W;K(Q)||((W=A.current)===null||W===void 0||W.focus(),M(null))},[K]),onTriggerLeave:f.useCallback(Q=>{K(Q)&&Q.preventDefault()},[K]),pointerGraceTimerRef:J,onPointerGraceIntentChange:f.useCallback(Q=>{G.current=Q},[])},f.createElement(te,L,f.createElement(Hm,{asChild:!0,trapped:o,onMountAutoFocus:ue(i,Q=>{var W;Q.preventDefault(),(W=A.current)===null||W===void 0||W.focus()}),onUnmountAutoFocus:s},f.createElement(yc,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:d,onPointerDownOutside:h,onFocusOutside:m,onInteractOutside:g,onDismiss:y},f.createElement(ZP,Y({asChild:!0},E,{dir:S.dir,orientation:"vertical",loop:r,currentTabStopId:P,onCurrentTabStopIdChange:M,onEntryFocus:ue(u,Q=>{S.isUsingKeyboardRef.current||Q.preventDefault()})}),f.createElement(Bm,Y({role:"menu","aria-orientation":"vertical","data-state":tA(C.open),"data-radix-menu-content":"",dir:S.dir},b,_,{ref:O,style:{outline:"none",..._.style},onKeyDown:ue(_.onKeyDown,Q=>{const le=Q.target.closest("[data-radix-menu-content]")===Q.currentTarget,ge=Q.ctrlKey||Q.altKey||Q.metaKey,Ve=Q.key.length===1;le&&(Q.key==="Tab"&&Q.preventDefault(),!ge&&Ve&&ie(Q.key));const Ue=A.current;if(Q.target!==Ue||!Jq.includes(Q.key))return;Q.preventDefault();const Me=k().filter(fe=>!fe.disabled).map(fe=>fe.ref.current);V3.includes(Q.key)&&Me.reverse(),$Q(Me)}),onBlur:ue(e.onBlur,Q=>{Q.currentTarget.contains(Q.target)||(window.clearTimeout(F.current),V.current="")}),onPointerMove:ue(e.onPointerMove,cd(Q=>{const W=Q.target,le=U.current!==Q.clientX;if(Q.currentTarget.contains(W)&&le){const ge=Q.clientX>U.current?"right":"left";ae.current=ge,U.current=Q.clientX}}))})))))))}),fQ=f.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return f.createElement(Pe.div,Y({},r,{ref:t}))}),U1="MenuItem",H2="menu.itemSelect",tb=f.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,i=f.useRef(null),s=Hd(U1,e.__scopeMenu),l=Jx(U1,e.__scopeMenu),u=Be(t,i),d=f.useRef(!1),h=()=>{const m=i.current;if(!n&&m){const g=new CustomEvent(H2,{bubbles:!0,cancelable:!0});m.addEventListener(H2,y=>r==null?void 0:r(y),{once:!0}),cx(m,g),g.defaultPrevented?d.current=!1:s.onClose()}};return f.createElement(Z3,Y({},o,{ref:u,disabled:n,onClick:ue(e.onClick,h),onPointerDown:m=>{var g;(g=e.onPointerDown)===null||g===void 0||g.call(e,m),d.current=!0},onPointerUp:ue(e.onPointerUp,m=>{var g;d.current||(g=m.currentTarget)===null||g===void 0||g.click()}),onKeyDown:ue(e.onKeyDown,m=>{const g=l.searchRef.current!=="";n||g&&m.key===" "||B1.includes(m.key)&&(m.currentTarget.click(),m.preventDefault())})}))}),Z3=f.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...i}=e,s=Jx(U1,n),l=H3(n),u=f.useRef(null),d=Be(t,u),[h,m]=f.useState(!1),[g,y]=f.useState("");return f.useEffect(()=>{const x=u.current;if(x){var _;y(((_=x.textContent)!==null&&_!==void 0?_:"").trim())}},[i.children]),f.createElement(ld.ItemSlot,{scope:n,disabled:r,textValue:o??g},f.createElement(qP,Y({asChild:!0},l,{focusable:!r}),f.createElement(Pe.div,Y({role:"menuitem","data-highlighted":h?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0},i,{ref:d,onPointerMove:ue(e.onPointerMove,cd(x=>{r?s.onItemLeave(x):(s.onItemEnter(x),x.defaultPrevented||x.currentTarget.focus())})),onPointerLeave:ue(e.onPointerLeave,cd(x=>s.onItemLeave(x))),onFocus:ue(e.onFocus,()=>m(!0)),onBlur:ue(e.onBlur,()=>m(!1))}))))}),pQ=f.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return f.createElement(Q3,{scope:e.__scopeMenu,checked:n},f.createElement(tb,Y({role:"menuitemcheckbox","aria-checked":om(n)?"mixed":n},o,{ref:t,"data-state":nb(n),onSelect:ue(o.onSelect,()=>r==null?void 0:r(om(n)?!0:!n),{checkForDefaultPrevented:!1})})))}),hQ="MenuRadioGroup",[$te,mQ]=Na(hQ,{value:void 0,onValueChange:()=>{}}),gQ="MenuRadioItem",vQ=f.forwardRef((e,t)=>{const{value:n,...r}=e,o=mQ(gQ,e.__scopeMenu),i=n===o.value;return f.createElement(Q3,{scope:e.__scopeMenu,checked:i},f.createElement(tb,Y({role:"menuitemradio","aria-checked":i},r,{ref:t,"data-state":nb(i),onSelect:ue(r.onSelect,()=>{var s;return(s=o.onValueChange)===null||s===void 0?void 0:s.call(o,n)},{checkForDefaultPrevented:!1})})))}),q3="MenuItemIndicator",[Q3,yQ]=Na(q3,{checked:!1}),wQ=f.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,i=yQ(q3,n);return f.createElement(xn,{present:r||om(i.checked)||i.checked===!0},f.createElement(Pe.span,Y({},o,{ref:t,"data-state":nb(i.checked)})))}),xQ=f.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return f.createElement(Pe.div,Y({role:"separator","aria-orientation":"horizontal"},r,{ref:t}))}),J3="MenuSub",[bQ,eA]=Na(J3),_Q=e=>{const{__scopeMenu:t,children:n,open:r=!1,onOpenChange:o}=e,i=Fs(J3,t),s=pg(t),[l,u]=f.useState(null),[d,h]=f.useState(null),m=Ft(o);return f.useEffect(()=>(i.open===!1&&m(!1),()=>m(!1)),[i.open,m]),f.createElement(Od,s,f.createElement(K3,{scope:t,open:r,onOpenChange:m,content:d,onContentChange:h},f.createElement(bQ,{scope:t,contentId:nr(),triggerId:nr(),trigger:l,onTriggerChange:u},n)))},gp="MenuSubTrigger",SQ=f.forwardRef((e,t)=>{const n=Fs(gp,e.__scopeMenu),r=Hd(gp,e.__scopeMenu),o=eA(gp,e.__scopeMenu),i=Jx(gp,e.__scopeMenu),s=f.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:u}=i,d={__scopeMenu:e.__scopeMenu},h=f.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return f.useEffect(()=>h,[h]),f.useEffect(()=>{const m=l.current;return()=>{window.clearTimeout(m),u(null)}},[l,u]),f.createElement(Y3,Y({asChild:!0},d),f.createElement(Z3,Y({id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":tA(n.open)},e,{ref:Am(t,o.onTriggerChange),onClick:m=>{var g;(g=e.onClick)===null||g===void 0||g.call(e,m),!(e.disabled||m.defaultPrevented)&&(m.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:ue(e.onPointerMove,cd(m=>{i.onItemEnter(m),!m.defaultPrevented&&!e.disabled&&!n.open&&!s.current&&(i.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),h()},100))})),onPointerLeave:ue(e.onPointerLeave,cd(m=>{var g;h();const y=(g=n.content)===null||g===void 0?void 0:g.getBoundingClientRect();if(y){var x;const _=(x=n.content)===null||x===void 0?void 0:x.dataset.side,C=_==="right",S=C?-5:5,b=y[C?"left":"right"],E=y[C?"right":"left"];i.onPointerGraceIntentChange({area:[{x:m.clientX+S,y:m.clientY},{x:b,y:y.top},{x:E,y:y.top},{x:E,y:y.bottom},{x:b,y:y.bottom}],side:_}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(m),m.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:ue(e.onKeyDown,m=>{const g=i.searchRef.current!=="";if(!(e.disabled||g&&m.key===" ")&&eQ[r.dir].includes(m.key)){var y;n.onOpenChange(!0),(y=n.content)===null||y===void 0||y.focus(),m.preventDefault()}})})))}),EQ="MenuSubContent",CQ=f.forwardRef((e,t)=>{const n=X3(yo,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,i=Fs(yo,e.__scopeMenu),s=Hd(yo,e.__scopeMenu),l=eA(EQ,e.__scopeMenu),u=f.useRef(null),d=Be(t,u);return f.createElement(ld.Provider,{scope:e.__scopeMenu},f.createElement(xn,{present:r||i.open},f.createElement(ld.Slot,{scope:e.__scopeMenu},f.createElement(eb,Y({id:l.contentId,"aria-labelledby":l.triggerId},o,{ref:d,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:h=>{var m;s.isUsingKeyboardRef.current&&((m=u.current)===null||m===void 0||m.focus()),h.preventDefault()},onCloseAutoFocus:h=>h.preventDefault(),onFocusOutside:ue(e.onFocusOutside,h=>{h.target!==l.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:ue(e.onEscapeKeyDown,h=>{s.onClose(),h.preventDefault()}),onKeyDown:ue(e.onKeyDown,h=>{const m=h.currentTarget.contains(h.target),g=tQ[s.dir].includes(h.key);if(m&&g){var y;i.onOpenChange(!1),(y=l.trigger)===null||y===void 0||y.focus(),h.preventDefault()}})})))))});function tA(e){return e?"open":"closed"}function om(e){return e==="indeterminate"}function nb(e){return om(e)?"indeterminate":e?"checked":"unchecked"}function $Q(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function kQ(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function RQ(e,t,n){const o=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=kQ(e,Math.max(i,0));o.length===1&&(s=s.filter(d=>d!==n));const u=s.find(d=>d.toLowerCase().startsWith(o.toLowerCase()));return u!==n?u:void 0}function TQ(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,s=t.length-1;ir!=h>r&&n<(d-l)*(r-u)/(h-u)+l&&(o=!o)}return o}function PQ(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return TQ(n,t)}function cd(e){return t=>t.pointerType==="mouse"?e(t):void 0}const AQ=iQ,OQ=Y3,MQ=aQ,NQ=cQ,DQ=fQ,IQ=tb,LQ=pQ,FQ=vQ,jQ=wQ,zQ=xQ,BQ=_Q,UQ=SQ,VQ=CQ,nA="DropdownMenu",[WQ,kte]=An(nA,[W3]),Sr=W3(),[HQ,rA]=WQ(nA),KQ=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:o,defaultOpen:i,onOpenChange:s,modal:l=!0}=e,u=Sr(t),d=f.useRef(null),[h=!1,m]=Zr({prop:o,defaultProp:i,onChange:s});return f.createElement(HQ,{scope:t,triggerId:nr(),triggerRef:d,contentId:nr(),open:h,onOpenChange:m,onOpenToggle:f.useCallback(()=>m(g=>!g),[m]),modal:l},f.createElement(AQ,Y({},u,{open:h,onOpenChange:m,dir:r,modal:l}),n))},YQ="DropdownMenuTrigger",GQ=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=e,i=rA(YQ,n),s=Sr(n);return f.createElement(OQ,Y({asChild:!0},s),f.createElement(Pe.button,Y({type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,disabled:r},o,{ref:Am(t,i.triggerRef),onPointerDown:ue(e.onPointerDown,l=>{!r&&l.button===0&&l.ctrlKey===!1&&(i.onOpenToggle(),i.open||l.preventDefault())}),onKeyDown:ue(e.onKeyDown,l=>{r||(["Enter"," "].includes(l.key)&&i.onOpenToggle(),l.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})))}),XQ=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Sr(t);return f.createElement(MQ,Y({},r,n))},ZQ="DropdownMenuContent",qQ=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=rA(ZQ,n),i=Sr(n),s=f.useRef(!1);return f.createElement(NQ,Y({id:o.contentId,"aria-labelledby":o.triggerId},i,r,{ref:t,onCloseAutoFocus:ue(e.onCloseAutoFocus,l=>{var u;s.current||(u=o.triggerRef.current)===null||u===void 0||u.focus(),s.current=!1,l.preventDefault()}),onInteractOutside:ue(e.onInteractOutside,l=>{const u=l.detail.originalEvent,d=u.button===0&&u.ctrlKey===!0,h=u.button===2||d;(!o.modal||h)&&(s.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)"}}))}),QQ=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Sr(n);return f.createElement(DQ,Y({},o,r,{ref:t}))}),JQ=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Sr(n);return f.createElement(IQ,Y({},o,r,{ref:t}))}),eJ=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Sr(n);return f.createElement(LQ,Y({},o,r,{ref:t}))}),tJ=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Sr(n);return f.createElement(FQ,Y({},o,r,{ref:t}))}),nJ=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Sr(n);return f.createElement(jQ,Y({},o,r,{ref:t}))}),rJ=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Sr(n);return f.createElement(zQ,Y({},o,r,{ref:t}))}),oJ=e=>{const{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:o,defaultOpen:i}=e,s=Sr(t),[l=!1,u]=Zr({prop:r,defaultProp:i,onChange:o});return f.createElement(BQ,Y({},s,{open:l,onOpenChange:u}),n)},iJ=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Sr(n);return f.createElement(UQ,Y({},o,r,{ref:t}))}),sJ=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Sr(n);return f.createElement(VQ,Y({},o,r,{ref:t,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)"}}))}),aJ=KQ,lJ=GQ,cJ=XQ,oA=qQ,iA=QQ,sA=JQ,aA=eJ,lA=tJ,cA=nJ,uA=rJ,uJ=oJ,dA=iJ,fA=sJ,dJ=aJ,fJ=lJ,K2=uJ,V1=f.forwardRef(({className:e,inset:t,children:n,...r},o)=>v.jsxs(dA,{ref:o,className:Ce("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...r,children:[n,v.jsx(Jj,{className:"ml-auto h-4 w-4"})]}));V1.displayName=dA.displayName;const W1=f.forwardRef(({className:e,...t},n)=>v.jsx(fA,{ref:n,className:Ce("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),...t}));W1.displayName=fA.displayName;const pA=f.forwardRef(({className:e,sideOffset:t=4,...n},r)=>v.jsx(cJ,{children:v.jsx(oA,{ref:r,sideOffset:t,className:Ce("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),onCloseAutoFocus:o=>o.preventDefault(),...n})}));pA.displayName=oA.displayName;const il=f.forwardRef(({className:e,inset:t,...n},r)=>v.jsx(sA,{ref:r,className:Ce("relative flex cursor-default select-none items-center 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",t&&"pl-8",e),...n}));il.displayName=sA.displayName;const pJ=f.forwardRef(({className:e,children:t,checked:n,...r},o)=>v.jsxs(aA,{ref:o,className:Ce("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:n,...r,children:[v.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:v.jsx(cA,{children:v.jsx(vT,{className:"h-4 w-4"})})}),t]}));pJ.displayName=aA.displayName;const hJ=f.forwardRef(({className:e,children:t,...n},r)=>v.jsxs(lA,{ref:r,className:Ce("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),...n,children:[v.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:v.jsx(cA,{children:v.jsx(oz,{className:"h-4 w-4 fill-current"})})}),t]}));hJ.displayName=lA.displayName;const mJ=f.forwardRef(({className:e,inset:t,...n},r)=>v.jsx(iA,{ref:r,className:Ce("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));mJ.displayName=iA.displayName;const gJ=f.forwardRef(({className:e,...t},n)=>v.jsx(uA,{ref:n,className:Ce("-mx-1 my-1 h-px bg-muted",e),...t}));gJ.displayName=uA.displayName;const Y2={RemoveBG:{IconClass:VC,showName:"RemoveBG"},AnimeSeg:{IconClass:VC,showName:"Anime Segmentation"},RealESRGAN:{IconClass:XT,showName:"RealESRGAN"},GFPGAN:{IconClass:WC,showName:"GFPGAN"},RestoreFormer:{IconClass:WC,showName:"RestoreFormer"},InteractiveSeg:{IconClass:nV,showName:"Interactive Segmentation"}},vJ=()=>{const[e,t,n,r]=bt(d=>[d.file,d.serverConfig.plugins,d.updateInteractiveSegState,d.runRenderablePlugin]),o=!e;if(t.length===0)return null;const i=(d,h)=>{h==="InteractiveSeg"?n({isInteractiveSeg:!0}):r(d,h)},s=()=>v.jsxs(K2,{children:[v.jsx(V1,{disabled:o,children:v.jsxs("div",{className:"flex gap-2 items-center",children:[v.jsx(XT,{}),"RealESRGAN"]})}),v.jsxs(W1,{children:[v.jsx(il,{onClick:()=>r(!1,"RealESRGAN",{upscale:2}),children:"upscale 2x"}),v.jsx(il,{onClick:()=>r(!1,"RealESRGAN",{upscale:4}),children:"upscale 4x"})]})]},"RealESRGAN"),l=d=>{const{IconClass:h,showName:m}=Y2[d.name];return v.jsxs(K2,{children:[v.jsx(V1,{disabled:o,children:v.jsxs("div",{className:"flex gap-2 items-center",children:[v.jsx(h,{className:"p-1"}),m]})}),v.jsxs(W1,{children:[v.jsx(il,{onClick:()=>i(!1,d.name),children:"Remove Background"}),v.jsx(il,{onClick:()=>i(!0,d.name),children:"Generate Mask"})]})]},d.name)},u=()=>t.map(d=>{const{IconClass:h,showName:m}=Y2[d.name];return d.name==="RealESRGAN"?s():d.name==="RemoveBG"||d.name==="AnimeSeg"?l(d):v.jsx(il,{onClick:()=>i(!1,d.name),disabled:o,children:v.jsxs("div",{className:"flex gap-2 items-center",children:[v.jsx(h,{className:"p-1"}),m]})},d.name)});return v.jsxs(dJ,{modal:!1,children:[v.jsx(fJ,{className:"border rounded-lg z-10 bg-background outline-none",tabIndex:-1,children:v.jsx(Rn,{variant:"ghost",size:"icon",asChild:!0,className:"p-1.5",children:v.jsx(WU,{strokeWidth:1})})}),v.jsx(pA,{side:"bottom",align:"start",children:u()})]})},yJ=Sx,wJ=gP,xJ=Ex,hA=f.forwardRef(({className:e,...t},n)=>v.jsx(Nd,{className:Ce("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));hA.displayName=Nd.displayName;const bJ=Om("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-200 data-[state=open]:duration-300",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),mA=f.forwardRef(({side:e="right",className:t,children:n,...r},o)=>v.jsxs(xJ,{children:[v.jsx(hA,{}),v.jsx(Dd,{ref:o,className:Ce(bJ({side:e}),t),...r,children:n})]}));mA.displayName=Dd.displayName;const gA=({className:e,...t})=>v.jsx("div",{className:Ce("flex flex-col space-y-2 text-center sm:text-left",e),...t});gA.displayName="SheetHeader";const _J=f.forwardRef(({className:e,...t},n)=>v.jsx(Id,{ref:n,className:Ce("text-lg font-semibold text-foreground",e),...t}));_J.displayName=Id.displayName;const SJ=f.forwardRef(({className:e,...t},n)=>v.jsx(Ld,{ref:n,className:Ce("text-sm text-muted-foreground",e),...t}));SJ.displayName=Ld.displayName;const Ut=({children:e})=>v.jsx("div",{className:"flex justify-between items-center pr-2",children:e}),Pt=({text:e,toolTip:t="",url:n,htmlFor:r,disabled:o=!1})=>v.jsxs(YT,{children:[v.jsx(GT,{asChild:!0,children:v.jsx(Gx,{htmlFor:r||e.toLowerCase().replace(" ","-"),className:"font-medium",disabled:o,children:e})}),t||n?v.jsxs(xx,{className:"flex flex-col max-w-xs text-sm",side:"left",children:[v.jsx("p",{children:t}),n?v.jsx(Rn,{variant:"link",className:"justify-end",children:v.jsx("a",{href:n,target:"_blank",children:"More info"})}):v.jsx(v.Fragment,{})]}):v.jsx(v.Fragment,{})]}),EJ=()=>{const[e,t]=bt(n=>[n.settings,n.updateSettings]);return v.jsxs("div",{className:"flex flex-col gap-4 mt-4",children:[v.jsxs("div",{className:"flex flex-col gap-1",children:[v.jsx(Pt,{htmlFor:"steps",text:"Steps",toolTip:"The number of denoising steps. More denoising steps usually lead to a higher quality image at the expense of slower inference."}),v.jsxs(Ut,{children:[v.jsx(uo,{className:"w-[180px]",defaultValue:[30],min:1,max:100,step:1,value:[Math.floor(e.ldmSteps)],onValueChange:n=>t({ldmSteps:n[0]})}),v.jsx(Gn,{id:"steps",className:"w-[60px] rounded-full",numberValue:e.ldmSteps,allowFloat:!1,onNumberValueChange:n=>{t({ldmSteps:n})}})]})]}),v.jsxs(Ut,{children:[v.jsx(Pt,{text:"Sampler"}),v.jsxs(aa,{value:e.ldmSampler,onValueChange:n=>{t({ldmSampler:n})},children:[v.jsx(ls,{className:"w-[100px]",children:v.jsx(la,{placeholder:"Select sampler"})}),v.jsx(cs,{align:"end",children:v.jsx(wl,{children:Object.values(Zw).map(n=>v.jsx(us,{value:n,children:n},n))})})]})]})]})},vA=f.forwardRef(({className:e,...t},n)=>v.jsx("textarea",{className:Ce("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm 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",e,"overflow-auto"),tabIndex:-1,ref:n,...t}));vA.displayName="Textarea";const vp=({text:e,onClick:t})=>{const[n]=bt(r=>[r.settings.showExtender]);return v.jsx(Rn,{variant:"outline",className:"p-1 h-8",disabled:!n,onClick:t,children:v.jsx("div",{className:"flex items-center gap-1",children:e})})},CJ=()=>{const[e,t,n,r,o,i,s,l,u,d,h]=bt(L=>[L.serverConfig.samplers,L.settings,L.paintByExampleFile,L.getIsProcessing(),L.updateSettings,L.runInpainting,L.updateAppState,L.updateExtenderByBuiltIn,L.updateExtenderDirection,L.adjustMask,L.clearMask]),[m,g]=Rx(n),y=f.useRef(null);OP(y,()=>{y!=null&&y.current&&y.current.blur()});const x=L=>{L.key==="Enter"&&L.ctrlKey&&t.prompt.length!==0&&i()},_=()=>v.jsxs(Ut,{children:[v.jsx(Pt,{text:"Cropper",toolTip:"Inpainting on part of image, improve inference speed and reduce memory usage."}),v.jsx(co,{id:"cropper",checked:t.showCropper,onCheckedChange:L=>{o({showCropper:L}),L&&o({showExtender:!1})}})]}),C=()=>t.model.support_controlnet?v.jsxs("div",{className:"flex flex-col gap-4",children:[v.jsxs("div",{className:"flex flex-col gap-4",children:[v.jsxs("div",{className:"flex justify-between items-center pr-2",children:[v.jsx(Pt,{text:"ControlNet",toolTip:"Using an additional conditioning image to control how an image is generated",url:"https://huggingface.co/docs/diffusers/main/en/using-diffusers/inpaint#controlnet"}),v.jsx(co,{id:"controlnet",checked:t.enableControlnet,onCheckedChange:L=>{o({enableControlnet:L})}})]}),v.jsx("div",{className:"flex flex-col gap-1",children:v.jsxs(Ut,{children:[v.jsx(uo,{className:"w-[180px]",defaultValue:[100],min:1,max:100,step:1,disabled:!t.enableControlnet,value:[Math.floor(t.controlnetConditioningScale*100)],onValueChange:L=>o({controlnetConditioningScale:L[0]/100})}),v.jsx(Gn,{id:"controlnet-weight",className:"w-[60px] rounded-full",disabled:!t.enableControlnet,numberValue:t.controlnetConditioningScale,allowFloat:!1,onNumberValueChange:L=>{o({controlnetConditioningScale:L})}})]})}),v.jsx("div",{className:"pr-2",children:v.jsxs(aa,{defaultValue:t.controlnetMethod,value:t.controlnetMethod,onValueChange:L=>{o({controlnetMethod:L})},disabled:!t.enableControlnet,children:[v.jsx(ls,{children:v.jsx(la,{placeholder:"Select control method"})}),v.jsx(cs,{align:"end",children:v.jsx(wl,{children:Object.values(t.model.controlnets).map(L=>v.jsx(us,{value:L,children:L.split("/")[1]},L))})})]})})]}),v.jsx(Fn,{})]}):null,S=()=>t.model.support_lcm_lora?v.jsxs(v.Fragment,{children:[v.jsxs(Ut,{children:[v.jsx(Pt,{text:"LCM Lora",url:"https://huggingface.co/docs/diffusers/main/en/using-diffusers/inference_with_lcm_lora",toolTip:"Enable quality image generation in typically 2-4 steps. Suggest disabling guidance_scale by setting it to 0. You can also try values between 1.0 and 2.0. When LCM Lora is enabled, LCMSampler will be used automatically."}),v.jsx(co,{id:"lcm-lora",checked:t.enableLCMLora,onCheckedChange:L=>{o({enableLCMLora:L})}})]}),v.jsx(Fn,{})]}):null,b=()=>t.model.support_freeu?v.jsxs("div",{className:"flex flex-col gap-4",children:[v.jsxs("div",{className:"flex justify-between items-center pr-2",children:[v.jsx(Pt,{text:"FreeU",toolTip:"FreeU is a technique for improving image quality. Different models may require different FreeU-specific hyperparameters, which can be viewed in the more info section.",url:"https://huggingface.co/docs/diffusers/main/en/using-diffusers/freeu"}),v.jsx(co,{id:"freeu",checked:t.enableFreeu,onCheckedChange:L=>{o({enableFreeu:L})}})]}),v.jsxs("div",{className:"flex flex-col gap-4",children:[v.jsxs("div",{className:"flex justify-center gap-6",children:[v.jsxs("div",{className:"flex gap-2 items-center justify-center",children:[v.jsx(Pt,{htmlFor:"freeu-s1",text:"s1",disabled:!t.enableFreeu}),v.jsx(Gn,{id:"freeu-s1",className:"w-14",disabled:!t.enableFreeu,numberValue:t.freeuConfig.s1,allowFloat:!0,onNumberValueChange:L=>{o({freeuConfig:{...t.freeuConfig,s1:L}})}})]}),v.jsxs("div",{className:"flex gap-2 items-center justify-center",children:[v.jsx(Pt,{htmlFor:"freeu-s2",text:"s2",disabled:!t.enableFreeu}),v.jsx(Gn,{id:"freeu-s2",className:"w-14",disabled:!t.enableFreeu,numberValue:t.freeuConfig.s2,allowFloat:!0,onNumberValueChange:L=>{o({freeuConfig:{...t.freeuConfig,s2:L}})}})]})]}),v.jsxs("div",{className:"flex justify-center gap-6",children:[v.jsxs("div",{className:"flex gap-2 items-center justify-center",children:[v.jsx(Pt,{htmlFor:"freeu-b1",text:"b1",disabled:!t.enableFreeu}),v.jsx(Gn,{id:"freeu-b1",className:"w-14",disabled:!t.enableFreeu,numberValue:t.freeuConfig.b1,allowFloat:!0,onNumberValueChange:L=>{o({freeuConfig:{...t.freeuConfig,b1:L}})}})]}),v.jsxs("div",{className:"flex gap-2 items-center justify-center",children:[v.jsx(Pt,{htmlFor:"freeu-b2",text:"b2",disabled:!t.enableFreeu}),v.jsx(Gn,{id:"freeu-b2",className:"w-14",disabled:!t.enableFreeu,numberValue:t.freeuConfig.b2,allowFloat:!0,onNumberValueChange:L=>{o({freeuConfig:{...t.freeuConfig,b2:L}})}})]})]})]}),v.jsx(Fn,{})]}):null,E=()=>t.model.need_prompt?v.jsxs("div",{className:"flex flex-col gap-4",children:[v.jsx(Pt,{text:"Negative prompt",url:"https://huggingface.co/docs/diffusers/main/en/using-diffusers/inpaint#negative-prompt",toolTip:"Negative prompt guides the model away from generating certain things in an image"}),v.jsx("div",{className:"pl-2 pr-4",children:v.jsx(vA,{ref:y,rows:4,onKeyUp:x,className:"max-h-[8rem] overflow-y-auto mb-2",placeholder:"",id:"negative-prompt",value:t.negativePrompt,onInput:L=>{L.preventDefault(),L.stopPropagation();const ie=L.target;o({negativePrompt:ie.value})}})})]}):null,k=()=>t.model.name!==YR?null:v.jsxs("div",{children:[v.jsxs(Ut,{children:[v.jsx(Pt,{text:"Example Image",toolTip:"An example image to guide image generation."}),v.jsx(c1,{tooltip:"Upload example image",onFileUpload:L=>{s({paintByExampleFile:L})},children:v.jsx(ZT,{})})]}),g?v.jsx("div",{className:"flex justify-center items-center",children:v.jsx("img",{src:m.src,alt:"example",className:"max-w-[200px] max-h-[200px] m-3"})}):v.jsx(v.Fragment,{}),v.jsx(Rn,{variant:"default",className:"w-full",disabled:r||!g,onClick:()=>{i()},children:"Paint"})]}),P=()=>t.model.name!==aF?null:v.jsxs("div",{className:"flex flex-col gap-1",children:[v.jsx(Pt,{text:"Image guidance scale",toolTip:"Push the generated image towards the inital image. Higher image guidance scale encourages generated images that are closely linked to the source image, usually at the expense of lower image quality.",url:"https://huggingface.co/docs/diffusers/main/en/api/pipelines/pix2pix"}),v.jsxs(Ut,{children:[v.jsx(uo,{className:"w-[180px]",defaultValue:[150],min:100,max:1e3,step:1,value:[Math.floor(t.p2pImageGuidanceScale*100)],onValueChange:L=>o({p2pImageGuidanceScale:L[0]/100})}),v.jsx(Gn,{id:"image-guidance-scale",className:"w-[60px] rounded-full",numberValue:t.p2pImageGuidanceScale,allowFloat:!0,onNumberValueChange:L=>{o({p2pImageGuidanceScale:L})}})]})]}),M=()=>t.model.support_strength?v.jsxs("div",{className:"flex flex-col gap-1",children:[v.jsx(Pt,{text:"Strength",url:"https://huggingface.co/docs/diffusers/main/en/using-diffusers/inpaint#strength",toolTip:"Strength is a measure of how much noise is added to the base image, which influences how similar the output is to the base image. Higher value means more noise and more different from the base image"}),v.jsxs(Ut,{children:[v.jsx(uo,{className:"w-[180px]",defaultValue:[100],min:10,max:100,step:1,value:[Math.floor(t.sdStrength*100)],onValueChange:L=>o({sdStrength:L[0]/100})}),v.jsx(Gn,{id:"strength",className:"w-[60px] rounded-full",numberValue:t.sdStrength,allowFloat:!0,onNumberValueChange:L=>{o({sdStrength:L})}})]})]}):null,A=()=>t.model.support_outpainting?v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"flex flex-col gap-4",children:[v.jsxs(Ut,{children:[v.jsx(Pt,{text:"Extender",toolTip:"Perform outpainting on images to expand it's content."}),v.jsx(co,{id:"extender",checked:t.showExtender,onCheckedChange:L=>{o({showExtender:L}),L&&o({showCropper:!1})}})]}),v.jsxs(Ut,{children:[v.jsxs(aa,{defaultValue:t.extenderDirection,value:t.extenderDirection,onValueChange:L=>{u(L)},children:[v.jsx(ls,{className:"w-[65px] h-7",disabled:!t.showExtender,children:v.jsx(la,{placeholder:"Select axis"})}),v.jsx(cs,{align:"end",children:v.jsx(wl,{children:Object.values(In).map(L=>v.jsx(us,{value:L,children:L},L))})})]}),v.jsxs("div",{className:"flex gap-1 justify-center mt-0",children:[v.jsx(vp,{text:"1.25x",onClick:()=>l(t.extenderDirection,1.25)}),v.jsx(vp,{text:"1.5x",onClick:()=>l(t.extenderDirection,1.5)}),v.jsx(vp,{text:"1.75x",onClick:()=>l(t.extenderDirection,1.75)}),v.jsx(vp,{text:"2.0x",onClick:()=>l(t.extenderDirection,2)})]})]})]}),v.jsx(Fn,{})]}):null,O=()=>t.model.name!==lF?null:v.jsxs(Ut,{children:[v.jsx(Pt,{text:"Task",toolTip:"PowerPaint task. When using extender, image-outpainting task will be auto used. For object-removal and image-outpainting, it is recommended to set the guidance_scale at 10 or above."}),v.jsxs(aa,{defaultValue:t.powerpaintTask,value:t.powerpaintTask,onValueChange:L=>{o({powerpaintTask:L})},disabled:t.showExtender,children:[v.jsx(ls,{className:"w-[140px]",children:v.jsx(la,{placeholder:"Select task"})}),v.jsx(cs,{align:"end",children:v.jsx(wl,{children:[kl.text_guided,kl.object_remove,kl.shape_guided].map(L=>v.jsx(us,{value:L,children:L},L))})})]})]}),F=()=>v.jsxs("div",{className:"flex flex-col gap-1",children:[v.jsx(Pt,{htmlFor:"steps",text:"Steps",toolTip:"The number of denoising steps. More denoising steps usually lead to a higher quality image at the expense of slower inference."}),v.jsxs(Ut,{children:[v.jsx(uo,{className:"w-[180px]",defaultValue:[30],min:1,max:100,step:1,value:[Math.floor(t.sdSteps)],onValueChange:L=>o({sdSteps:L[0]})}),v.jsx(Gn,{id:"steps",className:"w-[60px] rounded-full",numberValue:t.sdSteps,allowFloat:!1,onNumberValueChange:L=>{o({sdSteps:L})}})]})]}),V=()=>v.jsxs("div",{className:"flex flex-col gap-1",children:[v.jsx(Pt,{text:"Guidance scale",url:"https://huggingface.co/docs/diffusers/main/en/using-diffusers/inpaint#guidance-scale",toolTip:"Guidance scale affects how aligned the text prompt and generated image are. Higher value means the prompt and generated image are closely aligned, so the output is a stricter interpretation of the prompt"}),v.jsxs(Ut,{children:[v.jsx(uo,{className:"w-[180px]",defaultValue:[750],min:0,max:1500,step:1,value:[Math.floor(t.sdGuidanceScale*100)],onValueChange:L=>o({sdGuidanceScale:L[0]/100})}),v.jsx(Gn,{id:"guidance-scale",className:"w-[60px] rounded-full",numberValue:t.sdGuidanceScale,allowFloat:!0,onNumberValueChange:L=>{o({sdGuidanceScale:L})}})]})]}),J=()=>v.jsxs(Ut,{children:[v.jsx(Pt,{text:"Sampler"}),v.jsxs(aa,{defaultValue:t.sdSampler,value:t.sdSampler,onValueChange:L=>{o({sdSampler:L})},children:[v.jsx(ls,{className:"w-[175px] text-xs",children:v.jsx(la,{placeholder:"Select sampler"})}),v.jsx(cs,{align:"end",children:v.jsx(wl,{children:e.map(L=>v.jsx(us,{value:L,className:"text-xs",children:L},L))})})]})]}),G=()=>v.jsxs(Ut,{children:[v.jsx(Pt,{text:"Seed",toolTip:"Using same parameters and a fixed seed can generate same result image."}),v.jsxs("div",{className:"flex gap-2 justify-center items-center",children:[v.jsx(co,{id:"seed",checked:t.seedFixed,onCheckedChange:L=>{o({seedFixed:L})}}),v.jsx(Gn,{id:"seed",className:"w-[100px]",disabled:!t.seedFixed,numberValue:t.seed,allowFloat:!1,onNumberValueChange:L=>{o({seed:L})}})]})]}),ae=()=>v.jsxs("div",{className:"flex flex-col gap-1",children:[v.jsx(Pt,{text:"Mask blur",toolTip:"How much to blur the mask before processing, in pixels."}),v.jsxs(Ut,{children:[v.jsx(uo,{className:"w-[180px]",defaultValue:[t.sdMaskBlur],min:0,max:96,step:1,value:[Math.floor(t.sdMaskBlur)],onValueChange:L=>o({sdMaskBlur:L[0]})}),v.jsx(Gn,{id:"mask-blur",className:"w-[60px] rounded-full",numberValue:t.sdMaskBlur,allowFloat:!1,onNumberValueChange:L=>{o({sdMaskBlur:L})}})]})]}),U=()=>v.jsxs(v.Fragment,{children:[v.jsxs(Ut,{children:[v.jsx(Pt,{text:"Match histograms",toolTip:"Match the inpainting result histogram to the source image histogram",url:"https://github.com/Sanster/lama-cleaner/pull/143#issuecomment-1325859307"}),v.jsx(co,{id:"match-histograms",checked:t.sdMatchHistograms,onCheckedChange:L=>{o({sdMatchHistograms:L})}})]}),v.jsx(Fn,{})]}),te=()=>v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"flex flex-col gap-1",children:[v.jsx(Pt,{htmlFor:"adjustMaskKernelSize",text:"Adjust Mask",toolTip:"Expand or shrink mask. Using the slider to adjust the kernel size for dilation or erosion."}),v.jsxs(Ut,{children:[v.jsx(uo,{className:"w-[180px]",defaultValue:[12],min:1,max:100,step:1,value:[Math.floor(t.adjustMaskKernelSize)],onValueChange:L=>o({adjustMaskKernelSize:L[0]})}),v.jsx(Gn,{id:"adjustMaskKernelSize",className:"w-[60px] rounded-full",numberValue:t.adjustMaskKernelSize,allowFloat:!1,onNumberValueChange:L=>{o({adjustMaskKernelSize:L})}})]}),v.jsxs(Ut,{children:[v.jsxs("div",{className:"flex gap-1 justify-start",children:[v.jsx(Rn,{variant:"outline",className:"p-1 h-8",onClick:()=>d("expand"),disabled:r,children:v.jsxs("div",{className:"flex items-center gap-1 select-none",children:[v.jsx(rV,{size:16}),"expand"]})}),v.jsx(Rn,{variant:"outline",className:"p-1 h-8",onClick:()=>d("shrink"),disabled:r,children:v.jsxs("div",{className:"flex items-center gap-1 select-none",children:[v.jsx(tV,{size:16}),"Shrink"]})})]}),v.jsx(Rn,{variant:"outline",className:"p-1 h-8 justify-self-end",onClick:h,disabled:r,children:v.jsx("div",{className:"flex items-center gap-1 select-none",children:"Clear"})})]})]}),v.jsx(Fn,{})]});return v.jsxs("div",{className:"flex flex-col gap-4 mt-4",children:[_(),A(),te(),O(),F(),V(),P(),M(),J(),G(),E(),v.jsx(Fn,{}),C(),S(),ae(),U(),b(),k()]})},$J=()=>{const[e,t]=bt(n=>[n.settings,n.updateSettings]);return v.jsxs("div",{className:"flex flex-col gap-4 mt-4",children:[v.jsxs(Ut,{children:[v.jsx(Pt,{text:"CV2 Flag",url:"https://docs.opencv.org/4.8.0/d7/d8b/group__photo__inpaint.html#gga8002a65f5a3328fbf15df81b842d3c3ca892824c38e258feb5e72f308a358d52e"}),v.jsxs(aa,{value:e.cv2Flag,onValueChange:n=>{t({cv2Flag:n})},children:[v.jsx(ls,{className:"w-[160px]",children:v.jsx(la,{placeholder:"Select flag"})}),v.jsx(cs,{align:"end",children:v.jsx(wl,{children:Object.values(qw).map(n=>v.jsx(us,{value:n,children:n},n))})})]})]}),v.jsx(Pt,{text:"CV2 Radius",url:"https://docs.opencv.org/4.8.0/d7/d8b/group__photo__inpaint.html#gga8002a65f5a3328fbf15df81b842d3c3ca892824c38e258feb5e72f308a358d52e"}),v.jsxs(Ut,{children:[v.jsx(uo,{className:"w-[180px]",defaultValue:[5],min:1,max:100,step:1,value:[Math.floor(e.cv2Radius)],onValueChange:n=>t({cv2Radius:n[0]})}),v.jsx(Gn,{id:"cv2-radius",className:"w-[60px] rounded-full",numberValue:e.cv2Radius,allowFloat:!1,onNumberValueChange:n=>{t({cv2Radius:n})}})]})]})},kJ=()=>{const[e,t]=bt(i=>[i.settings,i.windowSize]),[n,r]=AP(!0);if(Zn("c",()=>{r()}),e.model.name!==oC&&e.model.name!==iC&&e.model.model_type===is)return null;const o=()=>e.model.name===oC?v.jsx(EJ,{}):e.model.name===iC?v.jsx($J,{}):v.jsx(CJ,{});return v.jsxs(yJ,{open:n,modal:!1,children:[v.jsx(wJ,{tabIndex:-1,className:"z-10 outline-none absolute top-[68px] right-6 rounded-lg border bg-background",children:v.jsx(Rn,{variant:"ghost",size:"icon",asChild:!0,className:"p-1.5",onClick:r,children:v.jsx(HU,{strokeWidth:1})})}),v.jsxs(mA,{side:"right",className:"w-[300px] mt-[60px] outline-none pl-4 pr-1",onOpenAutoFocus:i=>i.preventDefault(),onPointerDownOutside:i=>i.preventDefault(),children:[v.jsxs(gA,{children:[v.jsxs(Ut,{children:[v.jsx("div",{className:"overflow-hidden mr-8",children:e.model.name.split("/")[e.model.name.split("/").length-1]}),v.jsx(Rn,{variant:"ghost",size:"icon",className:"border h-6 w-6",onClick:r,children:v.jsx(KU,{strokeWidth:1})})]}),v.jsx(Fn,{})]}),v.jsx(og,{style:{height:t.height-160},className:"pr-3",children:o()})]})]})},Yo=Object.create(null);Yo.open="0";Yo.close="1";Yo.ping="2";Yo.pong="3";Yo.message="4";Yo.upgrade="5";Yo.noop="6";const th=Object.create(null);Object.keys(Yo).forEach(e=>{th[Yo[e]]=e});const H1={type:"error",data:"parser error"},yA=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",wA=typeof ArrayBuffer=="function",xA=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,rb=({type:e,data:t},n,r)=>yA&&t instanceof Blob?n?r(t):G2(t,r):wA&&(t instanceof ArrayBuffer||xA(t))?n?r(t):G2(new Blob([t]),r):r(Yo[e]+(t||"")),G2=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function X2(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let L0;function RJ(e,t){if(yA&&e.data instanceof Blob)return e.data.arrayBuffer().then(X2).then(t);if(wA&&(e.data instanceof ArrayBuffer||xA(e.data)))return t(X2(e.data));rb(e,!1,n=>{L0||(L0=new TextEncoder),t(L0.encode(n))})}const Z2="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",gu=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e{let t=e.length*.75,n=e.length,r,o=0,i,s,l,u;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const d=new ArrayBuffer(t),h=new Uint8Array(d);for(r=0;r>4,h[o++]=(s&15)<<4|l>>2,h[o++]=(l&3)<<6|u&63;return d},PJ=typeof ArrayBuffer=="function",ob=(e,t)=>{if(typeof e!="string")return{type:"message",data:bA(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:AJ(e.substring(1),t)}:th[n]?e.length>1?{type:th[n],data:e.substring(1)}:{type:th[n]}:H1},AJ=(e,t)=>{if(PJ){const n=TJ(e);return bA(n,t)}else return{base64:!0,data:e}},bA=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},_A="",OJ=(e,t)=>{const n=e.length,r=new Array(n);let o=0;e.forEach((i,s)=>{rb(i,!1,l=>{r[s]=l,++o===n&&t(r.join(_A))})})},MJ=(e,t)=>{const n=e.split(_A),r=[];for(let o=0;o{const r=n.length;let o;if(r<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,r);else if(r<65536){o=new Uint8Array(3);const i=new DataView(o.buffer);i.setUint8(0,126),i.setUint16(1,r)}else{o=new Uint8Array(9);const i=new DataView(o.buffer);i.setUint8(0,127),i.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!="string"&&(o[0]|=128),t.enqueue(o),t.enqueue(n)})}})}let F0;function yp(e){return e.reduce((t,n)=>t+n.length,0)}function wp(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let o=0;oMath.pow(2,21)-1){l.enqueue(H1);break}o=h*Math.pow(2,32)+d.getUint32(4),r=3}else{if(yp(n)e){l.enqueue(H1);break}}}})}const SA=4;function Qt(e){if(e)return IJ(e)}function IJ(e){for(var t in Qt.prototype)e[t]=Qt.prototype[t];return e}Qt.prototype.on=Qt.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};Qt.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};Qt.prototype.off=Qt.prototype.removeListener=Qt.prototype.removeAllListeners=Qt.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var r,o=0;o(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const LJ=Br.setTimeout,FJ=Br.clearTimeout;function hg(e,t){t.useNativeTimers?(e.setTimeoutFn=LJ.bind(Br),e.clearTimeoutFn=FJ.bind(Br)):(e.setTimeoutFn=Br.setTimeout.bind(Br),e.clearTimeoutFn=Br.clearTimeout.bind(Br))}const jJ=1.33;function zJ(e){return typeof e=="string"?BJ(e):Math.ceil((e.byteLength||e.size)*jJ)}function BJ(e){let t=0,n=0;for(let r=0,o=e.length;r=57344?n+=3:(r++,n+=4);return n}function UJ(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function VJ(e){let t={},n=e.split("&");for(let r=0,o=n.length;r0);return t}function $A(){const e=J2(+new Date);return e!==Q2?(q2=0,Q2=e):e+"."+J2(q2++)}for(;xp{this.readyState="paused",t()};if(this.polling||!this.writable){let r=0;this.polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};MJ(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,OJ(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=$A()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}request(t={}){return Object.assign(t,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new Vo(this.uri(),t)}doWrite(t,n){const r=this.request({method:"POST",data:t});r.on("success",n),r.on("error",(o,i)=>{this.onError("xhr post error",o,i)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=t}}class Vo extends Qt{constructor(t,n){super(),hg(this,n),this.opts=n,this.method=n.method||"GET",this.uri=t,this.data=n.data!==void 0?n.data:null,this.create()}create(){var t;const n=EA(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this.opts.xd;const r=this.xhr=new RA(n);try{r.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let o in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(o)&&r.setRequestHeader(o,this.opts.extraHeaders[o])}}catch{}if(this.method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(t=this.opts.cookieJar)===null||t===void 0||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),r.onreadystatechange=()=>{var o;r.readyState===3&&((o=this.opts.cookieJar)===null||o===void 0||o.parseCookies(r)),r.readyState===4&&(r.status===200||r.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof r.status=="number"?r.status:0)},0))},r.send(this.data)}catch(o){this.setTimeoutFn(()=>{this.onError(o)},0);return}typeof document<"u"&&(this.index=Vo.requestsCount++,Vo.requests[this.index]=this)}onError(t){this.emitReserved("error",t,this.xhr),this.cleanup(!0)}cleanup(t){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=YJ,t)try{this.xhr.abort()}catch{}typeof document<"u"&&delete Vo.requests[this.index],this.xhr=null}}onLoad(){const t=this.xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}Vo.requestsCount=0;Vo.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",e$);else if(typeof addEventListener=="function"){const e="onpagehide"in Br?"pagehide":"unload";addEventListener(e,e$,!1)}}function e$(){for(let e in Vo.requests)Vo.requests.hasOwnProperty(e)&&Vo.requests[e].abort()}const sb=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0),bp=Br.WebSocket||Br.MozWebSocket,t$=!0,ZJ="arraybuffer",n$=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class qJ extends ib{constructor(t){super(t),this.supportsBinary=!t.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const t=this.uri(),n=this.opts.protocols,r=n$?{}:EA(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=t$&&!n$?n?new bp(t,n):new bp(t):new bp(t,n,r)}catch(o){return this.emitReserved("error",o)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n{const s={};try{t$&&this.ws.send(i)}catch{}o&&sb(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=$A()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}check(){return!!bp}}class QJ extends ib{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(t=>{const n=DJ(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),o=NJ();o.readable.pipeTo(t.writable),this.writer=o.writable.getWriter();const i=()=>{r.read().then(({done:l,value:u})=>{l||(this.onPacket(u),i())}).catch(l=>{})};i();const s={type:"open"};this.query.sid&&(s.data=`{"sid":"${this.query.sid}"}`),this.writer.write(s).then(()=>this.onOpen())})}))}write(t){this.writable=!1;for(let n=0;n{o&&sb(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this.transport)===null||t===void 0||t.close()}}const JJ={websocket:qJ,webtransport:QJ,polling:XJ},eee=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,tee=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Y1(e){if(e.length>2e3)throw"URI too long";const t=e,n=e.indexOf("["),r=e.indexOf("]");n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let o=eee.exec(e||""),i={},s=14;for(;s--;)i[tee[s]]=o[s]||"";return n!=-1&&r!=-1&&(i.source=t,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=nee(i,i.path),i.queryKey=ree(i,i.query),i}function nee(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&r.splice(0,1),t.slice(-1)=="/"&&r.splice(r.length-1,1),r}function ree(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,o,i){o&&(n[o]=i)}),n}let TA=class sl extends Qt{constructor(t,n={}){super(),this.binaryType=ZJ,this.writeBuffer=[],t&&typeof t=="object"&&(n=t,t=null),t?(t=Y1(t),n.hostname=t.host,n.secure=t.protocol==="https"||t.protocol==="wss",n.port=t.port,t.query&&(n.query=t.query)):n.host&&(n.hostname=Y1(n.host).host),hg(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=n.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=VJ(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=SA,n.transport=t,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new JJ[t](r)}open(){let t;if(this.opts.rememberUpgrade&&sl.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)t="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else t=this.transports[0];this.readyState="opening";try{t=this.createTransport(t)}catch{this.transports.shift(),this.open();return}t.open(),this.setTransport(t)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",n=>this.onClose("transport close",n))}probe(t){let n=this.createTransport(t),r=!1;sl.priorWebsocketSuccess=!1;const o=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",m=>{if(!r)if(m.type==="pong"&&m.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;sl.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(h(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const g=new Error("probe error");g.transport=n.name,this.emitReserved("upgradeError",g)}}))};function i(){r||(r=!0,h(),n.close(),n=null)}const s=m=>{const g=new Error("probe error: "+m);g.transport=n.name,i(),this.emitReserved("upgradeError",g)};function l(){s("transport closed")}function u(){s("socket closed")}function d(m){n&&m.name!==n.name&&i()}const h=()=>{n.removeListener("open",o),n.removeListener("error",s),n.removeListener("close",l),this.off("close",u),this.off("upgrading",d)};n.once("open",o),n.once("error",s),n.once("close",l),this.once("close",u),this.once("upgrading",d),this.upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onOpen(){if(this.readyState="open",sl.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let t=0;const n=this.upgrades.length;for(;t{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this.getWritablePackets();this.transport.send(t),this.prevBufferLen=t.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r0&&n>this.maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}write(t,n,r){return this.sendPacket("message",t,n,r),this}send(t,n,r){return this.sendPacket("message",t,n,r),this}sendPacket(t,n,r,o){if(typeof n=="function"&&(o=n,n=void 0),typeof r=="function"&&(o=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const i={type:t,data:n,options:r};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),o&&this.once("flush",o),this.flush()}close(){const t=()=>{this.onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():t()}):this.upgrading?r():t()),this}onError(t){sl.priorWebsocketSuccess=!1,this.emitReserved("error",t),this.onClose("transport error",t)}onClose(t,n){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(t){const n=[];let r=0;const o=t.length;for(;rtypeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,PA=Object.prototype.toString,aee=typeof Blob=="function"||typeof Blob<"u"&&PA.call(Blob)==="[object BlobConstructor]",lee=typeof File=="function"||typeof File<"u"&&PA.call(File)==="[object FileConstructor]";function ab(e){return iee&&(e instanceof ArrayBuffer||see(e))||aee&&e instanceof Blob||lee&&e instanceof File}function nh(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n=0&&e.num{delete this.acks[t];for(let s=0;s{this.io.clearTimeoutFn(i),n.apply(this,[null,...s])}}emitWithAck(t,...n){const r=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((o,i)=>{n.push((s,l)=>r?s?i(s):o(l):o(s)),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((o,...i)=>r!==this._queue[0]?void 0:(o!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(o)):(this._queue.shift(),n&&n(null,...i)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:lt.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n)}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case lt.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case lt.EVENT:case lt.BINARY_EVENT:this.onevent(t);break;case lt.ACK:case lt.BINARY_ACK:this.onack(t);break;case lt.DISCONNECT:this.ondisconnect();break;case lt.CONNECT_ERROR:this.destroy();const r=new Error(t.data.message);r.data=t.data.data,this.emitReserved("connect_error",r);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let r=!1;return function(...o){r||(r=!0,n.packet({type:lt.ACK,id:t,data:o}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(n.apply(this,t.data),delete this.acks[t.id])}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:lt.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let r=0;r0&&e.jitter<=1?e.jitter:0,this.attempts=0}Cc.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0};Cc.prototype.reset=function(){this.attempts=0};Cc.prototype.setMin=function(e){this.ms=e};Cc.prototype.setMax=function(e){this.max=e};Cc.prototype.setJitter=function(e){this.jitter=e};class Z1 extends Qt{constructor(t,n){var r;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,hg(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new Cc({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const o=n.parser||mee;this.encoder=new o.Encoder,this.decoder=new o.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new TA(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const o=fo(n,"open",function(){r.onopen(),t&&t()}),i=l=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",l),t?t(l):this.maybeReconnectOnOpen()},s=fo(n,"error",i);if(this._timeout!==!1){const l=this._timeout,u=this.setTimeoutFn(()=>{o(),i(new Error("timeout")),n.close()},l);this.opts.autoUnref&&u.unref(),this.subs.push(()=>{this.clearTimeoutFn(u)})}return this.subs.push(o),this.subs.push(s),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(fo(t,"ping",this.onping.bind(this)),fo(t,"data",this.ondata.bind(this)),fo(t,"error",this.onerror.bind(this)),fo(t,"close",this.onclose.bind(this)),fo(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){sb(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new AA(this,t,n),this.nsps[t]=r),r}_destroy(t){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let r=0;rt()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(t,n){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(o=>{o?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",o)):t.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const cu={};function rh(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=oee(e,t.path||"/socket.io"),r=n.source,o=n.id,i=n.path,s=cu[o]&&i in cu[o].nsps,l=t.forceNew||t["force new connection"]||t.multiplex===!1||s;let u;return l?u=new Z1(r,t):(cu[o]||(cu[o]=new Z1(r,t)),u=cu[o]),n.query&&!t.query&&(t.query=n.queryKey),u.socket(n.path,t)}Object.assign(rh,{Manager:Z1,Socket:AA,io:rh,connect:rh});const OA="Progress",mg=100,[vee,Rte]=An(OA),[yee,wee]=vee(OA),MA=f.forwardRef((e,t)=>{const{__scopeProgress:n,value:r,max:o,getValueLabel:i=_ee,...s}=e,l=q1(o)?o:mg,u=DA(r,l)?r:null,d=im(u)?i(u,l):void 0;return f.createElement(yee,{scope:n,value:u,max:l},f.createElement(Pe.div,Y({"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":im(u)?u:void 0,"aria-valuetext":d,role:"progressbar","data-state":NA(u,l),"data-value":u??void 0,"data-max":l},s,{ref:t})))});MA.propTypes={max(e,t,n){const r=e[t],o=String(r);return r&&!q1(r)?new Error(See(o,n)):null},value(e,t,n){const r=e[t],o=String(r),i=q1(e.max)?e.max:mg;return r!=null&&!DA(r,i)?new Error(Eee(o,n)):null}};const xee="ProgressIndicator",bee=f.forwardRef((e,t)=>{var n;const{__scopeProgress:r,...o}=e,i=wee(xee,r);return f.createElement(Pe.div,Y({"data-state":NA(i.value,i.max),"data-value":(n=i.value)!==null&&n!==void 0?n:void 0,"data-max":i.max},o,{ref:t}))});function _ee(e,t){return`${Math.round(e/t*100)}%`}function NA(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function im(e){return typeof e=="number"}function q1(e){return im(e)&&!isNaN(e)&&e>0}function DA(e,t){return im(e)&&!isNaN(e)&&e<=t&&e>=0}function See(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${mg}\`.`}function Eee(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
- - a positive number
- - less than the value passed to \`max\` (or ${mg} if no \`max\` prop is set)
- - \`null\` if the progress is indeterminate.
-
-Defaulting to \`null\`.`}const IA=MA,Cee=bee,LA=f.forwardRef(({className:e,value:t,...n},r)=>v.jsx(IA,{ref:r,className:Ce("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",e),...n,children:v.jsx(Cee,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));LA.displayName=IA.displayName;const $ee="",Vi=rh($ee),kee=()=>{const[e,t,n]=bt(u=>[u.settings,u.isInpainting,u.isSD()]),[r,o]=f.useState(!1),[i,s]=f.useState(0),l=Math.min(Math.round(i/e.sdSteps*100),100);return f.useEffect(()=>{if(n)return Vi.on("connect",()=>{o(!0)}),Vi.on("disconnect",()=>{o(!1)}),Vi.on("diffusion_progress",u=>{u&&s(u.step+1)}),Vi.on("diffusion_finish",()=>{s(0)}),()=>{Vi.off("connect"),Vi.off("disconnect"),Vi.off("diffusion_progress"),Vi.off("diffusion_finish")}},[n]),v.jsxs("div",{className:"z-10 fixed bg-background w-[220px] left-1/2 -translate-x-1/2 top-[68px] h-[32px] flex justify-center items-center gap-[18px] border-[1px] border-[solid] rounded-[14px] pl-[8px] pr-[8px]",style:{visibility:r&&t&&n?"visible":"hidden"},children:[v.jsx(LA,{value:l}),v.jsxs("div",{className:"w-[45px] flex justify-center font-nums",children:[l,"%"]})]})},Ree=()=>{const[e,t]=bt(n=>[n.file,n.updateSettings]);return f.useEffect(()=>{(async()=>{const r=await jj();t({model:r})})()},[]),v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"flex gap-3 absolute top-[68px] left-[24px] items-center",children:[v.jsx(vJ,{}),v.jsx(qq,{})]}),v.jsx(Wq,{}),v.jsx(kee,{}),v.jsx(kJ,{}),e?v.jsx(Zq,{file:e}):v.jsx(v.Fragment,{})]})},Tee=()=>{const[e,t]=f.useState(window.innerWidth),n=f.useCallback(()=>{t(window.innerWidth)},[]);if(f.useEffect(()=>(window.addEventListener("resize",n),()=>{window.removeEventListener("resize",n)})),e<768)return"mobile";if(e>=768&&e<1224)return"tablet";if(e>=1224)return"desktop"};function Pee(e){const{onSelection:t}=e,[n]=f.useState(`file-upload-${Math.random().toString()}`),r=Tee();function o(i){if(!(!i||!i.type.match("image.*")))try{if(i.size>20*1024*1024)throw new Error("file too large");t(i)}catch(l){alert(`error: ${l.message}`)}}return v.jsx("div",{className:"absolute flex w-screen h-screen justify-center items-center pointer-events-none",children:v.jsx("label",{htmlFor:n,className:"grid bg-background border-[2px] border-[dashed] rounded-lg min-w-[600px] hover:bg-primary hover:text-primary-foreground pointer-events-auto",children:v.jsxs("div",{className:"grid p-16 w-full h-full",onDragOver:i=>{i.stopPropagation(),i.preventDefault()},children:[v.jsx("input",{className:"hidden",id:n,name:n,type:"file",onChange:i=>{var l;const s=(l=i.currentTarget.files)==null?void 0:l[0];s&&o(s)},accept:"image/png, image/jpeg"}),v.jsx("p",{className:"text-center",children:r==="desktop"?"Click here or drag an image file":"Tap here to load your picture"})]})})})}const FA="ToastProvider",[cb,Aee,Oee]=zd("Toast"),[jA,Tte]=An("Toast",[Oee]),[Mee,gg]=jA(FA),zA=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:o="right",swipeThreshold:i=50,children:s}=e,[l,u]=f.useState(null),[d,h]=f.useState(0),m=f.useRef(!1),g=f.useRef(!1);return f.createElement(cb.Provider,{scope:t},f.createElement(Mee,{scope:t,label:n,duration:r,swipeDirection:o,swipeThreshold:i,toastCount:d,viewport:l,onViewportChange:u,onToastAdd:f.useCallback(()=>h(y=>y+1),[]),onToastRemove:f.useCallback(()=>h(y=>y-1),[]),isFocusedToastEscapeKeyDownRef:m,isClosePausedRef:g},s))};zA.propTypes={label(e){if(e.label&&typeof e.label=="string"&&!e.label.trim()){const t=`Invalid prop \`label\` supplied to \`${FA}\`. Expected non-empty \`string\`.`;return new Error(t)}return null}};const Nee="ToastViewport",Dee=["F8"],Q1="toast.viewportPause",J1="toast.viewportResume",Iee=f.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=Dee,label:o="Notifications ({hotkey})",...i}=e,s=gg(Nee,n),l=Aee(n),u=f.useRef(null),d=f.useRef(null),h=f.useRef(null),m=f.useRef(null),g=Be(t,m,s.onViewportChange),y=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),x=s.toastCount>0;f.useEffect(()=>{const C=S=>{var b;r.every(k=>S[k]||S.code===k)&&((b=m.current)===null||b===void 0||b.focus())};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[r]),f.useEffect(()=>{const C=u.current,S=m.current;if(x&&C&&S){const b=()=>{if(!s.isClosePausedRef.current){const M=new CustomEvent(Q1);S.dispatchEvent(M),s.isClosePausedRef.current=!0}},E=()=>{if(s.isClosePausedRef.current){const M=new CustomEvent(J1);S.dispatchEvent(M),s.isClosePausedRef.current=!1}},k=M=>{!C.contains(M.relatedTarget)&&E()},P=()=>{C.contains(document.activeElement)||E()};return C.addEventListener("focusin",b),C.addEventListener("focusout",k),C.addEventListener("pointermove",b),C.addEventListener("pointerleave",P),window.addEventListener("blur",b),window.addEventListener("focus",E),()=>{C.removeEventListener("focusin",b),C.removeEventListener("focusout",k),C.removeEventListener("pointermove",b),C.removeEventListener("pointerleave",P),window.removeEventListener("blur",b),window.removeEventListener("focus",E)}}},[x,s.isClosePausedRef]);const _=f.useCallback(({tabbingDirection:C})=>{const b=l().map(E=>{const k=E.ref.current,P=[k,...Qee(k)];return C==="forwards"?P:P.reverse()});return(C==="forwards"?b.reverse():b).flat()},[l]);return f.useEffect(()=>{const C=m.current;if(C){const S=b=>{const E=b.altKey||b.ctrlKey||b.metaKey;if(b.key==="Tab"&&!E){const O=document.activeElement,F=b.shiftKey;if(b.target===C&&F){var P;(P=d.current)===null||P===void 0||P.focus();return}const G=_({tabbingDirection:F?"backwards":"forwards"}),ae=G.findIndex(U=>U===O);if(j0(G.slice(ae+1)))b.preventDefault();else{var M,A;F?(M=d.current)===null||M===void 0||M.focus():(A=h.current)===null||A===void 0||A.focus()}}};return C.addEventListener("keydown",S),()=>C.removeEventListener("keydown",S)}},[l,_]),f.createElement(_B,{ref:u,role:"region","aria-label":o.replace("{hotkey}",y),tabIndex:-1,style:{pointerEvents:x?void 0:"none"}},x&&f.createElement(o$,{ref:d,onFocusFromOutsideViewport:()=>{const C=_({tabbingDirection:"forwards"});j0(C)}}),f.createElement(cb.Slot,{scope:n},f.createElement(Pe.ol,Y({tabIndex:-1},i,{ref:g}))),x&&f.createElement(o$,{ref:h,onFocusFromOutsideViewport:()=>{const C=_({tabbingDirection:"backwards"});j0(C)}}))}),Lee="ToastFocusProxy",o$=f.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...o}=e,i=gg(Lee,n);return f.createElement(Um,Y({"aria-hidden":!0,tabIndex:0},o,{ref:t,style:{position:"fixed"},onFocus:s=>{var l;const u=s.relatedTarget;!((l=i.viewport)!==null&&l!==void 0&&l.contains(u))&&r()}}))}),vg="Toast",Fee="toast.swipeStart",jee="toast.swipeMove",zee="toast.swipeCancel",Bee="toast.swipeEnd",Uee=f.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:o,onOpenChange:i,...s}=e,[l=!0,u]=Zr({prop:r,defaultProp:o,onChange:i});return f.createElement(xn,{present:n||l},f.createElement(BA,Y({open:l},s,{ref:t,onClose:()=>u(!1),onPause:Ft(e.onPause),onResume:Ft(e.onResume),onSwipeStart:ue(e.onSwipeStart,d=>{d.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:ue(e.onSwipeMove,d=>{const{x:h,y:m}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","move"),d.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${h}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${m}px`)}),onSwipeCancel:ue(e.onSwipeCancel,d=>{d.currentTarget.setAttribute("data-swipe","cancel"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:ue(e.onSwipeEnd,d=>{const{x:h,y:m}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","end"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${h}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${m}px`),u(!1)})})))}),[Vee,Wee]=jA(vg,{onClose(){}}),BA=f.forwardRef((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:o,open:i,onClose:s,onEscapeKeyDown:l,onPause:u,onResume:d,onSwipeStart:h,onSwipeMove:m,onSwipeCancel:g,onSwipeEnd:y,...x}=e,_=gg(vg,n),[C,S]=f.useState(null),b=Be(t,U=>S(U)),E=f.useRef(null),k=f.useRef(null),P=o||_.duration,M=f.useRef(0),A=f.useRef(P),O=f.useRef(0),{onToastAdd:F,onToastRemove:V}=_,J=Ft(()=>{var U;(C==null?void 0:C.contains(document.activeElement))&&((U=_.viewport)===null||U===void 0||U.focus()),s()}),G=f.useCallback(U=>{!U||U===1/0||(window.clearTimeout(O.current),M.current=new Date().getTime(),O.current=window.setTimeout(J,U))},[J]);f.useEffect(()=>{const U=_.viewport;if(U){const te=()=>{G(A.current),d==null||d()},L=()=>{const ie=new Date().getTime()-M.current;A.current=A.current-ie,window.clearTimeout(O.current),u==null||u()};return U.addEventListener(Q1,L),U.addEventListener(J1,te),()=>{U.removeEventListener(Q1,L),U.removeEventListener(J1,te)}}},[_.viewport,P,u,d,G]),f.useEffect(()=>{i&&!_.isClosePausedRef.current&&G(P)},[i,P,_.isClosePausedRef,G]),f.useEffect(()=>(F(),()=>V()),[F,V]);const ae=f.useMemo(()=>C?HA(C):null,[C]);return _.viewport?f.createElement(f.Fragment,null,ae&&f.createElement(Hee,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite","aria-atomic":!0},ae),f.createElement(Vee,{scope:n,onClose:J},Os.createPortal(f.createElement(cb.ItemSlot,{scope:n},f.createElement(bB,{asChild:!0,onEscapeKeyDown:ue(l,()=>{_.isFocusedToastEscapeKeyDownRef.current||J(),_.isFocusedToastEscapeKeyDownRef.current=!1})},f.createElement(Pe.li,Y({role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":_.swipeDirection},x,{ref:b,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:ue(e.onKeyDown,U=>{U.key==="Escape"&&(l==null||l(U.nativeEvent),U.nativeEvent.defaultPrevented||(_.isFocusedToastEscapeKeyDownRef.current=!0,J()))}),onPointerDown:ue(e.onPointerDown,U=>{U.button===0&&(E.current={x:U.clientX,y:U.clientY})}),onPointerMove:ue(e.onPointerMove,U=>{if(!E.current)return;const te=U.clientX-E.current.x,L=U.clientY-E.current.y,ie=!!k.current,K=["left","right"].includes(_.swipeDirection),Q=["left","up"].includes(_.swipeDirection)?Math.min:Math.max,W=K?Q(0,te):0,le=K?0:Q(0,L),ge=U.pointerType==="touch"?10:2,Ve={x:W,y:le},Ue={originalEvent:U,delta:Ve};ie?(k.current=Ve,_p(jee,m,Ue,{discrete:!1})):i$(Ve,_.swipeDirection,ge)?(k.current=Ve,_p(Fee,h,Ue,{discrete:!1}),U.target.setPointerCapture(U.pointerId)):(Math.abs(te)>ge||Math.abs(L)>ge)&&(E.current=null)}),onPointerUp:ue(e.onPointerUp,U=>{const te=k.current,L=U.target;if(L.hasPointerCapture(U.pointerId)&&L.releasePointerCapture(U.pointerId),k.current=null,E.current=null,te){const ie=U.currentTarget,K={originalEvent:U,delta:te};i$(te,_.swipeDirection,_.swipeThreshold)?_p(Bee,y,K,{discrete:!0}):_p(zee,g,K,{discrete:!0}),ie.addEventListener("click",Q=>Q.preventDefault(),{once:!0})}})})))),_.viewport))):null});BA.propTypes={type(e){if(e.type&&!["foreground","background"].includes(e.type)){const t=`Invalid prop \`type\` supplied to \`${vg}\`. Expected \`foreground | background\`.`;return new Error(t)}return null}};const Hee=e=>{const{__scopeToast:t,children:n,...r}=e,o=gg(vg,t),[i,s]=f.useState(!1),[l,u]=f.useState(!1);return Zee(()=>s(!0)),f.useEffect(()=>{const d=window.setTimeout(()=>u(!0),1e3);return()=>window.clearTimeout(d)},[]),l?null:f.createElement(Md,{asChild:!0},f.createElement(Um,r,i&&f.createElement(f.Fragment,null,o.label," ",n)))},Kee=f.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return f.createElement(Pe.div,Y({},r,{ref:t}))}),Yee=f.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return f.createElement(Pe.div,Y({},r,{ref:t}))}),Gee="ToastAction",UA=f.forwardRef((e,t)=>{const{altText:n,...r}=e;return n?f.createElement(WA,{altText:n,asChild:!0},f.createElement(VA,Y({},r,{ref:t}))):null});UA.propTypes={altText(e){return e.altText?null:new Error(`Missing prop \`altText\` expected on \`${Gee}\``)}};const Xee="ToastClose",VA=f.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,o=Wee(Xee,n);return f.createElement(WA,{asChild:!0},f.createElement(Pe.button,Y({type:"button"},r,{ref:t,onClick:ue(e.onClick,o.onClose)})))}),WA=f.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...o}=e;return f.createElement(Pe.div,Y({"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0},o,{ref:t}))});function HA(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),qee(r)){const o=r.ariaHidden||r.hidden||r.style.display==="none",i=r.dataset.radixToastAnnounceExclude==="";if(!o)if(i){const s=r.dataset.radixToastAnnounceAlt;s&&t.push(s)}else t.push(...HA(r))}}),t}function _p(e,t,n,{discrete:r}){const o=n.originalEvent.currentTarget,i=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?cx(o,i):o.dispatchEvent(i)}const i$=(e,t,n=0)=>{const r=Math.abs(e.x),o=Math.abs(e.y),i=r>o;return t==="left"||t==="right"?i&&r>n:!i&&o>n};function Zee(e=()=>{}){const t=Ft(e);Pn(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function qee(e){return e.nodeType===e.ELEMENT_NODE}function Qee(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function j0(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}const Jee=zA,KA=Iee,YA=Uee,GA=Kee,XA=Yee,ZA=UA,qA=VA,ete=Jee,QA=f.forwardRef(({className:e,...t},n)=>v.jsx(KA,{ref:n,className:Ce("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),tabIndex:-1,...t}));QA.displayName=KA.displayName;const tte=Om("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),JA=f.forwardRef(({className:e,variant:t,...n},r)=>v.jsx(YA,{ref:r,className:Ce(tte({variant:t}),e),tabIndex:-1,...n}));JA.displayName=YA.displayName;const nte=f.forwardRef(({className:e,...t},n)=>v.jsx(ZA,{ref:n,className:Ce("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),tabIndex:-1,...t}));nte.displayName=ZA.displayName;const eO=f.forwardRef(({className:e,...t},n)=>v.jsx(qA,{ref:n,className:Ce("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",tabIndex:-1,...t,children:v.jsx(yT,{className:"h-4 w-4"})}));eO.displayName=qA.displayName;const tO=f.forwardRef(({className:e,...t},n)=>v.jsx(GA,{ref:n,className:Ce("text-sm font-semibold [&+div]:text-xs",e),tabIndex:-1,...t}));tO.displayName=GA.displayName;const nO=f.forwardRef(({className:e,...t},n)=>v.jsx(XA,{ref:n,className:Ce("text-sm opacity-90",e),...t,tabIndex:-1}));nO.displayName=XA.displayName;function rte(){const{toasts:e}=Td();return v.jsxs(ete,{children:[e.map(function({id:t,title:n,description:r,action:o,...i}){return v.jsxs(JA,{...i,children:[v.jsxs("div",{className:"grid gap-1",children:[n&&v.jsx(tO,{children:n}),r&&v.jsx(nO,{children:r})]}),o,v.jsx(eO,{})]},t)}),v.jsx(QA,{})]})}const ote=["image/jpeg","image/png","image/webp","image/bmp","image/tiff"];function ite(){const[e,t,n,r]=bt(g=>[g.file,g.updateAppState,g.setServerConfig,g.setFile]),o=Kj(),i=vH();f.useEffect(()=>{o&&r(o)},[o,r]),f.useEffect(()=>{t({windowSize:i})},[i]),f.useEffect(()=>{(async()=>{const y=await Lj();n(y),y.isDesktop&&uF()})()},[]);const s=f.useRef(0),l=f.useCallback(g=>{g.preventDefault(),g.stopPropagation()},[]),u=f.useCallback(g=>{g.preventDefault(),g.stopPropagation(),s.current+=1},[]),d=f.useCallback(g=>{g.preventDefault(),g.stopPropagation(),s.current-=1,s.current>0},[]),h=f.useCallback(g=>{if(g.preventDefault(),g.stopPropagation(),g.dataTransfer.files&&g.dataTransfer.files.length>0){if(!(g.dataTransfer.files.length>1)){const y=g.dataTransfer.files[0],x=y.type;ote.includes(x)&&r(y)}g.dataTransfer.clearData()}},[]),m=f.useCallback(g=>{if(!g.clipboardData)return;const y=g.clipboardData.items,x=[].slice.call(y).filter(S=>S.type.indexOf("image")!==-1);if(x.length===0)return;g.preventDefault(),g.stopPropagation();const C=x[0].getAsFile();C&&r(C)},[]);return f.useEffect(()=>(window.addEventListener("dragenter",u),window.addEventListener("dragleave",d),window.addEventListener("dragover",l),window.addEventListener("drop",h),window.addEventListener("paste",m),function(){window.removeEventListener("dragenter",u),window.removeEventListener("dragleave",d),window.removeEventListener("dragover",l),window.removeEventListener("drop",h),window.removeEventListener("paste",m)})),v.jsxs("main",{className:"flex min-h-screen flex-col items-center justify-between w-full bg-[radial-gradient(circle_at_1px_1px,_#8e8e8e8e_1px,_transparent_0)] [background-size:20px_20px] bg-repeat",children:[v.jsx(rte,{}),v.jsx(nZ,{}),v.jsx(Ree,{}),e?v.jsx(v.Fragment,{}):v.jsx(Pee,{onSelection:async g=>{r(g)}})]})}const sm=["light","dark"],ub="(prefers-color-scheme: dark)",ste=typeof window>"u",rO=f.createContext(void 0),ate=e=>f.useContext(rO)?Fe.createElement(f.Fragment,null,e.children):Fe.createElement(cte,e),lte=["light","dark"],cte=({forcedTheme:e,disableTransitionOnChange:t=!1,enableSystem:n=!0,enableColorScheme:r=!0,storageKey:o="theme",themes:i=lte,defaultTheme:s=n?"system":"light",attribute:l="data-theme",value:u,children:d,nonce:h})=>{const[m,g]=f.useState(()=>s$(o,s)),[y,x]=f.useState(()=>s$(o)),_=u?Object.values(u):i,C=f.useCallback(k=>{let P=k;if(!P)return;k==="system"&&n&&(P=a$());const M=u?u[P]:P,A=t?dte():null,O=document.documentElement;if(l==="class"?(O.classList.remove(..._),M&&O.classList.add(M)):M?O.setAttribute(l,M):O.removeAttribute(l),r){const F=sm.includes(s)?s:null,V=sm.includes(P)?P:F;O.style.colorScheme=V}A==null||A()},[]),S=f.useCallback(k=>{g(k);try{localStorage.setItem(o,k)}catch{}},[e]),b=f.useCallback(k=>{const P=a$(k);x(P),m==="system"&&n&&!e&&C("system")},[m,e]);f.useEffect(()=>{const k=window.matchMedia(ub);return k.addListener(b),b(k),()=>k.removeListener(b)},[b]),f.useEffect(()=>{const k=P=>{P.key===o&&S(P.newValue||s)};return window.addEventListener("storage",k),()=>window.removeEventListener("storage",k)},[S]),f.useEffect(()=>{C(e??m)},[e,m]);const E=f.useMemo(()=>({theme:m,setTheme:S,forcedTheme:e,resolvedTheme:m==="system"?y:m,themes:n?[...i,"system"]:i,systemTheme:n?y:void 0}),[m,S,e,y,n,i]);return Fe.createElement(rO.Provider,{value:E},Fe.createElement(ute,{forcedTheme:e,disableTransitionOnChange:t,enableSystem:n,enableColorScheme:r,storageKey:o,themes:i,defaultTheme:s,attribute:l,value:u,children:d,attrs:_,nonce:h}),d)},ute=f.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:o,defaultTheme:i,value:s,attrs:l,nonce:u})=>{const d=i==="system",h=n==="class"?`var d=document.documentElement,c=d.classList;c.remove(${l.map(x=>`'${x}'`).join(",")});`:`var d=document.documentElement,n='${n}',s='setAttribute';`,m=o?sm.includes(i)&&i?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${i}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",g=(x,_=!1,C=!0)=>{const S=s?s[x]:x,b=_?x+"|| ''":`'${S}'`;let E="";return o&&C&&!_&&sm.includes(x)&&(E+=`d.style.colorScheme = '${x}';`),n==="class"?E+=_||S?`c.add(${b})`:"null":S&&(E+=`d[s](n,${b})`),E},y=e?`!function(){${h}${g(e)}}()`:r?`!function(){try{${h}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${d})){var t='${ub}',m=window.matchMedia(t);if(m.media!==t||m.matches){${g("dark")}}else{${g("light")}}}else if(e){${s?`var x=${JSON.stringify(s)};`:""}${g(s?"x[e]":"e",!0)}}${d?"":"else{"+g(i,!1,!1)+"}"}${m}}catch(e){}}()`:`!function(){try{${h}var e=localStorage.getItem('${t}');if(e){${s?`var x=${JSON.stringify(s)};`:""}${g(s?"x[e]":"e",!0)}}else{${g(i,!1,!1)};}${m}}catch(t){}}();`;return Fe.createElement("script",{nonce:u,dangerouslySetInnerHTML:{__html:y}})},()=>!0),s$=(e,t)=>{if(ste)return;let n;try{n=localStorage.getItem(e)||void 0}catch{}return n||t},dte=()=>{const e=document.createElement("style");return e.appendChild(document.createTextNode("*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(e),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(e)},1)}},a$=e=>(e||(e=window.matchMedia(ub)),e.matches?"dark":"light"),fte=new dL;z0.createRoot(document.getElementById("root")).render(v.jsx(Fe.StrictMode,{children:v.jsx(gL,{client:fte,children:v.jsx(ate,{defaultTheme:"dark",disableTransitionOnChange:!0,children:v.jsx(BU,{children:v.jsx(ite,{})})})})}));
diff --git a/py/iopaint/web_app/assets/index-CXO-mkQB.js b/py/iopaint/web_app/assets/index-CXO-mkQB.js
deleted file mode 100644
index ef6cf80..0000000
--- a/py/iopaint/web_app/assets/index-CXO-mkQB.js
+++ /dev/null
@@ -1,165 +0,0 @@
-var Nv=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)};var z=(e,t,n)=>(Nv(e,t,"read from private field"),n?n.call(e):t.get(e)),Te=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},ye=(e,t,n,r)=>(Nv(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);var Ff=(e,t,n,r)=>({set _(o){ye(e,t,o,n)},get _(){return z(e,t,r)}}),tt=(e,t,n)=>(Nv(e,t,"access private method"),n);function SD(e,t){for(var n=0;nr[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(o){if(o.ep)return;o.ep=!0;const i=n(o);fetch(o.href,i)}})();var Yc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function lm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var v$={exports:{}},cm={},y$={exports:{}},it={};/**
- * @license React
- * react.production.min.js
- *
- * Copyright (c) Facebook, Inc. and its affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */var bd=Symbol.for("react.element"),ED=Symbol.for("react.portal"),CD=Symbol.for("react.fragment"),$D=Symbol.for("react.strict_mode"),kD=Symbol.for("react.profiler"),RD=Symbol.for("react.provider"),TD=Symbol.for("react.context"),PD=Symbol.for("react.forward_ref"),AD=Symbol.for("react.suspense"),OD=Symbol.for("react.memo"),MD=Symbol.for("react.lazy"),LS=Symbol.iterator;function ND(e){return e===null||typeof e!="object"?null:(e=LS&&e[LS]||e["@@iterator"],typeof e=="function"?e:null)}var w$={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x$=Object.assign,b$={};function fc(e,t,n){this.props=e,this.context=t,this.refs=b$,this.updater=n||w$}fc.prototype.isReactComponent={};fc.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};fc.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function _$(){}_$.prototype=fc.prototype;function ew(e,t,n){this.props=e,this.context=t,this.refs=b$,this.updater=n||w$}var tw=ew.prototype=new _$;tw.constructor=ew;x$(tw,fc.prototype);tw.isPureReactComponent=!0;var FS=Array.isArray,S$=Object.prototype.hasOwnProperty,nw={current:null},E$={key:!0,ref:!0,__self:!0,__source:!0};function C$(e,t,n){var r,o={},i=null,s=null;if(t!=null)for(r in t.ref!==void 0&&(s=t.ref),t.key!==void 0&&(i=""+t.key),t)S$.call(t,r)&&!E$.hasOwnProperty(r)&&(o[r]=t[r]);var l=arguments.length-2;if(l===1)o.children=n;else if(1>>1,ge=K[le];if(0>>1;leo(We,W))Meo(fe,We)?(K[le]=fe,K[Me]=W,le=Me):(K[le]=We,K[Ue]=W,le=Ue);else if(Meo(fe,W))K[le]=fe,K[Me]=W,le=Me;else break e}}return Q}function o(K,Q){var W=K.sortIndex-Q.sortIndex;return W!==0?W:K.id-Q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var s=Date,l=s.now();e.unstable_now=function(){return s.now()-l}}var u=[],d=[],h=1,m=null,g=3,y=!1,x=!1,_=!1,C=typeof setTimeout=="function"?setTimeout:null,S=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function E(K){for(var Q=n(d);Q!==null;){if(Q.callback===null)r(d);else if(Q.startTime<=K)r(d),Q.sortIndex=Q.expirationTime,t(u,Q);else break;Q=n(d)}}function k(K){if(_=!1,E(K),!x)if(n(u)!==null)x=!0,L(P);else{var Q=n(d);Q!==null&&ie(k,Q.startTime-K)}}function P(K,Q){x=!1,_&&(_=!1,S(O),O=-1),y=!0;var W=g;try{for(E(Q),m=n(u);m!==null&&(!(m.expirationTime>Q)||K&&!J());){var le=m.callback;if(typeof le=="function"){m.callback=null,g=m.priorityLevel;var ge=le(m.expirationTime<=Q);Q=e.unstable_now(),typeof ge=="function"?m.callback=ge:m===n(u)&&r(u),E(Q)}else r(u);m=n(u)}if(m!==null)var Ve=!0;else{var Ue=n(d);Ue!==null&&ie(k,Ue.startTime-Q),Ve=!1}return Ve}finally{m=null,g=W,y=!1}}var M=!1,A=null,O=-1,F=5,V=-1;function J(){return!(e.unstable_now()-VK||125le?(K.sortIndex=W,t(d,K),n(u)===null&&K===n(d)&&(_?(S(O),O=-1):_=!0,ie(k,W-le))):(K.sortIndex=ge,t(u,K),x||y||(x=!0,L(P))),K},e.unstable_shouldYield=J,e.unstable_wrapCallback=function(K){var Q=g;return function(){var W=g;g=Q;try{return K.apply(this,arguments)}finally{g=W}}}})(T$);R$.exports=T$;var KD=R$.exports;/**
- * @license React
- * react-dom.production.min.js
- *
- * Copyright (c) Facebook, Inc. and its affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */var P$=f,yr=KD;function ce(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),B0=Object.prototype.hasOwnProperty,YD=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,zS={},BS={};function GD(e){return B0.call(BS,e)?!0:B0.call(zS,e)?!1:YD.test(e)?BS[e]=!0:(zS[e]=!0,!1)}function XD(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function ZD(e,t,n,r){if(t===null||typeof t>"u"||XD(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Un(e,t,n,r,o,i,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=s}var wn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){wn[e]=new Un(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];wn[t]=new Un(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){wn[e]=new Un(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){wn[e]=new Un(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){wn[e]=new Un(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){wn[e]=new Un(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){wn[e]=new Un(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){wn[e]=new Un(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){wn[e]=new Un(e,5,!1,e.toLowerCase(),null,!1,!1)});var ow=/[\-:]([a-z])/g;function iw(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(ow,iw);wn[t]=new Un(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(ow,iw);wn[t]=new Un(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(ow,iw);wn[t]=new Un(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){wn[e]=new Un(e,1,!1,e.toLowerCase(),null,!1,!1)});wn.xlinkHref=new Un("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){wn[e]=new Un(e,1,!1,e.toLowerCase(),null,!0,!0)});function sw(e,t,n,r){var o=wn.hasOwnProperty(t)?wn[t]:null;(o!==null?o.type!==0:r||!(2l||o[s]!==i[l]){var u=`
-`+o[s].replace(" at new "," at ");return e.displayName&&u.includes("")&&(u=u.replace("",e.displayName)),u}while(1<=s&&0<=l);break}}}finally{Lv=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?uu(e):""}function qD(e){switch(e.tag){case 5:return uu(e.type);case 16:return uu("Lazy");case 13:return uu("Suspense");case 19:return uu("SuspenseList");case 0:case 2:case 15:return e=Fv(e.type,!1),e;case 11:return e=Fv(e.type.render,!1),e;case 1:return e=Fv(e.type,!0),e;default:return""}}function H0(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case ll:return"Fragment";case al:return"Portal";case U0:return"Profiler";case aw:return"StrictMode";case V0:return"Suspense";case W0:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case M$:return(e.displayName||"Context")+".Consumer";case O$:return(e._context.displayName||"Context")+".Provider";case lw:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case cw:return t=e.displayName||null,t!==null?t:H0(e.type)||"Memo";case Ki:t=e._payload,e=e._init;try{return H0(e(t))}catch{}}return null}function QD(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return H0(t);case 8:return t===aw?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Ss(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function D$(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function JD(e){var t=D$(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var o=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(s){r=""+s,i.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Bf(e){e._valueTracker||(e._valueTracker=JD(e))}function I$(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=D$(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function oh(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function K0(e,t){var n=t.checked;return zt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function VS(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Ss(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function L$(e,t){t=t.checked,t!=null&&sw(e,"checked",t,!1)}function Y0(e,t){L$(e,t);var n=Ss(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?G0(e,t.type,n):t.hasOwnProperty("defaultValue")&&G0(e,t.type,Ss(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function WS(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function G0(e,t,n){(t!=="number"||oh(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var du=Array.isArray;function bl(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o"+t.valueOf().toString()+"",t=Uf.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Ou(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var vu={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},e9=["Webkit","ms","Moz","O"];Object.keys(vu).forEach(function(e){e9.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),vu[t]=vu[e]})});function B$(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||vu.hasOwnProperty(e)&&vu[e]?(""+t).trim():t+"px"}function U$(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=B$(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var t9=zt({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function q0(e,t){if(t){if(t9[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(ce(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(ce(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(ce(61))}if(t.style!=null&&typeof t.style!="object")throw Error(ce(62))}}function Q0(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var J0=null;function uw(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ey=null,_l=null,Sl=null;function YS(e){if(e=Ed(e)){if(typeof ey!="function")throw Error(ce(280));var t=e.stateNode;t&&(t=hm(t),ey(e.stateNode,e.type,t))}}function V$(e){_l?Sl?Sl.push(e):Sl=[e]:_l=e}function W$(){if(_l){var e=_l,t=Sl;if(Sl=_l=null,YS(e),t)for(e=0;e>>=0,e===0?32:31-(f9(e)/p9|0)|0}var Vf=64,Wf=4194304;function fu(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function lh(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,o=e.suspendedLanes,i=e.pingedLanes,s=n&268435455;if(s!==0){var l=s&~o;l!==0?r=fu(l):(i&=s,i!==0&&(r=fu(i)))}else s=n&~o,s!==0?r=fu(s):i!==0&&(r=fu(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&o)&&(o=r&-r,i=t&-t,o>=i||o===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function _d(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-go(t),e[t]=n}function v9(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=wu),nE=" ",rE=!1;function uk(e,t){switch(e){case"keyup":return H9.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function dk(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var cl=!1;function Y9(e,t){switch(e){case"compositionend":return dk(t);case"keypress":return t.which!==32?null:(rE=!0,nE);case"textInput":return e=t.data,e===nE&&rE?null:e;default:return null}}function G9(e,t){if(cl)return e==="compositionend"||!yw&&uk(e,t)?(e=lk(),$p=mw=rs=null,cl=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=aE(n)}}function mk(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?mk(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function gk(){for(var e=window,t=oh();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=oh(e.document)}return t}function ww(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function rI(e){var t=gk(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&mk(n.ownerDocument.documentElement,n)){if(r!==null&&ww(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var o=n.textContent.length,i=Math.min(r.start,o);r=r.end===void 0?i:Math.min(r.end,o),!e.extend&&i>r&&(o=r,r=i,i=o),o=lE(n,i);var s=lE(n,r);o&&s&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,ul=null,sy=null,bu=null,ay=!1;function cE(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ay||ul==null||ul!==oh(r)||(r=ul,"selectionStart"in r&&ww(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),bu&&Fu(bu,r)||(bu=r,r=dh(sy,"onSelect"),0pl||(e.current=py[pl],py[pl]=null,pl--)}function $t(e,t){pl++,py[pl]=e.current,e.current=t}var Es={},Tn=Ps(Es),Jn=Ps(!1),ba=Es;function Kl(e,t){var n=e.type.contextTypes;if(!n)return Es;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o={},i;for(i in n)o[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function er(e){return e=e.childContextTypes,e!=null}function ph(){At(Jn),At(Tn)}function gE(e,t,n){if(Tn.current!==Es)throw Error(ce(168));$t(Tn,t),$t(Jn,n)}function Ck(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in t))throw Error(ce(108,QD(e)||"Unknown",o));return zt({},n,r)}function hh(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Es,ba=Tn.current,$t(Tn,e),$t(Jn,Jn.current),!0}function vE(e,t,n){var r=e.stateNode;if(!r)throw Error(ce(169));n?(e=Ck(e,t,ba),r.__reactInternalMemoizedMergedChildContext=e,At(Jn),At(Tn),$t(Tn,e)):At(Jn),$t(Jn,n)}var li=null,mm=!1,Qv=!1;function $k(e){li===null?li=[e]:li.push(e)}function mI(e){mm=!0,$k(e)}function As(){if(!Qv&&li!==null){Qv=!0;var e=0,t=xt;try{var n=li;for(xt=1;e>=s,o-=s,ci=1<<32-go(t)+o|n<O?(F=A,A=null):F=A.sibling;var V=g(S,A,E[O],k);if(V===null){A===null&&(A=F);break}e&&A&&V.alternate===null&&t(S,A),b=i(V,b,O),M===null?P=V:M.sibling=V,M=V,A=F}if(O===E.length)return n(S,A),Dt&&qs(S,O),P;if(A===null){for(;OO?(F=A,A=null):F=A.sibling;var J=g(S,A,V.value,k);if(J===null){A===null&&(A=F);break}e&&A&&J.alternate===null&&t(S,A),b=i(J,b,O),M===null?P=J:M.sibling=J,M=J,A=F}if(V.done)return n(S,A),Dt&&qs(S,O),P;if(A===null){for(;!V.done;O++,V=E.next())V=m(S,V.value,k),V!==null&&(b=i(V,b,O),M===null?P=V:M.sibling=V,M=V);return Dt&&qs(S,O),P}for(A=r(S,A);!V.done;O++,V=E.next())V=y(A,S,O,V.value,k),V!==null&&(e&&V.alternate!==null&&A.delete(V.key===null?O:V.key),b=i(V,b,O),M===null?P=V:M.sibling=V,M=V);return e&&A.forEach(function(G){return t(S,G)}),Dt&&qs(S,O),P}function C(S,b,E,k){if(typeof E=="object"&&E!==null&&E.type===ll&&E.key===null&&(E=E.props.children),typeof E=="object"&&E!==null){switch(E.$$typeof){case zf:e:{for(var P=E.key,M=b;M!==null;){if(M.key===P){if(P=E.type,P===ll){if(M.tag===7){n(S,M.sibling),b=o(M,E.props.children),b.return=S,S=b;break e}}else if(M.elementType===P||typeof P=="object"&&P!==null&&P.$$typeof===Ki&&EE(P)===M.type){n(S,M.sibling),b=o(M,E.props),b.ref=Jc(S,M,E),b.return=S,S=b;break e}n(S,M);break}else t(S,M);M=M.sibling}E.type===ll?(b=xa(E.props.children,S.mode,k,E.key),b.return=S,S=b):(k=Np(E.type,E.key,E.props,null,S.mode,k),k.ref=Jc(S,b,E),k.return=S,S=k)}return s(S);case al:e:{for(M=E.key;b!==null;){if(b.key===M)if(b.tag===4&&b.stateNode.containerInfo===E.containerInfo&&b.stateNode.implementation===E.implementation){n(S,b.sibling),b=o(b,E.children||[]),b.return=S,S=b;break e}else{n(S,b);break}else t(S,b);b=b.sibling}b=s0(E,S.mode,k),b.return=S,S=b}return s(S);case Ki:return M=E._init,C(S,b,M(E._payload),k)}if(du(E))return x(S,b,E,k);if(Gc(E))return _(S,b,E,k);qf(S,E)}return typeof E=="string"&&E!==""||typeof E=="number"?(E=""+E,b!==null&&b.tag===6?(n(S,b.sibling),b=o(b,E),b.return=S,S=b):(n(S,b),b=i0(E,S.mode,k),b.return=S,S=b),s(S)):n(S,b)}return C}var Gl=Nk(!0),Dk=Nk(!1),Cd={},zo=Ps(Cd),Uu=Ps(Cd),Vu=Ps(Cd);function oa(e){if(e===Cd)throw Error(ce(174));return e}function Rw(e,t){switch($t(Vu,t),$t(Uu,e),$t(zo,Cd),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Z0(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Z0(t,e)}At(zo),$t(zo,t)}function Xl(){At(zo),At(Uu),At(Vu)}function Ik(e){oa(Vu.current);var t=oa(zo.current),n=Z0(t,e.type);t!==n&&($t(Uu,e),$t(zo,n))}function Tw(e){Uu.current===e&&(At(zo),At(Uu))}var Lt=Ps(0);function xh(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Jv=[];function Pw(){for(var e=0;e