@iccandle/news 0.0.6 → 0.0.8
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/news-widget.cjs +7 -7
- package/dist/news-widget.js +495 -490
- package/package.json +1 -1
package/dist/news-widget.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode('.cta-loader__overlay{background-color:var(--iccandle-background);position:fixed;inset:0;z-index:999999;display:flex;align-items:center;justify-content:center;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px)}.cta-loader__content{position:relative;display:flex;height:100%;width:100%;flex-direction:column;align-items:center;justify-content:center;gap:9rem;padding-left:1.5rem;padding-right:1.5rem}.cta-loader__video{height:100%;max-height:18rem;width:100%;object-fit:contain}@media(min-width:768px){.cta-loader__video{max-height:20rem}}.cta-loader__bar-wrapper{width:100%;max-width:24rem}.cta-loader__bar-track{position:relative;height:.25rem;overflow:hidden;border-radius:9999px;background-color:var( --iccandle-background-secondary, rgba(128, 128, 128, .7) )}.cta-loader__bar-fill{position:absolute;top:0;bottom:0;left:0;width:100%;transform-origin:left;border-radius:9999px;background-color:var(--iccandle-primary, #ffffff);will-change:transform}.news-widget_detail_page__container{background:var(--iccandle-background);display:flex;height:100%;width:100%}.news-widget_detail_page__right_border{display:flex;flex:1;flex-direction:column;min-width:50%;border-right-style:solid;border-right-color:var(--iccandle-border);border-right-width:1px}.news-widget_detail_page__event_details{height:calc(100% - 57px)}.news-widget_detail_page__title_container{display:flex;height:57px;width:100%;align-items:center;justify-content:space-between;border-bottom-style:solid;border-bottom-color:var(--iccandle-border);border-bottom-width:1px}.news-widget_detail_page__title_padding{display:flex;align-items:center;gap:8px;padding:16px}.news-widget_detail_page__title_text{font-size:18px;line-height:calc(1.75 / 1.125);font-weight:600;color:var(--iccandle-title)}.news-widget_detail_page__back_button{height:2.25rem;width:2.25rem;border:none}.news-widget_detail_page__back_icon{color:var(--iccandle-text);height:1.25rem;width:1.25rem}.news-widget_event_details__container{background-color:var(--iccandle-background);box-sizing:border-box;display:flex;min-height:100%;width:100%;min-width:50%;flex:1;flex-direction:column;overflow:auto;gap:16px;padding:16px}.news-widget_event_details__container_sm{height:50%}@media(min-width:40rem){.news-widget_event_details__container_sm{height:100%}}.news-widget_event_details__ghost_button{background-color:var(--iccandle-background);position:absolute;right:50%;bottom:-8px;height:12px;width:24px;color:var(--iccandle-text);border-radius:calc(infinity * 1px);border-style:solid;border-width:1px;border-color:var(--iccandle-border);transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.3s}.news-widget_event_details__ghost_button_open{rotate:180deg}.news-widget_event_details__icon{height:16px;width:16px}.news-widget_event_details__chart_wrapper{position:relative;height:100%;min-height:500px}.news-widget_event_details__chart{height:100%;min-height:500px;overflow:hidden;border-radius:.75rem;border-style:solid;border-width:1px;border-color:var(--iccandle-border)}.news-widget_event_details_card__container{background-color:var(--iccandle-background);position:relative;border-radius:1rem;border-style:solid;border-width:1px;border-color:var(--iccandle-border);padding:.75rem}@media(min-width:40rem){.news-widget_event_details_card__container{min-height:170px;padding:1rem}}.news-widget_event_details_card__text{font-weight:600;color:var(--iccandle-news-details-title)}.news-widget_event_details_card__event_name{line-height:1.25;font-weight:700;font-size:1rem;color:var(--iccandle-title)}@media(min-width:40rem){.news-widget_event_details_card__event_name{font-size:1.125rem;line-height:1.75rem}}.news-widget_event_details_card__status_container{display:flex;align-items:center;gap:.25rem;font-size:.75rem;line-height:calc(1 / .75);text-wrap:nowrap;color:var(--iccandle-title)}.news-widget_event_details_card__status{height:.5rem;width:.5rem;border-radius:calc(infinity * 1px)}.news-widget_event_details_card__collapsible{display:grid;width:100%;overflow:hidden;transition:grid-template-rows .5s ease-in-out,opacity .5s ease-in-out}.news-widget_event_details_card__collapsible--open{grid-template-rows:1fr;opacity:1}.news-widget_event_details_card__collapsible--closed{grid-template-rows:0fr;opacity:0}.news-widget_event_details_card__text_bold{font-size:.875rem;line-height:1.25rem;font-weight:700}.news-widget_event_details_card__body{display:flex;height:100%;flex-direction:column;align-items:stretch;justify-content:space-between;gap:.75rem}@media(min-width:40rem){.news-widget_event_details_card__body{flex-direction:row;gap:.25rem}}.news-widget_event_details_card__left{display:flex;width:100%;flex-direction:column;gap:.5rem;border-bottom:1px solid var(--iccandle-border);padding-bottom:.75rem}@media(min-width:40rem){.news-widget_event_details_card__left{border-bottom:none;border-right:1px solid var(--iccandle-border);padding-bottom:0;padding-right:1rem}}.news-widget_event_details_card__header_row{display:flex;width:100%;align-items:flex-start;gap:.5rem}@media(min-width:40rem){.news-widget_event_details_card__header_row{align-items:center;gap:.75rem}}.news-widget_event_details_card__header_inner{display:flex;width:100%;flex-direction:column;align-items:flex-start;gap:.5rem}.news-widget_event_details_card__timestamp_row{display:flex;width:100%;align-items:center;justify-content:space-between;gap:.5rem}.news-widget_event_details_card__timestamp{font-size:.875rem;color:var(--iccandle-gray)}.news-widget_event_details_card__currency_row{display:flex;width:100%;align-items:center;gap:.5rem}@media(min-width:40rem){.news-widget_event_details_card__currency_row{max-height:2.25rem;gap:.75rem}}.news-widget_event_details_card__currency_icon{width:1.75rem;height:1.75rem;flex-shrink:0}@media(min-width:40rem){.news-widget_event_details_card__currency_icon{width:2.25rem;height:2.25rem}}.news-widget_event_details_card__currency_img{height:100%;width:100%;border-radius:9999px;object-fit:cover}.news-widget_event_details_card__speech_icon{width:1.25rem;height:1.25rem;flex-shrink:0}@media(min-width:40rem){.news-widget_event_details_card__speech_icon{width:1.75rem;height:1.75rem}}.news-widget_event_details_card__values_row{display:flex;width:100%;flex-direction:column;gap:.5rem}@media(min-width:40rem){.news-widget_event_details_card__values_row{flex-direction:row;justify-content:space-between}}.news-widget_event_details_card__values_group{display:flex;flex-wrap:wrap;align-items:flex-start;gap:.5rem}@media(min-width:40rem){.news-widget_event_details_card__values_group{align-items:center;gap:.75rem}}.news-widget_event_details_card__label{font-size:.75rem;font-weight:500;color:var(--iccandle-dark-gray)}.news-widget_event_details_card__fomc_source{margin-top:.5rem;font-size:.75rem;color:var(--iccandle-news-details-title)}@media(min-width:40rem){.news-widget_event_details_card__fomc_source{font-size:.875rem}}.news-widget_event_details_card__fomc_link{word-break:break-all;color:#3b82f6;text-decoration:underline}.news-widget_event_details_card__right{display:flex;width:100%;flex:1;flex-direction:column;align-items:flex-end;justify-content:center;gap:.75rem;padding-left:.25rem}@media(min-width:40rem){.news-widget_event_details_card__right{min-width:40%;padding-left:1rem}}.news-widget_event_details_card__description{font-size:.75rem;color:var(--iccandle-dark-gray);text-align:start;overflow-wrap:break-word;line-height:var(1 / .75)}.news-widget_event_details_card__collapsible_inner{display:flex;min-height:0;flex-direction:column;gap:1rem;overflow:hidden;padding-top:1rem;text-align:left}.news-widget_event_details_card__previous_events_list{display:flex;gap:.75rem;overflow-x:auto;padding-bottom:.75rem}.news-widget_event_details_card__info{display:flex;flex-direction:column;border-radius:.375rem;border-style:solid;border-width:1px;border-color:color-mix(in oklab,var(--iccandle-muted) 50%,transparent);padding-inline:.5rem;padding-block:.25rem;box-shadow:0 1px 2px #0000000d;text-align:left}.news-widget_news_card__container{background:var(--iccandle-background);width:220px;flex-shrink:0;border-radius:.75rem;border-style:solid;border-width:1px;border-color:var(--iccandle-border);padding:.75rem}.news-widget_news_card__title{color:var(--iccandle-news-card-title);font-size:.875rem;line-height:1.25;font-weight:600;text-align:left}.news-widget_news_card__info_card{background:color-mix(in oklab,var(--iccandle-muted) 50%,transparent);flex:1;padding:.25rem;text-align:center;border-radius:.5rem}.news-widget_news_card__font_semibold{font-weight:600}.news-widget_news_card__info_row{display:flex;align-items:stretch;gap:.25rem;font-size:.75rem;line-height:1rem}.news-widget_news_card__label{color:var(--iccandle-gray);margin-bottom:.25rem}.news-widget_news_card__header{display:flex;align-items:flex-start;gap:.75rem;margin-bottom:.75rem}.news-widget_news_card__currency_icon{width:1.75rem;height:1.75rem;flex-shrink:0}.news-widget_news_card__currency_img{height:100%;width:100%;border-radius:9999px;object-fit:cover}.news-widget_news_card__meta{min-width:0}.news-widget_news_card__date{color:var(--iccandle-gray);margin-bottom:.125rem;font-size:.75rem;line-height:1rem}.news-widget_main__container{display:flex;height:100%;width:100%;flex-direction:column;overflow-y:auto}@media(min-width:1024px){.news-widget_main__container--lg{flex-direction:row;overflow-y:unset}}.news-widget_main__iframe_full{height:100%;width:100%;border:none}.news-widget_main__iframe_half{width:100%;height:100%;border:none;flex-shrink:0}@media(min-width:1024px){.news-widget_main__container--lg .news-widget_main__iframe_half{width:50%;height:100%;flex-shrink:1}}.news-widget_main__left{width:100%;height:100%;flex-shrink:0;display:flex;flex-direction:column}@media(min-width:1024px){.news-widget_main__container--lg .news-widget_main__left{width:50%;height:100%;flex-shrink:1}}.news-widget__button{display:inline-flex;align-items:center;justify-content:center;gap:8px;white-space:nowrap;border-radius:6px;font-size:14px;font-weight:500;cursor:pointer;color:var(--iccandle-text);transition:color .15s,background-color .15s}.news-widget__button:focus-visible{outline:none;box-shadow:0 0 0 2px var(--iccandle-background),0 0 0 4px var(--iccandle-primary)}.news-widget__button:disabled{pointer-events:none;opacity:.5}.news-widget__button svg{pointer-events:none;width:16px;height:16px;flex-shrink:0}.news-widget__button--ghost{background:transparent}.news-widget__button--ghost:hover{background-color:var(--iccandle-secondary)}.news-widget__button--icon{height:40px;width:40px;padding:0}.news-widget,.news-widget *:before,.news-widget *:after{margin:0;padding:0;border:0 solid}.news-widget,.news-widget *,.news-widget *:before,.news-widget *:after{box-sizing:border-box;letter-spacing:normal}.news-widget{line-height:1.5;tab-size:4;--iccandle-primary: #00dfb9;--iccandle-primary-gradient-end: #ffb84d;--iccandle-background: #ffffff;--iccandle-border: #d1d5dc;--iccandle-text: #000000;--iccandle-secondary: oklch( from var(--iccandle-background) clamp(.92, calc(l - .06) , .98) c h / .92 );--iccandle-green: #22c55e;--iccandle-gray: #667085;--iccandle-dark-gray: #667085;--iccandle-orange: #ffb84d;--iccandle-red: #ef4444;--iccandle-title: #000;--iccandle-news-card-title: #0a0a0a;--iccandle-news-details-title: #344054;--iccandle-muted: hsl(0 0% 96.1%);font-family:var( --iccandle-font, "Inter Tight", ui-sans-serif, system-ui, sans-serif );position:relative;height:100%}.dark{--iccandle-primary: #00dfb9;--iccandle-primary-gradient-end: #ffb84d;--iccandle-background: #1a1a1a;--iccandle-border: rgba(255, 255, 255, .2);--iccandle-text: #ffffff;--iccandle-secondary: oklch( from var(--iccandle-background) clamp(.22, calc(l + .22) , .34) c h / .92 );--iccandle-green: #22c55e;--iccandle-gray: #a3a3a3;--iccandle-dark-gray: #6a7282;--iccandle-orange: #ffb84d;--iccandle-red: #ef4444;--iccandle-title: #fff;--iccandle-news-card-title: #fafafa;--iccandle-news-details-title: #d1d5dc;--iccandle-muted: hsl(0 0% 14.9%)}.news-widget__container{height:100%;width:100%}.news-widget__red{color:var(--iccandle-red)}.news-widget__green{color:var(--iccandle-green)}.news-widget__gray{color:var(--iccandle-gray)}.news-widget__orange{color:var(--iccandle-orange)}.news-widget__bg_green{background:var(--iccandle-green)}.news-widget__bg_gray{background:var(--iccandle-gray)}.news-widget__bg_orange{background:var(--iccandle-orange)}')),document.head.appendChild(e)}}catch(i){console.error("vite-plugin-css-injected-by-js",i)}})();
|
|
2
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react");var xe={exports:{}},
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react");var xe={exports:{}},be={};var ct;function mn(){if(ct)return be;ct=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(s,r,i){var o=null;if(i!==void 0&&(o=""+i),r.key!==void 0&&(o=""+r.key),"key"in r){i={};for(var a in r)a!=="key"&&(i[a]=r[a])}else i=r;return r=i.ref,{$$typeof:e,type:s,key:o,ref:r!==void 0?r:null,props:i}}return be.Fragment=t,be.jsx=n,be.jsxs=n,be}var Re={};var lt;function _n(){return lt||(lt=1,process.env.NODE_ENV!=="production"&&(function(){function e(u){if(u==null)return null;if(typeof u=="function")return u.$$typeof===le?null:u.displayName||u.name||null;if(typeof u=="string")return u;switch(u){case h:return"Fragment";case j:return"Profiler";case A:return"StrictMode";case k:return"Suspense";case q:return"SuspenseList";case M:return"Activity"}if(typeof u=="object")switch(typeof u.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),u.$$typeof){case w:return"Portal";case B:return u.displayName||"Context";case N:return(u._context.displayName||"Context")+".Consumer";case H:var C=u.render;return u=u.displayName,u||(u=C.displayName||C.name||"",u=u!==""?"ForwardRef("+u+")":"ForwardRef"),u;case re:return C=u.displayName||null,C!==null?C:e(u.type)||"Memo";case F:C=u._payload,u=u._init;try{return e(u(C))}catch{}}return null}function t(u){return""+u}function n(u){try{t(u);var C=!1}catch{C=!0}if(C){C=console;var T=C.error,S=typeof Symbol=="function"&&Symbol.toStringTag&&u[Symbol.toStringTag]||u.constructor.name||"Object";return T.call(C,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",S),t(u)}}function s(u){if(u===h)return"<>";if(typeof u=="object"&&u!==null&&u.$$typeof===F)return"<...>";try{var C=e(u);return C?"<"+C+">":"<...>"}catch{return"<...>"}}function r(){var u=W.A;return u===null?null:u.getOwner()}function i(){return Error("react-stack-top-frame")}function o(u){if(U.call(u,"key")){var C=Object.getOwnPropertyDescriptor(u,"key").get;if(C&&C.isReactWarning)return!1}return u.key!==void 0}function a(u,C){function T(){L||(L=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",C))}T.isReactWarning=!0,Object.defineProperty(u,"key",{get:T,configurable:!0})}function f(){var u=e(this.type);return ie[u]||(ie[u]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),u=this.props.ref,u!==void 0?u:null}function d(u,C,T,S,Y,I){var D=T.ref;return u={$$typeof:p,type:u,key:C,props:T,_owner:S},(D!==void 0?D:null)!==null?Object.defineProperty(u,"ref",{enumerable:!1,get:f}):Object.defineProperty(u,"ref",{enumerable:!1,value:null}),u._store={},Object.defineProperty(u._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(u,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(u,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:Y}),Object.defineProperty(u,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:I}),Object.freeze&&(Object.freeze(u.props),Object.freeze(u)),u}function l(u,C,T,S,Y,I){var D=C.children;if(D!==void 0)if(S)if(P(D)){for(S=0;S<D.length;S++)_(D[S]);Object.freeze&&Object.freeze(D)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else _(D);if(U.call(C,"key")){D=e(u);var Z=Object.keys(C).filter(function(V){return V!=="key"});S=0<Z.length?"{key: someKey, "+Z.join(": ..., ")+": ...}":"{key: someKey}",v[D+S]||(Z=0<Z.length?"{"+Z.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
3
3
|
let props = %s;
|
|
4
4
|
<%s {...props} />
|
|
5
5
|
React keys must be passed directly to JSX without using spread:
|
|
6
6
|
let props = %s;
|
|
7
|
-
<%s key={someKey} {...props} />`,S,D,Z,D),v[D+S]=!0)}if(D=null,U!==void 0&&(n(U),D=""+U),o(C)&&(n(C.key),D=""+C.key),"key"in C){U={};for(var x in C)x!=="key"&&(U[x]=C[x])}else U=C;return D&&a(U,typeof u=="function"?u.displayName||u.name||"Unknown":u),d(u,D,U,r(),Y,I)}function _(u){R(u)?u._store&&(u._store.validated=1):typeof u=="object"&&u!==null&&u.$$typeof===F&&(u._payload.status==="fulfilled"?R(u._payload.value)&&u._payload.value._store&&(u._payload.value._store.validated=1):u._store&&(u._store.validated=1))}function R(u){return typeof u=="object"&&u!==null&&u.$$typeof===p}var b=y,p=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),h=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),j=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),B=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),k=Symbol.for("react.suspense"),X=Symbol.for("react.suspense_list"),ce=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),M=Symbol.for("react.activity"),le=Symbol.for("react.client.reference"),W=b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,T=Object.prototype.hasOwnProperty,P=Array.isArray,K=console.createTask?console.createTask:function(){return null};b={react_stack_bottom_frame:function(u){return u()}};var L,re={},g=b.react_stack_bottom_frame.bind(b,i)(),z=K(s(i)),v={};be.Fragment=h,be.jsx=function(u,C,U){var S=1e4>W.recentlyCreatedOwnerStacks++;return l(u,C,U,!1,S?Error("react-stack-top-frame"):g,S?K(s(u)):z)},be.jsxs=function(u,C,U){var S=1e4>W.recentlyCreatedOwnerStacks++;return l(u,C,U,!0,S?Error("react-stack-top-frame"):g,S?K(s(u)):z)}})()),be}var lt;function hn(){return lt||(lt=1,process.env.NODE_ENV==="production"?xe.exports=mn():xe.exports=_n()),xe.exports}var m=hn();const Ft=y.createContext(null);function wn(){const e=y.useContext(Ft);if(!e)throw new Error("useCtaLoader must be used within CtaLoaderProvider");return e}const dt=1100,yn=180;function gn({children:e,theme:t}){const[n,s]=y.useState(!1),[r,i]=y.useState(!1),[o,a]=y.useState(0),f=y.useRef(null),d=y.useRef(null),l=y.useCallback(()=>{f.current&&window.clearTimeout(f.current),f.current=null,d.current&&window.clearTimeout(d.current),d.current=null,d.current=window.setTimeout(()=>{d.current=null,s(!1),i(!1)},yn)},[]),_=y.useCallback(()=>{f.current&&window.clearTimeout(f.current),f.current=null,d.current&&window.clearTimeout(d.current),d.current=null,a(p=>p+1),i(!1),s(!0),requestAnimationFrame(()=>requestAnimationFrame(()=>i(!0))),f.current=window.setTimeout(()=>{f.current=null,l()},dt)},[l]);y.useEffect(()=>l,[l]);const R=y.useMemo(()=>({start:_,stop:l,visible:n}),[_,l,n]),b=t==="light"?"https://icc-web-assets.s3.ap-southeast-1.amazonaws.com/loader/build-up-white.webm":"https://icc-web-assets.s3.ap-southeast-1.amazonaws.com/loader/build-up-black.webm";return m.jsxs(Ft.Provider,{value:R,children:[e,n&&m.jsx("div",{className:"cta-loader__overlay",children:m.jsxs("div",{className:"cta-loader__content",children:[m.jsx("video",{autoPlay:!0,loop:!0,muted:!0,playsInline:!0,preload:"auto",className:"cta-loader__video",children:m.jsx("source",{src:b,type:"video/webm"})}),m.jsx("div",{className:"cta-loader__bar-wrapper",children:m.jsx("div",{className:"cta-loader__bar-track",children:m.jsx("div",{className:"cta-loader__bar-fill",style:{transform:r?"scaleX(1)":"scaleX(0)",transition:`transform ${dt}ms linear`}},o)})})]})})]})}function jt(e,t){return function(){return e.apply(t,arguments)}}const{toString:Cn}=Object.prototype,{getPrototypeOf:Qe}=Object,{iterator:je,toStringTag:Bt}=Symbol,Be=(e=>t=>{const n=Cn.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),ue=e=>(e=e.toLowerCase(),t=>Be(t)===e),Me=e=>t=>typeof t===e,{isArray:ge}=Array,ye=Me("undefined");function Se(e){return e!==null&&!ye(e)&&e.constructor!==null&&!ye(e.constructor)&&ie(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Mt=ue("ArrayBuffer");function bn(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Mt(e.buffer),t}const Rn=Me("string"),ie=Me("function"),Yt=Me("number"),De=e=>e!==null&&typeof e=="object",En=e=>e===!0||e===!1,Pe=e=>{if(Be(e)!=="object")return!1;const t=Qe(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Bt in e)&&!(je in e)},Sn=e=>{if(!De(e)||Se(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Dn=ue("Date"),An=ue("File"),Un=ue("Blob"),Tn=ue("FileList"),Nn=e=>De(e)&&ie(e.pipe),vn=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||ie(e.append)&&((t=Be(e))==="formdata"||t==="object"&&ie(e.toString)&&e.toString()==="[object FormData]"))},xn=ue("URLSearchParams"),[Ln,Pn,On,kn]=["ReadableStream","Request","Response","Headers"].map(ue),Fn=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ae(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let s,r;if(typeof e!="object"&&(e=[e]),ge(e))for(s=0,r=e.length;s<r;s++)t.call(null,e[s],s,e);else{if(Se(e))return;const i=n?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let a;for(s=0;s<o;s++)a=i[s],t.call(null,e[a],a,e)}}function Ht(e,t){if(Se(e))return null;t=t.toLowerCase();const n=Object.keys(e);let s=n.length,r;for(;s-- >0;)if(r=n[s],t===r.toLowerCase())return r;return null}const fe=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,It=e=>!ye(e)&&e!==fe;function Je(){const{caseless:e,skipUndefined:t}=It(this)&&this||{},n={},s=(r,i)=>{if(i==="__proto__"||i==="constructor"||i==="prototype")return;const o=e&&Ht(n,i)||i;Pe(n[o])&&Pe(r)?n[o]=Je(n[o],r):Pe(r)?n[o]=Je({},r):ge(r)?n[o]=r.slice():(!t||!ye(r))&&(n[o]=r)};for(let r=0,i=arguments.length;r<i;r++)arguments[r]&&Ae(arguments[r],s);return n}const jn=(e,t,n,{allOwnKeys:s}={})=>(Ae(t,(r,i)=>{n&&ie(r)?Object.defineProperty(e,i,{value:jt(r,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,i,{value:r,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:s}),e),Bn=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Mn=(e,t,n,s)=>{e.prototype=Object.create(t.prototype,s),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},Yn=(e,t,n,s)=>{let r,i,o;const a={};if(t=t||{},e==null)return t;do{for(r=Object.getOwnPropertyNames(e),i=r.length;i-- >0;)o=r[i],(!s||s(o,e,t))&&!a[o]&&(t[o]=e[o],a[o]=!0);e=n!==!1&&Qe(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},Hn=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const s=e.indexOf(t,n);return s!==-1&&s===n},In=e=>{if(!e)return null;if(ge(e))return e;let t=e.length;if(!Yt(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},$n=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Qe(Uint8Array)),Gn=(e,t)=>{const s=(e&&e[je]).call(e);let r;for(;(r=s.next())&&!r.done;){const i=r.value;t.call(e,i[0],i[1])}},Jn=(e,t)=>{let n;const s=[];for(;(n=e.exec(t))!==null;)s.push(n);return s},Xn=ue("HTMLFormElement"),qn=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,s,r){return s.toUpperCase()+r}),ut=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Vn=ue("RegExp"),$t=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),s={};Ae(n,(r,i)=>{let o;(o=t(r,i,e))!==!1&&(s[i]=o||r)}),Object.defineProperties(e,s)},Kn=e=>{$t(e,(t,n)=>{if(ie(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const s=e[n];if(ie(s)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},zn=(e,t)=>{const n={},s=r=>{r.forEach(i=>{n[i]=!0})};return ge(e)?s(e):s(String(e).split(t)),n},Zn=()=>{},Wn=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Qn(e){return!!(e&&ie(e.append)&&e[Bt]==="FormData"&&e[je])}const es=e=>{const t=new Array(10),n=(s,r)=>{if(De(s)){if(t.indexOf(s)>=0)return;if(Se(s))return s;if(!("toJSON"in s)){t[r]=s;const i=ge(s)?[]:{};return Ae(s,(o,a)=>{const f=n(o,r+1);!ye(f)&&(i[a]=f)}),t[r]=void 0,i}}return s};return n(e,0)},ts=ue("AsyncFunction"),ns=e=>e&&(De(e)||ie(e))&&ie(e.then)&&ie(e.catch),Gt=((e,t)=>e?setImmediate:t?((n,s)=>(fe.addEventListener("message",({source:r,data:i})=>{r===fe&&i===n&&s.length&&s.shift()()},!1),r=>{s.push(r),fe.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",ie(fe.postMessage)),ss=typeof queueMicrotask<"u"?queueMicrotask.bind(fe):typeof process<"u"&&process.nextTick||Gt,rs=e=>e!=null&&ie(e[je]),c={isArray:ge,isArrayBuffer:Mt,isBuffer:Se,isFormData:vn,isArrayBufferView:bn,isString:Rn,isNumber:Yt,isBoolean:En,isObject:De,isPlainObject:Pe,isEmptyObject:Sn,isReadableStream:Ln,isRequest:Pn,isResponse:On,isHeaders:kn,isUndefined:ye,isDate:Dn,isFile:An,isBlob:Un,isRegExp:Vn,isFunction:ie,isStream:Nn,isURLSearchParams:xn,isTypedArray:$n,isFileList:Tn,forEach:Ae,merge:Je,extend:jn,trim:Fn,stripBOM:Bn,inherits:Mn,toFlatObject:Yn,kindOf:Be,kindOfTest:ue,endsWith:Hn,toArray:In,forEachEntry:Gn,matchAll:Jn,isHTMLForm:Xn,hasOwnProperty:ut,hasOwnProp:ut,reduceDescriptors:$t,freezeMethods:Kn,toObjectSet:zn,toCamelCase:qn,noop:Zn,toFiniteNumber:Wn,findKey:Ht,global:fe,isContextDefined:It,isSpecCompliantForm:Qn,toJSONObject:es,isAsyncFn:ts,isThenable:ns,setImmediate:Gt,asap:ss,isIterable:rs};let E=class Jt extends Error{static from(t,n,s,r,i,o){const a=new Jt(t.message,n||t.code,s,r,i);return a.cause=t,a.name=t.name,o&&Object.assign(a,o),a}constructor(t,n,s,r,i){super(t),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),s&&(this.config=s),r&&(this.request=r),i&&(this.response=i,this.status=i.status)}toJSON(){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:c.toJSONObject(this.config),code:this.code,status:this.status}}};E.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";E.ERR_BAD_OPTION="ERR_BAD_OPTION";E.ECONNABORTED="ECONNABORTED";E.ETIMEDOUT="ETIMEDOUT";E.ERR_NETWORK="ERR_NETWORK";E.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";E.ERR_DEPRECATED="ERR_DEPRECATED";E.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";E.ERR_BAD_REQUEST="ERR_BAD_REQUEST";E.ERR_CANCELED="ERR_CANCELED";E.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";E.ERR_INVALID_URL="ERR_INVALID_URL";const is=null;function Xe(e){return c.isPlainObject(e)||c.isArray(e)}function Xt(e){return c.endsWith(e,"[]")?e.slice(0,-2):e}function pt(e,t,n){return e?e.concat(t).map(function(r,i){return r=Xt(r),!n&&i?"["+r+"]":r}).join(n?".":""):t}function os(e){return c.isArray(e)&&!e.some(Xe)}const as=c.toFlatObject(c,{},null,function(t){return/^is[A-Z]/.test(t)});function Ye(e,t,n){if(!c.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=c.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(w,h){return!c.isUndefined(h[w])});const s=n.metaTokens,r=n.visitor||l,i=n.dots,o=n.indexes,f=(n.Blob||typeof Blob<"u"&&Blob)&&c.isSpecCompliantForm(t);if(!c.isFunction(r))throw new TypeError("visitor must be a function");function d(p){if(p===null)return"";if(c.isDate(p))return p.toISOString();if(c.isBoolean(p))return p.toString();if(!f&&c.isBlob(p))throw new E("Blob is not supported. Use a Buffer instead.");return c.isArrayBuffer(p)||c.isTypedArray(p)?f&&typeof Blob=="function"?new Blob([p]):Buffer.from(p):p}function l(p,w,h){let A=p;if(p&&!h&&typeof p=="object"){if(c.endsWith(w,"{}"))w=s?w:w.slice(0,-2),p=JSON.stringify(p);else if(c.isArray(p)&&os(p)||(c.isFileList(p)||c.endsWith(w,"[]"))&&(A=c.toArray(p)))return w=Xt(w),A.forEach(function(N,B){!(c.isUndefined(N)||N===null)&&t.append(o===!0?pt([w],B,i):o===null?w:w+"[]",d(N))}),!1}return Xe(p)?!0:(t.append(pt(h,w,i),d(p)),!1)}const _=[],R=Object.assign(as,{defaultVisitor:l,convertValue:d,isVisitable:Xe});function b(p,w){if(!c.isUndefined(p)){if(_.indexOf(p)!==-1)throw Error("Circular reference detected in "+w.join("."));_.push(p),c.forEach(p,function(A,j){(!(c.isUndefined(A)||A===null)&&r.call(t,A,c.isString(j)?j.trim():j,w,R))===!0&&b(A,w?w.concat(j):[j])}),_.pop()}}if(!c.isObject(e))throw new TypeError("data must be an object");return b(e),t}function ft(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(s){return t[s]})}function et(e,t){this._pairs=[],e&&Ye(e,this,t)}const qt=et.prototype;qt.append=function(t,n){this._pairs.push([t,n])};qt.toString=function(t){const n=t?function(s){return t.call(this,s,ft)}:ft;return this._pairs.map(function(r){return n(r[0])+"="+n(r[1])},"").join("&")};function cs(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Vt(e,t,n){if(!t)return e;const s=n&&n.encode||cs,r=c.isFunction(n)?{serialize:n}:n,i=r&&r.serialize;let o;if(i?o=i(t,r):o=c.isURLSearchParams(t)?t.toString():new et(t,r).toString(s),o){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class mt{constructor(){this.handlers=[]}use(t,n,s){return this.handlers.push({fulfilled:t,rejected:n,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){c.forEach(this.handlers,function(s){s!==null&&t(s)})}}const tt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},ls=typeof URLSearchParams<"u"?URLSearchParams:et,ds=typeof FormData<"u"?FormData:null,us=typeof Blob<"u"?Blob:null,ps={isBrowser:!0,classes:{URLSearchParams:ls,FormData:ds,Blob:us},protocols:["http","https","file","blob","url","data"]},nt=typeof window<"u"&&typeof document<"u",qe=typeof navigator=="object"&&navigator||void 0,fs=nt&&(!qe||["ReactNative","NativeScript","NS"].indexOf(qe.product)<0),ms=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",_s=nt&&window.location.href||"http://localhost",hs=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:nt,hasStandardBrowserEnv:fs,hasStandardBrowserWebWorkerEnv:ms,navigator:qe,origin:_s},Symbol.toStringTag,{value:"Module"})),te={...hs,...ps};function ws(e,t){return Ye(e,new te.classes.URLSearchParams,{visitor:function(n,s,r,i){return te.isNode&&c.isBuffer(n)?(this.append(s,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}function ys(e){return c.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function gs(e){const t={},n=Object.keys(e);let s;const r=n.length;let i;for(s=0;s<r;s++)i=n[s],t[i]=e[i];return t}function Kt(e){function t(n,s,r,i){let o=n[i++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),f=i>=n.length;return o=!o&&c.isArray(r)?r.length:o,f?(c.hasOwnProp(r,o)?r[o]=[r[o],s]:r[o]=s,!a):((!r[o]||!c.isObject(r[o]))&&(r[o]=[]),t(n,s,r[o],i)&&c.isArray(r[o])&&(r[o]=gs(r[o])),!a)}if(c.isFormData(e)&&c.isFunction(e.entries)){const n={};return c.forEachEntry(e,(s,r)=>{t(ys(s),r,n,0)}),n}return null}function Cs(e,t,n){if(c.isString(e))try{return(t||JSON.parse)(e),c.trim(e)}catch(s){if(s.name!=="SyntaxError")throw s}return(n||JSON.stringify)(e)}const Ue={transitional:tt,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const s=n.getContentType()||"",r=s.indexOf("application/json")>-1,i=c.isObject(t);if(i&&c.isHTMLForm(t)&&(t=new FormData(t)),c.isFormData(t))return r?JSON.stringify(Kt(t)):t;if(c.isArrayBuffer(t)||c.isBuffer(t)||c.isStream(t)||c.isFile(t)||c.isBlob(t)||c.isReadableStream(t))return t;if(c.isArrayBufferView(t))return t.buffer;if(c.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(i){if(s.indexOf("application/x-www-form-urlencoded")>-1)return ws(t,this.formSerializer).toString();if((a=c.isFileList(t))||s.indexOf("multipart/form-data")>-1){const f=this.env&&this.env.FormData;return Ye(a?{"files[]":t}:t,f&&new f,this.formSerializer)}}return i||r?(n.setContentType("application/json",!1),Cs(t)):t}],transformResponse:[function(t){const n=this.transitional||Ue.transitional,s=n&&n.forcedJSONParsing,r=this.responseType==="json";if(c.isResponse(t)||c.isReadableStream(t))return t;if(t&&c.isString(t)&&(s&&!this.responseType||r)){const o=!(n&&n.silentJSONParsing)&&r;try{return JSON.parse(t,this.parseReviver)}catch(a){if(o)throw a.name==="SyntaxError"?E.from(a,E.ERR_BAD_RESPONSE,this,null,this.response):a}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:te.classes.FormData,Blob:te.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};c.forEach(["delete","get","head","post","put","patch"],e=>{Ue.headers[e]={}});const bs=c.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"]),Rs=e=>{const t={};let n,s,r;return e&&e.split(`
|
|
8
|
-
`).forEach(function(o){r=o.indexOf(":"),n=o.substring(0,r).trim().toLowerCase(),s=o.substring(r+1).trim(),!(!n||t[n]&&bs[n])&&(n==="set-cookie"?t[n]?t[n].push(s):t[n]=[s]:t[n]=t[n]?t[n]+", "+s:s)}),t},
|
|
9
|
-
`)}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 s=new this(t);return n.forEach(r=>s.set(r)),s}static accessor(t){const s=(this[_t]=this[_t]={accessors:{}}).accessors,r=this.prototype;function i(o){const a=Re(o);s[a]||(As(r,o),s[a]=!0)}return c.isArray(t)?t.forEach(i):i(t),this}};oe.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);c.reduceDescriptors(oe.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(s){this[n]=s}}});c.freezeMethods(oe);function $e(e,t){const n=this||Ue,s=t||n,r=oe.from(s.headers);let i=s.data;return c.forEach(e,function(a){i=a.call(n,i,r.normalize(),t?t.status:void 0)}),r.normalize(),i}function zt(e){return!!(e&&e.__CANCEL__)}let Te=class extends E{constructor(t,n,s){super(t??"canceled",E.ERR_CANCELED,n,s),this.name="CanceledError",this.__CANCEL__=!0}};function Zt(e,t,n){const s=n.config.validateStatus;!n.status||!s||s(n.status)?e(n):t(new E("Request failed with status code "+n.status,[E.ERR_BAD_REQUEST,E.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Us(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Ts(e,t){e=e||10;const n=new Array(e),s=new Array(e);let r=0,i=0,o;return t=t!==void 0?t:1e3,function(f){const d=Date.now(),l=s[i];o||(o=d),n[r]=f,s[r]=d;let _=i,R=0;for(;_!==r;)R+=n[_++],_=_%e;if(r=(r+1)%e,r===i&&(i=(i+1)%e),d-o<t)return;const b=l&&d-l;return b?Math.round(R*1e3/b):void 0}}function Ns(e,t){let n=0,s=1e3/t,r,i;const o=(d,l=Date.now())=>{n=l,r=null,i&&(clearTimeout(i),i=null),e(...d)};return[(...d)=>{const l=Date.now(),_=l-n;_>=s?o(d,l):(r=d,i||(i=setTimeout(()=>{i=null,o(r)},s-_)))},()=>r&&o(r)]}const Fe=(e,t,n=3)=>{let s=0;const r=Ts(50,250);return Ns(i=>{const o=i.loaded,a=i.lengthComputable?i.total:void 0,f=o-s,d=r(f),l=o<=a;s=o;const _={loaded:o,total:a,progress:a?o/a:void 0,bytes:f,rate:d||void 0,estimated:d&&a&&l?(a-o)/d:void 0,event:i,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(_)},n)},ht=(e,t)=>{const n=e!=null;return[s=>t[0]({lengthComputable:n,total:e,loaded:s}),t[1]]},wt=e=>(...t)=>c.asap(()=>e(...t)),vs=te.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,te.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(te.origin),te.navigator&&/(msie|trident)/i.test(te.navigator.userAgent)):()=>!0,xs=te.hasStandardBrowserEnv?{write(e,t,n,s,r,i,o){if(typeof document>"u")return;const a=[`${e}=${encodeURIComponent(t)}`];c.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),c.isString(s)&&a.push(`path=${s}`),c.isString(r)&&a.push(`domain=${r}`),i===!0&&a.push("secure"),c.isString(o)&&a.push(`SameSite=${o}`),document.cookie=a.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Ls(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Ps(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Wt(e,t,n){let s=!Ls(t);return e&&(s||n==!1)?Ps(e,t):t}const yt=e=>e instanceof oe?{...e}:e;function he(e,t){t=t||{};const n={};function s(d,l,_,R){return c.isPlainObject(d)&&c.isPlainObject(l)?c.merge.call({caseless:R},d,l):c.isPlainObject(l)?c.merge({},l):c.isArray(l)?l.slice():l}function r(d,l,_,R){if(c.isUndefined(l)){if(!c.isUndefined(d))return s(void 0,d,_,R)}else return s(d,l,_,R)}function i(d,l){if(!c.isUndefined(l))return s(void 0,l)}function o(d,l){if(c.isUndefined(l)){if(!c.isUndefined(d))return s(void 0,d)}else return s(void 0,l)}function a(d,l,_){if(_ in t)return s(d,l);if(_ in e)return s(void 0,d)}const f={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,responseEncoding:o,validateStatus:a,headers:(d,l,_)=>r(yt(d),yt(l),_,!0)};return c.forEach(Object.keys({...e,...t}),function(l){if(l==="__proto__"||l==="constructor"||l==="prototype")return;const _=c.hasOwnProp(f,l)?f[l]:r,R=_(e[l],t[l],l);c.isUndefined(R)&&_!==a||(n[l]=R)}),n}const Qt=e=>{const t=he({},e);let{data:n,withXSRFToken:s,xsrfHeaderName:r,xsrfCookieName:i,headers:o,auth:a}=t;if(t.headers=o=oe.from(o),t.url=Vt(Wt(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),c.isFormData(n)){if(te.hasStandardBrowserEnv||te.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(c.isFunction(n.getHeaders)){const f=n.getHeaders(),d=["content-type","content-length"];Object.entries(f).forEach(([l,_])=>{d.includes(l.toLowerCase())&&o.set(l,_)})}}if(te.hasStandardBrowserEnv&&(s&&c.isFunction(s)&&(s=s(t)),s||s!==!1&&vs(t.url))){const f=r&&i&&xs.read(i);f&&o.set(r,f)}return t},Os=typeof XMLHttpRequest<"u",ks=Os&&function(e){return new Promise(function(n,s){const r=Qt(e);let i=r.data;const o=oe.from(r.headers).normalize();let{responseType:a,onUploadProgress:f,onDownloadProgress:d}=r,l,_,R,b,p;function w(){b&&b(),p&&p(),r.cancelToken&&r.cancelToken.unsubscribe(l),r.signal&&r.signal.removeEventListener("abort",l)}let h=new XMLHttpRequest;h.open(r.method.toUpperCase(),r.url,!0),h.timeout=r.timeout;function A(){if(!h)return;const N=oe.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),H={data:!a||a==="text"||a==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:N,config:e,request:h};Zt(function(X){n(X),w()},function(X){s(X),w()},H),h=null}"onloadend"in h?h.onloadend=A:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(A)},h.onabort=function(){h&&(s(new E("Request aborted",E.ECONNABORTED,e,h)),h=null)},h.onerror=function(B){const H=B&&B.message?B.message:"Network Error",k=new E(H,E.ERR_NETWORK,e,h);k.event=B||null,s(k),h=null},h.ontimeout=function(){let B=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const H=r.transitional||tt;r.timeoutErrorMessage&&(B=r.timeoutErrorMessage),s(new E(B,H.clarifyTimeoutError?E.ETIMEDOUT:E.ECONNABORTED,e,h)),h=null},i===void 0&&o.setContentType(null),"setRequestHeader"in h&&c.forEach(o.toJSON(),function(B,H){h.setRequestHeader(H,B)}),c.isUndefined(r.withCredentials)||(h.withCredentials=!!r.withCredentials),a&&a!=="json"&&(h.responseType=r.responseType),d&&([R,p]=Fe(d,!0),h.addEventListener("progress",R)),f&&h.upload&&([_,b]=Fe(f),h.upload.addEventListener("progress",_),h.upload.addEventListener("loadend",b)),(r.cancelToken||r.signal)&&(l=N=>{h&&(s(!N||N.type?new Te(null,e,h):N),h.abort(),h=null)},r.cancelToken&&r.cancelToken.subscribe(l),r.signal&&(r.signal.aborted?l():r.signal.addEventListener("abort",l)));const j=Us(r.url);if(j&&te.protocols.indexOf(j)===-1){s(new E("Unsupported protocol "+j+":",E.ERR_BAD_REQUEST,e));return}h.send(i||null)})},Fs=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let s=new AbortController,r;const i=function(d){if(!r){r=!0,a();const l=d instanceof Error?d:this.reason;s.abort(l instanceof E?l:new Te(l instanceof Error?l.message:l))}};let o=t&&setTimeout(()=>{o=null,i(new E(`timeout of ${t}ms exceeded`,E.ETIMEDOUT))},t);const a=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(d=>{d.unsubscribe?d.unsubscribe(i):d.removeEventListener("abort",i)}),e=null)};e.forEach(d=>d.addEventListener("abort",i));const{signal:f}=s;return f.unsubscribe=()=>c.asap(a),f}},js=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let s=0,r;for(;s<n;)r=s+t,yield e.slice(s,r),s=r},Bs=async function*(e,t){for await(const n of Ms(e))yield*js(n,t)},Ms=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:s}=await t.read();if(n)break;yield s}}finally{await t.cancel()}},gt=(e,t,n,s)=>{const r=Bs(e,t);let i=0,o,a=f=>{o||(o=!0,s&&s(f))};return new ReadableStream({async pull(f){try{const{done:d,value:l}=await r.next();if(d){a(),f.close();return}let _=l.byteLength;if(n){let R=i+=_;n(R)}f.enqueue(new Uint8Array(l))}catch(d){throw a(d),d}},cancel(f){return a(f),r.return()}},{highWaterMark:2})},Ct=64*1024,{isFunction:Le}=c,Ys=(({Request:e,Response:t})=>({Request:e,Response:t}))(c.global),{ReadableStream:bt,TextEncoder:Rt}=c.global,Et=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Hs=e=>{e=c.merge.call({skipUndefined:!0},Ys,e);const{fetch:t,Request:n,Response:s}=e,r=t?Le(t):typeof fetch=="function",i=Le(n),o=Le(s);if(!r)return!1;const a=r&&Le(bt),f=r&&(typeof Rt=="function"?(p=>w=>p.encode(w))(new Rt):async p=>new Uint8Array(await new n(p).arrayBuffer())),d=i&&a&&Et(()=>{let p=!1;const w=new n(te.origin,{body:new bt,method:"POST",get duplex(){return p=!0,"half"}}).headers.has("Content-Type");return p&&!w}),l=o&&a&&Et(()=>c.isReadableStream(new s("").body)),_={stream:l&&(p=>p.body)};r&&["text","arrayBuffer","blob","formData","stream"].forEach(p=>{!_[p]&&(_[p]=(w,h)=>{let A=w&&w[p];if(A)return A.call(w);throw new E(`Response type '${p}' is not supported`,E.ERR_NOT_SUPPORT,h)})});const R=async p=>{if(p==null)return 0;if(c.isBlob(p))return p.size;if(c.isSpecCompliantForm(p))return(await new n(te.origin,{method:"POST",body:p}).arrayBuffer()).byteLength;if(c.isArrayBufferView(p)||c.isArrayBuffer(p))return p.byteLength;if(c.isURLSearchParams(p)&&(p=p+""),c.isString(p))return(await f(p)).byteLength},b=async(p,w)=>{const h=c.toFiniteNumber(p.getContentLength());return h??R(w)};return async p=>{let{url:w,method:h,data:A,signal:j,cancelToken:N,timeout:B,onDownloadProgress:H,onUploadProgress:k,responseType:X,headers:ce,withCredentials:F="same-origin",fetchOptions:M}=Qt(p),le=t||fetch;X=X?(X+"").toLowerCase():"text";let W=Fs([j,N&&N.toAbortSignal()],B),T=null;const P=W&&W.unsubscribe&&(()=>{W.unsubscribe()});let K;try{if(k&&d&&h!=="get"&&h!=="head"&&(K=await b(ce,A))!==0){let u=new n(w,{method:"POST",body:A,duplex:"half"}),C;if(c.isFormData(A)&&(C=u.headers.get("content-type"))&&ce.setContentType(C),u.body){const[U,S]=ht(K,Fe(wt(k)));A=gt(u.body,Ct,U,S)}}c.isString(F)||(F=F?"include":"omit");const L=i&&"credentials"in n.prototype,re={...M,signal:W,method:h.toUpperCase(),headers:ce.normalize().toJSON(),body:A,duplex:"half",credentials:L?F:void 0};T=i&&new n(w,re);let g=await(i?le(T,M):le(w,re));const z=l&&(X==="stream"||X==="response");if(l&&(H||z&&P)){const u={};["status","statusText","headers"].forEach(Y=>{u[Y]=g[Y]});const C=c.toFiniteNumber(g.headers.get("content-length")),[U,S]=H&&ht(C,Fe(wt(H),!0))||[];g=new s(gt(g.body,Ct,U,()=>{S&&S(),P&&P()}),u)}X=X||"text";let v=await _[c.findKey(_,X)||"text"](g,p);return!z&&P&&P(),await new Promise((u,C)=>{Zt(u,C,{data:v,headers:oe.from(g.headers),status:g.status,statusText:g.statusText,config:p,request:T})})}catch(L){throw P&&P(),L&&L.name==="TypeError"&&/Load failed|fetch/i.test(L.message)?Object.assign(new E("Network Error",E.ERR_NETWORK,p,T,L&&L.response),{cause:L.cause||L}):E.from(L,L&&L.code,p,T,L&&L.response)}}},Is=new Map,en=e=>{let t=e&&e.env||{};const{fetch:n,Request:s,Response:r}=t,i=[s,r,n];let o=i.length,a=o,f,d,l=Is;for(;a--;)f=i[a],d=l.get(f),d===void 0&&l.set(f,d=a?new Map:Hs(t)),l=d;return d};en();const st={http:is,xhr:ks,fetch:{get:en}};c.forEach(st,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const St=e=>`- ${e}`,$s=e=>c.isFunction(e)||e===null||e===!1;function Gs(e,t){e=c.isArray(e)?e:[e];const{length:n}=e;let s,r;const i={};for(let o=0;o<n;o++){s=e[o];let a;if(r=s,!$s(s)&&(r=st[(a=String(s)).toLowerCase()],r===void 0))throw new E(`Unknown adapter '${a}'`);if(r&&(c.isFunction(r)||(r=r.get(t))))break;i[a||"#"+o]=r}if(!r){const o=Object.entries(i).map(([f,d])=>`adapter ${f} `+(d===!1?"is not supported by the environment":"is not available in the build"));let a=n?o.length>1?`since :
|
|
10
|
-
`+o.map(
|
|
11
|
-
`):" "+
|
|
12
|
-
`+i):s.stack=i}catch{}}throw s}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=he(this.defaults,n);const{transitional:s,paramsSerializer:r,headers:i}=n;s!==void 0&&ke.assertOptions(s,{silentJSONParsing:de.transitional(de.boolean),forcedJSONParsing:de.transitional(de.boolean),clarifyTimeoutError:de.transitional(de.boolean),legacyInterceptorReqResOrdering:de.transitional(de.boolean)},!1),r!=null&&(c.isFunction(r)?n.paramsSerializer={serialize:r}:ke.assertOptions(r,{encode:de.function,serialize:de.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),ke.assertOptions(n,{baseUrl:de.spelling("baseURL"),withXsrfToken:de.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&c.merge(i.common,i[n.method]);i&&c.forEach(["delete","get","head","post","put","patch","common"],p=>{delete i[p]}),n.headers=oe.concat(o,i);const a=[];let f=!0;this.interceptors.request.forEach(function(w){if(typeof w.runWhen=="function"&&w.runWhen(n)===!1)return;f=f&&w.synchronous;const h=n.transitional||tt;h&&h.legacyInterceptorReqResOrdering?a.unshift(w.fulfilled,w.rejected):a.push(w.fulfilled,w.rejected)});const d=[];this.interceptors.response.forEach(function(w){d.push(w.fulfilled,w.rejected)});let l,_=0,R;if(!f){const p=[Dt.bind(this),void 0];for(p.unshift(...a),p.push(...d),R=p.length,l=Promise.resolve(n);_<R;)l=l.then(p[_++],p[_++]);return l}R=a.length;let b=n;for(;_<R;){const p=a[_++],w=a[_++];try{b=p(b)}catch(h){w.call(this,h);break}}try{l=Dt.call(this,b)}catch(p){return Promise.reject(p)}for(_=0,R=d.length;_<R;)l=l.then(d[_++],d[_++]);return l}getUri(t){t=he(this.defaults,t);const n=Wt(t.baseURL,t.url,t.allowAbsoluteUrls);return Vt(n,t.params,t.paramsSerializer)}};c.forEach(["delete","get","head","options"],function(t){me.prototype[t]=function(n,s){return this.request(he(s||{},{method:t,url:n,data:(s||{}).data}))}});c.forEach(["post","put","patch"],function(t){function n(s){return function(i,o,a){return this.request(he(a||{},{method:t,headers:s?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}me.prototype[t]=n(),me.prototype[t+"Form"]=n(!0)});let Xs=class sn{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 s=this;this.promise.then(r=>{if(!s._listeners)return;let i=s._listeners.length;for(;i-- >0;)s._listeners[i](r);s._listeners=null}),this.promise.then=r=>{let i;const o=new Promise(a=>{s.subscribe(a),i=a}).then(r);return o.cancel=function(){s.unsubscribe(i)},o},t(function(i,o,a){s.reason||(s.reason=new Te(i,o,a),n(s.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=s=>{t.abort(s)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new sn(function(r){t=r}),cancel:t}}};function qs(e){return function(n){return e.apply(null,n)}}function Vs(e){return c.isObject(e)&&e.isAxiosError===!0}const Ve={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(Ve).forEach(([e,t])=>{Ve[t]=e});function rn(e){const t=new me(e),n=jt(me.prototype.request,t);return c.extend(n,me.prototype,t,{allOwnKeys:!0}),c.extend(n,t,null,{allOwnKeys:!0}),n.create=function(r){return rn(he(e,r))},n}const J=rn(Ue);J.Axios=me;J.CanceledError=Te;J.CancelToken=Xs;J.isCancel=zt;J.VERSION=nn;J.toFormData=Ye;J.AxiosError=E;J.Cancel=J.CanceledError;J.all=function(t){return Promise.all(t)};J.spread=qs;J.isAxiosError=Vs;J.mergeConfig=he;J.AxiosHeaders=oe;J.formToJSON=e=>Kt(c.isHTMLForm(e)?new FormData(e):e);J.getAdapter=tn.getAdapter;J.HttpStatusCode=Ve;J.default=J;const{Axios:kr,AxiosError:Fr,CanceledError:jr,isCancel:Br,CancelToken:Mr,VERSION:Yr,all:Hr,Cancel:Ir,isAxiosError:$r,spread:Gr,toFormData:Jr,AxiosHeaders:Xr,HttpStatusCode:qr,formToJSON:Vr,getAdapter:Kr,mergeConfig:zr}=J,Ut=e=>{let t;const n=new Set,s=(d,l)=>{const _=typeof d=="function"?d(t):d;if(!Object.is(_,t)){const R=t;t=l??(typeof _!="object"||_===null)?_:Object.assign({},t,_),n.forEach(b=>b(t,R))}},r=()=>t,a={setState:s,getState:r,getInitialState:()=>f,subscribe:d=>(n.add(d),()=>n.delete(d))},f=t=e(s,r,a);return a},Ks=(e=>e?Ut(e):Ut),zs=e=>e;function Zs(e,t=zs){const n=y.useSyncExternalStore(e.subscribe,y.useCallback(()=>t(e.getState()),[e,t]),y.useCallback(()=>t(e.getInitialState()),[e,t]));return y.useDebugValue(n),n}const Tt=e=>{const t=Ks(e),n=s=>Zs(t,s);return Object.assign(n,t),n},Ws=(e=>e?Tt(e):Tt),we=Ws(e=>({newsSelectedCandles:null,newsPlayEndTimestamp:null,newsTargetCandle:null,gapCount:0,isReplayMode:!1,setNewsSelectedCandles:t=>e({newsSelectedCandles:t}),setNewsPlayEndTimestamp:t=>e({newsPlayEndTimestamp:t}),setNewsTargetCandle:t=>e({newsTargetCandle:t}),setGapCount:t=>e({gapCount:t}),setReplayMode:t=>e({isReplayMode:t})})),Qs={"1D":"D1",D:"D1",240:"H4",120:"H2",60:"H1",30:"M30",15:"M15",5:"M5",1:"M1"},Ke=e=>({1:60,5:300,15:900,30:1800,60:3600})[e]||3600,on=[10,15,20,25,30,35,40,45,50],an=y.createContext(null),er=()=>{const e=y.useContext(an);if(!e)throw new Error("useWidgetContext must be used inside WidgetProvider");return e},tr=({children:e,selectedTimeframe:t,setSelectedTimeframe:n,currentSymbol:s,setCurrentSymbol:r})=>m.jsx(an.Provider,{value:{currentSymbol:s,setCurrentSymbol:r,selectedTimeframe:t,setSelectedTimeframe:n},children:e});const cn=(...e)=>e.filter((t,n,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===n).join(" ").trim();const nr=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const sr=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,s)=>s?s.toUpperCase():n.toLowerCase());const Nt=e=>{const t=sr(e);return t.charAt(0).toUpperCase()+t.slice(1)};var rr={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 ir=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const or=y.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:r="",children:i,iconNode:o,...a},f)=>y.createElement("svg",{ref:f,...rr,width:t,height:t,stroke:e,strokeWidth:s?Number(n)*24/Number(t):n,className:cn("lucide",r),...!i&&!ir(a)&&{"aria-hidden":"true"},...a},[...o.map(([d,l])=>y.createElement(d,l)),...Array.isArray(i)?i:[i]]));const rt=(e,t)=>{const n=y.forwardRef(({className:s,...r},i)=>y.createElement(or,{ref:i,iconNode:t,className:cn(`lucide-${nr(Nt(e))}`,`lucide-${e}`,s),...r}));return n.displayName=Nt(e),n};const ar=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],cr=rt("chevron-down",ar);const lr=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],dr=rt("chevron-left",lr);const ur=[["path",{d:"M8.8 20v-4.1l1.9.2a2.3 2.3 0 0 0 2.164-2.1V8.3A5.37 5.37 0 0 0 2 8.25c0 2.8.656 3.054 1 4.55a5.77 5.77 0 0 1 .029 2.758L2 20",key:"11atix"}],["path",{d:"M19.8 17.8a7.5 7.5 0 0 0 .003-10.603",key:"yol142"}],["path",{d:"M17 15a3.5 3.5 0 0 0-.025-4.975",key:"ssbmkc"}]],pr=rt("speech",ur),ze=(e,t)=>{if(!e||e==="-"||e.trim()===""||!t||t==="-"||t.trim()==="")return"news-widget__orange";const n=e.trim().replace(/[kKmMbB%]/g,"").replace(/[^\d.-]/g,""),s=t.trim().replace(/[kKmMbB%]/g,"").replace(/[^\d.-]/g,""),r=parseFloat(n)||0,i=parseFloat(s)||0;return r>i?"news-widget__green":r===i?"news-widget__orange":"news-widget__red"},vt=e=>e.trim().replaceAll(" ","").replaceAll("_",""),fr=new Intl.DateTimeFormat("en-US",{year:"numeric",month:"long",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}),ln=e=>{const t=fr.formatToParts(e),n=s=>t.find(r=>r.type===s)?.value??"";return`${n("year")} ${n("month")} ${n("day")}, ${n("hour")}:${n("minute")}`},mr=({currency:e,size:t=24})=>m.jsx("img",{src:`https://cdn.iccandle.ai/web-assets/${e}.svg`,className:"news-widget_news_card__currency_img",alt:e,width:t,height:t}),_r=({title:e,date:t,forecast:n,actual:s,currency:r})=>m.jsxs("div",{className:"news-widget_news_card__container",children:[m.jsxs("div",{className:"news-widget_news_card__header",children:[r&&m.jsx("div",{className:"news-widget_news_card__currency_icon",children:m.jsx(mr,{currency:r})}),m.jsxs("div",{className:"news-widget_news_card__meta",children:[m.jsx("div",{className:"news-widget_news_card__date",children:ln(new Date(t??0))}),m.jsx("div",{className:"news-widget_news_card__title",children:e})]})]}),m.jsxs("div",{className:"news-widget_news_card__info_row",children:[m.jsxs("div",{className:"news-widget_news_card__info_card",children:[m.jsx("div",{className:"news-widget_news_card__label",children:"Actual"}),m.jsx("div",{className:`news-widget_news_card__font_semibold ${ze(String(s),String(n))}`,children:s||"-"})]}),m.jsxs("div",{className:"news-widget_news_card__info_card",children:[m.jsx("div",{className:"news-widget_news_card__label",children:"Forecast"}),m.jsx("div",{className:"news-widget_news_card__font_semibold news-widget__orange",children:n||"-"})]})]})]});function hr(e){switch(e){case"post":return"news-widget__bg_green";case"early":return"news-widget__bg_gray";case"coming":return"news-widget__bg_orange"}}const wr=({eventData:e,showStatus:t=!0,showPreviousValues:n=!1,showSimilarEvents:s=!1,isSimilarEventsOpen:r=!1})=>m.jsxs("div",{className:"news-widget_event_details_card__container",children:[m.jsxs("div",{className:"news-widget_event_details_card__body",children:[m.jsxs("div",{className:"news-widget_event_details_card__left",children:[m.jsx("div",{className:"news-widget_event_details_card__header_row",children:m.jsxs("div",{className:"news-widget_event_details_card__header_inner",children:[m.jsxs("div",{className:"news-widget_event_details_card__timestamp_row",children:[m.jsxs("p",{className:"news-widget_event_details_card__timestamp",children:[e?.timestamp&&ln(new Date(e?.timestamp??0))," "]})," ",e?.status&&t&&m.jsxs("div",{className:"news-widget_event_details_card__status_container",children:[m.jsx("div",{className:`news-widget_event_details_card__status ${hr(e.status)}`}),e.status==="post"&&"Actual Released",e.status==="coming"&&"Predict Available",e.status==="early"&&"Predict Unavailable"]})," "]}),m.jsxs("div",{className:"news-widget_event_details_card__currency_row",children:[m.jsx("div",{className:"news-widget_event_details_card__currency_icon",children:m.jsx("img",{src:`https://cdn.iccandle.ai/web-assets/${e?.currency??"USD"}.svg`,className:"news-widget_event_details_card__currency_img",alt:e?.currency||"",width:36,height:36})}),m.jsxs("p",{className:"news-widget_event_details_card__event_name",children:[e?.event_name," ",e?.event_time&&` ${e?.event_time}`]}),e?.slug=="FOMC"&&m.jsx(pr,{stroke:"url(#gradient)",className:"news-widget_event_details_card__speech_icon"})]})]})}),e?.slug!="FOMC"&&m.jsxs("div",{className:"news-widget_event_details_card__values_row",children:[m.jsxs("div",{className:"news-widget_event_details_card__values_group",children:[m.jsxs("div",{className:"news-widget_event_details_card__info",children:[m.jsx("span",{className:"news-widget_event_details_card__label",children:"Actual:"}),m.jsx("span",{className:`news-widget_event_details_card__text_bold ${ze(e?.actual,e?.forecast)}`,children:e?.actual||"Soon"})]}),m.jsxs("div",{className:"news-widget_event_details_card__info",children:[m.jsx("span",{className:"news-widget_event_details_card__label",children:"Forecast:"}),m.jsx("span",{className:"news-widget_event_details_card__text_bold news-widget__orange",children:e?.forecast||"-"})]})]}),n&&m.jsxs("div",{className:"news-widget_event_details_card__values_group",children:[m.jsxs("div",{className:"news-widget_event_details_card__info",children:[m.jsx("span",{className:"news-widget_event_details_card__label",children:"Previous Actual:"}),m.jsx("span",{className:`news-widget_event_details_card__text_bold ${ze(e?.similar?.referenceEvent?.previous_actual,e?.similar?.referenceEvent?.previous_forecast)}`,children:e?.similar?.referenceEvent?.previous_actual||"-"})]}),m.jsxs("div",{className:"news-widget_event_details_card__info",children:[m.jsx("span",{className:"news-widget_event_details_card__label",children:"Previous Forecast:"}),m.jsx("span",{className:"news-widget_event_details_card__text_bold news-widget__orange",children:e?.similar?.referenceEvent?.previous_forecast||"-"})]})]})]}),e?.slug=="FOMC"&&m.jsxs("p",{className:"news-widget_event_details_card__fomc_source",children:["Source:"," ",m.jsx("a",{href:e?.resource??"#",target:"_blank",rel:"noopener noreferrer",className:"news-widget_event_details_card__fomc_link",children:"FOMC Report"})]})]}),m.jsx("div",{className:"news-widget_event_details_card__right",children:e?.description&&m.jsx("p",{className:"news-widget_event_details_card__description",children:e.description})})]}),s&&e?.similar?.referenceEvent?.previousEvents&&e?.similar?.referenceEvent?.previousEvents.length>0&&m.jsx("div",{className:`news-widget_event_details_card__collapsible ${r?"news-widget_event_details_card__collapsible--open":"news-widget_event_details_card__collapsible--closed"}`,children:r&&m.jsxs("div",{className:"news-widget_event_details_card__collapsible_inner",children:[e?.similar?.referenceEvent?.previousEvents.length>0&&m.jsxs("p",{className:"news-widget_event_details_card__text",children:["News Before This ",e?.event_name]}),e?.similar?.referenceEvent?.previousEvents.length>0&&m.jsx("div",{className:"news-widget_event_details_card__previous_events_list",children:e?.similar?.referenceEvent?.previousEvents?.map((i,o)=>m.jsx(_r,{title:i.event_name,date:new Date(i.timestamp),forecast:i.forecast,actual:i.actual,currency:e?.currency},o))})]})})]}),yr=({newsDetail:e,children:t,isCompared:n})=>{const[s,r]=y.useState(!1);return m.jsxs("div",{className:"news-widget_event_details__container news-widget_event_details__container_sm",children:[e&&m.jsxs("div",{style:{position:"relative"},children:[m.jsx(wr,{eventData:e.event,showPreviousValues:!n,showSimilarEvents:!0,isSimilarEventsOpen:s}),m.jsx("button",{type:"button",className:`news-widget__button news-widget_event_details__ghost_button ${s?"news-widget_event_details__ghost_button_open":""}`,onClick:()=>r(!s),children:m.jsx(cr,{className:"news-widget_event_details__icon"})})]}),m.jsx("div",{className:"news-widget_event_details__chart_wrapper",children:m.jsx("div",{className:"news-widget_event_details__chart",children:t})})]})},gr=[{name:"LTC_USD",type:"CFD",pipLocation:-1},{name:"HK33_HKD",type:"CFD",pipLocation:0},{name:"USD_JPY",type:"CURRENCY",pipLocation:-2},{name:"EUR_TRY",type:"CURRENCY",pipLocation:-4},{name:"BTCUSDT",type:"CRYPTO",pipLocation:0},{name:"ETHUSDT",type:"CRYPTO",pipLocation:0},{name:"XRPUSDT",type:"CRYPTO",pipLocation:-3},{name:"SOLUSDT",type:"CRYPTO",pipLocation:-1},{name:"AUD_NZD",type:"CURRENCY",pipLocation:-4},{name:"USD_THB",type:"CURRENCY",pipLocation:-2},{name:"GBP_CHF",type:"CURRENCY",pipLocation:-4},{name:"EUR_HUF",type:"CURRENCY",pipLocation:-2},{name:"EUR_ZAR",type:"CURRENCY",pipLocation:-4},{name:"NZD_JPY",type:"CURRENCY",pipLocation:-2},{name:"EUR_NZD",type:"CURRENCY",pipLocation:-4},{name:"USB02Y_USD",type:"CFD",pipLocation:-2},{name:"XAU_CAD",type:"METAL",pipLocation:-2},{name:"GBP_JPY",type:"CURRENCY",pipLocation:-2},{name:"USD_TRY",type:"CURRENCY",pipLocation:-4},{name:"EUR_NOK",type:"CURRENCY",pipLocation:-4},{name:"TRY_JPY",type:"CURRENCY",pipLocation:-2},{name:"USD_SGD",type:"CURRENCY",pipLocation:-4},{name:"EUR_SEK",type:"CURRENCY",pipLocation:-4},{name:"DE30_EUR",type:"CFD",pipLocation:0},{name:"AUD_CAD",type:"CURRENCY",pipLocation:-4},{name:"UK10YB_GBP",type:"CFD",pipLocation:-2},{name:"XPD_USD",type:"CFD",pipLocation:-2},{name:"UK100_GBP",type:"CFD",pipLocation:0},{name:"XAG_CHF",type:"METAL",pipLocation:-4},{name:"USD_CHF",type:"CURRENCY",pipLocation:-4},{name:"CHF_HKD",type:"CURRENCY",pipLocation:-4},{name:"EUR_HKD",type:"CURRENCY",pipLocation:-4},{name:"GBP_HKD",type:"CURRENCY",pipLocation:-4},{name:"XAU_NZD",type:"METAL",pipLocation:-2},{name:"GBP_NZD",type:"CURRENCY",pipLocation:-4},{name:"GBP_SGD",type:"CURRENCY",pipLocation:-4},{name:"USD_SEK",type:"CURRENCY",pipLocation:-4},{name:"EUR_SGD",type:"CURRENCY",pipLocation:-4},{name:"XAG_JPY",type:"METAL",pipLocation:0},{name:"USD_HKD",type:"CURRENCY",pipLocation:-4},{name:"XAG_HKD",type:"METAL",pipLocation:-4},{name:"XCU_USD",type:"CFD",pipLocation:-4},{name:"XAU_JPY",type:"METAL",pipLocation:1},{name:"EUR_PLN",type:"CURRENCY",pipLocation:-4},{name:"SUGAR_USD",type:"CFD",pipLocation:-4},{name:"HKD_JPY",type:"CURRENCY",pipLocation:-4},{name:"CHF_ZAR",type:"CURRENCY",pipLocation:-4},{name:"ZAR_JPY",type:"CURRENCY",pipLocation:-2},{name:"XAU_HKD",type:"METAL",pipLocation:-2},{name:"AUD_CHF",type:"CURRENCY",pipLocation:-4},{name:"EUR_CHF",type:"CURRENCY",pipLocation:-4},{name:"USD_MXN",type:"CURRENCY",pipLocation:-4},{name:"GBP_USD",type:"CURRENCY",pipLocation:-4},{name:"GBP_ZAR",type:"CURRENCY",pipLocation:-4},{name:"SGD_JPY",type:"CURRENCY",pipLocation:-2},{name:"BCH_USD",type:"CFD",pipLocation:-1},{name:"XAG_AUD",type:"METAL",pipLocation:-4},{name:"WTICO_USD",type:"CFD",pipLocation:-2},{name:"AUD_HKD",type:"CURRENCY",pipLocation:-4},{name:"AUD_SGD",type:"CURRENCY",pipLocation:-4},{name:"NZD_HKD",type:"CURRENCY",pipLocation:-4},{name:"EUR_JPY",type:"CURRENCY",pipLocation:-2},{name:"USD_NOK",type:"CURRENCY",pipLocation:-4},{name:"XAU_USD",type:"METAL",pipLocation:-1},{name:"DE10YB_EUR",type:"CFD",pipLocation:-2},{name:"USD_CZK",type:"CURRENCY",pipLocation:-4},{name:"XAU_CHF",type:"METAL",pipLocation:-2},{name:"USD_HUF",type:"CURRENCY",pipLocation:-2},{name:"WHEAT_USD",type:"CFD",pipLocation:-2},{name:"XAU_AUD",type:"METAL",pipLocation:-2},{name:"EUR_USD",type:"CURRENCY",pipLocation:-4},{name:"SG30_SGD",type:"CFD",pipLocation:-1},{name:"GBP_AUD",type:"CURRENCY",pipLocation:-4},{name:"USD_PLN",type:"CURRENCY",pipLocation:-4},{name:"NZD_CAD",type:"CURRENCY",pipLocation:-4},{name:"XAG_EUR",type:"METAL",pipLocation:-4},{name:"CORN_USD",type:"CFD",pipLocation:-2},{name:"XAG_SGD",type:"METAL",pipLocation:-4},{name:"CHINAH_HKD",type:"CFD",pipLocation:0},{name:"XAU_SGD",type:"METAL",pipLocation:-2},{name:"NZD_USD",type:"CURRENCY",pipLocation:-4},{name:"JP225Y_JPY",type:"CFD",pipLocation:0},{name:"XAG_NZD",type:"METAL",pipLocation:-4},{name:"EUR_CZK",type:"CURRENCY",pipLocation:-4},{name:"AU200_AUD",type:"CFD",pipLocation:0},{name:"SGD_CHF",type:"CURRENCY",pipLocation:-4},{name:"USD_DKK",type:"CURRENCY",pipLocation:-4},{name:"SPX500_USD",type:"CFD",pipLocation:0},{name:"NZD_SGD",type:"CURRENCY",pipLocation:-4},{name:"US30_USD",type:"CFD",pipLocation:0},{name:"NL25_EUR",type:"CFD",pipLocation:-2},{name:"JP225_USD",type:"CFD",pipLocation:0},{name:"USB30Y_USD",type:"CFD",pipLocation:-2},{name:"XAG_USD",type:"METAL",pipLocation:-4},{name:"GBP_PLN",type:"CURRENCY",pipLocation:-4},{name:"CN50_USD",type:"CFD",pipLocation:0},{name:"USB05Y_USD",type:"CFD",pipLocation:-2},{name:"AUD_USD",type:"CURRENCY",pipLocation:-4},{name:"USD_CNH",type:"CURRENCY",pipLocation:-4},{name:"EUR_GBP",type:"CURRENCY",pipLocation:-4},{name:"XAG_GBP",type:"METAL",pipLocation:-4},{name:"XAU_EUR",type:"METAL",pipLocation:-2},{name:"USD_CAD",type:"CURRENCY",pipLocation:-4},{name:"NAS100_USD",type:"CFD",pipLocation:0},{name:"EUR_CAD",type:"CURRENCY",pipLocation:-4},{name:"USB10Y_USD",type:"CFD",pipLocation:-2},{name:"EU50_EUR",type:"CFD",pipLocation:0},{name:"NATGAS_USD",type:"CFD",pipLocation:-2},{name:"CAD_JPY",type:"CURRENCY",pipLocation:-2},{name:"FR40_EUR",type:"CFD",pipLocation:0},{name:"XAU_XAG",type:"METAL",pipLocation:-2},{name:"CAD_SGD",type:"CURRENCY",pipLocation:-4},{name:"GBP_CAD",type:"CURRENCY",pipLocation:-4},{name:"USD_ZAR",type:"CURRENCY",pipLocation:-4},{name:"XAU_GBP",type:"METAL",pipLocation:-2},{name:"CH20_CHF",type:"CFD",pipLocation:0},{name:"CAD_HKD",type:"CURRENCY",pipLocation:-4},{name:"CHF_JPY",type:"CURRENCY",pipLocation:-2},{name:"NZD_CHF",type:"CURRENCY",pipLocation:-4},{name:"ESPIX_EUR",type:"CFD",pipLocation:0},{name:"XAG_CAD",type:"METAL",pipLocation:-4},{name:"XPT_USD",type:"CFD",pipLocation:-2},{name:"EUR_AUD",type:"CURRENCY",pipLocation:-4},{name:"CAD_CHF",type:"CURRENCY",pipLocation:-4},{name:"EUR_DKK",type:"CURRENCY",pipLocation:-4},{name:"SOYBN_USD",type:"CFD",pipLocation:-2},{name:"US2000_USD",type:"CFD",pipLocation:-2},{name:"BCO_USD",type:"CFD",pipLocation:-2},{name:"AUD_JPY",type:"CURRENCY",pipLocation:-2}];function Cr(e,t,n=1){if(t===0||!isFinite(t))return n;const s=e/t;return isFinite(s)?s:n}function xt(e){if(e.length===0)return 0;const t=[...e].sort((s,r)=>s-r),n=Math.floor(t.length/2);return t.length%2!==0?t[n]:(t[n-1]+t[n])/2}function br(e,t,n=[]){if(e.length===0)return[];const s=n.map(l=>Math.abs(l.c-l.o)),r=e.map(l=>Math.abs(l.c-l.o)),i=xt(r),o=xt(s),a=Cr(o,i),f=e[0].o,d=t.c;return e.map(l=>{const _=(l.o-f)*a+d,R=(l.h-f)*a+d,b=(l.l-f)*a+d,p=(l.c-f)*a+d;return{o:_,h:Math.max(R,_,p),l:Math.min(b,_,p),c:p}})}const _e=e=>e==="1"?60:e==="5"?300:e==="1D"?1440*3600:parseInt(e,10)*60,Ze=8,dn=4,We=5,un=e=>{const t=new Date(e+Ze*60*60*1e3),n=t.getUTCDay(),s=t.getUTCHours();return n===0?!1:n===1?s>=We:n===6?s<=dn:!0},pn=e=>{const t=new Date(e+Ze*60*60*1e3),n=t.getUTCDay(),s=t.getUTCHours();if(n===0||n===1&&s<We||n===6&&s>=dn){const r=(8-n)%7;return t.setUTCDate(t.getUTCDate()+r),t.setUTCHours(We,0,0,0),t.getTime()-Ze*60*60*1e3}return e},Rr=(e,t,n)=>{const s=_e(t)*1e3,r=[];let i=e;for(let o=0;o<n;o++)i+=s,un(i)||(i=pn(i)),r.push(i);return r},Lt=(e,t,n,s)=>{if(n<=0)return[];if(s==="24x7"){const i=_e(t)*1e3;return Array.from({length:n},(o,a)=>e+(a+1)*i)}if(s==="1700-1700")return Rr(e,t,n);const r=_e(t)*1e3;return Array.from({length:n},(i,o)=>e+(o+1)*r)},Er=(e,t,n,s)=>{if(s==="24x7"){const i=_e(n)*1e3;return Math.max(0,Math.floor((t-e)/i))}if(s==="1700-1700"){const i=_e(n)*1e3;let o=0,a=e;for(;a<t;)a+=i,un(a)||(a=pn(a)),a<=t&&o++;return o}const r=_e(n)*1e3;return Math.max(0,Math.floor((t-e)/r))},fn=[{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"},{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"},{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"},{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"},{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"},{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"},{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"},{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"},{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"},{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"},{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"},{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"},{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"},{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"},{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"},{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"},{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"},{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"},{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"},{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"},{ticker:"XAU_USD",display_name:"XAUUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/XAU.svg"],description:"Gold",type:"commodity",session:"1700-1700"},{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"},{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"},{ticker:"NAS100_USD",display_name:"NASDAQ100",logo_urls:["https://cdn.iccandle.ai/web-assets/NAS100.svg"],description:"NASDAQ 100",type:"indices",session:"1700-1700"},{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"},{ticker:"BTCUSDT",display_name:"BTCUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/BTC.svg"],description:"BTCUSDT",type:"crypto",session:"24x7"},{ticker:"ETHUSDT",display_name:"ETHUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/ETH.svg"],description:"ETHUSDT",type:"crypto",session:"24x7"},{ticker:"XRPUSDT",display_name:"XRPUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/XRP.svg"],description:"XRPUSDT",type:"crypto",session:"24x7"},{ticker:"SOLUSDT",display_name:"SOLUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/SOL.svg"],description:"SOLUSDT",type:"crypto",session:"24x7"},{ticker:"ADAUSDT",display_name:"ADAUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/ADA.svg"],description:"ADAUSDT",type:"crypto",session:"24x7"},{ticker:"AVAUSDT",display_name:"AVAUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/AVA.svg"],description:"AVAUSDT",type:"crypto",session:"24x7"},{ticker:"AVAXUSDT",display_name:"AVAXUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/AVAX.svg"],description:"AVAXUSDT",type:"crypto",session:"24x7"},{ticker:"BNBUSDT",display_name:"BNBUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/BNB.svg"],description:"BNBUSDT",type:"crypto",session:"24x7"},{ticker:"DOGEUSDT",display_name:"DOGEUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/DOGE.svg"],description:"DOGEUSDT",type:"crypto",session:"24x7"},{ticker:"DOTUSDT",display_name:"DOTUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/DOT.svg"],description:"DOTUSDT",type:"crypto",session:"24x7"},{ticker:"TRXUSDT",display_name:"TRXUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/TRX.svg"],description:"TRXUSDT",type:"crypto",session:"24x7"},{ticker:"AAPL",display_name:"AAPL",logo_urls:["https://cdn.iccandle.ai/web-assets/AAPL.svg"],description:"Apple Inc.",type:"stock",session:"24x7"},{ticker:"AMZN",display_name:"AMZN",logo_urls:["https://cdn.iccandle.ai/web-assets/AMZN.svg"],description:"Amazon.Com Inc",type:"stock",session:"24x7"},{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"},{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"},{ticker:"KO",display_name:"KO",logo_urls:["https://cdn.iccandle.ai/web-assets/KO.svg"],description:"Coca-Cola Company",type:"stock",session:"24x7"},{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"},{ticker:"MSFT",display_name:"MSFT",logo_urls:["https://cdn.iccandle.ai/web-assets/MSFT.svg"],description:"Microsoft Corp",type:"stock",session:"24x7"},{ticker:"NFLX",display_name:"NFLX",logo_urls:["https://cdn.iccandle.ai/web-assets/NFLX.svg"],description:"NetFlix Inc",type:"stock",session:"24x7"},{ticker:"NKE",display_name:"NKE",logo_urls:["https://cdn.iccandle.ai/web-assets/NKE.svg"],description:"Nike, Inc.",type:"stock",session:"24x7"},{ticker:"NVDA",display_name:"NVDA",logo_urls:["https://cdn.iccandle.ai/web-assets/NVDA.svg"],description:"Nvidia Corp",type:"stock",session:"24x7"},{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"},{ticker:"TSLA",display_name:"TSLA",logo_urls:["https://cdn.iccandle.ai/web-assets/TSLA.svg"],description:"Tesla, Inc. Common Stock",type:"stock",session:"24x7"},{ticker:"XAG_USD",display_name:"XAGUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/XAG.svg"],description:"Silver",type:"commodity",session:"1700-1700"},{ticker:"XCU_USD",display_name:"XCUUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/XCU.svg"],description:"Copper",type:"commodity",session:"1700-1700"}],Sr=({replayTabId:e,futureBarsRef:t,highlightBarsRef:n,tvWidgetRef:s,pushBar:r,resolution:i,symbol:o})=>{const a=we(b=>b.newsSelectedCandles),f=we(b=>b.newsTargetCandle),d=we(b=>b.newsPlayEndTimestamp),l=we(b=>b.gapCount),_=y.useRef(a),R=y.useRef(null);return y.useEffect(()=>{const b={current:null};let p=null,w=!1;return(async()=>{if(!w){if(a?.length&&f!==null){if(R.current===a)return;t.current=[];const h=d!=null;if(_.current||h)try{s?.current?.resetCache(),s?.current?.activeChart().resetData()}catch{}try{s?.current?.activeChart().executeActionById("timeScaleReset")}catch{}const j=[...a].slice(-50-(l||0)),N=br(j,f[f.length-1],f),H=fn.find(T=>T.ticker===o||T.display_name===o)?.session||"24x7",k=Lt(f[f.length-1].timestamp,i,l||0,H),X=Lt(l?k[k.length-1]:f[f.length-1].timestamp,i,N.length,H),F=N.map((T,P)=>({open:T.o,high:T.h,low:T.l,close:T.c,time:X[P]})).sort((T,P)=>T.time-P.time);n.current=F.slice(-50);let M=0,le=0;const W=async()=>{b.current&&(clearInterval(b.current),b.current=null),R.current=a;try{a&&F.length>0}catch(T){console.error("Error setting visible range:",T)}};F.length===0?(t.current=[],await W()):p=setTimeout(()=>{w||(b.current=setInterval(()=>{if(M<F.length){if(r(e,F[M]))t.current=F.slice(0,M+1),M++,le=0,M===F.length&&(t.current=F,W());else if(le++,le>=10){t.current=[...F];try{s?.current?.activeChart().resetData()}catch{}W()}}},150))},700)}else{if(t.current=[],_.current)try{s?.current?.resetCache(),s?.current?.activeChart().resetData()}catch{}R.current=null}_.current=a}})(),()=>{w=!0,p&&clearTimeout(p),b.current&&(t.current=[],clearInterval(b.current))}},[r,t,n,d,a,f,e,i,o,s,l]),y.useEffect(()=>{a===null&&(n.current=[])},[n,a]),m.jsx(m.Fragment,{})},Dr=({children:e,eventId:t,widgetKey:n,chartWidget:s,event:r,theme:i,newsDetail:o,selectedCandles:a,defaultSymbol:f,currentSymbol:d,currentTimeFrame:l,isUpcoming:_=!1,isElapsed:R=!1,onBack:b,pushBar:p,iframeRef:w,futureRef:h,pendingMessageRef:A,iframeReadyToListenRef:j,highlightBarsRef:N,setGapCountExternal:B,setReplayModeExternal:H})=>{const k=y.useRef(null),{setCurrentSymbol:X,setSelectedTimeframe:ce}=er(),{setNewsTargetCandle:F,setGapCount:M,setNewsPlayEndTimestamp:le,setNewsSelectedCandles:W}=we();return y.useEffect(()=>{if(!t||t==""||!s)return;const T=()=>{if(s){const g=s?.activeChart();g&&g.getAllShapes().forEach(z=>{try{g.removeEntity(z.id)}catch(v){console.error("Failed to remove shape",v)}})}},P=async()=>{const{data:g,status:z}=await J.get(`https://corprate-widget.iccandle.ai/news/${t}`,{headers:{"api-key":n},params:{symbol:f}});if(z!==200){console.error("Failed to fetch news detail");return}return g};let K=!1;const L=[],re=(g,z)=>{const v=window.setTimeout(g,z);return L.push(v),v};return k.current=s,s.onChartReady(async()=>{i==="dark"||i==="system"?(s.applyOverrides({"paneProperties.background":"#000000","scalesProperties.textColor":"#fff"}),s.setCSSCustomProperty("--tv-color-pane-background","#000000"),s.setCSSCustomProperty("--tv-color-platform-background","#0f0f0f")):(s.applyOverrides({"paneProperties.background":"#ffffff","scalesProperties.textColor":"#000"}),s.setCSSCustomProperty("--tv-color-pane-background","#ffffff"),s.setCSSCustomProperty("--tv-color-platform-background","#f9fafb"));const g=s.activeChart();if(!g)return;const z=async(S,Y)=>{await g.createShape({time:Y},{shape:"vertical_line",lock:!0,disableSelection:!0,overrides:{linestyle:2,linewidth:1}});const I=await g.exportData(),D=I.data.findIndex(x=>x[0]===Y);let Z=a;if(D!=-1&&!Z&&(Z=[...on].sort((x,q)=>q-x).find(x=>I.data[D+x])??null),D!=-1&&Z){const x=S,q=I.data[D+Z][0],$=I.data.filter(ae=>ae[0]>x&&ae[0]<=q)??[];let ee=null,pe=null;if($.length>0){const ae=$.reduce((ne,se,O,V)=>Number(se[3])<Number(V[ne][3])?O:ne,0),G=$[ae];pe={time:G[0],value:Number(G[3])}}if($.length>0){const ae=$.reduce((ne,se,O,V)=>Number(se[2])>Number(V[ne][2])?O:ne,0),G=$[ae];ee={time:G[0],value:Number(G[2])}}if(ee&&pe&&$.length>0){const ae=ee.value,G=pe.value,se=I.data[D+1][1];await g.createMultipointShape([{time:x,price:se},{time:q,price:ae}],{shape:"rectangle",overrides:{showLabel:!1,linecolor:"#12B76A",linewidth:1,linestyle:0,color:"#12B76A10",borderColor:"#12B76A",borderWidth:1,backgroundColor:"#12B76A",transparency:70,drawBorder:!1,frozen:!0}}),await g.createMultipointShape([{time:x,price:G},{time:q,price:se}],{shape:"rectangle",overrides:{showLabel:!1,linecolor:"#D92D2030",linewidth:1,linestyle:0,color:"#D92D2010",borderWidth:1,backgroundColor:"#D92D20",transparency:70,drawBorder:!1,frozen:!0}}),await g.createMultipointShape([{time:x,price:ae},{time:q,price:ae}],{shape:"trend_line",overrides:{linecolor:"#12B76A",linewidth:1,linestyle:2,extendLeft:!0,extendRight:!0}}),await g.createMultipointShape([{time:x,price:G},{time:q,price:G}],{shape:"trend_line",overrides:{linecolor:"#D92D20",linewidth:1,linestyle:2,extendLeft:!0,extendRight:!0}});const O=gr.find(ve=>vt(ve.name)==vt(d))?.pipLocation;let V="",Q="";if(O){const ve=Math.pow(10,-O),it=parseFloat(Math.abs((ae-se)*ve).toFixed(1)),ot=parseFloat(Math.abs((G-se)*ve).toFixed(1));V=`${it>=0?"+":""}${it.toFixed(2)} pip`,Q=`${ot>=0?"-":""}${ot.toFixed(2)} pip`}await g.createShape({time:ee.time,price:ee.value},{shape:"arrow_down",overrides:{arrowColor:"#12B76A",fontsize:11,color:"#12B76A",text:V,bold:!0}}),await g.createShape({time:pe.time,price:pe.value},{shape:"arrow_up",overrides:{arrowColor:"#D92D20",fontsize:11,color:"#D92D20",text:Q,bold:!0}});const Ne=Math.floor((x+q)/2);await g.createShape({time:Ne},{shape:"text",text:`${Z} candles`,zOrder:"top",overrides:{fontsize:12,color:"#FFFFFF",bold:!0,backgroundColor:"#FFFFFF"}})}}if(I&&I.data.length>0&&I.data[0][0]>=I.data[I.data.length-1][0]&&await g.setVisibleRange({from:I.data[0][0],to:I.data[I.data.length-1][0]}),_&&r){const x=Math.floor(Date.now()/1e3),q=Y,$=g.resolution(),ee=3600*24*7;x-ee>=q+ee&&await g.setVisibleRange({from:x-ee,to:q+ee},{applyDefaultRightMargin:!0,percentRightMargin:50}),re(()=>{K||k.current!==s||Number($)<=30&&g.createShape({time:q},{shape:"vertical_line",lock:!0,disableSelection:!0,overrides:{linestyle:2,linewidth:1}})},2e3)}},v=async()=>{if(K||k.current!==s)return;const S=await P();if(K||k.current!==s)return;T();const Y=(S?.event?.timestamp??0)/1e3,I=Ke(l),D=Y-Y%I;g.getVisibleBarsRange()||await new Promise(q=>setTimeout(q,2e3));const x=g.getVisibleBarsRange();x&&x.from<=Y&&Y<=x.to?await z(Y,D):(_||await g.setVisibleRange({from:Y},{applyDefaultRightMargin:!0,percentRightMargin:50}),await z(Y,D))},u=()=>{re(()=>{K||k.current!==s||d==g.symbol()||(async()=>{try{B(0),H(!1),W(null),w.current?.contentWindow?.postMessage({action:"handleClose"},"*"),X(g.symbol())}catch(S){console.log("error=>",S)}})()},300)},C=S=>{re(()=>{K||k.current!==s||l==S||(async()=>{try{B(0),H(!1),W(null),w.current?.contentWindow?.postMessage({action:"handleClose"},"*"),ce(S)}catch(Y){console.log("error=>",Y)}})()},300)};g.onSymbolChanged().subscribe(null,u),g.onIntervalChanged().subscribe(null,C);try{R||await v()}catch(S){console.log("error=>",S)}K&&(()=>{try{g.onSymbolChanged().unsubscribe(null,u)}catch{}try{g.onIntervalChanged().unsubscribe(null,C)}catch{}})()}),()=>{K=!0,L.forEach(g=>window.clearTimeout(g)),T(),k.current===s&&(k.current=null)}},[i,n,s,_,f,a,r,t,l,ce,d,X,R,le,W,M,F,B,H,w]),y.useEffect(()=>{s&&s.onChartReady(async()=>{const T=s?.activeChart();T&&T.onDataLoaded().subscribe(null,()=>{setTimeout(async()=>{const{data:P}=await T.exportData(),K=Ke(l),L=(r?.timestamp??0)/1e3,re=L-L%K,g=P.findIndex(v=>v[0]===re),z=P.slice(g-49,g+1).map(v=>({o:v[1],h:v[2],l:v[3],c:v[4],timestamp:v[0]*1e3}));if(_){const v=P[P.length-1],u={o:v[1],h:v[2],l:v[3],c:v[4],timestamp:v[0]*1e3},C=T.resolution(),U=_e(C)*1e3,S=u.timestamp,Y=r?.timestamp??0,I=Math.floor(Y/U)*U,D=fn.find($=>$.ticker===d||$.display_name===d)?.session||"24x7",Z=Er(S,I,C,D),x=P.slice(-50).map($=>({o:$[1],h:$[2],l:$[3],c:$[4],timestamp:$[0]*1e3}));M(Z),F(x);const q={newsTargetCandle:x,gapCount:Z};A.current=q,j.current&&(w.current?.contentWindow?.postMessage(A.current,"*"),A.current=null)}else{F(z),M(0);const v={newsTargetCandle:z,gapCount:0};A.current=v,j.current&&(w.current?.contentWindow?.postMessage(A.current,"*"),A.current=null)}},100)},!0)})},[t,r?.timestamp,F,M,l,_,d,s,A]),m.jsx("div",{className:"news-widget_detail_page__container",children:m.jsxs("div",{className:"news-widget_detail_page__right_border",children:[m.jsx("div",{className:"news-widget_detail_page__title_container",children:m.jsxs("div",{className:"news-widget_detail_page__title_padding",children:[m.jsx("button",{type:"button",className:"news-widget__button news-widget__button--ghost news-widget__button--icon news-widget_detail_page__back_button",onClick:b,children:m.jsx(dr,{className:"news-widget_detail_page__back_icon"})}),m.jsx("p",{className:"news-widget_detail_page__title_text",children:"Economic Calendar Analysis"})]})}),m.jsx("div",{className:"news-widget_detail_page__event_details",children:m.jsxs(yr,{newsDetail:o,children:[e,_&&m.jsx(Sr,{replayTabId:t||"news",futureBarsRef:h,highlightBarsRef:N,pushBar:p,tvWidgetRef:k,resolution:l||"15",symbol:d})]})})]})})},Ee="https://widget-result-news.iccandle.ai",Pt="https://corprate-widget.iccandle.ai/news",Ar=({chartWidget:e,children:t,widgetKey:n,userId:s,defaultSymbol:r,chartInterval:i="15",theme:o,symbolMapper:a,pushBar:f,futureRef:d,highlightBarsRef:l,setGapCountExternal:_,setReplayModeExternal:R})=>{const{start:b}=wn(),[p,w]=y.useState(""),[h,A]=y.useState(i),[j,N]=y.useState(r),[B,H]=y.useState(i),[k,X]=y.useState(r),[ce,F]=y.useState(null),[M,le]=y.useState(null),W=y.useRef(null),T=y.useRef(!1),{setNewsSelectedCandles:P,setNewsPlayEndTimestamp:K,newsTargetCandle:L,gapCount:re}=we(),g=y.useRef(null),z=Qs[h]||"M15",v=Ke("60"),u=M?.[0]?.timestamp?M?.[0]?.timestamp/1e3:0,C=u-u%v,U=M?.[0]?.candleData.H1?.candles,S=U?.findIndex(G=>G.timestamp===C)||0,I=(U?.length||0)-S<=10,D="next_pip_up_10"in(M?.[0]?.candleData[z]?.metadata??{}),Z=!!p&&!D,x=y.useRef(Z),q=y.useRef(!1);y.useEffect(()=>{if(Z!==x.current){if(x.current=Z,q.current){q.current=!1;return}b()}},[Z,b]),y.useEffect(()=>{const G=async O=>{const{data:V,status:Q}=await J.get(`${Pt}/${O}`,{headers:{"api-key":n},params:{symbol:r}});return Q!==200?(console.error("Failed to fetch news detail"),null):V},ne=async O=>{const{data:V,status:Q}=await J.get(`${Pt}/similar-details`,{headers:{"api-key":n},params:{event_id:O}});return Q!==200?(console.error("Failed to fetch compared news"),null):V};(async()=>{if(p==="")return;const[O,V]=await Promise.all([G(p),ne(p)]);O&&F(O),V&&le(V)})()},[n,p,r]);const $=y.useCallback(()=>{R(!1),_(0),P(null),K(null)},[R,_,P,K]),ee=y.useCallback(()=>{w(""),N(r),$()},[r,$]);y.useEffect(()=>{const G=async({origin:ne,data:se})=>{if(ne!==Ee||typeof se!="string")return;const O=JSON.parse(se);if(O.action=="back")ee();else if(O.action=="back-to-similar-events")$();else if(O.action=="eventClicked"){q.current=!0,b();const Q=O.data.event,Ne=e?.activeChart();await e?.headerReady(),Ne?.clearMarks(2),localStorage.setItem("iccandle:current-news-event",JSON.stringify({actual:Q.actual,event_name:Q.event_name,forecast:Q.forecast,id:Q.id,metric:Q.metric,previous:Q.previous,timestamp:Q.timestamp,currency:Q.currency})),Ne?.refreshMarks(),H(h),X(j),w(Q.id)}else if(O.action=="intervalChanged"||O.action=="symbolChanged"){const V=O.data;if(V.type===2)return;V.resolution&&A(V.resolution);const Q=a?.[V.symbol]??r;N(Q)}else if(O.action=="replay"){const V=O.data;R(V.isReplay),_(re),P(V.selectedCandles),K(L?.[L.length-1]?.timestamp??null)}else O.action=="iframe-ready"&&(T.current=!0,W.current?.contentWindow?.postMessage(g.current,"*"),g.current=null)};return window.addEventListener("message",G),()=>window.removeEventListener("message",G)},[L,re,e,r,b,$,ee,a,g,H,X,j,h,R,_,K,P]);const pe=y.useMemo(()=>{const G=M?.[0]?.candleData?.[z]?.metadata;return G?[...on].sort((ne,se)=>se-ne).find(ne=>[`next_pip_up_${ne}`,`next_pip_down_${ne}`].some(O=>G[O]!==void 0))??null:null},[M,z]);y.useEffect(()=>{const G=()=>{ee()};return window.addEventListener("popstate",G),()=>window.removeEventListener("popstate",G)},[ee]);const ae=y.useMemo(()=>p?M?D?`${Ee}/${p}?apiKey=${n}&userId=${s}&theme=${o}&interval=${B}&symbol=${k}`:`${Ee}/similar-events/${p}?apiKey=${n}&userId=${s}&theme=${o}`:`${Ee}?apiKey=${n}&userId=${s}&theme=${o}`:`${Ee}?apiKey=${n}&userId=${s}&theme=${o}`,[p,M,D,n,o,s,B,k]);return m.jsxs("div",{className:"news-widget_main__container news-widget_main__container--lg",children:[m.jsx("div",{className:"news-widget_main__left",style:{display:p&&!D?"flex":"none"},children:m.jsx(tr,{selectedTimeframe:h,setSelectedTimeframe:A,currentSymbol:j,setCurrentSymbol:N,children:m.jsx(Dr,{eventId:p,chartWidget:e,widgetKey:n,theme:o,defaultSymbol:r,newsDetail:ce,isUpcoming:I,event:ce?.event,selectedCandles:pe,currentTimeFrame:h,currentSymbol:j,onBack:ee,isElapsed:D,iframeRef:W,pendingMessageRef:g,iframeReadyToListenRef:T,pushBar:f,futureRef:d,highlightBarsRef:l,setReplayModeExternal:R,setGapCountExternal:_,children:t})})}),m.jsx("iframe",{src:ae,ref:W,className:p&&!D?"news-widget_main__iframe_half":"news-widget_main__iframe_full"})]})},Ur="https://api.iccandle.ai",Tr='"Inter Tight", ui-sans-serif, system-ui, sans-serif';function Ot(e){return{iccandle_primary:e.iccandle_primary,iccandle_border:e.iccandle_border,iccandle_text:e.iccandle_text,iccandle_background:e.iccandle_background,iccandle_primary_gradient_end:e.iccandle_primary_gradient_end,iccandle_font:e.icc_font??e.iccandle_font??Tr}}const Nr=async e=>{const t=await fetch(`${Ur}/corporate-client/v1/widgetStyle/search/user/?service_type=news`,{headers:{"api-key":e}});if(!t.ok)throw new Error(`Failed to fetch widget style: ${t.statusText}`);const n=await t.json();return{...n,dark:Ot(n.dark),light:Ot(n.light)}},kt={iccandle_font:"--iccandle-font",iccandle_primary:"--iccandle-primary",iccandle_border:"--iccandle-border",iccandle_text:"--iccandle-text",iccandle_background:"--iccandle-background",iccandle_primary_gradient_end:"--iccandle-primary-gradient-end"};function vr(e,t){const[n,s]=y.useState(null);y.useEffect(()=>{Nr(e).then(d=>{s(d)})},[e]);const r=y.useRef(null),[i,o]=y.useState(null),a=y.useMemo(()=>t==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":t,[t]),f=y.useMemo(()=>{if(n)return a==="dark"?n.dark:n.light},[n,a]);return y.useEffect(()=>{if(typeof window>"u"||!f||!i)return;const d=i;Object.keys(kt).forEach(l=>{d.style.setProperty(kt[l],f[l])})},[f,i]),{rootRef:r,setRootEl:o,resolvedTheme:a}}const xr=e=>{const{rootRef:t,setRootEl:n,resolvedTheme:s}=vr(e.widgetKey,e.theme);return m.jsx("div",{ref:r=>{t.current=r,n(r)},className:`news-widget__container news-widget ${s==="dark"?"dark":""}`,children:m.jsx(gn,{theme:s,children:m.jsx(Ar,{...e,children:e.children})})})};exports.NewsWidget=xr;
|
|
7
|
+
<%s key={someKey} {...props} />`,S,D,Z,D),v[D+S]=!0)}if(D=null,T!==void 0&&(n(T),D=""+T),o(C)&&(n(C.key),D=""+C.key),"key"in C){T={};for(var x in C)x!=="key"&&(T[x]=C[x])}else T=C;return D&&a(T,typeof u=="function"?u.displayName||u.name||"Unknown":u),d(u,D,T,r(),Y,I)}function _(u){b(u)?u._store&&(u._store.validated=1):typeof u=="object"&&u!==null&&u.$$typeof===F&&(u._payload.status==="fulfilled"?b(u._payload.value)&&u._payload.value._store&&(u._payload.value._store.validated=1):u._store&&(u._store.validated=1))}function b(u){return typeof u=="object"&&u!==null&&u.$$typeof===p}var R=y,p=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),h=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),j=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),B=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),k=Symbol.for("react.suspense"),q=Symbol.for("react.suspense_list"),re=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),M=Symbol.for("react.activity"),le=Symbol.for("react.client.reference"),W=R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U=Object.prototype.hasOwnProperty,P=Array.isArray,K=console.createTask?console.createTask:function(){return null};R={react_stack_bottom_frame:function(u){return u()}};var L,ie={},g=R.react_stack_bottom_frame.bind(R,i)(),z=K(s(i)),v={};Re.Fragment=h,Re.jsx=function(u,C,T){var S=1e4>W.recentlyCreatedOwnerStacks++;return l(u,C,T,!1,S?Error("react-stack-top-frame"):g,S?K(s(u)):z)},Re.jsxs=function(u,C,T){var S=1e4>W.recentlyCreatedOwnerStacks++;return l(u,C,T,!0,S?Error("react-stack-top-frame"):g,S?K(s(u)):z)}})()),Re}var dt;function hn(){return dt||(dt=1,process.env.NODE_ENV==="production"?xe.exports=mn():xe.exports=_n()),xe.exports}var m=hn();const jt=y.createContext(null);function wn(){const e=y.useContext(jt);if(!e)throw new Error("useCtaLoader must be used within CtaLoaderProvider");return e}const ut=1100,yn=180;function gn({children:e,theme:t}){const[n,s]=y.useState(!1),[r,i]=y.useState(!1),[o,a]=y.useState(0),f=y.useRef(null),d=y.useRef(null),l=y.useCallback(()=>{f.current&&window.clearTimeout(f.current),f.current=null,d.current&&window.clearTimeout(d.current),d.current=null,d.current=window.setTimeout(()=>{d.current=null,s(!1),i(!1)},yn)},[]),_=y.useCallback(()=>{f.current&&window.clearTimeout(f.current),f.current=null,d.current&&window.clearTimeout(d.current),d.current=null,a(p=>p+1),i(!1),s(!0),requestAnimationFrame(()=>requestAnimationFrame(()=>i(!0))),f.current=window.setTimeout(()=>{f.current=null,l()},ut)},[l]);y.useEffect(()=>l,[l]);const b=y.useMemo(()=>({start:_,stop:l,visible:n}),[_,l,n]),R=t==="light"?"https://icc-web-assets.s3.ap-southeast-1.amazonaws.com/loader/build-up-white.webm":"https://icc-web-assets.s3.ap-southeast-1.amazonaws.com/loader/build-up-black.webm";return m.jsxs(jt.Provider,{value:b,children:[e,n&&m.jsx("div",{className:"cta-loader__overlay",children:m.jsxs("div",{className:"cta-loader__content",children:[m.jsx("video",{autoPlay:!0,loop:!0,muted:!0,playsInline:!0,preload:"auto",className:"cta-loader__video",children:m.jsx("source",{src:R,type:"video/webm"})}),m.jsx("div",{className:"cta-loader__bar-wrapper",children:m.jsx("div",{className:"cta-loader__bar-track",children:m.jsx("div",{className:"cta-loader__bar-fill",style:{transform:r?"scaleX(1)":"scaleX(0)",transition:`transform ${ut}ms linear`}},o)})})]})})]})}function Bt(e,t){return function(){return e.apply(t,arguments)}}const{toString:Cn}=Object.prototype,{getPrototypeOf:Qe}=Object,{iterator:je,toStringTag:Mt}=Symbol,Be=(e=>t=>{const n=Cn.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),ue=e=>(e=e.toLowerCase(),t=>Be(t)===e),Me=e=>t=>typeof t===e,{isArray:Ce}=Array,ge=Me("undefined");function De(e){return e!==null&&!ge(e)&&e.constructor!==null&&!ge(e.constructor)&&oe(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Yt=ue("ArrayBuffer");function bn(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Yt(e.buffer),t}const Rn=Me("string"),oe=Me("function"),Ht=Me("number"),Ae=e=>e!==null&&typeof e=="object",En=e=>e===!0||e===!1,Pe=e=>{if(Be(e)!=="object")return!1;const t=Qe(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Mt in e)&&!(je in e)},Sn=e=>{if(!Ae(e)||De(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Dn=ue("Date"),An=ue("File"),Un=ue("Blob"),Tn=ue("FileList"),Nn=e=>Ae(e)&&oe(e.pipe),vn=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||oe(e.append)&&((t=Be(e))==="formdata"||t==="object"&&oe(e.toString)&&e.toString()==="[object FormData]"))},xn=ue("URLSearchParams"),[Ln,Pn,On,kn]=["ReadableStream","Request","Response","Headers"].map(ue),Fn=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ue(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let s,r;if(typeof e!="object"&&(e=[e]),Ce(e))for(s=0,r=e.length;s<r;s++)t.call(null,e[s],s,e);else{if(De(e))return;const i=n?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let a;for(s=0;s<o;s++)a=i[s],t.call(null,e[a],a,e)}}function It(e,t){if(De(e))return null;t=t.toLowerCase();const n=Object.keys(e);let s=n.length,r;for(;s-- >0;)if(r=n[s],t===r.toLowerCase())return r;return null}const me=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,$t=e=>!ge(e)&&e!==me;function Je(){const{caseless:e,skipUndefined:t}=$t(this)&&this||{},n={},s=(r,i)=>{if(i==="__proto__"||i==="constructor"||i==="prototype")return;const o=e&&It(n,i)||i;Pe(n[o])&&Pe(r)?n[o]=Je(n[o],r):Pe(r)?n[o]=Je({},r):Ce(r)?n[o]=r.slice():(!t||!ge(r))&&(n[o]=r)};for(let r=0,i=arguments.length;r<i;r++)arguments[r]&&Ue(arguments[r],s);return n}const jn=(e,t,n,{allOwnKeys:s}={})=>(Ue(t,(r,i)=>{n&&oe(r)?Object.defineProperty(e,i,{value:Bt(r,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,i,{value:r,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:s}),e),Bn=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Mn=(e,t,n,s)=>{e.prototype=Object.create(t.prototype,s),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},Yn=(e,t,n,s)=>{let r,i,o;const a={};if(t=t||{},e==null)return t;do{for(r=Object.getOwnPropertyNames(e),i=r.length;i-- >0;)o=r[i],(!s||s(o,e,t))&&!a[o]&&(t[o]=e[o],a[o]=!0);e=n!==!1&&Qe(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},Hn=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const s=e.indexOf(t,n);return s!==-1&&s===n},In=e=>{if(!e)return null;if(Ce(e))return e;let t=e.length;if(!Ht(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},$n=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Qe(Uint8Array)),Gn=(e,t)=>{const s=(e&&e[je]).call(e);let r;for(;(r=s.next())&&!r.done;){const i=r.value;t.call(e,i[0],i[1])}},Jn=(e,t)=>{let n;const s=[];for(;(n=e.exec(t))!==null;)s.push(n);return s},Xn=ue("HTMLFormElement"),qn=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,s,r){return s.toUpperCase()+r}),pt=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Vn=ue("RegExp"),Gt=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),s={};Ue(n,(r,i)=>{let o;(o=t(r,i,e))!==!1&&(s[i]=o||r)}),Object.defineProperties(e,s)},Kn=e=>{Gt(e,(t,n)=>{if(oe(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const s=e[n];if(oe(s)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},zn=(e,t)=>{const n={},s=r=>{r.forEach(i=>{n[i]=!0})};return Ce(e)?s(e):s(String(e).split(t)),n},Zn=()=>{},Wn=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Qn(e){return!!(e&&oe(e.append)&&e[Mt]==="FormData"&&e[je])}const es=e=>{const t=new Array(10),n=(s,r)=>{if(Ae(s)){if(t.indexOf(s)>=0)return;if(De(s))return s;if(!("toJSON"in s)){t[r]=s;const i=Ce(s)?[]:{};return Ue(s,(o,a)=>{const f=n(o,r+1);!ge(f)&&(i[a]=f)}),t[r]=void 0,i}}return s};return n(e,0)},ts=ue("AsyncFunction"),ns=e=>e&&(Ae(e)||oe(e))&&oe(e.then)&&oe(e.catch),Jt=((e,t)=>e?setImmediate:t?((n,s)=>(me.addEventListener("message",({source:r,data:i})=>{r===me&&i===n&&s.length&&s.shift()()},!1),r=>{s.push(r),me.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",oe(me.postMessage)),ss=typeof queueMicrotask<"u"?queueMicrotask.bind(me):typeof process<"u"&&process.nextTick||Jt,rs=e=>e!=null&&oe(e[je]),c={isArray:Ce,isArrayBuffer:Yt,isBuffer:De,isFormData:vn,isArrayBufferView:bn,isString:Rn,isNumber:Ht,isBoolean:En,isObject:Ae,isPlainObject:Pe,isEmptyObject:Sn,isReadableStream:Ln,isRequest:Pn,isResponse:On,isHeaders:kn,isUndefined:ge,isDate:Dn,isFile:An,isBlob:Un,isRegExp:Vn,isFunction:oe,isStream:Nn,isURLSearchParams:xn,isTypedArray:$n,isFileList:Tn,forEach:Ue,merge:Je,extend:jn,trim:Fn,stripBOM:Bn,inherits:Mn,toFlatObject:Yn,kindOf:Be,kindOfTest:ue,endsWith:Hn,toArray:In,forEachEntry:Gn,matchAll:Jn,isHTMLForm:Xn,hasOwnProperty:pt,hasOwnProp:pt,reduceDescriptors:Gt,freezeMethods:Kn,toObjectSet:zn,toCamelCase:qn,noop:Zn,toFiniteNumber:Wn,findKey:It,global:me,isContextDefined:$t,isSpecCompliantForm:Qn,toJSONObject:es,isAsyncFn:ts,isThenable:ns,setImmediate:Jt,asap:ss,isIterable:rs};let E=class Xt extends Error{static from(t,n,s,r,i,o){const a=new Xt(t.message,n||t.code,s,r,i);return a.cause=t,a.name=t.name,o&&Object.assign(a,o),a}constructor(t,n,s,r,i){super(t),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),s&&(this.config=s),r&&(this.request=r),i&&(this.response=i,this.status=i.status)}toJSON(){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:c.toJSONObject(this.config),code:this.code,status:this.status}}};E.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";E.ERR_BAD_OPTION="ERR_BAD_OPTION";E.ECONNABORTED="ECONNABORTED";E.ETIMEDOUT="ETIMEDOUT";E.ERR_NETWORK="ERR_NETWORK";E.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";E.ERR_DEPRECATED="ERR_DEPRECATED";E.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";E.ERR_BAD_REQUEST="ERR_BAD_REQUEST";E.ERR_CANCELED="ERR_CANCELED";E.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";E.ERR_INVALID_URL="ERR_INVALID_URL";const is=null;function Xe(e){return c.isPlainObject(e)||c.isArray(e)}function qt(e){return c.endsWith(e,"[]")?e.slice(0,-2):e}function ft(e,t,n){return e?e.concat(t).map(function(r,i){return r=qt(r),!n&&i?"["+r+"]":r}).join(n?".":""):t}function os(e){return c.isArray(e)&&!e.some(Xe)}const as=c.toFlatObject(c,{},null,function(t){return/^is[A-Z]/.test(t)});function Ye(e,t,n){if(!c.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=c.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(w,h){return!c.isUndefined(h[w])});const s=n.metaTokens,r=n.visitor||l,i=n.dots,o=n.indexes,f=(n.Blob||typeof Blob<"u"&&Blob)&&c.isSpecCompliantForm(t);if(!c.isFunction(r))throw new TypeError("visitor must be a function");function d(p){if(p===null)return"";if(c.isDate(p))return p.toISOString();if(c.isBoolean(p))return p.toString();if(!f&&c.isBlob(p))throw new E("Blob is not supported. Use a Buffer instead.");return c.isArrayBuffer(p)||c.isTypedArray(p)?f&&typeof Blob=="function"?new Blob([p]):Buffer.from(p):p}function l(p,w,h){let A=p;if(p&&!h&&typeof p=="object"){if(c.endsWith(w,"{}"))w=s?w:w.slice(0,-2),p=JSON.stringify(p);else if(c.isArray(p)&&os(p)||(c.isFileList(p)||c.endsWith(w,"[]"))&&(A=c.toArray(p)))return w=qt(w),A.forEach(function(N,B){!(c.isUndefined(N)||N===null)&&t.append(o===!0?ft([w],B,i):o===null?w:w+"[]",d(N))}),!1}return Xe(p)?!0:(t.append(ft(h,w,i),d(p)),!1)}const _=[],b=Object.assign(as,{defaultVisitor:l,convertValue:d,isVisitable:Xe});function R(p,w){if(!c.isUndefined(p)){if(_.indexOf(p)!==-1)throw Error("Circular reference detected in "+w.join("."));_.push(p),c.forEach(p,function(A,j){(!(c.isUndefined(A)||A===null)&&r.call(t,A,c.isString(j)?j.trim():j,w,b))===!0&&R(A,w?w.concat(j):[j])}),_.pop()}}if(!c.isObject(e))throw new TypeError("data must be an object");return R(e),t}function mt(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(s){return t[s]})}function et(e,t){this._pairs=[],e&&Ye(e,this,t)}const Vt=et.prototype;Vt.append=function(t,n){this._pairs.push([t,n])};Vt.toString=function(t){const n=t?function(s){return t.call(this,s,mt)}:mt;return this._pairs.map(function(r){return n(r[0])+"="+n(r[1])},"").join("&")};function cs(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Kt(e,t,n){if(!t)return e;const s=n&&n.encode||cs,r=c.isFunction(n)?{serialize:n}:n,i=r&&r.serialize;let o;if(i?o=i(t,r):o=c.isURLSearchParams(t)?t.toString():new et(t,r).toString(s),o){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class _t{constructor(){this.handlers=[]}use(t,n,s){return this.handlers.push({fulfilled:t,rejected:n,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){c.forEach(this.handlers,function(s){s!==null&&t(s)})}}const tt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},ls=typeof URLSearchParams<"u"?URLSearchParams:et,ds=typeof FormData<"u"?FormData:null,us=typeof Blob<"u"?Blob:null,ps={isBrowser:!0,classes:{URLSearchParams:ls,FormData:ds,Blob:us},protocols:["http","https","file","blob","url","data"]},nt=typeof window<"u"&&typeof document<"u",qe=typeof navigator=="object"&&navigator||void 0,fs=nt&&(!qe||["ReactNative","NativeScript","NS"].indexOf(qe.product)<0),ms=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",_s=nt&&window.location.href||"http://localhost",hs=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:nt,hasStandardBrowserEnv:fs,hasStandardBrowserWebWorkerEnv:ms,navigator:qe,origin:_s},Symbol.toStringTag,{value:"Module"})),te={...hs,...ps};function ws(e,t){return Ye(e,new te.classes.URLSearchParams,{visitor:function(n,s,r,i){return te.isNode&&c.isBuffer(n)?(this.append(s,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}function ys(e){return c.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function gs(e){const t={},n=Object.keys(e);let s;const r=n.length;let i;for(s=0;s<r;s++)i=n[s],t[i]=e[i];return t}function zt(e){function t(n,s,r,i){let o=n[i++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),f=i>=n.length;return o=!o&&c.isArray(r)?r.length:o,f?(c.hasOwnProp(r,o)?r[o]=[r[o],s]:r[o]=s,!a):((!r[o]||!c.isObject(r[o]))&&(r[o]=[]),t(n,s,r[o],i)&&c.isArray(r[o])&&(r[o]=gs(r[o])),!a)}if(c.isFormData(e)&&c.isFunction(e.entries)){const n={};return c.forEachEntry(e,(s,r)=>{t(ys(s),r,n,0)}),n}return null}function Cs(e,t,n){if(c.isString(e))try{return(t||JSON.parse)(e),c.trim(e)}catch(s){if(s.name!=="SyntaxError")throw s}return(n||JSON.stringify)(e)}const Te={transitional:tt,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const s=n.getContentType()||"",r=s.indexOf("application/json")>-1,i=c.isObject(t);if(i&&c.isHTMLForm(t)&&(t=new FormData(t)),c.isFormData(t))return r?JSON.stringify(zt(t)):t;if(c.isArrayBuffer(t)||c.isBuffer(t)||c.isStream(t)||c.isFile(t)||c.isBlob(t)||c.isReadableStream(t))return t;if(c.isArrayBufferView(t))return t.buffer;if(c.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(i){if(s.indexOf("application/x-www-form-urlencoded")>-1)return ws(t,this.formSerializer).toString();if((a=c.isFileList(t))||s.indexOf("multipart/form-data")>-1){const f=this.env&&this.env.FormData;return Ye(a?{"files[]":t}:t,f&&new f,this.formSerializer)}}return i||r?(n.setContentType("application/json",!1),Cs(t)):t}],transformResponse:[function(t){const n=this.transitional||Te.transitional,s=n&&n.forcedJSONParsing,r=this.responseType==="json";if(c.isResponse(t)||c.isReadableStream(t))return t;if(t&&c.isString(t)&&(s&&!this.responseType||r)){const o=!(n&&n.silentJSONParsing)&&r;try{return JSON.parse(t,this.parseReviver)}catch(a){if(o)throw a.name==="SyntaxError"?E.from(a,E.ERR_BAD_RESPONSE,this,null,this.response):a}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:te.classes.FormData,Blob:te.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};c.forEach(["delete","get","head","post","put","patch"],e=>{Te.headers[e]={}});const bs=c.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"]),Rs=e=>{const t={};let n,s,r;return e&&e.split(`
|
|
8
|
+
`).forEach(function(o){r=o.indexOf(":"),n=o.substring(0,r).trim().toLowerCase(),s=o.substring(r+1).trim(),!(!n||t[n]&&bs[n])&&(n==="set-cookie"?t[n]?t[n].push(s):t[n]=[s]:t[n]=t[n]?t[n]+", "+s:s)}),t},ht=Symbol("internals");function Ee(e){return e&&String(e).trim().toLowerCase()}function Oe(e){return e===!1||e==null?e:c.isArray(e)?e.map(Oe):String(e)}function Es(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=n.exec(e);)t[s[1]]=s[2];return t}const Ss=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Ie(e,t,n,s,r){if(c.isFunction(s))return s.call(this,t,n);if(r&&(t=n),!!c.isString(t)){if(c.isString(s))return t.indexOf(s)!==-1;if(c.isRegExp(s))return s.test(t)}}function Ds(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,s)=>n.toUpperCase()+s)}function As(e,t){const n=c.toCamelCase(" "+t);["get","set","has"].forEach(s=>{Object.defineProperty(e,s+n,{value:function(r,i,o){return this[s].call(this,t,r,i,o)},configurable:!0})})}let ae=class{constructor(t){t&&this.set(t)}set(t,n,s){const r=this;function i(a,f,d){const l=Ee(f);if(!l)throw new Error("header name must be a non-empty string");const _=c.findKey(r,l);(!_||r[_]===void 0||d===!0||d===void 0&&r[_]!==!1)&&(r[_||f]=Oe(a))}const o=(a,f)=>c.forEach(a,(d,l)=>i(d,l,f));if(c.isPlainObject(t)||t instanceof this.constructor)o(t,n);else if(c.isString(t)&&(t=t.trim())&&!Ss(t))o(Rs(t),n);else if(c.isObject(t)&&c.isIterable(t)){let a={},f,d;for(const l of t){if(!c.isArray(l))throw TypeError("Object iterator must return a key-value pair");a[d=l[0]]=(f=a[d])?c.isArray(f)?[...f,l[1]]:[f,l[1]]:l[1]}o(a,n)}else t!=null&&i(n,t,s);return this}get(t,n){if(t=Ee(t),t){const s=c.findKey(this,t);if(s){const r=this[s];if(!n)return r;if(n===!0)return Es(r);if(c.isFunction(n))return n.call(this,r,s);if(c.isRegExp(n))return n.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=Ee(t),t){const s=c.findKey(this,t);return!!(s&&this[s]!==void 0&&(!n||Ie(this,this[s],s,n)))}return!1}delete(t,n){const s=this;let r=!1;function i(o){if(o=Ee(o),o){const a=c.findKey(s,o);a&&(!n||Ie(s,s[a],a,n))&&(delete s[a],r=!0)}}return c.isArray(t)?t.forEach(i):i(t),r}clear(t){const n=Object.keys(this);let s=n.length,r=!1;for(;s--;){const i=n[s];(!t||Ie(this,this[i],i,t,!0))&&(delete this[i],r=!0)}return r}normalize(t){const n=this,s={};return c.forEach(this,(r,i)=>{const o=c.findKey(s,i);if(o){n[o]=Oe(r),delete n[i];return}const a=t?Ds(i):String(i).trim();a!==i&&delete n[i],n[a]=Oe(r),s[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return c.forEach(this,(s,r)=>{s!=null&&s!==!1&&(n[r]=t&&c.isArray(s)?s.join(", "):s)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(`
|
|
9
|
+
`)}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 s=new this(t);return n.forEach(r=>s.set(r)),s}static accessor(t){const s=(this[ht]=this[ht]={accessors:{}}).accessors,r=this.prototype;function i(o){const a=Ee(o);s[a]||(As(r,o),s[a]=!0)}return c.isArray(t)?t.forEach(i):i(t),this}};ae.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);c.reduceDescriptors(ae.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(s){this[n]=s}}});c.freezeMethods(ae);function $e(e,t){const n=this||Te,s=t||n,r=ae.from(s.headers);let i=s.data;return c.forEach(e,function(a){i=a.call(n,i,r.normalize(),t?t.status:void 0)}),r.normalize(),i}function Zt(e){return!!(e&&e.__CANCEL__)}let Ne=class extends E{constructor(t,n,s){super(t??"canceled",E.ERR_CANCELED,n,s),this.name="CanceledError",this.__CANCEL__=!0}};function Wt(e,t,n){const s=n.config.validateStatus;!n.status||!s||s(n.status)?e(n):t(new E("Request failed with status code "+n.status,[E.ERR_BAD_REQUEST,E.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Us(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Ts(e,t){e=e||10;const n=new Array(e),s=new Array(e);let r=0,i=0,o;return t=t!==void 0?t:1e3,function(f){const d=Date.now(),l=s[i];o||(o=d),n[r]=f,s[r]=d;let _=i,b=0;for(;_!==r;)b+=n[_++],_=_%e;if(r=(r+1)%e,r===i&&(i=(i+1)%e),d-o<t)return;const R=l&&d-l;return R?Math.round(b*1e3/R):void 0}}function Ns(e,t){let n=0,s=1e3/t,r,i;const o=(d,l=Date.now())=>{n=l,r=null,i&&(clearTimeout(i),i=null),e(...d)};return[(...d)=>{const l=Date.now(),_=l-n;_>=s?o(d,l):(r=d,i||(i=setTimeout(()=>{i=null,o(r)},s-_)))},()=>r&&o(r)]}const Fe=(e,t,n=3)=>{let s=0;const r=Ts(50,250);return Ns(i=>{const o=i.loaded,a=i.lengthComputable?i.total:void 0,f=o-s,d=r(f),l=o<=a;s=o;const _={loaded:o,total:a,progress:a?o/a:void 0,bytes:f,rate:d||void 0,estimated:d&&a&&l?(a-o)/d:void 0,event:i,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(_)},n)},wt=(e,t)=>{const n=e!=null;return[s=>t[0]({lengthComputable:n,total:e,loaded:s}),t[1]]},yt=e=>(...t)=>c.asap(()=>e(...t)),vs=te.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,te.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(te.origin),te.navigator&&/(msie|trident)/i.test(te.navigator.userAgent)):()=>!0,xs=te.hasStandardBrowserEnv?{write(e,t,n,s,r,i,o){if(typeof document>"u")return;const a=[`${e}=${encodeURIComponent(t)}`];c.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),c.isString(s)&&a.push(`path=${s}`),c.isString(r)&&a.push(`domain=${r}`),i===!0&&a.push("secure"),c.isString(o)&&a.push(`SameSite=${o}`),document.cookie=a.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Ls(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Ps(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Qt(e,t,n){let s=!Ls(t);return e&&(s||n==!1)?Ps(e,t):t}const gt=e=>e instanceof ae?{...e}:e;function we(e,t){t=t||{};const n={};function s(d,l,_,b){return c.isPlainObject(d)&&c.isPlainObject(l)?c.merge.call({caseless:b},d,l):c.isPlainObject(l)?c.merge({},l):c.isArray(l)?l.slice():l}function r(d,l,_,b){if(c.isUndefined(l)){if(!c.isUndefined(d))return s(void 0,d,_,b)}else return s(d,l,_,b)}function i(d,l){if(!c.isUndefined(l))return s(void 0,l)}function o(d,l){if(c.isUndefined(l)){if(!c.isUndefined(d))return s(void 0,d)}else return s(void 0,l)}function a(d,l,_){if(_ in t)return s(d,l);if(_ in e)return s(void 0,d)}const f={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,responseEncoding:o,validateStatus:a,headers:(d,l,_)=>r(gt(d),gt(l),_,!0)};return c.forEach(Object.keys({...e,...t}),function(l){if(l==="__proto__"||l==="constructor"||l==="prototype")return;const _=c.hasOwnProp(f,l)?f[l]:r,b=_(e[l],t[l],l);c.isUndefined(b)&&_!==a||(n[l]=b)}),n}const en=e=>{const t=we({},e);let{data:n,withXSRFToken:s,xsrfHeaderName:r,xsrfCookieName:i,headers:o,auth:a}=t;if(t.headers=o=ae.from(o),t.url=Kt(Qt(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),c.isFormData(n)){if(te.hasStandardBrowserEnv||te.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(c.isFunction(n.getHeaders)){const f=n.getHeaders(),d=["content-type","content-length"];Object.entries(f).forEach(([l,_])=>{d.includes(l.toLowerCase())&&o.set(l,_)})}}if(te.hasStandardBrowserEnv&&(s&&c.isFunction(s)&&(s=s(t)),s||s!==!1&&vs(t.url))){const f=r&&i&&xs.read(i);f&&o.set(r,f)}return t},Os=typeof XMLHttpRequest<"u",ks=Os&&function(e){return new Promise(function(n,s){const r=en(e);let i=r.data;const o=ae.from(r.headers).normalize();let{responseType:a,onUploadProgress:f,onDownloadProgress:d}=r,l,_,b,R,p;function w(){R&&R(),p&&p(),r.cancelToken&&r.cancelToken.unsubscribe(l),r.signal&&r.signal.removeEventListener("abort",l)}let h=new XMLHttpRequest;h.open(r.method.toUpperCase(),r.url,!0),h.timeout=r.timeout;function A(){if(!h)return;const N=ae.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),H={data:!a||a==="text"||a==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:N,config:e,request:h};Wt(function(q){n(q),w()},function(q){s(q),w()},H),h=null}"onloadend"in h?h.onloadend=A:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(A)},h.onabort=function(){h&&(s(new E("Request aborted",E.ECONNABORTED,e,h)),h=null)},h.onerror=function(B){const H=B&&B.message?B.message:"Network Error",k=new E(H,E.ERR_NETWORK,e,h);k.event=B||null,s(k),h=null},h.ontimeout=function(){let B=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const H=r.transitional||tt;r.timeoutErrorMessage&&(B=r.timeoutErrorMessage),s(new E(B,H.clarifyTimeoutError?E.ETIMEDOUT:E.ECONNABORTED,e,h)),h=null},i===void 0&&o.setContentType(null),"setRequestHeader"in h&&c.forEach(o.toJSON(),function(B,H){h.setRequestHeader(H,B)}),c.isUndefined(r.withCredentials)||(h.withCredentials=!!r.withCredentials),a&&a!=="json"&&(h.responseType=r.responseType),d&&([b,p]=Fe(d,!0),h.addEventListener("progress",b)),f&&h.upload&&([_,R]=Fe(f),h.upload.addEventListener("progress",_),h.upload.addEventListener("loadend",R)),(r.cancelToken||r.signal)&&(l=N=>{h&&(s(!N||N.type?new Ne(null,e,h):N),h.abort(),h=null)},r.cancelToken&&r.cancelToken.subscribe(l),r.signal&&(r.signal.aborted?l():r.signal.addEventListener("abort",l)));const j=Us(r.url);if(j&&te.protocols.indexOf(j)===-1){s(new E("Unsupported protocol "+j+":",E.ERR_BAD_REQUEST,e));return}h.send(i||null)})},Fs=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let s=new AbortController,r;const i=function(d){if(!r){r=!0,a();const l=d instanceof Error?d:this.reason;s.abort(l instanceof E?l:new Ne(l instanceof Error?l.message:l))}};let o=t&&setTimeout(()=>{o=null,i(new E(`timeout of ${t}ms exceeded`,E.ETIMEDOUT))},t);const a=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(d=>{d.unsubscribe?d.unsubscribe(i):d.removeEventListener("abort",i)}),e=null)};e.forEach(d=>d.addEventListener("abort",i));const{signal:f}=s;return f.unsubscribe=()=>c.asap(a),f}},js=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let s=0,r;for(;s<n;)r=s+t,yield e.slice(s,r),s=r},Bs=async function*(e,t){for await(const n of Ms(e))yield*js(n,t)},Ms=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:s}=await t.read();if(n)break;yield s}}finally{await t.cancel()}},Ct=(e,t,n,s)=>{const r=Bs(e,t);let i=0,o,a=f=>{o||(o=!0,s&&s(f))};return new ReadableStream({async pull(f){try{const{done:d,value:l}=await r.next();if(d){a(),f.close();return}let _=l.byteLength;if(n){let b=i+=_;n(b)}f.enqueue(new Uint8Array(l))}catch(d){throw a(d),d}},cancel(f){return a(f),r.return()}},{highWaterMark:2})},bt=64*1024,{isFunction:Le}=c,Ys=(({Request:e,Response:t})=>({Request:e,Response:t}))(c.global),{ReadableStream:Rt,TextEncoder:Et}=c.global,St=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Hs=e=>{e=c.merge.call({skipUndefined:!0},Ys,e);const{fetch:t,Request:n,Response:s}=e,r=t?Le(t):typeof fetch=="function",i=Le(n),o=Le(s);if(!r)return!1;const a=r&&Le(Rt),f=r&&(typeof Et=="function"?(p=>w=>p.encode(w))(new Et):async p=>new Uint8Array(await new n(p).arrayBuffer())),d=i&&a&&St(()=>{let p=!1;const w=new n(te.origin,{body:new Rt,method:"POST",get duplex(){return p=!0,"half"}}).headers.has("Content-Type");return p&&!w}),l=o&&a&&St(()=>c.isReadableStream(new s("").body)),_={stream:l&&(p=>p.body)};r&&["text","arrayBuffer","blob","formData","stream"].forEach(p=>{!_[p]&&(_[p]=(w,h)=>{let A=w&&w[p];if(A)return A.call(w);throw new E(`Response type '${p}' is not supported`,E.ERR_NOT_SUPPORT,h)})});const b=async p=>{if(p==null)return 0;if(c.isBlob(p))return p.size;if(c.isSpecCompliantForm(p))return(await new n(te.origin,{method:"POST",body:p}).arrayBuffer()).byteLength;if(c.isArrayBufferView(p)||c.isArrayBuffer(p))return p.byteLength;if(c.isURLSearchParams(p)&&(p=p+""),c.isString(p))return(await f(p)).byteLength},R=async(p,w)=>{const h=c.toFiniteNumber(p.getContentLength());return h??b(w)};return async p=>{let{url:w,method:h,data:A,signal:j,cancelToken:N,timeout:B,onDownloadProgress:H,onUploadProgress:k,responseType:q,headers:re,withCredentials:F="same-origin",fetchOptions:M}=en(p),le=t||fetch;q=q?(q+"").toLowerCase():"text";let W=Fs([j,N&&N.toAbortSignal()],B),U=null;const P=W&&W.unsubscribe&&(()=>{W.unsubscribe()});let K;try{if(k&&d&&h!=="get"&&h!=="head"&&(K=await R(re,A))!==0){let u=new n(w,{method:"POST",body:A,duplex:"half"}),C;if(c.isFormData(A)&&(C=u.headers.get("content-type"))&&re.setContentType(C),u.body){const[T,S]=wt(K,Fe(yt(k)));A=Ct(u.body,bt,T,S)}}c.isString(F)||(F=F?"include":"omit");const L=i&&"credentials"in n.prototype,ie={...M,signal:W,method:h.toUpperCase(),headers:re.normalize().toJSON(),body:A,duplex:"half",credentials:L?F:void 0};U=i&&new n(w,ie);let g=await(i?le(U,M):le(w,ie));const z=l&&(q==="stream"||q==="response");if(l&&(H||z&&P)){const u={};["status","statusText","headers"].forEach(Y=>{u[Y]=g[Y]});const C=c.toFiniteNumber(g.headers.get("content-length")),[T,S]=H&&wt(C,Fe(yt(H),!0))||[];g=new s(Ct(g.body,bt,T,()=>{S&&S(),P&&P()}),u)}q=q||"text";let v=await _[c.findKey(_,q)||"text"](g,p);return!z&&P&&P(),await new Promise((u,C)=>{Wt(u,C,{data:v,headers:ae.from(g.headers),status:g.status,statusText:g.statusText,config:p,request:U})})}catch(L){throw P&&P(),L&&L.name==="TypeError"&&/Load failed|fetch/i.test(L.message)?Object.assign(new E("Network Error",E.ERR_NETWORK,p,U,L&&L.response),{cause:L.cause||L}):E.from(L,L&&L.code,p,U,L&&L.response)}}},Is=new Map,tn=e=>{let t=e&&e.env||{};const{fetch:n,Request:s,Response:r}=t,i=[s,r,n];let o=i.length,a=o,f,d,l=Is;for(;a--;)f=i[a],d=l.get(f),d===void 0&&l.set(f,d=a?new Map:Hs(t)),l=d;return d};tn();const st={http:is,xhr:ks,fetch:{get:tn}};c.forEach(st,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Dt=e=>`- ${e}`,$s=e=>c.isFunction(e)||e===null||e===!1;function Gs(e,t){e=c.isArray(e)?e:[e];const{length:n}=e;let s,r;const i={};for(let o=0;o<n;o++){s=e[o];let a;if(r=s,!$s(s)&&(r=st[(a=String(s)).toLowerCase()],r===void 0))throw new E(`Unknown adapter '${a}'`);if(r&&(c.isFunction(r)||(r=r.get(t))))break;i[a||"#"+o]=r}if(!r){const o=Object.entries(i).map(([f,d])=>`adapter ${f} `+(d===!1?"is not supported by the environment":"is not available in the build"));let a=n?o.length>1?`since :
|
|
10
|
+
`+o.map(Dt).join(`
|
|
11
|
+
`):" "+Dt(o[0]):"as no adapter specified";throw new E("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return r}const nn={getAdapter:Gs,adapters:st};function Ge(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Ne(null,e)}function At(e){return Ge(e),e.headers=ae.from(e.headers),e.data=$e.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),nn.getAdapter(e.adapter||Te.adapter,e)(e).then(function(s){return Ge(e),s.data=$e.call(e,e.transformResponse,s),s.headers=ae.from(s.headers),s},function(s){return Zt(s)||(Ge(e),s&&s.response&&(s.response.data=$e.call(e,e.transformResponse,s.response),s.response.headers=ae.from(s.response.headers))),Promise.reject(s)})}const sn="1.13.5",He={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{He[e]=function(s){return typeof s===e||"a"+(t<1?"n ":" ")+e}});const Ut={};He.transitional=function(t,n,s){function r(i,o){return"[Axios v"+sn+"] Transitional option '"+i+"'"+o+(s?". "+s:"")}return(i,o,a)=>{if(t===!1)throw new E(r(o," has been removed"+(n?" in "+n:"")),E.ERR_DEPRECATED);return n&&!Ut[o]&&(Ut[o]=!0,console.warn(r(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,o,a):!0}};He.spelling=function(t){return(n,s)=>(console.warn(`${s} is likely a misspelling of ${t}`),!0)};function Js(e,t,n){if(typeof e!="object")throw new E("options must be an object",E.ERR_BAD_OPTION_VALUE);const s=Object.keys(e);let r=s.length;for(;r-- >0;){const i=s[r],o=t[i];if(o){const a=e[i],f=a===void 0||o(a,i,e);if(f!==!0)throw new E("option "+i+" must be "+f,E.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new E("Unknown option "+i,E.ERR_BAD_OPTION)}}const ke={assertOptions:Js,validators:He},de=ke.validators;let _e=class{constructor(t){this.defaults=t||{},this.interceptors={request:new _t,response:new _t}}async request(t,n){try{return await this._request(t,n)}catch(s){if(s instanceof Error){let r={};Error.captureStackTrace?Error.captureStackTrace(r):r=new Error;const i=r.stack?r.stack.replace(/^.+\n/,""):"";try{s.stack?i&&!String(s.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(s.stack+=`
|
|
12
|
+
`+i):s.stack=i}catch{}}throw s}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=we(this.defaults,n);const{transitional:s,paramsSerializer:r,headers:i}=n;s!==void 0&&ke.assertOptions(s,{silentJSONParsing:de.transitional(de.boolean),forcedJSONParsing:de.transitional(de.boolean),clarifyTimeoutError:de.transitional(de.boolean),legacyInterceptorReqResOrdering:de.transitional(de.boolean)},!1),r!=null&&(c.isFunction(r)?n.paramsSerializer={serialize:r}:ke.assertOptions(r,{encode:de.function,serialize:de.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),ke.assertOptions(n,{baseUrl:de.spelling("baseURL"),withXsrfToken:de.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&c.merge(i.common,i[n.method]);i&&c.forEach(["delete","get","head","post","put","patch","common"],p=>{delete i[p]}),n.headers=ae.concat(o,i);const a=[];let f=!0;this.interceptors.request.forEach(function(w){if(typeof w.runWhen=="function"&&w.runWhen(n)===!1)return;f=f&&w.synchronous;const h=n.transitional||tt;h&&h.legacyInterceptorReqResOrdering?a.unshift(w.fulfilled,w.rejected):a.push(w.fulfilled,w.rejected)});const d=[];this.interceptors.response.forEach(function(w){d.push(w.fulfilled,w.rejected)});let l,_=0,b;if(!f){const p=[At.bind(this),void 0];for(p.unshift(...a),p.push(...d),b=p.length,l=Promise.resolve(n);_<b;)l=l.then(p[_++],p[_++]);return l}b=a.length;let R=n;for(;_<b;){const p=a[_++],w=a[_++];try{R=p(R)}catch(h){w.call(this,h);break}}try{l=At.call(this,R)}catch(p){return Promise.reject(p)}for(_=0,b=d.length;_<b;)l=l.then(d[_++],d[_++]);return l}getUri(t){t=we(this.defaults,t);const n=Qt(t.baseURL,t.url,t.allowAbsoluteUrls);return Kt(n,t.params,t.paramsSerializer)}};c.forEach(["delete","get","head","options"],function(t){_e.prototype[t]=function(n,s){return this.request(we(s||{},{method:t,url:n,data:(s||{}).data}))}});c.forEach(["post","put","patch"],function(t){function n(s){return function(i,o,a){return this.request(we(a||{},{method:t,headers:s?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}_e.prototype[t]=n(),_e.prototype[t+"Form"]=n(!0)});let Xs=class rn{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 s=this;this.promise.then(r=>{if(!s._listeners)return;let i=s._listeners.length;for(;i-- >0;)s._listeners[i](r);s._listeners=null}),this.promise.then=r=>{let i;const o=new Promise(a=>{s.subscribe(a),i=a}).then(r);return o.cancel=function(){s.unsubscribe(i)},o},t(function(i,o,a){s.reason||(s.reason=new Ne(i,o,a),n(s.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=s=>{t.abort(s)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new rn(function(r){t=r}),cancel:t}}};function qs(e){return function(n){return e.apply(null,n)}}function Vs(e){return c.isObject(e)&&e.isAxiosError===!0}const Ve={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(Ve).forEach(([e,t])=>{Ve[t]=e});function on(e){const t=new _e(e),n=Bt(_e.prototype.request,t);return c.extend(n,_e.prototype,t,{allOwnKeys:!0}),c.extend(n,t,null,{allOwnKeys:!0}),n.create=function(r){return on(we(e,r))},n}const X=on(Te);X.Axios=_e;X.CanceledError=Ne;X.CancelToken=Xs;X.isCancel=Zt;X.VERSION=sn;X.toFormData=Ye;X.AxiosError=E;X.Cancel=X.CanceledError;X.all=function(t){return Promise.all(t)};X.spread=qs;X.isAxiosError=Vs;X.mergeConfig=we;X.AxiosHeaders=ae;X.formToJSON=e=>zt(c.isHTMLForm(e)?new FormData(e):e);X.getAdapter=nn.getAdapter;X.HttpStatusCode=Ve;X.default=X;const{Axios:kr,AxiosError:Fr,CanceledError:jr,isCancel:Br,CancelToken:Mr,VERSION:Yr,all:Hr,Cancel:Ir,isAxiosError:$r,spread:Gr,toFormData:Jr,AxiosHeaders:Xr,HttpStatusCode:qr,formToJSON:Vr,getAdapter:Kr,mergeConfig:zr}=X,Tt=e=>{let t;const n=new Set,s=(d,l)=>{const _=typeof d=="function"?d(t):d;if(!Object.is(_,t)){const b=t;t=l??(typeof _!="object"||_===null)?_:Object.assign({},t,_),n.forEach(R=>R(t,b))}},r=()=>t,a={setState:s,getState:r,getInitialState:()=>f,subscribe:d=>(n.add(d),()=>n.delete(d))},f=t=e(s,r,a);return a},Ks=(e=>e?Tt(e):Tt),zs=e=>e;function Zs(e,t=zs){const n=y.useSyncExternalStore(e.subscribe,y.useCallback(()=>t(e.getState()),[e,t]),y.useCallback(()=>t(e.getInitialState()),[e,t]));return y.useDebugValue(n),n}const Nt=e=>{const t=Ks(e),n=s=>Zs(t,s);return Object.assign(n,t),n},Ws=(e=>e?Nt(e):Nt),ye=Ws(e=>({newsSelectedCandles:null,newsPlayEndTimestamp:null,newsTargetCandle:null,gapCount:0,isReplayMode:!1,setNewsSelectedCandles:t=>e({newsSelectedCandles:t}),setNewsPlayEndTimestamp:t=>e({newsPlayEndTimestamp:t}),setNewsTargetCandle:t=>e({newsTargetCandle:t}),setGapCount:t=>e({gapCount:t}),setReplayMode:t=>e({isReplayMode:t})})),Qs={"1D":"D1",D:"D1",240:"H4",120:"H2",60:"H1",30:"M30",15:"M15",5:"M5",1:"M1"},Ke=e=>({1:60,5:300,15:900,30:1800,60:3600})[e]||3600,an=[10,15,20,25,30,35,40,45,50],cn=y.createContext(null),er=()=>{const e=y.useContext(cn);if(!e)throw new Error("useWidgetContext must be used inside WidgetProvider");return e},tr=({children:e,selectedTimeframe:t,setSelectedTimeframe:n,currentSymbol:s,setCurrentSymbol:r})=>m.jsx(cn.Provider,{value:{currentSymbol:s,setCurrentSymbol:r,selectedTimeframe:t,setSelectedTimeframe:n},children:e});const ln=(...e)=>e.filter((t,n,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===n).join(" ").trim();const nr=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const sr=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,s)=>s?s.toUpperCase():n.toLowerCase());const vt=e=>{const t=sr(e);return t.charAt(0).toUpperCase()+t.slice(1)};var rr={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 ir=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const or=y.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:r="",children:i,iconNode:o,...a},f)=>y.createElement("svg",{ref:f,...rr,width:t,height:t,stroke:e,strokeWidth:s?Number(n)*24/Number(t):n,className:ln("lucide",r),...!i&&!ir(a)&&{"aria-hidden":"true"},...a},[...o.map(([d,l])=>y.createElement(d,l)),...Array.isArray(i)?i:[i]]));const rt=(e,t)=>{const n=y.forwardRef(({className:s,...r},i)=>y.createElement(or,{ref:i,iconNode:t,className:ln(`lucide-${nr(vt(e))}`,`lucide-${e}`,s),...r}));return n.displayName=vt(e),n};const ar=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],cr=rt("chevron-down",ar);const lr=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],dr=rt("chevron-left",lr);const ur=[["path",{d:"M8.8 20v-4.1l1.9.2a2.3 2.3 0 0 0 2.164-2.1V8.3A5.37 5.37 0 0 0 2 8.25c0 2.8.656 3.054 1 4.55a5.77 5.77 0 0 1 .029 2.758L2 20",key:"11atix"}],["path",{d:"M19.8 17.8a7.5 7.5 0 0 0 .003-10.603",key:"yol142"}],["path",{d:"M17 15a3.5 3.5 0 0 0-.025-4.975",key:"ssbmkc"}]],pr=rt("speech",ur),ze=(e,t)=>{if(!e||e==="-"||e.trim()===""||!t||t==="-"||t.trim()==="")return"news-widget__orange";const n=e.trim().replace(/[kKmMbB%]/g,"").replace(/[^\d.-]/g,""),s=t.trim().replace(/[kKmMbB%]/g,"").replace(/[^\d.-]/g,""),r=parseFloat(n)||0,i=parseFloat(s)||0;return r>i?"news-widget__green":r===i?"news-widget__orange":"news-widget__red"},xt=e=>e.trim().replaceAll(" ","").replaceAll("_",""),fr=new Intl.DateTimeFormat("en-US",{year:"numeric",month:"long",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}),dn=e=>{const t=fr.formatToParts(e),n=s=>t.find(r=>r.type===s)?.value??"";return`${n("year")} ${n("month")} ${n("day")}, ${n("hour")}:${n("minute")}`},mr=({currency:e,size:t=24})=>m.jsx("img",{src:`https://cdn.iccandle.ai/web-assets/${e}.svg`,className:"news-widget_news_card__currency_img",alt:e,width:t,height:t}),_r=({title:e,date:t,forecast:n,actual:s,currency:r})=>m.jsxs("div",{className:"news-widget_news_card__container",children:[m.jsxs("div",{className:"news-widget_news_card__header",children:[r&&m.jsx("div",{className:"news-widget_news_card__currency_icon",children:m.jsx(mr,{currency:r})}),m.jsxs("div",{className:"news-widget_news_card__meta",children:[m.jsx("div",{className:"news-widget_news_card__date",children:dn(new Date(t??0))}),m.jsx("div",{className:"news-widget_news_card__title",children:e})]})]}),m.jsxs("div",{className:"news-widget_news_card__info_row",children:[m.jsxs("div",{className:"news-widget_news_card__info_card",children:[m.jsx("div",{className:"news-widget_news_card__label",children:"Actual"}),m.jsx("div",{className:`news-widget_news_card__font_semibold ${ze(String(s),String(n))}`,children:s||"-"})]}),m.jsxs("div",{className:"news-widget_news_card__info_card",children:[m.jsx("div",{className:"news-widget_news_card__label",children:"Forecast"}),m.jsx("div",{className:"news-widget_news_card__font_semibold news-widget__orange",children:n||"-"})]})]})]});function hr(e){switch(e){case"post":return"news-widget__bg_green";case"early":return"news-widget__bg_gray";case"coming":return"news-widget__bg_orange"}}const wr=({eventData:e,showStatus:t=!0,showPreviousValues:n=!1,showSimilarEvents:s=!1,isSimilarEventsOpen:r=!1})=>m.jsxs("div",{className:"news-widget_event_details_card__container",children:[m.jsxs("div",{className:"news-widget_event_details_card__body",children:[m.jsxs("div",{className:"news-widget_event_details_card__left",children:[m.jsx("div",{className:"news-widget_event_details_card__header_row",children:m.jsxs("div",{className:"news-widget_event_details_card__header_inner",children:[m.jsxs("div",{className:"news-widget_event_details_card__timestamp_row",children:[m.jsxs("p",{className:"news-widget_event_details_card__timestamp",children:[e?.timestamp&&dn(new Date(e?.timestamp??0))," "]})," ",e?.status&&t&&m.jsxs("div",{className:"news-widget_event_details_card__status_container",children:[m.jsx("div",{className:`news-widget_event_details_card__status ${hr(e.status)}`}),e.status==="post"&&"Actual Released",e.status==="coming"&&"Predict Available",e.status==="early"&&"Predict Unavailable"]})," "]}),m.jsxs("div",{className:"news-widget_event_details_card__currency_row",children:[m.jsx("div",{className:"news-widget_event_details_card__currency_icon",children:m.jsx("img",{src:`https://cdn.iccandle.ai/web-assets/${e?.currency??"USD"}.svg`,className:"news-widget_event_details_card__currency_img",alt:e?.currency||"",width:36,height:36})}),m.jsxs("p",{className:"news-widget_event_details_card__event_name",children:[e?.event_name," ",e?.event_time&&` ${e?.event_time}`]}),e?.slug=="FOMC"&&m.jsx(pr,{stroke:"url(#gradient)",className:"news-widget_event_details_card__speech_icon"})]})]})}),e?.slug!="FOMC"&&m.jsxs("div",{className:"news-widget_event_details_card__values_row",children:[m.jsxs("div",{className:"news-widget_event_details_card__values_group",children:[m.jsxs("div",{className:"news-widget_event_details_card__info",children:[m.jsx("span",{className:"news-widget_event_details_card__label",children:"Actual:"}),m.jsx("span",{className:`news-widget_event_details_card__text_bold ${ze(e?.actual,e?.forecast)}`,children:e?.actual||"Soon"})]}),m.jsxs("div",{className:"news-widget_event_details_card__info",children:[m.jsx("span",{className:"news-widget_event_details_card__label",children:"Forecast:"}),m.jsx("span",{className:"news-widget_event_details_card__text_bold news-widget__orange",children:e?.forecast||"-"})]})]}),n&&m.jsxs("div",{className:"news-widget_event_details_card__values_group",children:[m.jsxs("div",{className:"news-widget_event_details_card__info",children:[m.jsx("span",{className:"news-widget_event_details_card__label",children:"Previous Actual:"}),m.jsx("span",{className:`news-widget_event_details_card__text_bold ${ze(e?.similar?.referenceEvent?.previous_actual,e?.similar?.referenceEvent?.previous_forecast)}`,children:e?.similar?.referenceEvent?.previous_actual||"-"})]}),m.jsxs("div",{className:"news-widget_event_details_card__info",children:[m.jsx("span",{className:"news-widget_event_details_card__label",children:"Previous Forecast:"}),m.jsx("span",{className:"news-widget_event_details_card__text_bold news-widget__orange",children:e?.similar?.referenceEvent?.previous_forecast||"-"})]})]})]}),e?.slug=="FOMC"&&m.jsxs("p",{className:"news-widget_event_details_card__fomc_source",children:["Source:"," ",m.jsx("a",{href:e?.resource??"#",target:"_blank",rel:"noopener noreferrer",className:"news-widget_event_details_card__fomc_link",children:"FOMC Report"})]})]}),m.jsx("div",{className:"news-widget_event_details_card__right",children:e?.description&&m.jsx("p",{className:"news-widget_event_details_card__description",children:e.description})})]}),s&&e?.similar?.referenceEvent?.previousEvents&&e?.similar?.referenceEvent?.previousEvents.length>0&&m.jsx("div",{className:`news-widget_event_details_card__collapsible ${r?"news-widget_event_details_card__collapsible--open":"news-widget_event_details_card__collapsible--closed"}`,children:r&&m.jsxs("div",{className:"news-widget_event_details_card__collapsible_inner",children:[e?.similar?.referenceEvent?.previousEvents.length>0&&m.jsxs("p",{className:"news-widget_event_details_card__text",children:["News Before This ",e?.event_name]}),e?.similar?.referenceEvent?.previousEvents.length>0&&m.jsx("div",{className:"news-widget_event_details_card__previous_events_list",children:e?.similar?.referenceEvent?.previousEvents?.map((i,o)=>m.jsx(_r,{title:i.event_name,date:new Date(i.timestamp),forecast:i.forecast,actual:i.actual,currency:e?.currency},o))})]})})]}),yr=({newsDetail:e,children:t,isCompared:n})=>{const[s,r]=y.useState(!1);return m.jsxs("div",{className:"news-widget_event_details__container news-widget_event_details__container_sm",children:[e&&m.jsxs("div",{style:{position:"relative"},children:[m.jsx(wr,{eventData:e.event,showPreviousValues:!n,showSimilarEvents:!0,isSimilarEventsOpen:s}),m.jsx("button",{type:"button",className:`news-widget__button news-widget_event_details__ghost_button ${s?"news-widget_event_details__ghost_button_open":""}`,onClick:()=>r(!s),children:m.jsx(cr,{className:"news-widget_event_details__icon"})})]}),m.jsx("div",{className:"news-widget_event_details__chart_wrapper",children:m.jsx("div",{className:"news-widget_event_details__chart",children:t})})]})},gr=[{name:"LTC_USD",type:"CFD",pipLocation:-1},{name:"HK33_HKD",type:"CFD",pipLocation:0},{name:"USD_JPY",type:"CURRENCY",pipLocation:-2},{name:"EUR_TRY",type:"CURRENCY",pipLocation:-4},{name:"BTCUSDT",type:"CRYPTO",pipLocation:0},{name:"ETHUSDT",type:"CRYPTO",pipLocation:0},{name:"XRPUSDT",type:"CRYPTO",pipLocation:-3},{name:"SOLUSDT",type:"CRYPTO",pipLocation:-1},{name:"AUD_NZD",type:"CURRENCY",pipLocation:-4},{name:"USD_THB",type:"CURRENCY",pipLocation:-2},{name:"GBP_CHF",type:"CURRENCY",pipLocation:-4},{name:"EUR_HUF",type:"CURRENCY",pipLocation:-2},{name:"EUR_ZAR",type:"CURRENCY",pipLocation:-4},{name:"NZD_JPY",type:"CURRENCY",pipLocation:-2},{name:"EUR_NZD",type:"CURRENCY",pipLocation:-4},{name:"USB02Y_USD",type:"CFD",pipLocation:-2},{name:"XAU_CAD",type:"METAL",pipLocation:-2},{name:"GBP_JPY",type:"CURRENCY",pipLocation:-2},{name:"USD_TRY",type:"CURRENCY",pipLocation:-4},{name:"EUR_NOK",type:"CURRENCY",pipLocation:-4},{name:"TRY_JPY",type:"CURRENCY",pipLocation:-2},{name:"USD_SGD",type:"CURRENCY",pipLocation:-4},{name:"EUR_SEK",type:"CURRENCY",pipLocation:-4},{name:"DE30_EUR",type:"CFD",pipLocation:0},{name:"AUD_CAD",type:"CURRENCY",pipLocation:-4},{name:"UK10YB_GBP",type:"CFD",pipLocation:-2},{name:"XPD_USD",type:"CFD",pipLocation:-2},{name:"UK100_GBP",type:"CFD",pipLocation:0},{name:"XAG_CHF",type:"METAL",pipLocation:-4},{name:"USD_CHF",type:"CURRENCY",pipLocation:-4},{name:"CHF_HKD",type:"CURRENCY",pipLocation:-4},{name:"EUR_HKD",type:"CURRENCY",pipLocation:-4},{name:"GBP_HKD",type:"CURRENCY",pipLocation:-4},{name:"XAU_NZD",type:"METAL",pipLocation:-2},{name:"GBP_NZD",type:"CURRENCY",pipLocation:-4},{name:"GBP_SGD",type:"CURRENCY",pipLocation:-4},{name:"USD_SEK",type:"CURRENCY",pipLocation:-4},{name:"EUR_SGD",type:"CURRENCY",pipLocation:-4},{name:"XAG_JPY",type:"METAL",pipLocation:0},{name:"USD_HKD",type:"CURRENCY",pipLocation:-4},{name:"XAG_HKD",type:"METAL",pipLocation:-4},{name:"XCU_USD",type:"CFD",pipLocation:-4},{name:"XAU_JPY",type:"METAL",pipLocation:1},{name:"EUR_PLN",type:"CURRENCY",pipLocation:-4},{name:"SUGAR_USD",type:"CFD",pipLocation:-4},{name:"HKD_JPY",type:"CURRENCY",pipLocation:-4},{name:"CHF_ZAR",type:"CURRENCY",pipLocation:-4},{name:"ZAR_JPY",type:"CURRENCY",pipLocation:-2},{name:"XAU_HKD",type:"METAL",pipLocation:-2},{name:"AUD_CHF",type:"CURRENCY",pipLocation:-4},{name:"EUR_CHF",type:"CURRENCY",pipLocation:-4},{name:"USD_MXN",type:"CURRENCY",pipLocation:-4},{name:"GBP_USD",type:"CURRENCY",pipLocation:-4},{name:"GBP_ZAR",type:"CURRENCY",pipLocation:-4},{name:"SGD_JPY",type:"CURRENCY",pipLocation:-2},{name:"BCH_USD",type:"CFD",pipLocation:-1},{name:"XAG_AUD",type:"METAL",pipLocation:-4},{name:"WTICO_USD",type:"CFD",pipLocation:-2},{name:"AUD_HKD",type:"CURRENCY",pipLocation:-4},{name:"AUD_SGD",type:"CURRENCY",pipLocation:-4},{name:"NZD_HKD",type:"CURRENCY",pipLocation:-4},{name:"EUR_JPY",type:"CURRENCY",pipLocation:-2},{name:"USD_NOK",type:"CURRENCY",pipLocation:-4},{name:"XAU_USD",type:"METAL",pipLocation:-1},{name:"DE10YB_EUR",type:"CFD",pipLocation:-2},{name:"USD_CZK",type:"CURRENCY",pipLocation:-4},{name:"XAU_CHF",type:"METAL",pipLocation:-2},{name:"USD_HUF",type:"CURRENCY",pipLocation:-2},{name:"WHEAT_USD",type:"CFD",pipLocation:-2},{name:"XAU_AUD",type:"METAL",pipLocation:-2},{name:"EUR_USD",type:"CURRENCY",pipLocation:-4},{name:"SG30_SGD",type:"CFD",pipLocation:-1},{name:"GBP_AUD",type:"CURRENCY",pipLocation:-4},{name:"USD_PLN",type:"CURRENCY",pipLocation:-4},{name:"NZD_CAD",type:"CURRENCY",pipLocation:-4},{name:"XAG_EUR",type:"METAL",pipLocation:-4},{name:"CORN_USD",type:"CFD",pipLocation:-2},{name:"XAG_SGD",type:"METAL",pipLocation:-4},{name:"CHINAH_HKD",type:"CFD",pipLocation:0},{name:"XAU_SGD",type:"METAL",pipLocation:-2},{name:"NZD_USD",type:"CURRENCY",pipLocation:-4},{name:"JP225Y_JPY",type:"CFD",pipLocation:0},{name:"XAG_NZD",type:"METAL",pipLocation:-4},{name:"EUR_CZK",type:"CURRENCY",pipLocation:-4},{name:"AU200_AUD",type:"CFD",pipLocation:0},{name:"SGD_CHF",type:"CURRENCY",pipLocation:-4},{name:"USD_DKK",type:"CURRENCY",pipLocation:-4},{name:"SPX500_USD",type:"CFD",pipLocation:0},{name:"NZD_SGD",type:"CURRENCY",pipLocation:-4},{name:"US30_USD",type:"CFD",pipLocation:0},{name:"NL25_EUR",type:"CFD",pipLocation:-2},{name:"JP225_USD",type:"CFD",pipLocation:0},{name:"USB30Y_USD",type:"CFD",pipLocation:-2},{name:"XAG_USD",type:"METAL",pipLocation:-4},{name:"GBP_PLN",type:"CURRENCY",pipLocation:-4},{name:"CN50_USD",type:"CFD",pipLocation:0},{name:"USB05Y_USD",type:"CFD",pipLocation:-2},{name:"AUD_USD",type:"CURRENCY",pipLocation:-4},{name:"USD_CNH",type:"CURRENCY",pipLocation:-4},{name:"EUR_GBP",type:"CURRENCY",pipLocation:-4},{name:"XAG_GBP",type:"METAL",pipLocation:-4},{name:"XAU_EUR",type:"METAL",pipLocation:-2},{name:"USD_CAD",type:"CURRENCY",pipLocation:-4},{name:"NAS100_USD",type:"CFD",pipLocation:0},{name:"EUR_CAD",type:"CURRENCY",pipLocation:-4},{name:"USB10Y_USD",type:"CFD",pipLocation:-2},{name:"EU50_EUR",type:"CFD",pipLocation:0},{name:"NATGAS_USD",type:"CFD",pipLocation:-2},{name:"CAD_JPY",type:"CURRENCY",pipLocation:-2},{name:"FR40_EUR",type:"CFD",pipLocation:0},{name:"XAU_XAG",type:"METAL",pipLocation:-2},{name:"CAD_SGD",type:"CURRENCY",pipLocation:-4},{name:"GBP_CAD",type:"CURRENCY",pipLocation:-4},{name:"USD_ZAR",type:"CURRENCY",pipLocation:-4},{name:"XAU_GBP",type:"METAL",pipLocation:-2},{name:"CH20_CHF",type:"CFD",pipLocation:0},{name:"CAD_HKD",type:"CURRENCY",pipLocation:-4},{name:"CHF_JPY",type:"CURRENCY",pipLocation:-2},{name:"NZD_CHF",type:"CURRENCY",pipLocation:-4},{name:"ESPIX_EUR",type:"CFD",pipLocation:0},{name:"XAG_CAD",type:"METAL",pipLocation:-4},{name:"XPT_USD",type:"CFD",pipLocation:-2},{name:"EUR_AUD",type:"CURRENCY",pipLocation:-4},{name:"CAD_CHF",type:"CURRENCY",pipLocation:-4},{name:"EUR_DKK",type:"CURRENCY",pipLocation:-4},{name:"SOYBN_USD",type:"CFD",pipLocation:-2},{name:"US2000_USD",type:"CFD",pipLocation:-2},{name:"BCO_USD",type:"CFD",pipLocation:-2},{name:"AUD_JPY",type:"CURRENCY",pipLocation:-2}];function Cr(e,t,n=1){if(t===0||!isFinite(t))return n;const s=e/t;return isFinite(s)?s:n}function Lt(e){if(e.length===0)return 0;const t=[...e].sort((s,r)=>s-r),n=Math.floor(t.length/2);return t.length%2!==0?t[n]:(t[n-1]+t[n])/2}function br(e,t,n=[]){if(e.length===0)return[];const s=n.map(l=>Math.abs(l.c-l.o)),r=e.map(l=>Math.abs(l.c-l.o)),i=Lt(r),o=Lt(s),a=Cr(o,i),f=e[0].o,d=t.c;return e.map(l=>{const _=(l.o-f)*a+d,b=(l.h-f)*a+d,R=(l.l-f)*a+d,p=(l.c-f)*a+d;return{o:_,h:Math.max(b,_,p),l:Math.min(R,_,p),c:p}})}const he=e=>e==="1"?60:e==="5"?300:e==="1D"?1440*3600:parseInt(e,10)*60,Ze=8,un=4,We=5,pn=e=>{const t=new Date(e+Ze*60*60*1e3),n=t.getUTCDay(),s=t.getUTCHours();return n===0?!1:n===1?s>=We:n===6?s<=un:!0},fn=e=>{const t=new Date(e+Ze*60*60*1e3),n=t.getUTCDay(),s=t.getUTCHours();if(n===0||n===1&&s<We||n===6&&s>=un){const r=(8-n)%7;return t.setUTCDate(t.getUTCDate()+r),t.setUTCHours(We,0,0,0),t.getTime()-Ze*60*60*1e3}return e},Rr=(e,t,n)=>{const s=he(t)*1e3,r=[];let i=e;for(let o=0;o<n;o++)i+=s,pn(i)||(i=fn(i)),r.push(i);return r},Pt=(e,t,n,s)=>{if(n<=0)return[];if(s==="24x7"){const i=he(t)*1e3;return Array.from({length:n},(o,a)=>e+(a+1)*i)}if(s==="1700-1700")return Rr(e,t,n);const r=he(t)*1e3;return Array.from({length:n},(i,o)=>e+(o+1)*r)},Er=(e,t,n,s)=>{if(s==="24x7"){const i=he(n)*1e3;return Math.max(0,Math.floor((t-e)/i))}if(s==="1700-1700"){const i=he(n)*1e3;let o=0,a=e;for(;a<t;)a+=i,pn(a)||(a=fn(a)),a<=t&&o++;return o}const r=he(n)*1e3;return Math.max(0,Math.floor((t-e)/r))},it=[{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"},{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"},{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"},{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"},{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"},{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"},{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"},{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"},{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"},{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"},{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"},{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"},{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"},{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"},{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"},{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"},{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"},{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"},{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"},{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"},{ticker:"XAU_USD",display_name:"XAUUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/XAU.svg"],description:"Gold",type:"commodity",session:"1700-1700"},{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"},{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"},{ticker:"NAS100_USD",display_name:"NASDAQ100",logo_urls:["https://cdn.iccandle.ai/web-assets/NAS100.svg"],description:"NASDAQ 100",type:"indices",session:"1700-1700"},{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"},{ticker:"BTCUSDT",display_name:"BTCUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/BTC.svg"],description:"BTCUSDT",type:"crypto",session:"24x7"},{ticker:"ETHUSDT",display_name:"ETHUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/ETH.svg"],description:"ETHUSDT",type:"crypto",session:"24x7"},{ticker:"XRPUSDT",display_name:"XRPUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/XRP.svg"],description:"XRPUSDT",type:"crypto",session:"24x7"},{ticker:"SOLUSDT",display_name:"SOLUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/SOL.svg"],description:"SOLUSDT",type:"crypto",session:"24x7"},{ticker:"ADAUSDT",display_name:"ADAUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/ADA.svg"],description:"ADAUSDT",type:"crypto",session:"24x7"},{ticker:"AVAUSDT",display_name:"AVAUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/AVA.svg"],description:"AVAUSDT",type:"crypto",session:"24x7"},{ticker:"AVAXUSDT",display_name:"AVAXUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/AVAX.svg"],description:"AVAXUSDT",type:"crypto",session:"24x7"},{ticker:"BNBUSDT",display_name:"BNBUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/BNB.svg"],description:"BNBUSDT",type:"crypto",session:"24x7"},{ticker:"DOGEUSDT",display_name:"DOGEUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/DOGE.svg"],description:"DOGEUSDT",type:"crypto",session:"24x7"},{ticker:"DOTUSDT",display_name:"DOTUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/DOT.svg"],description:"DOTUSDT",type:"crypto",session:"24x7"},{ticker:"TRXUSDT",display_name:"TRXUSDT",logo_urls:["https://cdn.iccandle.ai/web-assets/TRX.svg"],description:"TRXUSDT",type:"crypto",session:"24x7"},{ticker:"AAPL",display_name:"AAPL",logo_urls:["https://cdn.iccandle.ai/web-assets/AAPL.svg"],description:"Apple Inc.",type:"stock",session:"24x7"},{ticker:"AMZN",display_name:"AMZN",logo_urls:["https://cdn.iccandle.ai/web-assets/AMZN.svg"],description:"Amazon.Com Inc",type:"stock",session:"24x7"},{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"},{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"},{ticker:"KO",display_name:"KO",logo_urls:["https://cdn.iccandle.ai/web-assets/KO.svg"],description:"Coca-Cola Company",type:"stock",session:"24x7"},{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"},{ticker:"MSFT",display_name:"MSFT",logo_urls:["https://cdn.iccandle.ai/web-assets/MSFT.svg"],description:"Microsoft Corp",type:"stock",session:"24x7"},{ticker:"NFLX",display_name:"NFLX",logo_urls:["https://cdn.iccandle.ai/web-assets/NFLX.svg"],description:"NetFlix Inc",type:"stock",session:"24x7"},{ticker:"NKE",display_name:"NKE",logo_urls:["https://cdn.iccandle.ai/web-assets/NKE.svg"],description:"Nike, Inc.",type:"stock",session:"24x7"},{ticker:"NVDA",display_name:"NVDA",logo_urls:["https://cdn.iccandle.ai/web-assets/NVDA.svg"],description:"Nvidia Corp",type:"stock",session:"24x7"},{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"},{ticker:"TSLA",display_name:"TSLA",logo_urls:["https://cdn.iccandle.ai/web-assets/TSLA.svg"],description:"Tesla, Inc. Common Stock",type:"stock",session:"24x7"},{ticker:"XAG_USD",display_name:"XAGUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/XAG.svg"],description:"Silver",type:"commodity",session:"1700-1700"},{ticker:"XCU_USD",display_name:"XCUUSD",logo_urls:["https://cdn.iccandle.ai/web-assets/XCU.svg"],description:"Copper",type:"commodity",session:"1700-1700"}],Sr=({replayTabId:e,futureBarsRef:t,highlightBarsRef:n,tvWidgetRef:s,pushBar:r,resolution:i,symbol:o})=>{const a=ye(R=>R.newsSelectedCandles),f=ye(R=>R.newsTargetCandle),d=ye(R=>R.newsPlayEndTimestamp),l=ye(R=>R.gapCount),_=y.useRef(a),b=y.useRef(null);return y.useEffect(()=>{const R={current:null};let p=null,w=!1;return(async()=>{if(!w){if(a?.length&&f!==null){if(b.current===a)return;t.current=[];const h=d!=null;if(_.current||h)try{s?.current?.resetCache(),s?.current?.activeChart().resetData()}catch{}try{s?.current?.activeChart().executeActionById("timeScaleReset")}catch{}const j=[...a].slice(-50-(l||0)),N=br(j,f[f.length-1],f),H=it.find(U=>U.ticker===o||U.display_name===o)?.session||"24x7",k=Pt(f[f.length-1].timestamp,i,l||0,H),q=Pt(l?k[k.length-1]:f[f.length-1].timestamp,i,N.length,H),F=N.map((U,P)=>({open:U.o,high:U.h,low:U.l,close:U.c,time:q[P]})).sort((U,P)=>U.time-P.time);n.current=F.slice(-50);let M=0,le=0;const W=async()=>{R.current&&(clearInterval(R.current),R.current=null),b.current=a;try{a&&F.length>0}catch(U){console.error("Error setting visible range:",U)}};F.length===0?(t.current=[],await W()):p=setTimeout(()=>{w||(R.current=setInterval(()=>{if(M<F.length){if(r(e,F[M]))t.current=F.slice(0,M+1),M++,le=0,M===F.length&&(t.current=F,W());else if(le++,le>=10){t.current=[...F];try{s?.current?.activeChart().resetData()}catch{}W()}}},150))},700)}else{if(t.current=[],_.current)try{s?.current?.resetCache(),s?.current?.activeChart().resetData()}catch{}b.current=null}_.current=a}})(),()=>{w=!0,p&&clearTimeout(p),R.current&&(t.current=[],clearInterval(R.current))}},[r,t,n,d,a,f,e,i,o,s,l]),y.useEffect(()=>{a===null&&(n.current=[])},[n,a]),m.jsx(m.Fragment,{})},Dr=({children:e,eventId:t,widgetKey:n,chartWidget:s,event:r,theme:i,newsDetail:o,selectedCandles:a,defaultSymbol:f,currentSymbol:d,currentTimeFrame:l,isUpcoming:_=!1,isElapsed:b=!1,onBack:R,pushBar:p,iframeRef:w,futureRef:h,pendingMessageRef:A,iframeReadyToListenRef:j,highlightBarsRef:N,setGapCountExternal:B,setReplayModeExternal:H})=>{const k=y.useRef(null),{setCurrentSymbol:q,setSelectedTimeframe:re}=er(),{setNewsTargetCandle:F,setGapCount:M,setNewsPlayEndTimestamp:le,setNewsSelectedCandles:W}=ye();return y.useEffect(()=>{if(!t||t==""||!s)return;const U=()=>{if(s)try{const g=s?.activeChart();g&&g.getAllShapes().forEach(z=>{try{g.removeEntity(z.id)}catch(v){console.error("Failed to remove shape",v)}})}catch{}},P=async()=>{const{data:g,status:z}=await X.get(`https://corprate-widget.iccandle.ai/news/${t}`,{headers:{"api-key":n},params:{symbol:f}});if(z!==200){console.error("Failed to fetch news detail");return}return g};let K=!1;const L=[],ie=(g,z)=>{const v=window.setTimeout(g,z);return L.push(v),v};return k.current=s,s.onChartReady(async()=>{i==="dark"||i==="system"?(s.applyOverrides({"paneProperties.background":"#000000","scalesProperties.textColor":"#fff"}),s.setCSSCustomProperty("--tv-color-pane-background","#000000"),s.setCSSCustomProperty("--tv-color-platform-background","#0f0f0f")):(s.applyOverrides({"paneProperties.background":"#ffffff","scalesProperties.textColor":"#000"}),s.setCSSCustomProperty("--tv-color-pane-background","#ffffff"),s.setCSSCustomProperty("--tv-color-platform-background","#f9fafb"));const g=s.activeChart();if(!g)return;const z=async(S,Y)=>{await g.createShape({time:Y},{shape:"vertical_line",lock:!0,disableSelection:!0,overrides:{linestyle:2,linewidth:1}});const I=await g.exportData(),D=I.data.findIndex(x=>x[0]===Y);let Z=a;if(D!=-1&&!Z&&(Z=[...an].sort((x,V)=>V-x).find(x=>I.data[D+x])??null),D!=-1&&Z){const x=S,V=I.data[D+Z][0],$=I.data.filter(ce=>ce[0]>x&&ce[0]<=V)??[];let ee=null,pe=null;if($.length>0){const ce=$.reduce((ne,se,O,J)=>Number(se[3])<Number(J[ne][3])?O:ne,0),G=$[ce];pe={time:G[0],value:Number(G[3])}}if($.length>0){const ce=$.reduce((ne,se,O,J)=>Number(se[2])>Number(J[ne][2])?O:ne,0),G=$[ce];ee={time:G[0],value:Number(G[2])}}if(ee&&pe&&$.length>0){const ce=ee.value,G=pe.value,se=I.data[D+1][1];await g.createMultipointShape([{time:x,price:se},{time:V,price:ce}],{shape:"rectangle",overrides:{showLabel:!1,linecolor:"#12B76A",linewidth:1,linestyle:0,color:"#12B76A10",borderColor:"#12B76A",borderWidth:1,backgroundColor:"#12B76A",transparency:70,drawBorder:!1,frozen:!0}}),await g.createMultipointShape([{time:x,price:G},{time:V,price:se}],{shape:"rectangle",overrides:{showLabel:!1,linecolor:"#D92D2030",linewidth:1,linestyle:0,color:"#D92D2010",borderWidth:1,backgroundColor:"#D92D20",transparency:70,drawBorder:!1,frozen:!0}}),await g.createMultipointShape([{time:x,price:ce},{time:V,price:ce}],{shape:"trend_line",overrides:{linecolor:"#12B76A",linewidth:1,linestyle:2,extendLeft:!0,extendRight:!0}}),await g.createMultipointShape([{time:x,price:G},{time:V,price:G}],{shape:"trend_line",overrides:{linecolor:"#D92D20",linewidth:1,linestyle:2,extendLeft:!0,extendRight:!0}});const O=gr.find(ve=>xt(ve.name)==xt(d))?.pipLocation;let J="",Q="";if(O){const ve=Math.pow(10,-O),ot=parseFloat(Math.abs((ce-se)*ve).toFixed(1)),at=parseFloat(Math.abs((G-se)*ve).toFixed(1));J=`${ot>=0?"+":""}${ot.toFixed(2)} pip`,Q=`${at>=0?"-":""}${at.toFixed(2)} pip`}await g.createShape({time:ee.time,price:ee.value},{shape:"arrow_down",overrides:{arrowColor:"#12B76A",fontsize:11,color:"#12B76A",text:J,bold:!0}}),await g.createShape({time:pe.time,price:pe.value},{shape:"arrow_up",overrides:{arrowColor:"#D92D20",fontsize:11,color:"#D92D20",text:Q,bold:!0}});const fe=Math.floor((x+V)/2);await g.createShape({time:fe},{shape:"text",text:`${Z} candles`,zOrder:"top",overrides:{fontsize:12,color:"#FFFFFF",bold:!0,backgroundColor:"#FFFFFF"}})}}if(I&&I.data.length>0&&I.data[0][0]>=I.data[I.data.length-1][0]&&await g.setVisibleRange({from:I.data[0][0],to:I.data[I.data.length-1][0]}),_&&r){const x=Math.floor(Date.now()/1e3),V=Y,$=g.resolution(),ee=3600*24*7;x-ee>=V+ee&&await g.setVisibleRange({from:x-ee,to:V+ee},{applyDefaultRightMargin:!0,percentRightMargin:50}),ie(()=>{K||k.current!==s||Number($)<=30&&g.createShape({time:V},{shape:"vertical_line",lock:!0,disableSelection:!0,overrides:{linestyle:2,linewidth:1}})},2e3)}},v=async()=>{if(K||k.current!==s)return;const S=await P();if(K||k.current!==s)return;U();const Y=(S?.event?.timestamp??0)/1e3,I=Ke(l),D=Y-Y%I;g.getVisibleBarsRange()||await new Promise(V=>setTimeout(V,2e3));const x=g.getVisibleBarsRange();x&&x.from<=Y&&Y<=x.to?await z(Y,D):(_||await g.setVisibleRange({from:Y},{applyDefaultRightMargin:!0,percentRightMargin:50}),await z(Y,D))},u=()=>{ie(()=>{K||k.current!==s||d==g.symbol()||(async()=>{try{B(0),H(!1),W(null),w.current?.contentWindow?.postMessage({action:"handleClose"},"*"),q(g.symbol())}catch(S){console.log("error=>",S)}})()},300)},C=S=>{ie(()=>{K||k.current!==s||l==S||(async()=>{try{B(0),H(!1),W(null),w.current?.contentWindow?.postMessage({action:"handleClose"},"*"),re(S)}catch(Y){console.log("error=>",Y)}})()},300)};g.onSymbolChanged().subscribe(null,u),g.onIntervalChanged().subscribe(null,C);try{b||await v()}catch(S){console.log("error=>",S)}K&&(()=>{try{g.onSymbolChanged().unsubscribe(null,u)}catch{}try{g.onIntervalChanged().unsubscribe(null,C)}catch{}})()}),()=>{K=!0,L.forEach(g=>window.clearTimeout(g)),U(),k.current===s&&(k.current=null)}},[i,n,s,_,f,a,r,t,l,re,d,q,b,le,W,M,F,B,H,w]),y.useEffect(()=>{if(s){if(t==""||b)return;s.onChartReady(async()=>{const U=s?.activeChart();re(U.resolution()),s.resetCache(),U.resetData(),U&&U.onDataLoaded().subscribe(null,async()=>{const{data:P}=await U.exportData(),K=Ke(l),L=(r?.timestamp??0)/1e3,ie=L-L%K,g=P.findIndex(v=>v[0]===ie),z=P.slice(g-49,g+1).map(v=>({o:v[1],h:v[2],l:v[3],c:v[4],timestamp:v[0]*1e3}));if(_){const v=P[P.length-1],u={o:v[1],h:v[2],l:v[3],c:v[4],timestamp:v[0]*1e3},C=U.resolution(),T=he(C)*1e3,S=u.timestamp,Y=r?.timestamp??0,I=Math.floor(Y/T)*T,D=it.find($=>$.ticker===d||$.display_name===d)?.session||"24x7",Z=Er(S,I,C,D),x=P.slice(-50).map($=>({o:$[1],h:$[2],l:$[3],c:$[4],timestamp:$[0]*1e3}));M(Z),F(x);const V={newsTargetCandle:x,gapCount:Z};A.current=V,j.current&&(w.current?.contentWindow?.postMessage(A.current,"*"),A.current=null)}else{F(z),M(0);const v={newsTargetCandle:z,gapCount:0};A.current=v,j.current&&(w.current?.contentWindow?.postMessage(A.current,"*"),A.current=null)}},!0)})}},[t,r?.timestamp,F,re,M,l,_,b,d,s,A]),m.jsx("div",{className:"news-widget_detail_page__container",children:m.jsxs("div",{className:"news-widget_detail_page__right_border",children:[m.jsx("div",{className:"news-widget_detail_page__title_container",children:m.jsxs("div",{className:"news-widget_detail_page__title_padding",children:[m.jsx("button",{type:"button",className:"news-widget__button news-widget__button--ghost news-widget__button--icon news-widget_detail_page__back_button",onClick:R,children:m.jsx(dr,{className:"news-widget_detail_page__back_icon"})}),m.jsx("p",{className:"news-widget_detail_page__title_text",children:"Economic Calendar Analysis"})]})}),m.jsx("div",{className:"news-widget_detail_page__event_details",children:m.jsxs(yr,{newsDetail:o,children:[e,_&&m.jsx(Sr,{replayTabId:t||"news",futureBarsRef:h,highlightBarsRef:N,pushBar:p,tvWidgetRef:k,resolution:l||"15",symbol:d})]})})]})})},Se="https://widget-result-news.iccandle.ai",Ot="https://corprate-widget.iccandle.ai/news",Ar=({chartWidget:e,children:t,widgetKey:n,userId:s,defaultSymbol:r,chartInterval:i="15",theme:o,symbolMapper:a,pushBar:f,futureRef:d,highlightBarsRef:l,setGapCountExternal:_,setReplayModeExternal:b})=>{const{start:R}=wn(),[p,w]=y.useState(""),[h,A]=y.useState(i),[j,N]=y.useState(r),[B,H]=y.useState(i),[k,q]=y.useState(r),[re,F]=y.useState(null),[M,le]=y.useState(null),W=y.useRef(null),U=y.useRef(!1),{setNewsSelectedCandles:P,setNewsPlayEndTimestamp:K,newsTargetCandle:L,gapCount:ie}=ye(),g=y.useRef(null),z=Qs[h]||"M15",v=Ke("60"),u=M?.[0]?.timestamp?M?.[0]?.timestamp/1e3:0,C=u-u%v,T=M?.[0]?.candleData.H1?.candles,S=T?.findIndex(G=>G.timestamp===C)||0,I=(T?.length||0)-S<=10,D="next_pip_up_10"in(M?.[0]?.candleData[z]?.metadata??{}),Z=!!p&&!D,x=y.useRef(Z),V=y.useRef(!1);y.useEffect(()=>{if(Z!==x.current){if(x.current=Z,V.current){V.current=!1;return}R()}},[Z,R]),y.useEffect(()=>{const G=async O=>{const{data:J,status:Q}=await X.get(`${Ot}/${O}`,{headers:{"api-key":n},params:{symbol:r}});return Q!==200?(console.error("Failed to fetch news detail"),null):J},ne=async O=>{const{data:J,status:Q}=await X.get(`${Ot}/similar-details`,{headers:{"api-key":n},params:{event_id:O}});return Q!==200?(console.error("Failed to fetch compared news"),null):J};(async()=>{if(p==="")return;const[O,J]=await Promise.all([G(p),ne(p)]);O&&F(O),J&&le(J)})()},[n,p,r]);const $=y.useCallback(()=>{b(!1),_(0),P(null),K(null)},[b,_,P,K]),ee=y.useCallback(()=>{w(""),N(r),$()},[r,$]);y.useEffect(()=>{const G=async({origin:ne,data:se})=>{if(ne!==Se||typeof se!="string")return;const O=JSON.parse(se);if(O.action=="back")ee();else if(O.action=="back-to-similar-events")$();else if(O.action=="eventClicked"){V.current=!0,R();const Q=O.data.event,fe=e?.activeChart();await e?.headerReady(),fe?.clearMarks(2),localStorage.setItem("iccandle:current-news-event",JSON.stringify({actual:Q.actual,event_name:Q.event_name,forecast:Q.forecast,id:Q.id,metric:Q.metric,previous:Q.previous,timestamp:Q.timestamp,currency:Q.currency})),fe?.refreshMarks(),H(h),q(j),w(Q.id)}else if(O.action=="intervalChanged"||O.action=="symbolChanged"){const J=O.data;if(J.type===2)return;J.resolution&&A(J.resolution);const Q=it.find(fe=>fe.display_name==J.symbol||fe.ticker==J.symbol)?.ticker||"XAU_USD";N(Q)}else if(O.action=="replay"){if(D)return;const J=O.data;b(J.isReplay),_(ie),P(J.selectedCandles),K(L?.[L.length-1]?.timestamp??null)}else O.action=="iframe-ready"&&(U.current=!0,W.current?.contentWindow?.postMessage(g.current,"*"),g.current=null)};return window.addEventListener("message",G),()=>window.removeEventListener("message",G)},[D,L,ie,e,r,R,$,ee,a,g,H,q,j,h,b,_,K,P]);const pe=y.useMemo(()=>{const G=M?.[0]?.candleData?.[z]?.metadata;return G?[...an].sort((ne,se)=>se-ne).find(ne=>[`next_pip_up_${ne}`,`next_pip_down_${ne}`].some(O=>G[O]!==void 0))??null:null},[M,z]);y.useEffect(()=>{const G=()=>{ee()};return window.addEventListener("popstate",G),()=>window.removeEventListener("popstate",G)},[ee]);const ce=y.useMemo(()=>p?M?D?`${Se}/${p}?apiKey=${n}&userId=${s}&theme=${o}&interval=${B}&symbol=${k}`:`${Se}/similar-events/${p}?apiKey=${n}&userId=${s}&theme=${o}`:`${Se}?apiKey=${n}&userId=${s}&theme=${o}`:`${Se}?apiKey=${n}&userId=${s}&theme=${o}`,[p,M,D,n,o,s,B,k]);return m.jsxs("div",{className:"news-widget_main__container news-widget_main__container--lg",children:[m.jsx("div",{className:"news-widget_main__left",style:{display:p&&!D?"flex":"none"},children:m.jsx(tr,{selectedTimeframe:h,setSelectedTimeframe:A,currentSymbol:j,setCurrentSymbol:N,children:m.jsx(Dr,{eventId:p,chartWidget:e,widgetKey:n,theme:o,defaultSymbol:r,newsDetail:re,isUpcoming:I,event:re?.event,selectedCandles:pe,currentTimeFrame:h,currentSymbol:j,onBack:ee,isElapsed:D,iframeRef:W,pendingMessageRef:g,iframeReadyToListenRef:U,pushBar:f,futureRef:d,highlightBarsRef:l,setReplayModeExternal:b,setGapCountExternal:_,children:t})})}),m.jsx("iframe",{src:ce,ref:W,className:p&&!D?"news-widget_main__iframe_half":"news-widget_main__iframe_full"})]})},Ur="https://api.iccandle.ai",Tr='"Inter Tight", ui-sans-serif, system-ui, sans-serif';function kt(e){return{iccandle_primary:e.iccandle_primary,iccandle_border:e.iccandle_border,iccandle_text:e.iccandle_text,iccandle_background:e.iccandle_background,iccandle_primary_gradient_end:e.iccandle_primary_gradient_end,iccandle_font:e.icc_font??e.iccandle_font??Tr}}const Nr=async e=>{const t=await fetch(`${Ur}/corporate-client/v1/widgetStyle/search/user/?service_type=news`,{headers:{"api-key":e}});if(!t.ok)throw new Error(`Failed to fetch widget style: ${t.statusText}`);const n=await t.json();return{...n,dark:kt(n.dark),light:kt(n.light)}},Ft={iccandle_font:"--iccandle-font",iccandle_primary:"--iccandle-primary",iccandle_border:"--iccandle-border",iccandle_text:"--iccandle-text",iccandle_background:"--iccandle-background",iccandle_primary_gradient_end:"--iccandle-primary-gradient-end"};function vr(e,t){const[n,s]=y.useState(null);y.useEffect(()=>{Nr(e).then(d=>{s(d)})},[e]);const r=y.useRef(null),[i,o]=y.useState(null),a=y.useMemo(()=>t==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":t,[t]),f=y.useMemo(()=>{if(n)return a==="dark"?n.dark:n.light},[n,a]);return y.useEffect(()=>{if(typeof window>"u"||!f||!i)return;const d=i;Object.keys(Ft).forEach(l=>{d.style.setProperty(Ft[l],f[l])})},[f,i]),{rootRef:r,setRootEl:o,resolvedTheme:a}}const xr=e=>{const{rootRef:t,setRootEl:n,resolvedTheme:s}=vr(e.widgetKey,e.theme);return m.jsx("div",{ref:r=>{t.current=r,n(r)},className:`news-widget__container news-widget ${s==="dark"?"dark":""}`,children:m.jsx(gn,{theme:s,children:m.jsx(Ar,{...e,children:e.children})})})};exports.NewsWidget=xr;
|