otx-swap 1.2.35 → 1.2.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +20 -20
- package/dist/index.d.ts +2 -19
- package/dist/index.mjs +4114 -3825
- package/package.json +15 -24
package/dist/index.cjs
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode('.optx-widget .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.optx-widget .fixed{position:fixed}.optx-widget .absolute{position:absolute}.optx-widget .relative{position:relative}.optx-widget .inset-0{inset:0}.optx-widget .inset-2{inset:.5rem}.optx-widget .inset-x-0{left:0;right:0}.optx-widget .-bottom-1{bottom:-.25rem}.optx-widget .-bottom-2{bottom:-.5rem}.optx-widget .-right-1{right:-.25rem}.optx-widget .-top-2{top:-.5rem}.optx-widget .bottom-0{bottom:0}.optx-widget .bottom-full{bottom:100%}.optx-widget .left-0{left:0}.optx-widget .left-1\\/2{left:50%}.optx-widget .left-3{left:.75rem}.optx-widget .left-4{left:1rem}.optx-widget .right-0{right:0}.optx-widget .right-3{right:.75rem}.optx-widget .right-4{right:1rem}.optx-widget .top-1\\/2{top:50%}.optx-widget .top-full{top:100%}.optx-widget .z-10{z-index:10}.optx-widget .z-50{z-index:50}.optx-widget .\\!m-0{margin:0!important}.optx-widget .-my-4{margin-top:-1rem;margin-bottom:-1rem}.optx-widget .mx-auto{margin-left:auto;margin-right:auto}.optx-widget .mb-1{margin-bottom:.25rem}.optx-widget .mb-2{margin-bottom:.5rem}.optx-widget .mb-3{margin-bottom:.75rem}.optx-widget .mb-4{margin-bottom:1rem}.optx-widget .mb-6{margin-bottom:1.5rem}.optx-widget .ml-2{margin-left:.5rem}.optx-widget .ml-3{margin-left:.75rem}.optx-widget .ml-auto{margin-left:auto}.optx-widget .mt-1{margin-top:.25rem}.optx-widget .mt-2{margin-top:.5rem}.optx-widget .mt-24{margin-top:6rem}.optx-widget .mt-3{margin-top:.75rem}.optx-widget .mt-4{margin-top:1rem}.optx-widget .mt-auto{margin-top:auto}.optx-widget .block{display:block}.optx-widget .inline-block{display:inline-block}.optx-widget .inline{display:inline}.optx-widget .flex{display:flex}.optx-widget .size-10{width:2.5rem;height:2.5rem}.optx-widget .size-12{width:3rem;height:3rem}.optx-widget .size-2{width:.5rem;height:.5rem}.optx-widget .size-20{width:5rem;height:5rem}.optx-widget .size-3{width:.75rem;height:.75rem}.optx-widget .size-4{width:1rem;height:1rem}.optx-widget .size-5{width:1.25rem;height:1.25rem}.optx-widget .size-8{width:2rem;height:2rem}.optx-widget .h-1\\.5{height:.375rem}.optx-widget .h-10{height:2.5rem}.optx-widget .h-12{height:3rem}.optx-widget .h-14{height:3.5rem}.optx-widget .h-16{height:4rem}.optx-widget .h-2{height:.5rem}.optx-widget .h-3{height:.75rem}.optx-widget .h-3\\.5{height:.875rem}.optx-widget .h-4{height:1rem}.optx-widget .h-5{height:1.25rem}.optx-widget .h-6{height:1.5rem}.optx-widget .h-8{height:2rem}.optx-widget .h-auto{height:auto}.optx-widget .h-full{height:100%}.optx-widget .max-h-\\[2\\.5rem\\]{max-height:2.5rem}.optx-widget .max-h-\\[2rem\\]{max-height:2rem}.optx-widget .max-h-\\[3rem\\]{max-height:3rem}.optx-widget .max-h-\\[5rem\\]{max-height:5rem}.optx-widget .max-h-\\[60vh\\]{max-height:60vh}.optx-widget .max-h-\\[96vh\\]{max-height:96vh}.optx-widget .min-h-0{min-height:0px}.optx-widget .w-1\\/3{width:33.333333%}.optx-widget .w-10{width:2.5rem}.optx-widget .w-12{width:3rem}.optx-widget .w-14{width:3.5rem}.optx-widget .w-16{width:4rem}.optx-widget .w-20{width:5rem}.optx-widget .w-24{width:6rem}.optx-widget .w-28{width:7rem}.optx-widget .w-3{width:.75rem}.optx-widget .w-3\\.5{width:.875rem}.optx-widget .w-32{width:8rem}.optx-widget .w-4{width:1rem}.optx-widget .w-48{width:12rem}.optx-widget .w-5{width:1.25rem}.optx-widget .w-6{width:1.5rem}.optx-widget .w-72{width:18rem}.optx-widget .w-8{width:2rem}.optx-widget .w-96{width:24rem}.optx-widget .w-auto{width:auto}.optx-widget .w-full{width:100%}.optx-widget .min-w-0{min-width:0px}.optx-widget .min-w-\\[140px\\]{min-width:140px}.optx-widget .max-w-\\[280px\\]{max-width:280px}.optx-widget .max-w-md{max-width:28rem}.optx-widget .flex-1{flex:1 1 0%}.optx-widget .flex-shrink-0,.optx-widget .shrink-0{flex-shrink:0}.optx-widget .-translate-x-1\\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.optx-widget .-translate-y-1\\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.optx-widget .rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.optx-widget .rotate-45{--tw-rotate: 45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.optx-widget .transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.optx-widget .animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.optx-widget .animate-spin{animation:spin 1s linear infinite}.optx-widget .cursor-not-allowed{cursor:not-allowed}.optx-widget .cursor-pointer{cursor:pointer}.optx-widget .resize{resize:both}.optx-widget .flex-col{flex-direction:column}.optx-widget .flex-wrap{flex-wrap:wrap}.optx-widget .items-end{align-items:flex-end}.optx-widget .items-center{align-items:center}.optx-widget .justify-end{justify-content:flex-end}.optx-widget .justify-center{justify-content:center}.optx-widget .justify-between{justify-content:space-between}.optx-widget .gap-0\\.5{gap:.125rem}.optx-widget .gap-1{gap:.25rem}.optx-widget .gap-1\\.5{gap:.375rem}.optx-widget .gap-2{gap:.5rem}.optx-widget .gap-3{gap:.75rem}.optx-widget .gap-4{gap:1rem}.optx-widget :is(.space-y-1>:not([hidden])~:not([hidden])){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.optx-widget :is(.space-y-2>:not([hidden])~:not([hidden])){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.optx-widget :is(.space-y-3>:not([hidden])~:not([hidden])){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.optx-widget :is(.divide-y>:not([hidden])~:not([hidden])){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.optx-widget :is(.divide-\\[var\\(--optimex-border\\)\\]>:not([hidden])~:not([hidden])){border-color:var(--optimex-border)}.optx-widget .overflow-auto{overflow:auto}.optx-widget .overflow-hidden{overflow:hidden}.optx-widget .overflow-y-auto{overflow-y:auto}.optx-widget .truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.optx-widget .break-all{word-break:break-all}.optx-widget .rounded{border-radius:.25rem}.optx-widget .rounded-2xl{border-radius:1rem}.optx-widget .rounded-\\[0\\.25rem\\]{border-radius:.25rem}.optx-widget .rounded-\\[9999px\\]{border-radius:9999px}.optx-widget .rounded-\\[var\\(--optimex-overlay-radius\\)\\]{border-radius:var(--optimex-overlay-radius)}.optx-widget .rounded-\\[var\\(--optimex-radius-button\\)\\]{border-radius:var(--optimex-radius-button)}.optx-widget .rounded-\\[var\\(--optimex-radius-input\\)\\]{border-radius:var(--optimex-radius-input)}.optx-widget .rounded-\\[var\\(--optimex-radius-widget\\)\\]{border-radius:var(--optimex-radius-widget)}.optx-widget .rounded-full{border-radius:9999px}.optx-widget .rounded-lg{border-radius:.5rem}.optx-widget .rounded-md{border-radius:.375rem}.optx-widget .rounded-xl{border-radius:.75rem}.optx-widget .rounded-t-sm{border-top-left-radius:.125rem;border-top-right-radius:.125rem}.optx-widget .border{border-width:1px}.optx-widget .border-2{border-width:2px}.optx-widget .border-4{border-width:4px}.optx-widget .border-b{border-bottom-width:1px}.optx-widget .border-l{border-left-width:1px}.optx-widget .border-r{border-right-width:1px}.optx-widget .border-t{border-top-width:1px}.optx-widget .border-none{border-style:none}.optx-widget .border-\\[var\\(--optimex-background\\)\\]{border-color:var(--optimex-background)}.optx-widget .border-\\[var\\(--optimex-error\\)\\]{border-color:var(--optimex-error)}.optx-widget .border-\\[var\\(--optimex-primary\\)\\]{border-color:var(--optimex-primary)}.optx-widget .border-\\[var\\(--optimex-surface\\)\\]{border-color:var(--optimex-surface)}.optx-widget .border-current{border-color:currentColor}.optx-widget .border-transparent{border-color:transparent}.optx-widget .border-white\\/10{border-color:#ffffff1a}.optx-widget .border-white\\/5{border-color:#ffffff0d}.optx-widget .border-white\\/\\[0\\.02\\]{border-color:#ffffff05}.optx-widget .border-white\\/\\[0\\.05\\]{border-color:#ffffff0d}.optx-widget .border-t-transparent{border-top-color:transparent}.optx-widget .bg-\\[rgba\\(239\\,68\\,68\\,0\\.15\\)\\]{background-color:#ef444426}.optx-widget .bg-\\[rgba\\(34\\,197\\,94\\,0\\.15\\)\\]{background-color:#22c55e26}.optx-widget .bg-\\[rgba\\(59\\,130\\,246\\,0\\.15\\)\\]{background-color:#3b82f626}.optx-widget .bg-\\[var\\(--optimex-background\\)\\]{background-color:var(--optimex-background)}.optx-widget .bg-\\[var\\(--optimex-border\\)\\]{background-color:var(--optimex-border)}.optx-widget .bg-\\[var\\(--optimex-error\\)\\]{background-color:var(--optimex-error)}.optx-widget .bg-\\[var\\(--optimex-overlay-background\\)\\]{background-color:var(--optimex-overlay-background)}.optx-widget .bg-\\[var\\(--optimex-primary\\)\\]{background-color:var(--optimex-primary)}.optx-widget .bg-\\[var\\(--optimex-surface\\)\\]{background-color:var(--optimex-surface)}.optx-widget .bg-\\[var\\(--optimex-surface-hover\\)\\]{background-color:var(--optimex-surface-hover)}.optx-widget .bg-black\\/60{background-color:#0009}.optx-widget .bg-blue-500\\/20{background-color:#3b82f633}.optx-widget .bg-green-500\\/10{background-color:#22c55e1a}.optx-widget .bg-orange-500\\/20{background-color:#f9731633}.optx-widget .bg-purple-500\\/20{background-color:#a855f733}.optx-widget .bg-red-500\\/10{background-color:#ef44441a}.optx-widget .bg-transparent{background-color:transparent}.optx-widget .bg-white\\/10{background-color:#ffffff1a}.optx-widget .bg-white\\/20{background-color:#fff3}.optx-widget .bg-white\\/5{background-color:#ffffff0d}.optx-widget .bg-white\\/\\[0\\.02\\]{background-color:#ffffff05}.optx-widget .bg-yellow-500\\/10{background-color:#eab3081a}.optx-widget .bg-zinc-900\\/50{background-color:#18181b80}.optx-widget .stroke-\\[var\\(--optimex-error\\)\\]{stroke:var(--optimex-error)}.optx-widget .p-0{padding:0}.optx-widget .p-1{padding:.25rem}.optx-widget .p-1\\.5{padding:.375rem}.optx-widget .p-2{padding:.5rem}.optx-widget .p-3{padding:.75rem}.optx-widget .p-4{padding:1rem}.optx-widget .p-6{padding:1.5rem}.optx-widget .px-1\\.5{padding-left:.375rem;padding-right:.375rem}.optx-widget .px-2{padding-left:.5rem;padding-right:.5rem}.optx-widget .px-2\\.5{padding-left:.625rem;padding-right:.625rem}.optx-widget .px-3{padding-left:.75rem;padding-right:.75rem}.optx-widget .px-4{padding-left:1rem;padding-right:1rem}.optx-widget .px-6{padding-left:1.5rem;padding-right:1.5rem}.optx-widget .py-0\\.5{padding-top:.125rem;padding-bottom:.125rem}.optx-widget .py-1{padding-top:.25rem;padding-bottom:.25rem}.optx-widget .py-1\\.5{padding-top:.375rem;padding-bottom:.375rem}.optx-widget .py-12{padding-top:3rem;padding-bottom:3rem}.optx-widget .py-2{padding-top:.5rem;padding-bottom:.5rem}.optx-widget .py-3{padding-top:.75rem;padding-bottom:.75rem}.optx-widget .py-4{padding-top:1rem;padding-bottom:1rem}.optx-widget .py-8{padding-top:2rem;padding-bottom:2rem}.optx-widget .py-\\[6px\\]{padding-top:6px;padding-bottom:6px}.optx-widget .pb-3{padding-bottom:.75rem}.optx-widget .pb-4{padding-bottom:1rem}.optx-widget .pl-10{padding-left:2.5rem}.optx-widget .pl-2{padding-left:.5rem}.optx-widget .pr-10{padding-right:2.5rem}.optx-widget .pr-3{padding-right:.75rem}.optx-widget .pt-2{padding-top:.5rem}.optx-widget .pt-3{padding-top:.75rem}.optx-widget .text-left{text-align:left}.optx-widget .text-center{text-align:center}.optx-widget .text-2xl{font-size:1.5rem;line-height:2rem}.optx-widget .text-\\[10px\\]{font-size:10px}.optx-widget .text-base{font-size:1rem;line-height:1.5rem}.optx-widget .text-lg{font-size:1.125rem;line-height:1.75rem}.optx-widget .text-sm{font-size:.875rem;line-height:1.25rem}.optx-widget .text-xl{font-size:1.25rem;line-height:1.75rem}.optx-widget .text-xs{font-size:.75rem;line-height:1rem}.optx-widget .font-bold{font-weight:700}.optx-widget .font-medium{font-weight:500}.optx-widget .font-semibold{font-weight:600}.optx-widget .uppercase{text-transform:uppercase}.optx-widget .leading-none{line-height:1}.optx-widget .tracking-tight{letter-spacing:-.025em}.optx-widget .tracking-wider{letter-spacing:.05em}.optx-widget .text-\\[var\\(--optimex-error\\)\\]{color:var(--optimex-error)}.optx-widget .text-\\[var\\(--optimex-primary\\)\\]{color:var(--optimex-primary)}.optx-widget .text-\\[var\\(--optimex-success\\)\\]{color:var(--optimex-success)}.optx-widget .text-\\[var\\(--optimex-text\\)\\]{color:var(--optimex-text)}.optx-widget .text-\\[var\\(--optimex-text-secondary\\)\\]{color:var(--optimex-text-secondary)}.optx-widget .text-\\[var\\(--optimex-warning\\)\\]{color:var(--optimex-warning)}.optx-widget .text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.optx-widget .text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.optx-widget .text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.optx-widget .text-orange-400{--tw-text-opacity: 1;color:rgb(251 146 60 / var(--tw-text-opacity, 1))}.optx-widget .text-purple-400{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.optx-widget .text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.optx-widget .text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.optx-widget .text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.optx-widget .text-zinc-400{--tw-text-opacity: 1;color:rgb(161 161 170 / var(--tw-text-opacity, 1))}.optx-widget .text-zinc-500{--tw-text-opacity: 1;color:rgb(113 113 122 / var(--tw-text-opacity, 1))}.optx-widget .opacity-0{opacity:0}.optx-widget .opacity-50{opacity:.5}.optx-widget .opacity-70{opacity:.7}.optx-widget .shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.optx-widget .shadow-\\[0_0_15px_rgba\\(235\\,98\\,0\\,0\\.1\\)\\]{--tw-shadow: 0 0 15px rgba(235,98,0,.1);--tw-shadow-colored: 0 0 15px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.optx-widget .shadow-\\[0_0_15px_rgba\\(235\\,98\\,0\\,0\\.3\\)\\]{--tw-shadow: 0 0 15px rgba(235,98,0,.3);--tw-shadow-colored: 0 0 15px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.optx-widget .shadow-\\[0_0_8px_rgba\\(235\\,98\\,0\\,0\\.8\\)\\]{--tw-shadow: 0 0 8px rgba(235,98,0,.8);--tw-shadow-colored: 0 0 8px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.optx-widget .shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.optx-widget .shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.optx-widget .shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.optx-widget .outline-none{outline:2px solid transparent;outline-offset:2px}.optx-widget .blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.optx-widget .filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.optx-widget .backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.optx-widget .transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.optx-widget .transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.optx-widget .transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.optx-widget .transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.optx-widget .duration-200{transition-duration:.2s}.optx-widget .duration-300{transition-duration:.3s}.optx-widget{--optimex-primary: #ed6300;--optimex-background: hsla(0, 0%, 100%, .04);--optimex-surface: hsla(0, 0%, 0%, .2);--optimex-text: #ffffff;--optimex-text-secondary: hsla(0, 0%, 100%, .48);--optimex-error: #ff4d4f;--optimex-success: #52c41a;--optimex-overlay-background: #343b47;--optimex-overlay-radius: .75rem;--optimex-radius-widget: 1rem;--optimex-radius-input: .75rem;--optimex-radius-button: .5rem;--optimex-font-family: "Inter", sans-serif;isolation:isolate;width:100%;min-width:0;max-width:100%;--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: ;font-family:var(--optimex-font-family);font-size:14px;line-height:1.5;color:var(--optimex-text);text-align:left;-webkit-text-size-adjust:100%;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.optx-widget .widget-container{background:var(--optimex-background);border:1px solid rgba(255,255,255,.05);border-radius:var(--optimex-radius-widget);-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px);width:100%;min-width:0;max-width:100%;box-sizing:border-box}.optx-widget *,.optx-widget *:before,.optx-widget *:after{box-sizing:border-box}.optx-widget button{font-family:inherit;line-height:inherit;margin:0;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none}.optx-widget input,.optx-widget select,.optx-widget textarea{font-family:inherit;line-height:inherit;margin:0}.optx-widget a{color:inherit;text-decoration:none}.optx-widget ul,.optx-widget ol{list-style:none;margin:0;padding:0}.optx-widget img{max-width:100%;height:auto}.optx-widget svg{display:inline-block;vertical-align:middle}.optx-widget .glow-orange{box-shadow:inset 0 0 15px #eb620026,0 0 20px #eb62001a}.optx-widget .glow-green{box-shadow:0 0 12px #22c55e33}.optx-widget .glow-red{box-shadow:0 0 12px #ef444433}@keyframes optx-status-pulse{0%,to{opacity:1}50%{opacity:.5}}.optx-widget .status-pulse{animation:optx-status-pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes modal-overlay-in{0%{opacity:0}to{opacity:1}}@keyframes modal-overlay-out{0%{opacity:1}to{opacity:0}}@keyframes modal-content-in{0%{opacity:0;transform:translate(-50%,-50%) scale(.95)}to{opacity:1;transform:translate(-50%,-50%) scale(1)}}@keyframes modal-content-out{0%{opacity:1;transform:translate(-50%,-50%) scale(1)}to{opacity:0;transform:translate(-50%,-50%) scale(.95)}}.animate-modal-overlay-in{animation:modal-overlay-in .2s ease-out}.animate-modal-overlay-out{animation:modal-overlay-out .15s ease-in}.animate-modal-in{animation:modal-content-in .2s ease-out}.animate-modal-out{animation:modal-content-out .15s ease-in}.optx-widget .placeholder\\:text-\\[var\\(--optimex-text-secondary\\)\\]::-moz-placeholder{color:var(--optimex-text-secondary)}.optx-widget .placeholder\\:text-\\[var\\(--optimex-text-secondary\\)\\]::placeholder{color:var(--optimex-text-secondary)}.optx-widget .focus-within\\:border-\\[var\\(--optimex-primary\\)\\]:focus-within{border-color:var(--optimex-primary)}.optx-widget .hover\\:scale-110:hover{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.optx-widget .hover\\:border-\\[var\\(--optimex-primary\\)\\]:hover{border-color:var(--optimex-primary)}.optx-widget .hover\\:bg-\\[rgba\\(239\\,68\\,68\\,0\\.2\\)\\]:hover{background-color:#ef444433}.optx-widget .hover\\:bg-\\[var\\(--optimex-primary-hover\\)\\]:hover{background-color:var(--optimex-primary-hover)}.optx-widget .hover\\:bg-\\[var\\(--optimex-surface-hover\\)\\]:hover{background-color:var(--optimex-surface-hover)}.optx-widget .hover\\:bg-white\\/10:hover{background-color:#ffffff1a}.optx-widget .hover\\:bg-white\\/5:hover{background-color:#ffffff0d}.optx-widget .hover\\:bg-white\\/\\[0\\.02\\]:hover{background-color:#ffffff05}.optx-widget .hover\\:text-\\[var\\(--optimex-primary\\)\\]:hover{color:var(--optimex-primary)}.optx-widget .hover\\:text-\\[var\\(--optimex-text\\)\\]:hover{color:var(--optimex-text)}.optx-widget .hover\\:text-\\[var\\(--optimex-text-secondary\\)\\]:hover{color:var(--optimex-text-secondary)}.optx-widget .hover\\:opacity-100:hover{opacity:1}.optx-widget .hover\\:opacity-70:hover{opacity:.7}.optx-widget .hover\\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.optx-widget .hover\\:brightness-110:hover{--tw-brightness: brightness(1.1);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.optx-widget .focus\\:border-\\[var\\(--optimex-primary\\)\\]:focus{border-color:var(--optimex-primary)}.optx-widget .focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.optx-widget .focus\\:ring-0:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.optx-widget .active\\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.optx-widget .active\\:scale-\\[0\\.98\\]:active{--tw-scale-x: .98;--tw-scale-y: .98;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.optx-widget .disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.optx-widget .disabled\\:opacity-50:disabled{opacity:.5}.optx-widget :is(.group:hover .group-hover\\:rotate-180){--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.optx-widget :is(.group:hover .group-hover\\:opacity-100){opacity:1}@media(min-width:640px){.optx-widget .sm\\:text-left{text-align:left}}')),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),p=require("react"),wn=require("react-dom");function Cn(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const x=Cn(p),To=Cn(wn);var it=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Me=typeof window>"u"||"Deno"in globalThis;function ae(){}function Ro(e,t){return typeof e=="function"?e(t):e}function er(e){return typeof e=="number"&&e>=0&&e!==1/0}function kn(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Ue(e,t){return typeof e=="function"?e(t):e}function ce(e,t){return typeof e=="function"?e(t):e}function Lr(e,t){const{type:r="all",exact:n,fetchStatus:o,predicate:a,queryKey:l,stale:i}=e;if(l){if(n){if(t.queryHash!==mr(l,t.options))return!1}else if(!st(t.queryKey,l))return!1}if(r!=="all"){const c=t.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof i=="boolean"&&t.isStale()!==i||o&&o!==t.state.fetchStatus||a&&!a(t))}function Dr(e,t){const{exact:r,status:n,predicate:o,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(r){if(nt(t.options.mutationKey)!==nt(a))return!1}else if(!st(t.options.mutationKey,a))return!1}return!(n&&t.state.status!==n||o&&!o(t))}function mr(e,t){return(t?.queryKeyHashFn||nt)(e)}function nt(e){return JSON.stringify(e,(t,r)=>nr(r)?Object.keys(r).sort().reduce((n,o)=>(n[o]=r[o],n),{}):r)}function st(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(r=>!st(e[r],t[r])):!1}function tr(e,t){if(e===t)return e;const r=Fr(e)&&Fr(t);if(r||nr(e)&&nr(t)){const n=r?e:Object.keys(e),o=n.length,a=r?t:Object.keys(t),l=a.length,i=r?[]:{};let c=0;for(let u=0;u<l;u++){const d=r?u:a[u];(!r&&n.includes(d)||r)&&e[d]===void 0&&t[d]===void 0?(i[d]=void 0,c++):(i[d]=tr(e[d],t[d]),i[d]===e[d]&&e[d]!==void 0&&c++)}return o===l&&c===o?e:i}return t}function rr(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function Fr(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function nr(e){if(!$r(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!$r(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function $r(e){return Object.prototype.toString.call(e)==="[object Object]"}function Oo(e){return new Promise(t=>{setTimeout(t,e)})}function sr(e,t,r){if(typeof r.structuralSharing=="function")return r.structuralSharing(e,t);if(r.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return tr(e,t)}catch(n){console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${n}`)}return tr(e,t)}return t}function _o(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function Ao(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var jt=Symbol();function jn(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===jt&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===jt?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var Po=class extends it{#t;#e;#n;constructor(){super(),this.#n=e=>{if(!Me&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#e||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(e){this.#n=e,this.#e?.(),this.#e=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#t!==e&&(this.#t=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#t=="boolean"?this.#t:globalThis.document?.visibilityState!=="hidden"}},pr=new Po,Mo=class extends it{#t=!0;#e;#n;constructor(){super(),this.#n=e=>{if(!Me&&window.addEventListener){const t=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}}}onSubscribe(){this.#e||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(e){this.#n=e,this.#e?.(),this.#e=e(this.setOnline.bind(this))}setOnline(e){this.#t!==e&&(this.#t=e,this.listeners.forEach(r=>{r(e)}))}isOnline(){return this.#t}},St=new Mo;function or(){let e,t;const r=new Promise((o,a)=>{e=o,t=a});r.status="pending",r.catch(()=>{});function n(o){Object.assign(r,o),delete r.resolve,delete r.reject}return r.resolve=o=>{n({status:"fulfilled",value:o}),e(o)},r.reject=o=>{n({status:"rejected",reason:o}),t(o)},r}function Io(e){return Math.min(1e3*2**e,3e4)}function Sn(e){return(e??"online")==="online"?St.isOnline():!0}var En=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function It(e){return e instanceof En}function Nn(e){let t=!1,r=0,n=!1,o;const a=or(),l=h=>{n||(m(new En(h)),e.abort?.())},i=()=>{t=!0},c=()=>{t=!1},u=()=>pr.isFocused()&&(e.networkMode==="always"||St.isOnline())&&e.canRun(),d=()=>Sn(e.networkMode)&&e.canRun(),f=h=>{n||(n=!0,e.onSuccess?.(h),o?.(),a.resolve(h))},m=h=>{n||(n=!0,e.onError?.(h),o?.(),a.reject(h))},b=()=>new Promise(h=>{o=y=>{(n||u())&&h(y)},e.onPause?.()}).then(()=>{o=void 0,n||e.onContinue?.()}),v=()=>{if(n)return;let h;const y=r===0?e.initialPromise:void 0;try{h=y??e.fn()}catch(g){h=Promise.reject(g)}Promise.resolve(h).then(f).catch(g=>{if(n)return;const S=e.retry??(Me?0:3),k=e.retryDelay??Io,w=typeof k=="function"?k(r,g):k,N=S===!0||typeof S=="number"&&r<S||typeof S=="function"&&S(r,g);if(t||!N){m(g);return}r++,e.onFail?.(r,g),Oo(w).then(()=>u()?void 0:b()).then(()=>{t?m(g):v()})})};return{promise:a,cancel:l,continue:()=>(o?.(),a),cancelRetry:i,continueRetry:c,canStart:d,start:()=>(d()?v():b().then(v),a)}}function Lo(){let e=[],t=0,r=i=>{i()},n=i=>{i()},o=i=>setTimeout(i,0);const a=i=>{t?e.push(i):o(()=>{r(i)})},l=()=>{const i=e;e=[],i.length&&o(()=>{n(()=>{i.forEach(c=>{r(c)})})})};return{batch:i=>{let c;t++;try{c=i()}finally{t--,t||l()}return c},batchCalls:i=>(...c)=>{a(()=>{i(...c)})},schedule:a,setNotifyFunction:i=>{r=i},setBatchNotifyFunction:i=>{n=i},setScheduler:i=>{o=i}}}var te=Lo(),Tn=class{#t;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),er(this.gcTime)&&(this.#t=setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Me?1/0:300*1e3))}clearGcTimeout(){this.#t&&(clearTimeout(this.#t),this.#t=void 0)}},Do=class extends Tn{#t;#e;#n;#r;#a;#o;constructor(e){super(),this.#o=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#n=e.cache,this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Fo(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#r?.promise}setOptions(e){this.options={...this.#a,...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#n.remove(this)}setData(e,t){const r=sr(this.state.data,e,this.options);return this.#s({data:r,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),r}setState(e,t){this.#s({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#r?.promise;return this.#r?.cancel(e),t?t.then(ae).catch(ae):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#t)}isActive(){return this.observers.some(e=>ce(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===jt||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(e=0){return this.state.isInvalidated||this.state.data===void 0||!kn(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#r?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#r?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#r&&(this.#o?this.#r.cancel({revert:!0}):this.#r.cancelRetry()),this.scheduleGc()),this.#n.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#s({type:"invalidate"})}fetch(e,t){if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#r)return this.#r.continueRetry(),this.#r.promise}if(e&&this.setOptions(e),!this.options.queryFn){const i=this.observers.find(c=>c.options.queryFn);i&&this.setOptions(i.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const r=new AbortController,n=i=>{Object.defineProperty(i,"signal",{enumerable:!0,get:()=>(this.#o=!0,r.signal)})},o=()=>{const i=jn(this.options,t),c={queryKey:this.queryKey,meta:this.meta};return n(c),this.#o=!1,this.options.persister?this.options.persister(i,c,this):i(c)},a={fetchOptions:t,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:o};n(a),this.options.behavior?.onFetch(a,this),this.#e=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#s({type:"fetch",meta:a.fetchOptions?.meta});const l=i=>{It(i)&&i.silent||this.#s({type:"error",error:i}),It(i)||(this.#n.config.onError?.(i,this),this.#n.config.onSettled?.(this.state.data,i,this)),this.scheduleGc()};return this.#r=Nn({initialPromise:t?.initialPromise,fn:a.fetchFn,abort:r.abort.bind(r),onSuccess:i=>{if(i===void 0){process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),l(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(i)}catch(c){l(c);return}this.#n.config.onSuccess?.(i,this),this.#n.config.onSettled?.(i,this.state.error,this),this.scheduleGc()},onError:l,onFail:(i,c)=>{this.#s({type:"failed",failureCount:i,error:c})},onPause:()=>{this.#s({type:"pause"})},onContinue:()=>{this.#s({type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}),this.#r.start()}#s(e){const t=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...Rn(r.data,this.options),fetchMeta:e.meta??null};case"success":return{...r,data:e.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const n=e.error;return It(n)&&n.revert&&this.#e?{...this.#e,fetchStatus:"idle"}:{...r,error:n,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=t(this.state),te.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),this.#n.notify({query:this,type:"updated",action:e})})}};function Rn(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Sn(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Fo(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,n=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var $o=class extends it{constructor(e={}){super(),this.config=e,this.#t=new Map}#t;build(e,t,r){const n=t.queryKey,o=t.queryHash??mr(n,t);let a=this.get(o);return a||(a=new Do({cache:this,queryKey:n,queryHash:o,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(n)}),this.add(a)),a}add(e){this.#t.has(e.queryHash)||(this.#t.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#t.get(e.queryHash);t&&(e.destroy(),t===e&&this.#t.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){te.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#t.get(e)}getAll(){return[...this.#t.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(r=>Lr(t,r))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(r=>Lr(e,r)):t}notify(e){te.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){te.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){te.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Bo=class extends Tn{#t;#e;#n;constructor(e){super(),this.mutationId=e.mutationId,this.#e=e.mutationCache,this.#t=[],this.state=e.state||zo(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#e.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#e.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#e.remove(this))}continue(){return this.#n?.continue()??this.execute(this.state.variables)}async execute(e){this.#n=Nn({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(n,o)=>{this.#r({type:"failed",failureCount:n,error:o})},onPause:()=>{this.#r({type:"pause"})},onContinue:()=>{this.#r({type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#e.canRun(this)});const t=this.state.status==="pending",r=!this.#n.canStart();try{if(!t){this.#r({type:"pending",variables:e,isPaused:r}),await this.#e.config.onMutate?.(e,this);const o=await this.options.onMutate?.(e);o!==this.state.context&&this.#r({type:"pending",context:o,variables:e,isPaused:r})}const n=await this.#n.start();return await this.#e.config.onSuccess?.(n,e,this.state.context,this),await this.options.onSuccess?.(n,e,this.state.context),await this.#e.config.onSettled?.(n,null,this.state.variables,this.state.context,this),await this.options.onSettled?.(n,null,e,this.state.context),this.#r({type:"success",data:n}),n}catch(n){try{throw await this.#e.config.onError?.(n,e,this.state.context,this),await this.options.onError?.(n,e,this.state.context),await this.#e.config.onSettled?.(void 0,n,this.state.variables,this.state.context,this),await this.options.onSettled?.(void 0,n,e,this.state.context),n}finally{this.#r({type:"error",error:n})}}finally{this.#e.runNext(this)}}#r(e){const t=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),te.batch(()=>{this.#t.forEach(r=>{r.onMutationUpdate(e)}),this.#e.notify({mutation:this,type:"updated",action:e})})}};function zo(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Wo=class extends it{constructor(e={}){super(),this.config=e,this.#t=new Set,this.#e=new Map,this.#n=0}#t;#e;#n;build(e,t,r){const n=new Bo({mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){this.#t.add(e);const t=ft(e);if(typeof t=="string"){const r=this.#e.get(t);r?r.push(e):this.#e.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#t.delete(e)){const t=ft(e);if(typeof t=="string"){const r=this.#e.get(t);if(r)if(r.length>1){const n=r.indexOf(e);n!==-1&&r.splice(n,1)}else r[0]===e&&this.#e.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=ft(e);if(typeof t=="string"){const n=this.#e.get(t)?.find(o=>o.state.status==="pending");return!n||n===e}else return!0}runNext(e){const t=ft(e);return typeof t=="string"?this.#e.get(t)?.find(n=>n!==e&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){te.batch(()=>{this.#t.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#t.clear(),this.#e.clear()})}getAll(){return Array.from(this.#t)}find(e){const t={exact:!0,...e};return this.getAll().find(r=>Dr(t,r))}findAll(e={}){return this.getAll().filter(t=>Dr(e,t))}notify(e){te.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return te.batch(()=>Promise.all(e.map(t=>t.continue().catch(ae))))}};function ft(e){return e.options.scope?.id}function Br(e){return{onFetch:(t,r)=>{const n=t.options,o=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],l=t.state.data?.pageParams||[];let i={pages:[],pageParams:[]},c=0;const u=async()=>{let d=!1;const f=v=>{Object.defineProperty(v,"signal",{enumerable:!0,get:()=>(t.signal.aborted?d=!0:t.signal.addEventListener("abort",()=>{d=!0}),t.signal)})},m=jn(t.options,t.fetchOptions),b=async(v,h,y)=>{if(d)return Promise.reject();if(h==null&&v.pages.length)return Promise.resolve(v);const g={queryKey:t.queryKey,pageParam:h,direction:y?"backward":"forward",meta:t.options.meta};f(g);const S=await m(g),{maxPages:k}=t.options,w=y?Ao:_o;return{pages:w(v.pages,S,k),pageParams:w(v.pageParams,h,k)}};if(o&&a.length){const v=o==="backward",h=v?Vo:zr,y={pages:a,pageParams:l},g=h(n,y);i=await b(y,g,v)}else{const v=e??a.length;do{const h=c===0?l[0]??n.initialPageParam:zr(n,i);if(c>0&&h==null)break;i=await b(i,h),c++}while(c<v)}return i};t.options.persister?t.fetchFn=()=>t.options.persister?.(u,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=u}}}function zr(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function Vo(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var Ho=class{#t;#e;#n;#r;#a;#o;#s;#i;constructor(e={}){this.#t=e.queryCache||new $o,this.#e=e.mutationCache||new Wo,this.#n=e.defaultOptions||{},this.#r=new Map,this.#a=new Map,this.#o=0}mount(){this.#o++,this.#o===1&&(this.#s=pr.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#t.onFocus())}),this.#i=St.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#t.onOnline())}))}unmount(){this.#o--,this.#o===0&&(this.#s?.(),this.#s=void 0,this.#i?.(),this.#i=void 0)}isFetching(e){return this.#t.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#e.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#t.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=this.#t.build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Ue(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return this.#t.findAll(e).map(({queryKey:t,state:r})=>{const n=r.data;return[t,n]})}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),a=this.#t.get(n.queryHash)?.state.data,l=Ro(t,a);if(l!==void 0)return this.#t.build(this,n).setData(l,{...r,manual:!0})}setQueriesData(e,t,r){return te.batch(()=>this.#t.findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#t.get(t.queryHash)?.state}removeQueries(e){const t=this.#t;te.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=this.#t,n={type:"active",...e};return te.batch(()=>(r.findAll(e).forEach(o=>{o.reset()}),this.refetchQueries(n,t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=te.batch(()=>this.#t.findAll(e).map(o=>o.cancel(r)));return Promise.all(n).then(ae).catch(ae)}invalidateQueries(e,t={}){return te.batch(()=>{if(this.#t.findAll(e).forEach(n=>{n.invalidate()}),e?.refetchType==="none")return Promise.resolve();const r={...e,type:e?.refetchType??e?.type??"active"};return this.refetchQueries(r,t)})}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},n=te.batch(()=>this.#t.findAll(e).filter(o=>!o.isDisabled()).map(o=>{let a=o.fetch(void 0,r);return r.throwOnError||(a=a.catch(ae)),o.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(n).then(ae)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=this.#t.build(this,t);return r.isStaleByTime(Ue(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ae).catch(ae)}fetchInfiniteQuery(e){return e.behavior=Br(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ae).catch(ae)}ensureInfiniteQueryData(e){return e.behavior=Br(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return St.isOnline()?this.#e.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#t}getMutationCache(){return this.#e}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(nt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#r.values()],r={};return t.forEach(n=>{st(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){this.#a.set(nt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#a.values()];let r={};return t.forEach(n=>{st(e,n.mutationKey)&&(r={...r,...n.defaultOptions})}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=mr(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===jt&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#t.clear(),this.#e.clear()}},Uo=class extends it{constructor(e,t){super(),this.options=t,this.#t=e,this.#i=null,this.#s=or(),this.options.experimental_prefetchInRender||this.#s.reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(t)}#t;#e=void 0;#n=void 0;#r=void 0;#a;#o;#s;#i;#p;#f;#h;#c;#u;#l;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),Wr(this.#e,this.options)?this.#d():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ar(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ar(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#y(),this.#w(),this.#e.removeObserver(this)}setOptions(e,t){const r=this.options,n=this.#e;if(this.options=this.#t.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ce(this.options.enabled,this.#e)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#C(),this.#e.setOptions(this.options),r._defaulted&&!rr(this.options,r)&&this.#t.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const o=this.hasListeners();o&&Vr(this.#e,n,this.options,r)&&this.#d(),this.updateResult(t),o&&(this.#e!==n||ce(this.options.enabled,this.#e)!==ce(r.enabled,this.#e)||Ue(this.options.staleTime,this.#e)!==Ue(r.staleTime,this.#e))&&this.#x();const a=this.#v();o&&(this.#e!==n||ce(this.options.enabled,this.#e)!==ce(r.enabled,this.#e)||a!==this.#l)&&this.#g(a)}getOptimisticResult(e){const t=this.#t.getQueryCache().build(this.#t,e),r=this.createResult(t,e);return Qo(this,r)&&(this.#r=r,this.#o=this.options,this.#a=this.#e.state),r}getCurrentResult(){return this.#r}trackResult(e,t){const r={};return Object.keys(e).forEach(n=>{Object.defineProperty(r,n,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(n),t?.(n),e[n])})}),r}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#e}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#t.defaultQueryOptions(e),r=this.#t.getQueryCache().build(this.#t,t);return r.fetch().then(()=>this.createResult(r,t))}fetch(e){return this.#d({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#d(e){this.#C();let t=this.#e.fetch(this.options,e);return e?.throwOnError||(t=t.catch(ae)),t}#x(){this.#y();const e=Ue(this.options.staleTime,this.#e);if(Me||this.#r.isStale||!er(e))return;const r=kn(this.#r.dataUpdatedAt,e)+1;this.#c=setTimeout(()=>{this.#r.isStale||this.updateResult()},r)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#e):this.options.refetchInterval)??!1}#g(e){this.#w(),this.#l=e,!(Me||ce(this.options.enabled,this.#e)===!1||!er(this.#l)||this.#l===0)&&(this.#u=setInterval(()=>{(this.options.refetchIntervalInBackground||pr.isFocused())&&this.#d()},this.#l))}#b(){this.#x(),this.#g(this.#v())}#y(){this.#c&&(clearTimeout(this.#c),this.#c=void 0)}#w(){this.#u&&(clearInterval(this.#u),this.#u=void 0)}createResult(e,t){const r=this.#e,n=this.options,o=this.#r,a=this.#a,l=this.#o,c=e!==r?e.state:this.#n,{state:u}=e;let d={...u},f=!1,m;if(t._optimisticResults){const C=this.hasListeners(),j=!C&&Wr(e,t),O=C&&Vr(e,r,t,n);(j||O)&&(d={...d,...Rn(u.data,e.options)}),t._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:b,errorUpdatedAt:v,status:h}=d;if(t.select&&d.data!==void 0)if(o&&d.data===a?.data&&t.select===this.#p)m=this.#f;else try{this.#p=t.select,m=t.select(d.data),m=sr(o?.data,m,t),this.#f=m,this.#i=null}catch(C){this.#i=C}else m=d.data;if(t.placeholderData!==void 0&&m===void 0&&h==="pending"){let C;if(o?.isPlaceholderData&&t.placeholderData===l?.placeholderData)C=o.data;else if(C=typeof t.placeholderData=="function"?t.placeholderData(this.#h?.state.data,this.#h):t.placeholderData,t.select&&C!==void 0)try{C=t.select(C),this.#i=null}catch(j){this.#i=j}C!==void 0&&(h="success",m=sr(o?.data,C,t),f=!0)}this.#i&&(b=this.#i,m=this.#f,v=Date.now(),h="error");const y=d.fetchStatus==="fetching",g=h==="pending",S=h==="error",k=g&&y,w=m!==void 0,A={status:h,fetchStatus:d.fetchStatus,isPending:g,isSuccess:h==="success",isError:S,isInitialLoading:k,isLoading:k,data:m,dataUpdatedAt:d.dataUpdatedAt,error:b,errorUpdatedAt:v,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>c.dataUpdateCount||d.errorUpdateCount>c.errorUpdateCount,isFetching:y,isRefetching:y&&!g,isLoadingError:S&&!w,isPaused:d.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:S&&w,isStale:xr(e,t),refetch:this.refetch,promise:this.#s};if(this.options.experimental_prefetchInRender){const C=D=>{A.status==="error"?D.reject(A.error):A.data!==void 0&&D.resolve(A.data)},j=()=>{const D=this.#s=A.promise=or();C(D)},O=this.#s;switch(O.status){case"pending":e.queryHash===r.queryHash&&C(O);break;case"fulfilled":(A.status==="error"||A.data!==O.value)&&j();break;case"rejected":(A.status!=="error"||A.error!==O.reason)&&j();break}}return A}updateResult(e){const t=this.#r,r=this.createResult(this.#e,this.options);if(this.#a=this.#e.state,this.#o=this.options,this.#a.data!==void 0&&(this.#h=this.#e),rr(r,t))return;this.#r=r;const n={},o=()=>{if(!t)return!0;const{notifyOnChangeProps:a}=this.options,l=typeof a=="function"?a():a;if(l==="all"||!l&&!this.#m.size)return!0;const i=new Set(l??this.#m);return this.options.throwOnError&&i.add("error"),Object.keys(this.#r).some(c=>{const u=c;return this.#r[u]!==t[u]&&i.has(u)})};e?.listeners!==!1&&o()&&(n.listeners=!0),this.#k({...n,...e})}#C(){const e=this.#t.getQueryCache().build(this.#t,this.options);if(e===this.#e)return;const t=this.#e;this.#e=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#k(e){te.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#r)}),this.#t.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function qo(e,t){return ce(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Wr(e,t){return qo(e,t)||e.state.data!==void 0&&ar(e,t,t.refetchOnMount)}function ar(e,t,r){if(ce(t.enabled,e)!==!1){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&xr(e,t)}return!1}function Vr(e,t,r,n){return(e!==t||ce(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&xr(e,r)}function xr(e,t){return ce(t.enabled,e)!==!1&&e.isStaleByTime(Ue(t.staleTime,e))}function Qo(e,t){return!rr(e.getCurrentResult(),t)}var On=x.createContext(void 0),Go=e=>{const t=x.useContext(On);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Ko=({client:e,children:t})=>(x.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),s.jsx(On.Provider,{value:e,children:t})),_n=x.createContext(!1),Yo=()=>x.useContext(_n);_n.Provider;function Zo(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Xo=x.createContext(Zo()),Jo=()=>x.useContext(Xo);function ea(e,t){return typeof e=="function"?e(...t):!!e}function Hr(){}var ta=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},ra=e=>{x.useEffect(()=>{e.clearReset()},[e])},na=({result:e,errorResetBoundary:t,throwOnError:r,query:n})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&ea(r,[e.error,n]),sa=e=>{const t=e.staleTime;e.suspense&&(e.staleTime=typeof t=="function"?(...r)=>Math.max(t(...r),1e3):Math.max(t??1e3,1e3),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3)))},oa=(e,t)=>e.isLoading&&e.isFetching&&!t,aa=(e,t)=>e?.suspense&&t.isPending,Ur=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function ia(e,t,r){if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const n=Go(),o=Yo(),a=Jo(),l=n.defaultQueryOptions(e);n.getDefaultOptions().queries?._experimental_beforeQuery?.(l),l._optimisticResults=o?"isRestoring":"optimistic",sa(l),ta(l,a),ra(a);const i=!n.getQueryCache().get(l.queryHash),[c]=x.useState(()=>new t(n,l)),u=c.getOptimisticResult(l),d=!o&&e.subscribed!==!1;if(x.useSyncExternalStore(x.useCallback(f=>{const m=d?c.subscribe(te.batchCalls(f)):Hr;return c.updateResult(),m},[c,d]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),x.useEffect(()=>{c.setOptions(l,{listeners:!1})},[l,c]),aa(l,u))throw Ur(l,c,a);if(na({result:u,errorResetBoundary:a,throwOnError:l.throwOnError,query:n.getQueryCache().get(l.queryHash)}))throw u.error;return n.getDefaultOptions().queries?._experimental_afterQuery?.(l,u),l.experimental_prefetchInRender&&!Me&&oa(u,o)&&(i?Ur(l,c,a):n.getQueryCache().get(l.queryHash)?.promise)?.catch(Hr).finally(()=>{c.updateResult()}),l.notifyOnChangeProps?u:c.trackResult(u)}function Qe(e,t){return ia(e,Uo)}const la={widget:"1rem",input:"0.75rem",button:"0.5rem"},ca={primary:"#ffffff",secondary:"hsla(0, 0%, 100%, 0.48)"},ua={background:"#343b47",radius:"0.75rem"},oe={colors:{primary:"#ed6300",background:"hsla(0, 0%, 100%, 0.04)",surface:"hsla(0, 0%, 0%, 0.2)",text:ca,error:"#ff4d4f",success:"#52c41a"},radius:la,overlay:ua,fontFamily:"'Inter', sans-serif"},An=p.createContext(null);function da({children:e,theme:t}){const r=p.useMemo(()=>t?{colors:{primary:t.colors?.primary??oe.colors.primary,background:t.colors?.background??oe.colors.background,surface:t.colors?.surface??oe.colors.surface,text:{primary:t.colors?.text?.primary??oe.colors.text.primary,secondary:t.colors?.text?.secondary??oe.colors.text.secondary},error:t.colors?.error??oe.colors.error,success:t.colors?.success??oe.colors.success},radius:{widget:t.radius?.widget??oe.radius.widget,input:t.radius?.input??oe.radius.input,button:t.radius?.button??oe.radius.button},overlay:{background:t.overlay?.background??oe.overlay.background,radius:t.overlay?.radius??oe.overlay.radius},fontFamily:t.fontFamily??oe.fontFamily}:oe,[t]),n=p.useMemo(()=>({"--optimex-primary":r.colors.primary,"--optimex-background":r.colors.background,"--optimex-surface":r.colors.surface,"--optimex-text":r.colors.text.primary,"--optimex-text-secondary":r.colors.text.secondary,"--optimex-error":r.colors.error,"--optimex-success":r.colors.success,"--optimex-radius-widget":r.radius.widget,"--optimex-radius-input":r.radius.input,"--optimex-radius-button":r.radius.button,"--optimex-overlay-background":r.overlay.background,"--optimex-overlay-radius":r.overlay.radius,"--optimex-font-family":r.fontFamily}),[r]);return s.jsx(An.Provider,{value:{theme:r},children:s.jsx("div",{style:n,className:"w-full",children:e})})}function fa(){const e=p.useContext(An);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const Pn=p.createContext(null);function ha({children:e,externalWalletClient:t,onRequestWallet:r}){const n=p.useMemo(()=>{const o=t?.evm?.address??null,a=t?.evm?.chain?.id??null,l=t?.btc?.address??null,i=t?.btc?.publicKey??null,c=t?.solana?.address??null,u=!!o,d=!!l,f=!!c;return{mode:"external",isExternalWallet:!0,isConnected:u||d||f,evmAddress:o,evmChainId:a,isEvmConnected:u,btcAddress:l,btcPublicKey:i,isBtcConnected:d,solanaAddress:c,isSolanaConnected:f,externalWalletClient:t,onRequestWallet:r,isConnecting:!1}},[t,r]);return s.jsx(Pn.Provider,{value:n,children:e})}class Lt extends Error{status;code;constructor(t,r,n){super(r),this.name="ApiError",this.status=t,this.code=n}}class Mn{baseUrl;headers;constructor(t){this.baseUrl=t.replace(/\/$/,""),this.headers={"Content-Type":"application/json"}}async request(t,r,n){const o=`${this.baseUrl}${r}`;try{const a=await fetch(o,{method:t,headers:this.headers,body:n?JSON.stringify(n):void 0});if(!a.ok){const i=await a.json().catch(()=>({}));throw new Lt(a.status,i.message||`Request failed with status ${a.status}`,i.code)}return(await a.json()).data}catch(a){throw a instanceof Lt?a:new Lt(0,a instanceof Error?a.message:"Network error","NETWORK_ERROR")}}async getTokens(){return this.request("GET","/v2/tokens")}async createQuote(t){return this.request("POST","/v2/trades/quote",t)}async submitTransaction(t,r){return this.request("POST","/v2/trades/submit-tx",{trade_id:t,tx_id:r})}async getTrade(t){return this.request("GET",`/v2/trades/${t}`)}async getTokenPrice(t){return this.request("GET",`/v2/tokens/${t}`)}async listTrades(t={}){const r=new URLSearchParams;t.limit&&r.set("limit",String(t.limit)),t.page&&r.set("page",String(t.page)),t.state&&r.set("state",t.state),t.from_user_address?.length&&t.from_user_address.forEach(a=>r.append("from_user_address",a)),t.to_user_address?.length&&t.to_user_address.forEach(a=>r.append("to_user_address",a));const n=r.toString(),o=n?`/v2/trades?${n}`:"/v2/trades";return this.request("GET",o)}}let He=null;function Ge(e){if(!He&&e&&(He=new Mn(e)),!He)throw new Error("API not initialized. Please provide baseUrl.");return He}function ma(e){return He=new Mn(e),He}const pa=["tokens"];function xa(e){return Qe({queryKey:pa,queryFn:async()=>Ge(e).getTokens(),staleTime:300*1e3,gcTime:1800*1e3,retry:3,retryDelay:t=>Math.min(1e3*2**t,3e4)})}const va=15e3,ga=1e4,K={EVM:"EVM",BTC:"BTC",SOLANA:"Solana"};function ba(e,t=4){return e?e.length<=t*2+3?e:`${e.slice(0,t+2)}...${e.slice(-t)}`:""}function ya(e,t,r=6){if(!e)return"0";let n;typeof e=="bigint"?n=e:typeof e=="string"?n=BigInt(e):n=BigInt(Math.floor(e));const o=BigInt(10**t),a=n/o,l=n%o;if(l===0n)return a.toString();const c=l.toString().padStart(t,"0").slice(0,r).replace(/0+$/,"");return c?`${a}.${c}`:a.toString()}function In(e,t){if(!e||e==="0")return 0n;const[r,n=""]=e.split("."),o=n.slice(0,t).padEnd(t,"0"),a=r+o;return BigInt(a)}function Ne(e,t=18,r=6){if(!e)return"0";const n=String(e);if(n.includes(".")||!Number.isInteger(Number(n))){const o=parseFloat(n);return isNaN(o)?"0":o.toFixed(r).replace(/\.?0+$/,"")}return ya(n,t,r)}function wa(e){return/^0x[a-fA-F0-9]{40}$/.test(e)}function Ca(e){return/^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$|^(bc1)[a-z0-9]{39,59}$/.test(e)}function ka(e){return/^[mn2][a-km-zA-HJ-NP-Z1-9]{25,34}$|^(tb1)[a-z0-9]{39,59}$/.test(e)}function ja(e){return/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(e)}function vr(e,t,r){const n=e.trim();if(!n)return{isValid:!1,error:"Address is required"};switch(t){case K.EVM:return wa(n)?{isValid:!0}:{isValid:!1,error:`Invalid ${r} wallet address`};case K.BTC:if(r==="bitcoin_testnet"){if(!ka(n))return{isValid:!1,error:`Invalid ${r} wallet address`}}else if(!Ca(n))return{isValid:!1,error:`Invalid ${r} wallet address`};return{isValid:!0};case K.SOLANA:return ja(n)?{isValid:!0}:{isValid:!1,error:`Invalid ${r} wallet address`};default:return{isValid:!1,error:`Unsupported network type: ${t}`}}}const Sa=e=>["quote",e];function Ea(e,{from_token:t,to_token:r,amount:n,from_user_address:o,to_user_address:a,user_refund_pubkey:l,slippage:i="100",affiliate_fee_bps:c,affiliate_info:u,trade_timeout:d,script_timeout:f,enabled:m=!0,onQuote:b}){const v=r&&a?vr(a,r.network_type,r.network_id).isValid:!1,h=t&&r&&n&&parseFloat(n)>0&&o&&a&&l&&v;return Qe({queryKey:Sa({from_token:t,to_token:r,amount:n,from_user_address:o,to_user_address:a,user_refund_pubkey:l,slippage:i}),queryFn:async()=>{const y=Ge(e),g=In(n,t.token_decimals).toString(),S=await y.createQuote({from_token_id:t.token_id,to_token_id:r.token_id,amount_in:g,slippage:i,from_user_address:o,to_user_address:a,user_refund_pubkey:l,affiliate_fee_bps:c,affiliate_info:u,trade_timeout:d,script_timeout:f});return b?.({quote:S,from_token:t,to_token:r,amount_in:n}),S},enabled:m&&!!h,staleTime:ga,refetchInterval:va,retry:2,retryDelay:1e3})}const Ln=p.createContext(null);function Na({children:e,value:t}){return s.jsx(Ln.Provider,{value:t,children:e})}function lt(){const e=p.useContext(Ln);if(!e)throw new Error("useWidgetConfig must be used within SwapWidget");return e}function Ta({className:e="h-6 w-6"}){return s.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[s.jsx("rect",{width:"24",height:"24",rx:"6",fill:"#D0D0D8"}),s.jsx("rect",{x:"4",y:"4",width:"6.85714",height:"6.85714",rx:"3.42857",fill:"#FFD49F"}),s.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.98943 6.98062C9.06078 6.50027 8.69769 6.24205 8.20122 6.06979L8.36227 5.4191L7.96906 5.32039L7.81227 5.95393C7.7089 5.92798 7.60273 5.9035 7.49723 5.87925L7.65514 5.24153L7.26216 5.14282L7.101 5.79329C7.01544 5.77366 6.93144 5.75426 6.84991 5.73384L6.85036 5.73181L6.30809 5.59542L6.20348 6.01846C6.20348 6.01846 6.49523 6.08581 6.48907 6.08998C6.64832 6.13003 6.6771 6.23618 6.67229 6.32034L6.48884 7.06162C6.49982 7.06444 6.51404 7.0685 6.52972 7.07482L6.5164 7.07147L6.48817 7.06444L6.23103 8.10286C6.21155 8.1516 6.16216 8.2247 6.05084 8.19695C6.05476 8.2027 5.76503 8.12509 5.76503 8.12509L5.56982 8.57847L6.08152 8.70696C6.13867 8.72139 6.19513 8.73622 6.251 8.7509C6.2882 8.76067 6.32514 8.77037 6.36184 8.77984L6.19912 9.43798L6.59188 9.53669L6.75304 8.88554C6.86033 8.91487 6.96448 8.94195 7.06639 8.96744L6.9058 9.61554L7.299 9.71425L7.46173 9.05735C8.13224 9.18517 8.63643 9.13361 8.84866 8.52274C9.01967 8.03089 8.84015 7.74717 8.48737 7.56216C8.74428 7.50248 8.93781 7.33225 8.98943 6.98062ZM8.09134 8.24968C7.97986 8.70094 7.27864 8.51438 6.9578 8.42902L6.95779 8.42901C6.92893 8.42133 6.90314 8.41447 6.88114 8.40897L7.09706 7.53706C7.12385 7.54379 7.15659 7.55119 7.19367 7.55957C7.52551 7.63458 8.20558 7.78829 8.09134 8.24968ZM7.26037 7.15491C7.52787 7.22682 8.11136 7.38367 8.213 6.97354C8.31679 6.55403 7.74968 6.42757 7.47272 6.36581C7.44156 6.35886 7.41408 6.35273 7.39164 6.3471L7.19587 7.1379C7.21436 7.14254 7.23606 7.14838 7.26037 7.15491Z",fill:"#F7931A"}),s.jsx("rect",{x:"12.8572",y:"4",width:"6.85714",height:"6.85714",rx:"3.42857",fill:"white"}),s.jsx("path",{d:"M14.8567 7.47096L16.2848 8.30034V6.83321V5.14284L14.8567 7.47096Z",fill:"#898989"}),s.jsx("path",{d:"M16.2837 5.14284V6.8332V8.30033L17.7118 7.47096L16.2837 5.14284Z",fill:"#323232"}),s.jsx("path",{d:"M16.2837 6.83343L17.7114 7.47098L16.2837 8.30014V6.83343Z",fill:"#141414"}),s.jsx("path",{d:"M16.2848 6.83322L16.2853 6.83336V8.29993L16.2848 8.30035L14.8567 7.47097L16.2848 6.83322Z",fill:"#373737"}),s.jsx("path",{d:"M14.8567 7.73708L16.2848 9.71431V8.56604L14.8567 7.73708Z",fill:"#898989"}),s.jsx("path",{d:"M16.2837 8.56604V9.71431L17.7127 7.73708L16.2837 8.56604Z",fill:"#323232"}),s.jsx("rect",{x:"4",y:"12.8571",width:"6.85714",height:"6.85714",rx:"3.42857",fill:"#DCFFFB"}),s.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.68368 15.456C8.66445 15.4645 8.64369 15.469 8.6227 15.469H5.49249C5.47756 15.469 5.46296 15.4645 5.45047 15.4563C5.43798 15.448 5.42815 15.4362 5.42218 15.4223C5.41621 15.4084 5.41436 15.3931 5.41685 15.3782C5.41935 15.3633 5.42608 15.3494 5.43622 15.3383L6.0958 14.6209C6.11009 14.6053 6.12738 14.5929 6.14662 14.5844C6.16585 14.5758 6.18661 14.5714 6.2076 14.5714H9.33781C9.35286 14.5711 9.3677 14.5753 9.3804 14.5835C9.39311 14.5917 9.40317 14.6035 9.40925 14.6175C9.41536 14.6315 9.41722 14.6469 9.41465 14.662C9.41208 14.677 9.40518 14.691 9.39482 14.7021L8.7345 15.4195C8.72021 15.4351 8.70292 15.4475 8.68368 15.456ZM8.73471 15.9844C8.72037 15.9689 8.70306 15.9565 8.68384 15.948C8.66462 15.9395 8.64389 15.9351 8.62291 15.935H5.4927C5.47777 15.935 5.46317 15.9394 5.45068 15.9477C5.43819 15.956 5.42836 15.9678 5.42239 15.9817C5.41642 15.9955 5.41457 16.0108 5.41706 16.0258C5.41955 16.0407 5.42629 16.0545 5.43643 16.0656L6.09601 16.7835C6.11035 16.799 6.12766 16.8114 6.14688 16.8199C6.1661 16.8284 6.18683 16.8328 6.20781 16.8329H9.33802C9.35292 16.8328 9.36746 16.8284 9.3799 16.82C9.39235 16.8117 9.40211 16.7999 9.40804 16.7861C9.41396 16.7722 9.41579 16.7569 9.41326 16.742C9.41076 16.7272 9.40405 16.7133 9.39392 16.7023L8.73471 15.9844ZM9.39503 17.4295L8.73471 18.147C8.72042 18.1626 8.70313 18.175 8.68389 18.1835C8.66466 18.192 8.6439 18.1964 8.62291 18.1965H5.4927C5.47777 18.1964 5.46317 18.192 5.45068 18.1837C5.43819 18.1754 5.42836 18.1636 5.42239 18.1498C5.41642 18.1359 5.41457 18.1206 5.41706 18.1057C5.41955 18.0908 5.42629 18.0769 5.43643 18.0658L6.09601 17.3484C6.1103 17.3328 6.12759 17.3203 6.14683 17.3118C6.16606 17.3033 6.18682 17.2989 6.20781 17.2989H9.33802C9.35307 17.2986 9.3679 17.3028 9.38061 17.311C9.39332 17.3192 9.40338 17.331 9.40945 17.345C9.41557 17.3589 9.41743 17.3744 9.41486 17.3895C9.41229 17.4045 9.40539 17.4185 9.39503 17.4295Z",fill:"url(#paint0_linear_all_networks)"}),s.jsx("rect",{x:"12.8572",y:"12.8571",width:"6.85714",height:"6.85714",rx:"3.42857",fill:"#999CB3"}),s.jsx("path",{d:"M16.0979 17.4286V15.1429H16.473V17.4286H16.0979ZM15.1426 16.4692V16.097H17.4283V16.4692H15.1426Z",fill:"#2D3153"}),s.jsx("defs",{children:s.jsxs("linearGradient",{id:"paint0_linear_all_networks",x1:"7.82209",y1:"19.7701",x2:"10.7176",y2:"15.7425",gradientUnits:"userSpaceOnUse",children:[s.jsx("stop",{offset:"0.08",stopColor:"#9945FF"}),s.jsx("stop",{offset:"0.3",stopColor:"#8752F3"}),s.jsx("stop",{offset:"0.5",stopColor:"#5497D5"}),s.jsx("stop",{offset:"0.6",stopColor:"#43B4CA"}),s.jsx("stop",{offset:"0.72",stopColor:"#28E0B9"}),s.jsx("stop",{offset:"0.97",stopColor:"#19FB9B"})]})})]})}function Ra(e){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",...e,children:s.jsx("path",{d:"M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"})})}function gr({className:e="h-5 w-5"}){return s.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 20 20",children:s.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})}function Dn({className:e="h-4 w-4"}){return s.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})}function Fn({className:e="h-5 w-5"}){return s.jsxs("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[s.jsx("circle",{cx:"12",cy:"12",r:"10",strokeOpacity:"0.25"}),s.jsx("path",{strokeLinecap:"round",d:"M12 2a10 10 0 019.17 6"})]})}function Oa({className:e="h-5 w-5"}){return s.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 20 20",children:s.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}function Ie({className:e="h-5 w-5"}){return s.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}function _a(e){return s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[s.jsx("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),s.jsx("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]})}function Aa(e){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",...e,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})})}function Pa({className:e="h-3.5 w-3.5"}){return s.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"})})}function Ma(e){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 29 20",fill:"currentColor",...e,children:s.jsx("path",{d:"M18.1123 4.25181C17.9463 3.49057 17.537 2.8272 16.9727 2.31607C15.4792 0.978457 13.189 1.03283 11.7619 2.4357C11.2751 2.91419 10.9321 3.51232 10.7662 4.18656C10.6002 4.84993 10.6555 5.64381 10.4564 6.50293C10.1798 7.75354 9.53813 8.90629 8.6088 9.81978C7.6131 10.7985 6.34081 11.451 4.95788 11.6903C4.19451 11.8208 3.3205 11.7773 2.57925 12.0165C2.00396 12.2014 1.48398 12.5276 1.07463 12.9409C-0.374675 14.3981 -0.352546 16.7254 1.10782 18.1609C2.535 19.5637 4.84725 19.6181 6.32974 18.2696C6.72802 17.9107 7.04886 17.4757 7.25907 16.9755C7.67947 16.0076 7.52459 15.5944 7.65735 14.6483C7.73479 14.0936 7.87862 13.5608 8.08882 13.0388C8.31009 12.4841 8.3986 12.3319 8.70837 11.8643C9.29473 10.9943 10.0692 10.2548 10.9874 9.73278C12.0053 9.14554 13.178 8.81929 14.4392 8.81929C16.32 8.81929 18.0237 9.56966 19.2628 10.7768C20.2586 11.7446 20.9445 13.0061 21.1879 14.4199C21.3096 15.0941 21.2432 15.8227 21.4202 16.4861C21.5972 17.1386 21.9402 17.715 22.4049 18.1826C23.8763 19.629 26.266 19.629 27.7485 18.1826C29.1646 16.7906 29.231 14.5395 27.8923 13.0823C27.4498 12.6038 26.8855 12.234 26.2549 12.0274C25.4252 11.7664 25.0379 11.8643 24.1971 11.7555C22.6593 11.5598 21.2875 10.8638 20.2475 9.84153C19.1854 8.79754 18.4663 7.40554 18.2893 5.8613C18.1897 5.19793 18.2561 4.87168 18.1123 4.25181ZM16.9617 11.0486C15.5013 9.61316 13.1448 9.61316 11.6844 11.0486C10.2241 12.4841 10.2241 14.8005 11.6844 16.236C13.1448 17.6715 15.5013 17.6715 16.9617 16.236C18.422 14.8005 18.422 12.4841 16.9617 11.0486ZM26.0668 3.13169C24.6065 1.6962 22.25 1.6962 20.7896 3.13169C19.3292 4.56719 19.3292 6.88355 20.7896 8.31904C22.25 9.75453 24.6065 9.75453 26.0668 8.31904C27.5272 6.88355 27.5272 4.56719 26.0668 3.13169ZM7.95606 3.17519C6.49569 1.7397 4.13919 1.7397 2.67882 3.17519C1.21845 4.61069 1.21845 6.92705 2.67882 8.36254C4.13919 9.79803 6.49569 9.79803 7.95606 8.36254C9.41643 6.92705 9.41643 4.59981 7.95606 3.17519Z"})})}function Ia(e){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 124 22",...e,children:s.jsx("path",{d:"M41.39 4.241c3.385 0 6.162 2.73 6.162 6.058s-2.777 6.003-6.162 6.003h-.62c-3.385 0-6.162-2.676-6.162-6.003S37.385 4.24 40.77 4.24zm-.3 10.745c2.877 0 4.825-2.317 4.825-4.644.055-2.37-1.903-4.796-4.824-4.796-2.976 0-4.879 2.425-4.824 4.796-.01 2.316 1.892 4.644 4.824 4.644m21.353-4.698c0 3.327-2.268 5.992-5.233 5.992h-.62c-2.422 0-3.905-.805-4.978-2.665V22H50.02V4.241h1.593V6.96c.963-1.925 2.666-2.719 4.979-2.719h.62c2.964 0 5.232 2.719 5.232 6.047m-1.703 0c0-2.317-1.649-4.644-4.559-4.644-2.312 0-4.259 1.925-4.259 4.23v.816c0 2.316 1.936 4.187 4.304 4.187 2.832 0 4.514-2.273 4.514-4.59m8.275 6.003c-.354 0-.72-.055-1.073-.196-.874-.305-1.593-.86-2.058-1.61a5 5 0 0 1-.465-1.109c-.1-.402-.155-.707-.155-1.11V5.765h-1.382v-1.36h1.382V.772h1.649v3.632h3.44v1.36h-3.44v6.144c0 1.762.774 2.828 2.722 2.828h1.438v1.566h-2.058zm6.018-15.28c0 .555-.409 1.012-.973 1.012A1.025 1.025 0 0 1 73.03 1.01C73.031.457 73.496 0 74.06 0s.973.457.973 1.011m-1.792 3.23h1.593v12.06h-1.593zm14.283 2.621c.819-1.718 2.511-2.62 4.47-2.62 3.075 0 4.47 2.729 4.47 5.502v6.558H94.87V9.396c0-5.655-6.881-4.698-6.881.196v6.71h-1.594V9.396c0-5.655-6.826-4.698-6.826.196v6.71h-1.637V4.242h1.593v2.065c1.637-2.925 6.716-2.773 7.999.555m17.436 8.124c1.847 0 3.695-1.164 4.304-2.73h1.593c-.819 2.316-2.877 4.035-5.543 4.035h-.664c-3.385 0-5.897-2.676-5.897-6.003s2.512-6.058 5.897-6.058h.664c3.341 0 5.897 2.73 5.897 6.058 0 .195 0 .402-.056.609H100.38c.121 2.273 2.268 4.089 4.58 4.089m4.624-5.296c-.099-2.273-2.257-4.133-4.613-4.133-2.312 0-4.47 1.86-4.569 4.133zM124 4.24l-5.133 6.058L124 16.302h-2.058l-4.104-4.84-4.105 4.84h-2.002l5.133-6.003-5.133-6.058h2.002l4.105 4.84 4.104-4.84zm-105.888-.49a3.67 3.67 0 0 0-1.14-1.935 3.817 3.817 0 0 0-5.21.12 3.67 3.67 0 0 0-.996 1.75c-.166.664-.11 1.458-.31 2.317A6.7 6.7 0 0 1 8.61 9.32a6.88 6.88 0 0 1-3.651 1.87c-.763.13-1.638.087-2.379.327a3.75 3.75 0 0 0-1.504.924 3.667 3.667 0 0 0 .033 5.22c1.427 1.403 3.74 1.457 5.222.109.398-.36.719-.794.93-1.294.42-.968.265-1.382.397-2.328a6.8 6.8 0 0 1 .432-1.61c.221-.554.31-.706.62-1.174a6.862 6.862 0 0 1 5.73-3.045c1.881 0 3.585.75 4.824 1.958a6.64 6.64 0 0 1 1.925 3.643c.122.674.055 1.403.232 2.066.177.653.52 1.229.985 1.697 1.471 1.446 3.861 1.446 5.343 0a3.666 3.666 0 0 0 .144-5.1 3.9 3.9 0 0 0-1.637-1.056c-.83-.26-1.217-.163-2.058-.271a6.86 6.86 0 0 1-3.95-1.914 6.65 6.65 0 0 1-1.958-3.98c-.1-.664-.033-.99-.177-1.61m-1.15 6.798a3.77 3.77 0 0 0-5.278 0 3.62 3.62 0 0 0 0 5.187 3.77 3.77 0 0 0 5.278 0 3.62 3.62 0 0 0 0-5.187m9.105-7.917a3.77 3.77 0 0 0-5.277 0 3.62 3.62 0 0 0 0 5.187 3.77 3.77 0 0 0 5.277 0 3.62 3.62 0 0 0 0-5.187m-18.11.043a3.77 3.77 0 0 0-5.278 0 3.62 3.62 0 0 0 0 5.188 3.77 3.77 0 0 0 5.277 0 3.62 3.62 0 0 0 0-5.188"})})}function La(e){return s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 25",fill:"none",...e,children:[s.jsx("mask",{id:"paste_mask",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"24",height:"25",children:s.jsx("rect",{y:"0.5",width:"24",height:"24",fill:"#D9D9D9"})}),s.jsx("g",{mask:"url(#paste_mask)",children:s.jsx("path",{d:"M5.30775 20.9999C4.80908 20.9999 4.38308 20.8233 4.02975 20.4701C3.67658 20.1168 3.5 19.6908 3.5 19.1921V5.80762C3.5 5.30895 3.67658 4.88295 4.02975 4.52962C4.38308 4.17645 4.80908 3.99987 5.30775 3.99987H9.7135C9.852 3.5127 10.135 3.10887 10.5625 2.78837C10.99 2.46787 11.4692 2.30762 12 2.30762C12.5513 2.30762 13.0382 2.46787 13.4605 2.78837C13.883 3.10887 14.1635 3.5127 14.302 3.99987H18.6923C19.1909 3.99987 19.6169 4.17645 19.9703 4.52962C20.3234 4.88295 20.5 5.30895 20.5 5.80762V19.1921C20.5 19.6908 20.3234 20.1168 19.9703 20.4701C19.6169 20.8233 19.1909 20.9999 18.6923 20.9999H5.30775ZM5.30775 19.4999H18.6923C18.7692 19.4999 18.8398 19.4678 18.9038 19.4036C18.9679 19.3396 19 19.2691 19 19.1921V5.80762C19 5.73062 18.9679 5.66012 18.9038 5.59612C18.8398 5.53195 18.7692 5.49987 18.6923 5.49987H16.5V8.11512H7.5V5.49987H5.30775C5.23075 5.49987 5.16025 5.53195 5.09625 5.59612C5.03208 5.66012 5 5.73062 5 5.80762V19.1921C5 19.2691 5.03208 19.3396 5.09625 19.4036C5.16025 19.4678 5.23075 19.4999 5.30775 19.4999ZM12 5.61537C12.2577 5.61537 12.4728 5.52912 12.6453 5.35662C12.8176 5.18412 12.9038 4.96903 12.9038 4.71137C12.9038 4.4537 12.8176 4.23862 12.6453 4.06612C12.4728 3.89378 12.2577 3.80762 12 3.80762C11.7423 3.80762 11.5273 3.89378 11.3548 4.06612C11.1824 4.23862 11.0963 4.4537 11.0963 4.71137C11.0963 4.96903 11.1824 5.18412 11.3548 5.35662C11.5273 5.52912 11.7423 5.61537 12 5.61537Z",fill:"currentColor",fillOpacity:.48})})]})}function Da(e){return s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[s.jsx("path",{d:"M4 12C4 7.58172 7.58172 4 12 4C15.0736 4 17.7555 5.6841 19.2291 8.16667M20 12C20 16.4183 16.4183 20 12 20C8.92638 20 6.24452 18.3159 4.77091 15.8333",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),s.jsx("path",{d:"M19 4V8H15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),s.jsx("path",{d:"M5 20V16H9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Fa(e){return s.jsxs("svg",{viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[s.jsx("circle",{cx:"32",cy:"32",r:"28",className:"fill-[var(--optimex-error)]/10 stroke-[var(--optimex-error)]",strokeWidth:"2"}),s.jsx("path",{d:"M20 22L26 28M26 22L20 28",className:"stroke-[var(--optimex-error)]",strokeWidth:"2.5",strokeLinecap:"round"}),s.jsx("path",{d:"M38 22L44 28M44 22L38 28",className:"stroke-[var(--optimex-error)]",strokeWidth:"2.5",strokeLinecap:"round"}),s.jsx("path",{d:"M22 44C26 38 38 38 42 44",className:"stroke-[var(--optimex-error)]",strokeWidth:"2.5",strokeLinecap:"round"})]})}function $a({className:e="h-5 w-5"}){return s.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})}function Ba({className:e="h-5 w-5"}){return s.jsxs("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}function $n(e){return s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[s.jsx("path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1"}),s.jsx("path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4"})]})}function qr({className:e="h-5 w-5"}){return s.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}function Bn(e){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 21",width:"20",height:"20",...e,children:s.jsx("path",{fill:"currentColor",d:"m11.299 2.846-.553 2.231q.557.126 1.103.263l.549-2.219 1.375.346-.563 2.277c1.737.603 3.008 1.506 2.759 3.188-.18 1.23-.858 1.827-1.757 2.036 1.234.647 1.862 1.641 1.264 3.362-.743 2.137-2.507 2.318-4.854 1.87l-.57 2.3-1.376-.345.562-2.269a53 53 0 0 1-1.096-.287l-.565 2.28-1.374-.346.57-2.304c-.322-.082-.65-.17-.982-.254L4 14.525l.684-1.587c.009.002 1.013.272 1 .251.389.098.562-.158.63-.33l.9-3.633.145.036a1 1 0 0 0-.142-.047l.64-2.593c.018-.295-.082-.667-.64-.807.02-.014-1-.25-1-.25l.367-1.48 1.898.476-.002.008q.43.106.88.207L9.922 2.5zM8.588 13.93c.933.233 3.81 1.164 4.236-.557.444-1.795-2.547-2.26-3.48-2.495zM9.69 9.483c.778.195 3.172.99 3.56-.575.404-1.634-2.098-1.998-2.875-2.193z"})})}function zn(e){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 14 12",width:"20",height:"20",...e,children:s.jsx("path",{fill:"currentColor",fillOpacity:.48,d:"M2.463 8.78a.44.44 0 0 1 .311-.129H13.5a.22.22 0 0 1 .156.376l-2.119 2.124a.44.44 0 0 1-.311.129H.5a.22.22 0 0 1-.156-.377zm0-7.932A.45.45 0 0 1 2.774.72H13.5a.221.221 0 0 1 .156.376L11.536 3.22a.44.44 0 0 1-.311.13H.5a.22.22 0 0 1-.156-.377zm9.074 3.941a.44.44 0 0 0-.311-.13H.5a.22.22 0 0 0-.156.377l2.12 2.124a.44.44 0 0 0 .31.129H13.5a.221.221 0 0 0 .156-.376z"})})}function Wn(e){return s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 14 22",width:"20",height:"20",...e,children:[s.jsx("path",{fill:"currentColor",d:"M6.998 0 .5 11.204l6.498-3.069zM6.998 8.136.5 11.205l6.498 3.992z"}),s.jsx("path",{fill:"currentColor",d:"M13.496 11.204 6.997 0v8.135z"}),s.jsx("path",{fill:"currentColor",d:"m6.997 15.197 6.499-3.992-6.499-3.07zM.5 12.484 6.998 22v-5.526z"}),s.jsx("path",{fill:"currentColor",d:"M6.997 16.474V22l6.502-9.516z"})]})}function Vn(e){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 25",width:"20",height:"20",...e,children:s.jsx("path",{fill:"currentColor",fillOpacity:.48,d:"M11.984 21.5c4.98 0 9.016-4.03 9.016-9s-4.036-9-9.016-9C7.26 3.5 3.385 7.127 3 11.743h11.917v1.514H3c.385 4.616 4.26 8.243 8.984 8.243"})})}function Hn(e){return s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 25",width:"20",height:"20",...e,children:[s.jsxs("g",{fill:"currentColor",fillOpacity:.48,clipPath:"url(#arb_a)",children:[s.jsx("path",{d:"m12.089 14.49 2.278 3.68 2.105-1.255-2.992-4.852zM18.389 15.439l-.002-1.006-3.27-5.24-1.213 2.119 3.157 5.251 1.14-.68a.53.53 0 0 0 .188-.379zM4.688 16.387l1.611.956 5.363-8.85-.91-.024c-.776-.011-1.611.196-1.994.84l-3.046 4.857-1.024 1.62zM14.758 8.494l-2.4.009-5.426 9.214 1.897 1.123.515-.9z"}),s.jsx("path",{d:"M19.4 8.481a1.58 1.58 0 0 0-.718-1.264L12.72 3.69a1.51 1.51 0 0 0-1.368 0c-.05.026-5.8 3.456-5.8 3.456a1.572 1.572 0 0 0-.863 1.333v7.307l1.024-1.62-.009-5.638.007-.06a.52.52 0 0 1 .204-.332c.027-.02 5.875-3.502 5.893-3.512a.5.5 0 0 1 .45-.002l5.887 3.484c.139.091.226.246.234.415v6.984a.52.52 0 0 1-.176.38l-1.141.68-.589.35-2.105 1.256-2.134 1.272a.5.5 0 0 1-.364-.007L9.345 17.94l-.516.9 2.27 1.344.36.207c.161.08.393.127.602.127q.29 0 .556-.108l6.2-3.693c.355-.284.565-.712.584-1.175z"})]}),s.jsx("defs",{children:s.jsx("clipPath",{id:"arb_a",children:s.jsx("path",{fill:"currentColor",d:"M4 3h16v18H4z"})})})]})}function Un(e){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 25",width:"20",height:"20",...e,children:s.jsx("path",{fill:"currentColor",fillOpacity:.48,d:"M7.245 16.646q-1.431 0-2.343-.672C4.301 15.52 4 14.867 4 14.03c0-.18.02-.39.058-.647q.154-.862.441-2.08Q5.317 8 8.717 8c.614 0 1.171.102 1.657.314q.73.298 1.152.915.423.604.423 1.44 0 .249-.058.633a26 26 0 0 1-.435 2.08c-.282 1.095-.762 1.92-1.453 2.464-.685.538-1.606.8-2.758.8m.173-1.728c.448 0 .825-.134 1.139-.396q.481-.393.685-1.216c.185-.756.326-1.408.422-1.972q.05-.25.051-.518.002-1.094-1.139-1.094-.672.001-1.152.396-.471.393-.672 1.216c-.147.538-.288 1.19-.435 1.972q-.05.238-.051.505c-.007.743.384 1.107 1.152 1.107M12.506 16.531c-.09 0-.154-.025-.205-.083-.038-.064-.051-.134-.038-.218l1.657-7.808a.32.32 0 0 1 .135-.217.35.35 0 0 1 .23-.083h3.194q1.333.001 2.137.55c.544.371.82.902.82 1.6 0 .198-.026.41-.071.627-.198.922-.602 1.6-1.216 2.042q-.902.66-2.477.659h-1.619l-.55 2.63a.34.34 0 0 1-.135.218.35.35 0 0 1-.23.083zm4.25-4.589c.339 0 .627-.09.876-.275q.383-.277.506-.793.038-.203.038-.359c0-.23-.07-.41-.205-.531-.134-.128-.37-.192-.697-.192h-1.44l-.455 2.15z"})})}function qn(e){return s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 25",width:"20",height:"20",...e,children:[s.jsx("path",{fill:"currentColor",fillOpacity:.48,d:"m4.913 12.5.011 3.868 3.286 1.935v2.264L3 17.511V11.37zm0-3.868v2.254L3 9.754V7.5l1.913-1.133L6.836 7.5zM9.582 7.5l1.913-1.133L13.418 7.5l-1.923 1.132z"}),s.jsx("path",{fill:"currentColor",fillOpacity:.48,d:"M6.297 15.567v-2.265l1.913 1.132v2.254zm3.285 3.547 1.914 1.132 1.923-1.132v2.254L11.496 22.5l-1.914-1.132zM16.163 7.5l1.913-1.133L20 7.5v2.254l-1.923 1.132V8.632zm1.913 8.868.011-3.868L20 11.368v6.142l-5.208 3.056v-2.265z"}),s.jsx("path",{fill:"currentColor",fillOpacity:.48,d:"m16.704 15.567-1.914 1.122v-2.254l1.913-1.133z"}),s.jsx("path",{fill:"currentColor",fillOpacity:.48,d:"m16.704 9.434.01 2.264-3.294 1.934v3.878l-1.913 1.122-1.914-1.122v-3.878l-3.295-1.934V9.434L8.22 8.3l3.275 1.944L14.79 8.3l1.922 1.133zM6.297 5.566 11.496 2.5l5.208 3.066L14.791 6.7l-3.295-1.944L8.21 6.7z"})]})}const Qr={bitcoin:Bn,solana:zn,ethereum:Wn,base:Vn,arbitrum:Hn,optimism:Un,bsc:qn};function za(e){if(!e)return null;const t=e.toLowerCase().replace(/[\s_-]/g,"");return t in Qr?Qr[t]:t.includes("bitcoin")||t.includes("btc")?Bn:t.includes("solana")||t.includes("sol")?zn:t.includes("ethereum")||t.includes("eth")||t.includes("erc20")?Wn:t.includes("base")?Vn:t.includes("arbitrum")||t.includes("arb")?Hn:t.includes("optimism")||t.includes("op")?Un:t.includes("bsc")||t.includes("binance")||t.includes("bnb")?qn:null}function Wa(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function Va({icon:e,label:t,address:r,className:n=""}){const[o,a]=p.useState(!1),l=p.useCallback(async()=>{try{await navigator.clipboard.writeText(r),a(!0),setTimeout(()=>a(!1),2e3)}catch{console.error("Failed to copy")}},[r]);return s.jsxs("div",{className:`flex items-center justify-between px-4 py-3 ${n}`,children:[s.jsxs("div",{className:"flex items-center gap-2 text-[var(--optimex-text-secondary)]",children:[s.jsx(e,{className:"size-4"}),s.jsx("span",{className:"text-sm",children:t})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm font-medium text-[var(--optimex-text)]",children:Wa(r)}),s.jsx("button",{onClick:l,className:"p-1 rounded hover:bg-[var(--optimex-surface-hover)] transition-colors",title:o?"Copied!":"Copy",children:o?s.jsx(gr,{className:"size-4 text-[var(--optimex-success)]"}):s.jsx(_a,{className:"size-4 text-[var(--optimex-text-secondary)]"})})]})]})}const Ha={primary:"bg-[var(--optimex-primary)] text-black hover:brightness-110 shadow-lg shadow-[var(--optimex-primary)]/30",secondary:"bg-[var(--optimex-surface)] text-[var(--optimex-text)] hover:bg-white/10 border border-white/10",ghost:"bg-transparent text-[var(--optimex-text-secondary)] hover:bg-white/10 hover:text-[var(--optimex-text)]",danger:"bg-[var(--optimex-error)] text-white hover:bg-[var(--optimex-error)]/90 hover:shadow-lg hover:shadow-[var(--optimex-error)]/25"},Ua={sm:"px-3 py-1.5 text-xs rounded-[var(--optimex-radius-button)] gap-1.5 max-h-[2rem]",md:"px-4 py-2 text-sm rounded-[var(--optimex-radius-button)] gap-2 max-h-[2.5rem]",lg:"px-6 py-3 text-sm rounded-[var(--optimex-radius-button)] gap-2 max-h-[3rem]"};function Qn({variant:e="primary",size:t="md",fullWidth:r=!1,isLoading:n=!1,leftIcon:o,rightIcon:a,children:l,className:i="",disabled:c,...u}){const d=c||n;return s.jsxs("button",{className:`
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode('.optx-widget .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.optx-widget .fixed{position:fixed}.optx-widget .absolute{position:absolute}.optx-widget .relative{position:relative}.optx-widget .inset-0{inset:0}.optx-widget .inset-2{inset:.5rem}.optx-widget .inset-x-0{left:0;right:0}.optx-widget .-bottom-1{bottom:-.25rem}.optx-widget .-bottom-2{bottom:-.5rem}.optx-widget .-right-1{right:-.25rem}.optx-widget .-top-2{top:-.5rem}.optx-widget .bottom-0{bottom:0}.optx-widget .bottom-full{bottom:100%}.optx-widget .left-0{left:0}.optx-widget .left-1\\/2{left:50%}.optx-widget .left-3{left:.75rem}.optx-widget .left-4{left:1rem}.optx-widget .right-0{right:0}.optx-widget .right-3{right:.75rem}.optx-widget .right-4{right:1rem}.optx-widget .top-1\\/2{top:50%}.optx-widget .top-full{top:100%}.optx-widget .z-10{z-index:10}.optx-widget .z-50{z-index:50}.optx-widget .\\!m-0{margin:0!important}.optx-widget .-my-4{margin-top:-1rem;margin-bottom:-1rem}.optx-widget .mx-auto{margin-left:auto;margin-right:auto}.optx-widget .mb-1{margin-bottom:.25rem}.optx-widget .mb-2{margin-bottom:.5rem}.optx-widget .mb-3{margin-bottom:.75rem}.optx-widget .mb-4{margin-bottom:1rem}.optx-widget .mb-6{margin-bottom:1.5rem}.optx-widget .ml-2{margin-left:.5rem}.optx-widget .ml-3{margin-left:.75rem}.optx-widget .ml-auto{margin-left:auto}.optx-widget .mt-1{margin-top:.25rem}.optx-widget .mt-2{margin-top:.5rem}.optx-widget .mt-24{margin-top:6rem}.optx-widget .mt-3{margin-top:.75rem}.optx-widget .mt-4{margin-top:1rem}.optx-widget .mt-auto{margin-top:auto}.optx-widget .block{display:block}.optx-widget .inline-block{display:inline-block}.optx-widget .inline{display:inline}.optx-widget .flex{display:flex}.optx-widget .size-10{width:2.5rem;height:2.5rem}.optx-widget .size-12{width:3rem;height:3rem}.optx-widget .size-2{width:.5rem;height:.5rem}.optx-widget .size-20{width:5rem;height:5rem}.optx-widget .size-3{width:.75rem;height:.75rem}.optx-widget .size-4{width:1rem;height:1rem}.optx-widget .size-5{width:1.25rem;height:1.25rem}.optx-widget .size-8{width:2rem;height:2rem}.optx-widget .h-1\\.5{height:.375rem}.optx-widget .h-10{height:2.5rem}.optx-widget .h-12{height:3rem}.optx-widget .h-14{height:3.5rem}.optx-widget .h-16{height:4rem}.optx-widget .h-2{height:.5rem}.optx-widget .h-3{height:.75rem}.optx-widget .h-3\\.5{height:.875rem}.optx-widget .h-4{height:1rem}.optx-widget .h-5{height:1.25rem}.optx-widget .h-6{height:1.5rem}.optx-widget .h-8{height:2rem}.optx-widget .h-auto{height:auto}.optx-widget .h-full{height:100%}.optx-widget .max-h-\\[2\\.5rem\\]{max-height:2.5rem}.optx-widget .max-h-\\[2rem\\]{max-height:2rem}.optx-widget .max-h-\\[3rem\\]{max-height:3rem}.optx-widget .max-h-\\[5rem\\]{max-height:5rem}.optx-widget .max-h-\\[60vh\\]{max-height:60vh}.optx-widget .max-h-\\[96vh\\]{max-height:96vh}.optx-widget .min-h-0{min-height:0px}.optx-widget .w-1\\/3{width:33.333333%}.optx-widget .w-10{width:2.5rem}.optx-widget .w-12{width:3rem}.optx-widget .w-14{width:3.5rem}.optx-widget .w-16{width:4rem}.optx-widget .w-20{width:5rem}.optx-widget .w-24{width:6rem}.optx-widget .w-28{width:7rem}.optx-widget .w-3{width:.75rem}.optx-widget .w-3\\.5{width:.875rem}.optx-widget .w-32{width:8rem}.optx-widget .w-4{width:1rem}.optx-widget .w-48{width:12rem}.optx-widget .w-5{width:1.25rem}.optx-widget .w-6{width:1.5rem}.optx-widget .w-72{width:18rem}.optx-widget .w-8{width:2rem}.optx-widget .w-96{width:24rem}.optx-widget .w-\\[32rem\\]{width:32rem}.optx-widget .w-auto{width:auto}.optx-widget .w-full{width:100%}.optx-widget .min-w-0{min-width:0px}.optx-widget .min-w-\\[140px\\]{min-width:140px}.optx-widget .max-w-\\[280px\\]{max-width:280px}.optx-widget .flex-1{flex:1 1 0%}.optx-widget .flex-shrink-0,.optx-widget .shrink-0{flex-shrink:0}.optx-widget .-translate-x-1\\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.optx-widget .-translate-y-1\\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.optx-widget .rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.optx-widget .rotate-45{--tw-rotate: 45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.optx-widget .transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.optx-widget .animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.optx-widget .animate-spin{animation:spin 1s linear infinite}.optx-widget .cursor-not-allowed{cursor:not-allowed}.optx-widget .cursor-pointer{cursor:pointer}.optx-widget .resize{resize:both}.optx-widget .flex-col{flex-direction:column}.optx-widget .flex-wrap{flex-wrap:wrap}.optx-widget .items-end{align-items:flex-end}.optx-widget .items-center{align-items:center}.optx-widget .justify-end{justify-content:flex-end}.optx-widget .justify-center{justify-content:center}.optx-widget .justify-between{justify-content:space-between}.optx-widget .gap-0\\.5{gap:.125rem}.optx-widget .gap-1{gap:.25rem}.optx-widget .gap-1\\.5{gap:.375rem}.optx-widget .gap-2{gap:.5rem}.optx-widget .gap-3{gap:.75rem}.optx-widget .gap-4{gap:1rem}.optx-widget :is(.space-y-1>:not([hidden])~:not([hidden])){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.optx-widget :is(.space-y-2>:not([hidden])~:not([hidden])){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.optx-widget :is(.space-y-3>:not([hidden])~:not([hidden])){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.optx-widget :is(.divide-y>:not([hidden])~:not([hidden])){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.optx-widget :is(.divide-white\\/10>:not([hidden])~:not([hidden])){border-color:#ffffff1a}.optx-widget .overflow-auto{overflow:auto}.optx-widget .overflow-hidden{overflow:hidden}.optx-widget .overflow-y-auto{overflow-y:auto}.optx-widget .truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.optx-widget .break-all{word-break:break-all}.optx-widget .rounded{border-radius:.25rem}.optx-widget .rounded-2xl{border-radius:1rem}.optx-widget .rounded-\\[0\\.25rem\\]{border-radius:.25rem}.optx-widget .rounded-\\[9999px\\]{border-radius:9999px}.optx-widget .rounded-\\[var\\(--optimex-overlay-radius\\)\\]{border-radius:var(--optimex-overlay-radius)}.optx-widget .rounded-\\[var\\(--optimex-radius-button\\)\\]{border-radius:var(--optimex-radius-button)}.optx-widget .rounded-\\[var\\(--optimex-radius-input\\)\\]{border-radius:var(--optimex-radius-input)}.optx-widget .rounded-\\[var\\(--optimex-radius-widget\\)\\]{border-radius:var(--optimex-radius-widget)}.optx-widget .rounded-full{border-radius:9999px}.optx-widget .rounded-lg{border-radius:.5rem}.optx-widget .rounded-md{border-radius:.375rem}.optx-widget .rounded-xl{border-radius:.75rem}.optx-widget .rounded-t-sm{border-top-left-radius:.125rem;border-top-right-radius:.125rem}.optx-widget .border{border-width:1px}.optx-widget .border-2{border-width:2px}.optx-widget .border-4{border-width:4px}.optx-widget .border-b{border-bottom-width:1px}.optx-widget .border-l{border-left-width:1px}.optx-widget .border-r{border-right-width:1px}.optx-widget .border-t{border-top-width:1px}.optx-widget .border-none{border-style:none}.optx-widget .border-\\[var\\(--optimex-background\\)\\]{border-color:var(--optimex-background)}.optx-widget .border-\\[var\\(--optimex-error\\)\\]{border-color:var(--optimex-error)}.optx-widget .border-\\[var\\(--optimex-primary\\)\\]{border-color:var(--optimex-primary)}.optx-widget .border-\\[var\\(--optimex-surface\\)\\]{border-color:var(--optimex-surface)}.optx-widget .border-current{border-color:currentColor}.optx-widget .border-transparent{border-color:transparent}.optx-widget .border-white\\/10{border-color:#ffffff1a}.optx-widget .border-white\\/5{border-color:#ffffff0d}.optx-widget .border-white\\/\\[0\\.02\\]{border-color:#ffffff05}.optx-widget .border-white\\/\\[0\\.05\\]{border-color:#ffffff0d}.optx-widget .border-t-transparent{border-top-color:transparent}.optx-widget .bg-\\[rgba\\(239\\,68\\,68\\,0\\.15\\)\\]{background-color:#ef444426}.optx-widget .bg-\\[rgba\\(34\\,197\\,94\\,0\\.15\\)\\]{background-color:#22c55e26}.optx-widget .bg-\\[rgba\\(59\\,130\\,246\\,0\\.15\\)\\]{background-color:#3b82f626}.optx-widget .bg-\\[var\\(--optimex-background\\)\\]{background-color:var(--optimex-background)}.optx-widget .bg-\\[var\\(--optimex-border\\)\\]{background-color:var(--optimex-border)}.optx-widget .bg-\\[var\\(--optimex-error\\)\\]{background-color:var(--optimex-error)}.optx-widget .bg-\\[var\\(--optimex-overlay-background\\)\\]{background-color:var(--optimex-overlay-background)}.optx-widget .bg-\\[var\\(--optimex-primary\\)\\]{background-color:var(--optimex-primary)}.optx-widget .bg-\\[var\\(--optimex-surface\\)\\]{background-color:var(--optimex-surface)}.optx-widget .bg-\\[var\\(--optimex-surface-hover\\)\\]{background-color:var(--optimex-surface-hover)}.optx-widget .bg-black\\/60{background-color:#0009}.optx-widget .bg-blue-500\\/20{background-color:#3b82f633}.optx-widget .bg-green-500\\/10{background-color:#22c55e1a}.optx-widget .bg-orange-500\\/20{background-color:#f9731633}.optx-widget .bg-purple-500\\/20{background-color:#a855f733}.optx-widget .bg-red-500\\/10{background-color:#ef44441a}.optx-widget .bg-transparent{background-color:transparent}.optx-widget .bg-white\\/10{background-color:#ffffff1a}.optx-widget .bg-white\\/20{background-color:#fff3}.optx-widget .bg-white\\/5{background-color:#ffffff0d}.optx-widget .bg-white\\/\\[0\\.02\\]{background-color:#ffffff05}.optx-widget .bg-yellow-500\\/10{background-color:#eab3081a}.optx-widget .stroke-\\[var\\(--optimex-error\\)\\]{stroke:var(--optimex-error)}.optx-widget .p-0{padding:0}.optx-widget .p-1{padding:.25rem}.optx-widget .p-1\\.5{padding:.375rem}.optx-widget .p-2{padding:.5rem}.optx-widget .p-3{padding:.75rem}.optx-widget .p-4{padding:1rem}.optx-widget .p-6{padding:1.5rem}.optx-widget .px-1\\.5{padding-left:.375rem;padding-right:.375rem}.optx-widget .px-2{padding-left:.5rem;padding-right:.5rem}.optx-widget .px-2\\.5{padding-left:.625rem;padding-right:.625rem}.optx-widget .px-3{padding-left:.75rem;padding-right:.75rem}.optx-widget .px-4{padding-left:1rem;padding-right:1rem}.optx-widget .px-6{padding-left:1.5rem;padding-right:1.5rem}.optx-widget .py-0\\.5{padding-top:.125rem;padding-bottom:.125rem}.optx-widget .py-1{padding-top:.25rem;padding-bottom:.25rem}.optx-widget .py-1\\.5{padding-top:.375rem;padding-bottom:.375rem}.optx-widget .py-12{padding-top:3rem;padding-bottom:3rem}.optx-widget .py-2{padding-top:.5rem;padding-bottom:.5rem}.optx-widget .py-3{padding-top:.75rem;padding-bottom:.75rem}.optx-widget .py-4{padding-top:1rem;padding-bottom:1rem}.optx-widget .py-8{padding-top:2rem;padding-bottom:2rem}.optx-widget .py-\\[6px\\]{padding-top:6px;padding-bottom:6px}.optx-widget .pb-3{padding-bottom:.75rem}.optx-widget .pb-4{padding-bottom:1rem}.optx-widget .pl-10{padding-left:2.5rem}.optx-widget .pr-10{padding-right:2.5rem}.optx-widget .pr-3{padding-right:.75rem}.optx-widget .pt-2{padding-top:.5rem}.optx-widget .pt-3{padding-top:.75rem}.optx-widget .text-left{text-align:left}.optx-widget .text-center{text-align:center}.optx-widget .text-2xl{font-size:1.5rem;line-height:2rem}.optx-widget .text-\\[10px\\]{font-size:10px}.optx-widget .text-base{font-size:1rem;line-height:1.5rem}.optx-widget .text-lg{font-size:1.125rem;line-height:1.75rem}.optx-widget .text-sm{font-size:.875rem;line-height:1.25rem}.optx-widget .text-xl{font-size:1.25rem;line-height:1.75rem}.optx-widget .text-xs{font-size:.75rem;line-height:1rem}.optx-widget .font-bold{font-weight:700}.optx-widget .font-medium{font-weight:500}.optx-widget .font-semibold{font-weight:600}.optx-widget .uppercase{text-transform:uppercase}.optx-widget .lowercase{text-transform:lowercase}.optx-widget .leading-none{line-height:1}.optx-widget .tracking-tight{letter-spacing:-.025em}.optx-widget .tracking-wider{letter-spacing:.05em}.optx-widget .text-\\[var\\(--optimex-error\\)\\]{color:var(--optimex-error)}.optx-widget .text-\\[var\\(--optimex-primary\\)\\]{color:var(--optimex-primary)}.optx-widget .text-\\[var\\(--optimex-success\\)\\]{color:var(--optimex-success)}.optx-widget .text-\\[var\\(--optimex-text\\)\\]{color:var(--optimex-text)}.optx-widget .text-\\[var\\(--optimex-text-secondary\\)\\]{color:var(--optimex-text-secondary)}.optx-widget .text-\\[var\\(--optimex-warning\\)\\]{color:var(--optimex-warning)}.optx-widget .text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.optx-widget .text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.optx-widget .text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.optx-widget .text-orange-400{--tw-text-opacity: 1;color:rgb(251 146 60 / var(--tw-text-opacity, 1))}.optx-widget .text-purple-400{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.optx-widget .text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.optx-widget .text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.optx-widget .text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.optx-widget .opacity-0{opacity:0}.optx-widget .opacity-50{opacity:.5}.optx-widget .opacity-70{opacity:.7}.optx-widget .shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.optx-widget .shadow-\\[0_0_15px_rgba\\(235\\,98\\,0\\,0\\.1\\)\\]{--tw-shadow: 0 0 15px rgba(235,98,0,.1);--tw-shadow-colored: 0 0 15px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.optx-widget .shadow-\\[0_0_15px_rgba\\(235\\,98\\,0\\,0\\.3\\)\\]{--tw-shadow: 0 0 15px rgba(235,98,0,.3);--tw-shadow-colored: 0 0 15px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.optx-widget .shadow-\\[0_0_8px_rgba\\(235\\,98\\,0\\,0\\.8\\)\\]{--tw-shadow: 0 0 8px rgba(235,98,0,.8);--tw-shadow-colored: 0 0 8px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.optx-widget .shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.optx-widget .shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.optx-widget .shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.optx-widget .outline-none{outline:2px solid transparent;outline-offset:2px}.optx-widget .blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.optx-widget .filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.optx-widget .backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.optx-widget .transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.optx-widget .transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.optx-widget .transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.optx-widget .transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.optx-widget .duration-200{transition-duration:.2s}.optx-widget .duration-300{transition-duration:.3s}.optx-widget{--optimex-primary: #ed6300;--optimex-background: hsla(0, 0%, 100%, .04);--optimex-surface: hsla(0, 0%, 0%, .2);--optimex-text: #ffffff;--optimex-text-secondary: hsla(0, 0%, 100%, .48);--optimex-error: #ff4d4f;--optimex-success: #52c41a;--optimex-overlay-background: #343b47;--optimex-overlay-radius: .75rem;--optimex-radius-widget: 1rem;--optimex-radius-input: .75rem;--optimex-radius-button: .5rem;--optimex-font-family: "Inter", sans-serif;isolation:isolate;width:100%;min-width:0;max-width:100%;--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: ;font-family:var(--optimex-font-family);font-size:14px;line-height:1.5;color:var(--optimex-text);text-align:left;-webkit-text-size-adjust:100%;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.optx-widget .widget-container{background:var(--optimex-background);border:1px solid rgba(255,255,255,.05);border-radius:var(--optimex-radius-widget);-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px);width:100%;min-width:0;max-width:100%;box-sizing:border-box}.optx-widget *,.optx-widget *:before,.optx-widget *:after{box-sizing:border-box}.optx-widget button{font-family:inherit;line-height:inherit;margin:0;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none}.optx-widget input,.optx-widget select,.optx-widget textarea{font-family:inherit;line-height:inherit;margin:0}.optx-widget a{color:inherit;text-decoration:none}.optx-widget ul,.optx-widget ol{list-style:none;margin:0;padding:0}.optx-widget img{max-width:100%;height:auto}.optx-widget svg{display:inline-block;vertical-align:middle}.optx-widget .glow-orange{box-shadow:inset 0 0 15px #eb620026,0 0 20px #eb62001a}.optx-widget .glow-green{box-shadow:0 0 12px #22c55e33}.optx-widget .glow-red{box-shadow:0 0 12px #ef444433}@keyframes optx-status-pulse{0%,to{opacity:1}50%{opacity:.5}}.optx-widget .status-pulse{animation:optx-status-pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes modal-overlay-in{0%{opacity:0}to{opacity:1}}@keyframes modal-overlay-out{0%{opacity:1}to{opacity:0}}@keyframes modal-content-in{0%{opacity:0;transform:translate(-50%,-46%)}to{opacity:1;transform:translate(-50%,-50%)}}@keyframes modal-content-out{0%{opacity:1;transform:translate(-50%,-50%)}to{opacity:0;transform:translate(-50%,-46%)}}.animate-modal-overlay-in{animation:modal-overlay-in .25s cubic-bezier(.16,1,.3,1)}.animate-modal-overlay-out{animation:modal-overlay-out .2s cubic-bezier(.16,1,.3,1)}.animate-modal-in{animation:modal-content-in .3s cubic-bezier(.16,1,.3,1)}.animate-modal-out{animation:modal-content-out .2s cubic-bezier(.16,1,.3,1)}@keyframes optx-shiny-text{0%{background-position:-200% center}to{background-position:200% center}}.optx-widget .shiny-text{background:linear-gradient(90deg,var(--optimex-text-secondary) 0%,var(--optimex-text-secondary) 40%,var(--optimex-text) 50%,var(--optimex-text-secondary) 60%,var(--optimex-text-secondary) 100%);background-size:200% auto;background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent;animation:optx-shiny-text 2s linear infinite}.optx-widget .collapsible-grid{display:grid;transition:grid-template-rows .2s ease-out}.optx-widget .collapsible-grid[data-state=closed]{grid-template-rows:0fr}.optx-widget .collapsible-grid[data-state=open]{grid-template-rows:1fr}.optx-widget .collapsible-content{overflow:hidden}.optx-widget .placeholder\\:text-\\[var\\(--optimex-text-secondary\\)\\]::-moz-placeholder{color:var(--optimex-text-secondary)}.optx-widget .placeholder\\:text-\\[var\\(--optimex-text-secondary\\)\\]::placeholder{color:var(--optimex-text-secondary)}.optx-widget .focus-within\\:border-\\[var\\(--optimex-primary\\)\\]:focus-within{border-color:var(--optimex-primary)}.optx-widget .hover\\:scale-110:hover{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.optx-widget .hover\\:border-\\[var\\(--optimex-primary\\)\\]:hover{border-color:var(--optimex-primary)}.optx-widget .hover\\:bg-\\[rgba\\(239\\,68\\,68\\,0\\.2\\)\\]:hover{background-color:#ef444433}.optx-widget .hover\\:bg-\\[var\\(--optimex-primary-hover\\)\\]:hover{background-color:var(--optimex-primary-hover)}.optx-widget .hover\\:bg-\\[var\\(--optimex-surface-hover\\)\\]:hover{background-color:var(--optimex-surface-hover)}.optx-widget .hover\\:bg-white\\/10:hover{background-color:#ffffff1a}.optx-widget .hover\\:bg-white\\/5:hover{background-color:#ffffff0d}.optx-widget .hover\\:bg-white\\/\\[0\\.02\\]:hover{background-color:#ffffff05}.optx-widget .hover\\:text-\\[var\\(--optimex-primary\\)\\]:hover{color:var(--optimex-primary)}.optx-widget .hover\\:text-\\[var\\(--optimex-text\\)\\]:hover{color:var(--optimex-text)}.optx-widget .hover\\:text-\\[var\\(--optimex-text-secondary\\)\\]:hover{color:var(--optimex-text-secondary)}.optx-widget .hover\\:opacity-100:hover{opacity:1}.optx-widget .hover\\:opacity-70:hover{opacity:.7}.optx-widget .hover\\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.optx-widget .hover\\:brightness-110:hover{--tw-brightness: brightness(1.1);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.optx-widget .focus\\:border-\\[var\\(--optimex-primary\\)\\]:focus{border-color:var(--optimex-primary)}.optx-widget .focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.optx-widget .focus\\:ring-0:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.optx-widget .active\\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.optx-widget .active\\:scale-\\[0\\.98\\]:active{--tw-scale-x: .98;--tw-scale-y: .98;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.optx-widget .disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.optx-widget :is(.group:hover .group-hover\\:rotate-180){--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.optx-widget :is(.group:hover .group-hover\\:opacity-100){opacity:1}@media(min-width:640px){.optx-widget .sm\\:text-left{text-align:left}}')),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),x=require("react"),ss=require("react-dom");function os(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const g=os(x),Zo=os(ss);var At=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Ye=typeof window>"u"||"Deno"in globalThis;function Ne(){}function Xo(e,t){return typeof e=="function"?e(t):e}function Hr(e){return typeof e=="number"&&e>=0&&e!==1/0}function as(e,t){return Math.max(e+(t||0)-Date.now(),0)}function vt(e,t){return typeof e=="function"?e(t):e}function Re(e,t){return typeof e=="function"?e(t):e}function bn(e,t){const{type:r="all",exact:n,fetchStatus:s,predicate:a,queryKey:c,stale:i}=e;if(c){if(n){if(t.queryHash!==nn(c,t.options))return!1}else if(!Rt(t.queryKey,c))return!1}if(r!=="all"){const u=t.isActive();if(r==="active"&&!u||r==="inactive"&&u)return!1}return!(typeof i=="boolean"&&t.isStale()!==i||s&&s!==t.state.fetchStatus||a&&!a(t))}function yn(e,t){const{exact:r,status:n,predicate:s,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(r){if(Tt(t.options.mutationKey)!==Tt(a))return!1}else if(!Rt(t.options.mutationKey,a))return!1}return!(n&&t.state.status!==n||s&&!s(t))}function nn(e,t){return(t?.queryKeyHashFn||Tt)(e)}function Tt(e){return JSON.stringify(e,(t,r)=>qr(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function Rt(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(r=>!Rt(e[r],t[r])):!1}function Vr(e,t){if(e===t)return e;const r=wn(e)&&wn(t);if(r||qr(e)&&qr(t)){const n=r?e:Object.keys(e),s=n.length,a=r?t:Object.keys(t),c=a.length,i=r?[]:{};let u=0;for(let d=0;d<c;d++){const f=r?d:a[d];(!r&&n.includes(f)||r)&&e[f]===void 0&&t[f]===void 0?(i[f]=void 0,u++):(i[f]=Vr(e[f],t[f]),i[f]===e[f]&&e[f]!==void 0&&u++)}return s===c&&u===s?e:i}return t}function Ur(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function wn(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function qr(e){if(!Cn(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!Cn(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Cn(e){return Object.prototype.toString.call(e)==="[object Object]"}function Jo(e){return new Promise(t=>{setTimeout(t,e)})}function Qr(e,t,r){if(typeof r.structuralSharing=="function")return r.structuralSharing(e,t);if(r.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return Vr(e,t)}catch(n){console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${n}`)}return Vr(e,t)}return t}function ea(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function ta(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var mr=Symbol();function is(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===mr&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===mr?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var ra=class extends At{#t;#e;#n;constructor(){super(),this.#n=e=>{if(!Ye&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#e||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(e){this.#n=e,this.#e?.(),this.#e=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#t!==e&&(this.#t=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#t=="boolean"?this.#t:globalThis.document?.visibilityState!=="hidden"}},sn=new ra,na=class extends At{#t=!0;#e;#n;constructor(){super(),this.#n=e=>{if(!Ye&&window.addEventListener){const t=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}}}onSubscribe(){this.#e||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(e){this.#n=e,this.#e?.(),this.#e=e(this.setOnline.bind(this))}setOnline(e){this.#t!==e&&(this.#t=e,this.listeners.forEach(r=>{r(e)}))}isOnline(){return this.#t}},pr=new na;function Kr(){let e,t;const r=new Promise((s,a)=>{e=s,t=a});r.status="pending",r.catch(()=>{});function n(s){Object.assign(r,s),delete r.resolve,delete r.reject}return r.resolve=s=>{n({status:"fulfilled",value:s}),e(s)},r.reject=s=>{n({status:"rejected",reason:s}),t(s)},r}function sa(e){return Math.min(1e3*2**e,3e4)}function ls(e){return(e??"online")==="online"?pr.isOnline():!0}var cs=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function kr(e){return e instanceof cs}function us(e){let t=!1,r=0,n=!1,s;const a=Kr(),c=m=>{n||(p(new cs(m)),e.abort?.())},i=()=>{t=!0},u=()=>{t=!1},d=()=>sn.isFocused()&&(e.networkMode==="always"||pr.isOnline())&&e.canRun(),f=()=>ls(e.networkMode)&&e.canRun(),h=m=>{n||(n=!0,e.onSuccess?.(m),s?.(),a.resolve(m))},p=m=>{n||(n=!0,e.onError?.(m),s?.(),a.reject(m))},y=()=>new Promise(m=>{s=w=>{(n||d())&&m(w)},e.onPause?.()}).then(()=>{s=void 0,n||e.onContinue?.()}),v=()=>{if(n)return;let m;const w=r===0?e.initialPromise:void 0;try{m=w??e.fn()}catch(b){m=Promise.reject(b)}Promise.resolve(m).then(h).catch(b=>{if(n)return;const R=e.retry??(Ye?0:3),T=e.retryDelay??sa,k=typeof T=="function"?T(r,b):T,A=R===!0||typeof R=="number"&&r<R||typeof R=="function"&&R(r,b);if(t||!A){p(b);return}r++,e.onFail?.(r,b),Jo(k).then(()=>d()?void 0:y()).then(()=>{t?p(b):v()})})};return{promise:a,cancel:c,continue:()=>(s?.(),a),cancelRetry:i,continueRetry:u,canStart:f,start:()=>(f()?v():y().then(v),a)}}function oa(){let e=[],t=0,r=i=>{i()},n=i=>{i()},s=i=>setTimeout(i,0);const a=i=>{t?e.push(i):s(()=>{r(i)})},c=()=>{const i=e;e=[],i.length&&s(()=>{n(()=>{i.forEach(u=>{r(u)})})})};return{batch:i=>{let u;t++;try{u=i()}finally{t--,t||c()}return u},batchCalls:i=>(...u)=>{a(()=>{i(...u)})},schedule:a,setNotifyFunction:i=>{r=i},setBatchNotifyFunction:i=>{n=i},setScheduler:i=>{s=i}}}var pe=oa(),ds=class{#t;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Hr(this.gcTime)&&(this.#t=setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ye?1/0:300*1e3))}clearGcTimeout(){this.#t&&(clearTimeout(this.#t),this.#t=void 0)}},aa=class extends ds{#t;#e;#n;#r;#a;#o;constructor(e){super(),this.#o=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#n=e.cache,this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=ia(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#r?.promise}setOptions(e){this.options={...this.#a,...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#n.remove(this)}setData(e,t){const r=Qr(this.state.data,e,this.options);return this.#s({data:r,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),r}setState(e,t){this.#s({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#r?.promise;return this.#r?.cancel(e),t?t.then(Ne).catch(Ne):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#t)}isActive(){return this.observers.some(e=>Re(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===mr||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(e=0){return this.state.isInvalidated||this.state.data===void 0||!as(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#r?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#r?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#r&&(this.#o?this.#r.cancel({revert:!0}):this.#r.cancelRetry()),this.scheduleGc()),this.#n.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#s({type:"invalidate"})}fetch(e,t){if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#r)return this.#r.continueRetry(),this.#r.promise}if(e&&this.setOptions(e),!this.options.queryFn){const i=this.observers.find(u=>u.options.queryFn);i&&this.setOptions(i.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const r=new AbortController,n=i=>{Object.defineProperty(i,"signal",{enumerable:!0,get:()=>(this.#o=!0,r.signal)})},s=()=>{const i=is(this.options,t),u={queryKey:this.queryKey,meta:this.meta};return n(u),this.#o=!1,this.options.persister?this.options.persister(i,u,this):i(u)},a={fetchOptions:t,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:s};n(a),this.options.behavior?.onFetch(a,this),this.#e=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#s({type:"fetch",meta:a.fetchOptions?.meta});const c=i=>{kr(i)&&i.silent||this.#s({type:"error",error:i}),kr(i)||(this.#n.config.onError?.(i,this),this.#n.config.onSettled?.(this.state.data,i,this)),this.scheduleGc()};return this.#r=us({initialPromise:t?.initialPromise,fn:a.fetchFn,abort:r.abort.bind(r),onSuccess:i=>{if(i===void 0){process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),c(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(i)}catch(u){c(u);return}this.#n.config.onSuccess?.(i,this),this.#n.config.onSettled?.(i,this.state.error,this),this.scheduleGc()},onError:c,onFail:(i,u)=>{this.#s({type:"failed",failureCount:i,error:u})},onPause:()=>{this.#s({type:"pause"})},onContinue:()=>{this.#s({type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}),this.#r.start()}#s(e){const t=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...fs(r.data,this.options),fetchMeta:e.meta??null};case"success":return{...r,data:e.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const n=e.error;return kr(n)&&n.revert&&this.#e?{...this.#e,fetchStatus:"idle"}:{...r,error:n,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=t(this.state),pe.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),this.#n.notify({query:this,type:"updated",action:e})})}};function fs(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ls(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function ia(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,n=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var la=class extends At{constructor(e={}){super(),this.config=e,this.#t=new Map}#t;build(e,t,r){const n=t.queryKey,s=t.queryHash??nn(n,t);let a=this.get(s);return a||(a=new aa({cache:this,queryKey:n,queryHash:s,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(n)}),this.add(a)),a}add(e){this.#t.has(e.queryHash)||(this.#t.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#t.get(e.queryHash);t&&(e.destroy(),t===e&&this.#t.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){pe.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#t.get(e)}getAll(){return[...this.#t.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(r=>bn(t,r))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(r=>bn(e,r)):t}notify(e){pe.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){pe.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){pe.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},ca=class extends ds{#t;#e;#n;constructor(e){super(),this.mutationId=e.mutationId,this.#e=e.mutationCache,this.#t=[],this.state=e.state||ua(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#e.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#e.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#e.remove(this))}continue(){return this.#n?.continue()??this.execute(this.state.variables)}async execute(e){this.#n=us({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(n,s)=>{this.#r({type:"failed",failureCount:n,error:s})},onPause:()=>{this.#r({type:"pause"})},onContinue:()=>{this.#r({type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#e.canRun(this)});const t=this.state.status==="pending",r=!this.#n.canStart();try{if(!t){this.#r({type:"pending",variables:e,isPaused:r}),await this.#e.config.onMutate?.(e,this);const s=await this.options.onMutate?.(e);s!==this.state.context&&this.#r({type:"pending",context:s,variables:e,isPaused:r})}const n=await this.#n.start();return await this.#e.config.onSuccess?.(n,e,this.state.context,this),await this.options.onSuccess?.(n,e,this.state.context),await this.#e.config.onSettled?.(n,null,this.state.variables,this.state.context,this),await this.options.onSettled?.(n,null,e,this.state.context),this.#r({type:"success",data:n}),n}catch(n){try{throw await this.#e.config.onError?.(n,e,this.state.context,this),await this.options.onError?.(n,e,this.state.context),await this.#e.config.onSettled?.(void 0,n,this.state.variables,this.state.context,this),await this.options.onSettled?.(void 0,n,e,this.state.context),n}finally{this.#r({type:"error",error:n})}}finally{this.#e.runNext(this)}}#r(e){const t=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),pe.batch(()=>{this.#t.forEach(r=>{r.onMutationUpdate(e)}),this.#e.notify({mutation:this,type:"updated",action:e})})}};function ua(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var da=class extends At{constructor(e={}){super(),this.config=e,this.#t=new Set,this.#e=new Map,this.#n=0}#t;#e;#n;build(e,t,r){const n=new ca({mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){this.#t.add(e);const t=rr(e);if(typeof t=="string"){const r=this.#e.get(t);r?r.push(e):this.#e.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#t.delete(e)){const t=rr(e);if(typeof t=="string"){const r=this.#e.get(t);if(r)if(r.length>1){const n=r.indexOf(e);n!==-1&&r.splice(n,1)}else r[0]===e&&this.#e.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=rr(e);if(typeof t=="string"){const n=this.#e.get(t)?.find(s=>s.state.status==="pending");return!n||n===e}else return!0}runNext(e){const t=rr(e);return typeof t=="string"?this.#e.get(t)?.find(n=>n!==e&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){pe.batch(()=>{this.#t.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#t.clear(),this.#e.clear()})}getAll(){return Array.from(this.#t)}find(e){const t={exact:!0,...e};return this.getAll().find(r=>yn(t,r))}findAll(e={}){return this.getAll().filter(t=>yn(e,t))}notify(e){pe.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return pe.batch(()=>Promise.all(e.map(t=>t.continue().catch(Ne))))}};function rr(e){return e.options.scope?.id}function kn(e){return{onFetch:(t,r)=>{const n=t.options,s=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],c=t.state.data?.pageParams||[];let i={pages:[],pageParams:[]},u=0;const d=async()=>{let f=!1;const h=v=>{Object.defineProperty(v,"signal",{enumerable:!0,get:()=>(t.signal.aborted?f=!0:t.signal.addEventListener("abort",()=>{f=!0}),t.signal)})},p=is(t.options,t.fetchOptions),y=async(v,m,w)=>{if(f)return Promise.reject();if(m==null&&v.pages.length)return Promise.resolve(v);const b={queryKey:t.queryKey,pageParam:m,direction:w?"backward":"forward",meta:t.options.meta};h(b);const R=await p(b),{maxPages:T}=t.options,k=w?ta:ea;return{pages:k(v.pages,R,T),pageParams:k(v.pageParams,m,T)}};if(s&&a.length){const v=s==="backward",m=v?fa:jn,w={pages:a,pageParams:c},b=m(n,w);i=await y(w,b,v)}else{const v=e??a.length;do{const m=u===0?c[0]??n.initialPageParam:jn(n,i);if(u>0&&m==null)break;i=await y(i,m),u++}while(u<v)}return i};t.options.persister?t.fetchFn=()=>t.options.persister?.(d,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=d}}}function jn(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function fa(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var ha=class{#t;#e;#n;#r;#a;#o;#s;#i;constructor(e={}){this.#t=e.queryCache||new la,this.#e=e.mutationCache||new da,this.#n=e.defaultOptions||{},this.#r=new Map,this.#a=new Map,this.#o=0}mount(){this.#o++,this.#o===1&&(this.#s=sn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#t.onFocus())}),this.#i=pr.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#t.onOnline())}))}unmount(){this.#o--,this.#o===0&&(this.#s?.(),this.#s=void 0,this.#i?.(),this.#i=void 0)}isFetching(e){return this.#t.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#e.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#t.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=this.#t.build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(vt(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return this.#t.findAll(e).map(({queryKey:t,state:r})=>{const n=r.data;return[t,n]})}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),a=this.#t.get(n.queryHash)?.state.data,c=Xo(t,a);if(c!==void 0)return this.#t.build(this,n).setData(c,{...r,manual:!0})}setQueriesData(e,t,r){return pe.batch(()=>this.#t.findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#t.get(t.queryHash)?.state}removeQueries(e){const t=this.#t;pe.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=this.#t,n={type:"active",...e};return pe.batch(()=>(r.findAll(e).forEach(s=>{s.reset()}),this.refetchQueries(n,t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=pe.batch(()=>this.#t.findAll(e).map(s=>s.cancel(r)));return Promise.all(n).then(Ne).catch(Ne)}invalidateQueries(e,t={}){return pe.batch(()=>{if(this.#t.findAll(e).forEach(n=>{n.invalidate()}),e?.refetchType==="none")return Promise.resolve();const r={...e,type:e?.refetchType??e?.type??"active"};return this.refetchQueries(r,t)})}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},n=pe.batch(()=>this.#t.findAll(e).filter(s=>!s.isDisabled()).map(s=>{let a=s.fetch(void 0,r);return r.throwOnError||(a=a.catch(Ne)),s.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(n).then(Ne)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=this.#t.build(this,t);return r.isStaleByTime(vt(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ne).catch(Ne)}fetchInfiniteQuery(e){return e.behavior=kn(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ne).catch(Ne)}ensureInfiniteQueryData(e){return e.behavior=kn(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return pr.isOnline()?this.#e.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#t}getMutationCache(){return this.#e}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(Tt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#r.values()],r={};return t.forEach(n=>{Rt(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){this.#a.set(Tt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#a.values()];let r={};return t.forEach(n=>{Rt(e,n.mutationKey)&&(r={...r,...n.defaultOptions})}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=nn(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===mr&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#t.clear(),this.#e.clear()}},ma=class extends At{constructor(e,t){super(),this.options=t,this.#t=e,this.#i=null,this.#s=Kr(),this.options.experimental_prefetchInRender||this.#s.reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(t)}#t;#e=void 0;#n=void 0;#r=void 0;#a;#o;#s;#i;#p;#f;#h;#c;#u;#l;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),Sn(this.#e,this.options)?this.#d():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Gr(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Gr(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#y(),this.#w(),this.#e.removeObserver(this)}setOptions(e,t){const r=this.options,n=this.#e;if(this.options=this.#t.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Re(this.options.enabled,this.#e)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#C(),this.#e.setOptions(this.options),r._defaulted&&!Ur(this.options,r)&&this.#t.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const s=this.hasListeners();s&&En(this.#e,n,this.options,r)&&this.#d(),this.updateResult(t),s&&(this.#e!==n||Re(this.options.enabled,this.#e)!==Re(r.enabled,this.#e)||vt(this.options.staleTime,this.#e)!==vt(r.staleTime,this.#e))&&this.#x();const a=this.#v();s&&(this.#e!==n||Re(this.options.enabled,this.#e)!==Re(r.enabled,this.#e)||a!==this.#l)&&this.#g(a)}getOptimisticResult(e){const t=this.#t.getQueryCache().build(this.#t,e),r=this.createResult(t,e);return xa(this,r)&&(this.#r=r,this.#o=this.options,this.#a=this.#e.state),r}getCurrentResult(){return this.#r}trackResult(e,t){const r={};return Object.keys(e).forEach(n=>{Object.defineProperty(r,n,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(n),t?.(n),e[n])})}),r}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#e}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#t.defaultQueryOptions(e),r=this.#t.getQueryCache().build(this.#t,t);return r.fetch().then(()=>this.createResult(r,t))}fetch(e){return this.#d({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#d(e){this.#C();let t=this.#e.fetch(this.options,e);return e?.throwOnError||(t=t.catch(Ne)),t}#x(){this.#y();const e=vt(this.options.staleTime,this.#e);if(Ye||this.#r.isStale||!Hr(e))return;const r=as(this.#r.dataUpdatedAt,e)+1;this.#c=setTimeout(()=>{this.#r.isStale||this.updateResult()},r)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#e):this.options.refetchInterval)??!1}#g(e){this.#w(),this.#l=e,!(Ye||Re(this.options.enabled,this.#e)===!1||!Hr(this.#l)||this.#l===0)&&(this.#u=setInterval(()=>{(this.options.refetchIntervalInBackground||sn.isFocused())&&this.#d()},this.#l))}#b(){this.#x(),this.#g(this.#v())}#y(){this.#c&&(clearTimeout(this.#c),this.#c=void 0)}#w(){this.#u&&(clearInterval(this.#u),this.#u=void 0)}createResult(e,t){const r=this.#e,n=this.options,s=this.#r,a=this.#a,c=this.#o,u=e!==r?e.state:this.#n,{state:d}=e;let f={...d},h=!1,p;if(t._optimisticResults){const j=this.hasListeners(),N=!j&&Sn(e,t),M=j&&En(e,r,t,n);(N||M)&&(f={...f,...fs(d.data,e.options)}),t._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:y,errorUpdatedAt:v,status:m}=f;if(t.select&&f.data!==void 0)if(s&&f.data===a?.data&&t.select===this.#p)p=this.#f;else try{this.#p=t.select,p=t.select(f.data),p=Qr(s?.data,p,t),this.#f=p,this.#i=null}catch(j){this.#i=j}else p=f.data;if(t.placeholderData!==void 0&&p===void 0&&m==="pending"){let j;if(s?.isPlaceholderData&&t.placeholderData===c?.placeholderData)j=s.data;else if(j=typeof t.placeholderData=="function"?t.placeholderData(this.#h?.state.data,this.#h):t.placeholderData,t.select&&j!==void 0)try{j=t.select(j),this.#i=null}catch(N){this.#i=N}j!==void 0&&(m="success",p=Qr(s?.data,j,t),h=!0)}this.#i&&(y=this.#i,p=this.#f,v=Date.now(),m="error");const w=f.fetchStatus==="fetching",b=m==="pending",R=m==="error",T=b&&w,k=p!==void 0,L={status:m,fetchStatus:f.fetchStatus,isPending:b,isSuccess:m==="success",isError:R,isInitialLoading:T,isLoading:T,data:p,dataUpdatedAt:f.dataUpdatedAt,error:y,errorUpdatedAt:v,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:f.dataUpdateCount>0||f.errorUpdateCount>0,isFetchedAfterMount:f.dataUpdateCount>u.dataUpdateCount||f.errorUpdateCount>u.errorUpdateCount,isFetching:w,isRefetching:w&&!b,isLoadingError:R&&!k,isPaused:f.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:R&&k,isStale:on(e,t),refetch:this.refetch,promise:this.#s};if(this.options.experimental_prefetchInRender){const j=U=>{L.status==="error"?U.reject(L.error):L.data!==void 0&&U.resolve(L.data)},N=()=>{const U=this.#s=L.promise=Kr();j(U)},M=this.#s;switch(M.status){case"pending":e.queryHash===r.queryHash&&j(M);break;case"fulfilled":(L.status==="error"||L.data!==M.value)&&N();break;case"rejected":(L.status!=="error"||L.error!==M.reason)&&N();break}}return L}updateResult(e){const t=this.#r,r=this.createResult(this.#e,this.options);if(this.#a=this.#e.state,this.#o=this.options,this.#a.data!==void 0&&(this.#h=this.#e),Ur(r,t))return;this.#r=r;const n={},s=()=>{if(!t)return!0;const{notifyOnChangeProps:a}=this.options,c=typeof a=="function"?a():a;if(c==="all"||!c&&!this.#m.size)return!0;const i=new Set(c??this.#m);return this.options.throwOnError&&i.add("error"),Object.keys(this.#r).some(u=>{const d=u;return this.#r[d]!==t[d]&&i.has(d)})};e?.listeners!==!1&&s()&&(n.listeners=!0),this.#k({...n,...e})}#C(){const e=this.#t.getQueryCache().build(this.#t,this.options);if(e===this.#e)return;const t=this.#e;this.#e=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#k(e){pe.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#r)}),this.#t.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function pa(e,t){return Re(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Sn(e,t){return pa(e,t)||e.state.data!==void 0&&Gr(e,t,t.refetchOnMount)}function Gr(e,t,r){if(Re(t.enabled,e)!==!1){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&on(e,t)}return!1}function En(e,t,r,n){return(e!==t||Re(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&on(e,r)}function on(e,t){return Re(t.enabled,e)!==!1&&e.isStaleByTime(vt(t.staleTime,e))}function xa(e,t){return!Ur(e.getCurrentResult(),t)}var hs=g.createContext(void 0),va=e=>{const t=g.useContext(hs);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},ga=({client:e,children:t})=>(g.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),o.jsx(hs.Provider,{value:e,children:t})),ms=g.createContext(!1),ba=()=>g.useContext(ms);ms.Provider;function ya(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var wa=g.createContext(ya()),Ca=()=>g.useContext(wa);function ka(e,t){return typeof e=="function"?e(...t):!!e}function Nn(){}var ja=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},Sa=e=>{g.useEffect(()=>{e.clearReset()},[e])},Ea=({result:e,errorResetBoundary:t,throwOnError:r,query:n})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&ka(r,[e.error,n]),Na=e=>{const t=e.staleTime;e.suspense&&(e.staleTime=typeof t=="function"?(...r)=>Math.max(t(...r),1e3):Math.max(t??1e3,1e3),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3)))},Ta=(e,t)=>e.isLoading&&e.isFetching&&!t,Ra=(e,t)=>e?.suspense&&t.isPending,Tn=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function Oa(e,t,r){if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const n=va(),s=ba(),a=Ca(),c=n.defaultQueryOptions(e);n.getDefaultOptions().queries?._experimental_beforeQuery?.(c),c._optimisticResults=s?"isRestoring":"optimistic",Na(c),ja(c,a),Sa(a);const i=!n.getQueryCache().get(c.queryHash),[u]=g.useState(()=>new t(n,c)),d=u.getOptimisticResult(c),f=!s&&e.subscribed!==!1;if(g.useSyncExternalStore(g.useCallback(h=>{const p=f?u.subscribe(pe.batchCalls(h)):Nn;return u.updateResult(),p},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),g.useEffect(()=>{u.setOptions(c,{listeners:!1})},[c,u]),Ra(c,d))throw Tn(c,u,a);if(Ea({result:d,errorResetBoundary:a,throwOnError:c.throwOnError,query:n.getQueryCache().get(c.queryHash)}))throw d.error;return n.getDefaultOptions().queries?._experimental_afterQuery?.(c,d),c.experimental_prefetchInRender&&!Ye&&Ta(d,s)&&(i?Tn(c,u,a):n.getQueryCache().get(c.queryHash)?.promise)?.catch(Nn).finally(()=>{u.updateResult()}),c.notifyOnChangeProps?d:u.trackResult(d)}function bt(e,t){return Oa(e,ma)}const _a={widget:"1rem",input:"0.75rem",button:"0.5rem"},Aa={primary:"#ffffff",secondary:"hsla(0, 0%, 100%, 0.48)"},Ma={background:"#343b47",radius:"0.75rem"},Ce={colors:{primary:"#ed6300",background:"hsla(0, 0%, 100%, 0.04)",surface:"hsla(0, 0%, 0%, 0.2)",text:Aa,error:"#ff4d4f",success:"#52c41a"},radius:_a,overlay:Ma,fontFamily:"'Inter', sans-serif"},ps=x.createContext(null);function Pa({children:e,theme:t}){const r=x.useMemo(()=>t?{colors:{primary:t.colors?.primary??Ce.colors.primary,background:t.colors?.background??Ce.colors.background,surface:t.colors?.surface??Ce.colors.surface,text:{primary:t.colors?.text?.primary??Ce.colors.text.primary,secondary:t.colors?.text?.secondary??Ce.colors.text.secondary},error:t.colors?.error??Ce.colors.error,success:t.colors?.success??Ce.colors.success},radius:{widget:t.radius?.widget??Ce.radius.widget,input:t.radius?.input??Ce.radius.input,button:t.radius?.button??Ce.radius.button},overlay:{background:t.overlay?.background??Ce.overlay.background,radius:t.overlay?.radius??Ce.overlay.radius},fontFamily:t.fontFamily??Ce.fontFamily}:Ce,[t]),n=x.useMemo(()=>({"--optimex-primary":r.colors.primary,"--optimex-background":r.colors.background,"--optimex-surface":r.colors.surface,"--optimex-text":r.colors.text.primary,"--optimex-text-secondary":r.colors.text.secondary,"--optimex-error":r.colors.error,"--optimex-success":r.colors.success,"--optimex-radius-widget":r.radius.widget,"--optimex-radius-input":r.radius.input,"--optimex-radius-button":r.radius.button,"--optimex-overlay-background":r.overlay.background,"--optimex-overlay-radius":r.overlay.radius,"--optimex-font-family":r.fontFamily}),[r]);return o.jsx(ps.Provider,{value:{theme:r},children:o.jsx("div",{style:n,className:"w-full",children:e})})}function Ia(){const e=x.useContext(ps);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const xs=x.createContext(null);function Da({children:e,externalWalletClient:t,onRequestWallet:r}){const n=x.useMemo(()=>{const s=t?.evm?.address??null,a=t?.evm?.chain?.id??null,c=t?.btc?.address??null,i=t?.btc?.publicKey??null,u=t?.solana?.address??null,d=!!s,f=!!c,h=!!u;return{mode:"external",isExternalWallet:!0,isConnected:d||f||h,evmAddress:s,evmChainId:a,isEvmConnected:d,btcAddress:c,btcPublicKey:i,isBtcConnected:f,solanaAddress:u,isSolanaConnected:h,externalWalletClient:t,onRequestWallet:r,isConnecting:!1}},[t,r]);return o.jsx(xs.Provider,{value:n,children:e})}class jr extends Error{status;code;constructor(t,r,n){super(r),this.name="ApiError",this.status=t,this.code=n}}class vs{baseUrl;headers;constructor(t){this.baseUrl=t.replace(/\/$/,""),this.headers={"Content-Type":"application/json"}}async request(t,r,n){const s=`${this.baseUrl}${r}`;try{const a=await fetch(s,{method:t,headers:this.headers,body:n?JSON.stringify(n):void 0});if(!a.ok){const i=await a.json().catch(()=>({}));throw new jr(a.status,i.message||`Request failed with status ${a.status}`,i.code)}return(await a.json()).data}catch(a){throw a instanceof jr?a:new jr(0,a instanceof Error?a.message:"Network error","NETWORK_ERROR")}}async getTokens(){return this.request("GET","/v2/tokens")}async createQuote(t){return this.request("POST","/v2/trades/quote",t)}async submitTransaction(t,r){return this.request("POST","/v2/trades/submit-tx",{trade_id:t,tx_id:r})}async getTrade(t){return this.request("GET",`/v2/trades/${t}`)}async getTokenPrice(t){return this.request("GET",`/v2/tokens/${t}`)}async listTrades(t={}){const r=new URLSearchParams;t.limit&&r.set("limit",String(t.limit)),t.page&&r.set("page",String(t.page)),t.state&&r.set("state",t.state),t.from_user_address?.length&&t.from_user_address.forEach(a=>r.append("from_user_address",a)),t.to_user_address?.length&&t.to_user_address.forEach(a=>r.append("to_user_address",a));const n=r.toString(),s=n?`/v2/trades?${n}`:"/v2/trades";return this.request("GET",s)}}let xt=null;function yt(e){if(!xt&&e&&(xt=new vs(e)),!xt)throw new Error("API not initialized. Please provide baseUrl.");return xt}function La(e){return xt=new vs(e),xt}const Fa=["tokens"];function Ba(e){return bt({queryKey:Fa,queryFn:async()=>yt(e).getTokens(),staleTime:300*1e3,gcTime:1800*1e3,retry:3,retryDelay:t=>Math.min(1e3*2**t,3e4)})}const $a=2e4,za=1e4,ie={EVM:"EVM",BTC:"BTC",SOLANA:"Solana"};function Wa(e,t=4){return e?e.length<=t*2+3?e:`${e.slice(0,t+2)}...${e.slice(-t)}`:""}function Ha(e,t,r=6){if(!e)return"0";let n;typeof e=="bigint"?n=e:typeof e=="string"?n=BigInt(e):n=BigInt(Math.floor(e));const s=BigInt(10**t),a=n/s,c=n%s;if(c===0n)return a.toString();const u=c.toString().padStart(t,"0").slice(0,r).replace(/0+$/,"");return u?`${a}.${u}`:a.toString()}function gs(e,t){if(!e||e==="0")return 0n;const[r,n=""]=e.split("."),s=n.slice(0,t).padEnd(t,"0"),a=r+s;return BigInt(a)}function ze(e,t=18,r=6){if(!e)return"0";const n=String(e);if(n.includes(".")||!Number.isInteger(Number(n))){const s=parseFloat(n);return isNaN(s)?"0":s.toFixed(r).replace(/\.?0+$/,"")}return Ha(n,t,r)}function Va(e,t){if(!t||!e||isNaN(parseFloat(e)))return"$0.00";const r=parseFloat(e);if(r===0)return"$0.00";const n=r*t;return n<.01?"<$0.01":n<1?`$${n.toFixed(4)}`:n<1e3?`$${n.toFixed(2)}`:n<1e6?`$${(n/1e3).toFixed(2)}K`:`$${(n/1e6).toFixed(2)}M`}var Ua=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Sr={exports:{}};var Rn;function qa(){return Rn||(Rn=1,(function(e){(function(){var t="input is invalid type",r="finalize already called",n=typeof window=="object",s=n?window:{};s.JS_SHA3_NO_WINDOW&&(n=!1);var a=!n&&typeof self=="object",c=!s.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;c?s=Ua:a&&(s=self);for(var i=!s.JS_SHA3_NO_COMMON_JS&&!0&&e.exports,u=!s.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",d="0123456789abcdef".split(""),f=[31,7936,2031616,520093696],h=[4,1024,262144,67108864],p=[1,256,65536,16777216],y=[6,1536,393216,100663296],v=[0,8,16,24],m=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],w=[224,256,384,512],b=[128,256],R=["hex","buffer","arrayBuffer","array","digest"],T={128:168,256:136},k=s.JS_SHA3_NO_NODE_JS||!Array.isArray?function(l){return Object.prototype.toString.call(l)==="[object Array]"}:Array.isArray,A=u&&(s.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)?function(l){return typeof l=="object"&&l.buffer&&l.buffer.constructor===ArrayBuffer}:ArrayBuffer.isView,L=function(l){var C=typeof l;if(C==="string")return[l,!0];if(C!=="object"||l===null)throw new Error(t);if(u&&l.constructor===ArrayBuffer)return[new Uint8Array(l),!1];if(!k(l)&&!A(l))throw new Error(t);return[l,!1]},j=function(l){return L(l)[0].length===0},N=function(l){for(var C=[],S=0;S<l.length;++S)C[S]=l[S];return C},M=function(l,C,S){return function(O){return new F(l,C,l).update(O)[S]()}},U=function(l,C,S){return function(O,E){return new F(l,C,E).update(O)[S]()}},W=function(l,C,S){return function(O,E,$,H){return oe["cshake"+l].update(O,E,$,H)[S]()}},K=function(l,C,S){return function(O,E,$,H){return oe["kmac"+l].update(O,E,$,H)[S]()}},D=function(l,C,S,O){for(var E=0;E<R.length;++E){var $=R[E];l[$]=C(S,O,$)}return l},X=function(l,C){var S=M(l,C,"hex");return S.create=function(){return new F(l,C,l)},S.update=function(O){return S.create().update(O)},D(S,M,l,C)},J=function(l,C){var S=U(l,C,"hex");return S.create=function(O){return new F(l,C,O)},S.update=function(O,E){return S.create(E).update(O)},D(S,U,l,C)},re=function(l,C){var S=T[l],O=W(l,C,"hex");return O.create=function(E,$,H){return j($)&&j(H)?oe["shake"+l].create(E):new F(l,C,E).bytepad([$,H],S)},O.update=function(E,$,H,B){return O.create($,H,B).update(E)},D(O,W,l,C)},te=function(l,C){var S=T[l],O=K(l,C,"hex");return O.create=function(E,$,H){return new ke(l,C,$).bytepad(["KMAC",H],S).bytepad([E],S)},O.update=function(E,$,H,B){return O.create(E,H,B).update($)},D(O,K,l,C)},_=[{name:"keccak",padding:p,bits:w,createMethod:X},{name:"sha3",padding:y,bits:w,createMethod:X},{name:"shake",padding:f,bits:b,createMethod:J},{name:"cshake",padding:h,bits:b,createMethod:re},{name:"kmac",padding:h,bits:b,createMethod:te}],oe={},me=[],xe=0;xe<_.length;++xe)for(var ve=_[xe],Y=ve.bits,ne=0;ne<Y.length;++ne){var ye=ve.name+"_"+Y[ne];if(me.push(ye),oe[ye]=ve.createMethod(Y[ne],ve.padding),ve.name!=="sha3"){var Te=ve.name+Y[ne];me.push(Te),oe[Te]=oe[ye]}}function F(l,C,S){this.blocks=[],this.s=[],this.padding=C,this.outputBits=S,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(l<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=S>>5,this.extraBytes=(S&31)>>3;for(var O=0;O<50;++O)this.s[O]=0}F.prototype.update=function(l){if(this.finalized)throw new Error(r);var C=L(l);l=C[0];for(var S=C[1],O=this.blocks,E=this.byteCount,$=l.length,H=this.blockCount,B=0,le=this.s,V,ee;B<$;){if(this.reset)for(this.reset=!1,O[0]=this.block,V=1;V<H+1;++V)O[V]=0;if(S)for(V=this.start;B<$&&V<E;++B)ee=l.charCodeAt(B),ee<128?O[V>>2]|=ee<<v[V++&3]:ee<2048?(O[V>>2]|=(192|ee>>6)<<v[V++&3],O[V>>2]|=(128|ee&63)<<v[V++&3]):ee<55296||ee>=57344?(O[V>>2]|=(224|ee>>12)<<v[V++&3],O[V>>2]|=(128|ee>>6&63)<<v[V++&3],O[V>>2]|=(128|ee&63)<<v[V++&3]):(ee=65536+((ee&1023)<<10|l.charCodeAt(++B)&1023),O[V>>2]|=(240|ee>>18)<<v[V++&3],O[V>>2]|=(128|ee>>12&63)<<v[V++&3],O[V>>2]|=(128|ee>>6&63)<<v[V++&3],O[V>>2]|=(128|ee&63)<<v[V++&3]);else for(V=this.start;B<$&&V<E;++B)O[V>>2]|=l[B]<<v[V++&3];if(this.lastByteIndex=V,V>=E){for(this.start=V-E,this.block=O[H],V=0;V<H;++V)le[V]^=O[V];we(le),this.reset=!0}else this.start=V}return this},F.prototype.encode=function(l,C){var S=l&255,O=1,E=[S];for(l=l>>8,S=l&255;S>0;)E.unshift(S),l=l>>8,S=l&255,++O;return C?E.push(O):E.unshift(O),this.update(E),E.length},F.prototype.encodeString=function(l){var C=L(l);l=C[0];var S=C[1],O=0,E=l.length;if(S)for(var $=0;$<l.length;++$){var H=l.charCodeAt($);H<128?O+=1:H<2048?O+=2:H<55296||H>=57344?O+=3:(H=65536+((H&1023)<<10|l.charCodeAt(++$)&1023),O+=4)}else O=E;return O+=this.encode(O*8),this.update(l),O},F.prototype.bytepad=function(l,C){for(var S=this.encode(C),O=0;O<l.length;++O)S+=this.encodeString(l[O]);var E=(C-S%C)%C,$=[];return $.length=E,this.update($),this},F.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var l=this.blocks,C=this.lastByteIndex,S=this.blockCount,O=this.s;if(l[C>>2]|=this.padding[C&3],this.lastByteIndex===this.byteCount)for(l[0]=l[S],C=1;C<S+1;++C)l[C]=0;for(l[S-1]|=2147483648,C=0;C<S;++C)O[C]^=l[C];we(O)}},F.prototype.toString=F.prototype.hex=function(){this.finalize();for(var l=this.blockCount,C=this.s,S=this.outputBlocks,O=this.extraBytes,E=0,$=0,H="",B;$<S;){for(E=0;E<l&&$<S;++E,++$)B=C[E],H+=d[B>>4&15]+d[B&15]+d[B>>12&15]+d[B>>8&15]+d[B>>20&15]+d[B>>16&15]+d[B>>28&15]+d[B>>24&15];$%l===0&&(C=N(C),we(C),E=0)}return O&&(B=C[E],H+=d[B>>4&15]+d[B&15],O>1&&(H+=d[B>>12&15]+d[B>>8&15]),O>2&&(H+=d[B>>20&15]+d[B>>16&15])),H},F.prototype.arrayBuffer=function(){this.finalize();var l=this.blockCount,C=this.s,S=this.outputBlocks,O=this.extraBytes,E=0,$=0,H=this.outputBits>>3,B;O?B=new ArrayBuffer(S+1<<2):B=new ArrayBuffer(H);for(var le=new Uint32Array(B);$<S;){for(E=0;E<l&&$<S;++E,++$)le[$]=C[E];$%l===0&&(C=N(C),we(C))}return O&&(le[$]=C[E],B=B.slice(0,H)),B},F.prototype.buffer=F.prototype.arrayBuffer,F.prototype.digest=F.prototype.array=function(){this.finalize();for(var l=this.blockCount,C=this.s,S=this.outputBlocks,O=this.extraBytes,E=0,$=0,H=[],B,le;$<S;){for(E=0;E<l&&$<S;++E,++$)B=$<<2,le=C[E],H[B]=le&255,H[B+1]=le>>8&255,H[B+2]=le>>16&255,H[B+3]=le>>24&255;$%l===0&&(C=N(C),we(C))}return O&&(B=$<<2,le=C[E],H[B]=le&255,O>1&&(H[B+1]=le>>8&255),O>2&&(H[B+2]=le>>16&255)),H};function ke(l,C,S){F.call(this,l,C,S)}ke.prototype=new F,ke.prototype.finalize=function(){return this.encode(this.outputBits,!0),F.prototype.finalize.call(this)};var we=function(l){var C,S,O,E,$,H,B,le,V,ee,We,tt,_e,rt,He,nt,st,Pe,ot,Ve,at,Ae,Ue,it,lt,ct,ut,dt,z,G,Z,Q,se,de,ce,je,ge,Ee,Se,be,Ie,qe,It,Dt,Lt,Ft,Bt,$t,zt,Wt,Ht,Vt,Ut,qt,Qt,Kt,Gt,Yt,Zt,Xt,Jt,er,tr;for(O=0;O<48;O+=2)E=l[0]^l[10]^l[20]^l[30]^l[40],$=l[1]^l[11]^l[21]^l[31]^l[41],H=l[2]^l[12]^l[22]^l[32]^l[42],B=l[3]^l[13]^l[23]^l[33]^l[43],le=l[4]^l[14]^l[24]^l[34]^l[44],V=l[5]^l[15]^l[25]^l[35]^l[45],ee=l[6]^l[16]^l[26]^l[36]^l[46],We=l[7]^l[17]^l[27]^l[37]^l[47],tt=l[8]^l[18]^l[28]^l[38]^l[48],_e=l[9]^l[19]^l[29]^l[39]^l[49],C=tt^(H<<1|B>>>31),S=_e^(B<<1|H>>>31),l[0]^=C,l[1]^=S,l[10]^=C,l[11]^=S,l[20]^=C,l[21]^=S,l[30]^=C,l[31]^=S,l[40]^=C,l[41]^=S,C=E^(le<<1|V>>>31),S=$^(V<<1|le>>>31),l[2]^=C,l[3]^=S,l[12]^=C,l[13]^=S,l[22]^=C,l[23]^=S,l[32]^=C,l[33]^=S,l[42]^=C,l[43]^=S,C=H^(ee<<1|We>>>31),S=B^(We<<1|ee>>>31),l[4]^=C,l[5]^=S,l[14]^=C,l[15]^=S,l[24]^=C,l[25]^=S,l[34]^=C,l[35]^=S,l[44]^=C,l[45]^=S,C=le^(tt<<1|_e>>>31),S=V^(_e<<1|tt>>>31),l[6]^=C,l[7]^=S,l[16]^=C,l[17]^=S,l[26]^=C,l[27]^=S,l[36]^=C,l[37]^=S,l[46]^=C,l[47]^=S,C=ee^(E<<1|$>>>31),S=We^($<<1|E>>>31),l[8]^=C,l[9]^=S,l[18]^=C,l[19]^=S,l[28]^=C,l[29]^=S,l[38]^=C,l[39]^=S,l[48]^=C,l[49]^=S,rt=l[0],He=l[1],Ft=l[11]<<4|l[10]>>>28,Bt=l[10]<<4|l[11]>>>28,dt=l[20]<<3|l[21]>>>29,z=l[21]<<3|l[20]>>>29,Xt=l[31]<<9|l[30]>>>23,Jt=l[30]<<9|l[31]>>>23,qe=l[40]<<18|l[41]>>>14,It=l[41]<<18|l[40]>>>14,de=l[2]<<1|l[3]>>>31,ce=l[3]<<1|l[2]>>>31,nt=l[13]<<12|l[12]>>>20,st=l[12]<<12|l[13]>>>20,$t=l[22]<<10|l[23]>>>22,zt=l[23]<<10|l[22]>>>22,G=l[33]<<13|l[32]>>>19,Z=l[32]<<13|l[33]>>>19,er=l[42]<<2|l[43]>>>30,tr=l[43]<<2|l[42]>>>30,qt=l[5]<<30|l[4]>>>2,Qt=l[4]<<30|l[5]>>>2,je=l[14]<<6|l[15]>>>26,ge=l[15]<<6|l[14]>>>26,Pe=l[25]<<11|l[24]>>>21,ot=l[24]<<11|l[25]>>>21,Wt=l[34]<<15|l[35]>>>17,Ht=l[35]<<15|l[34]>>>17,Q=l[45]<<29|l[44]>>>3,se=l[44]<<29|l[45]>>>3,it=l[6]<<28|l[7]>>>4,lt=l[7]<<28|l[6]>>>4,Kt=l[17]<<23|l[16]>>>9,Gt=l[16]<<23|l[17]>>>9,Ee=l[26]<<25|l[27]>>>7,Se=l[27]<<25|l[26]>>>7,Ve=l[36]<<21|l[37]>>>11,at=l[37]<<21|l[36]>>>11,Vt=l[47]<<24|l[46]>>>8,Ut=l[46]<<24|l[47]>>>8,Dt=l[8]<<27|l[9]>>>5,Lt=l[9]<<27|l[8]>>>5,ct=l[18]<<20|l[19]>>>12,ut=l[19]<<20|l[18]>>>12,Yt=l[29]<<7|l[28]>>>25,Zt=l[28]<<7|l[29]>>>25,be=l[38]<<8|l[39]>>>24,Ie=l[39]<<8|l[38]>>>24,Ae=l[48]<<14|l[49]>>>18,Ue=l[49]<<14|l[48]>>>18,l[0]=rt^~nt&Pe,l[1]=He^~st&ot,l[10]=it^~ct&dt,l[11]=lt^~ut&z,l[20]=de^~je&Ee,l[21]=ce^~ge&Se,l[30]=Dt^~Ft&$t,l[31]=Lt^~Bt&zt,l[40]=qt^~Kt&Yt,l[41]=Qt^~Gt&Zt,l[2]=nt^~Pe&Ve,l[3]=st^~ot&at,l[12]=ct^~dt&G,l[13]=ut^~z&Z,l[22]=je^~Ee&be,l[23]=ge^~Se&Ie,l[32]=Ft^~$t&Wt,l[33]=Bt^~zt&Ht,l[42]=Kt^~Yt&Xt,l[43]=Gt^~Zt&Jt,l[4]=Pe^~Ve&Ae,l[5]=ot^~at&Ue,l[14]=dt^~G&Q,l[15]=z^~Z&se,l[24]=Ee^~be&qe,l[25]=Se^~Ie&It,l[34]=$t^~Wt&Vt,l[35]=zt^~Ht&Ut,l[44]=Yt^~Xt&er,l[45]=Zt^~Jt&tr,l[6]=Ve^~Ae&rt,l[7]=at^~Ue&He,l[16]=G^~Q&it,l[17]=Z^~se<,l[26]=be^~qe&de,l[27]=Ie^~It&ce,l[36]=Wt^~Vt&Dt,l[37]=Ht^~Ut&Lt,l[46]=Xt^~er&qt,l[47]=Jt^~tr&Qt,l[8]=Ae^~rt&nt,l[9]=Ue^~He&st,l[18]=Q^~it&ct,l[19]=se^~lt&ut,l[28]=qe^~de&je,l[29]=It^~ce&ge,l[38]=Vt^~Dt&Ft,l[39]=Ut^~Lt&Bt,l[48]=er^~qt&Kt,l[49]=tr^~Qt&Gt,l[0]^=m[O],l[1]^=m[O+1]};if(i)e.exports=oe;else for(xe=0;xe<me.length;++xe)s[me[xe]]=oe[me[xe]]})()})(Sr)),Sr.exports}var Qa=qa();function Ka(e){const t=e.slice(2).toLowerCase(),r=Qa.keccak256(t);for(let n=0;n<40;n++){const s=parseInt(r[n],16),a=t[n];if(s>=8){if(e[n+2]!==a.toUpperCase())return!1}else if(e[n+2]!==a.toLowerCase())return!1}return!0}function Ga(e){return/^0x[a-fA-F0-9]{40}$/.test(e)?/^0x[0-9a-f]{40}$/.test(e)||/^0x[0-9A-F]{40}$/.test(e)?!0:Ka(e):!1}function Ya(e){return/^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$|^(bc1)[a-z0-9]{39,59}$/.test(e)}function Za(e){return/^[mn2][a-km-zA-HJ-NP-Z1-9]{25,34}$|^(tb1)[a-z0-9]{39,59}$/.test(e)}function Xa(e){return/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(e)}function an(e,t,r){const n=e.trim();if(!n)return{isValid:!1,error:"Address is required"};switch(t){case ie.EVM:return Ga(n)?{isValid:!0}:{isValid:!1,error:`Invalid ${r} wallet address`};case ie.BTC:if(r==="bitcoin_testnet"){if(!Za(n))return{isValid:!1,error:`Invalid ${r} wallet address`}}else if(!Ya(n))return{isValid:!1,error:`Invalid ${r} wallet address`};return{isValid:!0};case ie.SOLANA:return Xa(n)?{isValid:!0}:{isValid:!1,error:`Invalid ${r} wallet address`};default:return{isValid:!1,error:`Unsupported network type: ${t}`}}}const Ja=e=>["quote",e];function ei(e,{from_token:t,to_token:r,amount:n,from_user_address:s,to_user_address:a,user_refund_pubkey:c,slippage:i="100",affiliate_fee_bps:u,affiliate_info:d,trade_timeout:f,script_timeout:h,enabled:p=!0,onQuote:y}){const v=r&&a?an(a,r.network_type,r.network_id).isValid:!1,m=t&&r&&n&&parseFloat(n)>0&&s&&a&&c&&v;return bt({queryKey:Ja({from_token:t,to_token:r,amount:n,from_user_address:s,to_user_address:a,user_refund_pubkey:c,slippage:i}),queryFn:async()=>{const w=yt(e),b=gs(n,t.token_decimals).toString(),R=await w.createQuote({from_token_id:t.token_id,to_token_id:r.token_id,amount_in:b,slippage:i,from_user_address:s,to_user_address:a,user_refund_pubkey:c,affiliate_fee_bps:u,affiliate_info:d,trade_timeout:f,script_timeout:h});return y?.({quote:R,from_token:t,to_token:r,amount_in:n}),R},enabled:p&&!!m,staleTime:za,refetchInterval:$a,retry:2,retryDelay:1e3})}const bs=x.createContext(null);function ti({children:e,value:t}){return o.jsx(bs.Provider,{value:t,children:e})}function Mt(){const e=x.useContext(bs);if(!e)throw new Error("useWidgetConfig must be used within SwapWidget");return e}function ri({className:e="h-6 w-6"}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[o.jsx("rect",{width:"24",height:"24",rx:"6",fill:"#D0D0D8"}),o.jsx("rect",{x:"4",y:"4",width:"6.85714",height:"6.85714",rx:"3.42857",fill:"#FFD49F"}),o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.98943 6.98062C9.06078 6.50027 8.69769 6.24205 8.20122 6.06979L8.36227 5.4191L7.96906 5.32039L7.81227 5.95393C7.7089 5.92798 7.60273 5.9035 7.49723 5.87925L7.65514 5.24153L7.26216 5.14282L7.101 5.79329C7.01544 5.77366 6.93144 5.75426 6.84991 5.73384L6.85036 5.73181L6.30809 5.59542L6.20348 6.01846C6.20348 6.01846 6.49523 6.08581 6.48907 6.08998C6.64832 6.13003 6.6771 6.23618 6.67229 6.32034L6.48884 7.06162C6.49982 7.06444 6.51404 7.0685 6.52972 7.07482L6.5164 7.07147L6.48817 7.06444L6.23103 8.10286C6.21155 8.1516 6.16216 8.2247 6.05084 8.19695C6.05476 8.2027 5.76503 8.12509 5.76503 8.12509L5.56982 8.57847L6.08152 8.70696C6.13867 8.72139 6.19513 8.73622 6.251 8.7509C6.2882 8.76067 6.32514 8.77037 6.36184 8.77984L6.19912 9.43798L6.59188 9.53669L6.75304 8.88554C6.86033 8.91487 6.96448 8.94195 7.06639 8.96744L6.9058 9.61554L7.299 9.71425L7.46173 9.05735C8.13224 9.18517 8.63643 9.13361 8.84866 8.52274C9.01967 8.03089 8.84015 7.74717 8.48737 7.56216C8.74428 7.50248 8.93781 7.33225 8.98943 6.98062ZM8.09134 8.24968C7.97986 8.70094 7.27864 8.51438 6.9578 8.42902L6.95779 8.42901C6.92893 8.42133 6.90314 8.41447 6.88114 8.40897L7.09706 7.53706C7.12385 7.54379 7.15659 7.55119 7.19367 7.55957C7.52551 7.63458 8.20558 7.78829 8.09134 8.24968ZM7.26037 7.15491C7.52787 7.22682 8.11136 7.38367 8.213 6.97354C8.31679 6.55403 7.74968 6.42757 7.47272 6.36581C7.44156 6.35886 7.41408 6.35273 7.39164 6.3471L7.19587 7.1379C7.21436 7.14254 7.23606 7.14838 7.26037 7.15491Z",fill:"#F7931A"}),o.jsx("rect",{x:"12.8572",y:"4",width:"6.85714",height:"6.85714",rx:"3.42857",fill:"white"}),o.jsx("path",{d:"M14.8567 7.47096L16.2848 8.30034V6.83321V5.14284L14.8567 7.47096Z",fill:"#898989"}),o.jsx("path",{d:"M16.2837 5.14284V6.8332V8.30033L17.7118 7.47096L16.2837 5.14284Z",fill:"#323232"}),o.jsx("path",{d:"M16.2837 6.83343L17.7114 7.47098L16.2837 8.30014V6.83343Z",fill:"#141414"}),o.jsx("path",{d:"M16.2848 6.83322L16.2853 6.83336V8.29993L16.2848 8.30035L14.8567 7.47097L16.2848 6.83322Z",fill:"#373737"}),o.jsx("path",{d:"M14.8567 7.73708L16.2848 9.71431V8.56604L14.8567 7.73708Z",fill:"#898989"}),o.jsx("path",{d:"M16.2837 8.56604V9.71431L17.7127 7.73708L16.2837 8.56604Z",fill:"#323232"}),o.jsx("rect",{x:"4",y:"12.8571",width:"6.85714",height:"6.85714",rx:"3.42857",fill:"#DCFFFB"}),o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.68368 15.456C8.66445 15.4645 8.64369 15.469 8.6227 15.469H5.49249C5.47756 15.469 5.46296 15.4645 5.45047 15.4563C5.43798 15.448 5.42815 15.4362 5.42218 15.4223C5.41621 15.4084 5.41436 15.3931 5.41685 15.3782C5.41935 15.3633 5.42608 15.3494 5.43622 15.3383L6.0958 14.6209C6.11009 14.6053 6.12738 14.5929 6.14662 14.5844C6.16585 14.5758 6.18661 14.5714 6.2076 14.5714H9.33781C9.35286 14.5711 9.3677 14.5753 9.3804 14.5835C9.39311 14.5917 9.40317 14.6035 9.40925 14.6175C9.41536 14.6315 9.41722 14.6469 9.41465 14.662C9.41208 14.677 9.40518 14.691 9.39482 14.7021L8.7345 15.4195C8.72021 15.4351 8.70292 15.4475 8.68368 15.456ZM8.73471 15.9844C8.72037 15.9689 8.70306 15.9565 8.68384 15.948C8.66462 15.9395 8.64389 15.9351 8.62291 15.935H5.4927C5.47777 15.935 5.46317 15.9394 5.45068 15.9477C5.43819 15.956 5.42836 15.9678 5.42239 15.9817C5.41642 15.9955 5.41457 16.0108 5.41706 16.0258C5.41955 16.0407 5.42629 16.0545 5.43643 16.0656L6.09601 16.7835C6.11035 16.799 6.12766 16.8114 6.14688 16.8199C6.1661 16.8284 6.18683 16.8328 6.20781 16.8329H9.33802C9.35292 16.8328 9.36746 16.8284 9.3799 16.82C9.39235 16.8117 9.40211 16.7999 9.40804 16.7861C9.41396 16.7722 9.41579 16.7569 9.41326 16.742C9.41076 16.7272 9.40405 16.7133 9.39392 16.7023L8.73471 15.9844ZM9.39503 17.4295L8.73471 18.147C8.72042 18.1626 8.70313 18.175 8.68389 18.1835C8.66466 18.192 8.6439 18.1964 8.62291 18.1965H5.4927C5.47777 18.1964 5.46317 18.192 5.45068 18.1837C5.43819 18.1754 5.42836 18.1636 5.42239 18.1498C5.41642 18.1359 5.41457 18.1206 5.41706 18.1057C5.41955 18.0908 5.42629 18.0769 5.43643 18.0658L6.09601 17.3484C6.1103 17.3328 6.12759 17.3203 6.14683 17.3118C6.16606 17.3033 6.18682 17.2989 6.20781 17.2989H9.33802C9.35307 17.2986 9.3679 17.3028 9.38061 17.311C9.39332 17.3192 9.40338 17.331 9.40945 17.345C9.41557 17.3589 9.41743 17.3744 9.41486 17.3895C9.41229 17.4045 9.40539 17.4185 9.39503 17.4295Z",fill:"url(#paint0_linear_all_networks)"}),o.jsx("rect",{x:"12.8572",y:"12.8571",width:"6.85714",height:"6.85714",rx:"3.42857",fill:"#999CB3"}),o.jsx("path",{d:"M16.0979 17.4286V15.1429H16.473V17.4286H16.0979ZM15.1426 16.4692V16.097H17.4283V16.4692H15.1426Z",fill:"#2D3153"}),o.jsx("defs",{children:o.jsxs("linearGradient",{id:"paint0_linear_all_networks",x1:"7.82209",y1:"19.7701",x2:"10.7176",y2:"15.7425",gradientUnits:"userSpaceOnUse",children:[o.jsx("stop",{offset:"0.08",stopColor:"#9945FF"}),o.jsx("stop",{offset:"0.3",stopColor:"#8752F3"}),o.jsx("stop",{offset:"0.5",stopColor:"#5497D5"}),o.jsx("stop",{offset:"0.6",stopColor:"#43B4CA"}),o.jsx("stop",{offset:"0.72",stopColor:"#28E0B9"}),o.jsx("stop",{offset:"0.97",stopColor:"#19FB9B"})]})})]})}function ni(e){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{d:"M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"})})}function ln({className:e="h-5 w-5"}){return o.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})}function ys({className:e="h-4 w-4"}){return o.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})}function ws({className:e="h-5 w-5"}){return o.jsxs("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[o.jsx("circle",{cx:"12",cy:"12",r:"10",strokeOpacity:"0.25"}),o.jsx("path",{strokeLinecap:"round",d:"M12 2a10 10 0 019.17 6"})]})}function si({className:e="h-5 w-5"}){return o.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}function Ze({className:e="h-5 w-5"}){return o.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}function oi(e){return o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[o.jsx("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),o.jsx("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]})}function ai(e){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",...e,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})})}function ii({className:e="h-3.5 w-3.5"}){return o.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"})})}function li(e){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 29 20",fill:"currentColor",...e,children:o.jsx("path",{d:"M18.1123 4.25181C17.9463 3.49057 17.537 2.8272 16.9727 2.31607C15.4792 0.978457 13.189 1.03283 11.7619 2.4357C11.2751 2.91419 10.9321 3.51232 10.7662 4.18656C10.6002 4.84993 10.6555 5.64381 10.4564 6.50293C10.1798 7.75354 9.53813 8.90629 8.6088 9.81978C7.6131 10.7985 6.34081 11.451 4.95788 11.6903C4.19451 11.8208 3.3205 11.7773 2.57925 12.0165C2.00396 12.2014 1.48398 12.5276 1.07463 12.9409C-0.374675 14.3981 -0.352546 16.7254 1.10782 18.1609C2.535 19.5637 4.84725 19.6181 6.32974 18.2696C6.72802 17.9107 7.04886 17.4757 7.25907 16.9755C7.67947 16.0076 7.52459 15.5944 7.65735 14.6483C7.73479 14.0936 7.87862 13.5608 8.08882 13.0388C8.31009 12.4841 8.3986 12.3319 8.70837 11.8643C9.29473 10.9943 10.0692 10.2548 10.9874 9.73278C12.0053 9.14554 13.178 8.81929 14.4392 8.81929C16.32 8.81929 18.0237 9.56966 19.2628 10.7768C20.2586 11.7446 20.9445 13.0061 21.1879 14.4199C21.3096 15.0941 21.2432 15.8227 21.4202 16.4861C21.5972 17.1386 21.9402 17.715 22.4049 18.1826C23.8763 19.629 26.266 19.629 27.7485 18.1826C29.1646 16.7906 29.231 14.5395 27.8923 13.0823C27.4498 12.6038 26.8855 12.234 26.2549 12.0274C25.4252 11.7664 25.0379 11.8643 24.1971 11.7555C22.6593 11.5598 21.2875 10.8638 20.2475 9.84153C19.1854 8.79754 18.4663 7.40554 18.2893 5.8613C18.1897 5.19793 18.2561 4.87168 18.1123 4.25181ZM16.9617 11.0486C15.5013 9.61316 13.1448 9.61316 11.6844 11.0486C10.2241 12.4841 10.2241 14.8005 11.6844 16.236C13.1448 17.6715 15.5013 17.6715 16.9617 16.236C18.422 14.8005 18.422 12.4841 16.9617 11.0486ZM26.0668 3.13169C24.6065 1.6962 22.25 1.6962 20.7896 3.13169C19.3292 4.56719 19.3292 6.88355 20.7896 8.31904C22.25 9.75453 24.6065 9.75453 26.0668 8.31904C27.5272 6.88355 27.5272 4.56719 26.0668 3.13169ZM7.95606 3.17519C6.49569 1.7397 4.13919 1.7397 2.67882 3.17519C1.21845 4.61069 1.21845 6.92705 2.67882 8.36254C4.13919 9.79803 6.49569 9.79803 7.95606 8.36254C9.41643 6.92705 9.41643 4.59981 7.95606 3.17519Z"})})}function ci(e){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 124 22",...e,children:o.jsx("path",{d:"M41.39 4.241c3.385 0 6.162 2.73 6.162 6.058s-2.777 6.003-6.162 6.003h-.62c-3.385 0-6.162-2.676-6.162-6.003S37.385 4.24 40.77 4.24zm-.3 10.745c2.877 0 4.825-2.317 4.825-4.644.055-2.37-1.903-4.796-4.824-4.796-2.976 0-4.879 2.425-4.824 4.796-.01 2.316 1.892 4.644 4.824 4.644m21.353-4.698c0 3.327-2.268 5.992-5.233 5.992h-.62c-2.422 0-3.905-.805-4.978-2.665V22H50.02V4.241h1.593V6.96c.963-1.925 2.666-2.719 4.979-2.719h.62c2.964 0 5.232 2.719 5.232 6.047m-1.703 0c0-2.317-1.649-4.644-4.559-4.644-2.312 0-4.259 1.925-4.259 4.23v.816c0 2.316 1.936 4.187 4.304 4.187 2.832 0 4.514-2.273 4.514-4.59m8.275 6.003c-.354 0-.72-.055-1.073-.196-.874-.305-1.593-.86-2.058-1.61a5 5 0 0 1-.465-1.109c-.1-.402-.155-.707-.155-1.11V5.765h-1.382v-1.36h1.382V.772h1.649v3.632h3.44v1.36h-3.44v6.144c0 1.762.774 2.828 2.722 2.828h1.438v1.566h-2.058zm6.018-15.28c0 .555-.409 1.012-.973 1.012A1.025 1.025 0 0 1 73.03 1.01C73.031.457 73.496 0 74.06 0s.973.457.973 1.011m-1.792 3.23h1.593v12.06h-1.593zm14.283 2.621c.819-1.718 2.511-2.62 4.47-2.62 3.075 0 4.47 2.729 4.47 5.502v6.558H94.87V9.396c0-5.655-6.881-4.698-6.881.196v6.71h-1.594V9.396c0-5.655-6.826-4.698-6.826.196v6.71h-1.637V4.242h1.593v2.065c1.637-2.925 6.716-2.773 7.999.555m17.436 8.124c1.847 0 3.695-1.164 4.304-2.73h1.593c-.819 2.316-2.877 4.035-5.543 4.035h-.664c-3.385 0-5.897-2.676-5.897-6.003s2.512-6.058 5.897-6.058h.664c3.341 0 5.897 2.73 5.897 6.058 0 .195 0 .402-.056.609H100.38c.121 2.273 2.268 4.089 4.58 4.089m4.624-5.296c-.099-2.273-2.257-4.133-4.613-4.133-2.312 0-4.47 1.86-4.569 4.133zM124 4.24l-5.133 6.058L124 16.302h-2.058l-4.104-4.84-4.105 4.84h-2.002l5.133-6.003-5.133-6.058h2.002l4.105 4.84 4.104-4.84zm-105.888-.49a3.67 3.67 0 0 0-1.14-1.935 3.817 3.817 0 0 0-5.21.12 3.67 3.67 0 0 0-.996 1.75c-.166.664-.11 1.458-.31 2.317A6.7 6.7 0 0 1 8.61 9.32a6.88 6.88 0 0 1-3.651 1.87c-.763.13-1.638.087-2.379.327a3.75 3.75 0 0 0-1.504.924 3.667 3.667 0 0 0 .033 5.22c1.427 1.403 3.74 1.457 5.222.109.398-.36.719-.794.93-1.294.42-.968.265-1.382.397-2.328a6.8 6.8 0 0 1 .432-1.61c.221-.554.31-.706.62-1.174a6.862 6.862 0 0 1 5.73-3.045c1.881 0 3.585.75 4.824 1.958a6.64 6.64 0 0 1 1.925 3.643c.122.674.055 1.403.232 2.066.177.653.52 1.229.985 1.697 1.471 1.446 3.861 1.446 5.343 0a3.666 3.666 0 0 0 .144-5.1 3.9 3.9 0 0 0-1.637-1.056c-.83-.26-1.217-.163-2.058-.271a6.86 6.86 0 0 1-3.95-1.914 6.65 6.65 0 0 1-1.958-3.98c-.1-.664-.033-.99-.177-1.61m-1.15 6.798a3.77 3.77 0 0 0-5.278 0 3.62 3.62 0 0 0 0 5.187 3.77 3.77 0 0 0 5.278 0 3.62 3.62 0 0 0 0-5.187m9.105-7.917a3.77 3.77 0 0 0-5.277 0 3.62 3.62 0 0 0 0 5.187 3.77 3.77 0 0 0 5.277 0 3.62 3.62 0 0 0 0-5.187m-18.11.043a3.77 3.77 0 0 0-5.278 0 3.62 3.62 0 0 0 0 5.188 3.77 3.77 0 0 0 5.277 0 3.62 3.62 0 0 0 0-5.188"})})}function ui(e){return o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 25",fill:"none",...e,children:[o.jsx("mask",{id:"paste_mask",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"24",height:"25",children:o.jsx("rect",{y:"0.5",width:"24",height:"24",fill:"#D9D9D9"})}),o.jsx("g",{mask:"url(#paste_mask)",children:o.jsx("path",{d:"M5.30775 20.9999C4.80908 20.9999 4.38308 20.8233 4.02975 20.4701C3.67658 20.1168 3.5 19.6908 3.5 19.1921V5.80762C3.5 5.30895 3.67658 4.88295 4.02975 4.52962C4.38308 4.17645 4.80908 3.99987 5.30775 3.99987H9.7135C9.852 3.5127 10.135 3.10887 10.5625 2.78837C10.99 2.46787 11.4692 2.30762 12 2.30762C12.5513 2.30762 13.0382 2.46787 13.4605 2.78837C13.883 3.10887 14.1635 3.5127 14.302 3.99987H18.6923C19.1909 3.99987 19.6169 4.17645 19.9703 4.52962C20.3234 4.88295 20.5 5.30895 20.5 5.80762V19.1921C20.5 19.6908 20.3234 20.1168 19.9703 20.4701C19.6169 20.8233 19.1909 20.9999 18.6923 20.9999H5.30775ZM5.30775 19.4999H18.6923C18.7692 19.4999 18.8398 19.4678 18.9038 19.4036C18.9679 19.3396 19 19.2691 19 19.1921V5.80762C19 5.73062 18.9679 5.66012 18.9038 5.59612C18.8398 5.53195 18.7692 5.49987 18.6923 5.49987H16.5V8.11512H7.5V5.49987H5.30775C5.23075 5.49987 5.16025 5.53195 5.09625 5.59612C5.03208 5.66012 5 5.73062 5 5.80762V19.1921C5 19.2691 5.03208 19.3396 5.09625 19.4036C5.16025 19.4678 5.23075 19.4999 5.30775 19.4999ZM12 5.61537C12.2577 5.61537 12.4728 5.52912 12.6453 5.35662C12.8176 5.18412 12.9038 4.96903 12.9038 4.71137C12.9038 4.4537 12.8176 4.23862 12.6453 4.06612C12.4728 3.89378 12.2577 3.80762 12 3.80762C11.7423 3.80762 11.5273 3.89378 11.3548 4.06612C11.1824 4.23862 11.0963 4.4537 11.0963 4.71137C11.0963 4.96903 11.1824 5.18412 11.3548 5.35662C11.5273 5.52912 11.7423 5.61537 12 5.61537Z",fill:"currentColor",fillOpacity:.48})})]})}function di(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{d:"M4 12C4 7.58172 7.58172 4 12 4C15.0736 4 17.7555 5.6841 19.2291 8.16667M20 12C20 16.4183 16.4183 20 12 20C8.92638 20 6.24452 18.3159 4.77091 15.8333",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),o.jsx("path",{d:"M19 4V8H15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("path",{d:"M5 20V16H9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function fi(e){return o.jsxs("svg",{viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("circle",{cx:"32",cy:"32",r:"28",className:"fill-[var(--optimex-error)]/10 stroke-[var(--optimex-error)]",strokeWidth:"2"}),o.jsx("path",{d:"M20 22L26 28M26 22L20 28",className:"stroke-[var(--optimex-error)]",strokeWidth:"2.5",strokeLinecap:"round"}),o.jsx("path",{d:"M38 22L44 28M44 22L38 28",className:"stroke-[var(--optimex-error)]",strokeWidth:"2.5",strokeLinecap:"round"}),o.jsx("path",{d:"M22 44C26 38 38 38 42 44",className:"stroke-[var(--optimex-error)]",strokeWidth:"2.5",strokeLinecap:"round"})]})}function hi({className:e="h-5 w-5"}){return o.jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})}function mi({className:e="h-5 w-5"}){return o.jsxs("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}function Cs(e){return o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[o.jsx("path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1"}),o.jsx("path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4"})]})}function On({className:e="h-5 w-5"}){return o.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}function ks(e){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 21",width:"20",height:"20",...e,children:o.jsx("path",{fill:"currentColor",d:"m11.299 2.846-.553 2.231q.557.126 1.103.263l.549-2.219 1.375.346-.563 2.277c1.737.603 3.008 1.506 2.759 3.188-.18 1.23-.858 1.827-1.757 2.036 1.234.647 1.862 1.641 1.264 3.362-.743 2.137-2.507 2.318-4.854 1.87l-.57 2.3-1.376-.345.562-2.269a53 53 0 0 1-1.096-.287l-.565 2.28-1.374-.346.57-2.304c-.322-.082-.65-.17-.982-.254L4 14.525l.684-1.587c.009.002 1.013.272 1 .251.389.098.562-.158.63-.33l.9-3.633.145.036a1 1 0 0 0-.142-.047l.64-2.593c.018-.295-.082-.667-.64-.807.02-.014-1-.25-1-.25l.367-1.48 1.898.476-.002.008q.43.106.88.207L9.922 2.5zM8.588 13.93c.933.233 3.81 1.164 4.236-.557.444-1.795-2.547-2.26-3.48-2.495zM9.69 9.483c.778.195 3.172.99 3.56-.575.404-1.634-2.098-1.998-2.875-2.193z"})})}function js(e){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 14 12",width:"20",height:"20",...e,children:o.jsx("path",{fill:"currentColor",fillOpacity:.48,d:"M2.463 8.78a.44.44 0 0 1 .311-.129H13.5a.22.22 0 0 1 .156.376l-2.119 2.124a.44.44 0 0 1-.311.129H.5a.22.22 0 0 1-.156-.377zm0-7.932A.45.45 0 0 1 2.774.72H13.5a.221.221 0 0 1 .156.376L11.536 3.22a.44.44 0 0 1-.311.13H.5a.22.22 0 0 1-.156-.377zm9.074 3.941a.44.44 0 0 0-.311-.13H.5a.22.22 0 0 0-.156.377l2.12 2.124a.44.44 0 0 0 .31.129H13.5a.221.221 0 0 0 .156-.376z"})})}function Ss(e){return o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 14 22",width:"20",height:"20",...e,children:[o.jsx("path",{fill:"currentColor",d:"M6.998 0 .5 11.204l6.498-3.069zM6.998 8.136.5 11.205l6.498 3.992z"}),o.jsx("path",{fill:"currentColor",d:"M13.496 11.204 6.997 0v8.135z"}),o.jsx("path",{fill:"currentColor",d:"m6.997 15.197 6.499-3.992-6.499-3.07zM.5 12.484 6.998 22v-5.526z"}),o.jsx("path",{fill:"currentColor",d:"M6.997 16.474V22l6.502-9.516z"})]})}function Es(e){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 25",width:"20",height:"20",...e,children:o.jsx("path",{fill:"currentColor",fillOpacity:.48,d:"M11.984 21.5c4.98 0 9.016-4.03 9.016-9s-4.036-9-9.016-9C7.26 3.5 3.385 7.127 3 11.743h11.917v1.514H3c.385 4.616 4.26 8.243 8.984 8.243"})})}function Ns(e){return o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 25",width:"20",height:"20",...e,children:[o.jsxs("g",{fill:"currentColor",fillOpacity:.48,clipPath:"url(#arb_a)",children:[o.jsx("path",{d:"m12.089 14.49 2.278 3.68 2.105-1.255-2.992-4.852zM18.389 15.439l-.002-1.006-3.27-5.24-1.213 2.119 3.157 5.251 1.14-.68a.53.53 0 0 0 .188-.379zM4.688 16.387l1.611.956 5.363-8.85-.91-.024c-.776-.011-1.611.196-1.994.84l-3.046 4.857-1.024 1.62zM14.758 8.494l-2.4.009-5.426 9.214 1.897 1.123.515-.9z"}),o.jsx("path",{d:"M19.4 8.481a1.58 1.58 0 0 0-.718-1.264L12.72 3.69a1.51 1.51 0 0 0-1.368 0c-.05.026-5.8 3.456-5.8 3.456a1.572 1.572 0 0 0-.863 1.333v7.307l1.024-1.62-.009-5.638.007-.06a.52.52 0 0 1 .204-.332c.027-.02 5.875-3.502 5.893-3.512a.5.5 0 0 1 .45-.002l5.887 3.484c.139.091.226.246.234.415v6.984a.52.52 0 0 1-.176.38l-1.141.68-.589.35-2.105 1.256-2.134 1.272a.5.5 0 0 1-.364-.007L9.345 17.94l-.516.9 2.27 1.344.36.207c.161.08.393.127.602.127q.29 0 .556-.108l6.2-3.693c.355-.284.565-.712.584-1.175z"})]}),o.jsx("defs",{children:o.jsx("clipPath",{id:"arb_a",children:o.jsx("path",{fill:"currentColor",d:"M4 3h16v18H4z"})})})]})}function Ts(e){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 25",width:"20",height:"20",...e,children:o.jsx("path",{fill:"currentColor",fillOpacity:.48,d:"M7.245 16.646q-1.431 0-2.343-.672C4.301 15.52 4 14.867 4 14.03c0-.18.02-.39.058-.647q.154-.862.441-2.08Q5.317 8 8.717 8c.614 0 1.171.102 1.657.314q.73.298 1.152.915.423.604.423 1.44 0 .249-.058.633a26 26 0 0 1-.435 2.08c-.282 1.095-.762 1.92-1.453 2.464-.685.538-1.606.8-2.758.8m.173-1.728c.448 0 .825-.134 1.139-.396q.481-.393.685-1.216c.185-.756.326-1.408.422-1.972q.05-.25.051-.518.002-1.094-1.139-1.094-.672.001-1.152.396-.471.393-.672 1.216c-.147.538-.288 1.19-.435 1.972q-.05.238-.051.505c-.007.743.384 1.107 1.152 1.107M12.506 16.531c-.09 0-.154-.025-.205-.083-.038-.064-.051-.134-.038-.218l1.657-7.808a.32.32 0 0 1 .135-.217.35.35 0 0 1 .23-.083h3.194q1.333.001 2.137.55c.544.371.82.902.82 1.6 0 .198-.026.41-.071.627-.198.922-.602 1.6-1.216 2.042q-.902.66-2.477.659h-1.619l-.55 2.63a.34.34 0 0 1-.135.218.35.35 0 0 1-.23.083zm4.25-4.589c.339 0 .627-.09.876-.275q.383-.277.506-.793.038-.203.038-.359c0-.23-.07-.41-.205-.531-.134-.128-.37-.192-.697-.192h-1.44l-.455 2.15z"})})}function Rs(e){return o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 25",width:"20",height:"20",...e,children:[o.jsx("path",{fill:"currentColor",fillOpacity:.48,d:"m4.913 12.5.011 3.868 3.286 1.935v2.264L3 17.511V11.37zm0-3.868v2.254L3 9.754V7.5l1.913-1.133L6.836 7.5zM9.582 7.5l1.913-1.133L13.418 7.5l-1.923 1.132z"}),o.jsx("path",{fill:"currentColor",fillOpacity:.48,d:"M6.297 15.567v-2.265l1.913 1.132v2.254zm3.285 3.547 1.914 1.132 1.923-1.132v2.254L11.496 22.5l-1.914-1.132zM16.163 7.5l1.913-1.133L20 7.5v2.254l-1.923 1.132V8.632zm1.913 8.868.011-3.868L20 11.368v6.142l-5.208 3.056v-2.265z"}),o.jsx("path",{fill:"currentColor",fillOpacity:.48,d:"m16.704 15.567-1.914 1.122v-2.254l1.913-1.133z"}),o.jsx("path",{fill:"currentColor",fillOpacity:.48,d:"m16.704 9.434.01 2.264-3.294 1.934v3.878l-1.913 1.122-1.914-1.122v-3.878l-3.295-1.934V9.434L8.22 8.3l3.275 1.944L14.79 8.3l1.922 1.133zM6.297 5.566 11.496 2.5l5.208 3.066L14.791 6.7l-3.295-1.944L8.21 6.7z"})]})}const _n={bitcoin:ks,solana:js,ethereum:Ss,base:Es,arbitrum:Ns,optimism:Ts,bsc:Rs};function pi(e){if(!e)return null;const t=e.toLowerCase().replace(/[\s_-]/g,"");return t in _n?_n[t]:t.includes("bitcoin")||t.includes("btc")?ks:t.includes("solana")||t.includes("sol")?js:t.includes("ethereum")||t.includes("eth")||t.includes("erc20")?Ss:t.includes("base")?Es:t.includes("arbitrum")||t.includes("arb")?Ns:t.includes("optimism")||t.includes("op")?Ts:t.includes("bsc")||t.includes("binance")||t.includes("bnb")?Rs:null}function xi(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function vi({icon:e,label:t,address:r,className:n=""}){const[s,a]=x.useState(!1),c=x.useCallback(async()=>{try{await navigator.clipboard.writeText(r),a(!0),setTimeout(()=>a(!1),2e3)}catch{console.error("Failed to copy")}},[r]);return o.jsxs("div",{className:`flex items-center justify-between px-4 py-3 ${n}`,children:[o.jsxs("div",{className:"flex items-center gap-2 text-[var(--optimex-text-secondary)]",children:[o.jsx(e,{className:"size-4"}),o.jsx("span",{className:"text-sm",children:t})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-sm font-medium text-[var(--optimex-text)]",children:xi(r)}),o.jsx("button",{onClick:c,className:"p-1 rounded hover:bg-white/10 transition-colors",title:s?"Copied!":"Copy",children:s?o.jsx(ln,{className:"size-4 text-[var(--optimex-success)]"}):o.jsx(oi,{className:"size-4 text-[var(--optimex-text-secondary)]"})})]})]})}const gi={primary:"bg-[var(--optimex-primary)] text-black hover:brightness-110 shadow-lg shadow-[var(--optimex-primary)]/30",secondary:"bg-[var(--optimex-surface)] text-[var(--optimex-text)] hover:bg-white/10 border border-white/10",ghost:"bg-transparent text-[var(--optimex-text-secondary)] hover:bg-white/10 hover:text-[var(--optimex-text)]",danger:"bg-[var(--optimex-error)] text-white hover:bg-[var(--optimex-error)]/90 hover:shadow-lg hover:shadow-[var(--optimex-error)]/25"},bi={sm:"px-3 py-1.5 text-xs rounded-[var(--optimex-radius-button)] gap-1.5 max-h-[2rem]",md:"px-4 py-2 text-sm rounded-[var(--optimex-radius-button)] gap-2 max-h-[2.5rem]",lg:"px-6 py-3 text-sm rounded-[var(--optimex-radius-button)] gap-2 max-h-[3rem]",xl:"px-6 py-4 text-sm rounded-[var(--optimex-radius-button)] gap-2"};function cn({variant:e="primary",size:t="md",fullWidth:r=!1,isLoading:n=!1,leftIcon:s,rightIcon:a,children:c,className:i="",disabled:u,...d}){const f=u||n;return o.jsxs("button",{className:`
|
|
3
3
|
group flex items-center justify-center font-semibold transition-all active:scale-[0.98]
|
|
4
|
-
${
|
|
5
|
-
${
|
|
4
|
+
${gi[e]}
|
|
5
|
+
${bi[t]}
|
|
6
6
|
${r?"w-full":""}
|
|
7
|
-
${
|
|
7
|
+
${f?"cursor-not-allowed opacity-50":""}
|
|
8
8
|
${i}
|
|
9
|
-
`,disabled:d,...u,children:[n&&s.jsx(qa,{size:t}),!n&&o&&s.jsx("span",{className:"shrink-0",children:o}),l,!n&&a&&s.jsx("span",{className:"shrink-0",children:a})]})}function qa({size:e}){const t=e==="sm"?"h-4 w-4":"h-5 w-5";return s.jsx("div",{className:`${t} animate-spin rounded-[9999px] border-2 border-current border-t-transparent`})}function Gn(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(r=Gn(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Kn(){for(var e,t,r=0,n="",o=arguments.length;r<o;r++)(e=arguments[r])&&(t=Gn(e))&&(n&&(n+=" "),n+=t);return n}const Qa=(e,t)=>{const r=new Array(e.length+t.length);for(let n=0;n<e.length;n++)r[n]=e[n];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r},Ga=(e,t)=>({classGroupId:e,validator:t}),Yn=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),Et="-",Gr=[],Ka="arbitrary..",Ya=e=>{const t=Xa(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return Za(l);const i=l.split(Et),c=i[0]===""&&i.length>1?1:0;return Zn(i,c,t)},getConflictingClassGroupIds:(l,i)=>{if(i){const c=n[l],u=r[l];return c?u?Qa(u,c):c:u||Gr}return r[l]||Gr}}},Zn=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const o=e[t],a=r.nextPart.get(o);if(a){const u=Zn(e,t+1,a);if(u)return u}const l=r.validators;if(l===null)return;const i=t===0?e.join(Et):e.slice(t).join(Et),c=l.length;for(let u=0;u<c;u++){const d=l[u];if(d.validator(i))return d.classGroupId}},Za=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?Ka+n:void 0})(),Xa=e=>{const{theme:t,classGroups:r}=e;return Ja(r,t)},Ja=(e,t)=>{const r=Yn();for(const n in e){const o=e[n];br(o,r,n,t)}return r},br=(e,t,r,n)=>{const o=e.length;for(let a=0;a<o;a++){const l=e[a];ei(l,t,r,n)}},ei=(e,t,r,n)=>{if(typeof e=="string"){ti(e,t,r);return}if(typeof e=="function"){ri(e,t,r,n);return}ni(e,t,r,n)},ti=(e,t,r)=>{const n=e===""?t:Xn(t,e);n.classGroupId=r},ri=(e,t,r,n)=>{if(si(e)){br(e(n),t,r,n);return}t.validators===null&&(t.validators=[]),t.validators.push(Ga(r,e))},ni=(e,t,r,n)=>{const o=Object.entries(e),a=o.length;for(let l=0;l<a;l++){const[i,c]=o[l];br(c,Xn(t,i),r,n)}},Xn=(e,t)=>{let r=e;const n=t.split(Et),o=n.length;for(let a=0;a<o;a++){const l=n[a];let i=r.nextPart.get(l);i||(i=Yn(),r.nextPart.set(l,i)),r=i}return r},si=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,oi=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const o=(a,l)=>{r[a]=l,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(a){let l=r[a];if(l!==void 0)return l;if((l=n[a])!==void 0)return o(a,l),l},set(a,l){a in r?r[a]=l:o(a,l)}}},ir="!",Kr=":",ai=[],Yr=(e,t,r,n,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:o}),ii=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=o=>{const a=[];let l=0,i=0,c=0,u;const d=o.length;for(let h=0;h<d;h++){const y=o[h];if(l===0&&i===0){if(y===Kr){a.push(o.slice(c,h)),c=h+1;continue}if(y==="/"){u=h;continue}}y==="["?l++:y==="]"?l--:y==="("?i++:y===")"&&i--}const f=a.length===0?o:o.slice(c);let m=f,b=!1;f.endsWith(ir)?(m=f.slice(0,-1),b=!0):f.startsWith(ir)&&(m=f.slice(1),b=!0);const v=u&&u>c?u-c:void 0;return Yr(a,b,m,v)};if(t){const o=t+Kr,a=n;n=l=>l.startsWith(o)?a(l.slice(o.length)):Yr(ai,!1,l,void 0,!0)}if(r){const o=n;n=a=>r({className:a,parseClassName:o})}return n},li=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,n)=>{t.set(r,1e6+n)}),r=>{const n=[];let o=[];for(let a=0;a<r.length;a++){const l=r[a],i=l[0]==="[",c=t.has(l);i||c?(o.length>0&&(o.sort(),n.push(...o),o=[]),n.push(l)):o.push(l)}return o.length>0&&(o.sort(),n.push(...o)),n}},ci=e=>({cache:oi(e.cacheSize),parseClassName:ii(e),sortModifiers:li(e),...Ya(e)}),ui=/\s+/,di=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:o,sortModifiers:a}=t,l=[],i=e.trim().split(ui);let c="";for(let u=i.length-1;u>=0;u-=1){const d=i[u],{isExternal:f,modifiers:m,hasImportantModifier:b,baseClassName:v,maybePostfixModifierPosition:h}=r(d);if(f){c=d+(c.length>0?" "+c:c);continue}let y=!!h,g=n(y?v.substring(0,h):v);if(!g){if(!y){c=d+(c.length>0?" "+c:c);continue}if(g=n(v),!g){c=d+(c.length>0?" "+c:c);continue}y=!1}const S=m.length===0?"":m.length===1?m[0]:a(m).join(":"),k=b?S+ir:S,w=k+g;if(l.indexOf(w)>-1)continue;l.push(w);const N=o(g,y);for(let A=0;A<N.length;++A){const C=N[A];l.push(k+C)}c=d+(c.length>0?" "+c:c)}return c},fi=(...e)=>{let t=0,r,n,o="";for(;t<e.length;)(r=e[t++])&&(n=Jn(r))&&(o&&(o+=" "),o+=n);return o},Jn=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=Jn(e[n]))&&(r&&(r+=" "),r+=t);return r},hi=(e,...t)=>{let r,n,o,a;const l=c=>{const u=t.reduce((d,f)=>f(d),e());return r=ci(u),n=r.cache.get,o=r.cache.set,a=i,i(c)},i=c=>{const u=n(c);if(u)return u;const d=di(c,r);return o(c,d),d};return a=l,(...c)=>a(fi(...c))},mi=[],J=e=>{const t=r=>r[e]||mi;return t.isThemeGetter=!0,t},es=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ts=/^\((?:(\w[\w-]*):)?(.+)\)$/i,pi=/^\d+\/\d+$/,xi=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,vi=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,gi=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,bi=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,yi=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Be=e=>pi.test(e),L=e=>!!e&&!Number.isNaN(Number(e)),je=e=>!!e&&Number.isInteger(Number(e)),Dt=e=>e.endsWith("%")&&L(e.slice(0,-1)),ve=e=>xi.test(e),wi=()=>!0,Ci=e=>vi.test(e)&&!gi.test(e),rs=()=>!1,ki=e=>bi.test(e),ji=e=>yi.test(e),Si=e=>!T(e)&&!R(e),Ei=e=>Ke(e,os,rs),T=e=>es.test(e),_e=e=>Ke(e,as,Ci),Ft=e=>Ke(e,_i,L),Zr=e=>Ke(e,ns,rs),Ni=e=>Ke(e,ss,ji),ht=e=>Ke(e,is,ki),R=e=>ts.test(e),et=e=>Ye(e,as),Ti=e=>Ye(e,Ai),Xr=e=>Ye(e,ns),Ri=e=>Ye(e,os),Oi=e=>Ye(e,ss),mt=e=>Ye(e,is,!0),Ke=(e,t,r)=>{const n=es.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},Ye=(e,t,r=!1)=>{const n=ts.exec(e);return n?n[1]?t(n[1]):r:!1},ns=e=>e==="position"||e==="percentage",ss=e=>e==="image"||e==="url",os=e=>e==="length"||e==="size"||e==="bg-size",as=e=>e==="length",_i=e=>e==="number",Ai=e=>e==="family-name",is=e=>e==="shadow",Pi=()=>{const e=J("color"),t=J("font"),r=J("text"),n=J("font-weight"),o=J("tracking"),a=J("leading"),l=J("breakpoint"),i=J("container"),c=J("spacing"),u=J("radius"),d=J("shadow"),f=J("inset-shadow"),m=J("text-shadow"),b=J("drop-shadow"),v=J("blur"),h=J("perspective"),y=J("aspect"),g=J("ease"),S=J("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],N=()=>[...w(),R,T],A=()=>["auto","hidden","clip","visible","scroll"],C=()=>["auto","contain","none"],j=()=>[R,T,c],O=()=>[Be,"full","auto",...j()],D=()=>[je,"none","subgrid",R,T],M=()=>["auto",{span:["full",je,R,T]},je,R,T],$=()=>[je,"auto",R,T],_=()=>["auto","min","max","fr",R,T],W=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],V=()=>["start","end","center","stretch","center-safe","end-safe"],Q=()=>["auto",...j()],H=()=>[Be,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...j()],E=()=>[e,R,T],ne=()=>[...w(),Xr,Zr,{position:[R,T]}],ie=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Te=()=>["auto","cover","contain",Ri,Ei,{size:[R,T]}],pe=()=>[Dt,et,_e],U=()=>["","none","full",u,R,T],Z=()=>["",L,et,_e],de=()=>["solid","dashed","dotted","double"],be=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],F=()=>[L,Dt,Xr,Zr],xe=()=>["","none",v,R,T],ye=()=>["none",L,R,T],we=()=>["none",L,R,T],fe=()=>[L,R,T],Re=()=>[Be,"full",...j()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ve],breakpoint:[ve],color:[wi],container:[ve],"drop-shadow":[ve],ease:["in","out","in-out"],font:[Si],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ve],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ve],shadow:[ve],spacing:["px",L],text:[ve],"text-shadow":[ve],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Be,T,R,y]}],container:["container"],columns:[{columns:[L,T,R,i]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:N()}],overflow:[{overflow:A()}],"overflow-x":[{"overflow-x":A()}],"overflow-y":[{"overflow-y":A()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:O()}],"inset-x":[{"inset-x":O()}],"inset-y":[{"inset-y":O()}],start:[{start:O()}],end:[{end:O()}],top:[{top:O()}],right:[{right:O()}],bottom:[{bottom:O()}],left:[{left:O()}],visibility:["visible","invisible","collapse"],z:[{z:[je,"auto",R,T]}],basis:[{basis:[Be,"full","auto",i,...j()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[L,Be,"auto","initial","none",T]}],grow:[{grow:["",L,R,T]}],shrink:[{shrink:["",L,R,T]}],order:[{order:[je,"first","last","none",R,T]}],"grid-cols":[{"grid-cols":D()}],"col-start-end":[{col:M()}],"col-start":[{"col-start":$()}],"col-end":[{"col-end":$()}],"grid-rows":[{"grid-rows":D()}],"row-start-end":[{row:M()}],"row-start":[{"row-start":$()}],"row-end":[{"row-end":$()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":_()}],"auto-rows":[{"auto-rows":_()}],gap:[{gap:j()}],"gap-x":[{"gap-x":j()}],"gap-y":[{"gap-y":j()}],"justify-content":[{justify:[...W(),"normal"]}],"justify-items":[{"justify-items":[...V(),"normal"]}],"justify-self":[{"justify-self":["auto",...V()]}],"align-content":[{content:["normal",...W()]}],"align-items":[{items:[...V(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...V(),{baseline:["","last"]}]}],"place-content":[{"place-content":W()}],"place-items":[{"place-items":[...V(),"baseline"]}],"place-self":[{"place-self":["auto",...V()]}],p:[{p:j()}],px:[{px:j()}],py:[{py:j()}],ps:[{ps:j()}],pe:[{pe:j()}],pt:[{pt:j()}],pr:[{pr:j()}],pb:[{pb:j()}],pl:[{pl:j()}],m:[{m:Q()}],mx:[{mx:Q()}],my:[{my:Q()}],ms:[{ms:Q()}],me:[{me:Q()}],mt:[{mt:Q()}],mr:[{mr:Q()}],mb:[{mb:Q()}],ml:[{ml:Q()}],"space-x":[{"space-x":j()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":j()}],"space-y-reverse":["space-y-reverse"],size:[{size:H()}],w:[{w:[i,"screen",...H()]}],"min-w":[{"min-w":[i,"screen","none",...H()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[l]},...H()]}],h:[{h:["screen","lh",...H()]}],"min-h":[{"min-h":["screen","lh","none",...H()]}],"max-h":[{"max-h":["screen","lh",...H()]}],"font-size":[{text:["base",r,et,_e]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,R,Ft]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Dt,T]}],"font-family":[{font:[Ti,T,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,R,T]}],"line-clamp":[{"line-clamp":[L,"none",R,Ft]}],leading:[{leading:[a,...j()]}],"list-image":[{"list-image":["none",R,T]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",R,T]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:E()}],"text-color":[{text:E()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...de(),"wavy"]}],"text-decoration-thickness":[{decoration:[L,"from-font","auto",R,_e]}],"text-decoration-color":[{decoration:E()}],"underline-offset":[{"underline-offset":[L,"auto",R,T]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:j()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",R,T]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",R,T]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ne()}],"bg-repeat":[{bg:ie()}],"bg-size":[{bg:Te()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},je,R,T],radial:["",R,T],conic:[je,R,T]},Oi,Ni]}],"bg-color":[{bg:E()}],"gradient-from-pos":[{from:pe()}],"gradient-via-pos":[{via:pe()}],"gradient-to-pos":[{to:pe()}],"gradient-from":[{from:E()}],"gradient-via":[{via:E()}],"gradient-to":[{to:E()}],rounded:[{rounded:U()}],"rounded-s":[{"rounded-s":U()}],"rounded-e":[{"rounded-e":U()}],"rounded-t":[{"rounded-t":U()}],"rounded-r":[{"rounded-r":U()}],"rounded-b":[{"rounded-b":U()}],"rounded-l":[{"rounded-l":U()}],"rounded-ss":[{"rounded-ss":U()}],"rounded-se":[{"rounded-se":U()}],"rounded-ee":[{"rounded-ee":U()}],"rounded-es":[{"rounded-es":U()}],"rounded-tl":[{"rounded-tl":U()}],"rounded-tr":[{"rounded-tr":U()}],"rounded-br":[{"rounded-br":U()}],"rounded-bl":[{"rounded-bl":U()}],"border-w":[{border:Z()}],"border-w-x":[{"border-x":Z()}],"border-w-y":[{"border-y":Z()}],"border-w-s":[{"border-s":Z()}],"border-w-e":[{"border-e":Z()}],"border-w-t":[{"border-t":Z()}],"border-w-r":[{"border-r":Z()}],"border-w-b":[{"border-b":Z()}],"border-w-l":[{"border-l":Z()}],"divide-x":[{"divide-x":Z()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Z()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...de(),"hidden","none"]}],"divide-style":[{divide:[...de(),"hidden","none"]}],"border-color":[{border:E()}],"border-color-x":[{"border-x":E()}],"border-color-y":[{"border-y":E()}],"border-color-s":[{"border-s":E()}],"border-color-e":[{"border-e":E()}],"border-color-t":[{"border-t":E()}],"border-color-r":[{"border-r":E()}],"border-color-b":[{"border-b":E()}],"border-color-l":[{"border-l":E()}],"divide-color":[{divide:E()}],"outline-style":[{outline:[...de(),"none","hidden"]}],"outline-offset":[{"outline-offset":[L,R,T]}],"outline-w":[{outline:["",L,et,_e]}],"outline-color":[{outline:E()}],shadow:[{shadow:["","none",d,mt,ht]}],"shadow-color":[{shadow:E()}],"inset-shadow":[{"inset-shadow":["none",f,mt,ht]}],"inset-shadow-color":[{"inset-shadow":E()}],"ring-w":[{ring:Z()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:E()}],"ring-offset-w":[{"ring-offset":[L,_e]}],"ring-offset-color":[{"ring-offset":E()}],"inset-ring-w":[{"inset-ring":Z()}],"inset-ring-color":[{"inset-ring":E()}],"text-shadow":[{"text-shadow":["none",m,mt,ht]}],"text-shadow-color":[{"text-shadow":E()}],opacity:[{opacity:[L,R,T]}],"mix-blend":[{"mix-blend":[...be(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":be()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[L]}],"mask-image-linear-from-pos":[{"mask-linear-from":F()}],"mask-image-linear-to-pos":[{"mask-linear-to":F()}],"mask-image-linear-from-color":[{"mask-linear-from":E()}],"mask-image-linear-to-color":[{"mask-linear-to":E()}],"mask-image-t-from-pos":[{"mask-t-from":F()}],"mask-image-t-to-pos":[{"mask-t-to":F()}],"mask-image-t-from-color":[{"mask-t-from":E()}],"mask-image-t-to-color":[{"mask-t-to":E()}],"mask-image-r-from-pos":[{"mask-r-from":F()}],"mask-image-r-to-pos":[{"mask-r-to":F()}],"mask-image-r-from-color":[{"mask-r-from":E()}],"mask-image-r-to-color":[{"mask-r-to":E()}],"mask-image-b-from-pos":[{"mask-b-from":F()}],"mask-image-b-to-pos":[{"mask-b-to":F()}],"mask-image-b-from-color":[{"mask-b-from":E()}],"mask-image-b-to-color":[{"mask-b-to":E()}],"mask-image-l-from-pos":[{"mask-l-from":F()}],"mask-image-l-to-pos":[{"mask-l-to":F()}],"mask-image-l-from-color":[{"mask-l-from":E()}],"mask-image-l-to-color":[{"mask-l-to":E()}],"mask-image-x-from-pos":[{"mask-x-from":F()}],"mask-image-x-to-pos":[{"mask-x-to":F()}],"mask-image-x-from-color":[{"mask-x-from":E()}],"mask-image-x-to-color":[{"mask-x-to":E()}],"mask-image-y-from-pos":[{"mask-y-from":F()}],"mask-image-y-to-pos":[{"mask-y-to":F()}],"mask-image-y-from-color":[{"mask-y-from":E()}],"mask-image-y-to-color":[{"mask-y-to":E()}],"mask-image-radial":[{"mask-radial":[R,T]}],"mask-image-radial-from-pos":[{"mask-radial-from":F()}],"mask-image-radial-to-pos":[{"mask-radial-to":F()}],"mask-image-radial-from-color":[{"mask-radial-from":E()}],"mask-image-radial-to-color":[{"mask-radial-to":E()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":w()}],"mask-image-conic-pos":[{"mask-conic":[L]}],"mask-image-conic-from-pos":[{"mask-conic-from":F()}],"mask-image-conic-to-pos":[{"mask-conic-to":F()}],"mask-image-conic-from-color":[{"mask-conic-from":E()}],"mask-image-conic-to-color":[{"mask-conic-to":E()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ne()}],"mask-repeat":[{mask:ie()}],"mask-size":[{mask:Te()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",R,T]}],filter:[{filter:["","none",R,T]}],blur:[{blur:xe()}],brightness:[{brightness:[L,R,T]}],contrast:[{contrast:[L,R,T]}],"drop-shadow":[{"drop-shadow":["","none",b,mt,ht]}],"drop-shadow-color":[{"drop-shadow":E()}],grayscale:[{grayscale:["",L,R,T]}],"hue-rotate":[{"hue-rotate":[L,R,T]}],invert:[{invert:["",L,R,T]}],saturate:[{saturate:[L,R,T]}],sepia:[{sepia:["",L,R,T]}],"backdrop-filter":[{"backdrop-filter":["","none",R,T]}],"backdrop-blur":[{"backdrop-blur":xe()}],"backdrop-brightness":[{"backdrop-brightness":[L,R,T]}],"backdrop-contrast":[{"backdrop-contrast":[L,R,T]}],"backdrop-grayscale":[{"backdrop-grayscale":["",L,R,T]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[L,R,T]}],"backdrop-invert":[{"backdrop-invert":["",L,R,T]}],"backdrop-opacity":[{"backdrop-opacity":[L,R,T]}],"backdrop-saturate":[{"backdrop-saturate":[L,R,T]}],"backdrop-sepia":[{"backdrop-sepia":["",L,R,T]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":j()}],"border-spacing-x":[{"border-spacing-x":j()}],"border-spacing-y":[{"border-spacing-y":j()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",R,T]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[L,"initial",R,T]}],ease:[{ease:["linear","initial",g,R,T]}],delay:[{delay:[L,R,T]}],animate:[{animate:["none",S,R,T]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,R,T]}],"perspective-origin":[{"perspective-origin":N()}],rotate:[{rotate:ye()}],"rotate-x":[{"rotate-x":ye()}],"rotate-y":[{"rotate-y":ye()}],"rotate-z":[{"rotate-z":ye()}],scale:[{scale:we()}],"scale-x":[{"scale-x":we()}],"scale-y":[{"scale-y":we()}],"scale-z":[{"scale-z":we()}],"scale-3d":["scale-3d"],skew:[{skew:fe()}],"skew-x":[{"skew-x":fe()}],"skew-y":[{"skew-y":fe()}],transform:[{transform:[R,T,"","none","gpu","cpu"]}],"transform-origin":[{origin:N()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Re()}],"translate-x":[{"translate-x":Re()}],"translate-y":[{"translate-y":Re()}],"translate-z":[{"translate-z":Re()}],"translate-none":["translate-none"],accent:[{accent:E()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:E()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",R,T]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":j()}],"scroll-mx":[{"scroll-mx":j()}],"scroll-my":[{"scroll-my":j()}],"scroll-ms":[{"scroll-ms":j()}],"scroll-me":[{"scroll-me":j()}],"scroll-mt":[{"scroll-mt":j()}],"scroll-mr":[{"scroll-mr":j()}],"scroll-mb":[{"scroll-mb":j()}],"scroll-ml":[{"scroll-ml":j()}],"scroll-p":[{"scroll-p":j()}],"scroll-px":[{"scroll-px":j()}],"scroll-py":[{"scroll-py":j()}],"scroll-ps":[{"scroll-ps":j()}],"scroll-pe":[{"scroll-pe":j()}],"scroll-pt":[{"scroll-pt":j()}],"scroll-pr":[{"scroll-pr":j()}],"scroll-pb":[{"scroll-pb":j()}],"scroll-pl":[{"scroll-pl":j()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",R,T]}],fill:[{fill:["none",...E()]}],"stroke-w":[{stroke:[L,et,_e,Ft]}],stroke:[{stroke:["none",...E()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},ls=hi(Pi);function cs(...e){return ls(Kn(e))}function Mi({state:e,onConfirm:t,confirmText:r="Confirm",processingText:n="Processing...",successText:o="Done",errorText:a="Retry"}){const l=e==="processing",i=()=>{switch(e){case"processing":return n;case"success":return o;case"error":return a;default:return r}};return s.jsx(Qn,{variant:"primary",size:"lg",fullWidth:!0,onClick:t,isLoading:l,children:i()})}function Ee(e,t,{checkForDefaultPrevented:r=!0}={}){return function(o){if(e?.(o),r===!1||!o.defaultPrevented)return t?.(o)}}function Jr(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function us(...e){return t=>{let r=!1;const n=e.map(o=>{const a=Jr(o,t);return!r&&typeof a=="function"&&(r=!0),a});if(r)return()=>{for(let o=0;o<n.length;o++){const a=n[o];typeof a=="function"?a():Jr(e[o],null)}}}}function Fe(...e){return x.useCallback(us(...e),e)}function Ii(e,t){const r=x.createContext(t),n=a=>{const{children:l,...i}=a,c=x.useMemo(()=>i,Object.values(i));return s.jsx(r.Provider,{value:c,children:l})};n.displayName=e+"Provider";function o(a){const l=x.useContext(r);if(l)return l;if(t!==void 0)return t;throw new Error(`\`${a}\` must be used within \`${e}\``)}return[n,o]}function Li(e,t=[]){let r=[];function n(a,l){const i=x.createContext(l),c=r.length;r=[...r,l];const u=f=>{const{scope:m,children:b,...v}=f,h=m?.[e]?.[c]||i,y=x.useMemo(()=>v,Object.values(v));return s.jsx(h.Provider,{value:y,children:b})};u.displayName=a+"Provider";function d(f,m){const b=m?.[e]?.[c]||i,v=x.useContext(b);if(v)return v;if(l!==void 0)return l;throw new Error(`\`${f}\` must be used within \`${a}\``)}return[u,d]}const o=()=>{const a=r.map(l=>x.createContext(l));return function(i){const c=i?.[e]||a;return x.useMemo(()=>({[`__scope${e}`]:{...i,[e]:c}}),[i,c])}};return o.scopeName=e,[n,Di(o,...t)]}function Di(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(a){const l=n.reduce((i,{useScope:c,scopeName:u})=>{const f=c(a)[`__scope${u}`];return{...i,...f}},{});return x.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])}};return r.scopeName=t.scopeName,r}var ot=globalThis?.document?x.useLayoutEffect:()=>{},Fi=x[" useId ".trim().toString()]||(()=>{}),$i=0;function $t(e){const[t,r]=x.useState(Fi());return ot(()=>{r(n=>n??String($i++))},[e]),e||(t?`radix-${t}`:"")}var Bi=x[" useInsertionEffect ".trim().toString()]||ot;function zi({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[o,a,l]=Wi({defaultProp:t,onChange:r}),i=e!==void 0,c=i?e:o;{const d=x.useRef(e!==void 0);x.useEffect(()=>{const f=d.current;f!==i&&console.warn(`${n} is changing from ${f?"controlled":"uncontrolled"} to ${i?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=i},[i,n])}const u=x.useCallback(d=>{if(i){const f=Vi(d)?d(e):d;f!==e&&l.current?.(f)}else a(d)},[i,e,a,l]);return[c,u]}function Wi({defaultProp:e,onChange:t}){const[r,n]=x.useState(e),o=x.useRef(r),a=x.useRef(t);return Bi(()=>{a.current=t},[t]),x.useEffect(()=>{o.current!==r&&(a.current?.(r),o.current=r)},[r,o]),[r,n,a]}function Vi(e){return typeof e=="function"}function ds(e){const t=Hi(e),r=x.forwardRef((n,o)=>{const{children:a,...l}=n,i=x.Children.toArray(a),c=i.find(qi);if(c){const u=c.props.children,d=i.map(f=>f===c?x.Children.count(u)>1?x.Children.only(null):x.isValidElement(u)?u.props.children:null:f);return s.jsx(t,{...l,ref:o,children:x.isValidElement(u)?x.cloneElement(u,void 0,d):null})}return s.jsx(t,{...l,ref:o,children:a})});return r.displayName=`${e}.Slot`,r}function Hi(e){const t=x.forwardRef((r,n)=>{const{children:o,...a}=r;if(x.isValidElement(o)){const l=Gi(o),i=Qi(a,o.props);return o.type!==x.Fragment&&(i.ref=n?us(n,l):l),x.cloneElement(o,i)}return x.Children.count(o)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ui=Symbol("radix.slottable");function qi(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Ui}function Qi(e,t){const r={...t};for(const n in t){const o=e[n],a=t[n];/^on[A-Z]/.test(n)?o&&a?r[n]=(...i)=>{const c=a(...i);return o(...i),c}:o&&(r[n]=o):n==="style"?r[n]={...o,...a}:n==="className"&&(r[n]=[o,a].filter(Boolean).join(" "))}return{...e,...r}}function Gi(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Ki=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ge=Ki.reduce((e,t)=>{const r=ds(`Primitive.${t}`),n=x.forwardRef((o,a)=>{const{asChild:l,...i}=o,c=l?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(c,{...i,ref:a})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function Yi(e,t){e&&To.flushSync(()=>e.dispatchEvent(t))}function at(e){const t=x.useRef(e);return x.useEffect(()=>{t.current=e}),x.useMemo(()=>(...r)=>t.current?.(...r),[])}function Zi(e,t=globalThis?.document){const r=at(e);x.useEffect(()=>{const n=o=>{o.key==="Escape"&&r(o)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var Xi="DismissableLayer",lr="dismissableLayer.update",Ji="dismissableLayer.pointerDownOutside",el="dismissableLayer.focusOutside",en,fs=x.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),hs=x.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:l,onDismiss:i,...c}=e,u=x.useContext(fs),[d,f]=x.useState(null),m=d?.ownerDocument??globalThis?.document,[,b]=x.useState({}),v=Fe(t,C=>f(C)),h=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),g=h.indexOf(y),S=d?h.indexOf(d):-1,k=u.layersWithOutsidePointerEventsDisabled.size>0,w=S>=g,N=nl(C=>{const j=C.target,O=[...u.branches].some(D=>D.contains(j));!w||O||(o?.(C),l?.(C),C.defaultPrevented||i?.())},m),A=sl(C=>{const j=C.target;[...u.branches].some(D=>D.contains(j))||(a?.(C),l?.(C),C.defaultPrevented||i?.())},m);return Zi(C=>{S===u.layers.size-1&&(n?.(C),!C.defaultPrevented&&i&&(C.preventDefault(),i()))},m),x.useEffect(()=>{if(d)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(en=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),tn(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=en)}},[d,m,r,u]),x.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),tn())},[d,u]),x.useEffect(()=>{const C=()=>b({});return document.addEventListener(lr,C),()=>document.removeEventListener(lr,C)},[]),s.jsx(ge.div,{...c,ref:v,style:{pointerEvents:k?w?"auto":"none":void 0,...e.style},onFocusCapture:Ee(e.onFocusCapture,A.onFocusCapture),onBlurCapture:Ee(e.onBlurCapture,A.onBlurCapture),onPointerDownCapture:Ee(e.onPointerDownCapture,N.onPointerDownCapture)})});hs.displayName=Xi;var tl="DismissableLayerBranch",rl=x.forwardRef((e,t)=>{const r=x.useContext(fs),n=x.useRef(null),o=Fe(t,n);return x.useEffect(()=>{const a=n.current;if(a)return r.branches.add(a),()=>{r.branches.delete(a)}},[r.branches]),s.jsx(ge.div,{...e,ref:o})});rl.displayName=tl;function nl(e,t=globalThis?.document){const r=at(e),n=x.useRef(!1),o=x.useRef(()=>{});return x.useEffect(()=>{const a=i=>{if(i.target&&!n.current){let c=function(){ms(Ji,r,u,{discrete:!0})};const u={originalEvent:i};i.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=c,t.addEventListener("click",o.current,{once:!0})):c()}else t.removeEventListener("click",o.current);n.current=!1},l=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(l),t.removeEventListener("pointerdown",a),t.removeEventListener("click",o.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function sl(e,t=globalThis?.document){const r=at(e),n=x.useRef(!1);return x.useEffect(()=>{const o=a=>{a.target&&!n.current&&ms(el,r,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function tn(){const e=new CustomEvent(lr);document.dispatchEvent(e)}function ms(e,t,r,{discrete:n}){const o=r.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&o.addEventListener(e,t,{once:!0}),n?Yi(o,a):o.dispatchEvent(a)}var Bt="focusScope.autoFocusOnMount",zt="focusScope.autoFocusOnUnmount",rn={bubbles:!1,cancelable:!0},ol="FocusScope",ps=x.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...l}=e,[i,c]=x.useState(null),u=at(o),d=at(a),f=x.useRef(null),m=Fe(t,h=>c(h)),b=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(n){let h=function(k){if(b.paused||!i)return;const w=k.target;i.contains(w)?f.current=w:Se(f.current,{select:!0})},y=function(k){if(b.paused||!i)return;const w=k.relatedTarget;w!==null&&(i.contains(w)||Se(f.current,{select:!0}))},g=function(k){if(document.activeElement===document.body)for(const N of k)N.removedNodes.length>0&&Se(i)};document.addEventListener("focusin",h),document.addEventListener("focusout",y);const S=new MutationObserver(g);return i&&S.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",h),document.removeEventListener("focusout",y),S.disconnect()}}},[n,i,b.paused]),x.useEffect(()=>{if(i){sn.add(b);const h=document.activeElement;if(!i.contains(h)){const g=new CustomEvent(Bt,rn);i.addEventListener(Bt,u),i.dispatchEvent(g),g.defaultPrevented||(al(dl(xs(i)),{select:!0}),document.activeElement===h&&Se(i))}return()=>{i.removeEventListener(Bt,u),setTimeout(()=>{const g=new CustomEvent(zt,rn);i.addEventListener(zt,d),i.dispatchEvent(g),g.defaultPrevented||Se(h??document.body,{select:!0}),i.removeEventListener(zt,d),sn.remove(b)},0)}}},[i,u,d,b]);const v=x.useCallback(h=>{if(!r&&!n||b.paused)return;const y=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,g=document.activeElement;if(y&&g){const S=h.currentTarget,[k,w]=il(S);k&&w?!h.shiftKey&&g===w?(h.preventDefault(),r&&Se(k,{select:!0})):h.shiftKey&&g===k&&(h.preventDefault(),r&&Se(w,{select:!0})):g===S&&h.preventDefault()}},[r,n,b.paused]);return s.jsx(ge.div,{tabIndex:-1,...l,ref:m,onKeyDown:v})});ps.displayName=ol;function al(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(Se(n,{select:t}),document.activeElement!==r)return}function il(e){const t=xs(e),r=nn(t,e),n=nn(t.reverse(),e);return[r,n]}function xs(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const o=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||o?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function nn(e,t){for(const r of e)if(!ll(r,{upTo:t}))return r}function ll(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 cl(e){return e instanceof HTMLInputElement&&"select"in e}function Se(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&cl(e)&&t&&e.select()}}var sn=ul();function ul(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=on(e,t),e.unshift(t)},remove(t){e=on(e,t),e[0]?.resume()}}}function on(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function dl(e){return e.filter(t=>t.tagName!=="A")}var fl="Portal",vs=x.forwardRef((e,t)=>{const{container:r,...n}=e,[o,a]=x.useState(!1);ot(()=>a(!0),[]);const l=r||o&&globalThis?.document?.body;return l?wn.createPortal(s.jsx(ge.div,{...n,ref:t}),l):null});vs.displayName=fl;function hl(e,t){return x.useReducer((r,n)=>t[r][n]??r,e)}var Ot=e=>{const{present:t,children:r}=e,n=ml(t),o=typeof r=="function"?r({present:n.isPresent}):x.Children.only(r),a=Fe(n.ref,pl(o));return typeof r=="function"||n.isPresent?x.cloneElement(o,{ref:a}):null};Ot.displayName="Presence";function ml(e){const[t,r]=x.useState(),n=x.useRef(null),o=x.useRef(e),a=x.useRef("none"),l=e?"mounted":"unmounted",[i,c]=hl(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return x.useEffect(()=>{const u=pt(n.current);a.current=i==="mounted"?u:"none"},[i]),ot(()=>{const u=n.current,d=o.current;if(d!==e){const m=a.current,b=pt(u);e?c("MOUNT"):b==="none"||u?.display==="none"?c("UNMOUNT"):c(d&&m!==b?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),ot(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=b=>{const h=pt(n.current).includes(CSS.escape(b.animationName));if(b.target===t&&h&&(c("ANIMATION_END"),!o.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},m=b=>{b.target===t&&(a.current=pt(n.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:x.useCallback(u=>{n.current=u?getComputedStyle(u):null,r(u)},[])}}function pt(e){return e?.animationName||"none"}function pl(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Wt=0;function xl(){x.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??an()),document.body.insertAdjacentElement("beforeend",e[1]??an()),Wt++,()=>{Wt===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Wt--}},[])}function an(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var me=function(){return me=Object.assign||function(t){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},me.apply(this,arguments)};function gs(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function vl(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,a;n<o;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))}var Ct="right-scroll-bar-position",kt="width-before-scroll-bar",gl="with-scroll-bars-hidden",bl="--removed-body-scroll-bar-size";function Vt(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function yl(e,t){var r=p.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(n){var o=r.value;o!==n&&(r.value=n,r.callback(n,o))}}}})[0];return r.callback=t,r.facade}var wl=typeof window<"u"?x.useLayoutEffect:x.useEffect,ln=new WeakMap;function Cl(e,t){var r=yl(null,function(n){return e.forEach(function(o){return Vt(o,n)})});return wl(function(){var n=ln.get(r);if(n){var o=new Set(n),a=new Set(e),l=r.current;o.forEach(function(i){a.has(i)||Vt(i,null)}),a.forEach(function(i){o.has(i)||Vt(i,l)})}ln.set(r,e)},[e]),r}function kl(e){return e}function jl(e,t){t===void 0&&(t=kl);var r=[],n=!1,o={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(a){var l=t(a,n);return r.push(l),function(){r=r.filter(function(i){return i!==l})}},assignSyncMedium:function(a){for(n=!0;r.length;){var l=r;r=[],l.forEach(a)}r={push:function(i){return a(i)},filter:function(){return r}}},assignMedium:function(a){n=!0;var l=[];if(r.length){var i=r;r=[],i.forEach(a),l=r}var c=function(){var d=l;l=[],d.forEach(a)},u=function(){return Promise.resolve().then(c)};u(),r={push:function(d){l.push(d),u()},filter:function(d){return l=l.filter(d),r}}}};return o}function Sl(e){e===void 0&&(e={});var t=jl(null);return t.options=me({async:!0,ssr:!1},e),t}var bs=function(e){var t=e.sideCar,r=gs(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw new Error("Sidecar medium not found");return x.createElement(n,me({},r))};bs.isSideCarExport=!0;function El(e,t){return e.useMedium(t),bs}var ys=Sl(),Ht=function(){},_t=x.forwardRef(function(e,t){var r=x.useRef(null),n=x.useState({onScrollCapture:Ht,onWheelCapture:Ht,onTouchMoveCapture:Ht}),o=n[0],a=n[1],l=e.forwardProps,i=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,m=e.sideCar,b=e.noRelative,v=e.noIsolation,h=e.inert,y=e.allowPinchZoom,g=e.as,S=g===void 0?"div":g,k=e.gapMode,w=gs(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),N=m,A=Cl([r,t]),C=me(me({},w),o);return x.createElement(x.Fragment,null,d&&x.createElement(N,{sideCar:ys,removeScrollBar:u,shards:f,noRelative:b,noIsolation:v,inert:h,setCallbacks:a,allowPinchZoom:!!y,lockRef:r,gapMode:k}),l?x.cloneElement(x.Children.only(i),me(me({},C),{ref:A})):x.createElement(S,me({},C,{className:c,ref:A}),i))});_t.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};_t.classNames={fullWidth:kt,zeroRight:Ct};var Nl=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Tl(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Nl();return t&&e.setAttribute("nonce",t),e}function Rl(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Ol(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var _l=function(){var e=0,t=null;return{add:function(r){e==0&&(t=Tl())&&(Rl(t,r),Ol(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Al=function(){var e=_l();return function(t,r){x.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},ws=function(){var e=Al(),t=function(r){var n=r.styles,o=r.dynamic;return e(n,o),null};return t},Pl={left:0,top:0,right:0,gap:0},Ut=function(e){return parseInt(e||"",10)||0},Ml=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],n=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[Ut(r),Ut(n),Ut(o)]},Il=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Pl;var t=Ml(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},Ll=ws(),qe="data-scroll-locked",Dl=function(e,t,r,n){var o=e.left,a=e.top,l=e.right,i=e.gap;return r===void 0&&(r="margin"),`
|
|
10
|
-
.`.concat(
|
|
9
|
+
`,disabled:f,...d,children:[n&&o.jsx(yi,{size:t}),!n&&s&&o.jsx("span",{className:"shrink-0",children:s}),c,!n&&a&&o.jsx("span",{className:"shrink-0",children:a})]})}function yi({size:e}){const t=e==="sm"?"h-4 w-4":"h-5 w-5";return o.jsx("div",{className:`${t} animate-spin rounded-[9999px] border-2 border-current border-t-transparent`})}function Os(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(r=Os(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function _s(){for(var e,t,r=0,n="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=Os(e))&&(n&&(n+=" "),n+=t);return n}const wi=(e,t)=>{const r=new Array(e.length+t.length);for(let n=0;n<e.length;n++)r[n]=e[n];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r},Ci=(e,t)=>({classGroupId:e,validator:t}),As=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),xr="-",An=[],ki="arbitrary..",ji=e=>{const t=Ei(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:c=>{if(c.startsWith("[")&&c.endsWith("]"))return Si(c);const i=c.split(xr),u=i[0]===""&&i.length>1?1:0;return Ms(i,u,t)},getConflictingClassGroupIds:(c,i)=>{if(i){const u=n[c],d=r[c];return u?d?wi(d,u):u:d||An}return r[c]||An}}},Ms=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const s=e[t],a=r.nextPart.get(s);if(a){const d=Ms(e,t+1,a);if(d)return d}const c=r.validators;if(c===null)return;const i=t===0?e.join(xr):e.slice(t).join(xr),u=c.length;for(let d=0;d<u;d++){const f=c[d];if(f.validator(i))return f.classGroupId}},Si=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?ki+n:void 0})(),Ei=e=>{const{theme:t,classGroups:r}=e;return Ni(r,t)},Ni=(e,t)=>{const r=As();for(const n in e){const s=e[n];un(s,r,n,t)}return r},un=(e,t,r,n)=>{const s=e.length;for(let a=0;a<s;a++){const c=e[a];Ti(c,t,r,n)}},Ti=(e,t,r,n)=>{if(typeof e=="string"){Ri(e,t,r);return}if(typeof e=="function"){Oi(e,t,r,n);return}_i(e,t,r,n)},Ri=(e,t,r)=>{const n=e===""?t:Ps(t,e);n.classGroupId=r},Oi=(e,t,r,n)=>{if(Ai(e)){un(e(n),t,r,n);return}t.validators===null&&(t.validators=[]),t.validators.push(Ci(r,e))},_i=(e,t,r,n)=>{const s=Object.entries(e),a=s.length;for(let c=0;c<a;c++){const[i,u]=s[c];un(u,Ps(t,i),r,n)}},Ps=(e,t)=>{let r=e;const n=t.split(xr),s=n.length;for(let a=0;a<s;a++){const c=n[a];let i=r.nextPart.get(c);i||(i=As(),r.nextPart.set(c,i)),r=i}return r},Ai=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Mi=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const s=(a,c)=>{r[a]=c,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(a){let c=r[a];if(c!==void 0)return c;if((c=n[a])!==void 0)return s(a,c),c},set(a,c){a in r?r[a]=c:s(a,c)}}},Yr="!",Mn=":",Pi=[],Pn=(e,t,r,n,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:s}),Ii=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=s=>{const a=[];let c=0,i=0,u=0,d;const f=s.length;for(let m=0;m<f;m++){const w=s[m];if(c===0&&i===0){if(w===Mn){a.push(s.slice(u,m)),u=m+1;continue}if(w==="/"){d=m;continue}}w==="["?c++:w==="]"?c--:w==="("?i++:w===")"&&i--}const h=a.length===0?s:s.slice(u);let p=h,y=!1;h.endsWith(Yr)?(p=h.slice(0,-1),y=!0):h.startsWith(Yr)&&(p=h.slice(1),y=!0);const v=d&&d>u?d-u:void 0;return Pn(a,y,p,v)};if(t){const s=t+Mn,a=n;n=c=>c.startsWith(s)?a(c.slice(s.length)):Pn(Pi,!1,c,void 0,!0)}if(r){const s=n;n=a=>r({className:a,parseClassName:s})}return n},Di=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,n)=>{t.set(r,1e6+n)}),r=>{const n=[];let s=[];for(let a=0;a<r.length;a++){const c=r[a],i=c[0]==="[",u=t.has(c);i||u?(s.length>0&&(s.sort(),n.push(...s),s=[]),n.push(c)):s.push(c)}return s.length>0&&(s.sort(),n.push(...s)),n}},Li=e=>({cache:Mi(e.cacheSize),parseClassName:Ii(e),sortModifiers:Di(e),...ji(e)}),Fi=/\s+/,Bi=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:s,sortModifiers:a}=t,c=[],i=e.trim().split(Fi);let u="";for(let d=i.length-1;d>=0;d-=1){const f=i[d],{isExternal:h,modifiers:p,hasImportantModifier:y,baseClassName:v,maybePostfixModifierPosition:m}=r(f);if(h){u=f+(u.length>0?" "+u:u);continue}let w=!!m,b=n(w?v.substring(0,m):v);if(!b){if(!w){u=f+(u.length>0?" "+u:u);continue}if(b=n(v),!b){u=f+(u.length>0?" "+u:u);continue}w=!1}const R=p.length===0?"":p.length===1?p[0]:a(p).join(":"),T=y?R+Yr:R,k=T+b;if(c.indexOf(k)>-1)continue;c.push(k);const A=s(b,w);for(let L=0;L<A.length;++L){const j=A[L];c.push(T+j)}u=f+(u.length>0?" "+u:u)}return u},$i=(...e)=>{let t=0,r,n,s="";for(;t<e.length;)(r=e[t++])&&(n=Is(r))&&(s&&(s+=" "),s+=n);return s},Is=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=Is(e[n]))&&(r&&(r+=" "),r+=t);return r},zi=(e,...t)=>{let r,n,s,a;const c=u=>{const d=t.reduce((f,h)=>h(f),e());return r=Li(d),n=r.cache.get,s=r.cache.set,a=i,i(u)},i=u=>{const d=n(u);if(d)return d;const f=Bi(u,r);return s(u,f),f};return a=c,(...u)=>a($i(...u))},Wi=[],fe=e=>{const t=r=>r[e]||Wi;return t.isThemeGetter=!0,t},Ds=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Ls=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Hi=/^\d+\/\d+$/,Vi=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ui=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,qi=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Qi=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Ki=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ft=e=>Hi.test(e),q=e=>!!e&&!Number.isNaN(Number(e)),Fe=e=>!!e&&Number.isInteger(Number(e)),Er=e=>e.endsWith("%")&&q(e.slice(0,-1)),De=e=>Vi.test(e),Gi=()=>!0,Yi=e=>Ui.test(e)&&!qi.test(e),Fs=()=>!1,Zi=e=>Qi.test(e),Xi=e=>Ki.test(e),Ji=e=>!P(e)&&!I(e),el=e=>wt(e,zs,Fs),P=e=>Ds.test(e),Qe=e=>wt(e,Ws,Yi),Nr=e=>wt(e,ol,q),In=e=>wt(e,Bs,Fs),tl=e=>wt(e,$s,Xi),nr=e=>wt(e,Hs,Zi),I=e=>Ls.test(e),jt=e=>Ct(e,Ws),rl=e=>Ct(e,al),Dn=e=>Ct(e,Bs),nl=e=>Ct(e,zs),sl=e=>Ct(e,$s),sr=e=>Ct(e,Hs,!0),wt=(e,t,r)=>{const n=Ds.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},Ct=(e,t,r=!1)=>{const n=Ls.exec(e);return n?n[1]?t(n[1]):r:!1},Bs=e=>e==="position"||e==="percentage",$s=e=>e==="image"||e==="url",zs=e=>e==="length"||e==="size"||e==="bg-size",Ws=e=>e==="length",ol=e=>e==="number",al=e=>e==="family-name",Hs=e=>e==="shadow",il=()=>{const e=fe("color"),t=fe("font"),r=fe("text"),n=fe("font-weight"),s=fe("tracking"),a=fe("leading"),c=fe("breakpoint"),i=fe("container"),u=fe("spacing"),d=fe("radius"),f=fe("shadow"),h=fe("inset-shadow"),p=fe("text-shadow"),y=fe("drop-shadow"),v=fe("blur"),m=fe("perspective"),w=fe("aspect"),b=fe("ease"),R=fe("animate"),T=()=>["auto","avoid","all","avoid-page","page","left","right","column"],k=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],A=()=>[...k(),I,P],L=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto","contain","none"],N=()=>[I,P,u],M=()=>[ft,"full","auto",...N()],U=()=>[Fe,"none","subgrid",I,P],W=()=>["auto",{span:["full",Fe,I,P]},Fe,I,P],K=()=>[Fe,"auto",I,P],D=()=>["auto","min","max","fr",I,P],X=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],J=()=>["start","end","center","stretch","center-safe","end-safe"],re=()=>["auto",...N()],te=()=>[ft,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...N()],_=()=>[e,I,P],oe=()=>[...k(),Dn,In,{position:[I,P]}],me=()=>["no-repeat",{repeat:["","x","y","space","round"]}],xe=()=>["auto","cover","contain",nl,el,{size:[I,P]}],ve=()=>[Er,jt,Qe],Y=()=>["","none","full",d,I,P],ne=()=>["",q,jt,Qe],ye=()=>["solid","dashed","dotted","double"],Te=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],F=()=>[q,Er,Dn,In],ke=()=>["","none",v,I,P],we=()=>["none",q,I,P],l=()=>["none",q,I,P],C=()=>[q,I,P],S=()=>[ft,"full",...N()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[De],breakpoint:[De],color:[Gi],container:[De],"drop-shadow":[De],ease:["in","out","in-out"],font:[Ji],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[De],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[De],shadow:[De],spacing:["px",q],text:[De],"text-shadow":[De],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ft,P,I,w]}],container:["container"],columns:[{columns:[q,P,I,i]}],"break-after":[{"break-after":T()}],"break-before":[{"break-before":T()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:A()}],overflow:[{overflow:L()}],"overflow-x":[{"overflow-x":L()}],"overflow-y":[{"overflow-y":L()}],overscroll:[{overscroll:j()}],"overscroll-x":[{"overscroll-x":j()}],"overscroll-y":[{"overscroll-y":j()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:M()}],"inset-x":[{"inset-x":M()}],"inset-y":[{"inset-y":M()}],start:[{start:M()}],end:[{end:M()}],top:[{top:M()}],right:[{right:M()}],bottom:[{bottom:M()}],left:[{left:M()}],visibility:["visible","invisible","collapse"],z:[{z:[Fe,"auto",I,P]}],basis:[{basis:[ft,"full","auto",i,...N()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[q,ft,"auto","initial","none",P]}],grow:[{grow:["",q,I,P]}],shrink:[{shrink:["",q,I,P]}],order:[{order:[Fe,"first","last","none",I,P]}],"grid-cols":[{"grid-cols":U()}],"col-start-end":[{col:W()}],"col-start":[{"col-start":K()}],"col-end":[{"col-end":K()}],"grid-rows":[{"grid-rows":U()}],"row-start-end":[{row:W()}],"row-start":[{"row-start":K()}],"row-end":[{"row-end":K()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":D()}],"auto-rows":[{"auto-rows":D()}],gap:[{gap:N()}],"gap-x":[{"gap-x":N()}],"gap-y":[{"gap-y":N()}],"justify-content":[{justify:[...X(),"normal"]}],"justify-items":[{"justify-items":[...J(),"normal"]}],"justify-self":[{"justify-self":["auto",...J()]}],"align-content":[{content:["normal",...X()]}],"align-items":[{items:[...J(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...J(),{baseline:["","last"]}]}],"place-content":[{"place-content":X()}],"place-items":[{"place-items":[...J(),"baseline"]}],"place-self":[{"place-self":["auto",...J()]}],p:[{p:N()}],px:[{px:N()}],py:[{py:N()}],ps:[{ps:N()}],pe:[{pe:N()}],pt:[{pt:N()}],pr:[{pr:N()}],pb:[{pb:N()}],pl:[{pl:N()}],m:[{m:re()}],mx:[{mx:re()}],my:[{my:re()}],ms:[{ms:re()}],me:[{me:re()}],mt:[{mt:re()}],mr:[{mr:re()}],mb:[{mb:re()}],ml:[{ml:re()}],"space-x":[{"space-x":N()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":N()}],"space-y-reverse":["space-y-reverse"],size:[{size:te()}],w:[{w:[i,"screen",...te()]}],"min-w":[{"min-w":[i,"screen","none",...te()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[c]},...te()]}],h:[{h:["screen","lh",...te()]}],"min-h":[{"min-h":["screen","lh","none",...te()]}],"max-h":[{"max-h":["screen","lh",...te()]}],"font-size":[{text:["base",r,jt,Qe]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,I,Nr]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Er,P]}],"font-family":[{font:[rl,P,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,I,P]}],"line-clamp":[{"line-clamp":[q,"none",I,Nr]}],leading:[{leading:[a,...N()]}],"list-image":[{"list-image":["none",I,P]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",I,P]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:_()}],"text-color":[{text:_()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ye(),"wavy"]}],"text-decoration-thickness":[{decoration:[q,"from-font","auto",I,Qe]}],"text-decoration-color":[{decoration:_()}],"underline-offset":[{"underline-offset":[q,"auto",I,P]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:N()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",I,P]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",I,P]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:oe()}],"bg-repeat":[{bg:me()}],"bg-size":[{bg:xe()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Fe,I,P],radial:["",I,P],conic:[Fe,I,P]},sl,tl]}],"bg-color":[{bg:_()}],"gradient-from-pos":[{from:ve()}],"gradient-via-pos":[{via:ve()}],"gradient-to-pos":[{to:ve()}],"gradient-from":[{from:_()}],"gradient-via":[{via:_()}],"gradient-to":[{to:_()}],rounded:[{rounded:Y()}],"rounded-s":[{"rounded-s":Y()}],"rounded-e":[{"rounded-e":Y()}],"rounded-t":[{"rounded-t":Y()}],"rounded-r":[{"rounded-r":Y()}],"rounded-b":[{"rounded-b":Y()}],"rounded-l":[{"rounded-l":Y()}],"rounded-ss":[{"rounded-ss":Y()}],"rounded-se":[{"rounded-se":Y()}],"rounded-ee":[{"rounded-ee":Y()}],"rounded-es":[{"rounded-es":Y()}],"rounded-tl":[{"rounded-tl":Y()}],"rounded-tr":[{"rounded-tr":Y()}],"rounded-br":[{"rounded-br":Y()}],"rounded-bl":[{"rounded-bl":Y()}],"border-w":[{border:ne()}],"border-w-x":[{"border-x":ne()}],"border-w-y":[{"border-y":ne()}],"border-w-s":[{"border-s":ne()}],"border-w-e":[{"border-e":ne()}],"border-w-t":[{"border-t":ne()}],"border-w-r":[{"border-r":ne()}],"border-w-b":[{"border-b":ne()}],"border-w-l":[{"border-l":ne()}],"divide-x":[{"divide-x":ne()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ne()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ye(),"hidden","none"]}],"divide-style":[{divide:[...ye(),"hidden","none"]}],"border-color":[{border:_()}],"border-color-x":[{"border-x":_()}],"border-color-y":[{"border-y":_()}],"border-color-s":[{"border-s":_()}],"border-color-e":[{"border-e":_()}],"border-color-t":[{"border-t":_()}],"border-color-r":[{"border-r":_()}],"border-color-b":[{"border-b":_()}],"border-color-l":[{"border-l":_()}],"divide-color":[{divide:_()}],"outline-style":[{outline:[...ye(),"none","hidden"]}],"outline-offset":[{"outline-offset":[q,I,P]}],"outline-w":[{outline:["",q,jt,Qe]}],"outline-color":[{outline:_()}],shadow:[{shadow:["","none",f,sr,nr]}],"shadow-color":[{shadow:_()}],"inset-shadow":[{"inset-shadow":["none",h,sr,nr]}],"inset-shadow-color":[{"inset-shadow":_()}],"ring-w":[{ring:ne()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:_()}],"ring-offset-w":[{"ring-offset":[q,Qe]}],"ring-offset-color":[{"ring-offset":_()}],"inset-ring-w":[{"inset-ring":ne()}],"inset-ring-color":[{"inset-ring":_()}],"text-shadow":[{"text-shadow":["none",p,sr,nr]}],"text-shadow-color":[{"text-shadow":_()}],opacity:[{opacity:[q,I,P]}],"mix-blend":[{"mix-blend":[...Te(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Te()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[q]}],"mask-image-linear-from-pos":[{"mask-linear-from":F()}],"mask-image-linear-to-pos":[{"mask-linear-to":F()}],"mask-image-linear-from-color":[{"mask-linear-from":_()}],"mask-image-linear-to-color":[{"mask-linear-to":_()}],"mask-image-t-from-pos":[{"mask-t-from":F()}],"mask-image-t-to-pos":[{"mask-t-to":F()}],"mask-image-t-from-color":[{"mask-t-from":_()}],"mask-image-t-to-color":[{"mask-t-to":_()}],"mask-image-r-from-pos":[{"mask-r-from":F()}],"mask-image-r-to-pos":[{"mask-r-to":F()}],"mask-image-r-from-color":[{"mask-r-from":_()}],"mask-image-r-to-color":[{"mask-r-to":_()}],"mask-image-b-from-pos":[{"mask-b-from":F()}],"mask-image-b-to-pos":[{"mask-b-to":F()}],"mask-image-b-from-color":[{"mask-b-from":_()}],"mask-image-b-to-color":[{"mask-b-to":_()}],"mask-image-l-from-pos":[{"mask-l-from":F()}],"mask-image-l-to-pos":[{"mask-l-to":F()}],"mask-image-l-from-color":[{"mask-l-from":_()}],"mask-image-l-to-color":[{"mask-l-to":_()}],"mask-image-x-from-pos":[{"mask-x-from":F()}],"mask-image-x-to-pos":[{"mask-x-to":F()}],"mask-image-x-from-color":[{"mask-x-from":_()}],"mask-image-x-to-color":[{"mask-x-to":_()}],"mask-image-y-from-pos":[{"mask-y-from":F()}],"mask-image-y-to-pos":[{"mask-y-to":F()}],"mask-image-y-from-color":[{"mask-y-from":_()}],"mask-image-y-to-color":[{"mask-y-to":_()}],"mask-image-radial":[{"mask-radial":[I,P]}],"mask-image-radial-from-pos":[{"mask-radial-from":F()}],"mask-image-radial-to-pos":[{"mask-radial-to":F()}],"mask-image-radial-from-color":[{"mask-radial-from":_()}],"mask-image-radial-to-color":[{"mask-radial-to":_()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":k()}],"mask-image-conic-pos":[{"mask-conic":[q]}],"mask-image-conic-from-pos":[{"mask-conic-from":F()}],"mask-image-conic-to-pos":[{"mask-conic-to":F()}],"mask-image-conic-from-color":[{"mask-conic-from":_()}],"mask-image-conic-to-color":[{"mask-conic-to":_()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:oe()}],"mask-repeat":[{mask:me()}],"mask-size":[{mask:xe()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",I,P]}],filter:[{filter:["","none",I,P]}],blur:[{blur:ke()}],brightness:[{brightness:[q,I,P]}],contrast:[{contrast:[q,I,P]}],"drop-shadow":[{"drop-shadow":["","none",y,sr,nr]}],"drop-shadow-color":[{"drop-shadow":_()}],grayscale:[{grayscale:["",q,I,P]}],"hue-rotate":[{"hue-rotate":[q,I,P]}],invert:[{invert:["",q,I,P]}],saturate:[{saturate:[q,I,P]}],sepia:[{sepia:["",q,I,P]}],"backdrop-filter":[{"backdrop-filter":["","none",I,P]}],"backdrop-blur":[{"backdrop-blur":ke()}],"backdrop-brightness":[{"backdrop-brightness":[q,I,P]}],"backdrop-contrast":[{"backdrop-contrast":[q,I,P]}],"backdrop-grayscale":[{"backdrop-grayscale":["",q,I,P]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[q,I,P]}],"backdrop-invert":[{"backdrop-invert":["",q,I,P]}],"backdrop-opacity":[{"backdrop-opacity":[q,I,P]}],"backdrop-saturate":[{"backdrop-saturate":[q,I,P]}],"backdrop-sepia":[{"backdrop-sepia":["",q,I,P]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":N()}],"border-spacing-x":[{"border-spacing-x":N()}],"border-spacing-y":[{"border-spacing-y":N()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",I,P]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[q,"initial",I,P]}],ease:[{ease:["linear","initial",b,I,P]}],delay:[{delay:[q,I,P]}],animate:[{animate:["none",R,I,P]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,I,P]}],"perspective-origin":[{"perspective-origin":A()}],rotate:[{rotate:we()}],"rotate-x":[{"rotate-x":we()}],"rotate-y":[{"rotate-y":we()}],"rotate-z":[{"rotate-z":we()}],scale:[{scale:l()}],"scale-x":[{"scale-x":l()}],"scale-y":[{"scale-y":l()}],"scale-z":[{"scale-z":l()}],"scale-3d":["scale-3d"],skew:[{skew:C()}],"skew-x":[{"skew-x":C()}],"skew-y":[{"skew-y":C()}],transform:[{transform:[I,P,"","none","gpu","cpu"]}],"transform-origin":[{origin:A()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:S()}],"translate-x":[{"translate-x":S()}],"translate-y":[{"translate-y":S()}],"translate-z":[{"translate-z":S()}],"translate-none":["translate-none"],accent:[{accent:_()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:_()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",I,P]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":N()}],"scroll-mx":[{"scroll-mx":N()}],"scroll-my":[{"scroll-my":N()}],"scroll-ms":[{"scroll-ms":N()}],"scroll-me":[{"scroll-me":N()}],"scroll-mt":[{"scroll-mt":N()}],"scroll-mr":[{"scroll-mr":N()}],"scroll-mb":[{"scroll-mb":N()}],"scroll-ml":[{"scroll-ml":N()}],"scroll-p":[{"scroll-p":N()}],"scroll-px":[{"scroll-px":N()}],"scroll-py":[{"scroll-py":N()}],"scroll-ps":[{"scroll-ps":N()}],"scroll-pe":[{"scroll-pe":N()}],"scroll-pt":[{"scroll-pt":N()}],"scroll-pr":[{"scroll-pr":N()}],"scroll-pb":[{"scroll-pb":N()}],"scroll-pl":[{"scroll-pl":N()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",I,P]}],fill:[{fill:["none",..._()]}],"stroke-w":[{stroke:[q,jt,Qe,Nr]}],stroke:[{stroke:["none",..._()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Vs=zi(il);function Us(...e){return Vs(_s(e))}function ll({children:e,isOpen:t}){return o.jsx("div",{className:"collapsible-grid","data-state":t?"open":"closed",children:o.jsx("div",{className:"collapsible-content",children:e})})}function cl({state:e,onConfirm:t,confirmText:r="Confirm",processingText:n="Processing...",successText:s="Done",errorText:a="Retry"}){const c=e==="processing",i=()=>{switch(e){case"processing":return n;case"success":return s;case"error":return a;default:return r}};return o.jsx(cn,{variant:"primary",size:"xl",fullWidth:!0,onClick:t,isLoading:c,children:i()})}function $e(e,t,{checkForDefaultPrevented:r=!0}={}){return function(s){if(e?.(s),r===!1||!s.defaultPrevented)return t?.(s)}}function Ln(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function qs(...e){return t=>{let r=!1;const n=e.map(s=>{const a=Ln(s,t);return!r&&typeof a=="function"&&(r=!0),a});if(r)return()=>{for(let s=0;s<n.length;s++){const a=n[s];typeof a=="function"?a():Ln(e[s],null)}}}}function et(...e){return g.useCallback(qs(...e),e)}function ul(e,t){const r=g.createContext(t),n=a=>{const{children:c,...i}=a,u=g.useMemo(()=>i,Object.values(i));return o.jsx(r.Provider,{value:u,children:c})};n.displayName=e+"Provider";function s(a){const c=g.useContext(r);if(c)return c;if(t!==void 0)return t;throw new Error(`\`${a}\` must be used within \`${e}\``)}return[n,s]}function dl(e,t=[]){let r=[];function n(a,c){const i=g.createContext(c),u=r.length;r=[...r,c];const d=h=>{const{scope:p,children:y,...v}=h,m=p?.[e]?.[u]||i,w=g.useMemo(()=>v,Object.values(v));return o.jsx(m.Provider,{value:w,children:y})};d.displayName=a+"Provider";function f(h,p){const y=p?.[e]?.[u]||i,v=g.useContext(y);if(v)return v;if(c!==void 0)return c;throw new Error(`\`${h}\` must be used within \`${a}\``)}return[d,f]}const s=()=>{const a=r.map(c=>g.createContext(c));return function(i){const u=i?.[e]||a;return g.useMemo(()=>({[`__scope${e}`]:{...i,[e]:u}}),[i,u])}};return s.scopeName=e,[n,fl(s,...t)]}function fl(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(a){const c=n.reduce((i,{useScope:u,scopeName:d})=>{const h=u(a)[`__scope${d}`];return{...i,...h}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:c}),[c])}};return r.scopeName=t.scopeName,r}var Ot=globalThis?.document?g.useLayoutEffect:()=>{},hl=g[" useId ".trim().toString()]||(()=>{}),ml=0;function Tr(e){const[t,r]=g.useState(hl());return Ot(()=>{r(n=>n??String(ml++))},[e]),e||(t?`radix-${t}`:"")}var pl=g[" useInsertionEffect ".trim().toString()]||Ot;function xl({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[s,a,c]=vl({defaultProp:t,onChange:r}),i=e!==void 0,u=i?e:s;{const f=g.useRef(e!==void 0);g.useEffect(()=>{const h=f.current;h!==i&&console.warn(`${n} is changing from ${h?"controlled":"uncontrolled"} to ${i?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=i},[i,n])}const d=g.useCallback(f=>{if(i){const h=gl(f)?f(e):f;h!==e&&c.current?.(h)}else a(f)},[i,e,a,c]);return[u,d]}function vl({defaultProp:e,onChange:t}){const[r,n]=g.useState(e),s=g.useRef(r),a=g.useRef(t);return pl(()=>{a.current=t},[t]),g.useEffect(()=>{s.current!==r&&(a.current?.(r),s.current=r)},[r,s]),[r,n,a]}function gl(e){return typeof e=="function"}function Qs(e){const t=bl(e),r=g.forwardRef((n,s)=>{const{children:a,...c}=n,i=g.Children.toArray(a),u=i.find(wl);if(u){const d=u.props.children,f=i.map(h=>h===u?g.Children.count(d)>1?g.Children.only(null):g.isValidElement(d)?d.props.children:null:h);return o.jsx(t,{...c,ref:s,children:g.isValidElement(d)?g.cloneElement(d,void 0,f):null})}return o.jsx(t,{...c,ref:s,children:a})});return r.displayName=`${e}.Slot`,r}function bl(e){const t=g.forwardRef((r,n)=>{const{children:s,...a}=r;if(g.isValidElement(s)){const c=kl(s),i=Cl(a,s.props);return s.type!==g.Fragment&&(i.ref=n?qs(n,c):c),g.cloneElement(s,i)}return g.Children.count(s)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var yl=Symbol("radix.slottable");function wl(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===yl}function Cl(e,t){const r={...t};for(const n in t){const s=e[n],a=t[n];/^on[A-Z]/.test(n)?s&&a?r[n]=(...i)=>{const u=a(...i);return s(...i),u}:s&&(r[n]=s):n==="style"?r[n]={...s,...a}:n==="className"&&(r[n]=[s,a].filter(Boolean).join(" "))}return{...e,...r}}function kl(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var jl=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Le=jl.reduce((e,t)=>{const r=Qs(`Primitive.${t}`),n=g.forwardRef((s,a)=>{const{asChild:c,...i}=s,u=c?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(u,{...i,ref:a})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function Sl(e,t){e&&Zo.flushSync(()=>e.dispatchEvent(t))}function _t(e){const t=g.useRef(e);return g.useEffect(()=>{t.current=e}),g.useMemo(()=>(...r)=>t.current?.(...r),[])}function El(e,t=globalThis?.document){const r=_t(e);g.useEffect(()=>{const n=s=>{s.key==="Escape"&&r(s)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var Nl="DismissableLayer",Zr="dismissableLayer.update",Tl="dismissableLayer.pointerDownOutside",Rl="dismissableLayer.focusOutside",Fn,Ks=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Gs=g.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:s,onFocusOutside:a,onInteractOutside:c,onDismiss:i,...u}=e,d=g.useContext(Ks),[f,h]=g.useState(null),p=f?.ownerDocument??globalThis?.document,[,y]=g.useState({}),v=et(t,j=>h(j)),m=Array.from(d.layers),[w]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=m.indexOf(w),R=f?m.indexOf(f):-1,T=d.layersWithOutsidePointerEventsDisabled.size>0,k=R>=b,A=Al(j=>{const N=j.target,M=[...d.branches].some(U=>U.contains(N));!k||M||(s?.(j),c?.(j),j.defaultPrevented||i?.())},p),L=Ml(j=>{const N=j.target;[...d.branches].some(U=>U.contains(N))||(a?.(j),c?.(j),j.defaultPrevented||i?.())},p);return El(j=>{R===d.layers.size-1&&(n?.(j),!j.defaultPrevented&&i&&(j.preventDefault(),i()))},p),g.useEffect(()=>{if(f)return r&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(Fn=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),Bn(),()=>{r&&d.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=Fn)}},[f,p,r,d]),g.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),Bn())},[f,d]),g.useEffect(()=>{const j=()=>y({});return document.addEventListener(Zr,j),()=>document.removeEventListener(Zr,j)},[]),o.jsx(Le.div,{...u,ref:v,style:{pointerEvents:T?k?"auto":"none":void 0,...e.style},onFocusCapture:$e(e.onFocusCapture,L.onFocusCapture),onBlurCapture:$e(e.onBlurCapture,L.onBlurCapture),onPointerDownCapture:$e(e.onPointerDownCapture,A.onPointerDownCapture)})});Gs.displayName=Nl;var Ol="DismissableLayerBranch",_l=g.forwardRef((e,t)=>{const r=g.useContext(Ks),n=g.useRef(null),s=et(t,n);return g.useEffect(()=>{const a=n.current;if(a)return r.branches.add(a),()=>{r.branches.delete(a)}},[r.branches]),o.jsx(Le.div,{...e,ref:s})});_l.displayName=Ol;function Al(e,t=globalThis?.document){const r=_t(e),n=g.useRef(!1),s=g.useRef(()=>{});return g.useEffect(()=>{const a=i=>{if(i.target&&!n.current){let u=function(){Ys(Tl,r,d,{discrete:!0})};const d={originalEvent:i};i.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=u,t.addEventListener("click",s.current,{once:!0})):u()}else t.removeEventListener("click",s.current);n.current=!1},c=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(c),t.removeEventListener("pointerdown",a),t.removeEventListener("click",s.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function Ml(e,t=globalThis?.document){const r=_t(e),n=g.useRef(!1);return g.useEffect(()=>{const s=a=>{a.target&&!n.current&&Ys(Rl,r,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function Bn(){const e=new CustomEvent(Zr);document.dispatchEvent(e)}function Ys(e,t,r,{discrete:n}){const s=r.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&s.addEventListener(e,t,{once:!0}),n?Sl(s,a):s.dispatchEvent(a)}var Rr="focusScope.autoFocusOnMount",Or="focusScope.autoFocusOnUnmount",$n={bubbles:!1,cancelable:!0},Pl="FocusScope",Zs=g.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:s,onUnmountAutoFocus:a,...c}=e,[i,u]=g.useState(null),d=_t(s),f=_t(a),h=g.useRef(null),p=et(t,m=>u(m)),y=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(n){let m=function(T){if(y.paused||!i)return;const k=T.target;i.contains(k)?h.current=k:Be(h.current,{select:!0})},w=function(T){if(y.paused||!i)return;const k=T.relatedTarget;k!==null&&(i.contains(k)||Be(h.current,{select:!0}))},b=function(T){if(document.activeElement===document.body)for(const A of T)A.removedNodes.length>0&&Be(i)};document.addEventListener("focusin",m),document.addEventListener("focusout",w);const R=new MutationObserver(b);return i&&R.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",w),R.disconnect()}}},[n,i,y.paused]),g.useEffect(()=>{if(i){Wn.add(y);const m=document.activeElement;if(!i.contains(m)){const b=new CustomEvent(Rr,$n);i.addEventListener(Rr,d),i.dispatchEvent(b),b.defaultPrevented||(Il($l(Xs(i)),{select:!0}),document.activeElement===m&&Be(i))}return()=>{i.removeEventListener(Rr,d),setTimeout(()=>{const b=new CustomEvent(Or,$n);i.addEventListener(Or,f),i.dispatchEvent(b),b.defaultPrevented||Be(m??document.body,{select:!0}),i.removeEventListener(Or,f),Wn.remove(y)},0)}}},[i,d,f,y]);const v=g.useCallback(m=>{if(!r&&!n||y.paused)return;const w=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,b=document.activeElement;if(w&&b){const R=m.currentTarget,[T,k]=Dl(R);T&&k?!m.shiftKey&&b===k?(m.preventDefault(),r&&Be(T,{select:!0})):m.shiftKey&&b===T&&(m.preventDefault(),r&&Be(k,{select:!0})):b===R&&m.preventDefault()}},[r,n,y.paused]);return o.jsx(Le.div,{tabIndex:-1,...c,ref:p,onKeyDown:v})});Zs.displayName=Pl;function Il(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(Be(n,{select:t}),document.activeElement!==r)return}function Dl(e){const t=Xs(e),r=zn(t,e),n=zn(t.reverse(),e);return[r,n]}function Xs(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const s=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||s?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function zn(e,t){for(const r of e)if(!Ll(r,{upTo:t}))return r}function Ll(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 Fl(e){return e instanceof HTMLInputElement&&"select"in e}function Be(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&Fl(e)&&t&&e.select()}}var Wn=Bl();function Bl(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=Hn(e,t),e.unshift(t)},remove(t){e=Hn(e,t),e[0]?.resume()}}}function Hn(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function $l(e){return e.filter(t=>t.tagName!=="A")}var zl="Portal",Js=g.forwardRef((e,t)=>{const{container:r,...n}=e,[s,a]=g.useState(!1);Ot(()=>a(!0),[]);const c=r||s&&globalThis?.document?.body;return c?ss.createPortal(o.jsx(Le.div,{...n,ref:t}),c):null});Js.displayName=zl;function Wl(e,t){return g.useReducer((r,n)=>t[r][n]??r,e)}var br=e=>{const{present:t,children:r}=e,n=Hl(t),s=typeof r=="function"?r({present:n.isPresent}):g.Children.only(r),a=et(n.ref,Vl(s));return typeof r=="function"||n.isPresent?g.cloneElement(s,{ref:a}):null};br.displayName="Presence";function Hl(e){const[t,r]=g.useState(),n=g.useRef(null),s=g.useRef(e),a=g.useRef("none"),c=e?"mounted":"unmounted",[i,u]=Wl(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{const d=or(n.current);a.current=i==="mounted"?d:"none"},[i]),Ot(()=>{const d=n.current,f=s.current;if(f!==e){const p=a.current,y=or(d);e?u("MOUNT"):y==="none"||d?.display==="none"?u("UNMOUNT"):u(f&&p!==y?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,u]),Ot(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,h=y=>{const m=or(n.current).includes(CSS.escape(y.animationName));if(y.target===t&&m&&(u("ANIMATION_END"),!s.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",d=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},p=y=>{y.target===t&&(a.current=or(n.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{f.clearTimeout(d),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:g.useCallback(d=>{n.current=d?getComputedStyle(d):null,r(d)},[])}}function or(e){return e?.animationName||"none"}function Vl(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var _r=0;function Ul(){g.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Vn()),document.body.insertAdjacentElement("beforeend",e[1]??Vn()),_r++,()=>{_r===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),_r--}},[])}function Vn(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Me=function(){return Me=Object.assign||function(t){for(var r,n=1,s=arguments.length;n<s;n++){r=arguments[n];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},Me.apply(this,arguments)};function eo(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(r[n[s]]=e[n[s]]);return r}function ql(e,t,r){if(r||arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))}var fr="right-scroll-bar-position",hr="width-before-scroll-bar",Ql="with-scroll-bars-hidden",Kl="--removed-body-scroll-bar-size";function Ar(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Gl(e,t){var r=x.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(n){var s=r.value;s!==n&&(r.value=n,r.callback(n,s))}}}})[0];return r.callback=t,r.facade}var Yl=typeof window<"u"?g.useLayoutEffect:g.useEffect,Un=new WeakMap;function Zl(e,t){var r=Gl(null,function(n){return e.forEach(function(s){return Ar(s,n)})});return Yl(function(){var n=Un.get(r);if(n){var s=new Set(n),a=new Set(e),c=r.current;s.forEach(function(i){a.has(i)||Ar(i,null)}),a.forEach(function(i){s.has(i)||Ar(i,c)})}Un.set(r,e)},[e]),r}function Xl(e){return e}function Jl(e,t){t===void 0&&(t=Xl);var r=[],n=!1,s={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(a){var c=t(a,n);return r.push(c),function(){r=r.filter(function(i){return i!==c})}},assignSyncMedium:function(a){for(n=!0;r.length;){var c=r;r=[],c.forEach(a)}r={push:function(i){return a(i)},filter:function(){return r}}},assignMedium:function(a){n=!0;var c=[];if(r.length){var i=r;r=[],i.forEach(a),c=r}var u=function(){var f=c;c=[],f.forEach(a)},d=function(){return Promise.resolve().then(u)};d(),r={push:function(f){c.push(f),d()},filter:function(f){return c=c.filter(f),r}}}};return s}function ec(e){e===void 0&&(e={});var t=Jl(null);return t.options=Me({async:!0,ssr:!1},e),t}var to=function(e){var t=e.sideCar,r=eo(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw new Error("Sidecar medium not found");return g.createElement(n,Me({},r))};to.isSideCarExport=!0;function tc(e,t){return e.useMedium(t),to}var ro=ec(),Mr=function(){},yr=g.forwardRef(function(e,t){var r=g.useRef(null),n=g.useState({onScrollCapture:Mr,onWheelCapture:Mr,onTouchMoveCapture:Mr}),s=n[0],a=n[1],c=e.forwardProps,i=e.children,u=e.className,d=e.removeScrollBar,f=e.enabled,h=e.shards,p=e.sideCar,y=e.noRelative,v=e.noIsolation,m=e.inert,w=e.allowPinchZoom,b=e.as,R=b===void 0?"div":b,T=e.gapMode,k=eo(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),A=p,L=Zl([r,t]),j=Me(Me({},k),s);return g.createElement(g.Fragment,null,f&&g.createElement(A,{sideCar:ro,removeScrollBar:d,shards:h,noRelative:y,noIsolation:v,inert:m,setCallbacks:a,allowPinchZoom:!!w,lockRef:r,gapMode:T}),c?g.cloneElement(g.Children.only(i),Me(Me({},j),{ref:L})):g.createElement(R,Me({},j,{className:u,ref:L}),i))});yr.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};yr.classNames={fullWidth:hr,zeroRight:fr};var rc=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function nc(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=rc();return t&&e.setAttribute("nonce",t),e}function sc(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function oc(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var ac=function(){var e=0,t=null;return{add:function(r){e==0&&(t=nc())&&(sc(t,r),oc(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},ic=function(){var e=ac();return function(t,r){g.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},no=function(){var e=ic(),t=function(r){var n=r.styles,s=r.dynamic;return e(n,s),null};return t},lc={left:0,top:0,right:0,gap:0},Pr=function(e){return parseInt(e||"",10)||0},cc=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],n=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[Pr(r),Pr(n),Pr(s)]},uc=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return lc;var t=cc(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},dc=no(),gt="data-scroll-locked",fc=function(e,t,r,n){var s=e.left,a=e.top,c=e.right,i=e.gap;return r===void 0&&(r="margin"),`
|
|
10
|
+
.`.concat(Ql,` {
|
|
11
11
|
overflow: hidden `).concat(n,`;
|
|
12
12
|
padding-right: `).concat(i,"px ").concat(n,`;
|
|
13
13
|
}
|
|
14
|
-
body[`).concat(
|
|
14
|
+
body[`).concat(gt,`] {
|
|
15
15
|
overflow: hidden `).concat(n,`;
|
|
16
16
|
overscroll-behavior: contain;
|
|
17
17
|
`).concat([t&&"position: relative ".concat(n,";"),r==="margin"&&`
|
|
18
|
-
padding-left: `.concat(
|
|
18
|
+
padding-left: `.concat(s,`px;
|
|
19
19
|
padding-top: `).concat(a,`px;
|
|
20
|
-
padding-right: `).concat(
|
|
20
|
+
padding-right: `).concat(c,`px;
|
|
21
21
|
margin-left:0;
|
|
22
22
|
margin-top:0;
|
|
23
23
|
margin-right: `).concat(i,"px ").concat(n,`;
|
|
24
24
|
`),r==="padding"&&"padding-right: ".concat(i,"px ").concat(n,";")].filter(Boolean).join(""),`
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
.`).concat(
|
|
27
|
+
.`).concat(fr,` {
|
|
28
28
|
right: `).concat(i,"px ").concat(n,`;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
.`).concat(
|
|
31
|
+
.`).concat(hr,` {
|
|
32
32
|
margin-right: `).concat(i,"px ").concat(n,`;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
.`).concat(
|
|
35
|
+
.`).concat(fr," .").concat(fr,` {
|
|
36
36
|
right: 0 `).concat(n,`;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
.`).concat(
|
|
39
|
+
.`).concat(hr," .").concat(hr,` {
|
|
40
40
|
margin-right: 0 `).concat(n,`;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
body[`).concat(
|
|
44
|
-
`).concat(
|
|
43
|
+
body[`).concat(gt,`] {
|
|
44
|
+
`).concat(Kl,": ").concat(i,`px;
|
|
45
45
|
}
|
|
46
|
-
`)},
|
|
46
|
+
`)},qn=function(){var e=parseInt(document.body.getAttribute(gt)||"0",10);return isFinite(e)?e:0},hc=function(){g.useEffect(function(){return document.body.setAttribute(gt,(qn()+1).toString()),function(){var e=qn()-1;e<=0?document.body.removeAttribute(gt):document.body.setAttribute(gt,e.toString())}},[])},mc=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,s=n===void 0?"margin":n;hc();var a=g.useMemo(function(){return uc(s)},[s]);return g.createElement(dc,{styles:fc(a,!t,s,r?"":"!important")})},Xr=!1;if(typeof window<"u")try{var ar=Object.defineProperty({},"passive",{get:function(){return Xr=!0,!0}});window.addEventListener("test",ar,ar),window.removeEventListener("test",ar,ar)}catch{Xr=!1}var ht=Xr?{passive:!1}:!1,pc=function(e){return e.tagName==="TEXTAREA"},so=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!pc(e)&&r[t]==="visible")},xc=function(e){return so(e,"overflowY")},vc=function(e){return so(e,"overflowX")},Qn=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var s=oo(e,n);if(s){var a=ao(e,n),c=a[1],i=a[2];if(c>i)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},gc=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},bc=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},oo=function(e,t){return e==="v"?xc(t):vc(t)},ao=function(e,t){return e==="v"?gc(t):bc(t)},yc=function(e,t){return e==="h"&&t==="rtl"?-1:1},wc=function(e,t,r,n,s){var a=yc(e,window.getComputedStyle(t).direction),c=a*n,i=r.target,u=t.contains(i),d=!1,f=c>0,h=0,p=0;do{if(!i)break;var y=ao(e,i),v=y[0],m=y[1],w=y[2],b=m-w-a*v;(v||b)&&oo(e,i)&&(h+=b,p+=v);var R=i.parentNode;i=R&&R.nodeType===Node.DOCUMENT_FRAGMENT_NODE?R.host:R}while(!u&&i!==document.body||u&&(t.contains(i)||t===i));return(f&&Math.abs(h)<1||!f&&Math.abs(p)<1)&&(d=!0),d},ir=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Kn=function(e){return[e.deltaX,e.deltaY]},Gn=function(e){return e&&"current"in e?e.current:e},Cc=function(e,t){return e[0]===t[0]&&e[1]===t[1]},kc=function(e){return`
|
|
47
47
|
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
48
48
|
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
49
|
-
`)},
|
|
49
|
+
`)},jc=0,mt=[];function Sc(e){var t=g.useRef([]),r=g.useRef([0,0]),n=g.useRef(),s=g.useState(jc++)[0],a=g.useState(no)[0],c=g.useRef(e);g.useEffect(function(){c.current=e},[e]),g.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var m=ql([e.lockRef.current],(e.shards||[]).map(Gn),!0).filter(Boolean);return m.forEach(function(w){return w.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),m.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var i=g.useCallback(function(m,w){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!c.current.allowPinchZoom;var b=ir(m),R=r.current,T="deltaX"in m?m.deltaX:R[0]-b[0],k="deltaY"in m?m.deltaY:R[1]-b[1],A,L=m.target,j=Math.abs(T)>Math.abs(k)?"h":"v";if("touches"in m&&j==="h"&&L.type==="range")return!1;var N=window.getSelection(),M=N&&N.anchorNode,U=M?M===L||M.contains(L):!1;if(U)return!1;var W=Qn(j,L);if(!W)return!0;if(W?A=j:(A=j==="v"?"h":"v",W=Qn(j,L)),!W)return!1;if(!n.current&&"changedTouches"in m&&(T||k)&&(n.current=A),!A)return!0;var K=n.current||A;return wc(K,w,m,K==="h"?T:k)},[]),u=g.useCallback(function(m){var w=m;if(!(!mt.length||mt[mt.length-1]!==a)){var b="deltaY"in w?Kn(w):ir(w),R=t.current.filter(function(A){return A.name===w.type&&(A.target===w.target||w.target===A.shadowParent)&&Cc(A.delta,b)})[0];if(R&&R.should){w.cancelable&&w.preventDefault();return}if(!R){var T=(c.current.shards||[]).map(Gn).filter(Boolean).filter(function(A){return A.contains(w.target)}),k=T.length>0?i(w,T[0]):!c.current.noIsolation;k&&w.cancelable&&w.preventDefault()}}},[]),d=g.useCallback(function(m,w,b,R){var T={name:m,delta:w,target:b,should:R,shadowParent:Ec(b)};t.current.push(T),setTimeout(function(){t.current=t.current.filter(function(k){return k!==T})},1)},[]),f=g.useCallback(function(m){r.current=ir(m),n.current=void 0},[]),h=g.useCallback(function(m){d(m.type,Kn(m),m.target,i(m,e.lockRef.current))},[]),p=g.useCallback(function(m){d(m.type,ir(m),m.target,i(m,e.lockRef.current))},[]);g.useEffect(function(){return mt.push(a),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:p}),document.addEventListener("wheel",u,ht),document.addEventListener("touchmove",u,ht),document.addEventListener("touchstart",f,ht),function(){mt=mt.filter(function(m){return m!==a}),document.removeEventListener("wheel",u,ht),document.removeEventListener("touchmove",u,ht),document.removeEventListener("touchstart",f,ht)}},[]);var y=e.removeScrollBar,v=e.inert;return g.createElement(g.Fragment,null,v?g.createElement(a,{styles:kc(s)}):null,y?g.createElement(mc,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Ec(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Nc=tc(ro,Sc);var io=g.forwardRef(function(e,t){return g.createElement(yr,Me({},e,{ref:t,sideCar:Nc}))});io.classNames=yr.classNames;var Tc=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},pt=new WeakMap,lr=new WeakMap,cr={},Ir=0,lo=function(e){return e&&(e.host||lo(e.parentNode))},Rc=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=lo(r);return n&&e.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},Oc=function(e,t,r,n){var s=Rc(t,Array.isArray(e)?e:[e]);cr[r]||(cr[r]=new WeakMap);var a=cr[r],c=[],i=new Set,u=new Set(s),d=function(h){!h||i.has(h)||(i.add(h),d(h.parentNode))};s.forEach(d);var f=function(h){!h||u.has(h)||Array.prototype.forEach.call(h.children,function(p){if(i.has(p))f(p);else try{var y=p.getAttribute(n),v=y!==null&&y!=="false",m=(pt.get(p)||0)+1,w=(a.get(p)||0)+1;pt.set(p,m),a.set(p,w),c.push(p),m===1&&v&&lr.set(p,!0),w===1&&p.setAttribute(r,"true"),v||p.setAttribute(n,"true")}catch(b){console.error("aria-hidden: cannot operate on ",p,b)}})};return f(t),i.clear(),Ir++,function(){c.forEach(function(h){var p=pt.get(h)-1,y=a.get(h)-1;pt.set(h,p),a.set(h,y),p||(lr.has(h)||h.removeAttribute(n),lr.delete(h)),y||h.removeAttribute(r)}),Ir--,Ir||(pt=new WeakMap,pt=new WeakMap,lr=new WeakMap,cr={})}},_c=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),s=Tc(e);return s?(n.push.apply(n,Array.from(s.querySelectorAll("[aria-live], script"))),Oc(n,s,r,"aria-hidden")):function(){return null}},wr="Dialog",[co]=dl(wr),[Ac,Oe]=co(wr),uo=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:s,onOpenChange:a,modal:c=!0}=e,i=g.useRef(null),u=g.useRef(null),[d,f]=xl({prop:n,defaultProp:s??!1,onChange:a,caller:wr});return o.jsx(Ac,{scope:t,triggerRef:i,contentRef:u,contentId:Tr(),titleId:Tr(),descriptionId:Tr(),open:d,onOpenChange:f,onOpenToggle:g.useCallback(()=>f(h=>!h),[f]),modal:c,children:r})};uo.displayName=wr;var fo="DialogTrigger",Mc=g.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Oe(fo,r),a=et(t,s.triggerRef);return o.jsx(Le.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":hn(s.open),...n,ref:a,onClick:$e(e.onClick,s.onOpenToggle)})});Mc.displayName=fo;var dn="DialogPortal",[Pc,ho]=co(dn,{forceMount:void 0}),mo=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:s}=e,a=Oe(dn,t);return o.jsx(Pc,{scope:t,forceMount:r,children:g.Children.map(n,c=>o.jsx(br,{present:r||a.open,children:o.jsx(Js,{asChild:!0,container:s,children:c})}))})};mo.displayName=dn;var vr="DialogOverlay",po=g.forwardRef((e,t)=>{const r=ho(vr,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,a=Oe(vr,e.__scopeDialog);return a.modal?o.jsx(br,{present:n||a.open,children:o.jsx(Dc,{...s,ref:t})}):null});po.displayName=vr;var Ic=Qs("DialogOverlay.RemoveScroll"),Dc=g.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Oe(vr,r);return o.jsx(io,{as:Ic,allowPinchZoom:!0,shards:[s.contentRef],children:o.jsx(Le.div,{"data-state":hn(s.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),Xe="DialogContent",xo=g.forwardRef((e,t)=>{const r=ho(Xe,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,a=Oe(Xe,e.__scopeDialog);return o.jsx(br,{present:n||a.open,children:a.modal?o.jsx(Lc,{...s,ref:t}):o.jsx(Fc,{...s,ref:t})})});xo.displayName=Xe;var Lc=g.forwardRef((e,t)=>{const r=Oe(Xe,e.__scopeDialog),n=g.useRef(null),s=et(t,r.contentRef,n);return g.useEffect(()=>{const a=n.current;if(a)return _c(a)},[]),o.jsx(vo,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:$e(e.onCloseAutoFocus,a=>{a.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:$e(e.onPointerDownOutside,a=>{const c=a.detail.originalEvent,i=c.button===0&&c.ctrlKey===!0;(c.button===2||i)&&a.preventDefault()}),onFocusOutside:$e(e.onFocusOutside,a=>a.preventDefault())})}),Fc=g.forwardRef((e,t)=>{const r=Oe(Xe,e.__scopeDialog),n=g.useRef(!1),s=g.useRef(!1);return o.jsx(vo,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{e.onCloseAutoFocus?.(a),a.defaultPrevented||(n.current||r.triggerRef.current?.focus(),a.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:a=>{e.onInteractOutside?.(a),a.defaultPrevented||(n.current=!0,a.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const c=a.target;r.triggerRef.current?.contains(c)&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&s.current&&a.preventDefault()}})}),vo=g.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:a,...c}=e,i=Oe(Xe,r),u=g.useRef(null),d=et(t,u);return Ul(),o.jsxs(o.Fragment,{children:[o.jsx(Zs,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:a,children:o.jsx(Gs,{role:"dialog",id:i.contentId,"aria-describedby":i.descriptionId,"aria-labelledby":i.titleId,"data-state":hn(i.open),...c,ref:d,onDismiss:()=>i.onOpenChange(!1)})}),o.jsxs(o.Fragment,{children:[o.jsx(Bc,{titleId:i.titleId}),o.jsx(zc,{contentRef:u,descriptionId:i.descriptionId})]})]})}),fn="DialogTitle",go=g.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Oe(fn,r);return o.jsx(Le.h2,{id:s.titleId,...n,ref:t})});go.displayName=fn;var bo="DialogDescription",yo=g.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Oe(bo,r);return o.jsx(Le.p,{id:s.descriptionId,...n,ref:t})});yo.displayName=bo;var wo="DialogClose",Co=g.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Oe(wo,r);return o.jsx(Le.button,{type:"button",...n,ref:t,onClick:$e(e.onClick,()=>s.onOpenChange(!1))})});Co.displayName=wo;function hn(e){return e?"open":"closed"}var ko="DialogTitleWarning",[tf,jo]=ul(ko,{contentName:Xe,titleName:fn,docsSlug:"dialog"}),Bc=({titleId:e})=>{const t=jo(ko),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
50
50
|
|
|
51
51
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
52
52
|
|
|
53
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return
|
|
53
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return g.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},$c="DialogDescriptionWarning",zc=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${jo($c).contentName}}.`;return g.useEffect(()=>{const s=e.current?.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},So=uo,Eo=mo,No=po,To=xo,Ro=go,Oo=yo,_o=Co;function Wc(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}const Ao=x.createContext({drawerRef:{current:null},overlayRef:{current:null},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{},openProp:void 0,dismissible:!1,isOpen:!1,isDragging:!1,keyboardIsOpen:{current:!1},snapPointsOffset:null,snapPoints:null,handleOnly:!1,modal:!1,shouldFade:!1,activeSnapPoint:null,onOpenChange:()=>{},setActiveSnapPoint:()=>{},closeDrawer:()=>{},direction:"bottom",shouldAnimate:{current:!0},shouldScaleBackground:!1,setBackgroundColorOnScale:!0,noBodyStyles:!1,container:null,autoFocus:!1}),Pt=()=>{const e=x.useContext(Ao);if(!e)throw new Error("useDrawerContext must be used within a Drawer.Root");return e};Wc(`[data-vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1);animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=open]{animation-name:slideFromBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=closed]{animation-name:slideToBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=open]{animation-name:slideFromTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=closed]{animation-name:slideToTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=open]{animation-name:slideFromLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=closed]{animation-name:slideToLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=open]{animation-name:slideFromRight}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=closed]{animation-name:slideToRight}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--initial-transform,100%),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--initial-transform,100%),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-overlay][data-vaul-snap-points=false]{animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-overlay][data-vaul-snap-points=false][data-state=open]{animation-name:fadeIn}[data-vaul-overlay][data-state=closed]{animation-name:fadeOut}[data-vaul-animate=false]{animation:none!important}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:1}[data-vaul-drawer]:not([data-vaul-custom-container=true])::after{content:'';position:absolute;background:inherit;background-color:inherit}[data-vaul-drawer][data-vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[data-vaul-drawer][data-vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[data-vaul-overlay][data-vaul-snap-points=true]:not([data-vaul-snap-points-overlay=true]):not(
|
|
54
54
|
[data-state=closed]
|
|
55
|
-
){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}`);function mc(){const e=navigator.userAgent;return typeof window<"u"&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))}function pc(){return kr(/^Mac/)}function xc(){return kr(/^iPhone/)}function hn(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function vc(){return kr(/^iPad/)||pc()&&navigator.maxTouchPoints>1}function Ys(){return xc()||vc()}function kr(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.platform):void 0}const gc=24,bc=typeof window<"u"?p.useLayoutEffect:p.useEffect;function mn(...e){return(...t)=>{for(let r of e)typeof r=="function"&&r(...t)}}const Qt=typeof document<"u"&&window.visualViewport;function pn(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function Zs(e){for(pn(e)&&(e=e.parentElement);e&&!pn(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}const yc=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let yt=0,Gt;function wc(e={}){let{isDisabled:t}=e;bc(()=>{if(!t)return yt++,yt===1&&Ys()&&(Gt=Cc()),()=>{yt--,yt===0&&Gt?.()}},[t])}function Cc(){let e,t=0,r=f=>{e=Zs(f.target),!(e===document.documentElement&&e===document.body)&&(t=f.changedTouches[0].pageY)},n=f=>{if(!e||e===document.documentElement||e===document.body){f.preventDefault();return}let m=f.changedTouches[0].pageY,b=e.scrollTop,v=e.scrollHeight-e.clientHeight;v!==0&&((b<=0&&m>t||b>=v&&m<t)&&f.preventDefault(),t=m)},o=f=>{let m=f.target;ur(m)&&m!==document.activeElement&&(f.preventDefault(),m.style.transform="translateY(-2000px)",m.focus(),requestAnimationFrame(()=>{m.style.transform=""}))},a=f=>{let m=f.target;ur(m)&&(m.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{m.style.transform="",Qt&&(Qt.height<window.innerHeight?requestAnimationFrame(()=>{xn(m)}):Qt.addEventListener("resize",()=>xn(m),{once:!0}))}))},l=()=>{window.scrollTo(0,0)},i=window.pageXOffset,c=window.pageYOffset,u=mn(kc(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let d=mn(tt(document,"touchstart",r,{passive:!1,capture:!0}),tt(document,"touchmove",n,{passive:!1,capture:!0}),tt(document,"touchend",o,{passive:!1,capture:!0}),tt(document,"focus",a,!0),tt(window,"scroll",l));return()=>{u(),d(),window.scrollTo(i,c)}}function kc(e,t,r){let n=e.style[t];return e.style[t]=r,()=>{e.style[t]=n}}function tt(e,t,r,n){return e.addEventListener(t,r,n),()=>{e.removeEventListener(t,r,n)}}function xn(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let r=Zs(e);if(r!==document.documentElement&&r!==document.body&&r!==e){let n=r.getBoundingClientRect().top,o=e.getBoundingClientRect().top,a=e.getBoundingClientRect().bottom;const l=r.getBoundingClientRect().bottom+gc;a>l&&(r.scrollTop+=o-n)}e=r.parentElement}}function ur(e){return e instanceof HTMLInputElement&&!yc.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function jc(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function Sc(...e){return t=>e.forEach(r=>jc(r,t))}function Xs(...e){return x.useCallback(Sc(...e),e)}const Js=new WeakMap;function ee(e,t,r=!1){if(!e||!(e instanceof HTMLElement))return;let n={};Object.entries(t).forEach(([o,a])=>{if(o.startsWith("--")){e.style.setProperty(o,a);return}n[o]=e.style[o],e.style[o]=a}),!r&&Js.set(e,n)}function Ec(e,t){if(!e||!(e instanceof HTMLElement))return;let r=Js.get(e);r&&(e.style[t]=r[t])}const X=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function wt(e,t){if(!e)return null;const r=window.getComputedStyle(e),n=r.transform||r.webkitTransform||r.mozTransform;let o=n.match(/^matrix3d\((.+)\)$/);return o?parseFloat(o[1].split(", ")[X(t)?13:12]):(o=n.match(/^matrix\((.+)\)$/),o?parseFloat(o[1].split(", ")[X(t)?5:4]):null)}function Nc(e){return 8*(Math.log(e+1)-2)}function Kt(e,t){if(!e)return()=>{};const r=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=r}}function Tc(...e){return(...t)=>{for(const r of e)typeof r=="function"&&r(...t)}}const G={DURATION:.5,EASE:[.32,.72,0,1]},eo=.4,Rc=.25,Oc=100,to=8,Ae=16,dr=26,Yt="vaul-dragging";function ro(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>(...r)=>t.current==null?void 0:t.current.call(t,...r),[])}function _c({defaultProp:e,onChange:t}){const r=p.useState(e),[n]=r,o=p.useRef(n),a=ro(t);return p.useEffect(()=>{o.current!==n&&(a(n),o.current=n)},[n,o,a]),r}function no({prop:e,defaultProp:t,onChange:r=()=>{}}){const[n,o]=_c({defaultProp:t,onChange:r}),a=e!==void 0,l=a?e:n,i=ro(r),c=p.useCallback(u=>{if(a){const f=typeof u=="function"?u(e):u;f!==e&&i(f)}else o(u)},[a,e,o,i]);return[l,c]}function Ac({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:r,drawerRef:n,overlayRef:o,fadeFromIndex:a,onSnapPointChange:l,direction:i="bottom",container:c,snapToSequentialPoint:u}){const[d,f]=no({prop:e,defaultProp:r?.[0],onChange:t}),[m,b]=p.useState(typeof window<"u"?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);p.useEffect(()=>{function C(){b({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",C),()=>window.removeEventListener("resize",C)},[]);const v=p.useMemo(()=>d===r?.[r.length-1]||null,[r,d]),h=p.useMemo(()=>{var C;return(C=r?.findIndex(j=>j===d))!=null?C:null},[r,d]),y=r&&r.length>0&&(a||a===0)&&!Number.isNaN(a)&&r[a]===d||!r,g=p.useMemo(()=>{const C=c?{width:c.getBoundingClientRect().width,height:c.getBoundingClientRect().height}:typeof window<"u"?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};var j;return(j=r?.map(O=>{const D=typeof O=="string";let M=0;if(D&&(M=parseInt(O,10)),X(i)){const _=D?M:m?O*C.height:0;return m?i==="bottom"?C.height-_:-C.height+_:_}const $=D?M:m?O*C.width:0;return m?i==="right"?C.width-$:-C.width+$:$}))!=null?j:[]},[r,m,c]),S=p.useMemo(()=>h!==null?g?.[h]:null,[g,h]),k=p.useCallback(C=>{var j;const O=(j=g?.findIndex(D=>D===C))!=null?j:null;l(O),ee(n.current,{transition:`transform ${G.DURATION}s cubic-bezier(${G.EASE.join(",")})`,transform:X(i)?`translate3d(0, ${C}px, 0)`:`translate3d(${C}px, 0, 0)`}),g&&O!==g.length-1&&a!==void 0&&O!==a&&O<a?ee(o.current,{transition:`opacity ${G.DURATION}s cubic-bezier(${G.EASE.join(",")})`,opacity:"0"}):ee(o.current,{transition:`opacity ${G.DURATION}s cubic-bezier(${G.EASE.join(",")})`,opacity:"1"}),f(r?.[Math.max(O,0)])},[n.current,r,g,a,o,f]);p.useEffect(()=>{if(d||e){var C;const j=(C=r?.findIndex(O=>O===e||O===d))!=null?C:-1;g&&j!==-1&&typeof g[j]=="number"&&k(g[j])}},[d,e,r,g,k]);function w({draggedDistance:C,closeDrawer:j,velocity:O,dismissible:D}){if(a===void 0)return;const M=i==="bottom"||i==="right"?(S??0)-C:(S??0)+C,$=h===a-1,_=h===0,W=C>0;if($&&ee(o.current,{transition:`opacity ${G.DURATION}s cubic-bezier(${G.EASE.join(",")})`}),!u&&O>2&&!W){D?j():k(g[0]);return}if(!u&&O>2&&W&&g&&r){k(g[r.length-1]);return}const V=g?.reduce((H,E)=>typeof H!="number"||typeof E!="number"?H:Math.abs(E-M)<Math.abs(H-M)?E:H),Q=X(i)?window.innerHeight:window.innerWidth;if(O>eo&&Math.abs(C)<Q*.4){const H=W?1:-1;if(H>0&&v&&r){k(g[r.length-1]);return}if(_&&H<0&&D&&j(),h===null)return;k(g[h+H]);return}k(V)}function N({draggedDistance:C}){if(S===null)return;const j=i==="bottom"||i==="right"?S-C:S+C;(i==="bottom"||i==="right")&&j<g[g.length-1]||(i==="top"||i==="left")&&j>g[g.length-1]||ee(n.current,{transform:X(i)?`translate3d(0, ${j}px, 0)`:`translate3d(${j}px, 0, 0)`})}function A(C,j){if(!r||typeof h!="number"||!g||a===void 0)return null;const O=h===a-1;if(h>=a&&j)return 0;if(O&&!j)return 1;if(!y&&!O)return null;const M=O?h+1:h-1,$=O?g[M]-g[M-1]:g[M+1]-g[M],_=C/Math.abs($);return O?1-_:_}return{isLastSnapPoint:v,activeSnapPoint:d,shouldFade:y,getPercentageDragged:A,setActiveSnapPoint:f,activeSnapPointIndex:h,onRelease:w,onDrag:N,snapPointsOffset:g}}const Pc=()=>()=>{};function Mc(){const{direction:e,isOpen:t,shouldScaleBackground:r,setBackgroundColorOnScale:n,noBodyStyles:o}=ct(),a=p.useRef(null),l=p.useMemo(()=>document.body.style.backgroundColor,[]);function i(){return(window.innerWidth-dr)/window.innerWidth}p.useEffect(()=>{if(t&&r){a.current&&clearTimeout(a.current);const c=document.querySelector("[data-vaul-drawer-wrapper]")||document.querySelector("[vaul-drawer-wrapper]");if(!c)return;Tc(n&&!o?Kt(document.body,{background:"black"}):Pc,Kt(c,{transformOrigin:X(e)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${G.DURATION}s`,transitionTimingFunction:`cubic-bezier(${G.EASE.join(",")})`}));const u=Kt(c,{borderRadius:`${to}px`,overflow:"hidden",...X(e)?{transform:`scale(${i()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${i()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`}});return()=>{u(),a.current=window.setTimeout(()=>{l?document.body.style.background=l:document.body.style.removeProperty("background")},G.DURATION*1e3)}}},[t,r,l])}let rt=null;function Ic({isOpen:e,modal:t,nested:r,hasBeenOpened:n,preventScrollRestoration:o,noBodyStyles:a}){const[l,i]=p.useState(()=>typeof window<"u"?window.location.href:""),c=p.useRef(0),u=p.useCallback(()=>{if(hn()&&rt===null&&e&&!a){rt={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:"unset"};const{scrollX:f,innerHeight:m}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:`${-c.current}px`,left:`${-f}px`,right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{const b=m-window.innerHeight;b&&c.current>=m&&(document.body.style.top=`${-(c.current+b)}px`)}),300)}},[e]),d=p.useCallback(()=>{if(hn()&&rt!==null&&!a){const f=-parseInt(document.body.style.top,10),m=-parseInt(document.body.style.left,10);Object.assign(document.body.style,rt),window.requestAnimationFrame(()=>{if(o&&l!==window.location.href){i(window.location.href);return}window.scrollTo(m,f)}),rt=null}},[l]);return p.useEffect(()=>{function f(){c.current=window.scrollY}return f(),window.addEventListener("scroll",f),()=>{window.removeEventListener("scroll",f)}},[]),p.useEffect(()=>{if(t)return()=>{typeof document>"u"||document.querySelector("[data-vaul-drawer]")||d()}},[t,d]),p.useEffect(()=>{r||!n||(e?(!window.matchMedia("(display-mode: standalone)").matches&&u(),t||window.setTimeout(()=>{d()},500)):d())},[e,n,l,t,r,u,d]),{restorePositionSetting:d}}function Lc({open:e,onOpenChange:t,children:r,onDrag:n,onRelease:o,snapPoints:a,shouldScaleBackground:l=!1,setBackgroundColorOnScale:i=!0,closeThreshold:c=Rc,scrollLockTimeout:u=Oc,dismissible:d=!0,handleOnly:f=!1,fadeFromIndex:m=a&&a.length-1,activeSnapPoint:b,setActiveSnapPoint:v,fixed:h,modal:y=!0,onClose:g,nested:S,noBodyStyles:k=!1,direction:w="bottom",defaultOpen:N=!1,disablePreventScroll:A=!0,snapToSequentialPoint:C=!1,preventScrollRestoration:j=!1,repositionInputs:O=!0,onAnimationEnd:D,container:M,autoFocus:$=!1}){var _,W;const[V=!1,Q]=no({defaultProp:N,prop:e,onChange:P=>{t?.(P),!P&&!S&&yo(),setTimeout(()=>{D?.(P)},G.DURATION*1e3),P&&!y&&typeof window<"u"&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),P||(document.body.style.pointerEvents="auto")}}),[H,E]=p.useState(!1),[ne,ie]=p.useState(!1),[Te,pe]=p.useState(!1),U=p.useRef(null),Z=p.useRef(null),de=p.useRef(null),be=p.useRef(null),F=p.useRef(null),xe=p.useRef(!1),ye=p.useRef(null),we=p.useRef(0),fe=p.useRef(!1),Re=p.useRef(!N),Tr=p.useRef(0),I=p.useRef(null),Rr=p.useRef(((_=I.current)==null?void 0:_.getBoundingClientRect().height)||0),Or=p.useRef(((W=I.current)==null?void 0:W.getBoundingClientRect().width)||0),Mt=p.useRef(0),po=p.useCallback(P=>{a&&P===Xe.length-1&&(Z.current=new Date)},[]),{activeSnapPoint:xo,activeSnapPointIndex:$e,setActiveSnapPoint:_r,onRelease:vo,snapPointsOffset:Xe,onDrag:go,shouldFade:Ar,getPercentageDragged:bo}=Ac({snapPoints:a,activeSnapPointProp:b,setActiveSnapPointProp:v,drawerRef:I,fadeFromIndex:m,overlayRef:U,onSnapPointChange:po,direction:w,container:M,snapToSequentialPoint:C});wc({isDisabled:!V||ne||!y||Te||!H||!O||!A});const{restorePositionSetting:yo}=Ic({isOpen:V,modal:y,nested:S??!1,hasBeenOpened:H,preventScrollRestoration:j,noBodyStyles:k});function ut(){return(window.innerWidth-dr)/window.innerWidth}function wo(P){var z,q;!d&&!a||I.current&&!I.current.contains(P.target)||(Rr.current=((z=I.current)==null?void 0:z.getBoundingClientRect().height)||0,Or.current=((q=I.current)==null?void 0:q.getBoundingClientRect().width)||0,ie(!0),de.current=new Date,Ys()&&window.addEventListener("touchend",()=>xe.current=!1,{once:!0}),P.target.setPointerCapture(P.pointerId),we.current=X(w)?P.pageY:P.pageX)}function Pr(P,z){var q;let B=P;const Y=(q=window.getSelection())==null?void 0:q.toString(),se=I.current?wt(I.current,w):null,re=new Date;if(B.tagName==="SELECT"||B.hasAttribute("data-vaul-no-drag")||B.closest("[data-vaul-no-drag]"))return!1;if(w==="right"||w==="left")return!0;if(Z.current&&re.getTime()-Z.current.getTime()<500)return!1;if(se!==null&&(w==="bottom"?se>0:se<0))return!0;if(Y&&Y.length>0)return!1;if(F.current&&re.getTime()-F.current.getTime()<u&&se===0||z)return F.current=re,!1;for(;B;){if(B.scrollHeight>B.clientHeight){if(B.scrollTop!==0)return F.current=new Date,!1;if(B.getAttribute("role")==="dialog")return!0}B=B.parentNode}return!0}function Co(P){if(I.current&&ne){const z=w==="bottom"||w==="right"?1:-1,q=(we.current-(X(w)?P.pageY:P.pageX))*z,B=q>0,Y=a&&!d&&!B;if(Y&&$e===0)return;const se=Math.abs(q),re=document.querySelector("[data-vaul-drawer-wrapper]"),Ce=w==="bottom"||w==="top"?Rr.current:Or.current;let le=se/Ce;const Oe=bo(se,B);if(Oe!==null&&(le=Oe),Y&&le>=1||!xe.current&&!Pr(P.target,B))return;if(I.current.classList.add(Yt),xe.current=!0,ee(I.current,{transition:"none"}),ee(U.current,{transition:"none"}),a&&go({draggedDistance:q}),B&&!a){const he=Nc(q),dt=Math.min(he*-1,0)*z;ee(I.current,{transform:X(w)?`translate3d(0, ${dt}px, 0)`:`translate3d(${dt}px, 0, 0)`});return}const ke=1-le;if((Ar||m&&$e===m-1)&&(n?.(P,le),ee(U.current,{opacity:`${ke}`,transition:"none"},!0)),re&&U.current&&l){const he=Math.min(ut()+le*(1-ut()),1),dt=8-le*8,Ir=Math.max(0,14-le*14);ee(re,{borderRadius:`${dt}px`,transform:X(w)?`scale(${he}) translate3d(0, ${Ir}px, 0)`:`scale(${he}) translate3d(${Ir}px, 0, 0)`,transition:"none"},!0)}if(!a){const he=se*z;ee(I.current,{transform:X(w)?`translate3d(0, ${he}px, 0)`:`translate3d(${he}px, 0, 0)`})}}}p.useEffect(()=>{window.requestAnimationFrame(()=>{Re.current=!0})},[]),p.useEffect(()=>{var P;function z(){if(!I.current||!O)return;const q=document.activeElement;if(ur(q)||fe.current){var B;const Y=((B=window.visualViewport)==null?void 0:B.height)||0,se=window.innerHeight;let re=se-Y;const Ce=I.current.getBoundingClientRect().height||0,le=Ce>se*.8;Mt.current||(Mt.current=Ce);const Oe=I.current.getBoundingClientRect().top;if(Math.abs(Tr.current-re)>60&&(fe.current=!fe.current),a&&a.length>0&&Xe&&$e){const ke=Xe[$e]||0;re+=ke}if(Tr.current=re,Ce>Y||fe.current){const ke=I.current.getBoundingClientRect().height;let he=ke;ke>Y&&(he=Y-(le?Oe:dr)),h?I.current.style.height=`${ke-Math.max(re,0)}px`:I.current.style.height=`${Math.max(he,Y-Oe)}px`}else mc()||(I.current.style.height=`${Mt.current}px`);a&&a.length>0&&!fe.current?I.current.style.bottom="0px":I.current.style.bottom=`${Math.max(re,0)}px`}}return(P=window.visualViewport)==null||P.addEventListener("resize",z),()=>{var q;return(q=window.visualViewport)==null?void 0:q.removeEventListener("resize",z)}},[$e,a,Xe]);function Je(P){ko(),g?.(),P||Q(!1),setTimeout(()=>{a&&_r(a[0])},G.DURATION*1e3)}function Mr(){if(!I.current)return;const P=document.querySelector("[data-vaul-drawer-wrapper]"),z=wt(I.current,w);ee(I.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${G.DURATION}s cubic-bezier(${G.EASE.join(",")})`}),ee(U.current,{transition:`opacity ${G.DURATION}s cubic-bezier(${G.EASE.join(",")})`,opacity:"1"}),l&&z&&z>0&&V&&ee(P,{borderRadius:`${to}px`,overflow:"hidden",...X(w)?{transform:`scale(${ut()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${ut()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${G.DURATION}s`,transitionTimingFunction:`cubic-bezier(${G.EASE.join(",")})`},!0)}function ko(){!ne||!I.current||(I.current.classList.remove(Yt),xe.current=!1,ie(!1),be.current=new Date)}function jo(P){if(!ne||!I.current)return;I.current.classList.remove(Yt),xe.current=!1,ie(!1),be.current=new Date;const z=wt(I.current,w);if(!P||!Pr(P.target,!1)||!z||Number.isNaN(z)||de.current===null)return;const q=be.current.getTime()-de.current.getTime(),B=we.current-(X(w)?P.pageY:P.pageX),Y=Math.abs(B)/q;if(Y>.05&&(pe(!0),setTimeout(()=>{pe(!1)},200)),a){vo({draggedDistance:B*(w==="bottom"||w==="right"?1:-1),closeDrawer:Je,velocity:Y,dismissible:d}),o?.(P,!0);return}if(w==="bottom"||w==="right"?B>0:B<0){Mr(),o?.(P,!0);return}if(Y>eo){Je(),o?.(P,!1);return}var se;const re=Math.min((se=I.current.getBoundingClientRect().height)!=null?se:0,window.innerHeight);var Ce;const le=Math.min((Ce=I.current.getBoundingClientRect().width)!=null?Ce:0,window.innerWidth),Oe=w==="left"||w==="right";if(Math.abs(z)>=(Oe?le:re)*c){Je(),o?.(P,!1);return}o?.(P,!0),Mr()}p.useEffect(()=>(V&&(ee(document.documentElement,{scrollBehavior:"auto"}),Z.current=new Date),()=>{Ec(document.documentElement,"scrollBehavior")}),[V]);function So(P){const z=P?(window.innerWidth-Ae)/window.innerWidth:1,q=P?-Ae:0;ye.current&&window.clearTimeout(ye.current),ee(I.current,{transition:`transform ${G.DURATION}s cubic-bezier(${G.EASE.join(",")})`,transform:X(w)?`scale(${z}) translate3d(0, ${q}px, 0)`:`scale(${z}) translate3d(${q}px, 0, 0)`}),!P&&I.current&&(ye.current=setTimeout(()=>{const B=wt(I.current,w);ee(I.current,{transition:"none",transform:X(w)?`translate3d(0, ${B}px, 0)`:`translate3d(${B}px, 0, 0)`})},500))}function Eo(P,z){if(z<0)return;const q=(window.innerWidth-Ae)/window.innerWidth,B=q+z*(1-q),Y=-Ae+z*Ae;ee(I.current,{transform:X(w)?`scale(${B}) translate3d(0, ${Y}px, 0)`:`scale(${B}) translate3d(${Y}px, 0, 0)`,transition:"none"})}function No(P,z){const q=X(w)?window.innerHeight:window.innerWidth,B=z?(q-Ae)/q:1,Y=z?-Ae:0;z&&ee(I.current,{transition:`transform ${G.DURATION}s cubic-bezier(${G.EASE.join(",")})`,transform:X(w)?`scale(${B}) translate3d(0, ${Y}px, 0)`:`scale(${B}) translate3d(${Y}px, 0, 0)`})}return p.useEffect(()=>{y||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[y]),p.createElement(Ws,{defaultOpen:N,onOpenChange:P=>{!d&&!P||(P?E(!0):Je(!0),Q(P))},open:V},p.createElement(Ks.Provider,{value:{activeSnapPoint:xo,snapPoints:a,setActiveSnapPoint:_r,drawerRef:I,overlayRef:U,onOpenChange:t,onPress:wo,onRelease:jo,onDrag:Co,dismissible:d,shouldAnimate:Re,handleOnly:f,isOpen:V,isDragging:ne,shouldFade:Ar,closeDrawer:Je,onNestedDrag:Eo,onNestedOpenChange:So,onNestedRelease:No,keyboardIsOpen:fe,modal:y,snapPointsOffset:Xe,activeSnapPointIndex:$e,direction:w,shouldScaleBackground:l,setBackgroundColorOnScale:i,noBodyStyles:k,container:M,autoFocus:$}},r))}const so=p.forwardRef(function({...e},t){const{overlayRef:r,snapPoints:n,onRelease:o,shouldFade:a,isOpen:l,modal:i,shouldAnimate:c}=ct(),u=Xs(t,r),d=n&&n.length>0;if(!i)return null;const f=p.useCallback(m=>o(m),[o]);return p.createElement(Hs,{onMouseUp:f,ref:u,"data-vaul-overlay":"","data-vaul-snap-points":l&&d?"true":"false","data-vaul-snap-points-overlay":l&&a?"true":"false","data-vaul-animate":c?.current?"true":"false",...e})});so.displayName="Drawer.Overlay";const oo=p.forwardRef(function({onPointerDownOutside:e,style:t,onOpenAutoFocus:r,...n},o){const{drawerRef:a,onPress:l,onRelease:i,onDrag:c,keyboardIsOpen:u,snapPointsOffset:d,activeSnapPointIndex:f,modal:m,isOpen:b,direction:v,snapPoints:h,container:y,handleOnly:g,shouldAnimate:S,autoFocus:k}=ct(),[w,N]=p.useState(!1),A=Xs(o,a),C=p.useRef(null),j=p.useRef(null),O=p.useRef(!1),D=h&&h.length>0;Mc();const M=(_,W,V=0)=>{if(O.current)return!0;const Q=Math.abs(_.y),H=Math.abs(_.x),E=H>Q,ne=["bottom","right"].includes(W)?1:-1;if(W==="left"||W==="right"){if(!(_.x*ne<0)&&H>=0&&H<=V)return E}else if(!(_.y*ne<0)&&Q>=0&&Q<=V)return!E;return O.current=!0,!0};p.useEffect(()=>{D&&window.requestAnimationFrame(()=>{N(!0)})},[]);function $(_){C.current=null,O.current=!1,i(_)}return p.createElement(Us,{"data-vaul-drawer-direction":v,"data-vaul-drawer":"","data-vaul-delayed-snap-points":w?"true":"false","data-vaul-snap-points":b&&D?"true":"false","data-vaul-custom-container":y?"true":"false","data-vaul-animate":S?.current?"true":"false",...n,ref:A,style:d&&d.length>0?{"--snap-point-height":`${d[f??0]}px`,...t}:t,onPointerDown:_=>{g||(n.onPointerDown==null||n.onPointerDown.call(n,_),C.current={x:_.pageX,y:_.pageY},l(_))},onOpenAutoFocus:_=>{r?.(_),k||_.preventDefault()},onPointerDownOutside:_=>{if(e?.(_),!m||_.defaultPrevented){_.preventDefault();return}u.current&&(u.current=!1)},onFocusOutside:_=>{if(!m){_.preventDefault();return}},onPointerMove:_=>{if(j.current=_,g||(n.onPointerMove==null||n.onPointerMove.call(n,_),!C.current))return;const W=_.pageY-C.current.y,V=_.pageX-C.current.x,Q=_.pointerType==="touch"?10:2;M({x:V,y:W},v,Q)?c(_):(Math.abs(V)>Q||Math.abs(W)>Q)&&(C.current=null)},onPointerUp:_=>{n.onPointerUp==null||n.onPointerUp.call(n,_),C.current=null,O.current=!1,i(_)},onPointerOut:_=>{n.onPointerOut==null||n.onPointerOut.call(n,_),$(j.current)},onContextMenu:_=>{n.onContextMenu==null||n.onContextMenu.call(n,_),j.current&&$(j.current)}})});oo.displayName="Drawer.Content";const Dc=250,Fc=120,$c=p.forwardRef(function({preventCycle:e=!1,children:t,...r},n){const{closeDrawer:o,isDragging:a,snapPoints:l,activeSnapPoint:i,setActiveSnapPoint:c,dismissible:u,handleOnly:d,isOpen:f,onPress:m,onDrag:b}=ct(),v=p.useRef(null),h=p.useRef(!1);function y(){if(h.current){k();return}window.setTimeout(()=>{g()},Fc)}function g(){if(a||e||h.current){k();return}if(k(),!l||l.length===0){u||o();return}if(i===l[l.length-1]&&u){o();return}const N=l.findIndex(C=>C===i);if(N===-1)return;const A=l[N+1];c(A)}function S(){v.current=window.setTimeout(()=>{h.current=!0},Dc)}function k(){v.current&&window.clearTimeout(v.current),h.current=!1}return p.createElement("div",{onClick:y,onPointerCancel:k,onPointerDown:w=>{d&&m(w),S()},onPointerMove:w=>{d&&b(w)},ref:n,"data-vaul-drawer-visible":f?"true":"false","data-vaul-handle":"","aria-hidden":"true",...r},p.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},t))});$c.displayName="Drawer.Handle";function Bc(e){const t=ct(),{container:r=t.container,...n}=e;return p.createElement(Vs,{container:r,...n})}const Pe={Root:Lc,Content:oo,Overlay:so,Portal:Bc,Close:Gs,Title:qs,Description:Qs};function zc(e=768){const[t,r]=p.useState(!1);return p.useEffect(()=>{const n=()=>{r(window.innerWidth<e)};return n(),window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[e]),t}function Tt(...e){return ls(Kn(e))}const Wc={position:"fixed",inset:0,zIndex:9999,backgroundColor:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(4px)"},Vc={position:"fixed",left:"50%",top:"50%",transform:"translate(-50%, -50%)",zIndex:9999,width:"calc(100% - 2rem)",maxWidth:"42rem",display:"flex",flexDirection:"column"},Hc={position:"fixed",inset:0,zIndex:9999,backgroundColor:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(4px)"},Uc={position:"fixed",left:0,right:0,bottom:0,zIndex:9999,maxHeight:"96vh"};function jr({open:e,onOpenChange:t,children:r,title:n,description:o,className:a="",showCloseButton:l=!0,height:i}){const c=zc(),{theme:u}=fa(),d={"--optimex-primary":u.colors.primary,"--optimex-background":u.colors.background,"--optimex-surface":u.colors.surface,"--optimex-text":u.colors.text.primary,"--optimex-text-secondary":u.colors.text.secondary,"--optimex-error":u.colors.error,"--optimex-success":u.colors.success,"--optimex-radius-widget":u.radius.widget,"--optimex-radius-input":u.radius.input,"--optimex-radius-button":u.radius.button,"--optimex-overlay-background":u.overlay.background,"--optimex-overlay-radius":u.overlay.radius,"--optimex-font-family":u.fontFamily};return c?s.jsx(Pe.Root,{open:e,onOpenChange:t,children:s.jsxs(Pe.Portal,{children:[s.jsx(Pe.Overlay,{style:Hc}),s.jsx(Pe.Content,{style:Uc,children:s.jsxs("div",{className:Tt("optx-widget flex flex-col bg-[var(--optimex-overlay-background)] outline-none",a),style:{...d,height:i,maxHeight:"96vh",borderStyle:"solid",borderColor:"rgba(255, 255, 255, 0.1)",backgroundColor:u.overlay.background,borderRadius:`${u.overlay.radius} ${u.overlay.radius} 0 0`},children:[s.jsx("div",{className:"mx-auto mt-4 h-1.5 w-12 flex-shrink-0 rounded-full bg-white/20"}),(n||l)&&s.jsxs("div",{className:"flex items-center justify-between border-b border-white/[0.05] px-4 pb-4 pt-2",children:[s.jsxs("div",{children:[n&&s.jsx(Pe.Title,{className:"text-lg font-bold text-[var(--optimex-text)]",children:n}),o&&s.jsx(Pe.Description,{className:"text-sm text-[var(--optimex-text-secondary)]",children:o})]}),l&&s.jsx(Pe.Close,{className:"rounded-[var(--optimex-radius-button)] p-1.5 text-[var(--optimex-text-secondary)] transition-colors hover:bg-white/10 hover:text-[var(--optimex-text)]",children:s.jsx(Ie,{})})]}),s.jsx("div",{className:"flex flex-1 flex-col overflow-auto",children:r})]})})]})}):s.jsx(Ws,{open:e,onOpenChange:t,children:s.jsxs(Vs,{children:[s.jsx(Hs,{style:Wc}),s.jsx(Us,{style:{...Vc,height:i,maxHeight:i||"85vh"},children:s.jsxs("div",{className:Tt("optx-widget flex flex-col rounded-[var(--optimex-overlay-radius)] border border-white/10 bg-[var(--optimex-overlay-background)] shadow-2xl outline-none",a),style:{...d,flex:1,minHeight:0,height:"100%",borderStyle:"solid",borderColor:"rgba(255, 255, 255, 0.1)",backgroundColor:u.overlay.background,borderRadius:u.overlay.radius},children:[(n||o||l)&&s.jsxs("div",{className:"flex flex-shrink-0 items-center justify-between border-b border-white/[0.05] p-4",children:[s.jsxs("div",{className:"flex flex-col gap-1.5",children:[n&&s.jsx(qs,{className:"text-lg font-bold leading-none text-[var(--optimex-text)]",children:n}),o&&s.jsx(Qs,{className:"text-sm text-[var(--optimex-text-secondary)]",children:o})]}),l&&s.jsxs(Gs,{className:"rounded-[var(--optimex-radius-button)] p-1.5 text-[var(--optimex-text-secondary)] opacity-70 transition-opacity hover:opacity-100 hover:bg-white/10 focus:outline-none",children:[s.jsx(Ie,{}),s.jsx("span",{className:"sr-only",children:"Close"})]})]}),s.jsx("div",{className:"flex flex-1 flex-col overflow-hidden min-h-0",children:r})]})})]})})}const qc=({children:e,className:t=""})=>s.jsx("div",{className:Tt("p-4",t),children:e}),Qc=({children:e,className:t=""})=>s.jsx("div",{className:Tt("flex gap-2 border-t border-white/[0.05] p-4",t),children:e});function fr({children:e,onClick:t,isActive:r=!1,type:n="button",className:o=""}){return s.jsx("button",{type:n,onClick:t,className:cs(`px-2 py-1 bg-white/5 rounded-md text-xs transition-colors shadow-sm border ${r?"border-[var(--optimex-primary)] text-[var(--optimex-text)]":"border-transparent text-[var(--optimex-text-secondary)] hover:bg-[var(--optimex-surface-hover)] hover:text-[var(--optimex-text)]"} ${o}`),children:e})}const Gc={"bottom-right":"right-0 top-full mt-2","bottom-left":"left-0 top-full mt-2","bottom-center":"left-1/2 -translate-x-1/2 top-full mt-2","top-right":"right-0 bottom-full mb-2","top-left":"left-0 bottom-full mb-2","top-center":"left-1/2 -translate-x-1/2 bottom-full mb-2"},Kc={"bottom-right":"-top-2 right-4 rotate-45 border-l border-t border-white/10","bottom-left":"-top-2 left-4 rotate-45 border-l border-t border-white/10","bottom-center":"-top-2 left-1/2 -translate-x-1/2 rotate-45 border-l border-t border-white/10","top-right":"-bottom-2 right-4 rotate-45 border-r border-b border-white/10","top-left":"-bottom-2 left-4 rotate-45 border-r border-b border-white/10","top-center":"-bottom-2 left-1/2 -translate-x-1/2 rotate-45 border-r border-b border-white/10"};function Yc({isOpen:e,onClose:t,children:r,anchorRef:n,position:o="bottom-right",width:a="w-72",showArrow:l=!1,className:i="",ariaLabel:c}){const u=p.useRef(null);return p.useEffect(()=>{if(!e)return;const d=b=>{const v=b.target;u.current?.contains(v)||n?.current?.contains(v)||t()},f=b=>{b.key==="Escape"&&t()},m=setTimeout(()=>{document.addEventListener("mousedown",d),document.addEventListener("keydown",f)},0);return()=>{clearTimeout(m),document.removeEventListener("mousedown",d),document.removeEventListener("keydown",f)}},[e,t,n]),e?s.jsxs("div",{ref:u,className:`absolute z-50 rounded-[var(--optimex-overlay-radius)] border border-white/10 bg-[var(--optimex-overlay-background)] p-4 shadow-xl ${Gc[o]} ${a} ${i}`,role:"dialog","aria-label":c,children:[l&&s.jsx("div",{className:`absolute h-4 w-4 bg-[var(--optimex-overlay-background)] ${Kc[o]}`}),s.jsx("div",{className:"relative",children:r})]}):null}function Zc({value:e,onChange:t,placeholder:r,hasError:n=!1,leftIcon:o,rightContent:a,type:l="text",inputMode:i="text",disabled:c=!1,className:u=""}){return s.jsxs("div",{className:`flex rounded-[var(--optimex-radius-button)] items-center gap-2 bg-white/5 border py-3 px-3 transition-colors ${n?"border-[var(--optimex-error)]":"border-white/10 hover:border-[var(--optimex-primary)] focus-within:border-[var(--optimex-primary)]"} ${c?"opacity-50 cursor-not-allowed":""} ${u}`,children:[o&&s.jsx(o,{className:"size-5 text-[var(--optimex-text-secondary)] shrink-0"}),s.jsx("input",{type:l,inputMode:i,value:e,onChange:d=>t(d.target.value),placeholder:r,disabled:c,className:"flex-1 min-w-0 bg-transparent text-[var(--optimex-text)] text-sm placeholder:text-[var(--optimex-text-secondary)]/30 outline-none disabled:cursor-not-allowed"}),a]})}const Xc={sm:{container:"h-6 w-6",icon:"h-6 w-6",badge:"h-3 w-3"},md:{container:"h-8 w-8",icon:"h-8 w-8",badge:"h-4 w-4"},lg:{container:"h-10 w-10",icon:"h-10 w-10",badge:"h-5 w-5"},xl:{container:"h-14 w-14",icon:"h-14 w-14",badge:"h-6 w-6"}};function De({token:e,size:t="md",showNetworkBadge:r=!0}){const n=Xc[t];return s.jsxs("div",{className:`relative shrink-0 ${n.container}`,children:[s.jsx("img",{src:e.token_logo_uri||"/placeholder-token.svg",alt:e.token_symbol,className:`${n.icon} rounded-[9999px] bg-[var(--optimex-background)]`,onError:o=>{o.target.src="/placeholder-token.svg"}}),r&&e.network_logo_uri&&s.jsx("img",{src:e.network_logo_uri,alt:e.network_name,className:`absolute -bottom-1 -right-1 ${n.badge} rounded-[9999px] border-2 border-[var(--optimex-surface)]`,onError:o=>{o.target.style.display="none"}})]})}const Jc="widget-container rounded-[var(--optimex-radius-widget)] p-4 shadow-2xl relative w-full min-w-0";function Sr({children:e,className:t}){return s.jsx("div",{className:t??Jc,children:e})}function eu(){return s.jsxs("div",{className:"relative size-20 mb-4",children:[s.jsx("div",{className:"absolute inset-0 rounded-full bg-[var(--optimex-error)]/10 animate-pulse"}),s.jsx("div",{className:"absolute inset-2 rounded-full bg-[var(--optimex-error)]/20"}),s.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:s.jsx(Fa,{className:"size-10 text-[var(--optimex-error)]"})})]})}function tu({error:e,onRetry:t,className:r}){const n=()=>{const o=e?.message?.toLowerCase()||"";return o.includes("network")||o.includes("fetch")?"Connection issue. Check your internet and try again.":o.includes("timeout")?"Request timed out. The server might be busy.":o.includes("401")||o.includes("403")?"Access denied. Please check your credentials.":o.includes("500")||o.includes("server")?"Server is having issues. Please try again later.":"Something went wrong while loading. Let's give it another shot!"};return s.jsx(Sr,{className:r,children:s.jsx("div",{className:"bg-[var(--optimex-surface)] rounded-2xl p-6 border border-white/[0.02]",children:s.jsxs("div",{className:"flex flex-col items-center justify-center text-center",children:[s.jsx(eu,{}),s.jsx("h3",{className:"text-base font-bold text-[var(--optimex-text)] mb-1",children:"Oops! Something went wrong"}),s.jsx("p",{className:"text-sm text-[var(--optimex-text-secondary)] mb-6 max-w-[280px]",children:n()}),s.jsx(Qn,{onClick:t,size:"md",fullWidth:!0,leftIcon:s.jsx(Da,{className:"size-4 transition-transform group-hover:rotate-180"}),children:"Try Again"}),e?.message&&s.jsxs("details",{className:"mt-4 w-full",children:[s.jsx("summary",{className:"cursor-pointer text-xs text-[var(--optimex-text-secondary)]/60 hover:text-[var(--optimex-text-secondary)] transition-colors",children:"Technical details"}),s.jsx("p",{className:"mt-2 bg-white/5 p-3 text-left text-xs text-[var(--optimex-text-secondary)] break-all border border-white/[0.02]",children:e.message})]})]})})})}function ru({className:e}){return s.jsxs("div",{className:"flex flex-col gap-4",children:[s.jsxs("header",{className:"flex items-center justify-between px-2",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"size-8 rounded-lg bg-[var(--optimex-primary)]/30 animate-pulse"}),s.jsx("div",{className:"h-6 w-28 rounded bg-white/10 animate-pulse"})]}),s.jsx("div",{className:"size-10 rounded-lg bg-white/5 animate-pulse"})]}),s.jsxs(Sr,{className:e,children:[s.jsxs("div",{className:"bg-[var(--optimex-surface)] rounded-2xl p-4 border border-white/[0.02] mb-2",children:[s.jsx("div",{className:"flex justify-between items-center mb-4",children:s.jsx("div",{className:"h-3 w-10 animate-pulse rounded bg-white/10"})}),s.jsxs("div",{className:"flex items-center justify-between gap-4",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx("div",{className:"h-8 w-24 animate-pulse rounded bg-white/10 mb-2"}),s.jsx("div",{className:"h-3 w-16 animate-pulse rounded bg-white/5"})]}),s.jsxs("div",{className:"flex items-center gap-2 bg-white/5 p-2 pr-3 rounded-full border border-white/10",children:[s.jsx("div",{className:"size-8 rounded-full bg-white/10 animate-pulse"}),s.jsxs("div",{children:[s.jsx("div",{className:"h-4 w-12 animate-pulse rounded bg-white/10 mb-1"}),s.jsx("div",{className:"h-2 w-16 animate-pulse rounded bg-white/5"})]})]})]})]}),s.jsx("div",{className:"relative z-10 -my-4 flex justify-center",children:s.jsx("div",{className:"size-10 rounded-full bg-[var(--optimex-surface)] border-4 border-[var(--optimex-background)] animate-pulse"})}),s.jsxs("div",{className:"bg-[var(--optimex-surface)] rounded-2xl p-4 border border-white/[0.02] mb-4",children:[s.jsx("div",{className:"flex justify-between items-center mb-4",children:s.jsx("div",{className:"h-3 w-6 animate-pulse rounded bg-white/10"})}),s.jsxs("div",{className:"flex items-center justify-between gap-4",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx("div",{className:"h-8 w-20 animate-pulse rounded bg-white/10 mb-2"}),s.jsx("div",{className:"h-3 w-14 animate-pulse rounded bg-white/5"})]}),s.jsxs("div",{className:"flex items-center gap-2 bg-white/5 p-2 pr-3 rounded-full border border-white/10",children:[s.jsx("div",{className:"size-8 rounded-full bg-white/10 animate-pulse"}),s.jsxs("div",{children:[s.jsx("div",{className:"h-4 w-12 animate-pulse rounded bg-white/10 mb-1"}),s.jsx("div",{className:"h-2 w-16 animate-pulse rounded bg-white/5"})]})]})]})]}),s.jsxs("div",{className:"bg-[var(--optimex-surface)] rounded-2xl p-4 border border-white/[0.02] mb-4",children:[s.jsx("div",{className:"h-3 w-28 animate-pulse rounded bg-white/10 mb-2"}),s.jsxs("div",{className:"flex items-center gap-2 bg-white/5 border border-white/10 py-3 px-3 rounded-md",children:[s.jsx("div",{className:"size-5 rounded-full bg-white/10 animate-pulse shrink-0"}),s.jsx("div",{className:"h-4 flex-1 animate-pulse rounded bg-white/5"})]}),s.jsx("div",{className:"h-2 w-48 animate-pulse rounded bg-white/5 mt-2"})]}),s.jsx("div",{className:"h-12 w-full animate-pulse rounded-xl bg-[var(--optimex-primary)]/30 bg-white/5 mt-2"}),s.jsx("div",{className:"mt-4 flex items-center justify-center",children:s.jsx("div",{className:"h-4 w-32 animate-pulse rounded bg-white/5"})})]})]})}const ao=p.createContext(null);function nu({children:e}){const t=lt(),{data:r,isLoading:n,error:o,refetch:a}=xa(t.apiBaseUrl),l=t.renderLoading??ru,i=t.renderError??tu;if(n)return s.jsx(l,{});if(o||!r){const c=o instanceof Error?o:new Error("Failed to load tokens");return s.jsx(i,{error:c,onRetry:()=>a()})}return s.jsx(ao.Provider,{value:{tokensData:r,refetch:a},children:e})}function su(){const e=p.useContext(ao);if(!e)throw new Error("useTokensData must be used within TokensProvider");return e}function ou({token:e,value:t,onChange:r,placeholder:n,error:o,onClose:a}){const l=p.useCallback(()=>{r("")},[r]),i=p.useCallback(async()=>{try{const f=await navigator.clipboard.readText();f&&r(f.trim())}catch(f){console.error("Failed to read clipboard:",f)}},[r]),c=()=>n||(e?`Enter ${e.network_name} address`:"Enter receiving address"),u=e?.network_name||"destination",d=p.useMemo(()=>za(e?.network_name)||$n,[e?.network_name]);return s.jsxs("div",{className:"bg-[var(--optimex-surface)] rounded-[var(--optimex-radius-input)] p-4 border border-white/[0.05] animate-in slide-in-from-top-2 duration-300",children:[s.jsxs("div",{className:"flex justify-between items-center mb-2",children:[s.jsx("label",{className:"text-[var(--optimex-text-secondary)] text-xs",children:"Recipient Address"}),a&&s.jsx("button",{type:"button",onClick:l,className:"text-[var(--optimex-text-secondary)]/50 hover:text-[var(--optimex-text-secondary)] transition-colors",children:s.jsx(Ie,{className:"size-4"})})]}),s.jsx(Zc,{value:t,onChange:r,placeholder:c(),hasError:!!o,leftIcon:d,rightContent:t?s.jsx("button",{type:"button",onClick:l,className:"text-[var(--optimex-text-secondary)] hover:text-[var(--optimex-text)] transition-colors",children:s.jsx(Ie,{className:"size-5"})}):s.jsx("button",{type:"button",onClick:i,className:"text-[var(--optimex-text-secondary)] hover:text-[var(--optimex-primary)] transition-colors",children:s.jsx(La,{className:"size-5"})})}),o?s.jsxs("p",{className:"text-[10px] text-[var(--optimex-error)] mt-2 flex items-center gap-1",children:[s.jsx(qr,{className:"size-3"}),o]}):s.jsxs("p",{className:"text-[10px] text-[var(--optimex-text-secondary)] mt-2 flex items-center gap-1",children:[s.jsx(qr,{className:"size-3"}),"Ensure the address matches the ",u," network."]})]})}function vn({token:e,value:t,onChange:r,readOnly:n=!1,onSelectToken:o,isLoading:a=!1,loadingText:l="Loading...",balance:i,isOutput:c=!1,isWalletConnected:u=!1,usdValue:d="$0.00"}){const f=h=>{if(n||!r)return;const y=h.target.value;/^[0-9]*\.?[0-9]*$/.test(y)&&r(y)},m=u&&!c&&i!==void 0,b=()=>{if(!i||!r||n)return;const h=(parseFloat(i)/2).toString();r(h)},v=()=>{!i||!r||n||r(i)};return s.jsxs("div",{className:"bg-[var(--optimex-surface)] rounded-[var(--optimex-radius-input)] p-4 flex flex-col gap-2 border border-white/[0.02] focus-within:border-[var(--optimex-primary)]/40 transition-colors",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"text-[var(--optimex-text-secondary)] text-xs",children:c?"To":"From"}),s.jsx("div",{className:"flex items-center gap-2",children:m&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"text-[var(--optimex-text-secondary)] text-xs",children:["Balance: ",i," ",e?.token_symbol]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(fr,{onClick:b,children:"50%"}),s.jsx(fr,{onClick:v,children:"Max"})]})]})})]}),s.jsxs("div",{className:"flex items-center justify-between gap-4",children:[s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("input",{type:"text",inputMode:"decimal",placeholder:"0.0",value:t,onChange:f,readOnly:n,className:"w-full bg-transparent border-none p-0 text-[var(--optimex-text)] text-2xl font-bold focus:ring-0 placeholder:text-[var(--optimex-text-secondary)]/30 outline-none"}),s.jsxs("p",{className:"text-[var(--optimex-text-secondary)] text-xs mt-1",children:["~",d]})]}),s.jsxs("button",{onClick:o,className:"flex items-center gap-2 bg-white/5 hover:bg-white/10 p-2 pr-3 rounded-[9999px] transition-all border border-white/10 active:scale-95 shrink-0",children:[e?s.jsxs(s.Fragment,{children:[s.jsx(De,{token:e,size:"md"}),s.jsxs("div",{className:"text-left",children:[s.jsx("p",{className:"text-[var(--optimex-text)] text-sm font-bold leading-none",children:e.token_symbol}),s.jsx("p",{className:"text-[var(--optimex-text-secondary)] text-[10px] leading-none mt-1",children:e.network_name})]})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"size-8 rounded-[9999px] bg-white/10"}),s.jsx("span",{className:"text-[var(--optimex-text)] text-sm font-bold",children:"Select"})]}),s.jsx(Dn,{className:"size-4 text-[var(--optimex-text-secondary)]"})]})]}),a&&s.jsxs("div",{className:"flex items-center justify-end gap-2 text-sm text-[var(--optimex-text-secondary)]",children:[s.jsx("div",{className:"size-3 animate-spin rounded-[9999px] border border-[var(--optimex-primary)] border-t-transparent"}),s.jsx("span",{children:l})]})]})}const Zt=[.5,.75,1];function au({value:e,onChange:t}){const[r,n]=p.useState(""),[o,a]=p.useState(!Zt.includes(e)),l=p.useCallback(u=>{a(!1),n(""),t(u)},[t]),i=p.useCallback(u=>{const d=u.target.value;if(d===""||/^\d*\.?\d*$/.test(d)){n(d),a(!0);const f=parseFloat(d);!isNaN(f)&&f>0&&f<=50&&t(f)}},[t]),c=p.useCallback(()=>{a(!0),!r&&e&&n(Zt.includes(e)?"":String(e))},[r,e]);return s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-sm font-medium text-[var(--optimex-text)]",children:"Slippage Tolerance"}),s.jsxs("span",{className:"text-sm text-[var(--optimex-text-secondary)]",children:[e,"%"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[Zt.map(u=>s.jsxs(fr,{onClick:()=>l(u),isActive:e===u&&!o,className:"flex-1",children:[u,"%"]},u)),s.jsxs("div",{className:`flex flex-1 items-center justify-center px-2 rounded-md transition-colors shadow-sm bg-white/5 border ${o?"border-[var(--optimex-primary)]":"border-transparent hover:bg-white/10"}`,children:[s.jsx("input",{type:"text",inputMode:"decimal",placeholder:"Custom",value:r,onChange:i,onFocus:c,className:"w-full min-w-0 py-[6px] bg-transparent text-center text-xs outline-none placeholder:text-[var(--optimex-text-secondary)] text-[var(--optimex-text)]"}),s.jsx("span",{className:"text-xs text-[var(--optimex-text-secondary)]",children:"%"})]})]}),e>5&&s.jsx("p",{className:"text-xs text-[var(--optimex-warning)]",children:"This may result in an unfavorable trade. Try lowering your slippage setting."})]})}function iu({isOpen:e,onClose:t,value:r,onChange:n,anchorRef:o}){const a=p.useCallback(l=>{n(l)},[n]);return s.jsx(Yc,{isOpen:e,onClose:t,anchorRef:o,position:"bottom-right",width:"w-96",ariaLabel:"Slippage settings",children:s.jsx(au,{value:r,onChange:a})})}const lu=({title:e})=>s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"size-8 bg-[var(--optimex-primary)] rounded-[var(--optimex-radius-button)] flex items-center justify-center shadow-[0_0_15px_rgba(235,98,0,0.3)]",children:s.jsx(Ma,{className:"w-5 h-auto text-white"})}),s.jsx("h2",{className:"text-xl font-bold tracking-tight text-[var(--optimex-text)]",children:e})]});function cu({title:e="Swap",headerLeft:t,slippage:r=.75,onSlippageChange:n,isSettingsOpen:o=!1,onSettingsToggle:a,onHistoryClick:l,hideHistory:i=!1}){const c=p.useRef(null);return s.jsxs("header",{className:"flex items-center justify-between px-2",children:[t??s.jsx(lu,{title:e}),s.jsxs("div",{className:"flex items-center gap-2",children:[!i&&s.jsx("button",{onClick:l,className:"size-10 rounded-[var(--optimex-radius-button)] bg-white/5 hover:bg-white/10 text-[var(--optimex-text-secondary)] hover:text-[var(--optimex-text)] transition-colors flex items-center justify-center","aria-label":"Trade History",children:s.jsx(Aa,{className:"size-5"})}),s.jsxs("div",{className:"relative",children:[s.jsx("button",{ref:c,onClick:a,className:"size-10 rounded-[var(--optimex-radius-button)] bg-white/5 hover:bg-white/10 text-[var(--optimex-text-secondary)] hover:text-[var(--optimex-text)] transition-colors flex items-center justify-center","aria-label":"Settings",children:s.jsx(Ba,{className:"size-5"})}),s.jsx(iu,{isOpen:o,onClose:()=>a?.(),value:r,onChange:u=>n?.(u),anchorRef:c})]})]})]})}function io({onClick:e,disabled:t}){return s.jsx("div",{className:"!m-0 absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 z-10",children:s.jsx("button",{onClick:e,disabled:t,className:"size-10 rounded-[9999px] bg-[var(--optimex-surface)] border-4 border-white/5 flex items-center justify-center text-[var(--optimex-primary)] hover:scale-110 transition-all shadow-xl disabled:cursor-not-allowed",children:s.jsx(Ra,{className:"size-5"})})})}function uu({quote:e,fromToken:t,toToken:r,amount:n,slippage:o,isFetching:a}){const[l,i]=p.useState(!1),[c,u]=p.useState(!1),d=p.useCallback(()=>{u(g=>!g)},[]),f=p.useCallback(()=>{i(g=>!g)},[]),m=parseFloat(n)||0,b=parseFloat(e.min_amount_out)/Math.pow(10,r.token_decimals),v=m>0?b/m:0,h=b>0?m/b:0,y=()=>c?`1 ${r.token_symbol} = ${h.toFixed(6)} ${t.token_symbol}`:`1 ${t.token_symbol} = ${v.toFixed(6)} ${r.token_symbol}`;return s.jsxs("div",{className:"bg-white/[0.02] rounded-[var(--optimex-radius-button)] border border-white/5 overflow-hidden",children:[s.jsxs("button",{type:"button",onClick:f,className:"w-full flex items-center justify-between p-3 text-xs cursor-pointer hover:bg-white/[0.02] transition-colors",children:[s.jsx("div",{className:"flex items-center gap-2 text-[var(--optimex-text-secondary)] font-medium",children:a?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"size-3 animate-spin rounded-[9999px] border border-[var(--optimex-primary)] border-t-transparent"}),s.jsx("span",{children:"Updating..."})]}):s.jsx("span",{role:"button",tabIndex:0,onClick:g=>{g.stopPropagation(),d()},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.stopPropagation(),d())},className:"hover:text-[var(--optimex-text)] transition-colors",children:y()})}),s.jsx(Dn,{className:`size-4 text-[var(--optimex-text-secondary)] transition-transform ${l?"rotate-180":""}`})]}),l&&s.jsxs("div",{className:"px-3 pb-3 space-y-2 text-xs border-t border-white/5",children:[s.jsxs("div",{className:"flex items-center justify-between pt-3",children:[s.jsx("span",{className:"text-[var(--optimex-text-secondary)]",children:"Min. Received"}),s.jsxs("span",{className:"font-medium text-[var(--optimex-text)]",children:[Ne(e.min_amount_out,r.token_decimals)," ",r.token_symbol]})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-[var(--optimex-text-secondary)]",children:"Est. Time"}),s.jsx("span",{className:"font-medium text-[var(--optimex-primary)]",children:"~10 minutes"})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-[var(--optimex-text-secondary)]",children:"Slippage Tolerance"}),s.jsxs("span",{className:"font-medium text-[var(--optimex-text)]",children:[o,"%"]})]})]})]})}function du({text:e,disabled:t,onClick:r}){return s.jsx("button",{disabled:t,onClick:r,className:"w-full font-semibold text-black bg-[var(--optimex-primary)] hover:brightness-110 py-4 rounded-[var(--optimex-radius-button)] shadow-lg shadow-[var(--optimex-primary)]/30 flex items-center justify-center transition-all active:scale-[0.98] disabled:cursor-not-allowed disabled:opacity-50",children:e})}function fu(){return s.jsxs("a",{href:"https://optimex.com",target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-center gap-1.5 text-[var(--optimex-text-secondary)] text-[10px] opacity-50 hover:opacity-70 transition-opacity",children:[s.jsx("span",{children:"Powered by"}),s.jsx(Ia,{className:"h-3 w-auto"})]})}function hu({value:e,onChange:t,placeholder:r="Search by name or symbol..."}){return s.jsx("div",{className:"flex-shrink-0 p-4 pb-3",children:s.jsxs("div",{className:"relative",children:[s.jsx("input",{type:"text",placeholder:r,value:e,onChange:n=>t(n.target.value),className:"w-full rounded-xl bg-white/5 border border-white/10 px-4 py-3 pl-10 pr-10 text-[var(--optimex-text)] outline-none placeholder:text-[var(--optimex-text-secondary)]/60 transition-colors hover:border-[var(--optimex-primary)] focus:border-[var(--optimex-primary)]"}),s.jsx($a,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-[var(--optimex-text-secondary)]"}),e&&s.jsx("button",{type:"button",onClick:()=>t(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-[var(--optimex-text-secondary)] hover:text-[var(--optimex-text)] transition-colors",children:s.jsx(Ie,{className:"size-5"})})]})})}function mu({networks:e,selectedNetwork:t,onSelectNetwork:r}){return s.jsxs("div",{className:"w-1/3 min-w-[140px] min-h-0 border-r border-white/[0.05] overflow-y-auto p-2",children:[s.jsx("div",{className:"mb-2 px-2 text-xs font-medium uppercase tracking-wider text-[var(--optimex-text-secondary)]",children:"Networks"}),s.jsxs("div",{className:"space-y-1 px-2",children:[s.jsxs("button",{onClick:()=>r(null),className:`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm transition-colors ${t===null?"bg-white/5 text-[var(--optimex-text)]":"text-[var(--optimex-text-secondary)] hover:bg-white/5 hover:text-[var(--optimex-text)]"}`,children:[s.jsx(Ta,{}),s.jsx("span",{children:"All"})]}),e.map(n=>s.jsx(pu,{network:n,isSelected:t===n.network_id,onSelect:()=>r(n.network_id)},n.network_id))]})]})}function pu({network:e,isSelected:t,onSelect:r}){return s.jsxs("button",{onClick:r,className:`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm transition-colors ${t?"bg-white/5 text-[var(--optimex-text)]":"text-[var(--optimex-text-secondary)] hover:bg-white/5 hover:text-[var(--optimex-text)]"}`,children:[e.logo_uri?s.jsx("img",{src:e.logo_uri,alt:e.name,className:"h-8 w-8 rounded-lg",onError:n=>{n.target.style.display="none"}}):s.jsx("div",{className:"h-6 w-6 rounded-full bg-white/10"}),s.jsx("span",{className:"truncate",children:e.name})]})}function xu({tokens:e,selectedSymbol:t,onSelectSymbol:r,maxVisible:n=12}){return s.jsxs("div",{className:"flex-shrink-0 border-b border-white/[0.05] p-2",children:[s.jsx("div",{className:"mb-2 px-2 text-xs font-medium uppercase tracking-wider text-[var(--optimex-text-secondary)]",children:"Tokens"}),s.jsxs("div",{className:"flex flex-wrap gap-1.5 overflow-hidden max-h-[5rem]",children:[s.jsx("button",{onClick:()=>r(null),className:`border rounded-lg px-2.5 py-1 text-xs font-medium transition-colors ${t===null?"border-[var(--optimex-primary)] text-[var(--optimex-text)]":"border-transparent text-[var(--optimex-text-secondary)] hover:bg-white/10 hover:text-[var(--optimex-text)]"}`,children:"All"}),e.slice(0,n).map(o=>s.jsx(vu,{token:o,isSelected:t===o.token_symbol,onSelect:()=>r(o.token_symbol)},o.token_symbol))]})]})}function vu({token:e,isSelected:t,onSelect:r}){return s.jsxs("button",{onClick:r,className:cs("flex items-center gap-1 rounded-lg px-2.5 py-1 text-xs font-medium transition-colors outline-none border bg-white/5",t?"border-[var(--optimex-primary)] text-[var(--optimex-text)]":"border-transparent text-[var(--optimex-text-secondary)] hover:bg-white/10 hover:text-[var(--optimex-text)]"),children:[e.token_logo_uri&&s.jsx("img",{src:e.token_logo_uri,alt:e.token_symbol,className:"h-4 w-4 rounded-full",onError:n=>{n.target.style.display="none"}}),e.token_symbol]})}function Ze(){const e=p.useContext(Pn);if(!e)throw new Error("useWallet must be used within WalletProvider");return e}function Pt(e){return`https://network-api-stg.bitdex.xyz/${e}/rpc/zwD70RMT9DrE8L5SaMnJNMF8m70Gum`}function gu(e){return e==="bitcoin_testnet"?"https://mempool.space/testnet4/api":"https://mempool.space/api"}function Er(e){return!e.token_address||e.token_address===""||e.token_address==="native"||e.token_address==="0x0000000000000000000000000000000000000000"}function bu(e,t){if(!e||e==="0")return"0";const r=BigInt(e),n=BigInt(10**t),o=r/n,a=r%n;if(a===BigInt(0))return o.toString();let l=a.toString().padStart(t,"0");return l=l.replace(/0+$/,""),l.length>6&&(l=l.slice(0,6)),`${o}.${l}`}function yu(e){return`0x70a08231000000000000000000000000${e.toLowerCase().replace("0x","")}`}async function lo(e,t){const r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok)throw new Error(`RPC request failed: ${r.status}`);return r.json()}async function wu(e,t){const n=await lo(e,{jsonrpc:"2.0",method:"eth_getBalance",params:[t,"latest"],id:1});if(n.error)throw new Error(`RPC error: ${n.error.message}`);const o=n.result||"0x0";return BigInt(o).toString()}async function Cu(e,t,r){const n={jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:yu(r)},"latest"],id:1},o=await lo(e,n);if(o.error)throw new Error(`RPC error: ${o.error.message}`);const a=o.result||"0x0";return BigInt(a).toString()}async function ku(e,t){const r=Pt(e.network_id),n=Er(e);let o;return n?o=await wu(r,t):o=await Cu(r,e.token_address,t),{rawBalance:o,isNative:n}}async function ju(e,t){const n=`${gu(e.network_id)}/address/${t}`,o=await fetch(n);if(!o.ok)throw new Error(`Mempool API request failed: ${o.status}`);const a=await o.json(),l=a.chain_stats.funded_txo_sum-a.chain_stats.spent_txo_sum,i=a.mempool_stats.funded_txo_sum-a.mempool_stats.spent_txo_sum;return{rawBalance:(l+i).toString(),isNative:!0}}async function co(e,t){const r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok)throw new Error(`RPC request failed: ${r.status}`);return r.json()}async function Su(e,t){const n=await co(e,{jsonrpc:"2.0",method:"getBalance",params:[t],id:1});if(n.error)throw new Error(`RPC error: ${n.error.message}`);return(n.result?.value||0).toString()}async function Eu(e,t,r){const o=await co(e,{jsonrpc:"2.0",method:"getTokenAccountsByOwner",params:[r,{mint:t},{encoding:"jsonParsed"}],id:1});if(o.error)throw new Error(`RPC error: ${o.error.message}`);const a=o.result?.value||[];let l=BigInt(0);for(const i of a){const c=i.account.data.parsed.info.tokenAmount.amount;l+=BigInt(c)}return l.toString()}async function Nu(e,t){const r=Pt(e.network_id),n=Er(e);let o;return n?o=await Su(r,t):o=await Eu(r,e.token_address,t),{rawBalance:o,isNative:n}}function Tu(e,t){if(!t)return!1;switch(t){case K.EVM:return e.isEvmConnected;case K.BTC:return e.isBtcConnected;case K.SOLANA:return e.isSolanaConnected;default:return!1}}function Ru(e){if(!e)return"";switch(e){case K.EVM:return"EVM";case K.BTC:return"Bitcoin";case K.SOLANA:return"Solana";default:return e}}function Ou(e,t){if(!t)return null;switch(t){case K.EVM:return e.evmAddress;case K.BTC:return e.btcAddress;case K.SOLANA:return e.solanaAddress;default:return null}}async function uo({provider:e,address:t,chainId:r,chainName:n="Unknown"}){let o=t;if(!o){const l=await e.request({method:"eth_accounts"});if(!l||l.length===0)throw new Error("No accounts found. Please connect your wallet first.");o=l[0]}let a=r;if(a===void 0){const l=await e.request({method:"eth_chainId"});a=parseInt(l,16)}return fo({provider:e,address:o,chainId:a,chainName:n})}function fo({provider:e,address:t,chainId:r,chainName:n="Unknown"}){return{address:t,publicKey:t,chain:{id:r,name:n,type:"EVM"},sendTransaction:async i=>{const c=i;return await e.request({method:"eth_sendTransaction",params:[{from:t,to:c.to,value:c.value?`0x${c.value.toString(16)}`:void 0,data:c.data}]})},getChainId:async()=>{const i=await e.request({method:"eth_chainId"});return parseInt(i,16)},switchChain:async i=>{try{await e.request({method:"wallet_switchEthereumChain",params:[{chainId:`0x${i.toString(16)}`}]})}catch(c){throw c.code===4902?new Error(`Chain ${i} not found in wallet. Please add it first.`):c}}}}const _u=uo;async function Au(e,t){const r=e.token_address||"native";let n;switch(e.network_type){case K.BTC:n=await ju(e,t);break;case K.SOLANA:n=await Nu(e,t);break;case K.EVM:default:n=await ku(e,t)}return{tokenId:r,networkId:e.network_id,walletAddress:t,rawBalance:n.rawBalance,formattedBalance:bu(n.rawBalance,e.token_decimals),updatedAt:Date.now()}}const Pu=30*1e3,Mu=15*1e3;function Iu(e,t){return!e||!t?["balance"]:["balance",e.network_id,e.token_address||"native",t]}function ho({token:e,walletAddress:t,enabled:r=!0,polling:n=!1,pollingInterval:o=Mu}){const a=r&&!!e&&!!t,{data:l,isLoading:i,isFetching:c,error:u,refetch:d}=Qe({queryKey:Iu(e,t),queryFn:()=>Au(e,t),enabled:a,staleTime:Pu,retry:1,refetchOnWindowFocus:!1,refetchInterval:n?o:!1});return{balance:l,formattedBalance:l?.formattedBalance||"0",isLoading:a&&i,isFetching:a&&c,error:u,refetch:d}}function Lu({token:e,isSelected:t,isDisabled:r,onSelect:n}){const o=Ze(),a=Ou(o,e.network_type),{formattedBalance:l,isLoading:i}=ho({token:e,walletAddress:a,enabled:!!a}),c=!!a;return s.jsxs("button",{onClick:n,disabled:r,className:`flex w-full items-center gap-3 rounded-lg p-2 transition-colors ${t?"bg-white/5 text-[var(--optimex-text)]":r?"cursor-not-allowed opacity-50":"hover:bg-white/5"}`,children:[s.jsx(De,{token:e}),s.jsxs("div",{className:"flex-1 text-left",children:[s.jsx("div",{className:"text-sm text-[var(--optimex-text-secondary)]",children:e.token_name}),s.jsxs("div",{className:"flex items-center gap-2",children:[c&&s.jsx("span",{className:"text-sm font-medium text-[var(--optimex-text)]",children:i?s.jsx("span",{className:"inline-block h-4 w-12 animate-pulse rounded bg-white/10"}):l}),s.jsx("span",{className:"font-medium text-[var(--optimex-text)]",children:e.token_symbol})]})]}),t&&s.jsx(gr,{className:"h-5 w-5 text-[var(--optimex-primary)]"})]})}function Du({tokens:e,selectedTokenId:t,disabledTokenId:r,disabledTokenIds:n,isLoading:o,emptyMessage:a="No tokens available",onSelect:l}){return o?s.jsx("div",{className:"flex-1 overflow-y-auto p-2",children:s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-[var(--optimex-primary)] border-t-transparent"})})}):e.length===0?s.jsx("div",{className:"flex-1 overflow-y-auto p-2",children:s.jsx("div",{className:"py-8 text-center text-[var(--optimex-text-secondary)]",children:a})}):s.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto p-2",children:s.jsx("div",{className:"space-y-1",children:e.map(i=>{const c=r===i.token_id||n?.has(i.token_id)===!0;return s.jsx(Lu,{token:i,isSelected:t===i.token_id,isDisabled:c,onSelect:()=>l(i)},i.token_id)})})})}function Fu({isOpen:e,onClose:t,onSelect:r,tokensData:n,isLoading:o,selectedToken:a,disabledTokenId:l,disabledTokenIds:i,tokens:c,emptyMessage:u,title:d="Select Token",filterNetworkType:f}){const[m,b]=p.useState(""),[v,h]=p.useState(null),[y,g]=p.useState(null),S=p.useMemo(()=>n?.supported_networks?f?n.supported_networks.filter(M=>M.type===f):n.supported_networks:[],[n,f]),k=c??n?.tokens,w=p.useMemo(()=>k?k.filter(M=>{if(f&&M.network_type!==f||v&&M.network_id!==v)return!1;if(m){const $=(W,V)=>W.toLowerCase().includes(V.toLowerCase()),_=m.toLowerCase();return $(M.token_symbol,_)||$(M.token_name,_)||$(M.token_address,_)}return!0}):[],[k,m,v,f]),N=p.useMemo(()=>{if(!k)return[];const M=new Map;return k.forEach($=>{f&&$.network_type!==f||v&&$.network_id!==v||M.has($.token_symbol)||M.set($.token_symbol,$)}),Array.from(M.values())},[k,f,v]),A=p.useMemo(()=>y?w.filter(M=>M.token_symbol===y):w,[w,y]),C=()=>{b(""),h(null),g(null)},j=M=>{r(M),t(),C()},O=M=>{M||(t(),C())},D=M=>{h(M),g(null)};return s.jsx(jr,{open:e,onOpenChange:O,title:d,height:"70vh",children:s.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[s.jsx(hu,{value:m,onChange:b}),s.jsxs("div",{className:"flex flex-1 min-h-0 overflow-hidden",children:[s.jsx(mu,{networks:S,selectedNetwork:v,onSelectNetwork:D}),s.jsxs("div",{className:"flex flex-1 min-h-0 flex-col overflow-hidden pl-2",children:[s.jsx(xu,{tokens:N,selectedSymbol:y,onSelectSymbol:g}),s.jsx(Du,{tokens:A,selectedTokenId:a?.token_id,disabledTokenId:l,disabledTokenIds:i,isLoading:o,emptyMessage:m?"No tokens found":u??"No tokens available",onSelect:j})]})]})]})})}function gn({token:e,amount:t,label:r,isEstimated:n=!1,highlight:o=!1,usdValue:a="$0.00"}){return s.jsx("div",{className:`p-4 rounded-xl border transition-all duration-200 ${o?"bg-zinc-900/50 border-[var(--optimex-primary)]/20 shadow-[0_0_15px_rgba(235,98,0,0.1)]":"bg-zinc-900/50 border-white/5"}`,children:s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"size-12 flex items-center justify-center ",children:s.jsx(De,{token:e,size:"lg"})}),s.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0",children:[s.jsxs("p",{className:`text-xs font-medium uppercase tracking-wider ${o?"text-[var(--optimex-primary)]":"text-zinc-500"}`,children:[r," ",n&&"(Est.)"]}),s.jsx("p",{className:"text-white text-sm font-semibold truncate",children:e.token_symbol}),s.jsx("p",{className:"text-zinc-500 text-xs truncate",children:e.network_name})]}),s.jsxs("div",{className:"flex flex-col items-end gap-0.5 ml-auto shrink-0",children:[s.jsx("p",{className:"text-white text-lg font-bold",children:n?`~${t}`:t}),s.jsx("p",{className:"text-zinc-400 text-xs",children:a})]})]})})}function $u({fromToken:e,toToken:t,fromAmount:r,toAmount:n,fromUsdValue:o="$0.00",toUsdValue:a="$0.00"}){return s.jsxs("div",{className:"relative flex flex-col gap-2",children:[s.jsx(gn,{token:e,amount:r,label:"You Pay",usdValue:o}),s.jsx(io,{onClick:()=>{},disabled:!0}),s.jsx(gn,{token:t,amount:n,label:"You Receive",usdValue:a})]})}function Xt({label:e,value:t,borderTop:r}){return s.jsxs("div",{className:`flex justify-between items-center text-sm ${r?"pt-2 mt-2 border-t border-white/5":""}`,children:[s.jsx("span",{className:"text-zinc-500",children:e}),s.jsx("div",{className:"flex items-center gap-1 text-white font-medium",children:t})]})}function Bu({minReceived:e,estimatedTime:t,slippage:r,networkFee:n="Included"}){return s.jsxs("div",{className:"bg-[var(--optimex-surface)] rounded-xl p-4 border border-white/5 space-y-3",children:[s.jsx(Xt,{label:"Min. Received",value:e}),s.jsx(Xt,{label:"Estimated Time",value:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"size-2 bg-[var(--optimex-primary)] rounded-full animate-pulse shadow-[0_0_8px_rgba(235,98,0,0.8)]"}),s.jsx("span",{children:t})]})}),s.jsx(Xt,{label:"Slippage Tolerance",value:r})]})}const zu=3e4,Wu=6e4;function Rt({symbol:e,enabled:t=!0}){const r=lt(),{data:n,isLoading:o,isError:a}=Qe({queryKey:["tokenPrice",e],queryFn:async()=>{if(!e)throw new Error("Symbol is required");return(await Ge(r.apiBaseUrl).getTokenPrice(e)).current_price},enabled:t&&!!e,staleTime:zu,refetchInterval:Wu,retry:2});return{price:n??null,isLoading:o,isError:a,calculateUsdValue:i=>{if(!n||!i||isNaN(parseFloat(i)))return"$0.00";const c=parseFloat(i);if(c===0)return"$0.00";const u=c*n;return u<.01?"<$0.01":u<1?`$${u.toFixed(4)}`:u<1e3?`$${u.toFixed(2)}`:u<1e6?`$${(u/1e3).toFixed(2)}K`:`$${(u/1e6).toFixed(2)}M`}}}function Vu({isOpen:e,onClose:t,onConfirm:r,fromToken:n,toToken:o,amountIn:a,quote:l,slippage:i,stage:c,receivingAddress:u=""}){const d=c!=="idle"&&c!=="confirming"&&c!=="error"&&c!=="submitted",f=c==="submitted",m=c==="error",b=Ne(l.min_amount_out,o.token_decimals),{calculateUsdValue:v}=Rt({symbol:n.token_symbol,enabled:e}),{calculateUsdValue:h}=Rt({symbol:o.token_symbol,enabled:e}),y=v(a),g=h(b),S=w=>{!w&&!d&&t()},k=f?"Swap Complete":m?"Swap Failed":"Review Swap";return s.jsxs(jr,{open:e,onOpenChange:S,title:k,showCloseButton:!d,className:"w-full max-w-md",children:[s.jsxs(qc,{className:"space-y-3",children:[s.jsx($u,{fromToken:n,toToken:o,fromAmount:a,toAmount:b,fromUsdValue:y,toUsdValue:g}),s.jsx(Bu,{minReceived:`${b} ${o.token_symbol}`,estimatedTime:"~10 minutes",slippage:`${i}%`}),u&&s.jsx("div",{className:"bg-[var(--optimex-surface)] rounded-xl px-2 border border-white/5",children:s.jsx(Va,{icon:$n,label:"Receiving Address",address:u})})]}),s.jsx(Qc,{children:s.jsx(Mi,{state:d?"processing":f?"success":m?"error":"idle",onConfirm:f?t:r,confirmText:"Confirm Swap"})})]})}function Hu({swap:e}){const{tokens:t,modals:r,tokenSelect:n,actions:o,input:a,quote:l,execution:i}=e;return s.jsxs(s.Fragment,{children:[r.tokenSelect.isOpen&&s.jsx(Fu,{isOpen:r.tokenSelect.isOpen,onClose:r.tokenSelect.close,onSelect:o.selectToken,tokensData:t.data,isLoading:!1,selectedToken:n.type==="from"?t.from:t.to,disabledTokenId:n.type==="from"?t.to?.token_id:t.from?.token_id,tokens:n.type==="to"?t.availableTo:t.all,emptyMessage:n.type==="to"?"No available pairs for selected source token":void 0,title:n.type==="from"?"Select Source Token":"Select Destination Token"}),l.data&&t.from&&t.to&&r.confirm.isOpen&&s.jsx(Vu,{isOpen:r.confirm.isOpen,onClose:o.closeConfirmModal,onConfirm:o.confirmSwap,fromToken:t.from,toToken:t.to,amountIn:a.amount,quote:l.data,slippage:a.slippage,stage:i.stage,txHash:i.txHash,error:i.error,receivingAddress:e.addresses.receiving})]})}function Nr({status:e}){const t={pending:{icon:Fn,text:"Processing",bgClass:"bg-yellow-500/10",textClass:"text-yellow-500",animate:!0},success:{icon:gr,text:"Completed",bgClass:"bg-green-500/10",textClass:"text-green-500",animate:!1},failed:{icon:Oa,text:"Failed",bgClass:"bg-red-500/10",textClass:"text-red-500",animate:!1}},{icon:r,text:n,bgClass:o,textClass:a,animate:l}=t[e];return s.jsxs("div",{className:`flex items-center gap-1.5 px-2.5 py-1 rounded-full ${o}`,children:[s.jsx(r,{className:`w-4 h-4 ${a} ${l?"animate-spin":""}`}),s.jsx("span",{className:`text-xs font-medium ${a}`,children:n})]})}function Uu({onClose:e}){return s.jsxs("div",{className:"bg-[var(--optimex-surface)] border border-white/10 rounded-xl p-4 mt-3",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("span",{className:"text-xs text-[var(--optimex-text-secondary)] font-medium",children:"Recent Trade"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Nr,{status:"pending"}),e&&s.jsx("button",{onClick:e,className:"text-[var(--optimex-text-secondary)] hover:text-[var(--optimex-text)] transition-colors cursor-pointer","aria-label":"Close",children:s.jsx(Ie,{className:"w-4 h-4"})})]})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-6 h-6 rounded-full bg-white/10 animate-pulse"}),s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("div",{className:"w-16 h-4 bg-white/10 rounded animate-pulse"}),s.jsx("div",{className:"w-10 h-3 bg-white/10 rounded animate-pulse"})]})]}),s.jsx("div",{className:"flex items-center px-3",children:s.jsx("svg",{className:"w-5 h-5 text-[var(--optimex-text-secondary)]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14 5l7 7m0 0l-7 7m7-7H3"})})}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("div",{className:"flex flex-col items-end gap-1",children:[s.jsx("div",{className:"w-16 h-4 bg-white/10 rounded animate-pulse"}),s.jsx("div",{className:"w-10 h-3 bg-white/10 rounded animate-pulse"})]}),s.jsx("div",{className:"w-6 h-6 rounded-full bg-white/10 animate-pulse"})]})]})]})}function qu({trade:e,status:t,isLoading:r,onClose:n}){if(r||!e)return s.jsx(Uu,{onClose:n});const o=e.from_token,a=e.to_token,l=Ne(e.amount_in,o.token_decimals),i=Ne(e.min_amount_out,a.token_decimals);return s.jsxs("div",{className:"bg-[var(--optimex-surface)] border border-white/10 rounded-xl p-4 mt-3",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("span",{className:"text-xs text-[var(--optimex-text-secondary)] font-medium",children:"Recent Trade"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Nr,{status:t}),n&&s.jsx("button",{onClick:n,className:"text-[var(--optimex-text-secondary)] hover:text-[var(--optimex-text)] transition-colors cursor-pointer","aria-label":"Close",children:s.jsx(Ie,{className:"w-4 h-4"})})]})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(De,{token:o,size:"sm",showNetworkBadge:!1}),s.jsxs("div",{className:"flex flex-col",children:[s.jsx("span",{className:"text-sm font-semibold text-[var(--optimex-text)]",children:l}),s.jsx("span",{className:"text-xs text-[var(--optimex-text-secondary)]",children:o.token_symbol})]})]}),s.jsx("div",{className:"flex items-center px-3",children:s.jsx("svg",{className:"w-5 h-5 text-[var(--optimex-text-secondary)]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14 5l7 7m0 0l-7 7m7-7H3"})})}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("div",{className:"flex flex-col items-end",children:[s.jsx("span",{className:"text-sm font-semibold text-[var(--optimex-text)]",children:i}),s.jsx("span",{className:"text-xs text-[var(--optimex-text-secondary)]",children:a.token_symbol})]}),s.jsx(De,{token:a,size:"sm",showNetworkBadge:!1})]})]})]})}const Qu=1e4;function Gu({apiBaseUrl:e,walletAddresses:t,enabled:r=!0,limit:n=20}){const{data:o,isLoading:a,isError:l,refetch:i}=Qe({queryKey:["trades",t,n],queryFn:async()=>Ge(e).listTrades({from_user_address:t,limit:n}),enabled:r&&!!t?.length,refetchInterval:Qu,retry:2,retryDelay:2e3});return{trades:o??[],isLoading:a,isError:l,refetch:i}}function Ku(e){if(!e)return"pending";switch(e.toLowerCase()){case"success":case"completed":return"success";case"failed":case"refunded":case"expired":return"failed";default:return"pending"}}function Yu({trade:e}){const t=e.from_token,r=e.to_token,n=Ku(e.state),o=Ne(e.amount_in,t.token_decimals),a=Ne(e.min_amount_out,r.token_decimals);return s.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-[var(--optimex-surface)] border border-white/10",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(De,{token:t,size:"sm",showNetworkBadge:!1}),s.jsxs("div",{className:"flex flex-col",children:[s.jsx("span",{className:"text-sm font-semibold text-[var(--optimex-text)]",children:o}),s.jsx("span",{className:"text-xs text-[var(--optimex-text-secondary)]",children:t.token_symbol})]})]}),s.jsx("div",{className:"flex items-center px-2",children:s.jsx("svg",{className:"w-4 h-4 text-[var(--optimex-text-secondary)]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14 5l7 7m0 0l-7 7m7-7H3"})})}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("div",{className:"flex flex-col items-end",children:[s.jsx("span",{className:"text-sm font-semibold text-[var(--optimex-text)]",children:a}),s.jsx("span",{className:"text-xs text-[var(--optimex-text-secondary)]",children:r.token_symbol})]}),s.jsx(De,{token:r,size:"sm",showNetworkBadge:!1})]}),s.jsx("div",{className:"ml-3",children:s.jsx(Nr,{status:n})})]})}function Jt(){return s.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-[var(--optimex-surface)] border border-white/10",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-6 h-6 rounded-full bg-[var(--optimex-border)] animate-pulse"}),s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("div",{className:"w-14 h-4 bg-[var(--optimex-border)] rounded animate-pulse"}),s.jsx("div",{className:"w-8 h-3 bg-[var(--optimex-border)] rounded animate-pulse"})]})]}),s.jsx("div",{className:"w-4 h-4 bg-[var(--optimex-border)] rounded animate-pulse"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("div",{className:"flex flex-col items-end gap-1",children:[s.jsx("div",{className:"w-14 h-4 bg-[var(--optimex-border)] rounded animate-pulse"}),s.jsx("div",{className:"w-8 h-3 bg-[var(--optimex-border)] rounded animate-pulse"})]}),s.jsx("div",{className:"w-6 h-6 rounded-full bg-[var(--optimex-border)] animate-pulse"})]}),s.jsx("div",{className:"ml-3 w-20 h-6 bg-[var(--optimex-border)] rounded-full animate-pulse"})]})}function Zu(){return s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[s.jsx("div",{className:"w-16 h-16 mb-4 rounded-full bg-[var(--optimex-surface)] flex items-center justify-center",children:s.jsx("svg",{className:"w-8 h-8 text-[var(--optimex-text-secondary)]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})})}),s.jsx("p",{className:"text-sm text-[var(--optimex-text-secondary)]",children:"No trade history yet"})]})}function Xu({open:e,onOpenChange:t,evmAddress:r,btcAddress:n,solanaAddress:o}){const a=lt(),l=[r,n,o].filter(u=>!!u),{trades:i,isLoading:c}=Gu({apiBaseUrl:a.apiBaseUrl,walletAddresses:l.length>0?l:void 0,enabled:e&&l.length>0});return s.jsx(jr,{open:e,onOpenChange:t,title:"Trade History",className:"w-full max-w-md",children:s.jsxs("div",{className:"p-4 space-y-3 max-h-[60vh] overflow-y-auto",children:[c?s.jsxs(s.Fragment,{children:[s.jsx(Jt,{}),s.jsx(Jt,{}),s.jsx(Jt,{})]}):i.length===0?s.jsx(Zu,{}):i.map(u=>s.jsx(Yu,{trade:u},u.trade_id)),!c&&i.length>0&&s.jsxs("div",{className:"flex items-center justify-center gap-2 pt-2 text-xs text-[var(--optimex-text-secondary)]",children:[s.jsx(Fn,{className:"w-3 h-3 animate-spin"}),s.jsx("span",{children:"Auto-refreshing"})]})]})})}function Ju(e,t){return p.useMemo(()=>{const r=e.trim();if(!t||!r)return{isValid:!r,error:void 0};const n=vr(r,t.network_type,t.network_id);return{isValid:n.isValid,error:n.isValid?void 0:n.error}},[e,t])}function ed(){const[e,t]=p.useState(null),[r,n]=p.useState(!1),[o,a]=p.useState(!1),l=p.useCallback(()=>t("from"),[]),i=p.useCallback(()=>t("to"),[]),c=p.useCallback(()=>t(null),[]),u=p.useCallback(()=>n(!0),[]),d=p.useCallback(()=>n(!1),[]),f=p.useCallback(()=>a(b=>!b),[]),m=p.useCallback(()=>a(!1),[]);return{tokenSelect:{isOpen:e!==null,type:e,openFrom:l,openTo:i,close:c},confirm:{isOpen:r,open:u,close:d},settings:{isOpen:o,toggle:f,close:m}}}function td({fromToken:e,toToken:t,amount:r,fromUserAddress:n,toUserAddress:o,userRefundPubkey:a,slippage:l,config:i}){return p.useMemo(()=>{const c=o.trim(),u=i.affiliateAddress&&i.affiliateFee?[{provider:i.affiliateProvider??"optimex-widget",rate:String(i.affiliateFee),receiver:i.affiliateAddress,network:"ethereum"}]:void 0,d=Math.round(l*100);return{from_token:e,to_token:t,amount:r,from_user_address:n,to_user_address:c||null,user_refund_pubkey:a,slippage:String(d),affiliate_fee_bps:i.affiliateFee?String(i.affiliateFee):void 0,affiliate_info:u,trade_timeout:i.tradeTimeout,script_timeout:i.scriptTimeout}},[e,t,r,n,o,a,l,i.affiliateFee,i.affiliateAddress,i.affiliateProvider,i.tradeTimeout,i.scriptTimeout])}function rd(e,t){return p.useMemo(()=>{if(!e||!t)return{walletAccount:void 0,evmWalletAccount:void 0};switch(e.network_type){case K.EVM:return{walletAccount:t.evm,evmWalletAccount:t.evm};case K.BTC:return{walletAccount:t.btc,evmWalletAccount:void 0};case K.SOLANA:return{walletAccount:t.solana,evmWalletAccount:void 0};default:return{walletAccount:void 0,evmWalletAccount:void 0}}},[e,t])}const bn={BTC:1,EVM:2,Solana:3};function nd(e){const{tokens:t,pairs:r,selectedFromToken:n}=e,o=p.useMemo(()=>{const b=new Map;if(!r)return b;for(const v of r){if(!v.is_active)continue;const h=b.get(v.from_token_id);h?h.add(v.to_token_id):b.set(v.from_token_id,new Set([v.to_token_id]))}return b},[r]),a=p.useMemo(()=>t??[],[t]),l=p.useMemo(()=>{const b=new Set;for(const v of a){const h=o.get(v.token_id);(!h||h.size===0)&&b.add(v.token_id)}return b},[a,o]),i=p.useMemo(()=>{if(!n)return[];const b=o.get(n.token_id);return!b||b.size===0?[]:a.filter(v=>b.has(v.token_id))},[n,o,a]),c=p.useCallback((b,v)=>o.get(b)?.has(v)??!1,[o]),u=p.useCallback(b=>(o.get(b)?.size??0)>0,[o]),d=p.useCallback(b=>[...b].sort((v,h)=>{const y=bn[v.network_type]??99,g=bn[h.network_type]??99;return y-g}),[]),f=p.useCallback(b=>{const v=o.get(b.token_id);if(!v||v.size===0)return null;const h=a.filter(g=>v.has(g.token_id));return h.length===0?null:d(h)[0]??null},[o,a,d]),m=p.useCallback(()=>{if(a.length===0)return null;const b=d(a);for(const v of b){const h=f(v);if(h)return{fromToken:v,toToken:h}}return null},[a,d,f]);return{allTokens:a,tokensWithoutPairs:l,availableToTokens:i,isPairValid:c,findBestToToken:f,hasValidPairs:u,getDefaultPair:m}}function sd(e){if(!e.chain_id||e.network_type!=="EVM")return;const t=parseInt(e.chain_id,10);return isNaN(t)?void 0:t}async function od(e,t){const r=sd(t);if(!r)throw new Error(`Cannot determine chain ID for token: ${t.token_id}`);return await e.getChainId()===r?!1:(await e.switchChain(r),!0)}const ad="0xdd62ed3e",id="0x095ea7b3",ld="0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff";function hr(e){return e.toLowerCase().replace("0x","").padStart(64,"0")}function cd(e){return e.toString(16).padStart(64,"0")}function ud(e){const t=e.startsWith("0x")?e.slice(2):e;return!t||t===""?0n:BigInt("0x"+t)}async function dd(e,t,r,n){const o=Pt(e),a=ad+hr(r)+hr(n),i=await(await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:"eth_call",params:[{to:t,data:a},"latest"]})})).json();if(i.error)throw new Error(`Failed to check allowance: ${i.error.message}`);return ud(i.result)}function fd(e,t){const r=t?cd(t):ld.slice(2);return`${id}${hr(e)}${r}`}async function hd(e,t,r,n){const o=fd(r,n);return await e.sendTransaction({to:t,data:o})}async function md(e,t,r=60,n=2e3){const o=Pt(e);for(let a=0;a<r;a++){const i=await(await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:"eth_getTransactionReceipt",params:[t]})})).json();if(i.error)throw new Error(`RPC error: ${i.error.message}`);if(i.result){const c=i.result;return{status:c.status==="0x1"?"success":"reverted",blockNumber:c.blockNumber,transactionHash:c.transactionHash}}await new Promise(c=>setTimeout(c,n))}throw new Error(`Transaction ${t} not confirmed after ${r} attempts`)}function pd(e){return e?"getChainId"in e&&"switchChain"in e&&typeof e.getChainId=="function"&&typeof e.switchChain=="function":!1}function xd({apiBaseUrl:e,onWalletTx:t,onSubmitTx:r,onError:n}){const[o,a]=p.useState({stage:"idle",txHash:null,tradeId:null,error:null}),l=p.useCallback(()=>{a({stage:"idle",txHash:null,tradeId:null,error:null})},[]),i=p.useCallback(()=>{a(f=>({stage:"idle",txHash:f.txHash,tradeId:f.tradeId,error:null}))},[]),c=p.useCallback((f,m,b)=>{a(v=>({...v,stage:"error",error:f})),n?.({error:f,stage:m,trade_id:b})},[n]),u=p.useCallback(async(f,m,b,v)=>{const h=b.deposit_address;if(!h)throw new Error("Missing deposit address for EVM transaction");a(k=>({...k,stage:"switching_chain"})),await od(f,m);const y=Er(m);if(!y&&m.token_address&&(a(w=>({...w,stage:"checking_allowance"})),await dd(m.network_id,m.token_address,f.address,h)<v)){a(A=>({...A,stage:"approving"}));const w=await hd(f,m.token_address,h,v);if((await md(m.network_id,w)).status==="reverted")throw new Error("Token approval transaction reverted")}a(k=>({...k,stage:"broadcasting"}));const g={to:h,value:y?v:0n,data:b.payload?b.payload:void 0};return await f.sendTransaction(g)},[]),d=p.useCallback(async({quote:f,fromToken:m,toToken:b,amountIn:v,walletAccount:h,evmWalletAccount:y})=>{const g=Ge(e);try{a({stage:"confirming",txHash:null,tradeId:f.trade_id,error:null});const S=y||h;if(!S)throw new Error("Wallet not available");a(N=>({...N,stage:"signing"}));let k;const w=In(v,m.token_decimals);if(m.network_type===K.EVM){const N=y||(pd(h)?h:null);if(N)k=await u(N,m,f,w);else{const A=f.deposit_address,C=f.payload?f.payload:void 0;if(!A)throw new Error("Missing deposit address for EVM transaction");a(O=>({...O,stage:"broadcasting"}));const j={to:A,value:w,data:C};k=await S.sendTransaction(j)}}else if(m.network_type===K.BTC){if(!f.deposit_address)throw new Error("Missing deposit address for BTC transaction");a(N=>({...N,stage:"broadcasting"})),k=await S.sendTransaction({toAddress:f.deposit_address,amount:w})}else if(m.network_type===K.SOLANA){if(!f.payload)throw new Error("Missing payload for Solana transaction");a(N=>({...N,stage:"broadcasting"})),k=await S.sendTransaction(f.payload)}else throw new Error(`Unsupported network type: ${m.network_type}`);t?.({trade_id:f.trade_id,tx_hash:k,from_token:m,to_token:b,amount_in:v}),a(N=>({...N,txHash:k,stage:"submitting"}));try{await g.submitTransaction(f.trade_id,k),r?.({trade_id:f.trade_id,tx_hash:k,status:"success"})}catch(N){throw r?.({trade_id:f.trade_id,tx_hash:k,status:"error",error:N.message}),N}return a(N=>({...N,stage:"submitted"})),{tradeId:f.trade_id,txHash:k}}catch(S){const k=o.stage==="approving"?"approval":"wallet_tx";throw c(S,k,f.trade_id),S}},[e,t,r,c,u,o.stage]);return{...o,executeSwap:d,resetState:l,resetStateKeepTradeId:i,isExecuting:o.stage!=="idle"&&o.stage!=="submitted"&&o.stage!=="error"}}function vd({defaultPair:e,isPairValid:t,findBestToToken:r,hasValidPairs:n,defaultSlippage:o=.75,selectingToken:a=null}){const[l,i]=p.useState(null),[c,u]=p.useState(null),[d,f]=p.useState(""),[m,b]=p.useState(""),[v,h]=p.useState(o),y=l??e?.fromToken??null,g=c??e?.toToken??null,S=p.useCallback(()=>{y&&g&&t(g.token_id,y.token_id)&&(i(g),u(y),f(""))},[y,g,t]),k=p.useCallback(w=>{if(a==="from"){if(!n(w.token_id))return!1;if(w.token_id===g?.token_id)u(y);else if(g&&!t(w.token_id,g.token_id)){const N=r(w);u(N)}return i(w),!0}else if(a==="to")return w.token_id===y?.token_id&&i(g),u(w),!0;return!1},[a,y,g,t,r,n]);return{fromToken:y,toToken:g,handleTokenSelect:k,handleSwapDirection:S,amount:d,setAmount:f,receivingAddress:m,setReceivingAddress:b,slippage:v,setSlippage:h}}function gd({fromToken:e,toToken:t}){const r=Ze();return p.useMemo(()=>{const n=r.evmAddress,o=r.btcAddress,a=r.btcPublicKey;let l=null,i=null;return e?.network_type===K.EVM?(l=n,i=n):e?.network_type===K.BTC&&(l=o,i=a),{fromUserAddress:l,userRefundPubkey:i}},[r.evmAddress,r.btcAddress,r.btcPublicKey,e,t])}function bd({fromToken:e,toToken:t,amount:r,quote:n,isLoadingQuote:o,isFetchingQuote:a,receivingAddress:l,onConnectWallet:i,onSwap:c}){const u=Ze();return p.useMemo(()=>{if(!Tu(u,e?.network_type)){const m=Ru(e?.network_type);return{text:m?`Connect ${m} Wallet`:"Connect Wallet",disabled:!1,action:i}}return!e||!t?{text:"Select Tokens",disabled:!0,action:void 0}:!r||parseFloat(r)<=0?{text:"Enter Amount",disabled:!0,action:void 0}:l.trim()?vr(l,t.network_type,t.network_id).isValid?o||a?{text:"Getting Quote...",disabled:!0,action:void 0}:n?{text:"Review",disabled:!1,action:c}:{text:"Unable to Quote",disabled:!0,action:void 0}:{text:"Enter Receiving Address",disabled:!0,action:void 0}:{text:"Enter Receiving Address",disabled:!0,action:void 0}},[u.isEvmConnected,u.isBtcConnected,u.isSolanaConnected,e,t,r,o,a,n,i,c,l])}function yd({tokens:e,defaultFromToken:t,defaultToToken:r,isPairValid:n}){return p.useMemo(()=>{if(!t||!r||!e)return null;const o=e.find(l=>l.token_id===t),a=e.find(l=>l.token_id===r);return!o||!a?null:n(o.token_id,a.token_id)?{fromToken:o,toToken:a}:null},[e,t,r,n])}function wd(){const e=Ze(),t=lt(),r=ed(),{tokensData:n}=su(),o=n.tokens,a=n.pairs,{allTokens:l,tokensWithoutPairs:i,isPairValid:c,findBestToToken:u,hasValidPairs:d,getDefaultPair:f}=nd({tokens:o,pairs:a,selectedFromToken:null}),b=yd({tokens:o,defaultFromToken:t.defaultFromToken,defaultToToken:t.defaultToToken,isPairValid:c})??f(),{fromToken:v,toToken:h,handleTokenSelect:y,handleSwapDirection:g,amount:S,setAmount:k,receivingAddress:w,setReceivingAddress:N,slippage:A,setSlippage:C}=vd({defaultPair:b,isPairValid:c,findBestToToken:u,hasValidPairs:d,defaultSlippage:t.defaultSlippage,selectingToken:r.tokenSelect.type}),j=p.useMemo(()=>v?l.filter(F=>c(v.token_id,F.token_id)):[],[v,l,c]),O=Ju(w,h),{fromUserAddress:D,userRefundPubkey:M}=gd({fromToken:v,toToken:h}),$=td({fromToken:v,toToken:h,amount:S,fromUserAddress:D,toUserAddress:w,userRefundPubkey:M,slippage:A,config:{affiliateFee:t.affiliateFee,affiliateAddress:t.affiliateAddress,affiliateProvider:t.affiliateProvider,tradeTimeout:t.tradeTimeout,scriptTimeout:t.scriptTimeout}}),_=!!v&&!!h&&parseFloat(S)>0&&!!w.trim()&&!r.confirm.isOpen,{data:W,isLoading:V,isFetching:Q,refetch:H}=Ea(t.apiBaseUrl,{...$,enabled:_,onQuote:t.callbacks?.onQuote}),E=xd({apiBaseUrl:t.apiBaseUrl,onWalletTx:t.callbacks?.onWalletTx,onSubmitTx:t.callbacks?.onSubmitTx,onError:t.callbacks?.onError}),{walletAccount:ne,evmWalletAccount:ie}=rd(v,e.externalWalletClient??void 0),Te=p.useCallback(()=>{e.isExternalWallet?e.onRequestWallet?.(v?.network_id??""):e.openConnectModal?.()},[e,v?.network_id]),pe=p.useCallback(()=>{!W||!v||!h||(E.resetState(),r.confirm.open())},[W,v,h,r.confirm,E]),U=p.useCallback((F=!1)=>{E.isExecuting||(r.confirm.close(),F&&E.resetStateKeepTradeId())},[E,r.confirm]),Z=p.useCallback(async()=>{if(!(!W||!v||!h))try{const{txHash:F}=await E.executeSwap({quote:W,fromToken:v,toToken:h,amountIn:S,walletAccount:ne,evmWalletAccount:ie});U(!!F),k(""),N("")}catch(F){console.error("Swap failed:",F)}},[W,v,h,S,ne,ie,E,U,k,N]),de=p.useCallback(F=>{y(F)&&r.tokenSelect.close()},[y,r.tokenSelect]),be=bd({fromToken:v,toToken:h,amount:S,quote:W,isLoadingQuote:V,isFetchingQuote:Q,receivingAddress:w,onConnectWallet:Te,onSwap:pe});return{tokens:{from:v,to:h,all:l,availableTo:j,withoutPairs:i,data:n},input:{amount:S,setAmount:k,receivingAddress:w,setReceivingAddress:N,slippage:A,setSlippage:C},quote:{data:W,isLoading:V,isFetching:Q,refetch:H},validation:{address:O},buttonState:be,modals:r,tokenSelect:{type:r.tokenSelect.type},actions:{selectToken:de,swapDirection:g,connectWallet:Te,openSwapConfirm:pe,closeConfirmModal:U,confirmSwap:Z},execution:{stage:E.stage,txHash:E.txHash,tradeId:E.tradeId,error:E.error,isExecuting:E.isExecuting},wallet:e,addresses:{sending:D,receiving:w}}}const Cd=5e3;function yn(e){if(!e)return"pending";switch(e.toLowerCase()){case"success":case"completed":return"success";case"failed":case"refunded":case"expired":return"failed";default:return"pending"}}function kd({apiBaseUrl:e,tradeId:t}){const{data:r,isLoading:n}=Qe({queryKey:["trade",t],queryFn:async()=>Ge(e).getTrade(t),enabled:!!t,refetchInterval:o=>{const a=o.state.data;return a&&yn(a.state)==="success"?!1:Cd},retry:!0,retryDelay:2e3});return{trade:r??null,status:yn(r?.state),isLoading:n}}function mo(){const e=wd(),t=lt(),{tokens:r,input:n,quote:o,modals:a,buttonState:l,validation:i,actions:c,addresses:u,wallet:d,execution:f}=e,[m,b]=p.useState(!1),{trade:v,status:h,isLoading:y}=kd({apiBaseUrl:t.apiBaseUrl,tradeId:f.tradeId}),{formattedBalance:g}=ho({token:r.from,walletAddress:u.sending,enabled:!!r.from&&!!u.sending,polling:!0}),{calculateUsdValue:S}=Rt({symbol:r.from?.token_symbol,enabled:!!r.from}),{calculateUsdValue:k}=Rt({symbol:r.to?.token_symbol,enabled:!!r.to}),w=d.isConnected,N=S(n.amount),A=o.data?k(Ne(o.data.min_amount_out,r.to?.token_decimals||18)):"$0.00";return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex flex-col gap-4 w-full min-w-0",children:[s.jsx(cu,{headerLeft:t.headerLeft,slippage:n.slippage,onSlippageChange:n.setSlippage,isSettingsOpen:a.settings.isOpen,onSettingsToggle:a.settings.toggle,onHistoryClick:()=>b(!0),hideHistory:t.hideHistory||!d.isConnected}),s.jsxs(Sr,{children:[s.jsxs("div",{className:"space-y-2 relative",children:[s.jsx(vn,{token:r.from,value:n.amount,onChange:n.setAmount,onSelectToken:a.tokenSelect.openFrom,balance:g,isWalletConnected:w,usdValue:N}),s.jsx(io,{onClick:c.swapDirection}),s.jsx(vn,{token:r.to,value:o.data?Ne(o.data.min_amount_out,r.to?.token_decimals||18):"",readOnly:!0,onSelectToken:a.tokenSelect.openTo,isOutput:!0,usdValue:A})]}),s.jsx("div",{className:"mt-4",children:s.jsx(ou,{token:r.to,value:n.receivingAddress,onChange:n.setReceivingAddress,error:i.address.error})}),s.jsx("div",{className:"mt-4",children:s.jsx(du,{text:l.text,disabled:l.disabled,onClick:l.action})}),o.data&&r.from&&r.to&&s.jsx("div",{className:"mt-4",children:s.jsx(uu,{quote:o.data,fromToken:r.from,toToken:r.to,amount:n.amount,slippage:n.slippage,isFetching:o.isFetching,onRefresh:o.refetch})}),s.jsx("div",{className:"mt-4",children:s.jsx(fu,{})}),f.tradeId&&f.txHash&&s.jsx("div",{className:"mt-4",children:s.jsx(qu,{trade:v,status:h,isLoading:y})})]})]}),s.jsx(Hu,{swap:e}),m&&s.jsx(Xu,{open:m,onOpenChange:b,evmAddress:d.evmAddress??void 0,btcAddress:d.btcAddress??void 0,solanaAddress:d.solanaAddress??void 0})]})}function jd({className:e,connectLabel:t="Connect Wallet",showNetworkBadge:r=!0,onClick:n}){const o=Ze(),a=o.evmAddress||o.btcAddress||o.solanaAddress,l=()=>{if(n){n();return}o.isExternalWallet?o.onRequestWallet?.():o.openConnectModal?.()},i=()=>r?o.isEvmConnected?s.jsx("span",{className:"rounded bg-blue-500/20 px-1.5 py-0.5 text-xs text-blue-400",children:"EVM"}):o.isBtcConnected?s.jsx("span",{className:"rounded bg-orange-500/20 px-1.5 py-0.5 text-xs text-orange-400",children:"BTC"}):o.isSolanaConnected?s.jsx("span",{className:"rounded bg-purple-500/20 px-1.5 py-0.5 text-xs text-purple-400",children:"SOL"}):null:null;return o.isConnected?s.jsxs("div",{className:`flex items-center gap-2 ${e||""}`,children:[i(),s.jsxs("button",{onClick:l,className:"group flex items-center gap-1.5 rounded-[0.25rem] bg-[var(--optimex-surface-hover)] px-3 py-1.5 text-sm text-[var(--optimex-text)] transition-colors hover:bg-[rgba(239,68,68,0.2)]",children:[s.jsx("span",{children:ba(a)}),s.jsx(Pa,{className:"h-3.5 w-3.5 opacity-0 transition-opacity group-hover:opacity-100"})]})]}):s.jsx("button",{onClick:l,className:`rounded-[0.25rem] bg-[var(--optimex-primary)] px-4 py-1.5 text-sm font-medium text-white transition-colors hover:bg-[var(--optimex-primary-hover)] ${e||""}`,children:t})}function Sd({apiBaseUrl:e,walletClient:t,onRequestWallet:r,theme:n,defaultFromToken:o,defaultToToken:a,headerLeft:l,affiliateFee:i,affiliateAddress:c,affiliateProvider:u,tradeTimeout:d,scriptTimeout:f,defaultSlippage:m=.75,hideHistory:b=!1,children:v,renderLoading:h,renderError:y,queryClient:g,onQuote:S,onWalletTx:k,onSubmitTx:w,onSwapComplete:N,onError:A}){ma(e);const C=p.useMemo(()=>g??new Ho,[g]),O={apiBaseUrl:e,defaultSlippage:m,affiliateFee:i,affiliateAddress:c,affiliateProvider:u,tradeTimeout:d,scriptTimeout:f,defaultFromToken:o,defaultToToken:a,hideHistory:b,headerLeft:l,callbacks:{onQuote:S,onWalletTx:k,onSubmitTx:w,onSwapComplete:N,onError:A},renderLoading:h,renderError:y},D=v??s.jsx(mo,{});return s.jsx("div",{className:"optx-widget",children:s.jsx(Ko,{client:C,children:s.jsx(Na,{value:O,children:s.jsx(da,{theme:n,children:s.jsx(ha,{externalWalletClient:t,onRequestWallet:r,children:s.jsx(nu,{children:D})})})})})})}exports.ConnectButton=jd;exports.SwapCard=mo;exports.SwapWidget=Sd;exports.createEvmWalletClient=uo;exports.createEvmWalletClientAsync=_u;exports.createEvmWalletClientSync=fo;exports.useWallet=Ze;
|
|
55
|
+
){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}`);function Hc(){const e=navigator.userAgent;return typeof window<"u"&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))}function Vc(){return mn(/^Mac/)}function Uc(){return mn(/^iPhone/)}function Yn(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function qc(){return mn(/^iPad/)||Vc()&&navigator.maxTouchPoints>1}function Mo(){return Uc()||qc()}function mn(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.platform):void 0}const Qc=24,Kc=typeof window<"u"?x.useLayoutEffect:x.useEffect;function Zn(...e){return(...t)=>{for(let r of e)typeof r=="function"&&r(...t)}}const Dr=typeof document<"u"&&window.visualViewport;function Xn(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function Po(e){for(Xn(e)&&(e=e.parentElement);e&&!Xn(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}const Gc=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let ur=0,Lr;function Yc(e={}){let{isDisabled:t}=e;Kc(()=>{if(!t)return ur++,ur===1&&Mo()&&(Lr=Zc()),()=>{ur--,ur===0&&Lr?.()}},[t])}function Zc(){let e,t=0,r=h=>{e=Po(h.target),!(e===document.documentElement&&e===document.body)&&(t=h.changedTouches[0].pageY)},n=h=>{if(!e||e===document.documentElement||e===document.body){h.preventDefault();return}let p=h.changedTouches[0].pageY,y=e.scrollTop,v=e.scrollHeight-e.clientHeight;v!==0&&((y<=0&&p>t||y>=v&&p<t)&&h.preventDefault(),t=p)},s=h=>{let p=h.target;Jr(p)&&p!==document.activeElement&&(h.preventDefault(),p.style.transform="translateY(-2000px)",p.focus(),requestAnimationFrame(()=>{p.style.transform=""}))},a=h=>{let p=h.target;Jr(p)&&(p.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{p.style.transform="",Dr&&(Dr.height<window.innerHeight?requestAnimationFrame(()=>{Jn(p)}):Dr.addEventListener("resize",()=>Jn(p),{once:!0}))}))},c=()=>{window.scrollTo(0,0)},i=window.pageXOffset,u=window.pageYOffset,d=Zn(Xc(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let f=Zn(St(document,"touchstart",r,{passive:!1,capture:!0}),St(document,"touchmove",n,{passive:!1,capture:!0}),St(document,"touchend",s,{passive:!1,capture:!0}),St(document,"focus",a,!0),St(window,"scroll",c));return()=>{d(),f(),window.scrollTo(i,u)}}function Xc(e,t,r){let n=e.style[t];return e.style[t]=r,()=>{e.style[t]=n}}function St(e,t,r,n){return e.addEventListener(t,r,n),()=>{e.removeEventListener(t,r,n)}}function Jn(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let r=Po(e);if(r!==document.documentElement&&r!==document.body&&r!==e){let n=r.getBoundingClientRect().top,s=e.getBoundingClientRect().top,a=e.getBoundingClientRect().bottom;const c=r.getBoundingClientRect().bottom+Qc;a>c&&(r.scrollTop+=s-n)}e=r.parentElement}}function Jr(e){return e instanceof HTMLInputElement&&!Gc.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function Jc(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function eu(...e){return t=>e.forEach(r=>Jc(r,t))}function Io(...e){return g.useCallback(eu(...e),e)}const Do=new WeakMap;function he(e,t,r=!1){if(!e||!(e instanceof HTMLElement))return;let n={};Object.entries(t).forEach(([s,a])=>{if(s.startsWith("--")){e.style.setProperty(s,a);return}n[s]=e.style[s],e.style[s]=a}),!r&&Do.set(e,n)}function tu(e,t){if(!e||!(e instanceof HTMLElement))return;let r=Do.get(e);r&&(e.style[t]=r[t])}const ue=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function dr(e,t){if(!e)return null;const r=window.getComputedStyle(e),n=r.transform||r.webkitTransform||r.mozTransform;let s=n.match(/^matrix3d\((.+)\)$/);return s?parseFloat(s[1].split(", ")[ue(t)?13:12]):(s=n.match(/^matrix\((.+)\)$/),s?parseFloat(s[1].split(", ")[ue(t)?5:4]):null)}function ru(e){return 8*(Math.log(e+1)-2)}function Fr(e,t){if(!e)return()=>{};const r=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=r}}function nu(...e){return(...t)=>{for(const r of e)typeof r=="function"&&r(...t)}}const ae={DURATION:.5,EASE:[.32,.72,0,1]},Lo=.4,su=.25,ou=100,Fo=8,Ke=16,en=26,Br="vaul-dragging";function Bo(e){const t=x.useRef(e);return x.useEffect(()=>{t.current=e}),x.useMemo(()=>(...r)=>t.current==null?void 0:t.current.call(t,...r),[])}function au({defaultProp:e,onChange:t}){const r=x.useState(e),[n]=r,s=x.useRef(n),a=Bo(t);return x.useEffect(()=>{s.current!==n&&(a(n),s.current=n)},[n,s,a]),r}function $o({prop:e,defaultProp:t,onChange:r=()=>{}}){const[n,s]=au({defaultProp:t,onChange:r}),a=e!==void 0,c=a?e:n,i=Bo(r),u=x.useCallback(d=>{if(a){const h=typeof d=="function"?d(e):d;h!==e&&i(h)}else s(d)},[a,e,s,i]);return[c,u]}function iu({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:r,drawerRef:n,overlayRef:s,fadeFromIndex:a,onSnapPointChange:c,direction:i="bottom",container:u,snapToSequentialPoint:d}){const[f,h]=$o({prop:e,defaultProp:r?.[0],onChange:t}),[p,y]=x.useState(typeof window<"u"?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);x.useEffect(()=>{function j(){y({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",j),()=>window.removeEventListener("resize",j)},[]);const v=x.useMemo(()=>f===r?.[r.length-1]||null,[r,f]),m=x.useMemo(()=>{var j;return(j=r?.findIndex(N=>N===f))!=null?j:null},[r,f]),w=r&&r.length>0&&(a||a===0)&&!Number.isNaN(a)&&r[a]===f||!r,b=x.useMemo(()=>{const j=u?{width:u.getBoundingClientRect().width,height:u.getBoundingClientRect().height}:typeof window<"u"?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};var N;return(N=r?.map(M=>{const U=typeof M=="string";let W=0;if(U&&(W=parseInt(M,10)),ue(i)){const D=U?W:p?M*j.height:0;return p?i==="bottom"?j.height-D:-j.height+D:D}const K=U?W:p?M*j.width:0;return p?i==="right"?j.width-K:-j.width+K:K}))!=null?N:[]},[r,p,u]),R=x.useMemo(()=>m!==null?b?.[m]:null,[b,m]),T=x.useCallback(j=>{var N;const M=(N=b?.findIndex(U=>U===j))!=null?N:null;c(M),he(n.current,{transition:`transform ${ae.DURATION}s cubic-bezier(${ae.EASE.join(",")})`,transform:ue(i)?`translate3d(0, ${j}px, 0)`:`translate3d(${j}px, 0, 0)`}),b&&M!==b.length-1&&a!==void 0&&M!==a&&M<a?he(s.current,{transition:`opacity ${ae.DURATION}s cubic-bezier(${ae.EASE.join(",")})`,opacity:"0"}):he(s.current,{transition:`opacity ${ae.DURATION}s cubic-bezier(${ae.EASE.join(",")})`,opacity:"1"}),h(r?.[Math.max(M,0)])},[n.current,r,b,a,s,h]);x.useEffect(()=>{if(f||e){var j;const N=(j=r?.findIndex(M=>M===e||M===f))!=null?j:-1;b&&N!==-1&&typeof b[N]=="number"&&T(b[N])}},[f,e,r,b,T]);function k({draggedDistance:j,closeDrawer:N,velocity:M,dismissible:U}){if(a===void 0)return;const W=i==="bottom"||i==="right"?(R??0)-j:(R??0)+j,K=m===a-1,D=m===0,X=j>0;if(K&&he(s.current,{transition:`opacity ${ae.DURATION}s cubic-bezier(${ae.EASE.join(",")})`}),!d&&M>2&&!X){U?N():T(b[0]);return}if(!d&&M>2&&X&&b&&r){T(b[r.length-1]);return}const J=b?.reduce((te,_)=>typeof te!="number"||typeof _!="number"?te:Math.abs(_-W)<Math.abs(te-W)?_:te),re=ue(i)?window.innerHeight:window.innerWidth;if(M>Lo&&Math.abs(j)<re*.4){const te=X?1:-1;if(te>0&&v&&r){T(b[r.length-1]);return}if(D&&te<0&&U&&N(),m===null)return;T(b[m+te]);return}T(J)}function A({draggedDistance:j}){if(R===null)return;const N=i==="bottom"||i==="right"?R-j:R+j;(i==="bottom"||i==="right")&&N<b[b.length-1]||(i==="top"||i==="left")&&N>b[b.length-1]||he(n.current,{transform:ue(i)?`translate3d(0, ${N}px, 0)`:`translate3d(${N}px, 0, 0)`})}function L(j,N){if(!r||typeof m!="number"||!b||a===void 0)return null;const M=m===a-1;if(m>=a&&N)return 0;if(M&&!N)return 1;if(!w&&!M)return null;const W=M?m+1:m-1,K=M?b[W]-b[W-1]:b[W+1]-b[W],D=j/Math.abs(K);return M?1-D:D}return{isLastSnapPoint:v,activeSnapPoint:f,shouldFade:w,getPercentageDragged:L,setActiveSnapPoint:h,activeSnapPointIndex:m,onRelease:k,onDrag:A,snapPointsOffset:b}}const lu=()=>()=>{};function cu(){const{direction:e,isOpen:t,shouldScaleBackground:r,setBackgroundColorOnScale:n,noBodyStyles:s}=Pt(),a=x.useRef(null),c=x.useMemo(()=>document.body.style.backgroundColor,[]);function i(){return(window.innerWidth-en)/window.innerWidth}x.useEffect(()=>{if(t&&r){a.current&&clearTimeout(a.current);const u=document.querySelector("[data-vaul-drawer-wrapper]")||document.querySelector("[vaul-drawer-wrapper]");if(!u)return;nu(n&&!s?Fr(document.body,{background:"black"}):lu,Fr(u,{transformOrigin:ue(e)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${ae.DURATION}s`,transitionTimingFunction:`cubic-bezier(${ae.EASE.join(",")})`}));const d=Fr(u,{borderRadius:`${Fo}px`,overflow:"hidden",...ue(e)?{transform:`scale(${i()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${i()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`}});return()=>{d(),a.current=window.setTimeout(()=>{c?document.body.style.background=c:document.body.style.removeProperty("background")},ae.DURATION*1e3)}}},[t,r,c])}let Et=null;function uu({isOpen:e,modal:t,nested:r,hasBeenOpened:n,preventScrollRestoration:s,noBodyStyles:a}){const[c,i]=x.useState(()=>typeof window<"u"?window.location.href:""),u=x.useRef(0),d=x.useCallback(()=>{if(Yn()&&Et===null&&e&&!a){Et={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:"unset"};const{scrollX:h,innerHeight:p}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:`${-u.current}px`,left:`${-h}px`,right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{const y=p-window.innerHeight;y&&u.current>=p&&(document.body.style.top=`${-(u.current+y)}px`)}),300)}},[e]),f=x.useCallback(()=>{if(Yn()&&Et!==null&&!a){const h=-parseInt(document.body.style.top,10),p=-parseInt(document.body.style.left,10);Object.assign(document.body.style,Et),window.requestAnimationFrame(()=>{if(s&&c!==window.location.href){i(window.location.href);return}window.scrollTo(p,h)}),Et=null}},[c]);return x.useEffect(()=>{function h(){u.current=window.scrollY}return h(),window.addEventListener("scroll",h),()=>{window.removeEventListener("scroll",h)}},[]),x.useEffect(()=>{if(t)return()=>{typeof document>"u"||document.querySelector("[data-vaul-drawer]")||f()}},[t,f]),x.useEffect(()=>{r||!n||(e?(!window.matchMedia("(display-mode: standalone)").matches&&d(),t||window.setTimeout(()=>{f()},500)):f())},[e,n,c,t,r,d,f]),{restorePositionSetting:f}}function du({open:e,onOpenChange:t,children:r,onDrag:n,onRelease:s,snapPoints:a,shouldScaleBackground:c=!1,setBackgroundColorOnScale:i=!0,closeThreshold:u=su,scrollLockTimeout:d=ou,dismissible:f=!0,handleOnly:h=!1,fadeFromIndex:p=a&&a.length-1,activeSnapPoint:y,setActiveSnapPoint:v,fixed:m,modal:w=!0,onClose:b,nested:R,noBodyStyles:T=!1,direction:k="bottom",defaultOpen:A=!1,disablePreventScroll:L=!0,snapToSequentialPoint:j=!1,preventScrollRestoration:N=!1,repositionInputs:M=!0,onAnimationEnd:U,container:W,autoFocus:K=!1}){var D,X;const[J=!1,re]=$o({defaultProp:A,prop:e,onChange:z=>{t?.(z),!z&&!R&&st(),setTimeout(()=>{U?.(z)},ae.DURATION*1e3),z&&!w&&typeof window<"u"&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),z||(document.body.style.pointerEvents="auto")}}),[te,_]=x.useState(!1),[oe,me]=x.useState(!1),[xe,ve]=x.useState(!1),Y=x.useRef(null),ne=x.useRef(null),ye=x.useRef(null),Te=x.useRef(null),F=x.useRef(null),ke=x.useRef(!1),we=x.useRef(null),l=x.useRef(0),C=x.useRef(!1),S=x.useRef(!A),O=x.useRef(0),E=x.useRef(null),$=x.useRef(((D=E.current)==null?void 0:D.getBoundingClientRect().height)||0),H=x.useRef(((X=E.current)==null?void 0:X.getBoundingClientRect().width)||0),B=x.useRef(0),le=x.useCallback(z=>{a&&z===_e.length-1&&(ne.current=new Date)},[]),{activeSnapPoint:V,activeSnapPointIndex:ee,setActiveSnapPoint:We,onRelease:tt,snapPointsOffset:_e,onDrag:rt,shouldFade:He,getPercentageDragged:nt}=iu({snapPoints:a,activeSnapPointProp:y,setActiveSnapPointProp:v,drawerRef:E,fadeFromIndex:p,overlayRef:Y,onSnapPointChange:le,direction:k,container:W,snapToSequentialPoint:j});Yc({isDisabled:!J||oe||!w||xe||!te||!M||!L});const{restorePositionSetting:st}=uu({isOpen:J,modal:w,nested:R??!1,hasBeenOpened:te,preventScrollRestoration:N,noBodyStyles:T});function Pe(){return(window.innerWidth-en)/window.innerWidth}function ot(z){var G,Z;!f&&!a||E.current&&!E.current.contains(z.target)||($.current=((G=E.current)==null?void 0:G.getBoundingClientRect().height)||0,H.current=((Z=E.current)==null?void 0:Z.getBoundingClientRect().width)||0,me(!0),ye.current=new Date,Mo()&&window.addEventListener("touchend",()=>ke.current=!1,{once:!0}),z.target.setPointerCapture(z.pointerId),l.current=ue(k)?z.pageY:z.pageX)}function Ve(z,G){var Z;let Q=z;const se=(Z=window.getSelection())==null?void 0:Z.toString(),de=E.current?dr(E.current,k):null,ce=new Date;if(Q.tagName==="SELECT"||Q.hasAttribute("data-vaul-no-drag")||Q.closest("[data-vaul-no-drag]"))return!1;if(k==="right"||k==="left")return!0;if(ne.current&&ce.getTime()-ne.current.getTime()<500)return!1;if(de!==null&&(k==="bottom"?de>0:de<0))return!0;if(se&&se.length>0)return!1;if(F.current&&ce.getTime()-F.current.getTime()<d&&de===0||G)return F.current=ce,!1;for(;Q;){if(Q.scrollHeight>Q.clientHeight){if(Q.scrollTop!==0)return F.current=new Date,!1;if(Q.getAttribute("role")==="dialog")return!0}Q=Q.parentNode}return!0}function at(z){if(E.current&&oe){const G=k==="bottom"||k==="right"?1:-1,Z=(l.current-(ue(k)?z.pageY:z.pageX))*G,Q=Z>0,se=a&&!f&&!Q;if(se&&ee===0)return;const de=Math.abs(Z),ce=document.querySelector("[data-vaul-drawer-wrapper]"),je=k==="bottom"||k==="top"?$.current:H.current;let ge=de/je;const Ee=nt(de,Q);if(Ee!==null&&(ge=Ee),se&&ge>=1||!ke.current&&!Ve(z.target,Q))return;if(E.current.classList.add(Br),ke.current=!0,he(E.current,{transition:"none"}),he(Y.current,{transition:"none"}),a&&rt({draggedDistance:Z}),Q&&!a){const be=ru(Z),Ie=Math.min(be*-1,0)*G;he(E.current,{transform:ue(k)?`translate3d(0, ${Ie}px, 0)`:`translate3d(${Ie}px, 0, 0)`});return}const Se=1-ge;if((He||p&&ee===p-1)&&(n?.(z,ge),he(Y.current,{opacity:`${Se}`,transition:"none"},!0)),ce&&Y.current&&c){const be=Math.min(Pe()+ge*(1-Pe()),1),Ie=8-ge*8,qe=Math.max(0,14-ge*14);he(ce,{borderRadius:`${Ie}px`,transform:ue(k)?`scale(${be}) translate3d(0, ${qe}px, 0)`:`scale(${be}) translate3d(${qe}px, 0, 0)`,transition:"none"},!0)}if(!a){const be=de*G;he(E.current,{transform:ue(k)?`translate3d(0, ${be}px, 0)`:`translate3d(${be}px, 0, 0)`})}}}x.useEffect(()=>{window.requestAnimationFrame(()=>{S.current=!0})},[]),x.useEffect(()=>{var z;function G(){if(!E.current||!M)return;const Z=document.activeElement;if(Jr(Z)||C.current){var Q;const se=((Q=window.visualViewport)==null?void 0:Q.height)||0,de=window.innerHeight;let ce=de-se;const je=E.current.getBoundingClientRect().height||0,ge=je>de*.8;B.current||(B.current=je);const Ee=E.current.getBoundingClientRect().top;if(Math.abs(O.current-ce)>60&&(C.current=!C.current),a&&a.length>0&&_e&&ee){const Se=_e[ee]||0;ce+=Se}if(O.current=ce,je>se||C.current){const Se=E.current.getBoundingClientRect().height;let be=Se;Se>se&&(be=se-(ge?Ee:en)),m?E.current.style.height=`${Se-Math.max(ce,0)}px`:E.current.style.height=`${Math.max(be,se-Ee)}px`}else Hc()||(E.current.style.height=`${B.current}px`);a&&a.length>0&&!C.current?E.current.style.bottom="0px":E.current.style.bottom=`${Math.max(ce,0)}px`}}return(z=window.visualViewport)==null||z.addEventListener("resize",G),()=>{var Z;return(Z=window.visualViewport)==null?void 0:Z.removeEventListener("resize",G)}},[ee,a,_e]);function Ae(z){it(),b?.(),z||re(!1),setTimeout(()=>{a&&We(a[0])},ae.DURATION*1e3)}function Ue(){if(!E.current)return;const z=document.querySelector("[data-vaul-drawer-wrapper]"),G=dr(E.current,k);he(E.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${ae.DURATION}s cubic-bezier(${ae.EASE.join(",")})`}),he(Y.current,{transition:`opacity ${ae.DURATION}s cubic-bezier(${ae.EASE.join(",")})`,opacity:"1"}),c&&G&&G>0&&J&&he(z,{borderRadius:`${Fo}px`,overflow:"hidden",...ue(k)?{transform:`scale(${Pe()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${Pe()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${ae.DURATION}s`,transitionTimingFunction:`cubic-bezier(${ae.EASE.join(",")})`},!0)}function it(){!oe||!E.current||(E.current.classList.remove(Br),ke.current=!1,me(!1),Te.current=new Date)}function lt(z){if(!oe||!E.current)return;E.current.classList.remove(Br),ke.current=!1,me(!1),Te.current=new Date;const G=dr(E.current,k);if(!z||!Ve(z.target,!1)||!G||Number.isNaN(G)||ye.current===null)return;const Z=Te.current.getTime()-ye.current.getTime(),Q=l.current-(ue(k)?z.pageY:z.pageX),se=Math.abs(Q)/Z;if(se>.05&&(ve(!0),setTimeout(()=>{ve(!1)},200)),a){tt({draggedDistance:Q*(k==="bottom"||k==="right"?1:-1),closeDrawer:Ae,velocity:se,dismissible:f}),s?.(z,!0);return}if(k==="bottom"||k==="right"?Q>0:Q<0){Ue(),s?.(z,!0);return}if(se>Lo){Ae(),s?.(z,!1);return}var de;const ce=Math.min((de=E.current.getBoundingClientRect().height)!=null?de:0,window.innerHeight);var je;const ge=Math.min((je=E.current.getBoundingClientRect().width)!=null?je:0,window.innerWidth),Ee=k==="left"||k==="right";if(Math.abs(G)>=(Ee?ge:ce)*u){Ae(),s?.(z,!1);return}s?.(z,!0),Ue()}x.useEffect(()=>(J&&(he(document.documentElement,{scrollBehavior:"auto"}),ne.current=new Date),()=>{tu(document.documentElement,"scrollBehavior")}),[J]);function ct(z){const G=z?(window.innerWidth-Ke)/window.innerWidth:1,Z=z?-Ke:0;we.current&&window.clearTimeout(we.current),he(E.current,{transition:`transform ${ae.DURATION}s cubic-bezier(${ae.EASE.join(",")})`,transform:ue(k)?`scale(${G}) translate3d(0, ${Z}px, 0)`:`scale(${G}) translate3d(${Z}px, 0, 0)`}),!z&&E.current&&(we.current=setTimeout(()=>{const Q=dr(E.current,k);he(E.current,{transition:"none",transform:ue(k)?`translate3d(0, ${Q}px, 0)`:`translate3d(${Q}px, 0, 0)`})},500))}function ut(z,G){if(G<0)return;const Z=(window.innerWidth-Ke)/window.innerWidth,Q=Z+G*(1-Z),se=-Ke+G*Ke;he(E.current,{transform:ue(k)?`scale(${Q}) translate3d(0, ${se}px, 0)`:`scale(${Q}) translate3d(${se}px, 0, 0)`,transition:"none"})}function dt(z,G){const Z=ue(k)?window.innerHeight:window.innerWidth,Q=G?(Z-Ke)/Z:1,se=G?-Ke:0;G&&he(E.current,{transition:`transform ${ae.DURATION}s cubic-bezier(${ae.EASE.join(",")})`,transform:ue(k)?`scale(${Q}) translate3d(0, ${se}px, 0)`:`scale(${Q}) translate3d(${se}px, 0, 0)`})}return x.useEffect(()=>{w||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[w]),x.createElement(So,{defaultOpen:A,onOpenChange:z=>{!f&&!z||(z?_(!0):Ae(!0),re(z))},open:J},x.createElement(Ao.Provider,{value:{activeSnapPoint:V,snapPoints:a,setActiveSnapPoint:We,drawerRef:E,overlayRef:Y,onOpenChange:t,onPress:ot,onRelease:lt,onDrag:at,dismissible:f,shouldAnimate:S,handleOnly:h,isOpen:J,isDragging:oe,shouldFade:He,closeDrawer:Ae,onNestedDrag:ut,onNestedOpenChange:ct,onNestedRelease:dt,keyboardIsOpen:C,modal:w,snapPointsOffset:_e,activeSnapPointIndex:ee,direction:k,shouldScaleBackground:c,setBackgroundColorOnScale:i,noBodyStyles:T,container:W,autoFocus:K}},r))}const zo=x.forwardRef(function({...e},t){const{overlayRef:r,snapPoints:n,onRelease:s,shouldFade:a,isOpen:c,modal:i,shouldAnimate:u}=Pt(),d=Io(t,r),f=n&&n.length>0;if(!i)return null;const h=x.useCallback(p=>s(p),[s]);return x.createElement(No,{onMouseUp:h,ref:d,"data-vaul-overlay":"","data-vaul-snap-points":c&&f?"true":"false","data-vaul-snap-points-overlay":c&&a?"true":"false","data-vaul-animate":u?.current?"true":"false",...e})});zo.displayName="Drawer.Overlay";const Wo=x.forwardRef(function({onPointerDownOutside:e,style:t,onOpenAutoFocus:r,...n},s){const{drawerRef:a,onPress:c,onRelease:i,onDrag:u,keyboardIsOpen:d,snapPointsOffset:f,activeSnapPointIndex:h,modal:p,isOpen:y,direction:v,snapPoints:m,container:w,handleOnly:b,shouldAnimate:R,autoFocus:T}=Pt(),[k,A]=x.useState(!1),L=Io(s,a),j=x.useRef(null),N=x.useRef(null),M=x.useRef(!1),U=m&&m.length>0;cu();const W=(D,X,J=0)=>{if(M.current)return!0;const re=Math.abs(D.y),te=Math.abs(D.x),_=te>re,oe=["bottom","right"].includes(X)?1:-1;if(X==="left"||X==="right"){if(!(D.x*oe<0)&&te>=0&&te<=J)return _}else if(!(D.y*oe<0)&&re>=0&&re<=J)return!_;return M.current=!0,!0};x.useEffect(()=>{U&&window.requestAnimationFrame(()=>{A(!0)})},[]);function K(D){j.current=null,M.current=!1,i(D)}return x.createElement(To,{"data-vaul-drawer-direction":v,"data-vaul-drawer":"","data-vaul-delayed-snap-points":k?"true":"false","data-vaul-snap-points":y&&U?"true":"false","data-vaul-custom-container":w?"true":"false","data-vaul-animate":R?.current?"true":"false",...n,ref:L,style:f&&f.length>0?{"--snap-point-height":`${f[h??0]}px`,...t}:t,onPointerDown:D=>{b||(n.onPointerDown==null||n.onPointerDown.call(n,D),j.current={x:D.pageX,y:D.pageY},c(D))},onOpenAutoFocus:D=>{r?.(D),T||D.preventDefault()},onPointerDownOutside:D=>{if(e?.(D),!p||D.defaultPrevented){D.preventDefault();return}d.current&&(d.current=!1)},onFocusOutside:D=>{if(!p){D.preventDefault();return}},onPointerMove:D=>{if(N.current=D,b||(n.onPointerMove==null||n.onPointerMove.call(n,D),!j.current))return;const X=D.pageY-j.current.y,J=D.pageX-j.current.x,re=D.pointerType==="touch"?10:2;W({x:J,y:X},v,re)?u(D):(Math.abs(J)>re||Math.abs(X)>re)&&(j.current=null)},onPointerUp:D=>{n.onPointerUp==null||n.onPointerUp.call(n,D),j.current=null,M.current=!1,i(D)},onPointerOut:D=>{n.onPointerOut==null||n.onPointerOut.call(n,D),K(N.current)},onContextMenu:D=>{n.onContextMenu==null||n.onContextMenu.call(n,D),N.current&&K(N.current)}})});Wo.displayName="Drawer.Content";const fu=250,hu=120,mu=x.forwardRef(function({preventCycle:e=!1,children:t,...r},n){const{closeDrawer:s,isDragging:a,snapPoints:c,activeSnapPoint:i,setActiveSnapPoint:u,dismissible:d,handleOnly:f,isOpen:h,onPress:p,onDrag:y}=Pt(),v=x.useRef(null),m=x.useRef(!1);function w(){if(m.current){T();return}window.setTimeout(()=>{b()},hu)}function b(){if(a||e||m.current){T();return}if(T(),!c||c.length===0){d||s();return}if(i===c[c.length-1]&&d){s();return}const A=c.findIndex(j=>j===i);if(A===-1)return;const L=c[A+1];u(L)}function R(){v.current=window.setTimeout(()=>{m.current=!0},fu)}function T(){v.current&&window.clearTimeout(v.current),m.current=!1}return x.createElement("div",{onClick:w,onPointerCancel:T,onPointerDown:k=>{f&&p(k),R()},onPointerMove:k=>{f&&y(k)},ref:n,"data-vaul-drawer-visible":h?"true":"false","data-vaul-handle":"","aria-hidden":"true",...r},x.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},t))});mu.displayName="Drawer.Handle";function pu(e){const t=Pt(),{container:r=t.container,...n}=e;return x.createElement(Eo,{container:r,...n})}const Ge={Root:du,Content:Wo,Overlay:zo,Portal:pu,Close:_o,Title:Ro,Description:Oo};function xu(e=768){const[t,r]=x.useState(!1);return x.useEffect(()=>{const n=()=>{r(window.innerWidth<e)};return n(),window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[e]),t}function Nt(...e){return Vs(_s(e))}const vu={position:"fixed",inset:0,zIndex:9999,backgroundColor:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(4px)"},gu={position:"fixed",left:"50%",top:"50%",transform:"translate(-50%, -50%)",zIndex:9999,display:"flex",flexDirection:"column"},bu={position:"fixed",inset:0,zIndex:9999,backgroundColor:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(4px)"},yu={position:"fixed",left:0,right:0,bottom:0,zIndex:9999,maxHeight:"96vh"};function pn({open:e,onOpenChange:t,children:r,title:n,description:s,className:a="",showCloseButton:c=!0,height:i}){const u=xu(),{theme:d}=Ia(),f={"--optimex-primary":d.colors.primary,"--optimex-background":d.colors.background,"--optimex-surface":d.colors.surface,"--optimex-text":d.colors.text.primary,"--optimex-text-secondary":d.colors.text.secondary,"--optimex-error":d.colors.error,"--optimex-success":d.colors.success,"--optimex-radius-widget":d.radius.widget,"--optimex-radius-input":d.radius.input,"--optimex-radius-button":d.radius.button,"--optimex-overlay-background":d.overlay.background,"--optimex-overlay-radius":d.overlay.radius,"--optimex-font-family":d.fontFamily};return u?o.jsx(Ge.Root,{open:e,onOpenChange:t,children:o.jsxs(Ge.Portal,{children:[o.jsx(Ge.Overlay,{style:bu}),o.jsx(Ge.Content,{style:yu,children:o.jsxs("div",{className:Nt("optx-widget flex flex-col bg-[var(--optimex-overlay-background)] outline-none",a),style:{...f,height:i,maxHeight:"96vh",borderStyle:"solid",borderColor:"rgba(255, 255, 255, 0.1)",backgroundColor:d.overlay.background,borderRadius:`${d.overlay.radius} ${d.overlay.radius} 0 0`},children:[o.jsx("div",{className:"mx-auto mt-4 h-1.5 w-12 flex-shrink-0 rounded-full bg-white/20"}),(n||c)&&o.jsxs("div",{className:"flex items-center justify-between border-b border-white/[0.05] px-4 pb-4 pt-2",children:[o.jsxs("div",{children:[n&&o.jsx(Ge.Title,{className:"text-lg font-bold text-[var(--optimex-text)]",children:n}),s&&o.jsx(Ge.Description,{className:"text-sm text-[var(--optimex-text-secondary)]",children:s})]}),c&&o.jsx(Ge.Close,{className:"rounded-[var(--optimex-radius-button)] p-1.5 text-[var(--optimex-text-secondary)] transition-colors hover:bg-white/10 hover:text-[var(--optimex-text)]",children:o.jsx(Ze,{})})]}),o.jsx("div",{className:"flex flex-1 flex-col overflow-auto",children:r})]})})]})}):o.jsx(So,{open:e,onOpenChange:t,children:o.jsxs(Eo,{children:[o.jsx(No,{style:vu,className:"animate-modal-overlay-in data-[state=closed]:animate-modal-overlay-out"}),o.jsx(To,{style:{...gu,height:i,maxHeight:i||"85vh"},className:Nt("animate-modal-in data-[state=closed]:animate-modal-out",a),children:o.jsxs("div",{className:Nt("optx-widget flex flex-col rounded-[var(--optimex-overlay-radius)] border border-white/10 bg-[var(--optimex-overlay-background)] shadow-2xl outline-none"),style:{...f,flex:1,minHeight:0,height:"100%",borderStyle:"solid",borderColor:"rgba(255, 255, 255, 0.1)",backgroundColor:d.overlay.background,borderRadius:d.overlay.radius},children:[(n||s||c)&&o.jsxs("div",{className:"flex flex-shrink-0 items-center justify-between border-b border-white/[0.05] p-4",children:[o.jsxs("div",{className:"flex flex-col gap-1.5",children:[n&&o.jsx(Ro,{className:"text-lg font-bold leading-none text-[var(--optimex-text)]",children:n}),s&&o.jsx(Oo,{className:"text-sm text-[var(--optimex-text-secondary)]",children:s})]}),c&&o.jsxs(_o,{className:"rounded-[var(--optimex-radius-button)] p-1.5 text-[var(--optimex-text-secondary)] opacity-70 transition-opacity hover:opacity-100 hover:bg-white/10 focus:outline-none",children:[o.jsx(Ze,{}),o.jsx("span",{className:"sr-only",children:"Close"})]})]}),o.jsx("div",{className:"flex flex-1 flex-col overflow-hidden min-h-0",children:r})]})})]})})}const wu=({children:e,className:t=""})=>o.jsx("div",{className:Nt("p-4",t),children:e}),Cu=({children:e,className:t=""})=>o.jsx("div",{className:Nt("flex gap-2 border-t border-white/[0.05] p-4",t),children:e});function tn({children:e,onClick:t,isActive:r=!1,type:n="button",className:s=""}){return o.jsx("button",{type:n,onClick:t,className:Us(`px-2 py-1 bg-white/5 rounded-md text-xs transition-colors shadow-sm border ${r?"border-[var(--optimex-primary)] text-[var(--optimex-text)]":"border-transparent text-[var(--optimex-text-secondary)] hover:bg-[var(--optimex-surface-hover)] hover:text-[var(--optimex-text)]"} ${s}`),children:e})}const ku={"bottom-right":"right-0 top-full mt-2","bottom-left":"left-0 top-full mt-2","bottom-center":"left-1/2 -translate-x-1/2 top-full mt-2","top-right":"right-0 bottom-full mb-2","top-left":"left-0 bottom-full mb-2","top-center":"left-1/2 -translate-x-1/2 bottom-full mb-2"},ju={"bottom-right":"-top-2 right-4 rotate-45 border-l border-t border-white/10","bottom-left":"-top-2 left-4 rotate-45 border-l border-t border-white/10","bottom-center":"-top-2 left-1/2 -translate-x-1/2 rotate-45 border-l border-t border-white/10","top-right":"-bottom-2 right-4 rotate-45 border-r border-b border-white/10","top-left":"-bottom-2 left-4 rotate-45 border-r border-b border-white/10","top-center":"-bottom-2 left-1/2 -translate-x-1/2 rotate-45 border-r border-b border-white/10"};function Su({isOpen:e,onClose:t,children:r,anchorRef:n,position:s="bottom-right",width:a="w-72",showArrow:c=!1,className:i="",ariaLabel:u}){const d=x.useRef(null);return x.useEffect(()=>{if(!e)return;const f=y=>{const v=y.target;d.current?.contains(v)||n?.current?.contains(v)||t()},h=y=>{y.key==="Escape"&&t()},p=setTimeout(()=>{document.addEventListener("mousedown",f),document.addEventListener("keydown",h)},0);return()=>{clearTimeout(p),document.removeEventListener("mousedown",f),document.removeEventListener("keydown",h)}},[e,t,n]),e?o.jsxs("div",{ref:d,className:`absolute z-50 rounded-[var(--optimex-overlay-radius)] border border-white/10 bg-[var(--optimex-overlay-background)] p-4 shadow-xl ${ku[s]} ${a} ${i}`,role:"dialog","aria-label":u,children:[c&&o.jsx("div",{className:`absolute h-4 w-4 bg-[var(--optimex-overlay-background)] ${ju[s]}`}),o.jsx("div",{className:"relative",children:r})]}):null}function Eu({value:e,onChange:t,placeholder:r,hasError:n=!1,leftIcon:s,rightContent:a,type:c="text",inputMode:i="text",disabled:u=!1,className:d=""}){return o.jsxs("div",{className:`flex rounded-[var(--optimex-radius-button)] items-center gap-2 bg-white/5 border py-3 px-3 transition-colors ${n?"border-[var(--optimex-error)]":"border-white/10 hover:border-[var(--optimex-primary)] focus-within:border-[var(--optimex-primary)]"} ${u?"opacity-50 cursor-not-allowed":""} ${d}`,children:[s&&o.jsx(s,{className:"size-5 text-[var(--optimex-text-secondary)] shrink-0"}),o.jsx("input",{type:c,inputMode:i,value:e,onChange:f=>t(f.target.value),placeholder:r,disabled:u,className:"flex-1 min-w-0 bg-transparent text-[var(--optimex-text)] text-sm placeholder:text-[var(--optimex-text-secondary)]/30 outline-none disabled:cursor-not-allowed"}),a]})}const Nu={sm:{container:"h-6 w-6",icon:"h-6 w-6",badge:"h-3 w-3"},md:{container:"h-8 w-8",icon:"h-8 w-8",badge:"h-4 w-4"},lg:{container:"h-10 w-10",icon:"h-10 w-10",badge:"h-5 w-5"},xl:{container:"h-14 w-14",icon:"h-14 w-14",badge:"h-6 w-6"}};function Je({token:e,size:t="md",showNetworkBadge:r=!0}){const n=Nu[t];return o.jsxs("div",{className:`relative shrink-0 ${n.container}`,children:[o.jsx("img",{src:e.token_logo_uri||"/placeholder-token.svg",alt:e.token_symbol,className:`${n.icon} rounded-[9999px] bg-[var(--optimex-background)]`,onError:s=>{s.target.src="/placeholder-token.svg"}}),r&&e.network_logo_uri&&o.jsx("img",{src:e.network_logo_uri,alt:e.network_name,className:`absolute -bottom-1 -right-1 ${n.badge} rounded-[9999px] border-2 border-[var(--optimex-surface)]`,onError:s=>{s.target.style.display="none"}})]})}const Tu="widget-container rounded-[var(--optimex-radius-widget)] p-4 shadow-2xl relative w-full min-w-0";function xn({children:e,className:t}){return o.jsx("div",{className:t??Tu,children:e})}function Ru(){return o.jsxs("div",{className:"relative size-20 mb-4",children:[o.jsx("div",{className:"absolute inset-0 rounded-full bg-[var(--optimex-error)]/10 animate-pulse"}),o.jsx("div",{className:"absolute inset-2 rounded-full bg-[var(--optimex-error)]/20"}),o.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:o.jsx(fi,{className:"size-10 text-[var(--optimex-error)]"})})]})}function Ou({error:e,onRetry:t,className:r}){const n=()=>{const s=e?.message?.toLowerCase()||"";return s.includes("network")||s.includes("fetch")?"Connection issue. Check your internet and try again.":s.includes("timeout")?"Request timed out. The server might be busy.":s.includes("401")||s.includes("403")?"Access denied. Please check your credentials.":s.includes("500")||s.includes("server")?"Server is having issues. Please try again later.":"Something went wrong while loading. Let's give it another shot!"};return o.jsx(xn,{className:r,children:o.jsx("div",{className:"bg-[var(--optimex-surface)] rounded-2xl p-6 border border-white/[0.02]",children:o.jsxs("div",{className:"flex flex-col items-center justify-center text-center",children:[o.jsx(Ru,{}),o.jsx("h3",{className:"text-base font-bold text-[var(--optimex-text)] mb-1",children:"Oops! Something went wrong"}),o.jsx("p",{className:"text-sm text-[var(--optimex-text-secondary)] mb-6 max-w-[280px]",children:n()}),o.jsx(cn,{onClick:t,size:"md",fullWidth:!0,leftIcon:o.jsx(di,{className:"size-4 transition-transform group-hover:rotate-180"}),children:"Try Again"}),e?.message&&o.jsxs("details",{className:"mt-4 w-full",children:[o.jsx("summary",{className:"cursor-pointer text-xs text-[var(--optimex-text-secondary)]/60 hover:text-[var(--optimex-text-secondary)] transition-colors",children:"Technical details"}),o.jsx("p",{className:"mt-2 bg-white/5 p-3 text-left text-xs text-[var(--optimex-text-secondary)] break-all border border-white/[0.02]",children:e.message})]})]})})})}function _u({className:e}){return o.jsxs("div",{className:"flex flex-col gap-4",children:[o.jsxs("header",{className:"flex items-center justify-between px-2",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"size-8 rounded-lg bg-[var(--optimex-primary)]/30 animate-pulse"}),o.jsx("div",{className:"h-6 w-28 rounded bg-white/10 animate-pulse"})]}),o.jsx("div",{className:"size-10 rounded-lg bg-white/5 animate-pulse"})]}),o.jsxs(xn,{className:e,children:[o.jsxs("div",{className:"bg-[var(--optimex-surface)] rounded-2xl p-4 border border-white/[0.02] mb-2",children:[o.jsx("div",{className:"flex justify-between items-center mb-4",children:o.jsx("div",{className:"h-3 w-10 animate-pulse rounded bg-white/10"})}),o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsxs("div",{className:"flex-1",children:[o.jsx("div",{className:"h-8 w-24 animate-pulse rounded bg-white/10 mb-2"}),o.jsx("div",{className:"h-3 w-16 animate-pulse rounded bg-white/5"})]}),o.jsxs("div",{className:"flex items-center gap-2 bg-white/5 p-2 pr-3 rounded-full border border-white/10",children:[o.jsx("div",{className:"size-8 rounded-full bg-white/10 animate-pulse"}),o.jsxs("div",{children:[o.jsx("div",{className:"h-4 w-12 animate-pulse rounded bg-white/10 mb-1"}),o.jsx("div",{className:"h-2 w-16 animate-pulse rounded bg-white/5"})]})]})]})]}),o.jsx("div",{className:"relative z-10 -my-4 flex justify-center",children:o.jsx("div",{className:"size-10 rounded-full bg-[var(--optimex-surface)] border-4 border-[var(--optimex-background)] animate-pulse"})}),o.jsxs("div",{className:"bg-[var(--optimex-surface)] rounded-2xl p-4 border border-white/[0.02] mb-4",children:[o.jsx("div",{className:"flex justify-between items-center mb-4",children:o.jsx("div",{className:"h-3 w-6 animate-pulse rounded bg-white/10"})}),o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsxs("div",{className:"flex-1",children:[o.jsx("div",{className:"h-8 w-20 animate-pulse rounded bg-white/10 mb-2"}),o.jsx("div",{className:"h-3 w-14 animate-pulse rounded bg-white/5"})]}),o.jsxs("div",{className:"flex items-center gap-2 bg-white/5 p-2 pr-3 rounded-full border border-white/10",children:[o.jsx("div",{className:"size-8 rounded-full bg-white/10 animate-pulse"}),o.jsxs("div",{children:[o.jsx("div",{className:"h-4 w-12 animate-pulse rounded bg-white/10 mb-1"}),o.jsx("div",{className:"h-2 w-16 animate-pulse rounded bg-white/5"})]})]})]})]}),o.jsxs("div",{className:"bg-[var(--optimex-surface)] rounded-2xl p-4 border border-white/[0.02] mb-4",children:[o.jsx("div",{className:"h-3 w-28 animate-pulse rounded bg-white/10 mb-2"}),o.jsxs("div",{className:"flex items-center gap-2 bg-white/5 border border-white/10 py-3 px-3 rounded-md",children:[o.jsx("div",{className:"size-5 rounded-full bg-white/10 animate-pulse shrink-0"}),o.jsx("div",{className:"h-4 flex-1 animate-pulse rounded bg-white/5"})]}),o.jsx("div",{className:"h-2 w-48 animate-pulse rounded bg-white/5 mt-2"})]}),o.jsx("div",{className:"h-12 w-full animate-pulse rounded-xl bg-[var(--optimex-primary)]/30 bg-white/5 mt-2"}),o.jsx("div",{className:"mt-4 flex items-center justify-center",children:o.jsx("div",{className:"h-4 w-32 animate-pulse rounded bg-white/5"})})]})]})}const Ho=x.createContext(null);function Au({children:e}){const t=Mt(),{data:r,isLoading:n,error:s,refetch:a}=Ba(t.apiBaseUrl),c=t.renderLoading??_u,i=t.renderError??Ou;if(n)return o.jsx(c,{});if(s||!r){const u=s instanceof Error?s:new Error("Failed to load tokens");return o.jsx(i,{error:u,onRetry:()=>a()})}return o.jsx(Ho.Provider,{value:{tokensData:r,refetch:a},children:e})}function Mu(){const e=x.useContext(Ho);if(!e)throw new Error("useTokensData must be used within TokensProvider");return e}function Pu({token:e,value:t,onChange:r,placeholder:n,error:s,onClose:a}){const c=x.useCallback(()=>{r("")},[r]),i=x.useCallback(async()=>{try{const h=await navigator.clipboard.readText();h&&r(h.trim())}catch(h){console.error("Failed to read clipboard:",h)}},[r]),u=()=>n||(e?`Enter ${e.network_name} address`:"Enter receiving address"),d=e?.network_name||"destination",f=x.useMemo(()=>pi(e?.network_name)||Cs,[e?.network_name]);return o.jsxs("div",{className:"bg-[var(--optimex-surface)] rounded-[var(--optimex-radius-input)] p-4 border border-white/[0.05] animate-in slide-in-from-top-2 duration-300",children:[o.jsxs("div",{className:"flex justify-between items-center mb-2",children:[o.jsx("label",{className:"text-[var(--optimex-text-secondary)] text-xs",children:"Recipient Address"}),a&&o.jsx("button",{type:"button",onClick:c,className:"text-[var(--optimex-text-secondary)]/50 hover:text-[var(--optimex-text-secondary)] transition-colors",children:o.jsx(Ze,{className:"size-4"})})]}),o.jsx(Eu,{value:t,onChange:r,placeholder:u(),hasError:!!s,leftIcon:f,rightContent:t?o.jsx("button",{type:"button",onClick:c,className:"text-[var(--optimex-text-secondary)] hover:text-[var(--optimex-text)] transition-colors",children:o.jsx(Ze,{className:"size-5"})}):o.jsx("button",{type:"button",onClick:i,className:"text-[var(--optimex-text-secondary)] hover:text-[var(--optimex-primary)] transition-colors",children:o.jsx(ui,{className:"size-5"})})}),s?o.jsxs("p",{className:"text-[10px] text-[var(--optimex-error)] mt-2 flex items-center gap-1",children:[o.jsx(On,{className:"size-3"}),s]}):o.jsxs("p",{className:"text-[10px] text-[var(--optimex-text-secondary)] mt-2 flex items-center gap-1",children:[o.jsx(On,{className:"size-3"}),"Ensure the address matches the ",d," network."]})]})}function es({token:e,value:t,onChange:r,readOnly:n=!1,onSelectToken:s,isLoading:a=!1,loadingText:c="Loading...",balance:i,isOutput:u=!1,isWalletConnected:d=!1,usdValue:f="$0.00"}){const h=m=>{if(n||!r)return;const w=m.target.value;/^[0-9]*\.?[0-9]*$/.test(w)&&r(w)},p=d&&!u&&i!==void 0,y=()=>{if(!i||!r||n)return;const m=(parseFloat(i)/2).toString();r(m)},v=()=>{!i||!r||n||r(i)};return o.jsxs("div",{className:"bg-[var(--optimex-surface)] rounded-[var(--optimex-radius-input)] p-4 flex flex-col gap-2 border border-white/[0.02] focus-within:border-[var(--optimex-primary)]/40 transition-colors",children:[o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsx("span",{className:"text-[var(--optimex-text-secondary)] text-xs",children:u?"To":"From"}),o.jsx("div",{className:"flex items-center gap-2",children:p&&o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"text-[var(--optimex-text-secondary)] text-xs",children:["Balance: ",i," ",e?.token_symbol]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(tn,{onClick:y,children:"50%"}),o.jsx(tn,{onClick:v,children:"Max"})]})]})})]}),o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("input",{type:"text",inputMode:"decimal",placeholder:"0.0",value:t,onChange:h,readOnly:n,className:"w-full bg-transparent border-none p-0 text-[var(--optimex-text)] text-2xl font-bold focus:ring-0 placeholder:text-[var(--optimex-text-secondary)]/30 outline-none"}),o.jsxs("p",{className:"text-[var(--optimex-text-secondary)] text-xs mt-1",children:["~",f]})]}),o.jsxs("button",{onClick:s,className:"flex items-center gap-2 bg-white/5 hover:bg-white/10 p-2 pr-3 rounded-[9999px] transition-all border border-white/10 active:scale-95 shrink-0",children:[e?o.jsxs(o.Fragment,{children:[o.jsx(Je,{token:e,size:"md"}),o.jsxs("div",{className:"text-left",children:[o.jsx("p",{className:"text-[var(--optimex-text)] text-sm font-bold leading-none",children:e.token_symbol}),o.jsx("p",{className:"text-[var(--optimex-text-secondary)] text-[10px] leading-none mt-1",children:e.network_name})]})]}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"size-8 rounded-[9999px] bg-white/10"}),o.jsx("span",{className:"text-[var(--optimex-text)] text-sm font-bold",children:"Select"})]}),o.jsx(ys,{className:"size-4 text-[var(--optimex-text-secondary)]"})]})]}),a&&o.jsxs("div",{className:"flex items-center justify-end gap-2 text-sm text-[var(--optimex-text-secondary)]",children:[o.jsx("div",{className:"size-3 animate-spin rounded-[9999px] border border-[var(--optimex-primary)] border-t-transparent"}),o.jsx("span",{children:c})]})]})}const $r=[.5,.75,1];function Iu({value:e,onChange:t}){const[r,n]=x.useState(""),[s,a]=x.useState(!$r.includes(e)),c=x.useCallback(d=>{a(!1),n(""),t(d)},[t]),i=x.useCallback(d=>{const f=d.target.value;if(f===""||/^\d*\.?\d*$/.test(f)){n(f),a(!0);const h=parseFloat(f);!isNaN(h)&&h>0&&h<=50&&t(h)}},[t]),u=x.useCallback(()=>{a(!0),!r&&e&&n($r.includes(e)?"":String(e))},[r,e]);return o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-sm font-medium text-[var(--optimex-text)]",children:"Slippage Tolerance"}),o.jsxs("span",{className:"text-sm text-[var(--optimex-text-secondary)]",children:[e,"%"]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[$r.map(d=>o.jsxs(tn,{onClick:()=>c(d),isActive:e===d&&!s,className:"flex-1",children:[d,"%"]},d)),o.jsxs("div",{className:`flex flex-1 items-center justify-center px-2 rounded-md transition-colors shadow-sm bg-white/5 border ${s?"border-[var(--optimex-primary)]":"border-transparent hover:bg-white/10"}`,children:[o.jsx("input",{type:"text",inputMode:"decimal",placeholder:"Custom",value:r,onChange:i,onFocus:u,className:"w-full min-w-0 py-[6px] bg-transparent text-center text-xs outline-none placeholder:text-[var(--optimex-text-secondary)] text-[var(--optimex-text)]"}),o.jsx("span",{className:"text-xs text-[var(--optimex-text-secondary)]",children:"%"})]})]}),e>5&&o.jsx("p",{className:"text-xs text-[var(--optimex-warning)]",children:"This may result in an unfavorable trade. Try lowering your slippage setting."})]})}function Du({isOpen:e,onClose:t,value:r,onChange:n,anchorRef:s}){const a=x.useCallback(c=>{n(c)},[n]);return o.jsx(Su,{isOpen:e,onClose:t,anchorRef:s,position:"bottom-right",width:"w-96",ariaLabel:"Slippage settings",children:o.jsx(Iu,{value:r,onChange:a})})}const Lu=({title:e})=>o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"size-8 bg-[var(--optimex-primary)] rounded-[var(--optimex-radius-button)] flex items-center justify-center shadow-[0_0_15px_rgba(235,98,0,0.3)]",children:o.jsx(li,{className:"w-5 h-auto text-white"})}),o.jsx("h2",{className:"text-xl font-bold tracking-tight text-[var(--optimex-text)]",children:e})]});function Fu({title:e="Swap",headerLeft:t,slippage:r=.75,onSlippageChange:n,isSettingsOpen:s=!1,onSettingsToggle:a,onHistoryClick:c,hideHistory:i=!1}){const u=x.useRef(null);return o.jsxs("header",{className:"flex items-center justify-between px-2",children:[t??o.jsx(Lu,{title:e}),o.jsxs("div",{className:"flex items-center gap-2",children:[!i&&o.jsx("button",{onClick:c,className:"size-10 rounded-[var(--optimex-radius-button)] bg-white/5 hover:bg-white/10 text-[var(--optimex-text-secondary)] hover:text-[var(--optimex-text)] transition-colors flex items-center justify-center","aria-label":"Trade History",children:o.jsx(ai,{className:"size-5"})}),o.jsxs("div",{className:"relative",children:[o.jsx("button",{ref:u,onClick:a,className:"size-10 rounded-[var(--optimex-radius-button)] bg-white/5 hover:bg-white/10 text-[var(--optimex-text-secondary)] hover:text-[var(--optimex-text)] transition-colors flex items-center justify-center","aria-label":"Settings",children:o.jsx(mi,{className:"size-5"})}),o.jsx(Du,{isOpen:s,onClose:()=>a?.(),value:r,onChange:d=>n?.(d),anchorRef:u})]})]})]})}function Vo({onClick:e,disabled:t}){return o.jsx("div",{className:"!m-0 absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 z-10",children:o.jsx("button",{onClick:e,disabled:t,className:"size-10 rounded-[9999px] bg-[var(--optimex-surface)] border-4 border-white/5 flex items-center justify-center text-[var(--optimex-primary)] hover:scale-110 transition-all shadow-xl disabled:cursor-not-allowed",children:o.jsx(ni,{className:"size-5"})})})}function Bu({quote:e,fromToken:t,toToken:r,amount:n,slippage:s,isFetching:a}){const[c,i]=x.useState(!1),[u,d]=x.useState(!1),f=x.useCallback(()=>{d(b=>!b)},[]),h=x.useCallback(()=>{i(b=>!b)},[]),p=parseFloat(n)||0,y=parseFloat(e.min_amount_out)/Math.pow(10,r.token_decimals),v=p>0?y/p:0,m=y>0?p/y:0,w=()=>u?`1 ${r.token_symbol} ≈ ${m.toFixed(6)} ${t.token_symbol}`:`1 ${t.token_symbol} ≈ ${v.toFixed(6)} ${r.token_symbol}`;return o.jsxs("div",{className:"bg-white/[0.02] rounded-[var(--optimex-radius-button)] border border-white/5 overflow-hidden",children:[o.jsxs("button",{type:"button",onClick:h,className:"w-full flex items-center justify-between p-3 text-xs cursor-pointer hover:bg-white/[0.02] transition-colors",children:[o.jsx("div",{className:"flex items-center gap-2 text-[var(--optimex-text-secondary)] ",children:o.jsx("span",{role:"button",tabIndex:0,onClick:b=>{b.stopPropagation(),f()},onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&(b.stopPropagation(),f())},className:`text-[var(--optimex-text)] text-sm transition-colors ${a?"shiny-text":""}`,children:w()})}),o.jsx(ys,{className:`size-4 text-[var(--optimex-text-secondary)] transition-transform duration-200 ${c?"rotate-180":""}`})]}),o.jsx(ll,{isOpen:c,children:o.jsxs("div",{className:"px-3 pb-3 space-y-2 text-xs border-t border-white/5",children:[o.jsxs("div",{className:"flex items-center justify-between pt-3",children:[o.jsx("span",{className:"text-[var(--optimex-text-secondary)]",children:"Min. Received"}),o.jsxs("span",{className:`font-medium text-[var(--optimex-text)] ${a?"shiny-text":""}`,children:[ze(e.min_amount_out,r.token_decimals)," ",r.token_symbol]})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-[var(--optimex-text-secondary)]",children:"Est. Time"}),o.jsx("span",{className:"font-medium text-[var(--optimex-primary)]",children:"~10 minutes"})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-[var(--optimex-text-secondary)]",children:"Slippage Tolerance"}),o.jsxs("span",{className:"font-medium text-[var(--optimex-text)]",children:[s,"%"]})]})]})})]})}function $u({text:e,disabled:t,isLoading:r,onClick:n}){return o.jsx(cn,{variant:"primary",size:"xl",fullWidth:!0,disabled:t,isLoading:r,onClick:n,children:e})}function zu(){return o.jsxs("a",{href:"https://optimex.com",target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-center gap-1.5 text-[var(--optimex-text-secondary)] text-[10px] opacity-50 hover:opacity-70 transition-opacity",children:[o.jsx("span",{children:"Powered by"}),o.jsx(ci,{className:"h-3 w-auto"})]})}function Wu({value:e,onChange:t,placeholder:r="Search by name or symbol..."}){return o.jsx("div",{className:"flex-shrink-0 p-4 pb-3",children:o.jsxs("div",{className:"relative",children:[o.jsx("input",{type:"text",placeholder:r,value:e,onChange:n=>t(n.target.value),className:"w-full rounded-xl bg-white/5 border border-white/10 px-4 py-3 pl-10 pr-10 text-[var(--optimex-text)] outline-none placeholder:text-[var(--optimex-text-secondary)]/60 transition-colors hover:border-[var(--optimex-primary)] focus:border-[var(--optimex-primary)]"}),o.jsx(hi,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-[var(--optimex-text-secondary)]"}),e&&o.jsx("button",{type:"button",onClick:()=>t(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-[var(--optimex-text-secondary)] hover:text-[var(--optimex-text)] transition-colors",children:o.jsx(Ze,{className:"size-5"})})]})})}function Hu({networks:e,selectedNetwork:t,onSelectNetwork:r}){return o.jsxs("div",{className:"w-1/3 min-w-[140px] min-h-0 border-r border-white/[0.05] overflow-y-auto p-2",children:[o.jsx("div",{className:"mb-2 px-2 text-xs font-medium uppercase tracking-wider text-[var(--optimex-text-secondary)]",children:"Networks"}),o.jsxs("div",{className:"space-y-1 px-2",children:[o.jsxs("button",{onClick:()=>r(null),className:`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm transition-colors ${t===null?"bg-white/5 text-[var(--optimex-text)]":"text-[var(--optimex-text-secondary)] hover:bg-white/5 hover:text-[var(--optimex-text)]"}`,children:[o.jsx(ri,{}),o.jsx("span",{children:"All"})]}),e.map(n=>o.jsx(Vu,{network:n,isSelected:t===n.network_id,onSelect:()=>r(n.network_id)},n.network_id))]})]})}function Vu({network:e,isSelected:t,onSelect:r}){return o.jsxs("button",{onClick:r,className:`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm transition-colors ${t?"bg-white/5 text-[var(--optimex-text)]":"text-[var(--optimex-text-secondary)] hover:bg-white/5 hover:text-[var(--optimex-text)]"}`,children:[e.logo_uri?o.jsx("img",{src:e.logo_uri,alt:e.name,className:"h-8 w-8 rounded-lg",onError:n=>{n.target.style.display="none"}}):o.jsx("div",{className:"h-6 w-6 rounded-full bg-white/10"}),o.jsx("span",{className:"truncate",children:e.name})]})}function Uu({tokens:e,selectedSymbol:t,onSelectSymbol:r,maxVisible:n=12}){return o.jsxs("div",{className:"flex-shrink-0 border-b border-white/[0.05] p-2",children:[o.jsx("div",{className:"mb-2 px-2 text-xs font-medium uppercase tracking-wider text-[var(--optimex-text-secondary)]",children:"Tokens"}),o.jsxs("div",{className:"flex flex-wrap gap-1.5 overflow-hidden max-h-[5rem]",children:[o.jsx("button",{onClick:()=>r(null),className:`border rounded-lg px-2.5 py-1 text-xs font-medium transition-colors ${t===null?"border-[var(--optimex-primary)] text-[var(--optimex-text)]":"border-transparent text-[var(--optimex-text-secondary)] hover:bg-white/10 hover:text-[var(--optimex-text)]"}`,children:"All"}),e.slice(0,n).map(s=>o.jsx(qu,{token:s,isSelected:t===s.token_symbol,onSelect:()=>r(s.token_symbol)},s.token_symbol))]})]})}function qu({token:e,isSelected:t,onSelect:r}){return o.jsxs("button",{onClick:r,className:Us("flex items-center gap-1 rounded-lg px-2.5 py-1 text-xs font-medium transition-colors outline-none border bg-white/5",t?"border-[var(--optimex-primary)] text-[var(--optimex-text)]":"border-transparent text-[var(--optimex-text-secondary)] hover:bg-white/10 hover:text-[var(--optimex-text)]"),children:[e.token_logo_uri&&o.jsx("img",{src:e.token_logo_uri,alt:e.token_symbol,className:"h-4 w-4 rounded-full",onError:n=>{n.target.style.display="none"}}),e.token_symbol]})}function kt(){const e=x.useContext(xs);if(!e)throw new Error("useWallet must be used within WalletProvider");return e}function Cr(e){return`https://network-api-stg.bitdex.xyz/${e}/rpc/zwD70RMT9DrE8L5SaMnJNMF8m70Gum`}function Qu(e){return e==="bitcoin_testnet"?"https://mempool.space/testnet4/api":"https://mempool.space/api"}function vn(e){return!e.token_address||e.token_address===""||e.token_address==="native"||e.token_address==="0x0000000000000000000000000000000000000000"}function Ku(e,t){if(!e||e==="0")return"0";const r=BigInt(e),n=BigInt(10**t),s=r/n,a=r%n;if(a===BigInt(0))return s.toString();let c=a.toString().padStart(t,"0");return c=c.replace(/0+$/,""),c.length>6&&(c=c.slice(0,6)),`${s}.${c}`}function Gu(e){return`0x70a08231000000000000000000000000${e.toLowerCase().replace("0x","")}`}async function Uo(e,t){const r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok)throw new Error(`RPC request failed: ${r.status}`);return r.json()}async function Yu(e,t){const n=await Uo(e,{jsonrpc:"2.0",method:"eth_getBalance",params:[t,"latest"],id:1});if(n.error)throw new Error(`RPC error: ${n.error.message}`);const s=n.result||"0x0";return BigInt(s).toString()}async function Zu(e,t,r){const n={jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:Gu(r)},"latest"],id:1},s=await Uo(e,n);if(s.error)throw new Error(`RPC error: ${s.error.message}`);const a=s.result||"0x0";return BigInt(a).toString()}async function Xu(e,t){const r=Cr(e.network_id),n=vn(e);let s;return n?s=await Yu(r,t):s=await Zu(r,e.token_address,t),{rawBalance:s,isNative:n}}async function Ju(e,t){const n=`${Qu(e.network_id)}/address/${t}`,s=await fetch(n);if(!s.ok)throw new Error(`Mempool API request failed: ${s.status}`);const a=await s.json(),c=a.chain_stats.funded_txo_sum-a.chain_stats.spent_txo_sum,i=a.mempool_stats.funded_txo_sum-a.mempool_stats.spent_txo_sum;return{rawBalance:(c+i).toString(),isNative:!0}}async function qo(e,t){const r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok)throw new Error(`RPC request failed: ${r.status}`);return r.json()}async function ed(e,t){const n=await qo(e,{jsonrpc:"2.0",method:"getBalance",params:[t],id:1});if(n.error)throw new Error(`RPC error: ${n.error.message}`);return(n.result?.value||0).toString()}async function td(e,t,r){const s=await qo(e,{jsonrpc:"2.0",method:"getTokenAccountsByOwner",params:[r,{mint:t},{encoding:"jsonParsed"}],id:1});if(s.error)throw new Error(`RPC error: ${s.error.message}`);const a=s.result?.value||[];let c=BigInt(0);for(const i of a){const u=i.account.data.parsed.info.tokenAmount.amount;c+=BigInt(u)}return c.toString()}async function rd(e,t){const r=Cr(e.network_id),n=vn(e);let s;return n?s=await ed(r,t):s=await td(r,e.token_address,t),{rawBalance:s,isNative:n}}function nd(e,t){if(!t)return!1;switch(t){case ie.EVM:return e.isEvmConnected;case ie.BTC:return e.isBtcConnected;case ie.SOLANA:return e.isSolanaConnected;default:return!1}}function sd(e){if(!e)return"";switch(e){case ie.EVM:return"EVM";case ie.BTC:return"Bitcoin";case ie.SOLANA:return"Solana";default:return e}}function od(e,t){if(!t)return null;switch(t){case ie.EVM:return e.evmAddress;case ie.BTC:return e.btcAddress;case ie.SOLANA:return e.solanaAddress;default:return null}}async function Qo({provider:e,address:t,chainId:r,chainName:n="Unknown"}){let s=t;if(!s){const c=await e.request({method:"eth_accounts"});if(!c||c.length===0)throw new Error("No accounts found. Please connect your wallet first.");s=c[0]}let a=r;if(a===void 0){const c=await e.request({method:"eth_chainId"});a=parseInt(c,16)}return Ko({provider:e,address:s,chainId:a,chainName:n})}function Ko({provider:e,address:t,chainId:r,chainName:n="Unknown"}){return{address:t,publicKey:t,chain:{id:r,name:n,type:"EVM"},sendTransaction:async i=>{const u=i;return await e.request({method:"eth_sendTransaction",params:[{from:t,to:u.to,value:u.value?`0x${u.value.toString(16)}`:void 0,data:u.data}]})},getChainId:async()=>{const i=await e.request({method:"eth_chainId"});return parseInt(i,16)},switchChain:async i=>{try{await e.request({method:"wallet_switchEthereumChain",params:[{chainId:`0x${i.toString(16)}`}]})}catch(u){throw u.code===4902?new Error(`Chain ${i} not found in wallet. Please add it first.`):u}}}}const ad=Qo;async function id(e,t){const r=e.token_address||"native";let n;switch(e.network_type){case ie.BTC:n=await Ju(e,t);break;case ie.SOLANA:n=await rd(e,t);break;case ie.EVM:default:n=await Xu(e,t)}return{tokenId:r,networkId:e.network_id,walletAddress:t,rawBalance:n.rawBalance,formattedBalance:Ku(n.rawBalance,e.token_decimals),updatedAt:Date.now()}}const ld=30*1e3,cd=15*1e3;function ud(e,t){return!e||!t?["balance"]:["balance",e.network_id,e.token_address||"native",t]}function Go({token:e,walletAddress:t,enabled:r=!0,polling:n=!1,pollingInterval:s=cd}){const a=r&&!!e&&!!t,{data:c,isLoading:i,isFetching:u,error:d,refetch:f}=bt({queryKey:ud(e,t),queryFn:()=>id(e,t),enabled:a,staleTime:ld,retry:1,refetchOnWindowFocus:!1,refetchInterval:n?s:!1});return{balance:c,formattedBalance:c?.formattedBalance||"0",isLoading:a&&i,isFetching:a&&u,error:d,refetch:f}}function dd({token:e,isSelected:t,isDisabled:r,onSelect:n}){const s=kt(),a=od(s,e.network_type),{formattedBalance:c,isLoading:i}=Go({token:e,walletAddress:a,enabled:!!a}),u=!!a;return o.jsxs("button",{onClick:n,disabled:r,className:`flex w-full items-center gap-3 rounded-lg p-2 transition-colors ${t?"bg-white/5 text-[var(--optimex-text)]":r?"cursor-not-allowed opacity-50":"hover:bg-white/5"}`,children:[o.jsx(Je,{token:e}),o.jsxs("div",{className:"flex-1 text-left",children:[o.jsx("div",{className:"text-sm text-[var(--optimex-text-secondary)]",children:e.token_name}),o.jsxs("div",{className:"flex items-center gap-2",children:[u&&o.jsx("span",{className:"text-sm font-medium text-[var(--optimex-text)]",children:i?o.jsx("span",{className:"inline-block h-4 w-12 animate-pulse rounded bg-white/10"}):c}),o.jsx("span",{className:"font-medium text-[var(--optimex-text)]",children:e.token_symbol})]})]}),t&&o.jsx(ln,{className:"h-5 w-5 text-[var(--optimex-primary)]"})]})}function fd({tokens:e,selectedTokenId:t,disabledTokenId:r,disabledTokenIds:n,isLoading:s,emptyMessage:a="No tokens available",onSelect:c}){return s?o.jsx("div",{className:"flex-1 overflow-y-auto p-2",children:o.jsx("div",{className:"flex items-center justify-center py-8",children:o.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-[var(--optimex-primary)] border-t-transparent"})})}):e.length===0?o.jsx("div",{className:"flex-1 overflow-y-auto p-2",children:o.jsx("div",{className:"py-8 text-center text-[var(--optimex-text-secondary)]",children:a})}):o.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto p-2",children:o.jsx("div",{className:"space-y-1",children:e.map(i=>{const u=r===i.token_id||n?.has(i.token_id)===!0;return o.jsx(dd,{token:i,isSelected:t===i.token_id,isDisabled:u,onSelect:()=>c(i)},i.token_id)})})})}function hd({isOpen:e,onClose:t,onSelect:r,tokensData:n,isLoading:s,selectedToken:a,disabledTokenId:c,disabledTokenIds:i,tokens:u,emptyMessage:d,title:f="Select Token",filterNetworkType:h}){const[p,y]=x.useState(""),[v,m]=x.useState(null),[w,b]=x.useState(null),R=x.useMemo(()=>n?.supported_networks?h?n.supported_networks.filter(W=>W.type===h):n.supported_networks:[],[n,h]),T=u??n?.tokens,k=x.useMemo(()=>T?T.filter(W=>{if(h&&W.network_type!==h||v&&W.network_id!==v)return!1;if(p){const K=(X,J)=>X.toLowerCase().includes(J.toLowerCase()),D=p.toLowerCase();return K(W.token_symbol,D)||K(W.token_name,D)||K(W.token_address,D)}return!0}):[],[T,p,v,h]),A=x.useMemo(()=>{if(!T)return[];const W=new Map;return T.forEach(K=>{h&&K.network_type!==h||v&&K.network_id!==v||W.has(K.token_symbol)||W.set(K.token_symbol,K)}),Array.from(W.values())},[T,h,v]),L=x.useMemo(()=>w?k.filter(W=>W.token_symbol===w):k,[k,w]),j=()=>{y(""),m(null),b(null)},N=W=>{r(W),t(),j()},M=W=>{W||(t(),j())},U=W=>{m(W),b(null)};return o.jsx(pn,{open:e,onOpenChange:M,title:f,height:"70vh",children:o.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[o.jsx(Wu,{value:p,onChange:y}),o.jsxs("div",{className:"flex flex-1 min-h-0 overflow-hidden",children:[o.jsx(Hu,{networks:R,selectedNetwork:v,onSelectNetwork:U}),o.jsxs("div",{className:"flex flex-1 min-h-0 flex-col overflow-hidden",children:[o.jsx(Uu,{tokens:A,selectedSymbol:w,onSelectSymbol:b}),o.jsx(fd,{tokens:L,selectedTokenId:a?.token_id,disabledTokenId:c,disabledTokenIds:i,isLoading:s,emptyMessage:p?"No tokens found":d??"No tokens available",onSelect:N})]})]})]})})}function ts({token:e,amount:t,label:r,isEstimated:n=!1,highlight:s=!1,usdValue:a="$0.00"}){return o.jsx("div",{className:`p-4 rounded-xl border transition-all duration-200 ${s?"bg-[var(--optimex-surface)] border-[var(--optimex-primary)]/20 shadow-[0_0_15px_rgba(235,98,0,0.1)]":"bg-[var(--optimex-surface)] border-white/5"}`,children:o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("div",{className:"size-12 flex items-center justify-center",children:o.jsx(Je,{token:e,size:"lg"})}),o.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0",children:[o.jsxs("p",{className:`text-xs font-medium uppercase tracking-wider ${s?"text-[var(--optimex-primary)]":"text-[var(--optimex-text-secondary)]"}`,children:[r," ",n&&"(Est.)"]}),o.jsx("p",{className:"text-[var(--optimex-text)] text-sm font-semibold truncate",children:e.token_symbol}),o.jsx("p",{className:"text-[var(--optimex-text-secondary)] text-xs truncate",children:e.network_name})]}),o.jsxs("div",{className:"flex flex-col items-end gap-0.5 ml-auto shrink-0",children:[o.jsx("p",{className:"text-[var(--optimex-text)] text-lg font-bold",children:n?`~${t}`:t}),o.jsx("p",{className:"text-[var(--optimex-text-secondary)] text-xs",children:a})]})]})})}function md({fromToken:e,toToken:t,fromAmount:r,toAmount:n,fromUsdValue:s="$0.00",toUsdValue:a="$0.00"}){return o.jsxs("div",{className:"relative flex flex-col gap-2",children:[o.jsx(ts,{token:e,amount:r,label:"You Pay",usdValue:s}),o.jsx(Vo,{onClick:()=>{},disabled:!0}),o.jsx(ts,{token:t,amount:n,label:"You Receive",usdValue:a})]})}function zr({label:e,value:t,borderTop:r}){return o.jsxs("div",{className:`flex justify-between items-center text-sm ${r?"pt-2 mt-2 border-t border-white/5":""}`,children:[o.jsx("span",{className:"text-[var(--optimex-text-secondary)]",children:e}),o.jsx("div",{className:"flex items-center gap-1 text-[var(--optimex-text)] font-medium",children:t})]})}function pd({minReceived:e,estimatedTime:t,slippage:r,networkFee:n="Included"}){return o.jsxs("div",{className:"bg-[var(--optimex-surface)] rounded-xl p-4 border border-white/5 space-y-3",children:[o.jsx(zr,{label:"Min. Received",value:e}),o.jsx(zr,{label:"Estimated Time",value:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"size-2 bg-[var(--optimex-primary)] rounded-full animate-pulse shadow-[0_0_8px_rgba(235,98,0,0.8)]"}),o.jsx("span",{children:t})]})}),o.jsx(zr,{label:"Slippage Tolerance",value:r})]})}const xd=3e4,vd=6e4;function gr({symbol:e,enabled:t=!0}){const r=Mt(),{data:n,isLoading:s,isError:a}=bt({queryKey:["tokenPrice",e],queryFn:async()=>{if(!e)throw new Error("Symbol is required");return(await yt(r.apiBaseUrl).getTokenPrice(e)).current_price},enabled:t&&!!e,staleTime:xd,refetchInterval:vd,retry:2});return{price:n??null,isLoading:s,isError:a,calculateUsdValue:c=>Va(c,n??null)}}function gd({isOpen:e,onClose:t,onConfirm:r,fromToken:n,toToken:s,amountIn:a,quote:c,slippage:i,stage:u,receivingAddress:d=""}){const f=u!=="idle"&&u!=="confirming"&&u!=="error"&&u!=="submitted",h=u==="submitted",p=u==="error",y=ze(c.min_amount_out,s.token_decimals),{calculateUsdValue:v}=gr({symbol:n.token_symbol,enabled:e}),{calculateUsdValue:m}=gr({symbol:s.token_symbol,enabled:e}),w=v(a),b=m(y),R=k=>{!k&&!f&&t()},T=h?"Swap Complete":p?"Swap Failed":"Review Swap";return o.jsxs(pn,{open:e,onOpenChange:R,title:T,showCloseButton:!f,className:"w-[32rem]",children:[o.jsxs(wu,{className:"space-y-3",children:[o.jsx(md,{fromToken:n,toToken:s,fromAmount:a,toAmount:y,fromUsdValue:w,toUsdValue:b}),o.jsx(pd,{minReceived:`${y} ${s.token_symbol}`,estimatedTime:"~10 minutes",slippage:`${i}%`}),d&&o.jsx("div",{className:"bg-[var(--optimex-surface)] rounded-xl px-2 border border-white/5",children:o.jsx(vi,{icon:Cs,label:"Receiving Address",address:d})})]}),o.jsx(Cu,{children:o.jsx(cl,{state:f?"processing":h?"success":p?"error":"idle",onConfirm:h?t:r,confirmText:"Confirm Swap"})})]})}function bd({swap:e}){const{tokens:t,modals:r,tokenSelect:n,actions:s,input:a,quote:c,execution:i}=e;return o.jsxs(o.Fragment,{children:[r.tokenSelect.isOpen&&o.jsx(hd,{isOpen:r.tokenSelect.isOpen,onClose:r.tokenSelect.close,onSelect:s.selectToken,tokensData:t.data,isLoading:!1,selectedToken:n.type==="from"?t.from:t.to,disabledTokenId:n.type==="from"?t.to?.token_id:t.from?.token_id,tokens:n.type==="to"?t.availableTo:t.all,emptyMessage:n.type==="to"?"No available pairs for selected source token":void 0,title:n.type==="from"?"Select Source Token":"Select Destination Token"}),c.data&&t.from&&t.to&&r.confirm.isOpen&&o.jsx(gd,{isOpen:r.confirm.isOpen,onClose:s.closeConfirmModal,onConfirm:s.confirmSwap,fromToken:t.from,toToken:t.to,amountIn:a.amount,quote:c.data,slippage:a.slippage,stage:i.stage,txHash:i.txHash,error:i.error,receivingAddress:e.addresses.receiving})]})}function gn({status:e}){const t={pending:{icon:ws,text:"Processing",bgClass:"bg-yellow-500/10",textClass:"text-yellow-500",animate:!0},success:{icon:ln,text:"Completed",bgClass:"bg-green-500/10",textClass:"text-green-500",animate:!1},failed:{icon:si,text:"Failed",bgClass:"bg-red-500/10",textClass:"text-red-500",animate:!1}},{icon:r,text:n,bgClass:s,textClass:a,animate:c}=t[e];return o.jsxs("div",{className:`flex items-center gap-1.5 px-2.5 py-1 rounded-full ${s}`,children:[o.jsx(r,{className:`w-4 h-4 ${a} ${c?"animate-spin":""}`}),o.jsx("span",{className:`text-xs font-medium ${a}`,children:n})]})}function yd({onClose:e}){return o.jsxs("div",{className:"bg-[var(--optimex-surface)] border border-white/10 rounded-xl p-4 mt-3",children:[o.jsxs("div",{className:"flex items-center justify-between mb-3",children:[o.jsx("span",{className:"text-xs text-[var(--optimex-text-secondary)] font-medium",children:"Recent Trade"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(gn,{status:"pending"}),e&&o.jsx("button",{onClick:e,className:"text-[var(--optimex-text-secondary)] hover:text-[var(--optimex-text)] transition-colors cursor-pointer","aria-label":"Close",children:o.jsx(Ze,{className:"w-4 h-4"})})]})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-6 h-6 rounded-full bg-white/10 animate-pulse"}),o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx("div",{className:"w-16 h-4 bg-white/10 rounded animate-pulse"}),o.jsx("div",{className:"w-10 h-3 bg-white/10 rounded animate-pulse"})]})]}),o.jsx("div",{className:"flex items-center px-3",children:o.jsx("svg",{className:"w-5 h-5 text-[var(--optimex-text-secondary)]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14 5l7 7m0 0l-7 7m7-7H3"})})}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("div",{className:"flex flex-col items-end gap-1",children:[o.jsx("div",{className:"w-16 h-4 bg-white/10 rounded animate-pulse"}),o.jsx("div",{className:"w-10 h-3 bg-white/10 rounded animate-pulse"})]}),o.jsx("div",{className:"w-6 h-6 rounded-full bg-white/10 animate-pulse"})]})]})]})}function wd({trade:e,status:t,isLoading:r,onClose:n}){if(r||!e)return o.jsx(yd,{onClose:n});const s=e.from_token,a=e.to_token,c=ze(e.amount_in,s.token_decimals),i=ze(e.min_amount_out,a.token_decimals);return o.jsxs("div",{className:"bg-[var(--optimex-surface)] border border-white/10 rounded-xl p-4 mt-3",children:[o.jsxs("div",{className:"flex items-center justify-between mb-3",children:[o.jsx("span",{className:"text-xs text-[var(--optimex-text-secondary)] font-medium",children:"Recent Trade"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(gn,{status:t}),n&&o.jsx("button",{onClick:n,className:"text-[var(--optimex-text-secondary)] hover:text-[var(--optimex-text)] transition-colors cursor-pointer","aria-label":"Close",children:o.jsx(Ze,{className:"w-4 h-4"})})]})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Je,{token:s,size:"sm",showNetworkBadge:!1}),o.jsxs("div",{className:"flex flex-col",children:[o.jsx("span",{className:"text-sm font-semibold text-[var(--optimex-text)]",children:c}),o.jsx("span",{className:"text-xs text-[var(--optimex-text-secondary)]",children:s.token_symbol})]})]}),o.jsx("div",{className:"flex items-center px-3",children:o.jsx("svg",{className:"w-5 h-5 text-[var(--optimex-text-secondary)]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14 5l7 7m0 0l-7 7m7-7H3"})})}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("div",{className:"flex flex-col items-end",children:[o.jsx("span",{className:"text-sm font-semibold text-[var(--optimex-text)]",children:i}),o.jsx("span",{className:"text-xs text-[var(--optimex-text-secondary)]",children:a.token_symbol})]}),o.jsx(Je,{token:a,size:"sm",showNetworkBadge:!1})]})]})]})}const Cd=1e4;function kd({apiBaseUrl:e,walletAddresses:t,enabled:r=!0,limit:n=20}){const{data:s,isLoading:a,isError:c,refetch:i}=bt({queryKey:["trades",t,n],queryFn:async()=>yt(e).listTrades({from_user_address:t,limit:n}),enabled:r&&!!t?.length,refetchInterval:Cd,retry:2,retryDelay:2e3});return{trades:s??[],isLoading:a,isError:c,refetch:i}}function jd(e){if(!e)return"pending";switch(e.toLowerCase()){case"success":case"completed":return"success";case"failed":case"refunded":case"expired":return"failed";default:return"pending"}}function Sd({trade:e}){const t=e.from_token,r=e.to_token,n=jd(e.state),s=ze(e.amount_in,t.token_decimals),a=ze(e.min_amount_out,r.token_decimals);return o.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-[var(--optimex-surface)] border border-white/10",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Je,{token:t,size:"sm",showNetworkBadge:!1}),o.jsxs("div",{className:"flex flex-col",children:[o.jsx("span",{className:"text-sm font-semibold text-[var(--optimex-text)]",children:s}),o.jsx("span",{className:"text-xs text-[var(--optimex-text-secondary)]",children:t.token_symbol})]})]}),o.jsx("div",{className:"flex items-center px-2",children:o.jsx("svg",{className:"w-4 h-4 text-[var(--optimex-text-secondary)]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14 5l7 7m0 0l-7 7m7-7H3"})})}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("div",{className:"flex flex-col items-end",children:[o.jsx("span",{className:"text-sm font-semibold text-[var(--optimex-text)]",children:a}),o.jsx("span",{className:"text-xs text-[var(--optimex-text-secondary)]",children:r.token_symbol})]}),o.jsx(Je,{token:r,size:"sm",showNetworkBadge:!1})]}),o.jsx("div",{className:"ml-3",children:o.jsx(gn,{status:n})})]})}function Wr(){return o.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-[var(--optimex-surface)] border border-white/10",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-6 h-6 rounded-full bg-[var(--optimex-border)] animate-pulse"}),o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx("div",{className:"w-14 h-4 bg-[var(--optimex-border)] rounded animate-pulse"}),o.jsx("div",{className:"w-8 h-3 bg-[var(--optimex-border)] rounded animate-pulse"})]})]}),o.jsx("div",{className:"w-4 h-4 bg-[var(--optimex-border)] rounded animate-pulse"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("div",{className:"flex flex-col items-end gap-1",children:[o.jsx("div",{className:"w-14 h-4 bg-[var(--optimex-border)] rounded animate-pulse"}),o.jsx("div",{className:"w-8 h-3 bg-[var(--optimex-border)] rounded animate-pulse"})]}),o.jsx("div",{className:"w-6 h-6 rounded-full bg-[var(--optimex-border)] animate-pulse"})]}),o.jsx("div",{className:"ml-3 w-20 h-6 bg-[var(--optimex-border)] rounded-full animate-pulse"})]})}function Ed(){return o.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[o.jsx("div",{className:"w-16 h-16 mb-4 rounded-full bg-[var(--optimex-surface)] flex items-center justify-center",children:o.jsx("svg",{className:"w-8 h-8 text-[var(--optimex-text-secondary)]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})})}),o.jsx("p",{className:"text-sm text-[var(--optimex-text-secondary)]",children:"No trade history yet"})]})}function Nd({open:e,onOpenChange:t,evmAddress:r,btcAddress:n,solanaAddress:s}){const a=Mt(),c=[r,n,s].filter(d=>!!d),{trades:i,isLoading:u}=kd({apiBaseUrl:a.apiBaseUrl,walletAddresses:c.length>0?c:void 0,enabled:e&&c.length>0});return o.jsx(pn,{open:e,onOpenChange:t,title:"Trade History",className:"w-[32rem]",children:o.jsxs("div",{className:"p-4 space-y-3 max-h-[60vh] overflow-y-auto",children:[u?o.jsxs(o.Fragment,{children:[o.jsx(Wr,{}),o.jsx(Wr,{}),o.jsx(Wr,{})]}):i.length===0?o.jsx(Ed,{}):i.map(d=>o.jsx(Sd,{trade:d},d.trade_id)),!u&&i.length>0&&o.jsxs("div",{className:"flex items-center justify-center gap-2 pt-2 text-xs text-[var(--optimex-text-secondary)]",children:[o.jsx(ws,{className:"w-3 h-3 animate-spin"}),o.jsx("span",{children:"Auto-refreshing"})]})]})})}function Td(e,t){return x.useMemo(()=>{const r=e.trim();if(!t||!r)return{isValid:!r,error:void 0};const n=an(r,t.network_type,t.network_id);return{isValid:n.isValid,error:n.isValid?void 0:n.error}},[e,t])}function Rd(){const[e,t]=x.useState(null),[r,n]=x.useState(!1),[s,a]=x.useState(!1),c=x.useCallback(()=>t("from"),[]),i=x.useCallback(()=>t("to"),[]),u=x.useCallback(()=>t(null),[]),d=x.useCallback(()=>n(!0),[]),f=x.useCallback(()=>n(!1),[]),h=x.useCallback(()=>a(y=>!y),[]),p=x.useCallback(()=>a(!1),[]);return{tokenSelect:{isOpen:e!==null,type:e,openFrom:c,openTo:i,close:u},confirm:{isOpen:r,open:d,close:f},settings:{isOpen:s,toggle:h,close:p}}}function Od({fromToken:e,toToken:t,amount:r,fromUserAddress:n,toUserAddress:s,userRefundPubkey:a,slippage:c,config:i}){return x.useMemo(()=>{const u=s.trim(),d=i.affiliateAddress&&i.affiliateFee?[{provider:i.affiliateProvider??"optimex-widget",rate:String(i.affiliateFee),receiver:i.affiliateAddress,network:"ethereum"}]:void 0,f=Math.round(c*100);return{from_token:e,to_token:t,amount:r,from_user_address:n,to_user_address:u||null,user_refund_pubkey:a,slippage:String(f),affiliate_fee_bps:i.affiliateFee?String(i.affiliateFee):void 0,affiliate_info:d,trade_timeout:i.tradeTimeout,script_timeout:i.scriptTimeout}},[e,t,r,n,s,a,c,i.affiliateFee,i.affiliateAddress,i.affiliateProvider,i.tradeTimeout,i.scriptTimeout])}function _d(e,t){return x.useMemo(()=>{if(!e||!t)return{walletAccount:void 0,evmWalletAccount:void 0};switch(e.network_type){case ie.EVM:return{walletAccount:t.evm,evmWalletAccount:t.evm};case ie.BTC:return{walletAccount:t.btc,evmWalletAccount:void 0};case ie.SOLANA:return{walletAccount:t.solana,evmWalletAccount:void 0};default:return{walletAccount:void 0,evmWalletAccount:void 0}}},[e,t])}const rs={BTC:1,EVM:2,Solana:3};function Ad(e){const{tokens:t,pairs:r,selectedFromToken:n}=e,s=x.useMemo(()=>{const y=new Map;if(!r)return y;for(const v of r){if(!v.is_active)continue;const m=y.get(v.from_token_id);m?m.add(v.to_token_id):y.set(v.from_token_id,new Set([v.to_token_id]))}return y},[r]),a=x.useMemo(()=>t??[],[t]),c=x.useMemo(()=>{const y=new Set;for(const v of a){const m=s.get(v.token_id);(!m||m.size===0)&&y.add(v.token_id)}return y},[a,s]),i=x.useMemo(()=>{if(!n)return[];const y=s.get(n.token_id);return!y||y.size===0?[]:a.filter(v=>y.has(v.token_id))},[n,s,a]),u=x.useCallback((y,v)=>s.get(y)?.has(v)??!1,[s]),d=x.useCallback(y=>(s.get(y)?.size??0)>0,[s]),f=x.useCallback(y=>[...y].sort((v,m)=>{const w=rs[v.network_type]??99,b=rs[m.network_type]??99;return w-b}),[]),h=x.useCallback(y=>{const v=s.get(y.token_id);if(!v||v.size===0)return null;const m=a.filter(b=>v.has(b.token_id));return m.length===0?null:f(m)[0]??null},[s,a,f]),p=x.useCallback(()=>{if(a.length===0)return null;const y=f(a);for(const v of y){const m=h(v);if(m)return{fromToken:v,toToken:m}}return null},[a,f,h]);return{allTokens:a,tokensWithoutPairs:c,availableToTokens:i,isPairValid:u,findBestToToken:h,hasValidPairs:d,getDefaultPair:p}}function Md(e){if(!e.chain_id||e.network_type!=="EVM")return;const t=parseInt(e.chain_id,10);return isNaN(t)?void 0:t}async function Pd(e,t){const r=Md(t);if(!r)throw new Error(`Cannot determine chain ID for token: ${t.token_id}`);return await e.getChainId()===r?!1:(await e.switchChain(r),!0)}const Id="0xdd62ed3e",Dd="0x095ea7b3",Ld="0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff";function rn(e){return e.toLowerCase().replace("0x","").padStart(64,"0")}function Fd(e){return e.toString(16).padStart(64,"0")}function Bd(e){const t=e.startsWith("0x")?e.slice(2):e;return!t||t===""?0n:BigInt("0x"+t)}async function $d(e,t,r,n){const s=Cr(e),a=Id+rn(r)+rn(n),i=await(await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:"eth_call",params:[{to:t,data:a},"latest"]})})).json();if(i.error)throw new Error(`Failed to check allowance: ${i.error.message}`);return Bd(i.result)}function zd(e,t){const r=t?Fd(t):Ld.slice(2);return`${Dd}${rn(e)}${r}`}async function Wd(e,t,r,n){const s=zd(r,n);return await e.sendTransaction({to:t,data:s})}async function Hd(e,t,r=60,n=2e3){const s=Cr(e);for(let a=0;a<r;a++){const i=await(await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:"eth_getTransactionReceipt",params:[t]})})).json();if(i.error)throw new Error(`RPC error: ${i.error.message}`);if(i.result){const u=i.result;return{status:u.status==="0x1"?"success":"reverted",blockNumber:u.blockNumber,transactionHash:u.transactionHash}}await new Promise(u=>setTimeout(u,n))}throw new Error(`Transaction ${t} not confirmed after ${r} attempts`)}function Vd(e){return e?"getChainId"in e&&"switchChain"in e&&typeof e.getChainId=="function"&&typeof e.switchChain=="function":!1}function Ud({apiBaseUrl:e,onWalletTx:t,onSubmitTx:r,onError:n}){const[s,a]=x.useState({stage:"idle",txHash:null,tradeId:null,error:null}),c=x.useCallback(()=>{a({stage:"idle",txHash:null,tradeId:null,error:null})},[]),i=x.useCallback(()=>{a(h=>({stage:"idle",txHash:h.txHash,tradeId:h.tradeId,error:null}))},[]),u=x.useCallback((h,p,y)=>{a(v=>({...v,stage:"error",error:h})),n?.({error:h,stage:p,trade_id:y})},[n]),d=x.useCallback(async(h,p,y,v)=>{const m=y.deposit_address;if(!m)throw new Error("Missing deposit address for EVM transaction");a(T=>({...T,stage:"switching_chain"})),await Pd(h,p);const w=vn(p);if(!w&&p.token_address&&(a(k=>({...k,stage:"checking_allowance"})),await $d(p.network_id,p.token_address,h.address,m)<v)){a(L=>({...L,stage:"approving"}));const k=await Wd(h,p.token_address,m,v);if((await Hd(p.network_id,k)).status==="reverted")throw new Error("Token approval transaction reverted")}a(T=>({...T,stage:"broadcasting"}));const b={to:m,value:w?v:0n,data:y.payload?y.payload:void 0};return await h.sendTransaction(b)},[]),f=x.useCallback(async({quote:h,fromToken:p,toToken:y,amountIn:v,walletAccount:m,evmWalletAccount:w})=>{const b=yt(e);try{a({stage:"confirming",txHash:null,tradeId:h.trade_id,error:null});const R=w||m;if(!R)throw new Error("Wallet not available");a(A=>({...A,stage:"signing"}));let T;const k=gs(v,p.token_decimals);if(p.network_type===ie.EVM){const A=w||(Vd(m)?m:null);if(A)T=await d(A,p,h,k);else{const L=h.deposit_address,j=h.payload?h.payload:void 0;if(!L)throw new Error("Missing deposit address for EVM transaction");a(M=>({...M,stage:"broadcasting"}));const N={to:L,value:k,data:j};T=await R.sendTransaction(N)}}else if(p.network_type===ie.BTC){if(!h.deposit_address)throw new Error("Missing deposit address for BTC transaction");a(A=>({...A,stage:"broadcasting"})),T=await R.sendTransaction({toAddress:h.deposit_address,amount:k})}else if(p.network_type===ie.SOLANA){if(!h.payload)throw new Error("Missing payload for Solana transaction");a(A=>({...A,stage:"broadcasting"})),T=await R.sendTransaction(h.payload)}else throw new Error(`Unsupported network type: ${p.network_type}`);t?.({trade_id:h.trade_id,tx_hash:T,from_token:p,to_token:y,amount_in:v}),a(A=>({...A,txHash:T,stage:"submitting"}));try{await b.submitTransaction(h.trade_id,T),r?.({trade_id:h.trade_id,tx_hash:T,status:"success"})}catch(A){throw r?.({trade_id:h.trade_id,tx_hash:T,status:"error",error:A.message}),A}return a(A=>({...A,stage:"submitted"})),{tradeId:h.trade_id,txHash:T}}catch(R){const T=s.stage==="approving"?"approval":"wallet_tx";throw u(R,T,h.trade_id),R}},[e,t,r,u,d,s.stage]);return{...s,executeSwap:f,resetState:c,resetStateKeepTradeId:i,isExecuting:s.stage!=="idle"&&s.stage!=="submitted"&&s.stage!=="error"}}function qd({defaultPair:e,isPairValid:t,findBestToToken:r,hasValidPairs:n,defaultSlippage:s=.75,selectingToken:a=null}){const[c,i]=x.useState(null),[u,d]=x.useState(null),[f,h]=x.useState(""),[p,y]=x.useState(""),[v,m]=x.useState(s),w=c??e?.fromToken??null,b=u??e?.toToken??null,R=x.useCallback(()=>{w&&b&&t(b.token_id,w.token_id)&&(i(b),d(w),h(""))},[w,b,t]),T=x.useCallback(k=>{if(a==="from"){if(!n(k.token_id))return!1;if(k.token_id===b?.token_id)d(w);else if(b&&!t(k.token_id,b.token_id)){const A=r(k);d(A)}return i(k),!0}else if(a==="to")return k.token_id===w?.token_id&&i(b),d(k),!0;return!1},[a,w,b,t,r,n]);return{fromToken:w,toToken:b,handleTokenSelect:T,handleSwapDirection:R,amount:f,setAmount:h,receivingAddress:p,setReceivingAddress:y,slippage:v,setSlippage:m}}function Qd({fromToken:e,toToken:t}){const r=kt();return x.useMemo(()=>{const n=r.evmAddress,s=r.btcAddress,a=r.btcPublicKey;let c=null,i=null;return e?.network_type===ie.EVM?(c=n,i=n):e?.network_type===ie.BTC&&(c=s,i=a),{fromUserAddress:c,userRefundPubkey:i}},[r.evmAddress,r.btcAddress,r.btcPublicKey,e,t])}function Kd({fromToken:e,toToken:t,amount:r,quote:n,isLoadingQuote:s,isFetchingQuote:a,receivingAddress:c,onConnectWallet:i,onSwap:u}){const d=kt();return x.useMemo(()=>{if(!nd(d,e?.network_type)){const p=sd(e?.network_type);return{text:p?`Connect ${p} Wallet`:"Connect Wallet",disabled:!1,action:i}}return!e||!t?{text:"Select Tokens",disabled:!0,action:void 0}:!r||parseFloat(r)<=0?{text:"Enter Amount",disabled:!0,action:void 0}:c.trim()?an(c,t.network_type,t.network_id).isValid?s||a?{text:"Getting Quote...",disabled:!0,action:void 0}:n?{text:"Review",disabled:!1,action:u}:{text:"Unable to Quote",disabled:!0,action:void 0}:{text:"Enter Receiving Address",disabled:!0,action:void 0}:{text:"Enter Receiving Address",disabled:!0,action:void 0}},[d.isEvmConnected,d.isBtcConnected,d.isSolanaConnected,e,t,r,s,a,n,i,u,c])}function Gd({tokens:e,defaultFromToken:t,defaultToToken:r,isPairValid:n}){return x.useMemo(()=>{if(!t||!r||!e)return null;const s=e.find(c=>c.token_id===t),a=e.find(c=>c.token_id===r);return!s||!a?null:n(s.token_id,a.token_id)?{fromToken:s,toToken:a}:null},[e,t,r,n])}function Yd(){const e=kt(),t=Mt(),r=Rd(),{tokensData:n}=Mu(),s=n.tokens,a=n.pairs,{allTokens:c,tokensWithoutPairs:i,isPairValid:u,findBestToToken:d,hasValidPairs:f,getDefaultPair:h}=Ad({tokens:s,pairs:a,selectedFromToken:null}),y=Gd({tokens:s,defaultFromToken:t.defaultFromToken,defaultToToken:t.defaultToToken,isPairValid:u})??h(),{fromToken:v,toToken:m,handleTokenSelect:w,handleSwapDirection:b,amount:R,setAmount:T,receivingAddress:k,setReceivingAddress:A,slippage:L,setSlippage:j}=qd({defaultPair:y,isPairValid:u,findBestToToken:d,hasValidPairs:f,defaultSlippage:t.defaultSlippage,selectingToken:r.tokenSelect.type}),N=x.useMemo(()=>v?c.filter(F=>u(v.token_id,F.token_id)):[],[v,c,u]),M=Td(k,m),{fromUserAddress:U,userRefundPubkey:W}=Qd({fromToken:v,toToken:m}),K=Od({fromToken:v,toToken:m,amount:R,fromUserAddress:U,toUserAddress:k,userRefundPubkey:W,slippage:L,config:{affiliateFee:t.affiliateFee,affiliateAddress:t.affiliateAddress,affiliateProvider:t.affiliateProvider,tradeTimeout:t.tradeTimeout,scriptTimeout:t.scriptTimeout}}),D=!!v&&!!m&&parseFloat(R)>0&&!!k.trim()&&!r.confirm.isOpen,{data:X,isLoading:J,isFetching:re,refetch:te}=ei(t.apiBaseUrl,{...K,enabled:D,onQuote:t.callbacks?.onQuote}),_=Ud({apiBaseUrl:t.apiBaseUrl,onWalletTx:t.callbacks?.onWalletTx,onSubmitTx:t.callbacks?.onSubmitTx,onError:t.callbacks?.onError}),{walletAccount:oe,evmWalletAccount:me}=_d(v,e.externalWalletClient??void 0),xe=x.useCallback(()=>{e.isExternalWallet?e.onRequestWallet?.(v?.network_id??""):e.openConnectModal?.()},[e,v?.network_id]),ve=x.useCallback(()=>{!X||!v||!m||(_.resetState(),r.confirm.open())},[X,v,m,r.confirm,_]),Y=x.useCallback((F=!1)=>{_.isExecuting||(r.confirm.close(),F&&_.resetStateKeepTradeId())},[_,r.confirm]),ne=x.useCallback(async()=>{if(!(!X||!v||!m))try{const{txHash:F}=await _.executeSwap({quote:X,fromToken:v,toToken:m,amountIn:R,walletAccount:oe,evmWalletAccount:me});Y(!!F),T(""),A("")}catch(F){console.error("Swap failed:",F)}},[X,v,m,R,oe,me,_,Y,T,A]),ye=x.useCallback(F=>{w(F)&&r.tokenSelect.close()},[w,r.tokenSelect]),Te=Kd({fromToken:v,toToken:m,amount:R,quote:X,isLoadingQuote:J,isFetchingQuote:re,receivingAddress:k,onConnectWallet:xe,onSwap:ve});return{tokens:{from:v,to:m,all:c,availableTo:N,withoutPairs:i,data:n},input:{amount:R,setAmount:T,receivingAddress:k,setReceivingAddress:A,slippage:L,setSlippage:j},quote:{data:X,isLoading:J,isFetching:re,refetch:te},validation:{address:M},buttonState:Te,modals:r,tokenSelect:{type:r.tokenSelect.type},actions:{selectToken:ye,swapDirection:b,connectWallet:xe,openSwapConfirm:ve,closeConfirmModal:Y,confirmSwap:ne},execution:{stage:_.stage,txHash:_.txHash,tradeId:_.tradeId,error:_.error,isExecuting:_.isExecuting},wallet:e,addresses:{sending:U,receiving:k}}}const Zd=5e3;function ns(e){if(!e)return"pending";switch(e.toLowerCase()){case"success":case"completed":return"success";case"failed":case"refunded":case"expired":return"failed";default:return"pending"}}function Xd({apiBaseUrl:e,tradeId:t}){const{data:r,isLoading:n}=bt({queryKey:["trade",t],queryFn:async()=>yt(e).getTrade(t),enabled:!!t,refetchInterval:s=>{const a=s.state.data;return a&&ns(a.state)==="success"?!1:Zd},retry:!0,retryDelay:2e3});return{trade:r??null,status:ns(r?.state),isLoading:n}}function Yo(){const e=Yd(),t=Mt(),{tokens:r,input:n,quote:s,modals:a,buttonState:c,validation:i,actions:u,addresses:d,wallet:f,execution:h}=e,[p,y]=x.useState(!1),{trade:v,status:m,isLoading:w}=Xd({apiBaseUrl:t.apiBaseUrl,tradeId:h.tradeId}),{formattedBalance:b}=Go({token:r.from,walletAddress:d.sending,enabled:!!r.from&&!!d.sending,polling:!0}),{calculateUsdValue:R}=gr({symbol:r.from?.token_symbol,enabled:!!r.from}),{calculateUsdValue:T}=gr({symbol:r.to?.token_symbol,enabled:!!r.to}),k=f.isConnected,A=R(n.amount),L=s.data?T(ze(s.data.min_amount_out,r.to?.token_decimals||18)):"$0.00";return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex flex-col gap-4 w-full min-w-0",children:[o.jsx(Fu,{headerLeft:t.headerLeft,slippage:n.slippage,onSlippageChange:n.setSlippage,isSettingsOpen:a.settings.isOpen,onSettingsToggle:a.settings.toggle,onHistoryClick:()=>y(!0),hideHistory:t.hideHistory||!f.isConnected}),o.jsxs(xn,{children:[o.jsxs("div",{className:"space-y-2 relative",children:[o.jsx(es,{token:r.from,value:n.amount,onChange:n.setAmount,onSelectToken:a.tokenSelect.openFrom,balance:b,isWalletConnected:k,usdValue:A}),o.jsx(Vo,{onClick:u.swapDirection}),o.jsx(es,{token:r.to,value:s.data?ze(s.data.min_amount_out,r.to?.token_decimals||18):"",readOnly:!0,onSelectToken:a.tokenSelect.openTo,isOutput:!0,usdValue:L})]}),o.jsx("div",{className:"mt-4",children:o.jsx(Pu,{token:r.to,value:n.receivingAddress,onChange:n.setReceivingAddress,error:i.address.error})}),o.jsx("div",{className:"mt-4",children:o.jsx($u,{text:c.text,disabled:c.disabled,onClick:c.action})}),s.data&&r.from&&r.to&&o.jsx("div",{className:"mt-4",children:o.jsx(Bu,{quote:s.data,fromToken:r.from,toToken:r.to,amount:n.amount,slippage:n.slippage,isFetching:s.isFetching,onRefresh:s.refetch})}),o.jsx("div",{className:"mt-4",children:o.jsx(zu,{})}),h.tradeId&&h.txHash&&o.jsx("div",{className:"mt-4",children:o.jsx(wd,{trade:v,status:m,isLoading:w})})]})]}),o.jsx(bd,{swap:e}),p&&o.jsx(Nd,{open:p,onOpenChange:y,evmAddress:f.evmAddress??void 0,btcAddress:f.btcAddress??void 0,solanaAddress:f.solanaAddress??void 0})]})}function Jd({className:e,connectLabel:t="Connect Wallet",showNetworkBadge:r=!0,onClick:n}){const s=kt(),a=s.evmAddress||s.btcAddress||s.solanaAddress,c=()=>{if(n){n();return}s.isExternalWallet?s.onRequestWallet?.():s.openConnectModal?.()},i=()=>r?s.isEvmConnected?o.jsx("span",{className:"rounded bg-blue-500/20 px-1.5 py-0.5 text-xs text-blue-400",children:"EVM"}):s.isBtcConnected?o.jsx("span",{className:"rounded bg-orange-500/20 px-1.5 py-0.5 text-xs text-orange-400",children:"BTC"}):s.isSolanaConnected?o.jsx("span",{className:"rounded bg-purple-500/20 px-1.5 py-0.5 text-xs text-purple-400",children:"SOL"}):null:null;return s.isConnected?o.jsxs("div",{className:`flex items-center gap-2 ${e||""}`,children:[i(),o.jsxs("button",{onClick:c,className:"group flex items-center gap-1.5 rounded-[0.25rem] bg-[var(--optimex-surface-hover)] px-3 py-1.5 text-sm text-[var(--optimex-text)] transition-colors hover:bg-[rgba(239,68,68,0.2)]",children:[o.jsx("span",{children:Wa(a)}),o.jsx(ii,{className:"h-3.5 w-3.5 opacity-0 transition-opacity group-hover:opacity-100"})]})]}):o.jsx("button",{onClick:c,className:`rounded-[0.25rem] bg-[var(--optimex-primary)] px-4 py-1.5 text-sm font-medium text-white transition-colors hover:bg-[var(--optimex-primary-hover)] ${e||""}`,children:t})}function ef({apiBaseUrl:e,walletClient:t,onRequestWallet:r,theme:n,defaultFromToken:s,defaultToToken:a,headerLeft:c,affiliateFee:i,affiliateAddress:u,affiliateProvider:d,tradeTimeout:f,scriptTimeout:h,defaultSlippage:p=.75,hideHistory:y=!1,children:v,renderLoading:m,renderError:w,queryClient:b,onQuote:R,onWalletTx:T,onSubmitTx:k,onSwapComplete:A,onError:L}){La(e);const j=x.useMemo(()=>b??new ha,[b]),M={apiBaseUrl:e,defaultSlippage:p,affiliateFee:i,affiliateAddress:u,affiliateProvider:d,tradeTimeout:f,scriptTimeout:h,defaultFromToken:s,defaultToToken:a,hideHistory:y,headerLeft:c,callbacks:{onQuote:R,onWalletTx:T,onSubmitTx:k,onSwapComplete:A,onError:L},renderLoading:m,renderError:w},U=v??o.jsx(Yo,{});return o.jsx("div",{className:"optx-widget",children:o.jsx(ga,{client:j,children:o.jsx(ti,{value:M,children:o.jsx(Pa,{theme:n,children:o.jsx(Da,{externalWalletClient:t,onRequestWallet:r,children:o.jsx(Au,{children:U})})})})})})}exports.ConnectButton=Jd;exports.SwapCard=Yo;exports.SwapWidget=ef;exports.createEvmWalletClient=Qo;exports.createEvmWalletClientAsync=ad;exports.createEvmWalletClientSync=Ko;exports.useWallet=kt;
|