@iccandle/widget-web-trading 0.0.9 → 0.1.0

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.
@@ -1,5 +1,5 @@
1
- "use strict";var ih=Object.defineProperty;var Lc=e=>{throw TypeError(e)};var oh=(e,t,n)=>t in e?ih(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var st=(e,t,n)=>oh(e,typeof t!="symbol"?t+"":t,n),Zi=(e,t,n)=>t.has(e)||Lc("Cannot "+n);var E=(e,t,n)=>(Zi(e,t,"read from private field"),n?n.call(e):t.get(e)),ne=(e,t,n)=>t.has(e)?Lc("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),W=(e,t,n,r)=>(Zi(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),he=(e,t,n)=>(Zi(e,t,"access private method"),n);var fs=(e,t,n,r)=>({set _(s){W(e,t,s,n)},get _(){return E(e,t,r)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),S=require("react"),ah=require("react-dom");function Qd(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=Qd(S),Cr=Qd(ah);function jc(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=jc(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():jc(e[s],null)}}}}function Pe(...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=[];Ic(s)&&typeof ps=="function"&&(s=ps(s._payload)),w.Children.forEach(s,h=>{var m;if(mh(h)){a=!0;const g=h;let p="child"in g.props?g.props.child:g.props.children;Ic(p)&&typeof ps=="function"&&(p=ps(p._payload)),o=uh(g,p),l.push((m=o==null?void 0:o.props)==null?void 0:m.children)}else l.push(h)}),o?o=w.cloneElement(o,void 0,l):!a&&w.Children.count(s)===1&&w.isValidElement(s)&&(o=s);const d=o?ph(o):void 0,u=Pe(r,d);if(!o){if(s||s===0)throw new Error(a?bh(e):yh(e));return s}const f=fh(i,o.props??{});return o.type!==w.Fragment&&(f.ref=r?u:d),w.cloneElement(o,f)});return t.displayName=`${e}.Slot`,t}var lh=mr("Slot"),dh=Symbol.for("radix.slottable"),uh=(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 fh(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 ph(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 mh(e){return w.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===dh}var hh=Symbol.for("react.lazy");function Ic(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===hh&&"_payload"in e&&gh(e._payload)}function gh(e){return typeof e=="object"&&e!==null&&"then"in e}var yh=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,bh=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,ps=w[" use ".trim().toString()];function Xd(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=Xd(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Jd(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=Xd(e))&&(r&&(r+=" "),r+=t);return r}const Mc=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Fc=Jd,xa=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return Fc(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 u=n==null?void 0:n[d],f=i==null?void 0:i[d];if(u===null)return null;const h=Mc(u)||Mc(f);return s[d][h]}),a=n&&Object.entries(n).reduce((d,u)=>{let[f,h]=u;return h===void 0||(d[f]=h),d},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,u)=>{let{class:f,className:h,...m}=u;return Object.entries(m).every(g=>{let[p,y]=g;return Array.isArray(y)?y.includes({...i,...a}[p]):{...i,...a}[p]===y})?[...d,f,h]:d},[]);return Fc(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"}],vh={[-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 wh(){const e=-new Date().getTimezoneOffset()/60,t=vh[e];return t&&t.length>0?t[0]:"Etc/UTC"}const Xn="tv:latest-symbol";function _h(){for(var e=0,t,n,r="";e<arguments.length;)(t=arguments[e++])&&(n=eu(t))&&(r&&(r+=" "),r+=n);return r}function eu(e){if(typeof e=="string")return e;for(var t,n="",r=0;r<e.length;r++)e[r]&&(t=eu(e[r]))&&(n&&(n+=" "),n+=t);return n}var Sa="-";function xh(e){var t=Ch(e),n=e.conflictingClassGroups,r=e.conflictingClassGroupModifiers,s=r===void 0?{}:r;function i(a){var l=a.split(Sa);return l[0]===""&&l.length!==1&&l.shift(),tu(l,t)||Sh(a)}function o(a,l){var d=n[a]||[];return l&&s[a]?[].concat(d,s[a]):d}return{getClassGroupId:i,getConflictingClassGroupIds:o}}function tu(e,t){var o;if(e.length===0)return t.classGroupId;var n=e[0],r=t.nextPart.get(n),s=r?tu(e.slice(1),r):void 0;if(s)return s;if(t.validators.length!==0){var i=e.join(Sa);return(o=t.validators.find(function(a){var l=a.validator;return l(i)}))==null?void 0:o.classGroupId}}var Uc=/^\[(.+)\]$/;function Sh(e){if(Uc.test(e)){var t=Uc.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}}function Ch(e){var t=e.theme,n=e.prefix,r={nextPart:new Map,validators:[]},s=Th(Object.entries(e.classGroups),n);return s.forEach(function(i){var o=i[0],a=i[1];Eo(a,r,o,t)}),r}function Eo(e,t,n,r){e.forEach(function(s){if(typeof s=="string"){var i=s===""?t:Bc(t,s);i.classGroupId=n;return}if(typeof s=="function"){if(Eh(s)){Eo(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];Eo(l,Bc(t,a),n,r)})})}function Bc(e,t){var n=e;return t.split(Sa).forEach(function(r){n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n}function Eh(e){return e.isThemeGetter}function Th(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 Ph(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 nu="!";function kh(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,u,f=0;f<o.length;f++){var h=o[f];if(l===0){if(h===r&&(n||o.slice(f,f+s)===t)){a.push(o.slice(d,f)),d=f+s;continue}if(h==="/"){u=f;continue}}h==="["?l++:h==="]"&&l--}var m=a.length===0?o:o.substring(d),g=m.startsWith(nu),p=g?m.substring(1):m,y=u&&u>d?u-d:void 0;return{modifiers:a,hasImportantModifier:g,baseClassName:p,maybePostfixModifierPosition:y}}}function Ah(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 Nh(e){return{cache:Ph(e.cacheSize),splitModifiers:kh(e),...xh(e)}}var Oh=/\s+/;function Rh(e,t){var n=t.splitModifiers,r=t.getClassGroupId,s=t.getConflictingClassGroupIds,i=new Set;return e.trim().split(Oh).map(function(o){var a=n(o),l=a.modifiers,d=a.hasImportantModifier,u=a.baseClassName,f=a.maybePostfixModifierPosition,h=r(f?u.substring(0,f):u),m=!!f;if(!h){if(!f)return{isTailwindClass:!1,originalClassName:o};if(h=r(u),!h)return{isTailwindClass:!1,originalClassName:o};m=!1}var g=Ah(l).join(":"),p=d?g+nu:g;return{isTailwindClass:!0,modifierId:p,classGroupId:h,originalClassName:o,hasPostfixModifier:m}}).reverse().filter(function(o){if(!o.isTailwindClass)return!0;var a=o.modifierId,l=o.classGroupId,d=o.hasPostfixModifier,u=a+l;return i.has(u)?!1:(i.add(u),s(l,d).forEach(function(f){return i.add(a+f)}),!0)}).reverse().map(function(o){return o.originalClassName}).join(" ")}function Dh(){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 u=t[0],f=t.slice(1),h=f.reduce(function(m,g){return g(m)},u());return r=Nh(h),s=r.cache.get,i=r.cache.set,o=l,l(d)}function l(d){var u=s(d);if(u)return u;var f=Rh(d,r);return i(d,f),f}return function(){return o(_h.apply(null,arguments))}}function Te(e){var t=function(r){return r[e]||[]};return t.isThemeGetter=!0,t}var ru=/^\[(?:([a-z-]+):)?(.+)\]$/i,Lh=/^\d+\/\d+$/,jh=new Set(["px","full","screen"]),Ih=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Mh=/\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$/,Fh=/^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;function lt(e){return bn(e)||jh.has(e)||Lh.test(e)||To(e)}function To(e){return Bn(e,"length",zh)}function Uh(e){return Bn(e,"size",su)}function Bh(e){return Bn(e,"position",su)}function $h(e){return Bn(e,"url",Wh)}function ms(e){return Bn(e,"number",bn)}function bn(e){return!Number.isNaN(Number(e))}function Vh(e){return e.endsWith("%")&&bn(e.slice(0,-1))}function Rr(e){return $c(e)||Bn(e,"number",$c)}function ge(e){return ru.test(e)}function Dr(){return!0}function Wt(e){return Ih.test(e)}function Hh(e){return Bn(e,"",Kh)}function Bn(e,t,n){var r=ru.exec(e);return r?r[1]?r[1]===t:n(r[2]):!1}function zh(e){return Mh.test(e)}function su(){return!1}function Wh(e){return e.startsWith("url(")}function $c(e){return Number.isInteger(Number(e))}function Kh(e){return Fh.test(e)}function Gh(){var e=Te("colors"),t=Te("spacing"),n=Te("blur"),r=Te("brightness"),s=Te("borderColor"),i=Te("borderRadius"),o=Te("borderSpacing"),a=Te("borderWidth"),l=Te("contrast"),d=Te("grayscale"),u=Te("hueRotate"),f=Te("invert"),h=Te("gap"),m=Te("gradientColorStops"),g=Te("gradientColorStopPositions"),p=Te("inset"),y=Te("margin"),b=Te("opacity"),v=Te("padding"),x=Te("saturate"),_=Te("scale"),C=Te("sepia"),P=Te("skew"),T=Te("space"),N=Te("translate"),R=function(){return["auto","contain","none"]},A=function(){return["auto","hidden","clip","visible","scroll"]},j=function(){return["auto",ge,t]},D=function(){return[ge,t]},B=function(){return["",lt]},O=function(){return["auto",bn,ge]},H=function(){return["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"]},U=function(){return["solid","dashed","dotted","double","none"]},I=function(){return["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter"]},L=function(){return["start","end","center","between","around","evenly","stretch"]},M=function(){return["","0",ge]},K=function(){return["auto","avoid","all","avoid-page","page","left","right","column"]},F=function(){return[bn,ms]},se=function(){return[bn,ge]};return{cacheSize:500,theme:{colors:[Dr],spacing:[lt],blur:["none","",Wt,ge],brightness:F(),borderColor:[e],borderRadius:["none","","full",Wt,ge],borderSpacing:D(),borderWidth:B(),contrast:F(),grayscale:M(),hueRotate:se(),invert:M(),gap:D(),gradientColorStops:[e],gradientColorStopPositions:[Vh,To],inset:j(),margin:j(),opacity:F(),padding:D(),saturate:F(),scale:F(),sepia:M(),skew:se(),space:D(),translate:D()},classGroups:{aspect:[{aspect:["auto","square","video",ge]}],container:["container"],columns:[{columns:[Wt]}],"break-after":[{"break-after":K()}],"break-before":[{"break-before":K()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],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(H(),[ge])}],overflow:[{overflow:A()}],"overflow-x":[{"overflow-x":A()}],"overflow-y":[{"overflow-y":A()}],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:j()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ge]}],grow:[{grow:M()}],shrink:[{shrink:M()}],order:[{order:["first","last","none",Rr]}],"grid-cols":[{"grid-cols":[Dr]}],"col-start-end":[{col:["auto",{span:["full",Rr]},ge]}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":[Dr]}],"row-start-end":[{row:["auto",{span:[Rr]},ge]}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ge]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ge]}],gap:[{gap:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal"].concat(L())}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal"].concat(L(),["baseline"])}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[].concat(L(),["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:[y]}],mx:[{mx:[y]}],my:[{my:[y]}],ms:[{ms:[y]}],me:[{me:[y]}],mt:[{mt:[y]}],mr:[{mr:[y]}],mb:[{mb:[y]}],ml:[{ml:[y]}],"space-x":[{"space-x":[T]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[T]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit",ge,t]}],"min-w":[{"min-w":["min","max","fit",ge,lt]}],"max-w":[{"max-w":["0","none","full","min","max","fit","prose",{screen:[Wt]},Wt,ge]}],h:[{h:[ge,t,"auto","min","max","fit"]}],"min-h":[{"min-h":["min","max","fit",ge,lt]}],"max-h":[{"max-h":[ge,t,"min","max","fit"]}],"font-size":[{text:["base",Wt,To]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",ms]}],"font-family":[{font:[Dr]}],"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",ge]}],"line-clamp":[{"line-clamp":["none",bn,ms]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",ge,lt]}],"list-image":[{"list-image":["none",ge]}],"list-style-type":[{list:["none","disc","decimal",ge]}],"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(U(),["wavy"])}],"text-decoration-thickness":[{decoration:["auto","from-font",lt]}],"underline-offset":[{"underline-offset":["auto",ge,lt]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],indent:[{indent:D()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ge]}],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",ge]}],"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(H(),[Bh])}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Uh]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},$h]}],"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(U(),["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:U()}],"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(U())}],"outline-offset":[{"outline-offset":[ge,lt]}],"outline-w":[{outline:[lt]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[lt]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Wt,Hh]}],"shadow-color":[{shadow:[Dr]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":I()}],"bg-blend":[{"bg-blend":I()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Wt,ge]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[f]}],saturate:[{saturate:[x]}],sepia:[{sepia:[C]}],"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":[u]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[x]}],"backdrop-sepia":[{"backdrop-sepia":[C]}],"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",ge]}],duration:[{duration:se()}],ease:[{ease:["linear","in","out","in-out",ge]}],delay:[{delay:se()}],animate:[{animate:["none","spin","ping","pulse","bounce",ge]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[_]}],"scale-x":[{"scale-x":[_]}],"scale-y":[{"scale-y":[_]}],rotate:[{rotate:[Rr,ge]}],"translate-x":[{"translate-x":[N]}],"translate-y":[{"translate-y":[N]}],"skew-x":[{"skew-x":[P]}],"skew-y":[{"skew-y":[P]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ge]}],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",ge]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":D()}],"scroll-mx":[{"scroll-mx":D()}],"scroll-my":[{"scroll-my":D()}],"scroll-ms":[{"scroll-ms":D()}],"scroll-me":[{"scroll-me":D()}],"scroll-mt":[{"scroll-mt":D()}],"scroll-mr":[{"scroll-mr":D()}],"scroll-mb":[{"scroll-mb":D()}],"scroll-ml":[{"scroll-ml":D()}],"scroll-p":[{"scroll-p":D()}],"scroll-px":[{"scroll-px":D()}],"scroll-py":[{"scroll-py":D()}],"scroll-ps":[{"scroll-ps":D()}],"scroll-pe":[{"scroll-pe":D()}],"scroll-pt":[{"scroll-pt":D()}],"scroll-pr":[{"scroll-pr":D()}],"scroll-pb":[{"scroll-pb":D()}],"scroll-pl":[{"scroll-pl":D()}],"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",ge]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[lt,ms]}],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 qh=Dh(Gh);function Ce(...e){return qh(Jd(e))}const Zh=({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})}),Yh=xa("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},u)=>{const f=i?lh:"button";return c.jsxs(f,{className:Ce(Yh({variant:n,size:r,className:t}),o&&"cursor-default","relative"),ref:u,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(Zh,{className:a})})]}),e]})});ot.displayName="Button";function pe(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 $n(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=f=>{var b;const{scope:h,children:m,...g}=f,p=((b=h==null?void 0:h[e])==null?void 0:b[l])||a,y=w.useMemo(()=>g,Object.values(g));return c.jsx(p.Provider,{value:y,children:m})};d.displayName=i+"Provider";function u(f,h){var p;const m=((p=h==null?void 0:h[e])==null?void 0:p[l])||a,g=w.useContext(m);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${i}\``)}return[d,u]}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,Qh(s,...t)]}function Qh(...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 f=l(i)[`__scope${d}`];return{...a,...f}},{});return w.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var Ie=globalThis!=null&&globalThis.document?w.useLayoutEffect:()=>{},Xh=w[" useId ".trim().toString()]||(()=>{}),Jh=0;function on(e){const[t,n]=w.useState(Xh());return Ie(()=>{n(r=>r??String(Jh++))},[e]),e||(t?`radix-${t}`:"")}var eg=w[" useInsertionEffect ".trim().toString()]||Ie;function Dn({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,i,o]=tg({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:s;{const u=w.useRef(e!==void 0);w.useEffect(()=>{const f=u.current;f!==a&&console.warn(`${r} is changing from ${f?"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.`),u.current=a},[a,r])}const d=w.useCallback(u=>{var f;if(a){const h=ng(u)?u(e):u;h!==e&&((f=o.current)==null||f.call(o,h))}else i(u)},[a,e,i,o]);return[l,d]}function tg({defaultProp:e,onChange:t}){const[n,r]=w.useState(e),s=w.useRef(n),i=w.useRef(t);return eg(()=>{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 ng(e){return typeof e=="function"}var rg=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],me=rg.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 iu(e,t){e&&Cr.flushSync(()=>e.dispatchEvent(t))}function mt(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 sg(e,t=globalThis==null?void 0:globalThis.document){const n=mt(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 ig="DismissableLayer",Po="dismissableLayer.update",og="dismissableLayer.pointerDownOutside",ag="dismissableLayer.focusOutside",Vc,Ca=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),gi=w.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:a,onDismiss:l,...d}=e,u=w.useContext(Ca),[f,h]=w.useState(null),m=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=w.useState({}),p=Pe(t,R=>h(R)),y=Array.from(u.layers),[b]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=y.indexOf(b),x=f?y.indexOf(f):-1,_=u.layersWithOutsidePointerEventsDisabled.size>0,C=x>=v,P=w.useRef(!1),T=dg(R=>{const A=R.target;if(!(A instanceof Node))return;const j=[...u.branches].some(D=>D.contains(A));!C||j||(i==null||i(R),a==null||a(R),R.defaultPrevented||l==null||l())},{ownerDocument:m,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:P,dismissableSurfaces:u.dismissableSurfaces}),N=ug(R=>{if(r&&P.current)return;const A=R.target;[...u.branches].some(D=>D.contains(A))||(o==null||o(R),a==null||a(R),R.defaultPrevented||l==null||l())},m);return sg(R=>{x===u.layers.size-1&&(s==null||s(R),!R.defaultPrevented&&l&&(R.preventDefault(),l()))},m),w.useEffect(()=>{if(f)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Vc=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),Hc(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(f),u.layersWithOutsidePointerEventsDisabled.size===0&&(m.body.style.pointerEvents=Vc))}},[f,m,n,u]),w.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),Hc())},[f,u]),w.useEffect(()=>{const R=()=>g({});return document.addEventListener(Po,R),()=>document.removeEventListener(Po,R)},[]),c.jsx(me.div,{...d,ref:p,style:{pointerEvents:_?C?"auto":"none":void 0,...e.style},onFocusCapture:pe(e.onFocusCapture,N.onFocusCapture),onBlurCapture:pe(e.onBlurCapture,N.onBlurCapture),onPointerDownCapture:pe(e.onPointerDownCapture,T.onPointerDownCapture)})});gi.displayName=ig;var cg="DismissableLayerBranch",ou=w.forwardRef((e,t)=>{const n=w.useContext(Ca),r=w.useRef(null),s=Pe(t,r);return w.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),c.jsx(me.div,{...e,ref:s})});ou.displayName=cg;function lg(){const e=w.useContext(Ca),[t,n]=w.useState(null);return w.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}function dg(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:s,dismissableSurfaces:i}=t,o=mt(e),a=w.useRef(!1),l=w.useRef(!1),d=w.useRef(new Map),u=w.useRef(()=>{});return w.useEffect(()=>{function f(){l.current=!1,s.current=!1,d.current.clear()}function h(){return Array.from(d.current.values()).some(Boolean)}function m(v){if(!l.current)return;const x=v.target;x instanceof Node&&[...i].some(C=>C.contains(x))||d.current.set(v.type,!0),v.type==="click"&&window.setTimeout(()=>{l.current&&u.current()},0)}function g(v){l.current&&d.current.set(v.type,!1)}const p=v=>{if(v.target&&!a.current){let x=function(){n.removeEventListener("click",u.current);const C=h();f(),C||au(og,o,_,{discrete:!0})};const _={originalEvent:v};l.current=!0,s.current=r&&v.button===0,d.current.clear(),!r||v.button!==0?x():(n.removeEventListener("click",u.current),u.current=x,n.addEventListener("click",u.current,{once:!0}))}else n.removeEventListener("click",u.current),f();a.current=!1},y=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const v of y)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",u.current);for(const v of y)n.removeEventListener(v,m,!0),n.removeEventListener(v,g)}},[n,o,r,s,i]),{onPointerDownCapture:()=>a.current=!0}}function ug(e,t=globalThis==null?void 0:globalThis.document){const n=mt(e),r=w.useRef(!1);return w.useEffect(()=>{const s=i=>{i.target&&!r.current&&au(ag,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 Hc(){const e=new CustomEvent(Po);document.dispatchEvent(e)}function au(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?iu(s,i):s.dispatchEvent(i)}var fg=gi,pg=ou,Yi="focusScope.autoFocusOnMount",Qi="focusScope.autoFocusOnUnmount",zc={bubbles:!1,cancelable:!0},mg="FocusScope",Ea=w.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:i,...o}=e,[a,l]=w.useState(null),d=mt(s),u=mt(i),f=w.useRef(null),h=Pe(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(x){if(m.paused||!a)return;const _=x.target;a.contains(_)?f.current=_:Kt(f.current,{select:!0})},y=function(x){if(m.paused||!a)return;const _=x.relatedTarget;_!==null&&(a.contains(_)||Kt(f.current,{select:!0}))},b=function(x){if(document.activeElement===document.body)for(const C of x)C.removedNodes.length>0&&Kt(a)};document.addEventListener("focusin",p),document.addEventListener("focusout",y);const v=new MutationObserver(b);return a&&v.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",y),v.disconnect()}}},[r,a,m.paused]),w.useEffect(()=>{if(a){Kc.add(m);const p=document.activeElement;if(!a.contains(p)){const b=new CustomEvent(Yi,zc);a.addEventListener(Yi,d),a.dispatchEvent(b),b.defaultPrevented||(hg(wg(cu(a)),{select:!0}),document.activeElement===p&&Kt(a))}return()=>{a.removeEventListener(Yi,d),setTimeout(()=>{const b=new CustomEvent(Qi,zc);a.addEventListener(Qi,u),a.dispatchEvent(b),b.defaultPrevented||Kt(p??document.body,{select:!0}),a.removeEventListener(Qi,u),Kc.remove(m)},0)}}},[a,d,u,m]);const g=w.useCallback(p=>{if(!n&&!r||m.paused)return;const y=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,b=document.activeElement;if(y&&b){const v=p.currentTarget,[x,_]=gg(v);x&&_?!p.shiftKey&&b===_?(p.preventDefault(),n&&Kt(x,{select:!0})):p.shiftKey&&b===x&&(p.preventDefault(),n&&Kt(_,{select:!0})):b===v&&p.preventDefault()}},[n,r,m.paused]);return c.jsx(me.div,{tabIndex:-1,...o,ref:h,onKeyDown:g})});Ea.displayName=mg;function hg(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Kt(r,{select:t}),document.activeElement!==n)return}function gg(e){const t=cu(e),n=Wc(t,e),r=Wc(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 Wc(e,t){for(const n of e)if(!yg(n,{upTo:t}))return n}function yg(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 bg(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&&bg(e)&&t&&e.select()}}var Kc=vg();function vg(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Gc(e,t),e.unshift(t)},remove(t){var n;e=Gc(e,t),(n=e[0])==null||n.resume()}}}function Gc(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function wg(e){return e.filter(t=>t.tagName!=="A")}var _g="Portal",yi=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(me.div,{...r,ref:t}),o):null});yi.displayName=_g;function xg(e,t){return w.useReducer((n,r)=>t[n][r]??n,e)}var Vn=e=>{const{present:t,children:n}=e,r=Sg(t),s=typeof n=="function"?n({present:r.isPresent}):w.Children.only(n),i=Cg(r.ref,Eg(s));return typeof n=="function"||r.isPresent?w.cloneElement(s,{ref:i}):null};Vn.displayName="Presence";function Sg(e){const[t,n]=w.useState(),r=w.useRef(null),s=w.useRef(e),i=w.useRef("none"),o=e?"mounted":"unmounted",[a,l]=xg(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const d=hs(r.current);i.current=a==="mounted"?d:"none"},[a]),Ie(()=>{const d=r.current,u=s.current;if(u!==e){const h=i.current,m=hs(d);e?l("MOUNT"):m==="none"||(d==null?void 0:d.display)==="none"?l("UNMOUNT"):l(u&&h!==m?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,l]),Ie(()=>{if(t){let d;const u=t.ownerDocument.defaultView??window,f=m=>{const p=hs(r.current).includes(CSS.escape(m.animationName));if(m.target===t&&p&&(l("ANIMATION_END"),!s.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",d=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},h=m=>{m.target===t&&(i.current=hs(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{u.clearTimeout(d),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:w.useCallback(d=>{r.current=d?getComputedStyle(d):null,n(d)},[])}}function qc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Cg(...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=qc(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():qc(r[o],null)}}},[])}function hs(e){return(e==null?void 0:e.animationName)||"none"}function Eg(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 gs=0,_t=null;function lu(){w.useEffect(()=>{_t||(_t={start:Zc(),end:Zc()});const{start:e,end:t}=_t;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),gs++,()=>{gs===1&&(_t==null||_t.start.remove(),_t==null||_t.end.remove(),_t=null),gs=Math.max(0,gs-1)}},[])}function Zc(){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 Pt=function(){return Pt=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},Pt.apply(this,arguments)};function du(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 Tg(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 Ls="right-scroll-bar-position",js="width-before-scroll-bar",Pg="with-scroll-bars-hidden",kg="--removed-body-scroll-bar-size";function Xi(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Ag(e,t){var n=S.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 Ng=typeof window<"u"?w.useLayoutEffect:w.useEffect,Yc=new WeakMap;function Og(e,t){var n=Ag(null,function(r){return e.forEach(function(s){return Xi(s,r)})});return Ng(function(){var r=Yc.get(n);if(r){var s=new Set(r),i=new Set(e),o=n.current;s.forEach(function(a){i.has(a)||Xi(a,null)}),i.forEach(function(a){s.has(a)||Xi(a,o)})}Yc.set(n,e)},[e]),n}function Rg(e){return e}function Dg(e,t){t===void 0&&(t=Rg);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 u=o;o=[],u.forEach(i)},d=function(){return Promise.resolve().then(l)};d(),n={push:function(u){o.push(u),d()},filter:function(u){return o=o.filter(u),n}}}};return s}function Lg(e){e===void 0&&(e={});var t=Dg(null);return t.options=Pt({async:!0,ssr:!1},e),t}var uu=function(e){var t=e.sideCar,n=du(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,Pt({},n))};uu.isSideCarExport=!0;function jg(e,t){return e.useMedium(t),uu}var fu=Lg(),Ji=function(){},bi=w.forwardRef(function(e,t){var n=w.useRef(null),r=w.useState({onScrollCapture:Ji,onWheelCapture:Ji,onTouchMoveCapture:Ji}),s=r[0],i=r[1],o=e.forwardProps,a=e.children,l=e.className,d=e.removeScrollBar,u=e.enabled,f=e.shards,h=e.sideCar,m=e.noRelative,g=e.noIsolation,p=e.inert,y=e.allowPinchZoom,b=e.as,v=b===void 0?"div":b,x=e.gapMode,_=du(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=h,P=Og([n,t]),T=Pt(Pt({},_),s);return w.createElement(w.Fragment,null,u&&w.createElement(C,{sideCar:fu,removeScrollBar:d,shards:f,noRelative:m,noIsolation:g,inert:p,setCallbacks:i,allowPinchZoom:!!y,lockRef:n,gapMode:x}),o?w.cloneElement(w.Children.only(a),Pt(Pt({},T),{ref:P})):w.createElement(v,Pt({},T,{className:l,ref:P}),a))});bi.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};bi.classNames={fullWidth:js,zeroRight:Ls};var Ig=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Mg(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Ig();return t&&e.setAttribute("nonce",t),e}function Fg(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Ug(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Bg=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Mg())&&(Fg(t,n),Ug(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},$g=function(){var e=Bg();return function(t,n){w.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},pu=function(){var e=$g(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},Vg={left:0,top:0,right:0,gap:0},eo=function(e){return parseInt(e||"",10)||0},Hg=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[eo(n),eo(r),eo(s)]},zg=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Vg;var t=Hg(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])}},Wg=pu(),Jn="data-scroll-locked",Kg=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(Pg,` {
1
+ "use strict";var ah=Object.defineProperty;var Lc=e=>{throw TypeError(e)};var ch=(e,t,n)=>t in e?ah(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var st=(e,t,n)=>ch(e,typeof t!="symbol"?t+"":t,n),Zi=(e,t,n)=>t.has(e)||Lc("Cannot "+n);var E=(e,t,n)=>(Zi(e,t,"read from private field"),n?n.call(e):t.get(e)),ne=(e,t,n)=>t.has(e)?Lc("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),K=(e,t,n,r)=>(Zi(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),he=(e,t,n)=>(Zi(e,t,"access private method"),n);var fs=(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"),S=require("react"),lh=require("react-dom");function Xd(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=Xd(S),Cr=Xd(lh);function jc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function dh(...e){return t=>{let n=!1;const r=e.map(s=>{const i=jc(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():jc(e[s],null)}}}}function Pe(...e){return w.useCallback(dh(...e),e)}function mr(e){const t=w.forwardRef((n,r)=>{let{children:s,...i}=n,o=null,a=!1;const l=[];Ic(s)&&typeof ps=="function"&&(s=ps(s._payload)),w.Children.forEach(s,h=>{var m;if(gh(h)){a=!0;const g=h;let p="child"in g.props?g.props.child:g.props.children;Ic(p)&&typeof ps=="function"&&(p=ps(p._payload)),o=ph(g,p),l.push((m=o==null?void 0:o.props)==null?void 0:m.children)}else l.push(h)}),o?o=w.cloneElement(o,void 0,l):!a&&w.Children.count(s)===1&&w.isValidElement(s)&&(o=s);const d=o?hh(o):void 0,u=Pe(r,d);if(!o){if(s||s===0)throw new Error(a?wh(e):vh(e));return s}const f=mh(i,o.props??{});return o.type!==w.Fragment&&(f.ref=r?u:d),w.cloneElement(o,f)});return t.displayName=`${e}.Slot`,t}var uh=mr("Slot"),fh=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 mh(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 hh(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 gh(e){return w.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===fh}var yh=Symbol.for("react.lazy");function Ic(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===yh&&"_payload"in e&&bh(e._payload)}function bh(e){return typeof e=="object"&&e!==null&&"then"in e}var vh=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,wh=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,ps=w[" use ".trim().toString()];function Jd(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=Jd(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function eu(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=Jd(e))&&(r&&(r+=" "),r+=t);return r}const Mc=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Fc=eu,xa=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return Fc(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 u=n==null?void 0:n[d],f=i==null?void 0:i[d];if(u===null)return null;const h=Mc(u)||Mc(f);return s[d][h]}),a=n&&Object.entries(n).reduce((d,u)=>{let[f,h]=u;return h===void 0||(d[f]=h),d},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,u)=>{let{class:f,className:h,...m}=u;return Object.entries(m).every(g=>{let[p,y]=g;return Array.isArray(y)?y.includes({...i,...a}[p]):{...i,...a}[p]===y})?[...d,f,h]:d},[]);return Fc(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"}],_h={[-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 xh(){const e=-new Date().getTimezoneOffset()/60,t=_h[e];return t&&t.length>0?t[0]:"Etc/UTC"}const Xn="tv:latest-symbol",tu="web-trading-last-account-login";function Sh(){for(var e=0,t,n,r="";e<arguments.length;)(t=arguments[e++])&&(n=nu(t))&&(r&&(r+=" "),r+=n);return r}function nu(e){if(typeof e=="string")return e;for(var t,n="",r=0;r<e.length;r++)e[r]&&(t=nu(e[r]))&&(n&&(n+=" "),n+=t);return n}var Sa="-";function Ch(e){var t=Th(e),n=e.conflictingClassGroups,r=e.conflictingClassGroupModifiers,s=r===void 0?{}:r;function i(a){var l=a.split(Sa);return l[0]===""&&l.length!==1&&l.shift(),ru(l,t)||Eh(a)}function o(a,l){var d=n[a]||[];return l&&s[a]?[].concat(d,s[a]):d}return{getClassGroupId:i,getConflictingClassGroupIds:o}}function ru(e,t){var o;if(e.length===0)return t.classGroupId;var n=e[0],r=t.nextPart.get(n),s=r?ru(e.slice(1),r):void 0;if(s)return s;if(t.validators.length!==0){var i=e.join(Sa);return(o=t.validators.find(function(a){var l=a.validator;return l(i)}))==null?void 0:o.classGroupId}}var Uc=/^\[(.+)\]$/;function Eh(e){if(Uc.test(e)){var t=Uc.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}}function Th(e){var t=e.theme,n=e.prefix,r={nextPart:new Map,validators:[]},s=kh(Object.entries(e.classGroups),n);return s.forEach(function(i){var o=i[0],a=i[1];Eo(a,r,o,t)}),r}function Eo(e,t,n,r){e.forEach(function(s){if(typeof s=="string"){var i=s===""?t:Bc(t,s);i.classGroupId=n;return}if(typeof s=="function"){if(Ph(s)){Eo(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];Eo(l,Bc(t,a),n,r)})})}function Bc(e,t){var n=e;return t.split(Sa).forEach(function(r){n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n}function Ph(e){return e.isThemeGetter}function kh(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 Ah(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 su="!";function Nh(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,u,f=0;f<o.length;f++){var h=o[f];if(l===0){if(h===r&&(n||o.slice(f,f+s)===t)){a.push(o.slice(d,f)),d=f+s;continue}if(h==="/"){u=f;continue}}h==="["?l++:h==="]"&&l--}var m=a.length===0?o:o.substring(d),g=m.startsWith(su),p=g?m.substring(1):m,y=u&&u>d?u-d:void 0;return{modifiers:a,hasImportantModifier:g,baseClassName:p,maybePostfixModifierPosition:y}}}function Oh(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 Rh(e){return{cache:Ah(e.cacheSize),splitModifiers:Nh(e),...Ch(e)}}var Dh=/\s+/;function Lh(e,t){var n=t.splitModifiers,r=t.getClassGroupId,s=t.getConflictingClassGroupIds,i=new Set;return e.trim().split(Dh).map(function(o){var a=n(o),l=a.modifiers,d=a.hasImportantModifier,u=a.baseClassName,f=a.maybePostfixModifierPosition,h=r(f?u.substring(0,f):u),m=!!f;if(!h){if(!f)return{isTailwindClass:!1,originalClassName:o};if(h=r(u),!h)return{isTailwindClass:!1,originalClassName:o};m=!1}var g=Oh(l).join(":"),p=d?g+su:g;return{isTailwindClass:!0,modifierId:p,classGroupId:h,originalClassName:o,hasPostfixModifier:m}}).reverse().filter(function(o){if(!o.isTailwindClass)return!0;var a=o.modifierId,l=o.classGroupId,d=o.hasPostfixModifier,u=a+l;return i.has(u)?!1:(i.add(u),s(l,d).forEach(function(f){return i.add(a+f)}),!0)}).reverse().map(function(o){return o.originalClassName}).join(" ")}function jh(){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 u=t[0],f=t.slice(1),h=f.reduce(function(m,g){return g(m)},u());return r=Rh(h),s=r.cache.get,i=r.cache.set,o=l,l(d)}function l(d){var u=s(d);if(u)return u;var f=Lh(d,r);return i(d,f),f}return function(){return o(Sh.apply(null,arguments))}}function Te(e){var t=function(r){return r[e]||[]};return t.isThemeGetter=!0,t}var iu=/^\[(?:([a-z-]+):)?(.+)\]$/i,Ih=/^\d+\/\d+$/,Mh=new Set(["px","full","screen"]),Fh=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Uh=/\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$/,Bh=/^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;function lt(e){return bn(e)||Mh.has(e)||Ih.test(e)||To(e)}function To(e){return Bn(e,"length",Kh)}function $h(e){return Bn(e,"size",ou)}function Vh(e){return Bn(e,"position",ou)}function Hh(e){return Bn(e,"url",Gh)}function ms(e){return Bn(e,"number",bn)}function bn(e){return!Number.isNaN(Number(e))}function zh(e){return e.endsWith("%")&&bn(e.slice(0,-1))}function Rr(e){return $c(e)||Bn(e,"number",$c)}function ge(e){return iu.test(e)}function Dr(){return!0}function Wt(e){return Fh.test(e)}function Wh(e){return Bn(e,"",qh)}function Bn(e,t,n){var r=iu.exec(e);return r?r[1]?r[1]===t:n(r[2]):!1}function Kh(e){return Uh.test(e)}function ou(){return!1}function Gh(e){return e.startsWith("url(")}function $c(e){return Number.isInteger(Number(e))}function qh(e){return Bh.test(e)}function Zh(){var e=Te("colors"),t=Te("spacing"),n=Te("blur"),r=Te("brightness"),s=Te("borderColor"),i=Te("borderRadius"),o=Te("borderSpacing"),a=Te("borderWidth"),l=Te("contrast"),d=Te("grayscale"),u=Te("hueRotate"),f=Te("invert"),h=Te("gap"),m=Te("gradientColorStops"),g=Te("gradientColorStopPositions"),p=Te("inset"),y=Te("margin"),b=Te("opacity"),v=Te("padding"),x=Te("saturate"),_=Te("scale"),C=Te("sepia"),P=Te("skew"),T=Te("space"),O=Te("translate"),D=function(){return["auto","contain","none"]},j=function(){return["auto","hidden","clip","visible","scroll"]},A=function(){return["auto",ge,t]},N=function(){return[ge,t]},B=function(){return["",lt]},R=function(){return["auto",bn,ge]},H=function(){return["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"]},F=function(){return["solid","dashed","dotted","double","none"]},I=function(){return["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter"]},L=function(){return["start","end","center","between","around","evenly","stretch"]},U=function(){return["","0",ge]},z=function(){return["auto","avoid","all","avoid-page","page","left","right","column"]},M=function(){return[bn,ms]},se=function(){return[bn,ge]};return{cacheSize:500,theme:{colors:[Dr],spacing:[lt],blur:["none","",Wt,ge],brightness:M(),borderColor:[e],borderRadius:["none","","full",Wt,ge],borderSpacing:N(),borderWidth:B(),contrast:M(),grayscale:U(),hueRotate:se(),invert:U(),gap:N(),gradientColorStops:[e],gradientColorStopPositions:[zh,To],inset:A(),margin:A(),opacity:M(),padding:N(),saturate:M(),scale:M(),sepia:U(),skew:se(),space:N(),translate:N()},classGroups:{aspect:[{aspect:["auto","square","video",ge]}],container:["container"],columns:[{columns:[Wt]}],"break-after":[{"break-after":z()}],"break-before":[{"break-before":z()}],"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(H(),[ge])}],overflow:[{overflow:j()}],"overflow-x":[{"overflow-x":j()}],"overflow-y":[{"overflow-y":j()}],overscroll:[{overscroll:D()}],"overscroll-x":[{"overscroll-x":D()}],"overscroll-y":[{"overscroll-y":D()}],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:A()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ge]}],grow:[{grow:U()}],shrink:[{shrink:U()}],order:[{order:["first","last","none",Rr]}],"grid-cols":[{"grid-cols":[Dr]}],"col-start-end":[{col:["auto",{span:["full",Rr]},ge]}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":[Dr]}],"row-start-end":[{row:["auto",{span:[Rr]},ge]}],"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",ge]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ge]}],gap:[{gap:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal"].concat(L())}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal"].concat(L(),["baseline"])}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[].concat(L(),["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:[y]}],mx:[{mx:[y]}],my:[{my:[y]}],ms:[{ms:[y]}],me:[{me:[y]}],mt:[{mt:[y]}],mr:[{mr:[y]}],mb:[{mb:[y]}],ml:[{ml:[y]}],"space-x":[{"space-x":[T]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[T]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit",ge,t]}],"min-w":[{"min-w":["min","max","fit",ge,lt]}],"max-w":[{"max-w":["0","none","full","min","max","fit","prose",{screen:[Wt]},Wt,ge]}],h:[{h:[ge,t,"auto","min","max","fit"]}],"min-h":[{"min-h":["min","max","fit",ge,lt]}],"max-h":[{"max-h":[ge,t,"min","max","fit"]}],"font-size":[{text:["base",Wt,To]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",ms]}],"font-family":[{font:[Dr]}],"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",ge]}],"line-clamp":[{"line-clamp":["none",bn,ms]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",ge,lt]}],"list-image":[{"list-image":["none",ge]}],"list-style-type":[{list:["none","disc","decimal",ge]}],"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",lt]}],"underline-offset":[{"underline-offset":["auto",ge,lt]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],indent:[{indent:N()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ge]}],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",ge]}],"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(H(),[Vh])}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",$h]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Hh]}],"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":[ge,lt]}],"outline-w":[{outline:[lt]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[lt]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Wt,Wh]}],"shadow-color":[{shadow:[Dr]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":I()}],"bg-blend":[{"bg-blend":I()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Wt,ge]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[f]}],saturate:[{saturate:[x]}],sepia:[{sepia:[C]}],"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":[u]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[x]}],"backdrop-sepia":[{"backdrop-sepia":[C]}],"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",ge]}],duration:[{duration:se()}],ease:[{ease:["linear","in","out","in-out",ge]}],delay:[{delay:se()}],animate:[{animate:["none","spin","ping","pulse","bounce",ge]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[_]}],"scale-x":[{"scale-x":[_]}],"scale-y":[{"scale-y":[_]}],rotate:[{rotate:[Rr,ge]}],"translate-x":[{"translate-x":[O]}],"translate-y":[{"translate-y":[O]}],"skew-x":[{"skew-x":[P]}],"skew-y":[{"skew-y":[P]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ge]}],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",ge]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":N()}],"scroll-mx":[{"scroll-mx":N()}],"scroll-my":[{"scroll-my":N()}],"scroll-ms":[{"scroll-ms":N()}],"scroll-me":[{"scroll-me":N()}],"scroll-mt":[{"scroll-mt":N()}],"scroll-mr":[{"scroll-mr":N()}],"scroll-mb":[{"scroll-mb":N()}],"scroll-ml":[{"scroll-ml":N()}],"scroll-p":[{"scroll-p":N()}],"scroll-px":[{"scroll-px":N()}],"scroll-py":[{"scroll-py":N()}],"scroll-ps":[{"scroll-ps":N()}],"scroll-pe":[{"scroll-pe":N()}],"scroll-pt":[{"scroll-pt":N()}],"scroll-pr":[{"scroll-pr":N()}],"scroll-pb":[{"scroll-pb":N()}],"scroll-pl":[{"scroll-pl":N()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","pinch-zoom","manipulation",{pan:["x","left","right","y","up","down"]}]}],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ge]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[lt,ms]}],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 Yh=jh(Zh);function Ce(...e){return Yh(eu(e))}const Qh=({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})}),Xh=xa("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},u)=>{const f=i?uh:"button";return c.jsxs(f,{className:Ce(Xh({variant:n,size:r,className:t}),o&&"cursor-default","relative"),ref:u,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(Qh,{className:a})})]}),e]})});ot.displayName="Button";function pe(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 $n(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=f=>{var b;const{scope:h,children:m,...g}=f,p=((b=h==null?void 0:h[e])==null?void 0:b[l])||a,y=w.useMemo(()=>g,Object.values(g));return c.jsx(p.Provider,{value:y,children:m})};d.displayName=i+"Provider";function u(f,h){var p;const m=((p=h==null?void 0:h[e])==null?void 0:p[l])||a,g=w.useContext(m);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${i}\``)}return[d,u]}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,Jh(s,...t)]}function Jh(...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 f=l(i)[`__scope${d}`];return{...a,...f}},{});return w.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var Ie=globalThis!=null&&globalThis.document?w.useLayoutEffect:()=>{},eg=w[" useId ".trim().toString()]||(()=>{}),tg=0;function on(e){const[t,n]=w.useState(eg());return Ie(()=>{n(r=>r??String(tg++))},[e]),e||(t?`radix-${t}`:"")}var ng=w[" useInsertionEffect ".trim().toString()]||Ie;function Dn({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,i,o]=rg({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:s;{const u=w.useRef(e!==void 0);w.useEffect(()=>{const f=u.current;f!==a&&console.warn(`${r} is changing from ${f?"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.`),u.current=a},[a,r])}const d=w.useCallback(u=>{var f;if(a){const h=sg(u)?u(e):u;h!==e&&((f=o.current)==null||f.call(o,h))}else i(u)},[a,e,i,o]);return[l,d]}function rg({defaultProp:e,onChange:t}){const[n,r]=w.useState(e),s=w.useRef(n),i=w.useRef(t);return ng(()=>{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 sg(e){return typeof e=="function"}var ig=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],me=ig.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 au(e,t){e&&Cr.flushSync(()=>e.dispatchEvent(t))}function mt(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 og(e,t=globalThis==null?void 0:globalThis.document){const n=mt(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 ag="DismissableLayer",Po="dismissableLayer.update",cg="dismissableLayer.pointerDownOutside",lg="dismissableLayer.focusOutside",Vc,Ca=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),gi=w.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:a,onDismiss:l,...d}=e,u=w.useContext(Ca),[f,h]=w.useState(null),m=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=w.useState({}),p=Pe(t,D=>h(D)),y=Array.from(u.layers),[b]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=y.indexOf(b),x=f?y.indexOf(f):-1,_=u.layersWithOutsidePointerEventsDisabled.size>0,C=x>=v,P=w.useRef(!1),T=fg(D=>{const j=D.target;if(!(j instanceof Node))return;const A=[...u.branches].some(N=>N.contains(j));!C||A||(i==null||i(D),a==null||a(D),D.defaultPrevented||l==null||l())},{ownerDocument:m,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:P,dismissableSurfaces:u.dismissableSurfaces}),O=pg(D=>{if(r&&P.current)return;const j=D.target;[...u.branches].some(N=>N.contains(j))||(o==null||o(D),a==null||a(D),D.defaultPrevented||l==null||l())},m);return og(D=>{x===u.layers.size-1&&(s==null||s(D),!D.defaultPrevented&&l&&(D.preventDefault(),l()))},m),w.useEffect(()=>{if(f)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Vc=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),Hc(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(f),u.layersWithOutsidePointerEventsDisabled.size===0&&(m.body.style.pointerEvents=Vc))}},[f,m,n,u]),w.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),Hc())},[f,u]),w.useEffect(()=>{const D=()=>g({});return document.addEventListener(Po,D),()=>document.removeEventListener(Po,D)},[]),c.jsx(me.div,{...d,ref:p,style:{pointerEvents:_?C?"auto":"none":void 0,...e.style},onFocusCapture:pe(e.onFocusCapture,O.onFocusCapture),onBlurCapture:pe(e.onBlurCapture,O.onBlurCapture),onPointerDownCapture:pe(e.onPointerDownCapture,T.onPointerDownCapture)})});gi.displayName=ag;var dg="DismissableLayerBranch",cu=w.forwardRef((e,t)=>{const n=w.useContext(Ca),r=w.useRef(null),s=Pe(t,r);return w.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),c.jsx(me.div,{...e,ref:s})});cu.displayName=dg;function ug(){const e=w.useContext(Ca),[t,n]=w.useState(null);return w.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}function fg(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:s,dismissableSurfaces:i}=t,o=mt(e),a=w.useRef(!1),l=w.useRef(!1),d=w.useRef(new Map),u=w.useRef(()=>{});return w.useEffect(()=>{function f(){l.current=!1,s.current=!1,d.current.clear()}function h(){return Array.from(d.current.values()).some(Boolean)}function m(v){if(!l.current)return;const x=v.target;x instanceof Node&&[...i].some(C=>C.contains(x))||d.current.set(v.type,!0),v.type==="click"&&window.setTimeout(()=>{l.current&&u.current()},0)}function g(v){l.current&&d.current.set(v.type,!1)}const p=v=>{if(v.target&&!a.current){let x=function(){n.removeEventListener("click",u.current);const C=h();f(),C||lu(cg,o,_,{discrete:!0})};const _={originalEvent:v};l.current=!0,s.current=r&&v.button===0,d.current.clear(),!r||v.button!==0?x():(n.removeEventListener("click",u.current),u.current=x,n.addEventListener("click",u.current,{once:!0}))}else n.removeEventListener("click",u.current),f();a.current=!1},y=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const v of y)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",u.current);for(const v of y)n.removeEventListener(v,m,!0),n.removeEventListener(v,g)}},[n,o,r,s,i]),{onPointerDownCapture:()=>a.current=!0}}function pg(e,t=globalThis==null?void 0:globalThis.document){const n=mt(e),r=w.useRef(!1);return w.useEffect(()=>{const s=i=>{i.target&&!r.current&&lu(lg,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 Hc(){const e=new CustomEvent(Po);document.dispatchEvent(e)}function lu(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?au(s,i):s.dispatchEvent(i)}var mg=gi,hg=cu,Yi="focusScope.autoFocusOnMount",Qi="focusScope.autoFocusOnUnmount",zc={bubbles:!1,cancelable:!0},gg="FocusScope",Ea=w.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:i,...o}=e,[a,l]=w.useState(null),d=mt(s),u=mt(i),f=w.useRef(null),h=Pe(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(x){if(m.paused||!a)return;const _=x.target;a.contains(_)?f.current=_:Kt(f.current,{select:!0})},y=function(x){if(m.paused||!a)return;const _=x.relatedTarget;_!==null&&(a.contains(_)||Kt(f.current,{select:!0}))},b=function(x){if(document.activeElement===document.body)for(const C of x)C.removedNodes.length>0&&Kt(a)};document.addEventListener("focusin",p),document.addEventListener("focusout",y);const v=new MutationObserver(b);return a&&v.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",y),v.disconnect()}}},[r,a,m.paused]),w.useEffect(()=>{if(a){Kc.add(m);const p=document.activeElement;if(!a.contains(p)){const b=new CustomEvent(Yi,zc);a.addEventListener(Yi,d),a.dispatchEvent(b),b.defaultPrevented||(yg(xg(du(a)),{select:!0}),document.activeElement===p&&Kt(a))}return()=>{a.removeEventListener(Yi,d),setTimeout(()=>{const b=new CustomEvent(Qi,zc);a.addEventListener(Qi,u),a.dispatchEvent(b),b.defaultPrevented||Kt(p??document.body,{select:!0}),a.removeEventListener(Qi,u),Kc.remove(m)},0)}}},[a,d,u,m]);const g=w.useCallback(p=>{if(!n&&!r||m.paused)return;const y=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,b=document.activeElement;if(y&&b){const v=p.currentTarget,[x,_]=bg(v);x&&_?!p.shiftKey&&b===_?(p.preventDefault(),n&&Kt(x,{select:!0})):p.shiftKey&&b===x&&(p.preventDefault(),n&&Kt(_,{select:!0})):b===v&&p.preventDefault()}},[n,r,m.paused]);return c.jsx(me.div,{tabIndex:-1,...o,ref:h,onKeyDown:g})});Ea.displayName=gg;function yg(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Kt(r,{select:t}),document.activeElement!==n)return}function bg(e){const t=du(e),n=Wc(t,e),r=Wc(t.reverse(),e);return[n,r]}function du(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 Wc(e,t){for(const n of e)if(!vg(n,{upTo:t}))return n}function vg(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 wg(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&&wg(e)&&t&&e.select()}}var Kc=_g();function _g(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Gc(e,t),e.unshift(t)},remove(t){var n;e=Gc(e,t),(n=e[0])==null||n.resume()}}}function Gc(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function xg(e){return e.filter(t=>t.tagName!=="A")}var Sg="Portal",yi=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(me.div,{...r,ref:t}),o):null});yi.displayName=Sg;function Cg(e,t){return w.useReducer((n,r)=>t[n][r]??n,e)}var Vn=e=>{const{present:t,children:n}=e,r=Eg(t),s=typeof n=="function"?n({present:r.isPresent}):w.Children.only(n),i=Tg(r.ref,Pg(s));return typeof n=="function"||r.isPresent?w.cloneElement(s,{ref:i}):null};Vn.displayName="Presence";function Eg(e){const[t,n]=w.useState(),r=w.useRef(null),s=w.useRef(e),i=w.useRef("none"),o=e?"mounted":"unmounted",[a,l]=Cg(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const d=hs(r.current);i.current=a==="mounted"?d:"none"},[a]),Ie(()=>{const d=r.current,u=s.current;if(u!==e){const h=i.current,m=hs(d);e?l("MOUNT"):m==="none"||(d==null?void 0:d.display)==="none"?l("UNMOUNT"):l(u&&h!==m?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,l]),Ie(()=>{if(t){let d;const u=t.ownerDocument.defaultView??window,f=m=>{const p=hs(r.current).includes(CSS.escape(m.animationName));if(m.target===t&&p&&(l("ANIMATION_END"),!s.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",d=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},h=m=>{m.target===t&&(i.current=hs(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{u.clearTimeout(d),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:w.useCallback(d=>{r.current=d?getComputedStyle(d):null,n(d)},[])}}function qc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Tg(...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=qc(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():qc(r[o],null)}}},[])}function hs(e){return(e==null?void 0:e.animationName)||"none"}function Pg(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 gs=0,_t=null;function uu(){w.useEffect(()=>{_t||(_t={start:Zc(),end:Zc()});const{start:e,end:t}=_t;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),gs++,()=>{gs===1&&(_t==null||_t.start.remove(),_t==null||_t.end.remove(),_t=null),gs=Math.max(0,gs-1)}},[])}function Zc(){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 Pt=function(){return Pt=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},Pt.apply(this,arguments)};function fu(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 kg(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 Ls="right-scroll-bar-position",js="width-before-scroll-bar",Ag="with-scroll-bars-hidden",Ng="--removed-body-scroll-bar-size";function Xi(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Og(e,t){var n=S.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 Rg=typeof window<"u"?w.useLayoutEffect:w.useEffect,Yc=new WeakMap;function Dg(e,t){var n=Og(null,function(r){return e.forEach(function(s){return Xi(s,r)})});return Rg(function(){var r=Yc.get(n);if(r){var s=new Set(r),i=new Set(e),o=n.current;s.forEach(function(a){i.has(a)||Xi(a,null)}),i.forEach(function(a){s.has(a)||Xi(a,o)})}Yc.set(n,e)},[e]),n}function Lg(e){return e}function jg(e,t){t===void 0&&(t=Lg);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 u=o;o=[],u.forEach(i)},d=function(){return Promise.resolve().then(l)};d(),n={push:function(u){o.push(u),d()},filter:function(u){return o=o.filter(u),n}}}};return s}function Ig(e){e===void 0&&(e={});var t=jg(null);return t.options=Pt({async:!0,ssr:!1},e),t}var pu=function(e){var t=e.sideCar,n=fu(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,Pt({},n))};pu.isSideCarExport=!0;function Mg(e,t){return e.useMedium(t),pu}var mu=Ig(),Ji=function(){},bi=w.forwardRef(function(e,t){var n=w.useRef(null),r=w.useState({onScrollCapture:Ji,onWheelCapture:Ji,onTouchMoveCapture:Ji}),s=r[0],i=r[1],o=e.forwardProps,a=e.children,l=e.className,d=e.removeScrollBar,u=e.enabled,f=e.shards,h=e.sideCar,m=e.noRelative,g=e.noIsolation,p=e.inert,y=e.allowPinchZoom,b=e.as,v=b===void 0?"div":b,x=e.gapMode,_=fu(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=h,P=Dg([n,t]),T=Pt(Pt({},_),s);return w.createElement(w.Fragment,null,u&&w.createElement(C,{sideCar:mu,removeScrollBar:d,shards:f,noRelative:m,noIsolation:g,inert:p,setCallbacks:i,allowPinchZoom:!!y,lockRef:n,gapMode:x}),o?w.cloneElement(w.Children.only(a),Pt(Pt({},T),{ref:P})):w.createElement(v,Pt({},T,{className:l,ref:P}),a))});bi.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};bi.classNames={fullWidth:js,zeroRight:Ls};var Fg=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Ug(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Fg();return t&&e.setAttribute("nonce",t),e}function Bg(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function $g(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Vg=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Ug())&&(Bg(t,n),$g(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Hg=function(){var e=Vg();return function(t,n){w.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},hu=function(){var e=Hg(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},zg={left:0,top:0,right:0,gap:0},eo=function(e){return parseInt(e||"",10)||0},Wg=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[eo(n),eo(r),eo(s)]},Kg=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return zg;var t=Wg(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])}},Gg=hu(),Jn="data-scroll-locked",qg=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(Ag,` {
3
3
  overflow: hidden `).concat(r,`;
4
4
  padding-right: `).concat(a,"px ").concat(r,`;
5
5
  }
@@ -33,12 +33,12 @@
33
33
  }
34
34
 
35
35
  body[`).concat(Jn,`] {
36
- `).concat(kg,": ").concat(a,`px;
36
+ `).concat(Ng,": ").concat(a,`px;
37
37
  }
38
- `)},Qc=function(){var e=parseInt(document.body.getAttribute(Jn)||"0",10);return isFinite(e)?e:0},Gg=function(){w.useEffect(function(){return document.body.setAttribute(Jn,(Qc()+1).toString()),function(){var e=Qc()-1;e<=0?document.body.removeAttribute(Jn):document.body.setAttribute(Jn,e.toString())}},[])},qg=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;Gg();var i=w.useMemo(function(){return zg(s)},[s]);return w.createElement(Wg,{styles:Kg(i,!t,s,n?"":"!important")})},ko=!1;if(typeof window<"u")try{var ys=Object.defineProperty({},"passive",{get:function(){return ko=!0,!0}});window.addEventListener("test",ys,ys),window.removeEventListener("test",ys,ys)}catch{ko=!1}var zn=ko?{passive:!1}:!1,Zg=function(e){return e.tagName==="TEXTAREA"},mu=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Zg(e)&&n[t]==="visible")},Yg=function(e){return mu(e,"overflowY")},Qg=function(e){return mu(e,"overflowX")},Xc=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=hu(e,r);if(s){var i=gu(e,r),o=i[1],a=i[2];if(o>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Xg=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Jg=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},hu=function(e,t){return e==="v"?Yg(t):Qg(t)},gu=function(e,t){return e==="v"?Xg(t):Jg(t)},ey=function(e,t){return e==="h"&&t==="rtl"?-1:1},ty=function(e,t,n,r,s){var i=ey(e,window.getComputedStyle(t).direction),o=i*r,a=n.target,l=t.contains(a),d=!1,u=o>0,f=0,h=0;do{if(!a)break;var m=gu(e,a),g=m[0],p=m[1],y=m[2],b=p-y-i*g;(g||b)&&hu(e,a)&&(f+=b,h+=g);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(u&&Math.abs(f)<1||!u&&Math.abs(h)<1)&&(d=!0),d},bs=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Jc=function(e){return[e.deltaX,e.deltaY]},el=function(e){return e&&"current"in e?e.current:e},ny=function(e,t){return e[0]===t[0]&&e[1]===t[1]},ry=function(e){return`
38
+ `)},Qc=function(){var e=parseInt(document.body.getAttribute(Jn)||"0",10);return isFinite(e)?e:0},Zg=function(){w.useEffect(function(){return document.body.setAttribute(Jn,(Qc()+1).toString()),function(){var e=Qc()-1;e<=0?document.body.removeAttribute(Jn):document.body.setAttribute(Jn,e.toString())}},[])},Yg=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;Zg();var i=w.useMemo(function(){return Kg(s)},[s]);return w.createElement(Gg,{styles:qg(i,!t,s,n?"":"!important")})},ko=!1;if(typeof window<"u")try{var ys=Object.defineProperty({},"passive",{get:function(){return ko=!0,!0}});window.addEventListener("test",ys,ys),window.removeEventListener("test",ys,ys)}catch{ko=!1}var zn=ko?{passive:!1}:!1,Qg=function(e){return e.tagName==="TEXTAREA"},gu=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Qg(e)&&n[t]==="visible")},Xg=function(e){return gu(e,"overflowY")},Jg=function(e){return gu(e,"overflowX")},Xc=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=yu(e,r);if(s){var i=bu(e,r),o=i[1],a=i[2];if(o>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},ey=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},ty=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},yu=function(e,t){return e==="v"?Xg(t):Jg(t)},bu=function(e,t){return e==="v"?ey(t):ty(t)},ny=function(e,t){return e==="h"&&t==="rtl"?-1:1},ry=function(e,t,n,r,s){var i=ny(e,window.getComputedStyle(t).direction),o=i*r,a=n.target,l=t.contains(a),d=!1,u=o>0,f=0,h=0;do{if(!a)break;var m=bu(e,a),g=m[0],p=m[1],y=m[2],b=p-y-i*g;(g||b)&&yu(e,a)&&(f+=b,h+=g);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(u&&Math.abs(f)<1||!u&&Math.abs(h)<1)&&(d=!0),d},bs=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Jc=function(e){return[e.deltaX,e.deltaY]},el=function(e){return e&&"current"in e?e.current:e},sy=function(e,t){return e[0]===t[0]&&e[1]===t[1]},iy=function(e){return`
39
39
  .block-interactivity-`.concat(e,` {pointer-events: none;}
40
40
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
41
- `)},sy=0,Wn=[];function iy(e){var t=w.useRef([]),n=w.useRef([0,0]),r=w.useRef(),s=w.useState(sy++)[0],i=w.useState(pu)[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=Tg([e.lockRef.current],(e.shards||[]).map(el),!0).filter(Boolean);return p.forEach(function(y){return y.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),p.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var a=w.useCallback(function(p,y){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!o.current.allowPinchZoom;var b=bs(p),v=n.current,x="deltaX"in p?p.deltaX:v[0]-b[0],_="deltaY"in p?p.deltaY:v[1]-b[1],C,P=p.target,T=Math.abs(x)>Math.abs(_)?"h":"v";if("touches"in p&&T==="h"&&P.type==="range")return!1;var N=window.getSelection(),R=N&&N.anchorNode,A=R?R===P||R.contains(P):!1;if(A)return!1;var j=Xc(T,P);if(!j)return!0;if(j?C=T:(C=T==="v"?"h":"v",j=Xc(T,P)),!j)return!1;if(!r.current&&"changedTouches"in p&&(x||_)&&(r.current=C),!C)return!0;var D=r.current||C;return ty(D,y,p,D==="h"?x:_)},[]),l=w.useCallback(function(p){var y=p;if(!(!Wn.length||Wn[Wn.length-1]!==i)){var b="deltaY"in y?Jc(y):bs(y),v=t.current.filter(function(C){return C.name===y.type&&(C.target===y.target||y.target===C.shadowParent)&&ny(C.delta,b)})[0];if(v&&v.should){y.cancelable&&y.preventDefault();return}if(!v){var x=(o.current.shards||[]).map(el).filter(Boolean).filter(function(C){return C.contains(y.target)}),_=x.length>0?a(y,x[0]):!o.current.noIsolation;_&&y.cancelable&&y.preventDefault()}}},[]),d=w.useCallback(function(p,y,b,v){var x={name:p,delta:y,target:b,should:v,shadowParent:oy(b)};t.current.push(x),setTimeout(function(){t.current=t.current.filter(function(_){return _!==x})},1)},[]),u=w.useCallback(function(p){n.current=bs(p),r.current=void 0},[]),f=w.useCallback(function(p){d(p.type,Jc(p),p.target,a(p,e.lockRef.current))},[]),h=w.useCallback(function(p){d(p.type,bs(p),p.target,a(p,e.lockRef.current))},[]);w.useEffect(function(){return Wn.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",l,zn),document.addEventListener("touchmove",l,zn),document.addEventListener("touchstart",u,zn),function(){Wn=Wn.filter(function(p){return p!==i}),document.removeEventListener("wheel",l,zn),document.removeEventListener("touchmove",l,zn),document.removeEventListener("touchstart",u,zn)}},[]);var m=e.removeScrollBar,g=e.inert;return w.createElement(w.Fragment,null,g?w.createElement(i,{styles:ry(s)}):null,m?w.createElement(qg,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function oy(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const ay=jg(fu,iy);var Ta=w.forwardRef(function(e,t){return w.createElement(bi,Pt({},e,{ref:t,sideCar:ay}))});Ta.classNames=bi.classNames;var cy=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Kn=new WeakMap,vs=new WeakMap,ws={},to=0,yu=function(e){return e&&(e.host||yu(e.parentNode))},ly=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=yu(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})},dy=function(e,t,n,r){var s=ly(t,Array.isArray(e)?e:[e]);ws[n]||(ws[n]=new WeakMap);var i=ws[n],o=[],a=new Set,l=new Set(s),d=function(f){!f||a.has(f)||(a.add(f),d(f.parentNode))};s.forEach(d);var u=function(f){!f||l.has(f)||Array.prototype.forEach.call(f.children,function(h){if(a.has(h))u(h);else try{var m=h.getAttribute(r),g=m!==null&&m!=="false",p=(Kn.get(h)||0)+1,y=(i.get(h)||0)+1;Kn.set(h,p),i.set(h,y),o.push(h),p===1&&g&&vs.set(h,!0),y===1&&h.setAttribute(n,"true"),g||h.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",h,b)}})};return u(t),a.clear(),to++,function(){o.forEach(function(f){var h=Kn.get(f)-1,m=i.get(f)-1;Kn.set(f,h),i.set(f,m),h||(vs.has(f)||f.removeAttribute(r),vs.delete(f)),m||f.removeAttribute(n)}),to--,to||(Kn=new WeakMap,Kn=new WeakMap,vs=new WeakMap,ws={})}},bu=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=cy(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),dy(r,s,n,"aria-hidden")):function(){return null}},vi="Dialog",[vu]=$n(vi),[uy,yt]=vu(vi),wu=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,u]=Dn({prop:r,defaultProp:s??!1,onChange:i,caller:vi});return c.jsx(uy,{scope:t,triggerRef:a,contentRef:l,contentId:on(),titleId:on(),descriptionId:on(),open:d,onOpenChange:u,onOpenToggle:w.useCallback(()=>u(f=>!f),[u]),modal:o,children:n})};wu.displayName=vi;var _u="DialogTrigger",fy=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=yt(_u,n),i=Pe(t,s.triggerRef);return c.jsx(me.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":Ra(s.open),...r,ref:i,onClick:pe(e.onClick,s.onOpenToggle)})});fy.displayName=_u;var Pa="DialogPortal",[py,xu]=vu(Pa,{forceMount:void 0}),Su=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,i=yt(Pa,t);return c.jsx(py,{scope:t,forceMount:n,children:w.Children.map(r,o=>c.jsx(Vn,{present:n||i.open,children:c.jsx(yi,{asChild:!0,container:s,children:o})}))})};Su.displayName=Pa;var Ks="DialogOverlay",ka=w.forwardRef((e,t)=>{const n=xu(Ks,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=yt(Ks,e.__scopeDialog);return i.modal?c.jsx(Vn,{present:r||i.open,children:c.jsx(hy,{...s,ref:t})}):null});ka.displayName=Ks;var my=mr("DialogOverlay.RemoveScroll"),hy=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=yt(Ks,n),i=lg(),o=Pe(t,i);return c.jsx(Ta,{as:my,allowPinchZoom:!0,shards:[s.contentRef],children:c.jsx(me.div,{"data-state":Ra(s.open),...r,ref:o,style:{pointerEvents:"auto",...r.style}})})}),hr="DialogContent",Aa=w.forwardRef((e,t)=>{const n=xu(hr,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=yt(hr,e.__scopeDialog);return c.jsx(Vn,{present:r||i.open,children:i.modal?c.jsx(gy,{...s,ref:t}):c.jsx(yy,{...s,ref:t})})});Aa.displayName=hr;var gy=w.forwardRef((e,t)=>{const n=yt(hr,e.__scopeDialog),r=w.useRef(null),s=Pe(t,n.contentRef,r);return w.useEffect(()=>{const i=r.current;if(i)return bu(i)},[]),c.jsx(Cu,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:pe(e.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:pe(e.onPointerDownOutside,i=>{const o=i.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&i.preventDefault()}),onFocusOutside:pe(e.onFocusOutside,i=>i.preventDefault())})}),yy=w.forwardRef((e,t)=>{const n=yt(hr,e.__scopeDialog),r=w.useRef(!1),s=w.useRef(!1);return c.jsx(Cu,{...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()}})}),Cu=w.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,...o}=e,a=yt(hr,n);return lu(),c.jsx(c.Fragment,{children:c.jsx(Ea,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:c.jsx(gi,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":Ra(a.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>a.onOpenChange(!1)})})})}),Eu="DialogTitle",Na=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=yt(Eu,n);return c.jsx(me.h2,{id:s.titleId,...r,ref:t})});Na.displayName=Eu;var Tu="DialogDescription",Oa=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=yt(Tu,n);return c.jsx(me.p,{id:s.descriptionId,...r,ref:t})});Oa.displayName=Tu;var Pu="DialogClose",by=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=yt(Pu,n);return c.jsx(me.button,{type:"button",...r,ref:t,onClick:pe(e.onClick,()=>s.onOpenChange(!1))})});by.displayName=Pu;function Ra(e){return e?"open":"closed"}const vy=wu,wy=Su,ku=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}));ku.displayName=ka.displayName;const Au=w.forwardRef(({className:e,overlayClass:t,children:n,...r},s)=>c.jsxs(wy,{children:[c.jsx(ku,{className:t}),c.jsx(Aa,{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})]}));Au.displayName=Aa.displayName;const Nu=({className:e,...t})=>c.jsx("div",{className:Ce("flex flex-col space-y-1.5 border-b text-center sm:text-left",e),...t});Nu.displayName="DialogHeader";const Ou=({className:e,...t})=>c.jsx("div",{className:Ce("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Ou.displayName="DialogFooter";const Ru=w.forwardRef(({className:e,...t},n)=>c.jsx(Na,{ref:n,className:Ce("text-lg font-semibold leading-none tracking-tight",e),...t}));Ru.displayName=Na.displayName;const Du=w.forwardRef(({className:e,...t},n)=>c.jsx(Oa,{ref:n,className:Ce("text-sm text-muted-foreground",e),...t}));Du.displayName=Oa.displayName;function tl(e,[t,n]){return Math.min(n,Math.max(t,e))}function Da(e){const t=e+"CollectionProvider",[n,r]=$n(t),[s,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=p=>{const{scope:y,children:b}=p,v=w.useRef(null),x=w.useRef(new Map).current;return c.jsx(s,{scope:y,itemMap:x,collectionRef:v,children:b})};o.displayName=t;const a=e+"CollectionSlot",l=mr(a),d=w.forwardRef((p,y)=>{const{scope:b,children:v}=p,x=i(a,b),_=Pe(y,x.collectionRef);return c.jsx(l,{ref:_,children:v})});d.displayName=a;const u=e+"CollectionItemSlot",f="data-radix-collection-item",h=mr(u),m=w.forwardRef((p,y)=>{const{scope:b,children:v,...x}=p,_=w.useRef(null),C=Pe(y,_),P=i(u,b);return w.useEffect(()=>(P.itemMap.set(_,{ref:_,...x}),()=>void P.itemMap.delete(_))),c.jsx(h,{[f]:"",ref:C,children:v})});m.displayName=u;function g(p){const y=i(e+"CollectionConsumer",p);return w.useCallback(()=>{const v=y.collectionRef.current;if(!v)return[];const x=Array.from(v.querySelectorAll(`[${f}]`));return Array.from(y.itemMap.values()).sort((P,T)=>x.indexOf(P.ref.current)-x.indexOf(T.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:o,Slot:d,ItemSlot:m},g,r]}var _y=w.createContext(void 0);function Lu(e){const t=w.useContext(_y);return e||t||"ltr"}const xy=["top","right","bottom","left"],ln=Math.min,tt=Math.max,Gs=Math.round,_s=Math.floor,At=e=>({x:e,y:e}),Sy={left:"right",right:"left",bottom:"top",top:"bottom"};function Ao(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 La(e){return e==="x"?"y":"x"}function ja(e){return e==="y"?"height":"width"}function kt(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Ia(e){return La(kt(e))}function Cy(e,t,n){n===void 0&&(n=!1);const r=Er(e),s=Ia(e),i=ja(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 Ey(e){const t=qs(e);return[No(e),t,No(t)]}function No(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const nl=["left","right"],rl=["right","left"],Ty=["top","bottom"],Py=["bottom","top"];function ky(e,t,n){switch(e){case"top":case"bottom":return n?t?rl:nl:t?nl:rl;case"left":case"right":return t?Ty:Py;default:return[]}}function Ay(e,t,n,r){const s=Er(e);let i=ky(Ft(e),n==="start",r);return s&&(i=i.map(o=>o+"-"+s),t&&(i=i.concat(i.map(No)))),i}function qs(e){const t=Ft(e);return Sy[t]+e.slice(t.length)}function Ny(e){return{top:0,right:0,bottom:0,left:0,...e}}function ju(e){return typeof e!="number"?Ny(e):{top:e,right:e,bottom:e,left:e}}function Zs(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 sl(e,t,n){let{reference:r,floating:s}=e;const i=kt(t),o=Ia(t),a=ja(o),l=Ft(t),d=i==="y",u=r.x+r.width/2-s.width/2,f=r.y+r.height/2-s.height/2,h=r[a]/2-s[a]/2;let m;switch(l){case"top":m={x:u,y:r.y-s.height};break;case"bottom":m={x:u,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:f};break;case"left":m={x:r.x-s.width,y:f};break;default:m={x:r.x,y:r.y}}switch(Er(t)){case"start":m[o]-=h*(n&&d?-1:1);break;case"end":m[o]+=h*(n&&d?-1:1);break}return m}async function Oy(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:u="viewport",elementContext:f="floating",altBoundary:h=!1,padding:m=0}=Mt(t,e),g=ju(m),y=a[h?f==="floating"?"reference":"floating":f],b=Zs(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(y)))==null||n?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:d,rootBoundary:u,strategy:l})),v=f==="floating"?{x:r,y:s,width:o.floating.width,height:o.floating.height}:o.reference,x=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),_=await(i.isElement==null?void 0:i.isElement(x))?await(i.getScale==null?void 0:i.getScale(x))||{x:1,y:1}:{x:1,y:1},C=Zs(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:x,strategy:l}):v);return{top:(b.top-C.top+g.top)/_.y,bottom:(C.bottom-b.bottom+g.bottom)/_.y,left:(b.left-C.left+g.left)/_.x,right:(C.right-b.right+g.right)/_.x}}const Ry=50,Dy=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:o}=n,a=o.detectOverflow?o:{...o,detectOverflow:Oy},l=await(o.isRTL==null?void 0:o.isRTL(t));let d=await o.getElementRects({reference:e,floating:t,strategy:s}),{x:u,y:f}=sl(d,r,l),h=r,m=0;const g={};for(let p=0;p<i.length;p++){const y=i[p];if(!y)continue;const{name:b,fn:v}=y,{x,y:_,data:C,reset:P}=await v({x:u,y:f,initialPlacement:r,placement:h,strategy:s,middlewareData:g,rects:d,platform:a,elements:{reference:e,floating:t}});u=x??u,f=_??f,g[b]={...g[b],...C},P&&m<Ry&&(m++,typeof P=="object"&&(P.placement&&(h=P.placement),P.rects&&(d=P.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:s}):P.rects),{x:u,y:f}=sl(d,h,l)),p=-1)}return{x:u,y:f,placement:h,strategy:s,middlewareData:g}},Ly=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:u=0}=Mt(e,t)||{};if(d==null)return{};const f=ju(u),h={x:n,y:r},m=Ia(s),g=ja(m),p=await o.getDimensions(d),y=m==="y",b=y?"top":"left",v=y?"bottom":"right",x=y?"clientHeight":"clientWidth",_=i.reference[g]+i.reference[m]-h[m]-i.floating[g],C=h[m]-i.reference[m],P=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let T=P?P[x]:0;(!T||!await(o.isElement==null?void 0:o.isElement(P)))&&(T=a.floating[x]||i.floating[g]);const N=_/2-C/2,R=T/2-p[g]/2-1,A=ln(f[b],R),j=ln(f[v],R),D=A,B=T-p[g]-j,O=T/2-p[g]/2+N,H=Ao(D,O,B),U=!l.arrow&&Er(s)!=null&&O!==H&&i.reference[g]/2-(O<D?A:j)-p[g]/2<0,I=U?O<D?O-D:O-B:0;return{[m]:h[m]+I,data:{[m]:H,centerOffset:O-H-I,...U&&{alignmentOffset:I}},reset:U}}}),jy=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:u=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:p=!0,...y}=Mt(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const b=Ft(s),v=kt(a),x=Ft(a)===a,_=await(l.isRTL==null?void 0:l.isRTL(d.floating)),C=h||(x||!p?[qs(a)]:Ey(a)),P=g!=="none";!h&&P&&C.push(...Ay(a,p,g,_));const T=[a,...C],N=await l.detectOverflow(t,y),R=[];let A=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&R.push(N[b]),f){const O=Cy(s,o,_);R.push(N[O[0]],N[O[1]])}if(A=[...A,{placement:s,overflows:R}],!R.every(O=>O<=0)){var j,D;const O=(((j=i.flip)==null?void 0:j.index)||0)+1,H=T[O];if(H&&(!(f==="alignment"?v!==kt(H):!1)||A.every(L=>kt(L.placement)===v?L.overflows[0]>0:!0)))return{data:{index:O,overflows:A},reset:{placement:H}};let U=(D=A.filter(I=>I.overflows[0]<=0).sort((I,L)=>I.overflows[1]-L.overflows[1])[0])==null?void 0:D.placement;if(!U)switch(m){case"bestFit":{var B;const I=(B=A.filter(L=>{if(P){const M=kt(L.placement);return M===v||M==="y"}return!0}).map(L=>[L.placement,L.overflows.filter(M=>M>0).reduce((M,K)=>M+K,0)]).sort((L,M)=>L[1]-M[1])[0])==null?void 0:B[0];I&&(U=I);break}case"initialPlacement":U=a;break}if(s!==U)return{reset:{placement:U}}}return{}}}};function il(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ol(e){return xy.some(t=>e[t]>=0)}const Iy=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=il(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:ol(a)}}}case"escaped":{const o=await r.detectOverflow(t,{...i,altBoundary:!0}),a=il(o,n.floating);return{data:{escapedOffsets:a,escaped:ol(a)}}}default:return{}}}}},Iu=new Set(["left","top"]);async function My(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=kt(n)==="y",d=Iu.has(o)?-1:1,u=i&&l?-1:1,f=Mt(t,e);let{mainAxis:h,crossAxis:m,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof g=="number"&&(m=a==="end"?g*-1:g),l?{x:m*u,y:h*d}:{x:h*d,y:m*u}}const Fy=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 My(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}}}}},Uy=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:x}=b;return{x:v,y:x}}},...d}=Mt(e,t),u={x:n,y:r},f=await i.detectOverflow(t,d),h=kt(Ft(s)),m=La(h);let g=u[m],p=u[h];if(o){const b=m==="y"?"top":"left",v=m==="y"?"bottom":"right",x=g+f[b],_=g-f[v];g=Ao(x,g,_)}if(a){const b=h==="y"?"top":"left",v=h==="y"?"bottom":"right",x=p+f[b],_=p-f[v];p=Ao(x,p,_)}const y=l.fn({...t,[m]:g,[h]:p});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[m]:o,[h]:a}}}}}},By=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),u={x:n,y:r},f=kt(s),h=La(f);let m=u[h],g=u[f];const p=Mt(a,t),y=typeof p=="number"?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(l){const x=h==="y"?"height":"width",_=i.reference[h]-i.floating[x]+y.mainAxis,C=i.reference[h]+i.reference[x]-y.mainAxis;m<_?m=_:m>C&&(m=C)}if(d){var b,v;const x=h==="y"?"width":"height",_=Iu.has(Ft(s)),C=i.reference[f]-i.floating[x]+(_&&((b=o.offset)==null?void 0:b[f])||0)+(_?0:y.crossAxis),P=i.reference[f]+i.reference[x]+(_?0:((v=o.offset)==null?void 0:v[f])||0)-(_?y.crossAxis:0);g<C?g=C:g>P&&(g=P)}return{[h]:m,[f]:g}}}},$y=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),u=await o.detectOverflow(t,d),f=Ft(s),h=Er(s),m=kt(s)==="y",{width:g,height:p}=i.floating;let y,b;f==="top"||f==="bottom"?(y=f,b=h===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(b=f,y=h==="end"?"top":"bottom");const v=p-u.top-u.bottom,x=g-u.left-u.right,_=ln(p-u[y],v),C=ln(g-u[b],x),P=!t.middlewareData.shift;let T=_,N=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(N=x),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(T=v),P&&!h){const A=tt(u.left,0),j=tt(u.right,0),D=tt(u.top,0),B=tt(u.bottom,0);m?N=g-2*(A!==0||j!==0?A+j:tt(u.left,u.right)):T=p-2*(D!==0||B!==0?D+B:tt(u.top,u.bottom))}await l({...t,availableWidth:N,availableHeight:T});const R=await o.getDimensions(a.floating);return g!==R.width||p!==R.height?{reset:{rects:!0}}:{}}}};function wi(){return typeof window<"u"}function Tr(e){return Mu(e)?(e.nodeName||"").toLowerCase():"#document"}function nt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ot(e){var t;return(t=(Mu(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Mu(e){return wi()?e instanceof Node||e instanceof nt(e).Node:!1}function ht(e){return wi()?e instanceof Element||e instanceof nt(e).Element:!1}function $t(e){return wi()?e instanceof HTMLElement||e instanceof nt(e).HTMLElement:!1}function al(e){return!wi()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof nt(e).ShadowRoot}function ns(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=gt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function Vy(e){return/^(table|td|th)$/.test(Tr(e))}function _i(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Hy=/transform|translate|scale|rotate|perspective|filter/,zy=/paint|layout|strict|content/,yn=e=>!!e&&e!=="none";let no;function Ma(e){const t=ht(e)?gt(e):e;return yn(t.transform)||yn(t.translate)||yn(t.scale)||yn(t.rotate)||yn(t.perspective)||!Fa()&&(yn(t.backdropFilter)||yn(t.filter))||Hy.test(t.willChange||"")||zy.test(t.contain||"")}function Wy(e){let t=dn(e);for(;$t(t)&&!gr(t);){if(Ma(t))return t;if(_i(t))return null;t=dn(t)}return null}function Fa(){return no==null&&(no=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),no}function gr(e){return/^(html|body|#document)$/.test(Tr(e))}function gt(e){return nt(e).getComputedStyle(e)}function xi(e){return ht(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||al(e)&&e.host||Ot(e);return al(t)?t.host:t}function Fu(e){const t=dn(e);return gr(t)?e.ownerDocument?e.ownerDocument.body:e.body:$t(t)&&ns(t)?t:Fu(t)}function $r(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=Fu(e),i=s===((r=e.ownerDocument)==null?void 0:r.body),o=nt(s);if(i){const a=Oo(o);return t.concat(o,o.visualViewport||[],ns(s)?s:[],a&&n?$r(a):[])}else return t.concat(s,$r(s,[],n))}function Oo(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Uu(e){const t=gt(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=Gs(n)!==i||Gs(r)!==o;return a&&(n=i,r=o),{width:n,height:r,$:a}}function Ua(e){return ht(e)?e:e.contextElement}function er(e){const t=Ua(e);if(!$t(t))return At(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:i}=Uu(t);let o=(i?Gs(n.width):n.width)/r,a=(i?Gs(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const Ky=At(0);function Bu(e){const t=nt(e);return!Fa()||!t.visualViewport?Ky:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Gy(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==nt(e)?!1:t}function Ln(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=Ua(e);let o=At(1);t&&(r?ht(r)&&(o=er(r)):o=er(e));const a=Gy(i,n,r)?Bu(i):At(0);let l=(s.left+a.x)/o.x,d=(s.top+a.y)/o.y,u=s.width/o.x,f=s.height/o.y;if(i){const h=nt(i),m=r&&ht(r)?nt(r):r;let g=h,p=Oo(g);for(;p&&r&&m!==g;){const y=er(p),b=p.getBoundingClientRect(),v=gt(p),x=b.left+(p.clientLeft+parseFloat(v.paddingLeft))*y.x,_=b.top+(p.clientTop+parseFloat(v.paddingTop))*y.y;l*=y.x,d*=y.y,u*=y.x,f*=y.y,l+=x,d+=_,g=nt(p),p=Oo(g)}}return Zs({width:u,height:f,x:l,y:d})}function Si(e,t){const n=xi(e).scrollLeft;return t?t.left+n:Ln(Ot(e)).left+n}function $u(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Si(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function qy(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const i=s==="fixed",o=Ot(r),a=t?_i(t.floating):!1;if(r===o||a&&i)return n;let l={scrollLeft:0,scrollTop:0},d=At(1);const u=At(0),f=$t(r);if((f||!f&&!i)&&((Tr(r)!=="body"||ns(o))&&(l=xi(r)),f)){const m=Ln(r);d=er(r),u.x=m.x+r.clientLeft,u.y=m.y+r.clientTop}const h=o&&!f&&!i?$u(o,l):At(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-l.scrollLeft*d.x+u.x+h.x,y:n.y*d.y-l.scrollTop*d.y+u.y+h.y}}function Zy(e){return Array.from(e.getClientRects())}function Yy(e){const t=Ot(e),n=xi(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+Si(e);const a=-n.scrollTop;return gt(r).direction==="rtl"&&(o+=tt(t.clientWidth,r.clientWidth)-s),{width:s,height:i,x:o,y:a}}const cl=25;function Qy(e,t){const n=nt(e),r=Ot(e),s=n.visualViewport;let i=r.clientWidth,o=r.clientHeight,a=0,l=0;if(s){i=s.width,o=s.height;const u=Fa();(!u||u&&t==="fixed")&&(a=s.offsetLeft,l=s.offsetTop)}const d=Si(r);if(d<=0){const u=r.ownerDocument,f=u.body,h=getComputedStyle(f),m=u.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,g=Math.abs(r.clientWidth-f.clientWidth-m);g<=cl&&(i-=g)}else d<=cl&&(i+=d);return{width:i,height:o,x:a,y:l}}function Xy(e,t){const n=Ln(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,i=$t(e)?er(e):At(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 ll(e,t,n){let r;if(t==="viewport")r=Qy(e,n);else if(t==="document")r=Yy(Ot(e));else if(ht(t))r=Xy(t,n);else{const s=Bu(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return Zs(r)}function Vu(e,t){const n=dn(e);return n===t||!ht(n)||gr(n)?!1:gt(n).position==="fixed"||Vu(n,t)}function Jy(e,t){const n=t.get(e);if(n)return n;let r=$r(e,[],!1).filter(a=>ht(a)&&Tr(a)!=="body"),s=null;const i=gt(e).position==="fixed";let o=i?dn(e):e;for(;ht(o)&&!gr(o);){const a=gt(o),l=Ma(o);!l&&a.position==="fixed"&&(s=null),(i?!l&&!s:!l&&a.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||ns(o)&&!l&&Vu(e,o))?r=r.filter(u=>u!==o):s=a,o=dn(o)}return t.set(e,r),r}function eb(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const o=[...n==="clippingAncestors"?_i(t)?[]:Jy(t,this._c):[].concat(n),r],a=ll(t,o[0],s);let l=a.top,d=a.right,u=a.bottom,f=a.left;for(let h=1;h<o.length;h++){const m=ll(t,o[h],s);l=tt(m.top,l),d=ln(m.right,d),u=ln(m.bottom,u),f=tt(m.left,f)}return{width:d-f,height:u-l,x:f,y:l}}function tb(e){const{width:t,height:n}=Uu(e);return{width:t,height:n}}function nb(e,t,n){const r=$t(t),s=Ot(t),i=n==="fixed",o=Ln(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=At(0);function d(){l.x=Si(s)}if(r||!r&&!i)if((Tr(t)!=="body"||ns(s))&&(a=xi(t)),r){const m=Ln(t,!0,i,t);l.x=m.x+t.clientLeft,l.y=m.y+t.clientTop}else s&&d();i&&!r&&s&&d();const u=s&&!r&&!i?$u(s,a):At(0),f=o.left+a.scrollLeft-l.x-u.x,h=o.top+a.scrollTop-l.y-u.y;return{x:f,y:h,width:o.width,height:o.height}}function ro(e){return gt(e).position==="static"}function dl(e,t){if(!$t(e)||gt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ot(e)===n&&(n=n.ownerDocument.body),n}function Hu(e,t){const n=nt(e);if(_i(e))return n;if(!$t(e)){let s=dn(e);for(;s&&!gr(s);){if(ht(s)&&!ro(s))return s;s=dn(s)}return n}let r=dl(e,t);for(;r&&Vy(r)&&ro(r);)r=dl(r,t);return r&&gr(r)&&ro(r)&&!Ma(r)?n:r||Wy(e)||n}const rb=async function(e){const t=this.getOffsetParent||Hu,n=this.getDimensions,r=await n(e.floating);return{reference:nb(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function sb(e){return gt(e).direction==="rtl"}const ib={convertOffsetParentRelativeRectToViewportRelativeRect:qy,getDocumentElement:Ot,getClippingRect:eb,getOffsetParent:Hu,getElementRects:rb,getClientRects:Zy,getDimensions:tb,getScale:er,isElement:ht,isRTL:sb};function zu(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ob(e,t){let n=null,r;const s=Ot(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:u,top:f,width:h,height:m}=d;if(a||t(),!h||!m)return;const g=_s(f),p=_s(s.clientWidth-(u+h)),y=_s(s.clientHeight-(f+m)),b=_s(u),x={rootMargin:-g+"px "+-p+"px "+-y+"px "+-b+"px",threshold:tt(0,ln(1,l))||1};let _=!0;function C(P){const T=P[0].intersectionRatio;if(T!==l){if(!_)return o();T?o(!1,T):r=setTimeout(()=>{o(!1,1e-7)},1e3)}T===1&&!zu(d,e.getBoundingClientRect())&&o(),_=!1}try{n=new IntersectionObserver(C,{...x,root:s.ownerDocument})}catch{n=new IntersectionObserver(C,x)}n.observe(e)}return o(!0),i}function ab(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=Ua(e),u=s||i?[...d?$r(d):[],...t?$r(t):[]]:[];u.forEach(b=>{s&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const f=d&&a?ob(d,n):null;let h=-1,m=null;o&&(m=new ResizeObserver(b=>{let[v]=b;v&&v.target===d&&m&&t&&(m.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var x;(x=m)==null||x.observe(t)})),n()}),d&&!l&&m.observe(d),t&&m.observe(t));let g,p=l?Ln(e):null;l&&y();function y(){const b=Ln(e);p&&!zu(p,b)&&n(),p=b,g=requestAnimationFrame(y)}return n(),()=>{var b;u.forEach(v=>{s&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),f==null||f(),(b=m)==null||b.disconnect(),m=null,l&&cancelAnimationFrame(g)}}const cb=Fy,lb=Uy,db=jy,ub=$y,fb=Iy,ul=Ly,pb=By,mb=(e,t,n)=>{const r=new Map,s={platform:ib,...n},i={...s.platform,_c:r};return Dy(e,t,{...s,platform:i})};var hb=typeof document<"u",gb=function(){},Is=hb?S.useLayoutEffect:gb;function Ys(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(!Ys(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)&&!Ys(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function Wu(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function fl(e,t){const n=Wu(e);return Math.round(t*n)/n}function so(e){const t=w.useRef(e);return Is(()=>{t.current=e}),t}function yb(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,[u,f]=w.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,m]=w.useState(r);Ys(h,r)||m(r);const[g,p]=w.useState(null),[y,b]=w.useState(null),v=w.useCallback(L=>{L!==P.current&&(P.current=L,p(L))},[]),x=w.useCallback(L=>{L!==T.current&&(T.current=L,b(L))},[]),_=i||g,C=o||y,P=w.useRef(null),T=w.useRef(null),N=w.useRef(u),R=l!=null,A=so(l),j=so(s),D=so(d),B=w.useCallback(()=>{if(!P.current||!T.current)return;const L={placement:t,strategy:n,middleware:h};j.current&&(L.platform=j.current),mb(P.current,T.current,L).then(M=>{const K={...M,isPositioned:D.current!==!1};O.current&&!Ys(N.current,K)&&(N.current=K,Cr.flushSync(()=>{f(K)}))})},[h,t,n,j,D]);Is(()=>{d===!1&&N.current.isPositioned&&(N.current.isPositioned=!1,f(L=>({...L,isPositioned:!1})))},[d]);const O=w.useRef(!1);Is(()=>(O.current=!0,()=>{O.current=!1}),[]),Is(()=>{if(_&&(P.current=_),C&&(T.current=C),_&&C){if(A.current)return A.current(_,C,B);B()}},[_,C,B,A,R]);const H=w.useMemo(()=>({reference:P,floating:T,setReference:v,setFloating:x}),[v,x]),U=w.useMemo(()=>({reference:_,floating:C}),[_,C]),I=w.useMemo(()=>{const L={position:n,left:0,top:0};if(!U.floating)return L;const M=fl(U.floating,u.x),K=fl(U.floating,u.y);return a?{...L,transform:"translate("+M+"px, "+K+"px)",...Wu(U.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:M,top:K}},[n,a,U.floating,u.x,u.y]);return w.useMemo(()=>({...u,update:B,refs:H,elements:U,floatingStyles:I}),[u,B,H,U,I])}const bb=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?ul({element:r.current,padding:s}).fn(n):{}:r?ul({element:r,padding:s}).fn(n):{}}}},vb=(e,t)=>{const n=cb(e);return{name:n.name,fn:n.fn,options:[e,t]}},wb=(e,t)=>{const n=lb(e);return{name:n.name,fn:n.fn,options:[e,t]}},_b=(e,t)=>({fn:pb(e).fn,options:[e,t]}),xb=(e,t)=>{const n=db(e);return{name:n.name,fn:n.fn,options:[e,t]}},Sb=(e,t)=>{const n=ub(e);return{name:n.name,fn:n.fn,options:[e,t]}},Cb=(e,t)=>{const n=fb(e);return{name:n.name,fn:n.fn,options:[e,t]}},Eb=(e,t)=>{const n=bb(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Tb="Arrow",Ku=w.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...i}=e;return c.jsx(me.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"})})});Ku.displayName=Tb;var Pb=Ku;function kb(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 Ba="Popper",[Gu,qu]=$n(Ba),[Ab,Zu]=Gu(Ba),Yu=e=>{const{__scopePopper:t,children:n}=e,[r,s]=w.useState(null),[i,o]=w.useState(void 0);return c.jsx(Ab,{scope:t,anchor:r,onAnchorChange:s,placementState:i,setPlacementState:o,children:n})};Yu.displayName=Ba;var Qu="PopperAnchor",Xu=w.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,i=Zu(Qu,n),o=w.useRef(null),a=i.onAnchorChange,l=w.useCallback(g=>{o.current=g,g&&a(g)},[a]),d=Pe(t,l),u=w.useRef(null);w.useEffect(()=>{if(!r)return;const g=u.current;u.current=r.current,g!==u.current&&a(u.current)});const f=i.placementState&&Va(i.placementState),h=f==null?void 0:f[0],m=f==null?void 0:f[1];return r?null:c.jsx(me.div,{"data-radix-popper-side":h,"data-radix-popper-align":m,...s,ref:d})});Xu.displayName=Qu;var $a="PopperContent",[Nb,Ob]=Gu($a),Ju=w.forwardRef((e,t)=>{var $,ye,ae,ie,te,je;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:i="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:d=[],collisionPadding:u=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:m="optimized",onPlaced:g,...p}=e,y=Zu($a,n),[b,v]=w.useState(null),x=Pe(t,Re=>v(Re)),[_,C]=w.useState(null),P=kb(_),T=(P==null?void 0:P.width)??0,N=(P==null?void 0:P.height)??0,R=r+(i!=="center"?"-"+i:""),A=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},j=Array.isArray(d)?d:[d],D=j.length>0,B={padding:A,boundary:j.filter(Db),altBoundary:D},{refs:O,floatingStyles:H,placement:U,isPositioned:I,middlewareData:L}=yb({strategy:"fixed",placement:R,whileElementsMounted:(...Re)=>ab(...Re,{animationFrame:m==="always"}),elements:{reference:y.anchor},middleware:[vb({mainAxis:s+N,alignmentAxis:o}),l&&wb({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?_b():void 0,...B}),l&&xb({...B}),Sb({...B,apply:({elements:Re,rects:Ne,availableWidth:X,availableHeight:ke})=>{const{width:Fe,height:Qe}=Ne.reference,ct=Re.floating.style;ct.setProperty("--radix-popper-available-width",`${X}px`),ct.setProperty("--radix-popper-available-height",`${ke}px`),ct.setProperty("--radix-popper-anchor-width",`${Fe}px`),ct.setProperty("--radix-popper-anchor-height",`${Qe}px`)}}),_&&Eb({element:_,padding:a}),Lb({arrowWidth:T,arrowHeight:N}),h&&Cb({strategy:"referenceHidden",...B,boundary:D?B.boundary:void 0})]}),M=y.setPlacementState;Ie(()=>(M(U),()=>{M(void 0)}),[U,M]);const[K,F]=Va(U),se=mt(g);Ie(()=>{I&&(se==null||se())},[I,se]);const z=($=L.arrow)==null?void 0:$.x,de=(ye=L.arrow)==null?void 0:ye.y,ue=((ae=L.arrow)==null?void 0:ae.centerOffset)!==0,[ee,Z]=w.useState();return Ie(()=>{b&&Z(window.getComputedStyle(b).zIndex)},[b]),c.jsx("div",{ref:O.setFloating,"data-radix-popper-content-wrapper":"",style:{...H,transform:I?H.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ee,"--radix-popper-transform-origin":[(ie=L.transformOrigin)==null?void 0:ie.x,(te=L.transformOrigin)==null?void 0:te.y].join(" "),...((je=L.hide)==null?void 0:je.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:c.jsx(Nb,{scope:n,placedSide:K,placedAlign:F,onArrowChange:C,arrowX:z,arrowY:de,shouldHideArrow:ue,children:c.jsx(me.div,{"data-side":K,"data-align":F,...p,ref:x,style:{...p.style,animation:I?void 0:"none"}})})})});Ju.displayName=$a;var ef="PopperArrow",Rb={top:"bottom",right:"left",bottom:"top",left:"right"},tf=w.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,i=Ob(ef,r),o=Rb[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(Pb,{...s,ref:n,style:{...s.style,display:"block"}})})});tf.displayName=ef;function Db(e){return e!==null}var Lb=e=>({name:"transformOrigin",options:e,fn(t){var y,b,v;const{placement:n,rects:r,middlewareData:s}=t,o=((y=s.arrow)==null?void 0:y.centerOffset)!==0,a=o?0:e.arrowWidth,l=o?0:e.arrowHeight,[d,u]=Va(n),f={start:"0%",center:"50%",end:"100%"}[u],h=(((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?f:`${h}px`,p=`${-l}px`):d==="top"?(g=o?f:`${h}px`,p=`${r.floating.height+l}px`):d==="right"?(g=`${-l}px`,p=o?f:`${m}px`):d==="left"&&(g=`${r.floating.width+l}px`,p=o?f:`${m}px`),{data:{x:g,y:p}}}});function Va(e){const[t,n="center"]=e.split("-");return[t,n]}var jb=Yu,Ib=Xu,Mb=Ju,Fb=tf;function Ub(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 nf=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"}),Bb="VisuallyHidden",Ha=w.forwardRef((e,t)=>c.jsx(me.span,{...e,ref:t,style:{...nf,...e.style}}));Ha.displayName=Bb;var $b=[" ","Enter","ArrowUp","ArrowDown"],Vb=[" ","Enter"],jn="Select",[Ci,Ei,Hb]=Da(jn),[Hn]=$n(jn,[Hb,qu]),Ti=qu(),[zb,mn]=Hn(jn),[Wb,Kb]=Hn(jn),Gb="SelectProvider";function rf(e){const{__scopeSelect:t,children:n,open:r,defaultOpen:s,onOpenChange:i,value:o,defaultValue:a,onValueChange:l,dir:d,name:u,autoComplete:f,disabled:h,required:m,form:g,internal_do_not_use_render:p}=e,y=Ti(t),[b,v]=w.useState(null),[x,_]=w.useState(null),[C,P]=w.useState(!1),T=Lu(d),[N,R]=Dn({prop:r,defaultProp:s??!1,onChange:i,caller:jn}),[A,j]=Dn({prop:o,defaultProp:a,onChange:l,caller:jn}),D=w.useRef(null),B=b?!!g||!!b.closest("form"):!0,[O,H]=w.useState(new Set),U=on(),I=Array.from(O).map(F=>F.props.value).join(";"),L=w.useCallback(F=>{H(se=>new Set(se).add(F))},[]),M=w.useCallback(F=>{H(se=>{const z=new Set(se);return z.delete(F),z})},[]),K={required:m,trigger:b,onTriggerChange:v,valueNode:x,onValueNodeChange:_,valueNodeHasChildren:C,onValueNodeHasChildrenChange:P,contentId:U,value:A,onValueChange:j,open:N,onOpenChange:R,dir:T,triggerPointerDownPosRef:D,disabled:h,name:u,autoComplete:f,form:g,nativeOptions:O,nativeSelectKey:I,isFormControl:B};return c.jsx(jb,{...y,children:c.jsx(zb,{scope:t,...K,children:c.jsx(Ci.Provider,{scope:t,children:c.jsx(Wb,{scope:t,onNativeOptionAdd:L,onNativeOptionRemove:M,children:cv(p)?p(K):n})})})})}rf.displayName=Gb;var sf=e=>{const{__scopeSelect:t,children:n,...r}=e;return c.jsx(rf,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:s})=>c.jsxs(c.Fragment,{children:[n,s?c.jsx(Tf,{__scopeSelect:t}):null]})})};sf.displayName=jn;var of="SelectTrigger",za=w.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...s}=e,i=Ti(n),o=mn(of,n),a=o.disabled||r,l=Pe(t,o.onTriggerChange),d=Ei(n),u=w.useRef("touch"),[f,h,m]=Pf(p=>{const y=d().filter(x=>!x.disabled),b=y.find(x=>x.value===o.value),v=kf(y,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(Ib,{asChild:!0,...i,children:c.jsx(me.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":Pi(o.value)?"":void 0,...s,ref:l,onClick:pe(s.onClick,p=>{p.currentTarget.focus(),u.current!=="mouse"&&g(p)}),onPointerDown:pe(s.onPointerDown,p=>{u.current=p.pointerType;const y=p.target;y.hasPointerCapture(p.pointerId)&&y.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(g(p),p.preventDefault())}),onKeyDown:pe(s.onKeyDown,p=>{const y=f.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&h(p.key),!(y&&p.key===" ")&&$b.includes(p.key)&&(g(),p.preventDefault())})})})});za.displayName=of;var af="SelectValue",cf=w.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,children:i,placeholder:o="",...a}=e,l=mn(af,n),{onValueNodeHasChildrenChange:d}=l,u=i!==void 0,f=Pe(t,l.onValueNodeChange);Ie(()=>{d(u)},[d,u]);const h=Pi(l.value);return c.jsx(me.span,{...a,asChild:h?!1:a.asChild,ref:f,style:{pointerEvents:"none"},children:c.jsx(w.Fragment,{children:h?o:i},h?"placeholder":"value")})});cf.displayName=af;var qb="SelectIcon",lf=w.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...s}=e;return c.jsx(me.span,{"aria-hidden":!0,...s,ref:t,children:r||"▼"})});lf.displayName=qb;var df="SelectPortal",[Zb,Yb]=Hn(df,{forceMount:void 0}),uf=e=>{const{__scopeSelect:t,forceMount:n,...r}=e;return c.jsx(Zb,{scope:e.__scopeSelect,forceMount:n,children:c.jsx(yi,{asChild:!0,...r})})};uf.displayName=df;var un="SelectContent",Wa=w.forwardRef((e,t)=>{const n=Yb(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(Vn,{present:r||i.open,children:({present:l})=>l?c.jsx(mf,{...s,ref:t}):c.jsx(ff,{...s,fragment:o})})});Wa.displayName=un;var ff=w.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,fragment:s}=e;return s?Cr.createPortal(c.jsx(pf,{scope:n,children:c.jsx(Ci.Slot,{scope:n,children:c.jsx("div",{ref:t,children:r})})}),s):null});ff.displayName="SelectContentFragment";var dt=10,[pf,hn]=Hn(un),Qb="SelectContentImpl",Xb=mr("SelectContent.RemoveScroll"),mf=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:u,arrowPadding:f,collisionBoundary:h,collisionPadding:m,sticky:g,hideWhenDetached:p,avoidCollisions:y,...b}=e,v=mn(un,n),[x,_]=w.useState(null),[C,P]=w.useState(null),T=Pe(t,Z=>_(Z)),[N,R]=w.useState(null),[A,j]=w.useState(null),D=Ei(n),[B,O]=w.useState(!1),H=w.useRef(!1);w.useEffect(()=>{if(x)return bu(x)},[x]),lu();const U=w.useCallback(Z=>{const[$,...ye]=D().map(te=>te.ref.current),[ae]=ye.slice(-1),ie=document.activeElement;for(const te of Z)if(te===ie||(te==null||te.scrollIntoView({block:"nearest"}),te===$&&C&&(C.scrollTop=0),te===ae&&C&&(C.scrollTop=C.scrollHeight),te==null||te.focus(),document.activeElement!==ie))return},[D,C]),I=w.useCallback(()=>U([N,x]),[U,N,x]);w.useEffect(()=>{B&&I()},[B,I]);const{onOpenChange:L,triggerPointerDownPosRef:M}=v;w.useEffect(()=>{if(x){let Z={x:0,y:0};const $=ae=>{var ie,te;Z={x:Math.abs(Math.round(ae.pageX)-(((ie=M.current)==null?void 0:ie.x)??0)),y:Math.abs(Math.round(ae.pageY)-(((te=M.current)==null?void 0:te.y)??0))}},ye=ae=>{Z.x<=10&&Z.y<=10?ae.preventDefault():ae.composedPath().includes(x)||L(!1),document.removeEventListener("pointermove",$),M.current=null};return M.current!==null&&(document.addEventListener("pointermove",$),document.addEventListener("pointerup",ye,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",$),document.removeEventListener("pointerup",ye,{capture:!0})}}},[x,L,M]),w.useEffect(()=>{const Z=()=>L(!1);return window.addEventListener("blur",Z),window.addEventListener("resize",Z),()=>{window.removeEventListener("blur",Z),window.removeEventListener("resize",Z)}},[L]);const[K,F]=Pf(Z=>{const $=D().filter(ie=>!ie.disabled),ye=$.find(ie=>ie.ref.current===document.activeElement),ae=kf($,Z,ye);ae&&setTimeout(()=>{var ie;return(ie=ae.ref.current)==null?void 0:ie.focus()})}),se=w.useCallback((Z,$,ye)=>{const ae=!H.current&&!ye;(v.value!==void 0&&v.value===$||ae)&&(R(Z),ae&&(H.current=!0))},[v.value]),z=w.useCallback(()=>x==null?void 0:x.focus(),[x]),de=w.useCallback((Z,$,ye)=>{const ae=!H.current&&!ye;(v.value!==void 0&&v.value===$||ae)&&j(Z)},[v.value]),ue=r==="popper"?Ro:hf,ee=ue===Ro?{side:a,sideOffset:l,align:d,alignOffset:u,arrowPadding:f,collisionBoundary:h,collisionPadding:m,sticky:g,hideWhenDetached:p,avoidCollisions:y}:{};return c.jsx(pf,{scope:n,content:x,viewport:C,onViewportChange:P,itemRefCallback:se,selectedItem:N,onItemLeave:z,itemTextRefCallback:de,focusSelectedItem:I,selectedItemText:A,position:r,isPositioned:B,searchRef:K,children:c.jsx(Ta,{as:Xb,allowPinchZoom:!0,children:c.jsx(Ea,{asChild:!0,trapped:v.open,onMountAutoFocus:Z=>{Z.preventDefault()},onUnmountAutoFocus:pe(s,Z=>{var $;($=v.trigger)==null||$.focus({preventScroll:!0}),Z.preventDefault()}),children:c.jsx(gi,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:Z=>Z.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:c.jsx(ue,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:Z=>Z.preventDefault(),...b,...ee,onPlaced:()=>O(!0),ref:T,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:pe(b.onKeyDown,Z=>{const $=Z.ctrlKey||Z.altKey||Z.metaKey;if(Z.key==="Tab"&&Z.preventDefault(),!$&&Z.key.length===1&&F(Z.key),["ArrowUp","ArrowDown","Home","End"].includes(Z.key)){let ae=D().filter(ie=>!ie.disabled).map(ie=>ie.ref.current);if(["ArrowUp","End"].includes(Z.key)&&(ae=ae.slice().reverse()),["ArrowUp","ArrowDown"].includes(Z.key)){const ie=Z.target,te=ae.indexOf(ie);ae=ae.slice(te+1)}setTimeout(()=>U(ae)),Z.preventDefault()}})})})})})})});mf.displayName=Qb;var Jb="SelectItemAlignedPosition",hf=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,u]=w.useState(null),f=Pe(t,T=>u(T)),h=Ei(n),m=w.useRef(!1),g=w.useRef(!0),{viewport:p,selectedItem:y,selectedItemText:b,focusSelectedItem:v}=o,x=w.useCallback(()=>{if(i.trigger&&i.valueNode&&a&&d&&p&&y&&b){const T=i.trigger.getBoundingClientRect(),N=d.getBoundingClientRect(),R=i.valueNode.getBoundingClientRect(),A=b.getBoundingClientRect();if(i.dir!=="rtl"){const ie=A.left-N.left,te=R.left-ie,je=T.left-te,Re=T.width+je,Ne=Math.max(Re,N.width),X=window.innerWidth-dt,ke=tl(te,[dt,Math.max(dt,X-Ne)]);a.style.minWidth=Re+"px",a.style.left=ke+"px"}else{const ie=N.right-A.right,te=window.innerWidth-R.right-ie,je=window.innerWidth-T.right-te,Re=T.width+je,Ne=Math.max(Re,N.width),X=window.innerWidth-dt,ke=tl(te,[dt,Math.max(dt,X-Ne)]);a.style.minWidth=Re+"px",a.style.right=ke+"px"}const j=h(),D=window.innerHeight-dt*2,B=p.scrollHeight,O=window.getComputedStyle(d),H=parseInt(O.borderTopWidth,10),U=parseInt(O.paddingTop,10),I=parseInt(O.borderBottomWidth,10),L=parseInt(O.paddingBottom,10),M=H+U+B+L+I,K=Math.min(y.offsetHeight*5,M),F=window.getComputedStyle(p),se=parseInt(F.paddingTop,10),z=parseInt(F.paddingBottom,10),de=T.top+T.height/2-dt,ue=D-de,ee=y.offsetHeight/2,Z=y.offsetTop+ee,$=H+U+Z,ye=M-$;if($<=de){const ie=j.length>0&&y===j[j.length-1].ref.current;a.style.bottom="0px";const te=d.clientHeight-p.offsetTop-p.offsetHeight,je=Math.max(ue,ee+(ie?z:0)+te+I),Re=$+je;a.style.height=Re+"px"}else{const ie=j.length>0&&y===j[0].ref.current;a.style.top="0px";const je=Math.max(de,H+p.offsetTop+(ie?se:0)+ee)+ye;a.style.height=je+"px",p.scrollTop=$-de+p.offsetTop}a.style.margin=`${dt}px 0`,a.style.minHeight=K+"px",a.style.maxHeight=D+"px",r==null||r(),requestAnimationFrame(()=>m.current=!0)}},[h,i.trigger,i.valueNode,a,d,p,y,b,i.dir,r]);Ie(()=>x(),[x]);const[_,C]=w.useState();Ie(()=>{d&&C(window.getComputedStyle(d).zIndex)},[d]);const P=w.useCallback(T=>{T&&g.current===!0&&(x(),v==null||v(),g.current=!1)},[x,v]);return c.jsx(tv,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:m,onScrollButtonChange:P,children:c.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:_},children:c.jsx(me.div,{...s,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});hf.displayName=Jb;var ev="SelectPopperPosition",Ro=w.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=dt,...i}=e,o=Ti(n);return c.jsx(Mb,{...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)"}})});Ro.displayName=ev;var[tv,Ka]=Hn(un,{}),Do="SelectViewport",gf=w.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...s}=e,i=hn(Do,n),o=Ka(Do,n),a=Pe(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(Ci.Slot,{scope:n,children:c.jsx(me.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:pe(s.onScroll,d=>{const u=d.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:h}=o;if(h!=null&&h.current&&f){const m=Math.abs(l.current-u.scrollTop);if(m>0){const g=window.innerHeight-dt*2,p=parseFloat(f.style.minHeight),y=parseFloat(f.style.height),b=Math.max(p,y);if(b<g){const v=b+m,x=Math.min(g,v),_=v-x;f.style.height=x+"px",f.style.bottom==="0px"&&(u.scrollTop=_>0?_:0,f.style.justifyContent="flex-end")}}}l.current=u.scrollTop})})})]})});gf.displayName=Do;var yf="SelectGroup",[nv,rv]=Hn(yf),sv=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=on();return c.jsx(nv,{scope:n,id:s,children:c.jsx(me.div,{role:"group","aria-labelledby":s,...r,ref:t})})});sv.displayName=yf;var bf="SelectLabel",Ga=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=rv(bf,n);return c.jsx(me.div,{id:s.id,...r,ref:t})});Ga.displayName=bf;var Qs="SelectItem",[iv,vf]=Hn(Qs),qa=w.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:i,...o}=e,a=mn(Qs,n),l=hn(Qs,n),d=a.value===r,[u,f]=w.useState(i??""),[h,m]=w.useState(!1),g=Pe(t,v=>{var x;return(x=l.itemRefCallback)==null?void 0:x.call(l,v,r,s)}),p=on(),y=w.useRef("touch"),b=()=>{s||(a.onValueChange(r),a.onOpenChange(!1))};return c.jsx(iv,{scope:n,value:r,disabled:s,textId:p,isSelected:d,onItemTextChange:w.useCallback(v=>{f(x=>x||((v==null?void 0:v.textContent)??"").trim())},[]),children:c.jsx(Ci.ItemSlot,{scope:n,value:r,disabled:s,textValue:u,children:c.jsx(me.div,{role:"option","aria-labelledby":p,"data-highlighted":h?"":void 0,"aria-selected":d&&h,"data-state":d?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...o,ref:g,onFocus:pe(o.onFocus,()=>m(!0)),onBlur:pe(o.onBlur,()=>m(!1)),onClick:pe(o.onClick,()=>{y.current!=="mouse"&&b()}),onPointerUp:pe(o.onPointerUp,()=>{y.current==="mouse"&&b()}),onPointerDown:pe(o.onPointerDown,v=>{y.current=v.pointerType}),onPointerMove:pe(o.onPointerMove,v=>{var x;y.current=v.pointerType,s?(x=l.onItemLeave)==null||x.call(l):y.current==="mouse"&&v.currentTarget.focus({preventScroll:!0})}),onPointerLeave:pe(o.onPointerLeave,v=>{var x;v.currentTarget===document.activeElement&&((x=l.onItemLeave)==null||x.call(l))}),onKeyDown:pe(o.onKeyDown,v=>{var _;((_=l.searchRef)==null?void 0:_.current)!==""&&v.key===" "||(Vb.includes(v.key)&&b(),v.key===" "&&v.preventDefault())})})})})});qa.displayName=Qs;var Mr="SelectItemText",wf=w.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,...i}=e,o=mn(Mr,n),a=hn(Mr,n),l=vf(Mr,n),d=Kb(Mr,n),[u,f]=w.useState(null),h=Pe(t,b=>f(b),l.onItemTextChange,b=>{var v;return(v=a.itemTextRefCallback)==null?void 0:v.call(a,b,l.value,l.disabled)}),m=u==null?void 0:u.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:y}=d;return Ie(()=>(p(g),()=>y(g)),[p,y,g]),c.jsxs(c.Fragment,{children:[c.jsx(me.span,{id:l.textId,...i,ref:h}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!Pi(o.value)?Cr.createPortal(i.children,o.valueNode):null]})});wf.displayName=Mr;var _f="SelectItemIndicator",xf=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return vf(_f,n).isSelected?c.jsx(me.span,{"aria-hidden":!0,...r,ref:t}):null});xf.displayName=_f;var Lo="SelectScrollUpButton",Za=w.forwardRef((e,t)=>{const n=hn(Lo,e.__scopeSelect),r=Ka(Lo,e.__scopeSelect),[s,i]=w.useState(!1),o=Pe(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(Sf,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});Za.displayName=Lo;var jo="SelectScrollDownButton",Ya=w.forwardRef((e,t)=>{const n=hn(jo,e.__scopeSelect),r=Ka(jo,e.__scopeSelect),[s,i]=w.useState(!1),o=Pe(t,r.onScrollButtonChange);return Ie(()=>{if(n.viewport&&n.isPositioned){let a=function(){const d=l.scrollHeight-l.clientHeight,u=Math.ceil(l.scrollTop)<d;i(u)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),s?c.jsx(Sf,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});Ya.displayName=jo;var Sf=w.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=e,i=hn("SelectScrollButton",n),o=w.useRef(null),a=Ei(n),l=w.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return w.useEffect(()=>()=>l(),[l]),Ie(()=>{var u;const d=a().find(f=>f.ref.current===document.activeElement);(u=d==null?void 0:d.ref.current)==null||u.scrollIntoView({block:"nearest"})},[a]),c.jsx(me.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:pe(s.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:pe(s.onPointerMove,()=>{var d;(d=i.onItemLeave)==null||d.call(i),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:pe(s.onPointerLeave,()=>{l()})})}),ov="SelectSeparator",Qa=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return c.jsx(me.div,{"aria-hidden":!0,...r,ref:t})});Qa.displayName=ov;var Cf="SelectArrow",av=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=Ti(n);return hn(Cf,n).position==="popper"?c.jsx(Fb,{...s,...r,ref:t}):null});av.displayName=Cf;var Ef="SelectBubbleInput",Tf=w.forwardRef(({__scopeSelect:e,...t},n)=>{const r=mn(Ef,e),{value:s,onValueChange:i,required:o,disabled:a,name:l,autoComplete:d,form:u}=r,{nativeOptions:f,nativeSelectKey:h}=r,m=w.useRef(null),g=Pe(n,m),p=s??"",y=Ub(p),b=Array.from(f).some(v=>(v.props.value??"")==="");return w.useEffect(()=>{const v=m.current;if(!v)return;const x=window.HTMLSelectElement.prototype,C=Object.getOwnPropertyDescriptor(x,"value").set;if(y!==p&&C){const P=new Event("change",{bubbles:!0});C.call(v,p),v.dispatchEvent(P)}},[y,p]),c.jsxs(me.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:l,autoComplete:d,disabled:a,form:u,onChange:v=>i(v.target.value),...t,style:{...nf,...t.style},ref:g,defaultValue:p,children:[Pi(s)&&!b?c.jsx("option",{value:""}):null,Array.from(f)]},h)});Tf.displayName=Ef;function cv(e){return typeof e=="function"}function Pi(e){return e===""||e===void 0}function Pf(e){const t=mt(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 kf(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=lv(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 lv(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 dv=["color"],uv=S.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=ki(e,dv);return S.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}),S.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"}))}),fv=["color"],Xa=S.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=ki(e,fv);return S.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}),S.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"}))}),pv=["color"],mv=S.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=ki(e,pv);return S.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}),S.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"}))}),hv=["color"],gv=S.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=ki(e,hv);return S.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}),S.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 Xs=sf,Js=cf,Vr=w.forwardRef(({className:e,children:t,...n},r)=>c.jsxs(za,{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(lf,{asChild:!0,children:c.jsx(Xa,{className:"h-4 w-4 opacity-50"})})]}));Vr.displayName=za.displayName;const Af=w.forwardRef(({className:e,...t},n)=>c.jsx(Za,{ref:n,className:Ce("flex cursor-default items-center justify-center py-1",e),...t,children:c.jsx(mv,{className:"h-4 w-4"})}));Af.displayName=Za.displayName;const Nf=w.forwardRef(({className:e,...t},n)=>c.jsx(Ya,{ref:n,className:Ce("flex cursor-default items-center justify-center py-1",e),...t,children:c.jsx(Xa,{className:"h-4 w-4"})}));Nf.displayName=Ya.displayName;const Hr=w.forwardRef(({className:e,children:t,position:n="popper",...r},s)=>c.jsx(uf,{children:c.jsxs(Wa,{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(Af,{}),c.jsx(gf,{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(Nf,{})]})}));Hr.displayName=Wa.displayName;const yv=w.forwardRef(({className:e,...t},n)=>c.jsx(Ga,{ref:n,className:Ce("px-2 py-1.5 text-sm font-semibold",e),...t}));yv.displayName=Ga.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(xf,{children:c.jsx(uv,{className:"h-4 w-4"})})}),c.jsx(wf,{children:t})]}));zr.displayName=qa.displayName;const bv=w.forwardRef(({className:e,...t},n)=>c.jsx(Qa,{ref:n,className:Ce("-mx-1 my-1 h-px bg-muted",e),...t}));bv.displayName=Qa.displayName;function Of({open:e,isAccountsLoading:t,accountOptions:n,onConfirm:r,backUrl:s,createAccountUrl:i}){var f;const[o,a]=S.useState(""),l=o||((f=n[0])==null?void 0:f.login)||"",d=!t&&n.length>0&&l!=="",u=!t&&n.length===0;return c.jsx(vy,{open:e,children:c.jsxs(Au,{className:"web-trading-widget-account-modal",onPointerDownOutside:h=>h.preventDefault(),onEscapeKeyDown:h=>h.preventDefault(),children:[c.jsxs(Nu,{children:[c.jsx(Ru,{children:"Select trading account"}),c.jsx(Du,{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(Xs,{value:l,onValueChange:a,children:[c.jsx(Vr,{className:"web-trading-widget-account-modal__select",children:c.jsx(Js,{placeholder:"Select account"})}),c.jsx(Hr,{children:n.map(h=>c.jsxs(zr,{value:h.login,children:[h.label," (",h.balance.toFixed(2)," ",h.currency,")"]},h.login))})]}),c.jsx(Ou,{children:u?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 vv={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 wv=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),bt=(e,t)=>{const n=S.forwardRef(({color:r="currentColor",size:s=24,strokeWidth:i=2,absoluteStrokeWidth:o,children:a,...l},d)=>S.createElement("svg",{ref:d,...vv,width:s,height:s,stroke:r,strokeWidth:o?Number(i)*24/Number(s):i,className:`lucide lucide-${wv(e)}`,...l},[...t.map(([u,f])=>S.createElement(u,f)),...(Array.isArray(a)?a:[a])||[]]));return n.displayName=`${e}`,n},ei=bt("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),_v=bt("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),xv=bt("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),Io=bt("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),Rf=bt("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"}]]),Df=bt("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"}]]),Sv=bt("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"}]]),Cv=bt("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"}]]),Ev=bt("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]),Tv=bt("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),gn=bt("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function Pv(e){const t=Math.round(Math.log10(e));return Number.isFinite(t)&&t>0?t:5}function Ja(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 kv(e){const t=Ja(e);return t!=null&&t.pricescale?Pv(t.pricescale):5}function Lf(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 Av(e){const t=Ja(e);return(t==null?void 0:t.type)==="commodity"?100:1e5}const ec="USD";function rs(e){return Ye(e).toUpperCase()}function Ai(e){const t=rs(e);return t.length>=6?t.slice(3):ec}function tc(e){if(e!==ec&&e==="JPY")return"USDJPY"}function Nv(e,t,n,r,s){const i=Ai(e),o=tc(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 Ov(e,t,n,r,s,i,o={}){const a=e==="buy"?n:r;let d=(e==="buy"?a-t:t-a)*s*Av(i);const u=Ai(i),f=Nv(i,e,n,r,o);if(f!==void 0)d/=f;else if(u!==ec)return null;return Math.round(d*100)/100}function Rv(e){const t=new Set;for(const n of e){const r=tc(Ai(n));r&&rs(n)!==r&&t.add(r)}return[...t]}function Dv(e,t){const n=rs(e);if(n===t)return!0;const r=tc(Ai(e));return r===t&&n!==r}function Lv(e,t,n,r,s){if(!Dv(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=Ov(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 Ni(e){return Ye(e)||"—"}const qe={BUY:0,SELL:1,BUY_LIMIT:2,SELL_LIMIT:3,BUY_STOP:4,SELL_STOP:5,BUY_STOP_LIMIT:6,SELL_STOP_LIMIT:7},ti=[{mode:"market",label:"Market Execution",orderType:null,isMarket:!0},{mode:"buy_limit",label:"Buy Limit",orderType:qe.BUY_LIMIT,isMarket:!1},{mode:"sell_limit",label:"Sell Limit",orderType:qe.SELL_LIMIT,isMarket:!1},{mode:"buy_stop",label:"Buy Stop",orderType:qe.BUY_STOP,isMarket:!1},{mode:"sell_stop",label:"Sell Stop",orderType:qe.SELL_STOP,isMarket:!1},{mode:"buy_stop_limit",label:"Buy Stop Limit",orderType:qe.BUY_STOP_LIMIT,isMarket:!1},{mode:"sell_stop_limit",label:"Sell Stop Limit",orderType:qe.SELL_STOP_LIMIT,isMarket:!1}];function Oi(e){return ti.find(t=>t.mode===e)??ti[0]}function Ri(e){return Oi(e).isMarket}function Mo(e,t){const n=Oi(e);return n.orderType!==null?n.orderType:t==="buy"?qe.BUY:qe.SELL}function ni(e){return e%2===1?"sell":"buy"}function nc(e){return e>=qe.BUY_LIMIT&&e<=qe.SELL_STOP_LIMIT}function rc(e){return e===qe.BUY_STOP_LIMIT||e===qe.SELL_STOP_LIMIT}function jf(e){return e==="buy_stop_limit"||e==="sell_stop_limit"}const ft={GTC:0,TODAY:1,SPECIFIED:2,SPECIFIED_DAY:3},If=[{value:ft.GTC,label:"GTC"},{value:ft.TODAY,label:"Today"},{value:ft.SPECIFIED,label:"Specified"},{value:ft.SPECIFIED_DAY,label:"Specified Day"}];function sc(e){return e===ft.SPECIFIED}function ic(e){return e===ft.SPECIFIED_DAY}function jv(e){return e.map(t=>({login:t.login,label:t.label,balance:t.tradeStat.balance,currency:t.currency}))}function Iv(e,t){var n;return((n=e[0])==null?void 0:n.login)??""}function oc(e,t=Bt){return t.find(n=>n.ticker===e)}function Mv(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=Ja(e))==null?void 0:s.ticker)??null}function Mf(e,t=Bt){const n=oc(e,t),r=(n==null?void 0:n.resolve_symbol)??e.replace(/_/g,"");return Ye(r).toUpperCase()}function Di(e,t=Bt){const n=oc(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=oc(e,t);return(n==null?void 0:n.pricescale)??1e5}function Ee(e,t){return e.toFixed(t)}function Pr(e){return 1/10**e}function Ff(e,t){return e===null||t===null?null:(e+t)/2}function pt(e){const t=e.trim();if(!t)return;const n=Number(t);if(!(!Number.isFinite(n)||n<=0))return n}function Uf(e,t,n){if(sc(e)){if(!t.trim())return;const r=Date.parse(t);return Number.isFinite(r)?Math.floor(r/1e3):void 0}if(ic(e)){if(!n.trim())return;const r=Date.parse(`${n}T23:59:59`);return Number.isFinite(r)?Math.floor(r/1e3):void 0}}function Li(e,t,n){return e===ft.GTC||e===ft.TODAY?!0:Uf(e,t,n)!==void 0}const Fv={},pl=e=>{let t;const n=new Set,r=(u,f)=>{const h=typeof u=="function"?u(t):u;if(!Object.is(h,t)){const m=t;t=f??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(g=>g(t,m))}},s=()=>t,l={setState:r,getState:s,getInitialState:()=>d,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(Fv?"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},Uv=e=>e?pl(e):pl;function Bv(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var xs={exports:{}},io={},Ss={exports:{}},oo={};/**
41
+ `)},oy=0,Wn=[];function ay(e){var t=w.useRef([]),n=w.useRef([0,0]),r=w.useRef(),s=w.useState(oy++)[0],i=w.useState(hu)[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=kg([e.lockRef.current],(e.shards||[]).map(el),!0).filter(Boolean);return p.forEach(function(y){return y.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),p.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var a=w.useCallback(function(p,y){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!o.current.allowPinchZoom;var b=bs(p),v=n.current,x="deltaX"in p?p.deltaX:v[0]-b[0],_="deltaY"in p?p.deltaY:v[1]-b[1],C,P=p.target,T=Math.abs(x)>Math.abs(_)?"h":"v";if("touches"in p&&T==="h"&&P.type==="range")return!1;var O=window.getSelection(),D=O&&O.anchorNode,j=D?D===P||D.contains(P):!1;if(j)return!1;var A=Xc(T,P);if(!A)return!0;if(A?C=T:(C=T==="v"?"h":"v",A=Xc(T,P)),!A)return!1;if(!r.current&&"changedTouches"in p&&(x||_)&&(r.current=C),!C)return!0;var N=r.current||C;return ry(N,y,p,N==="h"?x:_)},[]),l=w.useCallback(function(p){var y=p;if(!(!Wn.length||Wn[Wn.length-1]!==i)){var b="deltaY"in y?Jc(y):bs(y),v=t.current.filter(function(C){return C.name===y.type&&(C.target===y.target||y.target===C.shadowParent)&&sy(C.delta,b)})[0];if(v&&v.should){y.cancelable&&y.preventDefault();return}if(!v){var x=(o.current.shards||[]).map(el).filter(Boolean).filter(function(C){return C.contains(y.target)}),_=x.length>0?a(y,x[0]):!o.current.noIsolation;_&&y.cancelable&&y.preventDefault()}}},[]),d=w.useCallback(function(p,y,b,v){var x={name:p,delta:y,target:b,should:v,shadowParent:cy(b)};t.current.push(x),setTimeout(function(){t.current=t.current.filter(function(_){return _!==x})},1)},[]),u=w.useCallback(function(p){n.current=bs(p),r.current=void 0},[]),f=w.useCallback(function(p){d(p.type,Jc(p),p.target,a(p,e.lockRef.current))},[]),h=w.useCallback(function(p){d(p.type,bs(p),p.target,a(p,e.lockRef.current))},[]);w.useEffect(function(){return Wn.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",l,zn),document.addEventListener("touchmove",l,zn),document.addEventListener("touchstart",u,zn),function(){Wn=Wn.filter(function(p){return p!==i}),document.removeEventListener("wheel",l,zn),document.removeEventListener("touchmove",l,zn),document.removeEventListener("touchstart",u,zn)}},[]);var m=e.removeScrollBar,g=e.inert;return w.createElement(w.Fragment,null,g?w.createElement(i,{styles:iy(s)}):null,m?w.createElement(Yg,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function cy(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const ly=Mg(mu,ay);var Ta=w.forwardRef(function(e,t){return w.createElement(bi,Pt({},e,{ref:t,sideCar:ly}))});Ta.classNames=bi.classNames;var dy=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Kn=new WeakMap,vs=new WeakMap,ws={},to=0,vu=function(e){return e&&(e.host||vu(e.parentNode))},uy=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=vu(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})},fy=function(e,t,n,r){var s=uy(t,Array.isArray(e)?e:[e]);ws[n]||(ws[n]=new WeakMap);var i=ws[n],o=[],a=new Set,l=new Set(s),d=function(f){!f||a.has(f)||(a.add(f),d(f.parentNode))};s.forEach(d);var u=function(f){!f||l.has(f)||Array.prototype.forEach.call(f.children,function(h){if(a.has(h))u(h);else try{var m=h.getAttribute(r),g=m!==null&&m!=="false",p=(Kn.get(h)||0)+1,y=(i.get(h)||0)+1;Kn.set(h,p),i.set(h,y),o.push(h),p===1&&g&&vs.set(h,!0),y===1&&h.setAttribute(n,"true"),g||h.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",h,b)}})};return u(t),a.clear(),to++,function(){o.forEach(function(f){var h=Kn.get(f)-1,m=i.get(f)-1;Kn.set(f,h),i.set(f,m),h||(vs.has(f)||f.removeAttribute(r),vs.delete(f)),m||f.removeAttribute(n)}),to--,to||(Kn=new WeakMap,Kn=new WeakMap,vs=new WeakMap,ws={})}},wu=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=dy(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),fy(r,s,n,"aria-hidden")):function(){return null}},vi="Dialog",[_u]=$n(vi),[py,yt]=_u(vi),xu=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,u]=Dn({prop:r,defaultProp:s??!1,onChange:i,caller:vi});return c.jsx(py,{scope:t,triggerRef:a,contentRef:l,contentId:on(),titleId:on(),descriptionId:on(),open:d,onOpenChange:u,onOpenToggle:w.useCallback(()=>u(f=>!f),[u]),modal:o,children:n})};xu.displayName=vi;var Su="DialogTrigger",my=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=yt(Su,n),i=Pe(t,s.triggerRef);return c.jsx(me.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":Ra(s.open),...r,ref:i,onClick:pe(e.onClick,s.onOpenToggle)})});my.displayName=Su;var Pa="DialogPortal",[hy,Cu]=_u(Pa,{forceMount:void 0}),Eu=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,i=yt(Pa,t);return c.jsx(hy,{scope:t,forceMount:n,children:w.Children.map(r,o=>c.jsx(Vn,{present:n||i.open,children:c.jsx(yi,{asChild:!0,container:s,children:o})}))})};Eu.displayName=Pa;var Ks="DialogOverlay",ka=w.forwardRef((e,t)=>{const n=Cu(Ks,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=yt(Ks,e.__scopeDialog);return i.modal?c.jsx(Vn,{present:r||i.open,children:c.jsx(yy,{...s,ref:t})}):null});ka.displayName=Ks;var gy=mr("DialogOverlay.RemoveScroll"),yy=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=yt(Ks,n),i=ug(),o=Pe(t,i);return c.jsx(Ta,{as:gy,allowPinchZoom:!0,shards:[s.contentRef],children:c.jsx(me.div,{"data-state":Ra(s.open),...r,ref:o,style:{pointerEvents:"auto",...r.style}})})}),hr="DialogContent",Aa=w.forwardRef((e,t)=>{const n=Cu(hr,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=yt(hr,e.__scopeDialog);return c.jsx(Vn,{present:r||i.open,children:i.modal?c.jsx(by,{...s,ref:t}):c.jsx(vy,{...s,ref:t})})});Aa.displayName=hr;var by=w.forwardRef((e,t)=>{const n=yt(hr,e.__scopeDialog),r=w.useRef(null),s=Pe(t,n.contentRef,r);return w.useEffect(()=>{const i=r.current;if(i)return wu(i)},[]),c.jsx(Tu,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:pe(e.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:pe(e.onPointerDownOutside,i=>{const o=i.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&i.preventDefault()}),onFocusOutside:pe(e.onFocusOutside,i=>i.preventDefault())})}),vy=w.forwardRef((e,t)=>{const n=yt(hr,e.__scopeDialog),r=w.useRef(!1),s=w.useRef(!1);return c.jsx(Tu,{...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()}})}),Tu=w.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,...o}=e,a=yt(hr,n);return uu(),c.jsx(c.Fragment,{children:c.jsx(Ea,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:c.jsx(gi,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":Ra(a.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>a.onOpenChange(!1)})})})}),Pu="DialogTitle",Na=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=yt(Pu,n);return c.jsx(me.h2,{id:s.titleId,...r,ref:t})});Na.displayName=Pu;var ku="DialogDescription",Oa=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=yt(ku,n);return c.jsx(me.p,{id:s.descriptionId,...r,ref:t})});Oa.displayName=ku;var Au="DialogClose",wy=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=yt(Au,n);return c.jsx(me.button,{type:"button",...r,ref:t,onClick:pe(e.onClick,()=>s.onOpenChange(!1))})});wy.displayName=Au;function Ra(e){return e?"open":"closed"}const _y=xu,xy=Eu,Nu=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}));Nu.displayName=ka.displayName;const Ou=w.forwardRef(({className:e,overlayClass:t,children:n,...r},s)=>c.jsxs(xy,{children:[c.jsx(Nu,{className:t}),c.jsx(Aa,{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})]}));Ou.displayName=Aa.displayName;const Ru=({className:e,...t})=>c.jsx("div",{className:Ce("flex flex-col space-y-1.5 border-b text-center sm:text-left",e),...t});Ru.displayName="DialogHeader";const Du=({className:e,...t})=>c.jsx("div",{className:Ce("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Du.displayName="DialogFooter";const Lu=w.forwardRef(({className:e,...t},n)=>c.jsx(Na,{ref:n,className:Ce("text-lg font-semibold leading-none tracking-tight",e),...t}));Lu.displayName=Na.displayName;const ju=w.forwardRef(({className:e,...t},n)=>c.jsx(Oa,{ref:n,className:Ce("text-sm text-muted-foreground",e),...t}));ju.displayName=Oa.displayName;function tl(e,[t,n]){return Math.min(n,Math.max(t,e))}function Da(e){const t=e+"CollectionProvider",[n,r]=$n(t),[s,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=p=>{const{scope:y,children:b}=p,v=w.useRef(null),x=w.useRef(new Map).current;return c.jsx(s,{scope:y,itemMap:x,collectionRef:v,children:b})};o.displayName=t;const a=e+"CollectionSlot",l=mr(a),d=w.forwardRef((p,y)=>{const{scope:b,children:v}=p,x=i(a,b),_=Pe(y,x.collectionRef);return c.jsx(l,{ref:_,children:v})});d.displayName=a;const u=e+"CollectionItemSlot",f="data-radix-collection-item",h=mr(u),m=w.forwardRef((p,y)=>{const{scope:b,children:v,...x}=p,_=w.useRef(null),C=Pe(y,_),P=i(u,b);return w.useEffect(()=>(P.itemMap.set(_,{ref:_,...x}),()=>void P.itemMap.delete(_))),c.jsx(h,{[f]:"",ref:C,children:v})});m.displayName=u;function g(p){const y=i(e+"CollectionConsumer",p);return w.useCallback(()=>{const v=y.collectionRef.current;if(!v)return[];const x=Array.from(v.querySelectorAll(`[${f}]`));return Array.from(y.itemMap.values()).sort((P,T)=>x.indexOf(P.ref.current)-x.indexOf(T.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:o,Slot:d,ItemSlot:m},g,r]}var Sy=w.createContext(void 0);function Iu(e){const t=w.useContext(Sy);return e||t||"ltr"}const Cy=["top","right","bottom","left"],ln=Math.min,tt=Math.max,Gs=Math.round,_s=Math.floor,At=e=>({x:e,y:e}),Ey={left:"right",right:"left",bottom:"top",top:"bottom"};function Ao(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 La(e){return e==="x"?"y":"x"}function ja(e){return e==="y"?"height":"width"}function kt(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Ia(e){return La(kt(e))}function Ty(e,t,n){n===void 0&&(n=!1);const r=Er(e),s=Ia(e),i=ja(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 Py(e){const t=qs(e);return[No(e),t,No(t)]}function No(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const nl=["left","right"],rl=["right","left"],ky=["top","bottom"],Ay=["bottom","top"];function Ny(e,t,n){switch(e){case"top":case"bottom":return n?t?rl:nl:t?nl:rl;case"left":case"right":return t?ky:Ay;default:return[]}}function Oy(e,t,n,r){const s=Er(e);let i=Ny(Ft(e),n==="start",r);return s&&(i=i.map(o=>o+"-"+s),t&&(i=i.concat(i.map(No)))),i}function qs(e){const t=Ft(e);return Ey[t]+e.slice(t.length)}function Ry(e){return{top:0,right:0,bottom:0,left:0,...e}}function Mu(e){return typeof e!="number"?Ry(e):{top:e,right:e,bottom:e,left:e}}function Zs(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 sl(e,t,n){let{reference:r,floating:s}=e;const i=kt(t),o=Ia(t),a=ja(o),l=Ft(t),d=i==="y",u=r.x+r.width/2-s.width/2,f=r.y+r.height/2-s.height/2,h=r[a]/2-s[a]/2;let m;switch(l){case"top":m={x:u,y:r.y-s.height};break;case"bottom":m={x:u,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:f};break;case"left":m={x:r.x-s.width,y:f};break;default:m={x:r.x,y:r.y}}switch(Er(t)){case"start":m[o]-=h*(n&&d?-1:1);break;case"end":m[o]+=h*(n&&d?-1:1);break}return m}async function Dy(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:u="viewport",elementContext:f="floating",altBoundary:h=!1,padding:m=0}=Mt(t,e),g=Mu(m),y=a[h?f==="floating"?"reference":"floating":f],b=Zs(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(y)))==null||n?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:d,rootBoundary:u,strategy:l})),v=f==="floating"?{x:r,y:s,width:o.floating.width,height:o.floating.height}:o.reference,x=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),_=await(i.isElement==null?void 0:i.isElement(x))?await(i.getScale==null?void 0:i.getScale(x))||{x:1,y:1}:{x:1,y:1},C=Zs(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:x,strategy:l}):v);return{top:(b.top-C.top+g.top)/_.y,bottom:(C.bottom-b.bottom+g.bottom)/_.y,left:(b.left-C.left+g.left)/_.x,right:(C.right-b.right+g.right)/_.x}}const Ly=50,jy=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:o}=n,a=o.detectOverflow?o:{...o,detectOverflow:Dy},l=await(o.isRTL==null?void 0:o.isRTL(t));let d=await o.getElementRects({reference:e,floating:t,strategy:s}),{x:u,y:f}=sl(d,r,l),h=r,m=0;const g={};for(let p=0;p<i.length;p++){const y=i[p];if(!y)continue;const{name:b,fn:v}=y,{x,y:_,data:C,reset:P}=await v({x:u,y:f,initialPlacement:r,placement:h,strategy:s,middlewareData:g,rects:d,platform:a,elements:{reference:e,floating:t}});u=x??u,f=_??f,g[b]={...g[b],...C},P&&m<Ly&&(m++,typeof P=="object"&&(P.placement&&(h=P.placement),P.rects&&(d=P.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:s}):P.rects),{x:u,y:f}=sl(d,h,l)),p=-1)}return{x:u,y:f,placement:h,strategy:s,middlewareData:g}},Iy=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:u=0}=Mt(e,t)||{};if(d==null)return{};const f=Mu(u),h={x:n,y:r},m=Ia(s),g=ja(m),p=await o.getDimensions(d),y=m==="y",b=y?"top":"left",v=y?"bottom":"right",x=y?"clientHeight":"clientWidth",_=i.reference[g]+i.reference[m]-h[m]-i.floating[g],C=h[m]-i.reference[m],P=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let T=P?P[x]:0;(!T||!await(o.isElement==null?void 0:o.isElement(P)))&&(T=a.floating[x]||i.floating[g]);const O=_/2-C/2,D=T/2-p[g]/2-1,j=ln(f[b],D),A=ln(f[v],D),N=j,B=T-p[g]-A,R=T/2-p[g]/2+O,H=Ao(N,R,B),F=!l.arrow&&Er(s)!=null&&R!==H&&i.reference[g]/2-(R<N?j:A)-p[g]/2<0,I=F?R<N?R-N:R-B:0;return{[m]:h[m]+I,data:{[m]:H,centerOffset:R-H-I,...F&&{alignmentOffset:I}},reset:F}}}),My=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:u=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:p=!0,...y}=Mt(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const b=Ft(s),v=kt(a),x=Ft(a)===a,_=await(l.isRTL==null?void 0:l.isRTL(d.floating)),C=h||(x||!p?[qs(a)]:Py(a)),P=g!=="none";!h&&P&&C.push(...Oy(a,p,g,_));const T=[a,...C],O=await l.detectOverflow(t,y),D=[];let j=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&D.push(O[b]),f){const R=Ty(s,o,_);D.push(O[R[0]],O[R[1]])}if(j=[...j,{placement:s,overflows:D}],!D.every(R=>R<=0)){var A,N;const R=(((A=i.flip)==null?void 0:A.index)||0)+1,H=T[R];if(H&&(!(f==="alignment"?v!==kt(H):!1)||j.every(L=>kt(L.placement)===v?L.overflows[0]>0:!0)))return{data:{index:R,overflows:j},reset:{placement:H}};let F=(N=j.filter(I=>I.overflows[0]<=0).sort((I,L)=>I.overflows[1]-L.overflows[1])[0])==null?void 0:N.placement;if(!F)switch(m){case"bestFit":{var B;const I=(B=j.filter(L=>{if(P){const U=kt(L.placement);return U===v||U==="y"}return!0}).map(L=>[L.placement,L.overflows.filter(U=>U>0).reduce((U,z)=>U+z,0)]).sort((L,U)=>L[1]-U[1])[0])==null?void 0:B[0];I&&(F=I);break}case"initialPlacement":F=a;break}if(s!==F)return{reset:{placement:F}}}return{}}}};function il(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ol(e){return Cy.some(t=>e[t]>=0)}const Fy=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=il(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:ol(a)}}}case"escaped":{const o=await r.detectOverflow(t,{...i,altBoundary:!0}),a=il(o,n.floating);return{data:{escapedOffsets:a,escaped:ol(a)}}}default:return{}}}}},Fu=new Set(["left","top"]);async function Uy(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=kt(n)==="y",d=Fu.has(o)?-1:1,u=i&&l?-1:1,f=Mt(t,e);let{mainAxis:h,crossAxis:m,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof g=="number"&&(m=a==="end"?g*-1:g),l?{x:m*u,y:h*d}:{x:h*d,y:m*u}}const By=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 Uy(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}}}}},$y=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:x}=b;return{x:v,y:x}}},...d}=Mt(e,t),u={x:n,y:r},f=await i.detectOverflow(t,d),h=kt(Ft(s)),m=La(h);let g=u[m],p=u[h];if(o){const b=m==="y"?"top":"left",v=m==="y"?"bottom":"right",x=g+f[b],_=g-f[v];g=Ao(x,g,_)}if(a){const b=h==="y"?"top":"left",v=h==="y"?"bottom":"right",x=p+f[b],_=p-f[v];p=Ao(x,p,_)}const y=l.fn({...t,[m]:g,[h]:p});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[m]:o,[h]:a}}}}}},Vy=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),u={x:n,y:r},f=kt(s),h=La(f);let m=u[h],g=u[f];const p=Mt(a,t),y=typeof p=="number"?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(l){const x=h==="y"?"height":"width",_=i.reference[h]-i.floating[x]+y.mainAxis,C=i.reference[h]+i.reference[x]-y.mainAxis;m<_?m=_:m>C&&(m=C)}if(d){var b,v;const x=h==="y"?"width":"height",_=Fu.has(Ft(s)),C=i.reference[f]-i.floating[x]+(_&&((b=o.offset)==null?void 0:b[f])||0)+(_?0:y.crossAxis),P=i.reference[f]+i.reference[x]+(_?0:((v=o.offset)==null?void 0:v[f])||0)-(_?y.crossAxis:0);g<C?g=C:g>P&&(g=P)}return{[h]:m,[f]:g}}}},Hy=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),u=await o.detectOverflow(t,d),f=Ft(s),h=Er(s),m=kt(s)==="y",{width:g,height:p}=i.floating;let y,b;f==="top"||f==="bottom"?(y=f,b=h===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(b=f,y=h==="end"?"top":"bottom");const v=p-u.top-u.bottom,x=g-u.left-u.right,_=ln(p-u[y],v),C=ln(g-u[b],x),P=!t.middlewareData.shift;let T=_,O=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(O=x),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(T=v),P&&!h){const j=tt(u.left,0),A=tt(u.right,0),N=tt(u.top,0),B=tt(u.bottom,0);m?O=g-2*(j!==0||A!==0?j+A:tt(u.left,u.right)):T=p-2*(N!==0||B!==0?N+B:tt(u.top,u.bottom))}await l({...t,availableWidth:O,availableHeight:T});const D=await o.getDimensions(a.floating);return g!==D.width||p!==D.height?{reset:{rects:!0}}:{}}}};function wi(){return typeof window<"u"}function Tr(e){return Uu(e)?(e.nodeName||"").toLowerCase():"#document"}function nt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ot(e){var t;return(t=(Uu(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Uu(e){return wi()?e instanceof Node||e instanceof nt(e).Node:!1}function ht(e){return wi()?e instanceof Element||e instanceof nt(e).Element:!1}function $t(e){return wi()?e instanceof HTMLElement||e instanceof nt(e).HTMLElement:!1}function al(e){return!wi()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof nt(e).ShadowRoot}function ns(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=gt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function zy(e){return/^(table|td|th)$/.test(Tr(e))}function _i(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Wy=/transform|translate|scale|rotate|perspective|filter/,Ky=/paint|layout|strict|content/,yn=e=>!!e&&e!=="none";let no;function Ma(e){const t=ht(e)?gt(e):e;return yn(t.transform)||yn(t.translate)||yn(t.scale)||yn(t.rotate)||yn(t.perspective)||!Fa()&&(yn(t.backdropFilter)||yn(t.filter))||Wy.test(t.willChange||"")||Ky.test(t.contain||"")}function Gy(e){let t=dn(e);for(;$t(t)&&!gr(t);){if(Ma(t))return t;if(_i(t))return null;t=dn(t)}return null}function Fa(){return no==null&&(no=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),no}function gr(e){return/^(html|body|#document)$/.test(Tr(e))}function gt(e){return nt(e).getComputedStyle(e)}function xi(e){return ht(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||al(e)&&e.host||Ot(e);return al(t)?t.host:t}function Bu(e){const t=dn(e);return gr(t)?e.ownerDocument?e.ownerDocument.body:e.body:$t(t)&&ns(t)?t:Bu(t)}function $r(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=Bu(e),i=s===((r=e.ownerDocument)==null?void 0:r.body),o=nt(s);if(i){const a=Oo(o);return t.concat(o,o.visualViewport||[],ns(s)?s:[],a&&n?$r(a):[])}else return t.concat(s,$r(s,[],n))}function Oo(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function $u(e){const t=gt(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=Gs(n)!==i||Gs(r)!==o;return a&&(n=i,r=o),{width:n,height:r,$:a}}function Ua(e){return ht(e)?e:e.contextElement}function er(e){const t=Ua(e);if(!$t(t))return At(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:i}=$u(t);let o=(i?Gs(n.width):n.width)/r,a=(i?Gs(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const qy=At(0);function Vu(e){const t=nt(e);return!Fa()||!t.visualViewport?qy:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Zy(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==nt(e)?!1:t}function Ln(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=Ua(e);let o=At(1);t&&(r?ht(r)&&(o=er(r)):o=er(e));const a=Zy(i,n,r)?Vu(i):At(0);let l=(s.left+a.x)/o.x,d=(s.top+a.y)/o.y,u=s.width/o.x,f=s.height/o.y;if(i){const h=nt(i),m=r&&ht(r)?nt(r):r;let g=h,p=Oo(g);for(;p&&r&&m!==g;){const y=er(p),b=p.getBoundingClientRect(),v=gt(p),x=b.left+(p.clientLeft+parseFloat(v.paddingLeft))*y.x,_=b.top+(p.clientTop+parseFloat(v.paddingTop))*y.y;l*=y.x,d*=y.y,u*=y.x,f*=y.y,l+=x,d+=_,g=nt(p),p=Oo(g)}}return Zs({width:u,height:f,x:l,y:d})}function Si(e,t){const n=xi(e).scrollLeft;return t?t.left+n:Ln(Ot(e)).left+n}function Hu(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Si(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function Yy(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const i=s==="fixed",o=Ot(r),a=t?_i(t.floating):!1;if(r===o||a&&i)return n;let l={scrollLeft:0,scrollTop:0},d=At(1);const u=At(0),f=$t(r);if((f||!f&&!i)&&((Tr(r)!=="body"||ns(o))&&(l=xi(r)),f)){const m=Ln(r);d=er(r),u.x=m.x+r.clientLeft,u.y=m.y+r.clientTop}const h=o&&!f&&!i?Hu(o,l):At(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-l.scrollLeft*d.x+u.x+h.x,y:n.y*d.y-l.scrollTop*d.y+u.y+h.y}}function Qy(e){return Array.from(e.getClientRects())}function Xy(e){const t=Ot(e),n=xi(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+Si(e);const a=-n.scrollTop;return gt(r).direction==="rtl"&&(o+=tt(t.clientWidth,r.clientWidth)-s),{width:s,height:i,x:o,y:a}}const cl=25;function Jy(e,t){const n=nt(e),r=Ot(e),s=n.visualViewport;let i=r.clientWidth,o=r.clientHeight,a=0,l=0;if(s){i=s.width,o=s.height;const u=Fa();(!u||u&&t==="fixed")&&(a=s.offsetLeft,l=s.offsetTop)}const d=Si(r);if(d<=0){const u=r.ownerDocument,f=u.body,h=getComputedStyle(f),m=u.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,g=Math.abs(r.clientWidth-f.clientWidth-m);g<=cl&&(i-=g)}else d<=cl&&(i+=d);return{width:i,height:o,x:a,y:l}}function eb(e,t){const n=Ln(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,i=$t(e)?er(e):At(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 ll(e,t,n){let r;if(t==="viewport")r=Jy(e,n);else if(t==="document")r=Xy(Ot(e));else if(ht(t))r=eb(t,n);else{const s=Vu(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return Zs(r)}function zu(e,t){const n=dn(e);return n===t||!ht(n)||gr(n)?!1:gt(n).position==="fixed"||zu(n,t)}function tb(e,t){const n=t.get(e);if(n)return n;let r=$r(e,[],!1).filter(a=>ht(a)&&Tr(a)!=="body"),s=null;const i=gt(e).position==="fixed";let o=i?dn(e):e;for(;ht(o)&&!gr(o);){const a=gt(o),l=Ma(o);!l&&a.position==="fixed"&&(s=null),(i?!l&&!s:!l&&a.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||ns(o)&&!l&&zu(e,o))?r=r.filter(u=>u!==o):s=a,o=dn(o)}return t.set(e,r),r}function nb(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const o=[...n==="clippingAncestors"?_i(t)?[]:tb(t,this._c):[].concat(n),r],a=ll(t,o[0],s);let l=a.top,d=a.right,u=a.bottom,f=a.left;for(let h=1;h<o.length;h++){const m=ll(t,o[h],s);l=tt(m.top,l),d=ln(m.right,d),u=ln(m.bottom,u),f=tt(m.left,f)}return{width:d-f,height:u-l,x:f,y:l}}function rb(e){const{width:t,height:n}=$u(e);return{width:t,height:n}}function sb(e,t,n){const r=$t(t),s=Ot(t),i=n==="fixed",o=Ln(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=At(0);function d(){l.x=Si(s)}if(r||!r&&!i)if((Tr(t)!=="body"||ns(s))&&(a=xi(t)),r){const m=Ln(t,!0,i,t);l.x=m.x+t.clientLeft,l.y=m.y+t.clientTop}else s&&d();i&&!r&&s&&d();const u=s&&!r&&!i?Hu(s,a):At(0),f=o.left+a.scrollLeft-l.x-u.x,h=o.top+a.scrollTop-l.y-u.y;return{x:f,y:h,width:o.width,height:o.height}}function ro(e){return gt(e).position==="static"}function dl(e,t){if(!$t(e)||gt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ot(e)===n&&(n=n.ownerDocument.body),n}function Wu(e,t){const n=nt(e);if(_i(e))return n;if(!$t(e)){let s=dn(e);for(;s&&!gr(s);){if(ht(s)&&!ro(s))return s;s=dn(s)}return n}let r=dl(e,t);for(;r&&zy(r)&&ro(r);)r=dl(r,t);return r&&gr(r)&&ro(r)&&!Ma(r)?n:r||Gy(e)||n}const ib=async function(e){const t=this.getOffsetParent||Wu,n=this.getDimensions,r=await n(e.floating);return{reference:sb(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function ob(e){return gt(e).direction==="rtl"}const ab={convertOffsetParentRelativeRectToViewportRelativeRect:Yy,getDocumentElement:Ot,getClippingRect:nb,getOffsetParent:Wu,getElementRects:ib,getClientRects:Qy,getDimensions:rb,getScale:er,isElement:ht,isRTL:ob};function Ku(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function cb(e,t){let n=null,r;const s=Ot(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:u,top:f,width:h,height:m}=d;if(a||t(),!h||!m)return;const g=_s(f),p=_s(s.clientWidth-(u+h)),y=_s(s.clientHeight-(f+m)),b=_s(u),x={rootMargin:-g+"px "+-p+"px "+-y+"px "+-b+"px",threshold:tt(0,ln(1,l))||1};let _=!0;function C(P){const T=P[0].intersectionRatio;if(T!==l){if(!_)return o();T?o(!1,T):r=setTimeout(()=>{o(!1,1e-7)},1e3)}T===1&&!Ku(d,e.getBoundingClientRect())&&o(),_=!1}try{n=new IntersectionObserver(C,{...x,root:s.ownerDocument})}catch{n=new IntersectionObserver(C,x)}n.observe(e)}return o(!0),i}function lb(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=Ua(e),u=s||i?[...d?$r(d):[],...t?$r(t):[]]:[];u.forEach(b=>{s&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const f=d&&a?cb(d,n):null;let h=-1,m=null;o&&(m=new ResizeObserver(b=>{let[v]=b;v&&v.target===d&&m&&t&&(m.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var x;(x=m)==null||x.observe(t)})),n()}),d&&!l&&m.observe(d),t&&m.observe(t));let g,p=l?Ln(e):null;l&&y();function y(){const b=Ln(e);p&&!Ku(p,b)&&n(),p=b,g=requestAnimationFrame(y)}return n(),()=>{var b;u.forEach(v=>{s&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),f==null||f(),(b=m)==null||b.disconnect(),m=null,l&&cancelAnimationFrame(g)}}const db=By,ub=$y,fb=My,pb=Hy,mb=Fy,ul=Iy,hb=Vy,gb=(e,t,n)=>{const r=new Map,s={platform:ab,...n},i={...s.platform,_c:r};return jy(e,t,{...s,platform:i})};var yb=typeof document<"u",bb=function(){},Is=yb?S.useLayoutEffect:bb;function Ys(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(!Ys(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)&&!Ys(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function Gu(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function fl(e,t){const n=Gu(e);return Math.round(t*n)/n}function so(e){const t=w.useRef(e);return Is(()=>{t.current=e}),t}function vb(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,[u,f]=w.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,m]=w.useState(r);Ys(h,r)||m(r);const[g,p]=w.useState(null),[y,b]=w.useState(null),v=w.useCallback(L=>{L!==P.current&&(P.current=L,p(L))},[]),x=w.useCallback(L=>{L!==T.current&&(T.current=L,b(L))},[]),_=i||g,C=o||y,P=w.useRef(null),T=w.useRef(null),O=w.useRef(u),D=l!=null,j=so(l),A=so(s),N=so(d),B=w.useCallback(()=>{if(!P.current||!T.current)return;const L={placement:t,strategy:n,middleware:h};A.current&&(L.platform=A.current),gb(P.current,T.current,L).then(U=>{const z={...U,isPositioned:N.current!==!1};R.current&&!Ys(O.current,z)&&(O.current=z,Cr.flushSync(()=>{f(z)}))})},[h,t,n,A,N]);Is(()=>{d===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,f(L=>({...L,isPositioned:!1})))},[d]);const R=w.useRef(!1);Is(()=>(R.current=!0,()=>{R.current=!1}),[]),Is(()=>{if(_&&(P.current=_),C&&(T.current=C),_&&C){if(j.current)return j.current(_,C,B);B()}},[_,C,B,j,D]);const H=w.useMemo(()=>({reference:P,floating:T,setReference:v,setFloating:x}),[v,x]),F=w.useMemo(()=>({reference:_,floating:C}),[_,C]),I=w.useMemo(()=>{const L={position:n,left:0,top:0};if(!F.floating)return L;const U=fl(F.floating,u.x),z=fl(F.floating,u.y);return a?{...L,transform:"translate("+U+"px, "+z+"px)",...Gu(F.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:U,top:z}},[n,a,F.floating,u.x,u.y]);return w.useMemo(()=>({...u,update:B,refs:H,elements:F,floatingStyles:I}),[u,B,H,F,I])}const wb=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?ul({element:r.current,padding:s}).fn(n):{}:r?ul({element:r,padding:s}).fn(n):{}}}},_b=(e,t)=>{const n=db(e);return{name:n.name,fn:n.fn,options:[e,t]}},xb=(e,t)=>{const n=ub(e);return{name:n.name,fn:n.fn,options:[e,t]}},Sb=(e,t)=>({fn:hb(e).fn,options:[e,t]}),Cb=(e,t)=>{const n=fb(e);return{name:n.name,fn:n.fn,options:[e,t]}},Eb=(e,t)=>{const n=pb(e);return{name:n.name,fn:n.fn,options:[e,t]}},Tb=(e,t)=>{const n=mb(e);return{name:n.name,fn:n.fn,options:[e,t]}},Pb=(e,t)=>{const n=wb(e);return{name:n.name,fn:n.fn,options:[e,t]}};var kb="Arrow",qu=w.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...i}=e;return c.jsx(me.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"})})});qu.displayName=kb;var Ab=qu;function Nb(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 Ba="Popper",[Zu,Yu]=$n(Ba),[Ob,Qu]=Zu(Ba),Xu=e=>{const{__scopePopper:t,children:n}=e,[r,s]=w.useState(null),[i,o]=w.useState(void 0);return c.jsx(Ob,{scope:t,anchor:r,onAnchorChange:s,placementState:i,setPlacementState:o,children:n})};Xu.displayName=Ba;var Ju="PopperAnchor",ef=w.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,i=Qu(Ju,n),o=w.useRef(null),a=i.onAnchorChange,l=w.useCallback(g=>{o.current=g,g&&a(g)},[a]),d=Pe(t,l),u=w.useRef(null);w.useEffect(()=>{if(!r)return;const g=u.current;u.current=r.current,g!==u.current&&a(u.current)});const f=i.placementState&&Va(i.placementState),h=f==null?void 0:f[0],m=f==null?void 0:f[1];return r?null:c.jsx(me.div,{"data-radix-popper-side":h,"data-radix-popper-align":m,...s,ref:d})});ef.displayName=Ju;var $a="PopperContent",[Rb,Db]=Zu($a),tf=w.forwardRef((e,t)=>{var $,ye,ae,ie,te,je;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:i="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:d=[],collisionPadding:u=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:m="optimized",onPlaced:g,...p}=e,y=Qu($a,n),[b,v]=w.useState(null),x=Pe(t,Re=>v(Re)),[_,C]=w.useState(null),P=Nb(_),T=(P==null?void 0:P.width)??0,O=(P==null?void 0:P.height)??0,D=r+(i!=="center"?"-"+i:""),j=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},A=Array.isArray(d)?d:[d],N=A.length>0,B={padding:j,boundary:A.filter(jb),altBoundary:N},{refs:R,floatingStyles:H,placement:F,isPositioned:I,middlewareData:L}=vb({strategy:"fixed",placement:D,whileElementsMounted:(...Re)=>lb(...Re,{animationFrame:m==="always"}),elements:{reference:y.anchor},middleware:[_b({mainAxis:s+O,alignmentAxis:o}),l&&xb({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?Sb():void 0,...B}),l&&Cb({...B}),Eb({...B,apply:({elements:Re,rects:Ne,availableWidth:X,availableHeight:ke})=>{const{width:Fe,height:Qe}=Ne.reference,ct=Re.floating.style;ct.setProperty("--radix-popper-available-width",`${X}px`),ct.setProperty("--radix-popper-available-height",`${ke}px`),ct.setProperty("--radix-popper-anchor-width",`${Fe}px`),ct.setProperty("--radix-popper-anchor-height",`${Qe}px`)}}),_&&Pb({element:_,padding:a}),Ib({arrowWidth:T,arrowHeight:O}),h&&Tb({strategy:"referenceHidden",...B,boundary:N?B.boundary:void 0})]}),U=y.setPlacementState;Ie(()=>(U(F),()=>{U(void 0)}),[F,U]);const[z,M]=Va(F),se=mt(g);Ie(()=>{I&&(se==null||se())},[I,se]);const W=($=L.arrow)==null?void 0:$.x,de=(ye=L.arrow)==null?void 0:ye.y,ue=((ae=L.arrow)==null?void 0:ae.centerOffset)!==0,[ee,Z]=w.useState();return Ie(()=>{b&&Z(window.getComputedStyle(b).zIndex)},[b]),c.jsx("div",{ref:R.setFloating,"data-radix-popper-content-wrapper":"",style:{...H,transform:I?H.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ee,"--radix-popper-transform-origin":[(ie=L.transformOrigin)==null?void 0:ie.x,(te=L.transformOrigin)==null?void 0:te.y].join(" "),...((je=L.hide)==null?void 0:je.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:c.jsx(Rb,{scope:n,placedSide:z,placedAlign:M,onArrowChange:C,arrowX:W,arrowY:de,shouldHideArrow:ue,children:c.jsx(me.div,{"data-side":z,"data-align":M,...p,ref:x,style:{...p.style,animation:I?void 0:"none"}})})})});tf.displayName=$a;var nf="PopperArrow",Lb={top:"bottom",right:"left",bottom:"top",left:"right"},rf=w.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,i=Db(nf,r),o=Lb[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(Ab,{...s,ref:n,style:{...s.style,display:"block"}})})});rf.displayName=nf;function jb(e){return e!==null}var Ib=e=>({name:"transformOrigin",options:e,fn(t){var y,b,v;const{placement:n,rects:r,middlewareData:s}=t,o=((y=s.arrow)==null?void 0:y.centerOffset)!==0,a=o?0:e.arrowWidth,l=o?0:e.arrowHeight,[d,u]=Va(n),f={start:"0%",center:"50%",end:"100%"}[u],h=(((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?f:`${h}px`,p=`${-l}px`):d==="top"?(g=o?f:`${h}px`,p=`${r.floating.height+l}px`):d==="right"?(g=`${-l}px`,p=o?f:`${m}px`):d==="left"&&(g=`${r.floating.width+l}px`,p=o?f:`${m}px`),{data:{x:g,y:p}}}});function Va(e){const[t,n="center"]=e.split("-");return[t,n]}var Mb=Xu,Fb=ef,Ub=tf,Bb=rf;function $b(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 sf=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"}),Vb="VisuallyHidden",Ha=w.forwardRef((e,t)=>c.jsx(me.span,{...e,ref:t,style:{...sf,...e.style}}));Ha.displayName=Vb;var Hb=[" ","Enter","ArrowUp","ArrowDown"],zb=[" ","Enter"],jn="Select",[Ci,Ei,Wb]=Da(jn),[Hn]=$n(jn,[Wb,Yu]),Ti=Yu(),[Kb,mn]=Hn(jn),[Gb,qb]=Hn(jn),Zb="SelectProvider";function of(e){const{__scopeSelect:t,children:n,open:r,defaultOpen:s,onOpenChange:i,value:o,defaultValue:a,onValueChange:l,dir:d,name:u,autoComplete:f,disabled:h,required:m,form:g,internal_do_not_use_render:p}=e,y=Ti(t),[b,v]=w.useState(null),[x,_]=w.useState(null),[C,P]=w.useState(!1),T=Iu(d),[O,D]=Dn({prop:r,defaultProp:s??!1,onChange:i,caller:jn}),[j,A]=Dn({prop:o,defaultProp:a,onChange:l,caller:jn}),N=w.useRef(null),B=b?!!g||!!b.closest("form"):!0,[R,H]=w.useState(new Set),F=on(),I=Array.from(R).map(M=>M.props.value).join(";"),L=w.useCallback(M=>{H(se=>new Set(se).add(M))},[]),U=w.useCallback(M=>{H(se=>{const W=new Set(se);return W.delete(M),W})},[]),z={required:m,trigger:b,onTriggerChange:v,valueNode:x,onValueNodeChange:_,valueNodeHasChildren:C,onValueNodeHasChildrenChange:P,contentId:F,value:j,onValueChange:A,open:O,onOpenChange:D,dir:T,triggerPointerDownPosRef:N,disabled:h,name:u,autoComplete:f,form:g,nativeOptions:R,nativeSelectKey:I,isFormControl:B};return c.jsx(Mb,{...y,children:c.jsx(Kb,{scope:t,...z,children:c.jsx(Ci.Provider,{scope:t,children:c.jsx(Gb,{scope:t,onNativeOptionAdd:L,onNativeOptionRemove:U,children:dv(p)?p(z):n})})})})}of.displayName=Zb;var af=e=>{const{__scopeSelect:t,children:n,...r}=e;return c.jsx(of,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:s})=>c.jsxs(c.Fragment,{children:[n,s?c.jsx(kf,{__scopeSelect:t}):null]})})};af.displayName=jn;var cf="SelectTrigger",za=w.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...s}=e,i=Ti(n),o=mn(cf,n),a=o.disabled||r,l=Pe(t,o.onTriggerChange),d=Ei(n),u=w.useRef("touch"),[f,h,m]=Af(p=>{const y=d().filter(x=>!x.disabled),b=y.find(x=>x.value===o.value),v=Nf(y,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(Fb,{asChild:!0,...i,children:c.jsx(me.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":Pi(o.value)?"":void 0,...s,ref:l,onClick:pe(s.onClick,p=>{p.currentTarget.focus(),u.current!=="mouse"&&g(p)}),onPointerDown:pe(s.onPointerDown,p=>{u.current=p.pointerType;const y=p.target;y.hasPointerCapture(p.pointerId)&&y.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(g(p),p.preventDefault())}),onKeyDown:pe(s.onKeyDown,p=>{const y=f.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&h(p.key),!(y&&p.key===" ")&&Hb.includes(p.key)&&(g(),p.preventDefault())})})})});za.displayName=cf;var lf="SelectValue",df=w.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,children:i,placeholder:o="",...a}=e,l=mn(lf,n),{onValueNodeHasChildrenChange:d}=l,u=i!==void 0,f=Pe(t,l.onValueNodeChange);Ie(()=>{d(u)},[d,u]);const h=Pi(l.value);return c.jsx(me.span,{...a,asChild:h?!1:a.asChild,ref:f,style:{pointerEvents:"none"},children:c.jsx(w.Fragment,{children:h?o:i},h?"placeholder":"value")})});df.displayName=lf;var Yb="SelectIcon",uf=w.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...s}=e;return c.jsx(me.span,{"aria-hidden":!0,...s,ref:t,children:r||"▼"})});uf.displayName=Yb;var ff="SelectPortal",[Qb,Xb]=Hn(ff,{forceMount:void 0}),pf=e=>{const{__scopeSelect:t,forceMount:n,...r}=e;return c.jsx(Qb,{scope:e.__scopeSelect,forceMount:n,children:c.jsx(yi,{asChild:!0,...r})})};pf.displayName=ff;var un="SelectContent",Wa=w.forwardRef((e,t)=>{const n=Xb(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(Vn,{present:r||i.open,children:({present:l})=>l?c.jsx(gf,{...s,ref:t}):c.jsx(mf,{...s,fragment:o})})});Wa.displayName=un;var mf=w.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,fragment:s}=e;return s?Cr.createPortal(c.jsx(hf,{scope:n,children:c.jsx(Ci.Slot,{scope:n,children:c.jsx("div",{ref:t,children:r})})}),s):null});mf.displayName="SelectContentFragment";var dt=10,[hf,hn]=Hn(un),Jb="SelectContentImpl",ev=mr("SelectContent.RemoveScroll"),gf=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:u,arrowPadding:f,collisionBoundary:h,collisionPadding:m,sticky:g,hideWhenDetached:p,avoidCollisions:y,...b}=e,v=mn(un,n),[x,_]=w.useState(null),[C,P]=w.useState(null),T=Pe(t,Z=>_(Z)),[O,D]=w.useState(null),[j,A]=w.useState(null),N=Ei(n),[B,R]=w.useState(!1),H=w.useRef(!1);w.useEffect(()=>{if(x)return wu(x)},[x]),uu();const F=w.useCallback(Z=>{const[$,...ye]=N().map(te=>te.ref.current),[ae]=ye.slice(-1),ie=document.activeElement;for(const te of Z)if(te===ie||(te==null||te.scrollIntoView({block:"nearest"}),te===$&&C&&(C.scrollTop=0),te===ae&&C&&(C.scrollTop=C.scrollHeight),te==null||te.focus(),document.activeElement!==ie))return},[N,C]),I=w.useCallback(()=>F([O,x]),[F,O,x]);w.useEffect(()=>{B&&I()},[B,I]);const{onOpenChange:L,triggerPointerDownPosRef:U}=v;w.useEffect(()=>{if(x){let Z={x:0,y:0};const $=ae=>{var ie,te;Z={x:Math.abs(Math.round(ae.pageX)-(((ie=U.current)==null?void 0:ie.x)??0)),y:Math.abs(Math.round(ae.pageY)-(((te=U.current)==null?void 0:te.y)??0))}},ye=ae=>{Z.x<=10&&Z.y<=10?ae.preventDefault():ae.composedPath().includes(x)||L(!1),document.removeEventListener("pointermove",$),U.current=null};return U.current!==null&&(document.addEventListener("pointermove",$),document.addEventListener("pointerup",ye,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",$),document.removeEventListener("pointerup",ye,{capture:!0})}}},[x,L,U]),w.useEffect(()=>{const Z=()=>L(!1);return window.addEventListener("blur",Z),window.addEventListener("resize",Z),()=>{window.removeEventListener("blur",Z),window.removeEventListener("resize",Z)}},[L]);const[z,M]=Af(Z=>{const $=N().filter(ie=>!ie.disabled),ye=$.find(ie=>ie.ref.current===document.activeElement),ae=Nf($,Z,ye);ae&&setTimeout(()=>{var ie;return(ie=ae.ref.current)==null?void 0:ie.focus()})}),se=w.useCallback((Z,$,ye)=>{const ae=!H.current&&!ye;(v.value!==void 0&&v.value===$||ae)&&(D(Z),ae&&(H.current=!0))},[v.value]),W=w.useCallback(()=>x==null?void 0:x.focus(),[x]),de=w.useCallback((Z,$,ye)=>{const ae=!H.current&&!ye;(v.value!==void 0&&v.value===$||ae)&&A(Z)},[v.value]),ue=r==="popper"?Ro:yf,ee=ue===Ro?{side:a,sideOffset:l,align:d,alignOffset:u,arrowPadding:f,collisionBoundary:h,collisionPadding:m,sticky:g,hideWhenDetached:p,avoidCollisions:y}:{};return c.jsx(hf,{scope:n,content:x,viewport:C,onViewportChange:P,itemRefCallback:se,selectedItem:O,onItemLeave:W,itemTextRefCallback:de,focusSelectedItem:I,selectedItemText:j,position:r,isPositioned:B,searchRef:z,children:c.jsx(Ta,{as:ev,allowPinchZoom:!0,children:c.jsx(Ea,{asChild:!0,trapped:v.open,onMountAutoFocus:Z=>{Z.preventDefault()},onUnmountAutoFocus:pe(s,Z=>{var $;($=v.trigger)==null||$.focus({preventScroll:!0}),Z.preventDefault()}),children:c.jsx(gi,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:Z=>Z.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:c.jsx(ue,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:Z=>Z.preventDefault(),...b,...ee,onPlaced:()=>R(!0),ref:T,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:pe(b.onKeyDown,Z=>{const $=Z.ctrlKey||Z.altKey||Z.metaKey;if(Z.key==="Tab"&&Z.preventDefault(),!$&&Z.key.length===1&&M(Z.key),["ArrowUp","ArrowDown","Home","End"].includes(Z.key)){let ae=N().filter(ie=>!ie.disabled).map(ie=>ie.ref.current);if(["ArrowUp","End"].includes(Z.key)&&(ae=ae.slice().reverse()),["ArrowUp","ArrowDown"].includes(Z.key)){const ie=Z.target,te=ae.indexOf(ie);ae=ae.slice(te+1)}setTimeout(()=>F(ae)),Z.preventDefault()}})})})})})})});gf.displayName=Jb;var tv="SelectItemAlignedPosition",yf=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,u]=w.useState(null),f=Pe(t,T=>u(T)),h=Ei(n),m=w.useRef(!1),g=w.useRef(!0),{viewport:p,selectedItem:y,selectedItemText:b,focusSelectedItem:v}=o,x=w.useCallback(()=>{if(i.trigger&&i.valueNode&&a&&d&&p&&y&&b){const T=i.trigger.getBoundingClientRect(),O=d.getBoundingClientRect(),D=i.valueNode.getBoundingClientRect(),j=b.getBoundingClientRect();if(i.dir!=="rtl"){const ie=j.left-O.left,te=D.left-ie,je=T.left-te,Re=T.width+je,Ne=Math.max(Re,O.width),X=window.innerWidth-dt,ke=tl(te,[dt,Math.max(dt,X-Ne)]);a.style.minWidth=Re+"px",a.style.left=ke+"px"}else{const ie=O.right-j.right,te=window.innerWidth-D.right-ie,je=window.innerWidth-T.right-te,Re=T.width+je,Ne=Math.max(Re,O.width),X=window.innerWidth-dt,ke=tl(te,[dt,Math.max(dt,X-Ne)]);a.style.minWidth=Re+"px",a.style.right=ke+"px"}const A=h(),N=window.innerHeight-dt*2,B=p.scrollHeight,R=window.getComputedStyle(d),H=parseInt(R.borderTopWidth,10),F=parseInt(R.paddingTop,10),I=parseInt(R.borderBottomWidth,10),L=parseInt(R.paddingBottom,10),U=H+F+B+L+I,z=Math.min(y.offsetHeight*5,U),M=window.getComputedStyle(p),se=parseInt(M.paddingTop,10),W=parseInt(M.paddingBottom,10),de=T.top+T.height/2-dt,ue=N-de,ee=y.offsetHeight/2,Z=y.offsetTop+ee,$=H+F+Z,ye=U-$;if($<=de){const ie=A.length>0&&y===A[A.length-1].ref.current;a.style.bottom="0px";const te=d.clientHeight-p.offsetTop-p.offsetHeight,je=Math.max(ue,ee+(ie?W:0)+te+I),Re=$+je;a.style.height=Re+"px"}else{const ie=A.length>0&&y===A[0].ref.current;a.style.top="0px";const je=Math.max(de,H+p.offsetTop+(ie?se:0)+ee)+ye;a.style.height=je+"px",p.scrollTop=$-de+p.offsetTop}a.style.margin=`${dt}px 0`,a.style.minHeight=z+"px",a.style.maxHeight=N+"px",r==null||r(),requestAnimationFrame(()=>m.current=!0)}},[h,i.trigger,i.valueNode,a,d,p,y,b,i.dir,r]);Ie(()=>x(),[x]);const[_,C]=w.useState();Ie(()=>{d&&C(window.getComputedStyle(d).zIndex)},[d]);const P=w.useCallback(T=>{T&&g.current===!0&&(x(),v==null||v(),g.current=!1)},[x,v]);return c.jsx(rv,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:m,onScrollButtonChange:P,children:c.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:_},children:c.jsx(me.div,{...s,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});yf.displayName=tv;var nv="SelectPopperPosition",Ro=w.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=dt,...i}=e,o=Ti(n);return c.jsx(Ub,{...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)"}})});Ro.displayName=nv;var[rv,Ka]=Hn(un,{}),Do="SelectViewport",bf=w.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...s}=e,i=hn(Do,n),o=Ka(Do,n),a=Pe(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(Ci.Slot,{scope:n,children:c.jsx(me.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:pe(s.onScroll,d=>{const u=d.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:h}=o;if(h!=null&&h.current&&f){const m=Math.abs(l.current-u.scrollTop);if(m>0){const g=window.innerHeight-dt*2,p=parseFloat(f.style.minHeight),y=parseFloat(f.style.height),b=Math.max(p,y);if(b<g){const v=b+m,x=Math.min(g,v),_=v-x;f.style.height=x+"px",f.style.bottom==="0px"&&(u.scrollTop=_>0?_:0,f.style.justifyContent="flex-end")}}}l.current=u.scrollTop})})})]})});bf.displayName=Do;var vf="SelectGroup",[sv,iv]=Hn(vf),ov=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=on();return c.jsx(sv,{scope:n,id:s,children:c.jsx(me.div,{role:"group","aria-labelledby":s,...r,ref:t})})});ov.displayName=vf;var wf="SelectLabel",Ga=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=iv(wf,n);return c.jsx(me.div,{id:s.id,...r,ref:t})});Ga.displayName=wf;var Qs="SelectItem",[av,_f]=Hn(Qs),qa=w.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:i,...o}=e,a=mn(Qs,n),l=hn(Qs,n),d=a.value===r,[u,f]=w.useState(i??""),[h,m]=w.useState(!1),g=Pe(t,v=>{var x;return(x=l.itemRefCallback)==null?void 0:x.call(l,v,r,s)}),p=on(),y=w.useRef("touch"),b=()=>{s||(a.onValueChange(r),a.onOpenChange(!1))};return c.jsx(av,{scope:n,value:r,disabled:s,textId:p,isSelected:d,onItemTextChange:w.useCallback(v=>{f(x=>x||((v==null?void 0:v.textContent)??"").trim())},[]),children:c.jsx(Ci.ItemSlot,{scope:n,value:r,disabled:s,textValue:u,children:c.jsx(me.div,{role:"option","aria-labelledby":p,"data-highlighted":h?"":void 0,"aria-selected":d&&h,"data-state":d?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...o,ref:g,onFocus:pe(o.onFocus,()=>m(!0)),onBlur:pe(o.onBlur,()=>m(!1)),onClick:pe(o.onClick,()=>{y.current!=="mouse"&&b()}),onPointerUp:pe(o.onPointerUp,()=>{y.current==="mouse"&&b()}),onPointerDown:pe(o.onPointerDown,v=>{y.current=v.pointerType}),onPointerMove:pe(o.onPointerMove,v=>{var x;y.current=v.pointerType,s?(x=l.onItemLeave)==null||x.call(l):y.current==="mouse"&&v.currentTarget.focus({preventScroll:!0})}),onPointerLeave:pe(o.onPointerLeave,v=>{var x;v.currentTarget===document.activeElement&&((x=l.onItemLeave)==null||x.call(l))}),onKeyDown:pe(o.onKeyDown,v=>{var _;((_=l.searchRef)==null?void 0:_.current)!==""&&v.key===" "||(zb.includes(v.key)&&b(),v.key===" "&&v.preventDefault())})})})})});qa.displayName=Qs;var Mr="SelectItemText",xf=w.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,...i}=e,o=mn(Mr,n),a=hn(Mr,n),l=_f(Mr,n),d=qb(Mr,n),[u,f]=w.useState(null),h=Pe(t,b=>f(b),l.onItemTextChange,b=>{var v;return(v=a.itemTextRefCallback)==null?void 0:v.call(a,b,l.value,l.disabled)}),m=u==null?void 0:u.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:y}=d;return Ie(()=>(p(g),()=>y(g)),[p,y,g]),c.jsxs(c.Fragment,{children:[c.jsx(me.span,{id:l.textId,...i,ref:h}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!Pi(o.value)?Cr.createPortal(i.children,o.valueNode):null]})});xf.displayName=Mr;var Sf="SelectItemIndicator",Cf=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return _f(Sf,n).isSelected?c.jsx(me.span,{"aria-hidden":!0,...r,ref:t}):null});Cf.displayName=Sf;var Lo="SelectScrollUpButton",Za=w.forwardRef((e,t)=>{const n=hn(Lo,e.__scopeSelect),r=Ka(Lo,e.__scopeSelect),[s,i]=w.useState(!1),o=Pe(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(Ef,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});Za.displayName=Lo;var jo="SelectScrollDownButton",Ya=w.forwardRef((e,t)=>{const n=hn(jo,e.__scopeSelect),r=Ka(jo,e.__scopeSelect),[s,i]=w.useState(!1),o=Pe(t,r.onScrollButtonChange);return Ie(()=>{if(n.viewport&&n.isPositioned){let a=function(){const d=l.scrollHeight-l.clientHeight,u=Math.ceil(l.scrollTop)<d;i(u)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),s?c.jsx(Ef,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});Ya.displayName=jo;var Ef=w.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=e,i=hn("SelectScrollButton",n),o=w.useRef(null),a=Ei(n),l=w.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return w.useEffect(()=>()=>l(),[l]),Ie(()=>{var u;const d=a().find(f=>f.ref.current===document.activeElement);(u=d==null?void 0:d.ref.current)==null||u.scrollIntoView({block:"nearest"})},[a]),c.jsx(me.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:pe(s.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:pe(s.onPointerMove,()=>{var d;(d=i.onItemLeave)==null||d.call(i),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:pe(s.onPointerLeave,()=>{l()})})}),cv="SelectSeparator",Qa=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return c.jsx(me.div,{"aria-hidden":!0,...r,ref:t})});Qa.displayName=cv;var Tf="SelectArrow",lv=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=Ti(n);return hn(Tf,n).position==="popper"?c.jsx(Bb,{...s,...r,ref:t}):null});lv.displayName=Tf;var Pf="SelectBubbleInput",kf=w.forwardRef(({__scopeSelect:e,...t},n)=>{const r=mn(Pf,e),{value:s,onValueChange:i,required:o,disabled:a,name:l,autoComplete:d,form:u}=r,{nativeOptions:f,nativeSelectKey:h}=r,m=w.useRef(null),g=Pe(n,m),p=s??"",y=$b(p),b=Array.from(f).some(v=>(v.props.value??"")==="");return w.useEffect(()=>{const v=m.current;if(!v)return;const x=window.HTMLSelectElement.prototype,C=Object.getOwnPropertyDescriptor(x,"value").set;if(y!==p&&C){const P=new Event("change",{bubbles:!0});C.call(v,p),v.dispatchEvent(P)}},[y,p]),c.jsxs(me.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:l,autoComplete:d,disabled:a,form:u,onChange:v=>i(v.target.value),...t,style:{...sf,...t.style},ref:g,defaultValue:p,children:[Pi(s)&&!b?c.jsx("option",{value:""}):null,Array.from(f)]},h)});kf.displayName=Pf;function dv(e){return typeof e=="function"}function Pi(e){return e===""||e===void 0}function Af(e){const t=mt(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 Nf(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=uv(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 uv(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 fv=["color"],pv=S.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=ki(e,fv);return S.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}),S.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"}))}),mv=["color"],Xa=S.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=ki(e,mv);return S.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}),S.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"}))}),hv=["color"],gv=S.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=ki(e,hv);return S.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}),S.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"}))}),yv=["color"],bv=S.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=ki(e,yv);return S.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}),S.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 Xs=af,Js=df,Vr=w.forwardRef(({className:e,children:t,...n},r)=>c.jsxs(za,{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(uf,{asChild:!0,children:c.jsx(Xa,{className:"h-4 w-4 opacity-50"})})]}));Vr.displayName=za.displayName;const Of=w.forwardRef(({className:e,...t},n)=>c.jsx(Za,{ref:n,className:Ce("flex cursor-default items-center justify-center py-1",e),...t,children:c.jsx(gv,{className:"h-4 w-4"})}));Of.displayName=Za.displayName;const Rf=w.forwardRef(({className:e,...t},n)=>c.jsx(Ya,{ref:n,className:Ce("flex cursor-default items-center justify-center py-1",e),...t,children:c.jsx(Xa,{className:"h-4 w-4"})}));Rf.displayName=Ya.displayName;const Hr=w.forwardRef(({className:e,children:t,position:n="popper",...r},s)=>c.jsx(pf,{children:c.jsxs(Wa,{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(Of,{}),c.jsx(bf,{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(Rf,{})]})}));Hr.displayName=Wa.displayName;const vv=w.forwardRef(({className:e,...t},n)=>c.jsx(Ga,{ref:n,className:Ce("px-2 py-1.5 text-sm font-semibold",e),...t}));vv.displayName=Ga.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(Cf,{children:c.jsx(pv,{className:"h-4 w-4"})})}),c.jsx(xf,{children:t})]}));zr.displayName=qa.displayName;const wv=w.forwardRef(({className:e,...t},n)=>c.jsx(Qa,{ref:n,className:Ce("-mx-1 my-1 h-px bg-muted",e),...t}));wv.displayName=Qa.displayName;function Df({open:e,isAccountsLoading:t,accountOptions:n,onConfirm:r,backUrl:s,createAccountUrl:i}){var f;const[o,a]=S.useState(""),l=o||((f=n[0])==null?void 0:f.login)||"",d=!t&&n.length>0&&l!=="",u=!t&&n.length===0;return c.jsx(_y,{open:e,children:c.jsxs(Ou,{className:"web-trading-widget-account-modal",onPointerDownOutside:h=>h.preventDefault(),onEscapeKeyDown:h=>h.preventDefault(),children:[c.jsxs(Ru,{children:[c.jsx(Lu,{children:"Select trading account"}),c.jsx(ju,{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(Xs,{value:l,onValueChange:a,children:[c.jsx(Vr,{className:"web-trading-widget-account-modal__select",children:c.jsx(Js,{placeholder:"Select account"})}),c.jsx(Hr,{children:n.map(h=>c.jsxs(zr,{value:h.login,children:[h.label," (",h.balance.toFixed(2)," ",h.currency,")"]},h.login))})]}),c.jsx(Du,{children:u?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 _v={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 xv=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),bt=(e,t)=>{const n=S.forwardRef(({color:r="currentColor",size:s=24,strokeWidth:i=2,absoluteStrokeWidth:o,children:a,...l},d)=>S.createElement("svg",{ref:d,..._v,width:s,height:s,stroke:r,strokeWidth:o?Number(i)*24/Number(s):i,className:`lucide lucide-${xv(e)}`,...l},[...t.map(([u,f])=>S.createElement(u,f)),...(Array.isArray(a)?a:[a])||[]]));return n.displayName=`${e}`,n},ei=bt("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),Sv=bt("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),Cv=bt("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),Io=bt("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),Lf=bt("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"}]]),jf=bt("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"}]]),Ev=bt("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"}]]),Tv=bt("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"}]]),Pv=bt("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]),kv=bt("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),gn=bt("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function Av(e){const t=Math.round(Math.log10(e));return Number.isFinite(t)&&t>0?t:5}function Ja(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 Nv(e){const t=Ja(e);return t!=null&&t.pricescale?Av(t.pricescale):5}function If(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 Ov(e){const t=Ja(e);return(t==null?void 0:t.type)==="commodity"?100:1e5}const ec="USD";function rs(e){return Ye(e).toUpperCase()}function Ai(e){const t=rs(e);return t.length>=6?t.slice(3):ec}function tc(e){if(e!==ec&&e==="JPY")return"USDJPY"}function Rv(e,t,n,r,s){const i=Ai(e),o=tc(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 Dv(e,t,n,r,s,i,o={}){const a=e==="buy"?n:r;let d=(e==="buy"?a-t:t-a)*s*Ov(i);const u=Ai(i),f=Rv(i,e,n,r,o);if(f!==void 0)d/=f;else if(u!==ec)return null;return Math.round(d*100)/100}function Lv(e){const t=new Set;for(const n of e){const r=tc(Ai(n));r&&rs(n)!==r&&t.add(r)}return[...t]}function jv(e,t){const n=rs(e);if(n===t)return!0;const r=tc(Ai(e));return r===t&&n!==r}function Iv(e,t,n,r,s){if(!jv(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=Dv(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 Ni(e){return Ye(e)||"—"}const qe={BUY:0,SELL:1,BUY_LIMIT:2,SELL_LIMIT:3,BUY_STOP:4,SELL_STOP:5,BUY_STOP_LIMIT:6,SELL_STOP_LIMIT:7},ti=[{mode:"market",label:"Market Execution",orderType:null,isMarket:!0},{mode:"buy_limit",label:"Buy Limit",orderType:qe.BUY_LIMIT,isMarket:!1},{mode:"sell_limit",label:"Sell Limit",orderType:qe.SELL_LIMIT,isMarket:!1},{mode:"buy_stop",label:"Buy Stop",orderType:qe.BUY_STOP,isMarket:!1},{mode:"sell_stop",label:"Sell Stop",orderType:qe.SELL_STOP,isMarket:!1},{mode:"buy_stop_limit",label:"Buy Stop Limit",orderType:qe.BUY_STOP_LIMIT,isMarket:!1},{mode:"sell_stop_limit",label:"Sell Stop Limit",orderType:qe.SELL_STOP_LIMIT,isMarket:!1}];function Oi(e){return ti.find(t=>t.mode===e)??ti[0]}function Ri(e){return Oi(e).isMarket}function Mo(e,t){const n=Oi(e);return n.orderType!==null?n.orderType:t==="buy"?qe.BUY:qe.SELL}function ni(e){return e%2===1?"sell":"buy"}function nc(e){return e>=qe.BUY_LIMIT&&e<=qe.SELL_STOP_LIMIT}function rc(e){return e===qe.BUY_STOP_LIMIT||e===qe.SELL_STOP_LIMIT}function Mf(e){return e==="buy_stop_limit"||e==="sell_stop_limit"}const ft={GTC:0,TODAY:1,SPECIFIED:2,SPECIFIED_DAY:3},Ff=[{value:ft.GTC,label:"GTC"},{value:ft.TODAY,label:"Today"},{value:ft.SPECIFIED,label:"Specified"},{value:ft.SPECIFIED_DAY,label:"Specified Day"}];function sc(e){return e===ft.SPECIFIED}function ic(e){return e===ft.SPECIFIED_DAY}function Mv(e){return e.map(t=>({login:t.login,label:t.label,balance:t.tradeStat.balance,currency:t.currency}))}function Fv(){if(typeof window>"u")return null;const e=localStorage.getItem(tu);return(e==null?void 0:e.trim())||null}function pl(e){if(typeof window>"u")return;const t=e.trim();t&&localStorage.setItem(tu,t)}function Uv(e,t){var n;return t&&e.some(r=>r.login===t)?t:((n=e[0])==null?void 0:n.login)??""}function oc(e,t=Bt){return t.find(n=>n.ticker===e)}function Bv(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=Ja(e))==null?void 0:s.ticker)??null}function Uf(e,t=Bt){const n=oc(e,t),r=(n==null?void 0:n.resolve_symbol)??e.replace(/_/g,"");return Ye(r).toUpperCase()}function Di(e,t=Bt){const n=oc(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=oc(e,t);return(n==null?void 0:n.pricescale)??1e5}function Ee(e,t){return e.toFixed(t)}function Pr(e){return 1/10**e}function Bf(e,t){return e===null||t===null?null:(e+t)/2}function pt(e){const t=e.trim();if(!t)return;const n=Number(t);if(!(!Number.isFinite(n)||n<=0))return n}function $f(e,t,n){if(sc(e)){if(!t.trim())return;const r=Date.parse(t);return Number.isFinite(r)?Math.floor(r/1e3):void 0}if(ic(e)){if(!n.trim())return;const r=Date.parse(`${n}T23:59:59`);return Number.isFinite(r)?Math.floor(r/1e3):void 0}}function Li(e,t,n){return e===ft.GTC||e===ft.TODAY?!0:$f(e,t,n)!==void 0}const $v={},ml=e=>{let t;const n=new Set,r=(u,f)=>{const h=typeof u=="function"?u(t):u;if(!Object.is(h,t)){const m=t;t=f??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(g=>g(t,m))}},s=()=>t,l={setState:r,getState:s,getInitialState:()=>d,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{($v?"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},Vv=e=>e?ml(e):ml;function Hv(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var xs={exports:{}},io={},Ss={exports:{}},oo={};/**
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 ml;function $v(){if(ml)return oo;ml=1;var e=S;function t(f,h){return f===h&&(f!==0||1/f===1/h)||f!==f&&h!==h}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,s=e.useEffect,i=e.useLayoutEffect,o=e.useDebugValue;function a(f,h){var m=h(),g=r({inst:{value:m,getSnapshot:h}}),p=g[0].inst,y=g[1];return i(function(){p.value=m,p.getSnapshot=h,l(p)&&y({inst:p})},[f,m,h]),s(function(){return l(p)&&y({inst:p}),f(function(){l(p)&&y({inst:p})})},[f]),o(m),m}function l(f){var h=f.getSnapshot;f=f.value;try{var m=h();return!n(f,m)}catch{return!0}}function d(f,h){return h()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:a;return oo.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,oo}var ao={};/**
49
+ */var hl;function zv(){if(hl)return oo;hl=1;var e=S;function t(f,h){return f===h&&(f!==0||1/f===1/h)||f!==f&&h!==h}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,s=e.useEffect,i=e.useLayoutEffect,o=e.useDebugValue;function a(f,h){var m=h(),g=r({inst:{value:m,getSnapshot:h}}),p=g[0].inst,y=g[1];return i(function(){p.value=m,p.getSnapshot=h,l(p)&&y({inst:p})},[f,m,h]),s(function(){return l(p)&&y({inst:p}),f(function(){l(p)&&y({inst:p})})},[f]),o(m),m}function l(f){var h=f.getSnapshot;f=f.value;try{var m=h();return!n(f,m)}catch{return!0}}function d(f,h){return h()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:a;return oo.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,oo}var ao={};/**
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 hl;function Vv(){return hl||(hl=1,process.env.NODE_ENV!=="production"&&(function(){function e(m,g){return m===g&&(m!==0||1/m===1/g)||m!==m&&g!==g}function t(m,g){u||s.startTransition===void 0||(u=!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 p=g();if(!f){var y=g();i(p,y)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),f=!0)}y=o({inst:{value:p,getSnapshot:g}});var b=y[0].inst,v=y[1];return l(function(){b.value=p,b.getSnapshot=g,n(b)&&v({inst:b})},[m,p,g]),a(function(){return n(b)&&v({inst:b}),m(function(){n(b)&&v({inst:b})})},[m]),d(p),p}function n(m){var g=m.getSnapshot;m=m.value;try{var p=g();return!i(m,p)}catch{return!0}}function r(m,g){return g()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var s=S,i=typeof Object.is=="function"?Object.is:e,o=s.useState,a=s.useEffect,l=s.useLayoutEffect,d=s.useDebugValue,u=!1,f=!1,h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;ao.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:h,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),ao}var gl;function Bf(){return gl||(gl=1,process.env.NODE_ENV==="production"?Ss.exports=$v():Ss.exports=Vv()),Ss.exports}/**
57
+ */var gl;function Wv(){return gl||(gl=1,process.env.NODE_ENV!=="production"&&(function(){function e(m,g){return m===g&&(m!==0||1/m===1/g)||m!==m&&g!==g}function t(m,g){u||s.startTransition===void 0||(u=!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 p=g();if(!f){var y=g();i(p,y)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),f=!0)}y=o({inst:{value:p,getSnapshot:g}});var b=y[0].inst,v=y[1];return l(function(){b.value=p,b.getSnapshot=g,n(b)&&v({inst:b})},[m,p,g]),a(function(){return n(b)&&v({inst:b}),m(function(){n(b)&&v({inst:b})})},[m]),d(p),p}function n(m){var g=m.getSnapshot;m=m.value;try{var p=g();return!i(m,p)}catch{return!0}}function r(m,g){return g()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var s=S,i=typeof Object.is=="function"?Object.is:e,o=s.useState,a=s.useEffect,l=s.useLayoutEffect,d=s.useDebugValue,u=!1,f=!1,h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;ao.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:h,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),ao}var yl;function Vf(){return yl||(yl=1,process.env.NODE_ENV==="production"?Ss.exports=zv():Ss.exports=Wv()),Ss.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 yl;function Hv(){if(yl)return io;yl=1;var e=S,t=Bf();function n(d,u){return d===u&&(d!==0||1/d===1/u)||d!==d&&u!==u}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 io.useSyncExternalStoreWithSelector=function(d,u,f,h,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(P){if(!v){if(v=!0,x=P,P=h(P),m!==void 0&&p.hasValue){var T=p.value;if(m(T,P))return _=T}return _=P}if(T=_,r(x,P))return T;var N=h(P);return m!==void 0&&m(T,N)?(x=P,T):(x=P,_=N)}var v=!1,x,_,C=f===void 0?null:f;return[function(){return b(u())},C===null?void 0:function(){return b(C())}]},[u,f,h,m]);var y=s(d,g[0],g[1]);return o(function(){p.hasValue=!0,p.value=y},[y]),l(y),y},io}var co={};/**
65
+ */var bl;function Kv(){if(bl)return io;bl=1;var e=S,t=Vf();function n(d,u){return d===u&&(d!==0||1/d===1/u)||d!==d&&u!==u}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 io.useSyncExternalStoreWithSelector=function(d,u,f,h,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(P){if(!v){if(v=!0,x=P,P=h(P),m!==void 0&&p.hasValue){var T=p.value;if(m(T,P))return _=T}return _=P}if(T=_,r(x,P))return T;var O=h(P);return m!==void 0&&m(T,O)?(x=P,T):(x=P,_=O)}var v=!1,x,_,C=f===void 0?null:f;return[function(){return b(u())},C===null?void 0:function(){return b(C())}]},[u,f,h,m]);var y=s(d,g[0],g[1]);return o(function(){p.hasValue=!0,p.value=y},[y]),l(y),y},io}var co={};/**
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 bl;function zv(){return bl||(bl=1,process.env.NODE_ENV!=="production"&&(function(){function e(d,u){return d===u&&(d!==0||1/d===1/u)||d!==d&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=S,n=Bf(),r=typeof Object.is=="function"?Object.is:e,s=n.useSyncExternalStore,i=t.useRef,o=t.useEffect,a=t.useMemo,l=t.useDebugValue;co.useSyncExternalStoreWithSelector=function(d,u,f,h,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(P){if(!v){if(v=!0,x=P,P=h(P),m!==void 0&&p.hasValue){var T=p.value;if(m(T,P))return _=T}return _=P}if(T=_,r(x,P))return T;var N=h(P);return m!==void 0&&m(T,N)?(x=P,T):(x=P,_=N)}var v=!1,x,_,C=f===void 0?null:f;return[function(){return b(u())},C===null?void 0:function(){return b(C())}]},[u,f,h,m]);var y=s(d,g[0],g[1]);return o(function(){p.hasValue=!0,p.value=y},[y]),l(y),y},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),co}var vl;function Wv(){return vl||(vl=1,process.env.NODE_ENV==="production"?xs.exports=Hv():xs.exports=zv()),xs.exports}var Kv=Wv();const Gv=Bv(Kv),$f={},{useDebugValue:qv}=S,{useSyncExternalStoreWithSelector:Zv}=Gv;let wl=!1;const Yv=e=>e;function Qv(e,t=Yv,n){($f?"production":void 0)!=="production"&&n&&!wl&&(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"),wl=!0);const r=Zv(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return qv(r),r}const _l=e=>{($f?"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"?Uv(e):e,n=(r,s)=>Qv(t,r,s);return Object.assign(n,t),n},ji=e=>e?_l(e):_l,xl={source:null,entryPrice:null,stopLoss:"",takeProfit:"",side:null,showEntryLine:!1,volumeLots:.01,digits:2,priceStep:.01},oe=ji(e=>({...xl,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}),clearDraft:()=>e({...xl})}));function lo(e,t){return e.toFixed(t)}function Xv({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,isDragging:d,scanResultUrl:u,onDragHandlePointerDown:f,onExpandedChange:h,onExpand:m,onPlaceOrder:g}){const[p,y]=S.useState(String(r)),[b,v]=S.useState(null),[x,_]=S.useState(u),C=oe(L=>L.setOrderSide),P=oe(L=>L.setVolumeLots);u!==x&&(_(u),v(null));const T=b??!!u;S.useEffect(()=>{h()},[T,h]);const N=()=>{const L=!T;L&&m(),v(L)},R=Number(Vt(Ht(e))),A=t!==null?Ee(t,R):"—",j=n!==null?Ee(n,R):"—",B=!o&&!a&&l!==""&&(t!==null&&n!==null),O=L=>{const M=Number(p),K=Number.isFinite(M)&&M>0?M:r,F=Math.max(i,K+L*s),se=lo(F,2);y(se),P(F)},H=()=>{const L=Number(p);if(!Number.isFinite(L)||L<=0){y(lo(r,2)),P(r);return}const M=Math.max(i,L),K=lo(M,2);y(K),P(M)},U=L=>{t===null||n===null||C({side:L,entryPrice:L==="buy"?n:t})},I=L=>{if(t===null||n===null||!l)return;const M=Number(p),K=Math.max(i,Number.isFinite(M)&&M>0?M:r);C({side:L,entryPrice:L==="buy"?n:t}),g({login:l,side:L,volumeLots:K,bid:t,ask:n})};return c.jsx("div",{className:`web-trading-widget-mini-order${T?" 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:f,className:`web-trading-widget-mini-order__drag-handle${d?" web-trading-widget-mini-order__drag-handle--grabbing":""}`,children:c.jsx(Df,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2})}),T?c.jsxs(c.Fragment,{children:[c.jsxs("button",{type:"button",disabled:!B,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--sell",onMouseDown:()=>U("sell"),onClick:()=>I("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:!B,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>O(-1),children:c.jsx(ei,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})}),c.jsx("input",{type:"text",inputMode:"decimal",value:p,disabled:!B,onChange:L=>y(L.target.value),onBlur:H,className:"web-trading-widget-mini-order__volume-input"}),c.jsx("button",{type:"button","aria-label":"Increase volume",disabled:!B,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>O(1),children:c.jsx(Io,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})})]}),c.jsxs("button",{type:"button",disabled:!B,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--buy",onMouseDown:()=>U("buy"),onClick:()=>I("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:j})]})]}):null,c.jsx("button",{type:"button","aria-label":T?"Collapse quick order panel":"Expand quick order panel","aria-expanded":T,className:"web-trading-widget-mini-order__toggle",onClick:N,children:T?c.jsx(_v,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5}):c.jsx(xv,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5})})]})})}const Jv="web-trading-widget-mini-exec-panel-position",Vf={x:56,y:96};function Sl(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 Cl(e,t){e.style.left=`${t.x}px`,e.style.top=`${t.y}px`}function ew(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):Vf.x,y:16}}function tw(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 El(e,t){try{e.hasPointerCapture(t)&&e.releasePointerCapture(t)}catch{}}function Hf(e){const t=(e==null?void 0:e.storageKey)??Jv,n=(e==null?void 0:e.defaultPosition)??Vf,r=e==null?void 0:e.defaultAlign,s=(e==null?void 0:e.isActive)??!0,i=S.useRef(null),[o,a]=S.useState(n),[l,d]=S.useState(!1),u=S.useRef(n),f=S.useRef(null);S.useEffect(()=>{u.current=o},[o]);const h=S.useCallback(p=>{const y=i.current,b=Sl(p,y);u.current=b,a(b),y&&Cl(y,b)},[]),m=S.useCallback(()=>{h(u.current)},[h]);S.useEffect(()=>{if(!s)return;const p=tw(t);if(p){h(p);return}const y=r?ew(r,i.current):null;h(y??u.current)},[h,r,s,t]);const g=S.useCallback(p=>{p.preventDefault(),p.stopPropagation();const y=p.currentTarget,b=i.current;if(!b)return;const v=p.pointerId;y.setPointerCapture(v);const x=p.clientX,_=p.clientY,C=u.current;d(!0),document.body.style.cursor="grabbing",document.body.style.userSelect="none";const P=(R,A)=>{const j=Sl({x:C.x+(R-x),y:C.y+(A-_)},b);u.current=j,Cl(b,j)},T=R=>{if(R.pointerId===v){El(y,v),y.removeEventListener("pointermove",N),y.removeEventListener("pointerup",T),y.removeEventListener("pointercancel",T),f.current=null,d(!1),a(u.current),document.body.style.cursor="",document.body.style.userSelect="";try{window.localStorage.setItem(t,JSON.stringify(u.current))}catch{}}},N=R=>{R.pointerId===v&&(R.preventDefault(),P(R.clientX,R.clientY))};y.addEventListener("pointermove",N),y.addEventListener("pointerup",T),y.addEventListener("pointercancel",T),f.current=()=>{El(y,v),y.removeEventListener("pointermove",N),y.removeEventListener("pointerup",T),y.removeEventListener("pointercancel",T),document.body.style.cursor="",document.body.style.userSelect="",d(!1)}},[t]);return S.useEffect(()=>{const p=()=>{h(u.current)};return window.addEventListener("resize",p),()=>{var y;window.removeEventListener("resize",p),(y=f.current)==null||y.call(f),f.current=null,document.body.style.cursor="",document.body.style.userSelect=""}},[h]),{panelRef:i,position:o,isDragging:l,onDragStart:g,reclamp:m}}const zf=200,nw=201,rw=203,sw=204,Wf=0,iw=2,Kf=0;function Ii(e){const t=Number(e.trim());if(!Number.isFinite(t))throw new Error("Invalid trading account login.");return t}function ac(e){return Math.round(e*1e4)}function ow(e){return e>=2&&e<=7}function aw(e){return{Action:sw,Order:Number(e.orderTicket),Login:Ii(e.login),Symbol:e.symbol.replace(/m$/i,""),Type:e.orderType}}function cw(e){return{Action:rw,Order:Number(e.orderTicket),Login:Ii(e.login),Symbol:e.symbol.replace(/m$/i,""),Type:e.orderType,Volume:ac(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 lw(e){const t=e.positionSide==="buy"?1:0;return{Action:zf,Login:Ii(e.login),Symbol:e.symbol.replace(/m$/i,""),Type:t,TypeFill:Wf,Volume:ac(e.volumeLots),Digits:e.digits,TypeTime:Kf,Comment:e.comment??"",Position:Number(e.positionTicket)}}function dw(e){const t=!ow(e.orderType);return{Action:t?zf:nw,Login:Ii(e.login),Symbol:e.symbol,Type:e.orderType,TypeFill:t?Wf:iw,Volume:ac(e.volumeLots),Digits:e.digits,TypeTime:e.typeTime??Kf,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 uw(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 fw=new Set(["10009","10008"]);function Lt(e){if(e===void 0||e==="")return;const t=Number(e);return Number.isFinite(t)?t:void 0}function pw(e){const t=Lt(e);return t===void 0?.01:t/1e4}function mw(e){var t;return(t=e.find(n=>n.answer))==null?void 0:t.answer}function hw(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:Lt(((r=i.result)==null?void 0:r.Price)??((s=i.answer)==null?void 0:s.ResultPrice))}}return{retcode:""}}function Ms(e){return fw.has(e)}function Cs(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=mw(r),{retcode:i,price:o}=hw(r),a=Ms(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,u=Ye(d),f=Lt(s==null?void 0:s.Type),h=f!==void 0?f%2===0?"buy":"sell":t.side,m=Lt(s==null?void 0:s.ResultPrice)??Lt(s==null?void 0:s.PriceOrder)??o??t.openPrice,g=Lt(s==null?void 0:s.ResultMarketBid),p=Lt(s==null?void 0:s.ResultMarketAsk),y=h==="buy"?g??m:p??m,b=kv(u);return{ticket:String(l||Math.floor(Date.now()/1e3)),login:((x=s==null?void 0:s.Login)==null?void 0:x.trim())||t.login,symbol:u,displaySymbol:Ni(u),side:h,volumeLots:pw(s==null?void 0:s.Volume)||t.volumeLots,openPrice:m,currentPrice:y,stopLoss:Lt(s==null?void 0:s.PriceSL),takeProfit:Lt(s==null?void 0:s.PriceTP),comment:((_=s==null?void 0:s.Comment)==null?void 0:_.trim())||t.comment,digits:Math.round(b),retcode:i,isSuccess:a,marketBid:g,marketAsk:p}}function gw(e){return e.type==="buy"?e.marketBid??e.currentPrice:e.marketAsk??e.currentPrice}function yw(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=Di(n.symbolTicker,t),o=Number(Vt(Ht(n.symbolTicker,t))),a=Ri(n.executionMode),l=rc(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&&!Li(d,n.expirationDateTime??"",n.expirationDay??""))return{success:!1,message:"Please set an expiration date for this order."};const u=a?n.side==="buy"?n.ask:n.bid:n.priceOrder??(n.side==="buy"?n.ask:n.bid),f=a?void 0:Uf(d,n.expirationDateTime??"",n.expirationDay??"");try{const h=dw({login:r,symbol:i,volumeLots:s,orderType:n.orderType,digits:o,comment:n.comment.trim(),priceOrder:nc(n.orderType)?n.priceOrder:void 0,priceTrigger:l?n.priceTrigger:void 0,priceSL:n.stopLoss,priceTP:n.takeProfit,typeTime:a?void 0:d,timeExpiration:f}),m=await e.sendRequest(h),g=Cs(m,{login:r,symbol:i,side:ni(n.orderType),volumeLots:s,openPrice:u,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(h){return{success:!1,message:h instanceof Error?h.message:"Failed to place order."}}},async closePosition(n){try{const r=gw(n),s=lw({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=Cs(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&&!Ms(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=aw({login:n.login,orderTicket:n.ticket,symbol:n.symbol,orderType:n.orderType}),s=await e.sendRequest(r),i=Cs(s,{login:n.login,symbol:n.symbol,side:n.side,volumeLots:n.volumeLots,openPrice:n.orderPrice,digits:n.digits,comment:n.comment});return i&&!Ms(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=cw({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=Cs(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&&!Ms(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 Gf(e,t){return function(){return e.apply(t,arguments)}}const{toString:bw}=Object.prototype,{getPrototypeOf:yr}=Object,{iterator:ss,toStringTag:qf}=Symbol,ri=(({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),ri(n,t))return!0;n=yr(n)}return!1},vw=(e,t)=>e!=null&&Wr(e,t)?e[t]:void 0,cc=(e=>t=>{const n=bw.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),vt=e=>(e=e.toLowerCase(),t=>cc(t)===e),Mi=e=>t=>typeof t===e,{isArray:In}=Array,br=Mi("undefined");function kr(e){return e!==null&&!br(e)&&e.constructor!==null&&!br(e.constructor)&&Ze(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Zf=vt("ArrayBuffer");function ww(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Zf(e.buffer),t}const _w=Mi("string"),Ze=Mi("function"),Yf=Mi("number"),Ar=e=>e!==null&&typeof e=="object",xw=e=>e===!0||e===!1,Fs=e=>{if(!Ar(e))return!1;const t=yr(e);return(t===null||t===Object.prototype||yr(t)===null)&&!Wr(e,qf)&&!Wr(e,ss)},Sw=e=>{if(!Ar(e)||kr(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Cw=vt("Date"),Ew=vt("File"),Tw=e=>!!(e&&typeof e.uri<"u"),Pw=e=>e&&typeof e.getParts<"u",kw=vt("Blob"),Aw=vt("FileList"),Nw=e=>Ar(e)&&Ze(e.pipe);function Ow(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const Tl=Ow(),Pl=typeof Tl.FormData<"u"?Tl.FormData:void 0,Rw=e=>{if(!e)return!1;if(Pl&&e instanceof Pl)return!0;const t=yr(e);if(!t||t===Object.prototype||!Ze(e.append))return!1;const n=cc(e);return n==="formdata"||n==="object"&&Ze(e.toString)&&e.toString()==="[object FormData]"},Dw=vt("URLSearchParams"),[Lw,jw,Iw,Mw]=["ReadableStream","Request","Response","Headers"].map(vt),Fw=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(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 Qf(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,Xf=e=>!br(e)&&e!==vn;function Fo(...e){const{caseless:t,skipUndefined:n}=Xf(this)&&this||{},r={},s=(i,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const a=t&&typeof o=="string"&&Qf(r,o)||o,l=ri(r,a)?r[a]:void 0;Fs(l)&&Fs(i)?r[a]=Fo(l,i):Fs(i)?r[a]=Fo({},i):In(i)?r[a]=i.slice():(!n||!br(i))&&(r[a]=i)};for(let i=0,o=e.length;i<o;i++){const a=e[i];if(!a||kr(a)||(is(a,s),typeof a!="object"||In(a)))continue;const l=Object.getOwnPropertySymbols(a);for(let d=0;d<l.length;d++){const u=l[d];Yw.call(a,u)&&s(a[u],u)}}return r}const Uw=(e,t,n,{allOwnKeys:r}={})=>(is(t,(s,i)=>{n&&Ze(s)?Object.defineProperty(e,i,{__proto__:null,value:Gf(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),Bw=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),$w=(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)},Vw=(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&&yr(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},Hw=(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},zw=e=>{if(!e)return null;if(In(e))return e;let t=e.length;if(!Yf(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},Ww=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&yr(Uint8Array)),Kw=(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])}},Gw=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},qw=vt("HTMLFormElement"),Zw=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),{propertyIsEnumerable:Yw}=Object.prototype,Qw=vt("RegExp"),Jf=(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)},Xw=e=>{Jf(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+"'")})}})},Jw=(e,t)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return In(e)?r(e):r(String(e).split(t)),n},e_=()=>{},t_=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function n_(e){return!!(e&&Ze(e.append)&&e[qf]==="FormData"&&e[ss])}const r_=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 is(r,(i,o)=>{const a=n(i);!br(a)&&(s[o]=a)}),t.delete(r),s}}return r};return n(e)},s_=vt("AsyncFunction"),i_=e=>e&&(Ar(e)||Ze(e))&&Ze(e.then)&&Ze(e.catch),ep=((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)),o_=typeof queueMicrotask<"u"?queueMicrotask.bind(vn):typeof process<"u"&&process.nextTick||ep,tp=e=>e!=null&&Ze(e[ss]),a_=e=>e!=null&&Wr(e,ss)&&tp(e),k={isArray:In,isArrayBuffer:Zf,isBuffer:kr,isFormData:Rw,isArrayBufferView:ww,isString:_w,isNumber:Yf,isBoolean:xw,isObject:Ar,isPlainObject:Fs,isEmptyObject:Sw,isReadableStream:Lw,isRequest:jw,isResponse:Iw,isHeaders:Mw,isUndefined:br,isDate:Cw,isFile:Ew,isReactNativeBlob:Tw,isReactNative:Pw,isBlob:kw,isRegExp:Qw,isFunction:Ze,isStream:Nw,isURLSearchParams:Dw,isTypedArray:Ww,isFileList:Aw,forEach:is,merge:Fo,extend:Uw,trim:Fw,stripBOM:Bw,inherits:$w,toFlatObject:Vw,kindOf:cc,kindOfTest:vt,endsWith:Hw,toArray:zw,forEachEntry:Kw,matchAll:Gw,isHTMLForm:qw,hasOwnProperty:ri,hasOwnProp:ri,hasOwnInPrototypeChain:Wr,getSafeProp:vw,reduceDescriptors:Jf,freezeMethods:Xw,toObjectSet:Jw,toCamelCase:Zw,noop:e_,toFiniteNumber:t_,findKey:Qf,global:vn,isContextDefined:Xf,isSpecCompliantForm:n_,toJSONObject:r_,isAsyncFn:s_,isThenable:i_,setImmediate:ep,asap:o_,isIterable:tp,isSafeIterable:a_},c_=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"]),l_=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]&&c_[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t};function d_(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 u_=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),f_=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function lc(e,t){return k.isArray(e)?e.map(n=>lc(n,t)):d_(String(e).replace(t,""))}const p_=e=>lc(e,u_),m_=e=>lc(e,f_);function np(e){const t=Object.create(null);return k.forEach(e.toJSON(),(n,r)=>{t[r]=m_(n)}),t}const kl=Symbol("internals");function Lr(e){return e&&String(e).trim().toLowerCase()}function Us(e){return e===!1||e==null?e:k.isArray(e)?e.map(Us):p_(String(e))}function h_(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 g_=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function uo(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 y_(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function b_(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 ze=class{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function i(a,l,d){const u=Lr(l);if(!u)return;const f=k.findKey(s,u);(!f||s[f]===void 0||d===!0||d===void 0&&s[f]!==!1)&&(s[f||l]=Us(a))}const o=(a,l)=>k.forEach(a,(d,u)=>i(d,u,l));if(k.isPlainObject(t)||t instanceof this.constructor)o(t,n);else if(k.isString(t)&&(t=t.trim())&&!g_(t))o(l_(t),n);else if(k.isObject(t)&&k.isSafeIterable(t)){let a=Object.create(null),l,d;for(const u of t){if(!k.isArray(u))throw new TypeError("Object iterator must return a key-value pair");d=u[0],k.hasOwnProp(a,d)?(l=a[d],a[d]=k.isArray(l)?[...l,u[1]]:[l,u[1]]):a[d]=u[1]}o(a,n)}else t!=null&&i(n,t,r);return this}get(t,n){if(t=Lr(t),t){const r=k.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return h_(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=Lr(t),t){const r=k.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||uo(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function i(o){if(o=Lr(o),o){const a=k.findKey(r,o);a&&(!n||uo(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||uo(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]=Us(s),delete n[i];return}const a=t?y_(i):String(i).trim();a!==i&&delete n[i],n[a]=Us(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[kl]=this[kl]={accessors:{}}).accessors,s=this.prototype;function i(o){const a=Lr(o);r[a]||(b_(s,o),r[a]=!0)}return k.isArray(t)?t.forEach(i):i(t),this}};ze.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);k.reduceDescriptors(ze.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});k.freezeMethods(ze);const v_="[REDACTED ****]";function w_(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 __(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 ze&&(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)&&w_(i))return r.pop(),i;o=Object.create(null);for(const[a,l]of Object.entries(i)){const d=n.has(a.toLowerCase())?v_:s(l);k.isUndefined(d)||(o[a]=d)}}return r.pop(),o};return s(e)}let q=class rp extends Error{static from(t,n,r,s,i,o){const a=new rp(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?__(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}}};q.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";q.ERR_BAD_OPTION="ERR_BAD_OPTION";q.ECONNABORTED="ECONNABORTED";q.ETIMEDOUT="ETIMEDOUT";q.ECONNREFUSED="ECONNREFUSED";q.ERR_NETWORK="ERR_NETWORK";q.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";q.ERR_DEPRECATED="ERR_DEPRECATED";q.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";q.ERR_BAD_REQUEST="ERR_BAD_REQUEST";q.ERR_CANCELED="ERR_CANCELED";q.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";q.ERR_INVALID_URL="ERR_INVALID_URL";q.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const x_=null,sp=100;function Uo(e){return k.isPlainObject(e)||k.isArray(e)}function ip(e){return k.endsWith(e,"[]")?e.slice(0,-2):e}function fo(e,t,n){return e?e.concat(t).map(function(s,i){return s=ip(s),!n&&i?"["+s+"]":s}).join(n?".":""):t}function S_(e){return k.isArray(e)&&!e.some(Uo)}const C_=k.toFlatObject(k,{},null,function(t){return/^is[A-Z]/.test(t)});function Fi(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,x){return!k.isUndefined(x[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?sp:n.maxDepth,d=a&&k.isSpecCompliantForm(t),u=[];if(!k.isFunction(s))throw new TypeError("visitor must be a function");function f(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 q("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 h(b){if(b>l)throw new q("Object is too deeply nested ("+b+" levels). Max depth: "+l,q.ERR_FORM_DATA_DEPTH_EXCEEDED)}function m(b,v){if(l===1/0)return JSON.stringify(b);const x=[];return JSON.stringify(b,function(C,P){if(!k.isObject(P))return P;for(;x.length&&x[x.length-1]!==this;)x.pop();return x.push(P),h(v+x.length-1),P})}function g(b,v,x){let _=b;if(k.isReactNative(t)&&k.isReactNativeBlob(b))return t.append(fo(x,v,i),f(b)),!1;if(b&&!x&&typeof b=="object"){if(k.endsWith(v,"{}"))v=r?v:v.slice(0,-2),b=m(b,1);else if(k.isArray(b)&&S_(b)||(k.isFileList(b)||k.endsWith(v,"[]"))&&(_=k.toArray(b)))return v=ip(v),_.forEach(function(P,T){!(k.isUndefined(P)||P===null)&&t.append(o===!0?fo([v],T,i):o===null?v:v+"[]",f(P))}),!1}return Uo(b)?!0:(t.append(fo(x,v,i),f(b)),!1)}const p=Object.assign(C_,{defaultVisitor:g,convertValue:f,isVisitable:Uo});function y(b,v,x=0){if(!k.isUndefined(b)){if(h(x),u.indexOf(b)!==-1)throw new Error("Circular reference detected in "+v.join("."));u.push(b),k.forEach(b,function(C,P){(!(k.isUndefined(C)||C===null)&&s.call(t,C,k.isString(P)?P.trim():P,v,p))===!0&&y(C,v?v.concat(P):[P],x+1)}),u.pop()}}if(!k.isObject(e))throw new TypeError("data must be an object");return y(e),t}function Al(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(r){return t[r]})}function dc(e,t){this._pairs=[],e&&Fi(e,this,t)}const op=dc.prototype;op.append=function(t,n){this._pairs.push([t,n])};op.toString=function(t){const n=t?function(r){return t.call(this,r,Al)}:Al;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function E_(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ap(e,t,n){if(!t)return e;const r=k.isFunction(n)?{serialize:n}:n,s=k.getSafeProp(r,"encode")||E_,i=k.getSafeProp(r,"serialize");let o;if(i?o=i(t,r):o=k.isURLSearchParams(t)?t.toString():new dc(t,r).toString(s),o){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class Nl{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 uc={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},T_=typeof URLSearchParams<"u"?URLSearchParams:dc,P_=typeof FormData<"u"?FormData:null,k_=typeof Blob<"u"?Blob:null,A_={isBrowser:!0,classes:{URLSearchParams:T_,FormData:P_,Blob:k_},protocols:["http","https","file","blob","url","data"]},fc=typeof window<"u"&&typeof document<"u",Bo=typeof navigator=="object"&&navigator||void 0,N_=fc&&(!Bo||["ReactNative","NativeScript","NS"].indexOf(Bo.product)<0),O_=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",R_=fc&&window.location.href||"http://localhost",D_=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:fc,hasStandardBrowserEnv:N_,hasStandardBrowserWebWorkerEnv:O_,navigator:Bo,origin:R_},Symbol.toStringTag,{value:"Module"})),Be={...D_,...A_};function L_(e,t){return Fi(e,new Be.classes.URLSearchParams,{visitor:function(n,r,s,i){return Be.isNode&&k.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}const Ol=sp;function cp(e){if(e>Ol)throw new q("FormData field is too deeply nested ("+e+" levels). Max depth: "+Ol,q.ERR_FORM_DATA_DEPTH_EXCEEDED)}function j_(e){const t=[],n=/\w+|\[(\w*)]/g;let r;for(;(r=n.exec(e))!==null;)cp(t.length),t.push(r[0]==="[]"?"":r[1]||r[0]);return t}function I_(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 lp(e){function t(n,r,s,i){cp(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]=I_(s[o])),!a)}if(k.isFormData(e)&&k.isFunction(e.entries)){const n={};return k.forEachEntry(e,(r,s)=>{t(j_(r),s,n,0)}),n}return null}const Gn=(e,t)=>e!=null&&k.hasOwnProp(e,t)?e[t]:void 0;function M_(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 os={transitional:uc,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(lp(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=Gn(this,"formSerializer");if(r.indexOf("application/x-www-form-urlencoded")>-1)return L_(t,l).toString();if((a=k.isFileList(t))||r.indexOf("multipart/form-data")>-1){const d=Gn(this,"env"),u=d&&d.FormData;return Fi(a?{"files[]":t}:t,u&&new u,l)}}return i||s?(n.setContentType("application/json",!1),M_(t)):t}],transformResponse:[function(t){const n=Gn(this,"transitional")||os.transitional,r=n&&n.forcedJSONParsing,s=Gn(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,Gn(this,"parseReviver"))}catch(l){if(a)throw l.name==="SyntaxError"?q.from(l,q.ERR_BAD_RESPONSE,this,null,Gn(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}}};k.forEach(["delete","get","head","post","put","patch","query"],e=>{os.headers[e]={}});function po(e,t){const n=this||os,r=t||n,s=ze.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 dp(e){return!!(e&&e.__CANCEL__)}let as=class extends q{constructor(t,n,r){super(t??"canceled",q.ERR_CANCELED,n,r),this.name="CanceledError",this.__CANCEL__=!0}};function up(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new q("Request failed with status code "+n.status,n.status>=400&&n.status<500?q.ERR_BAD_REQUEST:q.ERR_BAD_RESPONSE,n.config,n.request,n))}function F_(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function U_(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(),u=r[i];o||(o=d),n[s]=l,r[s]=d;let f=i,h=0;for(;f!==s;)h+=n[f++],f=f%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),d-o<t)return;const m=u&&d-u;return m?Math.round(h*1e3/m):void 0}}function B_(e,t){let n=0,r=1e3/t,s,i;const o=(d,u=Date.now())=>{n=u,s=null,i&&(clearTimeout(i),i=null),e(...d)};return[(...d)=>{const u=Date.now(),f=u-n;f>=r?o(d,u):(s=d,i||(i=setTimeout(()=>{i=null,o(s)},r-f)))},()=>s&&o(s)]}const si=(e,t,n=3)=>{let r=0;const s=U_(50,250);return B_(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),u=s(d);r=Math.max(r,l);const f={loaded:l,total:a,progress:a?l/a:void 0,bytes:d,rate:u||void 0,estimated:u&&a?(a-l)/u:void 0,event:i,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(f)},n)},Rl=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Dl=e=>(...t)=>k.asap(()=>e(...t)),$_=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,V_=Be.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 H_(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function z_(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const W_=/^https?:(?!\/\/)/i,K_=/[\t\n\r]/g;function G_(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function q_(e){return G_(e).replace(K_,"")}function Ll(e,t){if(typeof e=="string"&&W_.test(q_(e)))throw new q('Invalid URL: missing "//" after protocol',q.ERR_INVALID_URL,t)}function fp(e,t,n,r){Ll(t,r);let s=!H_(t);return e&&(s||n===!1)?(Ll(e,r),z_(e,t)):t}const jl=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(u,f,h,m){return k.isPlainObject(u)&&k.isPlainObject(f)?k.merge.call({caseless:m},u,f):k.isPlainObject(f)?k.merge({},f):k.isArray(f)?f.slice():f}function s(u,f,h,m){if(k.isUndefined(f)){if(!k.isUndefined(u))return r(void 0,u,h,m)}else return r(u,f,h,m)}function i(u,f){if(!k.isUndefined(f))return r(void 0,f)}function o(u,f){if(k.isUndefined(f)){if(!k.isUndefined(u))return r(void 0,u)}else return r(void 0,f)}function a(u){const f=k.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!k.isUndefined(f))if(k.isPlainObject(f)){if(k.hasOwnProp(f,u))return f[u]}else return;const h=k.hasOwnProp(e,"transitional")?e.transitional:void 0;if(k.isPlainObject(h)&&k.hasOwnProp(h,u))return h[u]}function l(u,f,h){if(k.hasOwnProp(t,h))return r(u,f);if(k.hasOwnProp(e,h))return r(void 0,u)}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:(u,f,h)=>s(jl(u),jl(f),h,!0)};return k.forEach(Object.keys({...e,...t}),function(f){if(f==="__proto__"||f==="constructor"||f==="prototype")return;const h=k.hasOwnProp(d,f)?d[f]:s,m=k.hasOwnProp(e,f)?e[f]:void 0,g=k.hasOwnProp(t,f)?t[f]:void 0,p=h(m,g,f);k.isUndefined(p)&&h!==l||(n[f]=p)}),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 Z_=["content-type","content-length"];function Y_(e,t,n){if(n!=="content-only"){e.set(t);return}Object.entries(t).forEach(([r,s])=>{Z_.includes(r.toLowerCase())&&e.set(r,s)})}const Q_=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16)));function pp(e){const t=Mn({},e),n=h=>k.hasOwnProp(t,h)?t[h]: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"),u=n("allowAbsoluteUrls"),f=n("url");if(t.headers=a=ze.from(a),t.url=ap(fp(d,f,u,t),n("params"),n("paramsSerializer")),l){const h=k.getSafeProp(l,"username")||"",m=k.getSafeProp(l,"password")||"";a.set("Authorization","Basic "+btoa(h+":"+(m?Q_(m):"")))}if(k.isFormData(r)&&(Be.hasStandardBrowserEnv||Be.hasStandardBrowserWebWorkerEnv||k.isReactNative(r)?a.setContentType(void 0):k.isFunction(r.getHeaders)&&Y_(a,r.getHeaders(),n("formDataHeaderPolicy"))),Be.hasStandardBrowserEnv&&(k.isFunction(s)&&(s=s(t)),s===!0||s==null&&$_(t.url))){const m=i&&o&&V_.read(o);m&&a.set(i,m)}return t}const X_=typeof XMLHttpRequest<"u",J_=X_&&function(e){return new Promise(function(n,r){const s=pp(e);let i=s.data;const o=ze.from(s.headers).normalize();let{responseType:a,onUploadProgress:l,onDownloadProgress:d}=s,u,f,h,m,g;function p(){m&&m(),g&&g(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let y=new XMLHttpRequest;y.open(s.method.toUpperCase(),s.url,!0),y.timeout=s.timeout;function b(){if(!y)return;const x=ze.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),C={data:!a||a==="text"||a==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:x,config:e,request:y};up(function(T){n(T),p()},function(T){r(T),p()},C),y=null}"onloadend"in y?y.onloadend=b:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.startsWith("file:"))||setTimeout(b)},y.onabort=function(){y&&(r(new q("Request aborted",q.ECONNABORTED,e,y)),p(),y=null)},y.onerror=function(_){const C=_&&_.message?_.message:"Network Error",P=new q(C,q.ERR_NETWORK,e,y);P.event=_||null,r(P),p(),y=null},y.ontimeout=function(){let _=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const C=s.transitional||uc;s.timeoutErrorMessage&&(_=s.timeoutErrorMessage),r(new q(_,C.clarifyTimeoutError?q.ETIMEDOUT:q.ECONNABORTED,e,y)),p(),y=null},i===void 0&&o.setContentType(null),"setRequestHeader"in y&&k.forEach(np(o),function(_,C){y.setRequestHeader(C,_)}),k.isUndefined(s.withCredentials)||(y.withCredentials=!!s.withCredentials),a&&a!=="json"&&(y.responseType=s.responseType),d&&([h,g]=si(d,!0),y.addEventListener("progress",h)),l&&y.upload&&([f,m]=si(l),y.upload.addEventListener("progress",f),y.upload.addEventListener("loadend",m)),(s.cancelToken||s.signal)&&(u=x=>{y&&(r(!x||x.type?new as(null,e,y):x),y.abort(),p(),y=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));const v=F_(s.url);if(v&&!Be.protocols.includes(v)){r(new q("Unsupported protocol "+v+":",q.ERR_BAD_REQUEST,e));return}y.send(i||null)})},ex=(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 q?d:new as(d instanceof Error?d.message:d))}};let i=t&&setTimeout(()=>{i=null,s(new q(`timeout of ${t}ms exceeded`,q.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},tx=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},nx=async function*(e,t){for await(const n of rx(e))yield*tx(n,t)},rx=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()}},Il=(e,t,n,r)=>{const s=nx(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:u}=await s.next();if(d){a(),l.close();return}let f=u.byteLength;if(n){let h=i+=f;n(h)}l.enqueue(new Uint8Array(u))}catch(d){throw a(d),d}},cancel(l){return a(l),s.return()}},{highWaterMark:2})},ii=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,sx=(e,t,n)=>t+2<n&&ii(e.charCodeAt(t+1))&&ii(e.charCodeAt(t+2));function ix(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);ii(g)&&ii(p)&&(o-=2,m+=2)}let l=0,d=a-1;const u=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--):u(d)&&(l++,d-=3)),l===1&&d>=0&&(r.charCodeAt(d)===61||u(d))&&l++;const h=Math.floor(o/4)*3-(l||0);return h>0?h: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 pc="1.18.0",Ml=64*1024,{isFunction:Es}=k,ox=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16))),Fl=e=>{if(!k.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},Ul=(e,...t)=>{try{return!!e(...t)}catch{return!1}},ax=e=>{const t=e.indexOf("://");let n=e;return t!==-1&&(n=n.slice(t+3)),n.includes("@")||n.includes(":")},cx=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?Es(s):typeof fetch=="function",l=Es(i),d=Es(o);if(!a)return!1;const u=a&&Es(n),f=a&&(typeof r=="function"?(b=>v=>b.encode(v))(new r):async b=>new Uint8Array(await new i(b).arrayBuffer())),h=l&&u&&Ul(()=>{let b=!1;const v=new i(Be.origin,{body:new n,method:"POST",get duplex(){return b=!0,"half"}}),x=v.headers.has("Content-Type");return v.body!=null&&v.body.cancel(),b&&!x}),m=d&&u&&Ul(()=>k.isReadableStream(new o("").body)),g={stream:m&&(b=>b.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(b=>{!g[b]&&(g[b]=(v,x)=>{let _=v&&v[b];if(_)return _.call(v);throw new q(`Response type '${b}' is not supported`,q.ERR_NOT_SUPPORT,x)})});const p=async b=>{if(b==null)return 0;if(k.isBlob(b))return b.size;if(k.isSpecCompliantForm(b))return(await new i(Be.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 f(b)).byteLength},y=async(b,v)=>{const x=k.toFiniteNumber(b.getContentLength());return x??p(v)};return async b=>{let{url:v,method:x,data:_,signal:C,cancelToken:P,timeout:T,onDownloadProgress:N,onUploadProgress:R,responseType:A,headers:j,withCredentials:D="same-origin",fetchOptions:B,maxContentLength:O,maxBodyLength:H}=pp(b);const U=k.isNumber(O)&&O>-1,I=k.isNumber(H)&&H>-1,L=ee=>k.hasOwnProp(b,ee)?b[ee]:void 0;let M=s||fetch;A=A?(A+"").toLowerCase():"text";let K=ex([C,P&&P.toAbortSignal()],T),F=null;const se=K&&K.unsubscribe&&(()=>{K.unsubscribe()});let z,de=null;const ue=()=>new q("Request body larger than maxBodyLength limit",q.ERR_BAD_REQUEST,b,F);try{let ee;const Z=L("auth");if(Z){const X=k.getSafeProp(Z,"username")||"",ke=k.getSafeProp(Z,"password")||"";ee={username:X,password:ke}}if(ax(v)){const X=new URL(v,Be.origin);if(!ee&&(X.username||X.password)){const ke=Fl(X.username),Fe=Fl(X.password);ee={username:ke,password:Fe}}(X.username||X.password)&&(X.username="",X.password="",v=X.href)}if(ee&&(j.delete("authorization"),j.set("Authorization","Basic "+btoa(ox((ee.username||"")+":"+(ee.password||""))))),U&&typeof v=="string"&&v.startsWith("data:")&&ix(v)>O)throw new q("maxContentLength size of "+O+" exceeded",q.ERR_BAD_RESPONSE,b,F);if(I&&x!=="get"&&x!=="head"){const X=await p(_);if(typeof X=="number"&&isFinite(X)&&(z=X,X>H))throw ue()}const $=I&&(k.isReadableStream(_)||k.isStream(_)),ye=(X,ke,Fe)=>Il(X,Ml,Qe=>{if(I&&Qe>H)throw de=ue();ke&&ke(Qe)},Fe);if(h&&x!=="get"&&x!=="head"&&(R||$)){if(z=z??await y(j,_),z!==0||$){let X=new i(v,{method:"POST",body:_,duplex:"half"}),ke;if(k.isFormData(_)&&(ke=X.headers.get("content-type"))&&j.setContentType(ke),X.body){const[Fe,Qe]=R&&Rl(z,si(Dl(R)))||[];_=ye(X.body,Fe,Qe)}}}else if($&&!l&&u&&x!=="get"&&x!=="head")_=ye(_);else if($&&l&&!h&&x!=="get"&&x!=="head")throw new q("Stream request bodies are not supported by the current fetch implementation",q.ERR_NOT_SUPPORT,b,F);k.isString(D)||(D=D?"include":"omit");const ae=l&&"credentials"in i.prototype;if(k.isFormData(_)){const X=j.getContentType();X&&/^multipart\/form-data/i.test(X)&&!/boundary=/i.test(X)&&j.delete("content-type")}j.set("User-Agent","axios/"+pc,!1);const ie={...B,signal:K,method:x.toUpperCase(),headers:np(j.normalize()),body:_,duplex:"half",credentials:ae?D:void 0};F=l&&new i(v,ie);let te=await(l?M(F,B):M(v,ie));const je=ze.from(te.headers);if(U){const X=k.toFiniteNumber(je.getContentLength());if(X!=null&&X>O)throw new q("maxContentLength size of "+O+" exceeded",q.ERR_BAD_RESPONSE,b,F)}const Re=m&&(A==="stream"||A==="response");if(m&&te.body&&(N||U||Re&&se)){const X={};["status","statusText","headers"].forEach($e=>{X[$e]=te[$e]});const ke=k.toFiniteNumber(je.getContentLength()),[Fe,Qe]=N&&Rl(ke,si(Dl(N),!0))||[];let ct=0;const re=$e=>{if(U&&(ct=$e,ct>O))throw new q("maxContentLength size of "+O+" exceeded",q.ERR_BAD_RESPONSE,b,F);Fe&&Fe($e)};te=new o(Il(te.body,Ml,re,()=>{Qe&&Qe(),se&&se()}),X)}A=A||"text";let Ne=await g[k.findKey(g,A)||"text"](te,b);if(U&&!m&&!Re){let X;if(Ne!=null&&(typeof Ne.byteLength=="number"?X=Ne.byteLength:typeof Ne.size=="number"?X=Ne.size:typeof Ne=="string"&&(X=typeof r=="function"?new r().encode(Ne).byteLength:Ne.length)),typeof X=="number"&&X>O)throw new q("maxContentLength size of "+O+" exceeded",q.ERR_BAD_RESPONSE,b,F)}return!Re&&se&&se(),await new Promise((X,ke)=>{up(X,ke,{data:Ne,headers:ze.from(te.headers),status:te.status,statusText:te.statusText,config:b,request:F})})}catch(ee){if(se&&se(),K&&K.aborted&&K.reason instanceof q){const Z=K.reason;throw Z.config=b,F&&(Z.request=F),ee!==Z&&(Z.cause=ee),Z}throw de?(F&&!de.request&&(de.request=F),de):ee instanceof q?(F&&!ee.request&&(ee.request=F),ee):ee&&ee.name==="TypeError"&&/Load failed|fetch/i.test(ee.message)?Object.assign(new q("Network Error",q.ERR_NETWORK,b,F,ee&&ee.response),{cause:ee.cause||ee}):q.from(ee,ee&&ee.code,b,F,ee&&ee.response)}}},lx=new Map,mp=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,u=lx;for(;a--;)l=i[a],d=u.get(l),d===void 0&&u.set(l,d=a?new Map:cx(t)),u=d;return d};mp();const mc={http:x_,xhr:J_,fetch:{get:mp}};k.forEach(mc,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const Bl=e=>`- ${e}`,dx=e=>k.isFunction(e)||e===null||e===!1;function ux(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,!dx(r)&&(s=mc[(a=String(r)).toLowerCase()],s===void 0))throw new q(`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(Bl).join(`
77
- `):" "+Bl(o[0]):"as no adapter specified";throw new q("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s}const hp={getAdapter:ux,adapters:mc};function mo(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new as(null,e)}function $l(e){return mo(e),e.headers=ze.from(e.headers),e.data=po.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),hp.getAdapter(e.adapter||os.adapter,e)(e).then(function(r){mo(e),e.response=r;try{r.data=po.call(e,e.transformResponse,r)}finally{delete e.response}return r.headers=ze.from(r.headers),r},function(r){if(!dp(r)&&(mo(e),r&&r.response)){e.response=r.response;try{r.response.data=po.call(e,e.transformResponse,r.response)}finally{delete e.response}r.response.headers=ze.from(r.response.headers)}return Promise.reject(r)})}const Ui={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Ui[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Vl={};Ui.transitional=function(t,n,r){function s(i,o){return"[Axios v"+pc+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,a)=>{if(t===!1)throw new q(s(o," has been removed"+(n?" in "+n:"")),q.ERR_DEPRECATED);return n&&!Vl[o]&&(Vl[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}};Ui.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function fx(e,t,n){if(typeof e!="object")throw new q("options must be an object",q.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 q("option "+i+" must be "+l,q.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new q("Unknown option "+i,q.ERR_BAD_OPTION)}}const Bs={assertOptions:fx,validators:Ui},Ve=Bs.validators;let On=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Nl,response:new Nl}}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(`
73
+ */var vl;function Gv(){return vl||(vl=1,process.env.NODE_ENV!=="production"&&(function(){function e(d,u){return d===u&&(d!==0||1/d===1/u)||d!==d&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=S,n=Vf(),r=typeof Object.is=="function"?Object.is:e,s=n.useSyncExternalStore,i=t.useRef,o=t.useEffect,a=t.useMemo,l=t.useDebugValue;co.useSyncExternalStoreWithSelector=function(d,u,f,h,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(P){if(!v){if(v=!0,x=P,P=h(P),m!==void 0&&p.hasValue){var T=p.value;if(m(T,P))return _=T}return _=P}if(T=_,r(x,P))return T;var O=h(P);return m!==void 0&&m(T,O)?(x=P,T):(x=P,_=O)}var v=!1,x,_,C=f===void 0?null:f;return[function(){return b(u())},C===null?void 0:function(){return b(C())}]},[u,f,h,m]);var y=s(d,g[0],g[1]);return o(function(){p.hasValue=!0,p.value=y},[y]),l(y),y},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),co}var wl;function qv(){return wl||(wl=1,process.env.NODE_ENV==="production"?xs.exports=Kv():xs.exports=Gv()),xs.exports}var Zv=qv();const Yv=Hv(Zv),Hf={},{useDebugValue:Qv}=S,{useSyncExternalStoreWithSelector:Xv}=Yv;let _l=!1;const Jv=e=>e;function ew(e,t=Jv,n){(Hf?"production":void 0)!=="production"&&n&&!_l&&(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"),_l=!0);const r=Xv(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Qv(r),r}const xl=e=>{(Hf?"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"?Vv(e):e,n=(r,s)=>ew(t,r,s);return Object.assign(n,t),n},ji=e=>e?xl(e):xl,Sl={source:null,entryPrice:null,stopLoss:"",takeProfit:"",side:null,showEntryLine:!1,volumeLots:.01,digits:2,priceStep:.01},oe=ji(e=>({...Sl,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}),clearDraft:()=>e({...Sl})}));function lo(e,t){return e.toFixed(t)}function tw({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,isDragging:d,scanResultUrl:u,onDragHandlePointerDown:f,onExpandedChange:h,onExpand:m,onPlaceOrder:g}){const[p,y]=S.useState(String(r)),[b,v]=S.useState(null),[x,_]=S.useState(u),C=oe(L=>L.setOrderSide),P=oe(L=>L.setVolumeLots);u!==x&&(_(u),v(null));const T=b??!!u;S.useEffect(()=>{h()},[T,h]);const O=()=>{const L=!T;L&&m(),v(L)},D=Number(Vt(Ht(e))),j=t!==null?Ee(t,D):"—",A=n!==null?Ee(n,D):"—",B=!o&&!a&&l!==""&&(t!==null&&n!==null),R=L=>{const U=Number(p),z=Number.isFinite(U)&&U>0?U:r,M=Math.max(i,z+L*s),se=lo(M,2);y(se),P(M)},H=()=>{const L=Number(p);if(!Number.isFinite(L)||L<=0){y(lo(r,2)),P(r);return}const U=Math.max(i,L),z=lo(U,2);y(z),P(U)},F=L=>{t===null||n===null||C({side:L,entryPrice:L==="buy"?n:t})},I=L=>{if(t===null||n===null||!l)return;const U=Number(p),z=Math.max(i,Number.isFinite(U)&&U>0?U:r);C({side:L,entryPrice:L==="buy"?n:t}),g({login:l,side:L,volumeLots:z,bid:t,ask:n})};return c.jsx("div",{className:`web-trading-widget-mini-order${T?" 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:f,className:`web-trading-widget-mini-order__drag-handle${d?" web-trading-widget-mini-order__drag-handle--grabbing":""}`,children:c.jsx(jf,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2})}),T?c.jsxs(c.Fragment,{children:[c.jsxs("button",{type:"button",disabled:!B,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--sell",onMouseDown:()=>F("sell"),onClick:()=>I("sell"),children:[c.jsx("span",{className:"web-trading-widget-mini-order__price",children:j}),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:!B,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>R(-1),children:c.jsx(ei,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})}),c.jsx("input",{type:"text",inputMode:"decimal",value:p,disabled:!B,onChange:L=>y(L.target.value),onBlur:H,className:"web-trading-widget-mini-order__volume-input"}),c.jsx("button",{type:"button","aria-label":"Increase volume",disabled:!B,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>R(1),children:c.jsx(Io,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})})]}),c.jsxs("button",{type:"button",disabled:!B,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--buy",onMouseDown:()=>F("buy"),onClick:()=>I("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:A})]})]}):null,c.jsx("button",{type:"button","aria-label":T?"Collapse quick order panel":"Expand quick order panel","aria-expanded":T,className:"web-trading-widget-mini-order__toggle",onClick:O,children:T?c.jsx(Sv,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5}):c.jsx(Cv,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5})})]})})}const nw="web-trading-widget-mini-exec-panel-position",zf={x:56,y:96};function Cl(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 El(e,t){e.style.left=`${t.x}px`,e.style.top=`${t.y}px`}function rw(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):zf.x,y:16}}function sw(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 Tl(e,t){try{e.hasPointerCapture(t)&&e.releasePointerCapture(t)}catch{}}function Wf(e){const t=(e==null?void 0:e.storageKey)??nw,n=(e==null?void 0:e.defaultPosition)??zf,r=e==null?void 0:e.defaultAlign,s=(e==null?void 0:e.isActive)??!0,i=S.useRef(null),[o,a]=S.useState(n),[l,d]=S.useState(!1),u=S.useRef(n),f=S.useRef(null);S.useEffect(()=>{u.current=o},[o]);const h=S.useCallback(p=>{const y=i.current,b=Cl(p,y);u.current=b,a(b),y&&El(y,b)},[]),m=S.useCallback(()=>{h(u.current)},[h]);S.useEffect(()=>{if(!s)return;const p=sw(t);if(p){h(p);return}const y=r?rw(r,i.current):null;h(y??u.current)},[h,r,s,t]);const g=S.useCallback(p=>{p.preventDefault(),p.stopPropagation();const y=p.currentTarget,b=i.current;if(!b)return;const v=p.pointerId;y.setPointerCapture(v);const x=p.clientX,_=p.clientY,C=u.current;d(!0),document.body.style.cursor="grabbing",document.body.style.userSelect="none";const P=(D,j)=>{const A=Cl({x:C.x+(D-x),y:C.y+(j-_)},b);u.current=A,El(b,A)},T=D=>{if(D.pointerId===v){Tl(y,v),y.removeEventListener("pointermove",O),y.removeEventListener("pointerup",T),y.removeEventListener("pointercancel",T),f.current=null,d(!1),a(u.current),document.body.style.cursor="",document.body.style.userSelect="";try{window.localStorage.setItem(t,JSON.stringify(u.current))}catch{}}},O=D=>{D.pointerId===v&&(D.preventDefault(),P(D.clientX,D.clientY))};y.addEventListener("pointermove",O),y.addEventListener("pointerup",T),y.addEventListener("pointercancel",T),f.current=()=>{Tl(y,v),y.removeEventListener("pointermove",O),y.removeEventListener("pointerup",T),y.removeEventListener("pointercancel",T),document.body.style.cursor="",document.body.style.userSelect="",d(!1)}},[t]);return S.useEffect(()=>{const p=()=>{h(u.current)};return window.addEventListener("resize",p),()=>{var y;window.removeEventListener("resize",p),(y=f.current)==null||y.call(f),f.current=null,document.body.style.cursor="",document.body.style.userSelect=""}},[h]),{panelRef:i,position:o,isDragging:l,onDragStart:g,reclamp:m}}const Kf=200,iw=201,ow=203,aw=204,Gf=0,cw=2,qf=0;function Ii(e){const t=Number(e.trim());if(!Number.isFinite(t))throw new Error("Invalid trading account login.");return t}function ac(e){return Math.round(e*1e4)}function lw(e){return e>=2&&e<=7}function dw(e){return{Action:aw,Order:Number(e.orderTicket),Login:Ii(e.login),Symbol:e.symbol.replace(/m$/i,""),Type:e.orderType}}function uw(e){return{Action:ow,Order:Number(e.orderTicket),Login:Ii(e.login),Symbol:e.symbol.replace(/m$/i,""),Type:e.orderType,Volume:ac(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 fw(e){const t=e.positionSide==="buy"?1:0;return{Action:Kf,Login:Ii(e.login),Symbol:e.symbol.replace(/m$/i,""),Type:t,TypeFill:Gf,Volume:ac(e.volumeLots),Digits:e.digits,TypeTime:qf,Comment:e.comment??"",Position:Number(e.positionTicket)}}function pw(e){const t=!lw(e.orderType);return{Action:t?Kf:iw,Login:Ii(e.login),Symbol:e.symbol,Type:e.orderType,TypeFill:t?Gf:cw,Volume:ac(e.volumeLots),Digits:e.digits,TypeTime:e.typeTime??qf,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 mw(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 hw=new Set(["10009","10008"]);function Lt(e){if(e===void 0||e==="")return;const t=Number(e);return Number.isFinite(t)?t:void 0}function gw(e){const t=Lt(e);return t===void 0?.01:t/1e4}function yw(e){var t;return(t=e.find(n=>n.answer))==null?void 0:t.answer}function bw(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:Lt(((r=i.result)==null?void 0:r.Price)??((s=i.answer)==null?void 0:s.ResultPrice))}}return{retcode:""}}function Ms(e){return hw.has(e)}function Cs(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=yw(r),{retcode:i,price:o}=bw(r),a=Ms(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,u=Ye(d),f=Lt(s==null?void 0:s.Type),h=f!==void 0?f%2===0?"buy":"sell":t.side,m=Lt(s==null?void 0:s.ResultPrice)??Lt(s==null?void 0:s.PriceOrder)??o??t.openPrice,g=Lt(s==null?void 0:s.ResultMarketBid),p=Lt(s==null?void 0:s.ResultMarketAsk),y=h==="buy"?g??m:p??m,b=Nv(u);return{ticket:String(l||Math.floor(Date.now()/1e3)),login:((x=s==null?void 0:s.Login)==null?void 0:x.trim())||t.login,symbol:u,displaySymbol:Ni(u),side:h,volumeLots:gw(s==null?void 0:s.Volume)||t.volumeLots,openPrice:m,currentPrice:y,stopLoss:Lt(s==null?void 0:s.PriceSL),takeProfit:Lt(s==null?void 0:s.PriceTP),comment:((_=s==null?void 0:s.Comment)==null?void 0:_.trim())||t.comment,digits:Math.round(b),retcode:i,isSuccess:a,marketBid:g,marketAsk:p}}function vw(e){return e.type==="buy"?e.marketBid??e.currentPrice:e.marketAsk??e.currentPrice}function ww(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=Di(n.symbolTicker,t),o=Number(Vt(Ht(n.symbolTicker,t))),a=Ri(n.executionMode),l=rc(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&&!Li(d,n.expirationDateTime??"",n.expirationDay??""))return{success:!1,message:"Please set an expiration date for this order."};const u=a?n.side==="buy"?n.ask:n.bid:n.priceOrder??(n.side==="buy"?n.ask:n.bid),f=a?void 0:$f(d,n.expirationDateTime??"",n.expirationDay??"");try{const h=pw({login:r,symbol:i,volumeLots:s,orderType:n.orderType,digits:o,comment:n.comment.trim(),priceOrder:nc(n.orderType)?n.priceOrder:void 0,priceTrigger:l?n.priceTrigger:void 0,priceSL:n.stopLoss,priceTP:n.takeProfit,typeTime:a?void 0:d,timeExpiration:f}),m=await e.sendRequest(h),g=Cs(m,{login:r,symbol:i,side:ni(n.orderType),volumeLots:s,openPrice:u,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(h){return{success:!1,message:h instanceof Error?h.message:"Failed to place order."}}},async closePosition(n){try{const r=vw(n),s=fw({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=Cs(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&&!Ms(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=dw({login:n.login,orderTicket:n.ticket,symbol:n.symbol,orderType:n.orderType}),s=await e.sendRequest(r),i=Cs(s,{login:n.login,symbol:n.symbol,side:n.side,volumeLots:n.volumeLots,openPrice:n.orderPrice,digits:n.digits,comment:n.comment});return i&&!Ms(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=uw({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=Cs(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&&!Ms(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 Zf(e,t){return function(){return e.apply(t,arguments)}}const{toString:_w}=Object.prototype,{getPrototypeOf:yr}=Object,{iterator:ss,toStringTag:Yf}=Symbol,ri=(({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),ri(n,t))return!0;n=yr(n)}return!1},xw=(e,t)=>e!=null&&Wr(e,t)?e[t]:void 0,cc=(e=>t=>{const n=_w.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),vt=e=>(e=e.toLowerCase(),t=>cc(t)===e),Mi=e=>t=>typeof t===e,{isArray:In}=Array,br=Mi("undefined");function kr(e){return e!==null&&!br(e)&&e.constructor!==null&&!br(e.constructor)&&Ze(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Qf=vt("ArrayBuffer");function Sw(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Qf(e.buffer),t}const Cw=Mi("string"),Ze=Mi("function"),Xf=Mi("number"),Ar=e=>e!==null&&typeof e=="object",Ew=e=>e===!0||e===!1,Fs=e=>{if(!Ar(e))return!1;const t=yr(e);return(t===null||t===Object.prototype||yr(t)===null)&&!Wr(e,Yf)&&!Wr(e,ss)},Tw=e=>{if(!Ar(e)||kr(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Pw=vt("Date"),kw=vt("File"),Aw=e=>!!(e&&typeof e.uri<"u"),Nw=e=>e&&typeof e.getParts<"u",Ow=vt("Blob"),Rw=vt("FileList"),Dw=e=>Ar(e)&&Ze(e.pipe);function Lw(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const Pl=Lw(),kl=typeof Pl.FormData<"u"?Pl.FormData:void 0,jw=e=>{if(!e)return!1;if(kl&&e instanceof kl)return!0;const t=yr(e);if(!t||t===Object.prototype||!Ze(e.append))return!1;const n=cc(e);return n==="formdata"||n==="object"&&Ze(e.toString)&&e.toString()==="[object FormData]"},Iw=vt("URLSearchParams"),[Mw,Fw,Uw,Bw]=["ReadableStream","Request","Response","Headers"].map(vt),$w=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(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 Jf(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,ep=e=>!br(e)&&e!==vn;function Fo(...e){const{caseless:t,skipUndefined:n}=ep(this)&&this||{},r={},s=(i,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const a=t&&typeof o=="string"&&Jf(r,o)||o,l=ri(r,a)?r[a]:void 0;Fs(l)&&Fs(i)?r[a]=Fo(l,i):Fs(i)?r[a]=Fo({},i):In(i)?r[a]=i.slice():(!n||!br(i))&&(r[a]=i)};for(let i=0,o=e.length;i<o;i++){const a=e[i];if(!a||kr(a)||(is(a,s),typeof a!="object"||In(a)))continue;const l=Object.getOwnPropertySymbols(a);for(let d=0;d<l.length;d++){const u=l[d];Jw.call(a,u)&&s(a[u],u)}}return r}const Vw=(e,t,n,{allOwnKeys:r}={})=>(is(t,(s,i)=>{n&&Ze(s)?Object.defineProperty(e,i,{__proto__:null,value:Zf(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),Hw=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),zw=(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)},Ww=(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&&yr(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},Kw=(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},Gw=e=>{if(!e)return null;if(In(e))return e;let t=e.length;if(!Xf(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},qw=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&yr(Uint8Array)),Zw=(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])}},Yw=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},Qw=vt("HTMLFormElement"),Xw=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),{propertyIsEnumerable:Jw}=Object.prototype,e_=vt("RegExp"),tp=(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)},t_=e=>{tp(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+"'")})}})},n_=(e,t)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return In(e)?r(e):r(String(e).split(t)),n},r_=()=>{},s_=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function i_(e){return!!(e&&Ze(e.append)&&e[Yf]==="FormData"&&e[ss])}const o_=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 is(r,(i,o)=>{const a=n(i);!br(a)&&(s[o]=a)}),t.delete(r),s}}return r};return n(e)},a_=vt("AsyncFunction"),c_=e=>e&&(Ar(e)||Ze(e))&&Ze(e.then)&&Ze(e.catch),np=((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)),l_=typeof queueMicrotask<"u"?queueMicrotask.bind(vn):typeof process<"u"&&process.nextTick||np,rp=e=>e!=null&&Ze(e[ss]),d_=e=>e!=null&&Wr(e,ss)&&rp(e),k={isArray:In,isArrayBuffer:Qf,isBuffer:kr,isFormData:jw,isArrayBufferView:Sw,isString:Cw,isNumber:Xf,isBoolean:Ew,isObject:Ar,isPlainObject:Fs,isEmptyObject:Tw,isReadableStream:Mw,isRequest:Fw,isResponse:Uw,isHeaders:Bw,isUndefined:br,isDate:Pw,isFile:kw,isReactNativeBlob:Aw,isReactNative:Nw,isBlob:Ow,isRegExp:e_,isFunction:Ze,isStream:Dw,isURLSearchParams:Iw,isTypedArray:qw,isFileList:Rw,forEach:is,merge:Fo,extend:Vw,trim:$w,stripBOM:Hw,inherits:zw,toFlatObject:Ww,kindOf:cc,kindOfTest:vt,endsWith:Kw,toArray:Gw,forEachEntry:Zw,matchAll:Yw,isHTMLForm:Qw,hasOwnProperty:ri,hasOwnProp:ri,hasOwnInPrototypeChain:Wr,getSafeProp:xw,reduceDescriptors:tp,freezeMethods:t_,toObjectSet:n_,toCamelCase:Xw,noop:r_,toFiniteNumber:s_,findKey:Jf,global:vn,isContextDefined:ep,isSpecCompliantForm:i_,toJSONObject:o_,isAsyncFn:a_,isThenable:c_,setImmediate:np,asap:l_,isIterable:rp,isSafeIterable:d_},u_=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"]),f_=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]&&u_[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t};function p_(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 m_=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),h_=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function lc(e,t){return k.isArray(e)?e.map(n=>lc(n,t)):p_(String(e).replace(t,""))}const g_=e=>lc(e,m_),y_=e=>lc(e,h_);function sp(e){const t=Object.create(null);return k.forEach(e.toJSON(),(n,r)=>{t[r]=y_(n)}),t}const Al=Symbol("internals");function Lr(e){return e&&String(e).trim().toLowerCase()}function Us(e){return e===!1||e==null?e:k.isArray(e)?e.map(Us):g_(String(e))}function b_(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 v_=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function uo(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 w_(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function __(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 ze=class{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function i(a,l,d){const u=Lr(l);if(!u)return;const f=k.findKey(s,u);(!f||s[f]===void 0||d===!0||d===void 0&&s[f]!==!1)&&(s[f||l]=Us(a))}const o=(a,l)=>k.forEach(a,(d,u)=>i(d,u,l));if(k.isPlainObject(t)||t instanceof this.constructor)o(t,n);else if(k.isString(t)&&(t=t.trim())&&!v_(t))o(f_(t),n);else if(k.isObject(t)&&k.isSafeIterable(t)){let a=Object.create(null),l,d;for(const u of t){if(!k.isArray(u))throw new TypeError("Object iterator must return a key-value pair");d=u[0],k.hasOwnProp(a,d)?(l=a[d],a[d]=k.isArray(l)?[...l,u[1]]:[l,u[1]]):a[d]=u[1]}o(a,n)}else t!=null&&i(n,t,r);return this}get(t,n){if(t=Lr(t),t){const r=k.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return b_(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=Lr(t),t){const r=k.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||uo(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function i(o){if(o=Lr(o),o){const a=k.findKey(r,o);a&&(!n||uo(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||uo(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]=Us(s),delete n[i];return}const a=t?w_(i):String(i).trim();a!==i&&delete n[i],n[a]=Us(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[Al]=this[Al]={accessors:{}}).accessors,s=this.prototype;function i(o){const a=Lr(o);r[a]||(__(s,o),r[a]=!0)}return k.isArray(t)?t.forEach(i):i(t),this}};ze.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);k.reduceDescriptors(ze.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});k.freezeMethods(ze);const x_="[REDACTED ****]";function S_(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 C_(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 ze&&(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)&&S_(i))return r.pop(),i;o=Object.create(null);for(const[a,l]of Object.entries(i)){const d=n.has(a.toLowerCase())?x_:s(l);k.isUndefined(d)||(o[a]=d)}}return r.pop(),o};return s(e)}let q=class ip extends Error{static from(t,n,r,s,i,o){const a=new ip(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?C_(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}}};q.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";q.ERR_BAD_OPTION="ERR_BAD_OPTION";q.ECONNABORTED="ECONNABORTED";q.ETIMEDOUT="ETIMEDOUT";q.ECONNREFUSED="ECONNREFUSED";q.ERR_NETWORK="ERR_NETWORK";q.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";q.ERR_DEPRECATED="ERR_DEPRECATED";q.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";q.ERR_BAD_REQUEST="ERR_BAD_REQUEST";q.ERR_CANCELED="ERR_CANCELED";q.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";q.ERR_INVALID_URL="ERR_INVALID_URL";q.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const E_=null,op=100;function Uo(e){return k.isPlainObject(e)||k.isArray(e)}function ap(e){return k.endsWith(e,"[]")?e.slice(0,-2):e}function fo(e,t,n){return e?e.concat(t).map(function(s,i){return s=ap(s),!n&&i?"["+s+"]":s}).join(n?".":""):t}function T_(e){return k.isArray(e)&&!e.some(Uo)}const P_=k.toFlatObject(k,{},null,function(t){return/^is[A-Z]/.test(t)});function Fi(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,x){return!k.isUndefined(x[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?op:n.maxDepth,d=a&&k.isSpecCompliantForm(t),u=[];if(!k.isFunction(s))throw new TypeError("visitor must be a function");function f(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 q("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 h(b){if(b>l)throw new q("Object is too deeply nested ("+b+" levels). Max depth: "+l,q.ERR_FORM_DATA_DEPTH_EXCEEDED)}function m(b,v){if(l===1/0)return JSON.stringify(b);const x=[];return JSON.stringify(b,function(C,P){if(!k.isObject(P))return P;for(;x.length&&x[x.length-1]!==this;)x.pop();return x.push(P),h(v+x.length-1),P})}function g(b,v,x){let _=b;if(k.isReactNative(t)&&k.isReactNativeBlob(b))return t.append(fo(x,v,i),f(b)),!1;if(b&&!x&&typeof b=="object"){if(k.endsWith(v,"{}"))v=r?v:v.slice(0,-2),b=m(b,1);else if(k.isArray(b)&&T_(b)||(k.isFileList(b)||k.endsWith(v,"[]"))&&(_=k.toArray(b)))return v=ap(v),_.forEach(function(P,T){!(k.isUndefined(P)||P===null)&&t.append(o===!0?fo([v],T,i):o===null?v:v+"[]",f(P))}),!1}return Uo(b)?!0:(t.append(fo(x,v,i),f(b)),!1)}const p=Object.assign(P_,{defaultVisitor:g,convertValue:f,isVisitable:Uo});function y(b,v,x=0){if(!k.isUndefined(b)){if(h(x),u.indexOf(b)!==-1)throw new Error("Circular reference detected in "+v.join("."));u.push(b),k.forEach(b,function(C,P){(!(k.isUndefined(C)||C===null)&&s.call(t,C,k.isString(P)?P.trim():P,v,p))===!0&&y(C,v?v.concat(P):[P],x+1)}),u.pop()}}if(!k.isObject(e))throw new TypeError("data must be an object");return y(e),t}function Nl(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(r){return t[r]})}function dc(e,t){this._pairs=[],e&&Fi(e,this,t)}const cp=dc.prototype;cp.append=function(t,n){this._pairs.push([t,n])};cp.toString=function(t){const n=t?function(r){return t.call(this,r,Nl)}:Nl;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function k_(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function lp(e,t,n){if(!t)return e;const r=k.isFunction(n)?{serialize:n}:n,s=k.getSafeProp(r,"encode")||k_,i=k.getSafeProp(r,"serialize");let o;if(i?o=i(t,r):o=k.isURLSearchParams(t)?t.toString():new dc(t,r).toString(s),o){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class Ol{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 uc={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},A_=typeof URLSearchParams<"u"?URLSearchParams:dc,N_=typeof FormData<"u"?FormData:null,O_=typeof Blob<"u"?Blob:null,R_={isBrowser:!0,classes:{URLSearchParams:A_,FormData:N_,Blob:O_},protocols:["http","https","file","blob","url","data"]},fc=typeof window<"u"&&typeof document<"u",Bo=typeof navigator=="object"&&navigator||void 0,D_=fc&&(!Bo||["ReactNative","NativeScript","NS"].indexOf(Bo.product)<0),L_=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",j_=fc&&window.location.href||"http://localhost",I_=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:fc,hasStandardBrowserEnv:D_,hasStandardBrowserWebWorkerEnv:L_,navigator:Bo,origin:j_},Symbol.toStringTag,{value:"Module"})),Be={...I_,...R_};function M_(e,t){return Fi(e,new Be.classes.URLSearchParams,{visitor:function(n,r,s,i){return Be.isNode&&k.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}const Rl=op;function dp(e){if(e>Rl)throw new q("FormData field is too deeply nested ("+e+" levels). Max depth: "+Rl,q.ERR_FORM_DATA_DEPTH_EXCEEDED)}function F_(e){const t=[],n=/\w+|\[(\w*)]/g;let r;for(;(r=n.exec(e))!==null;)dp(t.length),t.push(r[0]==="[]"?"":r[1]||r[0]);return t}function U_(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 up(e){function t(n,r,s,i){dp(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]=U_(s[o])),!a)}if(k.isFormData(e)&&k.isFunction(e.entries)){const n={};return k.forEachEntry(e,(r,s)=>{t(F_(r),s,n,0)}),n}return null}const Gn=(e,t)=>e!=null&&k.hasOwnProp(e,t)?e[t]:void 0;function B_(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 os={transitional:uc,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(up(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=Gn(this,"formSerializer");if(r.indexOf("application/x-www-form-urlencoded")>-1)return M_(t,l).toString();if((a=k.isFileList(t))||r.indexOf("multipart/form-data")>-1){const d=Gn(this,"env"),u=d&&d.FormData;return Fi(a?{"files[]":t}:t,u&&new u,l)}}return i||s?(n.setContentType("application/json",!1),B_(t)):t}],transformResponse:[function(t){const n=Gn(this,"transitional")||os.transitional,r=n&&n.forcedJSONParsing,s=Gn(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,Gn(this,"parseReviver"))}catch(l){if(a)throw l.name==="SyntaxError"?q.from(l,q.ERR_BAD_RESPONSE,this,null,Gn(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}}};k.forEach(["delete","get","head","post","put","patch","query"],e=>{os.headers[e]={}});function po(e,t){const n=this||os,r=t||n,s=ze.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 fp(e){return!!(e&&e.__CANCEL__)}let as=class extends q{constructor(t,n,r){super(t??"canceled",q.ERR_CANCELED,n,r),this.name="CanceledError",this.__CANCEL__=!0}};function pp(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new q("Request failed with status code "+n.status,n.status>=400&&n.status<500?q.ERR_BAD_REQUEST:q.ERR_BAD_RESPONSE,n.config,n.request,n))}function $_(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function V_(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(),u=r[i];o||(o=d),n[s]=l,r[s]=d;let f=i,h=0;for(;f!==s;)h+=n[f++],f=f%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),d-o<t)return;const m=u&&d-u;return m?Math.round(h*1e3/m):void 0}}function H_(e,t){let n=0,r=1e3/t,s,i;const o=(d,u=Date.now())=>{n=u,s=null,i&&(clearTimeout(i),i=null),e(...d)};return[(...d)=>{const u=Date.now(),f=u-n;f>=r?o(d,u):(s=d,i||(i=setTimeout(()=>{i=null,o(s)},r-f)))},()=>s&&o(s)]}const si=(e,t,n=3)=>{let r=0;const s=V_(50,250);return H_(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),u=s(d);r=Math.max(r,l);const f={loaded:l,total:a,progress:a?l/a:void 0,bytes:d,rate:u||void 0,estimated:u&&a?(a-l)/u:void 0,event:i,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(f)},n)},Dl=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Ll=e=>(...t)=>k.asap(()=>e(...t)),z_=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,W_=Be.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 K_(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function G_(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const q_=/^https?:(?!\/\/)/i,Z_=/[\t\n\r]/g;function Y_(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function Q_(e){return Y_(e).replace(Z_,"")}function jl(e,t){if(typeof e=="string"&&q_.test(Q_(e)))throw new q('Invalid URL: missing "//" after protocol',q.ERR_INVALID_URL,t)}function mp(e,t,n,r){jl(t,r);let s=!K_(t);return e&&(s||n===!1)?(jl(e,r),G_(e,t)):t}const Il=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(u,f,h,m){return k.isPlainObject(u)&&k.isPlainObject(f)?k.merge.call({caseless:m},u,f):k.isPlainObject(f)?k.merge({},f):k.isArray(f)?f.slice():f}function s(u,f,h,m){if(k.isUndefined(f)){if(!k.isUndefined(u))return r(void 0,u,h,m)}else return r(u,f,h,m)}function i(u,f){if(!k.isUndefined(f))return r(void 0,f)}function o(u,f){if(k.isUndefined(f)){if(!k.isUndefined(u))return r(void 0,u)}else return r(void 0,f)}function a(u){const f=k.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!k.isUndefined(f))if(k.isPlainObject(f)){if(k.hasOwnProp(f,u))return f[u]}else return;const h=k.hasOwnProp(e,"transitional")?e.transitional:void 0;if(k.isPlainObject(h)&&k.hasOwnProp(h,u))return h[u]}function l(u,f,h){if(k.hasOwnProp(t,h))return r(u,f);if(k.hasOwnProp(e,h))return r(void 0,u)}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:(u,f,h)=>s(Il(u),Il(f),h,!0)};return k.forEach(Object.keys({...e,...t}),function(f){if(f==="__proto__"||f==="constructor"||f==="prototype")return;const h=k.hasOwnProp(d,f)?d[f]:s,m=k.hasOwnProp(e,f)?e[f]:void 0,g=k.hasOwnProp(t,f)?t[f]:void 0,p=h(m,g,f);k.isUndefined(p)&&h!==l||(n[f]=p)}),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 X_=["content-type","content-length"];function J_(e,t,n){if(n!=="content-only"){e.set(t);return}Object.entries(t).forEach(([r,s])=>{X_.includes(r.toLowerCase())&&e.set(r,s)})}const ex=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16)));function hp(e){const t=Mn({},e),n=h=>k.hasOwnProp(t,h)?t[h]: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"),u=n("allowAbsoluteUrls"),f=n("url");if(t.headers=a=ze.from(a),t.url=lp(mp(d,f,u,t),n("params"),n("paramsSerializer")),l){const h=k.getSafeProp(l,"username")||"",m=k.getSafeProp(l,"password")||"";a.set("Authorization","Basic "+btoa(h+":"+(m?ex(m):"")))}if(k.isFormData(r)&&(Be.hasStandardBrowserEnv||Be.hasStandardBrowserWebWorkerEnv||k.isReactNative(r)?a.setContentType(void 0):k.isFunction(r.getHeaders)&&J_(a,r.getHeaders(),n("formDataHeaderPolicy"))),Be.hasStandardBrowserEnv&&(k.isFunction(s)&&(s=s(t)),s===!0||s==null&&z_(t.url))){const m=i&&o&&W_.read(o);m&&a.set(i,m)}return t}const tx=typeof XMLHttpRequest<"u",nx=tx&&function(e){return new Promise(function(n,r){const s=hp(e);let i=s.data;const o=ze.from(s.headers).normalize();let{responseType:a,onUploadProgress:l,onDownloadProgress:d}=s,u,f,h,m,g;function p(){m&&m(),g&&g(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let y=new XMLHttpRequest;y.open(s.method.toUpperCase(),s.url,!0),y.timeout=s.timeout;function b(){if(!y)return;const x=ze.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),C={data:!a||a==="text"||a==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:x,config:e,request:y};pp(function(T){n(T),p()},function(T){r(T),p()},C),y=null}"onloadend"in y?y.onloadend=b:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.startsWith("file:"))||setTimeout(b)},y.onabort=function(){y&&(r(new q("Request aborted",q.ECONNABORTED,e,y)),p(),y=null)},y.onerror=function(_){const C=_&&_.message?_.message:"Network Error",P=new q(C,q.ERR_NETWORK,e,y);P.event=_||null,r(P),p(),y=null},y.ontimeout=function(){let _=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const C=s.transitional||uc;s.timeoutErrorMessage&&(_=s.timeoutErrorMessage),r(new q(_,C.clarifyTimeoutError?q.ETIMEDOUT:q.ECONNABORTED,e,y)),p(),y=null},i===void 0&&o.setContentType(null),"setRequestHeader"in y&&k.forEach(sp(o),function(_,C){y.setRequestHeader(C,_)}),k.isUndefined(s.withCredentials)||(y.withCredentials=!!s.withCredentials),a&&a!=="json"&&(y.responseType=s.responseType),d&&([h,g]=si(d,!0),y.addEventListener("progress",h)),l&&y.upload&&([f,m]=si(l),y.upload.addEventListener("progress",f),y.upload.addEventListener("loadend",m)),(s.cancelToken||s.signal)&&(u=x=>{y&&(r(!x||x.type?new as(null,e,y):x),y.abort(),p(),y=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));const v=$_(s.url);if(v&&!Be.protocols.includes(v)){r(new q("Unsupported protocol "+v+":",q.ERR_BAD_REQUEST,e));return}y.send(i||null)})},rx=(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 q?d:new as(d instanceof Error?d.message:d))}};let i=t&&setTimeout(()=>{i=null,s(new q(`timeout of ${t}ms exceeded`,q.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},sx=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},ix=async function*(e,t){for await(const n of ox(e))yield*sx(n,t)},ox=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()}},Ml=(e,t,n,r)=>{const s=ix(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:u}=await s.next();if(d){a(),l.close();return}let f=u.byteLength;if(n){let h=i+=f;n(h)}l.enqueue(new Uint8Array(u))}catch(d){throw a(d),d}},cancel(l){return a(l),s.return()}},{highWaterMark:2})},ii=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,ax=(e,t,n)=>t+2<n&&ii(e.charCodeAt(t+1))&&ii(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 m=0;m<a;m++)if(r.charCodeAt(m)===37&&m+2<a){const g=r.charCodeAt(m+1),p=r.charCodeAt(m+2);ii(g)&&ii(p)&&(o-=2,m+=2)}let l=0,d=a-1;const u=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--):u(d)&&(l++,d-=3)),l===1&&d>=0&&(r.charCodeAt(d)===61||u(d))&&l++;const h=Math.floor(o/4)*3-(l||0);return h>0?h:0}let i=0;for(let o=0,a=r.length;o<a;o++){const l=r.charCodeAt(o);if(l===37&&ax(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 pc="1.18.0",Fl=64*1024,{isFunction:Es}=k,lx=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16))),Ul=e=>{if(!k.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},Bl=(e,...t)=>{try{return!!e(...t)}catch{return!1}},dx=e=>{const t=e.indexOf("://");let n=e;return t!==-1&&(n=n.slice(t+3)),n.includes("@")||n.includes(":")},ux=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?Es(s):typeof fetch=="function",l=Es(i),d=Es(o);if(!a)return!1;const u=a&&Es(n),f=a&&(typeof r=="function"?(b=>v=>b.encode(v))(new r):async b=>new Uint8Array(await new i(b).arrayBuffer())),h=l&&u&&Bl(()=>{let b=!1;const v=new i(Be.origin,{body:new n,method:"POST",get duplex(){return b=!0,"half"}}),x=v.headers.has("Content-Type");return v.body!=null&&v.body.cancel(),b&&!x}),m=d&&u&&Bl(()=>k.isReadableStream(new o("").body)),g={stream:m&&(b=>b.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(b=>{!g[b]&&(g[b]=(v,x)=>{let _=v&&v[b];if(_)return _.call(v);throw new q(`Response type '${b}' is not supported`,q.ERR_NOT_SUPPORT,x)})});const p=async b=>{if(b==null)return 0;if(k.isBlob(b))return b.size;if(k.isSpecCompliantForm(b))return(await new i(Be.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 f(b)).byteLength},y=async(b,v)=>{const x=k.toFiniteNumber(b.getContentLength());return x??p(v)};return async b=>{let{url:v,method:x,data:_,signal:C,cancelToken:P,timeout:T,onDownloadProgress:O,onUploadProgress:D,responseType:j,headers:A,withCredentials:N="same-origin",fetchOptions:B,maxContentLength:R,maxBodyLength:H}=hp(b);const F=k.isNumber(R)&&R>-1,I=k.isNumber(H)&&H>-1,L=ee=>k.hasOwnProp(b,ee)?b[ee]:void 0;let U=s||fetch;j=j?(j+"").toLowerCase():"text";let z=rx([C,P&&P.toAbortSignal()],T),M=null;const se=z&&z.unsubscribe&&(()=>{z.unsubscribe()});let W,de=null;const ue=()=>new q("Request body larger than maxBodyLength limit",q.ERR_BAD_REQUEST,b,M);try{let ee;const Z=L("auth");if(Z){const X=k.getSafeProp(Z,"username")||"",ke=k.getSafeProp(Z,"password")||"";ee={username:X,password:ke}}if(dx(v)){const X=new URL(v,Be.origin);if(!ee&&(X.username||X.password)){const ke=Ul(X.username),Fe=Ul(X.password);ee={username:ke,password:Fe}}(X.username||X.password)&&(X.username="",X.password="",v=X.href)}if(ee&&(A.delete("authorization"),A.set("Authorization","Basic "+btoa(lx((ee.username||"")+":"+(ee.password||""))))),F&&typeof v=="string"&&v.startsWith("data:")&&cx(v)>R)throw new q("maxContentLength size of "+R+" exceeded",q.ERR_BAD_RESPONSE,b,M);if(I&&x!=="get"&&x!=="head"){const X=await p(_);if(typeof X=="number"&&isFinite(X)&&(W=X,X>H))throw ue()}const $=I&&(k.isReadableStream(_)||k.isStream(_)),ye=(X,ke,Fe)=>Ml(X,Fl,Qe=>{if(I&&Qe>H)throw de=ue();ke&&ke(Qe)},Fe);if(h&&x!=="get"&&x!=="head"&&(D||$)){if(W=W??await y(A,_),W!==0||$){let X=new i(v,{method:"POST",body:_,duplex:"half"}),ke;if(k.isFormData(_)&&(ke=X.headers.get("content-type"))&&A.setContentType(ke),X.body){const[Fe,Qe]=D&&Dl(W,si(Ll(D)))||[];_=ye(X.body,Fe,Qe)}}}else if($&&!l&&u&&x!=="get"&&x!=="head")_=ye(_);else if($&&l&&!h&&x!=="get"&&x!=="head")throw new q("Stream request bodies are not supported by the current fetch implementation",q.ERR_NOT_SUPPORT,b,M);k.isString(N)||(N=N?"include":"omit");const ae=l&&"credentials"in i.prototype;if(k.isFormData(_)){const X=A.getContentType();X&&/^multipart\/form-data/i.test(X)&&!/boundary=/i.test(X)&&A.delete("content-type")}A.set("User-Agent","axios/"+pc,!1);const ie={...B,signal:z,method:x.toUpperCase(),headers:sp(A.normalize()),body:_,duplex:"half",credentials:ae?N:void 0};M=l&&new i(v,ie);let te=await(l?U(M,B):U(v,ie));const je=ze.from(te.headers);if(F){const X=k.toFiniteNumber(je.getContentLength());if(X!=null&&X>R)throw new q("maxContentLength size of "+R+" exceeded",q.ERR_BAD_RESPONSE,b,M)}const Re=m&&(j==="stream"||j==="response");if(m&&te.body&&(O||F||Re&&se)){const X={};["status","statusText","headers"].forEach($e=>{X[$e]=te[$e]});const ke=k.toFiniteNumber(je.getContentLength()),[Fe,Qe]=O&&Dl(ke,si(Ll(O),!0))||[];let ct=0;const re=$e=>{if(F&&(ct=$e,ct>R))throw new q("maxContentLength size of "+R+" exceeded",q.ERR_BAD_RESPONSE,b,M);Fe&&Fe($e)};te=new o(Ml(te.body,Fl,re,()=>{Qe&&Qe(),se&&se()}),X)}j=j||"text";let Ne=await g[k.findKey(g,j)||"text"](te,b);if(F&&!m&&!Re){let X;if(Ne!=null&&(typeof Ne.byteLength=="number"?X=Ne.byteLength:typeof Ne.size=="number"?X=Ne.size:typeof Ne=="string"&&(X=typeof r=="function"?new r().encode(Ne).byteLength:Ne.length)),typeof X=="number"&&X>R)throw new q("maxContentLength size of "+R+" exceeded",q.ERR_BAD_RESPONSE,b,M)}return!Re&&se&&se(),await new Promise((X,ke)=>{pp(X,ke,{data:Ne,headers:ze.from(te.headers),status:te.status,statusText:te.statusText,config:b,request:M})})}catch(ee){if(se&&se(),z&&z.aborted&&z.reason instanceof q){const Z=z.reason;throw Z.config=b,M&&(Z.request=M),ee!==Z&&(Z.cause=ee),Z}throw de?(M&&!de.request&&(de.request=M),de):ee instanceof q?(M&&!ee.request&&(ee.request=M),ee):ee&&ee.name==="TypeError"&&/Load failed|fetch/i.test(ee.message)?Object.assign(new q("Network Error",q.ERR_NETWORK,b,M,ee&&ee.response),{cause:ee.cause||ee}):q.from(ee,ee&&ee.code,b,M,ee&&ee.response)}}},fx=new Map,gp=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,u=fx;for(;a--;)l=i[a],d=u.get(l),d===void 0&&u.set(l,d=a?new Map:ux(t)),u=d;return d};gp();const mc={http:E_,xhr:nx,fetch:{get:gp}};k.forEach(mc,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const $l=e=>`- ${e}`,px=e=>k.isFunction(e)||e===null||e===!1;function mx(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,!px(r)&&(s=mc[(a=String(r)).toLowerCase()],s===void 0))throw new q(`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($l).join(`
77
+ `):" "+$l(o[0]):"as no adapter specified";throw new q("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s}const yp={getAdapter:mx,adapters:mc};function mo(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new as(null,e)}function Vl(e){return mo(e),e.headers=ze.from(e.headers),e.data=po.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),yp.getAdapter(e.adapter||os.adapter,e)(e).then(function(r){mo(e),e.response=r;try{r.data=po.call(e,e.transformResponse,r)}finally{delete e.response}return r.headers=ze.from(r.headers),r},function(r){if(!fp(r)&&(mo(e),r&&r.response)){e.response=r.response;try{r.response.data=po.call(e,e.transformResponse,r.response)}finally{delete e.response}r.response.headers=ze.from(r.response.headers)}return Promise.reject(r)})}const Ui={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Ui[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Hl={};Ui.transitional=function(t,n,r){function s(i,o){return"[Axios v"+pc+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,a)=>{if(t===!1)throw new q(s(o," has been removed"+(n?" in "+n:"")),q.ERR_DEPRECATED);return n&&!Hl[o]&&(Hl[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}};Ui.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function hx(e,t,n){if(typeof e!="object")throw new q("options must be an object",q.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 q("option "+i+" must be "+l,q.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new q("Unknown option "+i,q.ERR_BAD_OPTION)}}const Bs={assertOptions:hx,validators:Ui},Ve=Bs.validators;let On=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Ol,response:new Ol}}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&&Bs.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&&(k.isFunction(s)?n.paramsSerializer={serialize:s}:Bs.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),Bs.assertOptions(n,{baseUrl:Ve.spelling("baseURL"),withXsrfToken:Ve.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"],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 y=n.transitional||uc;y&&y.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 u,f=0,h;if(!l){const g=[$l.bind(this),void 0];for(g.unshift(...a),g.push(...d),h=g.length,u=Promise.resolve(n);f<h;)u=u.then(g[f++],g[f++]);return u}h=a.length;let m=n;for(;f<h;){const g=a[f++],p=a[f++];try{m=g(m)}catch(y){p.call(this,y);break}}try{u=$l.call(this,m)}catch(g){return Promise.reject(g)}for(f=0,h=d.length;f<h;)u=u.then(d[f++],d[f++]);return u}getUri(t){t=Mn(this.defaults,t);const n=fp(t.baseURL,t.url,t.allowAbsoluteUrls,t);return ap(n,t.params,t.paramsSerializer)}};k.forEach(["delete","get","head","options"],function(t){On.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}))}}On.prototype[t]=n(),t!=="query"&&(On.prototype[t+"Form"]=n(!0))});let px=class gp{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 gp(function(s){t=s}),cancel:t}}};function mx(e){return function(n){return e.apply(null,n)}}function hx(e){return k.isObject(e)&&e.isAxiosError===!0}const $o={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($o).forEach(([e,t])=>{$o[t]=e});function yp(e){const t=new On(e),n=Gf(On.prototype.request,t);return k.extend(n,On.prototype,t,{allOwnKeys:!0}),k.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return yp(Mn(e,s))},n}const Ae=yp(os);Ae.Axios=On;Ae.CanceledError=as;Ae.CancelToken=px;Ae.isCancel=dp;Ae.VERSION=pc;Ae.toFormData=Fi;Ae.AxiosError=q;Ae.Cancel=Ae.CanceledError;Ae.all=function(t){return Promise.all(t)};Ae.spread=mx;Ae.isAxiosError=hx;Ae.mergeConfig=Mn;Ae.AxiosHeaders=ze;Ae.formToJSON=e=>lp(k.isHTMLForm(e)?new FormData(e):e);Ae.getAdapter=hp.getAdapter;Ae.HttpStatusCode=$o;Ae.default=Ae;const{Axios:oT,AxiosError:aT,CanceledError:cT,isCancel:lT,CancelToken:dT,VERSION:uT,all:fT,Cancel:pT,isAxiosError:bp,spread:mT,toFormData:hT,AxiosHeaders:gT,HttpStatusCode:yT,formToJSON:bT,getAdapter:vT,mergeConfig:wT,create:_T}=Ae,gx="Bearer ",vp="web-trading-token";function yx(){return typeof window>"u"?null:localStorage.getItem(vp)}function Fn(e){return e.replace(/\/$/,"")}function Hl(e){const t=Fn(e);async function n(r){const s=yx();return(await Ae({...r,baseURL:t,headers:{...r.headers??{},...s?{Authorization:`${gx}${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 zl(e){return!e.isDemo&&!e.isArchive&&!!e.tradeStat}function bx(e){const t=e.filter(n=>zl(n)&&n.platformType==="mt5");return t.length>0?t:e.filter(zl)}function vx(e){const t=e,n=(t==null?void 0:t.accounts)??[];return bx(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 wx(e){try{const t=new URL(Fn(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 Fn(e)}}function _x(e){try{const t=new URL(Fn(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 xx(e){try{const t=new URL(Fn(e));return t.hostname.includes("opheleo")?"wss://public-ticks.opheleo.com":(t.protocol=t.protocol==="https:"?"wss:":"ws:",t.origin)}catch{return"wss://public-ticks.opheleo.com"}}function Sx(e){const t=Fn(e),n=Hl(t),r=wx(t),s=Hl(r),i=uw(n),o=Bt;return{baseUrl:t,platformApiBase:r,tickWebSocketUrl:_x(t),publicTickWebSocketUrl:xx(t),dealer:i,trading:yw(i,o),async getAccounts(){const a=await s.get("/account-config/api/v1");return vx(a)}}}const wp=S.createContext(null);function _p({baseUrl:e,children:t}){const n=S.useMemo(()=>Sx(e),[e]);return c.jsx(wp.Provider,{value:n,children:t})}function Rt(){const e=S.useContext(wp);if(!e)throw new Error("useWidgetApiClient must be used within WidgetApiProvider");return e}function Cx(){return Rt().tickWebSocketUrl}function Ex(){return Rt().publicTickWebSocketUrl}const Tx="wss://public-ticks.opheleo.com";function hc(e){const[t,n]=S.useState(null),r=Ex();return S.useEffect(()=>{n(null);const s=Di(e).toUpperCase();let i=null,o=!1;const a=r||Tx,l=()=>{i=new WebSocket(a),i.onmessage=d=>{var u;try{const f=JSON.parse(d.data);if(f.type!=="tick"||!Array.isArray(f.ticks))return;for(const h of f.ticks){if(((u=h.s)==null?void 0:u.trim().toUpperCase())!==s)continue;const g=Number(h.b),p=Number(h.a);if(!(!Number.isFinite(g)||!Number.isFinite(p))){n({bid:g,ask:p});break}}}catch{}},i.onclose=()=>{o||setTimeout(l,3e3)}};return l(),()=>{o=!0,i==null||i.close(1e3,"Unmounted")}},[e,r]),t}function Px({symbolTicker:e,scanResultUrl:t,orderState:n,backUrl:r,createAccountUrl:s}){const i=hc(e),{panelRef:o,position:a,isDragging:l,onDragStart:d,reclamp:u}=Hf(),{panel:f,isSubmitting:h,defaultVolumeLots:m,volumeStep:g,minVolumeLots:p,accountOptions:y,selectedLogin:b,isAccountsLoading:v,hasConfirmedAccount:x,confirmAccountSelection:_,placeMarketOrder:C}=n,P=oe(j=>j.setDraft),T=oe(j=>j.clearDraft),N=Number(Vt(Ht(e))),R=Pr(N);S.useEffect(()=>{x&&P({source:"new-order",entryPrice:null,side:null,showEntryLine:!1,volumeLots:m,digits:N,priceStep:R})},[m,N,x,R,P]),S.useEffect(()=>{(f==="closed"||f==="confirmation")&&T()},[T,f]);const A=j=>{C({symbolTicker:e,login:j.login,executionMode:"market",side:j.side,orderType:j.side==="buy"?qe.BUY:qe.SELL,volumeLots:j.volumeLots,stopLoss:"",takeProfit:"",priceOrder:"",priceTrigger:"",comment:"",typeTime:ft.GTC,expirationDateTime:"",expirationDay:"",bid:j.bid,ask:j.ask})};return c.jsxs(c.Fragment,{children:[c.jsx(Of,{open:!x,isAccountsLoading:v,accountOptions:y,onConfirm:_,backUrl:r,createAccountUrl:s}),x&&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(Xv,{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:h,isAccountsLoading:v,selectedLogin:b,isDragging:l,scanResultUrl:t,onDragHandlePointerDown:d,onExpandedChange:u,onExpand:u,onPlaceOrder:A})})]})}function kx(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 Ax(e,t){return e.openTimeMs!==t.openTimeMs?e.openTimeMs-t.openTimeMs:kx(e.ticket,t.ticket)}function Wl(e){return[...e].sort(Ax)}function Kl(e){return Ye(e).toUpperCase()}const ve=ji(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:Wl(t)})},setOrders:t=>{e({orders:Wl(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=Kl(t);e(i=>{const o={...i.liveQuotes,[s]:{bid:n,ask:r}};return{liveQuotes:o,positions:i.positions.map(a=>Lv(a,s,n,r,o)),orders:i.orders.map(a=>{if(Kl(a.symbol)!==s)return a;const l=a.side==="buy"?n:r;return{...a,currentPrice:l}})}})},clearPositions:()=>{e({positions:[],orders:[],liveQuotes:{}})}})),Nx="wss://symbols.opheleo.com";function Ox(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 Rv([...n]))n.add(r);return[...n].sort().join("|")}function Rx(e){return Ox(e.positions,e.orders)}function Dx(){const e=ve(Rx),t=ve(r=>r.updateQuotes),n=Cx();S.useEffect(()=>{if(!e)return;const r=e.split("|"),s=new Map;let i=!1;const o=n||Nx,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=u=>{var f;try{const h=JSON.parse(u.data),m=(f=h.symbol)==null?void 0:f.trim().toUpperCase();if(!m||m!==l)return;const g=Number(h.bid),p=Number(h.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 xp(){return Dx(),null}const Sp={buy:"#2563eb",sell:"#dc2626"},ho={positive:"#2563eb",negative:"#dc2626",neutral:"#94a3b8"},go={linewidth:1,linestyle:2,fontsize:11},Cp={stopLoss:"#f97316",takeProfit:"#22c55e"},Ep=e=>Sp[e],Vo=(e,t)=>e==="entry"?t!=null?Ep(t):Sp.sell:Cp[e],Gl=(e,t)=>{if(e==="entry")return Vo(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=Tp(n,r,s,i);return Pp(o)}return Cp[e]},Tp=(e,t,n,r)=>(e==="buy"?n-t:t-n)*r*100,Lx=(e,t)=>!Number.isFinite(t)||t<=0?0:Math.round(e/t),jx=e=>{const t=Tp(e.side,e.entryPrice,e.linePrice,e.volumeLots),n=e.side==="buy"?e.linePrice-e.entryPrice:e.entryPrice-e.linePrice,r=Lx(n,e.priceStep),s=e.kind==="takeProfit"?"TP":"SL",i=`${t.toFixed(2)} USD`,o=`${r} points`;return`${s} ${i}, ${o}`},Ix=(e,t)=>e.toFixed(t),Pp=e=>e>0?ho.positive:e<0?ho.negative:ho.neutral,Mx=e=>{const t=`${e.side.toUpperCase()} ${e.volumeLots.toFixed(2)}, `,n=`${e.profit.toFixed(2)} USD`;return`${t}${n}`},ql=e=>{const t=Ep(e.side),n=Pp(e.profit);return{text:Mx(e),linecolor:t,textcolor:n,linewidth:go.linewidth,linestyle:go.linestyle,fontsize:go.fontsize,showPrice:!0,horzLabelsAlign:"left"}},Zl=e=>pt(e),Fx=e=>e==="entry"||e==="stopLoss"||e==="takeProfit",yo=e=>{e.setUserEditEnabled(!1),e.setSelectionEnabled(!1)},Yl=(e,t,n)=>{if(e==="entry")return Ix(t,n.digits);const{entryPrice:r,side:s}=n;return s!==null&&r!==null?jx({kind:e,side:s,entryPrice:r,linePrice:t,volumeLots:n.volumeLots,priceStep:n.priceStep}):`${e==="takeProfit"?"TP":"SL"} ${Ee(t,n.digits)}`},Ux=({chartWidget:e})=>{const t=oe(_=>_.source),n=oe(_=>_.entryPrice),r=oe(_=>_.stopLoss),s=oe(_=>_.takeProfit),i=oe(_=>_.side),o=oe(_=>_.showEntryLine),a=oe(_=>_.volumeLots),l=oe(_=>_.digits),d=oe(_=>_.priceStep),u=oe(_=>_.setStopLoss),f=oe(_=>_.setTakeProfit),h=S.useRef({}),m=S.useRef(null),g=S.useRef(null),p=S.useRef({entryPrice:n,stopLoss:r,takeProfit:s,side:i,showEntryLine:o,volumeLots:a,digits:l,priceStep:d});S.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 y=S.useCallback(_=>{if(!e)return;const C=h.current[_];if(C){try{e.activeChart().removeEntity(C)}catch{}delete h.current[_]}},[e]),b=S.useCallback((_,C,P,T)=>{const N=Vo(C,T.side),R=Gl(C,{side:T.side,entryPrice:T.entryPrice,linePrice:P,volumeLots:T.volumeLots});_.setProperties({text:Yl(C,P,T),linecolor:N,textcolor:R,showPrice:!0,horzLabelsAlign:"left"})},[]),v=S.useCallback(async(_,C,P)=>{var D;if(!e)return;if(C===void 0){y(_);return}if(m.current===_)return;const T=e.activeChart(),N=Vo(_,P.side),R=Gl(_,{side:P.side,entryPrice:P.entryPrice,linePrice:C,volumeLots:P.volumeLots}),A=Yl(_,C,P),j=h.current[_];if(j)try{const B=T.getShapeById(j);_==="entry"&&yo(B);const O=(D=B.getPoints()[0])==null?void 0:D.price;if(O!==void 0&&Math.abs(O-C)<P.priceStep/2){B.setProperties({text:A,linecolor:N,textcolor:R,showPrice:!0,horzLabelsAlign:"left"});return}const H=B.getPoints();if(H.length>0){B.setPoints(H.map(U=>({...U,price:C}))),B.setProperties({text:A,linecolor:N,textcolor:R,showPrice:!0,horzLabelsAlign:"left"});return}}catch{delete h.current[_]}try{const B=T.getVisibleRange(),O=await T.createShape({time:B.from,price:C},{shape:"horizontal_line",text:A,disableSave:!0,lock:_==="entry",disableSelection:_==="entry",overrides:{linecolor:N,textcolor:R,linewidth:2,showPrice:!0,horzLabelsAlign:"left"}});if(_==="entry")try{yo(T.getShapeById(O))}catch{}h.current[_]=O}catch{}},[e,y]),x=S.useCallback(async _=>{const C=Zl(_.stopLoss),P=Zl(_.takeProfit);_.showEntryLine&&_.entryPrice!==null?await v("entry",_.entryPrice,_):await v("entry",void 0,_),await v("stopLoss",C,_),await v("takeProfit",P,_)},[v]);S.useEffect(()=>{if(!e||t===null)return;const _=(C,P)=>{var N,R,A;const T=(N=Object.entries(h.current).find(([,j])=>j===C))==null?void 0:N[0];if(!(!T||!Fx(T))){if(T==="entry"){if(P==="move"||P==="points_changed"){const j=p.current;if(j.entryPrice!==null)try{const D=e.activeChart().getShapeById(C),B=(R=D.getPoints()[0])==null?void 0:R.price;if(B!==void 0&&Math.abs(B-j.entryPrice)>=j.priceStep/2){const O=D.getPoints();O.length>0&&D.setPoints(O.map(H=>({...H,price:j.entryPrice})))}yo(D)}catch{}}return}if(P==="remove"){m.current=null,T==="stopLoss"&&u(""),T==="takeProfit"&&f(""),delete h.current[T];return}if(!(P!=="move"&&P!=="points_changed"))try{const j=e.activeChart().getShapeById(C),D=(A=j.getPoints()[0])==null?void 0:A.price;if(!Number.isFinite(D)||D<=0)return;const B=p.current;if(P==="points_changed"){m.current=T,b(j,T,D,B),g.current!==null&&clearTimeout(g.current),g.current=setTimeout(()=>{m.current=null;const U=Ee(D,p.current.digits);T==="stopLoss"?u(U):f(U)},120);return}g.current!==null&&(clearTimeout(g.current),g.current=null),m.current=null;const O=Ee(D,B.digits),H=T==="stopLoss"?{...B,stopLoss:O}:{...B,takeProfit:O};T==="stopLoss"?u(O):f(O),b(j,T,D,H)}catch{m.current=null}}};try{e.subscribe("drawing_event",_)}catch{}return()=>{m.current=null,g.current!==null&&(clearTimeout(g.current),g.current=null);try{e.unsubscribe("drawing_event",_)}catch{}Object.keys(h.current).forEach(C=>{y(C)}),h.current={}}},[e,y,u,f,t,b]),S.useEffect(()=>{if(!e||t===null)return;let _=!1;try{e.onChartReady(()=>{_||x(p.current)})}catch{}return()=>{_=!0}},[e,t,n,r,s,i,o,a,l,d,x])},Ql=e=>{e.setUserEditEnabled(!1),e.setSelectionEnabled(!1)},kp=(e,t)=>Ye(e.symbol).toUpperCase()===t,Bx=e=>ve.getState().positions.filter(t=>kp(t,e)).map(t=>({ticket:t.ticket,openPrice:t.openPrice,type:t.type,digits:t.digits,volumeLots:t.volumeLots,profit:t.profit})),Xl=(e,t,n)=>{try{const r=e.activeChart().symbol(),s=n.find(i=>i.display_name===r||i.ticker===r);if(s)return Mf(s.ticker,n)}catch{}return t},$x=(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)},Vx=({chartWidget:e,symbolTicker:t,symbols:n})=>{const r=ve(g=>g.positions),s=S.useRef(new Map),i=S.useRef(0),o=S.useMemo(()=>Mf(t,n),[t,n]),a=S.useMemo(()=>r.filter(g=>kp(g,o)).map(g=>`${g.ticket}:${g.openPrice}:${g.type}:${g.digits}:${g.volumeLots}:${g.profit.toFixed(2)}`).sort().join("|"),[o,r]),l=S.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=S.useCallback(()=>{for(const g of[...s.current.keys()])l(g);s.current.clear()},[l]),u=S.useCallback(async(g,p,y)=>{const b=ql({side:p.type,volumeLots:p.volumeLots,profit:p.profit}),x={time:g.getVisibleRange().from,price:p.openPrice},_=await g.createShape(x,{shape:"horizontal_line",text:String(b.text),disableSave:!0,lock:!0,disableSelection:!0,overrides:b});if(y!==i.current){try{g.removeEntity(_)}catch{}return null}try{Ql(g.getShapeById(_))}catch{}return _},[]),f=S.useCallback(async(g,p)=>{if(!e||p!==i.current)return;const y=e.activeChart(),b=ql({side:g.type,volumeLots:g.volumeLots,profit:g.profit}),v=s.current.get(g.ticket);if(v)try{$x(y.getShapeById(v),g.openPrice,b),Ql(y.getShapeById(v));return}catch{s.current.delete(g.ticket)}if(p===i.current)try{const x=await u(y,g,p);if(!x)return;s.current.set(g.ticket,x)}catch{}},[e,u]),h=S.useCallback(async(g,p)=>{if(!e||g!==i.current)return;const y=Bx(p),b=new Set(y.map(v=>v.ticket));for(const v of s.current.keys())b.has(v)||l(v);for(const v of y){if(g!==i.current)return;await f(v,g)}},[e,l,f]),m=S.useCallback(g=>{if(!e)return;const p=i.current+1;i.current=p,g!=null&&g.resetLineIds&&d();const y=(g==null?void 0:g.symbolKey)??Xl(e,o,n);h(p,y)},[o,e,d,n,h]);S.useEffect(()=>{if(!e)return;let g=!1,p=null;const y=()=>{g||m({resetLineIds:!0,symbolKey:Xl(e,o,n)})};let b=!1;const v=()=>{b=!0,y()},x=()=>{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,x)}catch{}})}catch{}return()=>{if(g=!0,i.current+=1,p)try{p.onSymbolChanged().unsubscribe(null,v),p.onDataLoaded().unsubscribe(null,x)}catch{}d()}},[o,e,d,m,n]),S.useEffect(()=>{if(!e)return;let g=!1;try{e.onChartReady(()=>{g||m({symbolKey:o})})}catch{}return()=>{g=!0}},[o,e,a,m])},Ap=({chartWidget:e,symbolTicker:t,symbols:n})=>(Vx({chartWidget:e,symbolTicker:t,symbols:n}),Ux({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,tr,$d,Hx=($d=class extends cs{constructor(){super();ne(this,_n);ne(this,Qt);ne(this,tr);W(this,tr,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,tr))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,Qt))==null||t.call(this),W(this,Qt,void 0))}setEventListener(t){var n;W(this,tr,t),(n=E(this,Qt))==null||n.call(this),W(this,Qt,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){E(this,_n)!==t&&(W(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,tr=new WeakMap,$d),gc=new Hx,zx={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},St,xn,Vd,Wx=(Vd=class{constructor(){ne(this,St,zx);ne(this,xn,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&E(this,xn)&&e!==E(this,St)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:E(this,St),provider:e}),W(this,St,e),process.env.NODE_ENV!=="production"&&W(this,xn,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&W(this,xn,!0),E(this,St).setTimeout(e,t)}clearTimeout(e){E(this,St).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&W(this,xn,!0),E(this,St).setInterval(e,t)}clearInterval(e){E(this,St).clearInterval(e)}},St=new WeakMap,xn=new WeakMap,Vd),wn=new Wx;function Kx(e){setTimeout(e,0)}var Gx=typeof window>"u"||"Deno"in globalThis;function Ge(){}function qx(e,t){return typeof e=="function"?e(t):e}function Ho(e){return typeof e=="number"&&e>=0&&e!==1/0}function Np(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 Jl(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:i,queryKey:o,stale:a}=e;if(o){if(r){if(t.queryHash!==yc(o,t.options))return!1}else if(!Gr(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 ed(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(!Gr(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function yc(e,t){return((t==null?void 0:t.queryKeyHashFn)||Kr)(e)}function Kr(e){return JSON.stringify(e,(t,n)=>Ko(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function Gr(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Gr(e[n],t[n])):!1}var Zx=Object.prototype.hasOwnProperty;function zo(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=td(e)&&td(t);if(!r&&!(Ko(e)&&Ko(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 u=0;u<a;u++){const f=r?u:o[u],h=e[f],m=t[f];if(h===m){l[f]=h,(r?u<i:Zx.call(e,f))&&d++;continue}if(h===null||m===null||typeof h!="object"||typeof m!="object"){l[f]=m;continue}const g=zo(h,m,n+1);l[f]=g,g===h&&d++}return i===a&&d===i?e:l}function Wo(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 td(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Ko(e){if(!nd(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!nd(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function nd(e){return Object.prototype.toString.call(e)==="[object Object]"}function Yx(e){return new Promise(t=>{wn.setTimeout(t,e)})}function Go(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 Qx(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function Xx(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var oi=Symbol();function Op(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===oi&&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===oi?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Rp(e,t){return typeof e=="function"?e(...t):!!e}function Jx(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 qr=(()=>{let e=()=>Gx;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 eS=Kx;function tS(){let e=[],t=0,n=a=>{a()},r=a=>{a()},s=eS;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 Ue=tS(),nr,Xt,rr,Hd,nS=(Hd=class extends cs{constructor(){super();ne(this,nr,!0);ne(this,Xt);ne(this,rr);W(this,rr,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,rr))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,Xt))==null||t.call(this),W(this,Xt,void 0))}setEventListener(t){var n;W(this,rr,t),(n=E(this,Xt))==null||n.call(this),W(this,Xt,t(this.setOnline.bind(this)))}setOnline(t){E(this,nr)!==t&&(W(this,nr,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return E(this,nr)}},nr=new WeakMap,Xt=new WeakMap,rr=new WeakMap,Hd),ai=new nS;function rS(e){return Math.min(1e3*2**e,3e4)}function Dp(e){return(e??"online")==="online"?ai.isOnline():!0}var Zo=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Lp(e){let t=!1,n=0,r;const s=qo(),i=()=>s.status!=="pending",o=p=>{var y;if(!i()){const b=new Zo(p);h(b),(y=e.onCancel)==null||y.call(e,b)}},a=()=>{t=!0},l=()=>{t=!1},d=()=>gc.isFocused()&&(e.networkMode==="always"||ai.isOnline())&&e.canRun(),u=()=>Dp(e.networkMode)&&e.canRun(),f=p=>{i()||(r==null||r(),s.resolve(p))},h=p=>{i()||(r==null||r(),s.reject(p))},m=()=>new Promise(p=>{var y;r=b=>{(i()||d())&&p(b)},(y=e.onPause)==null||y.call(e)}).then(()=>{var p;r=void 0,i()||(p=e.onContinue)==null||p.call(e)}),g=()=>{if(i())return;let p;const y=n===0?e.initialPromise:void 0;try{p=y??e.fn()}catch(b){p=Promise.reject(b)}Promise.resolve(p).then(f).catch(b=>{var P;if(i())return;const v=e.retry??(qr.isServer()?0:3),x=e.retryDelay??rS,_=typeof x=="function"?x(n,b):x,C=v===!0||typeof v=="number"&&n<v||typeof v=="function"&&v(n,b);if(t||!C){h(b);return}n++,(P=e.onFail)==null||P.call(e,n,b),Yx(_).then(()=>d()?void 0:m()).then(()=>{t?h(b):g()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(r==null||r(),s),cancelRetry:a,continueRetry:l,canStart:u,start:()=>(u()?g():m().then(g),s)}}var Sn,zd,jp=(zd=class{constructor(){ne(this,Sn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Ho(this.gcTime)&&W(this,Sn,wn.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(qr.isServer()?1/0:300*1e3))}clearGcTimeout(){E(this,Sn)!==void 0&&(wn.clearTimeout(E(this,Sn)),W(this,Sn,void 0))}},Sn=new WeakMap,zd);function sS(e){return{onFetch:(t,n)=>{var u,f,h,m,g;const r=t.options,s=(h=(f=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:f.fetchMore)==null?void 0:h.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 y=x=>{Jx(x,()=>t.signal,()=>p=!0)},b=Op(t.options,t.fetchOptions),v=async(x,_,C)=>{if(p)return Promise.reject(t.signal.reason);if(_==null&&x.pages.length)return Promise.resolve(x);const T=(()=>{const j={client:t.client,queryKey:t.queryKey,pageParam:_,direction:C?"backward":"forward",meta:t.options.meta};return y(j),j})(),N=await b(T),{maxPages:R}=t.options,A=C?Xx:Qx;return{pages:A(x.pages,N,R),pageParams:A(x.pageParams,_,R)}};if(s&&i.length){const x=s==="backward",_=x?iS:rd,C={pages:i,pageParams:o},P=_(r,C);a=await v(C,P,x)}else{const x=e??i.length;do{const _=l===0?o[0]??r.initialPageParam:rd(r,a);if(l>0&&_==null)break;a=await v(a,_),l++}while(l<x)}return a};t.options.persister?t.fetchFn=()=>{var p,y;return(y=(p=t.options).persister)==null?void 0:y.call(p,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=d}}}function rd(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 iS(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 sr,Cn,ir,it,En,Me,Qr,Tn,Je,Ip,Dt,Wd,oS=(Wd=class extends jp{constructor(t){super();ne(this,Je);ne(this,sr);ne(this,Cn);ne(this,ir);ne(this,it);ne(this,En);ne(this,Me);ne(this,Qr);ne(this,Tn);W(this,Tn,!1),W(this,Qr,t.defaultOptions),this.setOptions(t.options),this.observers=[],W(this,En,t.client),W(this,it,E(this,En).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,W(this,Cn,id(this.options)),this.state=t.state??E(this,Cn),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return E(this,sr)}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&&W(this,sr,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=id(this.options);n.data!==void 0&&(this.setState(sd(n.data,n.dataUpdatedAt)),W(this,Cn,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&E(this,it).remove(this)}setData(t,n){const r=Go(this.state.data,t,this.options);return he(this,Je,Dt).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t){he(this,Je,Dt).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(Ge).catch(Ge):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===oi||!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:!Np(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)||he(this,Je,Ip).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||he(this,Je,Dt).call(this,{type:"invalidate"})}async fetch(t,n){var d,u,f,h,m,g,p,y,b,v,x;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 _=this.observers.find(C=>C.options.queryFn);_&&this.setOptions(_.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=_=>{Object.defineProperty(_,"signal",{enumerable:!0,get:()=>(W(this,Tn,!0),r.signal)})},i=()=>{const _=Op(this.options,n),P=(()=>{const T={client:E(this,En),queryKey:this.queryKey,meta:this.meta};return s(T),T})();return W(this,Tn,!1),this.options.persister?this.options.persister(_,P,this):_(P)},a=(()=>{const _={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:E(this,En),state:this.state,fetchFn:i};return s(_),_})(),l=E(this,sr)==="infinite"?sS(this.options.pages):this.options.behavior;l==null||l.onFetch(a,this),W(this,ir,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=a.fetchOptions)==null?void 0:u.meta))&&he(this,Je,Dt).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta}),W(this,Me,Lp({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:_=>{_ instanceof Zo&&_.revert&&this.setState({...E(this,ir),fetchStatus:"idle"}),r.abort()},onFail:(_,C)=>{he(this,Je,Dt).call(this,{type:"failed",failureCount:_,error:C})},onPause:()=>{he(this,Je,Dt).call(this,{type:"pause"})},onContinue:()=>{he(this,Je,Dt).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const _=await E(this,Me).start();if(_===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(_),(m=(h=E(this,it).config).onSuccess)==null||m.call(h,_,this),(p=(g=E(this,it).config).onSettled)==null||p.call(g,_,this.state.error,this),_}catch(_){if(_ instanceof Zo){if(_.silent)return E(this,Me).promise;if(_.revert){if(this.state.data===void 0)throw _;return this.state.data}}throw he(this,Je,Dt).call(this,{type:"error",error:_}),(b=(y=E(this,it).config).onError)==null||b.call(y,_,this),(x=(v=E(this,it).config).onSettled)==null||x.call(v,this.state.data,_,this),_}finally{this.scheduleGc()}}},sr=new WeakMap,Cn=new WeakMap,ir=new WeakMap,it=new WeakMap,En=new WeakMap,Me=new WeakMap,Qr=new WeakMap,Tn=new WeakMap,Je=new WeakSet,Ip=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Dt=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,...Mp(r.data,this.options),fetchMeta:t.meta??null};case"success":const s={...r,...sd(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return W(this,ir,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),Ue.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),E(this,it).notify({query:this,type:"updated",action:t})})},Wd);function Mp(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Dp(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function sd(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function id(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,or,jt,Jt,Jr,ar,cr,kn,An,en,lr,xe,Fr,Yo,Qo,Xo,Jo,ea,ta,na,Fp,Kd,aS=(Kd=class extends cs{constructor(t,n){super();ne(this,xe);ne(this,Ke);ne(this,be);ne(this,Xr);ne(this,We);ne(this,Pn);ne(this,or);ne(this,jt);ne(this,Jt);ne(this,Jr);ne(this,ar);ne(this,cr);ne(this,kn);ne(this,An);ne(this,en);ne(this,lr,new Set);this.options=n,W(this,Ke,t),W(this,Jt,null),W(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),od(E(this,be),this.options)?he(this,xe,Fr).call(this):this.updateResult(),he(this,xe,Jo).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ra(E(this,be),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ra(E(this,be),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,he(this,xe,ea).call(this),he(this,xe,ta).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");he(this,xe,na).call(this),E(this,be).setOptions(this.options),n._defaulted&&!Wo(this.options,n)&&E(this,Ke).getQueryCache().notify({type:"observerOptionsUpdated",query:E(this,be),observer:this});const s=this.hasListeners();s&&ad(E(this,be),r,this.options,n)&&he(this,xe,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)))&&he(this,xe,Yo).call(this);const i=he(this,xe,Qo).call(this);s&&(E(this,be)!==r||et(this.options.enabled,E(this,be))!==et(n.enabled,E(this,be))||i!==E(this,en))&&he(this,xe,Xo).call(this,i)}getOptimisticResult(t){const n=E(this,Ke).getQueryCache().build(E(this,Ke),t),r=this.createResult(n,t);return lS(this,r)&&(W(this,We,r),W(this,or,this.options),W(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,lr).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 he(this,xe,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,or),d=t!==r?t.state:E(this,Xr),{state:u}=t;let f={...u},h=!1,m;if(n._optimisticResults){const A=this.hasListeners(),j=!A&&od(t,n),D=A&&ad(t,r,n,s);(j||D)&&(f={...f,...Mp(u.data,t.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:g,errorUpdatedAt:p,status:y}=f;m=f.data;let b=!1;if(n.placeholderData!==void 0&&m===void 0&&y==="pending"){let A;i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(A=i.data,b=!0):A=typeof n.placeholderData=="function"?n.placeholderData((R=E(this,cr))==null?void 0:R.state.data,E(this,cr)):n.placeholderData,A!==void 0&&(y="success",m=Go(i==null?void 0:i.data,A,n),h=!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,ar);else try{W(this,Jr,n.select),m=n.select(m),m=Go(i==null?void 0:i.data,m,n),W(this,ar,m),W(this,Jt,null)}catch(A){W(this,Jt,A)}E(this,Jt)&&(g=E(this,Jt),m=E(this,ar),p=Date.now(),y="error");const v=f.fetchStatus==="fetching",x=y==="pending",_=y==="error",C=x&&v,P=m!==void 0,N={status:y,fetchStatus:f.fetchStatus,isPending:x,isSuccess:y==="success",isError:_,isInitialLoading:C,isLoading:C,data:m,dataUpdatedAt:f.dataUpdatedAt,error:g,errorUpdatedAt:p,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:f.dataUpdateCount>d.dataUpdateCount||f.errorUpdateCount>d.errorUpdateCount,isFetching:v,isRefetching:v&&!x,isLoadingError:_&&!P,isPaused:f.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:_&&P,isStale:bc(t,n),refetch:this.refetch,promise:E(this,jt),isEnabled:et(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const A=N.data!==void 0,j=N.status==="error"&&!A,D=H=>{j?H.reject(N.error):A&&H.resolve(N.data)},B=()=>{const H=W(this,jt,N.promise=qo());D(H)},O=E(this,jt);switch(O.status){case"pending":t.queryHash===r.queryHash&&D(O);break;case"fulfilled":(j||N.data!==O.value)&&B();break;case"rejected":(!j||N.error!==O.reason)&&B();break}}return N}updateResult(){const t=E(this,We),n=this.createResult(E(this,be),this.options);if(W(this,Pn,E(this,be).state),W(this,or,this.options),E(this,Pn).data!==void 0&&W(this,cr,E(this,be)),Wo(n,t))return;W(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,lr).size)return!0;const o=new Set(i??E(this,lr));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)})};he(this,xe,Fp).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&he(this,xe,Jo).call(this)}},Ke=new WeakMap,be=new WeakMap,Xr=new WeakMap,We=new WeakMap,Pn=new WeakMap,or=new WeakMap,jt=new WeakMap,Jt=new WeakMap,Jr=new WeakMap,ar=new WeakMap,cr=new WeakMap,kn=new WeakMap,An=new WeakMap,en=new WeakMap,lr=new WeakMap,xe=new WeakSet,Fr=function(t){he(this,xe,na).call(this);let n=E(this,be).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Ge)),n},Yo=function(){he(this,xe,ea).call(this);const t=an(this.options.staleTime,E(this,be));if(qr.isServer()||E(this,We).isStale||!Ho(t))return;const r=Np(E(this,We).dataUpdatedAt,t)+1;W(this,kn,wn.setTimeout(()=>{E(this,We).isStale||this.updateResult()},r))},Qo=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(E(this,be)):this.options.refetchInterval)??!1},Xo=function(t){he(this,xe,ta).call(this),W(this,en,t),!(qr.isServer()||et(this.options.enabled,E(this,be))===!1||!Ho(E(this,en))||E(this,en)===0)&&W(this,An,wn.setInterval(()=>{(this.options.refetchIntervalInBackground||gc.isFocused())&&he(this,xe,Fr).call(this)},E(this,en)))},Jo=function(){he(this,xe,Yo).call(this),he(this,xe,Xo).call(this,he(this,xe,Qo).call(this))},ea=function(){E(this,kn)!==void 0&&(wn.clearTimeout(E(this,kn)),W(this,kn,void 0))},ta=function(){E(this,An)!==void 0&&(wn.clearInterval(E(this,An)),W(this,An,void 0))},na=function(){const t=E(this,Ke).getQueryCache().build(E(this,Ke),this.options);if(t===E(this,be))return;const n=E(this,be);W(this,be,t),W(this,Xr,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Fp=function(t){Ue.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(E(this,We))}),E(this,Ke).getQueryCache().notify({query:E(this,be),type:"observerResultsUpdated"})})},Kd);function cS(e,t){return et(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&et(t.retryOnMount,e)===!1)}function od(e,t){return cS(e,t)||e.state.data!==void 0&&ra(e,t,t.refetchOnMount)}function ra(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&&bc(e,t)}return!1}function ad(e,t,n,r){return(e!==t||et(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&bc(e,n)}function bc(e,t){return et(t.enabled,e)!==!1&&e.isStaleByTime(an(t.staleTime,e))}function lS(e,t){return!Wo(e.getCurrentResult(),t)}var es,Ct,He,Nn,Et,Gt,Gd,dS=(Gd=class extends jp{constructor(t){super();ne(this,Et);ne(this,es);ne(this,Ct);ne(this,He);ne(this,Nn);W(this,es,t.client),this.mutationId=t.mutationId,W(this,He,t.mutationCache),W(this,Ct,[]),this.state=t.state||uS(),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,Ct).includes(t)||(E(this,Ct).push(t),this.clearGcTimeout(),E(this,He).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){W(this,Ct,E(this,Ct).filter(n=>n!==t)),this.scheduleGc(),E(this,He).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){E(this,Ct).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,u,f,h,m,g,p,y,b,v,x,_,C,P,T;const n=()=>{he(this,Et,Gt).call(this,{type:"continue"})},r={client:E(this,es),meta:this.options.meta,mutationKey:this.options.mutationKey};W(this,Nn,Lp({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(N,R)=>{he(this,Et,Gt).call(this,{type:"failed",failureCount:N,error:R})},onPause:()=>{he(this,Et,Gt).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{he(this,Et,Gt).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&&he(this,Et,Gt).call(this,{type:"pending",context:R,variables:t,isPaused:i})}const N=await E(this,Nn).start();return await((d=(l=E(this,He).config).onSuccess)==null?void 0:d.call(l,N,t,this.state.context,this,r)),await((f=(u=this.options).onSuccess)==null?void 0:f.call(u,N,t,this.state.context,r)),await((m=(h=E(this,He).config).onSettled)==null?void 0:m.call(h,N,null,this.state.variables,this.state.context,this,r)),await((p=(g=this.options).onSettled)==null?void 0:p.call(g,N,null,t,this.state.context,r)),he(this,Et,Gt).call(this,{type:"success",data:N}),N}catch(N){try{await((b=(y=E(this,He).config).onError)==null?void 0:b.call(y,N,t,this.state.context,this,r))}catch(R){Promise.reject(R)}try{await((x=(v=this.options).onError)==null?void 0:x.call(v,N,t,this.state.context,r))}catch(R){Promise.reject(R)}try{await((C=(_=E(this,He).config).onSettled)==null?void 0:C.call(_,void 0,N,this.state.variables,this.state.context,this,r))}catch(R){Promise.reject(R)}try{await((T=(P=this.options).onSettled)==null?void 0:T.call(P,void 0,N,t,this.state.context,r))}catch(R){Promise.reject(R)}throw he(this,Et,Gt).call(this,{type:"error",error:N}),N}finally{E(this,He).runNext(this)}}},es=new WeakMap,Ct=new WeakMap,He=new WeakMap,Nn=new WeakMap,Et=new WeakSet,Gt=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),Ue.batch(()=>{E(this,Ct).forEach(r=>{r.onMutationUpdate(t)}),E(this,He).notify({mutation:this,type:"updated",action:t})})},Gd);function uS(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var It,ut,ts,qd,fS=(qd=class extends cs{constructor(t={}){super();ne(this,It);ne(this,ut);ne(this,ts);this.config=t,W(this,It,new Set),W(this,ut,new Map),W(this,ts,0)}build(t,n,r){const s=new dS({client:t,mutationCache:this,mutationId:++fs(this,ts)._,options:t.defaultMutationOptions(n),state:r});return this.add(s),s}add(t){E(this,It).add(t);const n=Ts(t);if(typeof n=="string"){const r=E(this,ut).get(n);r?r.push(t):E(this,ut).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(E(this,It).delete(t)){const n=Ts(t);if(typeof n=="string"){const r=E(this,ut).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,ut).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Ts(t);if(typeof n=="string"){const r=E(this,ut).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=Ts(t);if(typeof n=="string"){const s=(r=E(this,ut).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(){Ue.batch(()=>{E(this,It).forEach(t=>{this.notify({type:"removed",mutation:t})}),E(this,It).clear(),E(this,ut).clear()})}getAll(){return Array.from(E(this,It))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>ed(n,r))}findAll(t={}){return this.getAll().filter(n=>ed(t,n))}notify(t){Ue.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Ue.batch(()=>Promise.all(t.map(n=>n.continue().catch(Ge))))}},It=new WeakMap,ut=new WeakMap,ts=new WeakMap,qd);function Ts(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Tt,Zd,pS=(Zd=class extends cs{constructor(t={}){super();ne(this,Tt);this.config=t,W(this,Tt,new Map)}build(t,n,r){const s=n.queryKey,i=n.queryHash??yc(s,n);let o=this.get(i);return o||(o=new oS({client:t,queryKey:s,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){E(this,Tt).has(t.queryHash)||(E(this,Tt).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=E(this,Tt).get(t.queryHash);n&&(t.destroy(),n===t&&E(this,Tt).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Ue.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return E(this,Tt).get(t)}getAll(){return[...E(this,Tt).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Jl(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Jl(t,r)):n}notify(t){Ue.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Ue.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Ue.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Tt=new WeakMap,Zd),Oe,tn,nn,dr,ur,rn,fr,pr,Yd,mS=(Yd=class{constructor(e={}){ne(this,Oe);ne(this,tn);ne(this,nn);ne(this,dr);ne(this,ur);ne(this,rn);ne(this,fr);ne(this,pr);W(this,Oe,e.queryCache||new pS),W(this,tn,e.mutationCache||new fS),W(this,nn,e.defaultOptions||{}),W(this,dr,new Map),W(this,ur,new Map),W(this,rn,0)}mount(){fs(this,rn)._++,E(this,rn)===1&&(W(this,fr,gc.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,Oe).onFocus())})),W(this,pr,ai.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,Oe).onOnline())})))}unmount(){var e,t;fs(this,rn)._--,E(this,rn)===0&&((e=E(this,fr))==null||e.call(this),W(this,fr,void 0),(t=E(this,pr))==null||t.call(this),W(this,pr,void 0))}isFetching(e){return E(this,Oe).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,Oe).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=E(this,Oe).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,Oe).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,Oe).get(r.queryHash),i=s==null?void 0:s.state.data,o=qx(t,i);if(o!==void 0)return E(this,Oe).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return Ue.batch(()=>E(this,Oe).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,Oe).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=E(this,Oe);Ue.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=E(this,Oe);return Ue.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Ue.batch(()=>E(this,Oe).findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(Ge).catch(Ge)}invalidateQueries(e,t={}){return Ue.batch(()=>(E(this,Oe).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=Ue.batch(()=>E(this,Oe).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,n);return n.throwOnError||(i=i.catch(Ge)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Ge)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=E(this,Oe).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(Ge).catch(Ge)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ge).catch(Ge)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return ai.isOnline()?E(this,tn).resumePausedMutations():Promise.resolve()}getQueryCache(){return E(this,Oe)}getMutationCache(){return E(this,tn)}getDefaultOptions(){return E(this,nn)}setDefaultOptions(e){W(this,nn,e)}setQueryDefaults(e,t){E(this,dr).set(Kr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...E(this,dr).values()],n={};return t.forEach(r=>{Gr(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){E(this,ur).set(Kr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...E(this,ur).values()],n={};return t.forEach(r=>{Gr(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=yc(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===oi&&(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,Oe).clear(),E(this,tn).clear()}},Oe=new WeakMap,tn=new WeakMap,nn=new WeakMap,dr=new WeakMap,ur=new WeakMap,rn=new WeakMap,fr=new WeakMap,pr=new WeakMap,Yd),Up=w.createContext(void 0),Bp=e=>{const t=w.useContext(Up);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},hS=({client:e,children:t})=>(w.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),c.jsx(Up.Provider,{value:e,children:t})),$p=w.createContext(!1),gS=()=>w.useContext($p);$p.Provider;function yS(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var bS=w.createContext(yS()),vS=()=>w.useContext(bS),wS=(e,t,n)=>{const r=n!=null&&n.state.error&&typeof e.throwOnError=="function"?Rp(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},_S=e=>{w.useEffect(()=>{e.clearReset()},[e])},xS=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||Rp(n,[e.error,r])),SS=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))}},CS=(e,t)=>e.isLoading&&e.isFetching&&!t,ES=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,cd=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function TS(e,t,n){var m,g,p,y;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=gS(),s=vS(),i=Bp(),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,SS(o),wS(o,s,a),_S(s);const d=!i.getQueryCache().get(o.queryHash),[u]=w.useState(()=>new t(i,o)),f=u.getOptimisticResult(o),h=!r&&l;if(w.useSyncExternalStore(w.useCallback(b=>{const v=h?u.subscribe(Ue.batchCalls(b)):Ge;return u.updateResult(),v},[u,h]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),w.useEffect(()=>{u.setOptions(o)},[o,u]),ES(o,f))throw cd(o,u,s);if(xS({result:f,errorResetBoundary:s,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw f.error;if((y=(p=i.getDefaultOptions().queries)==null?void 0:p._experimental_afterQuery)==null||y.call(p,o,f),o.experimental_prefetchInRender&&!qr.isServer()&&CS(f,r)){const b=d?cd(o,u,s):a==null?void 0:a.promise;b==null||b.catch(Ge).finally(()=>{u.updateResult()})}return o.notifyOnChangeProps?f:u.trackResult(f)}function Nr(e,t){return TS(e,aS)}const Vp=S.createContext(null);function PS(e){return typeof window>"u"?e??null:e?(localStorage.setItem(vp,e),e):null}function kS({token:e,children:t}){const n=PS(e);return c.jsx(Vp.Provider,{value:n,children:t})}function AS(){return S.useContext(Vp)}const NS="widget-accounts",Hp="widget-positions",zp="widget-orders",OS="widget-deals",RS="widget-deals-total",DS=2e4;function $s(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 LS(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 vc(e){if(e==null||e==="")return"—";if(typeof e=="number"&&Number.isFinite(e)){const t=e>1e12?e:e*1e3;return $s(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 $s(new Date(s))}}const n=Date.parse(t);return Number.isFinite(n)?$s(new Date(n)):t}if(typeof e=="object"&&e!==null){const n=LS(e);if(n!==void 0)return vc(n)}return"—"}const Wp=["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 jS(e){return $s(e)}const IS={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 Bi(e,t){for(const n of t)if(e[n]!==void 0&&e[n]!==null&&e[n]!=="")return e[n]}function xt(e,t){const n=Bi(e,t);if(n===void 0)return;const r=Number(n);return Number.isFinite(r)?r:void 0}function Ps(e,t){const n=Bi(e,t);if(n!==void 0)return String(n)}function MS(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 sa(e){return e===void 0?.01:e>=100?e/1e4:e}function FS(e,t){return Lf(t,e)}function US(e){const t=Bi(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=xt(e,["type","Type","orderType","OrderType"])??2;return{label:IS[n]??(n%2===1?"sell":"buy"),side:ni(n),typeNum:n}}function BS(e,t){const n=xt(e,["volumeFilled","volume_filled","VolumeFilled","filledVolume","FilledVolume"]);if(n!==void 0)return sa(n);const r=xt(e,["volumeCurrent","volume_current","VolumeCurrent"]);return r!==void 0?sa(r):0}function $S(e,t){const n=Ps(e,["ticket","Ticket","order","Order","id","ID"]),r=Ps(e,["symbol","Symbol"])??"";if(!n||!r)return null;const s=Ye(r),{label:i,side:o,typeNum:a}=US(e),l=xt(e,["typeTime","TypeTime"])??0,d=sa(xt(e,["volumeLots","volume_lots","VolumeLots","volume","Volume"])),u=BS(e),f=xt(e,["priceOrder","price_order","PriceOrder","openPrice","open_price","price","Price"])??0,h=xt(e,["priceTrigger","price_trigger","PriceTrigger","triggerPrice","TriggerPrice"]),m=xt(e,["currentPrice","current_price","PriceCurrent","priceCurrent","marketPrice","MarketPrice"])??f,g=xt(e,["stopLoss","stop_loss","PriceSL","sl","SL"]),p=xt(e,["takeProfit","take_profit","PriceTP","tp","TP"]),y=Ps(e,["comment","Comment"])??"",b=FS(e,s),v=vc(Bi(e,Wp));return{ticket:n,login:Ps(e,["login","Login"])??t,symbol:s,displaySymbol:Ni(s),time:v,typeLabel:i,orderType:a,typeTime:l,side:o,volumeLots:d,volumeFilledLots:u,orderPrice:f,priceTrigger:h,stopLoss:g,takeProfit:p,currentPrice:m,comment:y,digits:b}}function VS(e,t){return MS(e).map(n=>$S(n,t)).filter(n=>n!==null)}function $i(e,t){for(const n of t)if(e[n]!==void 0&&e[n]!==null&&e[n]!=="")return e[n]}function qt(e,t){const n=$i(e,t);if(n===void 0)return;const r=Number(n);return Number.isFinite(r)?r:void 0}function ks(e,t){const n=$i(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","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 zS(e){return e===void 0?.01:e>=100?e/1e4:e}function WS(e){const t=$i(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=qt(e,["type","Type","action","Action"]);return n!==void 0&&n%2===1?"sell":"buy"}function KS(e,t){return Lf(t,e)}function GS(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=WS(e),o=zS(qt(e,["volumeLots","volume_lots","VolumeLots","volume","Volume"])),a=qt(e,["openPrice","open_price","PriceOpen","priceOpen","price","Price"])??0,l=qt(e,["currentPrice","current_price","PriceCurrent","priceCurrent"])??a,d=qt(e,["stopLoss","stop_loss","PriceSL","sl","SL"]),u=qt(e,["takeProfit","take_profit","PriceTP","tp","TP"]),f=qt(e,["profit","Profit","floating","Floating","pnl","PnL"])??0,h=qt(e,["swap","Swap"])??0,m=ks(e,["comment","Comment"])??"",g=KS(e,s),p=vc($i(e,Wp));return{ticket:n,login:ks(e,["login","Login"])??t,symbol:s,displaySymbol:Ni(s),time:p,type:i,volumeLots:o,openPrice:a,stopLoss:d,takeProfit:u,currentPrice:l,marketBid:l,marketAsk:l,swap:h,profit:f,comment:m,digits:g}}function qS(e,t){return HS(e).map(n=>GS(n,t)).filter(n=>n!==null)}function ls(){return Bt}function Kp(){const e=Rt(),t=AS(),{data:n,isLoading:r,isError:s}=Nr({queryKey:[NS,e.baseUrl,t],queryFn:()=>e.getAccounts(),enabled:!!t});return{accounts:n??[],isLoading:r,isError:s}}function ZS(e){const t=Rt();return Nr({queryKey:[Hp,t.baseUrl,e],queryFn:()=>t.dealer.getPositions(e),enabled:!!e,refetchInterval:DS})}function YS(e){const t=Rt();return Nr({queryKey:[zp,t.baseUrl,e],queryFn:()=>t.dealer.getOrders(e),enabled:!!e})}function QS(){const e=Bp(),t=Rt();return S.useCallback((n,r)=>{e.invalidateQueries({queryKey:[Hp,t.baseUrl,n]}),(r===void 0||nc(r))&&e.invalidateQueries({queryKey:[zp,t.baseUrl,n]})},[t.baseUrl,e])}function Vi(){const e=Rt(),t=QS();return{async submitOrder(n){const r=await e.trading.submitOrder(n);return r.success&&t(n.login,n.orderType),r},async closePosition(n){const r=await e.trading.closePosition(n);return r.success&&t(n.login),r},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 XS(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 JS(e){if(e===null||typeof e!="object")return{total:0};const t=e,n=t.data??t;return{total:Number(n.total??0)}}function e0(e,t,n,r={}){const s=Rt();return Nr({queryKey:[RS,s.baseUrl,e,t,n],queryFn:async()=>{const i=await s.dealer.getDealsTotal(e,t,n);return JS(i)},enabled:r.enabled??!0})}function t0(e,t,n,r,s,i={}){const o=Rt();return Nr({queryKey:[OS,o.baseUrl,e,t,n,r,s],queryFn:async()=>{const a=await o.dealer.getDeals(e,t,n,r,s);return XS(a)},enabled:i.enabled??!0})}function n0(e,t){return e!=null?qS(e,t):[]}function r0(e,t){return e!=null?VS(e,t):[]}function s0({symbolTicker:e,controlsRef:t,chartWidget:n,scanResultUrl:r,orderState:s,backUrl:i,createAccountUrl:o}){const{openMarketPanel:a,setSelectedLogin:l}=s,d=ls();return S.useEffect(()=>(t.current={open:a,setSelectedLogin:l},()=>{t.current=null}),[t,a,l]),c.jsxs(c.Fragment,{children:[c.jsx(Ap,{chartWidget:n,symbolTicker:e,symbols:d}),c.jsx(xp,{}),c.jsx(Px,{symbolTicker:e,scanResultUrl:r,orderState:s,backUrl:i,createAccountUrl:o})]})}const i0=8,ld=11;function o0({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 a0(){return c.jsx(c.Fragment,{children:Array.from({length:i0},(e,t)=>c.jsx("tr",{className:"web-trading-widget-terminal__skeleton-row",children:Array.from({length:ld},(n,r)=>c.jsx(o0,{wide:r===ld-1},r))},t))})}const c0={0:"Buy",1:"Sell",2:"Balance",3:"Credit",5:"-"},l0="web-trading-widget-text-buy",d0="web-trading-widget-text-sell",u0="web-trading-widget-terminal__head-row",bo=50;function f0(e){return e===0?l0:e===1?d0:u0}const dd=e=>e.toISOString().split("T")[0],Gp=e=>Math.floor(new Date(e).getTime()/1e3),p0=e=>Gp(e),m0=e=>Gp(e)+86399;function h0(){const e=new Date,t=new Date;return t.setDate(t.getDate()-7),{fromTs:p0(dd(t)),toTs:m0(dd(e))}}const g0=e=>new Date(e*1e3).toLocaleString(void 0,{year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"});function y0(e){try{return decodeURIComponent(e)}catch{return e}}function b0(){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 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:"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 w0({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 ${f0(e.action)}`,children:c0[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:jS(new Date(e.time*1e3))}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--nowrap",children:g0(e.time)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--truncate",children:e.comment?y0(e.comment):"—"})]})}function _0({login:e,detailUrl:t}){const{fromTs:n,toTs:r}=S.useMemo(()=>h0(),[]),s=e!=="",{data:i,isLoading:o}=e0(e,n,r,{enabled:s}),a=(i==null?void 0:i.total)??0,l=Math.max(0,a-bo),d=a>0?Math.min(bo,a):bo,{data:u,isLoading:f}=t0(e,n,r,l,d,{enabled:s}),h=s&&(o||f),m=S.useMemo(()=>[...(u==null?void 0:u.deals)??[]].sort((g,p)=>p.time-g.time),[u==null?void 0:u.deals]);return e?c.jsxs("div",{className:"web-trading-widget-terminal__deals-wrap",children:[c.jsx("div",{className:"web-trading-widget-terminal__body-scroll",children:c.jsxs("table",{className:"web-trading-widget-terminal__deals-table",children:[c.jsx(b0,{}),c.jsx(v0,{}),c.jsxs("tbody",{children:[h?c.jsx(a0,{}):null,!h&&m.length===0?c.jsx("tr",{children:c.jsx("td",{colSpan:11,className:"web-trading-widget-terminal__empty-cell",children:"No deals found"})}):null,h?null:m.map(g=>c.jsx(w0,{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:"More detail"})}):null]}):c.jsx("div",{className:"web-trading-widget-terminal__empty-cell",children:"Select an account to view deal history"})}function qp(e){const t=ve(d=>d.setPositions),n=ve(d=>d.setOrders),{data:r,isLoading:s,isError:i}=ZS(e),{data:o,isLoading:a,isError:l}=YS(e);return S.useEffect(()=>{if(!e.trim()){t([]),n([]);return}r!=null&&t(n0(r,e)),o!=null&&n(r0(o,e))},[e,o,r,n,t]),{isLoading:s||a,isError:!!(i||l)}}const ud=224,fd=32,wc=120;function Zp(){return typeof window>"u"?560:Math.max(wc,Math.floor(window.innerHeight*.7))}function x0(e){return Math.min(Zp(),Math.max(wc,e))}function S0(){const[e,t]=S.useState(ud),[n,r]=S.useState(!1),s=S.useRef(ud);S.useEffect(()=>{s.current=e},[e]);const i=S.useCallback(u=>{t(x0(u))},[]),o=S.useCallback(()=>{i(s.current+fd)},[i]),a=S.useCallback(()=>{i(s.current-fd)},[i]),l=S.useCallback(u=>{const f=u,h=s.current;r(!0);const m=p=>{const y=f-p.clientY;i(h+y)},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]);S.useEffect(()=>{const u=()=>{i(s.current)};return window.addEventListener("resize",u),()=>{window.removeEventListener("resize",u),document.body.style.cursor="",document.body.style.userSelect=""}},[i]);const d=Zp();return{height:e,isResizing:n,canIncrement:e<d,canDecrement:e>wc,onResizeStart:l,incrementHeight:o,decrementHeight:a}}const C0=e=>e==null?void 0:e.replace(/(\d+)\.0{18}/g,"$1"),E0=2e4;let vo=0;function T0(){return vo=(vo+1)%Number.MAX_VALUE,vo.toString()}const wo=new Map,pd=(e,t)=>{if(wo.has(e))return;const n=setTimeout(()=>{wo.delete(e),Br({type:"REMOVE_TOAST",toastId:e})},t||E0);wo.set(e,n)},P0=(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);pd(r,s==null?void 0:s.duration)}else e.toasts.forEach(s=>{pd(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)}}},Vs=[];let Hs={toasts:[]};function Br(e){Hs=P0(Hs,e),Vs.forEach(t=>{t(Hs)})}function Se({duration:e=2e4,description:t,...n}){const r=T0(),s=typeof t=="string"?C0(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 k0(){const[e,t]=w.useState(Hs);return w.useEffect(()=>(Vs.push(t),()=>{const n=Vs.indexOf(t);n>-1&&Vs.splice(n,1)}),[e]),{...e,toast:Se,dismiss:n=>Br({type:"DISMISS_TOAST",toastId:n})}}function A0(e){return e.type==="buy"?e.marketBid??e.currentPrice:e.marketAsk??e.currentPrice}function N0(){const{closePosition:e,deleteOrder:t}=Vi(),n=ve(p=>p.removePosition),r=ve(p=>p.removeOrder),s=ve(p=>p.setSelectedPositionTicket),i=ve(p=>p.setSelectedOrderTicket),[o,a]=S.useState(new Set),[l,d]=S.useState(!1),u=S.useCallback((p,y)=>{a(b=>{const v=new Set(b);return y?v.add(p):v.delete(p),v})},[]),f=S.useCallback(p=>o.has(p),[o]),h=S.useCallback(async p=>{const y=`position-${p.ticket}`;u(y,!0);try{const b=await e(p);if(!b.success){Se({variant:"destructive",description:b.message||"Failed to close position."});return}n(p.ticket),s(null),Se({description:`Position #${p.ticket} closed at ${A0(p).toFixed(p.digits)}.`})}catch(b){const v=b instanceof Error?b.message:"Failed to close position.";Se({variant:"destructive",description:v})}finally{u(y,!1)}},[e,n,u,s]),m=S.useCallback(async p=>{if(p.length===0||l)return;if(!e){Se({variant:"destructive",description:"Close position is not configured."});return}d(!0);let y=0,b=0;for(const v of p){const x=`position-${v.ticket}`;u(x,!0);try{if(!(await e(v)).success){b+=1;continue}n(v.ticket),y+=1}catch{b+=1}finally{u(x,!1)}}s(null),Se(b===0?{description:y===1?"1 position closed.":`${y} positions closed.`}:y===0?{variant:"destructive",description:"Failed to close positions."}:{variant:"destructive",description:`Closed ${y}, failed ${b}.`}),d(!1)},[l,e,n,u,s]),g=S.useCallback(async p=>{const y=`order-${p.ticket}`;u(y,!0);try{const b=await t(p);if(!b.success){Se({variant:"destructive",description:b.message||"Failed to delete order."});return}r(p.ticket),i(null),Se({description:`Order #${p.ticket} deleted.`})}catch(b){const v=b instanceof Error?b.message:"Failed to delete order.";Se({variant:"destructive",description:v})}finally{u(y,!1)}},[t,r,u,i]);return{closePosition:h,closeAllPositions:m,deleteOrder:g,isClosingAll:l,isRowBusy:f}}function Zt(e,t=2){return e.toFixed(t)}function Yp(e){return e.reduce((t,n)=>t+n.profit+n.swap,0)}function O0(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=Yp(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 ia(){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 R0(){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 D0({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(ia,{}),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 L0=[{id:"trade",label:"Trade"},{id:"history",label:"History"}];function j0({activeTab:e,onTabChange:t,positionCount:n,isClosingAll:r,onCloseAllPositions:s}){const i=e==="trade"&&n>0;return c.jsxs("div",{role:"tablist","aria-label":"Terminal panel tabs",className:"web-trading-widget-terminal__tab-bar",children:[L0.map(o=>{const a=e===o.id;return c.jsx("button",{type:"button",role:"tab","aria-selected":a,onClick:()=>t(o.id),className:`web-trading-widget-terminal__tab-btn${a?" web-trading-widget-terminal__tab-btn--active":""}`,children:o.label},o.id)}),c.jsx("div",{className:"web-trading-widget-terminal__toolbar-actions",children:i?c.jsx("button",{type:"button",disabled:r,onClick:s,className:"web-trading-widget-terminal__close-all-btn",children:r?"Closing…":"Close all"}):null})]})}function I0({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:Ee(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?Ee(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?Ee(e.takeProfit,e.digits):"N/A"}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:Ee(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 M0({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:Ee(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?Ee(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?Ee(e.takeProfit,e.digits):"N/A"}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:Ee(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 Qp({embedded:e=!1,symbolTicker:t="",onSymbolChange:n,onCreateNewOrder:r,dealDetailUrl:s}){const[i,o]=S.useState("trade"),a=ls(),{accounts:l,isLoading:d}=Kp(),u=S0(),{height:f,isResizing:h,onResizeStart:m}=e?{height:0,isResizing:!1,onResizeStart:()=>{}}:u,g=ve($=>$.selectedLogin),p=ve($=>$.selectedPositionTicket),y=ve($=>$.selectedOrderTicket),b=ve($=>$.setSelectedPositionTicket),v=ve($=>$.setSelectedOrderTicket),{isLoading:x}=qp(g),_=ve($=>$.positions),C=ve($=>$.orders),{closePosition:P,closeAllPositions:T,deleteOrder:N,isClosingAll:R,isRowBusy:A}=N0(),j=d||x,D=S.useMemo(()=>g?_.filter($=>$.login===g):_,[_,g]),B=S.useMemo(()=>g?C.filter($=>$.login===g):C,[C,g]),O=S.useMemo(()=>{const $=l.find(ye=>ye.login===g);return($==null?void 0:$.tradeStat)??null},[l,g]),H=S.useMemo(()=>D.map($=>$.ticket).sort().join("|"),[D]),U=S.useMemo(()=>O?`${O.balance}:${O.credit??0}:${O.equity}:${O.margin}|${H}`:"",[O,H]),I=S.useMemo(()=>{if(!O||D.length===0)return 0;const $=Yp(D);return O.equity-O.balance-(O.credit??0)-$},[U]),L=S.useMemo(()=>O0(O,D,I),[O,D,I]),M=D.length===0&&B.length===0,K=S.useRef(null),F=S.useRef(null),se=S.useRef(null),z=S.useCallback(()=>{T(D)},[T,D]),de=S.useCallback($=>{const ye=Mv($,a);ye&&(n==null||n(ye))},[n,a]),ue=S.useCallback($=>{b($.ticket),de($.symbol)},[b,de]),ee=S.useCallback($=>{v($.ticket),de($.symbol)},[v,de]),Z=S.useCallback($=>{const ye=K.current,ae=F.current,ie=se.current;if(!ye||!ae)return;const te=$==="header"?ye.scrollLeft:$==="body"?ae.scrollLeft:(ie==null?void 0:ie.scrollLeft)??0;$!=="header"&&(ye.scrollLeft=te),$!=="body"&&(ae.scrollLeft=te),ie&&$!=="footer"&&(ie.scrollLeft=te)},[]);return c.jsxs(c.Fragment,{children:[!e&&h?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:f},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":f,className:"web-trading-widget-terminal__resize-bar",onMouseDown:$=>{$.preventDefault(),m($.clientY)},children:c.jsx(Rf,{className:"web-trading-widget-icon web-trading-widget-icon--sm web-trading-widget-terminal__resize-icon"})})}),c.jsx(j0,{activeTab:i,onTabChange:o,positionCount:D.length,isClosingAll:R,onCloseAllPositions:z}),i==="trade"?c.jsxs(c.Fragment,{children:[c.jsx("div",{ref:K,className:"web-trading-widget-terminal__header-scroll",onScroll:()=>Z("header"),children:c.jsxs("table",{className:"web-trading-widget-terminal__table",children:[c.jsx(ia,{}),c.jsx(R0,{})]})}),c.jsx("div",{ref:F,className:"web-trading-widget-terminal__body-scroll",onScroll:()=>Z("body"),children:c.jsxs("table",{className:"web-trading-widget-terminal__table",children:[c.jsx(ia,{}),c.jsxs("tbody",{children:[j&&M?c.jsx("tr",{children:c.jsx("td",{colSpan:13,className:"web-trading-widget-terminal__empty-cell",children:"Loading…"})}):null,!j&&M?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,D.map($=>c.jsx(I0,{position:$,isSelected:p===$.ticket,isClosing:A(`position-${$.ticket}`),onSelect:()=>ue($),onClose:()=>void P($)},`position-${$.ticket}`)),B.map($=>c.jsx(M0,{order:$,isSelected:y===$.ticket,isDeleting:A(`order-${$.ticket}`),onSelect:()=>ee($),onDelete:()=>void N($)},`order-${$.ticket}`))]})]})})]}):c.jsx(_0,{login:g??"",detailUrl:s}),c.jsx(D0,{balance:L.balance,equity:L.equity,margin:L.margin,marginFree:L.marginFree,marginLevel:L.marginLevel,totalPnL:L.totalProfit,scrollRef:i==="trade"?se:void 0,onScroll:i==="trade"?()=>Z("footer"):void 0})]})]})}const oa=224,ci=120;function F0(e){var n;const t=(n=e==null?void 0:e.current)==null?void 0:n.clientHeight;return t&&t>0?Math.max(ci,Math.floor(t*.35)):oa}function U0(e){var n;const t=(n=e==null?void 0:e.current)==null?void 0:n.clientHeight;return t&&t>0?Math.max(ci,Math.floor(t*.85)):typeof window>"u"?560:Math.max(ci,Math.floor(window.innerHeight*.7))}function B0(e,t){return Math.min(U0(t),Math.max(ci,e))}function $0({containerRef:e,isOpen:t=!1}={}){const[n,r]=S.useState(oa),[s,i]=S.useState(!1),o=S.useRef(oa);S.useEffect(()=>{o.current=n},[n]);const a=S.useCallback(d=>{r(B0(d,e))},[e]);S.useEffect(()=>{if(!t)return;const d=Math.max(o.current,F0(e));a(d)},[e,t,a]);const l=S.useCallback(d=>{const u=d,f=o.current;i(!0);const h=g=>{const p=u-g.clientY;a(f+p)},m=()=>{i(!1),document.removeEventListener("mousemove",h),document.removeEventListener("mouseup",m),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",h),document.addEventListener("mouseup",m),document.body.style.cursor="row-resize",document.body.style.userSelect="none"},[a]);return S.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 Xp({children:e}){const[t]=S.useState(()=>new mS({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}}));return c.jsx(hS,{client:t,children:e})}function Jp({containerRef:e,onCreateNewOrder:t}){const[n,r]=S.useState(!1),{height:s,isResizing:i,onResizeStart:o}=$0({containerRef:e,isOpen:n}),a=ve(g=>g.selectedLogin),l=ve(g=>g.orders),d=ve(g=>g.positions),u=S.useMemo(()=>a?l.filter(g=>g.login===a):l,[a,l]),f=S.useMemo(()=>a?d.filter(g=>g.login===a):d,[a,d]),h=u.length+f.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(Sv,{className:"web-trading-widget-icon web-trading-widget-icon--sm"}),c.jsx("span",{children:"Orders"}),h>0?c.jsx("span",{className:"web-trading-widget-news-orders-overlay__badge",children:h}):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(Rf,{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(Qp,{embedded:!0,onCreateNewOrder:t?m:void 0})})]})}):null]})}function V0({baseUrl:e,containerRef:t,onCreateNewOrder:n}){return c.jsx(Xp,{children:c.jsx(_p,{baseUrl:e,children:c.jsx(Jp,{containerRef:t,onCreateNewOrder:n})})})}const Rn=S.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 Hi="Collapsible",[H0,em]=$n(Hi),[z0,_c]=H0(Hi),tm=w.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:s,disabled:i,onOpenChange:o,...a}=e,[l,d]=Dn({prop:r,defaultProp:s??!1,onChange:o,caller:Hi});return c.jsx(z0,{scope:n,disabled:i,contentId:on(),open:l,onOpenToggle:w.useCallback(()=>d(u=>!u),[d]),children:c.jsx(me.div,{"data-state":Sc(l),"data-disabled":i?"":void 0,...a,ref:t})})});tm.displayName=Hi;var nm="CollapsibleTrigger",rm=w.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,s=_c(nm,n);return c.jsx(me.button,{type:"button","aria-controls":s.open?s.contentId:void 0,"aria-expanded":s.open||!1,"data-state":Sc(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:t,onClick:pe(e.onClick,s.onOpenToggle)})});rm.displayName=nm;var xc="CollapsibleContent",sm=w.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=_c(xc,e.__scopeCollapsible);return c.jsx(Vn,{present:n||s.open,children:({present:i})=>c.jsx(W0,{...r,ref:t,present:i})})});sm.displayName=xc;var W0=w.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:s,...i}=e,o=_c(xc,n),[a,l]=w.useState(r),d=w.useRef(null),u=Pe(t,d),f=w.useRef(0),h=f.current,m=w.useRef(0),g=m.current,p=o.open||a,y=w.useRef(p),b=w.useRef(void 0);return w.useEffect(()=>{const v=requestAnimationFrame(()=>y.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 x=v.getBoundingClientRect();f.current=x.height,m.current=x.width,y.current||(v.style.transitionDuration=b.current.transitionDuration,v.style.animationName=b.current.animationName),l(r)}},[o.open,r]),c.jsx(me.div,{"data-state":Sc(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!p,...i,ref:u,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...e.style},children:p&&s})});function Sc(e){return e?"open":"closed"}var K0=tm,G0=rm,q0=sm,wt="Accordion",Z0=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[Cc,Y0,Q0]=Da(wt),[zi]=$n(wt,[Q0,em]),Ec=em(),im=w.forwardRef((e,t)=>{const{type:n,...r}=e,s=r,i=r;return c.jsx(Cc.Provider,{scope:e.__scopeAccordion,children:n==="multiple"?c.jsx(tC,{...i,ref:t}):c.jsx(eC,{...s,ref:t})})});im.displayName=wt;var[om,X0]=zi(wt),[am,J0]=zi(wt,{collapsible:!1}),eC=w.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},collapsible:i=!1,...o}=e,[a,l]=Dn({prop:n,defaultProp:r??"",onChange:s,caller:wt});return c.jsx(om,{scope:e.__scopeAccordion,value:w.useMemo(()=>a?[a]:[],[a]),onItemOpen:l,onItemClose:w.useCallback(()=>i&&l(""),[i,l]),children:c.jsx(am,{scope:e.__scopeAccordion,collapsible:i,children:c.jsx(cm,{...o,ref:t})})})}),tC=w.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},...i}=e,[o,a]=Dn({prop:n,defaultProp:r??[],onChange:s,caller:wt}),l=w.useCallback(u=>a((f=[])=>[...f,u]),[a]),d=w.useCallback(u=>a((f=[])=>f.filter(h=>h!==u)),[a]);return c.jsx(om,{scope:e.__scopeAccordion,value:o,onItemOpen:l,onItemClose:d,children:c.jsx(am,{scope:e.__scopeAccordion,collapsible:!0,children:c.jsx(cm,{...i,ref:t})})})}),[nC,Wi]=zi(wt),cm=w.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:r,dir:s,orientation:i="vertical",...o}=e,a=w.useRef(null),l=Pe(a,t),d=Y0(n),f=Lu(s)==="ltr",h=pe(e.onKeyDown,m=>{var N;if(!Z0.includes(m.key))return;const g=m.target,p=d().filter(R=>{var A;return!((A=R.ref.current)!=null&&A.disabled)}),y=p.findIndex(R=>R.ref.current===g),b=p.length;if(y===-1)return;m.preventDefault();let v=y;const x=0,_=b-1,C=()=>{v=y+1,v>_&&(v=x)},P=()=>{v=y-1,v<x&&(v=_)};switch(m.key){case"Home":v=x;break;case"End":v=_;break;case"ArrowRight":i==="horizontal"&&(f?C():P());break;case"ArrowDown":i==="vertical"&&C();break;case"ArrowLeft":i==="horizontal"&&(f?P():C());break;case"ArrowUp":i==="vertical"&&P();break}const T=v%b;(N=p[T].ref.current)==null||N.focus()});return c.jsx(nC,{scope:n,disabled:r,direction:s,orientation:i,children:c.jsx(Cc.Slot,{scope:n,children:c.jsx(me.div,{...o,"data-orientation":i,ref:l,onKeyDown:r?void 0:h})})})}),li="AccordionItem",[rC,Tc]=zi(li),lm=w.forwardRef((e,t)=>{const{__scopeAccordion:n,value:r,...s}=e,i=Wi(li,n),o=X0(li,n),a=Ec(n),l=on(),d=r&&o.value.includes(r)||!1,u=i.disabled||e.disabled;return c.jsx(rC,{scope:n,open:d,disabled:u,triggerId:l,children:c.jsx(K0,{"data-orientation":i.orientation,"data-state":hm(d),...a,...s,ref:t,disabled:u,open:d,onOpenChange:f=>{f?o.onItemOpen(r):o.onItemClose(r)}})})});lm.displayName=li;var dm="AccordionHeader",um=w.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=Wi(wt,n),i=Tc(dm,n);return c.jsx(me.h3,{"data-orientation":s.orientation,"data-state":hm(i.open),"data-disabled":i.disabled?"":void 0,...r,ref:t})});um.displayName=dm;var aa="AccordionTrigger",fm=w.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=Wi(wt,n),i=Tc(aa,n),o=J0(aa,n),a=Ec(n);return c.jsx(Cc.ItemSlot,{scope:n,children:c.jsx(G0,{"aria-disabled":i.open&&!o.collapsible||void 0,"data-orientation":s.orientation,id:i.triggerId,...a,...r,ref:t})})});fm.displayName=aa;var pm="AccordionContent",mm=w.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=Wi(wt,n),i=Tc(pm,n),o=Ec(n);return c.jsx(q0,{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}})});mm.displayName=pm;function hm(e){return e?"open":"closed"}var sC=im,iC=lm,oC=um,gm=fm,ym=mm;const aC=sC,qn=w.forwardRef(({className:e,...t},n)=>c.jsx(iC,{ref:n,className:Ce("border-b",e),...t}));qn.displayName="AccordionItem";const Zn=w.forwardRef(({className:e,children:t,...n},r)=>c.jsx(oC,{className:"flex",children:c.jsxs(gm,{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(Xa,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"})]})}));Zn.displayName=gm.displayName;const Yn=w.forwardRef(({className:e,children:t,...n},r)=>c.jsx(ym,{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})}));Yn.displayName=ym.displayName;function md(e){const t=e.trim().replace(/,/g,"");if(!t)return null;const n=Number(t);return Number.isFinite(n)?n:null}function hd(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 u=t.trim()!=="",f=g=>{if(l)return;const p=md(t),y=a!=null&&Number.isFinite(a)?a:s??0,v=(p??y)+g*r,x=s!==void 0?Math.max(s,v):v;x<=0||n(hd(x,i))},h=()=>{const g=md(t);if(g===null||g<=0){t.trim()!==""&&n("");return}n(hd(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&&u?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:()=>f(-1),children:c.jsx(Ev,{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:h,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:()=>f(1),children:c.jsx(Tv,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})]})]})}function cC({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,embedded:d=!1,onMinimize:u,onClose:f,onPlaceOrder:h}){const[m,g]=S.useState("market"),[p,y]=S.useState(String(r)),[b,v]=S.useState(""),[x,_]=S.useState(""),C=oe(re=>re.stopLoss),P=oe(re=>re.takeProfit),T=oe(re=>re.setStopLoss),N=oe(re=>re.setTakeProfit),R=oe(re=>re.setVolumeLots),A=oe(re=>re.setOrderSide),[j,D]=S.useState(""),[B,O]=S.useState(ft.GTC),[H,U]=S.useState(""),[I,L]=S.useState(""),M=Number(Vt(Ht(e))),K=Pr(M),F=Ff(t,n),se=t!==null?Ee(t,M):"—",z=n!==null?Ee(n,M):"—",de=Ri(m),ue=jf(m),ee=Oi(m),Z=ee.label,$=!de&&ee.orderType!==null&&ee.orderType%2===1,ye=S.useMemo(()=>F!==null?F:t??n,[n,t,F]),ae=re=>{y(re);const $e=Number(re);Number.isFinite($e)&&$e>0&&R($e)},ie=re=>t===null||n===null?null:de?re==="buy"?n:t:pt(b)??(re==="buy"?n:t),te=re=>{const $e=ie(re);$e!==null&&A({side:re,entryPrice:$e})},je=re=>{if(t===null||n===null||!l)return;const $e=Math.max(i,Number(p)||i),qi=Mo(m,re),us=ie(re);us!==null&&A({side:re,entryPrice:us}),h({login:l,executionMode:m,side:re,orderType:qi,volumeLots:$e,stopLoss:C,takeProfit:P,priceOrder:b,priceTrigger:x,comment:j,typeTime:B,expirationDateTime:H,expirationDay:I,bid:t,ask:n})},Re=t!==null&&n!==null,Ne=de||pt(b)!==void 0,X=!ue||pt(x)!==void 0,ke=de||Li(B,H,I),Fe=!o&&!a&&l!==""&&Re&&Ne&&X&&ke,Qe=!de&&sc(B),ct=!de&&ic(B);return c.jsxs("div",{className:"web-trading-widget-market-panel",children:[c.jsxs("div",{className:"web-trading-widget-market-panel__header",children:[c.jsxs(Xs,{value:m,onValueChange:re=>g(re),children:[c.jsx(Vr,{className:"web-trading-widget-market-panel__select-trigger",children:c.jsx(Js,{})}),c.jsx(Hr,{children:ti.map(re=>c.jsx(zr,{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:u,children:c.jsx(Cv,{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:f,children:c.jsx(gn,{className:"web-trading-widget-icon web-trading-widget-icon--md"})})]})]}),c.jsxs(aC,{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(Zn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Volume Setting"}),c.jsx(Yn,{className:"web-trading-widget-market-panel__accordion-content",children:c.jsx(De,{label:"Lots",value:p,onChange:ae,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(Zn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Order Price"}),c.jsx(Yn,{className:"web-trading-widget-market-panel__accordion-content",children:ue?c.jsxs(c.Fragment,{children:[c.jsx(De,{label:"Stop Price",value:x,onChange:_,step:K,decimals:M,basePrice:ye,placeholder:F!==null?Ee(F,M):"—"}),c.jsx(De,{label:"Limit Price",value:b,onChange:v,step:K,decimals:M,basePrice:ye,placeholder:F!==null?Ee(F,M):"—"})]}):c.jsx(De,{label:"Price",value:b,onChange:v,step:K,decimals:M,basePrice:ye,placeholder:F!==null?Ee(F,M):"—"})})]}),c.jsxs(qn,{value:"risk-management",className:"web-trading-widget-market-panel__accordion-item",children:[c.jsx(Zn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Risk Management"}),c.jsx(Yn,{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:C,onChange:T,step:K,decimals:M,basePrice:t,placeholder:t!==null?se:"—",clearable:!0}),c.jsx(De,{label:"Take Profit",value:P,onChange:N,step:K,decimals:M,basePrice:n,placeholder:n!==null?z:"—",clearable:!0})]})})]}),de?null:c.jsxs(qn,{value:"expiration",className:"web-trading-widget-market-panel__accordion-item",children:[c.jsx(Zn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Expiration"}),c.jsxs(Yn,{className:"web-trading-widget-market-panel__accordion-content",children:[c.jsxs(Xs,{value:String(B),onValueChange:re=>O(Number(re)),children:[c.jsx(Vr,{className:"web-trading-widget-market-panel__select-full",children:c.jsx(Js,{})}),c.jsx(Hr,{children:If.map(re=>c.jsx(zr,{value:String(re.value),children:re.label},re.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:H,onChange:re=>U(re.target.value)})]}):null,ct?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:I,onChange:re=>L(re.target.value)})]}):null]})]}),c.jsxs(qn,{value:"comment",className:"web-trading-widget-market-panel__accordion-item",children:[c.jsx(Zn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Comment"}),c.jsx(Yn,{className:"web-trading-widget-market-panel__accordion-content",children:c.jsx(Rn,{value:j,onChange:re=>D(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:se}),c.jsx("span",{className:"web-trading-widget-market-panel__quotes-ask",children:z})]}),de?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:!Fe,onMouseDown:()=>te("sell"),onClick:()=>je("sell"),children:"Sell by Market"}),c.jsx(ot,{type:"button",className:"web-trading-widget-market-panel__buy-btn",disabled:!Fe,onMouseDown:()=>te("buy"),onClick:()=>je("buy"),children:"Buy by Market"})]}):c.jsxs(ot,{type:"button",variant:$?"destructive":"default",className:`web-trading-widget-market-panel__place-btn${$?"":" web-trading-widget-market-panel__place-btn--buy"}`,disabled:!Fe,onMouseDown:()=>{const re=ee.orderType!==null&&ee.orderType%2===1?"sell":"buy";te(re)},onClick:()=>{const re=ee.orderType!==null&&ee.orderType%2===1?"sell":"buy";je(re)},children:["Place ",Z]})]})]})}function bm({confirmation:e,symbolTicker:t,onDismiss:n}){const r=Number(Vt(Ht(t))),s=Ee(e.price,r),i=e.side==="sell"?"sell":"buy",o=Ni(e.symbol||Di(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 As(e,t){return e.toLocaleString(void 0,{minimumFractionDigits:t,maximumFractionDigits:t})}function _o(e){const t=e.trim();if(!t)return;const n=Number(t);return Number.isFinite(n)?n:void 0}function vm({order:e,onClose:t}){const{deleteOrder:n,modifyOrder:r}=Vi(),s=ve(I=>I.removeOrder),[i,o]=S.useState(String(e.volumeLots)),[a,l]=S.useState(String(e.orderPrice)),[d,u]=S.useState(e.priceTrigger!==void 0?String(e.priceTrigger):""),f=oe(I=>I.stopLoss),h=oe(I=>I.takeProfit),m=oe(I=>I.setStopLoss),g=oe(I=>I.setTakeProfit),p=oe(I=>I.setDraft),y=oe(I=>I.clearDraft),[b,v]=S.useState(e.comment),[x,_]=S.useState(!1),[C,P]=S.useState(!1),T=Pr(e.digits);S.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:T}),()=>{y()}),[y,e.digits,e.orderPrice,e.side,e.stopLoss,e.takeProfit,e.volumeLots,T,p]);const N=rc(e.orderType),R=e.volumeLots,A=Number(a)||e.orderPrice,j=_o(d),D=x||C,B=!N||j!==void 0&&Number.isFinite(A)&&A>0,O=S.useMemo(()=>`Delete #${e.ticket} ${e.typeLabel} ${R.toFixed(2)} ${e.displaySymbol} at ${As(A,e.digits)}`,[e,A,R]),H=async()=>{if(!B){Se({variant:"destructive",description:N?"Please set both stop and limit prices.":"Please set an order price."});return}_(!0);try{const I=await r(e,{volumeLots:R,priceOrder:A,priceTrigger:N?j:void 0,stopLoss:_o(f),takeProfit:_o(h),comment:b.trim()||"order modify"});if(!I.success){Se({variant:"destructive",description:I.message||"Failed to modify order."});return}t(),Se({description:`Order #${e.ticket} updated.`})}catch(I){const L=I instanceof Error?I.message:"Failed to modify order.";Se({variant:"destructive",description:L})}finally{_(!1)}},U=async()=>{P(!0);try{const I=await n(e);if(!I.success){Se({variant:"destructive",description:I.message||"Failed to delete order."});return}s(e.ticket),t(),Se({description:`Order #${e.ticket} deleted.`})}catch(I){const L=I instanceof Error?I.message:"Failed to delete order.";Se({variant:"destructive",description:L})}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," ",R.toFixed(2)," / ",e.volumeFilledLots.toFixed(2)," ",e.displaySymbol," ",N&&j!==void 0?`${As(j,e.digits)} / ${As(A,e.digits)}`:As(A,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}),N?c.jsxs(c.Fragment,{children:[c.jsx(De,{label:"Stop Price",value:d,onChange:u,step:T,decimals:e.digits,basePrice:e.currentPrice}),c.jsx(De,{label:"Limit Price",value:a,onChange:l,step:T,decimals:e.digits,basePrice:e.currentPrice})]}):c.jsx(De,{label:"Price",value:a,onChange:l,step:T,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:f,onChange:m,step:T,decimals:e.digits,basePrice:e.currentPrice,placeholder:"—"}),c.jsx(De,{label:"Take Profit",value:h,onChange:g,step:T,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:I=>v(I.target.value)})]}),c.jsx(ot,{type:"button",variant:"secondary",className:"web-trading-widget-detail-panel__btn-full",disabled:D||!B,onClick:()=>void H(),children:"Modify"}),c.jsx(ot,{type:"button",className:"web-trading-widget-detail-panel__action-btn",disabled:D,onClick:()=>void U(),children:O})]})]})}function Ns(e,t){return e.toLocaleString(void 0,{minimumFractionDigits:t,maximumFractionDigits:t})}function lC(e){return e.type==="buy"?e.marketBid??e.currentPrice:e.marketAsk??e.currentPrice}function wm({position:e,onClose:t}){const{closePosition:n}=Vi(),r=ve(C=>C.removePosition),[s,i]=S.useState(String(e.volumeLots)),o=oe(C=>C.stopLoss),a=oe(C=>C.takeProfit),l=oe(C=>C.setStopLoss),d=oe(C=>C.setTakeProfit),u=oe(C=>C.setDraft),f=oe(C=>C.clearDraft),[h,m]=S.useState(e.comment),[g,p]=S.useState(!1),y=Pr(e.digits);S.useEffect(()=>(u({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:y}),()=>{f()}),[f,e.digits,e.openPrice,e.stopLoss,e.takeProfit,e.type,e.volumeLots,y,u]);const b=lC(e),v=e.volumeLots,x=S.useMemo(()=>{const C=e.profit.toFixed(2);return`Close #${e.ticket} ${e.type} ${v.toFixed(2)} ${e.displaySymbol} ${Ns(e.openPrice,e.digits)} at ${Ns(b,e.digits)} with Profit ${C}`},[b,e,v]),_=async()=>{p(!0);try{const C=await n(e);if(!C.success){Se({variant:"destructive",description:C.message||"Failed to close position."});return}r(e.ticket),t(),Se({description:`Position #${e.ticket} closed.`})}catch(C){const P=C instanceof Error?C.message:"Failed to close position.";Se({variant:"destructive",description:P})}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," ",Ns(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:Ns(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:y,decimals:e.digits,basePrice:e.marketBid??e.openPrice,placeholder:"—"}),c.jsx(De,{label:"Take Profit",value:a,onChange:d,step:y,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:h,onChange:C=>m(C.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 _(),children:x})]})]})}function gd({symbolTicker:e,orderState:t}){const n=hc(e),{confirmation:r,isSubmitting:s,defaultVolumeLots:i,volumeStep:o,minVolumeLots:a,selectedLogin:l,isAccountsLoading:d,hasConfirmedAccount:u,dismissConfirmation:f,placeMarketOrder:h}=t,m=ve(T=>T.positions),g=ve(T=>T.orders),p=ve(T=>T.selectedPositionTicket),y=ve(T=>T.selectedOrderTicket),b=ve(T=>T.setSelectedPositionTicket),v=ve(T=>T.setSelectedOrderTicket),x=p!==null?m.find(T=>T.ticket===p)??null:null,_=y!==null?g.find(T=>T.ticket===y)??null:null,C=r!==null,P=S.useCallback(T=>{h({symbolTicker:e,login:T.login,executionMode:T.executionMode,side:T.side,orderType:T.orderType,volumeLots:T.volumeLots,stopLoss:T.stopLoss,takeProfit:T.takeProfit,priceOrder:T.priceOrder,priceTrigger:T.priceTrigger,comment:T.comment,typeTime:T.typeTime,expirationDateTime:T.expirationDateTime,expirationDay:T.expirationDay,bid:T.bid,ask:T.ask})},[h,e]);return x!==null?c.jsx(wm,{position:x,onClose:()=>b(null)}):_!==null?c.jsx(vm,{order:_,onClose:()=>v(null)}):C&&r!==null?c.jsx(bm,{confirmation:r,symbolTicker:e,onDismiss:f}):u?c.jsx(cC,{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:P}):c.jsx("div",{className:"web-trading-widget-side-panel__empty",children:"Select a trading account to start placing orders."})}function yd({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 dC({symbolTicker:e,orderState:t,scanResultUrl:n,onScanResultLoad:r,initialTab:s="trade"}){const i=!!n,[o,a]=S.useState(s);return c.jsx("aside",{className:`web-trading-widget-side-panel${i?" web-trading-widget-side-panel--with-scan":""}`,children:i?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(yd,{label:"Trade",isActive:o==="trade",onClick:()=>a("trade")}),c.jsx(yd,{label:"Scan Result",isActive:o==="scan",onClick:()=>a("scan")})]}),c.jsxs("div",{className:"web-trading-widget-side-panel__panels",children:[c.jsx("div",{role:"tabpanel",hidden:o!=="trade",className:"web-trading-widget-side-panel__tabpanel",children:c.jsx(gd,{symbolTicker:e,orderState:t})}),c.jsx("div",{role:"tabpanel",hidden:o!=="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(gd,{symbolTicker:e,orderState:t})})})}const uC=.01,fC=.01,bd=.01;function pC({symbols:e,defaultPanelAfterConfirm:t="mini"}){const[n,r]=S.useState("closed"),[s,i]=S.useState(null),[o,a]=S.useState(!1),[l,d]=S.useState(!1),[u,f]=S.useState(null),h=ve(A=>A.setSelectedLogin),{accounts:m,isLoading:g}=Kp(),{submitOrder:p}=Vi(),y=S.useMemo(()=>jv(m),[m]),b=S.useMemo(()=>Iv(m),[m]),v=S.useMemo(()=>u!==null&&y.some(A=>A.login===u)?u:b,[y,b,u]);S.useEffect(()=>{v&&h(v)},[v,h]);const x=S.useCallback(A=>{f(A),h(A)},[h]),_=S.useCallback(A=>{A&&(x(A),d(!0),i(null),r(t))},[t,x]),C=S.useCallback(()=>{i(null),r("market")},[]),P=S.useCallback(()=>{i(null),r("mini")},[]),T=S.useCallback(()=>{i(null),r("mini")},[]),N=S.useCallback(()=>{i(null),r("mini")},[]),R=S.useCallback(async A=>{const j=A.login.trim();if(!j){Se({variant:"destructive",description:"Please select a trading account."});return}const D=Math.max(bd,A.volumeLots),B=Di(A.symbolTicker,e);Number(Vt(Ht(A.symbolTicker,e)));const O=Ri(A.executionMode),H=rc(A.orderType),U=pt(A.priceOrder),I=pt(A.priceTrigger);if(!O&&U===void 0){Se({variant:"destructive",description:H?"Please set a limit price for this order.":"Please set an order price for pending orders."});return}if(H&&I===void 0){Se({variant:"destructive",description:"Please set a stop price for stop limit orders."});return}if(!O&&!Li(A.typeTime,A.expirationDateTime,A.expirationDay)){Se({variant:"destructive",description:"Please set an expiration date for this order."});return}const L=O?A.side==="buy"?A.ask:A.bid:U??(A.side==="buy"?A.ask:A.bid);a(!0);try{const M=await p({login:j,symbolTicker:A.symbolTicker,executionMode:A.executionMode,side:ni(A.orderType),orderType:A.orderType,volumeLots:D,stopLoss:pt(A.stopLoss),takeProfit:pt(A.takeProfit),priceOrder:nc(A.orderType)?U:void 0,priceTrigger:H?I:void 0,comment:A.comment.trim(),typeTime:A.typeTime,expirationDateTime:A.expirationDateTime,expirationDay:A.expirationDay,bid:A.bid,ask:A.ask});if(!M.success){Se({variant:"destructive",description:M.message||"Order was not accepted."});return}i({ticket:M.ticket??"",side:M.side??ni(A.orderType),volumeLots:M.volumeLots??D,symbol:M.displaySymbol??B,price:M.price??L}),r("confirmation")}catch(M){const K=M instanceof Error?M.message:"Failed to place order.";Se({variant:"destructive",description:K})}finally{a(!1)}},[p,e]);return{panel:n,confirmation:s,isSubmitting:o,defaultVolumeLots:uC,volumeStep:fC,minVolumeLots:bd,accountOptions:y,selectedLogin:v,setSelectedLogin:x,isAccountsLoading:g,hasConfirmedAccount:l,confirmAccountSelection:_,openMarketPanel:C,openMiniPanel:P,closePanels:T,dismissConfirmation:N,placeMarketOrder:R}}function di(e){var t;if(typeof window<"u"){const n=localStorage.getItem(Xn);if(n&&e.some(r=>r.ticker===n))return n}return((t=e[0])==null?void 0:t.ticker)??"XAU_USD"}function ca(e,t,n){var r;return((r=t.find(s=>s.display_name===e||s.ticker===e))==null?void 0:r.ticker)??n}function mC({chartWidget:e,symbols:t,chartSlotElement:n,onSymbolTickerChange:r,onScanResultUrlChange:s,selectSymbolTickerRef:i}){const o=S.useMemo(()=>di(t),[t]),a=S.useRef(o),l=S.useRef(e),[d,u]=S.useState(null);S.useEffect(()=>{l.current=e},[e]),S.useEffect(()=>{if(!n){u(null);return}const h=()=>{const g=n.querySelector(":scope > div");u(g)};h();const m=new MutationObserver(h);return m.observe(n,{childList:!0}),()=>{m.disconnect()}},[n]);const f=S.useCallback(h=>{if(h===a.current)return;const m=t.find(p=>p.ticker===h);if(!m)return;a.current=h,localStorage.setItem(Xn,h),r(h),s(null);const g=l.current;if(g)try{g.onChartReady(()=>{g.activeChart().setSymbol(m.ticker)})}catch{}},[s,r,t]);return S.useEffect(()=>(i.current=f,()=>{i.current=null}),[f,i]),S.useEffect(()=>{if(!e)return;let h=!1,m=null;try{e.onChartReady(()=>{if(h)return;let g;try{g=e.activeChart()}catch{return}const p=v=>{const x=g.symbol(),_=ca(x,t,o);_!==a.current&&s(null);try{e.resetCache()}catch{}a.current=_,localStorage.setItem(Xn,_),r(_)},y=g.symbol(),b=ca(y,t,o);b!==a.current&&(a.current=b,localStorage.setItem(Xn,b),r(b)),g.onSymbolChanged().subscribe(null,p),m=()=>{try{g.onSymbolChanged().unsubscribe(null,p)}catch{}}})}catch{}return()=>{h=!0,m==null||m()}},[e,s,r,o,t]),{chartContainer:d}}const hC=xa("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 gC({className:e,variant:t,...n}){return c.jsx("div",{className:Ce(hC({variant:t}),e),...n})}function _m(){var t;const e=(t=window.TradingView)==null?void 0:t.widget;return typeof e=="function"?e:null}function zs(){return _m()!==null}const vd="/charting_library/charting_library.js";function yC({onLoad:e}){return S.useEffect(()=>{if(zs()){e();return}const t=document.querySelector(`script[src="${vd}"]`);if(t){const r=()=>{zs()&&e()};return t.addEventListener("load",r),()=>t.removeEventListener("load",r)}const n=document.createElement("script");return n.src=vd,n.async=!1,n.onload=()=>{zs()&&e()},n.onerror=()=>{console.error("Failed to load TradingView charting library")},document.head.appendChild(n),()=>{n.onload=null,n.onerror=null}},[e]),null}const wd=ji(e=>({playEndTimestamp:null,setPlayEndTimestamp:t=>e({playEndTimestamp:t})})),xm=ji(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})})),la=8,Sm=4,da=5,ua=e=>e==="1"?60:e==="5"?300:e==="1D"?1440*3600:parseInt(e,10)*60,bC=e=>{const t=new Date(e+la*60*60*1e3),n=t.getUTCDay(),r=t.getUTCHours();return n===0?!1:n===1?r>=da:n===6?r<=Sm:!0},vC=e=>{const t=new Date(e+la*60*60*1e3),n=t.getUTCDay(),r=t.getUTCHours();if(n===0||n===1&&r<da||n===6&&r>=Sm){const s=(8-n)%7;return t.setUTCDate(t.getUTCDate()+s),t.setUTCHours(da,0,0,0),t.getTime()-la*60*60*1e3}return e},wC=(e,t,n)=>{const r=ua(t)*1e3,s=[];let i=e;for(let o=0;o<n;o++)i+=r,bC(i)||(i=vC(i)),s.push(i);return s},_C=(e,t,n,r)=>{if(n<=0)return[];if(r==="24x7"){const i=ua(t)*1e3;return Array.from({length:n},(o,a)=>e+(a+1)*i)}if(r==="1700-1700")return wC(e,t,n);const s=ua(t)*1e3;return Array.from({length:n},(i,o)=>e+(o+1)*s)},xC=(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},_d="wss://symbols.opheleo.com";function SC(e){return{1:6e4,5:3e5,15:9e5,30:18e5,60:36e5,240:144e5}[e]??6e4}function xd(e){return e.trim().toUpperCase()}function CC(e,t){return Math.floor(e/t)*t}let jr;async function EC(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),Ae({baseURL:"https://corprate-widget.iccandle.ai",url:`/chart/endTimestamp?${t.toString()}`,method:"GET"})}class TC{constructor(t,n,r=Bt,s=_d){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||_d}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 f;const o=(f=t.library_custom_fields)==null?void 0:f.ticker,a=this.symbols.find(h=>o!==void 0&&h.ticker===o||h.ticker===t.ticker||h.display_name===t.name||h.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 u=wd.getState().playEndTimestamp;u&&(l.endTimestamp=u,wd.getState().setPlayEndTimestamp(null),jr=void 0),(async()=>{var h;try{const{data:m}=await EC(l);if(m.data_status==="threshold_limited"){s([],{noData:!0});return}if(m.data_status==="end_of_data"){s([],{noData:!0});return}if(!((h=m.items)!=null&&h.length)){s([],{noData:!0});return}jr=m.last_evaluated_key;const p=[...m.items].map(x=>({open:x.o,high:x.h,low:x.l,close:x.c,time:xC(x.timestamp,n)})),y=xm.getState(),{gapCount:b,isReplayMode:v}=y;if(v&&event){const x=_C(p[p.length-1].time,n,b||0,t.session);if(x.length>0){const _=p[p.length-1].close;for(const C of x)p.push({open:_,high:_,low:_,close:_,time:C})}}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 f;const o=(f=t.library_custom_fields)==null?void 0:f.ticker,a=this.symbols.find(h=>o!==void 0&&h.ticker===o||h.display_name===t.ticker||h.display_name===t.name),l=a!=null&&a.resolve_symbol?xd(a.resolve_symbol):xd(t.ticker||t.name||""),d=SC(n),u=`${l}|${n}`;this.subscriptions.set(s,{symbol:l,resolution:n,periodMs:d,onTick:r,onResetCacheNeededCallback:i,liveCandle:this.lastBarsCache.get(u)??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=CC(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),(f=>{var h,m;(m=(h=this.futureBarsRef)==null?void 0:h.current)!=null&&m.length||o.onTick(f)})(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:u})=>{!a||!Number.isFinite(l)||l<=0||i.some(f=>String(f.id)===String(a))||i.push({id:a,time:l/1e3,color:"green",label:d.slice(0,1)||"N",tooltip:[d],...u?{imageUrl:`/images/symbols/${u}.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:u,forecast:f,previous:h,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: ${f||"-"}`,`Previous Forecast: ${h||"-"}`,`Previous Actual: ${m||"-"}`],...u?{imageUrl:`https://cdn.iccandle.ai/web-assets/${u??"USD"}.svg`}:{}})}catch{}s(i)}}const PC=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(h=>h.time===r))return[i,o,a,l,Number.NaN,Number.NaN,Number.NaN];const f=l<i?1:0;return[i,o,a,l,f,f,f]}}};return Promise.resolve([t])},fa="An unknown error occurred",Ws=e=>{if(typeof e=="string")return e;if(typeof e!="object"||e===null)return fa;if(typeof e.message=="string")return e.message;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const n=Ws(e[t]);if(n)return n}return fa},kC=e=>{var t;if(bp(e)){const n=(t=e.response)!=null&&t.data?Ws(e.response.data):void 0;return n&&n!==fa?n:Ws(e)}return Ws(e)},AC=({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 Se({variant:"destructive",title:"Error",description:kC(bp(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 Sd;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(Sd||(Sd={}));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}},V=_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 pa=(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,_e.jsonStringifyReplacer)}`;break;case V.unrecognized_keys:n=`Unrecognized key(s) in object: ${_e.joinValues(e.keys,", ")}`;break;case V.invalid_union:n="Invalid input";break;case V.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${_e.joinValues(e.options)}`;break;case V.invalid_enum_value:n=`Invalid enum value. Expected ${_e.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}"`:_e.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,_e.assertNever(e)}return{message:n}};let NC=pa;function OC(){return NC}const RC=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=OC(),r=RC({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===pa?void 0:pa].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 ce;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 ce;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 ce=Object.freeze({status:"aborted"}),Ur=e=>({status:"dirty",value:e}),at=e=>({status:"valid",value:e}),Cd=e=>e.status==="aborted",Ed=e=>e.status==="dirty",vr=e=>e.status==="valid",ui=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 Td=(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 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(ui(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 Td(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(ui(s)?s:Promise.resolve(s));return Td(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:le.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 hi.create(this,this._def)}or(t){return pi.create([this,t],this._def)}and(t){return mi.create(this,t,this._def)}transform(t){return new xr({...fe(this._def),schema:this,typeName:le.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new ga({...fe(this._def),innerType:this,defaultValue:n,typeName:le.ZodDefault})}brand(){return new tE({typeName:le.ZodBranded,type:this,...fe(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new ya({...fe(this._def),innerType:this,catchValue:n,typeName:le.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Pc.create(this,t)}readonly(){return ba.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const DC=/^c[^\s-]{8,}$/i,LC=/^[0-9a-z]+$/,jC=/^[0-9A-HJKMNP-TV-Z]{26}$/i,IC=/^[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,MC=/^[a-z0-9_-]{21}$/i,FC=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,UC=/^[-+]?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)?)??$/,BC=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,$C="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let xo;const VC=/^(?:(?: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])$/,HC=/^(?:(?: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])$/,zC=/^(([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]))$/,WC=/^(([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])$/,KC=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,GC=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Cm="((\\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])))",qC=new RegExp(`^${Cm}$`);function Em(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 ZC(e){return new RegExp(`^${Em(e)}$`)}function YC(e){let t=`${Cm}T${Em(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 QC(e,t){return!!((t==="v4"||!t)&&VC.test(e)||(t==="v6"||!t)&&zC.test(e))}function XC(e,t){if(!FC.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 JC(e,t){return!!((t==="v4"||!t)&&HC.test(e)||(t==="v6"||!t)&&WC.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:V.invalid_type,expected:Y.string,received:i.parsedType}),ce}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")BC.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")xo||(xo=new RegExp($C,"u")),xo.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")IC.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")MC.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")DC.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")LC.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")jC.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"?YC(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"?qC.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{code:V.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?ZC(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"?UC.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"duration",code:V.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?QC(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"?XC(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"?JC(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"?KC.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"base64",code:V.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?GC.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"base64url",code:V.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: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:le.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...fe(e)});function eE(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:V.invalid_type,expected:Y.number,received:i.parsedType}),ce}let r;const s=new rt;for(const i of this._def.checks)i.kind==="int"?_e.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"?eE(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()):_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:le.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...fe(e)});class Zr 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 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()):_e.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}),ce}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:le.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...fe(e)});class ma 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:V.invalid_type,expected:Y.boolean,received:r.parsedType}),ce}return at(t.data)}}ma.create=e=>new ma({typeName:le.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...fe(e)});class fi 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:V.invalid_type,expected:Y.date,received:i.parsedType}),ce}if(Number.isNaN(t.data.getTime())){const i=this._getOrReturnCtx(t);return G(i,{code:V.invalid_date}),ce}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()):_e.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new fi({...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}}fi.create=e=>new fi({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:le.ZodDate,...fe(e)});class Pd extends we{_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}),ce}return at(t.data)}}Pd.create=e=>new Pd({typeName:le.ZodSymbol,...fe(e)});class kd extends we{_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}),ce}return at(t.data)}}kd.create=e=>new kd({typeName:le.ZodUndefined,...fe(e)});class Ad extends we{_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}),ce}return at(t.data)}}Ad.create=e=>new Ad({typeName:le.ZodNull,...fe(e)});class Nd extends we{constructor(){super(...arguments),this._any=!0}_parse(t){return at(t.data)}}Nd.create=e=>new Nd({typeName:le.ZodAny,...fe(e)});class Od extends we{constructor(){super(...arguments),this._unknown=!0}_parse(t){return at(t.data)}}Od.create=e=>new Od({typeName:le.ZodUnknown,...fe(e)});class pn extends we{_parse(t){const n=this._getOrReturnCtx(t);return G(n,{code:V.invalid_type,expected:Y.never,received:n.parsedType}),ce}}pn.create=e=>new pn({typeName:le.ZodNever,...fe(e)});class Rd extends we{_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}),ce}return at(t.data)}}Rd.create=e=>new Rd({typeName:le.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:V.invalid_type,expected:Y.array,received:n.parsedType}),ce;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 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:le.ZodArray,...fe(t)});function Qn(e){if(e instanceof Le){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=cn.create(Qn(r))}return new Le({...e._def,shape:()=>t})}else return e instanceof Nt?new Nt({...e._def,type:Qn(e.element)}):e instanceof cn?cn.create(Qn(e.unwrap())):e instanceof Sr?Sr.create(Qn(e.unwrap())):e instanceof Un?Un.create(e.items.map(t=>Qn(t))):e}class Le 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:V.invalid_type,expected:Y.object,received:d.parsedType}),ce}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 u=i[d],f=s.data[d];l.push({key:{status:"valid",value:d},value:u._parse(new fn(s,f,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof pn){const d=this._def.unknownKeys;if(d==="passthrough")for(const u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:s.data[u]}});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 u of a){const f=s.data[u];l.push({key:{status:"valid",value:u},value:d._parse(new fn(s,f,s.path,u)),alwaysSet:u in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const d=[];for(const u of l){const f=await u.key,h=await u.value;d.push({key:f,value:h,alwaysSet:u.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 Le({...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 Le({...this._def,unknownKeys:"strip"})}passthrough(){return new Le({...this._def,unknownKeys:"passthrough"})}extend(t){return new Le({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Le({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:le.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new Le({...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 Le({...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 Le({...this._def,shape:()=>n})}deepPartial(){return Qn(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 Le({...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 Le({...this._def,shape:()=>n})}keyof(){return Tm(_e.objectKeys(this.shape))}}Le.create=(e,t)=>new Le({shape:()=>e,unknownKeys:"strip",catchall:pn.create(),typeName:le.ZodObject,...fe(t)});Le.strictCreate=(e,t)=>new Le({shape:()=>e,unknownKeys:"strict",catchall:pn.create(),typeName:le.ZodObject,...fe(t)});Le.lazycreate=(e,t)=>new Le({shape:e,unknownKeys:"strip",catchall:pn.create(),typeName:le.ZodObject,...fe(t)});class pi 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:V.invalid_union,unionErrors:o}),ce}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},u=l._parseSync({data:n.data,path:n.path,parent:d});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,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}),ce}}get options(){return this._def.options}}pi.create=(e,t)=>new pi({options:e,typeName:le.ZodUnion,...fe(t)});function ha(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=ha(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=ha(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 mi extends we{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),s=(i,o)=>{if(Cd(i)||Cd(o))return ce;const a=ha(i.value,o.value);return a.valid?((Ed(i)||Ed(o))&&n.dirty(),{status:n.value,value:a.data}):(G(r,{code:V.invalid_intersection_types}),ce)};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}))}}mi.create=(e,t,n)=>new mi({left:e,right:t,typeName:le.ZodIntersection,...fe(n)});class Un extends we{_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}),ce;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"}),ce;!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 Un({...this._def,rest:t})}}Un.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Un({items:e,typeName:le.ZodTuple,rest:null,...fe(t)})};class Dd 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:V.invalid_type,expected:Y.map,received:r.parsedType}),ce;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,u=await l.value;if(d.status==="aborted"||u.status==="aborted")return ce;(d.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(d.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of o){const d=l.key,u=l.value;if(d.status==="aborted"||u.status==="aborted")return ce;(d.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(d.value,u.value)}return{status:n.value,value:a}}}}Dd.create=(e,t,n)=>new Dd({valueType:t,keyType:e,typeName:le.ZodMap,...fe(n)});class Yr extends we{_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}),ce;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 u of l){if(u.status==="aborted")return ce;u.status==="dirty"&&n.dirty(),d.add(u.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:le.ZodSet,...fe(t)});class Ld 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})}}Ld.create=(e,t)=>new Ld({getter:e,typeName:le.ZodLazy,...fe(t)});class jd extends we{_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}),ce}return{status:"valid",value:t.data}}get value(){return this._def.value}}jd.create=(e,t)=>new jd({value:e,typeName:le.ZodLiteral,...fe(t)});function Tm(e,t){return new _r({values:e,typeName:le.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:V.invalid_type}),ce}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}),ce}return at(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=Tm;class Id 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:V.invalid_type}),ce}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:V.invalid_enum_value,options:s}),ce}return at(t.data)}get enum(){return this._def.values}}Id.create=(e,t)=>new Id({values:e,typeName:le.ZodNativeEnum,...fe(t)});class hi 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:V.invalid_type,expected:Y.promise,received:n.parsedType}),ce;const r=n.parsedType===Y.promise?n.data:Promise.resolve(n.data);return at(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}hi.create=(e,t)=>new hi({type:e,typeName:le.ZodPromise,...fe(t)});class xr extends we{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===le.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 ce;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?ce:l.status==="dirty"||n.value==="dirty"?Ur(l.value):l});{if(n.value==="aborted")return ce;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?ce: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"?ce:(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"?ce:(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 ce;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})):ce);_e.assertNever(s)}}xr.create=(e,t,n)=>new xr({schema:e,typeName:le.ZodEffects,effect:t,...fe(n)});xr.createWithPreprocess=(e,t,n)=>new xr({schema:t,effect:{type:"preprocess",transform:e},typeName:le.ZodEffects,...fe(n)});class cn extends we{_parse(t){return this._getType(t)===Y.undefined?at(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}cn.create=(e,t)=>new cn({innerType:e,typeName:le.ZodOptional,...fe(t)});class Sr extends we{_parse(t){return this._getType(t)===Y.null?at(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Sr.create=(e,t)=>new Sr({innerType:e,typeName:le.ZodNullable,...fe(t)});class ga 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}}ga.create=(e,t)=>new ga({innerType:e,typeName:le.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...fe(t)});class ya 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 ui(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}}ya.create=(e,t)=>new ya({innerType:e,typeName:le.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...fe(t)});class Md extends we{_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}),ce}return{status:"valid",value:t.data}}}Md.create=e=>new Md({typeName:le.ZodNaN,...fe(e)});class tE 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 Pc 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"?ce: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"?ce: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 Pc({in:t,out:n,typeName:le.ZodPipeline})}}class ba extends we{_parse(t){const n=this._def.innerType._parse(t),r=s=>(vr(s)&&(s.value=Object.freeze(s.value)),s);return ui(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}ba.create=(e,t)=>new ba({innerType:e,typeName:le.ZodReadonly,...fe(t)});var le;(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"})(le||(le={}));const So=sn.create,Os=wr.create,nE=ma.create;pn.create;Nt.create;const rE=Le.create;pi.create;mi.create;Un.create;_r.create;hi.create;cn.create;Sr.create;const sE="https://api.opheleo.com",iE="Bearer ",oE="Authorization";rE({id:So(),userId:So(),createdAt:Os(),updatedAt:Os(),active:nE(),perDayUsage:Os(),userEmail:So().email(),maxPerDayUsage:Os()});async function aE(e,t,n){const r=typeof window<"u"?localStorage.getItem("session_token"):null;return(await Ae({baseURL:Fn(n??sE),url:e,method:t,headers:r?{[oE]:`${iE}${r}`}:void 0})).data}async function cE(e){return aE("/iccandle/v1/iccandle-user-usage/me","get",e)}const lE=e=>{const t=e==null?void 0:e.platformApiBase;return AC({queryKey:["iccandle-user-usage",t],queryFn:()=>cE(t),...e})},dE=S.createContext(null);function uE(){const e=S.useContext(dE);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function fE({controlsRef:e,onSymbolTickerChange:t,onScanResultUrlChange:n,onChartWidgetChange:r,onChartContainerChange:s,selectSymbolTickerRef:i,headerSlot:o}){const{resolvedTheme:a}=uE(),l=Rt(),d=ls(),u=S.useRef([]),f=S.useRef(null),h=S.useRef(a),m=S.useRef(null),g=S.useRef(null),p=S.useMemo(()=>di(d),[d]),y=S.useRef(p),b=S.useRef("60"),{setGapCount:v,setReplayMode:x}=xm();S.useEffect(()=>{v(0),x(!1)},[v,x]),S.useEffect(()=>{zs()&&T(!0)},[]);const[_,C]=S.useState(null),[P,T]=S.useState(!1),[N,R]=S.useState(null),A=S.useCallback(L=>{if(L===y.current)return;const M=d.find(F=>F.ticker===L);if(!M)return;y.current=L,localStorage.setItem(Xn,L),t(L);const K=f.current;if(K)try{K.onChartReady(()=>{K.activeChart().setSymbol(M.ticker)})}catch{}},[t,d]);S.useEffect(()=>(i.current=A,()=>{i.current=null}),[A,i]);const j=S.useRef([]),D=S.useMemo(()=>new TC(j,"selector",d,l.tickWebSocketUrl),[l.tickWebSocketUrl,d]),{data:B,isLoading:O}=lE({enabled:!0,platformApiBase:l.platformApiBase}),H=!O&&B?B.perDayUsage>=B.maxPerDayUsage:!1;S.useEffect(()=>{s(_)},[_,s]),S.useEffect(()=>{r(N)},[N,r]),S.useEffect(()=>{if(!P||!_)return;if(f.current){R(null),r(null);try{f.current.remove()}catch{}f.current=null}const L=di(d);y.current=L,b.current="60";const M=_m();if(!M)return;const K=new M({container:_,library_path:"/charting_library/",datafeed:D,symbol:L,interval:"60",autosize:!0,theme:h.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:()=>PC(u),drawings_access:{type:"black",tools:[{name:"Date Range"}]},locale:"en",timezone:wh(),overrides:{priceScaleSelectionStrategyName:"right","scalesProperties.showSeriesLastValue":!0}});let F=!1;return f.current=K,K.onChartReady(()=>{F||f.current!==K||R(K)}),()=>{if(F=!0,R(null),r(null),f.current){try{f.current.remove()}catch{}f.current=null}}},[_,D,r,P]),S.useEffect(()=>{if(!N)return;let L=!1;try{N.onChartReady(()=>{L||(async()=>{try{const M=N.activeChart(),K=await M.createStudy("Generated Candles - By iC Candle",!0,!0);if(L||(K&&M.bringToFront([K]),await N.headerReady(),L)||(await new Promise(z=>{setTimeout(()=>{if(!L)try{M.clearMarks(2)}catch{}z(!0)},150)}),L))return;localStorage.setItem("tv:selected-news-events","[]"),M.refreshMarks();const F=z=>{const de=M.symbol(),ue=ca(de,d,p);ue!==y.current&&(n(null),u.current=[]);try{N.resetCache()}catch{}y.current=ue,localStorage.setItem(Xn,ue),t(ue)},se=z=>{z!==b.current&&(n(null),u.current=[]);try{N.resetCache()}catch{}b.current=z};m.current=F,g.current=se,M.onSymbolChanged().subscribe(null,F),M.onIntervalChanged().subscribe(null,se)}catch{}})()})}catch{}return()=>{L=!0,m.current=null,g.current=null}},[N,e,n,t,p,d]),S.useEffect(()=>{if(!N||!a)return;let L=!1;try{N.onChartReady(()=>{L||N.changeTheme(a).catch(()=>{})})}catch{}return()=>{L=!0}},[N,a]);const U=S.useCallback(()=>{T(!0)},[]),I=H?c.jsx("div",{className:"web-trading-widget-advanced__scan-limit-wrap",children:c.jsxs(gC,{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"}),B&&c.jsxs("span",{className:"web-trading-widget-advanced__scan-limit-badge-count",children:[B.perDayUsage," of ",B.maxPerDayUsage," scans used today"]})]})}):null;return c.jsxs(c.Fragment,{children:[o??I,c.jsx(yC,{onLoad:U}),c.jsx("div",{ref:C,className:"web-trading-widget-advanced__container"})]})}const Pm=S.createContext(null);function Fd({value:e,children:t}){return c.jsx(Pm.Provider,{value:e,children:t})}function pE(){const e=S.useContext(Pm);if(!e)throw new Error("useWidgetChartSlot must be used within WidgetChartSlotProvider");return e}function Rs(e,t){return e.toFixed(t)}function mE({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,isDragging:d,isCollapsed:u,onToggleCollapsed:f,onDragHandlePointerDown:h,onPlaceOrder:m}){const[g,p]=S.useState(!0),y=u??g,b=()=>{f==null||f(),u===void 0&&p(U=>!U)},v=oe(U=>U.setOrderSide),x=oe(U=>U.setVolumeLots),_=oe(U=>U.volumeLots),[C,P]=S.useState(String(_||r));S.useEffect(()=>{y||P(Rs(_,2))},[y,_]);const T=Number(Vt(Ht(e))),N=t!==null?Ee(t,T):"—",R=n!==null?Ee(n,T):"—",j=!o&&!a&&l!==""&&(t!==null&&n!==null),D=U=>{const I=Number(C),L=Number.isFinite(I)&&I>0?I:r,M=Math.max(i,L+U*s),K=Rs(M,2);P(K),x(M)},B=()=>{const U=Number(C);if(!Number.isFinite(U)||U<=0){P(Rs(r,2)),x(r);return}const I=Math.max(i,U),L=Rs(I,2);P(L),x(I)},O=U=>{t===null||n===null||v({side:U,entryPrice:U==="buy"?n:t})},H=U=>{if(t===null||n===null||!l)return;const I=Number(C),L=Math.max(i,Number.isFinite(I)&&I>0?I:r);v({side:U,entryPrice:U==="buy"?n:t}),m({login:l,side:U,volumeLots:L,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:h,className:`web-trading-widget-mini-order__drag-handle${d?" web-trading-widget-mini-order__drag-handle--grabbing":""}`,children:c.jsx(Df,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2})}),c.jsxs(c.Fragment,{children:[c.jsxs("button",{type:"button",disabled:!j,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--sell",onMouseDown:()=>O("sell"),onClick:()=>H("sell"),children:[c.jsx("span",{className:"web-trading-widget-mini-order__price",children:N}),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:!j,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>D(-1),children:c.jsx(ei,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})}),c.jsx("input",{type:"text",inputMode:"decimal",value:C,disabled:!j,onChange:U=>P(U.target.value),onBlur:B,className:"web-trading-widget-mini-order__volume-input"}),c.jsx("button",{type:"button","aria-label":"Increase volume",disabled:!j,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>D(1),children:c.jsx(Io,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})})]}),c.jsxs("button",{type:"button",disabled:!j,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--buy",onMouseDown:()=>O("buy"),onClick:()=>H("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":y?"Expand quick order panel":"Collapse quick order panel","aria-expanded":!y,className:"web-trading-widget-mini-order__toggle",onClick:b,children:y?c.jsx(ei,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5}):c.jsx(Io,{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(ei,{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 hE=new Set(["volume-setting","risk-management"]);function gE({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,isDragging:d,onDragHandlePointerDown:u,onLayoutChange:f,onClose:h,onPlaceOrder:m}){const[g,p]=S.useState(!0),[y,b]=S.useState("market"),v=oe(J=>J.volumeLots),[x,_]=S.useState(String(v||r)),[C,P]=S.useState(""),[T,N]=S.useState(""),R=oe(J=>J.stopLoss),A=oe(J=>J.takeProfit),j=oe(J=>J.setStopLoss),D=oe(J=>J.setTakeProfit),B=oe(J=>J.setVolumeLots),O=oe(J=>J.setOrderSide),[H,U]=S.useState(""),[I,L]=S.useState(ft.GTC),[M,K]=S.useState(""),[F,se]=S.useState(""),[z,de]=S.useState(()=>new Set(hE));S.useEffect(()=>{f()},[g,f]);const ue=Number(Vt(Ht(e))),ee=Pr(ue),Z=Ff(t,n),$=t!==null?Ee(t,ue):"—",ye=n!==null?Ee(n,ue):"—",ae=Ri(y),ie=jf(y),te=Oi(y),je=te.label,Re=!ae&&te.orderType!==null&&te.orderType%2===1,Ne=S.useMemo(()=>Z!==null?Z:t??n,[n,t,Z]),X=J=>{de(Xe=>{const zt=new Set(Xe);return zt.has(J)?zt.delete(J):zt.add(J),zt})},ke=J=>{_(J);const Xe=Number(J);Number.isFinite(Xe)&&Xe>0&&B(Xe)},Fe=J=>t===null||n===null?null:ae?J==="buy"?n:t:pt(C)??(J==="buy"?n:t),Qe=J=>{const Xe=Fe(J);Xe!==null&&O({side:J,entryPrice:Xe})},ct=J=>{if(t===null||n===null||!l)return;const Xe=Math.max(i,Number(x)||i),zt=Mo(y,J),Or=Fe(J);Or!==null&&O({side:J,entryPrice:Or}),m({login:l,executionMode:y,side:J,orderType:zt,volumeLots:Xe,stopLoss:R,takeProfit:A,priceOrder:C,priceTrigger:T,comment:H,typeTime:I,expirationDateTime:M,expirationDay:F,bid:t,ask:n})},re=t!==null&&n!==null,$e=ae||pt(C)!==void 0,qi=!ie||pt(T)!==void 0,us=ae||Li(I,M,F),nh=!o&&!a&&l!==""&&re&&$e&&qi&&us,rh=!ae&&sc(I),sh=!ae&&ic(I),Rc=()=>te.orderType!==null&&te.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(mE,{symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,isDragging:d,isCollapsed:g,onToggleCollapsed:()=>p(J=>!J),onDragHandlePointerDown:u,onPlaceOrder:({login:J,side:Xe,volumeLots:zt,bid:Or,ask:Dc})=>{Or===null||Dc===null||m({login:J,executionMode:"market",side:Xe,orderType:Mo("market",Xe),volumeLots:zt,stopLoss:R,takeProfit:A,priceOrder:"",priceTrigger:"",comment:H,typeTime:I,expirationDateTime:"",expirationDay:"",bid:Or,ask:Dc})}}),g?null:c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"web-trading-widget-market-panel__header",children:c.jsxs(Xs,{value:y,onValueChange:J=>b(J),children:[c.jsx(Vr,{className:"web-trading-widget-market-panel__select-trigger","aria-label":"Order execution type",children:c.jsx(Js,{})}),c.jsx(Hr,{children:ti.map(J=>c.jsx(zr,{value:J.mode,children:J.label},J.mode))})]})}),c.jsxs("div",{className:"web-trading-widget-market-panel__accordion",children:[c.jsx(Ir,{id:"volume-setting",title:"Volume Setting",isOpen:z.has("volume-setting"),onToggle:()=>X("volume-setting"),children:c.jsx(De,{label:"Lots",value:x,onChange:ke,step:s,min:i,decimals:2})}),ae?null:c.jsx(Ir,{id:"order-price",title:"Order Price",isOpen:z.has("order-price"),onToggle:()=>X("order-price"),children:ie?c.jsxs(c.Fragment,{children:[c.jsx(De,{label:"Stop Price",value:T,onChange:N,step:ee,decimals:ue,basePrice:Ne,placeholder:Z!==null?Ee(Z,ue):"—"}),c.jsx(De,{label:"Limit Price",value:C,onChange:P,step:ee,decimals:ue,basePrice:Ne,placeholder:Z!==null?Ee(Z,ue):"—"})]}):c.jsx(De,{label:"Price",value:C,onChange:P,step:ee,decimals:ue,basePrice:Ne,placeholder:Z!==null?Ee(Z,ue):"—"})}),c.jsx(Ir,{id:"risk-management",title:"Risk Management",isOpen:z.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:j,step:ee,decimals:ue,basePrice:t,placeholder:t!==null?$:"—",clearable:!0}),c.jsx(De,{label:"Take Profit",value:A,onChange:D,step:ee,decimals:ue,basePrice:n,placeholder:n!==null?ye:"—",clearable:!0})]})}),ae?null:c.jsxs(Ir,{id:"expiration",title:"Expiration",isOpen:z.has("expiration"),onToggle:()=>X("expiration"),children:[c.jsx("select",{value:String(I),className:"web-trading-widget-market-panel__select-full","aria-label":"Order expiration type",onChange:J=>L(Number(J.target.value)),children:If.map(J=>c.jsx("option",{value:String(J.value),children:J.label},J.value))}),rh?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:M,className:"web-trading-widget-market-panel__input",onChange:J=>K(J.target.value)})]}):null,sh?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:F,className:"web-trading-widget-market-panel__input",onChange:J=>se(J.target.value)})]}):null]}),c.jsx(Ir,{id:"comment",title:"Comment",isOpen:z.has("comment"),onToggle:()=>X("comment"),children:c.jsx("input",{type:"text",value:H,className:"web-trading-widget-market-panel__input",placeholder:"",onChange:J=>U(J.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:$}),c.jsx("span",{className:"web-trading-widget-market-panel__quotes-ask",children:ye})]})}),!ae&&c.jsxs("button",{type:"button",className:`web-trading-widget-market-panel__place-btn${Re?" web-trading-widget-market-panel__place-btn--sell":" web-trading-widget-market-panel__place-btn--buy"}`,disabled:!nh,onMouseDown:()=>Qe(Rc()),onClick:()=>ct(Rc()),children:["Place ",je]})]})]})}function yE({symbolTicker:e,chartWidget:t,orderState:n}){const r=ls(),s=hc(e),{panel:i,confirmation:o,isSubmitting:a,defaultVolumeLots:l,volumeStep:d,minVolumeLots:u,selectedLogin:f,isAccountsLoading:h,hasConfirmedAccount:m,closePanels:g,dismissConfirmation:p,placeMarketOrder:y}=n,b=ve(F=>F.positions),v=ve(F=>F.orders),x=ve(F=>F.selectedPositionTicket),_=ve(F=>F.selectedOrderTicket),C=ve(F=>F.setSelectedPositionTicket),P=ve(F=>F.setSelectedOrderTicket),T=x!==null?b.find(F=>F.ticket===x)??null:null,N=_!==null?v.find(F=>F.ticket===_)??null:null,R=m&&i==="confirmation"&&o!==null,A=m&&i!=="confirmation"&&i!=="closed"&&T===null&&N===null,{panelRef:j,position:D,isDragging:B,onDragStart:O,reclamp:H}=Hf({storageKey:"web-trading-widget-modal-exec-panel-position",defaultAlign:"top-right",isActive:A}),U=oe(F=>F.setDraft),I=oe(F=>F.clearDraft),L=Number(Vt(Ht(e))),M=Pr(L);S.useEffect(()=>{m&&U({source:"new-order",entryPrice:null,side:null,showEntryLine:!1,volumeLots:l,digits:L,priceStep:M})},[l,L,m,M,U]),S.useEffect(()=>{(i==="closed"||i==="confirmation")&&I()},[I,i]);const K=T!==null||N!==null;return!m&&!K?null:c.jsxs("div",{className:"web-trading-widget-new-order-overlay-layer",children:[c.jsx(Ap,{chartWidget:t,symbolTicker:e,symbols:r}),K&&T!==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(wm,{position:T,onClose:()=>C(null)})}):null,K&&N!==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(vm,{order:N,onClose:()=>P(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(bm,{confirmation:o,symbolTicker:e,onDismiss:p})}):null,A?c.jsx("div",{ref:j,style:{left:D.x,top:D.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${B?" web-trading-widget-new-order-overlay--dragging":""}`,children:c.jsx(gE,{symbolTicker:e,bid:(s==null?void 0:s.bid)??null,ask:(s==null?void 0:s.ask)??null,defaultVolumeLots:l,volumeStep:d,minVolumeLots:u,isSubmitting:a,isAccountsLoading:h,selectedLogin:f,isDragging:B,onDragHandlePointerDown:O,onLayoutChange:H,onClose:g,onPlaceOrder:F=>void y({symbolTicker:e,login:F.login,executionMode:F.executionMode,side:F.side,orderType:F.orderType,volumeLots:F.volumeLots,stopLoss:F.stopLoss,takeProfit:F.takeProfit,priceOrder:F.priceOrder,priceTrigger:F.priceTrigger,comment:F.comment,typeTime:F.typeTime,expirationDateTime:F.expirationDateTime,expirationDay:F.expirationDay,bid:F.bid,ask:F.ask})})}):null]})}const bE=`<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&&Bs.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&&(k.isFunction(s)?n.paramsSerializer={serialize:s}:Bs.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),Bs.assertOptions(n,{baseUrl:Ve.spelling("baseURL"),withXsrfToken:Ve.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"],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 y=n.transitional||uc;y&&y.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 u,f=0,h;if(!l){const g=[Vl.bind(this),void 0];for(g.unshift(...a),g.push(...d),h=g.length,u=Promise.resolve(n);f<h;)u=u.then(g[f++],g[f++]);return u}h=a.length;let m=n;for(;f<h;){const g=a[f++],p=a[f++];try{m=g(m)}catch(y){p.call(this,y);break}}try{u=Vl.call(this,m)}catch(g){return Promise.reject(g)}for(f=0,h=d.length;f<h;)u=u.then(d[f++],d[f++]);return u}getUri(t){t=Mn(this.defaults,t);const n=mp(t.baseURL,t.url,t.allowAbsoluteUrls,t);return lp(n,t.params,t.paramsSerializer)}};k.forEach(["delete","get","head","options"],function(t){On.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}))}}On.prototype[t]=n(),t!=="query"&&(On.prototype[t+"Form"]=n(!0))});let gx=class bp{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 bp(function(s){t=s}),cancel:t}}};function yx(e){return function(n){return e.apply(null,n)}}function bx(e){return k.isObject(e)&&e.isAxiosError===!0}const $o={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($o).forEach(([e,t])=>{$o[t]=e});function vp(e){const t=new On(e),n=Zf(On.prototype.request,t);return k.extend(n,On.prototype,t,{allOwnKeys:!0}),k.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return vp(Mn(e,s))},n}const Ae=vp(os);Ae.Axios=On;Ae.CanceledError=as;Ae.CancelToken=gx;Ae.isCancel=fp;Ae.VERSION=pc;Ae.toFormData=Fi;Ae.AxiosError=q;Ae.Cancel=Ae.CanceledError;Ae.all=function(t){return Promise.all(t)};Ae.spread=yx;Ae.isAxiosError=bx;Ae.mergeConfig=Mn;Ae.AxiosHeaders=ze;Ae.formToJSON=e=>up(k.isHTMLForm(e)?new FormData(e):e);Ae.getAdapter=yp.getAdapter;Ae.HttpStatusCode=$o;Ae.default=Ae;const{Axios:lT,AxiosError:dT,CanceledError:uT,isCancel:fT,CancelToken:pT,VERSION:mT,all:hT,Cancel:gT,isAxiosError:wp,spread:yT,toFormData:bT,AxiosHeaders:vT,HttpStatusCode:wT,formToJSON:_T,getAdapter:xT,mergeConfig:ST,create:CT}=Ae,vx="Bearer ",_p="web-trading-token";function wx(){return typeof window>"u"?null:localStorage.getItem(_p)}function Fn(e){return e.replace(/\/$/,"")}function zl(e){const t=Fn(e);async function n(r){const s=wx();return(await Ae({...r,baseURL:t,headers:{...r.headers??{},...s?{Authorization:`${vx}${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 Wl(e){return!e.isDemo&&!e.isArchive&&!!e.tradeStat}function _x(e){const t=e.filter(n=>Wl(n)&&n.platformType==="mt5");return t.length>0?t:e.filter(Wl)}function xx(e){const t=e,n=(t==null?void 0:t.accounts)??[];return _x(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 Sx(e){try{const t=new URL(Fn(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 Fn(e)}}function Cx(e){try{const t=new URL(Fn(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 Ex(e){try{const t=new URL(Fn(e));return t.hostname.includes("opheleo")?"wss://public-ticks.opheleo.com":(t.protocol=t.protocol==="https:"?"wss:":"ws:",t.origin)}catch{return"wss://public-ticks.opheleo.com"}}function Tx(e){const t=Fn(e),n=zl(t),r=Sx(t),s=zl(r),i=mw(n),o=Bt;return{baseUrl:t,platformApiBase:r,tickWebSocketUrl:Cx(t),publicTickWebSocketUrl:Ex(t),dealer:i,trading:ww(i,o),async getAccounts(){const a=await s.get("/account-config/api/v1");return xx(a)}}}const xp=S.createContext(null);function Sp({baseUrl:e,children:t}){const n=S.useMemo(()=>Tx(e),[e]);return c.jsx(xp.Provider,{value:n,children:t})}function Rt(){const e=S.useContext(xp);if(!e)throw new Error("useWidgetApiClient must be used within WidgetApiProvider");return e}function Px(){return Rt().tickWebSocketUrl}function kx(){return Rt().publicTickWebSocketUrl}const Ax="wss://public-ticks.opheleo.com";function hc(e){const[t,n]=S.useState(null),r=kx();return S.useEffect(()=>{n(null);const s=Di(e).toUpperCase();let i=null,o=!1;const a=r||Ax,l=()=>{i=new WebSocket(a),i.onmessage=d=>{var u;try{const f=JSON.parse(d.data);if(f.type!=="tick"||!Array.isArray(f.ticks))return;for(const h of f.ticks){if(((u=h.s)==null?void 0:u.trim().toUpperCase())!==s)continue;const g=Number(h.b),p=Number(h.a);if(!(!Number.isFinite(g)||!Number.isFinite(p))){n({bid:g,ask:p});break}}}catch{}},i.onclose=()=>{o||setTimeout(l,3e3)}};return l(),()=>{o=!0,i==null||i.close(1e3,"Unmounted")}},[e,r]),t}function Nx({symbolTicker:e,scanResultUrl:t,orderState:n,backUrl:r,createAccountUrl:s}){const i=hc(e),{panelRef:o,position:a,isDragging:l,onDragStart:d,reclamp:u}=Wf(),{panel:f,isSubmitting:h,defaultVolumeLots:m,volumeStep:g,minVolumeLots:p,accountOptions:y,selectedLogin:b,isAccountsLoading:v,hasConfirmedAccount:x,needsAccountSelection:_,confirmAccountSelection:C,placeMarketOrder:P}=n,T=oe(N=>N.setDraft),O=oe(N=>N.clearDraft),D=Number(Vt(Ht(e))),j=Pr(D);S.useEffect(()=>{x&&T({source:"new-order",entryPrice:null,side:null,showEntryLine:!1,volumeLots:m,digits:D,priceStep:j})},[m,D,x,j,T]),S.useEffect(()=>{(f==="closed"||f==="confirmation")&&O()},[O,f]);const A=N=>{P({symbolTicker:e,login:N.login,executionMode:"market",side:N.side,orderType:N.side==="buy"?qe.BUY:qe.SELL,volumeLots:N.volumeLots,stopLoss:"",takeProfit:"",priceOrder:"",priceTrigger:"",comment:"",typeTime:ft.GTC,expirationDateTime:"",expirationDay:"",bid:N.bid,ask:N.ask})};return c.jsxs(c.Fragment,{children:[c.jsx(Df,{open:_,isAccountsLoading:v,accountOptions:y,onConfirm:C,backUrl:r,createAccountUrl:s}),x&&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(tw,{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:h,isAccountsLoading:v,selectedLogin:b,isDragging:l,scanResultUrl:t,onDragHandlePointerDown:d,onExpandedChange:u,onExpand:u,onPlaceOrder:A})})]})}function Ox(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 Rx(e,t){return e.openTimeMs!==t.openTimeMs?e.openTimeMs-t.openTimeMs:Ox(e.ticket,t.ticket)}function Kl(e){return[...e].sort(Rx)}function Gl(e){return Ye(e).toUpperCase()}const ve=ji(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:Kl(t)})},setOrders:t=>{e({orders:Kl(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=Gl(t);e(i=>{const o={...i.liveQuotes,[s]:{bid:n,ask:r}};return{liveQuotes:o,positions:i.positions.map(a=>Iv(a,s,n,r,o)),orders:i.orders.map(a=>{if(Gl(a.symbol)!==s)return a;const l=a.side==="buy"?n:r;return{...a,currentPrice:l}})}})},clearPositions:()=>{e({positions:[],orders:[],liveQuotes:{}})}})),Dx="wss://symbols.opheleo.com";function Lx(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 Lv([...n]))n.add(r);return[...n].sort().join("|")}function jx(e){return Lx(e.positions,e.orders)}function Ix(){const e=ve(jx),t=ve(r=>r.updateQuotes),n=Px();S.useEffect(()=>{if(!e)return;const r=e.split("|"),s=new Map;let i=!1;const o=n||Dx,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=u=>{var f;try{const h=JSON.parse(u.data),m=(f=h.symbol)==null?void 0:f.trim().toUpperCase();if(!m||m!==l)return;const g=Number(h.bid),p=Number(h.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 Cp(){return Ix(),null}const Ep={buy:"#2563eb",sell:"#dc2626"},ho={positive:"#2563eb",negative:"#dc2626",neutral:"#94a3b8"},go={linewidth:1,linestyle:2,fontsize:11},Tp={stopLoss:"#f97316",takeProfit:"#22c55e"},Pp=e=>Ep[e],Vo=(e,t)=>e==="entry"?t!=null?Pp(t):Ep.sell:Tp[e],ql=(e,t)=>{if(e==="entry")return Vo(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=kp(n,r,s,i);return Ap(o)}return Tp[e]},kp=(e,t,n,r)=>(e==="buy"?n-t:t-n)*r*100,Mx=(e,t)=>!Number.isFinite(t)||t<=0?0:Math.round(e/t),Fx=e=>{const t=kp(e.side,e.entryPrice,e.linePrice,e.volumeLots),n=e.side==="buy"?e.linePrice-e.entryPrice:e.entryPrice-e.linePrice,r=Mx(n,e.priceStep),s=e.kind==="takeProfit"?"TP":"SL",i=`${t.toFixed(2)} USD`,o=`${r} points`;return`${s} ${i}, ${o}`},Ux=(e,t)=>e.toFixed(t),Ap=e=>e>0?ho.positive:e<0?ho.negative:ho.neutral,Bx=e=>{const t=`${e.side.toUpperCase()} ${e.volumeLots.toFixed(2)}, `,n=`${e.profit.toFixed(2)} USD`;return`${t}${n}`},Zl=e=>{const t=Pp(e.side),n=Ap(e.profit);return{text:Bx(e),linecolor:t,textcolor:n,linewidth:go.linewidth,linestyle:go.linestyle,fontsize:go.fontsize,showPrice:!0,horzLabelsAlign:"left"}},Yl=e=>pt(e),$x=e=>e==="entry"||e==="stopLoss"||e==="takeProfit",yo=e=>{e.setUserEditEnabled(!1),e.setSelectionEnabled(!1)},Ql=(e,t,n)=>{if(e==="entry")return Ux(t,n.digits);const{entryPrice:r,side:s}=n;return s!==null&&r!==null?Fx({kind:e,side:s,entryPrice:r,linePrice:t,volumeLots:n.volumeLots,priceStep:n.priceStep}):`${e==="takeProfit"?"TP":"SL"} ${Ee(t,n.digits)}`},Vx=({chartWidget:e})=>{const t=oe(_=>_.source),n=oe(_=>_.entryPrice),r=oe(_=>_.stopLoss),s=oe(_=>_.takeProfit),i=oe(_=>_.side),o=oe(_=>_.showEntryLine),a=oe(_=>_.volumeLots),l=oe(_=>_.digits),d=oe(_=>_.priceStep),u=oe(_=>_.setStopLoss),f=oe(_=>_.setTakeProfit),h=S.useRef({}),m=S.useRef(null),g=S.useRef(null),p=S.useRef({entryPrice:n,stopLoss:r,takeProfit:s,side:i,showEntryLine:o,volumeLots:a,digits:l,priceStep:d});S.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 y=S.useCallback(_=>{if(!e)return;const C=h.current[_];if(C){try{e.activeChart().removeEntity(C)}catch{}delete h.current[_]}},[e]),b=S.useCallback((_,C,P,T)=>{const O=Vo(C,T.side),D=ql(C,{side:T.side,entryPrice:T.entryPrice,linePrice:P,volumeLots:T.volumeLots});_.setProperties({text:Ql(C,P,T),linecolor:O,textcolor:D,showPrice:!0,horzLabelsAlign:"left"})},[]),v=S.useCallback(async(_,C,P)=>{var N;if(!e)return;if(C===void 0){y(_);return}if(m.current===_)return;const T=e.activeChart(),O=Vo(_,P.side),D=ql(_,{side:P.side,entryPrice:P.entryPrice,linePrice:C,volumeLots:P.volumeLots}),j=Ql(_,C,P),A=h.current[_];if(A)try{const B=T.getShapeById(A);_==="entry"&&yo(B);const R=(N=B.getPoints()[0])==null?void 0:N.price;if(R!==void 0&&Math.abs(R-C)<P.priceStep/2){B.setProperties({text:j,linecolor:O,textcolor:D,showPrice:!0,horzLabelsAlign:"left"});return}const H=B.getPoints();if(H.length>0){B.setPoints(H.map(F=>({...F,price:C}))),B.setProperties({text:j,linecolor:O,textcolor:D,showPrice:!0,horzLabelsAlign:"left"});return}}catch{delete h.current[_]}try{const B=T.getVisibleRange(),R=await T.createShape({time:B.from,price:C},{shape:"horizontal_line",text:j,disableSave:!0,lock:_==="entry",disableSelection:_==="entry",overrides:{linecolor:O,textcolor:D,linewidth:2,showPrice:!0,horzLabelsAlign:"left"}});if(_==="entry")try{yo(T.getShapeById(R))}catch{}h.current[_]=R}catch{}},[e,y]),x=S.useCallback(async _=>{const C=Yl(_.stopLoss),P=Yl(_.takeProfit);_.showEntryLine&&_.entryPrice!==null?await v("entry",_.entryPrice,_):await v("entry",void 0,_),await v("stopLoss",C,_),await v("takeProfit",P,_)},[v]);S.useEffect(()=>{if(!e||t===null)return;const _=(C,P)=>{var O,D,j;const T=(O=Object.entries(h.current).find(([,A])=>A===C))==null?void 0:O[0];if(!(!T||!$x(T))){if(T==="entry"){if(P==="move"||P==="points_changed"){const A=p.current;if(A.entryPrice!==null)try{const N=e.activeChart().getShapeById(C),B=(D=N.getPoints()[0])==null?void 0:D.price;if(B!==void 0&&Math.abs(B-A.entryPrice)>=A.priceStep/2){const R=N.getPoints();R.length>0&&N.setPoints(R.map(H=>({...H,price:A.entryPrice})))}yo(N)}catch{}}return}if(P==="remove"){m.current=null,T==="stopLoss"&&u(""),T==="takeProfit"&&f(""),delete h.current[T];return}if(!(P!=="move"&&P!=="points_changed"))try{const A=e.activeChart().getShapeById(C),N=(j=A.getPoints()[0])==null?void 0:j.price;if(!Number.isFinite(N)||N<=0)return;const B=p.current;if(P==="points_changed"){m.current=T,b(A,T,N,B),g.current!==null&&clearTimeout(g.current),g.current=setTimeout(()=>{m.current=null;const F=Ee(N,p.current.digits);T==="stopLoss"?u(F):f(F)},120);return}g.current!==null&&(clearTimeout(g.current),g.current=null),m.current=null;const R=Ee(N,B.digits),H=T==="stopLoss"?{...B,stopLoss:R}:{...B,takeProfit:R};T==="stopLoss"?u(R):f(R),b(A,T,N,H)}catch{m.current=null}}};try{e.subscribe("drawing_event",_)}catch{}return()=>{m.current=null,g.current!==null&&(clearTimeout(g.current),g.current=null);try{e.unsubscribe("drawing_event",_)}catch{}Object.keys(h.current).forEach(C=>{y(C)}),h.current={}}},[e,y,u,f,t,b]),S.useEffect(()=>{if(!e||t===null)return;let _=!1;try{e.onChartReady(()=>{_||x(p.current)})}catch{}return()=>{_=!0}},[e,t,n,r,s,i,o,a,l,d,x])},Xl=e=>{e.setUserEditEnabled(!1),e.setSelectionEnabled(!1)},Np=(e,t)=>Ye(e.symbol).toUpperCase()===t,Hx=e=>ve.getState().positions.filter(t=>Np(t,e)).map(t=>({ticket:t.ticket,openPrice:t.openPrice,type:t.type,digits:t.digits,volumeLots:t.volumeLots,profit:t.profit})),Jl=(e,t,n)=>{try{const r=e.activeChart().symbol(),s=n.find(i=>i.display_name===r||i.ticker===r);if(s)return Uf(s.ticker,n)}catch{}return t},zx=(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)},Wx=({chartWidget:e,symbolTicker:t,symbols:n})=>{const r=ve(g=>g.positions),s=S.useRef(new Map),i=S.useRef(0),o=S.useMemo(()=>Uf(t,n),[t,n]),a=S.useMemo(()=>r.filter(g=>Np(g,o)).map(g=>`${g.ticket}:${g.openPrice}:${g.type}:${g.digits}:${g.volumeLots}:${g.profit.toFixed(2)}`).sort().join("|"),[o,r]),l=S.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=S.useCallback(()=>{for(const g of[...s.current.keys()])l(g);s.current.clear()},[l]),u=S.useCallback(async(g,p,y)=>{const b=Zl({side:p.type,volumeLots:p.volumeLots,profit:p.profit}),x={time:g.getVisibleRange().from,price:p.openPrice},_=await g.createShape(x,{shape:"horizontal_line",text:String(b.text),disableSave:!0,lock:!0,disableSelection:!0,overrides:b});if(y!==i.current){try{g.removeEntity(_)}catch{}return null}try{Xl(g.getShapeById(_))}catch{}return _},[]),f=S.useCallback(async(g,p)=>{if(!e||p!==i.current)return;const y=e.activeChart(),b=Zl({side:g.type,volumeLots:g.volumeLots,profit:g.profit}),v=s.current.get(g.ticket);if(v)try{zx(y.getShapeById(v),g.openPrice,b),Xl(y.getShapeById(v));return}catch{s.current.delete(g.ticket)}if(p===i.current)try{const x=await u(y,g,p);if(!x)return;s.current.set(g.ticket,x)}catch{}},[e,u]),h=S.useCallback(async(g,p)=>{if(!e||g!==i.current)return;const y=Hx(p),b=new Set(y.map(v=>v.ticket));for(const v of s.current.keys())b.has(v)||l(v);for(const v of y){if(g!==i.current)return;await f(v,g)}},[e,l,f]),m=S.useCallback(g=>{if(!e)return;const p=i.current+1;i.current=p,g!=null&&g.resetLineIds&&d();const y=(g==null?void 0:g.symbolKey)??Jl(e,o,n);h(p,y)},[o,e,d,n,h]);S.useEffect(()=>{if(!e)return;let g=!1,p=null;const y=()=>{g||m({resetLineIds:!0,symbolKey:Jl(e,o,n)})};let b=!1;const v=()=>{b=!0,y()},x=()=>{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,x)}catch{}})}catch{}return()=>{if(g=!0,i.current+=1,p)try{p.onSymbolChanged().unsubscribe(null,v),p.onDataLoaded().unsubscribe(null,x)}catch{}d()}},[o,e,d,m,n]),S.useEffect(()=>{if(!e)return;let g=!1;try{e.onChartReady(()=>{g||m({symbolKey:o})})}catch{}return()=>{g=!0}},[o,e,a,m])},Op=({chartWidget:e,symbolTicker:t,symbols:n})=>(Wx({chartWidget:e,symbolTicker:t,symbols:n}),Vx({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,tr,Vd,Kx=(Vd=class extends cs{constructor(){super();ne(this,_n);ne(this,Qt);ne(this,tr);K(this,tr,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,tr))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,Qt))==null||t.call(this),K(this,Qt,void 0))}setEventListener(t){var n;K(this,tr,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,tr=new WeakMap,Vd),gc=new Kx,Gx={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},St,xn,Hd,qx=(Hd=class{constructor(){ne(this,St,Gx);ne(this,xn,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&E(this,xn)&&e!==E(this,St)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:E(this,St),provider:e}),K(this,St,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,St).setTimeout(e,t)}clearTimeout(e){E(this,St).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&K(this,xn,!0),E(this,St).setInterval(e,t)}clearInterval(e){E(this,St).clearInterval(e)}},St=new WeakMap,xn=new WeakMap,Hd),wn=new qx;function Zx(e){setTimeout(e,0)}var Yx=typeof window>"u"||"Deno"in globalThis;function Ge(){}function Qx(e,t){return typeof e=="function"?e(t):e}function Ho(e){return typeof e=="number"&&e>=0&&e!==1/0}function Rp(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 ed(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:i,queryKey:o,stale:a}=e;if(o){if(r){if(t.queryHash!==yc(o,t.options))return!1}else if(!Gr(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 td(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(!Gr(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function yc(e,t){return((t==null?void 0:t.queryKeyHashFn)||Kr)(e)}function Kr(e){return JSON.stringify(e,(t,n)=>Ko(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function Gr(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Gr(e[n],t[n])):!1}var Xx=Object.prototype.hasOwnProperty;function zo(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=nd(e)&&nd(t);if(!r&&!(Ko(e)&&Ko(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 u=0;u<a;u++){const f=r?u:o[u],h=e[f],m=t[f];if(h===m){l[f]=h,(r?u<i:Xx.call(e,f))&&d++;continue}if(h===null||m===null||typeof h!="object"||typeof m!="object"){l[f]=m;continue}const g=zo(h,m,n+1);l[f]=g,g===h&&d++}return i===a&&d===i?e:l}function Wo(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 nd(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Ko(e){if(!rd(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!rd(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function rd(e){return Object.prototype.toString.call(e)==="[object Object]"}function Jx(e){return new Promise(t=>{wn.setTimeout(t,e)})}function Go(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 eS(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function tS(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var oi=Symbol();function Dp(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===oi&&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===oi?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Lp(e,t){return typeof e=="function"?e(...t):!!e}function nS(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 qr=(()=>{let e=()=>Yx;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 rS=Zx;function sS(){let e=[],t=0,n=a=>{a()},r=a=>{a()},s=rS;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 Ue=sS(),nr,Xt,rr,zd,iS=(zd=class extends cs{constructor(){super();ne(this,nr,!0);ne(this,Xt);ne(this,rr);K(this,rr,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,rr))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,Xt))==null||t.call(this),K(this,Xt,void 0))}setEventListener(t){var n;K(this,rr,t),(n=E(this,Xt))==null||n.call(this),K(this,Xt,t(this.setOnline.bind(this)))}setOnline(t){E(this,nr)!==t&&(K(this,nr,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return E(this,nr)}},nr=new WeakMap,Xt=new WeakMap,rr=new WeakMap,zd),ai=new iS;function oS(e){return Math.min(1e3*2**e,3e4)}function jp(e){return(e??"online")==="online"?ai.isOnline():!0}var Zo=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Ip(e){let t=!1,n=0,r;const s=qo(),i=()=>s.status!=="pending",o=p=>{var y;if(!i()){const b=new Zo(p);h(b),(y=e.onCancel)==null||y.call(e,b)}},a=()=>{t=!0},l=()=>{t=!1},d=()=>gc.isFocused()&&(e.networkMode==="always"||ai.isOnline())&&e.canRun(),u=()=>jp(e.networkMode)&&e.canRun(),f=p=>{i()||(r==null||r(),s.resolve(p))},h=p=>{i()||(r==null||r(),s.reject(p))},m=()=>new Promise(p=>{var y;r=b=>{(i()||d())&&p(b)},(y=e.onPause)==null||y.call(e)}).then(()=>{var p;r=void 0,i()||(p=e.onContinue)==null||p.call(e)}),g=()=>{if(i())return;let p;const y=n===0?e.initialPromise:void 0;try{p=y??e.fn()}catch(b){p=Promise.reject(b)}Promise.resolve(p).then(f).catch(b=>{var P;if(i())return;const v=e.retry??(qr.isServer()?0:3),x=e.retryDelay??oS,_=typeof x=="function"?x(n,b):x,C=v===!0||typeof v=="number"&&n<v||typeof v=="function"&&v(n,b);if(t||!C){h(b);return}n++,(P=e.onFail)==null||P.call(e,n,b),Jx(_).then(()=>d()?void 0:m()).then(()=>{t?h(b):g()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(r==null||r(),s),cancelRetry:a,continueRetry:l,canStart:u,start:()=>(u()?g():m().then(g),s)}}var Sn,Wd,Mp=(Wd=class{constructor(){ne(this,Sn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Ho(this.gcTime)&&K(this,Sn,wn.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(qr.isServer()?1/0:300*1e3))}clearGcTimeout(){E(this,Sn)!==void 0&&(wn.clearTimeout(E(this,Sn)),K(this,Sn,void 0))}},Sn=new WeakMap,Wd);function aS(e){return{onFetch:(t,n)=>{var u,f,h,m,g;const r=t.options,s=(h=(f=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:f.fetchMore)==null?void 0:h.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 y=x=>{nS(x,()=>t.signal,()=>p=!0)},b=Dp(t.options,t.fetchOptions),v=async(x,_,C)=>{if(p)return Promise.reject(t.signal.reason);if(_==null&&x.pages.length)return Promise.resolve(x);const T=(()=>{const A={client:t.client,queryKey:t.queryKey,pageParam:_,direction:C?"backward":"forward",meta:t.options.meta};return y(A),A})(),O=await b(T),{maxPages:D}=t.options,j=C?tS:eS;return{pages:j(x.pages,O,D),pageParams:j(x.pageParams,_,D)}};if(s&&i.length){const x=s==="backward",_=x?cS:sd,C={pages:i,pageParams:o},P=_(r,C);a=await v(C,P,x)}else{const x=e??i.length;do{const _=l===0?o[0]??r.initialPageParam:sd(r,a);if(l>0&&_==null)break;a=await v(a,_),l++}while(l<x)}return a};t.options.persister?t.fetchFn=()=>{var p,y;return(y=(p=t.options).persister)==null?void 0:y.call(p,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=d}}}function sd(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 cS(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 sr,Cn,ir,it,En,Me,Qr,Tn,Je,Fp,Dt,Kd,lS=(Kd=class extends Mp{constructor(t){super();ne(this,Je);ne(this,sr);ne(this,Cn);ne(this,ir);ne(this,it);ne(this,En);ne(this,Me);ne(this,Qr);ne(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,od(this.options)),this.state=t.state??E(this,Cn),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return E(this,sr)}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,sr,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=od(this.options);n.data!==void 0&&(this.setState(id(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=Go(this.state.data,t,this.options);return he(this,Je,Dt).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t){he(this,Je,Dt).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(Ge).catch(Ge):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===oi||!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:!Rp(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)||he(this,Je,Fp).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||he(this,Je,Dt).call(this,{type:"invalidate"})}async fetch(t,n){var d,u,f,h,m,g,p,y,b,v,x;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 _=this.observers.find(C=>C.options.queryFn);_&&this.setOptions(_.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=_=>{Object.defineProperty(_,"signal",{enumerable:!0,get:()=>(K(this,Tn,!0),r.signal)})},i=()=>{const _=Dp(this.options,n),P=(()=>{const T={client:E(this,En),queryKey:this.queryKey,meta:this.meta};return s(T),T})();return K(this,Tn,!1),this.options.persister?this.options.persister(_,P,this):_(P)},a=(()=>{const _={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:E(this,En),state:this.state,fetchFn:i};return s(_),_})(),l=E(this,sr)==="infinite"?aS(this.options.pages):this.options.behavior;l==null||l.onFetch(a,this),K(this,ir,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=a.fetchOptions)==null?void 0:u.meta))&&he(this,Je,Dt).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta}),K(this,Me,Ip({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:_=>{_ instanceof Zo&&_.revert&&this.setState({...E(this,ir),fetchStatus:"idle"}),r.abort()},onFail:(_,C)=>{he(this,Je,Dt).call(this,{type:"failed",failureCount:_,error:C})},onPause:()=>{he(this,Je,Dt).call(this,{type:"pause"})},onContinue:()=>{he(this,Je,Dt).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const _=await E(this,Me).start();if(_===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(_),(m=(h=E(this,it).config).onSuccess)==null||m.call(h,_,this),(p=(g=E(this,it).config).onSettled)==null||p.call(g,_,this.state.error,this),_}catch(_){if(_ instanceof Zo){if(_.silent)return E(this,Me).promise;if(_.revert){if(this.state.data===void 0)throw _;return this.state.data}}throw he(this,Je,Dt).call(this,{type:"error",error:_}),(b=(y=E(this,it).config).onError)==null||b.call(y,_,this),(x=(v=E(this,it).config).onSettled)==null||x.call(v,this.state.data,_,this),_}finally{this.scheduleGc()}}},sr=new WeakMap,Cn=new WeakMap,ir=new WeakMap,it=new WeakMap,En=new WeakMap,Me=new WeakMap,Qr=new WeakMap,Tn=new WeakMap,Je=new WeakSet,Fp=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Dt=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,...Up(r.data,this.options),fetchMeta:t.meta??null};case"success":const s={...r,...id(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return K(this,ir,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),Ue.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),E(this,it).notify({query:this,type:"updated",action:t})})},Kd);function Up(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:jp(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function id(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function od(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,or,jt,Jt,Jr,ar,cr,kn,An,en,lr,xe,Fr,Yo,Qo,Xo,Jo,ea,ta,na,Bp,Gd,dS=(Gd=class extends cs{constructor(t,n){super();ne(this,xe);ne(this,Ke);ne(this,be);ne(this,Xr);ne(this,We);ne(this,Pn);ne(this,or);ne(this,jt);ne(this,Jt);ne(this,Jr);ne(this,ar);ne(this,cr);ne(this,kn);ne(this,An);ne(this,en);ne(this,lr,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),ad(E(this,be),this.options)?he(this,xe,Fr).call(this):this.updateResult(),he(this,xe,Jo).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ra(E(this,be),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ra(E(this,be),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,he(this,xe,ea).call(this),he(this,xe,ta).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");he(this,xe,na).call(this),E(this,be).setOptions(this.options),n._defaulted&&!Wo(this.options,n)&&E(this,Ke).getQueryCache().notify({type:"observerOptionsUpdated",query:E(this,be),observer:this});const s=this.hasListeners();s&&cd(E(this,be),r,this.options,n)&&he(this,xe,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)))&&he(this,xe,Yo).call(this);const i=he(this,xe,Qo).call(this);s&&(E(this,be)!==r||et(this.options.enabled,E(this,be))!==et(n.enabled,E(this,be))||i!==E(this,en))&&he(this,xe,Xo).call(this,i)}getOptimisticResult(t){const n=E(this,Ke).getQueryCache().build(E(this,Ke),t),r=this.createResult(n,t);return fS(this,r)&&(K(this,We,r),K(this,or,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,lr).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 he(this,xe,Fr).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),E(this,We)))}createResult(t,n){var D;const r=E(this,be),s=this.options,i=E(this,We),o=E(this,Pn),a=E(this,or),d=t!==r?t.state:E(this,Xr),{state:u}=t;let f={...u},h=!1,m;if(n._optimisticResults){const j=this.hasListeners(),A=!j&&ad(t,n),N=j&&cd(t,r,n,s);(A||N)&&(f={...f,...Up(u.data,t.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:g,errorUpdatedAt:p,status:y}=f;m=f.data;let b=!1;if(n.placeholderData!==void 0&&m===void 0&&y==="pending"){let j;i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(j=i.data,b=!0):j=typeof n.placeholderData=="function"?n.placeholderData((D=E(this,cr))==null?void 0:D.state.data,E(this,cr)):n.placeholderData,j!==void 0&&(y="success",m=Go(i==null?void 0:i.data,j,n),h=!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,ar);else try{K(this,Jr,n.select),m=n.select(m),m=Go(i==null?void 0:i.data,m,n),K(this,ar,m),K(this,Jt,null)}catch(j){K(this,Jt,j)}E(this,Jt)&&(g=E(this,Jt),m=E(this,ar),p=Date.now(),y="error");const v=f.fetchStatus==="fetching",x=y==="pending",_=y==="error",C=x&&v,P=m!==void 0,O={status:y,fetchStatus:f.fetchStatus,isPending:x,isSuccess:y==="success",isError:_,isInitialLoading:C,isLoading:C,data:m,dataUpdatedAt:f.dataUpdatedAt,error:g,errorUpdatedAt:p,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:f.dataUpdateCount>d.dataUpdateCount||f.errorUpdateCount>d.errorUpdateCount,isFetching:v,isRefetching:v&&!x,isLoadingError:_&&!P,isPaused:f.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:_&&P,isStale:bc(t,n),refetch:this.refetch,promise:E(this,jt),isEnabled:et(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const j=O.data!==void 0,A=O.status==="error"&&!j,N=H=>{A?H.reject(O.error):j&&H.resolve(O.data)},B=()=>{const H=K(this,jt,O.promise=qo());N(H)},R=E(this,jt);switch(R.status){case"pending":t.queryHash===r.queryHash&&N(R);break;case"fulfilled":(A||O.data!==R.value)&&B();break;case"rejected":(!A||O.error!==R.reason)&&B();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,or,this.options),E(this,Pn).data!==void 0&&K(this,cr,E(this,be)),Wo(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,lr).size)return!0;const o=new Set(i??E(this,lr));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)})};he(this,xe,Bp).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&he(this,xe,Jo).call(this)}},Ke=new WeakMap,be=new WeakMap,Xr=new WeakMap,We=new WeakMap,Pn=new WeakMap,or=new WeakMap,jt=new WeakMap,Jt=new WeakMap,Jr=new WeakMap,ar=new WeakMap,cr=new WeakMap,kn=new WeakMap,An=new WeakMap,en=new WeakMap,lr=new WeakMap,xe=new WeakSet,Fr=function(t){he(this,xe,na).call(this);let n=E(this,be).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Ge)),n},Yo=function(){he(this,xe,ea).call(this);const t=an(this.options.staleTime,E(this,be));if(qr.isServer()||E(this,We).isStale||!Ho(t))return;const r=Rp(E(this,We).dataUpdatedAt,t)+1;K(this,kn,wn.setTimeout(()=>{E(this,We).isStale||this.updateResult()},r))},Qo=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(E(this,be)):this.options.refetchInterval)??!1},Xo=function(t){he(this,xe,ta).call(this),K(this,en,t),!(qr.isServer()||et(this.options.enabled,E(this,be))===!1||!Ho(E(this,en))||E(this,en)===0)&&K(this,An,wn.setInterval(()=>{(this.options.refetchIntervalInBackground||gc.isFocused())&&he(this,xe,Fr).call(this)},E(this,en)))},Jo=function(){he(this,xe,Yo).call(this),he(this,xe,Xo).call(this,he(this,xe,Qo).call(this))},ea=function(){E(this,kn)!==void 0&&(wn.clearTimeout(E(this,kn)),K(this,kn,void 0))},ta=function(){E(this,An)!==void 0&&(wn.clearInterval(E(this,An)),K(this,An,void 0))},na=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))},Bp=function(t){Ue.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(E(this,We))}),E(this,Ke).getQueryCache().notify({query:E(this,be),type:"observerResultsUpdated"})})},Gd);function uS(e,t){return et(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&et(t.retryOnMount,e)===!1)}function ad(e,t){return uS(e,t)||e.state.data!==void 0&&ra(e,t,t.refetchOnMount)}function ra(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&&bc(e,t)}return!1}function cd(e,t,n,r){return(e!==t||et(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&bc(e,n)}function bc(e,t){return et(t.enabled,e)!==!1&&e.isStaleByTime(an(t.staleTime,e))}function fS(e,t){return!Wo(e.getCurrentResult(),t)}var es,Ct,He,Nn,Et,Gt,qd,pS=(qd=class extends Mp{constructor(t){super();ne(this,Et);ne(this,es);ne(this,Ct);ne(this,He);ne(this,Nn);K(this,es,t.client),this.mutationId=t.mutationId,K(this,He,t.mutationCache),K(this,Ct,[]),this.state=t.state||mS(),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,Ct).includes(t)||(E(this,Ct).push(t),this.clearGcTimeout(),E(this,He).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){K(this,Ct,E(this,Ct).filter(n=>n!==t)),this.scheduleGc(),E(this,He).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){E(this,Ct).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,u,f,h,m,g,p,y,b,v,x,_,C,P,T;const n=()=>{he(this,Et,Gt).call(this,{type:"continue"})},r={client:E(this,es),meta:this.options.meta,mutationKey:this.options.mutationKey};K(this,Nn,Ip({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(O,D)=>{he(this,Et,Gt).call(this,{type:"failed",failureCount:O,error:D})},onPause:()=>{he(this,Et,Gt).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{he(this,Et,Gt).call(this,{type:"pending",variables:t,isPaused:i}),E(this,He).config.onMutate&&await E(this,He).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&&he(this,Et,Gt).call(this,{type:"pending",context:D,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((f=(u=this.options).onSuccess)==null?void 0:f.call(u,O,t,this.state.context,r)),await((m=(h=E(this,He).config).onSettled)==null?void 0:m.call(h,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)),he(this,Et,Gt).call(this,{type:"success",data:O}),O}catch(O){try{await((b=(y=E(this,He).config).onError)==null?void 0:b.call(y,O,t,this.state.context,this,r))}catch(D){Promise.reject(D)}try{await((x=(v=this.options).onError)==null?void 0:x.call(v,O,t,this.state.context,r))}catch(D){Promise.reject(D)}try{await((C=(_=E(this,He).config).onSettled)==null?void 0:C.call(_,void 0,O,this.state.variables,this.state.context,this,r))}catch(D){Promise.reject(D)}try{await((T=(P=this.options).onSettled)==null?void 0:T.call(P,void 0,O,t,this.state.context,r))}catch(D){Promise.reject(D)}throw he(this,Et,Gt).call(this,{type:"error",error:O}),O}finally{E(this,He).runNext(this)}}},es=new WeakMap,Ct=new WeakMap,He=new WeakMap,Nn=new WeakMap,Et=new WeakSet,Gt=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),Ue.batch(()=>{E(this,Ct).forEach(r=>{r.onMutationUpdate(t)}),E(this,He).notify({mutation:this,type:"updated",action:t})})},qd);function mS(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var It,ut,ts,Zd,hS=(Zd=class extends cs{constructor(t={}){super();ne(this,It);ne(this,ut);ne(this,ts);this.config=t,K(this,It,new Set),K(this,ut,new Map),K(this,ts,0)}build(t,n,r){const s=new pS({client:t,mutationCache:this,mutationId:++fs(this,ts)._,options:t.defaultMutationOptions(n),state:r});return this.add(s),s}add(t){E(this,It).add(t);const n=Ts(t);if(typeof n=="string"){const r=E(this,ut).get(n);r?r.push(t):E(this,ut).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(E(this,It).delete(t)){const n=Ts(t);if(typeof n=="string"){const r=E(this,ut).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,ut).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Ts(t);if(typeof n=="string"){const r=E(this,ut).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=Ts(t);if(typeof n=="string"){const s=(r=E(this,ut).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(){Ue.batch(()=>{E(this,It).forEach(t=>{this.notify({type:"removed",mutation:t})}),E(this,It).clear(),E(this,ut).clear()})}getAll(){return Array.from(E(this,It))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>td(n,r))}findAll(t={}){return this.getAll().filter(n=>td(t,n))}notify(t){Ue.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Ue.batch(()=>Promise.all(t.map(n=>n.continue().catch(Ge))))}},It=new WeakMap,ut=new WeakMap,ts=new WeakMap,Zd);function Ts(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Tt,Yd,gS=(Yd=class extends cs{constructor(t={}){super();ne(this,Tt);this.config=t,K(this,Tt,new Map)}build(t,n,r){const s=n.queryKey,i=n.queryHash??yc(s,n);let o=this.get(i);return o||(o=new lS({client:t,queryKey:s,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){E(this,Tt).has(t.queryHash)||(E(this,Tt).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=E(this,Tt).get(t.queryHash);n&&(t.destroy(),n===t&&E(this,Tt).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Ue.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return E(this,Tt).get(t)}getAll(){return[...E(this,Tt).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>ed(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>ed(t,r)):n}notify(t){Ue.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Ue.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Ue.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Tt=new WeakMap,Yd),Oe,tn,nn,dr,ur,rn,fr,pr,Qd,yS=(Qd=class{constructor(e={}){ne(this,Oe);ne(this,tn);ne(this,nn);ne(this,dr);ne(this,ur);ne(this,rn);ne(this,fr);ne(this,pr);K(this,Oe,e.queryCache||new gS),K(this,tn,e.mutationCache||new hS),K(this,nn,e.defaultOptions||{}),K(this,dr,new Map),K(this,ur,new Map),K(this,rn,0)}mount(){fs(this,rn)._++,E(this,rn)===1&&(K(this,fr,gc.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,Oe).onFocus())})),K(this,pr,ai.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,Oe).onOnline())})))}unmount(){var e,t;fs(this,rn)._--,E(this,rn)===0&&((e=E(this,fr))==null||e.call(this),K(this,fr,void 0),(t=E(this,pr))==null||t.call(this),K(this,pr,void 0))}isFetching(e){return E(this,Oe).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,Oe).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=E(this,Oe).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,Oe).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,Oe).get(r.queryHash),i=s==null?void 0:s.state.data,o=Qx(t,i);if(o!==void 0)return E(this,Oe).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return Ue.batch(()=>E(this,Oe).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,Oe).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=E(this,Oe);Ue.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=E(this,Oe);return Ue.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Ue.batch(()=>E(this,Oe).findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(Ge).catch(Ge)}invalidateQueries(e,t={}){return Ue.batch(()=>(E(this,Oe).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=Ue.batch(()=>E(this,Oe).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,n);return n.throwOnError||(i=i.catch(Ge)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Ge)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=E(this,Oe).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(Ge).catch(Ge)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ge).catch(Ge)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return ai.isOnline()?E(this,tn).resumePausedMutations():Promise.resolve()}getQueryCache(){return E(this,Oe)}getMutationCache(){return E(this,tn)}getDefaultOptions(){return E(this,nn)}setDefaultOptions(e){K(this,nn,e)}setQueryDefaults(e,t){E(this,dr).set(Kr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...E(this,dr).values()],n={};return t.forEach(r=>{Gr(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){E(this,ur).set(Kr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...E(this,ur).values()],n={};return t.forEach(r=>{Gr(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=yc(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===oi&&(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,Oe).clear(),E(this,tn).clear()}},Oe=new WeakMap,tn=new WeakMap,nn=new WeakMap,dr=new WeakMap,ur=new WeakMap,rn=new WeakMap,fr=new WeakMap,pr=new WeakMap,Qd),$p=w.createContext(void 0),Vp=e=>{const t=w.useContext($p);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},bS=({client:e,children:t})=>(w.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),c.jsx($p.Provider,{value:e,children:t})),Hp=w.createContext(!1),vS=()=>w.useContext(Hp);Hp.Provider;function wS(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var _S=w.createContext(wS()),xS=()=>w.useContext(_S),SS=(e,t,n)=>{const r=n!=null&&n.state.error&&typeof e.throwOnError=="function"?Lp(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},CS=e=>{w.useEffect(()=>{e.clearReset()},[e])},ES=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||Lp(n,[e.error,r])),TS=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))}},PS=(e,t)=>e.isLoading&&e.isFetching&&!t,kS=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,ld=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function AS(e,t,n){var m,g,p,y;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=vS(),s=xS(),i=Vp(),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,TS(o),SS(o,s,a),CS(s);const d=!i.getQueryCache().get(o.queryHash),[u]=w.useState(()=>new t(i,o)),f=u.getOptimisticResult(o),h=!r&&l;if(w.useSyncExternalStore(w.useCallback(b=>{const v=h?u.subscribe(Ue.batchCalls(b)):Ge;return u.updateResult(),v},[u,h]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),w.useEffect(()=>{u.setOptions(o)},[o,u]),kS(o,f))throw ld(o,u,s);if(ES({result:f,errorResetBoundary:s,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw f.error;if((y=(p=i.getDefaultOptions().queries)==null?void 0:p._experimental_afterQuery)==null||y.call(p,o,f),o.experimental_prefetchInRender&&!qr.isServer()&&PS(f,r)){const b=d?ld(o,u,s):a==null?void 0:a.promise;b==null||b.catch(Ge).finally(()=>{u.updateResult()})}return o.notifyOnChangeProps?f:u.trackResult(f)}function Nr(e,t){return AS(e,dS)}const zp=S.createContext(null);function NS(e){return typeof window>"u"?e??null:e?(localStorage.setItem(_p,e),e):null}function OS({token:e,children:t}){const n=NS(e);return c.jsx(zp.Provider,{value:n,children:t})}function RS(){return S.useContext(zp)}const DS="widget-accounts",Wp="widget-positions",Kp="widget-orders",LS="widget-deals",jS="widget-deals-total",IS=2e4;function $s(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 MS(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 vc(e){if(e==null||e==="")return"—";if(typeof e=="number"&&Number.isFinite(e)){const t=e>1e12?e:e*1e3;return $s(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 $s(new Date(s))}}const n=Date.parse(t);return Number.isFinite(n)?$s(new Date(n)):t}if(typeof e=="object"&&e!==null){const n=MS(e);if(n!==void 0)return vc(n)}return"—"}const Gp=["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 FS(e){return $s(e)}const US={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 Bi(e,t){for(const n of t)if(e[n]!==void 0&&e[n]!==null&&e[n]!=="")return e[n]}function xt(e,t){const n=Bi(e,t);if(n===void 0)return;const r=Number(n);return Number.isFinite(r)?r:void 0}function Ps(e,t){const n=Bi(e,t);if(n!==void 0)return String(n)}function BS(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 sa(e){return e===void 0?.01:e>=100?e/1e4:e}function $S(e,t){return If(t,e)}function VS(e){const t=Bi(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=xt(e,["type","Type","orderType","OrderType"])??2;return{label:US[n]??(n%2===1?"sell":"buy"),side:ni(n),typeNum:n}}function HS(e,t){const n=xt(e,["volumeFilled","volume_filled","VolumeFilled","filledVolume","FilledVolume"]);if(n!==void 0)return sa(n);const r=xt(e,["volumeCurrent","volume_current","VolumeCurrent"]);return r!==void 0?sa(r):0}function zS(e,t){const n=Ps(e,["ticket","Ticket","order","Order","id","ID"]),r=Ps(e,["symbol","Symbol"])??"";if(!n||!r)return null;const s=Ye(r),{label:i,side:o,typeNum:a}=VS(e),l=xt(e,["typeTime","TypeTime"])??0,d=sa(xt(e,["volumeLots","volume_lots","VolumeLots","volume","Volume"])),u=HS(e),f=xt(e,["priceOrder","price_order","PriceOrder","openPrice","open_price","price","Price"])??0,h=xt(e,["priceTrigger","price_trigger","PriceTrigger","triggerPrice","TriggerPrice"]),m=xt(e,["currentPrice","current_price","PriceCurrent","priceCurrent","marketPrice","MarketPrice"])??f,g=xt(e,["stopLoss","stop_loss","PriceSL","sl","SL"]),p=xt(e,["takeProfit","take_profit","PriceTP","tp","TP"]),y=Ps(e,["comment","Comment"])??"",b=$S(e,s),v=vc(Bi(e,Gp));return{ticket:n,login:Ps(e,["login","Login"])??t,symbol:s,displaySymbol:Ni(s),time:v,typeLabel:i,orderType:a,typeTime:l,side:o,volumeLots:d,volumeFilledLots:u,orderPrice:f,priceTrigger:h,stopLoss:g,takeProfit:p,currentPrice:m,comment:y,digits:b}}function WS(e,t){return BS(e).map(n=>zS(n,t)).filter(n=>n!==null)}function $i(e,t){for(const n of t)if(e[n]!==void 0&&e[n]!==null&&e[n]!=="")return e[n]}function qt(e,t){const n=$i(e,t);if(n===void 0)return;const r=Number(n);return Number.isFinite(r)?r:void 0}function ks(e,t){const n=$i(e,t);if(n!==void 0)return String(n)}function KS(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 GS(e){return e===void 0?.01:e>=100?e/1e4:e}function qS(e){const t=$i(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=qt(e,["type","Type","action","Action"]);return n!==void 0&&n%2===1?"sell":"buy"}function ZS(e,t){return If(t,e)}function YS(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=GS(qt(e,["volumeLots","volume_lots","VolumeLots","volume","Volume"])),a=qt(e,["openPrice","open_price","PriceOpen","priceOpen","price","Price"])??0,l=qt(e,["currentPrice","current_price","PriceCurrent","priceCurrent"])??a,d=qt(e,["stopLoss","stop_loss","PriceSL","sl","SL"]),u=qt(e,["takeProfit","take_profit","PriceTP","tp","TP"]),f=qt(e,["profit","Profit","floating","Floating","pnl","PnL"])??0,h=qt(e,["swap","Swap"])??0,m=ks(e,["comment","Comment"])??"",g=ZS(e,s),p=vc($i(e,Gp));return{ticket:n,login:ks(e,["login","Login"])??t,symbol:s,displaySymbol:Ni(s),time:p,type:i,volumeLots:o,openPrice:a,stopLoss:d,takeProfit:u,currentPrice:l,marketBid:l,marketAsk:l,swap:h,profit:f,comment:m,digits:g}}function QS(e,t){return KS(e).map(n=>YS(n,t)).filter(n=>n!==null)}function ls(){return Bt}function qp(){const e=Rt(),t=RS(),{data:n,isLoading:r,isError:s}=Nr({queryKey:[DS,e.baseUrl,t],queryFn:()=>e.getAccounts(),enabled:!!t});return{accounts:n??[],isLoading:r,isError:s}}function XS(e){const t=Rt();return Nr({queryKey:[Wp,t.baseUrl,e],queryFn:()=>t.dealer.getPositions(e),enabled:!!e,refetchInterval:IS})}function JS(e){const t=Rt();return Nr({queryKey:[Kp,t.baseUrl,e],queryFn:()=>t.dealer.getOrders(e),enabled:!!e})}function e0(){const e=Vp(),t=Rt();return S.useCallback((n,r)=>{e.invalidateQueries({queryKey:[Wp,t.baseUrl,n]}),(r===void 0||nc(r))&&e.invalidateQueries({queryKey:[Kp,t.baseUrl,n]})},[t.baseUrl,e])}function Vi(){const e=Rt(),t=e0();return{async submitOrder(n){const r=await e.trading.submitOrder(n);return r.success&&t(n.login,n.orderType),r},async closePosition(n){const r=await e.trading.closePosition(n);return r.success&&t(n.login),r},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 t0(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 n0(e){if(e===null||typeof e!="object")return{total:0};const t=e,n=t.data??t;return{total:Number(n.total??0)}}function r0(e,t,n,r={}){const s=Rt();return Nr({queryKey:[jS,s.baseUrl,e,t,n],queryFn:async()=>{const i=await s.dealer.getDealsTotal(e,t,n);return n0(i)},enabled:r.enabled??!0})}function s0(e,t,n,r,s,i={}){const o=Rt();return Nr({queryKey:[LS,o.baseUrl,e,t,n,r,s],queryFn:async()=>{const a=await o.dealer.getDeals(e,t,n,r,s);return t0(a)},enabled:i.enabled??!0})}function i0(e,t){return e!=null?QS(e,t):[]}function o0(e,t){return e!=null?WS(e,t):[]}function a0({symbolTicker:e,controlsRef:t,chartWidget:n,scanResultUrl:r,orderState:s,backUrl:i,createAccountUrl:o}){const{openMarketPanel:a,setSelectedLogin:l}=s,d=ls();return S.useEffect(()=>(t.current={open:a,setSelectedLogin:l},()=>{t.current=null}),[t,a,l]),c.jsxs(c.Fragment,{children:[c.jsx(Op,{chartWidget:n,symbolTicker:e,symbols:d}),c.jsx(Cp,{}),c.jsx(Nx,{symbolTicker:e,scanResultUrl:r,orderState:s,backUrl:i,createAccountUrl:o})]})}const c0=8,dd=11;function l0({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 d0(){return c.jsx(c.Fragment,{children:Array.from({length:c0},(e,t)=>c.jsx("tr",{className:"web-trading-widget-terminal__skeleton-row",children:Array.from({length:dd},(n,r)=>c.jsx(l0,{wide:r===dd-1},r))},t))})}const u0={0:"Buy",1:"Sell",2:"Balance",3:"Credit",5:"-"},f0="web-trading-widget-text-buy",p0="web-trading-widget-text-sell",m0="web-trading-widget-terminal__head-row",bo=50;function h0(e){return e===0?f0:e===1?p0:m0}const ud=e=>e.toISOString().split("T")[0],Zp=e=>Math.floor(new Date(e).getTime()/1e3),g0=e=>Zp(e),y0=e=>Zp(e)+86399;function b0(){const e=new Date,t=new Date;return t.setDate(t.getDate()-7),{fromTs:g0(ud(t)),toTs:y0(ud(e))}}const v0=e=>new Date(e*1e3).toLocaleString(void 0,{year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"});function w0(e){try{return decodeURIComponent(e)}catch{return e}}function _0(){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 x0(){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 S0({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 ${h0(e.action)}`,children:u0[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:FS(new Date(e.time*1e3))}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--nowrap",children:v0(e.time)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--truncate",children:e.comment?w0(e.comment):"—"})]})}function C0({login:e,detailUrl:t}){const{fromTs:n,toTs:r}=S.useMemo(()=>b0(),[]),s=e!=="",{data:i,isLoading:o}=r0(e,n,r,{enabled:s}),a=(i==null?void 0:i.total)??0,l=Math.max(0,a-bo),d=a>0?Math.min(bo,a):bo,{data:u,isLoading:f}=s0(e,n,r,l,d,{enabled:s}),h=s&&(o||f),m=S.useMemo(()=>[...(u==null?void 0:u.deals)??[]].sort((g,p)=>p.time-g.time),[u==null?void 0:u.deals]);return e?c.jsxs("div",{className:"web-trading-widget-terminal__deals-wrap",children:[c.jsx("div",{className:"web-trading-widget-terminal__body-scroll",children:c.jsxs("table",{className:"web-trading-widget-terminal__deals-table",children:[c.jsx(_0,{}),c.jsx(x0,{}),c.jsxs("tbody",{children:[h?c.jsx(d0,{}):null,!h&&m.length===0?c.jsx("tr",{children:c.jsx("td",{colSpan:11,className:"web-trading-widget-terminal__empty-cell",children:"No deals found"})}):null,h?null:m.map(g=>c.jsx(S0,{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:"More detail"})}):null]}):c.jsx("div",{className:"web-trading-widget-terminal__empty-cell",children:"Select an account to view deal history"})}function Yp(e){const t=ve(d=>d.setPositions),n=ve(d=>d.setOrders),{data:r,isLoading:s,isError:i}=XS(e),{data:o,isLoading:a,isError:l}=JS(e);return S.useEffect(()=>{if(!e.trim()){t([]),n([]);return}r!=null&&t(i0(r,e)),o!=null&&n(o0(o,e))},[e,o,r,n,t]),{isLoading:s||a,isError:!!(i||l)}}const fd=224,pd=32,wc=120;function Qp(){return typeof window>"u"?560:Math.max(wc,Math.floor(window.innerHeight*.7))}function E0(e){return Math.min(Qp(),Math.max(wc,e))}function T0(){const[e,t]=S.useState(fd),[n,r]=S.useState(!1),s=S.useRef(fd);S.useEffect(()=>{s.current=e},[e]);const i=S.useCallback(u=>{t(E0(u))},[]),o=S.useCallback(()=>{i(s.current+pd)},[i]),a=S.useCallback(()=>{i(s.current-pd)},[i]),l=S.useCallback(u=>{const f=u,h=s.current;r(!0);const m=p=>{const y=f-p.clientY;i(h+y)},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]);S.useEffect(()=>{const u=()=>{i(s.current)};return window.addEventListener("resize",u),()=>{window.removeEventListener("resize",u),document.body.style.cursor="",document.body.style.userSelect=""}},[i]);const d=Qp();return{height:e,isResizing:n,canIncrement:e<d,canDecrement:e>wc,onResizeStart:l,incrementHeight:o,decrementHeight:a}}const P0=e=>e==null?void 0:e.replace(/(\d+)\.0{18}/g,"$1"),k0=2e4;let vo=0;function A0(){return vo=(vo+1)%Number.MAX_VALUE,vo.toString()}const wo=new Map,md=(e,t)=>{if(wo.has(e))return;const n=setTimeout(()=>{wo.delete(e),Br({type:"REMOVE_TOAST",toastId:e})},t||k0);wo.set(e,n)},N0=(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);md(r,s==null?void 0:s.duration)}else e.toasts.forEach(s=>{md(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)}}},Vs=[];let Hs={toasts:[]};function Br(e){Hs=N0(Hs,e),Vs.forEach(t=>{t(Hs)})}function Se({duration:e=2e4,description:t,...n}){const r=A0(),s=typeof t=="string"?P0(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 O0(){const[e,t]=w.useState(Hs);return w.useEffect(()=>(Vs.push(t),()=>{const n=Vs.indexOf(t);n>-1&&Vs.splice(n,1)}),[e]),{...e,toast:Se,dismiss:n=>Br({type:"DISMISS_TOAST",toastId:n})}}function R0(e){return e.type==="buy"?e.marketBid??e.currentPrice:e.marketAsk??e.currentPrice}function D0(){const{closePosition:e,deleteOrder:t}=Vi(),n=ve(p=>p.removePosition),r=ve(p=>p.removeOrder),s=ve(p=>p.setSelectedPositionTicket),i=ve(p=>p.setSelectedOrderTicket),[o,a]=S.useState(new Set),[l,d]=S.useState(!1),u=S.useCallback((p,y)=>{a(b=>{const v=new Set(b);return y?v.add(p):v.delete(p),v})},[]),f=S.useCallback(p=>o.has(p),[o]),h=S.useCallback(async p=>{const y=`position-${p.ticket}`;u(y,!0);try{const b=await e(p);if(!b.success){Se({variant:"destructive",description:b.message||"Failed to close position."});return}n(p.ticket),s(null),Se({description:`Position #${p.ticket} closed at ${R0(p).toFixed(p.digits)}.`})}catch(b){const v=b instanceof Error?b.message:"Failed to close position.";Se({variant:"destructive",description:v})}finally{u(y,!1)}},[e,n,u,s]),m=S.useCallback(async p=>{if(p.length===0||l)return;if(!e){Se({variant:"destructive",description:"Close position is not configured."});return}d(!0);let y=0,b=0;for(const v of p){const x=`position-${v.ticket}`;u(x,!0);try{if(!(await e(v)).success){b+=1;continue}n(v.ticket),y+=1}catch{b+=1}finally{u(x,!1)}}s(null),Se(b===0?{description:y===1?"1 position closed.":`${y} positions closed.`}:y===0?{variant:"destructive",description:"Failed to close positions."}:{variant:"destructive",description:`Closed ${y}, failed ${b}.`}),d(!1)},[l,e,n,u,s]),g=S.useCallback(async p=>{const y=`order-${p.ticket}`;u(y,!0);try{const b=await t(p);if(!b.success){Se({variant:"destructive",description:b.message||"Failed to delete order."});return}r(p.ticket),i(null),Se({description:`Order #${p.ticket} deleted.`})}catch(b){const v=b instanceof Error?b.message:"Failed to delete order.";Se({variant:"destructive",description:v})}finally{u(y,!1)}},[t,r,u,i]);return{closePosition:h,closeAllPositions:m,deleteOrder:g,isClosingAll:l,isRowBusy:f}}function Zt(e,t=2){return e.toFixed(t)}function Xp(e){return e.reduce((t,n)=>t+n.profit+n.swap,0)}function L0(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=Xp(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 ia(){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 j0(){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 I0({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(ia,{}),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 M0=[{id:"trade",label:"Trade"},{id:"history",label:"History"}];function F0({activeTab:e,onTabChange:t,positionCount:n,isClosingAll:r,onCloseAllPositions:s}){const i=e==="trade"&&n>0;return c.jsxs("div",{role:"tablist","aria-label":"Terminal panel tabs",className:"web-trading-widget-terminal__tab-bar",children:[M0.map(o=>{const a=e===o.id;return c.jsx("button",{type:"button",role:"tab","aria-selected":a,onClick:()=>t(o.id),className:`web-trading-widget-terminal__tab-btn${a?" web-trading-widget-terminal__tab-btn--active":""}`,children:o.label},o.id)}),c.jsx("div",{className:"web-trading-widget-terminal__toolbar-actions",children:i?c.jsx("button",{type:"button",disabled:r,onClick:s,className:"web-trading-widget-terminal__close-all-btn",children:r?"Closing…":"Close all"}):null})]})}function U0({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:Ee(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?Ee(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?Ee(e.takeProfit,e.digits):"N/A"}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:Ee(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 B0({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:Ee(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?Ee(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?Ee(e.takeProfit,e.digits):"N/A"}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:Ee(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 Jp({embedded:e=!1,symbolTicker:t="",onSymbolChange:n,onCreateNewOrder:r,dealDetailUrl:s}){const[i,o]=S.useState("trade"),a=ls(),{accounts:l,isLoading:d}=qp(),u=T0(),{height:f,isResizing:h,onResizeStart:m}=e?{height:0,isResizing:!1,onResizeStart:()=>{}}:u,g=ve($=>$.selectedLogin),p=ve($=>$.selectedPositionTicket),y=ve($=>$.selectedOrderTicket),b=ve($=>$.setSelectedPositionTicket),v=ve($=>$.setSelectedOrderTicket),{isLoading:x}=Yp(g),_=ve($=>$.positions),C=ve($=>$.orders),{closePosition:P,closeAllPositions:T,deleteOrder:O,isClosingAll:D,isRowBusy:j}=D0(),A=d||x,N=S.useMemo(()=>g?_.filter($=>$.login===g):_,[_,g]),B=S.useMemo(()=>g?C.filter($=>$.login===g):C,[C,g]),R=S.useMemo(()=>{const $=l.find(ye=>ye.login===g);return($==null?void 0:$.tradeStat)??null},[l,g]),H=S.useMemo(()=>N.map($=>$.ticket).sort().join("|"),[N]),F=S.useMemo(()=>R?`${R.balance}:${R.credit??0}:${R.equity}:${R.margin}|${H}`:"",[R,H]),I=S.useMemo(()=>{if(!R||N.length===0)return 0;const $=Xp(N);return R.equity-R.balance-(R.credit??0)-$},[F]),L=S.useMemo(()=>L0(R,N,I),[R,N,I]),U=N.length===0&&B.length===0,z=S.useRef(null),M=S.useRef(null),se=S.useRef(null),W=S.useCallback(()=>{T(N)},[T,N]),de=S.useCallback($=>{const ye=Bv($,a);ye&&(n==null||n(ye))},[n,a]),ue=S.useCallback($=>{b($.ticket),de($.symbol)},[b,de]),ee=S.useCallback($=>{v($.ticket),de($.symbol)},[v,de]),Z=S.useCallback($=>{const ye=z.current,ae=M.current,ie=se.current;if(!ye||!ae)return;const te=$==="header"?ye.scrollLeft:$==="body"?ae.scrollLeft:(ie==null?void 0:ie.scrollLeft)??0;$!=="header"&&(ye.scrollLeft=te),$!=="body"&&(ae.scrollLeft=te),ie&&$!=="footer"&&(ie.scrollLeft=te)},[]);return c.jsxs(c.Fragment,{children:[!e&&h?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:f},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":f,className:"web-trading-widget-terminal__resize-bar",onMouseDown:$=>{$.preventDefault(),m($.clientY)},children:c.jsx(Lf,{className:"web-trading-widget-icon web-trading-widget-icon--sm web-trading-widget-terminal__resize-icon"})})}),c.jsx(F0,{activeTab:i,onTabChange:o,positionCount:N.length,isClosingAll:D,onCloseAllPositions:W}),i==="trade"?c.jsxs(c.Fragment,{children:[c.jsx("div",{ref:z,className:"web-trading-widget-terminal__header-scroll",onScroll:()=>Z("header"),children:c.jsxs("table",{className:"web-trading-widget-terminal__table",children:[c.jsx(ia,{}),c.jsx(j0,{})]})}),c.jsx("div",{ref:M,className:"web-trading-widget-terminal__body-scroll",onScroll:()=>Z("body"),children:c.jsxs("table",{className:"web-trading-widget-terminal__table",children:[c.jsx(ia,{}),c.jsxs("tbody",{children:[A&&U?c.jsx("tr",{children:c.jsx("td",{colSpan:13,className:"web-trading-widget-terminal__empty-cell",children:"Loading…"})}):null,!A&&U?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,N.map($=>c.jsx(U0,{position:$,isSelected:p===$.ticket,isClosing:j(`position-${$.ticket}`),onSelect:()=>ue($),onClose:()=>void P($)},`position-${$.ticket}`)),B.map($=>c.jsx(B0,{order:$,isSelected:y===$.ticket,isDeleting:j(`order-${$.ticket}`),onSelect:()=>ee($),onDelete:()=>void O($)},`order-${$.ticket}`))]})]})})]}):c.jsx(C0,{login:g??"",detailUrl:s}),c.jsx(I0,{balance:L.balance,equity:L.equity,margin:L.margin,marginFree:L.marginFree,marginLevel:L.marginLevel,totalPnL:L.totalProfit,scrollRef:i==="trade"?se:void 0,onScroll:i==="trade"?()=>Z("footer"):void 0})]})]})}const oa=224,ci=120;function $0(e){var n;const t=(n=e==null?void 0:e.current)==null?void 0:n.clientHeight;return t&&t>0?Math.max(ci,Math.floor(t*.35)):oa}function V0(e){var n;const t=(n=e==null?void 0:e.current)==null?void 0:n.clientHeight;return t&&t>0?Math.max(ci,Math.floor(t*.85)):typeof window>"u"?560:Math.max(ci,Math.floor(window.innerHeight*.7))}function H0(e,t){return Math.min(V0(t),Math.max(ci,e))}function z0({containerRef:e,isOpen:t=!1}={}){const[n,r]=S.useState(oa),[s,i]=S.useState(!1),o=S.useRef(oa);S.useEffect(()=>{o.current=n},[n]);const a=S.useCallback(d=>{r(H0(d,e))},[e]);S.useEffect(()=>{if(!t)return;const d=Math.max(o.current,$0(e));a(d)},[e,t,a]);const l=S.useCallback(d=>{const u=d,f=o.current;i(!0);const h=g=>{const p=u-g.clientY;a(f+p)},m=()=>{i(!1),document.removeEventListener("mousemove",h),document.removeEventListener("mouseup",m),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",h),document.addEventListener("mouseup",m),document.body.style.cursor="row-resize",document.body.style.userSelect="none"},[a]);return S.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 em({children:e}){const[t]=S.useState(()=>new yS({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}}));return c.jsx(bS,{client:t,children:e})}function tm({containerRef:e,onCreateNewOrder:t}){const[n,r]=S.useState(!1),{height:s,isResizing:i,onResizeStart:o}=z0({containerRef:e,isOpen:n}),a=ve(g=>g.selectedLogin),l=ve(g=>g.orders),d=ve(g=>g.positions),u=S.useMemo(()=>a?l.filter(g=>g.login===a):l,[a,l]),f=S.useMemo(()=>a?d.filter(g=>g.login===a):d,[a,d]),h=u.length+f.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(Ev,{className:"web-trading-widget-icon web-trading-widget-icon--sm"}),c.jsx("span",{children:"Orders"}),h>0?c.jsx("span",{className:"web-trading-widget-news-orders-overlay__badge",children:h}):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(Lf,{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(Jp,{embedded:!0,onCreateNewOrder:t?m:void 0})})]})}):null]})}function W0({baseUrl:e,containerRef:t,onCreateNewOrder:n}){return c.jsx(em,{children:c.jsx(Sp,{baseUrl:e,children:c.jsx(tm,{containerRef:t,onCreateNewOrder:n})})})}const Rn=S.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 Hi="Collapsible",[K0,nm]=$n(Hi),[G0,_c]=K0(Hi),rm=w.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:s,disabled:i,onOpenChange:o,...a}=e,[l,d]=Dn({prop:r,defaultProp:s??!1,onChange:o,caller:Hi});return c.jsx(G0,{scope:n,disabled:i,contentId:on(),open:l,onOpenToggle:w.useCallback(()=>d(u=>!u),[d]),children:c.jsx(me.div,{"data-state":Sc(l),"data-disabled":i?"":void 0,...a,ref:t})})});rm.displayName=Hi;var sm="CollapsibleTrigger",im=w.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,s=_c(sm,n);return c.jsx(me.button,{type:"button","aria-controls":s.open?s.contentId:void 0,"aria-expanded":s.open||!1,"data-state":Sc(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:t,onClick:pe(e.onClick,s.onOpenToggle)})});im.displayName=sm;var xc="CollapsibleContent",om=w.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=_c(xc,e.__scopeCollapsible);return c.jsx(Vn,{present:n||s.open,children:({present:i})=>c.jsx(q0,{...r,ref:t,present:i})})});om.displayName=xc;var q0=w.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:s,...i}=e,o=_c(xc,n),[a,l]=w.useState(r),d=w.useRef(null),u=Pe(t,d),f=w.useRef(0),h=f.current,m=w.useRef(0),g=m.current,p=o.open||a,y=w.useRef(p),b=w.useRef(void 0);return w.useEffect(()=>{const v=requestAnimationFrame(()=>y.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 x=v.getBoundingClientRect();f.current=x.height,m.current=x.width,y.current||(v.style.transitionDuration=b.current.transitionDuration,v.style.animationName=b.current.animationName),l(r)}},[o.open,r]),c.jsx(me.div,{"data-state":Sc(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!p,...i,ref:u,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...e.style},children:p&&s})});function Sc(e){return e?"open":"closed"}var Z0=rm,Y0=im,Q0=om,wt="Accordion",X0=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[Cc,J0,eC]=Da(wt),[zi]=$n(wt,[eC,nm]),Ec=nm(),am=w.forwardRef((e,t)=>{const{type:n,...r}=e,s=r,i=r;return c.jsx(Cc.Provider,{scope:e.__scopeAccordion,children:n==="multiple"?c.jsx(sC,{...i,ref:t}):c.jsx(rC,{...s,ref:t})})});am.displayName=wt;var[cm,tC]=zi(wt),[lm,nC]=zi(wt,{collapsible:!1}),rC=w.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},collapsible:i=!1,...o}=e,[a,l]=Dn({prop:n,defaultProp:r??"",onChange:s,caller:wt});return c.jsx(cm,{scope:e.__scopeAccordion,value:w.useMemo(()=>a?[a]:[],[a]),onItemOpen:l,onItemClose:w.useCallback(()=>i&&l(""),[i,l]),children:c.jsx(lm,{scope:e.__scopeAccordion,collapsible:i,children:c.jsx(dm,{...o,ref:t})})})}),sC=w.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},...i}=e,[o,a]=Dn({prop:n,defaultProp:r??[],onChange:s,caller:wt}),l=w.useCallback(u=>a((f=[])=>[...f,u]),[a]),d=w.useCallback(u=>a((f=[])=>f.filter(h=>h!==u)),[a]);return c.jsx(cm,{scope:e.__scopeAccordion,value:o,onItemOpen:l,onItemClose:d,children:c.jsx(lm,{scope:e.__scopeAccordion,collapsible:!0,children:c.jsx(dm,{...i,ref:t})})})}),[iC,Wi]=zi(wt),dm=w.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:r,dir:s,orientation:i="vertical",...o}=e,a=w.useRef(null),l=Pe(a,t),d=J0(n),f=Iu(s)==="ltr",h=pe(e.onKeyDown,m=>{var O;if(!X0.includes(m.key))return;const g=m.target,p=d().filter(D=>{var j;return!((j=D.ref.current)!=null&&j.disabled)}),y=p.findIndex(D=>D.ref.current===g),b=p.length;if(y===-1)return;m.preventDefault();let v=y;const x=0,_=b-1,C=()=>{v=y+1,v>_&&(v=x)},P=()=>{v=y-1,v<x&&(v=_)};switch(m.key){case"Home":v=x;break;case"End":v=_;break;case"ArrowRight":i==="horizontal"&&(f?C():P());break;case"ArrowDown":i==="vertical"&&C();break;case"ArrowLeft":i==="horizontal"&&(f?P():C());break;case"ArrowUp":i==="vertical"&&P();break}const T=v%b;(O=p[T].ref.current)==null||O.focus()});return c.jsx(iC,{scope:n,disabled:r,direction:s,orientation:i,children:c.jsx(Cc.Slot,{scope:n,children:c.jsx(me.div,{...o,"data-orientation":i,ref:l,onKeyDown:r?void 0:h})})})}),li="AccordionItem",[oC,Tc]=zi(li),um=w.forwardRef((e,t)=>{const{__scopeAccordion:n,value:r,...s}=e,i=Wi(li,n),o=tC(li,n),a=Ec(n),l=on(),d=r&&o.value.includes(r)||!1,u=i.disabled||e.disabled;return c.jsx(oC,{scope:n,open:d,disabled:u,triggerId:l,children:c.jsx(Z0,{"data-orientation":i.orientation,"data-state":ym(d),...a,...s,ref:t,disabled:u,open:d,onOpenChange:f=>{f?o.onItemOpen(r):o.onItemClose(r)}})})});um.displayName=li;var fm="AccordionHeader",pm=w.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=Wi(wt,n),i=Tc(fm,n);return c.jsx(me.h3,{"data-orientation":s.orientation,"data-state":ym(i.open),"data-disabled":i.disabled?"":void 0,...r,ref:t})});pm.displayName=fm;var aa="AccordionTrigger",mm=w.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=Wi(wt,n),i=Tc(aa,n),o=nC(aa,n),a=Ec(n);return c.jsx(Cc.ItemSlot,{scope:n,children:c.jsx(Y0,{"aria-disabled":i.open&&!o.collapsible||void 0,"data-orientation":s.orientation,id:i.triggerId,...a,...r,ref:t})})});mm.displayName=aa;var hm="AccordionContent",gm=w.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=Wi(wt,n),i=Tc(hm,n),o=Ec(n);return c.jsx(Q0,{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}})});gm.displayName=hm;function ym(e){return e?"open":"closed"}var aC=am,cC=um,lC=pm,bm=mm,vm=gm;const dC=aC,qn=w.forwardRef(({className:e,...t},n)=>c.jsx(cC,{ref:n,className:Ce("border-b",e),...t}));qn.displayName="AccordionItem";const Zn=w.forwardRef(({className:e,children:t,...n},r)=>c.jsx(lC,{className:"flex",children:c.jsxs(bm,{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(Xa,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"})]})}));Zn.displayName=bm.displayName;const Yn=w.forwardRef(({className:e,children:t,...n},r)=>c.jsx(vm,{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})}));Yn.displayName=vm.displayName;function hd(e){const t=e.trim().replace(/,/g,"");if(!t)return null;const n=Number(t);return Number.isFinite(n)?n:null}function gd(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 u=t.trim()!=="",f=g=>{if(l)return;const p=hd(t),y=a!=null&&Number.isFinite(a)?a:s??0,v=(p??y)+g*r,x=s!==void 0?Math.max(s,v):v;x<=0||n(gd(x,i))},h=()=>{const g=hd(t);if(g===null||g<=0){t.trim()!==""&&n("");return}n(gd(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&&u?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:()=>f(-1),children:c.jsx(Pv,{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:h,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:()=>f(1),children:c.jsx(kv,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})]})]})}function uC({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,embedded:d=!1,onMinimize:u,onClose:f,onPlaceOrder:h}){const[m,g]=S.useState("market"),[p,y]=S.useState(String(r)),[b,v]=S.useState(""),[x,_]=S.useState(""),C=oe(re=>re.stopLoss),P=oe(re=>re.takeProfit),T=oe(re=>re.setStopLoss),O=oe(re=>re.setTakeProfit),D=oe(re=>re.setVolumeLots),j=oe(re=>re.setOrderSide),[A,N]=S.useState(""),[B,R]=S.useState(ft.GTC),[H,F]=S.useState(""),[I,L]=S.useState(""),U=Number(Vt(Ht(e))),z=Pr(U),M=Bf(t,n),se=t!==null?Ee(t,U):"—",W=n!==null?Ee(n,U):"—",de=Ri(m),ue=Mf(m),ee=Oi(m),Z=ee.label,$=!de&&ee.orderType!==null&&ee.orderType%2===1,ye=S.useMemo(()=>M!==null?M:t??n,[n,t,M]),ae=re=>{y(re);const $e=Number(re);Number.isFinite($e)&&$e>0&&D($e)},ie=re=>t===null||n===null?null:de?re==="buy"?n:t:pt(b)??(re==="buy"?n:t),te=re=>{const $e=ie(re);$e!==null&&j({side:re,entryPrice:$e})},je=re=>{if(t===null||n===null||!l)return;const $e=Math.max(i,Number(p)||i),qi=Mo(m,re),us=ie(re);us!==null&&j({side:re,entryPrice:us}),h({login:l,executionMode:m,side:re,orderType:qi,volumeLots:$e,stopLoss:C,takeProfit:P,priceOrder:b,priceTrigger:x,comment:A,typeTime:B,expirationDateTime:H,expirationDay:I,bid:t,ask:n})},Re=t!==null&&n!==null,Ne=de||pt(b)!==void 0,X=!ue||pt(x)!==void 0,ke=de||Li(B,H,I),Fe=!o&&!a&&l!==""&&Re&&Ne&&X&&ke,Qe=!de&&sc(B),ct=!de&&ic(B);return c.jsxs("div",{className:"web-trading-widget-market-panel",children:[c.jsxs("div",{className:"web-trading-widget-market-panel__header",children:[c.jsxs(Xs,{value:m,onValueChange:re=>g(re),children:[c.jsx(Vr,{className:"web-trading-widget-market-panel__select-trigger",children:c.jsx(Js,{})}),c.jsx(Hr,{children:ti.map(re=>c.jsx(zr,{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:u,children:c.jsx(Tv,{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:f,children:c.jsx(gn,{className:"web-trading-widget-icon web-trading-widget-icon--md"})})]})]}),c.jsxs(dC,{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(Zn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Volume Setting"}),c.jsx(Yn,{className:"web-trading-widget-market-panel__accordion-content",children:c.jsx(De,{label:"Lots",value:p,onChange:ae,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(Zn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Order Price"}),c.jsx(Yn,{className:"web-trading-widget-market-panel__accordion-content",children:ue?c.jsxs(c.Fragment,{children:[c.jsx(De,{label:"Stop Price",value:x,onChange:_,step:z,decimals:U,basePrice:ye,placeholder:M!==null?Ee(M,U):"—"}),c.jsx(De,{label:"Limit Price",value:b,onChange:v,step:z,decimals:U,basePrice:ye,placeholder:M!==null?Ee(M,U):"—"})]}):c.jsx(De,{label:"Price",value:b,onChange:v,step:z,decimals:U,basePrice:ye,placeholder:M!==null?Ee(M,U):"—"})})]}),c.jsxs(qn,{value:"risk-management",className:"web-trading-widget-market-panel__accordion-item",children:[c.jsx(Zn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Risk Management"}),c.jsx(Yn,{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:C,onChange:T,step:z,decimals:U,basePrice:t,placeholder:t!==null?se:"—",clearable:!0}),c.jsx(De,{label:"Take Profit",value:P,onChange:O,step:z,decimals:U,basePrice:n,placeholder:n!==null?W:"—",clearable:!0})]})})]}),de?null:c.jsxs(qn,{value:"expiration",className:"web-trading-widget-market-panel__accordion-item",children:[c.jsx(Zn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Expiration"}),c.jsxs(Yn,{className:"web-trading-widget-market-panel__accordion-content",children:[c.jsxs(Xs,{value:String(B),onValueChange:re=>R(Number(re)),children:[c.jsx(Vr,{className:"web-trading-widget-market-panel__select-full",children:c.jsx(Js,{})}),c.jsx(Hr,{children:Ff.map(re=>c.jsx(zr,{value:String(re.value),children:re.label},re.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:H,onChange:re=>F(re.target.value)})]}):null,ct?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:I,onChange:re=>L(re.target.value)})]}):null]})]}),c.jsxs(qn,{value:"comment",className:"web-trading-widget-market-panel__accordion-item",children:[c.jsx(Zn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Comment"}),c.jsx(Yn,{className:"web-trading-widget-market-panel__accordion-content",children:c.jsx(Rn,{value:A,onChange:re=>N(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:se}),c.jsx("span",{className:"web-trading-widget-market-panel__quotes-ask",children:W})]}),de?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:!Fe,onMouseDown:()=>te("sell"),onClick:()=>je("sell"),children:"Sell by Market"}),c.jsx(ot,{type:"button",className:"web-trading-widget-market-panel__buy-btn",disabled:!Fe,onMouseDown:()=>te("buy"),onClick:()=>je("buy"),children:"Buy by Market"})]}):c.jsxs(ot,{type:"button",variant:$?"destructive":"default",className:`web-trading-widget-market-panel__place-btn${$?"":" web-trading-widget-market-panel__place-btn--buy"}`,disabled:!Fe,onMouseDown:()=>{const re=ee.orderType!==null&&ee.orderType%2===1?"sell":"buy";te(re)},onClick:()=>{const re=ee.orderType!==null&&ee.orderType%2===1?"sell":"buy";je(re)},children:["Place ",Z]})]})]})}function wm({confirmation:e,symbolTicker:t,onDismiss:n}){const r=Number(Vt(Ht(t))),s=Ee(e.price,r),i=e.side==="sell"?"sell":"buy",o=Ni(e.symbol||Di(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 As(e,t){return e.toLocaleString(void 0,{minimumFractionDigits:t,maximumFractionDigits:t})}function _o(e){const t=e.trim();if(!t)return;const n=Number(t);return Number.isFinite(n)?n:void 0}function _m({order:e,onClose:t}){const{deleteOrder:n,modifyOrder:r}=Vi(),s=ve(I=>I.removeOrder),[i,o]=S.useState(String(e.volumeLots)),[a,l]=S.useState(String(e.orderPrice)),[d,u]=S.useState(e.priceTrigger!==void 0?String(e.priceTrigger):""),f=oe(I=>I.stopLoss),h=oe(I=>I.takeProfit),m=oe(I=>I.setStopLoss),g=oe(I=>I.setTakeProfit),p=oe(I=>I.setDraft),y=oe(I=>I.clearDraft),[b,v]=S.useState(e.comment),[x,_]=S.useState(!1),[C,P]=S.useState(!1),T=Pr(e.digits);S.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:T}),()=>{y()}),[y,e.digits,e.orderPrice,e.side,e.stopLoss,e.takeProfit,e.volumeLots,T,p]);const O=rc(e.orderType),D=e.volumeLots,j=Number(a)||e.orderPrice,A=_o(d),N=x||C,B=!O||A!==void 0&&Number.isFinite(j)&&j>0,R=S.useMemo(()=>`Delete #${e.ticket} ${e.typeLabel} ${D.toFixed(2)} ${e.displaySymbol} at ${As(j,e.digits)}`,[e,j,D]),H=async()=>{if(!B){Se({variant:"destructive",description:O?"Please set both stop and limit prices.":"Please set an order price."});return}_(!0);try{const I=await r(e,{volumeLots:D,priceOrder:j,priceTrigger:O?A:void 0,stopLoss:_o(f),takeProfit:_o(h),comment:b.trim()||"order modify"});if(!I.success){Se({variant:"destructive",description:I.message||"Failed to modify order."});return}t(),Se({description:`Order #${e.ticket} updated.`})}catch(I){const L=I instanceof Error?I.message:"Failed to modify order.";Se({variant:"destructive",description:L})}finally{_(!1)}},F=async()=>{P(!0);try{const I=await n(e);if(!I.success){Se({variant:"destructive",description:I.message||"Failed to delete order."});return}s(e.ticket),t(),Se({description:`Order #${e.ticket} deleted.`})}catch(I){const L=I instanceof Error?I.message:"Failed to delete order.";Se({variant:"destructive",description:L})}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," ",D.toFixed(2)," / ",e.volumeFilledLots.toFixed(2)," ",e.displaySymbol," ",O&&A!==void 0?`${As(A,e.digits)} / ${As(j,e.digits)}`:As(j,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:u,step:T,decimals:e.digits,basePrice:e.currentPrice}),c.jsx(De,{label:"Limit Price",value:a,onChange:l,step:T,decimals:e.digits,basePrice:e.currentPrice})]}):c.jsx(De,{label:"Price",value:a,onChange:l,step:T,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:f,onChange:m,step:T,decimals:e.digits,basePrice:e.currentPrice,placeholder:"—"}),c.jsx(De,{label:"Take Profit",value:h,onChange:g,step:T,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:I=>v(I.target.value)})]}),c.jsx(ot,{type:"button",variant:"secondary",className:"web-trading-widget-detail-panel__btn-full",disabled:N||!B,onClick:()=>void H(),children:"Modify"}),c.jsx(ot,{type:"button",className:"web-trading-widget-detail-panel__action-btn",disabled:N,onClick:()=>void F(),children:R})]})]})}function Ns(e,t){return e.toLocaleString(void 0,{minimumFractionDigits:t,maximumFractionDigits:t})}function fC(e){return e.type==="buy"?e.marketBid??e.currentPrice:e.marketAsk??e.currentPrice}function xm({position:e,onClose:t}){const{closePosition:n}=Vi(),r=ve(C=>C.removePosition),[s,i]=S.useState(String(e.volumeLots)),o=oe(C=>C.stopLoss),a=oe(C=>C.takeProfit),l=oe(C=>C.setStopLoss),d=oe(C=>C.setTakeProfit),u=oe(C=>C.setDraft),f=oe(C=>C.clearDraft),[h,m]=S.useState(e.comment),[g,p]=S.useState(!1),y=Pr(e.digits);S.useEffect(()=>(u({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:y}),()=>{f()}),[f,e.digits,e.openPrice,e.stopLoss,e.takeProfit,e.type,e.volumeLots,y,u]);const b=fC(e),v=e.volumeLots,x=S.useMemo(()=>{const C=e.profit.toFixed(2);return`Close #${e.ticket} ${e.type} ${v.toFixed(2)} ${e.displaySymbol} ${Ns(e.openPrice,e.digits)} at ${Ns(b,e.digits)} with Profit ${C}`},[b,e,v]),_=async()=>{p(!0);try{const C=await n(e);if(!C.success){Se({variant:"destructive",description:C.message||"Failed to close position."});return}r(e.ticket),t(),Se({description:`Position #${e.ticket} closed.`})}catch(C){const P=C instanceof Error?C.message:"Failed to close position.";Se({variant:"destructive",description:P})}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," ",Ns(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:Ns(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:y,decimals:e.digits,basePrice:e.marketBid??e.openPrice,placeholder:"—"}),c.jsx(De,{label:"Take Profit",value:a,onChange:d,step:y,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:h,onChange:C=>m(C.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 _(),children:x})]})]})}function yd({symbolTicker:e,orderState:t}){const n=hc(e),{confirmation:r,isSubmitting:s,defaultVolumeLots:i,volumeStep:o,minVolumeLots:a,selectedLogin:l,isAccountsLoading:d,hasConfirmedAccount:u,dismissConfirmation:f,placeMarketOrder:h}=t,m=ve(T=>T.positions),g=ve(T=>T.orders),p=ve(T=>T.selectedPositionTicket),y=ve(T=>T.selectedOrderTicket),b=ve(T=>T.setSelectedPositionTicket),v=ve(T=>T.setSelectedOrderTicket),x=p!==null?m.find(T=>T.ticket===p)??null:null,_=y!==null?g.find(T=>T.ticket===y)??null:null,C=r!==null,P=S.useCallback(T=>{h({symbolTicker:e,login:T.login,executionMode:T.executionMode,side:T.side,orderType:T.orderType,volumeLots:T.volumeLots,stopLoss:T.stopLoss,takeProfit:T.takeProfit,priceOrder:T.priceOrder,priceTrigger:T.priceTrigger,comment:T.comment,typeTime:T.typeTime,expirationDateTime:T.expirationDateTime,expirationDay:T.expirationDay,bid:T.bid,ask:T.ask})},[h,e]);return x!==null?c.jsx(xm,{position:x,onClose:()=>b(null)}):_!==null?c.jsx(_m,{order:_,onClose:()=>v(null)}):C&&r!==null?c.jsx(wm,{confirmation:r,symbolTicker:e,onDismiss:f}):u?c.jsx(uC,{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:P}):c.jsx("div",{className:"web-trading-widget-side-panel__empty",children:"Select a trading account to start placing orders."})}function bd({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 pC({symbolTicker:e,orderState:t,scanResultUrl:n,onScanResultLoad:r,initialTab:s="trade"}){const i=!!n,[o,a]=S.useState(s);return c.jsx("aside",{className:`web-trading-widget-side-panel${i?" web-trading-widget-side-panel--with-scan":""}`,children:i?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(bd,{label:"Trade",isActive:o==="trade",onClick:()=>a("trade")}),c.jsx(bd,{label:"Scan Result",isActive:o==="scan",onClick:()=>a("scan")})]}),c.jsxs("div",{className:"web-trading-widget-side-panel__panels",children:[c.jsx("div",{role:"tabpanel",hidden:o!=="trade",className:"web-trading-widget-side-panel__tabpanel",children:c.jsx(yd,{symbolTicker:e,orderState:t})}),c.jsx("div",{role:"tabpanel",hidden:o!=="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(yd,{symbolTicker:e,orderState:t})})})}const mC=.01,hC=.01,vd=.01;function gC({symbols:e,defaultPanelAfterConfirm:t="mini"}){const[n,r]=S.useState("closed"),[s,i]=S.useState(null),[o,a]=S.useState(!1),[l,d]=S.useState("pending"),[u,f]=S.useState(null),h=ve(A=>A.setSelectedLogin),{accounts:m,isLoading:g}=qp(),{submitOrder:p}=Vi(),y=S.useMemo(()=>Mv(m),[m]),b=S.useMemo(()=>Uv(m,u),[m,u]),v=l==="confirmed",x=l==="needs-selection";S.useEffect(()=>{if(g)return;if(l==="confirmed"){u&&!y.some(N=>N.login===u)&&d("needs-selection");return}if(l==="needs-selection")return;const A=Fv();if(A&&y.some(N=>N.login===A)){f(A),d("confirmed"),r(t);return}d("needs-selection")},[l,y,t,g,u]),S.useEffect(()=>{b&&h(b)},[b,h]);const _=S.useCallback(A=>{f(A),h(A),pl(A)},[h]),C=S.useCallback(A=>{A&&(pl(A),_(A),d("confirmed"),i(null),r(t))},[t,_]),P=S.useCallback(()=>{i(null),r("market")},[]),T=S.useCallback(()=>{i(null),r("mini")},[]),O=S.useCallback(()=>{i(null),r("mini")},[]),D=S.useCallback(()=>{i(null),r("mini")},[]),j=S.useCallback(async A=>{const N=A.login.trim();if(!N){Se({variant:"destructive",description:"Please select a trading account."});return}const B=Math.max(vd,A.volumeLots),R=Di(A.symbolTicker,e);Number(Vt(Ht(A.symbolTicker,e)));const H=Ri(A.executionMode),F=rc(A.orderType),I=pt(A.priceOrder),L=pt(A.priceTrigger);if(!H&&I===void 0){Se({variant:"destructive",description:F?"Please set a limit price for this order.":"Please set an order price for pending orders."});return}if(F&&L===void 0){Se({variant:"destructive",description:"Please set a stop price for stop limit orders."});return}if(!H&&!Li(A.typeTime,A.expirationDateTime,A.expirationDay)){Se({variant:"destructive",description:"Please set an expiration date for this order."});return}const U=H?A.side==="buy"?A.ask:A.bid:I??(A.side==="buy"?A.ask:A.bid);a(!0);try{const z=await p({login:N,symbolTicker:A.symbolTicker,executionMode:A.executionMode,side:ni(A.orderType),orderType:A.orderType,volumeLots:B,stopLoss:pt(A.stopLoss),takeProfit:pt(A.takeProfit),priceOrder:nc(A.orderType)?I:void 0,priceTrigger:F?L:void 0,comment:A.comment.trim(),typeTime:A.typeTime,expirationDateTime:A.expirationDateTime,expirationDay:A.expirationDay,bid:A.bid,ask:A.ask});if(!z.success){Se({variant:"destructive",description:z.message||"Order was not accepted."});return}i({ticket:z.ticket??"",side:z.side??ni(A.orderType),volumeLots:z.volumeLots??B,symbol:z.displaySymbol??R,price:z.price??U}),r("confirmation")}catch(z){const M=z instanceof Error?z.message:"Failed to place order.";Se({variant:"destructive",description:M})}finally{a(!1)}},[p,e]);return{panel:n,confirmation:s,isSubmitting:o,defaultVolumeLots:mC,volumeStep:hC,minVolumeLots:vd,accountOptions:y,selectedLogin:b,setSelectedLogin:_,isAccountsLoading:g,hasConfirmedAccount:v,needsAccountSelection:x,confirmAccountSelection:C,openMarketPanel:P,openMiniPanel:T,closePanels:O,dismissConfirmation:D,placeMarketOrder:j}}function di(e){var t;if(typeof window<"u"){const n=localStorage.getItem(Xn);if(n&&e.some(r=>r.ticker===n))return n}return((t=e[0])==null?void 0:t.ticker)??"XAU_USD"}function ca(e,t,n){var r;return((r=t.find(s=>s.display_name===e||s.ticker===e))==null?void 0:r.ticker)??n}function yC({chartWidget:e,symbols:t,chartSlotElement:n,onSymbolTickerChange:r,onScanResultUrlChange:s,selectSymbolTickerRef:i}){const o=S.useMemo(()=>di(t),[t]),a=S.useRef(o),l=S.useRef(e),[d,u]=S.useState(null);S.useEffect(()=>{l.current=e},[e]),S.useEffect(()=>{if(!n){u(null);return}const h=()=>{const g=n.querySelector(":scope > div");u(g)};h();const m=new MutationObserver(h);return m.observe(n,{childList:!0}),()=>{m.disconnect()}},[n]);const f=S.useCallback(h=>{if(h===a.current)return;const m=t.find(p=>p.ticker===h);if(!m)return;a.current=h,localStorage.setItem(Xn,h),r(h),s(null);const g=l.current;if(g)try{g.onChartReady(()=>{g.activeChart().setSymbol(m.ticker)})}catch{}},[s,r,t]);return S.useEffect(()=>(i.current=f,()=>{i.current=null}),[f,i]),S.useEffect(()=>{if(!e)return;let h=!1,m=null;try{e.onChartReady(()=>{if(h)return;let g;try{g=e.activeChart()}catch{return}const p=v=>{const x=g.symbol(),_=ca(x,t,o);_!==a.current&&s(null);try{e.resetCache()}catch{}a.current=_,localStorage.setItem(Xn,_),r(_)},y=g.symbol(),b=ca(y,t,o);b!==a.current&&(a.current=b,localStorage.setItem(Xn,b),r(b)),g.onSymbolChanged().subscribe(null,p),m=()=>{try{g.onSymbolChanged().unsubscribe(null,p)}catch{}}})}catch{}return()=>{h=!0,m==null||m()}},[e,s,r,o,t]),{chartContainer:d}}const bC=xa("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 vC({className:e,variant:t,...n}){return c.jsx("div",{className:Ce(bC({variant:t}),e),...n})}function Sm(){var t;const e=(t=window.TradingView)==null?void 0:t.widget;return typeof e=="function"?e:null}function zs(){return Sm()!==null}const wd="/charting_library/charting_library.js";function wC({onLoad:e}){return S.useEffect(()=>{if(zs()){e();return}const t=document.querySelector(`script[src="${wd}"]`);if(t){const r=()=>{zs()&&e()};return t.addEventListener("load",r),()=>t.removeEventListener("load",r)}const n=document.createElement("script");return n.src=wd,n.async=!1,n.onload=()=>{zs()&&e()},n.onerror=()=>{console.error("Failed to load TradingView charting library")},document.head.appendChild(n),()=>{n.onload=null,n.onerror=null}},[e]),null}const _d=ji(e=>({playEndTimestamp:null,setPlayEndTimestamp:t=>e({playEndTimestamp:t})})),Cm=ji(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})})),la=8,Em=4,da=5,ua=e=>e==="1"?60:e==="5"?300:e==="1D"?1440*3600:parseInt(e,10)*60,_C=e=>{const t=new Date(e+la*60*60*1e3),n=t.getUTCDay(),r=t.getUTCHours();return n===0?!1:n===1?r>=da:n===6?r<=Em:!0},xC=e=>{const t=new Date(e+la*60*60*1e3),n=t.getUTCDay(),r=t.getUTCHours();if(n===0||n===1&&r<da||n===6&&r>=Em){const s=(8-n)%7;return t.setUTCDate(t.getUTCDate()+s),t.setUTCHours(da,0,0,0),t.getTime()-la*60*60*1e3}return e},SC=(e,t,n)=>{const r=ua(t)*1e3,s=[];let i=e;for(let o=0;o<n;o++)i+=r,_C(i)||(i=xC(i)),s.push(i);return s},CC=(e,t,n,r)=>{if(n<=0)return[];if(r==="24x7"){const i=ua(t)*1e3;return Array.from({length:n},(o,a)=>e+(a+1)*i)}if(r==="1700-1700")return SC(e,t,n);const s=ua(t)*1e3;return Array.from({length:n},(i,o)=>e+(o+1)*s)},EC=(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},xd="wss://symbols.opheleo.com";function TC(e){return{1:6e4,5:3e5,15:9e5,30:18e5,60:36e5,240:144e5}[e]??6e4}function Sd(e){return e.trim().toUpperCase()}function PC(e,t){return Math.floor(e/t)*t}let jr;async function kC(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),Ae({baseURL:"https://corprate-widget.iccandle.ai",url:`/chart/endTimestamp?${t.toString()}`,method:"GET"})}class AC{constructor(t,n,r=Bt,s=xd){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||xd}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 f;const o=(f=t.library_custom_fields)==null?void 0:f.ticker,a=this.symbols.find(h=>o!==void 0&&h.ticker===o||h.ticker===t.ticker||h.display_name===t.name||h.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 u=_d.getState().playEndTimestamp;u&&(l.endTimestamp=u,_d.getState().setPlayEndTimestamp(null),jr=void 0),(async()=>{var h;try{const{data:m}=await kC(l);if(m.data_status==="threshold_limited"){s([],{noData:!0});return}if(m.data_status==="end_of_data"){s([],{noData:!0});return}if(!((h=m.items)!=null&&h.length)){s([],{noData:!0});return}jr=m.last_evaluated_key;const p=[...m.items].map(x=>({open:x.o,high:x.h,low:x.l,close:x.c,time:EC(x.timestamp,n)})),y=Cm.getState(),{gapCount:b,isReplayMode:v}=y;if(v&&event){const x=CC(p[p.length-1].time,n,b||0,t.session);if(x.length>0){const _=p[p.length-1].close;for(const C of x)p.push({open:_,high:_,low:_,close:_,time:C})}}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 f;const o=(f=t.library_custom_fields)==null?void 0:f.ticker,a=this.symbols.find(h=>o!==void 0&&h.ticker===o||h.display_name===t.ticker||h.display_name===t.name),l=a!=null&&a.resolve_symbol?Sd(a.resolve_symbol):Sd(t.ticker||t.name||""),d=TC(n),u=`${l}|${n}`;this.subscriptions.set(s,{symbol:l,resolution:n,periodMs:d,onTick:r,onResetCacheNeededCallback:i,liveCandle:this.lastBarsCache.get(u)??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=PC(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),(f=>{var h,m;(m=(h=this.futureBarsRef)==null?void 0:h.current)!=null&&m.length||o.onTick(f)})(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:u})=>{!a||!Number.isFinite(l)||l<=0||i.some(f=>String(f.id)===String(a))||i.push({id:a,time:l/1e3,color:"green",label:d.slice(0,1)||"N",tooltip:[d],...u?{imageUrl:`/images/symbols/${u}.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:u,forecast:f,previous:h,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: ${f||"-"}`,`Previous Forecast: ${h||"-"}`,`Previous Actual: ${m||"-"}`],...u?{imageUrl:`https://cdn.iccandle.ai/web-assets/${u??"USD"}.svg`}:{}})}catch{}s(i)}}const NC=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(h=>h.time===r))return[i,o,a,l,Number.NaN,Number.NaN,Number.NaN];const f=l<i?1:0;return[i,o,a,l,f,f,f]}}};return Promise.resolve([t])},fa="An unknown error occurred",Ws=e=>{if(typeof e=="string")return e;if(typeof e!="object"||e===null)return fa;if(typeof e.message=="string")return e.message;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const n=Ws(e[t]);if(n)return n}return fa},OC=e=>{var t;if(wp(e)){const n=(t=e.response)!=null&&t.data?Ws(e.response.data):void 0;return n&&n!==fa?n:Ws(e)}return Ws(e)},RC=({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 Se({variant:"destructive",title:"Error",description:OC(wp(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 Cd;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(Cd||(Cd={}));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}},V=_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 pa=(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,_e.jsonStringifyReplacer)}`;break;case V.unrecognized_keys:n=`Unrecognized key(s) in object: ${_e.joinValues(e.keys,", ")}`;break;case V.invalid_union:n="Invalid input";break;case V.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${_e.joinValues(e.options)}`;break;case V.invalid_enum_value:n=`Invalid enum value. Expected ${_e.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}"`:_e.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,_e.assertNever(e)}return{message:n}};let DC=pa;function LC(){return DC}const jC=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=LC(),r=jC({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===pa?void 0:pa].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 ce;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 ce;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 ce=Object.freeze({status:"aborted"}),Ur=e=>({status:"dirty",value:e}),at=e=>({status:"valid",value:e}),Ed=e=>e.status==="aborted",Td=e=>e.status==="dirty",vr=e=>e.status==="valid",ui=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 Pd=(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 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(ui(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 Pd(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(ui(s)?s:Promise.resolve(s));return Pd(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:le.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 hi.create(this,this._def)}or(t){return pi.create([this,t],this._def)}and(t){return mi.create(this,t,this._def)}transform(t){return new xr({...fe(this._def),schema:this,typeName:le.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new ga({...fe(this._def),innerType:this,defaultValue:n,typeName:le.ZodDefault})}brand(){return new sE({typeName:le.ZodBranded,type:this,...fe(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new ya({...fe(this._def),innerType:this,catchValue:n,typeName:le.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Pc.create(this,t)}readonly(){return ba.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const IC=/^c[^\s-]{8,}$/i,MC=/^[0-9a-z]+$/,FC=/^[0-9A-HJKMNP-TV-Z]{26}$/i,UC=/^[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,BC=/^[a-z0-9_-]{21}$/i,$C=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,VC=/^[-+]?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)?)??$/,HC=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,zC="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let xo;const WC=/^(?:(?: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])$/,KC=/^(?:(?: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])$/,GC=/^(([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]))$/,qC=/^(([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])$/,ZC=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,YC=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Tm="((\\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])))",QC=new RegExp(`^${Tm}$`);function Pm(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 XC(e){return new RegExp(`^${Pm(e)}$`)}function JC(e){let t=`${Tm}T${Pm(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 eE(e,t){return!!((t==="v4"||!t)&&WC.test(e)||(t==="v6"||!t)&&GC.test(e))}function tE(e,t){if(!$C.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 nE(e,t){return!!((t==="v4"||!t)&&KC.test(e)||(t==="v6"||!t)&&qC.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:V.invalid_type,expected:Y.string,received:i.parsedType}),ce}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")HC.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")xo||(xo=new RegExp(zC,"u")),xo.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")UC.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")BC.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")IC.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")MC.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")FC.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"?JC(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"?QC.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{code:V.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?XC(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"?VC.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"duration",code:V.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?eE(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"?tE(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"?nE(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"?ZC.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"base64",code:V.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?YC.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"base64url",code:V.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: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:le.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...fe(e)});function rE(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:V.invalid_type,expected:Y.number,received:i.parsedType}),ce}let r;const s=new rt;for(const i of this._def.checks)i.kind==="int"?_e.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"?rE(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()):_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:le.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...fe(e)});class Zr 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 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()):_e.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}),ce}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:le.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...fe(e)});class ma 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:V.invalid_type,expected:Y.boolean,received:r.parsedType}),ce}return at(t.data)}}ma.create=e=>new ma({typeName:le.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...fe(e)});class fi 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:V.invalid_type,expected:Y.date,received:i.parsedType}),ce}if(Number.isNaN(t.data.getTime())){const i=this._getOrReturnCtx(t);return G(i,{code:V.invalid_date}),ce}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()):_e.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new fi({...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}}fi.create=e=>new fi({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:le.ZodDate,...fe(e)});class kd extends we{_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}),ce}return at(t.data)}}kd.create=e=>new kd({typeName:le.ZodSymbol,...fe(e)});class Ad extends we{_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}),ce}return at(t.data)}}Ad.create=e=>new Ad({typeName:le.ZodUndefined,...fe(e)});class Nd extends we{_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}),ce}return at(t.data)}}Nd.create=e=>new Nd({typeName:le.ZodNull,...fe(e)});class Od extends we{constructor(){super(...arguments),this._any=!0}_parse(t){return at(t.data)}}Od.create=e=>new Od({typeName:le.ZodAny,...fe(e)});class Rd extends we{constructor(){super(...arguments),this._unknown=!0}_parse(t){return at(t.data)}}Rd.create=e=>new Rd({typeName:le.ZodUnknown,...fe(e)});class pn extends we{_parse(t){const n=this._getOrReturnCtx(t);return G(n,{code:V.invalid_type,expected:Y.never,received:n.parsedType}),ce}}pn.create=e=>new pn({typeName:le.ZodNever,...fe(e)});class Dd extends we{_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}),ce}return at(t.data)}}Dd.create=e=>new Dd({typeName:le.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:V.invalid_type,expected:Y.array,received:n.parsedType}),ce;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 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:le.ZodArray,...fe(t)});function Qn(e){if(e instanceof Le){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=cn.create(Qn(r))}return new Le({...e._def,shape:()=>t})}else return e instanceof Nt?new Nt({...e._def,type:Qn(e.element)}):e instanceof cn?cn.create(Qn(e.unwrap())):e instanceof Sr?Sr.create(Qn(e.unwrap())):e instanceof Un?Un.create(e.items.map(t=>Qn(t))):e}class Le 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:V.invalid_type,expected:Y.object,received:d.parsedType}),ce}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 u=i[d],f=s.data[d];l.push({key:{status:"valid",value:d},value:u._parse(new fn(s,f,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof pn){const d=this._def.unknownKeys;if(d==="passthrough")for(const u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:s.data[u]}});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 u of a){const f=s.data[u];l.push({key:{status:"valid",value:u},value:d._parse(new fn(s,f,s.path,u)),alwaysSet:u in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const d=[];for(const u of l){const f=await u.key,h=await u.value;d.push({key:f,value:h,alwaysSet:u.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 Le({...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 Le({...this._def,unknownKeys:"strip"})}passthrough(){return new Le({...this._def,unknownKeys:"passthrough"})}extend(t){return new Le({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Le({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:le.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new Le({...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 Le({...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 Le({...this._def,shape:()=>n})}deepPartial(){return Qn(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 Le({...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 Le({...this._def,shape:()=>n})}keyof(){return km(_e.objectKeys(this.shape))}}Le.create=(e,t)=>new Le({shape:()=>e,unknownKeys:"strip",catchall:pn.create(),typeName:le.ZodObject,...fe(t)});Le.strictCreate=(e,t)=>new Le({shape:()=>e,unknownKeys:"strict",catchall:pn.create(),typeName:le.ZodObject,...fe(t)});Le.lazycreate=(e,t)=>new Le({shape:e,unknownKeys:"strip",catchall:pn.create(),typeName:le.ZodObject,...fe(t)});class pi 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:V.invalid_union,unionErrors:o}),ce}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},u=l._parseSync({data:n.data,path:n.path,parent:d});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,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}),ce}}get options(){return this._def.options}}pi.create=(e,t)=>new pi({options:e,typeName:le.ZodUnion,...fe(t)});function ha(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=ha(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=ha(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 mi extends we{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),s=(i,o)=>{if(Ed(i)||Ed(o))return ce;const a=ha(i.value,o.value);return a.valid?((Td(i)||Td(o))&&n.dirty(),{status:n.value,value:a.data}):(G(r,{code:V.invalid_intersection_types}),ce)};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}))}}mi.create=(e,t,n)=>new mi({left:e,right:t,typeName:le.ZodIntersection,...fe(n)});class Un extends we{_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}),ce;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"}),ce;!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 Un({...this._def,rest:t})}}Un.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Un({items:e,typeName:le.ZodTuple,rest:null,...fe(t)})};class Ld 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:V.invalid_type,expected:Y.map,received:r.parsedType}),ce;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,u=await l.value;if(d.status==="aborted"||u.status==="aborted")return ce;(d.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(d.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of o){const d=l.key,u=l.value;if(d.status==="aborted"||u.status==="aborted")return ce;(d.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(d.value,u.value)}return{status:n.value,value:a}}}}Ld.create=(e,t,n)=>new Ld({valueType:t,keyType:e,typeName:le.ZodMap,...fe(n)});class Yr extends we{_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}),ce;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 u of l){if(u.status==="aborted")return ce;u.status==="dirty"&&n.dirty(),d.add(u.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:le.ZodSet,...fe(t)});class jd 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})}}jd.create=(e,t)=>new jd({getter:e,typeName:le.ZodLazy,...fe(t)});class Id extends we{_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}),ce}return{status:"valid",value:t.data}}get value(){return this._def.value}}Id.create=(e,t)=>new Id({value:e,typeName:le.ZodLiteral,...fe(t)});function km(e,t){return new _r({values:e,typeName:le.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:V.invalid_type}),ce}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}),ce}return at(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=km;class Md 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:V.invalid_type}),ce}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:V.invalid_enum_value,options:s}),ce}return at(t.data)}get enum(){return this._def.values}}Md.create=(e,t)=>new Md({values:e,typeName:le.ZodNativeEnum,...fe(t)});class hi 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:V.invalid_type,expected:Y.promise,received:n.parsedType}),ce;const r=n.parsedType===Y.promise?n.data:Promise.resolve(n.data);return at(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}hi.create=(e,t)=>new hi({type:e,typeName:le.ZodPromise,...fe(t)});class xr extends we{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===le.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 ce;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?ce:l.status==="dirty"||n.value==="dirty"?Ur(l.value):l});{if(n.value==="aborted")return ce;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?ce: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"?ce:(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"?ce:(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 ce;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})):ce);_e.assertNever(s)}}xr.create=(e,t,n)=>new xr({schema:e,typeName:le.ZodEffects,effect:t,...fe(n)});xr.createWithPreprocess=(e,t,n)=>new xr({schema:t,effect:{type:"preprocess",transform:e},typeName:le.ZodEffects,...fe(n)});class cn extends we{_parse(t){return this._getType(t)===Y.undefined?at(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}cn.create=(e,t)=>new cn({innerType:e,typeName:le.ZodOptional,...fe(t)});class Sr extends we{_parse(t){return this._getType(t)===Y.null?at(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Sr.create=(e,t)=>new Sr({innerType:e,typeName:le.ZodNullable,...fe(t)});class ga 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}}ga.create=(e,t)=>new ga({innerType:e,typeName:le.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...fe(t)});class ya 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 ui(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}}ya.create=(e,t)=>new ya({innerType:e,typeName:le.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...fe(t)});class Fd extends we{_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}),ce}return{status:"valid",value:t.data}}}Fd.create=e=>new Fd({typeName:le.ZodNaN,...fe(e)});class sE 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 Pc 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"?ce: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"?ce: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 Pc({in:t,out:n,typeName:le.ZodPipeline})}}class ba extends we{_parse(t){const n=this._def.innerType._parse(t),r=s=>(vr(s)&&(s.value=Object.freeze(s.value)),s);return ui(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}ba.create=(e,t)=>new ba({innerType:e,typeName:le.ZodReadonly,...fe(t)});var le;(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"})(le||(le={}));const So=sn.create,Os=wr.create,iE=ma.create;pn.create;Nt.create;const oE=Le.create;pi.create;mi.create;Un.create;_r.create;hi.create;cn.create;Sr.create;const aE="https://api.opheleo.com",cE="Bearer ",lE="Authorization";oE({id:So(),userId:So(),createdAt:Os(),updatedAt:Os(),active:iE(),perDayUsage:Os(),userEmail:So().email(),maxPerDayUsage:Os()});async function dE(e,t,n){const r=typeof window<"u"?localStorage.getItem("session_token"):null;return(await Ae({baseURL:Fn(n??aE),url:e,method:t,headers:r?{[lE]:`${cE}${r}`}:void 0})).data}async function uE(e){return dE("/iccandle/v1/iccandle-user-usage/me","get",e)}const fE=e=>{const t=e==null?void 0:e.platformApiBase;return RC({queryKey:["iccandle-user-usage",t],queryFn:()=>uE(t),...e})},pE=S.createContext(null);function mE(){const e=S.useContext(pE);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function hE({controlsRef:e,onSymbolTickerChange:t,onScanResultUrlChange:n,onChartWidgetChange:r,onChartContainerChange:s,selectSymbolTickerRef:i,headerSlot:o}){const{resolvedTheme:a}=mE(),l=Rt(),d=ls(),u=S.useRef([]),f=S.useRef(null),h=S.useRef(a),m=S.useRef(null),g=S.useRef(null),p=S.useMemo(()=>di(d),[d]),y=S.useRef(p),b=S.useRef("60"),{setGapCount:v,setReplayMode:x}=Cm();S.useEffect(()=>{v(0),x(!1)},[v,x]),S.useEffect(()=>{zs()&&T(!0)},[]);const[_,C]=S.useState(null),[P,T]=S.useState(!1),[O,D]=S.useState(null),j=S.useCallback(L=>{if(L===y.current)return;const U=d.find(M=>M.ticker===L);if(!U)return;y.current=L,localStorage.setItem(Xn,L),t(L);const z=f.current;if(z)try{z.onChartReady(()=>{z.activeChart().setSymbol(U.ticker)})}catch{}},[t,d]);S.useEffect(()=>(i.current=j,()=>{i.current=null}),[j,i]);const A=S.useRef([]),N=S.useMemo(()=>new AC(A,"selector",d,l.tickWebSocketUrl),[l.tickWebSocketUrl,d]),{data:B,isLoading:R}=fE({enabled:!0,platformApiBase:l.platformApiBase}),H=!R&&B?B.perDayUsage>=B.maxPerDayUsage:!1;S.useEffect(()=>{s(_)},[_,s]),S.useEffect(()=>{r(O)},[O,r]),S.useEffect(()=>{if(!P||!_)return;if(f.current){D(null),r(null);try{f.current.remove()}catch{}f.current=null}const L=di(d);y.current=L,b.current="60";const U=Sm();if(!U)return;const z=new U({container:_,library_path:"/charting_library/",datafeed:N,symbol:L,interval:"60",autosize:!0,theme:h.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:()=>NC(u),drawings_access:{type:"black",tools:[{name:"Date Range"}]},locale:"en",timezone:xh(),overrides:{priceScaleSelectionStrategyName:"right","scalesProperties.showSeriesLastValue":!0}});let M=!1;return f.current=z,z.onChartReady(()=>{M||f.current!==z||D(z)}),()=>{if(M=!0,D(null),r(null),f.current){try{f.current.remove()}catch{}f.current=null}}},[_,N,r,P]),S.useEffect(()=>{if(!O)return;let L=!1;try{O.onChartReady(()=>{L||(async()=>{try{const U=O.activeChart(),z=await U.createStudy("Generated Candles - By iC Candle",!0,!0);if(L||(z&&U.bringToFront([z]),await O.headerReady(),L)||(await new Promise(W=>{setTimeout(()=>{if(!L)try{U.clearMarks(2)}catch{}W(!0)},150)}),L))return;localStorage.setItem("tv:selected-news-events","[]"),U.refreshMarks();const M=W=>{const de=U.symbol(),ue=ca(de,d,p);ue!==y.current&&(n(null),u.current=[]);try{O.resetCache()}catch{}y.current=ue,localStorage.setItem(Xn,ue),t(ue)},se=W=>{W!==b.current&&(n(null),u.current=[]);try{O.resetCache()}catch{}b.current=W};m.current=M,g.current=se,U.onSymbolChanged().subscribe(null,M),U.onIntervalChanged().subscribe(null,se)}catch{}})()})}catch{}return()=>{L=!0,m.current=null,g.current=null}},[O,e,n,t,p,d]),S.useEffect(()=>{if(!O||!a)return;let L=!1;try{O.onChartReady(()=>{L||O.changeTheme(a).catch(()=>{})})}catch{}return()=>{L=!0}},[O,a]);const F=S.useCallback(()=>{T(!0)},[]),I=H?c.jsx("div",{className:"web-trading-widget-advanced__scan-limit-wrap",children:c.jsxs(vC,{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"}),B&&c.jsxs("span",{className:"web-trading-widget-advanced__scan-limit-badge-count",children:[B.perDayUsage," of ",B.maxPerDayUsage," scans used today"]})]})}):null;return c.jsxs(c.Fragment,{children:[o??I,c.jsx(wC,{onLoad:F}),c.jsx("div",{ref:C,className:"web-trading-widget-advanced__container"})]})}const Am=S.createContext(null);function Ud({value:e,children:t}){return c.jsx(Am.Provider,{value:e,children:t})}function gE(){const e=S.useContext(Am);if(!e)throw new Error("useWidgetChartSlot must be used within WidgetChartSlotProvider");return e}function Rs(e,t){return e.toFixed(t)}function yE({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,isDragging:d,isCollapsed:u,onToggleCollapsed:f,onDragHandlePointerDown:h,onPlaceOrder:m}){const[g,p]=S.useState(!0),y=u??g,b=()=>{f==null||f(),u===void 0&&p(F=>!F)},v=oe(F=>F.setOrderSide),x=oe(F=>F.setVolumeLots),_=oe(F=>F.volumeLots),[C,P]=S.useState(String(_||r));S.useEffect(()=>{y||P(Rs(_,2))},[y,_]);const T=Number(Vt(Ht(e))),O=t!==null?Ee(t,T):"—",D=n!==null?Ee(n,T):"—",A=!o&&!a&&l!==""&&(t!==null&&n!==null),N=F=>{const I=Number(C),L=Number.isFinite(I)&&I>0?I:r,U=Math.max(i,L+F*s),z=Rs(U,2);P(z),x(U)},B=()=>{const F=Number(C);if(!Number.isFinite(F)||F<=0){P(Rs(r,2)),x(r);return}const I=Math.max(i,F),L=Rs(I,2);P(L),x(I)},R=F=>{t===null||n===null||v({side:F,entryPrice:F==="buy"?n:t})},H=F=>{if(t===null||n===null||!l)return;const I=Number(C),L=Math.max(i,Number.isFinite(I)&&I>0?I:r);v({side:F,entryPrice:F==="buy"?n:t}),m({login:l,side:F,volumeLots:L,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:h,className:`web-trading-widget-mini-order__drag-handle${d?" web-trading-widget-mini-order__drag-handle--grabbing":""}`,children:c.jsx(jf,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2})}),c.jsxs(c.Fragment,{children:[c.jsxs("button",{type:"button",disabled:!A,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--sell",onMouseDown:()=>R("sell"),onClick:()=>H("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:!A,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>N(-1),children:c.jsx(ei,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})}),c.jsx("input",{type:"text",inputMode:"decimal",value:C,disabled:!A,onChange:F=>P(F.target.value),onBlur:B,className:"web-trading-widget-mini-order__volume-input"}),c.jsx("button",{type:"button","aria-label":"Increase volume",disabled:!A,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>N(1),children:c.jsx(Io,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})})]}),c.jsxs("button",{type:"button",disabled:!A,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--buy",onMouseDown:()=>R("buy"),onClick:()=>H("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":y?"Expand quick order panel":"Collapse quick order panel","aria-expanded":!y,className:"web-trading-widget-mini-order__toggle",onClick:b,children:y?c.jsx(ei,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5}):c.jsx(Io,{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(ei,{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 bE=new Set(["volume-setting","risk-management"]);function vE({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,isDragging:d,onDragHandlePointerDown:u,onLayoutChange:f,onClose:h,onPlaceOrder:m}){const[g,p]=S.useState(!0),[y,b]=S.useState("market"),v=oe(J=>J.volumeLots),[x,_]=S.useState(String(v||r)),[C,P]=S.useState(""),[T,O]=S.useState(""),D=oe(J=>J.stopLoss),j=oe(J=>J.takeProfit),A=oe(J=>J.setStopLoss),N=oe(J=>J.setTakeProfit),B=oe(J=>J.setVolumeLots),R=oe(J=>J.setOrderSide),[H,F]=S.useState(""),[I,L]=S.useState(ft.GTC),[U,z]=S.useState(""),[M,se]=S.useState(""),[W,de]=S.useState(()=>new Set(bE));S.useEffect(()=>{f()},[g,f]);const ue=Number(Vt(Ht(e))),ee=Pr(ue),Z=Bf(t,n),$=t!==null?Ee(t,ue):"—",ye=n!==null?Ee(n,ue):"—",ae=Ri(y),ie=Mf(y),te=Oi(y),je=te.label,Re=!ae&&te.orderType!==null&&te.orderType%2===1,Ne=S.useMemo(()=>Z!==null?Z:t??n,[n,t,Z]),X=J=>{de(Xe=>{const zt=new Set(Xe);return zt.has(J)?zt.delete(J):zt.add(J),zt})},ke=J=>{_(J);const Xe=Number(J);Number.isFinite(Xe)&&Xe>0&&B(Xe)},Fe=J=>t===null||n===null?null:ae?J==="buy"?n:t:pt(C)??(J==="buy"?n:t),Qe=J=>{const Xe=Fe(J);Xe!==null&&R({side:J,entryPrice:Xe})},ct=J=>{if(t===null||n===null||!l)return;const Xe=Math.max(i,Number(x)||i),zt=Mo(y,J),Or=Fe(J);Or!==null&&R({side:J,entryPrice:Or}),m({login:l,executionMode:y,side:J,orderType:zt,volumeLots:Xe,stopLoss:D,takeProfit:j,priceOrder:C,priceTrigger:T,comment:H,typeTime:I,expirationDateTime:U,expirationDay:M,bid:t,ask:n})},re=t!==null&&n!==null,$e=ae||pt(C)!==void 0,qi=!ie||pt(T)!==void 0,us=ae||Li(I,U,M),sh=!o&&!a&&l!==""&&re&&$e&&qi&&us,ih=!ae&&sc(I),oh=!ae&&ic(I),Rc=()=>te.orderType!==null&&te.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(yE,{symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,isDragging:d,isCollapsed:g,onToggleCollapsed:()=>p(J=>!J),onDragHandlePointerDown:u,onPlaceOrder:({login:J,side:Xe,volumeLots:zt,bid:Or,ask:Dc})=>{Or===null||Dc===null||m({login:J,executionMode:"market",side:Xe,orderType:Mo("market",Xe),volumeLots:zt,stopLoss:D,takeProfit:j,priceOrder:"",priceTrigger:"",comment:H,typeTime:I,expirationDateTime:"",expirationDay:"",bid:Or,ask:Dc})}}),g?null:c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"web-trading-widget-market-panel__header",children:c.jsxs(Xs,{value:y,onValueChange:J=>b(J),children:[c.jsx(Vr,{className:"web-trading-widget-market-panel__select-trigger","aria-label":"Order execution type",children:c.jsx(Js,{})}),c.jsx(Hr,{children:ti.map(J=>c.jsx(zr,{value:J.mode,children:J.label},J.mode))})]})}),c.jsxs("div",{className:"web-trading-widget-market-panel__accordion",children:[c.jsx(Ir,{id:"volume-setting",title:"Volume Setting",isOpen:W.has("volume-setting"),onToggle:()=>X("volume-setting"),children:c.jsx(De,{label:"Lots",value:x,onChange:ke,step:s,min:i,decimals:2})}),ae?null:c.jsx(Ir,{id:"order-price",title:"Order Price",isOpen:W.has("order-price"),onToggle:()=>X("order-price"),children:ie?c.jsxs(c.Fragment,{children:[c.jsx(De,{label:"Stop Price",value:T,onChange:O,step:ee,decimals:ue,basePrice:Ne,placeholder:Z!==null?Ee(Z,ue):"—"}),c.jsx(De,{label:"Limit Price",value:C,onChange:P,step:ee,decimals:ue,basePrice:Ne,placeholder:Z!==null?Ee(Z,ue):"—"})]}):c.jsx(De,{label:"Price",value:C,onChange:P,step:ee,decimals:ue,basePrice:Ne,placeholder:Z!==null?Ee(Z,ue):"—"})}),c.jsx(Ir,{id:"risk-management",title:"Risk Management",isOpen:W.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:A,step:ee,decimals:ue,basePrice:t,placeholder:t!==null?$:"—",clearable:!0}),c.jsx(De,{label:"Take Profit",value:j,onChange:N,step:ee,decimals:ue,basePrice:n,placeholder:n!==null?ye:"—",clearable:!0})]})}),ae?null:c.jsxs(Ir,{id:"expiration",title:"Expiration",isOpen:W.has("expiration"),onToggle:()=>X("expiration"),children:[c.jsx("select",{value:String(I),className:"web-trading-widget-market-panel__select-full","aria-label":"Order expiration type",onChange:J=>L(Number(J.target.value)),children:Ff.map(J=>c.jsx("option",{value:String(J.value),children:J.label},J.value))}),ih?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:J=>z(J.target.value)})]}):null,oh?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:M,className:"web-trading-widget-market-panel__input",onChange:J=>se(J.target.value)})]}):null]}),c.jsx(Ir,{id:"comment",title:"Comment",isOpen:W.has("comment"),onToggle:()=>X("comment"),children:c.jsx("input",{type:"text",value:H,className:"web-trading-widget-market-panel__input",placeholder:"",onChange:J=>F(J.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:$}),c.jsx("span",{className:"web-trading-widget-market-panel__quotes-ask",children:ye})]})}),!ae&&c.jsxs("button",{type:"button",className:`web-trading-widget-market-panel__place-btn${Re?" web-trading-widget-market-panel__place-btn--sell":" web-trading-widget-market-panel__place-btn--buy"}`,disabled:!sh,onMouseDown:()=>Qe(Rc()),onClick:()=>ct(Rc()),children:["Place ",je]})]})]})}function wE({symbolTicker:e,chartWidget:t,orderState:n}){const r=ls(),s=hc(e),{panel:i,confirmation:o,isSubmitting:a,defaultVolumeLots:l,volumeStep:d,minVolumeLots:u,selectedLogin:f,isAccountsLoading:h,hasConfirmedAccount:m,closePanels:g,dismissConfirmation:p,placeMarketOrder:y}=n,b=ve(M=>M.positions),v=ve(M=>M.orders),x=ve(M=>M.selectedPositionTicket),_=ve(M=>M.selectedOrderTicket),C=ve(M=>M.setSelectedPositionTicket),P=ve(M=>M.setSelectedOrderTicket),T=x!==null?b.find(M=>M.ticket===x)??null:null,O=_!==null?v.find(M=>M.ticket===_)??null:null,D=m&&i==="confirmation"&&o!==null,j=m&&i!=="confirmation"&&i!=="closed"&&T===null&&O===null,{panelRef:A,position:N,isDragging:B,onDragStart:R,reclamp:H}=Wf({storageKey:"web-trading-widget-modal-exec-panel-position",defaultAlign:"top-right",isActive:j}),F=oe(M=>M.setDraft),I=oe(M=>M.clearDraft),L=Number(Vt(Ht(e))),U=Pr(L);S.useEffect(()=>{m&&F({source:"new-order",entryPrice:null,side:null,showEntryLine:!1,volumeLots:l,digits:L,priceStep:U})},[l,L,m,U,F]),S.useEffect(()=>{(i==="closed"||i==="confirmation")&&I()},[I,i]);const z=T!==null||O!==null;return!m&&!z?null:c.jsxs("div",{className:"web-trading-widget-new-order-overlay-layer",children:[c.jsx(Op,{chartWidget:t,symbolTicker:e,symbols:r}),z&&T!==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(xm,{position:T,onClose:()=>C(null)})}):null,z&&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(_m,{order:O,onClose:()=>P(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(wm,{confirmation:o,symbolTicker:e,onDismiss:p})}):null,j?c.jsx("div",{ref:A,style:{left:N.x,top:N.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${B?" web-trading-widget-new-order-overlay--dragging":""}`,children:c.jsx(vE,{symbolTicker:e,bid:(s==null?void 0:s.bid)??null,ask:(s==null?void 0:s.ask)??null,defaultVolumeLots:l,volumeStep:d,minVolumeLots:u,isSubmitting:a,isAccountsLoading:h,selectedLogin:f,isDragging:B,onDragHandlePointerDown:R,onLayoutChange:H,onClose:g,onPlaceOrder:M=>void y({symbolTicker:e,login:M.login,executionMode:M.executionMode,side:M.side,orderType:M.orderType,volumeLots:M.volumeLots,stopLoss:M.stopLoss,takeProfit:M.takeProfit,priceOrder:M.priceOrder,priceTrigger:M.priceTrigger,comment:M.comment,typeTime:M.typeTime,expirationDateTime:M.expirationDateTime,expirationDay:M.expirationDay,bid:M.bid,ask:M.ask})})}):null]})}const _E=`<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>`,km=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" aria-hidden="true">
85
+ </svg>`,Nm=`<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>`,vE=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" aria-hidden="true">
88
+ </svg>`,xE=`<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>`,Am="data-opheleo-account-dropdown";function wE(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 Nm(e){const[t]=e.label.split(" · ");return t??e.label}function _E(e){return`My Account — ${e.label} — ${e.balance.toFixed(2)} ${e.currency}`}function xE(e,t){const n=Nm(e),r=`${e.balance.toFixed(2)} ${e.currency}`;return`${e.login} · ${n} (${r})${t?" · Active":""}`}function kc(e){return e.accountOptions.length===0?null:e.accountOptions.find(t=>t.login===e.selectedLogin)??e.accountOptions[0]}function Om(e){return e.isAccountsLoading||e.isAccountDataLoading}function Rm(e){if(e.isAccountsLoading)return"My Account";if(e.isAccountDataLoading)return"My Account · Switching…";if(e.accountOptions.length===0)return"My Account · None";const t=kc(e);if(!t)return"My Account";const n=Nm(t);return`My Account · ${t.login} · ${n}`}function SE(e){return Om(e)?km:bE}function CE(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:xE(n,r),icon:r?vE:void 0,onSelect:()=>{r||t(n.login)}}})}function EE(e,t){var s,i;const n=e.querySelector(`[${Am}="true"]`);if(n instanceof HTMLElement)return n;const r=e.querySelectorAll('button, [role="button"], div');for(const o of r){if(!(o instanceof HTMLElement))continue;const a=((s=o.textContent)==null?void 0:s.trim())??"";if(!a.includes("My Account")&&a!==t)continue;let l=o;for(;l&&l!==e;){const d=((i=l.textContent)==null?void 0:i.trim())??"";if(l.tagName==="BUTTON"||l.getAttribute("role")==="button"||d.includes("My Account")&&l.querySelector("svg"))return l;l=l.parentElement}}return null}function TE(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 PE(e,t){e.setAttribute(Am,"true"),wE(e);const n=kc(t);if(!Om(t)&&n!==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}TE(e),e.style.border="1px solid transparent",e.style.borderRadius="6px",e.style.padding="0 10px"}function kE(e,t){if(!(e!=null&&e.isConnected))return;const n=Rm(t),r=()=>{const s=EE(e,n);s&&PE(s,t)};r(),requestAnimationFrame(r)}async function AE(e,t=()=>!0){try{await e.headerReady()}catch{return null}if(!t())return null;try{return await e.createDropdown({title:"My Account",tooltip:"Select your trading account",align:"left",icon:km,items:[{title:"Loading accounts…",onSelect:()=>{}}]})}catch{return null}}function Ud(e,t,n,r){if(!e||(r==null?void 0:r.isConnected)===!1)return;const s=kc(t);try{e.applyOptions({title:Rm(t),tooltip:s?_E(s):"Select your trading account",icon:SE(t),items:CE(t,n)})}catch{return}kE(r??null,t)}var Ac="ToastProvider",[Nc,NE,OE]=Da("Toast"),[Dm]=$n("Toast",[OE]),[RE,Ki]=Dm(Ac),Lm=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),[u,f]=w.useState(0),h=w.useRef(!1),m=w.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${Ac}\`. Expected non-empty \`string\`.`),c.jsx(Nc.Provider,{scope:t,children:c.jsx(RE,{scope:t,label:n,duration:r,swipeDirection:s,swipeThreshold:i,toastCount:u,viewport:l,onViewportChange:d,onToastAdd:w.useCallback(()=>f(g=>g+1),[]),onToastRemove:w.useCallback(()=>f(g=>g-1),[]),isFocusedToastEscapeKeyDownRef:h,isClosePausedRef:m,announcerContainer:o,children:a})})};Lm.displayName=Ac;var jm="ToastViewport",DE=["F8"],va="toast.viewportPause",wa="toast.viewportResume",Im=w.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=DE,label:s="Notifications ({hotkey})",...i}=e,o=Ki(jm,n),a=NE(n),l=w.useRef(null),d=w.useRef(null),u=w.useRef(null),f=w.useRef(null),h=Pe(t,f,o.onViewportChange),m=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),g=o.toastCount>0;w.useEffect(()=>{const y=b=>{var x;r.length!==0&&r.every(_=>b[_]||b.code===_)&&((x=f.current)==null||x.focus())};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[r]),w.useEffect(()=>{const y=l.current,b=f.current;if(g&&y&&b){const v=()=>{if(!o.isClosePausedRef.current){const P=new CustomEvent(va);b.dispatchEvent(P),o.isClosePausedRef.current=!0}},x=()=>{if(o.isClosePausedRef.current){const P=new CustomEvent(wa);b.dispatchEvent(P),o.isClosePausedRef.current=!1}},_=P=>{!y.contains(P.relatedTarget)&&x()},C=()=>{y.contains(document.activeElement)||x()};return y.addEventListener("focusin",v),y.addEventListener("focusout",_),y.addEventListener("pointermove",v),y.addEventListener("pointerleave",C),window.addEventListener("blur",v),window.addEventListener("focus",x),()=>{y.removeEventListener("focusin",v),y.removeEventListener("focusout",_),y.removeEventListener("pointermove",v),y.removeEventListener("pointerleave",C),window.removeEventListener("blur",v),window.removeEventListener("focus",x)}}},[g,o.isClosePausedRef]);const p=w.useCallback(({tabbingDirection:y})=>{const v=a().map(x=>{const _=x.ref.current,C=[_,...KE(_)];return y==="forwards"?C:C.reverse()});return(y==="forwards"?v.reverse():v).flat()},[a]);return w.useEffect(()=>{const y=f.current;if(y){const b=v=>{var C,P,T;const x=v.altKey||v.ctrlKey||v.metaKey;if(v.key==="Tab"&&!x){const N=document.activeElement,R=v.shiftKey;if(v.target===y&&R){(C=d.current)==null||C.focus();return}const D=p({tabbingDirection:R?"backwards":"forwards"}),B=D.findIndex(O=>O===N);Co(D.slice(B+1))?v.preventDefault():R?(P=d.current)==null||P.focus():(T=u.current)==null||T.focus()}};return y.addEventListener("keydown",b),()=>y.removeEventListener("keydown",b)}},[a,p]),c.jsxs(pg,{ref:l,role:"region","aria-label":s.replace("{hotkey}",m),tabIndex:-1,style:{pointerEvents:g?void 0:"none"},children:[g&&c.jsx(_a,{ref:d,onFocusFromOutsideViewport:()=>{const y=p({tabbingDirection:"forwards"});Co(y)}}),c.jsx(Nc.Slot,{scope:n,children:c.jsx(me.ol,{tabIndex:-1,...i,ref:h})}),g&&c.jsx(_a,{ref:u,onFocusFromOutsideViewport:()=>{const y=p({tabbingDirection:"backwards"});Co(y)}})]})});Im.displayName=jm;var Mm="ToastFocusProxy",_a=w.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...s}=e,i=Ki(Mm,n);return c.jsx(Ha,{tabIndex:0,...s,ref:t,style:{position:"fixed"},onFocus:o=>{var d;const a=o.relatedTarget;!((d=i.viewport)!=null&&d.contains(a))&&r()}})});_a.displayName=Mm;var ds="Toast",LE="toast.swipeStart",jE="toast.swipeMove",IE="toast.swipeCancel",ME="toast.swipeEnd",Fm=w.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:s,onOpenChange:i,...o}=e,[a,l]=Dn({prop:r,defaultProp:s??!0,onChange:i,caller:ds});return c.jsx(Vn,{present:n||a,children:c.jsx(BE,{open:a,...o,ref:t,onClose:()=>l(!1),onPause:mt(e.onPause),onResume:mt(e.onResume),onSwipeStart:pe(e.onSwipeStart,d=>{d.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:pe(e.onSwipeMove,d=>{const{x:u,y:f}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","move"),d.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${u}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${f}px`)}),onSwipeCancel:pe(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:pe(e.onSwipeEnd,d=>{const{x:u,y:f}=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",`${u}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${f}px`),l(!1)})})})});Fm.displayName=ds;var[FE,UE]=Dm(ds,{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:u,onSwipeMove:f,onSwipeCancel:h,onSwipeEnd:m,...g}=e,p=Ki(ds,n),[y,b]=w.useState(null),v=Pe(t,O=>b(O)),x=w.useRef(null),_=w.useRef(null),C=s||p.duration,P=w.useRef(0),T=w.useRef(C),N=w.useRef(0),{onToastAdd:R,onToastRemove:A}=p,j=mt(()=>{var H;(y==null?void 0:y.contains(document.activeElement))&&((H=p.viewport)==null||H.focus()),o()}),D=w.useCallback(O=>{!O||O===1/0||(window.clearTimeout(N.current),P.current=new Date().getTime(),N.current=window.setTimeout(j,O))},[j]);w.useEffect(()=>{const O=p.viewport;if(O){const H=()=>{D(T.current),d==null||d()},U=()=>{const I=new Date().getTime()-P.current;T.current=T.current-I,window.clearTimeout(N.current),l==null||l()};return O.addEventListener(va,U),O.addEventListener(wa,H),()=>{O.removeEventListener(va,U),O.removeEventListener(wa,H)}}},[p.viewport,C,l,d,D]),w.useEffect(()=>{i&&!p.isClosePausedRef.current&&D(C)},[i,C,p.isClosePausedRef,D]),w.useEffect(()=>(R(),()=>A()),[R,A]);const B=w.useMemo(()=>y?Wm(y):null,[y]);return p.viewport?c.jsxs(c.Fragment,{children:[B&&c.jsx($E,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:B}),c.jsx(FE,{scope:n,onClose:j,children:Cr.createPortal(c.jsx(Nc.ItemSlot,{scope:n,children:c.jsx(fg,{asChild:!0,onEscapeKeyDown:pe(a,()=>{p.isFocusedToastEscapeKeyDownRef.current||j(),p.isFocusedToastEscapeKeyDownRef.current=!1}),children:c.jsx(me.li,{tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":p.swipeDirection,...g,ref:v,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:pe(e.onKeyDown,O=>{O.key==="Escape"&&(a==null||a(O.nativeEvent),O.nativeEvent.defaultPrevented||(p.isFocusedToastEscapeKeyDownRef.current=!0,j()))}),onPointerDown:pe(e.onPointerDown,O=>{O.button===0&&(x.current={x:O.clientX,y:O.clientY})}),onPointerMove:pe(e.onPointerMove,O=>{if(!x.current)return;const H=O.clientX-x.current.x,U=O.clientY-x.current.y,I=!!_.current,L=["left","right"].includes(p.swipeDirection),M=["left","up"].includes(p.swipeDirection)?Math.min:Math.max,K=L?M(0,H):0,F=L?0:M(0,U),se=O.pointerType==="touch"?10:2,z={x:K,y:F},de={originalEvent:O,delta:z};I?(_.current=z,Ds(jE,f,de,{discrete:!1})):Bd(z,p.swipeDirection,se)?(_.current=z,Ds(LE,u,de,{discrete:!1}),O.target.setPointerCapture(O.pointerId)):(Math.abs(H)>se||Math.abs(U)>se)&&(x.current=null)}),onPointerUp:pe(e.onPointerUp,O=>{const H=_.current,U=O.target;if(U.hasPointerCapture(O.pointerId)&&U.releasePointerCapture(O.pointerId),_.current=null,x.current=null,H){const I=O.currentTarget,L={originalEvent:O,delta:H};Bd(H,p.swipeDirection,p.swipeThreshold)?Ds(ME,m,L,{discrete:!0}):Ds(IE,h,L,{discrete:!0}),I.addEventListener("click",M=>M.preventDefault(),{once:!0})}})})})}),p.viewport)})]}):null}),$E=e=>{const{__scopeToast:t,children:n,...r}=e,s=Ki(ds,t),[i,o]=w.useState(!1),[a,l]=w.useState(!1);return zE(()=>o(!0)),w.useEffect(()=>{const d=window.setTimeout(()=>l(!0),1e3);return()=>window.clearTimeout(d)},[]),a?null:c.jsx(yi,{asChild:!0,container:s.announcerContainer||void 0,children:c.jsx(Ha,{...r,children:i&&c.jsxs(c.Fragment,{children:[s.label," ",n]})})})},VE="ToastTitle",Um=w.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return c.jsx(me.div,{...r,ref:t})});Um.displayName=VE;var HE="ToastDescription",Bm=w.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return c.jsx(me.div,{...r,ref:t})});Bm.displayName=HE;var $m="ToastAction",Vm=w.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?c.jsx(zm,{altText:n,asChild:!0,children:c.jsx(Oc,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${$m}\`. Expected non-empty \`string\`.`),null)});Vm.displayName=$m;var Hm="ToastClose",Oc=w.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,s=UE(Hm,n);return c.jsx(zm,{asChild:!0,children:c.jsx(me.button,{type:"button",...r,ref:t,onClick:pe(e.onClick,s.onClose)})})});Oc.displayName=Hm;var zm=w.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...s}=e;return c.jsx(me.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...s,ref:t})});function Wm(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),WE(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(...Wm(r))}}),t}function Ds(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?iu(s,i):s.dispatchEvent(i)}var Bd=(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 zE(e=()=>{}){const t=mt(e);Ie(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function WE(e){return e.nodeType===e.ELEMENT_NODE}function KE(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 Co(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var GE=Lm,Km=Im,Gm=Fm,qm=Um,Zm=Bm,Ym=Vm,Gi=Oc;const qE=GE,Qm=w.forwardRef(({className:e,...t},n)=>c.jsx(Km,{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}));Qm.displayName=Km.displayName;const ZE=xa("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"}}),Xm=w.forwardRef(({className:e,variant:t,...n},r)=>c.jsx(Gm,{ref:r,className:Ce(ZE({variant:t}),e),...n}));Xm.displayName=Gm.displayName;const YE=w.forwardRef(({className:e,...t},n)=>c.jsx(Ym,{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}));YE.displayName=Ym.displayName;const Jm=w.forwardRef(({className:e,...t},n)=>c.jsx(Gi,{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(gv,{className:"h-4 min-h-4 w-4 min-w-4 text-black dark:text-white"})}));Jm.displayName=Gi.displayName;const QE=w.forwardRef(({className:e,children:t,...n},r)=>c.jsx(Gi,{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}));QE.displayName=Gi.displayName;const eh=w.forwardRef(({className:e,...t},n)=>c.jsx(qm,{ref:n,className:Ce("text-sm font-semibold [&+div]:text-base",e),...t}));eh.displayName=qm.displayName;const th=w.forwardRef(({className:e,...t},n)=>c.jsx(Zm,{ref:n,className:Ce("text-lg opacity-90 ",e),...t}));th.displayName=Zm.displayName;function XE(){const{toasts:e}=k0();return c.jsxs(qE,{children:[e.map(({id:t,title:n,description:r,action:s,...i})=>c.jsxs(Xm,{...i,children:[c.jsxs("div",{className:"grid gap-1",children:[n?c.jsx(eh,{children:n}):null,r?c.jsx(th,{children:r}):null]}),s,c.jsx(Jm,{})]},t)),c.jsx(Qm,{})]})}function JE(){const e=pE();return c.jsx(fE,{...e})}function eT({children:e,variant:t="chart",scanResultUrl:n,onScanResultUrlChange:r,onScanResultLoad:s,chartWidget:i,backUrl:o,createAccountUrl:a,dealDetailUrl:l}){const d=i!==void 0,u=ls(),f=pC({symbols:u,defaultPanelAfterConfirm:t==="news"?"market":"mini"}),h=S.useRef(null),m=S.useRef(null),[g,p]=S.useState(null),y=S.useCallback(z=>{p(z)},[]),[b,v]=S.useState(null),[x,_]=S.useState(null),C=d?i??null:b,[P,T]=S.useState(()=>di(u)),[N,R]=S.useState(n??null);S.useEffect(()=>{R(n??null)},[n]);const{isLoading:A}=qp(f.selectedLogin),j=S.useRef(null),[D,B]=S.useState(f.selectedLogin),O=S.useCallback(z=>{z!==f.selectedLogin&&f.setSelectedLogin(z)},[f.selectedLogin,f.setSelectedLogin]),H=A&&f.selectedLogin!==D,U=S.useCallback(z=>{T(z)},[]),I=S.useCallback(z=>{R(z),r==null||r(z)},[r]),{chartContainer:L}=mC({chartWidget:d?C:null,symbols:u,chartSlotElement:d?g:null,onSymbolTickerChange:U,onScanResultUrlChange:I,selectSymbolTickerRef:m}),M=d?L:x,K=S.useCallback(z=>{var de;(de=m.current)==null||de.call(m,z)},[]),F=S.useMemo(()=>({controlsRef:h,onSymbolTickerChange:U,onScanResultUrlChange:I,onChartWidgetChange:d?()=>{}:v,onChartContainerChange:d?()=>{}:_,selectSymbolTickerRef:m}),[I,U,d]);S.useEffect(()=>{if(t==="news")return h.current={open:f.openMarketPanel,setSelectedLogin:f.setSelectedLogin},()=>{h.current=null}},[f.openMarketPanel,f.setSelectedLogin,t]),S.useEffect(()=>{!A&&f.selectedLogin!==D&&B(f.selectedLogin)},[A,D,f.selectedLogin]),S.useEffect(()=>{if(!C)return;let z=!1;return(async()=>{try{const ue=await AE(C,()=>!z);if(z){ue==null||ue.remove();return}j.current=ue,Ud(j.current,{accountOptions:f.accountOptions,selectedLogin:f.selectedLogin,isAccountsLoading:f.isAccountsLoading,isAccountDataLoading:H},O,M)}catch{}})(),()=>{var ue;z=!0,(ue=j.current)==null||ue.remove(),j.current=null}},[M,C]),S.useEffect(()=>{Ud(j.current,{accountOptions:f.accountOptions,selectedLogin:f.selectedLogin,isAccountsLoading:f.isAccountsLoading,isAccountDataLoading:H},O,M)},[M,O,H,f.accountOptions,f.isAccountsLoading,f.selectedLogin]);const se=e??(d?null:c.jsx(JE,{}));return t==="news"?c.jsx(Fd,{value:F,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(xp,{}),c.jsx(Of,{open:!f.hasConfirmedAccount,isAccountsLoading:f.isAccountsLoading,accountOptions:f.accountOptions,onConfirm:f.confirmAccountSelection,backUrl:o,createAccountUrl:a}),c.jsxs("div",{className:"web-trading-widget-trading-layout__news-body",children:[d?c.jsx("div",{ref:y,className:"web-trading-widget-trading-layout__host-chart-slot",children:se}):se,c.jsx(yE,{symbolTicker:P,chartWidget:C,orderState:f})]})]}),c.jsx(Jp,{onCreateNewOrder:()=>{var z;return(z=h.current)==null?void 0:z.open()}})]})}):c.jsx(Fd,{value:F,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(s0,{controlsRef:h,symbolTicker:P,chartWidget:C,scanResultUrl:N,orderState:f,backUrl:o,createAccountUrl:a}),c.jsx("div",{ref:d?y:void 0,className:"web-trading-widget-trading-layout__chart-slot",children:se})]}),c.jsx(dC,{symbolTicker:P,orderState:f,scanResultUrl:N,initialTab:N?"scan":"trade",onScanResultLoad:s},N??"trade-only")]}),c.jsx(Qp,{symbolTicker:P,onSymbolChange:K,onCreateNewOrder:()=>{var z;return(z=h.current)==null?void 0:z.open()},dealDetailUrl:l})]})})}function tT({baseUrl:e,token:t,variant:n="chart",scanResultUrl:r,onScanResultLoad:s,onScanResultUrlChange:i,children:o,chartWidget:a,backUrl:l,createAccountUrl:d,dealDetailUrl:u}){return c.jsx(kS,{token:t,children:c.jsx(Xp,{children:c.jsxs(_p,{baseUrl:e,children:[c.jsx(eT,{variant:n,scanResultUrl:r,onScanResultUrlChange:i,chartWidget:a,onScanResultLoad:s,backUrl:l,createAccountUrl:d,dealDetailUrl:u,children:o}),c.jsx(XE,{})]})})})}exports.ChartNewsOrdersOverlay=V0;exports.WebTradingWidget=tT;
90
+ </svg>`,Om="data-opheleo-account-dropdown";function SE(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 Rm(e){const[t]=e.label.split(" · ");return t??e.label}function CE(e){return`My Account — ${e.label} — ${e.balance.toFixed(2)} ${e.currency}`}function EE(e,t){const n=Rm(e),r=`${e.balance.toFixed(2)} ${e.currency}`;return`${e.login} · ${n} (${r})${t?" · Active":""}`}function kc(e){return e.accountOptions.length===0?null:e.accountOptions.find(t=>t.login===e.selectedLogin)??e.accountOptions[0]}function Dm(e){return e.isAccountsLoading||e.isAccountDataLoading}function Lm(e){if(e.isAccountsLoading)return"My Account";if(e.isAccountDataLoading)return"My Account · Switching…";if(e.accountOptions.length===0)return"My Account · None";const t=kc(e);if(!t)return"My Account";const n=Rm(t);return`My Account · ${t.login} · ${n}`}function TE(e){return Dm(e)?Nm:_E}function PE(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:EE(n,r),icon:r?xE:void 0,onSelect:()=>{r||t(n.login)}}})}function kE(e,t){var s,i;const n=e.querySelector(`[${Om}="true"]`);if(n instanceof HTMLElement)return n;const r=e.querySelectorAll('button, [role="button"], div');for(const o of r){if(!(o instanceof HTMLElement))continue;const a=((s=o.textContent)==null?void 0:s.trim())??"";if(!a.includes("My Account")&&a!==t)continue;let l=o;for(;l&&l!==e;){const d=((i=l.textContent)==null?void 0:i.trim())??"";if(l.tagName==="BUTTON"||l.getAttribute("role")==="button"||d.includes("My Account")&&l.querySelector("svg"))return l;l=l.parentElement}}return null}function AE(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 NE(e,t){e.setAttribute(Om,"true"),SE(e);const n=kc(t);if(!Dm(t)&&n!==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}AE(e),e.style.border="1px solid transparent",e.style.borderRadius="6px",e.style.padding="0 10px"}function OE(e,t){if(!(e!=null&&e.isConnected))return;const n=Lm(t),r=()=>{const s=kE(e,n);s&&NE(s,t)};r(),requestAnimationFrame(r)}async function RE(e,t=()=>!0){try{await e.headerReady()}catch{return null}if(!t())return null;try{return await e.createDropdown({title:"My Account",tooltip:"Select your trading account",align:"left",icon:Nm,items:[{title:"Loading accounts…",onSelect:()=>{}}]})}catch{return null}}function Bd(e,t,n,r){if(!e||(r==null?void 0:r.isConnected)===!1)return;const s=kc(t);try{e.applyOptions({title:Lm(t),tooltip:s?CE(s):"Select your trading account",icon:TE(t),items:PE(t,n)})}catch{return}OE(r??null,t)}var Ac="ToastProvider",[Nc,DE,LE]=Da("Toast"),[jm]=$n("Toast",[LE]),[jE,Ki]=jm(Ac),Im=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),[u,f]=w.useState(0),h=w.useRef(!1),m=w.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${Ac}\`. Expected non-empty \`string\`.`),c.jsx(Nc.Provider,{scope:t,children:c.jsx(jE,{scope:t,label:n,duration:r,swipeDirection:s,swipeThreshold:i,toastCount:u,viewport:l,onViewportChange:d,onToastAdd:w.useCallback(()=>f(g=>g+1),[]),onToastRemove:w.useCallback(()=>f(g=>g-1),[]),isFocusedToastEscapeKeyDownRef:h,isClosePausedRef:m,announcerContainer:o,children:a})})};Im.displayName=Ac;var Mm="ToastViewport",IE=["F8"],va="toast.viewportPause",wa="toast.viewportResume",Fm=w.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=IE,label:s="Notifications ({hotkey})",...i}=e,o=Ki(Mm,n),a=DE(n),l=w.useRef(null),d=w.useRef(null),u=w.useRef(null),f=w.useRef(null),h=Pe(t,f,o.onViewportChange),m=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),g=o.toastCount>0;w.useEffect(()=>{const y=b=>{var x;r.length!==0&&r.every(_=>b[_]||b.code===_)&&((x=f.current)==null||x.focus())};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[r]),w.useEffect(()=>{const y=l.current,b=f.current;if(g&&y&&b){const v=()=>{if(!o.isClosePausedRef.current){const P=new CustomEvent(va);b.dispatchEvent(P),o.isClosePausedRef.current=!0}},x=()=>{if(o.isClosePausedRef.current){const P=new CustomEvent(wa);b.dispatchEvent(P),o.isClosePausedRef.current=!1}},_=P=>{!y.contains(P.relatedTarget)&&x()},C=()=>{y.contains(document.activeElement)||x()};return y.addEventListener("focusin",v),y.addEventListener("focusout",_),y.addEventListener("pointermove",v),y.addEventListener("pointerleave",C),window.addEventListener("blur",v),window.addEventListener("focus",x),()=>{y.removeEventListener("focusin",v),y.removeEventListener("focusout",_),y.removeEventListener("pointermove",v),y.removeEventListener("pointerleave",C),window.removeEventListener("blur",v),window.removeEventListener("focus",x)}}},[g,o.isClosePausedRef]);const p=w.useCallback(({tabbingDirection:y})=>{const v=a().map(x=>{const _=x.ref.current,C=[_,...ZE(_)];return y==="forwards"?C:C.reverse()});return(y==="forwards"?v.reverse():v).flat()},[a]);return w.useEffect(()=>{const y=f.current;if(y){const b=v=>{var C,P,T;const x=v.altKey||v.ctrlKey||v.metaKey;if(v.key==="Tab"&&!x){const O=document.activeElement,D=v.shiftKey;if(v.target===y&&D){(C=d.current)==null||C.focus();return}const N=p({tabbingDirection:D?"backwards":"forwards"}),B=N.findIndex(R=>R===O);Co(N.slice(B+1))?v.preventDefault():D?(P=d.current)==null||P.focus():(T=u.current)==null||T.focus()}};return y.addEventListener("keydown",b),()=>y.removeEventListener("keydown",b)}},[a,p]),c.jsxs(hg,{ref:l,role:"region","aria-label":s.replace("{hotkey}",m),tabIndex:-1,style:{pointerEvents:g?void 0:"none"},children:[g&&c.jsx(_a,{ref:d,onFocusFromOutsideViewport:()=>{const y=p({tabbingDirection:"forwards"});Co(y)}}),c.jsx(Nc.Slot,{scope:n,children:c.jsx(me.ol,{tabIndex:-1,...i,ref:h})}),g&&c.jsx(_a,{ref:u,onFocusFromOutsideViewport:()=>{const y=p({tabbingDirection:"backwards"});Co(y)}})]})});Fm.displayName=Mm;var Um="ToastFocusProxy",_a=w.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...s}=e,i=Ki(Um,n);return c.jsx(Ha,{tabIndex:0,...s,ref:t,style:{position:"fixed"},onFocus:o=>{var d;const a=o.relatedTarget;!((d=i.viewport)!=null&&d.contains(a))&&r()}})});_a.displayName=Um;var ds="Toast",ME="toast.swipeStart",FE="toast.swipeMove",UE="toast.swipeCancel",BE="toast.swipeEnd",Bm=w.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:s,onOpenChange:i,...o}=e,[a,l]=Dn({prop:r,defaultProp:s??!0,onChange:i,caller:ds});return c.jsx(Vn,{present:n||a,children:c.jsx(HE,{open:a,...o,ref:t,onClose:()=>l(!1),onPause:mt(e.onPause),onResume:mt(e.onResume),onSwipeStart:pe(e.onSwipeStart,d=>{d.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:pe(e.onSwipeMove,d=>{const{x:u,y:f}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","move"),d.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${u}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${f}px`)}),onSwipeCancel:pe(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:pe(e.onSwipeEnd,d=>{const{x:u,y:f}=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",`${u}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${f}px`),l(!1)})})})});Bm.displayName=ds;var[$E,VE]=jm(ds,{onClose(){}}),HE=w.forwardRef((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:s,open:i,onClose:o,onEscapeKeyDown:a,onPause:l,onResume:d,onSwipeStart:u,onSwipeMove:f,onSwipeCancel:h,onSwipeEnd:m,...g}=e,p=Ki(ds,n),[y,b]=w.useState(null),v=Pe(t,R=>b(R)),x=w.useRef(null),_=w.useRef(null),C=s||p.duration,P=w.useRef(0),T=w.useRef(C),O=w.useRef(0),{onToastAdd:D,onToastRemove:j}=p,A=mt(()=>{var H;(y==null?void 0:y.contains(document.activeElement))&&((H=p.viewport)==null||H.focus()),o()}),N=w.useCallback(R=>{!R||R===1/0||(window.clearTimeout(O.current),P.current=new Date().getTime(),O.current=window.setTimeout(A,R))},[A]);w.useEffect(()=>{const R=p.viewport;if(R){const H=()=>{N(T.current),d==null||d()},F=()=>{const I=new Date().getTime()-P.current;T.current=T.current-I,window.clearTimeout(O.current),l==null||l()};return R.addEventListener(va,F),R.addEventListener(wa,H),()=>{R.removeEventListener(va,F),R.removeEventListener(wa,H)}}},[p.viewport,C,l,d,N]),w.useEffect(()=>{i&&!p.isClosePausedRef.current&&N(C)},[i,C,p.isClosePausedRef,N]),w.useEffect(()=>(D(),()=>j()),[D,j]);const B=w.useMemo(()=>y?Gm(y):null,[y]);return p.viewport?c.jsxs(c.Fragment,{children:[B&&c.jsx(zE,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:B}),c.jsx($E,{scope:n,onClose:A,children:Cr.createPortal(c.jsx(Nc.ItemSlot,{scope:n,children:c.jsx(mg,{asChild:!0,onEscapeKeyDown:pe(a,()=>{p.isFocusedToastEscapeKeyDownRef.current||A(),p.isFocusedToastEscapeKeyDownRef.current=!1}),children:c.jsx(me.li,{tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":p.swipeDirection,...g,ref:v,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:pe(e.onKeyDown,R=>{R.key==="Escape"&&(a==null||a(R.nativeEvent),R.nativeEvent.defaultPrevented||(p.isFocusedToastEscapeKeyDownRef.current=!0,A()))}),onPointerDown:pe(e.onPointerDown,R=>{R.button===0&&(x.current={x:R.clientX,y:R.clientY})}),onPointerMove:pe(e.onPointerMove,R=>{if(!x.current)return;const H=R.clientX-x.current.x,F=R.clientY-x.current.y,I=!!_.current,L=["left","right"].includes(p.swipeDirection),U=["left","up"].includes(p.swipeDirection)?Math.min:Math.max,z=L?U(0,H):0,M=L?0:U(0,F),se=R.pointerType==="touch"?10:2,W={x:z,y:M},de={originalEvent:R,delta:W};I?(_.current=W,Ds(FE,f,de,{discrete:!1})):$d(W,p.swipeDirection,se)?(_.current=W,Ds(ME,u,de,{discrete:!1}),R.target.setPointerCapture(R.pointerId)):(Math.abs(H)>se||Math.abs(F)>se)&&(x.current=null)}),onPointerUp:pe(e.onPointerUp,R=>{const H=_.current,F=R.target;if(F.hasPointerCapture(R.pointerId)&&F.releasePointerCapture(R.pointerId),_.current=null,x.current=null,H){const I=R.currentTarget,L={originalEvent:R,delta:H};$d(H,p.swipeDirection,p.swipeThreshold)?Ds(BE,m,L,{discrete:!0}):Ds(UE,h,L,{discrete:!0}),I.addEventListener("click",U=>U.preventDefault(),{once:!0})}})})})}),p.viewport)})]}):null}),zE=e=>{const{__scopeToast:t,children:n,...r}=e,s=Ki(ds,t),[i,o]=w.useState(!1),[a,l]=w.useState(!1);return GE(()=>o(!0)),w.useEffect(()=>{const d=window.setTimeout(()=>l(!0),1e3);return()=>window.clearTimeout(d)},[]),a?null:c.jsx(yi,{asChild:!0,container:s.announcerContainer||void 0,children:c.jsx(Ha,{...r,children:i&&c.jsxs(c.Fragment,{children:[s.label," ",n]})})})},WE="ToastTitle",$m=w.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return c.jsx(me.div,{...r,ref:t})});$m.displayName=WE;var KE="ToastDescription",Vm=w.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return c.jsx(me.div,{...r,ref:t})});Vm.displayName=KE;var Hm="ToastAction",zm=w.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?c.jsx(Km,{altText:n,asChild:!0,children:c.jsx(Oc,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${Hm}\`. Expected non-empty \`string\`.`),null)});zm.displayName=Hm;var Wm="ToastClose",Oc=w.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,s=VE(Wm,n);return c.jsx(Km,{asChild:!0,children:c.jsx(me.button,{type:"button",...r,ref:t,onClick:pe(e.onClick,s.onClose)})})});Oc.displayName=Wm;var Km=w.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...s}=e;return c.jsx(me.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...s,ref:t})});function Gm(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),qE(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(...Gm(r))}}),t}function Ds(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?au(s,i):s.dispatchEvent(i)}var $d=(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 GE(e=()=>{}){const t=mt(e);Ie(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function qE(e){return e.nodeType===e.ELEMENT_NODE}function ZE(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 Co(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var YE=Im,qm=Fm,Zm=Bm,Ym=$m,Qm=Vm,Xm=zm,Gi=Oc;const QE=YE,Jm=w.forwardRef(({className:e,...t},n)=>c.jsx(qm,{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}));Jm.displayName=qm.displayName;const XE=xa("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"}}),eh=w.forwardRef(({className:e,variant:t,...n},r)=>c.jsx(Zm,{ref:r,className:Ce(XE({variant:t}),e),...n}));eh.displayName=Zm.displayName;const JE=w.forwardRef(({className:e,...t},n)=>c.jsx(Xm,{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}));JE.displayName=Xm.displayName;const th=w.forwardRef(({className:e,...t},n)=>c.jsx(Gi,{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(bv,{className:"h-4 min-h-4 w-4 min-w-4 text-black dark:text-white"})}));th.displayName=Gi.displayName;const eT=w.forwardRef(({className:e,children:t,...n},r)=>c.jsx(Gi,{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}));eT.displayName=Gi.displayName;const nh=w.forwardRef(({className:e,...t},n)=>c.jsx(Ym,{ref:n,className:Ce("text-sm font-semibold [&+div]:text-base",e),...t}));nh.displayName=Ym.displayName;const rh=w.forwardRef(({className:e,...t},n)=>c.jsx(Qm,{ref:n,className:Ce("text-lg opacity-90 ",e),...t}));rh.displayName=Qm.displayName;function tT(){const{toasts:e}=O0();return c.jsxs(QE,{children:[e.map(({id:t,title:n,description:r,action:s,...i})=>c.jsxs(eh,{...i,children:[c.jsxs("div",{className:"grid gap-1",children:[n?c.jsx(nh,{children:n}):null,r?c.jsx(rh,{children:r}):null]}),s,c.jsx(th,{})]},t)),c.jsx(Jm,{})]})}function nT(){const e=gE();return c.jsx(hE,{...e})}function rT({children:e,variant:t="chart",scanResultUrl:n,onScanResultUrlChange:r,onScanResultLoad:s,chartWidget:i,backUrl:o,createAccountUrl:a,dealDetailUrl:l}){const d=i!==void 0,u=ls(),f=gC({symbols:u,defaultPanelAfterConfirm:t==="news"?"market":"mini"}),h=S.useRef(null),m=S.useRef(null),[g,p]=S.useState(null),y=S.useCallback(W=>{p(W)},[]),[b,v]=S.useState(null),[x,_]=S.useState(null),C=d?i??null:b,[P,T]=S.useState(()=>di(u)),[O,D]=S.useState(n??null);S.useEffect(()=>{D(n??null)},[n]);const{isLoading:j}=Yp(f.selectedLogin),A=S.useRef(null),[N,B]=S.useState(f.selectedLogin),R=S.useCallback(W=>{W!==f.selectedLogin&&f.setSelectedLogin(W)},[f.selectedLogin,f.setSelectedLogin]),H=j&&f.selectedLogin!==N,F=S.useCallback(W=>{T(W)},[]),I=S.useCallback(W=>{D(W),r==null||r(W)},[r]),{chartContainer:L}=yC({chartWidget:d?C:null,symbols:u,chartSlotElement:d?g:null,onSymbolTickerChange:F,onScanResultUrlChange:I,selectSymbolTickerRef:m}),U=d?L:x,z=S.useCallback(W=>{var de;(de=m.current)==null||de.call(m,W)},[]),M=S.useMemo(()=>({controlsRef:h,onSymbolTickerChange:F,onScanResultUrlChange:I,onChartWidgetChange:d?()=>{}:v,onChartContainerChange:d?()=>{}:_,selectSymbolTickerRef:m}),[I,F,d]);S.useEffect(()=>{if(t==="news")return h.current={open:f.openMarketPanel,setSelectedLogin:f.setSelectedLogin},()=>{h.current=null}},[f.openMarketPanel,f.setSelectedLogin,t]),S.useEffect(()=>{!j&&f.selectedLogin!==N&&B(f.selectedLogin)},[j,N,f.selectedLogin]),S.useEffect(()=>{if(!C)return;let W=!1;return(async()=>{try{const ue=await RE(C,()=>!W);if(W){ue==null||ue.remove();return}A.current=ue,Bd(A.current,{accountOptions:f.accountOptions,selectedLogin:f.selectedLogin,isAccountsLoading:f.isAccountsLoading,isAccountDataLoading:H},R,U)}catch{}})(),()=>{var ue;W=!0,(ue=A.current)==null||ue.remove(),A.current=null}},[U,C]),S.useEffect(()=>{Bd(A.current,{accountOptions:f.accountOptions,selectedLogin:f.selectedLogin,isAccountsLoading:f.isAccountsLoading,isAccountDataLoading:H},R,U)},[U,R,H,f.accountOptions,f.isAccountsLoading,f.selectedLogin]);const se=e??(d?null:c.jsx(nT,{}));return t==="news"?c.jsx(Ud,{value:M,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(Cp,{}),c.jsx(Df,{open:f.needsAccountSelection,isAccountsLoading:f.isAccountsLoading,accountOptions:f.accountOptions,onConfirm:f.confirmAccountSelection,backUrl:o,createAccountUrl:a}),c.jsxs("div",{className:"web-trading-widget-trading-layout__news-body",children:[d?c.jsx("div",{ref:y,className:"web-trading-widget-trading-layout__host-chart-slot",children:se}):se,c.jsx(wE,{symbolTicker:P,chartWidget:C,orderState:f})]})]}),c.jsx(tm,{onCreateNewOrder:()=>{var W;return(W=h.current)==null?void 0:W.open()}})]})}):c.jsx(Ud,{value:M,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(a0,{controlsRef:h,symbolTicker:P,chartWidget:C,scanResultUrl:O,orderState:f,backUrl:o,createAccountUrl:a}),c.jsx("div",{ref:d?y:void 0,className:"web-trading-widget-trading-layout__chart-slot",children:se})]}),c.jsx(pC,{symbolTicker:P,orderState:f,scanResultUrl:O,initialTab:O?"scan":"trade",onScanResultLoad:s},O??"trade-only")]}),c.jsx(Jp,{symbolTicker:P,onSymbolChange:z,onCreateNewOrder:()=>{var W;return(W=h.current)==null?void 0:W.open()},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:u}){return c.jsx(OS,{token:t,children:c.jsx(em,{children:c.jsxs(Sp,{baseUrl:e,children:[c.jsx(rT,{variant:n,scanResultUrl:r,onScanResultUrlChange:i,chartWidget:a,onScanResultLoad:s,backUrl:l,createAccountUrl:d,dealDetailUrl:u,children:o}),c.jsx(tT,{})]})})})}exports.ChartNewsOrdersOverlay=W0;exports.WebTradingWidget=sT;