gearboxdownloadmodal 6.0.32 → 6.0.33

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.umd.js CHANGED
@@ -53,7 +53,7 @@ Valid keys: `+JSON.stringify(Object.keys(Z),null," "));var W=se(R,B,O,$,K+"."+B
53
53
  `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(o=>r.set(o)),r}static accessor(t){const r=(this[po]=this[po]={accessors:{}}).accessors,o=this.prototype;function i(a){const A=wt(a);r[A]||(cA(o,a),r[A]=!0)}return q.isArray(t)?t.forEach(i):i(t),this}}Bt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),q.reduceDescriptors(Bt.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}}),q.freezeMethods(Bt);const ze=Bt;function Yn(e,t){const n=this||jn,r=t||n,o=ze.from(r.headers);let i=r.data;return q.forEach(e,function(A){i=A.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function fo(e){return!!(e&&e.__CANCEL__)}function dt(e,t,n){U.call(this,e??"canceled",U.ERR_CANCELED,t,n),this.name="CanceledError"}q.inherits(dt,U,{__CANCEL__:!0});function ho(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new U("Request failed with status code "+n.status,[U.ERR_BAD_REQUEST,U.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function dA(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function mA(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o=0,i=0,a;return t=t!==void 0?t:1e3,function(d){const u=Date.now(),l=r[i];a||(a=u),n[o]=d,r[o]=u;let m=i,v=0;for(;m!==o;)v+=n[m++],m=m%e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),u-a<t)return;const g=l&&u-l;return g?Math.round(v*1e3/g):void 0}}function pA(e,t){let n=0;const r=1e3/t;let o=null;return function(){const a=this===!0,A=Date.now();if(a||A-n>r)return o&&(clearTimeout(o),o=null),n=A,e.apply(null,arguments);o||(o=setTimeout(()=>(o=null,n=Date.now(),e.apply(null,arguments)),r-(A-n)))}}const Ut=(e,t,n=3)=>{let r=0;const o=mA(50,250);return pA(i=>{const a=i.loaded,A=i.lengthComputable?i.total:void 0,d=a-r,u=o(d),l=a<=A;r=a;const m={loaded:a,total:A,progress:A?a/A:void 0,bytes:d,rate:u||void 0,estimated:u&&A&&l?(A-a)/u:void 0,event:i,lengthComputable:A!=null};m[t?"download":"upload"]=!0,e(m)},n)},fA=je.hasStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");let r;function o(i){let a=i;return t&&(n.setAttribute("href",a),a=n.href),n.setAttribute("href",a),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return r=o(window.location.href),function(a){const A=q.isString(a)?o(a):a;return A.protocol===r.protocol&&A.host===r.host}}():function(){return function(){return!0}}(),hA=je.hasStandardBrowserEnv?{write(e,t,n,r,o,i){const a=[e+"="+encodeURIComponent(t)];q.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),q.isString(r)&&a.push("path="+r),q.isString(o)&&a.push("domain="+o),i===!0&&a.push("secure"),document.cookie=a.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function gA(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function qA(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function go(e,t){return e&&!gA(t)?qA(e,t):t}const qo=e=>e instanceof ze?{...e}:e;function et(e,t){t=t||{};const n={};function r(u,l,m){return q.isPlainObject(u)&&q.isPlainObject(l)?q.merge.call({caseless:m},u,l):q.isPlainObject(l)?q.merge({},l):q.isArray(l)?l.slice():l}function o(u,l,m){if(q.isUndefined(l)){if(!q.isUndefined(u))return r(void 0,u,m)}else return r(u,l,m)}function i(u,l){if(!q.isUndefined(l))return r(void 0,l)}function a(u,l){if(q.isUndefined(l)){if(!q.isUndefined(u))return r(void 0,u)}else return r(void 0,l)}function A(u,l,m){if(m in t)return r(u,l);if(m in e)return r(void 0,u)}const d={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:A,headers:(u,l)=>o(qo(u),qo(l),!0)};return q.forEach(Object.keys(Object.assign({},e,t)),function(l){const m=d[l]||o,v=m(e[l],t[l],l);q.isUndefined(v)&&m!==A||(n[l]=v)}),n}const yo=e=>{const t=et({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:i,headers:a,auth:A}=t;t.headers=a=ze.from(a),t.url=lo(go(t.baseURL,t.url),e.params,e.paramsSerializer),A&&a.set("Authorization","Basic "+btoa((A.username||"")+":"+(A.password?unescape(encodeURIComponent(A.password)):"")));let d;if(q.isFormData(n)){if(je.hasStandardBrowserEnv||je.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if((d=a.getContentType())!==!1){const[u,...l]=d?d.split(";").map(m=>m.trim()).filter(Boolean):[];a.setContentType([u||"multipart/form-data",...l].join("; "))}}if(je.hasStandardBrowserEnv&&(r&&q.isFunction(r)&&(r=r(t)),r||r!==!1&&fA(t.url))){const u=o&&i&&hA.read(i);u&&a.set(o,u)}return t},yA=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(n,r){const o=yo(e);let i=o.data;const a=ze.from(o.headers).normalize();let{responseType:A}=o,d;function u(){o.cancelToken&&o.cancelToken.unsubscribe(d),o.signal&&o.signal.removeEventListener("abort",d)}let l=new XMLHttpRequest;l.open(o.method.toUpperCase(),o.url,!0),l.timeout=o.timeout;function m(){if(!l)return;const g=ze.from("getAllResponseHeaders"in l&&l.getAllResponseHeaders()),p={data:!A||A==="text"||A==="json"?l.responseText:l.response,status:l.status,statusText:l.statusText,headers:g,config:e,request:l};ho(function(w){n(w),u()},function(w){r(w),u()},p),l=null}"onloadend"in l?l.onloadend=m:l.onreadystatechange=function(){!l||l.readyState!==4||l.status===0&&!(l.responseURL&&l.responseURL.indexOf("file:")===0)||setTimeout(m)},l.onabort=function(){l&&(r(new U("Request aborted",U.ECONNABORTED,o,l)),l=null)},l.onerror=function(){r(new U("Network Error",U.ERR_NETWORK,o,l)),l=null},l.ontimeout=function(){let f=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const p=o.transitional||co;o.timeoutErrorMessage&&(f=o.timeoutErrorMessage),r(new U(f,p.clarifyTimeoutError?U.ETIMEDOUT:U.ECONNABORTED,o,l)),l=null},i===void 0&&a.setContentType(null),"setRequestHeader"in l&&q.forEach(a.toJSON(),function(f,p){l.setRequestHeader(p,f)}),q.isUndefined(o.withCredentials)||(l.withCredentials=!!o.withCredentials),A&&A!=="json"&&(l.responseType=o.responseType),typeof o.onDownloadProgress=="function"&&l.addEventListener("progress",Ut(o.onDownloadProgress,!0)),typeof o.onUploadProgress=="function"&&l.upload&&l.upload.addEventListener("progress",Ut(o.onUploadProgress)),(o.cancelToken||o.signal)&&(d=g=>{l&&(r(!g||g.type?new dt(null,e,l):g),l.abort(),l=null)},o.cancelToken&&o.cancelToken.subscribe(d),o.signal&&(o.signal.aborted?d():o.signal.addEventListener("abort",d)));const v=dA(o.url);if(v&&je.protocols.indexOf(v)===-1){r(new U("Unsupported protocol "+v+":",U.ERR_BAD_REQUEST,e));return}l.send(i||null)})},vA=(e,t)=>{let n=new AbortController,r;const o=function(d){if(!r){r=!0,a();const u=d instanceof Error?d:this.reason;n.abort(u instanceof U?u:new dt(u instanceof Error?u.message:u))}};let i=t&&setTimeout(()=>{o(new U(`timeout ${t} of ms exceeded`,U.ETIMEDOUT))},t);const a=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(d=>{d&&(d.removeEventListener?d.removeEventListener("abort",o):d.unsubscribe(o))}),e=null)};e.forEach(d=>d&&d.addEventListener&&d.addEventListener("abort",o));const{signal:A}=n;return A.unsubscribe=a,[A,()=>{i&&clearTimeout(i),i=null}]},bA=function*(e,t){let n=e.byteLength;if(!t||n<t){yield e;return}let r=0,o;for(;r<n;)o=r+t,yield e.slice(r,o),r=o},CA=async function*(e,t,n){for await(const r of e)yield*bA(ArrayBuffer.isView(r)?r:await n(String(r)),t)},vo=(e,t,n,r,o)=>{const i=CA(e,t,o);let a=0;return new ReadableStream({type:"bytes",async pull(A){const{done:d,value:u}=await i.next();if(d){A.close(),r();return}let l=u.byteLength;n&&n(a+=l),A.enqueue(new Uint8Array(u))},cancel(A){return r(A),i.return()}},{highWaterMark:2})},bo=(e,t)=>{const n=e!=null;return r=>setTimeout(()=>t({lengthComputable:n,total:e,loaded:r}))},Ft=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Co=Ft&&typeof ReadableStream=="function",Jn=Ft&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),ZA=Co&&(()=>{let e=!1;const t=new Request(je.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t})(),Zo=64*1024,Nn=Co&&!!(()=>{try{return q.isReadableStream(new Response("").body)}catch{}})(),_t={stream:Nn&&(e=>e.body)};Ft&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!_t[t]&&(_t[t]=q.isFunction(e[t])?n=>n[t]():(n,r)=>{throw new U(`Response type '${t}' is not supported`,U.ERR_NOT_SUPPORT,r)})})})(new Response);const IA=async e=>{if(e==null)return 0;if(q.isBlob(e))return e.size;if(q.isSpecCompliantForm(e))return(await new Request(e).arrayBuffer()).byteLength;if(q.isArrayBufferView(e))return e.byteLength;if(q.isURLSearchParams(e)&&(e=e+""),q.isString(e))return(await Jn(e)).byteLength},wA=async(e,t)=>{const n=q.toFiniteNumber(e.getContentLength());return n??IA(t)},Rn={http:Pa,xhr:yA,fetch:Ft&&(async e=>{let{url:t,method:n,data:r,signal:o,cancelToken:i,timeout:a,onDownloadProgress:A,onUploadProgress:d,responseType:u,headers:l,withCredentials:m="same-origin",fetchOptions:v}=yo(e);u=u?(u+"").toLowerCase():"text";let[g,f]=o||i||a?vA([o,i],a):[],p,y;const w=()=>{!p&&setTimeout(()=>{g&&g.unsubscribe()}),p=!0};let j;try{if(d&&ZA&&n!=="get"&&n!=="head"&&(j=await wA(l,r))!==0){let T=new Request(t,{method:"POST",body:r,duplex:"half"}),X;q.isFormData(r)&&(X=T.headers.get("content-type"))&&l.setContentType(X),T.body&&(r=vo(T.body,Zo,bo(j,Ut(d)),null,Jn))}q.isString(m)||(m=m?"cors":"omit"),y=new Request(t,{...v,signal:g,method:n.toUpperCase(),headers:l.normalize().toJSON(),body:r,duplex:"half",withCredentials:m});let M=await fetch(y);const E=Nn&&(u==="stream"||u==="response");if(Nn&&(A||E)){const T={};["status","statusText","headers"].forEach(F=>{T[F]=M[F]});const X=q.toFiniteNumber(M.headers.get("content-length"));M=new Response(vo(M.body,Zo,A&&bo(X,Ut(A,!0)),E&&w,Jn),T)}u=u||"text";let b=await _t[q.findKey(_t,u)||"text"](M,e);return!E&&w(),f&&f(),await new Promise((T,X)=>{ho(T,X,{data:b,headers:ze.from(M.headers),status:M.status,statusText:M.statusText,config:e,request:y})})}catch(M){throw w(),M&&M.name==="TypeError"&&/fetch/i.test(M.message)?Object.assign(new U("Network Error",U.ERR_NETWORK,e,y),{cause:M.cause||M}):U.from(M,M&&M.code,e,y)}})};q.forEach(Rn,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Io=e=>`- ${e}`,xA=e=>q.isFunction(e)||e===null||e===!1,wo={getAdapter:e=>{e=q.isArray(e)?e:[e];const{length:t}=e;let n,r;const o={};for(let i=0;i<t;i++){n=e[i];let a;if(r=n,!xA(n)&&(r=Rn[(a=String(n)).toLowerCase()],r===void 0))throw new U(`Unknown adapter '${a}'`);if(r)break;o[a||"#"+i]=r}if(!r){const i=Object.entries(o).map(([A,d])=>`adapter ${A} `+(d===!1?"is not supported by the environment":"is not available in the build"));let a=t?i.length>1?`since :
54
54
  `+i.map(Io).join(`
55
55
  `):" "+Io(i[0]):"as no adapter specified";throw new U("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return r},adapters:Rn};function Dn(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new dt(null,e)}function xo(e){return Dn(e),e.headers=ze.from(e.headers),e.data=Yn.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),wo.getAdapter(e.adapter||jn.adapter)(e).then(function(r){return Dn(e),r.data=Yn.call(e,e.transformResponse,r),r.headers=ze.from(r.headers),r},function(r){return fo(r)||(Dn(e),r&&r.response&&(r.response.data=Yn.call(e,e.transformResponse,r.response),r.response.headers=ze.from(r.response.headers))),Promise.reject(r)})}const Ko="1.7.2",Gn={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Gn[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const So={};Gn.transitional=function(t,n,r){function o(i,a){return"[Axios v"+Ko+"] Transitional option '"+i+"'"+a+(r?". "+r:"")}return(i,a,A)=>{if(t===!1)throw new U(o(a," has been removed"+(n?" in "+n:"")),U.ERR_DEPRECATED);return n&&!So[a]&&(So[a]=!0,console.warn(o(a," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,a,A):!0}};function KA(e,t,n){if(typeof e!="object")throw new U("options must be an object",U.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const i=r[o],a=t[i];if(a){const A=e[i],d=A===void 0||a(A,i,e);if(d!==!0)throw new U("option "+i+" must be "+d,U.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new U("Unknown option "+i,U.ERR_BAD_OPTION)}}const Tn={assertOptions:KA,validators:Gn},Be=Tn.validators;class $t{constructor(t){this.defaults=t,this.interceptors={request:new uo,response:new uo}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let o;Error.captureStackTrace?Error.captureStackTrace(o={}):o=new Error;const i=o.stack?o.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=`
56
- `+i):r.stack=i}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=et(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:i}=n;r!==void 0&&Tn.assertOptions(r,{silentJSONParsing:Be.transitional(Be.boolean),forcedJSONParsing:Be.transitional(Be.boolean),clarifyTimeoutError:Be.transitional(Be.boolean)},!1),o!=null&&(q.isFunction(o)?n.paramsSerializer={serialize:o}:Tn.assertOptions(o,{encode:Be.function,serialize:Be.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=i&&q.merge(i.common,i[n.method]);i&&q.forEach(["delete","get","head","post","put","patch","common"],f=>{delete i[f]}),n.headers=ze.concat(a,i);const A=[];let d=!0;this.interceptors.request.forEach(function(p){typeof p.runWhen=="function"&&p.runWhen(n)===!1||(d=d&&p.synchronous,A.unshift(p.fulfilled,p.rejected))});const u=[];this.interceptors.response.forEach(function(p){u.push(p.fulfilled,p.rejected)});let l,m=0,v;if(!d){const f=[xo.bind(this),void 0];for(f.unshift.apply(f,A),f.push.apply(f,u),v=f.length,l=Promise.resolve(n);m<v;)l=l.then(f[m++],f[m++]);return l}v=A.length;let g=n;for(m=0;m<v;){const f=A[m++],p=A[m++];try{g=f(g)}catch(y){p.call(this,y);break}}try{l=xo.call(this,g)}catch(f){return Promise.reject(f)}for(m=0,v=u.length;m<v;)l=l.then(u[m++],u[m++]);return l}getUri(t){t=et(this.defaults,t);const n=go(t.baseURL,t.url);return lo(n,t.params,t.paramsSerializer)}}q.forEach(["delete","get","head","options"],function(t){$t.prototype[t]=function(n,r){return this.request(et(r||{},{method:t,url:n,data:(r||{}).data}))}}),q.forEach(["post","put","patch"],function(t){function n(r){return function(i,a,A){return this.request(et(A||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))}}$t.prototype[t]=n(),$t.prototype[t+"Form"]=n(!0)});const en=$t;class Hn{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(o=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](o);r._listeners=null}),this.promise.then=o=>{let i;const a=new Promise(A=>{r.subscribe(A),i=A}).then(o);return a.cancel=function(){r.unsubscribe(i)},a},t(function(i,a,A){r.reason||(r.reason=new dt(i,a,A),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}static source(){let t;return{token:new Hn(function(o){t=o}),cancel:t}}}const SA=Hn;function WA(e){return function(n){return e.apply(null,n)}}function MA(e){return q.isObject(e)&&e.isAxiosError===!0}const Xn={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};Object.entries(Xn).forEach(([e,t])=>{Xn[t]=e});const LA=Xn;function Wo(e){const t=new en(e),n=Pr(en.prototype.request,t);return q.extend(n,en.prototype,t,{allOwnKeys:!0}),q.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return Wo(et(e,o))},n}const fe=Wo(jn);fe.Axios=en,fe.CanceledError=dt,fe.CancelToken=SA,fe.isCancel=fo,fe.VERSION=Ko,fe.toFormData=Pt,fe.AxiosError=U,fe.Cancel=fe.CanceledError,fe.all=function(t){return Promise.all(t)},fe.spread=WA,fe.isAxiosError=MA,fe.mergeConfig=et,fe.AxiosHeaders=ze,fe.formToJSON=e=>mo(q.isHTMLForm(e)?new FormData(e):e),fe.getAdapter=wo.getAdapter,fe.HttpStatusCode=LA,fe.default=fe;const EA=fe;/*! typescript-cookie v1.0.6 | MIT */const Mo=e=>encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),Lo=e=>encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent),Qn=decodeURIComponent,Pn=e=>(e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent));function OA(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(([t,n])=>n!=null&&n!==!1).map(([t,n])=>n===!0?`; ${t}`:`; ${t}=${n.split(";")[0]}`).join("")}function Eo(e,t,n){const r=/(?:^|; )([^=]*)=([^;]*)/g,o={};let i;for(;(i=r.exec(document.cookie))!=null;)try{const a=n(i[1]);if(o[a]=t(i[2],a),e===a)break}catch{}return e!=null?o[e]:o}const Oo=Object.freeze({decodeName:Qn,decodeValue:Pn,encodeName:Mo,encodeValue:Lo}),Vn=Object.freeze({path:"/"});function ko(e,t,n=Vn,{encodeValue:r=Lo,encodeName:o=Mo}={}){return document.cookie=`${o(e)}=${r(t,e)}${OA(n)}`}function jo(e,{decodeValue:t=Pn,decodeName:n=Qn}={}){return Eo(e,t,n)}function kA({decodeValue:e=Pn,decodeName:t=Qn}={}){return Eo(void 0,e,t)}function jA(e,t=Vn){ko(e,"",Object.assign({},t,{expires:-1}))}function Bn(e,t){const n={set:function(o,i,a){return ko(o,i,Object.assign({},this.attributes,a),{encodeValue:this.converter.write})},get:function(o){if(arguments.length===0)return kA(this.converter.read);if(o!=null)return jo(o,this.converter.read)},remove:function(o,i){jA(o,Object.assign({},this.attributes,i))},withAttributes:function(o){return Bn(this.converter,Object.assign({},this.attributes,o))},withConverter:function(o){return Bn(Object.assign({},this.converter,o),this.attributes)}},r={attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}};return Object.create(n,r)}Bn({read:Oo.decodeValue,write:Oo.encodeValue},Vn);let zo;typeof window<"u"&&(zo=jo("token"));const ge=EA.create({headers:{Authorization:zo}});async function zA(e,t,n){return(await ge.post(n+"/createFlexVersionLinkMulti",{_id:e,networks:t})).data}async function YA(e,t){return e.network=="fb"&&(e.zip=1),(await ge.post(t+"/createFlexVersionLink",e||{})).data}async function JA(e,t,n){return(await ge.post(e+"/createImportedVersionLink",{_id:t,network:n})).data}async function NA(e,t,n,r,o){return(await ge.post(e+"/createPlayableVersionLink",{_id:t,network:n,isPfTest:r,extras:o})).data}async function RA(e,t,n){return(await ge.post(n+"/createPlayableVersionLinkMulti",{_id:e,networks:t})).data}async function DA(e,t,n,r,o){return(await ge.post(e+"/createReadyVersionLink",{_id:t,network:n,isPfTest:r,extras:o})).data}async function GA(e,t,n){return(await ge.post(n+"/createReadyVersionLinkMulti",{_id:e,networks:t})).data}async function TA(e,t){return(await ge.post(t+"/getCdnExportName",e||{})).data}async function HA(e,t){return(await ge.post(t+"/updateFlexUrl",e||{})).data}async function Yo(e,t,n){return(await ge.post(n+"/updatePlayableVersion",{...t,_id:e})).data}function xt(e){const t=document.createElement("input");t.value=e,document.body.appendChild(t),t.select();try{return document.execCommand("copy")?(document.body.removeChild(t),!0):(document.body.removeChild(t),!1)}catch{return document.body.removeChild(t),!1}}function Jo(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=Jo(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function Ue(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=Jo(e))&&(r&&(r+=" "),r+=t);return r}const Kt=e=>typeof e=="number"&&!isNaN(e),tt=e=>typeof e=="string",Ze=e=>typeof e=="function",tn=e=>tt(e)||Ze(e)?e:null,Un=e=>C.isValidElement(e)||tt(e)||Ze(e)||Kt(e);function XA(e,t,n){n===void 0&&(n=300);const{scrollHeight:r,style:o}=e;requestAnimationFrame(()=>{o.minHeight="initial",o.height=r+"px",o.transition=`all ${n}ms`,requestAnimationFrame(()=>{o.height="0",o.padding="0",o.margin="0",setTimeout(t,n)})})}function nn(e){let{enter:t,exit:n,appendPosition:r=!1,collapse:o=!0,collapseDuration:i=300}=e;return function(a){let{children:A,position:d,preventExitTransition:u,done:l,nodeRef:m,isIn:v}=a;const g=r?`${t}--${d}`:t,f=r?`${n}--${d}`:n,p=C.useRef(0);return C.useLayoutEffect(()=>{const y=m.current,w=g.split(" "),j=M=>{M.target===m.current&&(y.dispatchEvent(new Event("d")),y.removeEventListener("animationend",j),y.removeEventListener("animationcancel",j),p.current===0&&M.type!=="animationcancel"&&y.classList.remove(...w))};y.classList.add(...w),y.addEventListener("animationend",j),y.addEventListener("animationcancel",j)},[]),C.useEffect(()=>{const y=m.current,w=()=>{y.removeEventListener("animationend",w),o?XA(y,l,i):l()};v||(u?w():(p.current=1,y.className+=` ${f}`,y.addEventListener("animationend",w)))},[v]),C.createElement(C.Fragment,null,A)}}function No(e,t){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:t}:{}}const Me={list:new Map,emitQueue:new Map,on(e,t){return this.list.has(e)||this.list.set(e,[]),this.list.get(e).push(t),this},off(e,t){if(t){const n=this.list.get(e).filter(r=>r!==t);return this.list.set(e,n),this}return this.list.delete(e),this},cancelEmit(e){const t=this.emitQueue.get(e);return t&&(t.forEach(clearTimeout),this.emitQueue.delete(e)),this},emit(e){this.list.has(e)&&this.list.get(e).forEach(t=>{const n=setTimeout(()=>{t(...[].slice.call(arguments,1))},0);this.emitQueue.has(e)||this.emitQueue.set(e,[]),this.emitQueue.get(e).push(n)})}},rn=e=>{let{theme:t,type:n,...r}=e;return C.createElement("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:t==="colored"?"currentColor":`var(--toastify-icon-color-${n})`,...r})},Fn={info:function(e){return C.createElement(rn,{...e},C.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 C.createElement(rn,{...e},C.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 C.createElement(rn,{...e},C.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 C.createElement(rn,{...e},C.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 C.createElement("div",{className:"Toastify__spinner"})}};function QA(e){const[,t]=C.useReducer(g=>g+1,0),[n,r]=C.useState([]),o=C.useRef(null),i=C.useRef(new Map).current,a=g=>n.indexOf(g)!==-1,A=C.useRef({toastKey:1,displayedToast:0,count:0,queue:[],props:e,containerId:null,isToastActive:a,getToast:g=>i.get(g)}).current;function d(g){let{containerId:f}=g;const{limit:p}=A.props;!p||f&&A.containerId!==f||(A.count-=A.queue.length,A.queue=[])}function u(g){r(f=>g==null?[]:f.filter(p=>p!==g))}function l(){const{toastContent:g,toastProps:f,staleId:p}=A.queue.shift();v(g,f,p)}function m(g,f){let{delay:p,staleId:y,...w}=f;if(!Un(g)||function(Q){return!o.current||A.props.enableMultiContainer&&Q.containerId!==A.props.containerId||i.has(Q.toastId)&&Q.updateId==null}(w))return;const{toastId:j,updateId:M,data:E}=w,{props:b}=A,T=()=>u(j),X=M==null;X&&A.count++;const F={...b,style:b.toastStyle,key:A.toastKey++,...Object.fromEntries(Object.entries(w).filter(Q=>{let[_,S]=Q;return S!=null})),toastId:j,updateId:M,data:E,closeToast:T,isIn:!1,className:tn(w.className||b.toastClassName),bodyClassName:tn(w.bodyClassName||b.bodyClassName),progressClassName:tn(w.progressClassName||b.progressClassName),autoClose:!w.isLoading&&(le=w.autoClose,te=b.autoClose,le===!1||Kt(le)&&le>0?le:te),deleteToast(){const Q=No(i.get(j),"removed");i.delete(j),Me.emit(4,Q);const _=A.queue.length;if(A.count=j==null?A.count-A.displayedToast:A.count-1,A.count<0&&(A.count=0),_>0){const S=j==null?A.props.limit:1;if(_===1||S===1)A.displayedToast++,l();else{const J=S>_?_:S;A.displayedToast=J;for(let N=0;N<J;N++)l()}}else t()}};var le,te;F.iconOut=function(Q){let{theme:_,type:S,isLoading:J,icon:N}=Q,h=null;const z={theme:_,type:S};return N===!1||(Ze(N)?h=N(z):C.isValidElement(N)?h=C.cloneElement(N,z):tt(N)||Kt(N)?h=N:J?h=Fn.spinner():(D=>D in Fn)(S)&&(h=Fn[S](z))),h}(F),Ze(w.onOpen)&&(F.onOpen=w.onOpen),Ze(w.onClose)&&(F.onClose=w.onClose),F.closeButton=b.closeButton,w.closeButton===!1||Un(w.closeButton)?F.closeButton=w.closeButton:w.closeButton===!0&&(F.closeButton=!Un(b.closeButton)||b.closeButton);let Ae=g;C.isValidElement(g)&&!tt(g.type)?Ae=C.cloneElement(g,{closeToast:T,toastProps:F,data:E}):Ze(g)&&(Ae=g({closeToast:T,toastProps:F,data:E})),b.limit&&b.limit>0&&A.count>b.limit&&X?A.queue.push({toastContent:Ae,toastProps:F,staleId:y}):Kt(p)?setTimeout(()=>{v(Ae,F,y)},p):v(Ae,F,y)}function v(g,f,p){const{toastId:y}=f;p&&i.delete(p);const w={content:g,props:f};i.set(y,w),r(j=>[...j,y].filter(M=>M!==p)),Me.emit(4,No(w,w.props.updateId==null?"added":"updated"))}return C.useEffect(()=>(A.containerId=e.containerId,Me.cancelEmit(3).on(0,m).on(1,g=>o.current&&u(g)).on(5,d).emit(2,A),()=>{i.clear(),Me.emit(3,A)}),[]),C.useEffect(()=>{A.props=e,A.isToastActive=a,A.displayedToast=n.length}),{getToastToRender:function(g){const f=new Map,p=Array.from(i.values());return e.newestOnTop&&p.reverse(),p.forEach(y=>{const{position:w}=y.props;f.has(w)||f.set(w,[]),f.get(w).push(y)}),Array.from(f,y=>g(y[0],y[1]))},containerRef:o,isToastActive:a}}function Ro(e){return e.targetTouches&&e.targetTouches.length>=1?e.targetTouches[0].clientX:e.clientX}function Do(e){return e.targetTouches&&e.targetTouches.length>=1?e.targetTouches[0].clientY:e.clientY}function PA(e){const[t,n]=C.useState(!1),[r,o]=C.useState(!1),i=C.useRef(null),a=C.useRef({start:0,x:0,y:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,boundingRect:null,didMove:!1}).current,A=C.useRef(e),{autoClose:d,pauseOnHover:u,closeToast:l,onClick:m,closeOnClick:v}=e;function g(E){if(e.draggable){E.nativeEvent.type==="touchstart"&&E.nativeEvent.preventDefault(),a.didMove=!1,document.addEventListener("mousemove",w),document.addEventListener("mouseup",j),document.addEventListener("touchmove",w),document.addEventListener("touchend",j);const b=i.current;a.canCloseOnClick=!0,a.canDrag=!0,a.boundingRect=b.getBoundingClientRect(),b.style.transition="",a.x=Ro(E.nativeEvent),a.y=Do(E.nativeEvent),e.draggableDirection==="x"?(a.start=a.x,a.removalDistance=b.offsetWidth*(e.draggablePercent/100)):(a.start=a.y,a.removalDistance=b.offsetHeight*(e.draggablePercent===80?1.5*e.draggablePercent:e.draggablePercent/100))}}function f(E){if(a.boundingRect){const{top:b,bottom:T,left:X,right:F}=a.boundingRect;E.nativeEvent.type!=="touchend"&&e.pauseOnHover&&a.x>=X&&a.x<=F&&a.y>=b&&a.y<=T?y():p()}}function p(){n(!0)}function y(){n(!1)}function w(E){const b=i.current;a.canDrag&&b&&(a.didMove=!0,t&&y(),a.x=Ro(E),a.y=Do(E),a.delta=e.draggableDirection==="x"?a.x-a.start:a.y-a.start,a.start!==a.x&&(a.canCloseOnClick=!1),b.style.transform=`translate${e.draggableDirection}(${a.delta}px)`,b.style.opacity=""+(1-Math.abs(a.delta/a.removalDistance)))}function j(){document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",j),document.removeEventListener("touchmove",w),document.removeEventListener("touchend",j);const E=i.current;if(a.canDrag&&a.didMove&&E){if(a.canDrag=!1,Math.abs(a.delta)>a.removalDistance)return o(!0),void e.closeToast();E.style.transition="transform 0.2s, opacity 0.2s",E.style.transform=`translate${e.draggableDirection}(0)`,E.style.opacity="1"}}C.useEffect(()=>{A.current=e}),C.useEffect(()=>(i.current&&i.current.addEventListener("d",p,{once:!0}),Ze(e.onOpen)&&e.onOpen(C.isValidElement(e.children)&&e.children.props),()=>{const E=A.current;Ze(E.onClose)&&E.onClose(C.isValidElement(E.children)&&E.children.props)}),[]),C.useEffect(()=>(e.pauseOnFocusLoss&&(document.hasFocus()||y(),window.addEventListener("focus",p),window.addEventListener("blur",y)),()=>{e.pauseOnFocusLoss&&(window.removeEventListener("focus",p),window.removeEventListener("blur",y))}),[e.pauseOnFocusLoss]);const M={onMouseDown:g,onTouchStart:g,onMouseUp:f,onTouchEnd:f};return d&&u&&(M.onMouseEnter=y,M.onMouseLeave=p),v&&(M.onClick=E=>{m&&m(E),a.canCloseOnClick&&l()}),{playToast:p,pauseToast:y,isRunning:t,preventExitTransition:r,toastRef:i,eventHandlers:M}}function Go(e){let{closeToast:t,theme:n,ariaLabel:r="close"}=e;return C.createElement("button",{className:`Toastify__close-button Toastify__close-button--${n}`,type:"button",onClick:o=>{o.stopPropagation(),t(o)},"aria-label":r},C.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},C.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 VA(e){let{delay:t,isRunning:n,closeToast:r,type:o="default",hide:i,className:a,style:A,controlledProgress:d,progress:u,rtl:l,isIn:m,theme:v}=e;const g=i||d&&u===0,f={...A,animationDuration:`${t}ms`,animationPlayState:n?"running":"paused",opacity:g?0:1};d&&(f.transform=`scaleX(${u})`);const p=Ue("Toastify__progress-bar",d?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated",`Toastify__progress-bar-theme--${v}`,`Toastify__progress-bar--${o}`,{"Toastify__progress-bar--rtl":l}),y=Ze(a)?a({rtl:l,type:o,defaultClassName:p}):Ue(p,a);return C.createElement("div",{role:"progressbar","aria-hidden":g?"true":"false","aria-label":"notification timer",className:y,style:f,[d&&u>=1?"onTransitionEnd":"onAnimationEnd"]:d&&u<1?null:()=>{m&&r()}})}const BA=e=>{const{isRunning:t,preventExitTransition:n,toastRef:r,eventHandlers:o}=PA(e),{closeButton:i,children:a,autoClose:A,onClick:d,type:u,hideProgressBar:l,closeToast:m,transition:v,position:g,className:f,style:p,bodyClassName:y,bodyStyle:w,progressClassName:j,progressStyle:M,updateId:E,role:b,progress:T,rtl:X,toastId:F,deleteToast:le,isIn:te,isLoading:Ae,iconOut:Q,closeOnClick:_,theme:S}=e,J=Ue("Toastify__toast",`Toastify__toast-theme--${S}`,`Toastify__toast--${u}`,{"Toastify__toast--rtl":X},{"Toastify__toast--close-on-click":_}),N=Ze(f)?f({rtl:X,position:g,type:u,defaultClassName:J}):Ue(J,f),h=!!T||!A,z={closeToast:m,type:u,theme:S};let D=null;return i===!1||(D=Ze(i)?i(z):C.isValidElement(i)?C.cloneElement(i,z):Go(z)),C.createElement(v,{isIn:te,done:le,position:g,preventExitTransition:n,nodeRef:r},C.createElement("div",{id:F,onClick:d,className:N,...o,style:p,ref:r},C.createElement("div",{...te&&{role:b},className:Ze(y)?y({type:u}):Ue("Toastify__toast-body",y),style:w},Q!=null&&C.createElement("div",{className:Ue("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!Ae})},Q),C.createElement("div",null,a)),D,C.createElement(VA,{...E&&!h?{key:`pb-${E}`}:{},rtl:X,theme:S,delay:A,isRunning:t,isIn:te,closeToast:m,hide:l,type:u,style:M,className:j,controlledProgress:h,progress:T||0})))},on=function(e,t){return t===void 0&&(t=!1),{enter:`Toastify--animate Toastify__${e}-enter`,exit:`Toastify--animate Toastify__${e}-exit`,appendPosition:t}},UA=nn(on("bounce",!0));nn(on("slide",!0)),nn(on("zoom")),nn(on("flip"));const _n=C.forwardRef((e,t)=>{const{getToastToRender:n,containerRef:r,isToastActive:o}=QA(e),{className:i,style:a,rtl:A,containerId:d}=e;function u(l){const m=Ue("Toastify__toast-container",`Toastify__toast-container--${l}`,{"Toastify__toast-container--rtl":A});return Ze(i)?i({position:l,rtl:A,defaultClassName:m}):Ue(m,tn(i))}return C.useEffect(()=>{t&&(t.current=r.current)},[]),C.createElement("div",{ref:r,className:"Toastify",id:d},n((l,m)=>{const v=m.length?{...a}:{...a,pointerEvents:"none"};return C.createElement("div",{className:u(l),style:v,key:`container-${l}`},m.map((g,f)=>{let{content:p,props:y}=g;return C.createElement(BA,{...y,isIn:o(y.toastId),style:{...y.style,"--nth":f+1,"--len":m.length},key:`toast-${y.key}`},p)}))}))});_n.displayName="ToastContainer",_n.defaultProps={position:"top-right",transition:UA,autoClose:5e3,closeButton:Go,pauseOnHover:!0,pauseOnFocusLoss:!0,closeOnClick:!0,draggable:!0,draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light"};let $n,nt=new Map,St=[],FA=1;function To(){return""+FA++}function _A(e){return e&&(tt(e.toastId)||Kt(e.toastId))?e.toastId:To()}function Wt(e,t){return nt.size>0?Me.emit(0,e,t):St.push({content:e,options:t}),t.toastId}function an(e,t){return{...t,type:t&&t.type||e,toastId:_A(t)}}function An(e){return(t,n)=>Wt(t,an(e,n))}function me(e,t){return Wt(e,an("default",t))}me.loading=(e,t)=>Wt(e,an("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...t})),me.promise=function(e,t,n){let r,{pending:o,error:i,success:a}=t;o&&(r=tt(o)?me.loading(o,n):me.loading(o.render,{...n,...o}));const A={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},d=(l,m,v)=>{if(m==null)return void me.dismiss(r);const g={type:l,...A,...n,data:v},f=tt(m)?{render:m}:m;return r?me.update(r,{...g,...f}):me(f.render,{...g,...f}),v},u=Ze(e)?e():e;return u.then(l=>d("success",a,l)).catch(l=>d("error",i,l)),u},me.success=An("success"),me.info=An("info"),me.error=An("error"),me.warning=An("warning"),me.warn=me.warning,me.dark=(e,t)=>Wt(e,an("default",{theme:"dark",...t})),me.dismiss=e=>{nt.size>0?Me.emit(1,e):St=St.filter(t=>e!=null&&t.options.toastId!==e)},me.clearWaitingQueue=function(e){return e===void 0&&(e={}),Me.emit(5,e)},me.isActive=e=>{let t=!1;return nt.forEach(n=>{n.isToastActive&&n.isToastActive(e)&&(t=!0)}),t},me.update=function(e,t){t===void 0&&(t={}),setTimeout(()=>{const n=function(r,o){let{containerId:i}=o;const a=nt.get(i||$n);return a&&a.getToast(r)}(e,t);if(n){const{props:r,content:o}=n,i={delay:100,...r,...t,toastId:t.toastId||e,updateId:To()};i.toastId!==e&&(i.staleId=e);const a=i.render||o;delete i.render,Wt(a,i)}},0)},me.done=e=>{me.update(e,{progress:1})},me.onChange=e=>(Me.on(4,e),()=>{Me.off(4,e)}),me.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"},me.TYPE={INFO:"info",SUCCESS:"success",WARNING:"warning",ERROR:"error",DEFAULT:"default"},Me.on(2,e=>{$n=e.containerId||e,nt.set($n,e),St.forEach(t=>{Me.emit(0,t.content,t.options)}),St=[]}).on(3,e=>{nt.delete(e.containerId||e),nt.size===0&&Me.off(0).off(1).off(5)});function mt(e){me.success(e,{position:"top-center",autoClose:650,hideProgressBar:!0,closeOnClick:!0,pauseOnHover:!0,draggable:!0,progress:void 0,theme:"light"})}let er="",Te="Playable",Le=null,Ho=null;const tr=async(e,t,n)=>{Te==="Playable"?t&&t.iosUrl!=="Loading..."&&t.googleUrl!=="Loading..."&&await Yo(e,{iosLink:t==null?void 0:t.iosUrl,androidLink:t==null?void 0:t.googleUrl},Le):Te==="Flex"?t&&t.iosUrl!=="Loading..."&&t.googleUrl!=="Loading..."&&await HA({_id:e,iosLink:t==null?void 0:t.iosUrl,androidLink:t==null?void 0:t.googleUrl},Le):Te==="Ready"&&t&&t.iosUrl!=="Loading..."&&t.googleUrl!=="Loading..."&&((n==null?void 0:n.urlType)==="single"&&(t.googleUrl=t.iosUrl),await Yo(e,{iosLink:t==null?void 0:t.iosUrl,androidLink:t==null?void 0:t.googleUrl},Le))},sn=async e=>{let t=er+"/"+e,n=e;fetch(t).then(r=>r.blob()).then(r=>{const o=window.URL.createObjectURL(r),i=document.createElement("a");i.href=o,i.download=n.split("/").reduce((a,A)=>A,""),document.body.appendChild(i),i.click(),window.URL.revokeObjectURL(o),mt("Download successfully")}).catch(r=>{console.error("File error:",r)})},$A=(e,t)=>{let n=er+"/"+e;xt(n)?mt("Link Copied"):t(n)};async function Mt(e,t,n,r="download",o=!1,i=null){return new Promise(async(a,A)=>{let d=async u=>{r==="download"?await sn(u):r==="copy"&&$A(u,Ho)};try{await tr(e,n,i)}catch(u){console.log("updateUrls error",u)}Te==="Playable"?NA(Le,e,t,o,i).then(async u=>{let{url:l}=u;await d(l),a(u)}).catch(u=>{let l=u.response.data.error.msg;A({message:l})}):Te==="Flex"?YA({_id:e,network:t,extras:i},Le).then(async u=>{if(u.message){A(u);return}let{url:l}=u;await d(l),a(u)}).catch(u=>{let l=u.response.data.error.msg;A({message:l})}):Te==="Import"?JA(Le,e,t).then(async u=>{let l=u.url;await d(l),a(u)}).catch(u=>{let l=u.response.data.error.msg;A({message:l})}):Te==="Ready"&&DA(Le,e,t,o,i).then(async u=>{if(u.message){A(u);return}let l=u.url;await d(l),a(u)}).catch(u=>{let l=u.response.data.error.msg;A({message:l})})})}async function es(e,t,n,r=null){return new Promise(async(o,i)=>{await tr(e,t,r),Te==="Flex"?zA(e,n,Le).then(async a=>{if(a.message){i(a);return}await sn(a.url),o(a.url)}).catch(a=>{let A=a.response.data.error.msg;i({message:A})}):Te==="Ready"?GA(e,n,Le).then(async a=>{if(a.message){i(a);return}await sn(a.url),o(a.url)}).catch(a=>{console.log("err",a);let A=a.response.data.error.msg;i({message:A})}):RA(e,n,Le).then(async a=>{await sn(a.url),o(a.url)}).catch(a=>{let A=a.response.data.error.msg;i({message:A})})})}function ts(e,t,n,r){Te=e,Le=t,Ho=n,er=r}async function ns(e){return await TA({versionId:e},Le)}async function nr(e,t){return(await ge.post(t+"/findPlayable",{_id:e})).data}const rs=({versionId:e,playableId:t,typeOfProduct:n,api:r,copyLinkUrl:o,setSafariCopyLink:i,qrUrl:a,iosLink:A,androidLink:d,urlType:u})=>{const[l,m]=C.useState(!1),v=async()=>{m(!0),Mt(e,"default",{iosUrl:A,googleUrl:d},null,!1,{urlType:u}).then(async g=>{var w,j,M,E;let f="";if(t&&(n==="Playable"||n==="Ready")){const b=await nr(t,r);console.log(b);const T=(j=(w=b==null?void 0:b.data)==null?void 0:w.globalProps)==null?void 0:j.defaultLandscape,X=(E=(M=b==null?void 0:b.data)==null?void 0:M.globalProps)==null?void 0:E.defaultPhoneIndex;console.log(T,X),T&&(f+="&landscape=true"),X!==void 0&&(f+=`&phoneIndex=${X}`)}nr(t,r),m(!1);let p;n==="Flex"?p=`${o}/preview?versionId=${e}`:n==="Import"?p=`${o}/preview?versionId=${e}_`:n==="Ready"?p=`${o}/preview?versionId=${e}_&ready=true`:p=`${o}/preview?versionId=${e}_`,p+=f,xt(p)?mt("Link copied"):i(p),m(!1)}).catch(g=>{m(!1)})};return s.jsxs("div",{style:{display:"flex",height:"125px",width:"100%",borderRadius:"10px",backgroundColor:"#000000",padding:"10px"},children:[s.jsx("div",{style:{marginRight:"0.75rem",width:"50%",display:"flex",justifyContent:"center",alignItems:"center"},children:a?s.jsx(la,{bgColor:"#0F0F1E",fgColor:"#ffffff",style:{height:"auto",maxWidth:"100%",width:"100%"},value:a}):s.jsx("img",{style:{width:"50px",height:"50px"},src:Xe,alt:"pf-logo-gif"})}),s.jsxs("div",{children:[s.jsx("div",{style:{marginBottom:"0.25rem",fontSize:"0.875rem",fontWeight:"bold",color:"white"},children:"Mobile testing"}),s.jsx("div",{style:{marginBottom:"1rem",fontSize:"0.75rem",color:"gray"},children:"Scan QR Code to test in any browser"}),s.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"0.375rem",backgroundColor:"#00a3ff57",color:"secondary-blue",cursor:"pointer"},onClick:()=>{l||v()},children:[s.jsx(Qr,{style:{height:"1.5rem",width:"1.5rem",stroke:"secondary-blue",color:"white"}}),s.jsx("div",{style:{height:"24px",display:"flex",alignItems:"center",justifyContent:"center",width:"80px"},children:l?s.jsx("img",{style:{height:"90%"},src:Xe,alt:"loading"}):s.jsx("button",{style:{fontSize:"1rem",color:"white",background:"rgba(0, 163, 255, 0)"},children:"Copy Link"})})]})]})]})},os=({versionName:e,versionId:t,playableId:n,typeOfProduct:r,api:o,iframeUrl:i,fetchFileUrl:a,copyLinkUrl:A,setSafariCopyLink:d,iosLink:u,androidLink:l,urlType:m})=>{const[v,g]=C.useState(window.innerWidth);console.log("iosLink",u),C.useEffect(()=>{console.log("re add event listener");function p(y){console.log(y),y.data==="cta"&&(console.log("Received 'cta' message from iframe"),u&&window.open(u,"_blank"))}return window.addEventListener("message",p,!1),()=>{window.removeEventListener("message",p)}},[u,l]),C.useEffect(()=>{const p=()=>{g(window.innerWidth)};return window.addEventListener("resize",p),()=>{window.removeEventListener("resize",p)}},[]);const f=(e==null?void 0:e.length)>25?e.slice(0,25)+"...":e;return s.jsxs("div",{style:{display:"flex",width:"300px",flexDirection:"column",justifyContent:"space-between",padding:"5px",height:v>1440?"680px":"620px",borderRadius:"0px 0px 0px 16px",marginTop:"20px"},children:[s.jsx(Wi,{iframeUrl:i}),s.jsx(Mi,{name:f}),s.jsx(rs,{versionId:t,playableId:n,typeOfProduct:r,api:o,copyLinkUrl:A,setSafariCopyLink:d,qrUrl:i,iosLink:u,androidLink:l,urlType:m})]})};var qe=(e=>(e.Flex="#7101FF",e.Playable="#F9830B",e.Import="#00a3ff",e.Ready="#0060A5",e))(qe||{});const Xo=({checked:e,typeOfProduct:t,id:n})=>{const[r,o]=C.useState(e);C.useEffect(()=>{o(e)},[e]);const i=()=>{o(!r)};return s.jsx("div",{style:{display:"inline-flex",alignItems:"center"},children:s.jsxs("label",{onClick:i,style:{position:"relative",display:"flex",cursor:"pointer",alignItems:"center"},htmlFor:n,children:[s.jsx("input",{type:"checkbox",style:{position:"relative",height:"20px",width:"20px",cursor:"pointer",appearance:"none",borderRadius:"0.25rem",transition:"all ease-in-out",border:"1px solid lightgray",opacity:1},id:n,checked:r,onChange:i}),s.jsxs("div",{style:{pointerEvents:"none",position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",color:"white",opacity:r?1:0,transition:"opacity ease-in-out"},children:[s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",style:{height:"14px",width:"14px"},viewBox:"0 0 20 20",fill:qe[t],stroke:qe[t],strokeWidth:"1",children:s.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"})})," "]})]})})},is=({typeOfProduct:e,allNetworksSelected:t,setAllNetworksSelected:n})=>s.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",marginBottom:"0.5rem"},children:[s.jsxs("div",{style:{fontSize:"2xl",fontWeight:"bold",display:"flex"},children:[s.jsx("span",{style:{color:qe[e]},children:"Select Network"}),s.jsx("span",{style:{whiteSpace:"pre"},children:" From List"})]}),s.jsxs("div",{onClick:()=>{n(!t)},style:{marginLeft:"auto",marginRight:"2rem",display:"flex",height:"24px",alignItems:"center",justifyContent:"flex-end",fontSize:"0.875rem",width:110},children:[s.jsx(Xo,{checked:t,typeOfProduct:e,id:"asd"}),s.jsx("span",{style:{marginLeft:"0.5rem",fontSize:"16px",fontWeight:"bold"},children:"Select All"})]})]});async function as(e,t){return(await ge.post(t+"/buyRequest",{requestType:e})).data}const As=()=>s.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[s.jsxs("g",{"clip-path":"url(#clip0_518_12094)",children:[s.jsx("path",{d:"M4.50977 11.99L19.4898 11.99",stroke:"#7101FF","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}),s.jsx("path",{d:"M13.5068 17.977L19.4828 12L13.5068 6.02299",stroke:"#7101FF","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})]}),s.jsx("defs",{children:s.jsx("clipPath",{id:"clip0_518_12094",children:s.jsx("rect",{width:"24",height:"24",fill:"white",transform:"translate(0 24) rotate(-90)"})})})]}),ss=({creditDownload:e,api:t})=>s.jsxs(s.Fragment,{children:[s.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."}),s.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"," ",s.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.",s.jsxs("button",{style:{marginLeft:"0.5rem",display:"flex",alignItems:"center",fontSize:"12px",fontWeight:"bold",textDecoration:"underline",color:"#yourColorHere"},onClick:()=>as("Flex Credit",t).then(n=>mt("You will be contacted regarding your request.")),children:["Get more",s.jsx(As,{})]})]})]}),Qo=({typeOfProduct:e,urls:t,handleIosChange:n,handleGoogleChange:r,disabled:o})=>{const i=A=>{n(A.target.value)},a=A=>{r(A.target.value)};return s.jsxs(s.Fragment,{children:[s.jsxs("div",{style:{display:"flex",height:"2rem",width:"100%",alignItems:"center",fontSize:"12px",fontWeight:"200"},children:[s.jsx("span",{style:{width:"5rem",fontWeight:"bold",flexShrink:0},children:"App Store:"}),s.jsx("input",{style:{marginLeft:"1.25rem",display:"flex",height:"100%",width:"100%",alignItems:"center",borderRadius:"0.375rem",border:t.iosUrl?"1px solid lightgray":"1px solid red",paddingLeft:"0.5rem",color:"#000000",borderColor:qe[e],marginRight:"2rem"},type:"text",value:t.iosUrl,onChange:i,placeholder:"Ios Url",disabled:o})]}),s.jsxs("div",{style:{marginTop:"0.5rem",display:"flex",height:"2rem",width:"100%",alignItems:"center",fontSize:"12px",fontWeight:"100"},children:[s.jsxs("span",{style:{width:"5rem",fontWeight:"bold",flexShrink:0},children:["Google Play:"," "]}),s.jsx("input",{style:{marginLeft:"1.25rem",display:"flex",height:"100%",width:"100%",alignItems:"center",borderRadius:"0.375rem",border:t.googleUrl?"1px solid lightgray":"1px solid red",paddingLeft:"0.5rem",color:"#000000",borderColor:qe[e],marginRight:"2rem"},type:"text",value:t.googleUrl,onChange:a,placeholder:"Google Url",disabled:o})]})]})},ls=({typeOfProduct:e,urls:t,handleIosChange:n,handleGoogleChange:r,disabled:o})=>{const i=a=>{n(a.target.value)};return s.jsx(s.Fragment,{children:s.jsxs("div",{style:{display:"flex",height:"2rem",width:"100%",alignItems:"center",fontSize:"12px",fontWeight:"200"},children:[s.jsx("span",{style:{width:"5rem",fontWeight:"bold",flexShrink:0},children:"Redirection URL:"}),s.jsx("input",{style:{marginLeft:"1.25rem",display:"flex",height:"100%",width:"100%",alignItems:"center",borderRadius:"0.375rem",border:t.iosUrl?"1px solid lightgray":"1px solid red",paddingLeft:"0.5rem",color:"#000000",borderColor:qe[e],marginRight:"2rem"},type:"text",value:t.iosUrl,onChange:i,placeholder:"Ios Url",disabled:o})]})})},us=({typeOfProduct:e,fileSize:t,urls:n,handleIosChange:r,handleGoogleChange:o,disabled:i,api:a,creditDownload:A,user:d,isTest:u,setIsTest:l,urlType:m,setUrlType:v})=>{const g=()=>s.jsxs("div",{style:{display:"flex",height:"24px",width:"100%",alignItems:"center",fontSize:"12px",fontWeight:"100"},children:[s.jsxs("span",{style:{width:"5rem",fontWeight:"bold"},children:["Enable Test:"," "]}),s.jsx("input",{style:{marginLeft:"1.25rem",display:"flex",height:"100%",width:"20px",alignItems:"center",borderRadius:"0.375rem",border:n.googleUrl?"1px solid lightgray":"1px solid red",paddingLeft:"0.5rem",color:"#000000",borderColor:qe[e]},type:"checkbox",checked:u,onChange:()=>{l(!u)},placeholder:"Google Url",disabled:i})]}),f=()=>s.jsx(s.Fragment,{children:s.jsxs("div",{style:{display:"flex",width:"400px",height:"30px",flexDirection:"row",justifyContent:"space-between",alignItems:"center",borderBottom:"1px solid #eaeaec",marginBottom:"10px",position:"relative"},className:"tab-switch",children:[s.jsx("div",{style:{position:"absolute",bottom:"-3px",left:m==="single"?"50%":"0%",width:"50%",height:"3px",borderRadius:"2px",backgroundColor:"#12a9fe",transition:"all 0.2s ease-in-out"},id:"tab-switch-background"}),s.jsx("div",{style:{width:"50%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer",position:"relative"},onClick:()=>{document.getElementById("tab-switch-background").style.left="0%",document.getElementById("single-tab").style.color="#a3a3a3",document.getElementById("game-tab").style.color="#000",document.getElementById("single-tab").style.fontWeight="normal",document.getElementById("game-tab").style.fontWeight="bold",setTimeout(()=>{v("game")},200)},children:s.jsx("span",{style:{position:"relative",color:m==="game"?"#000":"#a3a3a3",fontWeight:m==="game"?"bold":"normal",transition:"all 0.2s ease-in-out"},id:"game-tab",children:"App"})},"gameTab"),s.jsx("div",{style:{width:"50%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer",position:"relative"},onClick:()=>{document.getElementById("tab-switch-background").style.left="50%",document.getElementById("single-tab").style.color="#000",document.getElementById("game-tab").style.color="#a3a3a3",document.getElementById("single-tab").style.fontWeight="bold",document.getElementById("game-tab").style.fontWeight="normal",setTimeout(()=>{v("single")},200)},children:s.jsx("span",{style:{position:"relative",color:m==="single"?"#000":"#a3a3a3",fontWeight:m==="single"?"bold":"normal",transition:"all 0.2s ease-in-out"},id:"single-tab",children:"Website"})},"singleTab")]})});return s.jsx(s.Fragment,{children:e!=="Import"&&s.jsxs("div",{style:{display:"flex",width:"100%",flexDirection:"column"},children:[d.customer=="playableFactoryInternal"&&e==="Playable"&&s.jsx(g,{}),e==="Ready"?s.jsxs(s.Fragment,{children:[s.jsx(f,{}),m==="game"&&s.jsx(Qo,{typeOfProduct:e,urls:n,handleIosChange:r,handleGoogleChange:o,disabled:i}),m==="single"&&s.jsx(ls,{typeOfProduct:e,urls:n,handleIosChange:r,handleGoogleChange:o,disabled:i})]}):s.jsx(s.Fragment,{children:s.jsx(Qo,{typeOfProduct:e,urls:n,handleIosChange:r,handleGoogleChange:o,disabled:i})}),(A==null?void 0:A.willSpendCredit)&&s.jsx(ss,{creditDownload:A,api:a})]})})},cs=({typeOfProduct:e,title:t,fileSize:n})=>s.jsxs("div",{style:{fontSize:"1.5rem",fontWeight:"bold",paddingTop:"20px"},children:[s.jsx("span",{style:{color:qe[e]},children:t}),n&&s.jsxs("span",{style:{fontSize:"14px",fontWeight:"bold",marginLeft:"30px",color:"#87878E"},children:["File size: ",parseFloat(n).toFixed(2)," mb"]})]}),ds=({typeOfProduct:e,fileSize:t,urls:n,title:r,handleIosChange:o,handleGoogleChange:i,disabled:a,creditDownload:A,api:d,user:u,isTest:l,setIsTest:m,urlType:v,setUrlType:g,allNetworksSelected:f,setAllNetworksSelected:p})=>s.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",justifyContent:"space-between",alignItems:"flex-start",borderBottom:"1px solid #D1D5DB",paddingLeft:"1.25rem",paddingRight:"1.25rem",gap:"0.5rem"},children:[s.jsx(cs,{typeOfProduct:e,title:r,fileSize:t}),s.jsx(us,{typeOfProduct:e,fileSize:t,urls:n,handleIosChange:o,handleGoogleChange:i,disabled:a,creditDownload:A,api:d,user:u,isTest:l,setIsTest:m,urlType:v,setUrlType:g}),s.jsx(is,{typeOfProduct:e,allNetworksSelected:f,setAllNetworksSelected:p})]}),rr=({children:e,className:t,onClickDonwload:n,downloading:r,disabled:o})=>s.jsx("button",{onClick:n,className:t,style:{display:"flex",height:"40px",alignItems:"center",justifyContent:"center",borderRadius:"0.375rem",border:"1px solid lightgray",padding:"0.25rem",fontSize:"0.875rem",width:200,backgroundColor:"#FFFFFF"},disabled:r||o,children:e}),gu="",ms=({typeOfProduct:e})=>s.jsx("div",{style:{backgroundColor:"transparent",display:"flex",alignItems:"center",flexDirection:"column"},children:s.jsxs("div",{style:{position:"relative",width:"64px",height:"16px",marginTop:"8px"},children:[s.jsx("div",{style:{position:"absolute",top:0,width:"8px",height:"8px",borderRadius:"50%",backgroundColor:qe[e]}}),s.jsx("div",{style:{position:"absolute",top:0,width:"8px",height:"8px",borderRadius:"50%",backgroundColor:qe[e]}}),s.jsx("div",{style:{position:"absolute",top:0,width:"8px",height:"8px",borderRadius:"50%",backgroundColor:qe[e]}}),s.jsx("div",{style:{position:"absolute",top:0,width:"8px",height:"8px",borderRadius:"50%",backgroundColor:qe[e]}})]})}),Lt=({isNetworksLoading:e=!1})=>s.jsx("div",{style:{display:"flex",height:"100%",width:"90px",alignItems:"center",justifyContent:"center"},children:s.jsx("img",{width:e?"100px":"25px",height:e?"100px":"25px",src:Xe,alt:"pf-logo-gif"})}),or=({title:e,titleId:t,...n})=>s.jsxs("svg",{viewBox:"0 0 25 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em","aria-labelledby":t,...n,children:[e?s.jsx("title",{id:t,children:e}):null,s.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"})]}),ps=({onClose:e,iosLink:t,googleLink:n,buttonType:r,handleCopyLink:o,download:i,typeOfProduct:a,urlType:A})=>{let d="";return a==="Ready"&&A==="single"?d="Redirection url is empty. Are you sure you want to continue?":!t&&!n?d="Both links are empty. Are you sure you want to continue?":t?n||(d="Google link is empty. Are you sure you want to continue?"):d="iOS link is empty. Are you sure you want to continue?",s.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:[s.jsx("div",{onClick:e,style:{position:"absolute",zIndex:30,height:"100%",width:"100%",pointerEvents:"none"}}),s.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:[s.jsx("h1",{style:{textAlign:"center",fontSize:"18px",lineHeight:"24px"},children:d}),s.jsxs("div",{style:{display:"flex",gap:"5px"},children:[s.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:"No"}),s.jsx("button",{onClick:async u=>{r==="download"?await i():r==="copyLink"&&await o(),e()},style:{flex:1,cursor:"pointer",borderRadius:"0.375rem",border:"1px solid red",backgroundColor:"darkorange",padding:"0.5rem",fontWeight:"bold",color:"white",transition:"all 0.15s ease-linear"},children:"Yes"})]})]})]})},Po=({onClose:e,handleCopyLink:t,download:n,creditConfirmType:r,getDownloadCount:o})=>s.jsxs("div",{style:{position:"fixed",top:0,left:0,zIndex:50,display:"flex",height:"120%",width:"130%",alignItems:"center",justifyContent:"center",backgroundColor:"#00000080"},children:[s.jsx("div",{onClick:e,style:{position:"absolute",zIndex:30,height:"100%",width:"100%"}}),s.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:[s.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?"}),s.jsxs("div",{style:{display:"flex",gap:"5px"},children:[s.jsx("button",{onClick:e,style:{flex:1,cursor:"pointer",borderRadius:"4px",borderWidth:"1px",borderColor:"dark-50",padding:"2px",fontWeight:"bold"},children:"No"}),s.jsx("button",{style:{flex:1,cursor:"pointer",borderRadius:"4px",borderWidth:"1px",borderColor:"#F9830B",backgroundColor:"#F9830B",padding:"2px",fontWeight:"bold",color:"white"},onClick:async i=>{i.preventDefault(),i.stopPropagation(),r==="download"?(await n(),await o()):r==="copy"&&(await t(),await o()),e()},children:"Yes"})]})]})]}),fs=({onClose:e,handleDownload:t,handleDownloadMolocoTest:n,downloadingMoloco:r,downloadingMolocoTest:o,downloadingMolocoHtml:i})=>s.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:[s.jsx("div",{onClick:e,style:{position:"absolute",zIndex:30,height:"100%",width:"100%",pointerEvents:"none"}}),s.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:s.jsxs("div",{style:{display:"flex",gap:"5px",flexDirection:"column"},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"center"},children:[r?s.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer",borderRadius:"0.375rem",border:"1px solid darkorange",backgroundColor:"darkorange",color:"white",transition:"all 0.15s ease-linear",width:"200px",marginRight:"10px"},children:s.jsx("img",{width:"25px",height:"25px",src:Xe,alt:"pf-logo-gif"})}):s.jsx("button",{onClick:()=>{t(!1)},style:{cursor:"pointer",borderRadius:"0.375rem",border:"1px solid darkorange",backgroundColor:"darkorange",color:"white",transition:"all 0.15s ease-linear",width:"200px",marginRight:"10px"},children:"Download"}),i?s.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer",borderRadius:"0.375rem",border:"1px solid darkorange",backgroundColor:"darkorange",color:"white",transition:"all 0.15s ease-linear",width:"200px",marginLeft:"10px"},children:s.jsx("img",{width:"25px",height:"25px",src:Xe,alt:"pf-logo-gif"})}):s.jsx("button",{onClick:()=>{t(!0)},style:{cursor:"pointer",borderRadius:"0.375rem",border:"1px solid darkorange",backgroundColor:"darkorange",color:"white",transition:"all 0.15s ease-linear",width:"200px",marginLeft:"10px"},children:"Download HTML"})]}),s.jsx("div",{style:{display:"flex",justifyContent:"center"},children:o?s.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer",borderRadius:"0.375rem",border:"1px solid darkorange",backgroundColor:"darkorange",color:"white",transition:"all 0.15s ease-linear",width:"200px"},children:s.jsx("img",{width:"25px",height:"25px",src:Xe,alt:"pf-logo-gif"})}):s.jsx("button",{onClick:n,style:{cursor:"pointer",borderRadius:"0.375rem",border:"1px solid darkorange",backgroundColor:"darkorange",color:"white",transition:"all 0.15s ease-linear",width:"200px"},children:"Download Moloco Test"})})]})})]});async function hs(e,t,n,r){return(await ge.post(e+"/createMolocoTestPage",{_id:t,network:n,typeOfProduct:r})).data}const gs=({title:e,titleId:t})=>s.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:[s.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"}),s.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"})]}),qs=({onClose:e,versionId:t,urls:n,handleDownloadError:r})=>{const[o,i]=C.useState(""),[a,A]=C.useState(!1);C.useEffect(()=>{o||ns(t).then(u=>{console.log(u),fetch(u.uploadPath).then(l=>{console.log("fetch success"),i(u.uploadPath)}).catch(l=>{console.log("failed to fetch")})})},[o]);const d=async()=>{A(!0),Mt(t,"cdn",n,null,!1,{}).then(u=>{const l=u.url.replace("playablefactory.b-cdn.net","resources.playablefactory.app");i(l),A(!1)}).catch(u=>{r(u.message,u),e(),A(!1)})};return s.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:[s.jsx("div",{onClick:e,style:{position:"absolute",zIndex:30,height:"100%",width:"100%",pointerEvents:"none"}}),s.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:u=>{u.stopPropagation()},children:s.jsxs("div",{style:{display:"flex",gap:"5px",flexDirection:"column"},children:[s.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||d()},children:["Update Link",a&&s.jsx("img",{width:"30px",src:Xe,alt:"pf-logo-gif"})]}),s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:"#f6f6f6",height:"60px",color:"#737373"},children:[s.jsx("div",{style:{width:"66px",height:"100%",borderRight:"1px solid #e1e1e1",display:"flex",justifyContent:"center",alignItems:"center",flexShrink:0},children:s.jsx(gs,{})}),s.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",position:"relative",maxWidth:"68%"},children:s.jsx("a",{style:{textAlign:"center",overflow:"hidden",textOverflow:"ellipsis"},href:o,target:"_blank",children:o||"No CDN link generated"})}),s.jsx("button",{onClick:()=>{if(!o)return;xt(o)&&mt("Link copied")},style:{cursor:"pointer",borderRadius:"0.375rem",backgroundColor:o?"darkorange":"lightgray",color:"white",transition:"all 0.15s ease-linear",width:"100px",height:"46px",marginRight:"10px",flexShrink:0},children:"Copy"})]})]})})]})},ys=({id:e,imageUrl:t,handleCardClick:n,selected:r,name:o,networkVersionSize:i,fileSizeLoading:a,showCheckBox:A,typeOfProduct:d,versionId:u,api:l,handleDownloadError:m,fetchFileUrl:v,urls:g,game:f,setIsConfirmActive:p,creditDownload:y,getDownloadCount:w,disabled:j,user:M,setSafariCopyLink:E,isTest:b,urlType:T})=>{const[X,F]=C.useState(!1),[le,te]=C.useState(""),[Ae,Q]=C.useState(!1),[_,S]=C.useState(!1),[J,N]=C.useState(!1),[h,z]=C.useState(!1),[D,Z]=C.useState("download"),[I,L]=C.useState(!1),[Y,O]=C.useState(!1),[$,K]=C.useState(!1);let R={aarki:"html,copy",adcolony:"copy,html",adjoe:"copy,html",applovin:"copy,html",appreciate:"zip",chartboost:"copy,html",criteo:"zip",crossinstall:"copy,html",default:"copy",fb:"zip",fyber:"copy,html",google:"zip",google360:"zip",ironsource:"copy,html",kayzen:"apikey",kaden:"html",kidoz:"html",lifestreet:"copy,html",liftoff:"copy,zip",mobvista:"html",moloco:"html,molocotest",molocoV2:"html,molocotest",nucleo:"copy,html",oceanengine:"copy,zip",pointblank:"html",smadex:"zip",snapchat:"zip",tapjoy:"copy,html",tencent:"zip",toutiao:"copy,zip",toutiao_cn:"copy,zip",unity:"copy,html",vungle:"html",web:"copy,html",yandex:"zip",zucks:"copy,html",luna:"zip",inmobi:"copy,html,",nend:"html",adikteev:"html",jammp:"copy,html",mraid:"copy,html"};const P=()=>{n(e)},V=async(ee,ue)=>{const de={molocoGenerateHtml:!1,urlType:T};return W&&(ue==="copy"?(O(!0),ue="download",de.molocoGenerateHtml=!0):L(!0)),console.log("getVersion",ee,ue,de),F(!0),new Promise((lt,fn)=>{Mt(u,ee,g,ue,b,de).then(_e=>{F(!1),lt(_e),O(!1),L(!1)}).catch(_e=>{F(!1),m(_e.message,_e),fn(_e),O(!1),L(!1)})})},B=async(ee=!1)=>{console.log("handleMolocoDownload",ee),ee?O(!0):L(!0);const ue={molocoGenerateHtml:!1};ee&&(ue.molocoGenerateHtml=!0),Mt(u,o,g,"download",b,ue).then(de=>{ee?O(!1):L(!1),N(!1)}).catch(de=>{m(de.message,de)})},se=async()=>{K(!0);const ee=await hs(l,u,o,d);let ue=`${v}/${ee==null?void 0:ee.url}`;xt(ue)?(mt("Link Copied"),K(!1)):E(ue)},W=o==="moloco"||o==="molocoV2";return s.jsxs(s.Fragment,{children:[s.jsxs("div",{style:{position:"relative",display:"flex",flexDirection:"column",gap:"20px",padding:"16px",borderColor:r?qe[d]:"lightgray",borderWidth:"1px",borderStyle:"solid",backgroundColor:"white",width:"100%",height:"175px",borderRadius:"8px",cursor:"pointer"},className:"border-hover-"+d,onClick:P,children:[s.jsxs("div",{style:{marginTop:o=="web"?"10px":"40px",display:"flex",justifyContent:"center"},children:[s.jsx("div",{style:{position:"absolute",right:"0",top:"0",padding:"8px"},children:s.jsx("div",{children:i&&i.map(ee=>ee.network).includes(o)?a?s.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:s.jsx(ms,{typeOfProduct:d})}):i.map(ee=>s.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:ee.network===o?ee.size.toString().slice(0,5)+"Mb":""},ee.network)):null})}),s.jsx("div",{style:{position:"absolute",top:"0",left:"0",padding:"0.5rem"},children:(d==="Playable"||d==="Ready"||d==="Flex")&&A&&s.jsx(Xo,{checked:r,typeOfProduct:d,id:e})}),s.jsx("img",{onClick:P,style:{width:"30rem",height:o=="web"?"80px":"50px",objectFit:"contain"},src:t})]}),s.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"0.25rem"},children:[s.jsx(rr,{className:`${W?"w-1/2":"w-2/3"} border-hover-`+d,downloading:X,onClickDonwload:async ee=>{if(ee.stopPropagation(),o==="cdn")z(!0);else if(W&&M.customer==="playableFactoryInternal"){N(!0);return}else{te("download");const ue=g.iosUrl,de=g.googleUrl;y&&y.willSpendCredit?(p(!0),Z("download"),Q(!0)):["Playable","Flex"].includes(d)&&(!ue||!de)||d==="Ready"&&T==="single"&&!ue||d==="Ready"&&T==="multi"&&(!ue||!de)?(p(!0),S(!0)):(S(!1),Q(!1),await V(o,"download"))}},children:W?s.jsxs(s.Fragment,{children:[!I&&s.jsxs(s.Fragment,{children:[s.jsx(or,{style:{marginRight:"0.5rem",height:"1.5rem",width:"1rem",stroke:"dark-full"}}),M.customer!=="playableFactoryInternal"?"TXT":"Download"]}),I&&s.jsx(Lt,{})]}):s.jsxs(s.Fragment,{children:[!X&&s.jsxs(s.Fragment,{children:[s.jsx(or,{style:{marginRight:"0.5rem",height:"1.5rem",width:"1rem",stroke:"dark-full"}}),"Download"]}),X&&s.jsx(Lt,{})]})}),R[o]&&R[o].includes("copy")&&s.jsx(rr,{className:"w-1/3 border-hover-"+d,onClickDonwload:async ee=>{ee.stopPropagation(),te("copyLink");const ue=g.iosUrl,de=g.googleUrl;y&&(y!=null&&y.willSpendCredit)?(Z("copy"),p(!0),Q(!0)):d!=="Import"&&(!ue||!de)?(p(!0),S(!0)):(Q(!1),S(!1),await V(o,"copy"))},disabled:j,children:s.jsx(Qr,{className:"h-6 w-6 stroke-dark-full"})}),W&&M.customer!=="playableFactoryInternal"&&s.jsxs(rr,{className:"w-1/2 border-hover-"+d,onClickDonwload:async ee=>{ee.stopPropagation(),te("copyLink");const ue=g.iosUrl,de=g.googleUrl;y&&(y!=null&&y.willSpendCredit)?(Z("download"),p(!0),Q(!0)):d!=="Import"&&(!ue||!de)?(p(!0),S(!0)):(Q(!1),S(!1),await B(!0))},disabled:j,children:[!Y&&s.jsxs(s.Fragment,{children:[s.jsx(or,{style:{marginRight:"0.5rem",height:"1.5rem",width:"1rem",stroke:"dark-full"}}),"HTML"]}),Y&&s.jsx(Lt,{})]})]}),W&&s.jsx("img",{style:{position:"absolute",width:"135px",right:"0",top:"18px"},src:"https://home.playablefactory.app/recommended_badge.png"})]}),Ae&&s.jsx(Po,{creditConfirmType:D,handleCopyLink:async()=>{S(!1),p(!1),await V(o,"copy")},download:async()=>{S(!1),p(!1),await V(o,"download")},onClose:()=>{Q(!1),p(!1)},getDownloadCount:w}),_&&s.jsx(ps,{onClose:()=>{S(!1),p(!1)},iosLink:g.iosUrl,googleLink:g.googleUrl,buttonType:le,handleCopyLink:async()=>{S(!1),p(!1),await V(o,"copy")},download:async()=>{S(!1),p(!1),await V(o,"download")},typeOfProduct:d,urlType:T}),J&&M.customer==="playableFactoryInternal"&&s.jsx(fs,{onClose:()=>{N(!1)},handleDownload:B,handleDownloadMolocoTest:se,downloadingMoloco:I,donwloadintMolocoTest:$,downloadingMolocoHtml:Y}),h&&s.jsx(qs,{onClose:()=>{z(!1)},versionId:u,urls:g,handleDownloadError:m})]})},ln=[{id:"22",name:"moloco",imageSrc:"https://home.playablefactory.com/moloco.png"},{id:"44",name:"molocoV2",imageSrc:"https://home.playablefactory.com/molocoV2.png"},{id:"33",name:"web",imageSrc:"https://home.playablefactory.com/files/network_icons/web.png"},{id:"1",name:"unity",imageSrc:"https://home.playablefactory.com/unity.png"},{id:"2",name:"applovin",imageSrc:"https://home.playablefactory.com/applovin.png"},{id:"3",name:"ironsource",imageSrc:"https://home.playablefactory.com/ironsource.png"},{id:"4",name:"vungle",imageSrc:"https://home.playablefactory.com/vungle.png"},{id:"5",name:"mobvista",imageSrc:"https://home.playablefactory.com/mobvista.png"},{id:"6",name:"fb",imageSrc:"https://home.playablefactory.com/fb.png"},{id:"7",name:"toutiao",imageSrc:"https://home.playablefactory.com/toutiao.png"},{id:"8",name:"toutiao_cn",imageSrc:"https://home.playablefactory.com/toutiao_cn.png"},{id:"9",name:"adcolony",imageSrc:"https://home.playablefactory.com/adcolony.png"},{id:"10",name:"criteo",imageSrc:"https://home.playablefactory.com/criteo.png"},{id:"11",name:"chartboost",imageSrc:"https://home.playablefactory.com/chartboost.png"},{id:"12",name:"kayzen",imageSrc:"https://home.playablefactory.com/kayzen.png"},{id:"13",name:"crossinstall",imageSrc:"https://home.playablefactory.com/crossinstall.png"},{id:"14",name:"default",imageSrc:"https://home.playablefactory.com/default.png"},{id:"15",name:"fyber",imageSrc:"https://home.playablefactory.com/fyber.png"},{id:"16",name:"appreciate",imageSrc:"https://home.playablefactory.com/appreciate.png"},{id:"17",name:"google360",imageSrc:"https://home.playablefactory.com/google360.png"},{id:"18",name:"kaden",imageSrc:"https://home.playablefactory.com/kaden.png"},{id:"19",name:"kidoz",imageSrc:"https://home.playablefactory.com/kidoz.png"},{id:"20",name:"lifestreet",imageSrc:"https://home.playablefactory.com/lifestreet.png"},{id:"21",name:"liftoff",imageSrc:"https://home.playablefactory.com/liftoff.png"},{id:"23",name:"nucleo",imageSrc:"https://home.playablefactory.com/nucleo.png"},{id:"24",name:"oceanengine",imageSrc:"https://home.playablefactory.com/oceanengine.png"},{id:"25",name:"pointblank",imageSrc:"https://home.playablefactory.com/pointblank.png"},{id:"26",name:"snapchat",imageSrc:"https://home.playablefactory.com/snapchat.png"},{id:"27",name:"tapjoy",imageSrc:"https://home.playablefactory.com/tapjoy.png"},{id:"28",name:"tencent",imageSrc:"https://home.playablefactory.com/tencent.png"},{id:"31",name:"aarki",imageSrc:"https://home.playablefactory.com/aarki.png"},{id:"32",name:"yandex",imageSrc:"https://home.playablefactory.com/yandex.png"},{id:"34",name:"zucks",imageSrc:"https://home.playablefactory.com/zucks.png"},{id:"35",name:"google",imageSrc:"https://home.playablefactory.com/google.png"},{id:"36",name:"inmobi",imageSrc:"https://home.playablefactory.com/inmobi.png"},{id:"38",name:"smadex",imageSrc:"https://home.playablefactory.com/smadex.png"},{id:"39",name:"instantGame",imageSrc:"https://home.playablefactory.com/instantGame.png"},{id:"40",name:"luna",imageSrc:"https://home.playablefactory.com/luna.png"},{id:"41",name:"nend",imageSrc:"https://home.playablefactory.com/nend.png"},{id:"42",name:"jammp",imageSrc:"https://home.playablefactory.com/nend.png"},{id:"43",name:"adjoe",imageSrc:"https://home.playablefactory.com/adjoe.png"},{id:"45",name:"adikteev",imageSrc:"https://home.playablefactory.com/adikteev.png"},{id:"46",name:"appier",imageSrc:"https://home.playablefactory.com/appier.png"},{id:"47",name:"remerge",imageSrc:"https://home.playablefactory.com/remerge.png"},{id:"48",name:"persona",imageSrc:"https://home.playablefactory.com/persona.png"},{id:"49",name:"bidease",imageSrc:"https://home.playablefactory.com/bidease.png"},{id:"50",name:"mraid",imageSrc:"https://home.playablefactory.com/mraid.png"},{id:"51",name:"zynga",imageSrc:"https://home.playablefactory.com/zynga.png"},{id:"52",name:"youappi",imageSrc:"https://home.playablefactory.com/youappi.png"},{id:"53",name:"cdn",imageSrc:"https://home.playablefactory.com/cdn.png"}],vs=({children:e,typeOfProduct:t,className:n,onClick:r})=>{const o={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"0.5rem",width:"12rem",height:"2.5rem",backgroundColor:qe[t],color:"white",fontSize:"0.875rem",borderRadius:"0.875rem"};return s.jsx("button",{onClick:r,className:n,style:o,children:e})},bs=({networksVersionTotalSize:e,typeOfProduct:t,onClickMultiDownload:n,multiDownloading:r})=>s.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"8px"},children:r?s.jsx("div",{style:{display:"flex",width:"12rem",height:"2.5rem",borderRadius:"0.875rem",alignItems:"center",justifyContent:"center",backgroundColor:qe[t]},children:s.jsx(Lt,{})}):s.jsx(vs,{typeOfProduct:t,onClick:n,children:s.jsx("span",{style:{fontSize:"1.25rem",padding:"0.5rem",color:"#fff"},children:"Download All"})})}),Cs=({playable:e,creditDownload:t,visible:n,versionId:r,typeOfProduct:o,api:i,user:a,handleDownloadError:A,fetchFileUrl:d,urls:u,game:l,getDownloadCount:m,disabled:v,setSafariCopyLink:g,isTest:f,urlType:p,allNetworksSelected:y,setAllNetworksSelected:w})=>{const[j,M]=C.useState([]),[E,b]=C.useState([]),[T,X]=C.useState(!1),[F,le]=C.useState(""),[te,Ae]=C.useState(!1),[Q,_]=C.useState(!1),[S,J]=C.useState("download"),[N,h]=C.useState(!1),z=async I=>{const L=[...j];if(j.includes(I)){const Y=L.findIndex(O=>O===I);L.splice(Y,1),M(L)}else L.push(I),M([...j,I]);ln.filter(Y=>[...L].includes(Y.id)).map(Y=>Y.name)},D=async()=>new Promise(async(I,L)=>{const Y=ln.filter(O=>[...j].includes(O.id)).map(O=>O.name);Ae(!0),es(r,u,Y,{urlType:p}).then(O=>{Ae(!1),I(O)}).catch(O=>{console.log("get multi download err"),Ae(!1),A(O.message,O),L(O)})}),Z=async()=>{u.iosUrl,u.googleUrl,t&&t.willSpendCredit?(_(!0),J("download"),h(!0)):(h(!1),await D())};return C.useEffect(()=>{const I=ln.filter(L=>{var Y;return t&&((Y=t==null?void 0:t.networks)==null?void 0:Y.length)>0?t==null?void 0:t.networks.includes(L.name):o==="Import"?e==null?void 0:e.networks.filter(O=>O.status==="paid").some(O=>O.name===L.name):e==null?void 0:e.networks.includes(L.name)}).filter(L=>L.name==="voodoo"?a.customer==="customer:20":!0).map(L=>L.id);M(y?I:[])},[y]),s.jsxs(s.Fragment,{children:[s.jsx("div",{style:{position:"relative",flex:1,overflowY:Q?"hidden":"auto",padding:"1.5rem",paddingTop:"0"},children:s.jsx("div",{style:{display:"grid",gridTemplateColumns:"180px 180px 180px",gap:"1rem",overflowY:"auto",padding:"0.75rem"},children:n&&ln.filter(I=>{var L;return t&&((L=t==null?void 0:t.networks)==null?void 0:L.length)>0?t==null?void 0:t.networks.includes(I.name):o==="Import"?e==null?void 0:e.networks.filter(Y=>Y.status==="paid").some(Y=>Y.name===I.name):e==null?void 0:e.networks.includes(I.name)}).filter(I=>I.name==="voodoo"?a.customer==="customer:20":!0).map(I=>{let L=I.imageSrc;if(I.name==="web"){let Y="web_"+o.toLowerCase()+".png";L=L.replace("web.png",Y)}return s.jsx(ys,{id:I.id,name:I.name,imageUrl:L,selected:j.includes(I.id),handleCardClick:z,networkVersionSize:E,fileSizeLoading:T,showCheckBox:!0,typeOfProduct:o,versionId:r,api:i,handleDownloadError:A,fetchFileUrl:d,urls:u,game:l,creditDownload:t,setIsConfirmActive:_,getDownloadCount:m,disabled:v,user:a,setSafariCopyLink:g,isTest:f,urlType:p},I.id)})})}),j.length>1&&(o==="Playable"||o==="Ready"||o==="Flex")&&s.jsx("div",{style:{position:"fixed",bottom:"0",left:"65%",zIndex:20,transform:"translateX(-50%)",display:"flex",flexDirection:"column",paddingTop:"5px"},children:s.jsx(bs,{onClickMultiDownload:Z,networksVersionTotalSize:F,typeOfProduct:o,multiDownloading:te})}),N&&s.jsx(Po,{creditConfirmType:S,handleCopyLink:async()=>{},download:async()=>{h(!1),_(!1),await D()},onClose:()=>{h(!1),_(!1)},getDownloadCount:m})]})};async function Zs(e,t){return(await ge.post(t+"/getFlexDownloadCount",e)).data}async function Is(e,t){try{return(await ge.post(t+"/findGame",{_id:e})).data}catch{}}async function ws(e,t){return(await ge.post(t+"/getPlayableVersionMarketLink",{_id:e})).data}async function xs(e,t){return(await ge.post(t+"/getFlexData",{_id:e})).data}async function Ks(e,t){return(await ge.post(t+"/getImportedPlayable",{id:e})).data}async function Ss(e,t){return(await ge.post(t+"/getReadyDownloadCount",e)).data}const Ws=["adcolony","ironsource","applovin","unity","mobvista","criteo","kayzen","vungle","moloco","inmobi"],Vo=["web","adcolony","applovin","chartboost","crossinstall","fb","google","ironsource","lifestreet","liftoff","mobvista","nucleo","tapjoy","toutiao","unity","vungle","moloco","cdn"];let Bo=null;const Ms=({playableId:e,versionId:t,gameId:n,typeOfProduct:r,visible:o,api:i,user:a,title:A,handleDownloadError:d,fetchFileUrl:u,fileSize:l,setFileSize:m,setSafariCopyLink:v,iosLink:g,androidLink:f,setIosLink:p,setAndroidLink:y,urlType:w,setUrlType:j})=>{const[M,E]=C.useState(null),[b,T]=C.useState(null),[X,F]=C.useState(null),[le,te]=C.useState(!1),[Ae,Q]=C.useState(!0),[_,S]=C.useState(window.innerWidth),[J,N]=C.useState(!1);console.log("download modal version: 6.0.22");const[h,z]=C.useState(!1);C.useEffect(()=>{},[h]),C.useEffect(()=>{const K=()=>{S(window.innerWidth)};return window.addEventListener("resize",K),()=>{window.removeEventListener("resize",K)}},[]);const D=async()=>{te(!0);const K=await nr(e,i);return K!=null&&K.networks||(K.networks=Ws),E(K),K},Z=(K,R)=>{clearTimeout(Bo),Bo=setTimeout(()=>{console.log("Update URLS:"),tr(t,{iosUrl:K,googleUrl:R},{urlType:w})},1e3)},I=K=>{p(K),Z(K,f)},L=K=>{y(K),Z(g,K)},Y=async(K,R)=>{var P,V;console.log("getIosAndAndroidLink");try{let B;if(r==="Playable"||r==="Ready"){const se=await ws(t,i);if(se){console.log("version",se),p(se.iosLink),y(se.androidLink),te(!1);return}if(K&&(K.iosUrl||K.googleUrl)){p(K.iosUrl),y(K.googleUrl),te(!1);return}if(R&&R.html){let W=await fetch(u+"/"+R.html).then(de=>de.text());const ee=((P=W.match(/var\s+iosLink\s*=\s*['|"](https?[\w\d;,/?:@&=+$\-_.!~*'()#]+)['|"]/))==null?void 0:P.at(1))||"";p(ee);const ue=((V=W.match(/var\s+androidLink\s*=\s*['|"](https?[\w\d;,/?:@&=+$\-_.!~*'()#]+)['|"]/))==null?void 0:V.at(1))||"";y(ue),te(!1)}else y(""),p(""),te(!1)}else if(r==="Flex"){const se=await xs(t,i);if(se.googleUrl||se.iosUrl){y(se.googleUrl),p(se.iosUrl),te(!1);return}K&&(K.iosUrl||K.googleUrl)?(p(K.iosUrl),y(K.googleUrl),te(!1)):(y(""),p(""),te(!1))}}catch(B){d(B.response.data.error.msg)}},O=async()=>{te(!0);let K;r==="Flex"?K=await Zs({_id:t},i):r==="Ready"&&(K=await Ss({_id:t},i)),K&&(["admin","pm","tester","sales"].includes(a.role)?F({...K,networks:Vo}):r==="Ready"&&!K.canDownload?F({...K,networks:Vo}):F(K)),te(!1)},$=async()=>await Is(n,i);return C.useEffect(()=>{o||(E(null),T(null),F(null),m(null)),o&&(r==="Playable"?(D().then(K=>{Y(null,K)}),Q(!1)):r==="Ready"?O().then(K=>{D().then(R=>{Y(null,R),Q(!1)})}):r==="Flex"?O().then(K=>{Q(!1),$().then(R=>{o&&(Y(R,null),Q(!1),T(R))})}):r==="Import"&&Ks(t,i).then(K=>{console.log(K),E(K),p(K.iosUrl||""),y(K.googleUrl||""),te(!1),Q(!1)}))},[n,e,t,o]),s.jsxs("div",{style:{display:"flex",height:_>1440?"700px":"650px",width:_>1440?"675px":"680px",flexDirection:"column",borderRadius:"rounded",backgroundColor:"#F7F7F8",paddingTop:"0px"},children:[s.jsx(ds,{title:A,typeOfProduct:r,fileSize:l,urls:{iosUrl:g,googleUrl:f},handleIosChange:I,handleGoogleChange:L,disabled:Ae,api:i,creditDownload:X,user:a,isTest:J,setIsTest:N,urlType:w,setUrlType:j,allNetworksSelected:h,setAllNetworksSelected:z}),le?s.jsx("div",{style:{height:"100%",width:"100%",display:"flex",justifyContent:"center"},children:s.jsx(Lt,{isNetworksLoading:!0})}):(M||X)&&(r==="Flex"?b:!0)&&!le&&g!=="Loading..."&&f!=="Loading..."&&s.jsx(Cs,{playable:M,creditDownload:X,visible:o,versionId:t,typeOfProduct:r,api:i,user:a,handleDownloadError:d,fetchFileUrl:u,urls:{iosUrl:g,googleUrl:f},game:b,getDownloadCount:O,disabled:Ae,setSafariCopyLink:v,isTest:J,urlType:w,allNetworksSelected:h,setAllNetworksSelected:z})]})},qu="";var ir={exports:{}},rt={},ar={exports:{}},Ye={},Ar={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=l;/*!
56
+ `+i):r.stack=i}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=et(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:i}=n;r!==void 0&&Tn.assertOptions(r,{silentJSONParsing:Be.transitional(Be.boolean),forcedJSONParsing:Be.transitional(Be.boolean),clarifyTimeoutError:Be.transitional(Be.boolean)},!1),o!=null&&(q.isFunction(o)?n.paramsSerializer={serialize:o}:Tn.assertOptions(o,{encode:Be.function,serialize:Be.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=i&&q.merge(i.common,i[n.method]);i&&q.forEach(["delete","get","head","post","put","patch","common"],f=>{delete i[f]}),n.headers=ze.concat(a,i);const A=[];let d=!0;this.interceptors.request.forEach(function(p){typeof p.runWhen=="function"&&p.runWhen(n)===!1||(d=d&&p.synchronous,A.unshift(p.fulfilled,p.rejected))});const u=[];this.interceptors.response.forEach(function(p){u.push(p.fulfilled,p.rejected)});let l,m=0,v;if(!d){const f=[xo.bind(this),void 0];for(f.unshift.apply(f,A),f.push.apply(f,u),v=f.length,l=Promise.resolve(n);m<v;)l=l.then(f[m++],f[m++]);return l}v=A.length;let g=n;for(m=0;m<v;){const f=A[m++],p=A[m++];try{g=f(g)}catch(y){p.call(this,y);break}}try{l=xo.call(this,g)}catch(f){return Promise.reject(f)}for(m=0,v=u.length;m<v;)l=l.then(u[m++],u[m++]);return l}getUri(t){t=et(this.defaults,t);const n=go(t.baseURL,t.url);return lo(n,t.params,t.paramsSerializer)}}q.forEach(["delete","get","head","options"],function(t){$t.prototype[t]=function(n,r){return this.request(et(r||{},{method:t,url:n,data:(r||{}).data}))}}),q.forEach(["post","put","patch"],function(t){function n(r){return function(i,a,A){return this.request(et(A||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))}}$t.prototype[t]=n(),$t.prototype[t+"Form"]=n(!0)});const en=$t;class Hn{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(o=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](o);r._listeners=null}),this.promise.then=o=>{let i;const a=new Promise(A=>{r.subscribe(A),i=A}).then(o);return a.cancel=function(){r.unsubscribe(i)},a},t(function(i,a,A){r.reason||(r.reason=new dt(i,a,A),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}static source(){let t;return{token:new Hn(function(o){t=o}),cancel:t}}}const SA=Hn;function WA(e){return function(n){return e.apply(null,n)}}function MA(e){return q.isObject(e)&&e.isAxiosError===!0}const Xn={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};Object.entries(Xn).forEach(([e,t])=>{Xn[t]=e});const LA=Xn;function Wo(e){const t=new en(e),n=Pr(en.prototype.request,t);return q.extend(n,en.prototype,t,{allOwnKeys:!0}),q.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return Wo(et(e,o))},n}const fe=Wo(jn);fe.Axios=en,fe.CanceledError=dt,fe.CancelToken=SA,fe.isCancel=fo,fe.VERSION=Ko,fe.toFormData=Pt,fe.AxiosError=U,fe.Cancel=fe.CanceledError,fe.all=function(t){return Promise.all(t)},fe.spread=WA,fe.isAxiosError=MA,fe.mergeConfig=et,fe.AxiosHeaders=ze,fe.formToJSON=e=>mo(q.isHTMLForm(e)?new FormData(e):e),fe.getAdapter=wo.getAdapter,fe.HttpStatusCode=LA,fe.default=fe;const EA=fe;/*! typescript-cookie v1.0.6 | MIT */const Mo=e=>encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),Lo=e=>encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent),Qn=decodeURIComponent,Pn=e=>(e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent));function OA(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(([t,n])=>n!=null&&n!==!1).map(([t,n])=>n===!0?`; ${t}`:`; ${t}=${n.split(";")[0]}`).join("")}function Eo(e,t,n){const r=/(?:^|; )([^=]*)=([^;]*)/g,o={};let i;for(;(i=r.exec(document.cookie))!=null;)try{const a=n(i[1]);if(o[a]=t(i[2],a),e===a)break}catch{}return e!=null?o[e]:o}const Oo=Object.freeze({decodeName:Qn,decodeValue:Pn,encodeName:Mo,encodeValue:Lo}),Vn=Object.freeze({path:"/"});function ko(e,t,n=Vn,{encodeValue:r=Lo,encodeName:o=Mo}={}){return document.cookie=`${o(e)}=${r(t,e)}${OA(n)}`}function jo(e,{decodeValue:t=Pn,decodeName:n=Qn}={}){return Eo(e,t,n)}function kA({decodeValue:e=Pn,decodeName:t=Qn}={}){return Eo(void 0,e,t)}function jA(e,t=Vn){ko(e,"",Object.assign({},t,{expires:-1}))}function Bn(e,t){const n={set:function(o,i,a){return ko(o,i,Object.assign({},this.attributes,a),{encodeValue:this.converter.write})},get:function(o){if(arguments.length===0)return kA(this.converter.read);if(o!=null)return jo(o,this.converter.read)},remove:function(o,i){jA(o,Object.assign({},this.attributes,i))},withAttributes:function(o){return Bn(this.converter,Object.assign({},this.attributes,o))},withConverter:function(o){return Bn(Object.assign({},this.converter,o),this.attributes)}},r={attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}};return Object.create(n,r)}Bn({read:Oo.decodeValue,write:Oo.encodeValue},Vn);let zo;typeof window<"u"&&(zo=jo("token"));const ge=EA.create({headers:{Authorization:zo}});async function zA(e,t,n){return(await ge.post(n+"/createFlexVersionLinkMulti",{_id:e,networks:t})).data}async function YA(e,t){return e.network=="fb"&&(e.zip=1),(await ge.post(t+"/createFlexVersionLink",e||{})).data}async function JA(e,t,n){return(await ge.post(e+"/createImportedVersionLink",{_id:t,network:n})).data}async function NA(e,t,n,r,o){return(await ge.post(e+"/createPlayableVersionLink",{_id:t,network:n,isPfTest:r,extras:o})).data}async function RA(e,t,n){return(await ge.post(n+"/createPlayableVersionLinkMulti",{_id:e,networks:t})).data}async function DA(e,t,n,r,o){return(await ge.post(e+"/createReadyVersionLink",{_id:t,network:n,isPfTest:r,extras:o})).data}async function GA(e,t,n){return(await ge.post(n+"/createReadyVersionLinkMulti",{_id:e,networks:t})).data}async function TA(e,t){return(await ge.post(t+"/getCdnExportName",e||{})).data}async function HA(e,t){return(await ge.post(t+"/updateFlexUrl",e||{})).data}async function Yo(e,t,n){return(await ge.post(n+"/updatePlayableVersion",{...t,_id:e})).data}function xt(e){const t=document.createElement("input");t.value=e,document.body.appendChild(t),t.select();try{return document.execCommand("copy")?(document.body.removeChild(t),!0):(document.body.removeChild(t),!1)}catch{return document.body.removeChild(t),!1}}function Jo(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=Jo(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function Ue(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=Jo(e))&&(r&&(r+=" "),r+=t);return r}const Kt=e=>typeof e=="number"&&!isNaN(e),tt=e=>typeof e=="string",Ze=e=>typeof e=="function",tn=e=>tt(e)||Ze(e)?e:null,Un=e=>C.isValidElement(e)||tt(e)||Ze(e)||Kt(e);function XA(e,t,n){n===void 0&&(n=300);const{scrollHeight:r,style:o}=e;requestAnimationFrame(()=>{o.minHeight="initial",o.height=r+"px",o.transition=`all ${n}ms`,requestAnimationFrame(()=>{o.height="0",o.padding="0",o.margin="0",setTimeout(t,n)})})}function nn(e){let{enter:t,exit:n,appendPosition:r=!1,collapse:o=!0,collapseDuration:i=300}=e;return function(a){let{children:A,position:d,preventExitTransition:u,done:l,nodeRef:m,isIn:v}=a;const g=r?`${t}--${d}`:t,f=r?`${n}--${d}`:n,p=C.useRef(0);return C.useLayoutEffect(()=>{const y=m.current,w=g.split(" "),j=M=>{M.target===m.current&&(y.dispatchEvent(new Event("d")),y.removeEventListener("animationend",j),y.removeEventListener("animationcancel",j),p.current===0&&M.type!=="animationcancel"&&y.classList.remove(...w))};y.classList.add(...w),y.addEventListener("animationend",j),y.addEventListener("animationcancel",j)},[]),C.useEffect(()=>{const y=m.current,w=()=>{y.removeEventListener("animationend",w),o?XA(y,l,i):l()};v||(u?w():(p.current=1,y.className+=` ${f}`,y.addEventListener("animationend",w)))},[v]),C.createElement(C.Fragment,null,A)}}function No(e,t){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:t}:{}}const Me={list:new Map,emitQueue:new Map,on(e,t){return this.list.has(e)||this.list.set(e,[]),this.list.get(e).push(t),this},off(e,t){if(t){const n=this.list.get(e).filter(r=>r!==t);return this.list.set(e,n),this}return this.list.delete(e),this},cancelEmit(e){const t=this.emitQueue.get(e);return t&&(t.forEach(clearTimeout),this.emitQueue.delete(e)),this},emit(e){this.list.has(e)&&this.list.get(e).forEach(t=>{const n=setTimeout(()=>{t(...[].slice.call(arguments,1))},0);this.emitQueue.has(e)||this.emitQueue.set(e,[]),this.emitQueue.get(e).push(n)})}},rn=e=>{let{theme:t,type:n,...r}=e;return C.createElement("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:t==="colored"?"currentColor":`var(--toastify-icon-color-${n})`,...r})},Fn={info:function(e){return C.createElement(rn,{...e},C.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 C.createElement(rn,{...e},C.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 C.createElement(rn,{...e},C.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 C.createElement(rn,{...e},C.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 C.createElement("div",{className:"Toastify__spinner"})}};function QA(e){const[,t]=C.useReducer(g=>g+1,0),[n,r]=C.useState([]),o=C.useRef(null),i=C.useRef(new Map).current,a=g=>n.indexOf(g)!==-1,A=C.useRef({toastKey:1,displayedToast:0,count:0,queue:[],props:e,containerId:null,isToastActive:a,getToast:g=>i.get(g)}).current;function d(g){let{containerId:f}=g;const{limit:p}=A.props;!p||f&&A.containerId!==f||(A.count-=A.queue.length,A.queue=[])}function u(g){r(f=>g==null?[]:f.filter(p=>p!==g))}function l(){const{toastContent:g,toastProps:f,staleId:p}=A.queue.shift();v(g,f,p)}function m(g,f){let{delay:p,staleId:y,...w}=f;if(!Un(g)||function(Q){return!o.current||A.props.enableMultiContainer&&Q.containerId!==A.props.containerId||i.has(Q.toastId)&&Q.updateId==null}(w))return;const{toastId:j,updateId:M,data:E}=w,{props:b}=A,T=()=>u(j),X=M==null;X&&A.count++;const F={...b,style:b.toastStyle,key:A.toastKey++,...Object.fromEntries(Object.entries(w).filter(Q=>{let[_,S]=Q;return S!=null})),toastId:j,updateId:M,data:E,closeToast:T,isIn:!1,className:tn(w.className||b.toastClassName),bodyClassName:tn(w.bodyClassName||b.bodyClassName),progressClassName:tn(w.progressClassName||b.progressClassName),autoClose:!w.isLoading&&(le=w.autoClose,te=b.autoClose,le===!1||Kt(le)&&le>0?le:te),deleteToast(){const Q=No(i.get(j),"removed");i.delete(j),Me.emit(4,Q);const _=A.queue.length;if(A.count=j==null?A.count-A.displayedToast:A.count-1,A.count<0&&(A.count=0),_>0){const S=j==null?A.props.limit:1;if(_===1||S===1)A.displayedToast++,l();else{const J=S>_?_:S;A.displayedToast=J;for(let N=0;N<J;N++)l()}}else t()}};var le,te;F.iconOut=function(Q){let{theme:_,type:S,isLoading:J,icon:N}=Q,h=null;const z={theme:_,type:S};return N===!1||(Ze(N)?h=N(z):C.isValidElement(N)?h=C.cloneElement(N,z):tt(N)||Kt(N)?h=N:J?h=Fn.spinner():(D=>D in Fn)(S)&&(h=Fn[S](z))),h}(F),Ze(w.onOpen)&&(F.onOpen=w.onOpen),Ze(w.onClose)&&(F.onClose=w.onClose),F.closeButton=b.closeButton,w.closeButton===!1||Un(w.closeButton)?F.closeButton=w.closeButton:w.closeButton===!0&&(F.closeButton=!Un(b.closeButton)||b.closeButton);let Ae=g;C.isValidElement(g)&&!tt(g.type)?Ae=C.cloneElement(g,{closeToast:T,toastProps:F,data:E}):Ze(g)&&(Ae=g({closeToast:T,toastProps:F,data:E})),b.limit&&b.limit>0&&A.count>b.limit&&X?A.queue.push({toastContent:Ae,toastProps:F,staleId:y}):Kt(p)?setTimeout(()=>{v(Ae,F,y)},p):v(Ae,F,y)}function v(g,f,p){const{toastId:y}=f;p&&i.delete(p);const w={content:g,props:f};i.set(y,w),r(j=>[...j,y].filter(M=>M!==p)),Me.emit(4,No(w,w.props.updateId==null?"added":"updated"))}return C.useEffect(()=>(A.containerId=e.containerId,Me.cancelEmit(3).on(0,m).on(1,g=>o.current&&u(g)).on(5,d).emit(2,A),()=>{i.clear(),Me.emit(3,A)}),[]),C.useEffect(()=>{A.props=e,A.isToastActive=a,A.displayedToast=n.length}),{getToastToRender:function(g){const f=new Map,p=Array.from(i.values());return e.newestOnTop&&p.reverse(),p.forEach(y=>{const{position:w}=y.props;f.has(w)||f.set(w,[]),f.get(w).push(y)}),Array.from(f,y=>g(y[0],y[1]))},containerRef:o,isToastActive:a}}function Ro(e){return e.targetTouches&&e.targetTouches.length>=1?e.targetTouches[0].clientX:e.clientX}function Do(e){return e.targetTouches&&e.targetTouches.length>=1?e.targetTouches[0].clientY:e.clientY}function PA(e){const[t,n]=C.useState(!1),[r,o]=C.useState(!1),i=C.useRef(null),a=C.useRef({start:0,x:0,y:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,boundingRect:null,didMove:!1}).current,A=C.useRef(e),{autoClose:d,pauseOnHover:u,closeToast:l,onClick:m,closeOnClick:v}=e;function g(E){if(e.draggable){E.nativeEvent.type==="touchstart"&&E.nativeEvent.preventDefault(),a.didMove=!1,document.addEventListener("mousemove",w),document.addEventListener("mouseup",j),document.addEventListener("touchmove",w),document.addEventListener("touchend",j);const b=i.current;a.canCloseOnClick=!0,a.canDrag=!0,a.boundingRect=b.getBoundingClientRect(),b.style.transition="",a.x=Ro(E.nativeEvent),a.y=Do(E.nativeEvent),e.draggableDirection==="x"?(a.start=a.x,a.removalDistance=b.offsetWidth*(e.draggablePercent/100)):(a.start=a.y,a.removalDistance=b.offsetHeight*(e.draggablePercent===80?1.5*e.draggablePercent:e.draggablePercent/100))}}function f(E){if(a.boundingRect){const{top:b,bottom:T,left:X,right:F}=a.boundingRect;E.nativeEvent.type!=="touchend"&&e.pauseOnHover&&a.x>=X&&a.x<=F&&a.y>=b&&a.y<=T?y():p()}}function p(){n(!0)}function y(){n(!1)}function w(E){const b=i.current;a.canDrag&&b&&(a.didMove=!0,t&&y(),a.x=Ro(E),a.y=Do(E),a.delta=e.draggableDirection==="x"?a.x-a.start:a.y-a.start,a.start!==a.x&&(a.canCloseOnClick=!1),b.style.transform=`translate${e.draggableDirection}(${a.delta}px)`,b.style.opacity=""+(1-Math.abs(a.delta/a.removalDistance)))}function j(){document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",j),document.removeEventListener("touchmove",w),document.removeEventListener("touchend",j);const E=i.current;if(a.canDrag&&a.didMove&&E){if(a.canDrag=!1,Math.abs(a.delta)>a.removalDistance)return o(!0),void e.closeToast();E.style.transition="transform 0.2s, opacity 0.2s",E.style.transform=`translate${e.draggableDirection}(0)`,E.style.opacity="1"}}C.useEffect(()=>{A.current=e}),C.useEffect(()=>(i.current&&i.current.addEventListener("d",p,{once:!0}),Ze(e.onOpen)&&e.onOpen(C.isValidElement(e.children)&&e.children.props),()=>{const E=A.current;Ze(E.onClose)&&E.onClose(C.isValidElement(E.children)&&E.children.props)}),[]),C.useEffect(()=>(e.pauseOnFocusLoss&&(document.hasFocus()||y(),window.addEventListener("focus",p),window.addEventListener("blur",y)),()=>{e.pauseOnFocusLoss&&(window.removeEventListener("focus",p),window.removeEventListener("blur",y))}),[e.pauseOnFocusLoss]);const M={onMouseDown:g,onTouchStart:g,onMouseUp:f,onTouchEnd:f};return d&&u&&(M.onMouseEnter=y,M.onMouseLeave=p),v&&(M.onClick=E=>{m&&m(E),a.canCloseOnClick&&l()}),{playToast:p,pauseToast:y,isRunning:t,preventExitTransition:r,toastRef:i,eventHandlers:M}}function Go(e){let{closeToast:t,theme:n,ariaLabel:r="close"}=e;return C.createElement("button",{className:`Toastify__close-button Toastify__close-button--${n}`,type:"button",onClick:o=>{o.stopPropagation(),t(o)},"aria-label":r},C.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},C.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 VA(e){let{delay:t,isRunning:n,closeToast:r,type:o="default",hide:i,className:a,style:A,controlledProgress:d,progress:u,rtl:l,isIn:m,theme:v}=e;const g=i||d&&u===0,f={...A,animationDuration:`${t}ms`,animationPlayState:n?"running":"paused",opacity:g?0:1};d&&(f.transform=`scaleX(${u})`);const p=Ue("Toastify__progress-bar",d?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated",`Toastify__progress-bar-theme--${v}`,`Toastify__progress-bar--${o}`,{"Toastify__progress-bar--rtl":l}),y=Ze(a)?a({rtl:l,type:o,defaultClassName:p}):Ue(p,a);return C.createElement("div",{role:"progressbar","aria-hidden":g?"true":"false","aria-label":"notification timer",className:y,style:f,[d&&u>=1?"onTransitionEnd":"onAnimationEnd"]:d&&u<1?null:()=>{m&&r()}})}const BA=e=>{const{isRunning:t,preventExitTransition:n,toastRef:r,eventHandlers:o}=PA(e),{closeButton:i,children:a,autoClose:A,onClick:d,type:u,hideProgressBar:l,closeToast:m,transition:v,position:g,className:f,style:p,bodyClassName:y,bodyStyle:w,progressClassName:j,progressStyle:M,updateId:E,role:b,progress:T,rtl:X,toastId:F,deleteToast:le,isIn:te,isLoading:Ae,iconOut:Q,closeOnClick:_,theme:S}=e,J=Ue("Toastify__toast",`Toastify__toast-theme--${S}`,`Toastify__toast--${u}`,{"Toastify__toast--rtl":X},{"Toastify__toast--close-on-click":_}),N=Ze(f)?f({rtl:X,position:g,type:u,defaultClassName:J}):Ue(J,f),h=!!T||!A,z={closeToast:m,type:u,theme:S};let D=null;return i===!1||(D=Ze(i)?i(z):C.isValidElement(i)?C.cloneElement(i,z):Go(z)),C.createElement(v,{isIn:te,done:le,position:g,preventExitTransition:n,nodeRef:r},C.createElement("div",{id:F,onClick:d,className:N,...o,style:p,ref:r},C.createElement("div",{...te&&{role:b},className:Ze(y)?y({type:u}):Ue("Toastify__toast-body",y),style:w},Q!=null&&C.createElement("div",{className:Ue("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!Ae})},Q),C.createElement("div",null,a)),D,C.createElement(VA,{...E&&!h?{key:`pb-${E}`}:{},rtl:X,theme:S,delay:A,isRunning:t,isIn:te,closeToast:m,hide:l,type:u,style:M,className:j,controlledProgress:h,progress:T||0})))},on=function(e,t){return t===void 0&&(t=!1),{enter:`Toastify--animate Toastify__${e}-enter`,exit:`Toastify--animate Toastify__${e}-exit`,appendPosition:t}},UA=nn(on("bounce",!0));nn(on("slide",!0)),nn(on("zoom")),nn(on("flip"));const _n=C.forwardRef((e,t)=>{const{getToastToRender:n,containerRef:r,isToastActive:o}=QA(e),{className:i,style:a,rtl:A,containerId:d}=e;function u(l){const m=Ue("Toastify__toast-container",`Toastify__toast-container--${l}`,{"Toastify__toast-container--rtl":A});return Ze(i)?i({position:l,rtl:A,defaultClassName:m}):Ue(m,tn(i))}return C.useEffect(()=>{t&&(t.current=r.current)},[]),C.createElement("div",{ref:r,className:"Toastify",id:d},n((l,m)=>{const v=m.length?{...a}:{...a,pointerEvents:"none"};return C.createElement("div",{className:u(l),style:v,key:`container-${l}`},m.map((g,f)=>{let{content:p,props:y}=g;return C.createElement(BA,{...y,isIn:o(y.toastId),style:{...y.style,"--nth":f+1,"--len":m.length},key:`toast-${y.key}`},p)}))}))});_n.displayName="ToastContainer",_n.defaultProps={position:"top-right",transition:UA,autoClose:5e3,closeButton:Go,pauseOnHover:!0,pauseOnFocusLoss:!0,closeOnClick:!0,draggable:!0,draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light"};let $n,nt=new Map,St=[],FA=1;function To(){return""+FA++}function _A(e){return e&&(tt(e.toastId)||Kt(e.toastId))?e.toastId:To()}function Wt(e,t){return nt.size>0?Me.emit(0,e,t):St.push({content:e,options:t}),t.toastId}function an(e,t){return{...t,type:t&&t.type||e,toastId:_A(t)}}function An(e){return(t,n)=>Wt(t,an(e,n))}function me(e,t){return Wt(e,an("default",t))}me.loading=(e,t)=>Wt(e,an("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...t})),me.promise=function(e,t,n){let r,{pending:o,error:i,success:a}=t;o&&(r=tt(o)?me.loading(o,n):me.loading(o.render,{...n,...o}));const A={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},d=(l,m,v)=>{if(m==null)return void me.dismiss(r);const g={type:l,...A,...n,data:v},f=tt(m)?{render:m}:m;return r?me.update(r,{...g,...f}):me(f.render,{...g,...f}),v},u=Ze(e)?e():e;return u.then(l=>d("success",a,l)).catch(l=>d("error",i,l)),u},me.success=An("success"),me.info=An("info"),me.error=An("error"),me.warning=An("warning"),me.warn=me.warning,me.dark=(e,t)=>Wt(e,an("default",{theme:"dark",...t})),me.dismiss=e=>{nt.size>0?Me.emit(1,e):St=St.filter(t=>e!=null&&t.options.toastId!==e)},me.clearWaitingQueue=function(e){return e===void 0&&(e={}),Me.emit(5,e)},me.isActive=e=>{let t=!1;return nt.forEach(n=>{n.isToastActive&&n.isToastActive(e)&&(t=!0)}),t},me.update=function(e,t){t===void 0&&(t={}),setTimeout(()=>{const n=function(r,o){let{containerId:i}=o;const a=nt.get(i||$n);return a&&a.getToast(r)}(e,t);if(n){const{props:r,content:o}=n,i={delay:100,...r,...t,toastId:t.toastId||e,updateId:To()};i.toastId!==e&&(i.staleId=e);const a=i.render||o;delete i.render,Wt(a,i)}},0)},me.done=e=>{me.update(e,{progress:1})},me.onChange=e=>(Me.on(4,e),()=>{Me.off(4,e)}),me.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"},me.TYPE={INFO:"info",SUCCESS:"success",WARNING:"warning",ERROR:"error",DEFAULT:"default"},Me.on(2,e=>{$n=e.containerId||e,nt.set($n,e),St.forEach(t=>{Me.emit(0,t.content,t.options)}),St=[]}).on(3,e=>{nt.delete(e.containerId||e),nt.size===0&&Me.off(0).off(1).off(5)});function mt(e){me.success(e,{position:"top-center",autoClose:650,hideProgressBar:!0,closeOnClick:!0,pauseOnHover:!0,draggable:!0,progress:void 0,theme:"light"})}let er="",Te="Playable",Le=null,Ho=null;const tr=async(e,t,n)=>{Te==="Playable"?t&&t.iosUrl!=="Loading..."&&t.googleUrl!=="Loading..."&&await Yo(e,{iosLink:t==null?void 0:t.iosUrl,androidLink:t==null?void 0:t.googleUrl},Le):Te==="Flex"?t&&t.iosUrl!=="Loading..."&&t.googleUrl!=="Loading..."&&await HA({_id:e,iosLink:t==null?void 0:t.iosUrl,androidLink:t==null?void 0:t.googleUrl},Le):Te==="Ready"&&t&&t.iosUrl!=="Loading..."&&t.googleUrl!=="Loading..."&&((n==null?void 0:n.urlType)==="single"&&(t.googleUrl=t.iosUrl),await Yo(e,{iosLink:t==null?void 0:t.iosUrl,androidLink:t==null?void 0:t.googleUrl},Le))},sn=async e=>{let t=er+"/"+e,n=e;fetch(t).then(r=>r.blob()).then(r=>{const o=window.URL.createObjectURL(r),i=document.createElement("a");i.href=o,i.download=n.split("/").reduce((a,A)=>A,""),document.body.appendChild(i),i.click(),window.URL.revokeObjectURL(o),mt("Download successfully")}).catch(r=>{console.error("File error:",r)})},$A=(e,t)=>{let n=er+"/"+e;xt(n)?mt("Link Copied"):t(n)};async function Mt(e,t,n,r="download",o=!1,i=null){return new Promise(async(a,A)=>{let d=async u=>{r==="download"?await sn(u):r==="copy"&&$A(u,Ho)};try{await tr(e,n,i)}catch(u){console.log("updateUrls error",u)}Te==="Playable"?NA(Le,e,t,o,i).then(async u=>{let{url:l}=u;await d(l),a(u)}).catch(u=>{let l=u.response.data.error.msg;A({message:l})}):Te==="Flex"?YA({_id:e,network:t,extras:i},Le).then(async u=>{if(u.message){A(u);return}let{url:l}=u;await d(l),a(u)}).catch(u=>{let l=u.response.data.error.msg;A({message:l})}):Te==="Import"?JA(Le,e,t).then(async u=>{let l=u.url;await d(l),a(u)}).catch(u=>{let l=u.response.data.error.msg;A({message:l})}):Te==="Ready"&&DA(Le,e,t,o,i).then(async u=>{if(u.message){A(u);return}let l=u.url;await d(l),a(u)}).catch(u=>{let l=u.response.data.error.msg;A({message:l})})})}async function es(e,t,n,r=null){return new Promise(async(o,i)=>{await tr(e,t,r),Te==="Flex"?zA(e,n,Le).then(async a=>{if(a.message){i(a);return}await sn(a.url),o(a.url)}).catch(a=>{let A=a.response.data.error.msg;i({message:A})}):Te==="Ready"?GA(e,n,Le).then(async a=>{if(a.message){i(a);return}await sn(a.url),o(a.url)}).catch(a=>{console.log("err",a);let A=a.response.data.error.msg;i({message:A})}):RA(e,n,Le).then(async a=>{await sn(a.url),o(a.url)}).catch(a=>{let A=a.response.data.error.msg;i({message:A})})})}function ts(e,t,n,r){Te=e,Le=t,Ho=n,er=r}async function ns(e){return await TA({versionId:e,checkExistance:!0},Le)}async function nr(e,t){return(await ge.post(t+"/findPlayable",{_id:e})).data}const rs=({versionId:e,playableId:t,typeOfProduct:n,api:r,copyLinkUrl:o,setSafariCopyLink:i,qrUrl:a,iosLink:A,androidLink:d,urlType:u})=>{const[l,m]=C.useState(!1),v=async()=>{m(!0),Mt(e,"default",{iosUrl:A,googleUrl:d},null,!1,{urlType:u}).then(async g=>{var w,j,M,E;let f="";if(t&&(n==="Playable"||n==="Ready")){const b=await nr(t,r);console.log(b);const T=(j=(w=b==null?void 0:b.data)==null?void 0:w.globalProps)==null?void 0:j.defaultLandscape,X=(E=(M=b==null?void 0:b.data)==null?void 0:M.globalProps)==null?void 0:E.defaultPhoneIndex;console.log(T,X),T&&(f+="&landscape=true"),X!==void 0&&(f+=`&phoneIndex=${X}`)}nr(t,r),m(!1);let p;n==="Flex"?p=`${o}/preview?versionId=${e}`:n==="Import"?p=`${o}/preview?versionId=${e}_`:n==="Ready"?p=`${o}/preview?versionId=${e}_&ready=true`:p=`${o}/preview?versionId=${e}_`,p+=f,xt(p)?mt("Link copied"):i(p),m(!1)}).catch(g=>{m(!1)})};return s.jsxs("div",{style:{display:"flex",height:"125px",width:"100%",borderRadius:"10px",backgroundColor:"#000000",padding:"10px"},children:[s.jsx("div",{style:{marginRight:"0.75rem",width:"50%",display:"flex",justifyContent:"center",alignItems:"center"},children:a?s.jsx(la,{bgColor:"#0F0F1E",fgColor:"#ffffff",style:{height:"auto",maxWidth:"100%",width:"100%"},value:a}):s.jsx("img",{style:{width:"50px",height:"50px"},src:Xe,alt:"pf-logo-gif"})}),s.jsxs("div",{children:[s.jsx("div",{style:{marginBottom:"0.25rem",fontSize:"0.875rem",fontWeight:"bold",color:"white"},children:"Mobile testing"}),s.jsx("div",{style:{marginBottom:"1rem",fontSize:"0.75rem",color:"gray"},children:"Scan QR Code to test in any browser"}),s.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"0.375rem",backgroundColor:"#00a3ff57",color:"secondary-blue",cursor:"pointer"},onClick:()=>{l||v()},children:[s.jsx(Qr,{style:{height:"1.5rem",width:"1.5rem",stroke:"secondary-blue",color:"white"}}),s.jsx("div",{style:{height:"24px",display:"flex",alignItems:"center",justifyContent:"center",width:"80px"},children:l?s.jsx("img",{style:{height:"90%"},src:Xe,alt:"loading"}):s.jsx("button",{style:{fontSize:"1rem",color:"white",background:"rgba(0, 163, 255, 0)"},children:"Copy Link"})})]})]})]})},os=({versionName:e,versionId:t,playableId:n,typeOfProduct:r,api:o,iframeUrl:i,fetchFileUrl:a,copyLinkUrl:A,setSafariCopyLink:d,iosLink:u,androidLink:l,urlType:m})=>{const[v,g]=C.useState(window.innerWidth);console.log("iosLink",u),C.useEffect(()=>{console.log("re add event listener");function p(y){console.log(y),y.data==="cta"&&(console.log("Received 'cta' message from iframe"),u&&window.open(u,"_blank"))}return window.addEventListener("message",p,!1),()=>{window.removeEventListener("message",p)}},[u,l]),C.useEffect(()=>{const p=()=>{g(window.innerWidth)};return window.addEventListener("resize",p),()=>{window.removeEventListener("resize",p)}},[]);const f=(e==null?void 0:e.length)>25?e.slice(0,25)+"...":e;return s.jsxs("div",{style:{display:"flex",width:"300px",flexDirection:"column",justifyContent:"space-between",padding:"5px",height:v>1440?"680px":"620px",borderRadius:"0px 0px 0px 16px",marginTop:"20px"},children:[s.jsx(Wi,{iframeUrl:i}),s.jsx(Mi,{name:f}),s.jsx(rs,{versionId:t,playableId:n,typeOfProduct:r,api:o,copyLinkUrl:A,setSafariCopyLink:d,qrUrl:i,iosLink:u,androidLink:l,urlType:m})]})};var qe=(e=>(e.Flex="#7101FF",e.Playable="#F9830B",e.Import="#00a3ff",e.Ready="#0060A5",e))(qe||{});const Xo=({checked:e,typeOfProduct:t,id:n})=>{const[r,o]=C.useState(e);C.useEffect(()=>{o(e)},[e]);const i=()=>{o(!r)};return s.jsx("div",{style:{display:"inline-flex",alignItems:"center"},children:s.jsxs("label",{onClick:i,style:{position:"relative",display:"flex",cursor:"pointer",alignItems:"center"},htmlFor:n,children:[s.jsx("input",{type:"checkbox",style:{position:"relative",height:"20px",width:"20px",cursor:"pointer",appearance:"none",borderRadius:"0.25rem",transition:"all ease-in-out",border:"1px solid lightgray",opacity:1},id:n,checked:r,onChange:i}),s.jsxs("div",{style:{pointerEvents:"none",position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",color:"white",opacity:r?1:0,transition:"opacity ease-in-out"},children:[s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",style:{height:"14px",width:"14px"},viewBox:"0 0 20 20",fill:qe[t],stroke:qe[t],strokeWidth:"1",children:s.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"})})," "]})]})})},is=({typeOfProduct:e,allNetworksSelected:t,setAllNetworksSelected:n})=>s.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",marginBottom:"0.5rem"},children:[s.jsxs("div",{style:{fontSize:"2xl",fontWeight:"bold",display:"flex"},children:[s.jsx("span",{style:{color:qe[e]},children:"Select Network"}),s.jsx("span",{style:{whiteSpace:"pre"},children:" From List"})]}),s.jsxs("div",{onClick:()=>{n(!t)},style:{marginLeft:"auto",marginRight:"2rem",display:"flex",height:"24px",alignItems:"center",justifyContent:"flex-end",fontSize:"0.875rem",width:110},children:[s.jsx(Xo,{checked:t,typeOfProduct:e,id:"asd"}),s.jsx("span",{style:{marginLeft:"0.5rem",fontSize:"16px",fontWeight:"bold"},children:"Select All"})]})]});async function as(e,t){return(await ge.post(t+"/buyRequest",{requestType:e})).data}const As=()=>s.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[s.jsxs("g",{"clip-path":"url(#clip0_518_12094)",children:[s.jsx("path",{d:"M4.50977 11.99L19.4898 11.99",stroke:"#7101FF","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}),s.jsx("path",{d:"M13.5068 17.977L19.4828 12L13.5068 6.02299",stroke:"#7101FF","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})]}),s.jsx("defs",{children:s.jsx("clipPath",{id:"clip0_518_12094",children:s.jsx("rect",{width:"24",height:"24",fill:"white",transform:"translate(0 24) rotate(-90)"})})})]}),ss=({creditDownload:e,api:t})=>s.jsxs(s.Fragment,{children:[s.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."}),s.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"," ",s.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.",s.jsxs("button",{style:{marginLeft:"0.5rem",display:"flex",alignItems:"center",fontSize:"12px",fontWeight:"bold",textDecoration:"underline",color:"#yourColorHere"},onClick:()=>as("Flex Credit",t).then(n=>mt("You will be contacted regarding your request.")),children:["Get more",s.jsx(As,{})]})]})]}),Qo=({typeOfProduct:e,urls:t,handleIosChange:n,handleGoogleChange:r,disabled:o})=>{const i=A=>{n(A.target.value)},a=A=>{r(A.target.value)};return s.jsxs(s.Fragment,{children:[s.jsxs("div",{style:{display:"flex",height:"2rem",width:"100%",alignItems:"center",fontSize:"12px",fontWeight:"200"},children:[s.jsx("span",{style:{width:"5rem",fontWeight:"bold",flexShrink:0},children:"App Store:"}),s.jsx("input",{style:{marginLeft:"1.25rem",display:"flex",height:"100%",width:"100%",alignItems:"center",borderRadius:"0.375rem",border:t.iosUrl?"1px solid lightgray":"1px solid red",paddingLeft:"0.5rem",color:"#000000",borderColor:qe[e],marginRight:"2rem"},type:"text",value:t.iosUrl,onChange:i,placeholder:"Ios Url",disabled:o})]}),s.jsxs("div",{style:{marginTop:"0.5rem",display:"flex",height:"2rem",width:"100%",alignItems:"center",fontSize:"12px",fontWeight:"100"},children:[s.jsxs("span",{style:{width:"5rem",fontWeight:"bold",flexShrink:0},children:["Google Play:"," "]}),s.jsx("input",{style:{marginLeft:"1.25rem",display:"flex",height:"100%",width:"100%",alignItems:"center",borderRadius:"0.375rem",border:t.googleUrl?"1px solid lightgray":"1px solid red",paddingLeft:"0.5rem",color:"#000000",borderColor:qe[e],marginRight:"2rem"},type:"text",value:t.googleUrl,onChange:a,placeholder:"Google Url",disabled:o})]})]})},ls=({typeOfProduct:e,urls:t,handleIosChange:n,handleGoogleChange:r,disabled:o})=>{const i=a=>{n(a.target.value)};return s.jsx(s.Fragment,{children:s.jsxs("div",{style:{display:"flex",height:"2rem",width:"100%",alignItems:"center",fontSize:"12px",fontWeight:"200"},children:[s.jsx("span",{style:{width:"5rem",fontWeight:"bold",flexShrink:0},children:"Redirection URL:"}),s.jsx("input",{style:{marginLeft:"1.25rem",display:"flex",height:"100%",width:"100%",alignItems:"center",borderRadius:"0.375rem",border:t.iosUrl?"1px solid lightgray":"1px solid red",paddingLeft:"0.5rem",color:"#000000",borderColor:qe[e],marginRight:"2rem"},type:"text",value:t.iosUrl,onChange:i,placeholder:"Ios Url",disabled:o})]})})},us=({typeOfProduct:e,fileSize:t,urls:n,handleIosChange:r,handleGoogleChange:o,disabled:i,api:a,creditDownload:A,user:d,isTest:u,setIsTest:l,urlType:m,setUrlType:v})=>{const g=()=>s.jsxs("div",{style:{display:"flex",height:"24px",width:"100%",alignItems:"center",fontSize:"12px",fontWeight:"100"},children:[s.jsxs("span",{style:{width:"5rem",fontWeight:"bold"},children:["Enable Test:"," "]}),s.jsx("input",{style:{marginLeft:"1.25rem",display:"flex",height:"100%",width:"20px",alignItems:"center",borderRadius:"0.375rem",border:n.googleUrl?"1px solid lightgray":"1px solid red",paddingLeft:"0.5rem",color:"#000000",borderColor:qe[e]},type:"checkbox",checked:u,onChange:()=>{l(!u)},placeholder:"Google Url",disabled:i})]}),f=()=>s.jsx(s.Fragment,{children:s.jsxs("div",{style:{display:"flex",width:"400px",height:"30px",flexDirection:"row",justifyContent:"space-between",alignItems:"center",borderBottom:"1px solid #eaeaec",marginBottom:"10px",position:"relative"},className:"tab-switch",children:[s.jsx("div",{style:{position:"absolute",bottom:"-3px",left:m==="single"?"50%":"0%",width:"50%",height:"3px",borderRadius:"2px",backgroundColor:"#12a9fe",transition:"all 0.2s ease-in-out"},id:"tab-switch-background"}),s.jsx("div",{style:{width:"50%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer",position:"relative"},onClick:()=>{document.getElementById("tab-switch-background").style.left="0%",document.getElementById("single-tab").style.color="#a3a3a3",document.getElementById("game-tab").style.color="#000",document.getElementById("single-tab").style.fontWeight="normal",document.getElementById("game-tab").style.fontWeight="bold",setTimeout(()=>{v("game")},200)},children:s.jsx("span",{style:{position:"relative",color:m==="game"?"#000":"#a3a3a3",fontWeight:m==="game"?"bold":"normal",transition:"all 0.2s ease-in-out"},id:"game-tab",children:"App"})},"gameTab"),s.jsx("div",{style:{width:"50%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer",position:"relative"},onClick:()=>{document.getElementById("tab-switch-background").style.left="50%",document.getElementById("single-tab").style.color="#000",document.getElementById("game-tab").style.color="#a3a3a3",document.getElementById("single-tab").style.fontWeight="bold",document.getElementById("game-tab").style.fontWeight="normal",setTimeout(()=>{v("single")},200)},children:s.jsx("span",{style:{position:"relative",color:m==="single"?"#000":"#a3a3a3",fontWeight:m==="single"?"bold":"normal",transition:"all 0.2s ease-in-out"},id:"single-tab",children:"Website"})},"singleTab")]})});return s.jsx(s.Fragment,{children:e!=="Import"&&s.jsxs("div",{style:{display:"flex",width:"100%",flexDirection:"column"},children:[d.customer=="playableFactoryInternal"&&e==="Playable"&&s.jsx(g,{}),e==="Ready"?s.jsxs(s.Fragment,{children:[s.jsx(f,{}),m==="game"&&s.jsx(Qo,{typeOfProduct:e,urls:n,handleIosChange:r,handleGoogleChange:o,disabled:i}),m==="single"&&s.jsx(ls,{typeOfProduct:e,urls:n,handleIosChange:r,handleGoogleChange:o,disabled:i})]}):s.jsx(s.Fragment,{children:s.jsx(Qo,{typeOfProduct:e,urls:n,handleIosChange:r,handleGoogleChange:o,disabled:i})}),(A==null?void 0:A.willSpendCredit)&&s.jsx(ss,{creditDownload:A,api:a})]})})},cs=({typeOfProduct:e,title:t,fileSize:n})=>s.jsxs("div",{style:{fontSize:"1.5rem",fontWeight:"bold",paddingTop:"20px"},children:[s.jsx("span",{style:{color:qe[e]},children:t}),n&&s.jsxs("span",{style:{fontSize:"14px",fontWeight:"bold",marginLeft:"30px",color:"#87878E"},children:["File size: ",parseFloat(n).toFixed(2)," mb"]})]}),ds=({typeOfProduct:e,fileSize:t,urls:n,title:r,handleIosChange:o,handleGoogleChange:i,disabled:a,creditDownload:A,api:d,user:u,isTest:l,setIsTest:m,urlType:v,setUrlType:g,allNetworksSelected:f,setAllNetworksSelected:p})=>s.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",justifyContent:"space-between",alignItems:"flex-start",borderBottom:"1px solid #D1D5DB",paddingLeft:"1.25rem",paddingRight:"1.25rem",gap:"0.5rem"},children:[s.jsx(cs,{typeOfProduct:e,title:r,fileSize:t}),s.jsx(us,{typeOfProduct:e,fileSize:t,urls:n,handleIosChange:o,handleGoogleChange:i,disabled:a,creditDownload:A,api:d,user:u,isTest:l,setIsTest:m,urlType:v,setUrlType:g}),s.jsx(is,{typeOfProduct:e,allNetworksSelected:f,setAllNetworksSelected:p})]}),rr=({children:e,className:t,onClickDonwload:n,downloading:r,disabled:o})=>s.jsx("button",{onClick:n,className:t,style:{display:"flex",height:"40px",alignItems:"center",justifyContent:"center",borderRadius:"0.375rem",border:"1px solid lightgray",padding:"0.25rem",fontSize:"0.875rem",width:200,backgroundColor:"#FFFFFF"},disabled:r||o,children:e}),gu="",ms=({typeOfProduct:e})=>s.jsx("div",{style:{backgroundColor:"transparent",display:"flex",alignItems:"center",flexDirection:"column"},children:s.jsxs("div",{style:{position:"relative",width:"64px",height:"16px",marginTop:"8px"},children:[s.jsx("div",{style:{position:"absolute",top:0,width:"8px",height:"8px",borderRadius:"50%",backgroundColor:qe[e]}}),s.jsx("div",{style:{position:"absolute",top:0,width:"8px",height:"8px",borderRadius:"50%",backgroundColor:qe[e]}}),s.jsx("div",{style:{position:"absolute",top:0,width:"8px",height:"8px",borderRadius:"50%",backgroundColor:qe[e]}}),s.jsx("div",{style:{position:"absolute",top:0,width:"8px",height:"8px",borderRadius:"50%",backgroundColor:qe[e]}})]})}),Lt=({isNetworksLoading:e=!1})=>s.jsx("div",{style:{display:"flex",height:"100%",width:"90px",alignItems:"center",justifyContent:"center"},children:s.jsx("img",{width:e?"100px":"25px",height:e?"100px":"25px",src:Xe,alt:"pf-logo-gif"})}),or=({title:e,titleId:t,...n})=>s.jsxs("svg",{viewBox:"0 0 25 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em","aria-labelledby":t,...n,children:[e?s.jsx("title",{id:t,children:e}):null,s.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"})]}),ps=({onClose:e,iosLink:t,googleLink:n,buttonType:r,handleCopyLink:o,download:i,typeOfProduct:a,urlType:A})=>{let d="";return a==="Ready"&&A==="single"?d="Redirection url is empty. Are you sure you want to continue?":!t&&!n?d="Both links are empty. Are you sure you want to continue?":t?n||(d="Google link is empty. Are you sure you want to continue?"):d="iOS link is empty. Are you sure you want to continue?",s.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:[s.jsx("div",{onClick:e,style:{position:"absolute",zIndex:30,height:"100%",width:"100%",pointerEvents:"none"}}),s.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:[s.jsx("h1",{style:{textAlign:"center",fontSize:"18px",lineHeight:"24px"},children:d}),s.jsxs("div",{style:{display:"flex",gap:"5px"},children:[s.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:"No"}),s.jsx("button",{onClick:async u=>{r==="download"?await i():r==="copyLink"&&await o(),e()},style:{flex:1,cursor:"pointer",borderRadius:"0.375rem",border:"1px solid red",backgroundColor:"darkorange",padding:"0.5rem",fontWeight:"bold",color:"white",transition:"all 0.15s ease-linear"},children:"Yes"})]})]})]})},Po=({onClose:e,handleCopyLink:t,download:n,creditConfirmType:r,getDownloadCount:o})=>s.jsxs("div",{style:{position:"fixed",top:0,left:0,zIndex:50,display:"flex",height:"120%",width:"130%",alignItems:"center",justifyContent:"center",backgroundColor:"#00000080"},children:[s.jsx("div",{onClick:e,style:{position:"absolute",zIndex:30,height:"100%",width:"100%"}}),s.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:[s.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?"}),s.jsxs("div",{style:{display:"flex",gap:"5px"},children:[s.jsx("button",{onClick:e,style:{flex:1,cursor:"pointer",borderRadius:"4px",borderWidth:"1px",borderColor:"dark-50",padding:"2px",fontWeight:"bold"},children:"No"}),s.jsx("button",{style:{flex:1,cursor:"pointer",borderRadius:"4px",borderWidth:"1px",borderColor:"#F9830B",backgroundColor:"#F9830B",padding:"2px",fontWeight:"bold",color:"white"},onClick:async i=>{i.preventDefault(),i.stopPropagation(),r==="download"?(await n(),await o()):r==="copy"&&(await t(),await o()),e()},children:"Yes"})]})]})]}),fs=({onClose:e,handleDownload:t,handleDownloadMolocoTest:n,downloadingMoloco:r,downloadingMolocoTest:o,downloadingMolocoHtml:i})=>s.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:[s.jsx("div",{onClick:e,style:{position:"absolute",zIndex:30,height:"100%",width:"100%",pointerEvents:"none"}}),s.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:s.jsxs("div",{style:{display:"flex",gap:"5px",flexDirection:"column"},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"center"},children:[r?s.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer",borderRadius:"0.375rem",border:"1px solid darkorange",backgroundColor:"darkorange",color:"white",transition:"all 0.15s ease-linear",width:"200px",marginRight:"10px"},children:s.jsx("img",{width:"25px",height:"25px",src:Xe,alt:"pf-logo-gif"})}):s.jsx("button",{onClick:()=>{t(!1)},style:{cursor:"pointer",borderRadius:"0.375rem",border:"1px solid darkorange",backgroundColor:"darkorange",color:"white",transition:"all 0.15s ease-linear",width:"200px",marginRight:"10px"},children:"Download"}),i?s.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer",borderRadius:"0.375rem",border:"1px solid darkorange",backgroundColor:"darkorange",color:"white",transition:"all 0.15s ease-linear",width:"200px",marginLeft:"10px"},children:s.jsx("img",{width:"25px",height:"25px",src:Xe,alt:"pf-logo-gif"})}):s.jsx("button",{onClick:()=>{t(!0)},style:{cursor:"pointer",borderRadius:"0.375rem",border:"1px solid darkorange",backgroundColor:"darkorange",color:"white",transition:"all 0.15s ease-linear",width:"200px",marginLeft:"10px"},children:"Download HTML"})]}),s.jsx("div",{style:{display:"flex",justifyContent:"center"},children:o?s.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer",borderRadius:"0.375rem",border:"1px solid darkorange",backgroundColor:"darkorange",color:"white",transition:"all 0.15s ease-linear",width:"200px"},children:s.jsx("img",{width:"25px",height:"25px",src:Xe,alt:"pf-logo-gif"})}):s.jsx("button",{onClick:n,style:{cursor:"pointer",borderRadius:"0.375rem",border:"1px solid darkorange",backgroundColor:"darkorange",color:"white",transition:"all 0.15s ease-linear",width:"200px"},children:"Download Moloco Test"})})]})})]});async function hs(e,t,n,r){return(await ge.post(e+"/createMolocoTestPage",{_id:t,network:n,typeOfProduct:r})).data}const gs=({title:e,titleId:t})=>s.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:[s.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"}),s.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"})]}),qs=({onClose:e,versionId:t,urls:n,handleDownloadError:r})=>{const[o,i]=C.useState(""),[a,A]=C.useState(!1);C.useEffect(()=>{o||ns(t).then(u=>{console.log(u),u.exist&&i(u.uploadPath)})},[o]);const d=async()=>{A(!0),Mt(t,"cdn",n,null,!1,{}).then(u=>{const l=u.url.replace("playablefactory.b-cdn.net","resources.playablefactory.app");i(l),A(!1)}).catch(u=>{r(u.message,u),e(),A(!1)})};return s.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:[s.jsx("div",{onClick:e,style:{position:"absolute",zIndex:30,height:"100%",width:"100%",pointerEvents:"none"}}),s.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:u=>{u.stopPropagation()},children:s.jsxs("div",{style:{display:"flex",gap:"5px",flexDirection:"column"},children:[s.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||d()},children:["Update Link",a&&s.jsx("img",{width:"30px",src:Xe,alt:"pf-logo-gif"})]}),s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:"#f6f6f6",height:"60px",color:"#737373"},children:[s.jsx("div",{style:{width:"66px",height:"100%",borderRight:"1px solid #e1e1e1",display:"flex",justifyContent:"center",alignItems:"center",flexShrink:0},children:s.jsx(gs,{})}),s.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",position:"relative",maxWidth:"68%"},children:s.jsx("a",{style:{textAlign:"center",overflow:"hidden",textOverflow:"ellipsis"},href:o,target:"_blank",children:o||"No CDN link generated"})}),s.jsx("button",{onClick:()=>{if(!o)return;xt(o)&&mt("Link copied")},style:{cursor:"pointer",borderRadius:"0.375rem",backgroundColor:o?"darkorange":"lightgray",color:"white",transition:"all 0.15s ease-linear",width:"100px",height:"46px",marginRight:"10px",flexShrink:0},children:"Copy"})]})]})})]})},ys=({id:e,imageUrl:t,handleCardClick:n,selected:r,name:o,networkVersionSize:i,fileSizeLoading:a,showCheckBox:A,typeOfProduct:d,versionId:u,api:l,handleDownloadError:m,fetchFileUrl:v,urls:g,game:f,setIsConfirmActive:p,creditDownload:y,getDownloadCount:w,disabled:j,user:M,setSafariCopyLink:E,isTest:b,urlType:T})=>{const[X,F]=C.useState(!1),[le,te]=C.useState(""),[Ae,Q]=C.useState(!1),[_,S]=C.useState(!1),[J,N]=C.useState(!1),[h,z]=C.useState(!1),[D,Z]=C.useState("download"),[I,L]=C.useState(!1),[Y,O]=C.useState(!1),[$,K]=C.useState(!1);let R={aarki:"html,copy",adcolony:"copy,html",adjoe:"copy,html",applovin:"copy,html",appreciate:"zip",chartboost:"copy,html",criteo:"zip",crossinstall:"copy,html",default:"copy",fb:"zip",fyber:"copy,html",google:"zip",google360:"zip",ironsource:"copy,html",kayzen:"apikey",kaden:"html",kidoz:"html",lifestreet:"copy,html",liftoff:"copy,zip",mobvista:"html",moloco:"html,molocotest",molocoV2:"html,molocotest",nucleo:"copy,html",oceanengine:"copy,zip",pointblank:"html",smadex:"zip",snapchat:"zip",tapjoy:"copy,html",tencent:"zip",toutiao:"copy,zip",toutiao_cn:"copy,zip",unity:"copy,html",vungle:"html",web:"copy,html",yandex:"zip",zucks:"copy,html",luna:"zip",inmobi:"copy,html,",nend:"html",adikteev:"html",jammp:"copy,html",mraid:"copy,html"};const P=()=>{n(e)},V=async(ee,ue)=>{const de={molocoGenerateHtml:!1,urlType:T};return W&&(ue==="copy"?(O(!0),ue="download",de.molocoGenerateHtml=!0):L(!0)),console.log("getVersion",ee,ue,de),F(!0),new Promise((lt,fn)=>{Mt(u,ee,g,ue,b,de).then(_e=>{F(!1),lt(_e),O(!1),L(!1)}).catch(_e=>{F(!1),m(_e.message,_e),fn(_e),O(!1),L(!1)})})},B=async(ee=!1)=>{console.log("handleMolocoDownload",ee),ee?O(!0):L(!0);const ue={molocoGenerateHtml:!1};ee&&(ue.molocoGenerateHtml=!0),Mt(u,o,g,"download",b,ue).then(de=>{ee?O(!1):L(!1),N(!1)}).catch(de=>{m(de.message,de)})},se=async()=>{K(!0);const ee=await hs(l,u,o,d);let ue=`${v}/${ee==null?void 0:ee.url}`;xt(ue)?(mt("Link Copied"),K(!1)):E(ue)},W=o==="moloco"||o==="molocoV2";return s.jsxs(s.Fragment,{children:[s.jsxs("div",{style:{position:"relative",display:"flex",flexDirection:"column",gap:"20px",padding:"16px",borderColor:r?qe[d]:"lightgray",borderWidth:"1px",borderStyle:"solid",backgroundColor:"white",width:"100%",height:"175px",borderRadius:"8px",cursor:"pointer"},className:"border-hover-"+d,onClick:P,children:[s.jsxs("div",{style:{marginTop:o=="web"?"10px":"40px",display:"flex",justifyContent:"center"},children:[s.jsx("div",{style:{position:"absolute",right:"0",top:"0",padding:"8px"},children:s.jsx("div",{children:i&&i.map(ee=>ee.network).includes(o)?a?s.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:s.jsx(ms,{typeOfProduct:d})}):i.map(ee=>s.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:ee.network===o?ee.size.toString().slice(0,5)+"Mb":""},ee.network)):null})}),s.jsx("div",{style:{position:"absolute",top:"0",left:"0",padding:"0.5rem"},children:(d==="Playable"||d==="Ready"||d==="Flex")&&A&&s.jsx(Xo,{checked:r,typeOfProduct:d,id:e})}),s.jsx("img",{onClick:P,style:{width:"30rem",height:o=="web"?"80px":"50px",objectFit:"contain"},src:t})]}),s.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"0.25rem"},children:[s.jsx(rr,{className:`${W?"w-1/2":"w-2/3"} border-hover-`+d,downloading:X,onClickDonwload:async ee=>{if(ee.stopPropagation(),o==="cdn")z(!0);else if(W&&M.customer==="playableFactoryInternal"){N(!0);return}else{te("download");const ue=g.iosUrl,de=g.googleUrl;y&&y.willSpendCredit?(p(!0),Z("download"),Q(!0)):["Playable","Flex"].includes(d)&&(!ue||!de)||d==="Ready"&&T==="single"&&!ue||d==="Ready"&&T==="multi"&&(!ue||!de)?(p(!0),S(!0)):(S(!1),Q(!1),await V(o,"download"))}},children:W?s.jsxs(s.Fragment,{children:[!I&&s.jsxs(s.Fragment,{children:[s.jsx(or,{style:{marginRight:"0.5rem",height:"1.5rem",width:"1rem",stroke:"dark-full"}}),M.customer!=="playableFactoryInternal"?"TXT":"Download"]}),I&&s.jsx(Lt,{})]}):s.jsxs(s.Fragment,{children:[!X&&s.jsxs(s.Fragment,{children:[s.jsx(or,{style:{marginRight:"0.5rem",height:"1.5rem",width:"1rem",stroke:"dark-full"}}),"Download"]}),X&&s.jsx(Lt,{})]})}),R[o]&&R[o].includes("copy")&&s.jsx(rr,{className:"w-1/3 border-hover-"+d,onClickDonwload:async ee=>{ee.stopPropagation(),te("copyLink");const ue=g.iosUrl,de=g.googleUrl;y&&(y!=null&&y.willSpendCredit)?(Z("copy"),p(!0),Q(!0)):d!=="Import"&&(!ue||!de)?(p(!0),S(!0)):(Q(!1),S(!1),await V(o,"copy"))},disabled:j,children:s.jsx(Qr,{className:"h-6 w-6 stroke-dark-full"})}),W&&M.customer!=="playableFactoryInternal"&&s.jsxs(rr,{className:"w-1/2 border-hover-"+d,onClickDonwload:async ee=>{ee.stopPropagation(),te("copyLink");const ue=g.iosUrl,de=g.googleUrl;y&&(y!=null&&y.willSpendCredit)?(Z("download"),p(!0),Q(!0)):d!=="Import"&&(!ue||!de)?(p(!0),S(!0)):(Q(!1),S(!1),await B(!0))},disabled:j,children:[!Y&&s.jsxs(s.Fragment,{children:[s.jsx(or,{style:{marginRight:"0.5rem",height:"1.5rem",width:"1rem",stroke:"dark-full"}}),"HTML"]}),Y&&s.jsx(Lt,{})]})]}),W&&s.jsx("img",{style:{position:"absolute",width:"135px",right:"0",top:"18px"},src:"https://home.playablefactory.app/recommended_badge.png"})]}),Ae&&s.jsx(Po,{creditConfirmType:D,handleCopyLink:async()=>{S(!1),p(!1),await V(o,"copy")},download:async()=>{S(!1),p(!1),await V(o,"download")},onClose:()=>{Q(!1),p(!1)},getDownloadCount:w}),_&&s.jsx(ps,{onClose:()=>{S(!1),p(!1)},iosLink:g.iosUrl,googleLink:g.googleUrl,buttonType:le,handleCopyLink:async()=>{S(!1),p(!1),await V(o,"copy")},download:async()=>{S(!1),p(!1),await V(o,"download")},typeOfProduct:d,urlType:T}),J&&M.customer==="playableFactoryInternal"&&s.jsx(fs,{onClose:()=>{N(!1)},handleDownload:B,handleDownloadMolocoTest:se,downloadingMoloco:I,donwloadintMolocoTest:$,downloadingMolocoHtml:Y}),h&&s.jsx(qs,{onClose:()=>{z(!1)},versionId:u,urls:g,handleDownloadError:m})]})},ln=[{id:"22",name:"moloco",imageSrc:"https://home.playablefactory.com/moloco.png"},{id:"44",name:"molocoV2",imageSrc:"https://home.playablefactory.com/molocoV2.png"},{id:"33",name:"web",imageSrc:"https://home.playablefactory.com/files/network_icons/web.png"},{id:"1",name:"unity",imageSrc:"https://home.playablefactory.com/unity.png"},{id:"2",name:"applovin",imageSrc:"https://home.playablefactory.com/applovin.png"},{id:"3",name:"ironsource",imageSrc:"https://home.playablefactory.com/ironsource.png"},{id:"4",name:"vungle",imageSrc:"https://home.playablefactory.com/vungle.png"},{id:"5",name:"mobvista",imageSrc:"https://home.playablefactory.com/mobvista.png"},{id:"6",name:"fb",imageSrc:"https://home.playablefactory.com/fb.png"},{id:"7",name:"toutiao",imageSrc:"https://home.playablefactory.com/toutiao.png"},{id:"8",name:"toutiao_cn",imageSrc:"https://home.playablefactory.com/toutiao_cn.png"},{id:"9",name:"adcolony",imageSrc:"https://home.playablefactory.com/adcolony.png"},{id:"10",name:"criteo",imageSrc:"https://home.playablefactory.com/criteo.png"},{id:"11",name:"chartboost",imageSrc:"https://home.playablefactory.com/chartboost.png"},{id:"12",name:"kayzen",imageSrc:"https://home.playablefactory.com/kayzen.png"},{id:"13",name:"crossinstall",imageSrc:"https://home.playablefactory.com/crossinstall.png"},{id:"14",name:"default",imageSrc:"https://home.playablefactory.com/default.png"},{id:"15",name:"fyber",imageSrc:"https://home.playablefactory.com/fyber.png"},{id:"16",name:"appreciate",imageSrc:"https://home.playablefactory.com/appreciate.png"},{id:"17",name:"google360",imageSrc:"https://home.playablefactory.com/google360.png"},{id:"18",name:"kaden",imageSrc:"https://home.playablefactory.com/kaden.png"},{id:"19",name:"kidoz",imageSrc:"https://home.playablefactory.com/kidoz.png"},{id:"20",name:"lifestreet",imageSrc:"https://home.playablefactory.com/lifestreet.png"},{id:"21",name:"liftoff",imageSrc:"https://home.playablefactory.com/liftoff.png"},{id:"23",name:"nucleo",imageSrc:"https://home.playablefactory.com/nucleo.png"},{id:"24",name:"oceanengine",imageSrc:"https://home.playablefactory.com/oceanengine.png"},{id:"25",name:"pointblank",imageSrc:"https://home.playablefactory.com/pointblank.png"},{id:"26",name:"snapchat",imageSrc:"https://home.playablefactory.com/snapchat.png"},{id:"27",name:"tapjoy",imageSrc:"https://home.playablefactory.com/tapjoy.png"},{id:"28",name:"tencent",imageSrc:"https://home.playablefactory.com/tencent.png"},{id:"31",name:"aarki",imageSrc:"https://home.playablefactory.com/aarki.png"},{id:"32",name:"yandex",imageSrc:"https://home.playablefactory.com/yandex.png"},{id:"34",name:"zucks",imageSrc:"https://home.playablefactory.com/zucks.png"},{id:"35",name:"google",imageSrc:"https://home.playablefactory.com/google.png"},{id:"36",name:"inmobi",imageSrc:"https://home.playablefactory.com/inmobi.png"},{id:"38",name:"smadex",imageSrc:"https://home.playablefactory.com/smadex.png"},{id:"39",name:"instantGame",imageSrc:"https://home.playablefactory.com/instantGame.png"},{id:"40",name:"luna",imageSrc:"https://home.playablefactory.com/luna.png"},{id:"41",name:"nend",imageSrc:"https://home.playablefactory.com/nend.png"},{id:"42",name:"jammp",imageSrc:"https://home.playablefactory.com/nend.png"},{id:"43",name:"adjoe",imageSrc:"https://home.playablefactory.com/adjoe.png"},{id:"45",name:"adikteev",imageSrc:"https://home.playablefactory.com/adikteev.png"},{id:"46",name:"appier",imageSrc:"https://home.playablefactory.com/appier.png"},{id:"47",name:"remerge",imageSrc:"https://home.playablefactory.com/remerge.png"},{id:"48",name:"persona",imageSrc:"https://home.playablefactory.com/persona.png"},{id:"49",name:"bidease",imageSrc:"https://home.playablefactory.com/bidease.png"},{id:"50",name:"mraid",imageSrc:"https://home.playablefactory.com/mraid.png"},{id:"51",name:"zynga",imageSrc:"https://home.playablefactory.com/zynga.png"},{id:"52",name:"youappi",imageSrc:"https://home.playablefactory.com/youappi.png"},{id:"53",name:"cdn",imageSrc:"https://home.playablefactory.com/cdn.png"}],vs=({children:e,typeOfProduct:t,className:n,onClick:r})=>{const o={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"0.5rem",width:"12rem",height:"2.5rem",backgroundColor:qe[t],color:"white",fontSize:"0.875rem",borderRadius:"0.875rem"};return s.jsx("button",{onClick:r,className:n,style:o,children:e})},bs=({networksVersionTotalSize:e,typeOfProduct:t,onClickMultiDownload:n,multiDownloading:r})=>s.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"8px"},children:r?s.jsx("div",{style:{display:"flex",width:"12rem",height:"2.5rem",borderRadius:"0.875rem",alignItems:"center",justifyContent:"center",backgroundColor:qe[t]},children:s.jsx(Lt,{})}):s.jsx(vs,{typeOfProduct:t,onClick:n,children:s.jsx("span",{style:{fontSize:"1.25rem",padding:"0.5rem",color:"#fff"},children:"Download All"})})}),Cs=({playable:e,creditDownload:t,visible:n,versionId:r,typeOfProduct:o,api:i,user:a,handleDownloadError:A,fetchFileUrl:d,urls:u,game:l,getDownloadCount:m,disabled:v,setSafariCopyLink:g,isTest:f,urlType:p,allNetworksSelected:y,setAllNetworksSelected:w})=>{const[j,M]=C.useState([]),[E,b]=C.useState([]),[T,X]=C.useState(!1),[F,le]=C.useState(""),[te,Ae]=C.useState(!1),[Q,_]=C.useState(!1),[S,J]=C.useState("download"),[N,h]=C.useState(!1),z=async I=>{const L=[...j];if(j.includes(I)){const Y=L.findIndex(O=>O===I);L.splice(Y,1),M(L)}else L.push(I),M([...j,I]);ln.filter(Y=>[...L].includes(Y.id)).map(Y=>Y.name)},D=async()=>new Promise(async(I,L)=>{const Y=ln.filter(O=>[...j].includes(O.id)).map(O=>O.name);Ae(!0),es(r,u,Y,{urlType:p}).then(O=>{Ae(!1),I(O)}).catch(O=>{console.log("get multi download err"),Ae(!1),A(O.message,O),L(O)})}),Z=async()=>{u.iosUrl,u.googleUrl,t&&t.willSpendCredit?(_(!0),J("download"),h(!0)):(h(!1),await D())};return C.useEffect(()=>{const I=ln.filter(L=>{var Y;return t&&((Y=t==null?void 0:t.networks)==null?void 0:Y.length)>0?t==null?void 0:t.networks.includes(L.name):o==="Import"?e==null?void 0:e.networks.filter(O=>O.status==="paid").some(O=>O.name===L.name):e==null?void 0:e.networks.includes(L.name)}).filter(L=>L.name==="voodoo"?a.customer==="customer:20":!0).map(L=>L.id);M(y?I:[])},[y]),s.jsxs(s.Fragment,{children:[s.jsx("div",{style:{position:"relative",flex:1,overflowY:Q?"hidden":"auto",padding:"1.5rem",paddingTop:"0"},children:s.jsx("div",{style:{display:"grid",gridTemplateColumns:"180px 180px 180px",gap:"1rem",overflowY:"auto",padding:"0.75rem"},children:n&&ln.filter(I=>{var L;return t&&((L=t==null?void 0:t.networks)==null?void 0:L.length)>0?t==null?void 0:t.networks.includes(I.name):o==="Import"?e==null?void 0:e.networks.filter(Y=>Y.status==="paid").some(Y=>Y.name===I.name):e==null?void 0:e.networks.includes(I.name)}).filter(I=>I.name==="voodoo"?a.customer==="customer:20":!0).map(I=>{let L=I.imageSrc;if(I.name==="web"){let Y="web_"+o.toLowerCase()+".png";L=L.replace("web.png",Y)}return s.jsx(ys,{id:I.id,name:I.name,imageUrl:L,selected:j.includes(I.id),handleCardClick:z,networkVersionSize:E,fileSizeLoading:T,showCheckBox:!0,typeOfProduct:o,versionId:r,api:i,handleDownloadError:A,fetchFileUrl:d,urls:u,game:l,creditDownload:t,setIsConfirmActive:_,getDownloadCount:m,disabled:v,user:a,setSafariCopyLink:g,isTest:f,urlType:p},I.id)})})}),j.length>1&&(o==="Playable"||o==="Ready"||o==="Flex")&&s.jsx("div",{style:{position:"fixed",bottom:"0",left:"65%",zIndex:20,transform:"translateX(-50%)",display:"flex",flexDirection:"column",paddingTop:"5px"},children:s.jsx(bs,{onClickMultiDownload:Z,networksVersionTotalSize:F,typeOfProduct:o,multiDownloading:te})}),N&&s.jsx(Po,{creditConfirmType:S,handleCopyLink:async()=>{},download:async()=>{h(!1),_(!1),await D()},onClose:()=>{h(!1),_(!1)},getDownloadCount:m})]})};async function Zs(e,t){return(await ge.post(t+"/getFlexDownloadCount",e)).data}async function Is(e,t){try{return(await ge.post(t+"/findGame",{_id:e})).data}catch{}}async function ws(e,t){return(await ge.post(t+"/getPlayableVersionMarketLink",{_id:e})).data}async function xs(e,t){return(await ge.post(t+"/getFlexData",{_id:e})).data}async function Ks(e,t){return(await ge.post(t+"/getImportedPlayable",{id:e})).data}async function Ss(e,t){return(await ge.post(t+"/getReadyDownloadCount",e)).data}const Ws=["adcolony","ironsource","applovin","unity","mobvista","criteo","kayzen","vungle","moloco","inmobi"],Vo=["web","adcolony","applovin","chartboost","crossinstall","fb","google","ironsource","lifestreet","liftoff","mobvista","nucleo","tapjoy","toutiao","unity","vungle","moloco","cdn"];let Bo=null;const Ms=({playableId:e,versionId:t,gameId:n,typeOfProduct:r,visible:o,api:i,user:a,title:A,handleDownloadError:d,fetchFileUrl:u,fileSize:l,setFileSize:m,setSafariCopyLink:v,iosLink:g,androidLink:f,setIosLink:p,setAndroidLink:y,urlType:w,setUrlType:j})=>{const[M,E]=C.useState(null),[b,T]=C.useState(null),[X,F]=C.useState(null),[le,te]=C.useState(!1),[Ae,Q]=C.useState(!0),[_,S]=C.useState(window.innerWidth),[J,N]=C.useState(!1);console.log("download modal version: 6.0.22");const[h,z]=C.useState(!1);C.useEffect(()=>{},[h]),C.useEffect(()=>{const K=()=>{S(window.innerWidth)};return window.addEventListener("resize",K),()=>{window.removeEventListener("resize",K)}},[]);const D=async()=>{te(!0);const K=await nr(e,i);return K!=null&&K.networks||(K.networks=Ws),E(K),K},Z=(K,R)=>{clearTimeout(Bo),Bo=setTimeout(()=>{console.log("Update URLS:"),tr(t,{iosUrl:K,googleUrl:R},{urlType:w})},1e3)},I=K=>{p(K),Z(K,f)},L=K=>{y(K),Z(g,K)},Y=async(K,R)=>{var P,V;console.log("getIosAndAndroidLink");try{let B;if(r==="Playable"||r==="Ready"){const se=await ws(t,i);if(se){console.log("version",se),p(se.iosLink),y(se.androidLink),te(!1);return}if(K&&(K.iosUrl||K.googleUrl)){p(K.iosUrl),y(K.googleUrl),te(!1);return}if(R&&R.html){let W=await fetch(u+"/"+R.html).then(de=>de.text());const ee=((P=W.match(/var\s+iosLink\s*=\s*['|"](https?[\w\d;,/?:@&=+$\-_.!~*'()#]+)['|"]/))==null?void 0:P.at(1))||"";p(ee);const ue=((V=W.match(/var\s+androidLink\s*=\s*['|"](https?[\w\d;,/?:@&=+$\-_.!~*'()#]+)['|"]/))==null?void 0:V.at(1))||"";y(ue),te(!1)}else y(""),p(""),te(!1)}else if(r==="Flex"){const se=await xs(t,i);if(se.googleUrl||se.iosUrl){y(se.googleUrl),p(se.iosUrl),te(!1);return}K&&(K.iosUrl||K.googleUrl)?(p(K.iosUrl),y(K.googleUrl),te(!1)):(y(""),p(""),te(!1))}}catch(B){d(B.response.data.error.msg)}},O=async()=>{te(!0);let K;r==="Flex"?K=await Zs({_id:t},i):r==="Ready"&&(K=await Ss({_id:t},i)),K&&(["admin","pm","tester","sales"].includes(a.role)?F({...K,networks:Vo}):r==="Ready"&&!K.canDownload?F({...K,networks:Vo}):F(K)),te(!1)},$=async()=>await Is(n,i);return C.useEffect(()=>{o||(E(null),T(null),F(null),m(null)),o&&(r==="Playable"?(D().then(K=>{Y(null,K)}),Q(!1)):r==="Ready"?O().then(K=>{D().then(R=>{Y(null,R),Q(!1)})}):r==="Flex"?O().then(K=>{Q(!1),$().then(R=>{o&&(Y(R,null),Q(!1),T(R))})}):r==="Import"&&Ks(t,i).then(K=>{console.log(K),E(K),p(K.iosUrl||""),y(K.googleUrl||""),te(!1),Q(!1)}))},[n,e,t,o]),s.jsxs("div",{style:{display:"flex",height:_>1440?"700px":"650px",width:_>1440?"675px":"680px",flexDirection:"column",borderRadius:"rounded",backgroundColor:"#F7F7F8",paddingTop:"0px"},children:[s.jsx(ds,{title:A,typeOfProduct:r,fileSize:l,urls:{iosUrl:g,googleUrl:f},handleIosChange:I,handleGoogleChange:L,disabled:Ae,api:i,creditDownload:X,user:a,isTest:J,setIsTest:N,urlType:w,setUrlType:j,allNetworksSelected:h,setAllNetworksSelected:z}),le?s.jsx("div",{style:{height:"100%",width:"100%",display:"flex",justifyContent:"center"},children:s.jsx(Lt,{isNetworksLoading:!0})}):(M||X)&&(r==="Flex"?b:!0)&&!le&&g!=="Loading..."&&f!=="Loading..."&&s.jsx(Cs,{playable:M,creditDownload:X,visible:o,versionId:t,typeOfProduct:r,api:i,user:a,handleDownloadError:d,fetchFileUrl:u,urls:{iosUrl:g,googleUrl:f},game:b,getDownloadCount:O,disabled:Ae,setSafariCopyLink:v,isTest:J,urlType:w,allNetworksSelected:h,setAllNetworksSelected:z})]})},qu="";var ir={exports:{}},rt={},ar={exports:{}},Ye={},Ar={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=l;/*!
57
57
  * Adapted from jQuery UI core
58
58
  *
59
59
  * http://jqueryui.com