@iccandle/widget-web-trading 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web-trading-widget.cjs +21 -21
- package/dist/web-trading-widget.css +1 -1
- package/dist/web-trading-widget.js +6272 -5922
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";var lh=Object.defineProperty;var Lc=e=>{throw TypeError(e)};var dh=(e,t,n)=>t in e?lh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var st=(e,t,n)=>dh(e,typeof t!="symbol"?t+"":t,n),Zi=(e,t,n)=>t.has(e)||Lc("Cannot "+n);var T=(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 T(e,t,r)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),S=require("react"),uh=require("react-dom");function Jd(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=Jd(S),Cr=Jd(uh);function jc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function fh(...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(fh(...e),e)}function pr(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,g=>{var m;if(bh(g)){a=!0;const h=g;let p="child"in h.props?h.props.child:h.props.children;Ic(p)&&typeof ps=="function"&&(p=ps(p._payload)),o=hh(h,p),l.push((m=o==null?void 0:o.props)==null?void 0:m.children)}else l.push(g)}),o?o=w.cloneElement(o,void 0,l):!a&&w.Children.count(s)===1&&w.isValidElement(s)&&(o=s);const d=o?yh(o):void 0,u=Pe(r,d);if(!o){if(s||s===0)throw new Error(a?xh(e):_h(e));return s}const f=gh(i,o.props??{});return o.type!==w.Fragment&&(f.ref=r?u:d),w.cloneElement(o,f)});return t.displayName=`${e}.Slot`,t}var ph=pr("Slot"),mh=Symbol.for("radix.slottable"),hh=(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 gh(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 yh(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 bh(e){return w.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===mh}var vh=Symbol.for("react.lazy");function Ic(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===vh&&"_payload"in e&&wh(e._payload)}function wh(e){return typeof e=="object"&&e!==null&&"then"in e}var _h=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,xh=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,ps=w[" use ".trim().toString()];function eu(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=eu(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function tu(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=eu(e))&&(r&&(r+=" "),r+=t);return r}const Mc=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Fc=tu,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 g=Mc(u)||Mc(f);return s[d][g]}),a=n&&Object.entries(n).reduce((d,u)=>{let[f,g]=u;return g===void 0||(d[f]=g),d},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,u)=>{let{class:f,className:g,...m}=u;return Object.entries(m).every(h=>{let[p,y]=h;return Array.isArray(y)?y.includes({...i,...a}[p]):{...i,...a}[p]===y})?[...d,f,g]:d},[]);return Fc(e,o,l,n==null?void 0:n.class,n==null?void 0:n.className)},Ut=[{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"}],Sh={[-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 Ch(){const e=-new Date().getTimezoneOffset()/60,t=Sh[e];return t&&t.length>0?t[0]:"Etc/UTC"}const Qn="tv:latest-symbol",nu="web-trading-last-account-login";function Eh(){for(var e=0,t,n,r="";e<arguments.length;)(t=arguments[e++])&&(n=ru(t))&&(r&&(r+=" "),r+=n);return r}function ru(e){if(typeof e=="string")return e;for(var t,n="",r=0;r<e.length;r++)e[r]&&(t=ru(e[r]))&&(n&&(n+=" "),n+=t);return n}var Sa="-";function Th(e){var t=Ah(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(),su(l,t)||Ph(a)}function o(a,l){var d=n[a]||[];return l&&s[a]?[].concat(d,s[a]):d}return{getClassGroupId:i,getConflictingClassGroupIds:o}}function su(e,t){var o;if(e.length===0)return t.classGroupId;var n=e[0],r=t.nextPart.get(n),s=r?su(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 Ph(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 Ah(e){var t=e.theme,n=e.prefix,r={nextPart:new Map,validators:[]},s=Oh(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(Nh(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 Nh(e){return e.isThemeGetter}function Oh(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 kh(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 iu="!";function Rh(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 g=o[f];if(l===0){if(g===r&&(n||o.slice(f,f+s)===t)){a.push(o.slice(d,f)),d=f+s;continue}if(g==="/"){u=f;continue}}g==="["?l++:g==="]"&&l--}var m=a.length===0?o:o.substring(d),h=m.startsWith(iu),p=h?m.substring(1):m,y=u&&u>d?u-d:void 0;return{modifiers:a,hasImportantModifier:h,baseClassName:p,maybePostfixModifierPosition:y}}}function Dh(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 Lh(e){return{cache:kh(e.cacheSize),splitModifiers:Rh(e),...Th(e)}}var jh=/\s+/;function Ih(e,t){var n=t.splitModifiers,r=t.getClassGroupId,s=t.getConflictingClassGroupIds,i=new Set;return e.trim().split(jh).map(function(o){var a=n(o),l=a.modifiers,d=a.hasImportantModifier,u=a.baseClassName,f=a.maybePostfixModifierPosition,g=r(f?u.substring(0,f):u),m=!!f;if(!g){if(!f)return{isTailwindClass:!1,originalClassName:o};if(g=r(u),!g)return{isTailwindClass:!1,originalClassName:o};m=!1}var h=Dh(l).join(":"),p=d?h+iu:h;return{isTailwindClass:!0,modifierId:p,classGroupId:g,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 Mh(){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),g=f.reduce(function(m,h){return h(m)},u());return r=Lh(g),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=Ih(d,r);return i(d,f),f}return function(){return o(Eh.apply(null,arguments))}}function Te(e){var t=function(r){return r[e]||[]};return t.isThemeGetter=!0,t}var ou=/^\[(?:([a-z-]+):)?(.+)\]$/i,Fh=/^\d+\/\d+$/,Uh=new Set(["px","full","screen"]),Bh=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,$h=/\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$/,Vh=/^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;function lt(e){return bn(e)||Uh.has(e)||Fh.test(e)||To(e)}function To(e){return Un(e,"length",qh)}function Hh(e){return Un(e,"size",au)}function zh(e){return Un(e,"position",au)}function Wh(e){return Un(e,"url",Zh)}function ms(e){return Un(e,"number",bn)}function bn(e){return!Number.isNaN(Number(e))}function Kh(e){return e.endsWith("%")&&bn(e.slice(0,-1))}function Rr(e){return $c(e)||Un(e,"number",$c)}function ge(e){return ou.test(e)}function Dr(){return!0}function Wt(e){return Bh.test(e)}function Gh(e){return Un(e,"",Yh)}function Un(e,t,n){var r=ou.exec(e);return r?r[1]?r[1]===t:n(r[2]):!1}function qh(e){return $h.test(e)}function au(){return!1}function Zh(e){return e.startsWith("url(")}function $c(e){return Number.isInteger(Number(e))}function Yh(e){return Vh.test(e)}function Qh(){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"),g=Te("gap"),m=Te("gradientColorStops"),h=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"),E=Te("space"),k=Te("translate"),D=function(){return["auto","contain","none"]},I=function(){return["auto","hidden","clip","visible","scroll"]},N=function(){return["auto",ge,t]},O=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"]},M=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]},K=function(){return["auto","avoid","all","avoid-page","page","left","right","column"]},j=function(){return[bn,ms]},se=function(){return[bn,ge]};return{cacheSize:500,theme:{colors:[Dr],spacing:[lt],blur:["none","",Wt,ge],brightness:j(),borderColor:[e],borderRadius:["none","","full",Wt,ge],borderSpacing:O(),borderWidth:B(),contrast:j(),grayscale:U(),hueRotate:se(),invert:U(),gap:O(),gradientColorStops:[e],gradientColorStopPositions:[Kh,To],inset:N(),margin:N(),opacity:j(),padding:O(),saturate:j(),scale:j(),sepia:U(),skew:se(),space:O(),translate:O()},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:I()}],"overflow-x":[{"overflow-x":I()}],"overflow-y":[{"overflow-y":I()}],overscroll:[{overscroll:D()}],"overscroll-x":[{"overscroll-x":D()}],"overscroll-y":[{"overscroll-y":D()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[p]}],"inset-x":[{"inset-x":[p]}],"inset-y":[{"inset-y":[p]}],start:[{start:[p]}],end:[{end:[p]}],top:[{top:[p]}],right:[{right:[p]}],bottom:[{bottom:[p]}],left:[{left:[p]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Rr]}],basis:[{basis:N()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",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:[g]}],"gap-x":[{"gap-x":[g]}],"gap-y":[{"gap-y":[g]}],"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":[E]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[E]}],"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:O()}],"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(),[zh])}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Hh]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Wh]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[h]}],"gradient-via-pos":[{via:[h]}],"gradient-to-pos":[{to:[h]}],"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,Gh]}],"shadow-color":[{shadow:[Dr]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":M()}],"bg-blend":[{"bg-blend":M()}],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":[k]}],"translate-y":[{"translate-y":[k]}],"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":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"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 Xh=Mh(Qh);function Se(...e){return Xh(tu(e))}const Jh=({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})}),Vc=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?ph:"button";return i?c.jsx(f,{className:Se(Vc({variant:n,size:r,className:t}),o&&"cursor-default","relative"),ref:u,...d,children:e}):c.jsxs(f,{className:Se(Vc({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:Se("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(Jh,{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 Bn(e,t=[]){let n=[];function r(i,o){const a=w.createContext(o);a.displayName=i+"Context";const l=n.length;n=[...n,o];const d=f=>{var b;const{scope:g,children:m,...h}=f,p=((b=g==null?void 0:g[e])==null?void 0:b[l])||a,y=w.useMemo(()=>h,Object.values(h));return c.jsx(p.Provider,{value:y,children:m})};d.displayName=i+"Provider";function u(f,g){var p;const m=((p=g==null?void 0:g[e])==null?void 0:p[l])||a,h=w.useContext(m);if(h)return h;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,eg(s,...t)]}function eg(...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:()=>{},tg=w[" useId ".trim().toString()]||(()=>{}),ng=0;function on(e){const[t,n]=w.useState(tg());return Ie(()=>{n(r=>r??String(ng++))},[e]),e||(t?`radix-${t}`:"")}var rg=w[" useInsertionEffect ".trim().toString()]||Ie;function Dn({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,i,o]=sg({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 g=ig(u)?u(e):u;g!==e&&((f=o.current)==null||f.call(o,g))}else i(u)},[a,e,i,o]);return[l,d]}function sg({defaultProp:e,onChange:t}){const[n,r]=w.useState(e),s=w.useRef(n),i=w.useRef(t);return rg(()=>{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 ig(e){return typeof e=="function"}var og=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],me=og.reduce((e,t)=>{const n=pr(`Primitive.${t}`),r=w.forwardRef((s,i)=>{const{asChild:o,...a}=s,l=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(l,{...a,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function cu(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 ag(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 cg="DismissableLayer",Po="dismissableLayer.update",lg="dismissableLayer.pointerDownOutside",dg="dismissableLayer.focusOutside",Hc,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,g]=w.useState(null),m=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=w.useState({}),p=Pe(t,D=>g(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),E=pg(D=>{const I=D.target;if(!(I instanceof Node))return;const N=[...u.branches].some(O=>O.contains(I));!C||N||(i==null||i(D),a==null||a(D),D.defaultPrevented||l==null||l())},{ownerDocument:m,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:P,dismissableSurfaces:u.dismissableSurfaces}),k=mg(D=>{if(r&&P.current)return;const I=D.target;[...u.branches].some(O=>O.contains(I))||(o==null||o(D),a==null||a(D),D.defaultPrevented||l==null||l())},m);return ag(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&&(Hc=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),zc(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(f),u.layersWithOutsidePointerEventsDisabled.size===0&&(m.body.style.pointerEvents=Hc))}},[f,m,n,u]),w.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),zc())},[f,u]),w.useEffect(()=>{const D=()=>h({});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,k.onFocusCapture),onBlurCapture:pe(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:pe(e.onPointerDownCapture,E.onPointerDownCapture)})});gi.displayName=cg;var ug="DismissableLayerBranch",lu=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})});lu.displayName=ug;function fg(){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 pg(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 g(){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 h(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=g();f(),C||du(lg,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,h);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,h)}},[n,o,r,s,i]),{onPointerDownCapture:()=>a.current=!0}}function mg(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&&du(dg,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 zc(){const e=new CustomEvent(Po);document.dispatchEvent(e)}function du(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?cu(s,i):s.dispatchEvent(i)}var hg=gi,gg=lu,Yi="focusScope.autoFocusOnMount",Qi="focusScope.autoFocusOnUnmount",Wc={bubbles:!1,cancelable:!0},yg="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),g=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){Gc.add(m);const p=document.activeElement;if(!a.contains(p)){const b=new CustomEvent(Yi,Wc);a.addEventListener(Yi,d),a.dispatchEvent(b),b.defaultPrevented||(bg(Sg(uu(a)),{select:!0}),document.activeElement===p&&Kt(a))}return()=>{a.removeEventListener(Yi,d),setTimeout(()=>{const b=new CustomEvent(Qi,Wc);a.addEventListener(Qi,u),a.dispatchEvent(b),b.defaultPrevented||Kt(p??document.body,{select:!0}),a.removeEventListener(Qi,u),Gc.remove(m)},0)}}},[a,d,u,m]);const h=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,_]=vg(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:g,onKeyDown:h})});Ea.displayName=yg;function bg(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Kt(r,{select:t}),document.activeElement!==n)return}function vg(e){const t=uu(e),n=Kc(t,e),r=Kc(t.reverse(),e);return[n,r]}function uu(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 Kc(e,t){for(const n of e)if(!wg(n,{upTo:t}))return n}function wg(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 _g(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&&_g(e)&&t&&e.select()}}var Gc=xg();function xg(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=qc(e,t),e.unshift(t)},remove(t){var n;e=qc(e,t),(n=e[0])==null||n.resume()}}}function qc(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Sg(e){return e.filter(t=>t.tagName!=="A")}var Cg="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=Cg;function Eg(e,t){return w.useReducer((n,r)=>t[n][r]??n,e)}var $n=e=>{const{present:t,children:n}=e,r=Tg(t),s=typeof n=="function"?n({present:r.isPresent}):w.Children.only(n),i=Pg(r.ref,Ag(s));return typeof n=="function"||r.isPresent?w.cloneElement(s,{ref:i}):null};$n.displayName="Presence";function Tg(e){const[t,n]=w.useState(),r=w.useRef(null),s=w.useRef(e),i=w.useRef("none"),o=e?"mounted":"unmounted",[a,l]=Eg(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 g=i.current,m=hs(d);e?l("MOUNT"):m==="none"||(d==null?void 0:d.display)==="none"?l("UNMOUNT"):l(u&&g!==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)})}},g=m=>{m.target===t&&(i.current=hs(r.current))};return t.addEventListener("animationstart",g),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{u.clearTimeout(d),t.removeEventListener("animationstart",g),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 Zc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Pg(...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=Zc(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():Zc(r[o],null)}}},[])}function hs(e){return(e==null?void 0:e.animationName)||"none"}function Ag(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 fu(){w.useEffect(()=>{_t||(_t={start:Yc(),end:Yc()});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 Yc(){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 pu(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 Ng(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",Og="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 Rg(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 Dg=typeof window<"u"?w.useLayoutEffect:w.useEffect,Qc=new WeakMap;function Lg(e,t){var n=Rg(null,function(r){return e.forEach(function(s){return Xi(s,r)})});return Dg(function(){var r=Qc.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)})}Qc.set(n,e)},[e]),n}function jg(e){return e}function Ig(e,t){t===void 0&&(t=jg);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 Mg(e){e===void 0&&(e={});var t=Ig(null);return t.options=Pt({async:!0,ssr:!1},e),t}var mu=function(e){var t=e.sideCar,n=pu(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))};mu.isSideCarExport=!0;function Fg(e,t){return e.useMedium(t),mu}var hu=Mg(),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,g=e.sideCar,m=e.noRelative,h=e.noIsolation,p=e.inert,y=e.allowPinchZoom,b=e.as,v=b===void 0?"div":b,x=e.gapMode,_=pu(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=g,P=Lg([n,t]),E=Pt(Pt({},_),s);return w.createElement(w.Fragment,null,u&&w.createElement(C,{sideCar:hu,removeScrollBar:d,shards:f,noRelative:m,noIsolation:h,inert:p,setCallbacks:i,allowPinchZoom:!!y,lockRef:n,gapMode:x}),o?w.cloneElement(w.Children.only(a),Pt(Pt({},E),{ref:P})):w.createElement(v,Pt({},E,{className:l,ref:P}),a))});bi.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};bi.classNames={fullWidth:js,zeroRight:Ls};var Ug=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Bg(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Ug();return t&&e.setAttribute("nonce",t),e}function $g(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Vg(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Hg=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Bg())&&($g(t,n),Vg(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},zg=function(){var e=Hg();return function(t,n){w.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},gu=function(){var e=zg(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},Wg={left:0,top:0,right:0,gap:0},eo=function(e){return parseInt(e||"",10)||0},Kg=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)]},Gg=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Wg;var t=Kg(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])}},qg=gu(),Xn="data-scroll-locked",Zg=function(e,t,n,r){var s=e.left,i=e.top,o=e.right,a=e.gap;return n===void 0&&(n="margin"),`
|
|
2
|
-
.`.concat(
|
|
1
|
+
"use strict";var _h=Object.defineProperty;var Hc=e=>{throw TypeError(e)};var xh=(e,t,n)=>t in e?_h(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var it=(e,t,n)=>xh(e,typeof t!="symbol"?t+"":t,n),eo=(e,t,n)=>t.has(e)||Hc("Cannot "+n);var E=(e,t,n)=>(eo(e,t,"read from private field"),n?n.call(e):t.get(e)),ne=(e,t,n)=>t.has(e)?Hc("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),q=(e,t,n,r)=>(eo(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),ge=(e,t,n)=>(eo(e,t,"access private method"),n);var ws=(e,t,n,r)=>({set _(s){q(e,t,s,n)},get _(){return E(e,t,r)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),C=require("react"),Sh=require("react-dom");function fu(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const w=fu(C),Cr=fu(Sh);function zc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Ch(...e){return t=>{let n=!1;const r=e.map(s=>{const i=zc(s,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let s=0;s<r.length;s++){const i=r[s];typeof i=="function"?i():zc(e[s],null)}}}}function Oe(...e){return w.useCallback(Ch(...e),e)}function mr(e){const t=w.forwardRef((n,r)=>{let{children:s,...i}=n,o=null,a=!1;const l=[];Wc(s)&&typeof _s=="function"&&(s=_s(s._payload)),w.Children.forEach(s,g=>{var p;if(Oh(g)){a=!0;const y=g;let m="child"in y.props?y.props.child:y.props.children;Wc(m)&&typeof _s=="function"&&(m=_s(m._payload)),o=Ph(y,m),l.push((p=o==null?void 0:o.props)==null?void 0:p.children)}else l.push(g)}),o?o=w.cloneElement(o,void 0,l):!a&&w.Children.count(s)===1&&w.isValidElement(s)&&(o=s);const d=o?Ah(o):void 0,f=Oe(r,d);if(!o){if(s||s===0)throw new Error(a?Dh(e):Lh(e));return s}const u=kh(i,o.props??{});return o.type!==w.Fragment&&(u.ref=r?f:d),w.cloneElement(o,u)});return t.displayName=`${e}.Slot`,t}var Th=mr("Slot"),Eh=Symbol.for("radix.slottable"),Ph=(e,t)=>{if("child"in e.props){const n=e.props.child;return w.isValidElement(n)?w.cloneElement(n,void 0,e.props.children(n.props.children)):null}return w.isValidElement(t)?t:null};function kh(e,t){const n={...t};for(const r in t){const s=e[r],i=t[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...a)=>{const l=i(...a);return s(...a),l}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...e,...n}}function Ah(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Oh(e){return w.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Eh}var Nh=Symbol.for("react.lazy");function Wc(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Nh&&"_payload"in e&&Rh(e._payload)}function Rh(e){return typeof e=="object"&&e!==null&&"then"in e}var Lh=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,Dh=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,_s=w[" use ".trim().toString()];function mu(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=mu(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function pu(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=mu(e))&&(r&&(r+=" "),r+=t);return r}const Kc=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,qc=pu,Pa=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return qc(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:i}=t,o=Object.keys(s).map(d=>{const f=n==null?void 0:n[d],u=i==null?void 0:i[d];if(f===null)return null;const g=Kc(f)||Kc(u);return s[d][g]}),a=n&&Object.entries(n).reduce((d,f)=>{let[u,g]=f;return g===void 0||(d[u]=g),d},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,f)=>{let{class:u,className:g,...p}=f;return Object.entries(p).every(y=>{let[m,h]=y;return Array.isArray(h)?h.includes({...i,...a}[m]):{...i,...a}[m]===h})?[...d,u,g]:d},[]);return qc(e,o,l,n==null?void 0:n.class,n==null?void 0:n.className)},Bt=[{ticker:"EUR_JPY",display_name:"EURJPY",logo_urls:["https://cdn.iccandle.ai/web-assets/EUR.svg","https://cdn.iccandle.ai/web-assets/JPY.svg"],description:"EUR JPY",type:"forex",session:"1700-1700",pricescale:1e3,resolve_symbol:"EURJPY"},{ticker:"GBP_JPY",display_name:"GBPJPY",logo_urls:["https://cdn.iccandle.ai/web-assets/GBP.svg","https://cdn.iccandle.ai/web-assets/JPY.svg"],description:"GBP JPY",type:"forex",session:"1700-1700",pricescale:1e3,resolve_symbol:"GBPJPY"},{ticker:"AUD_JPY",display_name:"AUDJPY",logo_urls:["https://cdn.iccandle.ai/web-assets/AUD.svg","https://cdn.iccandle.ai/web-assets/JPY.svg"],description:"AUD JPY",type:"forex",session:"1700-1700",pricescale:1e3,resolve_symbol:"AUDJPY"},{ticker:"NZD_JPY",display_name:"NZDJPY",logo_urls:["https://cdn.iccandle.ai/web-assets/NZD.svg","https://cdn.iccandle.ai/web-assets/JPY.svg"],description:"NZD JPY",type:"forex",session:"1700-1700",pricescale:1e3,resolve_symbol:"NZDJPY"},{ticker:"CAD_JPY",display_name:"CADJPY",logo_urls:["https://cdn.iccandle.ai/web-assets/CAD.svg","https://cdn.iccandle.ai/web-assets/JPY.svg"],description:"CAD JPY",type:"forex",session:"1700-1700",pricescale:1e3,resolve_symbol:"CADJPY"},{ticker:"CHF_JPY",display_name:"CHFJPY",logo_urls:["https://cdn.iccandle.ai/web-assets/CHF.svg","https://cdn.iccandle.ai/web-assets/JPY.svg"],description:"CHF JPY",type:"forex",session:"1700-1700",pricescale:1e3,resolve_symbol:"CHFJPY"},{ticker:"USD_JPY",display_name:"USDJPY",logo_urls:["https://cdn.iccandle.ai/web-assets/USD.svg","https://cdn.iccandle.ai/web-assets/JPY.svg"],description:"USD JPY",type:"forex",session:"1700-1700",pricescale:1e3,resolve_symbol:"USDJPY"},{ticker:"EUR_USD",display_name:"EURUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/EUR.svg","https://cdn.iccandle.ai/web-assets/USD.svg"],description:"EUR USD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"EURUSD"},{ticker:"AUD_USD",display_name:"AUDUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/AUD.svg","https://cdn.iccandle.ai/web-assets/USD.svg"],description:"AUD USD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"AUDUSD"},{ticker:"NZD_USD",display_name:"NZDUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/NZD.svg","https://cdn.iccandle.ai/web-assets/USD.svg"],description:"NZD USD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"NZDUSD"},{ticker:"USD_CHF",display_name:"USDCHF",logo_urls:["https://cdn.iccandle.ai/web-assets/USD.svg","https://cdn.iccandle.ai/web-assets/CHF.svg"],description:"USD CHF",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"USDCHF"},{ticker:"USD_CAD",display_name:"USDCAD",logo_urls:["https://cdn.iccandle.ai/web-assets/USD.svg","https://cdn.iccandle.ai/web-assets/CAD.svg"],description:"USD CAD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"USDCAD"},{ticker:"GBP_AUD",display_name:"GBPAUD",logo_urls:["https://cdn.iccandle.ai/web-assets/GBP.svg","https://cdn.iccandle.ai/web-assets/AUD.svg"],description:"GBP AUD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"GBPAUD"},{ticker:"GBP_CAD",display_name:"GBPCAD",logo_urls:["https://cdn.iccandle.ai/web-assets/GBP.svg","https://cdn.iccandle.ai/web-assets/CAD.svg"],description:"GBP CAD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"GBPCAD"},{ticker:"GBP_CHF",display_name:"GBPCHF",logo_urls:["https://cdn.iccandle.ai/web-assets/GBP.svg","https://cdn.iccandle.ai/web-assets/CHF.svg"],description:"GBP CHF",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"GBPCHF"},{ticker:"GBP_NZD",display_name:"GBPNZD",logo_urls:["https://cdn.iccandle.ai/web-assets/GBP.svg","https://cdn.iccandle.ai/web-assets/NZD.svg"],description:"GBP NZD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"GBPNZD"},{ticker:"GBP_USD",display_name:"GBPUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/GBP.svg","https://cdn.iccandle.ai/web-assets/USD.svg"],description:"GBP USD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"GBPUSD"},{ticker:"NZD_CAD",display_name:"NZDCAD",logo_urls:["https://cdn.iccandle.ai/web-assets/NZD.svg","https://cdn.iccandle.ai/web-assets/CAD.svg"],description:"NZD CAD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"NZDCAD"},{ticker:"EUR_CAD",display_name:"EURCAD",logo_urls:["https://cdn.iccandle.ai/web-assets/EUR.svg","https://cdn.iccandle.ai/web-assets/CAD.svg"],description:"EUR CAD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"EURCAD"},{ticker:"EUR_AUD",display_name:"EURAUD",logo_urls:["https://cdn.iccandle.ai/web-assets/EUR.svg","https://cdn.iccandle.ai/web-assets/AUD.svg"],description:"EUR AUD",type:"forex",session:"1700-1700",pricescale:1e5,resolve_symbol:"EURAUD"},{ticker:"XAU_USD",display_name:"XAUUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/XAU.svg"],description:"Gold",type:"commodity",session:"1700-1700",pricescale:1e3,resolve_symbol:"XAUUSD"},{ticker:"BCO_USD",display_name:"BCOUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/BCO.svg"],description:"Brent Crude Oil",type:"commodity",session:"1700-1700",pricescale:1e3,resolve_symbol:"SpotBrent"},{ticker:"SPX500_USD",display_name:"S&P500",logo_urls:["https://cdn.iccandle.ai/web-assets/SPX500.svg"],description:"S&P 500",type:"indices",session:"1700-1700",pricescale:10,resolve_symbol:"SP500"},{ticker:"NAS100_USD",display_name:"NASDAQ100",logo_urls:["https://cdn.iccandle.ai/web-assets/NAS100.svg"],description:"NASDAQ 100",type:"indices",session:"1700-1700",pricescale:10,resolve_symbol:"NAS100"},{ticker:"US30_USD",display_name:"US30",logo_urls:["https://cdn.iccandle.ai/web-assets/US30.svg"],description:"US Wall St 30",type:"indices",session:"1700-1700",pricescale:10,resolve_symbol:"US30"},{ticker:"BTCUSDT",display_name:"BTCUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/BTC.svg"],description:"BTCUSDT",type:"crypto",session:"24x7",pricescale:100,resolve_symbol:"BTCUSD"},{ticker:"ETHUSDT",display_name:"ETHUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/ETH.svg"],description:"ETHUSDT",type:"crypto",session:"24x7",pricescale:100,resolve_symbol:"ETHUSD"},{ticker:"XRPUSDT",display_name:"XRPUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/XRP.svg"],description:"XRPUSDT",type:"crypto",session:"24x7",pricescale:1e4,resolve_symbol:"XRPUSD"},{ticker:"SOLUSDT",display_name:"SOLUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/SOL.svg"],description:"SOLUSDT",type:"crypto",session:"24x7",pricescale:100,resolve_symbol:"SOLUSD"},{ticker:"ADAUSDT",display_name:"ADAUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/ADA.svg"],description:"ADAUSDT",type:"crypto",session:"24x7",pricescale:1e4,resolve_symbol:"ADAUSD"},{ticker:"AVAUSDT",display_name:"AVAUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/AVA.svg"],description:"AVAUSDT",type:"crypto",session:"24x7",pricescale:1e4,resolve_symbol:"AVAUSD"},{ticker:"AVAXUSDT",display_name:"AVAXUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/AVAX.svg"],description:"AVAXUSDT",type:"crypto",session:"24x7",pricescale:100,resolve_symbol:"AVAXUSD"},{ticker:"BNBUSDT",display_name:"BNBUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/BNB.svg"],description:"BNBUSDT",type:"crypto",session:"24x7",pricescale:100,resolve_symbol:"BNBUSD"},{ticker:"DOGEUSDT",display_name:"DOGEUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/DOGE.svg"],description:"DOGEUSDT",type:"crypto",session:"24x7",pricescale:1e5,resolve_symbol:"DOGUSD"},{ticker:"DOTUSDT",display_name:"DOTUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/DOT.svg"],description:"DOTUSDT",type:"crypto",session:"24x7",pricescale:1e3,resolve_symbol:"DOTUSD"},{ticker:"TRXUSDT",display_name:"TRXUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/TRX.svg"],description:"TRXUSDT",type:"crypto",session:"24x7",pricescale:1e4,resolve_symbol:"TRXUSD"},{ticker:"AAPL",display_name:"AAPL",logo_urls:["https://cdn.iccandle.ai/web-assets/AAPL.svg"],description:"Apple Inc.",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"AAPL"},{ticker:"AMZN",display_name:"AMZN",logo_urls:["https://cdn.iccandle.ai/web-assets/AMZN.svg"],description:"Amazon.Com Inc",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"AMZN"},{ticker:"BRK.B",display_name:"BRK.B",logo_urls:["https://cdn.iccandle.ai/web-assets/BRK.B.svg"],description:"BERKSHIRE HATHAWAY Class B",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"BRKB"},{ticker:"GOOGL",display_name:"GOOGL",logo_urls:["https://cdn.iccandle.ai/web-assets/GOOGL.svg"],description:"Alphabet Inc. Class A Common Stock",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"GOOGL"},{ticker:"KO",display_name:"KO",logo_urls:["https://cdn.iccandle.ai/web-assets/KO.svg"],description:"Coca-Cola Company",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"KO"},{ticker:"META",display_name:"META",logo_urls:["https://cdn.iccandle.ai/web-assets/META.svg"],description:"Meta Platforms, Inc. Class A Common Stock",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"META"},{ticker:"MSFT",display_name:"MSFT",logo_urls:["https://cdn.iccandle.ai/web-assets/MSFT.svg"],description:"Microsoft Corp",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"MSFT"},{ticker:"NFLX",display_name:"NFLX",logo_urls:["https://cdn.iccandle.ai/web-assets/NFLX.svg"],description:"NetFlix Inc",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"NFLX"},{ticker:"NKE",display_name:"NKE",logo_urls:["https://cdn.iccandle.ai/web-assets/NKE.svg"],description:"Nike, Inc.",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"NKE"},{ticker:"NVDA",display_name:"NVDA",logo_urls:["https://cdn.iccandle.ai/web-assets/NVDA.svg"],description:"Nvidia Corp",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"NVDA"},{ticker:"TME",display_name:"TME",logo_urls:["https://cdn.iccandle.ai/web-assets/TME.svg"],description:"Tencent Music Entertainment Group American Depositary Shares, each representing two Class A Ordinary Shares",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"TME"},{ticker:"TSLA",display_name:"TSLA",logo_urls:["https://cdn.iccandle.ai/web-assets/TSLA.svg"],description:"Tesla, Inc. Common Stock",type:"stock",session:"24x7",pricescale:100,resolve_symbol:"TSLA"},{ticker:"XAG_USD",display_name:"XAGUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/XAG.svg"],description:"Silver",type:"commodity",session:"1700-1700",pricescale:1e3,resolve_symbol:"XAGUSD"},{ticker:"XCU_USD",display_name:"XCUUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/XCU.svg"],description:"Copper",type:"commodity",session:"1700-1700",pricescale:1e3,resolve_symbol:"XCUUSD"}],jh={[-11]:["Pacific/Fakaofo"],[-10]:["Pacific/Honolulu"],[-9]:["America/Anchorage","America/Juneau"],[-8]:["America/Los_Angeles","America/Vancouver"],[-7]:["US/Mountain"],[-6]:["America/Chicago","America/El_Salvador"],[-5]:["America/New_York","America/Lima","America/Bogota"],[-4]:["America/Caracas","America/Santiago","America/Toronto"],[-3]:["America/Argentina/Buenos_Aires","America/Sao_Paulo"],0:["Europe/London","Atlantic/Reykjavik","Africa/Casablanca","Africa/Tunis","Africa/Lagos"],1:["Europe/Amsterdam","Europe/Berlin","Europe/Madrid","Europe/Paris"],2:["Europe/Athens","Africa/Cairo","Africa/Johannesburg"],3:["Europe/Moscow","Asia/Riyadh","Asia/Qatar"],3.5:["Asia/Tehran"],4:["Asia/Dubai","Asia/Muscat"],4.5:[],5:["Asia/Karachi"],5.5:["Asia/Kolkata","Asia/Colombo"],5.75:["Asia/Kathmandu"],6:["Asia/Dhaka","Asia/Almaty"],6.5:["Asia/Yangon"],7:["Asia/Bangkok","Asia/Jakarta"],8:["Asia/Shanghai","Asia/Singapore","Asia/Hong_Kong","Asia/Kuala_Lumpur"],9:["Asia/Tokyo","Asia/Seoul"],9.5:["Australia/Adelaide"],10:["Australia/Sydney","Australia/Brisbane"],11:["Pacific/Norfolk"],12:["Pacific/Auckland"]};function Ih(){const e=-new Date().getTimezoneOffset()/60,t=jh[e];return t&&t.length>0?t[0]:"Etc/UTC"}const Qn="tv:latest-symbol",hu="web-trading-last-account-login";function Mh(){for(var e=0,t,n,r="";e<arguments.length;)(t=arguments[e++])&&(n=gu(t))&&(r&&(r+=" "),r+=n);return r}function gu(e){if(typeof e=="string")return e;for(var t,n="",r=0;r<e.length;r++)e[r]&&(t=gu(e[r]))&&(n&&(n+=" "),n+=t);return n}var ka="-";function Fh(e){var t=Bh(e),n=e.conflictingClassGroups,r=e.conflictingClassGroupModifiers,s=r===void 0?{}:r;function i(a){var l=a.split(ka);return l[0]===""&&l.length!==1&&l.shift(),yu(l,t)||Uh(a)}function o(a,l){var d=n[a]||[];return l&&s[a]?[].concat(d,s[a]):d}return{getClassGroupId:i,getConflictingClassGroupIds:o}}function yu(e,t){var o;if(e.length===0)return t.classGroupId;var n=e[0],r=t.nextPart.get(n),s=r?yu(e.slice(1),r):void 0;if(s)return s;if(t.validators.length!==0){var i=e.join(ka);return(o=t.validators.find(function(a){var l=a.validator;return l(i)}))==null?void 0:o.classGroupId}}var Gc=/^\[(.+)\]$/;function Uh(e){if(Gc.test(e)){var t=Gc.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}}function Bh(e){var t=e.theme,n=e.prefix,r={nextPart:new Map,validators:[]},s=Vh(Object.entries(e.classGroups),n);return s.forEach(function(i){var o=i[0],a=i[1];Oo(a,r,o,t)}),r}function Oo(e,t,n,r){e.forEach(function(s){if(typeof s=="string"){var i=s===""?t:Zc(t,s);i.classGroupId=n;return}if(typeof s=="function"){if($h(s)){Oo(s(r),t,n,r);return}t.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(function(o){var a=o[0],l=o[1];Oo(l,Zc(t,a),n,r)})})}function Zc(e,t){var n=e;return t.split(ka).forEach(function(r){n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n}function $h(e){return e.isThemeGetter}function Vh(e,t){return t?e.map(function(n){var r=n[0],s=n[1],i=s.map(function(o){return typeof o=="string"?t+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(function(a){var l=a[0],d=a[1];return[t+l,d]})):o});return[r,i]}):e}function Hh(e){if(e<1)return{get:function(){},set:function(){}};var t=0,n=new Map,r=new Map;function s(i,o){n.set(i,o),t++,t>e&&(t=0,r=n,n=new Map)}return{get:function(o){var a=n.get(o);if(a!==void 0)return a;if((a=r.get(o))!==void 0)return s(o,a),a},set:function(o,a){n.has(o)?n.set(o,a):s(o,a)}}}var bu="!";function zh(e){var t=e.separator||":",n=t.length===1,r=t[0],s=t.length;return function(o){for(var a=[],l=0,d=0,f,u=0;u<o.length;u++){var g=o[u];if(l===0){if(g===r&&(n||o.slice(u,u+s)===t)){a.push(o.slice(d,u)),d=u+s;continue}if(g==="/"){f=u;continue}}g==="["?l++:g==="]"&&l--}var p=a.length===0?o:o.substring(d),y=p.startsWith(bu),m=y?p.substring(1):p,h=f&&f>d?f-d:void 0;return{modifiers:a,hasImportantModifier:y,baseClassName:m,maybePostfixModifierPosition:h}}}function Wh(e){if(e.length<=1)return e;var t=[],n=[];return e.forEach(function(r){var s=r[0]==="[";s?(t.push.apply(t,n.sort().concat([r])),n=[]):n.push(r)}),t.push.apply(t,n.sort()),t}function Kh(e){return{cache:Hh(e.cacheSize),splitModifiers:zh(e),...Fh(e)}}var qh=/\s+/;function Gh(e,t){var n=t.splitModifiers,r=t.getClassGroupId,s=t.getConflictingClassGroupIds,i=new Set;return e.trim().split(qh).map(function(o){var a=n(o),l=a.modifiers,d=a.hasImportantModifier,f=a.baseClassName,u=a.maybePostfixModifierPosition,g=r(u?f.substring(0,u):f),p=!!u;if(!g){if(!u)return{isTailwindClass:!1,originalClassName:o};if(g=r(f),!g)return{isTailwindClass:!1,originalClassName:o};p=!1}var y=Wh(l).join(":"),m=d?y+bu:y;return{isTailwindClass:!0,modifierId:m,classGroupId:g,originalClassName:o,hasPostfixModifier:p}}).reverse().filter(function(o){if(!o.isTailwindClass)return!0;var a=o.modifierId,l=o.classGroupId,d=o.hasPostfixModifier,f=a+l;return i.has(f)?!1:(i.add(f),s(l,d).forEach(function(u){return i.add(a+u)}),!0)}).reverse().map(function(o){return o.originalClassName}).join(" ")}function Zh(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r,s,i,o=a;function a(d){var f=t[0],u=t.slice(1),g=u.reduce(function(p,y){return y(p)},f());return r=Kh(g),s=r.cache.get,i=r.cache.set,o=l,l(d)}function l(d){var f=s(d);if(f)return f;var u=Gh(d,r);return i(d,u),u}return function(){return o(Mh.apply(null,arguments))}}function Ae(e){var t=function(r){return r[e]||[]};return t.isThemeGetter=!0,t}var vu=/^\[(?:([a-z-]+):)?(.+)\]$/i,Yh=/^\d+\/\d+$/,Qh=new Set(["px","full","screen"]),Xh=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Jh=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,eg=/^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;function mt(e){return bn(e)||Qh.has(e)||Yh.test(e)||No(e)}function No(e){return Un(e,"length",og)}function tg(e){return Un(e,"size",wu)}function ng(e){return Un(e,"position",wu)}function rg(e){return Un(e,"url",ag)}function xs(e){return Un(e,"number",bn)}function bn(e){return!Number.isNaN(Number(e))}function sg(e){return e.endsWith("%")&&bn(e.slice(0,-1))}function Rr(e){return Yc(e)||Un(e,"number",Yc)}function ye(e){return vu.test(e)}function Lr(){return!0}function Wt(e){return Xh.test(e)}function ig(e){return Un(e,"",cg)}function Un(e,t,n){var r=vu.exec(e);return r?r[1]?r[1]===t:n(r[2]):!1}function og(e){return Jh.test(e)}function wu(){return!1}function ag(e){return e.startsWith("url(")}function Yc(e){return Number.isInteger(Number(e))}function cg(e){return eg.test(e)}function lg(){var e=Ae("colors"),t=Ae("spacing"),n=Ae("blur"),r=Ae("brightness"),s=Ae("borderColor"),i=Ae("borderRadius"),o=Ae("borderSpacing"),a=Ae("borderWidth"),l=Ae("contrast"),d=Ae("grayscale"),f=Ae("hueRotate"),u=Ae("invert"),g=Ae("gap"),p=Ae("gradientColorStops"),y=Ae("gradientColorStopPositions"),m=Ae("inset"),h=Ae("margin"),b=Ae("opacity"),v=Ae("padding"),_=Ae("saturate"),x=Ae("scale"),S=Ae("sepia"),T=Ae("skew"),P=Ae("space"),A=Ae("translate"),D=function(){return["auto","contain","none"]},I=function(){return["auto","hidden","clip","visible","scroll"]},N=function(){return["auto",ye,t]},L=function(){return[ye,t]},H=function(){return["",mt]},R=function(){return["auto",bn,ye]},F=function(){return["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"]},M=function(){return["solid","dashed","dotted","double","none"]},$=function(){return["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter"]},O=function(){return["start","end","center","between","around","evenly","stretch"]},U=function(){return["","0",ye]},W=function(){return["auto","avoid","all","avoid-page","page","left","right","column"]},j=function(){return[bn,xs]},ee=function(){return[bn,ye]};return{cacheSize:500,theme:{colors:[Lr],spacing:[mt],blur:["none","",Wt,ye],brightness:j(),borderColor:[e],borderRadius:["none","","full",Wt,ye],borderSpacing:L(),borderWidth:H(),contrast:j(),grayscale:U(),hueRotate:ee(),invert:U(),gap:L(),gradientColorStops:[e],gradientColorStopPositions:[sg,No],inset:N(),margin:N(),opacity:j(),padding:L(),saturate:j(),scale:j(),sepia:U(),skew:ee(),space:L(),translate:L()},classGroups:{aspect:[{aspect:["auto","square","video",ye]}],container:["container"],columns:[{columns:[Wt]}],"break-after":[{"break-after":W()}],"break-before":[{"break-before":W()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none"]}],clear:[{clear:["left","right","both","none"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[].concat(F(),[ye])}],overflow:[{overflow:I()}],"overflow-x":[{"overflow-x":I()}],"overflow-y":[{"overflow-y":I()}],overscroll:[{overscroll:D()}],"overscroll-x":[{"overscroll-x":D()}],"overscroll-y":[{"overscroll-y":D()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Rr]}],basis:[{basis:N()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ye]}],grow:[{grow:U()}],shrink:[{shrink:U()}],order:[{order:["first","last","none",Rr]}],"grid-cols":[{"grid-cols":[Lr]}],"col-start-end":[{col:["auto",{span:["full",Rr]},ye]}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":[Lr]}],"row-start-end":[{row:["auto",{span:[Rr]},ye]}],"row-start":[{"row-start":R()}],"row-end":[{"row-end":R()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ye]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ye]}],gap:[{gap:[g]}],"gap-x":[{"gap-x":[g]}],"gap-y":[{"gap-y":[g]}],"justify-content":[{justify:["normal"].concat(O())}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal"].concat(O(),["baseline"])}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[].concat(O(),["baseline"])}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[v]}],px:[{px:[v]}],py:[{py:[v]}],ps:[{ps:[v]}],pe:[{pe:[v]}],pt:[{pt:[v]}],pr:[{pr:[v]}],pb:[{pb:[v]}],pl:[{pl:[v]}],m:[{m:[h]}],mx:[{mx:[h]}],my:[{my:[h]}],ms:[{ms:[h]}],me:[{me:[h]}],mt:[{mt:[h]}],mr:[{mr:[h]}],mb:[{mb:[h]}],ml:[{ml:[h]}],"space-x":[{"space-x":[P]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[P]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit",ye,t]}],"min-w":[{"min-w":["min","max","fit",ye,mt]}],"max-w":[{"max-w":["0","none","full","min","max","fit","prose",{screen:[Wt]},Wt,ye]}],h:[{h:[ye,t,"auto","min","max","fit"]}],"min-h":[{"min-h":["min","max","fit",ye,mt]}],"max-h":[{"max-h":[ye,t,"min","max","fit"]}],"font-size":[{text:["base",Wt,No]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",xs]}],"font-family":[{font:[Lr]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",ye]}],"line-clamp":[{"line-clamp":["none",bn,xs]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",ye,mt]}],"list-image":[{"list-image":["none",ye]}],"list-style-type":[{list:["none","disc","decimal",ye]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[].concat(M(),["wavy"])}],"text-decoration-thickness":[{decoration:["auto","from-font",mt]}],"underline-offset":[{"underline-offset":["auto",ye,mt]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],indent:[{indent:L()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ye]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ye]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[].concat(F(),[ng])}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",tg]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},rg]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[y]}],"gradient-via-pos":[{via:[y]}],"gradient-to-pos":[{to:[y]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[].concat(M(),["hidden"])}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:M()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:[""].concat(M())}],"outline-offset":[{"outline-offset":[ye,mt]}],"outline-w":[{outline:[mt]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:H()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[mt]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Wt,ig]}],"shadow-color":[{shadow:[Lr]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":$()}],"bg-blend":[{"bg-blend":$()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Wt,ye]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[f]}],invert:[{invert:[u]}],saturate:[{saturate:[_]}],sepia:[{sepia:[S]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[f]}],"backdrop-invert":[{"backdrop-invert":[u]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[_]}],"backdrop-sepia":[{"backdrop-sepia":[S]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",ye]}],duration:[{duration:ee()}],ease:[{ease:["linear","in","out","in-out",ye]}],delay:[{delay:ee()}],animate:[{animate:["none","spin","ping","pulse","bounce",ye]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[x]}],"scale-x":[{"scale-x":[x]}],"scale-y":[{"scale-y":[x]}],rotate:[{rotate:[Rr,ye]}],"translate-x":[{"translate-x":[A]}],"translate-y":[{"translate-y":[A]}],"skew-x":[{"skew-x":[T]}],"skew-y":[{"skew-y":[T]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ye]}],accent:[{accent:["auto",e]}],appearance:["appearance-none"],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ye]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":L()}],"scroll-mx":[{"scroll-mx":L()}],"scroll-my":[{"scroll-my":L()}],"scroll-ms":[{"scroll-ms":L()}],"scroll-me":[{"scroll-me":L()}],"scroll-mt":[{"scroll-mt":L()}],"scroll-mr":[{"scroll-mr":L()}],"scroll-mb":[{"scroll-mb":L()}],"scroll-ml":[{"scroll-ml":L()}],"scroll-p":[{"scroll-p":L()}],"scroll-px":[{"scroll-px":L()}],"scroll-py":[{"scroll-py":L()}],"scroll-ps":[{"scroll-ps":L()}],"scroll-pe":[{"scroll-pe":L()}],"scroll-pt":[{"scroll-pt":L()}],"scroll-pr":[{"scroll-pr":L()}],"scroll-pb":[{"scroll-pb":L()}],"scroll-pl":[{"scroll-pl":L()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","pinch-zoom","manipulation",{pan:["x","left","right","y","up","down"]}]}],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ye]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[mt,xs]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}}var dg=Zh(lg);function Te(...e){return dg(pu(e))}const ug=({className:e=""})=>c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-loader-circle s absolute animate-spin",children:c.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56",className:e})}),Qc=Pa("inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:opacity-60",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input dark:border-[#FFFFFF1A] hover:opacity-60 dark:bg-[#202020] dark:text-white shadow-sm hover:bg-primary-1 ",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",cobalt:"text-cobalt-600 bg-cobalt-100 border border-cobalt-600 font-semibold hover:bg-cobalt-50 hover:text-cobalt-300",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),ct=w.forwardRef(({children:e,className:t,variant:n,size:r,loading:s,asChild:i=!1,disabled:o,loaderClassName:a="",loaderParentClassName:l="",...d},f)=>{const u=i?Th:"button";return i?c.jsx(u,{className:Te(Qc({variant:n,size:r,className:t}),o&&"cursor-default","relative"),ref:f,...d,children:e}):c.jsxs(u,{className:Te(Qc({variant:n,size:r,className:t}),o&&"cursor-default","relative"),ref:f,disabled:s||o,...d,children:[s&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"absolute left-0 z-10 h-full w-full rounded-md bg-white"}),c.jsx("span",{className:Te("absolute left-0 z-20 flex h-full w-full items-center justify-center rounded-md bg-inherit text-orange-300",l),children:c.jsx(ug,{className:a})})]}),e]})});ct.displayName="Button";function me(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e==null||e(s),n===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function Bn(e,t=[]){let n=[];function r(i,o){const a=w.createContext(o);a.displayName=i+"Context";const l=n.length;n=[...n,o];const d=u=>{var b;const{scope:g,children:p,...y}=u,m=((b=g==null?void 0:g[e])==null?void 0:b[l])||a,h=w.useMemo(()=>y,Object.values(y));return c.jsx(m.Provider,{value:h,children:p})};d.displayName=i+"Provider";function f(u,g){var m;const p=((m=g==null?void 0:g[e])==null?void 0:m[l])||a,y=w.useContext(p);if(y)return y;if(o!==void 0)return o;throw new Error(`\`${u}\` must be used within \`${i}\``)}return[d,f]}const s=()=>{const i=n.map(o=>w.createContext(o));return function(a){const l=(a==null?void 0:a[e])||i;return w.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return s.scopeName=e,[r,fg(s,...t)]}function fg(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const o=r.reduce((a,{useScope:l,scopeName:d})=>{const u=l(i)[`__scope${d}`];return{...a,...u}},{});return w.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var Ie=globalThis!=null&&globalThis.document?w.useLayoutEffect:()=>{},mg=w[" useId ".trim().toString()]||(()=>{}),pg=0;function on(e){const[t,n]=w.useState(mg());return Ie(()=>{n(r=>r??String(pg++))},[e]),e||(t?`radix-${t}`:"")}var hg=w[" useInsertionEffect ".trim().toString()]||Ie;function Ln({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,i,o]=gg({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:s;{const f=w.useRef(e!==void 0);w.useEffect(()=>{const u=f.current;u!==a&&console.warn(`${r} is changing from ${u?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=a},[a,r])}const d=w.useCallback(f=>{var u;if(a){const g=yg(f)?f(e):f;g!==e&&((u=o.current)==null||u.call(o,g))}else i(f)},[a,e,i,o]);return[l,d]}function gg({defaultProp:e,onChange:t}){const[n,r]=w.useState(e),s=w.useRef(n),i=w.useRef(t);return hg(()=>{i.current=t},[t]),w.useEffect(()=>{var o;s.current!==n&&((o=i.current)==null||o.call(i,n),s.current=n)},[n,s]),[n,r,i]}function yg(e){return typeof e=="function"}var bg=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],he=bg.reduce((e,t)=>{const n=mr(`Primitive.${t}`),r=w.forwardRef((s,i)=>{const{asChild:o,...a}=s,l=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(l,{...a,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function _u(e,t){e&&Cr.flushSync(()=>e.dispatchEvent(t))}function yt(e){const t=w.useRef(e);return w.useEffect(()=>{t.current=e}),w.useMemo(()=>((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)}),[])}function vg(e,t=globalThis==null?void 0:globalThis.document){const n=yt(e);w.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var wg="DismissableLayer",Ro="dismissableLayer.update",_g="dismissableLayer.pointerDownOutside",xg="dismissableLayer.focusOutside",Xc,Aa=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),xi=w.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:a,onDismiss:l,...d}=e,f=w.useContext(Aa),[u,g]=w.useState(null),p=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=w.useState({}),m=Oe(t,D=>g(D)),h=Array.from(f.layers),[b]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),v=h.indexOf(b),_=u?h.indexOf(u):-1,x=f.layersWithOutsidePointerEventsDisabled.size>0,S=_>=v,T=w.useRef(!1),P=Tg(D=>{const I=D.target;if(!(I instanceof Node))return;const N=[...f.branches].some(L=>L.contains(I));!S||N||(i==null||i(D),a==null||a(D),D.defaultPrevented||l==null||l())},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:T,dismissableSurfaces:f.dismissableSurfaces}),A=Eg(D=>{if(r&&T.current)return;const I=D.target;[...f.branches].some(L=>L.contains(I))||(o==null||o(D),a==null||a(D),D.defaultPrevented||l==null||l())},p);return vg(D=>{_===f.layers.size-1&&(s==null||s(D),!D.defaultPrevented&&l&&(D.preventDefault(),l()))},p),w.useEffect(()=>{if(u)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(Xc=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(u)),f.layers.add(u),Jc(),()=>{n&&(f.layersWithOutsidePointerEventsDisabled.delete(u),f.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=Xc))}},[u,p,n,f]),w.useEffect(()=>()=>{u&&(f.layers.delete(u),f.layersWithOutsidePointerEventsDisabled.delete(u),Jc())},[u,f]),w.useEffect(()=>{const D=()=>y({});return document.addEventListener(Ro,D),()=>document.removeEventListener(Ro,D)},[]),c.jsx(he.div,{...d,ref:m,style:{pointerEvents:x?S?"auto":"none":void 0,...e.style},onFocusCapture:me(e.onFocusCapture,A.onFocusCapture),onBlurCapture:me(e.onBlurCapture,A.onBlurCapture),onPointerDownCapture:me(e.onPointerDownCapture,P.onPointerDownCapture)})});xi.displayName=wg;var Sg="DismissableLayerBranch",xu=w.forwardRef((e,t)=>{const n=w.useContext(Aa),r=w.useRef(null),s=Oe(t,r);return w.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),c.jsx(he.div,{...e,ref:s})});xu.displayName=Sg;function Cg(){const e=w.useContext(Aa),[t,n]=w.useState(null);return w.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}function Tg(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:s,dismissableSurfaces:i}=t,o=yt(e),a=w.useRef(!1),l=w.useRef(!1),d=w.useRef(new Map),f=w.useRef(()=>{});return w.useEffect(()=>{function u(){l.current=!1,s.current=!1,d.current.clear()}function g(){return Array.from(d.current.values()).some(Boolean)}function p(v){if(!l.current)return;const _=v.target;_ instanceof Node&&[...i].some(S=>S.contains(_))||d.current.set(v.type,!0),v.type==="click"&&window.setTimeout(()=>{l.current&&f.current()},0)}function y(v){l.current&&d.current.set(v.type,!1)}const m=v=>{if(v.target&&!a.current){let _=function(){n.removeEventListener("click",f.current);const S=g();u(),S||Su(_g,o,x,{discrete:!0})};const x={originalEvent:v};l.current=!0,s.current=r&&v.button===0,d.current.clear(),!r||v.button!==0?_():(n.removeEventListener("click",f.current),f.current=_,n.addEventListener("click",f.current,{once:!0}))}else n.removeEventListener("click",f.current),u();a.current=!1},h=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const v of h)n.addEventListener(v,p,!0),n.addEventListener(v,y);const b=window.setTimeout(()=>{n.addEventListener("pointerdown",m)},0);return()=>{window.clearTimeout(b),n.removeEventListener("pointerdown",m),n.removeEventListener("click",f.current);for(const v of h)n.removeEventListener(v,p,!0),n.removeEventListener(v,y)}},[n,o,r,s,i]),{onPointerDownCapture:()=>a.current=!0}}function Eg(e,t=globalThis==null?void 0:globalThis.document){const n=yt(e),r=w.useRef(!1);return w.useEffect(()=>{const s=i=>{i.target&&!r.current&&Su(xg,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Jc(){const e=new CustomEvent(Ro);document.dispatchEvent(e)}function Su(e,t,n,{discrete:r}){const s=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?_u(s,i):s.dispatchEvent(i)}var Pg=xi,kg=xu,to="focusScope.autoFocusOnMount",no="focusScope.autoFocusOnUnmount",el={bubbles:!1,cancelable:!0},Ag="FocusScope",Oa=w.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:i,...o}=e,[a,l]=w.useState(null),d=yt(s),f=yt(i),u=w.useRef(null),g=Oe(t,m=>l(m)),p=w.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;w.useEffect(()=>{if(r){let m=function(_){if(p.paused||!a)return;const x=_.target;a.contains(x)?u.current=x:Kt(u.current,{select:!0})},h=function(_){if(p.paused||!a)return;const x=_.relatedTarget;x!==null&&(a.contains(x)||Kt(u.current,{select:!0}))},b=function(_){if(document.activeElement===document.body)for(const S of _)S.removedNodes.length>0&&Kt(a)};document.addEventListener("focusin",m),document.addEventListener("focusout",h);const v=new MutationObserver(b);return a&&v.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",h),v.disconnect()}}},[r,a,p.paused]),w.useEffect(()=>{if(a){nl.add(p);const m=document.activeElement;if(!a.contains(m)){const b=new CustomEvent(to,el);a.addEventListener(to,d),a.dispatchEvent(b),b.defaultPrevented||(Og(jg(Cu(a)),{select:!0}),document.activeElement===m&&Kt(a))}return()=>{a.removeEventListener(to,d),setTimeout(()=>{const b=new CustomEvent(no,el);a.addEventListener(no,f),a.dispatchEvent(b),b.defaultPrevented||Kt(m??document.body,{select:!0}),a.removeEventListener(no,f),nl.remove(p)},0)}}},[a,d,f,p]);const y=w.useCallback(m=>{if(!n&&!r||p.paused)return;const h=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,b=document.activeElement;if(h&&b){const v=m.currentTarget,[_,x]=Ng(v);_&&x?!m.shiftKey&&b===x?(m.preventDefault(),n&&Kt(_,{select:!0})):m.shiftKey&&b===_&&(m.preventDefault(),n&&Kt(x,{select:!0})):b===v&&m.preventDefault()}},[n,r,p.paused]);return c.jsx(he.div,{tabIndex:-1,...o,ref:g,onKeyDown:y})});Oa.displayName=Ag;function Og(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Kt(r,{select:t}),document.activeElement!==n)return}function Ng(e){const t=Cu(e),n=tl(t,e),r=tl(t.reverse(),e);return[n,r]}function Cu(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function tl(e,t){for(const n of e)if(!Rg(n,{upTo:t}))return n}function Rg(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Lg(e){return e instanceof HTMLInputElement&&"select"in e}function Kt(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Lg(e)&&t&&e.select()}}var nl=Dg();function Dg(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=rl(e,t),e.unshift(t)},remove(t){var n;e=rl(e,t),(n=e[0])==null||n.resume()}}}function rl(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function jg(e){return e.filter(t=>t.tagName!=="A")}var Ig="Portal",Si=w.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[s,i]=w.useState(!1);Ie(()=>i(!0),[]);const o=n||s&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?Cr.createPortal(c.jsx(he.div,{...r,ref:t}),o):null});Si.displayName=Ig;function Mg(e,t){return w.useReducer((n,r)=>t[n][r]??n,e)}var $n=e=>{const{present:t,children:n}=e,r=Fg(t),s=typeof n=="function"?n({present:r.isPresent}):w.Children.only(n),i=Ug(r.ref,Bg(s));return typeof n=="function"||r.isPresent?w.cloneElement(s,{ref:i}):null};$n.displayName="Presence";function Fg(e){const[t,n]=w.useState(),r=w.useRef(null),s=w.useRef(e),i=w.useRef("none"),o=e?"mounted":"unmounted",[a,l]=Mg(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const d=Ss(r.current);i.current=a==="mounted"?d:"none"},[a]),Ie(()=>{const d=r.current,f=s.current;if(f!==e){const g=i.current,p=Ss(d);e?l("MOUNT"):p==="none"||(d==null?void 0:d.display)==="none"?l("UNMOUNT"):l(f&&g!==p?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,l]),Ie(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,u=p=>{const m=Ss(r.current).includes(CSS.escape(p.animationName));if(p.target===t&&m&&(l("ANIMATION_END"),!s.current)){const h=t.style.animationFillMode;t.style.animationFillMode="forwards",d=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=h)})}},g=p=>{p.target===t&&(i.current=Ss(r.current))};return t.addEventListener("animationstart",g),t.addEventListener("animationcancel",u),t.addEventListener("animationend",u),()=>{f.clearTimeout(d),t.removeEventListener("animationstart",g),t.removeEventListener("animationcancel",u),t.removeEventListener("animationend",u)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:w.useCallback(d=>{r.current=d?getComputedStyle(d):null,n(d)},[])}}function sl(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Ug(...e){const t=w.useRef(e);return t.current=e,w.useCallback(n=>{const r=t.current;let s=!1;const i=r.map(o=>{const a=sl(o,n);return!s&&typeof a=="function"&&(s=!0),a});if(s)return()=>{for(let o=0;o<i.length;o++){const a=i[o];typeof a=="function"?a():sl(r[o],null)}}},[])}function Ss(e){return(e==null?void 0:e.animationName)||"none"}function Bg(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Cs=0,St=null;function Tu(){w.useEffect(()=>{St||(St={start:il(),end:il()});const{start:e,end:t}=St;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),Cs++,()=>{Cs===1&&(St==null||St.start.remove(),St==null||St.end.remove(),St=null),Cs=Math.max(0,Cs-1)}},[])}function il(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var kt=function(){return kt=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},kt.apply(this,arguments)};function Eu(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}function $g(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,i;r<s;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var $s="right-scroll-bar-position",Vs="width-before-scroll-bar",Vg="with-scroll-bars-hidden",Hg="--removed-body-scroll-bar-size";function ro(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function zg(e,t){var n=C.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=t,n.facade}var Wg=typeof window<"u"?w.useLayoutEffect:w.useEffect,ol=new WeakMap;function Kg(e,t){var n=zg(null,function(r){return e.forEach(function(s){return ro(s,r)})});return Wg(function(){var r=ol.get(n);if(r){var s=new Set(r),i=new Set(e),o=n.current;s.forEach(function(a){i.has(a)||ro(a,null)}),i.forEach(function(a){s.has(a)||ro(a,o)})}ol.set(n,e)},[e]),n}function qg(e){return e}function Gg(e,t){t===void 0&&(t=qg);var n=[],r=!1,s={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var o=t(i,r);return n.push(o),function(){n=n.filter(function(a){return a!==o})}},assignSyncMedium:function(i){for(r=!0;n.length;){var o=n;n=[],o.forEach(i)}n={push:function(a){return i(a)},filter:function(){return n}}},assignMedium:function(i){r=!0;var o=[];if(n.length){var a=n;n=[],a.forEach(i),o=n}var l=function(){var f=o;o=[],f.forEach(i)},d=function(){return Promise.resolve().then(l)};d(),n={push:function(f){o.push(f),d()},filter:function(f){return o=o.filter(f),n}}}};return s}function Zg(e){e===void 0&&(e={});var t=Gg(null);return t.options=kt({async:!0,ssr:!1},e),t}var Pu=function(e){var t=e.sideCar,n=Eu(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return w.createElement(r,kt({},n))};Pu.isSideCarExport=!0;function Yg(e,t){return e.useMedium(t),Pu}var ku=Zg(),so=function(){},Ci=w.forwardRef(function(e,t){var n=w.useRef(null),r=w.useState({onScrollCapture:so,onWheelCapture:so,onTouchMoveCapture:so}),s=r[0],i=r[1],o=e.forwardProps,a=e.children,l=e.className,d=e.removeScrollBar,f=e.enabled,u=e.shards,g=e.sideCar,p=e.noRelative,y=e.noIsolation,m=e.inert,h=e.allowPinchZoom,b=e.as,v=b===void 0?"div":b,_=e.gapMode,x=Eu(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=g,T=Kg([n,t]),P=kt(kt({},x),s);return w.createElement(w.Fragment,null,f&&w.createElement(S,{sideCar:ku,removeScrollBar:d,shards:u,noRelative:p,noIsolation:y,inert:m,setCallbacks:i,allowPinchZoom:!!h,lockRef:n,gapMode:_}),o?w.cloneElement(w.Children.only(a),kt(kt({},P),{ref:T})):w.createElement(v,kt({},P,{className:l,ref:T}),a))});Ci.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ci.classNames={fullWidth:Vs,zeroRight:$s};var Qg=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Xg(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Qg();return t&&e.setAttribute("nonce",t),e}function Jg(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function ey(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var ty=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Xg())&&(Jg(t,n),ey(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},ny=function(){var e=ty();return function(t,n){w.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Au=function(){var e=ny(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},ry={left:0,top:0,right:0,gap:0},io=function(e){return parseInt(e||"",10)||0},sy=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[io(n),io(r),io(s)]},iy=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return ry;var t=sy(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},oy=Au(),Xn="data-scroll-locked",ay=function(e,t,n,r){var s=e.left,i=e.top,o=e.right,a=e.gap;return n===void 0&&(n="margin"),`
|
|
2
|
+
.`.concat(Vg,` {
|
|
3
3
|
overflow: hidden `).concat(r,`;
|
|
4
4
|
padding-right: `).concat(a,"px ").concat(r,`;
|
|
5
5
|
}
|
|
@@ -16,29 +16,29 @@
|
|
|
16
16
|
`),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),`
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
.`).concat(
|
|
19
|
+
.`).concat($s,` {
|
|
20
20
|
right: `).concat(a,"px ").concat(r,`;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
.`).concat(
|
|
23
|
+
.`).concat(Vs,` {
|
|
24
24
|
margin-right: `).concat(a,"px ").concat(r,`;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
.`).concat(
|
|
27
|
+
.`).concat($s," .").concat($s,` {
|
|
28
28
|
right: 0 `).concat(r,`;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
.`).concat(
|
|
31
|
+
.`).concat(Vs," .").concat(Vs,` {
|
|
32
32
|
margin-right: 0 `).concat(r,`;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
body[`).concat(Xn,`] {
|
|
36
|
-
`).concat(
|
|
36
|
+
`).concat(Hg,": ").concat(a,`px;
|
|
37
37
|
}
|
|
38
|
-
`)},
|
|
38
|
+
`)},al=function(){var e=parseInt(document.body.getAttribute(Xn)||"0",10);return isFinite(e)?e:0},cy=function(){w.useEffect(function(){return document.body.setAttribute(Xn,(al()+1).toString()),function(){var e=al()-1;e<=0?document.body.removeAttribute(Xn):document.body.setAttribute(Xn,e.toString())}},[])},ly=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;cy();var i=w.useMemo(function(){return iy(s)},[s]);return w.createElement(oy,{styles:ay(i,!t,s,n?"":"!important")})},Lo=!1;if(typeof window<"u")try{var Ts=Object.defineProperty({},"passive",{get:function(){return Lo=!0,!0}});window.addEventListener("test",Ts,Ts),window.removeEventListener("test",Ts,Ts)}catch{Lo=!1}var Hn=Lo?{passive:!1}:!1,dy=function(e){return e.tagName==="TEXTAREA"},Ou=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!dy(e)&&n[t]==="visible")},uy=function(e){return Ou(e,"overflowY")},fy=function(e){return Ou(e,"overflowX")},cl=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=Nu(e,r);if(s){var i=Ru(e,r),o=i[1],a=i[2];if(o>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},my=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},py=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Nu=function(e,t){return e==="v"?uy(t):fy(t)},Ru=function(e,t){return e==="v"?my(t):py(t)},hy=function(e,t){return e==="h"&&t==="rtl"?-1:1},gy=function(e,t,n,r,s){var i=hy(e,window.getComputedStyle(t).direction),o=i*r,a=n.target,l=t.contains(a),d=!1,f=o>0,u=0,g=0;do{if(!a)break;var p=Ru(e,a),y=p[0],m=p[1],h=p[2],b=m-h-i*y;(y||b)&&Nu(e,a)&&(u+=b,g+=y);var v=a.parentNode;a=v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE?v.host:v}while(!l&&a!==document.body||l&&(t.contains(a)||t===a));return(f&&Math.abs(u)<1||!f&&Math.abs(g)<1)&&(d=!0),d},Es=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},ll=function(e){return[e.deltaX,e.deltaY]},dl=function(e){return e&&"current"in e?e.current:e},yy=function(e,t){return e[0]===t[0]&&e[1]===t[1]},by=function(e){return`
|
|
39
39
|
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
40
40
|
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
41
|
-
`)},ay=0,zn=[];function cy(e){var t=w.useRef([]),n=w.useRef([0,0]),r=w.useRef(),s=w.useState(ay++)[0],i=w.useState(gu)[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=Ng([e.lockRef.current],(e.shards||[]).map(tl),!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,E=Math.abs(x)>Math.abs(_)?"h":"v";if("touches"in p&&E==="h"&&P.type==="range")return!1;var k=window.getSelection(),D=k&&k.anchorNode,I=D?D===P||D.contains(P):!1;if(I)return!1;var N=Jc(E,P);if(!N)return!0;if(N?C=E:(C=E==="v"?"h":"v",N=Jc(E,P)),!N)return!1;if(!r.current&&"changedTouches"in p&&(x||_)&&(r.current=C),!C)return!0;var O=r.current||C;return sy(O,y,p,O==="h"?x:_)},[]),l=w.useCallback(function(p){var y=p;if(!(!zn.length||zn[zn.length-1]!==i)){var b="deltaY"in y?el(y):bs(y),v=t.current.filter(function(C){return C.name===y.type&&(C.target===y.target||y.target===C.shadowParent)&&iy(C.delta,b)})[0];if(v&&v.should){y.cancelable&&y.preventDefault();return}if(!v){var x=(o.current.shards||[]).map(tl).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:ly(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,el(p),p.target,a(p,e.lockRef.current))},[]),g=w.useCallback(function(p){d(p.type,bs(p),p.target,a(p,e.lockRef.current))},[]);w.useEffect(function(){return zn.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:g}),document.addEventListener("wheel",l,Hn),document.addEventListener("touchmove",l,Hn),document.addEventListener("touchstart",u,Hn),function(){zn=zn.filter(function(p){return p!==i}),document.removeEventListener("wheel",l,Hn),document.removeEventListener("touchmove",l,Hn),document.removeEventListener("touchstart",u,Hn)}},[]);var m=e.removeScrollBar,h=e.inert;return w.createElement(w.Fragment,null,h?w.createElement(i,{styles:oy(s)}):null,m?w.createElement(Qg,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function ly(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const dy=Fg(hu,cy);var Ta=w.forwardRef(function(e,t){return w.createElement(bi,Pt({},e,{ref:t,sideCar:dy}))});Ta.classNames=bi.classNames;var uy=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Wn=new WeakMap,vs=new WeakMap,ws={},to=0,wu=function(e){return e&&(e.host||wu(e.parentNode))},fy=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=wu(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})},py=function(e,t,n,r){var s=fy(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(g){if(a.has(g))u(g);else try{var m=g.getAttribute(r),h=m!==null&&m!=="false",p=(Wn.get(g)||0)+1,y=(i.get(g)||0)+1;Wn.set(g,p),i.set(g,y),o.push(g),p===1&&h&&vs.set(g,!0),y===1&&g.setAttribute(n,"true"),h||g.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",g,b)}})};return u(t),a.clear(),to++,function(){o.forEach(function(f){var g=Wn.get(f)-1,m=i.get(f)-1;Wn.set(f,g),i.set(f,m),g||(vs.has(f)||f.removeAttribute(r),vs.delete(f)),m||f.removeAttribute(n)}),to--,to||(Wn=new WeakMap,Wn=new WeakMap,vs=new WeakMap,ws={})}},_u=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=uy(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),py(r,s,n,"aria-hidden")):function(){return null}},vi="Dialog",[xu]=Bn(vi),[my,yt]=xu(vi),Su=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(my,{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})};Su.displayName=vi;var Cu="DialogTrigger",hy=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=yt(Cu,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)})});hy.displayName=Cu;var Pa="DialogPortal",[gy,Eu]=xu(Pa,{forceMount:void 0}),Tu=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,i=yt(Pa,t);return c.jsx(gy,{scope:t,forceMount:n,children:w.Children.map(r,o=>c.jsx($n,{present:n||i.open,children:c.jsx(yi,{asChild:!0,container:s,children:o})}))})};Tu.displayName=Pa;var Ks="DialogOverlay",Aa=w.forwardRef((e,t)=>{const n=Eu(Ks,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=yt(Ks,e.__scopeDialog);return i.modal?c.jsx($n,{present:r||i.open,children:c.jsx(by,{...s,ref:t})}):null});Aa.displayName=Ks;var yy=pr("DialogOverlay.RemoveScroll"),by=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=yt(Ks,n),i=fg(),o=Pe(t,i);return c.jsx(Ta,{as:yy,allowPinchZoom:!0,shards:[s.contentRef],children:c.jsx(me.div,{"data-state":Ra(s.open),...r,ref:o,style:{pointerEvents:"auto",...r.style}})})}),mr="DialogContent",Na=w.forwardRef((e,t)=>{const n=Eu(mr,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=yt(mr,e.__scopeDialog);return c.jsx($n,{present:r||i.open,children:i.modal?c.jsx(vy,{...s,ref:t}):c.jsx(wy,{...s,ref:t})})});Na.displayName=mr;var vy=w.forwardRef((e,t)=>{const n=yt(mr,e.__scopeDialog),r=w.useRef(null),s=Pe(t,n.contentRef,r);return w.useEffect(()=>{const i=r.current;if(i)return _u(i)},[]),c.jsx(Pu,{...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())})}),wy=w.forwardRef((e,t)=>{const n=yt(mr,e.__scopeDialog),r=w.useRef(!1),s=w.useRef(!1);return c.jsx(Pu,{...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()}})}),Pu=w.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,...o}=e,a=yt(mr,n);return fu(),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)})})})}),Au="DialogTitle",Oa=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=yt(Au,n);return c.jsx(me.h2,{id:s.titleId,...r,ref:t})});Oa.displayName=Au;var Nu="DialogDescription",ka=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=yt(Nu,n);return c.jsx(me.p,{id:s.descriptionId,...r,ref:t})});ka.displayName=Nu;var Ou="DialogClose",_y=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=yt(Ou,n);return c.jsx(me.button,{type:"button",...r,ref:t,onClick:pe(e.onClick,()=>s.onOpenChange(!1))})});_y.displayName=Ou;function Ra(e){return e?"open":"closed"}const xy=Su,Sy=Tu,ku=w.forwardRef(({className:e,...t},n)=>c.jsx(Aa,{ref:n,className:Se("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=Aa.displayName;const Ru=w.forwardRef(({className:e,overlayClass:t,children:n,...r},s)=>c.jsxs(Sy,{children:[c.jsx(ku,{className:t}),c.jsx(Na,{ref:s,className:Se("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})]}));Ru.displayName=Na.displayName;const Du=({className:e,...t})=>c.jsx("div",{className:Se("flex flex-col space-y-1.5 border-b text-center sm:text-left",e),...t});Du.displayName="DialogHeader";const Lu=({className:e,...t})=>c.jsx("div",{className:Se("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Lu.displayName="DialogFooter";const ju=w.forwardRef(({className:e,...t},n)=>c.jsx(Oa,{ref:n,className:Se("text-lg font-semibold leading-none tracking-tight",e),...t}));ju.displayName=Oa.displayName;const Iu=w.forwardRef(({className:e,...t},n)=>c.jsx(ka,{ref:n,className:Se("text-sm text-muted-foreground",e),...t}));Iu.displayName=ka.displayName;function nl(e,[t,n]){return Math.min(n,Math.max(t,e))}function Da(e){const t=e+"CollectionProvider",[n,r]=Bn(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=pr(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",g=pr(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(g,{[f]:"",ref:C,children:v})});m.displayName=u;function h(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,E)=>x.indexOf(P.ref.current)-x.indexOf(E.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:o,Slot:d,ItemSlot:m},h,r]}var Cy=w.createContext(void 0);function Mu(e){const t=w.useContext(Cy);return e||t||"ltr"}const Ey=["top","right","bottom","left"],ln=Math.min,tt=Math.max,Gs=Math.round,_s=Math.floor,Nt=e=>({x:e,y:e}),Ty={left:"right",right:"left",bottom:"top",top:"bottom"};function No(e,t,n){return tt(e,ln(t,n))}function It(e,t){return typeof e=="function"?e(t):e}function Mt(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 At(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Ia(e){return La(At(e))}function Py(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 Ay(e){const t=qs(e);return[Oo(e),t,Oo(t)]}function Oo(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const rl=["left","right"],sl=["right","left"],Ny=["top","bottom"],Oy=["bottom","top"];function ky(e,t,n){switch(e){case"top":case"bottom":return n?t?sl:rl:t?rl:sl;case"left":case"right":return t?Ny:Oy;default:return[]}}function Ry(e,t,n,r){const s=Er(e);let i=ky(Mt(e),n==="start",r);return s&&(i=i.map(o=>o+"-"+s),t&&(i=i.concat(i.map(Oo)))),i}function qs(e){const t=Mt(e);return Ty[t]+e.slice(t.length)}function Dy(e){return{top:0,right:0,bottom:0,left:0,...e}}function Fu(e){return typeof e!="number"?Dy(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 il(e,t,n){let{reference:r,floating:s}=e;const i=At(t),o=Ia(t),a=ja(o),l=Mt(t),d=i==="y",u=r.x+r.width/2-s.width/2,f=r.y+r.height/2-s.height/2,g=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]-=g*(n&&d?-1:1);break;case"end":m[o]+=g*(n&&d?-1:1);break}return m}async function Ly(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:g=!1,padding:m=0}=It(t,e),h=Fu(m),y=a[g?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+h.top)/_.y,bottom:(C.bottom-b.bottom+h.bottom)/_.y,left:(b.left-C.left+h.left)/_.x,right:(C.right-b.right+h.right)/_.x}}const jy=50,Iy=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:o}=n,a=o.detectOverflow?o:{...o,detectOverflow:Ly},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}=il(d,r,l),g=r,m=0;const h={};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:g,strategy:s,middlewareData:h,rects:d,platform:a,elements:{reference:e,floating:t}});u=x??u,f=_??f,h[b]={...h[b],...C},P&&m<jy&&(m++,typeof P=="object"&&(P.placement&&(g=P.placement),P.rects&&(d=P.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:s}):P.rects),{x:u,y:f}=il(d,g,l)),p=-1)}return{x:u,y:f,placement:g,strategy:s,middlewareData:h}},My=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}=It(e,t)||{};if(d==null)return{};const f=Fu(u),g={x:n,y:r},m=Ia(s),h=ja(m),p=await o.getDimensions(d),y=m==="y",b=y?"top":"left",v=y?"bottom":"right",x=y?"clientHeight":"clientWidth",_=i.reference[h]+i.reference[m]-g[m]-i.floating[h],C=g[m]-i.reference[m],P=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let E=P?P[x]:0;(!E||!await(o.isElement==null?void 0:o.isElement(P)))&&(E=a.floating[x]||i.floating[h]);const k=_/2-C/2,D=E/2-p[h]/2-1,I=ln(f[b],D),N=ln(f[v],D),O=I,B=E-p[h]-N,R=E/2-p[h]/2+k,H=No(O,R,B),F=!l.arrow&&Er(s)!=null&&R!==H&&i.reference[h]/2-(R<O?I:N)-p[h]/2<0,M=F?R<O?R-O:R-B:0;return{[m]:g[m]+M,data:{[m]:H,centerOffset:R-H-M,...F&&{alignmentOffset:M}},reset:F}}}),Fy=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:g,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:p=!0,...y}=It(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const b=Mt(s),v=At(a),x=Mt(a)===a,_=await(l.isRTL==null?void 0:l.isRTL(d.floating)),C=g||(x||!p?[qs(a)]:Ay(a)),P=h!=="none";!g&&P&&C.push(...Ry(a,p,h,_));const E=[a,...C],k=await l.detectOverflow(t,y),D=[];let I=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&D.push(k[b]),f){const R=Py(s,o,_);D.push(k[R[0]],k[R[1]])}if(I=[...I,{placement:s,overflows:D}],!D.every(R=>R<=0)){var N,O;const R=(((N=i.flip)==null?void 0:N.index)||0)+1,H=E[R];if(H&&(!(f==="alignment"?v!==At(H):!1)||I.every(L=>At(L.placement)===v?L.overflows[0]>0:!0)))return{data:{index:R,overflows:I},reset:{placement:H}};let F=(O=I.filter(M=>M.overflows[0]<=0).sort((M,L)=>M.overflows[1]-L.overflows[1])[0])==null?void 0:O.placement;if(!F)switch(m){case"bestFit":{var B;const M=(B=I.filter(L=>{if(P){const U=At(L.placement);return U===v||U==="y"}return!0}).map(L=>[L.placement,L.overflows.filter(U=>U>0).reduce((U,K)=>U+K,0)]).sort((L,U)=>L[1]-U[1])[0])==null?void 0:B[0];M&&(F=M);break}case"initialPlacement":F=a;break}if(s!==F)return{reset:{placement:F}}}return{}}}};function ol(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function al(e){return Ey.some(t=>e[t]>=0)}const Uy=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:s="referenceHidden",...i}=It(e,t);switch(s){case"referenceHidden":{const o=await r.detectOverflow(t,{...i,elementContext:"reference"}),a=ol(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:al(a)}}}case"escaped":{const o=await r.detectOverflow(t,{...i,altBoundary:!0}),a=ol(o,n.floating);return{data:{escapedOffsets:a,escaped:al(a)}}}default:return{}}}}},Uu=new Set(["left","top"]);async function By(e,t){const{placement:n,platform:r,elements:s}=e,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=Mt(n),a=Er(n),l=At(n)==="y",d=Uu.has(o)?-1:1,u=i&&l?-1:1,f=It(t,e);let{mainAxis:g,crossAxis:m,alignmentAxis:h}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof h=="number"&&(m=a==="end"?h*-1:h),l?{x:m*u,y:g*d}:{x:g*d,y:m*u}}const $y=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 By(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}}}}},Vy=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}=It(e,t),u={x:n,y:r},f=await i.detectOverflow(t,d),g=At(Mt(s)),m=La(g);let h=u[m],p=u[g];if(o){const b=m==="y"?"top":"left",v=m==="y"?"bottom":"right",x=h+f[b],_=h-f[v];h=No(x,h,_)}if(a){const b=g==="y"?"top":"left",v=g==="y"?"bottom":"right",x=p+f[b],_=p-f[v];p=No(x,p,_)}const y=l.fn({...t,[m]:h,[g]:p});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[m]:o,[g]:a}}}}}},Hy=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}=It(e,t),u={x:n,y:r},f=At(s),g=La(f);let m=u[g],h=u[f];const p=It(a,t),y=typeof p=="number"?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(l){const x=g==="y"?"height":"width",_=i.reference[g]-i.floating[x]+y.mainAxis,C=i.reference[g]+i.reference[x]-y.mainAxis;m<_?m=_:m>C&&(m=C)}if(d){var b,v;const x=g==="y"?"width":"height",_=Uu.has(Mt(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);h<C?h=C:h>P&&(h=P)}return{[g]:m,[f]:h}}}},zy=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:i,platform:o,elements:a}=t,{apply:l=()=>{},...d}=It(e,t),u=await o.detectOverflow(t,d),f=Mt(s),g=Er(s),m=At(s)==="y",{width:h,height:p}=i.floating;let y,b;f==="top"||f==="bottom"?(y=f,b=g===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(b=f,y=g==="end"?"top":"bottom");const v=p-u.top-u.bottom,x=h-u.left-u.right,_=ln(p-u[y],v),C=ln(h-u[b],x),P=!t.middlewareData.shift;let E=_,k=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(k=x),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(E=v),P&&!g){const I=tt(u.left,0),N=tt(u.right,0),O=tt(u.top,0),B=tt(u.bottom,0);m?k=h-2*(I!==0||N!==0?I+N:tt(u.left,u.right)):E=p-2*(O!==0||B!==0?O+B:tt(u.top,u.bottom))}await l({...t,availableWidth:k,availableHeight:E});const D=await o.getDimensions(a.floating);return h!==D.width||p!==D.height?{reset:{rects:!0}}:{}}}};function wi(){return typeof window<"u"}function Tr(e){return Bu(e)?(e.nodeName||"").toLowerCase():"#document"}function nt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function kt(e){var t;return(t=(Bu(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Bu(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 Bt(e){return wi()?e instanceof HTMLElement||e instanceof nt(e).HTMLElement:!1}function cl(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 Wy(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 Ky=/transform|translate|scale|rotate|perspective|filter/,Gy=/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))||Ky.test(t.willChange||"")||Gy.test(t.contain||"")}function qy(e){let t=dn(e);for(;Bt(t)&&!hr(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 hr(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||cl(e)&&e.host||kt(e);return cl(t)?t.host:t}function $u(e){const t=dn(e);return hr(t)?e.ownerDocument?e.ownerDocument.body:e.body:Bt(t)&&ns(t)?t:$u(t)}function $r(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=$u(e),i=s===((r=e.ownerDocument)==null?void 0:r.body),o=nt(s);if(i){const a=ko(o);return t.concat(o,o.visualViewport||[],ns(s)?s:[],a&&n?$r(a):[])}else return t.concat(s,$r(s,[],n))}function ko(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Vu(e){const t=gt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=Bt(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 Jn(e){const t=Ua(e);if(!Bt(t))return Nt(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:i}=Vu(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 Zy=Nt(0);function Hu(e){const t=nt(e);return!Fa()||!t.visualViewport?Zy:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Yy(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=Nt(1);t&&(r?ht(r)&&(o=Jn(r)):o=Jn(e));const a=Yy(i,n,r)?Hu(i):Nt(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 g=nt(i),m=r&&ht(r)?nt(r):r;let h=g,p=ko(h);for(;p&&r&&m!==h;){const y=Jn(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+=_,h=nt(p),p=ko(h)}}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(kt(e)).left+n}function zu(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=kt(r),a=t?_i(t.floating):!1;if(r===o||a&&i)return n;let l={scrollLeft:0,scrollTop:0},d=Nt(1);const u=Nt(0),f=Bt(r);if((f||!f&&!i)&&((Tr(r)!=="body"||ns(o))&&(l=xi(r)),f)){const m=Ln(r);d=Jn(r),u.x=m.x+r.clientLeft,u.y=m.y+r.clientTop}const g=o&&!f&&!i?zu(o,l):Nt(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-l.scrollLeft*d.x+u.x+g.x,y:n.y*d.y-l.scrollTop*d.y+u.y+g.y}}function Xy(e){return Array.from(e.getClientRects())}function Jy(e){const t=kt(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 ll=25;function eb(e,t){const n=nt(e),r=kt(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,g=getComputedStyle(f),m=u.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,h=Math.abs(r.clientWidth-f.clientWidth-m);h<=ll&&(i-=h)}else d<=ll&&(i+=d);return{width:i,height:o,x:a,y:l}}function tb(e,t){const n=Ln(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,i=Bt(e)?Jn(e):Nt(1),o=e.clientWidth*i.x,a=e.clientHeight*i.y,l=s*i.x,d=r*i.y;return{width:o,height:a,x:l,y:d}}function dl(e,t,n){let r;if(t==="viewport")r=eb(e,n);else if(t==="document")r=Jy(kt(e));else if(ht(t))r=tb(t,n);else{const s=Hu(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return Zs(r)}function Wu(e,t){const n=dn(e);return n===t||!ht(n)||hr(n)?!1:gt(n).position==="fixed"||Wu(n,t)}function nb(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)&&!hr(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&&Wu(e,o))?r=r.filter(u=>u!==o):s=a,o=dn(o)}return t.set(e,r),r}function rb(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const o=[...n==="clippingAncestors"?_i(t)?[]:nb(t,this._c):[].concat(n),r],a=dl(t,o[0],s);let l=a.top,d=a.right,u=a.bottom,f=a.left;for(let g=1;g<o.length;g++){const m=dl(t,o[g],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 sb(e){const{width:t,height:n}=Vu(e);return{width:t,height:n}}function ib(e,t,n){const r=Bt(t),s=kt(t),i=n==="fixed",o=Ln(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=Nt(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?zu(s,a):Nt(0),f=o.left+a.scrollLeft-l.x-u.x,g=o.top+a.scrollTop-l.y-u.y;return{x:f,y:g,width:o.width,height:o.height}}function ro(e){return gt(e).position==="static"}function ul(e,t){if(!Bt(e)||gt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return kt(e)===n&&(n=n.ownerDocument.body),n}function Ku(e,t){const n=nt(e);if(_i(e))return n;if(!Bt(e)){let s=dn(e);for(;s&&!hr(s);){if(ht(s)&&!ro(s))return s;s=dn(s)}return n}let r=ul(e,t);for(;r&&Wy(r)&&ro(r);)r=ul(r,t);return r&&hr(r)&&ro(r)&&!Ma(r)?n:r||qy(e)||n}const ob=async function(e){const t=this.getOffsetParent||Ku,n=this.getDimensions,r=await n(e.floating);return{reference:ib(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function ab(e){return gt(e).direction==="rtl"}const cb={convertOffsetParentRelativeRectToViewportRelativeRect:Qy,getDocumentElement:kt,getClippingRect:rb,getOffsetParent:Ku,getElementRects:ob,getClientRects:Xy,getDimensions:sb,getScale:Jn,isElement:ht,isRTL:ab};function Gu(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function lb(e,t){let n=null,r;const s=kt(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:g,height:m}=d;if(a||t(),!g||!m)return;const h=_s(f),p=_s(s.clientWidth-(u+g)),y=_s(s.clientHeight-(f+m)),b=_s(u),x={rootMargin:-h+"px "+-p+"px "+-y+"px "+-b+"px",threshold:tt(0,ln(1,l))||1};let _=!0;function C(P){const E=P[0].intersectionRatio;if(E!==l){if(!_)return o();E?o(!1,E):r=setTimeout(()=>{o(!1,1e-7)},1e3)}E===1&&!Gu(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 db(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?lb(d,n):null;let g=-1,m=null;o&&(m=new ResizeObserver(b=>{let[v]=b;v&&v.target===d&&m&&t&&(m.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var x;(x=m)==null||x.observe(t)})),n()}),d&&!l&&m.observe(d),t&&m.observe(t));let h,p=l?Ln(e):null;l&&y();function y(){const b=Ln(e);p&&!Gu(p,b)&&n(),p=b,h=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(h)}}const ub=$y,fb=Vy,pb=Fy,mb=zy,hb=Uy,fl=My,gb=Hy,yb=(e,t,n)=>{const r=new Map,s={platform:cb,...n},i={...s.platform,_c:r};return Iy(e,t,{...s,platform:i})};var bb=typeof document<"u",vb=function(){},Is=bb?S.useLayoutEffect:vb;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 qu(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function pl(e,t){const n=qu(e);return Math.round(t*n)/n}function so(e){const t=w.useRef(e);return Is(()=>{t.current=e}),t}function wb(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}),[g,m]=w.useState(r);Ys(g,r)||m(r);const[h,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!==E.current&&(E.current=L,b(L))},[]),_=i||h,C=o||y,P=w.useRef(null),E=w.useRef(null),k=w.useRef(u),D=l!=null,I=so(l),N=so(s),O=so(d),B=w.useCallback(()=>{if(!P.current||!E.current)return;const L={placement:t,strategy:n,middleware:g};N.current&&(L.platform=N.current),yb(P.current,E.current,L).then(U=>{const K={...U,isPositioned:O.current!==!1};R.current&&!Ys(k.current,K)&&(k.current=K,Cr.flushSync(()=>{f(K)}))})},[g,t,n,N,O]);Is(()=>{d===!1&&k.current.isPositioned&&(k.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&&(E.current=C),_&&C){if(I.current)return I.current(_,C,B);B()}},[_,C,B,I,D]);const H=w.useMemo(()=>({reference:P,floating:E,setReference:v,setFloating:x}),[v,x]),F=w.useMemo(()=>({reference:_,floating:C}),[_,C]),M=w.useMemo(()=>{const L={position:n,left:0,top:0};if(!F.floating)return L;const U=pl(F.floating,u.x),K=pl(F.floating,u.y);return a?{...L,transform:"translate("+U+"px, "+K+"px)",...qu(F.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:U,top:K}},[n,a,F.floating,u.x,u.y]);return w.useMemo(()=>({...u,update:B,refs:H,elements:F,floatingStyles:M}),[u,B,H,F,M])}const _b=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?fl({element:r.current,padding:s}).fn(n):{}:r?fl({element:r,padding:s}).fn(n):{}}}},xb=(e,t)=>{const n=ub(e);return{name:n.name,fn:n.fn,options:[e,t]}},Sb=(e,t)=>{const n=fb(e);return{name:n.name,fn:n.fn,options:[e,t]}},Cb=(e,t)=>({fn:gb(e).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=hb(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ab=(e,t)=>{const n=_b(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Nb="Arrow",Zu=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"})})});Zu.displayName=Nb;var Ob=Zu;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",[Yu,Qu]=Bn(Ba),[Rb,Xu]=Yu(Ba),Ju=e=>{const{__scopePopper:t,children:n}=e,[r,s]=w.useState(null),[i,o]=w.useState(void 0);return c.jsx(Rb,{scope:t,anchor:r,onAnchorChange:s,placementState:i,setPlacementState:o,children:n})};Ju.displayName=Ba;var ef="PopperAnchor",tf=w.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,i=Xu(ef,n),o=w.useRef(null),a=i.onAnchorChange,l=w.useCallback(h=>{o.current=h,h&&a(h)},[a]),d=Pe(t,l),u=w.useRef(null);w.useEffect(()=>{if(!r)return;const h=u.current;u.current=r.current,h!==u.current&&a(u.current)});const f=i.placementState&&Va(i.placementState),g=f==null?void 0:f[0],m=f==null?void 0:f[1];return r?null:c.jsx(me.div,{"data-radix-popper-side":g,"data-radix-popper-align":m,...s,ref:d})});tf.displayName=ef;var $a="PopperContent",[Db,Lb]=Yu($a),nf=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:g=!1,updatePositionStrategy:m="optimized",onPlaced:h,...p}=e,y=Xu($a,n),[b,v]=w.useState(null),x=Pe(t,Re=>v(Re)),[_,C]=w.useState(null),P=kb(_),E=(P==null?void 0:P.width)??0,k=(P==null?void 0:P.height)??0,D=r+(i!=="center"?"-"+i:""),I=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},N=Array.isArray(d)?d:[d],O=N.length>0,B={padding:I,boundary:N.filter(Ib),altBoundary:O},{refs:R,floatingStyles:H,placement:F,isPositioned:M,middlewareData:L}=wb({strategy:"fixed",placement:D,whileElementsMounted:(...Re)=>db(...Re,{animationFrame:m==="always"}),elements:{reference:y.anchor},middleware:[xb({mainAxis:s+k,alignmentAxis:o}),l&&Sb({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?Cb():void 0,...B}),l&&Eb({...B}),Tb({...B,apply:({elements:Re,rects:Oe,availableWidth:X,availableHeight:Ae})=>{const{width:Fe,height:Qe}=Oe.reference,ct=Re.floating.style;ct.setProperty("--radix-popper-available-width",`${X}px`),ct.setProperty("--radix-popper-available-height",`${Ae}px`),ct.setProperty("--radix-popper-anchor-width",`${Fe}px`),ct.setProperty("--radix-popper-anchor-height",`${Qe}px`)}}),_&&Ab({element:_,padding:a}),Mb({arrowWidth:E,arrowHeight:k}),g&&Pb({strategy:"referenceHidden",...B,boundary:O?B.boundary:void 0})]}),U=y.setPlacementState;Ie(()=>(U(F),()=>{U(void 0)}),[F,U]);const[K,j]=Va(F),se=mt(h);Ie(()=>{M&&(se==null||se())},[M,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:R.setFloating,"data-radix-popper-content-wrapper":"",style:{...H,transform:M?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(Db,{scope:n,placedSide:K,placedAlign:j,onArrowChange:C,arrowX:z,arrowY:de,shouldHideArrow:ue,children:c.jsx(me.div,{"data-side":K,"data-align":j,...p,ref:x,style:{...p.style,animation:M?void 0:"none"}})})})});nf.displayName=$a;var rf="PopperArrow",jb={top:"bottom",right:"left",bottom:"top",left:"right"},sf=w.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,i=Lb(rf,r),o=jb[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(Ob,{...s,ref:n,style:{...s.style,display:"block"}})})});sf.displayName=rf;function Ib(e){return e!==null}var Mb=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],g=(((b=s.arrow)==null?void 0:b.x)??0)+a/2,m=(((v=s.arrow)==null?void 0:v.y)??0)+l/2;let h="",p="";return d==="bottom"?(h=o?f:`${g}px`,p=`${-l}px`):d==="top"?(h=o?f:`${g}px`,p=`${r.floating.height+l}px`):d==="right"?(h=`${-l}px`,p=o?f:`${m}px`):d==="left"&&(h=`${r.floating.width+l}px`,p=o?f:`${m}px`),{data:{x:h,y:p}}}});function Va(e){const[t,n="center"]=e.split("-");return[t,n]}var Fb=Ju,Ub=tf,Bb=nf,$b=sf;function Vb(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 of=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"}),Hb="VisuallyHidden",Ha=w.forwardRef((e,t)=>c.jsx(me.span,{...e,ref:t,style:{...of,...e.style}}));Ha.displayName=Hb;var zb=[" ","Enter","ArrowUp","ArrowDown"],Wb=[" ","Enter"],jn="Select",[Ci,Ei,Kb]=Da(jn),[Vn]=Bn(jn,[Kb,Qu]),Ti=Qu(),[Gb,mn]=Vn(jn),[qb,Zb]=Vn(jn),Yb="SelectProvider";function af(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:g,required:m,form:h,internal_do_not_use_render:p}=e,y=Ti(t),[b,v]=w.useState(null),[x,_]=w.useState(null),[C,P]=w.useState(!1),E=Mu(d),[k,D]=Dn({prop:r,defaultProp:s??!1,onChange:i,caller:jn}),[I,N]=Dn({prop:o,defaultProp:a,onChange:l,caller:jn}),O=w.useRef(null),B=b?!!h||!!b.closest("form"):!0,[R,H]=w.useState(new Set),F=on(),M=Array.from(R).map(j=>j.props.value).join(";"),L=w.useCallback(j=>{H(se=>new Set(se).add(j))},[]),U=w.useCallback(j=>{H(se=>{const z=new Set(se);return z.delete(j),z})},[]),K={required:m,trigger:b,onTriggerChange:v,valueNode:x,onValueNodeChange:_,valueNodeHasChildren:C,onValueNodeHasChildrenChange:P,contentId:F,value:I,onValueChange:N,open:k,onOpenChange:D,dir:E,triggerPointerDownPosRef:O,disabled:g,name:u,autoComplete:f,form:h,nativeOptions:R,nativeSelectKey:M,isFormControl:B};return c.jsx(Fb,{...y,children:c.jsx(Gb,{scope:t,...K,children:c.jsx(Ci.Provider,{scope:t,children:c.jsx(qb,{scope:t,onNativeOptionAdd:L,onNativeOptionRemove:U,children:uv(p)?p(K):n})})})})}af.displayName=Yb;var cf=e=>{const{__scopeSelect:t,children:n,...r}=e;return c.jsx(af,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:s})=>c.jsxs(c.Fragment,{children:[n,s?c.jsx(Nf,{__scopeSelect:t}):null]})})};cf.displayName=jn;var lf="SelectTrigger",za=w.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...s}=e,i=Ti(n),o=mn(lf,n),a=o.disabled||r,l=Pe(t,o.onTriggerChange),d=Ei(n),u=w.useRef("touch"),[f,g,m]=Of(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)}),h=p=>{a||(o.onOpenChange(!0),m()),p&&(o.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return c.jsx(Ub,{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"&&h(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"&&(h(p),p.preventDefault())}),onKeyDown:pe(s.onKeyDown,p=>{const y=f.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&g(p.key),!(y&&p.key===" ")&&zb.includes(p.key)&&(h(),p.preventDefault())})})})});za.displayName=lf;var df="SelectValue",uf=w.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,children:i,placeholder:o="",...a}=e,l=mn(df,n),{onValueNodeHasChildrenChange:d}=l,u=i!==void 0,f=Pe(t,l.onValueNodeChange);Ie(()=>{d(u)},[d,u]);const g=Pi(l.value);return c.jsx(me.span,{...a,asChild:g?!1:a.asChild,ref:f,style:{pointerEvents:"none"},children:c.jsx(w.Fragment,{children:g?o:i},g?"placeholder":"value")})});uf.displayName=df;var Qb="SelectIcon",ff=w.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...s}=e;return c.jsx(me.span,{"aria-hidden":!0,...s,ref:t,children:r||"▼"})});ff.displayName=Qb;var pf="SelectPortal",[Xb,Jb]=Vn(pf,{forceMount:void 0}),mf=e=>{const{__scopeSelect:t,forceMount:n,...r}=e;return c.jsx(Xb,{scope:e.__scopeSelect,forceMount:n,children:c.jsx(yi,{asChild:!0,...r})})};mf.displayName=pf;var un="SelectContent",Wa=w.forwardRef((e,t)=>{const n=Jb(un,e.__scopeSelect),{forceMount:r=n.forceMount,...s}=e,i=mn(un,e.__scopeSelect),[o,a]=w.useState();return Ie(()=>{a(new DocumentFragment)},[]),c.jsx($n,{present:r||i.open,children:({present:l})=>l?c.jsx(yf,{...s,ref:t}):c.jsx(hf,{...s,fragment:o})})});Wa.displayName=un;var hf=w.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,fragment:s}=e;return s?Cr.createPortal(c.jsx(gf,{scope:n,children:c.jsx(Ci.Slot,{scope:n,children:c.jsx("div",{ref:t,children:r})})}),s):null});hf.displayName="SelectContentFragment";var dt=10,[gf,hn]=Vn(un),ev="SelectContentImpl",tv=pr("SelectContent.RemoveScroll"),yf=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:g,collisionPadding:m,sticky:h,hideWhenDetached:p,avoidCollisions:y,...b}=e,v=mn(un,n),[x,_]=w.useState(null),[C,P]=w.useState(null),E=Pe(t,Z=>_(Z)),[k,D]=w.useState(null),[I,N]=w.useState(null),O=Ei(n),[B,R]=w.useState(!1),H=w.useRef(!1);w.useEffect(()=>{if(x)return _u(x)},[x]),fu();const F=w.useCallback(Z=>{const[$,...ye]=O().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},[O,C]),M=w.useCallback(()=>F([k,x]),[F,k,x]);w.useEffect(()=>{B&&M()},[B,M]);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[K,j]=Of(Z=>{const $=O().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)&&(D(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)&&N(Z)},[v.value]),ue=r==="popper"?Ro:bf,ee=ue===Ro?{side:a,sideOffset:l,align:d,alignOffset:u,arrowPadding:f,collisionBoundary:g,collisionPadding:m,sticky:h,hideWhenDetached:p,avoidCollisions:y}:{};return c.jsx(gf,{scope:n,content:x,viewport:C,onViewportChange:P,itemRefCallback:se,selectedItem:k,onItemLeave:z,itemTextRefCallback:de,focusSelectedItem:M,selectedItemText:I,position:r,isPositioned:B,searchRef:K,children:c.jsx(Ta,{as:tv,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:E,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&&j(Z.key),["ArrowUp","ArrowDown","Home","End"].includes(Z.key)){let ae=O().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()}})})})})})})});yf.displayName=ev;var nv="SelectItemAlignedPosition",bf=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,E=>u(E)),g=Ei(n),m=w.useRef(!1),h=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 E=i.trigger.getBoundingClientRect(),k=d.getBoundingClientRect(),D=i.valueNode.getBoundingClientRect(),I=b.getBoundingClientRect();if(i.dir!=="rtl"){const ie=I.left-k.left,te=D.left-ie,je=E.left-te,Re=E.width+je,Oe=Math.max(Re,k.width),X=window.innerWidth-dt,Ae=nl(te,[dt,Math.max(dt,X-Oe)]);a.style.minWidth=Re+"px",a.style.left=Ae+"px"}else{const ie=k.right-I.right,te=window.innerWidth-D.right-ie,je=window.innerWidth-E.right-te,Re=E.width+je,Oe=Math.max(Re,k.width),X=window.innerWidth-dt,Ae=nl(te,[dt,Math.max(dt,X-Oe)]);a.style.minWidth=Re+"px",a.style.right=Ae+"px"}const N=g(),O=window.innerHeight-dt*2,B=p.scrollHeight,R=window.getComputedStyle(d),H=parseInt(R.borderTopWidth,10),F=parseInt(R.paddingTop,10),M=parseInt(R.borderBottomWidth,10),L=parseInt(R.paddingBottom,10),U=H+F+B+L+M,K=Math.min(y.offsetHeight*5,U),j=window.getComputedStyle(p),se=parseInt(j.paddingTop,10),z=parseInt(j.paddingBottom,10),de=E.top+E.height/2-dt,ue=O-de,ee=y.offsetHeight/2,Z=y.offsetTop+ee,$=H+F+Z,ye=U-$;if($<=de){const ie=N.length>0&&y===N[N.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+M),Re=$+je;a.style.height=Re+"px"}else{const ie=N.length>0&&y===N[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=O+"px",r==null||r(),requestAnimationFrame(()=>m.current=!0)}},[g,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(E=>{E&&h.current===!0&&(x(),v==null||v(),h.current=!1)},[x,v]);return c.jsx(sv,{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}})})})});bf.displayName=nv;var rv="SelectPopperPosition",Ro=w.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=dt,...i}=e,o=Ti(n);return c.jsx(Bb,{...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=rv;var[sv,Ka]=Vn(un,{}),Do="SelectViewport",vf=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:g}=o;if(g!=null&&g.current&&f){const m=Math.abs(l.current-u.scrollTop);if(m>0){const h=window.innerHeight-dt*2,p=parseFloat(f.style.minHeight),y=parseFloat(f.style.height),b=Math.max(p,y);if(b<h){const v=b+m,x=Math.min(h,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})})})]})});vf.displayName=Do;var wf="SelectGroup",[iv,ov]=Vn(wf),av=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=on();return c.jsx(iv,{scope:n,id:s,children:c.jsx(me.div,{role:"group","aria-labelledby":s,...r,ref:t})})});av.displayName=wf;var _f="SelectLabel",Ga=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=ov(_f,n);return c.jsx(me.div,{id:s.id,...r,ref:t})});Ga.displayName=_f;var Qs="SelectItem",[cv,xf]=Vn(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??""),[g,m]=w.useState(!1),h=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(cv,{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":g?"":void 0,"aria-selected":d&&g,"data-state":d?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...o,ref:h,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===" "||(Wb.includes(v.key)&&b(),v.key===" "&&v.preventDefault())})})})})});qa.displayName=Qs;var Mr="SelectItemText",Sf=w.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,...i}=e,o=mn(Mr,n),a=hn(Mr,n),l=xf(Mr,n),d=Zb(Mr,n),[u,f]=w.useState(null),g=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,h=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(h),()=>y(h)),[p,y,h]),c.jsxs(c.Fragment,{children:[c.jsx(me.span,{id:l.textId,...i,ref:g}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!Pi(o.value)?Cr.createPortal(i.children,o.valueNode):null]})});Sf.displayName=Mr;var Cf="SelectItemIndicator",Ef=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return xf(Cf,n).isSelected?c.jsx(me.span,{"aria-hidden":!0,...r,ref:t}):null});Ef.displayName=Cf;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(Tf,{...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(Tf,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});Ya.displayName=jo;var Tf=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()})})}),lv="SelectSeparator",Qa=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return c.jsx(me.div,{"aria-hidden":!0,...r,ref:t})});Qa.displayName=lv;var Pf="SelectArrow",dv=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=Ti(n);return hn(Pf,n).position==="popper"?c.jsx($b,{...s,...r,ref:t}):null});dv.displayName=Pf;var Af="SelectBubbleInput",Nf=w.forwardRef(({__scopeSelect:e,...t},n)=>{const r=mn(Af,e),{value:s,onValueChange:i,required:o,disabled:a,name:l,autoComplete:d,form:u}=r,{nativeOptions:f,nativeSelectKey:g}=r,m=w.useRef(null),h=Pe(n,m),p=s??"",y=Vb(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:{...of,...t.style},ref:h,defaultValue:p,children:[Pi(s)&&!b?c.jsx("option",{value:""}):null,Array.from(f)]},g)});Nf.displayName=Af;function uv(e){return typeof e=="function"}function Pi(e){return e===""||e===void 0}function Of(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=fv(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 fv(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Ai(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 pv=["color"],mv=S.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=Ai(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:"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"}))}),hv=["color"],Xa=S.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=Ai(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 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"}))}),gv=["color"],yv=S.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=Ai(e,gv);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"}))}),bv=["color"],vv=S.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=Ai(e,bv);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=cf,Js=uf,Vr=w.forwardRef(({className:e,children:t,...n},r)=>c.jsxs(za,{ref:r,className:Se("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(ff,{asChild:!0,children:c.jsx(Xa,{className:"h-4 w-4 opacity-50"})})]}));Vr.displayName=za.displayName;const Rf=w.forwardRef(({className:e,...t},n)=>c.jsx(Za,{ref:n,className:Se("flex cursor-default items-center justify-center py-1",e),...t,children:c.jsx(yv,{className:"h-4 w-4"})}));Rf.displayName=Za.displayName;const Df=w.forwardRef(({className:e,...t},n)=>c.jsx(Ya,{ref:n,className:Se("flex cursor-default items-center justify-center py-1",e),...t,children:c.jsx(Xa,{className:"h-4 w-4"})}));Df.displayName=Ya.displayName;const Hr=w.forwardRef(({className:e,children:t,position:n="popper",...r},s)=>c.jsx(mf,{children:c.jsxs(Wa,{ref:s,className:Se("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(Rf,{}),c.jsx(vf,{className:Se("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),c.jsx(Df,{})]})}));Hr.displayName=Wa.displayName;const wv=w.forwardRef(({className:e,...t},n)=>c.jsx(Ga,{ref:n,className:Se("px-2 py-1.5 text-sm font-semibold",e),...t}));wv.displayName=Ga.displayName;const zr=w.forwardRef(({className:e,children:t,...n},r)=>c.jsxs(qa,{ref:r,className:Se("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(Ef,{children:c.jsx(mv,{className:"h-4 w-4"})})}),c.jsx(Sf,{children:t})]}));zr.displayName=qa.displayName;const _v=w.forwardRef(({className:e,...t},n)=>c.jsx(Qa,{ref:n,className:Se("-mx-1 my-1 h-px bg-muted",e),...t}));_v.displayName=Qa.displayName;function Lf({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(xy,{open:e,children:c.jsxs(Ru,{className:"web-trading-widget-account-modal",onPointerDownOutside:g=>g.preventDefault(),onEscapeKeyDown:g=>g.preventDefault(),children:[c.jsxs(Du,{children:[c.jsx(ju,{children:"Select trading account"}),c.jsx(Iu,{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(g=>c.jsxs(zr,{value:g.login,children:[g.label," (",g.balance.toFixed(2)," ",g.currency,")"]},g.login))})]}),c.jsx(Lu,{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 xv={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 Sv=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,...xv,width:s,height:s,stroke:r,strokeWidth:o?Number(i)*24/Number(s):i,className:`lucide lucide-${Sv(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"}]]),Cv=bt("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),Ev=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"}]]),jf=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"}]]),If=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"}]]),Tv=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"}]]),Pv=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"}]]),Av=bt("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]),Nv=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 Ov(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 Ut.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?Ov(t.pricescale):5}function Mf(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 Rv(e){const t=Ja(e);switch(t==null?void 0:t.type){case"commodity":return 100;case"crypto":case"indices":case"stock":return 1;case"forex":default:return 1e5}}const ec="USD";function rs(e){return Ye(e).toUpperCase()}function Ni(e){const t=rs(e);return t.length>=6?t.slice(3):ec}function tc(e){if(e!==ec&&e==="JPY")return"USDJPY"}function Dv(e,t,n,r,s){const i=Ni(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 Lv(e,t,n,r,s,i,o={}){const a=e==="buy"?n:r;let d=(e==="buy"?a-t:t-a)*s*Rv(i);const u=Ni(i),f=Dv(i,e,n,r,o);if(f!==void 0)d/=f;else if(u!==ec)return null;return Math.round(d*100)/100}function jv(e){const t=new Set;for(const n of e){const r=tc(Ni(n));r&&rs(n)!==r&&t.add(r)}return[...t]}function Iv(e,t){const n=rs(e);if(n===t)return!0;const r=tc(Ni(e));return r===t&&n!==r}function Mv(e,t,n,r,s){if(!Iv(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=Lv(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 Oi(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 ki(e){return ti.find(t=>t.mode===e)??ti[0]}function Ri(e){return ki(e).isMarket}function Mo(e,t){const n=ki(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 Ff(e){return e==="buy_stop_limit"||e==="sell_stop_limit"}const ft={GTC:0,TODAY:1,SPECIFIED:2,SPECIFIED_DAY:3},Uf=[{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 Fv(e){return e.map(t=>({login:t.login,label:t.label,balance:t.tradeStat.balance,currency:t.currency}))}function Uv(){if(typeof window>"u")return null;const e=localStorage.getItem(nu);return(e==null?void 0:e.trim())||null}function ml(e){if(typeof window>"u")return;const t=e.trim();t&&localStorage.setItem(nu,t)}function Bv(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=Ut){return t.find(n=>n.ticker===e)}function $v(e,t=Ut){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 Bf(e,t=Ut){const n=oc(e,t),r=(n==null?void 0:n.resolve_symbol)??e.replace(/_/g,"");return Ye(r).toUpperCase()}function Di(e,t=Ut){const n=oc(e,t);return n!=null&&n.resolve_symbol?n.resolve_symbol:e.replace(/_/g,"")}function $t(e){const t=Math.round(Math.log10(e));return String(Number.isFinite(t)&&t>0?t:5)}function Vt(e,t=Ut){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 $f(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 Vf(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:Vf(e,t,n)!==void 0}const Vv={},hl=e=>{let t;const n=new Set,r=(u,f)=>{const g=typeof u=="function"?u(t):u;if(!Object.is(g,t)){const m=t;t=f??(typeof g!="object"||g===null)?g:Object.assign({},t,g),n.forEach(h=>h(t,m))}},s=()=>t,l={setState:r,getState:s,getInitialState:()=>d,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(Vv?"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},Hv=e=>e?hl(e):hl;function zv(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var xs={exports:{}},io={},Ss={exports:{}},oo={};/**
|
|
41
|
+
`)},vy=0,zn=[];function wy(e){var t=w.useRef([]),n=w.useRef([0,0]),r=w.useRef(),s=w.useState(vy++)[0],i=w.useState(Au)[0],o=w.useRef(e);w.useEffect(function(){o.current=e},[e]),w.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var m=$g([e.lockRef.current],(e.shards||[]).map(dl),!0).filter(Boolean);return m.forEach(function(h){return h.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),m.forEach(function(h){return h.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var a=w.useCallback(function(m,h){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!o.current.allowPinchZoom;var b=Es(m),v=n.current,_="deltaX"in m?m.deltaX:v[0]-b[0],x="deltaY"in m?m.deltaY:v[1]-b[1],S,T=m.target,P=Math.abs(_)>Math.abs(x)?"h":"v";if("touches"in m&&P==="h"&&T.type==="range")return!1;var A=window.getSelection(),D=A&&A.anchorNode,I=D?D===T||D.contains(T):!1;if(I)return!1;var N=cl(P,T);if(!N)return!0;if(N?S=P:(S=P==="v"?"h":"v",N=cl(P,T)),!N)return!1;if(!r.current&&"changedTouches"in m&&(_||x)&&(r.current=S),!S)return!0;var L=r.current||S;return gy(L,h,m,L==="h"?_:x)},[]),l=w.useCallback(function(m){var h=m;if(!(!zn.length||zn[zn.length-1]!==i)){var b="deltaY"in h?ll(h):Es(h),v=t.current.filter(function(S){return S.name===h.type&&(S.target===h.target||h.target===S.shadowParent)&&yy(S.delta,b)})[0];if(v&&v.should){h.cancelable&&h.preventDefault();return}if(!v){var _=(o.current.shards||[]).map(dl).filter(Boolean).filter(function(S){return S.contains(h.target)}),x=_.length>0?a(h,_[0]):!o.current.noIsolation;x&&h.cancelable&&h.preventDefault()}}},[]),d=w.useCallback(function(m,h,b,v){var _={name:m,delta:h,target:b,should:v,shadowParent:_y(b)};t.current.push(_),setTimeout(function(){t.current=t.current.filter(function(x){return x!==_})},1)},[]),f=w.useCallback(function(m){n.current=Es(m),r.current=void 0},[]),u=w.useCallback(function(m){d(m.type,ll(m),m.target,a(m,e.lockRef.current))},[]),g=w.useCallback(function(m){d(m.type,Es(m),m.target,a(m,e.lockRef.current))},[]);w.useEffect(function(){return zn.push(i),e.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:g}),document.addEventListener("wheel",l,Hn),document.addEventListener("touchmove",l,Hn),document.addEventListener("touchstart",f,Hn),function(){zn=zn.filter(function(m){return m!==i}),document.removeEventListener("wheel",l,Hn),document.removeEventListener("touchmove",l,Hn),document.removeEventListener("touchstart",f,Hn)}},[]);var p=e.removeScrollBar,y=e.inert;return w.createElement(w.Fragment,null,y?w.createElement(i,{styles:by(s)}):null,p?w.createElement(ly,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function _y(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const xy=Yg(ku,wy);var Na=w.forwardRef(function(e,t){return w.createElement(Ci,kt({},e,{ref:t,sideCar:xy}))});Na.classNames=Ci.classNames;var Sy=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Wn=new WeakMap,Ps=new WeakMap,ks={},oo=0,Lu=function(e){return e&&(e.host||Lu(e.parentNode))},Cy=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Lu(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Ty=function(e,t,n,r){var s=Cy(t,Array.isArray(e)?e:[e]);ks[n]||(ks[n]=new WeakMap);var i=ks[n],o=[],a=new Set,l=new Set(s),d=function(u){!u||a.has(u)||(a.add(u),d(u.parentNode))};s.forEach(d);var f=function(u){!u||l.has(u)||Array.prototype.forEach.call(u.children,function(g){if(a.has(g))f(g);else try{var p=g.getAttribute(r),y=p!==null&&p!=="false",m=(Wn.get(g)||0)+1,h=(i.get(g)||0)+1;Wn.set(g,m),i.set(g,h),o.push(g),m===1&&y&&Ps.set(g,!0),h===1&&g.setAttribute(n,"true"),y||g.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",g,b)}})};return f(t),a.clear(),oo++,function(){o.forEach(function(u){var g=Wn.get(u)-1,p=i.get(u)-1;Wn.set(u,g),i.set(u,p),g||(Ps.has(u)||u.removeAttribute(r),Ps.delete(u)),p||u.removeAttribute(n)}),oo--,oo||(Wn=new WeakMap,Wn=new WeakMap,Ps=new WeakMap,ks={})}},Du=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=Sy(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),Ty(r,s,n,"aria-hidden")):function(){return null}},Ti="Dialog",[ju]=Bn(Ti),[Ey,wt]=ju(Ti),Iu=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:o=!0}=e,a=w.useRef(null),l=w.useRef(null),[d,f]=Ln({prop:r,defaultProp:s??!1,onChange:i,caller:Ti});return c.jsx(Ey,{scope:t,triggerRef:a,contentRef:l,contentId:on(),titleId:on(),descriptionId:on(),open:d,onOpenChange:f,onOpenToggle:w.useCallback(()=>f(u=>!u),[f]),modal:o,children:n})};Iu.displayName=Ti;var Mu="DialogTrigger",Py=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=wt(Mu,n),i=Oe(t,s.triggerRef);return c.jsx(he.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":Ma(s.open),...r,ref:i,onClick:me(e.onClick,s.onOpenToggle)})});Py.displayName=Mu;var Ra="DialogPortal",[ky,Fu]=ju(Ra,{forceMount:void 0}),Uu=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,i=wt(Ra,t);return c.jsx(ky,{scope:t,forceMount:n,children:w.Children.map(r,o=>c.jsx($n,{present:n||i.open,children:c.jsx(Si,{asChild:!0,container:s,children:o})}))})};Uu.displayName=Ra;var Xs="DialogOverlay",La=w.forwardRef((e,t)=>{const n=Fu(Xs,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=wt(Xs,e.__scopeDialog);return i.modal?c.jsx($n,{present:r||i.open,children:c.jsx(Oy,{...s,ref:t})}):null});La.displayName=Xs;var Ay=mr("DialogOverlay.RemoveScroll"),Oy=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=wt(Xs,n),i=Cg(),o=Oe(t,i);return c.jsx(Na,{as:Ay,allowPinchZoom:!0,shards:[s.contentRef],children:c.jsx(he.div,{"data-state":Ma(s.open),...r,ref:o,style:{pointerEvents:"auto",...r.style}})})}),pr="DialogContent",Da=w.forwardRef((e,t)=>{const n=Fu(pr,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=wt(pr,e.__scopeDialog);return c.jsx($n,{present:r||i.open,children:i.modal?c.jsx(Ny,{...s,ref:t}):c.jsx(Ry,{...s,ref:t})})});Da.displayName=pr;var Ny=w.forwardRef((e,t)=>{const n=wt(pr,e.__scopeDialog),r=w.useRef(null),s=Oe(t,n.contentRef,r);return w.useEffect(()=>{const i=r.current;if(i)return Du(i)},[]),c.jsx(Bu,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:me(e.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:me(e.onPointerDownOutside,i=>{const o=i.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&i.preventDefault()}),onFocusOutside:me(e.onFocusOutside,i=>i.preventDefault())})}),Ry=w.forwardRef((e,t)=>{const n=wt(pr,e.__scopeDialog),r=w.useRef(!1),s=w.useRef(!1);return c.jsx(Bu,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,a;(o=e.onCloseAutoFocus)==null||o.call(e,i),i.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{var l,d;(l=e.onInteractOutside)==null||l.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=i.target;((d=n.triggerRef.current)==null?void 0:d.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),Bu=w.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,...o}=e,a=wt(pr,n);return Tu(),c.jsx(c.Fragment,{children:c.jsx(Oa,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:c.jsx(xi,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":Ma(a.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>a.onOpenChange(!1)})})})}),$u="DialogTitle",ja=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=wt($u,n);return c.jsx(he.h2,{id:s.titleId,...r,ref:t})});ja.displayName=$u;var Vu="DialogDescription",Ia=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=wt(Vu,n);return c.jsx(he.p,{id:s.descriptionId,...r,ref:t})});Ia.displayName=Vu;var Hu="DialogClose",Ly=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=wt(Hu,n);return c.jsx(he.button,{type:"button",...r,ref:t,onClick:me(e.onClick,()=>s.onOpenChange(!1))})});Ly.displayName=Hu;function Ma(e){return e?"open":"closed"}const Dy=Iu,jy=Uu,zu=w.forwardRef(({className:e,...t},n)=>c.jsx(La,{ref:n,className:Te("bg-background/80 fixed inset-0 z-50 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));zu.displayName=La.displayName;const Wu=w.forwardRef(({className:e,overlayClass:t,children:n,...r},s)=>c.jsxs(jy,{children:[c.jsx(zu,{className:t}),c.jsx(Da,{ref:s,className:Te("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-2xl md:w-full",e),...r,children:n})]}));Wu.displayName=Da.displayName;const Ku=({className:e,...t})=>c.jsx("div",{className:Te("flex flex-col space-y-1.5 border-b text-center sm:text-left",e),...t});Ku.displayName="DialogHeader";const qu=({className:e,...t})=>c.jsx("div",{className:Te("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});qu.displayName="DialogFooter";const Gu=w.forwardRef(({className:e,...t},n)=>c.jsx(ja,{ref:n,className:Te("text-lg font-semibold leading-none tracking-tight",e),...t}));Gu.displayName=ja.displayName;const Zu=w.forwardRef(({className:e,...t},n)=>c.jsx(Ia,{ref:n,className:Te("text-sm text-muted-foreground",e),...t}));Zu.displayName=Ia.displayName;function ul(e,[t,n]){return Math.min(n,Math.max(t,e))}function Fa(e){const t=e+"CollectionProvider",[n,r]=Bn(t),[s,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=m=>{const{scope:h,children:b}=m,v=w.useRef(null),_=w.useRef(new Map).current;return c.jsx(s,{scope:h,itemMap:_,collectionRef:v,children:b})};o.displayName=t;const a=e+"CollectionSlot",l=mr(a),d=w.forwardRef((m,h)=>{const{scope:b,children:v}=m,_=i(a,b),x=Oe(h,_.collectionRef);return c.jsx(l,{ref:x,children:v})});d.displayName=a;const f=e+"CollectionItemSlot",u="data-radix-collection-item",g=mr(f),p=w.forwardRef((m,h)=>{const{scope:b,children:v,..._}=m,x=w.useRef(null),S=Oe(h,x),T=i(f,b);return w.useEffect(()=>(T.itemMap.set(x,{ref:x,..._}),()=>void T.itemMap.delete(x))),c.jsx(g,{[u]:"",ref:S,children:v})});p.displayName=f;function y(m){const h=i(e+"CollectionConsumer",m);return w.useCallback(()=>{const v=h.collectionRef.current;if(!v)return[];const _=Array.from(v.querySelectorAll(`[${u}]`));return Array.from(h.itemMap.values()).sort((T,P)=>_.indexOf(T.ref.current)-_.indexOf(P.ref.current))},[h.collectionRef,h.itemMap])}return[{Provider:o,Slot:d,ItemSlot:p},y,r]}var Iy=w.createContext(void 0);function Yu(e){const t=w.useContext(Iy);return e||t||"ltr"}const My=["top","right","bottom","left"],ln=Math.min,nt=Math.max,Js=Math.round,As=Math.floor,Ot=e=>({x:e,y:e}),Fy={left:"right",right:"left",bottom:"top",top:"bottom"};function Do(e,t,n){return nt(e,ln(t,n))}function Mt(e,t){return typeof e=="function"?e(t):e}function Ft(e){return e.split("-")[0]}function Tr(e){return e.split("-")[1]}function Ua(e){return e==="x"?"y":"x"}function Ba(e){return e==="y"?"height":"width"}function At(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function $a(e){return Ua(At(e))}function Uy(e,t,n){n===void 0&&(n=!1);const r=Tr(e),s=$a(e),i=Ba(s);let o=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(o=ei(o)),[o,ei(o)]}function By(e){const t=ei(e);return[jo(e),t,jo(t)]}function jo(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const fl=["left","right"],ml=["right","left"],$y=["top","bottom"],Vy=["bottom","top"];function Hy(e,t,n){switch(e){case"top":case"bottom":return n?t?ml:fl:t?fl:ml;case"left":case"right":return t?$y:Vy;default:return[]}}function zy(e,t,n,r){const s=Tr(e);let i=Hy(Ft(e),n==="start",r);return s&&(i=i.map(o=>o+"-"+s),t&&(i=i.concat(i.map(jo)))),i}function ei(e){const t=Ft(e);return Fy[t]+e.slice(t.length)}function Wy(e){return{top:0,right:0,bottom:0,left:0,...e}}function Qu(e){return typeof e!="number"?Wy(e):{top:e,right:e,bottom:e,left:e}}function ti(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function pl(e,t,n){let{reference:r,floating:s}=e;const i=At(t),o=$a(t),a=Ba(o),l=Ft(t),d=i==="y",f=r.x+r.width/2-s.width/2,u=r.y+r.height/2-s.height/2,g=r[a]/2-s[a]/2;let p;switch(l){case"top":p={x:f,y:r.y-s.height};break;case"bottom":p={x:f,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:u};break;case"left":p={x:r.x-s.width,y:u};break;default:p={x:r.x,y:r.y}}switch(Tr(t)){case"start":p[o]-=g*(n&&d?-1:1);break;case"end":p[o]+=g*(n&&d?-1:1);break}return p}async function Ky(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:i,rects:o,elements:a,strategy:l}=e,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:g=!1,padding:p=0}=Mt(t,e),y=Qu(p),h=a[g?u==="floating"?"reference":"floating":u],b=ti(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(h)))==null||n?h:h.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:d,rootBoundary:f,strategy:l})),v=u==="floating"?{x:r,y:s,width:o.floating.width,height:o.floating.height}:o.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),x=await(i.isElement==null?void 0:i.isElement(_))?await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1}:{x:1,y:1},S=ti(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:_,strategy:l}):v);return{top:(b.top-S.top+y.top)/x.y,bottom:(S.bottom-b.bottom+y.bottom)/x.y,left:(b.left-S.left+y.left)/x.x,right:(S.right-b.right+y.right)/x.x}}const qy=50,Gy=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:o}=n,a=o.detectOverflow?o:{...o,detectOverflow:Ky},l=await(o.isRTL==null?void 0:o.isRTL(t));let d=await o.getElementRects({reference:e,floating:t,strategy:s}),{x:f,y:u}=pl(d,r,l),g=r,p=0;const y={};for(let m=0;m<i.length;m++){const h=i[m];if(!h)continue;const{name:b,fn:v}=h,{x:_,y:x,data:S,reset:T}=await v({x:f,y:u,initialPlacement:r,placement:g,strategy:s,middlewareData:y,rects:d,platform:a,elements:{reference:e,floating:t}});f=_??f,u=x??u,y[b]={...y[b],...S},T&&p<qy&&(p++,typeof T=="object"&&(T.placement&&(g=T.placement),T.rects&&(d=T.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:s}):T.rects),{x:f,y:u}=pl(d,g,l)),m=-1)}return{x:f,y:u,placement:g,strategy:s,middlewareData:y}},Zy=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:i,platform:o,elements:a,middlewareData:l}=t,{element:d,padding:f=0}=Mt(e,t)||{};if(d==null)return{};const u=Qu(f),g={x:n,y:r},p=$a(s),y=Ba(p),m=await o.getDimensions(d),h=p==="y",b=h?"top":"left",v=h?"bottom":"right",_=h?"clientHeight":"clientWidth",x=i.reference[y]+i.reference[p]-g[p]-i.floating[y],S=g[p]-i.reference[p],T=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let P=T?T[_]:0;(!P||!await(o.isElement==null?void 0:o.isElement(T)))&&(P=a.floating[_]||i.floating[y]);const A=x/2-S/2,D=P/2-m[y]/2-1,I=ln(u[b],D),N=ln(u[v],D),L=I,H=P-m[y]-N,R=P/2-m[y]/2+A,F=Do(L,R,H),M=!l.arrow&&Tr(s)!=null&&R!==F&&i.reference[y]/2-(R<L?I:N)-m[y]/2<0,$=M?R<L?R-L:R-H:0;return{[p]:g[p]+$,data:{[p]:F,centerOffset:R-F-$,...M&&{alignmentOffset:$}},reset:M}}}),Yy=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:i,rects:o,initialPlacement:a,platform:l,elements:d}=t,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:g,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:m=!0,...h}=Mt(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const b=Ft(s),v=At(a),_=Ft(a)===a,x=await(l.isRTL==null?void 0:l.isRTL(d.floating)),S=g||(_||!m?[ei(a)]:By(a)),T=y!=="none";!g&&T&&S.push(...zy(a,m,y,x));const P=[a,...S],A=await l.detectOverflow(t,h),D=[];let I=((r=i.flip)==null?void 0:r.overflows)||[];if(f&&D.push(A[b]),u){const R=Uy(s,o,x);D.push(A[R[0]],A[R[1]])}if(I=[...I,{placement:s,overflows:D}],!D.every(R=>R<=0)){var N,L;const R=(((N=i.flip)==null?void 0:N.index)||0)+1,F=P[R];if(F&&(!(u==="alignment"?v!==At(F):!1)||I.every(O=>At(O.placement)===v?O.overflows[0]>0:!0)))return{data:{index:R,overflows:I},reset:{placement:F}};let M=(L=I.filter($=>$.overflows[0]<=0).sort(($,O)=>$.overflows[1]-O.overflows[1])[0])==null?void 0:L.placement;if(!M)switch(p){case"bestFit":{var H;const $=(H=I.filter(O=>{if(T){const U=At(O.placement);return U===v||U==="y"}return!0}).map(O=>[O.placement,O.overflows.filter(U=>U>0).reduce((U,W)=>U+W,0)]).sort((O,U)=>O[1]-U[1])[0])==null?void 0:H[0];$&&(M=$);break}case"initialPlacement":M=a;break}if(s!==M)return{reset:{placement:M}}}return{}}}};function hl(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function gl(e){return My.some(t=>e[t]>=0)}const Qy=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:s="referenceHidden",...i}=Mt(e,t);switch(s){case"referenceHidden":{const o=await r.detectOverflow(t,{...i,elementContext:"reference"}),a=hl(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:gl(a)}}}case"escaped":{const o=await r.detectOverflow(t,{...i,altBoundary:!0}),a=hl(o,n.floating);return{data:{escapedOffsets:a,escaped:gl(a)}}}default:return{}}}}},Xu=new Set(["left","top"]);async function Xy(e,t){const{placement:n,platform:r,elements:s}=e,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=Ft(n),a=Tr(n),l=At(n)==="y",d=Xu.has(o)?-1:1,f=i&&l?-1:1,u=Mt(t,e);let{mainAxis:g,crossAxis:p,alignmentAxis:y}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&typeof y=="number"&&(p=a==="end"?y*-1:y),l?{x:p*f,y:g*d}:{x:g*d,y:p*f}}const Jy=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:i,placement:o,middlewareData:a}=t,l=await Xy(t,e);return o===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:s+l.x,y:i+l.y,data:{...l,placement:o}}}}},eb=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:i}=t,{mainAxis:o=!0,crossAxis:a=!1,limiter:l={fn:b=>{let{x:v,y:_}=b;return{x:v,y:_}}},...d}=Mt(e,t),f={x:n,y:r},u=await i.detectOverflow(t,d),g=At(Ft(s)),p=Ua(g);let y=f[p],m=f[g];if(o){const b=p==="y"?"top":"left",v=p==="y"?"bottom":"right",_=y+u[b],x=y-u[v];y=Do(_,y,x)}if(a){const b=g==="y"?"top":"left",v=g==="y"?"bottom":"right",_=m+u[b],x=m-u[v];m=Do(_,m,x)}const h=l.fn({...t,[p]:y,[g]:m});return{...h,data:{x:h.x-n,y:h.y-r,enabled:{[p]:o,[g]:a}}}}}},tb=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:i,middlewareData:o}=t,{offset:a=0,mainAxis:l=!0,crossAxis:d=!0}=Mt(e,t),f={x:n,y:r},u=At(s),g=Ua(u);let p=f[g],y=f[u];const m=Mt(a,t),h=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const _=g==="y"?"height":"width",x=i.reference[g]-i.floating[_]+h.mainAxis,S=i.reference[g]+i.reference[_]-h.mainAxis;p<x?p=x:p>S&&(p=S)}if(d){var b,v;const _=g==="y"?"width":"height",x=Xu.has(Ft(s)),S=i.reference[u]-i.floating[_]+(x&&((b=o.offset)==null?void 0:b[u])||0)+(x?0:h.crossAxis),T=i.reference[u]+i.reference[_]+(x?0:((v=o.offset)==null?void 0:v[u])||0)-(x?h.crossAxis:0);y<S?y=S:y>T&&(y=T)}return{[g]:p,[u]:y}}}},nb=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:i,platform:o,elements:a}=t,{apply:l=()=>{},...d}=Mt(e,t),f=await o.detectOverflow(t,d),u=Ft(s),g=Tr(s),p=At(s)==="y",{width:y,height:m}=i.floating;let h,b;u==="top"||u==="bottom"?(h=u,b=g===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(b=u,h=g==="end"?"top":"bottom");const v=m-f.top-f.bottom,_=y-f.left-f.right,x=ln(m-f[h],v),S=ln(y-f[b],_),T=!t.middlewareData.shift;let P=x,A=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(A=_),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(P=v),T&&!g){const I=nt(f.left,0),N=nt(f.right,0),L=nt(f.top,0),H=nt(f.bottom,0);p?A=y-2*(I!==0||N!==0?I+N:nt(f.left,f.right)):P=m-2*(L!==0||H!==0?L+H:nt(f.top,f.bottom))}await l({...t,availableWidth:A,availableHeight:P});const D=await o.getDimensions(a.floating);return y!==D.width||m!==D.height?{reset:{rects:!0}}:{}}}};function Ei(){return typeof window<"u"}function Er(e){return Ju(e)?(e.nodeName||"").toLowerCase():"#document"}function rt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Rt(e){var t;return(t=(Ju(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Ju(e){return Ei()?e instanceof Node||e instanceof rt(e).Node:!1}function bt(e){return Ei()?e instanceof Element||e instanceof rt(e).Element:!1}function $t(e){return Ei()?e instanceof HTMLElement||e instanceof rt(e).HTMLElement:!1}function yl(e){return!Ei()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof rt(e).ShadowRoot}function os(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=vt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function rb(e){return/^(table|td|th)$/.test(Er(e))}function Pi(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const sb=/transform|translate|scale|rotate|perspective|filter/,ib=/paint|layout|strict|content/,yn=e=>!!e&&e!=="none";let ao;function Va(e){const t=bt(e)?vt(e):e;return yn(t.transform)||yn(t.translate)||yn(t.scale)||yn(t.rotate)||yn(t.perspective)||!Ha()&&(yn(t.backdropFilter)||yn(t.filter))||sb.test(t.willChange||"")||ib.test(t.contain||"")}function ob(e){let t=dn(e);for(;$t(t)&&!hr(t);){if(Va(t))return t;if(Pi(t))return null;t=dn(t)}return null}function Ha(){return ao==null&&(ao=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),ao}function hr(e){return/^(html|body|#document)$/.test(Er(e))}function vt(e){return rt(e).getComputedStyle(e)}function ki(e){return bt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function dn(e){if(Er(e)==="html")return e;const t=e.assignedSlot||e.parentNode||yl(e)&&e.host||Rt(e);return yl(t)?t.host:t}function ef(e){const t=dn(e);return hr(t)?e.ownerDocument?e.ownerDocument.body:e.body:$t(t)&&os(t)?t:ef(t)}function Wr(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=ef(e),i=s===((r=e.ownerDocument)==null?void 0:r.body),o=rt(s);if(i){const a=Io(o);return t.concat(o,o.visualViewport||[],os(s)?s:[],a&&n?Wr(a):[])}else return t.concat(s,Wr(s,[],n))}function Io(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function tf(e){const t=vt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=$t(e),i=s?e.offsetWidth:n,o=s?e.offsetHeight:r,a=Js(n)!==i||Js(r)!==o;return a&&(n=i,r=o),{width:n,height:r,$:a}}function za(e){return bt(e)?e:e.contextElement}function Jn(e){const t=za(e);if(!$t(t))return Ot(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:i}=tf(t);let o=(i?Js(n.width):n.width)/r,a=(i?Js(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const ab=Ot(0);function nf(e){const t=rt(e);return!Ha()||!t.visualViewport?ab:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function cb(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==rt(e)?!1:t}function Dn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=za(e);let o=Ot(1);t&&(r?bt(r)&&(o=Jn(r)):o=Jn(e));const a=cb(i,n,r)?nf(i):Ot(0);let l=(s.left+a.x)/o.x,d=(s.top+a.y)/o.y,f=s.width/o.x,u=s.height/o.y;if(i){const g=rt(i),p=r&&bt(r)?rt(r):r;let y=g,m=Io(y);for(;m&&r&&p!==y;){const h=Jn(m),b=m.getBoundingClientRect(),v=vt(m),_=b.left+(m.clientLeft+parseFloat(v.paddingLeft))*h.x,x=b.top+(m.clientTop+parseFloat(v.paddingTop))*h.y;l*=h.x,d*=h.y,f*=h.x,u*=h.y,l+=_,d+=x,y=rt(m),m=Io(y)}}return ti({width:f,height:u,x:l,y:d})}function Ai(e,t){const n=ki(e).scrollLeft;return t?t.left+n:Dn(Rt(e)).left+n}function rf(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Ai(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function lb(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const i=s==="fixed",o=Rt(r),a=t?Pi(t.floating):!1;if(r===o||a&&i)return n;let l={scrollLeft:0,scrollTop:0},d=Ot(1);const f=Ot(0),u=$t(r);if((u||!u&&!i)&&((Er(r)!=="body"||os(o))&&(l=ki(r)),u)){const p=Dn(r);d=Jn(r),f.x=p.x+r.clientLeft,f.y=p.y+r.clientTop}const g=o&&!u&&!i?rf(o,l):Ot(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-l.scrollLeft*d.x+f.x+g.x,y:n.y*d.y-l.scrollTop*d.y+f.y+g.y}}function db(e){return Array.from(e.getClientRects())}function ub(e){const t=Rt(e),n=ki(e),r=e.ownerDocument.body,s=nt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=nt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+Ai(e);const a=-n.scrollTop;return vt(r).direction==="rtl"&&(o+=nt(t.clientWidth,r.clientWidth)-s),{width:s,height:i,x:o,y:a}}const bl=25;function fb(e,t){const n=rt(e),r=Rt(e),s=n.visualViewport;let i=r.clientWidth,o=r.clientHeight,a=0,l=0;if(s){i=s.width,o=s.height;const f=Ha();(!f||f&&t==="fixed")&&(a=s.offsetLeft,l=s.offsetTop)}const d=Ai(r);if(d<=0){const f=r.ownerDocument,u=f.body,g=getComputedStyle(u),p=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,y=Math.abs(r.clientWidth-u.clientWidth-p);y<=bl&&(i-=y)}else d<=bl&&(i+=d);return{width:i,height:o,x:a,y:l}}function mb(e,t){const n=Dn(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,i=$t(e)?Jn(e):Ot(1),o=e.clientWidth*i.x,a=e.clientHeight*i.y,l=s*i.x,d=r*i.y;return{width:o,height:a,x:l,y:d}}function vl(e,t,n){let r;if(t==="viewport")r=fb(e,n);else if(t==="document")r=ub(Rt(e));else if(bt(t))r=mb(t,n);else{const s=nf(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return ti(r)}function sf(e,t){const n=dn(e);return n===t||!bt(n)||hr(n)?!1:vt(n).position==="fixed"||sf(n,t)}function pb(e,t){const n=t.get(e);if(n)return n;let r=Wr(e,[],!1).filter(a=>bt(a)&&Er(a)!=="body"),s=null;const i=vt(e).position==="fixed";let o=i?dn(e):e;for(;bt(o)&&!hr(o);){const a=vt(o),l=Va(o);!l&&a.position==="fixed"&&(s=null),(i?!l&&!s:!l&&a.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||os(o)&&!l&&sf(e,o))?r=r.filter(f=>f!==o):s=a,o=dn(o)}return t.set(e,r),r}function hb(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const o=[...n==="clippingAncestors"?Pi(t)?[]:pb(t,this._c):[].concat(n),r],a=vl(t,o[0],s);let l=a.top,d=a.right,f=a.bottom,u=a.left;for(let g=1;g<o.length;g++){const p=vl(t,o[g],s);l=nt(p.top,l),d=ln(p.right,d),f=ln(p.bottom,f),u=nt(p.left,u)}return{width:d-u,height:f-l,x:u,y:l}}function gb(e){const{width:t,height:n}=tf(e);return{width:t,height:n}}function yb(e,t,n){const r=$t(t),s=Rt(t),i=n==="fixed",o=Dn(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=Ot(0);function d(){l.x=Ai(s)}if(r||!r&&!i)if((Er(t)!=="body"||os(s))&&(a=ki(t)),r){const p=Dn(t,!0,i,t);l.x=p.x+t.clientLeft,l.y=p.y+t.clientTop}else s&&d();i&&!r&&s&&d();const f=s&&!r&&!i?rf(s,a):Ot(0),u=o.left+a.scrollLeft-l.x-f.x,g=o.top+a.scrollTop-l.y-f.y;return{x:u,y:g,width:o.width,height:o.height}}function co(e){return vt(e).position==="static"}function wl(e,t){if(!$t(e)||vt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Rt(e)===n&&(n=n.ownerDocument.body),n}function of(e,t){const n=rt(e);if(Pi(e))return n;if(!$t(e)){let s=dn(e);for(;s&&!hr(s);){if(bt(s)&&!co(s))return s;s=dn(s)}return n}let r=wl(e,t);for(;r&&rb(r)&&co(r);)r=wl(r,t);return r&&hr(r)&&co(r)&&!Va(r)?n:r||ob(e)||n}const bb=async function(e){const t=this.getOffsetParent||of,n=this.getDimensions,r=await n(e.floating);return{reference:yb(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function vb(e){return vt(e).direction==="rtl"}const wb={convertOffsetParentRelativeRectToViewportRelativeRect:lb,getDocumentElement:Rt,getClippingRect:hb,getOffsetParent:of,getElementRects:bb,getClientRects:db,getDimensions:gb,getScale:Jn,isElement:bt,isRTL:vb};function af(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function _b(e,t){let n=null,r;const s=Rt(e);function i(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),i();const d=e.getBoundingClientRect(),{left:f,top:u,width:g,height:p}=d;if(a||t(),!g||!p)return;const y=As(u),m=As(s.clientWidth-(f+g)),h=As(s.clientHeight-(u+p)),b=As(f),_={rootMargin:-y+"px "+-m+"px "+-h+"px "+-b+"px",threshold:nt(0,ln(1,l))||1};let x=!0;function S(T){const P=T[0].intersectionRatio;if(P!==l){if(!x)return o();P?o(!1,P):r=setTimeout(()=>{o(!1,1e-7)},1e3)}P===1&&!af(d,e.getBoundingClientRect())&&o(),x=!1}try{n=new IntersectionObserver(S,{..._,root:s.ownerDocument})}catch{n=new IntersectionObserver(S,_)}n.observe(e)}return o(!0),i}function xb(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,d=za(e),f=s||i?[...d?Wr(d):[],...t?Wr(t):[]]:[];f.forEach(b=>{s&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const u=d&&a?_b(d,n):null;let g=-1,p=null;o&&(p=new ResizeObserver(b=>{let[v]=b;v&&v.target===d&&p&&t&&(p.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var _;(_=p)==null||_.observe(t)})),n()}),d&&!l&&p.observe(d),t&&p.observe(t));let y,m=l?Dn(e):null;l&&h();function h(){const b=Dn(e);m&&!af(m,b)&&n(),m=b,y=requestAnimationFrame(h)}return n(),()=>{var b;f.forEach(v=>{s&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),u==null||u(),(b=p)==null||b.disconnect(),p=null,l&&cancelAnimationFrame(y)}}const Sb=Jy,Cb=eb,Tb=Yy,Eb=nb,Pb=Qy,_l=Zy,kb=tb,Ab=(e,t,n)=>{const r=new Map,s={platform:wb,...n},i={...s.platform,_c:r};return Gy(e,t,{...s,platform:i})};var Ob=typeof document<"u",Nb=function(){},Hs=Ob?C.useLayoutEffect:Nb;function ni(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!ni(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const i=s[r];if(!(i==="_owner"&&e.$$typeof)&&!ni(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function cf(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function xl(e,t){const n=cf(e);return Math.round(t*n)/n}function lo(e){const t=w.useRef(e);return Hs(()=>{t.current=e}),t}function Rb(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:i,floating:o}={},transform:a=!0,whileElementsMounted:l,open:d}=e,[f,u]=w.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,p]=w.useState(r);ni(g,r)||p(r);const[y,m]=w.useState(null),[h,b]=w.useState(null),v=w.useCallback(O=>{O!==T.current&&(T.current=O,m(O))},[]),_=w.useCallback(O=>{O!==P.current&&(P.current=O,b(O))},[]),x=i||y,S=o||h,T=w.useRef(null),P=w.useRef(null),A=w.useRef(f),D=l!=null,I=lo(l),N=lo(s),L=lo(d),H=w.useCallback(()=>{if(!T.current||!P.current)return;const O={placement:t,strategy:n,middleware:g};N.current&&(O.platform=N.current),Ab(T.current,P.current,O).then(U=>{const W={...U,isPositioned:L.current!==!1};R.current&&!ni(A.current,W)&&(A.current=W,Cr.flushSync(()=>{u(W)}))})},[g,t,n,N,L]);Hs(()=>{d===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,u(O=>({...O,isPositioned:!1})))},[d]);const R=w.useRef(!1);Hs(()=>(R.current=!0,()=>{R.current=!1}),[]),Hs(()=>{if(x&&(T.current=x),S&&(P.current=S),x&&S){if(I.current)return I.current(x,S,H);H()}},[x,S,H,I,D]);const F=w.useMemo(()=>({reference:T,floating:P,setReference:v,setFloating:_}),[v,_]),M=w.useMemo(()=>({reference:x,floating:S}),[x,S]),$=w.useMemo(()=>{const O={position:n,left:0,top:0};if(!M.floating)return O;const U=xl(M.floating,f.x),W=xl(M.floating,f.y);return a?{...O,transform:"translate("+U+"px, "+W+"px)",...cf(M.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:U,top:W}},[n,a,M.floating,f.x,f.y]);return w.useMemo(()=>({...f,update:H,refs:F,elements:M,floatingStyles:$}),[f,H,F,M,$])}const Lb=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?_l({element:r.current,padding:s}).fn(n):{}:r?_l({element:r,padding:s}).fn(n):{}}}},Db=(e,t)=>{const n=Sb(e);return{name:n.name,fn:n.fn,options:[e,t]}},jb=(e,t)=>{const n=Cb(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ib=(e,t)=>({fn:kb(e).fn,options:[e,t]}),Mb=(e,t)=>{const n=Tb(e);return{name:n.name,fn:n.fn,options:[e,t]}},Fb=(e,t)=>{const n=Eb(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ub=(e,t)=>{const n=Pb(e);return{name:n.name,fn:n.fn,options:[e,t]}},Bb=(e,t)=>{const n=Lb(e);return{name:n.name,fn:n.fn,options:[e,t]}};var $b="Arrow",lf=w.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...i}=e;return c.jsx(he.svg,{...i,ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:c.jsx("polygon",{points:"0,0 30,0 15,10"})})});lf.displayName=$b;var Vb=lf;function Hb(e){const[t,n]=w.useState(void 0);return Ie(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const i=s[0];let o,a;if("borderBoxSize"in i){const l=i.borderBoxSize,d=Array.isArray(l)?l[0]:l;o=d.inlineSize,a=d.blockSize}else o=e.offsetWidth,a=e.offsetHeight;n({width:o,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var Wa="Popper",[df,uf]=Bn(Wa),[zb,ff]=df(Wa),mf=e=>{const{__scopePopper:t,children:n}=e,[r,s]=w.useState(null),[i,o]=w.useState(void 0);return c.jsx(zb,{scope:t,anchor:r,onAnchorChange:s,placementState:i,setPlacementState:o,children:n})};mf.displayName=Wa;var pf="PopperAnchor",hf=w.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,i=ff(pf,n),o=w.useRef(null),a=i.onAnchorChange,l=w.useCallback(y=>{o.current=y,y&&a(y)},[a]),d=Oe(t,l),f=w.useRef(null);w.useEffect(()=>{if(!r)return;const y=f.current;f.current=r.current,y!==f.current&&a(f.current)});const u=i.placementState&&qa(i.placementState),g=u==null?void 0:u[0],p=u==null?void 0:u[1];return r?null:c.jsx(he.div,{"data-radix-popper-side":g,"data-radix-popper-align":p,...s,ref:d})});hf.displayName=pf;var Ka="PopperContent",[Wb,Kb]=df(Ka),gf=w.forwardRef((e,t)=>{var se,Ee,le,oe,B,ve;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:i="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:d=[],collisionPadding:f=0,sticky:u="partial",hideWhenDetached:g=!1,updatePositionStrategy:p="optimized",onPlaced:y,...m}=e,h=ff(Ka,n),[b,v]=w.useState(null),_=Oe(t,ke=>v(ke)),[x,S]=w.useState(null),T=Hb(x),P=(T==null?void 0:T.width)??0,A=(T==null?void 0:T.height)??0,D=r+(i!=="center"?"-"+i:""),I=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},N=Array.isArray(d)?d:[d],L=N.length>0,H={padding:I,boundary:N.filter(Gb),altBoundary:L},{refs:R,floatingStyles:F,placement:M,isPositioned:$,middlewareData:O}=Rb({strategy:"fixed",placement:D,whileElementsMounted:(...ke)=>xb(...ke,{animationFrame:p==="always"}),elements:{reference:h.anchor},middleware:[Db({mainAxis:s+A,alignmentAxis:o}),l&&jb({mainAxis:!0,crossAxis:!1,limiter:u==="partial"?Ib():void 0,...H}),l&&Mb({...H}),Fb({...H,apply:({elements:ke,rects:Pe,availableWidth:X,availableHeight:Ne})=>{const{width:Be,height:Xe}=Pe.reference,ft=ke.floating.style;ft.setProperty("--radix-popper-available-width",`${X}px`),ft.setProperty("--radix-popper-available-height",`${Ne}px`),ft.setProperty("--radix-popper-anchor-width",`${Be}px`),ft.setProperty("--radix-popper-anchor-height",`${Xe}px`)}}),x&&Bb({element:x,padding:a}),Zb({arrowWidth:P,arrowHeight:A}),g&&Ub({strategy:"referenceHidden",...H,boundary:L?H.boundary:void 0})]}),U=h.setPlacementState;Ie(()=>(U(M),()=>{U(void 0)}),[M,U]);const[W,j]=qa(M),ee=yt(y);Ie(()=>{$&&(ee==null||ee())},[$,ee]);const J=(se=O.arrow)==null?void 0:se.x,de=(Ee=O.arrow)==null?void 0:Ee.y,ue=((le=O.arrow)==null?void 0:le.centerOffset)!==0,[V,K]=w.useState();return Ie(()=>{b&&K(window.getComputedStyle(b).zIndex)},[b]),c.jsx("div",{ref:R.setFloating,"data-radix-popper-content-wrapper":"",style:{...F,transform:$?F.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:V,"--radix-popper-transform-origin":[(oe=O.transformOrigin)==null?void 0:oe.x,(B=O.transformOrigin)==null?void 0:B.y].join(" "),...((ve=O.hide)==null?void 0:ve.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:c.jsx(Wb,{scope:n,placedSide:W,placedAlign:j,onArrowChange:S,arrowX:J,arrowY:de,shouldHideArrow:ue,children:c.jsx(he.div,{"data-side":W,"data-align":j,...m,ref:_,style:{...m.style,animation:$?void 0:"none"}})})})});gf.displayName=Ka;var yf="PopperArrow",qb={top:"bottom",right:"left",bottom:"top",left:"right"},bf=w.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,i=Kb(yf,r),o=qb[i.placedSide];return c.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:c.jsx(Vb,{...s,ref:n,style:{...s.style,display:"block"}})})});bf.displayName=yf;function Gb(e){return e!==null}var Zb=e=>({name:"transformOrigin",options:e,fn(t){var h,b,v;const{placement:n,rects:r,middlewareData:s}=t,o=((h=s.arrow)==null?void 0:h.centerOffset)!==0,a=o?0:e.arrowWidth,l=o?0:e.arrowHeight,[d,f]=qa(n),u={start:"0%",center:"50%",end:"100%"}[f],g=(((b=s.arrow)==null?void 0:b.x)??0)+a/2,p=(((v=s.arrow)==null?void 0:v.y)??0)+l/2;let y="",m="";return d==="bottom"?(y=o?u:`${g}px`,m=`${-l}px`):d==="top"?(y=o?u:`${g}px`,m=`${r.floating.height+l}px`):d==="right"?(y=`${-l}px`,m=o?u:`${p}px`):d==="left"&&(y=`${r.floating.width+l}px`,m=o?u:`${p}px`),{data:{x:y,y:m}}}});function qa(e){const[t,n="center"]=e.split("-");return[t,n]}var Yb=mf,Qb=hf,Xb=gf,Jb=bf;function ev(e){const t=w.useRef({value:e,previous:e});return w.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var vf=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),tv="VisuallyHidden",Ga=w.forwardRef((e,t)=>c.jsx(he.span,{...e,ref:t,style:{...vf,...e.style}}));Ga.displayName=tv;var nv=[" ","Enter","ArrowUp","ArrowDown"],rv=[" ","Enter"],jn="Select",[Oi,Ni,sv]=Fa(jn),[Vn]=Bn(jn,[sv,uf]),Ri=uf(),[iv,pn]=Vn(jn),[ov,av]=Vn(jn),cv="SelectProvider";function wf(e){const{__scopeSelect:t,children:n,open:r,defaultOpen:s,onOpenChange:i,value:o,defaultValue:a,onValueChange:l,dir:d,name:f,autoComplete:u,disabled:g,required:p,form:y,internal_do_not_use_render:m}=e,h=Ri(t),[b,v]=w.useState(null),[_,x]=w.useState(null),[S,T]=w.useState(!1),P=Yu(d),[A,D]=Ln({prop:r,defaultProp:s??!1,onChange:i,caller:jn}),[I,N]=Ln({prop:o,defaultProp:a,onChange:l,caller:jn}),L=w.useRef(null),H=b?!!y||!!b.closest("form"):!0,[R,F]=w.useState(new Set),M=on(),$=Array.from(R).map(j=>j.props.value).join(";"),O=w.useCallback(j=>{F(ee=>new Set(ee).add(j))},[]),U=w.useCallback(j=>{F(ee=>{const J=new Set(ee);return J.delete(j),J})},[]),W={required:p,trigger:b,onTriggerChange:v,valueNode:_,onValueNodeChange:x,valueNodeHasChildren:S,onValueNodeHasChildrenChange:T,contentId:M,value:I,onValueChange:N,open:A,onOpenChange:D,dir:P,triggerPointerDownPosRef:L,disabled:g,name:f,autoComplete:u,form:y,nativeOptions:R,nativeSelectKey:$,isFormControl:H};return c.jsx(Yb,{...h,children:c.jsx(iv,{scope:t,...W,children:c.jsx(Oi.Provider,{scope:t,children:c.jsx(ov,{scope:t,onNativeOptionAdd:O,onNativeOptionRemove:U,children:Sv(m)?m(W):n})})})})}wf.displayName=cv;var _f=e=>{const{__scopeSelect:t,children:n,...r}=e;return c.jsx(wf,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:s})=>c.jsxs(c.Fragment,{children:[n,s?c.jsx(Vf,{__scopeSelect:t}):null]})})};_f.displayName=jn;var xf="SelectTrigger",Za=w.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...s}=e,i=Ri(n),o=pn(xf,n),a=o.disabled||r,l=Oe(t,o.onTriggerChange),d=Ni(n),f=w.useRef("touch"),[u,g,p]=Hf(m=>{const h=d().filter(_=>!_.disabled),b=h.find(_=>_.value===o.value),v=zf(h,m,b);v!==void 0&&o.onValueChange(v.value)}),y=m=>{a||(o.onOpenChange(!0),p()),m&&(o.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return c.jsx(Qb,{asChild:!0,...i,children:c.jsx(he.button,{type:"button",role:"combobox","aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":Li(o.value)?"":void 0,...s,ref:l,onClick:me(s.onClick,m=>{m.currentTarget.focus(),f.current!=="mouse"&&y(m)}),onPointerDown:me(s.onPointerDown,m=>{f.current=m.pointerType;const h=m.target;h.hasPointerCapture(m.pointerId)&&h.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(y(m),m.preventDefault())}),onKeyDown:me(s.onKeyDown,m=>{const h=u.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&g(m.key),!(h&&m.key===" ")&&nv.includes(m.key)&&(y(),m.preventDefault())})})})});Za.displayName=xf;var Sf="SelectValue",Cf=w.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,children:i,placeholder:o="",...a}=e,l=pn(Sf,n),{onValueNodeHasChildrenChange:d}=l,f=i!==void 0,u=Oe(t,l.onValueNodeChange);Ie(()=>{d(f)},[d,f]);const g=Li(l.value);return c.jsx(he.span,{...a,asChild:g?!1:a.asChild,ref:u,style:{pointerEvents:"none"},children:c.jsx(w.Fragment,{children:g?o:i},g?"placeholder":"value")})});Cf.displayName=Sf;var lv="SelectIcon",Tf=w.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...s}=e;return c.jsx(he.span,{"aria-hidden":!0,...s,ref:t,children:r||"▼"})});Tf.displayName=lv;var Ef="SelectPortal",[dv,uv]=Vn(Ef,{forceMount:void 0}),Pf=e=>{const{__scopeSelect:t,forceMount:n,...r}=e;return c.jsx(dv,{scope:e.__scopeSelect,forceMount:n,children:c.jsx(Si,{asChild:!0,...r})})};Pf.displayName=Ef;var un="SelectContent",Ya=w.forwardRef((e,t)=>{const n=uv(un,e.__scopeSelect),{forceMount:r=n.forceMount,...s}=e,i=pn(un,e.__scopeSelect),[o,a]=w.useState();return Ie(()=>{a(new DocumentFragment)},[]),c.jsx($n,{present:r||i.open,children:({present:l})=>l?c.jsx(Of,{...s,ref:t}):c.jsx(kf,{...s,fragment:o})})});Ya.displayName=un;var kf=w.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,fragment:s}=e;return s?Cr.createPortal(c.jsx(Af,{scope:n,children:c.jsx(Oi.Slot,{scope:n,children:c.jsx("div",{ref:t,children:r})})}),s):null});kf.displayName="SelectContentFragment";var pt=10,[Af,hn]=Vn(un),fv="SelectContentImpl",mv=mr("SelectContent.RemoveScroll"),Of=w.forwardRef((e,t)=>{const{__scopeSelect:n}=e,{position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:i,onPointerDownOutside:o,side:a,sideOffset:l,align:d,alignOffset:f,arrowPadding:u,collisionBoundary:g,collisionPadding:p,sticky:y,hideWhenDetached:m,avoidCollisions:h,...b}=e,v=pn(un,n),[_,x]=w.useState(null),[S,T]=w.useState(null),P=Oe(t,K=>x(K)),[A,D]=w.useState(null),[I,N]=w.useState(null),L=Ni(n),[H,R]=w.useState(!1),F=w.useRef(!1);w.useEffect(()=>{if(_)return Du(_)},[_]),Tu();const M=w.useCallback(K=>{const[se,...Ee]=L().map(B=>B.ref.current),[le]=Ee.slice(-1),oe=document.activeElement;for(const B of K)if(B===oe||(B==null||B.scrollIntoView({block:"nearest"}),B===se&&S&&(S.scrollTop=0),B===le&&S&&(S.scrollTop=S.scrollHeight),B==null||B.focus(),document.activeElement!==oe))return},[L,S]),$=w.useCallback(()=>M([A,_]),[M,A,_]);w.useEffect(()=>{H&&$()},[H,$]);const{onOpenChange:O,triggerPointerDownPosRef:U}=v;w.useEffect(()=>{if(_){let K={x:0,y:0};const se=le=>{var oe,B;K={x:Math.abs(Math.round(le.pageX)-(((oe=U.current)==null?void 0:oe.x)??0)),y:Math.abs(Math.round(le.pageY)-(((B=U.current)==null?void 0:B.y)??0))}},Ee=le=>{K.x<=10&&K.y<=10?le.preventDefault():le.composedPath().includes(_)||O(!1),document.removeEventListener("pointermove",se),U.current=null};return U.current!==null&&(document.addEventListener("pointermove",se),document.addEventListener("pointerup",Ee,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",se),document.removeEventListener("pointerup",Ee,{capture:!0})}}},[_,O,U]),w.useEffect(()=>{const K=()=>O(!1);return window.addEventListener("blur",K),window.addEventListener("resize",K),()=>{window.removeEventListener("blur",K),window.removeEventListener("resize",K)}},[O]);const[W,j]=Hf(K=>{const se=L().filter(oe=>!oe.disabled),Ee=se.find(oe=>oe.ref.current===document.activeElement),le=zf(se,K,Ee);le&&setTimeout(()=>{var oe;return(oe=le.ref.current)==null?void 0:oe.focus()})}),ee=w.useCallback((K,se,Ee)=>{const le=!F.current&&!Ee;(v.value!==void 0&&v.value===se||le)&&(D(K),le&&(F.current=!0))},[v.value]),J=w.useCallback(()=>_==null?void 0:_.focus(),[_]),de=w.useCallback((K,se,Ee)=>{const le=!F.current&&!Ee;(v.value!==void 0&&v.value===se||le)&&N(K)},[v.value]),ue=r==="popper"?Mo:Nf,V=ue===Mo?{side:a,sideOffset:l,align:d,alignOffset:f,arrowPadding:u,collisionBoundary:g,collisionPadding:p,sticky:y,hideWhenDetached:m,avoidCollisions:h}:{};return c.jsx(Af,{scope:n,content:_,viewport:S,onViewportChange:T,itemRefCallback:ee,selectedItem:A,onItemLeave:J,itemTextRefCallback:de,focusSelectedItem:$,selectedItemText:I,position:r,isPositioned:H,searchRef:W,children:c.jsx(Na,{as:mv,allowPinchZoom:!0,children:c.jsx(Oa,{asChild:!0,trapped:v.open,onMountAutoFocus:K=>{K.preventDefault()},onUnmountAutoFocus:me(s,K=>{var se;(se=v.trigger)==null||se.focus({preventScroll:!0}),K.preventDefault()}),children:c.jsx(xi,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:K=>K.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:c.jsx(ue,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:K=>K.preventDefault(),...b,...V,onPlaced:()=>R(!0),ref:P,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:me(b.onKeyDown,K=>{const se=K.ctrlKey||K.altKey||K.metaKey;if(K.key==="Tab"&&K.preventDefault(),!se&&K.key.length===1&&j(K.key),["ArrowUp","ArrowDown","Home","End"].includes(K.key)){let le=L().filter(oe=>!oe.disabled).map(oe=>oe.ref.current);if(["ArrowUp","End"].includes(K.key)&&(le=le.slice().reverse()),["ArrowUp","ArrowDown"].includes(K.key)){const oe=K.target,B=le.indexOf(oe);le=le.slice(B+1)}setTimeout(()=>M(le)),K.preventDefault()}})})})})})})});Of.displayName=fv;var pv="SelectItemAlignedPosition",Nf=w.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...s}=e,i=pn(un,n),o=hn(un,n),[a,l]=w.useState(null),[d,f]=w.useState(null),u=Oe(t,P=>f(P)),g=Ni(n),p=w.useRef(!1),y=w.useRef(!0),{viewport:m,selectedItem:h,selectedItemText:b,focusSelectedItem:v}=o,_=w.useCallback(()=>{if(i.trigger&&i.valueNode&&a&&d&&m&&h&&b){const P=i.trigger.getBoundingClientRect(),A=d.getBoundingClientRect(),D=i.valueNode.getBoundingClientRect(),I=b.getBoundingClientRect();if(i.dir!=="rtl"){const oe=I.left-A.left,B=D.left-oe,ve=P.left-B,ke=P.width+ve,Pe=Math.max(ke,A.width),X=window.innerWidth-pt,Ne=ul(B,[pt,Math.max(pt,X-Pe)]);a.style.minWidth=ke+"px",a.style.left=Ne+"px"}else{const oe=A.right-I.right,B=window.innerWidth-D.right-oe,ve=window.innerWidth-P.right-B,ke=P.width+ve,Pe=Math.max(ke,A.width),X=window.innerWidth-pt,Ne=ul(B,[pt,Math.max(pt,X-Pe)]);a.style.minWidth=ke+"px",a.style.right=Ne+"px"}const N=g(),L=window.innerHeight-pt*2,H=m.scrollHeight,R=window.getComputedStyle(d),F=parseInt(R.borderTopWidth,10),M=parseInt(R.paddingTop,10),$=parseInt(R.borderBottomWidth,10),O=parseInt(R.paddingBottom,10),U=F+M+H+O+$,W=Math.min(h.offsetHeight*5,U),j=window.getComputedStyle(m),ee=parseInt(j.paddingTop,10),J=parseInt(j.paddingBottom,10),de=P.top+P.height/2-pt,ue=L-de,V=h.offsetHeight/2,K=h.offsetTop+V,se=F+M+K,Ee=U-se;if(se<=de){const oe=N.length>0&&h===N[N.length-1].ref.current;a.style.bottom="0px";const B=d.clientHeight-m.offsetTop-m.offsetHeight,ve=Math.max(ue,V+(oe?J:0)+B+$),ke=se+ve;a.style.height=ke+"px"}else{const oe=N.length>0&&h===N[0].ref.current;a.style.top="0px";const ve=Math.max(de,F+m.offsetTop+(oe?ee:0)+V)+Ee;a.style.height=ve+"px",m.scrollTop=se-de+m.offsetTop}a.style.margin=`${pt}px 0`,a.style.minHeight=W+"px",a.style.maxHeight=L+"px",r==null||r(),requestAnimationFrame(()=>p.current=!0)}},[g,i.trigger,i.valueNode,a,d,m,h,b,i.dir,r]);Ie(()=>_(),[_]);const[x,S]=w.useState();Ie(()=>{d&&S(window.getComputedStyle(d).zIndex)},[d]);const T=w.useCallback(P=>{P&&y.current===!0&&(_(),v==null||v(),y.current=!1)},[_,v]);return c.jsx(gv,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:p,onScrollButtonChange:T,children:c.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:x},children:c.jsx(he.div,{...s,ref:u,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});Nf.displayName=pv;var hv="SelectPopperPosition",Mo=w.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=pt,...i}=e,o=Ri(n);return c.jsx(Xb,{...o,...i,ref:t,align:r,collisionPadding:s,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Mo.displayName=hv;var[gv,Qa]=Vn(un,{}),Fo="SelectViewport",Rf=w.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...s}=e,i=hn(Fo,n),o=Qa(Fo,n),a=Oe(t,i.onViewportChange),l=w.useRef(0);return c.jsxs(c.Fragment,{children:[c.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),c.jsx(Oi.Slot,{scope:n,children:c.jsx(he.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:me(s.onScroll,d=>{const f=d.currentTarget,{contentWrapper:u,shouldExpandOnScrollRef:g}=o;if(g!=null&&g.current&&u){const p=Math.abs(l.current-f.scrollTop);if(p>0){const y=window.innerHeight-pt*2,m=parseFloat(u.style.minHeight),h=parseFloat(u.style.height),b=Math.max(m,h);if(b<y){const v=b+p,_=Math.min(y,v),x=v-_;u.style.height=_+"px",u.style.bottom==="0px"&&(f.scrollTop=x>0?x:0,u.style.justifyContent="flex-end")}}}l.current=f.scrollTop})})})]})});Rf.displayName=Fo;var Lf="SelectGroup",[yv,bv]=Vn(Lf),vv=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=on();return c.jsx(yv,{scope:n,id:s,children:c.jsx(he.div,{role:"group","aria-labelledby":s,...r,ref:t})})});vv.displayName=Lf;var Df="SelectLabel",Xa=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=bv(Df,n);return c.jsx(he.div,{id:s.id,...r,ref:t})});Xa.displayName=Df;var ri="SelectItem",[wv,jf]=Vn(ri),Ja=w.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:i,...o}=e,a=pn(ri,n),l=hn(ri,n),d=a.value===r,[f,u]=w.useState(i??""),[g,p]=w.useState(!1),y=Oe(t,v=>{var _;return(_=l.itemRefCallback)==null?void 0:_.call(l,v,r,s)}),m=on(),h=w.useRef("touch"),b=()=>{s||(a.onValueChange(r),a.onOpenChange(!1))};return c.jsx(wv,{scope:n,value:r,disabled:s,textId:m,isSelected:d,onItemTextChange:w.useCallback(v=>{u(_=>_||((v==null?void 0:v.textContent)??"").trim())},[]),children:c.jsx(Oi.ItemSlot,{scope:n,value:r,disabled:s,textValue:f,children:c.jsx(he.div,{role:"option","aria-labelledby":m,"data-highlighted":g?"":void 0,"aria-selected":d&&g,"data-state":d?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...o,ref:y,onFocus:me(o.onFocus,()=>p(!0)),onBlur:me(o.onBlur,()=>p(!1)),onClick:me(o.onClick,()=>{h.current!=="mouse"&&b()}),onPointerUp:me(o.onPointerUp,()=>{h.current==="mouse"&&b()}),onPointerDown:me(o.onPointerDown,v=>{h.current=v.pointerType}),onPointerMove:me(o.onPointerMove,v=>{var _;h.current=v.pointerType,s?(_=l.onItemLeave)==null||_.call(l):h.current==="mouse"&&v.currentTarget.focus({preventScroll:!0})}),onPointerLeave:me(o.onPointerLeave,v=>{var _;v.currentTarget===document.activeElement&&((_=l.onItemLeave)==null||_.call(l))}),onKeyDown:me(o.onKeyDown,v=>{var x;((x=l.searchRef)==null?void 0:x.current)!==""&&v.key===" "||(rv.includes(v.key)&&b(),v.key===" "&&v.preventDefault())})})})})});Ja.displayName=ri;var Fr="SelectItemText",If=w.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,...i}=e,o=pn(Fr,n),a=hn(Fr,n),l=jf(Fr,n),d=av(Fr,n),[f,u]=w.useState(null),g=Oe(t,b=>u(b),l.onItemTextChange,b=>{var v;return(v=a.itemTextRefCallback)==null?void 0:v.call(a,b,l.value,l.disabled)}),p=f==null?void 0:f.textContent,y=w.useMemo(()=>c.jsx("option",{value:l.value,disabled:l.disabled,children:p},l.value),[l.disabled,l.value,p]),{onNativeOptionAdd:m,onNativeOptionRemove:h}=d;return Ie(()=>(m(y),()=>h(y)),[m,h,y]),c.jsxs(c.Fragment,{children:[c.jsx(he.span,{id:l.textId,...i,ref:g}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!Li(o.value)?Cr.createPortal(i.children,o.valueNode):null]})});If.displayName=Fr;var Mf="SelectItemIndicator",Ff=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return jf(Mf,n).isSelected?c.jsx(he.span,{"aria-hidden":!0,...r,ref:t}):null});Ff.displayName=Mf;var Uo="SelectScrollUpButton",ec=w.forwardRef((e,t)=>{const n=hn(Uo,e.__scopeSelect),r=Qa(Uo,e.__scopeSelect),[s,i]=w.useState(!1),o=Oe(t,r.onScrollButtonChange);return Ie(()=>{if(n.viewport&&n.isPositioned){let a=function(){const d=l.scrollTop>0;i(d)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),s?c.jsx(Uf,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});ec.displayName=Uo;var Bo="SelectScrollDownButton",tc=w.forwardRef((e,t)=>{const n=hn(Bo,e.__scopeSelect),r=Qa(Bo,e.__scopeSelect),[s,i]=w.useState(!1),o=Oe(t,r.onScrollButtonChange);return Ie(()=>{if(n.viewport&&n.isPositioned){let a=function(){const d=l.scrollHeight-l.clientHeight,f=Math.ceil(l.scrollTop)<d;i(f)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),s?c.jsx(Uf,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});tc.displayName=Bo;var Uf=w.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=e,i=hn("SelectScrollButton",n),o=w.useRef(null),a=Ni(n),l=w.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return w.useEffect(()=>()=>l(),[l]),Ie(()=>{var f;const d=a().find(u=>u.ref.current===document.activeElement);(f=d==null?void 0:d.ref.current)==null||f.scrollIntoView({block:"nearest"})},[a]),c.jsx(he.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:me(s.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:me(s.onPointerMove,()=>{var d;(d=i.onItemLeave)==null||d.call(i),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:me(s.onPointerLeave,()=>{l()})})}),_v="SelectSeparator",nc=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return c.jsx(he.div,{"aria-hidden":!0,...r,ref:t})});nc.displayName=_v;var Bf="SelectArrow",xv=w.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=Ri(n);return hn(Bf,n).position==="popper"?c.jsx(Jb,{...s,...r,ref:t}):null});xv.displayName=Bf;var $f="SelectBubbleInput",Vf=w.forwardRef(({__scopeSelect:e,...t},n)=>{const r=pn($f,e),{value:s,onValueChange:i,required:o,disabled:a,name:l,autoComplete:d,form:f}=r,{nativeOptions:u,nativeSelectKey:g}=r,p=w.useRef(null),y=Oe(n,p),m=s??"",h=ev(m),b=Array.from(u).some(v=>(v.props.value??"")==="");return w.useEffect(()=>{const v=p.current;if(!v)return;const _=window.HTMLSelectElement.prototype,S=Object.getOwnPropertyDescriptor(_,"value").set;if(h!==m&&S){const T=new Event("change",{bubbles:!0});S.call(v,m),v.dispatchEvent(T)}},[h,m]),c.jsxs(he.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:l,autoComplete:d,disabled:a,form:f,onChange:v=>i(v.target.value),...t,style:{...vf,...t.style},ref:y,defaultValue:m,children:[Li(s)&&!b?c.jsx("option",{value:""}):null,Array.from(u)]},g)});Vf.displayName=$f;function Sv(e){return typeof e=="function"}function Li(e){return e===""||e===void 0}function Hf(e){const t=yt(e),n=w.useRef(""),r=w.useRef(0),s=w.useCallback(o=>{const a=n.current+o;t(a),(function l(d){n.current=d,window.clearTimeout(r.current),d!==""&&(r.current=window.setTimeout(()=>l(""),1e3))})(a)},[t]),i=w.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return w.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,i]}function zf(e,t,n){const s=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let o=Cv(e,Math.max(i,0));s.length===1&&(o=o.filter(d=>d!==n));const l=o.find(d=>d.textValue.toLowerCase().startsWith(s.toLowerCase()));return l!==n?l:void 0}function Cv(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Di(e,t){if(e==null)return{};var n={},r=Object.keys(e),s,i;for(i=0;i<r.length;i++)s=r[i],!(t.indexOf(s)>=0)&&(n[s]=e[s]);return n}var Tv=["color"],Ev=C.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=Di(e,Tv);return C.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:t}),C.createElement("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),Pv=["color"],rc=C.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=Di(e,Pv);return C.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:t}),C.createElement("path",{d:"M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),kv=["color"],Av=C.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=Di(e,kv);return C.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:t}),C.createElement("path",{d:"M3.13523 8.84197C3.3241 9.04343 3.64052 9.05363 3.84197 8.86477L7.5 5.43536L11.158 8.86477C11.3595 9.05363 11.6759 9.04343 11.8648 8.84197C12.0536 8.64051 12.0434 8.32409 11.842 8.13523L7.84197 4.38523C7.64964 4.20492 7.35036 4.20492 7.15803 4.38523L3.15803 8.13523C2.95657 8.32409 2.94637 8.64051 3.13523 8.84197Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),Ov=["color"],Nv=C.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,s=Di(e,Ov);return C.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s,{ref:t}),C.createElement("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))});const si=_f,ii=Cf,Kr=w.forwardRef(({className:e,children:t,...n},r)=>c.jsxs(Za,{ref:r,className:Te("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[placeholder]:text-muted-foreground [&>span]:line-clamp-1",e),...n,children:[t,c.jsx(Tf,{asChild:!0,children:c.jsx(rc,{className:"h-4 w-4 opacity-50"})})]}));Kr.displayName=Za.displayName;const Wf=w.forwardRef(({className:e,...t},n)=>c.jsx(ec,{ref:n,className:Te("flex cursor-default items-center justify-center py-1",e),...t,children:c.jsx(Av,{className:"h-4 w-4"})}));Wf.displayName=ec.displayName;const Kf=w.forwardRef(({className:e,...t},n)=>c.jsx(tc,{ref:n,className:Te("flex cursor-default items-center justify-center py-1",e),...t,children:c.jsx(rc,{className:"h-4 w-4"})}));Kf.displayName=tc.displayName;const qr=w.forwardRef(({className:e,children:t,position:n="popper",...r},s)=>c.jsx(Pf,{children:c.jsxs(Ya,{ref:s,className:Te("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] origin-[--radix-select-content-transform-origin] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[c.jsx(Wf,{}),c.jsx(Rf,{className:Te("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),c.jsx(Kf,{})]})}));qr.displayName=Ya.displayName;const Rv=w.forwardRef(({className:e,...t},n)=>c.jsx(Xa,{ref:n,className:Te("px-2 py-1.5 text-sm font-semibold",e),...t}));Rv.displayName=Xa.displayName;const Gr=w.forwardRef(({className:e,children:t,...n},r)=>c.jsxs(Ja,{ref:r,className:Te("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[c.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:c.jsx(Ff,{children:c.jsx(Ev,{className:"h-4 w-4"})})}),c.jsx(If,{children:t})]}));Gr.displayName=Ja.displayName;const Lv=w.forwardRef(({className:e,...t},n)=>c.jsx(nc,{ref:n,className:Te("-mx-1 my-1 h-px bg-muted",e),...t}));Lv.displayName=nc.displayName;function qf({open:e,isAccountsLoading:t,accountOptions:n,onConfirm:r,backUrl:s,createAccountUrl:i}){var u;const[o,a]=C.useState(""),l=o||((u=n[0])==null?void 0:u.login)||"",d=!t&&n.length>0&&l!=="",f=!t&&n.length===0;return c.jsx(Dy,{open:e,children:c.jsxs(Wu,{className:"web-trading-widget-account-modal",onPointerDownOutside:g=>g.preventDefault(),onEscapeKeyDown:g=>g.preventDefault(),children:[c.jsxs(Ku,{children:[c.jsx(Gu,{children:"Select trading account"}),c.jsx(Zu,{children:"Choose an account to continue trading on the chart."})]}),t?c.jsx("p",{className:"web-trading-widget-account-modal__loading",children:"Loading accounts…"}):n.length===0?c.jsx("p",{className:"web-trading-widget-account-modal__error",children:"No trading accounts available."}):c.jsxs(si,{value:l,onValueChange:a,children:[c.jsx(Kr,{className:"web-trading-widget-account-modal__select",children:c.jsx(ii,{placeholder:"Select account"})}),c.jsx(qr,{children:n.map(g=>c.jsxs(Gr,{value:g.login,children:[g.label," (",g.balance.toFixed(2)," ",g.currency,")"]},g.login))})]}),c.jsx(qu,{children:f?c.jsxs(c.Fragment,{children:[s?c.jsx(ct,{asChild:!0,variant:"outline",children:c.jsx("a",{href:s,children:"Just back"})}):null,i?c.jsx(ct,{asChild:!0,children:c.jsx("a",{href:i,children:"Create account"})}):null]}):c.jsx(ct,{type:"button",disabled:!d,onClick:()=>r(l),children:"Continue"})})]})})}var Dv={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const jv=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),lt=(e,t)=>{const n=C.forwardRef(({color:r="currentColor",size:s=24,strokeWidth:i=2,absoluteStrokeWidth:o,children:a,...l},d)=>C.createElement("svg",{ref:d,...Dv,width:s,height:s,stroke:r,strokeWidth:o?Number(i)*24/Number(s):i,className:`lucide lucide-${jv(e)}`,...l},[...t.map(([f,u])=>C.createElement(f,u)),...(Array.isArray(a)?a:[a])||[]]));return n.displayName=`${e}`,n},oi=lt("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),Iv=lt("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),Mv=lt("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),$o=lt("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),Gf=lt("GripHorizontal",[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]]),Zf=lt("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]),Fv=lt("ListOrdered",[["line",{x1:"10",x2:"21",y1:"6",y2:"6",key:"76qw6h"}],["line",{x1:"10",x2:"21",y1:"12",y2:"12",key:"16nom4"}],["line",{x1:"10",x2:"21",y1:"18",y2:"18",key:"u3jurt"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]),Uv=lt("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]),Bv=lt("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]),$v=lt("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),Vv=lt("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),gn=lt("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function Hv(e){const t=Math.round(Math.log10(e));return Number.isFinite(t)&&t>0?t:5}function sc(e){const t=Ke(e).toUpperCase();if(t)return Bt.find(n=>{var r,s;return((r=n.resolve_symbol)==null?void 0:r.toUpperCase())===t||((s=n.display_name)==null?void 0:s.toUpperCase())===t||n.ticker.replace(/_/g,"").toUpperCase()===t})}function zv(e){const t=sc(e);return t!=null&&t.pricescale?Hv(t.pricescale):5}function Yf(e,t){if(t)for(const r of["digits","Digits"]){const s=t[r];if(s!=null&&s!==""){const i=Number(s);if(Number.isFinite(i))return Math.round(i)}}const n=Ke(e).toUpperCase();return n.includes("XAU")||n.includes("GOLD")?2:n.includes("JPY")?3:5}function Wv(e){const t=sc(e);switch(t==null?void 0:t.type){case"commodity":return 100;case"crypto":case"indices":case"stock":return 1;case"forex":default:return 1e5}}const ic="USD";function as(e){return Ke(e).toUpperCase()}function ji(e){const t=as(e);return t.length>=6?t.slice(3):ic}function oc(e){if(e!==ic&&e==="JPY")return"USDJPY"}function Kv(e,t,n,r,s){const i=ji(e),o=oc(i);if(!o)return;if(as(e)===o){const d=t==="buy"?n:r;return d>0?d:void 0}const a=s[o];if(!a)return;const l=(a.bid+a.ask)/2;return l>0?l:void 0}function qv(e,t,n,r,s,i,o={}){const a=e==="buy"?n:r;let d=(e==="buy"?a-t:t-a)*s*Wv(i);const f=ji(i),u=Kv(i,e,n,r,o);if(u!==void 0)d/=u;else if(f!==ic)return null;return Math.round(d*100)/100}function Gv(e){const t=new Set;for(const n of e){const r=oc(ji(n));r&&as(n)!==r&&t.add(r)}return[...t]}function Zv(e,t){const n=as(e);if(n===t)return!0;const r=oc(ji(e));return r===t&&n!==r}function Yv(e,t,n,r,s){if(!Zv(e.symbol,t))return e;const i=as(e.symbol)===t,o=i?n:e.marketBid??e.currentPrice,a=i?r:e.marketAsk??e.currentPrice,l=e.type==="buy"?o:a,d=qv(e.type,e.openPrice,o,a,e.volumeLots,e.symbol,s);return{...e,currentPrice:l,marketBid:o,marketAsk:a,profit:d??e.profit}}function Ke(e){const t=e.trim();return t?t.replace(/m$/i,""):""}function Ii(e){return Ke(e)||"—"}const Ye={BUY:0,SELL:1,BUY_LIMIT:2,SELL_LIMIT:3,BUY_STOP:4,SELL_STOP:5,BUY_STOP_LIMIT:6,SELL_STOP_LIMIT:7},ai=[{mode:"market",label:"Market Execution",orderType:null,isMarket:!0},{mode:"buy_limit",label:"Buy Limit",orderType:Ye.BUY_LIMIT,isMarket:!1},{mode:"sell_limit",label:"Sell Limit",orderType:Ye.SELL_LIMIT,isMarket:!1},{mode:"buy_stop",label:"Buy Stop",orderType:Ye.BUY_STOP,isMarket:!1},{mode:"sell_stop",label:"Sell Stop",orderType:Ye.SELL_STOP,isMarket:!1},{mode:"buy_stop_limit",label:"Buy Stop Limit",orderType:Ye.BUY_STOP_LIMIT,isMarket:!1},{mode:"sell_stop_limit",label:"Sell Stop Limit",orderType:Ye.SELL_STOP_LIMIT,isMarket:!1}];function Mi(e){return ai.find(t=>t.mode===e)??ai[0]}function Fi(e){return Mi(e).isMarket}function Vo(e,t){const n=Mi(e);return n.orderType!==null?n.orderType:t==="buy"?Ye.BUY:Ye.SELL}function ci(e){return e%2===1?"sell":"buy"}function ac(e){return e>=Ye.BUY_LIMIT&&e<=Ye.SELL_STOP_LIMIT}function cc(e){return e===Ye.BUY_STOP_LIMIT||e===Ye.SELL_STOP_LIMIT}function Qf(e){return e==="buy_stop_limit"||e==="sell_stop_limit"}const gt={GTC:0,TODAY:1,SPECIFIED:2,SPECIFIED_DAY:3},Xf=[{value:gt.GTC,label:"GTC"},{value:gt.TODAY,label:"Today"},{value:gt.SPECIFIED,label:"Specified"},{value:gt.SPECIFIED_DAY,label:"Specified Day"}];function lc(e){return e===gt.SPECIFIED}function dc(e){return e===gt.SPECIFIED_DAY}function Qv(e){return e.map(t=>({login:t.login,label:t.label,balance:t.tradeStat.balance,currency:t.currency}))}function Xv(){if(typeof window>"u")return null;const e=localStorage.getItem(hu);return(e==null?void 0:e.trim())||null}function Sl(e){if(typeof window>"u")return;const t=e.trim();t&&localStorage.setItem(hu,t)}function Jv(e,t){var n;return t&&e.some(r=>r.login===t)?t:((n=e[0])==null?void 0:n.login)??""}function uc(e,t=Bt){return t.find(n=>n.ticker===e)}function ew(e,t=Bt){var s;const n=Ke(e).toUpperCase();if(!n)return null;const r=t.find(i=>{var o;return Ke(i.resolve_symbol??"").toUpperCase()===n||((o=i.display_name)==null?void 0:o.toUpperCase())===n||i.ticker.replace(/_/g,"").toUpperCase()===n||i.ticker.toUpperCase()===n});return r?r.ticker:((s=sc(e))==null?void 0:s.ticker)??null}function Jf(e,t=Bt){const n=uc(e,t),r=(n==null?void 0:n.resolve_symbol)??e.replace(/_/g,"");return Ke(r).toUpperCase()}function Ui(e,t=Bt){const n=uc(e,t);return n!=null&&n.resolve_symbol?n.resolve_symbol:e.replace(/_/g,"")}function Vt(e){const t=Math.round(Math.log10(e));return String(Number.isFinite(t)&&t>0?t:5)}function Ht(e,t=Bt){const n=uc(e,t);return(n==null?void 0:n.pricescale)??1e5}function xe(e,t){return e.toFixed(t)}function Pr(e){return 1/10**e}function fc(e,t){return e===null||t===null?null:(e+t)/2}function Ue(e){const t=e.trim();if(!t)return;const n=Number(t);if(!(!Number.isFinite(n)||n<=0))return n}function em(e,t,n){if(lc(e)){if(!t.trim())return;const r=Date.parse(t);return Number.isFinite(r)?Math.floor(r/1e3):void 0}if(dc(e)){if(!n.trim())return;const r=Date.parse(`${n}T23:59:59`);return Number.isFinite(r)?Math.floor(r/1e3):void 0}}function Bi(e,t,n){return e===gt.GTC||e===gt.TODAY?!0:em(e,t,n)!==void 0}const tw={},Cl=e=>{let t;const n=new Set,r=(f,u)=>{const g=typeof f=="function"?f(t):f;if(!Object.is(g,t)){const p=t;t=u??(typeof g!="object"||g===null)?g:Object.assign({},t,g),n.forEach(y=>y(t,p))}},s=()=>t,l={setState:r,getState:s,getInitialState:()=>d,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(tw?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},d=t=e(r,s,l);return l},nw=e=>e?Cl(e):Cl;function rw(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Os={exports:{}},uo={},Ns={exports:{}},fo={};/**
|
|
42
42
|
* @license React
|
|
43
43
|
* use-sync-external-store-shim.production.js
|
|
44
44
|
*
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
*
|
|
47
47
|
* This source code is licensed under the MIT license found in the
|
|
48
48
|
* LICENSE file in the root directory of this source tree.
|
|
49
|
-
*/var
|
|
49
|
+
*/var Tl;function sw(){if(Tl)return fo;Tl=1;var e=C;function t(u,g){return u===g&&(u!==0||1/u===1/g)||u!==u&&g!==g}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,s=e.useEffect,i=e.useLayoutEffect,o=e.useDebugValue;function a(u,g){var p=g(),y=r({inst:{value:p,getSnapshot:g}}),m=y[0].inst,h=y[1];return i(function(){m.value=p,m.getSnapshot=g,l(m)&&h({inst:m})},[u,p,g]),s(function(){return l(m)&&h({inst:m}),u(function(){l(m)&&h({inst:m})})},[u]),o(p),p}function l(u){var g=u.getSnapshot;u=u.value;try{var p=g();return!n(u,p)}catch{return!0}}function d(u,g){return g()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:a;return fo.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,fo}var mo={};/**
|
|
50
50
|
* @license React
|
|
51
51
|
* use-sync-external-store-shim.development.js
|
|
52
52
|
*
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
*
|
|
55
55
|
* This source code is licensed under the MIT license found in the
|
|
56
56
|
* LICENSE file in the root directory of this source tree.
|
|
57
|
-
*/var
|
|
57
|
+
*/var El;function iw(){return El||(El=1,process.env.NODE_ENV!=="production"&&(function(){function e(p,y){return p===y&&(p!==0||1/p===1/y)||p!==p&&y!==y}function t(p,y){f||s.startTransition===void 0||(f=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var m=y();if(!u){var h=y();i(m,h)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),u=!0)}h=o({inst:{value:m,getSnapshot:y}});var b=h[0].inst,v=h[1];return l(function(){b.value=m,b.getSnapshot=y,n(b)&&v({inst:b})},[p,m,y]),a(function(){return n(b)&&v({inst:b}),p(function(){n(b)&&v({inst:b})})},[p]),d(m),m}function n(p){var y=p.getSnapshot;p=p.value;try{var m=y();return!i(p,m)}catch{return!0}}function r(p,y){return y()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var s=C,i=typeof Object.is=="function"?Object.is:e,o=s.useState,a=s.useEffect,l=s.useLayoutEffect,d=s.useDebugValue,f=!1,u=!1,g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;mo.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:g,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),mo}var Pl;function tm(){return Pl||(Pl=1,process.env.NODE_ENV==="production"?Ns.exports=sw():Ns.exports=iw()),Ns.exports}/**
|
|
58
58
|
* @license React
|
|
59
59
|
* use-sync-external-store-shim/with-selector.production.js
|
|
60
60
|
*
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
*
|
|
63
63
|
* This source code is licensed under the MIT license found in the
|
|
64
64
|
* LICENSE file in the root directory of this source tree.
|
|
65
|
-
*/var
|
|
65
|
+
*/var kl;function ow(){if(kl)return uo;kl=1;var e=C,t=tm();function n(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var r=typeof Object.is=="function"?Object.is:n,s=t.useSyncExternalStore,i=e.useRef,o=e.useEffect,a=e.useMemo,l=e.useDebugValue;return uo.useSyncExternalStoreWithSelector=function(d,f,u,g,p){var y=i(null);if(y.current===null){var m={hasValue:!1,value:null};y.current=m}else m=y.current;y=a(function(){function b(T){if(!v){if(v=!0,_=T,T=g(T),p!==void 0&&m.hasValue){var P=m.value;if(p(P,T))return x=P}return x=T}if(P=x,r(_,T))return P;var A=g(T);return p!==void 0&&p(P,A)?(_=T,P):(_=T,x=A)}var v=!1,_,x,S=u===void 0?null:u;return[function(){return b(f())},S===null?void 0:function(){return b(S())}]},[f,u,g,p]);var h=s(d,y[0],y[1]);return o(function(){m.hasValue=!0,m.value=h},[h]),l(h),h},uo}var po={};/**
|
|
66
66
|
* @license React
|
|
67
67
|
* use-sync-external-store-shim/with-selector.development.js
|
|
68
68
|
*
|
|
@@ -70,21 +70,21 @@
|
|
|
70
70
|
*
|
|
71
71
|
* This source code is licensed under the MIT license found in the
|
|
72
72
|
* LICENSE file in the root directory of this source tree.
|
|
73
|
-
*/var wl;function qv(){return wl||(wl=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=Hf(),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,g,m){var h=i(null);if(h.current===null){var p={hasValue:!1,value:null};h.current=p}else p=h.current;h=a(function(){function b(P){if(!v){if(v=!0,x=P,P=g(P),m!==void 0&&p.hasValue){var E=p.value;if(m(E,P))return _=E}return _=P}if(E=_,r(x,P))return E;var k=g(P);return m!==void 0&&m(E,k)?(x=P,E):(x=P,_=k)}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,g,m]);var y=s(d,h[0],h[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 _l;function Zv(){return _l||(_l=1,process.env.NODE_ENV==="production"?xs.exports=Gv():xs.exports=qv()),xs.exports}var Yv=Zv();const Qv=zv(Yv),zf={},{useDebugValue:Xv}=S,{useSyncExternalStoreWithSelector:Jv}=Qv;let xl=!1;const ew=e=>e;function tw(e,t=ew,n){(zf?"production":void 0)!=="production"&&n&&!xl&&(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"),xl=!0);const r=Jv(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Xv(r),r}const Sl=e=>{(zf?"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"?Hv(e):e,n=(r,s)=>tw(t,r,s);return Object.assign(n,t),n},ji=e=>e?Sl(e):Sl,Cl={source:null,entryPrice:null,stopLoss:"",takeProfit:"",side:null,showEntryLine:!1,volumeLots:.01,digits:2,priceStep:.01},oe=ji(e=>({...Cl,setDraft:t=>e(n=>({source:t.source,entryPrice:t.entryPrice!==void 0?t.entryPrice:n.entryPrice,stopLoss:t.stopLoss??n.stopLoss,takeProfit:t.takeProfit??n.takeProfit,side:t.side!==void 0?t.side:n.side,showEntryLine:t.showEntryLine??n.showEntryLine,volumeLots:t.volumeLots??n.volumeLots,digits:t.digits??n.digits,priceStep:t.priceStep??n.priceStep})),setOrderSide:({side:t,entryPrice:n})=>e({side:t,entryPrice:n,showEntryLine:!0}),setStopLoss:t=>e({stopLoss:t}),setTakeProfit:t=>e({takeProfit:t}),setVolumeLots:t=>e({volumeLots:t}),clearEntryLinePreview:()=>e({side:null,entryPrice:null,showEntryLine:!1}),clearDraft:()=>e({...Cl})}));function lo(e,t){return e.toFixed(t)}function nw({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:g,onExpand:m,onPlaceOrder:h}){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 E=b??!!u;S.useEffect(()=>{g()},[E,g]);const k=()=>{const L=!E;L&&m(),v(L)},D=Number($t(Vt(e))),I=t!==null?Ee(t,D):"—",N=n!==null?Ee(n,D):"—",B=!o&&!a&&l!==""&&(t!==null&&n!==null),R=L=>{const U=Number(p),K=Number.isFinite(U)&&U>0?U:r,j=Math.max(i,K+L*s),se=lo(j,2);y(se),P(j)},H=()=>{const L=Number(p);if(!Number.isFinite(L)||L<=0){y(lo(r,2)),P(r);return}const U=Math.max(i,L),K=lo(U,2);y(K),P(U)},F=L=>{t===null||n===null||C({side:L,entryPrice:L==="buy"?n:t})},M=L=>{if(t===null||n===null||!l)return;const U=Number(p),K=Math.max(i,Number.isFinite(U)&&U>0?U:r);C({side:L,entryPrice:L==="buy"?n:t}),h({login:l,side:L,volumeLots:K,bid:t,ask:n})};return c.jsx("div",{className:`web-trading-widget-mini-order${E?" 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(If,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2})}),E?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:()=>M("sell"),children:[c.jsx("span",{className:"web-trading-widget-mini-order__price",children:I}),c.jsx("span",{className:"web-trading-widget-mini-order__label web-trading-widget-mini-order__label--sell",children:"SELL"})]}),c.jsxs("div",{className:"web-trading-widget-mini-order__volume",children:[c.jsx("button",{type:"button","aria-label":"Decrease volume",disabled:!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:()=>M("buy"),children:[c.jsx("span",{className:"web-trading-widget-mini-order__label web-trading-widget-mini-order__label--buy",children:"BUY"}),c.jsx("span",{className:"web-trading-widget-mini-order__price",children:N})]})]}):null,c.jsx("button",{type:"button","aria-label":E?"Collapse quick order panel":"Expand quick order panel","aria-expanded":E,className:"web-trading-widget-mini-order__toggle",onClick:k,children:E?c.jsx(Cv,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5}):c.jsx(Ev,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5})})]})})}const rw="web-trading-widget-mini-exec-panel-position",Wf={x:56,y:96};function El(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 Tl(e,t){e.style.left=`${t.x}px`,e.style.top=`${t.y}px`}function sw(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):Wf.x,y:16}}function iw(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 Pl(e,t){try{e.hasPointerCapture(t)&&e.releasePointerCapture(t)}catch{}}function Kf(e){const t=(e==null?void 0:e.storageKey)??rw,n=(e==null?void 0:e.defaultPosition)??Wf,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 g=S.useCallback(p=>{const y=i.current,b=El(p,y);u.current=b,a(b),y&&Tl(y,b)},[]),m=S.useCallback(()=>{g(u.current)},[g]);S.useEffect(()=>{if(!s)return;const p=iw(t);if(p){g(p);return}const y=r?sw(r,i.current):null;g(y??u.current)},[g,r,s,t]);const h=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,I)=>{const N=El({x:C.x+(D-x),y:C.y+(I-_)},b);u.current=N,Tl(b,N)},E=D=>{if(D.pointerId===v){Pl(y,v),y.removeEventListener("pointermove",k),y.removeEventListener("pointerup",E),y.removeEventListener("pointercancel",E),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{}}},k=D=>{D.pointerId===v&&(D.preventDefault(),P(D.clientX,D.clientY))};y.addEventListener("pointermove",k),y.addEventListener("pointerup",E),y.addEventListener("pointercancel",E),f.current=()=>{Pl(y,v),y.removeEventListener("pointermove",k),y.removeEventListener("pointerup",E),y.removeEventListener("pointercancel",E),document.body.style.cursor="",document.body.style.userSelect="",d(!1)}},[t]);return S.useEffect(()=>{const p=()=>{g(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=""}},[g]),{panelRef:i,position:o,isDragging:l,onDragStart:h,reclamp:m}}const Gf=200,ow=201,aw=203,cw=204,qf=0,lw=2,Zf=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 dw(e){return e>=2&&e<=7}function uw(e){return{Action:cw,Order:Number(e.orderTicket),Login:Ii(e.login),Symbol:e.symbol.replace(/m$/i,""),Type:e.orderType}}function fw(e){return{Action:aw,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 pw(e){const t=e.positionSide==="buy"?1:0;return{Action:Gf,Login:Ii(e.login),Symbol:e.symbol.replace(/m$/i,""),Type:t,TypeFill:qf,Volume:ac(e.volumeLots),Digits:e.digits,TypeTime:Zf,Comment:e.comment??"",Position:Number(e.positionTicket)}}function mw(e){const t=!dw(e.orderType);return{Action:t?Gf:ow,Login:Ii(e.login),Symbol:e.symbol,Type:e.orderType,TypeFill:t?qf:lw,Volume:ac(e.volumeLots),Digits:e.digits,TypeTime:e.typeTime??Zf,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 hw(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 gw=new Set(["10009","10008"]);function Dt(e){if(e===void 0||e==="")return;const t=Number(e);return Number.isFinite(t)?t:void 0}function yw(e){const t=Dt(e);return t===void 0?.01:t/1e4}function bw(e){var t;return(t=e.find(n=>n.answer))==null?void 0:t.answer}function vw(e){var t,n,r,s;for(const i of e){const o=((t=i.result)==null?void 0:t.Retcode)??((n=i.answer)==null?void 0:n.ResultRetcode);if(o)return{retcode:String(o),price:Dt(((r=i.result)==null?void 0:r.Price)??((s=i.answer)==null?void 0:s.ResultPrice))}}return{retcode:""}}function Ms(e){return gw.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=bw(r),{retcode:i,price:o}=vw(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=Dt(s==null?void 0:s.Type),g=f!==void 0?f%2===0?"buy":"sell":t.side,m=Dt(s==null?void 0:s.ResultPrice)??Dt(s==null?void 0:s.PriceOrder)??o??t.openPrice,h=Dt(s==null?void 0:s.ResultMarketBid),p=Dt(s==null?void 0:s.ResultMarketAsk),y=g==="buy"?h??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:Oi(u),side:g,volumeLots:yw(s==null?void 0:s.Volume)||t.volumeLots,openPrice:m,currentPrice:y,stopLoss:Dt(s==null?void 0:s.PriceSL),takeProfit:Dt(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:h,marketAsk:p}}function ww(e){return e.type==="buy"?e.marketBid??e.currentPrice:e.marketAsk??e.currentPrice}function _w(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($t(Vt(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:Vf(d,n.expirationDateTime??"",n.expirationDay??"");try{const g=mw({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(g),h=Cs(m,{login:r,symbol:i,side:ni(n.orderType),volumeLots:s,openPrice:u,digits:o,comment:n.comment.trim()});return h!=null&&h.isSuccess?{success:!0,ticket:h.ticket,side:h.side,volumeLots:h.volumeLots,displaySymbol:h.displaySymbol,price:h.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(g){return{success:!1,message:g instanceof Error?g.message:"Failed to place order."}}},async closePosition(n){try{const r=ww(n),s=pw({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=uw({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=fw({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 Yf(e,t){return function(){return e.apply(t,arguments)}}const{toString:xw}=Object.prototype,{getPrototypeOf:gr}=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=gr(n)}return!1},Sw=(e,t)=>e!=null&&Wr(e,t)?e[t]:void 0,cc=(e=>t=>{const n=xw.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,yr=Mi("undefined");function Ar(e){return e!==null&&!yr(e)&&e.constructor!==null&&!yr(e.constructor)&&Ze(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Xf=vt("ArrayBuffer");function Cw(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Xf(e.buffer),t}const Ew=Mi("string"),Ze=Mi("function"),Jf=Mi("number"),Nr=e=>e!==null&&typeof e=="object",Tw=e=>e===!0||e===!1,Fs=e=>{if(!Nr(e))return!1;const t=gr(e);return(t===null||t===Object.prototype||gr(t)===null)&&!Wr(e,Qf)&&!Wr(e,ss)},Pw=e=>{if(!Nr(e)||Ar(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Aw=vt("Date"),Nw=vt("File"),Ow=e=>!!(e&&typeof e.uri<"u"),kw=e=>e&&typeof e.getParts<"u",Rw=vt("Blob"),Dw=vt("FileList"),Lw=e=>Nr(e)&&Ze(e.pipe);function jw(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const Al=jw(),Nl=typeof Al.FormData<"u"?Al.FormData:void 0,Iw=e=>{if(!e)return!1;if(Nl&&e instanceof Nl)return!0;const t=gr(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]"},Mw=vt("URLSearchParams"),[Fw,Uw,Bw,$w]=["ReadableStream","Request","Response","Headers"].map(vt),Vw=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function is(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),In(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(Ar(e))return;const i=n?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let a;for(r=0;r<o;r++)a=i[r],t.call(null,e[a],a,e)}}function ep(e,t){if(Ar(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r=n.length,s;for(;r-- >0;)if(s=n[r],t===s.toLowerCase())return s;return null}const vn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,tp=e=>!yr(e)&&e!==vn;function Fo(...e){const{caseless:t,skipUndefined:n}=tp(this)&&this||{},r={},s=(i,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const a=t&&typeof o=="string"&&ep(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||!yr(i))&&(r[a]=i)};for(let i=0,o=e.length;i<o;i++){const a=e[i];if(!a||Ar(a)||(is(a,s),typeof a!="object"||In(a)))continue;const l=Object.getOwnPropertySymbols(a);for(let d=0;d<l.length;d++){const u=l[d];e_.call(a,u)&&s(a[u],u)}}return r}const Hw=(e,t,n,{allOwnKeys:r}={})=>(is(t,(s,i)=>{n&&Ze(s)?Object.defineProperty(e,i,{__proto__:null,value:Yf(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),zw=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Ww=(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)},Kw=(e,t,n,r)=>{let s,i,o;const a={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)o=s[i],(!r||r(o,e,t))&&!a[o]&&(t[o]=e[o],a[o]=!0);e=n!==!1&&gr(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},Gw=(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},qw=e=>{if(!e)return null;if(In(e))return e;let t=e.length;if(!Jf(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},Zw=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&gr(Uint8Array)),Yw=(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])}},Qw=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},Xw=vt("HTMLFormElement"),Jw=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),{propertyIsEnumerable:e_}=Object.prototype,t_=vt("RegExp"),np=(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)},n_=e=>{np(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+"'")})}})},r_=(e,t)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return In(e)?r(e):r(String(e).split(t)),n},s_=()=>{},i_=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function o_(e){return!!(e&&Ze(e.append)&&e[Qf]==="FormData"&&e[ss])}const a_=e=>{const t=new WeakSet,n=r=>{if(Nr(r)){if(t.has(r))return;if(Ar(r))return r;if(!("toJSON"in r)){t.add(r);const s=In(r)?[]:{};return is(r,(i,o)=>{const a=n(i);!yr(a)&&(s[o]=a)}),t.delete(r),s}}return r};return n(e)},c_=vt("AsyncFunction"),l_=e=>e&&(Nr(e)||Ze(e))&&Ze(e.then)&&Ze(e.catch),rp=((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)),d_=typeof queueMicrotask<"u"?queueMicrotask.bind(vn):typeof process<"u"&&process.nextTick||rp,sp=e=>e!=null&&Ze(e[ss]),u_=e=>e!=null&&Wr(e,ss)&&sp(e),A={isArray:In,isArrayBuffer:Xf,isBuffer:Ar,isFormData:Iw,isArrayBufferView:Cw,isString:Ew,isNumber:Jf,isBoolean:Tw,isObject:Nr,isPlainObject:Fs,isEmptyObject:Pw,isReadableStream:Fw,isRequest:Uw,isResponse:Bw,isHeaders:$w,isUndefined:yr,isDate:Aw,isFile:Nw,isReactNativeBlob:Ow,isReactNative:kw,isBlob:Rw,isRegExp:t_,isFunction:Ze,isStream:Lw,isURLSearchParams:Mw,isTypedArray:Zw,isFileList:Dw,forEach:is,merge:Fo,extend:Hw,trim:Vw,stripBOM:zw,inherits:Ww,toFlatObject:Kw,kindOf:cc,kindOfTest:vt,endsWith:Gw,toArray:qw,forEachEntry:Yw,matchAll:Qw,isHTMLForm:Xw,hasOwnProperty:ri,hasOwnProp:ri,hasOwnInPrototypeChain:Wr,getSafeProp:Sw,reduceDescriptors:np,freezeMethods:n_,toObjectSet:r_,toCamelCase:Jw,noop:s_,toFiniteNumber:i_,findKey:ep,global:vn,isContextDefined:tp,isSpecCompliantForm:o_,toJSONObject:a_,isAsyncFn:c_,isThenable:l_,setImmediate:rp,asap:d_,isIterable:sp,isSafeIterable:u_},f_=A.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),p_=e=>{const t={};let n,r,s;return e&&e.split(`
|
|
74
|
-
`).forEach(function(o){s=o.indexOf(":"),n=o.substring(0,s).trim().toLowerCase(),r=o.substring(s+1).trim(),!(!n||t[n]&&
|
|
75
|
-
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[Ol]=this[Ol]={accessors:{}}).accessors,s=this.prototype;function i(o){const a=Lr(o);r[a]||(x_(s,o),r[a]=!0)}return A.isArray(t)?t.forEach(i):i(t),this}};ze.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);A.reduceDescriptors(ze.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});A.freezeMethods(ze);const S_="[REDACTED ****]";function C_(e){if(A.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(A.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}function E_(e,t){const n=new Set(t.map(i=>String(i).toLowerCase())),r=[],s=i=>{if(i===null||typeof i!="object"||A.isBuffer(i))return i;if(r.indexOf(i)!==-1)return;i instanceof ze&&(i=i.toJSON()),r.push(i);let o;if(A.isArray(i))o=[],i.forEach((a,l)=>{const d=s(a);A.isUndefined(d)||(o[l]=d)});else{if(!A.isPlainObject(i)&&C_(i))return r.pop(),i;o=Object.create(null);for(const[a,l]of Object.entries(i)){const d=n.has(a.toLowerCase())?S_:s(l);A.isUndefined(d)||(o[a]=d)}}return r.pop(),o};return s(e)}let q=class op extends Error{static from(t,n,r,s,i,o){const a=new op(t.message,n||t.code,r,s,i);return a.cause=t,a.name=t.name,t.status!=null&&a.status==null&&(a.status=t.status),o&&Object.assign(a,o),a}constructor(t,n,r,s,i){super(t),Object.defineProperty(this,"message",{__proto__:null,value:t,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),r&&(this.config=r),s&&(this.request=s),i&&(this.response=i,this.status=i.status)}toJSON(){const t=this.config,n=t&&A.hasOwnProp(t,"redact")?t.redact:void 0,r=A.isArray(n)&&n.length>0?E_(t,n):A.toJSONObject(t);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:r,code:this.code,status:this.status}}};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 T_=null,ap=100;function Uo(e){return A.isPlainObject(e)||A.isArray(e)}function cp(e){return A.endsWith(e,"[]")?e.slice(0,-2):e}function fo(e,t,n){return e?e.concat(t).map(function(s,i){return s=cp(s),!n&&i?"["+s+"]":s}).join(n?".":""):t}function P_(e){return A.isArray(e)&&!e.some(Uo)}const A_=A.toFlatObject(A,{},null,function(t){return/^is[A-Z]/.test(t)});function Fi(e,t,n){if(!A.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=A.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(v,x){return!A.isUndefined(x[v])});const r=n.metaTokens,s=n.visitor||h,i=n.dots,o=n.indexes,a=n.Blob||typeof Blob<"u"&&Blob,l=n.maxDepth===void 0?ap:n.maxDepth,d=a&&A.isSpecCompliantForm(t),u=[];if(!A.isFunction(s))throw new TypeError("visitor must be a function");function f(b){if(b===null)return"";if(A.isDate(b))return b.toISOString();if(A.isBoolean(b))return b.toString();if(!d&&A.isBlob(b))throw new q("Blob is not supported. Use a Buffer instead.");return A.isArrayBuffer(b)||A.isTypedArray(b)?d&&typeof Blob=="function"?new Blob([b]):Buffer.from(b):b}function g(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(!A.isObject(P))return P;for(;x.length&&x[x.length-1]!==this;)x.pop();return x.push(P),g(v+x.length-1),P})}function h(b,v,x){let _=b;if(A.isReactNative(t)&&A.isReactNativeBlob(b))return t.append(fo(x,v,i),f(b)),!1;if(b&&!x&&typeof b=="object"){if(A.endsWith(v,"{}"))v=r?v:v.slice(0,-2),b=m(b,1);else if(A.isArray(b)&&P_(b)||(A.isFileList(b)||A.endsWith(v,"[]"))&&(_=A.toArray(b)))return v=cp(v),_.forEach(function(P,E){!(A.isUndefined(P)||P===null)&&t.append(o===!0?fo([v],E,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(A_,{defaultVisitor:h,convertValue:f,isVisitable:Uo});function y(b,v,x=0){if(!A.isUndefined(b)){if(g(x),u.indexOf(b)!==-1)throw new Error("Circular reference detected in "+v.join("."));u.push(b),A.forEach(b,function(C,P){(!(A.isUndefined(C)||C===null)&&s.call(t,C,A.isString(P)?P.trim():P,v,p))===!0&&y(C,v?v.concat(P):[P],x+1)}),u.pop()}}if(!A.isObject(e))throw new TypeError("data must be an object");return y(e),t}function kl(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 lp=dc.prototype;lp.append=function(t,n){this._pairs.push([t,n])};lp.toString=function(t){const n=t?function(r){return t.call(this,r,kl)}:kl;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function N_(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function dp(e,t,n){if(!t)return e;const r=A.isFunction(n)?{serialize:n}:n,s=A.getSafeProp(r,"encode")||N_,i=A.getSafeProp(r,"serialize");let o;if(i?o=i(t,r):o=A.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 Rl{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){A.forEach(this.handlers,function(r){r!==null&&t(r)})}}const uc={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},O_=typeof URLSearchParams<"u"?URLSearchParams:dc,k_=typeof FormData<"u"?FormData:null,R_=typeof Blob<"u"?Blob:null,D_={isBrowser:!0,classes:{URLSearchParams:O_,FormData:k_,Blob:R_},protocols:["http","https","file","blob","url","data"]},fc=typeof window<"u"&&typeof document<"u",Bo=typeof navigator=="object"&&navigator||void 0,L_=fc&&(!Bo||["ReactNative","NativeScript","NS"].indexOf(Bo.product)<0),j_=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",I_=fc&&window.location.href||"http://localhost",M_=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:fc,hasStandardBrowserEnv:L_,hasStandardBrowserWebWorkerEnv:j_,navigator:Bo,origin:I_},Symbol.toStringTag,{value:"Module"})),Be={...M_,...D_};function F_(e,t){return Fi(e,new Be.classes.URLSearchParams,{visitor:function(n,r,s,i){return Be.isNode&&A.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}const Dl=ap;function up(e){if(e>Dl)throw new q("FormData field is too deeply nested ("+e+" levels). Max depth: "+Dl,q.ERR_FORM_DATA_DEPTH_EXCEEDED)}function U_(e){const t=[],n=/\w+|\[(\w*)]/g;let r;for(;(r=n.exec(e))!==null;)up(t.length),t.push(r[0]==="[]"?"":r[1]||r[0]);return t}function B_(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 fp(e){function t(n,r,s,i){up(i);let o=n[i++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),l=i>=n.length;return o=!o&&A.isArray(s)?s.length:o,l?(A.hasOwnProp(s,o)?s[o]=A.isArray(s[o])?s[o].concat(r):[s[o],r]:s[o]=r,!a):((!A.hasOwnProp(s,o)||!A.isObject(s[o]))&&(s[o]=[]),t(n,r,s[o],i)&&A.isArray(s[o])&&(s[o]=B_(s[o])),!a)}if(A.isFormData(e)&&A.isFunction(e.entries)){const n={};return A.forEachEntry(e,(r,s)=>{t(U_(r),s,n,0)}),n}return null}const Kn=(e,t)=>e!=null&&A.hasOwnProp(e,t)?e[t]:void 0;function $_(e,t,n){if(A.isString(e))try{return(t||JSON.parse)(e),A.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const os={transitional:uc,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=A.isObject(t);if(i&&A.isHTMLForm(t)&&(t=new FormData(t)),A.isFormData(t))return s?JSON.stringify(fp(t)):t;if(A.isArrayBuffer(t)||A.isBuffer(t)||A.isStream(t)||A.isFile(t)||A.isBlob(t)||A.isReadableStream(t))return t;if(A.isArrayBufferView(t))return t.buffer;if(A.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(i){const l=Kn(this,"formSerializer");if(r.indexOf("application/x-www-form-urlencoded")>-1)return F_(t,l).toString();if((a=A.isFileList(t))||r.indexOf("multipart/form-data")>-1){const d=Kn(this,"env"),u=d&&d.FormData;return Fi(a?{"files[]":t}:t,u&&new u,l)}}return i||s?(n.setContentType("application/json",!1),$_(t)):t}],transformResponse:[function(t){const n=Kn(this,"transitional")||os.transitional,r=n&&n.forcedJSONParsing,s=Kn(this,"responseType"),i=s==="json";if(A.isResponse(t)||A.isReadableStream(t))return t;if(t&&A.isString(t)&&(r&&!s||i)){const a=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(t,Kn(this,"parseReviver"))}catch(l){if(a)throw l.name==="SyntaxError"?q.from(l,q.ERR_BAD_RESPONSE,this,null,Kn(this,"response")):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Be.classes.FormData,Blob:Be.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};A.forEach(["delete","get","head","post","put","patch","query"],e=>{os.headers[e]={}});function po(e,t){const n=this||os,r=t||n,s=ze.from(r.headers);let i=r.data;return A.forEach(e,function(a){i=a.call(n,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function pp(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 mp(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 V_(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function H_(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,g=0;for(;f!==s;)g+=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(g*1e3/m):void 0}}function z_(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=H_(50,250);return z_(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)},Ll=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},jl=e=>(...t)=>A.asap(()=>e(...t)),W_=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,K_=Be.hasStandardBrowserEnv?{write(e,t,n,r,s,i,o){if(typeof document>"u")return;const a=[`${e}=${encodeURIComponent(t)}`];A.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),A.isString(r)&&a.push(`path=${r}`),A.isString(s)&&a.push(`domain=${s}`),i===!0&&a.push("secure"),A.isString(o)&&a.push(`SameSite=${o}`),document.cookie=a.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.split(";");for(let n=0;n<t.length;n++){const r=t[n].replace(/^\s+/,""),s=r.indexOf("=");if(s!==-1&&r.slice(0,s)===e)return decodeURIComponent(r.slice(s+1))}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function G_(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function q_(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const Z_=/^https?:(?!\/\/)/i,Y_=/[\t\n\r]/g;function Q_(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function X_(e){return Q_(e).replace(Y_,"")}function Il(e,t){if(typeof e=="string"&&Z_.test(X_(e)))throw new q('Invalid URL: missing "//" after protocol',q.ERR_INVALID_URL,t)}function hp(e,t,n,r){Il(t,r);let s=!G_(t);return e&&(s||n===!1)?(Il(e,r),q_(e,t)):t}const Ml=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,g,m){return A.isPlainObject(u)&&A.isPlainObject(f)?A.merge.call({caseless:m},u,f):A.isPlainObject(f)?A.merge({},f):A.isArray(f)?f.slice():f}function s(u,f,g,m){if(A.isUndefined(f)){if(!A.isUndefined(u))return r(void 0,u,g,m)}else return r(u,f,g,m)}function i(u,f){if(!A.isUndefined(f))return r(void 0,f)}function o(u,f){if(A.isUndefined(f)){if(!A.isUndefined(u))return r(void 0,u)}else return r(void 0,f)}function a(u){const f=A.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!A.isUndefined(f))if(A.isPlainObject(f)){if(A.hasOwnProp(f,u))return f[u]}else return;const g=A.hasOwnProp(e,"transitional")?e.transitional:void 0;if(A.isPlainObject(g)&&A.hasOwnProp(g,u))return g[u]}function l(u,f,g){if(A.hasOwnProp(t,g))return r(u,f);if(A.hasOwnProp(e,g))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,g)=>s(Ml(u),Ml(f),g,!0)};return A.forEach(Object.keys({...e,...t}),function(f){if(f==="__proto__"||f==="constructor"||f==="prototype")return;const g=A.hasOwnProp(d,f)?d[f]:s,m=A.hasOwnProp(e,f)?e[f]:void 0,h=A.hasOwnProp(t,f)?t[f]:void 0,p=g(m,h,f);A.isUndefined(p)&&g!==l||(n[f]=p)}),A.hasOwnProp(t,"validateStatus")&&A.isUndefined(t.validateStatus)&&a("validateStatusUndefinedResolves")===!1&&(A.hasOwnProp(e,"validateStatus")?n.validateStatus=r(void 0,e.validateStatus):delete n.validateStatus),n}const J_=["content-type","content-length"];function ex(e,t,n){if(n!=="content-only"){e.set(t);return}Object.entries(t).forEach(([r,s])=>{J_.includes(r.toLowerCase())&&e.set(r,s)})}const tx=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16)));function gp(e){const t=Mn({},e),n=g=>A.hasOwnProp(t,g)?t[g]:void 0,r=n("data");let s=n("withXSRFToken");const i=n("xsrfHeaderName"),o=n("xsrfCookieName");let a=n("headers");const l=n("auth"),d=n("baseURL"),u=n("allowAbsoluteUrls"),f=n("url");if(t.headers=a=ze.from(a),t.url=dp(hp(d,f,u,t),n("params"),n("paramsSerializer")),l){const g=A.getSafeProp(l,"username")||"",m=A.getSafeProp(l,"password")||"";a.set("Authorization","Basic "+btoa(g+":"+(m?tx(m):"")))}if(A.isFormData(r)&&(Be.hasStandardBrowserEnv||Be.hasStandardBrowserWebWorkerEnv||A.isReactNative(r)?a.setContentType(void 0):A.isFunction(r.getHeaders)&&ex(a,r.getHeaders(),n("formDataHeaderPolicy"))),Be.hasStandardBrowserEnv&&(A.isFunction(s)&&(s=s(t)),s===!0||s==null&&W_(t.url))){const m=i&&o&&K_.read(o);m&&a.set(i,m)}return t}const nx=typeof XMLHttpRequest<"u",rx=nx&&function(e){return new Promise(function(n,r){const s=gp(e);let i=s.data;const o=ze.from(s.headers).normalize();let{responseType:a,onUploadProgress:l,onDownloadProgress:d}=s,u,f,g,m,h;function p(){m&&m(),h&&h(),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};mp(function(E){n(E),p()},function(E){r(E),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&&A.forEach(ip(o),function(_,C){y.setRequestHeader(C,_)}),A.isUndefined(s.withCredentials)||(y.withCredentials=!!s.withCredentials),a&&a!=="json"&&(y.responseType=s.responseType),d&&([g,h]=si(d,!0),y.addEventListener("progress",g)),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=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)})},sx=(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=()=>A.asap(o),a},ix=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},ox=async function*(e,t){for await(const n of ax(e))yield*ix(n,t)},ax=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()}},Fl=(e,t,n,r)=>{const s=ox(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 g=i+=f;n(g)}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,cx=(e,t,n)=>t+2<n&&ii(e.charCodeAt(t+1))&&ii(e.charCodeAt(t+2));function lx(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 h=r.charCodeAt(m+1),p=r.charCodeAt(m+2);ii(h)&&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 g=Math.floor(o/4)*3-(l||0);return g>0?g:0}let i=0;for(let o=0,a=r.length;o<a;o++){const l=r.charCodeAt(o);if(l===37&&cx(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",Ul=64*1024,{isFunction:Es}=A,dx=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16))),Bl=e=>{if(!A.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},$l=(e,...t)=>{try{return!!e(...t)}catch{return!1}},ux=e=>{const t=e.indexOf("://");let n=e;return t!==-1&&(n=n.slice(t+3)),n.includes("@")||n.includes(":")},fx=e=>{const t=A.global!==void 0&&A.global!==null?A.global:globalThis,{ReadableStream:n,TextEncoder:r}=t;e=A.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:s,Request:i,Response:o}=e,a=s?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())),g=l&&u&&$l(()=>{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&&$l(()=>A.isReadableStream(new o("").body)),h={stream:m&&(b=>b.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(b=>{!h[b]&&(h[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(A.isBlob(b))return b.size;if(A.isSpecCompliantForm(b))return(await new i(Be.origin,{method:"POST",body:b}).arrayBuffer()).byteLength;if(A.isArrayBufferView(b)||A.isArrayBuffer(b))return b.byteLength;if(A.isURLSearchParams(b)&&(b=b+""),A.isString(b))return(await f(b)).byteLength},y=async(b,v)=>{const x=A.toFiniteNumber(b.getContentLength());return x??p(v)};return async b=>{let{url:v,method:x,data:_,signal:C,cancelToken:P,timeout:E,onDownloadProgress:k,onUploadProgress:D,responseType:I,headers:N,withCredentials:O="same-origin",fetchOptions:B,maxContentLength:R,maxBodyLength:H}=gp(b);const F=A.isNumber(R)&&R>-1,M=A.isNumber(H)&&H>-1,L=ee=>A.hasOwnProp(b,ee)?b[ee]:void 0;let U=s||fetch;I=I?(I+"").toLowerCase():"text";let K=sx([C,P&&P.toAbortSignal()],E),j=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,j);try{let ee;const Z=L("auth");if(Z){const X=A.getSafeProp(Z,"username")||"",Ae=A.getSafeProp(Z,"password")||"";ee={username:X,password:Ae}}if(ux(v)){const X=new URL(v,Be.origin);if(!ee&&(X.username||X.password)){const Ae=Bl(X.username),Fe=Bl(X.password);ee={username:Ae,password:Fe}}(X.username||X.password)&&(X.username="",X.password="",v=X.href)}if(ee&&(N.delete("authorization"),N.set("Authorization","Basic "+btoa(dx((ee.username||"")+":"+(ee.password||""))))),F&&typeof v=="string"&&v.startsWith("data:")&&lx(v)>R)throw new q("maxContentLength size of "+R+" exceeded",q.ERR_BAD_RESPONSE,b,j);if(M&&x!=="get"&&x!=="head"){const X=await p(_);if(typeof X=="number"&&isFinite(X)&&(z=X,X>H))throw ue()}const $=M&&(A.isReadableStream(_)||A.isStream(_)),ye=(X,Ae,Fe)=>Fl(X,Ul,Qe=>{if(M&&Qe>H)throw de=ue();Ae&&Ae(Qe)},Fe);if(g&&x!=="get"&&x!=="head"&&(D||$)){if(z=z??await y(N,_),z!==0||$){let X=new i(v,{method:"POST",body:_,duplex:"half"}),Ae;if(A.isFormData(_)&&(Ae=X.headers.get("content-type"))&&N.setContentType(Ae),X.body){const[Fe,Qe]=D&&Ll(z,si(jl(D)))||[];_=ye(X.body,Fe,Qe)}}}else if($&&!l&&u&&x!=="get"&&x!=="head")_=ye(_);else if($&&l&&!g&&x!=="get"&&x!=="head")throw new q("Stream request bodies are not supported by the current fetch implementation",q.ERR_NOT_SUPPORT,b,j);A.isString(O)||(O=O?"include":"omit");const ae=l&&"credentials"in i.prototype;if(A.isFormData(_)){const X=N.getContentType();X&&/^multipart\/form-data/i.test(X)&&!/boundary=/i.test(X)&&N.delete("content-type")}N.set("User-Agent","axios/"+pc,!1);const ie={...B,signal:K,method:x.toUpperCase(),headers:ip(N.normalize()),body:_,duplex:"half",credentials:ae?O:void 0};j=l&&new i(v,ie);let te=await(l?U(j,B):U(v,ie));const je=ze.from(te.headers);if(F){const X=A.toFiniteNumber(je.getContentLength());if(X!=null&&X>R)throw new q("maxContentLength size of "+R+" exceeded",q.ERR_BAD_RESPONSE,b,j)}const Re=m&&(I==="stream"||I==="response");if(m&&te.body&&(k||F||Re&&se)){const X={};["status","statusText","headers"].forEach($e=>{X[$e]=te[$e]});const Ae=A.toFiniteNumber(je.getContentLength()),[Fe,Qe]=k&&Ll(Ae,si(jl(k),!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,j);Fe&&Fe($e)};te=new o(Fl(te.body,Ul,re,()=>{Qe&&Qe(),se&&se()}),X)}I=I||"text";let Oe=await h[A.findKey(h,I)||"text"](te,b);if(F&&!m&&!Re){let X;if(Oe!=null&&(typeof Oe.byteLength=="number"?X=Oe.byteLength:typeof Oe.size=="number"?X=Oe.size:typeof Oe=="string"&&(X=typeof r=="function"?new r().encode(Oe).byteLength:Oe.length)),typeof X=="number"&&X>R)throw new q("maxContentLength size of "+R+" exceeded",q.ERR_BAD_RESPONSE,b,j)}return!Re&&se&&se(),await new Promise((X,Ae)=>{mp(X,Ae,{data:Oe,headers:ze.from(te.headers),status:te.status,statusText:te.statusText,config:b,request:j})})}catch(ee){if(se&&se(),K&&K.aborted&&K.reason instanceof q){const Z=K.reason;throw Z.config=b,j&&(Z.request=j),ee!==Z&&(Z.cause=ee),Z}throw de?(j&&!de.request&&(de.request=j),de):ee instanceof q?(j&&!ee.request&&(ee.request=j),ee):ee&&ee.name==="TypeError"&&/Load failed|fetch/i.test(ee.message)?Object.assign(new q("Network Error",q.ERR_NETWORK,b,j,ee&&ee.response),{cause:ee.cause||ee}):q.from(ee,ee&&ee.code,b,j,ee&&ee.response)}}},px=new Map,yp=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=px;for(;a--;)l=i[a],d=u.get(l),d===void 0&&u.set(l,d=a?new Map:fx(t)),u=d;return d};yp();const mc={http:T_,xhr:rx,fetch:{get:yp}};A.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 Vl=e=>`- ${e}`,mx=e=>A.isFunction(e)||e===null||e===!1;function hx(e,t){e=A.isArray(e)?e:[e];const{length:n}=e;let r,s;const i={};for(let o=0;o<n;o++){r=e[o];let a;if(s=r,!mx(r)&&(s=mc[(a=String(r)).toLowerCase()],s===void 0))throw new q(`Unknown adapter '${a}'`);if(s&&(A.isFunction(s)||(s=s.get(t))))break;i[a||"#"+o]=s}if(!s){const o=Object.entries(i).map(([l,d])=>`adapter ${l} `+(d===!1?"is not supported by the environment":"is not available in the build"));let a=n?o.length>1?`since :
|
|
76
|
-
`+o.map(
|
|
77
|
-
`):" "+
|
|
73
|
+
*/var Al;function aw(){return Al||(Al=1,process.env.NODE_ENV!=="production"&&(function(){function e(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=C,n=tm(),r=typeof Object.is=="function"?Object.is:e,s=n.useSyncExternalStore,i=t.useRef,o=t.useEffect,a=t.useMemo,l=t.useDebugValue;po.useSyncExternalStoreWithSelector=function(d,f,u,g,p){var y=i(null);if(y.current===null){var m={hasValue:!1,value:null};y.current=m}else m=y.current;y=a(function(){function b(T){if(!v){if(v=!0,_=T,T=g(T),p!==void 0&&m.hasValue){var P=m.value;if(p(P,T))return x=P}return x=T}if(P=x,r(_,T))return P;var A=g(T);return p!==void 0&&p(P,A)?(_=T,P):(_=T,x=A)}var v=!1,_,x,S=u===void 0?null:u;return[function(){return b(f())},S===null?void 0:function(){return b(S())}]},[f,u,g,p]);var h=s(d,y[0],y[1]);return o(function(){m.hasValue=!0,m.value=h},[h]),l(h),h},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),po}var Ol;function cw(){return Ol||(Ol=1,process.env.NODE_ENV==="production"?Os.exports=ow():Os.exports=aw()),Os.exports}var lw=cw();const dw=rw(lw),nm={},{useDebugValue:uw}=C,{useSyncExternalStoreWithSelector:fw}=dw;let Nl=!1;const mw=e=>e;function pw(e,t=mw,n){(nm?"production":void 0)!=="production"&&n&&!Nl&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),Nl=!0);const r=fw(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return uw(r),r}const Rl=e=>{(nm?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?nw(e):e,n=(r,s)=>pw(t,r,s);return Object.assign(n,t),n},$i=e=>e?Rl(e):Rl,Ll={source:null,entryPrice:null,stopLoss:"",takeProfit:"",side:null,showEntryLine:!1,volumeLots:.01,digits:2,priceStep:.01},ie=$i(e=>({...Ll,setDraft:t=>e(n=>({source:t.source,entryPrice:t.entryPrice!==void 0?t.entryPrice:n.entryPrice,stopLoss:t.stopLoss??n.stopLoss,takeProfit:t.takeProfit??n.takeProfit,side:t.side!==void 0?t.side:n.side,showEntryLine:t.showEntryLine??n.showEntryLine,volumeLots:t.volumeLots??n.volumeLots,digits:t.digits??n.digits,priceStep:t.priceStep??n.priceStep})),setOrderSide:({side:t,entryPrice:n})=>e({side:t,entryPrice:n,showEntryLine:!0}),setStopLoss:t=>e({stopLoss:t}),setTakeProfit:t=>e({takeProfit:t}),setVolumeLots:t=>e({volumeLots:t}),clearEntryLinePreview:()=>e({side:null,entryPrice:null,showEntryLine:!1}),clearDraft:()=>e({...Ll})}));function ho(e,t){return e.toFixed(t)}function hw({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,isDragging:d,sidePanelTab:f="trade",onDragHandlePointerDown:u,onExpandedChange:g,onExpand:p,onPlaceOrder:y}){const[m,h]=C.useState(String(r)),[b,v]=C.useState(null),[_,x]=C.useState(f),S=ie(O=>O.setOrderSide),T=ie(O=>O.setVolumeLots);f!==_&&(x(f),v(null));const P=b??f==="scan";C.useEffect(()=>{g()},[P,g]);const A=()=>{const O=!P;O&&p(),v(O)},D=Number(Vt(Ht(e))),I=t!==null?xe(t,D):"—",N=n!==null?xe(n,D):"—",H=!o&&!a&&l!==""&&(t!==null&&n!==null),R=O=>{const U=Number(m),W=Number.isFinite(U)&&U>0?U:r,j=Math.max(i,W+O*s),ee=ho(j,2);h(ee),T(j)},F=()=>{const O=Number(m);if(!Number.isFinite(O)||O<=0){h(ho(r,2)),T(r);return}const U=Math.max(i,O),W=ho(U,2);h(W),T(U)},M=O=>{t===null||n===null||S({side:O,entryPrice:O==="buy"?n:t})},$=O=>{if(t===null||n===null||!l)return;const U=Number(m),W=Math.max(i,Number.isFinite(U)&&U>0?U:r);S({side:O,entryPrice:O==="buy"?n:t}),y({login:l,side:O,volumeLots:W,bid:t,ask:n})};return c.jsx("div",{className:`web-trading-widget-mini-order${P?" web-trading-widget-mini-order--expanded":" web-trading-widget-mini-order--collapsed"}`,children:c.jsxs("div",{className:"web-trading-widget-mini-order__row",children:[c.jsx("button",{type:"button","aria-label":"Move quick order panel",onPointerDown:u,className:`web-trading-widget-mini-order__drag-handle${d?" web-trading-widget-mini-order__drag-handle--grabbing":""}`,children:c.jsx(Zf,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2})}),P?c.jsxs(c.Fragment,{children:[c.jsxs("button",{type:"button",disabled:!H,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--sell",onMouseDown:()=>M("sell"),onClick:()=>$("sell"),children:[c.jsx("span",{className:"web-trading-widget-mini-order__price",children:I}),c.jsx("span",{className:"web-trading-widget-mini-order__label web-trading-widget-mini-order__label--sell",children:"SELL"})]}),c.jsxs("div",{className:"web-trading-widget-mini-order__volume",children:[c.jsx("button",{type:"button","aria-label":"Decrease volume",disabled:!H,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>R(-1),children:c.jsx(oi,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})}),c.jsx("input",{type:"text",inputMode:"decimal",value:m,disabled:!H,onChange:O=>h(O.target.value),onBlur:F,className:"web-trading-widget-mini-order__volume-input"}),c.jsx("button",{type:"button","aria-label":"Increase volume",disabled:!H,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>R(1),children:c.jsx($o,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})})]}),c.jsxs("button",{type:"button",disabled:!H,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--buy",onMouseDown:()=>M("buy"),onClick:()=>$("buy"),children:[c.jsx("span",{className:"web-trading-widget-mini-order__label web-trading-widget-mini-order__label--buy",children:"BUY"}),c.jsx("span",{className:"web-trading-widget-mini-order__price",children:N})]})]}):null,c.jsx("button",{type:"button","aria-label":P?"Collapse quick order panel":"Expand quick order panel","aria-expanded":P,className:"web-trading-widget-mini-order__toggle",onClick:A,children:P?c.jsx(Iv,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5}):c.jsx(Mv,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5})})]})})}const gw="web-trading-widget-mini-exec-panel-position",rm={x:56,y:96};function Dl(e,t){const n=t==null?void 0:t.offsetParent;if(!t||!n)return e;const r=Math.max(0,n.clientWidth-t.offsetWidth),s=Math.max(0,n.clientHeight-t.offsetHeight);return{x:Math.min(r,Math.max(0,e.x)),y:Math.min(s,Math.max(0,e.y))}}function jl(e,t){e.style.left=`${t.x}px`,e.style.top=`${t.y}px`}function yw(e,t){const n=t==null?void 0:t.offsetParent;return!t||!n?null:{x:e==="top-right"?Math.max(0,n.clientWidth-t.offsetWidth-16):rm.x,y:16}}function bw(e){if(typeof window>"u")return null;try{const t=window.localStorage.getItem(e);if(!t)return null;const n=JSON.parse(t);if(typeof n.x=="number"&&typeof n.y=="number")return{x:n.x,y:n.y}}catch{}return null}function Il(e,t){try{e.hasPointerCapture(t)&&e.releasePointerCapture(t)}catch{}}function sm(e){const t=(e==null?void 0:e.storageKey)??gw,n=(e==null?void 0:e.defaultPosition)??rm,r=e==null?void 0:e.defaultAlign,s=(e==null?void 0:e.isActive)??!0,i=C.useRef(null),[o,a]=C.useState(n),[l,d]=C.useState(!1),f=C.useRef(n),u=C.useRef(null);C.useEffect(()=>{f.current=o},[o]);const g=C.useCallback(m=>{const h=i.current,b=Dl(m,h);f.current=b,a(b),h&&jl(h,b)},[]),p=C.useCallback(()=>{g(f.current)},[g]);C.useEffect(()=>{if(!s)return;const m=bw(t);if(m){g(m);return}const h=r?yw(r,i.current):null;g(h??f.current)},[g,r,s,t]);const y=C.useCallback(m=>{m.preventDefault(),m.stopPropagation();const h=m.currentTarget,b=i.current;if(!b)return;const v=m.pointerId;h.setPointerCapture(v);const _=m.clientX,x=m.clientY,S=f.current;d(!0),document.body.style.cursor="grabbing",document.body.style.userSelect="none";const T=(D,I)=>{const N=Dl({x:S.x+(D-_),y:S.y+(I-x)},b);f.current=N,jl(b,N)},P=D=>{if(D.pointerId===v){Il(h,v),h.removeEventListener("pointermove",A),h.removeEventListener("pointerup",P),h.removeEventListener("pointercancel",P),u.current=null,d(!1),a(f.current),document.body.style.cursor="",document.body.style.userSelect="";try{window.localStorage.setItem(t,JSON.stringify(f.current))}catch{}}},A=D=>{D.pointerId===v&&(D.preventDefault(),T(D.clientX,D.clientY))};h.addEventListener("pointermove",A),h.addEventListener("pointerup",P),h.addEventListener("pointercancel",P),u.current=()=>{Il(h,v),h.removeEventListener("pointermove",A),h.removeEventListener("pointerup",P),h.removeEventListener("pointercancel",P),document.body.style.cursor="",document.body.style.userSelect="",d(!1)}},[t]);return C.useEffect(()=>{const m=()=>{g(f.current)};return window.addEventListener("resize",m),()=>{var h;window.removeEventListener("resize",m),(h=u.current)==null||h.call(u),u.current=null,document.body.style.cursor="",document.body.style.userSelect=""}},[g]),{panelRef:i,position:o,isDragging:l,onDragStart:y,reclamp:p}}const im=200,vw=201,ww=202,_w=203,xw=204,om=0,Sw=2,am=0;function cs(e){const t=Number(e.trim());if(!Number.isFinite(t))throw new Error("Invalid trading account login.");return t}function mc(e){return Math.round(e*1e4)}function Cw(e){return e>=2&&e<=7}function Tw(e){return{Action:xw,Order:Number(e.orderTicket),Login:cs(e.login),Symbol:e.symbol.replace(/m$/i,""),Type:e.orderType}}function Ew(e){return{Action:ww,Login:cs(e.login),Symbol:e.symbol.replace(/m$/i,""),Position:Number(e.positionTicket),Digits:e.digits,Comment:e.comment??"",...e.priceSL!==void 0?{PriceSL:e.priceSL}:{},...e.priceTP!==void 0?{PriceTP:e.priceTP}:{}}}function Pw(e){return{Action:_w,Order:Number(e.orderTicket),Login:cs(e.login),Symbol:e.symbol.replace(/m$/i,""),Type:e.orderType,Volume:mc(e.volumeLots),Digits:e.digits,TypeTime:e.typeTime,Comment:e.comment??"order modify",PriceOrder:e.priceOrder,...e.priceSL!==void 0?{PriceSL:e.priceSL}:{},...e.priceTP!==void 0?{PriceTP:e.priceTP}:{},...e.priceTrigger!==void 0?{PriceTrigger:e.priceTrigger}:{}}}function kw(e){const t=e.positionSide==="buy"?1:0;return{Action:im,Login:cs(e.login),Symbol:e.symbol.replace(/m$/i,""),Type:t,TypeFill:om,Volume:mc(e.volumeLots),Digits:e.digits,TypeTime:am,Comment:e.comment??"",Position:Number(e.positionTicket)}}function Aw(e){const t=!Cw(e.orderType);return{Action:t?im:vw,Login:cs(e.login),Symbol:e.symbol,Type:e.orderType,TypeFill:t?om:Sw,Volume:mc(e.volumeLots),Digits:e.digits,TypeTime:e.typeTime??am,Comment:e.comment,...e.priceOrder!==void 0?{PriceOrder:e.priceOrder}:{},...e.priceSL!==void 0?{PriceSL:e.priceSL}:{},...e.priceTP!==void 0?{PriceTP:e.priceTP}:{},...e.priceTrigger!==void 0?{PriceTrigger:e.priceTrigger}:{},...e.timeExpiration!==void 0?{TimeExpiration:e.timeExpiration}:{}}}function Ow(e){return{async sendRequest(t){return e.post("/api/dealer/send_request",t,{headers:{"Content-Type":"application/json"}})},async getPositions(t){return t.trim()?e.get(`/api/trade/position/page?login=${encodeURIComponent(t)}&offset=0&total=50`):null},async getOrders(t){return t.trim()?e.get(`/api/trade/order/page?login=${encodeURIComponent(t)}&offset=0&total=10`):null},async getDealsTotal(t,n,r){return t.trim()?e.get(`/api/trade/deal/total?login=${encodeURIComponent(t)}&from=${n}&to=${r}`):null},async getDeals(t,n,r,s,i){return t.trim()?e.get(`/api/trade/deal/page?login=${encodeURIComponent(t)}&from=${n}&to=${r}&offset=${s}&total=${i}`):null}}}const Nw=new Set(["10009","10008"]);function Dt(e){if(e===void 0||e==="")return;const t=Number(e);return Number.isFinite(t)?t:void 0}function Rw(e){const t=Dt(e);return t===void 0?.01:t/1e4}function Lw(e){var t;return(t=e.find(n=>n.answer))==null?void 0:t.answer}function Dw(e){var t,n,r,s;for(const i of e){const o=((t=i.result)==null?void 0:t.Retcode)??((n=i.answer)==null?void 0:n.ResultRetcode);if(o)return{retcode:String(o),price:Dt(((r=i.result)==null?void 0:r.Price)??((s=i.answer)==null?void 0:s.ResultPrice))}}return{retcode:""}}function Ur(e){return Nw.has(e)}function Dr(e,t){var v,_,x;if(!e||typeof e!="object")return null;const r=e.data;if(!(r!=null&&r.length))return null;const s=Lw(r),{retcode:i,price:o}=Dw(r),a=Ur(i),l=(s==null?void 0:s.ResultDeal)||(s==null?void 0:s.ResultOrder)||(s==null?void 0:s.Order),d=((v=s==null?void 0:s.Symbol)==null?void 0:v.trim())||t.symbol,f=Ke(d),u=Dt(s==null?void 0:s.Type),g=u!==void 0?u%2===0?"buy":"sell":t.side,p=Dt(s==null?void 0:s.ResultPrice)??Dt(s==null?void 0:s.PriceOrder)??o??t.openPrice,y=Dt(s==null?void 0:s.ResultMarketBid),m=Dt(s==null?void 0:s.ResultMarketAsk),h=g==="buy"?y??p:m??p,b=zv(f);return{ticket:String(l||Math.floor(Date.now()/1e3)),login:((_=s==null?void 0:s.Login)==null?void 0:_.trim())||t.login,symbol:f,displaySymbol:Ii(f),side:g,volumeLots:Rw(s==null?void 0:s.Volume)||t.volumeLots,openPrice:p,currentPrice:h,stopLoss:Dt(s==null?void 0:s.PriceSL),takeProfit:Dt(s==null?void 0:s.PriceTP),comment:((x=s==null?void 0:s.Comment)==null?void 0:x.trim())||t.comment,digits:Math.round(b),retcode:i,isSuccess:a,marketBid:y,marketAsk:m}}function jw(e){return e.type==="buy"?e.marketBid??e.currentPrice:e.marketAsk??e.currentPrice}function Iw(e,t){return{async submitOrder(n){const r=n.login.trim();if(!r)return{success:!1,message:"Please select a trading account."};const s=Math.max(.01,n.volumeLots),i=Ui(n.symbolTicker,t),o=Number(Vt(Ht(n.symbolTicker,t))),a=Fi(n.executionMode),l=cc(n.orderType),d=n.typeTime;if(!a&&n.priceOrder===void 0)return{success:!1,message:l?"Please set a limit price for this order.":"Please set an order price for pending orders."};if(l&&n.priceTrigger===void 0)return{success:!1,message:"Please set a stop price for stop limit orders."};if(!a&&!Bi(d,n.expirationDateTime??"",n.expirationDay??""))return{success:!1,message:"Please set an expiration date for this order."};const f=a?n.side==="buy"?n.ask:n.bid:n.priceOrder??(n.side==="buy"?n.ask:n.bid),u=a?void 0:em(d,n.expirationDateTime??"",n.expirationDay??"");try{const g=Aw({login:r,symbol:i,volumeLots:s,orderType:n.orderType,digits:o,comment:n.comment.trim(),priceOrder:ac(n.orderType)?n.priceOrder:void 0,priceTrigger:l?n.priceTrigger:void 0,priceSL:n.stopLoss,priceTP:n.takeProfit,typeTime:a?void 0:d,timeExpiration:u}),p=await e.sendRequest(g),y=Dr(p,{login:r,symbol:i,side:ci(n.orderType),volumeLots:s,openPrice:f,digits:o,comment:n.comment.trim()});return y!=null&&y.isSuccess?{success:!0,ticket:y.ticket,side:y.side,volumeLots:y.volumeLots,displaySymbol:y.displaySymbol,price:y.openPrice}:{success:!1,message:p&&typeof p=="object"&&"message"in p&&typeof p.message=="string"?p.message:"Order was not accepted by the dealer."}}catch(g){return{success:!1,message:g instanceof Error?g.message:"Failed to place order."}}},async closePosition(n){try{const r=jw(n),s=kw({login:n.login,symbol:n.symbol,positionTicket:n.ticket,volumeLots:n.volumeLots,positionSide:n.type,digits:n.digits,comment:n.comment.trim()}),i=await e.sendRequest(s),o=Dr(i,{login:n.login,symbol:n.symbol,side:n.type==="buy"?"sell":"buy",volumeLots:n.volumeLots,openPrice:r,digits:n.digits,comment:n.comment.trim()});return o&&!Ur(o.retcode)?{success:!1,message:`Close failed (retcode ${o.retcode}).`}:{success:!0}}catch(r){return{success:!1,message:r instanceof Error?r.message:"Failed to close position."}}},async deleteOrder(n){try{const r=Tw({login:n.login,orderTicket:n.ticket,symbol:n.symbol,orderType:n.orderType}),s=await e.sendRequest(r),i=Dr(s,{login:n.login,symbol:n.symbol,side:n.side,volumeLots:n.volumeLots,openPrice:n.orderPrice,digits:n.digits,comment:n.comment});return i&&!Ur(i.retcode)?{success:!1,message:`Delete failed (retcode ${i.retcode}).`}:{success:!0}}catch(r){return{success:!1,message:r instanceof Error?r.message:"Failed to delete order."}}},async modifyOrder(n,r){try{const s=Pw({login:n.login,orderTicket:n.ticket,symbol:n.symbol,orderType:n.orderType,volumeLots:r.volumeLots,digits:n.digits,priceOrder:r.priceOrder,priceTrigger:r.priceTrigger,priceSL:r.stopLoss,priceTP:r.takeProfit,typeTime:n.typeTime,comment:r.comment.trim()||"order modify"}),i=await e.sendRequest(s),o=Dr(i,{login:n.login,symbol:n.symbol,side:n.side,volumeLots:r.volumeLots,openPrice:r.priceOrder,digits:n.digits,comment:r.comment.trim()});return o&&!Ur(o.retcode)?{success:!1,message:`Modify failed (retcode ${o.retcode}).`}:{success:!0}}catch(s){return{success:!1,message:s instanceof Error?s.message:"Failed to modify order."}}},async modifyPosition(n,r){try{const s=Ew({login:n.login,positionTicket:n.ticket,symbol:n.symbol,digits:n.digits,priceSL:r.stopLoss,priceTP:r.takeProfit,comment:r.comment.trim()}),i=await e.sendRequest(s),o=Dr(i,{login:n.login,symbol:n.symbol,side:n.type,volumeLots:n.volumeLots,openPrice:n.openPrice,digits:n.digits,comment:r.comment.trim()});return o&&!Ur(o.retcode)?{success:!1,message:`Modify failed (retcode ${o.retcode}).`}:{success:!0}}catch(s){return{success:!1,message:s instanceof Error?s.message:"Failed to modify position."}}}}}function cm(e,t){return function(){return e.apply(t,arguments)}}const{toString:Mw}=Object.prototype,{getPrototypeOf:gr}=Object,{iterator:ls,toStringTag:lm}=Symbol,li=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Zr=(e,t)=>{let n=e;const r=[];for(;n!=null&&n!==Object.prototype;){if(r.indexOf(n)!==-1)return!1;if(r.push(n),li(n,t))return!0;n=gr(n)}return!1},Fw=(e,t)=>e!=null&&Zr(e,t)?e[t]:void 0,pc=(e=>t=>{const n=Mw.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),_t=e=>(e=e.toLowerCase(),t=>pc(t)===e),Vi=e=>t=>typeof t===e,{isArray:In}=Array,yr=Vi("undefined");function kr(e){return e!==null&&!yr(e)&&e.constructor!==null&&!yr(e.constructor)&&Qe(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const dm=_t("ArrayBuffer");function Uw(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&dm(e.buffer),t}const Bw=Vi("string"),Qe=Vi("function"),um=Vi("number"),Ar=e=>e!==null&&typeof e=="object",$w=e=>e===!0||e===!1,zs=e=>{if(!Ar(e))return!1;const t=gr(e);return(t===null||t===Object.prototype||gr(t)===null)&&!Zr(e,lm)&&!Zr(e,ls)},Vw=e=>{if(!Ar(e)||kr(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Hw=_t("Date"),zw=_t("File"),Ww=e=>!!(e&&typeof e.uri<"u"),Kw=e=>e&&typeof e.getParts<"u",qw=_t("Blob"),Gw=_t("FileList"),Zw=e=>Ar(e)&&Qe(e.pipe);function Yw(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const Ml=Yw(),Fl=typeof Ml.FormData<"u"?Ml.FormData:void 0,Qw=e=>{if(!e)return!1;if(Fl&&e instanceof Fl)return!0;const t=gr(e);if(!t||t===Object.prototype||!Qe(e.append))return!1;const n=pc(e);return n==="formdata"||n==="object"&&Qe(e.toString)&&e.toString()==="[object FormData]"},Xw=_t("URLSearchParams"),[Jw,e_,t_,n_]=["ReadableStream","Request","Response","Headers"].map(_t),r_=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ds(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),In(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(kr(e))return;const i=n?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let a;for(r=0;r<o;r++)a=i[r],t.call(null,e[a],a,e)}}function fm(e,t){if(kr(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r=n.length,s;for(;r-- >0;)if(s=n[r],t===s.toLowerCase())return s;return null}const vn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,mm=e=>!yr(e)&&e!==vn;function Ho(...e){const{caseless:t,skipUndefined:n}=mm(this)&&this||{},r={},s=(i,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const a=t&&typeof o=="string"&&fm(r,o)||o,l=li(r,a)?r[a]:void 0;zs(l)&&zs(i)?r[a]=Ho(l,i):zs(i)?r[a]=Ho({},i):In(i)?r[a]=i.slice():(!n||!yr(i))&&(r[a]=i)};for(let i=0,o=e.length;i<o;i++){const a=e[i];if(!a||kr(a)||(ds(a,s),typeof a!="object"||In(a)))continue;const l=Object.getOwnPropertySymbols(a);for(let d=0;d<l.length;d++){const f=l[d];h_.call(a,f)&&s(a[f],f)}}return r}const s_=(e,t,n,{allOwnKeys:r}={})=>(ds(t,(s,i)=>{n&&Qe(s)?Object.defineProperty(e,i,{__proto__:null,value:cm(s,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,i,{__proto__:null,value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),i_=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),o_=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),n&&Object.assign(e.prototype,n)},a_=(e,t,n,r)=>{let s,i,o;const a={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)o=s[i],(!r||r(o,e,t))&&!a[o]&&(t[o]=e[o],a[o]=!0);e=n!==!1&&gr(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},c_=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},l_=e=>{if(!e)return null;if(In(e))return e;let t=e.length;if(!um(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},d_=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&gr(Uint8Array)),u_=(e,t)=>{const r=(e&&e[ls]).call(e);let s;for(;(s=r.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},f_=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},m_=_t("HTMLFormElement"),p_=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),{propertyIsEnumerable:h_}=Object.prototype,g_=_t("RegExp"),pm=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};ds(n,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(r[i]=o||s)}),Object.defineProperties(e,r)},y_=e=>{pm(e,(t,n)=>{if(Qe(e)&&["arguments","caller","callee"].includes(n))return!1;const r=e[n];if(Qe(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},b_=(e,t)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return In(e)?r(e):r(String(e).split(t)),n},v_=()=>{},w_=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function __(e){return!!(e&&Qe(e.append)&&e[lm]==="FormData"&&e[ls])}const x_=e=>{const t=new WeakSet,n=r=>{if(Ar(r)){if(t.has(r))return;if(kr(r))return r;if(!("toJSON"in r)){t.add(r);const s=In(r)?[]:{};return ds(r,(i,o)=>{const a=n(i);!yr(a)&&(s[o]=a)}),t.delete(r),s}}return r};return n(e)},S_=_t("AsyncFunction"),C_=e=>e&&(Ar(e)||Qe(e))&&Qe(e.then)&&Qe(e.catch),hm=((e,t)=>e?setImmediate:t?((n,r)=>(vn.addEventListener("message",({source:s,data:i})=>{s===vn&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),vn.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Qe(vn.postMessage)),T_=typeof queueMicrotask<"u"?queueMicrotask.bind(vn):typeof process<"u"&&process.nextTick||hm,gm=e=>e!=null&&Qe(e[ls]),E_=e=>e!=null&&Zr(e,ls)&&gm(e),k={isArray:In,isArrayBuffer:dm,isBuffer:kr,isFormData:Qw,isArrayBufferView:Uw,isString:Bw,isNumber:um,isBoolean:$w,isObject:Ar,isPlainObject:zs,isEmptyObject:Vw,isReadableStream:Jw,isRequest:e_,isResponse:t_,isHeaders:n_,isUndefined:yr,isDate:Hw,isFile:zw,isReactNativeBlob:Ww,isReactNative:Kw,isBlob:qw,isRegExp:g_,isFunction:Qe,isStream:Zw,isURLSearchParams:Xw,isTypedArray:d_,isFileList:Gw,forEach:ds,merge:Ho,extend:s_,trim:r_,stripBOM:i_,inherits:o_,toFlatObject:a_,kindOf:pc,kindOfTest:_t,endsWith:c_,toArray:l_,forEachEntry:u_,matchAll:f_,isHTMLForm:m_,hasOwnProperty:li,hasOwnProp:li,hasOwnInPrototypeChain:Zr,getSafeProp:Fw,reduceDescriptors:pm,freezeMethods:y_,toObjectSet:b_,toCamelCase:p_,noop:v_,toFiniteNumber:w_,findKey:fm,global:vn,isContextDefined:mm,isSpecCompliantForm:__,toJSONObject:x_,isAsyncFn:S_,isThenable:C_,setImmediate:hm,asap:T_,isIterable:gm,isSafeIterable:E_},P_=k.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),k_=e=>{const t={};let n,r,s;return e&&e.split(`
|
|
74
|
+
`).forEach(function(o){s=o.indexOf(":"),n=o.substring(0,s).trim().toLowerCase(),r=o.substring(s+1).trim(),!(!n||t[n]&&P_[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t};function A_(e){let t=0,n=e.length;for(;t<n;){const r=e.charCodeAt(t);if(r!==9&&r!==32)break;t+=1}for(;n>t;){const r=e.charCodeAt(n-1);if(r!==9&&r!==32)break;n-=1}return t===0&&n===e.length?e:e.slice(t,n)}const O_=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),N_=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function hc(e,t){return k.isArray(e)?e.map(n=>hc(n,t)):A_(String(e).replace(t,""))}const R_=e=>hc(e,O_),L_=e=>hc(e,N_);function ym(e){const t=Object.create(null);return k.forEach(e.toJSON(),(n,r)=>{t[r]=L_(n)}),t}const Ul=Symbol("internals");function jr(e){return e&&String(e).trim().toLowerCase()}function Ws(e){return e===!1||e==null?e:k.isArray(e)?e.map(Ws):R_(String(e))}function D_(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const j_=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function go(e,t,n,r,s){if(k.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!k.isString(t)){if(k.isString(r))return t.indexOf(r)!==-1;if(k.isRegExp(r))return r.test(t)}}function I_(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function M_(e,t){const n=k.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{__proto__:null,value:function(s,i,o){return this[r].call(this,t,s,i,o)},configurable:!0})})}let We=class{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function i(a,l,d){const f=jr(l);if(!f)return;const u=k.findKey(s,f);(!u||s[u]===void 0||d===!0||d===void 0&&s[u]!==!1)&&(s[u||l]=Ws(a))}const o=(a,l)=>k.forEach(a,(d,f)=>i(d,f,l));if(k.isPlainObject(t)||t instanceof this.constructor)o(t,n);else if(k.isString(t)&&(t=t.trim())&&!j_(t))o(k_(t),n);else if(k.isObject(t)&&k.isSafeIterable(t)){let a=Object.create(null),l,d;for(const f of t){if(!k.isArray(f))throw new TypeError("Object iterator must return a key-value pair");d=f[0],k.hasOwnProp(a,d)?(l=a[d],a[d]=k.isArray(l)?[...l,f[1]]:[l,f[1]]):a[d]=f[1]}o(a,n)}else t!=null&&i(n,t,r);return this}get(t,n){if(t=jr(t),t){const r=k.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return D_(s);if(k.isFunction(n))return n.call(this,s,r);if(k.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=jr(t),t){const r=k.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||go(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function i(o){if(o=jr(o),o){const a=k.findKey(r,o);a&&(!n||go(r,r[a],a,n))&&(delete r[a],s=!0)}}return k.isArray(t)?t.forEach(i):i(t),s}clear(t){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const i=n[r];(!t||go(this,this[i],i,t,!0))&&(delete this[i],s=!0)}return s}normalize(t){const n=this,r={};return k.forEach(this,(s,i)=>{const o=k.findKey(r,i);if(o){n[o]=Ws(s),delete n[i];return}const a=t?I_(i):String(i).trim();a!==i&&delete n[i],n[a]=Ws(s),r[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return k.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&k.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(`
|
|
75
|
+
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[Ul]=this[Ul]={accessors:{}}).accessors,s=this.prototype;function i(o){const a=jr(o);r[a]||(M_(s,o),r[a]=!0)}return k.isArray(t)?t.forEach(i):i(t),this}};We.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);k.reduceDescriptors(We.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});k.freezeMethods(We);const F_="[REDACTED ****]";function U_(e){if(k.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(k.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}function B_(e,t){const n=new Set(t.map(i=>String(i).toLowerCase())),r=[],s=i=>{if(i===null||typeof i!="object"||k.isBuffer(i))return i;if(r.indexOf(i)!==-1)return;i instanceof We&&(i=i.toJSON()),r.push(i);let o;if(k.isArray(i))o=[],i.forEach((a,l)=>{const d=s(a);k.isUndefined(d)||(o[l]=d)});else{if(!k.isPlainObject(i)&&U_(i))return r.pop(),i;o=Object.create(null);for(const[a,l]of Object.entries(i)){const d=n.has(a.toLowerCase())?F_:s(l);k.isUndefined(d)||(o[a]=d)}}return r.pop(),o};return s(e)}let Z=class bm extends Error{static from(t,n,r,s,i,o){const a=new bm(t.message,n||t.code,r,s,i);return a.cause=t,a.name=t.name,t.status!=null&&a.status==null&&(a.status=t.status),o&&Object.assign(a,o),a}constructor(t,n,r,s,i){super(t),Object.defineProperty(this,"message",{__proto__:null,value:t,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),r&&(this.config=r),s&&(this.request=s),i&&(this.response=i,this.status=i.status)}toJSON(){const t=this.config,n=t&&k.hasOwnProp(t,"redact")?t.redact:void 0,r=k.isArray(n)&&n.length>0?B_(t,n):k.toJSONObject(t);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:r,code:this.code,status:this.status}}};Z.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";Z.ERR_BAD_OPTION="ERR_BAD_OPTION";Z.ECONNABORTED="ECONNABORTED";Z.ETIMEDOUT="ETIMEDOUT";Z.ECONNREFUSED="ECONNREFUSED";Z.ERR_NETWORK="ERR_NETWORK";Z.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";Z.ERR_DEPRECATED="ERR_DEPRECATED";Z.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";Z.ERR_BAD_REQUEST="ERR_BAD_REQUEST";Z.ERR_CANCELED="ERR_CANCELED";Z.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";Z.ERR_INVALID_URL="ERR_INVALID_URL";Z.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const $_=null,vm=100;function zo(e){return k.isPlainObject(e)||k.isArray(e)}function wm(e){return k.endsWith(e,"[]")?e.slice(0,-2):e}function yo(e,t,n){return e?e.concat(t).map(function(s,i){return s=wm(s),!n&&i?"["+s+"]":s}).join(n?".":""):t}function V_(e){return k.isArray(e)&&!e.some(zo)}const H_=k.toFlatObject(k,{},null,function(t){return/^is[A-Z]/.test(t)});function Hi(e,t,n){if(!k.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=k.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(v,_){return!k.isUndefined(_[v])});const r=n.metaTokens,s=n.visitor||y,i=n.dots,o=n.indexes,a=n.Blob||typeof Blob<"u"&&Blob,l=n.maxDepth===void 0?vm:n.maxDepth,d=a&&k.isSpecCompliantForm(t),f=[];if(!k.isFunction(s))throw new TypeError("visitor must be a function");function u(b){if(b===null)return"";if(k.isDate(b))return b.toISOString();if(k.isBoolean(b))return b.toString();if(!d&&k.isBlob(b))throw new Z("Blob is not supported. Use a Buffer instead.");return k.isArrayBuffer(b)||k.isTypedArray(b)?d&&typeof Blob=="function"?new Blob([b]):Buffer.from(b):b}function g(b){if(b>l)throw new Z("Object is too deeply nested ("+b+" levels). Max depth: "+l,Z.ERR_FORM_DATA_DEPTH_EXCEEDED)}function p(b,v){if(l===1/0)return JSON.stringify(b);const _=[];return JSON.stringify(b,function(S,T){if(!k.isObject(T))return T;for(;_.length&&_[_.length-1]!==this;)_.pop();return _.push(T),g(v+_.length-1),T})}function y(b,v,_){let x=b;if(k.isReactNative(t)&&k.isReactNativeBlob(b))return t.append(yo(_,v,i),u(b)),!1;if(b&&!_&&typeof b=="object"){if(k.endsWith(v,"{}"))v=r?v:v.slice(0,-2),b=p(b,1);else if(k.isArray(b)&&V_(b)||(k.isFileList(b)||k.endsWith(v,"[]"))&&(x=k.toArray(b)))return v=wm(v),x.forEach(function(T,P){!(k.isUndefined(T)||T===null)&&t.append(o===!0?yo([v],P,i):o===null?v:v+"[]",u(T))}),!1}return zo(b)?!0:(t.append(yo(_,v,i),u(b)),!1)}const m=Object.assign(H_,{defaultVisitor:y,convertValue:u,isVisitable:zo});function h(b,v,_=0){if(!k.isUndefined(b)){if(g(_),f.indexOf(b)!==-1)throw new Error("Circular reference detected in "+v.join("."));f.push(b),k.forEach(b,function(S,T){(!(k.isUndefined(S)||S===null)&&s.call(t,S,k.isString(T)?T.trim():T,v,m))===!0&&h(S,v?v.concat(T):[T],_+1)}),f.pop()}}if(!k.isObject(e))throw new TypeError("data must be an object");return h(e),t}function Bl(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(r){return t[r]})}function gc(e,t){this._pairs=[],e&&Hi(e,this,t)}const _m=gc.prototype;_m.append=function(t,n){this._pairs.push([t,n])};_m.toString=function(t){const n=t?function(r){return t.call(this,r,Bl)}:Bl;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function z_(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function xm(e,t,n){if(!t)return e;const r=k.isFunction(n)?{serialize:n}:n,s=k.getSafeProp(r,"encode")||z_,i=k.getSafeProp(r,"serialize");let o;if(i?o=i(t,r):o=k.isURLSearchParams(t)?t.toString():new gc(t,r).toString(s),o){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class $l{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){k.forEach(this.handlers,function(r){r!==null&&t(r)})}}const yc={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},W_=typeof URLSearchParams<"u"?URLSearchParams:gc,K_=typeof FormData<"u"?FormData:null,q_=typeof Blob<"u"?Blob:null,G_={isBrowser:!0,classes:{URLSearchParams:W_,FormData:K_,Blob:q_},protocols:["http","https","file","blob","url","data"]},bc=typeof window<"u"&&typeof document<"u",Wo=typeof navigator=="object"&&navigator||void 0,Z_=bc&&(!Wo||["ReactNative","NativeScript","NS"].indexOf(Wo.product)<0),Y_=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Q_=bc&&window.location.href||"http://localhost",X_=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:bc,hasStandardBrowserEnv:Z_,hasStandardBrowserWebWorkerEnv:Y_,navigator:Wo,origin:Q_},Symbol.toStringTag,{value:"Module"})),$e={...X_,...G_};function J_(e,t){return Hi(e,new $e.classes.URLSearchParams,{visitor:function(n,r,s,i){return $e.isNode&&k.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}const Vl=vm;function Sm(e){if(e>Vl)throw new Z("FormData field is too deeply nested ("+e+" levels). Max depth: "+Vl,Z.ERR_FORM_DATA_DEPTH_EXCEEDED)}function ex(e){const t=[],n=/\w+|\[(\w*)]/g;let r;for(;(r=n.exec(e))!==null;)Sm(t.length),t.push(r[0]==="[]"?"":r[1]||r[0]);return t}function tx(e){const t={},n=Object.keys(e);let r;const s=n.length;let i;for(r=0;r<s;r++)i=n[r],t[i]=e[i];return t}function Cm(e){function t(n,r,s,i){Sm(i);let o=n[i++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),l=i>=n.length;return o=!o&&k.isArray(s)?s.length:o,l?(k.hasOwnProp(s,o)?s[o]=k.isArray(s[o])?s[o].concat(r):[s[o],r]:s[o]=r,!a):((!k.hasOwnProp(s,o)||!k.isObject(s[o]))&&(s[o]=[]),t(n,r,s[o],i)&&k.isArray(s[o])&&(s[o]=tx(s[o])),!a)}if(k.isFormData(e)&&k.isFunction(e.entries)){const n={};return k.forEachEntry(e,(r,s)=>{t(ex(r),s,n,0)}),n}return null}const Kn=(e,t)=>e!=null&&k.hasOwnProp(e,t)?e[t]:void 0;function nx(e,t,n){if(k.isString(e))try{return(t||JSON.parse)(e),k.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const us={transitional:yc,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=k.isObject(t);if(i&&k.isHTMLForm(t)&&(t=new FormData(t)),k.isFormData(t))return s?JSON.stringify(Cm(t)):t;if(k.isArrayBuffer(t)||k.isBuffer(t)||k.isStream(t)||k.isFile(t)||k.isBlob(t)||k.isReadableStream(t))return t;if(k.isArrayBufferView(t))return t.buffer;if(k.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(i){const l=Kn(this,"formSerializer");if(r.indexOf("application/x-www-form-urlencoded")>-1)return J_(t,l).toString();if((a=k.isFileList(t))||r.indexOf("multipart/form-data")>-1){const d=Kn(this,"env"),f=d&&d.FormData;return Hi(a?{"files[]":t}:t,f&&new f,l)}}return i||s?(n.setContentType("application/json",!1),nx(t)):t}],transformResponse:[function(t){const n=Kn(this,"transitional")||us.transitional,r=n&&n.forcedJSONParsing,s=Kn(this,"responseType"),i=s==="json";if(k.isResponse(t)||k.isReadableStream(t))return t;if(t&&k.isString(t)&&(r&&!s||i)){const a=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(t,Kn(this,"parseReviver"))}catch(l){if(a)throw l.name==="SyntaxError"?Z.from(l,Z.ERR_BAD_RESPONSE,this,null,Kn(this,"response")):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:$e.classes.FormData,Blob:$e.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};k.forEach(["delete","get","head","post","put","patch","query"],e=>{us.headers[e]={}});function bo(e,t){const n=this||us,r=t||n,s=We.from(r.headers);let i=r.data;return k.forEach(e,function(a){i=a.call(n,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function Tm(e){return!!(e&&e.__CANCEL__)}let fs=class extends Z{constructor(t,n,r){super(t??"canceled",Z.ERR_CANCELED,n,r),this.name="CanceledError",this.__CANCEL__=!0}};function Em(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new Z("Request failed with status code "+n.status,n.status>=400&&n.status<500?Z.ERR_BAD_REQUEST:Z.ERR_BAD_RESPONSE,n.config,n.request,n))}function rx(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function sx(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,i=0,o;return t=t!==void 0?t:1e3,function(l){const d=Date.now(),f=r[i];o||(o=d),n[s]=l,r[s]=d;let u=i,g=0;for(;u!==s;)g+=n[u++],u=u%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),d-o<t)return;const p=f&&d-f;return p?Math.round(g*1e3/p):void 0}}function ix(e,t){let n=0,r=1e3/t,s,i;const o=(d,f=Date.now())=>{n=f,s=null,i&&(clearTimeout(i),i=null),e(...d)};return[(...d)=>{const f=Date.now(),u=f-n;u>=r?o(d,f):(s=d,i||(i=setTimeout(()=>{i=null,o(s)},r-u)))},()=>s&&o(s)]}const di=(e,t,n=3)=>{let r=0;const s=sx(50,250);return ix(i=>{if(!i||typeof i.loaded!="number")return;const o=i.loaded,a=i.lengthComputable?i.total:void 0,l=a!=null?Math.min(o,a):o,d=Math.max(0,l-r),f=s(d);r=Math.max(r,l);const u={loaded:l,total:a,progress:a?l/a:void 0,bytes:d,rate:f||void 0,estimated:f&&a?(a-l)/f:void 0,event:i,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(u)},n)},Hl=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},zl=e=>(...t)=>k.asap(()=>e(...t)),ox=$e.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,$e.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL($e.origin),$e.navigator&&/(msie|trident)/i.test($e.navigator.userAgent)):()=>!0,ax=$e.hasStandardBrowserEnv?{write(e,t,n,r,s,i,o){if(typeof document>"u")return;const a=[`${e}=${encodeURIComponent(t)}`];k.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),k.isString(r)&&a.push(`path=${r}`),k.isString(s)&&a.push(`domain=${s}`),i===!0&&a.push("secure"),k.isString(o)&&a.push(`SameSite=${o}`),document.cookie=a.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.split(";");for(let n=0;n<t.length;n++){const r=t[n].replace(/^\s+/,""),s=r.indexOf("=");if(s!==-1&&r.slice(0,s)===e)return decodeURIComponent(r.slice(s+1))}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function cx(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function lx(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const dx=/^https?:(?!\/\/)/i,ux=/[\t\n\r]/g;function fx(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function mx(e){return fx(e).replace(ux,"")}function Wl(e,t){if(typeof e=="string"&&dx.test(mx(e)))throw new Z('Invalid URL: missing "//" after protocol',Z.ERR_INVALID_URL,t)}function Pm(e,t,n,r){Wl(t,r);let s=!cx(t);return e&&(s||n===!1)?(Wl(e,r),lx(e,t)):t}const Kl=e=>e instanceof We?{...e}:e;function Mn(e,t){t=t||{};const n=Object.create(null);Object.defineProperty(n,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function r(f,u,g,p){return k.isPlainObject(f)&&k.isPlainObject(u)?k.merge.call({caseless:p},f,u):k.isPlainObject(u)?k.merge({},u):k.isArray(u)?u.slice():u}function s(f,u,g,p){if(k.isUndefined(u)){if(!k.isUndefined(f))return r(void 0,f,g,p)}else return r(f,u,g,p)}function i(f,u){if(!k.isUndefined(u))return r(void 0,u)}function o(f,u){if(k.isUndefined(u)){if(!k.isUndefined(f))return r(void 0,f)}else return r(void 0,u)}function a(f){const u=k.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!k.isUndefined(u))if(k.isPlainObject(u)){if(k.hasOwnProp(u,f))return u[f]}else return;const g=k.hasOwnProp(e,"transitional")?e.transitional:void 0;if(k.isPlainObject(g)&&k.hasOwnProp(g,f))return g[f]}function l(f,u,g){if(k.hasOwnProp(t,g))return r(f,u);if(k.hasOwnProp(e,g))return r(void 0,f)}const d={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,allowedSocketPaths:o,responseEncoding:o,validateStatus:l,headers:(f,u,g)=>s(Kl(f),Kl(u),g,!0)};return k.forEach(Object.keys({...e,...t}),function(u){if(u==="__proto__"||u==="constructor"||u==="prototype")return;const g=k.hasOwnProp(d,u)?d[u]:s,p=k.hasOwnProp(e,u)?e[u]:void 0,y=k.hasOwnProp(t,u)?t[u]:void 0,m=g(p,y,u);k.isUndefined(m)&&g!==l||(n[u]=m)}),k.hasOwnProp(t,"validateStatus")&&k.isUndefined(t.validateStatus)&&a("validateStatusUndefinedResolves")===!1&&(k.hasOwnProp(e,"validateStatus")?n.validateStatus=r(void 0,e.validateStatus):delete n.validateStatus),n}const px=["content-type","content-length"];function hx(e,t,n){if(n!=="content-only"){e.set(t);return}Object.entries(t).forEach(([r,s])=>{px.includes(r.toLowerCase())&&e.set(r,s)})}const gx=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16)));function km(e){const t=Mn({},e),n=g=>k.hasOwnProp(t,g)?t[g]:void 0,r=n("data");let s=n("withXSRFToken");const i=n("xsrfHeaderName"),o=n("xsrfCookieName");let a=n("headers");const l=n("auth"),d=n("baseURL"),f=n("allowAbsoluteUrls"),u=n("url");if(t.headers=a=We.from(a),t.url=xm(Pm(d,u,f,t),n("params"),n("paramsSerializer")),l){const g=k.getSafeProp(l,"username")||"",p=k.getSafeProp(l,"password")||"";a.set("Authorization","Basic "+btoa(g+":"+(p?gx(p):"")))}if(k.isFormData(r)&&($e.hasStandardBrowserEnv||$e.hasStandardBrowserWebWorkerEnv||k.isReactNative(r)?a.setContentType(void 0):k.isFunction(r.getHeaders)&&hx(a,r.getHeaders(),n("formDataHeaderPolicy"))),$e.hasStandardBrowserEnv&&(k.isFunction(s)&&(s=s(t)),s===!0||s==null&&ox(t.url))){const p=i&&o&&ax.read(o);p&&a.set(i,p)}return t}const yx=typeof XMLHttpRequest<"u",bx=yx&&function(e){return new Promise(function(n,r){const s=km(e);let i=s.data;const o=We.from(s.headers).normalize();let{responseType:a,onUploadProgress:l,onDownloadProgress:d}=s,f,u,g,p,y;function m(){p&&p(),y&&y(),s.cancelToken&&s.cancelToken.unsubscribe(f),s.signal&&s.signal.removeEventListener("abort",f)}let h=new XMLHttpRequest;h.open(s.method.toUpperCase(),s.url,!0),h.timeout=s.timeout;function b(){if(!h)return;const _=We.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),S={data:!a||a==="text"||a==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:_,config:e,request:h};Em(function(P){n(P),m()},function(P){r(P),m()},S),h=null}"onloadend"in h?h.onloadend=b:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.startsWith("file:"))||setTimeout(b)},h.onabort=function(){h&&(r(new Z("Request aborted",Z.ECONNABORTED,e,h)),m(),h=null)},h.onerror=function(x){const S=x&&x.message?x.message:"Network Error",T=new Z(S,Z.ERR_NETWORK,e,h);T.event=x||null,r(T),m(),h=null},h.ontimeout=function(){let x=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const S=s.transitional||yc;s.timeoutErrorMessage&&(x=s.timeoutErrorMessage),r(new Z(x,S.clarifyTimeoutError?Z.ETIMEDOUT:Z.ECONNABORTED,e,h)),m(),h=null},i===void 0&&o.setContentType(null),"setRequestHeader"in h&&k.forEach(ym(o),function(x,S){h.setRequestHeader(S,x)}),k.isUndefined(s.withCredentials)||(h.withCredentials=!!s.withCredentials),a&&a!=="json"&&(h.responseType=s.responseType),d&&([g,y]=di(d,!0),h.addEventListener("progress",g)),l&&h.upload&&([u,p]=di(l),h.upload.addEventListener("progress",u),h.upload.addEventListener("loadend",p)),(s.cancelToken||s.signal)&&(f=_=>{h&&(r(!_||_.type?new fs(null,e,h):_),h.abort(),m(),h=null)},s.cancelToken&&s.cancelToken.subscribe(f),s.signal&&(s.signal.aborted?f():s.signal.addEventListener("abort",f)));const v=rx(s.url);if(v&&!$e.protocols.includes(v)){r(new Z("Unsupported protocol "+v+":",Z.ERR_BAD_REQUEST,e));return}h.send(i||null)})},vx=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const n=new AbortController;let r=!1;const s=function(l){if(!r){r=!0,o();const d=l instanceof Error?l:this.reason;n.abort(d instanceof Z?d:new fs(d instanceof Error?d.message:d))}};let i=t&&setTimeout(()=>{i=null,s(new Z(`timeout of ${t}ms exceeded`,Z.ETIMEDOUT))},t);const o=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(l=>{l.unsubscribe?l.unsubscribe(s):l.removeEventListener("abort",s)}),e=null)};e.forEach(l=>l.addEventListener("abort",s));const{signal:a}=n;return a.unsubscribe=()=>k.asap(o),a},wx=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,s;for(;r<n;)s=r+t,yield e.slice(r,s),r=s},_x=async function*(e,t){for await(const n of xx(e))yield*wx(n,t)},xx=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},ql=(e,t,n,r)=>{const s=_x(e,t);let i=0,o,a=l=>{o||(o=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:d,value:f}=await s.next();if(d){a(),l.close();return}let u=f.byteLength;if(n){let g=i+=u;n(g)}l.enqueue(new Uint8Array(f))}catch(d){throw a(d),d}},cancel(l){return a(l),s.return()}},{highWaterMark:2})},ui=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,Sx=(e,t,n)=>t+2<n&&ui(e.charCodeAt(t+1))&&ui(e.charCodeAt(t+2));function Cx(e){if(!e||typeof e!="string"||!e.startsWith("data:"))return 0;const t=e.indexOf(",");if(t<0)return 0;const n=e.slice(5,t),r=e.slice(t+1);if(/;base64/i.test(n)){let o=r.length;const a=r.length;for(let p=0;p<a;p++)if(r.charCodeAt(p)===37&&p+2<a){const y=r.charCodeAt(p+1),m=r.charCodeAt(p+2);ui(y)&&ui(m)&&(o-=2,p+=2)}let l=0,d=a-1;const f=p=>p>=2&&r.charCodeAt(p-2)===37&&r.charCodeAt(p-1)===51&&(r.charCodeAt(p)===68||r.charCodeAt(p)===100);d>=0&&(r.charCodeAt(d)===61?(l++,d--):f(d)&&(l++,d-=3)),l===1&&d>=0&&(r.charCodeAt(d)===61||f(d))&&l++;const g=Math.floor(o/4)*3-(l||0);return g>0?g:0}let i=0;for(let o=0,a=r.length;o<a;o++){const l=r.charCodeAt(o);if(l===37&&Sx(r,o,a))i+=1,o+=2;else if(l<128)i+=1;else if(l<2048)i+=2;else if(l>=55296&&l<=56319&&o+1<a){const d=r.charCodeAt(o+1);d>=56320&&d<=57343?(i+=4,o++):i+=3}else i+=3}return i}const vc="1.18.0",Gl=64*1024,{isFunction:Rs}=k,Tx=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16))),Zl=e=>{if(!k.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},Yl=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Ex=e=>{const t=e.indexOf("://");let n=e;return t!==-1&&(n=n.slice(t+3)),n.includes("@")||n.includes(":")},Px=e=>{const t=k.global!==void 0&&k.global!==null?k.global:globalThis,{ReadableStream:n,TextEncoder:r}=t;e=k.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:s,Request:i,Response:o}=e,a=s?Rs(s):typeof fetch=="function",l=Rs(i),d=Rs(o);if(!a)return!1;const f=a&&Rs(n),u=a&&(typeof r=="function"?(b=>v=>b.encode(v))(new r):async b=>new Uint8Array(await new i(b).arrayBuffer())),g=l&&f&&Yl(()=>{let b=!1;const v=new i($e.origin,{body:new n,method:"POST",get duplex(){return b=!0,"half"}}),_=v.headers.has("Content-Type");return v.body!=null&&v.body.cancel(),b&&!_}),p=d&&f&&Yl(()=>k.isReadableStream(new o("").body)),y={stream:p&&(b=>b.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(b=>{!y[b]&&(y[b]=(v,_)=>{let x=v&&v[b];if(x)return x.call(v);throw new Z(`Response type '${b}' is not supported`,Z.ERR_NOT_SUPPORT,_)})});const m=async b=>{if(b==null)return 0;if(k.isBlob(b))return b.size;if(k.isSpecCompliantForm(b))return(await new i($e.origin,{method:"POST",body:b}).arrayBuffer()).byteLength;if(k.isArrayBufferView(b)||k.isArrayBuffer(b))return b.byteLength;if(k.isURLSearchParams(b)&&(b=b+""),k.isString(b))return(await u(b)).byteLength},h=async(b,v)=>{const _=k.toFiniteNumber(b.getContentLength());return _??m(v)};return async b=>{let{url:v,method:_,data:x,signal:S,cancelToken:T,timeout:P,onDownloadProgress:A,onUploadProgress:D,responseType:I,headers:N,withCredentials:L="same-origin",fetchOptions:H,maxContentLength:R,maxBodyLength:F}=km(b);const M=k.isNumber(R)&&R>-1,$=k.isNumber(F)&&F>-1,O=V=>k.hasOwnProp(b,V)?b[V]:void 0;let U=s||fetch;I=I?(I+"").toLowerCase():"text";let W=vx([S,T&&T.toAbortSignal()],P),j=null;const ee=W&&W.unsubscribe&&(()=>{W.unsubscribe()});let J,de=null;const ue=()=>new Z("Request body larger than maxBodyLength limit",Z.ERR_BAD_REQUEST,b,j);try{let V;const K=O("auth");if(K){const X=k.getSafeProp(K,"username")||"",Ne=k.getSafeProp(K,"password")||"";V={username:X,password:Ne}}if(Ex(v)){const X=new URL(v,$e.origin);if(!V&&(X.username||X.password)){const Ne=Zl(X.username),Be=Zl(X.password);V={username:Ne,password:Be}}(X.username||X.password)&&(X.username="",X.password="",v=X.href)}if(V&&(N.delete("authorization"),N.set("Authorization","Basic "+btoa(Tx((V.username||"")+":"+(V.password||""))))),M&&typeof v=="string"&&v.startsWith("data:")&&Cx(v)>R)throw new Z("maxContentLength size of "+R+" exceeded",Z.ERR_BAD_RESPONSE,b,j);if($&&_!=="get"&&_!=="head"){const X=await m(x);if(typeof X=="number"&&isFinite(X)&&(J=X,X>F))throw ue()}const se=$&&(k.isReadableStream(x)||k.isStream(x)),Ee=(X,Ne,Be)=>ql(X,Gl,Xe=>{if($&&Xe>F)throw de=ue();Ne&&Ne(Xe)},Be);if(g&&_!=="get"&&_!=="head"&&(D||se)){if(J=J??await h(N,x),J!==0||se){let X=new i(v,{method:"POST",body:x,duplex:"half"}),Ne;if(k.isFormData(x)&&(Ne=X.headers.get("content-type"))&&N.setContentType(Ne),X.body){const[Be,Xe]=D&&Hl(J,di(zl(D)))||[];x=Ee(X.body,Be,Xe)}}}else if(se&&!l&&f&&_!=="get"&&_!=="head")x=Ee(x);else if(se&&l&&!g&&_!=="get"&&_!=="head")throw new Z("Stream request bodies are not supported by the current fetch implementation",Z.ERR_NOT_SUPPORT,b,j);k.isString(L)||(L=L?"include":"omit");const le=l&&"credentials"in i.prototype;if(k.isFormData(x)){const X=N.getContentType();X&&/^multipart\/form-data/i.test(X)&&!/boundary=/i.test(X)&&N.delete("content-type")}N.set("User-Agent","axios/"+vc,!1);const oe={...H,signal:W,method:_.toUpperCase(),headers:ym(N.normalize()),body:x,duplex:"half",credentials:le?L:void 0};j=l&&new i(v,oe);let B=await(l?U(j,H):U(v,oe));const ve=We.from(B.headers);if(M){const X=k.toFiniteNumber(ve.getContentLength());if(X!=null&&X>R)throw new Z("maxContentLength size of "+R+" exceeded",Z.ERR_BAD_RESPONSE,b,j)}const ke=p&&(I==="stream"||I==="response");if(p&&B.body&&(A||M||ke&&ee)){const X={};["status","statusText","headers"].forEach(Ve=>{X[Ve]=B[Ve]});const Ne=k.toFiniteNumber(ve.getContentLength()),[Be,Xe]=A&&Hl(Ne,di(zl(A),!0))||[];let ft=0;const re=Ve=>{if(M&&(ft=Ve,ft>R))throw new Z("maxContentLength size of "+R+" exceeded",Z.ERR_BAD_RESPONSE,b,j);Be&&Be(Ve)};B=new o(ql(B.body,Gl,re,()=>{Xe&&Xe(),ee&&ee()}),X)}I=I||"text";let Pe=await y[k.findKey(y,I)||"text"](B,b);if(M&&!p&&!ke){let X;if(Pe!=null&&(typeof Pe.byteLength=="number"?X=Pe.byteLength:typeof Pe.size=="number"?X=Pe.size:typeof Pe=="string"&&(X=typeof r=="function"?new r().encode(Pe).byteLength:Pe.length)),typeof X=="number"&&X>R)throw new Z("maxContentLength size of "+R+" exceeded",Z.ERR_BAD_RESPONSE,b,j)}return!ke&&ee&&ee(),await new Promise((X,Ne)=>{Em(X,Ne,{data:Pe,headers:We.from(B.headers),status:B.status,statusText:B.statusText,config:b,request:j})})}catch(V){if(ee&&ee(),W&&W.aborted&&W.reason instanceof Z){const K=W.reason;throw K.config=b,j&&(K.request=j),V!==K&&(K.cause=V),K}throw de?(j&&!de.request&&(de.request=j),de):V instanceof Z?(j&&!V.request&&(V.request=j),V):V&&V.name==="TypeError"&&/Load failed|fetch/i.test(V.message)?Object.assign(new Z("Network Error",Z.ERR_NETWORK,b,j,V&&V.response),{cause:V.cause||V}):Z.from(V,V&&V.code,b,j,V&&V.response)}}},kx=new Map,Am=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,i=[r,s,n];let o=i.length,a=o,l,d,f=kx;for(;a--;)l=i[a],d=f.get(l),d===void 0&&f.set(l,d=a?new Map:Px(t)),f=d;return d};Am();const wc={http:$_,xhr:bx,fetch:{get:Am}};k.forEach(wc,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const Ql=e=>`- ${e}`,Ax=e=>k.isFunction(e)||e===null||e===!1;function Ox(e,t){e=k.isArray(e)?e:[e];const{length:n}=e;let r,s;const i={};for(let o=0;o<n;o++){r=e[o];let a;if(s=r,!Ax(r)&&(s=wc[(a=String(r)).toLowerCase()],s===void 0))throw new Z(`Unknown adapter '${a}'`);if(s&&(k.isFunction(s)||(s=s.get(t))))break;i[a||"#"+o]=s}if(!s){const o=Object.entries(i).map(([l,d])=>`adapter ${l} `+(d===!1?"is not supported by the environment":"is not available in the build"));let a=n?o.length>1?`since :
|
|
76
|
+
`+o.map(Ql).join(`
|
|
77
|
+
`):" "+Ql(o[0]):"as no adapter specified";throw new Z("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s}const Om={getAdapter:Ox,adapters:wc};function vo(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new fs(null,e)}function Xl(e){return vo(e),e.headers=We.from(e.headers),e.data=bo.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Om.getAdapter(e.adapter||us.adapter,e)(e).then(function(r){vo(e),e.response=r;try{r.data=bo.call(e,e.transformResponse,r)}finally{delete e.response}return r.headers=We.from(r.headers),r},function(r){if(!Tm(r)&&(vo(e),r&&r.response)){e.response=r.response;try{r.response.data=bo.call(e,e.transformResponse,r.response)}finally{delete e.response}r.response.headers=We.from(r.response.headers)}return Promise.reject(r)})}const zi={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{zi[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Jl={};zi.transitional=function(t,n,r){function s(i,o){return"[Axios v"+vc+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,a)=>{if(t===!1)throw new Z(s(o," has been removed"+(n?" in "+n:"")),Z.ERR_DEPRECATED);return n&&!Jl[o]&&(Jl[o]=!0,console.warn(s(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,o,a):!0}};zi.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function Nx(e,t,n){if(typeof e!="object")throw new Z("options must be an object",Z.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const i=r[s],o=Object.prototype.hasOwnProperty.call(t,i)?t[i]:void 0;if(o){const a=e[i],l=a===void 0||o(a,i,e);if(l!==!0)throw new Z("option "+i+" must be "+l,Z.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Z("Unknown option "+i,Z.ERR_BAD_OPTION)}}const Ks={assertOptions:Nx,validators:zi},He=Ks.validators;let Nn=class{constructor(t){this.defaults=t||{},this.interceptors={request:new $l,response:new $l}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=(()=>{if(!s.stack)return"";const o=s.stack.indexOf(`
|
|
78
78
|
`);return o===-1?"":s.stack.slice(o+1)})();try{if(!r.stack)r.stack=i;else if(i){const o=i.indexOf(`
|
|
79
79
|
`),a=o===-1?-1:i.indexOf(`
|
|
80
80
|
`,o+1),l=a===-1?"":i.slice(a+1);String(r.stack).endsWith(l)||(r.stack+=`
|
|
81
|
-
`+i)}}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Mn(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&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&&(A.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&&A.merge(i.common,i[n.method]);i&&A.forEach(["delete","get","head","post","put","patch","query","common"],h=>{delete i[h]}),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,g;if(!l){const h=[Hl.bind(this),void 0];for(h.unshift(...a),h.push(...d),g=h.length,u=Promise.resolve(n);f<g;)u=u.then(h[f++],h[f++]);return u}g=a.length;let m=n;for(;f<g;){const h=a[f++],p=a[f++];try{m=h(m)}catch(y){p.call(this,y);break}}try{u=Hl.call(this,m)}catch(h){return Promise.reject(h)}for(f=0,g=d.length;f<g;)u=u.then(d[f++],d[f++]);return u}getUri(t){t=Mn(this.defaults,t);const n=hp(t.baseURL,t.url,t.allowAbsoluteUrls,t);return dp(n,t.params,t.paramsSerializer)}};A.forEach(["delete","get","head","options"],function(t){kn.prototype[t]=function(n,r){return this.request(Mn(r||{},{method:t,url:n,data:r&&A.hasOwnProp(r,"data")?r.data:void 0}))}});A.forEach(["post","put","patch","query"],function(t){function n(r){return function(i,o,a){return this.request(Mn(a||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}kn.prototype[t]=n(),t!=="query"&&(kn.prototype[t+"Form"]=n(!0))});let yx=class vp{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 vp(function(s){t=s}),cancel:t}}};function bx(e){return function(n){return e.apply(null,n)}}function vx(e){return A.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 wp(e){const t=new kn(e),n=Yf(kn.prototype.request,t);return A.extend(n,kn.prototype,t,{allOwnKeys:!0}),A.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return wp(Mn(e,s))},n}const Ne=wp(os);Ne.Axios=kn;Ne.CanceledError=as;Ne.CancelToken=yx;Ne.isCancel=pp;Ne.VERSION=pc;Ne.toFormData=Fi;Ne.AxiosError=q;Ne.Cancel=Ne.CanceledError;Ne.all=function(t){return Promise.all(t)};Ne.spread=bx;Ne.isAxiosError=vx;Ne.mergeConfig=Mn;Ne.AxiosHeaders=ze;Ne.formToJSON=e=>fp(A.isHTMLForm(e)?new FormData(e):e);Ne.getAdapter=bp.getAdapter;Ne.HttpStatusCode=$o;Ne.default=Ne;const{Axios:aT,AxiosError:cT,CanceledError:lT,isCancel:dT,CancelToken:uT,VERSION:fT,all:pT,Cancel:mT,isAxiosError:_p,spread:hT,toFormData:gT,AxiosHeaders:yT,HttpStatusCode:bT,formToJSON:vT,getAdapter:wT,mergeConfig:_T,create:xT}=Ne,wx="Bearer ",xp="web-trading-token";function _x(){return typeof window>"u"?null:localStorage.getItem(xp)}function br(e){return e.replace(/\/$/,"")}function Wl(e){const t=br(e);async function n(r){const s=_x();return(await Ne({...r,baseURL:t,headers:{...r.headers??{},...s?{Authorization:`${wx}${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 Kl(e){return!e.isDemo&&!e.isArchive&&!!e.tradeStat}function xx(e){const t=e.filter(n=>Kl(n)&&n.platformType==="mt5");return t.length>0?t:e.filter(Kl)}function Sx(e){const t=e,n=(t==null?void 0:t.accounts)??[];return xx(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 Cx(e){try{const t=new URL(br(e));return t.hostname.includes("webtrade.")?(t.hostname=t.hostname.replace("webtrade.","api."),t.origin):(t.hostname.startsWith("webtrade")&&(t.hostname=t.hostname.replace(/^webtrade/,"api")),t.origin)}catch{return br(e)}}function Ex(e){try{const t=new URL(br(e));return t.hostname.includes("opheleo")?"wss://symbols.opheleo.com":(t.protocol=t.protocol==="https:"?"wss:":"ws:",t.origin)}catch{return"wss://symbols.opheleo.com"}}function Tx(e){const t=br(e),n=Wl(t),r=Cx(t),s=Wl(r),i=hw(n),o=Ut;return{baseUrl:t,platformApiBase:r,tickWebSocketUrl:Ex(t),dealer:i,trading:_w(i,o),async getAccounts(){const a=await s.get("/account-config/api/v1");return Sx(a)}}}const Sp=S.createContext(null);function Cp({baseUrl:e,children:t}){const n=S.useMemo(()=>Tx(e),[e]);return c.jsx(Sp.Provider,{value:n,children:t})}function Ht(){const e=S.useContext(Sp);if(!e)throw new Error("useWidgetApiClient must be used within WidgetApiProvider");return e}function Ep(){return Ht().tickWebSocketUrl}const Px="wss://symbols.opheleo.com";function hc(e){const[t,n]=S.useState(null),r=Ep();return S.useEffect(()=>{n(null);const s=Di(e).toUpperCase();let i=null,o=!1;const a=r||Px,l=()=>{i=new WebSocket(a),i.onopen=()=>{if(o){i==null||i.close(1e3,"Unmounted");return}i==null||i.send(JSON.stringify({action:"select_symbol",symbol:s}))},i.onmessage=d=>{var u;try{const f=JSON.parse(d.data);if(((u=f.symbol)==null?void 0:u.trim().toUpperCase())!==s)return;const m=Number(f.bid),h=Number(f.ask);if(!Number.isFinite(m)||!Number.isFinite(h))return;n({bid:m,ask:h})}catch{}},i.onclose=()=>{o||setTimeout(l,3e3)}};return l(),()=>{o=!0,i==null||i.close(1e3,"Unmounted")}},[e,r]),t}function Ax({symbolTicker:e,scanResultUrl:t,orderState:n,backUrl:r,createAccountUrl:s}){const i=hc(e),{panelRef:o,position:a,isDragging:l,onDragStart:d,reclamp:u}=Kf(),{panel:f,isSubmitting:g,defaultVolumeLots:m,volumeStep:h,minVolumeLots:p,accountOptions:y,selectedLogin:b,isAccountsLoading:v,hasConfirmedAccount:x,needsAccountSelection:_,confirmAccountSelection:C,placeMarketOrder:P}=n,E=oe(O=>O.setDraft),k=oe(O=>O.clearDraft),D=Number($t(Vt(e))),I=Pr(D);S.useEffect(()=>{x&&E({source:"new-order",entryPrice:null,side:null,showEntryLine:!1,volumeLots:m,digits:D,priceStep:I})},[m,D,x,I,E]),S.useEffect(()=>{(f==="closed"||f==="confirmation")&&k()},[k,f]);const N=O=>{P({symbolTicker:e,login:O.login,executionMode:"market",side:O.side,orderType:O.side==="buy"?qe.BUY:qe.SELL,volumeLots:O.volumeLots,stopLoss:"",takeProfit:"",priceOrder:"",priceTrigger:"",comment:"",typeTime:ft.GTC,expirationDateTime:"",expirationDay:"",bid:O.bid,ask:O.ask})};return c.jsxs(c.Fragment,{children:[c.jsx(Lf,{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(nw,{symbolTicker:e,bid:(i==null?void 0:i.bid)??null,ask:(i==null?void 0:i.ask)??null,defaultVolumeLots:m,volumeStep:h,minVolumeLots:p,isSubmitting:g,isAccountsLoading:v,selectedLogin:b,isDragging:l,scanResultUrl:t,onDragHandlePointerDown:d,onExpandedChange:u,onExpand:u,onPlaceOrder:N})})]})}function Nx(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 Ox(e,t){return e.openTimeMs!==t.openTimeMs?e.openTimeMs-t.openTimeMs:Nx(e.ticket,t.ticket)}function Gl(e){return[...e].sort(Ox)}function ql(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:Gl(t)})},setOrders:t=>{e({orders:Gl(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=ql(t);e(i=>{const o={...i.liveQuotes,[s]:{bid:n,ask:r}};return{liveQuotes:o,positions:i.positions.map(a=>Mv(a,s,n,r,o)),orders:i.orders.map(a=>{if(ql(a.symbol)!==s)return a;const l=a.side==="buy"?n:r;return{...a,currentPrice:l}})}})},clearPositions:()=>{e({positions:[],orders:[],liveQuotes:{}})}})),kx="wss://symbols.opheleo.com";function Rx(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 jv([...n]))n.add(r);return[...n].sort().join("|")}function Dx(e){return Rx(e.positions,e.orders)}function Lx(){const e=ve(Dx),t=ve(r=>r.updateQuotes),n=Ep();S.useEffect(()=>{if(!e)return;const r=e.split("|"),s=new Map;let i=!1;const o=n||kx,a=l=>{const d=new WebSocket(o);s.set(l,d),d.onopen=()=>{if(i){d.close(1e3,"Unmounted");return}d.send(JSON.stringify({action:"select_symbol",symbol:l}))},d.onmessage=u=>{var f;try{const g=JSON.parse(u.data),m=(f=g.symbol)==null?void 0:f.trim().toUpperCase();if(!m||m!==l)return;const h=Number(g.bid),p=Number(g.ask);if(!Number.isFinite(h)||!Number.isFinite(p))return;t(m,h,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 Tp(){return Lx(),null}const Pp={buy:"#2563eb",sell:"#dc2626"},ho={positive:"#2563eb",negative:"#dc2626",neutral:"#94a3b8"},go={linewidth:1,linestyle:2,fontsize:11},Ap={stopLoss:"#f97316",takeProfit:"#22c55e"},Np=e=>Pp[e],Vo=(e,t)=>e==="entry"?t!=null?Np(t):Pp.sell:Ap[e],Zl=(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=Op(n,r,s,i);return kp(o)}return Ap[e]},Op=(e,t,n,r)=>(e==="buy"?n-t:t-n)*r*100,jx=(e,t)=>!Number.isFinite(t)||t<=0?0:Math.round(e/t),Ix=e=>{const t=Op(e.side,e.entryPrice,e.linePrice,e.volumeLots),n=e.side==="buy"?e.linePrice-e.entryPrice:e.entryPrice-e.linePrice,r=jx(n,e.priceStep),s=e.kind==="takeProfit"?"TP":"SL",i=`${t.toFixed(2)} USD`,o=`${r} points`;return`${s} ${i}, ${o}`},Mx=(e,t)=>e.toFixed(t),kp=e=>e>0?ho.positive:e<0?ho.negative:ho.neutral,Fx=e=>{const t=`${e.side.toUpperCase()} ${e.volumeLots.toFixed(2)}, `,n=`${e.profit.toFixed(2)} USD`;return`${t}${n}`},Yl=e=>{const t=Np(e.side),n=kp(e.profit);return{text:Fx(e),linecolor:t,textcolor:n,linewidth:go.linewidth,linestyle:go.linestyle,fontsize:go.fontsize,showPrice:!0,horzLabelsAlign:"left"}},Ql=e=>pt(e),Ux=e=>e==="entry"||e==="stopLoss"||e==="takeProfit",yo=e=>{e.setUserEditEnabled(!1),e.setSelectionEnabled(!1)},Xl=(e,t,n)=>{if(e==="entry")return Mx(t,n.digits);const{entryPrice:r,side:s}=n;return s!==null&&r!==null?Ix({kind:e,side:s,entryPrice:r,linePrice:t,volumeLots:n.volumeLots,priceStep:n.priceStep}):`${e==="takeProfit"?"TP":"SL"} ${Ee(t,n.digits)}`},Bx=({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),g=S.useRef({}),m=S.useRef(null),h=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=g.current[_];if(C){try{e.activeChart().removeEntity(C)}catch{}delete g.current[_]}},[e]),b=S.useCallback((_,C,P,E)=>{const k=Vo(C,E.side),D=Zl(C,{side:E.side,entryPrice:E.entryPrice,linePrice:P,volumeLots:E.volumeLots});_.setProperties({text:Xl(C,P,E),linecolor:k,textcolor:D,showPrice:!0,horzLabelsAlign:"left"})},[]),v=S.useCallback(async(_,C,P)=>{var O;if(!e)return;if(C===void 0){y(_);return}if(m.current===_)return;const E=e.activeChart(),k=Vo(_,P.side),D=Zl(_,{side:P.side,entryPrice:P.entryPrice,linePrice:C,volumeLots:P.volumeLots}),I=Xl(_,C,P),N=g.current[_];if(N)try{const B=E.getShapeById(N);_==="entry"&&yo(B);const R=(O=B.getPoints()[0])==null?void 0:O.price;if(R!==void 0&&Math.abs(R-C)<P.priceStep/2){B.setProperties({text:I,linecolor:k,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:I,linecolor:k,textcolor:D,showPrice:!0,horzLabelsAlign:"left"});return}}catch{delete g.current[_]}try{const B=E.getVisibleRange(),R=await E.createShape({time:B.from,price:C},{shape:"horizontal_line",text:I,disableSave:!0,lock:_==="entry",disableSelection:_==="entry",overrides:{linecolor:k,textcolor:D,linewidth:2,showPrice:!0,horzLabelsAlign:"left"}});if(_==="entry"&&!p.current.showEntryLine){try{E.removeEntity(R)}catch{}return}if(_==="entry")try{yo(E.getShapeById(R))}catch{}g.current[_]=R}catch{}},[e,y]),x=S.useCallback(async _=>{const C=Ql(_.stopLoss),P=Ql(_.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 k,D,I;const E=(k=Object.entries(g.current).find(([,N])=>N===C))==null?void 0:k[0];if(!(!E||!Ux(E))){if(E==="entry"){if(P==="move"||P==="points_changed"){const N=p.current;if(N.entryPrice!==null)try{const O=e.activeChart().getShapeById(C),B=(D=O.getPoints()[0])==null?void 0:D.price;if(B!==void 0&&Math.abs(B-N.entryPrice)>=N.priceStep/2){const R=O.getPoints();R.length>0&&O.setPoints(R.map(H=>({...H,price:N.entryPrice})))}yo(O)}catch{}}return}if(P==="remove"){m.current=null,E==="stopLoss"&&u(""),E==="takeProfit"&&f(""),delete g.current[E];return}if(!(P!=="move"&&P!=="points_changed"))try{const N=e.activeChart().getShapeById(C),O=(I=N.getPoints()[0])==null?void 0:I.price;if(!Number.isFinite(O)||O<=0)return;const B=p.current;if(P==="points_changed"){m.current=E,b(N,E,O,B),h.current!==null&&clearTimeout(h.current),h.current=setTimeout(()=>{m.current=null;const F=Ee(O,p.current.digits);E==="stopLoss"?u(F):f(F)},120);return}h.current!==null&&(clearTimeout(h.current),h.current=null),m.current=null;const R=Ee(O,B.digits),H=E==="stopLoss"?{...B,stopLoss:R}:{...B,takeProfit:R};E==="stopLoss"?u(R):f(R),b(N,E,O,H)}catch{m.current=null}}};try{e.subscribe("drawing_event",_)}catch{}return()=>{m.current=null,h.current!==null&&(clearTimeout(h.current),h.current=null);try{e.unsubscribe("drawing_event",_)}catch{}Object.keys(g.current).forEach(C=>{y(C)}),g.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])},Jl=e=>{e.setUserEditEnabled(!1),e.setSelectionEnabled(!1)},Rp=(e,t)=>Ye(e.symbol).toUpperCase()===t,$x=e=>ve.getState().positions.filter(t=>Rp(t,e)).map(t=>({ticket:t.ticket,openPrice:t.openPrice,type:t.type,digits:t.digits,volumeLots:t.volumeLots,profit:t.profit})),ed=(e,t,n)=>{try{const r=e.activeChart().symbol(),s=n.find(i=>i.display_name===r||i.ticker===r);if(s)return Bf(s.ticker,n)}catch{}return t},Vx=(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)},Hx=({chartWidget:e,symbolTicker:t,symbols:n})=>{const r=ve(h=>h.positions),s=S.useRef(new Map),i=S.useRef(0),o=S.useMemo(()=>Bf(t,n),[t,n]),a=S.useMemo(()=>r.filter(h=>Rp(h,o)).map(h=>`${h.ticket}:${h.openPrice}:${h.type}:${h.digits}:${h.volumeLots}:${h.profit.toFixed(2)}`).sort().join("|"),[o,r]),l=S.useCallback(h=>{if(!e)return;const p=s.current.get(h);if(p){try{e.activeChart().removeEntity(p)}catch{}s.current.delete(h)}},[e]),d=S.useCallback(()=>{for(const h of[...s.current.keys()])l(h);s.current.clear()},[l]),u=S.useCallback(async(h,p,y)=>{const b=Yl({side:p.type,volumeLots:p.volumeLots,profit:p.profit}),x={time:h.getVisibleRange().from,price:p.openPrice},_=await h.createShape(x,{shape:"horizontal_line",text:String(b.text),disableSave:!0,lock:!0,disableSelection:!0,overrides:b});if(y!==i.current){try{h.removeEntity(_)}catch{}return null}try{Jl(h.getShapeById(_))}catch{}return _},[]),f=S.useCallback(async(h,p)=>{if(!e||p!==i.current)return;const y=e.activeChart(),b=Yl({side:h.type,volumeLots:h.volumeLots,profit:h.profit}),v=s.current.get(h.ticket);if(v)try{Vx(y.getShapeById(v),h.openPrice,b),Jl(y.getShapeById(v));return}catch{s.current.delete(h.ticket)}if(p===i.current)try{const x=await u(y,h,p);if(!x)return;s.current.set(h.ticket,x)}catch{}},[e,u]),g=S.useCallback(async(h,p)=>{if(!e||h!==i.current)return;const y=$x(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(h!==i.current)return;await f(v,h)}},[e,l,f]),m=S.useCallback(h=>{if(!e)return;const p=i.current+1;i.current=p,h!=null&&h.resetLineIds&&d();const y=(h==null?void 0:h.symbolKey)??ed(e,o,n);g(p,y)},[o,e,d,n,g]);S.useEffect(()=>{if(!e)return;let h=!1,p=null;const y=()=>{h||m({resetLineIds:!0,symbolKey:ed(e,o,n)})};let b=!1;const v=()=>{b=!0,y()},x=()=>{h||!b||(b=!1,m({symbolKey:o}))};try{e.onChartReady(()=>{if(!h)try{p=e.activeChart(),m({resetLineIds:!0,symbolKey:o}),p.onSymbolChanged().subscribe(null,v),p.onDataLoaded().subscribe(null,x)}catch{}})}catch{}return()=>{if(h=!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 h=!1;try{e.onChartReady(()=>{h||m({symbolKey:o})})}catch{}return()=>{h=!0}},[o,e,a,m])},Dp=({chartWidget:e,symbolTicker:t,symbols:n})=>(Hx({chartWidget:e,symbolTicker:t,symbols:n}),Bx({chartWidget:e}),null);var cs=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},_n,Qt,er,Hd,zx=(Hd=class extends cs{constructor(){super();ne(this,_n);ne(this,Qt);ne(this,er);W(this,er,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){T(this,Qt)||this.setEventListener(T(this,er))}onUnsubscribe(){var t;this.hasListeners()||((t=T(this,Qt))==null||t.call(this),W(this,Qt,void 0))}setEventListener(t){var n;W(this,er,t),(n=T(this,Qt))==null||n.call(this),W(this,Qt,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){T(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 T(this,_n)=="boolean"?T(this,_n):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},_n=new WeakMap,Qt=new WeakMap,er=new WeakMap,Hd),gc=new zx,Wx={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},St,xn,zd,Kx=(zd=class{constructor(){ne(this,St,Wx);ne(this,xn,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&T(this,xn)&&e!==T(this,St)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:T(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),T(this,St).setTimeout(e,t)}clearTimeout(e){T(this,St).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&W(this,xn,!0),T(this,St).setInterval(e,t)}clearInterval(e){T(this,St).clearInterval(e)}},St=new WeakMap,xn=new WeakMap,zd),wn=new Kx;function Gx(e){setTimeout(e,0)}var qx=typeof window>"u"||"Deno"in globalThis;function Ge(){}function Zx(e,t){return typeof e=="function"?e(t):e}function Ho(e){return typeof e=="number"&&e>=0&&e!==1/0}function Lp(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 td(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 nd(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 Yx=Object.prototype.hasOwnProperty;function zo(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=rd(e)&&rd(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],g=e[f],m=t[f];if(g===m){l[f]=g,(r?u<i:Yx.call(e,f))&&d++;continue}if(g===null||m===null||typeof g!="object"||typeof m!="object"){l[f]=m;continue}const h=zo(g,m,n+1);l[f]=h,h===g&&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 rd(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Ko(e){if(!sd(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!sd(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function sd(e){return Object.prototype.toString.call(e)==="[object Object]"}function Qx(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 Xx(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function Jx(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var oi=Symbol();function jp(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 Ip(e,t){return typeof e=="function"?e(...t):!!e}function eS(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=()=>qx;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 tS=Gx;function nS(){let e=[],t=0,n=a=>{a()},r=a=>{a()},s=tS;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=nS(),tr,Xt,nr,Wd,rS=(Wd=class extends cs{constructor(){super();ne(this,tr,!0);ne(this,Xt);ne(this,nr);W(this,nr,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){T(this,Xt)||this.setEventListener(T(this,nr))}onUnsubscribe(){var t;this.hasListeners()||((t=T(this,Xt))==null||t.call(this),W(this,Xt,void 0))}setEventListener(t){var n;W(this,nr,t),(n=T(this,Xt))==null||n.call(this),W(this,Xt,t(this.setOnline.bind(this)))}setOnline(t){T(this,tr)!==t&&(W(this,tr,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return T(this,tr)}},tr=new WeakMap,Xt=new WeakMap,nr=new WeakMap,Wd),ai=new rS;function sS(e){return Math.min(1e3*2**e,3e4)}function Mp(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 Fp(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);g(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=()=>Mp(e.networkMode)&&e.canRun(),f=p=>{i()||(r==null||r(),s.resolve(p))},g=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)}),h=()=>{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??sS,_=typeof x=="function"?x(n,b):x,C=v===!0||typeof v=="number"&&n<v||typeof v=="function"&&v(n,b);if(t||!C){g(b);return}n++,(P=e.onFail)==null||P.call(e,n,b),Qx(_).then(()=>d()?void 0:m()).then(()=>{t?g(b):h()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(r==null||r(),s),cancelRetry:a,continueRetry:l,canStart:u,start:()=>(u()?h():m().then(h),s)}}var Sn,Kd,Up=(Kd=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(){T(this,Sn)!==void 0&&(wn.clearTimeout(T(this,Sn)),W(this,Sn,void 0))}},Sn=new WeakMap,Kd);function iS(e){return{onFetch:(t,n)=>{var u,f,g,m,h;const r=t.options,s=(g=(f=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:f.fetchMore)==null?void 0:g.direction,i=((m=t.state.data)==null?void 0:m.pages)||[],o=((h=t.state.data)==null?void 0:h.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const d=async()=>{let p=!1;const y=x=>{eS(x,()=>t.signal,()=>p=!0)},b=jp(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 E=(()=>{const N={client:t.client,queryKey:t.queryKey,pageParam:_,direction:C?"backward":"forward",meta:t.options.meta};return y(N),N})(),k=await b(E),{maxPages:D}=t.options,I=C?Jx:Xx;return{pages:I(x.pages,k,D),pageParams:I(x.pageParams,_,D)}};if(s&&i.length){const x=s==="backward",_=x?oS:id,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:id(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 id(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 oS(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var rr,Cn,sr,it,En,Me,Qr,Tn,Je,Bp,Rt,Gd,aS=(Gd=class extends Up{constructor(t){super();ne(this,Je);ne(this,rr);ne(this,Cn);ne(this,sr);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,T(this,En).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,W(this,Cn,ad(this.options)),this.state=t.state??T(this,Cn),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return T(this,rr)}get promise(){var t;return(t=T(this,Me))==null?void 0:t.promise}setOptions(t){if(this.options={...T(this,Qr),...t},t!=null&&t._type&&W(this,rr,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=ad(this.options);n.data!==void 0&&(this.setState(od(n.data,n.dataUpdatedAt)),W(this,Cn,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&T(this,it).remove(this)}setData(t,n){const r=Go(this.state.data,t,this.options);return he(this,Je,Rt).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,Rt).call(this,{type:"setState",state:t})}cancel(t){var r,s;const n=(r=T(this,Me))==null?void 0:r.promise;return(s=T(this,Me))==null||s.cancel(t),n?n.then(Ge).catch(Ge):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return T(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:!Lp(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=T(this,Me))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=T(this,Me))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),T(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||(T(this,Me)&&(T(this,Tn)||he(this,Je,Bp).call(this)?T(this,Me).cancel({revert:!0}):T(this,Me).cancelRetry()),this.scheduleGc()),T(this,it).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||he(this,Je,Rt).call(this,{type:"invalidate"})}async fetch(t,n){var d,u,f,g,m,h,p,y,b,v,x;if(this.state.fetchStatus!=="idle"&&((d=T(this,Me))==null?void 0:d.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(T(this,Me))return T(this,Me).continueRetry(),T(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 _=jp(this.options,n),P=(()=>{const E={client:T(this,En),queryKey:this.queryKey,meta:this.meta};return s(E),E})();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:T(this,En),state:this.state,fetchFn:i};return s(_),_})(),l=T(this,rr)==="infinite"?iS(this.options.pages):this.options.behavior;l==null||l.onFetch(a,this),W(this,sr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=a.fetchOptions)==null?void 0:u.meta))&&he(this,Je,Rt).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta}),W(this,Me,Fp({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:_=>{_ instanceof Zo&&_.revert&&this.setState({...T(this,sr),fetchStatus:"idle"}),r.abort()},onFail:(_,C)=>{he(this,Je,Rt).call(this,{type:"failed",failureCount:_,error:C})},onPause:()=>{he(this,Je,Rt).call(this,{type:"pause"})},onContinue:()=>{he(this,Je,Rt).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const _=await T(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=(g=T(this,it).config).onSuccess)==null||m.call(g,_,this),(p=(h=T(this,it).config).onSettled)==null||p.call(h,_,this.state.error,this),_}catch(_){if(_ instanceof Zo){if(_.silent)return T(this,Me).promise;if(_.revert){if(this.state.data===void 0)throw _;return this.state.data}}throw he(this,Je,Rt).call(this,{type:"error",error:_}),(b=(y=T(this,it).config).onError)==null||b.call(y,_,this),(x=(v=T(this,it).config).onSettled)==null||x.call(v,this.state.data,_,this),_}finally{this.scheduleGc()}}},rr=new WeakMap,Cn=new WeakMap,sr=new WeakMap,it=new WeakMap,En=new WeakMap,Me=new WeakMap,Qr=new WeakMap,Tn=new WeakMap,Je=new WeakSet,Bp=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Rt=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,...$p(r.data,this.options),fetchMeta:t.meta??null};case"success":const s={...r,...od(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return W(this,sr,t.manual?s:void 0),s;case"error":const i=t.error;return{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Ue.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),T(this,it).notify({query:this,type:"updated",action:t})})},Gd);function $p(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Mp(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function od(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function ad(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Ke,be,Xr,We,Pn,ir,Lt,Jt,Jr,or,ar,An,Nn,en,cr,xe,Fr,Yo,Qo,Xo,Jo,ea,ta,na,Vp,qd,cS=(qd=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,ir);ne(this,Lt);ne(this,Jt);ne(this,Jr);ne(this,or);ne(this,ar);ne(this,An);ne(this,Nn);ne(this,en);ne(this,cr,new Set);this.options=n,W(this,Ke,t),W(this,Jt,null),W(this,Lt,qo()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(T(this,be).addObserver(this),cd(T(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(T(this,be),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ra(T(this,be),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,he(this,xe,ea).call(this),he(this,xe,ta).call(this),T(this,be).removeObserver(this)}setOptions(t){const n=this.options,r=T(this,be);if(this.options=T(this,Ke).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof et(this.options.enabled,T(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),T(this,be).setOptions(this.options),n._defaulted&&!Wo(this.options,n)&&T(this,Ke).getQueryCache().notify({type:"observerOptionsUpdated",query:T(this,be),observer:this});const s=this.hasListeners();s&&ld(T(this,be),r,this.options,n)&&he(this,xe,Fr).call(this),this.updateResult(),s&&(T(this,be)!==r||et(this.options.enabled,T(this,be))!==et(n.enabled,T(this,be))||an(this.options.staleTime,T(this,be))!==an(n.staleTime,T(this,be)))&&he(this,xe,Yo).call(this);const i=he(this,xe,Qo).call(this);s&&(T(this,be)!==r||et(this.options.enabled,T(this,be))!==et(n.enabled,T(this,be))||i!==T(this,en))&&he(this,xe,Xo).call(this,i)}getOptimisticResult(t){const n=T(this,Ke).getQueryCache().build(T(this,Ke),t),r=this.createResult(n,t);return dS(this,r)&&(W(this,We,r),W(this,ir,this.options),W(this,Pn,T(this,be).state)),r}getCurrentResult(){return T(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&&T(this,Lt).status==="pending"&&T(this,Lt).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,s))})}trackProp(t){T(this,cr).add(t)}getCurrentQuery(){return T(this,be)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=T(this,Ke).defaultQueryOptions(t),r=T(this,Ke).getQueryCache().build(T(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(),T(this,We)))}createResult(t,n){var D;const r=T(this,be),s=this.options,i=T(this,We),o=T(this,Pn),a=T(this,ir),d=t!==r?t.state:T(this,Xr),{state:u}=t;let f={...u},g=!1,m;if(n._optimisticResults){const I=this.hasListeners(),N=!I&&cd(t,n),O=I&&ld(t,r,n,s);(N||O)&&(f={...f,...$p(u.data,t.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:h,errorUpdatedAt:p,status:y}=f;m=f.data;let b=!1;if(n.placeholderData!==void 0&&m===void 0&&y==="pending"){let I;i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(I=i.data,b=!0):I=typeof n.placeholderData=="function"?n.placeholderData((D=T(this,ar))==null?void 0:D.state.data,T(this,ar)):n.placeholderData,I!==void 0&&(y="success",m=Go(i==null?void 0:i.data,I,n),g=!0)}if(n.select&&m!==void 0&&!b)if(i&&m===(o==null?void 0:o.data)&&n.select===T(this,Jr))m=T(this,or);else try{W(this,Jr,n.select),m=n.select(m),m=Go(i==null?void 0:i.data,m,n),W(this,or,m),W(this,Jt,null)}catch(I){W(this,Jt,I)}T(this,Jt)&&(h=T(this,Jt),m=T(this,or),p=Date.now(),y="error");const v=f.fetchStatus==="fetching",x=y==="pending",_=y==="error",C=x&&v,P=m!==void 0,k={status:y,fetchStatus:f.fetchStatus,isPending:x,isSuccess:y==="success",isError:_,isInitialLoading:C,isLoading:C,data:m,dataUpdatedAt:f.dataUpdatedAt,error:h,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:g,isRefetchError:_&&P,isStale:bc(t,n),refetch:this.refetch,promise:T(this,Lt),isEnabled:et(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const I=k.data!==void 0,N=k.status==="error"&&!I,O=H=>{N?H.reject(k.error):I&&H.resolve(k.data)},B=()=>{const H=W(this,Lt,k.promise=qo());O(H)},R=T(this,Lt);switch(R.status){case"pending":t.queryHash===r.queryHash&&O(R);break;case"fulfilled":(N||k.data!==R.value)&&B();break;case"rejected":(!N||k.error!==R.reason)&&B();break}}return k}updateResult(){const t=T(this,We),n=this.createResult(T(this,be),this.options);if(W(this,Pn,T(this,be).state),W(this,ir,this.options),T(this,Pn).data!==void 0&&W(this,ar,T(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&&!T(this,cr).size)return!0;const o=new Set(i??T(this,cr));return this.options.throwOnError&&o.add("error"),Object.keys(T(this,We)).some(a=>{const l=a;return T(this,We)[l]!==t[l]&&o.has(l)})};he(this,xe,Vp).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,ir=new WeakMap,Lt=new WeakMap,Jt=new WeakMap,Jr=new WeakMap,or=new WeakMap,ar=new WeakMap,An=new WeakMap,Nn=new WeakMap,en=new WeakMap,cr=new WeakMap,xe=new WeakSet,Fr=function(t){he(this,xe,na).call(this);let n=T(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,T(this,be));if(qr.isServer()||T(this,We).isStale||!Ho(t))return;const r=Lp(T(this,We).dataUpdatedAt,t)+1;W(this,An,wn.setTimeout(()=>{T(this,We).isStale||this.updateResult()},r))},Qo=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(T(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,T(this,be))===!1||!Ho(T(this,en))||T(this,en)===0)&&W(this,Nn,wn.setInterval(()=>{(this.options.refetchIntervalInBackground||gc.isFocused())&&he(this,xe,Fr).call(this)},T(this,en)))},Jo=function(){he(this,xe,Yo).call(this),he(this,xe,Xo).call(this,he(this,xe,Qo).call(this))},ea=function(){T(this,An)!==void 0&&(wn.clearTimeout(T(this,An)),W(this,An,void 0))},ta=function(){T(this,Nn)!==void 0&&(wn.clearInterval(T(this,Nn)),W(this,Nn,void 0))},na=function(){const t=T(this,Ke).getQueryCache().build(T(this,Ke),this.options);if(t===T(this,be))return;const n=T(this,be);W(this,be,t),W(this,Xr,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Vp=function(t){Ue.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(T(this,We))}),T(this,Ke).getQueryCache().notify({query:T(this,be),type:"observerResultsUpdated"})})},qd);function lS(e,t){return et(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&et(t.retryOnMount,e)===!1)}function cd(e,t){return lS(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 ld(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 dS(e,t){return!Wo(e.getCurrentResult(),t)}var es,Ct,He,On,Et,Gt,Zd,uS=(Zd=class extends Up{constructor(t){super();ne(this,Et);ne(this,es);ne(this,Ct);ne(this,He);ne(this,On);W(this,es,t.client),this.mutationId=t.mutationId,W(this,He,t.mutationCache),W(this,Ct,[]),this.state=t.state||fS(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){T(this,Ct).includes(t)||(T(this,Ct).push(t),this.clearGcTimeout(),T(this,He).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){W(this,Ct,T(this,Ct).filter(n=>n!==t)),this.scheduleGc(),T(this,He).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){T(this,Ct).length||(this.state.status==="pending"?this.scheduleGc():T(this,He).remove(this))}continue(){var t;return((t=T(this,On))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,a,l,d,u,f,g,m,h,p,y,b,v,x,_,C,P,E;const n=()=>{he(this,Et,Gt).call(this,{type:"continue"})},r={client:T(this,es),meta:this.options.meta,mutationKey:this.options.mutationKey};W(this,On,Fp({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(k,D)=>{he(this,Et,Gt).call(this,{type:"failed",failureCount:k,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:()=>T(this,He).canRun(this)}));const s=this.state.status==="pending",i=!T(this,On).canStart();try{if(s)n();else{he(this,Et,Gt).call(this,{type:"pending",variables:t,isPaused:i}),T(this,He).config.onMutate&&await T(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 k=await T(this,On).start();return await((d=(l=T(this,He).config).onSuccess)==null?void 0:d.call(l,k,t,this.state.context,this,r)),await((f=(u=this.options).onSuccess)==null?void 0:f.call(u,k,t,this.state.context,r)),await((m=(g=T(this,He).config).onSettled)==null?void 0:m.call(g,k,null,this.state.variables,this.state.context,this,r)),await((p=(h=this.options).onSettled)==null?void 0:p.call(h,k,null,t,this.state.context,r)),he(this,Et,Gt).call(this,{type:"success",data:k}),k}catch(k){try{await((b=(y=T(this,He).config).onError)==null?void 0:b.call(y,k,t,this.state.context,this,r))}catch(D){Promise.reject(D)}try{await((x=(v=this.options).onError)==null?void 0:x.call(v,k,t,this.state.context,r))}catch(D){Promise.reject(D)}try{await((C=(_=T(this,He).config).onSettled)==null?void 0:C.call(_,void 0,k,this.state.variables,this.state.context,this,r))}catch(D){Promise.reject(D)}try{await((E=(P=this.options).onSettled)==null?void 0:E.call(P,void 0,k,t,this.state.context,r))}catch(D){Promise.reject(D)}throw he(this,Et,Gt).call(this,{type:"error",error:k}),k}finally{T(this,He).runNext(this)}}},es=new WeakMap,Ct=new WeakMap,He=new WeakMap,On=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(()=>{T(this,Ct).forEach(r=>{r.onMutationUpdate(t)}),T(this,He).notify({mutation:this,type:"updated",action:t})})},Zd);function fS(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var jt,ut,ts,Yd,pS=(Yd=class extends cs{constructor(t={}){super();ne(this,jt);ne(this,ut);ne(this,ts);this.config=t,W(this,jt,new Set),W(this,ut,new Map),W(this,ts,0)}build(t,n,r){const s=new uS({client:t,mutationCache:this,mutationId:++fs(this,ts)._,options:t.defaultMutationOptions(n),state:r});return this.add(s),s}add(t){T(this,jt).add(t);const n=Ts(t);if(typeof n=="string"){const r=T(this,ut).get(n);r?r.push(t):T(this,ut).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(T(this,jt).delete(t)){const n=Ts(t);if(typeof n=="string"){const r=T(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&&T(this,ut).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Ts(t);if(typeof n=="string"){const r=T(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=T(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(()=>{T(this,jt).forEach(t=>{this.notify({type:"removed",mutation:t})}),T(this,jt).clear(),T(this,ut).clear()})}getAll(){return Array.from(T(this,jt))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>nd(n,r))}findAll(t={}){return this.getAll().filter(n=>nd(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))))}},jt=new WeakMap,ut=new WeakMap,ts=new WeakMap,Yd);function Ts(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Tt,Qd,mS=(Qd=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 aS({client:t,queryKey:s,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){T(this,Tt).has(t.queryHash)||(T(this,Tt).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=T(this,Tt).get(t.queryHash);n&&(t.destroy(),n===t&&T(this,Tt).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Ue.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return T(this,Tt).get(t)}getAll(){return[...T(this,Tt).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>td(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>td(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,Qd),ke,tn,nn,lr,dr,rn,ur,fr,Xd,hS=(Xd=class{constructor(e={}){ne(this,ke);ne(this,tn);ne(this,nn);ne(this,lr);ne(this,dr);ne(this,rn);ne(this,ur);ne(this,fr);W(this,ke,e.queryCache||new mS),W(this,tn,e.mutationCache||new pS),W(this,nn,e.defaultOptions||{}),W(this,lr,new Map),W(this,dr,new Map),W(this,rn,0)}mount(){fs(this,rn)._++,T(this,rn)===1&&(W(this,ur,gc.subscribe(async e=>{e&&(await this.resumePausedMutations(),T(this,ke).onFocus())})),W(this,fr,ai.subscribe(async e=>{e&&(await this.resumePausedMutations(),T(this,ke).onOnline())})))}unmount(){var e,t;fs(this,rn)._--,T(this,rn)===0&&((e=T(this,ur))==null||e.call(this),W(this,ur,void 0),(t=T(this,fr))==null||t.call(this),W(this,fr,void 0))}isFetching(e){return T(this,ke).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return T(this,tn).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=T(this,ke).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=T(this,ke).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 T(this,ke).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=T(this,ke).get(r.queryHash),i=s==null?void 0:s.state.data,o=Zx(t,i);if(o!==void 0)return T(this,ke).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return Ue.batch(()=>T(this,ke).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=T(this,ke).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=T(this,ke);Ue.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=T(this,ke);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(()=>T(this,ke).findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(Ge).catch(Ge)}invalidateQueries(e,t={}){return Ue.batch(()=>(T(this,ke).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(()=>T(this,ke).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=T(this,ke).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()?T(this,tn).resumePausedMutations():Promise.resolve()}getQueryCache(){return T(this,ke)}getMutationCache(){return T(this,tn)}getDefaultOptions(){return T(this,nn)}setDefaultOptions(e){W(this,nn,e)}setQueryDefaults(e,t){T(this,lr).set(Kr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...T(this,lr).values()],n={};return t.forEach(r=>{Gr(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){T(this,dr).set(Kr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...T(this,dr).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={...T(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:{...T(this,nn).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){T(this,ke).clear(),T(this,tn).clear()}},ke=new WeakMap,tn=new WeakMap,nn=new WeakMap,lr=new WeakMap,dr=new WeakMap,rn=new WeakMap,ur=new WeakMap,fr=new WeakMap,Xd),Hp=w.createContext(void 0),zp=e=>{const t=w.useContext(Hp);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},gS=({client:e,children:t})=>(w.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),c.jsx(Hp.Provider,{value:e,children:t})),Wp=w.createContext(!1),yS=()=>w.useContext(Wp);Wp.Provider;function bS(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var vS=w.createContext(bS()),wS=()=>w.useContext(vS),_S=(e,t,n)=>{const r=n!=null&&n.state.error&&typeof e.throwOnError=="function"?Ip(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},xS=e=>{w.useEffect(()=>{e.clearReset()},[e])},SS=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||Ip(n,[e.error,r])),CS=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))}},ES=(e,t)=>e.isLoading&&e.isFetching&&!t,TS=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,dd=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function PS(e,t,n){var m,h,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=yS(),s=wS(),i=zp(),o=i.defaultQueryOptions(e);(h=(m=i.getDefaultOptions().queries)==null?void 0:m._experimental_beforeQuery)==null||h.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,CS(o),_S(o,s,a),xS(s);const d=!i.getQueryCache().get(o.queryHash),[u]=w.useState(()=>new t(i,o)),f=u.getOptimisticResult(o),g=!r&&l;if(w.useSyncExternalStore(w.useCallback(b=>{const v=g?u.subscribe(Ue.batchCalls(b)):Ge;return u.updateResult(),v},[u,g]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),w.useEffect(()=>{u.setOptions(o)},[o,u]),TS(o,f))throw dd(o,u,s);if(SS({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()&&ES(f,r)){const b=d?dd(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 Or(e,t){return PS(e,cS)}const Kp=S.createContext(null);function AS(e){return typeof window>"u"?e??null:e?(localStorage.setItem(xp,e),e):null}function NS({token:e,children:t}){const n=AS(e);return c.jsx(Kp.Provider,{value:n,children:t})}function OS(){return S.useContext(Kp)}const kS="widget-accounts",Gp="widget-positions",qp="widget-orders",RS="widget-deals",DS="widget-deals-total",LS=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 jS(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=jS(e);if(n!==void 0)return vc(n)}return"—"}const Zp=["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 IS(e){return $s(e)}const MS={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 FS(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 US(e,t){return Mf(t,e)}function BS(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:MS[n]??(n%2===1?"sell":"buy"),side:ni(n),typeNum:n}}function $S(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 VS(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}=BS(e),l=xt(e,["typeTime","TypeTime"])??0,d=sa(xt(e,["volumeLots","volume_lots","VolumeLots","volume","Volume"])),u=$S(e),f=xt(e,["priceOrder","price_order","PriceOrder","openPrice","open_price","price","Price"])??0,g=xt(e,["priceTrigger","price_trigger","PriceTrigger","triggerPrice","TriggerPrice"]),m=xt(e,["currentPrice","current_price","PriceCurrent","priceCurrent","marketPrice","MarketPrice"])??f,h=xt(e,["stopLoss","stop_loss","PriceSL","sl","SL"]),p=xt(e,["takeProfit","take_profit","PriceTP","tp","TP"]),y=Ps(e,["comment","Comment"])??"",b=US(e,s),v=vc(Bi(e,Zp));return{ticket:n,login:Ps(e,["login","Login"])??t,symbol:s,displaySymbol:Oi(s),time:v,typeLabel:i,orderType:a,typeTime:l,side:o,volumeLots:d,volumeFilledLots:u,orderPrice:f,priceTrigger:g,stopLoss:h,takeProfit:p,currentPrice:m,comment:y,digits:b}}function HS(e,t){return FS(e).map(n=>VS(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 As(e,t){const n=$i(e,t);if(n!==void 0)return String(n)}function zS(e){if(Array.isArray(e))return e.filter(r=>typeof r=="object"&&r!==null);if(!e||typeof e!="object")return[];const t=e,n=["data","body","result"];for(const r of n){const s=t[r];if(Array.isArray(s))return s.filter(i=>typeof i=="object"&&i!==null);if(s&&typeof s=="object"){const i=s,o=["list","items","records","positions","orders","content","data"];for(const a of o){const l=i[a];if(Array.isArray(l))return l.filter(d=>typeof d=="object"&&d!==null)}}}return[]}function WS(e){return e===void 0?.01:e>=100?e/1e4:e}function KS(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 GS(e,t){return Mf(t,e)}function qS(e,t){const n=As(e,["ticket","Ticket","position","Position","order","Order","id","ID"]),r=As(e,["symbol","Symbol"])??"";if(!n||!r)return null;const s=Ye(r),i=KS(e),o=WS(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,g=qt(e,["swap","Swap"])??0,m=As(e,["comment","Comment"])??"",h=GS(e,s),p=vc($i(e,Zp));return{ticket:n,login:As(e,["login","Login"])??t,symbol:s,displaySymbol:Oi(s),time:p,type:i,volumeLots:o,openPrice:a,stopLoss:d,takeProfit:u,currentPrice:l,marketBid:l,marketAsk:l,swap:g,profit:f,comment:m,digits:h}}function ZS(e,t){return zS(e).map(n=>qS(n,t)).filter(n=>n!==null)}function ls(){return Ut}function Yp(){const e=Ht(),t=OS(),{data:n,isLoading:r,isError:s}=Or({queryKey:[kS,e.baseUrl,t],queryFn:()=>e.getAccounts(),enabled:!!t});return{accounts:n??[],isLoading:r,isError:s}}function YS(e){const t=Ht();return Or({queryKey:[Gp,t.baseUrl,e],queryFn:()=>t.dealer.getPositions(e),enabled:!!e,refetchInterval:LS})}function QS(e){const t=Ht();return Or({queryKey:[qp,t.baseUrl,e],queryFn:()=>t.dealer.getOrders(e),enabled:!!e})}function XS(){const e=zp(),t=Ht();return S.useCallback((n,r)=>{e.invalidateQueries({queryKey:[Gp,t.baseUrl,n]}),(r===void 0||nc(r))&&e.invalidateQueries({queryKey:[qp,t.baseUrl,n]})},[t.baseUrl,e])}function Vi(){const e=Ht(),t=XS();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 JS(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 e0(e){if(e===null||typeof e!="object")return{total:0};const t=e,n=t.data??t;return{total:Number(n.total??0)}}function t0(e,t,n,r={}){const s=Ht();return Or({queryKey:[DS,s.baseUrl,e,t,n],queryFn:async()=>{const i=await s.dealer.getDealsTotal(e,t,n);return e0(i)},enabled:r.enabled??!0})}function n0(e,t,n,r,s,i={}){const o=Ht();return Or({queryKey:[RS,o.baseUrl,e,t,n,r,s],queryFn:async()=>{const a=await o.dealer.getDeals(e,t,n,r,s);return JS(a)},enabled:i.enabled??!0})}function r0(e,t){return e!=null?ZS(e,t):[]}function s0(e,t){return e!=null?HS(e,t):[]}function i0({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(Dp,{chartWidget:n,symbolTicker:e,symbols:d}),c.jsx(Tp,{}),c.jsx(Ax,{symbolTicker:e,scanResultUrl:r,orderState:s,backUrl:i,createAccountUrl:o})]})}const o0=8,ud=11;function a0({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 c0(){return c.jsx(c.Fragment,{children:Array.from({length:o0},(e,t)=>c.jsx("tr",{className:"web-trading-widget-terminal__skeleton-row",children:Array.from({length:ud},(n,r)=>c.jsx(a0,{wide:r===ud-1},r))},t))})}const l0={0:"Buy",1:"Sell",2:"Balance",3:"Credit",5:"-"},d0="web-trading-widget-text-buy",u0="web-trading-widget-text-sell",f0="web-trading-widget-terminal__head-row",bo=50;function p0(e){return e===0?d0:e===1?u0:f0}const fd=e=>e.toISOString().split("T")[0],Qp=e=>Math.floor(new Date(e).getTime()/1e3),m0=e=>Qp(e),h0=e=>Qp(e)+86399;function g0(){const e=new Date,t=new Date;return t.setDate(t.getDate()-7),{fromTs:m0(fd(t)),toTs:h0(fd(e))}}const y0=e=>new Date(e*1e3).toLocaleString(void 0,{year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"});function b0(e){try{return decodeURIComponent(e)}catch{return e}}function v0(){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 w0(){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 _0({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 ${p0(e.action)}`,children:l0[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:IS(new Date(e.time*1e3))}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--nowrap",children:y0(e.time)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--truncate",children:e.comment?b0(e.comment):"—"})]})}function x0({login:e,detailUrl:t}){const{fromTs:n,toTs:r}=S.useMemo(()=>g0(),[]),s=e!=="",{data:i,isLoading:o}=t0(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}=n0(e,n,r,l,d,{enabled:s}),g=s&&(o||f),m=S.useMemo(()=>[...(u==null?void 0:u.deals)??[]].sort((h,p)=>p.time-h.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(v0,{}),c.jsx(w0,{}),c.jsxs("tbody",{children:[g?c.jsx(c0,{}):null,!g&&m.length===0?c.jsx("tr",{children:c.jsx("td",{colSpan:11,className:"web-trading-widget-terminal__empty-cell",children:"No deals found"})}):null,g?null:m.map(h=>c.jsx(_0,{deal:h},h.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 Xp(e){const t=ve(d=>d.setPositions),n=ve(d=>d.setOrders),{data:r,isLoading:s,isError:i}=YS(e),{data:o,isLoading:a,isError:l}=QS(e);return S.useEffect(()=>{if(!e.trim()){t([]),n([]);return}r!=null&&t(r0(r,e)),o!=null&&n(s0(o,e))},[e,o,r,n,t]),{isLoading:s||a,isError:!!(i||l)}}const pd=224,md=32,wc=120;function Jp(){return typeof window>"u"?560:Math.max(wc,Math.floor(window.innerHeight*.7))}function S0(e){return Math.min(Jp(),Math.max(wc,e))}function C0(){const[e,t]=S.useState(pd),[n,r]=S.useState(!1),s=S.useRef(pd);S.useEffect(()=>{s.current=e},[e]);const i=S.useCallback(u=>{t(S0(u))},[]),o=S.useCallback(()=>{i(s.current+md)},[i]),a=S.useCallback(()=>{i(s.current-md)},[i]),l=S.useCallback(u=>{const f=u,g=s.current;r(!0);const m=p=>{const y=f-p.clientY;i(g+y)},h=()=>{r(!1),document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",h),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",m),document.addEventListener("mouseup",h),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=Jp();return{height:e,isResizing:n,canIncrement:e<d,canDecrement:e>wc,onResizeStart:l,incrementHeight:o,decrementHeight:a}}const E0=e=>e==null?void 0:e.replace(/(\d+)\.0{18}/g,"$1"),T0=2e4;let vo=0;function P0(){return vo=(vo+1)%Number.MAX_VALUE,vo.toString()}const wo=new Map,hd=(e,t)=>{if(wo.has(e))return;const n=setTimeout(()=>{wo.delete(e),Br({type:"REMOVE_TOAST",toastId:e})},t||T0);wo.set(e,n)},A0=(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);hd(r,s==null?void 0:s.duration)}else e.toasts.forEach(s=>{hd(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=A0(Hs,e),Vs.forEach(t=>{t(Hs)})}function Ce({duration:e=2e4,description:t,...n}){const r=P0(),s=typeof t=="string"?E0(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 N0(){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:Ce,dismiss:n=>Br({type:"DISMISS_TOAST",toastId:n})}}function O0(e){return e.type==="buy"?e.marketBid??e.currentPrice:e.marketAsk??e.currentPrice}function k0(){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]),g=S.useCallback(async p=>{const y=`position-${p.ticket}`;u(y,!0);try{const b=await e(p);if(!b.success){Ce({variant:"destructive",description:b.message||"Failed to close position."});return}n(p.ticket),s(null),Ce({description:`Position #${p.ticket} closed at ${O0(p).toFixed(p.digits)}.`})}catch(b){const v=b instanceof Error?b.message:"Failed to close position.";Ce({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){Ce({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),Ce(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]),h=S.useCallback(async p=>{const y=`order-${p.ticket}`;u(y,!0);try{const b=await t(p);if(!b.success){Ce({variant:"destructive",description:b.message||"Failed to delete order."});return}r(p.ticket),i(null),Ce({description:`Order #${p.ticket} deleted.`})}catch(b){const v=b instanceof Error?b.message:"Failed to delete order.";Ce({variant:"destructive",description:v})}finally{u(y,!1)}},[t,r,u,i]);return{closePosition:g,closeAllPositions:m,deleteOrder:h,isClosingAll:l,isRowBusy:f}}function Zt(e,t=2){return e.toFixed(t)}function em(e){return e.reduce((t,n)=>t+n.profit+n.swap,0)}function R0(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=em(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 D0(){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 L0({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 j0=[{id:"trade",label:"Trade"},{id:"history",label:"History"}];function I0({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:[j0.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 M0({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 F0({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 tm({embedded:e=!1,symbolTicker:t="",onSymbolChange:n,onCreateNewOrder:r,dealDetailUrl:s}){const[i,o]=S.useState("trade"),a=ls(),{accounts:l,isLoading:d}=Yp(),u=C0(),{height:f,isResizing:g,onResizeStart:m}=e?{height:0,isResizing:!1,onResizeStart:()=>{}}:u,h=ve($=>$.selectedLogin),p=ve($=>$.selectedPositionTicket),y=ve($=>$.selectedOrderTicket),b=ve($=>$.setSelectedPositionTicket),v=ve($=>$.setSelectedOrderTicket),{isLoading:x}=Xp(h),_=ve($=>$.positions),C=ve($=>$.orders),{closePosition:P,closeAllPositions:E,deleteOrder:k,isClosingAll:D,isRowBusy:I}=k0(),N=d||x,O=S.useMemo(()=>h?_.filter($=>$.login===h):_,[_,h]),B=S.useMemo(()=>h?C.filter($=>$.login===h):C,[C,h]),R=S.useMemo(()=>{const $=l.find(ye=>ye.login===h);return($==null?void 0:$.tradeStat)??null},[l,h]),H=S.useMemo(()=>O.map($=>$.ticket).sort().join("|"),[O]),F=S.useMemo(()=>R?`${R.balance}:${R.credit??0}:${R.equity}:${R.margin}|${H}`:"",[R,H]),M=S.useMemo(()=>{if(!R||O.length===0)return 0;const $=em(O);return R.equity-R.balance-(R.credit??0)-$},[F]),L=S.useMemo(()=>R0(R,O,M),[R,O,M]),U=O.length===0&&B.length===0,K=S.useRef(null),j=S.useRef(null),se=S.useRef(null),z=S.useCallback(()=>{E(O)},[E,O]),de=S.useCallback($=>{const ye=$v($,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=j.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&&g?c.jsx("div",{className:"web-trading-widget-terminal-resize-overlay","aria-hidden":!0}):null,c.jsxs("div",{className:`web-trading-widget-terminal${e?" web-trading-widget-terminal--embedded":""}`,style:e?void 0:{height: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(jf,{className:"web-trading-widget-icon web-trading-widget-icon--sm web-trading-widget-terminal__resize-icon"})})}),c.jsx(I0,{activeTab:i,onTabChange:o,positionCount:O.length,isClosingAll:D,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(D0,{})]})}),c.jsx("div",{ref:j,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:[N&&U?c.jsx("tr",{children:c.jsx("td",{colSpan:13,className:"web-trading-widget-terminal__empty-cell",children:"Loading…"})}):null,!N&&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,O.map($=>c.jsx(M0,{position:$,isSelected:p===$.ticket,isClosing:I(`position-${$.ticket}`),onSelect:()=>ue($),onClose:()=>void P($)},`position-${$.ticket}`)),B.map($=>c.jsx(F0,{order:$,isSelected:y===$.ticket,isDeleting:I(`order-${$.ticket}`),onSelect:()=>ee($),onDelete:()=>void k($)},`order-${$.ticket}`))]})]})})]}):c.jsx(x0,{login:h??"",detailUrl:s}),c.jsx(L0,{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 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*.35)):oa}function B0(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 $0(e,t){return Math.min(B0(t),Math.max(ci,e))}function V0({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($0(d,e))},[e]);S.useEffect(()=>{if(!t)return;const d=Math.max(o.current,U0(e));a(d)},[e,t,a]);const l=S.useCallback(d=>{const u=d,f=o.current;i(!0);const g=h=>{const p=u-h.clientY;a(f+p)},m=()=>{i(!1),document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",m),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",g),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 nm({children:e}){const[t]=S.useState(()=>new hS({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}}));return c.jsx(gS,{client:t,children:e})}function rm({containerRef:e,onCreateNewOrder:t}){const[n,r]=S.useState(!1),{height:s,isResizing:i,onResizeStart:o}=V0({containerRef:e,isOpen:n}),a=ve(h=>h.selectedLogin),l=ve(h=>h.orders),d=ve(h=>h.positions),u=S.useMemo(()=>a?l.filter(h=>h.login===a):l,[a,l]),f=S.useMemo(()=>a?d.filter(h=>h.login===a):d,[a,d]),g=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(Tv,{className:"web-trading-widget-icon web-trading-widget-icon--sm"}),c.jsx("span",{children:"Orders"}),g>0?c.jsx("span",{className:"web-trading-widget-news-orders-overlay__badge",children:g}):null]}),n?c.jsx(c.Fragment,{children:c.jsxs("div",{className:"web-trading-widget-news-orders__panel",style:{height:s},children:[i?c.jsx("div",{className:"web-trading-widget-terminal-resize-overlay","aria-hidden":!0}):null,c.jsx("div",{className:"web-trading-widget-news-orders__panel-resize-bar-wrap",children:c.jsx("div",{role:"separator","aria-orientation":"horizontal","aria-label":"Resize terminal panel","aria-valuenow":s,className:"web-trading-widget-terminal__resize-bar",onMouseDown:h=>{h.preventDefault(),o(h.clientY)},children:c.jsx(jf,{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(tm,{embedded:!0,onCreateNewOrder:t?m:void 0})})]})}):null]})}function H0({baseUrl:e,containerRef:t,onCreateNewOrder:n}){return c.jsx(nm,{children:c.jsx(Cp,{baseUrl:e,children:c.jsx(rm,{containerRef:t,onCreateNewOrder:n})})})}const Rn=S.forwardRef(({className:e,type:t,...n},r)=>c.jsx("input",{type:t,className:Se("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",[z0,sm]=Bn(Hi),[W0,_c]=z0(Hi),im=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(W0,{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})})});im.displayName=Hi;var om="CollapsibleTrigger",am=w.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,s=_c(om,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)})});am.displayName=om;var xc="CollapsibleContent",cm=w.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=_c(xc,e.__scopeCollapsible);return c.jsx($n,{present:n||s.open,children:({present:i})=>c.jsx(K0,{...r,ref:t,present:i})})});cm.displayName=xc;var K0=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),g=f.current,m=w.useRef(0),h=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":g?`${g}px`:void 0,"--radix-collapsible-content-width":h?`${h}px`:void 0,...e.style},children:p&&s})});function Sc(e){return e?"open":"closed"}var G0=im,q0=am,Z0=cm,wt="Accordion",Y0=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[Cc,Q0,X0]=Da(wt),[zi]=Bn(wt,[X0,sm]),Ec=sm(),lm=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(nC,{...i,ref:t}):c.jsx(tC,{...s,ref:t})})});lm.displayName=wt;var[dm,J0]=zi(wt),[um,eC]=zi(wt,{collapsible:!1}),tC=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(dm,{scope:e.__scopeAccordion,value:w.useMemo(()=>a?[a]:[],[a]),onItemOpen:l,onItemClose:w.useCallback(()=>i&&l(""),[i,l]),children:c.jsx(um,{scope:e.__scopeAccordion,collapsible:i,children:c.jsx(fm,{...o,ref:t})})})}),nC=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(g=>g!==u)),[a]);return c.jsx(dm,{scope:e.__scopeAccordion,value:o,onItemOpen:l,onItemClose:d,children:c.jsx(um,{scope:e.__scopeAccordion,collapsible:!0,children:c.jsx(fm,{...i,ref:t})})})}),[rC,Wi]=zi(wt),fm=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=Q0(n),f=Mu(s)==="ltr",g=pe(e.onKeyDown,m=>{var k;if(!Y0.includes(m.key))return;const h=m.target,p=d().filter(D=>{var I;return!((I=D.ref.current)!=null&&I.disabled)}),y=p.findIndex(D=>D.ref.current===h),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 E=v%b;(k=p[E].ref.current)==null||k.focus()});return c.jsx(rC,{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:g})})})}),li="AccordionItem",[sC,Tc]=zi(li),pm=w.forwardRef((e,t)=>{const{__scopeAccordion:n,value:r,...s}=e,i=Wi(li,n),o=J0(li,n),a=Ec(n),l=on(),d=r&&o.value.includes(r)||!1,u=i.disabled||e.disabled;return c.jsx(sC,{scope:n,open:d,disabled:u,triggerId:l,children:c.jsx(G0,{"data-orientation":i.orientation,"data-state":vm(d),...a,...s,ref:t,disabled:u,open:d,onOpenChange:f=>{f?o.onItemOpen(r):o.onItemClose(r)}})})});pm.displayName=li;var mm="AccordionHeader",hm=w.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=Wi(wt,n),i=Tc(mm,n);return c.jsx(me.h3,{"data-orientation":s.orientation,"data-state":vm(i.open),"data-disabled":i.disabled?"":void 0,...r,ref:t})});hm.displayName=mm;var aa="AccordionTrigger",gm=w.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=Wi(wt,n),i=Tc(aa,n),o=eC(aa,n),a=Ec(n);return c.jsx(Cc.ItemSlot,{scope:n,children:c.jsx(q0,{"aria-disabled":i.open&&!o.collapsible||void 0,"data-orientation":s.orientation,id:i.triggerId,...a,...r,ref:t})})});gm.displayName=aa;var ym="AccordionContent",bm=w.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=Wi(wt,n),i=Tc(ym,n),o=Ec(n);return c.jsx(Z0,{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}})});bm.displayName=ym;function vm(e){return e?"open":"closed"}var iC=lm,oC=pm,aC=hm,wm=gm,_m=bm;const cC=iC,Gn=w.forwardRef(({className:e,...t},n)=>c.jsx(oC,{ref:n,className:Se("border-b",e),...t}));Gn.displayName="AccordionItem";const qn=w.forwardRef(({className:e,children:t,...n},r)=>c.jsx(aC,{className:"flex",children:c.jsxs(wm,{ref:r,className:Se("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"})]})}));qn.displayName=wm.displayName;const Zn=w.forwardRef(({className:e,children:t,...n},r)=>c.jsx(_m,{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:Se("pb-4 pt-0",e),children:t})}));Zn.displayName=_m.displayName;function gd(e){const t=e.trim().replace(/,/g,"");if(!t)return null;const n=Number(t);return Number.isFinite(n)?n:null}function yd(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=h=>{if(l)return;const p=gd(t),y=a!=null&&Number.isFinite(a)?a:s??0,v=(p??y)+h*r,x=s!==void 0?Math.max(s,v):v;x<=0||n(yd(x,i))},g=()=>{const h=gd(t);if(h===null||h<=0){t.trim()!==""&&n("");return}n(yd(h,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(Av,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})}),c.jsx("input",{type:"text",inputMode:"decimal",value:t,placeholder:o,disabled:l,onChange:h=>n(h.target.value),onBlur:g,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(Nv,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})]})]})}function lC({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:g}){const[m,h]=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),E=oe(re=>re.setStopLoss),k=oe(re=>re.setTakeProfit),D=oe(re=>re.setVolumeLots),I=oe(re=>re.setOrderSide),[N,O]=S.useState(""),[B,R]=S.useState(ft.GTC),[H,F]=S.useState(""),[M,L]=S.useState(""),U=Number($t(Vt(e))),K=Pr(U),j=$f(t,n),se=t!==null?Ee(t,U):"—",z=n!==null?Ee(n,U):"—",de=Ri(m),ue=Ff(m),ee=ki(m),Z=ee.label,$=!de&&ee.orderType!==null&&ee.orderType%2===1,ye=S.useMemo(()=>j!==null?j:t??n,[n,t,j]),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&&I({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&&I({side:re,entryPrice:us}),g({login:l,executionMode:m,side:re,orderType:qi,volumeLots:$e,stopLoss:C,takeProfit:P,priceOrder:b,priceTrigger:x,comment:N,typeTime:B,expirationDateTime:H,expirationDay:M,bid:t,ask:n})},Re=t!==null&&n!==null,Oe=de||pt(b)!==void 0,X=!ue||pt(x)!==void 0,Ae=de||Li(B,H,M),Fe=!o&&!a&&l!==""&&Re&&Oe&&X&&Ae,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=>h(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(Pv,{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(cC,{type:"multiple",defaultValue:["volume-setting","risk-management"],className:"web-trading-widget-market-panel__accordion",children:[c.jsxs(Gn,{value:"volume-setting",className:"web-trading-widget-market-panel__accordion-item",children:[c.jsx(qn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Volume Setting"}),c.jsx(Zn,{className:"web-trading-widget-market-panel__accordion-content",children:c.jsx(De,{label:"Lots",value:p,onChange:ae,step:s,min:i,decimals:2})})]}),de?null:c.jsxs(Gn,{value:"order-price",className:"web-trading-widget-market-panel__accordion-item",children:[c.jsx(qn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Order Price"}),c.jsx(Zn,{className:"web-trading-widget-market-panel__accordion-content",children:ue?c.jsxs(c.Fragment,{children:[c.jsx(De,{label:"Stop Price",value:x,onChange:_,step:K,decimals:U,basePrice:ye,placeholder:j!==null?Ee(j,U):"—"}),c.jsx(De,{label:"Limit Price",value:b,onChange:v,step:K,decimals:U,basePrice:ye,placeholder:j!==null?Ee(j,U):"—"})]}):c.jsx(De,{label:"Price",value:b,onChange:v,step:K,decimals:U,basePrice:ye,placeholder:j!==null?Ee(j,U):"—"})})]}),c.jsxs(Gn,{value:"risk-management",className:"web-trading-widget-market-panel__accordion-item",children:[c.jsx(qn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Risk Management"}),c.jsx(Zn,{className:"web-trading-widget-market-panel__accordion-content",children:c.jsxs("div",{className:"web-trading-widget-market-panel__grid-2",children:[c.jsx(De,{label:"Stop Loss",value:C,onChange:E,step:K,decimals:U,basePrice:t,placeholder:t!==null?se:"—",clearable:!0}),c.jsx(De,{label:"Take Profit",value:P,onChange:k,step:K,decimals:U,basePrice:n,placeholder:n!==null?z:"—",clearable:!0})]})})]}),de?null:c.jsxs(Gn,{value:"expiration",className:"web-trading-widget-market-panel__accordion-item",children:[c.jsx(qn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Expiration"}),c.jsxs(Zn,{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:Uf.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:M,onChange:re=>L(re.target.value)})]}):null]})]}),c.jsxs(Gn,{value:"comment",className:"web-trading-widget-market-panel__accordion-item",children:[c.jsx(qn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Comment"}),c.jsx(Zn,{className:"web-trading-widget-market-panel__accordion-content",children:c.jsx(Rn,{value:N,onChange:re=>O(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 xm({confirmation:e,symbolTicker:t,onDismiss:n}){const r=Number($t(Vt(t))),s=Ee(e.price,r),i=e.side==="sell"?"sell":"buy",o=Oi(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 Ns(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 Sm({order:e,onClose:t}){const{deleteOrder:n,modifyOrder:r}=Vi(),s=ve(M=>M.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(M=>M.stopLoss),g=oe(M=>M.takeProfit),m=oe(M=>M.setStopLoss),h=oe(M=>M.setTakeProfit),p=oe(M=>M.setDraft),y=oe(M=>M.clearDraft),[b,v]=S.useState(e.comment),[x,_]=S.useState(!1),[C,P]=S.useState(!1),E=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:E}),()=>{y()}),[y,e.digits,e.orderPrice,e.side,e.stopLoss,e.takeProfit,e.volumeLots,E,p]);const k=rc(e.orderType),D=e.volumeLots,I=Number(a)||e.orderPrice,N=_o(d),O=x||C,B=!k||N!==void 0&&Number.isFinite(I)&&I>0,R=S.useMemo(()=>`Delete #${e.ticket} ${e.typeLabel} ${D.toFixed(2)} ${e.displaySymbol} at ${Ns(I,e.digits)}`,[e,I,D]),H=async()=>{if(!B){Ce({variant:"destructive",description:k?"Please set both stop and limit prices.":"Please set an order price."});return}_(!0);try{const M=await r(e,{volumeLots:D,priceOrder:I,priceTrigger:k?N:void 0,stopLoss:_o(f),takeProfit:_o(g),comment:b.trim()||"order modify"});if(!M.success){Ce({variant:"destructive",description:M.message||"Failed to modify order."});return}t(),Ce({description:`Order #${e.ticket} updated.`})}catch(M){const L=M instanceof Error?M.message:"Failed to modify order.";Ce({variant:"destructive",description:L})}finally{_(!1)}},F=async()=>{P(!0);try{const M=await n(e);if(!M.success){Ce({variant:"destructive",description:M.message||"Failed to delete order."});return}s(e.ticket),t(),Ce({description:`Order #${e.ticket} deleted.`})}catch(M){const L=M instanceof Error?M.message:"Failed to delete order.";Ce({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," ",k&&N!==void 0?`${Ns(N,e.digits)} / ${Ns(I,e.digits)}`:Ns(I,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}),k?c.jsxs(c.Fragment,{children:[c.jsx(De,{label:"Stop Price",value:d,onChange:u,step:E,decimals:e.digits,basePrice:e.currentPrice}),c.jsx(De,{label:"Limit Price",value:a,onChange:l,step:E,decimals:e.digits,basePrice:e.currentPrice})]}):c.jsx(De,{label:"Price",value:a,onChange:l,step:E,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:E,decimals:e.digits,basePrice:e.currentPrice,placeholder:"—"}),c.jsx(De,{label:"Take Profit",value:g,onChange:h,step:E,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:M=>v(M.target.value)})]}),c.jsx(ot,{type:"button",variant:"secondary",className:"web-trading-widget-detail-panel__btn-full",disabled:O||!B,onClick:()=>void H(),children:"Modify"}),c.jsx(ot,{type:"button",className:"web-trading-widget-detail-panel__action-btn",disabled:O,onClick:()=>void F(),children:R})]})]})}function Os(e,t){return e.toLocaleString(void 0,{minimumFractionDigits:t,maximumFractionDigits:t})}function dC(e){return e.type==="buy"?e.marketBid??e.currentPrice:e.marketAsk??e.currentPrice}function Cm({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),[g,m]=S.useState(e.comment),[h,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=dC(e),v=e.volumeLots,x=S.useMemo(()=>{const C=e.profit.toFixed(2);return`Close #${e.ticket} ${e.type} ${v.toFixed(2)} ${e.displaySymbol} ${Os(e.openPrice,e.digits)} at ${Os(b,e.digits)} with Profit ${C}`},[b,e,v]),_=async()=>{p(!0);try{const C=await n(e);if(!C.success){Ce({variant:"destructive",description:C.message||"Failed to close position."});return}r(e.ticket),t(),Ce({description:`Position #${e.ticket} closed.`})}catch(C){const P=C instanceof Error?C.message:"Failed to close position.";Ce({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," ",Os(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:Os(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:g,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:h,onClick:()=>void _(),children:x})]})]})}function bd({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:g}=t,m=ve(E=>E.positions),h=ve(E=>E.orders),p=ve(E=>E.selectedPositionTicket),y=ve(E=>E.selectedOrderTicket),b=ve(E=>E.setSelectedPositionTicket),v=ve(E=>E.setSelectedOrderTicket),x=p!==null?m.find(E=>E.ticket===p)??null:null,_=y!==null?h.find(E=>E.ticket===y)??null:null,C=r!==null,P=S.useCallback(E=>{g({symbolTicker:e,login:E.login,executionMode:E.executionMode,side:E.side,orderType:E.orderType,volumeLots:E.volumeLots,stopLoss:E.stopLoss,takeProfit:E.takeProfit,priceOrder:E.priceOrder,priceTrigger:E.priceTrigger,comment:E.comment,typeTime:E.typeTime,expirationDateTime:E.expirationDateTime,expirationDay:E.expirationDay,bid:E.bid,ask:E.ask})},[g,e]);return x!==null?c.jsx(Cm,{position:x,onClose:()=>b(null)}):_!==null?c.jsx(Sm,{order:_,onClose:()=>v(null)}):C&&r!==null?c.jsx(xm,{confirmation:r,symbolTicker:e,onDismiss:f}):u?c.jsx(lC,{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 vd({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 uC({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(vd,{label:"Trade",isActive:o==="trade",onClick:()=>a("trade")}),c.jsx(vd,{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(bd,{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(bd,{symbolTicker:e,orderState:t})})})}const fC=.01,pC=.01,wd=.01;function mC({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),g=ve(N=>N.setSelectedLogin),{accounts:m,isLoading:h}=Yp(),{submitOrder:p}=Vi(),y=S.useMemo(()=>Fv(m),[m]),b=S.useMemo(()=>Bv(m,u),[m,u]),v=l==="confirmed",x=l==="needs-selection";S.useEffect(()=>{if(h)return;if(l==="confirmed"){u&&!y.some(O=>O.login===u)&&d("needs-selection");return}if(l==="needs-selection")return;const N=Uv();if(N&&y.some(O=>O.login===N)){f(N),d("confirmed"),r(t);return}d("needs-selection")},[l,y,t,h,u]),S.useEffect(()=>{b&&g(b)},[b,g]);const _=S.useCallback(N=>{f(N),g(N),ml(N)},[g]),C=S.useCallback(N=>{N&&(ml(N),_(N),d("confirmed"),i(null),r(t))},[t,_]),P=S.useCallback(()=>{i(null),r("market")},[]),E=S.useCallback(()=>{i(null),r("mini")},[]),k=S.useCallback(()=>{i(null),r("mini")},[]),D=S.useCallback(()=>{i(null),r("mini")},[]),I=S.useCallback(async N=>{const O=oe.getState().clearEntryLinePreview,B=N.login.trim();if(!B){O(),Ce({variant:"destructive",description:"Please select a trading account."});return}const R=Math.max(wd,N.volumeLots),H=Di(N.symbolTicker,e);Number($t(Vt(N.symbolTicker,e)));const F=Ri(N.executionMode),M=rc(N.orderType),L=pt(N.priceOrder),U=pt(N.priceTrigger);if(!F&&L===void 0){O(),Ce({variant:"destructive",description:M?"Please set a limit price for this order.":"Please set an order price for pending orders."});return}if(M&&U===void 0){O(),Ce({variant:"destructive",description:"Please set a stop price for stop limit orders."});return}if(!F&&!Li(N.typeTime,N.expirationDateTime,N.expirationDay)){O(),Ce({variant:"destructive",description:"Please set an expiration date for this order."});return}const K=F?N.side==="buy"?N.ask:N.bid:L??(N.side==="buy"?N.ask:N.bid);a(!0);try{const j=await p({login:B,symbolTicker:N.symbolTicker,executionMode:N.executionMode,side:ni(N.orderType),orderType:N.orderType,volumeLots:R,stopLoss:pt(N.stopLoss),takeProfit:pt(N.takeProfit),priceOrder:nc(N.orderType)?L:void 0,priceTrigger:M?U:void 0,comment:N.comment.trim(),typeTime:N.typeTime,expirationDateTime:N.expirationDateTime,expirationDay:N.expirationDay,bid:N.bid,ask:N.ask});if(!j.success){O(),Ce({variant:"destructive",description:j.message||"Order was not accepted."});return}i({ticket:j.ticket??"",side:j.side??ni(N.orderType),volumeLots:j.volumeLots??R,symbol:j.displaySymbol??H,price:j.price??K}),r("confirmation")}catch(j){O();const se=j instanceof Error?j.message:"Failed to place order.";Ce({variant:"destructive",description:se})}finally{a(!1)}},[p,e]);return{panel:n,confirmation:s,isSubmitting:o,defaultVolumeLots:fC,volumeStep:pC,minVolumeLots:wd,accountOptions:y,selectedLogin:b,setSelectedLogin:_,isAccountsLoading:h,hasConfirmedAccount:v,needsAccountSelection:x,confirmAccountSelection:C,openMarketPanel:P,openMiniPanel:E,closePanels:k,dismissConfirmation:D,placeMarketOrder:I}}function di(e){var t;if(typeof window<"u"){const n=localStorage.getItem(Qn);if(n&&e.some(r=>r.ticker===n))return n}return((t=e[0])==null?void 0:t.ticker)??"XAU_USD"}function 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 hC({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 g=()=>{const h=n.querySelector(":scope > div");u(h)};g();const m=new MutationObserver(g);return m.observe(n,{childList:!0}),()=>{m.disconnect()}},[n]);const f=S.useCallback(g=>{if(g===a.current)return;const m=t.find(p=>p.ticker===g);if(!m)return;a.current=g,localStorage.setItem(Qn,g),r(g),s(null);const h=l.current;if(h)try{h.onChartReady(()=>{h.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 g=!1,m=null;try{e.onChartReady(()=>{if(g)return;let h;try{h=e.activeChart()}catch{return}const p=v=>{const x=h.symbol(),_=ca(x,t,o);_!==a.current&&s(null);try{e.resetCache()}catch{}a.current=_,localStorage.setItem(Qn,_),r(_)},y=h.symbol(),b=ca(y,t,o);b!==a.current&&(a.current=b,localStorage.setItem(Qn,b),r(b)),h.onSymbolChanged().subscribe(null,p),m=()=>{try{h.onSymbolChanged().unsubscribe(null,p)}catch{}}})}catch{}return()=>{g=!0,m==null||m()}},[e,s,r,o,t]),{chartContainer:d}}const gC=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 yC({className:e,variant:t,...n}){return c.jsx("div",{className:Se(gC({variant:t}),e),...n})}function Em(){var t;const e=(t=window.TradingView)==null?void 0:t.widget;return typeof e=="function"?e:null}function zs(){return Em()!==null}const _d="/charting_library/charting_library.js";function bC({onLoad:e}){return S.useEffect(()=>{if(zs()){e();return}const t=document.querySelector(`script[src="${_d}"]`);if(t){const r=()=>{zs()&&e()};return t.addEventListener("load",r),()=>t.removeEventListener("load",r)}const n=document.createElement("script");return n.src=_d,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 xd=ji(e=>({playEndTimestamp:null,setPlayEndTimestamp:t=>e({playEndTimestamp:t})})),Tm=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,Pm=4,da=5,ua=e=>e==="1"?60:e==="5"?300:e==="1D"?1440*3600:parseInt(e,10)*60,vC=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<=Pm:!0},wC=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>=Pm){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},_C=(e,t,n)=>{const r=ua(t)*1e3,s=[];let i=e;for(let o=0;o<n;o++)i+=r,vC(i)||(i=wC(i)),s.push(i);return s},xC=(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 _C(e,t,n);const s=ua(t)*1e3;return Array.from({length:n},(i,o)=>e+(o+1)*s)},SC=(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},Sd="wss://symbols.opheleo.com";function CC(e){return{1:6e4,5:3e5,15:9e5,30:18e5,60:36e5,240:144e5}[e]??6e4}function Cd(e){return e.trim().toUpperCase()}function EC(e,t){return Math.floor(e/t)*t}let jr;async function TC(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),Ne({baseURL:"https://corprate-widget.iccandle.ai",url:`/chart/endTimestamp?${t.toString()}`,method:"GET"})}class PC{constructor(t,n,r=Ut,s=Sd){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||Sd}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(g=>o!==void 0&&g.ticker===o||g.ticker===t.ticker||g.display_name===t.name||g.display_name===t.ticker),l={symbol:(a==null?void 0:a.ticker)||"",timeframe:n};if(r.firstDataRequest&&(jr=void 0),!r.firstDataRequest)if(jr)l.last_evaluated_key=jr;else{s([],{noData:!0});return}const u=xd.getState().playEndTimestamp;u&&(l.endTimestamp=u,xd.getState().setPlayEndTimestamp(null),jr=void 0),(async()=>{var g;try{const{data:m}=await TC(l);if(m.data_status==="threshold_limited"){s([],{noData:!0});return}if(m.data_status==="end_of_data"){s([],{noData:!0});return}if(!((g=m.items)!=null&&g.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:SC(x.timestamp,n)})),y=Tm.getState(),{gapCount:b,isReplayMode:v}=y;if(v&&event){const x=xC(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(g=>o!==void 0&&g.ticker===o||g.display_name===t.ticker||g.display_name===t.name),l=a!=null&&a.resolve_symbol?Cd(a.resolve_symbol):Cd(t.ticker||t.name||""),d=CC(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=EC(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 g,m;(m=(g=this.futureBarsRef)==null?void 0:g.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:g,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: ${g||"-"}`,`Previous Actual: ${m||"-"}`],...u?{imageUrl:`https://cdn.iccandle.ai/web-assets/${u??"USD"}.svg`}:{}})}catch{}s(i)}}const AC=e=>{const t={name:"Generated Candles - By iC Candle",metainfo:{_metainfoVersion:51,id:"Generated Candles - By iC Candle@tv-basicstudies-1",description:"Generated Candles - By iC Candle",shortDescription:"Generated Candles",isCustomIndicator:!0,is_hidden_study:!1,is_price_study:!0,linkedToSeries:!0,format:{type:"price",precision:2},inputs:[],palettes:{palette_bar:{colors:{0:{name:"Bullish"},1:{name:"Bearish"}},valToIndex:{0:0,1:1}},palette_wick:{colors:{0:{name:"Bullish Wick"},1:{name:"Bearish Wick"}},valToIndex:{0:0,1:1}},palette_border:{colors:{0:{name:"Bullish Border"},1:{name:"Bearish Border"}},valToIndex:{0:0,1:1}}},plots:[{id:"plot_open",type:"ohlc_open",target:"plot_candle"},{id:"plot_high",type:"ohlc_high",target:"plot_candle"},{id:"plot_low",type:"ohlc_low",target:"plot_candle"},{id:"plot_close",type:"ohlc_close",target:"plot_candle"},{id:"plot_bar_color",type:"ohlc_colorer",palette:"palette_bar",target:"plot_candle"},{id:"plot_wick_color",type:"wick_colorer",palette:"palette_wick",target:"plot_candle"},{id:"plot_border_color",type:"border_colorer",palette:"palette_border",target:"plot_candle"}],ohlcPlots:{plot_candle:{title:"Generated Candles"}},styles:{},defaults:{styles:{},ohlcPlots:{plot_candle:{borderColor:"#000000",color:"#000000",drawBorder:!0,drawWick:!0,plottype:"ohlc_candles",visible:!0,wickColor:"#000000"}},palettes:{palette_bar:{colors:{0:{color:"#00dfb9",width:1,style:0},1:{color:"#ffb84d",width:1,style:0}}},palette_wick:{colors:{0:{color:"#00dfb9",width:1,style:0},1:{color:"#ffb84d",width:1,style:0}}},palette_border:{colors:{0:{color:"#00dfb9",width:1,style:0},1:{color:"#ffb84d",width:1,style:0}}}},precision:2,inputs:{}}},constructor:function(){this.init=function(n){this._context=n},this.main=function(n){this._context=n;const r=n.symbol.time,s=e.current,i=n.symbol.open,o=n.symbol.high,a=n.symbol.low,l=n.symbol.close;if(!Number.isFinite(r)||!s||s.length===0)return[i,o,a,l,Number.NaN,Number.NaN,Number.NaN];if(!s.some(g=>g.time===r))return[i,o,a,l,Number.NaN,Number.NaN,Number.NaN];const 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},NC=e=>{var t;if(_p(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)},OC=({queryKey:e,queryFn:t,...n})=>Or({queryKey:e,queryFn:async r=>{var s;try{const i=r.queryKey[1];return await t(i)}catch(i){throw Ce({variant:"destructive",title:"Error",description:NC(_p(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 Ed;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(Ed||(Ed={}));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 Ft 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 Ft))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()}}Ft.create=e=>new Ft(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 kC=pa;function RC(){return kC}const DC=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=RC(),r=DC({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}),Td=e=>e.status==="aborted",Pd=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 Ad=(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 Ft(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 Ad(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 Ad(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 Ot.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 nE({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 LC=/^c[^\s-]{8,}$/i,jC=/^[0-9a-z]+$/,IC=/^[0-9A-HJKMNP-TV-Z]{26}$/i,MC=/^[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,FC=/^[a-z0-9_-]{21}$/i,UC=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,BC=/^[-+]?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)?)??$/,$C=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,VC="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let xo;const 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])$/,zC=/^(?:(?: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])$/,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]))$/,KC=/^(([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])$/,GC=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,qC=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Am="((\\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])))",ZC=new RegExp(`^${Am}$`);function Nm(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 YC(e){return new RegExp(`^${Nm(e)}$`)}function QC(e){let t=`${Am}T${Nm(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 XC(e,t){return!!((t==="v4"||!t)&&HC.test(e)||(t==="v6"||!t)&&WC.test(e))}function JC(e,t){if(!UC.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 eE(e,t){return!!((t==="v4"||!t)&&zC.test(e)||(t==="v6"||!t)&&KC.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")$C.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(VC,"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")MC.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")FC.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")LC.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")jC.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")IC.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"?QC(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"?ZC.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{code:V.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?YC(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"?BC.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"duration",code:V.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?XC(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"?JC(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"?eE(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"?GC.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"base64",code:V.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?qC.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 tE(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"?tE(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 Nd 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)}}Nd.create=e=>new Nd({typeName:le.ZodSymbol,...fe(e)});class Od 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)}}Od.create=e=>new Od({typeName:le.ZodUndefined,...fe(e)});class kd 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)}}kd.create=e=>new kd({typeName:le.ZodNull,...fe(e)});class Rd extends we{constructor(){super(...arguments),this._any=!0}_parse(t){return at(t.data)}}Rd.create=e=>new Rd({typeName:le.ZodAny,...fe(e)});class Dd extends we{constructor(){super(...arguments),this._unknown=!0}_parse(t){return at(t.data)}}Dd.create=e=>new Dd({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 Ld 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)}}Ld.create=e=>new Ld({typeName:le.ZodVoid,...fe(e)});class Ot 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 Ot({...this._def,minLength:{value:t,message:Q.toString(n)}})}max(t,n){return new Ot({...this._def,maxLength:{value:t,message:Q.toString(n)}})}length(t,n){return new Ot({...this._def,exactLength:{value:t,message:Q.toString(n)}})}nonempty(t){return this.min(1,t)}}Ot.create=(e,t)=>new Ot({type:e,minLength:null,maxLength:null,exactLength:null,typeName:le.ZodArray,...fe(t)});function Yn(e){if(e instanceof Le){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=cn.create(Yn(r))}return new Le({...e._def,shape:()=>t})}else return e instanceof Ot?new Ot({...e._def,type:Yn(e.element)}):e instanceof cn?cn.create(Yn(e.unwrap())):e instanceof Sr?Sr.create(Yn(e.unwrap())):e instanceof Fn?Fn.create(e.items.map(t=>Yn(t))):e}class 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,g=await u.value;d.push({key:f,value:g,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 Yn(this)}partial(t){const n={};for(const r of _e.objectKeys(this.shape)){const s=this.shape[r];t&&!t[r]?n[r]=s:n[r]=s.optional()}return new 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 Om(_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 Ft(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 Ft(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(Td(i)||Td(o))return ce;const a=ha(i.value,o.value);return a.valid?((Pd(i)||Pd(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 Fn 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 Fn({...this._def,rest:t})}}Fn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Fn({items:e,typeName:le.ZodTuple,rest:null,...fe(t)})};class jd 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}}}}jd.create=(e,t,n)=>new jd({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 Id 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})}}Id.create=(e,t)=>new Id({getter:e,typeName:le.ZodLazy,...fe(t)});class Md 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}}Md.create=(e,t)=>new Md({value:e,typeName:le.ZodLiteral,...fe(t)});function Om(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=Om;class Fd 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}}Fd.create=(e,t)=>new Fd({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 Ft(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ft(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 Ud 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}}}Ud.create=e=>new Ud({typeName:le.ZodNaN,...fe(e)});class nE 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,ks=wr.create,rE=ma.create;pn.create;Ot.create;const sE=Le.create;pi.create;mi.create;Fn.create;_r.create;hi.create;cn.create;Sr.create;const iE="https://api.opheleo.com",oE="Bearer ",aE="Authorization";sE({id:So(),userId:So(),createdAt:ks(),updatedAt:ks(),active:rE(),perDayUsage:ks(),userEmail:So().email(),maxPerDayUsage:ks()});async function cE(e,t,n){const r=typeof window<"u"?localStorage.getItem("session_token"):null;return(await Ne({baseURL:br(n??iE),url:e,method:t,headers:r?{[aE]:`${oE}${r}`}:void 0})).data}async function lE(e){return cE("/iccandle/v1/iccandle-user-usage/me","get",e)}const dE=e=>{const t=e==null?void 0:e.platformApiBase;return OC({queryKey:["iccandle-user-usage",t],queryFn:()=>lE(t),...e})},uE=S.createContext(null);function fE(){const e=S.useContext(uE);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function pE({controlsRef:e,onSymbolTickerChange:t,onScanResultUrlChange:n,onChartWidgetChange:r,onChartContainerChange:s,selectSymbolTickerRef:i,headerSlot:o}){const{resolvedTheme:a}=fE(),l=Ht(),d=ls(),u=S.useRef([]),f=S.useRef(null),g=S.useRef(a),m=S.useRef(null),h=S.useRef(null),p=S.useMemo(()=>di(d),[d]),y=S.useRef(p),b=S.useRef("60"),{setGapCount:v,setReplayMode:x}=Tm();S.useEffect(()=>{v(0),x(!1)},[v,x]),S.useEffect(()=>{zs()&&E(!0)},[]);const[_,C]=S.useState(null),[P,E]=S.useState(!1),[k,D]=S.useState(null),I=S.useCallback(L=>{if(L===y.current)return;const U=d.find(j=>j.ticker===L);if(!U)return;y.current=L,localStorage.setItem(Qn,L),t(L);const K=f.current;if(K)try{K.onChartReady(()=>{K.activeChart().setSymbol(U.ticker)})}catch{}},[t,d]);S.useEffect(()=>(i.current=I,()=>{i.current=null}),[I,i]);const N=S.useRef([]),O=S.useMemo(()=>new PC(N,"selector",d,l.tickWebSocketUrl),[l.tickWebSocketUrl,d]),{data:B,isLoading:R}=dE({enabled:!0,platformApiBase:l.platformApiBase}),H=!R&&B?B.perDayUsage>=B.maxPerDayUsage:!1;S.useEffect(()=>{s(_)},[_,s]),S.useEffect(()=>{r(k)},[k,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=Em();if(!U)return;const K=new U({container:_,library_path:"/charting_library/",datafeed:O,symbol:L,interval:"60",autosize:!0,theme:g.current,disabled_features:["symbol_info","legend_inplace_edit","header_quick_search","header_compare"],enabled_features:["header_chart_type","show_symbol_logos","show_symbol_logo_in_legend"],custom_indicators_getter:()=>AC(u),drawings_access:{type:"black",tools:[{name:"Date Range"}]},locale:"en",timezone:Ch(),overrides:{priceScaleSelectionStrategyName:"right","scalesProperties.showSeriesLastValue":!0}});let j=!1;return f.current=K,K.onChartReady(()=>{j||f.current!==K||D(K)}),()=>{if(j=!0,D(null),r(null),f.current){try{f.current.remove()}catch{}f.current=null}}},[_,O,r,P]),S.useEffect(()=>{if(!k)return;let L=!1;try{k.onChartReady(()=>{L||(async()=>{try{const U=k.activeChart(),K=await U.createStudy("Generated Candles - By iC Candle",!0,!0);if(L||(K&&U.bringToFront([K]),await k.headerReady(),L)||(await new Promise(z=>{setTimeout(()=>{if(!L)try{U.clearMarks(2)}catch{}z(!0)},150)}),L))return;localStorage.setItem("tv:selected-news-events","[]"),U.refreshMarks();const j=z=>{const de=U.symbol(),ue=ca(de,d,p);ue!==y.current&&(n(null),u.current=[]);try{k.resetCache()}catch{}y.current=ue,localStorage.setItem(Qn,ue),t(ue)},se=z=>{z!==b.current&&(n(null),u.current=[]);try{k.resetCache()}catch{}b.current=z};m.current=j,h.current=se,U.onSymbolChanged().subscribe(null,j),U.onIntervalChanged().subscribe(null,se)}catch{}})()})}catch{}return()=>{L=!0,m.current=null,h.current=null}},[k,e,n,t,p,d]),S.useEffect(()=>{if(!k||!a)return;let L=!1;try{k.onChartReady(()=>{L||k.changeTheme(a).catch(()=>{})})}catch{}return()=>{L=!0}},[k,a]);const F=S.useCallback(()=>{E(!0)},[]),M=H?c.jsx("div",{className:"web-trading-widget-advanced__scan-limit-wrap",children:c.jsxs(yC,{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??M,c.jsx(bC,{onLoad:F}),c.jsx("div",{ref:C,className:"web-trading-widget-advanced__container"})]})}const km=S.createContext(null);function Bd({value:e,children:t}){return c.jsx(km.Provider,{value:e,children:t})}function mE(){const e=S.useContext(km);if(!e)throw new Error("useWidgetChartSlot must be used within WidgetChartSlotProvider");return e}function Rs(e,t){return e.toFixed(t)}function hE({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:g,onPlaceOrder:m}){const[h,p]=S.useState(!0),y=u??h,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 E=Number($t(Vt(e))),k=t!==null?Ee(t,E):"—",D=n!==null?Ee(n,E):"—",N=!o&&!a&&l!==""&&(t!==null&&n!==null),O=F=>{const M=Number(C),L=Number.isFinite(M)&&M>0?M:r,U=Math.max(i,L+F*s),K=Rs(U,2);P(K),x(U)},B=()=>{const F=Number(C);if(!Number.isFinite(F)||F<=0){P(Rs(r,2)),x(r);return}const M=Math.max(i,F),L=Rs(M,2);P(L),x(M)},R=F=>{t===null||n===null||v({side:F,entryPrice:F==="buy"?n:t})},H=F=>{if(t===null||n===null||!l)return;const M=Number(C),L=Math.max(i,Number.isFinite(M)&&M>0?M: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:g,className:`web-trading-widget-mini-order__drag-handle${d?" web-trading-widget-mini-order__drag-handle--grabbing":""}`,children:c.jsx(If,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2})}),c.jsxs(c.Fragment,{children:[c.jsxs("button",{type:"button",disabled:!N,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--sell",onMouseDown:()=>R("sell"),onClick:()=>H("sell"),children:[c.jsx("span",{className:"web-trading-widget-mini-order__price",children:k}),c.jsx("span",{className:"web-trading-widget-mini-order__label web-trading-widget-mini-order__label--sell",children:"SELL"})]}),c.jsxs("div",{className:"web-trading-widget-mini-order__volume",children:[c.jsx("button",{type:"button","aria-label":"Decrease volume",disabled:!N,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>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:C,disabled:!N,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:!N,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:!N,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 gE=new Set(["volume-setting","risk-management"]);function yE({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:g,onPlaceOrder:m}){const[h,p]=S.useState(!0),[y,b]=S.useState("market"),v=oe(J=>J.volumeLots),[x,_]=S.useState(String(v||r)),[C,P]=S.useState(""),[E,k]=S.useState(""),D=oe(J=>J.stopLoss),I=oe(J=>J.takeProfit),N=oe(J=>J.setStopLoss),O=oe(J=>J.setTakeProfit),B=oe(J=>J.setVolumeLots),R=oe(J=>J.setOrderSide),[H,F]=S.useState(""),[M,L]=S.useState(ft.GTC),[U,K]=S.useState(""),[j,se]=S.useState(""),[z,de]=S.useState(()=>new Set(gE));S.useEffect(()=>{f()},[h,f]);const ue=Number($t(Vt(e))),ee=Pr(ue),Z=$f(t,n),$=t!==null?Ee(t,ue):"—",ye=n!==null?Ee(n,ue):"—",ae=Ri(y),ie=Ff(y),te=ki(y),je=te.label,Re=!ae&&te.orderType!==null&&te.orderType%2===1,Oe=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})},Ae=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),kr=Fe(J);kr!==null&&R({side:J,entryPrice:kr}),m({login:l,executionMode:y,side:J,orderType:zt,volumeLots:Xe,stopLoss:D,takeProfit:I,priceOrder:C,priceTrigger:E,comment:H,typeTime:M,expirationDateTime:U,expirationDay:j,bid:t,ask:n})},re=t!==null&&n!==null,$e=ae||pt(C)!==void 0,qi=!ie||pt(E)!==void 0,us=ae||Li(M,U,j),oh=!o&&!a&&l!==""&&re&&$e&&qi&&us,ah=!ae&&sc(M),ch=!ae&&ic(M),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${h?" web-trading-widget-market-panel--collapsed":""}`,children:[c.jsx(hE,{symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,isDragging:d,isCollapsed:h,onToggleCollapsed:()=>p(J=>!J),onDragHandlePointerDown:u,onPlaceOrder:({login:J,side:Xe,volumeLots:zt,bid:kr,ask:Dc})=>{kr===null||Dc===null||m({login:J,executionMode:"market",side:Xe,orderType:Mo("market",Xe),volumeLots:zt,stopLoss:D,takeProfit:I,priceOrder:"",priceTrigger:"",comment:H,typeTime:M,expirationDateTime:"",expirationDay:"",bid:kr,ask:Dc})}}),h?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:Ae,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:E,onChange:k,step:ee,decimals:ue,basePrice:Oe,placeholder:Z!==null?Ee(Z,ue):"—"}),c.jsx(De,{label:"Limit Price",value:C,onChange:P,step:ee,decimals:ue,basePrice:Oe,placeholder:Z!==null?Ee(Z,ue):"—"})]}):c.jsx(De,{label:"Price",value:C,onChange:P,step:ee,decimals:ue,basePrice:Oe,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:D,onChange:N,step:ee,decimals:ue,basePrice:t,placeholder:t!==null?$:"—",clearable:!0}),c.jsx(De,{label:"Take Profit",value:I,onChange:O,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(M),className:"web-trading-widget-market-panel__select-full","aria-label":"Order expiration type",onChange:J=>L(Number(J.target.value)),children:Uf.map(J=>c.jsx("option",{value:String(J.value),children:J.label},J.value))}),ah?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=>K(J.target.value)})]}):null,ch?c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Expiration day"}),c.jsx("input",{type:"date",value:j,className:"web-trading-widget-market-panel__input",onChange: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=>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:!oh,onMouseDown:()=>Qe(Rc()),onClick:()=>ct(Rc()),children:["Place ",je]})]})]})}function bE({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:g,hasConfirmedAccount:m,closePanels:h,dismissConfirmation:p,placeMarketOrder:y}=n,b=ve(j=>j.positions),v=ve(j=>j.orders),x=ve(j=>j.selectedPositionTicket),_=ve(j=>j.selectedOrderTicket),C=ve(j=>j.setSelectedPositionTicket),P=ve(j=>j.setSelectedOrderTicket),E=x!==null?b.find(j=>j.ticket===x)??null:null,k=_!==null?v.find(j=>j.ticket===_)??null:null,D=m&&i==="confirmation"&&o!==null,I=m&&i!=="confirmation"&&i!=="closed"&&E===null&&k===null,{panelRef:N,position:O,isDragging:B,onDragStart:R,reclamp:H}=Kf({storageKey:"web-trading-widget-modal-exec-panel-position",defaultAlign:"top-right",isActive:I}),F=oe(j=>j.setDraft),M=oe(j=>j.clearDraft),L=Number($t(Vt(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")&&M()},[M,i]);const K=E!==null||k!==null;return!m&&!K?null:c.jsxs("div",{className:"web-trading-widget-new-order-overlay-layer",children:[c.jsx(Dp,{chartWidget:t,symbolTicker:e,symbols:r}),K&&E!==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(Cm,{position:E,onClose:()=>C(null)})}):null,K&&k!==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(Sm,{order:k,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(xm,{confirmation:o,symbolTicker:e,onDismiss:p})}):null,I?c.jsx("div",{ref:N,style:{left:O.x,top:O.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(yE,{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:g,selectedLogin:f,isDragging:B,onDragHandlePointerDown:R,onLayoutChange:H,onClose:h,onPlaceOrder:j=>void y({symbolTicker:e,login:j.login,executionMode:j.executionMode,side:j.side,orderType:j.orderType,volumeLots:j.volumeLots,stopLoss:j.stopLoss,takeProfit:j.takeProfit,priceOrder:j.priceOrder,priceTrigger:j.priceTrigger,comment:j.comment,typeTime:j.typeTime,expirationDateTime:j.expirationDateTime,expirationDay:j.expirationDay,bid:j.bid,ask:j.ask})})}):null]})}const vE=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" aria-hidden="true">
|
|
81
|
+
`+i)}}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Mn(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&Ks.assertOptions(r,{silentJSONParsing:He.transitional(He.boolean),forcedJSONParsing:He.transitional(He.boolean),clarifyTimeoutError:He.transitional(He.boolean),legacyInterceptorReqResOrdering:He.transitional(He.boolean),advertiseZstdAcceptEncoding:He.transitional(He.boolean),validateStatusUndefinedResolves:He.transitional(He.boolean)},!1),s!=null&&(k.isFunction(s)?n.paramsSerializer={serialize:s}:Ks.assertOptions(s,{encode:He.function,serialize:He.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Ks.assertOptions(n,{baseUrl:He.spelling("baseURL"),withXsrfToken:He.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&k.merge(i.common,i[n.method]);i&&k.forEach(["delete","get","head","post","put","patch","query","common"],y=>{delete i[y]}),n.headers=We.concat(o,i);const a=[];let l=!0;this.interceptors.request.forEach(function(m){if(typeof m.runWhen=="function"&&m.runWhen(n)===!1)return;l=l&&m.synchronous;const h=n.transitional||yc;h&&h.legacyInterceptorReqResOrdering?a.unshift(m.fulfilled,m.rejected):a.push(m.fulfilled,m.rejected)});const d=[];this.interceptors.response.forEach(function(m){d.push(m.fulfilled,m.rejected)});let f,u=0,g;if(!l){const y=[Xl.bind(this),void 0];for(y.unshift(...a),y.push(...d),g=y.length,f=Promise.resolve(n);u<g;)f=f.then(y[u++],y[u++]);return f}g=a.length;let p=n;for(;u<g;){const y=a[u++],m=a[u++];try{p=y(p)}catch(h){m.call(this,h);break}}try{f=Xl.call(this,p)}catch(y){return Promise.reject(y)}for(u=0,g=d.length;u<g;)f=f.then(d[u++],d[u++]);return f}getUri(t){t=Mn(this.defaults,t);const n=Pm(t.baseURL,t.url,t.allowAbsoluteUrls,t);return xm(n,t.params,t.paramsSerializer)}};k.forEach(["delete","get","head","options"],function(t){Nn.prototype[t]=function(n,r){return this.request(Mn(r||{},{method:t,url:n,data:r&&k.hasOwnProp(r,"data")?r.data:void 0}))}});k.forEach(["post","put","patch","query"],function(t){function n(r){return function(i,o,a){return this.request(Mn(a||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}Nn.prototype[t]=n(),t!=="query"&&(Nn.prototype[t+"Form"]=n(!0))});let Rx=class Nm{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(s=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(a=>{r.subscribe(a),i=a}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},t(function(i,o,a){r.reason||(r.reason=new fs(i,o,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new Nm(function(s){t=s}),cancel:t}}};function Lx(e){return function(n){return e.apply(null,n)}}function Dx(e){return k.isObject(e)&&e.isAxiosError===!0}const Ko={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Ko).forEach(([e,t])=>{Ko[t]=e});function Rm(e){const t=new Nn(e),n=cm(Nn.prototype.request,t);return k.extend(n,Nn.prototype,t,{allOwnKeys:!0}),k.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return Rm(Mn(e,s))},n}const Re=Rm(us);Re.Axios=Nn;Re.CanceledError=fs;Re.CancelToken=Rx;Re.isCancel=Tm;Re.VERSION=vc;Re.toFormData=Hi;Re.AxiosError=Z;Re.Cancel=Re.CanceledError;Re.all=function(t){return Promise.all(t)};Re.spread=Lx;Re.isAxiosError=Dx;Re.mergeConfig=Mn;Re.AxiosHeaders=We;Re.formToJSON=e=>Cm(k.isHTMLForm(e)?new FormData(e):e);Re.getAdapter=Om.getAdapter;Re.HttpStatusCode=Ko;Re.default=Re;const{Axios:FE,AxiosError:UE,CanceledError:BE,isCancel:$E,CancelToken:VE,VERSION:HE,all:zE,Cancel:WE,isAxiosError:Lm,spread:KE,toFormData:qE,AxiosHeaders:GE,HttpStatusCode:ZE,formToJSON:YE,getAdapter:QE,mergeConfig:XE,create:JE}=Re,jx="Bearer ",Dm="web-trading-token";function Ix(){return typeof window>"u"?null:localStorage.getItem(Dm)}function br(e){return e.replace(/\/$/,"")}function ed(e){const t=br(e);async function n(r){const s=Ix();return(await Re({...r,baseURL:t,headers:{...r.headers??{},...s?{Authorization:`${jx}${s}`}:{}}})).data}return{get(r,s){return n({...s,url:r,method:"get"})},post(r,s,i){return n({...i,url:r,method:"post",data:s})}}}function td(e){return!e.isDemo&&!e.isArchive&&!!e.tradeStat}function Mx(e){const t=e.filter(n=>td(n)&&n.platformType==="mt5");return t.length>0?t:e.filter(td)}function Fx(e){const t=e,n=(t==null?void 0:t.accounts)??[];return Mx(n).map(r=>{var s,i,o,a,l;return{id:r.id,login:String(r.login),label:`${r.displayTitle} · ${r.login}`,currency:r.currency,tradeStat:{balance:((s=r.tradeStat)==null?void 0:s.balance)??0,equity:((i=r.tradeStat)==null?void 0:i.equity)??0,margin:((o=r.tradeStat)==null?void 0:o.margin)??0,marginFree:((a=r.tradeStat)==null?void 0:a.marginFree)??0,marginLevel:(l=r.tradeStat)==null?void 0:l.marginLevel}}})}function Ux(e){try{const t=new URL(br(e));return t.hostname.includes("webtrade.")?(t.hostname=t.hostname.replace("webtrade.","api."),t.origin):(t.hostname.startsWith("webtrade")&&(t.hostname=t.hostname.replace(/^webtrade/,"api")),t.origin)}catch{return br(e)}}function Bx(e){try{const t=new URL(br(e));return t.hostname.includes("opheleo")?"wss://symbols.opheleo.com":(t.protocol=t.protocol==="https:"?"wss:":"ws:",t.origin)}catch{return"wss://symbols.opheleo.com"}}function $x(e){const t=br(e),n=ed(t),r=Ux(t),s=ed(r),i=Ow(n),o=Bt;return{baseUrl:t,platformApiBase:r,tickWebSocketUrl:Bx(t),dealer:i,trading:Iw(i,o),async getAccounts(){const a=await s.get("/account-config/api/v1");return Fx(a)}}}const jm=C.createContext(null);function Im({baseUrl:e,children:t}){const n=C.useMemo(()=>$x(e),[e]);return c.jsx(jm.Provider,{value:n,children:t})}function dt(){const e=C.useContext(jm);if(!e)throw new Error("useWidgetApiClient must be used within WidgetApiProvider");return e}function Mm(){return dt().tickWebSocketUrl}const Vx="wss://symbols.opheleo.com";function _c(e){const[t,n]=C.useState(null),r=Mm();return C.useEffect(()=>{n(null);const s=Ui(e).toUpperCase();let i=null,o=!1;const a=r||Vx,l=()=>{i=new WebSocket(a),i.onopen=()=>{if(o){i==null||i.close(1e3,"Unmounted");return}i==null||i.send(JSON.stringify({action:"select_symbol",symbol:s}))},i.onmessage=d=>{var f;try{const u=JSON.parse(d.data);if(((f=u.symbol)==null?void 0:f.trim().toUpperCase())!==s)return;const p=Number(u.bid),y=Number(u.ask);if(!Number.isFinite(p)||!Number.isFinite(y))return;n({bid:p,ask:y})}catch{}},i.onclose=()=>{o||setTimeout(l,3e3)}};return l(),()=>{o=!0,i==null||i.close(1e3,"Unmounted")}},[e,r]),t}function Hx({symbolTicker:e,sidePanelTab:t,orderState:n,backUrl:r,createAccountUrl:s}){const i=_c(e),{panelRef:o,position:a,isDragging:l,onDragStart:d,reclamp:f}=sm(),{panel:u,isSubmitting:g,defaultVolumeLots:p,volumeStep:y,minVolumeLots:m,accountOptions:h,selectedLogin:b,isAccountsLoading:v,hasConfirmedAccount:_,needsAccountSelection:x,confirmAccountSelection:S,placeMarketOrder:T}=n,P=ie(L=>L.setDraft),A=ie(L=>L.clearDraft),D=Number(Vt(Ht(e))),I=Pr(D);C.useEffect(()=>{_&&P({source:"new-order",entryPrice:null,side:null,showEntryLine:!1,volumeLots:p,digits:D,priceStep:I})},[p,D,_,I,P]),C.useEffect(()=>{(u==="closed"||u==="confirmation")&&A()},[A,u]);const N=L=>{T({symbolTicker:e,login:L.login,executionMode:"market",side:L.side,orderType:L.side==="buy"?Ye.BUY:Ye.SELL,volumeLots:L.volumeLots,stopLoss:"",takeProfit:"",priceOrder:"",priceTrigger:"",comment:"",typeTime:gt.GTC,expirationDateTime:"",expirationDay:"",bid:L.bid,ask:L.ask})};return c.jsxs(c.Fragment,{children:[c.jsx(qf,{open:x,isAccountsLoading:v,accountOptions:h,onConfirm:S,backUrl:r,createAccountUrl:s}),_&&c.jsx("div",{ref:o,style:{left:a.x,top:a.y},className:`web-trading-widget-new-order-overlay${l?" web-trading-widget-new-order-overlay--dragging":""}`,children:c.jsx(hw,{symbolTicker:e,bid:(i==null?void 0:i.bid)??null,ask:(i==null?void 0:i.ask)??null,defaultVolumeLots:p,volumeStep:y,minVolumeLots:m,isSubmitting:g,isAccountsLoading:v,selectedLogin:b,isDragging:l,sidePanelTab:t,onDragHandlePointerDown:d,onExpandedChange:f,onExpand:f,onPlaceOrder:N})})]})}function zx(e,t){const n=Number(e),r=Number(t);return Number.isFinite(n)&&Number.isFinite(r)&&n!==r?n-r:e.localeCompare(t,void 0,{numeric:!0})}function Wx(e,t){return e.openTimeMs!==t.openTimeMs?e.openTimeMs-t.openTimeMs:zx(e.ticket,t.ticket)}function nd(e){return[...e].sort(Wx)}function rd(e){return Ke(e).toUpperCase()}const pe=$i(e=>({positions:[],orders:[],liveQuotes:{},selectedLogin:"",selectedPositionTicket:null,selectedOrderTicket:null,setSelectedLogin:t=>{e({selectedLogin:t})},setSelectedPositionTicket:t=>{e(n=>({selectedPositionTicket:t,selectedOrderTicket:t!==null?null:n.selectedOrderTicket}))},setSelectedOrderTicket:t=>{e(n=>({selectedOrderTicket:t,selectedPositionTicket:t!==null?null:n.selectedPositionTicket}))},setPositions:t=>{e({positions:nd(t)})},setOrders:t=>{e({orders:nd(t)})},removePosition:t=>{e(n=>({positions:n.positions.filter(r=>r.ticket!==t),selectedPositionTicket:n.selectedPositionTicket===t?null:n.selectedPositionTicket}))},removeOrder:t=>{e(n=>({orders:n.orders.filter(r=>r.ticket!==t),selectedOrderTicket:n.selectedOrderTicket===t?null:n.selectedOrderTicket}))},updateQuotes:(t,n,r)=>{const s=rd(t);e(i=>{const o={...i.liveQuotes,[s]:{bid:n,ask:r}};return{liveQuotes:o,positions:i.positions.map(a=>Yv(a,s,n,r,o)),orders:i.orders.map(a=>{if(rd(a.symbol)!==s)return a;const l=a.side==="buy"?n:r;return{...a,currentPrice:l,marketBid:n,marketAsk:r}})}})},clearPositions:()=>{e({positions:[],orders:[],liveQuotes:{}})}})),Kx="wss://symbols.opheleo.com";function qx(e,t){const n=new Set;for(const r of e){const s=Ke(r.symbol).toUpperCase();s&&n.add(s)}for(const r of t){const s=Ke(r.symbol).toUpperCase();s&&n.add(s)}for(const r of Gv([...n]))n.add(r);return[...n].sort().join("|")}function Gx(e){return qx(e.positions,e.orders)}function Zx(){const e=pe(Gx),t=pe(r=>r.updateQuotes),n=Mm();C.useEffect(()=>{if(!e)return;const r=e.split("|"),s=new Map;let i=!1;const o=n||Kx,a=l=>{const d=new WebSocket(o);s.set(l,d),d.onopen=()=>{if(i){d.close(1e3,"Unmounted");return}d.send(JSON.stringify({action:"select_symbol",symbol:l}))},d.onmessage=f=>{var u;try{const g=JSON.parse(f.data),p=(u=g.symbol)==null?void 0:u.trim().toUpperCase();if(!p||p!==l)return;const y=Number(g.bid),m=Number(g.ask);if(!Number.isFinite(y)||!Number.isFinite(m))return;t(p,y,m)}catch{}},d.onclose=()=>{s.delete(l),i||setTimeout(()=>a(l),3e3)}};for(const l of r)a(l);return()=>{i=!0;for(const l of s.values())l.close(1e3,"Unmounted");s.clear()}},[e,n,t])}function Fm(){return Zx(),null}const Um={buy:"#2563eb",sell:"#dc2626"},wo={positive:"#2563eb",negative:"#dc2626",neutral:"#94a3b8"},_o={linewidth:1,linestyle:2,fontsize:11},Bm={stopLoss:"#f97316",takeProfit:"#22c55e"},$m=e=>Um[e],qo=(e,t)=>e==="entry"?t!=null?$m(t):Um.sell:Bm[e],sd=(e,t)=>{if(e==="entry")return qo(e,t.side);const{side:n,entryPrice:r,linePrice:s,volumeLots:i}=t;if(n!=null&&r!==null&&r!==void 0&&s!==void 0&&i!==void 0){const o=Vm(n,r,s,i);return Hm(o)}return Bm[e]},Vm=(e,t,n,r)=>(e==="buy"?n-t:t-n)*r*100,Yx=(e,t)=>!Number.isFinite(t)||t<=0?0:Math.round(e/t),Qx=e=>{const t=Vm(e.side,e.entryPrice,e.linePrice,e.volumeLots),n=e.side==="buy"?e.linePrice-e.entryPrice:e.entryPrice-e.linePrice,r=Yx(n,e.priceStep),s=e.kind==="takeProfit"?"TP":"SL",i=`${t.toFixed(2)} USD`,o=`${r} points`;return`${s} ${i}, ${o}`},Xx=(e,t)=>e.toFixed(t),Hm=e=>e>0?wo.positive:e<0?wo.negative:wo.neutral,Jx=e=>{const t=`${e.side.toUpperCase()} ${e.volumeLots.toFixed(2)}, `,n=`${e.profit.toFixed(2)} USD`;return`${t}${n}`},id=e=>{const t=$m(e.side),n=Hm(e.profit);return{text:Jx(e),linecolor:t,textcolor:n,linewidth:_o.linewidth,linestyle:_o.linestyle,fontsize:_o.fontsize,showPrice:!0,horzLabelsAlign:"left"}},xo=e=>Ue(e),eS=e=>e==="entry"||e==="stopLoss"||e==="takeProfit",So=e=>{e.setUserEditEnabled(!1),e.setSelectionEnabled(!1)},od=(e,t,n)=>{if(e==="entry")return Xx(t,n.digits);const{entryPrice:r,side:s}=n;return s!==null&&r!==null?Qx({kind:e,side:s,entryPrice:r,linePrice:t,volumeLots:n.volumeLots,priceStep:n.priceStep}):`${e==="takeProfit"?"TP":"SL"} ${xe(t,n.digits)}`},tS=({chartWidget:e})=>{const t=ie(S=>S.source),n=ie(S=>S.entryPrice),r=ie(S=>S.stopLoss),s=ie(S=>S.takeProfit),i=ie(S=>S.side),o=ie(S=>S.showEntryLine),a=ie(S=>S.volumeLots),l=ie(S=>S.digits),d=ie(S=>S.priceStep),f=ie(S=>S.setStopLoss),u=ie(S=>S.setTakeProfit),g=C.useRef({}),p=C.useRef(null),y=C.useRef(null),m=C.useRef(!1),h=C.useRef({entryPrice:n,stopLoss:r,takeProfit:s,side:i,showEntryLine:o,volumeLots:a,digits:l,priceStep:d});C.useEffect(()=>{h.current={entryPrice:n,stopLoss:r,takeProfit:s,side:i,showEntryLine:o,volumeLots:a,digits:l,priceStep:d}},[l,n,d,o,i,r,s,a]);const b=C.useCallback(S=>{if(!e)return;const T=g.current[S];if(T){try{e.activeChart().removeEntity(T)}catch{}delete g.current[S]}},[e]),v=C.useCallback((S,T,P,A)=>{const D=qo(T,A.side),I=sd(T,{side:A.side,entryPrice:A.entryPrice,linePrice:P,volumeLots:A.volumeLots});S.setProperties({text:od(T,P,A),linecolor:D,textcolor:I,showPrice:!0,horzLabelsAlign:"left"})},[]),_=C.useCallback(async(S,T,P)=>{var H;if(!e)return;if(T===void 0){b(S);return}if(p.current===S)return;const A=e.activeChart(),D=qo(S,P.side),I=sd(S,{side:P.side,entryPrice:P.entryPrice,linePrice:T,volumeLots:P.volumeLots}),N=od(S,T,P),L=g.current[S];if(L)try{const R=A.getShapeById(L);S==="entry"&&So(R);const F=(H=R.getPoints()[0])==null?void 0:H.price;if(F!==void 0&&Math.abs(F-T)<P.priceStep/2){R.setProperties({text:N,linecolor:D,textcolor:I,showPrice:!0,horzLabelsAlign:"left"});return}const M=R.getPoints();if(M.length>0){m.current=!0,R.setPoints(M.map($=>({...$,price:T}))),m.current=!1,R.setProperties({text:N,linecolor:D,textcolor:I,showPrice:!0,horzLabelsAlign:"left"});return}}catch{delete g.current[S]}try{const R=A.getVisibleRange(),F=await A.createShape({time:R.from,price:T},{shape:"horizontal_line",text:N,disableSave:!0,lock:S==="entry",disableSelection:S==="entry",overrides:{linecolor:D,textcolor:I,linewidth:2,showPrice:!0,horzLabelsAlign:"left"}});if(S==="entry"&&!h.current.showEntryLine){try{A.removeEntity(F)}catch{}return}if(S==="entry")try{So(A.getShapeById(F))}catch{}g.current[S]=F}catch{}},[e,b]),x=C.useCallback(async S=>{const T=xo(S.stopLoss),P=xo(S.takeProfit);S.showEntryLine&&S.entryPrice!==null?await _("entry",S.entryPrice,S):await _("entry",void 0,S),await _("stopLoss",T,S),await _("takeProfit",P,S)},[_]);C.useEffect(()=>{if(!e||t===null)return;const S=(T,P)=>{var N,L,H;const A=(N=Object.entries(g.current).find(([,R])=>R===T))==null?void 0:N[0];if(!A||!eS(A))return;const I=e.activeChart().getAllShapes().filter(R=>R.name==="horizontal_line").some(R=>R.id===T);if(A==="entry"){if((P==="move"||P==="points_changed")&&I){const R=h.current;if(R.entryPrice!==null)try{const F=e.activeChart().getShapeById(T),M=(L=F.getPoints()[0])==null?void 0:L.price;if(M!==void 0&&Math.abs(M-R.entryPrice)>=R.priceStep/2){const $=F.getPoints();$.length>0&&F.setPoints($.map(O=>({...O,price:R.entryPrice})))}So(F)}catch{}}return}if(P==="remove"&&I){p.current=null,A==="stopLoss"&&f(""),A==="takeProfit"&&u(""),delete g.current[A];return}if(!(P!=="move"&&P!=="points_changed"&&!I)&&!m.current)try{const R=e.activeChart().getShapeById(T),F=(H=R.getPoints()[0])==null?void 0:H.price;if(!Number.isFinite(F)||F<=0)return;const M=h.current,$=A==="stopLoss"?M.stopLoss:M.takeProfit,O=xo($),U=O!==void 0&&Math.abs(O-F)<M.priceStep/2;if(P==="points_changed"&&I){p.current=A,v(R,A,F,M),y.current!==null&&clearTimeout(y.current),y.current=setTimeout(()=>{p.current=null;const ee=xe(F,h.current.digits);A==="stopLoss"?f(ee):u(ee)},120);return}if(y.current!==null&&(clearTimeout(y.current),y.current=null),p.current=null,U){v(R,A,F,M);return}const W=xe(F,M.digits),j=A==="stopLoss"?{...M,stopLoss:W}:{...M,takeProfit:W};A==="stopLoss"?f(W):u(W),v(R,A,F,j)}catch{p.current=null}};try{e.subscribe("drawing_event",S)}catch{}return()=>{p.current=null,y.current!==null&&(clearTimeout(y.current),y.current=null);try{e.unsubscribe("drawing_event",S)}catch{}Object.keys(g.current).forEach(T=>{b(T)}),g.current={}}},[e,b,f,u,t,v]),C.useEffect(()=>{if(!e||t===null)return;let S=!1;try{e.onChartReady(()=>{S||x(h.current)})}catch{}return()=>{S=!0}},[e,t,n,r,s,i,o,a,l,d,x])},ad=e=>{e.setUserEditEnabled(!1),e.setSelectionEnabled(!1)},zm=(e,t)=>Ke(e.symbol).toUpperCase()===t,nS=e=>pe.getState().positions.filter(t=>zm(t,e)).map(t=>({ticket:t.ticket,openPrice:t.openPrice,type:t.type,digits:t.digits,volumeLots:t.volumeLots,profit:t.profit})),cd=(e,t,n)=>{try{const r=e.activeChart().symbol(),s=n.find(i=>i.display_name===r||i.ticker===r);if(s)return Jf(s.ticker,n)}catch{}return t},rS=(e,t,n)=>{var i;const r=(i=e.getPoints()[0])==null?void 0:i.price;if(r!==void 0&&Math.abs(r-t)<Number.EPSILON){e.setProperties(n);return}const s=e.getPoints();s.length>0&&e.setPoints(s.map(o=>({...o,price:t}))),e.setProperties(n)},sS=({chartWidget:e,symbolTicker:t,symbols:n})=>{const r=pe(y=>y.positions),s=C.useRef(new Map),i=C.useRef(0),o=C.useMemo(()=>Jf(t,n),[t,n]),a=C.useMemo(()=>r.filter(y=>zm(y,o)).map(y=>`${y.ticket}:${y.openPrice}:${y.type}:${y.digits}:${y.volumeLots}:${y.profit.toFixed(2)}`).sort().join("|"),[o,r]),l=C.useCallback(y=>{if(!e)return;const m=s.current.get(y);if(m){try{e.activeChart().removeEntity(m)}catch{}s.current.delete(y)}},[e]),d=C.useCallback(()=>{for(const y of[...s.current.keys()])l(y);s.current.clear()},[l]),f=C.useCallback(async(y,m,h)=>{const b=id({side:m.type,volumeLots:m.volumeLots,profit:m.profit}),_={time:y.getVisibleRange().from,price:m.openPrice},x=await y.createShape(_,{shape:"horizontal_line",text:String(b.text),disableSave:!0,lock:!0,disableSelection:!0,overrides:b});if(h!==i.current){try{y.removeEntity(x)}catch{}return null}try{ad(y.getShapeById(x))}catch{}return x},[]),u=C.useCallback(async(y,m)=>{if(!e||m!==i.current)return;const h=e.activeChart(),b=id({side:y.type,volumeLots:y.volumeLots,profit:y.profit}),v=s.current.get(y.ticket);if(v)try{rS(h.getShapeById(v),y.openPrice,b),ad(h.getShapeById(v));return}catch{s.current.delete(y.ticket)}if(m===i.current)try{const _=await f(h,y,m);if(!_)return;s.current.set(y.ticket,_)}catch{}},[e,f]),g=C.useCallback(async(y,m)=>{if(!e||y!==i.current)return;const h=nS(m),b=new Set(h.map(v=>v.ticket));for(const v of s.current.keys())b.has(v)||l(v);for(const v of h){if(y!==i.current)return;await u(v,y)}},[e,l,u]),p=C.useCallback(y=>{if(!e)return;const m=i.current+1;i.current=m,y!=null&&y.resetLineIds&&d();const h=(y==null?void 0:y.symbolKey)??cd(e,o,n);g(m,h)},[o,e,d,n,g]);C.useEffect(()=>{if(!e)return;let y=!1,m=null;const h=()=>{y||p({resetLineIds:!0,symbolKey:cd(e,o,n)})};let b=!1;const v=()=>{b=!0,h()},_=()=>{y||!b||(b=!1,p({symbolKey:o}))};try{e.onChartReady(()=>{if(!y)try{m=e.activeChart(),p({resetLineIds:!0,symbolKey:o}),m.onSymbolChanged().subscribe(null,v),m.onDataLoaded().subscribe(null,_)}catch{}})}catch{}return()=>{if(y=!0,i.current+=1,m)try{m.onSymbolChanged().unsubscribe(null,v),m.onDataLoaded().unsubscribe(null,_)}catch{}d()}},[o,e,d,p,n]),C.useEffect(()=>{if(!e)return;let y=!1;try{e.onChartReady(()=>{y||p({symbolKey:o})})}catch{}return()=>{y=!0}},[o,e,a,p])},Wm=({chartWidget:e,symbolTicker:t,symbols:n})=>(sS({chartWidget:e,symbolTicker:t,symbols:n}),tS({chartWidget:e}),null);var ms=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},_n,Qt,er,nu,iS=(nu=class extends ms{constructor(){super();ne(this,_n);ne(this,Qt);ne(this,er);q(this,er,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){E(this,Qt)||this.setEventListener(E(this,er))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,Qt))==null||t.call(this),q(this,Qt,void 0))}setEventListener(t){var n;q(this,er,t),(n=E(this,Qt))==null||n.call(this),q(this,Qt,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){E(this,_n)!==t&&(q(this,_n,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof E(this,_n)=="boolean"?E(this,_n):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},_n=new WeakMap,Qt=new WeakMap,er=new WeakMap,nu),xc=new iS,oS={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Ct,xn,ru,aS=(ru=class{constructor(){ne(this,Ct,oS);ne(this,xn,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&E(this,xn)&&e!==E(this,Ct)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:E(this,Ct),provider:e}),q(this,Ct,e),process.env.NODE_ENV!=="production"&&q(this,xn,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&q(this,xn,!0),E(this,Ct).setTimeout(e,t)}clearTimeout(e){E(this,Ct).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&q(this,xn,!0),E(this,Ct).setInterval(e,t)}clearInterval(e){E(this,Ct).clearInterval(e)}},Ct=new WeakMap,xn=new WeakMap,ru),wn=new aS;function cS(e){setTimeout(e,0)}var lS=typeof window>"u"||"Deno"in globalThis;function Ze(){}function dS(e,t){return typeof e=="function"?e(t):e}function Go(e){return typeof e=="number"&&e>=0&&e!==1/0}function Km(e,t){return Math.max(e+(t||0)-Date.now(),0)}function an(e,t){return typeof e=="function"?e(t):e}function tt(e,t){return typeof e=="function"?e(t):e}function ld(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:i,queryKey:o,stale:a}=e;if(o){if(r){if(t.queryHash!==Sc(o,t.options))return!1}else if(!Qr(t.queryKey,o))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||s&&s!==t.state.fetchStatus||i&&!i(t))}function dd(e,t){const{exact:n,status:r,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Yr(t.options.mutationKey)!==Yr(i))return!1}else if(!Qr(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function Sc(e,t){return((t==null?void 0:t.queryKeyHashFn)||Yr)(e)}function Yr(e){return JSON.stringify(e,(t,n)=>Qo(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function Qr(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Qr(e[n],t[n])):!1}var uS=Object.prototype.hasOwnProperty;function Zo(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=ud(e)&&ud(t);if(!r&&!(Qo(e)&&Qo(t)))return t;const i=(r?e:Object.keys(e)).length,o=r?t:Object.keys(t),a=o.length,l=r?new Array(a):{};let d=0;for(let f=0;f<a;f++){const u=r?f:o[f],g=e[u],p=t[u];if(g===p){l[u]=g,(r?f<i:uS.call(e,u))&&d++;continue}if(g===null||p===null||typeof g!="object"||typeof p!="object"){l[u]=p;continue}const y=Zo(g,p,n+1);l[u]=y,y===g&&d++}return i===a&&d===i?e:l}function Yo(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function ud(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Qo(e){if(!fd(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!fd(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function fd(e){return Object.prototype.toString.call(e)==="[object Object]"}function fS(e){return new Promise(t=>{wn.setTimeout(t,e)})}function Xo(e,t,n){if(typeof n.structuralSharing=="function")return n.structuralSharing(e,t);if(n.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return Zo(e,t)}catch(r){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${r}`),r}return Zo(e,t)}return t}function mS(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function pS(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var fi=Symbol();function qm(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===fi&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===fi?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Gm(e,t){return typeof e=="function"?e(...t):!!e}function hS(e,t,n){let r=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??(s=t()),r||(r=!0,s.aborted?n():s.addEventListener("abort",n,{once:!0})),s)}),e}var Xr=(()=>{let e=()=>lS;return{isServer(){return e()},setIsServer(t){e=t}}})();function Jo(){let e,t;const n=new Promise((s,i)=>{e=s,t=i});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),e(s)},n.reject=s=>{r({status:"rejected",reason:s}),t(s)},n}var gS=cS;function yS(){let e=[],t=0,n=a=>{a()},r=a=>{a()},s=gS;const i=a=>{t?e.push(a):s(()=>{n(a)})},o=()=>{const a=e;e=[],a.length&&s(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;t++;try{l=a()}finally{t--,t||o()}return l},batchCalls:a=>(...l)=>{i(()=>{a(...l)})},schedule:i,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{s=a}}}var Fe=yS(),tr,Xt,nr,su,bS=(su=class extends ms{constructor(){super();ne(this,tr,!0);ne(this,Xt);ne(this,nr);q(this,nr,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){E(this,Xt)||this.setEventListener(E(this,nr))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,Xt))==null||t.call(this),q(this,Xt,void 0))}setEventListener(t){var n;q(this,nr,t),(n=E(this,Xt))==null||n.call(this),q(this,Xt,t(this.setOnline.bind(this)))}setOnline(t){E(this,tr)!==t&&(q(this,tr,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return E(this,tr)}},tr=new WeakMap,Xt=new WeakMap,nr=new WeakMap,su),mi=new bS;function vS(e){return Math.min(1e3*2**e,3e4)}function Zm(e){return(e??"online")==="online"?mi.isOnline():!0}var ea=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Ym(e){let t=!1,n=0,r;const s=Jo(),i=()=>s.status!=="pending",o=m=>{var h;if(!i()){const b=new ea(m);g(b),(h=e.onCancel)==null||h.call(e,b)}},a=()=>{t=!0},l=()=>{t=!1},d=()=>xc.isFocused()&&(e.networkMode==="always"||mi.isOnline())&&e.canRun(),f=()=>Zm(e.networkMode)&&e.canRun(),u=m=>{i()||(r==null||r(),s.resolve(m))},g=m=>{i()||(r==null||r(),s.reject(m))},p=()=>new Promise(m=>{var h;r=b=>{(i()||d())&&m(b)},(h=e.onPause)==null||h.call(e)}).then(()=>{var m;r=void 0,i()||(m=e.onContinue)==null||m.call(e)}),y=()=>{if(i())return;let m;const h=n===0?e.initialPromise:void 0;try{m=h??e.fn()}catch(b){m=Promise.reject(b)}Promise.resolve(m).then(u).catch(b=>{var T;if(i())return;const v=e.retry??(Xr.isServer()?0:3),_=e.retryDelay??vS,x=typeof _=="function"?_(n,b):_,S=v===!0||typeof v=="number"&&n<v||typeof v=="function"&&v(n,b);if(t||!S){g(b);return}n++,(T=e.onFail)==null||T.call(e,n,b),fS(x).then(()=>d()?void 0:p()).then(()=>{t?g(b):y()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(r==null||r(),s),cancelRetry:a,continueRetry:l,canStart:f,start:()=>(f()?y():p().then(y),s)}}var Sn,iu,Qm=(iu=class{constructor(){ne(this,Sn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Go(this.gcTime)&&q(this,Sn,wn.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Xr.isServer()?1/0:300*1e3))}clearGcTimeout(){E(this,Sn)!==void 0&&(wn.clearTimeout(E(this,Sn)),q(this,Sn,void 0))}},Sn=new WeakMap,iu);function wS(e){return{onFetch:(t,n)=>{var f,u,g,p,y;const r=t.options,s=(g=(u=(f=t.fetchOptions)==null?void 0:f.meta)==null?void 0:u.fetchMore)==null?void 0:g.direction,i=((p=t.state.data)==null?void 0:p.pages)||[],o=((y=t.state.data)==null?void 0:y.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const d=async()=>{let m=!1;const h=_=>{hS(_,()=>t.signal,()=>m=!0)},b=qm(t.options,t.fetchOptions),v=async(_,x,S)=>{if(m)return Promise.reject(t.signal.reason);if(x==null&&_.pages.length)return Promise.resolve(_);const P=(()=>{const N={client:t.client,queryKey:t.queryKey,pageParam:x,direction:S?"backward":"forward",meta:t.options.meta};return h(N),N})(),A=await b(P),{maxPages:D}=t.options,I=S?pS:mS;return{pages:I(_.pages,A,D),pageParams:I(_.pageParams,x,D)}};if(s&&i.length){const _=s==="backward",x=_?_S:md,S={pages:i,pageParams:o},T=x(r,S);a=await v(S,T,_)}else{const _=e??i.length;do{const x=l===0?o[0]??r.initialPageParam:md(r,a);if(l>0&&x==null)break;a=await v(a,x),l++}while(l<_)}return a};t.options.persister?t.fetchFn=()=>{var m,h;return(h=(m=t.options).persister)==null?void 0:h.call(m,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=d}}}function md(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function _S(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var rr,Cn,sr,at,Tn,Me,ts,En,et,Xm,Lt,ou,xS=(ou=class extends Qm{constructor(t){super();ne(this,et);ne(this,rr);ne(this,Cn);ne(this,sr);ne(this,at);ne(this,Tn);ne(this,Me);ne(this,ts);ne(this,En);q(this,En,!1),q(this,ts,t.defaultOptions),this.setOptions(t.options),this.observers=[],q(this,Tn,t.client),q(this,at,E(this,Tn).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,q(this,Cn,hd(this.options)),this.state=t.state??E(this,Cn),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return E(this,rr)}get promise(){var t;return(t=E(this,Me))==null?void 0:t.promise}setOptions(t){if(this.options={...E(this,ts),...t},t!=null&&t._type&&q(this,rr,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=hd(this.options);n.data!==void 0&&(this.setState(pd(n.data,n.dataUpdatedAt)),q(this,Cn,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&E(this,at).remove(this)}setData(t,n){const r=Xo(this.state.data,t,this.options);return ge(this,et,Lt).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t){ge(this,et,Lt).call(this,{type:"setState",state:t})}cancel(t){var r,s;const n=(r=E(this,Me))==null?void 0:r.promise;return(s=E(this,Me))==null||s.cancel(t),n?n.then(Ze).catch(Ze):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return E(this,Cn)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>tt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===fi||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>an(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!Km(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=E(this,Me))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=E(this,Me))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),E(this,at).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(E(this,Me)&&(E(this,En)||ge(this,et,Xm).call(this)?E(this,Me).cancel({revert:!0}):E(this,Me).cancelRetry()),this.scheduleGc()),E(this,at).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||ge(this,et,Lt).call(this,{type:"invalidate"})}async fetch(t,n){var d,f,u,g,p,y,m,h,b,v,_;if(this.state.fetchStatus!=="idle"&&((d=E(this,Me))==null?void 0:d.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(E(this,Me))return E(this,Me).continueRetry(),E(this,Me).promise}if(t&&this.setOptions(t),!this.options.queryFn){const x=this.observers.find(S=>S.options.queryFn);x&&this.setOptions(x.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const r=new AbortController,s=x=>{Object.defineProperty(x,"signal",{enumerable:!0,get:()=>(q(this,En,!0),r.signal)})},i=()=>{const x=qm(this.options,n),T=(()=>{const P={client:E(this,Tn),queryKey:this.queryKey,meta:this.meta};return s(P),P})();return q(this,En,!1),this.options.persister?this.options.persister(x,T,this):x(T)},a=(()=>{const x={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:E(this,Tn),state:this.state,fetchFn:i};return s(x),x})(),l=E(this,rr)==="infinite"?wS(this.options.pages):this.options.behavior;l==null||l.onFetch(a,this),q(this,sr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((f=a.fetchOptions)==null?void 0:f.meta))&&ge(this,et,Lt).call(this,{type:"fetch",meta:(u=a.fetchOptions)==null?void 0:u.meta}),q(this,Me,Ym({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:x=>{x instanceof ea&&x.revert&&this.setState({...E(this,sr),fetchStatus:"idle"}),r.abort()},onFail:(x,S)=>{ge(this,et,Lt).call(this,{type:"failed",failureCount:x,error:S})},onPause:()=>{ge(this,et,Lt).call(this,{type:"pause"})},onContinue:()=>{ge(this,et,Lt).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const x=await E(this,Me).start();if(x===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(x),(p=(g=E(this,at).config).onSuccess)==null||p.call(g,x,this),(m=(y=E(this,at).config).onSettled)==null||m.call(y,x,this.state.error,this),x}catch(x){if(x instanceof ea){if(x.silent)return E(this,Me).promise;if(x.revert){if(this.state.data===void 0)throw x;return this.state.data}}throw ge(this,et,Lt).call(this,{type:"error",error:x}),(b=(h=E(this,at).config).onError)==null||b.call(h,x,this),(_=(v=E(this,at).config).onSettled)==null||_.call(v,this.state.data,x,this),x}finally{this.scheduleGc()}}},rr=new WeakMap,Cn=new WeakMap,sr=new WeakMap,at=new WeakMap,Tn=new WeakMap,Me=new WeakMap,ts=new WeakMap,En=new WeakMap,et=new WeakSet,Xm=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Lt=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...Jm(r.data,this.options),fetchMeta:t.meta??null};case"success":const s={...r,...pd(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return q(this,sr,t.manual?s:void 0),s;case"error":const i=t.error;return{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Fe.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),E(this,at).notify({query:this,type:"updated",action:t})})},ou);function Jm(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Zm(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function pd(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function hd(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Ge,be,ns,qe,Pn,ir,jt,Jt,rs,or,ar,kn,An,en,cr,Ce,Br,ta,na,ra,sa,ia,oa,aa,ep,au,SS=(au=class extends ms{constructor(t,n){super();ne(this,Ce);ne(this,Ge);ne(this,be);ne(this,ns);ne(this,qe);ne(this,Pn);ne(this,ir);ne(this,jt);ne(this,Jt);ne(this,rs);ne(this,or);ne(this,ar);ne(this,kn);ne(this,An);ne(this,en);ne(this,cr,new Set);this.options=n,q(this,Ge,t),q(this,Jt,null),q(this,jt,Jo()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(E(this,be).addObserver(this),gd(E(this,be),this.options)?ge(this,Ce,Br).call(this):this.updateResult(),ge(this,Ce,sa).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ca(E(this,be),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ca(E(this,be),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,ge(this,Ce,ia).call(this),ge(this,Ce,oa).call(this),E(this,be).removeObserver(this)}setOptions(t){const n=this.options,r=E(this,be);if(this.options=E(this,Ge).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof tt(this.options.enabled,E(this,be))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");ge(this,Ce,aa).call(this),E(this,be).setOptions(this.options),n._defaulted&&!Yo(this.options,n)&&E(this,Ge).getQueryCache().notify({type:"observerOptionsUpdated",query:E(this,be),observer:this});const s=this.hasListeners();s&&yd(E(this,be),r,this.options,n)&&ge(this,Ce,Br).call(this),this.updateResult(),s&&(E(this,be)!==r||tt(this.options.enabled,E(this,be))!==tt(n.enabled,E(this,be))||an(this.options.staleTime,E(this,be))!==an(n.staleTime,E(this,be)))&&ge(this,Ce,ta).call(this);const i=ge(this,Ce,na).call(this);s&&(E(this,be)!==r||tt(this.options.enabled,E(this,be))!==tt(n.enabled,E(this,be))||i!==E(this,en))&&ge(this,Ce,ra).call(this,i)}getOptimisticResult(t){const n=E(this,Ge).getQueryCache().build(E(this,Ge),t),r=this.createResult(n,t);return TS(this,r)&&(q(this,qe,r),q(this,ir,this.options),q(this,Pn,E(this,be).state)),r}getCurrentResult(){return E(this,qe)}trackResult(t,n){return new Proxy(t,{get:(r,s)=>(this.trackProp(s),n==null||n(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&E(this,jt).status==="pending"&&E(this,jt).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,s))})}trackProp(t){E(this,cr).add(t)}getCurrentQuery(){return E(this,be)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=E(this,Ge).defaultQueryOptions(t),r=E(this,Ge).getQueryCache().build(E(this,Ge),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return ge(this,Ce,Br).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),E(this,qe)))}createResult(t,n){var D;const r=E(this,be),s=this.options,i=E(this,qe),o=E(this,Pn),a=E(this,ir),d=t!==r?t.state:E(this,ns),{state:f}=t;let u={...f},g=!1,p;if(n._optimisticResults){const I=this.hasListeners(),N=!I&&gd(t,n),L=I&&yd(t,r,n,s);(N||L)&&(u={...u,...Jm(f.data,t.options)}),n._optimisticResults==="isRestoring"&&(u.fetchStatus="idle")}let{error:y,errorUpdatedAt:m,status:h}=u;p=u.data;let b=!1;if(n.placeholderData!==void 0&&p===void 0&&h==="pending"){let I;i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(I=i.data,b=!0):I=typeof n.placeholderData=="function"?n.placeholderData((D=E(this,ar))==null?void 0:D.state.data,E(this,ar)):n.placeholderData,I!==void 0&&(h="success",p=Xo(i==null?void 0:i.data,I,n),g=!0)}if(n.select&&p!==void 0&&!b)if(i&&p===(o==null?void 0:o.data)&&n.select===E(this,rs))p=E(this,or);else try{q(this,rs,n.select),p=n.select(p),p=Xo(i==null?void 0:i.data,p,n),q(this,or,p),q(this,Jt,null)}catch(I){q(this,Jt,I)}E(this,Jt)&&(y=E(this,Jt),p=E(this,or),m=Date.now(),h="error");const v=u.fetchStatus==="fetching",_=h==="pending",x=h==="error",S=_&&v,T=p!==void 0,A={status:h,fetchStatus:u.fetchStatus,isPending:_,isSuccess:h==="success",isError:x,isInitialLoading:S,isLoading:S,data:p,dataUpdatedAt:u.dataUpdatedAt,error:y,errorUpdatedAt:m,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:u.dataUpdateCount>d.dataUpdateCount||u.errorUpdateCount>d.errorUpdateCount,isFetching:v,isRefetching:v&&!_,isLoadingError:x&&!T,isPaused:u.fetchStatus==="paused",isPlaceholderData:g,isRefetchError:x&&T,isStale:Cc(t,n),refetch:this.refetch,promise:E(this,jt),isEnabled:tt(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const I=A.data!==void 0,N=A.status==="error"&&!I,L=F=>{N?F.reject(A.error):I&&F.resolve(A.data)},H=()=>{const F=q(this,jt,A.promise=Jo());L(F)},R=E(this,jt);switch(R.status){case"pending":t.queryHash===r.queryHash&&L(R);break;case"fulfilled":(N||A.data!==R.value)&&H();break;case"rejected":(!N||A.error!==R.reason)&&H();break}}return A}updateResult(){const t=E(this,qe),n=this.createResult(E(this,be),this.options);if(q(this,Pn,E(this,be).state),q(this,ir,this.options),E(this,Pn).data!==void 0&&q(this,ar,E(this,be)),Yo(n,t))return;q(this,qe,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!E(this,cr).size)return!0;const o=new Set(i??E(this,cr));return this.options.throwOnError&&o.add("error"),Object.keys(E(this,qe)).some(a=>{const l=a;return E(this,qe)[l]!==t[l]&&o.has(l)})};ge(this,Ce,ep).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&ge(this,Ce,sa).call(this)}},Ge=new WeakMap,be=new WeakMap,ns=new WeakMap,qe=new WeakMap,Pn=new WeakMap,ir=new WeakMap,jt=new WeakMap,Jt=new WeakMap,rs=new WeakMap,or=new WeakMap,ar=new WeakMap,kn=new WeakMap,An=new WeakMap,en=new WeakMap,cr=new WeakMap,Ce=new WeakSet,Br=function(t){ge(this,Ce,aa).call(this);let n=E(this,be).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Ze)),n},ta=function(){ge(this,Ce,ia).call(this);const t=an(this.options.staleTime,E(this,be));if(Xr.isServer()||E(this,qe).isStale||!Go(t))return;const r=Km(E(this,qe).dataUpdatedAt,t)+1;q(this,kn,wn.setTimeout(()=>{E(this,qe).isStale||this.updateResult()},r))},na=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(E(this,be)):this.options.refetchInterval)??!1},ra=function(t){ge(this,Ce,oa).call(this),q(this,en,t),!(Xr.isServer()||tt(this.options.enabled,E(this,be))===!1||!Go(E(this,en))||E(this,en)===0)&&q(this,An,wn.setInterval(()=>{(this.options.refetchIntervalInBackground||xc.isFocused())&&ge(this,Ce,Br).call(this)},E(this,en)))},sa=function(){ge(this,Ce,ta).call(this),ge(this,Ce,ra).call(this,ge(this,Ce,na).call(this))},ia=function(){E(this,kn)!==void 0&&(wn.clearTimeout(E(this,kn)),q(this,kn,void 0))},oa=function(){E(this,An)!==void 0&&(wn.clearInterval(E(this,An)),q(this,An,void 0))},aa=function(){const t=E(this,Ge).getQueryCache().build(E(this,Ge),this.options);if(t===E(this,be))return;const n=E(this,be);q(this,be,t),q(this,ns,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},ep=function(t){Fe.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(E(this,qe))}),E(this,Ge).getQueryCache().notify({query:E(this,be),type:"observerResultsUpdated"})})},au);function CS(e,t){return tt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&tt(t.retryOnMount,e)===!1)}function gd(e,t){return CS(e,t)||e.state.data!==void 0&&ca(e,t,t.refetchOnMount)}function ca(e,t,n){if(tt(t.enabled,e)!==!1&&an(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Cc(e,t)}return!1}function yd(e,t,n,r){return(e!==t||tt(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Cc(e,n)}function Cc(e,t){return tt(t.enabled,e)!==!1&&e.isStaleByTime(an(t.staleTime,e))}function TS(e,t){return!Yo(e.getCurrentResult(),t)}var ss,Tt,ze,On,Et,qt,cu,ES=(cu=class extends Qm{constructor(t){super();ne(this,Et);ne(this,ss);ne(this,Tt);ne(this,ze);ne(this,On);q(this,ss,t.client),this.mutationId=t.mutationId,q(this,ze,t.mutationCache),q(this,Tt,[]),this.state=t.state||PS(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){E(this,Tt).includes(t)||(E(this,Tt).push(t),this.clearGcTimeout(),E(this,ze).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){q(this,Tt,E(this,Tt).filter(n=>n!==t)),this.scheduleGc(),E(this,ze).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){E(this,Tt).length||(this.state.status==="pending"?this.scheduleGc():E(this,ze).remove(this))}continue(){var t;return((t=E(this,On))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,a,l,d,f,u,g,p,y,m,h,b,v,_,x,S,T,P;const n=()=>{ge(this,Et,qt).call(this,{type:"continue"})},r={client:E(this,ss),meta:this.options.meta,mutationKey:this.options.mutationKey};q(this,On,Ym({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(A,D)=>{ge(this,Et,qt).call(this,{type:"failed",failureCount:A,error:D})},onPause:()=>{ge(this,Et,qt).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>E(this,ze).canRun(this)}));const s=this.state.status==="pending",i=!E(this,On).canStart();try{if(s)n();else{ge(this,Et,qt).call(this,{type:"pending",variables:t,isPaused:i}),E(this,ze).config.onMutate&&await E(this,ze).config.onMutate(t,this,r);const D=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,t,r));D!==this.state.context&&ge(this,Et,qt).call(this,{type:"pending",context:D,variables:t,isPaused:i})}const A=await E(this,On).start();return await((d=(l=E(this,ze).config).onSuccess)==null?void 0:d.call(l,A,t,this.state.context,this,r)),await((u=(f=this.options).onSuccess)==null?void 0:u.call(f,A,t,this.state.context,r)),await((p=(g=E(this,ze).config).onSettled)==null?void 0:p.call(g,A,null,this.state.variables,this.state.context,this,r)),await((m=(y=this.options).onSettled)==null?void 0:m.call(y,A,null,t,this.state.context,r)),ge(this,Et,qt).call(this,{type:"success",data:A}),A}catch(A){try{await((b=(h=E(this,ze).config).onError)==null?void 0:b.call(h,A,t,this.state.context,this,r))}catch(D){Promise.reject(D)}try{await((_=(v=this.options).onError)==null?void 0:_.call(v,A,t,this.state.context,r))}catch(D){Promise.reject(D)}try{await((S=(x=E(this,ze).config).onSettled)==null?void 0:S.call(x,void 0,A,this.state.variables,this.state.context,this,r))}catch(D){Promise.reject(D)}try{await((P=(T=this.options).onSettled)==null?void 0:P.call(T,void 0,A,t,this.state.context,r))}catch(D){Promise.reject(D)}throw ge(this,Et,qt).call(this,{type:"error",error:A}),A}finally{E(this,ze).runNext(this)}}},ss=new WeakMap,Tt=new WeakMap,ze=new WeakMap,On=new WeakMap,Et=new WeakSet,qt=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Fe.batch(()=>{E(this,Tt).forEach(r=>{r.onMutationUpdate(t)}),E(this,ze).notify({mutation:this,type:"updated",action:t})})},cu);function PS(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var It,ht,is,lu,kS=(lu=class extends ms{constructor(t={}){super();ne(this,It);ne(this,ht);ne(this,is);this.config=t,q(this,It,new Set),q(this,ht,new Map),q(this,is,0)}build(t,n,r){const s=new ES({client:t,mutationCache:this,mutationId:++ws(this,is)._,options:t.defaultMutationOptions(n),state:r});return this.add(s),s}add(t){E(this,It).add(t);const n=Ls(t);if(typeof n=="string"){const r=E(this,ht).get(n);r?r.push(t):E(this,ht).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(E(this,It).delete(t)){const n=Ls(t);if(typeof n=="string"){const r=E(this,ht).get(n);if(r)if(r.length>1){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}else r[0]===t&&E(this,ht).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Ls(t);if(typeof n=="string"){const r=E(this,ht).get(n),s=r==null?void 0:r.find(i=>i.state.status==="pending");return!s||s===t}else return!0}runNext(t){var r;const n=Ls(t);if(typeof n=="string"){const s=(r=E(this,ht).get(n))==null?void 0:r.find(i=>i!==t&&i.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Fe.batch(()=>{E(this,It).forEach(t=>{this.notify({type:"removed",mutation:t})}),E(this,It).clear(),E(this,ht).clear()})}getAll(){return Array.from(E(this,It))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>dd(n,r))}findAll(t={}){return this.getAll().filter(n=>dd(t,n))}notify(t){Fe.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Fe.batch(()=>Promise.all(t.map(n=>n.continue().catch(Ze))))}},It=new WeakMap,ht=new WeakMap,is=new WeakMap,lu);function Ls(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Pt,du,AS=(du=class extends ms{constructor(t={}){super();ne(this,Pt);this.config=t,q(this,Pt,new Map)}build(t,n,r){const s=n.queryKey,i=n.queryHash??Sc(s,n);let o=this.get(i);return o||(o=new xS({client:t,queryKey:s,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){E(this,Pt).has(t.queryHash)||(E(this,Pt).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=E(this,Pt).get(t.queryHash);n&&(t.destroy(),n===t&&E(this,Pt).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Fe.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return E(this,Pt).get(t)}getAll(){return[...E(this,Pt).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>ld(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>ld(t,r)):n}notify(t){Fe.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Fe.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Fe.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Pt=new WeakMap,du),Le,tn,nn,lr,dr,rn,ur,fr,uu,OS=(uu=class{constructor(e={}){ne(this,Le);ne(this,tn);ne(this,nn);ne(this,lr);ne(this,dr);ne(this,rn);ne(this,ur);ne(this,fr);q(this,Le,e.queryCache||new AS),q(this,tn,e.mutationCache||new kS),q(this,nn,e.defaultOptions||{}),q(this,lr,new Map),q(this,dr,new Map),q(this,rn,0)}mount(){ws(this,rn)._++,E(this,rn)===1&&(q(this,ur,xc.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,Le).onFocus())})),q(this,fr,mi.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,Le).onOnline())})))}unmount(){var e,t;ws(this,rn)._--,E(this,rn)===0&&((e=E(this,ur))==null||e.call(this),q(this,ur,void 0),(t=E(this,fr))==null||t.call(this),q(this,fr,void 0))}isFetching(e){return E(this,Le).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return E(this,tn).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=E(this,Le).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=E(this,Le).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(an(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return E(this,Le).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),s=E(this,Le).get(r.queryHash),i=s==null?void 0:s.state.data,o=dS(t,i);if(o!==void 0)return E(this,Le).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return Fe.batch(()=>E(this,Le).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=E(this,Le).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=E(this,Le);Fe.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=E(this,Le);return Fe.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Fe.batch(()=>E(this,Le).findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(Ze).catch(Ze)}invalidateQueries(e,t={}){return Fe.batch(()=>(E(this,Le).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=Fe.batch(()=>E(this,Le).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,n);return n.throwOnError||(i=i.catch(Ze)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Ze)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=E(this,Le).build(this,t);return n.isStaleByTime(an(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ze).catch(Ze)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ze).catch(Ze)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return mi.isOnline()?E(this,tn).resumePausedMutations():Promise.resolve()}getQueryCache(){return E(this,Le)}getMutationCache(){return E(this,tn)}getDefaultOptions(){return E(this,nn)}setDefaultOptions(e){q(this,nn,e)}setQueryDefaults(e,t){E(this,lr).set(Yr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...E(this,lr).values()],n={};return t.forEach(r=>{Qr(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){E(this,dr).set(Yr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...E(this,dr).values()],n={};return t.forEach(r=>{Qr(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...E(this,nn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Sc(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===fi&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...E(this,nn).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){E(this,Le).clear(),E(this,tn).clear()}},Le=new WeakMap,tn=new WeakMap,nn=new WeakMap,lr=new WeakMap,dr=new WeakMap,rn=new WeakMap,ur=new WeakMap,fr=new WeakMap,uu),tp=w.createContext(void 0),ps=e=>{const t=w.useContext(tp);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},NS=({client:e,children:t})=>(w.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),c.jsx(tp.Provider,{value:e,children:t})),np=w.createContext(!1),RS=()=>w.useContext(np);np.Provider;function LS(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var DS=w.createContext(LS()),jS=()=>w.useContext(DS),IS=(e,t,n)=>{const r=n!=null&&n.state.error&&typeof e.throwOnError=="function"?Gm(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},MS=e=>{w.useEffect(()=>{e.clearReset()},[e])},FS=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||Gm(n,[e.error,r])),US=e=>{if(e.suspense){const n=s=>s==="static"?s:Math.max(s??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...s)=>n(r(...s)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},BS=(e,t)=>e.isLoading&&e.isFetching&&!t,$S=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,bd=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function VS(e,t,n){var p,y,m,h;if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const r=RS(),s=jS(),i=ps(),o=i.defaultQueryOptions(e);(y=(p=i.getDefaultOptions().queries)==null?void 0:p._experimental_beforeQuery)==null||y.call(p,o);const a=i.getQueryCache().get(o.queryHash);process.env.NODE_ENV!=="production"&&(o.queryFn||console.error(`[${o.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`));const l=e.subscribed!==!1;o._optimisticResults=r?"isRestoring":l?"optimistic":void 0,US(o),IS(o,s,a),MS(s);const d=!i.getQueryCache().get(o.queryHash),[f]=w.useState(()=>new t(i,o)),u=f.getOptimisticResult(o),g=!r&&l;if(w.useSyncExternalStore(w.useCallback(b=>{const v=g?f.subscribe(Fe.batchCalls(b)):Ze;return f.updateResult(),v},[f,g]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),w.useEffect(()=>{f.setOptions(o)},[o,f]),$S(o,u))throw bd(o,f,s);if(FS({result:u,errorResetBoundary:s,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw u.error;if((h=(m=i.getDefaultOptions().queries)==null?void 0:m._experimental_afterQuery)==null||h.call(m,o,u),o.experimental_prefetchInRender&&!Xr.isServer()&&BS(u,r)){const b=d?bd(o,f,s):a==null?void 0:a.promise;b==null||b.catch(Ze).finally(()=>{f.updateResult()})}return o.notifyOnChangeProps?u:f.trackResult(u)}function Or(e,t){return VS(e,SS)}function HS(e,t){const n=ps(),r=n.getQueryCache();return w.useSyncExternalStore(w.useCallback(s=>r.subscribe(Fe.batchCalls(s)),[r]),()=>n.isFetching(e),()=>n.isFetching(e))}const rp=C.createContext(null);function zS(e){return typeof window>"u"?e??null:e?(localStorage.setItem(Dm,e),e):null}function WS({token:e,children:t}){const n=zS(e);return c.jsx(rp.Provider,{value:n,children:t})}function KS(){return C.useContext(rp)}const Tc="widget-accounts",Ec="widget-positions",Pc="widget-orders",hs="widget-deals",gs="widget-deals-total",qS=2e4,GS=3e4;function qs(e){const t=String(e.getUTCDate()).padStart(2,"0"),n=String(e.getUTCMonth()+1).padStart(2,"0"),r=String(e.getUTCHours()).padStart(2,"0"),s=String(e.getUTCMinutes()).padStart(2,"0"),i=String(e.getUTCSeconds()).padStart(2,"0");return`${n}.${t} ${r}:${s}:${i}`}function sp(e){const t=["seconds","Seconds","timestamp","Timestamp","value","Value","time","Time"];for(const n of t)if(e[n]!==void 0&&e[n]!==null&&e[n]!=="")return e[n]}function ip(e){if(e==null||e==="")return 0;if(typeof e=="number"&&Number.isFinite(e))return e>1e12?e:e*1e3;if(typeof e=="string"){const t=e.trim();if(!t)return 0;if(/^\d+$/.test(t)){const r=Number(t);if(Number.isFinite(r))return r>1e12?r:r*1e3}const n=Date.parse(t);if(Number.isFinite(n))return n}if(typeof e=="object"&&e!==null){const n=sp(e);if(n!==void 0)return ip(n)}return 0}function kc(e){if(e==null||e==="")return"—";if(typeof e=="number"&&Number.isFinite(e)){const t=e>1e12?e:e*1e3;return qs(new Date(t))}if(typeof e=="string"){const t=e.trim();if(!t)return"—";if(/^\d+$/.test(t)){const r=Number(t);if(Number.isFinite(r)){const s=r>1e12?r:r*1e3;return qs(new Date(s))}}const n=Date.parse(t);return Number.isFinite(n)?qs(new Date(n)):t}if(typeof e=="object"&&e!==null){const n=sp(e);if(n!==void 0)return kc(n)}return"—"}const op=["time","Time","openTime","open_time","OpenTime","TimeOpen","timeOpen","timeCreate","TimeCreate","timeSetup","TimeSetup","setupTime","setup_time","createdAt","created_at","createTime","CreateTime","timestamp","Timestamp","openDate","OpenDate","date","Date"];function ZS(e){return qs(e)}const YS={0:"buy",1:"sell",2:"buy limit",3:"sell limit",4:"buy stop",5:"sell stop",6:"buy stop limit",7:"sell stop limit"};function Wi(e,t){for(const n of t)if(e[n]!==void 0&&e[n]!==null&&e[n]!=="")return e[n]}function ot(e,t){const n=Wi(e,t);if(n===void 0)return;const r=Number(n);return Number.isFinite(r)?r:void 0}function Ds(e,t){const n=Wi(e,t);if(n!==void 0)return String(n)}function QS(e){if(Array.isArray(e))return e.filter(r=>typeof r=="object"&&r!==null);if(!e||typeof e!="object")return[];const t=e,n=["data","body","result"];for(const r of n){const s=t[r];if(Array.isArray(s))return s.filter(i=>typeof i=="object"&&i!==null);if(s&&typeof s=="object"){const i=s,o=["list","items","records","orders","content","data"];for(const a of o){const l=i[a];if(Array.isArray(l))return l.filter(d=>typeof d=="object"&&d!==null)}}}return[]}function la(e){return e===void 0?.01:e>=100?e/1e4:e}function XS(e,t){return Yf(t,e)}function JS(e){const t=Wi(e,["type","Type","orderType","OrderType"]);if(typeof t=="string"){const r=t.toLowerCase().trim();if(r)return{label:r,side:r.includes("sell")?"sell":"buy",typeNum:r.includes("sell")?3:2}}const n=ot(e,["type","Type","orderType","OrderType"])??2;return{label:YS[n]??(n%2===1?"sell":"buy"),side:ci(n),typeNum:n}}function e0(e,t){const n=ot(e,["volumeFilled","volume_filled","VolumeFilled","filledVolume","FilledVolume"]);if(n!==void 0)return la(n);const r=ot(e,["volumeCurrent","volume_current","VolumeCurrent"]);return r!==void 0?la(r):0}function t0(e,t){const n=Ds(e,["ticket","Ticket","order","Order","id","ID"]),r=Ds(e,["symbol","Symbol"])??"";if(!n||!r)return null;const s=Ke(r),{label:i,side:o,typeNum:a}=JS(e),l=ot(e,["typeTime","TypeTime"])??0,d=la(ot(e,["volumeLots","volume_lots","VolumeLots","volume","Volume"])),f=e0(e),u=ot(e,["priceOrder","price_order","PriceOrder","openPrice","open_price","price","Price"])??0,g=ot(e,["priceTrigger","price_trigger","PriceTrigger","triggerPrice","TriggerPrice"]),p=ot(e,["currentPrice","current_price","PriceCurrent","priceCurrent","marketPrice","MarketPrice"])??u,y=ot(e,["stopLoss","stop_loss","PriceSL","sl","SL"]),m=ot(e,["takeProfit","take_profit","PriceTP","tp","TP"]),h=ot(e,["marketBid","MarketBid","bid","Bid"])??p,b=ot(e,["marketAsk","MarketAsk","ask","Ask"])??p,v=Ds(e,["comment","Comment"])??"",_=XS(e,s),x=Wi(e,op),S=ip(x),T=kc(x);return{ticket:n,login:Ds(e,["login","Login"])??t,symbol:s,displaySymbol:Ii(s),openTimeMs:S,time:T,typeLabel:i,orderType:a,typeTime:l,side:o,volumeLots:d,volumeFilledLots:f,orderPrice:u,priceTrigger:g,stopLoss:y,takeProfit:m,currentPrice:p,marketBid:h,marketAsk:b,comment:v,digits:_}}function n0(e,t){return QS(e).map(n=>t0(n,t)).filter(n=>n!==null)}function Ki(e,t){for(const n of t)if(e[n]!==void 0&&e[n]!==null&&e[n]!=="")return e[n]}function Gt(e,t){const n=Ki(e,t);if(n===void 0)return;const r=Number(n);return Number.isFinite(r)?r:void 0}function js(e,t){const n=Ki(e,t);if(n!==void 0)return String(n)}function r0(e){if(Array.isArray(e))return e.filter(r=>typeof r=="object"&&r!==null);if(!e||typeof e!="object")return[];const t=e,n=["data","body","result"];for(const r of n){const s=t[r];if(Array.isArray(s))return s.filter(i=>typeof i=="object"&&i!==null);if(s&&typeof s=="object"){const i=s,o=["list","items","records","positions","orders","content","data"];for(const a of o){const l=i[a];if(Array.isArray(l))return l.filter(d=>typeof d=="object"&&d!==null)}}}return[]}function s0(e){return e===void 0?.01:e>=100?e/1e4:e}function i0(e){const t=Ki(e,["type","Type","action","Action","side","Side"]);if(typeof t=="string"){const r=t.toLowerCase();if(r.includes("sell"))return"sell";if(r.includes("buy"))return"buy"}const n=Gt(e,["type","Type","action","Action"]);return n!==void 0&&n%2===1?"sell":"buy"}function o0(e,t){return Yf(t,e)}function a0(e,t){const n=js(e,["ticket","Ticket","position","Position","order","Order","id","ID"]),r=js(e,["symbol","Symbol"])??"";if(!n||!r)return null;const s=Ke(r),i=i0(e),o=s0(Gt(e,["volumeLots","volume_lots","VolumeLots","volume","Volume"])),a=Gt(e,["openPrice","open_price","PriceOpen","priceOpen","price","Price"])??0,l=Gt(e,["currentPrice","current_price","PriceCurrent","priceCurrent"])??a,d=Gt(e,["stopLoss","stop_loss","PriceSL","sl","SL"]),f=Gt(e,["takeProfit","take_profit","PriceTP","tp","TP"]),u=Gt(e,["profit","Profit","floating","Floating","pnl","PnL"])??0,g=Gt(e,["swap","Swap"])??0,p=js(e,["comment","Comment"])??"",y=o0(e,s),m=kc(Ki(e,op));return{ticket:n,login:js(e,["login","Login"])??t,symbol:s,displaySymbol:Ii(s),time:m,type:i,volumeLots:o,openPrice:a,stopLoss:d,takeProfit:f,currentPrice:l,marketBid:l,marketAsk:l,swap:g,profit:u,comment:p,digits:y}}function c0(e,t){return r0(e).map(n=>a0(n,t)).filter(n=>n!==null)}function ys(){return Bt}function ap(){const e=dt(),t=KS(),{data:n,isLoading:r,isError:s}=Or({queryKey:[Tc,e.baseUrl,t],queryFn:()=>e.getAccounts(),enabled:!!t,refetchInterval:GS});return{accounts:n??[],isLoading:r,isError:s}}function l0(e){const t=dt();return Or({queryKey:[Ec,t.baseUrl,e],queryFn:()=>t.dealer.getPositions(e),enabled:!!e,refetchInterval:qS})}function d0(e){const t=dt();return Or({queryKey:[Pc,t.baseUrl,e],queryFn:()=>t.dealer.getOrders(e),enabled:!!e})}function u0(e,t){e.invalidateQueries({queryKey:[Tc,t]})}function f0(e,t,n){e.invalidateQueries({queryKey:[gs,t,n]}),e.invalidateQueries({queryKey:[hs,t,n]})}function m0(){const e=ps(),t=dt();return C.useCallback(async n=>{await Promise.all([e.invalidateQueries({queryKey:[gs,t.baseUrl,n]}),e.invalidateQueries({queryKey:[hs,t.baseUrl,n]})])},[t.baseUrl,e])}function p0(){const e=ps(),t=dt();return C.useCallback(async n=>{await Promise.all([e.invalidateQueries({queryKey:[Tc,t.baseUrl]}),e.invalidateQueries({queryKey:[Ec,t.baseUrl,n]}),e.invalidateQueries({queryKey:[Pc,t.baseUrl,n]}),e.invalidateQueries({queryKey:[gs,t.baseUrl,n]}),e.invalidateQueries({queryKey:[hs,t.baseUrl,n]})])},[t.baseUrl,e])}function h0(){const e=ps(),t=dt();return C.useCallback((n,r,s)=>{u0(e,t.baseUrl),e.invalidateQueries({queryKey:[Ec,t.baseUrl,n]}),(r===void 0||ac(r))&&e.invalidateQueries({queryKey:[Pc,t.baseUrl,n]}),(s==null?void 0:s.invalidateDeals)!==!1&&f0(e,t.baseUrl,n)},[t.baseUrl,e])}function qi(){const e=dt(),t=h0();return{async submitOrder(n){const r=await e.trading.submitOrder(n);return r.success&&t(n.login,n.orderType),r},async closePosition(n,r){const s=await e.trading.closePosition(n);return s.success&&!(r!=null&&r.skipInvalidation)&&t(n.login),s},async deleteOrder(n){const r=await e.trading.deleteOrder(n);return r.success&&t(n.login,n.orderType),r},async modifyOrder(n,r){const s=await e.trading.modifyOrder(n,r);return s.success&&t(n.login,n.orderType),s},async modifyPosition(n,r){const s=await e.trading.modifyPosition(n,r);return s.success&&t(n.login),s}}}function g0(e){if(e===null||typeof e!="object")return{deals:[],offset:0,count:0};const t=e,n=t.data??t,s=(Array.isArray(n.deals)?n.deals:[]).map(i=>{const o=i??{};return{deal:Number(o.Deal??0),login:Number(o.Login??0),symbol:String(o.Symbol??""),action:Number(o.Action??0),volume:Number(o.Volume??0),price:Number(o.Price??0),profit:Number(o.Profit??0),time:Number(o.Time??0),entry:Number(o.Entry??0),comment:String(o.Comment??"")}});return{deals:s,offset:Number(n.offset??0),count:Number(n.count??s.length)}}function y0(e){if(e===null||typeof e!="object")return{total:0};const t=e,n=t.data??t;return{total:Number(n.total??0)}}function b0(e,t,n,r={}){const s=dt();return Or({queryKey:[gs,s.baseUrl,e,t,n],queryFn:async()=>{const i=await s.dealer.getDealsTotal(e,t,n);return y0(i)},enabled:r.enabled??!0})}function v0(e,t,n,r,s,i={}){const o=dt();return Or({queryKey:[hs,o.baseUrl,e,t,n,r,s],queryFn:async()=>{const a=await o.dealer.getDeals(e,t,n,r,s);return g0(a)},enabled:i.enabled??!0})}function w0(e,t){return e!=null?c0(e,t):[]}function _0(e,t){return e!=null?n0(e,t):[]}function x0({symbolTicker:e,controlsRef:t,chartWidget:n,sidePanelTab:r,orderState:s,backUrl:i,createAccountUrl:o}){const{openMarketPanel:a,setSelectedLogin:l}=s,d=ys();return C.useEffect(()=>(t.current={open:a,setSelectedLogin:l},()=>{t.current=null}),[t,a,l]),c.jsxs(c.Fragment,{children:[c.jsx(Wm,{chartWidget:n,symbolTicker:e,symbols:d}),c.jsx(Fm,{}),c.jsx(Hx,{symbolTicker:e,sidePanelTab:r,orderState:s,backUrl:i,createAccountUrl:o})]})}const S0=8,vd=11;function C0({wide:e}){return c.jsx("td",{className:"web-trading-widget-terminal__cell",children:c.jsx("div",{className:`web-trading-widget-terminal__skeleton-bar${e?" web-trading-widget-terminal__skeleton-bar--wide":""}`})})}function T0(){return c.jsx(c.Fragment,{children:Array.from({length:S0},(e,t)=>c.jsx("tr",{className:"web-trading-widget-terminal__skeleton-row",children:Array.from({length:vd},(n,r)=>c.jsx(C0,{wide:r===vd-1},r))},t))})}const E0={0:"Buy",1:"Sell",2:"Balance",3:"Credit",5:"-"},P0="web-trading-widget-text-buy",k0="web-trading-widget-text-sell",A0="web-trading-widget-terminal__head-row",Co=50;function O0(e){return e===0?P0:e===1?k0:A0}const wd=e=>e.toISOString().split("T")[0],cp=e=>Math.floor(new Date(e).getTime()/1e3),N0=e=>cp(e),R0=e=>cp(e)+86399;function L0(){const e=new Date,t=new Date;return t.setDate(t.getDate()-7),{fromTs:N0(wd(t)),toTs:R0(wd(e))}}const D0=e=>new Date(e*1e3).toLocaleString(void 0,{year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"});function j0(e){try{return decodeURIComponent(e)}catch{return e}}function I0(){return c.jsxs("colgroup",{children:[c.jsx("col",{className:"web-trading-widget-terminal-col--deal"}),c.jsx("col",{className:"web-trading-widget-terminal-col--ticket"}),c.jsx("col",{className:"web-trading-widget-terminal-col--symbol"}),c.jsx("col",{className:"web-trading-widget-terminal-col--type"}),c.jsx("col",{className:"web-trading-widget-terminal-col--volume"}),c.jsx("col",{className:"web-trading-widget-terminal-col--price"}),c.jsx("col",{className:"web-trading-widget-terminal-col--profit"}),c.jsx("col",{className:"web-trading-widget-terminal-col--entry"}),c.jsx("col",{className:"web-trading-widget-terminal-col--time"}),c.jsx("col",{className:"web-trading-widget-terminal-col--local-time"}),c.jsx("col",{})]})}function M0(){return c.jsx("thead",{children:c.jsxs("tr",{className:"web-trading-widget-terminal__head-row",children:[c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Deal"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Login"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Symbol"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Action"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Volume"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Price"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Profit"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Entry"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Time"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Local time"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Comment"})]})})}function F0({deal:e}){const t=e.profit>0?"web-trading-widget-text-profit-positive":e.profit<0?"web-trading-widget-text-profit-negative":"";return c.jsxs("tr",{className:"web-trading-widget-terminal__deals-row",children:[c.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.deal}),c.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.login}),c.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.symbol||"—"}),c.jsx("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--capitalize ${O0(e.action)}`,children:E0[e.action]??`Action ${e.action}`}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:(e.volume/1e4).toFixed(2)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.price.toFixed(5)}),c.jsxs("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right ${t}`,children:[e.profit>0?"+":"",e.profit.toFixed(2)]}),c.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.entry===1?"OUT":"IN"}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--nowrap",children:ZS(new Date(e.time*1e3))}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--nowrap",children:D0(e.time)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--truncate",children:e.comment?j0(e.comment):"—"})]})}function U0({login:e,detailUrl:t}){const{fromTs:n,toTs:r}=C.useMemo(()=>L0(),[]),s=e!=="",{data:i,isLoading:o}=b0(e,n,r,{enabled:s}),a=(i==null?void 0:i.total)??0,l=Math.max(0,a-Co),d=a>0?Math.min(Co,a):Co,{data:f,isLoading:u}=v0(e,n,r,l,d,{enabled:s}),g=s&&(o||u),p=C.useMemo(()=>[...(f==null?void 0:f.deals)??[]].sort((y,m)=>m.time-y.time),[f==null?void 0:f.deals]);return e?c.jsx("div",{className:"web-trading-widget-terminal__deals-wrap",children:c.jsxs("div",{className:"web-trading-widget-terminal__body-scroll",children:[c.jsxs("table",{className:"web-trading-widget-terminal__deals-table",children:[c.jsx(I0,{}),c.jsx(M0,{}),c.jsxs("tbody",{children:[g?c.jsx(T0,{}):null,!g&&p.length===0?c.jsx("tr",{children:c.jsx("td",{colSpan:11,className:"web-trading-widget-terminal__empty-cell",children:"No deals found"})}):null,g?null:p.map(y=>c.jsx(F0,{deal:y},y.deal))]})]}),t?c.jsx("div",{className:"web-trading-widget-terminal__deals-footer",children:c.jsx("a",{href:t,className:"web-trading-widget-terminal__deals-detail-btn",children:"See full deal history"})}):null]})}):c.jsx("div",{className:"web-trading-widget-terminal__empty-cell",children:"Select an account to view deal history"})}function lp(e){const t=pe(d=>d.setPositions),n=pe(d=>d.setOrders),{data:r,isLoading:s,isError:i}=l0(e),{data:o,isLoading:a,isError:l}=d0(e);return C.useEffect(()=>{if(!e.trim()){t([]),n([]);return}r!=null&&t(w0(r,e)),o!=null&&n(_0(o,e))},[e,o,r,n,t]),{isLoading:s||a,isError:!!(i||l)}}const _d=224,xd=32,Ac=120;function dp(){return typeof window>"u"?560:Math.max(Ac,Math.floor(window.innerHeight*.7))}function B0(e){return Math.min(dp(),Math.max(Ac,e))}function $0(){const[e,t]=C.useState(_d),[n,r]=C.useState(!1),s=C.useRef(_d);C.useEffect(()=>{s.current=e},[e]);const i=C.useCallback(f=>{t(B0(f))},[]),o=C.useCallback(()=>{i(s.current+xd)},[i]),a=C.useCallback(()=>{i(s.current-xd)},[i]),l=C.useCallback(f=>{const u=f,g=s.current;r(!0);const p=m=>{const h=u-m.clientY;i(g+h)},y=()=>{r(!1),document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",y),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",p),document.addEventListener("mouseup",y),document.body.style.cursor="row-resize",document.body.style.userSelect="none"},[i]);C.useEffect(()=>{const f=()=>{i(s.current)};return window.addEventListener("resize",f),()=>{window.removeEventListener("resize",f),document.body.style.cursor="",document.body.style.userSelect=""}},[i]);const d=dp();return{height:e,isResizing:n,canIncrement:e<d,canDecrement:e>Ac,onResizeStart:l,incrementHeight:o,decrementHeight:a}}const V0=e=>e==null?void 0:e.replace(/(\d+)\.0{18}/g,"$1"),H0=2e4;let To=0;function z0(){return To=(To+1)%Number.MAX_VALUE,To.toString()}const Eo=new Map,Sd=(e,t)=>{if(Eo.has(e))return;const n=setTimeout(()=>{Eo.delete(e),zr({type:"REMOVE_TOAST",toastId:e})},t||H0);Eo.set(e,n)},W0=(e,t)=>{var n;switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,((n=t==null?void 0:t.toast)==null?void 0:n.limit)??1)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(r=>r.id===t.toast.id?{...r,...t.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=t;if(r){const s=e.toasts.find(i=>i.id===r);Sd(r,s==null?void 0:s.duration)}else e.toasts.forEach(s=>{Sd(s.id,s.duration)});return{...e,toasts:e.toasts.map(s=>s.id===r||r===void 0?{...s,open:!1}:s)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(r=>r.id!==t.toastId)}}},Gs=[];let Zs={toasts:[]};function zr(e){Zs=W0(Zs,e),Gs.forEach(t=>{t(Zs)})}function Se({duration:e=2e4,description:t,...n}){const r=z0(),s=typeof t=="string"?V0(t):t,i=a=>zr({type:"UPDATE_TOAST",toast:{...a,description:s,id:r}}),o=()=>{zr({type:"DISMISS_TOAST",toastId:r})};return zr({type:"ADD_TOAST",toast:{...n,description:s,id:r,open:!0,duration:e,onOpenChange:a=>{a||o()}}}),e&&setTimeout(o,e),{id:r,dismiss:o,update:i}}function K0(){const[e,t]=w.useState(Zs);return w.useEffect(()=>(Gs.push(t),()=>{const n=Gs.indexOf(t);n>-1&&Gs.splice(n,1)}),[e]),{...e,toast:Se,dismiss:n=>zr({type:"DISMISS_TOAST",toastId:n})}}function q0(e){return e.type==="buy"?e.marketBid??e.currentPrice:e.marketAsk??e.currentPrice}function G0(){const{closePosition:e,deleteOrder:t}=qi(),n=p0(),r=pe(h=>h.removePosition),s=pe(h=>h.removeOrder),i=pe(h=>h.setSelectedPositionTicket),o=pe(h=>h.setSelectedOrderTicket),[a,l]=C.useState(new Set),[d,f]=C.useState(!1),u=C.useCallback((h,b)=>{l(v=>{const _=new Set(v);return b?_.add(h):_.delete(h),_})},[]),g=C.useCallback(h=>a.has(h),[a]),p=C.useCallback(async h=>{const b=`position-${h.ticket}`;u(b,!0);try{const v=await e(h);if(!v.success){Se({variant:"destructive",description:v.message||"Failed to close position."});return}r(h.ticket),i(null),Se({description:`Position #${h.ticket} closed at ${q0(h).toFixed(h.digits)}.`})}catch(v){const _=v instanceof Error?v.message:"Failed to close position.";Se({variant:"destructive",description:_})}finally{u(b,!1)}},[e,r,u,i]),y=C.useCallback(async h=>{var x;if(h.length===0||d)return;if(!e){Se({variant:"destructive",description:"Close position is not configured."});return}f(!0);let b=0,v=0;const _=((x=h[0])==null?void 0:x.login)??"";for(const S of h){const T=`position-${S.ticket}`;u(T,!0);try{if(!(await e(S,{skipInvalidation:!0})).success){v+=1;continue}r(S.ticket),b+=1}catch{v+=1}finally{u(T,!1)}}i(null),b>0&&_&&await n(_),Se(v===0?{description:b===1?"1 position closed.":`${b} positions closed.`}:b===0?{variant:"destructive",description:"Failed to close positions."}:{variant:"destructive",description:`Closed ${b}, failed ${v}.`}),f(!1)},[d,e,n,r,u,i]),m=C.useCallback(async h=>{const b=`order-${h.ticket}`;u(b,!0);try{const v=await t(h);if(!v.success){Se({variant:"destructive",description:v.message||"Failed to delete order."});return}s(h.ticket),o(null),Se({description:`Order #${h.ticket} deleted.`})}catch(v){const _=v instanceof Error?v.message:"Failed to delete order.";Se({variant:"destructive",description:_})}finally{u(b,!1)}},[t,s,u,o]);return{closePosition:p,closeAllPositions:y,deleteOrder:m,isClosingAll:d,isRowBusy:g}}function Zt(e,t=2){return e.toFixed(t)}function up(e){return e.reduce((t,n)=>t+n.profit+n.swap,0)}function Z0(e,t,n){const r=(e==null?void 0:e.balance)??0,s=(e==null?void 0:e.credit)??0,i=(e==null?void 0:e.margin)??0;if(!e||t.length===0)return{balance:r,equity:(e==null?void 0:e.equity)??r+s,margin:i,marginFree:(e==null?void 0:e.marginFree)??0,marginLevel:e==null?void 0:e.marginLevel,totalProfit:0};const o=up(t),a=r+s+o+n,l=a-i,d=i>0?a/i*100:void 0;return{balance:r,equity:a,margin:i,marginFree:l,marginLevel:d,totalProfit:o}}function da(){return c.jsxs("colgroup",{children:[c.jsx("col",{className:"web-trading-widget-terminal-col--symbol"}),c.jsx("col",{className:"web-trading-widget-terminal-col--ticket"}),c.jsx("col",{className:"web-trading-widget-terminal-col--time"}),c.jsx("col",{className:"web-trading-widget-terminal-col--type"}),c.jsx("col",{className:"web-trading-widget-terminal-col--volume"}),c.jsx("col",{className:"web-trading-widget-terminal-col--price"}),c.jsx("col",{className:"web-trading-widget-terminal-col--sl"}),c.jsx("col",{className:"web-trading-widget-terminal-col--tp"}),c.jsx("col",{className:"web-trading-widget-terminal-col--price2"}),c.jsx("col",{className:"web-trading-widget-terminal-col--swap"}),c.jsx("col",{className:"web-trading-widget-terminal-col--profit"}),c.jsx("col",{}),c.jsx("col",{className:"web-trading-widget-terminal-col--close"})]})}function Y0(){return c.jsx("thead",{children:c.jsxs("tr",{className:"web-trading-widget-terminal__head-row",children:[c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Symbol"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Ticket"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Server time"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Type"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Volume"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Price"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"S / L"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"T / P"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Price"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Swap"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right web-trading-widget-terminal__head-cell",children:"Profit"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--left web-trading-widget-terminal__head-cell",children:"Comment"}),c.jsx("th",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--close","aria-label":"Close"})]})})}function Q0({balance:e,equity:t,margin:n,marginFree:r,marginLevel:s,totalPnL:i,scrollRef:o,onScroll:a}){const l=i>0?"web-trading-widget-text-profit-positive":i<0?"web-trading-widget-text-profit-negative":"";return c.jsx("div",{className:"web-trading-widget-terminal__stats",children:c.jsx("div",{ref:o,className:"web-trading-widget-terminal__header-scroll",onScroll:a,children:c.jsxs("table",{className:"web-trading-widget-terminal__table",children:[c.jsx(da,{}),c.jsx("tbody",{children:c.jsxs("tr",{children:[c.jsx("td",{colSpan:10,className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--nowrap",children:c.jsxs("div",{className:"web-trading-widget-terminal__stats-row web-trading-widget-terminal__stats-row--tabular",children:[c.jsxs("span",{children:["Balance: ",Zt(e)]}),c.jsxs("span",{children:["Equity: ",Zt(t)]}),c.jsxs("span",{children:["Margin: ",Zt(n)]}),c.jsxs("span",{children:["Free margin: ",Zt(r)]}),c.jsxs("span",{children:["Level: ",s!==void 0?`${Zt(s,2)}%`:"0.00%"]})]})}),c.jsx("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right ${l}`,children:Zt(i)}),c.jsx("td",{className:"web-trading-widget-terminal__cell"}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--close"})]})})]})})})}const X0=[{id:"trade",label:"Trade"},{id:"history",label:"History"}];function J0({activeTab:e,onTabChange:t,positionCount:n,isClosingAll:r,onCloseAllPositions:s,isRefetchingDeals:i,onRefetchDeals:o}){const a=e==="trade"&&(n>0||r),l=e==="history";return c.jsxs("div",{role:"tablist","aria-label":"Terminal panel tabs",className:"web-trading-widget-terminal__tab-bar",children:[X0.map(d=>{const f=e===d.id;return c.jsx("button",{type:"button",role:"tab","aria-selected":f,onClick:()=>t(d.id),className:`web-trading-widget-terminal__tab-btn${f?" web-trading-widget-terminal__tab-btn--active":""}`,children:d.label},d.id)}),c.jsxs("div",{className:"web-trading-widget-terminal__toolbar-actions",children:[a?c.jsx("button",{type:"button",disabled:r,onClick:s,className:"web-trading-widget-terminal__close-all-btn",children:r?"Closing…":"Close all"}):null,l?c.jsxs("button",{type:"button",disabled:i,onClick:o,className:"web-trading-widget-terminal__refetch-btn","aria-label":"Refresh deal history",children:[c.jsx(Vv,{className:`web-trading-widget-icon web-trading-widget-icon--sm${i?" web-trading-widget-terminal__refetch-icon--spinning":""}`}),i?"Refreshing…":"Refresh"]}):null]})]})}function eC({position:e,isSelected:t,isClosing:n,onSelect:r,onClose:s}){const i=e.type==="buy"?"web-trading-widget-text-buy":"web-trading-widget-text-sell",o=e.profit>0?"web-trading-widget-text-profit-positive":e.profit<0?"web-trading-widget-text-profit-negative":"";return c.jsxs("tr",{className:`web-trading-widget-terminal__row${t?" web-trading-widget-terminal__row--selected":""}`,onClick:r,children:[c.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.displaySymbol}),c.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.ticket}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--nowrap",children:e.time}),c.jsx("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--capitalize ${i}`,children:e.type}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.volumeLots.toFixed(2)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:xe(e.openPrice,e.digits)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.stopLoss!==void 0&&e.stopLoss!==0?xe(e.stopLoss,e.digits):"N/A"}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.takeProfit!==void 0&&e.takeProfit!==0?xe(e.takeProfit,e.digits):"N/A"}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:xe(e.currentPrice,e.digits)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.swap!==0?Zt(e.swap):""}),c.jsx("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right ${o}`,children:Zt(e.profit)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--truncate",children:e.comment}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--close",children:c.jsx("button",{type:"button","aria-label":`Close position #${e.ticket}`,title:"Close position",disabled:n,className:"web-trading-widget-terminal__row-close-btn",onClick:a=>{a.stopPropagation(),s()},children:c.jsx(gn,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})})]})}function tC({order:e,isSelected:t,isDeleting:n,onSelect:r,onDelete:s}){const i=e.side==="buy"?"web-trading-widget-text-buy":"web-trading-widget-text-sell";return c.jsxs("tr",{className:`web-trading-widget-terminal__row${t?" web-trading-widget-terminal__row--selected":""}`,onClick:r,children:[c.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.displaySymbol}),c.jsx("td",{className:"web-trading-widget-terminal__cell",children:e.ticket}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--nowrap",children:e.time}),c.jsx("td",{className:`web-trading-widget-terminal__cell web-trading-widget-terminal__cell--capitalize ${i}`,children:e.typeLabel}),c.jsxs("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:[e.volumeLots.toFixed(2)," / ",e.volumeFilledLots.toFixed(2)]}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:xe(e.orderPrice,e.digits)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.stopLoss!==void 0&&e.stopLoss!==0?xe(e.stopLoss,e.digits):"N/A"}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:e.takeProfit!==void 0&&e.takeProfit!==0?xe(e.takeProfit,e.digits):"N/A"}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right",children:xe(e.currentPrice,e.digits)}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right"}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--right"}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--truncate",children:e.comment}),c.jsx("td",{className:"web-trading-widget-terminal__cell web-trading-widget-terminal__cell--close",children:c.jsx("button",{type:"button","aria-label":`Delete order #${e.ticket}`,title:"Delete order",disabled:n,className:"web-trading-widget-terminal__row-close-btn",onClick:o=>{o.stopPropagation(),s()},children:c.jsx(gn,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})})]})}function fp({embedded:e=!1,symbolTicker:t="",onSymbolChange:n,onCreateNewOrder:r,dealDetailUrl:s}){const[i,o]=C.useState("trade"),a=ys(),{accounts:l,isLoading:d}=ap(),f=$0(),{height:u,isResizing:g,onResizeStart:p}=e?{height:0,isResizing:!1,onResizeStart:()=>{}}:f,y=pe(B=>B.selectedLogin),m=pe(B=>B.selectedPositionTicket),h=pe(B=>B.selectedOrderTicket),b=pe(B=>B.setSelectedPositionTicket),v=pe(B=>B.setSelectedOrderTicket),{isLoading:_}=lp(y),x=pe(B=>B.positions),S=pe(B=>B.orders),{closePosition:T,closeAllPositions:P,deleteOrder:A,isClosingAll:D,isRowBusy:I}=G0(),N=m0(),L=dt(),H=HS({predicate:B=>{const ve=B.queryKey;return y?(ve[0]===hs||ve[0]===gs)&&ve[1]===L.baseUrl&&ve[2]===y:!1}})>0,R=d||_,F=C.useMemo(()=>y?x.filter(B=>B.login===y):x,[x,y]),M=C.useMemo(()=>y?S.filter(B=>B.login===y):S,[S,y]),$=C.useMemo(()=>{const B=l.find(ve=>ve.login===y);return(B==null?void 0:B.tradeStat)??null},[l,y]),O=C.useMemo(()=>F.map(B=>B.ticket).sort().join("|"),[F]),U=C.useMemo(()=>$?`${$.balance}:${$.credit??0}:${$.equity}:${$.margin}|${O}`:"",[$,O]),W=C.useMemo(()=>{if(!$||F.length===0)return 0;const B=up(F);return $.equity-$.balance-($.credit??0)-B},[U]),j=C.useMemo(()=>Z0($,F,W),[$,F,W]),ee=F.length===0&&M.length===0,J=C.useRef(null),de=C.useRef(null),ue=C.useRef(null),V=C.useCallback(()=>{P(F)},[P,F]),K=C.useCallback(()=>{y&&N(y)},[N,y]),se=C.useCallback(B=>{const ve=ew(B,a);ve&&(n==null||n(ve))},[n,a]),Ee=C.useCallback(B=>{b(B.ticket),se(B.symbol)},[b,se]),le=C.useCallback(B=>{v(B.ticket),se(B.symbol)},[v,se]),oe=C.useCallback(B=>{const ve=J.current,ke=de.current,Pe=ue.current;if(!ve||!ke)return;const X=B==="header"?ve.scrollLeft:B==="body"?ke.scrollLeft:(Pe==null?void 0:Pe.scrollLeft)??0;B!=="header"&&(ve.scrollLeft=X),B!=="body"&&(ke.scrollLeft=X),Pe&&B!=="footer"&&(Pe.scrollLeft=X)},[]);return c.jsxs(c.Fragment,{children:[!e&&g?c.jsx("div",{className:"web-trading-widget-terminal-resize-overlay","aria-hidden":!0}):null,c.jsxs("div",{className:`web-trading-widget-terminal${e?" web-trading-widget-terminal--embedded":""}`,style:e?void 0:{height:u},children:[e?null:c.jsx("div",{className:"web-trading-widget-terminal__resize-bar-wrap",children:c.jsx("div",{role:"separator","aria-orientation":"horizontal","aria-label":"Resize terminal panel","aria-valuenow":u,className:"web-trading-widget-terminal__resize-bar",onMouseDown:B=>{B.preventDefault(),p(B.clientY)},children:c.jsx(Gf,{className:"web-trading-widget-icon web-trading-widget-icon--sm web-trading-widget-terminal__resize-icon"})})}),c.jsx(J0,{activeTab:i,onTabChange:o,positionCount:F.length,isClosingAll:D,onCloseAllPositions:V,isRefetchingDeals:H,onRefetchDeals:K}),i==="trade"?c.jsxs(c.Fragment,{children:[c.jsx("div",{ref:J,className:"web-trading-widget-terminal__header-scroll",onScroll:()=>oe("header"),children:c.jsxs("table",{className:"web-trading-widget-terminal__table",children:[c.jsx(da,{}),c.jsx(Y0,{})]})}),c.jsx("div",{ref:de,className:"web-trading-widget-terminal__body-scroll",onScroll:()=>oe("body"),children:c.jsxs("table",{className:"web-trading-widget-terminal__table",children:[c.jsx(da,{}),c.jsxs("tbody",{children:[R&&ee?c.jsx("tr",{children:c.jsx("td",{colSpan:13,className:"web-trading-widget-terminal__empty-cell",children:"Loading…"})}):null,!R&&ee?c.jsx("tr",{children:c.jsx("td",{colSpan:13,className:"web-trading-widget-terminal__empty-cell",children:c.jsxs("div",{className:"web-trading-widget-terminal__empty-inner",children:[c.jsx("p",{className:"web-trading-widget-terminal__empty-text",children:"You don't have any positions"}),r?c.jsx("button",{type:"button",onClick:r,className:"web-trading-widget-terminal__create-btn",children:"Create New Order"}):null]})})}):null,F.map(B=>c.jsx(eC,{position:B,isSelected:m===B.ticket,isClosing:I(`position-${B.ticket}`),onSelect:()=>Ee(B),onClose:()=>void T(B)},`position-${B.ticket}`)),M.map(B=>c.jsx(tC,{order:B,isSelected:h===B.ticket,isDeleting:I(`order-${B.ticket}`),onSelect:()=>le(B),onDelete:()=>void A(B)},`order-${B.ticket}`))]})]})})]}):c.jsx(U0,{login:y??"",detailUrl:s}),c.jsx(Q0,{balance:j.balance,equity:j.equity,margin:j.margin,marginFree:j.marginFree,marginLevel:j.marginLevel,totalPnL:j.totalProfit,scrollRef:i==="trade"?ue:void 0,onScroll:i==="trade"?()=>oe("footer"):void 0})]})]})}const ua=224,pi=120;function nC(e){var n;const t=(n=e==null?void 0:e.current)==null?void 0:n.clientHeight;return t&&t>0?Math.max(pi,Math.floor(t*.35)):ua}function rC(e){var n;const t=(n=e==null?void 0:e.current)==null?void 0:n.clientHeight;return t&&t>0?Math.max(pi,Math.floor(t*.85)):typeof window>"u"?560:Math.max(pi,Math.floor(window.innerHeight*.7))}function sC(e,t){return Math.min(rC(t),Math.max(pi,e))}function iC({containerRef:e,isOpen:t=!1}={}){const[n,r]=C.useState(ua),[s,i]=C.useState(!1),o=C.useRef(ua);C.useEffect(()=>{o.current=n},[n]);const a=C.useCallback(d=>{r(sC(d,e))},[e]);C.useEffect(()=>{if(!t)return;const d=Math.max(o.current,nC(e));a(d)},[e,t,a]);const l=C.useCallback(d=>{const f=d,u=o.current;i(!0);const g=y=>{const m=f-y.clientY;a(u+m)},p=()=>{i(!1),document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",p),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",g),document.addEventListener("mouseup",p),document.body.style.cursor="row-resize",document.body.style.userSelect="none"},[a]);return C.useEffect(()=>{const d=()=>{a(o.current)};return window.addEventListener("resize",d),()=>{window.removeEventListener("resize",d),document.body.style.cursor="",document.body.style.userSelect=""}},[a]),{height:n,isResizing:s,onResizeStart:l}}function mp({children:e}){const[t]=C.useState(()=>new OS({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}}));return c.jsx(NS,{client:t,children:e})}function pp({containerRef:e,onCreateNewOrder:t}){const[n,r]=C.useState(!1),{height:s,isResizing:i,onResizeStart:o}=iC({containerRef:e,isOpen:n}),a=pe(y=>y.selectedLogin),l=pe(y=>y.orders),d=pe(y=>y.positions),f=C.useMemo(()=>a?l.filter(y=>y.login===a):l,[a,l]),u=C.useMemo(()=>a?d.filter(y=>y.login===a):d,[a,d]),g=f.length+u.length,p=()=>{r(!1),t==null||t()};return c.jsxs("div",{className:"web-trading-widget-news-orders-overlay-root",children:[c.jsxs("button",{type:"button",className:"web-trading-widget-news-orders-overlay__trigger","aria-label":"Open terminal","aria-expanded":n,onClick:()=>r(!0),children:[c.jsx(Fv,{className:"web-trading-widget-icon web-trading-widget-icon--sm"}),c.jsx("span",{children:"Orders"}),g>0?c.jsx("span",{className:"web-trading-widget-news-orders-overlay__badge",children:g}):null]}),n?c.jsx(c.Fragment,{children:c.jsxs("div",{className:"web-trading-widget-news-orders__panel",style:{height:s},children:[i?c.jsx("div",{className:"web-trading-widget-terminal-resize-overlay","aria-hidden":!0}):null,c.jsx("div",{className:"web-trading-widget-news-orders__panel-resize-bar-wrap",children:c.jsx("div",{role:"separator","aria-orientation":"horizontal","aria-label":"Resize terminal panel","aria-valuenow":s,className:"web-trading-widget-terminal__resize-bar",onMouseDown:y=>{y.preventDefault(),o(y.clientY)},children:c.jsx(Gf,{className:"web-trading-widget-icon web-trading-widget-icon--sm web-trading-widget-terminal__resize-icon"})})}),c.jsxs("div",{className:"web-trading-widget-news-orders__panel-header",children:[c.jsx("h2",{className:"web-trading-widget-news-orders__panel-title",children:"Terminal"}),c.jsx("button",{type:"button",className:"web-trading-widget-news-orders__panel-close","aria-label":"Close terminal panel",onClick:()=>r(!1),children:c.jsx(gn,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})]}),c.jsx("div",{className:"web-trading-widget-news-orders__panel-body",children:c.jsx(fp,{embedded:!0,onCreateNewOrder:t?p:void 0})})]})}):null]})}function oC({baseUrl:e,containerRef:t,onCreateNewOrder:n}){return c.jsx(mp,{children:c.jsx(Im,{baseUrl:e,children:c.jsx(pp,{containerRef:t,onCreateNewOrder:n})})})}const Rn=C.forwardRef(({className:e,type:t,...n},r)=>c.jsx("input",{type:t,className:Te("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-xs placeholder:text-gray-300 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 dark:border-gray-3",e),ref:r,...n}));Rn.displayName="Input";var Gi="Collapsible",[aC,hp]=Bn(Gi),[cC,Oc]=aC(Gi),gp=w.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:s,disabled:i,onOpenChange:o,...a}=e,[l,d]=Ln({prop:r,defaultProp:s??!1,onChange:o,caller:Gi});return c.jsx(cC,{scope:n,disabled:i,contentId:on(),open:l,onOpenToggle:w.useCallback(()=>d(f=>!f),[d]),children:c.jsx(he.div,{"data-state":Rc(l),"data-disabled":i?"":void 0,...a,ref:t})})});gp.displayName=Gi;var yp="CollapsibleTrigger",bp=w.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,s=Oc(yp,n);return c.jsx(he.button,{type:"button","aria-controls":s.open?s.contentId:void 0,"aria-expanded":s.open||!1,"data-state":Rc(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:t,onClick:me(e.onClick,s.onOpenToggle)})});bp.displayName=yp;var Nc="CollapsibleContent",vp=w.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=Oc(Nc,e.__scopeCollapsible);return c.jsx($n,{present:n||s.open,children:({present:i})=>c.jsx(lC,{...r,ref:t,present:i})})});vp.displayName=Nc;var lC=w.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:s,...i}=e,o=Oc(Nc,n),[a,l]=w.useState(r),d=w.useRef(null),f=Oe(t,d),u=w.useRef(0),g=u.current,p=w.useRef(0),y=p.current,m=o.open||a,h=w.useRef(m),b=w.useRef(void 0);return w.useEffect(()=>{const v=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(v)},[]),Ie(()=>{const v=d.current;if(v){b.current=b.current||{transitionDuration:v.style.transitionDuration,animationName:v.style.animationName},v.style.transitionDuration="0s",v.style.animationName="none";const _=v.getBoundingClientRect();u.current=_.height,p.current=_.width,h.current||(v.style.transitionDuration=b.current.transitionDuration,v.style.animationName=b.current.animationName),l(r)}},[o.open,r]),c.jsx(he.div,{"data-state":Rc(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!m,...i,ref:f,style:{"--radix-collapsible-content-height":g?`${g}px`:void 0,"--radix-collapsible-content-width":y?`${y}px`:void 0,...e.style},children:m&&s})});function Rc(e){return e?"open":"closed"}var dC=gp,uC=bp,fC=vp,xt="Accordion",mC=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[Lc,pC,hC]=Fa(xt),[Zi]=Bn(xt,[hC,hp]),Dc=hp(),wp=w.forwardRef((e,t)=>{const{type:n,...r}=e,s=r,i=r;return c.jsx(Lc.Provider,{scope:e.__scopeAccordion,children:n==="multiple"?c.jsx(vC,{...i,ref:t}):c.jsx(bC,{...s,ref:t})})});wp.displayName=xt;var[_p,gC]=Zi(xt),[xp,yC]=Zi(xt,{collapsible:!1}),bC=w.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},collapsible:i=!1,...o}=e,[a,l]=Ln({prop:n,defaultProp:r??"",onChange:s,caller:xt});return c.jsx(_p,{scope:e.__scopeAccordion,value:w.useMemo(()=>a?[a]:[],[a]),onItemOpen:l,onItemClose:w.useCallback(()=>i&&l(""),[i,l]),children:c.jsx(xp,{scope:e.__scopeAccordion,collapsible:i,children:c.jsx(Sp,{...o,ref:t})})})}),vC=w.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},...i}=e,[o,a]=Ln({prop:n,defaultProp:r??[],onChange:s,caller:xt}),l=w.useCallback(f=>a((u=[])=>[...u,f]),[a]),d=w.useCallback(f=>a((u=[])=>u.filter(g=>g!==f)),[a]);return c.jsx(_p,{scope:e.__scopeAccordion,value:o,onItemOpen:l,onItemClose:d,children:c.jsx(xp,{scope:e.__scopeAccordion,collapsible:!0,children:c.jsx(Sp,{...i,ref:t})})})}),[wC,Yi]=Zi(xt),Sp=w.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:r,dir:s,orientation:i="vertical",...o}=e,a=w.useRef(null),l=Oe(a,t),d=pC(n),u=Yu(s)==="ltr",g=me(e.onKeyDown,p=>{var A;if(!mC.includes(p.key))return;const y=p.target,m=d().filter(D=>{var I;return!((I=D.ref.current)!=null&&I.disabled)}),h=m.findIndex(D=>D.ref.current===y),b=m.length;if(h===-1)return;p.preventDefault();let v=h;const _=0,x=b-1,S=()=>{v=h+1,v>x&&(v=_)},T=()=>{v=h-1,v<_&&(v=x)};switch(p.key){case"Home":v=_;break;case"End":v=x;break;case"ArrowRight":i==="horizontal"&&(u?S():T());break;case"ArrowDown":i==="vertical"&&S();break;case"ArrowLeft":i==="horizontal"&&(u?T():S());break;case"ArrowUp":i==="vertical"&&T();break}const P=v%b;(A=m[P].ref.current)==null||A.focus()});return c.jsx(wC,{scope:n,disabled:r,direction:s,orientation:i,children:c.jsx(Lc.Slot,{scope:n,children:c.jsx(he.div,{...o,"data-orientation":i,ref:l,onKeyDown:r?void 0:g})})})}),hi="AccordionItem",[_C,jc]=Zi(hi),Cp=w.forwardRef((e,t)=>{const{__scopeAccordion:n,value:r,...s}=e,i=Yi(hi,n),o=gC(hi,n),a=Dc(n),l=on(),d=r&&o.value.includes(r)||!1,f=i.disabled||e.disabled;return c.jsx(_C,{scope:n,open:d,disabled:f,triggerId:l,children:c.jsx(dC,{"data-orientation":i.orientation,"data-state":Op(d),...a,...s,ref:t,disabled:f,open:d,onOpenChange:u=>{u?o.onItemOpen(r):o.onItemClose(r)}})})});Cp.displayName=hi;var Tp="AccordionHeader",Ep=w.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=Yi(xt,n),i=jc(Tp,n);return c.jsx(he.h3,{"data-orientation":s.orientation,"data-state":Op(i.open),"data-disabled":i.disabled?"":void 0,...r,ref:t})});Ep.displayName=Tp;var fa="AccordionTrigger",Pp=w.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=Yi(xt,n),i=jc(fa,n),o=yC(fa,n),a=Dc(n);return c.jsx(Lc.ItemSlot,{scope:n,children:c.jsx(uC,{"aria-disabled":i.open&&!o.collapsible||void 0,"data-orientation":s.orientation,id:i.triggerId,...a,...r,ref:t})})});Pp.displayName=fa;var kp="AccordionContent",Ap=w.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=Yi(xt,n),i=jc(kp,n),o=Dc(n);return c.jsx(fC,{role:"region","aria-labelledby":i.triggerId,"data-orientation":s.orientation,...o,...r,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});Ap.displayName=kp;function Op(e){return e?"open":"closed"}var xC=wp,SC=Cp,CC=Ep,Np=Pp,Rp=Ap;const TC=xC,qn=w.forwardRef(({className:e,...t},n)=>c.jsx(SC,{ref:n,className:Te("border-b",e),...t}));qn.displayName="AccordionItem";const Gn=w.forwardRef(({className:e,children:t,...n},r)=>c.jsx(CC,{className:"flex",children:c.jsxs(Np,{ref:r,className:Te("flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...n,children:[t,c.jsx(rc,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"})]})}));Gn.displayName=Np.displayName;const Zn=w.forwardRef(({className:e,children:t,...n},r)=>c.jsx(Rp,{ref:r,className:"overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...n,children:c.jsx("div",{className:Te("pb-4 pt-0",e),children:t})}));Zn.displayName=Rp.displayName;function Cd(e){const t=e.trim().replace(/,/g,"");if(!t||t===".")return null;const n=Number(t);return Number.isFinite(n)?n:null}function Td(e,t){return t<=0?String(Math.round(e)):e.toFixed(t)}function EC(e,t){const n=e.replace(/,/g,"").replace(/[^\d.]/g,""),r=n.indexOf(".");if(r===-1)return n;const s=n.slice(0,r),i=n.slice(r+1).replace(/\./g,""),o=t>0?i.slice(0,t):"";return`${s}.${o}`}function PC(e){const t=e.trim();return!t||t==="."?"":t.endsWith(".")?t.slice(0,-1):t}function De({label:e,value:t,onChange:n,step:r=.01,min:s,decimals:i=2,placeholder:o,basePrice:a,disabled:l=!1,clearable:d=!1}){const[f,u]=C.useState(t),[g,p]=C.useState(!1),y=g?f:t,m=y.trim()!=="",h=!d;C.useEffect(()=>{g||u(t)},[g,t]);const b=()=>a!=null&&Number.isFinite(a)?a:s??0,v=A=>{u(A),n(A)},_=A=>{if(l)return;const D=b(),I=Cd(y),N=y.trim()!=="";let L;!N||I===null?L=A===1?D:D-r:L=I+A*r;const H=s!==void 0?Math.max(s,L):L;if(H<=0)return;const R=Td(H,i);p(!1),v(R)},x=()=>{p(!0),u(t)},S=()=>{p(!1);const A=PC(f);if(!A){f.trim()!==""&&v("");return}const D=Cd(A);if(D===null||D<=0){v("");return}if(h){v(Td(D,i));return}v(A)},T=A=>{u(EC(A,i))},P=()=>{l||(p(!1),v(""))};return c.jsxs("div",{className:"web-trading-widget-stepper",children:[c.jsxs("div",{className:"web-trading-widget-stepper__header",children:[c.jsx("span",{className:"web-trading-widget-stepper__label",children:e}),d&&m?c.jsx("button",{type:"button","aria-label":`Clear ${e}`,className:"web-trading-widget-stepper__clear",disabled:l,onClick:P,children:c.jsx(gn,{className:"web-trading-widget-icon web-trading-widget-icon--xs"})}):null]}),c.jsxs("div",{className:`web-trading-widget-stepper__control${l?" web-trading-widget-stepper__control--disabled":""}`,children:[c.jsx("button",{type:"button","aria-label":`Decrease ${e}`,className:"web-trading-widget-stepper__btn web-trading-widget-stepper__btn--minus",disabled:l||a===null&&y.trim()==="",onClick:()=>_(-1),children:c.jsx(Bv,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})}),c.jsx("input",{type:"text",inputMode:"decimal",pattern:"[0-9]*[.]?[0-9]*",value:y,placeholder:o,disabled:l,onFocus:x,onChange:A=>T(A.target.value),onBlur:S,className:"web-trading-widget-stepper__input"}),c.jsx("button",{type:"button","aria-label":`Increase ${e}`,className:"web-trading-widget-stepper__btn web-trading-widget-stepper__btn--plus",disabled:l||a===null&&y.trim()==="",onClick:()=>_(1),children:c.jsx($v,{className:"web-trading-widget-icon web-trading-widget-icon--sm"})})]})]})}function kC({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,embedded:d=!1,onMinimize:f,onClose:u,onPlaceOrder:g}){const[p,y]=C.useState("market"),[m,h]=C.useState(String(r)),[b,v]=C.useState(""),[_,x]=C.useState(""),S=ie(re=>re.stopLoss),T=ie(re=>re.takeProfit),P=ie(re=>re.setStopLoss),A=ie(re=>re.setTakeProfit),D=ie(re=>re.setVolumeLots),I=ie(re=>re.setOrderSide),[N,L]=C.useState(""),[H,R]=C.useState(gt.GTC),[F,M]=C.useState(""),[$,O]=C.useState(""),U=Number(Vt(Ht(e))),W=Pr(U),j=fc(t,n),ee=t!==null?xe(t,U):"—",J=n!==null?xe(n,U):"—",de=Fi(p),ue=Qf(p),V=Mi(p),K=V.label,se=!de&&V.orderType!==null&&V.orderType%2===1,Ee=C.useMemo(()=>j!==null?j:t??n,[n,t,j]),le=re=>{h(re);const Ve=Number(re);Number.isFinite(Ve)&&Ve>0&&D(Ve)},oe=re=>t===null||n===null?null:de?re==="buy"?n:t:Ue(b)??(re==="buy"?n:t),B=re=>{const Ve=oe(re);Ve!==null&&I({side:re,entryPrice:Ve})},ve=re=>{if(t===null||n===null||!l)return;const Ve=Math.max(i,Number(m)||i),Ji=Vo(p,re),vs=oe(re);vs!==null&&I({side:re,entryPrice:vs}),g({login:l,executionMode:p,side:re,orderType:Ji,volumeLots:Ve,stopLoss:S,takeProfit:T,priceOrder:b,priceTrigger:_,comment:N,typeTime:H,expirationDateTime:F,expirationDay:$,bid:t,ask:n})},ke=t!==null&&n!==null,Pe=de||Ue(b)!==void 0,X=!ue||Ue(_)!==void 0,Ne=de||Bi(H,F,$),Be=!o&&!a&&l!==""&&ke&&Pe&&X&&Ne,Xe=!de&&lc(H),ft=!de&&dc(H);return c.jsxs("div",{className:"web-trading-widget-market-panel",children:[c.jsxs("div",{className:"web-trading-widget-market-panel__header",children:[c.jsxs(si,{value:p,onValueChange:re=>y(re),children:[c.jsx(Kr,{className:"web-trading-widget-market-panel__select-trigger",children:c.jsx(ii,{})}),c.jsx(qr,{children:ai.map(re=>c.jsx(Gr,{value:re.mode,children:re.label},re.mode))})]}),d?null:c.jsxs("div",{className:"web-trading-widget-market-panel__header-actions",children:[c.jsx("button",{type:"button","aria-label":"Minimize to quick order panel",className:"web-trading-widget-market-panel__header-btn",onClick:f,children:c.jsx(Uv,{className:"web-trading-widget-icon web-trading-widget-icon--md"})}),c.jsx("button",{type:"button","aria-label":"Close order panel",className:"web-trading-widget-market-panel__header-btn",onClick:u,children:c.jsx(gn,{className:"web-trading-widget-icon web-trading-widget-icon--md"})})]})]}),c.jsxs(TC,{type:"multiple",defaultValue:["volume-setting","risk-management"],className:"web-trading-widget-market-panel__accordion",children:[c.jsxs(qn,{value:"volume-setting",className:"web-trading-widget-market-panel__accordion-item",children:[c.jsx(Gn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Volume Setting"}),c.jsx(Zn,{className:"web-trading-widget-market-panel__accordion-content",children:c.jsx(De,{label:"Lots",value:m,onChange:le,step:s,min:i,decimals:2})})]}),de?null:c.jsxs(qn,{value:"order-price",className:"web-trading-widget-market-panel__accordion-item",children:[c.jsx(Gn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Order Price"}),c.jsx(Zn,{className:"web-trading-widget-market-panel__accordion-content",children:ue?c.jsxs(c.Fragment,{children:[c.jsx(De,{label:"Stop Price",value:_,onChange:x,step:W,decimals:U,basePrice:Ee,placeholder:j!==null?xe(j,U):"—"}),c.jsx(De,{label:"Limit Price",value:b,onChange:v,step:W,decimals:U,basePrice:Ee,placeholder:j!==null?xe(j,U):"—"})]}):c.jsx(De,{label:"Price",value:b,onChange:v,step:W,decimals:U,basePrice:Ee,placeholder:j!==null?xe(j,U):"—"})})]}),c.jsxs(qn,{value:"risk-management",className:"web-trading-widget-market-panel__accordion-item",children:[c.jsx(Gn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Risk Management"}),c.jsx(Zn,{className:"web-trading-widget-market-panel__accordion-content",children:c.jsxs("div",{className:"web-trading-widget-market-panel__grid-2",children:[c.jsx(De,{label:"Stop Loss",value:S,onChange:P,step:W,decimals:U,basePrice:t,placeholder:t!==null?ee:"—",clearable:!0}),c.jsx(De,{label:"Take Profit",value:T,onChange:A,step:W,decimals:U,basePrice:n,placeholder:n!==null?J:"—",clearable:!0})]})})]}),de?null:c.jsxs(qn,{value:"expiration",className:"web-trading-widget-market-panel__accordion-item",children:[c.jsx(Gn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Expiration"}),c.jsxs(Zn,{className:"web-trading-widget-market-panel__accordion-content",children:[c.jsxs(si,{value:String(H),onValueChange:re=>R(Number(re)),children:[c.jsx(Kr,{className:"web-trading-widget-market-panel__select-full",children:c.jsx(ii,{})}),c.jsx(qr,{children:Xf.map(re=>c.jsx(Gr,{value:String(re.value),children:re.label},re.value))})]}),Xe?c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Expiration time"}),c.jsx(Rn,{type:"datetime-local",value:F,onChange:re=>M(re.target.value)})]}):null,ft?c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Expiration day"}),c.jsx(Rn,{type:"date",value:$,onChange:re=>O(re.target.value)})]}):null]})]}),c.jsxs(qn,{value:"comment",className:"web-trading-widget-market-panel__accordion-item",children:[c.jsx(Gn,{className:"web-trading-widget-market-panel__accordion-trigger",children:"Comment"}),c.jsx(Zn,{className:"web-trading-widget-market-panel__accordion-content",children:c.jsx(Rn,{value:N,onChange:re=>L(re.target.value),placeholder:""})})]})]}),c.jsxs("div",{className:"web-trading-widget-market-panel__footer",children:[c.jsxs("div",{className:"web-trading-widget-market-panel__quotes",children:[c.jsx("span",{children:ee}),c.jsx("span",{className:"web-trading-widget-market-panel__quotes-ask",children:J})]}),de?c.jsxs("div",{className:"web-trading-widget-market-panel__actions",children:[c.jsx(ct,{type:"button",variant:"destructive",className:"web-trading-widget-market-panel__sell-btn",disabled:!Be,onMouseDown:()=>B("sell"),onClick:()=>ve("sell"),children:"Sell by Market"}),c.jsx(ct,{type:"button",className:"web-trading-widget-market-panel__buy-btn",disabled:!Be,onMouseDown:()=>B("buy"),onClick:()=>ve("buy"),children:"Buy by Market"})]}):c.jsxs(ct,{type:"button",variant:se?"destructive":"default",className:`web-trading-widget-market-panel__place-btn${se?"":" web-trading-widget-market-panel__place-btn--buy"}`,disabled:!Be,onMouseDown:()=>{const re=V.orderType!==null&&V.orderType%2===1?"sell":"buy";B(re)},onClick:()=>{const re=V.orderType!==null&&V.orderType%2===1?"sell":"buy";ve(re)},children:["Place ",K]})]})]})}function Lp({confirmation:e,symbolTicker:t,onDismiss:n}){const r=Number(Vt(Ht(t))),s=xe(e.price,r),i=e.side==="sell"?"sell":"buy",o=Ii(e.symbol||Ui(t));return c.jsxs("div",{className:"web-trading-widget-confirmation",children:[c.jsx("div",{className:"web-trading-widget-confirmation__close-row",children:c.jsx("button",{type:"button","aria-label":"Close confirmation",className:"web-trading-widget-confirmation__close-btn",onClick:n,children:c.jsx(gn,{className:"web-trading-widget-icon web-trading-widget-icon--md"})})}),c.jsxs("div",{className:"web-trading-widget-confirmation__body",children:[c.jsxs("p",{className:"web-trading-widget-confirmation__summary",children:[c.jsxs("span",{className:"web-trading-widget-confirmation__ticket",children:["#",e.ticket]})," ",c.jsx("span",{className:`web-trading-widget-confirmation__side web-trading-widget-confirmation__side--${e.side}`,children:i})," ",e.volumeLots.toFixed(2)," ",o]}),c.jsxs("p",{className:"web-trading-widget-confirmation__price",children:["at ",s]}),c.jsx("p",{className:"web-trading-widget-confirmation__status",children:"Placed"}),c.jsx(ct,{type:"button",className:"web-trading-widget-confirmation__ok-btn",onClick:n,children:"OK"})]})]})}function Is(e,t){return e.toLocaleString(void 0,{minimumFractionDigits:t,maximumFractionDigits:t})}function $r(e){if(!(e===void 0||e===0))return e}function Ed(e,t){return e===void 0||e===0?"":xe(e,t)}function Pd(e,t){const n=Ue(e);if(n!==void 0)return n;if($r(t)!==void 0)return 0}function Dp({order:e,onClose:t}){const{deleteOrder:n,modifyOrder:r}=qi(),s=pe(V=>V.removeOrder),i=pe(V=>V.liveQuotes),[o,a]=C.useState(String(e.volumeLots)),[l,d]=C.useState(String(e.orderPrice)),[f,u]=C.useState(e.priceTrigger!==void 0?String(e.priceTrigger):""),g=ie(V=>V.stopLoss),p=ie(V=>V.takeProfit),y=ie(V=>V.setStopLoss),m=ie(V=>V.setTakeProfit),h=ie(V=>V.setDraft),b=ie(V=>V.clearDraft),[v,_]=C.useState(e.comment),[x,S]=C.useState(!1),[T,P]=C.useState(!1),A=Pr(e.digits),D=Ke(e.symbol).toUpperCase(),I=i[D],N=(I==null?void 0:I.bid)??e.marketBid??null,L=(I==null?void 0:I.ask)??e.marketAsk??null,H=N!==null?xe(N,e.digits):"—",R=L!==null?xe(L,e.digits):"—",F=C.useMemo(()=>e.orderPrice>0?e.orderPrice:fc(N,L)??N??L,[L,N,e.orderPrice]);C.useEffect(()=>(h({source:"order",entryPrice:e.orderPrice,stopLoss:Ed(e.stopLoss,e.digits),takeProfit:Ed(e.takeProfit,e.digits),side:e.side,showEntryLine:!0,volumeLots:e.volumeLots,digits:e.digits,priceStep:A}),()=>{b()}),[b,e.digits,e.orderPrice,e.side,e.stopLoss,e.takeProfit,e.volumeLots,A,h]);const M=cc(e.orderType),$=e.volumeLots,O=Number(l)||e.orderPrice,U=Ue(f),W=x||T,ee=(O!==e.orderPrice||(M?U!==e.priceTrigger:!1)||$r(Ue(g))!==$r(e.stopLoss)||$r(Ue(p))!==$r(e.takeProfit)||v.trim()!==e.comment.trim())&&(!M||U!==void 0&&Number.isFinite(O)&&O>0),J=C.useMemo(()=>`Delete #${e.ticket} ${e.typeLabel} ${$.toFixed(2)} ${e.displaySymbol} at ${Is(O,e.digits)}`,[e,O,$]),de=async()=>{if(!ee){Se({variant:"destructive",description:M?"Please set both stop and limit prices.":"Please set an order price."});return}S(!0);try{const V=await r(e,{volumeLots:$,priceOrder:O,priceTrigger:M?U:void 0,stopLoss:Pd(g,e.stopLoss),takeProfit:Pd(p,e.takeProfit),comment:v.trim()||"order modify"});if(!V.success){Se({variant:"destructive",description:V.message||"Failed to modify order."});return}t(),Se({description:`Order #${e.ticket} updated.`})}catch(V){const K=V instanceof Error?V.message:"Failed to modify order.";Se({variant:"destructive",description:K})}finally{S(!1)}},ue=async()=>{P(!0);try{const V=await n(e);if(!V.success){Se({variant:"destructive",description:V.message||"Failed to delete order."});return}s(e.ticket),t(),Se({description:`Order #${e.ticket} deleted.`})}catch(V){const K=V instanceof Error?V.message:"Failed to delete order.";Se({variant:"destructive",description:K})}finally{P(!1)}};return c.jsxs("div",{className:"web-trading-widget-detail-panel",children:[c.jsxs("div",{className:"web-trading-widget-detail-panel__header",children:[c.jsxs("p",{className:`web-trading-widget-detail-panel__title web-trading-widget-detail-panel__title--${e.side}`,children:["#",e.ticket," ",e.typeLabel," ",$.toFixed(2)," / ",e.volumeFilledLots.toFixed(2)," ",e.displaySymbol," ",M&&U!==void 0?`${Is(U,e.digits)} / ${Is(O,e.digits)}`:Is(O,e.digits)]}),c.jsx("button",{type:"button","aria-label":"Close order panel",className:"web-trading-widget-icon-btn",onClick:t,children:c.jsx(gn,{className:"web-trading-widget-icon web-trading-widget-icon--md"})})]}),c.jsxs("div",{className:"web-trading-widget-detail-panel__body",children:[c.jsx(De,{label:"Lots",value:o,onChange:a,step:.01,min:.01,decimals:2,disabled:!0}),M?c.jsxs(c.Fragment,{children:[c.jsx(De,{label:"Stop Price",value:f,onChange:u,step:A,decimals:e.digits,basePrice:F}),c.jsx(De,{label:"Limit Price",value:l,onChange:d,step:A,decimals:e.digits,basePrice:F})]}):c.jsx(De,{label:"Price",value:l,onChange:d,step:A,decimals:e.digits,basePrice:F}),c.jsxs("div",{className:"web-trading-widget-market-panel__grid-2",children:[c.jsx(De,{label:"Stop Loss",value:g,onChange:y,step:A,decimals:e.digits,basePrice:N,placeholder:H,clearable:!0}),c.jsx(De,{label:"Take Profit",value:p,onChange:m,step:A,decimals:e.digits,basePrice:L,placeholder:R,clearable:!0})]}),c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Comment"}),c.jsx(Rn,{value:v,onChange:V=>_(V.target.value)})]}),c.jsx(ct,{type:"button",variant:"secondary",className:"web-trading-widget-detail-panel__btn-full",disabled:W||!ee,onClick:()=>void de(),children:"Modify"}),c.jsx(ct,{type:"button",className:"web-trading-widget-detail-panel__action-btn",disabled:W,onClick:()=>void ue(),children:J})]})]})}function Ms(e,t){return e.toLocaleString(void 0,{minimumFractionDigits:t,maximumFractionDigits:t})}function Vr(e){if(!(e===void 0||e===0))return e}function kd(e,t){return e===void 0||e===0?"":xe(e,t)}function Ad(e,t){const n=Ue(e);if(n!==void 0)return n;if(Vr(t)!==void 0)return 0}function AC(e,t,n){return e.type==="buy"?t??e.marketBid??e.currentPrice:n??e.marketAsk??e.currentPrice}function jp({position:e,onClose:t}){const{closePosition:n,modifyPosition:r}=qi(),s=pe(O=>O.removePosition),i=pe(O=>O.liveQuotes),[o,a]=C.useState(String(e.volumeLots)),l=ie(O=>O.stopLoss),d=ie(O=>O.takeProfit),f=ie(O=>O.setStopLoss),u=ie(O=>O.setTakeProfit),g=ie(O=>O.setDraft),p=ie(O=>O.clearDraft),[y,m]=C.useState(e.comment),[h,b]=C.useState(!1),[v,_]=C.useState(!1),x=Pr(e.digits),S=Ke(e.symbol).toUpperCase(),T=i[S],P=(T==null?void 0:T.bid)??e.marketBid??null,A=(T==null?void 0:T.ask)??e.marketAsk??null,D=P!==null?xe(P,e.digits):"—",I=A!==null?xe(A,e.digits):"—";C.useEffect(()=>(g({source:"position",entryPrice:e.openPrice,stopLoss:kd(e.stopLoss,e.digits),takeProfit:kd(e.takeProfit,e.digits),side:e.type,showEntryLine:!0,volumeLots:e.volumeLots,digits:e.digits,priceStep:x}),()=>{p()}),[p,e.digits,e.openPrice,e.stopLoss,e.takeProfit,e.type,e.volumeLots,x,g]);const N=AC(e,P,A),L=e.volumeLots,H=h||v,R=Vr(Ue(l))!==Vr(e.stopLoss)||Vr(Ue(d))!==Vr(e.takeProfit)||y.trim()!==e.comment.trim(),F=async()=>{if(R){_(!0);try{const O=await r(e,{stopLoss:Ad(l,e.stopLoss),takeProfit:Ad(d,e.takeProfit),comment:y.trim()});if(!O.success){Se({variant:"destructive",description:O.message||"Failed to modify position."});return}t(),Se({description:`Position #${e.ticket} updated.`})}catch(O){const U=O instanceof Error?O.message:"Failed to modify position.";Se({variant:"destructive",description:U})}finally{_(!1)}}},M=C.useMemo(()=>{const O=e.profit.toFixed(2);return`Close #${e.ticket} ${e.type} ${L.toFixed(2)} ${e.displaySymbol} ${Ms(e.openPrice,e.digits)} at ${Ms(N,e.digits)} with Profit ${O}`},[N,e,L]),$=async()=>{b(!0);try{const O=await n(e);if(!O.success){Se({variant:"destructive",description:O.message||"Failed to close position."});return}s(e.ticket),t(),Se({description:`Position #${e.ticket} closed.`})}catch(O){const U=O instanceof Error?O.message:"Failed to close position.";Se({variant:"destructive",description:U})}finally{b(!1)}};return c.jsxs("div",{className:"web-trading-widget-detail-panel",children:[c.jsxs("div",{className:"web-trading-widget-detail-panel__header",children:[c.jsxs("p",{className:"web-trading-widget-detail-panel__title web-trading-widget-detail-panel__title--position",children:["#",e.ticket," ",e.type," ",L.toFixed(2)," ",e.displaySymbol," ",Ms(e.openPrice,e.digits)]}),c.jsx("button",{type:"button","aria-label":"Close position panel",className:"web-trading-widget-icon-btn",onClick:t,children:c.jsx(gn,{className:"web-trading-widget-icon web-trading-widget-icon--md"})})]}),c.jsxs("div",{className:"web-trading-widget-detail-panel__body",children:[c.jsx(De,{label:"Lots",value:o,onChange:a,step:.01,min:.01,decimals:2,disabled:!0}),c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Price"}),c.jsx(Rn,{readOnly:!0,disabled:!0,value:Ms(e.openPrice,e.digits),className:"web-trading-widget-detail-panel__input-muted"})]}),c.jsxs("div",{className:"web-trading-widget-market-panel__grid-2",children:[c.jsx(De,{label:"Stop Loss",value:l,onChange:f,step:x,decimals:e.digits,basePrice:P,placeholder:D,clearable:!0}),c.jsx(De,{label:"Take Profit",value:d,onChange:u,step:x,decimals:e.digits,basePrice:A,placeholder:I,clearable:!0})]}),c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Comment"}),c.jsx(Rn,{value:y,onChange:O=>m(O.target.value)})]}),c.jsx(ct,{type:"button",variant:"secondary",className:"web-trading-widget-detail-panel__btn-full",disabled:H||!R,onClick:()=>void F(),children:"Modify"}),c.jsx(ct,{type:"button",className:"web-trading-widget-detail-panel__action-btn",disabled:H,onClick:()=>void $(),children:M})]})]})}function Od({symbolTicker:e,orderState:t}){const n=_c(e),{confirmation:r,isSubmitting:s,defaultVolumeLots:i,volumeStep:o,minVolumeLots:a,selectedLogin:l,isAccountsLoading:d,hasConfirmedAccount:f,dismissConfirmation:u,placeMarketOrder:g}=t,p=pe(P=>P.positions),y=pe(P=>P.orders),m=pe(P=>P.selectedPositionTicket),h=pe(P=>P.selectedOrderTicket),b=pe(P=>P.setSelectedPositionTicket),v=pe(P=>P.setSelectedOrderTicket),_=m!==null?p.find(P=>P.ticket===m)??null:null,x=h!==null?y.find(P=>P.ticket===h)??null:null,S=r!==null,T=C.useCallback(P=>{g({symbolTicker:e,login:P.login,executionMode:P.executionMode,side:P.side,orderType:P.orderType,volumeLots:P.volumeLots,stopLoss:P.stopLoss,takeProfit:P.takeProfit,priceOrder:P.priceOrder,priceTrigger:P.priceTrigger,comment:P.comment,typeTime:P.typeTime,expirationDateTime:P.expirationDateTime,expirationDay:P.expirationDay,bid:P.bid,ask:P.ask})},[g,e]);return _!==null?c.jsx(jp,{position:_,onClose:()=>b(null)}):x!==null?c.jsx(Dp,{order:x,onClose:()=>v(null)}):S&&r!==null?c.jsx(Lp,{confirmation:r,symbolTicker:e,onDismiss:u}):f?c.jsx(kC,{embedded:!0,symbolTicker:e,bid:(n==null?void 0:n.bid)??null,ask:(n==null?void 0:n.ask)??null,defaultVolumeLots:i,volumeStep:o,minVolumeLots:a,isSubmitting:s,isAccountsLoading:d,selectedLogin:l,onPlaceOrder:T}):c.jsx("div",{className:"web-trading-widget-side-panel__empty",children:"Select a trading account to start placing orders."})}function Nd({label:e,isActive:t,onClick:n}){return c.jsx("button",{type:"button",role:"tab","aria-selected":t,className:`web-trading-widget-side-panel__tab${t?" web-trading-widget-side-panel__tab--active":""}`,onClick:n,children:e})}function OC({symbolTicker:e,orderState:t,scanResultUrl:n,onScanResultLoad:r,initialTab:s="trade",activeTab:i,onTabChange:o}){const a=!!n,[l,d]=C.useState(s),f=i!==void 0,u=f?i:l,g=C.useCallback(p=>{f?o==null||o(p):d(p)},[f,o]);return c.jsx("aside",{className:`web-trading-widget-side-panel${a?" web-trading-widget-side-panel--with-scan":""}`,children:a?c.jsxs("div",{className:"web-trading-widget-side-panel__scan-layout",children:[c.jsxs("div",{role:"tablist","aria-label":"Chart side panel",className:"web-trading-widget-side-panel__tablist",children:[c.jsx(Nd,{label:"Trade",isActive:u==="trade",onClick:()=>g("trade")}),c.jsx(Nd,{label:"Scan Result",isActive:u==="scan",onClick:()=>g("scan")})]}),c.jsxs("div",{className:"web-trading-widget-side-panel__panels",children:[c.jsx("div",{role:"tabpanel",hidden:u!=="trade",className:"web-trading-widget-side-panel__tabpanel",children:c.jsx(Od,{symbolTicker:e,orderState:t})}),c.jsx("div",{role:"tabpanel",hidden:u!=="scan",className:"web-trading-widget-side-panel__tabpanel web-trading-widget-side-panel__tabpanel--scan",children:c.jsx("iframe",{src:n??void 0,title:"Scan result",className:"web-trading-widget-side-panel__iframe",onLoad:r},n)})]})]}):c.jsx("div",{className:"web-trading-widget-side-panel__scroll",children:c.jsx(Od,{symbolTicker:e,orderState:t})})})}const NC=.01,RC=.01,Rd=.01;function LC({symbols:e,defaultPanelAfterConfirm:t="mini"}){const[n,r]=C.useState("closed"),[s,i]=C.useState(null),[o,a]=C.useState(!1),[l,d]=C.useState("pending"),[f,u]=C.useState(null),g=pe(N=>N.setSelectedLogin),{accounts:p,isLoading:y}=ap(),{submitOrder:m}=qi(),h=C.useMemo(()=>Qv(p),[p]),b=C.useMemo(()=>Jv(p,f),[p,f]),v=l==="confirmed",_=l==="needs-selection";C.useEffect(()=>{if(y)return;if(l==="confirmed"){f&&!h.some(L=>L.login===f)&&d("needs-selection");return}if(l==="needs-selection")return;const N=Xv();if(N&&h.some(L=>L.login===N)){u(N),d("confirmed"),r(t);return}d("needs-selection")},[l,h,t,y,f]),C.useEffect(()=>{b&&g(b)},[b,g]);const x=C.useCallback(N=>{u(N),g(N),Sl(N)},[g]),S=C.useCallback(N=>{N&&(Sl(N),x(N),d("confirmed"),i(null),r(t))},[t,x]),T=C.useCallback(()=>{i(null),r("market")},[]),P=C.useCallback(()=>{i(null),r("mini")},[]),A=C.useCallback(()=>{i(null),r("mini")},[]),D=C.useCallback(()=>{i(null),r("mini")},[]),I=C.useCallback(async N=>{const L=ie.getState().clearEntryLinePreview,H=N.login.trim();if(!H){L(),Se({variant:"destructive",description:"Please select a trading account."});return}const R=Math.max(Rd,N.volumeLots),F=Ui(N.symbolTicker,e);Number(Vt(Ht(N.symbolTicker,e)));const M=Fi(N.executionMode),$=cc(N.orderType),O=Ue(N.priceOrder),U=Ue(N.priceTrigger);if(!M&&O===void 0){L(),Se({variant:"destructive",description:$?"Please set a limit price for this order.":"Please set an order price for pending orders."});return}if($&&U===void 0){L(),Se({variant:"destructive",description:"Please set a stop price for stop limit orders."});return}if(!M&&!Bi(N.typeTime,N.expirationDateTime,N.expirationDay)){L(),Se({variant:"destructive",description:"Please set an expiration date for this order."});return}const W=M?N.side==="buy"?N.ask:N.bid:O??(N.side==="buy"?N.ask:N.bid);a(!0);try{const j=await m({login:H,symbolTicker:N.symbolTicker,executionMode:N.executionMode,side:ci(N.orderType),orderType:N.orderType,volumeLots:R,stopLoss:Ue(N.stopLoss),takeProfit:Ue(N.takeProfit),priceOrder:ac(N.orderType)?O:void 0,priceTrigger:$?U:void 0,comment:N.comment.trim(),typeTime:N.typeTime,expirationDateTime:N.expirationDateTime,expirationDay:N.expirationDay,bid:N.bid,ask:N.ask});if(!j.success){L(),Se({variant:"destructive",description:j.message||"Order was not accepted."});return}i({ticket:j.ticket??"",side:j.side??ci(N.orderType),volumeLots:j.volumeLots??R,symbol:j.displaySymbol??F,price:j.price??W}),r("confirmation")}catch(j){L();const ee=j instanceof Error?j.message:"Failed to place order.";Se({variant:"destructive",description:ee})}finally{a(!1)}},[m,e]);return{panel:n,confirmation:s,isSubmitting:o,defaultVolumeLots:NC,volumeStep:RC,minVolumeLots:Rd,accountOptions:h,selectedLogin:b,setSelectedLogin:x,isAccountsLoading:y,hasConfirmedAccount:v,needsAccountSelection:_,confirmAccountSelection:S,openMarketPanel:T,openMiniPanel:P,closePanels:A,dismissConfirmation:D,placeMarketOrder:I}}function gi(e){var t;if(typeof window<"u"){const n=localStorage.getItem(Qn);if(n&&e.some(r=>r.ticker===n))return n}return((t=e[0])==null?void 0:t.ticker)??"XAU_USD"}function ma(e,t,n){var r;return((r=t.find(s=>s.display_name===e||s.ticker===e))==null?void 0:r.ticker)??n}function DC({chartWidget:e,symbols:t,chartSlotElement:n,onSymbolTickerChange:r,onScanResultUrlChange:s,selectSymbolTickerRef:i}){const o=C.useMemo(()=>gi(t),[t]),a=C.useRef(o),l=C.useRef(e),[d,f]=C.useState(null);C.useEffect(()=>{l.current=e},[e]),C.useEffect(()=>{if(!n){f(null);return}const g=()=>{const y=n.querySelector(":scope > div");f(y)};g();const p=new MutationObserver(g);return p.observe(n,{childList:!0}),()=>{p.disconnect()}},[n]);const u=C.useCallback(g=>{if(g===a.current)return;const p=t.find(m=>m.ticker===g);if(!p)return;a.current=g,localStorage.setItem(Qn,g),r(g),s(null);const y=l.current;if(y)try{y.onChartReady(()=>{y.activeChart().setSymbol(p.ticker)})}catch{}},[s,r,t]);return C.useEffect(()=>(i.current=u,()=>{i.current=null}),[u,i]),C.useEffect(()=>{if(!e)return;let g=!1,p=null;try{e.onChartReady(()=>{if(g)return;let y;try{y=e.activeChart()}catch{return}const m=v=>{const _=y.symbol(),x=ma(_,t,o);x!==a.current&&s(null);try{e.resetCache()}catch{}a.current=x,localStorage.setItem(Qn,x),r(x)},h=y.symbol(),b=ma(h,t,o);b!==a.current&&(a.current=b,localStorage.setItem(Qn,b),r(b)),y.onSymbolChanged().subscribe(null,m),p=()=>{try{y.onSymbolChanged().unsubscribe(null,m)}catch{}}})}catch{}return()=>{g=!0,p==null||p()}},[e,s,r,o,t]),{chartContainer:d}}const jC=Pa("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function IC({className:e,variant:t,...n}){return c.jsx("div",{className:Te(jC({variant:t}),e),...n})}function Ip(){var t;const e=(t=window.TradingView)==null?void 0:t.widget;return typeof e=="function"?e:null}function Ys(){return Ip()!==null}const Ld="/charting_library/charting_library.js";function MC({onLoad:e}){return C.useEffect(()=>{if(Ys()){e();return}const t=document.querySelector(`script[src="${Ld}"]`);if(t){const r=()=>{Ys()&&e()};return t.addEventListener("load",r),()=>t.removeEventListener("load",r)}const n=document.createElement("script");return n.src=Ld,n.async=!1,n.onload=()=>{Ys()&&e()},n.onerror=()=>{console.error("Failed to load TradingView charting library")},document.head.appendChild(n),()=>{n.onload=null,n.onerror=null}},[e]),null}const Dd=$i(e=>({playEndTimestamp:null,setPlayEndTimestamp:t=>e({playEndTimestamp:t})})),Mp=$i(e=>({newsSelectedCandles:null,newsPlayEndTimestamp:null,gapCount:0,isReplayMode:!1,setNewsSelectedCandles:t=>e({newsSelectedCandles:t}),setNewsPlayEndTimestamp:t=>e({newsPlayEndTimestamp:t}),setGapCount:t=>e({gapCount:t}),setReplayMode:t=>e({isReplayMode:t})})),pa=8,Fp=4,ha=5,ga=e=>e==="1"?60:e==="5"?300:e==="1D"?1440*3600:parseInt(e,10)*60,FC=e=>{const t=new Date(e+pa*60*60*1e3),n=t.getUTCDay(),r=t.getUTCHours();return n===0?!1:n===1?r>=ha:n===6?r<=Fp:!0},UC=e=>{const t=new Date(e+pa*60*60*1e3),n=t.getUTCDay(),r=t.getUTCHours();if(n===0||n===1&&r<ha||n===6&&r>=Fp){const s=(8-n)%7;return t.setUTCDate(t.getUTCDate()+s),t.setUTCHours(ha,0,0,0),t.getTime()-pa*60*60*1e3}return e},BC=(e,t,n)=>{const r=ga(t)*1e3,s=[];let i=e;for(let o=0;o<n;o++)i+=r,FC(i)||(i=UC(i)),s.push(i);return s},$C=(e,t,n,r)=>{if(n<=0)return[];if(r==="24x7"){const i=ga(t)*1e3;return Array.from({length:n},(o,a)=>e+(a+1)*i)}if(r==="1700-1700")return BC(e,t,n);const s=ga(t)*1e3;return Array.from({length:n},(i,o)=>e+(o+1)*s)},VC=(e,t)=>{if(t==="1D"||t==="D"||t==="1440"){const n=new Date(e*1e3);return n.setUTCHours(0,0,0,0),n.getTime()}return e.toString().length>11?e:e*1e3},jd="wss://symbols.opheleo.com";function HC(e){return{1:6e4,5:3e5,15:9e5,30:18e5,60:36e5,240:144e5}[e]??6e4}function Id(e){return e.trim().toUpperCase()}function zC(e,t){return Math.floor(e/t)*t}let Ir;async function WC(e){const t=new URLSearchParams({symbol:e.symbol,timeframe:e.timeframe,...e.endTimestamp&&{endTimestamp:e.endTimestamp.toString()}});return e.last_evaluated_key&&t.append("last_evaluated_key",e.last_evaluated_key),Re({baseURL:"https://corprate-widget.iccandle.ai",url:`/chart/endTimestamp?${t.toString()}`,method:"GET"})}class KC{constructor(t,n,r=Bt,s=jd){it(this,"futureBarsRef");it(this,"type");it(this,"symbols");it(this,"tickWebSocketUrl");it(this,"configuration",{supported_resolutions:["1","5","15","30","60"],supports_marks:!1,supports_timescale_marks:!0,supports_time:!1});it(this,"ws",null);it(this,"isWsConnecting",!1);it(this,"wsSelectedSymbol",null);it(this,"subscriptions",new Map);it(this,"lastBarsCache",new Map);it(this,"pushFutureBar",t=>{for(const[,n]of this.subscriptions.entries())return n.onTick(t),!0;return!1});this.futureBarsRef=t,this.type=n,this.symbols=r,this.tickWebSocketUrl=s||jd}onReady(t){setTimeout(()=>t(this.configuration),0)}resolveSymbol(t,n,r){const s=this.symbols.find(o=>o.ticker===t),i=this.symbols.find(o=>o.display_name===t);try{setTimeout(()=>{const o={name:(s==null?void 0:s.display_name)||(i==null?void 0:i.display_name)||localStorage.getItem("tv:latest-symbol")||"XAU_USD",timezone:"America/New_York",minmov:1,session:(s==null?void 0:s.session)||(i==null?void 0:i.session)||"24x7",has_intraday:!0,visible_plots_set:"ohlc",library_custom_fields:{ticker:(s==null?void 0:s.ticker)||(i==null?void 0:i.ticker)||localStorage.getItem("tv:latest-symbol")||"XAU_USD"},description:(s==null?void 0:s.description)||(i==null?void 0:i.description)||"",type:(s==null?void 0:s.type)||(i==null?void 0:i.type)||"",pricescale:(s==null?void 0:s.pricescale)||(i==null?void 0:i.pricescale)||1e5,ticker:(s==null?void 0:s.display_name)||(i==null?void 0:i.display_name)||localStorage.getItem("tv:latest-symbol")||"XAU_USD",exchange:"FX",format:"price",listed_exchange:"FX",logo_urls:(s==null?void 0:s.logo_urls.map(a=>a.replace("https://cdn.iccandle.ai/web-assets","/images/symbols")))||(i==null?void 0:i.logo_urls.map(a=>a.replace("https://cdn.iccandle.ai/web-assets","/images/symbols")))};n(o)},0)}catch{r("Symbol not found")}}getBars(t,n,r,s,i){var u;const o=(u=t.library_custom_fields)==null?void 0:u.ticker,a=this.symbols.find(g=>o!==void 0&&g.ticker===o||g.ticker===t.ticker||g.display_name===t.name||g.display_name===t.ticker),l={symbol:(a==null?void 0:a.ticker)||"",timeframe:n};if(r.firstDataRequest&&(Ir=void 0),!r.firstDataRequest)if(Ir)l.last_evaluated_key=Ir;else{s([],{noData:!0});return}const f=Dd.getState().playEndTimestamp;f&&(l.endTimestamp=f,Dd.getState().setPlayEndTimestamp(null),Ir=void 0),(async()=>{var g;try{const{data:p}=await WC(l);if(p.data_status==="threshold_limited"){s([],{noData:!0});return}if(p.data_status==="end_of_data"){s([],{noData:!0});return}if(!((g=p.items)!=null&&g.length)){s([],{noData:!0});return}Ir=p.last_evaluated_key;const m=[...p.items].map(_=>({open:_.o,high:_.h,low:_.l,close:_.c,time:VC(_.timestamp,n)})),h=Mp.getState(),{gapCount:b,isReplayMode:v}=h;if(v&&event){const _=$C(m[m.length-1].time,n,b||0,t.session);if(_.length>0){const x=m[m.length-1].close;for(const S of _)m.push({open:x,high:x,low:x,close:x,time:S})}}s(m)}catch(p){i(p),s([],{noData:!0})}})()}searchSymbols(t,n,r,s){if(r==="all"||r===""){const i=this.symbols.filter(o=>{var a;return(a=o.display_name)==null?void 0:a.toUpperCase().includes(t.toUpperCase())}).map(o=>({...o,symbol:o.display_name,exchange:"FX",logo_urls:o.logo_urls.map(a=>a.replace("https://cdn.iccandle.ai/web-assets","/images/symbols"))}));s(i)}else{const i=this.symbols.filter(o=>{var a;return((a=o.display_name)==null?void 0:a.toUpperCase().includes(t.toUpperCase()))&&o.type.includes(r)}).map(o=>({...o,symbol:o.display_name,exchange:"FX",logo_urls:o.logo_urls.map(a=>a.replace("https://cdn.iccandle.ai/web-assets","/images/symbols"))}));s(i)}}subscribeBars(t,n,r,s,i){var u;const o=(u=t.library_custom_fields)==null?void 0:u.ticker,a=this.symbols.find(g=>o!==void 0&&g.ticker===o||g.display_name===t.ticker||g.display_name===t.name),l=a!=null&&a.resolve_symbol?Id(a.resolve_symbol):Id(t.ticker||t.name||""),d=HC(n),f=`${l}|${n}`;this.subscriptions.set(s,{symbol:l,resolution:n,periodMs:d,onTick:r,onResetCacheNeededCallback:i,liveCandle:this.lastBarsCache.get(f)??null}),this.ensureWebSocket(l)}unsubscribeBars(t){this.subscriptions.delete(t),this.subscriptions.size===0&&this.ws&&(this.ws.close(1e3,"No more subscriptions"),this.ws=null)}ensureWebSocket(t){var s;const n=t??((s=this.subscriptions.values().next().value)==null?void 0:s.symbol);if(this.ws&&this.ws.readyState===WebSocket.OPEN&&this.wsSelectedSymbol===n||(this.ws&&this.wsSelectedSymbol!==n&&(this.ws.close(1e3,"Symbol change"),this.ws=null,this.wsSelectedSymbol=null),this.isWsConnecting))return;this.isWsConnecting=!0;const r=new WebSocket(this.tickWebSocketUrl);this.ws=r,this.wsSelectedSymbol=n??null,r.onopen=()=>{this.isWsConnecting=!1,n&&r.send(JSON.stringify({action:"select_symbol",symbol:n}))},r.onmessage=i=>this.handleMessage(i),r.onerror=()=>{this.isWsConnecting=!1},r.onclose=()=>{this.ws=null,this.wsSelectedSymbol=null,this.isWsConnecting=!1,this.subscriptions.size>0&&setTimeout(()=>this.ensureWebSocket(),3e3)}}handleMessage(t){try{const n=JSON.parse(t.data);this.processTick(n)}catch{}}processTick(t){const n=t.symbol,r=Number(t.updatedAtMs),s=(Number(t.bid)+Number(t.ask))/2;if(!(!Number.isFinite(r)||!Number.isFinite(s)))for(const[i,o]of this.subscriptions.entries()){if(o.symbol!==n)continue;const a=`${o.symbol}|${o.resolution}`,l=zC(r,o.periodMs);let d=o.liveCandle;d?l>d.time?d={time:l,open:s,high:s,low:s,close:s,volume:0}:d={...d,high:Math.max(d.high,s),low:Math.min(d.low,s),close:s}:d={time:l,open:s,high:s,low:s,close:s,volume:0},o.liveCandle=d,this.lastBarsCache.set(a,d),this.subscriptions.set(i,o),(u=>{var g,p;(p=(g=this.futureBarsRef)==null?void 0:g.current)!=null&&p.length||o.onTick(u)})(d)}}extractErrorMessage(t){if(t instanceof Error)return t.message;if(typeof t=="string")return t;try{return JSON.stringify(t)}catch{return String(t)}}getTimescaleMarks(t,n,r,s){const i=[];if(this.type&&this.type=="selector")try{const o=JSON.parse(localStorage.getItem("tv:selected-news-events")||"[]");o==null||o.forEach(({id:a,timestamp:l,event_name:d,currency:f})=>{!a||!Number.isFinite(l)||l<=0||i.some(u=>String(u.id)===String(a))||i.push({id:a,time:l/1e3,color:"green",label:d.slice(0,1)||"N",tooltip:[d],...f?{imageUrl:`/images/symbols/${f}.svg`}:{},showLabelWhenImageLoaded:!0})})}catch{}if(this.type&&this.type=="news")try{const o=JSON.parse(localStorage.getItem("iccandle:current-news-event")||"{}"),{id:a,timestamp:l,event_name:d,currency:f,forecast:u,previous:g,actual:p}=o;if(!a||!Number.isFinite(l)||l<=0||i.some(m=>String(m.id)==="news:"+a))return;i.push({id:"news:"+a,time:l/1e3,color:"green",label:d.slice(0,1),tooltip:[d,`Current Forecast: ${u||"-"}`,`Previous Forecast: ${g||"-"}`,`Previous Actual: ${p||"-"}`],...f?{imageUrl:`https://cdn.iccandle.ai/web-assets/${f??"USD"}.svg`}:{}})}catch{}s(i)}}const qC=e=>{const t={name:"Generated Candles - By iC Candle",metainfo:{_metainfoVersion:51,id:"Generated Candles - By iC Candle@tv-basicstudies-1",description:"Generated Candles - By iC Candle",shortDescription:"Generated Candles",isCustomIndicator:!0,is_hidden_study:!1,is_price_study:!0,linkedToSeries:!0,format:{type:"price",precision:2},inputs:[],palettes:{palette_bar:{colors:{0:{name:"Bullish"},1:{name:"Bearish"}},valToIndex:{0:0,1:1}},palette_wick:{colors:{0:{name:"Bullish Wick"},1:{name:"Bearish Wick"}},valToIndex:{0:0,1:1}},palette_border:{colors:{0:{name:"Bullish Border"},1:{name:"Bearish Border"}},valToIndex:{0:0,1:1}}},plots:[{id:"plot_open",type:"ohlc_open",target:"plot_candle"},{id:"plot_high",type:"ohlc_high",target:"plot_candle"},{id:"plot_low",type:"ohlc_low",target:"plot_candle"},{id:"plot_close",type:"ohlc_close",target:"plot_candle"},{id:"plot_bar_color",type:"ohlc_colorer",palette:"palette_bar",target:"plot_candle"},{id:"plot_wick_color",type:"wick_colorer",palette:"palette_wick",target:"plot_candle"},{id:"plot_border_color",type:"border_colorer",palette:"palette_border",target:"plot_candle"}],ohlcPlots:{plot_candle:{title:"Generated Candles"}},styles:{},defaults:{styles:{},ohlcPlots:{plot_candle:{borderColor:"#000000",color:"#000000",drawBorder:!0,drawWick:!0,plottype:"ohlc_candles",visible:!0,wickColor:"#000000"}},palettes:{palette_bar:{colors:{0:{color:"#00dfb9",width:1,style:0},1:{color:"#ffb84d",width:1,style:0}}},palette_wick:{colors:{0:{color:"#00dfb9",width:1,style:0},1:{color:"#ffb84d",width:1,style:0}}},palette_border:{colors:{0:{color:"#00dfb9",width:1,style:0},1:{color:"#ffb84d",width:1,style:0}}}},precision:2,inputs:{}}},constructor:function(){this.init=function(n){this._context=n},this.main=function(n){this._context=n;const r=n.symbol.time,s=e.current,i=n.symbol.open,o=n.symbol.high,a=n.symbol.low,l=n.symbol.close;if(!Number.isFinite(r)||!s||s.length===0)return[i,o,a,l,Number.NaN,Number.NaN,Number.NaN];if(!s.some(g=>g.time===r))return[i,o,a,l,Number.NaN,Number.NaN,Number.NaN];const u=l<i?1:0;return[i,o,a,l,u,u,u]}}};return Promise.resolve([t])},ya="An unknown error occurred",Qs=e=>{if(typeof e=="string")return e;if(typeof e!="object"||e===null)return ya;if(typeof e.message=="string")return e.message;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const n=Qs(e[t]);if(n)return n}return ya},GC=e=>{var t;if(Lm(e)){const n=(t=e.response)!=null&&t.data?Qs(e.response.data):void 0;return n&&n!==ya?n:Qs(e)}return Qs(e)},ZC=({queryKey:e,queryFn:t,...n})=>Or({queryKey:e,queryFn:async r=>{var s;try{const i=r.queryKey[1];return await t(i)}catch(i){throw Se({variant:"destructive",title:"Error",description:GC(Lm(i)?(s=i.response)==null?void 0:s.data:i)}),null}},...n});var _e;(function(e){e.assertEqual=s=>{};function t(s){}e.assertIs=t;function n(s){throw new Error}e.assertNever=n,e.arrayToEnum=s=>{const i={};for(const o of s)i[o]=o;return i},e.getValidEnumValues=s=>{const i=e.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),o={};for(const a of i)o[a]=s[a];return e.objectValues(o)},e.objectValues=s=>e.objectKeys(s).map(function(i){return s[i]}),e.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const i=[];for(const o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.push(o);return i},e.find=(s,i)=>{for(const o of s)if(i(o))return o},e.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}e.joinValues=r,e.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(_e||(_e={}));var Md;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(Md||(Md={}));const Y=_e.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Yt=e=>{switch(typeof e){case"undefined":return Y.undefined;case"string":return Y.string;case"number":return Number.isNaN(e)?Y.nan:Y.number;case"boolean":return Y.boolean;case"function":return Y.function;case"bigint":return Y.bigint;case"symbol":return Y.symbol;case"object":return Array.isArray(e)?Y.array:e===null?Y.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Y.promise:typeof Map<"u"&&e instanceof Map?Y.map:typeof Set<"u"&&e instanceof Set?Y.set:typeof Date<"u"&&e instanceof Date?Y.date:Y.object;default:return Y.unknown}},z=_e.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Ut extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){const n=t||function(i){return i.message},r={_errors:[]},s=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let a=r,l=0;for(;l<o.path.length;){const d=o.path[l];l===o.path.length-1?(a[d]=a[d]||{_errors:[]},a[d]._errors.push(n(o))):a[d]=a[d]||{_errors:[]},a=a[d],l++}}};return s(this),r}static assert(t){if(!(t instanceof Ut))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,_e.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const s of this.issues)if(s.path.length>0){const i=s.path[0];n[i]=n[i]||[],n[i].push(t(s))}else r.push(t(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Ut.create=e=>new Ut(e);const ba=(e,t)=>{let n;switch(e.code){case z.invalid_type:e.received===Y.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case z.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,_e.jsonStringifyReplacer)}`;break;case z.unrecognized_keys:n=`Unrecognized key(s) in object: ${_e.joinValues(e.keys,", ")}`;break;case z.invalid_union:n="Invalid input";break;case z.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${_e.joinValues(e.options)}`;break;case z.invalid_enum_value:n=`Invalid enum value. Expected ${_e.joinValues(e.options)}, received '${e.received}'`;break;case z.invalid_arguments:n="Invalid function arguments";break;case z.invalid_return_type:n="Invalid function return type";break;case z.invalid_date:n="Invalid date";break;case z.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:_e.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case z.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case z.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case z.custom:n="Invalid input";break;case z.invalid_intersection_types:n="Intersection results could not be merged";break;case z.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case z.not_finite:n="Number must be finite";break;default:n=t.defaultError,_e.assertNever(e)}return{message:n}};let YC=ba;function QC(){return YC}const XC=e=>{const{data:t,path:n,errorMaps:r,issueData:s}=e,i=[...n,...s.path||[]],o={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let a="";const l=r.filter(d=>!!d).slice().reverse();for(const d of l)a=d(o,{data:t,defaultError:a}).message;return{...s,path:i,message:a}};function G(e,t){const n=QC(),r=XC({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===ba?void 0:ba].filter(s=>!!s)});e.common.issues.push(r)}class st{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const s of n){if(s.status==="aborted")return ae;s.status==="dirty"&&t.dirty(),r.push(s.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const s of n){const i=await s.key,o=await s.value;r.push({key:i,value:o})}return st.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const s of n){const{key:i,value:o}=s;if(i.status==="aborted"||o.status==="aborted")return ae;i.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(r[i.value]=o.value)}return{status:t.value,value:r}}}const ae=Object.freeze({status:"aborted"}),Hr=e=>({status:"dirty",value:e}),ut=e=>({status:"valid",value:e}),Fd=e=>e.status==="aborted",Ud=e=>e.status==="dirty",vr=e=>e.status==="valid",yi=e=>typeof Promise<"u"&&e instanceof Promise;var Q;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(Q||(Q={}));class fn{constructor(t,n,r,s){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Bd=(e,t)=>{if(vr(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Ut(e.common.issues);return this._error=n,this._error}}};function fe(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:s}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:s}:{errorMap:(o,a)=>{const{message:l}=e;return o.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:s}}class we{get description(){return this._def.description}_getType(t){return Yt(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Yt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new st,ctx:{common:t.parent.common,data:t.data,parsedType:Yt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(yi(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Yt(t)},s=this._parseSync({data:t,path:r.path,parent:r});return Bd(r,s)}"~validate"(t){var r,s;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Yt(t)};if(!this["~standard"].async)try{const i=this._parseSync({data:t,path:[],parent:n});return vr(i)?{value:i.value}:{issues:n.common.issues}}catch(i){(s=(r=i==null?void 0:i.message)==null?void 0:r.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(i=>vr(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Yt(t)},s=this._parse({data:t,path:r.path,parent:r}),i=await(yi(s)?s:Promise.resolve(s));return Bd(r,i)}refine(t,n){const r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,i)=>{const o=t(s),a=()=>i.addIssue({code:z.custom,...r(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,s)=>t(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(t){return new xr({schema:this,typeName:ce.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return cn.create(this,this._def)}nullable(){return Sr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Nt.create(this)}promise(){return _i.create(this,this._def)}or(t){return vi.create([this,t],this._def)}and(t){return wi.create(this,t,this._def)}transform(t){return new xr({...fe(this._def),schema:this,typeName:ce.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new _a({...fe(this._def),innerType:this,defaultValue:n,typeName:ce.ZodDefault})}brand(){return new _T({typeName:ce.ZodBranded,type:this,...fe(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new xa({...fe(this._def),innerType:this,catchValue:n,typeName:ce.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Ic.create(this,t)}readonly(){return Sa.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const JC=/^c[^\s-]{8,}$/i,eT=/^[0-9a-z]+$/,tT=/^[0-9A-HJKMNP-TV-Z]{26}$/i,nT=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,rT=/^[a-z0-9_-]{21}$/i,sT=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,iT=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,oT=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,aT="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Po;const cT=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,lT=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,dT=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,uT=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,fT=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,mT=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Up="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",pT=new RegExp(`^${Up}$`);function Bp(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function hT(e){return new RegExp(`^${Bp(e)}$`)}function gT(e){let t=`${Up}T${Bp(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function yT(e,t){return!!((t==="v4"||!t)&&cT.test(e)||(t==="v6"||!t)&&dT.test(e))}function bT(e,t){if(!sT.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||t&&s.alg!==t)}catch{return!1}}function vT(e,t){return!!((t==="v4"||!t)&&lT.test(e)||(t==="v6"||!t)&&uT.test(e))}class sn extends we{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Y.string){const i=this._getOrReturnCtx(t);return G(i,{code:z.invalid_type,expected:Y.string,received:i.parsedType}),ae}const r=new st;let s;for(const i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(s=this._getOrReturnCtx(t,s),G(s,{code:z.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")t.data.length>i.value&&(s=this._getOrReturnCtx(t,s),G(s,{code:z.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const o=t.data.length>i.value,a=t.data.length<i.value;(o||a)&&(s=this._getOrReturnCtx(t,s),o?G(s,{code:z.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&G(s,{code:z.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")oT.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"email",code:z.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")Po||(Po=new RegExp(aT,"u")),Po.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"emoji",code:z.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")nT.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"uuid",code:z.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")rT.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"nanoid",code:z.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")JC.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"cuid",code:z.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")eT.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"cuid2",code:z.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")tT.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"ulid",code:z.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{s=this._getOrReturnCtx(t,s),G(s,{validation:"url",code:z.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"regex",code:z.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(t,s),G(s,{code:z.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(s=this._getOrReturnCtx(t,s),G(s,{code:z.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(s=this._getOrReturnCtx(t,s),G(s,{code:z.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?gT(i).test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{code:z.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?pT.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{code:z.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?hT(i).test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{code:z.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?iT.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"duration",code:z.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?yT(t.data,i.version)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"ip",code:z.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?bT(t.data,i.alg)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"jwt",code:z.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?vT(t.data,i.version)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"cidr",code:z.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?fT.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"base64",code:z.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?mT.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"base64url",code:z.invalid_string,message:i.message}),r.dirty()):_e.assertNever(i);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(s=>t.test(s),{validation:n,code:z.invalid_string,...Q.errToObj(r)})}_addCheck(t){return new sn({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Q.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Q.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Q.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Q.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Q.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Q.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Q.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Q.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Q.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...Q.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...Q.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Q.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...Q.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,...Q.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...Q.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...Q.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...Q.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...Q.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...Q.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...Q.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...Q.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...Q.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...Q.errToObj(n)})}nonempty(t){return this.min(1,Q.errToObj(t))}trim(){return new sn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new sn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new sn({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}sn.create=e=>new sn({checks:[],typeName:ce.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...fe(e)});function wT(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,s=n>r?n:r,i=Number.parseInt(e.toFixed(s).replace(".","")),o=Number.parseInt(t.toFixed(s).replace(".",""));return i%o/10**s}class wr extends we{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==Y.number){const i=this._getOrReturnCtx(t);return G(i,{code:z.invalid_type,expected:Y.number,received:i.parsedType}),ae}let r;const s=new st;for(const i of this._def.checks)i.kind==="int"?_e.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),G(r,{code:z.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),G(r,{code:z.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),G(r,{code:z.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?wT(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),G(r,{code:z.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),G(r,{code:z.not_finite,message:i.message}),s.dirty()):_e.assertNever(i);return{status:s.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,Q.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Q.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Q.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Q.toString(n))}setLimit(t,n,r,s){return new wr({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Q.toString(s)}]})}_addCheck(t){return new wr({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Q.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Q.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Q.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Q.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Q.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Q.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:Q.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Q.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Q.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&_e.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}wr.create=e=>new wr({checks:[],typeName:ce.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...fe(e)});class Jr extends we{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==Y.bigint)return this._getInvalidInput(t);let r;const s=new st;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),G(r,{code:z.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),G(r,{code:z.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),G(r,{code:z.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):_e.assertNever(i);return{status:s.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return G(n,{code:z.invalid_type,expected:Y.bigint,received:n.parsedType}),ae}gte(t,n){return this.setLimit("min",t,!0,Q.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Q.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Q.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Q.toString(n))}setLimit(t,n,r,s){return new Jr({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Q.toString(s)}]})}_addCheck(t){return new Jr({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Q.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Q.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Q.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Q.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Q.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Jr.create=e=>new Jr({checks:[],typeName:ce.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...fe(e)});class va extends we{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Y.boolean){const r=this._getOrReturnCtx(t);return G(r,{code:z.invalid_type,expected:Y.boolean,received:r.parsedType}),ae}return ut(t.data)}}va.create=e=>new va({typeName:ce.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...fe(e)});class bi extends we{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Y.date){const i=this._getOrReturnCtx(t);return G(i,{code:z.invalid_type,expected:Y.date,received:i.parsedType}),ae}if(Number.isNaN(t.data.getTime())){const i=this._getOrReturnCtx(t);return G(i,{code:z.invalid_date}),ae}const r=new st;let s;for(const i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(s=this._getOrReturnCtx(t,s),G(s,{code:z.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(s=this._getOrReturnCtx(t,s),G(s,{code:z.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):_e.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new bi({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:Q.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:Q.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}bi.create=e=>new bi({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:ce.ZodDate,...fe(e)});class $d extends we{_parse(t){if(this._getType(t)!==Y.symbol){const r=this._getOrReturnCtx(t);return G(r,{code:z.invalid_type,expected:Y.symbol,received:r.parsedType}),ae}return ut(t.data)}}$d.create=e=>new $d({typeName:ce.ZodSymbol,...fe(e)});class Vd extends we{_parse(t){if(this._getType(t)!==Y.undefined){const r=this._getOrReturnCtx(t);return G(r,{code:z.invalid_type,expected:Y.undefined,received:r.parsedType}),ae}return ut(t.data)}}Vd.create=e=>new Vd({typeName:ce.ZodUndefined,...fe(e)});class Hd extends we{_parse(t){if(this._getType(t)!==Y.null){const r=this._getOrReturnCtx(t);return G(r,{code:z.invalid_type,expected:Y.null,received:r.parsedType}),ae}return ut(t.data)}}Hd.create=e=>new Hd({typeName:ce.ZodNull,...fe(e)});class zd extends we{constructor(){super(...arguments),this._any=!0}_parse(t){return ut(t.data)}}zd.create=e=>new zd({typeName:ce.ZodAny,...fe(e)});class Wd extends we{constructor(){super(...arguments),this._unknown=!0}_parse(t){return ut(t.data)}}Wd.create=e=>new Wd({typeName:ce.ZodUnknown,...fe(e)});class mn extends we{_parse(t){const n=this._getOrReturnCtx(t);return G(n,{code:z.invalid_type,expected:Y.never,received:n.parsedType}),ae}}mn.create=e=>new mn({typeName:ce.ZodNever,...fe(e)});class Kd extends we{_parse(t){if(this._getType(t)!==Y.undefined){const r=this._getOrReturnCtx(t);return G(r,{code:z.invalid_type,expected:Y.void,received:r.parsedType}),ae}return ut(t.data)}}Kd.create=e=>new Kd({typeName:ce.ZodVoid,...fe(e)});class Nt extends we{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),s=this._def;if(n.parsedType!==Y.array)return G(n,{code:z.invalid_type,expected:Y.array,received:n.parsedType}),ae;if(s.exactLength!==null){const o=n.data.length>s.exactLength.value,a=n.data.length<s.exactLength.value;(o||a)&&(G(n,{code:o?z.too_big:z.too_small,minimum:a?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(G(n,{code:z.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(G(n,{code:z.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,a)=>s.type._parseAsync(new fn(n,o,n.path,a)))).then(o=>st.mergeArray(r,o));const i=[...n.data].map((o,a)=>s.type._parseSync(new fn(n,o,n.path,a)));return st.mergeArray(r,i)}get element(){return this._def.type}min(t,n){return new Nt({...this._def,minLength:{value:t,message:Q.toString(n)}})}max(t,n){return new Nt({...this._def,maxLength:{value:t,message:Q.toString(n)}})}length(t,n){return new Nt({...this._def,exactLength:{value:t,message:Q.toString(n)}})}nonempty(t){return this.min(1,t)}}Nt.create=(e,t)=>new Nt({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ce.ZodArray,...fe(t)});function Yn(e){if(e instanceof je){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=cn.create(Yn(r))}return new je({...e._def,shape:()=>t})}else return e instanceof Nt?new Nt({...e._def,type:Yn(e.element)}):e instanceof cn?cn.create(Yn(e.unwrap())):e instanceof Sr?Sr.create(Yn(e.unwrap())):e instanceof Fn?Fn.create(e.items.map(t=>Yn(t))):e}class je extends we{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=_e.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==Y.object){const d=this._getOrReturnCtx(t);return G(d,{code:z.invalid_type,expected:Y.object,received:d.parsedType}),ae}const{status:r,ctx:s}=this._processInputParams(t),{shape:i,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof mn&&this._def.unknownKeys==="strip"))for(const d in s.data)o.includes(d)||a.push(d);const l=[];for(const d of o){const f=i[d],u=s.data[d];l.push({key:{status:"valid",value:d},value:f._parse(new fn(s,u,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof mn){const d=this._def.unknownKeys;if(d==="passthrough")for(const f of a)l.push({key:{status:"valid",value:f},value:{status:"valid",value:s.data[f]}});else if(d==="strict")a.length>0&&(G(s,{code:z.unrecognized_keys,keys:a}),r.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const f of a){const u=s.data[f];l.push({key:{status:"valid",value:f},value:d._parse(new fn(s,u,s.path,f)),alwaysSet:f in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const d=[];for(const f of l){const u=await f.key,g=await f.value;d.push({key:u,value:g,alwaysSet:f.alwaysSet})}return d}).then(d=>st.mergeObjectSync(r,d)):st.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return Q.errToObj,new je({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var i,o;const s=((o=(i=this._def).errorMap)==null?void 0:o.call(i,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:Q.errToObj(t).message??s}:{message:s}}}:{}})}strip(){return new je({...this._def,unknownKeys:"strip"})}passthrough(){return new je({...this._def,unknownKeys:"passthrough"})}extend(t){return new je({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new je({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:ce.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new je({...this._def,catchall:t})}pick(t){const n={};for(const r of _e.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new je({...this._def,shape:()=>n})}omit(t){const n={};for(const r of _e.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new je({...this._def,shape:()=>n})}deepPartial(){return Yn(this)}partial(t){const n={};for(const r of _e.objectKeys(this.shape)){const s=this.shape[r];t&&!t[r]?n[r]=s:n[r]=s.optional()}return new je({...this._def,shape:()=>n})}required(t){const n={};for(const r of _e.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof cn;)i=i._def.innerType;n[r]=i}return new je({...this._def,shape:()=>n})}keyof(){return $p(_e.objectKeys(this.shape))}}je.create=(e,t)=>new je({shape:()=>e,unknownKeys:"strip",catchall:mn.create(),typeName:ce.ZodObject,...fe(t)});je.strictCreate=(e,t)=>new je({shape:()=>e,unknownKeys:"strict",catchall:mn.create(),typeName:ce.ZodObject,...fe(t)});je.lazycreate=(e,t)=>new je({shape:e,unknownKeys:"strip",catchall:mn.create(),typeName:ce.ZodObject,...fe(t)});class vi extends we{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function s(i){for(const a of i)if(a.result.status==="valid")return a.result;for(const a of i)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(a=>new Ut(a.ctx.common.issues));return G(n,{code:z.invalid_union,unionErrors:o}),ae}if(n.common.async)return Promise.all(r.map(async i=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(s);{let i;const o=[];for(const l of r){const d={...n,common:{...n.common,issues:[]},parent:null},f=l._parseSync({data:n.data,path:n.path,parent:d});if(f.status==="valid")return f;f.status==="dirty"&&!i&&(i={result:f,ctx:d}),d.common.issues.length&&o.push(d.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const a=o.map(l=>new Ut(l));return G(n,{code:z.invalid_union,unionErrors:a}),ae}}get options(){return this._def.options}}vi.create=(e,t)=>new vi({options:e,typeName:ce.ZodUnion,...fe(t)});function wa(e,t){const n=Yt(e),r=Yt(t);if(e===t)return{valid:!0,data:e};if(n===Y.object&&r===Y.object){const s=_e.objectKeys(t),i=_e.objectKeys(e).filter(a=>s.indexOf(a)!==-1),o={...e,...t};for(const a of i){const l=wa(e[a],t[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(n===Y.array&&r===Y.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let i=0;i<e.length;i++){const o=e[i],a=t[i],l=wa(o,a);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return n===Y.date&&r===Y.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class wi extends we{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),s=(i,o)=>{if(Fd(i)||Fd(o))return ae;const a=wa(i.value,o.value);return a.valid?((Ud(i)||Ud(o))&&n.dirty(),{status:n.value,value:a.data}):(G(r,{code:z.invalid_intersection_types}),ae)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,o])=>s(i,o)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}wi.create=(e,t,n)=>new wi({left:e,right:t,typeName:ce.ZodIntersection,...fe(n)});class Fn extends we{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Y.array)return G(r,{code:z.invalid_type,expected:Y.array,received:r.parsedType}),ae;if(r.data.length<this._def.items.length)return G(r,{code:z.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ae;!this._def.rest&&r.data.length>this._def.items.length&&(G(r,{code:z.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((o,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new fn(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>st.mergeArray(n,o)):st.mergeArray(n,i)}get items(){return this._def.items}rest(t){return new Fn({...this._def,rest:t})}}Fn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Fn({items:e,typeName:ce.ZodTuple,rest:null,...fe(t)})};class qd extends we{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Y.map)return G(r,{code:z.invalid_type,expected:Y.map,received:r.parsedType}),ae;const s=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([a,l],d)=>({key:s._parse(new fn(r,a,r.path,[d,"key"])),value:i._parse(new fn(r,l,r.path,[d,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of o){const d=await l.key,f=await l.value;if(d.status==="aborted"||f.status==="aborted")return ae;(d.status==="dirty"||f.status==="dirty")&&n.dirty(),a.set(d.value,f.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of o){const d=l.key,f=l.value;if(d.status==="aborted"||f.status==="aborted")return ae;(d.status==="dirty"||f.status==="dirty")&&n.dirty(),a.set(d.value,f.value)}return{status:n.value,value:a}}}}qd.create=(e,t,n)=>new qd({valueType:t,keyType:e,typeName:ce.ZodMap,...fe(n)});class es extends we{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Y.set)return G(r,{code:z.invalid_type,expected:Y.set,received:r.parsedType}),ae;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(G(r,{code:z.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(G(r,{code:z.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const i=this._def.valueType;function o(l){const d=new Set;for(const f of l){if(f.status==="aborted")return ae;f.status==="dirty"&&n.dirty(),d.add(f.value)}return{status:n.value,value:d}}const a=[...r.data.values()].map((l,d)=>i._parse(new fn(r,l,r.path,d)));return r.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(t,n){return new es({...this._def,minSize:{value:t,message:Q.toString(n)}})}max(t,n){return new es({...this._def,maxSize:{value:t,message:Q.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}es.create=(e,t)=>new es({valueType:e,minSize:null,maxSize:null,typeName:ce.ZodSet,...fe(t)});class Gd extends we{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Gd.create=(e,t)=>new Gd({getter:e,typeName:ce.ZodLazy,...fe(t)});class Zd extends we{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return G(n,{received:n.data,code:z.invalid_literal,expected:this._def.value}),ae}return{status:"valid",value:t.data}}get value(){return this._def.value}}Zd.create=(e,t)=>new Zd({value:e,typeName:ce.ZodLiteral,...fe(t)});function $p(e,t){return new _r({values:e,typeName:ce.ZodEnum,...fe(t)})}class _r extends we{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return G(n,{expected:_e.joinValues(r),received:n.parsedType,code:z.invalid_type}),ae}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return G(n,{received:n.data,code:z.invalid_enum_value,options:r}),ae}return ut(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return _r.create(t,{...this._def,...n})}exclude(t,n=this._def){return _r.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}_r.create=$p;class Yd extends we{_parse(t){const n=_e.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==Y.string&&r.parsedType!==Y.number){const s=_e.objectValues(n);return G(r,{expected:_e.joinValues(s),received:r.parsedType,code:z.invalid_type}),ae}if(this._cache||(this._cache=new Set(_e.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const s=_e.objectValues(n);return G(r,{received:r.data,code:z.invalid_enum_value,options:s}),ae}return ut(t.data)}get enum(){return this._def.values}}Yd.create=(e,t)=>new Yd({values:e,typeName:ce.ZodNativeEnum,...fe(t)});class _i extends we{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Y.promise&&n.common.async===!1)return G(n,{code:z.invalid_type,expected:Y.promise,received:n.parsedType}),ae;const r=n.parsedType===Y.promise?n.data:Promise.resolve(n.data);return ut(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}_i.create=(e,t)=>new _i({type:e,typeName:ce.ZodPromise,...fe(t)});class xr extends we{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ce.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),s=this._def.effect||null,i={addIssue:o=>{G(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){const o=s.transform(r.data,i);if(r.common.async)return Promise.resolve(o).then(async a=>{if(n.value==="aborted")return ae;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?ae:l.status==="dirty"||n.value==="dirty"?Hr(l.value):l});{if(n.value==="aborted")return ae;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?ae:a.status==="dirty"||n.value==="dirty"?Hr(a.value):a}}if(s.type==="refinement"){const o=a=>{const l=s.refinement(a,i);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?ae:(a.status==="dirty"&&n.dirty(),o(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?ae:(a.status==="dirty"&&n.dirty(),o(a.value).then(()=>({status:n.value,value:a.value}))))}if(s.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!vr(o))return ae;const a=s.transform(o.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>vr(o)?Promise.resolve(s.transform(o.value,i)).then(a=>({status:n.value,value:a})):ae);_e.assertNever(s)}}xr.create=(e,t,n)=>new xr({schema:e,typeName:ce.ZodEffects,effect:t,...fe(n)});xr.createWithPreprocess=(e,t,n)=>new xr({schema:t,effect:{type:"preprocess",transform:e},typeName:ce.ZodEffects,...fe(n)});class cn extends we{_parse(t){return this._getType(t)===Y.undefined?ut(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}cn.create=(e,t)=>new cn({innerType:e,typeName:ce.ZodOptional,...fe(t)});class Sr extends we{_parse(t){return this._getType(t)===Y.null?ut(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Sr.create=(e,t)=>new Sr({innerType:e,typeName:ce.ZodNullable,...fe(t)});class _a extends we{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===Y.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}_a.create=(e,t)=>new _a({innerType:e,typeName:ce.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...fe(t)});class xa extends we{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return yi(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Ut(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ut(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}xa.create=(e,t)=>new xa({innerType:e,typeName:ce.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...fe(t)});class Qd extends we{_parse(t){if(this._getType(t)!==Y.nan){const r=this._getOrReturnCtx(t);return G(r,{code:z.invalid_type,expected:Y.nan,received:r.parsedType}),ae}return{status:"valid",value:t.data}}}Qd.create=e=>new Qd({typeName:ce.ZodNaN,...fe(e)});class _T extends we{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Ic extends we{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?ae:i.status==="dirty"?(n.dirty(),Hr(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?ae:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(t,n){return new Ic({in:t,out:n,typeName:ce.ZodPipeline})}}class Sa extends we{_parse(t){const n=this._def.innerType._parse(t),r=s=>(vr(s)&&(s.value=Object.freeze(s.value)),s);return yi(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}Sa.create=(e,t)=>new Sa({innerType:e,typeName:ce.ZodReadonly,...fe(t)});var ce;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(ce||(ce={}));const ko=sn.create,Fs=wr.create,xT=va.create;mn.create;Nt.create;const ST=je.create;vi.create;wi.create;Fn.create;_r.create;_i.create;cn.create;Sr.create;const CT="https://api.opheleo.com",TT="Bearer ",ET="Authorization";ST({id:ko(),userId:ko(),createdAt:Fs(),updatedAt:Fs(),active:xT(),perDayUsage:Fs(),userEmail:ko().email(),maxPerDayUsage:Fs()});async function PT(e,t,n){const r=typeof window<"u"?localStorage.getItem("session_token"):null;return(await Re({baseURL:br(n??CT),url:e,method:t,headers:r?{[ET]:`${TT}${r}`}:void 0})).data}async function kT(e){return PT("/iccandle/v1/iccandle-user-usage/me","get",e)}const AT=e=>{const t=e==null?void 0:e.platformApiBase;return ZC({queryKey:["iccandle-user-usage",t],queryFn:()=>kT(t),...e})},OT=C.createContext(null);function NT(){const e=C.useContext(OT);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function RT({controlsRef:e,onSymbolTickerChange:t,onScanResultUrlChange:n,onChartWidgetChange:r,onChartContainerChange:s,selectSymbolTickerRef:i,headerSlot:o}){const{resolvedTheme:a}=NT(),l=dt(),d=ys(),f=C.useRef([]),u=C.useRef(null),g=C.useRef(a),p=C.useRef(null),y=C.useRef(null),m=C.useMemo(()=>gi(d),[d]),h=C.useRef(m),b=C.useRef("60"),{setGapCount:v,setReplayMode:_}=Mp();C.useEffect(()=>{v(0),_(!1)},[v,_]),C.useEffect(()=>{Ys()&&P(!0)},[]);const[x,S]=C.useState(null),[T,P]=C.useState(!1),[A,D]=C.useState(null),I=C.useCallback(O=>{if(O===h.current)return;const U=d.find(j=>j.ticker===O);if(!U)return;h.current=O,localStorage.setItem(Qn,O),t(O);const W=u.current;if(W)try{W.onChartReady(()=>{W.activeChart().setSymbol(U.ticker)})}catch{}},[t,d]);C.useEffect(()=>(i.current=I,()=>{i.current=null}),[I,i]);const N=C.useRef([]),L=C.useMemo(()=>new KC(N,"selector",d,l.tickWebSocketUrl),[l.tickWebSocketUrl,d]),{data:H,isLoading:R}=AT({enabled:!0,platformApiBase:l.platformApiBase}),F=!R&&H?H.perDayUsage>=H.maxPerDayUsage:!1;C.useEffect(()=>{s(x)},[x,s]),C.useEffect(()=>{r(A)},[A,r]),C.useEffect(()=>{if(!T||!x)return;if(u.current){D(null),r(null);try{u.current.remove()}catch{}u.current=null}const O=gi(d);h.current=O,b.current="60";const U=Ip();if(!U)return;const W=new U({container:x,library_path:"/charting_library/",datafeed:L,symbol:O,interval:"60",autosize:!0,theme:g.current,disabled_features:["symbol_info","legend_inplace_edit","header_quick_search","header_compare"],enabled_features:["header_chart_type","show_symbol_logos","show_symbol_logo_in_legend"],custom_indicators_getter:()=>qC(f),drawings_access:{type:"black",tools:[{name:"Date Range"}]},locale:"en",timezone:Ih(),overrides:{priceScaleSelectionStrategyName:"right","scalesProperties.showSeriesLastValue":!0}});let j=!1;return u.current=W,W.onChartReady(()=>{j||u.current!==W||D(W)}),()=>{if(j=!0,D(null),r(null),u.current){try{u.current.remove()}catch{}u.current=null}}},[x,L,r,T]),C.useEffect(()=>{if(!A)return;let O=!1;try{A.onChartReady(()=>{O||(async()=>{try{const U=A.activeChart(),W=await U.createStudy("Generated Candles - By iC Candle",!0,!0);if(O||(W&&U.bringToFront([W]),await A.headerReady(),O)||(await new Promise(J=>{setTimeout(()=>{if(!O)try{U.clearMarks(2)}catch{}J(!0)},150)}),O))return;localStorage.setItem("tv:selected-news-events","[]"),U.refreshMarks();const j=J=>{const de=U.symbol(),ue=ma(de,d,m);ue!==h.current&&(n(null),f.current=[]);try{A.resetCache()}catch{}h.current=ue,localStorage.setItem(Qn,ue),t(ue)},ee=J=>{J!==b.current&&(n(null),f.current=[]);try{A.resetCache()}catch{}b.current=J};p.current=j,y.current=ee,U.onSymbolChanged().subscribe(null,j),U.onIntervalChanged().subscribe(null,ee)}catch{}})()})}catch{}return()=>{O=!0,p.current=null,y.current=null}},[A,e,n,t,m,d]),C.useEffect(()=>{if(!A||!a)return;let O=!1;try{A.onChartReady(()=>{O||A.changeTheme(a).catch(()=>{})})}catch{}return()=>{O=!0}},[A,a]);const M=C.useCallback(()=>{P(!0)},[]),$=F?c.jsx("div",{className:"web-trading-widget-advanced__scan-limit-wrap",children:c.jsxs(IC,{variant:"destructive",className:"web-trading-widget-advanced__scan-limit-badge",children:[c.jsx("span",{className:"web-trading-widget-advanced__scan-limit-badge-title",children:"Daily scan limit reached"}),H&&c.jsxs("span",{className:"web-trading-widget-advanced__scan-limit-badge-count",children:[H.perDayUsage," of ",H.maxPerDayUsage," scans used today"]})]})}):null;return c.jsxs(c.Fragment,{children:[o??$,c.jsx(MC,{onLoad:M}),c.jsx("div",{ref:S,className:"web-trading-widget-advanced__container"})]})}const Vp=C.createContext(null);function Xd({value:e,children:t}){return c.jsx(Vp.Provider,{value:e,children:t})}function LT(){const e=C.useContext(Vp);if(!e)throw new Error("useWidgetChartSlot must be used within WidgetChartSlotProvider");return e}function Us(e,t){return e.toFixed(t)}function DT({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,isDragging:d,isCollapsed:f,onToggleCollapsed:u,onDragHandlePointerDown:g,onPlaceOrder:p}){const[y,m]=C.useState(!0),h=f??y,b=()=>{u==null||u(),f===void 0&&m(M=>!M)},v=ie(M=>M.setOrderSide),_=ie(M=>M.setVolumeLots),x=ie(M=>M.volumeLots),[S,T]=C.useState(String(x||r));C.useEffect(()=>{h||T(Us(x,2))},[h,x]);const P=Number(Vt(Ht(e))),A=t!==null?xe(t,P):"—",D=n!==null?xe(n,P):"—",N=!o&&!a&&l!==""&&(t!==null&&n!==null),L=M=>{const $=Number(S),O=Number.isFinite($)&&$>0?$:r,U=Math.max(i,O+M*s),W=Us(U,2);T(W),_(U)},H=()=>{const M=Number(S);if(!Number.isFinite(M)||M<=0){T(Us(r,2)),_(r);return}const $=Math.max(i,M),O=Us($,2);T(O),_($)},R=M=>{t===null||n===null||v({side:M,entryPrice:M==="buy"?n:t})},F=M=>{if(t===null||n===null||!l)return;const $=Number(S),O=Math.max(i,Number.isFinite($)&&$>0?$:r);v({side:M,entryPrice:M==="buy"?n:t}),p({login:l,side:M,volumeLots:O,bid:t,ask:n})};return c.jsx("div",{className:"web-trading-widget-mini-order web-trading-widget-mini-order--expanded",children:c.jsxs("div",{className:"web-trading-widget-mini-order__row",children:[c.jsx("button",{type:"button","aria-label":"Move quick order panel",onPointerDown:g,className:`web-trading-widget-mini-order__drag-handle${d?" web-trading-widget-mini-order__drag-handle--grabbing":""}`,children:c.jsx(Zf,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2})}),c.jsxs(c.Fragment,{children:[c.jsxs("button",{type:"button",disabled:!N,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--sell",onMouseDown:()=>R("sell"),onClick:()=>F("sell"),children:[c.jsx("span",{className:"web-trading-widget-mini-order__price",children:A}),c.jsx("span",{className:"web-trading-widget-mini-order__label web-trading-widget-mini-order__label--sell",children:"SELL"})]}),c.jsxs("div",{className:"web-trading-widget-mini-order__volume",children:[c.jsx("button",{type:"button","aria-label":"Decrease volume",disabled:!N,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>L(-1),children:c.jsx(oi,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})}),c.jsx("input",{type:"text",inputMode:"decimal",value:S,disabled:!N,onChange:M=>T(M.target.value),onBlur:H,className:"web-trading-widget-mini-order__volume-input"}),c.jsx("button",{type:"button","aria-label":"Increase volume",disabled:!N,className:"web-trading-widget-mini-order__volume-btn",onClick:()=>L(1),children:c.jsx($o,{className:"web-trading-widget-icon web-trading-widget-icon--xs",strokeWidth:2.5})})]}),c.jsxs("button",{type:"button",disabled:!N,className:"web-trading-widget-mini-order__side-btn web-trading-widget-mini-order__side-btn--buy",onMouseDown:()=>R("buy"),onClick:()=>F("buy"),children:[c.jsx("span",{className:"web-trading-widget-mini-order__label web-trading-widget-mini-order__label--buy",children:"BUY"}),c.jsx("span",{className:"web-trading-widget-mini-order__price",children:D})]})]}),c.jsx("button",{type:"button","aria-label":h?"Expand quick order panel":"Collapse quick order panel","aria-expanded":!h,className:"web-trading-widget-mini-order__toggle",onClick:b,children:h?c.jsx(oi,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5}):c.jsx($o,{className:"web-trading-widget-icon web-trading-widget-icon--sm",strokeWidth:2.5})})]})})}function Mr({title:e,isOpen:t,onToggle:n,children:r}){return c.jsxs("div",{className:"web-trading-widget-market-panel__accordion-item",children:[c.jsxs("button",{type:"button",className:`web-trading-widget-market-panel__accordion-trigger${t?" web-trading-widget-market-panel__accordion-trigger--open":""}`,"aria-expanded":t,onClick:n,children:[e,c.jsx(oi,{className:"web-trading-widget-icon web-trading-widget-icon--md web-trading-widget-text-muted"})]}),t?c.jsx("div",{className:"web-trading-widget-market-panel__accordion-content",children:r}):null]})}const jT=new Set(["volume-setting","risk-management"]);function IT({symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,isDragging:d,onDragHandlePointerDown:f,onLayoutChange:u,onClose:g,onPlaceOrder:p}){const[y,m]=C.useState(!0),[h,b]=C.useState("market"),v=ie(te=>te.volumeLots),[_,x]=C.useState(String(v||r)),[S,T]=C.useState(""),[P,A]=C.useState(""),D=ie(te=>te.stopLoss),I=ie(te=>te.takeProfit),N=ie(te=>te.setStopLoss),L=ie(te=>te.setTakeProfit),H=ie(te=>te.setVolumeLots),R=ie(te=>te.setOrderSide),[F,M]=C.useState(""),[$,O]=C.useState(gt.GTC),[U,W]=C.useState(""),[j,ee]=C.useState(""),[J,de]=C.useState(()=>new Set(jT));C.useEffect(()=>{u()},[y,u]);const ue=Number(Vt(Ht(e))),V=Pr(ue),K=fc(t,n),se=t!==null?xe(t,ue):"—",Ee=n!==null?xe(n,ue):"—",le=Fi(h),oe=Qf(h),B=Mi(h),ve=B.label,ke=!le&&B.orderType!==null&&B.orderType%2===1,Pe=C.useMemo(()=>K!==null?K:t??n,[n,t,K]),X=te=>{de(Je=>{const zt=new Set(Je);return zt.has(te)?zt.delete(te):zt.add(te),zt})},Ne=te=>{x(te);const Je=Number(te);Number.isFinite(Je)&&Je>0&&H(Je)},Be=te=>t===null||n===null?null:le?te==="buy"?n:t:Ue(S)??(te==="buy"?n:t),Xe=te=>{const Je=Be(te);Je!==null&&R({side:te,entryPrice:Je})},ft=te=>{if(t===null||n===null||!l)return;const Je=Math.max(i,Number(_)||i),zt=Vo(h,te),Nr=Be(te);Nr!==null&&R({side:te,entryPrice:Nr}),p({login:l,executionMode:h,side:te,orderType:zt,volumeLots:Je,stopLoss:D,takeProfit:I,priceOrder:S,priceTrigger:P,comment:F,typeTime:$,expirationDateTime:U,expirationDay:j,bid:t,ask:n})},re=t!==null&&n!==null,Ve=le||Ue(S)!==void 0,Ji=!oe||Ue(P)!==void 0,vs=le||Bi($,U,j),bh=!o&&!a&&l!==""&&re&&Ve&&Ji&&vs,vh=!le&&lc($),wh=!le&&dc($),$c=()=>B.orderType!==null&&B.orderType%2===1?"sell":"buy";return c.jsxs("div",{className:`web-trading-widget-market-panel web-trading-widget-market-panel--modal${y?" web-trading-widget-market-panel--collapsed":""}`,children:[c.jsx(DT,{symbolTicker:e,bid:t,ask:n,defaultVolumeLots:r,volumeStep:s,minVolumeLots:i,isSubmitting:o,isAccountsLoading:a,selectedLogin:l,isDragging:d,isCollapsed:y,onToggleCollapsed:()=>m(te=>!te),onDragHandlePointerDown:f,onPlaceOrder:({login:te,side:Je,volumeLots:zt,bid:Nr,ask:Vc})=>{Nr===null||Vc===null||p({login:te,executionMode:"market",side:Je,orderType:Vo("market",Je),volumeLots:zt,stopLoss:D,takeProfit:I,priceOrder:"",priceTrigger:"",comment:F,typeTime:$,expirationDateTime:"",expirationDay:"",bid:Nr,ask:Vc})}}),y?null:c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"web-trading-widget-market-panel__header",children:c.jsxs(si,{value:h,onValueChange:te=>b(te),children:[c.jsx(Kr,{className:"web-trading-widget-market-panel__select-trigger","aria-label":"Order execution type",children:c.jsx(ii,{})}),c.jsx(qr,{children:ai.map(te=>c.jsx(Gr,{value:te.mode,children:te.label},te.mode))})]})}),c.jsxs("div",{className:"web-trading-widget-market-panel__accordion",children:[c.jsx(Mr,{id:"volume-setting",title:"Volume Setting",isOpen:J.has("volume-setting"),onToggle:()=>X("volume-setting"),children:c.jsx(De,{label:"Lots",value:_,onChange:Ne,step:s,min:i,decimals:2})}),le?null:c.jsx(Mr,{id:"order-price",title:"Order Price",isOpen:J.has("order-price"),onToggle:()=>X("order-price"),children:oe?c.jsxs(c.Fragment,{children:[c.jsx(De,{label:"Stop Price",value:P,onChange:A,step:V,decimals:ue,basePrice:Pe,placeholder:K!==null?xe(K,ue):"—"}),c.jsx(De,{label:"Limit Price",value:S,onChange:T,step:V,decimals:ue,basePrice:Pe,placeholder:K!==null?xe(K,ue):"—"})]}):c.jsx(De,{label:"Price",value:S,onChange:T,step:V,decimals:ue,basePrice:Pe,placeholder:K!==null?xe(K,ue):"—"})}),c.jsx(Mr,{id:"risk-management",title:"Risk Management",isOpen:J.has("risk-management"),onToggle:()=>X("risk-management"),children:c.jsxs("div",{className:"web-trading-widget-market-panel__grid-2",children:[c.jsx(De,{label:"Stop Loss",value:D,onChange:N,step:V,decimals:ue,basePrice:t,placeholder:t!==null?se:"—",clearable:!0}),c.jsx(De,{label:"Take Profit",value:I,onChange:L,step:V,decimals:ue,basePrice:n,placeholder:n!==null?Ee:"—",clearable:!0})]})}),le?null:c.jsxs(Mr,{id:"expiration",title:"Expiration",isOpen:J.has("expiration"),onToggle:()=>X("expiration"),children:[c.jsx("select",{value:String($),className:"web-trading-widget-market-panel__select-full","aria-label":"Order expiration type",onChange:te=>O(Number(te.target.value)),children:Xf.map(te=>c.jsx("option",{value:String(te.value),children:te.label},te.value))}),vh?c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Expiration time"}),c.jsx("input",{type:"datetime-local",value:U,className:"web-trading-widget-market-panel__input",onChange:te=>W(te.target.value)})]}):null,wh?c.jsxs("div",{className:"web-trading-widget-market-panel__field",children:[c.jsx("span",{className:"web-trading-widget-market-panel__field-label",children:"Expiration day"}),c.jsx("input",{type:"date",value:j,className:"web-trading-widget-market-panel__input",onChange:te=>ee(te.target.value)})]}):null]}),c.jsx(Mr,{id:"comment",title:"Comment",isOpen:J.has("comment"),onToggle:()=>X("comment"),children:c.jsx("input",{type:"text",value:F,className:"web-trading-widget-market-panel__input",placeholder:"",onChange:te=>M(te.target.value)})})]}),c.jsx("div",{className:"web-trading-widget-market-panel__footer",children:c.jsxs("div",{className:"web-trading-widget-market-panel__quotes",children:[c.jsx("span",{children:se}),c.jsx("span",{className:"web-trading-widget-market-panel__quotes-ask",children:Ee})]})}),!le&&c.jsxs("button",{type:"button",className:`web-trading-widget-market-panel__place-btn${ke?" web-trading-widget-market-panel__place-btn--sell":" web-trading-widget-market-panel__place-btn--buy"}`,disabled:!bh,onMouseDown:()=>Xe($c()),onClick:()=>ft($c()),children:["Place ",ve]})]})]})}function MT({symbolTicker:e,chartWidget:t,orderState:n}){const r=ys(),s=_c(e),{panel:i,confirmation:o,isSubmitting:a,defaultVolumeLots:l,volumeStep:d,minVolumeLots:f,selectedLogin:u,isAccountsLoading:g,hasConfirmedAccount:p,closePanels:y,dismissConfirmation:m,placeMarketOrder:h}=n,b=pe(j=>j.positions),v=pe(j=>j.orders),_=pe(j=>j.selectedPositionTicket),x=pe(j=>j.selectedOrderTicket),S=pe(j=>j.setSelectedPositionTicket),T=pe(j=>j.setSelectedOrderTicket),P=_!==null?b.find(j=>j.ticket===_)??null:null,A=x!==null?v.find(j=>j.ticket===x)??null:null,D=p&&i==="confirmation"&&o!==null,I=p&&i!=="confirmation"&&i!=="closed"&&P===null&&A===null,{panelRef:N,position:L,isDragging:H,onDragStart:R,reclamp:F}=sm({storageKey:"web-trading-widget-modal-exec-panel-position",defaultAlign:"top-right",isActive:I}),M=ie(j=>j.setDraft),$=ie(j=>j.clearDraft),O=Number(Vt(Ht(e))),U=Pr(O);C.useEffect(()=>{p&&M({source:"new-order",entryPrice:null,side:null,showEntryLine:!1,volumeLots:l,digits:O,priceStep:U})},[l,O,p,U,M]),C.useEffect(()=>{(i==="closed"||i==="confirmation")&&$()},[$,i]);const W=P!==null||A!==null;return!p&&!W?null:c.jsxs("div",{className:"web-trading-widget-new-order-overlay-layer",children:[c.jsx(Wm,{chartWidget:t,symbolTicker:e,symbols:r}),W&&P!==null?c.jsx("div",{className:"web-trading-widget-new-order-overlay web-trading-widget-new-order-overlay--news web-trading-widget-new-order-overlay--side-panel",children:c.jsx(jp,{position:P,onClose:()=>S(null)})}):null,W&&A!==null?c.jsx("div",{className:"web-trading-widget-new-order-overlay web-trading-widget-new-order-overlay--news web-trading-widget-new-order-overlay--side-panel",children:c.jsx(Dp,{order:A,onClose:()=>T(null)})}):null,D&&o!==null?c.jsx("div",{className:"web-trading-widget-new-order-overlay web-trading-widget-new-order-overlay--news",children:c.jsx(Lp,{confirmation:o,symbolTicker:e,onDismiss:m})}):null,I?c.jsx("div",{ref:N,style:{left:L.x,top:L.y},className:`web-trading-widget-new-order-overlay web-trading-widget-new-order-overlay--news web-trading-widget-new-order-overlay--draggable web-trading-widget-new-order-overlay--exec-panel${H?" web-trading-widget-new-order-overlay--dragging":""}`,children:c.jsx(IT,{symbolTicker:e,bid:(s==null?void 0:s.bid)??null,ask:(s==null?void 0:s.ask)??null,defaultVolumeLots:l,volumeStep:d,minVolumeLots:f,isSubmitting:a,isAccountsLoading:g,selectedLogin:u,isDragging:H,onDragHandlePointerDown:R,onLayoutChange:F,onClose:y,onPlaceOrder:j=>void h({symbolTicker:e,login:j.login,executionMode:j.executionMode,side:j.side,orderType:j.orderType,volumeLots:j.volumeLots,stopLoss:j.stopLoss,takeProfit:j.takeProfit,priceOrder:j.priceOrder,priceTrigger:j.priceTrigger,comment:j.comment,typeTime:j.typeTime,expirationDateTime:j.expirationDateTime,expirationDay:j.expirationDay,bid:j.bid,ask:j.ask})})}):null]})}const FT=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" aria-hidden="true">
|
|
82
82
|
<rect x="1" y="1" width="16" height="16" rx="5" fill="#3B82F6" fill-opacity="0.18" stroke="#3B82F6" stroke-width="1"/>
|
|
83
83
|
<circle cx="9" cy="6.5" r="2.5" fill="none" stroke="#3B82F6" stroke-width="1.5"/>
|
|
84
84
|
<path d="M4 14.5c0-2.8 2.2-5 5-5s5 2.2 5 5" fill="none" stroke="#3B82F6" stroke-width="1.5" stroke-linecap="round"/>
|
|
85
|
-
</svg>`,
|
|
85
|
+
</svg>`,Hp=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" aria-hidden="true">
|
|
86
86
|
<circle cx="9" cy="9" r="6.5" fill="none" stroke="currentColor" stroke-width="1.5" stroke-opacity="0.25"/>
|
|
87
87
|
<path d="M9 2.5a6.5 6.5 0 0 1 6.5 6.5" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
88
|
-
</svg>`,
|
|
88
|
+
</svg>`,UT=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" aria-hidden="true">
|
|
89
89
|
<path d="M4.5 9.25 7.5 12.25 13.5 6.25" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/>
|
|
90
|
-
</svg>`,Dm="data-opheleo-account-dropdown";function _E(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 Lm(e){const[t]=e.label.split(" · ");return t??e.label}function xE(e){return`My Account — ${e.label} — ${e.balance.toFixed(2)} ${e.currency}`}function SE(e,t){const n=Lm(e),r=`${e.balance.toFixed(2)} ${e.currency}`;return`${e.login} · ${n} (${r})${t?" · Active":""}`}function Ac(e){return e.accountOptions.length===0?null:e.accountOptions.find(t=>t.login===e.selectedLogin)??e.accountOptions[0]}function jm(e){return e.isAccountsLoading||e.isAccountDataLoading}function Im(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=Ac(e);if(!t)return"My Account";const n=Lm(t);return`My Account · ${t.login} · ${n}`}function CE(e){return jm(e)?Rm:vE}function EE(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:SE(n,r),icon:r?wE:void 0,onSelect:()=>{r||t(n.login)}}})}function TE(e,t){var s,i;const n=e.querySelector(`[${Dm}="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 PE(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 AE(e,t){e.setAttribute(Dm,"true"),_E(e);const n=Ac(t);if(!jm(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}PE(e),e.style.border="1px solid transparent",e.style.borderRadius="6px",e.style.padding="0 10px"}function NE(e,t){if(!(e!=null&&e.isConnected))return;const n=Im(t),r=()=>{const s=TE(e,n);s&&AE(s,t)};r(),requestAnimationFrame(r)}async function OE(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:Rm,items:[{title:"Loading accounts…",onSelect:()=>{}}]})}catch{return null}}function $d(e,t,n,r){if(!e||(r==null?void 0:r.isConnected)===!1)return;const s=Ac(t);try{e.applyOptions({title:Im(t),tooltip:s?xE(s):"Select your trading account",icon:CE(t),items:EE(t,n)})}catch{return}NE(r??null,t)}var Nc="ToastProvider",[Oc,kE,RE]=Da("Toast"),[Mm]=Bn("Toast",[RE]),[DE,Ki]=Mm(Nc),Fm=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),g=w.useRef(!1),m=w.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${Nc}\`. Expected non-empty \`string\`.`),c.jsx(Oc.Provider,{scope:t,children:c.jsx(DE,{scope:t,label:n,duration:r,swipeDirection:s,swipeThreshold:i,toastCount:u,viewport:l,onViewportChange:d,onToastAdd:w.useCallback(()=>f(h=>h+1),[]),onToastRemove:w.useCallback(()=>f(h=>h-1),[]),isFocusedToastEscapeKeyDownRef:g,isClosePausedRef:m,announcerContainer:o,children:a})})};Fm.displayName=Nc;var Um="ToastViewport",LE=["F8"],va="toast.viewportPause",wa="toast.viewportResume",Bm=w.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=LE,label:s="Notifications ({hotkey})",...i}=e,o=Ki(Um,n),a=kE(n),l=w.useRef(null),d=w.useRef(null),u=w.useRef(null),f=w.useRef(null),g=Pe(t,f,o.onViewportChange),m=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),h=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(h&&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)}}},[h,o.isClosePausedRef]);const p=w.useCallback(({tabbingDirection:y})=>{const v=a().map(x=>{const _=x.ref.current,C=[_,...GE(_)];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,E;const x=v.altKey||v.ctrlKey||v.metaKey;if(v.key==="Tab"&&!x){const k=document.activeElement,D=v.shiftKey;if(v.target===y&&D){(C=d.current)==null||C.focus();return}const O=p({tabbingDirection:D?"backwards":"forwards"}),B=O.findIndex(R=>R===k);Co(O.slice(B+1))?v.preventDefault():D?(P=d.current)==null||P.focus():(E=u.current)==null||E.focus()}};return y.addEventListener("keydown",b),()=>y.removeEventListener("keydown",b)}},[a,p]),c.jsxs(gg,{ref:l,role:"region","aria-label":s.replace("{hotkey}",m),tabIndex:-1,style:{pointerEvents:h?void 0:"none"},children:[h&&c.jsx(_a,{ref:d,onFocusFromOutsideViewport:()=>{const y=p({tabbingDirection:"forwards"});Co(y)}}),c.jsx(Oc.Slot,{scope:n,children:c.jsx(me.ol,{tabIndex:-1,...i,ref:g})}),h&&c.jsx(_a,{ref:u,onFocusFromOutsideViewport:()=>{const y=p({tabbingDirection:"backwards"});Co(y)}})]})});Bm.displayName=Um;var $m="ToastFocusProxy",_a=w.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...s}=e,i=Ki($m,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=$m;var ds="Toast",jE="toast.swipeStart",IE="toast.swipeMove",ME="toast.swipeCancel",FE="toast.swipeEnd",Vm=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($n,{present:n||a,children:c.jsx($E,{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)})})})});Vm.displayName=ds;var[UE,BE]=Mm(ds,{onClose(){}}),$E=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:g,onSwipeEnd:m,...h}=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),E=w.useRef(C),k=w.useRef(0),{onToastAdd:D,onToastRemove:I}=p,N=mt(()=>{var H;(y==null?void 0:y.contains(document.activeElement))&&((H=p.viewport)==null||H.focus()),o()}),O=w.useCallback(R=>{!R||R===1/0||(window.clearTimeout(k.current),P.current=new Date().getTime(),k.current=window.setTimeout(N,R))},[N]);w.useEffect(()=>{const R=p.viewport;if(R){const H=()=>{O(E.current),d==null||d()},F=()=>{const M=new Date().getTime()-P.current;E.current=E.current-M,window.clearTimeout(k.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,O]),w.useEffect(()=>{i&&!p.isClosePausedRef.current&&O(C)},[i,C,p.isClosePausedRef,O]),w.useEffect(()=>(D(),()=>I()),[D,I]);const B=w.useMemo(()=>y?Zm(y):null,[y]);return p.viewport?c.jsxs(c.Fragment,{children:[B&&c.jsx(VE,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:B}),c.jsx(UE,{scope:n,onClose:N,children:Cr.createPortal(c.jsx(Oc.ItemSlot,{scope:n,children:c.jsx(hg,{asChild:!0,onEscapeKeyDown:pe(a,()=>{p.isFocusedToastEscapeKeyDownRef.current||N(),p.isFocusedToastEscapeKeyDownRef.current=!1}),children:c.jsx(me.li,{tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":p.swipeDirection,...h,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,N()))}),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,M=!!_.current,L=["left","right"].includes(p.swipeDirection),U=["left","up"].includes(p.swipeDirection)?Math.min:Math.max,K=L?U(0,H):0,j=L?0:U(0,F),se=R.pointerType==="touch"?10:2,z={x:K,y:j},de={originalEvent:R,delta:z};M?(_.current=z,Ds(IE,f,de,{discrete:!1})):Vd(z,p.swipeDirection,se)?(_.current=z,Ds(jE,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 M=R.currentTarget,L={originalEvent:R,delta:H};Vd(H,p.swipeDirection,p.swipeThreshold)?Ds(FE,m,L,{discrete:!0}):Ds(ME,g,L,{discrete:!0}),M.addEventListener("click",U=>U.preventDefault(),{once:!0})}})})})}),p.viewport)})]}):null}),VE=e=>{const{__scopeToast:t,children:n,...r}=e,s=Ki(ds,t),[i,o]=w.useState(!1),[a,l]=w.useState(!1);return WE(()=>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]})})})},HE="ToastTitle",Hm=w.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return c.jsx(me.div,{...r,ref:t})});Hm.displayName=HE;var zE="ToastDescription",zm=w.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return c.jsx(me.div,{...r,ref:t})});zm.displayName=zE;var Wm="ToastAction",Km=w.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?c.jsx(qm,{altText:n,asChild:!0,children:c.jsx(kc,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${Wm}\`. Expected non-empty \`string\`.`),null)});Km.displayName=Wm;var Gm="ToastClose",kc=w.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,s=BE(Gm,n);return c.jsx(qm,{asChild:!0,children:c.jsx(me.button,{type:"button",...r,ref:t,onClick:pe(e.onClick,s.onClose)})})});kc.displayName=Gm;var qm=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 Zm(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),KE(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(...Zm(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?cu(s,i):s.dispatchEvent(i)}var Vd=(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 WE(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 KE(e){return e.nodeType===e.ELEMENT_NODE}function GE(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 qE=Fm,Ym=Bm,Qm=Vm,Xm=Hm,Jm=zm,eh=Km,Gi=kc;const ZE=qE,th=w.forwardRef(({className:e,...t},n)=>c.jsx(Ym,{ref:n,className:Se("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}));th.displayName=Ym.displayName;const YE=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"}}),nh=w.forwardRef(({className:e,variant:t,...n},r)=>c.jsx(Qm,{ref:r,className:Se(YE({variant:t}),e),...n}));nh.displayName=Qm.displayName;const QE=w.forwardRef(({className:e,...t},n)=>c.jsx(eh,{ref:n,className:Se("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}));QE.displayName=eh.displayName;const rh=w.forwardRef(({className:e,...t},n)=>c.jsx(Gi,{ref:n,className:Se("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(vv,{className:"h-4 min-h-4 w-4 min-w-4 text-black dark:text-white"})}));rh.displayName=Gi.displayName;const XE=w.forwardRef(({className:e,children:t,...n},r)=>c.jsx(Gi,{ref:r,className:Se("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}));XE.displayName=Gi.displayName;const sh=w.forwardRef(({className:e,...t},n)=>c.jsx(Xm,{ref:n,className:Se("text-sm font-semibold [&+div]:text-base",e),...t}));sh.displayName=Xm.displayName;const ih=w.forwardRef(({className:e,...t},n)=>c.jsx(Jm,{ref:n,className:Se("text-lg opacity-90 ",e),...t}));ih.displayName=Jm.displayName;function JE(){const{toasts:e}=N0();return c.jsxs(ZE,{children:[e.map(({id:t,title:n,description:r,action:s,...i})=>c.jsxs(nh,{...i,children:[c.jsxs("div",{className:"grid gap-1",children:[n?c.jsx(sh,{children:n}):null,r?c.jsx(ih,{children:r}):null]}),s,c.jsx(rh,{})]},t)),c.jsx(th,{})]})}function eT(){const e=mE();return c.jsx(pE,{...e})}function tT({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=mC({symbols:u,defaultPanelAfterConfirm:t==="news"?"market":"mini"}),g=S.useRef(null),m=S.useRef(null),[h,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,E]=S.useState(()=>di(u)),[k,D]=S.useState(n??null);S.useEffect(()=>{D(n??null)},[n]);const{isLoading:I}=Xp(f.selectedLogin),N=S.useRef(null),[O,B]=S.useState(f.selectedLogin),R=S.useCallback(z=>{z!==f.selectedLogin&&f.setSelectedLogin(z)},[f.selectedLogin,f.setSelectedLogin]),H=I&&f.selectedLogin!==O,F=S.useCallback(z=>{E(z)},[]),M=S.useCallback(z=>{D(z),r==null||r(z)},[r]),{chartContainer:L}=hC({chartWidget:d?C:null,symbols:u,chartSlotElement:d?h:null,onSymbolTickerChange:F,onScanResultUrlChange:M,selectSymbolTickerRef:m}),U=d?L:x,K=S.useCallback(z=>{var de;(de=m.current)==null||de.call(m,z)},[]),j=S.useMemo(()=>({controlsRef:g,onSymbolTickerChange:F,onScanResultUrlChange:M,onChartWidgetChange:d?()=>{}:v,onChartContainerChange:d?()=>{}:_,selectSymbolTickerRef:m}),[M,F,d]);S.useEffect(()=>{if(t==="news")return g.current={open:f.openMarketPanel,setSelectedLogin:f.setSelectedLogin},()=>{g.current=null}},[f.openMarketPanel,f.setSelectedLogin,t]),S.useEffect(()=>{!I&&f.selectedLogin!==O&&B(f.selectedLogin)},[I,O,f.selectedLogin]),S.useEffect(()=>{if(!C)return;let z=!1;return(async()=>{try{const ue=await OE(C,()=>!z);if(z){ue==null||ue.remove();return}N.current=ue,$d(N.current,{accountOptions:f.accountOptions,selectedLogin:f.selectedLogin,isAccountsLoading:f.isAccountsLoading,isAccountDataLoading:H},R,U)}catch{}})(),()=>{var ue;z=!0,(ue=N.current)==null||ue.remove(),N.current=null}},[U,C]),S.useEffect(()=>{$d(N.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(eT,{}));return t==="news"?c.jsx(Bd,{value:j,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(Tp,{}),c.jsx(Lf,{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(bE,{symbolTicker:P,chartWidget:C,orderState:f})]})]}),c.jsx(rm,{onCreateNewOrder:()=>{var z;return(z=g.current)==null?void 0:z.open()}})]})}):c.jsx(Bd,{value:j,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(i0,{controlsRef:g,symbolTicker:P,chartWidget:C,scanResultUrl:k,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(uC,{symbolTicker:P,orderState:f,scanResultUrl:k,initialTab:k?"scan":"trade",onScanResultLoad:s},k??"trade-only")]}),c.jsx(tm,{symbolTicker:P,onSymbolChange:K,onCreateNewOrder:()=>{var z;return(z=g.current)==null?void 0:z.open()},dealDetailUrl:l})]})})}function nT({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(NS,{token:t,children:c.jsx(nm,{children:c.jsxs(Cp,{baseUrl:e,children:[c.jsx(tT,{variant:n,scanResultUrl:r,onScanResultUrlChange:i,chartWidget:a,onScanResultLoad:s,backUrl:l,createAccountUrl:d,dealDetailUrl:u,children:o}),c.jsx(JE,{})]})})})}exports.ChartNewsOrdersOverlay=H0;exports.WebTradingWidget=nT;
|
|
90
|
+
</svg>`,zp="data-opheleo-account-dropdown",BT="148px",$T=640,VT="MT5",Jd=new WeakMap,Wp=new WeakMap;function HT(e){e.classList.add("apply-common-tooltip"),e.style.display="inline-flex",e.style.alignItems="center",e.style.gap="6px",e.style.padding="0 8px",e.style.height="34px",e.style.cursor="pointer",e.style.border="none",e.style.background="transparent",e.style.color="inherit",e.style.fontSize="13px",e.style.fontWeight="400",e.style.whiteSpace="nowrap"}function zT(e){const t=new Set([document,e.ownerDocument]),n=e.querySelector("iframe");return n instanceof HTMLIFrameElement&&n.contentDocument&&t.add(n.contentDocument),[...t]}function Kp(e){if(!e)return!1;const t=e.querySelector("iframe");return(t instanceof HTMLIFrameElement?t.clientWidth:e.clientWidth)<$T}function WT(e){e.classList.forEach(t=>{t.includes("iconOnly")&&e.classList.remove(t)})}function KT(e,t){e.querySelectorAll("svg").forEach(n=>{n.style.display=t?"none":""})}function qT(e,t){WT(e),e.style.flexShrink="0",e.style.minWidth=t?"auto":BT,e.style.width="auto",e.style.maxWidth="none",e.style.overflow="visible",e.querySelectorAll("span, div").forEach(n=>{!(n instanceof HTMLElement)||n.querySelector("svg")||(n.style.display="",n.style.visibility="visible",n.style.opacity="1",n.style.maxWidth="none",n.style.overflow="visible",n.style.textOverflow="clip")}),KT(e,t)}function GT(e){const[t]=e.label.split(" · ");return t??e.label}function ZT(e){return`${VT} ${e.login}`}function YT(e){return`${e.label} — ${e.balance.toFixed(2)} ${e.currency}`}function QT(e,t){const n=GT(e),r=`${e.balance.toFixed(2)} ${e.currency}`;return`${e.login} · ${n} (${r})${t?" · Active":""}`}function Mc(e){return e.accountOptions.length===0?null:e.accountOptions.find(t=>t.login===e.selectedLogin)??e.accountOptions[0]}function qp(e){return e.isAccountsLoading||e.isAccountDataLoading}function XT(e){if(e.isAccountsLoading||e.accountOptions.length===0)return"";const t=Mc(e);return t?ZT(t):""}function JT(e){if(e.isAccountsLoading)return"Loading accounts…";if(e.isAccountDataLoading)return"Switching account…";const t=Mc(e);return t?YT(t):"Select your trading account"}function eE(e,t){if(!t)return qp(e)?Hp:FT}function tE(e,t){return e.isAccountsLoading?[{title:"Loading accounts…",onSelect:()=>{}}]:e.isAccountDataLoading?[{title:"Switching account…",onSelect:()=>{}}]:e.accountOptions.length===0?[{title:"No trading accounts",onSelect:()=>{}}]:e.accountOptions.map(n=>{const r=n.login===e.selectedLogin;return{title:QT(n,r),icon:r?UT:void 0,onSelect:()=>{r||t(n.login)}}})}function nE(e){for(const t of zT(e)){const n=t.querySelector(`[${zp}="true"]`);if(n instanceof HTMLElement)return n;for(const r of t.querySelectorAll("svg")){if(!(r.querySelector('rect[rx="5"]')instanceof SVGRectElement))continue;let s=r.parentElement;for(;s&&s!==t.body;){if(s.tagName==="BUTTON"||s.getAttribute("role")==="button")return s;s=s.parentElement}}}return null}function rE(e){e.style.removeProperty("background"),e.style.removeProperty("border"),e.style.removeProperty("border-radius"),e.style.removeProperty("padding"),e.style.removeProperty("font-weight"),e.style.removeProperty("color"),e.style.removeProperty("box-shadow")}function sE(e,t,n){e.setAttribute(zp,"true"),HT(e),qT(e,n);const r=Mc(t);if(!qp(t)&&r!==null){e.style.background="rgba(59, 130, 246, 0.14)",e.style.border="1px solid rgba(59, 130, 246, 0.5)",e.style.borderRadius="6px",e.style.padding="0 10px",e.style.fontWeight="600",e.style.color="#3B82F6",e.style.boxShadow="0 0 0 1px rgba(59, 130, 246, 0.08)";return}rE(e),e.style.border="1px solid transparent",e.style.borderRadius="6px",e.style.padding="0 10px"}function iE(e,t){if(!(e!=null&&e.isConnected))return;const n=Kp(e),r=()=>{const s=nE(e);s&&sE(s,t,n)};r(),requestAnimationFrame(r)}function oE(e){if(Jd.has(e))return;const t=new ResizeObserver(()=>{const r=Wp.get(e);r&&Gp(r.dropdown,r.state,r.onLoginChange,e)});t.observe(e);const n=e.querySelector("iframe");n instanceof HTMLIFrameElement&&t.observe(n),Jd.set(e,t)}function Gp(e,t,n,r){const s=Kp(r);try{e.applyOptions({title:XT(t),tooltip:JT(t),icon:eE(t,s),items:tE(t,n)})}catch{return}iE(r,t)}async function aE(e,t=()=>!0){try{await e.headerReady()}catch{return null}if(!t())return null;try{return await e.createDropdown({title:"",tooltip:"Select your trading account",align:"left",icon:Hp,items:[{title:"Loading accounts…",onSelect:()=>{}}]})}catch{return null}}function eu(e,t,n,r){!e||(r==null?void 0:r.isConnected)===!1||(r&&(Wp.set(r,{dropdown:e,state:t,onLoginChange:n}),oE(r)),Gp(e,t,n,r??null))}var Fc="ToastProvider",[Uc,cE,lE]=Fa("Toast"),[Zp]=Bn("Toast",[lE]),[dE,Qi]=Zp(Fc),Yp=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:s="right",swipeThreshold:i=50,announcerContainer:o,children:a}=e,[l,d]=w.useState(null),[f,u]=w.useState(0),g=w.useRef(!1),p=w.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${Fc}\`. Expected non-empty \`string\`.`),c.jsx(Uc.Provider,{scope:t,children:c.jsx(dE,{scope:t,label:n,duration:r,swipeDirection:s,swipeThreshold:i,toastCount:f,viewport:l,onViewportChange:d,onToastAdd:w.useCallback(()=>u(y=>y+1),[]),onToastRemove:w.useCallback(()=>u(y=>y-1),[]),isFocusedToastEscapeKeyDownRef:g,isClosePausedRef:p,announcerContainer:o,children:a})})};Yp.displayName=Fc;var Qp="ToastViewport",uE=["F8"],Ca="toast.viewportPause",Ta="toast.viewportResume",Xp=w.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=uE,label:s="Notifications ({hotkey})",...i}=e,o=Qi(Qp,n),a=cE(n),l=w.useRef(null),d=w.useRef(null),f=w.useRef(null),u=w.useRef(null),g=Oe(t,u,o.onViewportChange),p=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),y=o.toastCount>0;w.useEffect(()=>{const h=b=>{var _;r.length!==0&&r.every(x=>b[x]||b.code===x)&&((_=u.current)==null||_.focus())};return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[r]),w.useEffect(()=>{const h=l.current,b=u.current;if(y&&h&&b){const v=()=>{if(!o.isClosePausedRef.current){const T=new CustomEvent(Ca);b.dispatchEvent(T),o.isClosePausedRef.current=!0}},_=()=>{if(o.isClosePausedRef.current){const T=new CustomEvent(Ta);b.dispatchEvent(T),o.isClosePausedRef.current=!1}},x=T=>{!h.contains(T.relatedTarget)&&_()},S=()=>{h.contains(document.activeElement)||_()};return h.addEventListener("focusin",v),h.addEventListener("focusout",x),h.addEventListener("pointermove",v),h.addEventListener("pointerleave",S),window.addEventListener("blur",v),window.addEventListener("focus",_),()=>{h.removeEventListener("focusin",v),h.removeEventListener("focusout",x),h.removeEventListener("pointermove",v),h.removeEventListener("pointerleave",S),window.removeEventListener("blur",v),window.removeEventListener("focus",_)}}},[y,o.isClosePausedRef]);const m=w.useCallback(({tabbingDirection:h})=>{const v=a().map(_=>{const x=_.ref.current,S=[x,...CE(x)];return h==="forwards"?S:S.reverse()});return(h==="forwards"?v.reverse():v).flat()},[a]);return w.useEffect(()=>{const h=u.current;if(h){const b=v=>{var S,T,P;const _=v.altKey||v.ctrlKey||v.metaKey;if(v.key==="Tab"&&!_){const A=document.activeElement,D=v.shiftKey;if(v.target===h&&D){(S=d.current)==null||S.focus();return}const L=m({tabbingDirection:D?"backwards":"forwards"}),H=L.findIndex(R=>R===A);Ao(L.slice(H+1))?v.preventDefault():D?(T=d.current)==null||T.focus():(P=f.current)==null||P.focus()}};return h.addEventListener("keydown",b),()=>h.removeEventListener("keydown",b)}},[a,m]),c.jsxs(kg,{ref:l,role:"region","aria-label":s.replace("{hotkey}",p),tabIndex:-1,style:{pointerEvents:y?void 0:"none"},children:[y&&c.jsx(Ea,{ref:d,onFocusFromOutsideViewport:()=>{const h=m({tabbingDirection:"forwards"});Ao(h)}}),c.jsx(Uc.Slot,{scope:n,children:c.jsx(he.ol,{tabIndex:-1,...i,ref:g})}),y&&c.jsx(Ea,{ref:f,onFocusFromOutsideViewport:()=>{const h=m({tabbingDirection:"backwards"});Ao(h)}})]})});Xp.displayName=Qp;var Jp="ToastFocusProxy",Ea=w.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...s}=e,i=Qi(Jp,n);return c.jsx(Ga,{tabIndex:0,...s,ref:t,style:{position:"fixed"},onFocus:o=>{var d;const a=o.relatedTarget;!((d=i.viewport)!=null&&d.contains(a))&&r()}})});Ea.displayName=Jp;var bs="Toast",fE="toast.swipeStart",mE="toast.swipeMove",pE="toast.swipeCancel",hE="toast.swipeEnd",eh=w.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:s,onOpenChange:i,...o}=e,[a,l]=Ln({prop:r,defaultProp:s??!0,onChange:i,caller:bs});return c.jsx($n,{present:n||a,children:c.jsx(bE,{open:a,...o,ref:t,onClose:()=>l(!1),onPause:yt(e.onPause),onResume:yt(e.onResume),onSwipeStart:me(e.onSwipeStart,d=>{d.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:me(e.onSwipeMove,d=>{const{x:f,y:u}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","move"),d.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${f}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${u}px`)}),onSwipeCancel:me(e.onSwipeCancel,d=>{d.currentTarget.setAttribute("data-swipe","cancel"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:me(e.onSwipeEnd,d=>{const{x:f,y:u}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","end"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${f}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${u}px`),l(!1)})})})});eh.displayName=bs;var[gE,yE]=Zp(bs,{onClose(){}}),bE=w.forwardRef((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:s,open:i,onClose:o,onEscapeKeyDown:a,onPause:l,onResume:d,onSwipeStart:f,onSwipeMove:u,onSwipeCancel:g,onSwipeEnd:p,...y}=e,m=Qi(bs,n),[h,b]=w.useState(null),v=Oe(t,R=>b(R)),_=w.useRef(null),x=w.useRef(null),S=s||m.duration,T=w.useRef(0),P=w.useRef(S),A=w.useRef(0),{onToastAdd:D,onToastRemove:I}=m,N=yt(()=>{var F;(h==null?void 0:h.contains(document.activeElement))&&((F=m.viewport)==null||F.focus()),o()}),L=w.useCallback(R=>{!R||R===1/0||(window.clearTimeout(A.current),T.current=new Date().getTime(),A.current=window.setTimeout(N,R))},[N]);w.useEffect(()=>{const R=m.viewport;if(R){const F=()=>{L(P.current),d==null||d()},M=()=>{const $=new Date().getTime()-T.current;P.current=P.current-$,window.clearTimeout(A.current),l==null||l()};return R.addEventListener(Ca,M),R.addEventListener(Ta,F),()=>{R.removeEventListener(Ca,M),R.removeEventListener(Ta,F)}}},[m.viewport,S,l,d,L]),w.useEffect(()=>{i&&!m.isClosePausedRef.current&&L(S)},[i,S,m.isClosePausedRef,L]),w.useEffect(()=>(D(),()=>I()),[D,I]);const H=w.useMemo(()=>h?ah(h):null,[h]);return m.viewport?c.jsxs(c.Fragment,{children:[H&&c.jsx(vE,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:H}),c.jsx(gE,{scope:n,onClose:N,children:Cr.createPortal(c.jsx(Uc.ItemSlot,{scope:n,children:c.jsx(Pg,{asChild:!0,onEscapeKeyDown:me(a,()=>{m.isFocusedToastEscapeKeyDownRef.current||N(),m.isFocusedToastEscapeKeyDownRef.current=!1}),children:c.jsx(he.li,{tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":m.swipeDirection,...y,ref:v,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:me(e.onKeyDown,R=>{R.key==="Escape"&&(a==null||a(R.nativeEvent),R.nativeEvent.defaultPrevented||(m.isFocusedToastEscapeKeyDownRef.current=!0,N()))}),onPointerDown:me(e.onPointerDown,R=>{R.button===0&&(_.current={x:R.clientX,y:R.clientY})}),onPointerMove:me(e.onPointerMove,R=>{if(!_.current)return;const F=R.clientX-_.current.x,M=R.clientY-_.current.y,$=!!x.current,O=["left","right"].includes(m.swipeDirection),U=["left","up"].includes(m.swipeDirection)?Math.min:Math.max,W=O?U(0,F):0,j=O?0:U(0,M),ee=R.pointerType==="touch"?10:2,J={x:W,y:j},de={originalEvent:R,delta:J};$?(x.current=J,Bs(mE,u,de,{discrete:!1})):tu(J,m.swipeDirection,ee)?(x.current=J,Bs(fE,f,de,{discrete:!1}),R.target.setPointerCapture(R.pointerId)):(Math.abs(F)>ee||Math.abs(M)>ee)&&(_.current=null)}),onPointerUp:me(e.onPointerUp,R=>{const F=x.current,M=R.target;if(M.hasPointerCapture(R.pointerId)&&M.releasePointerCapture(R.pointerId),x.current=null,_.current=null,F){const $=R.currentTarget,O={originalEvent:R,delta:F};tu(F,m.swipeDirection,m.swipeThreshold)?Bs(hE,p,O,{discrete:!0}):Bs(pE,g,O,{discrete:!0}),$.addEventListener("click",U=>U.preventDefault(),{once:!0})}})})})}),m.viewport)})]}):null}),vE=e=>{const{__scopeToast:t,children:n,...r}=e,s=Qi(bs,t),[i,o]=w.useState(!1),[a,l]=w.useState(!1);return xE(()=>o(!0)),w.useEffect(()=>{const d=window.setTimeout(()=>l(!0),1e3);return()=>window.clearTimeout(d)},[]),a?null:c.jsx(Si,{asChild:!0,container:s.announcerContainer||void 0,children:c.jsx(Ga,{...r,children:i&&c.jsxs(c.Fragment,{children:[s.label," ",n]})})})},wE="ToastTitle",th=w.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return c.jsx(he.div,{...r,ref:t})});th.displayName=wE;var _E="ToastDescription",nh=w.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return c.jsx(he.div,{...r,ref:t})});nh.displayName=_E;var rh="ToastAction",sh=w.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?c.jsx(oh,{altText:n,asChild:!0,children:c.jsx(Bc,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${rh}\`. Expected non-empty \`string\`.`),null)});sh.displayName=rh;var ih="ToastClose",Bc=w.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,s=yE(ih,n);return c.jsx(oh,{asChild:!0,children:c.jsx(he.button,{type:"button",...r,ref:t,onClick:me(e.onClick,s.onClose)})})});Bc.displayName=ih;var oh=w.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...s}=e;return c.jsx(he.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...s,ref:t})});function ah(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),SE(r)){const s=r.ariaHidden||r.hidden||r.style.display==="none",i=r.dataset.radixToastAnnounceExclude==="";if(!s)if(i){const o=r.dataset.radixToastAnnounceAlt;o&&t.push(o)}else t.push(...ah(r))}}),t}function Bs(e,t,n,{discrete:r}){const s=n.originalEvent.currentTarget,i=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?_u(s,i):s.dispatchEvent(i)}var tu=(e,t,n=0)=>{const r=Math.abs(e.x),s=Math.abs(e.y),i=r>s;return t==="left"||t==="right"?i&&r>n:!i&&s>n};function xE(e=()=>{}){const t=yt(e);Ie(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function SE(e){return e.nodeType===e.ELEMENT_NODE}function CE(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Ao(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var TE=Yp,ch=Xp,lh=eh,dh=th,uh=nh,fh=sh,Xi=Bc;const EE=TE,mh=w.forwardRef(({className:e,...t},n)=>c.jsx(ch,{ref:n,className:Te("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse gap-2 p-4 sm:right-0 sm:top-[66px] sm:flex-col md:w-[520px]",e),...t}));mh.displayName=ch.displayName;const PE=Pa("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground",warning:"bg-yellow-600 group border-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),ph=w.forwardRef(({className:e,variant:t,...n},r)=>c.jsx(lh,{ref:r,className:Te(PE({variant:t}),e),...n}));ph.displayName=lh.displayName;const kE=w.forwardRef(({className:e,...t},n)=>c.jsx(fh,{ref:n,className:Te("group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t}));kE.displayName=fh.displayName;const hh=w.forwardRef(({className:e,...t},n)=>c.jsx(Xi,{ref:n,className:Te("text-foreground/50 rounded-md p-1 opacity-100 transition-opacity focus:opacity-100 focus:outline-none focus:ring-1",e),onClick:r=>{r.stopPropagation()},"toast-close":"",...t,children:c.jsx(Nv,{className:"h-4 min-h-4 w-4 min-w-4 text-black dark:text-white"})}));hh.displayName=Xi.displayName;const AE=w.forwardRef(({className:e,children:t,...n},r)=>c.jsx(Xi,{ref:r,className:Te("text-foreground/50 rounded-md p-1 opacity-100 transition-opacity focus:opacity-100 focus:outline-none focus:ring-1",e),onClick:s=>{s.stopPropagation()},"toast-close":"",...n,children:t}));AE.displayName=Xi.displayName;const gh=w.forwardRef(({className:e,...t},n)=>c.jsx(dh,{ref:n,className:Te("text-sm font-semibold [&+div]:text-base",e),...t}));gh.displayName=dh.displayName;const yh=w.forwardRef(({className:e,...t},n)=>c.jsx(uh,{ref:n,className:Te("text-lg opacity-90 ",e),...t}));yh.displayName=uh.displayName;function OE(){const{toasts:e}=K0();return c.jsxs(EE,{children:[e.map(({id:t,title:n,description:r,action:s,...i})=>c.jsxs(ph,{...i,children:[c.jsxs("div",{className:"grid gap-1",children:[n?c.jsx(gh,{children:n}):null,r?c.jsx(yh,{children:r}):null]}),s,c.jsx(hh,{})]},t)),c.jsx(mh,{})]})}function NE(){const e=LT();return c.jsx(RT,{...e})}function RE({children:e,variant:t="chart",scanResultUrl:n,onScanResultUrlChange:r,onScanResultLoad:s,chartWidget:i,backUrl:o,createAccountUrl:a,dealDetailUrl:l}){const d=i!==void 0,f=ys(),u=LC({symbols:f,defaultPanelAfterConfirm:t==="news"?"market":"mini"}),g=C.useRef(null),p=C.useRef(null),[y,m]=C.useState(null),h=C.useCallback(V=>{m(V)},[]),[b,v]=C.useState(null),[_,x]=C.useState(null),S=d?i??null:b,[T,P]=C.useState(()=>gi(f)),[A,D]=C.useState(n??null),[I,N]=C.useState(()=>n?"scan":"trade");C.useEffect(()=>{D(n??null)},[n]),C.useEffect(()=>{N(A?"scan":"trade")},[A]);const L=C.useCallback(()=>{var V;N("trade"),(V=g.current)==null||V.open()},[]),{isLoading:H}=lp(u.selectedLogin),R=C.useRef(null),[F,M]=C.useState(u.selectedLogin),$=C.useCallback(V=>{V!==u.selectedLogin&&u.setSelectedLogin(V)},[u.selectedLogin,u.setSelectedLogin]),O=H&&u.selectedLogin!==F,U=C.useCallback(V=>{P(V)},[]),W=C.useCallback(V=>{D(V),r==null||r(V)},[r]),{chartContainer:j}=DC({chartWidget:d?S:null,symbols:f,chartSlotElement:d?y:null,onSymbolTickerChange:U,onScanResultUrlChange:W,selectSymbolTickerRef:p}),ee=d?j:_,J=C.useCallback(V=>{var K;(K=p.current)==null||K.call(p,V)},[]),de=C.useMemo(()=>({controlsRef:g,onSymbolTickerChange:U,onScanResultUrlChange:W,onChartWidgetChange:d?()=>{}:v,onChartContainerChange:d?()=>{}:x,selectSymbolTickerRef:p}),[W,U,d]);C.useEffect(()=>{if(t==="news")return g.current={open:u.openMarketPanel,setSelectedLogin:u.setSelectedLogin},()=>{g.current=null}},[u.openMarketPanel,u.setSelectedLogin,t]),C.useEffect(()=>{!H&&u.selectedLogin!==F&&M(u.selectedLogin)},[H,F,u.selectedLogin]),C.useEffect(()=>{if(!S)return;let V=!1;return(async()=>{try{const se=await aE(S,()=>!V);if(V){se==null||se.remove();return}R.current=se,eu(R.current,{accountOptions:u.accountOptions,selectedLogin:u.selectedLogin,isAccountsLoading:u.isAccountsLoading,isAccountDataLoading:O},$,ee)}catch{}})(),()=>{var se;V=!0,(se=R.current)==null||se.remove(),R.current=null}},[ee,S]),C.useEffect(()=>{eu(R.current,{accountOptions:u.accountOptions,selectedLogin:u.selectedLogin,isAccountsLoading:u.isAccountsLoading,isAccountDataLoading:O},$,ee)},[ee,$,O,u.accountOptions,u.isAccountsLoading,u.selectedLogin]);const ue=e??(d?null:c.jsx(NE,{}));return t==="news"?c.jsx(Xd,{value:de,children:c.jsxs("div",{className:"web-trading-widget-trading-layout web-trading-widget-trading-layout--news",children:[c.jsxs("div",{className:"web-trading-widget-trading-layout__chart-slot",children:[c.jsx(Fm,{}),c.jsx(qf,{open:u.needsAccountSelection,isAccountsLoading:u.isAccountsLoading,accountOptions:u.accountOptions,onConfirm:u.confirmAccountSelection,backUrl:o,createAccountUrl:a}),c.jsxs("div",{className:"web-trading-widget-trading-layout__news-body",children:[d?c.jsx("div",{ref:h,className:"web-trading-widget-trading-layout__host-chart-slot",children:ue}):ue,c.jsx(MT,{symbolTicker:T,chartWidget:S,orderState:u})]})]}),c.jsx(pp,{onCreateNewOrder:()=>{var V;return(V=g.current)==null?void 0:V.open()}})]})}):c.jsx(Xd,{value:de,children:c.jsxs("div",{className:"web-trading-widget-trading-layout",children:[c.jsxs("div",{className:"web-trading-widget-trading-layout__body",children:[c.jsxs("div",{className:"web-trading-widget-trading-layout__chart-area",children:[c.jsx(x0,{controlsRef:g,symbolTicker:T,chartWidget:S,sidePanelTab:I,orderState:u,backUrl:o,createAccountUrl:a}),c.jsx("div",{ref:d?h:void 0,className:"web-trading-widget-trading-layout__chart-slot",children:ue})]}),c.jsx(OC,{symbolTicker:T,orderState:u,scanResultUrl:A,activeTab:I,onTabChange:N,onScanResultLoad:s})]}),c.jsx(fp,{symbolTicker:T,onSymbolChange:J,onCreateNewOrder:L,dealDetailUrl:l})]})})}function LE({baseUrl:e,token:t,variant:n="chart",scanResultUrl:r,onScanResultLoad:s,onScanResultUrlChange:i,children:o,chartWidget:a,backUrl:l,createAccountUrl:d,dealDetailUrl:f}){return c.jsx(WS,{token:t,children:c.jsx(mp,{children:c.jsxs(Im,{baseUrl:e,children:[c.jsx(RE,{variant:n,scanResultUrl:r,onScanResultUrlChange:i,chartWidget:a,onScanResultLoad:s,backUrl:l,createAccountUrl:d,dealDetailUrl:f,children:o}),c.jsx(OE,{})]})})})}exports.ChartNewsOrdersOverlay=oC;exports.WebTradingWidget=LE;
|