@iccandle/news 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/news-widget.cjs +7 -7
- package/dist/news-widget.d.ts +11 -2
- package/dist/news-widget.js +2208 -1451
- 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
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("react");var Ue={exports:{}},we={};var rt;function pn(){if(rt)return we;rt=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 we.Fragment=t,we.jsx=n,we.jsxs=n,we}var ye={};var it;function fn(){return it||(it=1,process.env.NODE_ENV!=="production"&&(function(){function e(u){if(u==null)return null;if(typeof u=="function")return u.$$typeof===$?null:u.displayName||u.name||null;if(typeof u=="string")return u;switch(u){case h:return"Fragment";case M:return"Profiler";case x:return"StrictMode";case K:return"Suspense";case k:return"SuspenseList";case ee: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 y:return"Portal";case B:return u.displayName||"Context";case T:return(u._context.displayName||"Context")+".Consumer";case L:var w=u.render;return u=u.displayName,u||(u=w.displayName||w.name||"",u=u!==""?"ForwardRef("+u+")":"ForwardRef"),u;case F:return w=u.displayName||null,w!==null?w:e(u.type)||"Memo";case H:w=u._payload,u=u._init;try{return e(u(w))}catch{}}return null}function t(u){return""+u}function n(u){try{t(u);var w=!1}catch{w=!0}if(w){w=console;var D=w.error,A=typeof Symbol=="function"&&Symbol.toStringTag&&u[Symbol.toStringTag]||u.constructor.name||"Object";return D.call(w,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",A),t(u)}}function s(u){if(u===h)return"<>";if(typeof u=="object"&&u!==null&&u.$$typeof===H)return"<...>";try{var w=e(u);return w?"<"+w+">":"<...>"}catch{return"<...>"}}function r(){var u=v.A;return u===null?null:u.getOwner()}function i(){return Error("react-stack-top-frame")}function o(u){if(j.call(u,"key")){var w=Object.getOwnPropertyDescriptor(u,"key").get;if(w&&w.isReactWarning)return!1}return u.key!==void 0}function a(u,w){function D(){g||(g=!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)",w))}D.isReactWarning=!0,Object.defineProperty(u,"key",{get:D,configurable:!0})}function p(){var u=e(this.type);return X[u]||(X[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,w,D,A,G,Q){var R=D.ref;return u={$$typeof:f,type:u,key:w,props:D,_owner:A},(R!==void 0?R:null)!==null?Object.defineProperty(u,"ref",{enumerable:!1,get:p}):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:G}),Object.defineProperty(u,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:Q}),Object.freeze&&(Object.freeze(u.props),Object.freeze(u)),u}function l(u,w,D,A,G,Q){var R=w.children;if(R!==void 0)if(A)if(q(R)){for(A=0;A<R.length;A++)_(R[A]);Object.freeze&&Object.freeze(R)}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 _(R);if(j.call(w,"key")){R=e(u);var U=Object.keys(w).filter(function(P){return P!=="key"});A=0<U.length?"{key: someKey, "+U.join(": ..., ")+": ...}":"{key: someKey}",W[R+A]||(U=0<U.length?"{"+U.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} />`,N,v,Q,v),H[v+N]=!0)}if(v=null,R!==void 0&&(n(R),v=""+R),i(h)&&(n(h.key),v=""+h.key),"key"in h){R={};for(var ae in h)ae!=="key"&&(R[ae]=h[ae])}else R=h;return v&&a(R,typeof l=="function"?l.displayName||l.name||"Unknown":l),d(l,v,R,s(),I,Z)}function w(l){S(l)?l._store&&(l._store.validated=1):typeof l=="object"&&l!==null&&l.$$typeof===V&&(l._payload.status==="fulfilled"?S(l._payload.value)&&l._payload.value._store&&(l._payload.value._store.validated=1):l._store&&(l._store.validated=1))}function S(l){return typeof l=="object"&&l!==null&&l.$$typeof===f}var T=g,f=Symbol.for("react.transitional.element"),y=Symbol.for("react.portal"),_=Symbol.for("react.fragment"),L=Symbol.for("react.strict_mode"),Y=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),k=Symbol.for("react.context"),$=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),z=Symbol.for("react.memo"),V=Symbol.for("react.lazy"),ee=Symbol.for("react.activity"),X=Symbol.for("react.client.reference"),F=T.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,B=Object.prototype.hasOwnProperty,O=Array.isArray,M=console.createTask?console.createTask:function(){return null};T={react_stack_bottom_frame:function(l){return l()}};var U,x={},b=T.react_stack_bottom_frame.bind(T,o)(),P=M(r(o)),H={};le.Fragment=_,le.jsx=function(l,h,R){var N=1e4>F.recentlyCreatedOwnerStacks++;return u(l,h,R,!1,N?Error("react-stack-top-frame"):b,N?M(r(l)):P)},le.jsxs=function(l,h,R){var N=1e4>F.recentlyCreatedOwnerStacks++;return u(l,h,R,!0,N?Error("react-stack-top-frame"):b,N?M(r(l)):P)}})()),le}var ze;function Jt(){return ze||(ze=1,process.env.NODE_ENV==="production"?we.exports=It():we.exports=qt()),we.exports}var m=Jt();const _t=g.createContext(null);function Gt(){const e=g.useContext(_t);if(!e)throw new Error("useCtaLoader must be used within CtaLoaderProvider");return e}const Ve=1100,zt=180;function Vt({children:e,theme:t}){const[n,r]=g.useState(!1),[s,o]=g.useState(!1),[i,a]=g.useState(0),p=g.useRef(null),d=g.useRef(null),u=g.useCallback(()=>{p.current&&window.clearTimeout(p.current),p.current=null,d.current&&window.clearTimeout(d.current),d.current=null,d.current=window.setTimeout(()=>{d.current=null,r(!1),o(!1)},zt)},[]),w=g.useCallback(()=>{p.current&&window.clearTimeout(p.current),p.current=null,d.current&&window.clearTimeout(d.current),d.current=null,a(f=>f+1),o(!1),r(!0),requestAnimationFrame(()=>requestAnimationFrame(()=>o(!0))),p.current=window.setTimeout(()=>{p.current=null,u()},Ve)},[u]);g.useEffect(()=>u,[u]);const S=g.useMemo(()=>({start:w,stop:u,visible:n}),[w,u,n]),T=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(_t.Provider,{value:S,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:T,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:s?"scaleX(1)":"scaleX(0)",transition:`transform ${Ve}ms linear`}},i)})})]})})]})}function ht(e,t){return function(){return e.apply(t,arguments)}}const{toString:Xt}=Object.prototype,{getPrototypeOf:ke}=Object,{iterator:Se,toStringTag:wt}=Symbol,Ne=(e=>t=>{const n=Xt.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),W=e=>(e=e.toLowerCase(),t=>Ne(t)===e),Ae=e=>t=>typeof t===e,{isArray:ie}=Array,oe=Ae("undefined");function pe(e){return e!==null&&!oe(e)&&e.constructor!==null&&!oe(e.constructor)&&J(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const yt=W("ArrayBuffer");function Kt(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&yt(e.buffer),t}const Wt=Ae("string"),J=Ae("function"),Rt=Ae("number"),fe=e=>e!==null&&typeof e=="object",Zt=e=>e===!0||e===!1,Re=e=>{if(Ne(e)!=="object")return!1;const t=ke(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(wt in e)&&!(Se in e)},Qt=e=>{if(!fe(e)||pe(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},en=W("Date"),tn=W("File"),nn=W("Blob"),rn=W("FileList"),sn=e=>fe(e)&&J(e.pipe),on=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||J(e.append)&&((t=Ne(e))==="formdata"||t==="object"&&J(e.toString)&&e.toString()==="[object FormData]"))},an=W("URLSearchParams"),[cn,ln,un,dn]=["ReadableStream","Request","Response","Headers"].map(W),pn=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function me(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),ie(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(pe(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let a;for(r=0;r<i;r++)a=o[r],t.call(null,e[a],a,e)}}function Et(e,t){if(pe(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r=n.length,s;for(;r-- >0;)if(s=n[r],t===s.toLowerCase())return s;return null}const te=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Ct=e=>!oe(e)&&e!==te;function De(){const{caseless:e,skipUndefined:t}=Ct(this)&&this||{},n={},r=(s,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const i=e&&Et(n,o)||o;Re(n[i])&&Re(s)?n[i]=De(n[i],s):Re(s)?n[i]=De({},s):ie(s)?n[i]=s.slice():(!t||!oe(s))&&(n[i]=s)};for(let s=0,o=arguments.length;s<o;s++)arguments[s]&&me(arguments[s],r);return n}const fn=(e,t,n,{allOwnKeys:r}={})=>(me(t,(s,o)=>{n&&J(s)?Object.defineProperty(e,o,{value:ht(s,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),mn=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),_n=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),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)},hn=(e,t,n,r)=>{let s,o,i;const a={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),o=s.length;o-- >0;)i=s[o],(!r||r(i,e,t))&&!a[i]&&(t[i]=e[i],a[i]=!0);e=n!==!1&&ke(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},wn=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},yn=e=>{if(!e)return null;if(ie(e))return e;let t=e.length;if(!Rt(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},Rn=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&ke(Uint8Array)),En=(e,t)=>{const r=(e&&e[Se]).call(e);let s;for(;(s=r.next())&&!s.done;){const o=s.value;t.call(e,o[0],o[1])}},Cn=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},gn=W("HTMLFormElement"),bn=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),Xe=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Sn=W("RegExp"),gt=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};me(n,(s,o)=>{let i;(i=t(s,o,e))!==!1&&(r[o]=i||s)}),Object.defineProperties(e,r)},Nn=e=>{gt(e,(t,n)=>{if(J(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(J(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},An=(e,t)=>{const n={},r=s=>{s.forEach(o=>{n[o]=!0})};return ie(e)?r(e):r(String(e).split(t)),n},Tn=()=>{},Ln=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Un(e){return!!(e&&J(e.append)&&e[wt]==="FormData"&&e[Se])}const xn=e=>{const t=new Array(10),n=(r,s)=>{if(fe(r)){if(t.indexOf(r)>=0)return;if(pe(r))return r;if(!("toJSON"in r)){t[s]=r;const o=ie(r)?[]:{};return me(r,(i,a)=>{const p=n(i,s+1);!oe(p)&&(o[a]=p)}),t[s]=void 0,o}}return r};return n(e,0)},vn=W("AsyncFunction"),Dn=e=>e&&(fe(e)||J(e))&&J(e.then)&&J(e.catch),bt=((e,t)=>e?setImmediate:t?((n,r)=>(te.addEventListener("message",({source:s,data:o})=>{s===te&&o===n&&r.length&&r.shift()()},!1),s=>{r.push(s),te.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",J(te.postMessage)),On=typeof queueMicrotask<"u"?queueMicrotask.bind(te):typeof process<"u"&&process.nextTick||bt,Pn=e=>e!=null&&J(e[Se]),c={isArray:ie,isArrayBuffer:yt,isBuffer:pe,isFormData:on,isArrayBufferView:Kt,isString:Wt,isNumber:Rt,isBoolean:Zt,isObject:fe,isPlainObject:Re,isEmptyObject:Qt,isReadableStream:cn,isRequest:ln,isResponse:un,isHeaders:dn,isUndefined:oe,isDate:en,isFile:tn,isBlob:nn,isRegExp:Sn,isFunction:J,isStream:sn,isURLSearchParams:an,isTypedArray:Rn,isFileList:rn,forEach:me,merge:De,extend:fn,trim:pn,stripBOM:mn,inherits:_n,toFlatObject:hn,kindOf:Ne,kindOfTest:W,endsWith:wn,toArray:yn,forEachEntry:En,matchAll:Cn,isHTMLForm:gn,hasOwnProperty:Xe,hasOwnProp:Xe,reduceDescriptors:gt,freezeMethods:Nn,toObjectSet:An,toCamelCase:bn,noop:Tn,toFiniteNumber:Ln,findKey:Et,global:te,isContextDefined:Ct,isSpecCompliantForm:Un,toJSONObject:xn,isAsyncFn:vn,isThenable:Dn,setImmediate:bt,asap:On,isIterable:Pn};let C=class St extends Error{static from(t,n,r,s,o,i){const a=new St(t.message,n||t.code,r,s,o);return a.cause=t,a.name=t.name,i&&Object.assign(a,i),a}constructor(t,n,r,s,o){super(t),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),r&&(this.config=r),s&&(this.request=s),o&&(this.response=o,this.status=o.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}}};C.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";C.ERR_BAD_OPTION="ERR_BAD_OPTION";C.ECONNABORTED="ECONNABORTED";C.ETIMEDOUT="ETIMEDOUT";C.ERR_NETWORK="ERR_NETWORK";C.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";C.ERR_DEPRECATED="ERR_DEPRECATED";C.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";C.ERR_BAD_REQUEST="ERR_BAD_REQUEST";C.ERR_CANCELED="ERR_CANCELED";C.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";C.ERR_INVALID_URL="ERR_INVALID_URL";const Fn=null;function Oe(e){return c.isPlainObject(e)||c.isArray(e)}function Nt(e){return c.endsWith(e,"[]")?e.slice(0,-2):e}function Ke(e,t,n){return e?e.concat(t).map(function(s,o){return s=Nt(s),!n&&o?"["+s+"]":s}).join(n?".":""):t}function jn(e){return c.isArray(e)&&!e.some(Oe)}const kn=c.toFlatObject(c,{},null,function(t){return/^is[A-Z]/.test(t)});function Te(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(y,_){return!c.isUndefined(_[y])});const r=n.metaTokens,s=n.visitor||u,o=n.dots,i=n.indexes,p=(n.Blob||typeof Blob<"u"&&Blob)&&c.isSpecCompliantForm(t);if(!c.isFunction(s))throw new TypeError("visitor must be a function");function d(f){if(f===null)return"";if(c.isDate(f))return f.toISOString();if(c.isBoolean(f))return f.toString();if(!p&&c.isBlob(f))throw new C("Blob is not supported. Use a Buffer instead.");return c.isArrayBuffer(f)||c.isTypedArray(f)?p&&typeof Blob=="function"?new Blob([f]):Buffer.from(f):f}function u(f,y,_){let L=f;if(f&&!_&&typeof f=="object"){if(c.endsWith(y,"{}"))y=r?y:y.slice(0,-2),f=JSON.stringify(f);else if(c.isArray(f)&&jn(f)||(c.isFileList(f)||c.endsWith(y,"[]"))&&(L=c.toArray(f)))return y=Nt(y),L.forEach(function(A,k){!(c.isUndefined(A)||A===null)&&t.append(i===!0?Ke([y],k,o):i===null?y:y+"[]",d(A))}),!1}return Oe(f)?!0:(t.append(Ke(_,y,o),d(f)),!1)}const w=[],S=Object.assign(kn,{defaultVisitor:u,convertValue:d,isVisitable:Oe});function T(f,y){if(!c.isUndefined(f)){if(w.indexOf(f)!==-1)throw Error("Circular reference detected in "+y.join("."));w.push(f),c.forEach(f,function(L,Y){(!(c.isUndefined(L)||L===null)&&s.call(t,L,c.isString(Y)?Y.trim():Y,y,S))===!0&&T(L,y?y.concat(Y):[Y])}),w.pop()}}if(!c.isObject(e))throw new TypeError("data must be an object");return T(e),t}function We(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function Be(e,t){this._pairs=[],e&&Te(e,this,t)}const At=Be.prototype;At.append=function(t,n){this._pairs.push([t,n])};At.toString=function(t){const n=t?function(r){return t.call(this,r,We)}:We;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function Bn(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Tt(e,t,n){if(!t)return e;const r=n&&n.encode||Bn,s=c.isFunction(n)?{serialize:n}:n,o=s&&s.serialize;let i;if(o?i=o(t,s):i=c.isURLSearchParams(t)?t.toString():new Be(t,s).toString(r),i){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class Ze{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){c.forEach(this.handlers,function(r){r!==null&&t(r)})}}const Me={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Mn=typeof URLSearchParams<"u"?URLSearchParams:Be,Yn=typeof FormData<"u"?FormData:null,$n=typeof Blob<"u"?Blob:null,Hn={isBrowser:!0,classes:{URLSearchParams:Mn,FormData:Yn,Blob:$n},protocols:["http","https","file","blob","url","data"]},Ye=typeof window<"u"&&typeof document<"u",Pe=typeof navigator=="object"&&navigator||void 0,In=Ye&&(!Pe||["ReactNative","NativeScript","NS"].indexOf(Pe.product)<0),qn=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Jn=Ye&&window.location.href||"http://localhost",Gn=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ye,hasStandardBrowserEnv:In,hasStandardBrowserWebWorkerEnv:qn,navigator:Pe,origin:Jn},Symbol.toStringTag,{value:"Module"})),q={...Gn,...Hn};function zn(e,t){return Te(e,new q.classes.URLSearchParams,{visitor:function(n,r,s,o){return q.isNode&&c.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}function Vn(e){return c.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Xn(e){const t={},n=Object.keys(e);let r;const s=n.length;let o;for(r=0;r<s;r++)o=n[r],t[o]=e[o];return t}function Lt(e){function t(n,r,s,o){let i=n[o++];if(i==="__proto__")return!0;const a=Number.isFinite(+i),p=o>=n.length;return i=!i&&c.isArray(s)?s.length:i,p?(c.hasOwnProp(s,i)?s[i]=[s[i],r]:s[i]=r,!a):((!s[i]||!c.isObject(s[i]))&&(s[i]=[]),t(n,r,s[i],o)&&c.isArray(s[i])&&(s[i]=Xn(s[i])),!a)}if(c.isFormData(e)&&c.isFunction(e.entries)){const n={};return c.forEachEntry(e,(r,s)=>{t(Vn(r),s,n,0)}),n}return null}function Kn(e,t,n){if(c.isString(e))try{return(t||JSON.parse)(e),c.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const _e={transitional:Me,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,o=c.isObject(t);if(o&&c.isHTMLForm(t)&&(t=new FormData(t)),c.isFormData(t))return s?JSON.stringify(Lt(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(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return zn(t,this.formSerializer).toString();if((a=c.isFileList(t))||r.indexOf("multipart/form-data")>-1){const p=this.env&&this.env.FormData;return Te(a?{"files[]":t}:t,p&&new p,this.formSerializer)}}return o||s?(n.setContentType("application/json",!1),Kn(t)):t}],transformResponse:[function(t){const n=this.transitional||_e.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(c.isResponse(t)||c.isReadableStream(t))return t;if(t&&c.isString(t)&&(r&&!this.responseType||s)){const i=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t,this.parseReviver)}catch(a){if(i)throw a.name==="SyntaxError"?C.from(a,C.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:q.classes.FormData,Blob:q.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=>{_e.headers[e]={}});const Wn=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"]),Zn=e=>{const t={};let n,r,s;return e&&e.split(`
|
|
8
|
-
`).forEach(function(
|
|
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 r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[Qe]=this[Qe]={accessors:{}}).accessors,s=this.prototype;function o(i){const a=ue(i);r[a]||(nr(s,i),r[a]=!0)}return c.isArray(t)?t.forEach(o):o(t),this}};G.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);c.reduceDescriptors(G.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});c.freezeMethods(G);function xe(e,t){const n=this||_e,r=t||n,s=G.from(r.headers);let o=r.data;return c.forEach(e,function(a){o=a.call(n,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function Ut(e){return!!(e&&e.__CANCEL__)}let he=class extends C{constructor(t,n,r){super(t??"canceled",C.ERR_CANCELED,n,r),this.name="CanceledError",this.__CANCEL__=!0}};function xt(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new C("Request failed with status code "+n.status,[C.ERR_BAD_REQUEST,C.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function rr(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function sr(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,o=0,i;return t=t!==void 0?t:1e3,function(p){const d=Date.now(),u=r[o];i||(i=d),n[s]=p,r[s]=d;let w=o,S=0;for(;w!==s;)S+=n[w++],w=w%e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),d-i<t)return;const T=u&&d-u;return T?Math.round(S*1e3/T):void 0}}function or(e,t){let n=0,r=1e3/t,s,o;const i=(d,u=Date.now())=>{n=u,s=null,o&&(clearTimeout(o),o=null),e(...d)};return[(...d)=>{const u=Date.now(),w=u-n;w>=r?i(d,u):(s=d,o||(o=setTimeout(()=>{o=null,i(s)},r-w)))},()=>s&&i(s)]}const ge=(e,t,n=3)=>{let r=0;const s=sr(50,250);return or(o=>{const i=o.loaded,a=o.lengthComputable?o.total:void 0,p=i-r,d=s(p),u=i<=a;r=i;const w={loaded:i,total:a,progress:a?i/a:void 0,bytes:p,rate:d||void 0,estimated:d&&a&&u?(a-i)/d:void 0,event:o,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(w)},n)},et=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},tt=e=>(...t)=>c.asap(()=>e(...t)),ir=q.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,q.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(q.origin),q.navigator&&/(msie|trident)/i.test(q.navigator.userAgent)):()=>!0,ar=q.hasStandardBrowserEnv?{write(e,t,n,r,s,o,i){if(typeof document>"u")return;const a=[`${e}=${encodeURIComponent(t)}`];c.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),c.isString(r)&&a.push(`path=${r}`),c.isString(s)&&a.push(`domain=${s}`),o===!0&&a.push("secure"),c.isString(i)&&a.push(`SameSite=${i}`),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 cr(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function lr(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function vt(e,t,n){let r=!cr(t);return e&&(r||n==!1)?lr(e,t):t}const nt=e=>e instanceof G?{...e}:e;function re(e,t){t=t||{};const n={};function r(d,u,w,S){return c.isPlainObject(d)&&c.isPlainObject(u)?c.merge.call({caseless:S},d,u):c.isPlainObject(u)?c.merge({},u):c.isArray(u)?u.slice():u}function s(d,u,w,S){if(c.isUndefined(u)){if(!c.isUndefined(d))return r(void 0,d,w,S)}else return r(d,u,w,S)}function o(d,u){if(!c.isUndefined(u))return r(void 0,u)}function i(d,u){if(c.isUndefined(u)){if(!c.isUndefined(d))return r(void 0,d)}else return r(void 0,u)}function a(d,u,w){if(w in t)return r(d,u);if(w in e)return r(void 0,d)}const p={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(d,u,w)=>s(nt(d),nt(u),w,!0)};return c.forEach(Object.keys({...e,...t}),function(u){if(u==="__proto__"||u==="constructor"||u==="prototype")return;const w=c.hasOwnProp(p,u)?p[u]:s,S=w(e[u],t[u],u);c.isUndefined(S)&&w!==a||(n[u]=S)}),n}const Dt=e=>{const t=re({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:a}=t;if(t.headers=i=G.from(i),t.url=Tt(vt(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),c.isFormData(n)){if(q.hasStandardBrowserEnv||q.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(c.isFunction(n.getHeaders)){const p=n.getHeaders(),d=["content-type","content-length"];Object.entries(p).forEach(([u,w])=>{d.includes(u.toLowerCase())&&i.set(u,w)})}}if(q.hasStandardBrowserEnv&&(r&&c.isFunction(r)&&(r=r(t)),r||r!==!1&&ir(t.url))){const p=s&&o&&ar.read(o);p&&i.set(s,p)}return t},ur=typeof XMLHttpRequest<"u",dr=ur&&function(e){return new Promise(function(n,r){const s=Dt(e);let o=s.data;const i=G.from(s.headers).normalize();let{responseType:a,onUploadProgress:p,onDownloadProgress:d}=s,u,w,S,T,f;function y(){T&&T(),f&&f(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let _=new XMLHttpRequest;_.open(s.method.toUpperCase(),s.url,!0),_.timeout=s.timeout;function L(){if(!_)return;const A=G.from("getAllResponseHeaders"in _&&_.getAllResponseHeaders()),$={data:!a||a==="text"||a==="json"?_.responseText:_.response,status:_.status,statusText:_.statusText,headers:A,config:e,request:_};xt(function(D){n(D),y()},function(D){r(D),y()},$),_=null}"onloadend"in _?_.onloadend=L:_.onreadystatechange=function(){!_||_.readyState!==4||_.status===0&&!(_.responseURL&&_.responseURL.indexOf("file:")===0)||setTimeout(L)},_.onabort=function(){_&&(r(new C("Request aborted",C.ECONNABORTED,e,_)),_=null)},_.onerror=function(k){const $=k&&k.message?k.message:"Network Error",E=new C($,C.ERR_NETWORK,e,_);E.event=k||null,r(E),_=null},_.ontimeout=function(){let k=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const $=s.transitional||Me;s.timeoutErrorMessage&&(k=s.timeoutErrorMessage),r(new C(k,$.clarifyTimeoutError?C.ETIMEDOUT:C.ECONNABORTED,e,_)),_=null},o===void 0&&i.setContentType(null),"setRequestHeader"in _&&c.forEach(i.toJSON(),function(k,$){_.setRequestHeader($,k)}),c.isUndefined(s.withCredentials)||(_.withCredentials=!!s.withCredentials),a&&a!=="json"&&(_.responseType=s.responseType),d&&([S,f]=ge(d,!0),_.addEventListener("progress",S)),p&&_.upload&&([w,T]=ge(p),_.upload.addEventListener("progress",w),_.upload.addEventListener("loadend",T)),(s.cancelToken||s.signal)&&(u=A=>{_&&(r(!A||A.type?new he(null,e,_):A),_.abort(),_=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));const Y=rr(s.url);if(Y&&q.protocols.indexOf(Y)===-1){r(new C("Unsupported protocol "+Y+":",C.ERR_BAD_REQUEST,e));return}_.send(o||null)})},pr=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,s;const o=function(d){if(!s){s=!0,a();const u=d instanceof Error?d:this.reason;r.abort(u instanceof C?u:new he(u instanceof Error?u.message:u))}};let i=t&&setTimeout(()=>{i=null,o(new C(`timeout of ${t}ms exceeded`,C.ETIMEDOUT))},t);const a=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(d=>{d.unsubscribe?d.unsubscribe(o):d.removeEventListener("abort",o)}),e=null)};e.forEach(d=>d.addEventListener("abort",o));const{signal:p}=r;return p.unsubscribe=()=>c.asap(a),p}},fr=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,s;for(;r<n;)s=r+t,yield e.slice(r,s),r=s},mr=async function*(e,t){for await(const n of _r(e))yield*fr(n,t)},_r=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},rt=(e,t,n,r)=>{const s=mr(e,t);let o=0,i,a=p=>{i||(i=!0,r&&r(p))};return new ReadableStream({async pull(p){try{const{done:d,value:u}=await s.next();if(d){a(),p.close();return}let w=u.byteLength;if(n){let S=o+=w;n(S)}p.enqueue(new Uint8Array(u))}catch(d){throw a(d),d}},cancel(p){return a(p),s.return()}},{highWaterMark:2})},st=64*1024,{isFunction:ye}=c,hr=(({Request:e,Response:t})=>({Request:e,Response:t}))(c.global),{ReadableStream:ot,TextEncoder:it}=c.global,at=(e,...t)=>{try{return!!e(...t)}catch{return!1}},wr=e=>{e=c.merge.call({skipUndefined:!0},hr,e);const{fetch:t,Request:n,Response:r}=e,s=t?ye(t):typeof fetch=="function",o=ye(n),i=ye(r);if(!s)return!1;const a=s&&ye(ot),p=s&&(typeof it=="function"?(f=>y=>f.encode(y))(new it):async f=>new Uint8Array(await new n(f).arrayBuffer())),d=o&&a&&at(()=>{let f=!1;const y=new n(q.origin,{body:new ot,method:"POST",get duplex(){return f=!0,"half"}}).headers.has("Content-Type");return f&&!y}),u=i&&a&&at(()=>c.isReadableStream(new r("").body)),w={stream:u&&(f=>f.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(f=>{!w[f]&&(w[f]=(y,_)=>{let L=y&&y[f];if(L)return L.call(y);throw new C(`Response type '${f}' is not supported`,C.ERR_NOT_SUPPORT,_)})});const S=async f=>{if(f==null)return 0;if(c.isBlob(f))return f.size;if(c.isSpecCompliantForm(f))return(await new n(q.origin,{method:"POST",body:f}).arrayBuffer()).byteLength;if(c.isArrayBufferView(f)||c.isArrayBuffer(f))return f.byteLength;if(c.isURLSearchParams(f)&&(f=f+""),c.isString(f))return(await p(f)).byteLength},T=async(f,y)=>{const _=c.toFiniteNumber(f.getContentLength());return _??S(y)};return async f=>{let{url:y,method:_,data:L,signal:Y,cancelToken:A,timeout:k,onDownloadProgress:$,onUploadProgress:E,responseType:D,headers:z,withCredentials:V="same-origin",fetchOptions:ee}=Dt(f),X=t||fetch;D=D?(D+"").toLowerCase():"text";let F=pr([Y,A&&A.toAbortSignal()],k),B=null;const O=F&&F.unsubscribe&&(()=>{F.unsubscribe()});let M;try{if(E&&d&&_!=="get"&&_!=="head"&&(M=await T(z,L))!==0){let l=new n(y,{method:"POST",body:L,duplex:"half"}),h;if(c.isFormData(L)&&(h=l.headers.get("content-type"))&&z.setContentType(h),l.body){const[R,N]=et(M,ge(tt(E)));L=rt(l.body,st,R,N)}}c.isString(V)||(V=V?"include":"omit");const U=o&&"credentials"in n.prototype,x={...ee,signal:F,method:_.toUpperCase(),headers:z.normalize().toJSON(),body:L,duplex:"half",credentials:U?V:void 0};B=o&&new n(y,x);let b=await(o?X(B,ee):X(y,x));const P=u&&(D==="stream"||D==="response");if(u&&($||P&&O)){const l={};["status","statusText","headers"].forEach(I=>{l[I]=b[I]});const h=c.toFiniteNumber(b.headers.get("content-length")),[R,N]=$&&et(h,ge(tt($),!0))||[];b=new r(rt(b.body,st,R,()=>{N&&N(),O&&O()}),l)}D=D||"text";let H=await w[c.findKey(w,D)||"text"](b,f);return!P&&O&&O(),await new Promise((l,h)=>{xt(l,h,{data:H,headers:G.from(b.headers),status:b.status,statusText:b.statusText,config:f,request:B})})}catch(U){throw O&&O(),U&&U.name==="TypeError"&&/Load failed|fetch/i.test(U.message)?Object.assign(new C("Network Error",C.ERR_NETWORK,f,B,U&&U.response),{cause:U.cause||U}):C.from(U,U&&U.code,f,B,U&&U.response)}}},yr=new Map,Ot=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,o=[r,s,n];let i=o.length,a=i,p,d,u=yr;for(;a--;)p=o[a],d=u.get(p),d===void 0&&u.set(p,d=a?new Map:wr(t)),u=d;return d};Ot();const $e={http:Fn,xhr:dr,fetch:{get:Ot}};c.forEach($e,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const ct=e=>`- ${e}`,Rr=e=>c.isFunction(e)||e===null||e===!1;function Er(e,t){e=c.isArray(e)?e:[e];const{length:n}=e;let r,s;const o={};for(let i=0;i<n;i++){r=e[i];let a;if(s=r,!Rr(r)&&(s=$e[(a=String(r)).toLowerCase()],s===void 0))throw new C(`Unknown adapter '${a}'`);if(s&&(c.isFunction(s)||(s=s.get(t))))break;o[a||"#"+i]=s}if(!s){const i=Object.entries(o).map(([p,d])=>`adapter ${p} `+(d===!1?"is not supported by the environment":"is not available in the build"));let a=n?i.length>1?`since :
|
|
10
|
-
`+
|
|
11
|
-
`):" "+
|
|
12
|
-
`+o):r.stack=o}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=re(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:o}=n;r!==void 0&&Ce.assertOptions(r,{silentJSONParsing:K.transitional(K.boolean),forcedJSONParsing:K.transitional(K.boolean),clarifyTimeoutError:K.transitional(K.boolean),legacyInterceptorReqResOrdering:K.transitional(K.boolean)},!1),s!=null&&(c.isFunction(s)?n.paramsSerializer={serialize:s}:Ce.assertOptions(s,{encode:K.function,serialize:K.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Ce.assertOptions(n,{baseUrl:K.spelling("baseURL"),withXsrfToken:K.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=o&&c.merge(o.common,o[n.method]);o&&c.forEach(["delete","get","head","post","put","patch","common"],f=>{delete o[f]}),n.headers=G.concat(i,o);const a=[];let p=!0;this.interceptors.request.forEach(function(y){if(typeof y.runWhen=="function"&&y.runWhen(n)===!1)return;p=p&&y.synchronous;const _=n.transitional||Me;_&&_.legacyInterceptorReqResOrdering?a.unshift(y.fulfilled,y.rejected):a.push(y.fulfilled,y.rejected)});const d=[];this.interceptors.response.forEach(function(y){d.push(y.fulfilled,y.rejected)});let u,w=0,S;if(!p){const f=[lt.bind(this),void 0];for(f.unshift(...a),f.push(...d),S=f.length,u=Promise.resolve(n);w<S;)u=u.then(f[w++],f[w++]);return u}S=a.length;let T=n;for(;w<S;){const f=a[w++],y=a[w++];try{T=f(T)}catch(_){y.call(this,_);break}}try{u=lt.call(this,T)}catch(f){return Promise.reject(f)}for(w=0,S=d.length;w<S;)u=u.then(d[w++],d[w++]);return u}getUri(t){t=re(this.defaults,t);const n=vt(t.baseURL,t.url,t.allowAbsoluteUrls);return Tt(n,t.params,t.paramsSerializer)}};c.forEach(["delete","get","head","options"],function(t){ne.prototype[t]=function(n,r){return this.request(re(r||{},{method:t,url:n,data:(r||{}).data}))}});c.forEach(["post","put","patch"],function(t){function n(r){return function(o,i,a){return this.request(re(a||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}ne.prototype[t]=n(),ne.prototype[t+"Form"]=n(!0)});let gr=class jt{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(o){n=o});const r=this;this.promise.then(s=>{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](s);r._listeners=null}),this.promise.then=s=>{let o;const i=new Promise(a=>{r.subscribe(a),o=a}).then(s);return i.cancel=function(){r.unsubscribe(o)},i},t(function(o,i,a){r.reason||(r.reason=new he(o,i,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new jt(function(s){t=s}),cancel:t}}};function br(e){return function(n){return e.apply(null,n)}}function Sr(e){return c.isObject(e)&&e.isAxiosError===!0}const Fe={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(Fe).forEach(([e,t])=>{Fe[t]=e});function kt(e){const t=new ne(e),n=ht(ne.prototype.request,t);return c.extend(n,ne.prototype,t,{allOwnKeys:!0}),c.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return kt(re(e,s))},n}const j=kt(_e);j.Axios=ne;j.CanceledError=he;j.CancelToken=gr;j.isCancel=Ut;j.VERSION=Ft;j.toFormData=Te;j.AxiosError=C;j.Cancel=j.CanceledError;j.all=function(t){return Promise.all(t)};j.spread=br;j.isAxiosError=Sr;j.mergeConfig=re;j.AxiosHeaders=G;j.formToJSON=e=>Lt(c.isHTMLForm(e)?new FormData(e):e);j.getAdapter=Pt.getAdapter;j.HttpStatusCode=Fe;j.default=j;const{Axios:ns,AxiosError:rs,CanceledError:ss,isCancel:os,CancelToken:is,VERSION:as,all:cs,Cancel:ls,isAxiosError:us,spread:ds,toFormData:ps,AxiosHeaders:fs,HttpStatusCode:ms,formToJSON:_s,getAdapter:hs,mergeConfig:ws}=j,Nr={"1D":"D1",D:"D1",240:"H4",120:"H2",60:"H1",30:"M30",15:"M15",5:"M5",1:"M1"},Bt=e=>({1:60,5:300,15:900,30:1800,60:3600})[e]||3600,Mt=[10,15,20,25,30,35,40,45,50],Yt=g.createContext(null),Ar=()=>{const e=g.useContext(Yt);if(!e)throw new Error("useWidgetContext must be used inside WidgetProvider");return e},Tr=({children:e,selectedTimeframe:t,setSelectedTimeframe:n,currentSymbol:r,setCurrentSymbol:s})=>m.jsx(Yt.Provider,{value:{currentSymbol:r,setCurrentSymbol:s,selectedTimeframe:t,setSelectedTimeframe:n},children:e});const $t=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();const Lr=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const Ur=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());const dt=e=>{const t=Ur(e);return t.charAt(0).toUpperCase()+t.slice(1)};var xr={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 vr=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const Dr=g.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:o,iconNode:i,...a},p)=>g.createElement("svg",{ref:p,...xr,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:$t("lucide",s),...!o&&!vr(a)&&{"aria-hidden":"true"},...a},[...i.map(([d,u])=>g.createElement(d,u)),...Array.isArray(o)?o:[o]]));const He=(e,t)=>{const n=g.forwardRef(({className:r,...s},o)=>g.createElement(Dr,{ref:o,iconNode:t,className:$t(`lucide-${Lr(dt(e))}`,`lucide-${e}`,r),...s}));return n.displayName=dt(e),n};const Or=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Pr=He("chevron-down",Or);const Fr=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],jr=He("chevron-left",Fr);const kr=[["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"}]],Br=He("speech",kr),je=(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,""),r=t.trim().replace(/[kKmMbB%]/g,"").replace(/[^\d.-]/g,""),s=parseFloat(n)||0,o=parseFloat(r)||0;return s>o?"news-widget__green":s===o?"news-widget__orange":"news-widget__red"},be=e=>e.trim().replaceAll(" ","").replaceAll("_",""),Mr=new Intl.DateTimeFormat("en-US",{year:"numeric",month:"long",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}),Ht=e=>{const t=Mr.formatToParts(e),n=r=>t.find(s=>s.type===r)?.value??"";return`${n("year")} ${n("month")} ${n("day")}, ${n("hour")}:${n("minute")}`},Yr=({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:r,currency:s})=>m.jsxs("div",{className:"news-widget_news_card__container",children:[m.jsxs("div",{className:"news-widget_news_card__header",children:[s&&m.jsx("div",{className:"news-widget_news_card__currency_icon",children:m.jsx(Yr,{currency:s})}),m.jsxs("div",{className:"news-widget_news_card__meta",children:[m.jsx("div",{className:"news-widget_news_card__date",children:Ht(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 ${je(String(r),String(n))}`,children:r||"-"})]}),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 Ir=({eventData:e,showStatus:t=!0,showPreviousValues:n=!1,showSimilarEvents:r=!1,isSimilarEventsOpen:s=!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&&Ht(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(Br,{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 ${je(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 ${je(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})})]}),r&&e?.similar?.referenceEvent?.previousEvents&&e?.similar?.referenceEvent?.previousEvents.length>0&&m.jsx("div",{className:`news-widget_event_details_card__collapsible ${s?"news-widget_event_details_card__collapsible--open":"news-widget_event_details_card__collapsible--closed"}`,children:s&&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((o,i)=>m.jsx($r,{title:o.event_name,date:new Date(o.timestamp),forecast:o.forecast,actual:o.actual,currency:e?.currency},i))})]})})]}),qr=({newsDetail:e,children:t,isCompared:n})=>{const[r,s]=g.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(Ir,{eventData:e.event,showPreviousValues:!n,showSimilarEvents:!0,isSimilarEventsOpen:r}),m.jsx("button",{type:"button",className:`news-widget__button news-widget_event_details__ghost_button ${r?"news-widget_event_details__ghost_button_open":""}`,onClick:()=>s(!r),children:m.jsx(Pr,{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})})]})},Jr=[{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}],Gr=({children:e,eventId:t,widgetKey:n,chartWidget:r,isUpcoming:s=!1,event:o,theme:i,newsDetail:a,selectedCandles:p,defaultSymbol:d,currentSymbol:u,currentTimeFrame:w,onBack:S,isElapsed:T=!1})=>{const{setCurrentSymbol:f,setSelectedTimeframe:y}=Ar(),_=g.useRef(null);return g.useEffect(()=>{if(!t||t==""||!r)return;const L=()=>{if(r){const E=r?.activeChart();E&&E.getAllShapes().forEach(D=>{try{E.removeEntity(D.id)}catch(z){console.error("Failed to remove shape",z)}})}},Y=async()=>{const{data:E,status:D}=await j.get(`https://corprate-widget.iccandle.ai/news/${t}`,{headers:{"api-key":n},params:{symbol:d}});if(D!==200){console.error("Failed to fetch news detail");return}return E};let A=!1;const k=[],$=(E,D)=>{const z=window.setTimeout(E,D);return k.push(z),z};return _.current=r,r.onChartReady(async()=>{i==="dark"||i==="system"?(r.applyOverrides({"paneProperties.background":"#000000","scalesProperties.textColor":"#fff"}),r.setCSSCustomProperty("--tv-color-pane-background","#000000"),r.setCSSCustomProperty("--tv-color-platform-background","#0f0f0f")):(r.applyOverrides({"paneProperties.background":"#ffffff","scalesProperties.textColor":"#000"}),r.setCSSCustomProperty("--tv-color-pane-background","#ffffff"),r.setCSSCustomProperty("--tv-color-platform-background","#f9fafb"));const E=r.activeChart();if(!E)return;await E.setSymbol(u),await E.setResolution(w);const D=async(F,B)=>{if(await E.createShape({time:B},{shape:"vertical_line",lock:!0,disableSelection:!0,overrides:{linestyle:2,linewidth:1}}),A||_.current!==r)return;const O=await E.exportData({includeTime:!0,includedStudies:[]}),M=O.data.findIndex(x=>x[0]===B);let U=p;if(M!=-1&&!U&&(U=[...Mt].sort((x,b)=>b-x).find(x=>O.data[M+x])??null),M!=-1&&U){const x=F,b=O.data[M+U][0],P=O.data.filter(h=>h[0]>x&&h[0]<=b)??[];let H=null,l=null;if(P.length>0){const h=P.reduce((N,I,Z,v)=>Number(I[3])<Number(v[N][3])?Z:N,0),R=P[h];l={time:R[0],value:Number(R[3])}}if(P.length>0){const h=P.reduce((N,I,Z,v)=>Number(I[2])>Number(v[N][2])?Z:N,0),R=P[h];H={time:R[0],value:Number(R[2])}}if(H&&l&&P.length>0){const h=H.value,R=l.value,I=O.data[M+1][1];await E.createMultipointShape([{time:x,price:I},{time:b,price:h}],{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 E.createMultipointShape([{time:x,price:R},{time:b,price:I}],{shape:"rectangle",overrides:{showLabel:!1,linecolor:"#D92D2030",linewidth:1,linestyle:0,color:"#D92D2010",borderWidth:1,backgroundColor:"#D92D20",transparency:70,drawBorder:!1,frozen:!0}}),await E.createMultipointShape([{time:x,price:h},{time:b,price:h}],{shape:"trend_line",overrides:{linecolor:"#12B76A",linewidth:1,linestyle:2,extendLeft:!0,extendRight:!0}}),await E.createMultipointShape([{time:x,price:R},{time:b,price:R}],{shape:"trend_line",overrides:{linecolor:"#D92D20",linewidth:1,linestyle:2,extendLeft:!0,extendRight:!0}});const Z=Jr.find(se=>be(se.name)==be(u))?.pipLocation;let v="",Q="";if(Z){const se=Math.pow(10,-Z),Ie=parseFloat(Math.abs((h-I)*se).toFixed(1)),qe=parseFloat(Math.abs((R-I)*se).toFixed(1));v=`${Ie>=0?"+":""}${Ie.toFixed(2)} pip`,Q=`${qe>=0?"-":""}${qe.toFixed(2)} pip`}await E.createShape({time:H.time,price:H.value},{shape:"arrow_down",overrides:{arrowColor:"#12B76A",fontsize:11,color:"#12B76A",text:v,bold:!0}}),await E.createShape({time:l.time,price:l.value},{shape:"arrow_up",overrides:{arrowColor:"#D92D20",fontsize:11,color:"#D92D20",text:Q,bold:!0}});const ae=Math.floor((x+b)/2);await E.createShape({time:ae},{shape:"text",text:`${U} candles`,zOrder:"top",overrides:{fontsize:12,color:"#FFFFFF",bold:!0,backgroundColor:"#FFFFFF"}})}}if(O&&(await E.setVisibleRange({from:O.data[0][0],to:O.data[O.data?.length-1][0]}),E.getPanes()[0].getLeftPriceScales()[0].setAutoScale(!0)),s&&o){const x=Math.floor(Date.now()/1e3);await E.setVisibleRange({from:x-3600*24*7,to:o.timestamp/1e3+1440*60*7});const b=o.timestamp/1e3,P=E.resolution();$(()=>{A||_.current!==r||Number(P)<=30&&E.createShape({time:b},{shape:"vertical_line",lock:!0,disableSelection:!0,overrides:{linestyle:2,linewidth:1}})},2e3)}},z=async()=>{if(L(),A||_.current!==r)return;const F=await Y();if(A||_.current!==r)return;const B=(F?.event?.timestamp??0)/1e3,O=Bt(w),M=B-B%O;E.getVisibleBarsRange()||await new Promise(b=>setTimeout(b,2e3));const x=E.getVisibleBarsRange();x&&x.from<=B&&B<=x.to?await D(B,M):(s||await E.setVisibleRange({from:B}),await D(B,M))},V=()=>{$(()=>{A||_.current!==r||(async()=>{try{f(E.symbol())}catch(F){console.log("error=>",F)}})()},300)},ee=()=>{$(()=>{A||_.current!==r||(async()=>{try{y(E.resolution())}catch(F){console.log("error=>",F)}})()},300)};E.onSymbolChanged().subscribe(null,V),E.onIntervalChanged().subscribe(null,ee);try{T||await z()}catch(F){console.log("error=>",F)}A&&(()=>{try{E.onSymbolChanged().unsubscribe(null,V)}catch{}try{E.onIntervalChanged().unsubscribe(null,ee)}catch{}})()}),()=>{A=!0,k.forEach(E=>window.clearTimeout(E)),L(),_.current===r&&(_.current=null)}},[i,n,r,s,d,p,o,t,w,y,u,f,T]),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:S,children:m.jsx(jr,{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.jsx(qr,{newsDetail:a,children:e})})]})})},de="https://widget-result-news.iccandle.ai",pt="https://corprate-widget.iccandle.ai/news",zr=({chartWidget:e,children:t,widgetKey:n,theme:r,defaultSymbol:s,symbolMapper:o,chartInterval:i="15"})=>{const{start:a}=Gt(),[p,d]=g.useState(""),[u,w]=g.useState(i),[S,T]=g.useState(s),[f,y]=g.useState(null),[_,L]=g.useState(null),Y=Nr[u]||"M15",A=Bt("60"),k=_?.[0]?.timestamp?_?.[0]?.timestamp/1e3:0,$=k-k%A,E=_?.[0]?.candleData.H1?.candles,D=E?.findIndex(b=>b.timestamp===$)||0,V=(E?.length||0)-D<=10,X="next_pip_up_50"in(_?.find(b=>b&&be(b.symbol)===be(S))?.candleData[Y]?.metadata??{}),F=!!p&&!X,B=g.useRef(F),O=g.useRef(!1);g.useEffect(()=>{if(F!==B.current){if(B.current=F,O.current){O.current=!1;return}a()}},[F,a]),g.useEffect(()=>{const b=async l=>{const{data:h,status:R}=await j.get(`${pt}/${l}`,{headers:{"api-key":n},params:{symbol:s}});return R!==200?(console.error("Failed to fetch news detail"),null):h},P=async l=>{const{data:h,status:R}=await j.get(`${pt}/similar-details`,{headers:{"api-key":n},params:{event_id:l}});return R!==200?(console.error("Failed to fetch compared news"),null):h};(async()=>{if(p==="")return;const[l,h]=await Promise.all([b(p),P(p)]);l&&y(l),h&&L(h)})()},[n,p,s]);const M=g.useCallback(()=>{d(""),T(s)},[s]);g.useEffect(()=>{const b=async({origin:P,data:H})=>{if(P!==de||typeof H!="string")return;const l=JSON.parse(H);if(l.action=="back")M();else if(l.action=="eventClicked"){O.current=!0,a();const R=l.data.event,N=e?.activeChart();await e?.headerReady(),N?.clearMarks(2),localStorage.setItem("iccandle:current-news-event",JSON.stringify({actual:R.actual,event_name:R.event_name,forecast:R.forecast,id:R.id,metric:R.metric,previous:R.previous,timestamp:R.timestamp,currency:R.currency})),N?.refreshMarks(),d(R.id)}else if(l.action=="intervalChanged"||l.action=="symbolChanged"){const h=l.data;if(h.type===2)return;w(h.resolution);const R=o?.[h.symbol]??s;T(R),a()}};return window.addEventListener("message",b),()=>window.removeEventListener("message",b)},[e,s,a,M,o]);const U=g.useMemo(()=>{const b=_?.[0]?.candleData?.[Y]?.metadata;return b?[...Mt].sort((P,H)=>H-P).find(P=>[`next_pip_up_${P}`,`next_pip_down_${P}`].some(l=>b[l]!==void 0))??null:null},[_,Y]);g.useEffect(()=>{const b=()=>{M()};return window.addEventListener("popstate",b),()=>window.removeEventListener("popstate",b)},[M]);const x=g.useMemo(()=>p?_?X?`${de}/${p}?apiKey=${n}&theme=${r}&interval=${u}&symbol=${S}`:`${de}/similar-events/${p}?apiKey=${n}&theme=${r}`:`${de}?apiKey=${n}&theme=${r}`:`${de}?apiKey=${n}&theme=${r}`,[p,_,X,n,r,u,S]);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&&!X?"flex":"none"},children:m.jsx(Tr,{selectedTimeframe:u,setSelectedTimeframe:w,currentSymbol:S,setCurrentSymbol:T,children:m.jsx(Gr,{eventId:p,chartWidget:e,widgetKey:n,theme:r,defaultSymbol:s,newsDetail:f,isUpcoming:V,event:f?.event,selectedCandles:U,currentTimeFrame:u,currentSymbol:S,onBack:M,isElapsed:X,children:t})})}),m.jsx("iframe",{src:x,className:p&&!X?"news-widget_main__iframe_half":"news-widget_main__iframe_full"})]})},Vr="https://api.iccandle.ai",Xr='"Inter Tight", ui-sans-serif, system-ui, sans-serif';function ft(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??Xr}}const Kr=async e=>{const t=await fetch(`${Vr}/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:ft(n.dark),light:ft(n.light)}},mt={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 Wr(e,t){const[n,r]=g.useState(null);g.useEffect(()=>{Kr(e).then(d=>{r(d)})},[e]);const s=g.useRef(null),[o,i]=g.useState(null),a=g.useMemo(()=>t==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":t,[t]),p=g.useMemo(()=>{if(n)return a==="dark"?n.dark:n.light},[n,a]);return g.useEffect(()=>{if(typeof window>"u"||!p||!o)return;const d=o;Object.keys(mt).forEach(u=>{d.style.setProperty(mt[u],p[u])})},[p,o]),{rootRef:s,setRootEl:i,resolvedTheme:a}}const Zr=e=>{const{rootRef:t,setRootEl:n,resolvedTheme:r}=Wr(e.widgetKey,e.theme);return m.jsx("div",{ref:s=>{t.current=s,n(s)},className:`news-widget__container news-widget ${r==="dark"?"dark":""}`,children:m.jsx(Vt,{theme:r,children:m.jsx(zr,{...e,children:e.children})})})};exports.NewsWidget=Zr;
|
|
7
|
+
<%s key={someKey} {...props} />`,A,R,U,R),W[R+A]=!0)}if(R=null,D!==void 0&&(n(D),R=""+D),o(w)&&(n(w.key),R=""+w.key),"key"in w){D={};for(var J in w)J!=="key"&&(D[J]=w[J])}else D=w;return R&&a(D,typeof u=="function"?u.displayName||u.name||"Unknown":u),d(u,R,D,r(),G,Q)}function _(u){S(u)?u._store&&(u._store.validated=1):typeof u=="object"&&u!==null&&u.$$typeof===H&&(u._payload.status==="fulfilled"?S(u._payload.value)&&u._payload.value._store&&(u._payload.value._store.validated=1):u._store&&(u._store.validated=1))}function S(u){return typeof u=="object"&&u!==null&&u.$$typeof===f}var C=b,f=Symbol.for("react.transitional.element"),y=Symbol.for("react.portal"),h=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),M=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),B=Symbol.for("react.context"),L=Symbol.for("react.forward_ref"),K=Symbol.for("react.suspense"),k=Symbol.for("react.suspense_list"),F=Symbol.for("react.memo"),H=Symbol.for("react.lazy"),ee=Symbol.for("react.activity"),$=Symbol.for("react.client.reference"),v=C.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,j=Object.prototype.hasOwnProperty,q=Array.isArray,Z=console.createTask?console.createTask:function(){return null};C={react_stack_bottom_frame:function(u){return u()}};var g,X={},N=C.react_stack_bottom_frame.bind(C,i)(),V=Z(s(i)),W={};ye.Fragment=h,ye.jsx=function(u,w,D){var A=1e4>v.recentlyCreatedOwnerStacks++;return l(u,w,D,!1,A?Error("react-stack-top-frame"):N,A?Z(s(u)):V)},ye.jsxs=function(u,w,D){var A=1e4>v.recentlyCreatedOwnerStacks++;return l(u,w,D,!0,A?Error("react-stack-top-frame"):N,A?Z(s(u)):V)}})()),ye}var ot;function mn(){return ot||(ot=1,process.env.NODE_ENV==="production"?Ue.exports=pn():Ue.exports=fn()),Ue.exports}var m=mn();const Pt=b.createContext(null);function _n(){const e=b.useContext(Pt);if(!e)throw new Error("useCtaLoader must be used within CtaLoaderProvider");return e}const at=1100,hn=180;function wn({children:e,theme:t}){const[n,s]=b.useState(!1),[r,i]=b.useState(!1),[o,a]=b.useState(0),p=b.useRef(null),d=b.useRef(null),l=b.useCallback(()=>{p.current&&window.clearTimeout(p.current),p.current=null,d.current&&window.clearTimeout(d.current),d.current=null,d.current=window.setTimeout(()=>{d.current=null,s(!1),i(!1)},hn)},[]),_=b.useCallback(()=>{p.current&&window.clearTimeout(p.current),p.current=null,d.current&&window.clearTimeout(d.current),d.current=null,a(f=>f+1),i(!1),s(!0),requestAnimationFrame(()=>requestAnimationFrame(()=>i(!0))),p.current=window.setTimeout(()=>{p.current=null,l()},at)},[l]);b.useEffect(()=>l,[l]);const S=b.useMemo(()=>({start:_,stop:l,visible:n}),[_,l,n]),C=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(Pt.Provider,{value:S,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:C,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 ${at}ms linear`}},o)})})]})})]})}function Ot(e,t){return function(){return e.apply(t,arguments)}}const{toString:yn}=Object.prototype,{getPrototypeOf:Ke}=Object,{iterator:Pe,toStringTag:kt}=Symbol,Oe=(e=>t=>{const n=yn.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),ie=e=>(e=e.toLowerCase(),t=>Oe(t)===e),ke=e=>t=>typeof t===e,{isArray:he}=Array,_e=ke("undefined");function Re(e){return e!==null&&!_e(e)&&e.constructor!==null&&!_e(e.constructor)&&te(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Ft=ie("ArrayBuffer");function gn(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Ft(e.buffer),t}const Cn=ke("string"),te=ke("function"),jt=ke("number"),be=e=>e!==null&&typeof e=="object",Rn=e=>e===!0||e===!1,Ne=e=>{if(Oe(e)!=="object")return!1;const t=Ke(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(kt in e)&&!(Pe in e)},bn=e=>{if(!be(e)||Re(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},En=ie("Date"),Sn=ie("File"),Dn=ie("Blob"),An=ie("FileList"),Un=e=>be(e)&&te(e.pipe),Tn=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||te(e.append)&&((t=Oe(e))==="formdata"||t==="object"&&te(e.toString)&&e.toString()==="[object FormData]"))},Nn=ie("URLSearchParams"),[vn,xn,Ln,Pn]=["ReadableStream","Request","Response","Headers"].map(ie),On=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ee(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let s,r;if(typeof e!="object"&&(e=[e]),he(e))for(s=0,r=e.length;s<r;s++)t.call(null,e[s],s,e);else{if(Re(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 Bt(e,t){if(Re(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 ae=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Mt=e=>!_e(e)&&e!==ae;function He(){const{caseless:e,skipUndefined:t}=Mt(this)&&this||{},n={},s=(r,i)=>{if(i==="__proto__"||i==="constructor"||i==="prototype")return;const o=e&&Bt(n,i)||i;Ne(n[o])&&Ne(r)?n[o]=He(n[o],r):Ne(r)?n[o]=He({},r):he(r)?n[o]=r.slice():(!t||!_e(r))&&(n[o]=r)};for(let r=0,i=arguments.length;r<i;r++)arguments[r]&&Ee(arguments[r],s);return n}const kn=(e,t,n,{allOwnKeys:s}={})=>(Ee(t,(r,i)=>{n&&te(r)?Object.defineProperty(e,i,{value:Ot(r,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,i,{value:r,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:s}),e),Fn=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),jn=(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)},Bn=(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&&Ke(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},Mn=(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},Yn=e=>{if(!e)return null;if(he(e))return e;let t=e.length;if(!jt(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},Hn=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Ke(Uint8Array)),In=(e,t)=>{const s=(e&&e[Pe]).call(e);let r;for(;(r=s.next())&&!r.done;){const i=r.value;t.call(e,i[0],i[1])}},$n=(e,t)=>{let n;const s=[];for(;(n=e.exec(t))!==null;)s.push(n);return s},Gn=ie("HTMLFormElement"),Jn=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,s,r){return s.toUpperCase()+r}),ct=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Xn=ie("RegExp"),Yt=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),s={};Ee(n,(r,i)=>{let o;(o=t(r,i,e))!==!1&&(s[i]=o||r)}),Object.defineProperties(e,s)},qn=e=>{Yt(e,(t,n)=>{if(te(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const s=e[n];if(te(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+"'")})}})},Vn=(e,t)=>{const n={},s=r=>{r.forEach(i=>{n[i]=!0})};return he(e)?s(e):s(String(e).split(t)),n},Kn=()=>{},zn=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Zn(e){return!!(e&&te(e.append)&&e[kt]==="FormData"&&e[Pe])}const Wn=e=>{const t=new Array(10),n=(s,r)=>{if(be(s)){if(t.indexOf(s)>=0)return;if(Re(s))return s;if(!("toJSON"in s)){t[r]=s;const i=he(s)?[]:{};return Ee(s,(o,a)=>{const p=n(o,r+1);!_e(p)&&(i[a]=p)}),t[r]=void 0,i}}return s};return n(e,0)},Qn=ie("AsyncFunction"),es=e=>e&&(be(e)||te(e))&&te(e.then)&&te(e.catch),Ht=((e,t)=>e?setImmediate:t?((n,s)=>(ae.addEventListener("message",({source:r,data:i})=>{r===ae&&i===n&&s.length&&s.shift()()},!1),r=>{s.push(r),ae.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",te(ae.postMessage)),ts=typeof queueMicrotask<"u"?queueMicrotask.bind(ae):typeof process<"u"&&process.nextTick||Ht,ns=e=>e!=null&&te(e[Pe]),c={isArray:he,isArrayBuffer:Ft,isBuffer:Re,isFormData:Tn,isArrayBufferView:gn,isString:Cn,isNumber:jt,isBoolean:Rn,isObject:be,isPlainObject:Ne,isEmptyObject:bn,isReadableStream:vn,isRequest:xn,isResponse:Ln,isHeaders:Pn,isUndefined:_e,isDate:En,isFile:Sn,isBlob:Dn,isRegExp:Xn,isFunction:te,isStream:Un,isURLSearchParams:Nn,isTypedArray:Hn,isFileList:An,forEach:Ee,merge:He,extend:kn,trim:On,stripBOM:Fn,inherits:jn,toFlatObject:Bn,kindOf:Oe,kindOfTest:ie,endsWith:Mn,toArray:Yn,forEachEntry:In,matchAll:$n,isHTMLForm:Gn,hasOwnProperty:ct,hasOwnProp:ct,reduceDescriptors:Yt,freezeMethods:qn,toObjectSet:Vn,toCamelCase:Jn,noop:Kn,toFiniteNumber:zn,findKey:Bt,global:ae,isContextDefined:Mt,isSpecCompliantForm:Zn,toJSONObject:Wn,isAsyncFn:Qn,isThenable:es,setImmediate:Ht,asap:ts,isIterable:ns};let E=class It extends Error{static from(t,n,s,r,i,o){const a=new It(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 ss=null;function Ie(e){return c.isPlainObject(e)||c.isArray(e)}function $t(e){return c.endsWith(e,"[]")?e.slice(0,-2):e}function lt(e,t,n){return e?e.concat(t).map(function(r,i){return r=$t(r),!n&&i?"["+r+"]":r}).join(n?".":""):t}function rs(e){return c.isArray(e)&&!e.some(Ie)}const is=c.toFlatObject(c,{},null,function(t){return/^is[A-Z]/.test(t)});function Fe(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(y,h){return!c.isUndefined(h[y])});const s=n.metaTokens,r=n.visitor||l,i=n.dots,o=n.indexes,p=(n.Blob||typeof Blob<"u"&&Blob)&&c.isSpecCompliantForm(t);if(!c.isFunction(r))throw new TypeError("visitor must be a function");function d(f){if(f===null)return"";if(c.isDate(f))return f.toISOString();if(c.isBoolean(f))return f.toString();if(!p&&c.isBlob(f))throw new E("Blob is not supported. Use a Buffer instead.");return c.isArrayBuffer(f)||c.isTypedArray(f)?p&&typeof Blob=="function"?new Blob([f]):Buffer.from(f):f}function l(f,y,h){let x=f;if(f&&!h&&typeof f=="object"){if(c.endsWith(y,"{}"))y=s?y:y.slice(0,-2),f=JSON.stringify(f);else if(c.isArray(f)&&rs(f)||(c.isFileList(f)||c.endsWith(y,"[]"))&&(x=c.toArray(f)))return y=$t(y),x.forEach(function(T,B){!(c.isUndefined(T)||T===null)&&t.append(o===!0?lt([y],B,i):o===null?y:y+"[]",d(T))}),!1}return Ie(f)?!0:(t.append(lt(h,y,i),d(f)),!1)}const _=[],S=Object.assign(is,{defaultVisitor:l,convertValue:d,isVisitable:Ie});function C(f,y){if(!c.isUndefined(f)){if(_.indexOf(f)!==-1)throw Error("Circular reference detected in "+y.join("."));_.push(f),c.forEach(f,function(x,M){(!(c.isUndefined(x)||x===null)&&r.call(t,x,c.isString(M)?M.trim():M,y,S))===!0&&C(x,y?y.concat(M):[M])}),_.pop()}}if(!c.isObject(e))throw new TypeError("data must be an object");return C(e),t}function dt(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(s){return t[s]})}function ze(e,t){this._pairs=[],e&&Fe(e,this,t)}const Gt=ze.prototype;Gt.append=function(t,n){this._pairs.push([t,n])};Gt.toString=function(t){const n=t?function(s){return t.call(this,s,dt)}:dt;return this._pairs.map(function(r){return n(r[0])+"="+n(r[1])},"").join("&")};function os(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Jt(e,t,n){if(!t)return e;const s=n&&n.encode||os,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 ze(t,r).toString(s),o){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class ut{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 Ze={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},as=typeof URLSearchParams<"u"?URLSearchParams:ze,cs=typeof FormData<"u"?FormData:null,ls=typeof Blob<"u"?Blob:null,ds={isBrowser:!0,classes:{URLSearchParams:as,FormData:cs,Blob:ls},protocols:["http","https","file","blob","url","data"]},We=typeof window<"u"&&typeof document<"u",$e=typeof navigator=="object"&&navigator||void 0,us=We&&(!$e||["ReactNative","NativeScript","NS"].indexOf($e.product)<0),ps=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",fs=We&&window.location.href||"http://localhost",ms=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:We,hasStandardBrowserEnv:us,hasStandardBrowserWebWorkerEnv:ps,navigator:$e,origin:fs},Symbol.toStringTag,{value:"Module"})),z={...ms,...ds};function _s(e,t){return Fe(e,new z.classes.URLSearchParams,{visitor:function(n,s,r,i){return z.isNode&&c.isBuffer(n)?(this.append(s,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}function hs(e){return c.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function ws(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 Xt(e){function t(n,s,r,i){let o=n[i++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),p=i>=n.length;return o=!o&&c.isArray(r)?r.length:o,p?(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]=ws(r[o])),!a)}if(c.isFormData(e)&&c.isFunction(e.entries)){const n={};return c.forEachEntry(e,(s,r)=>{t(hs(s),r,n,0)}),n}return null}function ys(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 Se={transitional:Ze,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(Xt(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 _s(t,this.formSerializer).toString();if((a=c.isFileList(t))||s.indexOf("multipart/form-data")>-1){const p=this.env&&this.env.FormData;return Fe(a?{"files[]":t}:t,p&&new p,this.formSerializer)}}return i||r?(n.setContentType("application/json",!1),ys(t)):t}],transformResponse:[function(t){const n=this.transitional||Se.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:z.classes.FormData,Blob:z.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=>{Se.headers[e]={}});const gs=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"]),Cs=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]&&gs[n])&&(n==="set-cookie"?t[n]?t[n].push(s):t[n]=[s]:t[n]=t[n]?t[n]+", "+s:s)}),t},pt=Symbol("internals");function ge(e){return e&&String(e).trim().toLowerCase()}function ve(e){return e===!1||e==null?e:c.isArray(e)?e.map(ve):String(e)}function Rs(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 bs=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Be(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 Es(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,s)=>n.toUpperCase()+s)}function Ss(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 ne=class{constructor(t){t&&this.set(t)}set(t,n,s){const r=this;function i(a,p,d){const l=ge(p);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[_||p]=ve(a))}const o=(a,p)=>c.forEach(a,(d,l)=>i(d,l,p));if(c.isPlainObject(t)||t instanceof this.constructor)o(t,n);else if(c.isString(t)&&(t=t.trim())&&!bs(t))o(Cs(t),n);else if(c.isObject(t)&&c.isIterable(t)){let a={},p,d;for(const l of t){if(!c.isArray(l))throw TypeError("Object iterator must return a key-value pair");a[d=l[0]]=(p=a[d])?c.isArray(p)?[...p,l[1]]:[p,l[1]]:l[1]}o(a,n)}else t!=null&&i(n,t,s);return this}get(t,n){if(t=ge(t),t){const s=c.findKey(this,t);if(s){const r=this[s];if(!n)return r;if(n===!0)return Rs(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=ge(t),t){const s=c.findKey(this,t);return!!(s&&this[s]!==void 0&&(!n||Be(this,this[s],s,n)))}return!1}delete(t,n){const s=this;let r=!1;function i(o){if(o=ge(o),o){const a=c.findKey(s,o);a&&(!n||Be(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||Be(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]=ve(r),delete n[i];return}const a=t?Es(i):String(i).trim();a!==i&&delete n[i],n[a]=ve(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[pt]=this[pt]={accessors:{}}).accessors,r=this.prototype;function i(o){const a=ge(o);s[a]||(Ss(r,o),s[a]=!0)}return c.isArray(t)?t.forEach(i):i(t),this}};ne.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);c.reduceDescriptors(ne.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(s){this[n]=s}}});c.freezeMethods(ne);function Me(e,t){const n=this||Se,s=t||n,r=ne.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 qt(e){return!!(e&&e.__CANCEL__)}let De=class extends E{constructor(t,n,s){super(t??"canceled",E.ERR_CANCELED,n,s),this.name="CanceledError",this.__CANCEL__=!0}};function Vt(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 Ds(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function As(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(p){const d=Date.now(),l=s[i];o||(o=d),n[r]=p,s[r]=d;let _=i,S=0;for(;_!==r;)S+=n[_++],_=_%e;if(r=(r+1)%e,r===i&&(i=(i+1)%e),d-o<t)return;const C=l&&d-l;return C?Math.round(S*1e3/C):void 0}}function Us(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 Le=(e,t,n=3)=>{let s=0;const r=As(50,250);return Us(i=>{const o=i.loaded,a=i.lengthComputable?i.total:void 0,p=o-s,d=r(p),l=o<=a;s=o;const _={loaded:o,total:a,progress:a?o/a:void 0,bytes:p,rate:d||void 0,estimated:d&&a&&l?(a-o)/d:void 0,event:i,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(_)},n)},ft=(e,t)=>{const n=e!=null;return[s=>t[0]({lengthComputable:n,total:e,loaded:s}),t[1]]},mt=e=>(...t)=>c.asap(()=>e(...t)),Ts=z.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,z.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(z.origin),z.navigator&&/(msie|trident)/i.test(z.navigator.userAgent)):()=>!0,Ns=z.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 vs(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function xs(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Kt(e,t,n){let s=!vs(t);return e&&(s||n==!1)?xs(e,t):t}const _t=e=>e instanceof ne?{...e}:e;function de(e,t){t=t||{};const n={};function s(d,l,_,S){return c.isPlainObject(d)&&c.isPlainObject(l)?c.merge.call({caseless:S},d,l):c.isPlainObject(l)?c.merge({},l):c.isArray(l)?l.slice():l}function r(d,l,_,S){if(c.isUndefined(l)){if(!c.isUndefined(d))return s(void 0,d,_,S)}else return s(d,l,_,S)}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 p={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(_t(d),_t(l),_,!0)};return c.forEach(Object.keys({...e,...t}),function(l){if(l==="__proto__"||l==="constructor"||l==="prototype")return;const _=c.hasOwnProp(p,l)?p[l]:r,S=_(e[l],t[l],l);c.isUndefined(S)&&_!==a||(n[l]=S)}),n}const zt=e=>{const t=de({},e);let{data:n,withXSRFToken:s,xsrfHeaderName:r,xsrfCookieName:i,headers:o,auth:a}=t;if(t.headers=o=ne.from(o),t.url=Jt(Kt(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(z.hasStandardBrowserEnv||z.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(c.isFunction(n.getHeaders)){const p=n.getHeaders(),d=["content-type","content-length"];Object.entries(p).forEach(([l,_])=>{d.includes(l.toLowerCase())&&o.set(l,_)})}}if(z.hasStandardBrowserEnv&&(s&&c.isFunction(s)&&(s=s(t)),s||s!==!1&&Ts(t.url))){const p=r&&i&&Ns.read(i);p&&o.set(r,p)}return t},Ls=typeof XMLHttpRequest<"u",Ps=Ls&&function(e){return new Promise(function(n,s){const r=zt(e);let i=r.data;const o=ne.from(r.headers).normalize();let{responseType:a,onUploadProgress:p,onDownloadProgress:d}=r,l,_,S,C,f;function y(){C&&C(),f&&f(),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 x(){if(!h)return;const T=ne.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),L={data:!a||a==="text"||a==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:T,config:e,request:h};Vt(function(k){n(k),y()},function(k){s(k),y()},L),h=null}"onloadend"in h?h.onloadend=x:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(x)},h.onabort=function(){h&&(s(new E("Request aborted",E.ECONNABORTED,e,h)),h=null)},h.onerror=function(B){const L=B&&B.message?B.message:"Network Error",K=new E(L,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 L=r.transitional||Ze;r.timeoutErrorMessage&&(B=r.timeoutErrorMessage),s(new E(B,L.clarifyTimeoutError?E.ETIMEDOUT:E.ECONNABORTED,e,h)),h=null},i===void 0&&o.setContentType(null),"setRequestHeader"in h&&c.forEach(o.toJSON(),function(B,L){h.setRequestHeader(L,B)}),c.isUndefined(r.withCredentials)||(h.withCredentials=!!r.withCredentials),a&&a!=="json"&&(h.responseType=r.responseType),d&&([S,f]=Le(d,!0),h.addEventListener("progress",S)),p&&h.upload&&([_,C]=Le(p),h.upload.addEventListener("progress",_),h.upload.addEventListener("loadend",C)),(r.cancelToken||r.signal)&&(l=T=>{h&&(s(!T||T.type?new De(null,e,h):T),h.abort(),h=null)},r.cancelToken&&r.cancelToken.subscribe(l),r.signal&&(r.signal.aborted?l():r.signal.addEventListener("abort",l)));const M=Ds(r.url);if(M&&z.protocols.indexOf(M)===-1){s(new E("Unsupported protocol "+M+":",E.ERR_BAD_REQUEST,e));return}h.send(i||null)})},Os=(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 De(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:p}=s;return p.unsubscribe=()=>c.asap(a),p}},ks=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},Fs=async function*(e,t){for await(const n of js(e))yield*ks(n,t)},js=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()}},ht=(e,t,n,s)=>{const r=Fs(e,t);let i=0,o,a=p=>{o||(o=!0,s&&s(p))};return new ReadableStream({async pull(p){try{const{done:d,value:l}=await r.next();if(d){a(),p.close();return}let _=l.byteLength;if(n){let S=i+=_;n(S)}p.enqueue(new Uint8Array(l))}catch(d){throw a(d),d}},cancel(p){return a(p),r.return()}},{highWaterMark:2})},wt=64*1024,{isFunction:Te}=c,Bs=(({Request:e,Response:t})=>({Request:e,Response:t}))(c.global),{ReadableStream:yt,TextEncoder:gt}=c.global,Ct=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Ms=e=>{e=c.merge.call({skipUndefined:!0},Bs,e);const{fetch:t,Request:n,Response:s}=e,r=t?Te(t):typeof fetch=="function",i=Te(n),o=Te(s);if(!r)return!1;const a=r&&Te(yt),p=r&&(typeof gt=="function"?(f=>y=>f.encode(y))(new gt):async f=>new Uint8Array(await new n(f).arrayBuffer())),d=i&&a&&Ct(()=>{let f=!1;const y=new n(z.origin,{body:new yt,method:"POST",get duplex(){return f=!0,"half"}}).headers.has("Content-Type");return f&&!y}),l=o&&a&&Ct(()=>c.isReadableStream(new s("").body)),_={stream:l&&(f=>f.body)};r&&["text","arrayBuffer","blob","formData","stream"].forEach(f=>{!_[f]&&(_[f]=(y,h)=>{let x=y&&y[f];if(x)return x.call(y);throw new E(`Response type '${f}' is not supported`,E.ERR_NOT_SUPPORT,h)})});const S=async f=>{if(f==null)return 0;if(c.isBlob(f))return f.size;if(c.isSpecCompliantForm(f))return(await new n(z.origin,{method:"POST",body:f}).arrayBuffer()).byteLength;if(c.isArrayBufferView(f)||c.isArrayBuffer(f))return f.byteLength;if(c.isURLSearchParams(f)&&(f=f+""),c.isString(f))return(await p(f)).byteLength},C=async(f,y)=>{const h=c.toFiniteNumber(f.getContentLength());return h??S(y)};return async f=>{let{url:y,method:h,data:x,signal:M,cancelToken:T,timeout:B,onDownloadProgress:L,onUploadProgress:K,responseType:k,headers:F,withCredentials:H="same-origin",fetchOptions:ee}=zt(f),$=t||fetch;k=k?(k+"").toLowerCase():"text";let v=Os([M,T&&T.toAbortSignal()],B),j=null;const q=v&&v.unsubscribe&&(()=>{v.unsubscribe()});let Z;try{if(K&&d&&h!=="get"&&h!=="head"&&(Z=await C(F,x))!==0){let u=new n(y,{method:"POST",body:x,duplex:"half"}),w;if(c.isFormData(x)&&(w=u.headers.get("content-type"))&&F.setContentType(w),u.body){const[D,A]=ft(Z,Le(mt(K)));x=ht(u.body,wt,D,A)}}c.isString(H)||(H=H?"include":"omit");const g=i&&"credentials"in n.prototype,X={...ee,signal:v,method:h.toUpperCase(),headers:F.normalize().toJSON(),body:x,duplex:"half",credentials:g?H:void 0};j=i&&new n(y,X);let N=await(i?$(j,ee):$(y,X));const V=l&&(k==="stream"||k==="response");if(l&&(L||V&&q)){const u={};["status","statusText","headers"].forEach(G=>{u[G]=N[G]});const w=c.toFiniteNumber(N.headers.get("content-length")),[D,A]=L&&ft(w,Le(mt(L),!0))||[];N=new s(ht(N.body,wt,D,()=>{A&&A(),q&&q()}),u)}k=k||"text";let W=await _[c.findKey(_,k)||"text"](N,f);return!V&&q&&q(),await new Promise((u,w)=>{Vt(u,w,{data:W,headers:ne.from(N.headers),status:N.status,statusText:N.statusText,config:f,request:j})})}catch(g){throw q&&q(),g&&g.name==="TypeError"&&/Load failed|fetch/i.test(g.message)?Object.assign(new E("Network Error",E.ERR_NETWORK,f,j,g&&g.response),{cause:g.cause||g}):E.from(g,g&&g.code,f,j,g&&g.response)}}},Ys=new Map,Zt=e=>{let t=e&&e.env||{};const{fetch:n,Request:s,Response:r}=t,i=[s,r,n];let o=i.length,a=o,p,d,l=Ys;for(;a--;)p=i[a],d=l.get(p),d===void 0&&l.set(p,d=a?new Map:Ms(t)),l=d;return d};Zt();const Qe={http:ss,xhr:Ps,fetch:{get:Zt}};c.forEach(Qe,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Rt=e=>`- ${e}`,Hs=e=>c.isFunction(e)||e===null||e===!1;function Is(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,!Hs(s)&&(r=Qe[(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(([p,d])=>`adapter ${p} `+(d===!1?"is not supported by the environment":"is not available in the build"));let a=n?o.length>1?`since :
|
|
10
|
+
`+o.map(Rt).join(`
|
|
11
|
+
`):" "+Rt(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 Wt={getAdapter:Is,adapters:Qe};function Ye(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new De(null,e)}function bt(e){return Ye(e),e.headers=ne.from(e.headers),e.data=Me.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Wt.getAdapter(e.adapter||Se.adapter,e)(e).then(function(s){return Ye(e),s.data=Me.call(e,e.transformResponse,s),s.headers=ne.from(s.headers),s},function(s){return qt(s)||(Ye(e),s&&s.response&&(s.response.data=Me.call(e,e.transformResponse,s.response),s.response.headers=ne.from(s.response.headers))),Promise.reject(s)})}const Qt="1.13.5",je={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{je[e]=function(s){return typeof s===e||"a"+(t<1?"n ":" ")+e}});const Et={};je.transitional=function(t,n,s){function r(i,o){return"[Axios v"+Qt+"] 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&&!Et[o]&&(Et[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}};je.spelling=function(t){return(n,s)=>(console.warn(`${s} is likely a misspelling of ${t}`),!0)};function $s(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],p=a===void 0||o(a,i,e);if(p!==!0)throw new E("option "+i+" must be "+p,E.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new E("Unknown option "+i,E.ERR_BAD_OPTION)}}const xe={assertOptions:$s,validators:je},re=xe.validators;let ce=class{constructor(t){this.defaults=t||{},this.interceptors={request:new ut,response:new ut}}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=de(this.defaults,n);const{transitional:s,paramsSerializer:r,headers:i}=n;s!==void 0&&xe.assertOptions(s,{silentJSONParsing:re.transitional(re.boolean),forcedJSONParsing:re.transitional(re.boolean),clarifyTimeoutError:re.transitional(re.boolean),legacyInterceptorReqResOrdering:re.transitional(re.boolean)},!1),r!=null&&(c.isFunction(r)?n.paramsSerializer={serialize:r}:xe.assertOptions(r,{encode:re.function,serialize:re.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),xe.assertOptions(n,{baseUrl:re.spelling("baseURL"),withXsrfToken:re.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"],f=>{delete i[f]}),n.headers=ne.concat(o,i);const a=[];let p=!0;this.interceptors.request.forEach(function(y){if(typeof y.runWhen=="function"&&y.runWhen(n)===!1)return;p=p&&y.synchronous;const h=n.transitional||Ze;h&&h.legacyInterceptorReqResOrdering?a.unshift(y.fulfilled,y.rejected):a.push(y.fulfilled,y.rejected)});const d=[];this.interceptors.response.forEach(function(y){d.push(y.fulfilled,y.rejected)});let l,_=0,S;if(!p){const f=[bt.bind(this),void 0];for(f.unshift(...a),f.push(...d),S=f.length,l=Promise.resolve(n);_<S;)l=l.then(f[_++],f[_++]);return l}S=a.length;let C=n;for(;_<S;){const f=a[_++],y=a[_++];try{C=f(C)}catch(h){y.call(this,h);break}}try{l=bt.call(this,C)}catch(f){return Promise.reject(f)}for(_=0,S=d.length;_<S;)l=l.then(d[_++],d[_++]);return l}getUri(t){t=de(this.defaults,t);const n=Kt(t.baseURL,t.url,t.allowAbsoluteUrls);return Jt(n,t.params,t.paramsSerializer)}};c.forEach(["delete","get","head","options"],function(t){ce.prototype[t]=function(n,s){return this.request(de(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(de(a||{},{method:t,headers:s?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}ce.prototype[t]=n(),ce.prototype[t+"Form"]=n(!0)});let Gs=class en{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 De(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 en(function(r){t=r}),cancel:t}}};function Js(e){return function(n){return e.apply(null,n)}}function Xs(e){return c.isObject(e)&&e.isAxiosError===!0}const Ge={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(Ge).forEach(([e,t])=>{Ge[t]=e});function tn(e){const t=new ce(e),n=Ot(ce.prototype.request,t);return c.extend(n,ce.prototype,t,{allOwnKeys:!0}),c.extend(n,t,null,{allOwnKeys:!0}),n.create=function(r){return tn(de(e,r))},n}const Y=tn(Se);Y.Axios=ce;Y.CanceledError=De;Y.CancelToken=Gs;Y.isCancel=qt;Y.VERSION=Qt;Y.toFormData=Fe;Y.AxiosError=E;Y.Cancel=Y.CanceledError;Y.all=function(t){return Promise.all(t)};Y.spread=Js;Y.isAxiosError=Xs;Y.mergeConfig=de;Y.AxiosHeaders=ne;Y.formToJSON=e=>Xt(c.isHTMLForm(e)?new FormData(e):e);Y.getAdapter=Wt.getAdapter;Y.HttpStatusCode=Ge;Y.default=Y;const{Axios:Pr,AxiosError:Or,CanceledError:kr,isCancel:Fr,CancelToken:jr,VERSION:Br,all:Mr,Cancel:Yr,isAxiosError:Hr,spread:Ir,toFormData:$r,AxiosHeaders:Gr,HttpStatusCode:Jr,formToJSON:Xr,getAdapter:qr,mergeConfig:Vr}=Y,St=e=>{let t;const n=new Set,s=(d,l)=>{const _=typeof d=="function"?d(t):d;if(!Object.is(_,t)){const S=t;t=l??(typeof _!="object"||_===null)?_:Object.assign({},t,_),n.forEach(C=>C(t,S))}},r=()=>t,a={setState:s,getState:r,getInitialState:()=>p,subscribe:d=>(n.add(d),()=>n.delete(d))},p=t=e(s,r,a);return a},qs=(e=>e?St(e):St),Vs=e=>e;function Ks(e,t=Vs){const n=b.useSyncExternalStore(e.subscribe,b.useCallback(()=>t(e.getState()),[e,t]),b.useCallback(()=>t(e.getInitialState()),[e,t]));return b.useDebugValue(n),n}const Dt=e=>{const t=qs(e),n=s=>Ks(t,s);return Object.assign(n,t),n},zs=(e=>e?Dt(e):Dt),me=zs(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})})),Zs={"1D":"D1",D:"D1",240:"H4",120:"H2",60:"H1",30:"M30",15:"M15",5:"M5",1:"M1"},Je=e=>({1:60,5:300,15:900,30:1800,60:3600})[e]||3600,nn=[10,15,20,25,30,35,40,45,50],sn=b.createContext(null),Ws=()=>{const e=b.useContext(sn);if(!e)throw new Error("useWidgetContext must be used inside WidgetProvider");return e},Qs=({children:e,selectedTimeframe:t,setSelectedTimeframe:n,currentSymbol:s,setCurrentSymbol:r})=>m.jsx(sn.Provider,{value:{currentSymbol:s,setCurrentSymbol:r,selectedTimeframe:t,setSelectedTimeframe:n},children:e});const rn=(...e)=>e.filter((t,n,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===n).join(" ").trim();const er=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const tr=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,s)=>s?s.toUpperCase():n.toLowerCase());const At=e=>{const t=tr(e);return t.charAt(0).toUpperCase()+t.slice(1)};var nr={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 sr=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const rr=b.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:r="",children:i,iconNode:o,...a},p)=>b.createElement("svg",{ref:p,...nr,width:t,height:t,stroke:e,strokeWidth:s?Number(n)*24/Number(t):n,className:rn("lucide",r),...!i&&!sr(a)&&{"aria-hidden":"true"},...a},[...o.map(([d,l])=>b.createElement(d,l)),...Array.isArray(i)?i:[i]]));const et=(e,t)=>{const n=b.forwardRef(({className:s,...r},i)=>b.createElement(rr,{ref:i,iconNode:t,className:rn(`lucide-${er(At(e))}`,`lucide-${e}`,s),...r}));return n.displayName=At(e),n};const ir=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],or=et("chevron-down",ir);const ar=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],cr=et("chevron-left",ar);const lr=[["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"}]],dr=et("speech",lr),Xe=(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"},Ut=e=>e.trim().replaceAll(" ","").replaceAll("_",""),ur=new Intl.DateTimeFormat("en-US",{year:"numeric",month:"long",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}),on=e=>{const t=ur.formatToParts(e),n=s=>t.find(r=>r.type===s)?.value??"";return`${n("year")} ${n("month")} ${n("day")}, ${n("hour")}:${n("minute")}`},pr=({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}),fr=({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(pr,{currency:r})}),m.jsxs("div",{className:"news-widget_news_card__meta",children:[m.jsx("div",{className:"news-widget_news_card__date",children:on(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 ${Xe(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 mr(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 _r=({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&&on(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 ${mr(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(dr,{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 ${Xe(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 ${Xe(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(fr,{title:i.event_name,date:new Date(i.timestamp),forecast:i.forecast,actual:i.actual,currency:e?.currency},o))})]})})]}),hr=({newsDetail:e,children:t,isCompared:n})=>{const[s,r]=b.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(_r,{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(or,{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})})]})},wr=[{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 yr(e,t,n=1){if(t===0||!isFinite(t))return n;const s=e/t;return isFinite(s)?s:n}function Tt(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 gr(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=Tt(r),o=Tt(s),a=yr(o,i),p=e[0].o,d=t.c;return e.map(l=>{const _=(l.o-p)*a+d,S=(l.h-p)*a+d,C=(l.l-p)*a+d,f=(l.c-p)*a+d;return{o:_,h:Math.max(S,_,f),l:Math.min(C,_,f),c:f}})}const le=e=>e==="1"?60:e==="5"?300:e==="1D"?1440*3600:parseInt(e,10)*60,qe=8,an=4,Ve=5,cn=e=>{const t=new Date(e+qe*60*60*1e3),n=t.getUTCDay(),s=t.getUTCHours();return n===0?!1:n===1?s>=Ve:n===6?s<=an:!0},ln=e=>{const t=new Date(e+qe*60*60*1e3),n=t.getUTCDay(),s=t.getUTCHours();if(n===0||n===1&&s<Ve||n===6&&s>=an){const r=(8-n)%7;return t.setUTCDate(t.getUTCDate()+r),t.setUTCHours(Ve,0,0,0),t.getTime()-qe*60*60*1e3}return e},Cr=(e,t,n)=>{const s=le(t)*1e3,r=[];let i=e;for(let o=0;o<n;o++)i+=s,cn(i)||(i=ln(i)),r.push(i);return r},Nt=(e,t,n,s)=>{if(n<=0)return[];if(s==="24x7"){const i=le(t)*1e3;return Array.from({length:n},(o,a)=>e+(a+1)*i)}if(s==="1700-1700")return Cr(e,t,n);const r=le(t)*1e3;return Array.from({length:n},(i,o)=>e+(o+1)*r)},Rr=(e,t,n,s)=>{if(s==="24x7"){const i=le(n)*1e3;return Math.max(0,Math.floor((t-e)/i))}if(s==="1700-1700"){const i=le(n)*1e3;let o=0,a=e;for(;a<t;)a+=i,cn(a)||(a=ln(a)),a<=t&&o++;return o}const r=le(n)*1e3;return Math.max(0,Math.floor((t-e)/r))},dn=[{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"}],br=({replayTabId:e,futureBarsRef:t,highlightBarsRef:n,tvWidgetRef:s,pushBar:r,resolution:i,symbol:o})=>{const a=me(C=>C.newsSelectedCandles),p=me(C=>C.newsTargetCandle),d=me(C=>C.newsPlayEndTimestamp),l=me(C=>C.gapCount),_=b.useRef(a),S=b.useRef(null);return b.useEffect(()=>{const C={current:null};let f=!1;return(async()=>{if(!f){if(a?.length&&p!==null){if(S.current===a)return;t.current=[];const y=d!=null;if(_.current||y)try{s?.current?.resetCache(),s?.current?.activeChart().resetData()}catch{}try{s?.current?.activeChart().executeActionById("timeScaleReset")}catch{}console.log("upcoming-predict: ",{newsTargetCandle:p});const x=[...a].slice(-50-(l||0)),M=gr(x,p[p.length-1],p),B=dn.find(v=>v.ticker===o||v.display_name===o)?.session||"24x7",L=Nt(p[p.length-1].timestamp,i,l||0,B),K=Nt(l?L[L.length-1]:p[p.length-1].timestamp,i,M.length,B),F=M.map((v,j)=>({open:v.o,high:v.h,low:v.l,close:v.c,time:K[j]})).sort((v,j)=>v.time-j.time);n.current=F.slice(-50);let H=0,ee=0;const $=async()=>{C.current&&(clearInterval(C.current),C.current=null),S.current=a;try{a&&F.length>0}catch(v){console.error("Error setting visible range:",v)}};F.length===0?(t.current=[],await $()):setTimeout(()=>{C.current=setInterval(()=>{if(H<F.length){if(r(e,F[H]))t.current=F.slice(0,H+1),H++,ee=0,H===F.length&&(t.current=F,$());else if(ee++,ee>=10){t.current=[...F];try{s?.current?.activeChart().resetData()}catch{}$()}}},150)},700)}else{if(t.current=[],_.current)try{s?.current?.resetCache(),s?.current?.activeChart().resetData()}catch{}S.current=null}_.current=a}})(),()=>{f=!0,C.current&&clearInterval(C.current)}},[r,t,n,d,a,p,e,i,o,s,l]),b.useEffect(()=>{a===null&&(n.current=[])},[n,a]),m.jsx(m.Fragment,{})},Er=({children:e,eventId:t,widgetKey:n,chartWidget:s,event:r,theme:i,newsDetail:o,selectedCandles:a,defaultSymbol:p,currentSymbol:d,currentTimeFrame:l,isUpcoming:_=!1,isElapsed:S=!1,onBack:C,pushBar:f,highlightBarsRef:y,futureRef:h,setGapCountExternal:x,setReplayModeExternal:M})=>{const T=b.useRef(null),B=b.useRef(!1),{setCurrentSymbol:L,setSelectedTimeframe:K}=Ws(),{setNewsTargetCandle:k,setGapCount:F,setNewsPlayEndTimestamp:H,setNewsSelectedCandles:ee}=me();return b.useEffect(()=>{if(!t||t==""||!s)return;const $=()=>{if(s){const g=s?.activeChart();g&&g.getAllShapes().forEach(X=>{try{g.removeEntity(X.id)}catch(N){console.error("Failed to remove shape",N)}})}},v=async()=>{const{data:g,status:X}=await Y.get(`https://corprate-widget.iccandle.ai/news/${t}`,{headers:{"api-key":n},params:{symbol:p}});if(X!==200){console.error("Failed to fetch news detail");return}return g};let j=!1;const q=[],Z=(g,X)=>{const N=window.setTimeout(g,X);return q.push(N),N};return T.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;if(!B.current){const w=await g.createStudy("Generated Candles - By iC Candle",!0,!0);w&&g.bringToFront([w]),B.current=!0}const X=async(w,D)=>{await g.createShape({time:D},{shape:"vertical_line",lock:!0,disableSelection:!0,overrides:{linestyle:2,linewidth:1}});const A=await g.exportData(),G=A.data.findIndex(R=>R[0]===D);let Q=a;if(G!=-1&&!Q&&(Q=[...nn].sort((R,U)=>U-R).find(R=>A.data[G+R])??null),G!=-1&&Q){const R=w,U=A.data[G+Q][0],J=A.data.filter(O=>O[0]>R&&O[0]<=U)??[];let P=null,I=null;if(J.length>0){const O=J.reduce((ue,oe,pe,fe)=>Number(oe[3])<Number(fe[ue][3])?pe:ue,0),se=J[O];I={time:se[0],value:Number(se[3])}}if(J.length>0){const O=J.reduce((ue,oe,pe,fe)=>Number(oe[2])>Number(fe[ue][2])?pe:ue,0),se=J[O];P={time:se[0],value:Number(se[2])}}if(P&&I&&J.length>0){const O=P.value,se=I.value,oe=A.data[G+1][1];await g.createMultipointShape([{time:R,price:oe},{time:U,price:O}],{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:R,price:se},{time:U,price:oe}],{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:R,price:O},{time:U,price:O}],{shape:"trend_line",overrides:{linecolor:"#12B76A",linewidth:1,linestyle:2,extendLeft:!0,extendRight:!0}}),await g.createMultipointShape([{time:R,price:se},{time:U,price:se}],{shape:"trend_line",overrides:{linecolor:"#D92D20",linewidth:1,linestyle:2,extendLeft:!0,extendRight:!0}});const pe=wr.find(Ae=>Ut(Ae.name)==Ut(d))?.pipLocation;let fe="",tt="";if(pe){const Ae=Math.pow(10,-pe),nt=parseFloat(Math.abs((O-oe)*Ae).toFixed(1)),st=parseFloat(Math.abs((se-oe)*Ae).toFixed(1));fe=`${nt>=0?"+":""}${nt.toFixed(2)} pip`,tt=`${st>=0?"-":""}${st.toFixed(2)} pip`}await g.createShape({time:P.time,price:P.value},{shape:"arrow_down",overrides:{arrowColor:"#12B76A",fontsize:11,color:"#12B76A",text:fe,bold:!0}}),await g.createShape({time:I.time,price:I.value},{shape:"arrow_up",overrides:{arrowColor:"#D92D20",fontsize:11,color:"#D92D20",text:tt,bold:!0}});const un=Math.floor((R+U)/2);await g.createShape({time:un},{shape:"text",text:`${Q} candles`,zOrder:"top",overrides:{fontsize:12,color:"#FFFFFF",bold:!0,backgroundColor:"#FFFFFF"}})}}if(A&&await g.setVisibleRange({from:A.data[0][0],to:A.data[A.data?.length-1][0]}),_&&r){const R=Math.floor(Date.now()/1e3);await g.setVisibleRange({from:R-3600*24*7,to:D/1e3+1440*60*7});const U=D/1e3,J=g.resolution();Z(()=>{j||T.current!==s||Number(J)<=30&&g.createShape({time:U},{shape:"vertical_line",lock:!0,disableSelection:!0,overrides:{linestyle:2,linewidth:1}})},2e3)}},N=async()=>{if(j||T.current!==s)return;const w=await v();if(j||T.current!==s)return;$();const D=(w?.event?.timestamp??0)/1e3,A=Je(l),G=D-D%A;g.getVisibleBarsRange()||await new Promise(U=>setTimeout(U,2e3));const R=g.getVisibleBarsRange();R&&R.from<=D&&D<=R.to?await X(D,G):(_||await g.setVisibleRange({from:D}),await X(D,G))},V=()=>{Z(()=>{j||T.current!==s||(async()=>{try{L(g.symbol())}catch(w){console.log("error=>",w)}})()},300)},W=()=>{Z(()=>{j||T.current!==s||(async()=>{try{K(g.resolution())}catch(w){console.log("error=>",w)}})()},300)};g.onSymbolChanged().subscribe(null,V),g.onIntervalChanged().subscribe(null,W);try{S||await N()}catch(w){console.log("error=>",w)}j&&(()=>{try{g.onSymbolChanged().unsubscribe(null,V)}catch{}try{g.onIntervalChanged().unsubscribe(null,W)}catch{}})()}),()=>{j=!0,q.forEach(g=>window.clearTimeout(g)),$(),T.current===s&&(T.current=null)}},[i,n,s,_,p,a,r,t,l,K,d,L,S,H,ee,F,k,x,M]),b.useEffect(()=>{s&&s.onChartReady(async()=>{const $=s?.activeChart();$&&$.onDataLoaded().subscribe(null,async()=>{const{data:v}=await $.exportData();console.log({isUpcoming:_,candles:v});const j=Je(l),q=(r?.timestamp??0)/1e3,Z=q-q%j,g=v.findIndex(N=>N[0]===Z),X=v.slice(g-49,g+1).map(N=>({o:N[1],h:N[2],l:N[3],c:N[4],timestamp:N[0]*1e3}));if(_){const N=v[v.length-1],V={o:N[1],h:N[2],l:N[3],c:N[4],timestamp:N[0]*1e3},W=$.resolution(),u=le(W)*1e3,w=V.timestamp,D=r?.timestamp??0,A=Math.floor(D/u)*u,G=dn.find(U=>U.ticker===d)?.session||"24x7",Q=Rr(w,A,W,G),R=v.slice(-50).map(U=>({o:U[1],h:U[2],l:U[3],c:U[4],timestamp:U[0]*1e3}));console.log({historySlice:R,gapCount:Q}),F(Q),k(R)}else console.log({targetCandle:X,gapCount:0}),k(X),F(0)},!0)})},[t,r?.timestamp,k,F,l,_,d,s]),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:C,children:m.jsx(cr,{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(hr,{newsDetail:o,children:[e,_&&m.jsx(br,{replayTabId:t||"news",futureBarsRef:h,highlightBarsRef:y,pushBar:f,tvWidgetRef:T,resolution:l||"15",symbol:d})]})})]})})},Ce="https://widget-result-news.iccandle.ai",vt="https://corprate-widget.iccandle.ai/news",Sr=({chartWidget:e,children:t,widgetKey:n,defaultSymbol:s,chartInterval:r="15",theme:i,symbolMapper:o,pushBar:a,futureRef:p,highlightBarsRef:d,setGapCountExternal:l,setReplayModeExternal:_})=>{const{start:S}=_n(),[C,f]=b.useState(""),[y,h]=b.useState(r),[x,M]=b.useState(s),[T,B]=b.useState(null),[L,K]=b.useState(null),{setNewsSelectedCandles:k,setNewsPlayEndTimestamp:F,newsTargetCandle:H,gapCount:ee}=me(),$=Zs[y]||"M15",v=Je("60"),j=L?.[0]?.timestamp?L?.[0]?.timestamp/1e3:0,q=j-j%v,Z=L?.[0]?.candleData.H1?.candles,g=Z?.findIndex(R=>R.timestamp===q)||0,N=(Z?.length||0)-g<=10,V="next_pip_up_50"in(L?.[0]?.candleData[$]?.metadata??{}),W=!!C&&!V,u=b.useRef(W),w=b.useRef(!1);b.useEffect(()=>{if(W!==u.current){if(u.current=W,w.current){w.current=!1;return}S()}},[W,S]),b.useEffect(()=>{const R=async P=>{const{data:I,status:O}=await Y.get(`${vt}/${P}`,{headers:{"api-key":n},params:{symbol:s}});return O!==200?(console.error("Failed to fetch news detail"),null):I},U=async P=>{const{data:I,status:O}=await Y.get(`${vt}/similar-details`,{headers:{"api-key":n},params:{event_id:P}});return O!==200?(console.error("Failed to fetch compared news"),null):I};(async()=>{if(C==="")return;const[P,I]=await Promise.all([R(C),U(C)]);P&&B(P),I&&K(I)})()},[n,C,s]);const D=b.useCallback(()=>{_(!1),l(0),k(null),F(null)},[_,l,k,F]),A=b.useCallback(()=>{f(""),M(s),D()},[s,D]);b.useEffect(()=>{const R=async({origin:U,data:J})=>{if(U!==Ce||typeof J!="string")return;const P=JSON.parse(J);if(console.log({action:P.action}),P.action=="back")A();else if(P.action=="back-to-similar-events")D();else if(P.action=="eventClicked"){w.current=!0,S();const O=P.data.event,se=e?.activeChart();await e?.headerReady(),se?.clearMarks(2),localStorage.setItem("iccandle:current-news-event",JSON.stringify({actual:O.actual,event_name:O.event_name,forecast:O.forecast,id:O.id,metric:O.metric,previous:O.previous,timestamp:O.timestamp,currency:O.currency})),se?.refreshMarks(),f(O.id)}else if(P.action=="intervalChanged"||P.action=="symbolChanged"){const I=P.data;if(I.type===2)return;h(I.resolution);const O=o?.[I.symbol]??s;M(O)}else if(P.action=="replay"){const I=P.data;console.log({replayData:I,gapCount:ee,ts:H?.[H.length-1]?.timestamp??null}),_(I.isReplay),l(ee),k(I.selectedCandles),F(H?.[H.length-1]?.timestamp??null)}};return window.addEventListener("message",R),()=>window.removeEventListener("message",R)},[H,ee,e,s,S,D,A,o,_,l,F,k]);const G=b.useMemo(()=>{const R=L?.[0]?.candleData?.[$]?.metadata;return R?[...nn].sort((U,J)=>J-U).find(U=>[`next_pip_up_${U}`,`next_pip_down_${U}`].some(P=>R[P]!==void 0))??null:null},[L,$]);b.useEffect(()=>{const R=()=>{A()};return window.addEventListener("popstate",R),()=>window.removeEventListener("popstate",R)},[A]);const Q=b.useMemo(()=>C?L?V?`${Ce}/${C}?apiKey=${n}&theme=${i}&interval=${y}&symbol=${x}`:`${Ce}/similar-events/${C}?apiKey=${n}&theme=${i}`:`${Ce}?apiKey=${n}&theme=${i}`:`${Ce}?apiKey=${n}&theme=${i}`,[C,L,V,n,i,y,x]);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:C&&!V?"flex":"none"},children:m.jsx(Qs,{selectedTimeframe:y,setSelectedTimeframe:h,currentSymbol:x,setCurrentSymbol:M,children:m.jsx(Er,{eventId:C,chartWidget:e,widgetKey:n,theme:i,defaultSymbol:s,newsDetail:T,isUpcoming:N,event:T?.event,selectedCandles:G,currentTimeFrame:y,currentSymbol:x,onBack:A,isElapsed:V,pushBar:a,futureRef:p,highlightBarsRef:d,setReplayModeExternal:_,setGapCountExternal:l,children:t})})}),m.jsx("iframe",{src:Q,className:C&&!V?"news-widget_main__iframe_half":"news-widget_main__iframe_full"})]})},Dr="https://api.iccandle.ai",Ar='"Inter Tight", ui-sans-serif, system-ui, sans-serif';function xt(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??Ar}}const Ur=async e=>{const t=await fetch(`${Dr}/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:xt(n.dark),light:xt(n.light)}},Lt={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 Tr(e,t){const[n,s]=b.useState(null);b.useEffect(()=>{Ur(e).then(d=>{s(d)})},[e]);const r=b.useRef(null),[i,o]=b.useState(null),a=b.useMemo(()=>t==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":t,[t]),p=b.useMemo(()=>{if(n)return a==="dark"?n.dark:n.light},[n,a]);return b.useEffect(()=>{if(typeof window>"u"||!p||!i)return;const d=i;Object.keys(Lt).forEach(l=>{d.style.setProperty(Lt[l],p[l])})},[p,i]),{rootRef:r,setRootEl:o,resolvedTheme:a}}const Nr=e=>{const{rootRef:t,setRootEl:n,resolvedTheme:s}=Tr(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(wn,{theme:s,children:m.jsx(Sr,{...e,children:e.children})})})};exports.NewsWidget=Nr;
|
package/dist/news-widget.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { IChartingLibraryWidget } from 'public/charting_library/charting_library';
|
|
3
|
+
import { IChartingLibraryWidget, Bar } from 'public/charting_library/charting_library';
|
|
4
4
|
|
|
5
5
|
declare const TICKERS: readonly ["EURJPY", "GBPJPY", "AUDJPY", "NZDJPY", "CADJPY", "CHFJPY", "USDJPY", "EURUSD", "AUDUSD", "NZDUSD", "USDCHF", "USDCAD", "GBPAUD", "GBPCAD", "GBPCHF", "GBPNZD", "GBPUSD", "NZDCAD", "EURCAD", "EURAUD", "XAUUSD", "BCOUSD", "S&P500", "NASDAQ100", "US30", "BTCUSDT", "ETHUSDT", "XRPUSDT", "SOLUSDT", "ADAUSDT", "AVAUSDT", "AVAXUSDT", "BNBUSDT", "DOGEUSDT", "DOTUSDT", "TRXUSDT", "AAPL", "AMZN", "BRK.B", "GOOGL", "KO", "META", "MSFT", "NFLX", "NKE", "NVDA", "TME", "TSLA", "XAGUSD", "XCUUSD"];
|
|
6
6
|
|
|
@@ -13,9 +13,18 @@ type NewsWidgetProps = {
|
|
|
13
13
|
children: ReactNode;
|
|
14
14
|
widgetKey: string;
|
|
15
15
|
defaultSymbol: string;
|
|
16
|
-
symbolMapper?: SymbolMapper;
|
|
17
16
|
chartInterval: "1" | "5" | "15" | "30" | "60";
|
|
18
17
|
theme?: "light" | "dark" | "system";
|
|
18
|
+
symbolMapper?: SymbolMapper;
|
|
19
|
+
pushBar: (tabValue: string, bar: Bar) => boolean;
|
|
20
|
+
highlightBarsRef: {
|
|
21
|
+
current: Bar[];
|
|
22
|
+
};
|
|
23
|
+
futureRef: {
|
|
24
|
+
current: Bar[];
|
|
25
|
+
};
|
|
26
|
+
setGapCountExternal: (count: number) => void;
|
|
27
|
+
setReplayModeExternal: (isReplayMode: boolean) => void;
|
|
19
28
|
};
|
|
20
29
|
|
|
21
30
|
declare const NewsWidget: (props: NewsWidgetProps) => react_jsx_runtime.JSX.Element;
|