otx-swap 1.2.6 → 1.2.7

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.
Files changed (3) hide show
  1. package/dist/index.cjs +7 -7
  2. package/dist/index.mjs +1745 -1736
  3. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  (function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".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 .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-\\[600px\\]{max-height:600px}.optx-widget .max-h-\\[60vh\\]{max-height:60vh}.optx-widget .max-h-\\[90vh\\]{max-height:90vh}.optx-widget .max-h-\\[96vh\\]{max-height:96vh}.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-2xl{max-width:42rem}.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))}@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-3xl{border-radius:1.5rem}.optx-widget .rounded-\\[0\\.25rem\\]{border-radius:.25rem}.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-2xl{border-top-left-radius:1rem;border-top-right-radius:1rem}.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-border\\)\\]{border-color:var(--optimex-border)}.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-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.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-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-red-500\\/20{background-color:#ef444433}.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-800\\/80{background-color:#27272acc}.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-white\\/20{color:#fff3}.optx-widget .text-white\\/30{color:#ffffff4d}.optx-widget .text-white\\/40{color:#fff6}.optx-widget .text-white\\/50{color:#ffffff80}.optx-widget .text-white\\/60{color:#fff9}.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 .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 .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{isolation:isolate;width:100%;min-width:0;max-width:100%;--optimex-primary: #eb6200;--optimex-primary-rgb: 235, 98, 0;--optimex-primary-hover: #d45800;--optimex-background: #0f1115;--optimex-surface: #1a1e26;--optimex-surface-hover: #252a35;--optimex-card-dark: #141417;--optimex-text: #ffffff;--optimex-text-secondary: #9ca3af;--optimex-border: #23170f;--optimex-success: #22c55e;--optimex-error: #ef4444;--optimex-warning: #f59e0b;--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:Space Grotesk,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;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 .glass-container{background:linear-gradient(135deg,#1a1e26e6,#0f1115f2);border:1px solid rgba(255,255,255,.05);-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}.optx-widget .placeholder\\:text-white\\/10::-moz-placeholder{color:#ffffff1a}.optx-widget .placeholder\\:text-white\\/10::placeholder{color:#ffffff1a}.optx-widget .placeholder\\:text-white\\/30::-moz-placeholder{color:#ffffff4d}.optx-widget .placeholder\\:text-white\\/30::placeholder{color:#ffffff4d}.optx-widget .placeholder\\:text-white\\/50::-moz-placeholder{color:#ffffff80}.optx-widget .placeholder\\:text-white\\/50::placeholder{color:#ffffff80}.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-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.optx-widget .hover\\:text-white\\/40:hover{color:#fff6}.optx-widget .hover\\:text-white\\/50:hover{color:#ffffff80}.optx-widget .hover\\:text-white\\/60:hover{color:#fff9}.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\\: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}}@media(min-width:768px){.optx-widget .md\\:h-\\[70vh\\]{height:70vh}}")),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"),p=require("react"),ke=require("./react-query-DLqM33VH.cjs"),Vn=require("react-dom");function Wn(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const h=Wn(p),To=Wn(Vn),Ct={colors:{primary:"#ed6300",primaryHover:"#EA580C",secondary:"#FB923C",background:"#111112",surface:"#1A1A1A",surfaceHover:"#252525",text:"#FFFFFF",textSecondary:"#9CA3AF",border:"#2A2A2A",success:"#22C55E",error:"#EF4444",warning:"#F59E0B"},borderRadius:"lg"},_o=p.createContext(null);function Ro({children:e,theme:t}){const n=p.useMemo(()=>t?{...Ct,...t,colors:{...Ct.colors,...t.colors}}:Ct,[t]),r=p.useMemo(()=>({"--optimex-primary":n.colors.primary,"--optimex-primary-hover":n.colors.primaryHover,"--optimex-secondary":n.colors.secondary,"--optimex-background":n.colors.background,"--optimex-surface":n.colors.surface,"--optimex-surface-hover":n.colors.surfaceHover,"--optimex-text":n.colors.text,"--optimex-text-secondary":n.colors.textSecondary,"--optimex-border":n.colors.border,"--optimex-success":n.colors.success,"--optimex-error":n.colors.error,"--optimex-warning":n.colors.warning}),[n]);return o.jsx(_o.Provider,{value:{theme:n},children:o.jsx("div",{style:r,className:"w-full",children:e})})}const Hn=p.createContext(null);function Ao({children:e,externalWalletClient:t,onRequestWallet:n}){const r=p.useMemo(()=>{const s=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,d=!!s,u=!!l,f=!!c;return{mode:"external",isExternalWallet:!0,isConnected:d||u||f,evmAddress:s,evmChainId:a,isEvmConnected:d,btcAddress:l,btcPublicKey:i,isBtcConnected:u,solanaAddress:c,isSolanaConnected:f,externalWalletClient:t,onRequestWallet:n,isConnecting:!1}},[t,n]);return o.jsx(Hn.Provider,{value:r,children:e})}class kt extends Error{status;code;constructor(t,n,r){super(n),this.name="ApiError",this.status=t,this.code=r}}class Un{baseUrl;headers;constructor(t){this.baseUrl=t.replace(/\/$/,""),this.headers={"Content-Type":"application/json"}}async request(t,n,r){const s=`${this.baseUrl}${n}`;try{const a=await fetch(s,{method:t,headers:this.headers,body:r?JSON.stringify(r):void 0});if(!a.ok){const i=await a.json().catch(()=>({}));throw new kt(a.status,i.message||`Request failed with status ${a.status}`,i.code)}return(await a.json()).data}catch(a){throw a instanceof kt?a:new kt(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,n){return this.request("POST","/v2/trades/submit-tx",{trade_id:t,tx_id:n})}async getTrade(t){return this.request("GET",`/v2/trades/${t}`)}async getTokenPrice(t){return this.request("GET",`/v2/tokens/${t}`)}async listTrades(t={}){const n=new URLSearchParams;t.limit&&n.set("limit",String(t.limit)),t.page&&n.set("page",String(t.page)),t.state&&n.set("state",t.state),t.from_user_address?.length&&t.from_user_address.forEach(a=>n.append("from_user_address",a)),t.to_user_address?.length&&t.to_user_address.forEach(a=>n.append("to_user_address",a));const r=n.toString(),s=r?`/v2/trades?${r}`:"/v2/trades";return this.request("GET",s)}}let Be=null;function Ve(e){if(!Be&&e&&(Be=new Un(e)),!Be)throw new Error("API not initialized. Please provide baseUrl.");return Be}function Mo(e){return Be=new Un(e),Be}const Lo=["tokens"];function Po(e){return ke.useQuery({queryKey:Lo,queryFn:async()=>Ve(e).getTokens(),staleTime:300*1e3,gcTime:1800*1e3,retry:3,retryDelay:t=>Math.min(1e3*2**t,3e4)})}const Oo=15e3,Io=1e4,Y={EVM:"EVM",BTC:"BTC",SOLANA:"Solana"};function Do(e,t=4){return e?e.length<=t*2+3?e:`${e.slice(0,t+2)}...${e.slice(-t)}`:""}function $o(e,t,n=6){if(!e)return"0";let r;typeof e=="bigint"?r=e:typeof e=="string"?r=BigInt(e):r=BigInt(Math.floor(e));const s=BigInt(10**t),a=r/s,l=r%s;if(l===0n)return a.toString();const c=l.toString().padStart(t,"0").slice(0,n).replace(/0+$/,"");return c?`${a}.${c}`:a.toString()}function qn(e,t){if(!e||e==="0")return 0n;const[n,r=""]=e.split("."),s=r.slice(0,t).padEnd(t,"0"),a=n+s;return BigInt(a)}function je(e,t=18,n=6){if(!e)return"0";const r=String(e);if(r.includes(".")||!Number.isInteger(Number(r))){const s=parseFloat(r);return isNaN(s)?"0":s.toFixed(n).replace(/\.?0+$/,"")}return $o(r,t,n)}function Fo(e){return/^0x[a-fA-F0-9]{40}$/.test(e)}function Bo(e){return/^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$|^(bc1)[a-z0-9]{39,59}$/.test(e)}function zo(e){return/^[mn2][a-km-zA-HJ-NP-Z1-9]{25,34}$|^(tb1)[a-z0-9]{39,59}$/.test(e)}function Vo(e){return/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(e)}function Kt(e,t,n){const r=e.trim();if(!r)return{isValid:!1,error:"Address is required"};switch(t){case Y.EVM:return Fo(r)?{isValid:!0}:{isValid:!1,error:`Invalid ${n} wallet address`};case Y.BTC:if(n==="bitcoin_testnet"){if(!zo(r))return{isValid:!1,error:`Invalid ${n} wallet address`}}else if(!Bo(r))return{isValid:!1,error:`Invalid ${n} wallet address`};return{isValid:!0};case Y.SOLANA:return Vo(r)?{isValid:!0}:{isValid:!1,error:`Invalid ${n} wallet address`};default:return{isValid:!1,error:`Unsupported network type: ${t}`}}}const Wo=e=>["quote",e];function Ho(e,{from_token:t,to_token:n,amount:r,from_user_address:s,to_user_address:a,user_refund_pubkey:l,slippage:i="100",affiliate_fee_bps:c,affiliate_info:d,trade_timeout:u,script_timeout:f,enabled:x=!0,onQuote:v}){const w=n&&a?Kt(a,n.network_type,n.network_id).isValid:!1,m=t&&n&&r&&parseFloat(r)>0&&s&&a&&l&&w;return ke.useQuery({queryKey:Wo({from_token:t,to_token:n,amount:r,from_user_address:s,to_user_address:a,user_refund_pubkey:l,slippage:i}),queryFn:async()=>{const y=Ve(e),g=qn(r,t.token_decimals).toString(),k=await y.createQuote({from_token_id:t.token_id,to_token_id:n.token_id,amount_in:g,slippage:i,from_user_address:s,to_user_address:a,user_refund_pubkey:l,affiliate_fee_bps:c,affiliate_info:d,trade_timeout:u,script_timeout:f});return v?.({quote:k,from_token:t,to_token:n,amount_in:r}),k},enabled:x&&!!m,staleTime:Io,refetchInterval:Oo,retry:2,retryDelay:1e3})}const Gn=p.createContext(null);function Uo({children:e,value:t}){return o.jsx(Gn.Provider,{value:t,children:e})}function Je(){const e=p.useContext(Gn);if(!e)throw new Error("useWidgetConfig must be used within SwapWidget");return e}function qo({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 Go(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 Yt({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 Kn({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 Yn({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 Ko({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 Ae({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 Yo(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 Zo(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 Qo({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 Xo(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 Jo(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 es(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 ts(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 ns(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 rs({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 os({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 Zn(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 pn({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 Qn(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 Xn(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 Jn(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 er(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 tr(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 nr(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 rr(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 hn={bitcoin:Qn,solana:Xn,ethereum:Jn,base:er,arbitrum:tr,optimism:nr,bsc:rr};function ss(e){if(!e)return null;const t=e.toLowerCase().replace(/[\s_-]/g,"");return t in hn?hn[t]:t.includes("bitcoin")||t.includes("btc")?Qn:t.includes("solana")||t.includes("sol")?Xn:t.includes("ethereum")||t.includes("eth")||t.includes("erc20")?Jn:t.includes("base")?er:t.includes("arbitrum")||t.includes("arb")?tr:t.includes("optimism")||t.includes("op")?nr:t.includes("bsc")||t.includes("binance")||t.includes("bnb")?rr:null}function as(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function is({icon:e,label:t,address:n,className:r=""}){const[s,a]=p.useState(!1),l=p.useCallback(async()=>{try{await navigator.clipboard.writeText(n),a(!0),setTimeout(()=>a(!1),2e3)}catch{console.error("Failed to copy")}},[n]);return o.jsxs("div",{className:`flex items-center justify-between px-4 py-3 ${r}`,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:as(n)}),o.jsx("button",{onClick:l,className:"p-1 rounded hover:bg-[var(--optimex-surface-hover)] transition-colors",title:s?"Copied!":"Copy",children:s?o.jsx(Yt,{className:"size-4 text-[var(--optimex-success)]"}):o.jsx(Yo,{className:"size-4 text-[var(--optimex-text-secondary)]"})})]})]})}const ls={primary:"bg-[var(--optimex-primary)] text-black hover:bg-[var(--optimex-primary-hover)] hover:brightness-110 shadow-lg shadow-[var(--optimex-primary)]/30",secondary:"bg-[var(--optimex-surface)] text-[var(--optimex-text)] hover:bg-[var(--optimex-surface-hover)] border border-[var(--optimex-border)]",ghost:"bg-transparent text-[var(--optimex-text-secondary)] hover:bg-[var(--optimex-surface-hover)] 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"},cs={sm:"px-3 py-1.5 text-xs rounded-md gap-1.5 max-h-[2rem]",md:"px-4 py-2 text-sm rounded-md gap-2 max-h-[2.5rem]",lg:"px-6 py-3 text-sm rounded-md gap-2 max-h-[3rem]"};function or({variant:e="primary",size:t="md",fullWidth:n=!1,isLoading:r=!1,leftIcon:s,rightIcon:a,children:l,className:i="",disabled:c,...d}){const u=c||r;return o.jsxs("button",{className:`
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),p=require("react"),ke=require("./react-query-DLqM33VH.cjs"),Vn=require("react-dom");function Wn(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const x=Wn(p),To=Wn(Vn),Ct={colors:{primary:"#ed6300",primaryHover:"#EA580C",secondary:"#FB923C",background:"#111112",surface:"#1A1A1A",surfaceHover:"#252525",text:"#FFFFFF",textSecondary:"#9CA3AF",border:"#2A2A2A",success:"#22C55E",error:"#EF4444",warning:"#F59E0B"},borderRadius:"lg"},_o=p.createContext(null);function Ro({children:e,theme:t}){const n=p.useMemo(()=>t?{...Ct,...t,colors:{...Ct.colors,...t.colors}}:Ct,[t]),r=p.useMemo(()=>({"--optimex-primary":n.colors.primary,"--optimex-primary-hover":n.colors.primaryHover,"--optimex-secondary":n.colors.secondary,"--optimex-background":n.colors.background,"--optimex-surface":n.colors.surface,"--optimex-surface-hover":n.colors.surfaceHover,"--optimex-text":n.colors.text,"--optimex-text-secondary":n.colors.textSecondary,"--optimex-border":n.colors.border,"--optimex-success":n.colors.success,"--optimex-error":n.colors.error,"--optimex-warning":n.colors.warning}),[n]);return o.jsx(_o.Provider,{value:{theme:n},children:o.jsx("div",{style:r,className:"w-full",children:e})})}const Hn=p.createContext(null);function Ao({children:e,externalWalletClient:t,onRequestWallet:n}){const r=p.useMemo(()=>{const s=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,d=!!s,f=!!l,u=!!c;return{mode:"external",isExternalWallet:!0,isConnected:d||f||u,evmAddress:s,evmChainId:a,isEvmConnected:d,btcAddress:l,btcPublicKey:i,isBtcConnected:f,solanaAddress:c,isSolanaConnected:u,externalWalletClient:t,onRequestWallet:n,isConnecting:!1}},[t,n]);return o.jsx(Hn.Provider,{value:r,children:e})}class kt extends Error{status;code;constructor(t,n,r){super(n),this.name="ApiError",this.status=t,this.code=r}}class Un{baseUrl;headers;constructor(t){this.baseUrl=t.replace(/\/$/,""),this.headers={"Content-Type":"application/json"}}async request(t,n,r){const s=`${this.baseUrl}${n}`;try{const a=await fetch(s,{method:t,headers:this.headers,body:r?JSON.stringify(r):void 0});if(!a.ok){const i=await a.json().catch(()=>({}));throw new kt(a.status,i.message||`Request failed with status ${a.status}`,i.code)}return(await a.json()).data}catch(a){throw a instanceof kt?a:new kt(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,n){return this.request("POST","/v2/trades/submit-tx",{trade_id:t,tx_id:n})}async getTrade(t){return this.request("GET",`/v2/trades/${t}`)}async getTokenPrice(t){return this.request("GET",`/v2/tokens/${t}`)}async listTrades(t={}){const n=new URLSearchParams;t.limit&&n.set("limit",String(t.limit)),t.page&&n.set("page",String(t.page)),t.state&&n.set("state",t.state),t.from_user_address?.length&&t.from_user_address.forEach(a=>n.append("from_user_address",a)),t.to_user_address?.length&&t.to_user_address.forEach(a=>n.append("to_user_address",a));const r=n.toString(),s=r?`/v2/trades?${r}`:"/v2/trades";return this.request("GET",s)}}let Be=null;function Ve(e){if(!Be&&e&&(Be=new Un(e)),!Be)throw new Error("API not initialized. Please provide baseUrl.");return Be}function Mo(e){return Be=new Un(e),Be}const Lo=["tokens"];function Po(e){return ke.useQuery({queryKey:Lo,queryFn:async()=>Ve(e).getTokens(),staleTime:300*1e3,gcTime:1800*1e3,retry:3,retryDelay:t=>Math.min(1e3*2**t,3e4)})}const Oo=15e3,Io=1e4,Y={EVM:"EVM",BTC:"BTC",SOLANA:"Solana"};function Do(e,t=4){return e?e.length<=t*2+3?e:`${e.slice(0,t+2)}...${e.slice(-t)}`:""}function $o(e,t,n=6){if(!e)return"0";let r;typeof e=="bigint"?r=e:typeof e=="string"?r=BigInt(e):r=BigInt(Math.floor(e));const s=BigInt(10**t),a=r/s,l=r%s;if(l===0n)return a.toString();const c=l.toString().padStart(t,"0").slice(0,n).replace(/0+$/,"");return c?`${a}.${c}`:a.toString()}function qn(e,t){if(!e||e==="0")return 0n;const[n,r=""]=e.split("."),s=r.slice(0,t).padEnd(t,"0"),a=n+s;return BigInt(a)}function je(e,t=18,n=6){if(!e)return"0";const r=String(e);if(r.includes(".")||!Number.isInteger(Number(r))){const s=parseFloat(r);return isNaN(s)?"0":s.toFixed(n).replace(/\.?0+$/,"")}return $o(r,t,n)}function Fo(e){return/^0x[a-fA-F0-9]{40}$/.test(e)}function Bo(e){return/^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$|^(bc1)[a-z0-9]{39,59}$/.test(e)}function zo(e){return/^[mn2][a-km-zA-HJ-NP-Z1-9]{25,34}$|^(tb1)[a-z0-9]{39,59}$/.test(e)}function Vo(e){return/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(e)}function Kt(e,t,n){const r=e.trim();if(!r)return{isValid:!1,error:"Address is required"};switch(t){case Y.EVM:return Fo(r)?{isValid:!0}:{isValid:!1,error:`Invalid ${n} wallet address`};case Y.BTC:if(n==="bitcoin_testnet"){if(!zo(r))return{isValid:!1,error:`Invalid ${n} wallet address`}}else if(!Bo(r))return{isValid:!1,error:`Invalid ${n} wallet address`};return{isValid:!0};case Y.SOLANA:return Vo(r)?{isValid:!0}:{isValid:!1,error:`Invalid ${n} wallet address`};default:return{isValid:!1,error:`Unsupported network type: ${t}`}}}const Wo=e=>["quote",e];function Ho(e,{from_token:t,to_token:n,amount:r,from_user_address:s,to_user_address:a,user_refund_pubkey:l,slippage:i="100",affiliate_fee_bps:c,affiliate_info:d,trade_timeout:f,script_timeout:u,enabled:h=!0,onQuote:g}){const v=n&&a?Kt(a,n.network_type,n.network_id).isValid:!1,m=t&&n&&r&&parseFloat(r)>0&&s&&a&&l&&v;return ke.useQuery({queryKey:Wo({from_token:t,to_token:n,amount:r,from_user_address:s,to_user_address:a,user_refund_pubkey:l,slippage:i}),queryFn:async()=>{const b=Ve(e),w=qn(r,t.token_decimals).toString(),N=await b.createQuote({from_token_id:t.token_id,to_token_id:n.token_id,amount_in:w,slippage:i,from_user_address:s,to_user_address:a,user_refund_pubkey:l,affiliate_fee_bps:c,affiliate_info:d,trade_timeout:f,script_timeout:u});return g?.({quote:N,from_token:t,to_token:n,amount_in:r}),N},enabled:h&&!!m,staleTime:Io,refetchInterval:Oo,retry:2,retryDelay:1e3})}const Gn=p.createContext(null);function Uo({children:e,value:t}){return o.jsx(Gn.Provider,{value:t,children:e})}function Je(){const e=p.useContext(Gn);if(!e)throw new Error("useWidgetConfig must be used within SwapWidget");return e}function qo({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 Go(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 Yt({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 Kn({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 Yn({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 Ko({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 Ae({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 Yo(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 Zo(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 Qo({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 Xo(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 Jo(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 es(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 ts(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 ns(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 rs({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 os({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 Zn(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 pn({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 Qn(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 Xn(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 Jn(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 er(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 tr(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 nr(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 rr(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 hn={bitcoin:Qn,solana:Xn,ethereum:Jn,base:er,arbitrum:tr,optimism:nr,bsc:rr};function ss(e){if(!e)return null;const t=e.toLowerCase().replace(/[\s_-]/g,"");return t in hn?hn[t]:t.includes("bitcoin")||t.includes("btc")?Qn:t.includes("solana")||t.includes("sol")?Xn:t.includes("ethereum")||t.includes("eth")||t.includes("erc20")?Jn:t.includes("base")?er:t.includes("arbitrum")||t.includes("arb")?tr:t.includes("optimism")||t.includes("op")?nr:t.includes("bsc")||t.includes("binance")||t.includes("bnb")?rr:null}function as(e){return e.length<=12?e:`${e.slice(0,6)}...${e.slice(-4)}`}function is({icon:e,label:t,address:n,className:r=""}){const[s,a]=p.useState(!1),l=p.useCallback(async()=>{try{await navigator.clipboard.writeText(n),a(!0),setTimeout(()=>a(!1),2e3)}catch{console.error("Failed to copy")}},[n]);return o.jsxs("div",{className:`flex items-center justify-between px-4 py-3 ${r}`,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:as(n)}),o.jsx("button",{onClick:l,className:"p-1 rounded hover:bg-[var(--optimex-surface-hover)] transition-colors",title:s?"Copied!":"Copy",children:s?o.jsx(Yt,{className:"size-4 text-[var(--optimex-success)]"}):o.jsx(Yo,{className:"size-4 text-[var(--optimex-text-secondary)]"})})]})]})}const ls={primary:"bg-[var(--optimex-primary)] text-black hover:bg-[var(--optimex-primary-hover)] hover:brightness-110 shadow-lg shadow-[var(--optimex-primary)]/30",secondary:"bg-[var(--optimex-surface)] text-[var(--optimex-text)] hover:bg-[var(--optimex-surface-hover)] border border-[var(--optimex-border)]",ghost:"bg-transparent text-[var(--optimex-text-secondary)] hover:bg-[var(--optimex-surface-hover)] 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"},cs={sm:"px-3 py-1.5 text-xs rounded-md gap-1.5 max-h-[2rem]",md:"px-4 py-2 text-sm rounded-md gap-2 max-h-[2.5rem]",lg:"px-6 py-3 text-sm rounded-md gap-2 max-h-[3rem]"};function or({variant:e="primary",size:t="md",fullWidth:n=!1,isLoading:r=!1,leftIcon:s,rightIcon:a,children:l,className:i="",disabled:c,...d}){const f=c||r;return o.jsxs("button",{className:`
3
3
  group flex items-center justify-center font-semibold transition-all active:scale-[0.98]
4
4
  ${ls[e]}
5
5
  ${cs[t]}
6
6
  ${n?"w-full":""}
7
- ${u?"cursor-not-allowed opacity-50":""}
7
+ ${f?"cursor-not-allowed opacity-50":""}
8
8
  ${i}
9
- `,disabled:u,...d,children:[r&&o.jsx(ds,{size:t}),!r&&s&&o.jsx("span",{className:"shrink-0",children:s}),l,!r&&a&&o.jsx("span",{className:"shrink-0",children:a})]})}function ds({size:e}){const t=e==="sm"?"h-4 w-4":"h-5 w-5";return o.jsx("div",{className:`${t} animate-spin rounded-full border-2 border-current border-t-transparent`})}function sr(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=sr(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function us(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=sr(e))&&(r&&(r+=" "),r+=t);return r}const fs=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},ms=(e,t)=>({classGroupId:e,validator:t}),ar=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),pt="-",xn=[],ps="arbitrary..",hs=e=>{const t=gs(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return xs(l);const i=l.split(pt),c=i[0]===""&&i.length>1?1:0;return ir(i,c,t)},getConflictingClassGroupIds:(l,i)=>{if(i){const c=r[l],d=n[l];return c?d?fs(d,c):c:d||xn}return n[l]||xn}}},ir=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const s=e[t],a=n.nextPart.get(s);if(a){const d=ir(e,t+1,a);if(d)return d}const l=n.validators;if(l===null)return;const i=t===0?e.join(pt):e.slice(t).join(pt),c=l.length;for(let d=0;d<c;d++){const u=l[d];if(u.validator(i))return u.classGroupId}},xs=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?ps+r:void 0})(),gs=e=>{const{theme:t,classGroups:n}=e;return vs(n,t)},vs=(e,t)=>{const n=ar();for(const r in e){const s=e[r];Zt(s,n,r,t)}return n},Zt=(e,t,n,r)=>{const s=e.length;for(let a=0;a<s;a++){const l=e[a];ws(l,t,n,r)}},ws=(e,t,n,r)=>{if(typeof e=="string"){bs(e,t,n);return}if(typeof e=="function"){ys(e,t,n,r);return}Cs(e,t,n,r)},bs=(e,t,n)=>{const r=e===""?t:lr(t,e);r.classGroupId=n},ys=(e,t,n,r)=>{if(ks(e)){Zt(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(ms(n,e))},Cs=(e,t,n,r)=>{const s=Object.entries(e),a=s.length;for(let l=0;l<a;l++){const[i,c]=s[l];Zt(c,lr(t,i),n,r)}},lr=(e,t)=>{let n=e;const r=t.split(pt),s=r.length;for(let a=0;a<s;a++){const l=r[a];let i=n.nextPart.get(l);i||(i=ar(),n.nextPart.set(l,i)),n=i}return n},ks=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,js=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const s=(a,l)=>{n[a]=l,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(a){let l=n[a];if(l!==void 0)return l;if((l=r[a])!==void 0)return s(a,l),l},set(a,l){a in n?n[a]=l:s(a,l)}}},zt="!",gn=":",Ns=[],vn=(e,t,n,r,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),Ss=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=s=>{const a=[];let l=0,i=0,c=0,d;const u=s.length;for(let m=0;m<u;m++){const y=s[m];if(l===0&&i===0){if(y===gn){a.push(s.slice(c,m)),c=m+1;continue}if(y==="/"){d=m;continue}}y==="["?l++:y==="]"?l--:y==="("?i++:y===")"&&i--}const f=a.length===0?s:s.slice(c);let x=f,v=!1;f.endsWith(zt)?(x=f.slice(0,-1),v=!0):f.startsWith(zt)&&(x=f.slice(1),v=!0);const w=d&&d>c?d-c:void 0;return vn(a,v,x,w)};if(t){const s=t+gn,a=r;r=l=>l.startsWith(s)?a(l.slice(s.length)):vn(Ns,!1,l,void 0,!0)}if(n){const s=r;r=a=>n({className:a,parseClassName:s})}return r},Es=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let a=0;a<n.length;a++){const l=n[a],i=l[0]==="[",c=t.has(l);i||c?(s.length>0&&(s.sort(),r.push(...s),s=[]),r.push(l)):s.push(l)}return s.length>0&&(s.sort(),r.push(...s)),r}},Ts=e=>({cache:js(e.cacheSize),parseClassName:Ss(e),sortModifiers:Es(e),...hs(e)}),_s=/\s+/,Rs=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:a}=t,l=[],i=e.trim().split(_s);let c="";for(let d=i.length-1;d>=0;d-=1){const u=i[d],{isExternal:f,modifiers:x,hasImportantModifier:v,baseClassName:w,maybePostfixModifierPosition:m}=n(u);if(f){c=u+(c.length>0?" "+c:c);continue}let y=!!m,g=r(y?w.substring(0,m):w);if(!g){if(!y){c=u+(c.length>0?" "+c:c);continue}if(g=r(w),!g){c=u+(c.length>0?" "+c:c);continue}y=!1}const k=x.length===0?"":x.length===1?x[0]:a(x).join(":"),N=v?k+zt:k,b=N+g;if(l.indexOf(b)>-1)continue;l.push(b);const A=s(g,y);for(let I=0;I<A.length;++I){const j=A[I];l.push(N+j)}c=u+(c.length>0?" "+c:c)}return c},As=(...e)=>{let t=0,n,r,s="";for(;t<e.length;)(n=e[t++])&&(r=cr(n))&&(s&&(s+=" "),s+=r);return s},cr=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=cr(e[r]))&&(n&&(n+=" "),n+=t);return n},Ms=(e,...t)=>{let n,r,s,a;const l=c=>{const d=t.reduce((u,f)=>f(u),e());return n=Ts(d),r=n.cache.get,s=n.cache.set,a=i,i(c)},i=c=>{const d=r(c);if(d)return d;const u=Rs(c,n);return s(c,u),u};return a=l,(...c)=>a(As(...c))},Ls=[],J=e=>{const t=n=>n[e]||Ls;return t.isThemeGetter=!0,t},dr=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ur=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Ps=/^\d+\/\d+$/,Os=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Is=/\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$/,Ds=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,$s=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Fs=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ie=e=>Ps.test(e),O=e=>!!e&&!Number.isNaN(Number(e)),be=e=>!!e&&Number.isInteger(Number(e)),jt=e=>e.endsWith("%")&&O(e.slice(0,-1)),me=e=>Os.test(e),Bs=()=>!0,zs=e=>Is.test(e)&&!Ds.test(e),fr=()=>!1,Vs=e=>$s.test(e),Ws=e=>Fs.test(e),Hs=e=>!E(e)&&!T(e),Us=e=>We(e,hr,fr),E=e=>dr.test(e),Te=e=>We(e,xr,zs),Nt=e=>We(e,Zs,O),wn=e=>We(e,mr,fr),qs=e=>We(e,pr,Ws),rt=e=>We(e,gr,Vs),T=e=>ur.test(e),Ke=e=>He(e,xr),Gs=e=>He(e,Qs),bn=e=>He(e,mr),Ks=e=>He(e,hr),Ys=e=>He(e,pr),ot=e=>He(e,gr,!0),We=(e,t,n)=>{const r=dr.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},He=(e,t,n=!1)=>{const r=ur.exec(e);return r?r[1]?t(r[1]):n:!1},mr=e=>e==="position"||e==="percentage",pr=e=>e==="image"||e==="url",hr=e=>e==="length"||e==="size"||e==="bg-size",xr=e=>e==="length",Zs=e=>e==="number",Qs=e=>e==="family-name",gr=e=>e==="shadow",Xs=()=>{const e=J("color"),t=J("font"),n=J("text"),r=J("font-weight"),s=J("tracking"),a=J("leading"),l=J("breakpoint"),i=J("container"),c=J("spacing"),d=J("radius"),u=J("shadow"),f=J("inset-shadow"),x=J("text-shadow"),v=J("drop-shadow"),w=J("blur"),m=J("perspective"),y=J("aspect"),g=J("ease"),k=J("animate"),N=()=>["auto","avoid","all","avoid-page","page","left","right","column"],b=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],A=()=>[...b(),T,E],I=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto","contain","none"],C=()=>[T,E,c],R=()=>[Ie,"full","auto",...C()],B=()=>[be,"none","subgrid",T,E],L=()=>["auto",{span:["full",be,T,E]},be,T,E],D=()=>[be,"auto",T,E],_=()=>["auto","min","max","fr",T,E],V=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],W=()=>["start","end","center","stretch","center-safe","end-safe"],G=()=>["auto",...C()],H=()=>[Ie,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...C()],S=()=>[e,T,E],ne=()=>[...b(),bn,wn,{position:[T,E]}],oe=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Ne=()=>["auto","cover","contain",Ks,Us,{size:[T,E]}],ue=()=>[jt,Ke,Te],U=()=>["","none","full",d,T,E],Q=()=>["",O,Ke,Te],ie=()=>["solid","dashed","dotted","double"],he=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],$=()=>[O,jt,bn,wn],fe=()=>["","none",w,T,E],xe=()=>["none",O,T,E],ge=()=>["none",O,T,E],le=()=>[O,T,E],Se=()=>[Ie,"full",...C()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[me],breakpoint:[me],color:[Bs],container:[me],"drop-shadow":[me],ease:["in","out","in-out"],font:[Hs],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[me],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[me],shadow:[me],spacing:["px",O],text:[me],"text-shadow":[me],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ie,E,T,y]}],container:["container"],columns:[{columns:[O,E,T,i]}],"break-after":[{"break-after":N()}],"break-before":[{"break-before":N()}],"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:I()}],"overflow-x":[{"overflow-x":I()}],"overflow-y":[{"overflow-y":I()}],overscroll:[{overscroll:j()}],"overscroll-x":[{"overscroll-x":j()}],"overscroll-y":[{"overscroll-y":j()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:R()}],"inset-x":[{"inset-x":R()}],"inset-y":[{"inset-y":R()}],start:[{start:R()}],end:[{end:R()}],top:[{top:R()}],right:[{right:R()}],bottom:[{bottom:R()}],left:[{left:R()}],visibility:["visible","invisible","collapse"],z:[{z:[be,"auto",T,E]}],basis:[{basis:[Ie,"full","auto",i,...C()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[O,Ie,"auto","initial","none",E]}],grow:[{grow:["",O,T,E]}],shrink:[{shrink:["",O,T,E]}],order:[{order:[be,"first","last","none",T,E]}],"grid-cols":[{"grid-cols":B()}],"col-start-end":[{col:L()}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":B()}],"row-start-end":[{row:L()}],"row-start":[{"row-start":D()}],"row-end":[{"row-end":D()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":_()}],"auto-rows":[{"auto-rows":_()}],gap:[{gap:C()}],"gap-x":[{"gap-x":C()}],"gap-y":[{"gap-y":C()}],"justify-content":[{justify:[...V(),"normal"]}],"justify-items":[{"justify-items":[...W(),"normal"]}],"justify-self":[{"justify-self":["auto",...W()]}],"align-content":[{content:["normal",...V()]}],"align-items":[{items:[...W(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...W(),{baseline:["","last"]}]}],"place-content":[{"place-content":V()}],"place-items":[{"place-items":[...W(),"baseline"]}],"place-self":[{"place-self":["auto",...W()]}],p:[{p:C()}],px:[{px:C()}],py:[{py:C()}],ps:[{ps:C()}],pe:[{pe:C()}],pt:[{pt:C()}],pr:[{pr:C()}],pb:[{pb:C()}],pl:[{pl:C()}],m:[{m:G()}],mx:[{mx:G()}],my:[{my:G()}],ms:[{ms:G()}],me:[{me:G()}],mt:[{mt:G()}],mr:[{mr:G()}],mb:[{mb:G()}],ml:[{ml:G()}],"space-x":[{"space-x":C()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":C()}],"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",n,Ke,Te]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,T,Nt]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",jt,E]}],"font-family":[{font:[Gs,E,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,T,E]}],"line-clamp":[{"line-clamp":[O,"none",T,Nt]}],leading:[{leading:[a,...C()]}],"list-image":[{"list-image":["none",T,E]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",T,E]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:S()}],"text-color":[{text:S()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ie(),"wavy"]}],"text-decoration-thickness":[{decoration:[O,"from-font","auto",T,Te]}],"text-decoration-color":[{decoration:S()}],"underline-offset":[{"underline-offset":[O,"auto",T,E]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:C()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",T,E]}],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",T,E]}],"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:oe()}],"bg-size":[{bg:Ne()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},be,T,E],radial:["",T,E],conic:[be,T,E]},Ys,qs]}],"bg-color":[{bg:S()}],"gradient-from-pos":[{from:ue()}],"gradient-via-pos":[{via:ue()}],"gradient-to-pos":[{to:ue()}],"gradient-from":[{from:S()}],"gradient-via":[{via:S()}],"gradient-to":[{to:S()}],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:Q()}],"border-w-x":[{"border-x":Q()}],"border-w-y":[{"border-y":Q()}],"border-w-s":[{"border-s":Q()}],"border-w-e":[{"border-e":Q()}],"border-w-t":[{"border-t":Q()}],"border-w-r":[{"border-r":Q()}],"border-w-b":[{"border-b":Q()}],"border-w-l":[{"border-l":Q()}],"divide-x":[{"divide-x":Q()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Q()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ie(),"hidden","none"]}],"divide-style":[{divide:[...ie(),"hidden","none"]}],"border-color":[{border:S()}],"border-color-x":[{"border-x":S()}],"border-color-y":[{"border-y":S()}],"border-color-s":[{"border-s":S()}],"border-color-e":[{"border-e":S()}],"border-color-t":[{"border-t":S()}],"border-color-r":[{"border-r":S()}],"border-color-b":[{"border-b":S()}],"border-color-l":[{"border-l":S()}],"divide-color":[{divide:S()}],"outline-style":[{outline:[...ie(),"none","hidden"]}],"outline-offset":[{"outline-offset":[O,T,E]}],"outline-w":[{outline:["",O,Ke,Te]}],"outline-color":[{outline:S()}],shadow:[{shadow:["","none",u,ot,rt]}],"shadow-color":[{shadow:S()}],"inset-shadow":[{"inset-shadow":["none",f,ot,rt]}],"inset-shadow-color":[{"inset-shadow":S()}],"ring-w":[{ring:Q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:S()}],"ring-offset-w":[{"ring-offset":[O,Te]}],"ring-offset-color":[{"ring-offset":S()}],"inset-ring-w":[{"inset-ring":Q()}],"inset-ring-color":[{"inset-ring":S()}],"text-shadow":[{"text-shadow":["none",x,ot,rt]}],"text-shadow-color":[{"text-shadow":S()}],opacity:[{opacity:[O,T,E]}],"mix-blend":[{"mix-blend":[...he(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":he()}],"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":[O]}],"mask-image-linear-from-pos":[{"mask-linear-from":$()}],"mask-image-linear-to-pos":[{"mask-linear-to":$()}],"mask-image-linear-from-color":[{"mask-linear-from":S()}],"mask-image-linear-to-color":[{"mask-linear-to":S()}],"mask-image-t-from-pos":[{"mask-t-from":$()}],"mask-image-t-to-pos":[{"mask-t-to":$()}],"mask-image-t-from-color":[{"mask-t-from":S()}],"mask-image-t-to-color":[{"mask-t-to":S()}],"mask-image-r-from-pos":[{"mask-r-from":$()}],"mask-image-r-to-pos":[{"mask-r-to":$()}],"mask-image-r-from-color":[{"mask-r-from":S()}],"mask-image-r-to-color":[{"mask-r-to":S()}],"mask-image-b-from-pos":[{"mask-b-from":$()}],"mask-image-b-to-pos":[{"mask-b-to":$()}],"mask-image-b-from-color":[{"mask-b-from":S()}],"mask-image-b-to-color":[{"mask-b-to":S()}],"mask-image-l-from-pos":[{"mask-l-from":$()}],"mask-image-l-to-pos":[{"mask-l-to":$()}],"mask-image-l-from-color":[{"mask-l-from":S()}],"mask-image-l-to-color":[{"mask-l-to":S()}],"mask-image-x-from-pos":[{"mask-x-from":$()}],"mask-image-x-to-pos":[{"mask-x-to":$()}],"mask-image-x-from-color":[{"mask-x-from":S()}],"mask-image-x-to-color":[{"mask-x-to":S()}],"mask-image-y-from-pos":[{"mask-y-from":$()}],"mask-image-y-to-pos":[{"mask-y-to":$()}],"mask-image-y-from-color":[{"mask-y-from":S()}],"mask-image-y-to-color":[{"mask-y-to":S()}],"mask-image-radial":[{"mask-radial":[T,E]}],"mask-image-radial-from-pos":[{"mask-radial-from":$()}],"mask-image-radial-to-pos":[{"mask-radial-to":$()}],"mask-image-radial-from-color":[{"mask-radial-from":S()}],"mask-image-radial-to-color":[{"mask-radial-to":S()}],"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":b()}],"mask-image-conic-pos":[{"mask-conic":[O]}],"mask-image-conic-from-pos":[{"mask-conic-from":$()}],"mask-image-conic-to-pos":[{"mask-conic-to":$()}],"mask-image-conic-from-color":[{"mask-conic-from":S()}],"mask-image-conic-to-color":[{"mask-conic-to":S()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ne()}],"mask-repeat":[{mask:oe()}],"mask-size":[{mask:Ne()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",T,E]}],filter:[{filter:["","none",T,E]}],blur:[{blur:fe()}],brightness:[{brightness:[O,T,E]}],contrast:[{contrast:[O,T,E]}],"drop-shadow":[{"drop-shadow":["","none",v,ot,rt]}],"drop-shadow-color":[{"drop-shadow":S()}],grayscale:[{grayscale:["",O,T,E]}],"hue-rotate":[{"hue-rotate":[O,T,E]}],invert:[{invert:["",O,T,E]}],saturate:[{saturate:[O,T,E]}],sepia:[{sepia:["",O,T,E]}],"backdrop-filter":[{"backdrop-filter":["","none",T,E]}],"backdrop-blur":[{"backdrop-blur":fe()}],"backdrop-brightness":[{"backdrop-brightness":[O,T,E]}],"backdrop-contrast":[{"backdrop-contrast":[O,T,E]}],"backdrop-grayscale":[{"backdrop-grayscale":["",O,T,E]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[O,T,E]}],"backdrop-invert":[{"backdrop-invert":["",O,T,E]}],"backdrop-opacity":[{"backdrop-opacity":[O,T,E]}],"backdrop-saturate":[{"backdrop-saturate":[O,T,E]}],"backdrop-sepia":[{"backdrop-sepia":["",O,T,E]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":C()}],"border-spacing-x":[{"border-spacing-x":C()}],"border-spacing-y":[{"border-spacing-y":C()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",T,E]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[O,"initial",T,E]}],ease:[{ease:["linear","initial",g,T,E]}],delay:[{delay:[O,T,E]}],animate:[{animate:["none",k,T,E]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,T,E]}],"perspective-origin":[{"perspective-origin":A()}],rotate:[{rotate:xe()}],"rotate-x":[{"rotate-x":xe()}],"rotate-y":[{"rotate-y":xe()}],"rotate-z":[{"rotate-z":xe()}],scale:[{scale:ge()}],"scale-x":[{"scale-x":ge()}],"scale-y":[{"scale-y":ge()}],"scale-z":[{"scale-z":ge()}],"scale-3d":["scale-3d"],skew:[{skew:le()}],"skew-x":[{"skew-x":le()}],"skew-y":[{"skew-y":le()}],transform:[{transform:[T,E,"","none","gpu","cpu"]}],"transform-origin":[{origin:A()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Se()}],"translate-x":[{"translate-x":Se()}],"translate-y":[{"translate-y":Se()}],"translate-z":[{"translate-z":Se()}],"translate-none":["translate-none"],accent:[{accent:S()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:S()}],"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",T,E]}],"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":C()}],"scroll-mx":[{"scroll-mx":C()}],"scroll-my":[{"scroll-my":C()}],"scroll-ms":[{"scroll-ms":C()}],"scroll-me":[{"scroll-me":C()}],"scroll-mt":[{"scroll-mt":C()}],"scroll-mr":[{"scroll-mr":C()}],"scroll-mb":[{"scroll-mb":C()}],"scroll-ml":[{"scroll-ml":C()}],"scroll-p":[{"scroll-p":C()}],"scroll-px":[{"scroll-px":C()}],"scroll-py":[{"scroll-py":C()}],"scroll-ps":[{"scroll-ps":C()}],"scroll-pe":[{"scroll-pe":C()}],"scroll-pt":[{"scroll-pt":C()}],"scroll-pr":[{"scroll-pr":C()}],"scroll-pb":[{"scroll-pb":C()}],"scroll-pl":[{"scroll-pl":C()}],"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",T,E]}],fill:[{fill:["none",...S()]}],"stroke-w":[{stroke:[O,Ke,Te,Nt]}],stroke:[{stroke:["none",...S()]}],"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"]}},Js=Ms(Xs);function vr(...e){return Js(us(e))}function ea({state:e,onConfirm:t,confirmText:n="Confirm",processingText:r="Processing...",successText:s="Done",errorText:a="Retry"}){const l=e==="processing",i=()=>{switch(e){case"processing":return r;case"success":return s;case"error":return a;default:return n}};return o.jsx(or,{variant:"primary",size:"lg",fullWidth:!0,onClick:t,isLoading:l,children:i()})}function Ce(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e?.(s),n===!1||!s.defaultPrevented)return t?.(s)}}function yn(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function wr(...e){return t=>{let n=!1;const r=e.map(s=>{const a=yn(s,t);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let s=0;s<r.length;s++){const a=r[s];typeof a=="function"?a():yn(e[s],null)}}}}function Pe(...e){return h.useCallback(wr(...e),e)}function ta(e,t){const n=h.createContext(t),r=a=>{const{children:l,...i}=a,c=h.useMemo(()=>i,Object.values(i));return o.jsx(n.Provider,{value:c,children:l})};r.displayName=e+"Provider";function s(a){const l=h.useContext(n);if(l)return l;if(t!==void 0)return t;throw new Error(`\`${a}\` must be used within \`${e}\``)}return[r,s]}function na(e,t=[]){let n=[];function r(a,l){const i=h.createContext(l),c=n.length;n=[...n,l];const d=f=>{const{scope:x,children:v,...w}=f,m=x?.[e]?.[c]||i,y=h.useMemo(()=>w,Object.values(w));return o.jsx(m.Provider,{value:y,children:v})};d.displayName=a+"Provider";function u(f,x){const v=x?.[e]?.[c]||i,w=h.useContext(v);if(w)return w;if(l!==void 0)return l;throw new Error(`\`${f}\` must be used within \`${a}\``)}return[d,u]}const s=()=>{const a=n.map(l=>h.createContext(l));return function(i){const c=i?.[e]||a;return h.useMemo(()=>({[`__scope${e}`]:{...i,[e]:c}}),[i,c])}};return s.scopeName=e,[r,ra(s,...t)]}function ra(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(a){const l=r.reduce((i,{useScope:c,scopeName:d})=>{const f=c(a)[`__scope${d}`];return{...i,...f}},{});return h.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])}};return n.scopeName=t.scopeName,n}var Qe=globalThis?.document?h.useLayoutEffect:()=>{},oa=h[" useId ".trim().toString()]||(()=>{}),sa=0;function St(e){const[t,n]=h.useState(oa());return Qe(()=>{n(r=>r??String(sa++))},[e]),e||(t?`radix-${t}`:"")}var aa=h[" useInsertionEffect ".trim().toString()]||Qe;function ia({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,a,l]=la({defaultProp:t,onChange:n}),i=e!==void 0,c=i?e:s;{const u=h.useRef(e!==void 0);h.useEffect(()=>{const f=u.current;f!==i&&console.warn(`${r} 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.`),u.current=i},[i,r])}const d=h.useCallback(u=>{if(i){const f=ca(u)?u(e):u;f!==e&&l.current?.(f)}else a(u)},[i,e,a,l]);return[c,d]}function la({defaultProp:e,onChange:t}){const[n,r]=h.useState(e),s=h.useRef(n),a=h.useRef(t);return aa(()=>{a.current=t},[t]),h.useEffect(()=>{s.current!==n&&(a.current?.(n),s.current=n)},[n,s]),[n,r,a]}function ca(e){return typeof e=="function"}function br(e){const t=da(e),n=h.forwardRef((r,s)=>{const{children:a,...l}=r,i=h.Children.toArray(a),c=i.find(fa);if(c){const d=c.props.children,u=i.map(f=>f===c?h.Children.count(d)>1?h.Children.only(null):h.isValidElement(d)?d.props.children:null:f);return o.jsx(t,{...l,ref:s,children:h.isValidElement(d)?h.cloneElement(d,void 0,u):null})}return o.jsx(t,{...l,ref:s,children:a})});return n.displayName=`${e}.Slot`,n}function da(e){const t=h.forwardRef((n,r)=>{const{children:s,...a}=n;if(h.isValidElement(s)){const l=pa(s),i=ma(a,s.props);return s.type!==h.Fragment&&(i.ref=r?wr(r,l):l),h.cloneElement(s,i)}return h.Children.count(s)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ua=Symbol("radix.slottable");function fa(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ua}function ma(e,t){const n={...t};for(const r in t){const s=e[r],a=t[r];/^on[A-Z]/.test(r)?s&&a?n[r]=(...i)=>{const c=a(...i);return s(...i),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...a}:r==="className"&&(n[r]=[s,a].filter(Boolean).join(" "))}return{...e,...n}}function pa(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var ha=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],pe=ha.reduce((e,t)=>{const n=br(`Primitive.${t}`),r=h.forwardRef((s,a)=>{const{asChild:l,...i}=s,c=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...i,ref:a})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function xa(e,t){e&&To.flushSync(()=>e.dispatchEvent(t))}function Xe(e){const t=h.useRef(e);return h.useEffect(()=>{t.current=e}),h.useMemo(()=>(...n)=>t.current?.(...n),[])}function ga(e,t=globalThis?.document){const n=Xe(e);h.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var va="DismissableLayer",Vt="dismissableLayer.update",wa="dismissableLayer.pointerDownOutside",ba="dismissableLayer.focusOutside",Cn,yr=h.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Cr=h.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:a,onInteractOutside:l,onDismiss:i,...c}=e,d=h.useContext(yr),[u,f]=h.useState(null),x=u?.ownerDocument??globalThis?.document,[,v]=h.useState({}),w=Pe(t,j=>f(j)),m=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),g=m.indexOf(y),k=u?m.indexOf(u):-1,N=d.layersWithOutsidePointerEventsDisabled.size>0,b=k>=g,A=ka(j=>{const C=j.target,R=[...d.branches].some(B=>B.contains(C));!b||R||(s?.(j),l?.(j),j.defaultPrevented||i?.())},x),I=ja(j=>{const C=j.target;[...d.branches].some(B=>B.contains(C))||(a?.(j),l?.(j),j.defaultPrevented||i?.())},x);return ga(j=>{k===d.layers.size-1&&(r?.(j),!j.defaultPrevented&&i&&(j.preventDefault(),i()))},x),h.useEffect(()=>{if(u)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(Cn=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(u)),d.layers.add(u),kn(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(x.body.style.pointerEvents=Cn)}},[u,x,n,d]),h.useEffect(()=>()=>{u&&(d.layers.delete(u),d.layersWithOutsidePointerEventsDisabled.delete(u),kn())},[u,d]),h.useEffect(()=>{const j=()=>v({});return document.addEventListener(Vt,j),()=>document.removeEventListener(Vt,j)},[]),o.jsx(pe.div,{...c,ref:w,style:{pointerEvents:N?b?"auto":"none":void 0,...e.style},onFocusCapture:Ce(e.onFocusCapture,I.onFocusCapture),onBlurCapture:Ce(e.onBlurCapture,I.onBlurCapture),onPointerDownCapture:Ce(e.onPointerDownCapture,A.onPointerDownCapture)})});Cr.displayName=va;var ya="DismissableLayerBranch",Ca=h.forwardRef((e,t)=>{const n=h.useContext(yr),r=h.useRef(null),s=Pe(t,r);return h.useEffect(()=>{const a=r.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),o.jsx(pe.div,{...e,ref:s})});Ca.displayName=ya;function ka(e,t=globalThis?.document){const n=Xe(e),r=h.useRef(!1),s=h.useRef(()=>{});return h.useEffect(()=>{const a=i=>{if(i.target&&!r.current){let c=function(){kr(wa,n,d,{discrete:!0})};const d={originalEvent:i};i.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=c,t.addEventListener("click",s.current,{once:!0})):c()}else t.removeEventListener("click",s.current);r.current=!1},l=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(l),t.removeEventListener("pointerdown",a),t.removeEventListener("click",s.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function ja(e,t=globalThis?.document){const n=Xe(e),r=h.useRef(!1);return h.useEffect(()=>{const s=a=>{a.target&&!r.current&&kr(ba,n,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function kn(){const e=new CustomEvent(Vt);document.dispatchEvent(e)}function kr(e,t,n,{discrete:r}){const s=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?xa(s,a):s.dispatchEvent(a)}var Et="focusScope.autoFocusOnMount",Tt="focusScope.autoFocusOnUnmount",jn={bubbles:!1,cancelable:!0},Na="FocusScope",jr=h.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:a,...l}=e,[i,c]=h.useState(null),d=Xe(s),u=Xe(a),f=h.useRef(null),x=Pe(t,m=>c(m)),v=h.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;h.useEffect(()=>{if(r){let m=function(N){if(v.paused||!i)return;const b=N.target;i.contains(b)?f.current=b:ye(f.current,{select:!0})},y=function(N){if(v.paused||!i)return;const b=N.relatedTarget;b!==null&&(i.contains(b)||ye(f.current,{select:!0}))},g=function(N){if(document.activeElement===document.body)for(const A of N)A.removedNodes.length>0&&ye(i)};document.addEventListener("focusin",m),document.addEventListener("focusout",y);const k=new MutationObserver(g);return i&&k.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",y),k.disconnect()}}},[r,i,v.paused]),h.useEffect(()=>{if(i){Sn.add(v);const m=document.activeElement;if(!i.contains(m)){const g=new CustomEvent(Et,jn);i.addEventListener(Et,d),i.dispatchEvent(g),g.defaultPrevented||(Sa(Aa(Nr(i)),{select:!0}),document.activeElement===m&&ye(i))}return()=>{i.removeEventListener(Et,d),setTimeout(()=>{const g=new CustomEvent(Tt,jn);i.addEventListener(Tt,u),i.dispatchEvent(g),g.defaultPrevented||ye(m??document.body,{select:!0}),i.removeEventListener(Tt,u),Sn.remove(v)},0)}}},[i,d,u,v]);const w=h.useCallback(m=>{if(!n&&!r||v.paused)return;const y=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,g=document.activeElement;if(y&&g){const k=m.currentTarget,[N,b]=Ea(k);N&&b?!m.shiftKey&&g===b?(m.preventDefault(),n&&ye(N,{select:!0})):m.shiftKey&&g===N&&(m.preventDefault(),n&&ye(b,{select:!0})):g===k&&m.preventDefault()}},[n,r,v.paused]);return o.jsx(pe.div,{tabIndex:-1,...l,ref:x,onKeyDown:w})});jr.displayName=Na;function Sa(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(ye(r,{select:t}),document.activeElement!==n)return}function Ea(e){const t=Nr(e),n=Nn(t,e),r=Nn(t.reverse(),e);return[n,r]}function Nr(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Nn(e,t){for(const n of e)if(!Ta(n,{upTo:t}))return n}function Ta(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 _a(e){return e instanceof HTMLInputElement&&"select"in e}function ye(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&_a(e)&&t&&e.select()}}var Sn=Ra();function Ra(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=En(e,t),e.unshift(t)},remove(t){e=En(e,t),e[0]?.resume()}}}function En(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Aa(e){return e.filter(t=>t.tagName!=="A")}var Ma="Portal",Sr=h.forwardRef((e,t)=>{const{container:n,...r}=e,[s,a]=h.useState(!1);Qe(()=>a(!0),[]);const l=n||s&&globalThis?.document?.body;return l?Vn.createPortal(o.jsx(pe.div,{...r,ref:t}),l):null});Sr.displayName=Ma;function La(e,t){return h.useReducer((n,r)=>t[n][r]??n,e)}var gt=e=>{const{present:t,children:n}=e,r=Pa(t),s=typeof n=="function"?n({present:r.isPresent}):h.Children.only(n),a=Pe(r.ref,Oa(s));return typeof n=="function"||r.isPresent?h.cloneElement(s,{ref:a}):null};gt.displayName="Presence";function Pa(e){const[t,n]=h.useState(),r=h.useRef(null),s=h.useRef(e),a=h.useRef("none"),l=e?"mounted":"unmounted",[i,c]=La(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return h.useEffect(()=>{const d=st(r.current);a.current=i==="mounted"?d:"none"},[i]),Qe(()=>{const d=r.current,u=s.current;if(u!==e){const x=a.current,v=st(d);e?c("MOUNT"):v==="none"||d?.display==="none"?c("UNMOUNT"):c(u&&x!==v?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,c]),Qe(()=>{if(t){let d;const u=t.ownerDocument.defaultView??window,f=v=>{const m=st(r.current).includes(CSS.escape(v.animationName));if(v.target===t&&m&&(c("ANIMATION_END"),!s.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",d=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},x=v=>{v.target===t&&(a.current=st(r.current))};return t.addEventListener("animationstart",x),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{u.clearTimeout(d),t.removeEventListener("animationstart",x),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:h.useCallback(d=>{r.current=d?getComputedStyle(d):null,n(d)},[])}}function st(e){return e?.animationName||"none"}function Oa(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var _t=0;function Ia(){h.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Tn()),document.body.insertAdjacentElement("beforeend",e[1]??Tn()),_t++,()=>{_t===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),_t--}},[])}function Tn(){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 de=function(){return de=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},de.apply(this,arguments)};function Er(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}function Da(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,a;r<s;r++)(a||!(r in t))&&(a||(a=Array.prototype.slice.call(t,0,r)),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var ft="right-scroll-bar-position",mt="width-before-scroll-bar",$a="with-scroll-bars-hidden",Fa="--removed-body-scroll-bar-size";function Rt(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Ba(e,t){var n=p.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=t,n.facade}var za=typeof window<"u"?h.useLayoutEffect:h.useEffect,_n=new WeakMap;function Va(e,t){var n=Ba(null,function(r){return e.forEach(function(s){return Rt(s,r)})});return za(function(){var r=_n.get(n);if(r){var s=new Set(r),a=new Set(e),l=n.current;s.forEach(function(i){a.has(i)||Rt(i,null)}),a.forEach(function(i){s.has(i)||Rt(i,l)})}_n.set(n,e)},[e]),n}function Wa(e){return e}function Ha(e,t){t===void 0&&(t=Wa);var n=[],r=!1,s={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(a){var l=t(a,r);return n.push(l),function(){n=n.filter(function(i){return i!==l})}},assignSyncMedium:function(a){for(r=!0;n.length;){var l=n;n=[],l.forEach(a)}n={push:function(i){return a(i)},filter:function(){return n}}},assignMedium:function(a){r=!0;var l=[];if(n.length){var i=n;n=[],i.forEach(a),l=n}var c=function(){var u=l;l=[],u.forEach(a)},d=function(){return Promise.resolve().then(c)};d(),n={push:function(u){l.push(u),d()},filter:function(u){return l=l.filter(u),n}}}};return s}function Ua(e){e===void 0&&(e={});var t=Ha(null);return t.options=de({async:!0,ssr:!1},e),t}var Tr=function(e){var t=e.sideCar,n=Er(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return h.createElement(r,de({},n))};Tr.isSideCarExport=!0;function qa(e,t){return e.useMedium(t),Tr}var _r=Ua(),At=function(){},vt=h.forwardRef(function(e,t){var n=h.useRef(null),r=h.useState({onScrollCapture:At,onWheelCapture:At,onTouchMoveCapture:At}),s=r[0],a=r[1],l=e.forwardProps,i=e.children,c=e.className,d=e.removeScrollBar,u=e.enabled,f=e.shards,x=e.sideCar,v=e.noRelative,w=e.noIsolation,m=e.inert,y=e.allowPinchZoom,g=e.as,k=g===void 0?"div":g,N=e.gapMode,b=Er(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),A=x,I=Va([n,t]),j=de(de({},b),s);return h.createElement(h.Fragment,null,u&&h.createElement(A,{sideCar:_r,removeScrollBar:d,shards:f,noRelative:v,noIsolation:w,inert:m,setCallbacks:a,allowPinchZoom:!!y,lockRef:n,gapMode:N}),l?h.cloneElement(h.Children.only(i),de(de({},j),{ref:I})):h.createElement(k,de({},j,{className:c,ref:I}),i))});vt.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};vt.classNames={fullWidth:mt,zeroRight:ft};var Ga=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Ka(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Ga();return t&&e.setAttribute("nonce",t),e}function Ya(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Za(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Qa=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Ka())&&(Ya(t,n),Za(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Xa=function(){var e=Qa();return function(t,n){h.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Rr=function(){var e=Xa(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},Ja={left:0,top:0,right:0,gap:0},Mt=function(e){return parseInt(e||"",10)||0},ei=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[Mt(n),Mt(r),Mt(s)]},ti=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Ja;var t=ei(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},ni=Rr(),ze="data-scroll-locked",ri=function(e,t,n,r){var s=e.left,a=e.top,l=e.right,i=e.gap;return n===void 0&&(n="margin"),`
9
+ `,disabled:f,...d,children:[r&&o.jsx(ds,{size:t}),!r&&s&&o.jsx("span",{className:"shrink-0",children:s}),l,!r&&a&&o.jsx("span",{className:"shrink-0",children:a})]})}function ds({size:e}){const t=e==="sm"?"h-4 w-4":"h-5 w-5";return o.jsx("div",{className:`${t} animate-spin rounded-full border-2 border-current border-t-transparent`})}function sr(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=sr(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function us(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=sr(e))&&(r&&(r+=" "),r+=t);return r}const fs=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},ms=(e,t)=>({classGroupId:e,validator:t}),ar=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),pt="-",xn=[],ps="arbitrary..",hs=e=>{const t=gs(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return xs(l);const i=l.split(pt),c=i[0]===""&&i.length>1?1:0;return ir(i,c,t)},getConflictingClassGroupIds:(l,i)=>{if(i){const c=r[l],d=n[l];return c?d?fs(d,c):c:d||xn}return n[l]||xn}}},ir=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const s=e[t],a=n.nextPart.get(s);if(a){const d=ir(e,t+1,a);if(d)return d}const l=n.validators;if(l===null)return;const i=t===0?e.join(pt):e.slice(t).join(pt),c=l.length;for(let d=0;d<c;d++){const f=l[d];if(f.validator(i))return f.classGroupId}},xs=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?ps+r:void 0})(),gs=e=>{const{theme:t,classGroups:n}=e;return vs(n,t)},vs=(e,t)=>{const n=ar();for(const r in e){const s=e[r];Zt(s,n,r,t)}return n},Zt=(e,t,n,r)=>{const s=e.length;for(let a=0;a<s;a++){const l=e[a];ws(l,t,n,r)}},ws=(e,t,n,r)=>{if(typeof e=="string"){bs(e,t,n);return}if(typeof e=="function"){ys(e,t,n,r);return}Cs(e,t,n,r)},bs=(e,t,n)=>{const r=e===""?t:lr(t,e);r.classGroupId=n},ys=(e,t,n,r)=>{if(ks(e)){Zt(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(ms(n,e))},Cs=(e,t,n,r)=>{const s=Object.entries(e),a=s.length;for(let l=0;l<a;l++){const[i,c]=s[l];Zt(c,lr(t,i),n,r)}},lr=(e,t)=>{let n=e;const r=t.split(pt),s=r.length;for(let a=0;a<s;a++){const l=r[a];let i=n.nextPart.get(l);i||(i=ar(),n.nextPart.set(l,i)),n=i}return n},ks=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,js=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const s=(a,l)=>{n[a]=l,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(a){let l=n[a];if(l!==void 0)return l;if((l=r[a])!==void 0)return s(a,l),l},set(a,l){a in n?n[a]=l:s(a,l)}}},zt="!",gn=":",Ns=[],vn=(e,t,n,r,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),Ss=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=s=>{const a=[];let l=0,i=0,c=0,d;const f=s.length;for(let m=0;m<f;m++){const b=s[m];if(l===0&&i===0){if(b===gn){a.push(s.slice(c,m)),c=m+1;continue}if(b==="/"){d=m;continue}}b==="["?l++:b==="]"?l--:b==="("?i++:b===")"&&i--}const u=a.length===0?s:s.slice(c);let h=u,g=!1;u.endsWith(zt)?(h=u.slice(0,-1),g=!0):u.startsWith(zt)&&(h=u.slice(1),g=!0);const v=d&&d>c?d-c:void 0;return vn(a,g,h,v)};if(t){const s=t+gn,a=r;r=l=>l.startsWith(s)?a(l.slice(s.length)):vn(Ns,!1,l,void 0,!0)}if(n){const s=r;r=a=>n({className:a,parseClassName:s})}return r},Es=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let a=0;a<n.length;a++){const l=n[a],i=l[0]==="[",c=t.has(l);i||c?(s.length>0&&(s.sort(),r.push(...s),s=[]),r.push(l)):s.push(l)}return s.length>0&&(s.sort(),r.push(...s)),r}},Ts=e=>({cache:js(e.cacheSize),parseClassName:Ss(e),sortModifiers:Es(e),...hs(e)}),_s=/\s+/,Rs=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:a}=t,l=[],i=e.trim().split(_s);let c="";for(let d=i.length-1;d>=0;d-=1){const f=i[d],{isExternal:u,modifiers:h,hasImportantModifier:g,baseClassName:v,maybePostfixModifierPosition:m}=n(f);if(u){c=f+(c.length>0?" "+c:c);continue}let b=!!m,w=r(b?v.substring(0,m):v);if(!w){if(!b){c=f+(c.length>0?" "+c:c);continue}if(w=r(v),!w){c=f+(c.length>0?" "+c:c);continue}b=!1}const N=h.length===0?"":h.length===1?h[0]:a(h).join(":"),k=g?N+zt:N,y=k+w;if(l.indexOf(y)>-1)continue;l.push(y);const E=s(w,b);for(let P=0;P<E.length;++P){const j=E[P];l.push(k+j)}c=f+(c.length>0?" "+c:c)}return c},As=(...e)=>{let t=0,n,r,s="";for(;t<e.length;)(n=e[t++])&&(r=cr(n))&&(s&&(s+=" "),s+=r);return s},cr=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=cr(e[r]))&&(n&&(n+=" "),n+=t);return n},Ms=(e,...t)=>{let n,r,s,a;const l=c=>{const d=t.reduce((f,u)=>u(f),e());return n=Ts(d),r=n.cache.get,s=n.cache.set,a=i,i(c)},i=c=>{const d=r(c);if(d)return d;const f=Rs(c,n);return s(c,f),f};return a=l,(...c)=>a(As(...c))},Ls=[],J=e=>{const t=n=>n[e]||Ls;return t.isThemeGetter=!0,t},dr=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ur=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Ps=/^\d+\/\d+$/,Os=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Is=/\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$/,Ds=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,$s=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Fs=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ie=e=>Ps.test(e),I=e=>!!e&&!Number.isNaN(Number(e)),be=e=>!!e&&Number.isInteger(Number(e)),jt=e=>e.endsWith("%")&&I(e.slice(0,-1)),me=e=>Os.test(e),Bs=()=>!0,zs=e=>Is.test(e)&&!Ds.test(e),fr=()=>!1,Vs=e=>$s.test(e),Ws=e=>Fs.test(e),Hs=e=>!T(e)&&!_(e),Us=e=>We(e,hr,fr),T=e=>dr.test(e),Te=e=>We(e,xr,zs),Nt=e=>We(e,Zs,I),wn=e=>We(e,mr,fr),qs=e=>We(e,pr,Ws),rt=e=>We(e,gr,Vs),_=e=>ur.test(e),Ke=e=>He(e,xr),Gs=e=>He(e,Qs),bn=e=>He(e,mr),Ks=e=>He(e,hr),Ys=e=>He(e,pr),ot=e=>He(e,gr,!0),We=(e,t,n)=>{const r=dr.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},He=(e,t,n=!1)=>{const r=ur.exec(e);return r?r[1]?t(r[1]):n:!1},mr=e=>e==="position"||e==="percentage",pr=e=>e==="image"||e==="url",hr=e=>e==="length"||e==="size"||e==="bg-size",xr=e=>e==="length",Zs=e=>e==="number",Qs=e=>e==="family-name",gr=e=>e==="shadow",Xs=()=>{const e=J("color"),t=J("font"),n=J("text"),r=J("font-weight"),s=J("tracking"),a=J("leading"),l=J("breakpoint"),i=J("container"),c=J("spacing"),d=J("radius"),f=J("shadow"),u=J("inset-shadow"),h=J("text-shadow"),g=J("drop-shadow"),v=J("blur"),m=J("perspective"),b=J("aspect"),w=J("ease"),N=J("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],y=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],E=()=>[...y(),_,T],P=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto","contain","none"],C=()=>[_,T,c],R=()=>[Ie,"full","auto",...C()],B=()=>[be,"none","subgrid",_,T],L=()=>["auto",{span:["full",be,_,T]},be,_,T],D=()=>[be,"auto",_,T],A=()=>["auto","min","max","fr",_,T],V=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],W=()=>["start","end","center","stretch","center-safe","end-safe"],G=()=>["auto",...C()],H=()=>[Ie,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...C()],S=()=>[e,_,T],ne=()=>[...y(),bn,wn,{position:[_,T]}],oe=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Ne=()=>["auto","cover","contain",Ks,Us,{size:[_,T]}],ue=()=>[jt,Ke,Te],U=()=>["","none","full",d,_,T],Q=()=>["",I,Ke,Te],ie=()=>["solid","dashed","dotted","double"],he=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],$=()=>[I,jt,bn,wn],fe=()=>["","none",v,_,T],xe=()=>["none",I,_,T],ge=()=>["none",I,_,T],le=()=>[I,_,T],Se=()=>[Ie,"full",...C()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[me],breakpoint:[me],color:[Bs],container:[me],"drop-shadow":[me],ease:["in","out","in-out"],font:[Hs],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[me],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[me],shadow:[me],spacing:["px",I],text:[me],"text-shadow":[me],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ie,T,_,b]}],container:["container"],columns:[{columns:[I,T,_,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:E()}],overflow:[{overflow:P()}],"overflow-x":[{"overflow-x":P()}],"overflow-y":[{"overflow-y":P()}],overscroll:[{overscroll:j()}],"overscroll-x":[{"overscroll-x":j()}],"overscroll-y":[{"overscroll-y":j()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:R()}],"inset-x":[{"inset-x":R()}],"inset-y":[{"inset-y":R()}],start:[{start:R()}],end:[{end:R()}],top:[{top:R()}],right:[{right:R()}],bottom:[{bottom:R()}],left:[{left:R()}],visibility:["visible","invisible","collapse"],z:[{z:[be,"auto",_,T]}],basis:[{basis:[Ie,"full","auto",i,...C()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[I,Ie,"auto","initial","none",T]}],grow:[{grow:["",I,_,T]}],shrink:[{shrink:["",I,_,T]}],order:[{order:[be,"first","last","none",_,T]}],"grid-cols":[{"grid-cols":B()}],"col-start-end":[{col:L()}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":B()}],"row-start-end":[{row:L()}],"row-start":[{"row-start":D()}],"row-end":[{"row-end":D()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":A()}],"auto-rows":[{"auto-rows":A()}],gap:[{gap:C()}],"gap-x":[{"gap-x":C()}],"gap-y":[{"gap-y":C()}],"justify-content":[{justify:[...V(),"normal"]}],"justify-items":[{"justify-items":[...W(),"normal"]}],"justify-self":[{"justify-self":["auto",...W()]}],"align-content":[{content:["normal",...V()]}],"align-items":[{items:[...W(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...W(),{baseline:["","last"]}]}],"place-content":[{"place-content":V()}],"place-items":[{"place-items":[...W(),"baseline"]}],"place-self":[{"place-self":["auto",...W()]}],p:[{p:C()}],px:[{px:C()}],py:[{py:C()}],ps:[{ps:C()}],pe:[{pe:C()}],pt:[{pt:C()}],pr:[{pr:C()}],pb:[{pb:C()}],pl:[{pl:C()}],m:[{m:G()}],mx:[{mx:G()}],my:[{my:G()}],ms:[{ms:G()}],me:[{me:G()}],mt:[{mt:G()}],mr:[{mr:G()}],mb:[{mb:G()}],ml:[{ml:G()}],"space-x":[{"space-x":C()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":C()}],"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",n,Ke,Te]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,_,Nt]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",jt,T]}],"font-family":[{font:[Gs,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:[s,_,T]}],"line-clamp":[{"line-clamp":[I,"none",_,Nt]}],leading:[{leading:[a,...C()]}],"list-image":[{"list-image":["none",_,T]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",_,T]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:S()}],"text-color":[{text:S()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ie(),"wavy"]}],"text-decoration-thickness":[{decoration:[I,"from-font","auto",_,Te]}],"text-decoration-color":[{decoration:S()}],"underline-offset":[{"underline-offset":[I,"auto",_,T]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:C()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",_,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",_,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:oe()}],"bg-size":[{bg:Ne()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},be,_,T],radial:["",_,T],conic:[be,_,T]},Ys,qs]}],"bg-color":[{bg:S()}],"gradient-from-pos":[{from:ue()}],"gradient-via-pos":[{via:ue()}],"gradient-to-pos":[{to:ue()}],"gradient-from":[{from:S()}],"gradient-via":[{via:S()}],"gradient-to":[{to:S()}],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:Q()}],"border-w-x":[{"border-x":Q()}],"border-w-y":[{"border-y":Q()}],"border-w-s":[{"border-s":Q()}],"border-w-e":[{"border-e":Q()}],"border-w-t":[{"border-t":Q()}],"border-w-r":[{"border-r":Q()}],"border-w-b":[{"border-b":Q()}],"border-w-l":[{"border-l":Q()}],"divide-x":[{"divide-x":Q()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Q()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ie(),"hidden","none"]}],"divide-style":[{divide:[...ie(),"hidden","none"]}],"border-color":[{border:S()}],"border-color-x":[{"border-x":S()}],"border-color-y":[{"border-y":S()}],"border-color-s":[{"border-s":S()}],"border-color-e":[{"border-e":S()}],"border-color-t":[{"border-t":S()}],"border-color-r":[{"border-r":S()}],"border-color-b":[{"border-b":S()}],"border-color-l":[{"border-l":S()}],"divide-color":[{divide:S()}],"outline-style":[{outline:[...ie(),"none","hidden"]}],"outline-offset":[{"outline-offset":[I,_,T]}],"outline-w":[{outline:["",I,Ke,Te]}],"outline-color":[{outline:S()}],shadow:[{shadow:["","none",f,ot,rt]}],"shadow-color":[{shadow:S()}],"inset-shadow":[{"inset-shadow":["none",u,ot,rt]}],"inset-shadow-color":[{"inset-shadow":S()}],"ring-w":[{ring:Q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:S()}],"ring-offset-w":[{"ring-offset":[I,Te]}],"ring-offset-color":[{"ring-offset":S()}],"inset-ring-w":[{"inset-ring":Q()}],"inset-ring-color":[{"inset-ring":S()}],"text-shadow":[{"text-shadow":["none",h,ot,rt]}],"text-shadow-color":[{"text-shadow":S()}],opacity:[{opacity:[I,_,T]}],"mix-blend":[{"mix-blend":[...he(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":he()}],"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":[I]}],"mask-image-linear-from-pos":[{"mask-linear-from":$()}],"mask-image-linear-to-pos":[{"mask-linear-to":$()}],"mask-image-linear-from-color":[{"mask-linear-from":S()}],"mask-image-linear-to-color":[{"mask-linear-to":S()}],"mask-image-t-from-pos":[{"mask-t-from":$()}],"mask-image-t-to-pos":[{"mask-t-to":$()}],"mask-image-t-from-color":[{"mask-t-from":S()}],"mask-image-t-to-color":[{"mask-t-to":S()}],"mask-image-r-from-pos":[{"mask-r-from":$()}],"mask-image-r-to-pos":[{"mask-r-to":$()}],"mask-image-r-from-color":[{"mask-r-from":S()}],"mask-image-r-to-color":[{"mask-r-to":S()}],"mask-image-b-from-pos":[{"mask-b-from":$()}],"mask-image-b-to-pos":[{"mask-b-to":$()}],"mask-image-b-from-color":[{"mask-b-from":S()}],"mask-image-b-to-color":[{"mask-b-to":S()}],"mask-image-l-from-pos":[{"mask-l-from":$()}],"mask-image-l-to-pos":[{"mask-l-to":$()}],"mask-image-l-from-color":[{"mask-l-from":S()}],"mask-image-l-to-color":[{"mask-l-to":S()}],"mask-image-x-from-pos":[{"mask-x-from":$()}],"mask-image-x-to-pos":[{"mask-x-to":$()}],"mask-image-x-from-color":[{"mask-x-from":S()}],"mask-image-x-to-color":[{"mask-x-to":S()}],"mask-image-y-from-pos":[{"mask-y-from":$()}],"mask-image-y-to-pos":[{"mask-y-to":$()}],"mask-image-y-from-color":[{"mask-y-from":S()}],"mask-image-y-to-color":[{"mask-y-to":S()}],"mask-image-radial":[{"mask-radial":[_,T]}],"mask-image-radial-from-pos":[{"mask-radial-from":$()}],"mask-image-radial-to-pos":[{"mask-radial-to":$()}],"mask-image-radial-from-color":[{"mask-radial-from":S()}],"mask-image-radial-to-color":[{"mask-radial-to":S()}],"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":y()}],"mask-image-conic-pos":[{"mask-conic":[I]}],"mask-image-conic-from-pos":[{"mask-conic-from":$()}],"mask-image-conic-to-pos":[{"mask-conic-to":$()}],"mask-image-conic-from-color":[{"mask-conic-from":S()}],"mask-image-conic-to-color":[{"mask-conic-to":S()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ne()}],"mask-repeat":[{mask:oe()}],"mask-size":[{mask:Ne()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",_,T]}],filter:[{filter:["","none",_,T]}],blur:[{blur:fe()}],brightness:[{brightness:[I,_,T]}],contrast:[{contrast:[I,_,T]}],"drop-shadow":[{"drop-shadow":["","none",g,ot,rt]}],"drop-shadow-color":[{"drop-shadow":S()}],grayscale:[{grayscale:["",I,_,T]}],"hue-rotate":[{"hue-rotate":[I,_,T]}],invert:[{invert:["",I,_,T]}],saturate:[{saturate:[I,_,T]}],sepia:[{sepia:["",I,_,T]}],"backdrop-filter":[{"backdrop-filter":["","none",_,T]}],"backdrop-blur":[{"backdrop-blur":fe()}],"backdrop-brightness":[{"backdrop-brightness":[I,_,T]}],"backdrop-contrast":[{"backdrop-contrast":[I,_,T]}],"backdrop-grayscale":[{"backdrop-grayscale":["",I,_,T]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[I,_,T]}],"backdrop-invert":[{"backdrop-invert":["",I,_,T]}],"backdrop-opacity":[{"backdrop-opacity":[I,_,T]}],"backdrop-saturate":[{"backdrop-saturate":[I,_,T]}],"backdrop-sepia":[{"backdrop-sepia":["",I,_,T]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":C()}],"border-spacing-x":[{"border-spacing-x":C()}],"border-spacing-y":[{"border-spacing-y":C()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",_,T]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[I,"initial",_,T]}],ease:[{ease:["linear","initial",w,_,T]}],delay:[{delay:[I,_,T]}],animate:[{animate:["none",N,_,T]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,_,T]}],"perspective-origin":[{"perspective-origin":E()}],rotate:[{rotate:xe()}],"rotate-x":[{"rotate-x":xe()}],"rotate-y":[{"rotate-y":xe()}],"rotate-z":[{"rotate-z":xe()}],scale:[{scale:ge()}],"scale-x":[{"scale-x":ge()}],"scale-y":[{"scale-y":ge()}],"scale-z":[{"scale-z":ge()}],"scale-3d":["scale-3d"],skew:[{skew:le()}],"skew-x":[{"skew-x":le()}],"skew-y":[{"skew-y":le()}],transform:[{transform:[_,T,"","none","gpu","cpu"]}],"transform-origin":[{origin:E()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Se()}],"translate-x":[{"translate-x":Se()}],"translate-y":[{"translate-y":Se()}],"translate-z":[{"translate-z":Se()}],"translate-none":["translate-none"],accent:[{accent:S()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:S()}],"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",_,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":C()}],"scroll-mx":[{"scroll-mx":C()}],"scroll-my":[{"scroll-my":C()}],"scroll-ms":[{"scroll-ms":C()}],"scroll-me":[{"scroll-me":C()}],"scroll-mt":[{"scroll-mt":C()}],"scroll-mr":[{"scroll-mr":C()}],"scroll-mb":[{"scroll-mb":C()}],"scroll-ml":[{"scroll-ml":C()}],"scroll-p":[{"scroll-p":C()}],"scroll-px":[{"scroll-px":C()}],"scroll-py":[{"scroll-py":C()}],"scroll-ps":[{"scroll-ps":C()}],"scroll-pe":[{"scroll-pe":C()}],"scroll-pt":[{"scroll-pt":C()}],"scroll-pr":[{"scroll-pr":C()}],"scroll-pb":[{"scroll-pb":C()}],"scroll-pl":[{"scroll-pl":C()}],"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",_,T]}],fill:[{fill:["none",...S()]}],"stroke-w":[{stroke:[I,Ke,Te,Nt]}],stroke:[{stroke:["none",...S()]}],"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"]}},Js=Ms(Xs);function vr(...e){return Js(us(e))}function ea({state:e,onConfirm:t,confirmText:n="Confirm",processingText:r="Processing...",successText:s="Done",errorText:a="Retry"}){const l=e==="processing",i=()=>{switch(e){case"processing":return r;case"success":return s;case"error":return a;default:return n}};return o.jsx(or,{variant:"primary",size:"lg",fullWidth:!0,onClick:t,isLoading:l,children:i()})}function Ce(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e?.(s),n===!1||!s.defaultPrevented)return t?.(s)}}function yn(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function wr(...e){return t=>{let n=!1;const r=e.map(s=>{const a=yn(s,t);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let s=0;s<r.length;s++){const a=r[s];typeof a=="function"?a():yn(e[s],null)}}}}function Pe(...e){return x.useCallback(wr(...e),e)}function ta(e,t){const n=x.createContext(t),r=a=>{const{children:l,...i}=a,c=x.useMemo(()=>i,Object.values(i));return o.jsx(n.Provider,{value:c,children:l})};r.displayName=e+"Provider";function s(a){const l=x.useContext(n);if(l)return l;if(t!==void 0)return t;throw new Error(`\`${a}\` must be used within \`${e}\``)}return[r,s]}function na(e,t=[]){let n=[];function r(a,l){const i=x.createContext(l),c=n.length;n=[...n,l];const d=u=>{const{scope:h,children:g,...v}=u,m=h?.[e]?.[c]||i,b=x.useMemo(()=>v,Object.values(v));return o.jsx(m.Provider,{value:b,children:g})};d.displayName=a+"Provider";function f(u,h){const g=h?.[e]?.[c]||i,v=x.useContext(g);if(v)return v;if(l!==void 0)return l;throw new Error(`\`${u}\` must be used within \`${a}\``)}return[d,f]}const s=()=>{const a=n.map(l=>x.createContext(l));return function(i){const c=i?.[e]||a;return x.useMemo(()=>({[`__scope${e}`]:{...i,[e]:c}}),[i,c])}};return s.scopeName=e,[r,ra(s,...t)]}function ra(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(a){const l=r.reduce((i,{useScope:c,scopeName:d})=>{const u=c(a)[`__scope${d}`];return{...i,...u}},{});return x.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])}};return n.scopeName=t.scopeName,n}var Qe=globalThis?.document?x.useLayoutEffect:()=>{},oa=x[" useId ".trim().toString()]||(()=>{}),sa=0;function St(e){const[t,n]=x.useState(oa());return Qe(()=>{n(r=>r??String(sa++))},[e]),e||(t?`radix-${t}`:"")}var aa=x[" useInsertionEffect ".trim().toString()]||Qe;function ia({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,a,l]=la({defaultProp:t,onChange:n}),i=e!==void 0,c=i?e:s;{const f=x.useRef(e!==void 0);x.useEffect(()=>{const u=f.current;u!==i&&console.warn(`${r} is changing from ${u?"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,r])}const d=x.useCallback(f=>{if(i){const u=ca(f)?f(e):f;u!==e&&l.current?.(u)}else a(f)},[i,e,a,l]);return[c,d]}function la({defaultProp:e,onChange:t}){const[n,r]=x.useState(e),s=x.useRef(n),a=x.useRef(t);return aa(()=>{a.current=t},[t]),x.useEffect(()=>{s.current!==n&&(a.current?.(n),s.current=n)},[n,s]),[n,r,a]}function ca(e){return typeof e=="function"}function br(e){const t=da(e),n=x.forwardRef((r,s)=>{const{children:a,...l}=r,i=x.Children.toArray(a),c=i.find(fa);if(c){const d=c.props.children,f=i.map(u=>u===c?x.Children.count(d)>1?x.Children.only(null):x.isValidElement(d)?d.props.children:null:u);return o.jsx(t,{...l,ref:s,children:x.isValidElement(d)?x.cloneElement(d,void 0,f):null})}return o.jsx(t,{...l,ref:s,children:a})});return n.displayName=`${e}.Slot`,n}function da(e){const t=x.forwardRef((n,r)=>{const{children:s,...a}=n;if(x.isValidElement(s)){const l=pa(s),i=ma(a,s.props);return s.type!==x.Fragment&&(i.ref=r?wr(r,l):l),x.cloneElement(s,i)}return x.Children.count(s)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ua=Symbol("radix.slottable");function fa(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ua}function ma(e,t){const n={...t};for(const r in t){const s=e[r],a=t[r];/^on[A-Z]/.test(r)?s&&a?n[r]=(...i)=>{const c=a(...i);return s(...i),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...a}:r==="className"&&(n[r]=[s,a].filter(Boolean).join(" "))}return{...e,...n}}function pa(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var ha=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],pe=ha.reduce((e,t)=>{const n=br(`Primitive.${t}`),r=x.forwardRef((s,a)=>{const{asChild:l,...i}=s,c=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...i,ref:a})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function xa(e,t){e&&To.flushSync(()=>e.dispatchEvent(t))}function Xe(e){const t=x.useRef(e);return x.useEffect(()=>{t.current=e}),x.useMemo(()=>(...n)=>t.current?.(...n),[])}function ga(e,t=globalThis?.document){const n=Xe(e);x.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var va="DismissableLayer",Vt="dismissableLayer.update",wa="dismissableLayer.pointerDownOutside",ba="dismissableLayer.focusOutside",Cn,yr=x.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Cr=x.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:a,onInteractOutside:l,onDismiss:i,...c}=e,d=x.useContext(yr),[f,u]=x.useState(null),h=f?.ownerDocument??globalThis?.document,[,g]=x.useState({}),v=Pe(t,j=>u(j)),m=Array.from(d.layers),[b]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),w=m.indexOf(b),N=f?m.indexOf(f):-1,k=d.layersWithOutsidePointerEventsDisabled.size>0,y=N>=w,E=ka(j=>{const C=j.target,R=[...d.branches].some(B=>B.contains(C));!y||R||(s?.(j),l?.(j),j.defaultPrevented||i?.())},h),P=ja(j=>{const C=j.target;[...d.branches].some(B=>B.contains(C))||(a?.(j),l?.(j),j.defaultPrevented||i?.())},h);return ga(j=>{N===d.layers.size-1&&(r?.(j),!j.defaultPrevented&&i&&(j.preventDefault(),i()))},h),x.useEffect(()=>{if(f)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(Cn=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),kn(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Cn)}},[f,h,n,d]),x.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),kn())},[f,d]),x.useEffect(()=>{const j=()=>g({});return document.addEventListener(Vt,j),()=>document.removeEventListener(Vt,j)},[]),o.jsx(pe.div,{...c,ref:v,style:{pointerEvents:k?y?"auto":"none":void 0,...e.style},onFocusCapture:Ce(e.onFocusCapture,P.onFocusCapture),onBlurCapture:Ce(e.onBlurCapture,P.onBlurCapture),onPointerDownCapture:Ce(e.onPointerDownCapture,E.onPointerDownCapture)})});Cr.displayName=va;var ya="DismissableLayerBranch",Ca=x.forwardRef((e,t)=>{const n=x.useContext(yr),r=x.useRef(null),s=Pe(t,r);return x.useEffect(()=>{const a=r.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),o.jsx(pe.div,{...e,ref:s})});Ca.displayName=ya;function ka(e,t=globalThis?.document){const n=Xe(e),r=x.useRef(!1),s=x.useRef(()=>{});return x.useEffect(()=>{const a=i=>{if(i.target&&!r.current){let c=function(){kr(wa,n,d,{discrete:!0})};const d={originalEvent:i};i.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=c,t.addEventListener("click",s.current,{once:!0})):c()}else t.removeEventListener("click",s.current);r.current=!1},l=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(l),t.removeEventListener("pointerdown",a),t.removeEventListener("click",s.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function ja(e,t=globalThis?.document){const n=Xe(e),r=x.useRef(!1);return x.useEffect(()=>{const s=a=>{a.target&&!r.current&&kr(ba,n,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function kn(){const e=new CustomEvent(Vt);document.dispatchEvent(e)}function kr(e,t,n,{discrete:r}){const s=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?xa(s,a):s.dispatchEvent(a)}var Et="focusScope.autoFocusOnMount",Tt="focusScope.autoFocusOnUnmount",jn={bubbles:!1,cancelable:!0},Na="FocusScope",jr=x.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:a,...l}=e,[i,c]=x.useState(null),d=Xe(s),f=Xe(a),u=x.useRef(null),h=Pe(t,m=>c(m)),g=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(r){let m=function(k){if(g.paused||!i)return;const y=k.target;i.contains(y)?u.current=y:ye(u.current,{select:!0})},b=function(k){if(g.paused||!i)return;const y=k.relatedTarget;y!==null&&(i.contains(y)||ye(u.current,{select:!0}))},w=function(k){if(document.activeElement===document.body)for(const E of k)E.removedNodes.length>0&&ye(i)};document.addEventListener("focusin",m),document.addEventListener("focusout",b);const N=new MutationObserver(w);return i&&N.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",b),N.disconnect()}}},[r,i,g.paused]),x.useEffect(()=>{if(i){Sn.add(g);const m=document.activeElement;if(!i.contains(m)){const w=new CustomEvent(Et,jn);i.addEventListener(Et,d),i.dispatchEvent(w),w.defaultPrevented||(Sa(Aa(Nr(i)),{select:!0}),document.activeElement===m&&ye(i))}return()=>{i.removeEventListener(Et,d),setTimeout(()=>{const w=new CustomEvent(Tt,jn);i.addEventListener(Tt,f),i.dispatchEvent(w),w.defaultPrevented||ye(m??document.body,{select:!0}),i.removeEventListener(Tt,f),Sn.remove(g)},0)}}},[i,d,f,g]);const v=x.useCallback(m=>{if(!n&&!r||g.paused)return;const b=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,w=document.activeElement;if(b&&w){const N=m.currentTarget,[k,y]=Ea(N);k&&y?!m.shiftKey&&w===y?(m.preventDefault(),n&&ye(k,{select:!0})):m.shiftKey&&w===k&&(m.preventDefault(),n&&ye(y,{select:!0})):w===N&&m.preventDefault()}},[n,r,g.paused]);return o.jsx(pe.div,{tabIndex:-1,...l,ref:h,onKeyDown:v})});jr.displayName=Na;function Sa(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(ye(r,{select:t}),document.activeElement!==n)return}function Ea(e){const t=Nr(e),n=Nn(t,e),r=Nn(t.reverse(),e);return[n,r]}function Nr(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Nn(e,t){for(const n of e)if(!Ta(n,{upTo:t}))return n}function Ta(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 _a(e){return e instanceof HTMLInputElement&&"select"in e}function ye(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&_a(e)&&t&&e.select()}}var Sn=Ra();function Ra(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=En(e,t),e.unshift(t)},remove(t){e=En(e,t),e[0]?.resume()}}}function En(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Aa(e){return e.filter(t=>t.tagName!=="A")}var Ma="Portal",Sr=x.forwardRef((e,t)=>{const{container:n,...r}=e,[s,a]=x.useState(!1);Qe(()=>a(!0),[]);const l=n||s&&globalThis?.document?.body;return l?Vn.createPortal(o.jsx(pe.div,{...r,ref:t}),l):null});Sr.displayName=Ma;function La(e,t){return x.useReducer((n,r)=>t[n][r]??n,e)}var gt=e=>{const{present:t,children:n}=e,r=Pa(t),s=typeof n=="function"?n({present:r.isPresent}):x.Children.only(n),a=Pe(r.ref,Oa(s));return typeof n=="function"||r.isPresent?x.cloneElement(s,{ref:a}):null};gt.displayName="Presence";function Pa(e){const[t,n]=x.useState(),r=x.useRef(null),s=x.useRef(e),a=x.useRef("none"),l=e?"mounted":"unmounted",[i,c]=La(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return x.useEffect(()=>{const d=st(r.current);a.current=i==="mounted"?d:"none"},[i]),Qe(()=>{const d=r.current,f=s.current;if(f!==e){const h=a.current,g=st(d);e?c("MOUNT"):g==="none"||d?.display==="none"?c("UNMOUNT"):c(f&&h!==g?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,c]),Qe(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,u=g=>{const m=st(r.current).includes(CSS.escape(g.animationName));if(g.target===t&&m&&(c("ANIMATION_END"),!s.current)){const b=t.style.animationFillMode;t.style.animationFillMode="forwards",d=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=b)})}},h=g=>{g.target===t&&(a.current=st(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",u),t.addEventListener("animationend",u),()=>{f.clearTimeout(d),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",u),t.removeEventListener("animationend",u)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:x.useCallback(d=>{r.current=d?getComputedStyle(d):null,n(d)},[])}}function st(e){return e?.animationName||"none"}function Oa(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var _t=0;function Ia(){x.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Tn()),document.body.insertAdjacentElement("beforeend",e[1]??Tn()),_t++,()=>{_t===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),_t--}},[])}function Tn(){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 de=function(){return de=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},de.apply(this,arguments)};function Er(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}function Da(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,a;r<s;r++)(a||!(r in t))&&(a||(a=Array.prototype.slice.call(t,0,r)),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var ft="right-scroll-bar-position",mt="width-before-scroll-bar",$a="with-scroll-bars-hidden",Fa="--removed-body-scroll-bar-size";function Rt(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Ba(e,t){var n=p.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=t,n.facade}var za=typeof window<"u"?x.useLayoutEffect:x.useEffect,_n=new WeakMap;function Va(e,t){var n=Ba(null,function(r){return e.forEach(function(s){return Rt(s,r)})});return za(function(){var r=_n.get(n);if(r){var s=new Set(r),a=new Set(e),l=n.current;s.forEach(function(i){a.has(i)||Rt(i,null)}),a.forEach(function(i){s.has(i)||Rt(i,l)})}_n.set(n,e)},[e]),n}function Wa(e){return e}function Ha(e,t){t===void 0&&(t=Wa);var n=[],r=!1,s={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(a){var l=t(a,r);return n.push(l),function(){n=n.filter(function(i){return i!==l})}},assignSyncMedium:function(a){for(r=!0;n.length;){var l=n;n=[],l.forEach(a)}n={push:function(i){return a(i)},filter:function(){return n}}},assignMedium:function(a){r=!0;var l=[];if(n.length){var i=n;n=[],i.forEach(a),l=n}var c=function(){var f=l;l=[],f.forEach(a)},d=function(){return Promise.resolve().then(c)};d(),n={push:function(f){l.push(f),d()},filter:function(f){return l=l.filter(f),n}}}};return s}function Ua(e){e===void 0&&(e={});var t=Ha(null);return t.options=de({async:!0,ssr:!1},e),t}var Tr=function(e){var t=e.sideCar,n=Er(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return x.createElement(r,de({},n))};Tr.isSideCarExport=!0;function qa(e,t){return e.useMedium(t),Tr}var _r=Ua(),At=function(){},vt=x.forwardRef(function(e,t){var n=x.useRef(null),r=x.useState({onScrollCapture:At,onWheelCapture:At,onTouchMoveCapture:At}),s=r[0],a=r[1],l=e.forwardProps,i=e.children,c=e.className,d=e.removeScrollBar,f=e.enabled,u=e.shards,h=e.sideCar,g=e.noRelative,v=e.noIsolation,m=e.inert,b=e.allowPinchZoom,w=e.as,N=w===void 0?"div":w,k=e.gapMode,y=Er(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=h,P=Va([n,t]),j=de(de({},y),s);return x.createElement(x.Fragment,null,f&&x.createElement(E,{sideCar:_r,removeScrollBar:d,shards:u,noRelative:g,noIsolation:v,inert:m,setCallbacks:a,allowPinchZoom:!!b,lockRef:n,gapMode:k}),l?x.cloneElement(x.Children.only(i),de(de({},j),{ref:P})):x.createElement(N,de({},j,{className:c,ref:P}),i))});vt.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};vt.classNames={fullWidth:mt,zeroRight:ft};var Ga=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Ka(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Ga();return t&&e.setAttribute("nonce",t),e}function Ya(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Za(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Qa=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Ka())&&(Ya(t,n),Za(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Xa=function(){var e=Qa();return function(t,n){x.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Rr=function(){var e=Xa(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},Ja={left:0,top:0,right:0,gap:0},Mt=function(e){return parseInt(e||"",10)||0},ei=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[Mt(n),Mt(r),Mt(s)]},ti=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Ja;var t=ei(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},ni=Rr(),ze="data-scroll-locked",ri=function(e,t,n,r){var s=e.left,a=e.top,l=e.right,i=e.gap;return n===void 0&&(n="margin"),`
10
10
  .`.concat($a,` {
11
11
  overflow: hidden `).concat(r,`;
12
12
  padding-right: `).concat(i,"px ").concat(r,`;
@@ -43,13 +43,13 @@
43
43
  body[`).concat(ze,`] {
44
44
  `).concat(Fa,": ").concat(i,`px;
45
45
  }
46
- `)},Rn=function(){var e=parseInt(document.body.getAttribute(ze)||"0",10);return isFinite(e)?e:0},oi=function(){h.useEffect(function(){return document.body.setAttribute(ze,(Rn()+1).toString()),function(){var e=Rn()-1;e<=0?document.body.removeAttribute(ze):document.body.setAttribute(ze,e.toString())}},[])},si=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;oi();var a=h.useMemo(function(){return ti(s)},[s]);return h.createElement(ni,{styles:ri(a,!t,s,n?"":"!important")})},Wt=!1;if(typeof window<"u")try{var at=Object.defineProperty({},"passive",{get:function(){return Wt=!0,!0}});window.addEventListener("test",at,at),window.removeEventListener("test",at,at)}catch{Wt=!1}var De=Wt?{passive:!1}:!1,ai=function(e){return e.tagName==="TEXTAREA"},Ar=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!ai(e)&&n[t]==="visible")},ii=function(e){return Ar(e,"overflowY")},li=function(e){return Ar(e,"overflowX")},An=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=Mr(e,r);if(s){var a=Lr(e,r),l=a[1],i=a[2];if(l>i)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},ci=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},di=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Mr=function(e,t){return e==="v"?ii(t):li(t)},Lr=function(e,t){return e==="v"?ci(t):di(t)},ui=function(e,t){return e==="h"&&t==="rtl"?-1:1},fi=function(e,t,n,r,s){var a=ui(e,window.getComputedStyle(t).direction),l=a*r,i=n.target,c=t.contains(i),d=!1,u=l>0,f=0,x=0;do{if(!i)break;var v=Lr(e,i),w=v[0],m=v[1],y=v[2],g=m-y-a*w;(w||g)&&Mr(e,i)&&(f+=g,x+=w);var k=i.parentNode;i=k&&k.nodeType===Node.DOCUMENT_FRAGMENT_NODE?k.host:k}while(!c&&i!==document.body||c&&(t.contains(i)||t===i));return(u&&Math.abs(f)<1||!u&&Math.abs(x)<1)&&(d=!0),d},it=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Mn=function(e){return[e.deltaX,e.deltaY]},Ln=function(e){return e&&"current"in e?e.current:e},mi=function(e,t){return e[0]===t[0]&&e[1]===t[1]},pi=function(e){return`
46
+ `)},Rn=function(){var e=parseInt(document.body.getAttribute(ze)||"0",10);return isFinite(e)?e:0},oi=function(){x.useEffect(function(){return document.body.setAttribute(ze,(Rn()+1).toString()),function(){var e=Rn()-1;e<=0?document.body.removeAttribute(ze):document.body.setAttribute(ze,e.toString())}},[])},si=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;oi();var a=x.useMemo(function(){return ti(s)},[s]);return x.createElement(ni,{styles:ri(a,!t,s,n?"":"!important")})},Wt=!1;if(typeof window<"u")try{var at=Object.defineProperty({},"passive",{get:function(){return Wt=!0,!0}});window.addEventListener("test",at,at),window.removeEventListener("test",at,at)}catch{Wt=!1}var De=Wt?{passive:!1}:!1,ai=function(e){return e.tagName==="TEXTAREA"},Ar=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!ai(e)&&n[t]==="visible")},ii=function(e){return Ar(e,"overflowY")},li=function(e){return Ar(e,"overflowX")},An=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=Mr(e,r);if(s){var a=Lr(e,r),l=a[1],i=a[2];if(l>i)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},ci=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},di=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Mr=function(e,t){return e==="v"?ii(t):li(t)},Lr=function(e,t){return e==="v"?ci(t):di(t)},ui=function(e,t){return e==="h"&&t==="rtl"?-1:1},fi=function(e,t,n,r,s){var a=ui(e,window.getComputedStyle(t).direction),l=a*r,i=n.target,c=t.contains(i),d=!1,f=l>0,u=0,h=0;do{if(!i)break;var g=Lr(e,i),v=g[0],m=g[1],b=g[2],w=m-b-a*v;(v||w)&&Mr(e,i)&&(u+=w,h+=v);var N=i.parentNode;i=N&&N.nodeType===Node.DOCUMENT_FRAGMENT_NODE?N.host:N}while(!c&&i!==document.body||c&&(t.contains(i)||t===i));return(f&&Math.abs(u)<1||!f&&Math.abs(h)<1)&&(d=!0),d},it=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Mn=function(e){return[e.deltaX,e.deltaY]},Ln=function(e){return e&&"current"in e?e.current:e},mi=function(e,t){return e[0]===t[0]&&e[1]===t[1]},pi=function(e){return`
47
47
  .block-interactivity-`.concat(e,` {pointer-events: none;}
48
48
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
49
- `)},hi=0,$e=[];function xi(e){var t=h.useRef([]),n=h.useRef([0,0]),r=h.useRef(),s=h.useState(hi++)[0],a=h.useState(Rr)[0],l=h.useRef(e);h.useEffect(function(){l.current=e},[e]),h.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var m=Da([e.lockRef.current],(e.shards||[]).map(Ln),!0).filter(Boolean);return m.forEach(function(y){return y.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),m.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var i=h.useCallback(function(m,y){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!l.current.allowPinchZoom;var g=it(m),k=n.current,N="deltaX"in m?m.deltaX:k[0]-g[0],b="deltaY"in m?m.deltaY:k[1]-g[1],A,I=m.target,j=Math.abs(N)>Math.abs(b)?"h":"v";if("touches"in m&&j==="h"&&I.type==="range")return!1;var C=window.getSelection(),R=C&&C.anchorNode,B=R?R===I||R.contains(I):!1;if(B)return!1;var L=An(j,I);if(!L)return!0;if(L?A=j:(A=j==="v"?"h":"v",L=An(j,I)),!L)return!1;if(!r.current&&"changedTouches"in m&&(N||b)&&(r.current=A),!A)return!0;var D=r.current||A;return fi(D,y,m,D==="h"?N:b)},[]),c=h.useCallback(function(m){var y=m;if(!(!$e.length||$e[$e.length-1]!==a)){var g="deltaY"in y?Mn(y):it(y),k=t.current.filter(function(A){return A.name===y.type&&(A.target===y.target||y.target===A.shadowParent)&&mi(A.delta,g)})[0];if(k&&k.should){y.cancelable&&y.preventDefault();return}if(!k){var N=(l.current.shards||[]).map(Ln).filter(Boolean).filter(function(A){return A.contains(y.target)}),b=N.length>0?i(y,N[0]):!l.current.noIsolation;b&&y.cancelable&&y.preventDefault()}}},[]),d=h.useCallback(function(m,y,g,k){var N={name:m,delta:y,target:g,should:k,shadowParent:gi(g)};t.current.push(N),setTimeout(function(){t.current=t.current.filter(function(b){return b!==N})},1)},[]),u=h.useCallback(function(m){n.current=it(m),r.current=void 0},[]),f=h.useCallback(function(m){d(m.type,Mn(m),m.target,i(m,e.lockRef.current))},[]),x=h.useCallback(function(m){d(m.type,it(m),m.target,i(m,e.lockRef.current))},[]);h.useEffect(function(){return $e.push(a),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:x}),document.addEventListener("wheel",c,De),document.addEventListener("touchmove",c,De),document.addEventListener("touchstart",u,De),function(){$e=$e.filter(function(m){return m!==a}),document.removeEventListener("wheel",c,De),document.removeEventListener("touchmove",c,De),document.removeEventListener("touchstart",u,De)}},[]);var v=e.removeScrollBar,w=e.inert;return h.createElement(h.Fragment,null,w?h.createElement(a,{styles:pi(s)}):null,v?h.createElement(si,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function gi(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const vi=qa(_r,xi);var Pr=h.forwardRef(function(e,t){return h.createElement(vt,de({},e,{ref:t,sideCar:vi}))});Pr.classNames=vt.classNames;var wi=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Fe=new WeakMap,lt=new WeakMap,ct={},Lt=0,Or=function(e){return e&&(e.host||Or(e.parentNode))},bi=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Or(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},yi=function(e,t,n,r){var s=bi(t,Array.isArray(e)?e:[e]);ct[n]||(ct[n]=new WeakMap);var a=ct[n],l=[],i=new Set,c=new Set(s),d=function(f){!f||i.has(f)||(i.add(f),d(f.parentNode))};s.forEach(d);var u=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(x){if(i.has(x))u(x);else try{var v=x.getAttribute(r),w=v!==null&&v!=="false",m=(Fe.get(x)||0)+1,y=(a.get(x)||0)+1;Fe.set(x,m),a.set(x,y),l.push(x),m===1&&w&&lt.set(x,!0),y===1&&x.setAttribute(n,"true"),w||x.setAttribute(r,"true")}catch(g){console.error("aria-hidden: cannot operate on ",x,g)}})};return u(t),i.clear(),Lt++,function(){l.forEach(function(f){var x=Fe.get(f)-1,v=a.get(f)-1;Fe.set(f,x),a.set(f,v),x||(lt.has(f)||f.removeAttribute(r),lt.delete(f)),v||f.removeAttribute(n)}),Lt--,Lt||(Fe=new WeakMap,Fe=new WeakMap,lt=new WeakMap,ct={})}},Ci=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=wi(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),yi(r,s,n,"aria-hidden")):function(){return null}},wt="Dialog",[Ir]=na(wt),[ki,ae]=Ir(wt),Dr=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:s,onOpenChange:a,modal:l=!0}=e,i=h.useRef(null),c=h.useRef(null),[d,u]=ia({prop:r,defaultProp:s??!1,onChange:a,caller:wt});return o.jsx(ki,{scope:t,triggerRef:i,contentRef:c,contentId:St(),titleId:St(),descriptionId:St(),open:d,onOpenChange:u,onOpenToggle:h.useCallback(()=>u(f=>!f),[u]),modal:l,children:n})};Dr.displayName=wt;var $r="DialogTrigger",ji=h.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=ae($r,n),a=Pe(t,s.triggerRef);return o.jsx(pe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Jt(s.open),...r,ref:a,onClick:Ce(e.onClick,s.onOpenToggle)})});ji.displayName=$r;var Qt="DialogPortal",[Ni,Fr]=Ir(Qt,{forceMount:void 0}),Br=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,a=ae(Qt,t);return o.jsx(Ni,{scope:t,forceMount:n,children:h.Children.map(r,l=>o.jsx(gt,{present:n||a.open,children:o.jsx(Sr,{asChild:!0,container:s,children:l})}))})};Br.displayName=Qt;var ht="DialogOverlay",zr=h.forwardRef((e,t)=>{const n=Fr(ht,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,a=ae(ht,e.__scopeDialog);return a.modal?o.jsx(gt,{present:r||a.open,children:o.jsx(Ei,{...s,ref:t})}):null});zr.displayName=ht;var Si=br("DialogOverlay.RemoveScroll"),Ei=h.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=ae(ht,n);return o.jsx(Pr,{as:Si,allowPinchZoom:!0,shards:[s.contentRef],children:o.jsx(pe.div,{"data-state":Jt(s.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Me="DialogContent",Vr=h.forwardRef((e,t)=>{const n=Fr(Me,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,a=ae(Me,e.__scopeDialog);return o.jsx(gt,{present:r||a.open,children:a.modal?o.jsx(Ti,{...s,ref:t}):o.jsx(_i,{...s,ref:t})})});Vr.displayName=Me;var Ti=h.forwardRef((e,t)=>{const n=ae(Me,e.__scopeDialog),r=h.useRef(null),s=Pe(t,n.contentRef,r);return h.useEffect(()=>{const a=r.current;if(a)return Ci(a)},[]),o.jsx(Wr,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ce(e.onCloseAutoFocus,a=>{a.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Ce(e.onPointerDownOutside,a=>{const l=a.detail.originalEvent,i=l.button===0&&l.ctrlKey===!0;(l.button===2||i)&&a.preventDefault()}),onFocusOutside:Ce(e.onFocusOutside,a=>a.preventDefault())})}),_i=h.forwardRef((e,t)=>{const n=ae(Me,e.__scopeDialog),r=h.useRef(!1),s=h.useRef(!1);return o.jsx(Wr,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{e.onCloseAutoFocus?.(a),a.defaultPrevented||(r.current||n.triggerRef.current?.focus(),a.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:a=>{e.onInteractOutside?.(a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const l=a.target;n.triggerRef.current?.contains(l)&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&s.current&&a.preventDefault()}})}),Wr=h.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:a,...l}=e,i=ae(Me,n),c=h.useRef(null),d=Pe(t,c);return Ia(),o.jsxs(o.Fragment,{children:[o.jsx(jr,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:a,children:o.jsx(Cr,{role:"dialog",id:i.contentId,"aria-describedby":i.descriptionId,"aria-labelledby":i.titleId,"data-state":Jt(i.open),...l,ref:d,onDismiss:()=>i.onOpenChange(!1)})}),o.jsxs(o.Fragment,{children:[o.jsx(Ri,{titleId:i.titleId}),o.jsx(Mi,{contentRef:c,descriptionId:i.descriptionId})]})]})}),Xt="DialogTitle",Hr=h.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=ae(Xt,n);return o.jsx(pe.h2,{id:s.titleId,...r,ref:t})});Hr.displayName=Xt;var Ur="DialogDescription",qr=h.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=ae(Ur,n);return o.jsx(pe.p,{id:s.descriptionId,...r,ref:t})});qr.displayName=Ur;var Gr="DialogClose",Kr=h.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=ae(Gr,n);return o.jsx(pe.button,{type:"button",...r,ref:t,onClick:Ce(e.onClick,()=>s.onOpenChange(!1))})});Kr.displayName=Gr;function Jt(e){return e?"open":"closed"}var Yr="DialogTitleWarning",[Gc,Zr]=ta(Yr,{contentName:Me,titleName:Xt,docsSlug:"dialog"}),Ri=({titleId:e})=>{const t=Zr(Yr),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
49
+ `)},hi=0,$e=[];function xi(e){var t=x.useRef([]),n=x.useRef([0,0]),r=x.useRef(),s=x.useState(hi++)[0],a=x.useState(Rr)[0],l=x.useRef(e);x.useEffect(function(){l.current=e},[e]),x.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var m=Da([e.lockRef.current],(e.shards||[]).map(Ln),!0).filter(Boolean);return m.forEach(function(b){return b.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),m.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var i=x.useCallback(function(m,b){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!l.current.allowPinchZoom;var w=it(m),N=n.current,k="deltaX"in m?m.deltaX:N[0]-w[0],y="deltaY"in m?m.deltaY:N[1]-w[1],E,P=m.target,j=Math.abs(k)>Math.abs(y)?"h":"v";if("touches"in m&&j==="h"&&P.type==="range")return!1;var C=window.getSelection(),R=C&&C.anchorNode,B=R?R===P||R.contains(P):!1;if(B)return!1;var L=An(j,P);if(!L)return!0;if(L?E=j:(E=j==="v"?"h":"v",L=An(j,P)),!L)return!1;if(!r.current&&"changedTouches"in m&&(k||y)&&(r.current=E),!E)return!0;var D=r.current||E;return fi(D,b,m,D==="h"?k:y)},[]),c=x.useCallback(function(m){var b=m;if(!(!$e.length||$e[$e.length-1]!==a)){var w="deltaY"in b?Mn(b):it(b),N=t.current.filter(function(E){return E.name===b.type&&(E.target===b.target||b.target===E.shadowParent)&&mi(E.delta,w)})[0];if(N&&N.should){b.cancelable&&b.preventDefault();return}if(!N){var k=(l.current.shards||[]).map(Ln).filter(Boolean).filter(function(E){return E.contains(b.target)}),y=k.length>0?i(b,k[0]):!l.current.noIsolation;y&&b.cancelable&&b.preventDefault()}}},[]),d=x.useCallback(function(m,b,w,N){var k={name:m,delta:b,target:w,should:N,shadowParent:gi(w)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(y){return y!==k})},1)},[]),f=x.useCallback(function(m){n.current=it(m),r.current=void 0},[]),u=x.useCallback(function(m){d(m.type,Mn(m),m.target,i(m,e.lockRef.current))},[]),h=x.useCallback(function(m){d(m.type,it(m),m.target,i(m,e.lockRef.current))},[]);x.useEffect(function(){return $e.push(a),e.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:h}),document.addEventListener("wheel",c,De),document.addEventListener("touchmove",c,De),document.addEventListener("touchstart",f,De),function(){$e=$e.filter(function(m){return m!==a}),document.removeEventListener("wheel",c,De),document.removeEventListener("touchmove",c,De),document.removeEventListener("touchstart",f,De)}},[]);var g=e.removeScrollBar,v=e.inert;return x.createElement(x.Fragment,null,v?x.createElement(a,{styles:pi(s)}):null,g?x.createElement(si,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function gi(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const vi=qa(_r,xi);var Pr=x.forwardRef(function(e,t){return x.createElement(vt,de({},e,{ref:t,sideCar:vi}))});Pr.classNames=vt.classNames;var wi=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Fe=new WeakMap,lt=new WeakMap,ct={},Lt=0,Or=function(e){return e&&(e.host||Or(e.parentNode))},bi=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Or(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},yi=function(e,t,n,r){var s=bi(t,Array.isArray(e)?e:[e]);ct[n]||(ct[n]=new WeakMap);var a=ct[n],l=[],i=new Set,c=new Set(s),d=function(u){!u||i.has(u)||(i.add(u),d(u.parentNode))};s.forEach(d);var f=function(u){!u||c.has(u)||Array.prototype.forEach.call(u.children,function(h){if(i.has(h))f(h);else try{var g=h.getAttribute(r),v=g!==null&&g!=="false",m=(Fe.get(h)||0)+1,b=(a.get(h)||0)+1;Fe.set(h,m),a.set(h,b),l.push(h),m===1&&v&&lt.set(h,!0),b===1&&h.setAttribute(n,"true"),v||h.setAttribute(r,"true")}catch(w){console.error("aria-hidden: cannot operate on ",h,w)}})};return f(t),i.clear(),Lt++,function(){l.forEach(function(u){var h=Fe.get(u)-1,g=a.get(u)-1;Fe.set(u,h),a.set(u,g),h||(lt.has(u)||u.removeAttribute(r),lt.delete(u)),g||u.removeAttribute(n)}),Lt--,Lt||(Fe=new WeakMap,Fe=new WeakMap,lt=new WeakMap,ct={})}},Ci=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=wi(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),yi(r,s,n,"aria-hidden")):function(){return null}},wt="Dialog",[Ir]=na(wt),[ki,ae]=Ir(wt),Dr=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:s,onOpenChange:a,modal:l=!0}=e,i=x.useRef(null),c=x.useRef(null),[d,f]=ia({prop:r,defaultProp:s??!1,onChange:a,caller:wt});return o.jsx(ki,{scope:t,triggerRef:i,contentRef:c,contentId:St(),titleId:St(),descriptionId:St(),open:d,onOpenChange:f,onOpenToggle:x.useCallback(()=>f(u=>!u),[f]),modal:l,children:n})};Dr.displayName=wt;var $r="DialogTrigger",ji=x.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=ae($r,n),a=Pe(t,s.triggerRef);return o.jsx(pe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Jt(s.open),...r,ref:a,onClick:Ce(e.onClick,s.onOpenToggle)})});ji.displayName=$r;var Qt="DialogPortal",[Ni,Fr]=Ir(Qt,{forceMount:void 0}),Br=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,a=ae(Qt,t);return o.jsx(Ni,{scope:t,forceMount:n,children:x.Children.map(r,l=>o.jsx(gt,{present:n||a.open,children:o.jsx(Sr,{asChild:!0,container:s,children:l})}))})};Br.displayName=Qt;var ht="DialogOverlay",zr=x.forwardRef((e,t)=>{const n=Fr(ht,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,a=ae(ht,e.__scopeDialog);return a.modal?o.jsx(gt,{present:r||a.open,children:o.jsx(Ei,{...s,ref:t})}):null});zr.displayName=ht;var Si=br("DialogOverlay.RemoveScroll"),Ei=x.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=ae(ht,n);return o.jsx(Pr,{as:Si,allowPinchZoom:!0,shards:[s.contentRef],children:o.jsx(pe.div,{"data-state":Jt(s.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Me="DialogContent",Vr=x.forwardRef((e,t)=>{const n=Fr(Me,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,a=ae(Me,e.__scopeDialog);return o.jsx(gt,{present:r||a.open,children:a.modal?o.jsx(Ti,{...s,ref:t}):o.jsx(_i,{...s,ref:t})})});Vr.displayName=Me;var Ti=x.forwardRef((e,t)=>{const n=ae(Me,e.__scopeDialog),r=x.useRef(null),s=Pe(t,n.contentRef,r);return x.useEffect(()=>{const a=r.current;if(a)return Ci(a)},[]),o.jsx(Wr,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ce(e.onCloseAutoFocus,a=>{a.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Ce(e.onPointerDownOutside,a=>{const l=a.detail.originalEvent,i=l.button===0&&l.ctrlKey===!0;(l.button===2||i)&&a.preventDefault()}),onFocusOutside:Ce(e.onFocusOutside,a=>a.preventDefault())})}),_i=x.forwardRef((e,t)=>{const n=ae(Me,e.__scopeDialog),r=x.useRef(!1),s=x.useRef(!1);return o.jsx(Wr,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{e.onCloseAutoFocus?.(a),a.defaultPrevented||(r.current||n.triggerRef.current?.focus(),a.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:a=>{e.onInteractOutside?.(a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const l=a.target;n.triggerRef.current?.contains(l)&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&s.current&&a.preventDefault()}})}),Wr=x.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:a,...l}=e,i=ae(Me,n),c=x.useRef(null),d=Pe(t,c);return Ia(),o.jsxs(o.Fragment,{children:[o.jsx(jr,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:a,children:o.jsx(Cr,{role:"dialog",id:i.contentId,"aria-describedby":i.descriptionId,"aria-labelledby":i.titleId,"data-state":Jt(i.open),...l,ref:d,onDismiss:()=>i.onOpenChange(!1)})}),o.jsxs(o.Fragment,{children:[o.jsx(Ri,{titleId:i.titleId}),o.jsx(Mi,{contentRef:c,descriptionId:i.descriptionId})]})]})}),Xt="DialogTitle",Hr=x.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=ae(Xt,n);return o.jsx(pe.h2,{id:s.titleId,...r,ref:t})});Hr.displayName=Xt;var Ur="DialogDescription",qr=x.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=ae(Ur,n);return o.jsx(pe.p,{id:s.descriptionId,...r,ref:t})});qr.displayName=Ur;var Gr="DialogClose",Kr=x.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=ae(Gr,n);return o.jsx(pe.button,{type:"button",...r,ref:t,onClick:Ce(e.onClick,()=>s.onOpenChange(!1))})});Kr.displayName=Gr;function Jt(e){return e?"open":"closed"}var Yr="DialogTitleWarning",[Gc,Zr]=ta(Yr,{contentName:Me,titleName:Xt,docsSlug:"dialog"}),Ri=({titleId:e})=>{const t=Zr(Yr),n=`\`${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 h.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Ai="DialogDescriptionWarning",Mi=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Zr(Ai).contentName}}.`;return h.useEffect(()=>{const s=e.current?.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},Li=Dr,Pi=Br,Oi=zr,Ii=Vr,Di=Hr,$i=qr,Fi=Kr;function Bi(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}const Qr=p.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}),et=()=>{const e=p.useContext(Qr);if(!e)throw new Error("useDrawerContext must be used within a Drawer.Root");return e};Bi(`[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(
53
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return x.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Ai="DialogDescriptionWarning",Mi=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Zr(Ai).contentName}}.`;return x.useEffect(()=>{const s=e.current?.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},Li=Dr,Pi=Br,Oi=zr,Ii=Vr,Di=Hr,$i=qr,Fi=Kr;function Bi(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}const Qr=p.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}),et=()=>{const e=p.useContext(Qr);if(!e)throw new Error("useDrawerContext must be used within a Drawer.Root");return e};Bi(`[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 zi(){const e=navigator.userAgent;return typeof window<"u"&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))}function Vi(){return en(/^Mac/)}function Wi(){return en(/^iPhone/)}function Pn(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function Hi(){return en(/^iPad/)||Vi()&&navigator.maxTouchPoints>1}function Xr(){return Wi()||Hi()}function en(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.platform):void 0}const Ui=24,qi=typeof window<"u"?p.useLayoutEffect:p.useEffect;function On(...e){return(...t)=>{for(let n of e)typeof n=="function"&&n(...t)}}const Pt=typeof document<"u"&&window.visualViewport;function In(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function Jr(e){for(In(e)&&(e=e.parentElement);e&&!In(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}const Gi=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let dt=0,Ot;function Ki(e={}){let{isDisabled:t}=e;qi(()=>{if(!t)return dt++,dt===1&&Xr()&&(Ot=Yi()),()=>{dt--,dt===0&&Ot?.()}},[t])}function Yi(){let e,t=0,n=f=>{e=Jr(f.target),!(e===document.documentElement&&e===document.body)&&(t=f.changedTouches[0].pageY)},r=f=>{if(!e||e===document.documentElement||e===document.body){f.preventDefault();return}let x=f.changedTouches[0].pageY,v=e.scrollTop,w=e.scrollHeight-e.clientHeight;w!==0&&((v<=0&&x>t||v>=w&&x<t)&&f.preventDefault(),t=x)},s=f=>{let x=f.target;Ht(x)&&x!==document.activeElement&&(f.preventDefault(),x.style.transform="translateY(-2000px)",x.focus(),requestAnimationFrame(()=>{x.style.transform=""}))},a=f=>{let x=f.target;Ht(x)&&(x.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{x.style.transform="",Pt&&(Pt.height<window.innerHeight?requestAnimationFrame(()=>{Dn(x)}):Pt.addEventListener("resize",()=>Dn(x),{once:!0}))}))},l=()=>{window.scrollTo(0,0)},i=window.pageXOffset,c=window.pageYOffset,d=On(Zi(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let u=On(Ye(document,"touchstart",n,{passive:!1,capture:!0}),Ye(document,"touchmove",r,{passive:!1,capture:!0}),Ye(document,"touchend",s,{passive:!1,capture:!0}),Ye(document,"focus",a,!0),Ye(window,"scroll",l));return()=>{d(),u(),window.scrollTo(i,c)}}function Zi(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}function Ye(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function Dn(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let n=Jr(e);if(n!==document.documentElement&&n!==document.body&&n!==e){let r=n.getBoundingClientRect().top,s=e.getBoundingClientRect().top,a=e.getBoundingClientRect().bottom;const l=n.getBoundingClientRect().bottom+Ui;a>l&&(n.scrollTop+=s-r)}e=n.parentElement}}function Ht(e){return e instanceof HTMLInputElement&&!Gi.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function Qi(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function Xi(...e){return t=>e.forEach(n=>Qi(n,t))}function eo(...e){return h.useCallback(Xi(...e),e)}const to=new WeakMap;function ee(e,t,n=!1){if(!e||!(e instanceof HTMLElement))return;let r={};Object.entries(t).forEach(([s,a])=>{if(s.startsWith("--")){e.style.setProperty(s,a);return}r[s]=e.style[s],e.style[s]=a}),!n&&to.set(e,r)}function Ji(e,t){if(!e||!(e instanceof HTMLElement))return;let n=to.get(e);n&&(e.style[t]=n[t])}const X=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function ut(e,t){if(!e)return null;const n=window.getComputedStyle(e),r=n.transform||n.webkitTransform||n.mozTransform;let s=r.match(/^matrix3d\((.+)\)$/);return s?parseFloat(s[1].split(", ")[X(t)?13:12]):(s=r.match(/^matrix\((.+)\)$/),s?parseFloat(s[1].split(", ")[X(t)?5:4]):null)}function el(e){return 8*(Math.log(e+1)-2)}function It(e,t){if(!e)return()=>{};const n=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=n}}function tl(...e){return(...t)=>{for(const n of e)typeof n=="function"&&n(...t)}}const K={DURATION:.5,EASE:[.32,.72,0,1]},no=.4,nl=.25,rl=100,ro=8,_e=16,Ut=26,Dt="vaul-dragging";function oo(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>(...n)=>t.current==null?void 0:t.current.call(t,...n),[])}function ol({defaultProp:e,onChange:t}){const n=p.useState(e),[r]=n,s=p.useRef(r),a=oo(t);return p.useEffect(()=>{s.current!==r&&(a(r),s.current=r)},[r,s,a]),n}function so({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,s]=ol({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:r,i=oo(n),c=p.useCallback(d=>{if(a){const f=typeof d=="function"?d(e):d;f!==e&&i(f)}else s(d)},[a,e,s,i]);return[l,c]}function sl({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:n,drawerRef:r,overlayRef:s,fadeFromIndex:a,onSnapPointChange:l,direction:i="bottom",container:c,snapToSequentialPoint:d}){const[u,f]=so({prop:e,defaultProp:n?.[0],onChange:t}),[x,v]=p.useState(typeof window<"u"?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);p.useEffect(()=>{function j(){v({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",j),()=>window.removeEventListener("resize",j)},[]);const w=p.useMemo(()=>u===n?.[n.length-1]||null,[n,u]),m=p.useMemo(()=>{var j;return(j=n?.findIndex(C=>C===u))!=null?j:null},[n,u]),y=n&&n.length>0&&(a||a===0)&&!Number.isNaN(a)&&n[a]===u||!n,g=p.useMemo(()=>{const j=c?{width:c.getBoundingClientRect().width,height:c.getBoundingClientRect().height}:typeof window<"u"?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};var C;return(C=n?.map(R=>{const B=typeof R=="string";let L=0;if(B&&(L=parseInt(R,10)),X(i)){const _=B?L:x?R*j.height:0;return x?i==="bottom"?j.height-_:-j.height+_:_}const D=B?L:x?R*j.width:0;return x?i==="right"?j.width-D:-j.width+D:D}))!=null?C:[]},[n,x,c]),k=p.useMemo(()=>m!==null?g?.[m]:null,[g,m]),N=p.useCallback(j=>{var C;const R=(C=g?.findIndex(B=>B===j))!=null?C:null;l(R),ee(r.current,{transition:`transform ${K.DURATION}s cubic-bezier(${K.EASE.join(",")})`,transform:X(i)?`translate3d(0, ${j}px, 0)`:`translate3d(${j}px, 0, 0)`}),g&&R!==g.length-1&&a!==void 0&&R!==a&&R<a?ee(s.current,{transition:`opacity ${K.DURATION}s cubic-bezier(${K.EASE.join(",")})`,opacity:"0"}):ee(s.current,{transition:`opacity ${K.DURATION}s cubic-bezier(${K.EASE.join(",")})`,opacity:"1"}),f(n?.[Math.max(R,0)])},[r.current,n,g,a,s,f]);p.useEffect(()=>{if(u||e){var j;const C=(j=n?.findIndex(R=>R===e||R===u))!=null?j:-1;g&&C!==-1&&typeof g[C]=="number"&&N(g[C])}},[u,e,n,g,N]);function b({draggedDistance:j,closeDrawer:C,velocity:R,dismissible:B}){if(a===void 0)return;const L=i==="bottom"||i==="right"?(k??0)-j:(k??0)+j,D=m===a-1,_=m===0,V=j>0;if(D&&ee(s.current,{transition:`opacity ${K.DURATION}s cubic-bezier(${K.EASE.join(",")})`}),!d&&R>2&&!V){B?C():N(g[0]);return}if(!d&&R>2&&V&&g&&n){N(g[n.length-1]);return}const W=g?.reduce((H,S)=>typeof H!="number"||typeof S!="number"?H:Math.abs(S-L)<Math.abs(H-L)?S:H),G=X(i)?window.innerHeight:window.innerWidth;if(R>no&&Math.abs(j)<G*.4){const H=V?1:-1;if(H>0&&w&&n){N(g[n.length-1]);return}if(_&&H<0&&B&&C(),m===null)return;N(g[m+H]);return}N(W)}function A({draggedDistance:j}){if(k===null)return;const C=i==="bottom"||i==="right"?k-j:k+j;(i==="bottom"||i==="right")&&C<g[g.length-1]||(i==="top"||i==="left")&&C>g[g.length-1]||ee(r.current,{transform:X(i)?`translate3d(0, ${C}px, 0)`:`translate3d(${C}px, 0, 0)`})}function I(j,C){if(!n||typeof m!="number"||!g||a===void 0)return null;const R=m===a-1;if(m>=a&&C)return 0;if(R&&!C)return 1;if(!y&&!R)return null;const L=R?m+1:m-1,D=R?g[L]-g[L-1]:g[L+1]-g[L],_=j/Math.abs(D);return R?1-_:_}return{isLastSnapPoint:w,activeSnapPoint:u,shouldFade:y,getPercentageDragged:I,setActiveSnapPoint:f,activeSnapPointIndex:m,onRelease:b,onDrag:A,snapPointsOffset:g}}const al=()=>()=>{};function il(){const{direction:e,isOpen:t,shouldScaleBackground:n,setBackgroundColorOnScale:r,noBodyStyles:s}=et(),a=p.useRef(null),l=p.useMemo(()=>document.body.style.backgroundColor,[]);function i(){return(window.innerWidth-Ut)/window.innerWidth}p.useEffect(()=>{if(t&&n){a.current&&clearTimeout(a.current);const c=document.querySelector("[data-vaul-drawer-wrapper]")||document.querySelector("[vaul-drawer-wrapper]");if(!c)return;tl(r&&!s?It(document.body,{background:"black"}):al,It(c,{transformOrigin:X(e)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${K.DURATION}s`,transitionTimingFunction:`cubic-bezier(${K.EASE.join(",")})`}));const d=It(c,{borderRadius:`${ro}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()=>{d(),a.current=window.setTimeout(()=>{l?document.body.style.background=l:document.body.style.removeProperty("background")},K.DURATION*1e3)}}},[t,n,l])}let Ze=null;function ll({isOpen:e,modal:t,nested:n,hasBeenOpened:r,preventScrollRestoration:s,noBodyStyles:a}){const[l,i]=p.useState(()=>typeof window<"u"?window.location.href:""),c=p.useRef(0),d=p.useCallback(()=>{if(Pn()&&Ze===null&&e&&!a){Ze={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:x}=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 v=x-window.innerHeight;v&&c.current>=x&&(document.body.style.top=`${-(c.current+v)}px`)}),300)}},[e]),u=p.useCallback(()=>{if(Pn()&&Ze!==null&&!a){const f=-parseInt(document.body.style.top,10),x=-parseInt(document.body.style.left,10);Object.assign(document.body.style,Ze),window.requestAnimationFrame(()=>{if(s&&l!==window.location.href){i(window.location.href);return}window.scrollTo(x,f)}),Ze=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]")||u()}},[t,u]),p.useEffect(()=>{n||!r||(e?(!window.matchMedia("(display-mode: standalone)").matches&&d(),t||window.setTimeout(()=>{u()},500)):u())},[e,r,l,t,n,d,u]),{restorePositionSetting:u}}function cl({open:e,onOpenChange:t,children:n,onDrag:r,onRelease:s,snapPoints:a,shouldScaleBackground:l=!1,setBackgroundColorOnScale:i=!0,closeThreshold:c=nl,scrollLockTimeout:d=rl,dismissible:u=!0,handleOnly:f=!1,fadeFromIndex:x=a&&a.length-1,activeSnapPoint:v,setActiveSnapPoint:w,fixed:m,modal:y=!0,onClose:g,nested:k,noBodyStyles:N=!1,direction:b="bottom",defaultOpen:A=!1,disablePreventScroll:I=!0,snapToSequentialPoint:j=!1,preventScrollRestoration:C=!1,repositionInputs:R=!0,onAnimationEnd:B,container:L,autoFocus:D=!1}){var _,V;const[W=!1,G]=so({defaultProp:A,prop:e,onChange:M=>{t?.(M),!M&&!k&&bo(),setTimeout(()=>{B?.(M)},K.DURATION*1e3),M&&!y&&typeof window<"u"&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),M||(document.body.style.pointerEvents="auto")}}),[H,S]=p.useState(!1),[ne,oe]=p.useState(!1),[Ne,ue]=p.useState(!1),U=p.useRef(null),Q=p.useRef(null),ie=p.useRef(null),he=p.useRef(null),$=p.useRef(null),fe=p.useRef(!1),xe=p.useRef(null),ge=p.useRef(0),le=p.useRef(!1),Se=p.useRef(!A),sn=p.useRef(0),P=p.useRef(null),an=p.useRef(((_=P.current)==null?void 0:_.getBoundingClientRect().height)||0),ln=p.useRef(((V=P.current)==null?void 0:V.getBoundingClientRect().width)||0),yt=p.useRef(0),ho=p.useCallback(M=>{a&&M===qe.length-1&&(Q.current=new Date)},[]),{activeSnapPoint:xo,activeSnapPointIndex:Oe,setActiveSnapPoint:cn,onRelease:go,snapPointsOffset:qe,onDrag:vo,shouldFade:dn,getPercentageDragged:wo}=sl({snapPoints:a,activeSnapPointProp:v,setActiveSnapPointProp:w,drawerRef:P,fadeFromIndex:x,overlayRef:U,onSnapPointChange:ho,direction:b,container:L,snapToSequentialPoint:j});Ki({isDisabled:!W||ne||!y||Ne||!H||!R||!I});const{restorePositionSetting:bo}=ll({isOpen:W,modal:y,nested:k??!1,hasBeenOpened:H,preventScrollRestoration:C,noBodyStyles:N});function tt(){return(window.innerWidth-Ut)/window.innerWidth}function yo(M){var z,q;!u&&!a||P.current&&!P.current.contains(M.target)||(an.current=((z=P.current)==null?void 0:z.getBoundingClientRect().height)||0,ln.current=((q=P.current)==null?void 0:q.getBoundingClientRect().width)||0,oe(!0),ie.current=new Date,Xr()&&window.addEventListener("touchend",()=>fe.current=!1,{once:!0}),M.target.setPointerCapture(M.pointerId),ge.current=X(b)?M.pageY:M.pageX)}function un(M,z){var q;let F=M;const Z=(q=window.getSelection())==null?void 0:q.toString(),re=P.current?ut(P.current,b):null,te=new Date;if(F.tagName==="SELECT"||F.hasAttribute("data-vaul-no-drag")||F.closest("[data-vaul-no-drag]"))return!1;if(b==="right"||b==="left")return!0;if(Q.current&&te.getTime()-Q.current.getTime()<500)return!1;if(re!==null&&(b==="bottom"?re>0:re<0))return!0;if(Z&&Z.length>0)return!1;if($.current&&te.getTime()-$.current.getTime()<d&&re===0||z)return $.current=te,!1;for(;F;){if(F.scrollHeight>F.clientHeight){if(F.scrollTop!==0)return $.current=new Date,!1;if(F.getAttribute("role")==="dialog")return!0}F=F.parentNode}return!0}function Co(M){if(P.current&&ne){const z=b==="bottom"||b==="right"?1:-1,q=(ge.current-(X(b)?M.pageY:M.pageX))*z,F=q>0,Z=a&&!u&&!F;if(Z&&Oe===0)return;const re=Math.abs(q),te=document.querySelector("[data-vaul-drawer-wrapper]"),ve=b==="bottom"||b==="top"?an.current:ln.current;let se=re/ve;const Ee=wo(re,F);if(Ee!==null&&(se=Ee),Z&&se>=1||!fe.current&&!un(M.target,F))return;if(P.current.classList.add(Dt),fe.current=!0,ee(P.current,{transition:"none"}),ee(U.current,{transition:"none"}),a&&vo({draggedDistance:q}),F&&!a){const ce=el(q),nt=Math.min(ce*-1,0)*z;ee(P.current,{transform:X(b)?`translate3d(0, ${nt}px, 0)`:`translate3d(${nt}px, 0, 0)`});return}const we=1-se;if((dn||x&&Oe===x-1)&&(r?.(M,se),ee(U.current,{opacity:`${we}`,transition:"none"},!0)),te&&U.current&&l){const ce=Math.min(tt()+se*(1-tt()),1),nt=8-se*8,mn=Math.max(0,14-se*14);ee(te,{borderRadius:`${nt}px`,transform:X(b)?`scale(${ce}) translate3d(0, ${mn}px, 0)`:`scale(${ce}) translate3d(${mn}px, 0, 0)`,transition:"none"},!0)}if(!a){const ce=re*z;ee(P.current,{transform:X(b)?`translate3d(0, ${ce}px, 0)`:`translate3d(${ce}px, 0, 0)`})}}}p.useEffect(()=>{window.requestAnimationFrame(()=>{Se.current=!0})},[]),p.useEffect(()=>{var M;function z(){if(!P.current||!R)return;const q=document.activeElement;if(Ht(q)||le.current){var F;const Z=((F=window.visualViewport)==null?void 0:F.height)||0,re=window.innerHeight;let te=re-Z;const ve=P.current.getBoundingClientRect().height||0,se=ve>re*.8;yt.current||(yt.current=ve);const Ee=P.current.getBoundingClientRect().top;if(Math.abs(sn.current-te)>60&&(le.current=!le.current),a&&a.length>0&&qe&&Oe){const we=qe[Oe]||0;te+=we}if(sn.current=te,ve>Z||le.current){const we=P.current.getBoundingClientRect().height;let ce=we;we>Z&&(ce=Z-(se?Ee:Ut)),m?P.current.style.height=`${we-Math.max(te,0)}px`:P.current.style.height=`${Math.max(ce,Z-Ee)}px`}else zi()||(P.current.style.height=`${yt.current}px`);a&&a.length>0&&!le.current?P.current.style.bottom="0px":P.current.style.bottom=`${Math.max(te,0)}px`}}return(M=window.visualViewport)==null||M.addEventListener("resize",z),()=>{var q;return(q=window.visualViewport)==null?void 0:q.removeEventListener("resize",z)}},[Oe,a,qe]);function Ge(M){ko(),g?.(),M||G(!1),setTimeout(()=>{a&&cn(a[0])},K.DURATION*1e3)}function fn(){if(!P.current)return;const M=document.querySelector("[data-vaul-drawer-wrapper]"),z=ut(P.current,b);ee(P.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${K.DURATION}s cubic-bezier(${K.EASE.join(",")})`}),ee(U.current,{transition:`opacity ${K.DURATION}s cubic-bezier(${K.EASE.join(",")})`,opacity:"1"}),l&&z&&z>0&&W&&ee(M,{borderRadius:`${ro}px`,overflow:"hidden",...X(b)?{transform:`scale(${tt()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${tt()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${K.DURATION}s`,transitionTimingFunction:`cubic-bezier(${K.EASE.join(",")})`},!0)}function ko(){!ne||!P.current||(P.current.classList.remove(Dt),fe.current=!1,oe(!1),he.current=new Date)}function jo(M){if(!ne||!P.current)return;P.current.classList.remove(Dt),fe.current=!1,oe(!1),he.current=new Date;const z=ut(P.current,b);if(!M||!un(M.target,!1)||!z||Number.isNaN(z)||ie.current===null)return;const q=he.current.getTime()-ie.current.getTime(),F=ge.current-(X(b)?M.pageY:M.pageX),Z=Math.abs(F)/q;if(Z>.05&&(ue(!0),setTimeout(()=>{ue(!1)},200)),a){go({draggedDistance:F*(b==="bottom"||b==="right"?1:-1),closeDrawer:Ge,velocity:Z,dismissible:u}),s?.(M,!0);return}if(b==="bottom"||b==="right"?F>0:F<0){fn(),s?.(M,!0);return}if(Z>no){Ge(),s?.(M,!1);return}var re;const te=Math.min((re=P.current.getBoundingClientRect().height)!=null?re:0,window.innerHeight);var ve;const se=Math.min((ve=P.current.getBoundingClientRect().width)!=null?ve:0,window.innerWidth),Ee=b==="left"||b==="right";if(Math.abs(z)>=(Ee?se:te)*c){Ge(),s?.(M,!1);return}s?.(M,!0),fn()}p.useEffect(()=>(W&&(ee(document.documentElement,{scrollBehavior:"auto"}),Q.current=new Date),()=>{Ji(document.documentElement,"scrollBehavior")}),[W]);function No(M){const z=M?(window.innerWidth-_e)/window.innerWidth:1,q=M?-_e:0;xe.current&&window.clearTimeout(xe.current),ee(P.current,{transition:`transform ${K.DURATION}s cubic-bezier(${K.EASE.join(",")})`,transform:X(b)?`scale(${z}) translate3d(0, ${q}px, 0)`:`scale(${z}) translate3d(${q}px, 0, 0)`}),!M&&P.current&&(xe.current=setTimeout(()=>{const F=ut(P.current,b);ee(P.current,{transition:"none",transform:X(b)?`translate3d(0, ${F}px, 0)`:`translate3d(${F}px, 0, 0)`})},500))}function So(M,z){if(z<0)return;const q=(window.innerWidth-_e)/window.innerWidth,F=q+z*(1-q),Z=-_e+z*_e;ee(P.current,{transform:X(b)?`scale(${F}) translate3d(0, ${Z}px, 0)`:`scale(${F}) translate3d(${Z}px, 0, 0)`,transition:"none"})}function Eo(M,z){const q=X(b)?window.innerHeight:window.innerWidth,F=z?(q-_e)/q:1,Z=z?-_e:0;z&&ee(P.current,{transition:`transform ${K.DURATION}s cubic-bezier(${K.EASE.join(",")})`,transform:X(b)?`scale(${F}) translate3d(0, ${Z}px, 0)`:`scale(${F}) translate3d(${Z}px, 0, 0)`})}return p.useEffect(()=>{y||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[y]),p.createElement(Li,{defaultOpen:A,onOpenChange:M=>{!u&&!M||(M?S(!0):Ge(!0),G(M))},open:W},p.createElement(Qr.Provider,{value:{activeSnapPoint:xo,snapPoints:a,setActiveSnapPoint:cn,drawerRef:P,overlayRef:U,onOpenChange:t,onPress:yo,onRelease:jo,onDrag:Co,dismissible:u,shouldAnimate:Se,handleOnly:f,isOpen:W,isDragging:ne,shouldFade:dn,closeDrawer:Ge,onNestedDrag:So,onNestedOpenChange:No,onNestedRelease:Eo,keyboardIsOpen:le,modal:y,snapPointsOffset:qe,activeSnapPointIndex:Oe,direction:b,shouldScaleBackground:l,setBackgroundColorOnScale:i,noBodyStyles:N,container:L,autoFocus:D}},n))}const ao=p.forwardRef(function({...e},t){const{overlayRef:n,snapPoints:r,onRelease:s,shouldFade:a,isOpen:l,modal:i,shouldAnimate:c}=et(),d=eo(t,n),u=r&&r.length>0;if(!i)return null;const f=p.useCallback(x=>s(x),[s]);return p.createElement(Oi,{onMouseUp:f,ref:d,"data-vaul-overlay":"","data-vaul-snap-points":l&&u?"true":"false","data-vaul-snap-points-overlay":l&&a?"true":"false","data-vaul-animate":c?.current?"true":"false",...e})});ao.displayName="Drawer.Overlay";const io=p.forwardRef(function({onPointerDownOutside:e,style:t,onOpenAutoFocus:n,...r},s){const{drawerRef:a,onPress:l,onRelease:i,onDrag:c,keyboardIsOpen:d,snapPointsOffset:u,activeSnapPointIndex:f,modal:x,isOpen:v,direction:w,snapPoints:m,container:y,handleOnly:g,shouldAnimate:k,autoFocus:N}=et(),[b,A]=p.useState(!1),I=eo(s,a),j=p.useRef(null),C=p.useRef(null),R=p.useRef(!1),B=m&&m.length>0;il();const L=(_,V,W=0)=>{if(R.current)return!0;const G=Math.abs(_.y),H=Math.abs(_.x),S=H>G,ne=["bottom","right"].includes(V)?1:-1;if(V==="left"||V==="right"){if(!(_.x*ne<0)&&H>=0&&H<=W)return S}else if(!(_.y*ne<0)&&G>=0&&G<=W)return!S;return R.current=!0,!0};p.useEffect(()=>{B&&window.requestAnimationFrame(()=>{A(!0)})},[]);function D(_){j.current=null,R.current=!1,i(_)}return p.createElement(Ii,{"data-vaul-drawer-direction":w,"data-vaul-drawer":"","data-vaul-delayed-snap-points":b?"true":"false","data-vaul-snap-points":v&&B?"true":"false","data-vaul-custom-container":y?"true":"false","data-vaul-animate":k?.current?"true":"false",...r,ref:I,style:u&&u.length>0?{"--snap-point-height":`${u[f??0]}px`,...t}:t,onPointerDown:_=>{g||(r.onPointerDown==null||r.onPointerDown.call(r,_),j.current={x:_.pageX,y:_.pageY},l(_))},onOpenAutoFocus:_=>{n?.(_),N||_.preventDefault()},onPointerDownOutside:_=>{if(e?.(_),!x||_.defaultPrevented){_.preventDefault();return}d.current&&(d.current=!1)},onFocusOutside:_=>{if(!x){_.preventDefault();return}},onPointerMove:_=>{if(C.current=_,g||(r.onPointerMove==null||r.onPointerMove.call(r,_),!j.current))return;const V=_.pageY-j.current.y,W=_.pageX-j.current.x,G=_.pointerType==="touch"?10:2;L({x:W,y:V},w,G)?c(_):(Math.abs(W)>G||Math.abs(V)>G)&&(j.current=null)},onPointerUp:_=>{r.onPointerUp==null||r.onPointerUp.call(r,_),j.current=null,R.current=!1,i(_)},onPointerOut:_=>{r.onPointerOut==null||r.onPointerOut.call(r,_),D(C.current)},onContextMenu:_=>{r.onContextMenu==null||r.onContextMenu.call(r,_),C.current&&D(C.current)}})});io.displayName="Drawer.Content";const dl=250,ul=120,fl=p.forwardRef(function({preventCycle:e=!1,children:t,...n},r){const{closeDrawer:s,isDragging:a,snapPoints:l,activeSnapPoint:i,setActiveSnapPoint:c,dismissible:d,handleOnly:u,isOpen:f,onPress:x,onDrag:v}=et(),w=p.useRef(null),m=p.useRef(!1);function y(){if(m.current){N();return}window.setTimeout(()=>{g()},ul)}function g(){if(a||e||m.current){N();return}if(N(),!l||l.length===0){d||s();return}if(i===l[l.length-1]&&d){s();return}const A=l.findIndex(j=>j===i);if(A===-1)return;const I=l[A+1];c(I)}function k(){w.current=window.setTimeout(()=>{m.current=!0},dl)}function N(){w.current&&window.clearTimeout(w.current),m.current=!1}return p.createElement("div",{onClick:y,onPointerCancel:N,onPointerDown:b=>{u&&x(b),k()},onPointerMove:b=>{u&&v(b)},ref:r,"data-vaul-drawer-visible":f?"true":"false","data-vaul-handle":"","aria-hidden":"true",...n},p.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},t))});fl.displayName="Drawer.Handle";function ml(e){const t=et(),{container:n=t.container,...r}=e;return p.createElement(Pi,{container:n,...r})}const Re={Root:cl,Content:io,Overlay:ao,Portal:ml,Close:Fi,Title:Di,Description:$i};function pl(e=768){const[t,n]=p.useState(!1);return p.useEffect(()=>{const r=()=>{n(window.innerWidth<e)};return r(),window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)},[e]),t}function tn({open:e,onOpenChange:t,children:n,title:r,description:s,className:a="",showCloseButton:l=!0}){return pl()?o.jsx(Re.Root,{open:e,onOpenChange:t,children:o.jsxs(Re.Portal,{children:[o.jsx(Re.Overlay,{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm"}),o.jsxs(Re.Content,{className:`fixed inset-x-0 bottom-0 z-50 mt-24 flex max-h-[96vh] flex-col rounded-t-2xl bg-[var(--optimex-surface)] border-t border-white/[0.05] outline-none ${a}`,children:[o.jsx("div",{className:"mx-auto mt-4 h-1.5 w-12 flex-shrink-0 rounded-full bg-white/20"}),(r||l)&&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:[r&&o.jsx(Re.Title,{className:"text-lg font-bold text-white",children:r}),s&&o.jsx(Re.Description,{className:"text-sm text-white/40",children:s})]}),l&&o.jsx(Re.Close,{className:"rounded-lg p-1.5 text-white/40 transition-colors hover:bg-white/10 hover:text-white/60",children:o.jsx(Ae,{})})]}),o.jsx("div",{className:"flex-1 overflow-auto",children:n})]})]})}):e?o.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[o.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:()=>t(!1)}),o.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":r?"modal-title":void 0,"aria-describedby":s?"modal-description":void 0,className:`relative z-10 flex max-h-[90vh] flex-col rounded-2xl bg-[var(--optimex-surface)] border border-white/[0.05] shadow-2xl ${a}`,children:[(r||l)&&o.jsxs("div",{className:"flex items-center justify-between border-b border-white/[0.05] p-4",children:[o.jsxs("div",{children:[r&&o.jsx("h2",{id:"modal-title",className:"text-lg font-bold text-white",children:r}),s&&o.jsx("p",{id:"modal-description",className:"text-sm text-white/40",children:s})]}),l&&o.jsx("button",{onClick:()=>t(!1),className:"rounded-lg p-1.5 text-white/40 transition-colors hover:bg-white/10 hover:text-white/60",children:o.jsx(Ae,{})})]}),o.jsx("div",{className:"flex-1 overflow-auto",children:n})]})]}):null}const hl=({children:e,className:t=""})=>o.jsx("div",{className:`p-4 ${t}`,children:e}),xl=({children:e,className:t=""})=>o.jsx("div",{className:`flex gap-2 border-t border-white/[0.05] p-4 ${t}`,children:e});function qt({children:e,onClick:t,isActive:n=!1,type:r="button",className:s=""}){return o.jsx("button",{type:r,onClick:t,className:vr(`px-2 py-1 bg-zinc-800/80 rounded-md text-xs transition-colors shadow-sm border ${n?"border-[var(--optimex-primary)]":"border-transparent text-white hover:bg-white/10 hover:text-white"} ${s}`),children:e})}const gl={"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"},vl={"bottom-right":"-top-2 right-4 rotate-45 border-l border-t","bottom-left":"-top-2 left-4 rotate-45 border-l border-t","bottom-center":"-top-2 left-1/2 -translate-x-1/2 rotate-45 border-l border-t","top-right":"-bottom-2 right-4 rotate-45 border-r border-b","top-left":"-bottom-2 left-4 rotate-45 border-r border-b","top-center":"-bottom-2 left-1/2 -translate-x-1/2 rotate-45 border-r border-b"};function wl({isOpen:e,onClose:t,children:n,anchorRef:r,position:s="bottom-right",width:a="w-72",showArrow:l=!0,className:i="",ariaLabel:c}){const d=p.useRef(null);return p.useEffect(()=>{if(!e)return;const u=v=>{const w=v.target;d.current?.contains(w)||r?.current?.contains(w)||t()},f=v=>{v.key==="Escape"&&t()},x=setTimeout(()=>{document.addEventListener("mousedown",u),document.addEventListener("keydown",f)},0);return()=>{clearTimeout(x),document.removeEventListener("mousedown",u),document.removeEventListener("keydown",f)}},[e,t,r]),e?o.jsxs("div",{ref:d,className:`absolute z-50 rounded-[0.25rem] border border-[var(--optimex-border)] bg-[var(--optimex-surface)] p-4 shadow-lg ${gl[s]} ${a} ${i}`,role:"dialog","aria-label":c,children:[l&&o.jsx("div",{className:`absolute h-4 w-4 border-[var(--optimex-border)] bg-[var(--optimex-surface)] ${vl[s]}`}),o.jsx("div",{className:"relative",children:n})]}):null}function bl({value:e,onChange:t,placeholder:n,hasError:r=!1,leftIcon:s,rightContent:a,type:l="text",inputMode:i="text",disabled:c=!1,className:d=""}){return o.jsxs("div",{className:`flex rounded-md items-center gap-2 bg-white/5 border py-3 px-3 transition-colors ${r?"border-red-500":"border-white/10 hover:border-[var(--optimex-primary)] focus-within:border-[var(--optimex-primary)]"} ${c?"opacity-50 cursor-not-allowed":""} ${d}`,children:[s&&o.jsx(s,{className:"size-5 text-white/40 shrink-0"}),o.jsx("input",{type:l,inputMode:i,value:e,onChange:u=>t(u.target.value),placeholder:n,disabled:c,className:"flex-1 min-w-0 bg-transparent text-white text-sm placeholder:text-white/10 outline-none disabled:cursor-not-allowed"}),a]})}const yl={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 Le({token:e,size:t="md",showNetworkBadge:n=!0}){const r=yl[t];return o.jsxs("div",{className:`relative shrink-0 ${r.container}`,children:[o.jsx("img",{src:e.token_logo_uri||"/placeholder-token.svg",alt:e.token_symbol,className:`${r.icon} rounded-full bg-[var(--optimex-background)]`,onError:s=>{s.target.src="/placeholder-token.svg"}}),n&&e.network_logo_uri&&o.jsx("img",{src:e.network_logo_uri,alt:e.network_name,className:`absolute -bottom-1 -right-1 ${r.badge} rounded-full border-2 border-[var(--optimex-surface)]`,onError:s=>{s.target.style.display="none"}})]})}const Cl="glass-container rounded-3xl p-4 shadow-2xl relative w-full min-w-0";function nn({children:e,className:t}){return o.jsx("div",{className:t??Cl,children:e})}function kl(){return o.jsxs("div",{className:"relative size-20 mb-4",children:[o.jsx("div",{className:"absolute inset-0 rounded-full bg-red-500/10 animate-pulse"}),o.jsx("div",{className:"absolute inset-2 rounded-full bg-red-500/20"}),o.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:o.jsx(ns,{className:"size-10 text-red-500"})})]})}function jl({error:e,onRetry:t,className:n}){const r=()=>{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(nn,{className:n,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(kl,{}),o.jsx("h3",{className:"text-base font-bold text-white mb-1",children:"Oops! Something went wrong"}),o.jsx("p",{className:"text-sm text-white/40 mb-6 max-w-[280px]",children:r()}),o.jsx(or,{onClick:t,size:"md",fullWidth:!0,leftIcon:o.jsx(ts,{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-white/30 hover:text-white/50 transition-colors",children:"Technical details"}),o.jsx("p",{className:"mt-2 bg-white/5 p-3 text-left text-xs text-white/40 break-all border border-white/[0.02]",children:e.message})]})]})})})}function Nl({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(nn,{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 lo=p.createContext(null);function Sl({children:e}){const t=Je(),{data:n,isLoading:r,error:s,refetch:a}=Po(t.apiBaseUrl),l=t.renderLoading??Nl,i=t.renderError??jl;if(r)return o.jsx(l,{});if(s||!n){const c=s instanceof Error?s:new Error("Failed to load tokens");return o.jsx(i,{error:c,onRetry:()=>a()})}return o.jsx(lo.Provider,{value:{tokensData:n,refetch:a},children:e})}function El(){const e=p.useContext(lo);if(!e)throw new Error("useTokensData must be used within TokensProvider");return e}function Tl({token:e,value:t,onChange:n,placeholder:r,error:s,onClose:a}){const l=p.useCallback(()=>{n("")},[n]),i=p.useCallback(async()=>{try{const f=await navigator.clipboard.readText();f&&n(f.trim())}catch(f){console.error("Failed to read clipboard:",f)}},[n]),c=()=>r||(e?`Enter ${e.network_name} address`:"Enter receiving address"),d=e?.network_name||"destination",u=p.useMemo(()=>ss(e?.network_name)||Zn,[e?.network_name]);return o.jsxs("div",{className:"bg-[var(--optimex-surface)] rounded-2xl 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-white/40 text-xs",children:"Recipient Address"}),a&&o.jsx("button",{type:"button",onClick:l,className:"text-white/20 hover:text-white/40 transition-colors",children:o.jsx(Ae,{className:"size-4"})})]}),o.jsx(bl,{value:t,onChange:n,placeholder:c(),hasError:!!s,leftIcon:u,rightContent:t?o.jsx("button",{type:"button",onClick:l,className:"text-white/40 hover:text-white/60 transition-colors",children:o.jsx(Ae,{className:"size-5"})}):o.jsx("button",{type:"button",onClick:i,className:"text-white/40 hover:text-[var(--optimex-primary)] transition-colors",children:o.jsx(es,{className:"size-5"})})}),s?o.jsxs("p",{className:"text-[10px] text-red-500 mt-2 flex items-center gap-1",children:[o.jsx(pn,{className:"size-3"}),s]}):o.jsxs("p",{className:"text-[10px] text-white/40 mt-2 flex items-center gap-1",children:[o.jsx(pn,{className:"size-3"}),"Ensure the address matches the ",d," network."]})]})}function $n({token:e,value:t,onChange:n,readOnly:r=!1,onSelectToken:s,isLoading:a=!1,loadingText:l="Loading...",balance:i,isOutput:c=!1,isWalletConnected:d=!1,usdValue:u="$0.00"}){const f=m=>{if(r||!n)return;const y=m.target.value;/^[0-9]*\.?[0-9]*$/.test(y)&&n(y)},x=d&&!c&&i!==void 0,v=()=>{if(!i||!n||r)return;const m=(parseFloat(i)/2).toString();n(m)},w=()=>{!i||!n||r||n(i)};return o.jsxs("div",{className:"bg-[var(--optimex-surface)] rounded-2xl 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-white/40 text-xs",children:c?"To":"From"}),o.jsx("div",{className:"flex items-center gap-2",children:x&&o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"text-white/40 text-xs",children:["Balance: ",i," ",e?.token_symbol]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(qt,{onClick:v,children:"50%"}),o.jsx(qt,{onClick:w,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:f,readOnly:r,className:"w-full bg-transparent border-none p-0 text-white text-2xl font-bold focus:ring-0 placeholder:text-white/10 outline-none"}),o.jsxs("p",{className:"text-white/30 text-xs mt-1",children:["~",u]})]}),o.jsxs("button",{onClick:s,className:"flex items-center gap-2 bg-white/5 hover:bg-white/10 p-2 pr-3 rounded-full transition-all border border-white/10 active:scale-95 shrink-0",children:[e?o.jsxs(o.Fragment,{children:[o.jsx(Le,{token:e,size:"md"}),o.jsxs("div",{className:"text-left",children:[o.jsx("p",{className:"text-white text-sm font-bold leading-none",children:e.token_symbol}),o.jsx("p",{className:"text-white/40 text-[10px] leading-none mt-1",children:e.network_name})]})]}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"size-8 rounded-full bg-white/10"}),o.jsx("span",{className:"text-white text-sm font-bold",children:"Select"})]}),o.jsx(Kn,{className:"size-4 text-white/20"})]})]}),a&&o.jsxs("div",{className:"flex items-center justify-end gap-2 text-sm text-white/40",children:[o.jsx("div",{className:"size-3 animate-spin rounded-full border border-[var(--optimex-primary)] border-t-transparent"}),o.jsx("span",{children:l})]})]})}const $t=[.5,.75,1];function _l({value:e,onChange:t}){const[n,r]=p.useState(""),[s,a]=p.useState(!$t.includes(e)),l=p.useCallback(d=>{a(!1),r(""),t(d)},[t]),i=p.useCallback(d=>{const u=d.target.value;if(u===""||/^\d*\.?\d*$/.test(u)){r(u),a(!0);const f=parseFloat(u);!isNaN(f)&&f>0&&f<=50&&t(f)}},[t]),c=p.useCallback(()=>{a(!0),!n&&e&&r($t.includes(e)?"":String(e))},[n,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:[$t.map(d=>o.jsxs(qt,{onClick:()=>l(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-zinc-800/80 border ${s?"border-[var(--optimex-primary)]":"border-transparent hover:bg-white/10"}`,children:[o.jsx("input",{type:"text",inputMode:"decimal",placeholder:"Custom",value:n,onChange:i,onFocus:c,className:"w-full min-w-0 py-[6px] bg-transparent text-center text-xs outline-none placeholder:text-white/50 text-white"}),o.jsx("span",{className:"text-xs text-white/50",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 Rl({isOpen:e,onClose:t,value:n,onChange:r,anchorRef:s}){const a=p.useCallback(l=>{r(l)},[r]);return o.jsx(wl,{isOpen:e,onClose:t,anchorRef:s,position:"bottom-right",width:"w-96",ariaLabel:"Slippage settings",children:o.jsx(_l,{value:n,onChange:a})})}function Al({title:e="Swap",slippage:t=.75,onSlippageChange:n,isSettingsOpen:r=!1,onSettingsToggle:s,onHistoryClick:a,hideHistory:l=!1}){const i=p.useRef(null);return 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 bg-[var(--optimex-primary)] rounded-lg flex items-center justify-center shadow-[0_0_15px_rgba(235,98,0,0.3)]",children:o.jsx(Xo,{className:"w-5 h-auto text-white"})}),o.jsx("h2",{className:"text-xl font-bold tracking-tight text-[var(--optimex-text)]",children:e})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[!l&&o.jsx("button",{onClick:a,className:"size-10 rounded-lg bg-white/5 hover:bg-white/10 text-white/60 hover:text-white transition-colors flex items-center justify-center","aria-label":"Trade History",children:o.jsx(Zo,{className:"size-5"})}),o.jsxs("div",{className:"relative",children:[o.jsx("button",{ref:i,onClick:s,className:"size-10 rounded-lg bg-white/5 hover:bg-white/10 text-white/60 hover:text-white transition-colors flex items-center justify-center","aria-label":"Settings",children:o.jsx(os,{className:"size-5"})}),o.jsx(Rl,{isOpen:r,onClose:()=>s?.(),value:t,onChange:c=>n?.(c),anchorRef:i})]})]})]})}function co({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-full 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(Go,{className:"size-5"})})})}function Ml({quote:e,fromToken:t,toToken:n,amount:r,slippage:s,isFetching:a}){const[l,i]=p.useState(!1),[c,d]=p.useState(!1),u=p.useCallback(()=>{d(g=>!g)},[]),f=p.useCallback(()=>{i(g=>!g)},[]),x=parseFloat(r)||0,v=parseFloat(e.min_amount_out)/Math.pow(10,n.token_decimals),w=x>0?v/x:0,m=v>0?x/v:0,y=()=>c?`1 ${n.token_symbol} = ${m.toFixed(6)} ${t.token_symbol}`:`1 ${t.token_symbol} = ${w.toFixed(6)} ${n.token_symbol}`;return o.jsxs("div",{className:"bg-white/[0.02] rounded-md border border-white/5 overflow-hidden",children:[o.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:[o.jsx("div",{className:"flex items-center gap-2 text-white/60 font-medium",children:a?o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"size-3 animate-spin rounded-full border border-[var(--optimex-primary)] border-t-transparent"}),o.jsx("span",{children:"Updating..."})]}):o.jsx("span",{role:"button",tabIndex:0,onClick:g=>{g.stopPropagation(),u()},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.stopPropagation(),u())},className:"hover:text-white transition-colors",children:y()})}),o.jsx(Kn,{className:`size-4 text-white/40 transition-transform ${l?"rotate-180":""}`})]}),l&&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-white/40",children:"Min. Received"}),o.jsxs("span",{className:"font-medium text-white",children:[je(e.min_amount_out,n.token_decimals)," ",n.token_symbol]})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-white/40",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-white/40",children:"Slippage Tolerance"}),o.jsxs("span",{className:"font-medium text-white",children:[s,"%"]})]})]})]})}function Ll({text:e,disabled:t,onClick:n}){return o.jsx("button",{disabled:t,onClick:n,className:"w-full font-semibold text-black bg-[var(--optimex-primary)] hover:bg-[var(--optimex-primary-hover)] hover:brightness-110 py-4 rounded-md 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 Pl(){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(Jo,{className:"h-3 w-auto"})]})}function Ol({value:e,onChange:t,placeholder:n="Search by name or symbol..."}){return o.jsx("div",{className:"p-4 pb-3",children:o.jsxs("div",{className:"relative",children:[o.jsx("input",{type:"text",placeholder:n,value:e,onChange:r=>t(r.target.value),className:"w-full rounded-xl bg-white/5 border border-white/10 px-4 py-3 pl-10 pr-10 text-white outline-none placeholder:text-white/30 transition-colors hover:border-[var(--optimex-primary)] focus:border-[var(--optimex-primary)]"}),o.jsx(rs,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-white/40"}),e&&o.jsx("button",{type:"button",onClick:()=>t(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-white/40 hover:text-white/60 transition-colors",children:o.jsx(Ae,{className:"size-5"})})]})})}function Il({networks:e,selectedNetwork:t,onSelectNetwork:n}){return o.jsxs("div",{className:"w-1/3 min-w-[140px] 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-white/40",children:"Networks"}),o.jsxs("div",{className:"space-y-1 px-2",children:[o.jsxs("button",{onClick:()=>n(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-white":"text-white/60 hover:bg-white/5 hover:text-white"}`,children:[o.jsx(qo,{}),o.jsx("span",{children:"All"})]}),e.map(r=>o.jsx(Dl,{network:r,isSelected:t===r.network_id,onSelect:()=>n(r.network_id)},r.network_id))]})]})}function Dl({network:e,isSelected:t,onSelect:n}){return o.jsxs("button",{onClick:n,className:`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm transition-colors ${t?"bg-white/5 text-white":"text-white/60 hover:bg-white/5 hover:text-white"}`,children:[e.logo_uri?o.jsx("img",{src:e.logo_uri,alt:e.name,className:"h-8 w-8 rounded-lg",onError:r=>{r.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 $l({tokens:e,selectedSymbol:t,onSelectSymbol:n,maxVisible:r=12}){return o.jsxs("div",{className:"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-white/40",children:"Tokens"}),o.jsxs("div",{className:"flex flex-wrap gap-1.5 overflow-hidden max-h-[5rem]",children:[o.jsx("button",{onClick:()=>n(null),className:`border rounded-lg px-2.5 py-1 text-xs font-medium transition-colors ${t===null?"border-[var(--optimex-primary)] text-white":"border-transparent text-white/60 hover:bg-white/10 hover:text-white"}`,children:"All"}),e.slice(0,r).map(s=>o.jsx(Fl,{token:s,isSelected:t===s.token_symbol,onSelect:()=>n(s.token_symbol)},s.token_symbol))]})]})}function Fl({token:e,isSelected:t,onSelect:n}){return o.jsxs("button",{onClick:n,className:vr("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-white":"border-transparent text-white/60 hover:bg-white/10 hover:text-white"),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:r=>{r.target.style.display="none"}}),e.token_symbol]})}function Ue(){const e=p.useContext(Hn);if(!e)throw new Error("useWallet must be used within WalletProvider");return e}function bt(e){return`https://network-api-stg.bitdex.xyz/${e}/rpc/zwD70RMT9DrE8L5SaMnJNMF8m70Gum`}function Bl(e){return e==="bitcoin_testnet"?"https://mempool.space/testnet4/api":"https://mempool.space/api"}function rn(e){return!e.token_address||e.token_address===""||e.token_address==="native"||e.token_address==="0x0000000000000000000000000000000000000000"}function zl(e,t){if(!e||e==="0")return"0";const n=BigInt(e),r=BigInt(10**t),s=n/r,a=n%r;if(a===BigInt(0))return s.toString();let l=a.toString().padStart(t,"0");return l=l.replace(/0+$/,""),l.length>6&&(l=l.slice(0,6)),`${s}.${l}`}function Vl(e){return`0x70a08231000000000000000000000000${e.toLowerCase().replace("0x","")}`}async function uo(e,t){const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw new Error(`RPC request failed: ${n.status}`);return n.json()}async function Wl(e,t){const r=await uo(e,{jsonrpc:"2.0",method:"eth_getBalance",params:[t,"latest"],id:1});if(r.error)throw new Error(`RPC error: ${r.error.message}`);const s=r.result||"0x0";return BigInt(s).toString()}async function Hl(e,t,n){const r={jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:Vl(n)},"latest"],id:1},s=await uo(e,r);if(s.error)throw new Error(`RPC error: ${s.error.message}`);const a=s.result||"0x0";return BigInt(a).toString()}async function Ul(e,t){const n=bt(e.network_id),r=rn(e);let s;return r?s=await Wl(n,t):s=await Hl(n,e.token_address,t),{rawBalance:s,isNative:r}}async function ql(e,t){const r=`${Bl(e.network_id)}/address/${t}`,s=await fetch(r);if(!s.ok)throw new Error(`Mempool API request failed: ${s.status}`);const a=await s.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 fo(e,t){const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw new Error(`RPC request failed: ${n.status}`);return n.json()}async function Gl(e,t){const r=await fo(e,{jsonrpc:"2.0",method:"getBalance",params:[t],id:1});if(r.error)throw new Error(`RPC error: ${r.error.message}`);return(r.result?.value||0).toString()}async function Kl(e,t,n){const s=await fo(e,{jsonrpc:"2.0",method:"getTokenAccountsByOwner",params:[n,{mint:t},{encoding:"jsonParsed"}],id:1});if(s.error)throw new Error(`RPC error: ${s.error.message}`);const a=s.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 Yl(e,t){const n=bt(e.network_id),r=rn(e);let s;return r?s=await Gl(n,t):s=await Kl(n,e.token_address,t),{rawBalance:s,isNative:r}}function Zl(e,t){if(!t)return!1;switch(t){case Y.EVM:return e.isEvmConnected;case Y.BTC:return e.isBtcConnected;case Y.SOLANA:return e.isSolanaConnected;default:return!1}}function Ql(e){if(!e)return"";switch(e){case Y.EVM:return"EVM";case Y.BTC:return"Bitcoin";case Y.SOLANA:return"Solana";default:return e}}function Xl(e,t){if(!t)return null;switch(t){case Y.EVM:return e.evmAddress;case Y.BTC:return e.btcAddress;case Y.SOLANA:return e.solanaAddress;default:return null}}async function Jl(e,t){const n=e.token_address||"native";let r;switch(e.network_type){case Y.BTC:r=await ql(e,t);break;case Y.SOLANA:r=await Yl(e,t);break;case Y.EVM:default:r=await Ul(e,t)}return{tokenId:n,networkId:e.network_id,walletAddress:t,rawBalance:r.rawBalance,formattedBalance:zl(r.rawBalance,e.token_decimals),updatedAt:Date.now()}}const ec=30*1e3,tc=15*1e3;function nc(e,t){return!e||!t?["balance"]:["balance",e.network_id,e.token_address||"native",t]}function mo({token:e,walletAddress:t,enabled:n=!0,polling:r=!1,pollingInterval:s=tc}){const a=n&&!!e&&!!t,{data:l,isLoading:i,isFetching:c,error:d,refetch:u}=ke.useQuery({queryKey:nc(e,t),queryFn:()=>Jl(e,t),enabled:a,staleTime:ec,retry:1,refetchOnWindowFocus:!1,refetchInterval:r?s:!1});return{balance:l,formattedBalance:l?.formattedBalance||"0",isLoading:a&&i,isFetching:a&&c,error:d,refetch:u}}function rc({token:e,isSelected:t,isDisabled:n,onSelect:r}){const s=Ue(),a=Xl(s,e.network_type),{formattedBalance:l,isLoading:i}=mo({token:e,walletAddress:a,enabled:!!a}),c=!!a;return o.jsxs("button",{onClick:r,disabled:n,className:`flex w-full items-center gap-3 rounded-lg p-2 transition-colors ${t?"bg-white/5 text-white":n?"cursor-not-allowed opacity-50":"hover:bg-white/5"}`,children:[o.jsx(Le,{token:e}),o.jsxs("div",{className:"flex-1 text-left",children:[o.jsx("div",{className:"text-sm text-white/40",children:e.token_name}),o.jsxs("div",{className:"flex items-center gap-2",children:[c&&o.jsx("span",{className:"text-sm font-medium text-white",children:i?o.jsx("span",{className:"inline-block h-4 w-12 animate-pulse rounded bg-white/10"}):l}),o.jsx("span",{className:"font-medium text-white",children:e.token_symbol})]})]}),t&&o.jsx(Yt,{className:"h-5 w-5 text-[var(--optimex-primary)]"})]})}function oc({tokens:e,selectedTokenId:t,disabledTokenId:n,disabledTokenIds:r,isLoading:s,emptyMessage:a="No tokens available",onSelect:l}){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-white/40",children:a})}):o.jsx("div",{className:"flex-1 overflow-y-auto p-2",children:o.jsx("div",{className:"space-y-1",children:e.map(i=>{const c=n===i.token_id||r?.has(i.token_id)===!0;return o.jsx(rc,{token:i,isSelected:t===i.token_id,isDisabled:c,onSelect:()=>l(i)},i.token_id)})})})}function sc({isOpen:e,onClose:t,onSelect:n,tokensData:r,isLoading:s,selectedToken:a,disabledTokenId:l,disabledTokenIds:i,tokens:c,emptyMessage:d,title:u="Select Token",filterNetworkType:f}){const[x,v]=p.useState(""),[w,m]=p.useState(null),[y,g]=p.useState(null),k=p.useMemo(()=>r?.supported_networks?f?r.supported_networks.filter(L=>L.type===f):r.supported_networks:[],[r,f]),N=c??r?.tokens,b=p.useMemo(()=>N?N.filter(L=>{if(f&&L.network_type!==f||w&&L.network_id!==w)return!1;if(x){const D=(V,W)=>V.toLowerCase().includes(W.toLowerCase()),_=x.toLowerCase();return D(L.token_symbol,_)||D(L.token_name,_)||D(L.token_address,_)}return!0}):[],[N,x,w,f]),A=p.useMemo(()=>{if(!N)return[];const L=new Map;return N.forEach(D=>{f&&D.network_type!==f||w&&D.network_id!==w||L.has(D.token_symbol)||L.set(D.token_symbol,D)}),Array.from(L.values())},[N,f,w]),I=p.useMemo(()=>y?b.filter(L=>L.token_symbol===y):b,[b,y]),j=()=>{v(""),m(null),g(null)},C=L=>{n(L),t(),j()},R=L=>{L||(t(),j())},B=L=>{m(L),g(null)};return o.jsx(tn,{open:e,onOpenChange:R,title:u,className:"h-full md:h-[70vh] max-h-[600px] w-full max-w-2xl",children:o.jsxs("div",{className:"flex h-full flex-col",children:[o.jsx(Ol,{value:x,onChange:v}),o.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[o.jsx(Il,{networks:k,selectedNetwork:w,onSelectNetwork:B}),o.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden pl-2",children:[o.jsx($l,{tokens:A,selectedSymbol:y,onSelectSymbol:g}),o.jsx(oc,{tokens:I,selectedTokenId:a?.token_id,disabledTokenId:l,disabledTokenIds:i,isLoading:s,emptyMessage:x?"No tokens found":d??"No tokens available",onSelect:C})]})]})]})})}function Fn({token:e,amount:t,label:n,isEstimated:r=!1,highlight:s=!1,usdValue:a="$0.00"}){return o.jsx("div",{className:`p-4 rounded-xl border transition-all duration-200 ${s?"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:o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("div",{className:"size-12 flex items-center justify-center ",children:o.jsx(Le,{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-zinc-500"}`,children:[n," ",r&&"(Est.)"]}),o.jsx("p",{className:"text-white text-sm font-semibold truncate",children:e.token_symbol}),o.jsx("p",{className:"text-zinc-500 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-white text-lg font-bold",children:r?`~${t}`:t}),o.jsx("p",{className:"text-zinc-400 text-xs",children:a})]})]})})}function ac({fromToken:e,toToken:t,fromAmount:n,toAmount:r,fromUsdValue:s="$0.00",toUsdValue:a="$0.00"}){return o.jsxs("div",{className:"relative flex flex-col gap-2",children:[o.jsx(Fn,{token:e,amount:n,label:"You Pay",usdValue:s}),o.jsx(co,{onClick:()=>{},disabled:!0}),o.jsx(Fn,{token:t,amount:r,label:"You Receive",usdValue:a})]})}function Ft({label:e,value:t,borderTop:n}){return o.jsxs("div",{className:`flex justify-between items-center text-sm ${n?"pt-2 mt-2 border-t border-white/5":""}`,children:[o.jsx("span",{className:"text-zinc-500",children:e}),o.jsx("div",{className:"flex items-center gap-1 text-white font-medium",children:t})]})}function ic({minReceived:e,estimatedTime:t,slippage:n,networkFee:r="Included"}){return o.jsxs("div",{className:"bg-[var(--optimex-surface)] rounded-xl p-4 border border-white/5 space-y-3",children:[o.jsx(Ft,{label:"Min. Received",value:e}),o.jsx(Ft,{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(Ft,{label:"Slippage Tolerance",value:n})]})}const lc=3e4,cc=6e4;function xt({symbol:e,enabled:t=!0}){const n=Je(),{data:r,isLoading:s,isError:a}=ke.useQuery({queryKey:["tokenPrice",e],queryFn:async()=>{if(!e)throw new Error("Symbol is required");return(await Ve(n.apiBaseUrl).getTokenPrice(e)).current_price},enabled:t&&!!e,staleTime:lc,refetchInterval:cc,retry:2});return{price:r??null,isLoading:s,isError:a,calculateUsdValue:i=>{if(!r||!i||isNaN(parseFloat(i)))return"$0.00";const c=parseFloat(i);if(c===0)return"$0.00";const d=c*r;return d<.01?"<$0.01":d<1?`$${d.toFixed(4)}`:d<1e3?`$${d.toFixed(2)}`:d<1e6?`$${(d/1e3).toFixed(2)}K`:`$${(d/1e6).toFixed(2)}M`}}}function dc({isOpen:e,onClose:t,onConfirm:n,fromToken:r,toToken:s,amountIn:a,quote:l,slippage:i,stage:c,receivingAddress:d=""}){const u=c!=="idle"&&c!=="confirming"&&c!=="error"&&c!=="submitted",f=c==="submitted",x=c==="error",v=je(l.min_amount_out,s.token_decimals),{calculateUsdValue:w}=xt({symbol:r.token_symbol,enabled:e}),{calculateUsdValue:m}=xt({symbol:s.token_symbol,enabled:e}),y=w(a),g=m(v),k=b=>{!b&&!u&&t()},N=f?"Swap Complete":x?"Swap Failed":"Review Swap";return o.jsxs(tn,{open:e,onOpenChange:k,title:N,showCloseButton:!u,className:"w-full max-w-md",children:[o.jsxs(hl,{className:"space-y-3",children:[o.jsx(ac,{fromToken:r,toToken:s,fromAmount:a,toAmount:v,fromUsdValue:y,toUsdValue:g}),o.jsx(ic,{minReceived:`${v} ${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(is,{icon:Zn,label:"Receiving Address",address:d})})]}),o.jsx(xl,{children:o.jsx(ea,{state:u?"processing":f?"success":x?"error":"idle",onConfirm:f?t:n,confirmText:"Confirm Swap"})})]})}function uc({swap:e}){const{tokens:t,modals:n,tokenSelect:r,actions:s,input:a,quote:l,execution:i}=e;return o.jsxs(o.Fragment,{children:[o.jsx(sc,{isOpen:n.tokenSelect.isOpen,onClose:n.tokenSelect.close,onSelect:s.selectToken,tokensData:t.data,isLoading:!1,selectedToken:r.type==="from"?t.from:t.to,disabledTokenId:r.type==="from"?t.to?.token_id:t.from?.token_id,tokens:r.type==="to"?t.availableTo:t.all,emptyMessage:r.type==="to"?"No available pairs for selected source token":void 0,title:r.type==="from"?"Select Source Token":"Select Destination Token"}),l.data&&t.from&&t.to&&o.jsx(dc,{isOpen:n.confirm.isOpen,onClose:s.closeConfirmModal,onConfirm:s.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 on({status:e}){const t={pending:{icon:Yn,text:"Processing",bgClass:"bg-yellow-500/10",textClass:"text-yellow-500",animate:!0},success:{icon:Yt,text:"Completed",bgClass:"bg-green-500/10",textClass:"text-green-500",animate:!1},failed:{icon:Ko,text:"Failed",bgClass:"bg-red-500/10",textClass:"text-red-500",animate:!1}},{icon:n,text:r,bgClass:s,textClass:a,animate:l}=t[e];return o.jsxs("div",{className:`flex items-center gap-1.5 px-2.5 py-1 rounded-full ${s}`,children:[o.jsx(n,{className:`w-4 h-4 ${a} ${l?"animate-spin":""}`}),o.jsx("span",{className:`text-xs font-medium ${a}`,children:r})]})}function fc({onClose:e}){return o.jsxs("div",{className:"bg-[var(--optimex-surface)] border border-[var(--optimex-border)] 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(on,{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(Ae,{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-[var(--optimex-border)] animate-pulse"}),o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx("div",{className:"w-16 h-4 bg-[var(--optimex-border)] rounded animate-pulse"}),o.jsx("div",{className:"w-10 h-3 bg-[var(--optimex-border)] 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-[var(--optimex-border)] rounded animate-pulse"}),o.jsx("div",{className:"w-10 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"})]})]})]})}function mc({trade:e,status:t,isLoading:n,onClose:r}){if(n||!e)return o.jsx(fc,{onClose:r});const s=e.from_token,a=e.to_token,l=je(e.amount_in,s.token_decimals),i=je(e.min_amount_out,a.token_decimals);return o.jsxs("div",{className:"bg-[var(--optimex-surface)] border border-[var(--optimex-border)] 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(on,{status:t}),r&&o.jsx("button",{onClick:r,className:"text-[var(--optimex-text-secondary)] hover:text-[var(--optimex-text)] transition-colors cursor-pointer","aria-label":"Close",children:o.jsx(Ae,{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(Le,{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:l}),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(Le,{token:a,size:"sm",showNetworkBadge:!1})]})]})]})}const pc=1e4;function hc({apiBaseUrl:e,walletAddresses:t,enabled:n=!0,limit:r=20}){const{data:s,isLoading:a,isError:l,refetch:i}=ke.useQuery({queryKey:["trades",t,r],queryFn:async()=>Ve(e).listTrades({from_user_address:t,limit:r}),enabled:n&&!!t?.length,refetchInterval:pc,retry:2,retryDelay:2e3});return{trades:s??[],isLoading:a,isError:l,refetch:i}}function xc(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 gc({trade:e}){const t=e.from_token,n=e.to_token,r=xc(e.state),s=je(e.amount_in,t.token_decimals),a=je(e.min_amount_out,n.token_decimals);return o.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-[var(--optimex-surface)] border border-[var(--optimex-border)]",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Le,{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:n.token_symbol})]}),o.jsx(Le,{token:n,size:"sm",showNetworkBadge:!1})]}),o.jsx("div",{className:"ml-3",children:o.jsx(on,{status:r})})]})}function Bt(){return o.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-[var(--optimex-surface)] border border-[var(--optimex-border)]",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 vc(){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 wc({open:e,onOpenChange:t,evmAddress:n,btcAddress:r,solanaAddress:s}){const a=Je(),l=[n,r,s].filter(d=>!!d),{trades:i,isLoading:c}=hc({apiBaseUrl:a.apiBaseUrl,walletAddresses:l.length>0?l:void 0,enabled:e&&l.length>0});return o.jsx(tn,{open:e,onOpenChange:t,title:"Trade History",className:"w-full max-w-md",children:o.jsxs("div",{className:"p-4 space-y-3 max-h-[60vh] overflow-y-auto",children:[c?o.jsxs(o.Fragment,{children:[o.jsx(Bt,{}),o.jsx(Bt,{}),o.jsx(Bt,{})]}):i.length===0?o.jsx(vc,{}):i.map(d=>o.jsx(gc,{trade:d},d.trade_id)),!c&&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(Yn,{className:"w-3 h-3 animate-spin"}),o.jsx("span",{children:"Auto-refreshing"})]})]})})}function bc(e,t){return p.useMemo(()=>{const n=e.trim();if(!t||!n)return{isValid:!n,error:void 0};const r=Kt(n,t.network_type,t.network_id);return{isValid:r.isValid,error:r.isValid?void 0:r.error}},[e,t])}function yc(){const[e,t]=p.useState(null),[n,r]=p.useState(!1),[s,a]=p.useState(!1),l=p.useCallback(()=>t("from"),[]),i=p.useCallback(()=>t("to"),[]),c=p.useCallback(()=>t(null),[]),d=p.useCallback(()=>r(!0),[]),u=p.useCallback(()=>r(!1),[]),f=p.useCallback(()=>a(v=>!v),[]),x=p.useCallback(()=>a(!1),[]);return{tokenSelect:{isOpen:e!==null,type:e,openFrom:l,openTo:i,close:c},confirm:{isOpen:n,open:d,close:u},settings:{isOpen:s,toggle:f,close:x}}}function Cc({fromToken:e,toToken:t,amount:n,fromUserAddress:r,toUserAddress:s,userRefundPubkey:a,slippage:l,config:i}){return p.useMemo(()=>{const c=s.trim(),d=i.affiliateAddress&&i.affiliateFee?[{provider:i.affiliateProvider??"optimex-widget",rate:String(i.affiliateFee),receiver:i.affiliateAddress,network:"ethereum"}]:void 0,u=Math.round(l*100);return{from_token:e,to_token:t,amount:n,from_user_address:r,to_user_address:c||null,user_refund_pubkey:a,slippage:String(u),affiliate_fee_bps:i.affiliateFee?String(i.affiliateFee):void 0,affiliate_info:d,trade_timeout:i.tradeTimeout,script_timeout:i.scriptTimeout}},[e,t,n,r,s,a,l,i.affiliateFee,i.affiliateAddress,i.affiliateProvider,i.tradeTimeout,i.scriptTimeout])}function kc(e,t){return p.useMemo(()=>{if(!e||!t)return{walletAccount:void 0,evmWalletAccount:void 0};switch(e.network_type){case Y.EVM:return{walletAccount:t.evm,evmWalletAccount:t.evm};case Y.BTC:return{walletAccount:t.btc,evmWalletAccount:void 0};case Y.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 jc(e){const{tokens:t,pairs:n,selectedFromToken:r}=e,s=p.useMemo(()=>{const v=new Map;if(!n)return v;for(const w of n){if(!w.is_active)continue;const m=v.get(w.from_token_id);m?m.add(w.to_token_id):v.set(w.from_token_id,new Set([w.to_token_id]))}return v},[n]),a=p.useMemo(()=>t??[],[t]),l=p.useMemo(()=>{const v=new Set;for(const w of a){const m=s.get(w.token_id);(!m||m.size===0)&&v.add(w.token_id)}return v},[a,s]),i=p.useMemo(()=>{if(!r)return[];const v=s.get(r.token_id);return!v||v.size===0?[]:a.filter(w=>v.has(w.token_id))},[r,s,a]),c=p.useCallback((v,w)=>s.get(v)?.has(w)??!1,[s]),d=p.useCallback(v=>(s.get(v)?.size??0)>0,[s]),u=p.useCallback(v=>[...v].sort((w,m)=>{const y=Bn[w.network_type]??99,g=Bn[m.network_type]??99;return y-g}),[]),f=p.useCallback(v=>{const w=s.get(v.token_id);if(!w||w.size===0)return null;const m=a.filter(g=>w.has(g.token_id));return m.length===0?null:u(m)[0]??null},[s,a,u]),x=p.useCallback(()=>{if(a.length===0)return null;const v=u(a);for(const w of v){const m=f(w);if(m)return{fromToken:w,toToken:m}}return null},[a,u,f]);return{allTokens:a,tokensWithoutPairs:l,availableToTokens:i,isPairValid:c,findBestToToken:f,hasValidPairs:d,getDefaultPair:x}}function Nc(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 Sc(e,t){const n=Nc(t);if(!n)throw new Error(`Cannot determine chain ID for token: ${t.token_id}`);return await e.getChainId()===n?!1:(await e.switchChain(n),!0)}const Ec="0xdd62ed3e",Tc="0x095ea7b3",_c="0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff";function Gt(e){return e.toLowerCase().replace("0x","").padStart(64,"0")}function Rc(e){return e.toString(16).padStart(64,"0")}function Ac(e){const t=e.startsWith("0x")?e.slice(2):e;return!t||t===""?0n:BigInt("0x"+t)}async function Mc(e,t,n,r){const s=bt(e),a=Ec+Gt(n)+Gt(r),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 Ac(i.result)}function Lc(e,t){const n=t?Rc(t):_c.slice(2);return`${Tc}${Gt(e)}${n}`}async function Pc(e,t,n,r){const s=Lc(n,r);return await e.sendTransaction({to:t,data:s})}async function Oc(e,t,n=60,r=2e3){const s=bt(e);for(let a=0;a<n;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 c=i.result;return{status:c.status==="0x1"?"success":"reverted",blockNumber:c.blockNumber,transactionHash:c.transactionHash}}await new Promise(c=>setTimeout(c,r))}throw new Error(`Transaction ${t} not confirmed after ${n} attempts`)}function Ic(e){return e?"getChainId"in e&&"switchChain"in e&&typeof e.getChainId=="function"&&typeof e.switchChain=="function":!1}function Dc({apiBaseUrl:e,onWalletTx:t,onSubmitTx:n,onError:r}){const[s,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((u,f,x)=>{a(v=>({...v,stage:"error",error:u})),r?.({error:u,stage:f,trade_id:x})},[r]),c=p.useCallback(async(u,f,x,v)=>{const w=x.deposit_address;if(!w)throw new Error("Missing deposit address for EVM transaction");a(k=>({...k,stage:"switching_chain"})),await Sc(u,f);const m=rn(f);if(!m&&f.token_address&&(a(N=>({...N,stage:"checking_allowance"})),await Mc(f.network_id,f.token_address,u.address,w)<v)){a(A=>({...A,stage:"approving"}));const N=await Pc(u,f.token_address,w,v);if((await Oc(f.network_id,N)).status==="reverted")throw new Error("Token approval transaction reverted")}a(k=>({...k,stage:"broadcasting"}));const y={to:w,value:m?v:0n,data:x.payload?x.payload:void 0};return await u.sendTransaction(y)},[]),d=p.useCallback(async({quote:u,fromToken:f,toToken:x,amountIn:v,walletAccount:w,evmWalletAccount:m})=>{const y=Ve(e);try{a({stage:"confirming",txHash:null,tradeId:u.trade_id,error:null});const g=m||w;if(!g)throw new Error("Wallet not available");a(b=>({...b,stage:"signing"}));let k;const N=qn(v,f.token_decimals);if(f.network_type===Y.EVM){const b=m||(Ic(w)?w:null);if(b)k=await c(b,f,u,N);else{const A=u.deposit_address,I=u.payload?u.payload:void 0;if(!A)throw new Error("Missing deposit address for EVM transaction");a(C=>({...C,stage:"broadcasting"}));const j={to:A,value:N,data:I};k=await g.sendTransaction(j)}}else if(f.network_type===Y.BTC){if(!u.deposit_address)throw new Error("Missing deposit address for BTC transaction");a(b=>({...b,stage:"broadcasting"})),k=await g.sendTransaction({toAddress:u.deposit_address,amount:N})}else if(f.network_type===Y.SOLANA){if(!u.payload)throw new Error("Missing payload for Solana transaction");a(b=>({...b,stage:"broadcasting"})),k=await g.sendTransaction(u.payload)}else throw new Error(`Unsupported network type: ${f.network_type}`);t?.({trade_id:u.trade_id,tx_hash:k,from_token:f,to_token:x,amount_in:v}),a(b=>({...b,txHash:k,stage:"submitting"}));try{await y.submitTransaction(u.trade_id,k),n?.({trade_id:u.trade_id,tx_hash:k,status:"success"})}catch(b){throw n?.({trade_id:u.trade_id,tx_hash:k,status:"error",error:b.message}),b}return a(b=>({...b,stage:"submitted"})),{tradeId:u.trade_id,txHash:k}}catch(g){const k=s.stage==="approving"?"approval":"wallet_tx";throw i(g,k,u.trade_id),g}},[e,t,n,i,c,s.stage]);return{...s,executeSwap:d,resetState:l,isExecuting:s.stage!=="idle"&&s.stage!=="submitted"&&s.stage!=="error"}}function $c({defaultPair:e,isPairValid:t,findBestToToken:n,hasValidPairs:r,defaultSlippage:s=.75,selectingToken:a=null}){const[l,i]=p.useState(null),[c,d]=p.useState(null),[u,f]=p.useState(""),[x,v]=p.useState(""),[w,m]=p.useState(s),y=l??e?.fromToken??null,g=c??e?.toToken??null,k=p.useCallback(()=>{y&&g&&t(g.token_id,y.token_id)&&(i(g),d(y),f(""))},[y,g,t]),N=p.useCallback(b=>{if(a==="from"){if(!r(b.token_id))return!1;if(b.token_id===g?.token_id)d(y);else if(g&&!t(b.token_id,g.token_id)){const A=n(b);d(A)}return i(b),!0}else if(a==="to")return b.token_id===y?.token_id&&i(g),d(b),!0;return!1},[a,y,g,t,n,r]);return{fromToken:y,toToken:g,handleTokenSelect:N,handleSwapDirection:k,amount:u,setAmount:f,receivingAddress:x,setReceivingAddress:v,slippage:w,setSlippage:m}}function Fc({fromToken:e,toToken:t}){const n=Ue();return p.useMemo(()=>{const r=n.evmAddress,s=n.btcAddress,a=n.btcPublicKey;let l=null,i=null;return e?.network_type===Y.EVM?(l=r,i=r):e?.network_type===Y.BTC&&(l=s,i=a),{fromUserAddress:l,userRefundPubkey:i}},[n.evmAddress,n.btcAddress,n.btcPublicKey,e,t])}function Bc({fromToken:e,toToken:t,amount:n,quote:r,isLoadingQuote:s,isFetchingQuote:a,receivingAddress:l,onConnectWallet:i,onSwap:c}){const d=Ue();return p.useMemo(()=>{if(!Zl(d,e?.network_type)){const x=Ql(e?.network_type);return{text:x?`Connect ${x} Wallet`:"Connect Wallet",disabled:!1,action:i}}return!e||!t?{text:"Select Tokens",disabled:!0,action:void 0}:!n||parseFloat(n)<=0?{text:"Enter Amount",disabled:!0,action:void 0}:l.trim()?Kt(l,t.network_type,t.network_id).isValid?s||a?{text:"Getting Quote...",disabled:!0,action:void 0}:r?{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}},[d.isEvmConnected,d.isBtcConnected,d.isSolanaConnected,e,t,n,s,a,r,i,c,l])}function zc({tokens:e,defaultFromToken:t,defaultToToken:n,isPairValid:r}){return p.useMemo(()=>{if(!t||!n||!e)return null;const s=e.find(l=>l.token_id===t),a=e.find(l=>l.token_id===n);return!s||!a?null:r(s.token_id,a.token_id)?{fromToken:s,toToken:a}:null},[e,t,n,r])}function Vc(){const e=Ue(),t=Je(),n=yc(),{tokensData:r}=El(),s=r.tokens,a=r.pairs,{allTokens:l,tokensWithoutPairs:i,isPairValid:c,findBestToToken:d,hasValidPairs:u,getDefaultPair:f}=jc({tokens:s,pairs:a,selectedFromToken:null}),v=zc({tokens:s,defaultFromToken:t.defaultFromToken,defaultToToken:t.defaultToToken,isPairValid:c})??f(),{fromToken:w,toToken:m,handleTokenSelect:y,handleSwapDirection:g,amount:k,setAmount:N,receivingAddress:b,setReceivingAddress:A,slippage:I,setSlippage:j}=$c({defaultPair:v,isPairValid:c,findBestToToken:d,hasValidPairs:u,defaultSlippage:t.defaultSlippage,selectingToken:n.tokenSelect.type}),C=p.useMemo(()=>w?l.filter($=>c(w.token_id,$.token_id)):[],[w,l,c]),R=bc(b,m),{fromUserAddress:B,userRefundPubkey:L}=Fc({fromToken:w,toToken:m}),D=Cc({fromToken:w,toToken:m,amount:k,fromUserAddress:B,toUserAddress:b,userRefundPubkey:L,slippage:I,config:{affiliateFee:t.affiliateFee,affiliateAddress:t.affiliateAddress,affiliateProvider:t.affiliateProvider,tradeTimeout:t.tradeTimeout,scriptTimeout:t.scriptTimeout}}),_=!!w&&!!m&&parseFloat(k)>0&&!!b.trim()&&!n.confirm.isOpen,{data:V,isLoading:W,isFetching:G,refetch:H}=Ho(t.apiBaseUrl,{...D,enabled:_,onQuote:t.callbacks?.onQuote}),S=Dc({apiBaseUrl:t.apiBaseUrl,onWalletTx:t.callbacks?.onWalletTx,onSubmitTx:t.callbacks?.onSubmitTx,onError:t.callbacks?.onError}),{walletAccount:ne,evmWalletAccount:oe}=kc(w,e.externalWalletClient??void 0),Ne=p.useCallback(()=>{e.isExternalWallet?e.onRequestWallet?.(w?.network_id??""):e.openConnectModal?.()},[e,w?.network_id]),ue=p.useCallback(()=>{!V||!w||!m||n.confirm.open()},[V,w,m,n.confirm]),U=p.useCallback(($=!1)=>{S.isExecuting||(n.confirm.close(),$||S.resetState())},[S,n.confirm]),Q=p.useCallback(async()=>{if(!(!V||!w||!m))try{await S.executeSwap({quote:V,fromToken:w,toToken:m,amountIn:k,walletAccount:ne,evmWalletAccount:oe}),U(!0),N("")}catch($){console.error("Swap failed:",$)}},[V,w,m,k,ne,oe,S,U,N]),ie=p.useCallback($=>{y($)&&n.tokenSelect.close()},[y,n.tokenSelect]),he=Bc({fromToken:w,toToken:m,amount:k,quote:V,isLoadingQuote:W,isFetchingQuote:G,receivingAddress:b,onConnectWallet:Ne,onSwap:ue});return{tokens:{from:w,to:m,all:l,availableTo:C,withoutPairs:i,data:r},input:{amount:k,setAmount:N,receivingAddress:b,setReceivingAddress:A,slippage:I,setSlippage:j},quote:{data:V,isLoading:W,isFetching:G,refetch:H},validation:{address:R},buttonState:he,modals:n,tokenSelect:{type:n.tokenSelect.type},actions:{selectToken:ie,swapDirection:g,connectWallet:Ne,openSwapConfirm:ue,closeConfirmModal:U,confirmSwap:Q},execution:{stage:S.stage,txHash:S.txHash,tradeId:S.tradeId,error:S.error,isExecuting:S.isExecuting},wallet:e,addresses:{sending:B,receiving:b}}}const Wc=5e3;function zn(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 Hc({apiBaseUrl:e,tradeId:t}){const{data:n,isLoading:r}=ke.useQuery({queryKey:["trade",t],queryFn:async()=>Ve(e).getTrade(t),enabled:!!t,refetchInterval:s=>{const a=s.state.data;return a&&zn(a.state)==="success"?!1:Wc},retry:!0,retryDelay:2e3});return{trade:n??null,status:zn(n?.state),isLoading:r}}function po(){const e=Vc(),t=Je(),{tokens:n,input:r,quote:s,modals:a,buttonState:l,validation:i,actions:c,addresses:d,wallet:u,execution:f}=e,[x,v]=p.useState(!1),{trade:w,status:m,isLoading:y}=Hc({apiBaseUrl:t.apiBaseUrl,tradeId:f.tradeId}),{formattedBalance:g}=mo({token:n.from,walletAddress:d.sending,enabled:!!n.from&&!!d.sending,polling:!0}),{calculateUsdValue:k}=xt({symbol:n.from?.token_symbol,enabled:!!n.from}),{calculateUsdValue:N}=xt({symbol:n.to?.token_symbol,enabled:!!n.to}),b=u.isConnected,A=k(r.amount),I=s.data?N(je(s.data.min_amount_out,n.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(Al,{slippage:r.slippage,onSlippageChange:r.setSlippage,isSettingsOpen:a.settings.isOpen,onSettingsToggle:a.settings.toggle,onHistoryClick:()=>v(!0),hideHistory:t.hideHistory||!u.isConnected}),o.jsxs(nn,{children:[o.jsxs("div",{className:"space-y-2 relative",children:[o.jsx($n,{token:n.from,value:r.amount,onChange:r.setAmount,onSelectToken:a.tokenSelect.openFrom,balance:g,isWalletConnected:b,usdValue:A}),o.jsx(co,{onClick:c.swapDirection}),o.jsx($n,{token:n.to,value:s.data?je(s.data.min_amount_out,n.to?.token_decimals||18):"",readOnly:!0,onSelectToken:a.tokenSelect.openTo,isOutput:!0,usdValue:I})]}),o.jsx("div",{className:"mt-4",children:o.jsx(Tl,{token:n.to,value:r.receivingAddress,onChange:r.setReceivingAddress,error:i.address.error})}),o.jsx("div",{className:"mt-4",children:o.jsx(Ll,{text:l.text,disabled:l.disabled,onClick:l.action})}),s.data&&n.from&&n.to&&o.jsx("div",{className:"mt-4",children:o.jsx(Ml,{quote:s.data,fromToken:n.from,toToken:n.to,amount:r.amount,slippage:r.slippage,isFetching:s.isFetching,onRefresh:s.refetch})}),o.jsx("div",{className:"mt-4",children:o.jsx(Pl,{})}),f.tradeId&&o.jsx("div",{className:"mt-4",children:o.jsx(mc,{trade:w,status:m,isLoading:y})})]})]}),o.jsx(uc,{swap:e}),x&&o.jsx(wc,{open:x,onOpenChange:v,evmAddress:u.evmAddress??void 0,btcAddress:u.btcAddress??void 0,solanaAddress:u.solanaAddress??void 0})]})}function Uc({className:e,connectLabel:t="Connect Wallet",showNetworkBadge:n=!0,onClick:r}){const s=Ue(),a=s.evmAddress||s.btcAddress||s.solanaAddress,l=()=>{if(r){r();return}s.isExternalWallet?s.onRequestWallet?.():s.openConnectModal?.()},i=()=>n?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: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:[o.jsx("span",{children:Do(a)}),o.jsx(Qo,{className:"h-3.5 w-3.5 opacity-0 transition-opacity group-hover:opacity-100"})]})]}):o.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 qc({apiBaseUrl:e,walletClient:t,onRequestWallet:n,theme:r,defaultFromToken:s,defaultToToken:a,affiliateFee:l,affiliateAddress:i,affiliateProvider:c,tradeTimeout:d,scriptTimeout:u,defaultSlippage:f=.75,hideHistory:x=!1,children:v,renderLoading:w,renderError:m,queryClient:y,onQuote:g,onWalletTx:k,onSubmitTx:N,onSwapComplete:b,onError:A}){Mo(e);const I=p.useMemo(()=>y??new ke.QueryClient,[y]),C={apiBaseUrl:e,defaultSlippage:f,affiliateFee:l,affiliateAddress:i,affiliateProvider:c,tradeTimeout:d,scriptTimeout:u,defaultFromToken:s,defaultToToken:a,hideHistory:x,callbacks:{onQuote:g,onWalletTx:k,onSubmitTx:N,onSwapComplete:b,onError:A},renderLoading:w,renderError:m},R=v??o.jsx(po,{});return o.jsx("div",{className:"optx-widget",children:o.jsx(ke.QueryClientProvider,{client:I,children:o.jsx(Uo,{value:C,children:o.jsx(Ro,{theme:r,children:o.jsx(Ao,{externalWalletClient:t,onRequestWallet:n,children:o.jsx(Sl,{children:R})})})})})})}exports.ConnectButton=Uc;exports.SwapCard=po;exports.SwapWidget=qc;exports.useWallet=Ue;
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 zi(){const e=navigator.userAgent;return typeof window<"u"&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))}function Vi(){return en(/^Mac/)}function Wi(){return en(/^iPhone/)}function Pn(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function Hi(){return en(/^iPad/)||Vi()&&navigator.maxTouchPoints>1}function Xr(){return Wi()||Hi()}function en(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.platform):void 0}const Ui=24,qi=typeof window<"u"?p.useLayoutEffect:p.useEffect;function On(...e){return(...t)=>{for(let n of e)typeof n=="function"&&n(...t)}}const Pt=typeof document<"u"&&window.visualViewport;function In(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function Jr(e){for(In(e)&&(e=e.parentElement);e&&!In(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}const Gi=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let dt=0,Ot;function Ki(e={}){let{isDisabled:t}=e;qi(()=>{if(!t)return dt++,dt===1&&Xr()&&(Ot=Yi()),()=>{dt--,dt===0&&Ot?.()}},[t])}function Yi(){let e,t=0,n=u=>{e=Jr(u.target),!(e===document.documentElement&&e===document.body)&&(t=u.changedTouches[0].pageY)},r=u=>{if(!e||e===document.documentElement||e===document.body){u.preventDefault();return}let h=u.changedTouches[0].pageY,g=e.scrollTop,v=e.scrollHeight-e.clientHeight;v!==0&&((g<=0&&h>t||g>=v&&h<t)&&u.preventDefault(),t=h)},s=u=>{let h=u.target;Ht(h)&&h!==document.activeElement&&(u.preventDefault(),h.style.transform="translateY(-2000px)",h.focus(),requestAnimationFrame(()=>{h.style.transform=""}))},a=u=>{let h=u.target;Ht(h)&&(h.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{h.style.transform="",Pt&&(Pt.height<window.innerHeight?requestAnimationFrame(()=>{Dn(h)}):Pt.addEventListener("resize",()=>Dn(h),{once:!0}))}))},l=()=>{window.scrollTo(0,0)},i=window.pageXOffset,c=window.pageYOffset,d=On(Zi(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let f=On(Ye(document,"touchstart",n,{passive:!1,capture:!0}),Ye(document,"touchmove",r,{passive:!1,capture:!0}),Ye(document,"touchend",s,{passive:!1,capture:!0}),Ye(document,"focus",a,!0),Ye(window,"scroll",l));return()=>{d(),f(),window.scrollTo(i,c)}}function Zi(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}function Ye(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function Dn(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let n=Jr(e);if(n!==document.documentElement&&n!==document.body&&n!==e){let r=n.getBoundingClientRect().top,s=e.getBoundingClientRect().top,a=e.getBoundingClientRect().bottom;const l=n.getBoundingClientRect().bottom+Ui;a>l&&(n.scrollTop+=s-r)}e=n.parentElement}}function Ht(e){return e instanceof HTMLInputElement&&!Gi.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function Qi(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function Xi(...e){return t=>e.forEach(n=>Qi(n,t))}function eo(...e){return x.useCallback(Xi(...e),e)}const to=new WeakMap;function ee(e,t,n=!1){if(!e||!(e instanceof HTMLElement))return;let r={};Object.entries(t).forEach(([s,a])=>{if(s.startsWith("--")){e.style.setProperty(s,a);return}r[s]=e.style[s],e.style[s]=a}),!n&&to.set(e,r)}function Ji(e,t){if(!e||!(e instanceof HTMLElement))return;let n=to.get(e);n&&(e.style[t]=n[t])}const X=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function ut(e,t){if(!e)return null;const n=window.getComputedStyle(e),r=n.transform||n.webkitTransform||n.mozTransform;let s=r.match(/^matrix3d\((.+)\)$/);return s?parseFloat(s[1].split(", ")[X(t)?13:12]):(s=r.match(/^matrix\((.+)\)$/),s?parseFloat(s[1].split(", ")[X(t)?5:4]):null)}function el(e){return 8*(Math.log(e+1)-2)}function It(e,t){if(!e)return()=>{};const n=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=n}}function tl(...e){return(...t)=>{for(const n of e)typeof n=="function"&&n(...t)}}const K={DURATION:.5,EASE:[.32,.72,0,1]},no=.4,nl=.25,rl=100,ro=8,_e=16,Ut=26,Dt="vaul-dragging";function oo(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>(...n)=>t.current==null?void 0:t.current.call(t,...n),[])}function ol({defaultProp:e,onChange:t}){const n=p.useState(e),[r]=n,s=p.useRef(r),a=oo(t);return p.useEffect(()=>{s.current!==r&&(a(r),s.current=r)},[r,s,a]),n}function so({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,s]=ol({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:r,i=oo(n),c=p.useCallback(d=>{if(a){const u=typeof d=="function"?d(e):d;u!==e&&i(u)}else s(d)},[a,e,s,i]);return[l,c]}function sl({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:n,drawerRef:r,overlayRef:s,fadeFromIndex:a,onSnapPointChange:l,direction:i="bottom",container:c,snapToSequentialPoint:d}){const[f,u]=so({prop:e,defaultProp:n?.[0],onChange:t}),[h,g]=p.useState(typeof window<"u"?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);p.useEffect(()=>{function j(){g({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",j),()=>window.removeEventListener("resize",j)},[]);const v=p.useMemo(()=>f===n?.[n.length-1]||null,[n,f]),m=p.useMemo(()=>{var j;return(j=n?.findIndex(C=>C===f))!=null?j:null},[n,f]),b=n&&n.length>0&&(a||a===0)&&!Number.isNaN(a)&&n[a]===f||!n,w=p.useMemo(()=>{const j=c?{width:c.getBoundingClientRect().width,height:c.getBoundingClientRect().height}:typeof window<"u"?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};var C;return(C=n?.map(R=>{const B=typeof R=="string";let L=0;if(B&&(L=parseInt(R,10)),X(i)){const A=B?L:h?R*j.height:0;return h?i==="bottom"?j.height-A:-j.height+A:A}const D=B?L:h?R*j.width:0;return h?i==="right"?j.width-D:-j.width+D:D}))!=null?C:[]},[n,h,c]),N=p.useMemo(()=>m!==null?w?.[m]:null,[w,m]),k=p.useCallback(j=>{var C;const R=(C=w?.findIndex(B=>B===j))!=null?C:null;l(R),ee(r.current,{transition:`transform ${K.DURATION}s cubic-bezier(${K.EASE.join(",")})`,transform:X(i)?`translate3d(0, ${j}px, 0)`:`translate3d(${j}px, 0, 0)`}),w&&R!==w.length-1&&a!==void 0&&R!==a&&R<a?ee(s.current,{transition:`opacity ${K.DURATION}s cubic-bezier(${K.EASE.join(",")})`,opacity:"0"}):ee(s.current,{transition:`opacity ${K.DURATION}s cubic-bezier(${K.EASE.join(",")})`,opacity:"1"}),u(n?.[Math.max(R,0)])},[r.current,n,w,a,s,u]);p.useEffect(()=>{if(f||e){var j;const C=(j=n?.findIndex(R=>R===e||R===f))!=null?j:-1;w&&C!==-1&&typeof w[C]=="number"&&k(w[C])}},[f,e,n,w,k]);function y({draggedDistance:j,closeDrawer:C,velocity:R,dismissible:B}){if(a===void 0)return;const L=i==="bottom"||i==="right"?(N??0)-j:(N??0)+j,D=m===a-1,A=m===0,V=j>0;if(D&&ee(s.current,{transition:`opacity ${K.DURATION}s cubic-bezier(${K.EASE.join(",")})`}),!d&&R>2&&!V){B?C():k(w[0]);return}if(!d&&R>2&&V&&w&&n){k(w[n.length-1]);return}const W=w?.reduce((H,S)=>typeof H!="number"||typeof S!="number"?H:Math.abs(S-L)<Math.abs(H-L)?S:H),G=X(i)?window.innerHeight:window.innerWidth;if(R>no&&Math.abs(j)<G*.4){const H=V?1:-1;if(H>0&&v&&n){k(w[n.length-1]);return}if(A&&H<0&&B&&C(),m===null)return;k(w[m+H]);return}k(W)}function E({draggedDistance:j}){if(N===null)return;const C=i==="bottom"||i==="right"?N-j:N+j;(i==="bottom"||i==="right")&&C<w[w.length-1]||(i==="top"||i==="left")&&C>w[w.length-1]||ee(r.current,{transform:X(i)?`translate3d(0, ${C}px, 0)`:`translate3d(${C}px, 0, 0)`})}function P(j,C){if(!n||typeof m!="number"||!w||a===void 0)return null;const R=m===a-1;if(m>=a&&C)return 0;if(R&&!C)return 1;if(!b&&!R)return null;const L=R?m+1:m-1,D=R?w[L]-w[L-1]:w[L+1]-w[L],A=j/Math.abs(D);return R?1-A:A}return{isLastSnapPoint:v,activeSnapPoint:f,shouldFade:b,getPercentageDragged:P,setActiveSnapPoint:u,activeSnapPointIndex:m,onRelease:y,onDrag:E,snapPointsOffset:w}}const al=()=>()=>{};function il(){const{direction:e,isOpen:t,shouldScaleBackground:n,setBackgroundColorOnScale:r,noBodyStyles:s}=et(),a=p.useRef(null),l=p.useMemo(()=>document.body.style.backgroundColor,[]);function i(){return(window.innerWidth-Ut)/window.innerWidth}p.useEffect(()=>{if(t&&n){a.current&&clearTimeout(a.current);const c=document.querySelector("[data-vaul-drawer-wrapper]")||document.querySelector("[vaul-drawer-wrapper]");if(!c)return;tl(r&&!s?It(document.body,{background:"black"}):al,It(c,{transformOrigin:X(e)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${K.DURATION}s`,transitionTimingFunction:`cubic-bezier(${K.EASE.join(",")})`}));const d=It(c,{borderRadius:`${ro}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()=>{d(),a.current=window.setTimeout(()=>{l?document.body.style.background=l:document.body.style.removeProperty("background")},K.DURATION*1e3)}}},[t,n,l])}let Ze=null;function ll({isOpen:e,modal:t,nested:n,hasBeenOpened:r,preventScrollRestoration:s,noBodyStyles:a}){const[l,i]=p.useState(()=>typeof window<"u"?window.location.href:""),c=p.useRef(0),d=p.useCallback(()=>{if(Pn()&&Ze===null&&e&&!a){Ze={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:"unset"};const{scrollX:u,innerHeight:h}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:`${-c.current}px`,left:`${-u}px`,right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{const g=h-window.innerHeight;g&&c.current>=h&&(document.body.style.top=`${-(c.current+g)}px`)}),300)}},[e]),f=p.useCallback(()=>{if(Pn()&&Ze!==null&&!a){const u=-parseInt(document.body.style.top,10),h=-parseInt(document.body.style.left,10);Object.assign(document.body.style,Ze),window.requestAnimationFrame(()=>{if(s&&l!==window.location.href){i(window.location.href);return}window.scrollTo(h,u)}),Ze=null}},[l]);return p.useEffect(()=>{function u(){c.current=window.scrollY}return u(),window.addEventListener("scroll",u),()=>{window.removeEventListener("scroll",u)}},[]),p.useEffect(()=>{if(t)return()=>{typeof document>"u"||document.querySelector("[data-vaul-drawer]")||f()}},[t,f]),p.useEffect(()=>{n||!r||(e?(!window.matchMedia("(display-mode: standalone)").matches&&d(),t||window.setTimeout(()=>{f()},500)):f())},[e,r,l,t,n,d,f]),{restorePositionSetting:f}}function cl({open:e,onOpenChange:t,children:n,onDrag:r,onRelease:s,snapPoints:a,shouldScaleBackground:l=!1,setBackgroundColorOnScale:i=!0,closeThreshold:c=nl,scrollLockTimeout:d=rl,dismissible:f=!0,handleOnly:u=!1,fadeFromIndex:h=a&&a.length-1,activeSnapPoint:g,setActiveSnapPoint:v,fixed:m,modal:b=!0,onClose:w,nested:N,noBodyStyles:k=!1,direction:y="bottom",defaultOpen:E=!1,disablePreventScroll:P=!0,snapToSequentialPoint:j=!1,preventScrollRestoration:C=!1,repositionInputs:R=!0,onAnimationEnd:B,container:L,autoFocus:D=!1}){var A,V;const[W=!1,G]=so({defaultProp:E,prop:e,onChange:M=>{t?.(M),!M&&!N&&bo(),setTimeout(()=>{B?.(M)},K.DURATION*1e3),M&&!b&&typeof window<"u"&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),M||(document.body.style.pointerEvents="auto")}}),[H,S]=p.useState(!1),[ne,oe]=p.useState(!1),[Ne,ue]=p.useState(!1),U=p.useRef(null),Q=p.useRef(null),ie=p.useRef(null),he=p.useRef(null),$=p.useRef(null),fe=p.useRef(!1),xe=p.useRef(null),ge=p.useRef(0),le=p.useRef(!1),Se=p.useRef(!E),sn=p.useRef(0),O=p.useRef(null),an=p.useRef(((A=O.current)==null?void 0:A.getBoundingClientRect().height)||0),ln=p.useRef(((V=O.current)==null?void 0:V.getBoundingClientRect().width)||0),yt=p.useRef(0),ho=p.useCallback(M=>{a&&M===qe.length-1&&(Q.current=new Date)},[]),{activeSnapPoint:xo,activeSnapPointIndex:Oe,setActiveSnapPoint:cn,onRelease:go,snapPointsOffset:qe,onDrag:vo,shouldFade:dn,getPercentageDragged:wo}=sl({snapPoints:a,activeSnapPointProp:g,setActiveSnapPointProp:v,drawerRef:O,fadeFromIndex:h,overlayRef:U,onSnapPointChange:ho,direction:y,container:L,snapToSequentialPoint:j});Ki({isDisabled:!W||ne||!b||Ne||!H||!R||!P});const{restorePositionSetting:bo}=ll({isOpen:W,modal:b,nested:N??!1,hasBeenOpened:H,preventScrollRestoration:C,noBodyStyles:k});function tt(){return(window.innerWidth-Ut)/window.innerWidth}function yo(M){var z,q;!f&&!a||O.current&&!O.current.contains(M.target)||(an.current=((z=O.current)==null?void 0:z.getBoundingClientRect().height)||0,ln.current=((q=O.current)==null?void 0:q.getBoundingClientRect().width)||0,oe(!0),ie.current=new Date,Xr()&&window.addEventListener("touchend",()=>fe.current=!1,{once:!0}),M.target.setPointerCapture(M.pointerId),ge.current=X(y)?M.pageY:M.pageX)}function un(M,z){var q;let F=M;const Z=(q=window.getSelection())==null?void 0:q.toString(),re=O.current?ut(O.current,y):null,te=new Date;if(F.tagName==="SELECT"||F.hasAttribute("data-vaul-no-drag")||F.closest("[data-vaul-no-drag]"))return!1;if(y==="right"||y==="left")return!0;if(Q.current&&te.getTime()-Q.current.getTime()<500)return!1;if(re!==null&&(y==="bottom"?re>0:re<0))return!0;if(Z&&Z.length>0)return!1;if($.current&&te.getTime()-$.current.getTime()<d&&re===0||z)return $.current=te,!1;for(;F;){if(F.scrollHeight>F.clientHeight){if(F.scrollTop!==0)return $.current=new Date,!1;if(F.getAttribute("role")==="dialog")return!0}F=F.parentNode}return!0}function Co(M){if(O.current&&ne){const z=y==="bottom"||y==="right"?1:-1,q=(ge.current-(X(y)?M.pageY:M.pageX))*z,F=q>0,Z=a&&!f&&!F;if(Z&&Oe===0)return;const re=Math.abs(q),te=document.querySelector("[data-vaul-drawer-wrapper]"),ve=y==="bottom"||y==="top"?an.current:ln.current;let se=re/ve;const Ee=wo(re,F);if(Ee!==null&&(se=Ee),Z&&se>=1||!fe.current&&!un(M.target,F))return;if(O.current.classList.add(Dt),fe.current=!0,ee(O.current,{transition:"none"}),ee(U.current,{transition:"none"}),a&&vo({draggedDistance:q}),F&&!a){const ce=el(q),nt=Math.min(ce*-1,0)*z;ee(O.current,{transform:X(y)?`translate3d(0, ${nt}px, 0)`:`translate3d(${nt}px, 0, 0)`});return}const we=1-se;if((dn||h&&Oe===h-1)&&(r?.(M,se),ee(U.current,{opacity:`${we}`,transition:"none"},!0)),te&&U.current&&l){const ce=Math.min(tt()+se*(1-tt()),1),nt=8-se*8,mn=Math.max(0,14-se*14);ee(te,{borderRadius:`${nt}px`,transform:X(y)?`scale(${ce}) translate3d(0, ${mn}px, 0)`:`scale(${ce}) translate3d(${mn}px, 0, 0)`,transition:"none"},!0)}if(!a){const ce=re*z;ee(O.current,{transform:X(y)?`translate3d(0, ${ce}px, 0)`:`translate3d(${ce}px, 0, 0)`})}}}p.useEffect(()=>{window.requestAnimationFrame(()=>{Se.current=!0})},[]),p.useEffect(()=>{var M;function z(){if(!O.current||!R)return;const q=document.activeElement;if(Ht(q)||le.current){var F;const Z=((F=window.visualViewport)==null?void 0:F.height)||0,re=window.innerHeight;let te=re-Z;const ve=O.current.getBoundingClientRect().height||0,se=ve>re*.8;yt.current||(yt.current=ve);const Ee=O.current.getBoundingClientRect().top;if(Math.abs(sn.current-te)>60&&(le.current=!le.current),a&&a.length>0&&qe&&Oe){const we=qe[Oe]||0;te+=we}if(sn.current=te,ve>Z||le.current){const we=O.current.getBoundingClientRect().height;let ce=we;we>Z&&(ce=Z-(se?Ee:Ut)),m?O.current.style.height=`${we-Math.max(te,0)}px`:O.current.style.height=`${Math.max(ce,Z-Ee)}px`}else zi()||(O.current.style.height=`${yt.current}px`);a&&a.length>0&&!le.current?O.current.style.bottom="0px":O.current.style.bottom=`${Math.max(te,0)}px`}}return(M=window.visualViewport)==null||M.addEventListener("resize",z),()=>{var q;return(q=window.visualViewport)==null?void 0:q.removeEventListener("resize",z)}},[Oe,a,qe]);function Ge(M){ko(),w?.(),M||G(!1),setTimeout(()=>{a&&cn(a[0])},K.DURATION*1e3)}function fn(){if(!O.current)return;const M=document.querySelector("[data-vaul-drawer-wrapper]"),z=ut(O.current,y);ee(O.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${K.DURATION}s cubic-bezier(${K.EASE.join(",")})`}),ee(U.current,{transition:`opacity ${K.DURATION}s cubic-bezier(${K.EASE.join(",")})`,opacity:"1"}),l&&z&&z>0&&W&&ee(M,{borderRadius:`${ro}px`,overflow:"hidden",...X(y)?{transform:`scale(${tt()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${tt()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${K.DURATION}s`,transitionTimingFunction:`cubic-bezier(${K.EASE.join(",")})`},!0)}function ko(){!ne||!O.current||(O.current.classList.remove(Dt),fe.current=!1,oe(!1),he.current=new Date)}function jo(M){if(!ne||!O.current)return;O.current.classList.remove(Dt),fe.current=!1,oe(!1),he.current=new Date;const z=ut(O.current,y);if(!M||!un(M.target,!1)||!z||Number.isNaN(z)||ie.current===null)return;const q=he.current.getTime()-ie.current.getTime(),F=ge.current-(X(y)?M.pageY:M.pageX),Z=Math.abs(F)/q;if(Z>.05&&(ue(!0),setTimeout(()=>{ue(!1)},200)),a){go({draggedDistance:F*(y==="bottom"||y==="right"?1:-1),closeDrawer:Ge,velocity:Z,dismissible:f}),s?.(M,!0);return}if(y==="bottom"||y==="right"?F>0:F<0){fn(),s?.(M,!0);return}if(Z>no){Ge(),s?.(M,!1);return}var re;const te=Math.min((re=O.current.getBoundingClientRect().height)!=null?re:0,window.innerHeight);var ve;const se=Math.min((ve=O.current.getBoundingClientRect().width)!=null?ve:0,window.innerWidth),Ee=y==="left"||y==="right";if(Math.abs(z)>=(Ee?se:te)*c){Ge(),s?.(M,!1);return}s?.(M,!0),fn()}p.useEffect(()=>(W&&(ee(document.documentElement,{scrollBehavior:"auto"}),Q.current=new Date),()=>{Ji(document.documentElement,"scrollBehavior")}),[W]);function No(M){const z=M?(window.innerWidth-_e)/window.innerWidth:1,q=M?-_e:0;xe.current&&window.clearTimeout(xe.current),ee(O.current,{transition:`transform ${K.DURATION}s cubic-bezier(${K.EASE.join(",")})`,transform:X(y)?`scale(${z}) translate3d(0, ${q}px, 0)`:`scale(${z}) translate3d(${q}px, 0, 0)`}),!M&&O.current&&(xe.current=setTimeout(()=>{const F=ut(O.current,y);ee(O.current,{transition:"none",transform:X(y)?`translate3d(0, ${F}px, 0)`:`translate3d(${F}px, 0, 0)`})},500))}function So(M,z){if(z<0)return;const q=(window.innerWidth-_e)/window.innerWidth,F=q+z*(1-q),Z=-_e+z*_e;ee(O.current,{transform:X(y)?`scale(${F}) translate3d(0, ${Z}px, 0)`:`scale(${F}) translate3d(${Z}px, 0, 0)`,transition:"none"})}function Eo(M,z){const q=X(y)?window.innerHeight:window.innerWidth,F=z?(q-_e)/q:1,Z=z?-_e:0;z&&ee(O.current,{transition:`transform ${K.DURATION}s cubic-bezier(${K.EASE.join(",")})`,transform:X(y)?`scale(${F}) translate3d(0, ${Z}px, 0)`:`scale(${F}) translate3d(${Z}px, 0, 0)`})}return p.useEffect(()=>{b||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[b]),p.createElement(Li,{defaultOpen:E,onOpenChange:M=>{!f&&!M||(M?S(!0):Ge(!0),G(M))},open:W},p.createElement(Qr.Provider,{value:{activeSnapPoint:xo,snapPoints:a,setActiveSnapPoint:cn,drawerRef:O,overlayRef:U,onOpenChange:t,onPress:yo,onRelease:jo,onDrag:Co,dismissible:f,shouldAnimate:Se,handleOnly:u,isOpen:W,isDragging:ne,shouldFade:dn,closeDrawer:Ge,onNestedDrag:So,onNestedOpenChange:No,onNestedRelease:Eo,keyboardIsOpen:le,modal:b,snapPointsOffset:qe,activeSnapPointIndex:Oe,direction:y,shouldScaleBackground:l,setBackgroundColorOnScale:i,noBodyStyles:k,container:L,autoFocus:D}},n))}const ao=p.forwardRef(function({...e},t){const{overlayRef:n,snapPoints:r,onRelease:s,shouldFade:a,isOpen:l,modal:i,shouldAnimate:c}=et(),d=eo(t,n),f=r&&r.length>0;if(!i)return null;const u=p.useCallback(h=>s(h),[s]);return p.createElement(Oi,{onMouseUp:u,ref:d,"data-vaul-overlay":"","data-vaul-snap-points":l&&f?"true":"false","data-vaul-snap-points-overlay":l&&a?"true":"false","data-vaul-animate":c?.current?"true":"false",...e})});ao.displayName="Drawer.Overlay";const io=p.forwardRef(function({onPointerDownOutside:e,style:t,onOpenAutoFocus:n,...r},s){const{drawerRef:a,onPress:l,onRelease:i,onDrag:c,keyboardIsOpen:d,snapPointsOffset:f,activeSnapPointIndex:u,modal:h,isOpen:g,direction:v,snapPoints:m,container:b,handleOnly:w,shouldAnimate:N,autoFocus:k}=et(),[y,E]=p.useState(!1),P=eo(s,a),j=p.useRef(null),C=p.useRef(null),R=p.useRef(!1),B=m&&m.length>0;il();const L=(A,V,W=0)=>{if(R.current)return!0;const G=Math.abs(A.y),H=Math.abs(A.x),S=H>G,ne=["bottom","right"].includes(V)?1:-1;if(V==="left"||V==="right"){if(!(A.x*ne<0)&&H>=0&&H<=W)return S}else if(!(A.y*ne<0)&&G>=0&&G<=W)return!S;return R.current=!0,!0};p.useEffect(()=>{B&&window.requestAnimationFrame(()=>{E(!0)})},[]);function D(A){j.current=null,R.current=!1,i(A)}return p.createElement(Ii,{"data-vaul-drawer-direction":v,"data-vaul-drawer":"","data-vaul-delayed-snap-points":y?"true":"false","data-vaul-snap-points":g&&B?"true":"false","data-vaul-custom-container":b?"true":"false","data-vaul-animate":N?.current?"true":"false",...r,ref:P,style:f&&f.length>0?{"--snap-point-height":`${f[u??0]}px`,...t}:t,onPointerDown:A=>{w||(r.onPointerDown==null||r.onPointerDown.call(r,A),j.current={x:A.pageX,y:A.pageY},l(A))},onOpenAutoFocus:A=>{n?.(A),k||A.preventDefault()},onPointerDownOutside:A=>{if(e?.(A),!h||A.defaultPrevented){A.preventDefault();return}d.current&&(d.current=!1)},onFocusOutside:A=>{if(!h){A.preventDefault();return}},onPointerMove:A=>{if(C.current=A,w||(r.onPointerMove==null||r.onPointerMove.call(r,A),!j.current))return;const V=A.pageY-j.current.y,W=A.pageX-j.current.x,G=A.pointerType==="touch"?10:2;L({x:W,y:V},v,G)?c(A):(Math.abs(W)>G||Math.abs(V)>G)&&(j.current=null)},onPointerUp:A=>{r.onPointerUp==null||r.onPointerUp.call(r,A),j.current=null,R.current=!1,i(A)},onPointerOut:A=>{r.onPointerOut==null||r.onPointerOut.call(r,A),D(C.current)},onContextMenu:A=>{r.onContextMenu==null||r.onContextMenu.call(r,A),C.current&&D(C.current)}})});io.displayName="Drawer.Content";const dl=250,ul=120,fl=p.forwardRef(function({preventCycle:e=!1,children:t,...n},r){const{closeDrawer:s,isDragging:a,snapPoints:l,activeSnapPoint:i,setActiveSnapPoint:c,dismissible:d,handleOnly:f,isOpen:u,onPress:h,onDrag:g}=et(),v=p.useRef(null),m=p.useRef(!1);function b(){if(m.current){k();return}window.setTimeout(()=>{w()},ul)}function w(){if(a||e||m.current){k();return}if(k(),!l||l.length===0){d||s();return}if(i===l[l.length-1]&&d){s();return}const E=l.findIndex(j=>j===i);if(E===-1)return;const P=l[E+1];c(P)}function N(){v.current=window.setTimeout(()=>{m.current=!0},dl)}function k(){v.current&&window.clearTimeout(v.current),m.current=!1}return p.createElement("div",{onClick:b,onPointerCancel:k,onPointerDown:y=>{f&&h(y),N()},onPointerMove:y=>{f&&g(y)},ref:r,"data-vaul-drawer-visible":u?"true":"false","data-vaul-handle":"","aria-hidden":"true",...n},p.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},t))});fl.displayName="Drawer.Handle";function ml(e){const t=et(),{container:n=t.container,...r}=e;return p.createElement(Pi,{container:n,...r})}const Re={Root:cl,Content:io,Overlay:ao,Portal:ml,Close:Fi,Title:Di,Description:$i};function pl(e=768){const[t,n]=p.useState(!1);return p.useEffect(()=>{const r=()=>{n(window.innerWidth<e)};return r(),window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)},[e]),t}function tn({open:e,onOpenChange:t,children:n,title:r,description:s,className:a="",showCloseButton:l=!0}){return pl()?o.jsx(Re.Root,{open:e,onOpenChange:t,children:o.jsxs(Re.Portal,{children:[o.jsx(Re.Overlay,{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm"}),o.jsxs(Re.Content,{className:`fixed inset-x-0 bottom-0 z-50 mt-24 flex max-h-[96vh] flex-col rounded-t-2xl bg-[var(--optimex-surface)] border-t border-white/[0.05] outline-none ${a}`,children:[o.jsx("div",{className:"mx-auto mt-4 h-1.5 w-12 flex-shrink-0 rounded-full bg-white/20"}),(r||l)&&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:[r&&o.jsx(Re.Title,{className:"text-lg font-bold text-white",children:r}),s&&o.jsx(Re.Description,{className:"text-sm text-white/40",children:s})]}),l&&o.jsx(Re.Close,{className:"rounded-lg p-1.5 text-white/40 transition-colors hover:bg-white/10 hover:text-white/60",children:o.jsx(Ae,{})})]}),o.jsx("div",{className:"flex-1 overflow-auto",children:n})]})]})}):e?o.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[o.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:()=>t(!1)}),o.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":r?"modal-title":void 0,"aria-describedby":s?"modal-description":void 0,className:`relative z-10 flex max-h-[90vh] flex-col rounded-2xl bg-[var(--optimex-surface)] border border-white/[0.05] shadow-2xl ${a}`,children:[(r||l)&&o.jsxs("div",{className:"flex items-center justify-between border-b border-white/[0.05] p-4",children:[o.jsxs("div",{children:[r&&o.jsx("h2",{id:"modal-title",className:"text-lg font-bold text-white",children:r}),s&&o.jsx("p",{id:"modal-description",className:"text-sm text-white/40",children:s})]}),l&&o.jsx("button",{onClick:()=>t(!1),className:"rounded-lg p-1.5 text-white/40 transition-colors hover:bg-white/10 hover:text-white/60",children:o.jsx(Ae,{})})]}),o.jsx("div",{className:"flex-1 overflow-auto",children:n})]})]}):null}const hl=({children:e,className:t=""})=>o.jsx("div",{className:`p-4 ${t}`,children:e}),xl=({children:e,className:t=""})=>o.jsx("div",{className:`flex gap-2 border-t border-white/[0.05] p-4 ${t}`,children:e});function qt({children:e,onClick:t,isActive:n=!1,type:r="button",className:s=""}){return o.jsx("button",{type:r,onClick:t,className:vr(`px-2 py-1 bg-zinc-800/80 rounded-md text-xs transition-colors shadow-sm border ${n?"border-[var(--optimex-primary)]":"border-transparent text-white hover:bg-white/10 hover:text-white"} ${s}`),children:e})}const gl={"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"},vl={"bottom-right":"-top-2 right-4 rotate-45 border-l border-t","bottom-left":"-top-2 left-4 rotate-45 border-l border-t","bottom-center":"-top-2 left-1/2 -translate-x-1/2 rotate-45 border-l border-t","top-right":"-bottom-2 right-4 rotate-45 border-r border-b","top-left":"-bottom-2 left-4 rotate-45 border-r border-b","top-center":"-bottom-2 left-1/2 -translate-x-1/2 rotate-45 border-r border-b"};function wl({isOpen:e,onClose:t,children:n,anchorRef:r,position:s="bottom-right",width:a="w-72",showArrow:l=!0,className:i="",ariaLabel:c}){const d=p.useRef(null);return p.useEffect(()=>{if(!e)return;const f=g=>{const v=g.target;d.current?.contains(v)||r?.current?.contains(v)||t()},u=g=>{g.key==="Escape"&&t()},h=setTimeout(()=>{document.addEventListener("mousedown",f),document.addEventListener("keydown",u)},0);return()=>{clearTimeout(h),document.removeEventListener("mousedown",f),document.removeEventListener("keydown",u)}},[e,t,r]),e?o.jsxs("div",{ref:d,className:`absolute z-50 rounded-[0.25rem] border border-[var(--optimex-border)] bg-[var(--optimex-surface)] p-4 shadow-lg ${gl[s]} ${a} ${i}`,role:"dialog","aria-label":c,children:[l&&o.jsx("div",{className:`absolute h-4 w-4 border-[var(--optimex-border)] bg-[var(--optimex-surface)] ${vl[s]}`}),o.jsx("div",{className:"relative",children:n})]}):null}function bl({value:e,onChange:t,placeholder:n,hasError:r=!1,leftIcon:s,rightContent:a,type:l="text",inputMode:i="text",disabled:c=!1,className:d=""}){return o.jsxs("div",{className:`flex rounded-md items-center gap-2 bg-white/5 border py-3 px-3 transition-colors ${r?"border-red-500":"border-white/10 hover:border-[var(--optimex-primary)] focus-within:border-[var(--optimex-primary)]"} ${c?"opacity-50 cursor-not-allowed":""} ${d}`,children:[s&&o.jsx(s,{className:"size-5 text-white/40 shrink-0"}),o.jsx("input",{type:l,inputMode:i,value:e,onChange:f=>t(f.target.value),placeholder:n,disabled:c,className:"flex-1 min-w-0 bg-transparent text-white text-sm placeholder:text-white/10 outline-none disabled:cursor-not-allowed"}),a]})}const yl={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 Le({token:e,size:t="md",showNetworkBadge:n=!0}){const r=yl[t];return o.jsxs("div",{className:`relative shrink-0 ${r.container}`,children:[o.jsx("img",{src:e.token_logo_uri||"/placeholder-token.svg",alt:e.token_symbol,className:`${r.icon} rounded-full bg-[var(--optimex-background)]`,onError:s=>{s.target.src="/placeholder-token.svg"}}),n&&e.network_logo_uri&&o.jsx("img",{src:e.network_logo_uri,alt:e.network_name,className:`absolute -bottom-1 -right-1 ${r.badge} rounded-full border-2 border-[var(--optimex-surface)]`,onError:s=>{s.target.style.display="none"}})]})}const Cl="glass-container rounded-3xl p-4 shadow-2xl relative w-full min-w-0";function nn({children:e,className:t}){return o.jsx("div",{className:t??Cl,children:e})}function kl(){return o.jsxs("div",{className:"relative size-20 mb-4",children:[o.jsx("div",{className:"absolute inset-0 rounded-full bg-red-500/10 animate-pulse"}),o.jsx("div",{className:"absolute inset-2 rounded-full bg-red-500/20"}),o.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:o.jsx(ns,{className:"size-10 text-red-500"})})]})}function jl({error:e,onRetry:t,className:n}){const r=()=>{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(nn,{className:n,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(kl,{}),o.jsx("h3",{className:"text-base font-bold text-white mb-1",children:"Oops! Something went wrong"}),o.jsx("p",{className:"text-sm text-white/40 mb-6 max-w-[280px]",children:r()}),o.jsx(or,{onClick:t,size:"md",fullWidth:!0,leftIcon:o.jsx(ts,{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-white/30 hover:text-white/50 transition-colors",children:"Technical details"}),o.jsx("p",{className:"mt-2 bg-white/5 p-3 text-left text-xs text-white/40 break-all border border-white/[0.02]",children:e.message})]})]})})})}function Nl({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(nn,{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 lo=p.createContext(null);function Sl({children:e}){const t=Je(),{data:n,isLoading:r,error:s,refetch:a}=Po(t.apiBaseUrl),l=t.renderLoading??Nl,i=t.renderError??jl;if(r)return o.jsx(l,{});if(s||!n){const c=s instanceof Error?s:new Error("Failed to load tokens");return o.jsx(i,{error:c,onRetry:()=>a()})}return o.jsx(lo.Provider,{value:{tokensData:n,refetch:a},children:e})}function El(){const e=p.useContext(lo);if(!e)throw new Error("useTokensData must be used within TokensProvider");return e}function Tl({token:e,value:t,onChange:n,placeholder:r,error:s,onClose:a}){const l=p.useCallback(()=>{n("")},[n]),i=p.useCallback(async()=>{try{const u=await navigator.clipboard.readText();u&&n(u.trim())}catch(u){console.error("Failed to read clipboard:",u)}},[n]),c=()=>r||(e?`Enter ${e.network_name} address`:"Enter receiving address"),d=e?.network_name||"destination",f=p.useMemo(()=>ss(e?.network_name)||Zn,[e?.network_name]);return o.jsxs("div",{className:"bg-[var(--optimex-surface)] rounded-2xl 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-white/40 text-xs",children:"Recipient Address"}),a&&o.jsx("button",{type:"button",onClick:l,className:"text-white/20 hover:text-white/40 transition-colors",children:o.jsx(Ae,{className:"size-4"})})]}),o.jsx(bl,{value:t,onChange:n,placeholder:c(),hasError:!!s,leftIcon:f,rightContent:t?o.jsx("button",{type:"button",onClick:l,className:"text-white/40 hover:text-white/60 transition-colors",children:o.jsx(Ae,{className:"size-5"})}):o.jsx("button",{type:"button",onClick:i,className:"text-white/40 hover:text-[var(--optimex-primary)] transition-colors",children:o.jsx(es,{className:"size-5"})})}),s?o.jsxs("p",{className:"text-[10px] text-red-500 mt-2 flex items-center gap-1",children:[o.jsx(pn,{className:"size-3"}),s]}):o.jsxs("p",{className:"text-[10px] text-white/40 mt-2 flex items-center gap-1",children:[o.jsx(pn,{className:"size-3"}),"Ensure the address matches the ",d," network."]})]})}function $n({token:e,value:t,onChange:n,readOnly:r=!1,onSelectToken:s,isLoading:a=!1,loadingText:l="Loading...",balance:i,isOutput:c=!1,isWalletConnected:d=!1,usdValue:f="$0.00"}){const u=m=>{if(r||!n)return;const b=m.target.value;/^[0-9]*\.?[0-9]*$/.test(b)&&n(b)},h=d&&!c&&i!==void 0,g=()=>{if(!i||!n||r)return;const m=(parseFloat(i)/2).toString();n(m)},v=()=>{!i||!n||r||n(i)};return o.jsxs("div",{className:"bg-[var(--optimex-surface)] rounded-2xl 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-white/40 text-xs",children:c?"To":"From"}),o.jsx("div",{className:"flex items-center gap-2",children:h&&o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"text-white/40 text-xs",children:["Balance: ",i," ",e?.token_symbol]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(qt,{onClick:g,children:"50%"}),o.jsx(qt,{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:u,readOnly:r,className:"w-full bg-transparent border-none p-0 text-white text-2xl font-bold focus:ring-0 placeholder:text-white/10 outline-none"}),o.jsxs("p",{className:"text-white/30 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-full transition-all border border-white/10 active:scale-95 shrink-0",children:[e?o.jsxs(o.Fragment,{children:[o.jsx(Le,{token:e,size:"md"}),o.jsxs("div",{className:"text-left",children:[o.jsx("p",{className:"text-white text-sm font-bold leading-none",children:e.token_symbol}),o.jsx("p",{className:"text-white/40 text-[10px] leading-none mt-1",children:e.network_name})]})]}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"size-8 rounded-full bg-white/10"}),o.jsx("span",{className:"text-white text-sm font-bold",children:"Select"})]}),o.jsx(Kn,{className:"size-4 text-white/20"})]})]}),a&&o.jsxs("div",{className:"flex items-center justify-end gap-2 text-sm text-white/40",children:[o.jsx("div",{className:"size-3 animate-spin rounded-full border border-[var(--optimex-primary)] border-t-transparent"}),o.jsx("span",{children:l})]})]})}const $t=[.5,.75,1];function _l({value:e,onChange:t}){const[n,r]=p.useState(""),[s,a]=p.useState(!$t.includes(e)),l=p.useCallback(d=>{a(!1),r(""),t(d)},[t]),i=p.useCallback(d=>{const f=d.target.value;if(f===""||/^\d*\.?\d*$/.test(f)){r(f),a(!0);const u=parseFloat(f);!isNaN(u)&&u>0&&u<=50&&t(u)}},[t]),c=p.useCallback(()=>{a(!0),!n&&e&&r($t.includes(e)?"":String(e))},[n,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:[$t.map(d=>o.jsxs(qt,{onClick:()=>l(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-zinc-800/80 border ${s?"border-[var(--optimex-primary)]":"border-transparent hover:bg-white/10"}`,children:[o.jsx("input",{type:"text",inputMode:"decimal",placeholder:"Custom",value:n,onChange:i,onFocus:c,className:"w-full min-w-0 py-[6px] bg-transparent text-center text-xs outline-none placeholder:text-white/50 text-white"}),o.jsx("span",{className:"text-xs text-white/50",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 Rl({isOpen:e,onClose:t,value:n,onChange:r,anchorRef:s}){const a=p.useCallback(l=>{r(l)},[r]);return o.jsx(wl,{isOpen:e,onClose:t,anchorRef:s,position:"bottom-right",width:"w-96",ariaLabel:"Slippage settings",children:o.jsx(_l,{value:n,onChange:a})})}function Al({title:e="Swap",slippage:t=.75,onSlippageChange:n,isSettingsOpen:r=!1,onSettingsToggle:s,onHistoryClick:a,hideHistory:l=!1}){const i=p.useRef(null);return 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 bg-[var(--optimex-primary)] rounded-lg flex items-center justify-center shadow-[0_0_15px_rgba(235,98,0,0.3)]",children:o.jsx(Xo,{className:"w-5 h-auto text-white"})}),o.jsx("h2",{className:"text-xl font-bold tracking-tight text-[var(--optimex-text)]",children:e})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[!l&&o.jsx("button",{onClick:a,className:"size-10 rounded-lg bg-white/5 hover:bg-white/10 text-white/60 hover:text-white transition-colors flex items-center justify-center","aria-label":"Trade History",children:o.jsx(Zo,{className:"size-5"})}),o.jsxs("div",{className:"relative",children:[o.jsx("button",{ref:i,onClick:s,className:"size-10 rounded-lg bg-white/5 hover:bg-white/10 text-white/60 hover:text-white transition-colors flex items-center justify-center","aria-label":"Settings",children:o.jsx(os,{className:"size-5"})}),o.jsx(Rl,{isOpen:r,onClose:()=>s?.(),value:t,onChange:c=>n?.(c),anchorRef:i})]})]})]})}function co({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-full 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(Go,{className:"size-5"})})})}function Ml({quote:e,fromToken:t,toToken:n,amount:r,slippage:s,isFetching:a}){const[l,i]=p.useState(!1),[c,d]=p.useState(!1),f=p.useCallback(()=>{d(w=>!w)},[]),u=p.useCallback(()=>{i(w=>!w)},[]),h=parseFloat(r)||0,g=parseFloat(e.min_amount_out)/Math.pow(10,n.token_decimals),v=h>0?g/h:0,m=g>0?h/g:0,b=()=>c?`1 ${n.token_symbol} = ${m.toFixed(6)} ${t.token_symbol}`:`1 ${t.token_symbol} = ${v.toFixed(6)} ${n.token_symbol}`;return o.jsxs("div",{className:"bg-white/[0.02] rounded-md border border-white/5 overflow-hidden",children:[o.jsxs("button",{type:"button",onClick:u,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-white/60 font-medium",children:a?o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"size-3 animate-spin rounded-full border border-[var(--optimex-primary)] border-t-transparent"}),o.jsx("span",{children:"Updating..."})]}):o.jsx("span",{role:"button",tabIndex:0,onClick:w=>{w.stopPropagation(),f()},onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&(w.stopPropagation(),f())},className:"hover:text-white transition-colors",children:b()})}),o.jsx(Kn,{className:`size-4 text-white/40 transition-transform ${l?"rotate-180":""}`})]}),l&&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-white/40",children:"Min. Received"}),o.jsxs("span",{className:"font-medium text-white",children:[je(e.min_amount_out,n.token_decimals)," ",n.token_symbol]})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-white/40",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-white/40",children:"Slippage Tolerance"}),o.jsxs("span",{className:"font-medium text-white",children:[s,"%"]})]})]})]})}function Ll({text:e,disabled:t,onClick:n}){return o.jsx("button",{disabled:t,onClick:n,className:"w-full font-semibold text-black bg-[var(--optimex-primary)] hover:bg-[var(--optimex-primary-hover)] hover:brightness-110 py-4 rounded-md 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 Pl(){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(Jo,{className:"h-3 w-auto"})]})}function Ol({value:e,onChange:t,placeholder:n="Search by name or symbol..."}){return o.jsx("div",{className:"p-4 pb-3",children:o.jsxs("div",{className:"relative",children:[o.jsx("input",{type:"text",placeholder:n,value:e,onChange:r=>t(r.target.value),className:"w-full rounded-xl bg-white/5 border border-white/10 px-4 py-3 pl-10 pr-10 text-white outline-none placeholder:text-white/30 transition-colors hover:border-[var(--optimex-primary)] focus:border-[var(--optimex-primary)]"}),o.jsx(rs,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-white/40"}),e&&o.jsx("button",{type:"button",onClick:()=>t(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-white/40 hover:text-white/60 transition-colors",children:o.jsx(Ae,{className:"size-5"})})]})})}function Il({networks:e,selectedNetwork:t,onSelectNetwork:n}){return o.jsxs("div",{className:"w-1/3 min-w-[140px] 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-white/40",children:"Networks"}),o.jsxs("div",{className:"space-y-1 px-2",children:[o.jsxs("button",{onClick:()=>n(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-white":"text-white/60 hover:bg-white/5 hover:text-white"}`,children:[o.jsx(qo,{}),o.jsx("span",{children:"All"})]}),e.map(r=>o.jsx(Dl,{network:r,isSelected:t===r.network_id,onSelect:()=>n(r.network_id)},r.network_id))]})]})}function Dl({network:e,isSelected:t,onSelect:n}){return o.jsxs("button",{onClick:n,className:`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm transition-colors ${t?"bg-white/5 text-white":"text-white/60 hover:bg-white/5 hover:text-white"}`,children:[e.logo_uri?o.jsx("img",{src:e.logo_uri,alt:e.name,className:"h-8 w-8 rounded-lg",onError:r=>{r.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 $l({tokens:e,selectedSymbol:t,onSelectSymbol:n,maxVisible:r=12}){return o.jsxs("div",{className:"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-white/40",children:"Tokens"}),o.jsxs("div",{className:"flex flex-wrap gap-1.5 overflow-hidden max-h-[5rem]",children:[o.jsx("button",{onClick:()=>n(null),className:`border rounded-lg px-2.5 py-1 text-xs font-medium transition-colors ${t===null?"border-[var(--optimex-primary)] text-white":"border-transparent text-white/60 hover:bg-white/10 hover:text-white"}`,children:"All"}),e.slice(0,r).map(s=>o.jsx(Fl,{token:s,isSelected:t===s.token_symbol,onSelect:()=>n(s.token_symbol)},s.token_symbol))]})]})}function Fl({token:e,isSelected:t,onSelect:n}){return o.jsxs("button",{onClick:n,className:vr("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-white":"border-transparent text-white/60 hover:bg-white/10 hover:text-white"),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:r=>{r.target.style.display="none"}}),e.token_symbol]})}function Ue(){const e=p.useContext(Hn);if(!e)throw new Error("useWallet must be used within WalletProvider");return e}function bt(e){return`https://network-api-stg.bitdex.xyz/${e}/rpc/zwD70RMT9DrE8L5SaMnJNMF8m70Gum`}function Bl(e){return e==="bitcoin_testnet"?"https://mempool.space/testnet4/api":"https://mempool.space/api"}function rn(e){return!e.token_address||e.token_address===""||e.token_address==="native"||e.token_address==="0x0000000000000000000000000000000000000000"}function zl(e,t){if(!e||e==="0")return"0";const n=BigInt(e),r=BigInt(10**t),s=n/r,a=n%r;if(a===BigInt(0))return s.toString();let l=a.toString().padStart(t,"0");return l=l.replace(/0+$/,""),l.length>6&&(l=l.slice(0,6)),`${s}.${l}`}function Vl(e){return`0x70a08231000000000000000000000000${e.toLowerCase().replace("0x","")}`}async function uo(e,t){const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw new Error(`RPC request failed: ${n.status}`);return n.json()}async function Wl(e,t){const r=await uo(e,{jsonrpc:"2.0",method:"eth_getBalance",params:[t,"latest"],id:1});if(r.error)throw new Error(`RPC error: ${r.error.message}`);const s=r.result||"0x0";return BigInt(s).toString()}async function Hl(e,t,n){const r={jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:Vl(n)},"latest"],id:1},s=await uo(e,r);if(s.error)throw new Error(`RPC error: ${s.error.message}`);const a=s.result||"0x0";return BigInt(a).toString()}async function Ul(e,t){const n=bt(e.network_id),r=rn(e);let s;return r?s=await Wl(n,t):s=await Hl(n,e.token_address,t),{rawBalance:s,isNative:r}}async function ql(e,t){const r=`${Bl(e.network_id)}/address/${t}`,s=await fetch(r);if(!s.ok)throw new Error(`Mempool API request failed: ${s.status}`);const a=await s.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 fo(e,t){const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw new Error(`RPC request failed: ${n.status}`);return n.json()}async function Gl(e,t){const r=await fo(e,{jsonrpc:"2.0",method:"getBalance",params:[t],id:1});if(r.error)throw new Error(`RPC error: ${r.error.message}`);return(r.result?.value||0).toString()}async function Kl(e,t,n){const s=await fo(e,{jsonrpc:"2.0",method:"getTokenAccountsByOwner",params:[n,{mint:t},{encoding:"jsonParsed"}],id:1});if(s.error)throw new Error(`RPC error: ${s.error.message}`);const a=s.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 Yl(e,t){const n=bt(e.network_id),r=rn(e);let s;return r?s=await Gl(n,t):s=await Kl(n,e.token_address,t),{rawBalance:s,isNative:r}}function Zl(e,t){if(!t)return!1;switch(t){case Y.EVM:return e.isEvmConnected;case Y.BTC:return e.isBtcConnected;case Y.SOLANA:return e.isSolanaConnected;default:return!1}}function Ql(e){if(!e)return"";switch(e){case Y.EVM:return"EVM";case Y.BTC:return"Bitcoin";case Y.SOLANA:return"Solana";default:return e}}function Xl(e,t){if(!t)return null;switch(t){case Y.EVM:return e.evmAddress;case Y.BTC:return e.btcAddress;case Y.SOLANA:return e.solanaAddress;default:return null}}async function Jl(e,t){const n=e.token_address||"native";let r;switch(e.network_type){case Y.BTC:r=await ql(e,t);break;case Y.SOLANA:r=await Yl(e,t);break;case Y.EVM:default:r=await Ul(e,t)}return{tokenId:n,networkId:e.network_id,walletAddress:t,rawBalance:r.rawBalance,formattedBalance:zl(r.rawBalance,e.token_decimals),updatedAt:Date.now()}}const ec=30*1e3,tc=15*1e3;function nc(e,t){return!e||!t?["balance"]:["balance",e.network_id,e.token_address||"native",t]}function mo({token:e,walletAddress:t,enabled:n=!0,polling:r=!1,pollingInterval:s=tc}){const a=n&&!!e&&!!t,{data:l,isLoading:i,isFetching:c,error:d,refetch:f}=ke.useQuery({queryKey:nc(e,t),queryFn:()=>Jl(e,t),enabled:a,staleTime:ec,retry:1,refetchOnWindowFocus:!1,refetchInterval:r?s:!1});return{balance:l,formattedBalance:l?.formattedBalance||"0",isLoading:a&&i,isFetching:a&&c,error:d,refetch:f}}function rc({token:e,isSelected:t,isDisabled:n,onSelect:r}){const s=Ue(),a=Xl(s,e.network_type),{formattedBalance:l,isLoading:i}=mo({token:e,walletAddress:a,enabled:!!a}),c=!!a;return o.jsxs("button",{onClick:r,disabled:n,className:`flex w-full items-center gap-3 rounded-lg p-2 transition-colors ${t?"bg-white/5 text-white":n?"cursor-not-allowed opacity-50":"hover:bg-white/5"}`,children:[o.jsx(Le,{token:e}),o.jsxs("div",{className:"flex-1 text-left",children:[o.jsx("div",{className:"text-sm text-white/40",children:e.token_name}),o.jsxs("div",{className:"flex items-center gap-2",children:[c&&o.jsx("span",{className:"text-sm font-medium text-white",children:i?o.jsx("span",{className:"inline-block h-4 w-12 animate-pulse rounded bg-white/10"}):l}),o.jsx("span",{className:"font-medium text-white",children:e.token_symbol})]})]}),t&&o.jsx(Yt,{className:"h-5 w-5 text-[var(--optimex-primary)]"})]})}function oc({tokens:e,selectedTokenId:t,disabledTokenId:n,disabledTokenIds:r,isLoading:s,emptyMessage:a="No tokens available",onSelect:l}){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-white/40",children:a})}):o.jsx("div",{className:"flex-1 overflow-y-auto p-2",children:o.jsx("div",{className:"space-y-1",children:e.map(i=>{const c=n===i.token_id||r?.has(i.token_id)===!0;return o.jsx(rc,{token:i,isSelected:t===i.token_id,isDisabled:c,onSelect:()=>l(i)},i.token_id)})})})}function sc({isOpen:e,onClose:t,onSelect:n,tokensData:r,isLoading:s,selectedToken:a,disabledTokenId:l,disabledTokenIds:i,tokens:c,emptyMessage:d,title:f="Select Token",filterNetworkType:u}){const[h,g]=p.useState(""),[v,m]=p.useState(null),[b,w]=p.useState(null),N=p.useMemo(()=>r?.supported_networks?u?r.supported_networks.filter(L=>L.type===u):r.supported_networks:[],[r,u]),k=c??r?.tokens,y=p.useMemo(()=>k?k.filter(L=>{if(u&&L.network_type!==u||v&&L.network_id!==v)return!1;if(h){const D=(V,W)=>V.toLowerCase().includes(W.toLowerCase()),A=h.toLowerCase();return D(L.token_symbol,A)||D(L.token_name,A)||D(L.token_address,A)}return!0}):[],[k,h,v,u]),E=p.useMemo(()=>{if(!k)return[];const L=new Map;return k.forEach(D=>{u&&D.network_type!==u||v&&D.network_id!==v||L.has(D.token_symbol)||L.set(D.token_symbol,D)}),Array.from(L.values())},[k,u,v]),P=p.useMemo(()=>b?y.filter(L=>L.token_symbol===b):y,[y,b]),j=()=>{g(""),m(null),w(null)},C=L=>{n(L),t(),j()},R=L=>{L||(t(),j())},B=L=>{m(L),w(null)};return o.jsx(tn,{open:e,onOpenChange:R,title:f,className:"h-full md:h-[70vh] max-h-[600px] w-full max-w-2xl",children:o.jsxs("div",{className:"flex h-full flex-col",children:[o.jsx(Ol,{value:h,onChange:g}),o.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[o.jsx(Il,{networks:N,selectedNetwork:v,onSelectNetwork:B}),o.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden pl-2",children:[o.jsx($l,{tokens:E,selectedSymbol:b,onSelectSymbol:w}),o.jsx(oc,{tokens:P,selectedTokenId:a?.token_id,disabledTokenId:l,disabledTokenIds:i,isLoading:s,emptyMessage:h?"No tokens found":d??"No tokens available",onSelect:C})]})]})]})})}function Fn({token:e,amount:t,label:n,isEstimated:r=!1,highlight:s=!1,usdValue:a="$0.00"}){return o.jsx("div",{className:`p-4 rounded-xl border transition-all duration-200 ${s?"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:o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("div",{className:"size-12 flex items-center justify-center ",children:o.jsx(Le,{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-zinc-500"}`,children:[n," ",r&&"(Est.)"]}),o.jsx("p",{className:"text-white text-sm font-semibold truncate",children:e.token_symbol}),o.jsx("p",{className:"text-zinc-500 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-white text-lg font-bold",children:r?`~${t}`:t}),o.jsx("p",{className:"text-zinc-400 text-xs",children:a})]})]})})}function ac({fromToken:e,toToken:t,fromAmount:n,toAmount:r,fromUsdValue:s="$0.00",toUsdValue:a="$0.00"}){return o.jsxs("div",{className:"relative flex flex-col gap-2",children:[o.jsx(Fn,{token:e,amount:n,label:"You Pay",usdValue:s}),o.jsx(co,{onClick:()=>{},disabled:!0}),o.jsx(Fn,{token:t,amount:r,label:"You Receive",usdValue:a})]})}function Ft({label:e,value:t,borderTop:n}){return o.jsxs("div",{className:`flex justify-between items-center text-sm ${n?"pt-2 mt-2 border-t border-white/5":""}`,children:[o.jsx("span",{className:"text-zinc-500",children:e}),o.jsx("div",{className:"flex items-center gap-1 text-white font-medium",children:t})]})}function ic({minReceived:e,estimatedTime:t,slippage:n,networkFee:r="Included"}){return o.jsxs("div",{className:"bg-[var(--optimex-surface)] rounded-xl p-4 border border-white/5 space-y-3",children:[o.jsx(Ft,{label:"Min. Received",value:e}),o.jsx(Ft,{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(Ft,{label:"Slippage Tolerance",value:n})]})}const lc=3e4,cc=6e4;function xt({symbol:e,enabled:t=!0}){const n=Je(),{data:r,isLoading:s,isError:a}=ke.useQuery({queryKey:["tokenPrice",e],queryFn:async()=>{if(!e)throw new Error("Symbol is required");return(await Ve(n.apiBaseUrl).getTokenPrice(e)).current_price},enabled:t&&!!e,staleTime:lc,refetchInterval:cc,retry:2});return{price:r??null,isLoading:s,isError:a,calculateUsdValue:i=>{if(!r||!i||isNaN(parseFloat(i)))return"$0.00";const c=parseFloat(i);if(c===0)return"$0.00";const d=c*r;return d<.01?"<$0.01":d<1?`$${d.toFixed(4)}`:d<1e3?`$${d.toFixed(2)}`:d<1e6?`$${(d/1e3).toFixed(2)}K`:`$${(d/1e6).toFixed(2)}M`}}}function dc({isOpen:e,onClose:t,onConfirm:n,fromToken:r,toToken:s,amountIn:a,quote:l,slippage:i,stage:c,receivingAddress:d=""}){const f=c!=="idle"&&c!=="confirming"&&c!=="error"&&c!=="submitted",u=c==="submitted",h=c==="error",g=je(l.min_amount_out,s.token_decimals),{calculateUsdValue:v}=xt({symbol:r.token_symbol,enabled:e}),{calculateUsdValue:m}=xt({symbol:s.token_symbol,enabled:e}),b=v(a),w=m(g),N=y=>{!y&&!f&&t()},k=u?"Swap Complete":h?"Swap Failed":"Review Swap";return o.jsxs(tn,{open:e,onOpenChange:N,title:k,showCloseButton:!f,className:"w-full max-w-md",children:[o.jsxs(hl,{className:"space-y-3",children:[o.jsx(ac,{fromToken:r,toToken:s,fromAmount:a,toAmount:g,fromUsdValue:b,toUsdValue:w}),o.jsx(ic,{minReceived:`${g} ${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(is,{icon:Zn,label:"Receiving Address",address:d})})]}),o.jsx(xl,{children:o.jsx(ea,{state:f?"processing":u?"success":h?"error":"idle",onConfirm:u?t:n,confirmText:"Confirm Swap"})})]})}function uc({swap:e}){const{tokens:t,modals:n,tokenSelect:r,actions:s,input:a,quote:l,execution:i}=e;return o.jsxs(o.Fragment,{children:[o.jsx(sc,{isOpen:n.tokenSelect.isOpen,onClose:n.tokenSelect.close,onSelect:s.selectToken,tokensData:t.data,isLoading:!1,selectedToken:r.type==="from"?t.from:t.to,disabledTokenId:r.type==="from"?t.to?.token_id:t.from?.token_id,tokens:r.type==="to"?t.availableTo:t.all,emptyMessage:r.type==="to"?"No available pairs for selected source token":void 0,title:r.type==="from"?"Select Source Token":"Select Destination Token"}),l.data&&t.from&&t.to&&o.jsx(dc,{isOpen:n.confirm.isOpen,onClose:s.closeConfirmModal,onConfirm:s.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 on({status:e}){const t={pending:{icon:Yn,text:"Processing",bgClass:"bg-yellow-500/10",textClass:"text-yellow-500",animate:!0},success:{icon:Yt,text:"Completed",bgClass:"bg-green-500/10",textClass:"text-green-500",animate:!1},failed:{icon:Ko,text:"Failed",bgClass:"bg-red-500/10",textClass:"text-red-500",animate:!1}},{icon:n,text:r,bgClass:s,textClass:a,animate:l}=t[e];return o.jsxs("div",{className:`flex items-center gap-1.5 px-2.5 py-1 rounded-full ${s}`,children:[o.jsx(n,{className:`w-4 h-4 ${a} ${l?"animate-spin":""}`}),o.jsx("span",{className:`text-xs font-medium ${a}`,children:r})]})}function fc({onClose:e}){return o.jsxs("div",{className:"bg-[var(--optimex-surface)] border border-[var(--optimex-border)] 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(on,{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(Ae,{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-[var(--optimex-border)] animate-pulse"}),o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx("div",{className:"w-16 h-4 bg-[var(--optimex-border)] rounded animate-pulse"}),o.jsx("div",{className:"w-10 h-3 bg-[var(--optimex-border)] 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-[var(--optimex-border)] rounded animate-pulse"}),o.jsx("div",{className:"w-10 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"})]})]})]})}function mc({trade:e,status:t,isLoading:n,onClose:r}){if(n||!e)return o.jsx(fc,{onClose:r});const s=e.from_token,a=e.to_token,l=je(e.amount_in,s.token_decimals),i=je(e.min_amount_out,a.token_decimals);return o.jsxs("div",{className:"bg-[var(--optimex-surface)] border border-[var(--optimex-border)] 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(on,{status:t}),r&&o.jsx("button",{onClick:r,className:"text-[var(--optimex-text-secondary)] hover:text-[var(--optimex-text)] transition-colors cursor-pointer","aria-label":"Close",children:o.jsx(Ae,{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(Le,{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:l}),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(Le,{token:a,size:"sm",showNetworkBadge:!1})]})]})]})}const pc=1e4;function hc({apiBaseUrl:e,walletAddresses:t,enabled:n=!0,limit:r=20}){const{data:s,isLoading:a,isError:l,refetch:i}=ke.useQuery({queryKey:["trades",t,r],queryFn:async()=>Ve(e).listTrades({from_user_address:t,limit:r}),enabled:n&&!!t?.length,refetchInterval:pc,retry:2,retryDelay:2e3});return{trades:s??[],isLoading:a,isError:l,refetch:i}}function xc(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 gc({trade:e}){const t=e.from_token,n=e.to_token,r=xc(e.state),s=je(e.amount_in,t.token_decimals),a=je(e.min_amount_out,n.token_decimals);return o.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-[var(--optimex-surface)] border border-[var(--optimex-border)]",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Le,{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:n.token_symbol})]}),o.jsx(Le,{token:n,size:"sm",showNetworkBadge:!1})]}),o.jsx("div",{className:"ml-3",children:o.jsx(on,{status:r})})]})}function Bt(){return o.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-[var(--optimex-surface)] border border-[var(--optimex-border)]",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 vc(){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 wc({open:e,onOpenChange:t,evmAddress:n,btcAddress:r,solanaAddress:s}){const a=Je(),l=[n,r,s].filter(d=>!!d),{trades:i,isLoading:c}=hc({apiBaseUrl:a.apiBaseUrl,walletAddresses:l.length>0?l:void 0,enabled:e&&l.length>0});return o.jsx(tn,{open:e,onOpenChange:t,title:"Trade History",className:"w-full max-w-md",children:o.jsxs("div",{className:"p-4 space-y-3 max-h-[60vh] overflow-y-auto",children:[c?o.jsxs(o.Fragment,{children:[o.jsx(Bt,{}),o.jsx(Bt,{}),o.jsx(Bt,{})]}):i.length===0?o.jsx(vc,{}):i.map(d=>o.jsx(gc,{trade:d},d.trade_id)),!c&&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(Yn,{className:"w-3 h-3 animate-spin"}),o.jsx("span",{children:"Auto-refreshing"})]})]})})}function bc(e,t){return p.useMemo(()=>{const n=e.trim();if(!t||!n)return{isValid:!n,error:void 0};const r=Kt(n,t.network_type,t.network_id);return{isValid:r.isValid,error:r.isValid?void 0:r.error}},[e,t])}function yc(){const[e,t]=p.useState(null),[n,r]=p.useState(!1),[s,a]=p.useState(!1),l=p.useCallback(()=>t("from"),[]),i=p.useCallback(()=>t("to"),[]),c=p.useCallback(()=>t(null),[]),d=p.useCallback(()=>r(!0),[]),f=p.useCallback(()=>r(!1),[]),u=p.useCallback(()=>a(g=>!g),[]),h=p.useCallback(()=>a(!1),[]);return{tokenSelect:{isOpen:e!==null,type:e,openFrom:l,openTo:i,close:c},confirm:{isOpen:n,open:d,close:f},settings:{isOpen:s,toggle:u,close:h}}}function Cc({fromToken:e,toToken:t,amount:n,fromUserAddress:r,toUserAddress:s,userRefundPubkey:a,slippage:l,config:i}){return p.useMemo(()=>{const c=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(l*100);return{from_token:e,to_token:t,amount:n,from_user_address:r,to_user_address:c||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,n,r,s,a,l,i.affiliateFee,i.affiliateAddress,i.affiliateProvider,i.tradeTimeout,i.scriptTimeout])}function kc(e,t){return p.useMemo(()=>{if(!e||!t)return{walletAccount:void 0,evmWalletAccount:void 0};switch(e.network_type){case Y.EVM:return{walletAccount:t.evm,evmWalletAccount:t.evm};case Y.BTC:return{walletAccount:t.btc,evmWalletAccount:void 0};case Y.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 jc(e){const{tokens:t,pairs:n,selectedFromToken:r}=e,s=p.useMemo(()=>{const g=new Map;if(!n)return g;for(const v of n){if(!v.is_active)continue;const m=g.get(v.from_token_id);m?m.add(v.to_token_id):g.set(v.from_token_id,new Set([v.to_token_id]))}return g},[n]),a=p.useMemo(()=>t??[],[t]),l=p.useMemo(()=>{const g=new Set;for(const v of a){const m=s.get(v.token_id);(!m||m.size===0)&&g.add(v.token_id)}return g},[a,s]),i=p.useMemo(()=>{if(!r)return[];const g=s.get(r.token_id);return!g||g.size===0?[]:a.filter(v=>g.has(v.token_id))},[r,s,a]),c=p.useCallback((g,v)=>s.get(g)?.has(v)??!1,[s]),d=p.useCallback(g=>(s.get(g)?.size??0)>0,[s]),f=p.useCallback(g=>[...g].sort((v,m)=>{const b=Bn[v.network_type]??99,w=Bn[m.network_type]??99;return b-w}),[]),u=p.useCallback(g=>{const v=s.get(g.token_id);if(!v||v.size===0)return null;const m=a.filter(w=>v.has(w.token_id));return m.length===0?null:f(m)[0]??null},[s,a,f]),h=p.useCallback(()=>{if(a.length===0)return null;const g=f(a);for(const v of g){const m=u(v);if(m)return{fromToken:v,toToken:m}}return null},[a,f,u]);return{allTokens:a,tokensWithoutPairs:l,availableToTokens:i,isPairValid:c,findBestToToken:u,hasValidPairs:d,getDefaultPair:h}}function Nc(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 Sc(e,t){const n=Nc(t);if(!n)throw new Error(`Cannot determine chain ID for token: ${t.token_id}`);return await e.getChainId()===n?!1:(await e.switchChain(n),!0)}const Ec="0xdd62ed3e",Tc="0x095ea7b3",_c="0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff";function Gt(e){return e.toLowerCase().replace("0x","").padStart(64,"0")}function Rc(e){return e.toString(16).padStart(64,"0")}function Ac(e){const t=e.startsWith("0x")?e.slice(2):e;return!t||t===""?0n:BigInt("0x"+t)}async function Mc(e,t,n,r){const s=bt(e),a=Ec+Gt(n)+Gt(r),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 Ac(i.result)}function Lc(e,t){const n=t?Rc(t):_c.slice(2);return`${Tc}${Gt(e)}${n}`}async function Pc(e,t,n,r){const s=Lc(n,r);return await e.sendTransaction({to:t,data:s})}async function Oc(e,t,n=60,r=2e3){const s=bt(e);for(let a=0;a<n;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 c=i.result;return{status:c.status==="0x1"?"success":"reverted",blockNumber:c.blockNumber,transactionHash:c.transactionHash}}await new Promise(c=>setTimeout(c,r))}throw new Error(`Transaction ${t} not confirmed after ${n} attempts`)}function Ic(e){return e?"getChainId"in e&&"switchChain"in e&&typeof e.getChainId=="function"&&typeof e.switchChain=="function":!1}function Dc({apiBaseUrl:e,onWalletTx:t,onSubmitTx:n,onError:r}){const[s,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(u=>({stage:"idle",txHash:null,tradeId:u.tradeId,error:null}))},[]),c=p.useCallback((u,h,g)=>{a(v=>({...v,stage:"error",error:u})),r?.({error:u,stage:h,trade_id:g})},[r]),d=p.useCallback(async(u,h,g,v)=>{const m=g.deposit_address;if(!m)throw new Error("Missing deposit address for EVM transaction");a(k=>({...k,stage:"switching_chain"})),await Sc(u,h);const b=rn(h);if(!b&&h.token_address&&(a(y=>({...y,stage:"checking_allowance"})),await Mc(h.network_id,h.token_address,u.address,m)<v)){a(P=>({...P,stage:"approving"}));const y=await Pc(u,h.token_address,m,v);if((await Oc(h.network_id,y)).status==="reverted")throw new Error("Token approval transaction reverted")}a(k=>({...k,stage:"broadcasting"}));const w={to:m,value:b?v:0n,data:g.payload?g.payload:void 0};return await u.sendTransaction(w)},[]),f=p.useCallback(async({quote:u,fromToken:h,toToken:g,amountIn:v,walletAccount:m,evmWalletAccount:b})=>{const w=Ve(e);try{a({stage:"confirming",txHash:null,tradeId:u.trade_id,error:null});const N=b||m;if(!N)throw new Error("Wallet not available");a(E=>({...E,stage:"signing"}));let k;const y=qn(v,h.token_decimals);if(h.network_type===Y.EVM){const E=b||(Ic(m)?m:null);if(E)k=await d(E,h,u,y);else{const P=u.deposit_address,j=u.payload?u.payload:void 0;if(!P)throw new Error("Missing deposit address for EVM transaction");a(R=>({...R,stage:"broadcasting"}));const C={to:P,value:y,data:j};k=await N.sendTransaction(C)}}else if(h.network_type===Y.BTC){if(!u.deposit_address)throw new Error("Missing deposit address for BTC transaction");a(E=>({...E,stage:"broadcasting"})),k=await N.sendTransaction({toAddress:u.deposit_address,amount:y})}else if(h.network_type===Y.SOLANA){if(!u.payload)throw new Error("Missing payload for Solana transaction");a(E=>({...E,stage:"broadcasting"})),k=await N.sendTransaction(u.payload)}else throw new Error(`Unsupported network type: ${h.network_type}`);t?.({trade_id:u.trade_id,tx_hash:k,from_token:h,to_token:g,amount_in:v}),a(E=>({...E,txHash:k,stage:"submitting"}));try{await w.submitTransaction(u.trade_id,k),n?.({trade_id:u.trade_id,tx_hash:k,status:"success"})}catch(E){throw n?.({trade_id:u.trade_id,tx_hash:k,status:"error",error:E.message}),E}return a(E=>({...E,stage:"submitted"})),{tradeId:u.trade_id,txHash:k}}catch(N){const k=s.stage==="approving"?"approval":"wallet_tx";throw c(N,k,u.trade_id),N}},[e,t,n,c,d,s.stage]);return{...s,executeSwap:f,resetState:l,resetStateKeepTradeId:i,isExecuting:s.stage!=="idle"&&s.stage!=="submitted"&&s.stage!=="error"}}function $c({defaultPair:e,isPairValid:t,findBestToToken:n,hasValidPairs:r,defaultSlippage:s=.75,selectingToken:a=null}){const[l,i]=p.useState(null),[c,d]=p.useState(null),[f,u]=p.useState(""),[h,g]=p.useState(""),[v,m]=p.useState(s),b=l??e?.fromToken??null,w=c??e?.toToken??null,N=p.useCallback(()=>{b&&w&&t(w.token_id,b.token_id)&&(i(w),d(b),u(""))},[b,w,t]),k=p.useCallback(y=>{if(a==="from"){if(!r(y.token_id))return!1;if(y.token_id===w?.token_id)d(b);else if(w&&!t(y.token_id,w.token_id)){const E=n(y);d(E)}return i(y),!0}else if(a==="to")return y.token_id===b?.token_id&&i(w),d(y),!0;return!1},[a,b,w,t,n,r]);return{fromToken:b,toToken:w,handleTokenSelect:k,handleSwapDirection:N,amount:f,setAmount:u,receivingAddress:h,setReceivingAddress:g,slippage:v,setSlippage:m}}function Fc({fromToken:e,toToken:t}){const n=Ue();return p.useMemo(()=>{const r=n.evmAddress,s=n.btcAddress,a=n.btcPublicKey;let l=null,i=null;return e?.network_type===Y.EVM?(l=r,i=r):e?.network_type===Y.BTC&&(l=s,i=a),{fromUserAddress:l,userRefundPubkey:i}},[n.evmAddress,n.btcAddress,n.btcPublicKey,e,t])}function Bc({fromToken:e,toToken:t,amount:n,quote:r,isLoadingQuote:s,isFetchingQuote:a,receivingAddress:l,onConnectWallet:i,onSwap:c}){const d=Ue();return p.useMemo(()=>{if(!Zl(d,e?.network_type)){const h=Ql(e?.network_type);return{text:h?`Connect ${h} Wallet`:"Connect Wallet",disabled:!1,action:i}}return!e||!t?{text:"Select Tokens",disabled:!0,action:void 0}:!n||parseFloat(n)<=0?{text:"Enter Amount",disabled:!0,action:void 0}:l.trim()?Kt(l,t.network_type,t.network_id).isValid?s||a?{text:"Getting Quote...",disabled:!0,action:void 0}:r?{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}},[d.isEvmConnected,d.isBtcConnected,d.isSolanaConnected,e,t,n,s,a,r,i,c,l])}function zc({tokens:e,defaultFromToken:t,defaultToToken:n,isPairValid:r}){return p.useMemo(()=>{if(!t||!n||!e)return null;const s=e.find(l=>l.token_id===t),a=e.find(l=>l.token_id===n);return!s||!a?null:r(s.token_id,a.token_id)?{fromToken:s,toToken:a}:null},[e,t,n,r])}function Vc(){const e=Ue(),t=Je(),n=yc(),{tokensData:r}=El(),s=r.tokens,a=r.pairs,{allTokens:l,tokensWithoutPairs:i,isPairValid:c,findBestToToken:d,hasValidPairs:f,getDefaultPair:u}=jc({tokens:s,pairs:a,selectedFromToken:null}),g=zc({tokens:s,defaultFromToken:t.defaultFromToken,defaultToToken:t.defaultToToken,isPairValid:c})??u(),{fromToken:v,toToken:m,handleTokenSelect:b,handleSwapDirection:w,amount:N,setAmount:k,receivingAddress:y,setReceivingAddress:E,slippage:P,setSlippage:j}=$c({defaultPair:g,isPairValid:c,findBestToToken:d,hasValidPairs:f,defaultSlippage:t.defaultSlippage,selectingToken:n.tokenSelect.type}),C=p.useMemo(()=>v?l.filter($=>c(v.token_id,$.token_id)):[],[v,l,c]),R=bc(y,m),{fromUserAddress:B,userRefundPubkey:L}=Fc({fromToken:v,toToken:m}),D=Cc({fromToken:v,toToken:m,amount:N,fromUserAddress:B,toUserAddress:y,userRefundPubkey:L,slippage:P,config:{affiliateFee:t.affiliateFee,affiliateAddress:t.affiliateAddress,affiliateProvider:t.affiliateProvider,tradeTimeout:t.tradeTimeout,scriptTimeout:t.scriptTimeout}}),A=!!v&&!!m&&parseFloat(N)>0&&!!y.trim()&&!n.confirm.isOpen,{data:V,isLoading:W,isFetching:G,refetch:H}=Ho(t.apiBaseUrl,{...D,enabled:A,onQuote:t.callbacks?.onQuote}),S=Dc({apiBaseUrl:t.apiBaseUrl,onWalletTx:t.callbacks?.onWalletTx,onSubmitTx:t.callbacks?.onSubmitTx,onError:t.callbacks?.onError}),{walletAccount:ne,evmWalletAccount:oe}=kc(v,e.externalWalletClient??void 0),Ne=p.useCallback(()=>{e.isExternalWallet?e.onRequestWallet?.(v?.network_id??""):e.openConnectModal?.()},[e,v?.network_id]),ue=p.useCallback(()=>{!V||!v||!m||(S.resetState(),n.confirm.open())},[V,v,m,n.confirm,S]),U=p.useCallback(($=!1)=>{S.isExecuting||(n.confirm.close(),$&&S.resetStateKeepTradeId())},[S,n.confirm]),Q=p.useCallback(async()=>{if(!(!V||!v||!m))try{await S.executeSwap({quote:V,fromToken:v,toToken:m,amountIn:N,walletAccount:ne,evmWalletAccount:oe}),U(!0),k(""),E("")}catch($){console.error("Swap failed:",$)}},[V,v,m,N,ne,oe,S,U,k,E]),ie=p.useCallback($=>{b($)&&n.tokenSelect.close()},[b,n.tokenSelect]),he=Bc({fromToken:v,toToken:m,amount:N,quote:V,isLoadingQuote:W,isFetchingQuote:G,receivingAddress:y,onConnectWallet:Ne,onSwap:ue});return{tokens:{from:v,to:m,all:l,availableTo:C,withoutPairs:i,data:r},input:{amount:N,setAmount:k,receivingAddress:y,setReceivingAddress:E,slippage:P,setSlippage:j},quote:{data:V,isLoading:W,isFetching:G,refetch:H},validation:{address:R},buttonState:he,modals:n,tokenSelect:{type:n.tokenSelect.type},actions:{selectToken:ie,swapDirection:w,connectWallet:Ne,openSwapConfirm:ue,closeConfirmModal:U,confirmSwap:Q},execution:{stage:S.stage,txHash:S.txHash,tradeId:S.tradeId,error:S.error,isExecuting:S.isExecuting},wallet:e,addresses:{sending:B,receiving:y}}}const Wc=5e3;function zn(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 Hc({apiBaseUrl:e,tradeId:t}){const{data:n,isLoading:r}=ke.useQuery({queryKey:["trade",t],queryFn:async()=>Ve(e).getTrade(t),enabled:!!t,refetchInterval:s=>{const a=s.state.data;return a&&zn(a.state)==="success"?!1:Wc},retry:!0,retryDelay:2e3});return{trade:n??null,status:zn(n?.state),isLoading:r}}function po(){const e=Vc(),t=Je(),{tokens:n,input:r,quote:s,modals:a,buttonState:l,validation:i,actions:c,addresses:d,wallet:f,execution:u}=e,[h,g]=p.useState(!1),{trade:v,status:m,isLoading:b}=Hc({apiBaseUrl:t.apiBaseUrl,tradeId:u.tradeId}),{formattedBalance:w}=mo({token:n.from,walletAddress:d.sending,enabled:!!n.from&&!!d.sending,polling:!0}),{calculateUsdValue:N}=xt({symbol:n.from?.token_symbol,enabled:!!n.from}),{calculateUsdValue:k}=xt({symbol:n.to?.token_symbol,enabled:!!n.to}),y=f.isConnected,E=N(r.amount),P=s.data?k(je(s.data.min_amount_out,n.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(Al,{slippage:r.slippage,onSlippageChange:r.setSlippage,isSettingsOpen:a.settings.isOpen,onSettingsToggle:a.settings.toggle,onHistoryClick:()=>g(!0),hideHistory:t.hideHistory||!f.isConnected}),o.jsxs(nn,{children:[o.jsxs("div",{className:"space-y-2 relative",children:[o.jsx($n,{token:n.from,value:r.amount,onChange:r.setAmount,onSelectToken:a.tokenSelect.openFrom,balance:w,isWalletConnected:y,usdValue:E}),o.jsx(co,{onClick:c.swapDirection}),o.jsx($n,{token:n.to,value:s.data?je(s.data.min_amount_out,n.to?.token_decimals||18):"",readOnly:!0,onSelectToken:a.tokenSelect.openTo,isOutput:!0,usdValue:P})]}),o.jsx("div",{className:"mt-4",children:o.jsx(Tl,{token:n.to,value:r.receivingAddress,onChange:r.setReceivingAddress,error:i.address.error})}),o.jsx("div",{className:"mt-4",children:o.jsx(Ll,{text:l.text,disabled:l.disabled,onClick:l.action})}),s.data&&n.from&&n.to&&o.jsx("div",{className:"mt-4",children:o.jsx(Ml,{quote:s.data,fromToken:n.from,toToken:n.to,amount:r.amount,slippage:r.slippage,isFetching:s.isFetching,onRefresh:s.refetch})}),o.jsx("div",{className:"mt-4",children:o.jsx(Pl,{})}),u.tradeId&&o.jsx("div",{className:"mt-4",children:o.jsx(mc,{trade:v,status:m,isLoading:b})})]})]}),o.jsx(uc,{swap:e}),h&&o.jsx(wc,{open:h,onOpenChange:g,evmAddress:f.evmAddress??void 0,btcAddress:f.btcAddress??void 0,solanaAddress:f.solanaAddress??void 0})]})}function Uc({className:e,connectLabel:t="Connect Wallet",showNetworkBadge:n=!0,onClick:r}){const s=Ue(),a=s.evmAddress||s.btcAddress||s.solanaAddress,l=()=>{if(r){r();return}s.isExternalWallet?s.onRequestWallet?.():s.openConnectModal?.()},i=()=>n?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: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:[o.jsx("span",{children:Do(a)}),o.jsx(Qo,{className:"h-3.5 w-3.5 opacity-0 transition-opacity group-hover:opacity-100"})]})]}):o.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 qc({apiBaseUrl:e,walletClient:t,onRequestWallet:n,theme:r,defaultFromToken:s,defaultToToken:a,affiliateFee:l,affiliateAddress:i,affiliateProvider:c,tradeTimeout:d,scriptTimeout:f,defaultSlippage:u=.75,hideHistory:h=!1,children:g,renderLoading:v,renderError:m,queryClient:b,onQuote:w,onWalletTx:N,onSubmitTx:k,onSwapComplete:y,onError:E}){Mo(e);const P=p.useMemo(()=>b??new ke.QueryClient,[b]),C={apiBaseUrl:e,defaultSlippage:u,affiliateFee:l,affiliateAddress:i,affiliateProvider:c,tradeTimeout:d,scriptTimeout:f,defaultFromToken:s,defaultToToken:a,hideHistory:h,callbacks:{onQuote:w,onWalletTx:N,onSubmitTx:k,onSwapComplete:y,onError:E},renderLoading:v,renderError:m},R=g??o.jsx(po,{});return o.jsx("div",{className:"optx-widget",children:o.jsx(ke.QueryClientProvider,{client:P,children:o.jsx(Uo,{value:C,children:o.jsx(Ro,{theme:r,children:o.jsx(Ao,{externalWalletClient:t,onRequestWallet:n,children:o.jsx(Sl,{children:R})})})})})})}exports.ConnectButton=Uc;exports.SwapCard=po;exports.SwapWidget=qc;exports.useWallet=Ue;