@msquared/pixel-streaming-client
Version:
Browser client for viewing pixel-streamed content from MSquared events
14 lines (12 loc) • 40 kB
JavaScript
;var MSquaredPixelStreamingClient=(()=>{var Ct=Object.create;var re=Object.defineProperty,Nt=Object.defineProperties,Ot=Object.getOwnPropertyDescriptor,Pt=Object.getOwnPropertyDescriptors,Ut=Object.getOwnPropertyNames,pe=Object.getOwnPropertySymbols,At=Object.getPrototypeOf,Ne=Object.prototype.hasOwnProperty,et=Object.prototype.propertyIsEnumerable;var M=Math.pow,Ce=(o,e,t)=>e in o?re(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,U=(o,e)=>{for(var t in e||(e={}))Ne.call(e,t)&&Ce(o,t,e[t]);if(pe)for(var t of pe(e))et.call(e,t)&&Ce(o,t,e[t]);return o},q=(o,e)=>Nt(o,Pt(e));var Rt=(o=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(o,{get:(e,t)=>(typeof require!="undefined"?require:e)[t]}):o)(function(o){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+o+'" is not supported')});var tt=(o,e)=>{var t={};for(var a in o)Ne.call(o,a)&&e.indexOf(a)<0&&(t[a]=o[a]);if(o!=null&&pe)for(var a of pe(o))e.indexOf(a)<0&&et.call(o,a)&&(t[a]=o[a]);return t};var Lt=(o,e)=>()=>(e||o((e={exports:{}}).exports,e),e.exports),_t=(o,e)=>{for(var t in e)re(o,t,{get:e[t],enumerable:!0})},rt=(o,e,t,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of Ut(e))!Ne.call(o,l)&&l!==t&&re(o,l,{get:()=>e[l],enumerable:!(a=Ot(e,l))||a.enumerable});return o};var Gt=(o,e,t)=>(t=o!=null?Ct(At(o)):{},rt(e||!o||!o.__esModule?re(t,"default",{value:o,enumerable:!0}):t,o)),Vt=o=>rt(re({},"__esModule",{value:!0}),o);var T=(o,e,t)=>Ce(o,typeof e!="symbol"?e+"":e,t);var N=(o,e,t)=>new Promise((a,l)=>{var c=b=>{try{g(t.next(b))}catch(w){l(w)}},p=b=>{try{g(t.throw(b))}catch(w){l(w)}},g=b=>b.done?a(b.value):Promise.resolve(b.value).then(c,p);g((t=t.apply(o,e)).next())});var ot=Lt((ie,be)=>{(function(o,e){"use strict";var t="1.0.41",a="",l="?",c="function",p="undefined",g="object",b="string",w="major",n="model",s="name",r="type",i="vendor",d="version",E="architecture",k="console",u="mobile",m="tablet",I="smarttv",C="wearable",F="embedded",A=500,D="Amazon",_="Apple",Z="ASUS",z="BlackBerry",oe="Browser",se="Chrome",xt="Edge",ae="Firefox",ce="Google",qe="Honor",je="Huawei",Et="Lenovo",de="LG",ve="Microsoft",Se="Motorola",ye="Nvidia",Be="OnePlus",X="Opera",xe="OPPO",Y="Samsung",We="Sharp",Q="Sony",Ee="Xiaomi",ke="Zebra",Ke="Facebook",He="Chromium OS",$e="Mac OS",Ze=" Browser",kt=function(v,S){var h={};for(var x in v)S[x]&&S[x].length%2===0?h[x]=S[x].concat(v[x]):h[x]=v[x];return h},le=function(v){for(var S={},h=0;h<v.length;h++)S[v[h].toUpperCase()]=v[h];return S},Xe=function(v,S){return typeof v===b?J(S).indexOf(J(v))!==-1:!1},J=function(v){return v.toLowerCase()},It=function(v){return typeof v===b?v.replace(/[^\d\.]/g,a).split(".")[0]:e},Ie=function(v,S){if(typeof v===b)return v=v.replace(/^\s\s*/,a),typeof S===p?v:v.substring(0,A)},ee=function(v,S){for(var h=0,x,G,R,y,f,L;h<S.length&&!f;){var Te=S[h],Je=S[h+1];for(x=G=0;x<Te.length&&!f&&Te[x];)if(f=Te[x++].exec(v),f)for(R=0;R<Je.length;R++)L=f[++G],y=Je[R],typeof y===g&&y.length>0?y.length===2?typeof y[1]==c?this[y[0]]=y[1].call(this,L):this[y[0]]=y[1]:y.length===3?typeof y[1]===c&&!(y[1].exec&&y[1].test)?this[y[0]]=L?y[1].call(this,L,y[2]):e:this[y[0]]=L?L.replace(y[1],y[2]):e:y.length===4&&(this[y[0]]=L?y[3].call(this,L.replace(y[1],y[2])):e):this[y]=L||e;h+=2}},te=function(v,S){for(var h in S)if(typeof S[h]===g&&S[h].length>0){for(var x=0;x<S[h].length;x++)if(Xe(S[h][x],v))return h===l?e:h}else if(Xe(S[h],v))return h===l?e:h;return S.hasOwnProperty("*")?S["*"]:v},Tt={"1.0":"/8","1.2":"/1","1.3":"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},Ye={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2","8.1":"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},Qe={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[d,[s,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[d,[s,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[s,d],[/opios[\/ ]+([\w\.]+)/i],[d,[s,X+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[d,[s,X+" GX"]],[/\bopr\/([\w\.]+)/i],[d,[s,X]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[d,[s,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[d,[s,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon)\/([-\w\.]+)/i,/(heytap|ovi|115)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[s,d],[/quark(?:pc)?\/([-\w\.]+)/i],[d,[s,"Quark"]],[/\bddg\/([\w\.]+)/i],[d,[s,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[d,[s,"UC"+oe]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[d,[s,"WeChat"]],[/konqueror\/([\w\.]+)/i],[d,[s,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[d,[s,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[d,[s,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[d,[s,"Smart Lenovo "+oe]],[/(avast|avg)\/([\w\.]+)/i],[[s,/(.+)/,"$1 Secure "+oe],d],[/\bfocus\/([\w\.]+)/i],[d,[s,ae+" Focus"]],[/\bopt\/([\w\.]+)/i],[d,[s,X+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[d,[s,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[d,[s,"Dolphin"]],[/coast\/([\w\.]+)/i],[d,[s,X+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[d,[s,"MIUI"+Ze]],[/fxios\/([\w\.-]+)/i],[d,[s,ae]],[/\bqihoobrowser\/?([\w\.]*)/i],[d,[s,"360"]],[/\b(qq)\/([\w\.]+)/i],[[s,/(.+)/,"$1Browser"],d],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[s,/(.+)/,"$1"+Ze],d],[/samsungbrowser\/([\w\.]+)/i],[d,[s,Y+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[d,[s,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[s,"Sogou Mobile"],d],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[s,d],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[s],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[d,s],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[s,Ke],d],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/(daum)apps[\/ ]([\w\.]+)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[s,d],[/\bgsa\/([\w\.]+) .*safari\//i],[d,[s,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[d,[s,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[d,[s,se+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[s,se+" WebView"],d],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[d,[s,"Android "+oe]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[s,d],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[d,[s,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[d,s],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[s,[d,te,Tt]],[/(webkit|khtml)\/([\w\.]+)/i],[s,d],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[s,"Netscape"],d],[/(wolvic|librewolf)\/([\w\.]+)/i],[s,d],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[d,[s,ae+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[s,[d,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[s,[d,/master.|lts./,""]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[E,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[E,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[E,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[E,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[E,"arm"]],[/((ppc|powerpc)(64)?)( mac|;|\))/i],[[E,/ower/,a,J]],[/ sun4\w[;\)]/i],[[E,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i],[[E,J]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[n,[i,Y],[r,m]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[n,[i,Y],[r,u]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[n,[i,_],[r,u]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[n,[i,_],[r,m]],[/(macintosh);/i],[n,[i,_]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[n,[i,We],[r,u]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[n,[i,qe],[r,m]],[/honor([-\w ]+)[;\)]/i],[n,[i,qe],[r,u]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[n,[i,je],[r,m]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[n,[i,je],[r,u]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[n,/_/g," "],[i,Ee],[r,m]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i,/ ([\w ]+) miui\/v?\d/i],[[n,/_/g," "],[i,Ee],[r,u]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[n,[i,xe],[r,u]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[n,[i,te,{OnePlus:["304","403","203"],"*":xe}],[r,m]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[n,[i,"Vivo"],[r,u]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[n,[i,"Realme"],[r,u]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto(?! 360)[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[n,[i,Se],[r,u]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[n,[i,Se],[r,m]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[n,[i,de],[r,m]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv|watch)\w+)/i,/\blg-?([\d\w]+) bui/i],[n,[i,de],[r,u]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[n,[i,Et],[r,m]],[/(nokia) (t[12][01])/i],[i,n,[r,m]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*))/i],[[n,/_/g," "],[r,u],[i,"Nokia"]],[/(pixel (c|tablet))\b/i],[n,[i,ce],[r,m]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[n,[i,ce],[r,u]],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[n,[i,Q],[r,u]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[n,"Xperia Tablet"],[i,Q],[r,m]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[n,[i,Be],[r,u]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[n,[i,D],[r,m]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[n,/(.+)/g,"Fire Phone $1"],[i,D],[r,u]],[/(playbook);[-\w\),; ]+(rim)/i],[n,i,[r,m]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[n,[i,z],[r,u]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[n,[i,Z],[r,m]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[n,[i,Z],[r,u]],[/(nexus 9)/i],[n,[i,"HTC"],[r,m]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[i,[n,/_/g," "],[r,u]],[/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])\w*(\)| bui)/i],[n,[i,"TCL"],[r,m]],[/(itel) ((\w+))/i],[[i,J],n,[r,te,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[n,[i,"Acer"],[r,m]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[n,[i,"Meizu"],[r,u]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[n,[i,"Ulefone"],[r,u]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[n,[i,"Energizer"],[r,u]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[n,[i,"Cat"],[r,u]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[n,[i,"Smartfren"],[r,u]],[/droid.+; (a(?:015|06[35]|142p?))/i],[n,[i,"Nothing"],[r,u]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[n,[i,"Archos"],[r,m]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[n,[i,"Archos"],[r,u]],[/(imo) (tab \w+)/i,/(infinix) (x1101b?)/i],[i,n,[r,m]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (hmd|imo) ([\w ]+?)(?: bui|\))/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i,/(oppo) ?([\w ]+) bui/i],[i,n,[r,u]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[i,n,[r,m]],[/(surface duo)/i],[n,[i,ve],[r,m]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[n,[i,"Fairphone"],[r,u]],[/(u304aa)/i],[n,[i,"AT&T"],[r,u]],[/\bsie-(\w*)/i],[n,[i,"Siemens"],[r,u]],[/\b(rct\w+) b/i],[n,[i,"RCA"],[r,m]],[/\b(venue[\d ]{2,7}) b/i],[n,[i,"Dell"],[r,m]],[/\b(q(?:mv|ta)\w+) b/i],[n,[i,"Verizon"],[r,m]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[n,[i,"Barnes & Noble"],[r,m]],[/\b(tm\d{3}\w+) b/i],[n,[i,"NuVision"],[r,m]],[/\b(k88) b/i],[n,[i,"ZTE"],[r,m]],[/\b(nx\d{3}j) b/i],[n,[i,"ZTE"],[r,u]],[/\b(gen\d{3}) b.+49h/i],[n,[i,"Swiss"],[r,u]],[/\b(zur\d{3}) b/i],[n,[i,"Swiss"],[r,m]],[/\b((zeki)?tb.*\b) b/i],[n,[i,"Zeki"],[r,m]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[i,"Dragon Touch"],n,[r,m]],[/\b(ns-?\w{0,9}) b/i],[n,[i,"Insignia"],[r,m]],[/\b((nxa|next)-?\w{0,9}) b/i],[n,[i,"NextBook"],[r,m]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[i,"Voice"],n,[r,u]],[/\b(lvtel\-)?(v1[12]) b/i],[[i,"LvTel"],n,[r,u]],[/\b(ph-1) /i],[n,[i,"Essential"],[r,u]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[n,[i,"Envizen"],[r,m]],[/\b(trio[-\w\. ]+) b/i],[n,[i,"MachSpeed"],[r,m]],[/\btu_(1491) b/i],[n,[i,"Rotor"],[r,m]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[n,[i,ye],[r,m]],[/(sprint) (\w+)/i],[i,n,[r,u]],[/(kin\.[onetw]{3})/i],[[n,/\./g," "],[i,ve],[r,u]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[n,[i,ke],[r,m]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[n,[i,ke],[r,u]],[/smart-tv.+(samsung)/i],[i,[r,I]],[/hbbtv.+maple;(\d+)/i],[[n,/^/,"SmartTV"],[i,Y],[r,I]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[i,de],[r,I]],[/(apple) ?tv/i],[i,[n,_+" TV"],[r,I]],[/crkey/i],[[n,se+"cast"],[i,ce],[r,I]],[/droid.+aft(\w+)( bui|\))/i],[n,[i,D],[r,I]],[/(shield \w+ tv)/i],[n,[i,ye],[r,I]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[n,[i,We],[r,I]],[/(bravia[\w ]+)( bui|\))/i],[n,[i,Q],[r,I]],[/(mi(tv|box)-?\w+) bui/i],[n,[i,Ee],[r,I]],[/Hbbtv.*(technisat) (.*);/i],[i,n,[r,I]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[i,Ie],[n,Ie],[r,I]],[/droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i],[n,[r,I]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[r,I]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[i,n,[r,k]],[/droid.+; (shield)( bui|\))/i],[n,[i,ye],[r,k]],[/(playstation \w+)/i],[n,[i,Q],[r,k]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[n,[i,ve],[r,k]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[n,[i,Y],[r,C]],[/((pebble))app/i,/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[i,n,[r,C]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[n,[i,xe],[r,C]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[n,[i,_],[r,C]],[/(opwwe\d{3})/i],[n,[i,Be],[r,C]],[/(moto 360)/i],[n,[i,Se],[r,C]],[/(smartwatch 3)/i],[n,[i,Q],[r,C]],[/(g watch r)/i],[n,[i,de],[r,C]],[/droid.+; (wt63?0{2,3})\)/i],[n,[i,ke],[r,C]],[/droid.+; (glass) \d/i],[n,[i,ce],[r,C]],[/(pico) (4|neo3(?: link|pro)?)/i],[i,n,[r,C]],[/; (quest( \d| pro)?)/i],[n,[i,Ke],[r,C]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[i,[r,F]],[/(aeobc)\b/i],[n,[i,D],[r,F]],[/(homepod).+mac os/i],[n,[i,_],[r,F]],[/windows iot/i],[[r,F]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[n,[r,u]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[n,[r,m]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[r,m]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[r,u]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[n,[i,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[d,[s,xt+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[s,d],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[d,[s,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[s,d],[/ladybird\//i],[[s,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[d,s]],os:[[/microsoft (windows) (vista|xp)/i],[s,d],[/(windows (?:phone(?: os)?|mobile|iot))[\/ ]?([\d\.\w ]*)/i],[s,[d,te,Ye]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[d,te,Ye],[s,"Windows"]],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[d,/_/g,"."],[s,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[s,$e],[d,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[d,s],[/(ubuntu) ([\w\.]+) like android/i],[[s,/(.+)/,"$1 Touch"],d],[/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen|webos)\w*[-\/; ]?([\d\.]*)/i],[s,d],[/\(bb(10);/i],[d,[s,z]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[d,[s,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[d,[s,ae+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[d,[s,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[d,[s,"watchOS"]],[/crkey\/([\d\.]+)/i],[d,[s,se+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[s,He],d],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux)(?: arm\w*| x86\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[s,d],[/(sunos) ?([\w\.\d]*)/i],[[s,"Solaris"],d],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[s,d]]},P=function(v,S){if(typeof v===g&&(S=v,v=e),!(this instanceof P))return new P(v,S).getResult();var h=typeof o!==p&&o.navigator?o.navigator:e,x=v||(h&&h.userAgent?h.userAgent:a),G=h&&h.userAgentData?h.userAgentData:e,R=S?kt(Qe,S):Qe,y=h&&h.userAgent==x;return this.getBrowser=function(){var f={};return f[s]=e,f[d]=e,ee.call(f,x,R.browser),f[w]=It(f[d]),y&&h&&h.brave&&typeof h.brave.isBrave==c&&(f[s]="Brave"),f},this.getCPU=function(){var f={};return f[E]=e,ee.call(f,x,R.cpu),f},this.getDevice=function(){var f={};return f[i]=e,f[n]=e,f[r]=e,ee.call(f,x,R.device),y&&!f[r]&&G&&G.mobile&&(f[r]=u),y&&f[n]=="Macintosh"&&h&&typeof h.standalone!==p&&h.maxTouchPoints&&h.maxTouchPoints>2&&(f[n]="iPad",f[r]=m),f},this.getEngine=function(){var f={};return f[s]=e,f[d]=e,ee.call(f,x,R.engine),f},this.getOS=function(){var f={};return f[s]=e,f[d]=e,ee.call(f,x,R.os),y&&!f[s]&&G&&G.platform&&G.platform!="Unknown"&&(f[s]=G.platform.replace(/chrome os/i,He).replace(/macos/i,$e)),f},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return x},this.setUA=function(f){return x=typeof f===b&&f.length>A?Ie(f,A):f,this},this.setUA(x),this};P.VERSION=t,P.BROWSER=le([s,d,w]),P.CPU=le([E]),P.DEVICE=le([n,i,r,k,u,I,m,C,F]),P.ENGINE=P.OS=le([s,d]),typeof ie!==p?(typeof be!==p&&be.exports&&(ie=be.exports=P),ie.UAParser=P):typeof define===c&&define.amd?define(function(){return P}):typeof o!==p&&(o.UAParser=P);var H=typeof o!==p&&(o.jQuery||o.Zepto);if(H&&!H.ua){var ue=new P;H.ua=ue.getResult(),H.ua.get=function(){return ue.getUA()},H.ua.set=function(v){ue.setUA(v);var S=ue.getResult();for(var h in S)H.ua[h]=S[h]}}})(typeof window=="object"?window:ie)});var Zt={};_t(Zt,{DEFAULT_GDN_SETTINGS:()=>ht,ElementNotFound:()=>vt,GFNTerminationError:()=>B,PopupBlocked:()=>De,SessionState:()=>Fe,StreamProvider:()=>ze,StreamState:()=>Me,StreamTarget:()=>wt,StreamTerminationError:()=>he,StreamingClient:()=>ne,StreamingClientError:()=>V,UnsupportedProvider:()=>St,usePixelStreaming:()=>yt});var me="0123456789abcdef",ge=class o{constructor(e){this.bytes=e}static ofInner(e){if(e.length!==16)throw new TypeError("not 128-bit length");return new o(e)}static fromFieldsV7(e,t,a,l){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(a)||!Number.isInteger(l)||e<0||t<0||a<0||l<0||e>0xffffffffffff||t>4095||a>1073741823||l>4294967295)throw new RangeError("invalid field value");let c=new Uint8Array(16);return c[0]=e/M(2,40),c[1]=e/M(2,32),c[2]=e/M(2,24),c[3]=e/M(2,16),c[4]=e/M(2,8),c[5]=e,c[6]=112|t>>>8,c[7]=t,c[8]=128|a>>>24,c[9]=a>>>16,c[10]=a>>>8,c[11]=a,c[12]=l>>>24,c[13]=l>>>16,c[14]=l>>>8,c[15]=l,new o(c)}static parse(e){var t,a,l,c;let p;switch(e.length){case 32:p=(t=/^[0-9a-f]{32}$/i.exec(e))===null||t===void 0?void 0:t[0];break;case 36:p=(a=/^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(e))===null||a===void 0?void 0:a.slice(1,6).join("");break;case 38:p=(l=/^\{([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})\}$/i.exec(e))===null||l===void 0?void 0:l.slice(1,6).join("");break;case 45:p=(c=/^urn:uuid:([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(e))===null||c===void 0?void 0:c.slice(1,6).join("");break;default:break}if(p){let g=new Uint8Array(16);for(let b=0;b<16;b+=4){let w=parseInt(p.substring(2*b,2*b+8),16);g[b+0]=w>>>24,g[b+1]=w>>>16,g[b+2]=w>>>8,g[b+3]=w}return new o(g)}else throw new SyntaxError("could not parse UUID string")}toString(){let e="";for(let t=0;t<this.bytes.length;t++)e+=me.charAt(this.bytes[t]>>>4),e+=me.charAt(this.bytes[t]&15),(t===3||t===5||t===7||t===9)&&(e+="-");return e}toHex(){let e="";for(let t=0;t<this.bytes.length;t++)e+=me.charAt(this.bytes[t]>>>4),e+=me.charAt(this.bytes[t]&15);return e}toJSON(){return this.toString()}getVariant(){let e=this.bytes[8]>>>4;if(e<0)throw new Error("unreachable");if(e<=7)return this.bytes.every(t=>t===0)?"NIL":"VAR_0";if(e<=11)return"VAR_10";if(e<=13)return"VAR_110";if(e<=15)return this.bytes.every(t=>t===255)?"MAX":"VAR_RESERVED";throw new Error("unreachable")}getVersion(){return this.getVariant()==="VAR_10"?this.bytes[6]>>>4:void 0}clone(){return new o(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(let t=0;t<16;t++){let a=this.bytes[t]-e.bytes[t];if(a!==0)return Math.sign(a)}return 0}},Oe=class{constructor(e){this.timestamp=0,this.counter=0,this.random=e!=null?e:Ft()}generate(){return this.generateOrResetCore(Date.now(),1e4)}generateOrAbort(){return this.generateOrAbortCore(Date.now(),1e4)}generateOrResetCore(e,t){let a=this.generateOrAbortCore(e,t);return a===void 0&&(this.timestamp=0,a=this.generateOrAbortCore(e,t)),a}generateOrAbortCore(e,t){if(!Number.isInteger(e)||e<1||e>0xffffffffffff)throw new RangeError("`unixTsMs` must be a 48-bit positive integer");if(t<0||t>0xffffffffffff)throw new RangeError("`rollbackAllowance` out of reasonable range");if(e>this.timestamp)this.timestamp=e,this.resetCounter();else if(e+t>=this.timestamp)this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter());else return;return ge.fromFieldsV7(this.timestamp,Math.trunc(this.counter/M(2,30)),this.counter&M(2,30)-1,this.random.nextUint32())}resetCounter(){this.counter=this.random.nextUint32()*1024+(this.random.nextUint32()&1023)}generateV4(){let e=new Uint8Array(Uint32Array.of(this.random.nextUint32(),this.random.nextUint32(),this.random.nextUint32(),this.random.nextUint32()).buffer);return e[6]=64|e[6]>>>4,e[8]=128|e[8]>>>2,ge.ofInner(e)}},Ft=()=>{if(typeof crypto!="undefined"&&typeof crypto.getRandomValues!="undefined")return new Pe;if(typeof UUIDV7_DENY_WEAK_RNG!="undefined"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");return{nextUint32:()=>Math.trunc(Math.random()*65536)*65536+Math.trunc(Math.random()*65536)}},Pe=class{constructor(){this.buffer=new Uint32Array(8),this.cursor=65535}nextUint32(){return this.cursor>=this.buffer.length&&(crypto.getRandomValues(this.buffer),this.cursor=0),this.buffer[this.cursor++]}},it,nt=()=>Dt().toString(),Dt=()=>(it||(it=new Oe)).generate();var st=Gt(ot(),1),$;function at(){var p;if(navigator.userAgent===($==null?void 0:$.raw))return $;let o=new st.UAParser(navigator.userAgent),e=o.getOS(),t=o.getDevice(),a=o.getBrowser(),l=o.getEngine(),c=o.getCPU();return((p=e.name)==null?void 0:p.replace(/\s/g,"").toLowerCase())==="macos"&&navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&(t.model="iPad",t.type="tablet",e.name="iOS"),$={raw:navigator.userAgent,os:e,device:t,browser:a,engine:l,cpu:c},$}var ct={iOS:"iOS"},Ue={Safari:"Safari",SafariMobile:"Mobile Safari"};var zt={chrome:{minVer:77},"chrome headless":{minVer:77},edge:{minVer:91},safari:{minVer:16,devices:new Set(["ipad"])},"mobile safari":{minVer:16}},Mt={chrome:{minVer:73},"chrome headless":{minVer:73},firefox:{minVer:66},safari:{minVer:16,devices:new Set(["ipad"])},"mobile safari":{minVer:16}};function dt(o,e,t,a,l){if(l===ct.iOS&&e!==Ue.Safari&&e!==Ue.SafariMobile)return!1;let c=e.toLowerCase(),p=a.toLowerCase(),g=o[c];if(typeof g!="undefined"){let b=g.minVer<=t,w=g.devices,n=w?w.has(p):!0;return b&&n}return!1}var Ae={};function qt(){var r,i,d,E,k;let{browser:o,os:e,device:t,raw:a}=at();if(Ae[a])return Ae[a];let l=Number.parseInt((r=o==null?void 0:o.version)!=null?r:"",10),c=(i=t.model)!=null?i:"",p=(d=t.type)!=null?d:"",g=(E=o.name)!=null?E:"",b=(k=e.name)!=null?k:"",w=dt(Mt,g,l,c,b),n=dt(zt,g,l,c,b),s={browserName:g,browserVersion:l,osName:b,deviceModel:c,deviceType:p,ubitusSupported:w,geforceSupported:n};return Ae[a]=s,s}function Re(o=!1){let e=qt();return o?q(U({},e),{geforceSupported:!0,ubitusSupported:!0}):e}function Le(o,e=Error){return typeof e=="function"?o instanceof e:o instanceof Error?o===e:!1}function lt(o){return o instanceof Error?o:new Error("unknown error",{cause:o})}function jt(o,...e){try{return o()}catch(t){if(e.length===0)return lt(t);for(let a of e)if(Le(t,a))return t;throw t}}function ut(o,e=Error){if(Le(o,e))return o;if(o instanceof Error&&o.cause!==void 0)return ut(o.cause,e)}var j={is:Le,wrap:lt,catch:jt,as:ut};var fe=class{constructor(e=new EventTarget){this.target=e}addEventListener(e,t,a){this.target.addEventListener(e,t,a)}removeEventListener(e,t,a){this.target.removeEventListener(e,t,a)}on(e,t,a){this.addEventListener(e,t,a)}off(e,t,a){this.removeEventListener(e,t,a)}dispatchEvent(e){return this.target.dispatchEvent(e)}emit(e,t){return this.dispatchEvent(new CustomEvent(e,{detail:t}))}};var _e=class extends Error{constructor(e){super(e!=null?e:"invariant does not hold"),this.name="InvariantError"}};function pt(o,e){if(!o)throw new _e(e)}var Bt="https://sdk.nvidia.com/gfn/client-sdk/1.x/gfn-client-sdk.js",K=class extends Error{constructor(){super(...arguments);T(this,"name","GFNClientError")}},Ve=new K("not-initialized"),Wt=new K("already-initialized"),B=class extends K{constructor(t,a,l,c){super(l,c);this.code=t;this.reason=a;T(this,"name","GFNTerminationError")}},mt="geforce-container",W,Ge=class{constructor(e,t){this.config=e;this.serverInfo=t;T(this,"player")}start(e,t){return N(this,null,function*(){var c,p;yield globalThis.GFN.auth.loginWithNonce(t.nonce,t.cmsId);let a=(c=globalThis.GFN.auth.guestUser)==null?void 0:c.idToken;pt(a,"guestUser ID token should exist");let l=globalThis.GFN.streamer.detectStreamingResolution();l.width===1024&&l.height===720&&(l.width=1280),this.player&&((p=this.player)==null||p.remove(),this.cancel()),this.player=document.createElement("div"),this.player.setAttribute("id",mt),this.player.setAttribute("style","width: 100%; height: 100%; background: black;"),e.append(this.player);try{yield globalThis.GFN.streamer.start({server:this.serverInfo.defaultZone.address,appId:t.cmsId,windowElementId:mt,streamParams:{width:l.width,height:l.height,fps:60}})}catch(g){return new K("failed to start stream",{cause:g})}})}cancel(){globalThis.GFN.streamer.cancel()}stop(){globalThis.GFN.streamer.stop()}listen({onTerminated:e,onStarted:t}){globalThis.GFN.streamer.on("started",t),globalThis.GFN.streamer.on("diagnostic",a=>{switch(a.code){case 3237093642:case 3237093643:e(new B(a.code,-1,a.message))}}),globalThis.GFN.streamer.on("terminated",a=>{switch(a.code){case 15868704:case void 0:e();break;default:e(new B(a.code,a.reason))}})}};function Kt(o){return N(this,null,function*(){if(W)return Wt;yield Ht();try{yield globalThis.GFN.initialize(new globalThis.GFN.Settings(o.settings));let e=yield globalThis.GFN.server.getServerInfo();return globalThis.GFN.settings.vpcId=e.vpcId,W=new Ge(o,e),W}catch(e){return new K("GFN client initialization failed",{cause:e})}})}function gt(){return W||Ve}function bt(o){return N(this,null,function*(){return W||Kt(o)})}function Ht(){if(!globalThis.GFN)return new Promise(o=>{let e=document.createElement("script");e.src=Bt,e.addEventListener("load",function t(){o(),e.removeEventListener("load",t)}),document.head.append(e)})}function ft(o,e,{fullscreen:t=!0}={}){let a=new URL("/apps","https://gdn.nvidia.com"),l=a.searchParams,c=!t;return l.append("cms-id",e.cmsId),l.append("action","play-game"),l.append("nonce",e.nonce),l.append("redirect",e.redirect),l.append("partner-id",o),l.append("utm_source","Improbable"),l.append("utm_campaign","Streaming"),l.append("windowed-mode",c.toString()),e.zone&&l.append("zone",e.zone),e.state&&l.append("state",e.state),a.href}var Fe=(w=>(w.Queued="QUEUED",w.Admitted="ADMITTED",w.Ready="READY",w.Pending="PENDING",w.Active="ACTIVE",w.Replaced="REPLACED",w.Expired="EXPIRED",w.Failed="FAILED",w.Deleted="DELETED",w))(Fe||{}),we=class{constructor(e){T(this,"organizationId");T(this,"token");T(this,"fetch");T(this,"logger");T(this,"baseURL");var t,a,l;this.organizationId=e.organizationId,this.fetch=(t=e.fetch)!=null?t:globalThis.fetch.bind(globalThis),this.token=e.token,this.logger=(a=e.logger)!=null?a:console,this.baseURL=e.host?`${(l=e.protocol)!=null?l:"https"}://${e.host}`:void 0}setAuthToken(e){this.token=e}refreshSession(l){return N(this,arguments,function*({projectId:e,worldId:t,sessionId:a}){let c=new Headers({"x-m2-project-id":e,"x-m2-world-id":t});try{let p=yield this.doFetch(`/api/sessions/${a}`,{method:"post",headers:c});if(!p.ok){this.logger.error("Failed to refresh session:",{body:yield p.text(),status:p.status});return}return yield p.json()}catch(p){this.logger.error("Failed to make refresh session request:",{error:p});return}})}pollSession(e,t,a,l){return N(this,null,function*(){let c;for(;!c||c.state==="QUEUED"||c.state==="ADMITTED"||c.state==="PENDING"||c.state==="READY";){if(c=yield this.refreshSession({projectId:e,worldId:t,sessionId:a}),!c)return;if(c.state==="ACTIVE")return l&&l(c.state),c;yield new Promise(p=>globalThis.setTimeout(p,5e3))}return c})}createSession(p){return N(this,arguments,function*({projectId:e,streamId:t,sessionMetadata:a,worldId:l,onStateChange:c}){let g=new Headers({"x-m2-project-id":e,"x-m2-world-id":l!=null?l:"","Content-Type":"application/json"});try{let b=yield this.doFetch("/api/sessions",{method:"post",headers:g,body:JSON.stringify({streamId:t,metadata:a})});if(!b.ok){this.logger.error("Failed to fetch session config:",{body:yield b.text(),status:b.status});return}let w=yield b.json();return l&&(w.state==="QUEUED"||w.state==="READY")?(c&&c(w.state),yield this.pollSession(e,l,w.sessionId,c)):w}catch(b){this.logger.error("Failed to make fetch session config request:",{error:b});return}})}deleteSession(c){return N(this,arguments,function*({projectId:e,worldId:t,sessionId:a,deletionReason:l}){let p=new Headers({"x-m2-project-id":e,"x-m2-world-id":t});try{let g=yield this.doFetch(`/api/sessions/${a}`,{method:"delete",headers:p,body:JSON.stringify({deletionReason:l})});if(!g.ok){this.logger.error("Failed to delete session:",{body:yield g.text(),status:g.status});return}}catch(g){this.logger.error("Failed to make refresh session request:",{error:g});return}})}doFetch(e,t){return N(this,null,function*(){let a=typeof e=="string"&&this.baseURL?new URL(e,this.baseURL):e,l=new Headers(t==null?void 0:t.headers);if(!l.has("Authorization")&&this.token){let c=typeof this.token=="function"?yield this.token():this.token;l.set("Authorization",`Bearer ${c}`)}return!l.has("x-m2-organization-id")&&this.organizationId&&l.set("x-m2-organization-id",this.organizationId),this.fetch(a,q(U({},t),{headers:l}))})}};var ze=(t=>(t.GeforceNow="gdn",t.Ubitus="ubitus",t))(ze||{}),wt=(t=>(t[t.Window=0]="Window",t[t.Embedded=1]="Embedded",t))(wt||{}),ht={partnerId:"0Xg3tEsmQZqn-zsZgSTIQqJZn5f7X7kuBxE5C9KFsys",clientId:"7F2uPUC63HsHxn3wy51IhSmPyXMsr8Wru-mKOREmqfA",catalogClientId:"18e30568-63b3-43ae-8db6-078689b5705c"},V=class extends Error{constructor(){super(...arguments);T(this,"name","StreamingClientError")}},vt=new V("Stream container element not found in DOM"),he=class extends V{constructor(){super(...arguments);T(this,"name","StreamTerminationError")}},De=new V("Popup or new tab was blocked by the browser"),St=new V("only GeforceNow provider is currently supported"),Me=(c=>(c[c.Idle=0]="Idle",c[c.Loading=1]="Loading",c[c.Streaming=2]="Streaming",c[c.Terminated=3]="Terminated",c[c.Unknown=4]="Unknown",c))(Me||{}),ne=class extends fe{constructor(t){var a,l,c,p,g;super();T(this,"skipBrowserSupportChecks");T(this,"gdnSettings");T(this,"logger");T(this,"sessionClient");this.logger=(a=t.logger)!=null?a:console,this.gdnSettings=U(U({},ht),t.gdn),this.sessionClient=new we(U({host:(c=(l=t.server)==null?void 0:l.host)!=null?c:`${t.auth.organizationId}.m2worlds.io`,protocol:(p=t.server)==null?void 0:p.protocol,fetch:t.fetch},t.auth)),this.skipBrowserSupportChecks=(g=t.skipBrowserSupportChecks)!=null?g:!1}getBrowserSupport(){let t=Re(this.skipBrowserSupportChecks);return{gdn:t.geforceSupported,ubitus:t.ubitusSupported}}setAuthToken(t){this.sessionClient.setAuthToken(t)}setup(c){return N(this,arguments,function*({projectId:t,worldId:a,forceProvider:l}){let p=Re(this.skipBrowserSupportChecks),g=nt(),b=yield this.sessionClient.createSession({projectId:t,streamId:g,sessionMetadata:q(U({},p),{forceProvider:l}),worldId:a,onStateChange:w=>{this.emit("sessionStateUpdated",w)}});if(b)return{streamId:g,projectId:t,worldId:a,sessionId:b.sessionId,config:b.providerConfig}})}start(b){return N(this,null,function*(){var w=b,{streamId:t,projectId:a,worldId:l,sessionId:c,provider:p}=w,g=tt(w,["streamId","projectId","worldId","sessionId","provider"]);var r;if(p!=="gdn")return St;this.emit("streamStateUpdated",{state:1});let n=!0,s=i=>{this.emit("error",i),this.emit("streamStateUpdated",{state:3,error:i}),n&&(this.cleanup({projectId:a,worldId:l,sessionId:c,reason:i}),n=!1)};switch(g.target){case 0:{let{fullscreen:i=!0,config:d,container:E}=g,k=`_stream:${t}`,u=ft(this.gdnSettings.partnerId,d,{fullscreen:i}),m=this.open({container:E,href:u,target:k});return j.is(m)?(j.is(De)&&((r=this.logger)==null||r.warn("Popup was blocked. We cannot monitor the new window for close events or close it via the SDK")),s(m)):this.emit("streamStateUpdated",{state:2}),m}case 1:{let{config:i,container:d}=g,E=$t(d);if(E instanceof Error)return s(E),E;let k=yield bt({settings:this.gdnSettings});if(j.is(k))return s(k),k;k.listen({onStarted:()=>{this.emit("streamStateUpdated",{state:2})},onTerminated(m){s(new he("Stream terminated with error",{cause:m}))}});let u=yield k.start(E,{cmsId:Number.parseInt(i.cmsId,10),nonce:i.nonce});return j.is(u)?(s(u),u):E}}})}stop(){let t=gt();if(!j.is(t,Ve)){if(j.is(t))return t;t.stop()}}cleanup(p){return N(this,arguments,function*({projectId:t,worldId:a,sessionId:l,reason:c}){let g=c instanceof Error?c.message:c,b=j.as(c,B);if(b){let w=`${b.message||g}`,n=`0x${b.code.toString(16).toUpperCase()}`;g=`GFN: ${w} (reason=${b.reason}, code=${n})`}return yield this.sessionClient.deleteSession({projectId:t,worldId:a,sessionId:l,deletionReason:g})})}open(t){let{container:a,href:l,target:c}=t;if(a)return a.location.href=l,a;let p=globalThis.open(l,c);if(!p)return De;let g=setInterval(()=>{p.closed&&(clearInterval(g),this.emit("streamStateUpdated",{state:3}))},2e3);return p}};function $t(o){if(typeof o=="string"){let e=document.querySelector(o);return e||vt}return o}var O=Rt("react");function yt({organizationId:o,projectId:e,worldId:t,authToken:a,clientOptions:l}){let[c,p]=(0,O.useState)(0),[g,b]=(0,O.useState)(),[w,n]=(0,O.useState)(a),s=(0,O.useRef)(null),r=(0,O.useRef)(null),i=(0,O.useCallback)(()=>{if(s.current){if(r.current){let{onStreamStateUpdate:k,onSessionStateUpdate:u,onErrorEvent:m}=r.current;s.current.removeEventListener("streamStateUpdated",k),s.current.removeEventListener("sessionStateUpdated",u),s.current.removeEventListener("error",m)}s.current.stop(),p(0),b(void 0)}},[]),d=(0,O.useCallback)(m=>N(null,[m],function*({streamTarget:k,onError:u=()=>{}}){var _,Z;if(!s.current)return;i();let I=z=>{p(z.detail.state)},C=z=>{b(z.detail)},F=z=>{u(z.detail)};r.current={onStreamStateUpdate:I,onSessionStateUpdate:C,onErrorEvent:F},s.current.addEventListener("streamStateUpdated",I),s.current.addEventListener("sessionStateUpdated",C),s.current.addEventListener("error",F);let A=yield s.current.setup({projectId:e,worldId:t,forceProvider:"gdn"});if(!A){u(new Error("Failed to fetch stream config"));return}if(((_=A.config)==null?void 0:_.name)!=="gdn"){u(new Error(`Unsupported provider: ${(Z=A.config)==null?void 0:Z.name}`));return}let D=yield s.current.start(U(q(U({},A),{provider:"gdn"}),k));if(D instanceof V)throw A&&(yield s.current.cleanup(U({reason:D},A))),D}),[e,t,i]),E=(0,O.useCallback)(()=>s.current?s.current.getBrowserSupport():{},[]);return(0,O.useEffect)(()=>{s.current&&a?s.current.setAuthToken(a):n(a)},[a]),(0,O.useEffect)(()=>{let k={auth:{token:w,organizationId:o}};return s.current||(s.current=new ne(l!=null?l:k)),()=>{i(),s.current=null}},[o,l,w,i]),{streamState:c,sessionState:g,startStreaming:d,stopStreaming:i,getBrowserSupport:E}}return Vt(Zt);})();
/*! Bundled license information:
uuidv7/dist/index.js:
(**
* uuidv7: A JavaScript implementation of UUID version 7
*
* Copyright 2021-2024 LiosK
*
* @license Apache-2.0
* @packageDocumentation
*)
*/