gearboxdownloadmodal 8.5.4 → 8.5.5
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/index.es.js +35 -34
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +6 -6
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
*/var ir;function el(){return ir||(ir=1,process.env.NODE_ENV!=="production"&&function(){var e=y,i=Symbol.for("react.element"),t=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),n=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),q=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),u=Symbol.for("react.lazy"),I=Symbol.for("react.offscreen"),c=Symbol.iterator,Z="@@iterator";function K(d){if(d===null||typeof d!="object")return null;var R=c&&d[c]||d[Z];return typeof R=="function"?R:null}var S=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function W(d){{for(var R=arguments.length,x=new Array(R>1?R-1:0),ii=1;ii<R;ii++)x[ii-1]=arguments[ii];U("error",d,x)}}function U(d,R,x){{var ii=S.ReactDebugCurrentFrame,Ii=ii.getStackAddendum();Ii!==""&&(R+="%s",x=x.concat([Ii]));var Si=x.map(function(mi){return String(mi)});Si.unshift("Warning: "+R),Function.prototype.apply.call(console[d],console,Si)}}var k=!1,h=!1,b=!1,F=!1,N=!1,v;v=Symbol.for("react.module.reference");function _(d){return!!(typeof d=="string"||typeof d=="function"||d===a||d===r||N||d===o||d===A||d===q||F||d===I||k||h||b||typeof d=="object"&&d!==null&&(d.$$typeof===u||d.$$typeof===p||d.$$typeof===s||d.$$typeof===n||d.$$typeof===l||d.$$typeof===v||d.getModuleId!==void 0))}function X(d,R,x){var ii=d.displayName;if(ii)return ii;var Ii=R.displayName||R.name||"";return Ii!==""?x+"("+Ii+")":x}function H(d){return d.displayName||"Context"}function f(d){if(d==null)return null;if(typeof d.tag=="number"&&W("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof d=="function")return d.displayName||d.name||null;if(typeof d=="string")return d;switch(d){case a:return"Fragment";case t:return"Portal";case r:return"Profiler";case o:return"StrictMode";case A:return"Suspense";case q:return"SuspenseList"}if(typeof d=="object")switch(d.$$typeof){case n:var R=d;return H(R)+".Consumer";case s:var x=d;return H(x._context)+".Provider";case l:return X(d,d.render,"ForwardRef");case p:var ii=d.displayName||null;return ii!==null?ii:f(d.type)||"Memo";case u:{var Ii=d,Si=Ii._payload,mi=Ii._init;try{return f(mi(Si))}catch{return null}}}return null}var g=Object.assign,L=0,Y,C,M,D,J,E,O;function B(){}B.__reactDisabledLog=!0;function z(){{if(L===0){Y=console.log,C=console.info,M=console.warn,D=console.error,J=console.group,E=console.groupCollapsed,O=console.groupEnd;var d={configurable:!0,enumerable:!0,value:B,writable:!0};Object.defineProperties(console,{info:d,log:d,warn:d,error:d,group:d,groupCollapsed:d,groupEnd:d})}L++}}function P(){{if(L--,L===0){var d={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:g({},d,{value:Y}),info:g({},d,{value:C}),warn:g({},d,{value:M}),error:g({},d,{value:D}),group:g({},d,{value:J}),groupCollapsed:g({},d,{value:E}),groupEnd:g({},d,{value:O})})}L<0&&W("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Q=S.ReactCurrentDispatcher,w;function ti(d,R,x){{if(w===void 0)try{throw Error()}catch(Ii){var ii=Ii.stack.trim().match(/\n( *(at )?)/);w=ii&&ii[1]||""}return`
|
|
18
18
|
`+w+d}}var si=!1,oi;{var Zi=typeof WeakMap=="function"?WeakMap:Map;oi=new Zi}function G(d,R){if(!d||si)return"";{var x=oi.get(d);if(x!==void 0)return x}var ii;si=!0;var Ii=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Si;Si=Q.current,Q.current=null,z();try{if(R){var mi=function(){throw Error()};if(Object.defineProperty(mi.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(mi,[])}catch(Di){ii=Di}Reflect.construct(d,[],mi)}else{try{mi.call()}catch(Di){ii=Di}d.call(mi.prototype)}}else{try{throw Error()}catch(Di){ii=Di}d()}}catch(Di){if(Di&&ii&&typeof Di.stack=="string"){for(var li=Di.stack.split(`
|
|
19
19
|
`),Ni=ii.stack.split(`
|
|
20
|
-
`),
|
|
21
|
-
`+li[
|
|
20
|
+
`),Vi=li.length-1,Wi=Ni.length-1;Vi>=1&&Wi>=0&&li[Vi]!==Ni[Wi];)Wi--;for(;Vi>=1&&Wi>=0;Vi--,Wi--)if(li[Vi]!==Ni[Wi]){if(Vi!==1||Wi!==1)do if(Vi--,Wi--,Wi<0||li[Vi]!==Ni[Wi]){var te=`
|
|
21
|
+
`+li[Vi].replace(" at new "," at ");return d.displayName&&te.includes("<anonymous>")&&(te=te.replace("<anonymous>",d.displayName)),typeof d=="function"&&oi.set(d,te),te}while(Vi>=1&&Wi>=0);break}}}finally{si=!1,Q.current=Si,P(),Error.prepareStackTrace=Ii}var ot=d?d.displayName||d.name:"",Te=ot?ti(ot):"";return typeof d=="function"&&oi.set(d,Te),Te}function Mi(d,R,x){return G(d,!1)}function Fi(d){var R=d.prototype;return!!(R&&R.isReactComponent)}function Ei(d,R,x){if(d==null)return"";if(typeof d=="function")return G(d,Fi(d));if(typeof d=="string")return ti(d);switch(d){case A:return ti("Suspense");case q:return ti("SuspenseList")}if(typeof d=="object")switch(d.$$typeof){case l:return Mi(d.render);case p:return Ei(d.type,R,x);case u:{var ii=d,Ii=ii._payload,Si=ii._init;try{return Ei(Si(Ii),R,x)}catch{}}}return""}var bi=Object.prototype.hasOwnProperty,$i={},j=S.ReactDebugCurrentFrame;function T(d){if(d){var R=d._owner,x=Ei(d.type,d._source,R?R.type:null);j.setExtraStackFrame(x)}else j.setExtraStackFrame(null)}function $(d,R,x,ii,Ii){{var Si=Function.call.bind(bi);for(var mi in d)if(Si(d,mi)){var li=void 0;try{if(typeof d[mi]!="function"){var Ni=Error((ii||"React class")+": "+x+" type `"+mi+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof d[mi]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Ni.name="Invariant Violation",Ni}li=d[mi](R,mi,ii,x,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Vi){li=Vi}li&&!(li instanceof Error)&&(T(Ii),W("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",ii||"React class",x,mi,typeof li),T(null)),li instanceof Error&&!(li.message in $i)&&($i[li.message]=!0,T(Ii),W("Failed %s type: %s",x,li.message),T(null))}}}var Ci=Array.isArray;function ui(d){return Ci(d)}function wi(d){{var R=typeof Symbol=="function"&&Symbol.toStringTag,x=R&&d[Symbol.toStringTag]||d.constructor.name||"Object";return x}}function Mt(d){try{return Ze(d),!1}catch{return!0}}function Ze(d){return""+d}function he(d){if(Mt(d))return W("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",wi(d)),Ze(d)}var Qi=S.ReactCurrentOwner,me={key:!0,ref:!0,__self:!0,__source:!0},Et,Ra,Ce;Ce={};function Ua(d){if(bi.call(d,"ref")){var R=Object.getOwnPropertyDescriptor(d,"ref").get;if(R&&R.isReactWarning)return!1}return d.ref!==void 0}function La(d){if(bi.call(d,"key")){var R=Object.getOwnPropertyDescriptor(d,"key").get;if(R&&R.isReactWarning)return!1}return d.key!==void 0}function ni(d,R){if(typeof d.ref=="string"&&Qi.current&&R&&Qi.current.stateNode!==R){var x=f(Qi.current.type);Ce[x]||(W('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',f(Qi.current.type),d.ref),Ce[x]=!0)}}function gi(d,R){{var x=function(){Et||(Et=!0,W("%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://reactjs.org/link/special-props)",R))};x.isReactWarning=!0,Object.defineProperty(d,"key",{get:x,configurable:!0})}}function yi(d,R){{var x=function(){Ra||(Ra=!0,W("%s: `ref` 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://reactjs.org/link/special-props)",R))};x.isReactWarning=!0,Object.defineProperty(d,"ref",{get:x,configurable:!0})}}var Ue=function(d,R,x,ii,Ii,Si,mi){var li={$$typeof:i,type:d,key:R,ref:x,props:mi,_owner:Si};return li._store={},Object.defineProperty(li._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(li,"_self",{configurable:!1,enumerable:!1,writable:!1,value:ii}),Object.defineProperty(li,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Ii}),Object.freeze&&(Object.freeze(li.props),Object.freeze(li)),li};function ie(d,R,x,ii,Ii){{var Si,mi={},li=null,Ni=null;x!==void 0&&(he(x),li=""+x),La(R)&&(he(R.key),li=""+R.key),Ua(R)&&(Ni=R.ref,ni(R,Ii));for(Si in R)bi.call(R,Si)&&!me.hasOwnProperty(Si)&&(mi[Si]=R[Si]);if(d&&d.defaultProps){var Vi=d.defaultProps;for(Si in Vi)mi[Si]===void 0&&(mi[Si]=Vi[Si])}if(li||Ni){var Wi=typeof d=="function"?d.displayName||d.name||"Unknown":d;li&&gi(mi,Wi),Ni&&yi(mi,Wi)}return Ue(d,li,Ni,Ii,ii,Qi.current,mi)}}var ye=S.ReactCurrentOwner,ee=S.ReactDebugCurrentFrame;function Bi(d){if(d){var R=d._owner,x=Ei(d.type,d._source,R?R.type:null);ee.setExtraStackFrame(x)}else ee.setExtraStackFrame(null)}var at;at=!1;function ge(d){return typeof d=="object"&&d!==null&&d.$$typeof===i}function Bn(){{if(ye.current){var d=f(ye.current.type);if(d)return`
|
|
22
22
|
|
|
23
23
|
Check the render method of \``+d+"`."}return""}}function SI(d){{if(d!==void 0){var R=d.fileName.replace(/^.*[\\\/]/,""),x=d.lineNumber;return`
|
|
24
24
|
|
|
25
25
|
Check your code at `+R+":"+x+"."}return""}}var Dn={};function hI(d){{var R=Bn();if(!R){var x=typeof d=="string"?d:d.displayName||d.name;x&&(R=`
|
|
26
26
|
|
|
27
|
-
Check the top-level render call using <`+x+">.")}return R}}function Xn(d,R){{if(!d._store||d._store.validated||d.key!=null)return;d._store.validated=!0;var x=hI(R);if(Dn[x])return;Dn[x]=!0;var ii="";d&&d._owner&&d._owner!==ye.current&&(ii=" It was passed a child from "+f(d._owner.type)+"."),Bi(d),W('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',x,ii),Bi(null)}}function fn(d,R){{if(typeof d!="object")return;if(ui(d))for(var x=0;x<d.length;x++){var ii=d[x];ge(ii)&&Xn(ii,R)}else if(ge(d))d._store&&(d._store.validated=!0);else if(d){var Ii=K(d);if(typeof Ii=="function"&&Ii!==d.entries)for(var Si=Ii.call(d),mi;!(mi=Si.next()).done;)ge(mi.value)&&Xn(mi.value,R)}}}function CI(d){{var R=d.type;if(R==null||typeof R=="string")return;var x;if(typeof R=="function")x=R.propTypes;else if(typeof R=="object"&&(R.$$typeof===l||R.$$typeof===p))x=R.propTypes;else return;if(x){var ii=f(R);$(x,d.props,"prop",ii,d)}else if(R.PropTypes!==void 0&&!at){at=!0;var Ii=f(R);W("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Ii||"Unknown")}typeof R.getDefaultProps=="function"&&!R.getDefaultProps.isReactClassApproved&&W("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function yI(d){{for(var R=Object.keys(d.props),x=0;x<R.length;x++){var ii=R[x];if(ii!=="children"&&ii!=="key"){Bi(d),W("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",ii),Bi(null);break}}d.ref!==null&&(Bi(d),W("Invalid attribute `ref` supplied to `React.Fragment`."),Bi(null))}}var vn={};function Hn(d,R,x,ii,Ii,Si){{var mi=_(d);if(!mi){var li="";(d===void 0||typeof d=="object"&&d!==null&&Object.keys(d).length===0)&&(li+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var Ni=SI(Ii);Ni?li+=Ni:li+=Bn();var
|
|
27
|
+
Check the top-level render call using <`+x+">.")}return R}}function Xn(d,R){{if(!d._store||d._store.validated||d.key!=null)return;d._store.validated=!0;var x=hI(R);if(Dn[x])return;Dn[x]=!0;var ii="";d&&d._owner&&d._owner!==ye.current&&(ii=" It was passed a child from "+f(d._owner.type)+"."),Bi(d),W('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',x,ii),Bi(null)}}function fn(d,R){{if(typeof d!="object")return;if(ui(d))for(var x=0;x<d.length;x++){var ii=d[x];ge(ii)&&Xn(ii,R)}else if(ge(d))d._store&&(d._store.validated=!0);else if(d){var Ii=K(d);if(typeof Ii=="function"&&Ii!==d.entries)for(var Si=Ii.call(d),mi;!(mi=Si.next()).done;)ge(mi.value)&&Xn(mi.value,R)}}}function CI(d){{var R=d.type;if(R==null||typeof R=="string")return;var x;if(typeof R=="function")x=R.propTypes;else if(typeof R=="object"&&(R.$$typeof===l||R.$$typeof===p))x=R.propTypes;else return;if(x){var ii=f(R);$(x,d.props,"prop",ii,d)}else if(R.PropTypes!==void 0&&!at){at=!0;var Ii=f(R);W("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Ii||"Unknown")}typeof R.getDefaultProps=="function"&&!R.getDefaultProps.isReactClassApproved&&W("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function yI(d){{for(var R=Object.keys(d.props),x=0;x<R.length;x++){var ii=R[x];if(ii!=="children"&&ii!=="key"){Bi(d),W("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",ii),Bi(null);break}}d.ref!==null&&(Bi(d),W("Invalid attribute `ref` supplied to `React.Fragment`."),Bi(null))}}var vn={};function Hn(d,R,x,ii,Ii,Si){{var mi=_(d);if(!mi){var li="";(d===void 0||typeof d=="object"&&d!==null&&Object.keys(d).length===0)&&(li+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var Ni=SI(Ii);Ni?li+=Ni:li+=Bn();var Vi;d===null?Vi="null":ui(d)?Vi="array":d!==void 0&&d.$$typeof===i?(Vi="<"+(f(d.type)||"Unknown")+" />",li=" Did you accidentally export a JSX literal instead of a component?"):Vi=typeof d,W("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Vi,li)}var Wi=ie(d,R,x,Ii,Si);if(Wi==null)return Wi;if(mi){var te=R.children;if(te!==void 0)if(ii)if(ui(te)){for(var ot=0;ot<te.length;ot++)fn(te[ot],d);Object.freeze&&Object.freeze(te)}else W("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 fn(te,d)}if(bi.call(R,"key")){var Te=f(d),Di=Object.keys(R).filter(function(MI){return MI!=="key"}),_o=Di.length>0?"{key: someKey, "+Di.join(": ..., ")+": ...}":"{key: someKey}";if(!vn[Te+_o]){var WI=Di.length>0?"{"+Di.join(": ..., ")+": ...}":"{}";W(`A props object containing a "key" prop is being spread into JSX:
|
|
28
28
|
let props = %s;
|
|
29
29
|
<%s {...props} />
|
|
30
30
|
React keys must be passed directly to JSX without using spread:
|
|
@@ -34,7 +34,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
34
34
|
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(i){return i instanceof this?i:new this(i)}static concat(i,...t){const a=new this(i);return t.forEach(o=>a.set(o)),a}static accessor(i){const a=(this[hr]=this[hr]={accessors:{}}).accessors,o=this.prototype;function r(s){const n=qt(s);a[n]||(sA(o,s),a[n]=!0)}return V.isArray(i)?i.forEach(r):r(i),this}}Qt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),V.reduceDescriptors(Qt.prototype,({value:e},i)=>{let t=i[0].toUpperCase()+i.slice(1);return{get:()=>e,set(a){this[t]=a}}}),V.freezeMethods(Qt);const oe=Qt;function Ta(e,i){const t=this||Oa,a=i||t,o=oe.from(a.headers);let r=a.data;return V.forEach(e,function(n){r=n.call(t,r,o.normalize(),i?i.status:void 0)}),o.normalize(),r}function Cr(e){return!!(e&&e.__CANCEL__)}function De(e,i,t){ri.call(this,e??"canceled",ri.ERR_CANCELED,i,t),this.name="CanceledError"}V.inherits(De,ri,{__CANCEL__:!0});function yr(e,i,t){const a=t.config.validateStatus;!t.status||!a||a(t.status)?e(t):i(new ri("Request failed with status code "+t.status,[ri.ERR_BAD_REQUEST,ri.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function nA(e){const i=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return i&&i[1]||""}function lA(e,i){e=e||10;const t=new Array(e),a=new Array(e);let o=0,r=0,s;return i=i!==void 0?i:1e3,function(l){const A=Date.now(),q=a[r];s||(s=A),t[o]=l,a[o]=A;let p=r,u=0;for(;p!==o;)u+=t[p++],p=p%e;if(o=(o+1)%e,o===r&&(r=(r+1)%e),A-s<i)return;const I=q&&A-q;return I?Math.round(u*1e3/I):void 0}}function AA(e,i){let t=0,a=1e3/i,o,r;const s=(A,q=Date.now())=>{t=q,o=null,r&&(clearTimeout(r),r=null),e(...A)};return[(...A)=>{const q=Date.now(),p=q-t;p>=a?s(A,q):(o=A,r||(r=setTimeout(()=>{r=null,s(o)},a-p)))},()=>o&&s(o)]}const jt=(e,i,t=3)=>{let a=0;const o=lA(50,250);return AA(r=>{const s=r.loaded,n=r.lengthComputable?r.total:void 0,l=s-a,A=o(l),q=s<=n;a=s;const p={loaded:s,total:n,progress:n?s/n:void 0,bytes:l,rate:A||void 0,estimated:A&&n&&q?(n-s)/A:void 0,event:r,lengthComputable:n!=null,[i?"download":"upload"]:!0};e(p)},t)},gr=(e,i)=>{const t=e!=null;return[a=>i[0]({lengthComputable:t,total:e,loaded:a}),i[1]]},Vr=e=>(...i)=>V.asap(()=>e(...i)),qA=Li.hasStandardBrowserEnv?((e,i)=>t=>(t=new URL(t,Li.origin),e.protocol===t.protocol&&e.host===t.host&&(i||e.port===t.port)))(new URL(Li.origin),Li.navigator&&/(msie|trident)/i.test(Li.navigator.userAgent)):()=>!0,mA=Li.hasStandardBrowserEnv?{write(e,i,t,a,o,r,s){if(typeof document>"u")return;const n=[`${e}=${encodeURIComponent(i)}`];V.isNumber(t)&&n.push(`expires=${new Date(t).toUTCString()}`),V.isString(a)&&n.push(`path=${a}`),V.isString(o)&&n.push(`domain=${o}`),r===!0&&n.push("secure"),V.isString(s)&&n.push(`SameSite=${s}`),document.cookie=n.join("; ")},read(e){if(typeof document>"u")return null;const i=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return i?decodeURIComponent(i[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function pA(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function uA(e,i){return i?e.replace(/\/?\/$/,"")+"/"+i.replace(/^\/+/,""):e}function Jr(e,i,t){let a=!pA(i);return e&&(a||t==!1)?uA(e,i):i}const kr=e=>e instanceof oe?{...e}:e;function Ye(e,i){i=i||{};const t={};function a(A,q,p,u){return V.isPlainObject(A)&&V.isPlainObject(q)?V.merge.call({caseless:u},A,q):V.isPlainObject(q)?V.merge({},q):V.isArray(q)?q.slice():q}function o(A,q,p,u){if(V.isUndefined(q)){if(!V.isUndefined(A))return a(void 0,A,p,u)}else return a(A,q,p,u)}function r(A,q){if(!V.isUndefined(q))return a(void 0,q)}function s(A,q){if(V.isUndefined(q)){if(!V.isUndefined(A))return a(void 0,A)}else return a(void 0,q)}function n(A,q,p){if(p in i)return a(A,q);if(p in e)return a(void 0,A)}const l={url:r,method:r,data:r,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:n,headers:(A,q,p)=>o(kr(A),kr(q),p,!0)};return V.forEach(Object.keys({...e,...i}),function(q){const p=l[q]||o,u=p(e[q],i[q],q);V.isUndefined(u)&&p!==n||(t[q]=u)}),t}const Wr=e=>{const i=Ye({},e);let{data:t,withXSRFToken:a,xsrfHeaderName:o,xsrfCookieName:r,headers:s,auth:n}=i;if(i.headers=s=oe.from(s),i.url=cr(Jr(i.baseURL,i.url,i.allowAbsoluteUrls),e.params,e.paramsSerializer),n&&s.set("Authorization","Basic "+btoa((n.username||"")+":"+(n.password?unescape(encodeURIComponent(n.password)):""))),V.isFormData(t)){if(Li.hasStandardBrowserEnv||Li.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(V.isFunction(t.getHeaders)){const l=t.getHeaders(),A=["content-type","content-length"];Object.entries(l).forEach(([q,p])=>{A.includes(q.toLowerCase())&&s.set(q,p)})}}if(Li.hasStandardBrowserEnv&&(a&&V.isFunction(a)&&(a=a(i)),a||a!==!1&&qA(i.url))){const l=o&&r&&mA.read(r);l&&s.set(o,l)}return i},IA=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(t,a){const o=Wr(e);let r=o.data;const s=oe.from(o.headers).normalize();let{responseType:n,onUploadProgress:l,onDownloadProgress:A}=o,q,p,u,I,c;function Z(){I&&I(),c&&c(),o.cancelToken&&o.cancelToken.unsubscribe(q),o.signal&&o.signal.removeEventListener("abort",q)}let K=new XMLHttpRequest;K.open(o.method.toUpperCase(),o.url,!0),K.timeout=o.timeout;function S(){if(!K)return;const U=oe.from("getAllResponseHeaders"in K&&K.getAllResponseHeaders()),h={data:!n||n==="text"||n==="json"?K.responseText:K.response,status:K.status,statusText:K.statusText,headers:U,config:e,request:K};yr(function(F){t(F),Z()},function(F){a(F),Z()},h),K=null}"onloadend"in K?K.onloadend=S:K.onreadystatechange=function(){!K||K.readyState!==4||K.status===0&&!(K.responseURL&&K.responseURL.indexOf("file:")===0)||setTimeout(S)},K.onabort=function(){K&&(a(new ri("Request aborted",ri.ECONNABORTED,e,K)),K=null)},K.onerror=function(k){const h=k&&k.message?k.message:"Network Error",b=new ri(h,ri.ERR_NETWORK,e,K);b.event=k||null,a(b),K=null},K.ontimeout=function(){let k=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const h=o.transitional||Zr;o.timeoutErrorMessage&&(k=o.timeoutErrorMessage),a(new ri(k,h.clarifyTimeoutError?ri.ETIMEDOUT:ri.ECONNABORTED,e,K)),K=null},r===void 0&&s.setContentType(null),"setRequestHeader"in K&&V.forEach(s.toJSON(),function(k,h){K.setRequestHeader(h,k)}),V.isUndefined(o.withCredentials)||(K.withCredentials=!!o.withCredentials),n&&n!=="json"&&(K.responseType=o.responseType),A&&([u,c]=jt(A,!0),K.addEventListener("progress",u)),l&&K.upload&&([p,I]=jt(l),K.upload.addEventListener("progress",p),K.upload.addEventListener("loadend",I)),(o.cancelToken||o.signal)&&(q=U=>{K&&(a(!U||U.type?new De(null,e,K):U),K.abort(),K=null)},o.cancelToken&&o.cancelToken.subscribe(q),o.signal&&(o.signal.aborted?q():o.signal.addEventListener("abort",q)));const W=nA(o.url);if(W&&Li.protocols.indexOf(W)===-1){a(new ri("Unsupported protocol "+W+":",ri.ERR_BAD_REQUEST,e));return}K.send(r||null)})},KA=(e,i)=>{const{length:t}=e=e?e.filter(Boolean):[];if(i||t){let a=new AbortController,o;const r=function(A){if(!o){o=!0,n();const q=A instanceof Error?A:this.reason;a.abort(q instanceof ri?q:new De(q instanceof Error?q.message:q))}};let s=i&&setTimeout(()=>{s=null,r(new ri(`timeout ${i} of ms exceeded`,ri.ETIMEDOUT))},i);const n=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach(A=>{A.unsubscribe?A.unsubscribe(r):A.removeEventListener("abort",r)}),e=null)};e.forEach(A=>A.addEventListener("abort",r));const{signal:l}=a;return l.unsubscribe=()=>V.asap(n),l}},cA=function*(e,i){let t=e.byteLength;if(!i||t<i){yield e;return}let a=0,o;for(;a<t;)o=a+i,yield e.slice(a,o),a=o},dA=async function*(e,i){for await(const t of ZA(e))yield*cA(t,i)},ZA=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const i=e.getReader();try{for(;;){const{done:t,value:a}=await i.read();if(t)break;yield a}}finally{await i.cancel()}},Mr=(e,i,t,a)=>{const o=dA(e,i);let r=0,s,n=l=>{s||(s=!0,a&&a(l))};return new ReadableStream({async pull(l){try{const{done:A,value:q}=await o.next();if(A){n(),l.close();return}let p=q.byteLength;if(t){let u=r+=p;t(u)}l.enqueue(new Uint8Array(q))}catch(A){throw n(A),A}},cancel(l){return n(l),o.return()}},{highWaterMark:2})},Er=64*1024,{isFunction:Ft}=V,SA=(({Request:e,Response:i})=>({Request:e,Response:i}))(V.global),{ReadableStream:Rr,TextEncoder:Ur}=V.global,Lr=(e,...i)=>{try{return!!e(...i)}catch{return!1}},hA=e=>{e=V.merge.call({skipUndefined:!0},SA,e);const{fetch:i,Request:t,Response:a}=e,o=i?Ft(i):typeof fetch=="function",r=Ft(t),s=Ft(a);if(!o)return!1;const n=o&&Ft(Rr),l=o&&(typeof Ur=="function"?(c=>Z=>c.encode(Z))(new Ur):async c=>new Uint8Array(await new t(c).arrayBuffer())),A=r&&n&&Lr(()=>{let c=!1;const Z=new t(Li.origin,{body:new Rr,method:"POST",get duplex(){return c=!0,"half"}}).headers.has("Content-Type");return c&&!Z}),q=s&&n&&Lr(()=>V.isReadableStream(new a("").body)),p={stream:q&&(c=>c.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(c=>{!p[c]&&(p[c]=(Z,K)=>{let S=Z&&Z[c];if(S)return S.call(Z);throw new ri(`Response type '${c}' is not supported`,ri.ERR_NOT_SUPPORT,K)})});const u=async c=>{if(c==null)return 0;if(V.isBlob(c))return c.size;if(V.isSpecCompliantForm(c))return(await new t(Li.origin,{method:"POST",body:c}).arrayBuffer()).byteLength;if(V.isArrayBufferView(c)||V.isArrayBuffer(c))return c.byteLength;if(V.isURLSearchParams(c)&&(c=c+""),V.isString(c))return(await l(c)).byteLength},I=async(c,Z)=>{const K=V.toFiniteNumber(c.getContentLength());return K??u(Z)};return async c=>{let{url:Z,method:K,data:S,signal:W,cancelToken:U,timeout:k,onDownloadProgress:h,onUploadProgress:b,responseType:F,headers:N,withCredentials:v="same-origin",fetchOptions:_}=Wr(c),X=i||fetch;F=F?(F+"").toLowerCase():"text";let H=KA([W,U&&U.toAbortSignal()],k),f=null;const g=H&&H.unsubscribe&&(()=>{H.unsubscribe()});let L;try{if(b&&A&&K!=="get"&&K!=="head"&&(L=await I(N,S))!==0){let E=new t(Z,{method:"POST",body:S,duplex:"half"}),O;if(V.isFormData(S)&&(O=E.headers.get("content-type"))&&N.setContentType(O),E.body){const[B,z]=gr(L,jt(Vr(b)));S=Mr(E.body,Er,B,z)}}V.isString(v)||(v=v?"include":"omit");const Y=r&&"credentials"in t.prototype,C={..._,signal:H,method:K.toUpperCase(),headers:N.normalize().toJSON(),body:S,duplex:"half",credentials:Y?v:void 0};f=r&&new t(Z,C);let M=await(r?X(f,_):X(Z,C));const D=q&&(F==="stream"||F==="response");if(q&&(h||D&&g)){const E={};["status","statusText","headers"].forEach(P=>{E[P]=M[P]});const O=V.toFiniteNumber(M.headers.get("content-length")),[B,z]=h&&gr(O,jt(Vr(h),!0))||[];M=new a(Mr(M.body,Er,B,()=>{z&&z(),g&&g()}),E)}F=F||"text";let J=await p[V.findKey(p,F)||"text"](M,c);return!D&&g&&g(),await new Promise((E,O)=>{yr(E,O,{data:J,headers:oe.from(M.headers),status:M.status,statusText:M.statusText,config:c,request:f})})}catch(Y){throw g&&g(),Y&&Y.name==="TypeError"&&/Load failed|fetch/i.test(Y.message)?Object.assign(new ri("Network Error",ri.ERR_NETWORK,c,f),{cause:Y.cause||Y}):ri.from(Y,Y&&Y.code,c,f)}}},CA=new Map,Yr=e=>{let i=e&&e.env||{};const{fetch:t,Request:a,Response:o}=i,r=[a,o,t];let s=r.length,n=s,l,A,q=CA;for(;n--;)l=r[n],A=q.get(l),A===void 0&&q.set(l,A=n?new Map:hA(i)),q=A;return A};Yr();const wa={http:zl,xhr:IA,fetch:{get:Yr}};V.forEach(wa,(e,i)=>{if(e){try{Object.defineProperty(e,"name",{value:i})}catch{}Object.defineProperty(e,"adapterName",{value:i})}});const Gr=e=>`- ${e}`,yA=e=>V.isFunction(e)||e===null||e===!1;function gA(e,i){e=V.isArray(e)?e:[e];const{length:t}=e;let a,o;const r={};for(let s=0;s<t;s++){a=e[s];let n;if(o=a,!yA(a)&&(o=wa[(n=String(a)).toLowerCase()],o===void 0))throw new ri(`Unknown adapter '${n}'`);if(o&&(V.isFunction(o)||(o=o.get(i))))break;r[n||"#"+s]=o}if(!o){const s=Object.entries(r).map(([l,A])=>`adapter ${l} `+(A===!1?"is not supported by the environment":"is not available in the build"));let n=t?s.length>1?`since :
|
|
35
35
|
`+s.map(Gr).join(`
|
|
36
36
|
`):" "+Gr(s[0]):"as no adapter specified";throw new ri("There is no suitable adapter to dispatch the request "+n,"ERR_NOT_SUPPORT")}return o}const br={getAdapter:gA,adapters:wa};function Ba(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new De(null,e)}function Qr(e){return Ba(e),e.headers=oe.from(e.headers),e.data=Ta.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),br.getAdapter(e.adapter||Oa.adapter,e)(e).then(function(a){return Ba(e),a.data=Ta.call(e,e.transformResponse,a),a.headers=oe.from(a.headers),a},function(a){return Cr(a)||(Ba(e),a&&a.response&&(a.response.data=Ta.call(e,e.transformResponse,a.response),a.response.headers=oe.from(a.response.headers))),Promise.reject(a)})}const jr="1.13.2",Nt={};["object","boolean","number","function","string","symbol"].forEach((e,i)=>{Nt[e]=function(a){return typeof a===e||"a"+(i<1?"n ":" ")+e}});const Fr={};Nt.transitional=function(i,t,a){function o(r,s){return"[Axios v"+jr+"] Transitional option '"+r+"'"+s+(a?". "+a:"")}return(r,s,n)=>{if(i===!1)throw new ri(o(s," has been removed"+(t?" in "+t:"")),ri.ERR_DEPRECATED);return t&&!Fr[s]&&(Fr[s]=!0,console.warn(o(s," has been deprecated since v"+t+" and will be removed in the near future"))),i?i(r,s,n):!0}},Nt.spelling=function(i){return(t,a)=>(console.warn(`${a} is likely a misspelling of ${i}`),!0)};function VA(e,i,t){if(typeof e!="object")throw new ri("options must be an object",ri.ERR_BAD_OPTION_VALUE);const a=Object.keys(e);let o=a.length;for(;o-- >0;){const r=a[o],s=i[r];if(s){const n=e[r],l=n===void 0||s(n,r,e);if(l!==!0)throw new ri("option "+r+" must be "+l,ri.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new ri("Unknown option "+r,ri.ERR_BAD_OPTION)}}const xt={assertOptions:VA,validators:Nt},pe=xt.validators;class Ot{constructor(i){this.defaults=i||{},this.interceptors={request:new dr,response:new dr}}async request(i,t){try{return await this._request(i,t)}catch(a){if(a instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;const r=o.stack?o.stack.replace(/^.+\n/,""):"";try{a.stack?r&&!String(a.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(a.stack+=`
|
|
37
|
-
`+r):a.stack=r}catch{}}throw a}}_request(i,t){typeof i=="string"?(t=t||{},t.url=i):t=i||{},t=Ye(this.defaults,t);const{transitional:a,paramsSerializer:o,headers:r}=t;a!==void 0&&xt.assertOptions(a,{silentJSONParsing:pe.transitional(pe.boolean),forcedJSONParsing:pe.transitional(pe.boolean),clarifyTimeoutError:pe.transitional(pe.boolean)},!1),o!=null&&(V.isFunction(o)?t.paramsSerializer={serialize:o}:xt.assertOptions(o,{encode:pe.function,serialize:pe.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),xt.assertOptions(t,{baseUrl:pe.spelling("baseURL"),withXsrfToken:pe.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=r&&V.merge(r.common,r[t.method]);r&&V.forEach(["delete","get","head","post","put","patch","common"],c=>{delete r[c]}),t.headers=oe.concat(s,r);const n=[];let l=!0;this.interceptors.request.forEach(function(Z){typeof Z.runWhen=="function"&&Z.runWhen(t)===!1||(l=l&&Z.synchronous,n.unshift(Z.fulfilled,Z.rejected))});const A=[];this.interceptors.response.forEach(function(Z){A.push(Z.fulfilled,Z.rejected)});let q,p=0,u;if(!l){const c=[Qr.bind(this),void 0];for(c.unshift(...n),c.push(...A),u=c.length,q=Promise.resolve(t);p<u;)q=q.then(c[p++],c[p++]);return q}u=n.length;let I=t;for(;p<u;){const c=n[p++],Z=n[p++];try{I=c(I)}catch(K){Z.call(this,K);break}}try{q=Qr.call(this,I)}catch(c){return Promise.reject(c)}for(p=0,u=A.length;p<u;)q=q.then(A[p++],A[p++]);return q}getUri(i){i=Ye(this.defaults,i);const t=Jr(i.baseURL,i.url,i.allowAbsoluteUrls);return cr(t,i.params,i.paramsSerializer)}}V.forEach(["delete","get","head","options"],function(i){Ot.prototype[i]=function(t,a){return this.request(Ye(a||{},{method:i,url:t,data:(a||{}).data}))}}),V.forEach(["post","put","patch"],function(i){function t(a){return function(r,s,n){return this.request(Ye(n||{},{method:i,headers:a?{"Content-Type":"multipart/form-data"}:{},url:r,data:s}))}}Ot.prototype[i]=t(),Ot.prototype[i+"Form"]=t(!0)});const zt=Ot;class Da{constructor(i){if(typeof i!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(r){t=r});const a=this;this.promise.then(o=>{if(!a._listeners)return;let r=a._listeners.length;for(;r-- >0;)a._listeners[r](o);a._listeners=null}),this.promise.then=o=>{let r;const s=new Promise(n=>{a.subscribe(n),r=n}).then(o);return s.cancel=function(){a.unsubscribe(r)},s},i(function(r,s,n){a.reason||(a.reason=new De(r,s,n),t(a.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(i){if(this.reason){i(this.reason);return}this._listeners?this._listeners.push(i):this._listeners=[i]}unsubscribe(i){if(!this._listeners)return;const t=this._listeners.indexOf(i);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const i=new AbortController,t=a=>{i.abort(a)};return this.subscribe(t),i.signal.unsubscribe=()=>this.unsubscribe(t),i.signal}static source(){let i;return{token:new Da(function(o){i=o}),cancel:i}}}const JA=Da;function kA(e){return function(t){return e.apply(null,t)}}function WA(e){return V.isObject(e)&&e.isAxiosError===!0}const Xa={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(Xa).forEach(([e,i])=>{Xa[i]=e});const MA=Xa;function Nr(e){const i=new zt(e),t=er(zt.prototype.request,i);return V.extend(t,zt.prototype,i,{allOwnKeys:!0}),V.extend(t,i,null,{allOwnKeys:!0}),t.create=function(o){return Nr(Ye(e,o))},t}const
|
|
37
|
+
`+r):a.stack=r}catch{}}throw a}}_request(i,t){typeof i=="string"?(t=t||{},t.url=i):t=i||{},t=Ye(this.defaults,t);const{transitional:a,paramsSerializer:o,headers:r}=t;a!==void 0&&xt.assertOptions(a,{silentJSONParsing:pe.transitional(pe.boolean),forcedJSONParsing:pe.transitional(pe.boolean),clarifyTimeoutError:pe.transitional(pe.boolean)},!1),o!=null&&(V.isFunction(o)?t.paramsSerializer={serialize:o}:xt.assertOptions(o,{encode:pe.function,serialize:pe.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),xt.assertOptions(t,{baseUrl:pe.spelling("baseURL"),withXsrfToken:pe.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=r&&V.merge(r.common,r[t.method]);r&&V.forEach(["delete","get","head","post","put","patch","common"],c=>{delete r[c]}),t.headers=oe.concat(s,r);const n=[];let l=!0;this.interceptors.request.forEach(function(Z){typeof Z.runWhen=="function"&&Z.runWhen(t)===!1||(l=l&&Z.synchronous,n.unshift(Z.fulfilled,Z.rejected))});const A=[];this.interceptors.response.forEach(function(Z){A.push(Z.fulfilled,Z.rejected)});let q,p=0,u;if(!l){const c=[Qr.bind(this),void 0];for(c.unshift(...n),c.push(...A),u=c.length,q=Promise.resolve(t);p<u;)q=q.then(c[p++],c[p++]);return q}u=n.length;let I=t;for(;p<u;){const c=n[p++],Z=n[p++];try{I=c(I)}catch(K){Z.call(this,K);break}}try{q=Qr.call(this,I)}catch(c){return Promise.reject(c)}for(p=0,u=A.length;p<u;)q=q.then(A[p++],A[p++]);return q}getUri(i){i=Ye(this.defaults,i);const t=Jr(i.baseURL,i.url,i.allowAbsoluteUrls);return cr(t,i.params,i.paramsSerializer)}}V.forEach(["delete","get","head","options"],function(i){Ot.prototype[i]=function(t,a){return this.request(Ye(a||{},{method:i,url:t,data:(a||{}).data}))}}),V.forEach(["post","put","patch"],function(i){function t(a){return function(r,s,n){return this.request(Ye(n||{},{method:i,headers:a?{"Content-Type":"multipart/form-data"}:{},url:r,data:s}))}}Ot.prototype[i]=t(),Ot.prototype[i+"Form"]=t(!0)});const zt=Ot;class Da{constructor(i){if(typeof i!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(r){t=r});const a=this;this.promise.then(o=>{if(!a._listeners)return;let r=a._listeners.length;for(;r-- >0;)a._listeners[r](o);a._listeners=null}),this.promise.then=o=>{let r;const s=new Promise(n=>{a.subscribe(n),r=n}).then(o);return s.cancel=function(){a.unsubscribe(r)},s},i(function(r,s,n){a.reason||(a.reason=new De(r,s,n),t(a.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(i){if(this.reason){i(this.reason);return}this._listeners?this._listeners.push(i):this._listeners=[i]}unsubscribe(i){if(!this._listeners)return;const t=this._listeners.indexOf(i);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const i=new AbortController,t=a=>{i.abort(a)};return this.subscribe(t),i.signal.unsubscribe=()=>this.unsubscribe(t),i.signal}static source(){let i;return{token:new Da(function(o){i=o}),cancel:i}}}const JA=Da;function kA(e){return function(t){return e.apply(null,t)}}function WA(e){return V.isObject(e)&&e.isAxiosError===!0}const Xa={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(Xa).forEach(([e,i])=>{Xa[i]=e});const MA=Xa;function Nr(e){const i=new zt(e),t=er(zt.prototype.request,i);return V.extend(t,zt.prototype,i,{allOwnKeys:!0}),V.extend(t,i,null,{allOwnKeys:!0}),t.create=function(o){return Nr(Ye(e,o))},t}const Ji=Nr(Oa);Ji.Axios=zt,Ji.CanceledError=De,Ji.CancelToken=JA,Ji.isCancel=Cr,Ji.VERSION=jr,Ji.toFormData=Gt,Ji.AxiosError=ri,Ji.Cancel=Ji.CanceledError,Ji.all=function(i){return Promise.all(i)},Ji.spread=kA,Ji.isAxiosError=WA,Ji.mergeConfig=Ye,Ji.AxiosHeaders=oe,Ji.formToJSON=e=>Sr(V.isHTMLForm(e)?new FormData(e):e),Ji.getAdapter=br.getAdapter,Ji.HttpStatusCode=MA,Ji.default=Ji;const EA=Ji;/*! typescript-cookie v1.0.6 | MIT */const xr=e=>encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),Or=e=>encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent),fa=decodeURIComponent,va=e=>(e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent));function RA(e){return e=Object.assign({},e),typeof e.expires=="number"&&(e.expires=new Date(Date.now()+e.expires*864e5)),e.expires!=null&&(e.expires=e.expires.toUTCString()),Object.entries(e).filter(([i,t])=>t!=null&&t!==!1).map(([i,t])=>t===!0?`; ${i}`:`; ${i}=${t.split(";")[0]}`).join("")}function zr(e,i,t){const a=/(?:^|; )([^=]*)=([^;]*)/g,o={};let r;for(;(r=a.exec(document.cookie))!=null;)try{const s=t(r[1]);if(o[s]=i(r[2],s),e===s)break}catch{}return e!=null?o[e]:o}const Tr=Object.freeze({decodeName:fa,decodeValue:va,encodeName:xr,encodeValue:Or}),Ha=Object.freeze({path:"/"});function wr(e,i,t=Ha,{encodeValue:a=Or,encodeName:o=xr}={}){return document.cookie=`${o(e)}=${a(i,e)}${RA(t)}`}function Br(e,{decodeValue:i=va,decodeName:t=fa}={}){return zr(e,i,t)}function UA({decodeValue:e=va,decodeName:i=fa}={}){return zr(void 0,e,i)}function LA(e,i=Ha){wr(e,"",Object.assign({},i,{expires:-1}))}function Pa(e,i){const t={set:function(o,r,s){return wr(o,r,Object.assign({},this.attributes,s),{encodeValue:this.converter.write})},get:function(o){if(arguments.length===0)return UA(this.converter.read);if(o!=null)return Br(o,this.converter.read)},remove:function(o,r){LA(o,Object.assign({},this.attributes,r))},withAttributes:function(o){return Pa(this.converter,Object.assign({},this.attributes,o))},withConverter:function(o){return Pa(Object.assign({},this.converter,o),this.attributes)}},a={attributes:{value:Object.freeze(i)},converter:{value:Object.freeze(e)}};return Object.create(t,a)}Pa({read:Tr.decodeValue,write:Tr.encodeValue},Ha);let Dr;typeof window<"u"&&(Dr=Br("token"));const Ki=EA.create({headers:{Authorization:`${Dr}`}});async function _a(e,i,t){return(await Ki.post(t+"/updatePlayableVersion",{...i,_id:e})).data}let Xr=null;const YA=({name:e,versionId:i,api:t,onNameChange:a})=>{const[o,r]=y.useState(e),[s,n]=y.useState(!1),l=y.useRef(e),A=window.innerWidth<768,q=window.innerWidth>=768&&window.innerWidth<1440,p=e!=="Flex";y.useEffect(()=>{r(e),l.current=e},[e]);const u=S=>{clearTimeout(Xr),Xr=setTimeout(()=>{i&&t&&S!==l.current&&_a(i,{name:S},t).then(()=>{l.current=S,console.log("Version name updated successfully"),a&&a(i,S)}).catch(W=>{console.error("Error updating version name:",W)})},1e3)},I=()=>{n(!0)},c=S=>{const W=S.target.value;r(W),u(W)},Z=()=>{n(!1)},K=S=>{S.key==="Enter"&&n(!1)};return m.jsx("div",{style:{textAlign:"center",marginTop:A?"0.5rem":q?"0.25rem":"0",marginBottom:A?p?"0.75rem":"0.5rem":q?p?"0.5rem":"0.25rem":p?"1.25rem":"1rem"},children:s?m.jsx("input",{type:"text",value:o,onChange:c,onBlur:Z,onKeyDown:K,autoFocus:!0,placeholder:"Name your playable...",style:{fontWeight:"600",fontSize:A?"0.75rem":"0.875rem",color:"#111827",textAlign:"center",width:"100%",paddingLeft:"0.5rem",paddingRight:"0.5rem",paddingTop:"0.25rem",paddingBottom:"0.25rem",border:"1px solid #3B82F6",borderRadius:"0.25rem",outline:"none",minHeight:A?"1.75rem":"2rem"},onFocus:S=>{S.currentTarget.style.boxShadow="0 0 0 2px rgba(59, 130, 246, 0.5)"},onBlurCapture:S=>{S.currentTarget.style.boxShadow="none"}}):m.jsx("h3",{onClick:I,style:{fontWeight:o?"600":"400",fontSize:A?"0.75rem":"0.875rem",cursor:"pointer",paddingLeft:"0.5rem",paddingRight:"0.5rem",paddingTop:"0.25rem",paddingBottom:"0.25rem",borderRadius:"0.25rem",transition:"background-color 0.2s ease",minHeight:A?"1.75rem":"2rem",display:"flex",alignItems:"center",justifyContent:"center",color:o?"#111827":"#9CA3AF",border:"1.5px dashed #D1D5DB",margin:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%",width:"100%"},onMouseEnter:S=>{S.currentTarget.style.backgroundColor="#F3F4F6"},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="transparent"},children:o.length>20?o.slice(0,20)+"...":o})})};var Tt={},$a={exports:{}},wt={exports:{}},ci={};/** @license React v16.13.1
|
|
38
38
|
* react-is.production.min.js
|
|
39
39
|
*
|
|
40
40
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -84,12 +84,12 @@ doc.body (`+e+`):
|
|
|
84
84
|
`+o:"")+`
|
|
85
85
|
|
|
86
86
|
The above lifecycles should be removed. Learn more about this warning here:
|
|
87
|
-
https://fb.me/react-async-component-lifecycle-hooks`)}if(typeof e.getDerivedStateFromProps=="function"&&(i.componentWillMount=tn,i.componentWillReceiveProps=an),typeof i.getSnapshotBeforeUpdate=="function"){if(typeof i.componentDidUpdate!="function")throw new Error("Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype");i.componentWillUpdate=on;var n=i.componentDidUpdate;i.componentDidUpdate=function(A,q,p){var u=this.__reactInternalSnapshotFlag?this.__reactInternalSnapshot:p;n.call(this,A,q,u)}}return e}const Sp=$n(Object.freeze(Object.defineProperty({__proto__:null,polyfill:Zp},Symbol.toStringTag,{value:"Module"})));Object.defineProperty(be,"__esModule",{value:!0}),be.bodyOpenClassName=be.portalClassName=void 0;var rn=Object.assign||function(e){for(var i=1;i<arguments.length;i++){var t=arguments[i];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},hp=function(){function e(i,t){for(var a=0;a<t.length;a++){var o=t[a];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(i,o.key,o)}}return function(i,t,a){return t&&e(i.prototype,t),a&&e(i,a),i}}(),sn=y,qa=ht(sn),Cp=Pn,ma=ht(Cp),yp=Bt,ai=ht(yp),gp=dp,nn=ht(gp),Vp=ne,Jp=Wp(Vp),Me=le,ln=ht(Me),kp=Sp;function Wp(e){if(e&&e.__esModule)return e;var i={};if(e!=null)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(i[t]=e[t]);return i.default=e,i}function ht(e){return e&&e.__esModule?e:{default:e}}function Mp(e,i){if(!(e instanceof i))throw new TypeError("Cannot call a class as a function")}function An(e,i){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i&&(typeof i=="object"||typeof i=="function")?i:e}function Ep(e,i){if(typeof i!="function"&&i!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof i);e.prototype=Object.create(i&&i.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),i&&(Object.setPrototypeOf?Object.setPrototypeOf(e,i):e.__proto__=i)}var Rp=be.portalClassName="ReactModalPortal",Up=be.bodyOpenClassName="ReactModal__Body--open",xe=Me.canUseDOM&&ma.default.createPortal!==void 0,ko=function(i){return document.createElement(i)},qn=function(){return xe?ma.default.createPortal:ma.default.unstable_renderSubtreeIntoContainer};function pa(e){return e()}var et=function(e){Ep(i,e);function i(){var t,a,o,r;Mp(this,i);for(var s=arguments.length,n=Array(s),l=0;l<s;l++)n[l]=arguments[l];return r=(a=(o=An(this,(t=i.__proto__||Object.getPrototypeOf(i)).call.apply(t,[this].concat(n))),o),o.removePortal=function(){!xe&&ma.default.unmountComponentAtNode(o.node);var A=pa(o.props.parentSelector);A&&A.contains(o.node)?A.removeChild(o.node):console.warn('React-Modal: "parentSelector" prop did not returned any DOM element. Make sure that the parent element is unmounted to avoid any memory leaks.')},o.portalRef=function(A){o.portal=A},o.renderPortal=function(A){var q=qn(),p=q(o,qa.default.createElement(nn.default,rn({defaultStyles:i.defaultStyles},A)),o.node);o.portalRef(p)},a),An(o,r)}return hp(i,[{key:"componentDidMount",value:function(){if(Me.canUseDOM){xe||(this.node=ko("div")),this.node.className=this.props.portalClassName;var a=pa(this.props.parentSelector);a.appendChild(this.node),!xe&&this.renderPortal(this.props)}}},{key:"getSnapshotBeforeUpdate",value:function(a){var o=pa(a.parentSelector),r=pa(this.props.parentSelector);return{prevParent:o,nextParent:r}}},{key:"componentDidUpdate",value:function(a,o,r){if(Me.canUseDOM){var s=this.props,n=s.isOpen,l=s.portalClassName;a.portalClassName!==l&&(this.node.className=l);var A=r.prevParent,q=r.nextParent;q!==A&&(A.removeChild(this.node),q.appendChild(this.node)),!(!a.isOpen&&!n)&&!xe&&this.renderPortal(this.props)}}},{key:"componentWillUnmount",value:function(){if(!(!Me.canUseDOM||!this.node||!this.portal)){var a=this.portal.state,o=Date.now(),r=a.isOpen&&this.props.closeTimeoutMS&&(a.closesAt||o+this.props.closeTimeoutMS);r?(a.beforeClose||this.portal.closeWithTimeout(),setTimeout(this.removePortal,r-o)):this.removePortal()}}},{key:"render",value:function(){if(!Me.canUseDOM||!xe)return null;!this.node&&xe&&(this.node=ko("div"));var a=qn();return a(qa.default.createElement(nn.default,rn({ref:this.portalRef,defaultStyles:i.defaultStyles},this.props)),this.node)}}],[{key:"setAppElement",value:function(a){Jp.setElement(a)}}]),i}(sn.Component);et.propTypes={isOpen:ai.default.bool.isRequired,style:ai.default.shape({content:ai.default.object,overlay:ai.default.object}),portalClassName:ai.default.string,bodyOpenClassName:ai.default.string,htmlOpenClassName:ai.default.string,className:ai.default.oneOfType([ai.default.string,ai.default.shape({base:ai.default.string.isRequired,afterOpen:ai.default.string.isRequired,beforeClose:ai.default.string.isRequired})]),overlayClassName:ai.default.oneOfType([ai.default.string,ai.default.shape({base:ai.default.string.isRequired,afterOpen:ai.default.string.isRequired,beforeClose:ai.default.string.isRequired})]),appElement:ai.default.oneOfType([ai.default.instanceOf(ln.default),ai.default.instanceOf(Me.SafeHTMLCollection),ai.default.instanceOf(Me.SafeNodeList),ai.default.arrayOf(ai.default.instanceOf(ln.default))]),onAfterOpen:ai.default.func,onRequestClose:ai.default.func,closeTimeoutMS:ai.default.number,ariaHideApp:ai.default.bool,shouldFocusAfterRender:ai.default.bool,shouldCloseOnOverlayClick:ai.default.bool,shouldReturnFocusAfterClose:ai.default.bool,preventScroll:ai.default.bool,parentSelector:ai.default.func,aria:ai.default.object,data:ai.default.object,role:ai.default.string,contentLabel:ai.default.string,shouldCloseOnEsc:ai.default.bool,overlayRef:ai.default.func,contentRef:ai.default.func,id:ai.default.string,overlayElement:ai.default.func,contentElement:ai.default.func},et.defaultProps={isOpen:!1,portalClassName:Rp,bodyOpenClassName:Up,role:"dialog",ariaHideApp:!0,closeTimeoutMS:0,shouldFocusAfterRender:!0,shouldCloseOnEsc:!0,shouldCloseOnOverlayClick:!0,shouldReturnFocusAfterClose:!0,preventScroll:!1,parentSelector:function(){return document.body},overlayElement:function(i,t){return qa.default.createElement("div",i,t)},contentElement:function(i,t){return qa.default.createElement("div",i,t)}},et.defaultStyles={overlay:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(255, 255, 255, 0.75)"},content:{position:"absolute",top:"40px",left:"40px",right:"40px",bottom:"40px",border:"1px solid #ccc",background:"#fff",overflow:"auto",WebkitOverflowScrolling:"touch",borderRadius:"4px",outline:"none",padding:"20px"}},(0,kp.polyfill)(et),process.env.NODE_ENV!=="production"&&(et.setCreateHTMLElement=function(e){return ko=e}),be.default=et,function(e,i){Object.defineProperty(i,"__esModule",{value:!0});var t=be,a=o(t);function o(r){return r&&r.__esModule?r:{default:r}}i.default=a.default,e.exports=i.default}(So,So.exports);var Lp=So.exports;const ua=_n(Lp);async function mn(e,i){return(await Ki.post(`${i}/getCompanyAllSubs`,{customer:e})).data}async function Yp(e,i,t,a){return(await Ki.post(a+"/updateSub",{sub:e,updates:i,product:t})).data}function pn(e){var i,t,a="";if(typeof e=="string"||typeof e=="number")a+=e;else if(typeof e=="object")if(Array.isArray(e))for(i=0;i<e.length;i++)e[i]&&(t=pn(e[i]))&&(a&&(a+=" "),a+=t);else for(i in e)e[i]&&(a&&(a+=" "),a+=i);return a}function Ee(){for(var e,i,t=0,a="";t<arguments.length;)(e=arguments[t++])&&(i=pn(e))&&(a&&(a+=" "),a+=i);return a}const Ct=e=>typeof e=="number"&&!isNaN(e),Oe=e=>typeof e=="string",Ti=e=>typeof e=="function",Ia=e=>Oe(e)||Ti(e)?e:null,Wo=e=>y.isValidElement(e)||Oe(e)||Ti(e)||Ct(e);function Gp(e,i,t){t===void 0&&(t=300);const{scrollHeight:a,style:o}=e;requestAnimationFrame(()=>{o.minHeight="initial",o.height=a+"px",o.transition=`all ${t}ms`,requestAnimationFrame(()=>{o.height="0",o.padding="0",o.margin="0",setTimeout(i,t)})})}function Ka(e){let{enter:i,exit:t,appendPosition:a=!1,collapse:o=!0,collapseDuration:r=300}=e;return function(s){let{children:n,position:l,preventExitTransition:A,done:q,nodeRef:p,isIn:u}=s;const I=a?`${i}--${l}`:i,c=a?`${t}--${l}`:t,Z=y.useRef(0);return y.useLayoutEffect(()=>{const K=p.current,S=I.split(" "),W=U=>{U.target===p.current&&(K.dispatchEvent(new Event("d")),K.removeEventListener("animationend",W),K.removeEventListener("animationcancel",W),Z.current===0&&U.type!=="animationcancel"&&K.classList.remove(...S))};K.classList.add(...S),K.addEventListener("animationend",W),K.addEventListener("animationcancel",W)},[]),y.useEffect(()=>{const K=p.current,S=()=>{K.removeEventListener("animationend",S),o?Gp(K,q,r):q()};u||(A?S():(Z.current=1,K.className+=` ${c}`,K.addEventListener("animationend",S)))},[u]),y.createElement(y.Fragment,null,n)}}function un(e,i){return e!=null?{content:e.content,containerId:e.props.containerId,id:e.props.toastId,theme:e.props.theme,type:e.props.type,data:e.props.data||{},isLoading:e.props.isLoading,icon:e.props.icon,status:i}:{}}const Pi={list:new Map,emitQueue:new Map,on(e,i){return this.list.has(e)||this.list.set(e,[]),this.list.get(e).push(i),this},off(e,i){if(i){const t=this.list.get(e).filter(a=>a!==i);return this.list.set(e,t),this}return this.list.delete(e),this},cancelEmit(e){const i=this.emitQueue.get(e);return i&&(i.forEach(clearTimeout),this.emitQueue.delete(e)),this},emit(e){this.list.has(e)&&this.list.get(e).forEach(i=>{const t=setTimeout(()=>{i(...[].slice.call(arguments,1))},0);this.emitQueue.has(e)||this.emitQueue.set(e,[]),this.emitQueue.get(e).push(t)})}},ca=e=>{let{theme:i,type:t,...a}=e;return y.createElement("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:i==="colored"?"currentColor":`var(--toastify-icon-color-${t})`,...a})},Mo={info:function(e){return y.createElement(ca,{...e},y.createElement("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))},warning:function(e){return y.createElement(ca,{...e},y.createElement("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))},success:function(e){return y.createElement(ca,{...e},y.createElement("path",{d:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}))},error:function(e){return y.createElement(ca,{...e},y.createElement("path",{d:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}))},spinner:function(){return y.createElement("div",{className:"Toastify__spinner"})}};function bp(e){const[,i]=y.useReducer(I=>I+1,0),[t,a]=y.useState([]),o=y.useRef(null),r=y.useRef(new Map).current,s=I=>t.indexOf(I)!==-1,n=y.useRef({toastKey:1,displayedToast:0,count:0,queue:[],props:e,containerId:null,isToastActive:s,getToast:I=>r.get(I)}).current;function l(I){let{containerId:c}=I;const{limit:Z}=n.props;!Z||c&&n.containerId!==c||(n.count-=n.queue.length,n.queue=[])}function A(I){a(c=>I==null?[]:c.filter(Z=>Z!==I))}function q(){const{toastContent:I,toastProps:c,staleId:Z}=n.queue.shift();u(I,c,Z)}function p(I,c){let{delay:Z,staleId:K,...S}=c;if(!Wo(I)||function(H){return!o.current||n.props.enableMultiContainer&&H.containerId!==n.props.containerId||r.has(H.toastId)&&H.updateId==null}(S))return;const{toastId:W,updateId:U,data:k}=S,{props:h}=n,b=()=>A(W),F=U==null;F&&n.count++;const N={...h,style:h.toastStyle,key:n.toastKey++,...Object.fromEntries(Object.entries(S).filter(H=>{let[f,g]=H;return g!=null})),toastId:W,updateId:U,data:k,closeToast:b,isIn:!1,className:Ia(S.className||h.toastClassName),bodyClassName:Ia(S.bodyClassName||h.bodyClassName),progressClassName:Ia(S.progressClassName||h.progressClassName),autoClose:!S.isLoading&&(v=S.autoClose,_=h.autoClose,v===!1||Ct(v)&&v>0?v:_),deleteToast(){const H=un(r.get(W),"removed");r.delete(W),Pi.emit(4,H);const f=n.queue.length;if(n.count=W==null?n.count-n.displayedToast:n.count-1,n.count<0&&(n.count=0),f>0){const g=W==null?n.props.limit:1;if(f===1||g===1)n.displayedToast++,q();else{const L=g>f?f:g;n.displayedToast=L;for(let Y=0;Y<L;Y++)q()}}else i()}};var v,_;N.iconOut=function(H){let{theme:f,type:g,isLoading:L,icon:Y}=H,C=null;const M={theme:f,type:g};return Y===!1||(Ti(Y)?C=Y(M):y.isValidElement(Y)?C=y.cloneElement(Y,M):Oe(Y)||Ct(Y)?C=Y:L?C=Mo.spinner():(D=>D in Mo)(g)&&(C=Mo[g](M))),C}(N),Ti(S.onOpen)&&(N.onOpen=S.onOpen),Ti(S.onClose)&&(N.onClose=S.onClose),N.closeButton=h.closeButton,S.closeButton===!1||Wo(S.closeButton)?N.closeButton=S.closeButton:S.closeButton===!0&&(N.closeButton=!Wo(h.closeButton)||h.closeButton);let X=I;y.isValidElement(I)&&!Oe(I.type)?X=y.cloneElement(I,{closeToast:b,toastProps:N,data:k}):Ti(I)&&(X=I({closeToast:b,toastProps:N,data:k})),h.limit&&h.limit>0&&n.count>h.limit&&F?n.queue.push({toastContent:X,toastProps:N,staleId:K}):Ct(Z)?setTimeout(()=>{u(X,N,K)},Z):u(X,N,K)}function u(I,c,Z){const{toastId:K}=c;Z&&r.delete(Z);const S={content:I,props:c};r.set(K,S),a(W=>[...W,K].filter(U=>U!==Z)),Pi.emit(4,un(S,S.props.updateId==null?"added":"updated"))}return y.useEffect(()=>(n.containerId=e.containerId,Pi.cancelEmit(3).on(0,p).on(1,I=>o.current&&A(I)).on(5,l).emit(2,n),()=>{r.clear(),Pi.emit(3,n)}),[]),y.useEffect(()=>{n.props=e,n.isToastActive=s,n.displayedToast=t.length}),{getToastToRender:function(I){const c=new Map,Z=Array.from(r.values());return e.newestOnTop&&Z.reverse(),Z.forEach(K=>{const{position:S}=K.props;c.has(S)||c.set(S,[]),c.get(S).push(K)}),Array.from(c,K=>I(K[0],K[1]))},containerRef:o,isToastActive:s}}function In(e){return e.targetTouches&&e.targetTouches.length>=1?e.targetTouches[0].clientX:e.clientX}function Kn(e){return e.targetTouches&&e.targetTouches.length>=1?e.targetTouches[0].clientY:e.clientY}function Qp(e){const[i,t]=y.useState(!1),[a,o]=y.useState(!1),r=y.useRef(null),s=y.useRef({start:0,x:0,y:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,boundingRect:null,didMove:!1}).current,n=y.useRef(e),{autoClose:l,pauseOnHover:A,closeToast:q,onClick:p,closeOnClick:u}=e;function I(k){if(e.draggable){k.nativeEvent.type==="touchstart"&&k.nativeEvent.preventDefault(),s.didMove=!1,document.addEventListener("mousemove",S),document.addEventListener("mouseup",W),document.addEventListener("touchmove",S),document.addEventListener("touchend",W);const h=r.current;s.canCloseOnClick=!0,s.canDrag=!0,s.boundingRect=h.getBoundingClientRect(),h.style.transition="",s.x=In(k.nativeEvent),s.y=Kn(k.nativeEvent),e.draggableDirection==="x"?(s.start=s.x,s.removalDistance=h.offsetWidth*(e.draggablePercent/100)):(s.start=s.y,s.removalDistance=h.offsetHeight*(e.draggablePercent===80?1.5*e.draggablePercent:e.draggablePercent/100))}}function c(k){if(s.boundingRect){const{top:h,bottom:b,left:F,right:N}=s.boundingRect;k.nativeEvent.type!=="touchend"&&e.pauseOnHover&&s.x>=F&&s.x<=N&&s.y>=h&&s.y<=b?K():Z()}}function Z(){t(!0)}function K(){t(!1)}function S(k){const h=r.current;s.canDrag&&h&&(s.didMove=!0,i&&K(),s.x=In(k),s.y=Kn(k),s.delta=e.draggableDirection==="x"?s.x-s.start:s.y-s.start,s.start!==s.x&&(s.canCloseOnClick=!1),h.style.transform=`translate${e.draggableDirection}(${s.delta}px)`,h.style.opacity=""+(1-Math.abs(s.delta/s.removalDistance)))}function W(){document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",W),document.removeEventListener("touchmove",S),document.removeEventListener("touchend",W);const k=r.current;if(s.canDrag&&s.didMove&&k){if(s.canDrag=!1,Math.abs(s.delta)>s.removalDistance)return o(!0),void e.closeToast();k.style.transition="transform 0.2s, opacity 0.2s",k.style.transform=`translate${e.draggableDirection}(0)`,k.style.opacity="1"}}y.useEffect(()=>{n.current=e}),y.useEffect(()=>(r.current&&r.current.addEventListener("d",Z,{once:!0}),Ti(e.onOpen)&&e.onOpen(y.isValidElement(e.children)&&e.children.props),()=>{const k=n.current;Ti(k.onClose)&&k.onClose(y.isValidElement(k.children)&&k.children.props)}),[]),y.useEffect(()=>(e.pauseOnFocusLoss&&(document.hasFocus()||K(),window.addEventListener("focus",Z),window.addEventListener("blur",K)),()=>{e.pauseOnFocusLoss&&(window.removeEventListener("focus",Z),window.removeEventListener("blur",K))}),[e.pauseOnFocusLoss]);const U={onMouseDown:I,onTouchStart:I,onMouseUp:c,onTouchEnd:c};return l&&A&&(U.onMouseEnter=K,U.onMouseLeave=Z),u&&(U.onClick=k=>{p&&p(k),s.canCloseOnClick&&q()}),{playToast:Z,pauseToast:K,isRunning:i,preventExitTransition:a,toastRef:r,eventHandlers:U}}function cn(e){let{closeToast:i,theme:t,ariaLabel:a="close"}=e;return y.createElement("button",{className:`Toastify__close-button Toastify__close-button--${t}`,type:"button",onClick:o=>{o.stopPropagation(),i(o)},"aria-label":a},y.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},y.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})))}function jp(e){let{delay:i,isRunning:t,closeToast:a,type:o="default",hide:r,className:s,style:n,controlledProgress:l,progress:A,rtl:q,isIn:p,theme:u}=e;const I=r||l&&A===0,c={...n,animationDuration:`${i}ms`,animationPlayState:t?"running":"paused",opacity:I?0:1};l&&(c.transform=`scaleX(${A})`);const Z=Ee("Toastify__progress-bar",l?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated",`Toastify__progress-bar-theme--${u}`,`Toastify__progress-bar--${o}`,{"Toastify__progress-bar--rtl":q}),K=Ti(s)?s({rtl:q,type:o,defaultClassName:Z}):Ee(Z,s);return y.createElement("div",{role:"progressbar","aria-hidden":I?"true":"false","aria-label":"notification timer",className:K,style:c,[l&&A>=1?"onTransitionEnd":"onAnimationEnd"]:l&&A<1?null:()=>{p&&a()}})}const Fp=e=>{const{isRunning:i,preventExitTransition:t,toastRef:a,eventHandlers:o}=Qp(e),{closeButton:r,children:s,autoClose:n,onClick:l,type:A,hideProgressBar:q,closeToast:p,transition:u,position:I,className:c,style:Z,bodyClassName:K,bodyStyle:S,progressClassName:W,progressStyle:U,updateId:k,role:h,progress:b,rtl:F,toastId:N,deleteToast:v,isIn:_,isLoading:X,iconOut:H,closeOnClick:f,theme:g}=e,L=Ee("Toastify__toast",`Toastify__toast-theme--${g}`,`Toastify__toast--${A}`,{"Toastify__toast--rtl":F},{"Toastify__toast--close-on-click":f}),Y=Ti(c)?c({rtl:F,position:I,type:A,defaultClassName:L}):Ee(L,c),C=!!b||!n,M={closeToast:p,type:A,theme:g};let D=null;return r===!1||(D=Ti(r)?r(M):y.isValidElement(r)?y.cloneElement(r,M):cn(M)),y.createElement(u,{isIn:_,done:v,position:I,preventExitTransition:t,nodeRef:a},y.createElement("div",{id:N,onClick:l,className:Y,...o,style:Z,ref:a},y.createElement("div",{..._&&{role:h},className:Ti(K)?K({type:A}):Ee("Toastify__toast-body",K),style:S},H!=null&&y.createElement("div",{className:Ee("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!X})},H),y.createElement("div",null,s)),D,y.createElement(jp,{...k&&!C?{key:`pb-${k}`}:{},rtl:F,theme:g,delay:n,isRunning:i,isIn:_,closeToast:p,hide:q,type:A,style:U,className:W,controlledProgress:C,progress:b||0})))},da=function(e,i){return i===void 0&&(i=!1),{enter:`Toastify--animate Toastify__${e}-enter`,exit:`Toastify--animate Toastify__${e}-exit`,appendPosition:i}},Np=Ka(da("bounce",!0));Ka(da("slide",!0)),Ka(da("zoom")),Ka(da("flip"));const Eo=y.forwardRef((e,i)=>{const{getToastToRender:t,containerRef:a,isToastActive:o}=bp(e),{className:r,style:s,rtl:n,containerId:l}=e;function A(q){const p=Ee("Toastify__toast-container",`Toastify__toast-container--${q}`,{"Toastify__toast-container--rtl":n});return Ti(r)?r({position:q,rtl:n,defaultClassName:p}):Ee(p,Ia(r))}return y.useEffect(()=>{i&&(i.current=a.current)},[]),y.createElement("div",{ref:a,className:"Toastify",id:l},t((q,p)=>{const u=p.length?{...s}:{...s,pointerEvents:"none"};return y.createElement("div",{className:A(q),style:u,key:`container-${q}`},p.map((I,c)=>{let{content:Z,props:K}=I;return y.createElement(Fp,{...K,isIn:o(K.toastId),style:{...K.style,"--nth":c+1,"--len":p.length},key:`toast-${K.key}`},Z)}))}))});Eo.displayName="ToastContainer",Eo.defaultProps={position:"top-right",transition:Np,autoClose:5e3,closeButton:cn,pauseOnHover:!0,pauseOnFocusLoss:!0,closeOnClick:!0,draggable:!0,draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light"};let Ro,ze=new Map,yt=[],xp=1;function dn(){return""+xp++}function Op(e){return e&&(Oe(e.toastId)||Ct(e.toastId))?e.toastId:dn()}function gt(e,i){return ze.size>0?Pi.emit(0,e,i):yt.push({content:e,options:i}),i.toastId}function Za(e,i){return{...i,type:i&&i.type||e,toastId:Op(i)}}function Sa(e){return(i,t)=>gt(i,Za(e,t))}function hi(e,i){return gt(e,Za("default",i))}hi.loading=(e,i)=>gt(e,Za("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...i})),hi.promise=function(e,i,t){let a,{pending:o,error:r,success:s}=i;o&&(a=Oe(o)?hi.loading(o,t):hi.loading(o.render,{...t,...o}));const n={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},l=(q,p,u)=>{if(p==null)return void hi.dismiss(a);const I={type:q,...n,...t,data:u},c=Oe(p)?{render:p}:p;return a?hi.update(a,{...I,...c}):hi(c.render,{...I,...c}),u},A=Ti(e)?e():e;return A.then(q=>l("success",s,q)).catch(q=>l("error",r,q)),A},hi.success=Sa("success"),hi.info=Sa("info"),hi.error=Sa("error"),hi.warning=Sa("warning"),hi.warn=hi.warning,hi.dark=(e,i)=>gt(e,Za("default",{theme:"dark",...i})),hi.dismiss=e=>{ze.size>0?Pi.emit(1,e):yt=yt.filter(i=>e!=null&&i.options.toastId!==e)},hi.clearWaitingQueue=function(e){return e===void 0&&(e={}),Pi.emit(5,e)},hi.isActive=e=>{let i=!1;return ze.forEach(t=>{t.isToastActive&&t.isToastActive(e)&&(i=!0)}),i},hi.update=function(e,i){i===void 0&&(i={}),setTimeout(()=>{const t=function(a,o){let{containerId:r}=o;const s=ze.get(r||Ro);return s&&s.getToast(a)}(e,i);if(t){const{props:a,content:o}=t,r={delay:100,...a,...i,toastId:i.toastId||e,updateId:dn()};r.toastId!==e&&(r.staleId=e);const s=r.render||o;delete r.render,gt(s,r)}},0)},hi.done=e=>{hi.update(e,{progress:1})},hi.onChange=e=>(Pi.on(4,e),()=>{Pi.off(4,e)}),hi.POSITION={TOP_LEFT:"top-left",TOP_RIGHT:"top-right",TOP_CENTER:"top-center",BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",BOTTOM_CENTER:"bottom-center"},hi.TYPE={INFO:"info",SUCCESS:"success",WARNING:"warning",ERROR:"error",DEFAULT:"default"},Pi.on(2,e=>{Ro=e.containerId||e,ze.set(Ro,e),yt.forEach(i=>{Pi.emit(0,i.content,i.options)}),yt=[]}).on(3,e=>{ze.delete(e.containerId||e),ze.size===0&&Pi.off(0).off(1).off(5)});function ha(e){hi.error(e,{position:"top-center",autoClose:650,hideProgressBar:!0,closeOnClick:!0,pauseOnHover:!0,draggable:!0,progress:void 0,theme:"light"})}function Zn(e){hi.success(e,{position:"top-center",autoClose:650,hideProgressBar:!0,closeOnClick:!0,pauseOnHover:!0,draggable:!0,progress:void 0,theme:"light"})}async function Sn(e,i,t){return(await Ki.post(e+"/getNetworks",{typeOfProduct:i,versionId:t})).data}async function zp(e){return(await Ki.post(e+"/getNetworks",{allNetworks:!0})).data}const Uo="#f97316",hn="#ea580c",Lo="#AD1BFF",Cn="#9200e7",Yo="#2563eb",yn="#0031FF";var qi=(e=>(e[e.Flex=Lo]="Flex",e[e.Playable=Uo]="Playable",e.Import="#00a3ff",e[e.Ready=Yo]="Ready",e.Fusion="#171717",e))(qi||{}),Vt=(e=>(e[e.Flex=Cn]="Flex",e[e.Ready=yn]="Ready",e[e.Playable=hn]="Playable",e.Import="#0082CC",e.Fusion="#0A0A0A",e))(Vt||{}),Tp=(e=>(e[e.Flex=`bg-[${Lo}]`]="Flex",e[e.Playable=`bg-[${Uo}]`]="Playable",e.Import="bg-[#00a3ff]",e[e.Ready=`bg-[${Yo}]`]="Ready",e.Fusion="bg-[#171717]",e))(Tp||{}),gn=(e=>(e.Fusion="linear-gradient(to right, #651FFF, #5018CC)",e[e.Ready=`linear-gradient(to right, ${Yo}, ${yn})`]="Ready",e[e.Playable=`linear-gradient(to right, ${Uo}, ${hn})`]="Playable",e[e.Flex=`linear-gradient(to right, ${Lo}, ${Cn})`]="Flex",e))(gn||{});const wp={applovin:"Mobile marketing platform for user acquisition",unity:"Unity Ads monetization platform",mobvista:"AI-powered mobile advertising platform",ironsource:"Mobile monetization and marketing platform",moloco:"Machine learning-powered performance marketing",vungle:"In-app video ad platform",facebook:"Facebook Audience Network",google:"Google Ads platform",liftoff:"Mobile app marketing and retargeting",tencent:"Tencent advertising platform",aarki:"Mobile advertising platform",adform:"Digital advertising platform"},Bp=({visible:e,onClose:i,api:t,user:a,typeOfProduct:o,versionId:r,customerId:s})=>{const[n,l]=y.useState([]),[A,q]=y.useState([]),[p,u]=y.useState(!1),[I,c]=y.useState(!1),[Z,K]=y.useState(null),[S,W]=ji(na),U=()=>qi[o]||qi.Playable,k=()=>Vt[o]||"red",h=()=>({Ready:"#E0F2FE",Playable:"#FFF7ED",Import:"#E0F2FE",Flex:"#F3E8FF",Fusion:"#F5F5F5"})[o]||"#FFF7ED",b=U(),F=k(),N=h();y.useEffect(()=>{e&&v()},[e]);const v=async()=>{u(!0);try{const g=await mn(s,t);let L=[];o==="Playable"?L=g.playableSubs||[]:o==="Ready"?L=g.readySubs||[]:o==="Flex"&&(L=g.flexSubs||[]);const Y=L.find(C=>C.isActive&&new Date(C.endsAt)>new Date);if(Y){K(Y),l(Array.isArray(Y.networks)?Y.networks:[]);const M=(await zp(t)).filter(D=>D.name!=="web"&&D.name!=="cdn"&&D.name!=="default").map(D=>({id:D.id,name:D.name,imageSrc:D.imageSrc,description:wp[D.name]||""}));q(M)}}catch(g){console.error("Error fetching subscription data:",g),ha("Failed to load subscription data")}finally{u(!1)}},_=g=>{l(L=>L.includes(g)?L.filter(Y=>Y!==g):[...L,g])},X=()=>{l(A.map(g=>g.id))},H=()=>{l([])},f=async()=>{if(!Z){ha("No active subscription found");return}c(!0);try{let g="playable";o==="Ready"?g="ready":o==="Flex"&&(g="flex"),await Yp(Z,{downloadLimit:Z.downloadLimit,seatLimit:Z.seatLimit,endsAt:Z.endsAt,isUnlimited:Z.isUnlimited,packageId:Z.packageId,networks:n},g,t);const L=await Sn(t,o,r);if(L){const Y=L.map(C=>(C.name=C.id,C));W(Y)}Zn("Networks updated successfully"),i()}catch(g){console.error("Error updating networks:",g),ha("Failed to update networks")}finally{c(!1)}};return m.jsx(ua,{isOpen:e,ariaHideApp:!1,onRequestClose:i,style:{content:{position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)",borderRadius:"0.75rem",backgroundColor:"white",zIndex:60,height:"600px",width:"900px",maxWidth:"95vw",maxHeight:"95vh",overflow:"hidden",padding:"0"},overlay:{position:"fixed",backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:60,top:0,left:0,right:0,bottom:0}},contentLabel:"Edit Visible Networks Modal",shouldCloseOnOverlayClick:!0,children:m.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%"},children:[m.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"1.5rem",borderBottom:"1px solid #E5E7EB"},children:[m.jsx("h2",{style:{fontSize:"1.5rem",fontWeight:"600",color:"#111827",margin:0},children:"Edit Visible Networks"}),m.jsx("button",{onClick:i,style:{padding:"0.5rem",borderRadius:"9999px",border:"none",backgroundColor:"transparent",cursor:"pointer",transition:"background-color 0.2s"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="#F3F4F6"},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent"},children:m.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[m.jsx("path",{d:"M18 6 6 18"}),m.jsx("path",{d:"m6 6 12 12"})]})})]}),m.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"1.5rem",borderBottom:"1px solid #E5E7EB"},children:[m.jsxs("div",{style:{display:"flex",gap:"1rem"},children:[m.jsx("button",{onClick:X,style:{padding:"0.5rem 1rem",backgroundColor:N,border:"none",borderRadius:"0.5rem",fontSize:"0.875rem",fontWeight:"500",color:b,cursor:"pointer",transition:"background-color 0.2s"},children:"Select All"}),m.jsx("button",{onClick:H,style:{padding:"0.5rem 1rem",backgroundColor:"transparent",border:"none",borderRadius:"0.5rem",fontSize:"0.875rem",fontWeight:"500",color:"#6B7280",cursor:"pointer",transition:"background-color 0.2s"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="#F3F4F6"},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent"},children:"Select None"})]}),m.jsxs("div",{style:{fontSize:"0.875rem",color:"#6B7280"},children:[n.length," of ",A.length," selected"]})]}),m.jsx("div",{style:{flex:1,overflowY:"auto",padding:"1.5rem"},children:p?m.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:m.jsx("div",{children:"Loading..."})}):m.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:"1rem"},children:[A.length===0&&m.jsx("div",{style:{gridColumn:"1 / -1",textAlign:"center",color:"#6B7280",fontSize:"0.875rem"},children:"No subscription for customer, add in networks from the admin panel."}),A.map(g=>{const L=n.includes(g.id);return m.jsxs("div",{onClick:()=>_(g.id),style:{position:"relative",display:"flex",flexDirection:"column",gap:"0.75rem",padding:"1.5rem",border:`2px solid ${L?b:"#E5E7EB"}`,borderRadius:"0.75rem",backgroundColor:L?N:"white",cursor:"pointer",transition:"all 0.2s"},children:[m.jsx("div",{style:{position:"absolute",top:"1rem",right:"1rem",width:"1.5rem",height:"1.5rem",borderRadius:"9999px",backgroundColor:L?b:"white",border:`2px solid ${L?b:"#D1D5DB"}`,display:"flex",alignItems:"center",justifyContent:"center"},children:L&&m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:m.jsx("path",{d:"M20 6 9 17l-5-5"})})}),m.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"1rem"},children:[m.jsx("img",{src:g.imageSrc,alt:g.name,style:{width:"60px",height:"40px",objectFit:"contain"}}),m.jsxs("div",{children:[m.jsx("h3",{style:{fontSize:"1rem",fontWeight:"600",color:"#111827",margin:0,textTransform:"capitalize"},children:g.name==="mobvista"?"Mintegral":g.name}),g.description&&m.jsx("p",{style:{fontSize:"0.75rem",color:"#6B7280",margin:"0.25rem 0 0 0"},children:g.description})]})]})]},g.id)})]})}),m.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.75rem",padding:"1.5rem",borderTop:"1px solid #E5E7EB"},children:[m.jsx("button",{onClick:i,style:{padding:"0.5rem 1.5rem",backgroundColor:"white",border:"1px solid #D1D5DB",borderRadius:"0.5rem",fontSize:"0.875rem",fontWeight:"500",color:"#374151",cursor:"pointer",transition:"background-color 0.2s"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="#F9FAFB"},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="white"},children:"Cancel"}),m.jsx("button",{onClick:f,disabled:I,style:{padding:"0.5rem 1.5rem",backgroundColor:I?"#D1D5DB":b,border:"none",borderRadius:"0.5rem",fontSize:"0.875rem",fontWeight:"500",color:"white",cursor:I?"not-allowed":"pointer",transition:"background-color 0.2s"},onMouseEnter:g=>{I||(g.currentTarget.style.backgroundColor=F)},onMouseLeave:g=>{I||(g.currentTarget.style.backgroundColor=b)},children:I?"Saving...":"Save Changes"})]})]})})},Dp=({typeOfProduct:e,allNetworksSelected:i,setAllNetworksSelected:t,api:a,user:o,versionId:r,customerId:s})=>{const[n,l]=y.useState(!1),[A,q]=y.useState(!1);return y.useEffect(()=>{(async()=>{try{const u=await mn(s,a);let I=[];e==="Playable"?I=u.playableSubs||[]:e==="Ready"?I=u.readySubs||[]:e==="Flex"&&(I=u.flexSubs||[]),q(I.length>0)}catch(u){console.error("Error checking subscriptions:",u),q(!1)}})()},[e,s,a]),m.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",marginBottom:"0",marginTop:"0",paddingRight:"1rem"},children:[m.jsx("h3",{style:{fontSize:"1rem",fontWeight:"600",color:"#111827",margin:0},children:"Ad Networks"}),m.jsxs("div",{style:{display:"flex",gap:"0.5rem",alignItems:"center"},children:[A&&["pm","admin"].includes(o.role)&&m.jsxs("button",{onClick:()=>l(!0),style:{display:"flex",alignItems:"center",gap:"0.375rem",paddingLeft:"0.75rem",paddingRight:"0.75rem",paddingTop:"0.375rem",paddingBottom:"0.375rem",backgroundColor:"#F3F4F6",border:"none",borderRadius:"0.5rem",fontSize:"0.75rem",fontWeight:"500",color:"#374151",cursor:"pointer",transition:"background-color 0.2s ease"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="#E5E7EB"},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="#F3F4F6"},children:[m.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[m.jsx("path",{d:"M12 20h9"}),m.jsx("path",{d:"M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"})]}),"Edit Networks"]}),m.jsxs("button",{onClick:()=>t(!i),style:{display:"flex",alignItems:"center",gap:"0.375rem",paddingLeft:"0.75rem",paddingRight:"0.75rem",paddingTop:"0.375rem",paddingBottom:"0.375rem",backgroundColor:"#F3F4F6",border:"none",borderRadius:"0.5rem",fontSize:"0.75rem",fontWeight:"500",color:"#374151",cursor:"pointer",transition:"background-color 0.2s ease"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="#E5E7EB"},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="#F3F4F6"},children:[m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:i?m.jsxs(m.Fragment,{children:[m.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),m.jsx("path",{d:"M9 13l2 2 4-6"})]}):m.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"})}),i?"Deselect All":"Select All"]})]}),["pm","admin"].includes(o.role)&&m.jsx(Bp,{visible:n,onClose:()=>l(!1),api:a,user:o,typeOfProduct:e,versionId:r,customerId:s})]})};async function Xp(e,i){return(await Ki.post(i+"/buyRequest",{requestType:e})).data}const fp=()=>m.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[m.jsxs("g",{"clip-path":"url(#clip0_518_12094)",children:[m.jsx("path",{d:"M4.50977 11.99L19.4898 11.99",stroke:"#7101FF","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}),m.jsx("path",{d:"M13.5068 17.977L19.4828 12L13.5068 6.02299",stroke:"#7101FF","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})]}),m.jsx("defs",{children:m.jsx("clipPath",{id:"clip0_518_12094",children:m.jsx("rect",{width:"24",height:"24",fill:"white",transform:"translate(0 24) rotate(-90)"})})})]}),vp=({creditDownload:e,api:i})=>m.jsxs(m.Fragment,{children:[m.jsx("div",{style:{marginTop:"0.5rem",paddingLeft:"1.5rem",paddingRight:"1.5rem",fontWeight:100},children:"If you continue to export, you will spend 1 credit."}),m.jsxs("div",{style:{display:"flex",alignItems:"center",width:"100%",paddingLeft:"1.5rem",paddingRight:"1.5rem",paddingTop:"0.25rem",fontSize:"12px",fontWeight:100},children:["You have"," ",m.jsx("span",{style:{paddingLeft:"0.25rem",paddingRight:"0.25rem",fontWeight:"bold",color:"#yourColorHere"},children:(e==null?void 0:e.downloadLimit)-(e==null?void 0:e.downloadLimitUsed)<0?0:(e==null?void 0:e.downloadLimit)-(e==null?void 0:e.downloadLimitUsed)})," ","credits remaining.",m.jsxs("button",{style:{marginLeft:"0.5rem",display:"flex",alignItems:"center",fontSize:"12px",fontWeight:"bold",textDecoration:"underline",color:"#yourColorHere"},onClick:()=>Xp("Flex Credit",i).then(t=>Zn("You will be contacted regarding your request.")),children:["Get more",m.jsx(fp,{})]})]})]}),Hp=({typeOfProduct:e,urls:i,handleIosChange:t,handleGoogleChange:a,disabled:o})=>{const r=q=>{t(q.target.value)},s=q=>{a(q.target.value)},[n,l]=ji(dt);let A=o;return e==="Playable"&&!o&&!n&&(A=!0),m.jsxs(m.Fragment,{children:[e==="Playable"&&m.jsxs("div",{style:{display:"none",height:"2rem",width:"100%",alignItems:"center",fontSize:"12px",fontWeight:"200"},children:[m.jsx("span",{style:{width:"6.5rem",fontWeight:"bold",flexShrink:0},children:"Use Custom Url"}),m.jsx("input",{type:"checkbox",checked:n,onChange:q=>l(q.target.checked)})]}),m.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",marginBottom:"0.75rem",paddingRight:"1rem"},children:[m.jsx("label",{style:{fontSize:"0.75rem",fontWeight:"500",color:"#374151",marginBottom:"0.25rem"},children:"App Store Link"}),m.jsx("input",{style:{display:"flex",height:"1.75rem",width:"100%",alignItems:"center",borderRadius:"0.5rem",border:"1px solid #D1D5DB",paddingLeft:"0.625rem",paddingRight:"0.625rem",fontSize:"0.75rem",color:"#000000",outline:"none",transition:"all 0.2s ease"},type:"text",value:i.iosUrl,onChange:r,placeholder:"https://apps.apple.com/app/...",disabled:A,onFocus:q=>{q.currentTarget.style.borderColor="#3B82F6",q.currentTarget.style.boxShadow="0 0 0 3px rgba(59, 130, 246, 0.1)"},onBlur:q=>{q.currentTarget.style.borderColor="#D1D5DB",q.currentTarget.style.boxShadow="none"}})]}),m.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",marginBottom:"0.75rem",paddingRight:"1rem"},children:[m.jsx("label",{style:{fontSize:"0.75rem",fontWeight:"500",color:"#374151",marginBottom:"0.25rem"},children:"Google Play Link"}),m.jsx("input",{style:{display:"flex",height:"1.75rem",width:"100%",alignItems:"center",borderRadius:"0.5rem",border:"1px solid #D1D5DB",paddingLeft:"0.625rem",paddingRight:"0.625rem",fontSize:"0.75rem",color:"#000000",outline:"none",transition:"all 0.2s ease"},type:"text",value:i.googleUrl,onChange:s,placeholder:"https://play.google.com/store/apps/details?id=...",disabled:A,onFocus:q=>{q.currentTarget.style.borderColor="#3B82F6",q.currentTarget.style.boxShadow="0 0 0 3px rgba(59, 130, 246, 0.1)"},onBlur:q=>{q.currentTarget.style.borderColor="#D1D5DB",q.currentTarget.style.boxShadow="none"}})]})]})},Pp=({typeOfProduct:e,fileSize:i,urls:t,handleIosChange:a,handleGoogleChange:o,disabled:r,api:s,creditDownload:n,user:l,isTest:A,setIsTest:q,urlType:p,setUrlType:u})=>m.jsx(m.Fragment,{children:e!=="Import"&&m.jsxs("div",{style:{display:"flex",width:"100%",flexDirection:"column"},children:[m.jsx(Hp,{typeOfProduct:e,urls:t,handleIosChange:a,handleGoogleChange:o,disabled:r}),(n==null?void 0:n.willSpendCredit)&&m.jsx(vp,{creditDownload:n,api:s})]})}),_p=({typeOfProduct:e,title:i,fileSize:t})=>{const a=gn[e],o=e!=="Flex";return m.jsxs("div",{children:[m.jsx("h2",{className:"text-xl font-bold",style:{backgroundImage:a,WebkitBackgroundClip:"text",backgroundClip:"text",WebkitTextFillColor:"transparent",marginBottom:o?"0.75rem":"0.25rem",marginTop:"2.5rem",lineHeight:"1.2",margin:0},children:i}),t?m.jsxs("p",{style:{fontSize:"0.75rem",fontWeight:"400",color:"#6B7280",marginTop:"0.25rem",marginBottom:0},children:["File size: ",parseFloat(t).toFixed(2)," MB"]}):null]})},$p=({typeOfProduct:e,fileSize:i,urls:t,title:a,handleIosChange:o,handleGoogleChange:r,disabled:s,creditDownload:n,api:l,user:A,isTest:q,setIsTest:p,urlType:u,setUrlType:I,allNetworksSelected:c,setAllNetworksSelected:Z,versionId:K,customerId:S})=>m.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",justifyContent:"space-between",alignItems:"flex-start",paddingLeft:"1.25rem",paddingRight:"1.25rem",paddingTop:"1.5rem",paddingBottom:"0.75rem",gap:"0.5rem"},children:[m.jsx(_p,{typeOfProduct:e,title:a,fileSize:i}),m.jsx(Pp,{typeOfProduct:e,fileSize:i,urls:t,handleIosChange:o,handleGoogleChange:r,disabled:s,creditDownload:n,api:l,user:A,isTest:q,setIsTest:p,urlType:u,setUrlType:I}),m.jsx(Dp,{typeOfProduct:e,allNetworksSelected:c,setAllNetworksSelected:Z,api:l,user:A,versionId:K,customerId:S})]}),Go=({children:e,className:i,onClickDonwload:t,downloading:a,disabled:o,variant:r="primary",typeOfProduct:s,isCopied:n=!1})=>{const l=r==="primary",A=()=>l?s&&qi[s]?qi[s]:"red":"#E5E7EB",q=()=>l?s&&Vt[s]?Vt[s]:"red":"#D1D5DB",p=()=>"none",u=n?"#16A34A":A(),I=n?"#15803D":q();return m.jsx("button",{onClick:t,className:i,style:{display:"flex",height:"30px",alignItems:"center",justifyContent:"center",borderRadius:"0.5rem",border:"none",padding:l?"0.25rem 0.5rem":"0.25rem",fontSize:"0.75rem",fontWeight:"500",width:l?"auto":"26px",minWidth:l?"90px":"26px",flex:l?1:"0 0 auto",backgroundColor:u,color:l||n?"#FFFFFF":"#374151",cursor:o||a||n?"not-allowed":"pointer",opacity:o||a?.6:1,transition:"all 0.2s ease",boxShadow:p()},disabled:a||o,onMouseEnter:c=>{!o&&!a&&!n&&(c.currentTarget.style.backgroundColor=I)},onMouseLeave:c=>{!o&&!a&&(c.currentTarget.style.backgroundColor=u)},children:n?m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:m.jsx("polyline",{points:"20 6 9 17 4 12"})}):e})},iu=({checked:e,typeOfProduct:i,id:t})=>{const[a,o]=y.useState(e),r=qi[i];y.useEffect(()=>{o(e)},[e]);const s=()=>{o(!a)};return m.jsx("div",{style:{display:"inline-flex",alignItems:"center"},children:m.jsxs("label",{onClick:s,style:{position:"relative",display:"flex",cursor:"pointer",alignItems:"center"},htmlFor:t,children:[m.jsx("input",{type:"checkbox",style:{position:"relative",height:"20px",width:"20px",cursor:"pointer",appearance:"none",borderRadius:"0.25rem",transition:"all 200ms ease-in-out",border:a?"none":"1px solid lightgray",backgroundColor:a?r:"transparent",opacity:1},id:t,checked:a,onChange:s}),m.jsxs("div",{style:{pointerEvents:"none",position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",color:"white",opacity:a?1:0,transition:"opacity ease-in-out"},children:[m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",style:{height:"14px",width:"14px"},viewBox:"0 0 20 20",fill:"white",stroke:"white",strokeWidth:"1",children:m.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})," "]})]})})},JK="",eu=({typeOfProduct:e})=>m.jsx("div",{style:{backgroundColor:"transparent",display:"flex",alignItems:"center",flexDirection:"column"},children:m.jsxs("div",{style:{position:"relative",width:"64px",height:"16px",marginTop:"8px"},children:[m.jsx("div",{style:{position:"absolute",top:0,width:"8px",height:"8px",borderRadius:"50%",backgroundColor:qi[e]}}),m.jsx("div",{style:{position:"absolute",top:0,width:"8px",height:"8px",borderRadius:"50%",backgroundColor:qi[e]}}),m.jsx("div",{style:{position:"absolute",top:0,width:"8px",height:"8px",borderRadius:"50%",backgroundColor:qi[e]}}),m.jsx("div",{style:{position:"absolute",top:0,width:"8px",height:"8px",borderRadius:"50%",backgroundColor:qi[e]}})]})}),Jt=({isNetworksLoading:e=!1,isLight:i=!0})=>m.jsx("div",{style:{display:"flex",height:"100%",width:"90px",alignItems:"center",justifyContent:"center"},children:m.jsx("img",{width:e?"100px":"25px",height:e?"100px":"25px",src:i?We:Xe,alt:"pf-logo-gif"})}),bo=({title:e,titleId:i,...t})=>m.jsxs("svg",{viewBox:"0 0 25 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em","aria-labelledby":i,...t,children:[e?m.jsx("title",{id:i,children:e}):null,m.jsx("path",{stroke:"currentColor",d:"m15.985 11.111-3.556 3.556-3.556-3.556M12.429 4v10.667M20.429 16.444A3.556 3.556 0 0 1 16.873 20H7.985a3.556 3.556 0 0 1-3.556-3.556",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round"})]}),tu=({onClose:e,iosLink:i,googleLink:t,buttonType:a,handleCopyLink:o,download:r,typeOfProduct:s})=>{const n=s&&qi[s]?qi[s]:qi.Playable;let l="";return!i&&!t?l=pi.t("common:both_links_are_empty_are_you_sure_want_to_continue"):i?t||(l=pi.t("common:google_play_link_is_empty_are_you_sure_want_to_continue")):l=pi.t("common:ios_link_is_empty_are_you_sure_want_to_continue"),m.jsxs("div",{style:{position:"fixed",top:0,left:0,zIndex:50,display:"flex",height:"120%",width:"130%",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0, 0, 0, 0.2)"},children:[m.jsx("div",{onClick:e,style:{position:"absolute",zIndex:30,height:"100%",width:"100%",pointerEvents:"none"}}),m.jsxs("div",{style:{position:"absolute",zIndex:50,display:"flex",flexDirection:"column",gap:"5px",maxWidth:"350px",borderRadius:"0.375rem",backgroundColor:"white",padding:"1rem",pointerEvents:"auto"},children:[m.jsx("h1",{style:{textAlign:"center",fontSize:"18px",lineHeight:"24px"},children:l}),m.jsxs("div",{style:{display:"flex",gap:"5px"},children:[m.jsx("button",{onClick:()=>{e(!1)},style:{flex:1,cursor:"pointer",borderRadius:"0.375rem",border:"1px solid #666666",padding:"0.5rem",fontWeight:"bold",transition:"all 0.15s ease-linear"},children:pi.t("common:no")}),m.jsx("button",{onClick:async A=>{a==="download"?await r():a==="copyLink"&&await o(),e()},style:{flex:1,cursor:"pointer",borderRadius:"0.375rem",border:`1px solid ${n}`,backgroundColor:n,padding:"0.5rem",fontWeight:"bold",color:"white",transition:"all 0.15s ease-linear"},children:pi.t("common:yes")})]})]})]})},Qo=({onClose:e,handleCopyLink:i,download:t,creditConfirmType:a,getDownloadCount:o,width:r="130%",height:s="120%",typeOfProduct:n="Playable"})=>{const l=n&&qi[n]?qi[n]:qi.Playable;return m.jsxs("div",{style:{position:"fixed",top:0,left:0,zIndex:50,display:"flex",height:s,width:r,alignItems:"center",justifyContent:"center",backgroundColor:"#00000080"},children:[m.jsx("div",{onClick:e,style:{position:"absolute",zIndex:30,height:"100%",width:"100%"}}),m.jsxs("div",{style:{position:"absolute",zIndex:50,display:"flex",height:"max-content",width:350,flexDirection:"column",gap:"5px",borderRadius:"8px",backgroundColor:"white",padding:"20px"},children:[m.jsx("h1",{style:{textAlign:"center",fontSize:"18px",lineHeight:"24px"},children:"You are going to spend 1 credit for this download, do you want to continue?"}),m.jsxs("div",{style:{display:"flex",gap:"5px"},children:[m.jsx("button",{onClick:e,style:{flex:1,cursor:"pointer",borderRadius:"4px",borderWidth:"1px",borderColor:"#666666",padding:"2px",fontWeight:"bold"},children:"No"}),m.jsx("button",{style:{flex:1,cursor:"pointer",borderRadius:"4px",borderWidth:"1px",borderColor:l,backgroundColor:l,padding:"2px",fontWeight:"bold",color:"white"},onClick:async A=>{A.preventDefault(),A.stopPropagation(),a==="download"?(await t(),await o()):a==="copy"&&(await i(),await o()),e()},children:"Yes"})]})]})]})},au=({onClose:e,handleDownload:i,handleDownloadMolocoTest:t,downloadingMoloco:a,downloadingMolocoTest:o,downloadingMolocoHtml:r,isCopiedMolocoTest:s,typeOfProduct:n="Playable"})=>{const l=n&&qi[n]?qi[n]:qi.Playable;return m.jsxs("div",{style:{position:"fixed",top:0,left:0,zIndex:50,display:"flex",height:"100%",width:"100%",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0, 0, 0, 0.2)"},onClick:e,children:[m.jsx("div",{onClick:e,style:{position:"absolute",zIndex:30,height:"100%",width:"100%",pointerEvents:"none"}}),m.jsx("div",{style:{position:"absolute",zIndex:50,display:"flex",flexDirection:"column",gap:"5px",minWidth:"500px",borderRadius:"0.375rem",backgroundColor:"white",padding:"1rem",pointerEvents:"auto"},onClick:A=>{A.stopPropagation()},children:m.jsxs("div",{style:{display:"flex",gap:"5px",flexDirection:"column"},children:[m.jsxs("div",{style:{display:"flex",justifyContent:"center"},children:[a?m.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer",borderRadius:"0.375rem",border:`1px solid ${l}`,backgroundColor:l,color:"white",transition:"all 0.15s ease-linear",width:"200px",marginRight:"10px"},children:m.jsx("img",{width:"25px",height:"25px",src:We,alt:"pf-logo-gif"})}):m.jsx("button",{onClick:()=>{i(!1)},style:{cursor:"pointer",borderRadius:"0.375rem",border:`1px solid ${l}`,backgroundColor:l,color:"white",transition:"all 0.15s ease-linear",width:"200px",marginRight:"10px"},children:"Download"}),r?m.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer",borderRadius:"0.375rem",border:`1px solid ${l}`,backgroundColor:l,color:"white",transition:"all 0.15s ease-linear",width:"200px",marginLeft:"10px"},children:m.jsx("img",{width:"25px",height:"25px",src:We,alt:"pf-logo-gif"})}):m.jsx("button",{onClick:()=>{i(!0)},style:{cursor:"pointer",borderRadius:"0.375rem",border:`1px solid ${l}`,backgroundColor:l,color:"white",transition:"all 0.15s ease-linear",width:"200px",marginLeft:"10px"},children:"Download HTML"})]}),m.jsx("div",{style:{display:"flex",justifyContent:"center"},children:o?m.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer",borderRadius:"0.375rem",border:`1px solid ${l}`,backgroundColor:l,color:"white",transition:"all 0.15s ease-linear",width:"200px"},children:m.jsx("img",{width:"25px",height:"25px",src:We,alt:"pf-logo-gif"})}):m.jsx("button",{onClick:t,disabled:s,style:{cursor:s?"default":"pointer",borderRadius:"0.375rem",border:s?"1px solid #16A34A":`1px solid ${l}`,backgroundColor:s?"#16A34A":l,color:"white",transition:"all 0.15s ease-linear",width:"200px"},children:s?"Link Copied!":"Download Moloco Test"})})]})})]})};async function ou(e,i,t,a){return(await Ki.post(e+"/createMolocoTestPage",{_id:i,network:t,typeOfProduct:a})).data}const ru=({onClose:e,handleDownload:i,downloadingPortrait:t,downloadingLandscape:a,downloadingResponsive:o,typeOfProduct:r="Playable"})=>{const s=r&&qi[r]?qi[r]:qi.Playable;return m.jsxs("div",{style:{position:"fixed",top:0,left:0,zIndex:50,display:"flex",height:"100%",width:"100%",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0, 0, 0, 0.2)"},onClick:e,children:[m.jsx("div",{onClick:e,style:{position:"absolute",zIndex:30,height:"100%",width:"100%",pointerEvents:"none"}}),m.jsx("div",{style:{position:"absolute",zIndex:50,display:"flex",flexDirection:"column",gap:"15px",minWidth:"500px",borderRadius:"0.375rem",backgroundColor:"white",padding:"1.5rem",pointerEvents:"auto"},onClick:n=>{n.stopPropagation()},children:m.jsx("div",{style:{display:"flex",gap:"10px",flexDirection:"column"},children:m.jsxs("div",{style:{display:"flex",justifyContent:"center",gap:"10px"},children:[t?m.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer",borderRadius:"0.375rem",border:`1px solid ${s}`,backgroundColor:s,color:"white",transition:"all 0.15s ease-linear",width:"140px",padding:"10px"},children:m.jsx("img",{width:"20px",height:"20px",src:We,alt:"loading-gif"})}):m.jsx("button",{onClick:()=>i("portrait"),style:{cursor:"pointer",borderRadius:"0.375rem",border:`1px solid ${s}`,backgroundColor:s,color:"white",transition:"all 0.15s ease-linear",width:"140px",padding:"10px",fontSize:"14px"},children:"Portrait"}),a?m.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer",borderRadius:"0.375rem",border:`1px solid ${s}`,backgroundColor:s,color:"white",transition:"all 0.15s ease-linear",width:"140px",padding:"10px"},children:m.jsx("img",{width:"20px",height:"20px",src:We,alt:"loading-gif"})}):m.jsx("button",{onClick:()=>i("landscape"),style:{cursor:"pointer",borderRadius:"0.375rem",border:`1px solid ${s}`,backgroundColor:s,color:"white",transition:"all 0.15s ease-linear",width:"140px",padding:"10px",fontSize:"14px"},children:"Landscape"}),o?m.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer",borderRadius:"0.375rem",border:`1px solid ${s}`,backgroundColor:s,color:"white",transition:"all 0.15s ease-linear",width:"140px",padding:"10px"},children:m.jsx("img",{width:"20px",height:"20px",src:We,alt:"loading-gif"})}):m.jsx("button",{onClick:()=>i("responsive"),style:{cursor:"pointer",borderRadius:"0.375rem",border:`1px solid ${s}`,backgroundColor:s,color:"white",transition:"all 0.15s ease-linear",width:"140px",padding:"10px",fontSize:"14px"},children:"Responsive"})]})})})]})};async function jo(e,i,t){return(await Ki.post(e+"/createPlayableVersionABTestLink",{_id:i,networks:t.networks,versions:t.versions,interactions:t.interactions||["0 click"]})).data}const su=({id:e,imageUrl:i,handleCardClick:t,selected:a,name:o,networkVersionSize:r,fileSizeLoading:s,showCheckBox:n,typeOfProduct:l,versionId:A,api:q,handleDownloadError:p,fetchFileUrl:u,urls:I,game:c,setIsConfirmActive:Z,creditDownload:K,getDownloadCount:S,disabled:W,user:U,setSafariCopyLink:k,isTest:h,urlType:b,setCdnModal:F,generateCDN:N,cdnUrl:v,selectedVersionIds:_})=>{const[X,H]=y.useState(!1),[f,g]=y.useState(""),[L,Y]=y.useState(!1),[C,M]=y.useState(!1),[D,J]=y.useState(!1),[E,O]=y.useState("download"),[B,z]=y.useState(!1),[P,Q]=y.useState(!1),[w,ti]=y.useState(!1),[si,oi]=y.useState(!1),[Zi,G]=y.useState(!1),[Mi,Fi]=y.useState(!1),[Ei,bi]=y.useState(!1),[$i,j]=y.useState(!1),[T,$]=y.useState(!1),[Ci,ui]=ji(na),[wi,Mt]=ji(dt),Ze=l==="Playable"?wi:!0,he={cdn:"Generate Link",adikteev:"Copy CDN"},Qi=()=>{t(e)},me=async(ni,ki,yi)=>{if(H(!0),l==="Flex"&&U.flex===!1&&U.customer!=="playableFactoryInternal"){p("|ACCESS|"),H(!1);return}if(_&&_.length>0&&ki==="download")try{if(!c||!c._id)throw new Error("Game data is required for multi-version download");const ie=await jo(q,c._id,{networks:[ni],versions:_}),ye=u+"/"+ie.url,Bi=await(await fetch(ye)).blob(),at=window.URL.createObjectURL(Bi),ge=document.createElement("a");return ge.href=at,ge.download=ie.url.split("/").pop()||"download.zip",document.body.appendChild(ge),ge.click(),window.URL.revokeObjectURL(at),document.body.removeChild(ge),H(!1),ie.url}catch(ie){console.log("multi-version single network download error",ie),H(!1),p(ie.message,ie);return}const Ue={molocoGenerateHtml:!1,urlType:b,responsiveType:"responsive"};if(Ce?ki==="copy"?(Q(!0),ki="download",Ue.molocoGenerateHtml=!0):z(!0):Ua&&(Ue.responsiveType=yi),console.log("getVersion",ni,ki,Ue),ni==="cdn"){F(!0),await N(!0),H(!1);return}return ni==="adikteev"&&(ki="copy"),new Promise((ie,ye)=>{ve(A,ni,Ze?I:null,ki,h,Ue).then(ee=>{H(!1),ie(ee),Q(!1),z(!1)}).catch(ee=>{H(!1),p(ee.message,ee),ye(ee),Q(!1),z(!1)})})},Et=async(ni=!1)=>{ni?Q(!0):z(!0);const ki={molocoGenerateHtml:!1};if(ni&&(ki.molocoGenerateHtml=!0),_&&_.length>0)try{if(!c||!c._id)throw new Error("Game data is required for multi-version download");const yi=await jo(q,c._id,{networks:["moloco"],versions:_,extras:{molocoGenerateHtml:ni}}),Ue=u+"/"+yi.url,ye=await(await fetch(Ue)).blob(),ee=window.URL.createObjectURL(ye),Bi=document.createElement("a");return Bi.href=ee,Bi.download=yi.url.split("/").pop()||"download.zip",document.body.appendChild(Bi),Bi.click(),window.URL.revokeObjectURL(ee),document.body.removeChild(Bi),H(!1),ni?Q(!1):z(!1),J(!1),yi.url}catch(yi){console.log("multi-version single network download error",yi),H(!1),p(yi.message,yi);return}ve(A,o,Ze?I:null,"download",h,ki).then(yi=>{ni?Q(!1):z(!1),J(!1)}).catch(yi=>{p(yi.message,yi)})},Ra=async()=>{ti(!0);const ni=await ou(q,A,o,l);let ki=`${u}/${ni==null?void 0:ni.url}`;fe(ki)?(oi(!0),setTimeout(()=>oi(!1),2e3),ti(!1)):(k(ki),ti(!1))},Ce=o==="moloco"||o==="molocoV2",Ua=o==="google",La=Ci.find(ni=>ni.name===o);return m.jsxs(m.Fragment,{children:[m.jsxs("div",{style:{position:"relative",display:"flex",flexDirection:"column",gap:"20px",padding:"16px",borderColor:a?qi[l]:"lightgray",borderWidth:"1px",borderStyle:"solid",backgroundColor:"white",width:"100%",height:"175px",borderRadius:"8px",cursor:"pointer"},className:"border-hover-"+l,onClick:Qi,children:[m.jsxs("div",{style:{marginTop:o=="web"?"10px":"40px",display:"flex",justifyContent:"center"},children:[m.jsx("div",{style:{position:"absolute",right:"0",top:"0",padding:"8px"},children:m.jsx("div",{children:r&&r.map(ni=>ni.network).includes(o)?s?m.jsx("div",{style:{position:"absolute",right:"0",top:"0.5rem",padding:"0.5rem",height:"1.5rem",display:"flex",justifyContent:"center",alignItems:"center",marginRight:"2rem"},children:m.jsx(eu,{typeOfProduct:l})}):r.map(ni=>m.jsx("div",{style:{position:"absolute",right:"0",top:"0.5rem",padding:"0.5rem",marginRight:"2rem",fontSize:"1rem",height:"1.5rem",display:"flex",justifyContent:"center",alignItems:"center"},children:ni.network===o?ni.size.toString().slice(0,5)+"Mb":""},ni.network)):null})}),m.jsx("div",{style:{position:"absolute",top:"0",left:"0",padding:"0.5rem"},children:(l==="Playable"||l==="Ready"||l==="Flex")&&n&&m.jsx(iu,{checked:a,typeOfProduct:l,id:e})}),m.jsx("img",{onClick:Qi,style:{width:"30rem",height:o=="web"?"80px":"50px",objectFit:"contain"},src:i})]}),m.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"0.25rem"},children:[m.jsx(Go,{className:`${Ce?"w-1/2":"w-2/3"} border-hover-`+l,downloading:X,typeOfProduct:l,onClickDonwload:async ni=>{if(ni.stopPropagation(),console.log("user in onclickdownload",U),Ce&&U.customer==="playableFactoryInternal"){J(!0);return}else if(Ua)Fi(!0);else{g("download");const ki=I.iosUrl,yi=I.googleUrl;o==="cdn"&&K&&K.willSpendCredit&&!v||o!=="cdn"&&K&&K.willSpendCredit?(Z(!0),O("download"),Y(!0)):["Playable","Flex","Ready"].includes(l)&&(!ki||!yi)?(Z(!0),M(!0)):(M(!1),Y(!1),await me(o,"download"))}},children:Ce?m.jsxs(m.Fragment,{children:[!B&&m.jsxs(m.Fragment,{children:[m.jsx(bo,{style:{marginRight:"0.5rem",height:"1.5rem",width:"1rem",stroke:"dark-full"}}),U.customer!=="playableFactoryInternal"?pi.t("common:txt"):pi.t("common:download")]}),B&&m.jsx(Jt,{})]}):m.jsxs(m.Fragment,{children:[!X&&m.jsxs(m.Fragment,{children:[m.jsx(bo,{style:{marginRight:"0.5rem",height:"1.5rem",width:"1rem",stroke:"dark-full"}}),he[o]||pi.t("common:download")]}),X&&m.jsx(Jt,{})]})}),La&&La.downloadType.includes("copy")&&m.jsx(Go,{className:"w-1/3 border-hover-"+l,variant:"secondary",typeOfProduct:l,onClickDonwload:async ni=>{if(ni.stopPropagation(),Zi)return;g("copyLink");const ki=I.iosUrl,yi=I.googleUrl;K&&(K!=null&&K.willSpendCredit)?(O("copy"),Z(!0),Y(!0)):l!=="Import"&&(!ki||!yi)?(Z(!0),M(!0)):(Y(!1),M(!1),await me(o,"copy"),G(!0),setTimeout(()=>G(!1),2e3))},disabled:W,isCopied:Zi,children:m.jsx(ds,{className:"h-4 w-4 stroke-dark-full"})}),Ce&&U.customer!=="playableFactoryInternal"&&m.jsxs(Go,{className:"w-1/2 border-hover-"+l,typeOfProduct:l,onClickDonwload:async ni=>{ni.stopPropagation(),g("copyLink");const ki=I.iosUrl,yi=I.googleUrl;K&&(K!=null&&K.willSpendCredit)?(O("download"),Z(!0),Y(!0)):l!=="Import"&&(!ki||!yi)?(Z(!0),M(!0)):(Y(!1),M(!1),await Et(!0))},disabled:W,children:[!P&&m.jsxs(m.Fragment,{children:[m.jsx(bo,{style:{marginRight:"0.5rem",height:"1.5rem",width:"1rem",stroke:"dark-full"}}),pi.t("common:html")]}),P&&m.jsx(Jt,{})]})]})]}),L&&m.jsx(Qo,{creditConfirmType:E,handleCopyLink:async()=>{M(!1),Z(!1),await me(o,"copy")},download:async()=>{M(!1),Z(!1),await me(o,"download")},onClose:()=>{Y(!1),Z(!1)},getDownloadCount:S,typeOfProduct:l}),C&&m.jsx(tu,{onClose:()=>{M(!1),Z(!1)},iosLink:I.iosUrl,googleLink:I.googleUrl,buttonType:f,typeOfProduct:l,handleCopyLink:async()=>{M(!1),Z(!1),await me(o,"copy")},download:async()=>{M(!1),Z(!1),await me(o,"download")}}),D&&U.customer==="playableFactoryInternal"&&m.jsx(au,{onClose:()=>{J(!1)},handleDownload:Et,handleDownloadMolocoTest:Ra,downloadingMoloco:B,donwloadintMolocoTest:w,downloadingMolocoHtml:P,isCopiedMolocoTest:si,typeOfProduct:l}),Mi&&m.jsx(ru,{onClose:()=>{Fi(!1)},handleDownload:async ni=>{ni==="portrait"?bi(!0):ni==="landscape"?j(!0):$(!0),await me(o,"download",ni),ni==="portrait"?bi(!1):ni==="landscape"?j(!1):$(!1)},downloadingPortrait:Ei,downloadingLandscape:$i,downloadingResponsive:T,typeOfProduct:l})]})},nu=({networksVersionTotalSize:e,typeOfProduct:i,onClickMultiDownload:t,multiDownloading:a,selectedCount:o=0})=>{const r=qi[i]||"#EA580C",n=(()=>{const l={Flex:"#5A00CC",Ready:"#004A7F",Playable:"#C2410C",Import:"#0082CC",Fusion:"#0A0A0A"};return i&&l[i]?l[i]:"#C2410C"})();return m.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"8px"},children:a?m.jsx("div",{style:{display:"flex",width:"auto",minWidth:"12rem",height:"2.5rem",borderRadius:"0.5rem",alignItems:"center",justifyContent:"center",backgroundColor:r,padding:"0 1.5rem"},children:m.jsx(Jt,{})}):m.jsxs("button",{onClick:t,style:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",padding:"0.625rem 1.5rem",minWidth:"12rem",height:"2.5rem",backgroundColor:r,color:"white",fontSize:"0.875rem",fontWeight:"500",borderRadius:"0.5rem",border:`2px solid ${r}`,boxShadow:`0 0 0 2px white, 0 0 0 4px ${r}, 0 10px 15px -3px ${r}4D, 0 4px 6px -4px ${r}4D`,cursor:"pointer",transition:"all 0.2s ease",whiteSpace:"nowrap"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor=n,l.currentTarget.style.boxShadow=`0 0 0 2px white, 0 0 0 4px ${r}, 0 20px 25px -5px ${r}66, 0 8px 10px -6px ${r}66`},onMouseLeave:l=>{l.currentTarget.style.backgroundColor=r,l.currentTarget.style.boxShadow=`0 0 0 2px white, 0 0 0 4px ${r}, 0 10px 15px -3px ${r}4D, 0 4px 6px -4px ${r}4D`},children:[m.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{marginRight:"0.5rem"},children:[m.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),m.jsx("polyline",{points:"7 10 12 15 17 10"}),m.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}),m.jsxs("span",{children:["Download Selected (",o,")"]})]})})},Vn=({title:e,titleId:i})=>m.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[m.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),m.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]}),lu=({onClose:e,cdnUrl:i,generateCDN:t,cdnUploading:a,typeOfProduct:o="Playable"})=>{const[r,s]=y.useState(!1),n=o&&qi[o]?qi[o]:qi.Playable;return m.jsxs("div",{style:{position:"fixed",top:0,left:0,zIndex:50,display:"flex",height:"100%",width:"100%",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0, 0, 0, 0.2)"},onClick:e,children:[m.jsx("div",{onClick:e,style:{position:"absolute",zIndex:30,height:"100%",width:"100%",pointerEvents:"none"}}),m.jsx("div",{style:{position:"absolute",zIndex:50,display:"flex",flexDirection:"column",gap:"5px",minWidth:"500px",maxWidth:"728px",width:"90%",minHeight:"150px",borderRadius:"10px",backgroundColor:"white",padding:"40px 30px 50px",pointerEvents:"auto"},onClick:l=>{l.stopPropagation()},children:m.jsxs("div",{style:{display:"flex",gap:"5px",flexDirection:"column"},children:[m.jsxs("p",{style:{fontSize:"1.1rem",fontWeight:500,textAlign:"left",marginBottom:"10px",color:"#00a3ff",textDecoration:"underline",cursor:"pointer",width:"150px",display:"flex",gap:"10px",alignItems:"center",height:"28px"},onClick:()=>{a||t()},children:["Update Link",a&&m.jsx("div",{style:{width:"20px",height:"20px",border:"3px solid #f3f3f3",borderTop:"3px solid #00a3ff",borderRadius:"50%",animation:"spin 1s linear infinite"}})]}),m.jsx("style",{children:`
|
|
87
|
+
https://fb.me/react-async-component-lifecycle-hooks`)}if(typeof e.getDerivedStateFromProps=="function"&&(i.componentWillMount=tn,i.componentWillReceiveProps=an),typeof i.getSnapshotBeforeUpdate=="function"){if(typeof i.componentDidUpdate!="function")throw new Error("Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype");i.componentWillUpdate=on;var n=i.componentDidUpdate;i.componentDidUpdate=function(A,q,p){var u=this.__reactInternalSnapshotFlag?this.__reactInternalSnapshot:p;n.call(this,A,q,u)}}return e}const Sp=$n(Object.freeze(Object.defineProperty({__proto__:null,polyfill:Zp},Symbol.toStringTag,{value:"Module"})));Object.defineProperty(be,"__esModule",{value:!0}),be.bodyOpenClassName=be.portalClassName=void 0;var rn=Object.assign||function(e){for(var i=1;i<arguments.length;i++){var t=arguments[i];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},hp=function(){function e(i,t){for(var a=0;a<t.length;a++){var o=t[a];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(i,o.key,o)}}return function(i,t,a){return t&&e(i.prototype,t),a&&e(i,a),i}}(),sn=y,qa=ht(sn),Cp=Pn,ma=ht(Cp),yp=Bt,ai=ht(yp),gp=dp,nn=ht(gp),Vp=ne,Jp=Wp(Vp),Me=le,ln=ht(Me),kp=Sp;function Wp(e){if(e&&e.__esModule)return e;var i={};if(e!=null)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(i[t]=e[t]);return i.default=e,i}function ht(e){return e&&e.__esModule?e:{default:e}}function Mp(e,i){if(!(e instanceof i))throw new TypeError("Cannot call a class as a function")}function An(e,i){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i&&(typeof i=="object"||typeof i=="function")?i:e}function Ep(e,i){if(typeof i!="function"&&i!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof i);e.prototype=Object.create(i&&i.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),i&&(Object.setPrototypeOf?Object.setPrototypeOf(e,i):e.__proto__=i)}var Rp=be.portalClassName="ReactModalPortal",Up=be.bodyOpenClassName="ReactModal__Body--open",xe=Me.canUseDOM&&ma.default.createPortal!==void 0,ko=function(i){return document.createElement(i)},qn=function(){return xe?ma.default.createPortal:ma.default.unstable_renderSubtreeIntoContainer};function pa(e){return e()}var et=function(e){Ep(i,e);function i(){var t,a,o,r;Mp(this,i);for(var s=arguments.length,n=Array(s),l=0;l<s;l++)n[l]=arguments[l];return r=(a=(o=An(this,(t=i.__proto__||Object.getPrototypeOf(i)).call.apply(t,[this].concat(n))),o),o.removePortal=function(){!xe&&ma.default.unmountComponentAtNode(o.node);var A=pa(o.props.parentSelector);A&&A.contains(o.node)?A.removeChild(o.node):console.warn('React-Modal: "parentSelector" prop did not returned any DOM element. Make sure that the parent element is unmounted to avoid any memory leaks.')},o.portalRef=function(A){o.portal=A},o.renderPortal=function(A){var q=qn(),p=q(o,qa.default.createElement(nn.default,rn({defaultStyles:i.defaultStyles},A)),o.node);o.portalRef(p)},a),An(o,r)}return hp(i,[{key:"componentDidMount",value:function(){if(Me.canUseDOM){xe||(this.node=ko("div")),this.node.className=this.props.portalClassName;var a=pa(this.props.parentSelector);a.appendChild(this.node),!xe&&this.renderPortal(this.props)}}},{key:"getSnapshotBeforeUpdate",value:function(a){var o=pa(a.parentSelector),r=pa(this.props.parentSelector);return{prevParent:o,nextParent:r}}},{key:"componentDidUpdate",value:function(a,o,r){if(Me.canUseDOM){var s=this.props,n=s.isOpen,l=s.portalClassName;a.portalClassName!==l&&(this.node.className=l);var A=r.prevParent,q=r.nextParent;q!==A&&(A.removeChild(this.node),q.appendChild(this.node)),!(!a.isOpen&&!n)&&!xe&&this.renderPortal(this.props)}}},{key:"componentWillUnmount",value:function(){if(!(!Me.canUseDOM||!this.node||!this.portal)){var a=this.portal.state,o=Date.now(),r=a.isOpen&&this.props.closeTimeoutMS&&(a.closesAt||o+this.props.closeTimeoutMS);r?(a.beforeClose||this.portal.closeWithTimeout(),setTimeout(this.removePortal,r-o)):this.removePortal()}}},{key:"render",value:function(){if(!Me.canUseDOM||!xe)return null;!this.node&&xe&&(this.node=ko("div"));var a=qn();return a(qa.default.createElement(nn.default,rn({ref:this.portalRef,defaultStyles:i.defaultStyles},this.props)),this.node)}}],[{key:"setAppElement",value:function(a){Jp.setElement(a)}}]),i}(sn.Component);et.propTypes={isOpen:ai.default.bool.isRequired,style:ai.default.shape({content:ai.default.object,overlay:ai.default.object}),portalClassName:ai.default.string,bodyOpenClassName:ai.default.string,htmlOpenClassName:ai.default.string,className:ai.default.oneOfType([ai.default.string,ai.default.shape({base:ai.default.string.isRequired,afterOpen:ai.default.string.isRequired,beforeClose:ai.default.string.isRequired})]),overlayClassName:ai.default.oneOfType([ai.default.string,ai.default.shape({base:ai.default.string.isRequired,afterOpen:ai.default.string.isRequired,beforeClose:ai.default.string.isRequired})]),appElement:ai.default.oneOfType([ai.default.instanceOf(ln.default),ai.default.instanceOf(Me.SafeHTMLCollection),ai.default.instanceOf(Me.SafeNodeList),ai.default.arrayOf(ai.default.instanceOf(ln.default))]),onAfterOpen:ai.default.func,onRequestClose:ai.default.func,closeTimeoutMS:ai.default.number,ariaHideApp:ai.default.bool,shouldFocusAfterRender:ai.default.bool,shouldCloseOnOverlayClick:ai.default.bool,shouldReturnFocusAfterClose:ai.default.bool,preventScroll:ai.default.bool,parentSelector:ai.default.func,aria:ai.default.object,data:ai.default.object,role:ai.default.string,contentLabel:ai.default.string,shouldCloseOnEsc:ai.default.bool,overlayRef:ai.default.func,contentRef:ai.default.func,id:ai.default.string,overlayElement:ai.default.func,contentElement:ai.default.func},et.defaultProps={isOpen:!1,portalClassName:Rp,bodyOpenClassName:Up,role:"dialog",ariaHideApp:!0,closeTimeoutMS:0,shouldFocusAfterRender:!0,shouldCloseOnEsc:!0,shouldCloseOnOverlayClick:!0,shouldReturnFocusAfterClose:!0,preventScroll:!1,parentSelector:function(){return document.body},overlayElement:function(i,t){return qa.default.createElement("div",i,t)},contentElement:function(i,t){return qa.default.createElement("div",i,t)}},et.defaultStyles={overlay:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(255, 255, 255, 0.75)"},content:{position:"absolute",top:"40px",left:"40px",right:"40px",bottom:"40px",border:"1px solid #ccc",background:"#fff",overflow:"auto",WebkitOverflowScrolling:"touch",borderRadius:"4px",outline:"none",padding:"20px"}},(0,kp.polyfill)(et),process.env.NODE_ENV!=="production"&&(et.setCreateHTMLElement=function(e){return ko=e}),be.default=et,function(e,i){Object.defineProperty(i,"__esModule",{value:!0});var t=be,a=o(t);function o(r){return r&&r.__esModule?r:{default:r}}i.default=a.default,e.exports=i.default}(So,So.exports);var Lp=So.exports;const ua=_n(Lp);async function mn(e,i){return(await Ki.post(`${i}/getCompanyAllSubs`,{customer:e})).data}async function Yp(e,i,t,a){return(await Ki.post(a+"/updateSub",{sub:e,updates:i,product:t})).data}function pn(e){var i,t,a="";if(typeof e=="string"||typeof e=="number")a+=e;else if(typeof e=="object")if(Array.isArray(e))for(i=0;i<e.length;i++)e[i]&&(t=pn(e[i]))&&(a&&(a+=" "),a+=t);else for(i in e)e[i]&&(a&&(a+=" "),a+=i);return a}function Ee(){for(var e,i,t=0,a="";t<arguments.length;)(e=arguments[t++])&&(i=pn(e))&&(a&&(a+=" "),a+=i);return a}const Ct=e=>typeof e=="number"&&!isNaN(e),Oe=e=>typeof e=="string",Ti=e=>typeof e=="function",Ia=e=>Oe(e)||Ti(e)?e:null,Wo=e=>y.isValidElement(e)||Oe(e)||Ti(e)||Ct(e);function Gp(e,i,t){t===void 0&&(t=300);const{scrollHeight:a,style:o}=e;requestAnimationFrame(()=>{o.minHeight="initial",o.height=a+"px",o.transition=`all ${t}ms`,requestAnimationFrame(()=>{o.height="0",o.padding="0",o.margin="0",setTimeout(i,t)})})}function Ka(e){let{enter:i,exit:t,appendPosition:a=!1,collapse:o=!0,collapseDuration:r=300}=e;return function(s){let{children:n,position:l,preventExitTransition:A,done:q,nodeRef:p,isIn:u}=s;const I=a?`${i}--${l}`:i,c=a?`${t}--${l}`:t,Z=y.useRef(0);return y.useLayoutEffect(()=>{const K=p.current,S=I.split(" "),W=U=>{U.target===p.current&&(K.dispatchEvent(new Event("d")),K.removeEventListener("animationend",W),K.removeEventListener("animationcancel",W),Z.current===0&&U.type!=="animationcancel"&&K.classList.remove(...S))};K.classList.add(...S),K.addEventListener("animationend",W),K.addEventListener("animationcancel",W)},[]),y.useEffect(()=>{const K=p.current,S=()=>{K.removeEventListener("animationend",S),o?Gp(K,q,r):q()};u||(A?S():(Z.current=1,K.className+=` ${c}`,K.addEventListener("animationend",S)))},[u]),y.createElement(y.Fragment,null,n)}}function un(e,i){return e!=null?{content:e.content,containerId:e.props.containerId,id:e.props.toastId,theme:e.props.theme,type:e.props.type,data:e.props.data||{},isLoading:e.props.isLoading,icon:e.props.icon,status:i}:{}}const Pi={list:new Map,emitQueue:new Map,on(e,i){return this.list.has(e)||this.list.set(e,[]),this.list.get(e).push(i),this},off(e,i){if(i){const t=this.list.get(e).filter(a=>a!==i);return this.list.set(e,t),this}return this.list.delete(e),this},cancelEmit(e){const i=this.emitQueue.get(e);return i&&(i.forEach(clearTimeout),this.emitQueue.delete(e)),this},emit(e){this.list.has(e)&&this.list.get(e).forEach(i=>{const t=setTimeout(()=>{i(...[].slice.call(arguments,1))},0);this.emitQueue.has(e)||this.emitQueue.set(e,[]),this.emitQueue.get(e).push(t)})}},ca=e=>{let{theme:i,type:t,...a}=e;return y.createElement("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:i==="colored"?"currentColor":`var(--toastify-icon-color-${t})`,...a})},Mo={info:function(e){return y.createElement(ca,{...e},y.createElement("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))},warning:function(e){return y.createElement(ca,{...e},y.createElement("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))},success:function(e){return y.createElement(ca,{...e},y.createElement("path",{d:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}))},error:function(e){return y.createElement(ca,{...e},y.createElement("path",{d:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}))},spinner:function(){return y.createElement("div",{className:"Toastify__spinner"})}};function bp(e){const[,i]=y.useReducer(I=>I+1,0),[t,a]=y.useState([]),o=y.useRef(null),r=y.useRef(new Map).current,s=I=>t.indexOf(I)!==-1,n=y.useRef({toastKey:1,displayedToast:0,count:0,queue:[],props:e,containerId:null,isToastActive:s,getToast:I=>r.get(I)}).current;function l(I){let{containerId:c}=I;const{limit:Z}=n.props;!Z||c&&n.containerId!==c||(n.count-=n.queue.length,n.queue=[])}function A(I){a(c=>I==null?[]:c.filter(Z=>Z!==I))}function q(){const{toastContent:I,toastProps:c,staleId:Z}=n.queue.shift();u(I,c,Z)}function p(I,c){let{delay:Z,staleId:K,...S}=c;if(!Wo(I)||function(H){return!o.current||n.props.enableMultiContainer&&H.containerId!==n.props.containerId||r.has(H.toastId)&&H.updateId==null}(S))return;const{toastId:W,updateId:U,data:k}=S,{props:h}=n,b=()=>A(W),F=U==null;F&&n.count++;const N={...h,style:h.toastStyle,key:n.toastKey++,...Object.fromEntries(Object.entries(S).filter(H=>{let[f,g]=H;return g!=null})),toastId:W,updateId:U,data:k,closeToast:b,isIn:!1,className:Ia(S.className||h.toastClassName),bodyClassName:Ia(S.bodyClassName||h.bodyClassName),progressClassName:Ia(S.progressClassName||h.progressClassName),autoClose:!S.isLoading&&(v=S.autoClose,_=h.autoClose,v===!1||Ct(v)&&v>0?v:_),deleteToast(){const H=un(r.get(W),"removed");r.delete(W),Pi.emit(4,H);const f=n.queue.length;if(n.count=W==null?n.count-n.displayedToast:n.count-1,n.count<0&&(n.count=0),f>0){const g=W==null?n.props.limit:1;if(f===1||g===1)n.displayedToast++,q();else{const L=g>f?f:g;n.displayedToast=L;for(let Y=0;Y<L;Y++)q()}}else i()}};var v,_;N.iconOut=function(H){let{theme:f,type:g,isLoading:L,icon:Y}=H,C=null;const M={theme:f,type:g};return Y===!1||(Ti(Y)?C=Y(M):y.isValidElement(Y)?C=y.cloneElement(Y,M):Oe(Y)||Ct(Y)?C=Y:L?C=Mo.spinner():(D=>D in Mo)(g)&&(C=Mo[g](M))),C}(N),Ti(S.onOpen)&&(N.onOpen=S.onOpen),Ti(S.onClose)&&(N.onClose=S.onClose),N.closeButton=h.closeButton,S.closeButton===!1||Wo(S.closeButton)?N.closeButton=S.closeButton:S.closeButton===!0&&(N.closeButton=!Wo(h.closeButton)||h.closeButton);let X=I;y.isValidElement(I)&&!Oe(I.type)?X=y.cloneElement(I,{closeToast:b,toastProps:N,data:k}):Ti(I)&&(X=I({closeToast:b,toastProps:N,data:k})),h.limit&&h.limit>0&&n.count>h.limit&&F?n.queue.push({toastContent:X,toastProps:N,staleId:K}):Ct(Z)?setTimeout(()=>{u(X,N,K)},Z):u(X,N,K)}function u(I,c,Z){const{toastId:K}=c;Z&&r.delete(Z);const S={content:I,props:c};r.set(K,S),a(W=>[...W,K].filter(U=>U!==Z)),Pi.emit(4,un(S,S.props.updateId==null?"added":"updated"))}return y.useEffect(()=>(n.containerId=e.containerId,Pi.cancelEmit(3).on(0,p).on(1,I=>o.current&&A(I)).on(5,l).emit(2,n),()=>{r.clear(),Pi.emit(3,n)}),[]),y.useEffect(()=>{n.props=e,n.isToastActive=s,n.displayedToast=t.length}),{getToastToRender:function(I){const c=new Map,Z=Array.from(r.values());return e.newestOnTop&&Z.reverse(),Z.forEach(K=>{const{position:S}=K.props;c.has(S)||c.set(S,[]),c.get(S).push(K)}),Array.from(c,K=>I(K[0],K[1]))},containerRef:o,isToastActive:s}}function In(e){return e.targetTouches&&e.targetTouches.length>=1?e.targetTouches[0].clientX:e.clientX}function Kn(e){return e.targetTouches&&e.targetTouches.length>=1?e.targetTouches[0].clientY:e.clientY}function Qp(e){const[i,t]=y.useState(!1),[a,o]=y.useState(!1),r=y.useRef(null),s=y.useRef({start:0,x:0,y:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,boundingRect:null,didMove:!1}).current,n=y.useRef(e),{autoClose:l,pauseOnHover:A,closeToast:q,onClick:p,closeOnClick:u}=e;function I(k){if(e.draggable){k.nativeEvent.type==="touchstart"&&k.nativeEvent.preventDefault(),s.didMove=!1,document.addEventListener("mousemove",S),document.addEventListener("mouseup",W),document.addEventListener("touchmove",S),document.addEventListener("touchend",W);const h=r.current;s.canCloseOnClick=!0,s.canDrag=!0,s.boundingRect=h.getBoundingClientRect(),h.style.transition="",s.x=In(k.nativeEvent),s.y=Kn(k.nativeEvent),e.draggableDirection==="x"?(s.start=s.x,s.removalDistance=h.offsetWidth*(e.draggablePercent/100)):(s.start=s.y,s.removalDistance=h.offsetHeight*(e.draggablePercent===80?1.5*e.draggablePercent:e.draggablePercent/100))}}function c(k){if(s.boundingRect){const{top:h,bottom:b,left:F,right:N}=s.boundingRect;k.nativeEvent.type!=="touchend"&&e.pauseOnHover&&s.x>=F&&s.x<=N&&s.y>=h&&s.y<=b?K():Z()}}function Z(){t(!0)}function K(){t(!1)}function S(k){const h=r.current;s.canDrag&&h&&(s.didMove=!0,i&&K(),s.x=In(k),s.y=Kn(k),s.delta=e.draggableDirection==="x"?s.x-s.start:s.y-s.start,s.start!==s.x&&(s.canCloseOnClick=!1),h.style.transform=`translate${e.draggableDirection}(${s.delta}px)`,h.style.opacity=""+(1-Math.abs(s.delta/s.removalDistance)))}function W(){document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",W),document.removeEventListener("touchmove",S),document.removeEventListener("touchend",W);const k=r.current;if(s.canDrag&&s.didMove&&k){if(s.canDrag=!1,Math.abs(s.delta)>s.removalDistance)return o(!0),void e.closeToast();k.style.transition="transform 0.2s, opacity 0.2s",k.style.transform=`translate${e.draggableDirection}(0)`,k.style.opacity="1"}}y.useEffect(()=>{n.current=e}),y.useEffect(()=>(r.current&&r.current.addEventListener("d",Z,{once:!0}),Ti(e.onOpen)&&e.onOpen(y.isValidElement(e.children)&&e.children.props),()=>{const k=n.current;Ti(k.onClose)&&k.onClose(y.isValidElement(k.children)&&k.children.props)}),[]),y.useEffect(()=>(e.pauseOnFocusLoss&&(document.hasFocus()||K(),window.addEventListener("focus",Z),window.addEventListener("blur",K)),()=>{e.pauseOnFocusLoss&&(window.removeEventListener("focus",Z),window.removeEventListener("blur",K))}),[e.pauseOnFocusLoss]);const U={onMouseDown:I,onTouchStart:I,onMouseUp:c,onTouchEnd:c};return l&&A&&(U.onMouseEnter=K,U.onMouseLeave=Z),u&&(U.onClick=k=>{p&&p(k),s.canCloseOnClick&&q()}),{playToast:Z,pauseToast:K,isRunning:i,preventExitTransition:a,toastRef:r,eventHandlers:U}}function cn(e){let{closeToast:i,theme:t,ariaLabel:a="close"}=e;return y.createElement("button",{className:`Toastify__close-button Toastify__close-button--${t}`,type:"button",onClick:o=>{o.stopPropagation(),i(o)},"aria-label":a},y.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},y.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})))}function jp(e){let{delay:i,isRunning:t,closeToast:a,type:o="default",hide:r,className:s,style:n,controlledProgress:l,progress:A,rtl:q,isIn:p,theme:u}=e;const I=r||l&&A===0,c={...n,animationDuration:`${i}ms`,animationPlayState:t?"running":"paused",opacity:I?0:1};l&&(c.transform=`scaleX(${A})`);const Z=Ee("Toastify__progress-bar",l?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated",`Toastify__progress-bar-theme--${u}`,`Toastify__progress-bar--${o}`,{"Toastify__progress-bar--rtl":q}),K=Ti(s)?s({rtl:q,type:o,defaultClassName:Z}):Ee(Z,s);return y.createElement("div",{role:"progressbar","aria-hidden":I?"true":"false","aria-label":"notification timer",className:K,style:c,[l&&A>=1?"onTransitionEnd":"onAnimationEnd"]:l&&A<1?null:()=>{p&&a()}})}const Fp=e=>{const{isRunning:i,preventExitTransition:t,toastRef:a,eventHandlers:o}=Qp(e),{closeButton:r,children:s,autoClose:n,onClick:l,type:A,hideProgressBar:q,closeToast:p,transition:u,position:I,className:c,style:Z,bodyClassName:K,bodyStyle:S,progressClassName:W,progressStyle:U,updateId:k,role:h,progress:b,rtl:F,toastId:N,deleteToast:v,isIn:_,isLoading:X,iconOut:H,closeOnClick:f,theme:g}=e,L=Ee("Toastify__toast",`Toastify__toast-theme--${g}`,`Toastify__toast--${A}`,{"Toastify__toast--rtl":F},{"Toastify__toast--close-on-click":f}),Y=Ti(c)?c({rtl:F,position:I,type:A,defaultClassName:L}):Ee(L,c),C=!!b||!n,M={closeToast:p,type:A,theme:g};let D=null;return r===!1||(D=Ti(r)?r(M):y.isValidElement(r)?y.cloneElement(r,M):cn(M)),y.createElement(u,{isIn:_,done:v,position:I,preventExitTransition:t,nodeRef:a},y.createElement("div",{id:N,onClick:l,className:Y,...o,style:Z,ref:a},y.createElement("div",{..._&&{role:h},className:Ti(K)?K({type:A}):Ee("Toastify__toast-body",K),style:S},H!=null&&y.createElement("div",{className:Ee("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!X})},H),y.createElement("div",null,s)),D,y.createElement(jp,{...k&&!C?{key:`pb-${k}`}:{},rtl:F,theme:g,delay:n,isRunning:i,isIn:_,closeToast:p,hide:q,type:A,style:U,className:W,controlledProgress:C,progress:b||0})))},da=function(e,i){return i===void 0&&(i=!1),{enter:`Toastify--animate Toastify__${e}-enter`,exit:`Toastify--animate Toastify__${e}-exit`,appendPosition:i}},Np=Ka(da("bounce",!0));Ka(da("slide",!0)),Ka(da("zoom")),Ka(da("flip"));const Eo=y.forwardRef((e,i)=>{const{getToastToRender:t,containerRef:a,isToastActive:o}=bp(e),{className:r,style:s,rtl:n,containerId:l}=e;function A(q){const p=Ee("Toastify__toast-container",`Toastify__toast-container--${q}`,{"Toastify__toast-container--rtl":n});return Ti(r)?r({position:q,rtl:n,defaultClassName:p}):Ee(p,Ia(r))}return y.useEffect(()=>{i&&(i.current=a.current)},[]),y.createElement("div",{ref:a,className:"Toastify",id:l},t((q,p)=>{const u=p.length?{...s}:{...s,pointerEvents:"none"};return y.createElement("div",{className:A(q),style:u,key:`container-${q}`},p.map((I,c)=>{let{content:Z,props:K}=I;return y.createElement(Fp,{...K,isIn:o(K.toastId),style:{...K.style,"--nth":c+1,"--len":p.length},key:`toast-${K.key}`},Z)}))}))});Eo.displayName="ToastContainer",Eo.defaultProps={position:"top-right",transition:Np,autoClose:5e3,closeButton:cn,pauseOnHover:!0,pauseOnFocusLoss:!0,closeOnClick:!0,draggable:!0,draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light"};let Ro,ze=new Map,yt=[],xp=1;function dn(){return""+xp++}function Op(e){return e&&(Oe(e.toastId)||Ct(e.toastId))?e.toastId:dn()}function gt(e,i){return ze.size>0?Pi.emit(0,e,i):yt.push({content:e,options:i}),i.toastId}function Za(e,i){return{...i,type:i&&i.type||e,toastId:Op(i)}}function Sa(e){return(i,t)=>gt(i,Za(e,t))}function hi(e,i){return gt(e,Za("default",i))}hi.loading=(e,i)=>gt(e,Za("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...i})),hi.promise=function(e,i,t){let a,{pending:o,error:r,success:s}=i;o&&(a=Oe(o)?hi.loading(o,t):hi.loading(o.render,{...t,...o}));const n={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},l=(q,p,u)=>{if(p==null)return void hi.dismiss(a);const I={type:q,...n,...t,data:u},c=Oe(p)?{render:p}:p;return a?hi.update(a,{...I,...c}):hi(c.render,{...I,...c}),u},A=Ti(e)?e():e;return A.then(q=>l("success",s,q)).catch(q=>l("error",r,q)),A},hi.success=Sa("success"),hi.info=Sa("info"),hi.error=Sa("error"),hi.warning=Sa("warning"),hi.warn=hi.warning,hi.dark=(e,i)=>gt(e,Za("default",{theme:"dark",...i})),hi.dismiss=e=>{ze.size>0?Pi.emit(1,e):yt=yt.filter(i=>e!=null&&i.options.toastId!==e)},hi.clearWaitingQueue=function(e){return e===void 0&&(e={}),Pi.emit(5,e)},hi.isActive=e=>{let i=!1;return ze.forEach(t=>{t.isToastActive&&t.isToastActive(e)&&(i=!0)}),i},hi.update=function(e,i){i===void 0&&(i={}),setTimeout(()=>{const t=function(a,o){let{containerId:r}=o;const s=ze.get(r||Ro);return s&&s.getToast(a)}(e,i);if(t){const{props:a,content:o}=t,r={delay:100,...a,...i,toastId:i.toastId||e,updateId:dn()};r.toastId!==e&&(r.staleId=e);const s=r.render||o;delete r.render,gt(s,r)}},0)},hi.done=e=>{hi.update(e,{progress:1})},hi.onChange=e=>(Pi.on(4,e),()=>{Pi.off(4,e)}),hi.POSITION={TOP_LEFT:"top-left",TOP_RIGHT:"top-right",TOP_CENTER:"top-center",BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",BOTTOM_CENTER:"bottom-center"},hi.TYPE={INFO:"info",SUCCESS:"success",WARNING:"warning",ERROR:"error",DEFAULT:"default"},Pi.on(2,e=>{Ro=e.containerId||e,ze.set(Ro,e),yt.forEach(i=>{Pi.emit(0,i.content,i.options)}),yt=[]}).on(3,e=>{ze.delete(e.containerId||e),ze.size===0&&Pi.off(0).off(1).off(5)});function ha(e){hi.error(e,{position:"top-center",autoClose:650,hideProgressBar:!0,closeOnClick:!0,pauseOnHover:!0,draggable:!0,progress:void 0,theme:"light"})}function Zn(e){hi.success(e,{position:"top-center",autoClose:650,hideProgressBar:!0,closeOnClick:!0,pauseOnHover:!0,draggable:!0,progress:void 0,theme:"light"})}async function Sn(e,i,t){return(await Ki.post(e+"/getNetworks",{typeOfProduct:i,versionId:t})).data}async function zp(e){return(await Ki.post(e+"/getNetworks",{allNetworks:!0})).data}const Uo="#f97316",hn="#ea580c",Lo="#AD1BFF",Cn="#9200e7",Yo="#2563eb",yn="#0031FF";var qi=(e=>(e[e.Flex=Lo]="Flex",e[e.Playable=Uo]="Playable",e.Import="#00a3ff",e[e.Ready=Yo]="Ready",e.Fusion="#171717",e))(qi||{}),Vt=(e=>(e[e.Flex=Cn]="Flex",e[e.Ready=yn]="Ready",e[e.Playable=hn]="Playable",e.Import="#0082CC",e.Fusion="#0A0A0A",e))(Vt||{}),Tp=(e=>(e[e.Flex=`bg-[${Lo}]`]="Flex",e[e.Playable=`bg-[${Uo}]`]="Playable",e.Import="bg-[#00a3ff]",e[e.Ready=`bg-[${Yo}]`]="Ready",e.Fusion="bg-[#171717]",e))(Tp||{}),gn=(e=>(e.Fusion="linear-gradient(to right, #651FFF, #5018CC)",e[e.Ready=`linear-gradient(to right, ${Yo}, ${yn})`]="Ready",e[e.Playable=`linear-gradient(to right, ${Uo}, ${hn})`]="Playable",e[e.Flex=`linear-gradient(to right, ${Lo}, ${Cn})`]="Flex",e))(gn||{});const wp={applovin:"Mobile marketing platform for user acquisition",unity:"Unity Ads monetization platform",mobvista:"AI-powered mobile advertising platform",ironsource:"Mobile monetization and marketing platform",moloco:"Machine learning-powered performance marketing",vungle:"In-app video ad platform",facebook:"Facebook Audience Network",google:"Google Ads platform",liftoff:"Mobile app marketing and retargeting",tencent:"Tencent advertising platform",aarki:"Mobile advertising platform",adform:"Digital advertising platform"},Bp=({visible:e,onClose:i,api:t,user:a,typeOfProduct:o,versionId:r,customerId:s})=>{const[n,l]=y.useState([]),[A,q]=y.useState([]),[p,u]=y.useState(!1),[I,c]=y.useState(!1),[Z,K]=y.useState(null),[S,W]=ji(na),U=()=>qi[o]||qi.Playable,k=()=>Vt[o]||"red",h=()=>({Ready:"#E0F2FE",Playable:"#FFF7ED",Import:"#E0F2FE",Flex:"#F3E8FF",Fusion:"#F5F5F5"})[o]||"#FFF7ED",b=U(),F=k(),N=h();y.useEffect(()=>{e&&v()},[e]);const v=async()=>{u(!0);try{const g=await mn(s,t);let L=[];o==="Playable"?L=g.playableSubs||[]:o==="Ready"?L=g.readySubs||[]:o==="Flex"&&(L=g.flexSubs||[]);const Y=L.find(C=>C.isActive&&new Date(C.endsAt)>new Date);if(Y){K(Y),l(Array.isArray(Y.networks)?Y.networks:[]);const M=(await zp(t)).filter(D=>D.name!=="web"&&D.name!=="cdn"&&D.name!=="default").map(D=>({id:D.id,name:D.name,imageSrc:D.imageSrc,description:wp[D.name]||""}));q(M)}}catch(g){console.error("Error fetching subscription data:",g),ha("Failed to load subscription data")}finally{u(!1)}},_=g=>{l(L=>L.includes(g)?L.filter(Y=>Y!==g):[...L,g])},X=()=>{l(A.map(g=>g.id))},H=()=>{l([])},f=async()=>{if(!Z){ha("No active subscription found");return}c(!0);try{let g="playable";o==="Ready"?g="ready":o==="Flex"&&(g="flex"),await Yp(Z,{downloadLimit:Z.downloadLimit,seatLimit:Z.seatLimit,endsAt:Z.endsAt,isUnlimited:Z.isUnlimited,packageId:Z.packageId,networks:n},g,t);const L=await Sn(t,o,r);if(L){const Y=L.map(C=>(C.name=C.id,C));W(Y)}Zn("Networks updated successfully"),i()}catch(g){console.error("Error updating networks:",g),ha("Failed to update networks")}finally{c(!1)}};return m.jsx(ua,{isOpen:e,ariaHideApp:!1,onRequestClose:i,style:{content:{position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)",borderRadius:"0.75rem",backgroundColor:"white",zIndex:60,height:"600px",width:"900px",maxWidth:"95vw",maxHeight:"95vh",overflow:"hidden",padding:"0"},overlay:{position:"fixed",backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:60,top:0,left:0,right:0,bottom:0}},contentLabel:"Edit Visible Networks Modal",shouldCloseOnOverlayClick:!0,children:m.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%"},children:[m.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"1.5rem",borderBottom:"1px solid #E5E7EB"},children:[m.jsx("h2",{style:{fontSize:"1.5rem",fontWeight:"600",color:"#111827",margin:0},children:"Edit Visible Networks"}),m.jsx("button",{onClick:i,style:{padding:"0.5rem",borderRadius:"9999px",border:"none",backgroundColor:"transparent",cursor:"pointer",transition:"background-color 0.2s"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="#F3F4F6"},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent"},children:m.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[m.jsx("path",{d:"M18 6 6 18"}),m.jsx("path",{d:"m6 6 12 12"})]})})]}),m.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"1.5rem",borderBottom:"1px solid #E5E7EB"},children:[m.jsxs("div",{style:{display:"flex",gap:"1rem"},children:[m.jsx("button",{onClick:X,style:{padding:"0.5rem 1rem",backgroundColor:N,border:"none",borderRadius:"0.5rem",fontSize:"0.875rem",fontWeight:"500",color:b,cursor:"pointer",transition:"background-color 0.2s"},children:"Select All"}),m.jsx("button",{onClick:H,style:{padding:"0.5rem 1rem",backgroundColor:"transparent",border:"none",borderRadius:"0.5rem",fontSize:"0.875rem",fontWeight:"500",color:"#6B7280",cursor:"pointer",transition:"background-color 0.2s"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="#F3F4F6"},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent"},children:"Select None"})]}),m.jsxs("div",{style:{fontSize:"0.875rem",color:"#6B7280"},children:[n.length," of ",A.length," selected"]})]}),m.jsx("div",{style:{flex:1,overflowY:"auto",padding:"1.5rem"},children:p?m.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:m.jsx("div",{children:"Loading..."})}):m.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:"1rem"},children:[A.length===0&&m.jsx("div",{style:{gridColumn:"1 / -1",textAlign:"center",color:"#6B7280",fontSize:"0.875rem"},children:"No subscription for customer, add in networks from the admin panel."}),A.map(g=>{const L=n.includes(g.id);return m.jsxs("div",{onClick:()=>_(g.id),style:{position:"relative",display:"flex",flexDirection:"column",gap:"0.75rem",padding:"1.5rem",border:`2px solid ${L?b:"#E5E7EB"}`,borderRadius:"0.75rem",backgroundColor:L?N:"white",cursor:"pointer",transition:"all 0.2s"},children:[m.jsx("div",{style:{position:"absolute",top:"1rem",right:"1rem",width:"1.5rem",height:"1.5rem",borderRadius:"9999px",backgroundColor:L?b:"white",border:`2px solid ${L?b:"#D1D5DB"}`,display:"flex",alignItems:"center",justifyContent:"center"},children:L&&m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:m.jsx("path",{d:"M20 6 9 17l-5-5"})})}),m.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"1rem"},children:[m.jsx("img",{src:g.imageSrc,alt:g.name,style:{width:"60px",height:"40px",objectFit:"contain"}}),m.jsxs("div",{children:[m.jsx("h3",{style:{fontSize:"1rem",fontWeight:"600",color:"#111827",margin:0,textTransform:"capitalize"},children:g.name==="mobvista"?"Mintegral":g.name}),g.description&&m.jsx("p",{style:{fontSize:"0.75rem",color:"#6B7280",margin:"0.25rem 0 0 0"},children:g.description})]})]})]},g.id)})]})}),m.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.75rem",padding:"1.5rem",borderTop:"1px solid #E5E7EB"},children:[m.jsx("button",{onClick:i,style:{padding:"0.5rem 1.5rem",backgroundColor:"white",border:"1px solid #D1D5DB",borderRadius:"0.5rem",fontSize:"0.875rem",fontWeight:"500",color:"#374151",cursor:"pointer",transition:"background-color 0.2s"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="#F9FAFB"},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="white"},children:"Cancel"}),m.jsx("button",{onClick:f,disabled:I,style:{padding:"0.5rem 1.5rem",backgroundColor:I?"#D1D5DB":b,border:"none",borderRadius:"0.5rem",fontSize:"0.875rem",fontWeight:"500",color:"white",cursor:I?"not-allowed":"pointer",transition:"background-color 0.2s"},onMouseEnter:g=>{I||(g.currentTarget.style.backgroundColor=F)},onMouseLeave:g=>{I||(g.currentTarget.style.backgroundColor=b)},children:I?"Saving...":"Save Changes"})]})]})})},Dp=({typeOfProduct:e,allNetworksSelected:i,setAllNetworksSelected:t,api:a,user:o,versionId:r,customerId:s})=>{const[n,l]=y.useState(!1),[A,q]=y.useState(!1);return y.useEffect(()=>{(async()=>{try{const u=await mn(s,a);let I=[];e==="Playable"?I=u.playableSubs||[]:e==="Ready"?I=u.readySubs||[]:e==="Flex"&&(I=u.flexSubs||[]),q(I.length>0)}catch(u){console.error("Error checking subscriptions:",u),q(!1)}})()},[e,s,a]),m.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",marginBottom:"0",marginTop:"0",paddingRight:"1rem"},children:[m.jsx("h3",{style:{fontSize:"1rem",fontWeight:"600",color:"#111827",margin:0},children:"Ad Networks"}),m.jsxs("div",{style:{display:"flex",gap:"0.5rem",alignItems:"center"},children:[A&&["pm","admin"].includes(o.role)&&m.jsxs("button",{onClick:()=>l(!0),style:{display:"flex",alignItems:"center",gap:"0.375rem",paddingLeft:"0.75rem",paddingRight:"0.75rem",paddingTop:"0.375rem",paddingBottom:"0.375rem",backgroundColor:"#F3F4F6",border:"none",borderRadius:"0.5rem",fontSize:"0.75rem",fontWeight:"500",color:"#374151",cursor:"pointer",transition:"background-color 0.2s ease"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="#E5E7EB"},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="#F3F4F6"},children:[m.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[m.jsx("path",{d:"M12 20h9"}),m.jsx("path",{d:"M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"})]}),"Edit Networks"]}),m.jsxs("button",{onClick:()=>t(!i),style:{display:"flex",alignItems:"center",gap:"0.375rem",paddingLeft:"0.75rem",paddingRight:"0.75rem",paddingTop:"0.375rem",paddingBottom:"0.375rem",backgroundColor:"#F3F4F6",border:"none",borderRadius:"0.5rem",fontSize:"0.75rem",fontWeight:"500",color:"#374151",cursor:"pointer",transition:"background-color 0.2s ease"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="#E5E7EB"},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="#F3F4F6"},children:[m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:i?m.jsxs(m.Fragment,{children:[m.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),m.jsx("path",{d:"M9 13l2 2 4-6"})]}):m.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"})}),i?"Deselect All":"Select All"]})]}),["pm","admin"].includes(o.role)&&m.jsx(Bp,{visible:n,onClose:()=>l(!1),api:a,user:o,typeOfProduct:e,versionId:r,customerId:s})]})};async function Xp(e,i){return(await Ki.post(i+"/buyRequest",{requestType:e})).data}const fp=()=>m.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[m.jsxs("g",{"clip-path":"url(#clip0_518_12094)",children:[m.jsx("path",{d:"M4.50977 11.99L19.4898 11.99",stroke:"#7101FF","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}),m.jsx("path",{d:"M13.5068 17.977L19.4828 12L13.5068 6.02299",stroke:"#7101FF","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})]}),m.jsx("defs",{children:m.jsx("clipPath",{id:"clip0_518_12094",children:m.jsx("rect",{width:"24",height:"24",fill:"white",transform:"translate(0 24) rotate(-90)"})})})]}),vp=({creditDownload:e,api:i})=>m.jsxs(m.Fragment,{children:[m.jsx("div",{style:{marginTop:"0.5rem",paddingLeft:"1.5rem",paddingRight:"1.5rem",fontWeight:100},children:"If you continue to export, you will spend 1 credit."}),m.jsxs("div",{style:{display:"flex",alignItems:"center",width:"100%",paddingLeft:"1.5rem",paddingRight:"1.5rem",paddingTop:"0.25rem",fontSize:"12px",fontWeight:100},children:["You have"," ",m.jsx("span",{style:{paddingLeft:"0.25rem",paddingRight:"0.25rem",fontWeight:"bold",color:"#yourColorHere"},children:(e==null?void 0:e.downloadLimit)-(e==null?void 0:e.downloadLimitUsed)<0?0:(e==null?void 0:e.downloadLimit)-(e==null?void 0:e.downloadLimitUsed)})," ","credits remaining.",m.jsxs("button",{style:{marginLeft:"0.5rem",display:"flex",alignItems:"center",fontSize:"12px",fontWeight:"bold",textDecoration:"underline",color:"#yourColorHere"},onClick:()=>Xp("Flex Credit",i).then(t=>Zn("You will be contacted regarding your request.")),children:["Get more",m.jsx(fp,{})]})]})]}),Hp=({typeOfProduct:e,urls:i,handleIosChange:t,handleGoogleChange:a,disabled:o})=>{const r=q=>{t(q.target.value)},s=q=>{a(q.target.value)},[n,l]=ji(dt);let A=o;return e==="Playable"&&!o&&!n&&(A=!0),m.jsxs(m.Fragment,{children:[e==="Playable"&&m.jsxs("div",{style:{display:"none",height:"2rem",width:"100%",alignItems:"center",fontSize:"12px",fontWeight:"200"},children:[m.jsx("span",{style:{width:"6.5rem",fontWeight:"bold",flexShrink:0},children:"Use Custom Url"}),m.jsx("input",{type:"checkbox",checked:n,onChange:q=>l(q.target.checked)})]}),m.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",marginBottom:"0.75rem",paddingRight:"1rem"},children:[m.jsx("label",{style:{fontSize:"0.75rem",fontWeight:"500",color:"#374151",marginBottom:"0.25rem"},children:"App Store Link"}),m.jsx("input",{style:{display:"flex",height:"1.75rem",width:"100%",alignItems:"center",borderRadius:"0.5rem",border:"1px solid #D1D5DB",paddingLeft:"0.625rem",paddingRight:"0.625rem",fontSize:"0.75rem",color:"#000000",outline:"none",transition:"all 0.2s ease"},type:"text",value:i.iosUrl,onChange:r,placeholder:"https://apps.apple.com/app/...",disabled:A,onFocus:q=>{q.currentTarget.style.borderColor="#3B82F6",q.currentTarget.style.boxShadow="0 0 0 3px rgba(59, 130, 246, 0.1)"},onBlur:q=>{q.currentTarget.style.borderColor="#D1D5DB",q.currentTarget.style.boxShadow="none"}})]}),m.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",marginBottom:"0.75rem",paddingRight:"1rem"},children:[m.jsx("label",{style:{fontSize:"0.75rem",fontWeight:"500",color:"#374151",marginBottom:"0.25rem"},children:"Google Play Link"}),m.jsx("input",{style:{display:"flex",height:"1.75rem",width:"100%",alignItems:"center",borderRadius:"0.5rem",border:"1px solid #D1D5DB",paddingLeft:"0.625rem",paddingRight:"0.625rem",fontSize:"0.75rem",color:"#000000",outline:"none",transition:"all 0.2s ease"},type:"text",value:i.googleUrl,onChange:s,placeholder:"https://play.google.com/store/apps/details?id=...",disabled:A,onFocus:q=>{q.currentTarget.style.borderColor="#3B82F6",q.currentTarget.style.boxShadow="0 0 0 3px rgba(59, 130, 246, 0.1)"},onBlur:q=>{q.currentTarget.style.borderColor="#D1D5DB",q.currentTarget.style.boxShadow="none"}})]})]})},Pp=({typeOfProduct:e,fileSize:i,urls:t,handleIosChange:a,handleGoogleChange:o,disabled:r,api:s,creditDownload:n,user:l,isTest:A,setIsTest:q,urlType:p,setUrlType:u})=>m.jsx(m.Fragment,{children:e!=="Import"&&m.jsxs("div",{style:{display:"flex",width:"100%",flexDirection:"column"},children:[m.jsx(Hp,{typeOfProduct:e,urls:t,handleIosChange:a,handleGoogleChange:o,disabled:r}),(n==null?void 0:n.willSpendCredit)&&m.jsx(vp,{creditDownload:n,api:s})]})}),_p=({typeOfProduct:e,title:i,fileSize:t})=>{const a=gn[e],o=e!=="Flex";return m.jsxs("div",{children:[m.jsx("h2",{className:"text-xl font-bold",style:{backgroundImage:a,WebkitBackgroundClip:"text",backgroundClip:"text",WebkitTextFillColor:"transparent",marginBottom:o?"0.75rem":"0.25rem",marginTop:"2.5rem",lineHeight:"1.2",margin:0},children:i}),t?m.jsxs("p",{style:{fontSize:"0.75rem",fontWeight:"400",color:"#6B7280",marginTop:"0.25rem",marginBottom:0},children:["File size: ",parseFloat(t).toFixed(2)," MB"]}):null]})},$p=({typeOfProduct:e,fileSize:i,urls:t,title:a,handleIosChange:o,handleGoogleChange:r,disabled:s,creditDownload:n,api:l,user:A,isTest:q,setIsTest:p,urlType:u,setUrlType:I,allNetworksSelected:c,setAllNetworksSelected:Z,versionId:K,customerId:S})=>m.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",justifyContent:"space-between",alignItems:"flex-start",paddingLeft:"1.25rem",paddingRight:"1.25rem",paddingTop:"1.5rem",paddingBottom:"0.75rem",gap:"0.5rem"},children:[m.jsx(_p,{typeOfProduct:e,title:a,fileSize:i}),m.jsx(Pp,{typeOfProduct:e,fileSize:i,urls:t,handleIosChange:o,handleGoogleChange:r,disabled:s,creditDownload:n,api:l,user:A,isTest:q,setIsTest:p,urlType:u,setUrlType:I}),m.jsx(Dp,{typeOfProduct:e,allNetworksSelected:c,setAllNetworksSelected:Z,api:l,user:A,versionId:K,customerId:S})]}),Go=({children:e,className:i,onClickDonwload:t,downloading:a,disabled:o,variant:r="primary",typeOfProduct:s,isCopied:n=!1})=>{const l=r==="primary",A=()=>l?s&&qi[s]?qi[s]:"red":"#E5E7EB",q=()=>l?s&&Vt[s]?Vt[s]:"red":"#D1D5DB",p=()=>"none",u=n?"#16A34A":A(),I=n?"#15803D":q();return m.jsx("button",{onClick:t,className:i,style:{display:"flex",height:"30px",alignItems:"center",justifyContent:"center",borderRadius:"0.5rem",border:"none",padding:l?"0.25rem 0.5rem":"0.25rem",fontSize:"0.75rem",fontWeight:"500",width:l?"auto":"26px",minWidth:l?"90px":"26px",flex:l?1:"0 0 auto",backgroundColor:u,color:l||n?"#FFFFFF":"#374151",cursor:o||a||n?"not-allowed":"pointer",opacity:o||a?.6:1,transition:"all 0.2s ease",boxShadow:p()},disabled:a||o,onMouseEnter:c=>{!o&&!a&&!n&&(c.currentTarget.style.backgroundColor=I)},onMouseLeave:c=>{!o&&!a&&(c.currentTarget.style.backgroundColor=u)},children:n?m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:m.jsx("polyline",{points:"20 6 9 17 4 12"})}):e})},iu=({checked:e,typeOfProduct:i,id:t})=>{const[a,o]=y.useState(e),r=qi[i];y.useEffect(()=>{o(e)},[e]);const s=()=>{o(!a)};return m.jsx("div",{style:{display:"inline-flex",alignItems:"center"},children:m.jsxs("label",{onClick:s,style:{position:"relative",display:"flex",cursor:"pointer",alignItems:"center"},htmlFor:t,children:[m.jsx("input",{type:"checkbox",style:{position:"relative",height:"20px",width:"20px",cursor:"pointer",appearance:"none",borderRadius:"0.25rem",transition:"all 200ms ease-in-out",border:a?"none":"1px solid lightgray",backgroundColor:a?r:"transparent",opacity:1},id:t,checked:a,onChange:s}),m.jsxs("div",{style:{pointerEvents:"none",position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",color:"white",opacity:a?1:0,transition:"opacity ease-in-out"},children:[m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",style:{height:"14px",width:"14px"},viewBox:"0 0 20 20",fill:"white",stroke:"white",strokeWidth:"1",children:m.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})," "]})]})})},JK="",eu=({typeOfProduct:e})=>m.jsx("div",{style:{backgroundColor:"transparent",display:"flex",alignItems:"center",flexDirection:"column"},children:m.jsxs("div",{style:{position:"relative",width:"64px",height:"16px",marginTop:"8px"},children:[m.jsx("div",{style:{position:"absolute",top:0,width:"8px",height:"8px",borderRadius:"50%",backgroundColor:qi[e]}}),m.jsx("div",{style:{position:"absolute",top:0,width:"8px",height:"8px",borderRadius:"50%",backgroundColor:qi[e]}}),m.jsx("div",{style:{position:"absolute",top:0,width:"8px",height:"8px",borderRadius:"50%",backgroundColor:qi[e]}}),m.jsx("div",{style:{position:"absolute",top:0,width:"8px",height:"8px",borderRadius:"50%",backgroundColor:qi[e]}})]})}),Jt=({isNetworksLoading:e=!1,isLight:i=!0})=>m.jsx("div",{style:{display:"flex",height:"100%",width:"90px",alignItems:"center",justifyContent:"center"},children:m.jsx("img",{width:e?"100px":"25px",height:e?"100px":"25px",src:i?We:Xe,alt:"pf-logo-gif"})}),bo=({title:e,titleId:i,...t})=>m.jsxs("svg",{viewBox:"0 0 25 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em","aria-labelledby":i,...t,children:[e?m.jsx("title",{id:i,children:e}):null,m.jsx("path",{stroke:"currentColor",d:"m15.985 11.111-3.556 3.556-3.556-3.556M12.429 4v10.667M20.429 16.444A3.556 3.556 0 0 1 16.873 20H7.985a3.556 3.556 0 0 1-3.556-3.556",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round"})]}),tu=({onClose:e,iosLink:i,googleLink:t,buttonType:a,handleCopyLink:o,download:r,typeOfProduct:s})=>{const n=s&&qi[s]?qi[s]:qi.Playable;let l="";return!i&&!t?l=pi.t("common:both_links_are_empty_are_you_sure_want_to_continue"):i?t||(l=pi.t("common:google_play_link_is_empty_are_you_sure_want_to_continue")):l=pi.t("common:ios_link_is_empty_are_you_sure_want_to_continue"),m.jsxs("div",{style:{position:"fixed",top:0,left:0,zIndex:50,display:"flex",height:"120%",width:"130%",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0, 0, 0, 0.2)"},children:[m.jsx("div",{onClick:e,style:{position:"absolute",zIndex:30,height:"100%",width:"100%",pointerEvents:"none"}}),m.jsxs("div",{style:{position:"absolute",zIndex:50,display:"flex",flexDirection:"column",gap:"5px",maxWidth:"350px",borderRadius:"0.375rem",backgroundColor:"white",padding:"1rem",pointerEvents:"auto"},children:[m.jsx("h1",{style:{textAlign:"center",fontSize:"18px",lineHeight:"24px"},children:l}),m.jsxs("div",{style:{display:"flex",gap:"5px"},children:[m.jsx("button",{onClick:()=>{e(!1)},style:{flex:1,cursor:"pointer",borderRadius:"0.375rem",border:"1px solid #666666",padding:"0.5rem",fontWeight:"bold",transition:"all 0.15s ease-linear"},children:pi.t("common:no")}),m.jsx("button",{onClick:async A=>{a==="download"?await r():a==="copyLink"&&await o(),e()},style:{flex:1,cursor:"pointer",borderRadius:"0.375rem",border:`1px solid ${n}`,backgroundColor:n,padding:"0.5rem",fontWeight:"bold",color:"white",transition:"all 0.15s ease-linear"},children:pi.t("common:yes")})]})]})]})},Qo=({onClose:e,handleCopyLink:i,download:t,creditConfirmType:a,getDownloadCount:o,width:r="130%",height:s="120%",typeOfProduct:n="Playable"})=>{const l=n&&qi[n]?qi[n]:qi.Playable;return m.jsxs("div",{style:{position:"fixed",top:0,left:0,zIndex:50,display:"flex",height:s,width:r,alignItems:"center",justifyContent:"center",backgroundColor:"#00000080"},children:[m.jsx("div",{onClick:e,style:{position:"absolute",zIndex:30,height:"100%",width:"100%"}}),m.jsxs("div",{style:{position:"absolute",zIndex:50,display:"flex",height:"max-content",width:350,flexDirection:"column",gap:"5px",borderRadius:"8px",backgroundColor:"white",padding:"20px"},children:[m.jsx("h1",{style:{textAlign:"center",fontSize:"18px",lineHeight:"24px"},children:"You are going to spend 1 credit for this download, do you want to continue?"}),m.jsxs("div",{style:{display:"flex",gap:"5px"},children:[m.jsx("button",{onClick:e,style:{flex:1,cursor:"pointer",borderRadius:"4px",borderWidth:"1px",borderColor:"#666666",padding:"2px",fontWeight:"bold"},children:"No"}),m.jsx("button",{style:{flex:1,cursor:"pointer",borderRadius:"4px",borderWidth:"1px",borderColor:l,backgroundColor:l,padding:"2px",fontWeight:"bold",color:"white"},onClick:async A=>{A.preventDefault(),A.stopPropagation(),a==="download"?(await t(),await o()):a==="copy"&&(await i(),await o()),e()},children:"Yes"})]})]})]})},au=({onClose:e,handleDownload:i,handleDownloadMolocoTest:t,downloadingMoloco:a,downloadingMolocoTest:o,downloadingMolocoHtml:r,isCopiedMolocoTest:s,typeOfProduct:n="Playable"})=>{const l=n&&qi[n]?qi[n]:qi.Playable;return m.jsxs("div",{style:{position:"fixed",top:0,left:0,zIndex:50,display:"flex",height:"100%",width:"100%",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0, 0, 0, 0.2)"},onClick:e,children:[m.jsx("div",{onClick:e,style:{position:"absolute",zIndex:30,height:"100%",width:"100%",pointerEvents:"none"}}),m.jsx("div",{style:{position:"absolute",zIndex:50,display:"flex",flexDirection:"column",gap:"5px",minWidth:"500px",borderRadius:"0.375rem",backgroundColor:"white",padding:"1rem",pointerEvents:"auto"},onClick:A=>{A.stopPropagation()},children:m.jsxs("div",{style:{display:"flex",gap:"5px",flexDirection:"column"},children:[m.jsxs("div",{style:{display:"flex",justifyContent:"center"},children:[a?m.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer",borderRadius:"0.375rem",border:`1px solid ${l}`,backgroundColor:l,color:"white",transition:"all 0.15s ease-linear",width:"200px",marginRight:"10px"},children:m.jsx("img",{width:"25px",height:"25px",src:We,alt:"pf-logo-gif"})}):m.jsx("button",{onClick:()=>{i(!1)},style:{cursor:"pointer",borderRadius:"0.375rem",border:`1px solid ${l}`,backgroundColor:l,color:"white",transition:"all 0.15s ease-linear",width:"200px",marginRight:"10px"},children:"Download"}),r?m.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer",borderRadius:"0.375rem",border:`1px solid ${l}`,backgroundColor:l,color:"white",transition:"all 0.15s ease-linear",width:"200px",marginLeft:"10px"},children:m.jsx("img",{width:"25px",height:"25px",src:We,alt:"pf-logo-gif"})}):m.jsx("button",{onClick:()=>{i(!0)},style:{cursor:"pointer",borderRadius:"0.375rem",border:`1px solid ${l}`,backgroundColor:l,color:"white",transition:"all 0.15s ease-linear",width:"200px",marginLeft:"10px"},children:"Download HTML"})]}),m.jsx("div",{style:{display:"flex",justifyContent:"center"},children:o?m.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer",borderRadius:"0.375rem",border:`1px solid ${l}`,backgroundColor:l,color:"white",transition:"all 0.15s ease-linear",width:"200px"},children:m.jsx("img",{width:"25px",height:"25px",src:We,alt:"pf-logo-gif"})}):m.jsx("button",{onClick:t,disabled:s,style:{cursor:s?"default":"pointer",borderRadius:"0.375rem",border:s?"1px solid #16A34A":`1px solid ${l}`,backgroundColor:s?"#16A34A":l,color:"white",transition:"all 0.15s ease-linear",width:"200px"},children:s?"Link Copied!":"Download Moloco Test"})})]})})]})};async function ou(e,i,t,a){return(await Ki.post(e+"/createMolocoTestPage",{_id:i,network:t,typeOfProduct:a})).data}const ru=({onClose:e,handleDownload:i,downloadingPortrait:t,downloadingLandscape:a,downloadingResponsive:o,typeOfProduct:r="Playable"})=>{const s=r&&qi[r]?qi[r]:qi.Playable;return m.jsxs("div",{style:{position:"fixed",top:0,left:0,zIndex:50,display:"flex",height:"100%",width:"100%",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0, 0, 0, 0.2)"},onClick:e,children:[m.jsx("div",{onClick:e,style:{position:"absolute",zIndex:30,height:"100%",width:"100%",pointerEvents:"none"}}),m.jsx("div",{style:{position:"absolute",zIndex:50,display:"flex",flexDirection:"column",gap:"15px",minWidth:"500px",borderRadius:"0.375rem",backgroundColor:"white",padding:"1.5rem",pointerEvents:"auto"},onClick:n=>{n.stopPropagation()},children:m.jsx("div",{style:{display:"flex",gap:"10px",flexDirection:"column"},children:m.jsxs("div",{style:{display:"flex",justifyContent:"center",gap:"10px"},children:[t?m.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer",borderRadius:"0.375rem",border:`1px solid ${s}`,backgroundColor:s,color:"white",transition:"all 0.15s ease-linear",width:"140px",padding:"10px"},children:m.jsx("img",{width:"20px",height:"20px",src:We,alt:"loading-gif"})}):m.jsx("button",{onClick:()=>i("portrait"),style:{cursor:"pointer",borderRadius:"0.375rem",border:`1px solid ${s}`,backgroundColor:s,color:"white",transition:"all 0.15s ease-linear",width:"140px",padding:"10px",fontSize:"14px"},children:"Portrait"}),a?m.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer",borderRadius:"0.375rem",border:`1px solid ${s}`,backgroundColor:s,color:"white",transition:"all 0.15s ease-linear",width:"140px",padding:"10px"},children:m.jsx("img",{width:"20px",height:"20px",src:We,alt:"loading-gif"})}):m.jsx("button",{onClick:()=>i("landscape"),style:{cursor:"pointer",borderRadius:"0.375rem",border:`1px solid ${s}`,backgroundColor:s,color:"white",transition:"all 0.15s ease-linear",width:"140px",padding:"10px",fontSize:"14px"},children:"Landscape"}),o?m.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer",borderRadius:"0.375rem",border:`1px solid ${s}`,backgroundColor:s,color:"white",transition:"all 0.15s ease-linear",width:"140px",padding:"10px"},children:m.jsx("img",{width:"20px",height:"20px",src:We,alt:"loading-gif"})}):m.jsx("button",{onClick:()=>i("responsive"),style:{cursor:"pointer",borderRadius:"0.375rem",border:`1px solid ${s}`,backgroundColor:s,color:"white",transition:"all 0.15s ease-linear",width:"140px",padding:"10px",fontSize:"14px"},children:"Responsive"})]})})})]})};async function jo(e,i,t){return(await Ki.post(e+"/createPlayableVersionABTestLink",{_id:i,networks:t.networks,versions:t.versions,interactions:t.interactions||["0 click"],extras:t.extras||{}})).data}const su=({id:e,imageUrl:i,handleCardClick:t,selected:a,name:o,networkVersionSize:r,fileSizeLoading:s,showCheckBox:n,typeOfProduct:l,versionId:A,api:q,handleDownloadError:p,fetchFileUrl:u,urls:I,game:c,setIsConfirmActive:Z,creditDownload:K,getDownloadCount:S,disabled:W,user:U,setSafariCopyLink:k,isTest:h,urlType:b,setCdnModal:F,generateCDN:N,cdnUrl:v,selectedVersionIds:_})=>{const[X,H]=y.useState(!1),[f,g]=y.useState(""),[L,Y]=y.useState(!1),[C,M]=y.useState(!1),[D,J]=y.useState(!1),[E,O]=y.useState("download"),[B,z]=y.useState(!1),[P,Q]=y.useState(!1),[w,ti]=y.useState(!1),[si,oi]=y.useState(!1),[Zi,G]=y.useState(!1),[Mi,Fi]=y.useState(!1),[Ei,bi]=y.useState(!1),[$i,j]=y.useState(!1),[T,$]=y.useState(!1),[Ci,ui]=ji(na),[wi,Mt]=ji(dt),Ze=l==="Playable"?wi:!0,he={cdn:"Generate Link",adikteev:"Copy CDN"},Qi=()=>{t(e)},me=async(ni,gi,yi)=>{if(H(!0),l==="Flex"&&U.flex===!1&&U.customer!=="playableFactoryInternal"){p("|ACCESS|"),H(!1);return}if(_&&_.length>0&&gi==="download")try{if(!c||!c._id)throw new Error("Game data is required for multi-version download");const ie=await jo(q,c._id,{networks:[ni],versions:_}),ye=u+"/"+ie.url,Bi=await(await fetch(ye)).blob(),at=window.URL.createObjectURL(Bi),ge=document.createElement("a");return ge.href=at,ge.download=ie.url.split("/").pop()||"download.zip",document.body.appendChild(ge),ge.click(),window.URL.revokeObjectURL(at),document.body.removeChild(ge),H(!1),ie.url}catch(ie){console.log("multi-version single network download error",ie),H(!1),p(ie.message,ie);return}const Ue={molocoGenerateHtml:!1,urlType:b,responsiveType:"responsive"};if(Ce?gi==="copy"?(Q(!0),gi="download",Ue.molocoGenerateHtml=!0):z(!0):Ua&&(Ue.responsiveType=yi),console.log("getVersion",ni,gi,Ue),ni==="cdn"){F(!0),await N(!0),H(!1);return}return ni==="adikteev"&&(gi="copy"),new Promise((ie,ye)=>{ve(A,ni,Ze?I:null,gi,h,Ue).then(ee=>{H(!1),ie(ee),Q(!1),z(!1)}).catch(ee=>{H(!1),p(ee.message,ee),ye(ee),Q(!1),z(!1)})})},Et=async(ni=!1)=>{ni?Q(!0):z(!0);const gi={molocoGenerateHtml:!1};if(ni&&(gi.molocoGenerateHtml=!0),_&&_.length>0)try{if(!c||!c._id)throw new Error("Game data is required for multi-version download");const yi=await jo(q,c._id,{networks:["moloco"],versions:_,extras:gi}),Ue=u+"/"+yi.url,ye=await(await fetch(Ue)).blob(),ee=window.URL.createObjectURL(ye),Bi=document.createElement("a");return Bi.href=ee,Bi.download=yi.url.split("/").pop()||"download.zip",document.body.appendChild(Bi),Bi.click(),window.URL.revokeObjectURL(ee),document.body.removeChild(Bi),H(!1),ni?Q(!1):z(!1),J(!1),yi.url}catch(yi){console.log("multi-version single network download error",yi),H(!1),p(yi.message,yi);return}ve(A,o,Ze?I:null,"download",h,gi).then(yi=>{ni?Q(!1):z(!1),J(!1)}).catch(yi=>{p(yi.message,yi)})},Ra=async()=>{ti(!0);const ni=await ou(q,A,o,l);let gi=`${u}/${ni==null?void 0:ni.url}`;fe(gi)?(oi(!0),setTimeout(()=>oi(!1),2e3),ti(!1)):(k(gi),ti(!1))},Ce=o==="moloco"||o==="molocoV2",Ua=o==="google",La=Ci.find(ni=>ni.name===o);return m.jsxs(m.Fragment,{children:[m.jsxs("div",{style:{position:"relative",display:"flex",flexDirection:"column",gap:"20px",padding:"16px",borderColor:a?qi[l]:"lightgray",borderWidth:"1px",borderStyle:"solid",backgroundColor:"white",width:"100%",height:"175px",borderRadius:"8px",cursor:"pointer"},className:"border-hover-"+l,onClick:Qi,children:[m.jsxs("div",{style:{marginTop:o=="web"?"10px":"40px",display:"flex",justifyContent:"center"},children:[m.jsx("div",{style:{position:"absolute",right:"0",top:"0",padding:"8px"},children:m.jsx("div",{children:r&&r.map(ni=>ni.network).includes(o)?s?m.jsx("div",{style:{position:"absolute",right:"0",top:"0.5rem",padding:"0.5rem",height:"1.5rem",display:"flex",justifyContent:"center",alignItems:"center",marginRight:"2rem"},children:m.jsx(eu,{typeOfProduct:l})}):r.map(ni=>m.jsx("div",{style:{position:"absolute",right:"0",top:"0.5rem",padding:"0.5rem",marginRight:"2rem",fontSize:"1rem",height:"1.5rem",display:"flex",justifyContent:"center",alignItems:"center"},children:ni.network===o?ni.size.toString().slice(0,5)+"Mb":""},ni.network)):null})}),m.jsx("div",{style:{position:"absolute",top:"0",left:"0",padding:"0.5rem"},children:(l==="Playable"||l==="Ready"||l==="Flex")&&n&&m.jsx(iu,{checked:a,typeOfProduct:l,id:e})}),m.jsx("img",{onClick:Qi,style:{width:"30rem",height:o=="web"?"80px":"50px",objectFit:"contain"},src:i})]}),m.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"0.25rem"},children:[m.jsx(Go,{className:`${Ce?"w-1/2":"w-2/3"} border-hover-`+l,downloading:X,typeOfProduct:l,onClickDonwload:async ni=>{if(ni.stopPropagation(),console.log("user in onclickdownload",U),Ce&&U.customer==="playableFactoryInternal"){J(!0);return}else if(Ua)Fi(!0);else{g("download");const gi=I.iosUrl,yi=I.googleUrl;o==="cdn"&&K&&K.willSpendCredit&&!v||o!=="cdn"&&K&&K.willSpendCredit?(Z(!0),O("download"),Y(!0)):["Playable","Flex","Ready"].includes(l)&&(!gi||!yi)?(Z(!0),M(!0)):(M(!1),Y(!1),await me(o,"download"))}},children:Ce?m.jsxs(m.Fragment,{children:[!B&&m.jsxs(m.Fragment,{children:[m.jsx(bo,{style:{marginRight:"0.5rem",height:"1.5rem",width:"1rem",stroke:"dark-full"}}),U.customer!=="playableFactoryInternal"?pi.t("common:txt"):pi.t("common:download")]}),B&&m.jsx(Jt,{})]}):m.jsxs(m.Fragment,{children:[!X&&m.jsxs(m.Fragment,{children:[m.jsx(bo,{style:{marginRight:"0.5rem",height:"1.5rem",width:"1rem",stroke:"dark-full"}}),he[o]||pi.t("common:download")]}),X&&m.jsx(Jt,{})]})}),La&&La.downloadType.includes("copy")&&m.jsx(Go,{className:"w-1/3 border-hover-"+l,variant:"secondary",typeOfProduct:l,onClickDonwload:async ni=>{if(ni.stopPropagation(),Zi)return;g("copyLink");const gi=I.iosUrl,yi=I.googleUrl;K&&(K!=null&&K.willSpendCredit)?(O("copy"),Z(!0),Y(!0)):l!=="Import"&&(!gi||!yi)?(Z(!0),M(!0)):(Y(!1),M(!1),await me(o,"copy"),G(!0),setTimeout(()=>G(!1),2e3))},disabled:W,isCopied:Zi,children:m.jsx(ds,{className:"h-4 w-4 stroke-dark-full"})}),Ce&&U.customer!=="playableFactoryInternal"&&m.jsxs(Go,{className:"w-1/2 border-hover-"+l,typeOfProduct:l,onClickDonwload:async ni=>{ni.stopPropagation(),g("copyLink");const gi=I.iosUrl,yi=I.googleUrl;K&&(K!=null&&K.willSpendCredit)?(O("download"),Z(!0),Y(!0)):l!=="Import"&&(!gi||!yi)?(Z(!0),M(!0)):(Y(!1),M(!1),await Et(!0))},disabled:W,children:[!P&&m.jsxs(m.Fragment,{children:[m.jsx(bo,{style:{marginRight:"0.5rem",height:"1.5rem",width:"1rem",stroke:"dark-full"}}),pi.t("common:html")]}),P&&m.jsx(Jt,{})]})]})]}),L&&m.jsx(Qo,{creditConfirmType:E,handleCopyLink:async()=>{M(!1),Z(!1),await me(o,"copy")},download:async()=>{M(!1),Z(!1),await me(o,"download")},onClose:()=>{Y(!1),Z(!1)},getDownloadCount:S,typeOfProduct:l}),C&&m.jsx(tu,{onClose:()=>{M(!1),Z(!1)},iosLink:I.iosUrl,googleLink:I.googleUrl,buttonType:f,typeOfProduct:l,handleCopyLink:async()=>{M(!1),Z(!1),await me(o,"copy")},download:async()=>{M(!1),Z(!1),await me(o,"download")}}),D&&U.customer==="playableFactoryInternal"&&m.jsx(au,{onClose:()=>{J(!1)},handleDownload:Et,handleDownloadMolocoTest:Ra,downloadingMoloco:B,donwloadintMolocoTest:w,downloadingMolocoHtml:P,isCopiedMolocoTest:si,typeOfProduct:l}),Mi&&m.jsx(ru,{onClose:()=>{Fi(!1)},handleDownload:async ni=>{ni==="portrait"?bi(!0):ni==="landscape"?j(!0):$(!0),await me(o,"download",ni),ni==="portrait"?bi(!1):ni==="landscape"?j(!1):$(!1)},downloadingPortrait:Ei,downloadingLandscape:$i,downloadingResponsive:T,typeOfProduct:l})]})},nu=({networksVersionTotalSize:e,typeOfProduct:i,onClickMultiDownload:t,multiDownloading:a,selectedCount:o=0})=>{const r=qi[i]||"#EA580C",n=(()=>{const l={Flex:"#5A00CC",Ready:"#004A7F",Playable:"#C2410C",Import:"#0082CC",Fusion:"#0A0A0A"};return i&&l[i]?l[i]:"#C2410C"})();return m.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"8px"},children:a?m.jsx("div",{style:{display:"flex",width:"auto",minWidth:"12rem",height:"2.5rem",borderRadius:"0.5rem",alignItems:"center",justifyContent:"center",backgroundColor:r,padding:"0 1.5rem"},children:m.jsx(Jt,{})}):m.jsxs("button",{onClick:t,style:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",padding:"0.625rem 1.5rem",minWidth:"12rem",height:"2.5rem",backgroundColor:r,color:"white",fontSize:"0.875rem",fontWeight:"500",borderRadius:"0.5rem",border:`2px solid ${r}`,boxShadow:`0 0 0 2px white, 0 0 0 4px ${r}, 0 10px 15px -3px ${r}4D, 0 4px 6px -4px ${r}4D`,cursor:"pointer",transition:"all 0.2s ease",whiteSpace:"nowrap"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor=n,l.currentTarget.style.boxShadow=`0 0 0 2px white, 0 0 0 4px ${r}, 0 20px 25px -5px ${r}66, 0 8px 10px -6px ${r}66`},onMouseLeave:l=>{l.currentTarget.style.backgroundColor=r,l.currentTarget.style.boxShadow=`0 0 0 2px white, 0 0 0 4px ${r}, 0 10px 15px -3px ${r}4D, 0 4px 6px -4px ${r}4D`},children:[m.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{marginRight:"0.5rem"},children:[m.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),m.jsx("polyline",{points:"7 10 12 15 17 10"}),m.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}),m.jsxs("span",{children:["Download Selected (",o,")"]})]})})},Vn=({title:e,titleId:i})=>m.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[m.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),m.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]}),lu=({onClose:e,cdnUrl:i,generateCDN:t,cdnUploading:a,typeOfProduct:o="Playable"})=>{const[r,s]=y.useState(!1),n=o&&qi[o]?qi[o]:qi.Playable;return m.jsxs("div",{style:{position:"fixed",top:0,left:0,zIndex:50,display:"flex",height:"100%",width:"100%",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0, 0, 0, 0.2)"},onClick:e,children:[m.jsx("div",{onClick:e,style:{position:"absolute",zIndex:30,height:"100%",width:"100%",pointerEvents:"none"}}),m.jsx("div",{style:{position:"absolute",zIndex:50,display:"flex",flexDirection:"column",gap:"5px",minWidth:"500px",maxWidth:"728px",width:"90%",minHeight:"150px",borderRadius:"10px",backgroundColor:"white",padding:"40px 30px 50px",pointerEvents:"auto"},onClick:l=>{l.stopPropagation()},children:m.jsxs("div",{style:{display:"flex",gap:"5px",flexDirection:"column"},children:[m.jsxs("p",{style:{fontSize:"1.1rem",fontWeight:500,textAlign:"left",marginBottom:"10px",color:"#00a3ff",textDecoration:"underline",cursor:"pointer",width:"150px",display:"flex",gap:"10px",alignItems:"center",height:"28px"},onClick:()=>{a||t()},children:["Update Link",a&&m.jsx("div",{style:{width:"20px",height:"20px",border:"3px solid #f3f3f3",borderTop:"3px solid #00a3ff",borderRadius:"50%",animation:"spin 1s linear infinite"}})]}),m.jsx("style",{children:`
|
|
88
88
|
@keyframes spin {
|
|
89
89
|
0% { transform: rotate(0deg); }
|
|
90
90
|
100% { transform: rotate(360deg); }
|
|
91
91
|
}
|
|
92
|
-
`}),m.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:"#f6f6f6",height:"60px",color:"#737373"},children:[m.jsx("div",{style:{width:"66px",height:"100%",borderRight:"1px solid #e1e1e1",display:"flex",justifyContent:"center",alignItems:"center",flexShrink:0},children:m.jsx(Vn,{})}),m.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",position:"relative",maxWidth:"68%"},children:m.jsx("a",{style:{textAlign:"center",overflow:"hidden",textOverflow:"ellipsis"},href:i,target:"_blank",children:i||"No CDN link generated"})}),m.jsx("button",{onClick:()=>{if(!i||r)return;fe(i)&&(s(!0),setTimeout(()=>s(!1),2e3))},style:{cursor:!i||r?"default":"pointer",borderRadius:"0.375rem",backgroundColor:r?"#16A34A":i?n:"lightgray",color:"white",transition:"all 0.15s ease-linear",width:"100px",height:"46px",marginRight:"10px",flexShrink:0},children:r?pi.t("common:link_copied"):pi.t("common:copy")})]})]})})]})},Au=({onClose:e,url:i,typeOfProduct:t="Playable"})=>{const[a,o]=y.useState(!1),r=t&&qi[t]?qi[t]:qi.Playable;return m.jsxs("div",{style:{position:"fixed",top:0,left:0,zIndex:50,display:"flex",height:"100%",width:"100%",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0, 0, 0, 0.2)"},onClick:e,children:[m.jsx("div",{onClick:e,style:{position:"absolute",zIndex:30,height:"100%",width:"100%",pointerEvents:"none"}}),m.jsx("div",{style:{position:"absolute",zIndex:50,display:"flex",flexDirection:"column",gap:"5px",minWidth:"500px",maxWidth:"728px",width:"90%",minHeight:"150px",borderRadius:"10px",backgroundColor:"white",padding:"40px 30px 50px",pointerEvents:"auto"},onClick:s=>{s.stopPropagation()},children:m.jsx("div",{style:{display:"flex",gap:"5px",flexDirection:"column"},children:m.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:"#f6f6f6",height:"60px",color:"#737373"},children:[m.jsx("div",{style:{width:"66px",height:"100%",borderRight:"1px solid #e1e1e1",display:"flex",justifyContent:"center",alignItems:"center",flexShrink:0},children:m.jsx(Vn,{})}),m.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",position:"relative",maxWidth:"68%"},children:m.jsx("a",{style:{textAlign:"center",overflow:"hidden",textOverflow:"ellipsis"},href:i,target:"_blank",children:i||m.jsx("img",{width:"30px",src:Xe,alt:"pf-logo-gif"})})}),m.jsx("button",{onClick:()=>{if(!i||a)return;fe(i)&&(o(!0),setTimeout(()=>o(!1),2e3))},style:{cursor:!i||a?"default":"pointer",borderRadius:"0.375rem",backgroundColor:a?"#16A34A":i?r:"lightgray",color:"white",transition:"all 0.15s ease-linear",width:"100px",height:"46px",marginRight:"10px",flexShrink:0},children:a?pi.t("common:link_copied"):pi.t("common:copy")})]})})})]})},qu=({playable:e,creditDownload:i,visible:t,versionId:a,typeOfProduct:o,api:r,user:s,handleDownloadError:n,fetchFileUrl:l,urls:A,game:q,getDownloadCount:p,disabled:u,setSafariCopyLink:I,isTest:c,urlType:Z,allNetworksSelected:K,cdnModal:S,setCdnModal:W,cdnUrl:U,setCdnUrl:k,customer:h,selectedVersionIds:b})=>{const[F,N]=y.useState([]),[v,_]=y.useState([]),[X,H]=y.useState(!1),[f,g]=y.useState(""),[L,Y]=y.useState(!1),[C,M]=y.useState(!1),[D,J]=y.useState("download"),[E,O]=y.useState(!1),[B,z]=y.useState(!1),[P,Q]=y.useState(!1),[w,ti]=ji(Bs),[si,oi]=ji(Ds),[Zi]=ji(na),[G,Mi]=ji(dt),Fi=o==="Playable"?G:!0,Ei=async(T=!1)=>{T&&U||P||(Q(!0),ve(a,"cdn",Fi?A:null,null,!1,{}).then($=>{k($.url),Q(!1)}).catch($=>{n($.message,$),Q(!1)}))},bi=async T=>{if(T==="adikteev"||T==="cdn")return;const $=[...F];if(F.includes(T)){const Ci=$.findIndex(ui=>ui===T);$.splice(Ci,1),N($)}else $.push(T),N([...F,T]);Zi.filter(Ci=>[...$].includes(Ci.id)).map(Ci=>Ci.name)},$i=async()=>new Promise(async(T,$)=>{const Ci=Zi.filter(ui=>[...F].includes(ui.id)).map(ui=>ui.name);if(Y(!0),b&&b.length>0)try{if(!q||!q._id)throw new Error("Game data is required for multi-version download");const ui=await jo(r,q._id,{networks:Ci,versions:b}),wi=l+"/"+ui.url,Ze=await(await fetch(wi)).blob(),he=window.URL.createObjectURL(Ze),Qi=document.createElement("a");Qi.href=he,Qi.download=ui.url.split("/").pop()||"download.zip",document.body.appendChild(Qi),Qi.click(),window.URL.revokeObjectURL(he),document.body.removeChild(Qi),Y(!1),T(ui.url)}catch(ui){console.log("multi-version download error",ui),Y(!1),n(ui.message,ui),$(ui)}else kq(a,A,Ci,{urlType:Z}).then(ui=>{Y(!1),T(ui)}).catch(ui=>{console.log("get multi download err"),Y(!1),n(ui.message,ui),$(ui)})}),j=async()=>{A.iosUrl,A.googleUrl,i&&i.willSpendCredit?(M(!0),J("download"),O(!0)):(O(!1),await $i())};return y.useEffect(()=>{const T=Zi.filter($=>{var Ci;return b&&b.length>0?!0:i&&((Ci=i==null?void 0:i.networks)==null?void 0:Ci.length)>0?typeof $=="string"?i==null?void 0:i.networks.includes($):i==null?void 0:i.networks.includes($.name):o==="Import"?e==null?void 0:e.networks.filter(ui=>ui.status==="paid").some(ui=>ui.name===$.name):$?!0:e==null?void 0:e.networks.includes($)}).filter($=>$.name==="voodoo"?s.customer==="customer:20":!0).filter($=>$.id!=="adikteev"&&$.id!=="cdn").map($=>$.id);console.log("networks",T),N(K?T:[])},[K,b,Zi,i,o,e,q,s.customer]),m.jsxs("div",{style:{position:"relative",flex:1,display:"flex",flexDirection:"column",overflow:"hidden",paddingRight:o==="Flex"?"0.25rem":void 0},children:[m.jsx("div",{style:{flex:1,overflowY:C?"hidden":"auto",padding:"1.5rem",paddingTop:"0",paddingBottom:F.length>0?"5rem":"1.5rem"},children:m.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, minmax(0, 1fr))",gap:"0.75rem",maxWidth:"100%"},children:t&&Zi.filter(T=>{var $;if(b&&b.length>0)return!0;if(i&&(($=i==null?void 0:i.networks)==null?void 0:$.length)>0)return typeof T=="string"?i==null?void 0:i.networks.includes(T):i==null?void 0:i.networks.includes(T.name);if(o==="Import")return e==null?void 0:e.networks.filter(Ci=>Ci.status==="paid").some(Ci=>Ci.name===T.name);if(!T)e==null||e.networks.includes(T);else return T}).filter(T=>T.name==="voodoo"?s.customer==="customer:20":!0).map(T=>{let $=T.imageSrc;if(T.name==="web"){let Ci="web_"+o.toLowerCase()+".png";$=$.replace("web.png",Ci)}return m.jsx(su,{id:T.id,name:T.name,imageUrl:$,selected:F.includes(T.id),handleCardClick:bi,networkVersionSize:v,fileSizeLoading:X,showCheckBox:T.id!=="adikteev"&&T.id!=="cdn",typeOfProduct:o,versionId:a,api:r,handleDownloadError:n,fetchFileUrl:l,urls:A,game:q,creditDownload:i,setIsConfirmActive:M,getDownloadCount:p,disabled:u,user:s,setSafariCopyLink:I,isTest:c,urlType:Z,setCdnModal:W,generateCDN:Ei,cdnUrl:U,selectedVersionIds:b},T.id)})})}),F.length>0&&(o==="Playable"||o==="Ready"||o==="Flex")&&m.jsx("div",{style:{position:"absolute",bottom:"1rem",left:"50%",transform:"translateX(-50%)",display:"flex",flexDirection:"column",zIndex:20},children:m.jsx(nu,{onClickMultiDownload:j,networksVersionTotalSize:f,typeOfProduct:o,multiDownloading:L,selectedCount:F.length})}),S&&m.jsx(lu,{onClose:()=>{W(!1),p()},versionId:a,urls:A,handleDownloadError:n,cdnUrl:U,setCdnUrl:k,generateCDN:async()=>{if(!P){if(!(i!=null&&i.willSpendCredit)){Ei();return}if(s.customer==="playableFactoryInternal"){Ei();return}z(!0)}},cdnUploading:P,typeOfProduct:o}),si&&m.jsx(Au,{onClose:()=>{oi(!1)},url:w,typeOfProduct:o}),B&&m.jsx(Qo,{width:"100%",height:"100%",creditConfirmType:D,handleCopyLink:async()=>{},download:async()=>{O(!1),z(!1),Ei()},onClose:()=>{O(!1),z(!1),Q(!1)},getDownloadCount:p,typeOfProduct:o}),E&&m.jsx(Qo,{creditConfirmType:D,handleCopyLink:async()=>{},download:async()=>{O(!1),M(!1),await $i()},onClose:()=>{O(!1),M(!1)},getDownloadCount:p,typeOfProduct:o})]})};async function mu(e,i){return(await Ki.post(i+"/getFlexDownloadCount",e)).data}async function pu(e,i){try{return(await Ki.post(i+"/findGame",{_id:e})).data}catch{}}async function uu(e,i){return(await Ki.post(i+"/getPlayableVersionMarketLink",{_id:e})).data}async function Iu(e,i){return(await Ki.post(i+"/getFlexData",{_id:e})).data}async function Ku(e,i){return(await Ki.post(i+"/getImportedPlayable",{id:e})).data}async function cu(e,i){return(await Ki.post(i+"/getReadyDownloadCount",e)).data}async function du(e,i){try{return(await Ki.post(i+"/findCustomer",{_id:e})).data}catch{}}const Jn=["web","adcolony","applovin","chartboost","crossinstall","fb","google","google360","ironsource","lifestreet","liftoff","mobvista","nucleo","tapjoy","toutiao","unity","vungle","moloco","cdn"];let kn=null;const Zu=({playableId:e,versionId:i,gameId:t,typeOfProduct:a,visible:o,api:r,user:s,title:n,handleDownloadError:l,fetchFileUrl:A,fileSize:q,setFileSize:p,setSafariCopyLink:u,iosLink:I,androidLink:c,setIosLink:Z,setAndroidLink:K,urlType:S,setUrlType:W,selectedVersionIds:U})=>{const[k,h]=y.useState(null),[b,F]=y.useState(null),[N,v]=y.useState(null),[_,X]=y.useState(!1),[H,f]=y.useState(!0),[g,L]=y.useState(window.innerWidth),[Y,C]=y.useState(!1),[M,D]=y.useState(!1),[J,E]=y.useState("");ji(Bs),ji(Ds);const[O,B]=ji(Xs),[z,P]=ji(dt);y.useEffect(()=>{!J&&a!=="Fusion"&&Mq(i).then(j=>{j!=null&&j.exist&&E(j.uploadPath)})},[J]);const[Q,w]=y.useState(!1);y.useEffect(()=>{},[Q]),y.useEffect(()=>{const j=()=>{L(window.innerWidth)};return window.addEventListener("resize",j),()=>{window.removeEventListener("resize",j)}},[]);const ti=async()=>{X(!0);const j=await Ss(e,r);return j!=null&&j.networks||(j.networks=Jn),h(j),j},si=(j,T)=>{clearTimeout(kn),kn=setTimeout(()=>{a==="Playable"&&!z||Vq(i,{iosUrl:j,googleUrl:T},{urlType:S})},1e3)},oi=j=>{Z(j),si(j,c)},Zi=j=>{K(j),si(I,j)},G=async(j,T)=>{var $,Ci;try{let ui;if(a==="Playable"||a==="Ready"){const wi=await uu(i,r);if(wi){Z(wi.iosLink),K(wi.androidLink),X(!1);return}if(j&&(j.iosUrl||j.googleUrl)){Z(j.iosUrl),K(j.googleUrl),X(!1);return}if(T&&T.html){const Mt=`${A}/${T.html}?t=${Date.now()}`;let Ze=await fetch(Mt).then(me=>me.text());const he=(($=Ze.match(/var\s+iosLink\s*=\s*['|"](https?[^\s'"]+)['|"]/))==null?void 0:$.at(1))||"";Z(he);const Qi=((Ci=Ze.match(/var\s+androidLink\s*=\s*['|"](https?[^\s'"]+)['|"]/))==null?void 0:Ci.at(1))||"";K(Qi),X(!1)}else K(""),Z(""),X(!1)}else if(a==="Flex"){const wi=await Iu(i,r);if(wi.googleUrl||wi.iosUrl){K(wi.googleUrl),Z(wi.iosUrl),X(!1);return}j&&(j.iosUrl||j.googleUrl)?(Z(j.iosUrl),K(j.googleUrl),X(!1)):(K(""),Z(""),X(!1))}else a==="Fusion"&&(j&&(j.iosUrl||j.googleUrl)?(Z(j.iosUrl),K(j.googleUrl),X(!1)):(K(""),Z(""),X(!1)))}catch(ui){l(ui.response.data.error.msg)}},Mi=async()=>{X(!0);let j;a==="Flex"?j=await mu({_id:i},r):a==="Ready"&&(j=await cu({_id:i},r)),j&&(["admin","pm","tester","sales"].includes(s.role)?v({...j,networks:O}):(console.log("result",j),a==="Ready"&&!j.canDownload?v({...j,networks:Jn}):(console.log("result",j),v({...j,networks:j.networks})))),X(!1)},Fi=async()=>await pu(t,r),[Ei,bi]=y.useState(null),$i=async j=>await du(j,r);return y.useEffect(()=>{o||(h(null),F(null),v(null),p(null),bi(null)),o&&(a==="Playable"?Fi().then(j=>{F(j),j&&$i(j.customer).then(T=>{bi(T||null)}),ti().then(T=>{G(null,T)}),f(!1)}):a==="Ready"?Mi().then(j=>{ti().then(T=>{G(null,T),f(!1),T!=null&&T.customer&&$i(T.customer).then($=>{bi($||null)})})}):a==="Flex"?Mi().then(j=>{f(!1),Fi().then(T=>{o&&(G(T,null),f(!1),F(T),T&&$i(T.customer).then($=>{bi($||null)}))})}):a==="Import"?Ku(i,r).then(j=>{h(j),Z(j.iosUrl||""),K(j.googleUrl||""),X(!1),f(!1)}):a==="Fusion"&&(f(!1),Fi().then(j=>{o&&(G(j,null),f(!1),F({...j,networks:O.filter(T=>T!=="cdn")}),j&&$i(j.customer).then(T=>{bi(T||null)}))})))},[t,e,i,o]),m.jsxs("div",{style:{position:"relative",display:"flex",height:g>1440?"650px":g<768?"auto":"600px",width:g>1440?"695px":g<768?"100%":"700px",flex:1,flexDirection:"column",borderRadius:"rounded",paddingTop:"0px"},children:[g>=768&&m.jsx("div",{style:{position:"absolute",left:0,top:"1.5rem",bottom:"1.5rem",width:"1px",backgroundColor:"#D1D5DB"}}),m.jsx($p,{title:n,typeOfProduct:a,fileSize:q,urls:{iosUrl:I,googleUrl:c},handleIosChange:oi,handleGoogleChange:Zi,disabled:H,api:r,creditDownload:N,user:s,isTest:Y,setIsTest:C,urlType:S,setUrlType:W,allNetworksSelected:Q,setAllNetworksSelected:w,versionId:i,customerId:(Ei==null?void 0:Ei._id)||""}),_?m.jsx("div",{style:{height:"100%",width:"100%",display:"flex",justifyContent:"center"},children:m.jsx(Jt,{isNetworksLoading:!0,isLight:!1})}):(k||N||a==="Fusion")&&(a==="Flex"?b:!0)&&!_&&I!=="Loading..."&&c!=="Loading..."&&m.jsx(qu,{playable:k,creditDownload:N,visible:o,versionId:i,typeOfProduct:a,api:r,user:s,handleDownloadError:l,fetchFileUrl:A,urls:{iosUrl:I,googleUrl:c},game:b,getDownloadCount:Mi,disabled:H,setSafariCopyLink:u,isTest:Y,urlType:S,allNetworksSelected:Q,cdnModal:M,setCdnModal:D,cdnUrl:J,setCdnUrl:E,customer:Ei??void 0,selectedVersionIds:U})]})};async function Su(e,i=!1,t){return(await Ki.post(e+"/getPlayableVersionNames",{isFlex:i,versionIds:t})).data}const hu=({selectedVersionIds:e,api:i,fetchFileUrl:t})=>{const[a,o]=y.useState([]);return y.useEffect(()=>{const r=e.map(n=>({versionId:n,versionName:"Loading...",size:null,status:"loading"}));o(r),(async()=>{try{const n=await Su(i,!1,e);o(l=>l.map((A,q)=>{var p;return{...A,versionName:((p=n[q])==null?void 0:p.name)||`Version ${A.versionId}`}})),e.forEach(async(l,A)=>{try{const q=await ve(l,"preview",null,null,!1);o(p=>{const u=[...p];return u[A]={...u[A],size:q.size,status:q.size>=5?"exceeded":"ok"},u})}catch(q){console.error(`Error checking version ${l}:`,q),o(p=>{const u=[...p];return u[A]={...u[A],status:"ok"},u})}})}catch(n){console.error("Error fetching version names:",n)}})()},[e,i]),m.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"300px",height:"100%",padding:"1rem",paddingTop:"3.5rem",overflowY:"auto"},children:[m.jsx("h2",{style:{fontSize:"1.125rem",fontWeight:"600",marginBottom:"0.75rem",color:"#1F2937"},children:"Versions"}),m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem"},children:a.map(r=>m.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0.625rem 0.75rem",backgroundColor:"#F9FAFB",borderRadius:"0.5rem",border:"1px solid #E5E7EB"},children:[m.jsx("span",{style:{fontSize:"0.875rem",color:"#374151",fontWeight:"500"},children:r.versionName}),r.status==="loading"?m.jsx("img",{width:"20px",height:"20px",src:Xe,alt:"loading"}):r.status==="exceeded"?m.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-end"},children:[m.jsx("div",{style:{width:"20px",height:"20px",borderRadius:"50%",backgroundColor:"#EF4444",display:"flex",alignItems:"center",justifyContent:"center"},children:m.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.jsx("path",{d:"M9 3L3 9M3 3l6 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})})}),m.jsx("span",{style:{fontSize:"0.75rem",color:"#EF4444",marginTop:"0.25rem"},children:"Exceeds 5 MB"})]}):m.jsx("div",{style:{width:"20px",height:"20px",borderRadius:"50%",backgroundColor:"#10B981",display:"flex",alignItems:"center",justifyContent:"center"},children:m.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.jsx("path",{d:"M2.5 6.5L4.5 8.5L9.5 3.5",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},r.versionId))})]})},kK="",ce=Object.create(null);ce.open="0",ce.close="1",ce.ping="2",ce.pong="3",ce.message="4",ce.upgrade="5",ce.noop="6";const Ca=Object.create(null);Object.keys(ce).forEach(e=>{Ca[ce[e]]=e});const Fo={type:"error",data:"parser error"},Wn=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Mn=typeof ArrayBuffer=="function",En=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,No=({type:e,data:i},t,a)=>Wn&&i instanceof Blob?t?a(i):Rn(i,a):Mn&&(i instanceof ArrayBuffer||En(i))?t?a(i):Rn(new Blob([i]),a):a(ce[e]+(i||"")),Rn=(e,i)=>{const t=new FileReader;return t.onload=function(){const a=t.result.split(",")[1];i("b"+(a||""))},t.readAsDataURL(e)};function Un(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let xo;function Cu(e,i){if(Wn&&e.data instanceof Blob)return e.data.arrayBuffer().then(Un).then(i);if(Mn&&(e.data instanceof ArrayBuffer||En(e.data)))return i(Un(e.data));No(e,!1,t=>{xo||(xo=new TextEncoder),i(xo.encode(t))})}const Ln="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",kt=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<Ln.length;e++)kt[Ln.charCodeAt(e)]=e;const yu=e=>{let i=e.length*.75,t=e.length,a,o=0,r,s,n,l;e[e.length-1]==="="&&(i--,e[e.length-2]==="="&&i--);const A=new ArrayBuffer(i),q=new Uint8Array(A);for(a=0;a<t;a+=4)r=kt[e.charCodeAt(a)],s=kt[e.charCodeAt(a+1)],n=kt[e.charCodeAt(a+2)],l=kt[e.charCodeAt(a+3)],q[o++]=r<<2|s>>4,q[o++]=(s&15)<<4|n>>2,q[o++]=(n&3)<<6|l&63;return A},gu=typeof ArrayBuffer=="function",Oo=(e,i)=>{if(typeof e!="string")return{type:"message",data:Yn(e,i)};const t=e.charAt(0);return t==="b"?{type:"message",data:Vu(e.substring(1),i)}:Ca[t]?e.length>1?{type:Ca[t],data:e.substring(1)}:{type:Ca[t]}:Fo},Vu=(e,i)=>{if(gu){const t=yu(e);return Yn(t,i)}else return{base64:!0,data:e}},Yn=(e,i)=>{switch(i){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},Gn=String.fromCharCode(30),Ju=(e,i)=>{const t=e.length,a=new Array(t);let o=0;e.forEach((r,s)=>{No(r,!1,n=>{a[s]=n,++o===t&&i(a.join(Gn))})})},ku=(e,i)=>{const t=e.split(Gn),a=[];for(let o=0;o<t.length;o++){const r=Oo(t[o],i);if(a.push(r),r.type==="error")break}return a};function Wu(){return new TransformStream({transform(e,i){Cu(e,t=>{const a=t.length;let o;if(a<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,a);else if(a<65536){o=new Uint8Array(3);const r=new DataView(o.buffer);r.setUint8(0,126),r.setUint16(1,a)}else{o=new Uint8Array(9);const r=new DataView(o.buffer);r.setUint8(0,127),r.setBigUint64(1,BigInt(a))}e.data&&typeof e.data!="string"&&(o[0]|=128),i.enqueue(o),i.enqueue(t)})}})}let zo;function ya(e){return e.reduce((i,t)=>i+t.length,0)}function ga(e,i){if(e[0].length===i)return e.shift();const t=new Uint8Array(i);let a=0;for(let o=0;o<i;o++)t[o]=e[0][a++],a===e[0].length&&(e.shift(),a=0);return e.length&&a<e[0].length&&(e[0]=e[0].slice(a)),t}function Mu(e,i){zo||(zo=new TextDecoder);const t=[];let a=0,o=-1,r=!1;return new TransformStream({transform(s,n){for(t.push(s);;){if(a===0){if(ya(t)<1)break;const l=ga(t,1);r=(l[0]&128)===128,o=l[0]&127,o<126?a=3:o===126?a=1:a=2}else if(a===1){if(ya(t)<2)break;const l=ga(t,2);o=new DataView(l.buffer,l.byteOffset,l.length).getUint16(0),a=3}else if(a===2){if(ya(t)<8)break;const l=ga(t,8),A=new DataView(l.buffer,l.byteOffset,l.length),q=A.getUint32(0);if(q>Math.pow(2,53-32)-1){n.enqueue(Fo);break}o=q*Math.pow(2,32)+A.getUint32(4),a=3}else{if(ya(t)<o)break;const l=ga(t,o);n.enqueue(Oo(r?l:zo.decode(l),i)),a=0}if(o===0||o>e){n.enqueue(Fo);break}}}})}const bn=4;function Ji(e){if(e)return Eu(e)}function Eu(e){for(var i in Ji.prototype)e[i]=Ji.prototype[i];return e}Ji.prototype.on=Ji.prototype.addEventListener=function(e,i){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(i),this},Ji.prototype.once=function(e,i){function t(){this.off(e,t),i.apply(this,arguments)}return t.fn=i,this.on(e,t),this},Ji.prototype.off=Ji.prototype.removeListener=Ji.prototype.removeAllListeners=Ji.prototype.removeEventListener=function(e,i){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+e];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var a,o=0;o<t.length;o++)if(a=t[o],a===i||a.fn===i){t.splice(o,1);break}return t.length===0&&delete this._callbacks["$"+e],this},Ji.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var i=new Array(arguments.length-1),t=this._callbacks["$"+e],a=1;a<arguments.length;a++)i[a-1]=arguments[a];if(t){t=t.slice(0);for(var a=0,o=t.length;a<o;++a)t[a].apply(this,i)}return this},Ji.prototype.emitReserved=Ji.prototype.emit,Ji.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},Ji.prototype.hasListeners=function(e){return!!this.listeners(e).length};const Va=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?i=>Promise.resolve().then(i):(i,t)=>t(i,0))(),_i=(()=>typeof self<"u"?self:typeof window<"u"?window:Function("return this")())(),Ru="arraybuffer";function WK(){}function Qn(e,...i){return i.reduce((t,a)=>(e.hasOwnProperty(a)&&(t[a]=e[a]),t),{})}const Uu=_i.setTimeout,Lu=_i.clearTimeout;function Ja(e,i){i.useNativeTimers?(e.setTimeoutFn=Uu.bind(_i),e.clearTimeoutFn=Lu.bind(_i)):(e.setTimeoutFn=_i.setTimeout.bind(_i),e.clearTimeoutFn=_i.clearTimeout.bind(_i))}const Yu=1.33;function Gu(e){return typeof e=="string"?bu(e):Math.ceil((e.byteLength||e.size)*Yu)}function bu(e){let i=0,t=0;for(let a=0,o=e.length;a<o;a++)i=e.charCodeAt(a),i<128?t+=1:i<2048?t+=2:i<55296||i>=57344?t+=3:(a++,t+=4);return t}function jn(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Qu(e){let i="";for(let t in e)e.hasOwnProperty(t)&&(i.length&&(i+="&"),i+=encodeURIComponent(t)+"="+encodeURIComponent(e[t]));return i}function ju(e){let i={},t=e.split("&");for(let a=0,o=t.length;a<o;a++){let r=t[a].split("=");i[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return i}class Fu extends Error{constructor(i,t,a){super(i),this.description=t,this.context=a,this.type="TransportError"}}class To extends Ji{constructor(i){super(),this.writable=!1,Ja(this,i),this.opts=i,this.query=i.query,this.socket=i.socket,this.supportsBinary=!i.forceBase64}onError(i,t,a){return super.emitReserved("error",new Fu(i,t,a)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(i){this.readyState==="open"&&this.write(i)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(i){const t=Oo(i,this.socket.binaryType);this.onPacket(t)}onPacket(i){super.emitReserved("packet",i)}onClose(i){this.readyState="closed",super.emitReserved("close",i)}pause(i){}createUri(i,t={}){return i+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const i=this.opts.hostname;return i.indexOf(":")===-1?i:"["+i+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(i){const t=Qu(i);return t.length?"?"+t:""}}class Nu extends To{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(i){this.readyState="pausing";const t=()=>{this.readyState="paused",i()};if(this._polling||!this.writable){let a=0;this._polling&&(a++,this.once("pollComplete",function(){--a||t()})),this.writable||(a++,this.once("drain",function(){--a||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(i){const t=a=>{if(this.readyState==="opening"&&a.type==="open"&&this.onOpen(),a.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(a)};ku(i,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const i=()=>{this.write([{type:"close"}])};this.readyState==="open"?i():this.once("open",i)}write(i){this.writable=!1,Ju(i,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const i=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=jn()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(i,t)}}let Fn=!1;try{Fn=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const xu=Fn;function Ou(){}class zu extends Nu{constructor(i){if(super(i),typeof location<"u"){const t=location.protocol==="https:";let a=location.port;a||(a=t?"443":"80"),this.xd=typeof location<"u"&&i.hostname!==location.hostname||a!==i.port}}doWrite(i,t){const a=this.request({method:"POST",data:i});a.on("success",t),a.on("error",(o,r)=>{this.onError("xhr post error",o,r)})}doPoll(){const i=this.request();i.on("data",this.onData.bind(this)),i.on("error",(t,a)=>{this.onError("xhr poll error",t,a)}),this.pollXhr=i}}class de extends Ji{constructor(i,t,a){super(),this.createRequest=i,Ja(this,a),this._opts=a,this._method=a.method||"GET",this._uri=t,this._data=a.data!==void 0?a.data:null,this._create()}_create(){var i;const t=Qn(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const a=this._xhr=this.createRequest(t);try{a.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){a.setDisableHeaderCheck&&a.setDisableHeaderCheck(!0);for(let o in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(o)&&a.setRequestHeader(o,this._opts.extraHeaders[o])}}catch{}if(this._method==="POST")try{a.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{a.setRequestHeader("Accept","*/*")}catch{}(i=this._opts.cookieJar)===null||i===void 0||i.addCookies(a),"withCredentials"in a&&(a.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(a.timeout=this._opts.requestTimeout),a.onreadystatechange=()=>{var o;a.readyState===3&&((o=this._opts.cookieJar)===null||o===void 0||o.parseCookies(a.getResponseHeader("set-cookie"))),a.readyState===4&&(a.status===200||a.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof a.status=="number"?a.status:0)},0))},a.send(this._data)}catch(o){this.setTimeoutFn(()=>{this._onError(o)},0);return}typeof document<"u"&&(this._index=de.requestsCount++,de.requests[this._index]=this)}_onError(i){this.emitReserved("error",i,this._xhr),this._cleanup(!0)}_cleanup(i){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=Ou,i)try{this._xhr.abort()}catch{}typeof document<"u"&&delete de.requests[this._index],this._xhr=null}}_onLoad(){const i=this._xhr.responseText;i!==null&&(this.emitReserved("data",i),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}if(de.requestsCount=0,de.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Nn);else if(typeof addEventListener=="function"){const e="onpagehide"in _i?"pagehide":"unload";addEventListener(e,Nn,!1)}}function Nn(){for(let e in de.requests)de.requests.hasOwnProperty(e)&&de.requests[e].abort()}const Tu=function(){const e=xn({xdomain:!1});return e&&e.responseType!==null}();class wu extends zu{constructor(i){super(i);const t=i&&i.forceBase64;this.supportsBinary=Tu&&!t}request(i={}){return Object.assign(i,{xd:this.xd},this.opts),new de(xn,this.uri(),i)}}function xn(e){const i=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!i||xu))return new XMLHttpRequest}catch{}if(!i)try{return new _i[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const On=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Bu extends To{get name(){return"websocket"}doOpen(){const i=this.uri(),t=this.opts.protocols,a=On?{}:Qn(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(a.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(i,t,a)}catch(o){return this.emitReserved("error",o)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=i=>this.onClose({description:"websocket connection closed",context:i}),this.ws.onmessage=i=>this.onData(i.data),this.ws.onerror=i=>this.onError("websocket error",i)}write(i){this.writable=!1;for(let t=0;t<i.length;t++){const a=i[t],o=t===i.length-1;No(a,this.supportsBinary,r=>{try{this.doWrite(a,r)}catch{}o&&Va(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const i=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=jn()),this.supportsBinary||(t.b64=1),this.createUri(i,t)}}const wo=_i.WebSocket||_i.MozWebSocket;class Du extends Bu{createSocket(i,t,a){return On?new wo(i,t,a):t?new wo(i,t):new wo(i)}doWrite(i,t){this.ws.send(t)}}class Xu extends To{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(i){return this.emitReserved("error",i)}this._transport.closed.then(()=>{this.onClose()}).catch(i=>{this.onError("webtransport error",i)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(i=>{const t=Mu(Number.MAX_SAFE_INTEGER,this.socket.binaryType),a=i.readable.pipeThrough(t).getReader(),o=Wu();o.readable.pipeTo(i.writable),this._writer=o.writable.getWriter();const r=()=>{a.read().then(({done:n,value:l})=>{n||(this.onPacket(l),r())}).catch(n=>{})};r();const s={type:"open"};this.query.sid&&(s.data=`{"sid":"${this.query.sid}"}`),this._writer.write(s).then(()=>this.onOpen())})})}write(i){this.writable=!1;for(let t=0;t<i.length;t++){const a=i[t],o=t===i.length-1;this._writer.write(a).then(()=>{o&&Va(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var i;(i=this._transport)===null||i===void 0||i.close()}}const fu={websocket:Du,webtransport:Xu,polling:wu},vu=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Hu=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Bo(e){if(e.length>8e3)throw"URI too long";const i=e,t=e.indexOf("["),a=e.indexOf("]");t!=-1&&a!=-1&&(e=e.substring(0,t)+e.substring(t,a).replace(/:/g,";")+e.substring(a,e.length));let o=vu.exec(e||""),r={},s=14;for(;s--;)r[Hu[s]]=o[s]||"";return t!=-1&&a!=-1&&(r.source=i,r.host=r.host.substring(1,r.host.length-1).replace(/;/g,":"),r.authority=r.authority.replace("[","").replace("]","").replace(/;/g,":"),r.ipv6uri=!0),r.pathNames=Pu(r,r.path),r.queryKey=_u(r,r.query),r}function Pu(e,i){const t=/\/{2,9}/g,a=i.replace(t,"/").split("/");return(i.slice(0,1)=="/"||i.length===0)&&a.splice(0,1),i.slice(-1)=="/"&&a.splice(a.length-1,1),a}function _u(e,i){const t={};return i.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(a,o,r){o&&(t[o]=r)}),t}const Do=typeof addEventListener=="function"&&typeof removeEventListener=="function",ka=[];Do&&addEventListener("offline",()=>{ka.forEach(e=>e())},!1);class Re extends Ji{constructor(i,t){if(super(),this.binaryType=Ru,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,i&&typeof i=="object"&&(t=i,i=null),i){const a=Bo(i);t.hostname=a.host,t.secure=a.protocol==="https"||a.protocol==="wss",t.port=a.port,a.query&&(t.query=a.query)}else t.host&&(t.hostname=Bo(t.host).host);Ja(this,t),this.secure=t.secure!=null?t.secure:typeof location<"u"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=t.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(a=>{const o=a.prototype.name;this.transports.push(o),this._transportsByName[o]=a}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=ju(this.opts.query)),Do&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},ka.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(i){const t=Object.assign({},this.opts.query);t.EIO=bn,t.transport=i,this.id&&(t.sid=this.id);const a=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[i]);return new this._transportsByName[i](a)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const i=this.opts.rememberUpgrade&&Re.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(i);t.open(),this.setTransport(t)}setTransport(i){this.transport&&this.transport.removeAllListeners(),this.transport=i,i.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",t=>this._onClose("transport close",t))}onOpen(){this.readyState="open",Re.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(i){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",i),this.emitReserved("heartbeat"),i.type){case"open":this.onHandshake(JSON.parse(i.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const t=new Error("server error");t.code=i.data,this._onError(t);break;case"message":this.emitReserved("data",i.data),this.emitReserved("message",i.data);break}}onHandshake(i){this.emitReserved("handshake",i),this.id=i.sid,this.transport.query.sid=i.sid,this._pingInterval=i.pingInterval,this._pingTimeout=i.pingTimeout,this._maxPayload=i.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const i=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+i,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},i),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const i=this._getWritablePackets();this.transport.send(i),this._prevBufferLen=i.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let a=0;a<this.writeBuffer.length;a++){const o=this.writeBuffer[a].data;if(o&&(t+=Gu(o)),a>0&&t>this._maxPayload)return this.writeBuffer.slice(0,a);t+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const i=Date.now()>this._pingTimeoutTime;return i&&(this._pingTimeoutTime=0,Va(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),i}write(i,t,a){return this._sendPacket("message",i,t,a),this}send(i,t,a){return this._sendPacket("message",i,t,a),this}_sendPacket(i,t,a,o){if(typeof t=="function"&&(o=t,t=void 0),typeof a=="function"&&(o=a,a=null),this.readyState==="closing"||this.readyState==="closed")return;a=a||{},a.compress=a.compress!==!1;const r={type:i,data:t,options:a};this.emitReserved("packetCreate",r),this.writeBuffer.push(r),o&&this.once("flush",o),this.flush()}close(){const i=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),i()},a=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?a():i()}):this.upgrading?a():i()),this}_onError(i){if(Re.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",i),this._onClose("transport error",i)}_onClose(i,t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Do&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const a=ka.indexOf(this._offlineEventListener);a!==-1&&ka.splice(a,1)}this.readyState="closed",this.id=null,this.emitReserved("close",i,t),this.writeBuffer=[],this._prevBufferLen=0}}}Re.protocol=bn;class $u extends Re{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let i=0;i<this._upgrades.length;i++)this._probe(this._upgrades[i])}_probe(i){let t=this.createTransport(i),a=!1;Re.priorWebsocketSuccess=!1;const o=()=>{a||(t.send([{type:"ping",data:"probe"}]),t.once("packet",p=>{if(!a)if(p.type==="pong"&&p.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;Re.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{a||this.readyState!=="closed"&&(q(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const u=new Error("probe error");u.transport=t.name,this.emitReserved("upgradeError",u)}}))};function r(){a||(a=!0,q(),t.close(),t=null)}const s=p=>{const u=new Error("probe error: "+p);u.transport=t.name,r(),this.emitReserved("upgradeError",u)};function n(){s("transport closed")}function l(){s("socket closed")}function A(p){t&&p.name!==t.name&&r()}const q=()=>{t.removeListener("open",o),t.removeListener("error",s),t.removeListener("close",n),this.off("close",l),this.off("upgrading",A)};t.once("open",o),t.once("error",s),t.once("close",n),this.once("close",l),this.once("upgrading",A),this._upgrades.indexOf("webtransport")!==-1&&i!=="webtransport"?this.setTimeoutFn(()=>{a||t.open()},200):t.open()}onHandshake(i){this._upgrades=this._filterUpgrades(i.upgrades),super.onHandshake(i)}_filterUpgrades(i){const t=[];for(let a=0;a<i.length;a++)~this.transports.indexOf(i[a])&&t.push(i[a]);return t}}let iI=class extends $u{constructor(i,t={}){const a=typeof i=="object"?i:t;(!a.transports||a.transports&&typeof a.transports[0]=="string")&&(a.transports=(a.transports||["polling","websocket","webtransport"]).map(o=>fu[o]).filter(o=>!!o)),super(i,a)}};function eI(e,i="",t){let a=e;t=t||typeof location<"u"&&location,e==null&&(e=t.protocol+"//"+t.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=t.protocol+e:e=t.host+e),/^(https?|wss?):\/\//.test(e)||(typeof t<"u"?e=t.protocol+"//"+e:e="https://"+e),a=Bo(e)),a.port||(/^(http|ws)$/.test(a.protocol)?a.port="80":/^(http|ws)s$/.test(a.protocol)&&(a.port="443")),a.path=a.path||"/";const r=a.host.indexOf(":")!==-1?"["+a.host+"]":a.host;return a.id=a.protocol+"://"+r+":"+a.port+i,a.href=a.protocol+"://"+r+(t&&t.port===a.port?"":":"+a.port),a}const tI=typeof ArrayBuffer=="function",aI=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,zn=Object.prototype.toString,oI=typeof Blob=="function"||typeof Blob<"u"&&zn.call(Blob)==="[object BlobConstructor]",rI=typeof File=="function"||typeof File<"u"&&zn.call(File)==="[object FileConstructor]";function Xo(e){return tI&&(e instanceof ArrayBuffer||aI(e))||oI&&e instanceof Blob||rI&&e instanceof File}function Wa(e,i){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let t=0,a=e.length;t<a;t++)if(Wa(e[t]))return!0;return!1}if(Xo(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return Wa(e.toJSON(),!0);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&Wa(e[t]))return!0;return!1}function sI(e){const i=[],t=e.data,a=e;return a.data=fo(t,i),a.attachments=i.length,{packet:a,buffers:i}}function fo(e,i){if(!e)return e;if(Xo(e)){const t={_placeholder:!0,num:i.length};return i.push(e),t}else if(Array.isArray(e)){const t=new Array(e.length);for(let a=0;a<e.length;a++)t[a]=fo(e[a],i);return t}else if(typeof e=="object"&&!(e instanceof Date)){const t={};for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=fo(e[a],i));return t}return e}function nI(e,i){return e.data=vo(e.data,i),delete e.attachments,e}function vo(e,i){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<i.length)return i[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let t=0;t<e.length;t++)e[t]=vo(e[t],i);else if(typeof e=="object")for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(e[t]=vo(e[t],i));return e}const lI=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],AI=5;var Ai;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})(Ai||(Ai={}));class qI{constructor(i){this.replacer=i}encode(i){return(i.type===Ai.EVENT||i.type===Ai.ACK)&&Wa(i)?this.encodeAsBinary({type:i.type===Ai.EVENT?Ai.BINARY_EVENT:Ai.BINARY_ACK,nsp:i.nsp,data:i.data,id:i.id}):[this.encodeAsString(i)]}encodeAsString(i){let t=""+i.type;return(i.type===Ai.BINARY_EVENT||i.type===Ai.BINARY_ACK)&&(t+=i.attachments+"-"),i.nsp&&i.nsp!=="/"&&(t+=i.nsp+","),i.id!=null&&(t+=i.id),i.data!=null&&(t+=JSON.stringify(i.data,this.replacer)),t}encodeAsBinary(i){const t=sI(i),a=this.encodeAsString(t.packet),o=t.buffers;return o.unshift(a),o}}function Tn(e){return Object.prototype.toString.call(e)==="[object Object]"}class Ho extends Ji{constructor(i){super(),this.reviver=i}add(i){let t;if(typeof i=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(i);const a=t.type===Ai.BINARY_EVENT;a||t.type===Ai.BINARY_ACK?(t.type=a?Ai.EVENT:Ai.ACK,this.reconstructor=new mI(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(Xo(i)||i.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(i),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+i)}decodeString(i){let t=0;const a={type:Number(i.charAt(0))};if(Ai[a.type]===void 0)throw new Error("unknown packet type "+a.type);if(a.type===Ai.BINARY_EVENT||a.type===Ai.BINARY_ACK){const r=t+1;for(;i.charAt(++t)!=="-"&&t!=i.length;);const s=i.substring(r,t);if(s!=Number(s)||i.charAt(t)!=="-")throw new Error("Illegal attachments");a.attachments=Number(s)}if(i.charAt(t+1)==="/"){const r=t+1;for(;++t&&!(i.charAt(t)===","||t===i.length););a.nsp=i.substring(r,t)}else a.nsp="/";const o=i.charAt(t+1);if(o!==""&&Number(o)==o){const r=t+1;for(;++t;){const s=i.charAt(t);if(s==null||Number(s)!=s){--t;break}if(t===i.length)break}a.id=Number(i.substring(r,t+1))}if(i.charAt(++t)){const r=this.tryParse(i.substr(t));if(Ho.isPayloadValid(a.type,r))a.data=r;else throw new Error("invalid payload")}return a}tryParse(i){try{return JSON.parse(i,this.reviver)}catch{return!1}}static isPayloadValid(i,t){switch(i){case Ai.CONNECT:return Tn(t);case Ai.DISCONNECT:return t===void 0;case Ai.CONNECT_ERROR:return typeof t=="string"||Tn(t);case Ai.EVENT:case Ai.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&lI.indexOf(t[0])===-1);case Ai.ACK:case Ai.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class mI{constructor(i){this.packet=i,this.buffers=[],this.reconPack=i}takeBinaryData(i){if(this.buffers.push(i),this.buffers.length===this.reconPack.attachments){const t=nI(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const pI=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Ho,Encoder:qI,get PacketType(){return Ai},protocol:AI},Symbol.toStringTag,{value:"Module"}));function qe(e,i,t){return e.on(i,t),function(){e.off(i,t)}}const uI=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class wn extends Ji{constructor(i,t,a){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=i,this.nsp=t,a&&a.auth&&(this.auth=a.auth),this._opts=Object.assign({},a),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const i=this.io;this.subs=[qe(i,"open",this.onopen.bind(this)),qe(i,"packet",this.onpacket.bind(this)),qe(i,"error",this.onerror.bind(this)),qe(i,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...i){return i.unshift("message"),this.emit.apply(this,i),this}emit(i,...t){var a,o,r;if(uI.hasOwnProperty(i))throw new Error('"'+i.toString()+'" is a reserved event name');if(t.unshift(i),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const s={type:Ai.EVENT,data:t};if(s.options={},s.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){const q=this.ids++,p=t.pop();this._registerAckCallback(q,p),s.id=q}const n=(o=(a=this.io.engine)===null||a===void 0?void 0:a.transport)===null||o===void 0?void 0:o.writable,l=this.connected&&!(!((r=this.io.engine)===null||r===void 0)&&r._hasPingExpired());return this.flags.volatile&&!n||(l?(this.notifyOutgoingListeners(s),this.packet(s)):this.sendBuffer.push(s)),this.flags={},this}_registerAckCallback(i,t){var a;const o=(a=this.flags.timeout)!==null&&a!==void 0?a:this._opts.ackTimeout;if(o===void 0){this.acks[i]=t;return}const r=this.io.setTimeoutFn(()=>{delete this.acks[i];for(let n=0;n<this.sendBuffer.length;n++)this.sendBuffer[n].id===i&&this.sendBuffer.splice(n,1);t.call(this,new Error("operation has timed out"))},o),s=(...n)=>{this.io.clearTimeoutFn(r),t.apply(this,n)};s.withError=!0,this.acks[i]=s}emitWithAck(i,...t){return new Promise((a,o)=>{const r=(s,n)=>s?o(s):a(n);r.withError=!0,t.push(r),this.emit(i,...t)})}_addToQueue(i){let t;typeof i[i.length-1]=="function"&&(t=i.pop());const a={id:this._queueSeq++,tryCount:0,pending:!1,args:i,flags:Object.assign({fromQueue:!0},this.flags)};i.push((o,...r)=>a!==this._queue[0]?void 0:(o!==null?a.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(o)):(this._queue.shift(),t&&t(null,...r)),a.pending=!1,this._drainQueue())),this._queue.push(a),this._drainQueue()}_drainQueue(i=!1){if(!this.connected||this._queue.length===0)return;const t=this._queue[0];t.pending&&!i||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(i){i.nsp=this.nsp,this.io._packet(i)}onopen(){typeof this.auth=="function"?this.auth(i=>{this._sendConnectPacket(i)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(i){this.packet({type:Ai.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},i):i})}onerror(i){this.connected||this.emitReserved("connect_error",i)}onclose(i,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",i,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(i=>{if(!this.sendBuffer.some(a=>String(a.id)===i)){const a=this.acks[i];delete this.acks[i],a.withError&&a.call(this,new Error("socket has been disconnected"))}})}onpacket(i){if(i.nsp===this.nsp)switch(i.type){case Ai.CONNECT:i.data&&i.data.sid?this.onconnect(i.data.sid,i.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Ai.EVENT:case Ai.BINARY_EVENT:this.onevent(i);break;case Ai.ACK:case Ai.BINARY_ACK:this.onack(i);break;case Ai.DISCONNECT:this.ondisconnect();break;case Ai.CONNECT_ERROR:this.destroy();const a=new Error(i.data.message);a.data=i.data.data,this.emitReserved("connect_error",a);break}}onevent(i){const t=i.data||[];i.id!=null&&t.push(this.ack(i.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(i){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const a of t)a.apply(this,i)}super.emit.apply(this,i),this._pid&&i.length&&typeof i[i.length-1]=="string"&&(this._lastOffset=i[i.length-1])}ack(i){const t=this;let a=!1;return function(...o){a||(a=!0,t.packet({type:Ai.ACK,id:i,data:o}))}}onack(i){const t=this.acks[i.id];typeof t=="function"&&(delete this.acks[i.id],t.withError&&i.data.unshift(null),t.apply(this,i.data))}onconnect(i,t){this.id=i,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(i=>this.emitEvent(i)),this.receiveBuffer=[],this.sendBuffer.forEach(i=>{this.notifyOutgoingListeners(i),this.packet(i)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(i=>i()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Ai.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(i){return this.flags.compress=i,this}get volatile(){return this.flags.volatile=!0,this}timeout(i){return this.flags.timeout=i,this}onAny(i){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(i),this}prependAny(i){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(i),this}offAny(i){if(!this._anyListeners)return this;if(i){const t=this._anyListeners;for(let a=0;a<t.length;a++)if(i===t[a])return t.splice(a,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(i){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(i),this}prependAnyOutgoing(i){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(i),this}offAnyOutgoing(i){if(!this._anyOutgoingListeners)return this;if(i){const t=this._anyOutgoingListeners;for(let a=0;a<t.length;a++)if(i===t[a])return t.splice(a,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(i){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const a of t)a.apply(this,i.data)}}}function tt(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}tt.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var i=Math.random(),t=Math.floor(i*this.jitter*e);e=Math.floor(i*10)&1?e+t:e-t}return Math.min(e,this.max)|0},tt.prototype.reset=function(){this.attempts=0},tt.prototype.setMin=function(e){this.ms=e},tt.prototype.setMax=function(e){this.max=e},tt.prototype.setJitter=function(e){this.jitter=e};class Po extends Ji{constructor(i,t){var a;super(),this.nsps={},this.subs=[],i&&typeof i=="object"&&(t=i,i=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,Ja(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((a=t.randomizationFactor)!==null&&a!==void 0?a:.5),this.backoff=new tt({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=i;const o=t.parser||pI;this.encoder=new o.Encoder,this.decoder=new o.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(i){return arguments.length?(this._reconnection=!!i,i||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(i){return i===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=i,this)}reconnectionDelay(i){var t;return i===void 0?this._reconnectionDelay:(this._reconnectionDelay=i,(t=this.backoff)===null||t===void 0||t.setMin(i),this)}randomizationFactor(i){var t;return i===void 0?this._randomizationFactor:(this._randomizationFactor=i,(t=this.backoff)===null||t===void 0||t.setJitter(i),this)}reconnectionDelayMax(i){var t;return i===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=i,(t=this.backoff)===null||t===void 0||t.setMax(i),this)}timeout(i){return arguments.length?(this._timeout=i,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(i){if(~this._readyState.indexOf("open"))return this;this.engine=new iI(this.uri,this.opts);const t=this.engine,a=this;this._readyState="opening",this.skipReconnect=!1;const o=qe(t,"open",function(){a.onopen(),i&&i()}),r=n=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",n),i?i(n):this.maybeReconnectOnOpen()},s=qe(t,"error",r);if(this._timeout!==!1){const n=this._timeout,l=this.setTimeoutFn(()=>{o(),r(new Error("timeout")),t.close()},n);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(o),this.subs.push(s),this}connect(i){return this.open(i)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const i=this.engine;this.subs.push(qe(i,"ping",this.onping.bind(this)),qe(i,"data",this.ondata.bind(this)),qe(i,"error",this.onerror.bind(this)),qe(i,"close",this.onclose.bind(this)),qe(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(i){try{this.decoder.add(i)}catch(t){this.onclose("parse error",t)}}ondecoded(i){Va(()=>{this.emitReserved("packet",i)},this.setTimeoutFn)}onerror(i){this.emitReserved("error",i)}socket(i,t){let a=this.nsps[i];return a?this._autoConnect&&!a.active&&a.connect():(a=new wn(this,i,t),this.nsps[i]=a),a}_destroy(i){const t=Object.keys(this.nsps);for(const a of t)if(this.nsps[a].active)return;this._close()}_packet(i){const t=this.encoder.encode(i);for(let a=0;a<t.length;a++)this.engine.write(t[a],i.options)}cleanup(){this.subs.forEach(i=>i()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(i,t){var a;this.cleanup(),(a=this.engine)===null||a===void 0||a.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",i,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const i=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const a=this.setTimeoutFn(()=>{i.skipReconnect||(this.emitReserved("reconnect_attempt",i.backoff.attempts),!i.skipReconnect&&i.open(o=>{o?(i._reconnecting=!1,i.reconnect(),this.emitReserved("reconnect_error",o)):i.onreconnect()}))},t);this.opts.autoUnref&&a.unref(),this.subs.push(()=>{this.clearTimeoutFn(a)})}}onreconnect(){const i=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",i)}}const Wt={};function Ma(e,i){typeof e=="object"&&(i=e,e=void 0),i=i||{};const t=eI(e,i.path||"/socket.io"),a=t.source,o=t.id,r=t.path,s=Wt[o]&&r in Wt[o].nsps,n=i.forceNew||i["force new connection"]||i.multiplex===!1||s;let l;return n?l=new Po(a,i):(Wt[o]||(Wt[o]=new Po(a,i)),l=Wt[o]),t.query&&!i.query&&(i.query=t.queryKey),l.socket(t.path,i)}Object.assign(Ma,{Manager:Po,Socket:wn,io:Ma,connect:Ma});async function II(e,i,t){return(await Ki.post(t,{versionId:e,fileSize:i})).data}async function KI(e,i){return(await Ki.post(i+"/getFileSize",e)).data}const Ea=5,cI=({setIsExceedingFileSizeAccepted:e,closeModal:i,setLoading:t,typeOfProduct:a,versionId:o,fileSize:r,setFileSize:s,user:n,compressApi:l,producerApi:A,api:q})=>{const[p,u]=y.useState(!1),[I,c]=y.useState(!1);y.useEffect(()=>{const h=Ma(l,{path:"/socket.io"});return h.on("connect",()=>{console.log("Connected to the socket server")}),h.on("video-compressing",async b=>{if(console.log(b),b.userId===n._id&&b.isSuccess){console.log("Video compress successfull");const F=await KI({_id:o},q);s(F.size),e(!1)}}),h.on("error",b=>{console.error("Socket error:",b)}),()=>{h.disconnect()}},[o]);const Z=()=>{i(),e(!1),t(!0)},K=async()=>{try{u(!0);const h=await II(o,r,`${A}/videos/compressByDiff`);console.log("Compression result:",h),t(!1)}catch(h){console.error("Error compressing video:",h),t(!1),i()}},S=qi[a],W=Vt[a],U=r-Ea,k=Ea/r*100;return m.jsxs(ua,{isOpen:!0,ariaHideApp:!1,onRequestClose:Z,style:{content:{position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)",borderRadius:"1.5rem",backgroundColor:"white",zIndex:50,maxWidth:"32rem",width:"100%",height:"100%",maxHeight:"34.5rem",overflow:"hidden",padding:"0px"},overlay:{position:"fixed",backgroundColor:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(4px)",WebkitBackdropFilter:"blur(4px)",zIndex:50,top:0,left:0,right:0,bottom:0}},contentLabel:"Playable Size Exceeding Modal",shouldCloseOnOverlayClick:!0,children:[m.jsx("button",{onClick:Z,style:{position:"absolute",top:"1.25rem",right:"1.25rem",padding:"0.5rem",borderRadius:"9999px",transition:"all 0.3s",zIndex:10,border:"none",background:"transparent",cursor:"pointer"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="#f1f5f9"},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent"},"aria-label":"Close",children:m.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{color:"#94a3b8",transition:"color 0.3s"},onMouseEnter:h=>{h.currentTarget.style.color="#0f172a"},onMouseLeave:h=>{h.currentTarget.style.color="#94a3b8"},children:[m.jsx("path",{d:"M18 6 6 18"}),m.jsx("path",{d:"m6 6 12 12"})]})}),m.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center",gap:"8px",paddingLeft:"2rem",paddingRight:"2rem",paddingTop:"2.5rem",paddingBottom:"2.5rem",height:"100%",width:"100%"},children:[m.jsxs("div",{style:{position:"relative",marginBottom:"1.5rem"},children:[m.jsx("div",{style:{position:"absolute",inset:0,borderRadius:"9999px",filter:"blur(24px)",opacity:.4,animation:"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",backgroundColor:S}}),m.jsx("div",{style:{position:"relative",width:"80px",height:"80px",borderRadius:"9999px",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)",backgroundColor:S},children:m.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"44",height:"44",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[m.jsx("circle",{cx:"12",cy:"12",r:"10"}),m.jsx("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),m.jsx("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]})})]}),m.jsx("h2",{style:{fontSize:"24px",fontWeight:"bold",color:"#0f172a",marginBottom:"0.5rem",letterSpacing:"-0.025em"},children:"Playable Size Too Large"}),m.jsxs("div",{style:{backgroundColor:"#f8fafc",borderRadius:"0.75rem",paddingLeft:"1rem",paddingRight:"1rem",paddingTop:"0.75rem",paddingBottom:"0.75rem",marginBottom:"1rem",width:"100%",border:"1px solid #e2e8f0"},children:[m.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:"0.875rem"},children:[m.jsx("span",{style:{color:"#475569"},children:"Current size:"}),m.jsxs("span",{style:{fontWeight:"bold",fontSize:"18px",color:S},children:[r.toFixed(1)," MB"]})]}),m.jsxs("div",{style:{marginTop:"0.5rem",width:"100%",position:"relative"},children:[m.jsx("div",{style:{width:"100%",backgroundColor:"#e2e8f0",borderRadius:"9999px",height:"0.5rem",overflow:"hidden"},children:m.jsx("div",{style:{height:"100%",borderTopLeftRadius:"9999px",borderBottomLeftRadius:"9999px",width:`${k}%`,backgroundColor:S}})}),m.jsx("div",{style:{position:"absolute",top:0,width:"0.125rem",height:"0.5rem",backgroundColor:"#334155",zIndex:10,left:`${k}%`}}),m.jsx("div",{style:{position:"absolute",top:0,height:"0.5rem",overflow:"hidden",left:`${k}%`,width:`${100-k}%`},children:m.jsx("div",{style:{height:"100%",borderTopRightRadius:"9999px",borderBottomRightRadius:"9999px",opacity:.6,backgroundColor:S,backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 3px, rgba(255,255,255,0.3) 3px, rgba(255,255,255,0.3) 6px)"}})})]}),m.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:"0.75rem",marginTop:"0.25rem"},children:[m.jsxs("span",{style:{color:"#64748b"},children:["Limit: ",Ea," MB"]}),m.jsxs("span",{style:{fontWeight:500,fontSize:"12px",color:S},children:["+",U.toFixed(1)," MB over"]})]})]}),p?m.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",paddingTop:"2rem",paddingBottom:"2rem"},children:[m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:S,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{animation:"spin 1s linear infinite",marginBottom:"1rem"},children:m.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),m.jsx("style",{children:`
|
|
92
|
+
`}),m.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:"#f6f6f6",height:"60px",color:"#737373"},children:[m.jsx("div",{style:{width:"66px",height:"100%",borderRight:"1px solid #e1e1e1",display:"flex",justifyContent:"center",alignItems:"center",flexShrink:0},children:m.jsx(Vn,{})}),m.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",position:"relative",maxWidth:"68%"},children:m.jsx("a",{style:{textAlign:"center",overflow:"hidden",textOverflow:"ellipsis"},href:i,target:"_blank",children:i||"No CDN link generated"})}),m.jsx("button",{onClick:()=>{if(!i||r)return;fe(i)&&(s(!0),setTimeout(()=>s(!1),2e3))},style:{cursor:!i||r?"default":"pointer",borderRadius:"0.375rem",backgroundColor:r?"#16A34A":i?n:"lightgray",color:"white",transition:"all 0.15s ease-linear",width:"100px",height:"46px",marginRight:"10px",flexShrink:0},children:r?pi.t("common:link_copied"):pi.t("common:copy")})]})]})})]})},Au=({onClose:e,url:i,typeOfProduct:t="Playable"})=>{const[a,o]=y.useState(!1),r=t&&qi[t]?qi[t]:qi.Playable;return m.jsxs("div",{style:{position:"fixed",top:0,left:0,zIndex:50,display:"flex",height:"100%",width:"100%",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0, 0, 0, 0.2)"},onClick:e,children:[m.jsx("div",{onClick:e,style:{position:"absolute",zIndex:30,height:"100%",width:"100%",pointerEvents:"none"}}),m.jsx("div",{style:{position:"absolute",zIndex:50,display:"flex",flexDirection:"column",gap:"5px",minWidth:"500px",maxWidth:"728px",width:"90%",minHeight:"150px",borderRadius:"10px",backgroundColor:"white",padding:"40px 30px 50px",pointerEvents:"auto"},onClick:s=>{s.stopPropagation()},children:m.jsx("div",{style:{display:"flex",gap:"5px",flexDirection:"column"},children:m.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:"#f6f6f6",height:"60px",color:"#737373"},children:[m.jsx("div",{style:{width:"66px",height:"100%",borderRight:"1px solid #e1e1e1",display:"flex",justifyContent:"center",alignItems:"center",flexShrink:0},children:m.jsx(Vn,{})}),m.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",position:"relative",maxWidth:"68%"},children:m.jsx("a",{style:{textAlign:"center",overflow:"hidden",textOverflow:"ellipsis"},href:i,target:"_blank",children:i||m.jsx("img",{width:"30px",src:Xe,alt:"pf-logo-gif"})})}),m.jsx("button",{onClick:()=>{if(!i||a)return;fe(i)&&(o(!0),setTimeout(()=>o(!1),2e3))},style:{cursor:!i||a?"default":"pointer",borderRadius:"0.375rem",backgroundColor:a?"#16A34A":i?r:"lightgray",color:"white",transition:"all 0.15s ease-linear",width:"100px",height:"46px",marginRight:"10px",flexShrink:0},children:a?pi.t("common:link_copied"):pi.t("common:copy")})]})})})]})},qu=({playable:e,creditDownload:i,visible:t,versionId:a,typeOfProduct:o,api:r,user:s,handleDownloadError:n,fetchFileUrl:l,urls:A,game:q,getDownloadCount:p,disabled:u,setSafariCopyLink:I,isTest:c,urlType:Z,allNetworksSelected:K,cdnModal:S,setCdnModal:W,cdnUrl:U,setCdnUrl:k,customer:h,selectedVersionIds:b})=>{const[F,N]=y.useState([]),[v,_]=y.useState([]),[X,H]=y.useState(!1),[f,g]=y.useState(""),[L,Y]=y.useState(!1),[C,M]=y.useState(!1),[D,J]=y.useState("download"),[E,O]=y.useState(!1),[B,z]=y.useState(!1),[P,Q]=y.useState(!1),[w,ti]=ji(Bs),[si,oi]=ji(Ds),[Zi]=ji(na),[G,Mi]=ji(dt),Fi=o==="Playable"?G:!0,Ei=async(T=!1)=>{T&&U||P||(Q(!0),ve(a,"cdn",Fi?A:null,null,!1,{}).then($=>{k($.url),Q(!1)}).catch($=>{n($.message,$),Q(!1)}))},bi=async T=>{if(T==="adikteev"||T==="cdn")return;const $=[...F];if(F.includes(T)){const Ci=$.findIndex(ui=>ui===T);$.splice(Ci,1),N($)}else $.push(T),N([...F,T]);Zi.filter(Ci=>[...$].includes(Ci.id)).map(Ci=>Ci.name)},$i=async()=>new Promise(async(T,$)=>{const Ci=Zi.filter(ui=>[...F].includes(ui.id)).map(ui=>ui.name);if(Y(!0),b&&b.length>0)try{if(!q||!q._id)throw new Error("Game data is required for multi-version download");const ui=await jo(r,q._id,{networks:Ci,versions:b}),wi=l+"/"+ui.url,Ze=await(await fetch(wi)).blob(),he=window.URL.createObjectURL(Ze),Qi=document.createElement("a");Qi.href=he,Qi.download=ui.url.split("/").pop()||"download.zip",document.body.appendChild(Qi),Qi.click(),window.URL.revokeObjectURL(he),document.body.removeChild(Qi),Y(!1),T(ui.url)}catch(ui){console.log("multi-version download error",ui),Y(!1),n(ui.message,ui),$(ui)}else kq(a,A,Ci,{urlType:Z}).then(ui=>{Y(!1),T(ui)}).catch(ui=>{console.log("get multi download err"),Y(!1),n(ui.message,ui),$(ui)})}),j=async()=>{A.iosUrl,A.googleUrl,i&&i.willSpendCredit?(M(!0),J("download"),O(!0)):(O(!1),await $i())};return y.useEffect(()=>{const T=Zi.filter($=>{var Ci;return b&&b.length>0?!0:i&&((Ci=i==null?void 0:i.networks)==null?void 0:Ci.length)>0?typeof $=="string"?i==null?void 0:i.networks.includes($):i==null?void 0:i.networks.includes($.name):o==="Import"?e==null?void 0:e.networks.filter(ui=>ui.status==="paid").some(ui=>ui.name===$.name):$?!0:e==null?void 0:e.networks.includes($)}).filter($=>$.name==="voodoo"?s.customer==="customer:20":!0).filter($=>$.id!=="adikteev"&&$.id!=="cdn").map($=>$.id);console.log("networks",T),N(K?T:[])},[K,b,Zi,i,o,e,q,s.customer]),m.jsxs("div",{style:{position:"relative",flex:1,display:"flex",flexDirection:"column",overflow:"hidden",paddingRight:o==="Flex"?"0.25rem":void 0},children:[m.jsx("div",{style:{flex:1,overflowY:C?"hidden":"auto",padding:"1.5rem",paddingTop:"0",paddingBottom:F.length>0?"5rem":"1.5rem"},children:m.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, minmax(0, 1fr))",gap:"0.75rem",maxWidth:"100%"},children:t&&Zi.filter(T=>{var $;if(b&&b.length>0)return!0;if(i&&(($=i==null?void 0:i.networks)==null?void 0:$.length)>0)return typeof T=="string"?i==null?void 0:i.networks.includes(T):i==null?void 0:i.networks.includes(T.name);if(o==="Import")return e==null?void 0:e.networks.filter(Ci=>Ci.status==="paid").some(Ci=>Ci.name===T.name);if(!T)e==null||e.networks.includes(T);else return T}).filter(T=>T.name==="voodoo"?s.customer==="customer:20":!0).map(T=>{let $=T.imageSrc;if(T.name==="web"){let Ci="web_"+o.toLowerCase()+".png";$=$.replace("web.png",Ci)}return m.jsx(su,{id:T.id,name:T.name,imageUrl:$,selected:F.includes(T.id),handleCardClick:bi,networkVersionSize:v,fileSizeLoading:X,showCheckBox:T.id!=="adikteev"&&T.id!=="cdn",typeOfProduct:o,versionId:a,api:r,handleDownloadError:n,fetchFileUrl:l,urls:A,game:q,creditDownload:i,setIsConfirmActive:M,getDownloadCount:p,disabled:u,user:s,setSafariCopyLink:I,isTest:c,urlType:Z,setCdnModal:W,generateCDN:Ei,cdnUrl:U,selectedVersionIds:b},T.id)})})}),F.length>0&&(o==="Playable"||o==="Ready"||o==="Flex")&&m.jsx("div",{style:{position:"absolute",bottom:"1rem",left:"50%",transform:"translateX(-50%)",display:"flex",flexDirection:"column",zIndex:20},children:m.jsx(nu,{onClickMultiDownload:j,networksVersionTotalSize:f,typeOfProduct:o,multiDownloading:L,selectedCount:F.length})}),S&&m.jsx(lu,{onClose:()=>{W(!1),p()},versionId:a,urls:A,handleDownloadError:n,cdnUrl:U,setCdnUrl:k,generateCDN:async()=>{if(!P){if(!(i!=null&&i.willSpendCredit)){Ei();return}if(s.customer==="playableFactoryInternal"){Ei();return}z(!0)}},cdnUploading:P,typeOfProduct:o}),si&&m.jsx(Au,{onClose:()=>{oi(!1)},url:w,typeOfProduct:o}),B&&m.jsx(Qo,{width:"100%",height:"100%",creditConfirmType:D,handleCopyLink:async()=>{},download:async()=>{O(!1),z(!1),Ei()},onClose:()=>{O(!1),z(!1),Q(!1)},getDownloadCount:p,typeOfProduct:o}),E&&m.jsx(Qo,{creditConfirmType:D,handleCopyLink:async()=>{},download:async()=>{O(!1),M(!1),await $i()},onClose:()=>{O(!1),M(!1)},getDownloadCount:p,typeOfProduct:o})]})};async function mu(e,i){return(await Ki.post(i+"/getFlexDownloadCount",e)).data}async function pu(e,i){try{return(await Ki.post(i+"/findGame",{_id:e})).data}catch{}}async function uu(e,i){return(await Ki.post(i+"/getPlayableVersionMarketLink",{_id:e})).data}async function Iu(e,i){return(await Ki.post(i+"/getFlexData",{_id:e})).data}async function Ku(e,i){return(await Ki.post(i+"/getImportedPlayable",{id:e})).data}async function cu(e,i){return(await Ki.post(i+"/getReadyDownloadCount",e)).data}async function du(e,i){try{return(await Ki.post(i+"/findCustomer",{_id:e})).data}catch{}}const Jn=["web","adcolony","applovin","chartboost","crossinstall","fb","google","google360","ironsource","lifestreet","liftoff","mobvista","nucleo","tapjoy","toutiao","unity","vungle","moloco","cdn"];let kn=null;const Zu=({playableId:e,versionId:i,gameId:t,typeOfProduct:a,visible:o,api:r,user:s,title:n,handleDownloadError:l,fetchFileUrl:A,fileSize:q,setFileSize:p,setSafariCopyLink:u,iosLink:I,androidLink:c,setIosLink:Z,setAndroidLink:K,urlType:S,setUrlType:W,selectedVersionIds:U})=>{const[k,h]=y.useState(null),[b,F]=y.useState(null),[N,v]=y.useState(null),[_,X]=y.useState(!1),[H,f]=y.useState(!0),[g,L]=y.useState(window.innerWidth),[Y,C]=y.useState(!1),[M,D]=y.useState(!1),[J,E]=y.useState("");ji(Bs),ji(Ds);const[O,B]=ji(Xs),[z,P]=ji(dt);y.useEffect(()=>{!J&&a!=="Fusion"&&Mq(i).then(j=>{j!=null&&j.exist&&E(j.uploadPath)})},[J]);const[Q,w]=y.useState(!1);y.useEffect(()=>{},[Q]),y.useEffect(()=>{const j=()=>{L(window.innerWidth)};return window.addEventListener("resize",j),()=>{window.removeEventListener("resize",j)}},[]);const ti=async()=>{X(!0);const j=await Ss(e,r);return j!=null&&j.networks||(j.networks=Jn),h(j),j},si=(j,T)=>{clearTimeout(kn),kn=setTimeout(()=>{a==="Playable"&&!z||Vq(i,{iosUrl:j,googleUrl:T},{urlType:S})},1e3)},oi=j=>{Z(j),si(j,c)},Zi=j=>{K(j),si(I,j)},G=async(j,T)=>{var $,Ci;try{let ui;if(a==="Playable"||a==="Ready"){const wi=await uu(i,r);if(wi){Z(wi.iosLink),K(wi.androidLink),X(!1);return}if(j&&(j.iosUrl||j.googleUrl)){Z(j.iosUrl),K(j.googleUrl),X(!1);return}if(T&&T.html){const Mt=`${A}/${T.html}?t=${Date.now()}`;let Ze=await fetch(Mt).then(me=>me.text());const he=(($=Ze.match(/var\s+iosLink\s*=\s*['|"](https?[^\s'"]+)['|"]/))==null?void 0:$.at(1))||"";Z(he);const Qi=((Ci=Ze.match(/var\s+androidLink\s*=\s*['|"](https?[^\s'"]+)['|"]/))==null?void 0:Ci.at(1))||"";K(Qi),X(!1)}else K(""),Z(""),X(!1)}else if(a==="Flex"){const wi=await Iu(i,r);if(wi.googleUrl||wi.iosUrl){K(wi.googleUrl),Z(wi.iosUrl),X(!1);return}j&&(j.iosUrl||j.googleUrl)?(Z(j.iosUrl),K(j.googleUrl),X(!1)):(K(""),Z(""),X(!1))}else a==="Fusion"&&(j&&(j.iosUrl||j.googleUrl)?(Z(j.iosUrl),K(j.googleUrl),X(!1)):(K(""),Z(""),X(!1)))}catch(ui){l(ui.response.data.error.msg)}},Mi=async()=>{X(!0);let j;a==="Flex"?j=await mu({_id:i},r):a==="Ready"&&(j=await cu({_id:i},r)),j&&(["admin","pm","tester","sales"].includes(s.role)?v({...j,networks:O}):(console.log("result",j),a==="Ready"&&!j.canDownload?v({...j,networks:Jn}):(console.log("result",j),v({...j,networks:j.networks})))),X(!1)},Fi=async()=>await pu(t,r),[Ei,bi]=y.useState(null),$i=async j=>await du(j,r);return y.useEffect(()=>{o||(h(null),F(null),v(null),p(null),bi(null)),o&&(a==="Playable"?Fi().then(j=>{F(j),j&&$i(j.customer).then(T=>{bi(T||null)}),ti().then(T=>{G(null,T)}),f(!1)}):a==="Ready"?Mi().then(j=>{ti().then(T=>{G(null,T),f(!1),T!=null&&T.customer&&$i(T.customer).then($=>{bi($||null)})})}):a==="Flex"?Mi().then(j=>{f(!1),Fi().then(T=>{o&&(G(T,null),f(!1),F(T),T&&$i(T.customer).then($=>{bi($||null)}))})}):a==="Import"?Ku(i,r).then(j=>{h(j),Z(j.iosUrl||""),K(j.googleUrl||""),X(!1),f(!1)}):a==="Fusion"&&(f(!1),Fi().then(j=>{o&&(G(j,null),f(!1),F({...j,networks:O.filter(T=>T!=="cdn")}),j&&$i(j.customer).then(T=>{bi(T||null)}))})))},[t,e,i,o]),m.jsxs("div",{style:{position:"relative",display:"flex",height:g>1440?"650px":g<768?"auto":"600px",width:g>1440?"695px":g<768?"100%":"700px",flex:1,flexDirection:"column",borderRadius:"rounded",paddingTop:"0px"},children:[g>=768&&m.jsx("div",{style:{position:"absolute",left:0,top:"1.5rem",bottom:"1.5rem",width:"1px",backgroundColor:"#D1D5DB"}}),m.jsx($p,{title:n,typeOfProduct:a,fileSize:q,urls:{iosUrl:I,googleUrl:c},handleIosChange:oi,handleGoogleChange:Zi,disabled:H,api:r,creditDownload:N,user:s,isTest:Y,setIsTest:C,urlType:S,setUrlType:W,allNetworksSelected:Q,setAllNetworksSelected:w,versionId:i,customerId:(Ei==null?void 0:Ei._id)||""}),_?m.jsx("div",{style:{height:"100%",width:"100%",display:"flex",justifyContent:"center"},children:m.jsx(Jt,{isNetworksLoading:!0,isLight:!1})}):(k||N||a==="Fusion")&&(a==="Flex"?b:!0)&&!_&&I!=="Loading..."&&c!=="Loading..."&&m.jsx(qu,{playable:k,creditDownload:N,visible:o,versionId:i,typeOfProduct:a,api:r,user:s,handleDownloadError:l,fetchFileUrl:A,urls:{iosUrl:I,googleUrl:c},game:b,getDownloadCount:Mi,disabled:H,setSafariCopyLink:u,isTest:Y,urlType:S,allNetworksSelected:Q,cdnModal:M,setCdnModal:D,cdnUrl:J,setCdnUrl:E,customer:Ei??void 0,selectedVersionIds:U})]})};async function Su(e,i=!1,t){return(await Ki.post(e+"/getPlayableVersionNames",{isFlex:i,versionIds:t})).data}const hu=({selectedVersionIds:e,api:i,fetchFileUrl:t})=>{const[a,o]=y.useState([]);return y.useEffect(()=>{const r=e.map(n=>({versionId:n,versionName:"Loading...",size:null,status:"loading"}));o(r),(async()=>{try{const n=await Su(i,!1,e);o(l=>l.map((A,q)=>{var p;return{...A,versionName:((p=n[q])==null?void 0:p.name)||`Version ${A.versionId}`}})),e.forEach(async(l,A)=>{try{const q=await ve(l,"preview",null,null,!1);o(p=>{const u=[...p];return u[A]={...u[A],size:q.size,status:q.size>=5?"exceeded":"ok"},u})}catch(q){console.error(`Error checking version ${l}:`,q),o(p=>{const u=[...p];return u[A]={...u[A],status:"ok"},u})}})}catch(n){console.error("Error fetching version names:",n)}})()},[e,i]),m.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"300px",height:"100%",padding:"1rem",paddingTop:"3.5rem",overflowY:"auto"},children:[m.jsx("h2",{style:{fontSize:"1.125rem",fontWeight:"600",marginBottom:"0.75rem",color:"#1F2937"},children:"Versions"}),m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem"},children:a.map(r=>m.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0.625rem 0.75rem",backgroundColor:"#F9FAFB",borderRadius:"0.5rem",border:"1px solid #E5E7EB"},children:[m.jsx("span",{style:{fontSize:"0.875rem",color:"#374151",fontWeight:"500"},children:r.versionName}),r.status==="loading"?m.jsx("img",{width:"20px",height:"20px",src:Xe,alt:"loading"}):r.status==="exceeded"?m.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-end"},children:[m.jsx("div",{style:{width:"20px",height:"20px",borderRadius:"50%",backgroundColor:"#EF4444",display:"flex",alignItems:"center",justifyContent:"center"},children:m.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.jsx("path",{d:"M9 3L3 9M3 3l6 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})})}),m.jsx("span",{style:{fontSize:"0.75rem",color:"#EF4444",marginTop:"0.25rem"},children:"Exceeds 5 MB"})]}):m.jsx("div",{style:{width:"20px",height:"20px",borderRadius:"50%",backgroundColor:"#10B981",display:"flex",alignItems:"center",justifyContent:"center"},children:m.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.jsx("path",{d:"M2.5 6.5L4.5 8.5L9.5 3.5",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},r.versionId))})]})},kK="",ce=Object.create(null);ce.open="0",ce.close="1",ce.ping="2",ce.pong="3",ce.message="4",ce.upgrade="5",ce.noop="6";const Ca=Object.create(null);Object.keys(ce).forEach(e=>{Ca[ce[e]]=e});const Fo={type:"error",data:"parser error"},Wn=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Mn=typeof ArrayBuffer=="function",En=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,No=({type:e,data:i},t,a)=>Wn&&i instanceof Blob?t?a(i):Rn(i,a):Mn&&(i instanceof ArrayBuffer||En(i))?t?a(i):Rn(new Blob([i]),a):a(ce[e]+(i||"")),Rn=(e,i)=>{const t=new FileReader;return t.onload=function(){const a=t.result.split(",")[1];i("b"+(a||""))},t.readAsDataURL(e)};function Un(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let xo;function Cu(e,i){if(Wn&&e.data instanceof Blob)return e.data.arrayBuffer().then(Un).then(i);if(Mn&&(e.data instanceof ArrayBuffer||En(e.data)))return i(Un(e.data));No(e,!1,t=>{xo||(xo=new TextEncoder),i(xo.encode(t))})}const Ln="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",kt=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<Ln.length;e++)kt[Ln.charCodeAt(e)]=e;const yu=e=>{let i=e.length*.75,t=e.length,a,o=0,r,s,n,l;e[e.length-1]==="="&&(i--,e[e.length-2]==="="&&i--);const A=new ArrayBuffer(i),q=new Uint8Array(A);for(a=0;a<t;a+=4)r=kt[e.charCodeAt(a)],s=kt[e.charCodeAt(a+1)],n=kt[e.charCodeAt(a+2)],l=kt[e.charCodeAt(a+3)],q[o++]=r<<2|s>>4,q[o++]=(s&15)<<4|n>>2,q[o++]=(n&3)<<6|l&63;return A},gu=typeof ArrayBuffer=="function",Oo=(e,i)=>{if(typeof e!="string")return{type:"message",data:Yn(e,i)};const t=e.charAt(0);return t==="b"?{type:"message",data:Vu(e.substring(1),i)}:Ca[t]?e.length>1?{type:Ca[t],data:e.substring(1)}:{type:Ca[t]}:Fo},Vu=(e,i)=>{if(gu){const t=yu(e);return Yn(t,i)}else return{base64:!0,data:e}},Yn=(e,i)=>{switch(i){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},Gn=String.fromCharCode(30),Ju=(e,i)=>{const t=e.length,a=new Array(t);let o=0;e.forEach((r,s)=>{No(r,!1,n=>{a[s]=n,++o===t&&i(a.join(Gn))})})},ku=(e,i)=>{const t=e.split(Gn),a=[];for(let o=0;o<t.length;o++){const r=Oo(t[o],i);if(a.push(r),r.type==="error")break}return a};function Wu(){return new TransformStream({transform(e,i){Cu(e,t=>{const a=t.length;let o;if(a<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,a);else if(a<65536){o=new Uint8Array(3);const r=new DataView(o.buffer);r.setUint8(0,126),r.setUint16(1,a)}else{o=new Uint8Array(9);const r=new DataView(o.buffer);r.setUint8(0,127),r.setBigUint64(1,BigInt(a))}e.data&&typeof e.data!="string"&&(o[0]|=128),i.enqueue(o),i.enqueue(t)})}})}let zo;function ya(e){return e.reduce((i,t)=>i+t.length,0)}function ga(e,i){if(e[0].length===i)return e.shift();const t=new Uint8Array(i);let a=0;for(let o=0;o<i;o++)t[o]=e[0][a++],a===e[0].length&&(e.shift(),a=0);return e.length&&a<e[0].length&&(e[0]=e[0].slice(a)),t}function Mu(e,i){zo||(zo=new TextDecoder);const t=[];let a=0,o=-1,r=!1;return new TransformStream({transform(s,n){for(t.push(s);;){if(a===0){if(ya(t)<1)break;const l=ga(t,1);r=(l[0]&128)===128,o=l[0]&127,o<126?a=3:o===126?a=1:a=2}else if(a===1){if(ya(t)<2)break;const l=ga(t,2);o=new DataView(l.buffer,l.byteOffset,l.length).getUint16(0),a=3}else if(a===2){if(ya(t)<8)break;const l=ga(t,8),A=new DataView(l.buffer,l.byteOffset,l.length),q=A.getUint32(0);if(q>Math.pow(2,53-32)-1){n.enqueue(Fo);break}o=q*Math.pow(2,32)+A.getUint32(4),a=3}else{if(ya(t)<o)break;const l=ga(t,o);n.enqueue(Oo(r?l:zo.decode(l),i)),a=0}if(o===0||o>e){n.enqueue(Fo);break}}}})}const bn=4;function ki(e){if(e)return Eu(e)}function Eu(e){for(var i in ki.prototype)e[i]=ki.prototype[i];return e}ki.prototype.on=ki.prototype.addEventListener=function(e,i){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(i),this},ki.prototype.once=function(e,i){function t(){this.off(e,t),i.apply(this,arguments)}return t.fn=i,this.on(e,t),this},ki.prototype.off=ki.prototype.removeListener=ki.prototype.removeAllListeners=ki.prototype.removeEventListener=function(e,i){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+e];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var a,o=0;o<t.length;o++)if(a=t[o],a===i||a.fn===i){t.splice(o,1);break}return t.length===0&&delete this._callbacks["$"+e],this},ki.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var i=new Array(arguments.length-1),t=this._callbacks["$"+e],a=1;a<arguments.length;a++)i[a-1]=arguments[a];if(t){t=t.slice(0);for(var a=0,o=t.length;a<o;++a)t[a].apply(this,i)}return this},ki.prototype.emitReserved=ki.prototype.emit,ki.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},ki.prototype.hasListeners=function(e){return!!this.listeners(e).length};const Va=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?i=>Promise.resolve().then(i):(i,t)=>t(i,0))(),_i=(()=>typeof self<"u"?self:typeof window<"u"?window:Function("return this")())(),Ru="arraybuffer";function WK(){}function Qn(e,...i){return i.reduce((t,a)=>(e.hasOwnProperty(a)&&(t[a]=e[a]),t),{})}const Uu=_i.setTimeout,Lu=_i.clearTimeout;function Ja(e,i){i.useNativeTimers?(e.setTimeoutFn=Uu.bind(_i),e.clearTimeoutFn=Lu.bind(_i)):(e.setTimeoutFn=_i.setTimeout.bind(_i),e.clearTimeoutFn=_i.clearTimeout.bind(_i))}const Yu=1.33;function Gu(e){return typeof e=="string"?bu(e):Math.ceil((e.byteLength||e.size)*Yu)}function bu(e){let i=0,t=0;for(let a=0,o=e.length;a<o;a++)i=e.charCodeAt(a),i<128?t+=1:i<2048?t+=2:i<55296||i>=57344?t+=3:(a++,t+=4);return t}function jn(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Qu(e){let i="";for(let t in e)e.hasOwnProperty(t)&&(i.length&&(i+="&"),i+=encodeURIComponent(t)+"="+encodeURIComponent(e[t]));return i}function ju(e){let i={},t=e.split("&");for(let a=0,o=t.length;a<o;a++){let r=t[a].split("=");i[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return i}class Fu extends Error{constructor(i,t,a){super(i),this.description=t,this.context=a,this.type="TransportError"}}class To extends ki{constructor(i){super(),this.writable=!1,Ja(this,i),this.opts=i,this.query=i.query,this.socket=i.socket,this.supportsBinary=!i.forceBase64}onError(i,t,a){return super.emitReserved("error",new Fu(i,t,a)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(i){this.readyState==="open"&&this.write(i)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(i){const t=Oo(i,this.socket.binaryType);this.onPacket(t)}onPacket(i){super.emitReserved("packet",i)}onClose(i){this.readyState="closed",super.emitReserved("close",i)}pause(i){}createUri(i,t={}){return i+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const i=this.opts.hostname;return i.indexOf(":")===-1?i:"["+i+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(i){const t=Qu(i);return t.length?"?"+t:""}}class Nu extends To{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(i){this.readyState="pausing";const t=()=>{this.readyState="paused",i()};if(this._polling||!this.writable){let a=0;this._polling&&(a++,this.once("pollComplete",function(){--a||t()})),this.writable||(a++,this.once("drain",function(){--a||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(i){const t=a=>{if(this.readyState==="opening"&&a.type==="open"&&this.onOpen(),a.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(a)};ku(i,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const i=()=>{this.write([{type:"close"}])};this.readyState==="open"?i():this.once("open",i)}write(i){this.writable=!1,Ju(i,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const i=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=jn()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(i,t)}}let Fn=!1;try{Fn=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const xu=Fn;function Ou(){}class zu extends Nu{constructor(i){if(super(i),typeof location<"u"){const t=location.protocol==="https:";let a=location.port;a||(a=t?"443":"80"),this.xd=typeof location<"u"&&i.hostname!==location.hostname||a!==i.port}}doWrite(i,t){const a=this.request({method:"POST",data:i});a.on("success",t),a.on("error",(o,r)=>{this.onError("xhr post error",o,r)})}doPoll(){const i=this.request();i.on("data",this.onData.bind(this)),i.on("error",(t,a)=>{this.onError("xhr poll error",t,a)}),this.pollXhr=i}}class de extends ki{constructor(i,t,a){super(),this.createRequest=i,Ja(this,a),this._opts=a,this._method=a.method||"GET",this._uri=t,this._data=a.data!==void 0?a.data:null,this._create()}_create(){var i;const t=Qn(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const a=this._xhr=this.createRequest(t);try{a.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){a.setDisableHeaderCheck&&a.setDisableHeaderCheck(!0);for(let o in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(o)&&a.setRequestHeader(o,this._opts.extraHeaders[o])}}catch{}if(this._method==="POST")try{a.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{a.setRequestHeader("Accept","*/*")}catch{}(i=this._opts.cookieJar)===null||i===void 0||i.addCookies(a),"withCredentials"in a&&(a.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(a.timeout=this._opts.requestTimeout),a.onreadystatechange=()=>{var o;a.readyState===3&&((o=this._opts.cookieJar)===null||o===void 0||o.parseCookies(a.getResponseHeader("set-cookie"))),a.readyState===4&&(a.status===200||a.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof a.status=="number"?a.status:0)},0))},a.send(this._data)}catch(o){this.setTimeoutFn(()=>{this._onError(o)},0);return}typeof document<"u"&&(this._index=de.requestsCount++,de.requests[this._index]=this)}_onError(i){this.emitReserved("error",i,this._xhr),this._cleanup(!0)}_cleanup(i){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=Ou,i)try{this._xhr.abort()}catch{}typeof document<"u"&&delete de.requests[this._index],this._xhr=null}}_onLoad(){const i=this._xhr.responseText;i!==null&&(this.emitReserved("data",i),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}if(de.requestsCount=0,de.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Nn);else if(typeof addEventListener=="function"){const e="onpagehide"in _i?"pagehide":"unload";addEventListener(e,Nn,!1)}}function Nn(){for(let e in de.requests)de.requests.hasOwnProperty(e)&&de.requests[e].abort()}const Tu=function(){const e=xn({xdomain:!1});return e&&e.responseType!==null}();class wu extends zu{constructor(i){super(i);const t=i&&i.forceBase64;this.supportsBinary=Tu&&!t}request(i={}){return Object.assign(i,{xd:this.xd},this.opts),new de(xn,this.uri(),i)}}function xn(e){const i=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!i||xu))return new XMLHttpRequest}catch{}if(!i)try{return new _i[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const On=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Bu extends To{get name(){return"websocket"}doOpen(){const i=this.uri(),t=this.opts.protocols,a=On?{}:Qn(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(a.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(i,t,a)}catch(o){return this.emitReserved("error",o)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=i=>this.onClose({description:"websocket connection closed",context:i}),this.ws.onmessage=i=>this.onData(i.data),this.ws.onerror=i=>this.onError("websocket error",i)}write(i){this.writable=!1;for(let t=0;t<i.length;t++){const a=i[t],o=t===i.length-1;No(a,this.supportsBinary,r=>{try{this.doWrite(a,r)}catch{}o&&Va(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const i=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=jn()),this.supportsBinary||(t.b64=1),this.createUri(i,t)}}const wo=_i.WebSocket||_i.MozWebSocket;class Du extends Bu{createSocket(i,t,a){return On?new wo(i,t,a):t?new wo(i,t):new wo(i)}doWrite(i,t){this.ws.send(t)}}class Xu extends To{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(i){return this.emitReserved("error",i)}this._transport.closed.then(()=>{this.onClose()}).catch(i=>{this.onError("webtransport error",i)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(i=>{const t=Mu(Number.MAX_SAFE_INTEGER,this.socket.binaryType),a=i.readable.pipeThrough(t).getReader(),o=Wu();o.readable.pipeTo(i.writable),this._writer=o.writable.getWriter();const r=()=>{a.read().then(({done:n,value:l})=>{n||(this.onPacket(l),r())}).catch(n=>{})};r();const s={type:"open"};this.query.sid&&(s.data=`{"sid":"${this.query.sid}"}`),this._writer.write(s).then(()=>this.onOpen())})})}write(i){this.writable=!1;for(let t=0;t<i.length;t++){const a=i[t],o=t===i.length-1;this._writer.write(a).then(()=>{o&&Va(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var i;(i=this._transport)===null||i===void 0||i.close()}}const fu={websocket:Du,webtransport:Xu,polling:wu},vu=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Hu=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Bo(e){if(e.length>8e3)throw"URI too long";const i=e,t=e.indexOf("["),a=e.indexOf("]");t!=-1&&a!=-1&&(e=e.substring(0,t)+e.substring(t,a).replace(/:/g,";")+e.substring(a,e.length));let o=vu.exec(e||""),r={},s=14;for(;s--;)r[Hu[s]]=o[s]||"";return t!=-1&&a!=-1&&(r.source=i,r.host=r.host.substring(1,r.host.length-1).replace(/;/g,":"),r.authority=r.authority.replace("[","").replace("]","").replace(/;/g,":"),r.ipv6uri=!0),r.pathNames=Pu(r,r.path),r.queryKey=_u(r,r.query),r}function Pu(e,i){const t=/\/{2,9}/g,a=i.replace(t,"/").split("/");return(i.slice(0,1)=="/"||i.length===0)&&a.splice(0,1),i.slice(-1)=="/"&&a.splice(a.length-1,1),a}function _u(e,i){const t={};return i.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(a,o,r){o&&(t[o]=r)}),t}const Do=typeof addEventListener=="function"&&typeof removeEventListener=="function",ka=[];Do&&addEventListener("offline",()=>{ka.forEach(e=>e())},!1);class Re extends ki{constructor(i,t){if(super(),this.binaryType=Ru,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,i&&typeof i=="object"&&(t=i,i=null),i){const a=Bo(i);t.hostname=a.host,t.secure=a.protocol==="https"||a.protocol==="wss",t.port=a.port,a.query&&(t.query=a.query)}else t.host&&(t.hostname=Bo(t.host).host);Ja(this,t),this.secure=t.secure!=null?t.secure:typeof location<"u"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=t.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(a=>{const o=a.prototype.name;this.transports.push(o),this._transportsByName[o]=a}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=ju(this.opts.query)),Do&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},ka.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(i){const t=Object.assign({},this.opts.query);t.EIO=bn,t.transport=i,this.id&&(t.sid=this.id);const a=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[i]);return new this._transportsByName[i](a)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const i=this.opts.rememberUpgrade&&Re.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(i);t.open(),this.setTransport(t)}setTransport(i){this.transport&&this.transport.removeAllListeners(),this.transport=i,i.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",t=>this._onClose("transport close",t))}onOpen(){this.readyState="open",Re.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(i){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",i),this.emitReserved("heartbeat"),i.type){case"open":this.onHandshake(JSON.parse(i.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const t=new Error("server error");t.code=i.data,this._onError(t);break;case"message":this.emitReserved("data",i.data),this.emitReserved("message",i.data);break}}onHandshake(i){this.emitReserved("handshake",i),this.id=i.sid,this.transport.query.sid=i.sid,this._pingInterval=i.pingInterval,this._pingTimeout=i.pingTimeout,this._maxPayload=i.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const i=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+i,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},i),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const i=this._getWritablePackets();this.transport.send(i),this._prevBufferLen=i.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let a=0;a<this.writeBuffer.length;a++){const o=this.writeBuffer[a].data;if(o&&(t+=Gu(o)),a>0&&t>this._maxPayload)return this.writeBuffer.slice(0,a);t+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const i=Date.now()>this._pingTimeoutTime;return i&&(this._pingTimeoutTime=0,Va(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),i}write(i,t,a){return this._sendPacket("message",i,t,a),this}send(i,t,a){return this._sendPacket("message",i,t,a),this}_sendPacket(i,t,a,o){if(typeof t=="function"&&(o=t,t=void 0),typeof a=="function"&&(o=a,a=null),this.readyState==="closing"||this.readyState==="closed")return;a=a||{},a.compress=a.compress!==!1;const r={type:i,data:t,options:a};this.emitReserved("packetCreate",r),this.writeBuffer.push(r),o&&this.once("flush",o),this.flush()}close(){const i=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),i()},a=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?a():i()}):this.upgrading?a():i()),this}_onError(i){if(Re.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",i),this._onClose("transport error",i)}_onClose(i,t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Do&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const a=ka.indexOf(this._offlineEventListener);a!==-1&&ka.splice(a,1)}this.readyState="closed",this.id=null,this.emitReserved("close",i,t),this.writeBuffer=[],this._prevBufferLen=0}}}Re.protocol=bn;class $u extends Re{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let i=0;i<this._upgrades.length;i++)this._probe(this._upgrades[i])}_probe(i){let t=this.createTransport(i),a=!1;Re.priorWebsocketSuccess=!1;const o=()=>{a||(t.send([{type:"ping",data:"probe"}]),t.once("packet",p=>{if(!a)if(p.type==="pong"&&p.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;Re.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{a||this.readyState!=="closed"&&(q(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const u=new Error("probe error");u.transport=t.name,this.emitReserved("upgradeError",u)}}))};function r(){a||(a=!0,q(),t.close(),t=null)}const s=p=>{const u=new Error("probe error: "+p);u.transport=t.name,r(),this.emitReserved("upgradeError",u)};function n(){s("transport closed")}function l(){s("socket closed")}function A(p){t&&p.name!==t.name&&r()}const q=()=>{t.removeListener("open",o),t.removeListener("error",s),t.removeListener("close",n),this.off("close",l),this.off("upgrading",A)};t.once("open",o),t.once("error",s),t.once("close",n),this.once("close",l),this.once("upgrading",A),this._upgrades.indexOf("webtransport")!==-1&&i!=="webtransport"?this.setTimeoutFn(()=>{a||t.open()},200):t.open()}onHandshake(i){this._upgrades=this._filterUpgrades(i.upgrades),super.onHandshake(i)}_filterUpgrades(i){const t=[];for(let a=0;a<i.length;a++)~this.transports.indexOf(i[a])&&t.push(i[a]);return t}}let iI=class extends $u{constructor(i,t={}){const a=typeof i=="object"?i:t;(!a.transports||a.transports&&typeof a.transports[0]=="string")&&(a.transports=(a.transports||["polling","websocket","webtransport"]).map(o=>fu[o]).filter(o=>!!o)),super(i,a)}};function eI(e,i="",t){let a=e;t=t||typeof location<"u"&&location,e==null&&(e=t.protocol+"//"+t.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=t.protocol+e:e=t.host+e),/^(https?|wss?):\/\//.test(e)||(typeof t<"u"?e=t.protocol+"//"+e:e="https://"+e),a=Bo(e)),a.port||(/^(http|ws)$/.test(a.protocol)?a.port="80":/^(http|ws)s$/.test(a.protocol)&&(a.port="443")),a.path=a.path||"/";const r=a.host.indexOf(":")!==-1?"["+a.host+"]":a.host;return a.id=a.protocol+"://"+r+":"+a.port+i,a.href=a.protocol+"://"+r+(t&&t.port===a.port?"":":"+a.port),a}const tI=typeof ArrayBuffer=="function",aI=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,zn=Object.prototype.toString,oI=typeof Blob=="function"||typeof Blob<"u"&&zn.call(Blob)==="[object BlobConstructor]",rI=typeof File=="function"||typeof File<"u"&&zn.call(File)==="[object FileConstructor]";function Xo(e){return tI&&(e instanceof ArrayBuffer||aI(e))||oI&&e instanceof Blob||rI&&e instanceof File}function Wa(e,i){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let t=0,a=e.length;t<a;t++)if(Wa(e[t]))return!0;return!1}if(Xo(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return Wa(e.toJSON(),!0);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&Wa(e[t]))return!0;return!1}function sI(e){const i=[],t=e.data,a=e;return a.data=fo(t,i),a.attachments=i.length,{packet:a,buffers:i}}function fo(e,i){if(!e)return e;if(Xo(e)){const t={_placeholder:!0,num:i.length};return i.push(e),t}else if(Array.isArray(e)){const t=new Array(e.length);for(let a=0;a<e.length;a++)t[a]=fo(e[a],i);return t}else if(typeof e=="object"&&!(e instanceof Date)){const t={};for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=fo(e[a],i));return t}return e}function nI(e,i){return e.data=vo(e.data,i),delete e.attachments,e}function vo(e,i){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<i.length)return i[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let t=0;t<e.length;t++)e[t]=vo(e[t],i);else if(typeof e=="object")for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(e[t]=vo(e[t],i));return e}const lI=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],AI=5;var Ai;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})(Ai||(Ai={}));class qI{constructor(i){this.replacer=i}encode(i){return(i.type===Ai.EVENT||i.type===Ai.ACK)&&Wa(i)?this.encodeAsBinary({type:i.type===Ai.EVENT?Ai.BINARY_EVENT:Ai.BINARY_ACK,nsp:i.nsp,data:i.data,id:i.id}):[this.encodeAsString(i)]}encodeAsString(i){let t=""+i.type;return(i.type===Ai.BINARY_EVENT||i.type===Ai.BINARY_ACK)&&(t+=i.attachments+"-"),i.nsp&&i.nsp!=="/"&&(t+=i.nsp+","),i.id!=null&&(t+=i.id),i.data!=null&&(t+=JSON.stringify(i.data,this.replacer)),t}encodeAsBinary(i){const t=sI(i),a=this.encodeAsString(t.packet),o=t.buffers;return o.unshift(a),o}}function Tn(e){return Object.prototype.toString.call(e)==="[object Object]"}class Ho extends ki{constructor(i){super(),this.reviver=i}add(i){let t;if(typeof i=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(i);const a=t.type===Ai.BINARY_EVENT;a||t.type===Ai.BINARY_ACK?(t.type=a?Ai.EVENT:Ai.ACK,this.reconstructor=new mI(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(Xo(i)||i.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(i),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+i)}decodeString(i){let t=0;const a={type:Number(i.charAt(0))};if(Ai[a.type]===void 0)throw new Error("unknown packet type "+a.type);if(a.type===Ai.BINARY_EVENT||a.type===Ai.BINARY_ACK){const r=t+1;for(;i.charAt(++t)!=="-"&&t!=i.length;);const s=i.substring(r,t);if(s!=Number(s)||i.charAt(t)!=="-")throw new Error("Illegal attachments");a.attachments=Number(s)}if(i.charAt(t+1)==="/"){const r=t+1;for(;++t&&!(i.charAt(t)===","||t===i.length););a.nsp=i.substring(r,t)}else a.nsp="/";const o=i.charAt(t+1);if(o!==""&&Number(o)==o){const r=t+1;for(;++t;){const s=i.charAt(t);if(s==null||Number(s)!=s){--t;break}if(t===i.length)break}a.id=Number(i.substring(r,t+1))}if(i.charAt(++t)){const r=this.tryParse(i.substr(t));if(Ho.isPayloadValid(a.type,r))a.data=r;else throw new Error("invalid payload")}return a}tryParse(i){try{return JSON.parse(i,this.reviver)}catch{return!1}}static isPayloadValid(i,t){switch(i){case Ai.CONNECT:return Tn(t);case Ai.DISCONNECT:return t===void 0;case Ai.CONNECT_ERROR:return typeof t=="string"||Tn(t);case Ai.EVENT:case Ai.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&lI.indexOf(t[0])===-1);case Ai.ACK:case Ai.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class mI{constructor(i){this.packet=i,this.buffers=[],this.reconPack=i}takeBinaryData(i){if(this.buffers.push(i),this.buffers.length===this.reconPack.attachments){const t=nI(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const pI=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Ho,Encoder:qI,get PacketType(){return Ai},protocol:AI},Symbol.toStringTag,{value:"Module"}));function qe(e,i,t){return e.on(i,t),function(){e.off(i,t)}}const uI=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class wn extends ki{constructor(i,t,a){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=i,this.nsp=t,a&&a.auth&&(this.auth=a.auth),this._opts=Object.assign({},a),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const i=this.io;this.subs=[qe(i,"open",this.onopen.bind(this)),qe(i,"packet",this.onpacket.bind(this)),qe(i,"error",this.onerror.bind(this)),qe(i,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...i){return i.unshift("message"),this.emit.apply(this,i),this}emit(i,...t){var a,o,r;if(uI.hasOwnProperty(i))throw new Error('"'+i.toString()+'" is a reserved event name');if(t.unshift(i),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const s={type:Ai.EVENT,data:t};if(s.options={},s.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){const q=this.ids++,p=t.pop();this._registerAckCallback(q,p),s.id=q}const n=(o=(a=this.io.engine)===null||a===void 0?void 0:a.transport)===null||o===void 0?void 0:o.writable,l=this.connected&&!(!((r=this.io.engine)===null||r===void 0)&&r._hasPingExpired());return this.flags.volatile&&!n||(l?(this.notifyOutgoingListeners(s),this.packet(s)):this.sendBuffer.push(s)),this.flags={},this}_registerAckCallback(i,t){var a;const o=(a=this.flags.timeout)!==null&&a!==void 0?a:this._opts.ackTimeout;if(o===void 0){this.acks[i]=t;return}const r=this.io.setTimeoutFn(()=>{delete this.acks[i];for(let n=0;n<this.sendBuffer.length;n++)this.sendBuffer[n].id===i&&this.sendBuffer.splice(n,1);t.call(this,new Error("operation has timed out"))},o),s=(...n)=>{this.io.clearTimeoutFn(r),t.apply(this,n)};s.withError=!0,this.acks[i]=s}emitWithAck(i,...t){return new Promise((a,o)=>{const r=(s,n)=>s?o(s):a(n);r.withError=!0,t.push(r),this.emit(i,...t)})}_addToQueue(i){let t;typeof i[i.length-1]=="function"&&(t=i.pop());const a={id:this._queueSeq++,tryCount:0,pending:!1,args:i,flags:Object.assign({fromQueue:!0},this.flags)};i.push((o,...r)=>a!==this._queue[0]?void 0:(o!==null?a.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(o)):(this._queue.shift(),t&&t(null,...r)),a.pending=!1,this._drainQueue())),this._queue.push(a),this._drainQueue()}_drainQueue(i=!1){if(!this.connected||this._queue.length===0)return;const t=this._queue[0];t.pending&&!i||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(i){i.nsp=this.nsp,this.io._packet(i)}onopen(){typeof this.auth=="function"?this.auth(i=>{this._sendConnectPacket(i)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(i){this.packet({type:Ai.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},i):i})}onerror(i){this.connected||this.emitReserved("connect_error",i)}onclose(i,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",i,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(i=>{if(!this.sendBuffer.some(a=>String(a.id)===i)){const a=this.acks[i];delete this.acks[i],a.withError&&a.call(this,new Error("socket has been disconnected"))}})}onpacket(i){if(i.nsp===this.nsp)switch(i.type){case Ai.CONNECT:i.data&&i.data.sid?this.onconnect(i.data.sid,i.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Ai.EVENT:case Ai.BINARY_EVENT:this.onevent(i);break;case Ai.ACK:case Ai.BINARY_ACK:this.onack(i);break;case Ai.DISCONNECT:this.ondisconnect();break;case Ai.CONNECT_ERROR:this.destroy();const a=new Error(i.data.message);a.data=i.data.data,this.emitReserved("connect_error",a);break}}onevent(i){const t=i.data||[];i.id!=null&&t.push(this.ack(i.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(i){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const a of t)a.apply(this,i)}super.emit.apply(this,i),this._pid&&i.length&&typeof i[i.length-1]=="string"&&(this._lastOffset=i[i.length-1])}ack(i){const t=this;let a=!1;return function(...o){a||(a=!0,t.packet({type:Ai.ACK,id:i,data:o}))}}onack(i){const t=this.acks[i.id];typeof t=="function"&&(delete this.acks[i.id],t.withError&&i.data.unshift(null),t.apply(this,i.data))}onconnect(i,t){this.id=i,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(i=>this.emitEvent(i)),this.receiveBuffer=[],this.sendBuffer.forEach(i=>{this.notifyOutgoingListeners(i),this.packet(i)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(i=>i()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Ai.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(i){return this.flags.compress=i,this}get volatile(){return this.flags.volatile=!0,this}timeout(i){return this.flags.timeout=i,this}onAny(i){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(i),this}prependAny(i){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(i),this}offAny(i){if(!this._anyListeners)return this;if(i){const t=this._anyListeners;for(let a=0;a<t.length;a++)if(i===t[a])return t.splice(a,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(i){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(i),this}prependAnyOutgoing(i){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(i),this}offAnyOutgoing(i){if(!this._anyOutgoingListeners)return this;if(i){const t=this._anyOutgoingListeners;for(let a=0;a<t.length;a++)if(i===t[a])return t.splice(a,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(i){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const a of t)a.apply(this,i.data)}}}function tt(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}tt.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var i=Math.random(),t=Math.floor(i*this.jitter*e);e=Math.floor(i*10)&1?e+t:e-t}return Math.min(e,this.max)|0},tt.prototype.reset=function(){this.attempts=0},tt.prototype.setMin=function(e){this.ms=e},tt.prototype.setMax=function(e){this.max=e},tt.prototype.setJitter=function(e){this.jitter=e};class Po extends ki{constructor(i,t){var a;super(),this.nsps={},this.subs=[],i&&typeof i=="object"&&(t=i,i=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,Ja(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((a=t.randomizationFactor)!==null&&a!==void 0?a:.5),this.backoff=new tt({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=i;const o=t.parser||pI;this.encoder=new o.Encoder,this.decoder=new o.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(i){return arguments.length?(this._reconnection=!!i,i||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(i){return i===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=i,this)}reconnectionDelay(i){var t;return i===void 0?this._reconnectionDelay:(this._reconnectionDelay=i,(t=this.backoff)===null||t===void 0||t.setMin(i),this)}randomizationFactor(i){var t;return i===void 0?this._randomizationFactor:(this._randomizationFactor=i,(t=this.backoff)===null||t===void 0||t.setJitter(i),this)}reconnectionDelayMax(i){var t;return i===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=i,(t=this.backoff)===null||t===void 0||t.setMax(i),this)}timeout(i){return arguments.length?(this._timeout=i,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(i){if(~this._readyState.indexOf("open"))return this;this.engine=new iI(this.uri,this.opts);const t=this.engine,a=this;this._readyState="opening",this.skipReconnect=!1;const o=qe(t,"open",function(){a.onopen(),i&&i()}),r=n=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",n),i?i(n):this.maybeReconnectOnOpen()},s=qe(t,"error",r);if(this._timeout!==!1){const n=this._timeout,l=this.setTimeoutFn(()=>{o(),r(new Error("timeout")),t.close()},n);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(o),this.subs.push(s),this}connect(i){return this.open(i)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const i=this.engine;this.subs.push(qe(i,"ping",this.onping.bind(this)),qe(i,"data",this.ondata.bind(this)),qe(i,"error",this.onerror.bind(this)),qe(i,"close",this.onclose.bind(this)),qe(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(i){try{this.decoder.add(i)}catch(t){this.onclose("parse error",t)}}ondecoded(i){Va(()=>{this.emitReserved("packet",i)},this.setTimeoutFn)}onerror(i){this.emitReserved("error",i)}socket(i,t){let a=this.nsps[i];return a?this._autoConnect&&!a.active&&a.connect():(a=new wn(this,i,t),this.nsps[i]=a),a}_destroy(i){const t=Object.keys(this.nsps);for(const a of t)if(this.nsps[a].active)return;this._close()}_packet(i){const t=this.encoder.encode(i);for(let a=0;a<t.length;a++)this.engine.write(t[a],i.options)}cleanup(){this.subs.forEach(i=>i()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(i,t){var a;this.cleanup(),(a=this.engine)===null||a===void 0||a.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",i,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const i=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const a=this.setTimeoutFn(()=>{i.skipReconnect||(this.emitReserved("reconnect_attempt",i.backoff.attempts),!i.skipReconnect&&i.open(o=>{o?(i._reconnecting=!1,i.reconnect(),this.emitReserved("reconnect_error",o)):i.onreconnect()}))},t);this.opts.autoUnref&&a.unref(),this.subs.push(()=>{this.clearTimeoutFn(a)})}}onreconnect(){const i=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",i)}}const Wt={};function Ma(e,i){typeof e=="object"&&(i=e,e=void 0),i=i||{};const t=eI(e,i.path||"/socket.io"),a=t.source,o=t.id,r=t.path,s=Wt[o]&&r in Wt[o].nsps,n=i.forceNew||i["force new connection"]||i.multiplex===!1||s;let l;return n?l=new Po(a,i):(Wt[o]||(Wt[o]=new Po(a,i)),l=Wt[o]),t.query&&!i.query&&(i.query=t.queryKey),l.socket(t.path,i)}Object.assign(Ma,{Manager:Po,Socket:wn,io:Ma,connect:Ma});async function II(e,i,t){return(await Ki.post(t,{versionId:e,fileSize:i})).data}async function KI(e,i){return(await Ki.post(i+"/getFileSize",e)).data}const Ea=5,cI=({setIsExceedingFileSizeAccepted:e,closeModal:i,setLoading:t,typeOfProduct:a,versionId:o,fileSize:r,setFileSize:s,user:n,compressApi:l,producerApi:A,api:q})=>{const[p,u]=y.useState(!1),[I,c]=y.useState(!1);y.useEffect(()=>{const h=Ma(l,{path:"/socket.io"});return h.on("connect",()=>{console.log("Connected to the socket server")}),h.on("video-compressing",async b=>{if(console.log(b),b.userId===n._id&&b.isSuccess){console.log("Video compress successfull");const F=await KI({_id:o},q);s(F.size),e(!1)}}),h.on("error",b=>{console.error("Socket error:",b)}),()=>{h.disconnect()}},[o]);const Z=()=>{i(),e(!1),t(!0)},K=async()=>{try{u(!0);const h=await II(o,r,`${A}/videos/compressByDiff`);console.log("Compression result:",h),t(!1)}catch(h){console.error("Error compressing video:",h),t(!1),i()}},S=qi[a],W=Vt[a],U=r-Ea,k=Ea/r*100;return m.jsxs(ua,{isOpen:!0,ariaHideApp:!1,onRequestClose:Z,style:{content:{position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)",borderRadius:"1.5rem",backgroundColor:"white",zIndex:50,maxWidth:"32rem",width:"100%",height:"100%",maxHeight:"34.5rem",overflow:"hidden",padding:"0px"},overlay:{position:"fixed",backgroundColor:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(4px)",WebkitBackdropFilter:"blur(4px)",zIndex:50,top:0,left:0,right:0,bottom:0}},contentLabel:"Playable Size Exceeding Modal",shouldCloseOnOverlayClick:!0,children:[m.jsx("button",{onClick:Z,style:{position:"absolute",top:"1.25rem",right:"1.25rem",padding:"0.5rem",borderRadius:"9999px",transition:"all 0.3s",zIndex:10,border:"none",background:"transparent",cursor:"pointer"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="#f1f5f9"},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent"},"aria-label":"Close",children:m.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{color:"#94a3b8",transition:"color 0.3s"},onMouseEnter:h=>{h.currentTarget.style.color="#0f172a"},onMouseLeave:h=>{h.currentTarget.style.color="#94a3b8"},children:[m.jsx("path",{d:"M18 6 6 18"}),m.jsx("path",{d:"m6 6 12 12"})]})}),m.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center",gap:"8px",paddingLeft:"2rem",paddingRight:"2rem",paddingTop:"2.5rem",paddingBottom:"2.5rem",height:"100%",width:"100%"},children:[m.jsxs("div",{style:{position:"relative",marginBottom:"1.5rem"},children:[m.jsx("div",{style:{position:"absolute",inset:0,borderRadius:"9999px",filter:"blur(24px)",opacity:.4,animation:"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",backgroundColor:S}}),m.jsx("div",{style:{position:"relative",width:"80px",height:"80px",borderRadius:"9999px",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)",backgroundColor:S},children:m.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"44",height:"44",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[m.jsx("circle",{cx:"12",cy:"12",r:"10"}),m.jsx("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),m.jsx("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]})})]}),m.jsx("h2",{style:{fontSize:"24px",fontWeight:"bold",color:"#0f172a",marginBottom:"0.5rem",letterSpacing:"-0.025em"},children:"Playable Size Too Large"}),m.jsxs("div",{style:{backgroundColor:"#f8fafc",borderRadius:"0.75rem",paddingLeft:"1rem",paddingRight:"1rem",paddingTop:"0.75rem",paddingBottom:"0.75rem",marginBottom:"1rem",width:"100%",border:"1px solid #e2e8f0"},children:[m.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:"0.875rem"},children:[m.jsx("span",{style:{color:"#475569"},children:"Current size:"}),m.jsxs("span",{style:{fontWeight:"bold",fontSize:"18px",color:S},children:[r.toFixed(1)," MB"]})]}),m.jsxs("div",{style:{marginTop:"0.5rem",width:"100%",position:"relative"},children:[m.jsx("div",{style:{width:"100%",backgroundColor:"#e2e8f0",borderRadius:"9999px",height:"0.5rem",overflow:"hidden"},children:m.jsx("div",{style:{height:"100%",borderTopLeftRadius:"9999px",borderBottomLeftRadius:"9999px",width:`${k}%`,backgroundColor:S}})}),m.jsx("div",{style:{position:"absolute",top:0,width:"0.125rem",height:"0.5rem",backgroundColor:"#334155",zIndex:10,left:`${k}%`}}),m.jsx("div",{style:{position:"absolute",top:0,height:"0.5rem",overflow:"hidden",left:`${k}%`,width:`${100-k}%`},children:m.jsx("div",{style:{height:"100%",borderTopRightRadius:"9999px",borderBottomRightRadius:"9999px",opacity:.6,backgroundColor:S,backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 3px, rgba(255,255,255,0.3) 3px, rgba(255,255,255,0.3) 6px)"}})})]}),m.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:"0.75rem",marginTop:"0.25rem"},children:[m.jsxs("span",{style:{color:"#64748b"},children:["Limit: ",Ea," MB"]}),m.jsxs("span",{style:{fontWeight:500,fontSize:"12px",color:S},children:["+",U.toFixed(1)," MB over"]})]})]}),p?m.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",paddingTop:"2rem",paddingBottom:"2rem"},children:[m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:S,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{animation:"spin 1s linear infinite",marginBottom:"1rem"},children:m.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),m.jsx("style",{children:`
|
|
93
93
|
@keyframes spin {
|
|
94
94
|
from {
|
|
95
95
|
transform: rotate(0deg);
|