@iccandle/widget-web-trading 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web-trading-widget.cjs +21 -21
- package/dist/web-trading-widget.js +5155 -5005
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";var mh=Object.defineProperty;var Bc=e=>{throw TypeError(e)};var hh=(e,t,n)=>t in e?mh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var st=(e,t,n)=>hh(e,typeof t!="symbol"?t+"":t,n),Xi=(e,t,n)=>t.has(e)||Bc("Cannot "+n);var E=(e,t,n)=>(Xi(e,t,"read from private field"),n?n.call(e):t.get(e)),te=(e,t,n)=>t.has(e)?Bc("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),K=(e,t,n,r)=>(Xi(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),ge=(e,t,n)=>(Xi(e,t,"access private method"),n);var hs=(e,t,n,r)=>({set _(s){K(e,t,s,n)},get _(){return E(e,t,r)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),C=require("react"),gh=require("react-dom");function ou(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 w=ou(C),Cr=ou(gh);function $c(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function yh(...e){return t=>{let n=!1;const r=e.map(s=>{const i=$c(s,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let s=0;s<r.length;s++){const i=r[s];typeof i=="function"?i():$c(e[s],null)}}}}function Ne(...e){return w.useCallback(yh(...e),e)}function pr(e){const t=w.forwardRef((n,r)=>{let{children:s,...i}=n,o=null,a=!1;const l=[];Vc(s)&&typeof gs=="function"&&(s=gs(s._payload)),w.Children.forEach(s,y=>{var m;if(Sh(y)){a=!0;const g=y;let p="child"in g.props?g.props.child:g.props.children;Vc(p)&&typeof gs=="function"&&(p=gs(p._payload)),o=wh(g,p),l.push((m=o==null?void 0:o.props)==null?void 0:m.children)}else l.push(y)}),o?o=w.cloneElement(o,void 0,l):!a&&w.Children.count(s)===1&&w.isValidElement(s)&&(o=s);const d=o?xh(o):void 0,f=Ne(r,d);if(!o){if(s||s===0)throw new Error(a?Ph(e):Th(e));return s}const u=_h(i,o.props??{});return o.type!==w.Fragment&&(u.ref=r?f:d),w.cloneElement(o,u)});return t.displayName=`${e}.Slot`,t}var bh=pr("Slot"),vh=Symbol.for("radix.slottable"),wh=(e,t)=>{if("child"in e.props){const n=e.props.child;return w.isValidElement(n)?w.cloneElement(n,void 0,e.props.children(n.props.children)):null}return w.isValidElement(t)?t:null};function _h(e,t){const n={...t};for(const r in t){const s=e[r],i=t[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...a)=>{const l=i(...a);return s(...a),l}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...e,...n}}function xh(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Sh(e){return w.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===vh}var Ch=Symbol.for("react.lazy");function Vc(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Ch&&"_payload"in e&&Eh(e._payload)}function Eh(e){return typeof e=="object"&&e!==null&&"then"in e}var Th=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,Ph=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,gs=w[" use ".trim().toString()];function au(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=au(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function cu(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=au(e))&&(r&&(r+=" "),r+=t);return r}const Hc=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,zc=cu,Ea=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return zc(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:i}=t,o=Object.keys(s).map(d=>{const f=n==null?void 0:n[d],u=i==null?void 0:i[d];if(f===null)return null;const y=Hc(f)||Hc(u);return s[d][y]}),a=n&&Object.entries(n).reduce((d,f)=>{let[u,y]=f;return y===void 0||(d[u]=y),d},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,f)=>{let{class:u,className:y,...m}=f;return Object.entries(m).every(g=>{let[p,h]=g;return Array.isArray(h)?h.includes({...i,...a}[p]):{...i,...a}[p]===h})?[...d,u,y]:d},[]);return zc(e,o,l,n==null?void 0:n.class,n==null?void 0:n.className)},Bt=[{ticker:"EUR_JPY",display_name:"EURJPY",logo_urls:["https://cdn.iccandle.ai/web-assets/EUR.svg","https://cdn.iccandle.ai/web-assets/JPY.svg"],description:"EUR JPY",type:"forex",session:"1700-1700",pricescale:1e3,resolve_symbol:"EURJPY"},{ticker:"GBP_JPY",display_name:"GBPJPY",logo_urls:["https://cdn.iccandle.ai/web-assets/GBP.svg","https://cdn.iccandle.ai/web-assets/JPY.svg"],description:"GBP JPY",type:"forex",session:"1700-1700",pricescale:1e3,resolve_symbol:"GBPJPY"},{ticker:"AUD_JPY",display_name:"AUDJPY",logo_urls:["https://cdn.iccandle.ai/web-assets/AUD.svg","https://cdn.iccandle.ai/web-assets/JPY.svg"],description:"AUD JPY",type:"forex",session:"1700-1700",pricescale:1e3,resolve_symbol:"AUDJPY"},{ticker:"NZD_JPY",display_name:"NZDJPY",logo_urls:["https://cdn.iccandle.ai/web-assets/NZD.svg","https://cdn.iccandle.ai/web-assets/JPY.svg"],description:"NZD JPY",type:"forex",session:"1700-1700",pricescale:1e3,resolve_symbol:"NZDJPY"},{ticker:"CAD_JPY",display_name:"CADJPY",logo_urls:["https://cdn.iccandle.ai/web-assets/CAD.svg","https://cdn.iccandle.ai/web-assets/JPY.svg"],description:"CAD JPY",type:"forex",session:"1700-1700",pricescale:1e3,resolve_symbol:"CADJPY"},{ticker:"CHF_JPY",display_name:"CHFJPY",logo_urls:["https://cdn.iccandle.ai/web-assets/CHF.svg","https://cdn.iccandle.ai/web-assets/JPY.svg"],description:"CHF JPY",type:"forex",session:"1700-1700",pricescale:1e3,resolve_symbol:"CHFJPY"},{ticker:"USD_JPY",display_name:"USDJPY",logo_urls:["https://cdn.iccandle.ai/web-assets/USD.svg","https://cdn.iccandle.ai/web-assets/JPY.svg"],description:"USD JPY",type:"forex",session:"1700-1700",pricescale:1e3,resolve_symbol:"USDJPY"},{ticker:"EUR_USD",display_name:"EURUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/EUR.svg","https://cdn.iccandle.ai/web-assets/USD.svg"],description:"EUR USD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"EURUSD"},{ticker:"AUD_USD",display_name:"AUDUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/AUD.svg","https://cdn.iccandle.ai/web-assets/USD.svg"],description:"AUD USD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"AUDUSD"},{ticker:"NZD_USD",display_name:"NZDUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/NZD.svg","https://cdn.iccandle.ai/web-assets/USD.svg"],description:"NZD USD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"NZDUSD"},{ticker:"USD_CHF",display_name:"USDCHF",logo_urls:["https://cdn.iccandle.ai/web-assets/USD.svg","https://cdn.iccandle.ai/web-assets/CHF.svg"],description:"USD CHF",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"USDCHF"},{ticker:"USD_CAD",display_name:"USDCAD",logo_urls:["https://cdn.iccandle.ai/web-assets/USD.svg","https://cdn.iccandle.ai/web-assets/CAD.svg"],description:"USD CAD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"USDCAD"},{ticker:"GBP_AUD",display_name:"GBPAUD",logo_urls:["https://cdn.iccandle.ai/web-assets/GBP.svg","https://cdn.iccandle.ai/web-assets/AUD.svg"],description:"GBP AUD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"GBPAUD"},{ticker:"GBP_CAD",display_name:"GBPCAD",logo_urls:["https://cdn.iccandle.ai/web-assets/GBP.svg","https://cdn.iccandle.ai/web-assets/CAD.svg"],description:"GBP CAD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"GBPCAD"},{ticker:"GBP_CHF",display_name:"GBPCHF",logo_urls:["https://cdn.iccandle.ai/web-assets/GBP.svg","https://cdn.iccandle.ai/web-assets/CHF.svg"],description:"GBP CHF",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"GBPCHF"},{ticker:"GBP_NZD",display_name:"GBPNZD",logo_urls:["https://cdn.iccandle.ai/web-assets/GBP.svg","https://cdn.iccandle.ai/web-assets/NZD.svg"],description:"GBP NZD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"GBPNZD"},{ticker:"GBP_USD",display_name:"GBPUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/GBP.svg","https://cdn.iccandle.ai/web-assets/USD.svg"],description:"GBP USD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"GBPUSD"},{ticker:"NZD_CAD",display_name:"NZDCAD",logo_urls:["https://cdn.iccandle.ai/web-assets/NZD.svg","https://cdn.iccandle.ai/web-assets/CAD.svg"],description:"NZD CAD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"NZDCAD"},{ticker:"EUR_CAD",display_name:"EURCAD",logo_urls:["https://cdn.iccandle.ai/web-assets/EUR.svg","https://cdn.iccandle.ai/web-assets/CAD.svg"],description:"EUR CAD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"EURCAD"},{ticker:"EUR_AUD",display_name:"EURAUD",logo_urls:["https://cdn.iccandle.ai/web-assets/EUR.svg","https://cdn.iccandle.ai/web-assets/AUD.svg"],description:"EUR AUD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"EURAUD"},{ticker:"XAU_USD",display_name:"XAUUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/XAU.svg"],description:"Gold",type:"commodity",session:"1700-1700",pricescale:1e3,resolve_symbol:"XAUUSD"},{ticker:"BCO_USD",display_name:"BCOUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/BCO.svg"],description:"Brent Crude Oil",type:"commodity",session:"1700-1700",pricescale:1e3,resolve_symbol:"SpotBrent"},{ticker:"SPX500_USD",display_name:"S&P500",logo_urls:["https://cdn.iccandle.ai/web-assets/SPX500.svg"],description:"S&P 500",type:"indices",session:"1700-1700",pricescale:10,resolve_symbol:"SP500"},{ticker:"NAS100_USD",display_name:"NASDAQ100",logo_urls:["https://cdn.iccandle.ai/web-assets/NAS100.svg"],description:"NASDAQ 100",type:"indices",session:"1700-1700",pricescale:10,resolve_symbol:"NAS100"},{ticker:"US30_USD",display_name:"US30",logo_urls:["https://cdn.iccandle.ai/web-assets/US30.svg"],description:"US Wall St 30",type:"indices",session:"1700-1700",pricescale:10,resolve_symbol:"US30"},{ticker:"BTCUSDT",display_name:"BTCUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/BTC.svg"],description:"BTCUSDT",type:"crypto",session:"24x7",pricescale:100,resolve_symbol:"BTCUSD"},{ticker:"ETHUSDT",display_name:"ETHUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/ETH.svg"],description:"ETHUSDT",type:"crypto",session:"24x7",pricescale:100,resolve_symbol:"ETHUSD"},{ticker:"XRPUSDT",display_name:"XRPUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/XRP.svg"],description:"XRPUSDT",type:"crypto",session:"24x7",pricescale:1e4,resolve_symbol:"XRPUSD"},{ticker:"SOLUSDT",display_name:"SOLUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/SOL.svg"],description:"SOLUSDT",type:"crypto",session:"24x7",pricescale:100,resolve_symbol:"SOLUSD"},{ticker:"ADAUSDT",display_name:"ADAUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/ADA.svg"],description:"ADAUSDT",type:"crypto",session:"24x7",pricescale:1e4,resolve_symbol:"ADAUSD"},{ticker:"AVAUSDT",display_name:"AVAUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/AVA.svg"],description:"AVAUSDT",type:"crypto",session:"24x7",pricescale:1e4,resolve_symbol:"AVAUSD"},{ticker:"AVAXUSDT",display_name:"AVAXUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/AVAX.svg"],description:"AVAXUSDT",type:"crypto",session:"24x7",pricescale:100,resolve_symbol:"AVAXUSD"},{ticker:"BNBUSDT",display_name:"BNBUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/BNB.svg"],description:"BNBUSDT",type:"crypto",session:"24x7",pricescale:100,resolve_symbol:"BNBUSD"},{ticker:"DOGEUSDT",display_name:"DOGEUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/DOGE.svg"],description:"DOGEUSDT",type:"crypto",session:"24x7",pricescale:1e5,resolve_symbol:"DOGUSD"},{ticker:"DOTUSDT",display_name:"DOTUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/DOT.svg"],description:"DOTUSDT",type:"crypto",session:"24x7",pricescale:1e3,resolve_symbol:"DOTUSD"},{ticker:"TRXUSDT",display_name:"TRXUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/TRX.svg"],description:"TRXUSDT",type:"crypto",session:"24x7",pricescale:1e4,resolve_symbol:"TRXUSD"},{ticker:"AAPL",display_name:"AAPL",logo_urls:["https://cdn.iccandle.ai/web-assets/AAPL.svg"],description:"Apple Inc.",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"AAPL"},{ticker:"AMZN",display_name:"AMZN",logo_urls:["https://cdn.iccandle.ai/web-assets/AMZN.svg"],description:"Amazon.Com Inc",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"AMZN"},{ticker:"BRK.B",display_name:"BRK.B",logo_urls:["https://cdn.iccandle.ai/web-assets/BRK.B.svg"],description:"BERKSHIRE HATHAWAY Class B",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"BRKB"},{ticker:"GOOGL",display_name:"GOOGL",logo_urls:["https://cdn.iccandle.ai/web-assets/GOOGL.svg"],description:"Alphabet Inc. Class A Common Stock",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"GOOGL"},{ticker:"KO",display_name:"KO",logo_urls:["https://cdn.iccandle.ai/web-assets/KO.svg"],description:"Coca-Cola Company",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"KO"},{ticker:"META",display_name:"META",logo_urls:["https://cdn.iccandle.ai/web-assets/META.svg"],description:"Meta Platforms, Inc. Class A Common Stock",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"META"},{ticker:"MSFT",display_name:"MSFT",logo_urls:["https://cdn.iccandle.ai/web-assets/MSFT.svg"],description:"Microsoft Corp",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"MSFT"},{ticker:"NFLX",display_name:"NFLX",logo_urls:["https://cdn.iccandle.ai/web-assets/NFLX.svg"],description:"NetFlix Inc",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"NFLX"},{ticker:"NKE",display_name:"NKE",logo_urls:["https://cdn.iccandle.ai/web-assets/NKE.svg"],description:"Nike, Inc.",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"NKE"},{ticker:"NVDA",display_name:"NVDA",logo_urls:["https://cdn.iccandle.ai/web-assets/NVDA.svg"],description:"Nvidia Corp",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"NVDA"},{ticker:"TME",display_name:"TME",logo_urls:["https://cdn.iccandle.ai/web-assets/TME.svg"],description:"Tencent Music Entertainment Group American Depositary Shares, each representing two Class A Ordinary Shares",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"TME"},{ticker:"TSLA",display_name:"TSLA",logo_urls:["https://cdn.iccandle.ai/web-assets/TSLA.svg"],description:"Tesla, Inc. Common Stock",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"TSLA"},{ticker:"XAG_USD",display_name:"XAGUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/XAG.svg"],description:"Silver",type:"commodity",session:"1700-1700",pricescale:1e3,resolve_symbol:"XAGUSD"},{ticker:"XCU_USD",display_name:"XCUUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/XCU.svg"],description:"Copper",type:"commodity",session:"1700-1700",pricescale:1e3,resolve_symbol:"XCUUSD"}],Ah={[-11]:["Pacific/Fakaofo"],[-10]:["Pacific/Honolulu"],[-9]:["America/Anchorage","America/Juneau"],[-8]:["America/Los_Angeles","America/Vancouver"],[-7]:["US/Mountain"],[-6]:["America/Chicago","America/El_Salvador"],[-5]:["America/New_York","America/Lima","America/Bogota"],[-4]:["America/Caracas","America/Santiago","America/Toronto"],[-3]:["America/Argentina/Buenos_Aires","America/Sao_Paulo"],0:["Europe/London","Atlantic/Reykjavik","Africa/Casablanca","Africa/Tunis","Africa/Lagos"],1:["Europe/Amsterdam","Europe/Berlin","Europe/Madrid","Europe/Paris"],2:["Europe/Athens","Africa/Cairo","Africa/Johannesburg"],3:["Europe/Moscow","Asia/Riyadh","Asia/Qatar"],3.5:["Asia/Tehran"],4:["Asia/Dubai","Asia/Muscat"],4.5:[],5:["Asia/Karachi"],5.5:["Asia/Kolkata","Asia/Colombo"],5.75:["Asia/Kathmandu"],6:["Asia/Dhaka","Asia/Almaty"],6.5:["Asia/Yangon"],7:["Asia/Bangkok","Asia/Jakarta"],8:["Asia/Shanghai","Asia/Singapore","Asia/Hong_Kong","Asia/Kuala_Lumpur"],9:["Asia/Tokyo","Asia/Seoul"],9.5:["Australia/Adelaide"],10:["Australia/Sydney","Australia/Brisbane"],11:["Pacific/Norfolk"],12:["Pacific/Auckland"]};function Oh(){const e=-new Date().getTimezoneOffset()/60,t=Ah[e];return t&&t.length>0?t[0]:"Etc/UTC"}const Qn="tv:latest-symbol",lu="web-trading-last-account-login";function Nh(){for(var e=0,t,n,r="";e<arguments.length;)(t=arguments[e++])&&(n=du(t))&&(r&&(r+=" "),r+=n);return r}function du(e){if(typeof e=="string")return e;for(var t,n="",r=0;r<e.length;r++)e[r]&&(t=du(e[r]))&&(n&&(n+=" "),n+=t);return n}var Ta="-";function kh(e){var t=Lh(e),n=e.conflictingClassGroups,r=e.conflictingClassGroupModifiers,s=r===void 0?{}:r;function i(a){var l=a.split(Ta);return l[0]===""&&l.length!==1&&l.shift(),uu(l,t)||Rh(a)}function o(a,l){var d=n[a]||[];return l&&s[a]?[].concat(d,s[a]):d}return{getClassGroupId:i,getConflictingClassGroupIds:o}}function uu(e,t){var o;if(e.length===0)return t.classGroupId;var n=e[0],r=t.nextPart.get(n),s=r?uu(e.slice(1),r):void 0;if(s)return s;if(t.validators.length!==0){var i=e.join(Ta);return(o=t.validators.find(function(a){var l=a.validator;return l(i)}))==null?void 0:o.classGroupId}}var Wc=/^\[(.+)\]$/;function Rh(e){if(Wc.test(e)){var t=Wc.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}}function Lh(e){var t=e.theme,n=e.prefix,r={nextPart:new Map,validators:[]},s=jh(Object.entries(e.classGroups),n);return s.forEach(function(i){var o=i[0],a=i[1];Ao(a,r,o,t)}),r}function Ao(e,t,n,r){e.forEach(function(s){if(typeof s=="string"){var i=s===""?t:Kc(t,s);i.classGroupId=n;return}if(typeof s=="function"){if(Dh(s)){Ao(s(r),t,n,r);return}t.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(function(o){var a=o[0],l=o[1];Ao(l,Kc(t,a),n,r)})})}function Kc(e,t){var n=e;return t.split(Ta).forEach(function(r){n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n}function Dh(e){return e.isThemeGetter}function jh(e,t){return t?e.map(function(n){var r=n[0],s=n[1],i=s.map(function(o){return typeof o=="string"?t+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(function(a){var l=a[0],d=a[1];return[t+l,d]})):o});return[r,i]}):e}function Ih(e){if(e<1)return{get:function(){},set:function(){}};var t=0,n=new Map,r=new Map;function s(i,o){n.set(i,o),t++,t>e&&(t=0,r=n,n=new Map)}return{get:function(o){var a=n.get(o);if(a!==void 0)return a;if((a=r.get(o))!==void 0)return s(o,a),a},set:function(o,a){n.has(o)?n.set(o,a):s(o,a)}}}var fu="!";function Mh(e){var t=e.separator||":",n=t.length===1,r=t[0],s=t.length;return function(o){for(var a=[],l=0,d=0,f,u=0;u<o.length;u++){var y=o[u];if(l===0){if(y===r&&(n||o.slice(u,u+s)===t)){a.push(o.slice(d,u)),d=u+s;continue}if(y==="/"){f=u;continue}}y==="["?l++:y==="]"&&l--}var m=a.length===0?o:o.substring(d),g=m.startsWith(fu),p=g?m.substring(1):m,h=f&&f>d?f-d:void 0;return{modifiers:a,hasImportantModifier:g,baseClassName:p,maybePostfixModifierPosition:h}}}function Fh(e){if(e.length<=1)return e;var t=[],n=[];return e.forEach(function(r){var s=r[0]==="[";s?(t.push.apply(t,n.sort().concat([r])),n=[]):n.push(r)}),t.push.apply(t,n.sort()),t}function Uh(e){return{cache:Ih(e.cacheSize),splitModifiers:Mh(e),...kh(e)}}var Bh=/\s+/;function $h(e,t){var n=t.splitModifiers,r=t.getClassGroupId,s=t.getConflictingClassGroupIds,i=new Set;return e.trim().split(Bh).map(function(o){var a=n(o),l=a.modifiers,d=a.hasImportantModifier,f=a.baseClassName,u=a.maybePostfixModifierPosition,y=r(u?f.substring(0,u):f),m=!!u;if(!y){if(!u)return{isTailwindClass:!1,originalClassName:o};if(y=r(f),!y)return{isTailwindClass:!1,originalClassName:o};m=!1}var g=Fh(l).join(":"),p=d?g+fu:g;return{isTailwindClass:!0,modifierId:p,classGroupId:y,originalClassName:o,hasPostfixModifier:m}}).reverse().filter(function(o){if(!o.isTailwindClass)return!0;var a=o.modifierId,l=o.classGroupId,d=o.hasPostfixModifier,f=a+l;return i.has(f)?!1:(i.add(f),s(l,d).forEach(function(u){return i.add(a+u)}),!0)}).reverse().map(function(o){return o.originalClassName}).join(" ")}function Vh(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r,s,i,o=a;function a(d){var f=t[0],u=t.slice(1),y=u.reduce(function(m,g){return g(m)},f());return r=Uh(y),s=r.cache.get,i=r.cache.set,o=l,l(d)}function l(d){var f=s(d);if(f)return f;var u=$h(d,r);return i(d,u),u}return function(){return o(Nh.apply(null,arguments))}}function Oe(e){var t=function(r){return r[e]||[]};return t.isThemeGetter=!0,t}var pu=/^\[(?:([a-z-]+):)?(.+)\]$/i,Hh=/^\d+\/\d+$/,zh=new Set(["px","full","screen"]),Wh=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Kh=/\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$/,qh=/^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;function ut(e){return bn(e)||zh.has(e)||Hh.test(e)||Oo(e)}function Oo(e){return Un(e,"length",Jh)}function Gh(e){return Un(e,"size",mu)}function Zh(e){return Un(e,"position",mu)}function Yh(e){return Un(e,"url",eg)}function ys(e){return Un(e,"number",bn)}function bn(e){return!Number.isNaN(Number(e))}function Qh(e){return e.endsWith("%")&&bn(e.slice(0,-1))}function Rr(e){return qc(e)||Un(e,"number",qc)}function ye(e){return pu.test(e)}function Lr(){return!0}function Wt(e){return Wh.test(e)}function Xh(e){return Un(e,"",tg)}function Un(e,t,n){var r=pu.exec(e);return r?r[1]?r[1]===t:n(r[2]):!1}function Jh(e){return Kh.test(e)}function mu(){return!1}function eg(e){return e.startsWith("url(")}function qc(e){return Number.isInteger(Number(e))}function tg(e){return qh.test(e)}function ng(){var e=Oe("colors"),t=Oe("spacing"),n=Oe("blur"),r=Oe("brightness"),s=Oe("borderColor"),i=Oe("borderRadius"),o=Oe("borderSpacing"),a=Oe("borderWidth"),l=Oe("contrast"),d=Oe("grayscale"),f=Oe("hueRotate"),u=Oe("invert"),y=Oe("gap"),m=Oe("gradientColorStops"),g=Oe("gradientColorStopPositions"),p=Oe("inset"),h=Oe("margin"),b=Oe("opacity"),v=Oe("padding"),_=Oe("saturate"),x=Oe("scale"),S=Oe("sepia"),T=Oe("skew"),P=Oe("space"),O=Oe("translate"),R=function(){return["auto","contain","none"]},M=function(){return["auto","hidden","clip","visible","scroll"]},N=function(){return["auto",ye,t]},j=function(){return[ye,t]},H=function(){return["",ut]},k=function(){return["auto",bn,ye]},B=function(){return["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"]},F=function(){return["solid","dashed","dotted","double","none"]},L=function(){return["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter"]},D=function(){return["start","end","center","between","around","evenly","stretch"]},$=function(){return["","0",ye]},W=function(){return["auto","avoid","all","avoid-page","page","left","right","column"]},I=function(){return[bn,ys]},re=function(){return[bn,ye]};return{cacheSize:500,theme:{colors:[Lr],spacing:[ut],blur:["none","",Wt,ye],brightness:I(),borderColor:[e],borderRadius:["none","","full",Wt,ye],borderSpacing:j(),borderWidth:H(),contrast:I(),grayscale:$(),hueRotate:re(),invert:$(),gap:j(),gradientColorStops:[e],gradientColorStopPositions:[Qh,Oo],inset:N(),margin:N(),opacity:I(),padding:j(),saturate:I(),scale:I(),sepia:$(),skew:re(),space:j(),translate:j()},classGroups:{aspect:[{aspect:["auto","square","video",ye]}],container:["container"],columns:[{columns:[Wt]}],"break-after":[{"break-after":W()}],"break-before":[{"break-before":W()}],"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"],float:[{float:["right","left","none"]}],clear:[{clear:["left","right","both","none"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[].concat(B(),[ye])}],overflow:[{overflow:M()}],"overflow-x":[{"overflow-x":M()}],"overflow-y":[{"overflow-y":M()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[p]}],"inset-x":[{"inset-x":[p]}],"inset-y":[{"inset-y":[p]}],start:[{start:[p]}],end:[{end:[p]}],top:[{top:[p]}],right:[{right:[p]}],bottom:[{bottom:[p]}],left:[{left:[p]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Rr]}],basis:[{basis:N()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ye]}],grow:[{grow:$()}],shrink:[{shrink:$()}],order:[{order:["first","last","none",Rr]}],"grid-cols":[{"grid-cols":[Lr]}],"col-start-end":[{col:["auto",{span:["full",Rr]},ye]}],"col-start":[{"col-start":k()}],"col-end":[{"col-end":k()}],"grid-rows":[{"grid-rows":[Lr]}],"row-start-end":[{row:["auto",{span:[Rr]},ye]}],"row-start":[{"row-start":k()}],"row-end":[{"row-end":k()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ye]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ye]}],gap:[{gap:[y]}],"gap-x":[{"gap-x":[y]}],"gap-y":[{"gap-y":[y]}],"justify-content":[{justify:["normal"].concat(D())}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal"].concat(D(),["baseline"])}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[].concat(D(),["baseline"])}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[v]}],px:[{px:[v]}],py:[{py:[v]}],ps:[{ps:[v]}],pe:[{pe:[v]}],pt:[{pt:[v]}],pr:[{pr:[v]}],pb:[{pb:[v]}],pl:[{pl:[v]}],m:[{m:[h]}],mx:[{mx:[h]}],my:[{my:[h]}],ms:[{ms:[h]}],me:[{me:[h]}],mt:[{mt:[h]}],mr:[{mr:[h]}],mb:[{mb:[h]}],ml:[{ml:[h]}],"space-x":[{"space-x":[P]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[P]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit",ye,t]}],"min-w":[{"min-w":["min","max","fit",ye,ut]}],"max-w":[{"max-w":["0","none","full","min","max","fit","prose",{screen:[Wt]},Wt,ye]}],h:[{h:[ye,t,"auto","min","max","fit"]}],"min-h":[{"min-h":["min","max","fit",ye,ut]}],"max-h":[{"max-h":[ye,t,"min","max","fit"]}],"font-size":[{text:["base",Wt,Oo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",ys]}],"font-family":[{font:[Lr]}],"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-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",ye]}],"line-clamp":[{"line-clamp":["none",bn,ys]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",ye,ut]}],"list-image":[{"list-image":["none",ye]}],"list-style-type":[{list:["none","disc","decimal",ye]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[].concat(F(),["wavy"])}],"text-decoration-thickness":[{decoration:["auto","from-font",ut]}],"underline-offset":[{"underline-offset":["auto",ye,ut]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],indent:[{indent:j()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ye]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ye]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[].concat(B(),[Zh])}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Gh]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Yh]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[g]}],"gradient-via-pos":[{via:[g]}],"gradient-to-pos":[{to:[g]}],"gradient-from":[{from:[m]}],"gradient-via":[{via:[m]}],"gradient-to":[{to:[m]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[].concat(F(),["hidden"])}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:F()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[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:[""].concat(F())}],"outline-offset":[{"outline-offset":[ye,ut]}],"outline-w":[{outline:[ut]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:H()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[ut]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Wt,Xh]}],"shadow-color":[{shadow:[Lr]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":L()}],"bg-blend":[{"bg-blend":L()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Wt,ye]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[f]}],invert:[{invert:[u]}],saturate:[{saturate:[_]}],sepia:[{sepia:[S]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[f]}],"backdrop-invert":[{"backdrop-invert":[u]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[_]}],"backdrop-sepia":[{"backdrop-sepia":[S]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",ye]}],duration:[{duration:re()}],ease:[{ease:["linear","in","out","in-out",ye]}],delay:[{delay:re()}],animate:[{animate:["none","spin","ping","pulse","bounce",ye]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[x]}],"scale-x":[{"scale-x":[x]}],"scale-y":[{"scale-y":[x]}],rotate:[{rotate:[Rr,ye]}],"translate-x":[{"translate-x":[O]}],"translate-y":[{"translate-y":[O]}],"skew-x":[{"skew-x":[T]}],"skew-y":[{"skew-y":[T]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ye]}],accent:[{accent:["auto",e]}],appearance:["appearance-none"],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",ye]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":j()}],"scroll-mx":[{"scroll-mx":j()}],"scroll-my":[{"scroll-my":j()}],"scroll-ms":[{"scroll-ms":j()}],"scroll-me":[{"scroll-me":j()}],"scroll-mt":[{"scroll-mt":j()}],"scroll-mr":[{"scroll-mr":j()}],"scroll-mb":[{"scroll-mb":j()}],"scroll-ml":[{"scroll-ml":j()}],"scroll-p":[{"scroll-p":j()}],"scroll-px":[{"scroll-px":j()}],"scroll-py":[{"scroll-py":j()}],"scroll-ps":[{"scroll-ps":j()}],"scroll-pe":[{"scroll-pe":j()}],"scroll-pt":[{"scroll-pt":j()}],"scroll-pr":[{"scroll-pr":j()}],"scroll-pb":[{"scroll-pb":j()}],"scroll-pl":[{"scroll-pl":j()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","pinch-zoom","manipulation",{pan:["x","left","right","y","up","down"]}]}],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ye]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[ut,ys]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"]},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"],"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"],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-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-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"],"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"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}}var rg=Vh(ng);function Ce(...e){return rg(cu(e))}const sg=({className:e=""})=>c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-loader-circle s absolute animate-spin",children:c.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56",className:e})}),Gc=Ea("inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:opacity-60",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input dark:border-[#FFFFFF1A] hover:opacity-60 dark:bg-[#202020] dark:text-white shadow-sm hover:bg-primary-1 ",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",cobalt:"text-cobalt-600 bg-cobalt-100 border border-cobalt-600 font-semibold hover:bg-cobalt-50 hover:text-cobalt-300",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),ot=w.forwardRef(({children:e,className:t,variant:n,size:r,loading:s,asChild:i=!1,disabled:o,loaderClassName:a="",loaderParentClassName:l="",...d},f)=>{const u=i?bh:"button";return i?c.jsx(u,{className:Ce(Gc({variant:n,size:r,className:t}),o&&"cursor-default","relative"),ref:f,...d,children:e}):c.jsxs(u,{className:Ce(Gc({variant:n,size:r,className:t}),o&&"cursor-default","relative"),ref:f,disabled:s||o,...d,children:[s&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"absolute left-0 z-10 h-full w-full rounded-md bg-white"}),c.jsx("span",{className:Ce("absolute left-0 z-20 flex h-full w-full items-center justify-center rounded-md bg-inherit text-orange-300",l),children:c.jsx(sg,{className:a})})]}),e]})});ot.displayName="Button";function fe(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e==null||e(s),n===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function Bn(e,t=[]){let n=[];function r(i,o){const a=w.createContext(o);a.displayName=i+"Context";const l=n.length;n=[...n,o];const d=u=>{var b;const{scope:y,children:m,...g}=u,p=((b=y==null?void 0:y[e])==null?void 0:b[l])||a,h=w.useMemo(()=>g,Object.values(g));return c.jsx(p.Provider,{value:h,children:m})};d.displayName=i+"Provider";function f(u,y){var p;const m=((p=y==null?void 0:y[e])==null?void 0:p[l])||a,g=w.useContext(m);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${u}\` must be used within \`${i}\``)}return[d,f]}const s=()=>{const i=n.map(o=>w.createContext(o));return function(a){const l=(a==null?void 0:a[e])||i;return w.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return s.scopeName=e,[r,ig(s,...t)]}function ig(...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(i){const o=r.reduce((a,{useScope:l,scopeName:d})=>{const u=l(i)[`__scope${d}`];return{...a,...u}},{});return w.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var Ie=globalThis!=null&&globalThis.document?w.useLayoutEffect:()=>{},og=w[" useId ".trim().toString()]||(()=>{}),ag=0;function on(e){const[t,n]=w.useState(og());return Ie(()=>{n(r=>r??String(ag++))},[e]),e||(t?`radix-${t}`:"")}var cg=w[" useInsertionEffect ".trim().toString()]||Ie;function Ln({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,i,o]=lg({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:s;{const f=w.useRef(e!==void 0);w.useEffect(()=>{const u=f.current;u!==a&&console.warn(`${r} is changing from ${u?"controlled":"uncontrolled"} to ${a?"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=a},[a,r])}const d=w.useCallback(f=>{var u;if(a){const y=dg(f)?f(e):f;y!==e&&((u=o.current)==null||u.call(o,y))}else i(f)},[a,e,i,o]);return[l,d]}function lg({defaultProp:e,onChange:t}){const[n,r]=w.useState(e),s=w.useRef(n),i=w.useRef(t);return cg(()=>{i.current=t},[t]),w.useEffect(()=>{var o;s.current!==n&&((o=i.current)==null||o.call(i,n),s.current=n)},[n,s]),[n,r,i]}function dg(e){return typeof e=="function"}var ug=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],pe=ug.reduce((e,t)=>{const n=pr(`Primitive.${t}`),r=w.forwardRef((s,i)=>{const{asChild:o,...a}=s,l=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(l,{...a,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function hu(e,t){e&&Cr.flushSync(()=>e.dispatchEvent(t))}function gt(e){const t=w.useRef(e);return w.useEffect(()=>{t.current=e}),w.useMemo(()=>((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)}),[])}function fg(e,t=globalThis==null?void 0:globalThis.document){const n=gt(e);w.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 pg="DismissableLayer",No="dismissableLayer.update",mg="dismissableLayer.pointerDownOutside",hg="dismissableLayer.focusOutside",Zc,Pa=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),vi=w.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:a,onDismiss:l,...d}=e,f=w.useContext(Pa),[u,y]=w.useState(null),m=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=w.useState({}),p=Ne(t,R=>y(R)),h=Array.from(f.layers),[b]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),v=h.indexOf(b),_=u?h.indexOf(u):-1,x=f.layersWithOutsidePointerEventsDisabled.size>0,S=_>=v,T=w.useRef(!1),P=bg(R=>{const M=R.target;if(!(M instanceof Node))return;const N=[...f.branches].some(j=>j.contains(M));!S||N||(i==null||i(R),a==null||a(R),R.defaultPrevented||l==null||l())},{ownerDocument:m,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:T,dismissableSurfaces:f.dismissableSurfaces}),O=vg(R=>{if(r&&T.current)return;const M=R.target;[...f.branches].some(j=>j.contains(M))||(o==null||o(R),a==null||a(R),R.defaultPrevented||l==null||l())},m);return fg(R=>{_===f.layers.size-1&&(s==null||s(R),!R.defaultPrevented&&l&&(R.preventDefault(),l()))},m),w.useEffect(()=>{if(u)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(Zc=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(u)),f.layers.add(u),Yc(),()=>{n&&(f.layersWithOutsidePointerEventsDisabled.delete(u),f.layersWithOutsidePointerEventsDisabled.size===0&&(m.body.style.pointerEvents=Zc))}},[u,m,n,f]),w.useEffect(()=>()=>{u&&(f.layers.delete(u),f.layersWithOutsidePointerEventsDisabled.delete(u),Yc())},[u,f]),w.useEffect(()=>{const R=()=>g({});return document.addEventListener(No,R),()=>document.removeEventListener(No,R)},[]),c.jsx(pe.div,{...d,ref:p,style:{pointerEvents:x?S?"auto":"none":void 0,...e.style},onFocusCapture:fe(e.onFocusCapture,O.onFocusCapture),onBlurCapture:fe(e.onBlurCapture,O.onBlurCapture),onPointerDownCapture:fe(e.onPointerDownCapture,P.onPointerDownCapture)})});vi.displayName=pg;var gg="DismissableLayerBranch",gu=w.forwardRef((e,t)=>{const n=w.useContext(Pa),r=w.useRef(null),s=Ne(t,r);return w.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),c.jsx(pe.div,{...e,ref:s})});gu.displayName=gg;function yg(){const e=w.useContext(Pa),[t,n]=w.useState(null);return w.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}function bg(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:s,dismissableSurfaces:i}=t,o=gt(e),a=w.useRef(!1),l=w.useRef(!1),d=w.useRef(new Map),f=w.useRef(()=>{});return w.useEffect(()=>{function u(){l.current=!1,s.current=!1,d.current.clear()}function y(){return Array.from(d.current.values()).some(Boolean)}function m(v){if(!l.current)return;const _=v.target;_ instanceof Node&&[...i].some(S=>S.contains(_))||d.current.set(v.type,!0),v.type==="click"&&window.setTimeout(()=>{l.current&&f.current()},0)}function g(v){l.current&&d.current.set(v.type,!1)}const p=v=>{if(v.target&&!a.current){let _=function(){n.removeEventListener("click",f.current);const S=y();u(),S||yu(mg,o,x,{discrete:!0})};const x={originalEvent:v};l.current=!0,s.current=r&&v.button===0,d.current.clear(),!r||v.button!==0?_():(n.removeEventListener("click",f.current),f.current=_,n.addEventListener("click",f.current,{once:!0}))}else n.removeEventListener("click",f.current),u();a.current=!1},h=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const v of h)n.addEventListener(v,m,!0),n.addEventListener(v,g);const b=window.setTimeout(()=>{n.addEventListener("pointerdown",p)},0);return()=>{window.clearTimeout(b),n.removeEventListener("pointerdown",p),n.removeEventListener("click",f.current);for(const v of h)n.removeEventListener(v,m,!0),n.removeEventListener(v,g)}},[n,o,r,s,i]),{onPointerDownCapture:()=>a.current=!0}}function vg(e,t=globalThis==null?void 0:globalThis.document){const n=gt(e),r=w.useRef(!1);return w.useEffect(()=>{const s=i=>{i.target&&!r.current&&yu(hg,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Yc(){const e=new CustomEvent(No);document.dispatchEvent(e)}function yu(e,t,n,{discrete:r}){const s=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?hu(s,i):s.dispatchEvent(i)}var wg=vi,_g=gu,Ji="focusScope.autoFocusOnMount",eo="focusScope.autoFocusOnUnmount",Qc={bubbles:!1,cancelable:!0},xg="FocusScope",Aa=w.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:i,...o}=e,[a,l]=w.useState(null),d=gt(s),f=gt(i),u=w.useRef(null),y=Ne(t,p=>l(p)),m=w.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;w.useEffect(()=>{if(r){let p=function(_){if(m.paused||!a)return;const x=_.target;a.contains(x)?u.current=x:Kt(u.current,{select:!0})},h=function(_){if(m.paused||!a)return;const x=_.relatedTarget;x!==null&&(a.contains(x)||Kt(u.current,{select:!0}))},b=function(_){if(document.activeElement===document.body)for(const S of _)S.removedNodes.length>0&&Kt(a)};document.addEventListener("focusin",p),document.addEventListener("focusout",h);const v=new MutationObserver(b);return a&&v.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",h),v.disconnect()}}},[r,a,m.paused]),w.useEffect(()=>{if(a){Jc.add(m);const p=document.activeElement;if(!a.contains(p)){const b=new CustomEvent(Ji,Qc);a.addEventListener(Ji,d),a.dispatchEvent(b),b.defaultPrevented||(Sg(Ag(bu(a)),{select:!0}),document.activeElement===p&&Kt(a))}return()=>{a.removeEventListener(Ji,d),setTimeout(()=>{const b=new CustomEvent(eo,Qc);a.addEventListener(eo,f),a.dispatchEvent(b),b.defaultPrevented||Kt(p??document.body,{select:!0}),a.removeEventListener(eo,f),Jc.remove(m)},0)}}},[a,d,f,m]);const g=w.useCallback(p=>{if(!n&&!r||m.paused)return;const h=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,b=document.activeElement;if(h&&b){const v=p.currentTarget,[_,x]=Cg(v);_&&x?!p.shiftKey&&b===x?(p.preventDefault(),n&&Kt(_,{select:!0})):p.shiftKey&&b===_&&(p.preventDefault(),n&&Kt(x,{select:!0})):b===v&&p.preventDefault()}},[n,r,m.paused]);return c.jsx(pe.div,{tabIndex:-1,...o,ref:y,onKeyDown:g})});Aa.displayName=xg;function Sg(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Kt(r,{select:t}),document.activeElement!==n)return}function Cg(e){const t=bu(e),n=Xc(t,e),r=Xc(t.reverse(),e);return[n,r]}function bu(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 Xc(e,t){for(const n of e)if(!Eg(n,{upTo:t}))return n}function Eg(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 Tg(e){return e instanceof HTMLInputElement&&"select"in e}function Kt(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Tg(e)&&t&&e.select()}}var Jc=Pg();function Pg(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=el(e,t),e.unshift(t)},remove(t){var n;e=el(e,t),(n=e[0])==null||n.resume()}}}function el(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Ag(e){return e.filter(t=>t.tagName!=="A")}var Og="Portal",wi=w.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[s,i]=w.useState(!1);Ie(()=>i(!0),[]);const o=n||s&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?Cr.createPortal(c.jsx(pe.div,{...r,ref:t}),o):null});wi.displayName=Og;function Ng(e,t){return w.useReducer((n,r)=>t[n][r]??n,e)}var $n=e=>{const{present:t,children:n}=e,r=kg(t),s=typeof n=="function"?n({present:r.isPresent}):w.Children.only(n),i=Rg(r.ref,Lg(s));return typeof n=="function"||r.isPresent?w.cloneElement(s,{ref:i}):null};$n.displayName="Presence";function kg(e){const[t,n]=w.useState(),r=w.useRef(null),s=w.useRef(e),i=w.useRef("none"),o=e?"mounted":"unmounted",[a,l]=Ng(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const d=bs(r.current);i.current=a==="mounted"?d:"none"},[a]),Ie(()=>{const d=r.current,f=s.current;if(f!==e){const y=i.current,m=bs(d);e?l("MOUNT"):m==="none"||(d==null?void 0:d.display)==="none"?l("UNMOUNT"):l(f&&y!==m?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,l]),Ie(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,u=m=>{const p=bs(r.current).includes(CSS.escape(m.animationName));if(m.target===t&&p&&(l("ANIMATION_END"),!s.current)){const h=t.style.animationFillMode;t.style.animationFillMode="forwards",d=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=h)})}},y=m=>{m.target===t&&(i.current=bs(r.current))};return t.addEventListener("animationstart",y),t.addEventListener("animationcancel",u),t.addEventListener("animationend",u),()=>{f.clearTimeout(d),t.removeEventListener("animationstart",y),t.removeEventListener("animationcancel",u),t.removeEventListener("animationend",u)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:w.useCallback(d=>{r.current=d?getComputedStyle(d):null,n(d)},[])}}function tl(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Rg(...e){const t=w.useRef(e);return t.current=e,w.useCallback(n=>{const r=t.current;let s=!1;const i=r.map(o=>{const a=tl(o,n);return!s&&typeof a=="function"&&(s=!0),a});if(s)return()=>{for(let o=0;o<i.length;o++){const a=i[o];typeof a=="function"?a():tl(r[o],null)}}},[])}function bs(e){return(e==null?void 0:e.animationName)||"none"}function Lg(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var vs=0,xt=null;function vu(){w.useEffect(()=>{xt||(xt={start:nl(),end:nl()});const{start:e,end:t}=xt;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),vs++,()=>{vs===1&&(xt==null||xt.start.remove(),xt==null||xt.end.remove(),xt=null),vs=Math.max(0,vs-1)}},[])}function nl(){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 At=function(){return At=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},At.apply(this,arguments)};function wu(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 Dg(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,i;r<s;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var Ms="right-scroll-bar-position",Fs="width-before-scroll-bar",jg="with-scroll-bars-hidden",Ig="--removed-body-scroll-bar-size";function to(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Mg(e,t){var n=C.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 Fg=typeof window<"u"?w.useLayoutEffect:w.useEffect,rl=new WeakMap;function Ug(e,t){var n=Mg(null,function(r){return e.forEach(function(s){return to(s,r)})});return Fg(function(){var r=rl.get(n);if(r){var s=new Set(r),i=new Set(e),o=n.current;s.forEach(function(a){i.has(a)||to(a,null)}),i.forEach(function(a){s.has(a)||to(a,o)})}rl.set(n,e)},[e]),n}function Bg(e){return e}function $g(e,t){t===void 0&&(t=Bg);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(i){var o=t(i,r);return n.push(o),function(){n=n.filter(function(a){return a!==o})}},assignSyncMedium:function(i){for(r=!0;n.length;){var o=n;n=[],o.forEach(i)}n={push:function(a){return i(a)},filter:function(){return n}}},assignMedium:function(i){r=!0;var o=[];if(n.length){var a=n;n=[],a.forEach(i),o=n}var l=function(){var f=o;o=[],f.forEach(i)},d=function(){return Promise.resolve().then(l)};d(),n={push:function(f){o.push(f),d()},filter:function(f){return o=o.filter(f),n}}}};return s}function Vg(e){e===void 0&&(e={});var t=$g(null);return t.options=At({async:!0,ssr:!1},e),t}var _u=function(e){var t=e.sideCar,n=wu(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 w.createElement(r,At({},n))};_u.isSideCarExport=!0;function Hg(e,t){return e.useMedium(t),_u}var xu=Vg(),no=function(){},_i=w.forwardRef(function(e,t){var n=w.useRef(null),r=w.useState({onScrollCapture:no,onWheelCapture:no,onTouchMoveCapture:no}),s=r[0],i=r[1],o=e.forwardProps,a=e.children,l=e.className,d=e.removeScrollBar,f=e.enabled,u=e.shards,y=e.sideCar,m=e.noRelative,g=e.noIsolation,p=e.inert,h=e.allowPinchZoom,b=e.as,v=b===void 0?"div":b,_=e.gapMode,x=wu(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=y,T=Ug([n,t]),P=At(At({},x),s);return w.createElement(w.Fragment,null,f&&w.createElement(S,{sideCar:xu,removeScrollBar:d,shards:u,noRelative:m,noIsolation:g,inert:p,setCallbacks:i,allowPinchZoom:!!h,lockRef:n,gapMode:_}),o?w.cloneElement(w.Children.only(a),At(At({},P),{ref:T})):w.createElement(v,At({},P,{className:l,ref:T}),a))});_i.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};_i.classNames={fullWidth:Fs,zeroRight:Ms};var zg=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Wg(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=zg();return t&&e.setAttribute("nonce",t),e}function Kg(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function qg(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Gg=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Wg())&&(Kg(t,n),qg(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Zg=function(){var e=Gg();return function(t,n){w.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Su=function(){var e=Zg(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},Yg={left:0,top:0,right:0,gap:0},ro=function(e){return parseInt(e||"",10)||0},Qg=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[ro(n),ro(r),ro(s)]},Xg=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Yg;var t=Qg(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])}},Jg=Su(),Xn="data-scroll-locked",ey=function(e,t,n,r){var s=e.left,i=e.top,o=e.right,a=e.gap;return n===void 0&&(n="margin"),`
|
|
2
|
-
.`.concat(
|
|
1
|
+
"use strict";var _h=Object.defineProperty;var Hc=e=>{throw TypeError(e)};var xh=(e,t,n)=>t in e?_h(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var it=(e,t,n)=>xh(e,typeof t!="symbol"?t+"":t,n),eo=(e,t,n)=>t.has(e)||Hc("Cannot "+n);var E=(e,t,n)=>(eo(e,t,"read from private field"),n?n.call(e):t.get(e)),ne=(e,t,n)=>t.has(e)?Hc("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),q=(e,t,n,r)=>(eo(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),ge=(e,t,n)=>(eo(e,t,"access private method"),n);var ws=(e,t,n,r)=>({set _(s){q(e,t,s,n)},get _(){return E(e,t,r)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),C=require("react"),Sh=require("react-dom");function fu(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 w=fu(C),Cr=fu(Sh);function zc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Ch(...e){return t=>{let n=!1;const r=e.map(s=>{const i=zc(s,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let s=0;s<r.length;s++){const i=r[s];typeof i=="function"?i():zc(e[s],null)}}}}function Oe(...e){return w.useCallback(Ch(...e),e)}function mr(e){const t=w.forwardRef((n,r)=>{let{children:s,...i}=n,o=null,a=!1;const l=[];Wc(s)&&typeof _s=="function"&&(s=_s(s._payload)),w.Children.forEach(s,g=>{var p;if(Oh(g)){a=!0;const y=g;let m="child"in y.props?y.props.child:y.props.children;Wc(m)&&typeof _s=="function"&&(m=_s(m._payload)),o=Ph(y,m),l.push((p=o==null?void 0:o.props)==null?void 0:p.children)}else l.push(g)}),o?o=w.cloneElement(o,void 0,l):!a&&w.Children.count(s)===1&&w.isValidElement(s)&&(o=s);const d=o?Ah(o):void 0,f=Oe(r,d);if(!o){if(s||s===0)throw new Error(a?Dh(e):Lh(e));return s}const u=kh(i,o.props??{});return o.type!==w.Fragment&&(u.ref=r?f:d),w.cloneElement(o,u)});return t.displayName=`${e}.Slot`,t}var Th=mr("Slot"),Eh=Symbol.for("radix.slottable"),Ph=(e,t)=>{if("child"in e.props){const n=e.props.child;return w.isValidElement(n)?w.cloneElement(n,void 0,e.props.children(n.props.children)):null}return w.isValidElement(t)?t:null};function kh(e,t){const n={...t};for(const r in t){const s=e[r],i=t[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...a)=>{const l=i(...a);return s(...a),l}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...e,...n}}function Ah(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Oh(e){return w.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Eh}var Nh=Symbol.for("react.lazy");function Wc(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Nh&&"_payload"in e&&Rh(e._payload)}function Rh(e){return typeof e=="object"&&e!==null&&"then"in e}var Lh=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,Dh=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,_s=w[" use ".trim().toString()];function mu(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=mu(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function pu(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=mu(e))&&(r&&(r+=" "),r+=t);return r}const Kc=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,qc=pu,Pa=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return qc(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:i}=t,o=Object.keys(s).map(d=>{const f=n==null?void 0:n[d],u=i==null?void 0:i[d];if(f===null)return null;const g=Kc(f)||Kc(u);return s[d][g]}),a=n&&Object.entries(n).reduce((d,f)=>{let[u,g]=f;return g===void 0||(d[u]=g),d},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,f)=>{let{class:u,className:g,...p}=f;return Object.entries(p).every(y=>{let[m,h]=y;return Array.isArray(h)?h.includes({...i,...a}[m]):{...i,...a}[m]===h})?[...d,u,g]:d},[]);return qc(e,o,l,n==null?void 0:n.class,n==null?void 0:n.className)},Bt=[{ticker:"EUR_JPY",display_name:"EURJPY",logo_urls:["https://cdn.iccandle.ai/web-assets/EUR.svg","https://cdn.iccandle.ai/web-assets/JPY.svg"],description:"EUR JPY",type:"forex",session:"1700-1700",pricescale:1e3,resolve_symbol:"EURJPY"},{ticker:"GBP_JPY",display_name:"GBPJPY",logo_urls:["https://cdn.iccandle.ai/web-assets/GBP.svg","https://cdn.iccandle.ai/web-assets/JPY.svg"],description:"GBP JPY",type:"forex",session:"1700-1700",pricescale:1e3,resolve_symbol:"GBPJPY"},{ticker:"AUD_JPY",display_name:"AUDJPY",logo_urls:["https://cdn.iccandle.ai/web-assets/AUD.svg","https://cdn.iccandle.ai/web-assets/JPY.svg"],description:"AUD JPY",type:"forex",session:"1700-1700",pricescale:1e3,resolve_symbol:"AUDJPY"},{ticker:"NZD_JPY",display_name:"NZDJPY",logo_urls:["https://cdn.iccandle.ai/web-assets/NZD.svg","https://cdn.iccandle.ai/web-assets/JPY.svg"],description:"NZD JPY",type:"forex",session:"1700-1700",pricescale:1e3,resolve_symbol:"NZDJPY"},{ticker:"CAD_JPY",display_name:"CADJPY",logo_urls:["https://cdn.iccandle.ai/web-assets/CAD.svg","https://cdn.iccandle.ai/web-assets/JPY.svg"],description:"CAD JPY",type:"forex",session:"1700-1700",pricescale:1e3,resolve_symbol:"CADJPY"},{ticker:"CHF_JPY",display_name:"CHFJPY",logo_urls:["https://cdn.iccandle.ai/web-assets/CHF.svg","https://cdn.iccandle.ai/web-assets/JPY.svg"],description:"CHF JPY",type:"forex",session:"1700-1700",pricescale:1e3,resolve_symbol:"CHFJPY"},{ticker:"USD_JPY",display_name:"USDJPY",logo_urls:["https://cdn.iccandle.ai/web-assets/USD.svg","https://cdn.iccandle.ai/web-assets/JPY.svg"],description:"USD JPY",type:"forex",session:"1700-1700",pricescale:1e3,resolve_symbol:"USDJPY"},{ticker:"EUR_USD",display_name:"EURUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/EUR.svg","https://cdn.iccandle.ai/web-assets/USD.svg"],description:"EUR USD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"EURUSD"},{ticker:"AUD_USD",display_name:"AUDUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/AUD.svg","https://cdn.iccandle.ai/web-assets/USD.svg"],description:"AUD USD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"AUDUSD"},{ticker:"NZD_USD",display_name:"NZDUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/NZD.svg","https://cdn.iccandle.ai/web-assets/USD.svg"],description:"NZD USD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"NZDUSD"},{ticker:"USD_CHF",display_name:"USDCHF",logo_urls:["https://cdn.iccandle.ai/web-assets/USD.svg","https://cdn.iccandle.ai/web-assets/CHF.svg"],description:"USD CHF",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"USDCHF"},{ticker:"USD_CAD",display_name:"USDCAD",logo_urls:["https://cdn.iccandle.ai/web-assets/USD.svg","https://cdn.iccandle.ai/web-assets/CAD.svg"],description:"USD CAD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"USDCAD"},{ticker:"GBP_AUD",display_name:"GBPAUD",logo_urls:["https://cdn.iccandle.ai/web-assets/GBP.svg","https://cdn.iccandle.ai/web-assets/AUD.svg"],description:"GBP AUD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"GBPAUD"},{ticker:"GBP_CAD",display_name:"GBPCAD",logo_urls:["https://cdn.iccandle.ai/web-assets/GBP.svg","https://cdn.iccandle.ai/web-assets/CAD.svg"],description:"GBP CAD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"GBPCAD"},{ticker:"GBP_CHF",display_name:"GBPCHF",logo_urls:["https://cdn.iccandle.ai/web-assets/GBP.svg","https://cdn.iccandle.ai/web-assets/CHF.svg"],description:"GBP CHF",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"GBPCHF"},{ticker:"GBP_NZD",display_name:"GBPNZD",logo_urls:["https://cdn.iccandle.ai/web-assets/GBP.svg","https://cdn.iccandle.ai/web-assets/NZD.svg"],description:"GBP NZD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"GBPNZD"},{ticker:"GBP_USD",display_name:"GBPUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/GBP.svg","https://cdn.iccandle.ai/web-assets/USD.svg"],description:"GBP USD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"GBPUSD"},{ticker:"NZD_CAD",display_name:"NZDCAD",logo_urls:["https://cdn.iccandle.ai/web-assets/NZD.svg","https://cdn.iccandle.ai/web-assets/CAD.svg"],description:"NZD CAD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"NZDCAD"},{ticker:"EUR_CAD",display_name:"EURCAD",logo_urls:["https://cdn.iccandle.ai/web-assets/EUR.svg","https://cdn.iccandle.ai/web-assets/CAD.svg"],description:"EUR CAD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"EURCAD"},{ticker:"EUR_AUD",display_name:"EURAUD",logo_urls:["https://cdn.iccandle.ai/web-assets/EUR.svg","https://cdn.iccandle.ai/web-assets/AUD.svg"],description:"EUR AUD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"EURAUD"},{ticker:"XAU_USD",display_name:"XAUUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/XAU.svg"],description:"Gold",type:"commodity",session:"1700-1700",pricescale:1e3,resolve_symbol:"XAUUSD"},{ticker:"BCO_USD",display_name:"BCOUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/BCO.svg"],description:"Brent Crude Oil",type:"commodity",session:"1700-1700",pricescale:1e3,resolve_symbol:"SpotBrent"},{ticker:"SPX500_USD",display_name:"S&P500",logo_urls:["https://cdn.iccandle.ai/web-assets/SPX500.svg"],description:"S&P 500",type:"indices",session:"1700-1700",pricescale:10,resolve_symbol:"SP500"},{ticker:"NAS100_USD",display_name:"NASDAQ100",logo_urls:["https://cdn.iccandle.ai/web-assets/NAS100.svg"],description:"NASDAQ 100",type:"indices",session:"1700-1700",pricescale:10,resolve_symbol:"NAS100"},{ticker:"US30_USD",display_name:"US30",logo_urls:["https://cdn.iccandle.ai/web-assets/US30.svg"],description:"US Wall St 30",type:"indices",session:"1700-1700",pricescale:10,resolve_symbol:"US30"},{ticker:"BTCUSDT",display_name:"BTCUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/BTC.svg"],description:"BTCUSDT",type:"crypto",session:"24x7",pricescale:100,resolve_symbol:"BTCUSD"},{ticker:"ETHUSDT",display_name:"ETHUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/ETH.svg"],description:"ETHUSDT",type:"crypto",session:"24x7",pricescale:100,resolve_symbol:"ETHUSD"},{ticker:"XRPUSDT",display_name:"XRPUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/XRP.svg"],description:"XRPUSDT",type:"crypto",session:"24x7",pricescale:1e4,resolve_symbol:"XRPUSD"},{ticker:"SOLUSDT",display_name:"SOLUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/SOL.svg"],description:"SOLUSDT",type:"crypto",session:"24x7",pricescale:100,resolve_symbol:"SOLUSD"},{ticker:"ADAUSDT",display_name:"ADAUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/ADA.svg"],description:"ADAUSDT",type:"crypto",session:"24x7",pricescale:1e4,resolve_symbol:"ADAUSD"},{ticker:"AVAUSDT",display_name:"AVAUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/AVA.svg"],description:"AVAUSDT",type:"crypto",session:"24x7",pricescale:1e4,resolve_symbol:"AVAUSD"},{ticker:"AVAXUSDT",display_name:"AVAXUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/AVAX.svg"],description:"AVAXUSDT",type:"crypto",session:"24x7",pricescale:100,resolve_symbol:"AVAXUSD"},{ticker:"BNBUSDT",display_name:"BNBUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/BNB.svg"],description:"BNBUSDT",type:"crypto",session:"24x7",pricescale:100,resolve_symbol:"BNBUSD"},{ticker:"DOGEUSDT",display_name:"DOGEUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/DOGE.svg"],description:"DOGEUSDT",type:"crypto",session:"24x7",pricescale:1e5,resolve_symbol:"DOGUSD"},{ticker:"DOTUSDT",display_name:"DOTUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/DOT.svg"],description:"DOTUSDT",type:"crypto",session:"24x7",pricescale:1e3,resolve_symbol:"DOTUSD"},{ticker:"TRXUSDT",display_name:"TRXUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/TRX.svg"],description:"TRXUSDT",type:"crypto",session:"24x7",pricescale:1e4,resolve_symbol:"TRXUSD"},{ticker:"AAPL",display_name:"AAPL",logo_urls:["https://cdn.iccandle.ai/web-assets/AAPL.svg"],description:"Apple Inc.",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"AAPL"},{ticker:"AMZN",display_name:"AMZN",logo_urls:["https://cdn.iccandle.ai/web-assets/AMZN.svg"],description:"Amazon.Com Inc",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"AMZN"},{ticker:"BRK.B",display_name:"BRK.B",logo_urls:["https://cdn.iccandle.ai/web-assets/BRK.B.svg"],description:"BERKSHIRE HATHAWAY Class B",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"BRKB"},{ticker:"GOOGL",display_name:"GOOGL",logo_urls:["https://cdn.iccandle.ai/web-assets/GOOGL.svg"],description:"Alphabet Inc. Class A Common Stock",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"GOOGL"},{ticker:"KO",display_name:"KO",logo_urls:["https://cdn.iccandle.ai/web-assets/KO.svg"],description:"Coca-Cola Company",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"KO"},{ticker:"META",display_name:"META",logo_urls:["https://cdn.iccandle.ai/web-assets/META.svg"],description:"Meta Platforms, Inc. Class A Common Stock",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"META"},{ticker:"MSFT",display_name:"MSFT",logo_urls:["https://cdn.iccandle.ai/web-assets/MSFT.svg"],description:"Microsoft Corp",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"MSFT"},{ticker:"NFLX",display_name:"NFLX",logo_urls:["https://cdn.iccandle.ai/web-assets/NFLX.svg"],description:"NetFlix Inc",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"NFLX"},{ticker:"NKE",display_name:"NKE",logo_urls:["https://cdn.iccandle.ai/web-assets/NKE.svg"],description:"Nike, Inc.",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"NKE"},{ticker:"NVDA",display_name:"NVDA",logo_urls:["https://cdn.iccandle.ai/web-assets/NVDA.svg"],description:"Nvidia Corp",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"NVDA"},{ticker:"TME",display_name:"TME",logo_urls:["https://cdn.iccandle.ai/web-assets/TME.svg"],description:"Tencent Music Entertainment Group American Depositary Shares, each representing two Class A Ordinary Shares",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"TME"},{ticker:"TSLA",display_name:"TSLA",logo_urls:["https://cdn.iccandle.ai/web-assets/TSLA.svg"],description:"Tesla, Inc. Common Stock",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"TSLA"},{ticker:"XAG_USD",display_name:"XAGUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/XAG.svg"],description:"Silver",type:"commodity",session:"1700-1700",pricescale:1e3,resolve_symbol:"XAGUSD"},{ticker:"XCU_USD",display_name:"XCUUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/XCU.svg"],description:"Copper",type:"commodity",session:"1700-1700",pricescale:1e3,resolve_symbol:"XCUUSD"}],jh={[-11]:["Pacific/Fakaofo"],[-10]:["Pacific/Honolulu"],[-9]:["America/Anchorage","America/Juneau"],[-8]:["America/Los_Angeles","America/Vancouver"],[-7]:["US/Mountain"],[-6]:["America/Chicago","America/El_Salvador"],[-5]:["America/New_York","America/Lima","America/Bogota"],[-4]:["America/Caracas","America/Santiago","America/Toronto"],[-3]:["America/Argentina/Buenos_Aires","America/Sao_Paulo"],0:["Europe/London","Atlantic/Reykjavik","Africa/Casablanca","Africa/Tunis","Africa/Lagos"],1:["Europe/Amsterdam","Europe/Berlin","Europe/Madrid","Europe/Paris"],2:["Europe/Athens","Africa/Cairo","Africa/Johannesburg"],3:["Europe/Moscow","Asia/Riyadh","Asia/Qatar"],3.5:["Asia/Tehran"],4:["Asia/Dubai","Asia/Muscat"],4.5:[],5:["Asia/Karachi"],5.5:["Asia/Kolkata","Asia/Colombo"],5.75:["Asia/Kathmandu"],6:["Asia/Dhaka","Asia/Almaty"],6.5:["Asia/Yangon"],7:["Asia/Bangkok","Asia/Jakarta"],8:["Asia/Shanghai","Asia/Singapore","Asia/Hong_Kong","Asia/Kuala_Lumpur"],9:["Asia/Tokyo","Asia/Seoul"],9.5:["Australia/Adelaide"],10:["Australia/Sydney","Australia/Brisbane"],11:["Pacific/Norfolk"],12:["Pacific/Auckland"]};function Ih(){const e=-new Date().getTimezoneOffset()/60,t=jh[e];return t&&t.length>0?t[0]:"Etc/UTC"}const Qn="tv:latest-symbol",hu="web-trading-last-account-login";function Mh(){for(var e=0,t,n,r="";e<arguments.length;)(t=arguments[e++])&&(n=gu(t))&&(r&&(r+=" "),r+=n);return r}function gu(e){if(typeof e=="string")return e;for(var t,n="",r=0;r<e.length;r++)e[r]&&(t=gu(e[r]))&&(n&&(n+=" "),n+=t);return n}var ka="-";function Fh(e){var t=Bh(e),n=e.conflictingClassGroups,r=e.conflictingClassGroupModifiers,s=r===void 0?{}:r;function i(a){var l=a.split(ka);return l[0]===""&&l.length!==1&&l.shift(),yu(l,t)||Uh(a)}function o(a,l){var d=n[a]||[];return l&&s[a]?[].concat(d,s[a]):d}return{getClassGroupId:i,getConflictingClassGroupIds:o}}function yu(e,t){var o;if(e.length===0)return t.classGroupId;var n=e[0],r=t.nextPart.get(n),s=r?yu(e.slice(1),r):void 0;if(s)return s;if(t.validators.length!==0){var i=e.join(ka);return(o=t.validators.find(function(a){var l=a.validator;return l(i)}))==null?void 0:o.classGroupId}}var Gc=/^\[(.+)\]$/;function Uh(e){if(Gc.test(e)){var t=Gc.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}}function Bh(e){var t=e.theme,n=e.prefix,r={nextPart:new Map,validators:[]},s=Vh(Object.entries(e.classGroups),n);return s.forEach(function(i){var o=i[0],a=i[1];Oo(a,r,o,t)}),r}function Oo(e,t,n,r){e.forEach(function(s){if(typeof s=="string"){var i=s===""?t:Zc(t,s);i.classGroupId=n;return}if(typeof s=="function"){if($h(s)){Oo(s(r),t,n,r);return}t.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(function(o){var a=o[0],l=o[1];Oo(l,Zc(t,a),n,r)})})}function Zc(e,t){var n=e;return t.split(ka).forEach(function(r){n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n}function $h(e){return e.isThemeGetter}function Vh(e,t){return t?e.map(function(n){var r=n[0],s=n[1],i=s.map(function(o){return typeof o=="string"?t+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(function(a){var l=a[0],d=a[1];return[t+l,d]})):o});return[r,i]}):e}function Hh(e){if(e<1)return{get:function(){},set:function(){}};var t=0,n=new Map,r=new Map;function s(i,o){n.set(i,o),t++,t>e&&(t=0,r=n,n=new Map)}return{get:function(o){var a=n.get(o);if(a!==void 0)return a;if((a=r.get(o))!==void 0)return s(o,a),a},set:function(o,a){n.has(o)?n.set(o,a):s(o,a)}}}var bu="!";function zh(e){var t=e.separator||":",n=t.length===1,r=t[0],s=t.length;return function(o){for(var a=[],l=0,d=0,f,u=0;u<o.length;u++){var g=o[u];if(l===0){if(g===r&&(n||o.slice(u,u+s)===t)){a.push(o.slice(d,u)),d=u+s;continue}if(g==="/"){f=u;continue}}g==="["?l++:g==="]"&&l--}var p=a.length===0?o:o.substring(d),y=p.startsWith(bu),m=y?p.substring(1):p,h=f&&f>d?f-d:void 0;return{modifiers:a,hasImportantModifier:y,baseClassName:m,maybePostfixModifierPosition:h}}}function Wh(e){if(e.length<=1)return e;var t=[],n=[];return e.forEach(function(r){var s=r[0]==="[";s?(t.push.apply(t,n.sort().concat([r])),n=[]):n.push(r)}),t.push.apply(t,n.sort()),t}function Kh(e){return{cache:Hh(e.cacheSize),splitModifiers:zh(e),...Fh(e)}}var qh=/\s+/;function Gh(e,t){var n=t.splitModifiers,r=t.getClassGroupId,s=t.getConflictingClassGroupIds,i=new Set;return e.trim().split(qh).map(function(o){var a=n(o),l=a.modifiers,d=a.hasImportantModifier,f=a.baseClassName,u=a.maybePostfixModifierPosition,g=r(u?f.substring(0,u):f),p=!!u;if(!g){if(!u)return{isTailwindClass:!1,originalClassName:o};if(g=r(f),!g)return{isTailwindClass:!1,originalClassName:o};p=!1}var y=Wh(l).join(":"),m=d?y+bu:y;return{isTailwindClass:!0,modifierId:m,classGroupId:g,originalClassName:o,hasPostfixModifier:p}}).reverse().filter(function(o){if(!o.isTailwindClass)return!0;var a=o.modifierId,l=o.classGroupId,d=o.hasPostfixModifier,f=a+l;return i.has(f)?!1:(i.add(f),s(l,d).forEach(function(u){return i.add(a+u)}),!0)}).reverse().map(function(o){return o.originalClassName}).join(" ")}function Zh(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r,s,i,o=a;function a(d){var f=t[0],u=t.slice(1),g=u.reduce(function(p,y){return y(p)},f());return r=Kh(g),s=r.cache.get,i=r.cache.set,o=l,l(d)}function l(d){var f=s(d);if(f)return f;var u=Gh(d,r);return i(d,u),u}return function(){return o(Mh.apply(null,arguments))}}function Ae(e){var t=function(r){return r[e]||[]};return t.isThemeGetter=!0,t}var vu=/^\[(?:([a-z-]+):)?(.+)\]$/i,Yh=/^\d+\/\d+$/,Qh=new Set(["px","full","screen"]),Xh=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Jh=/\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$/,eg=/^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;function mt(e){return bn(e)||Qh.has(e)||Yh.test(e)||No(e)}function No(e){return Un(e,"length",og)}function tg(e){return Un(e,"size",wu)}function ng(e){return Un(e,"position",wu)}function rg(e){return Un(e,"url",ag)}function xs(e){return Un(e,"number",bn)}function bn(e){return!Number.isNaN(Number(e))}function sg(e){return e.endsWith("%")&&bn(e.slice(0,-1))}function Rr(e){return Yc(e)||Un(e,"number",Yc)}function ye(e){return vu.test(e)}function Lr(){return!0}function Wt(e){return Xh.test(e)}function ig(e){return Un(e,"",cg)}function Un(e,t,n){var r=vu.exec(e);return r?r[1]?r[1]===t:n(r[2]):!1}function og(e){return Jh.test(e)}function wu(){return!1}function ag(e){return e.startsWith("url(")}function Yc(e){return Number.isInteger(Number(e))}function cg(e){return eg.test(e)}function lg(){var e=Ae("colors"),t=Ae("spacing"),n=Ae("blur"),r=Ae("brightness"),s=Ae("borderColor"),i=Ae("borderRadius"),o=Ae("borderSpacing"),a=Ae("borderWidth"),l=Ae("contrast"),d=Ae("grayscale"),f=Ae("hueRotate"),u=Ae("invert"),g=Ae("gap"),p=Ae("gradientColorStops"),y=Ae("gradientColorStopPositions"),m=Ae("inset"),h=Ae("margin"),b=Ae("opacity"),v=Ae("padding"),_=Ae("saturate"),x=Ae("scale"),S=Ae("sepia"),T=Ae("skew"),P=Ae("space"),A=Ae("translate"),D=function(){return["auto","contain","none"]},I=function(){return["auto","hidden","clip","visible","scroll"]},N=function(){return["auto",ye,t]},L=function(){return[ye,t]},H=function(){return["",mt]},R=function(){return["auto",bn,ye]},F=function(){return["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"]},M=function(){return["solid","dashed","dotted","double","none"]},$=function(){return["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter"]},O=function(){return["start","end","center","between","around","evenly","stretch"]},U=function(){return["","0",ye]},W=function(){return["auto","avoid","all","avoid-page","page","left","right","column"]},j=function(){return[bn,xs]},ee=function(){return[bn,ye]};return{cacheSize:500,theme:{colors:[Lr],spacing:[mt],blur:["none","",Wt,ye],brightness:j(),borderColor:[e],borderRadius:["none","","full",Wt,ye],borderSpacing:L(),borderWidth:H(),contrast:j(),grayscale:U(),hueRotate:ee(),invert:U(),gap:L(),gradientColorStops:[e],gradientColorStopPositions:[sg,No],inset:N(),margin:N(),opacity:j(),padding:L(),saturate:j(),scale:j(),sepia:U(),skew:ee(),space:L(),translate:L()},classGroups:{aspect:[{aspect:["auto","square","video",ye]}],container:["container"],columns:[{columns:[Wt]}],"break-after":[{"break-after":W()}],"break-before":[{"break-before":W()}],"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"],float:[{float:["right","left","none"]}],clear:[{clear:["left","right","both","none"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[].concat(F(),[ye])}],overflow:[{overflow:I()}],"overflow-x":[{"overflow-x":I()}],"overflow-y":[{"overflow-y":I()}],overscroll:[{overscroll:D()}],"overscroll-x":[{"overscroll-x":D()}],"overscroll-y":[{"overscroll-y":D()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Rr]}],basis:[{basis:N()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ye]}],grow:[{grow:U()}],shrink:[{shrink:U()}],order:[{order:["first","last","none",Rr]}],"grid-cols":[{"grid-cols":[Lr]}],"col-start-end":[{col:["auto",{span:["full",Rr]},ye]}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":[Lr]}],"row-start-end":[{row:["auto",{span:[Rr]},ye]}],"row-start":[{"row-start":R()}],"row-end":[{"row-end":R()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ye]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ye]}],gap:[{gap:[g]}],"gap-x":[{"gap-x":[g]}],"gap-y":[{"gap-y":[g]}],"justify-content":[{justify:["normal"].concat(O())}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal"].concat(O(),["baseline"])}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[].concat(O(),["baseline"])}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[v]}],px:[{px:[v]}],py:[{py:[v]}],ps:[{ps:[v]}],pe:[{pe:[v]}],pt:[{pt:[v]}],pr:[{pr:[v]}],pb:[{pb:[v]}],pl:[{pl:[v]}],m:[{m:[h]}],mx:[{mx:[h]}],my:[{my:[h]}],ms:[{ms:[h]}],me:[{me:[h]}],mt:[{mt:[h]}],mr:[{mr:[h]}],mb:[{mb:[h]}],ml:[{ml:[h]}],"space-x":[{"space-x":[P]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[P]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit",ye,t]}],"min-w":[{"min-w":["min","max","fit",ye,mt]}],"max-w":[{"max-w":["0","none","full","min","max","fit","prose",{screen:[Wt]},Wt,ye]}],h:[{h:[ye,t,"auto","min","max","fit"]}],"min-h":[{"min-h":["min","max","fit",ye,mt]}],"max-h":[{"max-h":[ye,t,"min","max","fit"]}],"font-size":[{text:["base",Wt,No]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",xs]}],"font-family":[{font:[Lr]}],"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-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",ye]}],"line-clamp":[{"line-clamp":["none",bn,xs]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",ye,mt]}],"list-image":[{"list-image":["none",ye]}],"list-style-type":[{list:["none","disc","decimal",ye]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[].concat(M(),["wavy"])}],"text-decoration-thickness":[{decoration:["auto","from-font",mt]}],"underline-offset":[{"underline-offset":["auto",ye,mt]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],indent:[{indent:L()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ye]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ye]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[].concat(F(),[ng])}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",tg]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},rg]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[y]}],"gradient-via-pos":[{via:[y]}],"gradient-to-pos":[{to:[y]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[].concat(M(),["hidden"])}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:M()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[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:[""].concat(M())}],"outline-offset":[{"outline-offset":[ye,mt]}],"outline-w":[{outline:[mt]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:H()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[mt]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Wt,ig]}],"shadow-color":[{shadow:[Lr]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":$()}],"bg-blend":[{"bg-blend":$()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Wt,ye]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[f]}],invert:[{invert:[u]}],saturate:[{saturate:[_]}],sepia:[{sepia:[S]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[f]}],"backdrop-invert":[{"backdrop-invert":[u]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[_]}],"backdrop-sepia":[{"backdrop-sepia":[S]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",ye]}],duration:[{duration:ee()}],ease:[{ease:["linear","in","out","in-out",ye]}],delay:[{delay:ee()}],animate:[{animate:["none","spin","ping","pulse","bounce",ye]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[x]}],"scale-x":[{"scale-x":[x]}],"scale-y":[{"scale-y":[x]}],rotate:[{rotate:[Rr,ye]}],"translate-x":[{"translate-x":[A]}],"translate-y":[{"translate-y":[A]}],"skew-x":[{"skew-x":[T]}],"skew-y":[{"skew-y":[T]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ye]}],accent:[{accent:["auto",e]}],appearance:["appearance-none"],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",ye]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":L()}],"scroll-mx":[{"scroll-mx":L()}],"scroll-my":[{"scroll-my":L()}],"scroll-ms":[{"scroll-ms":L()}],"scroll-me":[{"scroll-me":L()}],"scroll-mt":[{"scroll-mt":L()}],"scroll-mr":[{"scroll-mr":L()}],"scroll-mb":[{"scroll-mb":L()}],"scroll-ml":[{"scroll-ml":L()}],"scroll-p":[{"scroll-p":L()}],"scroll-px":[{"scroll-px":L()}],"scroll-py":[{"scroll-py":L()}],"scroll-ps":[{"scroll-ps":L()}],"scroll-pe":[{"scroll-pe":L()}],"scroll-pt":[{"scroll-pt":L()}],"scroll-pr":[{"scroll-pr":L()}],"scroll-pb":[{"scroll-pb":L()}],"scroll-pl":[{"scroll-pl":L()}],"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","pinch-zoom","manipulation",{pan:["x","left","right","y","up","down"]}]}],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ye]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[mt,xs]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"]},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"],"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"],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-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-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"],"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"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}}var dg=Zh(lg);function Te(...e){return dg(pu(e))}const ug=({className:e=""})=>c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-loader-circle s absolute animate-spin",children:c.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56",className:e})}),Qc=Pa("inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:opacity-60",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input dark:border-[#FFFFFF1A] hover:opacity-60 dark:bg-[#202020] dark:text-white shadow-sm hover:bg-primary-1 ",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",cobalt:"text-cobalt-600 bg-cobalt-100 border border-cobalt-600 font-semibold hover:bg-cobalt-50 hover:text-cobalt-300",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),ct=w.forwardRef(({children:e,className:t,variant:n,size:r,loading:s,asChild:i=!1,disabled:o,loaderClassName:a="",loaderParentClassName:l="",...d},f)=>{const u=i?Th:"button";return i?c.jsx(u,{className:Te(Qc({variant:n,size:r,className:t}),o&&"cursor-default","relative"),ref:f,...d,children:e}):c.jsxs(u,{className:Te(Qc({variant:n,size:r,className:t}),o&&"cursor-default","relative"),ref:f,disabled:s||o,...d,children:[s&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"absolute left-0 z-10 h-full w-full rounded-md bg-white"}),c.jsx("span",{className:Te("absolute left-0 z-20 flex h-full w-full items-center justify-center rounded-md bg-inherit text-orange-300",l),children:c.jsx(ug,{className:a})})]}),e]})});ct.displayName="Button";function me(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e==null||e(s),n===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function Bn(e,t=[]){let n=[];function r(i,o){const a=w.createContext(o);a.displayName=i+"Context";const l=n.length;n=[...n,o];const d=u=>{var b;const{scope:g,children:p,...y}=u,m=((b=g==null?void 0:g[e])==null?void 0:b[l])||a,h=w.useMemo(()=>y,Object.values(y));return c.jsx(m.Provider,{value:h,children:p})};d.displayName=i+"Provider";function f(u,g){var m;const p=((m=g==null?void 0:g[e])==null?void 0:m[l])||a,y=w.useContext(p);if(y)return y;if(o!==void 0)return o;throw new Error(`\`${u}\` must be used within \`${i}\``)}return[d,f]}const s=()=>{const i=n.map(o=>w.createContext(o));return function(a){const l=(a==null?void 0:a[e])||i;return w.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return s.scopeName=e,[r,fg(s,...t)]}function fg(...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(i){const o=r.reduce((a,{useScope:l,scopeName:d})=>{const u=l(i)[`__scope${d}`];return{...a,...u}},{});return w.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var Ie=globalThis!=null&&globalThis.document?w.useLayoutEffect:()=>{},mg=w[" useId ".trim().toString()]||(()=>{}),pg=0;function on(e){const[t,n]=w.useState(mg());return Ie(()=>{n(r=>r??String(pg++))},[e]),e||(t?`radix-${t}`:"")}var hg=w[" useInsertionEffect ".trim().toString()]||Ie;function Ln({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,i,o]=gg({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:s;{const f=w.useRef(e!==void 0);w.useEffect(()=>{const u=f.current;u!==a&&console.warn(`${r} is changing from ${u?"controlled":"uncontrolled"} to ${a?"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=a},[a,r])}const d=w.useCallback(f=>{var u;if(a){const g=yg(f)?f(e):f;g!==e&&((u=o.current)==null||u.call(o,g))}else i(f)},[a,e,i,o]);return[l,d]}function gg({defaultProp:e,onChange:t}){const[n,r]=w.useState(e),s=w.useRef(n),i=w.useRef(t);return hg(()=>{i.current=t},[t]),w.useEffect(()=>{var o;s.current!==n&&((o=i.current)==null||o.call(i,n),s.current=n)},[n,s]),[n,r,i]}function yg(e){return typeof e=="function"}var bg=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],he=bg.reduce((e,t)=>{const n=mr(`Primitive.${t}`),r=w.forwardRef((s,i)=>{const{asChild:o,...a}=s,l=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(l,{...a,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function _u(e,t){e&&Cr.flushSync(()=>e.dispatchEvent(t))}function yt(e){const t=w.useRef(e);return w.useEffect(()=>{t.current=e}),w.useMemo(()=>((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)}),[])}function vg(e,t=globalThis==null?void 0:globalThis.document){const n=yt(e);w.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 wg="DismissableLayer",Ro="dismissableLayer.update",_g="dismissableLayer.pointerDownOutside",xg="dismissableLayer.focusOutside",Xc,Aa=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),xi=w.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:a,onDismiss:l,...d}=e,f=w.useContext(Aa),[u,g]=w.useState(null),p=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=w.useState({}),m=Oe(t,D=>g(D)),h=Array.from(f.layers),[b]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),v=h.indexOf(b),_=u?h.indexOf(u):-1,x=f.layersWithOutsidePointerEventsDisabled.size>0,S=_>=v,T=w.useRef(!1),P=Tg(D=>{const I=D.target;if(!(I instanceof Node))return;const N=[...f.branches].some(L=>L.contains(I));!S||N||(i==null||i(D),a==null||a(D),D.defaultPrevented||l==null||l())},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:T,dismissableSurfaces:f.dismissableSurfaces}),A=Eg(D=>{if(r&&T.current)return;const I=D.target;[...f.branches].some(L=>L.contains(I))||(o==null||o(D),a==null||a(D),D.defaultPrevented||l==null||l())},p);return vg(D=>{_===f.layers.size-1&&(s==null||s(D),!D.defaultPrevented&&l&&(D.preventDefault(),l()))},p),w.useEffect(()=>{if(u)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(Xc=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(u)),f.layers.add(u),Jc(),()=>{n&&(f.layersWithOutsidePointerEventsDisabled.delete(u),f.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=Xc))}},[u,p,n,f]),w.useEffect(()=>()=>{u&&(f.layers.delete(u),f.layersWithOutsidePointerEventsDisabled.delete(u),Jc())},[u,f]),w.useEffect(()=>{const D=()=>y({});return document.addEventListener(Ro,D),()=>document.removeEventListener(Ro,D)},[]),c.jsx(he.div,{...d,ref:m,style:{pointerEvents:x?S?"auto":"none":void 0,...e.style},onFocusCapture:me(e.onFocusCapture,A.onFocusCapture),onBlurCapture:me(e.onBlurCapture,A.onBlurCapture),onPointerDownCapture:me(e.onPointerDownCapture,P.onPointerDownCapture)})});xi.displayName=wg;var Sg="DismissableLayerBranch",xu=w.forwardRef((e,t)=>{const n=w.useContext(Aa),r=w.useRef(null),s=Oe(t,r);return w.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),c.jsx(he.div,{...e,ref:s})});xu.displayName=Sg;function Cg(){const e=w.useContext(Aa),[t,n]=w.useState(null);return w.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}function Tg(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:s,dismissableSurfaces:i}=t,o=yt(e),a=w.useRef(!1),l=w.useRef(!1),d=w.useRef(new Map),f=w.useRef(()=>{});return w.useEffect(()=>{function u(){l.current=!1,s.current=!1,d.current.clear()}function g(){return Array.from(d.current.values()).some(Boolean)}function p(v){if(!l.current)return;const _=v.target;_ instanceof Node&&[...i].some(S=>S.contains(_))||d.current.set(v.type,!0),v.type==="click"&&window.setTimeout(()=>{l.current&&f.current()},0)}function y(v){l.current&&d.current.set(v.type,!1)}const m=v=>{if(v.target&&!a.current){let _=function(){n.removeEventListener("click",f.current);const S=g();u(),S||Su(_g,o,x,{discrete:!0})};const x={originalEvent:v};l.current=!0,s.current=r&&v.button===0,d.current.clear(),!r||v.button!==0?_():(n.removeEventListener("click",f.current),f.current=_,n.addEventListener("click",f.current,{once:!0}))}else n.removeEventListener("click",f.current),u();a.current=!1},h=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const v of h)n.addEventListener(v,p,!0),n.addEventListener(v,y);const b=window.setTimeout(()=>{n.addEventListener("pointerdown",m)},0);return()=>{window.clearTimeout(b),n.removeEventListener("pointerdown",m),n.removeEventListener("click",f.current);for(const v of h)n.removeEventListener(v,p,!0),n.removeEventListener(v,y)}},[n,o,r,s,i]),{onPointerDownCapture:()=>a.current=!0}}function Eg(e,t=globalThis==null?void 0:globalThis.document){const n=yt(e),r=w.useRef(!1);return w.useEffect(()=>{const s=i=>{i.target&&!r.current&&Su(xg,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Jc(){const e=new CustomEvent(Ro);document.dispatchEvent(e)}function Su(e,t,n,{discrete:r}){const s=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?_u(s,i):s.dispatchEvent(i)}var Pg=xi,kg=xu,to="focusScope.autoFocusOnMount",no="focusScope.autoFocusOnUnmount",el={bubbles:!1,cancelable:!0},Ag="FocusScope",Oa=w.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:i,...o}=e,[a,l]=w.useState(null),d=yt(s),f=yt(i),u=w.useRef(null),g=Oe(t,m=>l(m)),p=w.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;w.useEffect(()=>{if(r){let m=function(_){if(p.paused||!a)return;const x=_.target;a.contains(x)?u.current=x:Kt(u.current,{select:!0})},h=function(_){if(p.paused||!a)return;const x=_.relatedTarget;x!==null&&(a.contains(x)||Kt(u.current,{select:!0}))},b=function(_){if(document.activeElement===document.body)for(const S of _)S.removedNodes.length>0&&Kt(a)};document.addEventListener("focusin",m),document.addEventListener("focusout",h);const v=new MutationObserver(b);return a&&v.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",h),v.disconnect()}}},[r,a,p.paused]),w.useEffect(()=>{if(a){nl.add(p);const m=document.activeElement;if(!a.contains(m)){const b=new CustomEvent(to,el);a.addEventListener(to,d),a.dispatchEvent(b),b.defaultPrevented||(Og(jg(Cu(a)),{select:!0}),document.activeElement===m&&Kt(a))}return()=>{a.removeEventListener(to,d),setTimeout(()=>{const b=new CustomEvent(no,el);a.addEventListener(no,f),a.dispatchEvent(b),b.defaultPrevented||Kt(m??document.body,{select:!0}),a.removeEventListener(no,f),nl.remove(p)},0)}}},[a,d,f,p]);const y=w.useCallback(m=>{if(!n&&!r||p.paused)return;const h=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,b=document.activeElement;if(h&&b){const v=m.currentTarget,[_,x]=Ng(v);_&&x?!m.shiftKey&&b===x?(m.preventDefault(),n&&Kt(_,{select:!0})):m.shiftKey&&b===_&&(m.preventDefault(),n&&Kt(x,{select:!0})):b===v&&m.preventDefault()}},[n,r,p.paused]);return c.jsx(he.div,{tabIndex:-1,...o,ref:g,onKeyDown:y})});Oa.displayName=Ag;function Og(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Kt(r,{select:t}),document.activeElement!==n)return}function Ng(e){const t=Cu(e),n=tl(t,e),r=tl(t.reverse(),e);return[n,r]}function Cu(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 tl(e,t){for(const n of e)if(!Rg(n,{upTo:t}))return n}function Rg(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 Lg(e){return e instanceof HTMLInputElement&&"select"in e}function Kt(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Lg(e)&&t&&e.select()}}var nl=Dg();function Dg(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=rl(e,t),e.unshift(t)},remove(t){var n;e=rl(e,t),(n=e[0])==null||n.resume()}}}function rl(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function jg(e){return e.filter(t=>t.tagName!=="A")}var Ig="Portal",Si=w.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[s,i]=w.useState(!1);Ie(()=>i(!0),[]);const o=n||s&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?Cr.createPortal(c.jsx(he.div,{...r,ref:t}),o):null});Si.displayName=Ig;function Mg(e,t){return w.useReducer((n,r)=>t[n][r]??n,e)}var $n=e=>{const{present:t,children:n}=e,r=Fg(t),s=typeof n=="function"?n({present:r.isPresent}):w.Children.only(n),i=Ug(r.ref,Bg(s));return typeof n=="function"||r.isPresent?w.cloneElement(s,{ref:i}):null};$n.displayName="Presence";function Fg(e){const[t,n]=w.useState(),r=w.useRef(null),s=w.useRef(e),i=w.useRef("none"),o=e?"mounted":"unmounted",[a,l]=Mg(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const d=Ss(r.current);i.current=a==="mounted"?d:"none"},[a]),Ie(()=>{const d=r.current,f=s.current;if(f!==e){const g=i.current,p=Ss(d);e?l("MOUNT"):p==="none"||(d==null?void 0:d.display)==="none"?l("UNMOUNT"):l(f&&g!==p?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,l]),Ie(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,u=p=>{const m=Ss(r.current).includes(CSS.escape(p.animationName));if(p.target===t&&m&&(l("ANIMATION_END"),!s.current)){const h=t.style.animationFillMode;t.style.animationFillMode="forwards",d=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=h)})}},g=p=>{p.target===t&&(i.current=Ss(r.current))};return t.addEventListener("animationstart",g),t.addEventListener("animationcancel",u),t.addEventListener("animationend",u),()=>{f.clearTimeout(d),t.removeEventListener("animationstart",g),t.removeEventListener("animationcancel",u),t.removeEventListener("animationend",u)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:w.useCallback(d=>{r.current=d?getComputedStyle(d):null,n(d)},[])}}function sl(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Ug(...e){const t=w.useRef(e);return t.current=e,w.useCallback(n=>{const r=t.current;let s=!1;const i=r.map(o=>{const a=sl(o,n);return!s&&typeof a=="function"&&(s=!0),a});if(s)return()=>{for(let o=0;o<i.length;o++){const a=i[o];typeof a=="function"?a():sl(r[o],null)}}},[])}function Ss(e){return(e==null?void 0:e.animationName)||"none"}function Bg(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Cs=0,St=null;function Tu(){w.useEffect(()=>{St||(St={start:il(),end:il()});const{start:e,end:t}=St;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),Cs++,()=>{Cs===1&&(St==null||St.start.remove(),St==null||St.end.remove(),St=null),Cs=Math.max(0,Cs-1)}},[])}function il(){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 kt=function(){return kt=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},kt.apply(this,arguments)};function Eu(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 $g(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,i;r<s;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var $s="right-scroll-bar-position",Vs="width-before-scroll-bar",Vg="with-scroll-bars-hidden",Hg="--removed-body-scroll-bar-size";function ro(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function zg(e,t){var n=C.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 Wg=typeof window<"u"?w.useLayoutEffect:w.useEffect,ol=new WeakMap;function Kg(e,t){var n=zg(null,function(r){return e.forEach(function(s){return ro(s,r)})});return Wg(function(){var r=ol.get(n);if(r){var s=new Set(r),i=new Set(e),o=n.current;s.forEach(function(a){i.has(a)||ro(a,null)}),i.forEach(function(a){s.has(a)||ro(a,o)})}ol.set(n,e)},[e]),n}function qg(e){return e}function Gg(e,t){t===void 0&&(t=qg);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(i){var o=t(i,r);return n.push(o),function(){n=n.filter(function(a){return a!==o})}},assignSyncMedium:function(i){for(r=!0;n.length;){var o=n;n=[],o.forEach(i)}n={push:function(a){return i(a)},filter:function(){return n}}},assignMedium:function(i){r=!0;var o=[];if(n.length){var a=n;n=[],a.forEach(i),o=n}var l=function(){var f=o;o=[],f.forEach(i)},d=function(){return Promise.resolve().then(l)};d(),n={push:function(f){o.push(f),d()},filter:function(f){return o=o.filter(f),n}}}};return s}function Zg(e){e===void 0&&(e={});var t=Gg(null);return t.options=kt({async:!0,ssr:!1},e),t}var Pu=function(e){var t=e.sideCar,n=Eu(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 w.createElement(r,kt({},n))};Pu.isSideCarExport=!0;function Yg(e,t){return e.useMedium(t),Pu}var ku=Zg(),so=function(){},Ci=w.forwardRef(function(e,t){var n=w.useRef(null),r=w.useState({onScrollCapture:so,onWheelCapture:so,onTouchMoveCapture:so}),s=r[0],i=r[1],o=e.forwardProps,a=e.children,l=e.className,d=e.removeScrollBar,f=e.enabled,u=e.shards,g=e.sideCar,p=e.noRelative,y=e.noIsolation,m=e.inert,h=e.allowPinchZoom,b=e.as,v=b===void 0?"div":b,_=e.gapMode,x=Eu(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=g,T=Kg([n,t]),P=kt(kt({},x),s);return w.createElement(w.Fragment,null,f&&w.createElement(S,{sideCar:ku,removeScrollBar:d,shards:u,noRelative:p,noIsolation:y,inert:m,setCallbacks:i,allowPinchZoom:!!h,lockRef:n,gapMode:_}),o?w.cloneElement(w.Children.only(a),kt(kt({},P),{ref:T})):w.createElement(v,kt({},P,{className:l,ref:T}),a))});Ci.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ci.classNames={fullWidth:Vs,zeroRight:$s};var Qg=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Xg(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Qg();return t&&e.setAttribute("nonce",t),e}function Jg(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function ey(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var ty=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Xg())&&(Jg(t,n),ey(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},ny=function(){var e=ty();return function(t,n){w.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Au=function(){var e=ny(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},ry={left:0,top:0,right:0,gap:0},io=function(e){return parseInt(e||"",10)||0},sy=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[io(n),io(r),io(s)]},iy=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return ry;var t=sy(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])}},oy=Au(),Xn="data-scroll-locked",ay=function(e,t,n,r){var s=e.left,i=e.top,o=e.right,a=e.gap;return n===void 0&&(n="margin"),`
|
|
2
|
+
.`.concat(Vg,` {
|
|
3
3
|
overflow: hidden `).concat(r,`;
|
|
4
4
|
padding-right: `).concat(a,"px ").concat(r,`;
|
|
5
5
|
}
|
|
@@ -16,29 +16,29 @@
|
|
|
16
16
|
`),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),`
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
.`).concat(
|
|
19
|
+
.`).concat($s,` {
|
|
20
20
|
right: `).concat(a,"px ").concat(r,`;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
.`).concat(
|
|
23
|
+
.`).concat(Vs,` {
|
|
24
24
|
margin-right: `).concat(a,"px ").concat(r,`;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
.`).concat(
|
|
27
|
+
.`).concat($s," .").concat($s,` {
|
|
28
28
|
right: 0 `).concat(r,`;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
.`).concat(
|
|
31
|
+
.`).concat(Vs," .").concat(Vs,` {
|
|
32
32
|
margin-right: 0 `).concat(r,`;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
body[`).concat(Xn,`] {
|
|
36
|
-
`).concat(
|
|
36
|
+
`).concat(Hg,": ").concat(a,`px;
|
|
37
37
|
}
|
|
38
|
-
`)},
|
|
38
|
+
`)},al=function(){var e=parseInt(document.body.getAttribute(Xn)||"0",10);return isFinite(e)?e:0},cy=function(){w.useEffect(function(){return document.body.setAttribute(Xn,(al()+1).toString()),function(){var e=al()-1;e<=0?document.body.removeAttribute(Xn):document.body.setAttribute(Xn,e.toString())}},[])},ly=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;cy();var i=w.useMemo(function(){return iy(s)},[s]);return w.createElement(oy,{styles:ay(i,!t,s,n?"":"!important")})},Lo=!1;if(typeof window<"u")try{var Ts=Object.defineProperty({},"passive",{get:function(){return Lo=!0,!0}});window.addEventListener("test",Ts,Ts),window.removeEventListener("test",Ts,Ts)}catch{Lo=!1}var Hn=Lo?{passive:!1}:!1,dy=function(e){return e.tagName==="TEXTAREA"},Ou=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!dy(e)&&n[t]==="visible")},uy=function(e){return Ou(e,"overflowY")},fy=function(e){return Ou(e,"overflowX")},cl=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=Nu(e,r);if(s){var i=Ru(e,r),o=i[1],a=i[2];if(o>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},my=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},py=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Nu=function(e,t){return e==="v"?uy(t):fy(t)},Ru=function(e,t){return e==="v"?my(t):py(t)},hy=function(e,t){return e==="h"&&t==="rtl"?-1:1},gy=function(e,t,n,r,s){var i=hy(e,window.getComputedStyle(t).direction),o=i*r,a=n.target,l=t.contains(a),d=!1,f=o>0,u=0,g=0;do{if(!a)break;var p=Ru(e,a),y=p[0],m=p[1],h=p[2],b=m-h-i*y;(y||b)&&Nu(e,a)&&(u+=b,g+=y);var v=a.parentNode;a=v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE?v.host:v}while(!l&&a!==document.body||l&&(t.contains(a)||t===a));return(f&&Math.abs(u)<1||!f&&Math.abs(g)<1)&&(d=!0),d},Es=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},ll=function(e){return[e.deltaX,e.deltaY]},dl=function(e){return e&&"current"in e?e.current:e},yy=function(e,t){return e[0]===t[0]&&e[1]===t[1]},by=function(e){return`
|
|
39
39
|
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
40
40
|
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
41
|
-
`)},fy=0,zn=[];function py(e){var t=w.useRef([]),n=w.useRef([0,0]),r=w.useRef(),s=w.useState(fy++)[0],i=w.useState(Su)[0],o=w.useRef(e);w.useEffect(function(){o.current=e},[e]),w.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var p=Dg([e.lockRef.current],(e.shards||[]).map(al),!0).filter(Boolean);return p.forEach(function(h){return h.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),p.forEach(function(h){return h.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var a=w.useCallback(function(p,h){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!o.current.allowPinchZoom;var b=_s(p),v=n.current,_="deltaX"in p?p.deltaX:v[0]-b[0],x="deltaY"in p?p.deltaY:v[1]-b[1],S,T=p.target,P=Math.abs(_)>Math.abs(x)?"h":"v";if("touches"in p&&P==="h"&&T.type==="range")return!1;var O=window.getSelection(),R=O&&O.anchorNode,M=R?R===T||R.contains(T):!1;if(M)return!1;var N=il(P,T);if(!N)return!0;if(N?S=P:(S=P==="v"?"h":"v",N=il(P,T)),!N)return!1;if(!r.current&&"changedTouches"in p&&(_||x)&&(r.current=S),!S)return!0;var j=r.current||S;return ly(j,h,p,j==="h"?_:x)},[]),l=w.useCallback(function(p){var h=p;if(!(!zn.length||zn[zn.length-1]!==i)){var b="deltaY"in h?ol(h):_s(h),v=t.current.filter(function(S){return S.name===h.type&&(S.target===h.target||h.target===S.shadowParent)&&dy(S.delta,b)})[0];if(v&&v.should){h.cancelable&&h.preventDefault();return}if(!v){var _=(o.current.shards||[]).map(al).filter(Boolean).filter(function(S){return S.contains(h.target)}),x=_.length>0?a(h,_[0]):!o.current.noIsolation;x&&h.cancelable&&h.preventDefault()}}},[]),d=w.useCallback(function(p,h,b,v){var _={name:p,delta:h,target:b,should:v,shadowParent:my(b)};t.current.push(_),setTimeout(function(){t.current=t.current.filter(function(x){return x!==_})},1)},[]),f=w.useCallback(function(p){n.current=_s(p),r.current=void 0},[]),u=w.useCallback(function(p){d(p.type,ol(p),p.target,a(p,e.lockRef.current))},[]),y=w.useCallback(function(p){d(p.type,_s(p),p.target,a(p,e.lockRef.current))},[]);w.useEffect(function(){return zn.push(i),e.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:y}),document.addEventListener("wheel",l,Hn),document.addEventListener("touchmove",l,Hn),document.addEventListener("touchstart",f,Hn),function(){zn=zn.filter(function(p){return p!==i}),document.removeEventListener("wheel",l,Hn),document.removeEventListener("touchmove",l,Hn),document.removeEventListener("touchstart",f,Hn)}},[]);var m=e.removeScrollBar,g=e.inert;return w.createElement(w.Fragment,null,g?w.createElement(i,{styles:uy(s)}):null,m?w.createElement(ny,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function my(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const hy=Hg(xu,py);var Oa=w.forwardRef(function(e,t){return w.createElement(_i,At({},e,{ref:t,sideCar:hy}))});Oa.classNames=_i.classNames;var gy=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Wn=new WeakMap,xs=new WeakMap,Ss={},so=0,Pu=function(e){return e&&(e.host||Pu(e.parentNode))},yy=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Pu(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})},by=function(e,t,n,r){var s=yy(t,Array.isArray(e)?e:[e]);Ss[n]||(Ss[n]=new WeakMap);var i=Ss[n],o=[],a=new Set,l=new Set(s),d=function(u){!u||a.has(u)||(a.add(u),d(u.parentNode))};s.forEach(d);var f=function(u){!u||l.has(u)||Array.prototype.forEach.call(u.children,function(y){if(a.has(y))f(y);else try{var m=y.getAttribute(r),g=m!==null&&m!=="false",p=(Wn.get(y)||0)+1,h=(i.get(y)||0)+1;Wn.set(y,p),i.set(y,h),o.push(y),p===1&&g&&xs.set(y,!0),h===1&&y.setAttribute(n,"true"),g||y.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",y,b)}})};return f(t),a.clear(),so++,function(){o.forEach(function(u){var y=Wn.get(u)-1,m=i.get(u)-1;Wn.set(u,y),i.set(u,m),y||(xs.has(u)||u.removeAttribute(r),xs.delete(u)),m||u.removeAttribute(n)}),so--,so||(Wn=new WeakMap,Wn=new WeakMap,xs=new WeakMap,Ss={})}},Au=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=gy(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),by(r,s,n,"aria-hidden")):function(){return null}},xi="Dialog",[Ou]=Bn(xi),[vy,vt]=Ou(xi),Nu=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:o=!0}=e,a=w.useRef(null),l=w.useRef(null),[d,f]=Ln({prop:r,defaultProp:s??!1,onChange:i,caller:xi});return c.jsx(vy,{scope:t,triggerRef:a,contentRef:l,contentId:on(),titleId:on(),descriptionId:on(),open:d,onOpenChange:f,onOpenToggle:w.useCallback(()=>f(u=>!u),[f]),modal:o,children:n})};Nu.displayName=xi;var ku="DialogTrigger",wy=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=vt(ku,n),i=Ne(t,s.triggerRef);return c.jsx(pe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":ja(s.open),...r,ref:i,onClick:fe(e.onClick,s.onOpenToggle)})});wy.displayName=ku;var Na="DialogPortal",[_y,Ru]=Ou(Na,{forceMount:void 0}),Lu=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,i=vt(Na,t);return c.jsx(_y,{scope:t,forceMount:n,children:w.Children.map(r,o=>c.jsx($n,{present:n||i.open,children:c.jsx(wi,{asChild:!0,container:s,children:o})}))})};Lu.displayName=Na;var Zs="DialogOverlay",ka=w.forwardRef((e,t)=>{const n=Ru(Zs,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=vt(Zs,e.__scopeDialog);return i.modal?c.jsx($n,{present:r||i.open,children:c.jsx(Sy,{...s,ref:t})}):null});ka.displayName=Zs;var xy=pr("DialogOverlay.RemoveScroll"),Sy=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=vt(Zs,n),i=yg(),o=Ne(t,i);return c.jsx(Oa,{as:xy,allowPinchZoom:!0,shards:[s.contentRef],children:c.jsx(pe.div,{"data-state":ja(s.open),...r,ref:o,style:{pointerEvents:"auto",...r.style}})})}),mr="DialogContent",Ra=w.forwardRef((e,t)=>{const n=Ru(mr,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=vt(mr,e.__scopeDialog);return c.jsx($n,{present:r||i.open,children:i.modal?c.jsx(Cy,{...s,ref:t}):c.jsx(Ey,{...s,ref:t})})});Ra.displayName=mr;var Cy=w.forwardRef((e,t)=>{const n=vt(mr,e.__scopeDialog),r=w.useRef(null),s=Ne(t,n.contentRef,r);return w.useEffect(()=>{const i=r.current;if(i)return Au(i)},[]),c.jsx(Du,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:fe(e.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:fe(e.onPointerDownOutside,i=>{const o=i.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&i.preventDefault()}),onFocusOutside:fe(e.onFocusOutside,i=>i.preventDefault())})}),Ey=w.forwardRef((e,t)=>{const n=vt(mr,e.__scopeDialog),r=w.useRef(!1),s=w.useRef(!1);return c.jsx(Du,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,a;(o=e.onCloseAutoFocus)==null||o.call(e,i),i.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{var l,d;(l=e.onInteractOutside)==null||l.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=i.target;((d=n.triggerRef.current)==null?void 0:d.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),Du=w.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,...o}=e,a=vt(mr,n);return vu(),c.jsx(c.Fragment,{children:c.jsx(Aa,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:c.jsx(vi,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":ja(a.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>a.onOpenChange(!1)})})})}),ju="DialogTitle",La=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=vt(ju,n);return c.jsx(pe.h2,{id:s.titleId,...r,ref:t})});La.displayName=ju;var Iu="DialogDescription",Da=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=vt(Iu,n);return c.jsx(pe.p,{id:s.descriptionId,...r,ref:t})});Da.displayName=Iu;var Mu="DialogClose",Ty=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=vt(Mu,n);return c.jsx(pe.button,{type:"button",...r,ref:t,onClick:fe(e.onClick,()=>s.onOpenChange(!1))})});Ty.displayName=Mu;function ja(e){return e?"open":"closed"}const Py=Nu,Ay=Lu,Fu=w.forwardRef(({className:e,...t},n)=>c.jsx(ka,{ref:n,className:Ce("bg-background/80 fixed inset-0 z-50 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));Fu.displayName=ka.displayName;const Uu=w.forwardRef(({className:e,overlayClass:t,children:n,...r},s)=>c.jsxs(Ay,{children:[c.jsx(Fu,{className:t}),c.jsx(Ra,{ref:s,className:Ce("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-2xl md:w-full",e),...r,children:n})]}));Uu.displayName=Ra.displayName;const Bu=({className:e,...t})=>c.jsx("div",{className:Ce("flex flex-col space-y-1.5 border-b text-center sm:text-left",e),...t});Bu.displayName="DialogHeader";const $u=({className:e,...t})=>c.jsx("div",{className:Ce("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});$u.displayName="DialogFooter";const Vu=w.forwardRef(({className:e,...t},n)=>c.jsx(La,{ref:n,className:Ce("text-lg font-semibold leading-none tracking-tight",e),...t}));Vu.displayName=La.displayName;const Hu=w.forwardRef(({className:e,...t},n)=>c.jsx(Da,{ref:n,className:Ce("text-sm text-muted-foreground",e),...t}));Hu.displayName=Da.displayName;function cl(e,[t,n]){return Math.min(n,Math.max(t,e))}function Ia(e){const t=e+"CollectionProvider",[n,r]=Bn(t),[s,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=p=>{const{scope:h,children:b}=p,v=w.useRef(null),_=w.useRef(new Map).current;return c.jsx(s,{scope:h,itemMap:_,collectionRef:v,children:b})};o.displayName=t;const a=e+"CollectionSlot",l=pr(a),d=w.forwardRef((p,h)=>{const{scope:b,children:v}=p,_=i(a,b),x=Ne(h,_.collectionRef);return c.jsx(l,{ref:x,children:v})});d.displayName=a;const f=e+"CollectionItemSlot",u="data-radix-collection-item",y=pr(f),m=w.forwardRef((p,h)=>{const{scope:b,children:v,..._}=p,x=w.useRef(null),S=Ne(h,x),T=i(f,b);return w.useEffect(()=>(T.itemMap.set(x,{ref:x,..._}),()=>void T.itemMap.delete(x))),c.jsx(y,{[u]:"",ref:S,children:v})});m.displayName=f;function g(p){const h=i(e+"CollectionConsumer",p);return w.useCallback(()=>{const v=h.collectionRef.current;if(!v)return[];const _=Array.from(v.querySelectorAll(`[${u}]`));return Array.from(h.itemMap.values()).sort((T,P)=>_.indexOf(T.ref.current)-_.indexOf(P.ref.current))},[h.collectionRef,h.itemMap])}return[{Provider:o,Slot:d,ItemSlot:m},g,r]}var Oy=w.createContext(void 0);function zu(e){const t=w.useContext(Oy);return e||t||"ltr"}const Ny=["top","right","bottom","left"],ln=Math.min,tt=Math.max,Ys=Math.round,Cs=Math.floor,Nt=e=>({x:e,y:e}),ky={left:"right",right:"left",bottom:"top",top:"bottom"};function Ro(e,t,n){return tt(e,ln(t,n))}function Mt(e,t){return typeof e=="function"?e(t):e}function Ft(e){return e.split("-")[0]}function Er(e){return e.split("-")[1]}function Ma(e){return e==="x"?"y":"x"}function Fa(e){return e==="y"?"height":"width"}function Ot(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Ua(e){return Ma(Ot(e))}function Ry(e,t,n){n===void 0&&(n=!1);const r=Er(e),s=Ua(e),i=Fa(s);let o=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(o=Qs(o)),[o,Qs(o)]}function Ly(e){const t=Qs(e);return[Lo(e),t,Lo(t)]}function Lo(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const ll=["left","right"],dl=["right","left"],Dy=["top","bottom"],jy=["bottom","top"];function Iy(e,t,n){switch(e){case"top":case"bottom":return n?t?dl:ll:t?ll:dl;case"left":case"right":return t?Dy:jy;default:return[]}}function My(e,t,n,r){const s=Er(e);let i=Iy(Ft(e),n==="start",r);return s&&(i=i.map(o=>o+"-"+s),t&&(i=i.concat(i.map(Lo)))),i}function Qs(e){const t=Ft(e);return ky[t]+e.slice(t.length)}function Fy(e){return{top:0,right:0,bottom:0,left:0,...e}}function Wu(e){return typeof e!="number"?Fy(e):{top:e,right:e,bottom:e,left:e}}function Xs(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function ul(e,t,n){let{reference:r,floating:s}=e;const i=Ot(t),o=Ua(t),a=Fa(o),l=Ft(t),d=i==="y",f=r.x+r.width/2-s.width/2,u=r.y+r.height/2-s.height/2,y=r[a]/2-s[a]/2;let m;switch(l){case"top":m={x:f,y:r.y-s.height};break;case"bottom":m={x:f,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:u};break;case"left":m={x:r.x-s.width,y:u};break;default:m={x:r.x,y:r.y}}switch(Er(t)){case"start":m[o]-=y*(n&&d?-1:1);break;case"end":m[o]+=y*(n&&d?-1:1);break}return m}async function Uy(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:i,rects:o,elements:a,strategy:l}=e,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:y=!1,padding:m=0}=Mt(t,e),g=Wu(m),h=a[y?u==="floating"?"reference":"floating":u],b=Xs(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(h)))==null||n?h:h.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:d,rootBoundary:f,strategy:l})),v=u==="floating"?{x:r,y:s,width:o.floating.width,height:o.floating.height}:o.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),x=await(i.isElement==null?void 0:i.isElement(_))?await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1}:{x:1,y:1},S=Xs(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:_,strategy:l}):v);return{top:(b.top-S.top+g.top)/x.y,bottom:(S.bottom-b.bottom+g.bottom)/x.y,left:(b.left-S.left+g.left)/x.x,right:(S.right-b.right+g.right)/x.x}}const By=50,$y=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:o}=n,a=o.detectOverflow?o:{...o,detectOverflow:Uy},l=await(o.isRTL==null?void 0:o.isRTL(t));let d=await o.getElementRects({reference:e,floating:t,strategy:s}),{x:f,y:u}=ul(d,r,l),y=r,m=0;const g={};for(let p=0;p<i.length;p++){const h=i[p];if(!h)continue;const{name:b,fn:v}=h,{x:_,y:x,data:S,reset:T}=await v({x:f,y:u,initialPlacement:r,placement:y,strategy:s,middlewareData:g,rects:d,platform:a,elements:{reference:e,floating:t}});f=_??f,u=x??u,g[b]={...g[b],...S},T&&m<By&&(m++,typeof T=="object"&&(T.placement&&(y=T.placement),T.rects&&(d=T.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:s}):T.rects),{x:f,y:u}=ul(d,y,l)),p=-1)}return{x:f,y:u,placement:y,strategy:s,middlewareData:g}},Vy=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:i,platform:o,elements:a,middlewareData:l}=t,{element:d,padding:f=0}=Mt(e,t)||{};if(d==null)return{};const u=Wu(f),y={x:n,y:r},m=Ua(s),g=Fa(m),p=await o.getDimensions(d),h=m==="y",b=h?"top":"left",v=h?"bottom":"right",_=h?"clientHeight":"clientWidth",x=i.reference[g]+i.reference[m]-y[m]-i.floating[g],S=y[m]-i.reference[m],T=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let P=T?T[_]:0;(!P||!await(o.isElement==null?void 0:o.isElement(T)))&&(P=a.floating[_]||i.floating[g]);const O=x/2-S/2,R=P/2-p[g]/2-1,M=ln(u[b],R),N=ln(u[v],R),j=M,H=P-p[g]-N,k=P/2-p[g]/2+O,B=Ro(j,k,H),F=!l.arrow&&Er(s)!=null&&k!==B&&i.reference[g]/2-(k<j?M:N)-p[g]/2<0,L=F?k<j?k-j:k-H:0;return{[m]:y[m]+L,data:{[m]:B,centerOffset:k-B-L,...F&&{alignmentOffset:L}},reset:F}}}),Hy=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:i,rects:o,initialPlacement:a,platform:l,elements:d}=t,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:y,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:p=!0,...h}=Mt(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const b=Ft(s),v=Ot(a),_=Ft(a)===a,x=await(l.isRTL==null?void 0:l.isRTL(d.floating)),S=y||(_||!p?[Qs(a)]:Ly(a)),T=g!=="none";!y&&T&&S.push(...My(a,p,g,x));const P=[a,...S],O=await l.detectOverflow(t,h),R=[];let M=((r=i.flip)==null?void 0:r.overflows)||[];if(f&&R.push(O[b]),u){const k=Ry(s,o,x);R.push(O[k[0]],O[k[1]])}if(M=[...M,{placement:s,overflows:R}],!R.every(k=>k<=0)){var N,j;const k=(((N=i.flip)==null?void 0:N.index)||0)+1,B=P[k];if(B&&(!(u==="alignment"?v!==Ot(B):!1)||M.every(D=>Ot(D.placement)===v?D.overflows[0]>0:!0)))return{data:{index:k,overflows:M},reset:{placement:B}};let F=(j=M.filter(L=>L.overflows[0]<=0).sort((L,D)=>L.overflows[1]-D.overflows[1])[0])==null?void 0:j.placement;if(!F)switch(m){case"bestFit":{var H;const L=(H=M.filter(D=>{if(T){const $=Ot(D.placement);return $===v||$==="y"}return!0}).map(D=>[D.placement,D.overflows.filter($=>$>0).reduce(($,W)=>$+W,0)]).sort((D,$)=>D[1]-$[1])[0])==null?void 0:H[0];L&&(F=L);break}case"initialPlacement":F=a;break}if(s!==F)return{reset:{placement:F}}}return{}}}};function fl(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function pl(e){return Ny.some(t=>e[t]>=0)}const zy=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:s="referenceHidden",...i}=Mt(e,t);switch(s){case"referenceHidden":{const o=await r.detectOverflow(t,{...i,elementContext:"reference"}),a=fl(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:pl(a)}}}case"escaped":{const o=await r.detectOverflow(t,{...i,altBoundary:!0}),a=fl(o,n.floating);return{data:{escapedOffsets:a,escaped:pl(a)}}}default:return{}}}}},Ku=new Set(["left","top"]);async function Wy(e,t){const{placement:n,platform:r,elements:s}=e,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=Ft(n),a=Er(n),l=Ot(n)==="y",d=Ku.has(o)?-1:1,f=i&&l?-1:1,u=Mt(t,e);let{mainAxis:y,crossAxis:m,alignmentAxis:g}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&typeof g=="number"&&(m=a==="end"?g*-1:g),l?{x:m*f,y:y*d}:{x:y*d,y:m*f}}const Ky=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:i,placement:o,middlewareData:a}=t,l=await Wy(t,e);return o===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:s+l.x,y:i+l.y,data:{...l,placement:o}}}}},qy=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:i}=t,{mainAxis:o=!0,crossAxis:a=!1,limiter:l={fn:b=>{let{x:v,y:_}=b;return{x:v,y:_}}},...d}=Mt(e,t),f={x:n,y:r},u=await i.detectOverflow(t,d),y=Ot(Ft(s)),m=Ma(y);let g=f[m],p=f[y];if(o){const b=m==="y"?"top":"left",v=m==="y"?"bottom":"right",_=g+u[b],x=g-u[v];g=Ro(_,g,x)}if(a){const b=y==="y"?"top":"left",v=y==="y"?"bottom":"right",_=p+u[b],x=p-u[v];p=Ro(_,p,x)}const h=l.fn({...t,[m]:g,[y]:p});return{...h,data:{x:h.x-n,y:h.y-r,enabled:{[m]:o,[y]:a}}}}}},Gy=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:i,middlewareData:o}=t,{offset:a=0,mainAxis:l=!0,crossAxis:d=!0}=Mt(e,t),f={x:n,y:r},u=Ot(s),y=Ma(u);let m=f[y],g=f[u];const p=Mt(a,t),h=typeof p=="number"?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(l){const _=y==="y"?"height":"width",x=i.reference[y]-i.floating[_]+h.mainAxis,S=i.reference[y]+i.reference[_]-h.mainAxis;m<x?m=x:m>S&&(m=S)}if(d){var b,v;const _=y==="y"?"width":"height",x=Ku.has(Ft(s)),S=i.reference[u]-i.floating[_]+(x&&((b=o.offset)==null?void 0:b[u])||0)+(x?0:h.crossAxis),T=i.reference[u]+i.reference[_]+(x?0:((v=o.offset)==null?void 0:v[u])||0)-(x?h.crossAxis:0);g<S?g=S:g>T&&(g=T)}return{[y]:m,[u]:g}}}},Zy=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:i,platform:o,elements:a}=t,{apply:l=()=>{},...d}=Mt(e,t),f=await o.detectOverflow(t,d),u=Ft(s),y=Er(s),m=Ot(s)==="y",{width:g,height:p}=i.floating;let h,b;u==="top"||u==="bottom"?(h=u,b=y===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(b=u,h=y==="end"?"top":"bottom");const v=p-f.top-f.bottom,_=g-f.left-f.right,x=ln(p-f[h],v),S=ln(g-f[b],_),T=!t.middlewareData.shift;let P=x,O=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(O=_),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(P=v),T&&!y){const M=tt(f.left,0),N=tt(f.right,0),j=tt(f.top,0),H=tt(f.bottom,0);m?O=g-2*(M!==0||N!==0?M+N:tt(f.left,f.right)):P=p-2*(j!==0||H!==0?j+H:tt(f.top,f.bottom))}await l({...t,availableWidth:O,availableHeight:P});const R=await o.getDimensions(a.floating);return g!==R.width||p!==R.height?{reset:{rects:!0}}:{}}}};function Si(){return typeof window<"u"}function Tr(e){return qu(e)?(e.nodeName||"").toLowerCase():"#document"}function nt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Rt(e){var t;return(t=(qu(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function qu(e){return Si()?e instanceof Node||e instanceof nt(e).Node:!1}function yt(e){return Si()?e instanceof Element||e instanceof nt(e).Element:!1}function $t(e){return Si()?e instanceof HTMLElement||e instanceof nt(e).HTMLElement:!1}function ml(e){return!Si()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof nt(e).ShadowRoot}function ns(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=bt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function Yy(e){return/^(table|td|th)$/.test(Tr(e))}function Ci(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Qy=/transform|translate|scale|rotate|perspective|filter/,Xy=/paint|layout|strict|content/,yn=e=>!!e&&e!=="none";let io;function Ba(e){const t=yt(e)?bt(e):e;return yn(t.transform)||yn(t.translate)||yn(t.scale)||yn(t.rotate)||yn(t.perspective)||!$a()&&(yn(t.backdropFilter)||yn(t.filter))||Qy.test(t.willChange||"")||Xy.test(t.contain||"")}function Jy(e){let t=dn(e);for(;$t(t)&&!hr(t);){if(Ba(t))return t;if(Ci(t))return null;t=dn(t)}return null}function $a(){return io==null&&(io=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),io}function hr(e){return/^(html|body|#document)$/.test(Tr(e))}function bt(e){return nt(e).getComputedStyle(e)}function Ei(e){return yt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function dn(e){if(Tr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ml(e)&&e.host||Rt(e);return ml(t)?t.host:t}function Gu(e){const t=dn(e);return hr(t)?e.ownerDocument?e.ownerDocument.body:e.body:$t(t)&&ns(t)?t:Gu(t)}function $r(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=Gu(e),i=s===((r=e.ownerDocument)==null?void 0:r.body),o=nt(s);if(i){const a=Do(o);return t.concat(o,o.visualViewport||[],ns(s)?s:[],a&&n?$r(a):[])}else return t.concat(s,$r(s,[],n))}function Do(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Zu(e){const t=bt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=$t(e),i=s?e.offsetWidth:n,o=s?e.offsetHeight:r,a=Ys(n)!==i||Ys(r)!==o;return a&&(n=i,r=o),{width:n,height:r,$:a}}function Va(e){return yt(e)?e:e.contextElement}function Jn(e){const t=Va(e);if(!$t(t))return Nt(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:i}=Zu(t);let o=(i?Ys(n.width):n.width)/r,a=(i?Ys(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const eb=Nt(0);function Yu(e){const t=nt(e);return!$a()||!t.visualViewport?eb:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function tb(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==nt(e)?!1:t}function Dn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=Va(e);let o=Nt(1);t&&(r?yt(r)&&(o=Jn(r)):o=Jn(e));const a=tb(i,n,r)?Yu(i):Nt(0);let l=(s.left+a.x)/o.x,d=(s.top+a.y)/o.y,f=s.width/o.x,u=s.height/o.y;if(i){const y=nt(i),m=r&&yt(r)?nt(r):r;let g=y,p=Do(g);for(;p&&r&&m!==g;){const h=Jn(p),b=p.getBoundingClientRect(),v=bt(p),_=b.left+(p.clientLeft+parseFloat(v.paddingLeft))*h.x,x=b.top+(p.clientTop+parseFloat(v.paddingTop))*h.y;l*=h.x,d*=h.y,f*=h.x,u*=h.y,l+=_,d+=x,g=nt(p),p=Do(g)}}return Xs({width:f,height:u,x:l,y:d})}function Ti(e,t){const n=Ei(e).scrollLeft;return t?t.left+n:Dn(Rt(e)).left+n}function Qu(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Ti(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function nb(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const i=s==="fixed",o=Rt(r),a=t?Ci(t.floating):!1;if(r===o||a&&i)return n;let l={scrollLeft:0,scrollTop:0},d=Nt(1);const f=Nt(0),u=$t(r);if((u||!u&&!i)&&((Tr(r)!=="body"||ns(o))&&(l=Ei(r)),u)){const m=Dn(r);d=Jn(r),f.x=m.x+r.clientLeft,f.y=m.y+r.clientTop}const y=o&&!u&&!i?Qu(o,l):Nt(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-l.scrollLeft*d.x+f.x+y.x,y:n.y*d.y-l.scrollTop*d.y+f.y+y.y}}function rb(e){return Array.from(e.getClientRects())}function sb(e){const t=Rt(e),n=Ei(e),r=e.ownerDocument.body,s=tt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=tt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+Ti(e);const a=-n.scrollTop;return bt(r).direction==="rtl"&&(o+=tt(t.clientWidth,r.clientWidth)-s),{width:s,height:i,x:o,y:a}}const hl=25;function ib(e,t){const n=nt(e),r=Rt(e),s=n.visualViewport;let i=r.clientWidth,o=r.clientHeight,a=0,l=0;if(s){i=s.width,o=s.height;const f=$a();(!f||f&&t==="fixed")&&(a=s.offsetLeft,l=s.offsetTop)}const d=Ti(r);if(d<=0){const f=r.ownerDocument,u=f.body,y=getComputedStyle(u),m=f.compatMode==="CSS1Compat"&&parseFloat(y.marginLeft)+parseFloat(y.marginRight)||0,g=Math.abs(r.clientWidth-u.clientWidth-m);g<=hl&&(i-=g)}else d<=hl&&(i+=d);return{width:i,height:o,x:a,y:l}}function ob(e,t){const n=Dn(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,i=$t(e)?Jn(e):Nt(1),o=e.clientWidth*i.x,a=e.clientHeight*i.y,l=s*i.x,d=r*i.y;return{width:o,height:a,x:l,y:d}}function gl(e,t,n){let r;if(t==="viewport")r=ib(e,n);else if(t==="document")r=sb(Rt(e));else if(yt(t))r=ob(t,n);else{const s=Yu(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return Xs(r)}function Xu(e,t){const n=dn(e);return n===t||!yt(n)||hr(n)?!1:bt(n).position==="fixed"||Xu(n,t)}function ab(e,t){const n=t.get(e);if(n)return n;let r=$r(e,[],!1).filter(a=>yt(a)&&Tr(a)!=="body"),s=null;const i=bt(e).position==="fixed";let o=i?dn(e):e;for(;yt(o)&&!hr(o);){const a=bt(o),l=Ba(o);!l&&a.position==="fixed"&&(s=null),(i?!l&&!s:!l&&a.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||ns(o)&&!l&&Xu(e,o))?r=r.filter(f=>f!==o):s=a,o=dn(o)}return t.set(e,r),r}function cb(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const o=[...n==="clippingAncestors"?Ci(t)?[]:ab(t,this._c):[].concat(n),r],a=gl(t,o[0],s);let l=a.top,d=a.right,f=a.bottom,u=a.left;for(let y=1;y<o.length;y++){const m=gl(t,o[y],s);l=tt(m.top,l),d=ln(m.right,d),f=ln(m.bottom,f),u=tt(m.left,u)}return{width:d-u,height:f-l,x:u,y:l}}function lb(e){const{width:t,height:n}=Zu(e);return{width:t,height:n}}function db(e,t,n){const r=$t(t),s=Rt(t),i=n==="fixed",o=Dn(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=Nt(0);function d(){l.x=Ti(s)}if(r||!r&&!i)if((Tr(t)!=="body"||ns(s))&&(a=Ei(t)),r){const m=Dn(t,!0,i,t);l.x=m.x+t.clientLeft,l.y=m.y+t.clientTop}else s&&d();i&&!r&&s&&d();const f=s&&!r&&!i?Qu(s,a):Nt(0),u=o.left+a.scrollLeft-l.x-f.x,y=o.top+a.scrollTop-l.y-f.y;return{x:u,y,width:o.width,height:o.height}}function oo(e){return bt(e).position==="static"}function yl(e,t){if(!$t(e)||bt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Rt(e)===n&&(n=n.ownerDocument.body),n}function Ju(e,t){const n=nt(e);if(Ci(e))return n;if(!$t(e)){let s=dn(e);for(;s&&!hr(s);){if(yt(s)&&!oo(s))return s;s=dn(s)}return n}let r=yl(e,t);for(;r&&Yy(r)&&oo(r);)r=yl(r,t);return r&&hr(r)&&oo(r)&&!Ba(r)?n:r||Jy(e)||n}const ub=async function(e){const t=this.getOffsetParent||Ju,n=this.getDimensions,r=await n(e.floating);return{reference:db(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function fb(e){return bt(e).direction==="rtl"}const pb={convertOffsetParentRelativeRectToViewportRelativeRect:nb,getDocumentElement:Rt,getClippingRect:cb,getOffsetParent:Ju,getElementRects:ub,getClientRects:rb,getDimensions:lb,getScale:Jn,isElement:yt,isRTL:fb};function ef(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function mb(e,t){let n=null,r;const s=Rt(e);function i(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),i();const d=e.getBoundingClientRect(),{left:f,top:u,width:y,height:m}=d;if(a||t(),!y||!m)return;const g=Cs(u),p=Cs(s.clientWidth-(f+y)),h=Cs(s.clientHeight-(u+m)),b=Cs(f),_={rootMargin:-g+"px "+-p+"px "+-h+"px "+-b+"px",threshold:tt(0,ln(1,l))||1};let x=!0;function S(T){const P=T[0].intersectionRatio;if(P!==l){if(!x)return o();P?o(!1,P):r=setTimeout(()=>{o(!1,1e-7)},1e3)}P===1&&!ef(d,e.getBoundingClientRect())&&o(),x=!1}try{n=new IntersectionObserver(S,{..._,root:s.ownerDocument})}catch{n=new IntersectionObserver(S,_)}n.observe(e)}return o(!0),i}function hb(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,d=Va(e),f=s||i?[...d?$r(d):[],...t?$r(t):[]]:[];f.forEach(b=>{s&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const u=d&&a?mb(d,n):null;let y=-1,m=null;o&&(m=new ResizeObserver(b=>{let[v]=b;v&&v.target===d&&m&&t&&(m.unobserve(t),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var _;(_=m)==null||_.observe(t)})),n()}),d&&!l&&m.observe(d),t&&m.observe(t));let g,p=l?Dn(e):null;l&&h();function h(){const b=Dn(e);p&&!ef(p,b)&&n(),p=b,g=requestAnimationFrame(h)}return n(),()=>{var b;f.forEach(v=>{s&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),u==null||u(),(b=m)==null||b.disconnect(),m=null,l&&cancelAnimationFrame(g)}}const gb=Ky,yb=qy,bb=Hy,vb=Zy,wb=zy,bl=Vy,_b=Gy,xb=(e,t,n)=>{const r=new Map,s={platform:pb,...n},i={...s.platform,_c:r};return $y(e,t,{...s,platform:i})};var Sb=typeof document<"u",Cb=function(){},Us=Sb?C.useLayoutEffect:Cb;function Js(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Js(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const i=s[r];if(!(i==="_owner"&&e.$$typeof)&&!Js(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function tf(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function vl(e,t){const n=tf(e);return Math.round(t*n)/n}function ao(e){const t=w.useRef(e);return Us(()=>{t.current=e}),t}function Eb(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:i,floating:o}={},transform:a=!0,whileElementsMounted:l,open:d}=e,[f,u]=w.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[y,m]=w.useState(r);Js(y,r)||m(r);const[g,p]=w.useState(null),[h,b]=w.useState(null),v=w.useCallback(D=>{D!==T.current&&(T.current=D,p(D))},[]),_=w.useCallback(D=>{D!==P.current&&(P.current=D,b(D))},[]),x=i||g,S=o||h,T=w.useRef(null),P=w.useRef(null),O=w.useRef(f),R=l!=null,M=ao(l),N=ao(s),j=ao(d),H=w.useCallback(()=>{if(!T.current||!P.current)return;const D={placement:t,strategy:n,middleware:y};N.current&&(D.platform=N.current),xb(T.current,P.current,D).then($=>{const W={...$,isPositioned:j.current!==!1};k.current&&!Js(O.current,W)&&(O.current=W,Cr.flushSync(()=>{u(W)}))})},[y,t,n,N,j]);Us(()=>{d===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,u(D=>({...D,isPositioned:!1})))},[d]);const k=w.useRef(!1);Us(()=>(k.current=!0,()=>{k.current=!1}),[]),Us(()=>{if(x&&(T.current=x),S&&(P.current=S),x&&S){if(M.current)return M.current(x,S,H);H()}},[x,S,H,M,R]);const B=w.useMemo(()=>({reference:T,floating:P,setReference:v,setFloating:_}),[v,_]),F=w.useMemo(()=>({reference:x,floating:S}),[x,S]),L=w.useMemo(()=>{const D={position:n,left:0,top:0};if(!F.floating)return D;const $=vl(F.floating,f.x),W=vl(F.floating,f.y);return a?{...D,transform:"translate("+$+"px, "+W+"px)",...tf(F.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:$,top:W}},[n,a,F.floating,f.x,f.y]);return w.useMemo(()=>({...f,update:H,refs:B,elements:F,floatingStyles:L}),[f,H,B,F,L])}const Tb=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?bl({element:r.current,padding:s}).fn(n):{}:r?bl({element:r,padding:s}).fn(n):{}}}},Pb=(e,t)=>{const n=gb(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ab=(e,t)=>{const n=yb(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ob=(e,t)=>({fn:_b(e).fn,options:[e,t]}),Nb=(e,t)=>{const n=bb(e);return{name:n.name,fn:n.fn,options:[e,t]}},kb=(e,t)=>{const n=vb(e);return{name:n.name,fn:n.fn,options:[e,t]}},Rb=(e,t)=>{const n=wb(e);return{name:n.name,fn:n.fn,options:[e,t]}},Lb=(e,t)=>{const n=Tb(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Db="Arrow",nf=w.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...i}=e;return c.jsx(pe.svg,{...i,ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:c.jsx("polygon",{points:"0,0 30,0 15,10"})})});nf.displayName=Db;var jb=nf;function Ib(e){const[t,n]=w.useState(void 0);return Ie(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const i=s[0];let o,a;if("borderBoxSize"in i){const l=i.borderBoxSize,d=Array.isArray(l)?l[0]:l;o=d.inlineSize,a=d.blockSize}else o=e.offsetWidth,a=e.offsetHeight;n({width:o,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var Ha="Popper",[rf,sf]=Bn(Ha),[Mb,of]=rf(Ha),af=e=>{const{__scopePopper:t,children:n}=e,[r,s]=w.useState(null),[i,o]=w.useState(void 0);return c.jsx(Mb,{scope:t,anchor:r,onAnchorChange:s,placementState:i,setPlacementState:o,children:n})};af.displayName=Ha;var cf="PopperAnchor",lf=w.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,i=of(cf,n),o=w.useRef(null),a=i.onAnchorChange,l=w.useCallback(g=>{o.current=g,g&&a(g)},[a]),d=Ne(t,l),f=w.useRef(null);w.useEffect(()=>{if(!r)return;const g=f.current;f.current=r.current,g!==f.current&&a(f.current)});const u=i.placementState&&Wa(i.placementState),y=u==null?void 0:u[0],m=u==null?void 0:u[1];return r?null:c.jsx(pe.div,{"data-radix-popper-side":y,"data-radix-popper-align":m,...s,ref:d})});lf.displayName=cf;var za="PopperContent",[Fb,Ub]=rf(za),df=w.forwardRef((e,t)=>{var ie,he,le,oe,U,we;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:i="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:d=[],collisionPadding:f=0,sticky:u="partial",hideWhenDetached:y=!1,updatePositionStrategy:m="optimized",onPlaced:g,...p}=e,h=of(za,n),[b,v]=w.useState(null),_=Ne(t,Ae=>v(Ae)),[x,S]=w.useState(null),T=Ib(x),P=(T==null?void 0:T.width)??0,O=(T==null?void 0:T.height)??0,R=r+(i!=="center"?"-"+i:""),M=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},N=Array.isArray(d)?d:[d],j=N.length>0,H={padding:M,boundary:N.filter($b),altBoundary:j},{refs:k,floatingStyles:B,placement:F,isPositioned:L,middlewareData:D}=Eb({strategy:"fixed",placement:R,whileElementsMounted:(...Ae)=>hb(...Ae,{animationFrame:m==="always"}),elements:{reference:h.anchor},middleware:[Pb({mainAxis:s+O,alignmentAxis:o}),l&&Ab({mainAxis:!0,crossAxis:!1,limiter:u==="partial"?Ob():void 0,...H}),l&&Nb({...H}),kb({...H,apply:({elements:Ae,rects:Ee,availableWidth:X,availableHeight:ke})=>{const{width:Ue,height:Qe}=Ee.reference,dt=Ae.floating.style;dt.setProperty("--radix-popper-available-width",`${X}px`),dt.setProperty("--radix-popper-available-height",`${ke}px`),dt.setProperty("--radix-popper-anchor-width",`${Ue}px`),dt.setProperty("--radix-popper-anchor-height",`${Qe}px`)}}),x&&Lb({element:x,padding:a}),Vb({arrowWidth:P,arrowHeight:O}),y&&Rb({strategy:"referenceHidden",...H,boundary:j?H.boundary:void 0})]}),$=h.setPlacementState;Ie(()=>($(F),()=>{$(void 0)}),[F,$]);const[W,I]=Wa(F),re=gt(g);Ie(()=>{L&&(re==null||re())},[L,re]);const J=(ie=D.arrow)==null?void 0:ie.x,ue=(he=D.arrow)==null?void 0:he.y,me=((le=D.arrow)==null?void 0:le.centerOffset)!==0,[z,q]=w.useState();return Ie(()=>{b&&q(window.getComputedStyle(b).zIndex)},[b]),c.jsx("div",{ref:k.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:L?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:z,"--radix-popper-transform-origin":[(oe=D.transformOrigin)==null?void 0:oe.x,(U=D.transformOrigin)==null?void 0:U.y].join(" "),...((we=D.hide)==null?void 0:we.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:c.jsx(Fb,{scope:n,placedSide:W,placedAlign:I,onArrowChange:S,arrowX:J,arrowY:ue,shouldHideArrow:me,children:c.jsx(pe.div,{"data-side":W,"data-align":I,...p,ref:_,style:{...p.style,animation:L?void 0:"none"}})})})});df.displayName=za;var uf="PopperArrow",Bb={top:"bottom",right:"left",bottom:"top",left:"right"},ff=w.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,i=Ub(uf,r),o=Bb[i.placedSide];return c.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:c.jsx(jb,{...s,ref:n,style:{...s.style,display:"block"}})})});ff.displayName=uf;function $b(e){return e!==null}var Vb=e=>({name:"transformOrigin",options:e,fn(t){var h,b,v;const{placement:n,rects:r,middlewareData:s}=t,o=((h=s.arrow)==null?void 0:h.centerOffset)!==0,a=o?0:e.arrowWidth,l=o?0:e.arrowHeight,[d,f]=Wa(n),u={start:"0%",center:"50%",end:"100%"}[f],y=(((b=s.arrow)==null?void 0:b.x)??0)+a/2,m=(((v=s.arrow)==null?void 0:v.y)??0)+l/2;let g="",p="";return d==="bottom"?(g=o?u:`${y}px`,p=`${-l}px`):d==="top"?(g=o?u:`${y}px`,p=`${r.floating.height+l}px`):d==="right"?(g=`${-l}px`,p=o?u:`${m}px`):d==="left"&&(g=`${r.floating.width+l}px`,p=o?u:`${m}px`),{data:{x:g,y:p}}}});function Wa(e){const[t,n="center"]=e.split("-");return[t,n]}var Hb=af,zb=lf,Wb=df,Kb=ff;function qb(e){const t=w.useRef({value:e,previous:e});return w.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var pf=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Gb="VisuallyHidden",Ka=w.forwardRef((e,t)=>c.jsx(pe.span,{...e,ref:t,style:{...pf,...e.style}}));Ka.displayName=Gb;var Zb=[" ","Enter","ArrowUp","ArrowDown"],Yb=[" ","Enter"],jn="Select",[Pi,Ai,Qb]=Ia(jn),[Vn]=Bn(jn,[Qb,sf]),Oi=sf(),[Xb,mn]=Vn(jn),[Jb,ev]=Vn(jn),tv="SelectProvider";function mf(e){const{__scopeSelect:t,children:n,open:r,defaultOpen:s,onOpenChange:i,value:o,defaultValue:a,onValueChange:l,dir:d,name:f,autoComplete:u,disabled:y,required:m,form:g,internal_do_not_use_render:p}=e,h=Oi(t),[b,v]=w.useState(null),[_,x]=w.useState(null),[S,T]=w.useState(!1),P=zu(d),[O,R]=Ln({prop:r,defaultProp:s??!1,onChange:i,caller:jn}),[M,N]=Ln({prop:o,defaultProp:a,onChange:l,caller:jn}),j=w.useRef(null),H=b?!!g||!!b.closest("form"):!0,[k,B]=w.useState(new Set),F=on(),L=Array.from(k).map(I=>I.props.value).join(";"),D=w.useCallback(I=>{B(re=>new Set(re).add(I))},[]),$=w.useCallback(I=>{B(re=>{const J=new Set(re);return J.delete(I),J})},[]),W={required:m,trigger:b,onTriggerChange:v,valueNode:_,onValueNodeChange:x,valueNodeHasChildren:S,onValueNodeHasChildrenChange:T,contentId:F,value:M,onValueChange:N,open:O,onOpenChange:R,dir:P,triggerPointerDownPosRef:j,disabled:y,name:f,autoComplete:u,form:g,nativeOptions:k,nativeSelectKey:L,isFormControl:H};return c.jsx(Hb,{...h,children:c.jsx(Xb,{scope:t,...W,children:c.jsx(Pi.Provider,{scope:t,children:c.jsx(Jb,{scope:t,onNativeOptionAdd:D,onNativeOptionRemove:$,children:gv(p)?p(W):n})})})})}mf.displayName=tv;var hf=e=>{const{__scopeSelect:t,children:n,...r}=e;return c.jsx(mf,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:s})=>c.jsxs(c.Fragment,{children:[n,s?c.jsx(If,{__scopeSelect:t}):null]})})};hf.displayName=jn;var gf="SelectTrigger",qa=w.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...s}=e,i=Oi(n),o=mn(gf,n),a=o.disabled||r,l=Ne(t,o.onTriggerChange),d=Ai(n),f=w.useRef("touch"),[u,y,m]=Mf(p=>{const h=d().filter(_=>!_.disabled),b=h.find(_=>_.value===o.value),v=Ff(h,p,b);v!==void 0&&o.onValueChange(v.value)}),g=p=>{a||(o.onOpenChange(!0),m()),p&&(o.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return c.jsx(zb,{asChild:!0,...i,children:c.jsx(pe.button,{type:"button",role:"combobox","aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":Ni(o.value)?"":void 0,...s,ref:l,onClick:fe(s.onClick,p=>{p.currentTarget.focus(),f.current!=="mouse"&&g(p)}),onPointerDown:fe(s.onPointerDown,p=>{f.current=p.pointerType;const h=p.target;h.hasPointerCapture(p.pointerId)&&h.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(g(p),p.preventDefault())}),onKeyDown:fe(s.onKeyDown,p=>{const h=u.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&y(p.key),!(h&&p.key===" ")&&Zb.includes(p.key)&&(g(),p.preventDefault())})})})});qa.displayName=gf;var yf="SelectValue",bf=w.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,children:i,placeholder:o="",...a}=e,l=mn(yf,n),{onValueNodeHasChildrenChange:d}=l,f=i!==void 0,u=Ne(t,l.onValueNodeChange);Ie(()=>{d(f)},[d,f]);const y=Ni(l.value);return c.jsx(pe.span,{...a,asChild:y?!1:a.asChild,ref:u,style:{pointerEvents:"none"},children:c.jsx(w.Fragment,{children:y?o:i},y?"placeholder":"value")})});bf.displayName=yf;var nv="SelectIcon",vf=w.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...s}=e;return c.jsx(pe.span,{"aria-hidden":!0,...s,ref:t,children:r||"▼"})});vf.displayName=nv;var wf="SelectPortal",[rv,sv]=Vn(wf,{forceMount:void 0}),_f=e=>{const{__scopeSelect:t,forceMount:n,...r}=e;return c.jsx(rv,{scope:e.__scopeSelect,forceMount:n,children:c.jsx(wi,{asChild:!0,...r})})};_f.displayName=wf;var un="SelectContent",Ga=w.forwardRef((e,t)=>{const n=sv(un,e.__scopeSelect),{forceMount:r=n.forceMount,...s}=e,i=mn(un,e.__scopeSelect),[o,a]=w.useState();return Ie(()=>{a(new DocumentFragment)},[]),c.jsx($n,{present:r||i.open,children:({present:l})=>l?c.jsx(Cf,{...s,ref:t}):c.jsx(xf,{...s,fragment:o})})});Ga.displayName=un;var xf=w.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,fragment:s}=e;return s?Cr.createPortal(c.jsx(Sf,{scope:n,children:c.jsx(Pi.Slot,{scope:n,children:c.jsx("div",{ref:t,children:r})})}),s):null});xf.displayName="SelectContentFragment";var ft=10,[Sf,hn]=Vn(un),iv="SelectContentImpl",ov=pr("SelectContent.RemoveScroll"),Cf=w.forwardRef((e,t)=>{const{__scopeSelect:n}=e,{position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:i,onPointerDownOutside:o,side:a,sideOffset:l,align:d,alignOffset:f,arrowPadding:u,collisionBoundary:y,collisionPadding:m,sticky:g,hideWhenDetached:p,avoidCollisions:h,...b}=e,v=mn(un,n),[_,x]=w.useState(null),[S,T]=w.useState(null),P=Ne(t,q=>x(q)),[O,R]=w.useState(null),[M,N]=w.useState(null),j=Ai(n),[H,k]=w.useState(!1),B=w.useRef(!1);w.useEffect(()=>{if(_)return Au(_)},[_]),vu();const F=w.useCallback(q=>{const[ie,...he]=j().map(U=>U.ref.current),[le]=he.slice(-1),oe=document.activeElement;for(const U of q)if(U===oe||(U==null||U.scrollIntoView({block:"nearest"}),U===ie&&S&&(S.scrollTop=0),U===le&&S&&(S.scrollTop=S.scrollHeight),U==null||U.focus(),document.activeElement!==oe))return},[j,S]),L=w.useCallback(()=>F([O,_]),[F,O,_]);w.useEffect(()=>{H&&L()},[H,L]);const{onOpenChange:D,triggerPointerDownPosRef:$}=v;w.useEffect(()=>{if(_){let q={x:0,y:0};const ie=le=>{var oe,U;q={x:Math.abs(Math.round(le.pageX)-(((oe=$.current)==null?void 0:oe.x)??0)),y:Math.abs(Math.round(le.pageY)-(((U=$.current)==null?void 0:U.y)??0))}},he=le=>{q.x<=10&&q.y<=10?le.preventDefault():le.composedPath().includes(_)||D(!1),document.removeEventListener("pointermove",ie),$.current=null};return $.current!==null&&(document.addEventListener("pointermove",ie),document.addEventListener("pointerup",he,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ie),document.removeEventListener("pointerup",he,{capture:!0})}}},[_,D,$]),w.useEffect(()=>{const q=()=>D(!1);return window.addEventListener("blur",q),window.addEventListener("resize",q),()=>{window.removeEventListener("blur",q),window.removeEventListener("resize",q)}},[D]);const[W,I]=Mf(q=>{const ie=j().filter(oe=>!oe.disabled),he=ie.find(oe=>oe.ref.current===document.activeElement),le=Ff(ie,q,he);le&&setTimeout(()=>{var oe;return(oe=le.ref.current)==null?void 0:oe.focus()})}),re=w.useCallback((q,ie,he)=>{const le=!B.current&&!he;(v.value!==void 0&&v.value===ie||le)&&(R(q),le&&(B.current=!0))},[v.value]),J=w.useCallback(()=>_==null?void 0:_.focus(),[_]),ue=w.useCallback((q,ie,he)=>{const le=!B.current&&!he;(v.value!==void 0&&v.value===ie||le)&&N(q)},[v.value]),me=r==="popper"?jo:Ef,z=me===jo?{side:a,sideOffset:l,align:d,alignOffset:f,arrowPadding:u,collisionBoundary:y,collisionPadding:m,sticky:g,hideWhenDetached:p,avoidCollisions:h}:{};return c.jsx(Sf,{scope:n,content:_,viewport:S,onViewportChange:T,itemRefCallback:re,selectedItem:O,onItemLeave:J,itemTextRefCallback:ue,focusSelectedItem:L,selectedItemText:M,position:r,isPositioned:H,searchRef:W,children:c.jsx(Oa,{as:ov,allowPinchZoom:!0,children:c.jsx(Aa,{asChild:!0,trapped:v.open,onMountAutoFocus:q=>{q.preventDefault()},onUnmountAutoFocus:fe(s,q=>{var ie;(ie=v.trigger)==null||ie.focus({preventScroll:!0}),q.preventDefault()}),children:c.jsx(vi,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:q=>q.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:c.jsx(me,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:q=>q.preventDefault(),...b,...z,onPlaced:()=>k(!0),ref:P,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:fe(b.onKeyDown,q=>{const ie=q.ctrlKey||q.altKey||q.metaKey;if(q.key==="Tab"&&q.preventDefault(),!ie&&q.key.length===1&&I(q.key),["ArrowUp","ArrowDown","Home","End"].includes(q.key)){let le=j().filter(oe=>!oe.disabled).map(oe=>oe.ref.current);if(["ArrowUp","End"].includes(q.key)&&(le=le.slice().reverse()),["ArrowUp","ArrowDown"].includes(q.key)){const oe=q.target,U=le.indexOf(oe);le=le.slice(U+1)}setTimeout(()=>F(le)),q.preventDefault()}})})})})})})});Cf.displayName=iv;var av="SelectItemAlignedPosition",Ef=w.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...s}=e,i=mn(un,n),o=hn(un,n),[a,l]=w.useState(null),[d,f]=w.useState(null),u=Ne(t,P=>f(P)),y=Ai(n),m=w.useRef(!1),g=w.useRef(!0),{viewport:p,selectedItem:h,selectedItemText:b,focusSelectedItem:v}=o,_=w.useCallback(()=>{if(i.trigger&&i.valueNode&&a&&d&&p&&h&&b){const P=i.trigger.getBoundingClientRect(),O=d.getBoundingClientRect(),R=i.valueNode.getBoundingClientRect(),M=b.getBoundingClientRect();if(i.dir!=="rtl"){const oe=M.left-O.left,U=R.left-oe,we=P.left-U,Ae=P.width+we,Ee=Math.max(Ae,O.width),X=window.innerWidth-ft,ke=cl(U,[ft,Math.max(ft,X-Ee)]);a.style.minWidth=Ae+"px",a.style.left=ke+"px"}else{const oe=O.right-M.right,U=window.innerWidth-R.right-oe,we=window.innerWidth-P.right-U,Ae=P.width+we,Ee=Math.max(Ae,O.width),X=window.innerWidth-ft,ke=cl(U,[ft,Math.max(ft,X-Ee)]);a.style.minWidth=Ae+"px",a.style.right=ke+"px"}const N=y(),j=window.innerHeight-ft*2,H=p.scrollHeight,k=window.getComputedStyle(d),B=parseInt(k.borderTopWidth,10),F=parseInt(k.paddingTop,10),L=parseInt(k.borderBottomWidth,10),D=parseInt(k.paddingBottom,10),$=B+F+H+D+L,W=Math.min(h.offsetHeight*5,$),I=window.getComputedStyle(p),re=parseInt(I.paddingTop,10),J=parseInt(I.paddingBottom,10),ue=P.top+P.height/2-ft,me=j-ue,z=h.offsetHeight/2,q=h.offsetTop+z,ie=B+F+q,he=$-ie;if(ie<=ue){const oe=N.length>0&&h===N[N.length-1].ref.current;a.style.bottom="0px";const U=d.clientHeight-p.offsetTop-p.offsetHeight,we=Math.max(me,z+(oe?J:0)+U+L),Ae=ie+we;a.style.height=Ae+"px"}else{const oe=N.length>0&&h===N[0].ref.current;a.style.top="0px";const we=Math.max(ue,B+p.offsetTop+(oe?re:0)+z)+he;a.style.height=we+"px",p.scrollTop=ie-ue+p.offsetTop}a.style.margin=`${ft}px 0`,a.style.minHeight=W+"px",a.style.maxHeight=j+"px",r==null||r(),requestAnimationFrame(()=>m.current=!0)}},[y,i.trigger,i.valueNode,a,d,p,h,b,i.dir,r]);Ie(()=>_(),[_]);const[x,S]=w.useState();Ie(()=>{d&&S(window.getComputedStyle(d).zIndex)},[d]);const T=w.useCallback(P=>{P&&g.current===!0&&(_(),v==null||v(),g.current=!1)},[_,v]);return c.jsx(lv,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:m,onScrollButtonChange:T,children:c.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:x},children:c.jsx(pe.div,{...s,ref:u,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});Ef.displayName=av;var cv="SelectPopperPosition",jo=w.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=ft,...i}=e,o=Oi(n);return c.jsx(Wb,{...o,...i,ref:t,align:r,collisionPadding:s,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});jo.displayName=cv;var[lv,Za]=Vn(un,{}),Io="SelectViewport",Tf=w.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...s}=e,i=hn(Io,n),o=Za(Io,n),a=Ne(t,i.onViewportChange),l=w.useRef(0);return c.jsxs(c.Fragment,{children:[c.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),c.jsx(Pi.Slot,{scope:n,children:c.jsx(pe.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:fe(s.onScroll,d=>{const f=d.currentTarget,{contentWrapper:u,shouldExpandOnScrollRef:y}=o;if(y!=null&&y.current&&u){const m=Math.abs(l.current-f.scrollTop);if(m>0){const g=window.innerHeight-ft*2,p=parseFloat(u.style.minHeight),h=parseFloat(u.style.height),b=Math.max(p,h);if(b<g){const v=b+m,_=Math.min(g,v),x=v-_;u.style.height=_+"px",u.style.bottom==="0px"&&(f.scrollTop=x>0?x:0,u.style.justifyContent="flex-end")}}}l.current=f.scrollTop})})})]})});Tf.displayName=Io;var Pf="SelectGroup",[dv,uv]=Vn(Pf),fv=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=on();return c.jsx(dv,{scope:n,id:s,children:c.jsx(pe.div,{role:"group","aria-labelledby":s,...r,ref:t})})});fv.displayName=Pf;var Af="SelectLabel",Ya=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=uv(Af,n);return c.jsx(pe.div,{id:s.id,...r,ref:t})});Ya.displayName=Af;var ei="SelectItem",[pv,Of]=Vn(ei),Qa=w.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:i,...o}=e,a=mn(ei,n),l=hn(ei,n),d=a.value===r,[f,u]=w.useState(i??""),[y,m]=w.useState(!1),g=Ne(t,v=>{var _;return(_=l.itemRefCallback)==null?void 0:_.call(l,v,r,s)}),p=on(),h=w.useRef("touch"),b=()=>{s||(a.onValueChange(r),a.onOpenChange(!1))};return c.jsx(pv,{scope:n,value:r,disabled:s,textId:p,isSelected:d,onItemTextChange:w.useCallback(v=>{u(_=>_||((v==null?void 0:v.textContent)??"").trim())},[]),children:c.jsx(Pi.ItemSlot,{scope:n,value:r,disabled:s,textValue:f,children:c.jsx(pe.div,{role:"option","aria-labelledby":p,"data-highlighted":y?"":void 0,"aria-selected":d&&y,"data-state":d?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...o,ref:g,onFocus:fe(o.onFocus,()=>m(!0)),onBlur:fe(o.onBlur,()=>m(!1)),onClick:fe(o.onClick,()=>{h.current!=="mouse"&&b()}),onPointerUp:fe(o.onPointerUp,()=>{h.current==="mouse"&&b()}),onPointerDown:fe(o.onPointerDown,v=>{h.current=v.pointerType}),onPointerMove:fe(o.onPointerMove,v=>{var _;h.current=v.pointerType,s?(_=l.onItemLeave)==null||_.call(l):h.current==="mouse"&&v.currentTarget.focus({preventScroll:!0})}),onPointerLeave:fe(o.onPointerLeave,v=>{var _;v.currentTarget===document.activeElement&&((_=l.onItemLeave)==null||_.call(l))}),onKeyDown:fe(o.onKeyDown,v=>{var x;((x=l.searchRef)==null?void 0:x.current)!==""&&v.key===" "||(Yb.includes(v.key)&&b(),v.key===" "&&v.preventDefault())})})})})});Qa.displayName=ei;var Mr="SelectItemText",Nf=w.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,...i}=e,o=mn(Mr,n),a=hn(Mr,n),l=Of(Mr,n),d=ev(Mr,n),[f,u]=w.useState(null),y=Ne(t,b=>u(b),l.onItemTextChange,b=>{var v;return(v=a.itemTextRefCallback)==null?void 0:v.call(a,b,l.value,l.disabled)}),m=f==null?void 0:f.textContent,g=w.useMemo(()=>c.jsx("option",{value:l.value,disabled:l.disabled,children:m},l.value),[l.disabled,l.value,m]),{onNativeOptionAdd:p,onNativeOptionRemove:h}=d;return Ie(()=>(p(g),()=>h(g)),[p,h,g]),c.jsxs(c.Fragment,{children:[c.jsx(pe.span,{id:l.textId,...i,ref:y}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!Ni(o.value)?Cr.createPortal(i.children,o.valueNode):null]})});Nf.displayName=Mr;var kf="SelectItemIndicator",Rf=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return Of(kf,n).isSelected?c.jsx(pe.span,{"aria-hidden":!0,...r,ref:t}):null});Rf.displayName=kf;var Mo="SelectScrollUpButton",Xa=w.forwardRef((e,t)=>{const n=hn(Mo,e.__scopeSelect),r=Za(Mo,e.__scopeSelect),[s,i]=w.useState(!1),o=Ne(t,r.onScrollButtonChange);return Ie(()=>{if(n.viewport&&n.isPositioned){let a=function(){const d=l.scrollTop>0;i(d)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),s?c.jsx(Lf,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});Xa.displayName=Mo;var Fo="SelectScrollDownButton",Ja=w.forwardRef((e,t)=>{const n=hn(Fo,e.__scopeSelect),r=Za(Fo,e.__scopeSelect),[s,i]=w.useState(!1),o=Ne(t,r.onScrollButtonChange);return Ie(()=>{if(n.viewport&&n.isPositioned){let a=function(){const d=l.scrollHeight-l.clientHeight,f=Math.ceil(l.scrollTop)<d;i(f)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),s?c.jsx(Lf,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});Ja.displayName=Fo;var Lf=w.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=e,i=hn("SelectScrollButton",n),o=w.useRef(null),a=Ai(n),l=w.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return w.useEffect(()=>()=>l(),[l]),Ie(()=>{var f;const d=a().find(u=>u.ref.current===document.activeElement);(f=d==null?void 0:d.ref.current)==null||f.scrollIntoView({block:"nearest"})},[a]),c.jsx(pe.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:fe(s.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:fe(s.onPointerMove,()=>{var d;(d=i.onItemLeave)==null||d.call(i),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:fe(s.onPointerLeave,()=>{l()})})}),mv="SelectSeparator",ec=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return c.jsx(pe.div,{"aria-hidden":!0,...r,ref:t})});ec.displayName=mv;var Df="SelectArrow",hv=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=Oi(n);return hn(Df,n).position==="popper"?c.jsx(Kb,{...s,...r,ref:t}):null});hv.displayName=Df;var jf="SelectBubbleInput",If=w.forwardRef(({__scopeSelect:e,...t},n)=>{const r=mn(jf,e),{value:s,onValueChange:i,required:o,disabled:a,name:l,autoComplete:d,form:f}=r,{nativeOptions:u,nativeSelectKey:y}=r,m=w.useRef(null),g=Ne(n,m),p=s??"",h=qb(p),b=Array.from(u).some(v=>(v.props.value??"")==="");return w.useEffect(()=>{const v=m.current;if(!v)return;const _=window.HTMLSelectElement.prototype,S=Object.getOwnPropertyDescriptor(_,"value").set;if(h!==p&&S){const T=new Event("change",{bubbles:!0});S.call(v,p),v.dispatchEvent(T)}},[h,p]),c.jsxs(pe.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:l,autoComplete:d,disabled:a,form:f,onChange:v=>i(v.target.value),...t,style:{...pf,...t.style},ref:g,defaultValue:p,children:[Ni(s)&&!b?c.jsx("option",{value:""}):null,Array.from(u)]},y)});If.displayName=jf;function gv(e){return typeof e=="function"}function Ni(e){return e===""||e===void 0}function Mf(e){const t=gt(e),n=w.useRef(""),r=w.useRef(0),s=w.useCallback(o=>{const a=n.current+o;t(a),(function l(d){n.current=d,window.clearTimeout(r.current),d!==""&&(r.current=window.setTimeout(()=>l(""),1e3))})(a)},[t]),i=w.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return w.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,i]}function Ff(e,t,n){const s=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let o=yv(e,Math.max(i,0));s.length===1&&(o=o.filter(d=>d!==n));const l=o.find(d=>d.textValue.toLowerCase().startsWith(s.toLowerCase()));return l!==n?l:void 0}function yv(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function ki(e,t){if(e==null)return{};var n={},r=Object.keys(e),s,i;for(i=0;i<r.length;i++)s=r[i],!(t.indexOf(s)>=0)&&(n[s]=e[s]);return n}var bv=["color"],vv=C.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=ki(e,bv);return C.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:t}),C.createElement("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),wv=["color"],tc=C.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=ki(e,wv);return C.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:t}),C.createElement("path",{d:"M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),_v=["color"],xv=C.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=ki(e,_v);return C.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:t}),C.createElement("path",{d:"M3.13523 8.84197C3.3241 9.04343 3.64052 9.05363 3.84197 8.86477L7.5 5.43536L11.158 8.86477C11.3595 9.05363 11.6759 9.04343 11.8648 8.84197C12.0536 8.64051 12.0434 8.32409 11.842 8.13523L7.84197 4.38523C7.64964 4.20492 7.35036 4.20492 7.15803 4.38523L3.15803 8.13523C2.95657 8.32409 2.94637 8.64051 3.13523 8.84197Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),Sv=["color"],Cv=C.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=ki(e,Sv);return C.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:t}),C.createElement("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))});const ti=hf,ni=bf,Vr=w.forwardRef(({className:e,children:t,...n},r)=>c.jsxs(qa,{ref:r,className:Ce("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[placeholder]:text-muted-foreground [&>span]:line-clamp-1",e),...n,children:[t,c.jsx(vf,{asChild:!0,children:c.jsx(tc,{className:"h-4 w-4 opacity-50"})})]}));Vr.displayName=qa.displayName;const Uf=w.forwardRef(({className:e,...t},n)=>c.jsx(Xa,{ref:n,className:Ce("flex cursor-default items-center justify-center py-1",e),...t,children:c.jsx(xv,{className:"h-4 w-4"})}));Uf.displayName=Xa.displayName;const Bf=w.forwardRef(({className:e,...t},n)=>c.jsx(Ja,{ref:n,className:Ce("flex cursor-default items-center justify-center py-1",e),...t,children:c.jsx(tc,{className:"h-4 w-4"})}));Bf.displayName=Ja.displayName;const Hr=w.forwardRef(({className:e,children:t,position:n="popper",...r},s)=>c.jsx(_f,{children:c.jsxs(Ga,{ref:s,className:Ce("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] origin-[--radix-select-content-transform-origin] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[c.jsx(Uf,{}),c.jsx(Tf,{className:Ce("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),c.jsx(Bf,{})]})}));Hr.displayName=Ga.displayName;const Ev=w.forwardRef(({className:e,...t},n)=>c.jsx(Ya,{ref:n,className:Ce("px-2 py-1.5 text-sm font-semibold",e),...t}));Ev.displayName=Ya.displayName;const zr=w.forwardRef(({className:e,children:t,...n},r)=>c.jsxs(Qa,{ref:r,className:Ce("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[c.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:c.jsx(Rf,{children:c.jsx(vv,{className:"h-4 w-4"})})}),c.jsx(Nf,{children:t})]}));zr.displayName=Qa.displayName;const Tv=w.forwardRef(({className:e,...t},n)=>c.jsx(ec,{ref:n,className:Ce("-mx-1 my-1 h-px bg-muted",e),...t}));Tv.displayName=ec.displayName;function $f({open:e,isAccountsLoading:t,accountOptions:n,onConfirm:r,backUrl:s,createAccountUrl:i}){var u;const[o,a]=C.useState(""),l=o||((u=n[0])==null?void 0:u.login)||"",d=!t&&n.length>0&&l!=="",f=!t&&n.length===0;return c.jsx(Py,{open:e,children:c.jsxs(Uu,{className:"web-trading-widget-account-modal",onPointerDownOutside:y=>y.preventDefault(),onEscapeKeyDown:y=>y.preventDefault(),children:[c.jsxs(Bu,{children:[c.jsx(Vu,{children:"Select trading account"}),c.jsx(Hu,{children:"Choose an account to continue trading on the chart."})]}),t?c.jsx("p",{className:"web-trading-widget-account-modal__loading",children:"Loading accounts…"}):n.length===0?c.jsx("p",{className:"web-trading-widget-account-modal__error",children:"No trading accounts available."}):c.jsxs(ti,{value:l,onValueChange:a,children:[c.jsx(Vr,{className:"web-trading-widget-account-modal__select",children:c.jsx(ni,{placeholder:"Select account"})}),c.jsx(Hr,{children:n.map(y=>c.jsxs(zr,{value:y.login,children:[y.label," (",y.balance.toFixed(2)," ",y.currency,")"]},y.login))})]}),c.jsx($u,{children:f?c.jsxs(c.Fragment,{children:[s?c.jsx(ot,{asChild:!0,variant:"outline",children:c.jsx("a",{href:s,children:"Just back"})}):null,i?c.jsx(ot,{asChild:!0,children:c.jsx("a",{href:i,children:"Create account"})}):null]}):c.jsx(ot,{type:"button",disabled:!d,onClick:()=>r(l),children:"Continue"})})]})})}var Pv={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const Av=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),at=(e,t)=>{const n=C.forwardRef(({color:r="currentColor",size:s=24,strokeWidth:i=2,absoluteStrokeWidth:o,children:a,...l},d)=>C.createElement("svg",{ref:d,...Pv,width:s,height:s,stroke:r,strokeWidth:o?Number(i)*24/Number(s):i,className:`lucide lucide-${Av(e)}`,...l},[...t.map(([f,u])=>C.createElement(f,u)),...(Array.isArray(a)?a:[a])||[]]));return n.displayName=`${e}`,n},ri=at("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),Ov=at("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),Nv=at("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),Uo=at("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),Vf=at("GripHorizontal",[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]]),Hf=at("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]),kv=at("ListOrdered",[["line",{x1:"10",x2:"21",y1:"6",y2:"6",key:"76qw6h"}],["line",{x1:"10",x2:"21",y1:"12",y2:"12",key:"16nom4"}],["line",{x1:"10",x2:"21",y1:"18",y2:"18",key:"u3jurt"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]),Rv=at("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]),Lv=at("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]),Dv=at("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),jv=at("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),gn=at("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function Iv(e){const t=Math.round(Math.log10(e));return Number.isFinite(t)&&t>0?t:5}function nc(e){const t=Ye(e).toUpperCase();if(t)return Bt.find(n=>{var r,s;return((r=n.resolve_symbol)==null?void 0:r.toUpperCase())===t||((s=n.display_name)==null?void 0:s.toUpperCase())===t||n.ticker.replace(/_/g,"").toUpperCase()===t})}function Mv(e){const t=nc(e);return t!=null&&t.pricescale?Iv(t.pricescale):5}function zf(e,t){if(t)for(const r of["digits","Digits"]){const s=t[r];if(s!=null&&s!==""){const i=Number(s);if(Number.isFinite(i))return Math.round(i)}}const n=Ye(e).toUpperCase();return n.includes("XAU")||n.includes("GOLD")?2:n.includes("JPY")?3:5}function Fv(e){const t=nc(e);switch(t==null?void 0:t.type){case"commodity":return 100;case"crypto":case"indices":case"stock":return 1;case"forex":default:return 1e5}}const rc="USD";function rs(e){return Ye(e).toUpperCase()}function Ri(e){const t=rs(e);return t.length>=6?t.slice(3):rc}function sc(e){if(e!==rc&&e==="JPY")return"USDJPY"}function Uv(e,t,n,r,s){const i=Ri(e),o=sc(i);if(!o)return;if(rs(e)===o){const d=t==="buy"?n:r;return d>0?d:void 0}const a=s[o];if(!a)return;const l=(a.bid+a.ask)/2;return l>0?l:void 0}function Bv(e,t,n,r,s,i,o={}){const a=e==="buy"?n:r;let d=(e==="buy"?a-t:t-a)*s*Fv(i);const f=Ri(i),u=Uv(i,e,n,r,o);if(u!==void 0)d/=u;else if(f!==rc)return null;return Math.round(d*100)/100}function $v(e){const t=new Set;for(const n of e){const r=sc(Ri(n));r&&rs(n)!==r&&t.add(r)}return[...t]}function Vv(e,t){const n=rs(e);if(n===t)return!0;const r=sc(Ri(e));return r===t&&n!==r}function Hv(e,t,n,r,s){if(!Vv(e.symbol,t))return e;const i=rs(e.symbol)===t,o=i?n:e.marketBid??e.currentPrice,a=i?r:e.marketAsk??e.currentPrice,l=e.type==="buy"?o:a,d=Bv(e.type,e.openPrice,o,a,e.volumeLots,e.symbol,s);return{...e,currentPrice:l,marketBid:o,marketAsk:a,profit:d??e.profit}}function Ye(e){const t=e.trim();return t?t.replace(/m$/i,""):""}function Li(e){return Ye(e)||"—"}const Ge={BUY:0,SELL:1,BUY_LIMIT:2,SELL_LIMIT:3,BUY_STOP:4,SELL_STOP:5,BUY_STOP_LIMIT:6,SELL_STOP_LIMIT:7},si=[{mode:"market",label:"Market Execution",orderType:null,isMarket:!0},{mode:"buy_limit",label:"Buy Limit",orderType:Ge.BUY_LIMIT,isMarket:!1},{mode:"sell_limit",label:"Sell Limit",orderType:Ge.SELL_LIMIT,isMarket:!1},{mode:"buy_stop",label:"Buy Stop",orderType:Ge.BUY_STOP,isMarket:!1},{mode:"sell_stop",label:"Sell Stop",orderType:Ge.SELL_STOP,isMarket:!1},{mode:"buy_stop_limit",label:"Buy Stop Limit",orderType:Ge.BUY_STOP_LIMIT,isMarket:!1},{mode:"sell_stop_limit",label:"Sell Stop Limit",orderType:Ge.SELL_STOP_LIMIT,isMarket:!1}];function Di(e){return si.find(t=>t.mode===e)??si[0]}function ji(e){return Di(e).isMarket}function Bo(e,t){const n=Di(e);return n.orderType!==null?n.orderType:t==="buy"?Ge.BUY:Ge.SELL}function ii(e){return e%2===1?"sell":"buy"}function ic(e){return e>=Ge.BUY_LIMIT&&e<=Ge.SELL_STOP_LIMIT}function oc(e){return e===Ge.BUY_STOP_LIMIT||e===Ge.SELL_STOP_LIMIT}function Wf(e){return e==="buy_stop_limit"||e==="sell_stop_limit"}const mt={GTC:0,TODAY:1,SPECIFIED:2,SPECIFIED_DAY:3},Kf=[{value:mt.GTC,label:"GTC"},{value:mt.TODAY,label:"Today"},{value:mt.SPECIFIED,label:"Specified"},{value:mt.SPECIFIED_DAY,label:"Specified Day"}];function ac(e){return e===mt.SPECIFIED}function cc(e){return e===mt.SPECIFIED_DAY}function zv(e){return e.map(t=>({login:t.login,label:t.label,balance:t.tradeStat.balance,currency:t.currency}))}function Wv(){if(typeof window>"u")return null;const e=localStorage.getItem(lu);return(e==null?void 0:e.trim())||null}function wl(e){if(typeof window>"u")return;const t=e.trim();t&&localStorage.setItem(lu,t)}function Kv(e,t){var n;return t&&e.some(r=>r.login===t)?t:((n=e[0])==null?void 0:n.login)??""}function lc(e,t=Bt){return t.find(n=>n.ticker===e)}function qv(e,t=Bt){var s;const n=Ye(e).toUpperCase();if(!n)return null;const r=t.find(i=>{var o;return Ye(i.resolve_symbol??"").toUpperCase()===n||((o=i.display_name)==null?void 0:o.toUpperCase())===n||i.ticker.replace(/_/g,"").toUpperCase()===n||i.ticker.toUpperCase()===n});return r?r.ticker:((s=nc(e))==null?void 0:s.ticker)??null}function qf(e,t=Bt){const n=lc(e,t),r=(n==null?void 0:n.resolve_symbol)??e.replace(/_/g,"");return Ye(r).toUpperCase()}function Ii(e,t=Bt){const n=lc(e,t);return n!=null&&n.resolve_symbol?n.resolve_symbol:e.replace(/_/g,"")}function Vt(e){const t=Math.round(Math.log10(e));return String(Number.isFinite(t)&&t>0?t:5)}function Ht(e,t=Bt){const n=lc(e,t);return(n==null?void 0:n.pricescale)??1e5}function Pe(e,t){return e.toFixed(t)}function Pr(e){return 1/10**e}function Gf(e,t){return e===null||t===null?null:(e+t)/2}function ht(e){const t=e.trim();if(!t)return;const n=Number(t);if(!(!Number.isFinite(n)||n<=0))return n}function Zf(e,t,n){if(ac(e)){if(!t.trim())return;const r=Date.parse(t);return Number.isFinite(r)?Math.floor(r/1e3):void 0}if(cc(e)){if(!n.trim())return;const r=Date.parse(`${n}T23:59:59`);return Number.isFinite(r)?Math.floor(r/1e3):void 0}}function Mi(e,t,n){return e===mt.GTC||e===mt.TODAY?!0:Zf(e,t,n)!==void 0}const Gv={},_l=e=>{let t;const n=new Set,r=(f,u)=>{const y=typeof f=="function"?f(t):f;if(!Object.is(y,t)){const m=t;t=u??(typeof y!="object"||y===null)?y:Object.assign({},t,y),n.forEach(g=>g(t,m))}},s=()=>t,l={setState:r,getState:s,getInitialState:()=>d,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(Gv?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},d=t=e(r,s,l);return l},Zv=e=>e?_l(e):_l;function Yv(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Es={exports:{}},co={},Ts={exports:{}},lo={};/**
|
|
41
|
+
`)},vy=0,zn=[];function wy(e){var t=w.useRef([]),n=w.useRef([0,0]),r=w.useRef(),s=w.useState(vy++)[0],i=w.useState(Au)[0],o=w.useRef(e);w.useEffect(function(){o.current=e},[e]),w.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var m=$g([e.lockRef.current],(e.shards||[]).map(dl),!0).filter(Boolean);return m.forEach(function(h){return h.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),m.forEach(function(h){return h.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var a=w.useCallback(function(m,h){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!o.current.allowPinchZoom;var b=Es(m),v=n.current,_="deltaX"in m?m.deltaX:v[0]-b[0],x="deltaY"in m?m.deltaY:v[1]-b[1],S,T=m.target,P=Math.abs(_)>Math.abs(x)?"h":"v";if("touches"in m&&P==="h"&&T.type==="range")return!1;var A=window.getSelection(),D=A&&A.anchorNode,I=D?D===T||D.contains(T):!1;if(I)return!1;var N=cl(P,T);if(!N)return!0;if(N?S=P:(S=P==="v"?"h":"v",N=cl(P,T)),!N)return!1;if(!r.current&&"changedTouches"in m&&(_||x)&&(r.current=S),!S)return!0;var L=r.current||S;return gy(L,h,m,L==="h"?_:x)},[]),l=w.useCallback(function(m){var h=m;if(!(!zn.length||zn[zn.length-1]!==i)){var b="deltaY"in h?ll(h):Es(h),v=t.current.filter(function(S){return S.name===h.type&&(S.target===h.target||h.target===S.shadowParent)&&yy(S.delta,b)})[0];if(v&&v.should){h.cancelable&&h.preventDefault();return}if(!v){var _=(o.current.shards||[]).map(dl).filter(Boolean).filter(function(S){return S.contains(h.target)}),x=_.length>0?a(h,_[0]):!o.current.noIsolation;x&&h.cancelable&&h.preventDefault()}}},[]),d=w.useCallback(function(m,h,b,v){var _={name:m,delta:h,target:b,should:v,shadowParent:_y(b)};t.current.push(_),setTimeout(function(){t.current=t.current.filter(function(x){return x!==_})},1)},[]),f=w.useCallback(function(m){n.current=Es(m),r.current=void 0},[]),u=w.useCallback(function(m){d(m.type,ll(m),m.target,a(m,e.lockRef.current))},[]),g=w.useCallback(function(m){d(m.type,Es(m),m.target,a(m,e.lockRef.current))},[]);w.useEffect(function(){return zn.push(i),e.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:g}),document.addEventListener("wheel",l,Hn),document.addEventListener("touchmove",l,Hn),document.addEventListener("touchstart",f,Hn),function(){zn=zn.filter(function(m){return m!==i}),document.removeEventListener("wheel",l,Hn),document.removeEventListener("touchmove",l,Hn),document.removeEventListener("touchstart",f,Hn)}},[]);var p=e.removeScrollBar,y=e.inert;return w.createElement(w.Fragment,null,y?w.createElement(i,{styles:by(s)}):null,p?w.createElement(ly,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function _y(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const xy=Yg(ku,wy);var Na=w.forwardRef(function(e,t){return w.createElement(Ci,kt({},e,{ref:t,sideCar:xy}))});Na.classNames=Ci.classNames;var Sy=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Wn=new WeakMap,Ps=new WeakMap,ks={},oo=0,Lu=function(e){return e&&(e.host||Lu(e.parentNode))},Cy=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Lu(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})},Ty=function(e,t,n,r){var s=Cy(t,Array.isArray(e)?e:[e]);ks[n]||(ks[n]=new WeakMap);var i=ks[n],o=[],a=new Set,l=new Set(s),d=function(u){!u||a.has(u)||(a.add(u),d(u.parentNode))};s.forEach(d);var f=function(u){!u||l.has(u)||Array.prototype.forEach.call(u.children,function(g){if(a.has(g))f(g);else try{var p=g.getAttribute(r),y=p!==null&&p!=="false",m=(Wn.get(g)||0)+1,h=(i.get(g)||0)+1;Wn.set(g,m),i.set(g,h),o.push(g),m===1&&y&&Ps.set(g,!0),h===1&&g.setAttribute(n,"true"),y||g.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",g,b)}})};return f(t),a.clear(),oo++,function(){o.forEach(function(u){var g=Wn.get(u)-1,p=i.get(u)-1;Wn.set(u,g),i.set(u,p),g||(Ps.has(u)||u.removeAttribute(r),Ps.delete(u)),p||u.removeAttribute(n)}),oo--,oo||(Wn=new WeakMap,Wn=new WeakMap,Ps=new WeakMap,ks={})}},Du=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=Sy(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),Ty(r,s,n,"aria-hidden")):function(){return null}},Ti="Dialog",[ju]=Bn(Ti),[Ey,wt]=ju(Ti),Iu=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:o=!0}=e,a=w.useRef(null),l=w.useRef(null),[d,f]=Ln({prop:r,defaultProp:s??!1,onChange:i,caller:Ti});return c.jsx(Ey,{scope:t,triggerRef:a,contentRef:l,contentId:on(),titleId:on(),descriptionId:on(),open:d,onOpenChange:f,onOpenToggle:w.useCallback(()=>f(u=>!u),[f]),modal:o,children:n})};Iu.displayName=Ti;var Mu="DialogTrigger",Py=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=wt(Mu,n),i=Oe(t,s.triggerRef);return c.jsx(he.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":Ma(s.open),...r,ref:i,onClick:me(e.onClick,s.onOpenToggle)})});Py.displayName=Mu;var Ra="DialogPortal",[ky,Fu]=ju(Ra,{forceMount:void 0}),Uu=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,i=wt(Ra,t);return c.jsx(ky,{scope:t,forceMount:n,children:w.Children.map(r,o=>c.jsx($n,{present:n||i.open,children:c.jsx(Si,{asChild:!0,container:s,children:o})}))})};Uu.displayName=Ra;var Xs="DialogOverlay",La=w.forwardRef((e,t)=>{const n=Fu(Xs,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=wt(Xs,e.__scopeDialog);return i.modal?c.jsx($n,{present:r||i.open,children:c.jsx(Oy,{...s,ref:t})}):null});La.displayName=Xs;var Ay=mr("DialogOverlay.RemoveScroll"),Oy=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=wt(Xs,n),i=Cg(),o=Oe(t,i);return c.jsx(Na,{as:Ay,allowPinchZoom:!0,shards:[s.contentRef],children:c.jsx(he.div,{"data-state":Ma(s.open),...r,ref:o,style:{pointerEvents:"auto",...r.style}})})}),pr="DialogContent",Da=w.forwardRef((e,t)=>{const n=Fu(pr,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=wt(pr,e.__scopeDialog);return c.jsx($n,{present:r||i.open,children:i.modal?c.jsx(Ny,{...s,ref:t}):c.jsx(Ry,{...s,ref:t})})});Da.displayName=pr;var Ny=w.forwardRef((e,t)=>{const n=wt(pr,e.__scopeDialog),r=w.useRef(null),s=Oe(t,n.contentRef,r);return w.useEffect(()=>{const i=r.current;if(i)return Du(i)},[]),c.jsx(Bu,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:me(e.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:me(e.onPointerDownOutside,i=>{const o=i.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&i.preventDefault()}),onFocusOutside:me(e.onFocusOutside,i=>i.preventDefault())})}),Ry=w.forwardRef((e,t)=>{const n=wt(pr,e.__scopeDialog),r=w.useRef(!1),s=w.useRef(!1);return c.jsx(Bu,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,a;(o=e.onCloseAutoFocus)==null||o.call(e,i),i.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{var l,d;(l=e.onInteractOutside)==null||l.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=i.target;((d=n.triggerRef.current)==null?void 0:d.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),Bu=w.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,...o}=e,a=wt(pr,n);return Tu(),c.jsx(c.Fragment,{children:c.jsx(Oa,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:c.jsx(xi,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":Ma(a.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>a.onOpenChange(!1)})})})}),$u="DialogTitle",ja=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=wt($u,n);return c.jsx(he.h2,{id:s.titleId,...r,ref:t})});ja.displayName=$u;var Vu="DialogDescription",Ia=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=wt(Vu,n);return c.jsx(he.p,{id:s.descriptionId,...r,ref:t})});Ia.displayName=Vu;var Hu="DialogClose",Ly=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=wt(Hu,n);return c.jsx(he.button,{type:"button",...r,ref:t,onClick:me(e.onClick,()=>s.onOpenChange(!1))})});Ly.displayName=Hu;function Ma(e){return e?"open":"closed"}const Dy=Iu,jy=Uu,zu=w.forwardRef(({className:e,...t},n)=>c.jsx(La,{ref:n,className:Te("bg-background/80 fixed inset-0 z-50 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));zu.displayName=La.displayName;const Wu=w.forwardRef(({className:e,overlayClass:t,children:n,...r},s)=>c.jsxs(jy,{children:[c.jsx(zu,{className:t}),c.jsx(Da,{ref:s,className:Te("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-2xl md:w-full",e),...r,children:n})]}));Wu.displayName=Da.displayName;const Ku=({className:e,...t})=>c.jsx("div",{className:Te("flex flex-col space-y-1.5 border-b text-center sm:text-left",e),...t});Ku.displayName="DialogHeader";const qu=({className:e,...t})=>c.jsx("div",{className:Te("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});qu.displayName="DialogFooter";const Gu=w.forwardRef(({className:e,...t},n)=>c.jsx(ja,{ref:n,className:Te("text-lg font-semibold leading-none tracking-tight",e),...t}));Gu.displayName=ja.displayName;const Zu=w.forwardRef(({className:e,...t},n)=>c.jsx(Ia,{ref:n,className:Te("text-sm text-muted-foreground",e),...t}));Zu.displayName=Ia.displayName;function ul(e,[t,n]){return Math.min(n,Math.max(t,e))}function Fa(e){const t=e+"CollectionProvider",[n,r]=Bn(t),[s,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=m=>{const{scope:h,children:b}=m,v=w.useRef(null),_=w.useRef(new Map).current;return c.jsx(s,{scope:h,itemMap:_,collectionRef:v,children:b})};o.displayName=t;const a=e+"CollectionSlot",l=mr(a),d=w.forwardRef((m,h)=>{const{scope:b,children:v}=m,_=i(a,b),x=Oe(h,_.collectionRef);return c.jsx(l,{ref:x,children:v})});d.displayName=a;const f=e+"CollectionItemSlot",u="data-radix-collection-item",g=mr(f),p=w.forwardRef((m,h)=>{const{scope:b,children:v,..._}=m,x=w.useRef(null),S=Oe(h,x),T=i(f,b);return w.useEffect(()=>(T.itemMap.set(x,{ref:x,..._}),()=>void T.itemMap.delete(x))),c.jsx(g,{[u]:"",ref:S,children:v})});p.displayName=f;function y(m){const h=i(e+"CollectionConsumer",m);return w.useCallback(()=>{const v=h.collectionRef.current;if(!v)return[];const _=Array.from(v.querySelectorAll(`[${u}]`));return Array.from(h.itemMap.values()).sort((T,P)=>_.indexOf(T.ref.current)-_.indexOf(P.ref.current))},[h.collectionRef,h.itemMap])}return[{Provider:o,Slot:d,ItemSlot:p},y,r]}var Iy=w.createContext(void 0);function Yu(e){const t=w.useContext(Iy);return e||t||"ltr"}const My=["top","right","bottom","left"],ln=Math.min,nt=Math.max,Js=Math.round,As=Math.floor,Ot=e=>({x:e,y:e}),Fy={left:"right",right:"left",bottom:"top",top:"bottom"};function Do(e,t,n){return nt(e,ln(t,n))}function Mt(e,t){return typeof e=="function"?e(t):e}function Ft(e){return e.split("-")[0]}function Tr(e){return e.split("-")[1]}function Ua(e){return e==="x"?"y":"x"}function Ba(e){return e==="y"?"height":"width"}function At(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function $a(e){return Ua(At(e))}function Uy(e,t,n){n===void 0&&(n=!1);const r=Tr(e),s=$a(e),i=Ba(s);let o=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(o=ei(o)),[o,ei(o)]}function By(e){const t=ei(e);return[jo(e),t,jo(t)]}function jo(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const fl=["left","right"],ml=["right","left"],$y=["top","bottom"],Vy=["bottom","top"];function Hy(e,t,n){switch(e){case"top":case"bottom":return n?t?ml:fl:t?fl:ml;case"left":case"right":return t?$y:Vy;default:return[]}}function zy(e,t,n,r){const s=Tr(e);let i=Hy(Ft(e),n==="start",r);return s&&(i=i.map(o=>o+"-"+s),t&&(i=i.concat(i.map(jo)))),i}function ei(e){const t=Ft(e);return Fy[t]+e.slice(t.length)}function Wy(e){return{top:0,right:0,bottom:0,left:0,...e}}function Qu(e){return typeof e!="number"?Wy(e):{top:e,right:e,bottom:e,left:e}}function ti(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function pl(e,t,n){let{reference:r,floating:s}=e;const i=At(t),o=$a(t),a=Ba(o),l=Ft(t),d=i==="y",f=r.x+r.width/2-s.width/2,u=r.y+r.height/2-s.height/2,g=r[a]/2-s[a]/2;let p;switch(l){case"top":p={x:f,y:r.y-s.height};break;case"bottom":p={x:f,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:u};break;case"left":p={x:r.x-s.width,y:u};break;default:p={x:r.x,y:r.y}}switch(Tr(t)){case"start":p[o]-=g*(n&&d?-1:1);break;case"end":p[o]+=g*(n&&d?-1:1);break}return p}async function Ky(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:i,rects:o,elements:a,strategy:l}=e,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:g=!1,padding:p=0}=Mt(t,e),y=Qu(p),h=a[g?u==="floating"?"reference":"floating":u],b=ti(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(h)))==null||n?h:h.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:d,rootBoundary:f,strategy:l})),v=u==="floating"?{x:r,y:s,width:o.floating.width,height:o.floating.height}:o.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),x=await(i.isElement==null?void 0:i.isElement(_))?await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1}:{x:1,y:1},S=ti(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:_,strategy:l}):v);return{top:(b.top-S.top+y.top)/x.y,bottom:(S.bottom-b.bottom+y.bottom)/x.y,left:(b.left-S.left+y.left)/x.x,right:(S.right-b.right+y.right)/x.x}}const qy=50,Gy=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:o}=n,a=o.detectOverflow?o:{...o,detectOverflow:Ky},l=await(o.isRTL==null?void 0:o.isRTL(t));let d=await o.getElementRects({reference:e,floating:t,strategy:s}),{x:f,y:u}=pl(d,r,l),g=r,p=0;const y={};for(let m=0;m<i.length;m++){const h=i[m];if(!h)continue;const{name:b,fn:v}=h,{x:_,y:x,data:S,reset:T}=await v({x:f,y:u,initialPlacement:r,placement:g,strategy:s,middlewareData:y,rects:d,platform:a,elements:{reference:e,floating:t}});f=_??f,u=x??u,y[b]={...y[b],...S},T&&p<qy&&(p++,typeof T=="object"&&(T.placement&&(g=T.placement),T.rects&&(d=T.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:s}):T.rects),{x:f,y:u}=pl(d,g,l)),m=-1)}return{x:f,y:u,placement:g,strategy:s,middlewareData:y}},Zy=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:i,platform:o,elements:a,middlewareData:l}=t,{element:d,padding:f=0}=Mt(e,t)||{};if(d==null)return{};const u=Qu(f),g={x:n,y:r},p=$a(s),y=Ba(p),m=await o.getDimensions(d),h=p==="y",b=h?"top":"left",v=h?"bottom":"right",_=h?"clientHeight":"clientWidth",x=i.reference[y]+i.reference[p]-g[p]-i.floating[y],S=g[p]-i.reference[p],T=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let P=T?T[_]:0;(!P||!await(o.isElement==null?void 0:o.isElement(T)))&&(P=a.floating[_]||i.floating[y]);const A=x/2-S/2,D=P/2-m[y]/2-1,I=ln(u[b],D),N=ln(u[v],D),L=I,H=P-m[y]-N,R=P/2-m[y]/2+A,F=Do(L,R,H),M=!l.arrow&&Tr(s)!=null&&R!==F&&i.reference[y]/2-(R<L?I:N)-m[y]/2<0,$=M?R<L?R-L:R-H:0;return{[p]:g[p]+$,data:{[p]:F,centerOffset:R-F-$,...M&&{alignmentOffset:$}},reset:M}}}),Yy=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:i,rects:o,initialPlacement:a,platform:l,elements:d}=t,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:g,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:m=!0,...h}=Mt(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const b=Ft(s),v=At(a),_=Ft(a)===a,x=await(l.isRTL==null?void 0:l.isRTL(d.floating)),S=g||(_||!m?[ei(a)]:By(a)),T=y!=="none";!g&&T&&S.push(...zy(a,m,y,x));const P=[a,...S],A=await l.detectOverflow(t,h),D=[];let I=((r=i.flip)==null?void 0:r.overflows)||[];if(f&&D.push(A[b]),u){const R=Uy(s,o,x);D.push(A[R[0]],A[R[1]])}if(I=[...I,{placement:s,overflows:D}],!D.every(R=>R<=0)){var N,L;const R=(((N=i.flip)==null?void 0:N.index)||0)+1,F=P[R];if(F&&(!(u==="alignment"?v!==At(F):!1)||I.every(O=>At(O.placement)===v?O.overflows[0]>0:!0)))return{data:{index:R,overflows:I},reset:{placement:F}};let M=(L=I.filter($=>$.overflows[0]<=0).sort(($,O)=>$.overflows[1]-O.overflows[1])[0])==null?void 0:L.placement;if(!M)switch(p){case"bestFit":{var H;const $=(H=I.filter(O=>{if(T){const U=At(O.placement);return U===v||U==="y"}return!0}).map(O=>[O.placement,O.overflows.filter(U=>U>0).reduce((U,W)=>U+W,0)]).sort((O,U)=>O[1]-U[1])[0])==null?void 0:H[0];$&&(M=$);break}case"initialPlacement":M=a;break}if(s!==M)return{reset:{placement:M}}}return{}}}};function hl(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function gl(e){return My.some(t=>e[t]>=0)}const Qy=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:s="referenceHidden",...i}=Mt(e,t);switch(s){case"referenceHidden":{const o=await r.detectOverflow(t,{...i,elementContext:"reference"}),a=hl(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:gl(a)}}}case"escaped":{const o=await r.detectOverflow(t,{...i,altBoundary:!0}),a=hl(o,n.floating);return{data:{escapedOffsets:a,escaped:gl(a)}}}default:return{}}}}},Xu=new Set(["left","top"]);async function Xy(e,t){const{placement:n,platform:r,elements:s}=e,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=Ft(n),a=Tr(n),l=At(n)==="y",d=Xu.has(o)?-1:1,f=i&&l?-1:1,u=Mt(t,e);let{mainAxis:g,crossAxis:p,alignmentAxis:y}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&typeof y=="number"&&(p=a==="end"?y*-1:y),l?{x:p*f,y:g*d}:{x:g*d,y:p*f}}const Jy=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:i,placement:o,middlewareData:a}=t,l=await Xy(t,e);return o===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:s+l.x,y:i+l.y,data:{...l,placement:o}}}}},eb=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:i}=t,{mainAxis:o=!0,crossAxis:a=!1,limiter:l={fn:b=>{let{x:v,y:_}=b;return{x:v,y:_}}},...d}=Mt(e,t),f={x:n,y:r},u=await i.detectOverflow(t,d),g=At(Ft(s)),p=Ua(g);let y=f[p],m=f[g];if(o){const b=p==="y"?"top":"left",v=p==="y"?"bottom":"right",_=y+u[b],x=y-u[v];y=Do(_,y,x)}if(a){const b=g==="y"?"top":"left",v=g==="y"?"bottom":"right",_=m+u[b],x=m-u[v];m=Do(_,m,x)}const h=l.fn({...t,[p]:y,[g]:m});return{...h,data:{x:h.x-n,y:h.y-r,enabled:{[p]:o,[g]:a}}}}}},tb=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:i,middlewareData:o}=t,{offset:a=0,mainAxis:l=!0,crossAxis:d=!0}=Mt(e,t),f={x:n,y:r},u=At(s),g=Ua(u);let p=f[g],y=f[u];const m=Mt(a,t),h=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const _=g==="y"?"height":"width",x=i.reference[g]-i.floating[_]+h.mainAxis,S=i.reference[g]+i.reference[_]-h.mainAxis;p<x?p=x:p>S&&(p=S)}if(d){var b,v;const _=g==="y"?"width":"height",x=Xu.has(Ft(s)),S=i.reference[u]-i.floating[_]+(x&&((b=o.offset)==null?void 0:b[u])||0)+(x?0:h.crossAxis),T=i.reference[u]+i.reference[_]+(x?0:((v=o.offset)==null?void 0:v[u])||0)-(x?h.crossAxis:0);y<S?y=S:y>T&&(y=T)}return{[g]:p,[u]:y}}}},nb=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:i,platform:o,elements:a}=t,{apply:l=()=>{},...d}=Mt(e,t),f=await o.detectOverflow(t,d),u=Ft(s),g=Tr(s),p=At(s)==="y",{width:y,height:m}=i.floating;let h,b;u==="top"||u==="bottom"?(h=u,b=g===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(b=u,h=g==="end"?"top":"bottom");const v=m-f.top-f.bottom,_=y-f.left-f.right,x=ln(m-f[h],v),S=ln(y-f[b],_),T=!t.middlewareData.shift;let P=x,A=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(A=_),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(P=v),T&&!g){const I=nt(f.left,0),N=nt(f.right,0),L=nt(f.top,0),H=nt(f.bottom,0);p?A=y-2*(I!==0||N!==0?I+N:nt(f.left,f.right)):P=m-2*(L!==0||H!==0?L+H:nt(f.top,f.bottom))}await l({...t,availableWidth:A,availableHeight:P});const D=await o.getDimensions(a.floating);return y!==D.width||m!==D.height?{reset:{rects:!0}}:{}}}};function Ei(){return typeof window<"u"}function Er(e){return Ju(e)?(e.nodeName||"").toLowerCase():"#document"}function rt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Rt(e){var t;return(t=(Ju(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Ju(e){return Ei()?e instanceof Node||e instanceof rt(e).Node:!1}function bt(e){return Ei()?e instanceof Element||e instanceof rt(e).Element:!1}function $t(e){return Ei()?e instanceof HTMLElement||e instanceof rt(e).HTMLElement:!1}function yl(e){return!Ei()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof rt(e).ShadowRoot}function os(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=vt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function rb(e){return/^(table|td|th)$/.test(Er(e))}function Pi(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const sb=/transform|translate|scale|rotate|perspective|filter/,ib=/paint|layout|strict|content/,yn=e=>!!e&&e!=="none";let ao;function Va(e){const t=bt(e)?vt(e):e;return yn(t.transform)||yn(t.translate)||yn(t.scale)||yn(t.rotate)||yn(t.perspective)||!Ha()&&(yn(t.backdropFilter)||yn(t.filter))||sb.test(t.willChange||"")||ib.test(t.contain||"")}function ob(e){let t=dn(e);for(;$t(t)&&!hr(t);){if(Va(t))return t;if(Pi(t))return null;t=dn(t)}return null}function Ha(){return ao==null&&(ao=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),ao}function hr(e){return/^(html|body|#document)$/.test(Er(e))}function vt(e){return rt(e).getComputedStyle(e)}function ki(e){return bt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function dn(e){if(Er(e)==="html")return e;const t=e.assignedSlot||e.parentNode||yl(e)&&e.host||Rt(e);return yl(t)?t.host:t}function ef(e){const t=dn(e);return hr(t)?e.ownerDocument?e.ownerDocument.body:e.body:$t(t)&&os(t)?t:ef(t)}function Wr(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=ef(e),i=s===((r=e.ownerDocument)==null?void 0:r.body),o=rt(s);if(i){const a=Io(o);return t.concat(o,o.visualViewport||[],os(s)?s:[],a&&n?Wr(a):[])}else return t.concat(s,Wr(s,[],n))}function Io(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function tf(e){const t=vt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=$t(e),i=s?e.offsetWidth:n,o=s?e.offsetHeight:r,a=Js(n)!==i||Js(r)!==o;return a&&(n=i,r=o),{width:n,height:r,$:a}}function za(e){return bt(e)?e:e.contextElement}function Jn(e){const t=za(e);if(!$t(t))return Ot(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:i}=tf(t);let o=(i?Js(n.width):n.width)/r,a=(i?Js(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const ab=Ot(0);function nf(e){const t=rt(e);return!Ha()||!t.visualViewport?ab:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function cb(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==rt(e)?!1:t}function Dn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=za(e);let o=Ot(1);t&&(r?bt(r)&&(o=Jn(r)):o=Jn(e));const a=cb(i,n,r)?nf(i):Ot(0);let l=(s.left+a.x)/o.x,d=(s.top+a.y)/o.y,f=s.width/o.x,u=s.height/o.y;if(i){const g=rt(i),p=r&&bt(r)?rt(r):r;let y=g,m=Io(y);for(;m&&r&&p!==y;){const h=Jn(m),b=m.getBoundingClientRect(),v=vt(m),_=b.left+(m.clientLeft+parseFloat(v.paddingLeft))*h.x,x=b.top+(m.clientTop+parseFloat(v.paddingTop))*h.y;l*=h.x,d*=h.y,f*=h.x,u*=h.y,l+=_,d+=x,y=rt(m),m=Io(y)}}return ti({width:f,height:u,x:l,y:d})}function Ai(e,t){const n=ki(e).scrollLeft;return t?t.left+n:Dn(Rt(e)).left+n}function rf(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Ai(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function lb(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const i=s==="fixed",o=Rt(r),a=t?Pi(t.floating):!1;if(r===o||a&&i)return n;let l={scrollLeft:0,scrollTop:0},d=Ot(1);const f=Ot(0),u=$t(r);if((u||!u&&!i)&&((Er(r)!=="body"||os(o))&&(l=ki(r)),u)){const p=Dn(r);d=Jn(r),f.x=p.x+r.clientLeft,f.y=p.y+r.clientTop}const g=o&&!u&&!i?rf(o,l):Ot(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-l.scrollLeft*d.x+f.x+g.x,y:n.y*d.y-l.scrollTop*d.y+f.y+g.y}}function db(e){return Array.from(e.getClientRects())}function ub(e){const t=Rt(e),n=ki(e),r=e.ownerDocument.body,s=nt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=nt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+Ai(e);const a=-n.scrollTop;return vt(r).direction==="rtl"&&(o+=nt(t.clientWidth,r.clientWidth)-s),{width:s,height:i,x:o,y:a}}const bl=25;function fb(e,t){const n=rt(e),r=Rt(e),s=n.visualViewport;let i=r.clientWidth,o=r.clientHeight,a=0,l=0;if(s){i=s.width,o=s.height;const f=Ha();(!f||f&&t==="fixed")&&(a=s.offsetLeft,l=s.offsetTop)}const d=Ai(r);if(d<=0){const f=r.ownerDocument,u=f.body,g=getComputedStyle(u),p=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,y=Math.abs(r.clientWidth-u.clientWidth-p);y<=bl&&(i-=y)}else d<=bl&&(i+=d);return{width:i,height:o,x:a,y:l}}function mb(e,t){const n=Dn(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,i=$t(e)?Jn(e):Ot(1),o=e.clientWidth*i.x,a=e.clientHeight*i.y,l=s*i.x,d=r*i.y;return{width:o,height:a,x:l,y:d}}function vl(e,t,n){let r;if(t==="viewport")r=fb(e,n);else if(t==="document")r=ub(Rt(e));else if(bt(t))r=mb(t,n);else{const s=nf(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return ti(r)}function sf(e,t){const n=dn(e);return n===t||!bt(n)||hr(n)?!1:vt(n).position==="fixed"||sf(n,t)}function pb(e,t){const n=t.get(e);if(n)return n;let r=Wr(e,[],!1).filter(a=>bt(a)&&Er(a)!=="body"),s=null;const i=vt(e).position==="fixed";let o=i?dn(e):e;for(;bt(o)&&!hr(o);){const a=vt(o),l=Va(o);!l&&a.position==="fixed"&&(s=null),(i?!l&&!s:!l&&a.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||os(o)&&!l&&sf(e,o))?r=r.filter(f=>f!==o):s=a,o=dn(o)}return t.set(e,r),r}function hb(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const o=[...n==="clippingAncestors"?Pi(t)?[]:pb(t,this._c):[].concat(n),r],a=vl(t,o[0],s);let l=a.top,d=a.right,f=a.bottom,u=a.left;for(let g=1;g<o.length;g++){const p=vl(t,o[g],s);l=nt(p.top,l),d=ln(p.right,d),f=ln(p.bottom,f),u=nt(p.left,u)}return{width:d-u,height:f-l,x:u,y:l}}function gb(e){const{width:t,height:n}=tf(e);return{width:t,height:n}}function yb(e,t,n){const r=$t(t),s=Rt(t),i=n==="fixed",o=Dn(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=Ot(0);function d(){l.x=Ai(s)}if(r||!r&&!i)if((Er(t)!=="body"||os(s))&&(a=ki(t)),r){const p=Dn(t,!0,i,t);l.x=p.x+t.clientLeft,l.y=p.y+t.clientTop}else s&&d();i&&!r&&s&&d();const f=s&&!r&&!i?rf(s,a):Ot(0),u=o.left+a.scrollLeft-l.x-f.x,g=o.top+a.scrollTop-l.y-f.y;return{x:u,y:g,width:o.width,height:o.height}}function co(e){return vt(e).position==="static"}function wl(e,t){if(!$t(e)||vt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Rt(e)===n&&(n=n.ownerDocument.body),n}function of(e,t){const n=rt(e);if(Pi(e))return n;if(!$t(e)){let s=dn(e);for(;s&&!hr(s);){if(bt(s)&&!co(s))return s;s=dn(s)}return n}let r=wl(e,t);for(;r&&rb(r)&&co(r);)r=wl(r,t);return r&&hr(r)&&co(r)&&!Va(r)?n:r||ob(e)||n}const bb=async function(e){const t=this.getOffsetParent||of,n=this.getDimensions,r=await n(e.floating);return{reference:yb(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function vb(e){return vt(e).direction==="rtl"}const wb={convertOffsetParentRelativeRectToViewportRelativeRect:lb,getDocumentElement:Rt,getClippingRect:hb,getOffsetParent:of,getElementRects:bb,getClientRects:db,getDimensions:gb,getScale:Jn,isElement:bt,isRTL:vb};function af(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function _b(e,t){let n=null,r;const s=Rt(e);function i(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),i();const d=e.getBoundingClientRect(),{left:f,top:u,width:g,height:p}=d;if(a||t(),!g||!p)return;const y=As(u),m=As(s.clientWidth-(f+g)),h=As(s.clientHeight-(u+p)),b=As(f),_={rootMargin:-y+"px "+-m+"px "+-h+"px "+-b+"px",threshold:nt(0,ln(1,l))||1};let x=!0;function S(T){const P=T[0].intersectionRatio;if(P!==l){if(!x)return o();P?o(!1,P):r=setTimeout(()=>{o(!1,1e-7)},1e3)}P===1&&!af(d,e.getBoundingClientRect())&&o(),x=!1}try{n=new IntersectionObserver(S,{..._,root:s.ownerDocument})}catch{n=new IntersectionObserver(S,_)}n.observe(e)}return o(!0),i}function xb(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,d=za(e),f=s||i?[...d?Wr(d):[],...t?Wr(t):[]]:[];f.forEach(b=>{s&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const u=d&&a?_b(d,n):null;let g=-1,p=null;o&&(p=new ResizeObserver(b=>{let[v]=b;v&&v.target===d&&p&&t&&(p.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var _;(_=p)==null||_.observe(t)})),n()}),d&&!l&&p.observe(d),t&&p.observe(t));let y,m=l?Dn(e):null;l&&h();function h(){const b=Dn(e);m&&!af(m,b)&&n(),m=b,y=requestAnimationFrame(h)}return n(),()=>{var b;f.forEach(v=>{s&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),u==null||u(),(b=p)==null||b.disconnect(),p=null,l&&cancelAnimationFrame(y)}}const Sb=Jy,Cb=eb,Tb=Yy,Eb=nb,Pb=Qy,_l=Zy,kb=tb,Ab=(e,t,n)=>{const r=new Map,s={platform:wb,...n},i={...s.platform,_c:r};return Gy(e,t,{...s,platform:i})};var Ob=typeof document<"u",Nb=function(){},Hs=Ob?C.useLayoutEffect:Nb;function ni(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!ni(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const i=s[r];if(!(i==="_owner"&&e.$$typeof)&&!ni(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function cf(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function xl(e,t){const n=cf(e);return Math.round(t*n)/n}function lo(e){const t=w.useRef(e);return Hs(()=>{t.current=e}),t}function Rb(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:i,floating:o}={},transform:a=!0,whileElementsMounted:l,open:d}=e,[f,u]=w.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,p]=w.useState(r);ni(g,r)||p(r);const[y,m]=w.useState(null),[h,b]=w.useState(null),v=w.useCallback(O=>{O!==T.current&&(T.current=O,m(O))},[]),_=w.useCallback(O=>{O!==P.current&&(P.current=O,b(O))},[]),x=i||y,S=o||h,T=w.useRef(null),P=w.useRef(null),A=w.useRef(f),D=l!=null,I=lo(l),N=lo(s),L=lo(d),H=w.useCallback(()=>{if(!T.current||!P.current)return;const O={placement:t,strategy:n,middleware:g};N.current&&(O.platform=N.current),Ab(T.current,P.current,O).then(U=>{const W={...U,isPositioned:L.current!==!1};R.current&&!ni(A.current,W)&&(A.current=W,Cr.flushSync(()=>{u(W)}))})},[g,t,n,N,L]);Hs(()=>{d===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,u(O=>({...O,isPositioned:!1})))},[d]);const R=w.useRef(!1);Hs(()=>(R.current=!0,()=>{R.current=!1}),[]),Hs(()=>{if(x&&(T.current=x),S&&(P.current=S),x&&S){if(I.current)return I.current(x,S,H);H()}},[x,S,H,I,D]);const F=w.useMemo(()=>({reference:T,floating:P,setReference:v,setFloating:_}),[v,_]),M=w.useMemo(()=>({reference:x,floating:S}),[x,S]),$=w.useMemo(()=>{const O={position:n,left:0,top:0};if(!M.floating)return O;const U=xl(M.floating,f.x),W=xl(M.floating,f.y);return a?{...O,transform:"translate("+U+"px, "+W+"px)",...cf(M.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:U,top:W}},[n,a,M.floating,f.x,f.y]);return w.useMemo(()=>({...f,update:H,refs:F,elements:M,floatingStyles:$}),[f,H,F,M,$])}const Lb=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?_l({element:r.current,padding:s}).fn(n):{}:r?_l({element:r,padding:s}).fn(n):{}}}},Db=(e,t)=>{const n=Sb(e);return{name:n.name,fn:n.fn,options:[e,t]}},jb=(e,t)=>{const n=Cb(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ib=(e,t)=>({fn:kb(e).fn,options:[e,t]}),Mb=(e,t)=>{const n=Tb(e);return{name:n.name,fn:n.fn,options:[e,t]}},Fb=(e,t)=>{const n=Eb(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ub=(e,t)=>{const n=Pb(e);return{name:n.name,fn:n.fn,options:[e,t]}},Bb=(e,t)=>{const n=Lb(e);return{name:n.name,fn:n.fn,options:[e,t]}};var $b="Arrow",lf=w.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...i}=e;return c.jsx(he.svg,{...i,ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:c.jsx("polygon",{points:"0,0 30,0 15,10"})})});lf.displayName=$b;var Vb=lf;function Hb(e){const[t,n]=w.useState(void 0);return Ie(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const i=s[0];let o,a;if("borderBoxSize"in i){const l=i.borderBoxSize,d=Array.isArray(l)?l[0]:l;o=d.inlineSize,a=d.blockSize}else o=e.offsetWidth,a=e.offsetHeight;n({width:o,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var Wa="Popper",[df,uf]=Bn(Wa),[zb,ff]=df(Wa),mf=e=>{const{__scopePopper:t,children:n}=e,[r,s]=w.useState(null),[i,o]=w.useState(void 0);return c.jsx(zb,{scope:t,anchor:r,onAnchorChange:s,placementState:i,setPlacementState:o,children:n})};mf.displayName=Wa;var pf="PopperAnchor",hf=w.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,i=ff(pf,n),o=w.useRef(null),a=i.onAnchorChange,l=w.useCallback(y=>{o.current=y,y&&a(y)},[a]),d=Oe(t,l),f=w.useRef(null);w.useEffect(()=>{if(!r)return;const y=f.current;f.current=r.current,y!==f.current&&a(f.current)});const u=i.placementState&&qa(i.placementState),g=u==null?void 0:u[0],p=u==null?void 0:u[1];return r?null:c.jsx(he.div,{"data-radix-popper-side":g,"data-radix-popper-align":p,...s,ref:d})});hf.displayName=pf;var Ka="PopperContent",[Wb,Kb]=df(Ka),gf=w.forwardRef((e,t)=>{var se,Ee,le,oe,B,ve;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:i="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:d=[],collisionPadding:f=0,sticky:u="partial",hideWhenDetached:g=!1,updatePositionStrategy:p="optimized",onPlaced:y,...m}=e,h=ff(Ka,n),[b,v]=w.useState(null),_=Oe(t,ke=>v(ke)),[x,S]=w.useState(null),T=Hb(x),P=(T==null?void 0:T.width)??0,A=(T==null?void 0:T.height)??0,D=r+(i!=="center"?"-"+i:""),I=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},N=Array.isArray(d)?d:[d],L=N.length>0,H={padding:I,boundary:N.filter(Gb),altBoundary:L},{refs:R,floatingStyles:F,placement:M,isPositioned:$,middlewareData:O}=Rb({strategy:"fixed",placement:D,whileElementsMounted:(...ke)=>xb(...ke,{animationFrame:p==="always"}),elements:{reference:h.anchor},middleware:[Db({mainAxis:s+A,alignmentAxis:o}),l&&jb({mainAxis:!0,crossAxis:!1,limiter:u==="partial"?Ib():void 0,...H}),l&&Mb({...H}),Fb({...H,apply:({elements:ke,rects:Pe,availableWidth:X,availableHeight:Ne})=>{const{width:Be,height:Xe}=Pe.reference,ft=ke.floating.style;ft.setProperty("--radix-popper-available-width",`${X}px`),ft.setProperty("--radix-popper-available-height",`${Ne}px`),ft.setProperty("--radix-popper-anchor-width",`${Be}px`),ft.setProperty("--radix-popper-anchor-height",`${Xe}px`)}}),x&&Bb({element:x,padding:a}),Zb({arrowWidth:P,arrowHeight:A}),g&&Ub({strategy:"referenceHidden",...H,boundary:L?H.boundary:void 0})]}),U=h.setPlacementState;Ie(()=>(U(M),()=>{U(void 0)}),[M,U]);const[W,j]=qa(M),ee=yt(y);Ie(()=>{$&&(ee==null||ee())},[$,ee]);const J=(se=O.arrow)==null?void 0:se.x,de=(Ee=O.arrow)==null?void 0:Ee.y,ue=((le=O.arrow)==null?void 0:le.centerOffset)!==0,[V,K]=w.useState();return Ie(()=>{b&&K(window.getComputedStyle(b).zIndex)},[b]),c.jsx("div",{ref:R.setFloating,"data-radix-popper-content-wrapper":"",style:{...F,transform:$?F.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:V,"--radix-popper-transform-origin":[(oe=O.transformOrigin)==null?void 0:oe.x,(B=O.transformOrigin)==null?void 0:B.y].join(" "),...((ve=O.hide)==null?void 0:ve.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:c.jsx(Wb,{scope:n,placedSide:W,placedAlign:j,onArrowChange:S,arrowX:J,arrowY:de,shouldHideArrow:ue,children:c.jsx(he.div,{"data-side":W,"data-align":j,...m,ref:_,style:{...m.style,animation:$?void 0:"none"}})})})});gf.displayName=Ka;var yf="PopperArrow",qb={top:"bottom",right:"left",bottom:"top",left:"right"},bf=w.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,i=Kb(yf,r),o=qb[i.placedSide];return c.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:c.jsx(Vb,{...s,ref:n,style:{...s.style,display:"block"}})})});bf.displayName=yf;function Gb(e){return e!==null}var Zb=e=>({name:"transformOrigin",options:e,fn(t){var h,b,v;const{placement:n,rects:r,middlewareData:s}=t,o=((h=s.arrow)==null?void 0:h.centerOffset)!==0,a=o?0:e.arrowWidth,l=o?0:e.arrowHeight,[d,f]=qa(n),u={start:"0%",center:"50%",end:"100%"}[f],g=(((b=s.arrow)==null?void 0:b.x)??0)+a/2,p=(((v=s.arrow)==null?void 0:v.y)??0)+l/2;let y="",m="";return d==="bottom"?(y=o?u:`${g}px`,m=`${-l}px`):d==="top"?(y=o?u:`${g}px`,m=`${r.floating.height+l}px`):d==="right"?(y=`${-l}px`,m=o?u:`${p}px`):d==="left"&&(y=`${r.floating.width+l}px`,m=o?u:`${p}px`),{data:{x:y,y:m}}}});function qa(e){const[t,n="center"]=e.split("-");return[t,n]}var Yb=mf,Qb=hf,Xb=gf,Jb=bf;function ev(e){const t=w.useRef({value:e,previous:e});return w.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var vf=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),tv="VisuallyHidden",Ga=w.forwardRef((e,t)=>c.jsx(he.span,{...e,ref:t,style:{...vf,...e.style}}));Ga.displayName=tv;var nv=[" ","Enter","ArrowUp","ArrowDown"],rv=[" ","Enter"],jn="Select",[Oi,Ni,sv]=Fa(jn),[Vn]=Bn(jn,[sv,uf]),Ri=uf(),[iv,pn]=Vn(jn),[ov,av]=Vn(jn),cv="SelectProvider";function wf(e){const{__scopeSelect:t,children:n,open:r,defaultOpen:s,onOpenChange:i,value:o,defaultValue:a,onValueChange:l,dir:d,name:f,autoComplete:u,disabled:g,required:p,form:y,internal_do_not_use_render:m}=e,h=Ri(t),[b,v]=w.useState(null),[_,x]=w.useState(null),[S,T]=w.useState(!1),P=Yu(d),[A,D]=Ln({prop:r,defaultProp:s??!1,onChange:i,caller:jn}),[I,N]=Ln({prop:o,defaultProp:a,onChange:l,caller:jn}),L=w.useRef(null),H=b?!!y||!!b.closest("form"):!0,[R,F]=w.useState(new Set),M=on(),$=Array.from(R).map(j=>j.props.value).join(";"),O=w.useCallback(j=>{F(ee=>new Set(ee).add(j))},[]),U=w.useCallback(j=>{F(ee=>{const J=new Set(ee);return J.delete(j),J})},[]),W={required:p,trigger:b,onTriggerChange:v,valueNode:_,onValueNodeChange:x,valueNodeHasChildren:S,onValueNodeHasChildrenChange:T,contentId:M,value:I,onValueChange:N,open:A,onOpenChange:D,dir:P,triggerPointerDownPosRef:L,disabled:g,name:f,autoComplete:u,form:y,nativeOptions:R,nativeSelectKey:$,isFormControl:H};return c.jsx(Yb,{...h,children:c.jsx(iv,{scope:t,...W,children:c.jsx(Oi.Provider,{scope:t,children:c.jsx(ov,{scope:t,onNativeOptionAdd:O,onNativeOptionRemove:U,children:Sv(m)?m(W):n})})})})}wf.displayName=cv;var _f=e=>{const{__scopeSelect:t,children:n,...r}=e;return c.jsx(wf,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:s})=>c.jsxs(c.Fragment,{children:[n,s?c.jsx(Vf,{__scopeSelect:t}):null]})})};_f.displayName=jn;var xf="SelectTrigger",Za=w.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...s}=e,i=Ri(n),o=pn(xf,n),a=o.disabled||r,l=Oe(t,o.onTriggerChange),d=Ni(n),f=w.useRef("touch"),[u,g,p]=Hf(m=>{const h=d().filter(_=>!_.disabled),b=h.find(_=>_.value===o.value),v=zf(h,m,b);v!==void 0&&o.onValueChange(v.value)}),y=m=>{a||(o.onOpenChange(!0),p()),m&&(o.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return c.jsx(Qb,{asChild:!0,...i,children:c.jsx(he.button,{type:"button",role:"combobox","aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":Li(o.value)?"":void 0,...s,ref:l,onClick:me(s.onClick,m=>{m.currentTarget.focus(),f.current!=="mouse"&&y(m)}),onPointerDown:me(s.onPointerDown,m=>{f.current=m.pointerType;const h=m.target;h.hasPointerCapture(m.pointerId)&&h.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(y(m),m.preventDefault())}),onKeyDown:me(s.onKeyDown,m=>{const h=u.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&g(m.key),!(h&&m.key===" ")&&nv.includes(m.key)&&(y(),m.preventDefault())})})})});Za.displayName=xf;var Sf="SelectValue",Cf=w.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,children:i,placeholder:o="",...a}=e,l=pn(Sf,n),{onValueNodeHasChildrenChange:d}=l,f=i!==void 0,u=Oe(t,l.onValueNodeChange);Ie(()=>{d(f)},[d,f]);const g=Li(l.value);return c.jsx(he.span,{...a,asChild:g?!1:a.asChild,ref:u,style:{pointerEvents:"none"},children:c.jsx(w.Fragment,{children:g?o:i},g?"placeholder":"value")})});Cf.displayName=Sf;var lv="SelectIcon",Tf=w.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...s}=e;return c.jsx(he.span,{"aria-hidden":!0,...s,ref:t,children:r||"▼"})});Tf.displayName=lv;var Ef="SelectPortal",[dv,uv]=Vn(Ef,{forceMount:void 0}),Pf=e=>{const{__scopeSelect:t,forceMount:n,...r}=e;return c.jsx(dv,{scope:e.__scopeSelect,forceMount:n,children:c.jsx(Si,{asChild:!0,...r})})};Pf.displayName=Ef;var un="SelectContent",Ya=w.forwardRef((e,t)=>{const n=uv(un,e.__scopeSelect),{forceMount:r=n.forceMount,...s}=e,i=pn(un,e.__scopeSelect),[o,a]=w.useState();return Ie(()=>{a(new DocumentFragment)},[]),c.jsx($n,{present:r||i.open,children:({present:l})=>l?c.jsx(Of,{...s,ref:t}):c.jsx(kf,{...s,fragment:o})})});Ya.displayName=un;var kf=w.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,fragment:s}=e;return s?Cr.createPortal(c.jsx(Af,{scope:n,children:c.jsx(Oi.Slot,{scope:n,children:c.jsx("div",{ref:t,children:r})})}),s):null});kf.displayName="SelectContentFragment";var pt=10,[Af,hn]=Vn(un),fv="SelectContentImpl",mv=mr("SelectContent.RemoveScroll"),Of=w.forwardRef((e,t)=>{const{__scopeSelect:n}=e,{position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:i,onPointerDownOutside:o,side:a,sideOffset:l,align:d,alignOffset:f,arrowPadding:u,collisionBoundary:g,collisionPadding:p,sticky:y,hideWhenDetached:m,avoidCollisions:h,...b}=e,v=pn(un,n),[_,x]=w.useState(null),[S,T]=w.useState(null),P=Oe(t,K=>x(K)),[A,D]=w.useState(null),[I,N]=w.useState(null),L=Ni(n),[H,R]=w.useState(!1),F=w.useRef(!1);w.useEffect(()=>{if(_)return Du(_)},[_]),Tu();const M=w.useCallback(K=>{const[se,...Ee]=L().map(B=>B.ref.current),[le]=Ee.slice(-1),oe=document.activeElement;for(const B of K)if(B===oe||(B==null||B.scrollIntoView({block:"nearest"}),B===se&&S&&(S.scrollTop=0),B===le&&S&&(S.scrollTop=S.scrollHeight),B==null||B.focus(),document.activeElement!==oe))return},[L,S]),$=w.useCallback(()=>M([A,_]),[M,A,_]);w.useEffect(()=>{H&&$()},[H,$]);const{onOpenChange:O,triggerPointerDownPosRef:U}=v;w.useEffect(()=>{if(_){let K={x:0,y:0};const se=le=>{var oe,B;K={x:Math.abs(Math.round(le.pageX)-(((oe=U.current)==null?void 0:oe.x)??0)),y:Math.abs(Math.round(le.pageY)-(((B=U.current)==null?void 0:B.y)??0))}},Ee=le=>{K.x<=10&&K.y<=10?le.preventDefault():le.composedPath().includes(_)||O(!1),document.removeEventListener("pointermove",se),U.current=null};return U.current!==null&&(document.addEventListener("pointermove",se),document.addEventListener("pointerup",Ee,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",se),document.removeEventListener("pointerup",Ee,{capture:!0})}}},[_,O,U]),w.useEffect(()=>{const K=()=>O(!1);return window.addEventListener("blur",K),window.addEventListener("resize",K),()=>{window.removeEventListener("blur",K),window.removeEventListener("resize",K)}},[O]);const[W,j]=Hf(K=>{const se=L().filter(oe=>!oe.disabled),Ee=se.find(oe=>oe.ref.current===document.activeElement),le=zf(se,K,Ee);le&&setTimeout(()=>{var oe;return(oe=le.ref.current)==null?void 0:oe.focus()})}),ee=w.useCallback((K,se,Ee)=>{const le=!F.current&&!Ee;(v.value!==void 0&&v.value===se||le)&&(D(K),le&&(F.current=!0))},[v.value]),J=w.useCallback(()=>_==null?void 0:_.focus(),[_]),de=w.useCallback((K,se,Ee)=>{const le=!F.current&&!Ee;(v.value!==void 0&&v.value===se||le)&&N(K)},[v.value]),ue=r==="popper"?Mo:Nf,V=ue===Mo?{side:a,sideOffset:l,align:d,alignOffset:f,arrowPadding:u,collisionBoundary:g,collisionPadding:p,sticky:y,hideWhenDetached:m,avoidCollisions:h}:{};return c.jsx(Af,{scope:n,content:_,viewport:S,onViewportChange:T,itemRefCallback:ee,selectedItem:A,onItemLeave:J,itemTextRefCallback:de,focusSelectedItem:$,selectedItemText:I,position:r,isPositioned:H,searchRef:W,children:c.jsx(Na,{as:mv,allowPinchZoom:!0,children:c.jsx(Oa,{asChild:!0,trapped:v.open,onMountAutoFocus:K=>{K.preventDefault()},onUnmountAutoFocus:me(s,K=>{var se;(se=v.trigger)==null||se.focus({preventScroll:!0}),K.preventDefault()}),children:c.jsx(xi,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:K=>K.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:c.jsx(ue,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:K=>K.preventDefault(),...b,...V,onPlaced:()=>R(!0),ref:P,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:me(b.onKeyDown,K=>{const se=K.ctrlKey||K.altKey||K.metaKey;if(K.key==="Tab"&&K.preventDefault(),!se&&K.key.length===1&&j(K.key),["ArrowUp","ArrowDown","Home","End"].includes(K.key)){let le=L().filter(oe=>!oe.disabled).map(oe=>oe.ref.current);if(["ArrowUp","End"].includes(K.key)&&(le=le.slice().reverse()),["ArrowUp","ArrowDown"].includes(K.key)){const oe=K.target,B=le.indexOf(oe);le=le.slice(B+1)}setTimeout(()=>M(le)),K.preventDefault()}})})})})})})});Of.displayName=fv;var pv="SelectItemAlignedPosition",Nf=w.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...s}=e,i=pn(un,n),o=hn(un,n),[a,l]=w.useState(null),[d,f]=w.useState(null),u=Oe(t,P=>f(P)),g=Ni(n),p=w.useRef(!1),y=w.useRef(!0),{viewport:m,selectedItem:h,selectedItemText:b,focusSelectedItem:v}=o,_=w.useCallback(()=>{if(i.trigger&&i.valueNode&&a&&d&&m&&h&&b){const P=i.trigger.getBoundingClientRect(),A=d.getBoundingClientRect(),D=i.valueNode.getBoundingClientRect(),I=b.getBoundingClientRect();if(i.dir!=="rtl"){const oe=I.left-A.left,B=D.left-oe,ve=P.left-B,ke=P.width+ve,Pe=Math.max(ke,A.width),X=window.innerWidth-pt,Ne=ul(B,[pt,Math.max(pt,X-Pe)]);a.style.minWidth=ke+"px",a.style.left=Ne+"px"}else{const oe=A.right-I.right,B=window.innerWidth-D.right-oe,ve=window.innerWidth-P.right-B,ke=P.width+ve,Pe=Math.max(ke,A.width),X=window.innerWidth-pt,Ne=ul(B,[pt,Math.max(pt,X-Pe)]);a.style.minWidth=ke+"px",a.style.right=Ne+"px"}const N=g(),L=window.innerHeight-pt*2,H=m.scrollHeight,R=window.getComputedStyle(d),F=parseInt(R.borderTopWidth,10),M=parseInt(R.paddingTop,10),$=parseInt(R.borderBottomWidth,10),O=parseInt(R.paddingBottom,10),U=F+M+H+O+$,W=Math.min(h.offsetHeight*5,U),j=window.getComputedStyle(m),ee=parseInt(j.paddingTop,10),J=parseInt(j.paddingBottom,10),de=P.top+P.height/2-pt,ue=L-de,V=h.offsetHeight/2,K=h.offsetTop+V,se=F+M+K,Ee=U-se;if(se<=de){const oe=N.length>0&&h===N[N.length-1].ref.current;a.style.bottom="0px";const B=d.clientHeight-m.offsetTop-m.offsetHeight,ve=Math.max(ue,V+(oe?J:0)+B+$),ke=se+ve;a.style.height=ke+"px"}else{const oe=N.length>0&&h===N[0].ref.current;a.style.top="0px";const ve=Math.max(de,F+m.offsetTop+(oe?ee:0)+V)+Ee;a.style.height=ve+"px",m.scrollTop=se-de+m.offsetTop}a.style.margin=`${pt}px 0`,a.style.minHeight=W+"px",a.style.maxHeight=L+"px",r==null||r(),requestAnimationFrame(()=>p.current=!0)}},[g,i.trigger,i.valueNode,a,d,m,h,b,i.dir,r]);Ie(()=>_(),[_]);const[x,S]=w.useState();Ie(()=>{d&&S(window.getComputedStyle(d).zIndex)},[d]);const T=w.useCallback(P=>{P&&y.current===!0&&(_(),v==null||v(),y.current=!1)},[_,v]);return c.jsx(gv,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:p,onScrollButtonChange:T,children:c.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:x},children:c.jsx(he.div,{...s,ref:u,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});Nf.displayName=pv;var hv="SelectPopperPosition",Mo=w.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=pt,...i}=e,o=Ri(n);return c.jsx(Xb,{...o,...i,ref:t,align:r,collisionPadding:s,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Mo.displayName=hv;var[gv,Qa]=Vn(un,{}),Fo="SelectViewport",Rf=w.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...s}=e,i=hn(Fo,n),o=Qa(Fo,n),a=Oe(t,i.onViewportChange),l=w.useRef(0);return c.jsxs(c.Fragment,{children:[c.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),c.jsx(Oi.Slot,{scope:n,children:c.jsx(he.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:me(s.onScroll,d=>{const f=d.currentTarget,{contentWrapper:u,shouldExpandOnScrollRef:g}=o;if(g!=null&&g.current&&u){const p=Math.abs(l.current-f.scrollTop);if(p>0){const y=window.innerHeight-pt*2,m=parseFloat(u.style.minHeight),h=parseFloat(u.style.height),b=Math.max(m,h);if(b<y){const v=b+p,_=Math.min(y,v),x=v-_;u.style.height=_+"px",u.style.bottom==="0px"&&(f.scrollTop=x>0?x:0,u.style.justifyContent="flex-end")}}}l.current=f.scrollTop})})})]})});Rf.displayName=Fo;var Lf="SelectGroup",[yv,bv]=Vn(Lf),vv=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=on();return c.jsx(yv,{scope:n,id:s,children:c.jsx(he.div,{role:"group","aria-labelledby":s,...r,ref:t})})});vv.displayName=Lf;var Df="SelectLabel",Xa=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=bv(Df,n);return c.jsx(he.div,{id:s.id,...r,ref:t})});Xa.displayName=Df;var ri="SelectItem",[wv,jf]=Vn(ri),Ja=w.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:i,...o}=e,a=pn(ri,n),l=hn(ri,n),d=a.value===r,[f,u]=w.useState(i??""),[g,p]=w.useState(!1),y=Oe(t,v=>{var _;return(_=l.itemRefCallback)==null?void 0:_.call(l,v,r,s)}),m=on(),h=w.useRef("touch"),b=()=>{s||(a.onValueChange(r),a.onOpenChange(!1))};return c.jsx(wv,{scope:n,value:r,disabled:s,textId:m,isSelected:d,onItemTextChange:w.useCallback(v=>{u(_=>_||((v==null?void 0:v.textContent)??"").trim())},[]),children:c.jsx(Oi.ItemSlot,{scope:n,value:r,disabled:s,textValue:f,children:c.jsx(he.div,{role:"option","aria-labelledby":m,"data-highlighted":g?"":void 0,"aria-selected":d&&g,"data-state":d?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...o,ref:y,onFocus:me(o.onFocus,()=>p(!0)),onBlur:me(o.onBlur,()=>p(!1)),onClick:me(o.onClick,()=>{h.current!=="mouse"&&b()}),onPointerUp:me(o.onPointerUp,()=>{h.current==="mouse"&&b()}),onPointerDown:me(o.onPointerDown,v=>{h.current=v.pointerType}),onPointerMove:me(o.onPointerMove,v=>{var _;h.current=v.pointerType,s?(_=l.onItemLeave)==null||_.call(l):h.current==="mouse"&&v.currentTarget.focus({preventScroll:!0})}),onPointerLeave:me(o.onPointerLeave,v=>{var _;v.currentTarget===document.activeElement&&((_=l.onItemLeave)==null||_.call(l))}),onKeyDown:me(o.onKeyDown,v=>{var x;((x=l.searchRef)==null?void 0:x.current)!==""&&v.key===" "||(rv.includes(v.key)&&b(),v.key===" "&&v.preventDefault())})})})})});Ja.displayName=ri;var Fr="SelectItemText",If=w.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,...i}=e,o=pn(Fr,n),a=hn(Fr,n),l=jf(Fr,n),d=av(Fr,n),[f,u]=w.useState(null),g=Oe(t,b=>u(b),l.onItemTextChange,b=>{var v;return(v=a.itemTextRefCallback)==null?void 0:v.call(a,b,l.value,l.disabled)}),p=f==null?void 0:f.textContent,y=w.useMemo(()=>c.jsx("option",{value:l.value,disabled:l.disabled,children:p},l.value),[l.disabled,l.value,p]),{onNativeOptionAdd:m,onNativeOptionRemove:h}=d;return Ie(()=>(m(y),()=>h(y)),[m,h,y]),c.jsxs(c.Fragment,{children:[c.jsx(he.span,{id:l.textId,...i,ref:g}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!Li(o.value)?Cr.createPortal(i.children,o.valueNode):null]})});If.displayName=Fr;var Mf="SelectItemIndicator",Ff=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return jf(Mf,n).isSelected?c.jsx(he.span,{"aria-hidden":!0,...r,ref:t}):null});Ff.displayName=Mf;var Uo="SelectScrollUpButton",ec=w.forwardRef((e,t)=>{const n=hn(Uo,e.__scopeSelect),r=Qa(Uo,e.__scopeSelect),[s,i]=w.useState(!1),o=Oe(t,r.onScrollButtonChange);return Ie(()=>{if(n.viewport&&n.isPositioned){let a=function(){const d=l.scrollTop>0;i(d)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),s?c.jsx(Uf,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});ec.displayName=Uo;var Bo="SelectScrollDownButton",tc=w.forwardRef((e,t)=>{const n=hn(Bo,e.__scopeSelect),r=Qa(Bo,e.__scopeSelect),[s,i]=w.useState(!1),o=Oe(t,r.onScrollButtonChange);return Ie(()=>{if(n.viewport&&n.isPositioned){let a=function(){const d=l.scrollHeight-l.clientHeight,f=Math.ceil(l.scrollTop)<d;i(f)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),s?c.jsx(Uf,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});tc.displayName=Bo;var Uf=w.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=e,i=hn("SelectScrollButton",n),o=w.useRef(null),a=Ni(n),l=w.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return w.useEffect(()=>()=>l(),[l]),Ie(()=>{var f;const d=a().find(u=>u.ref.current===document.activeElement);(f=d==null?void 0:d.ref.current)==null||f.scrollIntoView({block:"nearest"})},[a]),c.jsx(he.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:me(s.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:me(s.onPointerMove,()=>{var d;(d=i.onItemLeave)==null||d.call(i),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:me(s.onPointerLeave,()=>{l()})})}),_v="SelectSeparator",nc=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return c.jsx(he.div,{"aria-hidden":!0,...r,ref:t})});nc.displayName=_v;var Bf="SelectArrow",xv=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=Ri(n);return hn(Bf,n).position==="popper"?c.jsx(Jb,{...s,...r,ref:t}):null});xv.displayName=Bf;var $f="SelectBubbleInput",Vf=w.forwardRef(({__scopeSelect:e,...t},n)=>{const r=pn($f,e),{value:s,onValueChange:i,required:o,disabled:a,name:l,autoComplete:d,form:f}=r,{nativeOptions:u,nativeSelectKey:g}=r,p=w.useRef(null),y=Oe(n,p),m=s??"",h=ev(m),b=Array.from(u).some(v=>(v.props.value??"")==="");return w.useEffect(()=>{const v=p.current;if(!v)return;const _=window.HTMLSelectElement.prototype,S=Object.getOwnPropertyDescriptor(_,"value").set;if(h!==m&&S){const T=new Event("change",{bubbles:!0});S.call(v,m),v.dispatchEvent(T)}},[h,m]),c.jsxs(he.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:l,autoComplete:d,disabled:a,form:f,onChange:v=>i(v.target.value),...t,style:{...vf,...t.style},ref:y,defaultValue:m,children:[Li(s)&&!b?c.jsx("option",{value:""}):null,Array.from(u)]},g)});Vf.displayName=$f;function Sv(e){return typeof e=="function"}function Li(e){return e===""||e===void 0}function Hf(e){const t=yt(e),n=w.useRef(""),r=w.useRef(0),s=w.useCallback(o=>{const a=n.current+o;t(a),(function l(d){n.current=d,window.clearTimeout(r.current),d!==""&&(r.current=window.setTimeout(()=>l(""),1e3))})(a)},[t]),i=w.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return w.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,i]}function zf(e,t,n){const s=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let o=Cv(e,Math.max(i,0));s.length===1&&(o=o.filter(d=>d!==n));const l=o.find(d=>d.textValue.toLowerCase().startsWith(s.toLowerCase()));return l!==n?l:void 0}function Cv(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Di(e,t){if(e==null)return{};var n={},r=Object.keys(e),s,i;for(i=0;i<r.length;i++)s=r[i],!(t.indexOf(s)>=0)&&(n[s]=e[s]);return n}var Tv=["color"],Ev=C.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=Di(e,Tv);return C.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:t}),C.createElement("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),Pv=["color"],rc=C.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=Di(e,Pv);return C.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:t}),C.createElement("path",{d:"M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),kv=["color"],Av=C.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=Di(e,kv);return C.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:t}),C.createElement("path",{d:"M3.13523 8.84197C3.3241 9.04343 3.64052 9.05363 3.84197 8.86477L7.5 5.43536L11.158 8.86477C11.3595 9.05363 11.6759 9.04343 11.8648 8.84197C12.0536 8.64051 12.0434 8.32409 11.842 8.13523L7.84197 4.38523C7.64964 4.20492 7.35036 4.20492 7.15803 4.38523L3.15803 8.13523C2.95657 8.32409 2.94637 8.64051 3.13523 8.84197Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),Ov=["color"],Nv=C.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=Di(e,Ov);return C.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:t}),C.createElement("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))});const si=_f,ii=Cf,Kr=w.forwardRef(({className:e,children:t,...n},r)=>c.jsxs(Za,{ref:r,className:Te("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[placeholder]:text-muted-foreground [&>span]:line-clamp-1",e),...n,children:[t,c.jsx(Tf,{asChild:!0,children:c.jsx(rc,{className:"h-4 w-4 opacity-50"})})]}));Kr.displayName=Za.displayName;const Wf=w.forwardRef(({className:e,...t},n)=>c.jsx(ec,{ref:n,className:Te("flex cursor-default items-center justify-center py-1",e),...t,children:c.jsx(Av,{className:"h-4 w-4"})}));Wf.displayName=ec.displayName;const Kf=w.forwardRef(({className:e,...t},n)=>c.jsx(tc,{ref:n,className:Te("flex cursor-default items-center justify-center py-1",e),...t,children:c.jsx(rc,{className:"h-4 w-4"})}));Kf.displayName=tc.displayName;const qr=w.forwardRef(({className:e,children:t,position:n="popper",...r},s)=>c.jsx(Pf,{children:c.jsxs(Ya,{ref:s,className:Te("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] origin-[--radix-select-content-transform-origin] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[c.jsx(Wf,{}),c.jsx(Rf,{className:Te("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),c.jsx(Kf,{})]})}));qr.displayName=Ya.displayName;const Rv=w.forwardRef(({className:e,...t},n)=>c.jsx(Xa,{ref:n,className:Te("px-2 py-1.5 text-sm font-semibold",e),...t}));Rv.displayName=Xa.displayName;const Gr=w.forwardRef(({className:e,children:t,...n},r)=>c.jsxs(Ja,{ref:r,className:Te("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[c.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:c.jsx(Ff,{children:c.jsx(Ev,{className:"h-4 w-4"})})}),c.jsx(If,{children:t})]}));Gr.displayName=Ja.displayName;const Lv=w.forwardRef(({className:e,...t},n)=>c.jsx(nc,{ref:n,className:Te("-mx-1 my-1 h-px bg-muted",e),...t}));Lv.displayName=nc.displayName;function qf({open:e,isAccountsLoading:t,accountOptions:n,onConfirm:r,backUrl:s,createAccountUrl:i}){var u;const[o,a]=C.useState(""),l=o||((u=n[0])==null?void 0:u.login)||"",d=!t&&n.length>0&&l!=="",f=!t&&n.length===0;return c.jsx(Dy,{open:e,children:c.jsxs(Wu,{className:"web-trading-widget-account-modal",onPointerDownOutside:g=>g.preventDefault(),onEscapeKeyDown:g=>g.preventDefault(),children:[c.jsxs(Ku,{children:[c.jsx(Gu,{children:"Select trading account"}),c.jsx(Zu,{children:"Choose an account to continue trading on the chart."})]}),t?c.jsx("p",{className:"web-trading-widget-account-modal__loading",children:"Loading accounts…"}):n.length===0?c.jsx("p",{className:"web-trading-widget-account-modal__error",children:"No trading accounts available."}):c.jsxs(si,{value:l,onValueChange:a,children:[c.jsx(Kr,{className:"web-trading-widget-account-modal__select",children:c.jsx(ii,{placeholder:"Select account"})}),c.jsx(qr,{children:n.map(g=>c.jsxs(Gr,{value:g.login,children:[g.label," (",g.balance.toFixed(2)," ",g.currency,")"]},g.login))})]}),c.jsx(qu,{children:f?c.jsxs(c.Fragment,{children:[s?c.jsx(ct,{asChild:!0,variant:"outline",children:c.jsx("a",{href:s,children:"Just back"})}):null,i?c.jsx(ct,{asChild:!0,children:c.jsx("a",{href:i,children:"Create account"})}):null]}):c.jsx(ct,{type:"button",disabled:!d,onClick:()=>r(l),children:"Continue"})})]})})}var Dv={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const jv=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),lt=(e,t)=>{const n=C.forwardRef(({color:r="currentColor",size:s=24,strokeWidth:i=2,absoluteStrokeWidth:o,children:a,...l},d)=>C.createElement("svg",{ref:d,...Dv,width:s,height:s,stroke:r,strokeWidth:o?Number(i)*24/Number(s):i,className:`lucide lucide-${jv(e)}`,...l},[...t.map(([f,u])=>C.createElement(f,u)),...(Array.isArray(a)?a:[a])||[]]));return n.displayName=`${e}`,n},oi=lt("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),Iv=lt("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),Mv=lt("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),$o=lt("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),Gf=lt("GripHorizontal",[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]]),Zf=lt("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]),Fv=lt("ListOrdered",[["line",{x1:"10",x2:"21",y1:"6",y2:"6",key:"76qw6h"}],["line",{x1:"10",x2:"21",y1:"12",y2:"12",key:"16nom4"}],["line",{x1:"10",x2:"21",y1:"18",y2:"18",key:"u3jurt"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]),Uv=lt("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]),Bv=lt("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]),$v=lt("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),Vv=lt("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),gn=lt("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function Hv(e){const t=Math.round(Math.log10(e));return Number.isFinite(t)&&t>0?t:5}function sc(e){const t=Ke(e).toUpperCase();if(t)return Bt.find(n=>{var r,s;return((r=n.resolve_symbol)==null?void 0:r.toUpperCase())===t||((s=n.display_name)==null?void 0:s.toUpperCase())===t||n.ticker.replace(/_/g,"").toUpperCase()===t})}function zv(e){const t=sc(e);return t!=null&&t.pricescale?Hv(t.pricescale):5}function Yf(e,t){if(t)for(const r of["digits","Digits"]){const s=t[r];if(s!=null&&s!==""){const i=Number(s);if(Number.isFinite(i))return Math.round(i)}}const n=Ke(e).toUpperCase();return n.includes("XAU")||n.includes("GOLD")?2:n.includes("JPY")?3:5}function Wv(e){const t=sc(e);switch(t==null?void 0:t.type){case"commodity":return 100;case"crypto":case"indices":case"stock":return 1;case"forex":default:return 1e5}}const ic="USD";function as(e){return Ke(e).toUpperCase()}function ji(e){const t=as(e);return t.length>=6?t.slice(3):ic}function oc(e){if(e!==ic&&e==="JPY")return"USDJPY"}function Kv(e,t,n,r,s){const i=ji(e),o=oc(i);if(!o)return;if(as(e)===o){const d=t==="buy"?n:r;return d>0?d:void 0}const a=s[o];if(!a)return;const l=(a.bid+a.ask)/2;return l>0?l:void 0}function qv(e,t,n,r,s,i,o={}){const a=e==="buy"?n:r;let d=(e==="buy"?a-t:t-a)*s*Wv(i);const f=ji(i),u=Kv(i,e,n,r,o);if(u!==void 0)d/=u;else if(f!==ic)return null;return Math.round(d*100)/100}function Gv(e){const t=new Set;for(const n of e){const r=oc(ji(n));r&&as(n)!==r&&t.add(r)}return[...t]}function Zv(e,t){const n=as(e);if(n===t)return!0;const r=oc(ji(e));return r===t&&n!==r}function Yv(e,t,n,r,s){if(!Zv(e.symbol,t))return e;const i=as(e.symbol)===t,o=i?n:e.marketBid??e.currentPrice,a=i?r:e.marketAsk??e.currentPrice,l=e.type==="buy"?o:a,d=qv(e.type,e.openPrice,o,a,e.volumeLots,e.symbol,s);return{...e,currentPrice:l,marketBid:o,marketAsk:a,profit:d??e.profit}}function Ke(e){const t=e.trim();return t?t.replace(/m$/i,""):""}function Ii(e){return Ke(e)||"—"}const Ye={BUY:0,SELL:1,BUY_LIMIT:2,SELL_LIMIT:3,BUY_STOP:4,SELL_STOP:5,BUY_STOP_LIMIT:6,SELL_STOP_LIMIT:7},ai=[{mode:"market",label:"Market Execution",orderType:null,isMarket:!0},{mode:"buy_limit",label:"Buy Limit",orderType:Ye.BUY_LIMIT,isMarket:!1},{mode:"sell_limit",label:"Sell Limit",orderType:Ye.SELL_LIMIT,isMarket:!1},{mode:"buy_stop",label:"Buy Stop",orderType:Ye.BUY_STOP,isMarket:!1},{mode:"sell_stop",label:"Sell Stop",orderType:Ye.SELL_STOP,isMarket:!1},{mode:"buy_stop_limit",label:"Buy Stop Limit",orderType:Ye.BUY_STOP_LIMIT,isMarket:!1},{mode:"sell_stop_limit",label:"Sell Stop Limit",orderType:Ye.SELL_STOP_LIMIT,isMarket:!1}];function Mi(e){return ai.find(t=>t.mode===e)??ai[0]}function Fi(e){return Mi(e).isMarket}function Vo(e,t){const n=Mi(e);return n.orderType!==null?n.orderType:t==="buy"?Ye.BUY:Ye.SELL}function ci(e){return e%2===1?"sell":"buy"}function ac(e){return e>=Ye.BUY_LIMIT&&e<=Ye.SELL_STOP_LIMIT}function cc(e){return e===Ye.BUY_STOP_LIMIT||e===Ye.SELL_STOP_LIMIT}function Qf(e){return e==="buy_stop_limit"||e==="sell_stop_limit"}const gt={GTC:0,TODAY:1,SPECIFIED:2,SPECIFIED_DAY:3},Xf=[{value:gt.GTC,label:"GTC"},{value:gt.TODAY,label:"Today"},{value:gt.SPECIFIED,label:"Specified"},{value:gt.SPECIFIED_DAY,label:"Specified Day"}];function lc(e){return e===gt.SPECIFIED}function dc(e){return e===gt.SPECIFIED_DAY}function Qv(e){return e.map(t=>({login:t.login,label:t.label,balance:t.tradeStat.balance,currency:t.currency}))}function Xv(){if(typeof window>"u")return null;const e=localStorage.getItem(hu);return(e==null?void 0:e.trim())||null}function Sl(e){if(typeof window>"u")return;const t=e.trim();t&&localStorage.setItem(hu,t)}function Jv(e,t){var n;return t&&e.some(r=>r.login===t)?t:((n=e[0])==null?void 0:n.login)??""}function uc(e,t=Bt){return t.find(n=>n.ticker===e)}function ew(e,t=Bt){var s;const n=Ke(e).toUpperCase();if(!n)return null;const r=t.find(i=>{var o;return Ke(i.resolve_symbol??"").toUpperCase()===n||((o=i.display_name)==null?void 0:o.toUpperCase())===n||i.ticker.replace(/_/g,"").toUpperCase()===n||i.ticker.toUpperCase()===n});return r?r.ticker:((s=sc(e))==null?void 0:s.ticker)??null}function Jf(e,t=Bt){const n=uc(e,t),r=(n==null?void 0:n.resolve_symbol)??e.replace(/_/g,"");return Ke(r).toUpperCase()}function Ui(e,t=Bt){const n=uc(e,t);return n!=null&&n.resolve_symbol?n.resolve_symbol:e.replace(/_/g,"")}function Vt(e){const t=Math.round(Math.log10(e));return String(Number.isFinite(t)&&t>0?t:5)}function Ht(e,t=Bt){const n=uc(e,t);return(n==null?void 0:n.pricescale)??1e5}function xe(e,t){return e.toFixed(t)}function Pr(e){return 1/10**e}function fc(e,t){return e===null||t===null?null:(e+t)/2}function Ue(e){const t=e.trim();if(!t)return;const n=Number(t);if(!(!Number.isFinite(n)||n<=0))return n}function em(e,t,n){if(lc(e)){if(!t.trim())return;const r=Date.parse(t);return Number.isFinite(r)?Math.floor(r/1e3):void 0}if(dc(e)){if(!n.trim())return;const r=Date.parse(`${n}T23:59:59`);return Number.isFinite(r)?Math.floor(r/1e3):void 0}}function Bi(e,t,n){return e===gt.GTC||e===gt.TODAY?!0:em(e,t,n)!==void 0}const tw={},Cl=e=>{let t;const n=new Set,r=(f,u)=>{const g=typeof f=="function"?f(t):f;if(!Object.is(g,t)){const p=t;t=u??(typeof g!="object"||g===null)?g:Object.assign({},t,g),n.forEach(y=>y(t,p))}},s=()=>t,l={setState:r,getState:s,getInitialState:()=>d,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(tw?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},d=t=e(r,s,l);return l},nw=e=>e?Cl(e):Cl;function rw(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Os={exports:{}},uo={},Ns={exports:{}},fo={};/**
|
|
42
42
|
* @license React
|
|
43
43
|
* use-sync-external-store-shim.production.js
|
|
44
44
|
*
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
*
|
|
47
47
|
* This source code is licensed under the MIT license found in the
|
|
48
48
|
* LICENSE file in the root directory of this source tree.
|
|
49
|
-
*/var
|
|
49
|
+
*/var Tl;function sw(){if(Tl)return fo;Tl=1;var e=C;function t(u,g){return u===g&&(u!==0||1/u===1/g)||u!==u&&g!==g}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,s=e.useEffect,i=e.useLayoutEffect,o=e.useDebugValue;function a(u,g){var p=g(),y=r({inst:{value:p,getSnapshot:g}}),m=y[0].inst,h=y[1];return i(function(){m.value=p,m.getSnapshot=g,l(m)&&h({inst:m})},[u,p,g]),s(function(){return l(m)&&h({inst:m}),u(function(){l(m)&&h({inst:m})})},[u]),o(p),p}function l(u){var g=u.getSnapshot;u=u.value;try{var p=g();return!n(u,p)}catch{return!0}}function d(u,g){return g()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:a;return fo.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,fo}var mo={};/**
|
|
50
50
|
* @license React
|
|
51
51
|
* use-sync-external-store-shim.development.js
|
|
52
52
|
*
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
*
|
|
55
55
|
* This source code is licensed under the MIT license found in the
|
|
56
56
|
* LICENSE file in the root directory of this source tree.
|
|
57
|
-
*/var
|
|
57
|
+
*/var El;function iw(){return El||(El=1,process.env.NODE_ENV!=="production"&&(function(){function e(p,y){return p===y&&(p!==0||1/p===1/y)||p!==p&&y!==y}function t(p,y){f||s.startTransition===void 0||(f=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var m=y();if(!u){var h=y();i(m,h)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),u=!0)}h=o({inst:{value:m,getSnapshot:y}});var b=h[0].inst,v=h[1];return l(function(){b.value=m,b.getSnapshot=y,n(b)&&v({inst:b})},[p,m,y]),a(function(){return n(b)&&v({inst:b}),p(function(){n(b)&&v({inst:b})})},[p]),d(m),m}function n(p){var y=p.getSnapshot;p=p.value;try{var m=y();return!i(p,m)}catch{return!0}}function r(p,y){return y()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var s=C,i=typeof Object.is=="function"?Object.is:e,o=s.useState,a=s.useEffect,l=s.useLayoutEffect,d=s.useDebugValue,f=!1,u=!1,g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;mo.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:g,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),mo}var Pl;function tm(){return Pl||(Pl=1,process.env.NODE_ENV==="production"?Ns.exports=sw():Ns.exports=iw()),Ns.exports}/**
|
|
58
58
|
* @license React
|
|
59
59
|
* use-sync-external-store-shim/with-selector.production.js
|
|
60
60
|
*
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
*
|
|
63
63
|
* This source code is licensed under the MIT license found in the
|
|
64
64
|
* LICENSE file in the root directory of this source tree.
|
|
65
|
-
*/var
|
|
65
|
+
*/var kl;function ow(){if(kl)return uo;kl=1;var e=C,t=tm();function n(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var r=typeof Object.is=="function"?Object.is:n,s=t.useSyncExternalStore,i=e.useRef,o=e.useEffect,a=e.useMemo,l=e.useDebugValue;return uo.useSyncExternalStoreWithSelector=function(d,f,u,g,p){var y=i(null);if(y.current===null){var m={hasValue:!1,value:null};y.current=m}else m=y.current;y=a(function(){function b(T){if(!v){if(v=!0,_=T,T=g(T),p!==void 0&&m.hasValue){var P=m.value;if(p(P,T))return x=P}return x=T}if(P=x,r(_,T))return P;var A=g(T);return p!==void 0&&p(P,A)?(_=T,P):(_=T,x=A)}var v=!1,_,x,S=u===void 0?null:u;return[function(){return b(f())},S===null?void 0:function(){return b(S())}]},[f,u,g,p]);var h=s(d,y[0],y[1]);return o(function(){m.hasValue=!0,m.value=h},[h]),l(h),h},uo}var po={};/**
|
|
66
66
|
* @license React
|
|
67
67
|
* use-sync-external-store-shim/with-selector.development.js
|
|
68
68
|
*
|
|
@@ -70,21 +70,21 @@
|
|
|
70
70
|
*
|
|
71
71
|
* This source code is licensed under the MIT license found in the
|
|
72
72
|
* LICENSE file in the root directory of this source tree.
|
|
73
|
-
*/var Tl;function ew(){return Tl||(Tl=1,process.env.NODE_ENV!=="production"&&(function(){function e(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=C,n=Yf(),r=typeof Object.is=="function"?Object.is:e,s=n.useSyncExternalStore,i=t.useRef,o=t.useEffect,a=t.useMemo,l=t.useDebugValue;fo.useSyncExternalStoreWithSelector=function(d,f,u,y,m){var g=i(null);if(g.current===null){var p={hasValue:!1,value:null};g.current=p}else p=g.current;g=a(function(){function b(T){if(!v){if(v=!0,_=T,T=y(T),m!==void 0&&p.hasValue){var P=p.value;if(m(P,T))return x=P}return x=T}if(P=x,r(_,T))return P;var O=y(T);return m!==void 0&&m(P,O)?(_=T,P):(_=T,x=O)}var v=!1,_,x,S=u===void 0?null:u;return[function(){return b(f())},S===null?void 0:function(){return b(S())}]},[f,u,y,m]);var h=s(d,g[0],g[1]);return o(function(){p.hasValue=!0,p.value=h},[h]),l(h),h},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),fo}var Pl;function tw(){return Pl||(Pl=1,process.env.NODE_ENV==="production"?Es.exports=Jv():Es.exports=ew()),Es.exports}var nw=tw();const rw=Yv(nw),Qf={},{useDebugValue:sw}=C,{useSyncExternalStoreWithSelector:iw}=rw;let Al=!1;const ow=e=>e;function aw(e,t=ow,n){(Qf?"production":void 0)!=="production"&&n&&!Al&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),Al=!0);const r=iw(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return sw(r),r}const Ol=e=>{(Qf?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?Zv(e):e,n=(r,s)=>aw(t,r,s);return Object.assign(n,t),n},Fi=e=>e?Ol(e):Ol,Nl={source:null,entryPrice:null,stopLoss:"",takeProfit:"",side:null,showEntryLine:!1,volumeLots:.01,digits:2,priceStep:.01},se=Fi(e=>({...Nl,setDraft:t=>e(n=>({source:t.source,entryPrice:t.entryPrice!==void 0?t.entryPrice:n.entryPrice,stopLoss:t.stopLoss??n.stopLoss,takeProfit:t.takeProfit??n.takeProfit,side:t.side!==void 0?t.side:n.side,showEntryLine:t.showEntryLine??n.showEntryLine,volumeLots:t.volumeLots??n.volumeLots,digits:t.digits??n.digits,priceStep:t.priceStep??n.priceStep})),setOrderSide:({side:t,entryPrice:n})=>e({side:t,entryPrice:n,showEntryLine:!0}),setStopLoss:t=>e({stopLoss:t}),setTakeProfit:t=>e({takeProfit:t}),setVolumeLots:t=>e({volumeLots:t}),clearEntryLinePreview:()=>e({side:null,entryPrice:null,showEntryLine:!1}),clearDraft:()=>e({...Nl})}));function po(e,t){return e.toFixed(t)}function cw({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,isDragging:d,sidePanelTab:f="trade",onDragHandlePointerDown:u,onExpandedChange:y,onExpand:m,onPlaceOrder:g}){const[p,h]=C.useState(String(r)),[b,v]=C.useState(null),[_,x]=C.useState(f),S=se(D=>D.setOrderSide),T=se(D=>D.setVolumeLots);f!==_&&(x(f),v(null));const P=b??f==="scan";C.useEffect(()=>{y()},[P,y]);const O=()=>{const D=!P;D&&m(),v(D)},R=Number(Vt(Ht(e))),M=t!==null?Pe(t,R):"—",N=n!==null?Pe(n,R):"—",H=!o&&!a&&l!==""&&(t!==null&&n!==null),k=D=>{const $=Number(p),W=Number.isFinite($)&&$>0?$:r,I=Math.max(i,W+D*s),re=po(I,2);h(re),T(I)},B=()=>{const D=Number(p);if(!Number.isFinite(D)||D<=0){h(po(r,2)),T(r);return}const $=Math.max(i,D),W=po($,2);h(W),T($)},F=D=>{t===null||n===null||S({side:D,entryPrice:D==="buy"?n:t})},L=D=>{if(t===null||n===null||!l)return;const $=Number(p),W=Math.max(i,Number.isFinite($)&&$>0?$:r);S({side:D,entryPrice:D==="buy"?n:t}),g({login:l,side:D,volumeLots:W,bid:t,ask:n})};return c.jsx("div",{className:`web-trading-widget-mini-order${P?" web-trading-widget-mini-order--expanded":" web-trading-widget-mini-order--collapsed"}`,children:c.jsxs("div",{className:"web-trading-widget-mini-order__row",children:[c.jsx("button",{type:"button","aria-label":"Move quick order panel",onPointerDown:u,className:`web-trading-widget-mini-order__drag-handle${d?" web-trading-widget-mini-order__drag-handle--grabbing":""}`,children:c.jsx(Hf,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2})}),P?c.jsxs(c.Fragment,{children:[c.jsxs("button",{type:"button",disabled:!H,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--sell",onMouseDown:()=>F("sell"),onClick:()=>L("sell"),children:[c.jsx("span",{className:"web-trading-widget-mini-order__price",children:M}),c.jsx("span",{className:"web-trading-widget-mini-order__label web-trading-widget-mini-order__label--sell",children:"SELL"})]}),c.jsxs("div",{className:"web-trading-widget-mini-order__volume",children:[c.jsx("button",{type:"button","aria-label":"Decrease volume",disabled:!H,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>k(-1),children:c.jsx(ri,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})}),c.jsx("input",{type:"text",inputMode:"decimal",value:p,disabled:!H,onChange:D=>h(D.target.value),onBlur:B,className:"web-trading-widget-mini-order__volume-input"}),c.jsx("button",{type:"button","aria-label":"Increase volume",disabled:!H,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>k(1),children:c.jsx(Uo,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})})]}),c.jsxs("button",{type:"button",disabled:!H,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--buy",onMouseDown:()=>F("buy"),onClick:()=>L("buy"),children:[c.jsx("span",{className:"web-trading-widget-mini-order__label web-trading-widget-mini-order__label--buy",children:"BUY"}),c.jsx("span",{className:"web-trading-widget-mini-order__price",children:N})]})]}):null,c.jsx("button",{type:"button","aria-label":P?"Collapse quick order panel":"Expand quick order panel","aria-expanded":P,className:"web-trading-widget-mini-order__toggle",onClick:O,children:P?c.jsx(Ov,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5}):c.jsx(Nv,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5})})]})})}const lw="web-trading-widget-mini-exec-panel-position",Xf={x:56,y:96};function kl(e,t){const n=t==null?void 0:t.offsetParent;if(!t||!n)return e;const r=Math.max(0,n.clientWidth-t.offsetWidth),s=Math.max(0,n.clientHeight-t.offsetHeight);return{x:Math.min(r,Math.max(0,e.x)),y:Math.min(s,Math.max(0,e.y))}}function Rl(e,t){e.style.left=`${t.x}px`,e.style.top=`${t.y}px`}function dw(e,t){const n=t==null?void 0:t.offsetParent;return!t||!n?null:{x:e==="top-right"?Math.max(0,n.clientWidth-t.offsetWidth-16):Xf.x,y:16}}function uw(e){if(typeof window>"u")return null;try{const t=window.localStorage.getItem(e);if(!t)return null;const n=JSON.parse(t);if(typeof n.x=="number"&&typeof n.y=="number")return{x:n.x,y:n.y}}catch{}return null}function Ll(e,t){try{e.hasPointerCapture(t)&&e.releasePointerCapture(t)}catch{}}function Jf(e){const t=(e==null?void 0:e.storageKey)??lw,n=(e==null?void 0:e.defaultPosition)??Xf,r=e==null?void 0:e.defaultAlign,s=(e==null?void 0:e.isActive)??!0,i=C.useRef(null),[o,a]=C.useState(n),[l,d]=C.useState(!1),f=C.useRef(n),u=C.useRef(null);C.useEffect(()=>{f.current=o},[o]);const y=C.useCallback(p=>{const h=i.current,b=kl(p,h);f.current=b,a(b),h&&Rl(h,b)},[]),m=C.useCallback(()=>{y(f.current)},[y]);C.useEffect(()=>{if(!s)return;const p=uw(t);if(p){y(p);return}const h=r?dw(r,i.current):null;y(h??f.current)},[y,r,s,t]);const g=C.useCallback(p=>{p.preventDefault(),p.stopPropagation();const h=p.currentTarget,b=i.current;if(!b)return;const v=p.pointerId;h.setPointerCapture(v);const _=p.clientX,x=p.clientY,S=f.current;d(!0),document.body.style.cursor="grabbing",document.body.style.userSelect="none";const T=(R,M)=>{const N=kl({x:S.x+(R-_),y:S.y+(M-x)},b);f.current=N,Rl(b,N)},P=R=>{if(R.pointerId===v){Ll(h,v),h.removeEventListener("pointermove",O),h.removeEventListener("pointerup",P),h.removeEventListener("pointercancel",P),u.current=null,d(!1),a(f.current),document.body.style.cursor="",document.body.style.userSelect="";try{window.localStorage.setItem(t,JSON.stringify(f.current))}catch{}}},O=R=>{R.pointerId===v&&(R.preventDefault(),T(R.clientX,R.clientY))};h.addEventListener("pointermove",O),h.addEventListener("pointerup",P),h.addEventListener("pointercancel",P),u.current=()=>{Ll(h,v),h.removeEventListener("pointermove",O),h.removeEventListener("pointerup",P),h.removeEventListener("pointercancel",P),document.body.style.cursor="",document.body.style.userSelect="",d(!1)}},[t]);return C.useEffect(()=>{const p=()=>{y(f.current)};return window.addEventListener("resize",p),()=>{var h;window.removeEventListener("resize",p),(h=u.current)==null||h.call(u),u.current=null,document.body.style.cursor="",document.body.style.userSelect=""}},[y]),{panelRef:i,position:o,isDragging:l,onDragStart:g,reclamp:m}}const ep=200,fw=201,pw=203,mw=204,tp=0,hw=2,np=0;function Ui(e){const t=Number(e.trim());if(!Number.isFinite(t))throw new Error("Invalid trading account login.");return t}function dc(e){return Math.round(e*1e4)}function gw(e){return e>=2&&e<=7}function yw(e){return{Action:mw,Order:Number(e.orderTicket),Login:Ui(e.login),Symbol:e.symbol.replace(/m$/i,""),Type:e.orderType}}function bw(e){return{Action:pw,Order:Number(e.orderTicket),Login:Ui(e.login),Symbol:e.symbol.replace(/m$/i,""),Type:e.orderType,Volume:dc(e.volumeLots),Digits:e.digits,TypeTime:e.typeTime,Comment:e.comment??"order modify",PriceOrder:e.priceOrder,...e.priceSL!==void 0?{PriceSL:e.priceSL}:{},...e.priceTP!==void 0?{PriceTP:e.priceTP}:{},...e.priceTrigger!==void 0?{PriceTrigger:e.priceTrigger}:{}}}function vw(e){const t=e.positionSide==="buy"?1:0;return{Action:ep,Login:Ui(e.login),Symbol:e.symbol.replace(/m$/i,""),Type:t,TypeFill:tp,Volume:dc(e.volumeLots),Digits:e.digits,TypeTime:np,Comment:e.comment??"",Position:Number(e.positionTicket)}}function ww(e){const t=!gw(e.orderType);return{Action:t?ep:fw,Login:Ui(e.login),Symbol:e.symbol,Type:e.orderType,TypeFill:t?tp:hw,Volume:dc(e.volumeLots),Digits:e.digits,TypeTime:e.typeTime??np,Comment:e.comment,...e.priceOrder!==void 0?{PriceOrder:e.priceOrder}:{},...e.priceSL!==void 0?{PriceSL:e.priceSL}:{},...e.priceTP!==void 0?{PriceTP:e.priceTP}:{},...e.priceTrigger!==void 0?{PriceTrigger:e.priceTrigger}:{},...e.timeExpiration!==void 0?{TimeExpiration:e.timeExpiration}:{}}}function _w(e){return{async sendRequest(t){return e.post("/api/dealer/send_request",t,{headers:{"Content-Type":"application/json"}})},async getPositions(t){return t.trim()?e.get(`/api/trade/position/page?login=${encodeURIComponent(t)}&offset=0&total=50`):null},async getOrders(t){return t.trim()?e.get(`/api/trade/order/page?login=${encodeURIComponent(t)}&offset=0&total=10`):null},async getDealsTotal(t,n,r){return t.trim()?e.get(`/api/trade/deal/total?login=${encodeURIComponent(t)}&from=${n}&to=${r}`):null},async getDeals(t,n,r,s,i){return t.trim()?e.get(`/api/trade/deal/page?login=${encodeURIComponent(t)}&from=${n}&to=${r}&offset=${s}&total=${i}`):null}}}const xw=new Set(["10009","10008"]);function Dt(e){if(e===void 0||e==="")return;const t=Number(e);return Number.isFinite(t)?t:void 0}function Sw(e){const t=Dt(e);return t===void 0?.01:t/1e4}function Cw(e){var t;return(t=e.find(n=>n.answer))==null?void 0:t.answer}function Ew(e){var t,n,r,s;for(const i of e){const o=((t=i.result)==null?void 0:t.Retcode)??((n=i.answer)==null?void 0:n.ResultRetcode);if(o)return{retcode:String(o),price:Dt(((r=i.result)==null?void 0:r.Price)??((s=i.answer)==null?void 0:s.ResultPrice))}}return{retcode:""}}function Bs(e){return xw.has(e)}function Ps(e,t){var v,_,x;if(!e||typeof e!="object")return null;const r=e.data;if(!(r!=null&&r.length))return null;const s=Cw(r),{retcode:i,price:o}=Ew(r),a=Bs(i),l=(s==null?void 0:s.ResultDeal)||(s==null?void 0:s.ResultOrder)||(s==null?void 0:s.Order),d=((v=s==null?void 0:s.Symbol)==null?void 0:v.trim())||t.symbol,f=Ye(d),u=Dt(s==null?void 0:s.Type),y=u!==void 0?u%2===0?"buy":"sell":t.side,m=Dt(s==null?void 0:s.ResultPrice)??Dt(s==null?void 0:s.PriceOrder)??o??t.openPrice,g=Dt(s==null?void 0:s.ResultMarketBid),p=Dt(s==null?void 0:s.ResultMarketAsk),h=y==="buy"?g??m:p??m,b=Mv(f);return{ticket:String(l||Math.floor(Date.now()/1e3)),login:((_=s==null?void 0:s.Login)==null?void 0:_.trim())||t.login,symbol:f,displaySymbol:Li(f),side:y,volumeLots:Sw(s==null?void 0:s.Volume)||t.volumeLots,openPrice:m,currentPrice:h,stopLoss:Dt(s==null?void 0:s.PriceSL),takeProfit:Dt(s==null?void 0:s.PriceTP),comment:((x=s==null?void 0:s.Comment)==null?void 0:x.trim())||t.comment,digits:Math.round(b),retcode:i,isSuccess:a,marketBid:g,marketAsk:p}}function Tw(e){return e.type==="buy"?e.marketBid??e.currentPrice:e.marketAsk??e.currentPrice}function Pw(e,t){return{async submitOrder(n){const r=n.login.trim();if(!r)return{success:!1,message:"Please select a trading account."};const s=Math.max(.01,n.volumeLots),i=Ii(n.symbolTicker,t),o=Number(Vt(Ht(n.symbolTicker,t))),a=ji(n.executionMode),l=oc(n.orderType),d=n.typeTime;if(!a&&n.priceOrder===void 0)return{success:!1,message:l?"Please set a limit price for this order.":"Please set an order price for pending orders."};if(l&&n.priceTrigger===void 0)return{success:!1,message:"Please set a stop price for stop limit orders."};if(!a&&!Mi(d,n.expirationDateTime??"",n.expirationDay??""))return{success:!1,message:"Please set an expiration date for this order."};const f=a?n.side==="buy"?n.ask:n.bid:n.priceOrder??(n.side==="buy"?n.ask:n.bid),u=a?void 0:Zf(d,n.expirationDateTime??"",n.expirationDay??"");try{const y=ww({login:r,symbol:i,volumeLots:s,orderType:n.orderType,digits:o,comment:n.comment.trim(),priceOrder:ic(n.orderType)?n.priceOrder:void 0,priceTrigger:l?n.priceTrigger:void 0,priceSL:n.stopLoss,priceTP:n.takeProfit,typeTime:a?void 0:d,timeExpiration:u}),m=await e.sendRequest(y),g=Ps(m,{login:r,symbol:i,side:ii(n.orderType),volumeLots:s,openPrice:f,digits:o,comment:n.comment.trim()});return g!=null&&g.isSuccess?{success:!0,ticket:g.ticket,side:g.side,volumeLots:g.volumeLots,displaySymbol:g.displaySymbol,price:g.openPrice}:{success:!1,message:m&&typeof m=="object"&&"message"in m&&typeof m.message=="string"?m.message:"Order was not accepted by the dealer."}}catch(y){return{success:!1,message:y instanceof Error?y.message:"Failed to place order."}}},async closePosition(n){try{const r=Tw(n),s=vw({login:n.login,symbol:n.symbol,positionTicket:n.ticket,volumeLots:n.volumeLots,positionSide:n.type,digits:n.digits,comment:n.comment.trim()}),i=await e.sendRequest(s),o=Ps(i,{login:n.login,symbol:n.symbol,side:n.type==="buy"?"sell":"buy",volumeLots:n.volumeLots,openPrice:r,digits:n.digits,comment:n.comment.trim()});return o&&!Bs(o.retcode)?{success:!1,message:`Close failed (retcode ${o.retcode}).`}:{success:!0}}catch(r){return{success:!1,message:r instanceof Error?r.message:"Failed to close position."}}},async deleteOrder(n){try{const r=yw({login:n.login,orderTicket:n.ticket,symbol:n.symbol,orderType:n.orderType}),s=await e.sendRequest(r),i=Ps(s,{login:n.login,symbol:n.symbol,side:n.side,volumeLots:n.volumeLots,openPrice:n.orderPrice,digits:n.digits,comment:n.comment});return i&&!Bs(i.retcode)?{success:!1,message:`Delete failed (retcode ${i.retcode}).`}:{success:!0}}catch(r){return{success:!1,message:r instanceof Error?r.message:"Failed to delete order."}}},async modifyOrder(n,r){try{const s=bw({login:n.login,orderTicket:n.ticket,symbol:n.symbol,orderType:n.orderType,volumeLots:r.volumeLots,digits:n.digits,priceOrder:r.priceOrder,priceTrigger:r.priceTrigger,priceSL:r.stopLoss,priceTP:r.takeProfit,typeTime:n.typeTime,comment:r.comment.trim()||"order modify"}),i=await e.sendRequest(s),o=Ps(i,{login:n.login,symbol:n.symbol,side:n.side,volumeLots:r.volumeLots,openPrice:r.priceOrder,digits:n.digits,comment:r.comment.trim()});return o&&!Bs(o.retcode)?{success:!1,message:`Modify failed (retcode ${o.retcode}).`}:{success:!0}}catch(s){return{success:!1,message:s instanceof Error?s.message:"Failed to modify order."}}}}}function rp(e,t){return function(){return e.apply(t,arguments)}}const{toString:Aw}=Object.prototype,{getPrototypeOf:gr}=Object,{iterator:ss,toStringTag:sp}=Symbol,oi=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Wr=(e,t)=>{let n=e;const r=[];for(;n!=null&&n!==Object.prototype;){if(r.indexOf(n)!==-1)return!1;if(r.push(n),oi(n,t))return!0;n=gr(n)}return!1},Ow=(e,t)=>e!=null&&Wr(e,t)?e[t]:void 0,uc=(e=>t=>{const n=Aw.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),wt=e=>(e=e.toLowerCase(),t=>uc(t)===e),Bi=e=>t=>typeof t===e,{isArray:In}=Array,yr=Bi("undefined");function Ar(e){return e!==null&&!yr(e)&&e.constructor!==null&&!yr(e.constructor)&&Ze(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const ip=wt("ArrayBuffer");function Nw(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&ip(e.buffer),t}const kw=Bi("string"),Ze=Bi("function"),op=Bi("number"),Or=e=>e!==null&&typeof e=="object",Rw=e=>e===!0||e===!1,$s=e=>{if(!Or(e))return!1;const t=gr(e);return(t===null||t===Object.prototype||gr(t)===null)&&!Wr(e,sp)&&!Wr(e,ss)},Lw=e=>{if(!Or(e)||Ar(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Dw=wt("Date"),jw=wt("File"),Iw=e=>!!(e&&typeof e.uri<"u"),Mw=e=>e&&typeof e.getParts<"u",Fw=wt("Blob"),Uw=wt("FileList"),Bw=e=>Or(e)&&Ze(e.pipe);function $w(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const Dl=$w(),jl=typeof Dl.FormData<"u"?Dl.FormData:void 0,Vw=e=>{if(!e)return!1;if(jl&&e instanceof jl)return!0;const t=gr(e);if(!t||t===Object.prototype||!Ze(e.append))return!1;const n=uc(e);return n==="formdata"||n==="object"&&Ze(e.toString)&&e.toString()==="[object FormData]"},Hw=wt("URLSearchParams"),[zw,Ww,Kw,qw]=["ReadableStream","Request","Response","Headers"].map(wt),Gw=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function is(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),In(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(Ar(e))return;const i=n?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let a;for(r=0;r<o;r++)a=i[r],t.call(null,e[a],a,e)}}function ap(e,t){if(Ar(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r=n.length,s;for(;r-- >0;)if(s=n[r],t===s.toLowerCase())return s;return null}const vn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,cp=e=>!yr(e)&&e!==vn;function $o(...e){const{caseless:t,skipUndefined:n}=cp(this)&&this||{},r={},s=(i,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const a=t&&typeof o=="string"&&ap(r,o)||o,l=oi(r,a)?r[a]:void 0;$s(l)&&$s(i)?r[a]=$o(l,i):$s(i)?r[a]=$o({},i):In(i)?r[a]=i.slice():(!n||!yr(i))&&(r[a]=i)};for(let i=0,o=e.length;i<o;i++){const a=e[i];if(!a||Ar(a)||(is(a,s),typeof a!="object"||In(a)))continue;const l=Object.getOwnPropertySymbols(a);for(let d=0;d<l.length;d++){const f=l[d];o_.call(a,f)&&s(a[f],f)}}return r}const Zw=(e,t,n,{allOwnKeys:r}={})=>(is(t,(s,i)=>{n&&Ze(s)?Object.defineProperty(e,i,{__proto__:null,value:rp(s,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,i,{__proto__:null,value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),Yw=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Qw=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),n&&Object.assign(e.prototype,n)},Xw=(e,t,n,r)=>{let s,i,o;const a={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)o=s[i],(!r||r(o,e,t))&&!a[o]&&(t[o]=e[o],a[o]=!0);e=n!==!1&&gr(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},Jw=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},e_=e=>{if(!e)return null;if(In(e))return e;let t=e.length;if(!op(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},t_=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&gr(Uint8Array)),n_=(e,t)=>{const r=(e&&e[ss]).call(e);let s;for(;(s=r.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},r_=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},s_=wt("HTMLFormElement"),i_=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),{propertyIsEnumerable:o_}=Object.prototype,a_=wt("RegExp"),lp=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};is(n,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(r[i]=o||s)}),Object.defineProperties(e,r)},c_=e=>{lp(e,(t,n)=>{if(Ze(e)&&["arguments","caller","callee"].includes(n))return!1;const r=e[n];if(Ze(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},l_=(e,t)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return In(e)?r(e):r(String(e).split(t)),n},d_=()=>{},u_=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function f_(e){return!!(e&&Ze(e.append)&&e[sp]==="FormData"&&e[ss])}const p_=e=>{const t=new WeakSet,n=r=>{if(Or(r)){if(t.has(r))return;if(Ar(r))return r;if(!("toJSON"in r)){t.add(r);const s=In(r)?[]:{};return is(r,(i,o)=>{const a=n(i);!yr(a)&&(s[o]=a)}),t.delete(r),s}}return r};return n(e)},m_=wt("AsyncFunction"),h_=e=>e&&(Or(e)||Ze(e))&&Ze(e.then)&&Ze(e.catch),dp=((e,t)=>e?setImmediate:t?((n,r)=>(vn.addEventListener("message",({source:s,data:i})=>{s===vn&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),vn.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Ze(vn.postMessage)),g_=typeof queueMicrotask<"u"?queueMicrotask.bind(vn):typeof process<"u"&&process.nextTick||dp,up=e=>e!=null&&Ze(e[ss]),y_=e=>e!=null&&Wr(e,ss)&&up(e),A={isArray:In,isArrayBuffer:ip,isBuffer:Ar,isFormData:Vw,isArrayBufferView:Nw,isString:kw,isNumber:op,isBoolean:Rw,isObject:Or,isPlainObject:$s,isEmptyObject:Lw,isReadableStream:zw,isRequest:Ww,isResponse:Kw,isHeaders:qw,isUndefined:yr,isDate:Dw,isFile:jw,isReactNativeBlob:Iw,isReactNative:Mw,isBlob:Fw,isRegExp:a_,isFunction:Ze,isStream:Bw,isURLSearchParams:Hw,isTypedArray:t_,isFileList:Uw,forEach:is,merge:$o,extend:Zw,trim:Gw,stripBOM:Yw,inherits:Qw,toFlatObject:Xw,kindOf:uc,kindOfTest:wt,endsWith:Jw,toArray:e_,forEachEntry:n_,matchAll:r_,isHTMLForm:s_,hasOwnProperty:oi,hasOwnProp:oi,hasOwnInPrototypeChain:Wr,getSafeProp:Ow,reduceDescriptors:lp,freezeMethods:c_,toObjectSet:l_,toCamelCase:i_,noop:d_,toFiniteNumber:u_,findKey:ap,global:vn,isContextDefined:cp,isSpecCompliantForm:f_,toJSONObject:p_,isAsyncFn:m_,isThenable:h_,setImmediate:dp,asap:g_,isIterable:up,isSafeIterable:y_},b_=A.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),v_=e=>{const t={};let n,r,s;return e&&e.split(`
|
|
74
|
-
`).forEach(function(o){s=o.indexOf(":"),n=o.substring(0,s).trim().toLowerCase(),r=o.substring(s+1).trim(),!(!n||t[n]&&
|
|
75
|
-
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[Il]=this[Il]={accessors:{}}).accessors,s=this.prototype;function i(o){const a=Dr(o);r[a]||(A_(s,o),r[a]=!0)}return A.isArray(t)?t.forEach(i):i(t),this}};ze.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);A.reduceDescriptors(ze.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});A.freezeMethods(ze);const O_="[REDACTED ****]";function N_(e){if(A.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(A.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}function k_(e,t){const n=new Set(t.map(i=>String(i).toLowerCase())),r=[],s=i=>{if(i===null||typeof i!="object"||A.isBuffer(i))return i;if(r.indexOf(i)!==-1)return;i instanceof ze&&(i=i.toJSON()),r.push(i);let o;if(A.isArray(i))o=[],i.forEach((a,l)=>{const d=s(a);A.isUndefined(d)||(o[l]=d)});else{if(!A.isPlainObject(i)&&N_(i))return r.pop(),i;o=Object.create(null);for(const[a,l]of Object.entries(i)){const d=n.has(a.toLowerCase())?O_:s(l);A.isUndefined(d)||(o[a]=d)}}return r.pop(),o};return s(e)}let Z=class pp extends Error{static from(t,n,r,s,i,o){const a=new pp(t.message,n||t.code,r,s,i);return a.cause=t,a.name=t.name,t.status!=null&&a.status==null&&(a.status=t.status),o&&Object.assign(a,o),a}constructor(t,n,r,s,i){super(t),Object.defineProperty(this,"message",{__proto__:null,value:t,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),r&&(this.config=r),s&&(this.request=s),i&&(this.response=i,this.status=i.status)}toJSON(){const t=this.config,n=t&&A.hasOwnProp(t,"redact")?t.redact:void 0,r=A.isArray(n)&&n.length>0?k_(t,n):A.toJSONObject(t);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:r,code:this.code,status:this.status}}};Z.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";Z.ERR_BAD_OPTION="ERR_BAD_OPTION";Z.ECONNABORTED="ECONNABORTED";Z.ETIMEDOUT="ETIMEDOUT";Z.ECONNREFUSED="ECONNREFUSED";Z.ERR_NETWORK="ERR_NETWORK";Z.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";Z.ERR_DEPRECATED="ERR_DEPRECATED";Z.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";Z.ERR_BAD_REQUEST="ERR_BAD_REQUEST";Z.ERR_CANCELED="ERR_CANCELED";Z.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";Z.ERR_INVALID_URL="ERR_INVALID_URL";Z.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const R_=null,mp=100;function Vo(e){return A.isPlainObject(e)||A.isArray(e)}function hp(e){return A.endsWith(e,"[]")?e.slice(0,-2):e}function ho(e,t,n){return e?e.concat(t).map(function(s,i){return s=hp(s),!n&&i?"["+s+"]":s}).join(n?".":""):t}function L_(e){return A.isArray(e)&&!e.some(Vo)}const D_=A.toFlatObject(A,{},null,function(t){return/^is[A-Z]/.test(t)});function $i(e,t,n){if(!A.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=A.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(v,_){return!A.isUndefined(_[v])});const r=n.metaTokens,s=n.visitor||g,i=n.dots,o=n.indexes,a=n.Blob||typeof Blob<"u"&&Blob,l=n.maxDepth===void 0?mp:n.maxDepth,d=a&&A.isSpecCompliantForm(t),f=[];if(!A.isFunction(s))throw new TypeError("visitor must be a function");function u(b){if(b===null)return"";if(A.isDate(b))return b.toISOString();if(A.isBoolean(b))return b.toString();if(!d&&A.isBlob(b))throw new Z("Blob is not supported. Use a Buffer instead.");return A.isArrayBuffer(b)||A.isTypedArray(b)?d&&typeof Blob=="function"?new Blob([b]):Buffer.from(b):b}function y(b){if(b>l)throw new Z("Object is too deeply nested ("+b+" levels). Max depth: "+l,Z.ERR_FORM_DATA_DEPTH_EXCEEDED)}function m(b,v){if(l===1/0)return JSON.stringify(b);const _=[];return JSON.stringify(b,function(S,T){if(!A.isObject(T))return T;for(;_.length&&_[_.length-1]!==this;)_.pop();return _.push(T),y(v+_.length-1),T})}function g(b,v,_){let x=b;if(A.isReactNative(t)&&A.isReactNativeBlob(b))return t.append(ho(_,v,i),u(b)),!1;if(b&&!_&&typeof b=="object"){if(A.endsWith(v,"{}"))v=r?v:v.slice(0,-2),b=m(b,1);else if(A.isArray(b)&&L_(b)||(A.isFileList(b)||A.endsWith(v,"[]"))&&(x=A.toArray(b)))return v=hp(v),x.forEach(function(T,P){!(A.isUndefined(T)||T===null)&&t.append(o===!0?ho([v],P,i):o===null?v:v+"[]",u(T))}),!1}return Vo(b)?!0:(t.append(ho(_,v,i),u(b)),!1)}const p=Object.assign(D_,{defaultVisitor:g,convertValue:u,isVisitable:Vo});function h(b,v,_=0){if(!A.isUndefined(b)){if(y(_),f.indexOf(b)!==-1)throw new Error("Circular reference detected in "+v.join("."));f.push(b),A.forEach(b,function(S,T){(!(A.isUndefined(S)||S===null)&&s.call(t,S,A.isString(T)?T.trim():T,v,p))===!0&&h(S,v?v.concat(T):[T],_+1)}),f.pop()}}if(!A.isObject(e))throw new TypeError("data must be an object");return h(e),t}function Ml(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(r){return t[r]})}function pc(e,t){this._pairs=[],e&&$i(e,this,t)}const gp=pc.prototype;gp.append=function(t,n){this._pairs.push([t,n])};gp.toString=function(t){const n=t?function(r){return t.call(this,r,Ml)}:Ml;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function j_(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function yp(e,t,n){if(!t)return e;const r=A.isFunction(n)?{serialize:n}:n,s=A.getSafeProp(r,"encode")||j_,i=A.getSafeProp(r,"serialize");let o;if(i?o=i(t,r):o=A.isURLSearchParams(t)?t.toString():new pc(t,r).toString(s),o){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class Fl{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){A.forEach(this.handlers,function(r){r!==null&&t(r)})}}const mc={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},I_=typeof URLSearchParams<"u"?URLSearchParams:pc,M_=typeof FormData<"u"?FormData:null,F_=typeof Blob<"u"?Blob:null,U_={isBrowser:!0,classes:{URLSearchParams:I_,FormData:M_,Blob:F_},protocols:["http","https","file","blob","url","data"]},hc=typeof window<"u"&&typeof document<"u",Ho=typeof navigator=="object"&&navigator||void 0,B_=hc&&(!Ho||["ReactNative","NativeScript","NS"].indexOf(Ho.product)<0),$_=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",V_=hc&&window.location.href||"http://localhost",H_=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:hc,hasStandardBrowserEnv:B_,hasStandardBrowserWebWorkerEnv:$_,navigator:Ho,origin:V_},Symbol.toStringTag,{value:"Module"})),Be={...H_,...U_};function z_(e,t){return $i(e,new Be.classes.URLSearchParams,{visitor:function(n,r,s,i){return Be.isNode&&A.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}const Ul=mp;function bp(e){if(e>Ul)throw new Z("FormData field is too deeply nested ("+e+" levels). Max depth: "+Ul,Z.ERR_FORM_DATA_DEPTH_EXCEEDED)}function W_(e){const t=[],n=/\w+|\[(\w*)]/g;let r;for(;(r=n.exec(e))!==null;)bp(t.length),t.push(r[0]==="[]"?"":r[1]||r[0]);return t}function K_(e){const t={},n=Object.keys(e);let r;const s=n.length;let i;for(r=0;r<s;r++)i=n[r],t[i]=e[i];return t}function vp(e){function t(n,r,s,i){bp(i);let o=n[i++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),l=i>=n.length;return o=!o&&A.isArray(s)?s.length:o,l?(A.hasOwnProp(s,o)?s[o]=A.isArray(s[o])?s[o].concat(r):[s[o],r]:s[o]=r,!a):((!A.hasOwnProp(s,o)||!A.isObject(s[o]))&&(s[o]=[]),t(n,r,s[o],i)&&A.isArray(s[o])&&(s[o]=K_(s[o])),!a)}if(A.isFormData(e)&&A.isFunction(e.entries)){const n={};return A.forEachEntry(e,(r,s)=>{t(W_(r),s,n,0)}),n}return null}const Kn=(e,t)=>e!=null&&A.hasOwnProp(e,t)?e[t]:void 0;function q_(e,t,n){if(A.isString(e))try{return(t||JSON.parse)(e),A.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const os={transitional:mc,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=A.isObject(t);if(i&&A.isHTMLForm(t)&&(t=new FormData(t)),A.isFormData(t))return s?JSON.stringify(vp(t)):t;if(A.isArrayBuffer(t)||A.isBuffer(t)||A.isStream(t)||A.isFile(t)||A.isBlob(t)||A.isReadableStream(t))return t;if(A.isArrayBufferView(t))return t.buffer;if(A.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(i){const l=Kn(this,"formSerializer");if(r.indexOf("application/x-www-form-urlencoded")>-1)return z_(t,l).toString();if((a=A.isFileList(t))||r.indexOf("multipart/form-data")>-1){const d=Kn(this,"env"),f=d&&d.FormData;return $i(a?{"files[]":t}:t,f&&new f,l)}}return i||s?(n.setContentType("application/json",!1),q_(t)):t}],transformResponse:[function(t){const n=Kn(this,"transitional")||os.transitional,r=n&&n.forcedJSONParsing,s=Kn(this,"responseType"),i=s==="json";if(A.isResponse(t)||A.isReadableStream(t))return t;if(t&&A.isString(t)&&(r&&!s||i)){const a=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(t,Kn(this,"parseReviver"))}catch(l){if(a)throw l.name==="SyntaxError"?Z.from(l,Z.ERR_BAD_RESPONSE,this,null,Kn(this,"response")):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Be.classes.FormData,Blob:Be.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};A.forEach(["delete","get","head","post","put","patch","query"],e=>{os.headers[e]={}});function go(e,t){const n=this||os,r=t||n,s=ze.from(r.headers);let i=r.data;return A.forEach(e,function(a){i=a.call(n,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function wp(e){return!!(e&&e.__CANCEL__)}let as=class extends Z{constructor(t,n,r){super(t??"canceled",Z.ERR_CANCELED,n,r),this.name="CanceledError",this.__CANCEL__=!0}};function _p(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new Z("Request failed with status code "+n.status,n.status>=400&&n.status<500?Z.ERR_BAD_REQUEST:Z.ERR_BAD_RESPONSE,n.config,n.request,n))}function G_(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function Z_(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,i=0,o;return t=t!==void 0?t:1e3,function(l){const d=Date.now(),f=r[i];o||(o=d),n[s]=l,r[s]=d;let u=i,y=0;for(;u!==s;)y+=n[u++],u=u%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),d-o<t)return;const m=f&&d-f;return m?Math.round(y*1e3/m):void 0}}function Y_(e,t){let n=0,r=1e3/t,s,i;const o=(d,f=Date.now())=>{n=f,s=null,i&&(clearTimeout(i),i=null),e(...d)};return[(...d)=>{const f=Date.now(),u=f-n;u>=r?o(d,f):(s=d,i||(i=setTimeout(()=>{i=null,o(s)},r-u)))},()=>s&&o(s)]}const ai=(e,t,n=3)=>{let r=0;const s=Z_(50,250);return Y_(i=>{if(!i||typeof i.loaded!="number")return;const o=i.loaded,a=i.lengthComputable?i.total:void 0,l=a!=null?Math.min(o,a):o,d=Math.max(0,l-r),f=s(d);r=Math.max(r,l);const u={loaded:l,total:a,progress:a?l/a:void 0,bytes:d,rate:f||void 0,estimated:f&&a?(a-l)/f:void 0,event:i,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(u)},n)},Bl=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},$l=e=>(...t)=>A.asap(()=>e(...t)),Q_=Be.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Be.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Be.origin),Be.navigator&&/(msie|trident)/i.test(Be.navigator.userAgent)):()=>!0,X_=Be.hasStandardBrowserEnv?{write(e,t,n,r,s,i,o){if(typeof document>"u")return;const a=[`${e}=${encodeURIComponent(t)}`];A.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),A.isString(r)&&a.push(`path=${r}`),A.isString(s)&&a.push(`domain=${s}`),i===!0&&a.push("secure"),A.isString(o)&&a.push(`SameSite=${o}`),document.cookie=a.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.split(";");for(let n=0;n<t.length;n++){const r=t[n].replace(/^\s+/,""),s=r.indexOf("=");if(s!==-1&&r.slice(0,s)===e)return decodeURIComponent(r.slice(s+1))}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function J_(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function ex(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const tx=/^https?:(?!\/\/)/i,nx=/[\t\n\r]/g;function rx(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function sx(e){return rx(e).replace(nx,"")}function Vl(e,t){if(typeof e=="string"&&tx.test(sx(e)))throw new Z('Invalid URL: missing "//" after protocol',Z.ERR_INVALID_URL,t)}function xp(e,t,n,r){Vl(t,r);let s=!J_(t);return e&&(s||n===!1)?(Vl(e,r),ex(e,t)):t}const Hl=e=>e instanceof ze?{...e}:e;function Mn(e,t){t=t||{};const n=Object.create(null);Object.defineProperty(n,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function r(f,u,y,m){return A.isPlainObject(f)&&A.isPlainObject(u)?A.merge.call({caseless:m},f,u):A.isPlainObject(u)?A.merge({},u):A.isArray(u)?u.slice():u}function s(f,u,y,m){if(A.isUndefined(u)){if(!A.isUndefined(f))return r(void 0,f,y,m)}else return r(f,u,y,m)}function i(f,u){if(!A.isUndefined(u))return r(void 0,u)}function o(f,u){if(A.isUndefined(u)){if(!A.isUndefined(f))return r(void 0,f)}else return r(void 0,u)}function a(f){const u=A.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!A.isUndefined(u))if(A.isPlainObject(u)){if(A.hasOwnProp(u,f))return u[f]}else return;const y=A.hasOwnProp(e,"transitional")?e.transitional:void 0;if(A.isPlainObject(y)&&A.hasOwnProp(y,f))return y[f]}function l(f,u,y){if(A.hasOwnProp(t,y))return r(f,u);if(A.hasOwnProp(e,y))return r(void 0,f)}const d={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,allowedSocketPaths:o,responseEncoding:o,validateStatus:l,headers:(f,u,y)=>s(Hl(f),Hl(u),y,!0)};return A.forEach(Object.keys({...e,...t}),function(u){if(u==="__proto__"||u==="constructor"||u==="prototype")return;const y=A.hasOwnProp(d,u)?d[u]:s,m=A.hasOwnProp(e,u)?e[u]:void 0,g=A.hasOwnProp(t,u)?t[u]:void 0,p=y(m,g,u);A.isUndefined(p)&&y!==l||(n[u]=p)}),A.hasOwnProp(t,"validateStatus")&&A.isUndefined(t.validateStatus)&&a("validateStatusUndefinedResolves")===!1&&(A.hasOwnProp(e,"validateStatus")?n.validateStatus=r(void 0,e.validateStatus):delete n.validateStatus),n}const ix=["content-type","content-length"];function ox(e,t,n){if(n!=="content-only"){e.set(t);return}Object.entries(t).forEach(([r,s])=>{ix.includes(r.toLowerCase())&&e.set(r,s)})}const ax=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16)));function Sp(e){const t=Mn({},e),n=y=>A.hasOwnProp(t,y)?t[y]:void 0,r=n("data");let s=n("withXSRFToken");const i=n("xsrfHeaderName"),o=n("xsrfCookieName");let a=n("headers");const l=n("auth"),d=n("baseURL"),f=n("allowAbsoluteUrls"),u=n("url");if(t.headers=a=ze.from(a),t.url=yp(xp(d,u,f,t),n("params"),n("paramsSerializer")),l){const y=A.getSafeProp(l,"username")||"",m=A.getSafeProp(l,"password")||"";a.set("Authorization","Basic "+btoa(y+":"+(m?ax(m):"")))}if(A.isFormData(r)&&(Be.hasStandardBrowserEnv||Be.hasStandardBrowserWebWorkerEnv||A.isReactNative(r)?a.setContentType(void 0):A.isFunction(r.getHeaders)&&ox(a,r.getHeaders(),n("formDataHeaderPolicy"))),Be.hasStandardBrowserEnv&&(A.isFunction(s)&&(s=s(t)),s===!0||s==null&&Q_(t.url))){const m=i&&o&&X_.read(o);m&&a.set(i,m)}return t}const cx=typeof XMLHttpRequest<"u",lx=cx&&function(e){return new Promise(function(n,r){const s=Sp(e);let i=s.data;const o=ze.from(s.headers).normalize();let{responseType:a,onUploadProgress:l,onDownloadProgress:d}=s,f,u,y,m,g;function p(){m&&m(),g&&g(),s.cancelToken&&s.cancelToken.unsubscribe(f),s.signal&&s.signal.removeEventListener("abort",f)}let h=new XMLHttpRequest;h.open(s.method.toUpperCase(),s.url,!0),h.timeout=s.timeout;function b(){if(!h)return;const _=ze.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),S={data:!a||a==="text"||a==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:_,config:e,request:h};_p(function(P){n(P),p()},function(P){r(P),p()},S),h=null}"onloadend"in h?h.onloadend=b:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.startsWith("file:"))||setTimeout(b)},h.onabort=function(){h&&(r(new Z("Request aborted",Z.ECONNABORTED,e,h)),p(),h=null)},h.onerror=function(x){const S=x&&x.message?x.message:"Network Error",T=new Z(S,Z.ERR_NETWORK,e,h);T.event=x||null,r(T),p(),h=null},h.ontimeout=function(){let x=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const S=s.transitional||mc;s.timeoutErrorMessage&&(x=s.timeoutErrorMessage),r(new Z(x,S.clarifyTimeoutError?Z.ETIMEDOUT:Z.ECONNABORTED,e,h)),p(),h=null},i===void 0&&o.setContentType(null),"setRequestHeader"in h&&A.forEach(fp(o),function(x,S){h.setRequestHeader(S,x)}),A.isUndefined(s.withCredentials)||(h.withCredentials=!!s.withCredentials),a&&a!=="json"&&(h.responseType=s.responseType),d&&([y,g]=ai(d,!0),h.addEventListener("progress",y)),l&&h.upload&&([u,m]=ai(l),h.upload.addEventListener("progress",u),h.upload.addEventListener("loadend",m)),(s.cancelToken||s.signal)&&(f=_=>{h&&(r(!_||_.type?new as(null,e,h):_),h.abort(),p(),h=null)},s.cancelToken&&s.cancelToken.subscribe(f),s.signal&&(s.signal.aborted?f():s.signal.addEventListener("abort",f)));const v=G_(s.url);if(v&&!Be.protocols.includes(v)){r(new Z("Unsupported protocol "+v+":",Z.ERR_BAD_REQUEST,e));return}h.send(i||null)})},dx=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const n=new AbortController;let r=!1;const s=function(l){if(!r){r=!0,o();const d=l instanceof Error?l:this.reason;n.abort(d instanceof Z?d:new as(d instanceof Error?d.message:d))}};let i=t&&setTimeout(()=>{i=null,s(new Z(`timeout of ${t}ms exceeded`,Z.ETIMEDOUT))},t);const o=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(l=>{l.unsubscribe?l.unsubscribe(s):l.removeEventListener("abort",s)}),e=null)};e.forEach(l=>l.addEventListener("abort",s));const{signal:a}=n;return a.unsubscribe=()=>A.asap(o),a},ux=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,s;for(;r<n;)s=r+t,yield e.slice(r,s),r=s},fx=async function*(e,t){for await(const n of px(e))yield*ux(n,t)},px=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},zl=(e,t,n,r)=>{const s=fx(e,t);let i=0,o,a=l=>{o||(o=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:d,value:f}=await s.next();if(d){a(),l.close();return}let u=f.byteLength;if(n){let y=i+=u;n(y)}l.enqueue(new Uint8Array(f))}catch(d){throw a(d),d}},cancel(l){return a(l),s.return()}},{highWaterMark:2})},ci=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,mx=(e,t,n)=>t+2<n&&ci(e.charCodeAt(t+1))&&ci(e.charCodeAt(t+2));function hx(e){if(!e||typeof e!="string"||!e.startsWith("data:"))return 0;const t=e.indexOf(",");if(t<0)return 0;const n=e.slice(5,t),r=e.slice(t+1);if(/;base64/i.test(n)){let o=r.length;const a=r.length;for(let m=0;m<a;m++)if(r.charCodeAt(m)===37&&m+2<a){const g=r.charCodeAt(m+1),p=r.charCodeAt(m+2);ci(g)&&ci(p)&&(o-=2,m+=2)}let l=0,d=a-1;const f=m=>m>=2&&r.charCodeAt(m-2)===37&&r.charCodeAt(m-1)===51&&(r.charCodeAt(m)===68||r.charCodeAt(m)===100);d>=0&&(r.charCodeAt(d)===61?(l++,d--):f(d)&&(l++,d-=3)),l===1&&d>=0&&(r.charCodeAt(d)===61||f(d))&&l++;const y=Math.floor(o/4)*3-(l||0);return y>0?y:0}let i=0;for(let o=0,a=r.length;o<a;o++){const l=r.charCodeAt(o);if(l===37&&mx(r,o,a))i+=1,o+=2;else if(l<128)i+=1;else if(l<2048)i+=2;else if(l>=55296&&l<=56319&&o+1<a){const d=r.charCodeAt(o+1);d>=56320&&d<=57343?(i+=4,o++):i+=3}else i+=3}return i}const gc="1.18.0",Wl=64*1024,{isFunction:As}=A,gx=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16))),Kl=e=>{if(!A.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},ql=(e,...t)=>{try{return!!e(...t)}catch{return!1}},yx=e=>{const t=e.indexOf("://");let n=e;return t!==-1&&(n=n.slice(t+3)),n.includes("@")||n.includes(":")},bx=e=>{const t=A.global!==void 0&&A.global!==null?A.global:globalThis,{ReadableStream:n,TextEncoder:r}=t;e=A.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:s,Request:i,Response:o}=e,a=s?As(s):typeof fetch=="function",l=As(i),d=As(o);if(!a)return!1;const f=a&&As(n),u=a&&(typeof r=="function"?(b=>v=>b.encode(v))(new r):async b=>new Uint8Array(await new i(b).arrayBuffer())),y=l&&f&&ql(()=>{let b=!1;const v=new i(Be.origin,{body:new n,method:"POST",get duplex(){return b=!0,"half"}}),_=v.headers.has("Content-Type");return v.body!=null&&v.body.cancel(),b&&!_}),m=d&&f&&ql(()=>A.isReadableStream(new o("").body)),g={stream:m&&(b=>b.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(b=>{!g[b]&&(g[b]=(v,_)=>{let x=v&&v[b];if(x)return x.call(v);throw new Z(`Response type '${b}' is not supported`,Z.ERR_NOT_SUPPORT,_)})});const p=async b=>{if(b==null)return 0;if(A.isBlob(b))return b.size;if(A.isSpecCompliantForm(b))return(await new i(Be.origin,{method:"POST",body:b}).arrayBuffer()).byteLength;if(A.isArrayBufferView(b)||A.isArrayBuffer(b))return b.byteLength;if(A.isURLSearchParams(b)&&(b=b+""),A.isString(b))return(await u(b)).byteLength},h=async(b,v)=>{const _=A.toFiniteNumber(b.getContentLength());return _??p(v)};return async b=>{let{url:v,method:_,data:x,signal:S,cancelToken:T,timeout:P,onDownloadProgress:O,onUploadProgress:R,responseType:M,headers:N,withCredentials:j="same-origin",fetchOptions:H,maxContentLength:k,maxBodyLength:B}=Sp(b);const F=A.isNumber(k)&&k>-1,L=A.isNumber(B)&&B>-1,D=z=>A.hasOwnProp(b,z)?b[z]:void 0;let $=s||fetch;M=M?(M+"").toLowerCase():"text";let W=dx([S,T&&T.toAbortSignal()],P),I=null;const re=W&&W.unsubscribe&&(()=>{W.unsubscribe()});let J,ue=null;const me=()=>new Z("Request body larger than maxBodyLength limit",Z.ERR_BAD_REQUEST,b,I);try{let z;const q=D("auth");if(q){const X=A.getSafeProp(q,"username")||"",ke=A.getSafeProp(q,"password")||"";z={username:X,password:ke}}if(yx(v)){const X=new URL(v,Be.origin);if(!z&&(X.username||X.password)){const ke=Kl(X.username),Ue=Kl(X.password);z={username:ke,password:Ue}}(X.username||X.password)&&(X.username="",X.password="",v=X.href)}if(z&&(N.delete("authorization"),N.set("Authorization","Basic "+btoa(gx((z.username||"")+":"+(z.password||""))))),F&&typeof v=="string"&&v.startsWith("data:")&&hx(v)>k)throw new Z("maxContentLength size of "+k+" exceeded",Z.ERR_BAD_RESPONSE,b,I);if(L&&_!=="get"&&_!=="head"){const X=await p(x);if(typeof X=="number"&&isFinite(X)&&(J=X,X>B))throw me()}const ie=L&&(A.isReadableStream(x)||A.isStream(x)),he=(X,ke,Ue)=>zl(X,Wl,Qe=>{if(L&&Qe>B)throw ue=me();ke&&ke(Qe)},Ue);if(y&&_!=="get"&&_!=="head"&&(R||ie)){if(J=J??await h(N,x),J!==0||ie){let X=new i(v,{method:"POST",body:x,duplex:"half"}),ke;if(A.isFormData(x)&&(ke=X.headers.get("content-type"))&&N.setContentType(ke),X.body){const[Ue,Qe]=R&&Bl(J,ai($l(R)))||[];x=he(X.body,Ue,Qe)}}}else if(ie&&!l&&f&&_!=="get"&&_!=="head")x=he(x);else if(ie&&l&&!y&&_!=="get"&&_!=="head")throw new Z("Stream request bodies are not supported by the current fetch implementation",Z.ERR_NOT_SUPPORT,b,I);A.isString(j)||(j=j?"include":"omit");const le=l&&"credentials"in i.prototype;if(A.isFormData(x)){const X=N.getContentType();X&&/^multipart\/form-data/i.test(X)&&!/boundary=/i.test(X)&&N.delete("content-type")}N.set("User-Agent","axios/"+gc,!1);const oe={...H,signal:W,method:_.toUpperCase(),headers:fp(N.normalize()),body:x,duplex:"half",credentials:le?j:void 0};I=l&&new i(v,oe);let U=await(l?$(I,H):$(v,oe));const we=ze.from(U.headers);if(F){const X=A.toFiniteNumber(we.getContentLength());if(X!=null&&X>k)throw new Z("maxContentLength size of "+k+" exceeded",Z.ERR_BAD_RESPONSE,b,I)}const Ae=m&&(M==="stream"||M==="response");if(m&&U.body&&(O||F||Ae&&re)){const X={};["status","statusText","headers"].forEach($e=>{X[$e]=U[$e]});const ke=A.toFiniteNumber(we.getContentLength()),[Ue,Qe]=O&&Bl(ke,ai($l(O),!0))||[];let dt=0;const ne=$e=>{if(F&&(dt=$e,dt>k))throw new Z("maxContentLength size of "+k+" exceeded",Z.ERR_BAD_RESPONSE,b,I);Ue&&Ue($e)};U=new o(zl(U.body,Wl,ne,()=>{Qe&&Qe(),re&&re()}),X)}M=M||"text";let Ee=await g[A.findKey(g,M)||"text"](U,b);if(F&&!m&&!Ae){let X;if(Ee!=null&&(typeof Ee.byteLength=="number"?X=Ee.byteLength:typeof Ee.size=="number"?X=Ee.size:typeof Ee=="string"&&(X=typeof r=="function"?new r().encode(Ee).byteLength:Ee.length)),typeof X=="number"&&X>k)throw new Z("maxContentLength size of "+k+" exceeded",Z.ERR_BAD_RESPONSE,b,I)}return!Ae&&re&&re(),await new Promise((X,ke)=>{_p(X,ke,{data:Ee,headers:ze.from(U.headers),status:U.status,statusText:U.statusText,config:b,request:I})})}catch(z){if(re&&re(),W&&W.aborted&&W.reason instanceof Z){const q=W.reason;throw q.config=b,I&&(q.request=I),z!==q&&(q.cause=z),q}throw ue?(I&&!ue.request&&(ue.request=I),ue):z instanceof Z?(I&&!z.request&&(z.request=I),z):z&&z.name==="TypeError"&&/Load failed|fetch/i.test(z.message)?Object.assign(new Z("Network Error",Z.ERR_NETWORK,b,I,z&&z.response),{cause:z.cause||z}):Z.from(z,z&&z.code,b,I,z&&z.response)}}},vx=new Map,Cp=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,i=[r,s,n];let o=i.length,a=o,l,d,f=vx;for(;a--;)l=i[a],d=f.get(l),d===void 0&&f.set(l,d=a?new Map:bx(t)),f=d;return d};Cp();const yc={http:R_,xhr:lx,fetch:{get:Cp}};A.forEach(yc,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const Gl=e=>`- ${e}`,wx=e=>A.isFunction(e)||e===null||e===!1;function _x(e,t){e=A.isArray(e)?e:[e];const{length:n}=e;let r,s;const i={};for(let o=0;o<n;o++){r=e[o];let a;if(s=r,!wx(r)&&(s=yc[(a=String(r)).toLowerCase()],s===void 0))throw new Z(`Unknown adapter '${a}'`);if(s&&(A.isFunction(s)||(s=s.get(t))))break;i[a||"#"+o]=s}if(!s){const o=Object.entries(i).map(([l,d])=>`adapter ${l} `+(d===!1?"is not supported by the environment":"is not available in the build"));let a=n?o.length>1?`since :
|
|
76
|
-
`+o.map(
|
|
77
|
-
`):" "+
|
|
73
|
+
*/var Al;function aw(){return Al||(Al=1,process.env.NODE_ENV!=="production"&&(function(){function e(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=C,n=tm(),r=typeof Object.is=="function"?Object.is:e,s=n.useSyncExternalStore,i=t.useRef,o=t.useEffect,a=t.useMemo,l=t.useDebugValue;po.useSyncExternalStoreWithSelector=function(d,f,u,g,p){var y=i(null);if(y.current===null){var m={hasValue:!1,value:null};y.current=m}else m=y.current;y=a(function(){function b(T){if(!v){if(v=!0,_=T,T=g(T),p!==void 0&&m.hasValue){var P=m.value;if(p(P,T))return x=P}return x=T}if(P=x,r(_,T))return P;var A=g(T);return p!==void 0&&p(P,A)?(_=T,P):(_=T,x=A)}var v=!1,_,x,S=u===void 0?null:u;return[function(){return b(f())},S===null?void 0:function(){return b(S())}]},[f,u,g,p]);var h=s(d,y[0],y[1]);return o(function(){m.hasValue=!0,m.value=h},[h]),l(h),h},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),po}var Ol;function cw(){return Ol||(Ol=1,process.env.NODE_ENV==="production"?Os.exports=ow():Os.exports=aw()),Os.exports}var lw=cw();const dw=rw(lw),nm={},{useDebugValue:uw}=C,{useSyncExternalStoreWithSelector:fw}=dw;let Nl=!1;const mw=e=>e;function pw(e,t=mw,n){(nm?"production":void 0)!=="production"&&n&&!Nl&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),Nl=!0);const r=fw(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return uw(r),r}const Rl=e=>{(nm?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?nw(e):e,n=(r,s)=>pw(t,r,s);return Object.assign(n,t),n},$i=e=>e?Rl(e):Rl,Ll={source:null,entryPrice:null,stopLoss:"",takeProfit:"",side:null,showEntryLine:!1,volumeLots:.01,digits:2,priceStep:.01},ie=$i(e=>({...Ll,setDraft:t=>e(n=>({source:t.source,entryPrice:t.entryPrice!==void 0?t.entryPrice:n.entryPrice,stopLoss:t.stopLoss??n.stopLoss,takeProfit:t.takeProfit??n.takeProfit,side:t.side!==void 0?t.side:n.side,showEntryLine:t.showEntryLine??n.showEntryLine,volumeLots:t.volumeLots??n.volumeLots,digits:t.digits??n.digits,priceStep:t.priceStep??n.priceStep})),setOrderSide:({side:t,entryPrice:n})=>e({side:t,entryPrice:n,showEntryLine:!0}),setStopLoss:t=>e({stopLoss:t}),setTakeProfit:t=>e({takeProfit:t}),setVolumeLots:t=>e({volumeLots:t}),clearEntryLinePreview:()=>e({side:null,entryPrice:null,showEntryLine:!1}),clearDraft:()=>e({...Ll})}));function ho(e,t){return e.toFixed(t)}function hw({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,isDragging:d,sidePanelTab:f="trade",onDragHandlePointerDown:u,onExpandedChange:g,onExpand:p,onPlaceOrder:y}){const[m,h]=C.useState(String(r)),[b,v]=C.useState(null),[_,x]=C.useState(f),S=ie(O=>O.setOrderSide),T=ie(O=>O.setVolumeLots);f!==_&&(x(f),v(null));const P=b??f==="scan";C.useEffect(()=>{g()},[P,g]);const A=()=>{const O=!P;O&&p(),v(O)},D=Number(Vt(Ht(e))),I=t!==null?xe(t,D):"—",N=n!==null?xe(n,D):"—",H=!o&&!a&&l!==""&&(t!==null&&n!==null),R=O=>{const U=Number(m),W=Number.isFinite(U)&&U>0?U:r,j=Math.max(i,W+O*s),ee=ho(j,2);h(ee),T(j)},F=()=>{const O=Number(m);if(!Number.isFinite(O)||O<=0){h(ho(r,2)),T(r);return}const U=Math.max(i,O),W=ho(U,2);h(W),T(U)},M=O=>{t===null||n===null||S({side:O,entryPrice:O==="buy"?n:t})},$=O=>{if(t===null||n===null||!l)return;const U=Number(m),W=Math.max(i,Number.isFinite(U)&&U>0?U:r);S({side:O,entryPrice:O==="buy"?n:t}),y({login:l,side:O,volumeLots:W,bid:t,ask:n})};return c.jsx("div",{className:`web-trading-widget-mini-order${P?" web-trading-widget-mini-order--expanded":" web-trading-widget-mini-order--collapsed"}`,children:c.jsxs("div",{className:"web-trading-widget-mini-order__row",children:[c.jsx("button",{type:"button","aria-label":"Move quick order panel",onPointerDown:u,className:`web-trading-widget-mini-order__drag-handle${d?" web-trading-widget-mini-order__drag-handle--grabbing":""}`,children:c.jsx(Zf,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2})}),P?c.jsxs(c.Fragment,{children:[c.jsxs("button",{type:"button",disabled:!H,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--sell",onMouseDown:()=>M("sell"),onClick:()=>$("sell"),children:[c.jsx("span",{className:"web-trading-widget-mini-order__price",children:I}),c.jsx("span",{className:"web-trading-widget-mini-order__label web-trading-widget-mini-order__label--sell",children:"SELL"})]}),c.jsxs("div",{className:"web-trading-widget-mini-order__volume",children:[c.jsx("button",{type:"button","aria-label":"Decrease volume",disabled:!H,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>R(-1),children:c.jsx(oi,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})}),c.jsx("input",{type:"text",inputMode:"decimal",value:m,disabled:!H,onChange:O=>h(O.target.value),onBlur:F,className:"web-trading-widget-mini-order__volume-input"}),c.jsx("button",{type:"button","aria-label":"Increase volume",disabled:!H,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>R(1),children:c.jsx($o,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})})]}),c.jsxs("button",{type:"button",disabled:!H,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--buy",onMouseDown:()=>M("buy"),onClick:()=>$("buy"),children:[c.jsx("span",{className:"web-trading-widget-mini-order__label web-trading-widget-mini-order__label--buy",children:"BUY"}),c.jsx("span",{className:"web-trading-widget-mini-order__price",children:N})]})]}):null,c.jsx("button",{type:"button","aria-label":P?"Collapse quick order panel":"Expand quick order panel","aria-expanded":P,className:"web-trading-widget-mini-order__toggle",onClick:A,children:P?c.jsx(Iv,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5}):c.jsx(Mv,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5})})]})})}const gw="web-trading-widget-mini-exec-panel-position",rm={x:56,y:96};function Dl(e,t){const n=t==null?void 0:t.offsetParent;if(!t||!n)return e;const r=Math.max(0,n.clientWidth-t.offsetWidth),s=Math.max(0,n.clientHeight-t.offsetHeight);return{x:Math.min(r,Math.max(0,e.x)),y:Math.min(s,Math.max(0,e.y))}}function jl(e,t){e.style.left=`${t.x}px`,e.style.top=`${t.y}px`}function yw(e,t){const n=t==null?void 0:t.offsetParent;return!t||!n?null:{x:e==="top-right"?Math.max(0,n.clientWidth-t.offsetWidth-16):rm.x,y:16}}function bw(e){if(typeof window>"u")return null;try{const t=window.localStorage.getItem(e);if(!t)return null;const n=JSON.parse(t);if(typeof n.x=="number"&&typeof n.y=="number")return{x:n.x,y:n.y}}catch{}return null}function Il(e,t){try{e.hasPointerCapture(t)&&e.releasePointerCapture(t)}catch{}}function sm(e){const t=(e==null?void 0:e.storageKey)??gw,n=(e==null?void 0:e.defaultPosition)??rm,r=e==null?void 0:e.defaultAlign,s=(e==null?void 0:e.isActive)??!0,i=C.useRef(null),[o,a]=C.useState(n),[l,d]=C.useState(!1),f=C.useRef(n),u=C.useRef(null);C.useEffect(()=>{f.current=o},[o]);const g=C.useCallback(m=>{const h=i.current,b=Dl(m,h);f.current=b,a(b),h&&jl(h,b)},[]),p=C.useCallback(()=>{g(f.current)},[g]);C.useEffect(()=>{if(!s)return;const m=bw(t);if(m){g(m);return}const h=r?yw(r,i.current):null;g(h??f.current)},[g,r,s,t]);const y=C.useCallback(m=>{m.preventDefault(),m.stopPropagation();const h=m.currentTarget,b=i.current;if(!b)return;const v=m.pointerId;h.setPointerCapture(v);const _=m.clientX,x=m.clientY,S=f.current;d(!0),document.body.style.cursor="grabbing",document.body.style.userSelect="none";const T=(D,I)=>{const N=Dl({x:S.x+(D-_),y:S.y+(I-x)},b);f.current=N,jl(b,N)},P=D=>{if(D.pointerId===v){Il(h,v),h.removeEventListener("pointermove",A),h.removeEventListener("pointerup",P),h.removeEventListener("pointercancel",P),u.current=null,d(!1),a(f.current),document.body.style.cursor="",document.body.style.userSelect="";try{window.localStorage.setItem(t,JSON.stringify(f.current))}catch{}}},A=D=>{D.pointerId===v&&(D.preventDefault(),T(D.clientX,D.clientY))};h.addEventListener("pointermove",A),h.addEventListener("pointerup",P),h.addEventListener("pointercancel",P),u.current=()=>{Il(h,v),h.removeEventListener("pointermove",A),h.removeEventListener("pointerup",P),h.removeEventListener("pointercancel",P),document.body.style.cursor="",document.body.style.userSelect="",d(!1)}},[t]);return C.useEffect(()=>{const m=()=>{g(f.current)};return window.addEventListener("resize",m),()=>{var h;window.removeEventListener("resize",m),(h=u.current)==null||h.call(u),u.current=null,document.body.style.cursor="",document.body.style.userSelect=""}},[g]),{panelRef:i,position:o,isDragging:l,onDragStart:y,reclamp:p}}const im=200,vw=201,ww=202,_w=203,xw=204,om=0,Sw=2,am=0;function cs(e){const t=Number(e.trim());if(!Number.isFinite(t))throw new Error("Invalid trading account login.");return t}function mc(e){return Math.round(e*1e4)}function Cw(e){return e>=2&&e<=7}function Tw(e){return{Action:xw,Order:Number(e.orderTicket),Login:cs(e.login),Symbol:e.symbol.replace(/m$/i,""),Type:e.orderType}}function Ew(e){return{Action:ww,Login:cs(e.login),Symbol:e.symbol.replace(/m$/i,""),Position:Number(e.positionTicket),Digits:e.digits,Comment:e.comment??"",...e.priceSL!==void 0?{PriceSL:e.priceSL}:{},...e.priceTP!==void 0?{PriceTP:e.priceTP}:{}}}function Pw(e){return{Action:_w,Order:Number(e.orderTicket),Login:cs(e.login),Symbol:e.symbol.replace(/m$/i,""),Type:e.orderType,Volume:mc(e.volumeLots),Digits:e.digits,TypeTime:e.typeTime,Comment:e.comment??"order modify",PriceOrder:e.priceOrder,...e.priceSL!==void 0?{PriceSL:e.priceSL}:{},...e.priceTP!==void 0?{PriceTP:e.priceTP}:{},...e.priceTrigger!==void 0?{PriceTrigger:e.priceTrigger}:{}}}function kw(e){const t=e.positionSide==="buy"?1:0;return{Action:im,Login:cs(e.login),Symbol:e.symbol.replace(/m$/i,""),Type:t,TypeFill:om,Volume:mc(e.volumeLots),Digits:e.digits,TypeTime:am,Comment:e.comment??"",Position:Number(e.positionTicket)}}function Aw(e){const t=!Cw(e.orderType);return{Action:t?im:vw,Login:cs(e.login),Symbol:e.symbol,Type:e.orderType,TypeFill:t?om:Sw,Volume:mc(e.volumeLots),Digits:e.digits,TypeTime:e.typeTime??am,Comment:e.comment,...e.priceOrder!==void 0?{PriceOrder:e.priceOrder}:{},...e.priceSL!==void 0?{PriceSL:e.priceSL}:{},...e.priceTP!==void 0?{PriceTP:e.priceTP}:{},...e.priceTrigger!==void 0?{PriceTrigger:e.priceTrigger}:{},...e.timeExpiration!==void 0?{TimeExpiration:e.timeExpiration}:{}}}function Ow(e){return{async sendRequest(t){return e.post("/api/dealer/send_request",t,{headers:{"Content-Type":"application/json"}})},async getPositions(t){return t.trim()?e.get(`/api/trade/position/page?login=${encodeURIComponent(t)}&offset=0&total=50`):null},async getOrders(t){return t.trim()?e.get(`/api/trade/order/page?login=${encodeURIComponent(t)}&offset=0&total=10`):null},async getDealsTotal(t,n,r){return t.trim()?e.get(`/api/trade/deal/total?login=${encodeURIComponent(t)}&from=${n}&to=${r}`):null},async getDeals(t,n,r,s,i){return t.trim()?e.get(`/api/trade/deal/page?login=${encodeURIComponent(t)}&from=${n}&to=${r}&offset=${s}&total=${i}`):null}}}const Nw=new Set(["10009","10008"]);function Dt(e){if(e===void 0||e==="")return;const t=Number(e);return Number.isFinite(t)?t:void 0}function Rw(e){const t=Dt(e);return t===void 0?.01:t/1e4}function Lw(e){var t;return(t=e.find(n=>n.answer))==null?void 0:t.answer}function Dw(e){var t,n,r,s;for(const i of e){const o=((t=i.result)==null?void 0:t.Retcode)??((n=i.answer)==null?void 0:n.ResultRetcode);if(o)return{retcode:String(o),price:Dt(((r=i.result)==null?void 0:r.Price)??((s=i.answer)==null?void 0:s.ResultPrice))}}return{retcode:""}}function Ur(e){return Nw.has(e)}function Dr(e,t){var v,_,x;if(!e||typeof e!="object")return null;const r=e.data;if(!(r!=null&&r.length))return null;const s=Lw(r),{retcode:i,price:o}=Dw(r),a=Ur(i),l=(s==null?void 0:s.ResultDeal)||(s==null?void 0:s.ResultOrder)||(s==null?void 0:s.Order),d=((v=s==null?void 0:s.Symbol)==null?void 0:v.trim())||t.symbol,f=Ke(d),u=Dt(s==null?void 0:s.Type),g=u!==void 0?u%2===0?"buy":"sell":t.side,p=Dt(s==null?void 0:s.ResultPrice)??Dt(s==null?void 0:s.PriceOrder)??o??t.openPrice,y=Dt(s==null?void 0:s.ResultMarketBid),m=Dt(s==null?void 0:s.ResultMarketAsk),h=g==="buy"?y??p:m??p,b=zv(f);return{ticket:String(l||Math.floor(Date.now()/1e3)),login:((_=s==null?void 0:s.Login)==null?void 0:_.trim())||t.login,symbol:f,displaySymbol:Ii(f),side:g,volumeLots:Rw(s==null?void 0:s.Volume)||t.volumeLots,openPrice:p,currentPrice:h,stopLoss:Dt(s==null?void 0:s.PriceSL),takeProfit:Dt(s==null?void 0:s.PriceTP),comment:((x=s==null?void 0:s.Comment)==null?void 0:x.trim())||t.comment,digits:Math.round(b),retcode:i,isSuccess:a,marketBid:y,marketAsk:m}}function jw(e){return e.type==="buy"?e.marketBid??e.currentPrice:e.marketAsk??e.currentPrice}function Iw(e,t){return{async submitOrder(n){const r=n.login.trim();if(!r)return{success:!1,message:"Please select a trading account."};const s=Math.max(.01,n.volumeLots),i=Ui(n.symbolTicker,t),o=Number(Vt(Ht(n.symbolTicker,t))),a=Fi(n.executionMode),l=cc(n.orderType),d=n.typeTime;if(!a&&n.priceOrder===void 0)return{success:!1,message:l?"Please set a limit price for this order.":"Please set an order price for pending orders."};if(l&&n.priceTrigger===void 0)return{success:!1,message:"Please set a stop price for stop limit orders."};if(!a&&!Bi(d,n.expirationDateTime??"",n.expirationDay??""))return{success:!1,message:"Please set an expiration date for this order."};const f=a?n.side==="buy"?n.ask:n.bid:n.priceOrder??(n.side==="buy"?n.ask:n.bid),u=a?void 0:em(d,n.expirationDateTime??"",n.expirationDay??"");try{const g=Aw({login:r,symbol:i,volumeLots:s,orderType:n.orderType,digits:o,comment:n.comment.trim(),priceOrder:ac(n.orderType)?n.priceOrder:void 0,priceTrigger:l?n.priceTrigger:void 0,priceSL:n.stopLoss,priceTP:n.takeProfit,typeTime:a?void 0:d,timeExpiration:u}),p=await e.sendRequest(g),y=Dr(p,{login:r,symbol:i,side:ci(n.orderType),volumeLots:s,openPrice:f,digits:o,comment:n.comment.trim()});return y!=null&&y.isSuccess?{success:!0,ticket:y.ticket,side:y.side,volumeLots:y.volumeLots,displaySymbol:y.displaySymbol,price:y.openPrice}:{success:!1,message:p&&typeof p=="object"&&"message"in p&&typeof p.message=="string"?p.message:"Order was not accepted by the dealer."}}catch(g){return{success:!1,message:g instanceof Error?g.message:"Failed to place order."}}},async closePosition(n){try{const r=jw(n),s=kw({login:n.login,symbol:n.symbol,positionTicket:n.ticket,volumeLots:n.volumeLots,positionSide:n.type,digits:n.digits,comment:n.comment.trim()}),i=await e.sendRequest(s),o=Dr(i,{login:n.login,symbol:n.symbol,side:n.type==="buy"?"sell":"buy",volumeLots:n.volumeLots,openPrice:r,digits:n.digits,comment:n.comment.trim()});return o&&!Ur(o.retcode)?{success:!1,message:`Close failed (retcode ${o.retcode}).`}:{success:!0}}catch(r){return{success:!1,message:r instanceof Error?r.message:"Failed to close position."}}},async deleteOrder(n){try{const r=Tw({login:n.login,orderTicket:n.ticket,symbol:n.symbol,orderType:n.orderType}),s=await e.sendRequest(r),i=Dr(s,{login:n.login,symbol:n.symbol,side:n.side,volumeLots:n.volumeLots,openPrice:n.orderPrice,digits:n.digits,comment:n.comment});return i&&!Ur(i.retcode)?{success:!1,message:`Delete failed (retcode ${i.retcode}).`}:{success:!0}}catch(r){return{success:!1,message:r instanceof Error?r.message:"Failed to delete order."}}},async modifyOrder(n,r){try{const s=Pw({login:n.login,orderTicket:n.ticket,symbol:n.symbol,orderType:n.orderType,volumeLots:r.volumeLots,digits:n.digits,priceOrder:r.priceOrder,priceTrigger:r.priceTrigger,priceSL:r.stopLoss,priceTP:r.takeProfit,typeTime:n.typeTime,comment:r.comment.trim()||"order modify"}),i=await e.sendRequest(s),o=Dr(i,{login:n.login,symbol:n.symbol,side:n.side,volumeLots:r.volumeLots,openPrice:r.priceOrder,digits:n.digits,comment:r.comment.trim()});return o&&!Ur(o.retcode)?{success:!1,message:`Modify failed (retcode ${o.retcode}).`}:{success:!0}}catch(s){return{success:!1,message:s instanceof Error?s.message:"Failed to modify order."}}},async modifyPosition(n,r){try{const s=Ew({login:n.login,positionTicket:n.ticket,symbol:n.symbol,digits:n.digits,priceSL:r.stopLoss,priceTP:r.takeProfit,comment:r.comment.trim()}),i=await e.sendRequest(s),o=Dr(i,{login:n.login,symbol:n.symbol,side:n.type,volumeLots:n.volumeLots,openPrice:n.openPrice,digits:n.digits,comment:r.comment.trim()});return o&&!Ur(o.retcode)?{success:!1,message:`Modify failed (retcode ${o.retcode}).`}:{success:!0}}catch(s){return{success:!1,message:s instanceof Error?s.message:"Failed to modify position."}}}}}function cm(e,t){return function(){return e.apply(t,arguments)}}const{toString:Mw}=Object.prototype,{getPrototypeOf:gr}=Object,{iterator:ls,toStringTag:lm}=Symbol,li=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Zr=(e,t)=>{let n=e;const r=[];for(;n!=null&&n!==Object.prototype;){if(r.indexOf(n)!==-1)return!1;if(r.push(n),li(n,t))return!0;n=gr(n)}return!1},Fw=(e,t)=>e!=null&&Zr(e,t)?e[t]:void 0,pc=(e=>t=>{const n=Mw.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),_t=e=>(e=e.toLowerCase(),t=>pc(t)===e),Vi=e=>t=>typeof t===e,{isArray:In}=Array,yr=Vi("undefined");function kr(e){return e!==null&&!yr(e)&&e.constructor!==null&&!yr(e.constructor)&&Qe(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const dm=_t("ArrayBuffer");function Uw(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&dm(e.buffer),t}const Bw=Vi("string"),Qe=Vi("function"),um=Vi("number"),Ar=e=>e!==null&&typeof e=="object",$w=e=>e===!0||e===!1,zs=e=>{if(!Ar(e))return!1;const t=gr(e);return(t===null||t===Object.prototype||gr(t)===null)&&!Zr(e,lm)&&!Zr(e,ls)},Vw=e=>{if(!Ar(e)||kr(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Hw=_t("Date"),zw=_t("File"),Ww=e=>!!(e&&typeof e.uri<"u"),Kw=e=>e&&typeof e.getParts<"u",qw=_t("Blob"),Gw=_t("FileList"),Zw=e=>Ar(e)&&Qe(e.pipe);function Yw(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const Ml=Yw(),Fl=typeof Ml.FormData<"u"?Ml.FormData:void 0,Qw=e=>{if(!e)return!1;if(Fl&&e instanceof Fl)return!0;const t=gr(e);if(!t||t===Object.prototype||!Qe(e.append))return!1;const n=pc(e);return n==="formdata"||n==="object"&&Qe(e.toString)&&e.toString()==="[object FormData]"},Xw=_t("URLSearchParams"),[Jw,e_,t_,n_]=["ReadableStream","Request","Response","Headers"].map(_t),r_=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ds(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),In(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(kr(e))return;const i=n?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let a;for(r=0;r<o;r++)a=i[r],t.call(null,e[a],a,e)}}function fm(e,t){if(kr(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r=n.length,s;for(;r-- >0;)if(s=n[r],t===s.toLowerCase())return s;return null}const vn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,mm=e=>!yr(e)&&e!==vn;function Ho(...e){const{caseless:t,skipUndefined:n}=mm(this)&&this||{},r={},s=(i,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const a=t&&typeof o=="string"&&fm(r,o)||o,l=li(r,a)?r[a]:void 0;zs(l)&&zs(i)?r[a]=Ho(l,i):zs(i)?r[a]=Ho({},i):In(i)?r[a]=i.slice():(!n||!yr(i))&&(r[a]=i)};for(let i=0,o=e.length;i<o;i++){const a=e[i];if(!a||kr(a)||(ds(a,s),typeof a!="object"||In(a)))continue;const l=Object.getOwnPropertySymbols(a);for(let d=0;d<l.length;d++){const f=l[d];h_.call(a,f)&&s(a[f],f)}}return r}const s_=(e,t,n,{allOwnKeys:r}={})=>(ds(t,(s,i)=>{n&&Qe(s)?Object.defineProperty(e,i,{__proto__:null,value:cm(s,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,i,{__proto__:null,value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),i_=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),o_=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),n&&Object.assign(e.prototype,n)},a_=(e,t,n,r)=>{let s,i,o;const a={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)o=s[i],(!r||r(o,e,t))&&!a[o]&&(t[o]=e[o],a[o]=!0);e=n!==!1&&gr(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},c_=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},l_=e=>{if(!e)return null;if(In(e))return e;let t=e.length;if(!um(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},d_=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&gr(Uint8Array)),u_=(e,t)=>{const r=(e&&e[ls]).call(e);let s;for(;(s=r.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},f_=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},m_=_t("HTMLFormElement"),p_=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),{propertyIsEnumerable:h_}=Object.prototype,g_=_t("RegExp"),pm=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};ds(n,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(r[i]=o||s)}),Object.defineProperties(e,r)},y_=e=>{pm(e,(t,n)=>{if(Qe(e)&&["arguments","caller","callee"].includes(n))return!1;const r=e[n];if(Qe(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},b_=(e,t)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return In(e)?r(e):r(String(e).split(t)),n},v_=()=>{},w_=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function __(e){return!!(e&&Qe(e.append)&&e[lm]==="FormData"&&e[ls])}const x_=e=>{const t=new WeakSet,n=r=>{if(Ar(r)){if(t.has(r))return;if(kr(r))return r;if(!("toJSON"in r)){t.add(r);const s=In(r)?[]:{};return ds(r,(i,o)=>{const a=n(i);!yr(a)&&(s[o]=a)}),t.delete(r),s}}return r};return n(e)},S_=_t("AsyncFunction"),C_=e=>e&&(Ar(e)||Qe(e))&&Qe(e.then)&&Qe(e.catch),hm=((e,t)=>e?setImmediate:t?((n,r)=>(vn.addEventListener("message",({source:s,data:i})=>{s===vn&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),vn.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Qe(vn.postMessage)),T_=typeof queueMicrotask<"u"?queueMicrotask.bind(vn):typeof process<"u"&&process.nextTick||hm,gm=e=>e!=null&&Qe(e[ls]),E_=e=>e!=null&&Zr(e,ls)&&gm(e),k={isArray:In,isArrayBuffer:dm,isBuffer:kr,isFormData:Qw,isArrayBufferView:Uw,isString:Bw,isNumber:um,isBoolean:$w,isObject:Ar,isPlainObject:zs,isEmptyObject:Vw,isReadableStream:Jw,isRequest:e_,isResponse:t_,isHeaders:n_,isUndefined:yr,isDate:Hw,isFile:zw,isReactNativeBlob:Ww,isReactNative:Kw,isBlob:qw,isRegExp:g_,isFunction:Qe,isStream:Zw,isURLSearchParams:Xw,isTypedArray:d_,isFileList:Gw,forEach:ds,merge:Ho,extend:s_,trim:r_,stripBOM:i_,inherits:o_,toFlatObject:a_,kindOf:pc,kindOfTest:_t,endsWith:c_,toArray:l_,forEachEntry:u_,matchAll:f_,isHTMLForm:m_,hasOwnProperty:li,hasOwnProp:li,hasOwnInPrototypeChain:Zr,getSafeProp:Fw,reduceDescriptors:pm,freezeMethods:y_,toObjectSet:b_,toCamelCase:p_,noop:v_,toFiniteNumber:w_,findKey:fm,global:vn,isContextDefined:mm,isSpecCompliantForm:__,toJSONObject:x_,isAsyncFn:S_,isThenable:C_,setImmediate:hm,asap:T_,isIterable:gm,isSafeIterable:E_},P_=k.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),k_=e=>{const t={};let n,r,s;return e&&e.split(`
|
|
74
|
+
`).forEach(function(o){s=o.indexOf(":"),n=o.substring(0,s).trim().toLowerCase(),r=o.substring(s+1).trim(),!(!n||t[n]&&P_[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t};function A_(e){let t=0,n=e.length;for(;t<n;){const r=e.charCodeAt(t);if(r!==9&&r!==32)break;t+=1}for(;n>t;){const r=e.charCodeAt(n-1);if(r!==9&&r!==32)break;n-=1}return t===0&&n===e.length?e:e.slice(t,n)}const O_=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),N_=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function hc(e,t){return k.isArray(e)?e.map(n=>hc(n,t)):A_(String(e).replace(t,""))}const R_=e=>hc(e,O_),L_=e=>hc(e,N_);function ym(e){const t=Object.create(null);return k.forEach(e.toJSON(),(n,r)=>{t[r]=L_(n)}),t}const Ul=Symbol("internals");function jr(e){return e&&String(e).trim().toLowerCase()}function Ws(e){return e===!1||e==null?e:k.isArray(e)?e.map(Ws):R_(String(e))}function D_(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const j_=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function go(e,t,n,r,s){if(k.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!k.isString(t)){if(k.isString(r))return t.indexOf(r)!==-1;if(k.isRegExp(r))return r.test(t)}}function I_(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function M_(e,t){const n=k.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{__proto__:null,value:function(s,i,o){return this[r].call(this,t,s,i,o)},configurable:!0})})}let We=class{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function i(a,l,d){const f=jr(l);if(!f)return;const u=k.findKey(s,f);(!u||s[u]===void 0||d===!0||d===void 0&&s[u]!==!1)&&(s[u||l]=Ws(a))}const o=(a,l)=>k.forEach(a,(d,f)=>i(d,f,l));if(k.isPlainObject(t)||t instanceof this.constructor)o(t,n);else if(k.isString(t)&&(t=t.trim())&&!j_(t))o(k_(t),n);else if(k.isObject(t)&&k.isSafeIterable(t)){let a=Object.create(null),l,d;for(const f of t){if(!k.isArray(f))throw new TypeError("Object iterator must return a key-value pair");d=f[0],k.hasOwnProp(a,d)?(l=a[d],a[d]=k.isArray(l)?[...l,f[1]]:[l,f[1]]):a[d]=f[1]}o(a,n)}else t!=null&&i(n,t,r);return this}get(t,n){if(t=jr(t),t){const r=k.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return D_(s);if(k.isFunction(n))return n.call(this,s,r);if(k.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=jr(t),t){const r=k.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||go(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function i(o){if(o=jr(o),o){const a=k.findKey(r,o);a&&(!n||go(r,r[a],a,n))&&(delete r[a],s=!0)}}return k.isArray(t)?t.forEach(i):i(t),s}clear(t){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const i=n[r];(!t||go(this,this[i],i,t,!0))&&(delete this[i],s=!0)}return s}normalize(t){const n=this,r={};return k.forEach(this,(s,i)=>{const o=k.findKey(r,i);if(o){n[o]=Ws(s),delete n[i];return}const a=t?I_(i):String(i).trim();a!==i&&delete n[i],n[a]=Ws(s),r[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return k.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&k.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(`
|
|
75
|
+
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[Ul]=this[Ul]={accessors:{}}).accessors,s=this.prototype;function i(o){const a=jr(o);r[a]||(M_(s,o),r[a]=!0)}return k.isArray(t)?t.forEach(i):i(t),this}};We.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);k.reduceDescriptors(We.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});k.freezeMethods(We);const F_="[REDACTED ****]";function U_(e){if(k.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(k.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}function B_(e,t){const n=new Set(t.map(i=>String(i).toLowerCase())),r=[],s=i=>{if(i===null||typeof i!="object"||k.isBuffer(i))return i;if(r.indexOf(i)!==-1)return;i instanceof We&&(i=i.toJSON()),r.push(i);let o;if(k.isArray(i))o=[],i.forEach((a,l)=>{const d=s(a);k.isUndefined(d)||(o[l]=d)});else{if(!k.isPlainObject(i)&&U_(i))return r.pop(),i;o=Object.create(null);for(const[a,l]of Object.entries(i)){const d=n.has(a.toLowerCase())?F_:s(l);k.isUndefined(d)||(o[a]=d)}}return r.pop(),o};return s(e)}let Z=class bm extends Error{static from(t,n,r,s,i,o){const a=new bm(t.message,n||t.code,r,s,i);return a.cause=t,a.name=t.name,t.status!=null&&a.status==null&&(a.status=t.status),o&&Object.assign(a,o),a}constructor(t,n,r,s,i){super(t),Object.defineProperty(this,"message",{__proto__:null,value:t,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),r&&(this.config=r),s&&(this.request=s),i&&(this.response=i,this.status=i.status)}toJSON(){const t=this.config,n=t&&k.hasOwnProp(t,"redact")?t.redact:void 0,r=k.isArray(n)&&n.length>0?B_(t,n):k.toJSONObject(t);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:r,code:this.code,status:this.status}}};Z.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";Z.ERR_BAD_OPTION="ERR_BAD_OPTION";Z.ECONNABORTED="ECONNABORTED";Z.ETIMEDOUT="ETIMEDOUT";Z.ECONNREFUSED="ECONNREFUSED";Z.ERR_NETWORK="ERR_NETWORK";Z.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";Z.ERR_DEPRECATED="ERR_DEPRECATED";Z.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";Z.ERR_BAD_REQUEST="ERR_BAD_REQUEST";Z.ERR_CANCELED="ERR_CANCELED";Z.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";Z.ERR_INVALID_URL="ERR_INVALID_URL";Z.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const $_=null,vm=100;function zo(e){return k.isPlainObject(e)||k.isArray(e)}function wm(e){return k.endsWith(e,"[]")?e.slice(0,-2):e}function yo(e,t,n){return e?e.concat(t).map(function(s,i){return s=wm(s),!n&&i?"["+s+"]":s}).join(n?".":""):t}function V_(e){return k.isArray(e)&&!e.some(zo)}const H_=k.toFlatObject(k,{},null,function(t){return/^is[A-Z]/.test(t)});function Hi(e,t,n){if(!k.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=k.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(v,_){return!k.isUndefined(_[v])});const r=n.metaTokens,s=n.visitor||y,i=n.dots,o=n.indexes,a=n.Blob||typeof Blob<"u"&&Blob,l=n.maxDepth===void 0?vm:n.maxDepth,d=a&&k.isSpecCompliantForm(t),f=[];if(!k.isFunction(s))throw new TypeError("visitor must be a function");function u(b){if(b===null)return"";if(k.isDate(b))return b.toISOString();if(k.isBoolean(b))return b.toString();if(!d&&k.isBlob(b))throw new Z("Blob is not supported. Use a Buffer instead.");return k.isArrayBuffer(b)||k.isTypedArray(b)?d&&typeof Blob=="function"?new Blob([b]):Buffer.from(b):b}function g(b){if(b>l)throw new Z("Object is too deeply nested ("+b+" levels). Max depth: "+l,Z.ERR_FORM_DATA_DEPTH_EXCEEDED)}function p(b,v){if(l===1/0)return JSON.stringify(b);const _=[];return JSON.stringify(b,function(S,T){if(!k.isObject(T))return T;for(;_.length&&_[_.length-1]!==this;)_.pop();return _.push(T),g(v+_.length-1),T})}function y(b,v,_){let x=b;if(k.isReactNative(t)&&k.isReactNativeBlob(b))return t.append(yo(_,v,i),u(b)),!1;if(b&&!_&&typeof b=="object"){if(k.endsWith(v,"{}"))v=r?v:v.slice(0,-2),b=p(b,1);else if(k.isArray(b)&&V_(b)||(k.isFileList(b)||k.endsWith(v,"[]"))&&(x=k.toArray(b)))return v=wm(v),x.forEach(function(T,P){!(k.isUndefined(T)||T===null)&&t.append(o===!0?yo([v],P,i):o===null?v:v+"[]",u(T))}),!1}return zo(b)?!0:(t.append(yo(_,v,i),u(b)),!1)}const m=Object.assign(H_,{defaultVisitor:y,convertValue:u,isVisitable:zo});function h(b,v,_=0){if(!k.isUndefined(b)){if(g(_),f.indexOf(b)!==-1)throw new Error("Circular reference detected in "+v.join("."));f.push(b),k.forEach(b,function(S,T){(!(k.isUndefined(S)||S===null)&&s.call(t,S,k.isString(T)?T.trim():T,v,m))===!0&&h(S,v?v.concat(T):[T],_+1)}),f.pop()}}if(!k.isObject(e))throw new TypeError("data must be an object");return h(e),t}function Bl(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(r){return t[r]})}function gc(e,t){this._pairs=[],e&&Hi(e,this,t)}const _m=gc.prototype;_m.append=function(t,n){this._pairs.push([t,n])};_m.toString=function(t){const n=t?function(r){return t.call(this,r,Bl)}:Bl;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function z_(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function xm(e,t,n){if(!t)return e;const r=k.isFunction(n)?{serialize:n}:n,s=k.getSafeProp(r,"encode")||z_,i=k.getSafeProp(r,"serialize");let o;if(i?o=i(t,r):o=k.isURLSearchParams(t)?t.toString():new gc(t,r).toString(s),o){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class $l{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){k.forEach(this.handlers,function(r){r!==null&&t(r)})}}const yc={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},W_=typeof URLSearchParams<"u"?URLSearchParams:gc,K_=typeof FormData<"u"?FormData:null,q_=typeof Blob<"u"?Blob:null,G_={isBrowser:!0,classes:{URLSearchParams:W_,FormData:K_,Blob:q_},protocols:["http","https","file","blob","url","data"]},bc=typeof window<"u"&&typeof document<"u",Wo=typeof navigator=="object"&&navigator||void 0,Z_=bc&&(!Wo||["ReactNative","NativeScript","NS"].indexOf(Wo.product)<0),Y_=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Q_=bc&&window.location.href||"http://localhost",X_=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:bc,hasStandardBrowserEnv:Z_,hasStandardBrowserWebWorkerEnv:Y_,navigator:Wo,origin:Q_},Symbol.toStringTag,{value:"Module"})),$e={...X_,...G_};function J_(e,t){return Hi(e,new $e.classes.URLSearchParams,{visitor:function(n,r,s,i){return $e.isNode&&k.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}const Vl=vm;function Sm(e){if(e>Vl)throw new Z("FormData field is too deeply nested ("+e+" levels). Max depth: "+Vl,Z.ERR_FORM_DATA_DEPTH_EXCEEDED)}function ex(e){const t=[],n=/\w+|\[(\w*)]/g;let r;for(;(r=n.exec(e))!==null;)Sm(t.length),t.push(r[0]==="[]"?"":r[1]||r[0]);return t}function tx(e){const t={},n=Object.keys(e);let r;const s=n.length;let i;for(r=0;r<s;r++)i=n[r],t[i]=e[i];return t}function Cm(e){function t(n,r,s,i){Sm(i);let o=n[i++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),l=i>=n.length;return o=!o&&k.isArray(s)?s.length:o,l?(k.hasOwnProp(s,o)?s[o]=k.isArray(s[o])?s[o].concat(r):[s[o],r]:s[o]=r,!a):((!k.hasOwnProp(s,o)||!k.isObject(s[o]))&&(s[o]=[]),t(n,r,s[o],i)&&k.isArray(s[o])&&(s[o]=tx(s[o])),!a)}if(k.isFormData(e)&&k.isFunction(e.entries)){const n={};return k.forEachEntry(e,(r,s)=>{t(ex(r),s,n,0)}),n}return null}const Kn=(e,t)=>e!=null&&k.hasOwnProp(e,t)?e[t]:void 0;function nx(e,t,n){if(k.isString(e))try{return(t||JSON.parse)(e),k.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const us={transitional:yc,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=k.isObject(t);if(i&&k.isHTMLForm(t)&&(t=new FormData(t)),k.isFormData(t))return s?JSON.stringify(Cm(t)):t;if(k.isArrayBuffer(t)||k.isBuffer(t)||k.isStream(t)||k.isFile(t)||k.isBlob(t)||k.isReadableStream(t))return t;if(k.isArrayBufferView(t))return t.buffer;if(k.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(i){const l=Kn(this,"formSerializer");if(r.indexOf("application/x-www-form-urlencoded")>-1)return J_(t,l).toString();if((a=k.isFileList(t))||r.indexOf("multipart/form-data")>-1){const d=Kn(this,"env"),f=d&&d.FormData;return Hi(a?{"files[]":t}:t,f&&new f,l)}}return i||s?(n.setContentType("application/json",!1),nx(t)):t}],transformResponse:[function(t){const n=Kn(this,"transitional")||us.transitional,r=n&&n.forcedJSONParsing,s=Kn(this,"responseType"),i=s==="json";if(k.isResponse(t)||k.isReadableStream(t))return t;if(t&&k.isString(t)&&(r&&!s||i)){const a=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(t,Kn(this,"parseReviver"))}catch(l){if(a)throw l.name==="SyntaxError"?Z.from(l,Z.ERR_BAD_RESPONSE,this,null,Kn(this,"response")):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:$e.classes.FormData,Blob:$e.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};k.forEach(["delete","get","head","post","put","patch","query"],e=>{us.headers[e]={}});function bo(e,t){const n=this||us,r=t||n,s=We.from(r.headers);let i=r.data;return k.forEach(e,function(a){i=a.call(n,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function Tm(e){return!!(e&&e.__CANCEL__)}let fs=class extends Z{constructor(t,n,r){super(t??"canceled",Z.ERR_CANCELED,n,r),this.name="CanceledError",this.__CANCEL__=!0}};function Em(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new Z("Request failed with status code "+n.status,n.status>=400&&n.status<500?Z.ERR_BAD_REQUEST:Z.ERR_BAD_RESPONSE,n.config,n.request,n))}function rx(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function sx(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,i=0,o;return t=t!==void 0?t:1e3,function(l){const d=Date.now(),f=r[i];o||(o=d),n[s]=l,r[s]=d;let u=i,g=0;for(;u!==s;)g+=n[u++],u=u%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),d-o<t)return;const p=f&&d-f;return p?Math.round(g*1e3/p):void 0}}function ix(e,t){let n=0,r=1e3/t,s,i;const o=(d,f=Date.now())=>{n=f,s=null,i&&(clearTimeout(i),i=null),e(...d)};return[(...d)=>{const f=Date.now(),u=f-n;u>=r?o(d,f):(s=d,i||(i=setTimeout(()=>{i=null,o(s)},r-u)))},()=>s&&o(s)]}const di=(e,t,n=3)=>{let r=0;const s=sx(50,250);return ix(i=>{if(!i||typeof i.loaded!="number")return;const o=i.loaded,a=i.lengthComputable?i.total:void 0,l=a!=null?Math.min(o,a):o,d=Math.max(0,l-r),f=s(d);r=Math.max(r,l);const u={loaded:l,total:a,progress:a?l/a:void 0,bytes:d,rate:f||void 0,estimated:f&&a?(a-l)/f:void 0,event:i,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(u)},n)},Hl=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},zl=e=>(...t)=>k.asap(()=>e(...t)),ox=$e.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,$e.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL($e.origin),$e.navigator&&/(msie|trident)/i.test($e.navigator.userAgent)):()=>!0,ax=$e.hasStandardBrowserEnv?{write(e,t,n,r,s,i,o){if(typeof document>"u")return;const a=[`${e}=${encodeURIComponent(t)}`];k.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),k.isString(r)&&a.push(`path=${r}`),k.isString(s)&&a.push(`domain=${s}`),i===!0&&a.push("secure"),k.isString(o)&&a.push(`SameSite=${o}`),document.cookie=a.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.split(";");for(let n=0;n<t.length;n++){const r=t[n].replace(/^\s+/,""),s=r.indexOf("=");if(s!==-1&&r.slice(0,s)===e)return decodeURIComponent(r.slice(s+1))}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function cx(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function lx(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const dx=/^https?:(?!\/\/)/i,ux=/[\t\n\r]/g;function fx(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function mx(e){return fx(e).replace(ux,"")}function Wl(e,t){if(typeof e=="string"&&dx.test(mx(e)))throw new Z('Invalid URL: missing "//" after protocol',Z.ERR_INVALID_URL,t)}function Pm(e,t,n,r){Wl(t,r);let s=!cx(t);return e&&(s||n===!1)?(Wl(e,r),lx(e,t)):t}const Kl=e=>e instanceof We?{...e}:e;function Mn(e,t){t=t||{};const n=Object.create(null);Object.defineProperty(n,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function r(f,u,g,p){return k.isPlainObject(f)&&k.isPlainObject(u)?k.merge.call({caseless:p},f,u):k.isPlainObject(u)?k.merge({},u):k.isArray(u)?u.slice():u}function s(f,u,g,p){if(k.isUndefined(u)){if(!k.isUndefined(f))return r(void 0,f,g,p)}else return r(f,u,g,p)}function i(f,u){if(!k.isUndefined(u))return r(void 0,u)}function o(f,u){if(k.isUndefined(u)){if(!k.isUndefined(f))return r(void 0,f)}else return r(void 0,u)}function a(f){const u=k.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!k.isUndefined(u))if(k.isPlainObject(u)){if(k.hasOwnProp(u,f))return u[f]}else return;const g=k.hasOwnProp(e,"transitional")?e.transitional:void 0;if(k.isPlainObject(g)&&k.hasOwnProp(g,f))return g[f]}function l(f,u,g){if(k.hasOwnProp(t,g))return r(f,u);if(k.hasOwnProp(e,g))return r(void 0,f)}const d={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,allowedSocketPaths:o,responseEncoding:o,validateStatus:l,headers:(f,u,g)=>s(Kl(f),Kl(u),g,!0)};return k.forEach(Object.keys({...e,...t}),function(u){if(u==="__proto__"||u==="constructor"||u==="prototype")return;const g=k.hasOwnProp(d,u)?d[u]:s,p=k.hasOwnProp(e,u)?e[u]:void 0,y=k.hasOwnProp(t,u)?t[u]:void 0,m=g(p,y,u);k.isUndefined(m)&&g!==l||(n[u]=m)}),k.hasOwnProp(t,"validateStatus")&&k.isUndefined(t.validateStatus)&&a("validateStatusUndefinedResolves")===!1&&(k.hasOwnProp(e,"validateStatus")?n.validateStatus=r(void 0,e.validateStatus):delete n.validateStatus),n}const px=["content-type","content-length"];function hx(e,t,n){if(n!=="content-only"){e.set(t);return}Object.entries(t).forEach(([r,s])=>{px.includes(r.toLowerCase())&&e.set(r,s)})}const gx=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16)));function km(e){const t=Mn({},e),n=g=>k.hasOwnProp(t,g)?t[g]:void 0,r=n("data");let s=n("withXSRFToken");const i=n("xsrfHeaderName"),o=n("xsrfCookieName");let a=n("headers");const l=n("auth"),d=n("baseURL"),f=n("allowAbsoluteUrls"),u=n("url");if(t.headers=a=We.from(a),t.url=xm(Pm(d,u,f,t),n("params"),n("paramsSerializer")),l){const g=k.getSafeProp(l,"username")||"",p=k.getSafeProp(l,"password")||"";a.set("Authorization","Basic "+btoa(g+":"+(p?gx(p):"")))}if(k.isFormData(r)&&($e.hasStandardBrowserEnv||$e.hasStandardBrowserWebWorkerEnv||k.isReactNative(r)?a.setContentType(void 0):k.isFunction(r.getHeaders)&&hx(a,r.getHeaders(),n("formDataHeaderPolicy"))),$e.hasStandardBrowserEnv&&(k.isFunction(s)&&(s=s(t)),s===!0||s==null&&ox(t.url))){const p=i&&o&&ax.read(o);p&&a.set(i,p)}return t}const yx=typeof XMLHttpRequest<"u",bx=yx&&function(e){return new Promise(function(n,r){const s=km(e);let i=s.data;const o=We.from(s.headers).normalize();let{responseType:a,onUploadProgress:l,onDownloadProgress:d}=s,f,u,g,p,y;function m(){p&&p(),y&&y(),s.cancelToken&&s.cancelToken.unsubscribe(f),s.signal&&s.signal.removeEventListener("abort",f)}let h=new XMLHttpRequest;h.open(s.method.toUpperCase(),s.url,!0),h.timeout=s.timeout;function b(){if(!h)return;const _=We.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),S={data:!a||a==="text"||a==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:_,config:e,request:h};Em(function(P){n(P),m()},function(P){r(P),m()},S),h=null}"onloadend"in h?h.onloadend=b:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.startsWith("file:"))||setTimeout(b)},h.onabort=function(){h&&(r(new Z("Request aborted",Z.ECONNABORTED,e,h)),m(),h=null)},h.onerror=function(x){const S=x&&x.message?x.message:"Network Error",T=new Z(S,Z.ERR_NETWORK,e,h);T.event=x||null,r(T),m(),h=null},h.ontimeout=function(){let x=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const S=s.transitional||yc;s.timeoutErrorMessage&&(x=s.timeoutErrorMessage),r(new Z(x,S.clarifyTimeoutError?Z.ETIMEDOUT:Z.ECONNABORTED,e,h)),m(),h=null},i===void 0&&o.setContentType(null),"setRequestHeader"in h&&k.forEach(ym(o),function(x,S){h.setRequestHeader(S,x)}),k.isUndefined(s.withCredentials)||(h.withCredentials=!!s.withCredentials),a&&a!=="json"&&(h.responseType=s.responseType),d&&([g,y]=di(d,!0),h.addEventListener("progress",g)),l&&h.upload&&([u,p]=di(l),h.upload.addEventListener("progress",u),h.upload.addEventListener("loadend",p)),(s.cancelToken||s.signal)&&(f=_=>{h&&(r(!_||_.type?new fs(null,e,h):_),h.abort(),m(),h=null)},s.cancelToken&&s.cancelToken.subscribe(f),s.signal&&(s.signal.aborted?f():s.signal.addEventListener("abort",f)));const v=rx(s.url);if(v&&!$e.protocols.includes(v)){r(new Z("Unsupported protocol "+v+":",Z.ERR_BAD_REQUEST,e));return}h.send(i||null)})},vx=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const n=new AbortController;let r=!1;const s=function(l){if(!r){r=!0,o();const d=l instanceof Error?l:this.reason;n.abort(d instanceof Z?d:new fs(d instanceof Error?d.message:d))}};let i=t&&setTimeout(()=>{i=null,s(new Z(`timeout of ${t}ms exceeded`,Z.ETIMEDOUT))},t);const o=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(l=>{l.unsubscribe?l.unsubscribe(s):l.removeEventListener("abort",s)}),e=null)};e.forEach(l=>l.addEventListener("abort",s));const{signal:a}=n;return a.unsubscribe=()=>k.asap(o),a},wx=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,s;for(;r<n;)s=r+t,yield e.slice(r,s),r=s},_x=async function*(e,t){for await(const n of xx(e))yield*wx(n,t)},xx=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},ql=(e,t,n,r)=>{const s=_x(e,t);let i=0,o,a=l=>{o||(o=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:d,value:f}=await s.next();if(d){a(),l.close();return}let u=f.byteLength;if(n){let g=i+=u;n(g)}l.enqueue(new Uint8Array(f))}catch(d){throw a(d),d}},cancel(l){return a(l),s.return()}},{highWaterMark:2})},ui=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,Sx=(e,t,n)=>t+2<n&&ui(e.charCodeAt(t+1))&&ui(e.charCodeAt(t+2));function Cx(e){if(!e||typeof e!="string"||!e.startsWith("data:"))return 0;const t=e.indexOf(",");if(t<0)return 0;const n=e.slice(5,t),r=e.slice(t+1);if(/;base64/i.test(n)){let o=r.length;const a=r.length;for(let p=0;p<a;p++)if(r.charCodeAt(p)===37&&p+2<a){const y=r.charCodeAt(p+1),m=r.charCodeAt(p+2);ui(y)&&ui(m)&&(o-=2,p+=2)}let l=0,d=a-1;const f=p=>p>=2&&r.charCodeAt(p-2)===37&&r.charCodeAt(p-1)===51&&(r.charCodeAt(p)===68||r.charCodeAt(p)===100);d>=0&&(r.charCodeAt(d)===61?(l++,d--):f(d)&&(l++,d-=3)),l===1&&d>=0&&(r.charCodeAt(d)===61||f(d))&&l++;const g=Math.floor(o/4)*3-(l||0);return g>0?g:0}let i=0;for(let o=0,a=r.length;o<a;o++){const l=r.charCodeAt(o);if(l===37&&Sx(r,o,a))i+=1,o+=2;else if(l<128)i+=1;else if(l<2048)i+=2;else if(l>=55296&&l<=56319&&o+1<a){const d=r.charCodeAt(o+1);d>=56320&&d<=57343?(i+=4,o++):i+=3}else i+=3}return i}const vc="1.18.0",Gl=64*1024,{isFunction:Rs}=k,Tx=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16))),Zl=e=>{if(!k.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},Yl=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Ex=e=>{const t=e.indexOf("://");let n=e;return t!==-1&&(n=n.slice(t+3)),n.includes("@")||n.includes(":")},Px=e=>{const t=k.global!==void 0&&k.global!==null?k.global:globalThis,{ReadableStream:n,TextEncoder:r}=t;e=k.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:s,Request:i,Response:o}=e,a=s?Rs(s):typeof fetch=="function",l=Rs(i),d=Rs(o);if(!a)return!1;const f=a&&Rs(n),u=a&&(typeof r=="function"?(b=>v=>b.encode(v))(new r):async b=>new Uint8Array(await new i(b).arrayBuffer())),g=l&&f&&Yl(()=>{let b=!1;const v=new i($e.origin,{body:new n,method:"POST",get duplex(){return b=!0,"half"}}),_=v.headers.has("Content-Type");return v.body!=null&&v.body.cancel(),b&&!_}),p=d&&f&&Yl(()=>k.isReadableStream(new o("").body)),y={stream:p&&(b=>b.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(b=>{!y[b]&&(y[b]=(v,_)=>{let x=v&&v[b];if(x)return x.call(v);throw new Z(`Response type '${b}' is not supported`,Z.ERR_NOT_SUPPORT,_)})});const m=async b=>{if(b==null)return 0;if(k.isBlob(b))return b.size;if(k.isSpecCompliantForm(b))return(await new i($e.origin,{method:"POST",body:b}).arrayBuffer()).byteLength;if(k.isArrayBufferView(b)||k.isArrayBuffer(b))return b.byteLength;if(k.isURLSearchParams(b)&&(b=b+""),k.isString(b))return(await u(b)).byteLength},h=async(b,v)=>{const _=k.toFiniteNumber(b.getContentLength());return _??m(v)};return async b=>{let{url:v,method:_,data:x,signal:S,cancelToken:T,timeout:P,onDownloadProgress:A,onUploadProgress:D,responseType:I,headers:N,withCredentials:L="same-origin",fetchOptions:H,maxContentLength:R,maxBodyLength:F}=km(b);const M=k.isNumber(R)&&R>-1,$=k.isNumber(F)&&F>-1,O=V=>k.hasOwnProp(b,V)?b[V]:void 0;let U=s||fetch;I=I?(I+"").toLowerCase():"text";let W=vx([S,T&&T.toAbortSignal()],P),j=null;const ee=W&&W.unsubscribe&&(()=>{W.unsubscribe()});let J,de=null;const ue=()=>new Z("Request body larger than maxBodyLength limit",Z.ERR_BAD_REQUEST,b,j);try{let V;const K=O("auth");if(K){const X=k.getSafeProp(K,"username")||"",Ne=k.getSafeProp(K,"password")||"";V={username:X,password:Ne}}if(Ex(v)){const X=new URL(v,$e.origin);if(!V&&(X.username||X.password)){const Ne=Zl(X.username),Be=Zl(X.password);V={username:Ne,password:Be}}(X.username||X.password)&&(X.username="",X.password="",v=X.href)}if(V&&(N.delete("authorization"),N.set("Authorization","Basic "+btoa(Tx((V.username||"")+":"+(V.password||""))))),M&&typeof v=="string"&&v.startsWith("data:")&&Cx(v)>R)throw new Z("maxContentLength size of "+R+" exceeded",Z.ERR_BAD_RESPONSE,b,j);if($&&_!=="get"&&_!=="head"){const X=await m(x);if(typeof X=="number"&&isFinite(X)&&(J=X,X>F))throw ue()}const se=$&&(k.isReadableStream(x)||k.isStream(x)),Ee=(X,Ne,Be)=>ql(X,Gl,Xe=>{if($&&Xe>F)throw de=ue();Ne&&Ne(Xe)},Be);if(g&&_!=="get"&&_!=="head"&&(D||se)){if(J=J??await h(N,x),J!==0||se){let X=new i(v,{method:"POST",body:x,duplex:"half"}),Ne;if(k.isFormData(x)&&(Ne=X.headers.get("content-type"))&&N.setContentType(Ne),X.body){const[Be,Xe]=D&&Hl(J,di(zl(D)))||[];x=Ee(X.body,Be,Xe)}}}else if(se&&!l&&f&&_!=="get"&&_!=="head")x=Ee(x);else if(se&&l&&!g&&_!=="get"&&_!=="head")throw new Z("Stream request bodies are not supported by the current fetch implementation",Z.ERR_NOT_SUPPORT,b,j);k.isString(L)||(L=L?"include":"omit");const le=l&&"credentials"in i.prototype;if(k.isFormData(x)){const X=N.getContentType();X&&/^multipart\/form-data/i.test(X)&&!/boundary=/i.test(X)&&N.delete("content-type")}N.set("User-Agent","axios/"+vc,!1);const oe={...H,signal:W,method:_.toUpperCase(),headers:ym(N.normalize()),body:x,duplex:"half",credentials:le?L:void 0};j=l&&new i(v,oe);let B=await(l?U(j,H):U(v,oe));const ve=We.from(B.headers);if(M){const X=k.toFiniteNumber(ve.getContentLength());if(X!=null&&X>R)throw new Z("maxContentLength size of "+R+" exceeded",Z.ERR_BAD_RESPONSE,b,j)}const ke=p&&(I==="stream"||I==="response");if(p&&B.body&&(A||M||ke&&ee)){const X={};["status","statusText","headers"].forEach(Ve=>{X[Ve]=B[Ve]});const Ne=k.toFiniteNumber(ve.getContentLength()),[Be,Xe]=A&&Hl(Ne,di(zl(A),!0))||[];let ft=0;const re=Ve=>{if(M&&(ft=Ve,ft>R))throw new Z("maxContentLength size of "+R+" exceeded",Z.ERR_BAD_RESPONSE,b,j);Be&&Be(Ve)};B=new o(ql(B.body,Gl,re,()=>{Xe&&Xe(),ee&&ee()}),X)}I=I||"text";let Pe=await y[k.findKey(y,I)||"text"](B,b);if(M&&!p&&!ke){let X;if(Pe!=null&&(typeof Pe.byteLength=="number"?X=Pe.byteLength:typeof Pe.size=="number"?X=Pe.size:typeof Pe=="string"&&(X=typeof r=="function"?new r().encode(Pe).byteLength:Pe.length)),typeof X=="number"&&X>R)throw new Z("maxContentLength size of "+R+" exceeded",Z.ERR_BAD_RESPONSE,b,j)}return!ke&&ee&&ee(),await new Promise((X,Ne)=>{Em(X,Ne,{data:Pe,headers:We.from(B.headers),status:B.status,statusText:B.statusText,config:b,request:j})})}catch(V){if(ee&&ee(),W&&W.aborted&&W.reason instanceof Z){const K=W.reason;throw K.config=b,j&&(K.request=j),V!==K&&(K.cause=V),K}throw de?(j&&!de.request&&(de.request=j),de):V instanceof Z?(j&&!V.request&&(V.request=j),V):V&&V.name==="TypeError"&&/Load failed|fetch/i.test(V.message)?Object.assign(new Z("Network Error",Z.ERR_NETWORK,b,j,V&&V.response),{cause:V.cause||V}):Z.from(V,V&&V.code,b,j,V&&V.response)}}},kx=new Map,Am=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,i=[r,s,n];let o=i.length,a=o,l,d,f=kx;for(;a--;)l=i[a],d=f.get(l),d===void 0&&f.set(l,d=a?new Map:Px(t)),f=d;return d};Am();const wc={http:$_,xhr:bx,fetch:{get:Am}};k.forEach(wc,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const Ql=e=>`- ${e}`,Ax=e=>k.isFunction(e)||e===null||e===!1;function Ox(e,t){e=k.isArray(e)?e:[e];const{length:n}=e;let r,s;const i={};for(let o=0;o<n;o++){r=e[o];let a;if(s=r,!Ax(r)&&(s=wc[(a=String(r)).toLowerCase()],s===void 0))throw new Z(`Unknown adapter '${a}'`);if(s&&(k.isFunction(s)||(s=s.get(t))))break;i[a||"#"+o]=s}if(!s){const o=Object.entries(i).map(([l,d])=>`adapter ${l} `+(d===!1?"is not supported by the environment":"is not available in the build"));let a=n?o.length>1?`since :
|
|
76
|
+
`+o.map(Ql).join(`
|
|
77
|
+
`):" "+Ql(o[0]):"as no adapter specified";throw new Z("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s}const Om={getAdapter:Ox,adapters:wc};function vo(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new fs(null,e)}function Xl(e){return vo(e),e.headers=We.from(e.headers),e.data=bo.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Om.getAdapter(e.adapter||us.adapter,e)(e).then(function(r){vo(e),e.response=r;try{r.data=bo.call(e,e.transformResponse,r)}finally{delete e.response}return r.headers=We.from(r.headers),r},function(r){if(!Tm(r)&&(vo(e),r&&r.response)){e.response=r.response;try{r.response.data=bo.call(e,e.transformResponse,r.response)}finally{delete e.response}r.response.headers=We.from(r.response.headers)}return Promise.reject(r)})}const zi={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{zi[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Jl={};zi.transitional=function(t,n,r){function s(i,o){return"[Axios v"+vc+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,a)=>{if(t===!1)throw new Z(s(o," has been removed"+(n?" in "+n:"")),Z.ERR_DEPRECATED);return n&&!Jl[o]&&(Jl[o]=!0,console.warn(s(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,o,a):!0}};zi.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function Nx(e,t,n){if(typeof e!="object")throw new Z("options must be an object",Z.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const i=r[s],o=Object.prototype.hasOwnProperty.call(t,i)?t[i]:void 0;if(o){const a=e[i],l=a===void 0||o(a,i,e);if(l!==!0)throw new Z("option "+i+" must be "+l,Z.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Z("Unknown option "+i,Z.ERR_BAD_OPTION)}}const Ks={assertOptions:Nx,validators:zi},He=Ks.validators;let Nn=class{constructor(t){this.defaults=t||{},this.interceptors={request:new $l,response:new $l}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=(()=>{if(!s.stack)return"";const o=s.stack.indexOf(`
|
|
78
78
|
`);return o===-1?"":s.stack.slice(o+1)})();try{if(!r.stack)r.stack=i;else if(i){const o=i.indexOf(`
|
|
79
79
|
`),a=o===-1?-1:i.indexOf(`
|
|
80
80
|
`,o+1),l=a===-1?"":i.slice(a+1);String(r.stack).endsWith(l)||(r.stack+=`
|
|
81
|
-
`+i)}}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Mn(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&Hs.assertOptions(r,{silentJSONParsing:Ve.transitional(Ve.boolean),forcedJSONParsing:Ve.transitional(Ve.boolean),clarifyTimeoutError:Ve.transitional(Ve.boolean),legacyInterceptorReqResOrdering:Ve.transitional(Ve.boolean),advertiseZstdAcceptEncoding:Ve.transitional(Ve.boolean),validateStatusUndefinedResolves:Ve.transitional(Ve.boolean)},!1),s!=null&&(A.isFunction(s)?n.paramsSerializer={serialize:s}:Hs.assertOptions(s,{encode:Ve.function,serialize:Ve.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Hs.assertOptions(n,{baseUrl:Ve.spelling("baseURL"),withXsrfToken:Ve.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&A.merge(i.common,i[n.method]);i&&A.forEach(["delete","get","head","post","put","patch","query","common"],g=>{delete i[g]}),n.headers=ze.concat(o,i);const a=[];let l=!0;this.interceptors.request.forEach(function(p){if(typeof p.runWhen=="function"&&p.runWhen(n)===!1)return;l=l&&p.synchronous;const h=n.transitional||mc;h&&h.legacyInterceptorReqResOrdering?a.unshift(p.fulfilled,p.rejected):a.push(p.fulfilled,p.rejected)});const d=[];this.interceptors.response.forEach(function(p){d.push(p.fulfilled,p.rejected)});let f,u=0,y;if(!l){const g=[Zl.bind(this),void 0];for(g.unshift(...a),g.push(...d),y=g.length,f=Promise.resolve(n);u<y;)f=f.then(g[u++],g[u++]);return f}y=a.length;let m=n;for(;u<y;){const g=a[u++],p=a[u++];try{m=g(m)}catch(h){p.call(this,h);break}}try{f=Zl.call(this,m)}catch(g){return Promise.reject(g)}for(u=0,y=d.length;u<y;)f=f.then(d[u++],d[u++]);return f}getUri(t){t=Mn(this.defaults,t);const n=xp(t.baseURL,t.url,t.allowAbsoluteUrls,t);return yp(n,t.params,t.paramsSerializer)}};A.forEach(["delete","get","head","options"],function(t){kn.prototype[t]=function(n,r){return this.request(Mn(r||{},{method:t,url:n,data:r&&A.hasOwnProp(r,"data")?r.data:void 0}))}});A.forEach(["post","put","patch","query"],function(t){function n(r){return function(i,o,a){return this.request(Mn(a||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}kn.prototype[t]=n(),t!=="query"&&(kn.prototype[t+"Form"]=n(!0))});let Sx=class Tp{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(s=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(a=>{r.subscribe(a),i=a}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},t(function(i,o,a){r.reason||(r.reason=new as(i,o,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new Tp(function(s){t=s}),cancel:t}}};function Cx(e){return function(n){return e.apply(null,n)}}function Ex(e){return A.isObject(e)&&e.isAxiosError===!0}const zo={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(zo).forEach(([e,t])=>{zo[t]=e});function Pp(e){const t=new kn(e),n=rp(kn.prototype.request,t);return A.extend(n,kn.prototype,t,{allOwnKeys:!0}),A.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return Pp(Mn(e,s))},n}const Re=Pp(os);Re.Axios=kn;Re.CanceledError=as;Re.CancelToken=Sx;Re.isCancel=wp;Re.VERSION=gc;Re.toFormData=$i;Re.AxiosError=Z;Re.Cancel=Re.CanceledError;Re.all=function(t){return Promise.all(t)};Re.spread=Cx;Re.isAxiosError=Ex;Re.mergeConfig=Mn;Re.AxiosHeaders=ze;Re.formToJSON=e=>vp(A.isHTMLForm(e)?new FormData(e):e);Re.getAdapter=Ep.getAdapter;Re.HttpStatusCode=zo;Re.default=Re;const{Axios:AT,AxiosError:OT,CanceledError:NT,isCancel:kT,CancelToken:RT,VERSION:LT,all:DT,Cancel:jT,isAxiosError:Ap,spread:IT,toFormData:MT,AxiosHeaders:FT,HttpStatusCode:UT,formToJSON:BT,getAdapter:$T,mergeConfig:VT,create:HT}=Re,Tx="Bearer ",Op="web-trading-token";function Px(){return typeof window>"u"?null:localStorage.getItem(Op)}function br(e){return e.replace(/\/$/,"")}function Ql(e){const t=br(e);async function n(r){const s=Px();return(await Re({...r,baseURL:t,headers:{...r.headers??{},...s?{Authorization:`${Tx}${s}`}:{}}})).data}return{get(r,s){return n({...s,url:r,method:"get"})},post(r,s,i){return n({...i,url:r,method:"post",data:s})}}}function Xl(e){return!e.isDemo&&!e.isArchive&&!!e.tradeStat}function Ax(e){const t=e.filter(n=>Xl(n)&&n.platformType==="mt5");return t.length>0?t:e.filter(Xl)}function Ox(e){const t=e,n=(t==null?void 0:t.accounts)??[];return Ax(n).map(r=>{var s,i,o,a,l;return{id:r.id,login:String(r.login),label:`${r.displayTitle} · ${r.login}`,currency:r.currency,tradeStat:{balance:((s=r.tradeStat)==null?void 0:s.balance)??0,equity:((i=r.tradeStat)==null?void 0:i.equity)??0,margin:((o=r.tradeStat)==null?void 0:o.margin)??0,marginFree:((a=r.tradeStat)==null?void 0:a.marginFree)??0,marginLevel:(l=r.tradeStat)==null?void 0:l.marginLevel}}})}function Nx(e){try{const t=new URL(br(e));return t.hostname.includes("webtrade.")?(t.hostname=t.hostname.replace("webtrade.","api."),t.origin):(t.hostname.startsWith("webtrade")&&(t.hostname=t.hostname.replace(/^webtrade/,"api")),t.origin)}catch{return br(e)}}function kx(e){try{const t=new URL(br(e));return t.hostname.includes("opheleo")?"wss://symbols.opheleo.com":(t.protocol=t.protocol==="https:"?"wss:":"ws:",t.origin)}catch{return"wss://symbols.opheleo.com"}}function Rx(e){const t=br(e),n=Ql(t),r=Nx(t),s=Ql(r),i=_w(n),o=Bt;return{baseUrl:t,platformApiBase:r,tickWebSocketUrl:kx(t),dealer:i,trading:Pw(i,o),async getAccounts(){const a=await s.get("/account-config/api/v1");return Ox(a)}}}const Np=C.createContext(null);function kp({baseUrl:e,children:t}){const n=C.useMemo(()=>Rx(e),[e]);return c.jsx(Np.Provider,{value:n,children:t})}function ct(){const e=C.useContext(Np);if(!e)throw new Error("useWidgetApiClient must be used within WidgetApiProvider");return e}function Rp(){return ct().tickWebSocketUrl}const Lx="wss://symbols.opheleo.com";function bc(e){const[t,n]=C.useState(null),r=Rp();return C.useEffect(()=>{n(null);const s=Ii(e).toUpperCase();let i=null,o=!1;const a=r||Lx,l=()=>{i=new WebSocket(a),i.onopen=()=>{if(o){i==null||i.close(1e3,"Unmounted");return}i==null||i.send(JSON.stringify({action:"select_symbol",symbol:s}))},i.onmessage=d=>{var f;try{const u=JSON.parse(d.data);if(((f=u.symbol)==null?void 0:f.trim().toUpperCase())!==s)return;const m=Number(u.bid),g=Number(u.ask);if(!Number.isFinite(m)||!Number.isFinite(g))return;n({bid:m,ask:g})}catch{}},i.onclose=()=>{o||setTimeout(l,3e3)}};return l(),()=>{o=!0,i==null||i.close(1e3,"Unmounted")}},[e,r]),t}function Dx({symbolTicker:e,sidePanelTab:t,orderState:n,backUrl:r,createAccountUrl:s}){const i=bc(e),{panelRef:o,position:a,isDragging:l,onDragStart:d,reclamp:f}=Jf(),{panel:u,isSubmitting:y,defaultVolumeLots:m,volumeStep:g,minVolumeLots:p,accountOptions:h,selectedLogin:b,isAccountsLoading:v,hasConfirmedAccount:_,needsAccountSelection:x,confirmAccountSelection:S,placeMarketOrder:T}=n,P=se(j=>j.setDraft),O=se(j=>j.clearDraft),R=Number(Vt(Ht(e))),M=Pr(R);C.useEffect(()=>{_&&P({source:"new-order",entryPrice:null,side:null,showEntryLine:!1,volumeLots:m,digits:R,priceStep:M})},[m,R,_,M,P]),C.useEffect(()=>{(u==="closed"||u==="confirmation")&&O()},[O,u]);const N=j=>{T({symbolTicker:e,login:j.login,executionMode:"market",side:j.side,orderType:j.side==="buy"?Ge.BUY:Ge.SELL,volumeLots:j.volumeLots,stopLoss:"",takeProfit:"",priceOrder:"",priceTrigger:"",comment:"",typeTime:mt.GTC,expirationDateTime:"",expirationDay:"",bid:j.bid,ask:j.ask})};return c.jsxs(c.Fragment,{children:[c.jsx($f,{open:x,isAccountsLoading:v,accountOptions:h,onConfirm:S,backUrl:r,createAccountUrl:s}),_&&c.jsx("div",{ref:o,style:{left:a.x,top:a.y},className:`web-trading-widget-new-order-overlay${l?" web-trading-widget-new-order-overlay--dragging":""}`,children:c.jsx(cw,{symbolTicker:e,bid:(i==null?void 0:i.bid)??null,ask:(i==null?void 0:i.ask)??null,defaultVolumeLots:m,volumeStep:g,minVolumeLots:p,isSubmitting:y,isAccountsLoading:v,selectedLogin:b,isDragging:l,sidePanelTab:t,onDragHandlePointerDown:d,onExpandedChange:f,onExpand:f,onPlaceOrder:N})})]})}function jx(e,t){const n=Number(e),r=Number(t);return Number.isFinite(n)&&Number.isFinite(r)&&n!==r?n-r:e.localeCompare(t,void 0,{numeric:!0})}function Ix(e,t){return e.openTimeMs!==t.openTimeMs?e.openTimeMs-t.openTimeMs:jx(e.ticket,t.ticket)}function Jl(e){return[...e].sort(Ix)}function ed(e){return Ye(e).toUpperCase()}const ve=Fi(e=>({positions:[],orders:[],liveQuotes:{},selectedLogin:"",selectedPositionTicket:null,selectedOrderTicket:null,setSelectedLogin:t=>{e({selectedLogin:t})},setSelectedPositionTicket:t=>{e(n=>({selectedPositionTicket:t,selectedOrderTicket:t!==null?null:n.selectedOrderTicket}))},setSelectedOrderTicket:t=>{e(n=>({selectedOrderTicket:t,selectedPositionTicket:t!==null?null:n.selectedPositionTicket}))},setPositions:t=>{e({positions:Jl(t)})},setOrders:t=>{e({orders:Jl(t)})},removePosition:t=>{e(n=>({positions:n.positions.filter(r=>r.ticket!==t),selectedPositionTicket:n.selectedPositionTicket===t?null:n.selectedPositionTicket}))},removeOrder:t=>{e(n=>({orders:n.orders.filter(r=>r.ticket!==t),selectedOrderTicket:n.selectedOrderTicket===t?null:n.selectedOrderTicket}))},updateQuotes:(t,n,r)=>{const s=ed(t);e(i=>{const o={...i.liveQuotes,[s]:{bid:n,ask:r}};return{liveQuotes:o,positions:i.positions.map(a=>Hv(a,s,n,r,o)),orders:i.orders.map(a=>{if(ed(a.symbol)!==s)return a;const l=a.side==="buy"?n:r;return{...a,currentPrice:l}})}})},clearPositions:()=>{e({positions:[],orders:[],liveQuotes:{}})}})),Mx="wss://symbols.opheleo.com";function Fx(e,t){const n=new Set;for(const r of e){const s=Ye(r.symbol).toUpperCase();s&&n.add(s)}for(const r of t){const s=Ye(r.symbol).toUpperCase();s&&n.add(s)}for(const r of $v([...n]))n.add(r);return[...n].sort().join("|")}function Ux(e){return Fx(e.positions,e.orders)}function Bx(){const e=ve(Ux),t=ve(r=>r.updateQuotes),n=Rp();C.useEffect(()=>{if(!e)return;const r=e.split("|"),s=new Map;let i=!1;const o=n||Mx,a=l=>{const d=new WebSocket(o);s.set(l,d),d.onopen=()=>{if(i){d.close(1e3,"Unmounted");return}d.send(JSON.stringify({action:"select_symbol",symbol:l}))},d.onmessage=f=>{var u;try{const y=JSON.parse(f.data),m=(u=y.symbol)==null?void 0:u.trim().toUpperCase();if(!m||m!==l)return;const g=Number(y.bid),p=Number(y.ask);if(!Number.isFinite(g)||!Number.isFinite(p))return;t(m,g,p)}catch{}},d.onclose=()=>{s.delete(l),i||setTimeout(()=>a(l),3e3)}};for(const l of r)a(l);return()=>{i=!0;for(const l of s.values())l.close(1e3,"Unmounted");s.clear()}},[e,n,t])}function Lp(){return Bx(),null}const Dp={buy:"#2563eb",sell:"#dc2626"},bo={positive:"#2563eb",negative:"#dc2626",neutral:"#94a3b8"},vo={linewidth:1,linestyle:2,fontsize:11},jp={stopLoss:"#f97316",takeProfit:"#22c55e"},Ip=e=>Dp[e],Wo=(e,t)=>e==="entry"?t!=null?Ip(t):Dp.sell:jp[e],td=(e,t)=>{if(e==="entry")return Wo(e,t.side);const{side:n,entryPrice:r,linePrice:s,volumeLots:i}=t;if(n!=null&&r!==null&&r!==void 0&&s!==void 0&&i!==void 0){const o=Mp(n,r,s,i);return Fp(o)}return jp[e]},Mp=(e,t,n,r)=>(e==="buy"?n-t:t-n)*r*100,$x=(e,t)=>!Number.isFinite(t)||t<=0?0:Math.round(e/t),Vx=e=>{const t=Mp(e.side,e.entryPrice,e.linePrice,e.volumeLots),n=e.side==="buy"?e.linePrice-e.entryPrice:e.entryPrice-e.linePrice,r=$x(n,e.priceStep),s=e.kind==="takeProfit"?"TP":"SL",i=`${t.toFixed(2)} USD`,o=`${r} points`;return`${s} ${i}, ${o}`},Hx=(e,t)=>e.toFixed(t),Fp=e=>e>0?bo.positive:e<0?bo.negative:bo.neutral,zx=e=>{const t=`${e.side.toUpperCase()} ${e.volumeLots.toFixed(2)}, `,n=`${e.profit.toFixed(2)} USD`;return`${t}${n}`},nd=e=>{const t=Ip(e.side),n=Fp(e.profit);return{text:zx(e),linecolor:t,textcolor:n,linewidth:vo.linewidth,linestyle:vo.linestyle,fontsize:vo.fontsize,showPrice:!0,horzLabelsAlign:"left"}},rd=e=>ht(e),Wx=e=>e==="entry"||e==="stopLoss"||e==="takeProfit",wo=e=>{e.setUserEditEnabled(!1),e.setSelectionEnabled(!1)},sd=(e,t,n)=>{if(e==="entry")return Hx(t,n.digits);const{entryPrice:r,side:s}=n;return s!==null&&r!==null?Vx({kind:e,side:s,entryPrice:r,linePrice:t,volumeLots:n.volumeLots,priceStep:n.priceStep}):`${e==="takeProfit"?"TP":"SL"} ${Pe(t,n.digits)}`},Kx=({chartWidget:e})=>{const t=se(S=>S.source),n=se(S=>S.entryPrice),r=se(S=>S.stopLoss),s=se(S=>S.takeProfit),i=se(S=>S.side),o=se(S=>S.showEntryLine),a=se(S=>S.volumeLots),l=se(S=>S.digits),d=se(S=>S.priceStep),f=se(S=>S.setStopLoss),u=se(S=>S.setTakeProfit),y=C.useRef({}),m=C.useRef(null),g=C.useRef(null),p=C.useRef({entryPrice:n,stopLoss:r,takeProfit:s,side:i,showEntryLine:o,volumeLots:a,digits:l,priceStep:d});C.useEffect(()=>{p.current={entryPrice:n,stopLoss:r,takeProfit:s,side:i,showEntryLine:o,volumeLots:a,digits:l,priceStep:d}},[l,n,d,o,i,r,s,a]);const h=C.useCallback(S=>{if(!e)return;const T=y.current[S];if(T){try{e.activeChart().removeEntity(T)}catch{}delete y.current[S]}},[e]),b=C.useCallback((S,T,P,O)=>{const R=Wo(T,O.side),M=td(T,{side:O.side,entryPrice:O.entryPrice,linePrice:P,volumeLots:O.volumeLots});S.setProperties({text:sd(T,P,O),linecolor:R,textcolor:M,showPrice:!0,horzLabelsAlign:"left"})},[]),v=C.useCallback(async(S,T,P)=>{var H;if(!e)return;if(T===void 0){h(S);return}if(m.current===S)return;const O=e.activeChart(),R=Wo(S,P.side),M=td(S,{side:P.side,entryPrice:P.entryPrice,linePrice:T,volumeLots:P.volumeLots}),N=sd(S,T,P),j=y.current[S];if(j)try{const k=O.getShapeById(j);S==="entry"&&wo(k);const B=(H=k.getPoints()[0])==null?void 0:H.price;if(B!==void 0&&Math.abs(B-T)<P.priceStep/2){k.setProperties({text:N,linecolor:R,textcolor:M,showPrice:!0,horzLabelsAlign:"left"});return}const F=k.getPoints();if(F.length>0){k.setPoints(F.map(L=>({...L,price:T}))),k.setProperties({text:N,linecolor:R,textcolor:M,showPrice:!0,horzLabelsAlign:"left"});return}}catch{delete y.current[S]}try{const k=O.getVisibleRange(),B=await O.createShape({time:k.from,price:T},{shape:"horizontal_line",text:N,disableSave:!0,lock:S==="entry",disableSelection:S==="entry",overrides:{linecolor:R,textcolor:M,linewidth:2,showPrice:!0,horzLabelsAlign:"left"}});if(S==="entry"&&!p.current.showEntryLine){try{O.removeEntity(B)}catch{}return}if(S==="entry")try{wo(O.getShapeById(B))}catch{}y.current[S]=B}catch{}},[e,h]),_=C.useCallback(async S=>{const T=rd(S.stopLoss),P=rd(S.takeProfit);S.showEntryLine&&S.entryPrice!==null?await v("entry",S.entryPrice,S):await v("entry",void 0,S),await v("stopLoss",T,S),await v("takeProfit",P,S)},[v]),x=t!==null&&(o||r.trim()!==""||s.trim()!=="");C.useEffect(()=>{if(!e||!x)return;const S=(T,P)=>{var N,j,H;const O=(N=Object.entries(y.current).find(([,k])=>k===T))==null?void 0:N[0];if(!O||!Wx(O))return;const M=e.activeChart().getAllShapes().filter(k=>k.name==="horizontal_line").some(k=>k.id===T);if(O==="entry"){if((P==="move"||P==="points_changed")&&M){const k=p.current;if(k.entryPrice!==null)try{const B=e.activeChart().getShapeById(T),F=(j=B.getPoints()[0])==null?void 0:j.price;if(F!==void 0&&Math.abs(F-k.entryPrice)>=k.priceStep/2){const L=B.getPoints();L.length>0&&B.setPoints(L.map(D=>({...D,price:k.entryPrice})))}wo(B)}catch{}}return}if(P==="remove"&&M){m.current=null,O==="stopLoss"&&f(""),O==="takeProfit"&&u(""),delete y.current[O];return}if(!(P!=="move"&&P!=="points_changed"&&!M))try{const k=e.activeChart().getShapeById(T),B=(H=k.getPoints()[0])==null?void 0:H.price;if(!Number.isFinite(B)||B<=0)return;const F=p.current;if(P==="points_changed"&&M){m.current=O,b(k,O,B,F),g.current!==null&&clearTimeout(g.current),g.current=setTimeout(()=>{m.current=null;const $=Pe(B,p.current.digits);O==="stopLoss"?f($):u($)},120);return}g.current!==null&&(clearTimeout(g.current),g.current=null),m.current=null;const L=Pe(B,F.digits),D=O==="stopLoss"?{...F,stopLoss:L}:{...F,takeProfit:L};O==="stopLoss"?f(L):u(L),b(k,O,B,D)}catch{m.current=null}};try{e.subscribe("drawing_event",S)}catch{}return()=>{m.current=null,g.current!==null&&(clearTimeout(g.current),g.current=null);try{e.unsubscribe("drawing_event",S)}catch{}}},[e,x,f,u,b]),C.useEffect(()=>{if(!e||t===null)return;let S=!1;try{e.onChartReady(()=>{S||_(p.current)})}catch{}return()=>{S=!0}},[e,t,n,r,s,i,o,a,l,d,_])},id=e=>{e.setUserEditEnabled(!1),e.setSelectionEnabled(!1)},Up=(e,t)=>Ye(e.symbol).toUpperCase()===t,qx=e=>ve.getState().positions.filter(t=>Up(t,e)).map(t=>({ticket:t.ticket,openPrice:t.openPrice,type:t.type,digits:t.digits,volumeLots:t.volumeLots,profit:t.profit})),od=(e,t,n)=>{try{const r=e.activeChart().symbol(),s=n.find(i=>i.display_name===r||i.ticker===r);if(s)return qf(s.ticker,n)}catch{}return t},Gx=(e,t,n)=>{var i;const r=(i=e.getPoints()[0])==null?void 0:i.price;if(r!==void 0&&Math.abs(r-t)<Number.EPSILON){e.setProperties(n);return}const s=e.getPoints();s.length>0&&e.setPoints(s.map(o=>({...o,price:t}))),e.setProperties(n)},Zx=({chartWidget:e,symbolTicker:t,symbols:n})=>{const r=ve(g=>g.positions),s=C.useRef(new Map),i=C.useRef(0),o=C.useMemo(()=>qf(t,n),[t,n]),a=C.useMemo(()=>r.filter(g=>Up(g,o)).map(g=>`${g.ticket}:${g.openPrice}:${g.type}:${g.digits}:${g.volumeLots}:${g.profit.toFixed(2)}`).sort().join("|"),[o,r]),l=C.useCallback(g=>{if(!e)return;const p=s.current.get(g);if(p){try{e.activeChart().removeEntity(p)}catch{}s.current.delete(g)}},[e]),d=C.useCallback(()=>{for(const g of[...s.current.keys()])l(g);s.current.clear()},[l]),f=C.useCallback(async(g,p,h)=>{const b=nd({side:p.type,volumeLots:p.volumeLots,profit:p.profit}),_={time:g.getVisibleRange().from,price:p.openPrice},x=await g.createShape(_,{shape:"horizontal_line",text:String(b.text),disableSave:!0,lock:!0,disableSelection:!0,overrides:b});if(h!==i.current){try{g.removeEntity(x)}catch{}return null}try{id(g.getShapeById(x))}catch{}return x},[]),u=C.useCallback(async(g,p)=>{if(!e||p!==i.current)return;const h=e.activeChart(),b=nd({side:g.type,volumeLots:g.volumeLots,profit:g.profit}),v=s.current.get(g.ticket);if(v)try{Gx(h.getShapeById(v),g.openPrice,b),id(h.getShapeById(v));return}catch{s.current.delete(g.ticket)}if(p===i.current)try{const _=await f(h,g,p);if(!_)return;s.current.set(g.ticket,_)}catch{}},[e,f]),y=C.useCallback(async(g,p)=>{if(!e||g!==i.current)return;const h=qx(p),b=new Set(h.map(v=>v.ticket));for(const v of s.current.keys())b.has(v)||l(v);for(const v of h){if(g!==i.current)return;await u(v,g)}},[e,l,u]),m=C.useCallback(g=>{if(!e)return;const p=i.current+1;i.current=p,g!=null&&g.resetLineIds&&d();const h=(g==null?void 0:g.symbolKey)??od(e,o,n);y(p,h)},[o,e,d,n,y]);C.useEffect(()=>{if(!e)return;let g=!1,p=null;const h=()=>{g||m({resetLineIds:!0,symbolKey:od(e,o,n)})};let b=!1;const v=()=>{b=!0,h()},_=()=>{g||!b||(b=!1,m({symbolKey:o}))};try{e.onChartReady(()=>{if(!g)try{p=e.activeChart(),m({resetLineIds:!0,symbolKey:o}),p.onSymbolChanged().subscribe(null,v),p.onDataLoaded().subscribe(null,_)}catch{}})}catch{}return()=>{if(g=!0,i.current+=1,p)try{p.onSymbolChanged().unsubscribe(null,v),p.onDataLoaded().unsubscribe(null,_)}catch{}d()}},[o,e,d,m,n]),C.useEffect(()=>{if(!e)return;let g=!1;try{e.onChartReady(()=>{g||m({symbolKey:o})})}catch{}return()=>{g=!0}},[o,e,a,m])},Bp=({chartWidget:e,symbolTicker:t,symbols:n})=>(Zx({chartWidget:e,symbolTicker:t,symbols:n}),Kx({chartWidget:e}),null);var cs=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},_n,Qt,er,Yd,Yx=(Yd=class extends cs{constructor(){super();te(this,_n);te(this,Qt);te(this,er);K(this,er,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){E(this,Qt)||this.setEventListener(E(this,er))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,Qt))==null||t.call(this),K(this,Qt,void 0))}setEventListener(t){var n;K(this,er,t),(n=E(this,Qt))==null||n.call(this),K(this,Qt,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){E(this,_n)!==t&&(K(this,_n,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof E(this,_n)=="boolean"?E(this,_n):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},_n=new WeakMap,Qt=new WeakMap,er=new WeakMap,Yd),vc=new Yx,Qx={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Ct,xn,Qd,Xx=(Qd=class{constructor(){te(this,Ct,Qx);te(this,xn,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&E(this,xn)&&e!==E(this,Ct)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:E(this,Ct),provider:e}),K(this,Ct,e),process.env.NODE_ENV!=="production"&&K(this,xn,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&K(this,xn,!0),E(this,Ct).setTimeout(e,t)}clearTimeout(e){E(this,Ct).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&K(this,xn,!0),E(this,Ct).setInterval(e,t)}clearInterval(e){E(this,Ct).clearInterval(e)}},Ct=new WeakMap,xn=new WeakMap,Qd),wn=new Xx;function Jx(e){setTimeout(e,0)}var eS=typeof window>"u"||"Deno"in globalThis;function qe(){}function tS(e,t){return typeof e=="function"?e(t):e}function Ko(e){return typeof e=="number"&&e>=0&&e!==1/0}function $p(e,t){return Math.max(e+(t||0)-Date.now(),0)}function an(e,t){return typeof e=="function"?e(t):e}function et(e,t){return typeof e=="function"?e(t):e}function ad(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:i,queryKey:o,stale:a}=e;if(o){if(r){if(t.queryHash!==wc(o,t.options))return!1}else if(!qr(t.queryKey,o))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||s&&s!==t.state.fetchStatus||i&&!i(t))}function cd(e,t){const{exact:n,status:r,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Kr(t.options.mutationKey)!==Kr(i))return!1}else if(!qr(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function wc(e,t){return((t==null?void 0:t.queryKeyHashFn)||Kr)(e)}function Kr(e){return JSON.stringify(e,(t,n)=>Zo(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function qr(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>qr(e[n],t[n])):!1}var nS=Object.prototype.hasOwnProperty;function qo(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=ld(e)&&ld(t);if(!r&&!(Zo(e)&&Zo(t)))return t;const i=(r?e:Object.keys(e)).length,o=r?t:Object.keys(t),a=o.length,l=r?new Array(a):{};let d=0;for(let f=0;f<a;f++){const u=r?f:o[f],y=e[u],m=t[u];if(y===m){l[u]=y,(r?f<i:nS.call(e,u))&&d++;continue}if(y===null||m===null||typeof y!="object"||typeof m!="object"){l[u]=m;continue}const g=qo(y,m,n+1);l[u]=g,g===y&&d++}return i===a&&d===i?e:l}function Go(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function ld(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Zo(e){if(!dd(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!dd(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function dd(e){return Object.prototype.toString.call(e)==="[object Object]"}function rS(e){return new Promise(t=>{wn.setTimeout(t,e)})}function Yo(e,t,n){if(typeof n.structuralSharing=="function")return n.structuralSharing(e,t);if(n.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return qo(e,t)}catch(r){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${r}`),r}return qo(e,t)}return t}function sS(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function iS(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var li=Symbol();function Vp(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===li&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===li?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Hp(e,t){return typeof e=="function"?e(...t):!!e}function oS(e,t,n){let r=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??(s=t()),r||(r=!0,s.aborted?n():s.addEventListener("abort",n,{once:!0})),s)}),e}var Gr=(()=>{let e=()=>eS;return{isServer(){return e()},setIsServer(t){e=t}}})();function Qo(){let e,t;const n=new Promise((s,i)=>{e=s,t=i});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),e(s)},n.reject=s=>{r({status:"rejected",reason:s}),t(s)},n}var aS=Jx;function cS(){let e=[],t=0,n=a=>{a()},r=a=>{a()},s=aS;const i=a=>{t?e.push(a):s(()=>{n(a)})},o=()=>{const a=e;e=[],a.length&&s(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;t++;try{l=a()}finally{t--,t||o()}return l},batchCalls:a=>(...l)=>{i(()=>{a(...l)})},schedule:i,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{s=a}}}var Fe=cS(),tr,Xt,nr,Xd,lS=(Xd=class extends cs{constructor(){super();te(this,tr,!0);te(this,Xt);te(this,nr);K(this,nr,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){E(this,Xt)||this.setEventListener(E(this,nr))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,Xt))==null||t.call(this),K(this,Xt,void 0))}setEventListener(t){var n;K(this,nr,t),(n=E(this,Xt))==null||n.call(this),K(this,Xt,t(this.setOnline.bind(this)))}setOnline(t){E(this,tr)!==t&&(K(this,tr,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return E(this,tr)}},tr=new WeakMap,Xt=new WeakMap,nr=new WeakMap,Xd),di=new lS;function dS(e){return Math.min(1e3*2**e,3e4)}function zp(e){return(e??"online")==="online"?di.isOnline():!0}var Xo=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Wp(e){let t=!1,n=0,r;const s=Qo(),i=()=>s.status!=="pending",o=p=>{var h;if(!i()){const b=new Xo(p);y(b),(h=e.onCancel)==null||h.call(e,b)}},a=()=>{t=!0},l=()=>{t=!1},d=()=>vc.isFocused()&&(e.networkMode==="always"||di.isOnline())&&e.canRun(),f=()=>zp(e.networkMode)&&e.canRun(),u=p=>{i()||(r==null||r(),s.resolve(p))},y=p=>{i()||(r==null||r(),s.reject(p))},m=()=>new Promise(p=>{var h;r=b=>{(i()||d())&&p(b)},(h=e.onPause)==null||h.call(e)}).then(()=>{var p;r=void 0,i()||(p=e.onContinue)==null||p.call(e)}),g=()=>{if(i())return;let p;const h=n===0?e.initialPromise:void 0;try{p=h??e.fn()}catch(b){p=Promise.reject(b)}Promise.resolve(p).then(u).catch(b=>{var T;if(i())return;const v=e.retry??(Gr.isServer()?0:3),_=e.retryDelay??dS,x=typeof _=="function"?_(n,b):_,S=v===!0||typeof v=="number"&&n<v||typeof v=="function"&&v(n,b);if(t||!S){y(b);return}n++,(T=e.onFail)==null||T.call(e,n,b),rS(x).then(()=>d()?void 0:m()).then(()=>{t?y(b):g()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(r==null||r(),s),cancelRetry:a,continueRetry:l,canStart:f,start:()=>(f()?g():m().then(g),s)}}var Sn,Jd,Kp=(Jd=class{constructor(){te(this,Sn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Ko(this.gcTime)&&K(this,Sn,wn.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Gr.isServer()?1/0:300*1e3))}clearGcTimeout(){E(this,Sn)!==void 0&&(wn.clearTimeout(E(this,Sn)),K(this,Sn,void 0))}},Sn=new WeakMap,Jd);function uS(e){return{onFetch:(t,n)=>{var f,u,y,m,g;const r=t.options,s=(y=(u=(f=t.fetchOptions)==null?void 0:f.meta)==null?void 0:u.fetchMore)==null?void 0:y.direction,i=((m=t.state.data)==null?void 0:m.pages)||[],o=((g=t.state.data)==null?void 0:g.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const d=async()=>{let p=!1;const h=_=>{oS(_,()=>t.signal,()=>p=!0)},b=Vp(t.options,t.fetchOptions),v=async(_,x,S)=>{if(p)return Promise.reject(t.signal.reason);if(x==null&&_.pages.length)return Promise.resolve(_);const P=(()=>{const N={client:t.client,queryKey:t.queryKey,pageParam:x,direction:S?"backward":"forward",meta:t.options.meta};return h(N),N})(),O=await b(P),{maxPages:R}=t.options,M=S?iS:sS;return{pages:M(_.pages,O,R),pageParams:M(_.pageParams,x,R)}};if(s&&i.length){const _=s==="backward",x=_?fS:ud,S={pages:i,pageParams:o},T=x(r,S);a=await v(S,T,_)}else{const _=e??i.length;do{const x=l===0?o[0]??r.initialPageParam:ud(r,a);if(l>0&&x==null)break;a=await v(a,x),l++}while(l<_)}return a};t.options.persister?t.fetchFn=()=>{var p,h;return(h=(p=t.options).persister)==null?void 0:h.call(p,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=d}}}function ud(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function fS(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var rr,Cn,sr,it,En,Me,Qr,Tn,Je,qp,Lt,eu,pS=(eu=class extends Kp{constructor(t){super();te(this,Je);te(this,rr);te(this,Cn);te(this,sr);te(this,it);te(this,En);te(this,Me);te(this,Qr);te(this,Tn);K(this,Tn,!1),K(this,Qr,t.defaultOptions),this.setOptions(t.options),this.observers=[],K(this,En,t.client),K(this,it,E(this,En).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,K(this,Cn,pd(this.options)),this.state=t.state??E(this,Cn),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return E(this,rr)}get promise(){var t;return(t=E(this,Me))==null?void 0:t.promise}setOptions(t){if(this.options={...E(this,Qr),...t},t!=null&&t._type&&K(this,rr,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=pd(this.options);n.data!==void 0&&(this.setState(fd(n.data,n.dataUpdatedAt)),K(this,Cn,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&E(this,it).remove(this)}setData(t,n){const r=Yo(this.state.data,t,this.options);return ge(this,Je,Lt).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t){ge(this,Je,Lt).call(this,{type:"setState",state:t})}cancel(t){var r,s;const n=(r=E(this,Me))==null?void 0:r.promise;return(s=E(this,Me))==null||s.cancel(t),n?n.then(qe).catch(qe):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return E(this,Cn)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>et(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===li||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>an(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!$p(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=E(this,Me))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=E(this,Me))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),E(this,it).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(E(this,Me)&&(E(this,Tn)||ge(this,Je,qp).call(this)?E(this,Me).cancel({revert:!0}):E(this,Me).cancelRetry()),this.scheduleGc()),E(this,it).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||ge(this,Je,Lt).call(this,{type:"invalidate"})}async fetch(t,n){var d,f,u,y,m,g,p,h,b,v,_;if(this.state.fetchStatus!=="idle"&&((d=E(this,Me))==null?void 0:d.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(E(this,Me))return E(this,Me).continueRetry(),E(this,Me).promise}if(t&&this.setOptions(t),!this.options.queryFn){const x=this.observers.find(S=>S.options.queryFn);x&&this.setOptions(x.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const r=new AbortController,s=x=>{Object.defineProperty(x,"signal",{enumerable:!0,get:()=>(K(this,Tn,!0),r.signal)})},i=()=>{const x=Vp(this.options,n),T=(()=>{const P={client:E(this,En),queryKey:this.queryKey,meta:this.meta};return s(P),P})();return K(this,Tn,!1),this.options.persister?this.options.persister(x,T,this):x(T)},a=(()=>{const x={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:E(this,En),state:this.state,fetchFn:i};return s(x),x})(),l=E(this,rr)==="infinite"?uS(this.options.pages):this.options.behavior;l==null||l.onFetch(a,this),K(this,sr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((f=a.fetchOptions)==null?void 0:f.meta))&&ge(this,Je,Lt).call(this,{type:"fetch",meta:(u=a.fetchOptions)==null?void 0:u.meta}),K(this,Me,Wp({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:x=>{x instanceof Xo&&x.revert&&this.setState({...E(this,sr),fetchStatus:"idle"}),r.abort()},onFail:(x,S)=>{ge(this,Je,Lt).call(this,{type:"failed",failureCount:x,error:S})},onPause:()=>{ge(this,Je,Lt).call(this,{type:"pause"})},onContinue:()=>{ge(this,Je,Lt).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const x=await E(this,Me).start();if(x===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(x),(m=(y=E(this,it).config).onSuccess)==null||m.call(y,x,this),(p=(g=E(this,it).config).onSettled)==null||p.call(g,x,this.state.error,this),x}catch(x){if(x instanceof Xo){if(x.silent)return E(this,Me).promise;if(x.revert){if(this.state.data===void 0)throw x;return this.state.data}}throw ge(this,Je,Lt).call(this,{type:"error",error:x}),(b=(h=E(this,it).config).onError)==null||b.call(h,x,this),(_=(v=E(this,it).config).onSettled)==null||_.call(v,this.state.data,x,this),x}finally{this.scheduleGc()}}},rr=new WeakMap,Cn=new WeakMap,sr=new WeakMap,it=new WeakMap,En=new WeakMap,Me=new WeakMap,Qr=new WeakMap,Tn=new WeakMap,Je=new WeakSet,qp=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Lt=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...Gp(r.data,this.options),fetchMeta:t.meta??null};case"success":const s={...r,...fd(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return K(this,sr,t.manual?s:void 0),s;case"error":const i=t.error;return{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Fe.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),E(this,it).notify({query:this,type:"updated",action:t})})},eu);function Gp(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:zp(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function fd(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function pd(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Ke,be,Xr,We,Pn,ir,jt,Jt,Jr,or,ar,An,On,en,cr,Se,Fr,Jo,ea,ta,na,ra,sa,ia,Zp,tu,mS=(tu=class extends cs{constructor(t,n){super();te(this,Se);te(this,Ke);te(this,be);te(this,Xr);te(this,We);te(this,Pn);te(this,ir);te(this,jt);te(this,Jt);te(this,Jr);te(this,or);te(this,ar);te(this,An);te(this,On);te(this,en);te(this,cr,new Set);this.options=n,K(this,Ke,t),K(this,Jt,null),K(this,jt,Qo()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(E(this,be).addObserver(this),md(E(this,be),this.options)?ge(this,Se,Fr).call(this):this.updateResult(),ge(this,Se,na).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return oa(E(this,be),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return oa(E(this,be),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,ge(this,Se,ra).call(this),ge(this,Se,sa).call(this),E(this,be).removeObserver(this)}setOptions(t){const n=this.options,r=E(this,be);if(this.options=E(this,Ke).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof et(this.options.enabled,E(this,be))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");ge(this,Se,ia).call(this),E(this,be).setOptions(this.options),n._defaulted&&!Go(this.options,n)&&E(this,Ke).getQueryCache().notify({type:"observerOptionsUpdated",query:E(this,be),observer:this});const s=this.hasListeners();s&&hd(E(this,be),r,this.options,n)&&ge(this,Se,Fr).call(this),this.updateResult(),s&&(E(this,be)!==r||et(this.options.enabled,E(this,be))!==et(n.enabled,E(this,be))||an(this.options.staleTime,E(this,be))!==an(n.staleTime,E(this,be)))&&ge(this,Se,Jo).call(this);const i=ge(this,Se,ea).call(this);s&&(E(this,be)!==r||et(this.options.enabled,E(this,be))!==et(n.enabled,E(this,be))||i!==E(this,en))&&ge(this,Se,ta).call(this,i)}getOptimisticResult(t){const n=E(this,Ke).getQueryCache().build(E(this,Ke),t),r=this.createResult(n,t);return gS(this,r)&&(K(this,We,r),K(this,ir,this.options),K(this,Pn,E(this,be).state)),r}getCurrentResult(){return E(this,We)}trackResult(t,n){return new Proxy(t,{get:(r,s)=>(this.trackProp(s),n==null||n(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&E(this,jt).status==="pending"&&E(this,jt).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,s))})}trackProp(t){E(this,cr).add(t)}getCurrentQuery(){return E(this,be)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=E(this,Ke).defaultQueryOptions(t),r=E(this,Ke).getQueryCache().build(E(this,Ke),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return ge(this,Se,Fr).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),E(this,We)))}createResult(t,n){var R;const r=E(this,be),s=this.options,i=E(this,We),o=E(this,Pn),a=E(this,ir),d=t!==r?t.state:E(this,Xr),{state:f}=t;let u={...f},y=!1,m;if(n._optimisticResults){const M=this.hasListeners(),N=!M&&md(t,n),j=M&&hd(t,r,n,s);(N||j)&&(u={...u,...Gp(f.data,t.options)}),n._optimisticResults==="isRestoring"&&(u.fetchStatus="idle")}let{error:g,errorUpdatedAt:p,status:h}=u;m=u.data;let b=!1;if(n.placeholderData!==void 0&&m===void 0&&h==="pending"){let M;i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(M=i.data,b=!0):M=typeof n.placeholderData=="function"?n.placeholderData((R=E(this,ar))==null?void 0:R.state.data,E(this,ar)):n.placeholderData,M!==void 0&&(h="success",m=Yo(i==null?void 0:i.data,M,n),y=!0)}if(n.select&&m!==void 0&&!b)if(i&&m===(o==null?void 0:o.data)&&n.select===E(this,Jr))m=E(this,or);else try{K(this,Jr,n.select),m=n.select(m),m=Yo(i==null?void 0:i.data,m,n),K(this,or,m),K(this,Jt,null)}catch(M){K(this,Jt,M)}E(this,Jt)&&(g=E(this,Jt),m=E(this,or),p=Date.now(),h="error");const v=u.fetchStatus==="fetching",_=h==="pending",x=h==="error",S=_&&v,T=m!==void 0,O={status:h,fetchStatus:u.fetchStatus,isPending:_,isSuccess:h==="success",isError:x,isInitialLoading:S,isLoading:S,data:m,dataUpdatedAt:u.dataUpdatedAt,error:g,errorUpdatedAt:p,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:u.dataUpdateCount>d.dataUpdateCount||u.errorUpdateCount>d.errorUpdateCount,isFetching:v,isRefetching:v&&!_,isLoadingError:x&&!T,isPaused:u.fetchStatus==="paused",isPlaceholderData:y,isRefetchError:x&&T,isStale:_c(t,n),refetch:this.refetch,promise:E(this,jt),isEnabled:et(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const M=O.data!==void 0,N=O.status==="error"&&!M,j=B=>{N?B.reject(O.error):M&&B.resolve(O.data)},H=()=>{const B=K(this,jt,O.promise=Qo());j(B)},k=E(this,jt);switch(k.status){case"pending":t.queryHash===r.queryHash&&j(k);break;case"fulfilled":(N||O.data!==k.value)&&H();break;case"rejected":(!N||O.error!==k.reason)&&H();break}}return O}updateResult(){const t=E(this,We),n=this.createResult(E(this,be),this.options);if(K(this,Pn,E(this,be).state),K(this,ir,this.options),E(this,Pn).data!==void 0&&K(this,ar,E(this,be)),Go(n,t))return;K(this,We,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!E(this,cr).size)return!0;const o=new Set(i??E(this,cr));return this.options.throwOnError&&o.add("error"),Object.keys(E(this,We)).some(a=>{const l=a;return E(this,We)[l]!==t[l]&&o.has(l)})};ge(this,Se,Zp).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&ge(this,Se,na).call(this)}},Ke=new WeakMap,be=new WeakMap,Xr=new WeakMap,We=new WeakMap,Pn=new WeakMap,ir=new WeakMap,jt=new WeakMap,Jt=new WeakMap,Jr=new WeakMap,or=new WeakMap,ar=new WeakMap,An=new WeakMap,On=new WeakMap,en=new WeakMap,cr=new WeakMap,Se=new WeakSet,Fr=function(t){ge(this,Se,ia).call(this);let n=E(this,be).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(qe)),n},Jo=function(){ge(this,Se,ra).call(this);const t=an(this.options.staleTime,E(this,be));if(Gr.isServer()||E(this,We).isStale||!Ko(t))return;const r=$p(E(this,We).dataUpdatedAt,t)+1;K(this,An,wn.setTimeout(()=>{E(this,We).isStale||this.updateResult()},r))},ea=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(E(this,be)):this.options.refetchInterval)??!1},ta=function(t){ge(this,Se,sa).call(this),K(this,en,t),!(Gr.isServer()||et(this.options.enabled,E(this,be))===!1||!Ko(E(this,en))||E(this,en)===0)&&K(this,On,wn.setInterval(()=>{(this.options.refetchIntervalInBackground||vc.isFocused())&&ge(this,Se,Fr).call(this)},E(this,en)))},na=function(){ge(this,Se,Jo).call(this),ge(this,Se,ta).call(this,ge(this,Se,ea).call(this))},ra=function(){E(this,An)!==void 0&&(wn.clearTimeout(E(this,An)),K(this,An,void 0))},sa=function(){E(this,On)!==void 0&&(wn.clearInterval(E(this,On)),K(this,On,void 0))},ia=function(){const t=E(this,Ke).getQueryCache().build(E(this,Ke),this.options);if(t===E(this,be))return;const n=E(this,be);K(this,be,t),K(this,Xr,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Zp=function(t){Fe.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(E(this,We))}),E(this,Ke).getQueryCache().notify({query:E(this,be),type:"observerResultsUpdated"})})},tu);function hS(e,t){return et(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&et(t.retryOnMount,e)===!1)}function md(e,t){return hS(e,t)||e.state.data!==void 0&&oa(e,t,t.refetchOnMount)}function oa(e,t,n){if(et(t.enabled,e)!==!1&&an(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&_c(e,t)}return!1}function hd(e,t,n,r){return(e!==t||et(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&_c(e,n)}function _c(e,t){return et(t.enabled,e)!==!1&&e.isStaleByTime(an(t.staleTime,e))}function gS(e,t){return!Go(e.getCurrentResult(),t)}var es,Et,He,Nn,Tt,qt,nu,yS=(nu=class extends Kp{constructor(t){super();te(this,Tt);te(this,es);te(this,Et);te(this,He);te(this,Nn);K(this,es,t.client),this.mutationId=t.mutationId,K(this,He,t.mutationCache),K(this,Et,[]),this.state=t.state||bS(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){E(this,Et).includes(t)||(E(this,Et).push(t),this.clearGcTimeout(),E(this,He).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){K(this,Et,E(this,Et).filter(n=>n!==t)),this.scheduleGc(),E(this,He).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){E(this,Et).length||(this.state.status==="pending"?this.scheduleGc():E(this,He).remove(this))}continue(){var t;return((t=E(this,Nn))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,a,l,d,f,u,y,m,g,p,h,b,v,_,x,S,T,P;const n=()=>{ge(this,Tt,qt).call(this,{type:"continue"})},r={client:E(this,es),meta:this.options.meta,mutationKey:this.options.mutationKey};K(this,Nn,Wp({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(O,R)=>{ge(this,Tt,qt).call(this,{type:"failed",failureCount:O,error:R})},onPause:()=>{ge(this,Tt,qt).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>E(this,He).canRun(this)}));const s=this.state.status==="pending",i=!E(this,Nn).canStart();try{if(s)n();else{ge(this,Tt,qt).call(this,{type:"pending",variables:t,isPaused:i}),E(this,He).config.onMutate&&await E(this,He).config.onMutate(t,this,r);const R=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,t,r));R!==this.state.context&&ge(this,Tt,qt).call(this,{type:"pending",context:R,variables:t,isPaused:i})}const O=await E(this,Nn).start();return await((d=(l=E(this,He).config).onSuccess)==null?void 0:d.call(l,O,t,this.state.context,this,r)),await((u=(f=this.options).onSuccess)==null?void 0:u.call(f,O,t,this.state.context,r)),await((m=(y=E(this,He).config).onSettled)==null?void 0:m.call(y,O,null,this.state.variables,this.state.context,this,r)),await((p=(g=this.options).onSettled)==null?void 0:p.call(g,O,null,t,this.state.context,r)),ge(this,Tt,qt).call(this,{type:"success",data:O}),O}catch(O){try{await((b=(h=E(this,He).config).onError)==null?void 0:b.call(h,O,t,this.state.context,this,r))}catch(R){Promise.reject(R)}try{await((_=(v=this.options).onError)==null?void 0:_.call(v,O,t,this.state.context,r))}catch(R){Promise.reject(R)}try{await((S=(x=E(this,He).config).onSettled)==null?void 0:S.call(x,void 0,O,this.state.variables,this.state.context,this,r))}catch(R){Promise.reject(R)}try{await((P=(T=this.options).onSettled)==null?void 0:P.call(T,void 0,O,t,this.state.context,r))}catch(R){Promise.reject(R)}throw ge(this,Tt,qt).call(this,{type:"error",error:O}),O}finally{E(this,He).runNext(this)}}},es=new WeakMap,Et=new WeakMap,He=new WeakMap,Nn=new WeakMap,Tt=new WeakSet,qt=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Fe.batch(()=>{E(this,Et).forEach(r=>{r.onMutationUpdate(t)}),E(this,He).notify({mutation:this,type:"updated",action:t})})},nu);function bS(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var It,pt,ts,ru,vS=(ru=class extends cs{constructor(t={}){super();te(this,It);te(this,pt);te(this,ts);this.config=t,K(this,It,new Set),K(this,pt,new Map),K(this,ts,0)}build(t,n,r){const s=new yS({client:t,mutationCache:this,mutationId:++hs(this,ts)._,options:t.defaultMutationOptions(n),state:r});return this.add(s),s}add(t){E(this,It).add(t);const n=Os(t);if(typeof n=="string"){const r=E(this,pt).get(n);r?r.push(t):E(this,pt).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(E(this,It).delete(t)){const n=Os(t);if(typeof n=="string"){const r=E(this,pt).get(n);if(r)if(r.length>1){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}else r[0]===t&&E(this,pt).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Os(t);if(typeof n=="string"){const r=E(this,pt).get(n),s=r==null?void 0:r.find(i=>i.state.status==="pending");return!s||s===t}else return!0}runNext(t){var r;const n=Os(t);if(typeof n=="string"){const s=(r=E(this,pt).get(n))==null?void 0:r.find(i=>i!==t&&i.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Fe.batch(()=>{E(this,It).forEach(t=>{this.notify({type:"removed",mutation:t})}),E(this,It).clear(),E(this,pt).clear()})}getAll(){return Array.from(E(this,It))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>cd(n,r))}findAll(t={}){return this.getAll().filter(n=>cd(t,n))}notify(t){Fe.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Fe.batch(()=>Promise.all(t.map(n=>n.continue().catch(qe))))}},It=new WeakMap,pt=new WeakMap,ts=new WeakMap,ru);function Os(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Pt,su,wS=(su=class extends cs{constructor(t={}){super();te(this,Pt);this.config=t,K(this,Pt,new Map)}build(t,n,r){const s=n.queryKey,i=n.queryHash??wc(s,n);let o=this.get(i);return o||(o=new pS({client:t,queryKey:s,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){E(this,Pt).has(t.queryHash)||(E(this,Pt).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=E(this,Pt).get(t.queryHash);n&&(t.destroy(),n===t&&E(this,Pt).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Fe.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return E(this,Pt).get(t)}getAll(){return[...E(this,Pt).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>ad(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>ad(t,r)):n}notify(t){Fe.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Fe.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Fe.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Pt=new WeakMap,su),Le,tn,nn,lr,dr,rn,ur,fr,iu,_S=(iu=class{constructor(e={}){te(this,Le);te(this,tn);te(this,nn);te(this,lr);te(this,dr);te(this,rn);te(this,ur);te(this,fr);K(this,Le,e.queryCache||new wS),K(this,tn,e.mutationCache||new vS),K(this,nn,e.defaultOptions||{}),K(this,lr,new Map),K(this,dr,new Map),K(this,rn,0)}mount(){hs(this,rn)._++,E(this,rn)===1&&(K(this,ur,vc.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,Le).onFocus())})),K(this,fr,di.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,Le).onOnline())})))}unmount(){var e,t;hs(this,rn)._--,E(this,rn)===0&&((e=E(this,ur))==null||e.call(this),K(this,ur,void 0),(t=E(this,fr))==null||t.call(this),K(this,fr,void 0))}isFetching(e){return E(this,Le).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return E(this,tn).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=E(this,Le).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=E(this,Le).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(an(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return E(this,Le).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),s=E(this,Le).get(r.queryHash),i=s==null?void 0:s.state.data,o=tS(t,i);if(o!==void 0)return E(this,Le).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return Fe.batch(()=>E(this,Le).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=E(this,Le).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=E(this,Le);Fe.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=E(this,Le);return Fe.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Fe.batch(()=>E(this,Le).findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(qe).catch(qe)}invalidateQueries(e,t={}){return Fe.batch(()=>(E(this,Le).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=Fe.batch(()=>E(this,Le).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,n);return n.throwOnError||(i=i.catch(qe)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(qe)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=E(this,Le).build(this,t);return n.isStaleByTime(an(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(qe).catch(qe)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(qe).catch(qe)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return di.isOnline()?E(this,tn).resumePausedMutations():Promise.resolve()}getQueryCache(){return E(this,Le)}getMutationCache(){return E(this,tn)}getDefaultOptions(){return E(this,nn)}setDefaultOptions(e){K(this,nn,e)}setQueryDefaults(e,t){E(this,lr).set(Kr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...E(this,lr).values()],n={};return t.forEach(r=>{qr(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){E(this,dr).set(Kr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...E(this,dr).values()],n={};return t.forEach(r=>{qr(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...E(this,nn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=wc(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===li&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...E(this,nn).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){E(this,Le).clear(),E(this,tn).clear()}},Le=new WeakMap,tn=new WeakMap,nn=new WeakMap,lr=new WeakMap,dr=new WeakMap,rn=new WeakMap,ur=new WeakMap,fr=new WeakMap,iu),Yp=w.createContext(void 0),ls=e=>{const t=w.useContext(Yp);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},xS=({client:e,children:t})=>(w.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),c.jsx(Yp.Provider,{value:e,children:t})),Qp=w.createContext(!1),SS=()=>w.useContext(Qp);Qp.Provider;function CS(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var ES=w.createContext(CS()),TS=()=>w.useContext(ES),PS=(e,t,n)=>{const r=n!=null&&n.state.error&&typeof e.throwOnError=="function"?Hp(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},AS=e=>{w.useEffect(()=>{e.clearReset()},[e])},OS=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||Hp(n,[e.error,r])),NS=e=>{if(e.suspense){const n=s=>s==="static"?s:Math.max(s??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...s)=>n(r(...s)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},kS=(e,t)=>e.isLoading&&e.isFetching&&!t,RS=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,gd=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function LS(e,t,n){var m,g,p,h;if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const r=SS(),s=TS(),i=ls(),o=i.defaultQueryOptions(e);(g=(m=i.getDefaultOptions().queries)==null?void 0:m._experimental_beforeQuery)==null||g.call(m,o);const a=i.getQueryCache().get(o.queryHash);process.env.NODE_ENV!=="production"&&(o.queryFn||console.error(`[${o.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`));const l=e.subscribed!==!1;o._optimisticResults=r?"isRestoring":l?"optimistic":void 0,NS(o),PS(o,s,a),AS(s);const d=!i.getQueryCache().get(o.queryHash),[f]=w.useState(()=>new t(i,o)),u=f.getOptimisticResult(o),y=!r&&l;if(w.useSyncExternalStore(w.useCallback(b=>{const v=y?f.subscribe(Fe.batchCalls(b)):qe;return f.updateResult(),v},[f,y]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),w.useEffect(()=>{f.setOptions(o)},[o,f]),RS(o,u))throw gd(o,f,s);if(OS({result:u,errorResetBoundary:s,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw u.error;if((h=(p=i.getDefaultOptions().queries)==null?void 0:p._experimental_afterQuery)==null||h.call(p,o,u),o.experimental_prefetchInRender&&!Gr.isServer()&&kS(u,r)){const b=d?gd(o,f,s):a==null?void 0:a.promise;b==null||b.catch(qe).finally(()=>{f.updateResult()})}return o.notifyOnChangeProps?u:f.trackResult(u)}function Nr(e,t){return LS(e,mS)}function DS(e,t){const n=ls(),r=n.getQueryCache();return w.useSyncExternalStore(w.useCallback(s=>r.subscribe(Fe.batchCalls(s)),[r]),()=>n.isFetching(e),()=>n.isFetching(e))}const Xp=C.createContext(null);function jS(e){return typeof window>"u"?e??null:e?(localStorage.setItem(Op,e),e):null}function IS({token:e,children:t}){const n=jS(e);return c.jsx(Xp.Provider,{value:n,children:t})}function MS(){return C.useContext(Xp)}const xc="widget-accounts",Sc="widget-positions",Cc="widget-orders",ds="widget-deals",us="widget-deals-total",FS=2e4,US=3e4;function zs(e){const t=String(e.getUTCDate()).padStart(2,"0"),n=String(e.getUTCMonth()+1).padStart(2,"0"),r=String(e.getUTCHours()).padStart(2,"0"),s=String(e.getUTCMinutes()).padStart(2,"0"),i=String(e.getUTCSeconds()).padStart(2,"0");return`${n}.${t} ${r}:${s}:${i}`}function BS(e){const t=["seconds","Seconds","timestamp","Timestamp","value","Value","time","Time"];for(const n of t)if(e[n]!==void 0&&e[n]!==null&&e[n]!=="")return e[n]}function Ec(e){if(e==null||e==="")return"—";if(typeof e=="number"&&Number.isFinite(e)){const t=e>1e12?e:e*1e3;return zs(new Date(t))}if(typeof e=="string"){const t=e.trim();if(!t)return"—";if(/^\d+$/.test(t)){const r=Number(t);if(Number.isFinite(r)){const s=r>1e12?r:r*1e3;return zs(new Date(s))}}const n=Date.parse(t);return Number.isFinite(n)?zs(new Date(n)):t}if(typeof e=="object"&&e!==null){const n=BS(e);if(n!==void 0)return Ec(n)}return"—"}const Jp=["time","Time","openTime","open_time","OpenTime","TimeOpen","timeOpen","timeCreate","TimeCreate","timeSetup","TimeSetup","setupTime","setup_time","createdAt","created_at","createTime","CreateTime","timestamp","Timestamp","openDate","OpenDate","date","Date"];function $S(e){return zs(e)}const VS={0:"buy",1:"sell",2:"buy limit",3:"sell limit",4:"buy stop",5:"sell stop",6:"buy stop limit",7:"sell stop limit"};function Hi(e,t){for(const n of t)if(e[n]!==void 0&&e[n]!==null&&e[n]!=="")return e[n]}function St(e,t){const n=Hi(e,t);if(n===void 0)return;const r=Number(n);return Number.isFinite(r)?r:void 0}function Ns(e,t){const n=Hi(e,t);if(n!==void 0)return String(n)}function HS(e){if(Array.isArray(e))return e.filter(r=>typeof r=="object"&&r!==null);if(!e||typeof e!="object")return[];const t=e,n=["data","body","result"];for(const r of n){const s=t[r];if(Array.isArray(s))return s.filter(i=>typeof i=="object"&&i!==null);if(s&&typeof s=="object"){const i=s,o=["list","items","records","orders","content","data"];for(const a of o){const l=i[a];if(Array.isArray(l))return l.filter(d=>typeof d=="object"&&d!==null)}}}return[]}function aa(e){return e===void 0?.01:e>=100?e/1e4:e}function zS(e,t){return zf(t,e)}function WS(e){const t=Hi(e,["type","Type","orderType","OrderType"]);if(typeof t=="string"){const r=t.toLowerCase().trim();if(r)return{label:r,side:r.includes("sell")?"sell":"buy",typeNum:r.includes("sell")?3:2}}const n=St(e,["type","Type","orderType","OrderType"])??2;return{label:VS[n]??(n%2===1?"sell":"buy"),side:ii(n),typeNum:n}}function KS(e,t){const n=St(e,["volumeFilled","volume_filled","VolumeFilled","filledVolume","FilledVolume"]);if(n!==void 0)return aa(n);const r=St(e,["volumeCurrent","volume_current","VolumeCurrent"]);return r!==void 0?aa(r):0}function qS(e,t){const n=Ns(e,["ticket","Ticket","order","Order","id","ID"]),r=Ns(e,["symbol","Symbol"])??"";if(!n||!r)return null;const s=Ye(r),{label:i,side:o,typeNum:a}=WS(e),l=St(e,["typeTime","TypeTime"])??0,d=aa(St(e,["volumeLots","volume_lots","VolumeLots","volume","Volume"])),f=KS(e),u=St(e,["priceOrder","price_order","PriceOrder","openPrice","open_price","price","Price"])??0,y=St(e,["priceTrigger","price_trigger","PriceTrigger","triggerPrice","TriggerPrice"]),m=St(e,["currentPrice","current_price","PriceCurrent","priceCurrent","marketPrice","MarketPrice"])??u,g=St(e,["stopLoss","stop_loss","PriceSL","sl","SL"]),p=St(e,["takeProfit","take_profit","PriceTP","tp","TP"]),h=Ns(e,["comment","Comment"])??"",b=zS(e,s),v=Ec(Hi(e,Jp));return{ticket:n,login:Ns(e,["login","Login"])??t,symbol:s,displaySymbol:Li(s),time:v,typeLabel:i,orderType:a,typeTime:l,side:o,volumeLots:d,volumeFilledLots:f,orderPrice:u,priceTrigger:y,stopLoss:g,takeProfit:p,currentPrice:m,comment:h,digits:b}}function GS(e,t){return HS(e).map(n=>qS(n,t)).filter(n=>n!==null)}function zi(e,t){for(const n of t)if(e[n]!==void 0&&e[n]!==null&&e[n]!=="")return e[n]}function Gt(e,t){const n=zi(e,t);if(n===void 0)return;const r=Number(n);return Number.isFinite(r)?r:void 0}function ks(e,t){const n=zi(e,t);if(n!==void 0)return String(n)}function ZS(e){if(Array.isArray(e))return e.filter(r=>typeof r=="object"&&r!==null);if(!e||typeof e!="object")return[];const t=e,n=["data","body","result"];for(const r of n){const s=t[r];if(Array.isArray(s))return s.filter(i=>typeof i=="object"&&i!==null);if(s&&typeof s=="object"){const i=s,o=["list","items","records","positions","orders","content","data"];for(const a of o){const l=i[a];if(Array.isArray(l))return l.filter(d=>typeof d=="object"&&d!==null)}}}return[]}function YS(e){return e===void 0?.01:e>=100?e/1e4:e}function QS(e){const t=zi(e,["type","Type","action","Action","side","Side"]);if(typeof t=="string"){const r=t.toLowerCase();if(r.includes("sell"))return"sell";if(r.includes("buy"))return"buy"}const n=Gt(e,["type","Type","action","Action"]);return n!==void 0&&n%2===1?"sell":"buy"}function XS(e,t){return zf(t,e)}function JS(e,t){const n=ks(e,["ticket","Ticket","position","Position","order","Order","id","ID"]),r=ks(e,["symbol","Symbol"])??"";if(!n||!r)return null;const s=Ye(r),i=QS(e),o=YS(Gt(e,["volumeLots","volume_lots","VolumeLots","volume","Volume"])),a=Gt(e,["openPrice","open_price","PriceOpen","priceOpen","price","Price"])??0,l=Gt(e,["currentPrice","current_price","PriceCurrent","priceCurrent"])??a,d=Gt(e,["stopLoss","stop_loss","PriceSL","sl","SL"]),f=Gt(e,["takeProfit","take_profit","PriceTP","tp","TP"]),u=Gt(e,["profit","Profit","floating","Floating","pnl","PnL"])??0,y=Gt(e,["swap","Swap"])??0,m=ks(e,["comment","Comment"])??"",g=XS(e,s),p=Ec(zi(e,Jp));return{ticket:n,login:ks(e,["login","Login"])??t,symbol:s,displaySymbol:Li(s),time:p,type:i,volumeLots:o,openPrice:a,stopLoss:d,takeProfit:f,currentPrice:l,marketBid:l,marketAsk:l,swap:y,profit:u,comment:m,digits:g}}function e0(e,t){return ZS(e).map(n=>JS(n,t)).filter(n=>n!==null)}function fs(){return Bt}function em(){const e=ct(),t=MS(),{data:n,isLoading:r,isError:s}=Nr({queryKey:[xc,e.baseUrl,t],queryFn:()=>e.getAccounts(),enabled:!!t,refetchInterval:US});return{accounts:n??[],isLoading:r,isError:s}}function t0(e){const t=ct();return Nr({queryKey:[Sc,t.baseUrl,e],queryFn:()=>t.dealer.getPositions(e),enabled:!!e,refetchInterval:FS})}function n0(e){const t=ct();return Nr({queryKey:[Cc,t.baseUrl,e],queryFn:()=>t.dealer.getOrders(e),enabled:!!e})}function r0(e,t){e.invalidateQueries({queryKey:[xc,t]})}function s0(e,t,n){e.invalidateQueries({queryKey:[us,t,n]}),e.invalidateQueries({queryKey:[ds,t,n]})}function i0(){const e=ls(),t=ct();return C.useCallback(async n=>{await Promise.all([e.invalidateQueries({queryKey:[us,t.baseUrl,n]}),e.invalidateQueries({queryKey:[ds,t.baseUrl,n]})])},[t.baseUrl,e])}function o0(){const e=ls(),t=ct();return C.useCallback(async n=>{await Promise.all([e.invalidateQueries({queryKey:[xc,t.baseUrl]}),e.invalidateQueries({queryKey:[Sc,t.baseUrl,n]}),e.invalidateQueries({queryKey:[Cc,t.baseUrl,n]}),e.invalidateQueries({queryKey:[us,t.baseUrl,n]}),e.invalidateQueries({queryKey:[ds,t.baseUrl,n]})])},[t.baseUrl,e])}function a0(){const e=ls(),t=ct();return C.useCallback((n,r,s)=>{r0(e,t.baseUrl),e.invalidateQueries({queryKey:[Sc,t.baseUrl,n]}),(r===void 0||ic(r))&&e.invalidateQueries({queryKey:[Cc,t.baseUrl,n]}),(s==null?void 0:s.invalidateDeals)!==!1&&s0(e,t.baseUrl,n)},[t.baseUrl,e])}function Wi(){const e=ct(),t=a0();return{async submitOrder(n){const r=await e.trading.submitOrder(n);return r.success&&t(n.login,n.orderType),r},async closePosition(n,r){const s=await e.trading.closePosition(n);return s.success&&!(r!=null&&r.skipInvalidation)&&t(n.login),s},async deleteOrder(n){const r=await e.trading.deleteOrder(n);return r.success&&t(n.login,n.orderType),r},async modifyOrder(n,r){const s=await e.trading.modifyOrder(n,r);return s.success&&t(n.login,n.orderType),s}}}function c0(e){if(e===null||typeof e!="object")return{deals:[],offset:0,count:0};const t=e,n=t.data??t,s=(Array.isArray(n.deals)?n.deals:[]).map(i=>{const o=i??{};return{deal:Number(o.Deal??0),login:Number(o.Login??0),symbol:String(o.Symbol??""),action:Number(o.Action??0),volume:Number(o.Volume??0),price:Number(o.Price??0),profit:Number(o.Profit??0),time:Number(o.Time??0),entry:Number(o.Entry??0),comment:String(o.Comment??"")}});return{deals:s,offset:Number(n.offset??0),count:Number(n.count??s.length)}}function l0(e){if(e===null||typeof e!="object")return{total:0};const t=e,n=t.data??t;return{total:Number(n.total??0)}}function d0(e,t,n,r={}){const s=ct();return Nr({queryKey:[us,s.baseUrl,e,t,n],queryFn:async()=>{const i=await s.dealer.getDealsTotal(e,t,n);return l0(i)},enabled:r.enabled??!0})}function u0(e,t,n,r,s,i={}){const o=ct();return Nr({queryKey:[ds,o.baseUrl,e,t,n,r,s],queryFn:async()=>{const a=await o.dealer.getDeals(e,t,n,r,s);return c0(a)},enabled:i.enabled??!0})}function f0(e,t){return e!=null?e0(e,t):[]}function p0(e,t){return e!=null?GS(e,t):[]}function m0({symbolTicker:e,controlsRef:t,chartWidget:n,sidePanelTab:r,orderState:s,backUrl:i,createAccountUrl:o}){const{openMarketPanel:a,setSelectedLogin:l,hasConfirmedAccount:d}=s,f=fs();return C.useEffect(()=>(t.current={open:a,setSelectedLogin:l},()=>{t.current=null}),[t,a,l]),c.jsxs(c.Fragment,{children:[d?c.jsx(Bp,{chartWidget:n,symbolTicker:e,symbols:f}):null,c.jsx(Lp,{}),c.jsx(Dx,{symbolTicker:e,sidePanelTab:r,orderState:s,backUrl:i,createAccountUrl:o})]})}const h0=8,yd=11;function g0({wide:e}){return c.jsx("td",{className:"web-trading-widget-terminal__cell",children:c.jsx("div",{className:`web-trading-widget-terminal__skeleton-bar${e?" web-trading-widget-terminal__skeleton-bar--wide":""}`})})}function y0(){return c.jsx(c.Fragment,{children:Array.from({length:h0},(e,t)=>c.jsx("tr",{className:"web-trading-widget-terminal__skeleton-row",children:Array.from({length:yd},(n,r)=>c.jsx(g0,{wide:r===yd-1},r))},t))})}const b0={0:"Buy",1:"Sell",2:"Balance",3:"Credit",5:"-"},v0="web-trading-widget-text-buy",w0="web-trading-widget-text-sell",_0="web-trading-widget-terminal__head-row",_o=50;function x0(e){return e===0?v0:e===1?w0:_0}const bd=e=>e.toISOString().split("T")[0],tm=e=>Math.floor(new Date(e).getTime()/1e3),S0=e=>tm(e),C0=e=>tm(e)+86399;function E0(){const e=new Date,t=new Date;return t.setDate(t.getDate()-7),{fromTs:S0(bd(t)),toTs:C0(bd(e))}}const T0=e=>new Date(e*1e3).toLocaleString(void 0,{year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"});function P0(e){try{return decodeURIComponent(e)}catch{return e}}function A0(){return c.jsxs("colgroup",{children:[c.jsx("col",{className:"web-trading-widget-terminal-col--deal"}),c.jsx("col",{className:"web-trading-widget-terminal-col--ticket"}),c.jsx("col",{className:"web-trading-widget-terminal-col--symbol"}),c.jsx("col",{className:"web-trading-widget-terminal-col--type"}),c.jsx("col",{className:"web-trading-widget-terminal-col--volume"}),c.jsx("col",{className:"web-trading-widget-terminal-col--price"}),c.jsx("col",{className:"web-trading-widget-terminal-col--profit"}),c.jsx("col",{className:"web-trading-widget-terminal-col--entry"}),c.jsx("col",{className:"web-trading-widget-terminal-col--time"}),c.jsx("col",{className:"web-trading-widget-terminal-col--local-time"}),c.jsx("col",{})]})}function O0(){return c.jsx("thead",{children:c.jsxs("tr",{className:"web-trading-widget-terminal__head-row",children:[c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Deal"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Login"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Symbol"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Action"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Volume"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Price"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Profit"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Entry"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Time"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Local time"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Comment"})]})})}function N0({deal:e}){const t=e.profit>0?"web-trading-widget-text-profit-positive":e.profit<0?"web-trading-widget-text-profit-negative":"";return c.jsxs("tr",{className:"web-trading-widget-terminal__deals-row",children:[c.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.deal}),c.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.login}),c.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.symbol||"—"}),c.jsx("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--capitalize ${x0(e.action)}`,children:b0[e.action]??`Action ${e.action}`}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:(e.volume/1e4).toFixed(2)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.price.toFixed(5)}),c.jsxs("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right ${t}`,children:[e.profit>0?"+":"",e.profit.toFixed(2)]}),c.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.entry===1?"OUT":"IN"}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--nowrap",children:$S(new Date(e.time*1e3))}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--nowrap",children:T0(e.time)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--truncate",children:e.comment?P0(e.comment):"—"})]})}function k0({login:e,detailUrl:t}){const{fromTs:n,toTs:r}=C.useMemo(()=>E0(),[]),s=e!=="",{data:i,isLoading:o}=d0(e,n,r,{enabled:s}),a=(i==null?void 0:i.total)??0,l=Math.max(0,a-_o),d=a>0?Math.min(_o,a):_o,{data:f,isLoading:u}=u0(e,n,r,l,d,{enabled:s}),y=s&&(o||u),m=C.useMemo(()=>[...(f==null?void 0:f.deals)??[]].sort((g,p)=>p.time-g.time),[f==null?void 0:f.deals]);return e?c.jsx("div",{className:"web-trading-widget-terminal__deals-wrap",children:c.jsxs("div",{className:"web-trading-widget-terminal__body-scroll",children:[c.jsxs("table",{className:"web-trading-widget-terminal__deals-table",children:[c.jsx(A0,{}),c.jsx(O0,{}),c.jsxs("tbody",{children:[y?c.jsx(y0,{}):null,!y&&m.length===0?c.jsx("tr",{children:c.jsx("td",{colSpan:11,className:"web-trading-widget-terminal__empty-cell",children:"No deals found"})}):null,y?null:m.map(g=>c.jsx(N0,{deal:g},g.deal))]})]}),t?c.jsx("div",{className:"web-trading-widget-terminal__deals-footer",children:c.jsx("a",{href:t,className:"web-trading-widget-terminal__deals-detail-btn",children:"See full deal history"})}):null]})}):c.jsx("div",{className:"web-trading-widget-terminal__empty-cell",children:"Select an account to view deal history"})}function nm(e){const t=ve(d=>d.setPositions),n=ve(d=>d.setOrders),{data:r,isLoading:s,isError:i}=t0(e),{data:o,isLoading:a,isError:l}=n0(e);return C.useEffect(()=>{if(!e.trim()){t([]),n([]);return}r!=null&&t(f0(r,e)),o!=null&&n(p0(o,e))},[e,o,r,n,t]),{isLoading:s||a,isError:!!(i||l)}}const vd=224,wd=32,Tc=120;function rm(){return typeof window>"u"?560:Math.max(Tc,Math.floor(window.innerHeight*.7))}function R0(e){return Math.min(rm(),Math.max(Tc,e))}function L0(){const[e,t]=C.useState(vd),[n,r]=C.useState(!1),s=C.useRef(vd);C.useEffect(()=>{s.current=e},[e]);const i=C.useCallback(f=>{t(R0(f))},[]),o=C.useCallback(()=>{i(s.current+wd)},[i]),a=C.useCallback(()=>{i(s.current-wd)},[i]),l=C.useCallback(f=>{const u=f,y=s.current;r(!0);const m=p=>{const h=u-p.clientY;i(y+h)},g=()=>{r(!1),document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",g),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",m),document.addEventListener("mouseup",g),document.body.style.cursor="row-resize",document.body.style.userSelect="none"},[i]);C.useEffect(()=>{const f=()=>{i(s.current)};return window.addEventListener("resize",f),()=>{window.removeEventListener("resize",f),document.body.style.cursor="",document.body.style.userSelect=""}},[i]);const d=rm();return{height:e,isResizing:n,canIncrement:e<d,canDecrement:e>Tc,onResizeStart:l,incrementHeight:o,decrementHeight:a}}const D0=e=>e==null?void 0:e.replace(/(\d+)\.0{18}/g,"$1"),j0=2e4;let xo=0;function I0(){return xo=(xo+1)%Number.MAX_VALUE,xo.toString()}const So=new Map,_d=(e,t)=>{if(So.has(e))return;const n=setTimeout(()=>{So.delete(e),Br({type:"REMOVE_TOAST",toastId:e})},t||j0);So.set(e,n)},M0=(e,t)=>{var n;switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,((n=t==null?void 0:t.toast)==null?void 0:n.limit)??1)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(r=>r.id===t.toast.id?{...r,...t.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=t;if(r){const s=e.toasts.find(i=>i.id===r);_d(r,s==null?void 0:s.duration)}else e.toasts.forEach(s=>{_d(s.id,s.duration)});return{...e,toasts:e.toasts.map(s=>s.id===r||r===void 0?{...s,open:!1}:s)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(r=>r.id!==t.toastId)}}},Ws=[];let Ks={toasts:[]};function Br(e){Ks=M0(Ks,e),Ws.forEach(t=>{t(Ks)})}function Te({duration:e=2e4,description:t,...n}){const r=I0(),s=typeof t=="string"?D0(t):t,i=a=>Br({type:"UPDATE_TOAST",toast:{...a,description:s,id:r}}),o=()=>{Br({type:"DISMISS_TOAST",toastId:r})};return Br({type:"ADD_TOAST",toast:{...n,description:s,id:r,open:!0,duration:e,onOpenChange:a=>{a||o()}}}),e&&setTimeout(o,e),{id:r,dismiss:o,update:i}}function F0(){const[e,t]=w.useState(Ks);return w.useEffect(()=>(Ws.push(t),()=>{const n=Ws.indexOf(t);n>-1&&Ws.splice(n,1)}),[e]),{...e,toast:Te,dismiss:n=>Br({type:"DISMISS_TOAST",toastId:n})}}function U0(e){return e.type==="buy"?e.marketBid??e.currentPrice:e.marketAsk??e.currentPrice}function B0(){const{closePosition:e,deleteOrder:t}=Wi(),n=o0(),r=ve(h=>h.removePosition),s=ve(h=>h.removeOrder),i=ve(h=>h.setSelectedPositionTicket),o=ve(h=>h.setSelectedOrderTicket),[a,l]=C.useState(new Set),[d,f]=C.useState(!1),u=C.useCallback((h,b)=>{l(v=>{const _=new Set(v);return b?_.add(h):_.delete(h),_})},[]),y=C.useCallback(h=>a.has(h),[a]),m=C.useCallback(async h=>{const b=`position-${h.ticket}`;u(b,!0);try{const v=await e(h);if(!v.success){Te({variant:"destructive",description:v.message||"Failed to close position."});return}r(h.ticket),i(null),Te({description:`Position #${h.ticket} closed at ${U0(h).toFixed(h.digits)}.`})}catch(v){const _=v instanceof Error?v.message:"Failed to close position.";Te({variant:"destructive",description:_})}finally{u(b,!1)}},[e,r,u,i]),g=C.useCallback(async h=>{var x;if(h.length===0||d)return;if(!e){Te({variant:"destructive",description:"Close position is not configured."});return}f(!0);let b=0,v=0;const _=((x=h[0])==null?void 0:x.login)??"";for(const S of h){const T=`position-${S.ticket}`;u(T,!0);try{if(!(await e(S,{skipInvalidation:!0})).success){v+=1;continue}r(S.ticket),b+=1}catch{v+=1}finally{u(T,!1)}}i(null),b>0&&_&&await n(_),Te(v===0?{description:b===1?"1 position closed.":`${b} positions closed.`}:b===0?{variant:"destructive",description:"Failed to close positions."}:{variant:"destructive",description:`Closed ${b}, failed ${v}.`}),f(!1)},[d,e,n,r,u,i]),p=C.useCallback(async h=>{const b=`order-${h.ticket}`;u(b,!0);try{const v=await t(h);if(!v.success){Te({variant:"destructive",description:v.message||"Failed to delete order."});return}s(h.ticket),o(null),Te({description:`Order #${h.ticket} deleted.`})}catch(v){const _=v instanceof Error?v.message:"Failed to delete order.";Te({variant:"destructive",description:_})}finally{u(b,!1)}},[t,s,u,o]);return{closePosition:m,closeAllPositions:g,deleteOrder:p,isClosingAll:d,isRowBusy:y}}function Zt(e,t=2){return e.toFixed(t)}function sm(e){return e.reduce((t,n)=>t+n.profit+n.swap,0)}function $0(e,t,n){const r=(e==null?void 0:e.balance)??0,s=(e==null?void 0:e.credit)??0,i=(e==null?void 0:e.margin)??0;if(!e||t.length===0)return{balance:r,equity:(e==null?void 0:e.equity)??r+s,margin:i,marginFree:(e==null?void 0:e.marginFree)??0,marginLevel:e==null?void 0:e.marginLevel,totalProfit:0};const o=sm(t),a=r+s+o+n,l=a-i,d=i>0?a/i*100:void 0;return{balance:r,equity:a,margin:i,marginFree:l,marginLevel:d,totalProfit:o}}function ca(){return c.jsxs("colgroup",{children:[c.jsx("col",{className:"web-trading-widget-terminal-col--symbol"}),c.jsx("col",{className:"web-trading-widget-terminal-col--ticket"}),c.jsx("col",{className:"web-trading-widget-terminal-col--time"}),c.jsx("col",{className:"web-trading-widget-terminal-col--type"}),c.jsx("col",{className:"web-trading-widget-terminal-col--volume"}),c.jsx("col",{className:"web-trading-widget-terminal-col--price"}),c.jsx("col",{className:"web-trading-widget-terminal-col--sl"}),c.jsx("col",{className:"web-trading-widget-terminal-col--tp"}),c.jsx("col",{className:"web-trading-widget-terminal-col--price2"}),c.jsx("col",{className:"web-trading-widget-terminal-col--swap"}),c.jsx("col",{className:"web-trading-widget-terminal-col--profit"}),c.jsx("col",{}),c.jsx("col",{className:"web-trading-widget-terminal-col--close"})]})}function V0(){return c.jsx("thead",{children:c.jsxs("tr",{className:"web-trading-widget-terminal__head-row",children:[c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Symbol"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Ticket"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Server time"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Type"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Volume"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Price"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"S / L"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"T / P"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Price"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Swap"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Profit"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Comment"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--close","aria-label":"Close"})]})})}function H0({balance:e,equity:t,margin:n,marginFree:r,marginLevel:s,totalPnL:i,scrollRef:o,onScroll:a}){const l=i>0?"web-trading-widget-text-profit-positive":i<0?"web-trading-widget-text-profit-negative":"";return c.jsx("div",{className:"web-trading-widget-terminal__stats",children:c.jsx("div",{ref:o,className:"web-trading-widget-terminal__header-scroll",onScroll:a,children:c.jsxs("table",{className:"web-trading-widget-terminal__table",children:[c.jsx(ca,{}),c.jsx("tbody",{children:c.jsxs("tr",{children:[c.jsx("td",{colSpan:10,className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--nowrap",children:c.jsxs("div",{className:"web-trading-widget-terminal__stats-row web-trading-widget-terminal__stats-row--tabular",children:[c.jsxs("span",{children:["Balance: ",Zt(e)]}),c.jsxs("span",{children:["Equity: ",Zt(t)]}),c.jsxs("span",{children:["Margin: ",Zt(n)]}),c.jsxs("span",{children:["Free margin: ",Zt(r)]}),c.jsxs("span",{children:["Level: ",s!==void 0?`${Zt(s,2)}%`:"0.00%"]})]})}),c.jsx("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right ${l}`,children:Zt(i)}),c.jsx("td",{className:"web-trading-widget-terminal__cell"}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--close"})]})})]})})})}const z0=[{id:"trade",label:"Trade"},{id:"history",label:"History"}];function W0({activeTab:e,onTabChange:t,positionCount:n,isClosingAll:r,onCloseAllPositions:s,isRefetchingDeals:i,onRefetchDeals:o}){const a=e==="trade"&&(n>0||r),l=e==="history";return c.jsxs("div",{role:"tablist","aria-label":"Terminal panel tabs",className:"web-trading-widget-terminal__tab-bar",children:[z0.map(d=>{const f=e===d.id;return c.jsx("button",{type:"button",role:"tab","aria-selected":f,onClick:()=>t(d.id),className:`web-trading-widget-terminal__tab-btn${f?" web-trading-widget-terminal__tab-btn--active":""}`,children:d.label},d.id)}),c.jsxs("div",{className:"web-trading-widget-terminal__toolbar-actions",children:[a?c.jsx("button",{type:"button",disabled:r,onClick:s,className:"web-trading-widget-terminal__close-all-btn",children:r?"Closing…":"Close all"}):null,l?c.jsxs("button",{type:"button",disabled:i,onClick:o,className:"web-trading-widget-terminal__refetch-btn","aria-label":"Refresh deal history",children:[c.jsx(jv,{className:`web-trading-widget-icon web-trading-widget-icon--sm${i?" web-trading-widget-terminal__refetch-icon--spinning":""}`}),i?"Refreshing…":"Refresh"]}):null]})]})}function K0({position:e,isSelected:t,isClosing:n,onSelect:r,onClose:s}){const i=e.type==="buy"?"web-trading-widget-text-buy":"web-trading-widget-text-sell",o=e.profit>0?"web-trading-widget-text-profit-positive":e.profit<0?"web-trading-widget-text-profit-negative":"";return c.jsxs("tr",{className:`web-trading-widget-terminal__row${t?" web-trading-widget-terminal__row--selected":""}`,onClick:r,children:[c.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.displaySymbol}),c.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.ticket}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--nowrap",children:e.time}),c.jsx("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--capitalize ${i}`,children:e.type}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.volumeLots.toFixed(2)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:Pe(e.openPrice,e.digits)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.stopLoss!==void 0&&e.stopLoss!==0?Pe(e.stopLoss,e.digits):"N/A"}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.takeProfit!==void 0&&e.takeProfit!==0?Pe(e.takeProfit,e.digits):"N/A"}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:Pe(e.currentPrice,e.digits)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.swap!==0?Zt(e.swap):""}),c.jsx("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right ${o}`,children:Zt(e.profit)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--truncate",children:e.comment}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--close",children:c.jsx("button",{type:"button","aria-label":`Close position #${e.ticket}`,title:"Close position",disabled:n,className:"web-trading-widget-terminal__row-close-btn",onClick:a=>{a.stopPropagation(),s()},children:c.jsx(gn,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})})]})}function q0({order:e,isSelected:t,isDeleting:n,onSelect:r,onDelete:s}){const i=e.side==="buy"?"web-trading-widget-text-buy":"web-trading-widget-text-sell";return c.jsxs("tr",{className:`web-trading-widget-terminal__row${t?" web-trading-widget-terminal__row--selected":""}`,onClick:r,children:[c.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.displaySymbol}),c.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.ticket}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--nowrap",children:e.time}),c.jsx("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--capitalize ${i}`,children:e.typeLabel}),c.jsxs("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:[e.volumeLots.toFixed(2)," / ",e.volumeFilledLots.toFixed(2)]}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:Pe(e.orderPrice,e.digits)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.stopLoss!==void 0&&e.stopLoss!==0?Pe(e.stopLoss,e.digits):"N/A"}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.takeProfit!==void 0&&e.takeProfit!==0?Pe(e.takeProfit,e.digits):"N/A"}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:Pe(e.currentPrice,e.digits)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right"}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right"}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--truncate",children:e.comment}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--close",children:c.jsx("button",{type:"button","aria-label":`Delete order #${e.ticket}`,title:"Delete order",disabled:n,className:"web-trading-widget-terminal__row-close-btn",onClick:o=>{o.stopPropagation(),s()},children:c.jsx(gn,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})})]})}function im({embedded:e=!1,symbolTicker:t="",onSymbolChange:n,onCreateNewOrder:r,dealDetailUrl:s}){const[i,o]=C.useState("trade"),a=fs(),{accounts:l,isLoading:d}=em(),f=L0(),{height:u,isResizing:y,onResizeStart:m}=e?{height:0,isResizing:!1,onResizeStart:()=>{}}:f,g=ve(U=>U.selectedLogin),p=ve(U=>U.selectedPositionTicket),h=ve(U=>U.selectedOrderTicket),b=ve(U=>U.setSelectedPositionTicket),v=ve(U=>U.setSelectedOrderTicket),{isLoading:_}=nm(g),x=ve(U=>U.positions),S=ve(U=>U.orders),{closePosition:T,closeAllPositions:P,deleteOrder:O,isClosingAll:R,isRowBusy:M}=B0(),N=i0(),j=ct(),H=DS({predicate:U=>{const we=U.queryKey;return g?(we[0]===ds||we[0]===us)&&we[1]===j.baseUrl&&we[2]===g:!1}})>0,k=d||_,B=C.useMemo(()=>g?x.filter(U=>U.login===g):x,[x,g]),F=C.useMemo(()=>g?S.filter(U=>U.login===g):S,[S,g]),L=C.useMemo(()=>{const U=l.find(we=>we.login===g);return(U==null?void 0:U.tradeStat)??null},[l,g]),D=C.useMemo(()=>B.map(U=>U.ticket).sort().join("|"),[B]),$=C.useMemo(()=>L?`${L.balance}:${L.credit??0}:${L.equity}:${L.margin}|${D}`:"",[L,D]),W=C.useMemo(()=>{if(!L||B.length===0)return 0;const U=sm(B);return L.equity-L.balance-(L.credit??0)-U},[$]),I=C.useMemo(()=>$0(L,B,W),[L,B,W]),re=B.length===0&&F.length===0,J=C.useRef(null),ue=C.useRef(null),me=C.useRef(null),z=C.useCallback(()=>{P(B)},[P,B]),q=C.useCallback(()=>{g&&N(g)},[N,g]),ie=C.useCallback(U=>{const we=qv(U,a);we&&(n==null||n(we))},[n,a]),he=C.useCallback(U=>{b(U.ticket),ie(U.symbol)},[b,ie]),le=C.useCallback(U=>{v(U.ticket),ie(U.symbol)},[v,ie]),oe=C.useCallback(U=>{const we=J.current,Ae=ue.current,Ee=me.current;if(!we||!Ae)return;const X=U==="header"?we.scrollLeft:U==="body"?Ae.scrollLeft:(Ee==null?void 0:Ee.scrollLeft)??0;U!=="header"&&(we.scrollLeft=X),U!=="body"&&(Ae.scrollLeft=X),Ee&&U!=="footer"&&(Ee.scrollLeft=X)},[]);return c.jsxs(c.Fragment,{children:[!e&&y?c.jsx("div",{className:"web-trading-widget-terminal-resize-overlay","aria-hidden":!0}):null,c.jsxs("div",{className:`web-trading-widget-terminal${e?" web-trading-widget-terminal--embedded":""}`,style:e?void 0:{height:u},children:[e?null:c.jsx("div",{className:"web-trading-widget-terminal__resize-bar-wrap",children:c.jsx("div",{role:"separator","aria-orientation":"horizontal","aria-label":"Resize terminal panel","aria-valuenow":u,className:"web-trading-widget-terminal__resize-bar",onMouseDown:U=>{U.preventDefault(),m(U.clientY)},children:c.jsx(Vf,{className:"web-trading-widget-icon web-trading-widget-icon--sm web-trading-widget-terminal__resize-icon"})})}),c.jsx(W0,{activeTab:i,onTabChange:o,positionCount:B.length,isClosingAll:R,onCloseAllPositions:z,isRefetchingDeals:H,onRefetchDeals:q}),i==="trade"?c.jsxs(c.Fragment,{children:[c.jsx("div",{ref:J,className:"web-trading-widget-terminal__header-scroll",onScroll:()=>oe("header"),children:c.jsxs("table",{className:"web-trading-widget-terminal__table",children:[c.jsx(ca,{}),c.jsx(V0,{})]})}),c.jsx("div",{ref:ue,className:"web-trading-widget-terminal__body-scroll",onScroll:()=>oe("body"),children:c.jsxs("table",{className:"web-trading-widget-terminal__table",children:[c.jsx(ca,{}),c.jsxs("tbody",{children:[k&&re?c.jsx("tr",{children:c.jsx("td",{colSpan:13,className:"web-trading-widget-terminal__empty-cell",children:"Loading…"})}):null,!k&&re?c.jsx("tr",{children:c.jsx("td",{colSpan:13,className:"web-trading-widget-terminal__empty-cell",children:c.jsxs("div",{className:"web-trading-widget-terminal__empty-inner",children:[c.jsx("p",{className:"web-trading-widget-terminal__empty-text",children:"You don't have any positions"}),r?c.jsx("button",{type:"button",onClick:r,className:"web-trading-widget-terminal__create-btn",children:"Create New Order"}):null]})})}):null,B.map(U=>c.jsx(K0,{position:U,isSelected:p===U.ticket,isClosing:M(`position-${U.ticket}`),onSelect:()=>he(U),onClose:()=>void T(U)},`position-${U.ticket}`)),F.map(U=>c.jsx(q0,{order:U,isSelected:h===U.ticket,isDeleting:M(`order-${U.ticket}`),onSelect:()=>le(U),onDelete:()=>void O(U)},`order-${U.ticket}`))]})]})})]}):c.jsx(k0,{login:g??"",detailUrl:s}),c.jsx(H0,{balance:I.balance,equity:I.equity,margin:I.margin,marginFree:I.marginFree,marginLevel:I.marginLevel,totalPnL:I.totalProfit,scrollRef:i==="trade"?me:void 0,onScroll:i==="trade"?()=>oe("footer"):void 0})]})]})}const la=224,ui=120;function G0(e){var n;const t=(n=e==null?void 0:e.current)==null?void 0:n.clientHeight;return t&&t>0?Math.max(ui,Math.floor(t*.35)):la}function Z0(e){var n;const t=(n=e==null?void 0:e.current)==null?void 0:n.clientHeight;return t&&t>0?Math.max(ui,Math.floor(t*.85)):typeof window>"u"?560:Math.max(ui,Math.floor(window.innerHeight*.7))}function Y0(e,t){return Math.min(Z0(t),Math.max(ui,e))}function Q0({containerRef:e,isOpen:t=!1}={}){const[n,r]=C.useState(la),[s,i]=C.useState(!1),o=C.useRef(la);C.useEffect(()=>{o.current=n},[n]);const a=C.useCallback(d=>{r(Y0(d,e))},[e]);C.useEffect(()=>{if(!t)return;const d=Math.max(o.current,G0(e));a(d)},[e,t,a]);const l=C.useCallback(d=>{const f=d,u=o.current;i(!0);const y=g=>{const p=f-g.clientY;a(u+p)},m=()=>{i(!1),document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",m),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",y),document.addEventListener("mouseup",m),document.body.style.cursor="row-resize",document.body.style.userSelect="none"},[a]);return C.useEffect(()=>{const d=()=>{a(o.current)};return window.addEventListener("resize",d),()=>{window.removeEventListener("resize",d),document.body.style.cursor="",document.body.style.userSelect=""}},[a]),{height:n,isResizing:s,onResizeStart:l}}function om({children:e}){const[t]=C.useState(()=>new _S({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}}));return c.jsx(xS,{client:t,children:e})}function am({containerRef:e,onCreateNewOrder:t}){const[n,r]=C.useState(!1),{height:s,isResizing:i,onResizeStart:o}=Q0({containerRef:e,isOpen:n}),a=ve(g=>g.selectedLogin),l=ve(g=>g.orders),d=ve(g=>g.positions),f=C.useMemo(()=>a?l.filter(g=>g.login===a):l,[a,l]),u=C.useMemo(()=>a?d.filter(g=>g.login===a):d,[a,d]),y=f.length+u.length,m=()=>{r(!1),t==null||t()};return c.jsxs("div",{className:"web-trading-widget-news-orders-overlay-root",children:[c.jsxs("button",{type:"button",className:"web-trading-widget-news-orders-overlay__trigger","aria-label":"Open terminal","aria-expanded":n,onClick:()=>r(!0),children:[c.jsx(kv,{className:"web-trading-widget-icon web-trading-widget-icon--sm"}),c.jsx("span",{children:"Orders"}),y>0?c.jsx("span",{className:"web-trading-widget-news-orders-overlay__badge",children:y}):null]}),n?c.jsx(c.Fragment,{children:c.jsxs("div",{className:"web-trading-widget-news-orders__panel",style:{height:s},children:[i?c.jsx("div",{className:"web-trading-widget-terminal-resize-overlay","aria-hidden":!0}):null,c.jsx("div",{className:"web-trading-widget-news-orders__panel-resize-bar-wrap",children:c.jsx("div",{role:"separator","aria-orientation":"horizontal","aria-label":"Resize terminal panel","aria-valuenow":s,className:"web-trading-widget-terminal__resize-bar",onMouseDown:g=>{g.preventDefault(),o(g.clientY)},children:c.jsx(Vf,{className:"web-trading-widget-icon web-trading-widget-icon--sm web-trading-widget-terminal__resize-icon"})})}),c.jsxs("div",{className:"web-trading-widget-news-orders__panel-header",children:[c.jsx("h2",{className:"web-trading-widget-news-orders__panel-title",children:"Terminal"}),c.jsx("button",{type:"button",className:"web-trading-widget-news-orders__panel-close","aria-label":"Close terminal panel",onClick:()=>r(!1),children:c.jsx(gn,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})]}),c.jsx("div",{className:"web-trading-widget-news-orders__panel-body",children:c.jsx(im,{embedded:!0,onCreateNewOrder:t?m:void 0})})]})}):null]})}function X0({baseUrl:e,containerRef:t,onCreateNewOrder:n}){return c.jsx(om,{children:c.jsx(kp,{baseUrl:e,children:c.jsx(am,{containerRef:t,onCreateNewOrder:n})})})}const Rn=C.forwardRef(({className:e,type:t,...n},r)=>c.jsx("input",{type:t,className:Ce("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-xs placeholder:text-gray-300 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 dark:border-gray-3",e),ref:r,...n}));Rn.displayName="Input";var Ki="Collapsible",[J0,cm]=Bn(Ki),[eC,Pc]=J0(Ki),lm=w.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:s,disabled:i,onOpenChange:o,...a}=e,[l,d]=Ln({prop:r,defaultProp:s??!1,onChange:o,caller:Ki});return c.jsx(eC,{scope:n,disabled:i,contentId:on(),open:l,onOpenToggle:w.useCallback(()=>d(f=>!f),[d]),children:c.jsx(pe.div,{"data-state":Oc(l),"data-disabled":i?"":void 0,...a,ref:t})})});lm.displayName=Ki;var dm="CollapsibleTrigger",um=w.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,s=Pc(dm,n);return c.jsx(pe.button,{type:"button","aria-controls":s.open?s.contentId:void 0,"aria-expanded":s.open||!1,"data-state":Oc(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:t,onClick:fe(e.onClick,s.onOpenToggle)})});um.displayName=dm;var Ac="CollapsibleContent",fm=w.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=Pc(Ac,e.__scopeCollapsible);return c.jsx($n,{present:n||s.open,children:({present:i})=>c.jsx(tC,{...r,ref:t,present:i})})});fm.displayName=Ac;var tC=w.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:s,...i}=e,o=Pc(Ac,n),[a,l]=w.useState(r),d=w.useRef(null),f=Ne(t,d),u=w.useRef(0),y=u.current,m=w.useRef(0),g=m.current,p=o.open||a,h=w.useRef(p),b=w.useRef(void 0);return w.useEffect(()=>{const v=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(v)},[]),Ie(()=>{const v=d.current;if(v){b.current=b.current||{transitionDuration:v.style.transitionDuration,animationName:v.style.animationName},v.style.transitionDuration="0s",v.style.animationName="none";const _=v.getBoundingClientRect();u.current=_.height,m.current=_.width,h.current||(v.style.transitionDuration=b.current.transitionDuration,v.style.animationName=b.current.animationName),l(r)}},[o.open,r]),c.jsx(pe.div,{"data-state":Oc(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!p,...i,ref:f,style:{"--radix-collapsible-content-height":y?`${y}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...e.style},children:p&&s})});function Oc(e){return e?"open":"closed"}var nC=lm,rC=um,sC=fm,_t="Accordion",iC=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[Nc,oC,aC]=Ia(_t),[qi]=Bn(_t,[aC,cm]),kc=cm(),pm=w.forwardRef((e,t)=>{const{type:n,...r}=e,s=r,i=r;return c.jsx(Nc.Provider,{scope:e.__scopeAccordion,children:n==="multiple"?c.jsx(uC,{...i,ref:t}):c.jsx(dC,{...s,ref:t})})});pm.displayName=_t;var[mm,cC]=qi(_t),[hm,lC]=qi(_t,{collapsible:!1}),dC=w.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},collapsible:i=!1,...o}=e,[a,l]=Ln({prop:n,defaultProp:r??"",onChange:s,caller:_t});return c.jsx(mm,{scope:e.__scopeAccordion,value:w.useMemo(()=>a?[a]:[],[a]),onItemOpen:l,onItemClose:w.useCallback(()=>i&&l(""),[i,l]),children:c.jsx(hm,{scope:e.__scopeAccordion,collapsible:i,children:c.jsx(gm,{...o,ref:t})})})}),uC=w.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},...i}=e,[o,a]=Ln({prop:n,defaultProp:r??[],onChange:s,caller:_t}),l=w.useCallback(f=>a((u=[])=>[...u,f]),[a]),d=w.useCallback(f=>a((u=[])=>u.filter(y=>y!==f)),[a]);return c.jsx(mm,{scope:e.__scopeAccordion,value:o,onItemOpen:l,onItemClose:d,children:c.jsx(hm,{scope:e.__scopeAccordion,collapsible:!0,children:c.jsx(gm,{...i,ref:t})})})}),[fC,Gi]=qi(_t),gm=w.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:r,dir:s,orientation:i="vertical",...o}=e,a=w.useRef(null),l=Ne(a,t),d=oC(n),u=zu(s)==="ltr",y=fe(e.onKeyDown,m=>{var O;if(!iC.includes(m.key))return;const g=m.target,p=d().filter(R=>{var M;return!((M=R.ref.current)!=null&&M.disabled)}),h=p.findIndex(R=>R.ref.current===g),b=p.length;if(h===-1)return;m.preventDefault();let v=h;const _=0,x=b-1,S=()=>{v=h+1,v>x&&(v=_)},T=()=>{v=h-1,v<_&&(v=x)};switch(m.key){case"Home":v=_;break;case"End":v=x;break;case"ArrowRight":i==="horizontal"&&(u?S():T());break;case"ArrowDown":i==="vertical"&&S();break;case"ArrowLeft":i==="horizontal"&&(u?T():S());break;case"ArrowUp":i==="vertical"&&T();break}const P=v%b;(O=p[P].ref.current)==null||O.focus()});return c.jsx(fC,{scope:n,disabled:r,direction:s,orientation:i,children:c.jsx(Nc.Slot,{scope:n,children:c.jsx(pe.div,{...o,"data-orientation":i,ref:l,onKeyDown:r?void 0:y})})})}),fi="AccordionItem",[pC,Rc]=qi(fi),ym=w.forwardRef((e,t)=>{const{__scopeAccordion:n,value:r,...s}=e,i=Gi(fi,n),o=cC(fi,n),a=kc(n),l=on(),d=r&&o.value.includes(r)||!1,f=i.disabled||e.disabled;return c.jsx(pC,{scope:n,open:d,disabled:f,triggerId:l,children:c.jsx(nC,{"data-orientation":i.orientation,"data-state":Sm(d),...a,...s,ref:t,disabled:f,open:d,onOpenChange:u=>{u?o.onItemOpen(r):o.onItemClose(r)}})})});ym.displayName=fi;var bm="AccordionHeader",vm=w.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=Gi(_t,n),i=Rc(bm,n);return c.jsx(pe.h3,{"data-orientation":s.orientation,"data-state":Sm(i.open),"data-disabled":i.disabled?"":void 0,...r,ref:t})});vm.displayName=bm;var da="AccordionTrigger",wm=w.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=Gi(_t,n),i=Rc(da,n),o=lC(da,n),a=kc(n);return c.jsx(Nc.ItemSlot,{scope:n,children:c.jsx(rC,{"aria-disabled":i.open&&!o.collapsible||void 0,"data-orientation":s.orientation,id:i.triggerId,...a,...r,ref:t})})});wm.displayName=da;var _m="AccordionContent",xm=w.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=Gi(_t,n),i=Rc(_m,n),o=kc(n);return c.jsx(sC,{role:"region","aria-labelledby":i.triggerId,"data-orientation":s.orientation,...o,...r,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});xm.displayName=_m;function Sm(e){return e?"open":"closed"}var mC=pm,hC=ym,gC=vm,Cm=wm,Em=xm;const yC=mC,qn=w.forwardRef(({className:e,...t},n)=>c.jsx(hC,{ref:n,className:Ce("border-b",e),...t}));qn.displayName="AccordionItem";const Gn=w.forwardRef(({className:e,children:t,...n},r)=>c.jsx(gC,{className:"flex",children:c.jsxs(Cm,{ref:r,className:Ce("flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...n,children:[t,c.jsx(tc,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"})]})}));Gn.displayName=Cm.displayName;const Zn=w.forwardRef(({className:e,children:t,...n},r)=>c.jsx(Em,{ref:r,className:"overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...n,children:c.jsx("div",{className:Ce("pb-4 pt-0",e),children:t})}));Zn.displayName=Em.displayName;function xd(e){const t=e.trim().replace(/,/g,"");if(!t)return null;const n=Number(t);return Number.isFinite(n)?n:null}function Sd(e,t){return t<=0?String(Math.round(e)):e.toFixed(t)}function De({label:e,value:t,onChange:n,step:r=.01,min:s,decimals:i=2,placeholder:o,basePrice:a,disabled:l=!1,clearable:d=!1}){const f=t.trim()!=="",u=g=>{if(l)return;const p=xd(t),h=a!=null&&Number.isFinite(a)?a:s??0,v=(p??h)+g*r,_=s!==void 0?Math.max(s,v):v;_<=0||n(Sd(_,i))},y=()=>{const g=xd(t);if(g===null||g<=0){t.trim()!==""&&n("");return}n(Sd(g,i))},m=()=>{l||n("")};return c.jsxs("div",{className:"web-trading-widget-stepper",children:[c.jsxs("div",{className:"web-trading-widget-stepper__header",children:[c.jsx("span",{className:"web-trading-widget-stepper__label",children:e}),d&&f?c.jsx("button",{type:"button","aria-label":`Clear ${e}`,className:"web-trading-widget-stepper__clear",disabled:l,onClick:m,children:c.jsx(gn,{className:"web-trading-widget-icon web-trading-widget-icon--xs"})}):null]}),c.jsxs("div",{className:`web-trading-widget-stepper__control${l?" web-trading-widget-stepper__control--disabled":""}`,children:[c.jsx("button",{type:"button","aria-label":`Decrease ${e}`,className:"web-trading-widget-stepper__btn web-trading-widget-stepper__btn--minus",disabled:l||a===null&&t.trim()==="",onClick:()=>u(-1),children:c.jsx(Lv,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})}),c.jsx("input",{type:"text",inputMode:"decimal",value:t,placeholder:o,disabled:l,onChange:g=>n(g.target.value),onBlur:y,className:"web-trading-widget-stepper__input"}),c.jsx("button",{type:"button","aria-label":`Increase ${e}`,className:"web-trading-widget-stepper__btn web-trading-widget-stepper__btn--plus",disabled:l||a===null&&t.trim()==="",onClick:()=>u(1),children:c.jsx(Dv,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})]})]})}function bC({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,embedded:d=!1,onMinimize:f,onClose:u,onPlaceOrder:y}){const[m,g]=C.useState("market"),[p,h]=C.useState(String(r)),[b,v]=C.useState(""),[_,x]=C.useState(""),S=se(ne=>ne.stopLoss),T=se(ne=>ne.takeProfit),P=se(ne=>ne.setStopLoss),O=se(ne=>ne.setTakeProfit),R=se(ne=>ne.setVolumeLots),M=se(ne=>ne.setOrderSide),[N,j]=C.useState(""),[H,k]=C.useState(mt.GTC),[B,F]=C.useState(""),[L,D]=C.useState(""),$=Number(Vt(Ht(e))),W=Pr($),I=Gf(t,n),re=t!==null?Pe(t,$):"—",J=n!==null?Pe(n,$):"—",ue=ji(m),me=Wf(m),z=Di(m),q=z.label,ie=!ue&&z.orderType!==null&&z.orderType%2===1,he=C.useMemo(()=>I!==null?I:t??n,[n,t,I]),le=ne=>{h(ne);const $e=Number(ne);Number.isFinite($e)&&$e>0&&R($e)},oe=ne=>t===null||n===null?null:ue?ne==="buy"?n:t:ht(b)??(ne==="buy"?n:t),U=ne=>{const $e=oe(ne);$e!==null&&M({side:ne,entryPrice:$e})},we=ne=>{if(t===null||n===null||!l)return;const $e=Math.max(i,Number(p)||i),Qi=Bo(m,ne),ms=oe(ne);ms!==null&&M({side:ne,entryPrice:ms}),y({login:l,executionMode:m,side:ne,orderType:Qi,volumeLots:$e,stopLoss:S,takeProfit:T,priceOrder:b,priceTrigger:_,comment:N,typeTime:H,expirationDateTime:B,expirationDay:L,bid:t,ask:n})},Ae=t!==null&&n!==null,Ee=ue||ht(b)!==void 0,X=!me||ht(_)!==void 0,ke=ue||Mi(H,B,L),Ue=!o&&!a&&l!==""&&Ae&&Ee&&X&&ke,Qe=!ue&&ac(H),dt=!ue&&cc(H);return c.jsxs("div",{className:"web-trading-widget-market-panel",children:[c.jsxs("div",{className:"web-trading-widget-market-panel__header",children:[c.jsxs(ti,{value:m,onValueChange:ne=>g(ne),children:[c.jsx(Vr,{className:"web-trading-widget-market-panel__select-trigger",children:c.jsx(ni,{})}),c.jsx(Hr,{children:si.map(ne=>c.jsx(zr,{value:ne.mode,children:ne.label},ne.mode))})]}),d?null:c.jsxs("div",{className:"web-trading-widget-market-panel__header-actions",children:[c.jsx("button",{type:"button","aria-label":"Minimize to quick order panel",className:"web-trading-widget-market-panel__header-btn",onClick:f,children:c.jsx(Rv,{className:"web-trading-widget-icon web-trading-widget-icon--md"})}),c.jsx("button",{type:"button","aria-label":"Close order panel",className:"web-trading-widget-market-panel__header-btn",onClick:u,children:c.jsx(gn,{className:"web-trading-widget-icon web-trading-widget-icon--md"})})]})]}),c.jsxs(yC,{type:"multiple",defaultValue:["volume-setting","risk-management"],className:"web-trading-widget-market-panel__accordion",children:[c.jsxs(qn,{value:"volume-setting",className:"web-trading-widget-market-panel__accordion-item",children:[c.jsx(Gn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Volume Setting"}),c.jsx(Zn,{className:"web-trading-widget-market-panel__accordion-content",children:c.jsx(De,{label:"Lots",value:p,onChange:le,step:s,min:i,decimals:2})})]}),ue?null:c.jsxs(qn,{value:"order-price",className:"web-trading-widget-market-panel__accordion-item",children:[c.jsx(Gn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Order Price"}),c.jsx(Zn,{className:"web-trading-widget-market-panel__accordion-content",children:me?c.jsxs(c.Fragment,{children:[c.jsx(De,{label:"Stop Price",value:_,onChange:x,step:W,decimals:$,basePrice:he,placeholder:I!==null?Pe(I,$):"—"}),c.jsx(De,{label:"Limit Price",value:b,onChange:v,step:W,decimals:$,basePrice:he,placeholder:I!==null?Pe(I,$):"—"})]}):c.jsx(De,{label:"Price",value:b,onChange:v,step:W,decimals:$,basePrice:he,placeholder:I!==null?Pe(I,$):"—"})})]}),c.jsxs(qn,{value:"risk-management",className:"web-trading-widget-market-panel__accordion-item",children:[c.jsx(Gn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Risk Management"}),c.jsx(Zn,{className:"web-trading-widget-market-panel__accordion-content",children:c.jsxs("div",{className:"web-trading-widget-market-panel__grid-2",children:[c.jsx(De,{label:"Stop Loss",value:S,onChange:P,step:W,decimals:$,basePrice:t,placeholder:t!==null?re:"—",clearable:!0}),c.jsx(De,{label:"Take Profit",value:T,onChange:O,step:W,decimals:$,basePrice:n,placeholder:n!==null?J:"—",clearable:!0})]})})]}),ue?null:c.jsxs(qn,{value:"expiration",className:"web-trading-widget-market-panel__accordion-item",children:[c.jsx(Gn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Expiration"}),c.jsxs(Zn,{className:"web-trading-widget-market-panel__accordion-content",children:[c.jsxs(ti,{value:String(H),onValueChange:ne=>k(Number(ne)),children:[c.jsx(Vr,{className:"web-trading-widget-market-panel__select-full",children:c.jsx(ni,{})}),c.jsx(Hr,{children:Kf.map(ne=>c.jsx(zr,{value:String(ne.value),children:ne.label},ne.value))})]}),Qe?c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Expiration time"}),c.jsx(Rn,{type:"datetime-local",value:B,onChange:ne=>F(ne.target.value)})]}):null,dt?c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Expiration day"}),c.jsx(Rn,{type:"date",value:L,onChange:ne=>D(ne.target.value)})]}):null]})]}),c.jsxs(qn,{value:"comment",className:"web-trading-widget-market-panel__accordion-item",children:[c.jsx(Gn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Comment"}),c.jsx(Zn,{className:"web-trading-widget-market-panel__accordion-content",children:c.jsx(Rn,{value:N,onChange:ne=>j(ne.target.value),placeholder:""})})]})]}),c.jsxs("div",{className:"web-trading-widget-market-panel__footer",children:[c.jsxs("div",{className:"web-trading-widget-market-panel__quotes",children:[c.jsx("span",{children:re}),c.jsx("span",{className:"web-trading-widget-market-panel__quotes-ask",children:J})]}),ue?c.jsxs("div",{className:"web-trading-widget-market-panel__actions",children:[c.jsx(ot,{type:"button",variant:"destructive",className:"web-trading-widget-market-panel__sell-btn",disabled:!Ue,onMouseDown:()=>U("sell"),onClick:()=>we("sell"),children:"Sell by Market"}),c.jsx(ot,{type:"button",className:"web-trading-widget-market-panel__buy-btn",disabled:!Ue,onMouseDown:()=>U("buy"),onClick:()=>we("buy"),children:"Buy by Market"})]}):c.jsxs(ot,{type:"button",variant:ie?"destructive":"default",className:`web-trading-widget-market-panel__place-btn${ie?"":" web-trading-widget-market-panel__place-btn--buy"}`,disabled:!Ue,onMouseDown:()=>{const ne=z.orderType!==null&&z.orderType%2===1?"sell":"buy";U(ne)},onClick:()=>{const ne=z.orderType!==null&&z.orderType%2===1?"sell":"buy";we(ne)},children:["Place ",q]})]})]})}function Tm({confirmation:e,symbolTicker:t,onDismiss:n}){const r=Number(Vt(Ht(t))),s=Pe(e.price,r),i=e.side==="sell"?"sell":"buy",o=Li(e.symbol||Ii(t));return c.jsxs("div",{className:"web-trading-widget-confirmation",children:[c.jsx("div",{className:"web-trading-widget-confirmation__close-row",children:c.jsx("button",{type:"button","aria-label":"Close confirmation",className:"web-trading-widget-confirmation__close-btn",onClick:n,children:c.jsx(gn,{className:"web-trading-widget-icon web-trading-widget-icon--md"})})}),c.jsxs("div",{className:"web-trading-widget-confirmation__body",children:[c.jsxs("p",{className:"web-trading-widget-confirmation__summary",children:[c.jsxs("span",{className:"web-trading-widget-confirmation__ticket",children:["#",e.ticket]})," ",c.jsx("span",{className:`web-trading-widget-confirmation__side web-trading-widget-confirmation__side--${e.side}`,children:i})," ",e.volumeLots.toFixed(2)," ",o]}),c.jsxs("p",{className:"web-trading-widget-confirmation__price",children:["at ",s]}),c.jsx("p",{className:"web-trading-widget-confirmation__status",children:"Placed"}),c.jsx(ot,{type:"button",className:"web-trading-widget-confirmation__ok-btn",onClick:n,children:"OK"})]})]})}function Rs(e,t){return e.toLocaleString(void 0,{minimumFractionDigits:t,maximumFractionDigits:t})}function Co(e){const t=e.trim();if(!t)return;const n=Number(t);return Number.isFinite(n)?n:void 0}function Pm({order:e,onClose:t}){const{deleteOrder:n,modifyOrder:r}=Wi(),s=ve(L=>L.removeOrder),[i,o]=C.useState(String(e.volumeLots)),[a,l]=C.useState(String(e.orderPrice)),[d,f]=C.useState(e.priceTrigger!==void 0?String(e.priceTrigger):""),u=se(L=>L.stopLoss),y=se(L=>L.takeProfit),m=se(L=>L.setStopLoss),g=se(L=>L.setTakeProfit),p=se(L=>L.setDraft),h=se(L=>L.clearDraft),[b,v]=C.useState(e.comment),[_,x]=C.useState(!1),[S,T]=C.useState(!1),P=Pr(e.digits);C.useEffect(()=>(p({source:"order",entryPrice:e.orderPrice,stopLoss:e.stopLoss!==void 0?String(e.stopLoss):"",takeProfit:e.takeProfit!==void 0?String(e.takeProfit):"",side:e.side,showEntryLine:!0,volumeLots:e.volumeLots,digits:e.digits,priceStep:P}),()=>{h()}),[h,e.digits,e.orderPrice,e.side,e.stopLoss,e.takeProfit,e.volumeLots,P,p]);const O=oc(e.orderType),R=e.volumeLots,M=Number(a)||e.orderPrice,N=Co(d),j=_||S,H=!O||N!==void 0&&Number.isFinite(M)&&M>0,k=C.useMemo(()=>`Delete #${e.ticket} ${e.typeLabel} ${R.toFixed(2)} ${e.displaySymbol} at ${Rs(M,e.digits)}`,[e,M,R]),B=async()=>{if(!H){Te({variant:"destructive",description:O?"Please set both stop and limit prices.":"Please set an order price."});return}x(!0);try{const L=await r(e,{volumeLots:R,priceOrder:M,priceTrigger:O?N:void 0,stopLoss:Co(u),takeProfit:Co(y),comment:b.trim()||"order modify"});if(!L.success){Te({variant:"destructive",description:L.message||"Failed to modify order."});return}t(),Te({description:`Order #${e.ticket} updated.`})}catch(L){const D=L instanceof Error?L.message:"Failed to modify order.";Te({variant:"destructive",description:D})}finally{x(!1)}},F=async()=>{T(!0);try{const L=await n(e);if(!L.success){Te({variant:"destructive",description:L.message||"Failed to delete order."});return}s(e.ticket),t(),Te({description:`Order #${e.ticket} deleted.`})}catch(L){const D=L instanceof Error?L.message:"Failed to delete order.";Te({variant:"destructive",description:D})}finally{T(!1)}};return c.jsxs("div",{className:"web-trading-widget-detail-panel",children:[c.jsxs("div",{className:"web-trading-widget-detail-panel__header",children:[c.jsxs("p",{className:`web-trading-widget-detail-panel__title web-trading-widget-detail-panel__title--${e.side}`,children:["#",e.ticket," ",e.typeLabel," ",R.toFixed(2)," / ",e.volumeFilledLots.toFixed(2)," ",e.displaySymbol," ",O&&N!==void 0?`${Rs(N,e.digits)} / ${Rs(M,e.digits)}`:Rs(M,e.digits)]}),c.jsx("button",{type:"button","aria-label":"Close order panel",className:"web-trading-widget-icon-btn",onClick:t,children:c.jsx(gn,{className:"web-trading-widget-icon web-trading-widget-icon--md"})})]}),c.jsxs("div",{className:"web-trading-widget-detail-panel__body",children:[c.jsx(De,{label:"Lots",value:i,onChange:o,step:.01,min:.01,decimals:2,disabled:!0}),O?c.jsxs(c.Fragment,{children:[c.jsx(De,{label:"Stop Price",value:d,onChange:f,step:P,decimals:e.digits,basePrice:e.currentPrice}),c.jsx(De,{label:"Limit Price",value:a,onChange:l,step:P,decimals:e.digits,basePrice:e.currentPrice})]}):c.jsx(De,{label:"Price",value:a,onChange:l,step:P,decimals:e.digits,basePrice:e.currentPrice}),c.jsxs("div",{className:"web-trading-widget-market-panel__grid-2",children:[c.jsx(De,{label:"Stop Loss",value:u,onChange:m,step:P,decimals:e.digits,basePrice:e.currentPrice,placeholder:"—"}),c.jsx(De,{label:"Take Profit",value:y,onChange:g,step:P,decimals:e.digits,basePrice:e.currentPrice,placeholder:"—"})]}),c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Comment"}),c.jsx(Rn,{value:b,onChange:L=>v(L.target.value)})]}),c.jsx(ot,{type:"button",variant:"secondary",className:"web-trading-widget-detail-panel__btn-full",disabled:j||!H,onClick:()=>void B(),children:"Modify"}),c.jsx(ot,{type:"button",className:"web-trading-widget-detail-panel__action-btn",disabled:j,onClick:()=>void F(),children:k})]})]})}function Ls(e,t){return e.toLocaleString(void 0,{minimumFractionDigits:t,maximumFractionDigits:t})}function vC(e){return e.type==="buy"?e.marketBid??e.currentPrice:e.marketAsk??e.currentPrice}function Am({position:e,onClose:t}){const{closePosition:n}=Wi(),r=ve(S=>S.removePosition),[s,i]=C.useState(String(e.volumeLots)),o=se(S=>S.stopLoss),a=se(S=>S.takeProfit),l=se(S=>S.setStopLoss),d=se(S=>S.setTakeProfit),f=se(S=>S.setDraft),u=se(S=>S.clearDraft),[y,m]=C.useState(e.comment),[g,p]=C.useState(!1),h=Pr(e.digits);C.useEffect(()=>(f({source:"position",entryPrice:e.openPrice,stopLoss:e.stopLoss!==void 0?String(e.stopLoss):"",takeProfit:e.takeProfit!==void 0?String(e.takeProfit):"",side:e.type,showEntryLine:!0,volumeLots:e.volumeLots,digits:e.digits,priceStep:h}),()=>{u()}),[u,e.digits,e.openPrice,e.stopLoss,e.takeProfit,e.type,e.volumeLots,h,f]);const b=vC(e),v=e.volumeLots,_=C.useMemo(()=>{const S=e.profit.toFixed(2);return`Close #${e.ticket} ${e.type} ${v.toFixed(2)} ${e.displaySymbol} ${Ls(e.openPrice,e.digits)} at ${Ls(b,e.digits)} with Profit ${S}`},[b,e,v]),x=async()=>{p(!0);try{const S=await n(e);if(!S.success){Te({variant:"destructive",description:S.message||"Failed to close position."});return}r(e.ticket),t(),Te({description:`Position #${e.ticket} closed.`})}catch(S){const T=S instanceof Error?S.message:"Failed to close position.";Te({variant:"destructive",description:T})}finally{p(!1)}};return c.jsxs("div",{className:"web-trading-widget-detail-panel",children:[c.jsxs("div",{className:"web-trading-widget-detail-panel__header",children:[c.jsxs("p",{className:"web-trading-widget-detail-panel__title web-trading-widget-detail-panel__title--position",children:["#",e.ticket," ",e.type," ",v.toFixed(2)," ",e.displaySymbol," ",Ls(e.openPrice,e.digits)]}),c.jsx("button",{type:"button","aria-label":"Close position panel",className:"web-trading-widget-icon-btn",onClick:t,children:c.jsx(gn,{className:"web-trading-widget-icon web-trading-widget-icon--md"})})]}),c.jsxs("div",{className:"web-trading-widget-detail-panel__body",children:[c.jsx(De,{label:"Lots",value:s,onChange:i,step:.01,min:.01,decimals:2,disabled:!0}),c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Price"}),c.jsx(Rn,{readOnly:!0,disabled:!0,value:Ls(e.openPrice,e.digits),className:"web-trading-widget-detail-panel__input-muted"})]}),c.jsxs("div",{className:"web-trading-widget-market-panel__grid-2",children:[c.jsx(De,{label:"Stop Loss",value:o,onChange:l,step:h,decimals:e.digits,basePrice:e.marketBid??e.openPrice,placeholder:"—"}),c.jsx(De,{label:"Take Profit",value:a,onChange:d,step:h,decimals:e.digits,basePrice:e.marketAsk??e.openPrice,placeholder:"—"})]}),c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Comment"}),c.jsx(Rn,{value:y,onChange:S=>m(S.target.value)})]}),c.jsx(ot,{type:"button",variant:"secondary",className:"web-trading-widget-detail-panel__btn-full",disabled:!0,children:"Modify"}),c.jsx(ot,{type:"button",className:"web-trading-widget-detail-panel__action-btn",disabled:g,onClick:()=>void x(),children:_})]})]})}function Cd({symbolTicker:e,orderState:t}){const n=bc(e),{confirmation:r,isSubmitting:s,defaultVolumeLots:i,volumeStep:o,minVolumeLots:a,selectedLogin:l,isAccountsLoading:d,hasConfirmedAccount:f,dismissConfirmation:u,placeMarketOrder:y}=t,m=ve(P=>P.positions),g=ve(P=>P.orders),p=ve(P=>P.selectedPositionTicket),h=ve(P=>P.selectedOrderTicket),b=ve(P=>P.setSelectedPositionTicket),v=ve(P=>P.setSelectedOrderTicket),_=p!==null?m.find(P=>P.ticket===p)??null:null,x=h!==null?g.find(P=>P.ticket===h)??null:null,S=r!==null,T=C.useCallback(P=>{y({symbolTicker:e,login:P.login,executionMode:P.executionMode,side:P.side,orderType:P.orderType,volumeLots:P.volumeLots,stopLoss:P.stopLoss,takeProfit:P.takeProfit,priceOrder:P.priceOrder,priceTrigger:P.priceTrigger,comment:P.comment,typeTime:P.typeTime,expirationDateTime:P.expirationDateTime,expirationDay:P.expirationDay,bid:P.bid,ask:P.ask})},[y,e]);return _!==null?c.jsx(Am,{position:_,onClose:()=>b(null)}):x!==null?c.jsx(Pm,{order:x,onClose:()=>v(null)}):S&&r!==null?c.jsx(Tm,{confirmation:r,symbolTicker:e,onDismiss:u}):f?c.jsx(bC,{embedded:!0,symbolTicker:e,bid:(n==null?void 0:n.bid)??null,ask:(n==null?void 0:n.ask)??null,defaultVolumeLots:i,volumeStep:o,minVolumeLots:a,isSubmitting:s,isAccountsLoading:d,selectedLogin:l,onPlaceOrder:T}):c.jsx("div",{className:"web-trading-widget-side-panel__empty",children:"Select a trading account to start placing orders."})}function Ed({label:e,isActive:t,onClick:n}){return c.jsx("button",{type:"button",role:"tab","aria-selected":t,className:`web-trading-widget-side-panel__tab${t?" web-trading-widget-side-panel__tab--active":""}`,onClick:n,children:e})}function wC({symbolTicker:e,orderState:t,scanResultUrl:n,onScanResultLoad:r,initialTab:s="trade",activeTab:i,onTabChange:o}){const a=!!n,[l,d]=C.useState(s),f=i!==void 0,u=f?i:l,y=C.useCallback(m=>{f?o==null||o(m):d(m)},[f,o]);return c.jsx("aside",{className:`web-trading-widget-side-panel${a?" web-trading-widget-side-panel--with-scan":""}`,children:a?c.jsxs("div",{className:"web-trading-widget-side-panel__scan-layout",children:[c.jsxs("div",{role:"tablist","aria-label":"Chart side panel",className:"web-trading-widget-side-panel__tablist",children:[c.jsx(Ed,{label:"Trade",isActive:u==="trade",onClick:()=>y("trade")}),c.jsx(Ed,{label:"Scan Result",isActive:u==="scan",onClick:()=>y("scan")})]}),c.jsxs("div",{className:"web-trading-widget-side-panel__panels",children:[c.jsx("div",{role:"tabpanel",hidden:u!=="trade",className:"web-trading-widget-side-panel__tabpanel",children:c.jsx(Cd,{symbolTicker:e,orderState:t})}),c.jsx("div",{role:"tabpanel",hidden:u!=="scan",className:"web-trading-widget-side-panel__tabpanel web-trading-widget-side-panel__tabpanel--scan",children:c.jsx("iframe",{src:n??void 0,title:"Scan result",className:"web-trading-widget-side-panel__iframe",onLoad:r},n)})]})]}):c.jsx("div",{className:"web-trading-widget-side-panel__scroll",children:c.jsx(Cd,{symbolTicker:e,orderState:t})})})}const _C=.01,xC=.01,Td=.01;function SC({symbols:e,defaultPanelAfterConfirm:t="mini"}){const[n,r]=C.useState("closed"),[s,i]=C.useState(null),[o,a]=C.useState(!1),[l,d]=C.useState("pending"),[f,u]=C.useState(null),y=ve(N=>N.setSelectedLogin),{accounts:m,isLoading:g}=em(),{submitOrder:p}=Wi(),h=C.useMemo(()=>zv(m),[m]),b=C.useMemo(()=>Kv(m,f),[m,f]),v=l==="confirmed",_=l==="needs-selection";C.useEffect(()=>{if(g)return;if(l==="confirmed"){f&&!h.some(j=>j.login===f)&&d("needs-selection");return}if(l==="needs-selection")return;const N=Wv();if(N&&h.some(j=>j.login===N)){u(N),d("confirmed"),r(t);return}d("needs-selection")},[l,h,t,g,f]),C.useEffect(()=>{b&&y(b)},[b,y]);const x=C.useCallback(N=>{u(N),y(N),wl(N)},[y]),S=C.useCallback(N=>{N&&(wl(N),x(N),d("confirmed"),i(null),r(t))},[t,x]),T=C.useCallback(()=>{i(null),r("market")},[]),P=C.useCallback(()=>{i(null),r("mini")},[]),O=C.useCallback(()=>{i(null),r("mini")},[]),R=C.useCallback(()=>{i(null),r("mini")},[]),M=C.useCallback(async N=>{const j=se.getState().clearEntryLinePreview,H=N.login.trim();if(!H){j(),Te({variant:"destructive",description:"Please select a trading account."});return}const k=Math.max(Td,N.volumeLots),B=Ii(N.symbolTicker,e);Number(Vt(Ht(N.symbolTicker,e)));const F=ji(N.executionMode),L=oc(N.orderType),D=ht(N.priceOrder),$=ht(N.priceTrigger);if(!F&&D===void 0){j(),Te({variant:"destructive",description:L?"Please set a limit price for this order.":"Please set an order price for pending orders."});return}if(L&&$===void 0){j(),Te({variant:"destructive",description:"Please set a stop price for stop limit orders."});return}if(!F&&!Mi(N.typeTime,N.expirationDateTime,N.expirationDay)){j(),Te({variant:"destructive",description:"Please set an expiration date for this order."});return}const W=F?N.side==="buy"?N.ask:N.bid:D??(N.side==="buy"?N.ask:N.bid);a(!0);try{const I=await p({login:H,symbolTicker:N.symbolTicker,executionMode:N.executionMode,side:ii(N.orderType),orderType:N.orderType,volumeLots:k,stopLoss:ht(N.stopLoss),takeProfit:ht(N.takeProfit),priceOrder:ic(N.orderType)?D:void 0,priceTrigger:L?$:void 0,comment:N.comment.trim(),typeTime:N.typeTime,expirationDateTime:N.expirationDateTime,expirationDay:N.expirationDay,bid:N.bid,ask:N.ask});if(!I.success){j(),Te({variant:"destructive",description:I.message||"Order was not accepted."});return}i({ticket:I.ticket??"",side:I.side??ii(N.orderType),volumeLots:I.volumeLots??k,symbol:I.displaySymbol??B,price:I.price??W}),r("confirmation")}catch(I){j();const re=I instanceof Error?I.message:"Failed to place order.";Te({variant:"destructive",description:re})}finally{a(!1)}},[p,e]);return{panel:n,confirmation:s,isSubmitting:o,defaultVolumeLots:_C,volumeStep:xC,minVolumeLots:Td,accountOptions:h,selectedLogin:b,setSelectedLogin:x,isAccountsLoading:g,hasConfirmedAccount:v,needsAccountSelection:_,confirmAccountSelection:S,openMarketPanel:T,openMiniPanel:P,closePanels:O,dismissConfirmation:R,placeMarketOrder:M}}function pi(e){var t;if(typeof window<"u"){const n=localStorage.getItem(Qn);if(n&&e.some(r=>r.ticker===n))return n}return((t=e[0])==null?void 0:t.ticker)??"XAU_USD"}function ua(e,t,n){var r;return((r=t.find(s=>s.display_name===e||s.ticker===e))==null?void 0:r.ticker)??n}function CC({chartWidget:e,symbols:t,chartSlotElement:n,onSymbolTickerChange:r,onScanResultUrlChange:s,selectSymbolTickerRef:i}){const o=C.useMemo(()=>pi(t),[t]),a=C.useRef(o),l=C.useRef(e),[d,f]=C.useState(null);C.useEffect(()=>{l.current=e},[e]),C.useEffect(()=>{if(!n){f(null);return}const y=()=>{const g=n.querySelector(":scope > div");f(g)};y();const m=new MutationObserver(y);return m.observe(n,{childList:!0}),()=>{m.disconnect()}},[n]);const u=C.useCallback(y=>{if(y===a.current)return;const m=t.find(p=>p.ticker===y);if(!m)return;a.current=y,localStorage.setItem(Qn,y),r(y),s(null);const g=l.current;if(g)try{g.onChartReady(()=>{g.activeChart().setSymbol(m.ticker)})}catch{}},[s,r,t]);return C.useEffect(()=>(i.current=u,()=>{i.current=null}),[u,i]),C.useEffect(()=>{if(!e)return;let y=!1,m=null;try{e.onChartReady(()=>{if(y)return;let g;try{g=e.activeChart()}catch{return}const p=v=>{const _=g.symbol(),x=ua(_,t,o);x!==a.current&&s(null);try{e.resetCache()}catch{}a.current=x,localStorage.setItem(Qn,x),r(x)},h=g.symbol(),b=ua(h,t,o);b!==a.current&&(a.current=b,localStorage.setItem(Qn,b),r(b)),g.onSymbolChanged().subscribe(null,p),m=()=>{try{g.onSymbolChanged().unsubscribe(null,p)}catch{}}})}catch{}return()=>{y=!0,m==null||m()}},[e,s,r,o,t]),{chartContainer:d}}const EC=Ea("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function TC({className:e,variant:t,...n}){return c.jsx("div",{className:Ce(EC({variant:t}),e),...n})}function Om(){var t;const e=(t=window.TradingView)==null?void 0:t.widget;return typeof e=="function"?e:null}function qs(){return Om()!==null}const Pd="/charting_library/charting_library.js";function PC({onLoad:e}){return C.useEffect(()=>{if(qs()){e();return}const t=document.querySelector(`script[src="${Pd}"]`);if(t){const r=()=>{qs()&&e()};return t.addEventListener("load",r),()=>t.removeEventListener("load",r)}const n=document.createElement("script");return n.src=Pd,n.async=!1,n.onload=()=>{qs()&&e()},n.onerror=()=>{console.error("Failed to load TradingView charting library")},document.head.appendChild(n),()=>{n.onload=null,n.onerror=null}},[e]),null}const Ad=Fi(e=>({playEndTimestamp:null,setPlayEndTimestamp:t=>e({playEndTimestamp:t})})),Nm=Fi(e=>({newsSelectedCandles:null,newsPlayEndTimestamp:null,gapCount:0,isReplayMode:!1,setNewsSelectedCandles:t=>e({newsSelectedCandles:t}),setNewsPlayEndTimestamp:t=>e({newsPlayEndTimestamp:t}),setGapCount:t=>e({gapCount:t}),setReplayMode:t=>e({isReplayMode:t})})),fa=8,km=4,pa=5,ma=e=>e==="1"?60:e==="5"?300:e==="1D"?1440*3600:parseInt(e,10)*60,AC=e=>{const t=new Date(e+fa*60*60*1e3),n=t.getUTCDay(),r=t.getUTCHours();return n===0?!1:n===1?r>=pa:n===6?r<=km:!0},OC=e=>{const t=new Date(e+fa*60*60*1e3),n=t.getUTCDay(),r=t.getUTCHours();if(n===0||n===1&&r<pa||n===6&&r>=km){const s=(8-n)%7;return t.setUTCDate(t.getUTCDate()+s),t.setUTCHours(pa,0,0,0),t.getTime()-fa*60*60*1e3}return e},NC=(e,t,n)=>{const r=ma(t)*1e3,s=[];let i=e;for(let o=0;o<n;o++)i+=r,AC(i)||(i=OC(i)),s.push(i);return s},kC=(e,t,n,r)=>{if(n<=0)return[];if(r==="24x7"){const i=ma(t)*1e3;return Array.from({length:n},(o,a)=>e+(a+1)*i)}if(r==="1700-1700")return NC(e,t,n);const s=ma(t)*1e3;return Array.from({length:n},(i,o)=>e+(o+1)*s)},RC=(e,t)=>{if(t==="1D"||t==="D"||t==="1440"){const n=new Date(e*1e3);return n.setUTCHours(0,0,0,0),n.getTime()}return e.toString().length>11?e:e*1e3},Od="wss://symbols.opheleo.com";function LC(e){return{1:6e4,5:3e5,15:9e5,30:18e5,60:36e5,240:144e5}[e]??6e4}function Nd(e){return e.trim().toUpperCase()}function DC(e,t){return Math.floor(e/t)*t}let jr;async function jC(e){const t=new URLSearchParams({symbol:e.symbol,timeframe:e.timeframe,...e.endTimestamp&&{endTimestamp:e.endTimestamp.toString()}});return e.last_evaluated_key&&t.append("last_evaluated_key",e.last_evaluated_key),Re({baseURL:"https://corprate-widget.iccandle.ai",url:`/chart/endTimestamp?${t.toString()}`,method:"GET"})}class IC{constructor(t,n,r=Bt,s=Od){st(this,"futureBarsRef");st(this,"type");st(this,"symbols");st(this,"tickWebSocketUrl");st(this,"configuration",{supported_resolutions:["1","5","15","30","60"],supports_marks:!1,supports_timescale_marks:!0,supports_time:!1});st(this,"ws",null);st(this,"isWsConnecting",!1);st(this,"wsSelectedSymbol",null);st(this,"subscriptions",new Map);st(this,"lastBarsCache",new Map);st(this,"pushFutureBar",t=>{for(const[,n]of this.subscriptions.entries())return n.onTick(t),!0;return!1});this.futureBarsRef=t,this.type=n,this.symbols=r,this.tickWebSocketUrl=s||Od}onReady(t){setTimeout(()=>t(this.configuration),0)}resolveSymbol(t,n,r){const s=this.symbols.find(o=>o.ticker===t),i=this.symbols.find(o=>o.display_name===t);try{setTimeout(()=>{const o={name:(s==null?void 0:s.display_name)||(i==null?void 0:i.display_name)||localStorage.getItem("tv:latest-symbol")||"XAU_USD",timezone:"America/New_York",minmov:1,session:(s==null?void 0:s.session)||(i==null?void 0:i.session)||"24x7",has_intraday:!0,visible_plots_set:"ohlc",library_custom_fields:{ticker:(s==null?void 0:s.ticker)||(i==null?void 0:i.ticker)||localStorage.getItem("tv:latest-symbol")||"XAU_USD"},description:(s==null?void 0:s.description)||(i==null?void 0:i.description)||"",type:(s==null?void 0:s.type)||(i==null?void 0:i.type)||"",pricescale:(s==null?void 0:s.pricescale)||(i==null?void 0:i.pricescale)||1e5,ticker:(s==null?void 0:s.display_name)||(i==null?void 0:i.display_name)||localStorage.getItem("tv:latest-symbol")||"XAU_USD",exchange:"FX",format:"price",listed_exchange:"FX",logo_urls:(s==null?void 0:s.logo_urls.map(a=>a.replace("https://cdn.iccandle.ai/web-assets","/images/symbols")))||(i==null?void 0:i.logo_urls.map(a=>a.replace("https://cdn.iccandle.ai/web-assets","/images/symbols")))};n(o)},0)}catch{r("Symbol not found")}}getBars(t,n,r,s,i){var u;const o=(u=t.library_custom_fields)==null?void 0:u.ticker,a=this.symbols.find(y=>o!==void 0&&y.ticker===o||y.ticker===t.ticker||y.display_name===t.name||y.display_name===t.ticker),l={symbol:(a==null?void 0:a.ticker)||"",timeframe:n};if(r.firstDataRequest&&(jr=void 0),!r.firstDataRequest)if(jr)l.last_evaluated_key=jr;else{s([],{noData:!0});return}const f=Ad.getState().playEndTimestamp;f&&(l.endTimestamp=f,Ad.getState().setPlayEndTimestamp(null),jr=void 0),(async()=>{var y;try{const{data:m}=await jC(l);if(m.data_status==="threshold_limited"){s([],{noData:!0});return}if(m.data_status==="end_of_data"){s([],{noData:!0});return}if(!((y=m.items)!=null&&y.length)){s([],{noData:!0});return}jr=m.last_evaluated_key;const p=[...m.items].map(_=>({open:_.o,high:_.h,low:_.l,close:_.c,time:RC(_.timestamp,n)})),h=Nm.getState(),{gapCount:b,isReplayMode:v}=h;if(v&&event){const _=kC(p[p.length-1].time,n,b||0,t.session);if(_.length>0){const x=p[p.length-1].close;for(const S of _)p.push({open:x,high:x,low:x,close:x,time:S})}}s(p)}catch(m){i(m),s([],{noData:!0})}})()}searchSymbols(t,n,r,s){if(r==="all"||r===""){const i=this.symbols.filter(o=>{var a;return(a=o.display_name)==null?void 0:a.toUpperCase().includes(t.toUpperCase())}).map(o=>({...o,symbol:o.display_name,exchange:"FX",logo_urls:o.logo_urls.map(a=>a.replace("https://cdn.iccandle.ai/web-assets","/images/symbols"))}));s(i)}else{const i=this.symbols.filter(o=>{var a;return((a=o.display_name)==null?void 0:a.toUpperCase().includes(t.toUpperCase()))&&o.type.includes(r)}).map(o=>({...o,symbol:o.display_name,exchange:"FX",logo_urls:o.logo_urls.map(a=>a.replace("https://cdn.iccandle.ai/web-assets","/images/symbols"))}));s(i)}}subscribeBars(t,n,r,s,i){var u;const o=(u=t.library_custom_fields)==null?void 0:u.ticker,a=this.symbols.find(y=>o!==void 0&&y.ticker===o||y.display_name===t.ticker||y.display_name===t.name),l=a!=null&&a.resolve_symbol?Nd(a.resolve_symbol):Nd(t.ticker||t.name||""),d=LC(n),f=`${l}|${n}`;this.subscriptions.set(s,{symbol:l,resolution:n,periodMs:d,onTick:r,onResetCacheNeededCallback:i,liveCandle:this.lastBarsCache.get(f)??null}),this.ensureWebSocket(l)}unsubscribeBars(t){this.subscriptions.delete(t),this.subscriptions.size===0&&this.ws&&(this.ws.close(1e3,"No more subscriptions"),this.ws=null)}ensureWebSocket(t){var s;const n=t??((s=this.subscriptions.values().next().value)==null?void 0:s.symbol);if(this.ws&&this.ws.readyState===WebSocket.OPEN&&this.wsSelectedSymbol===n||(this.ws&&this.wsSelectedSymbol!==n&&(this.ws.close(1e3,"Symbol change"),this.ws=null,this.wsSelectedSymbol=null),this.isWsConnecting))return;this.isWsConnecting=!0;const r=new WebSocket(this.tickWebSocketUrl);this.ws=r,this.wsSelectedSymbol=n??null,r.onopen=()=>{this.isWsConnecting=!1,n&&r.send(JSON.stringify({action:"select_symbol",symbol:n}))},r.onmessage=i=>this.handleMessage(i),r.onerror=()=>{this.isWsConnecting=!1},r.onclose=()=>{this.ws=null,this.wsSelectedSymbol=null,this.isWsConnecting=!1,this.subscriptions.size>0&&setTimeout(()=>this.ensureWebSocket(),3e3)}}handleMessage(t){try{const n=JSON.parse(t.data);this.processTick(n)}catch{}}processTick(t){const n=t.symbol,r=Number(t.updatedAtMs),s=(Number(t.bid)+Number(t.ask))/2;if(!(!Number.isFinite(r)||!Number.isFinite(s)))for(const[i,o]of this.subscriptions.entries()){if(o.symbol!==n)continue;const a=`${o.symbol}|${o.resolution}`,l=DC(r,o.periodMs);let d=o.liveCandle;d?l>d.time?d={time:l,open:s,high:s,low:s,close:s,volume:0}:d={...d,high:Math.max(d.high,s),low:Math.min(d.low,s),close:s}:d={time:l,open:s,high:s,low:s,close:s,volume:0},o.liveCandle=d,this.lastBarsCache.set(a,d),this.subscriptions.set(i,o),(u=>{var y,m;(m=(y=this.futureBarsRef)==null?void 0:y.current)!=null&&m.length||o.onTick(u)})(d)}}extractErrorMessage(t){if(t instanceof Error)return t.message;if(typeof t=="string")return t;try{return JSON.stringify(t)}catch{return String(t)}}getTimescaleMarks(t,n,r,s){const i=[];if(this.type&&this.type=="selector")try{const o=JSON.parse(localStorage.getItem("tv:selected-news-events")||"[]");o==null||o.forEach(({id:a,timestamp:l,event_name:d,currency:f})=>{!a||!Number.isFinite(l)||l<=0||i.some(u=>String(u.id)===String(a))||i.push({id:a,time:l/1e3,color:"green",label:d.slice(0,1)||"N",tooltip:[d],...f?{imageUrl:`/images/symbols/${f}.svg`}:{},showLabelWhenImageLoaded:!0})})}catch{}if(this.type&&this.type=="news")try{const o=JSON.parse(localStorage.getItem("iccandle:current-news-event")||"{}"),{id:a,timestamp:l,event_name:d,currency:f,forecast:u,previous:y,actual:m}=o;if(!a||!Number.isFinite(l)||l<=0||i.some(p=>String(p.id)==="news:"+a))return;i.push({id:"news:"+a,time:l/1e3,color:"green",label:d.slice(0,1),tooltip:[d,`Current Forecast: ${u||"-"}`,`Previous Forecast: ${y||"-"}`,`Previous Actual: ${m||"-"}`],...f?{imageUrl:`https://cdn.iccandle.ai/web-assets/${f??"USD"}.svg`}:{}})}catch{}s(i)}}const MC=e=>{const t={name:"Generated Candles - By iC Candle",metainfo:{_metainfoVersion:51,id:"Generated Candles - By iC Candle@tv-basicstudies-1",description:"Generated Candles - By iC Candle",shortDescription:"Generated Candles",isCustomIndicator:!0,is_hidden_study:!1,is_price_study:!0,linkedToSeries:!0,format:{type:"price",precision:2},inputs:[],palettes:{palette_bar:{colors:{0:{name:"Bullish"},1:{name:"Bearish"}},valToIndex:{0:0,1:1}},palette_wick:{colors:{0:{name:"Bullish Wick"},1:{name:"Bearish Wick"}},valToIndex:{0:0,1:1}},palette_border:{colors:{0:{name:"Bullish Border"},1:{name:"Bearish Border"}},valToIndex:{0:0,1:1}}},plots:[{id:"plot_open",type:"ohlc_open",target:"plot_candle"},{id:"plot_high",type:"ohlc_high",target:"plot_candle"},{id:"plot_low",type:"ohlc_low",target:"plot_candle"},{id:"plot_close",type:"ohlc_close",target:"plot_candle"},{id:"plot_bar_color",type:"ohlc_colorer",palette:"palette_bar",target:"plot_candle"},{id:"plot_wick_color",type:"wick_colorer",palette:"palette_wick",target:"plot_candle"},{id:"plot_border_color",type:"border_colorer",palette:"palette_border",target:"plot_candle"}],ohlcPlots:{plot_candle:{title:"Generated Candles"}},styles:{},defaults:{styles:{},ohlcPlots:{plot_candle:{borderColor:"#000000",color:"#000000",drawBorder:!0,drawWick:!0,plottype:"ohlc_candles",visible:!0,wickColor:"#000000"}},palettes:{palette_bar:{colors:{0:{color:"#00dfb9",width:1,style:0},1:{color:"#ffb84d",width:1,style:0}}},palette_wick:{colors:{0:{color:"#00dfb9",width:1,style:0},1:{color:"#ffb84d",width:1,style:0}}},palette_border:{colors:{0:{color:"#00dfb9",width:1,style:0},1:{color:"#ffb84d",width:1,style:0}}}},precision:2,inputs:{}}},constructor:function(){this.init=function(n){this._context=n},this.main=function(n){this._context=n;const r=n.symbol.time,s=e.current,i=n.symbol.open,o=n.symbol.high,a=n.symbol.low,l=n.symbol.close;if(!Number.isFinite(r)||!s||s.length===0)return[i,o,a,l,Number.NaN,Number.NaN,Number.NaN];if(!s.some(y=>y.time===r))return[i,o,a,l,Number.NaN,Number.NaN,Number.NaN];const u=l<i?1:0;return[i,o,a,l,u,u,u]}}};return Promise.resolve([t])},ha="An unknown error occurred",Gs=e=>{if(typeof e=="string")return e;if(typeof e!="object"||e===null)return ha;if(typeof e.message=="string")return e.message;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const n=Gs(e[t]);if(n)return n}return ha},FC=e=>{var t;if(Ap(e)){const n=(t=e.response)!=null&&t.data?Gs(e.response.data):void 0;return n&&n!==ha?n:Gs(e)}return Gs(e)},UC=({queryKey:e,queryFn:t,...n})=>Nr({queryKey:e,queryFn:async r=>{var s;try{const i=r.queryKey[1];return await t(i)}catch(i){throw Te({variant:"destructive",title:"Error",description:FC(Ap(i)?(s=i.response)==null?void 0:s.data:i)}),null}},...n});var xe;(function(e){e.assertEqual=s=>{};function t(s){}e.assertIs=t;function n(s){throw new Error}e.assertNever=n,e.arrayToEnum=s=>{const i={};for(const o of s)i[o]=o;return i},e.getValidEnumValues=s=>{const i=e.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),o={};for(const a of i)o[a]=s[a];return e.objectValues(o)},e.objectValues=s=>e.objectKeys(s).map(function(i){return s[i]}),e.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const i=[];for(const o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.push(o);return i},e.find=(s,i)=>{for(const o of s)if(i(o))return o},e.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}e.joinValues=r,e.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(xe||(xe={}));var kd;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(kd||(kd={}));const Y=xe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Yt=e=>{switch(typeof e){case"undefined":return Y.undefined;case"string":return Y.string;case"number":return Number.isNaN(e)?Y.nan:Y.number;case"boolean":return Y.boolean;case"function":return Y.function;case"bigint":return Y.bigint;case"symbol":return Y.symbol;case"object":return Array.isArray(e)?Y.array:e===null?Y.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Y.promise:typeof Map<"u"&&e instanceof Map?Y.map:typeof Set<"u"&&e instanceof Set?Y.set:typeof Date<"u"&&e instanceof Date?Y.date:Y.object;default:return Y.unknown}},V=xe.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Ut extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){const n=t||function(i){return i.message},r={_errors:[]},s=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let a=r,l=0;for(;l<o.path.length;){const d=o.path[l];l===o.path.length-1?(a[d]=a[d]||{_errors:[]},a[d]._errors.push(n(o))):a[d]=a[d]||{_errors:[]},a=a[d],l++}}};return s(this),r}static assert(t){if(!(t instanceof Ut))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,xe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const s of this.issues)if(s.path.length>0){const i=s.path[0];n[i]=n[i]||[],n[i].push(t(s))}else r.push(t(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Ut.create=e=>new Ut(e);const ga=(e,t)=>{let n;switch(e.code){case V.invalid_type:e.received===Y.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case V.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,xe.jsonStringifyReplacer)}`;break;case V.unrecognized_keys:n=`Unrecognized key(s) in object: ${xe.joinValues(e.keys,", ")}`;break;case V.invalid_union:n="Invalid input";break;case V.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${xe.joinValues(e.options)}`;break;case V.invalid_enum_value:n=`Invalid enum value. Expected ${xe.joinValues(e.options)}, received '${e.received}'`;break;case V.invalid_arguments:n="Invalid function arguments";break;case V.invalid_return_type:n="Invalid function return type";break;case V.invalid_date:n="Invalid date";break;case V.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:xe.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case V.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case V.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case V.custom:n="Invalid input";break;case V.invalid_intersection_types:n="Intersection results could not be merged";break;case V.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case V.not_finite:n="Number must be finite";break;default:n=t.defaultError,xe.assertNever(e)}return{message:n}};let BC=ga;function $C(){return BC}const VC=e=>{const{data:t,path:n,errorMaps:r,issueData:s}=e,i=[...n,...s.path||[]],o={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let a="";const l=r.filter(d=>!!d).slice().reverse();for(const d of l)a=d(o,{data:t,defaultError:a}).message;return{...s,path:i,message:a}};function G(e,t){const n=$C(),r=VC({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===ga?void 0:ga].filter(s=>!!s)});e.common.issues.push(r)}class rt{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const s of n){if(s.status==="aborted")return ae;s.status==="dirty"&&t.dirty(),r.push(s.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const s of n){const i=await s.key,o=await s.value;r.push({key:i,value:o})}return rt.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const s of n){const{key:i,value:o}=s;if(i.status==="aborted"||o.status==="aborted")return ae;i.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(r[i.value]=o.value)}return{status:t.value,value:r}}}const ae=Object.freeze({status:"aborted"}),Ur=e=>({status:"dirty",value:e}),lt=e=>({status:"valid",value:e}),Rd=e=>e.status==="aborted",Ld=e=>e.status==="dirty",vr=e=>e.status==="valid",mi=e=>typeof Promise<"u"&&e instanceof Promise;var Q;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(Q||(Q={}));class fn{constructor(t,n,r,s){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Dd=(e,t)=>{if(vr(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Ut(e.common.issues);return this._error=n,this._error}}};function de(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:s}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:s}:{errorMap:(o,a)=>{const{message:l}=e;return o.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:s}}class _e{get description(){return this._def.description}_getType(t){return Yt(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Yt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new rt,ctx:{common:t.parent.common,data:t.data,parsedType:Yt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(mi(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Yt(t)},s=this._parseSync({data:t,path:r.path,parent:r});return Dd(r,s)}"~validate"(t){var r,s;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Yt(t)};if(!this["~standard"].async)try{const i=this._parseSync({data:t,path:[],parent:n});return vr(i)?{value:i.value}:{issues:n.common.issues}}catch(i){(s=(r=i==null?void 0:i.message)==null?void 0:r.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(i=>vr(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Yt(t)},s=this._parse({data:t,path:r.path,parent:r}),i=await(mi(s)?s:Promise.resolve(s));return Dd(r,i)}refine(t,n){const r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,i)=>{const o=t(s),a=()=>i.addIssue({code:V.custom,...r(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,s)=>t(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(t){return new xr({schema:this,typeName:ce.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return cn.create(this,this._def)}nullable(){return Sr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return kt.create(this)}promise(){return bi.create(this,this._def)}or(t){return gi.create([this,t],this._def)}and(t){return yi.create(this,t,this._def)}transform(t){return new xr({...de(this._def),schema:this,typeName:ce.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new va({...de(this._def),innerType:this,defaultValue:n,typeName:ce.ZodDefault})}brand(){return new uE({typeName:ce.ZodBranded,type:this,...de(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new wa({...de(this._def),innerType:this,catchValue:n,typeName:ce.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Lc.create(this,t)}readonly(){return _a.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const HC=/^c[^\s-]{8,}$/i,zC=/^[0-9a-z]+$/,WC=/^[0-9A-HJKMNP-TV-Z]{26}$/i,KC=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,qC=/^[a-z0-9_-]{21}$/i,GC=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ZC=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,YC=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,QC="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Eo;const XC=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,JC=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,eE=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,tE=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,nE=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,rE=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Rm="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",sE=new RegExp(`^${Rm}$`);function Lm(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function iE(e){return new RegExp(`^${Lm(e)}$`)}function oE(e){let t=`${Rm}T${Lm(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function aE(e,t){return!!((t==="v4"||!t)&&XC.test(e)||(t==="v6"||!t)&&eE.test(e))}function cE(e,t){if(!GC.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||t&&s.alg!==t)}catch{return!1}}function lE(e,t){return!!((t==="v4"||!t)&&JC.test(e)||(t==="v6"||!t)&&tE.test(e))}class sn extends _e{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Y.string){const i=this._getOrReturnCtx(t);return G(i,{code:V.invalid_type,expected:Y.string,received:i.parsedType}),ae}const r=new rt;let s;for(const i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(s=this._getOrReturnCtx(t,s),G(s,{code:V.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")t.data.length>i.value&&(s=this._getOrReturnCtx(t,s),G(s,{code:V.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const o=t.data.length>i.value,a=t.data.length<i.value;(o||a)&&(s=this._getOrReturnCtx(t,s),o?G(s,{code:V.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&G(s,{code:V.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")YC.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"email",code:V.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")Eo||(Eo=new RegExp(QC,"u")),Eo.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"emoji",code:V.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")KC.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"uuid",code:V.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")qC.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"nanoid",code:V.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")HC.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"cuid",code:V.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")zC.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"cuid2",code:V.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")WC.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"ulid",code:V.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{s=this._getOrReturnCtx(t,s),G(s,{validation:"url",code:V.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"regex",code:V.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(t,s),G(s,{code:V.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(s=this._getOrReturnCtx(t,s),G(s,{code:V.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(s=this._getOrReturnCtx(t,s),G(s,{code:V.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?oE(i).test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{code:V.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?sE.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{code:V.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?iE(i).test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{code:V.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?ZC.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"duration",code:V.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?aE(t.data,i.version)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"ip",code:V.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?cE(t.data,i.alg)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"jwt",code:V.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?lE(t.data,i.version)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"cidr",code:V.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?nE.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"base64",code:V.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?rE.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"base64url",code:V.invalid_string,message:i.message}),r.dirty()):xe.assertNever(i);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(s=>t.test(s),{validation:n,code:V.invalid_string,...Q.errToObj(r)})}_addCheck(t){return new sn({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Q.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Q.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Q.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Q.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Q.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Q.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Q.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Q.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Q.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...Q.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...Q.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Q.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...Q.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,...Q.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...Q.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...Q.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...Q.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...Q.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...Q.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...Q.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...Q.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...Q.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...Q.errToObj(n)})}nonempty(t){return this.min(1,Q.errToObj(t))}trim(){return new sn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new sn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new sn({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}sn.create=e=>new sn({checks:[],typeName:ce.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...de(e)});function dE(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,s=n>r?n:r,i=Number.parseInt(e.toFixed(s).replace(".","")),o=Number.parseInt(t.toFixed(s).replace(".",""));return i%o/10**s}class wr extends _e{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==Y.number){const i=this._getOrReturnCtx(t);return G(i,{code:V.invalid_type,expected:Y.number,received:i.parsedType}),ae}let r;const s=new rt;for(const i of this._def.checks)i.kind==="int"?xe.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),G(r,{code:V.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),G(r,{code:V.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),G(r,{code:V.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?dE(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),G(r,{code:V.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),G(r,{code:V.not_finite,message:i.message}),s.dirty()):xe.assertNever(i);return{status:s.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,Q.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Q.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Q.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Q.toString(n))}setLimit(t,n,r,s){return new wr({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Q.toString(s)}]})}_addCheck(t){return new wr({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Q.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Q.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Q.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Q.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Q.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Q.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:Q.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Q.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Q.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&xe.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}wr.create=e=>new wr({checks:[],typeName:ce.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...de(e)});class Zr extends _e{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==Y.bigint)return this._getInvalidInput(t);let r;const s=new rt;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),G(r,{code:V.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),G(r,{code:V.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),G(r,{code:V.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):xe.assertNever(i);return{status:s.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return G(n,{code:V.invalid_type,expected:Y.bigint,received:n.parsedType}),ae}gte(t,n){return this.setLimit("min",t,!0,Q.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Q.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Q.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Q.toString(n))}setLimit(t,n,r,s){return new Zr({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Q.toString(s)}]})}_addCheck(t){return new Zr({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Q.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Q.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Q.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Q.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Q.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Zr.create=e=>new Zr({checks:[],typeName:ce.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...de(e)});class ya extends _e{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Y.boolean){const r=this._getOrReturnCtx(t);return G(r,{code:V.invalid_type,expected:Y.boolean,received:r.parsedType}),ae}return lt(t.data)}}ya.create=e=>new ya({typeName:ce.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...de(e)});class hi extends _e{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Y.date){const i=this._getOrReturnCtx(t);return G(i,{code:V.invalid_type,expected:Y.date,received:i.parsedType}),ae}if(Number.isNaN(t.data.getTime())){const i=this._getOrReturnCtx(t);return G(i,{code:V.invalid_date}),ae}const r=new rt;let s;for(const i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(s=this._getOrReturnCtx(t,s),G(s,{code:V.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(s=this._getOrReturnCtx(t,s),G(s,{code:V.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):xe.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new hi({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:Q.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:Q.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}hi.create=e=>new hi({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:ce.ZodDate,...de(e)});class jd extends _e{_parse(t){if(this._getType(t)!==Y.symbol){const r=this._getOrReturnCtx(t);return G(r,{code:V.invalid_type,expected:Y.symbol,received:r.parsedType}),ae}return lt(t.data)}}jd.create=e=>new jd({typeName:ce.ZodSymbol,...de(e)});class Id extends _e{_parse(t){if(this._getType(t)!==Y.undefined){const r=this._getOrReturnCtx(t);return G(r,{code:V.invalid_type,expected:Y.undefined,received:r.parsedType}),ae}return lt(t.data)}}Id.create=e=>new Id({typeName:ce.ZodUndefined,...de(e)});class Md extends _e{_parse(t){if(this._getType(t)!==Y.null){const r=this._getOrReturnCtx(t);return G(r,{code:V.invalid_type,expected:Y.null,received:r.parsedType}),ae}return lt(t.data)}}Md.create=e=>new Md({typeName:ce.ZodNull,...de(e)});class Fd extends _e{constructor(){super(...arguments),this._any=!0}_parse(t){return lt(t.data)}}Fd.create=e=>new Fd({typeName:ce.ZodAny,...de(e)});class Ud extends _e{constructor(){super(...arguments),this._unknown=!0}_parse(t){return lt(t.data)}}Ud.create=e=>new Ud({typeName:ce.ZodUnknown,...de(e)});class pn extends _e{_parse(t){const n=this._getOrReturnCtx(t);return G(n,{code:V.invalid_type,expected:Y.never,received:n.parsedType}),ae}}pn.create=e=>new pn({typeName:ce.ZodNever,...de(e)});class Bd extends _e{_parse(t){if(this._getType(t)!==Y.undefined){const r=this._getOrReturnCtx(t);return G(r,{code:V.invalid_type,expected:Y.void,received:r.parsedType}),ae}return lt(t.data)}}Bd.create=e=>new Bd({typeName:ce.ZodVoid,...de(e)});class kt extends _e{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),s=this._def;if(n.parsedType!==Y.array)return G(n,{code:V.invalid_type,expected:Y.array,received:n.parsedType}),ae;if(s.exactLength!==null){const o=n.data.length>s.exactLength.value,a=n.data.length<s.exactLength.value;(o||a)&&(G(n,{code:o?V.too_big:V.too_small,minimum:a?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(G(n,{code:V.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(G(n,{code:V.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,a)=>s.type._parseAsync(new fn(n,o,n.path,a)))).then(o=>rt.mergeArray(r,o));const i=[...n.data].map((o,a)=>s.type._parseSync(new fn(n,o,n.path,a)));return rt.mergeArray(r,i)}get element(){return this._def.type}min(t,n){return new kt({...this._def,minLength:{value:t,message:Q.toString(n)}})}max(t,n){return new kt({...this._def,maxLength:{value:t,message:Q.toString(n)}})}length(t,n){return new kt({...this._def,exactLength:{value:t,message:Q.toString(n)}})}nonempty(t){return this.min(1,t)}}kt.create=(e,t)=>new kt({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ce.ZodArray,...de(t)});function Yn(e){if(e instanceof je){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=cn.create(Yn(r))}return new je({...e._def,shape:()=>t})}else return e instanceof kt?new kt({...e._def,type:Yn(e.element)}):e instanceof cn?cn.create(Yn(e.unwrap())):e instanceof Sr?Sr.create(Yn(e.unwrap())):e instanceof Fn?Fn.create(e.items.map(t=>Yn(t))):e}class je extends _e{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=xe.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==Y.object){const d=this._getOrReturnCtx(t);return G(d,{code:V.invalid_type,expected:Y.object,received:d.parsedType}),ae}const{status:r,ctx:s}=this._processInputParams(t),{shape:i,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof pn&&this._def.unknownKeys==="strip"))for(const d in s.data)o.includes(d)||a.push(d);const l=[];for(const d of o){const f=i[d],u=s.data[d];l.push({key:{status:"valid",value:d},value:f._parse(new fn(s,u,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof pn){const d=this._def.unknownKeys;if(d==="passthrough")for(const f of a)l.push({key:{status:"valid",value:f},value:{status:"valid",value:s.data[f]}});else if(d==="strict")a.length>0&&(G(s,{code:V.unrecognized_keys,keys:a}),r.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const f of a){const u=s.data[f];l.push({key:{status:"valid",value:f},value:d._parse(new fn(s,u,s.path,f)),alwaysSet:f in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const d=[];for(const f of l){const u=await f.key,y=await f.value;d.push({key:u,value:y,alwaysSet:f.alwaysSet})}return d}).then(d=>rt.mergeObjectSync(r,d)):rt.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return Q.errToObj,new je({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var i,o;const s=((o=(i=this._def).errorMap)==null?void 0:o.call(i,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:Q.errToObj(t).message??s}:{message:s}}}:{}})}strip(){return new je({...this._def,unknownKeys:"strip"})}passthrough(){return new je({...this._def,unknownKeys:"passthrough"})}extend(t){return new je({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new je({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:ce.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new je({...this._def,catchall:t})}pick(t){const n={};for(const r of xe.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new je({...this._def,shape:()=>n})}omit(t){const n={};for(const r of xe.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new je({...this._def,shape:()=>n})}deepPartial(){return Yn(this)}partial(t){const n={};for(const r of xe.objectKeys(this.shape)){const s=this.shape[r];t&&!t[r]?n[r]=s:n[r]=s.optional()}return new je({...this._def,shape:()=>n})}required(t){const n={};for(const r of xe.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof cn;)i=i._def.innerType;n[r]=i}return new je({...this._def,shape:()=>n})}keyof(){return Dm(xe.objectKeys(this.shape))}}je.create=(e,t)=>new je({shape:()=>e,unknownKeys:"strip",catchall:pn.create(),typeName:ce.ZodObject,...de(t)});je.strictCreate=(e,t)=>new je({shape:()=>e,unknownKeys:"strict",catchall:pn.create(),typeName:ce.ZodObject,...de(t)});je.lazycreate=(e,t)=>new je({shape:e,unknownKeys:"strip",catchall:pn.create(),typeName:ce.ZodObject,...de(t)});class gi extends _e{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function s(i){for(const a of i)if(a.result.status==="valid")return a.result;for(const a of i)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(a=>new Ut(a.ctx.common.issues));return G(n,{code:V.invalid_union,unionErrors:o}),ae}if(n.common.async)return Promise.all(r.map(async i=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(s);{let i;const o=[];for(const l of r){const d={...n,common:{...n.common,issues:[]},parent:null},f=l._parseSync({data:n.data,path:n.path,parent:d});if(f.status==="valid")return f;f.status==="dirty"&&!i&&(i={result:f,ctx:d}),d.common.issues.length&&o.push(d.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const a=o.map(l=>new Ut(l));return G(n,{code:V.invalid_union,unionErrors:a}),ae}}get options(){return this._def.options}}gi.create=(e,t)=>new gi({options:e,typeName:ce.ZodUnion,...de(t)});function ba(e,t){const n=Yt(e),r=Yt(t);if(e===t)return{valid:!0,data:e};if(n===Y.object&&r===Y.object){const s=xe.objectKeys(t),i=xe.objectKeys(e).filter(a=>s.indexOf(a)!==-1),o={...e,...t};for(const a of i){const l=ba(e[a],t[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(n===Y.array&&r===Y.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let i=0;i<e.length;i++){const o=e[i],a=t[i],l=ba(o,a);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return n===Y.date&&r===Y.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class yi extends _e{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),s=(i,o)=>{if(Rd(i)||Rd(o))return ae;const a=ba(i.value,o.value);return a.valid?((Ld(i)||Ld(o))&&n.dirty(),{status:n.value,value:a.data}):(G(r,{code:V.invalid_intersection_types}),ae)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,o])=>s(i,o)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}yi.create=(e,t,n)=>new yi({left:e,right:t,typeName:ce.ZodIntersection,...de(n)});class Fn extends _e{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Y.array)return G(r,{code:V.invalid_type,expected:Y.array,received:r.parsedType}),ae;if(r.data.length<this._def.items.length)return G(r,{code:V.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ae;!this._def.rest&&r.data.length>this._def.items.length&&(G(r,{code:V.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((o,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new fn(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>rt.mergeArray(n,o)):rt.mergeArray(n,i)}get items(){return this._def.items}rest(t){return new Fn({...this._def,rest:t})}}Fn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Fn({items:e,typeName:ce.ZodTuple,rest:null,...de(t)})};class $d extends _e{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Y.map)return G(r,{code:V.invalid_type,expected:Y.map,received:r.parsedType}),ae;const s=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([a,l],d)=>({key:s._parse(new fn(r,a,r.path,[d,"key"])),value:i._parse(new fn(r,l,r.path,[d,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of o){const d=await l.key,f=await l.value;if(d.status==="aborted"||f.status==="aborted")return ae;(d.status==="dirty"||f.status==="dirty")&&n.dirty(),a.set(d.value,f.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of o){const d=l.key,f=l.value;if(d.status==="aborted"||f.status==="aborted")return ae;(d.status==="dirty"||f.status==="dirty")&&n.dirty(),a.set(d.value,f.value)}return{status:n.value,value:a}}}}$d.create=(e,t,n)=>new $d({valueType:t,keyType:e,typeName:ce.ZodMap,...de(n)});class Yr extends _e{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Y.set)return G(r,{code:V.invalid_type,expected:Y.set,received:r.parsedType}),ae;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(G(r,{code:V.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(G(r,{code:V.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const i=this._def.valueType;function o(l){const d=new Set;for(const f of l){if(f.status==="aborted")return ae;f.status==="dirty"&&n.dirty(),d.add(f.value)}return{status:n.value,value:d}}const a=[...r.data.values()].map((l,d)=>i._parse(new fn(r,l,r.path,d)));return r.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(t,n){return new Yr({...this._def,minSize:{value:t,message:Q.toString(n)}})}max(t,n){return new Yr({...this._def,maxSize:{value:t,message:Q.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}Yr.create=(e,t)=>new Yr({valueType:e,minSize:null,maxSize:null,typeName:ce.ZodSet,...de(t)});class Vd extends _e{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Vd.create=(e,t)=>new Vd({getter:e,typeName:ce.ZodLazy,...de(t)});class Hd extends _e{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return G(n,{received:n.data,code:V.invalid_literal,expected:this._def.value}),ae}return{status:"valid",value:t.data}}get value(){return this._def.value}}Hd.create=(e,t)=>new Hd({value:e,typeName:ce.ZodLiteral,...de(t)});function Dm(e,t){return new _r({values:e,typeName:ce.ZodEnum,...de(t)})}class _r extends _e{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return G(n,{expected:xe.joinValues(r),received:n.parsedType,code:V.invalid_type}),ae}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return G(n,{received:n.data,code:V.invalid_enum_value,options:r}),ae}return lt(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return _r.create(t,{...this._def,...n})}exclude(t,n=this._def){return _r.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}_r.create=Dm;class zd extends _e{_parse(t){const n=xe.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==Y.string&&r.parsedType!==Y.number){const s=xe.objectValues(n);return G(r,{expected:xe.joinValues(s),received:r.parsedType,code:V.invalid_type}),ae}if(this._cache||(this._cache=new Set(xe.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const s=xe.objectValues(n);return G(r,{received:r.data,code:V.invalid_enum_value,options:s}),ae}return lt(t.data)}get enum(){return this._def.values}}zd.create=(e,t)=>new zd({values:e,typeName:ce.ZodNativeEnum,...de(t)});class bi extends _e{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Y.promise&&n.common.async===!1)return G(n,{code:V.invalid_type,expected:Y.promise,received:n.parsedType}),ae;const r=n.parsedType===Y.promise?n.data:Promise.resolve(n.data);return lt(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}bi.create=(e,t)=>new bi({type:e,typeName:ce.ZodPromise,...de(t)});class xr extends _e{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ce.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),s=this._def.effect||null,i={addIssue:o=>{G(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){const o=s.transform(r.data,i);if(r.common.async)return Promise.resolve(o).then(async a=>{if(n.value==="aborted")return ae;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?ae:l.status==="dirty"||n.value==="dirty"?Ur(l.value):l});{if(n.value==="aborted")return ae;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?ae:a.status==="dirty"||n.value==="dirty"?Ur(a.value):a}}if(s.type==="refinement"){const o=a=>{const l=s.refinement(a,i);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?ae:(a.status==="dirty"&&n.dirty(),o(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?ae:(a.status==="dirty"&&n.dirty(),o(a.value).then(()=>({status:n.value,value:a.value}))))}if(s.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!vr(o))return ae;const a=s.transform(o.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>vr(o)?Promise.resolve(s.transform(o.value,i)).then(a=>({status:n.value,value:a})):ae);xe.assertNever(s)}}xr.create=(e,t,n)=>new xr({schema:e,typeName:ce.ZodEffects,effect:t,...de(n)});xr.createWithPreprocess=(e,t,n)=>new xr({schema:t,effect:{type:"preprocess",transform:e},typeName:ce.ZodEffects,...de(n)});class cn extends _e{_parse(t){return this._getType(t)===Y.undefined?lt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}cn.create=(e,t)=>new cn({innerType:e,typeName:ce.ZodOptional,...de(t)});class Sr extends _e{_parse(t){return this._getType(t)===Y.null?lt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Sr.create=(e,t)=>new Sr({innerType:e,typeName:ce.ZodNullable,...de(t)});class va extends _e{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===Y.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}va.create=(e,t)=>new va({innerType:e,typeName:ce.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...de(t)});class wa extends _e{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return mi(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Ut(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ut(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}wa.create=(e,t)=>new wa({innerType:e,typeName:ce.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...de(t)});class Wd extends _e{_parse(t){if(this._getType(t)!==Y.nan){const r=this._getOrReturnCtx(t);return G(r,{code:V.invalid_type,expected:Y.nan,received:r.parsedType}),ae}return{status:"valid",value:t.data}}}Wd.create=e=>new Wd({typeName:ce.ZodNaN,...de(e)});class uE extends _e{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Lc extends _e{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?ae:i.status==="dirty"?(n.dirty(),Ur(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?ae:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(t,n){return new Lc({in:t,out:n,typeName:ce.ZodPipeline})}}class _a extends _e{_parse(t){const n=this._def.innerType._parse(t),r=s=>(vr(s)&&(s.value=Object.freeze(s.value)),s);return mi(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}_a.create=(e,t)=>new _a({innerType:e,typeName:ce.ZodReadonly,...de(t)});var ce;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(ce||(ce={}));const To=sn.create,Ds=wr.create,fE=ya.create;pn.create;kt.create;const pE=je.create;gi.create;yi.create;Fn.create;_r.create;bi.create;cn.create;Sr.create;const mE="https://api.opheleo.com",hE="Bearer ",gE="Authorization";pE({id:To(),userId:To(),createdAt:Ds(),updatedAt:Ds(),active:fE(),perDayUsage:Ds(),userEmail:To().email(),maxPerDayUsage:Ds()});async function yE(e,t,n){const r=typeof window<"u"?localStorage.getItem("session_token"):null;return(await Re({baseURL:br(n??mE),url:e,method:t,headers:r?{[gE]:`${hE}${r}`}:void 0})).data}async function bE(e){return yE("/iccandle/v1/iccandle-user-usage/me","get",e)}const vE=e=>{const t=e==null?void 0:e.platformApiBase;return UC({queryKey:["iccandle-user-usage",t],queryFn:()=>bE(t),...e})},wE=C.createContext(null);function _E(){const e=C.useContext(wE);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function xE({controlsRef:e,onSymbolTickerChange:t,onScanResultUrlChange:n,onChartWidgetChange:r,onChartContainerChange:s,selectSymbolTickerRef:i,headerSlot:o}){const{resolvedTheme:a}=_E(),l=ct(),d=fs(),f=C.useRef([]),u=C.useRef(null),y=C.useRef(a),m=C.useRef(null),g=C.useRef(null),p=C.useMemo(()=>pi(d),[d]),h=C.useRef(p),b=C.useRef("60"),{setGapCount:v,setReplayMode:_}=Nm();C.useEffect(()=>{v(0),_(!1)},[v,_]),C.useEffect(()=>{qs()&&P(!0)},[]);const[x,S]=C.useState(null),[T,P]=C.useState(!1),[O,R]=C.useState(null),M=C.useCallback(D=>{if(D===h.current)return;const $=d.find(I=>I.ticker===D);if(!$)return;h.current=D,localStorage.setItem(Qn,D),t(D);const W=u.current;if(W)try{W.onChartReady(()=>{W.activeChart().setSymbol($.ticker)})}catch{}},[t,d]);C.useEffect(()=>(i.current=M,()=>{i.current=null}),[M,i]);const N=C.useRef([]),j=C.useMemo(()=>new IC(N,"selector",d,l.tickWebSocketUrl),[l.tickWebSocketUrl,d]),{data:H,isLoading:k}=vE({enabled:!0,platformApiBase:l.platformApiBase}),B=!k&&H?H.perDayUsage>=H.maxPerDayUsage:!1;C.useEffect(()=>{s(x)},[x,s]),C.useEffect(()=>{r(O)},[O,r]),C.useEffect(()=>{if(!T||!x)return;if(u.current){R(null),r(null);try{u.current.remove()}catch{}u.current=null}const D=pi(d);h.current=D,b.current="60";const $=Om();if(!$)return;const W=new $({container:x,library_path:"/charting_library/",datafeed:j,symbol:D,interval:"60",autosize:!0,theme:y.current,disabled_features:["symbol_info","legend_inplace_edit","header_quick_search","header_compare"],enabled_features:["header_chart_type","show_symbol_logos","show_symbol_logo_in_legend"],custom_indicators_getter:()=>MC(f),drawings_access:{type:"black",tools:[{name:"Date Range"}]},locale:"en",timezone:Oh(),overrides:{priceScaleSelectionStrategyName:"right","scalesProperties.showSeriesLastValue":!0}});let I=!1;return u.current=W,W.onChartReady(()=>{I||u.current!==W||R(W)}),()=>{if(I=!0,R(null),r(null),u.current){try{u.current.remove()}catch{}u.current=null}}},[x,j,r,T]),C.useEffect(()=>{if(!O)return;let D=!1;try{O.onChartReady(()=>{D||(async()=>{try{const $=O.activeChart(),W=await $.createStudy("Generated Candles - By iC Candle",!0,!0);if(D||(W&&$.bringToFront([W]),await O.headerReady(),D)||(await new Promise(J=>{setTimeout(()=>{if(!D)try{$.clearMarks(2)}catch{}J(!0)},150)}),D))return;localStorage.setItem("tv:selected-news-events","[]"),$.refreshMarks();const I=J=>{const ue=$.symbol(),me=ua(ue,d,p);me!==h.current&&(n(null),f.current=[]);try{O.resetCache()}catch{}h.current=me,localStorage.setItem(Qn,me),t(me)},re=J=>{J!==b.current&&(n(null),f.current=[]);try{O.resetCache()}catch{}b.current=J};m.current=I,g.current=re,$.onSymbolChanged().subscribe(null,I),$.onIntervalChanged().subscribe(null,re)}catch{}})()})}catch{}return()=>{D=!0,m.current=null,g.current=null}},[O,e,n,t,p,d]),C.useEffect(()=>{if(!O||!a)return;let D=!1;try{O.onChartReady(()=>{D||O.changeTheme(a).catch(()=>{})})}catch{}return()=>{D=!0}},[O,a]);const F=C.useCallback(()=>{P(!0)},[]),L=B?c.jsx("div",{className:"web-trading-widget-advanced__scan-limit-wrap",children:c.jsxs(TC,{variant:"destructive",className:"web-trading-widget-advanced__scan-limit-badge",children:[c.jsx("span",{className:"web-trading-widget-advanced__scan-limit-badge-title",children:"Daily scan limit reached"}),H&&c.jsxs("span",{className:"web-trading-widget-advanced__scan-limit-badge-count",children:[H.perDayUsage," of ",H.maxPerDayUsage," scans used today"]})]})}):null;return c.jsxs(c.Fragment,{children:[o??L,c.jsx(PC,{onLoad:F}),c.jsx("div",{ref:S,className:"web-trading-widget-advanced__container"})]})}const jm=C.createContext(null);function Kd({value:e,children:t}){return c.jsx(jm.Provider,{value:e,children:t})}function SE(){const e=C.useContext(jm);if(!e)throw new Error("useWidgetChartSlot must be used within WidgetChartSlotProvider");return e}function js(e,t){return e.toFixed(t)}function CE({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,isDragging:d,isCollapsed:f,onToggleCollapsed:u,onDragHandlePointerDown:y,onPlaceOrder:m}){const[g,p]=C.useState(!0),h=f??g,b=()=>{u==null||u(),f===void 0&&p(F=>!F)},v=se(F=>F.setOrderSide),_=se(F=>F.setVolumeLots),x=se(F=>F.volumeLots),[S,T]=C.useState(String(x||r));C.useEffect(()=>{h||T(js(x,2))},[h,x]);const P=Number(Vt(Ht(e))),O=t!==null?Pe(t,P):"—",R=n!==null?Pe(n,P):"—",N=!o&&!a&&l!==""&&(t!==null&&n!==null),j=F=>{const L=Number(S),D=Number.isFinite(L)&&L>0?L:r,$=Math.max(i,D+F*s),W=js($,2);T(W),_($)},H=()=>{const F=Number(S);if(!Number.isFinite(F)||F<=0){T(js(r,2)),_(r);return}const L=Math.max(i,F),D=js(L,2);T(D),_(L)},k=F=>{t===null||n===null||v({side:F,entryPrice:F==="buy"?n:t})},B=F=>{if(t===null||n===null||!l)return;const L=Number(S),D=Math.max(i,Number.isFinite(L)&&L>0?L:r);v({side:F,entryPrice:F==="buy"?n:t}),m({login:l,side:F,volumeLots:D,bid:t,ask:n})};return c.jsx("div",{className:"web-trading-widget-mini-order web-trading-widget-mini-order--expanded",children:c.jsxs("div",{className:"web-trading-widget-mini-order__row",children:[c.jsx("button",{type:"button","aria-label":"Move quick order panel",onPointerDown:y,className:`web-trading-widget-mini-order__drag-handle${d?" web-trading-widget-mini-order__drag-handle--grabbing":""}`,children:c.jsx(Hf,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2})}),c.jsxs(c.Fragment,{children:[c.jsxs("button",{type:"button",disabled:!N,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--sell",onMouseDown:()=>k("sell"),onClick:()=>B("sell"),children:[c.jsx("span",{className:"web-trading-widget-mini-order__price",children:O}),c.jsx("span",{className:"web-trading-widget-mini-order__label web-trading-widget-mini-order__label--sell",children:"SELL"})]}),c.jsxs("div",{className:"web-trading-widget-mini-order__volume",children:[c.jsx("button",{type:"button","aria-label":"Decrease volume",disabled:!N,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>j(-1),children:c.jsx(ri,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})}),c.jsx("input",{type:"text",inputMode:"decimal",value:S,disabled:!N,onChange:F=>T(F.target.value),onBlur:H,className:"web-trading-widget-mini-order__volume-input"}),c.jsx("button",{type:"button","aria-label":"Increase volume",disabled:!N,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>j(1),children:c.jsx(Uo,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})})]}),c.jsxs("button",{type:"button",disabled:!N,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--buy",onMouseDown:()=>k("buy"),onClick:()=>B("buy"),children:[c.jsx("span",{className:"web-trading-widget-mini-order__label web-trading-widget-mini-order__label--buy",children:"BUY"}),c.jsx("span",{className:"web-trading-widget-mini-order__price",children:R})]})]}),c.jsx("button",{type:"button","aria-label":h?"Expand quick order panel":"Collapse quick order panel","aria-expanded":!h,className:"web-trading-widget-mini-order__toggle",onClick:b,children:h?c.jsx(ri,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5}):c.jsx(Uo,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5})})]})})}function Ir({title:e,isOpen:t,onToggle:n,children:r}){return c.jsxs("div",{className:"web-trading-widget-market-panel__accordion-item",children:[c.jsxs("button",{type:"button",className:`web-trading-widget-market-panel__accordion-trigger${t?" web-trading-widget-market-panel__accordion-trigger--open":""}`,"aria-expanded":t,onClick:n,children:[e,c.jsx(ri,{className:"web-trading-widget-icon web-trading-widget-icon--md web-trading-widget-text-muted"})]}),t?c.jsx("div",{className:"web-trading-widget-market-panel__accordion-content",children:r}):null]})}const EE=new Set(["volume-setting","risk-management"]);function TE({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,isDragging:d,onDragHandlePointerDown:f,onLayoutChange:u,onClose:y,onPlaceOrder:m}){const[g,p]=C.useState(!0),[h,b]=C.useState("market"),v=se(ee=>ee.volumeLots),[_,x]=C.useState(String(v||r)),[S,T]=C.useState(""),[P,O]=C.useState(""),R=se(ee=>ee.stopLoss),M=se(ee=>ee.takeProfit),N=se(ee=>ee.setStopLoss),j=se(ee=>ee.setTakeProfit),H=se(ee=>ee.setVolumeLots),k=se(ee=>ee.setOrderSide),[B,F]=C.useState(""),[L,D]=C.useState(mt.GTC),[$,W]=C.useState(""),[I,re]=C.useState(""),[J,ue]=C.useState(()=>new Set(EE));C.useEffect(()=>{u()},[g,u]);const me=Number(Vt(Ht(e))),z=Pr(me),q=Gf(t,n),ie=t!==null?Pe(t,me):"—",he=n!==null?Pe(n,me):"—",le=ji(h),oe=Wf(h),U=Di(h),we=U.label,Ae=!le&&U.orderType!==null&&U.orderType%2===1,Ee=C.useMemo(()=>q!==null?q:t??n,[n,t,q]),X=ee=>{ue(Xe=>{const zt=new Set(Xe);return zt.has(ee)?zt.delete(ee):zt.add(ee),zt})},ke=ee=>{x(ee);const Xe=Number(ee);Number.isFinite(Xe)&&Xe>0&&H(Xe)},Ue=ee=>t===null||n===null?null:le?ee==="buy"?n:t:ht(S)??(ee==="buy"?n:t),Qe=ee=>{const Xe=Ue(ee);Xe!==null&&k({side:ee,entryPrice:Xe})},dt=ee=>{if(t===null||n===null||!l)return;const Xe=Math.max(i,Number(_)||i),zt=Bo(h,ee),kr=Ue(ee);kr!==null&&k({side:ee,entryPrice:kr}),m({login:l,executionMode:h,side:ee,orderType:zt,volumeLots:Xe,stopLoss:R,takeProfit:M,priceOrder:S,priceTrigger:P,comment:B,typeTime:L,expirationDateTime:$,expirationDay:I,bid:t,ask:n})},ne=t!==null&&n!==null,$e=le||ht(S)!==void 0,Qi=!oe||ht(P)!==void 0,ms=le||Mi(L,$,I),uh=!o&&!a&&l!==""&&ne&&$e&&Qi&&ms,fh=!le&&ac(L),ph=!le&&cc(L),Fc=()=>U.orderType!==null&&U.orderType%2===1?"sell":"buy";return c.jsxs("div",{className:`web-trading-widget-market-panel web-trading-widget-market-panel--modal${g?" web-trading-widget-market-panel--collapsed":""}`,children:[c.jsx(CE,{symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,isDragging:d,isCollapsed:g,onToggleCollapsed:()=>p(ee=>!ee),onDragHandlePointerDown:f,onPlaceOrder:({login:ee,side:Xe,volumeLots:zt,bid:kr,ask:Uc})=>{kr===null||Uc===null||m({login:ee,executionMode:"market",side:Xe,orderType:Bo("market",Xe),volumeLots:zt,stopLoss:R,takeProfit:M,priceOrder:"",priceTrigger:"",comment:B,typeTime:L,expirationDateTime:"",expirationDay:"",bid:kr,ask:Uc})}}),g?null:c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"web-trading-widget-market-panel__header",children:c.jsxs(ti,{value:h,onValueChange:ee=>b(ee),children:[c.jsx(Vr,{className:"web-trading-widget-market-panel__select-trigger","aria-label":"Order execution type",children:c.jsx(ni,{})}),c.jsx(Hr,{children:si.map(ee=>c.jsx(zr,{value:ee.mode,children:ee.label},ee.mode))})]})}),c.jsxs("div",{className:"web-trading-widget-market-panel__accordion",children:[c.jsx(Ir,{id:"volume-setting",title:"Volume Setting",isOpen:J.has("volume-setting"),onToggle:()=>X("volume-setting"),children:c.jsx(De,{label:"Lots",value:_,onChange:ke,step:s,min:i,decimals:2})}),le?null:c.jsx(Ir,{id:"order-price",title:"Order Price",isOpen:J.has("order-price"),onToggle:()=>X("order-price"),children:oe?c.jsxs(c.Fragment,{children:[c.jsx(De,{label:"Stop Price",value:P,onChange:O,step:z,decimals:me,basePrice:Ee,placeholder:q!==null?Pe(q,me):"—"}),c.jsx(De,{label:"Limit Price",value:S,onChange:T,step:z,decimals:me,basePrice:Ee,placeholder:q!==null?Pe(q,me):"—"})]}):c.jsx(De,{label:"Price",value:S,onChange:T,step:z,decimals:me,basePrice:Ee,placeholder:q!==null?Pe(q,me):"—"})}),c.jsx(Ir,{id:"risk-management",title:"Risk Management",isOpen:J.has("risk-management"),onToggle:()=>X("risk-management"),children:c.jsxs("div",{className:"web-trading-widget-market-panel__grid-2",children:[c.jsx(De,{label:"Stop Loss",value:R,onChange:N,step:z,decimals:me,basePrice:t,placeholder:t!==null?ie:"—",clearable:!0}),c.jsx(De,{label:"Take Profit",value:M,onChange:j,step:z,decimals:me,basePrice:n,placeholder:n!==null?he:"—",clearable:!0})]})}),le?null:c.jsxs(Ir,{id:"expiration",title:"Expiration",isOpen:J.has("expiration"),onToggle:()=>X("expiration"),children:[c.jsx("select",{value:String(L),className:"web-trading-widget-market-panel__select-full","aria-label":"Order expiration type",onChange:ee=>D(Number(ee.target.value)),children:Kf.map(ee=>c.jsx("option",{value:String(ee.value),children:ee.label},ee.value))}),fh?c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Expiration time"}),c.jsx("input",{type:"datetime-local",value:$,className:"web-trading-widget-market-panel__input",onChange:ee=>W(ee.target.value)})]}):null,ph?c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Expiration day"}),c.jsx("input",{type:"date",value:I,className:"web-trading-widget-market-panel__input",onChange:ee=>re(ee.target.value)})]}):null]}),c.jsx(Ir,{id:"comment",title:"Comment",isOpen:J.has("comment"),onToggle:()=>X("comment"),children:c.jsx("input",{type:"text",value:B,className:"web-trading-widget-market-panel__input",placeholder:"",onChange:ee=>F(ee.target.value)})})]}),c.jsx("div",{className:"web-trading-widget-market-panel__footer",children:c.jsxs("div",{className:"web-trading-widget-market-panel__quotes",children:[c.jsx("span",{children:ie}),c.jsx("span",{className:"web-trading-widget-market-panel__quotes-ask",children:he})]})}),!le&&c.jsxs("button",{type:"button",className:`web-trading-widget-market-panel__place-btn${Ae?" web-trading-widget-market-panel__place-btn--sell":" web-trading-widget-market-panel__place-btn--buy"}`,disabled:!uh,onMouseDown:()=>Qe(Fc()),onClick:()=>dt(Fc()),children:["Place ",we]})]})]})}function PE({symbolTicker:e,chartWidget:t,orderState:n}){const r=fs(),s=bc(e),{panel:i,confirmation:o,isSubmitting:a,defaultVolumeLots:l,volumeStep:d,minVolumeLots:f,selectedLogin:u,isAccountsLoading:y,hasConfirmedAccount:m,closePanels:g,dismissConfirmation:p,placeMarketOrder:h}=n,b=ve(I=>I.positions),v=ve(I=>I.orders),_=ve(I=>I.selectedPositionTicket),x=ve(I=>I.selectedOrderTicket),S=ve(I=>I.setSelectedPositionTicket),T=ve(I=>I.setSelectedOrderTicket),P=_!==null?b.find(I=>I.ticket===_)??null:null,O=x!==null?v.find(I=>I.ticket===x)??null:null,R=m&&i==="confirmation"&&o!==null,M=m&&i!=="confirmation"&&i!=="closed"&&P===null&&O===null,{panelRef:N,position:j,isDragging:H,onDragStart:k,reclamp:B}=Jf({storageKey:"web-trading-widget-modal-exec-panel-position",defaultAlign:"top-right",isActive:M}),F=se(I=>I.setDraft),L=se(I=>I.clearDraft),D=Number(Vt(Ht(e))),$=Pr(D);C.useEffect(()=>{m&&F({source:"new-order",entryPrice:null,side:null,showEntryLine:!1,volumeLots:l,digits:D,priceStep:$})},[l,D,m,$,F]),C.useEffect(()=>{(i==="closed"||i==="confirmation")&&L()},[L,i]);const W=P!==null||O!==null;return!m&&!W?null:c.jsxs("div",{className:"web-trading-widget-new-order-overlay-layer",children:[c.jsx(Bp,{chartWidget:t,symbolTicker:e,symbols:r}),W&&P!==null?c.jsx("div",{className:"web-trading-widget-new-order-overlay web-trading-widget-new-order-overlay--news web-trading-widget-new-order-overlay--side-panel",children:c.jsx(Am,{position:P,onClose:()=>S(null)})}):null,W&&O!==null?c.jsx("div",{className:"web-trading-widget-new-order-overlay web-trading-widget-new-order-overlay--news web-trading-widget-new-order-overlay--side-panel",children:c.jsx(Pm,{order:O,onClose:()=>T(null)})}):null,R&&o!==null?c.jsx("div",{className:"web-trading-widget-new-order-overlay web-trading-widget-new-order-overlay--news",children:c.jsx(Tm,{confirmation:o,symbolTicker:e,onDismiss:p})}):null,M?c.jsx("div",{ref:N,style:{left:j.x,top:j.y},className:`web-trading-widget-new-order-overlay web-trading-widget-new-order-overlay--news web-trading-widget-new-order-overlay--draggable web-trading-widget-new-order-overlay--exec-panel${H?" web-trading-widget-new-order-overlay--dragging":""}`,children:c.jsx(TE,{symbolTicker:e,bid:(s==null?void 0:s.bid)??null,ask:(s==null?void 0:s.ask)??null,defaultVolumeLots:l,volumeStep:d,minVolumeLots:f,isSubmitting:a,isAccountsLoading:y,selectedLogin:u,isDragging:H,onDragHandlePointerDown:k,onLayoutChange:B,onClose:g,onPlaceOrder:I=>void h({symbolTicker:e,login:I.login,executionMode:I.executionMode,side:I.side,orderType:I.orderType,volumeLots:I.volumeLots,stopLoss:I.stopLoss,takeProfit:I.takeProfit,priceOrder:I.priceOrder,priceTrigger:I.priceTrigger,comment:I.comment,typeTime:I.typeTime,expirationDateTime:I.expirationDateTime,expirationDay:I.expirationDay,bid:I.bid,ask:I.ask})})}):null]})}const AE=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" aria-hidden="true">
|
|
81
|
+
`+i)}}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Mn(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&Ks.assertOptions(r,{silentJSONParsing:He.transitional(He.boolean),forcedJSONParsing:He.transitional(He.boolean),clarifyTimeoutError:He.transitional(He.boolean),legacyInterceptorReqResOrdering:He.transitional(He.boolean),advertiseZstdAcceptEncoding:He.transitional(He.boolean),validateStatusUndefinedResolves:He.transitional(He.boolean)},!1),s!=null&&(k.isFunction(s)?n.paramsSerializer={serialize:s}:Ks.assertOptions(s,{encode:He.function,serialize:He.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Ks.assertOptions(n,{baseUrl:He.spelling("baseURL"),withXsrfToken:He.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&k.merge(i.common,i[n.method]);i&&k.forEach(["delete","get","head","post","put","patch","query","common"],y=>{delete i[y]}),n.headers=We.concat(o,i);const a=[];let l=!0;this.interceptors.request.forEach(function(m){if(typeof m.runWhen=="function"&&m.runWhen(n)===!1)return;l=l&&m.synchronous;const h=n.transitional||yc;h&&h.legacyInterceptorReqResOrdering?a.unshift(m.fulfilled,m.rejected):a.push(m.fulfilled,m.rejected)});const d=[];this.interceptors.response.forEach(function(m){d.push(m.fulfilled,m.rejected)});let f,u=0,g;if(!l){const y=[Xl.bind(this),void 0];for(y.unshift(...a),y.push(...d),g=y.length,f=Promise.resolve(n);u<g;)f=f.then(y[u++],y[u++]);return f}g=a.length;let p=n;for(;u<g;){const y=a[u++],m=a[u++];try{p=y(p)}catch(h){m.call(this,h);break}}try{f=Xl.call(this,p)}catch(y){return Promise.reject(y)}for(u=0,g=d.length;u<g;)f=f.then(d[u++],d[u++]);return f}getUri(t){t=Mn(this.defaults,t);const n=Pm(t.baseURL,t.url,t.allowAbsoluteUrls,t);return xm(n,t.params,t.paramsSerializer)}};k.forEach(["delete","get","head","options"],function(t){Nn.prototype[t]=function(n,r){return this.request(Mn(r||{},{method:t,url:n,data:r&&k.hasOwnProp(r,"data")?r.data:void 0}))}});k.forEach(["post","put","patch","query"],function(t){function n(r){return function(i,o,a){return this.request(Mn(a||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}Nn.prototype[t]=n(),t!=="query"&&(Nn.prototype[t+"Form"]=n(!0))});let Rx=class Nm{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(s=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(a=>{r.subscribe(a),i=a}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},t(function(i,o,a){r.reason||(r.reason=new fs(i,o,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new Nm(function(s){t=s}),cancel:t}}};function Lx(e){return function(n){return e.apply(null,n)}}function Dx(e){return k.isObject(e)&&e.isAxiosError===!0}const Ko={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Ko).forEach(([e,t])=>{Ko[t]=e});function Rm(e){const t=new Nn(e),n=cm(Nn.prototype.request,t);return k.extend(n,Nn.prototype,t,{allOwnKeys:!0}),k.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return Rm(Mn(e,s))},n}const Re=Rm(us);Re.Axios=Nn;Re.CanceledError=fs;Re.CancelToken=Rx;Re.isCancel=Tm;Re.VERSION=vc;Re.toFormData=Hi;Re.AxiosError=Z;Re.Cancel=Re.CanceledError;Re.all=function(t){return Promise.all(t)};Re.spread=Lx;Re.isAxiosError=Dx;Re.mergeConfig=Mn;Re.AxiosHeaders=We;Re.formToJSON=e=>Cm(k.isHTMLForm(e)?new FormData(e):e);Re.getAdapter=Om.getAdapter;Re.HttpStatusCode=Ko;Re.default=Re;const{Axios:FE,AxiosError:UE,CanceledError:BE,isCancel:$E,CancelToken:VE,VERSION:HE,all:zE,Cancel:WE,isAxiosError:Lm,spread:KE,toFormData:qE,AxiosHeaders:GE,HttpStatusCode:ZE,formToJSON:YE,getAdapter:QE,mergeConfig:XE,create:JE}=Re,jx="Bearer ",Dm="web-trading-token";function Ix(){return typeof window>"u"?null:localStorage.getItem(Dm)}function br(e){return e.replace(/\/$/,"")}function ed(e){const t=br(e);async function n(r){const s=Ix();return(await Re({...r,baseURL:t,headers:{...r.headers??{},...s?{Authorization:`${jx}${s}`}:{}}})).data}return{get(r,s){return n({...s,url:r,method:"get"})},post(r,s,i){return n({...i,url:r,method:"post",data:s})}}}function td(e){return!e.isDemo&&!e.isArchive&&!!e.tradeStat}function Mx(e){const t=e.filter(n=>td(n)&&n.platformType==="mt5");return t.length>0?t:e.filter(td)}function Fx(e){const t=e,n=(t==null?void 0:t.accounts)??[];return Mx(n).map(r=>{var s,i,o,a,l;return{id:r.id,login:String(r.login),label:`${r.displayTitle} · ${r.login}`,currency:r.currency,tradeStat:{balance:((s=r.tradeStat)==null?void 0:s.balance)??0,equity:((i=r.tradeStat)==null?void 0:i.equity)??0,margin:((o=r.tradeStat)==null?void 0:o.margin)??0,marginFree:((a=r.tradeStat)==null?void 0:a.marginFree)??0,marginLevel:(l=r.tradeStat)==null?void 0:l.marginLevel}}})}function Ux(e){try{const t=new URL(br(e));return t.hostname.includes("webtrade.")?(t.hostname=t.hostname.replace("webtrade.","api."),t.origin):(t.hostname.startsWith("webtrade")&&(t.hostname=t.hostname.replace(/^webtrade/,"api")),t.origin)}catch{return br(e)}}function Bx(e){try{const t=new URL(br(e));return t.hostname.includes("opheleo")?"wss://symbols.opheleo.com":(t.protocol=t.protocol==="https:"?"wss:":"ws:",t.origin)}catch{return"wss://symbols.opheleo.com"}}function $x(e){const t=br(e),n=ed(t),r=Ux(t),s=ed(r),i=Ow(n),o=Bt;return{baseUrl:t,platformApiBase:r,tickWebSocketUrl:Bx(t),dealer:i,trading:Iw(i,o),async getAccounts(){const a=await s.get("/account-config/api/v1");return Fx(a)}}}const jm=C.createContext(null);function Im({baseUrl:e,children:t}){const n=C.useMemo(()=>$x(e),[e]);return c.jsx(jm.Provider,{value:n,children:t})}function dt(){const e=C.useContext(jm);if(!e)throw new Error("useWidgetApiClient must be used within WidgetApiProvider");return e}function Mm(){return dt().tickWebSocketUrl}const Vx="wss://symbols.opheleo.com";function _c(e){const[t,n]=C.useState(null),r=Mm();return C.useEffect(()=>{n(null);const s=Ui(e).toUpperCase();let i=null,o=!1;const a=r||Vx,l=()=>{i=new WebSocket(a),i.onopen=()=>{if(o){i==null||i.close(1e3,"Unmounted");return}i==null||i.send(JSON.stringify({action:"select_symbol",symbol:s}))},i.onmessage=d=>{var f;try{const u=JSON.parse(d.data);if(((f=u.symbol)==null?void 0:f.trim().toUpperCase())!==s)return;const p=Number(u.bid),y=Number(u.ask);if(!Number.isFinite(p)||!Number.isFinite(y))return;n({bid:p,ask:y})}catch{}},i.onclose=()=>{o||setTimeout(l,3e3)}};return l(),()=>{o=!0,i==null||i.close(1e3,"Unmounted")}},[e,r]),t}function Hx({symbolTicker:e,sidePanelTab:t,orderState:n,backUrl:r,createAccountUrl:s}){const i=_c(e),{panelRef:o,position:a,isDragging:l,onDragStart:d,reclamp:f}=sm(),{panel:u,isSubmitting:g,defaultVolumeLots:p,volumeStep:y,minVolumeLots:m,accountOptions:h,selectedLogin:b,isAccountsLoading:v,hasConfirmedAccount:_,needsAccountSelection:x,confirmAccountSelection:S,placeMarketOrder:T}=n,P=ie(L=>L.setDraft),A=ie(L=>L.clearDraft),D=Number(Vt(Ht(e))),I=Pr(D);C.useEffect(()=>{_&&P({source:"new-order",entryPrice:null,side:null,showEntryLine:!1,volumeLots:p,digits:D,priceStep:I})},[p,D,_,I,P]),C.useEffect(()=>{(u==="closed"||u==="confirmation")&&A()},[A,u]);const N=L=>{T({symbolTicker:e,login:L.login,executionMode:"market",side:L.side,orderType:L.side==="buy"?Ye.BUY:Ye.SELL,volumeLots:L.volumeLots,stopLoss:"",takeProfit:"",priceOrder:"",priceTrigger:"",comment:"",typeTime:gt.GTC,expirationDateTime:"",expirationDay:"",bid:L.bid,ask:L.ask})};return c.jsxs(c.Fragment,{children:[c.jsx(qf,{open:x,isAccountsLoading:v,accountOptions:h,onConfirm:S,backUrl:r,createAccountUrl:s}),_&&c.jsx("div",{ref:o,style:{left:a.x,top:a.y},className:`web-trading-widget-new-order-overlay${l?" web-trading-widget-new-order-overlay--dragging":""}`,children:c.jsx(hw,{symbolTicker:e,bid:(i==null?void 0:i.bid)??null,ask:(i==null?void 0:i.ask)??null,defaultVolumeLots:p,volumeStep:y,minVolumeLots:m,isSubmitting:g,isAccountsLoading:v,selectedLogin:b,isDragging:l,sidePanelTab:t,onDragHandlePointerDown:d,onExpandedChange:f,onExpand:f,onPlaceOrder:N})})]})}function zx(e,t){const n=Number(e),r=Number(t);return Number.isFinite(n)&&Number.isFinite(r)&&n!==r?n-r:e.localeCompare(t,void 0,{numeric:!0})}function Wx(e,t){return e.openTimeMs!==t.openTimeMs?e.openTimeMs-t.openTimeMs:zx(e.ticket,t.ticket)}function nd(e){return[...e].sort(Wx)}function rd(e){return Ke(e).toUpperCase()}const pe=$i(e=>({positions:[],orders:[],liveQuotes:{},selectedLogin:"",selectedPositionTicket:null,selectedOrderTicket:null,setSelectedLogin:t=>{e({selectedLogin:t})},setSelectedPositionTicket:t=>{e(n=>({selectedPositionTicket:t,selectedOrderTicket:t!==null?null:n.selectedOrderTicket}))},setSelectedOrderTicket:t=>{e(n=>({selectedOrderTicket:t,selectedPositionTicket:t!==null?null:n.selectedPositionTicket}))},setPositions:t=>{e({positions:nd(t)})},setOrders:t=>{e({orders:nd(t)})},removePosition:t=>{e(n=>({positions:n.positions.filter(r=>r.ticket!==t),selectedPositionTicket:n.selectedPositionTicket===t?null:n.selectedPositionTicket}))},removeOrder:t=>{e(n=>({orders:n.orders.filter(r=>r.ticket!==t),selectedOrderTicket:n.selectedOrderTicket===t?null:n.selectedOrderTicket}))},updateQuotes:(t,n,r)=>{const s=rd(t);e(i=>{const o={...i.liveQuotes,[s]:{bid:n,ask:r}};return{liveQuotes:o,positions:i.positions.map(a=>Yv(a,s,n,r,o)),orders:i.orders.map(a=>{if(rd(a.symbol)!==s)return a;const l=a.side==="buy"?n:r;return{...a,currentPrice:l,marketBid:n,marketAsk:r}})}})},clearPositions:()=>{e({positions:[],orders:[],liveQuotes:{}})}})),Kx="wss://symbols.opheleo.com";function qx(e,t){const n=new Set;for(const r of e){const s=Ke(r.symbol).toUpperCase();s&&n.add(s)}for(const r of t){const s=Ke(r.symbol).toUpperCase();s&&n.add(s)}for(const r of Gv([...n]))n.add(r);return[...n].sort().join("|")}function Gx(e){return qx(e.positions,e.orders)}function Zx(){const e=pe(Gx),t=pe(r=>r.updateQuotes),n=Mm();C.useEffect(()=>{if(!e)return;const r=e.split("|"),s=new Map;let i=!1;const o=n||Kx,a=l=>{const d=new WebSocket(o);s.set(l,d),d.onopen=()=>{if(i){d.close(1e3,"Unmounted");return}d.send(JSON.stringify({action:"select_symbol",symbol:l}))},d.onmessage=f=>{var u;try{const g=JSON.parse(f.data),p=(u=g.symbol)==null?void 0:u.trim().toUpperCase();if(!p||p!==l)return;const y=Number(g.bid),m=Number(g.ask);if(!Number.isFinite(y)||!Number.isFinite(m))return;t(p,y,m)}catch{}},d.onclose=()=>{s.delete(l),i||setTimeout(()=>a(l),3e3)}};for(const l of r)a(l);return()=>{i=!0;for(const l of s.values())l.close(1e3,"Unmounted");s.clear()}},[e,n,t])}function Fm(){return Zx(),null}const Um={buy:"#2563eb",sell:"#dc2626"},wo={positive:"#2563eb",negative:"#dc2626",neutral:"#94a3b8"},_o={linewidth:1,linestyle:2,fontsize:11},Bm={stopLoss:"#f97316",takeProfit:"#22c55e"},$m=e=>Um[e],qo=(e,t)=>e==="entry"?t!=null?$m(t):Um.sell:Bm[e],sd=(e,t)=>{if(e==="entry")return qo(e,t.side);const{side:n,entryPrice:r,linePrice:s,volumeLots:i}=t;if(n!=null&&r!==null&&r!==void 0&&s!==void 0&&i!==void 0){const o=Vm(n,r,s,i);return Hm(o)}return Bm[e]},Vm=(e,t,n,r)=>(e==="buy"?n-t:t-n)*r*100,Yx=(e,t)=>!Number.isFinite(t)||t<=0?0:Math.round(e/t),Qx=e=>{const t=Vm(e.side,e.entryPrice,e.linePrice,e.volumeLots),n=e.side==="buy"?e.linePrice-e.entryPrice:e.entryPrice-e.linePrice,r=Yx(n,e.priceStep),s=e.kind==="takeProfit"?"TP":"SL",i=`${t.toFixed(2)} USD`,o=`${r} points`;return`${s} ${i}, ${o}`},Xx=(e,t)=>e.toFixed(t),Hm=e=>e>0?wo.positive:e<0?wo.negative:wo.neutral,Jx=e=>{const t=`${e.side.toUpperCase()} ${e.volumeLots.toFixed(2)}, `,n=`${e.profit.toFixed(2)} USD`;return`${t}${n}`},id=e=>{const t=$m(e.side),n=Hm(e.profit);return{text:Jx(e),linecolor:t,textcolor:n,linewidth:_o.linewidth,linestyle:_o.linestyle,fontsize:_o.fontsize,showPrice:!0,horzLabelsAlign:"left"}},xo=e=>Ue(e),eS=e=>e==="entry"||e==="stopLoss"||e==="takeProfit",So=e=>{e.setUserEditEnabled(!1),e.setSelectionEnabled(!1)},od=(e,t,n)=>{if(e==="entry")return Xx(t,n.digits);const{entryPrice:r,side:s}=n;return s!==null&&r!==null?Qx({kind:e,side:s,entryPrice:r,linePrice:t,volumeLots:n.volumeLots,priceStep:n.priceStep}):`${e==="takeProfit"?"TP":"SL"} ${xe(t,n.digits)}`},tS=({chartWidget:e})=>{const t=ie(S=>S.source),n=ie(S=>S.entryPrice),r=ie(S=>S.stopLoss),s=ie(S=>S.takeProfit),i=ie(S=>S.side),o=ie(S=>S.showEntryLine),a=ie(S=>S.volumeLots),l=ie(S=>S.digits),d=ie(S=>S.priceStep),f=ie(S=>S.setStopLoss),u=ie(S=>S.setTakeProfit),g=C.useRef({}),p=C.useRef(null),y=C.useRef(null),m=C.useRef(!1),h=C.useRef({entryPrice:n,stopLoss:r,takeProfit:s,side:i,showEntryLine:o,volumeLots:a,digits:l,priceStep:d});C.useEffect(()=>{h.current={entryPrice:n,stopLoss:r,takeProfit:s,side:i,showEntryLine:o,volumeLots:a,digits:l,priceStep:d}},[l,n,d,o,i,r,s,a]);const b=C.useCallback(S=>{if(!e)return;const T=g.current[S];if(T){try{e.activeChart().removeEntity(T)}catch{}delete g.current[S]}},[e]),v=C.useCallback((S,T,P,A)=>{const D=qo(T,A.side),I=sd(T,{side:A.side,entryPrice:A.entryPrice,linePrice:P,volumeLots:A.volumeLots});S.setProperties({text:od(T,P,A),linecolor:D,textcolor:I,showPrice:!0,horzLabelsAlign:"left"})},[]),_=C.useCallback(async(S,T,P)=>{var H;if(!e)return;if(T===void 0){b(S);return}if(p.current===S)return;const A=e.activeChart(),D=qo(S,P.side),I=sd(S,{side:P.side,entryPrice:P.entryPrice,linePrice:T,volumeLots:P.volumeLots}),N=od(S,T,P),L=g.current[S];if(L)try{const R=A.getShapeById(L);S==="entry"&&So(R);const F=(H=R.getPoints()[0])==null?void 0:H.price;if(F!==void 0&&Math.abs(F-T)<P.priceStep/2){R.setProperties({text:N,linecolor:D,textcolor:I,showPrice:!0,horzLabelsAlign:"left"});return}const M=R.getPoints();if(M.length>0){m.current=!0,R.setPoints(M.map($=>({...$,price:T}))),m.current=!1,R.setProperties({text:N,linecolor:D,textcolor:I,showPrice:!0,horzLabelsAlign:"left"});return}}catch{delete g.current[S]}try{const R=A.getVisibleRange(),F=await A.createShape({time:R.from,price:T},{shape:"horizontal_line",text:N,disableSave:!0,lock:S==="entry",disableSelection:S==="entry",overrides:{linecolor:D,textcolor:I,linewidth:2,showPrice:!0,horzLabelsAlign:"left"}});if(S==="entry"&&!h.current.showEntryLine){try{A.removeEntity(F)}catch{}return}if(S==="entry")try{So(A.getShapeById(F))}catch{}g.current[S]=F}catch{}},[e,b]),x=C.useCallback(async S=>{const T=xo(S.stopLoss),P=xo(S.takeProfit);S.showEntryLine&&S.entryPrice!==null?await _("entry",S.entryPrice,S):await _("entry",void 0,S),await _("stopLoss",T,S),await _("takeProfit",P,S)},[_]);C.useEffect(()=>{if(!e||t===null)return;const S=(T,P)=>{var N,L,H;const A=(N=Object.entries(g.current).find(([,R])=>R===T))==null?void 0:N[0];if(!A||!eS(A))return;const I=e.activeChart().getAllShapes().filter(R=>R.name==="horizontal_line").some(R=>R.id===T);if(A==="entry"){if((P==="move"||P==="points_changed")&&I){const R=h.current;if(R.entryPrice!==null)try{const F=e.activeChart().getShapeById(T),M=(L=F.getPoints()[0])==null?void 0:L.price;if(M!==void 0&&Math.abs(M-R.entryPrice)>=R.priceStep/2){const $=F.getPoints();$.length>0&&F.setPoints($.map(O=>({...O,price:R.entryPrice})))}So(F)}catch{}}return}if(P==="remove"&&I){p.current=null,A==="stopLoss"&&f(""),A==="takeProfit"&&u(""),delete g.current[A];return}if(!(P!=="move"&&P!=="points_changed"&&!I)&&!m.current)try{const R=e.activeChart().getShapeById(T),F=(H=R.getPoints()[0])==null?void 0:H.price;if(!Number.isFinite(F)||F<=0)return;const M=h.current,$=A==="stopLoss"?M.stopLoss:M.takeProfit,O=xo($),U=O!==void 0&&Math.abs(O-F)<M.priceStep/2;if(P==="points_changed"&&I){p.current=A,v(R,A,F,M),y.current!==null&&clearTimeout(y.current),y.current=setTimeout(()=>{p.current=null;const ee=xe(F,h.current.digits);A==="stopLoss"?f(ee):u(ee)},120);return}if(y.current!==null&&(clearTimeout(y.current),y.current=null),p.current=null,U){v(R,A,F,M);return}const W=xe(F,M.digits),j=A==="stopLoss"?{...M,stopLoss:W}:{...M,takeProfit:W};A==="stopLoss"?f(W):u(W),v(R,A,F,j)}catch{p.current=null}};try{e.subscribe("drawing_event",S)}catch{}return()=>{p.current=null,y.current!==null&&(clearTimeout(y.current),y.current=null);try{e.unsubscribe("drawing_event",S)}catch{}Object.keys(g.current).forEach(T=>{b(T)}),g.current={}}},[e,b,f,u,t,v]),C.useEffect(()=>{if(!e||t===null)return;let S=!1;try{e.onChartReady(()=>{S||x(h.current)})}catch{}return()=>{S=!0}},[e,t,n,r,s,i,o,a,l,d,x])},ad=e=>{e.setUserEditEnabled(!1),e.setSelectionEnabled(!1)},zm=(e,t)=>Ke(e.symbol).toUpperCase()===t,nS=e=>pe.getState().positions.filter(t=>zm(t,e)).map(t=>({ticket:t.ticket,openPrice:t.openPrice,type:t.type,digits:t.digits,volumeLots:t.volumeLots,profit:t.profit})),cd=(e,t,n)=>{try{const r=e.activeChart().symbol(),s=n.find(i=>i.display_name===r||i.ticker===r);if(s)return Jf(s.ticker,n)}catch{}return t},rS=(e,t,n)=>{var i;const r=(i=e.getPoints()[0])==null?void 0:i.price;if(r!==void 0&&Math.abs(r-t)<Number.EPSILON){e.setProperties(n);return}const s=e.getPoints();s.length>0&&e.setPoints(s.map(o=>({...o,price:t}))),e.setProperties(n)},sS=({chartWidget:e,symbolTicker:t,symbols:n})=>{const r=pe(y=>y.positions),s=C.useRef(new Map),i=C.useRef(0),o=C.useMemo(()=>Jf(t,n),[t,n]),a=C.useMemo(()=>r.filter(y=>zm(y,o)).map(y=>`${y.ticket}:${y.openPrice}:${y.type}:${y.digits}:${y.volumeLots}:${y.profit.toFixed(2)}`).sort().join("|"),[o,r]),l=C.useCallback(y=>{if(!e)return;const m=s.current.get(y);if(m){try{e.activeChart().removeEntity(m)}catch{}s.current.delete(y)}},[e]),d=C.useCallback(()=>{for(const y of[...s.current.keys()])l(y);s.current.clear()},[l]),f=C.useCallback(async(y,m,h)=>{const b=id({side:m.type,volumeLots:m.volumeLots,profit:m.profit}),_={time:y.getVisibleRange().from,price:m.openPrice},x=await y.createShape(_,{shape:"horizontal_line",text:String(b.text),disableSave:!0,lock:!0,disableSelection:!0,overrides:b});if(h!==i.current){try{y.removeEntity(x)}catch{}return null}try{ad(y.getShapeById(x))}catch{}return x},[]),u=C.useCallback(async(y,m)=>{if(!e||m!==i.current)return;const h=e.activeChart(),b=id({side:y.type,volumeLots:y.volumeLots,profit:y.profit}),v=s.current.get(y.ticket);if(v)try{rS(h.getShapeById(v),y.openPrice,b),ad(h.getShapeById(v));return}catch{s.current.delete(y.ticket)}if(m===i.current)try{const _=await f(h,y,m);if(!_)return;s.current.set(y.ticket,_)}catch{}},[e,f]),g=C.useCallback(async(y,m)=>{if(!e||y!==i.current)return;const h=nS(m),b=new Set(h.map(v=>v.ticket));for(const v of s.current.keys())b.has(v)||l(v);for(const v of h){if(y!==i.current)return;await u(v,y)}},[e,l,u]),p=C.useCallback(y=>{if(!e)return;const m=i.current+1;i.current=m,y!=null&&y.resetLineIds&&d();const h=(y==null?void 0:y.symbolKey)??cd(e,o,n);g(m,h)},[o,e,d,n,g]);C.useEffect(()=>{if(!e)return;let y=!1,m=null;const h=()=>{y||p({resetLineIds:!0,symbolKey:cd(e,o,n)})};let b=!1;const v=()=>{b=!0,h()},_=()=>{y||!b||(b=!1,p({symbolKey:o}))};try{e.onChartReady(()=>{if(!y)try{m=e.activeChart(),p({resetLineIds:!0,symbolKey:o}),m.onSymbolChanged().subscribe(null,v),m.onDataLoaded().subscribe(null,_)}catch{}})}catch{}return()=>{if(y=!0,i.current+=1,m)try{m.onSymbolChanged().unsubscribe(null,v),m.onDataLoaded().unsubscribe(null,_)}catch{}d()}},[o,e,d,p,n]),C.useEffect(()=>{if(!e)return;let y=!1;try{e.onChartReady(()=>{y||p({symbolKey:o})})}catch{}return()=>{y=!0}},[o,e,a,p])},Wm=({chartWidget:e,symbolTicker:t,symbols:n})=>(sS({chartWidget:e,symbolTicker:t,symbols:n}),tS({chartWidget:e}),null);var ms=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},_n,Qt,er,nu,iS=(nu=class extends ms{constructor(){super();ne(this,_n);ne(this,Qt);ne(this,er);q(this,er,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){E(this,Qt)||this.setEventListener(E(this,er))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,Qt))==null||t.call(this),q(this,Qt,void 0))}setEventListener(t){var n;q(this,er,t),(n=E(this,Qt))==null||n.call(this),q(this,Qt,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){E(this,_n)!==t&&(q(this,_n,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof E(this,_n)=="boolean"?E(this,_n):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},_n=new WeakMap,Qt=new WeakMap,er=new WeakMap,nu),xc=new iS,oS={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Ct,xn,ru,aS=(ru=class{constructor(){ne(this,Ct,oS);ne(this,xn,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&E(this,xn)&&e!==E(this,Ct)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:E(this,Ct),provider:e}),q(this,Ct,e),process.env.NODE_ENV!=="production"&&q(this,xn,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&q(this,xn,!0),E(this,Ct).setTimeout(e,t)}clearTimeout(e){E(this,Ct).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&q(this,xn,!0),E(this,Ct).setInterval(e,t)}clearInterval(e){E(this,Ct).clearInterval(e)}},Ct=new WeakMap,xn=new WeakMap,ru),wn=new aS;function cS(e){setTimeout(e,0)}var lS=typeof window>"u"||"Deno"in globalThis;function Ze(){}function dS(e,t){return typeof e=="function"?e(t):e}function Go(e){return typeof e=="number"&&e>=0&&e!==1/0}function Km(e,t){return Math.max(e+(t||0)-Date.now(),0)}function an(e,t){return typeof e=="function"?e(t):e}function tt(e,t){return typeof e=="function"?e(t):e}function ld(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:i,queryKey:o,stale:a}=e;if(o){if(r){if(t.queryHash!==Sc(o,t.options))return!1}else if(!Qr(t.queryKey,o))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||s&&s!==t.state.fetchStatus||i&&!i(t))}function dd(e,t){const{exact:n,status:r,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Yr(t.options.mutationKey)!==Yr(i))return!1}else if(!Qr(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function Sc(e,t){return((t==null?void 0:t.queryKeyHashFn)||Yr)(e)}function Yr(e){return JSON.stringify(e,(t,n)=>Qo(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function Qr(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Qr(e[n],t[n])):!1}var uS=Object.prototype.hasOwnProperty;function Zo(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=ud(e)&&ud(t);if(!r&&!(Qo(e)&&Qo(t)))return t;const i=(r?e:Object.keys(e)).length,o=r?t:Object.keys(t),a=o.length,l=r?new Array(a):{};let d=0;for(let f=0;f<a;f++){const u=r?f:o[f],g=e[u],p=t[u];if(g===p){l[u]=g,(r?f<i:uS.call(e,u))&&d++;continue}if(g===null||p===null||typeof g!="object"||typeof p!="object"){l[u]=p;continue}const y=Zo(g,p,n+1);l[u]=y,y===g&&d++}return i===a&&d===i?e:l}function Yo(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function ud(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Qo(e){if(!fd(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!fd(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function fd(e){return Object.prototype.toString.call(e)==="[object Object]"}function fS(e){return new Promise(t=>{wn.setTimeout(t,e)})}function Xo(e,t,n){if(typeof n.structuralSharing=="function")return n.structuralSharing(e,t);if(n.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return Zo(e,t)}catch(r){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${r}`),r}return Zo(e,t)}return t}function mS(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function pS(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var fi=Symbol();function qm(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===fi&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===fi?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Gm(e,t){return typeof e=="function"?e(...t):!!e}function hS(e,t,n){let r=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??(s=t()),r||(r=!0,s.aborted?n():s.addEventListener("abort",n,{once:!0})),s)}),e}var Xr=(()=>{let e=()=>lS;return{isServer(){return e()},setIsServer(t){e=t}}})();function Jo(){let e,t;const n=new Promise((s,i)=>{e=s,t=i});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),e(s)},n.reject=s=>{r({status:"rejected",reason:s}),t(s)},n}var gS=cS;function yS(){let e=[],t=0,n=a=>{a()},r=a=>{a()},s=gS;const i=a=>{t?e.push(a):s(()=>{n(a)})},o=()=>{const a=e;e=[],a.length&&s(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;t++;try{l=a()}finally{t--,t||o()}return l},batchCalls:a=>(...l)=>{i(()=>{a(...l)})},schedule:i,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{s=a}}}var Fe=yS(),tr,Xt,nr,su,bS=(su=class extends ms{constructor(){super();ne(this,tr,!0);ne(this,Xt);ne(this,nr);q(this,nr,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){E(this,Xt)||this.setEventListener(E(this,nr))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,Xt))==null||t.call(this),q(this,Xt,void 0))}setEventListener(t){var n;q(this,nr,t),(n=E(this,Xt))==null||n.call(this),q(this,Xt,t(this.setOnline.bind(this)))}setOnline(t){E(this,tr)!==t&&(q(this,tr,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return E(this,tr)}},tr=new WeakMap,Xt=new WeakMap,nr=new WeakMap,su),mi=new bS;function vS(e){return Math.min(1e3*2**e,3e4)}function Zm(e){return(e??"online")==="online"?mi.isOnline():!0}var ea=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Ym(e){let t=!1,n=0,r;const s=Jo(),i=()=>s.status!=="pending",o=m=>{var h;if(!i()){const b=new ea(m);g(b),(h=e.onCancel)==null||h.call(e,b)}},a=()=>{t=!0},l=()=>{t=!1},d=()=>xc.isFocused()&&(e.networkMode==="always"||mi.isOnline())&&e.canRun(),f=()=>Zm(e.networkMode)&&e.canRun(),u=m=>{i()||(r==null||r(),s.resolve(m))},g=m=>{i()||(r==null||r(),s.reject(m))},p=()=>new Promise(m=>{var h;r=b=>{(i()||d())&&m(b)},(h=e.onPause)==null||h.call(e)}).then(()=>{var m;r=void 0,i()||(m=e.onContinue)==null||m.call(e)}),y=()=>{if(i())return;let m;const h=n===0?e.initialPromise:void 0;try{m=h??e.fn()}catch(b){m=Promise.reject(b)}Promise.resolve(m).then(u).catch(b=>{var T;if(i())return;const v=e.retry??(Xr.isServer()?0:3),_=e.retryDelay??vS,x=typeof _=="function"?_(n,b):_,S=v===!0||typeof v=="number"&&n<v||typeof v=="function"&&v(n,b);if(t||!S){g(b);return}n++,(T=e.onFail)==null||T.call(e,n,b),fS(x).then(()=>d()?void 0:p()).then(()=>{t?g(b):y()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(r==null||r(),s),cancelRetry:a,continueRetry:l,canStart:f,start:()=>(f()?y():p().then(y),s)}}var Sn,iu,Qm=(iu=class{constructor(){ne(this,Sn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Go(this.gcTime)&&q(this,Sn,wn.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Xr.isServer()?1/0:300*1e3))}clearGcTimeout(){E(this,Sn)!==void 0&&(wn.clearTimeout(E(this,Sn)),q(this,Sn,void 0))}},Sn=new WeakMap,iu);function wS(e){return{onFetch:(t,n)=>{var f,u,g,p,y;const r=t.options,s=(g=(u=(f=t.fetchOptions)==null?void 0:f.meta)==null?void 0:u.fetchMore)==null?void 0:g.direction,i=((p=t.state.data)==null?void 0:p.pages)||[],o=((y=t.state.data)==null?void 0:y.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const d=async()=>{let m=!1;const h=_=>{hS(_,()=>t.signal,()=>m=!0)},b=qm(t.options,t.fetchOptions),v=async(_,x,S)=>{if(m)return Promise.reject(t.signal.reason);if(x==null&&_.pages.length)return Promise.resolve(_);const P=(()=>{const N={client:t.client,queryKey:t.queryKey,pageParam:x,direction:S?"backward":"forward",meta:t.options.meta};return h(N),N})(),A=await b(P),{maxPages:D}=t.options,I=S?pS:mS;return{pages:I(_.pages,A,D),pageParams:I(_.pageParams,x,D)}};if(s&&i.length){const _=s==="backward",x=_?_S:md,S={pages:i,pageParams:o},T=x(r,S);a=await v(S,T,_)}else{const _=e??i.length;do{const x=l===0?o[0]??r.initialPageParam:md(r,a);if(l>0&&x==null)break;a=await v(a,x),l++}while(l<_)}return a};t.options.persister?t.fetchFn=()=>{var m,h;return(h=(m=t.options).persister)==null?void 0:h.call(m,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=d}}}function md(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function _S(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var rr,Cn,sr,at,Tn,Me,ts,En,et,Xm,Lt,ou,xS=(ou=class extends Qm{constructor(t){super();ne(this,et);ne(this,rr);ne(this,Cn);ne(this,sr);ne(this,at);ne(this,Tn);ne(this,Me);ne(this,ts);ne(this,En);q(this,En,!1),q(this,ts,t.defaultOptions),this.setOptions(t.options),this.observers=[],q(this,Tn,t.client),q(this,at,E(this,Tn).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,q(this,Cn,hd(this.options)),this.state=t.state??E(this,Cn),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return E(this,rr)}get promise(){var t;return(t=E(this,Me))==null?void 0:t.promise}setOptions(t){if(this.options={...E(this,ts),...t},t!=null&&t._type&&q(this,rr,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=hd(this.options);n.data!==void 0&&(this.setState(pd(n.data,n.dataUpdatedAt)),q(this,Cn,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&E(this,at).remove(this)}setData(t,n){const r=Xo(this.state.data,t,this.options);return ge(this,et,Lt).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t){ge(this,et,Lt).call(this,{type:"setState",state:t})}cancel(t){var r,s;const n=(r=E(this,Me))==null?void 0:r.promise;return(s=E(this,Me))==null||s.cancel(t),n?n.then(Ze).catch(Ze):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return E(this,Cn)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>tt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===fi||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>an(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!Km(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=E(this,Me))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=E(this,Me))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),E(this,at).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(E(this,Me)&&(E(this,En)||ge(this,et,Xm).call(this)?E(this,Me).cancel({revert:!0}):E(this,Me).cancelRetry()),this.scheduleGc()),E(this,at).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||ge(this,et,Lt).call(this,{type:"invalidate"})}async fetch(t,n){var d,f,u,g,p,y,m,h,b,v,_;if(this.state.fetchStatus!=="idle"&&((d=E(this,Me))==null?void 0:d.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(E(this,Me))return E(this,Me).continueRetry(),E(this,Me).promise}if(t&&this.setOptions(t),!this.options.queryFn){const x=this.observers.find(S=>S.options.queryFn);x&&this.setOptions(x.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const r=new AbortController,s=x=>{Object.defineProperty(x,"signal",{enumerable:!0,get:()=>(q(this,En,!0),r.signal)})},i=()=>{const x=qm(this.options,n),T=(()=>{const P={client:E(this,Tn),queryKey:this.queryKey,meta:this.meta};return s(P),P})();return q(this,En,!1),this.options.persister?this.options.persister(x,T,this):x(T)},a=(()=>{const x={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:E(this,Tn),state:this.state,fetchFn:i};return s(x),x})(),l=E(this,rr)==="infinite"?wS(this.options.pages):this.options.behavior;l==null||l.onFetch(a,this),q(this,sr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((f=a.fetchOptions)==null?void 0:f.meta))&&ge(this,et,Lt).call(this,{type:"fetch",meta:(u=a.fetchOptions)==null?void 0:u.meta}),q(this,Me,Ym({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:x=>{x instanceof ea&&x.revert&&this.setState({...E(this,sr),fetchStatus:"idle"}),r.abort()},onFail:(x,S)=>{ge(this,et,Lt).call(this,{type:"failed",failureCount:x,error:S})},onPause:()=>{ge(this,et,Lt).call(this,{type:"pause"})},onContinue:()=>{ge(this,et,Lt).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const x=await E(this,Me).start();if(x===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(x),(p=(g=E(this,at).config).onSuccess)==null||p.call(g,x,this),(m=(y=E(this,at).config).onSettled)==null||m.call(y,x,this.state.error,this),x}catch(x){if(x instanceof ea){if(x.silent)return E(this,Me).promise;if(x.revert){if(this.state.data===void 0)throw x;return this.state.data}}throw ge(this,et,Lt).call(this,{type:"error",error:x}),(b=(h=E(this,at).config).onError)==null||b.call(h,x,this),(_=(v=E(this,at).config).onSettled)==null||_.call(v,this.state.data,x,this),x}finally{this.scheduleGc()}}},rr=new WeakMap,Cn=new WeakMap,sr=new WeakMap,at=new WeakMap,Tn=new WeakMap,Me=new WeakMap,ts=new WeakMap,En=new WeakMap,et=new WeakSet,Xm=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Lt=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...Jm(r.data,this.options),fetchMeta:t.meta??null};case"success":const s={...r,...pd(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return q(this,sr,t.manual?s:void 0),s;case"error":const i=t.error;return{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Fe.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),E(this,at).notify({query:this,type:"updated",action:t})})},ou);function Jm(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Zm(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function pd(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function hd(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Ge,be,ns,qe,Pn,ir,jt,Jt,rs,or,ar,kn,An,en,cr,Ce,Br,ta,na,ra,sa,ia,oa,aa,ep,au,SS=(au=class extends ms{constructor(t,n){super();ne(this,Ce);ne(this,Ge);ne(this,be);ne(this,ns);ne(this,qe);ne(this,Pn);ne(this,ir);ne(this,jt);ne(this,Jt);ne(this,rs);ne(this,or);ne(this,ar);ne(this,kn);ne(this,An);ne(this,en);ne(this,cr,new Set);this.options=n,q(this,Ge,t),q(this,Jt,null),q(this,jt,Jo()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(E(this,be).addObserver(this),gd(E(this,be),this.options)?ge(this,Ce,Br).call(this):this.updateResult(),ge(this,Ce,sa).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ca(E(this,be),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ca(E(this,be),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,ge(this,Ce,ia).call(this),ge(this,Ce,oa).call(this),E(this,be).removeObserver(this)}setOptions(t){const n=this.options,r=E(this,be);if(this.options=E(this,Ge).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof tt(this.options.enabled,E(this,be))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");ge(this,Ce,aa).call(this),E(this,be).setOptions(this.options),n._defaulted&&!Yo(this.options,n)&&E(this,Ge).getQueryCache().notify({type:"observerOptionsUpdated",query:E(this,be),observer:this});const s=this.hasListeners();s&&yd(E(this,be),r,this.options,n)&&ge(this,Ce,Br).call(this),this.updateResult(),s&&(E(this,be)!==r||tt(this.options.enabled,E(this,be))!==tt(n.enabled,E(this,be))||an(this.options.staleTime,E(this,be))!==an(n.staleTime,E(this,be)))&&ge(this,Ce,ta).call(this);const i=ge(this,Ce,na).call(this);s&&(E(this,be)!==r||tt(this.options.enabled,E(this,be))!==tt(n.enabled,E(this,be))||i!==E(this,en))&&ge(this,Ce,ra).call(this,i)}getOptimisticResult(t){const n=E(this,Ge).getQueryCache().build(E(this,Ge),t),r=this.createResult(n,t);return TS(this,r)&&(q(this,qe,r),q(this,ir,this.options),q(this,Pn,E(this,be).state)),r}getCurrentResult(){return E(this,qe)}trackResult(t,n){return new Proxy(t,{get:(r,s)=>(this.trackProp(s),n==null||n(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&E(this,jt).status==="pending"&&E(this,jt).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,s))})}trackProp(t){E(this,cr).add(t)}getCurrentQuery(){return E(this,be)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=E(this,Ge).defaultQueryOptions(t),r=E(this,Ge).getQueryCache().build(E(this,Ge),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return ge(this,Ce,Br).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),E(this,qe)))}createResult(t,n){var D;const r=E(this,be),s=this.options,i=E(this,qe),o=E(this,Pn),a=E(this,ir),d=t!==r?t.state:E(this,ns),{state:f}=t;let u={...f},g=!1,p;if(n._optimisticResults){const I=this.hasListeners(),N=!I&&gd(t,n),L=I&&yd(t,r,n,s);(N||L)&&(u={...u,...Jm(f.data,t.options)}),n._optimisticResults==="isRestoring"&&(u.fetchStatus="idle")}let{error:y,errorUpdatedAt:m,status:h}=u;p=u.data;let b=!1;if(n.placeholderData!==void 0&&p===void 0&&h==="pending"){let I;i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(I=i.data,b=!0):I=typeof n.placeholderData=="function"?n.placeholderData((D=E(this,ar))==null?void 0:D.state.data,E(this,ar)):n.placeholderData,I!==void 0&&(h="success",p=Xo(i==null?void 0:i.data,I,n),g=!0)}if(n.select&&p!==void 0&&!b)if(i&&p===(o==null?void 0:o.data)&&n.select===E(this,rs))p=E(this,or);else try{q(this,rs,n.select),p=n.select(p),p=Xo(i==null?void 0:i.data,p,n),q(this,or,p),q(this,Jt,null)}catch(I){q(this,Jt,I)}E(this,Jt)&&(y=E(this,Jt),p=E(this,or),m=Date.now(),h="error");const v=u.fetchStatus==="fetching",_=h==="pending",x=h==="error",S=_&&v,T=p!==void 0,A={status:h,fetchStatus:u.fetchStatus,isPending:_,isSuccess:h==="success",isError:x,isInitialLoading:S,isLoading:S,data:p,dataUpdatedAt:u.dataUpdatedAt,error:y,errorUpdatedAt:m,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:u.dataUpdateCount>d.dataUpdateCount||u.errorUpdateCount>d.errorUpdateCount,isFetching:v,isRefetching:v&&!_,isLoadingError:x&&!T,isPaused:u.fetchStatus==="paused",isPlaceholderData:g,isRefetchError:x&&T,isStale:Cc(t,n),refetch:this.refetch,promise:E(this,jt),isEnabled:tt(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const I=A.data!==void 0,N=A.status==="error"&&!I,L=F=>{N?F.reject(A.error):I&&F.resolve(A.data)},H=()=>{const F=q(this,jt,A.promise=Jo());L(F)},R=E(this,jt);switch(R.status){case"pending":t.queryHash===r.queryHash&&L(R);break;case"fulfilled":(N||A.data!==R.value)&&H();break;case"rejected":(!N||A.error!==R.reason)&&H();break}}return A}updateResult(){const t=E(this,qe),n=this.createResult(E(this,be),this.options);if(q(this,Pn,E(this,be).state),q(this,ir,this.options),E(this,Pn).data!==void 0&&q(this,ar,E(this,be)),Yo(n,t))return;q(this,qe,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!E(this,cr).size)return!0;const o=new Set(i??E(this,cr));return this.options.throwOnError&&o.add("error"),Object.keys(E(this,qe)).some(a=>{const l=a;return E(this,qe)[l]!==t[l]&&o.has(l)})};ge(this,Ce,ep).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&ge(this,Ce,sa).call(this)}},Ge=new WeakMap,be=new WeakMap,ns=new WeakMap,qe=new WeakMap,Pn=new WeakMap,ir=new WeakMap,jt=new WeakMap,Jt=new WeakMap,rs=new WeakMap,or=new WeakMap,ar=new WeakMap,kn=new WeakMap,An=new WeakMap,en=new WeakMap,cr=new WeakMap,Ce=new WeakSet,Br=function(t){ge(this,Ce,aa).call(this);let n=E(this,be).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Ze)),n},ta=function(){ge(this,Ce,ia).call(this);const t=an(this.options.staleTime,E(this,be));if(Xr.isServer()||E(this,qe).isStale||!Go(t))return;const r=Km(E(this,qe).dataUpdatedAt,t)+1;q(this,kn,wn.setTimeout(()=>{E(this,qe).isStale||this.updateResult()},r))},na=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(E(this,be)):this.options.refetchInterval)??!1},ra=function(t){ge(this,Ce,oa).call(this),q(this,en,t),!(Xr.isServer()||tt(this.options.enabled,E(this,be))===!1||!Go(E(this,en))||E(this,en)===0)&&q(this,An,wn.setInterval(()=>{(this.options.refetchIntervalInBackground||xc.isFocused())&&ge(this,Ce,Br).call(this)},E(this,en)))},sa=function(){ge(this,Ce,ta).call(this),ge(this,Ce,ra).call(this,ge(this,Ce,na).call(this))},ia=function(){E(this,kn)!==void 0&&(wn.clearTimeout(E(this,kn)),q(this,kn,void 0))},oa=function(){E(this,An)!==void 0&&(wn.clearInterval(E(this,An)),q(this,An,void 0))},aa=function(){const t=E(this,Ge).getQueryCache().build(E(this,Ge),this.options);if(t===E(this,be))return;const n=E(this,be);q(this,be,t),q(this,ns,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},ep=function(t){Fe.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(E(this,qe))}),E(this,Ge).getQueryCache().notify({query:E(this,be),type:"observerResultsUpdated"})})},au);function CS(e,t){return tt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&tt(t.retryOnMount,e)===!1)}function gd(e,t){return CS(e,t)||e.state.data!==void 0&&ca(e,t,t.refetchOnMount)}function ca(e,t,n){if(tt(t.enabled,e)!==!1&&an(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Cc(e,t)}return!1}function yd(e,t,n,r){return(e!==t||tt(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Cc(e,n)}function Cc(e,t){return tt(t.enabled,e)!==!1&&e.isStaleByTime(an(t.staleTime,e))}function TS(e,t){return!Yo(e.getCurrentResult(),t)}var ss,Tt,ze,On,Et,qt,cu,ES=(cu=class extends Qm{constructor(t){super();ne(this,Et);ne(this,ss);ne(this,Tt);ne(this,ze);ne(this,On);q(this,ss,t.client),this.mutationId=t.mutationId,q(this,ze,t.mutationCache),q(this,Tt,[]),this.state=t.state||PS(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){E(this,Tt).includes(t)||(E(this,Tt).push(t),this.clearGcTimeout(),E(this,ze).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){q(this,Tt,E(this,Tt).filter(n=>n!==t)),this.scheduleGc(),E(this,ze).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){E(this,Tt).length||(this.state.status==="pending"?this.scheduleGc():E(this,ze).remove(this))}continue(){var t;return((t=E(this,On))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,a,l,d,f,u,g,p,y,m,h,b,v,_,x,S,T,P;const n=()=>{ge(this,Et,qt).call(this,{type:"continue"})},r={client:E(this,ss),meta:this.options.meta,mutationKey:this.options.mutationKey};q(this,On,Ym({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(A,D)=>{ge(this,Et,qt).call(this,{type:"failed",failureCount:A,error:D})},onPause:()=>{ge(this,Et,qt).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>E(this,ze).canRun(this)}));const s=this.state.status==="pending",i=!E(this,On).canStart();try{if(s)n();else{ge(this,Et,qt).call(this,{type:"pending",variables:t,isPaused:i}),E(this,ze).config.onMutate&&await E(this,ze).config.onMutate(t,this,r);const D=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,t,r));D!==this.state.context&&ge(this,Et,qt).call(this,{type:"pending",context:D,variables:t,isPaused:i})}const A=await E(this,On).start();return await((d=(l=E(this,ze).config).onSuccess)==null?void 0:d.call(l,A,t,this.state.context,this,r)),await((u=(f=this.options).onSuccess)==null?void 0:u.call(f,A,t,this.state.context,r)),await((p=(g=E(this,ze).config).onSettled)==null?void 0:p.call(g,A,null,this.state.variables,this.state.context,this,r)),await((m=(y=this.options).onSettled)==null?void 0:m.call(y,A,null,t,this.state.context,r)),ge(this,Et,qt).call(this,{type:"success",data:A}),A}catch(A){try{await((b=(h=E(this,ze).config).onError)==null?void 0:b.call(h,A,t,this.state.context,this,r))}catch(D){Promise.reject(D)}try{await((_=(v=this.options).onError)==null?void 0:_.call(v,A,t,this.state.context,r))}catch(D){Promise.reject(D)}try{await((S=(x=E(this,ze).config).onSettled)==null?void 0:S.call(x,void 0,A,this.state.variables,this.state.context,this,r))}catch(D){Promise.reject(D)}try{await((P=(T=this.options).onSettled)==null?void 0:P.call(T,void 0,A,t,this.state.context,r))}catch(D){Promise.reject(D)}throw ge(this,Et,qt).call(this,{type:"error",error:A}),A}finally{E(this,ze).runNext(this)}}},ss=new WeakMap,Tt=new WeakMap,ze=new WeakMap,On=new WeakMap,Et=new WeakSet,qt=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Fe.batch(()=>{E(this,Tt).forEach(r=>{r.onMutationUpdate(t)}),E(this,ze).notify({mutation:this,type:"updated",action:t})})},cu);function PS(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var It,ht,is,lu,kS=(lu=class extends ms{constructor(t={}){super();ne(this,It);ne(this,ht);ne(this,is);this.config=t,q(this,It,new Set),q(this,ht,new Map),q(this,is,0)}build(t,n,r){const s=new ES({client:t,mutationCache:this,mutationId:++ws(this,is)._,options:t.defaultMutationOptions(n),state:r});return this.add(s),s}add(t){E(this,It).add(t);const n=Ls(t);if(typeof n=="string"){const r=E(this,ht).get(n);r?r.push(t):E(this,ht).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(E(this,It).delete(t)){const n=Ls(t);if(typeof n=="string"){const r=E(this,ht).get(n);if(r)if(r.length>1){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}else r[0]===t&&E(this,ht).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Ls(t);if(typeof n=="string"){const r=E(this,ht).get(n),s=r==null?void 0:r.find(i=>i.state.status==="pending");return!s||s===t}else return!0}runNext(t){var r;const n=Ls(t);if(typeof n=="string"){const s=(r=E(this,ht).get(n))==null?void 0:r.find(i=>i!==t&&i.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Fe.batch(()=>{E(this,It).forEach(t=>{this.notify({type:"removed",mutation:t})}),E(this,It).clear(),E(this,ht).clear()})}getAll(){return Array.from(E(this,It))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>dd(n,r))}findAll(t={}){return this.getAll().filter(n=>dd(t,n))}notify(t){Fe.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Fe.batch(()=>Promise.all(t.map(n=>n.continue().catch(Ze))))}},It=new WeakMap,ht=new WeakMap,is=new WeakMap,lu);function Ls(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Pt,du,AS=(du=class extends ms{constructor(t={}){super();ne(this,Pt);this.config=t,q(this,Pt,new Map)}build(t,n,r){const s=n.queryKey,i=n.queryHash??Sc(s,n);let o=this.get(i);return o||(o=new xS({client:t,queryKey:s,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){E(this,Pt).has(t.queryHash)||(E(this,Pt).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=E(this,Pt).get(t.queryHash);n&&(t.destroy(),n===t&&E(this,Pt).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Fe.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return E(this,Pt).get(t)}getAll(){return[...E(this,Pt).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>ld(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>ld(t,r)):n}notify(t){Fe.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Fe.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Fe.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Pt=new WeakMap,du),Le,tn,nn,lr,dr,rn,ur,fr,uu,OS=(uu=class{constructor(e={}){ne(this,Le);ne(this,tn);ne(this,nn);ne(this,lr);ne(this,dr);ne(this,rn);ne(this,ur);ne(this,fr);q(this,Le,e.queryCache||new AS),q(this,tn,e.mutationCache||new kS),q(this,nn,e.defaultOptions||{}),q(this,lr,new Map),q(this,dr,new Map),q(this,rn,0)}mount(){ws(this,rn)._++,E(this,rn)===1&&(q(this,ur,xc.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,Le).onFocus())})),q(this,fr,mi.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,Le).onOnline())})))}unmount(){var e,t;ws(this,rn)._--,E(this,rn)===0&&((e=E(this,ur))==null||e.call(this),q(this,ur,void 0),(t=E(this,fr))==null||t.call(this),q(this,fr,void 0))}isFetching(e){return E(this,Le).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return E(this,tn).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=E(this,Le).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=E(this,Le).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(an(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return E(this,Le).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),s=E(this,Le).get(r.queryHash),i=s==null?void 0:s.state.data,o=dS(t,i);if(o!==void 0)return E(this,Le).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return Fe.batch(()=>E(this,Le).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=E(this,Le).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=E(this,Le);Fe.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=E(this,Le);return Fe.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Fe.batch(()=>E(this,Le).findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(Ze).catch(Ze)}invalidateQueries(e,t={}){return Fe.batch(()=>(E(this,Le).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=Fe.batch(()=>E(this,Le).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,n);return n.throwOnError||(i=i.catch(Ze)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Ze)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=E(this,Le).build(this,t);return n.isStaleByTime(an(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ze).catch(Ze)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ze).catch(Ze)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return mi.isOnline()?E(this,tn).resumePausedMutations():Promise.resolve()}getQueryCache(){return E(this,Le)}getMutationCache(){return E(this,tn)}getDefaultOptions(){return E(this,nn)}setDefaultOptions(e){q(this,nn,e)}setQueryDefaults(e,t){E(this,lr).set(Yr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...E(this,lr).values()],n={};return t.forEach(r=>{Qr(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){E(this,dr).set(Yr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...E(this,dr).values()],n={};return t.forEach(r=>{Qr(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...E(this,nn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Sc(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===fi&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...E(this,nn).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){E(this,Le).clear(),E(this,tn).clear()}},Le=new WeakMap,tn=new WeakMap,nn=new WeakMap,lr=new WeakMap,dr=new WeakMap,rn=new WeakMap,ur=new WeakMap,fr=new WeakMap,uu),tp=w.createContext(void 0),ps=e=>{const t=w.useContext(tp);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},NS=({client:e,children:t})=>(w.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),c.jsx(tp.Provider,{value:e,children:t})),np=w.createContext(!1),RS=()=>w.useContext(np);np.Provider;function LS(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var DS=w.createContext(LS()),jS=()=>w.useContext(DS),IS=(e,t,n)=>{const r=n!=null&&n.state.error&&typeof e.throwOnError=="function"?Gm(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},MS=e=>{w.useEffect(()=>{e.clearReset()},[e])},FS=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||Gm(n,[e.error,r])),US=e=>{if(e.suspense){const n=s=>s==="static"?s:Math.max(s??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...s)=>n(r(...s)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},BS=(e,t)=>e.isLoading&&e.isFetching&&!t,$S=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,bd=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function VS(e,t,n){var p,y,m,h;if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const r=RS(),s=jS(),i=ps(),o=i.defaultQueryOptions(e);(y=(p=i.getDefaultOptions().queries)==null?void 0:p._experimental_beforeQuery)==null||y.call(p,o);const a=i.getQueryCache().get(o.queryHash);process.env.NODE_ENV!=="production"&&(o.queryFn||console.error(`[${o.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`));const l=e.subscribed!==!1;o._optimisticResults=r?"isRestoring":l?"optimistic":void 0,US(o),IS(o,s,a),MS(s);const d=!i.getQueryCache().get(o.queryHash),[f]=w.useState(()=>new t(i,o)),u=f.getOptimisticResult(o),g=!r&&l;if(w.useSyncExternalStore(w.useCallback(b=>{const v=g?f.subscribe(Fe.batchCalls(b)):Ze;return f.updateResult(),v},[f,g]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),w.useEffect(()=>{f.setOptions(o)},[o,f]),$S(o,u))throw bd(o,f,s);if(FS({result:u,errorResetBoundary:s,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw u.error;if((h=(m=i.getDefaultOptions().queries)==null?void 0:m._experimental_afterQuery)==null||h.call(m,o,u),o.experimental_prefetchInRender&&!Xr.isServer()&&BS(u,r)){const b=d?bd(o,f,s):a==null?void 0:a.promise;b==null||b.catch(Ze).finally(()=>{f.updateResult()})}return o.notifyOnChangeProps?u:f.trackResult(u)}function Or(e,t){return VS(e,SS)}function HS(e,t){const n=ps(),r=n.getQueryCache();return w.useSyncExternalStore(w.useCallback(s=>r.subscribe(Fe.batchCalls(s)),[r]),()=>n.isFetching(e),()=>n.isFetching(e))}const rp=C.createContext(null);function zS(e){return typeof window>"u"?e??null:e?(localStorage.setItem(Dm,e),e):null}function WS({token:e,children:t}){const n=zS(e);return c.jsx(rp.Provider,{value:n,children:t})}function KS(){return C.useContext(rp)}const Tc="widget-accounts",Ec="widget-positions",Pc="widget-orders",hs="widget-deals",gs="widget-deals-total",qS=2e4,GS=3e4;function qs(e){const t=String(e.getUTCDate()).padStart(2,"0"),n=String(e.getUTCMonth()+1).padStart(2,"0"),r=String(e.getUTCHours()).padStart(2,"0"),s=String(e.getUTCMinutes()).padStart(2,"0"),i=String(e.getUTCSeconds()).padStart(2,"0");return`${n}.${t} ${r}:${s}:${i}`}function sp(e){const t=["seconds","Seconds","timestamp","Timestamp","value","Value","time","Time"];for(const n of t)if(e[n]!==void 0&&e[n]!==null&&e[n]!=="")return e[n]}function ip(e){if(e==null||e==="")return 0;if(typeof e=="number"&&Number.isFinite(e))return e>1e12?e:e*1e3;if(typeof e=="string"){const t=e.trim();if(!t)return 0;if(/^\d+$/.test(t)){const r=Number(t);if(Number.isFinite(r))return r>1e12?r:r*1e3}const n=Date.parse(t);if(Number.isFinite(n))return n}if(typeof e=="object"&&e!==null){const n=sp(e);if(n!==void 0)return ip(n)}return 0}function kc(e){if(e==null||e==="")return"—";if(typeof e=="number"&&Number.isFinite(e)){const t=e>1e12?e:e*1e3;return qs(new Date(t))}if(typeof e=="string"){const t=e.trim();if(!t)return"—";if(/^\d+$/.test(t)){const r=Number(t);if(Number.isFinite(r)){const s=r>1e12?r:r*1e3;return qs(new Date(s))}}const n=Date.parse(t);return Number.isFinite(n)?qs(new Date(n)):t}if(typeof e=="object"&&e!==null){const n=sp(e);if(n!==void 0)return kc(n)}return"—"}const op=["time","Time","openTime","open_time","OpenTime","TimeOpen","timeOpen","timeCreate","TimeCreate","timeSetup","TimeSetup","setupTime","setup_time","createdAt","created_at","createTime","CreateTime","timestamp","Timestamp","openDate","OpenDate","date","Date"];function ZS(e){return qs(e)}const YS={0:"buy",1:"sell",2:"buy limit",3:"sell limit",4:"buy stop",5:"sell stop",6:"buy stop limit",7:"sell stop limit"};function Wi(e,t){for(const n of t)if(e[n]!==void 0&&e[n]!==null&&e[n]!=="")return e[n]}function ot(e,t){const n=Wi(e,t);if(n===void 0)return;const r=Number(n);return Number.isFinite(r)?r:void 0}function Ds(e,t){const n=Wi(e,t);if(n!==void 0)return String(n)}function QS(e){if(Array.isArray(e))return e.filter(r=>typeof r=="object"&&r!==null);if(!e||typeof e!="object")return[];const t=e,n=["data","body","result"];for(const r of n){const s=t[r];if(Array.isArray(s))return s.filter(i=>typeof i=="object"&&i!==null);if(s&&typeof s=="object"){const i=s,o=["list","items","records","orders","content","data"];for(const a of o){const l=i[a];if(Array.isArray(l))return l.filter(d=>typeof d=="object"&&d!==null)}}}return[]}function la(e){return e===void 0?.01:e>=100?e/1e4:e}function XS(e,t){return Yf(t,e)}function JS(e){const t=Wi(e,["type","Type","orderType","OrderType"]);if(typeof t=="string"){const r=t.toLowerCase().trim();if(r)return{label:r,side:r.includes("sell")?"sell":"buy",typeNum:r.includes("sell")?3:2}}const n=ot(e,["type","Type","orderType","OrderType"])??2;return{label:YS[n]??(n%2===1?"sell":"buy"),side:ci(n),typeNum:n}}function e0(e,t){const n=ot(e,["volumeFilled","volume_filled","VolumeFilled","filledVolume","FilledVolume"]);if(n!==void 0)return la(n);const r=ot(e,["volumeCurrent","volume_current","VolumeCurrent"]);return r!==void 0?la(r):0}function t0(e,t){const n=Ds(e,["ticket","Ticket","order","Order","id","ID"]),r=Ds(e,["symbol","Symbol"])??"";if(!n||!r)return null;const s=Ke(r),{label:i,side:o,typeNum:a}=JS(e),l=ot(e,["typeTime","TypeTime"])??0,d=la(ot(e,["volumeLots","volume_lots","VolumeLots","volume","Volume"])),f=e0(e),u=ot(e,["priceOrder","price_order","PriceOrder","openPrice","open_price","price","Price"])??0,g=ot(e,["priceTrigger","price_trigger","PriceTrigger","triggerPrice","TriggerPrice"]),p=ot(e,["currentPrice","current_price","PriceCurrent","priceCurrent","marketPrice","MarketPrice"])??u,y=ot(e,["stopLoss","stop_loss","PriceSL","sl","SL"]),m=ot(e,["takeProfit","take_profit","PriceTP","tp","TP"]),h=ot(e,["marketBid","MarketBid","bid","Bid"])??p,b=ot(e,["marketAsk","MarketAsk","ask","Ask"])??p,v=Ds(e,["comment","Comment"])??"",_=XS(e,s),x=Wi(e,op),S=ip(x),T=kc(x);return{ticket:n,login:Ds(e,["login","Login"])??t,symbol:s,displaySymbol:Ii(s),openTimeMs:S,time:T,typeLabel:i,orderType:a,typeTime:l,side:o,volumeLots:d,volumeFilledLots:f,orderPrice:u,priceTrigger:g,stopLoss:y,takeProfit:m,currentPrice:p,marketBid:h,marketAsk:b,comment:v,digits:_}}function n0(e,t){return QS(e).map(n=>t0(n,t)).filter(n=>n!==null)}function Ki(e,t){for(const n of t)if(e[n]!==void 0&&e[n]!==null&&e[n]!=="")return e[n]}function Gt(e,t){const n=Ki(e,t);if(n===void 0)return;const r=Number(n);return Number.isFinite(r)?r:void 0}function js(e,t){const n=Ki(e,t);if(n!==void 0)return String(n)}function r0(e){if(Array.isArray(e))return e.filter(r=>typeof r=="object"&&r!==null);if(!e||typeof e!="object")return[];const t=e,n=["data","body","result"];for(const r of n){const s=t[r];if(Array.isArray(s))return s.filter(i=>typeof i=="object"&&i!==null);if(s&&typeof s=="object"){const i=s,o=["list","items","records","positions","orders","content","data"];for(const a of o){const l=i[a];if(Array.isArray(l))return l.filter(d=>typeof d=="object"&&d!==null)}}}return[]}function s0(e){return e===void 0?.01:e>=100?e/1e4:e}function i0(e){const t=Ki(e,["type","Type","action","Action","side","Side"]);if(typeof t=="string"){const r=t.toLowerCase();if(r.includes("sell"))return"sell";if(r.includes("buy"))return"buy"}const n=Gt(e,["type","Type","action","Action"]);return n!==void 0&&n%2===1?"sell":"buy"}function o0(e,t){return Yf(t,e)}function a0(e,t){const n=js(e,["ticket","Ticket","position","Position","order","Order","id","ID"]),r=js(e,["symbol","Symbol"])??"";if(!n||!r)return null;const s=Ke(r),i=i0(e),o=s0(Gt(e,["volumeLots","volume_lots","VolumeLots","volume","Volume"])),a=Gt(e,["openPrice","open_price","PriceOpen","priceOpen","price","Price"])??0,l=Gt(e,["currentPrice","current_price","PriceCurrent","priceCurrent"])??a,d=Gt(e,["stopLoss","stop_loss","PriceSL","sl","SL"]),f=Gt(e,["takeProfit","take_profit","PriceTP","tp","TP"]),u=Gt(e,["profit","Profit","floating","Floating","pnl","PnL"])??0,g=Gt(e,["swap","Swap"])??0,p=js(e,["comment","Comment"])??"",y=o0(e,s),m=kc(Ki(e,op));return{ticket:n,login:js(e,["login","Login"])??t,symbol:s,displaySymbol:Ii(s),time:m,type:i,volumeLots:o,openPrice:a,stopLoss:d,takeProfit:f,currentPrice:l,marketBid:l,marketAsk:l,swap:g,profit:u,comment:p,digits:y}}function c0(e,t){return r0(e).map(n=>a0(n,t)).filter(n=>n!==null)}function ys(){return Bt}function ap(){const e=dt(),t=KS(),{data:n,isLoading:r,isError:s}=Or({queryKey:[Tc,e.baseUrl,t],queryFn:()=>e.getAccounts(),enabled:!!t,refetchInterval:GS});return{accounts:n??[],isLoading:r,isError:s}}function l0(e){const t=dt();return Or({queryKey:[Ec,t.baseUrl,e],queryFn:()=>t.dealer.getPositions(e),enabled:!!e,refetchInterval:qS})}function d0(e){const t=dt();return Or({queryKey:[Pc,t.baseUrl,e],queryFn:()=>t.dealer.getOrders(e),enabled:!!e})}function u0(e,t){e.invalidateQueries({queryKey:[Tc,t]})}function f0(e,t,n){e.invalidateQueries({queryKey:[gs,t,n]}),e.invalidateQueries({queryKey:[hs,t,n]})}function m0(){const e=ps(),t=dt();return C.useCallback(async n=>{await Promise.all([e.invalidateQueries({queryKey:[gs,t.baseUrl,n]}),e.invalidateQueries({queryKey:[hs,t.baseUrl,n]})])},[t.baseUrl,e])}function p0(){const e=ps(),t=dt();return C.useCallback(async n=>{await Promise.all([e.invalidateQueries({queryKey:[Tc,t.baseUrl]}),e.invalidateQueries({queryKey:[Ec,t.baseUrl,n]}),e.invalidateQueries({queryKey:[Pc,t.baseUrl,n]}),e.invalidateQueries({queryKey:[gs,t.baseUrl,n]}),e.invalidateQueries({queryKey:[hs,t.baseUrl,n]})])},[t.baseUrl,e])}function h0(){const e=ps(),t=dt();return C.useCallback((n,r,s)=>{u0(e,t.baseUrl),e.invalidateQueries({queryKey:[Ec,t.baseUrl,n]}),(r===void 0||ac(r))&&e.invalidateQueries({queryKey:[Pc,t.baseUrl,n]}),(s==null?void 0:s.invalidateDeals)!==!1&&f0(e,t.baseUrl,n)},[t.baseUrl,e])}function qi(){const e=dt(),t=h0();return{async submitOrder(n){const r=await e.trading.submitOrder(n);return r.success&&t(n.login,n.orderType),r},async closePosition(n,r){const s=await e.trading.closePosition(n);return s.success&&!(r!=null&&r.skipInvalidation)&&t(n.login),s},async deleteOrder(n){const r=await e.trading.deleteOrder(n);return r.success&&t(n.login,n.orderType),r},async modifyOrder(n,r){const s=await e.trading.modifyOrder(n,r);return s.success&&t(n.login,n.orderType),s},async modifyPosition(n,r){const s=await e.trading.modifyPosition(n,r);return s.success&&t(n.login),s}}}function g0(e){if(e===null||typeof e!="object")return{deals:[],offset:0,count:0};const t=e,n=t.data??t,s=(Array.isArray(n.deals)?n.deals:[]).map(i=>{const o=i??{};return{deal:Number(o.Deal??0),login:Number(o.Login??0),symbol:String(o.Symbol??""),action:Number(o.Action??0),volume:Number(o.Volume??0),price:Number(o.Price??0),profit:Number(o.Profit??0),time:Number(o.Time??0),entry:Number(o.Entry??0),comment:String(o.Comment??"")}});return{deals:s,offset:Number(n.offset??0),count:Number(n.count??s.length)}}function y0(e){if(e===null||typeof e!="object")return{total:0};const t=e,n=t.data??t;return{total:Number(n.total??0)}}function b0(e,t,n,r={}){const s=dt();return Or({queryKey:[gs,s.baseUrl,e,t,n],queryFn:async()=>{const i=await s.dealer.getDealsTotal(e,t,n);return y0(i)},enabled:r.enabled??!0})}function v0(e,t,n,r,s,i={}){const o=dt();return Or({queryKey:[hs,o.baseUrl,e,t,n,r,s],queryFn:async()=>{const a=await o.dealer.getDeals(e,t,n,r,s);return g0(a)},enabled:i.enabled??!0})}function w0(e,t){return e!=null?c0(e,t):[]}function _0(e,t){return e!=null?n0(e,t):[]}function x0({symbolTicker:e,controlsRef:t,chartWidget:n,sidePanelTab:r,orderState:s,backUrl:i,createAccountUrl:o}){const{openMarketPanel:a,setSelectedLogin:l}=s,d=ys();return C.useEffect(()=>(t.current={open:a,setSelectedLogin:l},()=>{t.current=null}),[t,a,l]),c.jsxs(c.Fragment,{children:[c.jsx(Wm,{chartWidget:n,symbolTicker:e,symbols:d}),c.jsx(Fm,{}),c.jsx(Hx,{symbolTicker:e,sidePanelTab:r,orderState:s,backUrl:i,createAccountUrl:o})]})}const S0=8,vd=11;function C0({wide:e}){return c.jsx("td",{className:"web-trading-widget-terminal__cell",children:c.jsx("div",{className:`web-trading-widget-terminal__skeleton-bar${e?" web-trading-widget-terminal__skeleton-bar--wide":""}`})})}function T0(){return c.jsx(c.Fragment,{children:Array.from({length:S0},(e,t)=>c.jsx("tr",{className:"web-trading-widget-terminal__skeleton-row",children:Array.from({length:vd},(n,r)=>c.jsx(C0,{wide:r===vd-1},r))},t))})}const E0={0:"Buy",1:"Sell",2:"Balance",3:"Credit",5:"-"},P0="web-trading-widget-text-buy",k0="web-trading-widget-text-sell",A0="web-trading-widget-terminal__head-row",Co=50;function O0(e){return e===0?P0:e===1?k0:A0}const wd=e=>e.toISOString().split("T")[0],cp=e=>Math.floor(new Date(e).getTime()/1e3),N0=e=>cp(e),R0=e=>cp(e)+86399;function L0(){const e=new Date,t=new Date;return t.setDate(t.getDate()-7),{fromTs:N0(wd(t)),toTs:R0(wd(e))}}const D0=e=>new Date(e*1e3).toLocaleString(void 0,{year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"});function j0(e){try{return decodeURIComponent(e)}catch{return e}}function I0(){return c.jsxs("colgroup",{children:[c.jsx("col",{className:"web-trading-widget-terminal-col--deal"}),c.jsx("col",{className:"web-trading-widget-terminal-col--ticket"}),c.jsx("col",{className:"web-trading-widget-terminal-col--symbol"}),c.jsx("col",{className:"web-trading-widget-terminal-col--type"}),c.jsx("col",{className:"web-trading-widget-terminal-col--volume"}),c.jsx("col",{className:"web-trading-widget-terminal-col--price"}),c.jsx("col",{className:"web-trading-widget-terminal-col--profit"}),c.jsx("col",{className:"web-trading-widget-terminal-col--entry"}),c.jsx("col",{className:"web-trading-widget-terminal-col--time"}),c.jsx("col",{className:"web-trading-widget-terminal-col--local-time"}),c.jsx("col",{})]})}function M0(){return c.jsx("thead",{children:c.jsxs("tr",{className:"web-trading-widget-terminal__head-row",children:[c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Deal"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Login"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Symbol"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Action"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Volume"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Price"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Profit"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Entry"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Time"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Local time"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Comment"})]})})}function F0({deal:e}){const t=e.profit>0?"web-trading-widget-text-profit-positive":e.profit<0?"web-trading-widget-text-profit-negative":"";return c.jsxs("tr",{className:"web-trading-widget-terminal__deals-row",children:[c.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.deal}),c.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.login}),c.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.symbol||"—"}),c.jsx("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--capitalize ${O0(e.action)}`,children:E0[e.action]??`Action ${e.action}`}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:(e.volume/1e4).toFixed(2)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.price.toFixed(5)}),c.jsxs("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right ${t}`,children:[e.profit>0?"+":"",e.profit.toFixed(2)]}),c.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.entry===1?"OUT":"IN"}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--nowrap",children:ZS(new Date(e.time*1e3))}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--nowrap",children:D0(e.time)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--truncate",children:e.comment?j0(e.comment):"—"})]})}function U0({login:e,detailUrl:t}){const{fromTs:n,toTs:r}=C.useMemo(()=>L0(),[]),s=e!=="",{data:i,isLoading:o}=b0(e,n,r,{enabled:s}),a=(i==null?void 0:i.total)??0,l=Math.max(0,a-Co),d=a>0?Math.min(Co,a):Co,{data:f,isLoading:u}=v0(e,n,r,l,d,{enabled:s}),g=s&&(o||u),p=C.useMemo(()=>[...(f==null?void 0:f.deals)??[]].sort((y,m)=>m.time-y.time),[f==null?void 0:f.deals]);return e?c.jsx("div",{className:"web-trading-widget-terminal__deals-wrap",children:c.jsxs("div",{className:"web-trading-widget-terminal__body-scroll",children:[c.jsxs("table",{className:"web-trading-widget-terminal__deals-table",children:[c.jsx(I0,{}),c.jsx(M0,{}),c.jsxs("tbody",{children:[g?c.jsx(T0,{}):null,!g&&p.length===0?c.jsx("tr",{children:c.jsx("td",{colSpan:11,className:"web-trading-widget-terminal__empty-cell",children:"No deals found"})}):null,g?null:p.map(y=>c.jsx(F0,{deal:y},y.deal))]})]}),t?c.jsx("div",{className:"web-trading-widget-terminal__deals-footer",children:c.jsx("a",{href:t,className:"web-trading-widget-terminal__deals-detail-btn",children:"See full deal history"})}):null]})}):c.jsx("div",{className:"web-trading-widget-terminal__empty-cell",children:"Select an account to view deal history"})}function lp(e){const t=pe(d=>d.setPositions),n=pe(d=>d.setOrders),{data:r,isLoading:s,isError:i}=l0(e),{data:o,isLoading:a,isError:l}=d0(e);return C.useEffect(()=>{if(!e.trim()){t([]),n([]);return}r!=null&&t(w0(r,e)),o!=null&&n(_0(o,e))},[e,o,r,n,t]),{isLoading:s||a,isError:!!(i||l)}}const _d=224,xd=32,Ac=120;function dp(){return typeof window>"u"?560:Math.max(Ac,Math.floor(window.innerHeight*.7))}function B0(e){return Math.min(dp(),Math.max(Ac,e))}function $0(){const[e,t]=C.useState(_d),[n,r]=C.useState(!1),s=C.useRef(_d);C.useEffect(()=>{s.current=e},[e]);const i=C.useCallback(f=>{t(B0(f))},[]),o=C.useCallback(()=>{i(s.current+xd)},[i]),a=C.useCallback(()=>{i(s.current-xd)},[i]),l=C.useCallback(f=>{const u=f,g=s.current;r(!0);const p=m=>{const h=u-m.clientY;i(g+h)},y=()=>{r(!1),document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",y),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",p),document.addEventListener("mouseup",y),document.body.style.cursor="row-resize",document.body.style.userSelect="none"},[i]);C.useEffect(()=>{const f=()=>{i(s.current)};return window.addEventListener("resize",f),()=>{window.removeEventListener("resize",f),document.body.style.cursor="",document.body.style.userSelect=""}},[i]);const d=dp();return{height:e,isResizing:n,canIncrement:e<d,canDecrement:e>Ac,onResizeStart:l,incrementHeight:o,decrementHeight:a}}const V0=e=>e==null?void 0:e.replace(/(\d+)\.0{18}/g,"$1"),H0=2e4;let To=0;function z0(){return To=(To+1)%Number.MAX_VALUE,To.toString()}const Eo=new Map,Sd=(e,t)=>{if(Eo.has(e))return;const n=setTimeout(()=>{Eo.delete(e),zr({type:"REMOVE_TOAST",toastId:e})},t||H0);Eo.set(e,n)},W0=(e,t)=>{var n;switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,((n=t==null?void 0:t.toast)==null?void 0:n.limit)??1)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(r=>r.id===t.toast.id?{...r,...t.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=t;if(r){const s=e.toasts.find(i=>i.id===r);Sd(r,s==null?void 0:s.duration)}else e.toasts.forEach(s=>{Sd(s.id,s.duration)});return{...e,toasts:e.toasts.map(s=>s.id===r||r===void 0?{...s,open:!1}:s)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(r=>r.id!==t.toastId)}}},Gs=[];let Zs={toasts:[]};function zr(e){Zs=W0(Zs,e),Gs.forEach(t=>{t(Zs)})}function Se({duration:e=2e4,description:t,...n}){const r=z0(),s=typeof t=="string"?V0(t):t,i=a=>zr({type:"UPDATE_TOAST",toast:{...a,description:s,id:r}}),o=()=>{zr({type:"DISMISS_TOAST",toastId:r})};return zr({type:"ADD_TOAST",toast:{...n,description:s,id:r,open:!0,duration:e,onOpenChange:a=>{a||o()}}}),e&&setTimeout(o,e),{id:r,dismiss:o,update:i}}function K0(){const[e,t]=w.useState(Zs);return w.useEffect(()=>(Gs.push(t),()=>{const n=Gs.indexOf(t);n>-1&&Gs.splice(n,1)}),[e]),{...e,toast:Se,dismiss:n=>zr({type:"DISMISS_TOAST",toastId:n})}}function q0(e){return e.type==="buy"?e.marketBid??e.currentPrice:e.marketAsk??e.currentPrice}function G0(){const{closePosition:e,deleteOrder:t}=qi(),n=p0(),r=pe(h=>h.removePosition),s=pe(h=>h.removeOrder),i=pe(h=>h.setSelectedPositionTicket),o=pe(h=>h.setSelectedOrderTicket),[a,l]=C.useState(new Set),[d,f]=C.useState(!1),u=C.useCallback((h,b)=>{l(v=>{const _=new Set(v);return b?_.add(h):_.delete(h),_})},[]),g=C.useCallback(h=>a.has(h),[a]),p=C.useCallback(async h=>{const b=`position-${h.ticket}`;u(b,!0);try{const v=await e(h);if(!v.success){Se({variant:"destructive",description:v.message||"Failed to close position."});return}r(h.ticket),i(null),Se({description:`Position #${h.ticket} closed at ${q0(h).toFixed(h.digits)}.`})}catch(v){const _=v instanceof Error?v.message:"Failed to close position.";Se({variant:"destructive",description:_})}finally{u(b,!1)}},[e,r,u,i]),y=C.useCallback(async h=>{var x;if(h.length===0||d)return;if(!e){Se({variant:"destructive",description:"Close position is not configured."});return}f(!0);let b=0,v=0;const _=((x=h[0])==null?void 0:x.login)??"";for(const S of h){const T=`position-${S.ticket}`;u(T,!0);try{if(!(await e(S,{skipInvalidation:!0})).success){v+=1;continue}r(S.ticket),b+=1}catch{v+=1}finally{u(T,!1)}}i(null),b>0&&_&&await n(_),Se(v===0?{description:b===1?"1 position closed.":`${b} positions closed.`}:b===0?{variant:"destructive",description:"Failed to close positions."}:{variant:"destructive",description:`Closed ${b}, failed ${v}.`}),f(!1)},[d,e,n,r,u,i]),m=C.useCallback(async h=>{const b=`order-${h.ticket}`;u(b,!0);try{const v=await t(h);if(!v.success){Se({variant:"destructive",description:v.message||"Failed to delete order."});return}s(h.ticket),o(null),Se({description:`Order #${h.ticket} deleted.`})}catch(v){const _=v instanceof Error?v.message:"Failed to delete order.";Se({variant:"destructive",description:_})}finally{u(b,!1)}},[t,s,u,o]);return{closePosition:p,closeAllPositions:y,deleteOrder:m,isClosingAll:d,isRowBusy:g}}function Zt(e,t=2){return e.toFixed(t)}function up(e){return e.reduce((t,n)=>t+n.profit+n.swap,0)}function Z0(e,t,n){const r=(e==null?void 0:e.balance)??0,s=(e==null?void 0:e.credit)??0,i=(e==null?void 0:e.margin)??0;if(!e||t.length===0)return{balance:r,equity:(e==null?void 0:e.equity)??r+s,margin:i,marginFree:(e==null?void 0:e.marginFree)??0,marginLevel:e==null?void 0:e.marginLevel,totalProfit:0};const o=up(t),a=r+s+o+n,l=a-i,d=i>0?a/i*100:void 0;return{balance:r,equity:a,margin:i,marginFree:l,marginLevel:d,totalProfit:o}}function da(){return c.jsxs("colgroup",{children:[c.jsx("col",{className:"web-trading-widget-terminal-col--symbol"}),c.jsx("col",{className:"web-trading-widget-terminal-col--ticket"}),c.jsx("col",{className:"web-trading-widget-terminal-col--time"}),c.jsx("col",{className:"web-trading-widget-terminal-col--type"}),c.jsx("col",{className:"web-trading-widget-terminal-col--volume"}),c.jsx("col",{className:"web-trading-widget-terminal-col--price"}),c.jsx("col",{className:"web-trading-widget-terminal-col--sl"}),c.jsx("col",{className:"web-trading-widget-terminal-col--tp"}),c.jsx("col",{className:"web-trading-widget-terminal-col--price2"}),c.jsx("col",{className:"web-trading-widget-terminal-col--swap"}),c.jsx("col",{className:"web-trading-widget-terminal-col--profit"}),c.jsx("col",{}),c.jsx("col",{className:"web-trading-widget-terminal-col--close"})]})}function Y0(){return c.jsx("thead",{children:c.jsxs("tr",{className:"web-trading-widget-terminal__head-row",children:[c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Symbol"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Ticket"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Server time"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Type"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Volume"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Price"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"S / L"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"T / P"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Price"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Swap"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Profit"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Comment"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--close","aria-label":"Close"})]})})}function Q0({balance:e,equity:t,margin:n,marginFree:r,marginLevel:s,totalPnL:i,scrollRef:o,onScroll:a}){const l=i>0?"web-trading-widget-text-profit-positive":i<0?"web-trading-widget-text-profit-negative":"";return c.jsx("div",{className:"web-trading-widget-terminal__stats",children:c.jsx("div",{ref:o,className:"web-trading-widget-terminal__header-scroll",onScroll:a,children:c.jsxs("table",{className:"web-trading-widget-terminal__table",children:[c.jsx(da,{}),c.jsx("tbody",{children:c.jsxs("tr",{children:[c.jsx("td",{colSpan:10,className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--nowrap",children:c.jsxs("div",{className:"web-trading-widget-terminal__stats-row web-trading-widget-terminal__stats-row--tabular",children:[c.jsxs("span",{children:["Balance: ",Zt(e)]}),c.jsxs("span",{children:["Equity: ",Zt(t)]}),c.jsxs("span",{children:["Margin: ",Zt(n)]}),c.jsxs("span",{children:["Free margin: ",Zt(r)]}),c.jsxs("span",{children:["Level: ",s!==void 0?`${Zt(s,2)}%`:"0.00%"]})]})}),c.jsx("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right ${l}`,children:Zt(i)}),c.jsx("td",{className:"web-trading-widget-terminal__cell"}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--close"})]})})]})})})}const X0=[{id:"trade",label:"Trade"},{id:"history",label:"History"}];function J0({activeTab:e,onTabChange:t,positionCount:n,isClosingAll:r,onCloseAllPositions:s,isRefetchingDeals:i,onRefetchDeals:o}){const a=e==="trade"&&(n>0||r),l=e==="history";return c.jsxs("div",{role:"tablist","aria-label":"Terminal panel tabs",className:"web-trading-widget-terminal__tab-bar",children:[X0.map(d=>{const f=e===d.id;return c.jsx("button",{type:"button",role:"tab","aria-selected":f,onClick:()=>t(d.id),className:`web-trading-widget-terminal__tab-btn${f?" web-trading-widget-terminal__tab-btn--active":""}`,children:d.label},d.id)}),c.jsxs("div",{className:"web-trading-widget-terminal__toolbar-actions",children:[a?c.jsx("button",{type:"button",disabled:r,onClick:s,className:"web-trading-widget-terminal__close-all-btn",children:r?"Closing…":"Close all"}):null,l?c.jsxs("button",{type:"button",disabled:i,onClick:o,className:"web-trading-widget-terminal__refetch-btn","aria-label":"Refresh deal history",children:[c.jsx(Vv,{className:`web-trading-widget-icon web-trading-widget-icon--sm${i?" web-trading-widget-terminal__refetch-icon--spinning":""}`}),i?"Refreshing…":"Refresh"]}):null]})]})}function eC({position:e,isSelected:t,isClosing:n,onSelect:r,onClose:s}){const i=e.type==="buy"?"web-trading-widget-text-buy":"web-trading-widget-text-sell",o=e.profit>0?"web-trading-widget-text-profit-positive":e.profit<0?"web-trading-widget-text-profit-negative":"";return c.jsxs("tr",{className:`web-trading-widget-terminal__row${t?" web-trading-widget-terminal__row--selected":""}`,onClick:r,children:[c.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.displaySymbol}),c.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.ticket}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--nowrap",children:e.time}),c.jsx("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--capitalize ${i}`,children:e.type}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.volumeLots.toFixed(2)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:xe(e.openPrice,e.digits)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.stopLoss!==void 0&&e.stopLoss!==0?xe(e.stopLoss,e.digits):"N/A"}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.takeProfit!==void 0&&e.takeProfit!==0?xe(e.takeProfit,e.digits):"N/A"}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:xe(e.currentPrice,e.digits)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.swap!==0?Zt(e.swap):""}),c.jsx("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right ${o}`,children:Zt(e.profit)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--truncate",children:e.comment}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--close",children:c.jsx("button",{type:"button","aria-label":`Close position #${e.ticket}`,title:"Close position",disabled:n,className:"web-trading-widget-terminal__row-close-btn",onClick:a=>{a.stopPropagation(),s()},children:c.jsx(gn,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})})]})}function tC({order:e,isSelected:t,isDeleting:n,onSelect:r,onDelete:s}){const i=e.side==="buy"?"web-trading-widget-text-buy":"web-trading-widget-text-sell";return c.jsxs("tr",{className:`web-trading-widget-terminal__row${t?" web-trading-widget-terminal__row--selected":""}`,onClick:r,children:[c.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.displaySymbol}),c.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.ticket}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--nowrap",children:e.time}),c.jsx("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--capitalize ${i}`,children:e.typeLabel}),c.jsxs("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:[e.volumeLots.toFixed(2)," / ",e.volumeFilledLots.toFixed(2)]}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:xe(e.orderPrice,e.digits)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.stopLoss!==void 0&&e.stopLoss!==0?xe(e.stopLoss,e.digits):"N/A"}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.takeProfit!==void 0&&e.takeProfit!==0?xe(e.takeProfit,e.digits):"N/A"}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:xe(e.currentPrice,e.digits)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right"}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right"}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--truncate",children:e.comment}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--close",children:c.jsx("button",{type:"button","aria-label":`Delete order #${e.ticket}`,title:"Delete order",disabled:n,className:"web-trading-widget-terminal__row-close-btn",onClick:o=>{o.stopPropagation(),s()},children:c.jsx(gn,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})})]})}function fp({embedded:e=!1,symbolTicker:t="",onSymbolChange:n,onCreateNewOrder:r,dealDetailUrl:s}){const[i,o]=C.useState("trade"),a=ys(),{accounts:l,isLoading:d}=ap(),f=$0(),{height:u,isResizing:g,onResizeStart:p}=e?{height:0,isResizing:!1,onResizeStart:()=>{}}:f,y=pe(B=>B.selectedLogin),m=pe(B=>B.selectedPositionTicket),h=pe(B=>B.selectedOrderTicket),b=pe(B=>B.setSelectedPositionTicket),v=pe(B=>B.setSelectedOrderTicket),{isLoading:_}=lp(y),x=pe(B=>B.positions),S=pe(B=>B.orders),{closePosition:T,closeAllPositions:P,deleteOrder:A,isClosingAll:D,isRowBusy:I}=G0(),N=m0(),L=dt(),H=HS({predicate:B=>{const ve=B.queryKey;return y?(ve[0]===hs||ve[0]===gs)&&ve[1]===L.baseUrl&&ve[2]===y:!1}})>0,R=d||_,F=C.useMemo(()=>y?x.filter(B=>B.login===y):x,[x,y]),M=C.useMemo(()=>y?S.filter(B=>B.login===y):S,[S,y]),$=C.useMemo(()=>{const B=l.find(ve=>ve.login===y);return(B==null?void 0:B.tradeStat)??null},[l,y]),O=C.useMemo(()=>F.map(B=>B.ticket).sort().join("|"),[F]),U=C.useMemo(()=>$?`${$.balance}:${$.credit??0}:${$.equity}:${$.margin}|${O}`:"",[$,O]),W=C.useMemo(()=>{if(!$||F.length===0)return 0;const B=up(F);return $.equity-$.balance-($.credit??0)-B},[U]),j=C.useMemo(()=>Z0($,F,W),[$,F,W]),ee=F.length===0&&M.length===0,J=C.useRef(null),de=C.useRef(null),ue=C.useRef(null),V=C.useCallback(()=>{P(F)},[P,F]),K=C.useCallback(()=>{y&&N(y)},[N,y]),se=C.useCallback(B=>{const ve=ew(B,a);ve&&(n==null||n(ve))},[n,a]),Ee=C.useCallback(B=>{b(B.ticket),se(B.symbol)},[b,se]),le=C.useCallback(B=>{v(B.ticket),se(B.symbol)},[v,se]),oe=C.useCallback(B=>{const ve=J.current,ke=de.current,Pe=ue.current;if(!ve||!ke)return;const X=B==="header"?ve.scrollLeft:B==="body"?ke.scrollLeft:(Pe==null?void 0:Pe.scrollLeft)??0;B!=="header"&&(ve.scrollLeft=X),B!=="body"&&(ke.scrollLeft=X),Pe&&B!=="footer"&&(Pe.scrollLeft=X)},[]);return c.jsxs(c.Fragment,{children:[!e&&g?c.jsx("div",{className:"web-trading-widget-terminal-resize-overlay","aria-hidden":!0}):null,c.jsxs("div",{className:`web-trading-widget-terminal${e?" web-trading-widget-terminal--embedded":""}`,style:e?void 0:{height:u},children:[e?null:c.jsx("div",{className:"web-trading-widget-terminal__resize-bar-wrap",children:c.jsx("div",{role:"separator","aria-orientation":"horizontal","aria-label":"Resize terminal panel","aria-valuenow":u,className:"web-trading-widget-terminal__resize-bar",onMouseDown:B=>{B.preventDefault(),p(B.clientY)},children:c.jsx(Gf,{className:"web-trading-widget-icon web-trading-widget-icon--sm web-trading-widget-terminal__resize-icon"})})}),c.jsx(J0,{activeTab:i,onTabChange:o,positionCount:F.length,isClosingAll:D,onCloseAllPositions:V,isRefetchingDeals:H,onRefetchDeals:K}),i==="trade"?c.jsxs(c.Fragment,{children:[c.jsx("div",{ref:J,className:"web-trading-widget-terminal__header-scroll",onScroll:()=>oe("header"),children:c.jsxs("table",{className:"web-trading-widget-terminal__table",children:[c.jsx(da,{}),c.jsx(Y0,{})]})}),c.jsx("div",{ref:de,className:"web-trading-widget-terminal__body-scroll",onScroll:()=>oe("body"),children:c.jsxs("table",{className:"web-trading-widget-terminal__table",children:[c.jsx(da,{}),c.jsxs("tbody",{children:[R&&ee?c.jsx("tr",{children:c.jsx("td",{colSpan:13,className:"web-trading-widget-terminal__empty-cell",children:"Loading…"})}):null,!R&&ee?c.jsx("tr",{children:c.jsx("td",{colSpan:13,className:"web-trading-widget-terminal__empty-cell",children:c.jsxs("div",{className:"web-trading-widget-terminal__empty-inner",children:[c.jsx("p",{className:"web-trading-widget-terminal__empty-text",children:"You don't have any positions"}),r?c.jsx("button",{type:"button",onClick:r,className:"web-trading-widget-terminal__create-btn",children:"Create New Order"}):null]})})}):null,F.map(B=>c.jsx(eC,{position:B,isSelected:m===B.ticket,isClosing:I(`position-${B.ticket}`),onSelect:()=>Ee(B),onClose:()=>void T(B)},`position-${B.ticket}`)),M.map(B=>c.jsx(tC,{order:B,isSelected:h===B.ticket,isDeleting:I(`order-${B.ticket}`),onSelect:()=>le(B),onDelete:()=>void A(B)},`order-${B.ticket}`))]})]})})]}):c.jsx(U0,{login:y??"",detailUrl:s}),c.jsx(Q0,{balance:j.balance,equity:j.equity,margin:j.margin,marginFree:j.marginFree,marginLevel:j.marginLevel,totalPnL:j.totalProfit,scrollRef:i==="trade"?ue:void 0,onScroll:i==="trade"?()=>oe("footer"):void 0})]})]})}const ua=224,pi=120;function nC(e){var n;const t=(n=e==null?void 0:e.current)==null?void 0:n.clientHeight;return t&&t>0?Math.max(pi,Math.floor(t*.35)):ua}function rC(e){var n;const t=(n=e==null?void 0:e.current)==null?void 0:n.clientHeight;return t&&t>0?Math.max(pi,Math.floor(t*.85)):typeof window>"u"?560:Math.max(pi,Math.floor(window.innerHeight*.7))}function sC(e,t){return Math.min(rC(t),Math.max(pi,e))}function iC({containerRef:e,isOpen:t=!1}={}){const[n,r]=C.useState(ua),[s,i]=C.useState(!1),o=C.useRef(ua);C.useEffect(()=>{o.current=n},[n]);const a=C.useCallback(d=>{r(sC(d,e))},[e]);C.useEffect(()=>{if(!t)return;const d=Math.max(o.current,nC(e));a(d)},[e,t,a]);const l=C.useCallback(d=>{const f=d,u=o.current;i(!0);const g=y=>{const m=f-y.clientY;a(u+m)},p=()=>{i(!1),document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",p),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",g),document.addEventListener("mouseup",p),document.body.style.cursor="row-resize",document.body.style.userSelect="none"},[a]);return C.useEffect(()=>{const d=()=>{a(o.current)};return window.addEventListener("resize",d),()=>{window.removeEventListener("resize",d),document.body.style.cursor="",document.body.style.userSelect=""}},[a]),{height:n,isResizing:s,onResizeStart:l}}function mp({children:e}){const[t]=C.useState(()=>new OS({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}}));return c.jsx(NS,{client:t,children:e})}function pp({containerRef:e,onCreateNewOrder:t}){const[n,r]=C.useState(!1),{height:s,isResizing:i,onResizeStart:o}=iC({containerRef:e,isOpen:n}),a=pe(y=>y.selectedLogin),l=pe(y=>y.orders),d=pe(y=>y.positions),f=C.useMemo(()=>a?l.filter(y=>y.login===a):l,[a,l]),u=C.useMemo(()=>a?d.filter(y=>y.login===a):d,[a,d]),g=f.length+u.length,p=()=>{r(!1),t==null||t()};return c.jsxs("div",{className:"web-trading-widget-news-orders-overlay-root",children:[c.jsxs("button",{type:"button",className:"web-trading-widget-news-orders-overlay__trigger","aria-label":"Open terminal","aria-expanded":n,onClick:()=>r(!0),children:[c.jsx(Fv,{className:"web-trading-widget-icon web-trading-widget-icon--sm"}),c.jsx("span",{children:"Orders"}),g>0?c.jsx("span",{className:"web-trading-widget-news-orders-overlay__badge",children:g}):null]}),n?c.jsx(c.Fragment,{children:c.jsxs("div",{className:"web-trading-widget-news-orders__panel",style:{height:s},children:[i?c.jsx("div",{className:"web-trading-widget-terminal-resize-overlay","aria-hidden":!0}):null,c.jsx("div",{className:"web-trading-widget-news-orders__panel-resize-bar-wrap",children:c.jsx("div",{role:"separator","aria-orientation":"horizontal","aria-label":"Resize terminal panel","aria-valuenow":s,className:"web-trading-widget-terminal__resize-bar",onMouseDown:y=>{y.preventDefault(),o(y.clientY)},children:c.jsx(Gf,{className:"web-trading-widget-icon web-trading-widget-icon--sm web-trading-widget-terminal__resize-icon"})})}),c.jsxs("div",{className:"web-trading-widget-news-orders__panel-header",children:[c.jsx("h2",{className:"web-trading-widget-news-orders__panel-title",children:"Terminal"}),c.jsx("button",{type:"button",className:"web-trading-widget-news-orders__panel-close","aria-label":"Close terminal panel",onClick:()=>r(!1),children:c.jsx(gn,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})]}),c.jsx("div",{className:"web-trading-widget-news-orders__panel-body",children:c.jsx(fp,{embedded:!0,onCreateNewOrder:t?p:void 0})})]})}):null]})}function oC({baseUrl:e,containerRef:t,onCreateNewOrder:n}){return c.jsx(mp,{children:c.jsx(Im,{baseUrl:e,children:c.jsx(pp,{containerRef:t,onCreateNewOrder:n})})})}const Rn=C.forwardRef(({className:e,type:t,...n},r)=>c.jsx("input",{type:t,className:Te("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-xs placeholder:text-gray-300 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 dark:border-gray-3",e),ref:r,...n}));Rn.displayName="Input";var Gi="Collapsible",[aC,hp]=Bn(Gi),[cC,Oc]=aC(Gi),gp=w.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:s,disabled:i,onOpenChange:o,...a}=e,[l,d]=Ln({prop:r,defaultProp:s??!1,onChange:o,caller:Gi});return c.jsx(cC,{scope:n,disabled:i,contentId:on(),open:l,onOpenToggle:w.useCallback(()=>d(f=>!f),[d]),children:c.jsx(he.div,{"data-state":Rc(l),"data-disabled":i?"":void 0,...a,ref:t})})});gp.displayName=Gi;var yp="CollapsibleTrigger",bp=w.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,s=Oc(yp,n);return c.jsx(he.button,{type:"button","aria-controls":s.open?s.contentId:void 0,"aria-expanded":s.open||!1,"data-state":Rc(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:t,onClick:me(e.onClick,s.onOpenToggle)})});bp.displayName=yp;var Nc="CollapsibleContent",vp=w.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=Oc(Nc,e.__scopeCollapsible);return c.jsx($n,{present:n||s.open,children:({present:i})=>c.jsx(lC,{...r,ref:t,present:i})})});vp.displayName=Nc;var lC=w.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:s,...i}=e,o=Oc(Nc,n),[a,l]=w.useState(r),d=w.useRef(null),f=Oe(t,d),u=w.useRef(0),g=u.current,p=w.useRef(0),y=p.current,m=o.open||a,h=w.useRef(m),b=w.useRef(void 0);return w.useEffect(()=>{const v=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(v)},[]),Ie(()=>{const v=d.current;if(v){b.current=b.current||{transitionDuration:v.style.transitionDuration,animationName:v.style.animationName},v.style.transitionDuration="0s",v.style.animationName="none";const _=v.getBoundingClientRect();u.current=_.height,p.current=_.width,h.current||(v.style.transitionDuration=b.current.transitionDuration,v.style.animationName=b.current.animationName),l(r)}},[o.open,r]),c.jsx(he.div,{"data-state":Rc(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!m,...i,ref:f,style:{"--radix-collapsible-content-height":g?`${g}px`:void 0,"--radix-collapsible-content-width":y?`${y}px`:void 0,...e.style},children:m&&s})});function Rc(e){return e?"open":"closed"}var dC=gp,uC=bp,fC=vp,xt="Accordion",mC=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[Lc,pC,hC]=Fa(xt),[Zi]=Bn(xt,[hC,hp]),Dc=hp(),wp=w.forwardRef((e,t)=>{const{type:n,...r}=e,s=r,i=r;return c.jsx(Lc.Provider,{scope:e.__scopeAccordion,children:n==="multiple"?c.jsx(vC,{...i,ref:t}):c.jsx(bC,{...s,ref:t})})});wp.displayName=xt;var[_p,gC]=Zi(xt),[xp,yC]=Zi(xt,{collapsible:!1}),bC=w.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},collapsible:i=!1,...o}=e,[a,l]=Ln({prop:n,defaultProp:r??"",onChange:s,caller:xt});return c.jsx(_p,{scope:e.__scopeAccordion,value:w.useMemo(()=>a?[a]:[],[a]),onItemOpen:l,onItemClose:w.useCallback(()=>i&&l(""),[i,l]),children:c.jsx(xp,{scope:e.__scopeAccordion,collapsible:i,children:c.jsx(Sp,{...o,ref:t})})})}),vC=w.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},...i}=e,[o,a]=Ln({prop:n,defaultProp:r??[],onChange:s,caller:xt}),l=w.useCallback(f=>a((u=[])=>[...u,f]),[a]),d=w.useCallback(f=>a((u=[])=>u.filter(g=>g!==f)),[a]);return c.jsx(_p,{scope:e.__scopeAccordion,value:o,onItemOpen:l,onItemClose:d,children:c.jsx(xp,{scope:e.__scopeAccordion,collapsible:!0,children:c.jsx(Sp,{...i,ref:t})})})}),[wC,Yi]=Zi(xt),Sp=w.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:r,dir:s,orientation:i="vertical",...o}=e,a=w.useRef(null),l=Oe(a,t),d=pC(n),u=Yu(s)==="ltr",g=me(e.onKeyDown,p=>{var A;if(!mC.includes(p.key))return;const y=p.target,m=d().filter(D=>{var I;return!((I=D.ref.current)!=null&&I.disabled)}),h=m.findIndex(D=>D.ref.current===y),b=m.length;if(h===-1)return;p.preventDefault();let v=h;const _=0,x=b-1,S=()=>{v=h+1,v>x&&(v=_)},T=()=>{v=h-1,v<_&&(v=x)};switch(p.key){case"Home":v=_;break;case"End":v=x;break;case"ArrowRight":i==="horizontal"&&(u?S():T());break;case"ArrowDown":i==="vertical"&&S();break;case"ArrowLeft":i==="horizontal"&&(u?T():S());break;case"ArrowUp":i==="vertical"&&T();break}const P=v%b;(A=m[P].ref.current)==null||A.focus()});return c.jsx(wC,{scope:n,disabled:r,direction:s,orientation:i,children:c.jsx(Lc.Slot,{scope:n,children:c.jsx(he.div,{...o,"data-orientation":i,ref:l,onKeyDown:r?void 0:g})})})}),hi="AccordionItem",[_C,jc]=Zi(hi),Cp=w.forwardRef((e,t)=>{const{__scopeAccordion:n,value:r,...s}=e,i=Yi(hi,n),o=gC(hi,n),a=Dc(n),l=on(),d=r&&o.value.includes(r)||!1,f=i.disabled||e.disabled;return c.jsx(_C,{scope:n,open:d,disabled:f,triggerId:l,children:c.jsx(dC,{"data-orientation":i.orientation,"data-state":Op(d),...a,...s,ref:t,disabled:f,open:d,onOpenChange:u=>{u?o.onItemOpen(r):o.onItemClose(r)}})})});Cp.displayName=hi;var Tp="AccordionHeader",Ep=w.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=Yi(xt,n),i=jc(Tp,n);return c.jsx(he.h3,{"data-orientation":s.orientation,"data-state":Op(i.open),"data-disabled":i.disabled?"":void 0,...r,ref:t})});Ep.displayName=Tp;var fa="AccordionTrigger",Pp=w.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=Yi(xt,n),i=jc(fa,n),o=yC(fa,n),a=Dc(n);return c.jsx(Lc.ItemSlot,{scope:n,children:c.jsx(uC,{"aria-disabled":i.open&&!o.collapsible||void 0,"data-orientation":s.orientation,id:i.triggerId,...a,...r,ref:t})})});Pp.displayName=fa;var kp="AccordionContent",Ap=w.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=Yi(xt,n),i=jc(kp,n),o=Dc(n);return c.jsx(fC,{role:"region","aria-labelledby":i.triggerId,"data-orientation":s.orientation,...o,...r,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});Ap.displayName=kp;function Op(e){return e?"open":"closed"}var xC=wp,SC=Cp,CC=Ep,Np=Pp,Rp=Ap;const TC=xC,qn=w.forwardRef(({className:e,...t},n)=>c.jsx(SC,{ref:n,className:Te("border-b",e),...t}));qn.displayName="AccordionItem";const Gn=w.forwardRef(({className:e,children:t,...n},r)=>c.jsx(CC,{className:"flex",children:c.jsxs(Np,{ref:r,className:Te("flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...n,children:[t,c.jsx(rc,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"})]})}));Gn.displayName=Np.displayName;const Zn=w.forwardRef(({className:e,children:t,...n},r)=>c.jsx(Rp,{ref:r,className:"overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...n,children:c.jsx("div",{className:Te("pb-4 pt-0",e),children:t})}));Zn.displayName=Rp.displayName;function Cd(e){const t=e.trim().replace(/,/g,"");if(!t||t===".")return null;const n=Number(t);return Number.isFinite(n)?n:null}function Td(e,t){return t<=0?String(Math.round(e)):e.toFixed(t)}function EC(e,t){const n=e.replace(/,/g,"").replace(/[^\d.]/g,""),r=n.indexOf(".");if(r===-1)return n;const s=n.slice(0,r),i=n.slice(r+1).replace(/\./g,""),o=t>0?i.slice(0,t):"";return`${s}.${o}`}function PC(e){const t=e.trim();return!t||t==="."?"":t.endsWith(".")?t.slice(0,-1):t}function De({label:e,value:t,onChange:n,step:r=.01,min:s,decimals:i=2,placeholder:o,basePrice:a,disabled:l=!1,clearable:d=!1}){const[f,u]=C.useState(t),[g,p]=C.useState(!1),y=g?f:t,m=y.trim()!=="",h=!d;C.useEffect(()=>{g||u(t)},[g,t]);const b=()=>a!=null&&Number.isFinite(a)?a:s??0,v=A=>{u(A),n(A)},_=A=>{if(l)return;const D=b(),I=Cd(y),N=y.trim()!=="";let L;!N||I===null?L=A===1?D:D-r:L=I+A*r;const H=s!==void 0?Math.max(s,L):L;if(H<=0)return;const R=Td(H,i);p(!1),v(R)},x=()=>{p(!0),u(t)},S=()=>{p(!1);const A=PC(f);if(!A){f.trim()!==""&&v("");return}const D=Cd(A);if(D===null||D<=0){v("");return}if(h){v(Td(D,i));return}v(A)},T=A=>{u(EC(A,i))},P=()=>{l||(p(!1),v(""))};return c.jsxs("div",{className:"web-trading-widget-stepper",children:[c.jsxs("div",{className:"web-trading-widget-stepper__header",children:[c.jsx("span",{className:"web-trading-widget-stepper__label",children:e}),d&&m?c.jsx("button",{type:"button","aria-label":`Clear ${e}`,className:"web-trading-widget-stepper__clear",disabled:l,onClick:P,children:c.jsx(gn,{className:"web-trading-widget-icon web-trading-widget-icon--xs"})}):null]}),c.jsxs("div",{className:`web-trading-widget-stepper__control${l?" web-trading-widget-stepper__control--disabled":""}`,children:[c.jsx("button",{type:"button","aria-label":`Decrease ${e}`,className:"web-trading-widget-stepper__btn web-trading-widget-stepper__btn--minus",disabled:l||a===null&&y.trim()==="",onClick:()=>_(-1),children:c.jsx(Bv,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})}),c.jsx("input",{type:"text",inputMode:"decimal",pattern:"[0-9]*[.]?[0-9]*",value:y,placeholder:o,disabled:l,onFocus:x,onChange:A=>T(A.target.value),onBlur:S,className:"web-trading-widget-stepper__input"}),c.jsx("button",{type:"button","aria-label":`Increase ${e}`,className:"web-trading-widget-stepper__btn web-trading-widget-stepper__btn--plus",disabled:l||a===null&&y.trim()==="",onClick:()=>_(1),children:c.jsx($v,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})]})]})}function kC({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,embedded:d=!1,onMinimize:f,onClose:u,onPlaceOrder:g}){const[p,y]=C.useState("market"),[m,h]=C.useState(String(r)),[b,v]=C.useState(""),[_,x]=C.useState(""),S=ie(re=>re.stopLoss),T=ie(re=>re.takeProfit),P=ie(re=>re.setStopLoss),A=ie(re=>re.setTakeProfit),D=ie(re=>re.setVolumeLots),I=ie(re=>re.setOrderSide),[N,L]=C.useState(""),[H,R]=C.useState(gt.GTC),[F,M]=C.useState(""),[$,O]=C.useState(""),U=Number(Vt(Ht(e))),W=Pr(U),j=fc(t,n),ee=t!==null?xe(t,U):"—",J=n!==null?xe(n,U):"—",de=Fi(p),ue=Qf(p),V=Mi(p),K=V.label,se=!de&&V.orderType!==null&&V.orderType%2===1,Ee=C.useMemo(()=>j!==null?j:t??n,[n,t,j]),le=re=>{h(re);const Ve=Number(re);Number.isFinite(Ve)&&Ve>0&&D(Ve)},oe=re=>t===null||n===null?null:de?re==="buy"?n:t:Ue(b)??(re==="buy"?n:t),B=re=>{const Ve=oe(re);Ve!==null&&I({side:re,entryPrice:Ve})},ve=re=>{if(t===null||n===null||!l)return;const Ve=Math.max(i,Number(m)||i),Ji=Vo(p,re),vs=oe(re);vs!==null&&I({side:re,entryPrice:vs}),g({login:l,executionMode:p,side:re,orderType:Ji,volumeLots:Ve,stopLoss:S,takeProfit:T,priceOrder:b,priceTrigger:_,comment:N,typeTime:H,expirationDateTime:F,expirationDay:$,bid:t,ask:n})},ke=t!==null&&n!==null,Pe=de||Ue(b)!==void 0,X=!ue||Ue(_)!==void 0,Ne=de||Bi(H,F,$),Be=!o&&!a&&l!==""&&ke&&Pe&&X&&Ne,Xe=!de&&lc(H),ft=!de&&dc(H);return c.jsxs("div",{className:"web-trading-widget-market-panel",children:[c.jsxs("div",{className:"web-trading-widget-market-panel__header",children:[c.jsxs(si,{value:p,onValueChange:re=>y(re),children:[c.jsx(Kr,{className:"web-trading-widget-market-panel__select-trigger",children:c.jsx(ii,{})}),c.jsx(qr,{children:ai.map(re=>c.jsx(Gr,{value:re.mode,children:re.label},re.mode))})]}),d?null:c.jsxs("div",{className:"web-trading-widget-market-panel__header-actions",children:[c.jsx("button",{type:"button","aria-label":"Minimize to quick order panel",className:"web-trading-widget-market-panel__header-btn",onClick:f,children:c.jsx(Uv,{className:"web-trading-widget-icon web-trading-widget-icon--md"})}),c.jsx("button",{type:"button","aria-label":"Close order panel",className:"web-trading-widget-market-panel__header-btn",onClick:u,children:c.jsx(gn,{className:"web-trading-widget-icon web-trading-widget-icon--md"})})]})]}),c.jsxs(TC,{type:"multiple",defaultValue:["volume-setting","risk-management"],className:"web-trading-widget-market-panel__accordion",children:[c.jsxs(qn,{value:"volume-setting",className:"web-trading-widget-market-panel__accordion-item",children:[c.jsx(Gn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Volume Setting"}),c.jsx(Zn,{className:"web-trading-widget-market-panel__accordion-content",children:c.jsx(De,{label:"Lots",value:m,onChange:le,step:s,min:i,decimals:2})})]}),de?null:c.jsxs(qn,{value:"order-price",className:"web-trading-widget-market-panel__accordion-item",children:[c.jsx(Gn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Order Price"}),c.jsx(Zn,{className:"web-trading-widget-market-panel__accordion-content",children:ue?c.jsxs(c.Fragment,{children:[c.jsx(De,{label:"Stop Price",value:_,onChange:x,step:W,decimals:U,basePrice:Ee,placeholder:j!==null?xe(j,U):"—"}),c.jsx(De,{label:"Limit Price",value:b,onChange:v,step:W,decimals:U,basePrice:Ee,placeholder:j!==null?xe(j,U):"—"})]}):c.jsx(De,{label:"Price",value:b,onChange:v,step:W,decimals:U,basePrice:Ee,placeholder:j!==null?xe(j,U):"—"})})]}),c.jsxs(qn,{value:"risk-management",className:"web-trading-widget-market-panel__accordion-item",children:[c.jsx(Gn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Risk Management"}),c.jsx(Zn,{className:"web-trading-widget-market-panel__accordion-content",children:c.jsxs("div",{className:"web-trading-widget-market-panel__grid-2",children:[c.jsx(De,{label:"Stop Loss",value:S,onChange:P,step:W,decimals:U,basePrice:t,placeholder:t!==null?ee:"—",clearable:!0}),c.jsx(De,{label:"Take Profit",value:T,onChange:A,step:W,decimals:U,basePrice:n,placeholder:n!==null?J:"—",clearable:!0})]})})]}),de?null:c.jsxs(qn,{value:"expiration",className:"web-trading-widget-market-panel__accordion-item",children:[c.jsx(Gn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Expiration"}),c.jsxs(Zn,{className:"web-trading-widget-market-panel__accordion-content",children:[c.jsxs(si,{value:String(H),onValueChange:re=>R(Number(re)),children:[c.jsx(Kr,{className:"web-trading-widget-market-panel__select-full",children:c.jsx(ii,{})}),c.jsx(qr,{children:Xf.map(re=>c.jsx(Gr,{value:String(re.value),children:re.label},re.value))})]}),Xe?c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Expiration time"}),c.jsx(Rn,{type:"datetime-local",value:F,onChange:re=>M(re.target.value)})]}):null,ft?c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Expiration day"}),c.jsx(Rn,{type:"date",value:$,onChange:re=>O(re.target.value)})]}):null]})]}),c.jsxs(qn,{value:"comment",className:"web-trading-widget-market-panel__accordion-item",children:[c.jsx(Gn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Comment"}),c.jsx(Zn,{className:"web-trading-widget-market-panel__accordion-content",children:c.jsx(Rn,{value:N,onChange:re=>L(re.target.value),placeholder:""})})]})]}),c.jsxs("div",{className:"web-trading-widget-market-panel__footer",children:[c.jsxs("div",{className:"web-trading-widget-market-panel__quotes",children:[c.jsx("span",{children:ee}),c.jsx("span",{className:"web-trading-widget-market-panel__quotes-ask",children:J})]}),de?c.jsxs("div",{className:"web-trading-widget-market-panel__actions",children:[c.jsx(ct,{type:"button",variant:"destructive",className:"web-trading-widget-market-panel__sell-btn",disabled:!Be,onMouseDown:()=>B("sell"),onClick:()=>ve("sell"),children:"Sell by Market"}),c.jsx(ct,{type:"button",className:"web-trading-widget-market-panel__buy-btn",disabled:!Be,onMouseDown:()=>B("buy"),onClick:()=>ve("buy"),children:"Buy by Market"})]}):c.jsxs(ct,{type:"button",variant:se?"destructive":"default",className:`web-trading-widget-market-panel__place-btn${se?"":" web-trading-widget-market-panel__place-btn--buy"}`,disabled:!Be,onMouseDown:()=>{const re=V.orderType!==null&&V.orderType%2===1?"sell":"buy";B(re)},onClick:()=>{const re=V.orderType!==null&&V.orderType%2===1?"sell":"buy";ve(re)},children:["Place ",K]})]})]})}function Lp({confirmation:e,symbolTicker:t,onDismiss:n}){const r=Number(Vt(Ht(t))),s=xe(e.price,r),i=e.side==="sell"?"sell":"buy",o=Ii(e.symbol||Ui(t));return c.jsxs("div",{className:"web-trading-widget-confirmation",children:[c.jsx("div",{className:"web-trading-widget-confirmation__close-row",children:c.jsx("button",{type:"button","aria-label":"Close confirmation",className:"web-trading-widget-confirmation__close-btn",onClick:n,children:c.jsx(gn,{className:"web-trading-widget-icon web-trading-widget-icon--md"})})}),c.jsxs("div",{className:"web-trading-widget-confirmation__body",children:[c.jsxs("p",{className:"web-trading-widget-confirmation__summary",children:[c.jsxs("span",{className:"web-trading-widget-confirmation__ticket",children:["#",e.ticket]})," ",c.jsx("span",{className:`web-trading-widget-confirmation__side web-trading-widget-confirmation__side--${e.side}`,children:i})," ",e.volumeLots.toFixed(2)," ",o]}),c.jsxs("p",{className:"web-trading-widget-confirmation__price",children:["at ",s]}),c.jsx("p",{className:"web-trading-widget-confirmation__status",children:"Placed"}),c.jsx(ct,{type:"button",className:"web-trading-widget-confirmation__ok-btn",onClick:n,children:"OK"})]})]})}function Is(e,t){return e.toLocaleString(void 0,{minimumFractionDigits:t,maximumFractionDigits:t})}function $r(e){if(!(e===void 0||e===0))return e}function Ed(e,t){return e===void 0||e===0?"":xe(e,t)}function Pd(e,t){const n=Ue(e);if(n!==void 0)return n;if($r(t)!==void 0)return 0}function Dp({order:e,onClose:t}){const{deleteOrder:n,modifyOrder:r}=qi(),s=pe(V=>V.removeOrder),i=pe(V=>V.liveQuotes),[o,a]=C.useState(String(e.volumeLots)),[l,d]=C.useState(String(e.orderPrice)),[f,u]=C.useState(e.priceTrigger!==void 0?String(e.priceTrigger):""),g=ie(V=>V.stopLoss),p=ie(V=>V.takeProfit),y=ie(V=>V.setStopLoss),m=ie(V=>V.setTakeProfit),h=ie(V=>V.setDraft),b=ie(V=>V.clearDraft),[v,_]=C.useState(e.comment),[x,S]=C.useState(!1),[T,P]=C.useState(!1),A=Pr(e.digits),D=Ke(e.symbol).toUpperCase(),I=i[D],N=(I==null?void 0:I.bid)??e.marketBid??null,L=(I==null?void 0:I.ask)??e.marketAsk??null,H=N!==null?xe(N,e.digits):"—",R=L!==null?xe(L,e.digits):"—",F=C.useMemo(()=>e.orderPrice>0?e.orderPrice:fc(N,L)??N??L,[L,N,e.orderPrice]);C.useEffect(()=>(h({source:"order",entryPrice:e.orderPrice,stopLoss:Ed(e.stopLoss,e.digits),takeProfit:Ed(e.takeProfit,e.digits),side:e.side,showEntryLine:!0,volumeLots:e.volumeLots,digits:e.digits,priceStep:A}),()=>{b()}),[b,e.digits,e.orderPrice,e.side,e.stopLoss,e.takeProfit,e.volumeLots,A,h]);const M=cc(e.orderType),$=e.volumeLots,O=Number(l)||e.orderPrice,U=Ue(f),W=x||T,ee=(O!==e.orderPrice||(M?U!==e.priceTrigger:!1)||$r(Ue(g))!==$r(e.stopLoss)||$r(Ue(p))!==$r(e.takeProfit)||v.trim()!==e.comment.trim())&&(!M||U!==void 0&&Number.isFinite(O)&&O>0),J=C.useMemo(()=>`Delete #${e.ticket} ${e.typeLabel} ${$.toFixed(2)} ${e.displaySymbol} at ${Is(O,e.digits)}`,[e,O,$]),de=async()=>{if(!ee){Se({variant:"destructive",description:M?"Please set both stop and limit prices.":"Please set an order price."});return}S(!0);try{const V=await r(e,{volumeLots:$,priceOrder:O,priceTrigger:M?U:void 0,stopLoss:Pd(g,e.stopLoss),takeProfit:Pd(p,e.takeProfit),comment:v.trim()||"order modify"});if(!V.success){Se({variant:"destructive",description:V.message||"Failed to modify order."});return}t(),Se({description:`Order #${e.ticket} updated.`})}catch(V){const K=V instanceof Error?V.message:"Failed to modify order.";Se({variant:"destructive",description:K})}finally{S(!1)}},ue=async()=>{P(!0);try{const V=await n(e);if(!V.success){Se({variant:"destructive",description:V.message||"Failed to delete order."});return}s(e.ticket),t(),Se({description:`Order #${e.ticket} deleted.`})}catch(V){const K=V instanceof Error?V.message:"Failed to delete order.";Se({variant:"destructive",description:K})}finally{P(!1)}};return c.jsxs("div",{className:"web-trading-widget-detail-panel",children:[c.jsxs("div",{className:"web-trading-widget-detail-panel__header",children:[c.jsxs("p",{className:`web-trading-widget-detail-panel__title web-trading-widget-detail-panel__title--${e.side}`,children:["#",e.ticket," ",e.typeLabel," ",$.toFixed(2)," / ",e.volumeFilledLots.toFixed(2)," ",e.displaySymbol," ",M&&U!==void 0?`${Is(U,e.digits)} / ${Is(O,e.digits)}`:Is(O,e.digits)]}),c.jsx("button",{type:"button","aria-label":"Close order panel",className:"web-trading-widget-icon-btn",onClick:t,children:c.jsx(gn,{className:"web-trading-widget-icon web-trading-widget-icon--md"})})]}),c.jsxs("div",{className:"web-trading-widget-detail-panel__body",children:[c.jsx(De,{label:"Lots",value:o,onChange:a,step:.01,min:.01,decimals:2,disabled:!0}),M?c.jsxs(c.Fragment,{children:[c.jsx(De,{label:"Stop Price",value:f,onChange:u,step:A,decimals:e.digits,basePrice:F}),c.jsx(De,{label:"Limit Price",value:l,onChange:d,step:A,decimals:e.digits,basePrice:F})]}):c.jsx(De,{label:"Price",value:l,onChange:d,step:A,decimals:e.digits,basePrice:F}),c.jsxs("div",{className:"web-trading-widget-market-panel__grid-2",children:[c.jsx(De,{label:"Stop Loss",value:g,onChange:y,step:A,decimals:e.digits,basePrice:N,placeholder:H,clearable:!0}),c.jsx(De,{label:"Take Profit",value:p,onChange:m,step:A,decimals:e.digits,basePrice:L,placeholder:R,clearable:!0})]}),c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Comment"}),c.jsx(Rn,{value:v,onChange:V=>_(V.target.value)})]}),c.jsx(ct,{type:"button",variant:"secondary",className:"web-trading-widget-detail-panel__btn-full",disabled:W||!ee,onClick:()=>void de(),children:"Modify"}),c.jsx(ct,{type:"button",className:"web-trading-widget-detail-panel__action-btn",disabled:W,onClick:()=>void ue(),children:J})]})]})}function Ms(e,t){return e.toLocaleString(void 0,{minimumFractionDigits:t,maximumFractionDigits:t})}function Vr(e){if(!(e===void 0||e===0))return e}function kd(e,t){return e===void 0||e===0?"":xe(e,t)}function Ad(e,t){const n=Ue(e);if(n!==void 0)return n;if(Vr(t)!==void 0)return 0}function AC(e,t,n){return e.type==="buy"?t??e.marketBid??e.currentPrice:n??e.marketAsk??e.currentPrice}function jp({position:e,onClose:t}){const{closePosition:n,modifyPosition:r}=qi(),s=pe(O=>O.removePosition),i=pe(O=>O.liveQuotes),[o,a]=C.useState(String(e.volumeLots)),l=ie(O=>O.stopLoss),d=ie(O=>O.takeProfit),f=ie(O=>O.setStopLoss),u=ie(O=>O.setTakeProfit),g=ie(O=>O.setDraft),p=ie(O=>O.clearDraft),[y,m]=C.useState(e.comment),[h,b]=C.useState(!1),[v,_]=C.useState(!1),x=Pr(e.digits),S=Ke(e.symbol).toUpperCase(),T=i[S],P=(T==null?void 0:T.bid)??e.marketBid??null,A=(T==null?void 0:T.ask)??e.marketAsk??null,D=P!==null?xe(P,e.digits):"—",I=A!==null?xe(A,e.digits):"—";C.useEffect(()=>(g({source:"position",entryPrice:e.openPrice,stopLoss:kd(e.stopLoss,e.digits),takeProfit:kd(e.takeProfit,e.digits),side:e.type,showEntryLine:!0,volumeLots:e.volumeLots,digits:e.digits,priceStep:x}),()=>{p()}),[p,e.digits,e.openPrice,e.stopLoss,e.takeProfit,e.type,e.volumeLots,x,g]);const N=AC(e,P,A),L=e.volumeLots,H=h||v,R=Vr(Ue(l))!==Vr(e.stopLoss)||Vr(Ue(d))!==Vr(e.takeProfit)||y.trim()!==e.comment.trim(),F=async()=>{if(R){_(!0);try{const O=await r(e,{stopLoss:Ad(l,e.stopLoss),takeProfit:Ad(d,e.takeProfit),comment:y.trim()});if(!O.success){Se({variant:"destructive",description:O.message||"Failed to modify position."});return}t(),Se({description:`Position #${e.ticket} updated.`})}catch(O){const U=O instanceof Error?O.message:"Failed to modify position.";Se({variant:"destructive",description:U})}finally{_(!1)}}},M=C.useMemo(()=>{const O=e.profit.toFixed(2);return`Close #${e.ticket} ${e.type} ${L.toFixed(2)} ${e.displaySymbol} ${Ms(e.openPrice,e.digits)} at ${Ms(N,e.digits)} with Profit ${O}`},[N,e,L]),$=async()=>{b(!0);try{const O=await n(e);if(!O.success){Se({variant:"destructive",description:O.message||"Failed to close position."});return}s(e.ticket),t(),Se({description:`Position #${e.ticket} closed.`})}catch(O){const U=O instanceof Error?O.message:"Failed to close position.";Se({variant:"destructive",description:U})}finally{b(!1)}};return c.jsxs("div",{className:"web-trading-widget-detail-panel",children:[c.jsxs("div",{className:"web-trading-widget-detail-panel__header",children:[c.jsxs("p",{className:"web-trading-widget-detail-panel__title web-trading-widget-detail-panel__title--position",children:["#",e.ticket," ",e.type," ",L.toFixed(2)," ",e.displaySymbol," ",Ms(e.openPrice,e.digits)]}),c.jsx("button",{type:"button","aria-label":"Close position panel",className:"web-trading-widget-icon-btn",onClick:t,children:c.jsx(gn,{className:"web-trading-widget-icon web-trading-widget-icon--md"})})]}),c.jsxs("div",{className:"web-trading-widget-detail-panel__body",children:[c.jsx(De,{label:"Lots",value:o,onChange:a,step:.01,min:.01,decimals:2,disabled:!0}),c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Price"}),c.jsx(Rn,{readOnly:!0,disabled:!0,value:Ms(e.openPrice,e.digits),className:"web-trading-widget-detail-panel__input-muted"})]}),c.jsxs("div",{className:"web-trading-widget-market-panel__grid-2",children:[c.jsx(De,{label:"Stop Loss",value:l,onChange:f,step:x,decimals:e.digits,basePrice:P,placeholder:D,clearable:!0}),c.jsx(De,{label:"Take Profit",value:d,onChange:u,step:x,decimals:e.digits,basePrice:A,placeholder:I,clearable:!0})]}),c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Comment"}),c.jsx(Rn,{value:y,onChange:O=>m(O.target.value)})]}),c.jsx(ct,{type:"button",variant:"secondary",className:"web-trading-widget-detail-panel__btn-full",disabled:H||!R,onClick:()=>void F(),children:"Modify"}),c.jsx(ct,{type:"button",className:"web-trading-widget-detail-panel__action-btn",disabled:H,onClick:()=>void $(),children:M})]})]})}function Od({symbolTicker:e,orderState:t}){const n=_c(e),{confirmation:r,isSubmitting:s,defaultVolumeLots:i,volumeStep:o,minVolumeLots:a,selectedLogin:l,isAccountsLoading:d,hasConfirmedAccount:f,dismissConfirmation:u,placeMarketOrder:g}=t,p=pe(P=>P.positions),y=pe(P=>P.orders),m=pe(P=>P.selectedPositionTicket),h=pe(P=>P.selectedOrderTicket),b=pe(P=>P.setSelectedPositionTicket),v=pe(P=>P.setSelectedOrderTicket),_=m!==null?p.find(P=>P.ticket===m)??null:null,x=h!==null?y.find(P=>P.ticket===h)??null:null,S=r!==null,T=C.useCallback(P=>{g({symbolTicker:e,login:P.login,executionMode:P.executionMode,side:P.side,orderType:P.orderType,volumeLots:P.volumeLots,stopLoss:P.stopLoss,takeProfit:P.takeProfit,priceOrder:P.priceOrder,priceTrigger:P.priceTrigger,comment:P.comment,typeTime:P.typeTime,expirationDateTime:P.expirationDateTime,expirationDay:P.expirationDay,bid:P.bid,ask:P.ask})},[g,e]);return _!==null?c.jsx(jp,{position:_,onClose:()=>b(null)}):x!==null?c.jsx(Dp,{order:x,onClose:()=>v(null)}):S&&r!==null?c.jsx(Lp,{confirmation:r,symbolTicker:e,onDismiss:u}):f?c.jsx(kC,{embedded:!0,symbolTicker:e,bid:(n==null?void 0:n.bid)??null,ask:(n==null?void 0:n.ask)??null,defaultVolumeLots:i,volumeStep:o,minVolumeLots:a,isSubmitting:s,isAccountsLoading:d,selectedLogin:l,onPlaceOrder:T}):c.jsx("div",{className:"web-trading-widget-side-panel__empty",children:"Select a trading account to start placing orders."})}function Nd({label:e,isActive:t,onClick:n}){return c.jsx("button",{type:"button",role:"tab","aria-selected":t,className:`web-trading-widget-side-panel__tab${t?" web-trading-widget-side-panel__tab--active":""}`,onClick:n,children:e})}function OC({symbolTicker:e,orderState:t,scanResultUrl:n,onScanResultLoad:r,initialTab:s="trade",activeTab:i,onTabChange:o}){const a=!!n,[l,d]=C.useState(s),f=i!==void 0,u=f?i:l,g=C.useCallback(p=>{f?o==null||o(p):d(p)},[f,o]);return c.jsx("aside",{className:`web-trading-widget-side-panel${a?" web-trading-widget-side-panel--with-scan":""}`,children:a?c.jsxs("div",{className:"web-trading-widget-side-panel__scan-layout",children:[c.jsxs("div",{role:"tablist","aria-label":"Chart side panel",className:"web-trading-widget-side-panel__tablist",children:[c.jsx(Nd,{label:"Trade",isActive:u==="trade",onClick:()=>g("trade")}),c.jsx(Nd,{label:"Scan Result",isActive:u==="scan",onClick:()=>g("scan")})]}),c.jsxs("div",{className:"web-trading-widget-side-panel__panels",children:[c.jsx("div",{role:"tabpanel",hidden:u!=="trade",className:"web-trading-widget-side-panel__tabpanel",children:c.jsx(Od,{symbolTicker:e,orderState:t})}),c.jsx("div",{role:"tabpanel",hidden:u!=="scan",className:"web-trading-widget-side-panel__tabpanel web-trading-widget-side-panel__tabpanel--scan",children:c.jsx("iframe",{src:n??void 0,title:"Scan result",className:"web-trading-widget-side-panel__iframe",onLoad:r},n)})]})]}):c.jsx("div",{className:"web-trading-widget-side-panel__scroll",children:c.jsx(Od,{symbolTicker:e,orderState:t})})})}const NC=.01,RC=.01,Rd=.01;function LC({symbols:e,defaultPanelAfterConfirm:t="mini"}){const[n,r]=C.useState("closed"),[s,i]=C.useState(null),[o,a]=C.useState(!1),[l,d]=C.useState("pending"),[f,u]=C.useState(null),g=pe(N=>N.setSelectedLogin),{accounts:p,isLoading:y}=ap(),{submitOrder:m}=qi(),h=C.useMemo(()=>Qv(p),[p]),b=C.useMemo(()=>Jv(p,f),[p,f]),v=l==="confirmed",_=l==="needs-selection";C.useEffect(()=>{if(y)return;if(l==="confirmed"){f&&!h.some(L=>L.login===f)&&d("needs-selection");return}if(l==="needs-selection")return;const N=Xv();if(N&&h.some(L=>L.login===N)){u(N),d("confirmed"),r(t);return}d("needs-selection")},[l,h,t,y,f]),C.useEffect(()=>{b&&g(b)},[b,g]);const x=C.useCallback(N=>{u(N),g(N),Sl(N)},[g]),S=C.useCallback(N=>{N&&(Sl(N),x(N),d("confirmed"),i(null),r(t))},[t,x]),T=C.useCallback(()=>{i(null),r("market")},[]),P=C.useCallback(()=>{i(null),r("mini")},[]),A=C.useCallback(()=>{i(null),r("mini")},[]),D=C.useCallback(()=>{i(null),r("mini")},[]),I=C.useCallback(async N=>{const L=ie.getState().clearEntryLinePreview,H=N.login.trim();if(!H){L(),Se({variant:"destructive",description:"Please select a trading account."});return}const R=Math.max(Rd,N.volumeLots),F=Ui(N.symbolTicker,e);Number(Vt(Ht(N.symbolTicker,e)));const M=Fi(N.executionMode),$=cc(N.orderType),O=Ue(N.priceOrder),U=Ue(N.priceTrigger);if(!M&&O===void 0){L(),Se({variant:"destructive",description:$?"Please set a limit price for this order.":"Please set an order price for pending orders."});return}if($&&U===void 0){L(),Se({variant:"destructive",description:"Please set a stop price for stop limit orders."});return}if(!M&&!Bi(N.typeTime,N.expirationDateTime,N.expirationDay)){L(),Se({variant:"destructive",description:"Please set an expiration date for this order."});return}const W=M?N.side==="buy"?N.ask:N.bid:O??(N.side==="buy"?N.ask:N.bid);a(!0);try{const j=await m({login:H,symbolTicker:N.symbolTicker,executionMode:N.executionMode,side:ci(N.orderType),orderType:N.orderType,volumeLots:R,stopLoss:Ue(N.stopLoss),takeProfit:Ue(N.takeProfit),priceOrder:ac(N.orderType)?O:void 0,priceTrigger:$?U:void 0,comment:N.comment.trim(),typeTime:N.typeTime,expirationDateTime:N.expirationDateTime,expirationDay:N.expirationDay,bid:N.bid,ask:N.ask});if(!j.success){L(),Se({variant:"destructive",description:j.message||"Order was not accepted."});return}i({ticket:j.ticket??"",side:j.side??ci(N.orderType),volumeLots:j.volumeLots??R,symbol:j.displaySymbol??F,price:j.price??W}),r("confirmation")}catch(j){L();const ee=j instanceof Error?j.message:"Failed to place order.";Se({variant:"destructive",description:ee})}finally{a(!1)}},[m,e]);return{panel:n,confirmation:s,isSubmitting:o,defaultVolumeLots:NC,volumeStep:RC,minVolumeLots:Rd,accountOptions:h,selectedLogin:b,setSelectedLogin:x,isAccountsLoading:y,hasConfirmedAccount:v,needsAccountSelection:_,confirmAccountSelection:S,openMarketPanel:T,openMiniPanel:P,closePanels:A,dismissConfirmation:D,placeMarketOrder:I}}function gi(e){var t;if(typeof window<"u"){const n=localStorage.getItem(Qn);if(n&&e.some(r=>r.ticker===n))return n}return((t=e[0])==null?void 0:t.ticker)??"XAU_USD"}function ma(e,t,n){var r;return((r=t.find(s=>s.display_name===e||s.ticker===e))==null?void 0:r.ticker)??n}function DC({chartWidget:e,symbols:t,chartSlotElement:n,onSymbolTickerChange:r,onScanResultUrlChange:s,selectSymbolTickerRef:i}){const o=C.useMemo(()=>gi(t),[t]),a=C.useRef(o),l=C.useRef(e),[d,f]=C.useState(null);C.useEffect(()=>{l.current=e},[e]),C.useEffect(()=>{if(!n){f(null);return}const g=()=>{const y=n.querySelector(":scope > div");f(y)};g();const p=new MutationObserver(g);return p.observe(n,{childList:!0}),()=>{p.disconnect()}},[n]);const u=C.useCallback(g=>{if(g===a.current)return;const p=t.find(m=>m.ticker===g);if(!p)return;a.current=g,localStorage.setItem(Qn,g),r(g),s(null);const y=l.current;if(y)try{y.onChartReady(()=>{y.activeChart().setSymbol(p.ticker)})}catch{}},[s,r,t]);return C.useEffect(()=>(i.current=u,()=>{i.current=null}),[u,i]),C.useEffect(()=>{if(!e)return;let g=!1,p=null;try{e.onChartReady(()=>{if(g)return;let y;try{y=e.activeChart()}catch{return}const m=v=>{const _=y.symbol(),x=ma(_,t,o);x!==a.current&&s(null);try{e.resetCache()}catch{}a.current=x,localStorage.setItem(Qn,x),r(x)},h=y.symbol(),b=ma(h,t,o);b!==a.current&&(a.current=b,localStorage.setItem(Qn,b),r(b)),y.onSymbolChanged().subscribe(null,m),p=()=>{try{y.onSymbolChanged().unsubscribe(null,m)}catch{}}})}catch{}return()=>{g=!0,p==null||p()}},[e,s,r,o,t]),{chartContainer:d}}const jC=Pa("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function IC({className:e,variant:t,...n}){return c.jsx("div",{className:Te(jC({variant:t}),e),...n})}function Ip(){var t;const e=(t=window.TradingView)==null?void 0:t.widget;return typeof e=="function"?e:null}function Ys(){return Ip()!==null}const Ld="/charting_library/charting_library.js";function MC({onLoad:e}){return C.useEffect(()=>{if(Ys()){e();return}const t=document.querySelector(`script[src="${Ld}"]`);if(t){const r=()=>{Ys()&&e()};return t.addEventListener("load",r),()=>t.removeEventListener("load",r)}const n=document.createElement("script");return n.src=Ld,n.async=!1,n.onload=()=>{Ys()&&e()},n.onerror=()=>{console.error("Failed to load TradingView charting library")},document.head.appendChild(n),()=>{n.onload=null,n.onerror=null}},[e]),null}const Dd=$i(e=>({playEndTimestamp:null,setPlayEndTimestamp:t=>e({playEndTimestamp:t})})),Mp=$i(e=>({newsSelectedCandles:null,newsPlayEndTimestamp:null,gapCount:0,isReplayMode:!1,setNewsSelectedCandles:t=>e({newsSelectedCandles:t}),setNewsPlayEndTimestamp:t=>e({newsPlayEndTimestamp:t}),setGapCount:t=>e({gapCount:t}),setReplayMode:t=>e({isReplayMode:t})})),pa=8,Fp=4,ha=5,ga=e=>e==="1"?60:e==="5"?300:e==="1D"?1440*3600:parseInt(e,10)*60,FC=e=>{const t=new Date(e+pa*60*60*1e3),n=t.getUTCDay(),r=t.getUTCHours();return n===0?!1:n===1?r>=ha:n===6?r<=Fp:!0},UC=e=>{const t=new Date(e+pa*60*60*1e3),n=t.getUTCDay(),r=t.getUTCHours();if(n===0||n===1&&r<ha||n===6&&r>=Fp){const s=(8-n)%7;return t.setUTCDate(t.getUTCDate()+s),t.setUTCHours(ha,0,0,0),t.getTime()-pa*60*60*1e3}return e},BC=(e,t,n)=>{const r=ga(t)*1e3,s=[];let i=e;for(let o=0;o<n;o++)i+=r,FC(i)||(i=UC(i)),s.push(i);return s},$C=(e,t,n,r)=>{if(n<=0)return[];if(r==="24x7"){const i=ga(t)*1e3;return Array.from({length:n},(o,a)=>e+(a+1)*i)}if(r==="1700-1700")return BC(e,t,n);const s=ga(t)*1e3;return Array.from({length:n},(i,o)=>e+(o+1)*s)},VC=(e,t)=>{if(t==="1D"||t==="D"||t==="1440"){const n=new Date(e*1e3);return n.setUTCHours(0,0,0,0),n.getTime()}return e.toString().length>11?e:e*1e3},jd="wss://symbols.opheleo.com";function HC(e){return{1:6e4,5:3e5,15:9e5,30:18e5,60:36e5,240:144e5}[e]??6e4}function Id(e){return e.trim().toUpperCase()}function zC(e,t){return Math.floor(e/t)*t}let Ir;async function WC(e){const t=new URLSearchParams({symbol:e.symbol,timeframe:e.timeframe,...e.endTimestamp&&{endTimestamp:e.endTimestamp.toString()}});return e.last_evaluated_key&&t.append("last_evaluated_key",e.last_evaluated_key),Re({baseURL:"https://corprate-widget.iccandle.ai",url:`/chart/endTimestamp?${t.toString()}`,method:"GET"})}class KC{constructor(t,n,r=Bt,s=jd){it(this,"futureBarsRef");it(this,"type");it(this,"symbols");it(this,"tickWebSocketUrl");it(this,"configuration",{supported_resolutions:["1","5","15","30","60"],supports_marks:!1,supports_timescale_marks:!0,supports_time:!1});it(this,"ws",null);it(this,"isWsConnecting",!1);it(this,"wsSelectedSymbol",null);it(this,"subscriptions",new Map);it(this,"lastBarsCache",new Map);it(this,"pushFutureBar",t=>{for(const[,n]of this.subscriptions.entries())return n.onTick(t),!0;return!1});this.futureBarsRef=t,this.type=n,this.symbols=r,this.tickWebSocketUrl=s||jd}onReady(t){setTimeout(()=>t(this.configuration),0)}resolveSymbol(t,n,r){const s=this.symbols.find(o=>o.ticker===t),i=this.symbols.find(o=>o.display_name===t);try{setTimeout(()=>{const o={name:(s==null?void 0:s.display_name)||(i==null?void 0:i.display_name)||localStorage.getItem("tv:latest-symbol")||"XAU_USD",timezone:"America/New_York",minmov:1,session:(s==null?void 0:s.session)||(i==null?void 0:i.session)||"24x7",has_intraday:!0,visible_plots_set:"ohlc",library_custom_fields:{ticker:(s==null?void 0:s.ticker)||(i==null?void 0:i.ticker)||localStorage.getItem("tv:latest-symbol")||"XAU_USD"},description:(s==null?void 0:s.description)||(i==null?void 0:i.description)||"",type:(s==null?void 0:s.type)||(i==null?void 0:i.type)||"",pricescale:(s==null?void 0:s.pricescale)||(i==null?void 0:i.pricescale)||1e5,ticker:(s==null?void 0:s.display_name)||(i==null?void 0:i.display_name)||localStorage.getItem("tv:latest-symbol")||"XAU_USD",exchange:"FX",format:"price",listed_exchange:"FX",logo_urls:(s==null?void 0:s.logo_urls.map(a=>a.replace("https://cdn.iccandle.ai/web-assets","/images/symbols")))||(i==null?void 0:i.logo_urls.map(a=>a.replace("https://cdn.iccandle.ai/web-assets","/images/symbols")))};n(o)},0)}catch{r("Symbol not found")}}getBars(t,n,r,s,i){var u;const o=(u=t.library_custom_fields)==null?void 0:u.ticker,a=this.symbols.find(g=>o!==void 0&&g.ticker===o||g.ticker===t.ticker||g.display_name===t.name||g.display_name===t.ticker),l={symbol:(a==null?void 0:a.ticker)||"",timeframe:n};if(r.firstDataRequest&&(Ir=void 0),!r.firstDataRequest)if(Ir)l.last_evaluated_key=Ir;else{s([],{noData:!0});return}const f=Dd.getState().playEndTimestamp;f&&(l.endTimestamp=f,Dd.getState().setPlayEndTimestamp(null),Ir=void 0),(async()=>{var g;try{const{data:p}=await WC(l);if(p.data_status==="threshold_limited"){s([],{noData:!0});return}if(p.data_status==="end_of_data"){s([],{noData:!0});return}if(!((g=p.items)!=null&&g.length)){s([],{noData:!0});return}Ir=p.last_evaluated_key;const m=[...p.items].map(_=>({open:_.o,high:_.h,low:_.l,close:_.c,time:VC(_.timestamp,n)})),h=Mp.getState(),{gapCount:b,isReplayMode:v}=h;if(v&&event){const _=$C(m[m.length-1].time,n,b||0,t.session);if(_.length>0){const x=m[m.length-1].close;for(const S of _)m.push({open:x,high:x,low:x,close:x,time:S})}}s(m)}catch(p){i(p),s([],{noData:!0})}})()}searchSymbols(t,n,r,s){if(r==="all"||r===""){const i=this.symbols.filter(o=>{var a;return(a=o.display_name)==null?void 0:a.toUpperCase().includes(t.toUpperCase())}).map(o=>({...o,symbol:o.display_name,exchange:"FX",logo_urls:o.logo_urls.map(a=>a.replace("https://cdn.iccandle.ai/web-assets","/images/symbols"))}));s(i)}else{const i=this.symbols.filter(o=>{var a;return((a=o.display_name)==null?void 0:a.toUpperCase().includes(t.toUpperCase()))&&o.type.includes(r)}).map(o=>({...o,symbol:o.display_name,exchange:"FX",logo_urls:o.logo_urls.map(a=>a.replace("https://cdn.iccandle.ai/web-assets","/images/symbols"))}));s(i)}}subscribeBars(t,n,r,s,i){var u;const o=(u=t.library_custom_fields)==null?void 0:u.ticker,a=this.symbols.find(g=>o!==void 0&&g.ticker===o||g.display_name===t.ticker||g.display_name===t.name),l=a!=null&&a.resolve_symbol?Id(a.resolve_symbol):Id(t.ticker||t.name||""),d=HC(n),f=`${l}|${n}`;this.subscriptions.set(s,{symbol:l,resolution:n,periodMs:d,onTick:r,onResetCacheNeededCallback:i,liveCandle:this.lastBarsCache.get(f)??null}),this.ensureWebSocket(l)}unsubscribeBars(t){this.subscriptions.delete(t),this.subscriptions.size===0&&this.ws&&(this.ws.close(1e3,"No more subscriptions"),this.ws=null)}ensureWebSocket(t){var s;const n=t??((s=this.subscriptions.values().next().value)==null?void 0:s.symbol);if(this.ws&&this.ws.readyState===WebSocket.OPEN&&this.wsSelectedSymbol===n||(this.ws&&this.wsSelectedSymbol!==n&&(this.ws.close(1e3,"Symbol change"),this.ws=null,this.wsSelectedSymbol=null),this.isWsConnecting))return;this.isWsConnecting=!0;const r=new WebSocket(this.tickWebSocketUrl);this.ws=r,this.wsSelectedSymbol=n??null,r.onopen=()=>{this.isWsConnecting=!1,n&&r.send(JSON.stringify({action:"select_symbol",symbol:n}))},r.onmessage=i=>this.handleMessage(i),r.onerror=()=>{this.isWsConnecting=!1},r.onclose=()=>{this.ws=null,this.wsSelectedSymbol=null,this.isWsConnecting=!1,this.subscriptions.size>0&&setTimeout(()=>this.ensureWebSocket(),3e3)}}handleMessage(t){try{const n=JSON.parse(t.data);this.processTick(n)}catch{}}processTick(t){const n=t.symbol,r=Number(t.updatedAtMs),s=(Number(t.bid)+Number(t.ask))/2;if(!(!Number.isFinite(r)||!Number.isFinite(s)))for(const[i,o]of this.subscriptions.entries()){if(o.symbol!==n)continue;const a=`${o.symbol}|${o.resolution}`,l=zC(r,o.periodMs);let d=o.liveCandle;d?l>d.time?d={time:l,open:s,high:s,low:s,close:s,volume:0}:d={...d,high:Math.max(d.high,s),low:Math.min(d.low,s),close:s}:d={time:l,open:s,high:s,low:s,close:s,volume:0},o.liveCandle=d,this.lastBarsCache.set(a,d),this.subscriptions.set(i,o),(u=>{var g,p;(p=(g=this.futureBarsRef)==null?void 0:g.current)!=null&&p.length||o.onTick(u)})(d)}}extractErrorMessage(t){if(t instanceof Error)return t.message;if(typeof t=="string")return t;try{return JSON.stringify(t)}catch{return String(t)}}getTimescaleMarks(t,n,r,s){const i=[];if(this.type&&this.type=="selector")try{const o=JSON.parse(localStorage.getItem("tv:selected-news-events")||"[]");o==null||o.forEach(({id:a,timestamp:l,event_name:d,currency:f})=>{!a||!Number.isFinite(l)||l<=0||i.some(u=>String(u.id)===String(a))||i.push({id:a,time:l/1e3,color:"green",label:d.slice(0,1)||"N",tooltip:[d],...f?{imageUrl:`/images/symbols/${f}.svg`}:{},showLabelWhenImageLoaded:!0})})}catch{}if(this.type&&this.type=="news")try{const o=JSON.parse(localStorage.getItem("iccandle:current-news-event")||"{}"),{id:a,timestamp:l,event_name:d,currency:f,forecast:u,previous:g,actual:p}=o;if(!a||!Number.isFinite(l)||l<=0||i.some(m=>String(m.id)==="news:"+a))return;i.push({id:"news:"+a,time:l/1e3,color:"green",label:d.slice(0,1),tooltip:[d,`Current Forecast: ${u||"-"}`,`Previous Forecast: ${g||"-"}`,`Previous Actual: ${p||"-"}`],...f?{imageUrl:`https://cdn.iccandle.ai/web-assets/${f??"USD"}.svg`}:{}})}catch{}s(i)}}const qC=e=>{const t={name:"Generated Candles - By iC Candle",metainfo:{_metainfoVersion:51,id:"Generated Candles - By iC Candle@tv-basicstudies-1",description:"Generated Candles - By iC Candle",shortDescription:"Generated Candles",isCustomIndicator:!0,is_hidden_study:!1,is_price_study:!0,linkedToSeries:!0,format:{type:"price",precision:2},inputs:[],palettes:{palette_bar:{colors:{0:{name:"Bullish"},1:{name:"Bearish"}},valToIndex:{0:0,1:1}},palette_wick:{colors:{0:{name:"Bullish Wick"},1:{name:"Bearish Wick"}},valToIndex:{0:0,1:1}},palette_border:{colors:{0:{name:"Bullish Border"},1:{name:"Bearish Border"}},valToIndex:{0:0,1:1}}},plots:[{id:"plot_open",type:"ohlc_open",target:"plot_candle"},{id:"plot_high",type:"ohlc_high",target:"plot_candle"},{id:"plot_low",type:"ohlc_low",target:"plot_candle"},{id:"plot_close",type:"ohlc_close",target:"plot_candle"},{id:"plot_bar_color",type:"ohlc_colorer",palette:"palette_bar",target:"plot_candle"},{id:"plot_wick_color",type:"wick_colorer",palette:"palette_wick",target:"plot_candle"},{id:"plot_border_color",type:"border_colorer",palette:"palette_border",target:"plot_candle"}],ohlcPlots:{plot_candle:{title:"Generated Candles"}},styles:{},defaults:{styles:{},ohlcPlots:{plot_candle:{borderColor:"#000000",color:"#000000",drawBorder:!0,drawWick:!0,plottype:"ohlc_candles",visible:!0,wickColor:"#000000"}},palettes:{palette_bar:{colors:{0:{color:"#00dfb9",width:1,style:0},1:{color:"#ffb84d",width:1,style:0}}},palette_wick:{colors:{0:{color:"#00dfb9",width:1,style:0},1:{color:"#ffb84d",width:1,style:0}}},palette_border:{colors:{0:{color:"#00dfb9",width:1,style:0},1:{color:"#ffb84d",width:1,style:0}}}},precision:2,inputs:{}}},constructor:function(){this.init=function(n){this._context=n},this.main=function(n){this._context=n;const r=n.symbol.time,s=e.current,i=n.symbol.open,o=n.symbol.high,a=n.symbol.low,l=n.symbol.close;if(!Number.isFinite(r)||!s||s.length===0)return[i,o,a,l,Number.NaN,Number.NaN,Number.NaN];if(!s.some(g=>g.time===r))return[i,o,a,l,Number.NaN,Number.NaN,Number.NaN];const u=l<i?1:0;return[i,o,a,l,u,u,u]}}};return Promise.resolve([t])},ya="An unknown error occurred",Qs=e=>{if(typeof e=="string")return e;if(typeof e!="object"||e===null)return ya;if(typeof e.message=="string")return e.message;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const n=Qs(e[t]);if(n)return n}return ya},GC=e=>{var t;if(Lm(e)){const n=(t=e.response)!=null&&t.data?Qs(e.response.data):void 0;return n&&n!==ya?n:Qs(e)}return Qs(e)},ZC=({queryKey:e,queryFn:t,...n})=>Or({queryKey:e,queryFn:async r=>{var s;try{const i=r.queryKey[1];return await t(i)}catch(i){throw Se({variant:"destructive",title:"Error",description:GC(Lm(i)?(s=i.response)==null?void 0:s.data:i)}),null}},...n});var _e;(function(e){e.assertEqual=s=>{};function t(s){}e.assertIs=t;function n(s){throw new Error}e.assertNever=n,e.arrayToEnum=s=>{const i={};for(const o of s)i[o]=o;return i},e.getValidEnumValues=s=>{const i=e.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),o={};for(const a of i)o[a]=s[a];return e.objectValues(o)},e.objectValues=s=>e.objectKeys(s).map(function(i){return s[i]}),e.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const i=[];for(const o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.push(o);return i},e.find=(s,i)=>{for(const o of s)if(i(o))return o},e.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}e.joinValues=r,e.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(_e||(_e={}));var Md;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(Md||(Md={}));const Y=_e.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Yt=e=>{switch(typeof e){case"undefined":return Y.undefined;case"string":return Y.string;case"number":return Number.isNaN(e)?Y.nan:Y.number;case"boolean":return Y.boolean;case"function":return Y.function;case"bigint":return Y.bigint;case"symbol":return Y.symbol;case"object":return Array.isArray(e)?Y.array:e===null?Y.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Y.promise:typeof Map<"u"&&e instanceof Map?Y.map:typeof Set<"u"&&e instanceof Set?Y.set:typeof Date<"u"&&e instanceof Date?Y.date:Y.object;default:return Y.unknown}},z=_e.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Ut extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){const n=t||function(i){return i.message},r={_errors:[]},s=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let a=r,l=0;for(;l<o.path.length;){const d=o.path[l];l===o.path.length-1?(a[d]=a[d]||{_errors:[]},a[d]._errors.push(n(o))):a[d]=a[d]||{_errors:[]},a=a[d],l++}}};return s(this),r}static assert(t){if(!(t instanceof Ut))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,_e.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const s of this.issues)if(s.path.length>0){const i=s.path[0];n[i]=n[i]||[],n[i].push(t(s))}else r.push(t(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Ut.create=e=>new Ut(e);const ba=(e,t)=>{let n;switch(e.code){case z.invalid_type:e.received===Y.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case z.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,_e.jsonStringifyReplacer)}`;break;case z.unrecognized_keys:n=`Unrecognized key(s) in object: ${_e.joinValues(e.keys,", ")}`;break;case z.invalid_union:n="Invalid input";break;case z.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${_e.joinValues(e.options)}`;break;case z.invalid_enum_value:n=`Invalid enum value. Expected ${_e.joinValues(e.options)}, received '${e.received}'`;break;case z.invalid_arguments:n="Invalid function arguments";break;case z.invalid_return_type:n="Invalid function return type";break;case z.invalid_date:n="Invalid date";break;case z.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:_e.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case z.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case z.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case z.custom:n="Invalid input";break;case z.invalid_intersection_types:n="Intersection results could not be merged";break;case z.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case z.not_finite:n="Number must be finite";break;default:n=t.defaultError,_e.assertNever(e)}return{message:n}};let YC=ba;function QC(){return YC}const XC=e=>{const{data:t,path:n,errorMaps:r,issueData:s}=e,i=[...n,...s.path||[]],o={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let a="";const l=r.filter(d=>!!d).slice().reverse();for(const d of l)a=d(o,{data:t,defaultError:a}).message;return{...s,path:i,message:a}};function G(e,t){const n=QC(),r=XC({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===ba?void 0:ba].filter(s=>!!s)});e.common.issues.push(r)}class st{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const s of n){if(s.status==="aborted")return ae;s.status==="dirty"&&t.dirty(),r.push(s.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const s of n){const i=await s.key,o=await s.value;r.push({key:i,value:o})}return st.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const s of n){const{key:i,value:o}=s;if(i.status==="aborted"||o.status==="aborted")return ae;i.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(r[i.value]=o.value)}return{status:t.value,value:r}}}const ae=Object.freeze({status:"aborted"}),Hr=e=>({status:"dirty",value:e}),ut=e=>({status:"valid",value:e}),Fd=e=>e.status==="aborted",Ud=e=>e.status==="dirty",vr=e=>e.status==="valid",yi=e=>typeof Promise<"u"&&e instanceof Promise;var Q;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(Q||(Q={}));class fn{constructor(t,n,r,s){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Bd=(e,t)=>{if(vr(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Ut(e.common.issues);return this._error=n,this._error}}};function fe(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:s}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:s}:{errorMap:(o,a)=>{const{message:l}=e;return o.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:s}}class we{get description(){return this._def.description}_getType(t){return Yt(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Yt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new st,ctx:{common:t.parent.common,data:t.data,parsedType:Yt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(yi(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Yt(t)},s=this._parseSync({data:t,path:r.path,parent:r});return Bd(r,s)}"~validate"(t){var r,s;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Yt(t)};if(!this["~standard"].async)try{const i=this._parseSync({data:t,path:[],parent:n});return vr(i)?{value:i.value}:{issues:n.common.issues}}catch(i){(s=(r=i==null?void 0:i.message)==null?void 0:r.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(i=>vr(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Yt(t)},s=this._parse({data:t,path:r.path,parent:r}),i=await(yi(s)?s:Promise.resolve(s));return Bd(r,i)}refine(t,n){const r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,i)=>{const o=t(s),a=()=>i.addIssue({code:z.custom,...r(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,s)=>t(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(t){return new xr({schema:this,typeName:ce.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return cn.create(this,this._def)}nullable(){return Sr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Nt.create(this)}promise(){return _i.create(this,this._def)}or(t){return vi.create([this,t],this._def)}and(t){return wi.create(this,t,this._def)}transform(t){return new xr({...fe(this._def),schema:this,typeName:ce.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new _a({...fe(this._def),innerType:this,defaultValue:n,typeName:ce.ZodDefault})}brand(){return new _T({typeName:ce.ZodBranded,type:this,...fe(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new xa({...fe(this._def),innerType:this,catchValue:n,typeName:ce.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Ic.create(this,t)}readonly(){return Sa.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const JC=/^c[^\s-]{8,}$/i,eT=/^[0-9a-z]+$/,tT=/^[0-9A-HJKMNP-TV-Z]{26}$/i,nT=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,rT=/^[a-z0-9_-]{21}$/i,sT=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,iT=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,oT=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,aT="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Po;const cT=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,lT=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,dT=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,uT=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,fT=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,mT=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Up="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",pT=new RegExp(`^${Up}$`);function Bp(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function hT(e){return new RegExp(`^${Bp(e)}$`)}function gT(e){let t=`${Up}T${Bp(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function yT(e,t){return!!((t==="v4"||!t)&&cT.test(e)||(t==="v6"||!t)&&dT.test(e))}function bT(e,t){if(!sT.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||t&&s.alg!==t)}catch{return!1}}function vT(e,t){return!!((t==="v4"||!t)&&lT.test(e)||(t==="v6"||!t)&&uT.test(e))}class sn extends we{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Y.string){const i=this._getOrReturnCtx(t);return G(i,{code:z.invalid_type,expected:Y.string,received:i.parsedType}),ae}const r=new st;let s;for(const i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(s=this._getOrReturnCtx(t,s),G(s,{code:z.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")t.data.length>i.value&&(s=this._getOrReturnCtx(t,s),G(s,{code:z.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const o=t.data.length>i.value,a=t.data.length<i.value;(o||a)&&(s=this._getOrReturnCtx(t,s),o?G(s,{code:z.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&G(s,{code:z.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")oT.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"email",code:z.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")Po||(Po=new RegExp(aT,"u")),Po.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"emoji",code:z.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")nT.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"uuid",code:z.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")rT.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"nanoid",code:z.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")JC.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"cuid",code:z.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")eT.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"cuid2",code:z.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")tT.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"ulid",code:z.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{s=this._getOrReturnCtx(t,s),G(s,{validation:"url",code:z.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"regex",code:z.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(t,s),G(s,{code:z.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(s=this._getOrReturnCtx(t,s),G(s,{code:z.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(s=this._getOrReturnCtx(t,s),G(s,{code:z.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?gT(i).test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{code:z.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?pT.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{code:z.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?hT(i).test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{code:z.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?iT.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"duration",code:z.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?yT(t.data,i.version)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"ip",code:z.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?bT(t.data,i.alg)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"jwt",code:z.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?vT(t.data,i.version)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"cidr",code:z.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?fT.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"base64",code:z.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?mT.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"base64url",code:z.invalid_string,message:i.message}),r.dirty()):_e.assertNever(i);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(s=>t.test(s),{validation:n,code:z.invalid_string,...Q.errToObj(r)})}_addCheck(t){return new sn({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Q.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Q.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Q.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Q.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Q.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Q.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Q.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Q.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Q.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...Q.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...Q.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Q.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...Q.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,...Q.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...Q.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...Q.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...Q.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...Q.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...Q.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...Q.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...Q.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...Q.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...Q.errToObj(n)})}nonempty(t){return this.min(1,Q.errToObj(t))}trim(){return new sn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new sn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new sn({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}sn.create=e=>new sn({checks:[],typeName:ce.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...fe(e)});function wT(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,s=n>r?n:r,i=Number.parseInt(e.toFixed(s).replace(".","")),o=Number.parseInt(t.toFixed(s).replace(".",""));return i%o/10**s}class wr extends we{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==Y.number){const i=this._getOrReturnCtx(t);return G(i,{code:z.invalid_type,expected:Y.number,received:i.parsedType}),ae}let r;const s=new st;for(const i of this._def.checks)i.kind==="int"?_e.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),G(r,{code:z.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),G(r,{code:z.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),G(r,{code:z.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?wT(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),G(r,{code:z.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),G(r,{code:z.not_finite,message:i.message}),s.dirty()):_e.assertNever(i);return{status:s.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,Q.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Q.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Q.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Q.toString(n))}setLimit(t,n,r,s){return new wr({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Q.toString(s)}]})}_addCheck(t){return new wr({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Q.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Q.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Q.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Q.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Q.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Q.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:Q.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Q.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Q.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&_e.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}wr.create=e=>new wr({checks:[],typeName:ce.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...fe(e)});class Jr extends we{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==Y.bigint)return this._getInvalidInput(t);let r;const s=new st;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),G(r,{code:z.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),G(r,{code:z.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),G(r,{code:z.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):_e.assertNever(i);return{status:s.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return G(n,{code:z.invalid_type,expected:Y.bigint,received:n.parsedType}),ae}gte(t,n){return this.setLimit("min",t,!0,Q.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Q.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Q.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Q.toString(n))}setLimit(t,n,r,s){return new Jr({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Q.toString(s)}]})}_addCheck(t){return new Jr({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Q.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Q.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Q.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Q.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Q.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Jr.create=e=>new Jr({checks:[],typeName:ce.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...fe(e)});class va extends we{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Y.boolean){const r=this._getOrReturnCtx(t);return G(r,{code:z.invalid_type,expected:Y.boolean,received:r.parsedType}),ae}return ut(t.data)}}va.create=e=>new va({typeName:ce.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...fe(e)});class bi extends we{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Y.date){const i=this._getOrReturnCtx(t);return G(i,{code:z.invalid_type,expected:Y.date,received:i.parsedType}),ae}if(Number.isNaN(t.data.getTime())){const i=this._getOrReturnCtx(t);return G(i,{code:z.invalid_date}),ae}const r=new st;let s;for(const i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(s=this._getOrReturnCtx(t,s),G(s,{code:z.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(s=this._getOrReturnCtx(t,s),G(s,{code:z.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):_e.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new bi({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:Q.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:Q.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}bi.create=e=>new bi({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:ce.ZodDate,...fe(e)});class $d extends we{_parse(t){if(this._getType(t)!==Y.symbol){const r=this._getOrReturnCtx(t);return G(r,{code:z.invalid_type,expected:Y.symbol,received:r.parsedType}),ae}return ut(t.data)}}$d.create=e=>new $d({typeName:ce.ZodSymbol,...fe(e)});class Vd extends we{_parse(t){if(this._getType(t)!==Y.undefined){const r=this._getOrReturnCtx(t);return G(r,{code:z.invalid_type,expected:Y.undefined,received:r.parsedType}),ae}return ut(t.data)}}Vd.create=e=>new Vd({typeName:ce.ZodUndefined,...fe(e)});class Hd extends we{_parse(t){if(this._getType(t)!==Y.null){const r=this._getOrReturnCtx(t);return G(r,{code:z.invalid_type,expected:Y.null,received:r.parsedType}),ae}return ut(t.data)}}Hd.create=e=>new Hd({typeName:ce.ZodNull,...fe(e)});class zd extends we{constructor(){super(...arguments),this._any=!0}_parse(t){return ut(t.data)}}zd.create=e=>new zd({typeName:ce.ZodAny,...fe(e)});class Wd extends we{constructor(){super(...arguments),this._unknown=!0}_parse(t){return ut(t.data)}}Wd.create=e=>new Wd({typeName:ce.ZodUnknown,...fe(e)});class mn extends we{_parse(t){const n=this._getOrReturnCtx(t);return G(n,{code:z.invalid_type,expected:Y.never,received:n.parsedType}),ae}}mn.create=e=>new mn({typeName:ce.ZodNever,...fe(e)});class Kd extends we{_parse(t){if(this._getType(t)!==Y.undefined){const r=this._getOrReturnCtx(t);return G(r,{code:z.invalid_type,expected:Y.void,received:r.parsedType}),ae}return ut(t.data)}}Kd.create=e=>new Kd({typeName:ce.ZodVoid,...fe(e)});class Nt extends we{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),s=this._def;if(n.parsedType!==Y.array)return G(n,{code:z.invalid_type,expected:Y.array,received:n.parsedType}),ae;if(s.exactLength!==null){const o=n.data.length>s.exactLength.value,a=n.data.length<s.exactLength.value;(o||a)&&(G(n,{code:o?z.too_big:z.too_small,minimum:a?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(G(n,{code:z.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(G(n,{code:z.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,a)=>s.type._parseAsync(new fn(n,o,n.path,a)))).then(o=>st.mergeArray(r,o));const i=[...n.data].map((o,a)=>s.type._parseSync(new fn(n,o,n.path,a)));return st.mergeArray(r,i)}get element(){return this._def.type}min(t,n){return new Nt({...this._def,minLength:{value:t,message:Q.toString(n)}})}max(t,n){return new Nt({...this._def,maxLength:{value:t,message:Q.toString(n)}})}length(t,n){return new Nt({...this._def,exactLength:{value:t,message:Q.toString(n)}})}nonempty(t){return this.min(1,t)}}Nt.create=(e,t)=>new Nt({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ce.ZodArray,...fe(t)});function Yn(e){if(e instanceof je){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=cn.create(Yn(r))}return new je({...e._def,shape:()=>t})}else return e instanceof Nt?new Nt({...e._def,type:Yn(e.element)}):e instanceof cn?cn.create(Yn(e.unwrap())):e instanceof Sr?Sr.create(Yn(e.unwrap())):e instanceof Fn?Fn.create(e.items.map(t=>Yn(t))):e}class je extends we{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=_e.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==Y.object){const d=this._getOrReturnCtx(t);return G(d,{code:z.invalid_type,expected:Y.object,received:d.parsedType}),ae}const{status:r,ctx:s}=this._processInputParams(t),{shape:i,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof mn&&this._def.unknownKeys==="strip"))for(const d in s.data)o.includes(d)||a.push(d);const l=[];for(const d of o){const f=i[d],u=s.data[d];l.push({key:{status:"valid",value:d},value:f._parse(new fn(s,u,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof mn){const d=this._def.unknownKeys;if(d==="passthrough")for(const f of a)l.push({key:{status:"valid",value:f},value:{status:"valid",value:s.data[f]}});else if(d==="strict")a.length>0&&(G(s,{code:z.unrecognized_keys,keys:a}),r.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const f of a){const u=s.data[f];l.push({key:{status:"valid",value:f},value:d._parse(new fn(s,u,s.path,f)),alwaysSet:f in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const d=[];for(const f of l){const u=await f.key,g=await f.value;d.push({key:u,value:g,alwaysSet:f.alwaysSet})}return d}).then(d=>st.mergeObjectSync(r,d)):st.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return Q.errToObj,new je({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var i,o;const s=((o=(i=this._def).errorMap)==null?void 0:o.call(i,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:Q.errToObj(t).message??s}:{message:s}}}:{}})}strip(){return new je({...this._def,unknownKeys:"strip"})}passthrough(){return new je({...this._def,unknownKeys:"passthrough"})}extend(t){return new je({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new je({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:ce.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new je({...this._def,catchall:t})}pick(t){const n={};for(const r of _e.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new je({...this._def,shape:()=>n})}omit(t){const n={};for(const r of _e.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new je({...this._def,shape:()=>n})}deepPartial(){return Yn(this)}partial(t){const n={};for(const r of _e.objectKeys(this.shape)){const s=this.shape[r];t&&!t[r]?n[r]=s:n[r]=s.optional()}return new je({...this._def,shape:()=>n})}required(t){const n={};for(const r of _e.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof cn;)i=i._def.innerType;n[r]=i}return new je({...this._def,shape:()=>n})}keyof(){return $p(_e.objectKeys(this.shape))}}je.create=(e,t)=>new je({shape:()=>e,unknownKeys:"strip",catchall:mn.create(),typeName:ce.ZodObject,...fe(t)});je.strictCreate=(e,t)=>new je({shape:()=>e,unknownKeys:"strict",catchall:mn.create(),typeName:ce.ZodObject,...fe(t)});je.lazycreate=(e,t)=>new je({shape:e,unknownKeys:"strip",catchall:mn.create(),typeName:ce.ZodObject,...fe(t)});class vi extends we{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function s(i){for(const a of i)if(a.result.status==="valid")return a.result;for(const a of i)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(a=>new Ut(a.ctx.common.issues));return G(n,{code:z.invalid_union,unionErrors:o}),ae}if(n.common.async)return Promise.all(r.map(async i=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(s);{let i;const o=[];for(const l of r){const d={...n,common:{...n.common,issues:[]},parent:null},f=l._parseSync({data:n.data,path:n.path,parent:d});if(f.status==="valid")return f;f.status==="dirty"&&!i&&(i={result:f,ctx:d}),d.common.issues.length&&o.push(d.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const a=o.map(l=>new Ut(l));return G(n,{code:z.invalid_union,unionErrors:a}),ae}}get options(){return this._def.options}}vi.create=(e,t)=>new vi({options:e,typeName:ce.ZodUnion,...fe(t)});function wa(e,t){const n=Yt(e),r=Yt(t);if(e===t)return{valid:!0,data:e};if(n===Y.object&&r===Y.object){const s=_e.objectKeys(t),i=_e.objectKeys(e).filter(a=>s.indexOf(a)!==-1),o={...e,...t};for(const a of i){const l=wa(e[a],t[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(n===Y.array&&r===Y.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let i=0;i<e.length;i++){const o=e[i],a=t[i],l=wa(o,a);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return n===Y.date&&r===Y.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class wi extends we{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),s=(i,o)=>{if(Fd(i)||Fd(o))return ae;const a=wa(i.value,o.value);return a.valid?((Ud(i)||Ud(o))&&n.dirty(),{status:n.value,value:a.data}):(G(r,{code:z.invalid_intersection_types}),ae)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,o])=>s(i,o)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}wi.create=(e,t,n)=>new wi({left:e,right:t,typeName:ce.ZodIntersection,...fe(n)});class Fn extends we{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Y.array)return G(r,{code:z.invalid_type,expected:Y.array,received:r.parsedType}),ae;if(r.data.length<this._def.items.length)return G(r,{code:z.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ae;!this._def.rest&&r.data.length>this._def.items.length&&(G(r,{code:z.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((o,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new fn(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>st.mergeArray(n,o)):st.mergeArray(n,i)}get items(){return this._def.items}rest(t){return new Fn({...this._def,rest:t})}}Fn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Fn({items:e,typeName:ce.ZodTuple,rest:null,...fe(t)})};class qd extends we{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Y.map)return G(r,{code:z.invalid_type,expected:Y.map,received:r.parsedType}),ae;const s=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([a,l],d)=>({key:s._parse(new fn(r,a,r.path,[d,"key"])),value:i._parse(new fn(r,l,r.path,[d,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of o){const d=await l.key,f=await l.value;if(d.status==="aborted"||f.status==="aborted")return ae;(d.status==="dirty"||f.status==="dirty")&&n.dirty(),a.set(d.value,f.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of o){const d=l.key,f=l.value;if(d.status==="aborted"||f.status==="aborted")return ae;(d.status==="dirty"||f.status==="dirty")&&n.dirty(),a.set(d.value,f.value)}return{status:n.value,value:a}}}}qd.create=(e,t,n)=>new qd({valueType:t,keyType:e,typeName:ce.ZodMap,...fe(n)});class es extends we{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Y.set)return G(r,{code:z.invalid_type,expected:Y.set,received:r.parsedType}),ae;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(G(r,{code:z.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(G(r,{code:z.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const i=this._def.valueType;function o(l){const d=new Set;for(const f of l){if(f.status==="aborted")return ae;f.status==="dirty"&&n.dirty(),d.add(f.value)}return{status:n.value,value:d}}const a=[...r.data.values()].map((l,d)=>i._parse(new fn(r,l,r.path,d)));return r.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(t,n){return new es({...this._def,minSize:{value:t,message:Q.toString(n)}})}max(t,n){return new es({...this._def,maxSize:{value:t,message:Q.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}es.create=(e,t)=>new es({valueType:e,minSize:null,maxSize:null,typeName:ce.ZodSet,...fe(t)});class Gd extends we{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Gd.create=(e,t)=>new Gd({getter:e,typeName:ce.ZodLazy,...fe(t)});class Zd extends we{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return G(n,{received:n.data,code:z.invalid_literal,expected:this._def.value}),ae}return{status:"valid",value:t.data}}get value(){return this._def.value}}Zd.create=(e,t)=>new Zd({value:e,typeName:ce.ZodLiteral,...fe(t)});function $p(e,t){return new _r({values:e,typeName:ce.ZodEnum,...fe(t)})}class _r extends we{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return G(n,{expected:_e.joinValues(r),received:n.parsedType,code:z.invalid_type}),ae}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return G(n,{received:n.data,code:z.invalid_enum_value,options:r}),ae}return ut(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return _r.create(t,{...this._def,...n})}exclude(t,n=this._def){return _r.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}_r.create=$p;class Yd extends we{_parse(t){const n=_e.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==Y.string&&r.parsedType!==Y.number){const s=_e.objectValues(n);return G(r,{expected:_e.joinValues(s),received:r.parsedType,code:z.invalid_type}),ae}if(this._cache||(this._cache=new Set(_e.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const s=_e.objectValues(n);return G(r,{received:r.data,code:z.invalid_enum_value,options:s}),ae}return ut(t.data)}get enum(){return this._def.values}}Yd.create=(e,t)=>new Yd({values:e,typeName:ce.ZodNativeEnum,...fe(t)});class _i extends we{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Y.promise&&n.common.async===!1)return G(n,{code:z.invalid_type,expected:Y.promise,received:n.parsedType}),ae;const r=n.parsedType===Y.promise?n.data:Promise.resolve(n.data);return ut(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}_i.create=(e,t)=>new _i({type:e,typeName:ce.ZodPromise,...fe(t)});class xr extends we{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ce.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),s=this._def.effect||null,i={addIssue:o=>{G(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){const o=s.transform(r.data,i);if(r.common.async)return Promise.resolve(o).then(async a=>{if(n.value==="aborted")return ae;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?ae:l.status==="dirty"||n.value==="dirty"?Hr(l.value):l});{if(n.value==="aborted")return ae;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?ae:a.status==="dirty"||n.value==="dirty"?Hr(a.value):a}}if(s.type==="refinement"){const o=a=>{const l=s.refinement(a,i);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?ae:(a.status==="dirty"&&n.dirty(),o(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?ae:(a.status==="dirty"&&n.dirty(),o(a.value).then(()=>({status:n.value,value:a.value}))))}if(s.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!vr(o))return ae;const a=s.transform(o.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>vr(o)?Promise.resolve(s.transform(o.value,i)).then(a=>({status:n.value,value:a})):ae);_e.assertNever(s)}}xr.create=(e,t,n)=>new xr({schema:e,typeName:ce.ZodEffects,effect:t,...fe(n)});xr.createWithPreprocess=(e,t,n)=>new xr({schema:t,effect:{type:"preprocess",transform:e},typeName:ce.ZodEffects,...fe(n)});class cn extends we{_parse(t){return this._getType(t)===Y.undefined?ut(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}cn.create=(e,t)=>new cn({innerType:e,typeName:ce.ZodOptional,...fe(t)});class Sr extends we{_parse(t){return this._getType(t)===Y.null?ut(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Sr.create=(e,t)=>new Sr({innerType:e,typeName:ce.ZodNullable,...fe(t)});class _a extends we{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===Y.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}_a.create=(e,t)=>new _a({innerType:e,typeName:ce.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...fe(t)});class xa extends we{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return yi(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Ut(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ut(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}xa.create=(e,t)=>new xa({innerType:e,typeName:ce.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...fe(t)});class Qd extends we{_parse(t){if(this._getType(t)!==Y.nan){const r=this._getOrReturnCtx(t);return G(r,{code:z.invalid_type,expected:Y.nan,received:r.parsedType}),ae}return{status:"valid",value:t.data}}}Qd.create=e=>new Qd({typeName:ce.ZodNaN,...fe(e)});class _T extends we{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Ic extends we{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?ae:i.status==="dirty"?(n.dirty(),Hr(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?ae:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(t,n){return new Ic({in:t,out:n,typeName:ce.ZodPipeline})}}class Sa extends we{_parse(t){const n=this._def.innerType._parse(t),r=s=>(vr(s)&&(s.value=Object.freeze(s.value)),s);return yi(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}Sa.create=(e,t)=>new Sa({innerType:e,typeName:ce.ZodReadonly,...fe(t)});var ce;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(ce||(ce={}));const ko=sn.create,Fs=wr.create,xT=va.create;mn.create;Nt.create;const ST=je.create;vi.create;wi.create;Fn.create;_r.create;_i.create;cn.create;Sr.create;const CT="https://api.opheleo.com",TT="Bearer ",ET="Authorization";ST({id:ko(),userId:ko(),createdAt:Fs(),updatedAt:Fs(),active:xT(),perDayUsage:Fs(),userEmail:ko().email(),maxPerDayUsage:Fs()});async function PT(e,t,n){const r=typeof window<"u"?localStorage.getItem("session_token"):null;return(await Re({baseURL:br(n??CT),url:e,method:t,headers:r?{[ET]:`${TT}${r}`}:void 0})).data}async function kT(e){return PT("/iccandle/v1/iccandle-user-usage/me","get",e)}const AT=e=>{const t=e==null?void 0:e.platformApiBase;return ZC({queryKey:["iccandle-user-usage",t],queryFn:()=>kT(t),...e})},OT=C.createContext(null);function NT(){const e=C.useContext(OT);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function RT({controlsRef:e,onSymbolTickerChange:t,onScanResultUrlChange:n,onChartWidgetChange:r,onChartContainerChange:s,selectSymbolTickerRef:i,headerSlot:o}){const{resolvedTheme:a}=NT(),l=dt(),d=ys(),f=C.useRef([]),u=C.useRef(null),g=C.useRef(a),p=C.useRef(null),y=C.useRef(null),m=C.useMemo(()=>gi(d),[d]),h=C.useRef(m),b=C.useRef("60"),{setGapCount:v,setReplayMode:_}=Mp();C.useEffect(()=>{v(0),_(!1)},[v,_]),C.useEffect(()=>{Ys()&&P(!0)},[]);const[x,S]=C.useState(null),[T,P]=C.useState(!1),[A,D]=C.useState(null),I=C.useCallback(O=>{if(O===h.current)return;const U=d.find(j=>j.ticker===O);if(!U)return;h.current=O,localStorage.setItem(Qn,O),t(O);const W=u.current;if(W)try{W.onChartReady(()=>{W.activeChart().setSymbol(U.ticker)})}catch{}},[t,d]);C.useEffect(()=>(i.current=I,()=>{i.current=null}),[I,i]);const N=C.useRef([]),L=C.useMemo(()=>new KC(N,"selector",d,l.tickWebSocketUrl),[l.tickWebSocketUrl,d]),{data:H,isLoading:R}=AT({enabled:!0,platformApiBase:l.platformApiBase}),F=!R&&H?H.perDayUsage>=H.maxPerDayUsage:!1;C.useEffect(()=>{s(x)},[x,s]),C.useEffect(()=>{r(A)},[A,r]),C.useEffect(()=>{if(!T||!x)return;if(u.current){D(null),r(null);try{u.current.remove()}catch{}u.current=null}const O=gi(d);h.current=O,b.current="60";const U=Ip();if(!U)return;const W=new U({container:x,library_path:"/charting_library/",datafeed:L,symbol:O,interval:"60",autosize:!0,theme:g.current,disabled_features:["symbol_info","legend_inplace_edit","header_quick_search","header_compare"],enabled_features:["header_chart_type","show_symbol_logos","show_symbol_logo_in_legend"],custom_indicators_getter:()=>qC(f),drawings_access:{type:"black",tools:[{name:"Date Range"}]},locale:"en",timezone:Ih(),overrides:{priceScaleSelectionStrategyName:"right","scalesProperties.showSeriesLastValue":!0}});let j=!1;return u.current=W,W.onChartReady(()=>{j||u.current!==W||D(W)}),()=>{if(j=!0,D(null),r(null),u.current){try{u.current.remove()}catch{}u.current=null}}},[x,L,r,T]),C.useEffect(()=>{if(!A)return;let O=!1;try{A.onChartReady(()=>{O||(async()=>{try{const U=A.activeChart(),W=await U.createStudy("Generated Candles - By iC Candle",!0,!0);if(O||(W&&U.bringToFront([W]),await A.headerReady(),O)||(await new Promise(J=>{setTimeout(()=>{if(!O)try{U.clearMarks(2)}catch{}J(!0)},150)}),O))return;localStorage.setItem("tv:selected-news-events","[]"),U.refreshMarks();const j=J=>{const de=U.symbol(),ue=ma(de,d,m);ue!==h.current&&(n(null),f.current=[]);try{A.resetCache()}catch{}h.current=ue,localStorage.setItem(Qn,ue),t(ue)},ee=J=>{J!==b.current&&(n(null),f.current=[]);try{A.resetCache()}catch{}b.current=J};p.current=j,y.current=ee,U.onSymbolChanged().subscribe(null,j),U.onIntervalChanged().subscribe(null,ee)}catch{}})()})}catch{}return()=>{O=!0,p.current=null,y.current=null}},[A,e,n,t,m,d]),C.useEffect(()=>{if(!A||!a)return;let O=!1;try{A.onChartReady(()=>{O||A.changeTheme(a).catch(()=>{})})}catch{}return()=>{O=!0}},[A,a]);const M=C.useCallback(()=>{P(!0)},[]),$=F?c.jsx("div",{className:"web-trading-widget-advanced__scan-limit-wrap",children:c.jsxs(IC,{variant:"destructive",className:"web-trading-widget-advanced__scan-limit-badge",children:[c.jsx("span",{className:"web-trading-widget-advanced__scan-limit-badge-title",children:"Daily scan limit reached"}),H&&c.jsxs("span",{className:"web-trading-widget-advanced__scan-limit-badge-count",children:[H.perDayUsage," of ",H.maxPerDayUsage," scans used today"]})]})}):null;return c.jsxs(c.Fragment,{children:[o??$,c.jsx(MC,{onLoad:M}),c.jsx("div",{ref:S,className:"web-trading-widget-advanced__container"})]})}const Vp=C.createContext(null);function Xd({value:e,children:t}){return c.jsx(Vp.Provider,{value:e,children:t})}function LT(){const e=C.useContext(Vp);if(!e)throw new Error("useWidgetChartSlot must be used within WidgetChartSlotProvider");return e}function Us(e,t){return e.toFixed(t)}function DT({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,isDragging:d,isCollapsed:f,onToggleCollapsed:u,onDragHandlePointerDown:g,onPlaceOrder:p}){const[y,m]=C.useState(!0),h=f??y,b=()=>{u==null||u(),f===void 0&&m(M=>!M)},v=ie(M=>M.setOrderSide),_=ie(M=>M.setVolumeLots),x=ie(M=>M.volumeLots),[S,T]=C.useState(String(x||r));C.useEffect(()=>{h||T(Us(x,2))},[h,x]);const P=Number(Vt(Ht(e))),A=t!==null?xe(t,P):"—",D=n!==null?xe(n,P):"—",N=!o&&!a&&l!==""&&(t!==null&&n!==null),L=M=>{const $=Number(S),O=Number.isFinite($)&&$>0?$:r,U=Math.max(i,O+M*s),W=Us(U,2);T(W),_(U)},H=()=>{const M=Number(S);if(!Number.isFinite(M)||M<=0){T(Us(r,2)),_(r);return}const $=Math.max(i,M),O=Us($,2);T(O),_($)},R=M=>{t===null||n===null||v({side:M,entryPrice:M==="buy"?n:t})},F=M=>{if(t===null||n===null||!l)return;const $=Number(S),O=Math.max(i,Number.isFinite($)&&$>0?$:r);v({side:M,entryPrice:M==="buy"?n:t}),p({login:l,side:M,volumeLots:O,bid:t,ask:n})};return c.jsx("div",{className:"web-trading-widget-mini-order web-trading-widget-mini-order--expanded",children:c.jsxs("div",{className:"web-trading-widget-mini-order__row",children:[c.jsx("button",{type:"button","aria-label":"Move quick order panel",onPointerDown:g,className:`web-trading-widget-mini-order__drag-handle${d?" web-trading-widget-mini-order__drag-handle--grabbing":""}`,children:c.jsx(Zf,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2})}),c.jsxs(c.Fragment,{children:[c.jsxs("button",{type:"button",disabled:!N,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--sell",onMouseDown:()=>R("sell"),onClick:()=>F("sell"),children:[c.jsx("span",{className:"web-trading-widget-mini-order__price",children:A}),c.jsx("span",{className:"web-trading-widget-mini-order__label web-trading-widget-mini-order__label--sell",children:"SELL"})]}),c.jsxs("div",{className:"web-trading-widget-mini-order__volume",children:[c.jsx("button",{type:"button","aria-label":"Decrease volume",disabled:!N,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>L(-1),children:c.jsx(oi,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})}),c.jsx("input",{type:"text",inputMode:"decimal",value:S,disabled:!N,onChange:M=>T(M.target.value),onBlur:H,className:"web-trading-widget-mini-order__volume-input"}),c.jsx("button",{type:"button","aria-label":"Increase volume",disabled:!N,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>L(1),children:c.jsx($o,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})})]}),c.jsxs("button",{type:"button",disabled:!N,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--buy",onMouseDown:()=>R("buy"),onClick:()=>F("buy"),children:[c.jsx("span",{className:"web-trading-widget-mini-order__label web-trading-widget-mini-order__label--buy",children:"BUY"}),c.jsx("span",{className:"web-trading-widget-mini-order__price",children:D})]})]}),c.jsx("button",{type:"button","aria-label":h?"Expand quick order panel":"Collapse quick order panel","aria-expanded":!h,className:"web-trading-widget-mini-order__toggle",onClick:b,children:h?c.jsx(oi,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5}):c.jsx($o,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5})})]})})}function Mr({title:e,isOpen:t,onToggle:n,children:r}){return c.jsxs("div",{className:"web-trading-widget-market-panel__accordion-item",children:[c.jsxs("button",{type:"button",className:`web-trading-widget-market-panel__accordion-trigger${t?" web-trading-widget-market-panel__accordion-trigger--open":""}`,"aria-expanded":t,onClick:n,children:[e,c.jsx(oi,{className:"web-trading-widget-icon web-trading-widget-icon--md web-trading-widget-text-muted"})]}),t?c.jsx("div",{className:"web-trading-widget-market-panel__accordion-content",children:r}):null]})}const jT=new Set(["volume-setting","risk-management"]);function IT({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,isDragging:d,onDragHandlePointerDown:f,onLayoutChange:u,onClose:g,onPlaceOrder:p}){const[y,m]=C.useState(!0),[h,b]=C.useState("market"),v=ie(te=>te.volumeLots),[_,x]=C.useState(String(v||r)),[S,T]=C.useState(""),[P,A]=C.useState(""),D=ie(te=>te.stopLoss),I=ie(te=>te.takeProfit),N=ie(te=>te.setStopLoss),L=ie(te=>te.setTakeProfit),H=ie(te=>te.setVolumeLots),R=ie(te=>te.setOrderSide),[F,M]=C.useState(""),[$,O]=C.useState(gt.GTC),[U,W]=C.useState(""),[j,ee]=C.useState(""),[J,de]=C.useState(()=>new Set(jT));C.useEffect(()=>{u()},[y,u]);const ue=Number(Vt(Ht(e))),V=Pr(ue),K=fc(t,n),se=t!==null?xe(t,ue):"—",Ee=n!==null?xe(n,ue):"—",le=Fi(h),oe=Qf(h),B=Mi(h),ve=B.label,ke=!le&&B.orderType!==null&&B.orderType%2===1,Pe=C.useMemo(()=>K!==null?K:t??n,[n,t,K]),X=te=>{de(Je=>{const zt=new Set(Je);return zt.has(te)?zt.delete(te):zt.add(te),zt})},Ne=te=>{x(te);const Je=Number(te);Number.isFinite(Je)&&Je>0&&H(Je)},Be=te=>t===null||n===null?null:le?te==="buy"?n:t:Ue(S)??(te==="buy"?n:t),Xe=te=>{const Je=Be(te);Je!==null&&R({side:te,entryPrice:Je})},ft=te=>{if(t===null||n===null||!l)return;const Je=Math.max(i,Number(_)||i),zt=Vo(h,te),Nr=Be(te);Nr!==null&&R({side:te,entryPrice:Nr}),p({login:l,executionMode:h,side:te,orderType:zt,volumeLots:Je,stopLoss:D,takeProfit:I,priceOrder:S,priceTrigger:P,comment:F,typeTime:$,expirationDateTime:U,expirationDay:j,bid:t,ask:n})},re=t!==null&&n!==null,Ve=le||Ue(S)!==void 0,Ji=!oe||Ue(P)!==void 0,vs=le||Bi($,U,j),bh=!o&&!a&&l!==""&&re&&Ve&&Ji&&vs,vh=!le&&lc($),wh=!le&&dc($),$c=()=>B.orderType!==null&&B.orderType%2===1?"sell":"buy";return c.jsxs("div",{className:`web-trading-widget-market-panel web-trading-widget-market-panel--modal${y?" web-trading-widget-market-panel--collapsed":""}`,children:[c.jsx(DT,{symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,isDragging:d,isCollapsed:y,onToggleCollapsed:()=>m(te=>!te),onDragHandlePointerDown:f,onPlaceOrder:({login:te,side:Je,volumeLots:zt,bid:Nr,ask:Vc})=>{Nr===null||Vc===null||p({login:te,executionMode:"market",side:Je,orderType:Vo("market",Je),volumeLots:zt,stopLoss:D,takeProfit:I,priceOrder:"",priceTrigger:"",comment:F,typeTime:$,expirationDateTime:"",expirationDay:"",bid:Nr,ask:Vc})}}),y?null:c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"web-trading-widget-market-panel__header",children:c.jsxs(si,{value:h,onValueChange:te=>b(te),children:[c.jsx(Kr,{className:"web-trading-widget-market-panel__select-trigger","aria-label":"Order execution type",children:c.jsx(ii,{})}),c.jsx(qr,{children:ai.map(te=>c.jsx(Gr,{value:te.mode,children:te.label},te.mode))})]})}),c.jsxs("div",{className:"web-trading-widget-market-panel__accordion",children:[c.jsx(Mr,{id:"volume-setting",title:"Volume Setting",isOpen:J.has("volume-setting"),onToggle:()=>X("volume-setting"),children:c.jsx(De,{label:"Lots",value:_,onChange:Ne,step:s,min:i,decimals:2})}),le?null:c.jsx(Mr,{id:"order-price",title:"Order Price",isOpen:J.has("order-price"),onToggle:()=>X("order-price"),children:oe?c.jsxs(c.Fragment,{children:[c.jsx(De,{label:"Stop Price",value:P,onChange:A,step:V,decimals:ue,basePrice:Pe,placeholder:K!==null?xe(K,ue):"—"}),c.jsx(De,{label:"Limit Price",value:S,onChange:T,step:V,decimals:ue,basePrice:Pe,placeholder:K!==null?xe(K,ue):"—"})]}):c.jsx(De,{label:"Price",value:S,onChange:T,step:V,decimals:ue,basePrice:Pe,placeholder:K!==null?xe(K,ue):"—"})}),c.jsx(Mr,{id:"risk-management",title:"Risk Management",isOpen:J.has("risk-management"),onToggle:()=>X("risk-management"),children:c.jsxs("div",{className:"web-trading-widget-market-panel__grid-2",children:[c.jsx(De,{label:"Stop Loss",value:D,onChange:N,step:V,decimals:ue,basePrice:t,placeholder:t!==null?se:"—",clearable:!0}),c.jsx(De,{label:"Take Profit",value:I,onChange:L,step:V,decimals:ue,basePrice:n,placeholder:n!==null?Ee:"—",clearable:!0})]})}),le?null:c.jsxs(Mr,{id:"expiration",title:"Expiration",isOpen:J.has("expiration"),onToggle:()=>X("expiration"),children:[c.jsx("select",{value:String($),className:"web-trading-widget-market-panel__select-full","aria-label":"Order expiration type",onChange:te=>O(Number(te.target.value)),children:Xf.map(te=>c.jsx("option",{value:String(te.value),children:te.label},te.value))}),vh?c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Expiration time"}),c.jsx("input",{type:"datetime-local",value:U,className:"web-trading-widget-market-panel__input",onChange:te=>W(te.target.value)})]}):null,wh?c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Expiration day"}),c.jsx("input",{type:"date",value:j,className:"web-trading-widget-market-panel__input",onChange:te=>ee(te.target.value)})]}):null]}),c.jsx(Mr,{id:"comment",title:"Comment",isOpen:J.has("comment"),onToggle:()=>X("comment"),children:c.jsx("input",{type:"text",value:F,className:"web-trading-widget-market-panel__input",placeholder:"",onChange:te=>M(te.target.value)})})]}),c.jsx("div",{className:"web-trading-widget-market-panel__footer",children:c.jsxs("div",{className:"web-trading-widget-market-panel__quotes",children:[c.jsx("span",{children:se}),c.jsx("span",{className:"web-trading-widget-market-panel__quotes-ask",children:Ee})]})}),!le&&c.jsxs("button",{type:"button",className:`web-trading-widget-market-panel__place-btn${ke?" web-trading-widget-market-panel__place-btn--sell":" web-trading-widget-market-panel__place-btn--buy"}`,disabled:!bh,onMouseDown:()=>Xe($c()),onClick:()=>ft($c()),children:["Place ",ve]})]})]})}function MT({symbolTicker:e,chartWidget:t,orderState:n}){const r=ys(),s=_c(e),{panel:i,confirmation:o,isSubmitting:a,defaultVolumeLots:l,volumeStep:d,minVolumeLots:f,selectedLogin:u,isAccountsLoading:g,hasConfirmedAccount:p,closePanels:y,dismissConfirmation:m,placeMarketOrder:h}=n,b=pe(j=>j.positions),v=pe(j=>j.orders),_=pe(j=>j.selectedPositionTicket),x=pe(j=>j.selectedOrderTicket),S=pe(j=>j.setSelectedPositionTicket),T=pe(j=>j.setSelectedOrderTicket),P=_!==null?b.find(j=>j.ticket===_)??null:null,A=x!==null?v.find(j=>j.ticket===x)??null:null,D=p&&i==="confirmation"&&o!==null,I=p&&i!=="confirmation"&&i!=="closed"&&P===null&&A===null,{panelRef:N,position:L,isDragging:H,onDragStart:R,reclamp:F}=sm({storageKey:"web-trading-widget-modal-exec-panel-position",defaultAlign:"top-right",isActive:I}),M=ie(j=>j.setDraft),$=ie(j=>j.clearDraft),O=Number(Vt(Ht(e))),U=Pr(O);C.useEffect(()=>{p&&M({source:"new-order",entryPrice:null,side:null,showEntryLine:!1,volumeLots:l,digits:O,priceStep:U})},[l,O,p,U,M]),C.useEffect(()=>{(i==="closed"||i==="confirmation")&&$()},[$,i]);const W=P!==null||A!==null;return!p&&!W?null:c.jsxs("div",{className:"web-trading-widget-new-order-overlay-layer",children:[c.jsx(Wm,{chartWidget:t,symbolTicker:e,symbols:r}),W&&P!==null?c.jsx("div",{className:"web-trading-widget-new-order-overlay web-trading-widget-new-order-overlay--news web-trading-widget-new-order-overlay--side-panel",children:c.jsx(jp,{position:P,onClose:()=>S(null)})}):null,W&&A!==null?c.jsx("div",{className:"web-trading-widget-new-order-overlay web-trading-widget-new-order-overlay--news web-trading-widget-new-order-overlay--side-panel",children:c.jsx(Dp,{order:A,onClose:()=>T(null)})}):null,D&&o!==null?c.jsx("div",{className:"web-trading-widget-new-order-overlay web-trading-widget-new-order-overlay--news",children:c.jsx(Lp,{confirmation:o,symbolTicker:e,onDismiss:m})}):null,I?c.jsx("div",{ref:N,style:{left:L.x,top:L.y},className:`web-trading-widget-new-order-overlay web-trading-widget-new-order-overlay--news web-trading-widget-new-order-overlay--draggable web-trading-widget-new-order-overlay--exec-panel${H?" web-trading-widget-new-order-overlay--dragging":""}`,children:c.jsx(IT,{symbolTicker:e,bid:(s==null?void 0:s.bid)??null,ask:(s==null?void 0:s.ask)??null,defaultVolumeLots:l,volumeStep:d,minVolumeLots:f,isSubmitting:a,isAccountsLoading:g,selectedLogin:u,isDragging:H,onDragHandlePointerDown:R,onLayoutChange:F,onClose:y,onPlaceOrder:j=>void h({symbolTicker:e,login:j.login,executionMode:j.executionMode,side:j.side,orderType:j.orderType,volumeLots:j.volumeLots,stopLoss:j.stopLoss,takeProfit:j.takeProfit,priceOrder:j.priceOrder,priceTrigger:j.priceTrigger,comment:j.comment,typeTime:j.typeTime,expirationDateTime:j.expirationDateTime,expirationDay:j.expirationDay,bid:j.bid,ask:j.ask})})}):null]})}const FT=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" aria-hidden="true">
|
|
82
82
|
<rect x="1" y="1" width="16" height="16" rx="5" fill="#3B82F6" fill-opacity="0.18" stroke="#3B82F6" stroke-width="1"/>
|
|
83
83
|
<circle cx="9" cy="6.5" r="2.5" fill="none" stroke="#3B82F6" stroke-width="1.5"/>
|
|
84
84
|
<path d="M4 14.5c0-2.8 2.2-5 5-5s5 2.2 5 5" fill="none" stroke="#3B82F6" stroke-width="1.5" stroke-linecap="round"/>
|
|
85
|
-
</svg>`,
|
|
85
|
+
</svg>`,Hp=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" aria-hidden="true">
|
|
86
86
|
<circle cx="9" cy="9" r="6.5" fill="none" stroke="currentColor" stroke-width="1.5" stroke-opacity="0.25"/>
|
|
87
87
|
<path d="M9 2.5a6.5 6.5 0 0 1 6.5 6.5" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
88
|
-
</svg>`,
|
|
88
|
+
</svg>`,UT=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" aria-hidden="true">
|
|
89
89
|
<path d="M4.5 9.25 7.5 12.25 13.5 6.25" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/>
|
|
90
|
-
</svg>`,Mm="data-opheleo-account-dropdown",NE="148px",kE=640,RE="MT5",qd=new WeakMap,Fm=new WeakMap;function LE(e){e.classList.add("apply-common-tooltip"),e.style.display="inline-flex",e.style.alignItems="center",e.style.gap="6px",e.style.padding="0 8px",e.style.height="34px",e.style.cursor="pointer",e.style.border="none",e.style.background="transparent",e.style.color="inherit",e.style.fontSize="13px",e.style.fontWeight="400",e.style.whiteSpace="nowrap"}function DE(e){const t=new Set([document,e.ownerDocument]),n=e.querySelector("iframe");return n instanceof HTMLIFrameElement&&n.contentDocument&&t.add(n.contentDocument),[...t]}function Um(e){if(!e)return!1;const t=e.querySelector("iframe");return(t instanceof HTMLIFrameElement?t.clientWidth:e.clientWidth)<kE}function jE(e){e.classList.forEach(t=>{t.includes("iconOnly")&&e.classList.remove(t)})}function IE(e,t){e.querySelectorAll("svg").forEach(n=>{n.style.display=t?"none":""})}function ME(e,t){jE(e),e.style.flexShrink="0",e.style.minWidth=t?"auto":NE,e.style.width="auto",e.style.maxWidth="none",e.style.overflow="visible",e.querySelectorAll("span, div").forEach(n=>{!(n instanceof HTMLElement)||n.querySelector("svg")||(n.style.display="",n.style.visibility="visible",n.style.opacity="1",n.style.maxWidth="none",n.style.overflow="visible",n.style.textOverflow="clip")}),IE(e,t)}function FE(e){const[t]=e.label.split(" · ");return t??e.label}function UE(e){return`${RE} ${e.login}`}function BE(e){return`${e.label} — ${e.balance.toFixed(2)} ${e.currency}`}function $E(e,t){const n=FE(e),r=`${e.balance.toFixed(2)} ${e.currency}`;return`${e.login} · ${n} (${r})${t?" · Active":""}`}function Dc(e){return e.accountOptions.length===0?null:e.accountOptions.find(t=>t.login===e.selectedLogin)??e.accountOptions[0]}function Bm(e){return e.isAccountsLoading||e.isAccountDataLoading}function VE(e){if(e.isAccountsLoading||e.accountOptions.length===0)return"";const t=Dc(e);return t?UE(t):""}function HE(e){if(e.isAccountsLoading)return"Loading accounts…";if(e.isAccountDataLoading)return"Switching account…";const t=Dc(e);return t?BE(t):"Select your trading account"}function zE(e,t){if(!t)return Bm(e)?Im:AE}function WE(e,t){return e.isAccountsLoading?[{title:"Loading accounts…",onSelect:()=>{}}]:e.isAccountDataLoading?[{title:"Switching account…",onSelect:()=>{}}]:e.accountOptions.length===0?[{title:"No trading accounts",onSelect:()=>{}}]:e.accountOptions.map(n=>{const r=n.login===e.selectedLogin;return{title:$E(n,r),icon:r?OE:void 0,onSelect:()=>{r||t(n.login)}}})}function KE(e){for(const t of DE(e)){const n=t.querySelector(`[${Mm}="true"]`);if(n instanceof HTMLElement)return n;for(const r of t.querySelectorAll("svg")){if(!(r.querySelector('rect[rx="5"]')instanceof SVGRectElement))continue;let s=r.parentElement;for(;s&&s!==t.body;){if(s.tagName==="BUTTON"||s.getAttribute("role")==="button")return s;s=s.parentElement}}}return null}function qE(e){e.style.removeProperty("background"),e.style.removeProperty("border"),e.style.removeProperty("border-radius"),e.style.removeProperty("padding"),e.style.removeProperty("font-weight"),e.style.removeProperty("color"),e.style.removeProperty("box-shadow")}function GE(e,t,n){e.setAttribute(Mm,"true"),LE(e),ME(e,n);const r=Dc(t);if(!Bm(t)&&r!==null){e.style.background="rgba(59, 130, 246, 0.14)",e.style.border="1px solid rgba(59, 130, 246, 0.5)",e.style.borderRadius="6px",e.style.padding="0 10px",e.style.fontWeight="600",e.style.color="#3B82F6",e.style.boxShadow="0 0 0 1px rgba(59, 130, 246, 0.08)";return}qE(e),e.style.border="1px solid transparent",e.style.borderRadius="6px",e.style.padding="0 10px"}function ZE(e,t){if(!(e!=null&&e.isConnected))return;const n=Um(e),r=()=>{const s=KE(e);s&&GE(s,t,n)};r(),requestAnimationFrame(r)}function YE(e){if(qd.has(e))return;const t=new ResizeObserver(()=>{const r=Fm.get(e);r&&$m(r.dropdown,r.state,r.onLoginChange,e)});t.observe(e);const n=e.querySelector("iframe");n instanceof HTMLIFrameElement&&t.observe(n),qd.set(e,t)}function $m(e,t,n,r){const s=Um(r);try{e.applyOptions({title:VE(t),tooltip:HE(t),icon:zE(t,s),items:WE(t,n)})}catch{return}ZE(r,t)}async function QE(e,t=()=>!0){try{await e.headerReady()}catch{return null}if(!t())return null;try{return await e.createDropdown({title:"",tooltip:"Select your trading account",align:"left",icon:Im,items:[{title:"Loading accounts…",onSelect:()=>{}}]})}catch{return null}}function Gd(e,t,n,r){!e||(r==null?void 0:r.isConnected)===!1||(r&&(Fm.set(r,{dropdown:e,state:t,onLoginChange:n}),YE(r)),$m(e,t,n,r??null))}var jc="ToastProvider",[Ic,XE,JE]=Ia("Toast"),[Vm]=Bn("Toast",[JE]),[eT,Zi]=Vm(jc),Hm=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:s="right",swipeThreshold:i=50,announcerContainer:o,children:a}=e,[l,d]=w.useState(null),[f,u]=w.useState(0),y=w.useRef(!1),m=w.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${jc}\`. Expected non-empty \`string\`.`),c.jsx(Ic.Provider,{scope:t,children:c.jsx(eT,{scope:t,label:n,duration:r,swipeDirection:s,swipeThreshold:i,toastCount:f,viewport:l,onViewportChange:d,onToastAdd:w.useCallback(()=>u(g=>g+1),[]),onToastRemove:w.useCallback(()=>u(g=>g-1),[]),isFocusedToastEscapeKeyDownRef:y,isClosePausedRef:m,announcerContainer:o,children:a})})};Hm.displayName=jc;var zm="ToastViewport",tT=["F8"],xa="toast.viewportPause",Sa="toast.viewportResume",Wm=w.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=tT,label:s="Notifications ({hotkey})",...i}=e,o=Zi(zm,n),a=XE(n),l=w.useRef(null),d=w.useRef(null),f=w.useRef(null),u=w.useRef(null),y=Ne(t,u,o.onViewportChange),m=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),g=o.toastCount>0;w.useEffect(()=>{const h=b=>{var _;r.length!==0&&r.every(x=>b[x]||b.code===x)&&((_=u.current)==null||_.focus())};return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[r]),w.useEffect(()=>{const h=l.current,b=u.current;if(g&&h&&b){const v=()=>{if(!o.isClosePausedRef.current){const T=new CustomEvent(xa);b.dispatchEvent(T),o.isClosePausedRef.current=!0}},_=()=>{if(o.isClosePausedRef.current){const T=new CustomEvent(Sa);b.dispatchEvent(T),o.isClosePausedRef.current=!1}},x=T=>{!h.contains(T.relatedTarget)&&_()},S=()=>{h.contains(document.activeElement)||_()};return h.addEventListener("focusin",v),h.addEventListener("focusout",x),h.addEventListener("pointermove",v),h.addEventListener("pointerleave",S),window.addEventListener("blur",v),window.addEventListener("focus",_),()=>{h.removeEventListener("focusin",v),h.removeEventListener("focusout",x),h.removeEventListener("pointermove",v),h.removeEventListener("pointerleave",S),window.removeEventListener("blur",v),window.removeEventListener("focus",_)}}},[g,o.isClosePausedRef]);const p=w.useCallback(({tabbingDirection:h})=>{const v=a().map(_=>{const x=_.ref.current,S=[x,...mT(x)];return h==="forwards"?S:S.reverse()});return(h==="forwards"?v.reverse():v).flat()},[a]);return w.useEffect(()=>{const h=u.current;if(h){const b=v=>{var S,T,P;const _=v.altKey||v.ctrlKey||v.metaKey;if(v.key==="Tab"&&!_){const O=document.activeElement,R=v.shiftKey;if(v.target===h&&R){(S=d.current)==null||S.focus();return}const j=p({tabbingDirection:R?"backwards":"forwards"}),H=j.findIndex(k=>k===O);Po(j.slice(H+1))?v.preventDefault():R?(T=d.current)==null||T.focus():(P=f.current)==null||P.focus()}};return h.addEventListener("keydown",b),()=>h.removeEventListener("keydown",b)}},[a,p]),c.jsxs(_g,{ref:l,role:"region","aria-label":s.replace("{hotkey}",m),tabIndex:-1,style:{pointerEvents:g?void 0:"none"},children:[g&&c.jsx(Ca,{ref:d,onFocusFromOutsideViewport:()=>{const h=p({tabbingDirection:"forwards"});Po(h)}}),c.jsx(Ic.Slot,{scope:n,children:c.jsx(pe.ol,{tabIndex:-1,...i,ref:y})}),g&&c.jsx(Ca,{ref:f,onFocusFromOutsideViewport:()=>{const h=p({tabbingDirection:"backwards"});Po(h)}})]})});Wm.displayName=zm;var Km="ToastFocusProxy",Ca=w.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...s}=e,i=Zi(Km,n);return c.jsx(Ka,{tabIndex:0,...s,ref:t,style:{position:"fixed"},onFocus:o=>{var d;const a=o.relatedTarget;!((d=i.viewport)!=null&&d.contains(a))&&r()}})});Ca.displayName=Km;var ps="Toast",nT="toast.swipeStart",rT="toast.swipeMove",sT="toast.swipeCancel",iT="toast.swipeEnd",qm=w.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:s,onOpenChange:i,...o}=e,[a,l]=Ln({prop:r,defaultProp:s??!0,onChange:i,caller:ps});return c.jsx($n,{present:n||a,children:c.jsx(cT,{open:a,...o,ref:t,onClose:()=>l(!1),onPause:gt(e.onPause),onResume:gt(e.onResume),onSwipeStart:fe(e.onSwipeStart,d=>{d.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:fe(e.onSwipeMove,d=>{const{x:f,y:u}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","move"),d.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${f}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${u}px`)}),onSwipeCancel:fe(e.onSwipeCancel,d=>{d.currentTarget.setAttribute("data-swipe","cancel"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:fe(e.onSwipeEnd,d=>{const{x:f,y:u}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","end"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${f}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${u}px`),l(!1)})})})});qm.displayName=ps;var[oT,aT]=Vm(ps,{onClose(){}}),cT=w.forwardRef((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:s,open:i,onClose:o,onEscapeKeyDown:a,onPause:l,onResume:d,onSwipeStart:f,onSwipeMove:u,onSwipeCancel:y,onSwipeEnd:m,...g}=e,p=Zi(ps,n),[h,b]=w.useState(null),v=Ne(t,k=>b(k)),_=w.useRef(null),x=w.useRef(null),S=s||p.duration,T=w.useRef(0),P=w.useRef(S),O=w.useRef(0),{onToastAdd:R,onToastRemove:M}=p,N=gt(()=>{var B;(h==null?void 0:h.contains(document.activeElement))&&((B=p.viewport)==null||B.focus()),o()}),j=w.useCallback(k=>{!k||k===1/0||(window.clearTimeout(O.current),T.current=new Date().getTime(),O.current=window.setTimeout(N,k))},[N]);w.useEffect(()=>{const k=p.viewport;if(k){const B=()=>{j(P.current),d==null||d()},F=()=>{const L=new Date().getTime()-T.current;P.current=P.current-L,window.clearTimeout(O.current),l==null||l()};return k.addEventListener(xa,F),k.addEventListener(Sa,B),()=>{k.removeEventListener(xa,F),k.removeEventListener(Sa,B)}}},[p.viewport,S,l,d,j]),w.useEffect(()=>{i&&!p.isClosePausedRef.current&&j(S)},[i,S,p.isClosePausedRef,j]),w.useEffect(()=>(R(),()=>M()),[R,M]);const H=w.useMemo(()=>h?eh(h):null,[h]);return p.viewport?c.jsxs(c.Fragment,{children:[H&&c.jsx(lT,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:H}),c.jsx(oT,{scope:n,onClose:N,children:Cr.createPortal(c.jsx(Ic.ItemSlot,{scope:n,children:c.jsx(wg,{asChild:!0,onEscapeKeyDown:fe(a,()=>{p.isFocusedToastEscapeKeyDownRef.current||N(),p.isFocusedToastEscapeKeyDownRef.current=!1}),children:c.jsx(pe.li,{tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":p.swipeDirection,...g,ref:v,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:fe(e.onKeyDown,k=>{k.key==="Escape"&&(a==null||a(k.nativeEvent),k.nativeEvent.defaultPrevented||(p.isFocusedToastEscapeKeyDownRef.current=!0,N()))}),onPointerDown:fe(e.onPointerDown,k=>{k.button===0&&(_.current={x:k.clientX,y:k.clientY})}),onPointerMove:fe(e.onPointerMove,k=>{if(!_.current)return;const B=k.clientX-_.current.x,F=k.clientY-_.current.y,L=!!x.current,D=["left","right"].includes(p.swipeDirection),$=["left","up"].includes(p.swipeDirection)?Math.min:Math.max,W=D?$(0,B):0,I=D?0:$(0,F),re=k.pointerType==="touch"?10:2,J={x:W,y:I},ue={originalEvent:k,delta:J};L?(x.current=J,Is(rT,u,ue,{discrete:!1})):Zd(J,p.swipeDirection,re)?(x.current=J,Is(nT,f,ue,{discrete:!1}),k.target.setPointerCapture(k.pointerId)):(Math.abs(B)>re||Math.abs(F)>re)&&(_.current=null)}),onPointerUp:fe(e.onPointerUp,k=>{const B=x.current,F=k.target;if(F.hasPointerCapture(k.pointerId)&&F.releasePointerCapture(k.pointerId),x.current=null,_.current=null,B){const L=k.currentTarget,D={originalEvent:k,delta:B};Zd(B,p.swipeDirection,p.swipeThreshold)?Is(iT,m,D,{discrete:!0}):Is(sT,y,D,{discrete:!0}),L.addEventListener("click",$=>$.preventDefault(),{once:!0})}})})})}),p.viewport)})]}):null}),lT=e=>{const{__scopeToast:t,children:n,...r}=e,s=Zi(ps,t),[i,o]=w.useState(!1),[a,l]=w.useState(!1);return fT(()=>o(!0)),w.useEffect(()=>{const d=window.setTimeout(()=>l(!0),1e3);return()=>window.clearTimeout(d)},[]),a?null:c.jsx(wi,{asChild:!0,container:s.announcerContainer||void 0,children:c.jsx(Ka,{...r,children:i&&c.jsxs(c.Fragment,{children:[s.label," ",n]})})})},dT="ToastTitle",Gm=w.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return c.jsx(pe.div,{...r,ref:t})});Gm.displayName=dT;var uT="ToastDescription",Zm=w.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return c.jsx(pe.div,{...r,ref:t})});Zm.displayName=uT;var Ym="ToastAction",Qm=w.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?c.jsx(Jm,{altText:n,asChild:!0,children:c.jsx(Mc,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${Ym}\`. Expected non-empty \`string\`.`),null)});Qm.displayName=Ym;var Xm="ToastClose",Mc=w.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,s=aT(Xm,n);return c.jsx(Jm,{asChild:!0,children:c.jsx(pe.button,{type:"button",...r,ref:t,onClick:fe(e.onClick,s.onClose)})})});Mc.displayName=Xm;var Jm=w.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...s}=e;return c.jsx(pe.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...s,ref:t})});function eh(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),pT(r)){const s=r.ariaHidden||r.hidden||r.style.display==="none",i=r.dataset.radixToastAnnounceExclude==="";if(!s)if(i){const o=r.dataset.radixToastAnnounceAlt;o&&t.push(o)}else t.push(...eh(r))}}),t}function Is(e,t,n,{discrete:r}){const s=n.originalEvent.currentTarget,i=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?hu(s,i):s.dispatchEvent(i)}var Zd=(e,t,n=0)=>{const r=Math.abs(e.x),s=Math.abs(e.y),i=r>s;return t==="left"||t==="right"?i&&r>n:!i&&s>n};function fT(e=()=>{}){const t=gt(e);Ie(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function pT(e){return e.nodeType===e.ELEMENT_NODE}function mT(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 Po(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var hT=Hm,th=Wm,nh=qm,rh=Gm,sh=Zm,ih=Qm,Yi=Mc;const gT=hT,oh=w.forwardRef(({className:e,...t},n)=>c.jsx(th,{ref:n,className:Ce("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse gap-2 p-4 sm:right-0 sm:top-[66px] sm:flex-col md:w-[520px]",e),...t}));oh.displayName=th.displayName;const yT=Ea("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground",warning:"bg-yellow-600 group border-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),ah=w.forwardRef(({className:e,variant:t,...n},r)=>c.jsx(nh,{ref:r,className:Ce(yT({variant:t}),e),...n}));ah.displayName=nh.displayName;const bT=w.forwardRef(({className:e,...t},n)=>c.jsx(ih,{ref:n,className:Ce("group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t}));bT.displayName=ih.displayName;const ch=w.forwardRef(({className:e,...t},n)=>c.jsx(Yi,{ref:n,className:Ce("text-foreground/50 rounded-md p-1 opacity-100 transition-opacity focus:opacity-100 focus:outline-none focus:ring-1",e),onClick:r=>{r.stopPropagation()},"toast-close":"",...t,children:c.jsx(Cv,{className:"h-4 min-h-4 w-4 min-w-4 text-black dark:text-white"})}));ch.displayName=Yi.displayName;const vT=w.forwardRef(({className:e,children:t,...n},r)=>c.jsx(Yi,{ref:r,className:Ce("text-foreground/50 rounded-md p-1 opacity-100 transition-opacity focus:opacity-100 focus:outline-none focus:ring-1",e),onClick:s=>{s.stopPropagation()},"toast-close":"",...n,children:t}));vT.displayName=Yi.displayName;const lh=w.forwardRef(({className:e,...t},n)=>c.jsx(rh,{ref:n,className:Ce("text-sm font-semibold [&+div]:text-base",e),...t}));lh.displayName=rh.displayName;const dh=w.forwardRef(({className:e,...t},n)=>c.jsx(sh,{ref:n,className:Ce("text-lg opacity-90 ",e),...t}));dh.displayName=sh.displayName;function wT(){const{toasts:e}=F0();return c.jsxs(gT,{children:[e.map(({id:t,title:n,description:r,action:s,...i})=>c.jsxs(ah,{...i,children:[c.jsxs("div",{className:"grid gap-1",children:[n?c.jsx(lh,{children:n}):null,r?c.jsx(dh,{children:r}):null]}),s,c.jsx(ch,{})]},t)),c.jsx(oh,{})]})}function _T(){const e=SE();return c.jsx(xE,{...e})}function xT({children:e,variant:t="chart",scanResultUrl:n,onScanResultUrlChange:r,onScanResultLoad:s,chartWidget:i,backUrl:o,createAccountUrl:a,dealDetailUrl:l}){const d=i!==void 0,f=fs(),u=SC({symbols:f,defaultPanelAfterConfirm:t==="news"?"market":"mini"}),y=C.useRef(null),m=C.useRef(null),[g,p]=C.useState(null),h=C.useCallback(z=>{p(z)},[]),[b,v]=C.useState(null),[_,x]=C.useState(null),S=d?i??null:b,[T,P]=C.useState(()=>pi(f)),[O,R]=C.useState(n??null),[M,N]=C.useState(()=>n?"scan":"trade");C.useEffect(()=>{R(n??null)},[n]),C.useEffect(()=>{N(O?"scan":"trade")},[O]);const j=C.useCallback(()=>{var z;N("trade"),(z=y.current)==null||z.open()},[]),{isLoading:H}=nm(u.selectedLogin),k=C.useRef(null),[B,F]=C.useState(u.selectedLogin),L=C.useCallback(z=>{z!==u.selectedLogin&&u.setSelectedLogin(z)},[u.selectedLogin,u.setSelectedLogin]),D=H&&u.selectedLogin!==B,$=C.useCallback(z=>{P(z)},[]),W=C.useCallback(z=>{R(z),r==null||r(z)},[r]),{chartContainer:I}=CC({chartWidget:d?S:null,symbols:f,chartSlotElement:d?g:null,onSymbolTickerChange:$,onScanResultUrlChange:W,selectSymbolTickerRef:m}),re=d?I:_,J=C.useCallback(z=>{var q;(q=m.current)==null||q.call(m,z)},[]),ue=C.useMemo(()=>({controlsRef:y,onSymbolTickerChange:$,onScanResultUrlChange:W,onChartWidgetChange:d?()=>{}:v,onChartContainerChange:d?()=>{}:x,selectSymbolTickerRef:m}),[W,$,d]);C.useEffect(()=>{if(t!=="news"){y.current=null;return}return y.current={open:u.openMarketPanel,setSelectedLogin:u.setSelectedLogin},()=>{y.current=null}},[u.openMarketPanel,u.setSelectedLogin,t]),C.useEffect(()=>{!H&&u.selectedLogin!==B&&F(u.selectedLogin)},[H,B,u.selectedLogin]),C.useEffect(()=>{var ie;if(!S||!u.hasConfirmedAccount){(ie=k.current)==null||ie.remove(),k.current=null;return}let z=!1;return(async()=>{try{const he=await QE(S,()=>!z);if(z){he==null||he.remove();return}k.current=he,Gd(k.current,{accountOptions:u.accountOptions,selectedLogin:u.selectedLogin,isAccountsLoading:u.isAccountsLoading,isAccountDataLoading:D},L,re)}catch{}})(),()=>{var he;z=!0,(he=k.current)==null||he.remove(),k.current=null}},[re,S,u.hasConfirmedAccount]),C.useEffect(()=>{u.hasConfirmedAccount&&Gd(k.current,{accountOptions:u.accountOptions,selectedLogin:u.selectedLogin,isAccountsLoading:u.isAccountsLoading,isAccountDataLoading:D},L,re)},[re,L,D,u.accountOptions,u.hasConfirmedAccount,u.isAccountsLoading,u.selectedLogin]);const me=e??(d?null:c.jsx(_T,{}));return t==="news"?c.jsx(Kd,{value:ue,children:c.jsxs("div",{className:"web-trading-widget-trading-layout web-trading-widget-trading-layout--news",children:[c.jsxs("div",{className:"web-trading-widget-trading-layout__chart-slot",children:[c.jsx(Lp,{}),c.jsx($f,{open:u.needsAccountSelection,isAccountsLoading:u.isAccountsLoading,accountOptions:u.accountOptions,onConfirm:u.confirmAccountSelection,backUrl:o,createAccountUrl:a}),c.jsxs("div",{className:"web-trading-widget-trading-layout__news-body",children:[d?c.jsx("div",{ref:h,className:"web-trading-widget-trading-layout__host-chart-slot",children:me}):me,c.jsx(PE,{symbolTicker:T,chartWidget:S,orderState:u})]})]}),c.jsx(am,{onCreateNewOrder:()=>{var z;return(z=y.current)==null?void 0:z.open()}})]})}):c.jsx(Kd,{value:ue,children:c.jsxs("div",{className:"web-trading-widget-trading-layout",children:[c.jsxs("div",{className:"web-trading-widget-trading-layout__body",children:[c.jsxs("div",{className:"web-trading-widget-trading-layout__chart-area",children:[c.jsx(m0,{controlsRef:y,symbolTicker:T,chartWidget:S,sidePanelTab:M,orderState:u,backUrl:o,createAccountUrl:a}),c.jsx("div",{ref:d?h:void 0,className:"web-trading-widget-trading-layout__chart-slot",children:me})]}),c.jsx(wC,{symbolTicker:T,orderState:u,scanResultUrl:O,activeTab:M,onTabChange:N,onScanResultLoad:s})]}),c.jsx(im,{symbolTicker:T,onSymbolChange:J,onCreateNewOrder:j,dealDetailUrl:l})]})})}function ST({baseUrl:e,token:t,variant:n="chart",scanResultUrl:r,onScanResultLoad:s,onScanResultUrlChange:i,children:o,chartWidget:a,backUrl:l,createAccountUrl:d,dealDetailUrl:f}){return c.jsx(IS,{token:t,children:c.jsx(om,{children:c.jsxs(kp,{baseUrl:e,children:[c.jsx(xT,{variant:n,scanResultUrl:r,onScanResultUrlChange:i,chartWidget:a,onScanResultLoad:s,backUrl:l,createAccountUrl:d,dealDetailUrl:f,children:o}),c.jsx(wT,{})]})})})}exports.ChartNewsOrdersOverlay=X0;exports.WebTradingWidget=ST;
|
|
90
|
+
</svg>`,zp="data-opheleo-account-dropdown",BT="148px",$T=640,VT="MT5",Jd=new WeakMap,Wp=new WeakMap;function HT(e){e.classList.add("apply-common-tooltip"),e.style.display="inline-flex",e.style.alignItems="center",e.style.gap="6px",e.style.padding="0 8px",e.style.height="34px",e.style.cursor="pointer",e.style.border="none",e.style.background="transparent",e.style.color="inherit",e.style.fontSize="13px",e.style.fontWeight="400",e.style.whiteSpace="nowrap"}function zT(e){const t=new Set([document,e.ownerDocument]),n=e.querySelector("iframe");return n instanceof HTMLIFrameElement&&n.contentDocument&&t.add(n.contentDocument),[...t]}function Kp(e){if(!e)return!1;const t=e.querySelector("iframe");return(t instanceof HTMLIFrameElement?t.clientWidth:e.clientWidth)<$T}function WT(e){e.classList.forEach(t=>{t.includes("iconOnly")&&e.classList.remove(t)})}function KT(e,t){e.querySelectorAll("svg").forEach(n=>{n.style.display=t?"none":""})}function qT(e,t){WT(e),e.style.flexShrink="0",e.style.minWidth=t?"auto":BT,e.style.width="auto",e.style.maxWidth="none",e.style.overflow="visible",e.querySelectorAll("span, div").forEach(n=>{!(n instanceof HTMLElement)||n.querySelector("svg")||(n.style.display="",n.style.visibility="visible",n.style.opacity="1",n.style.maxWidth="none",n.style.overflow="visible",n.style.textOverflow="clip")}),KT(e,t)}function GT(e){const[t]=e.label.split(" · ");return t??e.label}function ZT(e){return`${VT} ${e.login}`}function YT(e){return`${e.label} — ${e.balance.toFixed(2)} ${e.currency}`}function QT(e,t){const n=GT(e),r=`${e.balance.toFixed(2)} ${e.currency}`;return`${e.login} · ${n} (${r})${t?" · Active":""}`}function Mc(e){return e.accountOptions.length===0?null:e.accountOptions.find(t=>t.login===e.selectedLogin)??e.accountOptions[0]}function qp(e){return e.isAccountsLoading||e.isAccountDataLoading}function XT(e){if(e.isAccountsLoading||e.accountOptions.length===0)return"";const t=Mc(e);return t?ZT(t):""}function JT(e){if(e.isAccountsLoading)return"Loading accounts…";if(e.isAccountDataLoading)return"Switching account…";const t=Mc(e);return t?YT(t):"Select your trading account"}function eE(e,t){if(!t)return qp(e)?Hp:FT}function tE(e,t){return e.isAccountsLoading?[{title:"Loading accounts…",onSelect:()=>{}}]:e.isAccountDataLoading?[{title:"Switching account…",onSelect:()=>{}}]:e.accountOptions.length===0?[{title:"No trading accounts",onSelect:()=>{}}]:e.accountOptions.map(n=>{const r=n.login===e.selectedLogin;return{title:QT(n,r),icon:r?UT:void 0,onSelect:()=>{r||t(n.login)}}})}function nE(e){for(const t of zT(e)){const n=t.querySelector(`[${zp}="true"]`);if(n instanceof HTMLElement)return n;for(const r of t.querySelectorAll("svg")){if(!(r.querySelector('rect[rx="5"]')instanceof SVGRectElement))continue;let s=r.parentElement;for(;s&&s!==t.body;){if(s.tagName==="BUTTON"||s.getAttribute("role")==="button")return s;s=s.parentElement}}}return null}function rE(e){e.style.removeProperty("background"),e.style.removeProperty("border"),e.style.removeProperty("border-radius"),e.style.removeProperty("padding"),e.style.removeProperty("font-weight"),e.style.removeProperty("color"),e.style.removeProperty("box-shadow")}function sE(e,t,n){e.setAttribute(zp,"true"),HT(e),qT(e,n);const r=Mc(t);if(!qp(t)&&r!==null){e.style.background="rgba(59, 130, 246, 0.14)",e.style.border="1px solid rgba(59, 130, 246, 0.5)",e.style.borderRadius="6px",e.style.padding="0 10px",e.style.fontWeight="600",e.style.color="#3B82F6",e.style.boxShadow="0 0 0 1px rgba(59, 130, 246, 0.08)";return}rE(e),e.style.border="1px solid transparent",e.style.borderRadius="6px",e.style.padding="0 10px"}function iE(e,t){if(!(e!=null&&e.isConnected))return;const n=Kp(e),r=()=>{const s=nE(e);s&&sE(s,t,n)};r(),requestAnimationFrame(r)}function oE(e){if(Jd.has(e))return;const t=new ResizeObserver(()=>{const r=Wp.get(e);r&&Gp(r.dropdown,r.state,r.onLoginChange,e)});t.observe(e);const n=e.querySelector("iframe");n instanceof HTMLIFrameElement&&t.observe(n),Jd.set(e,t)}function Gp(e,t,n,r){const s=Kp(r);try{e.applyOptions({title:XT(t),tooltip:JT(t),icon:eE(t,s),items:tE(t,n)})}catch{return}iE(r,t)}async function aE(e,t=()=>!0){try{await e.headerReady()}catch{return null}if(!t())return null;try{return await e.createDropdown({title:"",tooltip:"Select your trading account",align:"left",icon:Hp,items:[{title:"Loading accounts…",onSelect:()=>{}}]})}catch{return null}}function eu(e,t,n,r){!e||(r==null?void 0:r.isConnected)===!1||(r&&(Wp.set(r,{dropdown:e,state:t,onLoginChange:n}),oE(r)),Gp(e,t,n,r??null))}var Fc="ToastProvider",[Uc,cE,lE]=Fa("Toast"),[Zp]=Bn("Toast",[lE]),[dE,Qi]=Zp(Fc),Yp=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:s="right",swipeThreshold:i=50,announcerContainer:o,children:a}=e,[l,d]=w.useState(null),[f,u]=w.useState(0),g=w.useRef(!1),p=w.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${Fc}\`. Expected non-empty \`string\`.`),c.jsx(Uc.Provider,{scope:t,children:c.jsx(dE,{scope:t,label:n,duration:r,swipeDirection:s,swipeThreshold:i,toastCount:f,viewport:l,onViewportChange:d,onToastAdd:w.useCallback(()=>u(y=>y+1),[]),onToastRemove:w.useCallback(()=>u(y=>y-1),[]),isFocusedToastEscapeKeyDownRef:g,isClosePausedRef:p,announcerContainer:o,children:a})})};Yp.displayName=Fc;var Qp="ToastViewport",uE=["F8"],Ca="toast.viewportPause",Ta="toast.viewportResume",Xp=w.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=uE,label:s="Notifications ({hotkey})",...i}=e,o=Qi(Qp,n),a=cE(n),l=w.useRef(null),d=w.useRef(null),f=w.useRef(null),u=w.useRef(null),g=Oe(t,u,o.onViewportChange),p=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),y=o.toastCount>0;w.useEffect(()=>{const h=b=>{var _;r.length!==0&&r.every(x=>b[x]||b.code===x)&&((_=u.current)==null||_.focus())};return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[r]),w.useEffect(()=>{const h=l.current,b=u.current;if(y&&h&&b){const v=()=>{if(!o.isClosePausedRef.current){const T=new CustomEvent(Ca);b.dispatchEvent(T),o.isClosePausedRef.current=!0}},_=()=>{if(o.isClosePausedRef.current){const T=new CustomEvent(Ta);b.dispatchEvent(T),o.isClosePausedRef.current=!1}},x=T=>{!h.contains(T.relatedTarget)&&_()},S=()=>{h.contains(document.activeElement)||_()};return h.addEventListener("focusin",v),h.addEventListener("focusout",x),h.addEventListener("pointermove",v),h.addEventListener("pointerleave",S),window.addEventListener("blur",v),window.addEventListener("focus",_),()=>{h.removeEventListener("focusin",v),h.removeEventListener("focusout",x),h.removeEventListener("pointermove",v),h.removeEventListener("pointerleave",S),window.removeEventListener("blur",v),window.removeEventListener("focus",_)}}},[y,o.isClosePausedRef]);const m=w.useCallback(({tabbingDirection:h})=>{const v=a().map(_=>{const x=_.ref.current,S=[x,...CE(x)];return h==="forwards"?S:S.reverse()});return(h==="forwards"?v.reverse():v).flat()},[a]);return w.useEffect(()=>{const h=u.current;if(h){const b=v=>{var S,T,P;const _=v.altKey||v.ctrlKey||v.metaKey;if(v.key==="Tab"&&!_){const A=document.activeElement,D=v.shiftKey;if(v.target===h&&D){(S=d.current)==null||S.focus();return}const L=m({tabbingDirection:D?"backwards":"forwards"}),H=L.findIndex(R=>R===A);Ao(L.slice(H+1))?v.preventDefault():D?(T=d.current)==null||T.focus():(P=f.current)==null||P.focus()}};return h.addEventListener("keydown",b),()=>h.removeEventListener("keydown",b)}},[a,m]),c.jsxs(kg,{ref:l,role:"region","aria-label":s.replace("{hotkey}",p),tabIndex:-1,style:{pointerEvents:y?void 0:"none"},children:[y&&c.jsx(Ea,{ref:d,onFocusFromOutsideViewport:()=>{const h=m({tabbingDirection:"forwards"});Ao(h)}}),c.jsx(Uc.Slot,{scope:n,children:c.jsx(he.ol,{tabIndex:-1,...i,ref:g})}),y&&c.jsx(Ea,{ref:f,onFocusFromOutsideViewport:()=>{const h=m({tabbingDirection:"backwards"});Ao(h)}})]})});Xp.displayName=Qp;var Jp="ToastFocusProxy",Ea=w.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...s}=e,i=Qi(Jp,n);return c.jsx(Ga,{tabIndex:0,...s,ref:t,style:{position:"fixed"},onFocus:o=>{var d;const a=o.relatedTarget;!((d=i.viewport)!=null&&d.contains(a))&&r()}})});Ea.displayName=Jp;var bs="Toast",fE="toast.swipeStart",mE="toast.swipeMove",pE="toast.swipeCancel",hE="toast.swipeEnd",eh=w.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:s,onOpenChange:i,...o}=e,[a,l]=Ln({prop:r,defaultProp:s??!0,onChange:i,caller:bs});return c.jsx($n,{present:n||a,children:c.jsx(bE,{open:a,...o,ref:t,onClose:()=>l(!1),onPause:yt(e.onPause),onResume:yt(e.onResume),onSwipeStart:me(e.onSwipeStart,d=>{d.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:me(e.onSwipeMove,d=>{const{x:f,y:u}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","move"),d.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${f}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${u}px`)}),onSwipeCancel:me(e.onSwipeCancel,d=>{d.currentTarget.setAttribute("data-swipe","cancel"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:me(e.onSwipeEnd,d=>{const{x:f,y:u}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","end"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${f}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${u}px`),l(!1)})})})});eh.displayName=bs;var[gE,yE]=Zp(bs,{onClose(){}}),bE=w.forwardRef((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:s,open:i,onClose:o,onEscapeKeyDown:a,onPause:l,onResume:d,onSwipeStart:f,onSwipeMove:u,onSwipeCancel:g,onSwipeEnd:p,...y}=e,m=Qi(bs,n),[h,b]=w.useState(null),v=Oe(t,R=>b(R)),_=w.useRef(null),x=w.useRef(null),S=s||m.duration,T=w.useRef(0),P=w.useRef(S),A=w.useRef(0),{onToastAdd:D,onToastRemove:I}=m,N=yt(()=>{var F;(h==null?void 0:h.contains(document.activeElement))&&((F=m.viewport)==null||F.focus()),o()}),L=w.useCallback(R=>{!R||R===1/0||(window.clearTimeout(A.current),T.current=new Date().getTime(),A.current=window.setTimeout(N,R))},[N]);w.useEffect(()=>{const R=m.viewport;if(R){const F=()=>{L(P.current),d==null||d()},M=()=>{const $=new Date().getTime()-T.current;P.current=P.current-$,window.clearTimeout(A.current),l==null||l()};return R.addEventListener(Ca,M),R.addEventListener(Ta,F),()=>{R.removeEventListener(Ca,M),R.removeEventListener(Ta,F)}}},[m.viewport,S,l,d,L]),w.useEffect(()=>{i&&!m.isClosePausedRef.current&&L(S)},[i,S,m.isClosePausedRef,L]),w.useEffect(()=>(D(),()=>I()),[D,I]);const H=w.useMemo(()=>h?ah(h):null,[h]);return m.viewport?c.jsxs(c.Fragment,{children:[H&&c.jsx(vE,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:H}),c.jsx(gE,{scope:n,onClose:N,children:Cr.createPortal(c.jsx(Uc.ItemSlot,{scope:n,children:c.jsx(Pg,{asChild:!0,onEscapeKeyDown:me(a,()=>{m.isFocusedToastEscapeKeyDownRef.current||N(),m.isFocusedToastEscapeKeyDownRef.current=!1}),children:c.jsx(he.li,{tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":m.swipeDirection,...y,ref:v,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:me(e.onKeyDown,R=>{R.key==="Escape"&&(a==null||a(R.nativeEvent),R.nativeEvent.defaultPrevented||(m.isFocusedToastEscapeKeyDownRef.current=!0,N()))}),onPointerDown:me(e.onPointerDown,R=>{R.button===0&&(_.current={x:R.clientX,y:R.clientY})}),onPointerMove:me(e.onPointerMove,R=>{if(!_.current)return;const F=R.clientX-_.current.x,M=R.clientY-_.current.y,$=!!x.current,O=["left","right"].includes(m.swipeDirection),U=["left","up"].includes(m.swipeDirection)?Math.min:Math.max,W=O?U(0,F):0,j=O?0:U(0,M),ee=R.pointerType==="touch"?10:2,J={x:W,y:j},de={originalEvent:R,delta:J};$?(x.current=J,Bs(mE,u,de,{discrete:!1})):tu(J,m.swipeDirection,ee)?(x.current=J,Bs(fE,f,de,{discrete:!1}),R.target.setPointerCapture(R.pointerId)):(Math.abs(F)>ee||Math.abs(M)>ee)&&(_.current=null)}),onPointerUp:me(e.onPointerUp,R=>{const F=x.current,M=R.target;if(M.hasPointerCapture(R.pointerId)&&M.releasePointerCapture(R.pointerId),x.current=null,_.current=null,F){const $=R.currentTarget,O={originalEvent:R,delta:F};tu(F,m.swipeDirection,m.swipeThreshold)?Bs(hE,p,O,{discrete:!0}):Bs(pE,g,O,{discrete:!0}),$.addEventListener("click",U=>U.preventDefault(),{once:!0})}})})})}),m.viewport)})]}):null}),vE=e=>{const{__scopeToast:t,children:n,...r}=e,s=Qi(bs,t),[i,o]=w.useState(!1),[a,l]=w.useState(!1);return xE(()=>o(!0)),w.useEffect(()=>{const d=window.setTimeout(()=>l(!0),1e3);return()=>window.clearTimeout(d)},[]),a?null:c.jsx(Si,{asChild:!0,container:s.announcerContainer||void 0,children:c.jsx(Ga,{...r,children:i&&c.jsxs(c.Fragment,{children:[s.label," ",n]})})})},wE="ToastTitle",th=w.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return c.jsx(he.div,{...r,ref:t})});th.displayName=wE;var _E="ToastDescription",nh=w.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return c.jsx(he.div,{...r,ref:t})});nh.displayName=_E;var rh="ToastAction",sh=w.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?c.jsx(oh,{altText:n,asChild:!0,children:c.jsx(Bc,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${rh}\`. Expected non-empty \`string\`.`),null)});sh.displayName=rh;var ih="ToastClose",Bc=w.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,s=yE(ih,n);return c.jsx(oh,{asChild:!0,children:c.jsx(he.button,{type:"button",...r,ref:t,onClick:me(e.onClick,s.onClose)})})});Bc.displayName=ih;var oh=w.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...s}=e;return c.jsx(he.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...s,ref:t})});function ah(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),SE(r)){const s=r.ariaHidden||r.hidden||r.style.display==="none",i=r.dataset.radixToastAnnounceExclude==="";if(!s)if(i){const o=r.dataset.radixToastAnnounceAlt;o&&t.push(o)}else t.push(...ah(r))}}),t}function Bs(e,t,n,{discrete:r}){const s=n.originalEvent.currentTarget,i=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?_u(s,i):s.dispatchEvent(i)}var tu=(e,t,n=0)=>{const r=Math.abs(e.x),s=Math.abs(e.y),i=r>s;return t==="left"||t==="right"?i&&r>n:!i&&s>n};function xE(e=()=>{}){const t=yt(e);Ie(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function SE(e){return e.nodeType===e.ELEMENT_NODE}function CE(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 Ao(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var TE=Yp,ch=Xp,lh=eh,dh=th,uh=nh,fh=sh,Xi=Bc;const EE=TE,mh=w.forwardRef(({className:e,...t},n)=>c.jsx(ch,{ref:n,className:Te("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse gap-2 p-4 sm:right-0 sm:top-[66px] sm:flex-col md:w-[520px]",e),...t}));mh.displayName=ch.displayName;const PE=Pa("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground",warning:"bg-yellow-600 group border-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),ph=w.forwardRef(({className:e,variant:t,...n},r)=>c.jsx(lh,{ref:r,className:Te(PE({variant:t}),e),...n}));ph.displayName=lh.displayName;const kE=w.forwardRef(({className:e,...t},n)=>c.jsx(fh,{ref:n,className:Te("group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t}));kE.displayName=fh.displayName;const hh=w.forwardRef(({className:e,...t},n)=>c.jsx(Xi,{ref:n,className:Te("text-foreground/50 rounded-md p-1 opacity-100 transition-opacity focus:opacity-100 focus:outline-none focus:ring-1",e),onClick:r=>{r.stopPropagation()},"toast-close":"",...t,children:c.jsx(Nv,{className:"h-4 min-h-4 w-4 min-w-4 text-black dark:text-white"})}));hh.displayName=Xi.displayName;const AE=w.forwardRef(({className:e,children:t,...n},r)=>c.jsx(Xi,{ref:r,className:Te("text-foreground/50 rounded-md p-1 opacity-100 transition-opacity focus:opacity-100 focus:outline-none focus:ring-1",e),onClick:s=>{s.stopPropagation()},"toast-close":"",...n,children:t}));AE.displayName=Xi.displayName;const gh=w.forwardRef(({className:e,...t},n)=>c.jsx(dh,{ref:n,className:Te("text-sm font-semibold [&+div]:text-base",e),...t}));gh.displayName=dh.displayName;const yh=w.forwardRef(({className:e,...t},n)=>c.jsx(uh,{ref:n,className:Te("text-lg opacity-90 ",e),...t}));yh.displayName=uh.displayName;function OE(){const{toasts:e}=K0();return c.jsxs(EE,{children:[e.map(({id:t,title:n,description:r,action:s,...i})=>c.jsxs(ph,{...i,children:[c.jsxs("div",{className:"grid gap-1",children:[n?c.jsx(gh,{children:n}):null,r?c.jsx(yh,{children:r}):null]}),s,c.jsx(hh,{})]},t)),c.jsx(mh,{})]})}function NE(){const e=LT();return c.jsx(RT,{...e})}function RE({children:e,variant:t="chart",scanResultUrl:n,onScanResultUrlChange:r,onScanResultLoad:s,chartWidget:i,backUrl:o,createAccountUrl:a,dealDetailUrl:l}){const d=i!==void 0,f=ys(),u=LC({symbols:f,defaultPanelAfterConfirm:t==="news"?"market":"mini"}),g=C.useRef(null),p=C.useRef(null),[y,m]=C.useState(null),h=C.useCallback(V=>{m(V)},[]),[b,v]=C.useState(null),[_,x]=C.useState(null),S=d?i??null:b,[T,P]=C.useState(()=>gi(f)),[A,D]=C.useState(n??null),[I,N]=C.useState(()=>n?"scan":"trade");C.useEffect(()=>{D(n??null)},[n]),C.useEffect(()=>{N(A?"scan":"trade")},[A]);const L=C.useCallback(()=>{var V;N("trade"),(V=g.current)==null||V.open()},[]),{isLoading:H}=lp(u.selectedLogin),R=C.useRef(null),[F,M]=C.useState(u.selectedLogin),$=C.useCallback(V=>{V!==u.selectedLogin&&u.setSelectedLogin(V)},[u.selectedLogin,u.setSelectedLogin]),O=H&&u.selectedLogin!==F,U=C.useCallback(V=>{P(V)},[]),W=C.useCallback(V=>{D(V),r==null||r(V)},[r]),{chartContainer:j}=DC({chartWidget:d?S:null,symbols:f,chartSlotElement:d?y:null,onSymbolTickerChange:U,onScanResultUrlChange:W,selectSymbolTickerRef:p}),ee=d?j:_,J=C.useCallback(V=>{var K;(K=p.current)==null||K.call(p,V)},[]),de=C.useMemo(()=>({controlsRef:g,onSymbolTickerChange:U,onScanResultUrlChange:W,onChartWidgetChange:d?()=>{}:v,onChartContainerChange:d?()=>{}:x,selectSymbolTickerRef:p}),[W,U,d]);C.useEffect(()=>{if(t==="news")return g.current={open:u.openMarketPanel,setSelectedLogin:u.setSelectedLogin},()=>{g.current=null}},[u.openMarketPanel,u.setSelectedLogin,t]),C.useEffect(()=>{!H&&u.selectedLogin!==F&&M(u.selectedLogin)},[H,F,u.selectedLogin]),C.useEffect(()=>{if(!S)return;let V=!1;return(async()=>{try{const se=await aE(S,()=>!V);if(V){se==null||se.remove();return}R.current=se,eu(R.current,{accountOptions:u.accountOptions,selectedLogin:u.selectedLogin,isAccountsLoading:u.isAccountsLoading,isAccountDataLoading:O},$,ee)}catch{}})(),()=>{var se;V=!0,(se=R.current)==null||se.remove(),R.current=null}},[ee,S]),C.useEffect(()=>{eu(R.current,{accountOptions:u.accountOptions,selectedLogin:u.selectedLogin,isAccountsLoading:u.isAccountsLoading,isAccountDataLoading:O},$,ee)},[ee,$,O,u.accountOptions,u.isAccountsLoading,u.selectedLogin]);const ue=e??(d?null:c.jsx(NE,{}));return t==="news"?c.jsx(Xd,{value:de,children:c.jsxs("div",{className:"web-trading-widget-trading-layout web-trading-widget-trading-layout--news",children:[c.jsxs("div",{className:"web-trading-widget-trading-layout__chart-slot",children:[c.jsx(Fm,{}),c.jsx(qf,{open:u.needsAccountSelection,isAccountsLoading:u.isAccountsLoading,accountOptions:u.accountOptions,onConfirm:u.confirmAccountSelection,backUrl:o,createAccountUrl:a}),c.jsxs("div",{className:"web-trading-widget-trading-layout__news-body",children:[d?c.jsx("div",{ref:h,className:"web-trading-widget-trading-layout__host-chart-slot",children:ue}):ue,c.jsx(MT,{symbolTicker:T,chartWidget:S,orderState:u})]})]}),c.jsx(pp,{onCreateNewOrder:()=>{var V;return(V=g.current)==null?void 0:V.open()}})]})}):c.jsx(Xd,{value:de,children:c.jsxs("div",{className:"web-trading-widget-trading-layout",children:[c.jsxs("div",{className:"web-trading-widget-trading-layout__body",children:[c.jsxs("div",{className:"web-trading-widget-trading-layout__chart-area",children:[c.jsx(x0,{controlsRef:g,symbolTicker:T,chartWidget:S,sidePanelTab:I,orderState:u,backUrl:o,createAccountUrl:a}),c.jsx("div",{ref:d?h:void 0,className:"web-trading-widget-trading-layout__chart-slot",children:ue})]}),c.jsx(OC,{symbolTicker:T,orderState:u,scanResultUrl:A,activeTab:I,onTabChange:N,onScanResultLoad:s})]}),c.jsx(fp,{symbolTicker:T,onSymbolChange:J,onCreateNewOrder:L,dealDetailUrl:l})]})})}function LE({baseUrl:e,token:t,variant:n="chart",scanResultUrl:r,onScanResultLoad:s,onScanResultUrlChange:i,children:o,chartWidget:a,backUrl:l,createAccountUrl:d,dealDetailUrl:f}){return c.jsx(WS,{token:t,children:c.jsx(mp,{children:c.jsxs(Im,{baseUrl:e,children:[c.jsx(RE,{variant:n,scanResultUrl:r,onScanResultUrlChange:i,chartWidget:a,onScanResultLoad:s,backUrl:l,createAccountUrl:d,dealDetailUrl:f,children:o}),c.jsx(OE,{})]})})})}exports.ChartNewsOrdersOverlay=oC;exports.WebTradingWidget=LE;
|