UNPKG

@scandit/web-barcode-link

Version:

The Scandit Web Barcode Link package

1 lines 71.4 kB
(function(S,A){typeof exports=="object"&&typeof module<"u"?A(exports):typeof define=="function"&&define.amd?define(["exports"],A):(S=typeof globalThis<"u"?globalThis:S||self,A(S.ScanditBarcodeLink={}))})(this,function(S){"use strict";var Ni=Object.defineProperty;var Di=(S,A,q)=>A in S?Ni(S,A,{enumerable:!0,configurable:!0,writable:!0,value:q}):S[A]=q;var _=(S,A,q)=>(Di(S,typeof A!="symbol"?A+"":A,q),q);class A{constructor(e){this.barcodeLink=e}getConfiguration(){return{...this.barcodeLink.configuration}}onCancel(){this.barcodeLink.dispose(),this.barcodeLink.listeners.forEach(e=>{var t;(t=e.onCancel)==null||t.call(e)})}onCapture(e,t){this.barcodeLink.listeners.forEach(s=>{var n;(n=s.onCapture)==null||n.call(s,e,t)})}onDeviceConnected(){this.barcodeLink.listeners.forEach(e=>{var t;(t=e.onDeviceConnected)==null||t.call(e)})}onDeviceDisconnected(){this.barcodeLink.listeners.forEach(e=>{var t;(t=e.onDeviceDisconnected)==null||t.call(e)})}onConnectionStateChanged(e){this.barcodeLink.listeners.forEach(t=>{var s;(s=t.onConnectionStateChanged)==null||s.call(t,e)})}}var q=(i=>(i.Unique="unique",i.Count="count",i))(q||{}),ve=(i=>(i.SingleScanning="singleScanning",i.ContinuousScanning="continuousScanning",i.SingleListBuilding="singleListBuilding",i.ContinuousListBuilding="continuousListBuilding",i))(ve||{}),j=(i=>(i.Express="express",i.Web="web",i))(j||{});class ke{constructor(e){_(this,"configuration",{barcodeLinkMode:ve.SingleScanning,licenseKey:"",listBehavior:q.Unique,symbologies:{}});_(this,"flow");_(this,"flowDelegate",new A(this));_(this,"listeners",new Set);this.configuration.licenseKey=e}static forLicenseKey(e){return new ke(e)}setSymbologies(e){return this.configuration.symbologies=e,this}setBarcodeLinkMode(e){return this.configuration.barcodeLinkMode=e,this}setBarcodeRegexValidation(e){return this.configuration.barcodeRegexValidation=String(e).slice(1,-1),this}setBarcodeTransformations(e){return this.configuration.barcodeTransformations=e,this}setPlatform(e){switch(e){case j.Express:return delete this.configuration.platform,this;case j.Web:return this.configuration.platform=e,this}}setListBehavior(e){return this.configuration.listBehavior=e,this}addListener(e){return this.listeners.add(e),this}removeListener(e){return this.listeners.delete(e),this}async initialize(e){return this.flow=e,this.flow.setDelegate(this.flowDelegate),await this.flow.initialize()}dispose(){var e;(e=this.flow)==null||e.dispose()}}var Ye=(i=>(i.EAN13UPCA="ean13Upca",i.UPCE="upce",i.EAN8="ean8",i.Code39="code39",i.Code93="code93",i.Code128="code128",i.Code11="code11",i.Code25="code25",i.Codabar="codabar",i.InterleavedTwoOfFive="interleavedTwoOfFive",i.MSIPlessey="msiPlessey",i.QR="qr",i.DataMatrix="dataMatrix",i.Aztec="aztec",i.MaxiCode="maxicode",i.DotCode="dotcode",i.KIX="kix",i.RM4SCC="rm4scc",i.GS1Databar="databar",i.GS1DatabarExpanded="databarExpanded",i.GS1DatabarLimited="databarLimited",i.PDF417="pdf417",i.MicroPDF417="microPdf417",i.MicroQR="microQr",i.Code32="code32",i.Lapa4SC="lapa4sc",i.IATATwoOfFive="iata2of5",i.MatrixTwoOfFive="matrix2of5",i.USPSIntelligentMail="uspsIntelligentMail",i))(Ye||{}),Bt=(i=>(i.A="A",i.B="B",i.C="C",i))(Bt||{}),Lt=(i=>(i.Mod10="mod10",i.Mod11="mod11",i.Mod16="mod16",i.Mod43="mod43",i.Mod47="mod47",i.Mod103="mod103",i.Mod10AndMod11="mod1110",i.Mod10AndMod10="mod1010",i))(Lt||{}),Nt=(i=>(i.None="none",i.Unknown="unknown",i.Linked="linked",i.GS1TypeA="gs1TypeA",i.GS1TypeB="gs1TypeB",i.GS1TypeC="gs1TypeC",i))(Nt||{});const Dt=".sdc-barcode-link{position:fixed;top:0;left:0;width:100%;height:100%;height:100dvh;display:grid;background-color:#0000004d;z-index:100}.sdc-barcode-link iframe{max-width:650px;max-height:800px;width:90vw;height:90vh;margin:auto;transform:scale(0);animation:centerPop .3s 50ms ease-out forwards;transition:all .3s}@media screen and (max-width: 700px){.sdc-barcode-link iframe{width:100%;height:100%;max-height:none}}@keyframes centerPop{to{transform:none}}";class Mt{constructor(){_(this,"barcodeLinkUrl","https://barcode-link.scandit.com");_(this,"onIframeMessageListener",this.onIframeMessage.bind(this));_(this,"sessionId");_(this,"popup",null);_(this,"iframe",null);_(this,"style",null);_(this,"delegate")}setDelegate(e){this.delegate=e}async initialize(){var e;this.initStyles(),this.popup=this.createPopup(),this.iframe=this.createIframe({src:this.barcodeLinkUrl}),this.popup.append(this.iframe),document.body.append(this.popup),this.listenToIframeMessages(),this.sessionId=await new Promise(t=>{function s(n){n.data.type==="loaded"&&(window.removeEventListener("message",s),t(n.data.sessionId))}window.addEventListener("message",s)}),this.sendMessage({type:"configuration",configuration:(e=this.delegate)==null?void 0:e.getConfiguration()})}dispose(){window.removeEventListener("message",this.onIframeMessageListener),document.head.removeChild(this.style),document.body.removeChild(this.popup),this.popup=null,this.iframe=null,this.style=null}listenToIframeMessages(){window.addEventListener("message",this.onIframeMessageListener)}sendMessage(e){var n,c;const t=new URL(this.barcodeLinkUrl),s=`${t.protocol}//${t.host}`;(c=(n=this.iframe)==null?void 0:n.contentWindow)==null||c.postMessage(e,s)}onIframeMessage(e){var s,n,c,u,g;if(e.source!==((s=this.iframe)==null?void 0:s.contentWindow))return;const{type:t}=e.data;switch(t){case"cancelled":(c=(n=this.delegate)==null?void 0:n.onCancel)==null||c.call(n);break;case"capture":(g=(u=this.delegate)==null?void 0:u.onCapture)==null||g.call(u,e.data.barcodes,e.data.finished);break}}createPopup(){const e=document.createElement("div");return e.className="sdc-barcode-link",e}createIframe(e){const t=document.createElement("iframe");return t.src=e.src,t.setAttribute("sandbox","allow-scripts allow-same-origin"),t.setAttribute("allow","camera"),t.setAttribute("referrerpolicy","origin"),t.setAttribute("title","Barcode Link Plugin"),t}initStyles(){document.querySelector('style[id="sdc-barcode-link"]')||(this.style=document.createElement("style"),this.style.textContent=Dt,document.head.append(this.style))}}var z=(i=>(i.MainDeviceReconnected="mainDeviceReconnected",i.MainDeviceDisconnected="mainDeviceDisconnected",i.MainDeviceConnectionFailed="mainDeviceConnectionFailed",i.RemoteDeviceConnected="remoteDeviceConnected",i.RemoteDeviceDisconnected="remoteDeviceDisconnected",i))(z||{}),Pt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},_e={exports:{}};(function(i,e){(function(t,s){var n="1.0.40",c="",u="?",g="function",y="undefined",R="object",T="string",I="major",r="model",h="name",o="type",a="vendor",l="version",L="architecture",$="console",p="mobile",m="tablet",O="smarttv",F="wearable",qe="embedded",Ie=500,de="Amazon",Z="Apple",gt="ASUS",yt="BlackBerry",fe="Browser",pe="Chrome",xi="Edge",me="Firefox",ee="Google",vt="Huawei",Fe="LG",Ve="Microsoft",kt="Motorola",te="Opera",ie="Samsung",_t="Sharp",we="Sony",ze="Xiaomi",We="Zebra",Et="Facebook",Ct="Chromium OS",St="Mac OS",Tt=" Browser",Ri=function(b,v){var f={};for(var E in b)v[E]&&v[E].length%2===0?f[E]=v[E].concat(b[E]):f[E]=b[E];return f},be=function(b){for(var v={},f=0;f<b.length;f++)v[b[f].toUpperCase()]=b[f];return v},At=function(b,v){return typeof b===T?H(v).indexOf(H(b))!==-1:!1},H=function(b){return b.toLowerCase()},Bi=function(b){return typeof b===T?b.replace(/[^\d\.]/g,c).split(".")[0]:s},He=function(b,v){if(typeof b===T)return b=b.replace(/^\s\s*/,c),typeof v===y?b:b.substring(0,Ie)},se=function(b,v){for(var f=0,E,V,P,k,d,U;f<v.length&&!d;){var Ke=v[f],Rt=v[f+1];for(E=V=0;E<Ke.length&&!d&&Ke[E];)if(d=Ke[E++].exec(b),d)for(P=0;P<Rt.length;P++)U=d[++V],k=Rt[P],typeof k===R&&k.length>0?k.length===2?typeof k[1]==g?this[k[0]]=k[1].call(this,U):this[k[0]]=k[1]:k.length===3?typeof k[1]===g&&!(k[1].exec&&k[1].test)?this[k[0]]=U?k[1].call(this,U,k[2]):s:this[k[0]]=U?U.replace(k[1],k[2]):s:k.length===4&&(this[k[0]]=U?k[3].call(this,U.replace(k[1],k[2])):s):this[k]=U||s;f+=2}},ge=function(b,v){for(var f in v)if(typeof v[f]===R&&v[f].length>0){for(var E=0;E<v[f].length;E++)if(At(v[f][E],b))return f===u?s:f}else if(At(v[f],b))return f===u?s:f;return v.hasOwnProperty("*")?v["*"]:b},Li={"1.0":"/8","1.2":"/1","1.3":"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},Ot={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"},xt={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[l,[h,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[l,[h,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[h,l],[/opios[\/ ]+([\w\.]+)/i],[l,[h,te+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[l,[h,te+" GX"]],[/\bopr\/([\w\.]+)/i],[l,[h,te]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[l,[h,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[l,[h,"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],[h,l],[/quark(?:pc)?\/([-\w\.]+)/i],[l,[h,"Quark"]],[/\bddg\/([\w\.]+)/i],[l,[h,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[l,[h,"UC"+fe]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[l,[h,"WeChat"]],[/konqueror\/([\w\.]+)/i],[l,[h,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[l,[h,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[l,[h,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[l,[h,"Smart Lenovo "+fe]],[/(avast|avg)\/([\w\.]+)/i],[[h,/(.+)/,"$1 Secure "+fe],l],[/\bfocus\/([\w\.]+)/i],[l,[h,me+" Focus"]],[/\bopt\/([\w\.]+)/i],[l,[h,te+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[l,[h,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[l,[h,"Dolphin"]],[/coast\/([\w\.]+)/i],[l,[h,te+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[l,[h,"MIUI"+Tt]],[/fxios\/([\w\.-]+)/i],[l,[h,me]],[/\bqihoobrowser\/?([\w\.]*)/i],[l,[h,"360"]],[/\b(qq)\/([\w\.]+)/i],[[h,/(.+)/,"$1Browser"],l],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[h,/(.+)/,"$1"+Tt],l],[/samsungbrowser\/([\w\.]+)/i],[l,[h,ie+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[l,[h,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[h,"Sogou Mobile"],l],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[h,l],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[h],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[l,h],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[h,Et],l],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\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],[h,l],[/\bgsa\/([\w\.]+) .*safari\//i],[l,[h,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[l,[h,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[l,[h,pe+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[h,pe+" WebView"],l],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[l,[h,"Android "+fe]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[h,l],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[l,[h,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[l,h],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[h,[l,ge,Li]],[/(webkit|khtml)\/([\w\.]+)/i],[h,l],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[h,"Netscape"],l],[/(wolvic|librewolf)\/([\w\.]+)/i],[h,l],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[l,[h,me+" 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,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[h,[l,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[h,[l,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[L,"amd64"]],[/(ia32(?=;))/i],[[L,H]],[/((?:i[346]|x)86)[;\)]/i],[[L,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[L,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[L,"armhf"]],[/windows (ce|mobile); ppc;/i],[[L,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[L,/ower/,c,H]],[/(sun4\w)[;\)]/i],[[L,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[L,H]]],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],[r,[a,ie],[o,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],[r,[a,ie],[o,p]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[r,[a,Z],[o,p]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[r,[a,Z],[o,m]],[/(macintosh);/i],[r,[a,Z]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[r,[a,_t],[o,p]],[/(?:honor)([-\w ]+)[;\)]/i],[r,[a,"Honor"],[o,p]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[r,[a,vt],[o,m]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[r,[a,vt],[o,p]],[/\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],[[r,/_/g," "],[a,ze],[o,p]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[r,/_/g," "],[a,ze],[o,m]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[r,[a,"OPPO"],[o,p]],[/\b(opd2\d{3}a?) bui/i],[r,[a,"OPPO"],[o,m]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[r,[a,"Vivo"],[o,p]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[r,[a,"Realme"],[o,p]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[r,[a,kt],[o,p]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[r,[a,kt],[o,m]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[r,[a,Fe],[o,m]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[r,[a,Fe],[o,p]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[r,[a,"Lenovo"],[o,m]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[r,/_/g," "],[a,"Nokia"],[o,p]],[/(pixel c)\b/i],[r,[a,ee],[o,m]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[r,[a,ee],[o,p]],[/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],[r,[a,we],[o,p]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[r,"Xperia Tablet"],[a,we],[o,m]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[r,[a,"OnePlus"],[o,p]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[r,[a,de],[o,m]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[r,/(.+)/g,"Fire Phone $1"],[a,de],[o,p]],[/(playbook);[-\w\),; ]+(rim)/i],[r,a,[o,m]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[r,[a,yt],[o,p]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[r,[a,gt],[o,m]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[r,[a,gt],[o,p]],[/(nexus 9)/i],[r,[a,"HTC"],[o,m]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[a,[r,/_/g," "],[o,p]],[/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],[r,[a,"TCL"],[o,m]],[/(itel) ((\w+))/i],[[a,H],r,[o,ge,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[r,[a,"Acer"],[o,m]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[r,[a,"Meizu"],[o,p]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[r,[a,"Ulefone"],[o,p]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[r,[a,"Energizer"],[o,p]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[r,[a,"Cat"],[o,p]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[r,[a,"Smartfren"],[o,p]],[/droid.+; (a(?:015|06[35]|142p?))/i],[r,[a,"Nothing"],[o,p]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (imo) ((?!tab)[\w ]+?)(?: bui|\))/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[a,r,[o,p]],[/(imo) (tab \w+)/i,/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/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],[a,r,[o,m]],[/(surface duo)/i],[r,[a,Ve],[o,m]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[r,[a,"Fairphone"],[o,p]],[/(u304aa)/i],[r,[a,"AT&T"],[o,p]],[/\bsie-(\w*)/i],[r,[a,"Siemens"],[o,p]],[/\b(rct\w+) b/i],[r,[a,"RCA"],[o,m]],[/\b(venue[\d ]{2,7}) b/i],[r,[a,"Dell"],[o,m]],[/\b(q(?:mv|ta)\w+) b/i],[r,[a,"Verizon"],[o,m]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[r,[a,"Barnes & Noble"],[o,m]],[/\b(tm\d{3}\w+) b/i],[r,[a,"NuVision"],[o,m]],[/\b(k88) b/i],[r,[a,"ZTE"],[o,m]],[/\b(nx\d{3}j) b/i],[r,[a,"ZTE"],[o,p]],[/\b(gen\d{3}) b.+49h/i],[r,[a,"Swiss"],[o,p]],[/\b(zur\d{3}) b/i],[r,[a,"Swiss"],[o,m]],[/\b((zeki)?tb.*\b) b/i],[r,[a,"Zeki"],[o,m]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[a,"Dragon Touch"],r,[o,m]],[/\b(ns-?\w{0,9}) b/i],[r,[a,"Insignia"],[o,m]],[/\b((nxa|next)-?\w{0,9}) b/i],[r,[a,"NextBook"],[o,m]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[a,"Voice"],r,[o,p]],[/\b(lvtel\-)?(v1[12]) b/i],[[a,"LvTel"],r,[o,p]],[/\b(ph-1) /i],[r,[a,"Essential"],[o,p]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[r,[a,"Envizen"],[o,m]],[/\b(trio[-\w\. ]+) b/i],[r,[a,"MachSpeed"],[o,m]],[/\btu_(1491) b/i],[r,[a,"Rotor"],[o,m]],[/(shield[\w ]+) b/i],[r,[a,"Nvidia"],[o,m]],[/(sprint) (\w+)/i],[a,r,[o,p]],[/(kin\.[onetw]{3})/i],[[r,/\./g," "],[a,Ve],[o,p]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[r,[a,We],[o,m]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[r,[a,We],[o,p]],[/smart-tv.+(samsung)/i],[a,[o,O]],[/hbbtv.+maple;(\d+)/i],[[r,/^/,"SmartTV"],[a,ie],[o,O]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[a,Fe],[o,O]],[/(apple) ?tv/i],[a,[r,Z+" TV"],[o,O]],[/crkey/i],[[r,pe+"cast"],[a,ee],[o,O]],[/droid.+aft(\w+)( bui|\))/i],[r,[a,de],[o,O]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[r,[a,_t],[o,O]],[/(bravia[\w ]+)( bui|\))/i],[r,[a,we],[o,O]],[/(mitv-\w{5}) bui/i],[r,[a,ze],[o,O]],[/Hbbtv.*(technisat) (.*);/i],[a,r,[o,O]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[a,He],[r,He],[o,O]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[o,O]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[a,r,[o,$]],[/droid.+; (shield) bui/i],[r,[a,"Nvidia"],[o,$]],[/(playstation [345portablevi]+)/i],[r,[a,we],[o,$]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[r,[a,Ve],[o,$]],[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],[r,[a,ie],[o,F]],[/((pebble))app/i],[a,r,[o,F]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[r,[a,Z],[o,F]],[/droid.+; (glass) \d/i],[r,[a,ee],[o,F]],[/droid.+; (wt63?0{2,3})\)/i],[r,[a,We],[o,F]],[/droid.+; (glass) \d/i],[r,[a,ee],[o,F]],[/(pico) (4|neo3(?: link|pro)?)/i],[a,r,[o,F]],[/; (quest( \d| pro)?)/i],[r,[a,Et],[o,F]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[a,[o,qe]],[/(aeobc)\b/i],[r,[a,de],[o,qe]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[r,[o,p]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[r,[o,m]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[o,m]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[o,p]],[/(android[-\w\. ]{0,9});.+buil/i],[r,[a,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[l,[h,xi+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[h,l],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[l,[h,"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],[h,l],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[l,h]],os:[[/microsoft (windows) (vista|xp)/i],[h,l],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[h,[l,ge,Ot]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[l,ge,Ot],[h,"Windows"]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[l,/_/g,"."],[h,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[h,St],[l,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[l,h],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish|openharmony)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[h,l],[/\(bb(10);/i],[l,[h,yt]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[l,[h,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[l,[h,me+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[l,[h,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[l,[h,"watchOS"]],[/crkey\/([\d\.]+)/i],[l,[h,pe+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[h,Ct],l],[/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) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[h,l],[/(sunos) ?([\w\.\d]*)/i],[[h,"Solaris"],l],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[h,l]]},N=function(b,v){if(typeof b===R&&(v=b,b=s),!(this instanceof N))return new N(b,v).getResult();var f=typeof t!==y&&t.navigator?t.navigator:s,E=b||(f&&f.userAgent?f.userAgent:c),V=f&&f.userAgentData?f.userAgentData:s,P=v?Ri(xt,v):xt,k=f&&f.userAgent==E;return this.getBrowser=function(){var d={};return d[h]=s,d[l]=s,se.call(d,E,P.browser),d[I]=Bi(d[l]),k&&f&&f.brave&&typeof f.brave.isBrave==g&&(d[h]="Brave"),d},this.getCPU=function(){var d={};return d[L]=s,se.call(d,E,P.cpu),d},this.getDevice=function(){var d={};return d[a]=s,d[r]=s,d[o]=s,se.call(d,E,P.device),k&&!d[o]&&V&&V.mobile&&(d[o]=p),k&&d[r]=="Macintosh"&&f&&typeof f.standalone!==y&&f.maxTouchPoints&&f.maxTouchPoints>2&&(d[r]="iPad",d[o]=m),d},this.getEngine=function(){var d={};return d[h]=s,d[l]=s,se.call(d,E,P.engine),d},this.getOS=function(){var d={};return d[h]=s,d[l]=s,se.call(d,E,P.os),k&&!d[h]&&V&&V.platform&&V.platform!="Unknown"&&(d[h]=V.platform.replace(/chrome os/i,Ct).replace(/macos/i,St)),d},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 E},this.setUA=function(d){return E=typeof d===T&&d.length>Ie?He(d,Ie):d,this},this.setUA(E),this};N.VERSION=n,N.BROWSER=be([h,l,I]),N.CPU=be([L]),N.DEVICE=be([r,a,o,$,p,O,m,F,qe]),N.ENGINE=N.OS=be([h,l]),i.exports&&(e=i.exports=N),e.UAParser=N;var K=typeof t!==y&&(t.jQuery||t.Zepto);if(K&&!K.ua){var ye=new N;K.ua=ye.getResult(),K.ua.get=function(){return ye.getUA()},K.ua.set=function(b){ye.setUA(b);var v=ye.getResult();for(var f in v)K.ua[f]=v[f]}}})(typeof window=="object"?window:Pt)})(_e,_e.exports);var Ee=_e.exports;class je{static isDesktopDevice(){var s;if("orientation"in window)return!1;const e="(any-pointer: coarse)",t=(s=window.matchMedia)==null?void 0:s.call(window,e);return navigator.maxTouchPoints===0||(t==null?void 0:t.media)===e&&!(t!=null&&t.matches)}static isIpad(e){return new Ee.UAParser(e).getDevice().vendor==="Apple"&&window.screen.width===820&&window.screen.height===1180&&window.screen.colorDepth===32&&window.screen.pixelDepth===32}static getBrowserName(){var e;return((e=Ee.UAParser(navigator.userAgent).browser.name)==null?void 0:e.toLowerCase())??""}static getBrowserVersion(){var e;return((e=Ee.UAParser(navigator.userAgent).browser.version)==null?void 0:e.toLowerCase())??""}}class Ut{constructor(e){this.barcodeLinkUrl=e}async sendMetric(e){try{await fetch(new URL("/api/metrics/ingest?uiless=true",this.barcodeLinkUrl),{method:"POST",body:JSON.stringify(e),headers:new Headers({"content-type":"application/json"})})}catch(t){console.warn("error while sending metric",t)}}getBrowserMetricData(){return{browser:je.getBrowserName(),browserVersion:je.getBrowserVersion().split(".").slice(0,2).join(".")}}}var G=(i=>(i.AllOthersDisconnected="allOthersDisconnected",i.Capture="capture",i.Configuration="configuration",i.RemoteScanStarted="remoteScanStarted",i.AllOthersReconnected="allOthersReconnected",i))(G||{});const D=Object.create(null);D.open="0",D.close="1",D.ping="2",D.pong="3",D.message="4",D.upgrade="5",D.noop="6";const ne=Object.create(null);Object.keys(D).forEach(i=>{ne[D[i]]=i});const Ce={type:"error",data:"parser error"},Ge=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Xe=typeof ArrayBuffer=="function",Je=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i&&i.buffer instanceof ArrayBuffer,Se=({type:i,data:e},t,s)=>Ge&&e instanceof Blob?t?s(e):Qe(e,s):Xe&&(e instanceof ArrayBuffer||Je(e))?t?s(e):Qe(new Blob([e]),s):s(D[i]+(e||"")),Qe=(i,e)=>{const t=new FileReader;return t.onload=function(){const s=t.result.split(",")[1];e("b"+(s||""))},t.readAsDataURL(i)};function $e(i){return i instanceof Uint8Array?i:i instanceof ArrayBuffer?new Uint8Array(i):new Uint8Array(i.buffer,i.byteOffset,i.byteLength)}let Te;function qt(i,e){if(Ge&&i.data instanceof Blob)return i.data.arrayBuffer().then($e).then(e);if(Xe&&(i.data instanceof ArrayBuffer||Je(i.data)))return e($e(i.data));Se(i,!1,t=>{Te||(Te=new TextEncoder),e(Te.encode(t))})}const Ze="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",X=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let i=0;i<Ze.length;i++)X[Ze.charCodeAt(i)]=i;const It=i=>{let e=i.length*.75,t=i.length,s,n=0,c,u,g,y;i[i.length-1]==="="&&(e--,i[i.length-2]==="="&&e--);const R=new ArrayBuffer(e),T=new Uint8Array(R);for(s=0;s<t;s+=4)c=X[i.charCodeAt(s)],u=X[i.charCodeAt(s+1)],g=X[i.charCodeAt(s+2)],y=X[i.charCodeAt(s+3)],T[n++]=c<<2|u>>4,T[n++]=(u&15)<<4|g>>2,T[n++]=(g&3)<<6|y&63;return R},Ft=typeof ArrayBuffer=="function",Ae=(i,e)=>{if(typeof i!="string")return{type:"message",data:et(i,e)};const t=i.charAt(0);return t==="b"?{type:"message",data:Vt(i.substring(1),e)}:ne[t]?i.length>1?{type:ne[t],data:i.substring(1)}:{type:ne[t]}:Ce},Vt=(i,e)=>{if(Ft){const t=It(i);return et(t,e)}else return{base64:!0,data:i}},et=(i,e)=>{switch(e){case"blob":return i instanceof Blob?i:new Blob([i]);case"arraybuffer":default:return i instanceof ArrayBuffer?i:i.buffer}},tt="",zt=(i,e)=>{const t=i.length,s=new Array(t);let n=0;i.forEach((c,u)=>{Se(c,!1,g=>{s[u]=g,++n===t&&e(s.join(tt))})})},Wt=(i,e)=>{const t=i.split(tt),s=[];for(let n=0;n<t.length;n++){const c=Ae(t[n],e);if(s.push(c),c.type==="error")break}return s};function Ht(){return new TransformStream({transform(i,e){qt(i,t=>{const s=t.length;let n;if(s<126)n=new Uint8Array(1),new DataView(n.buffer).setUint8(0,s);else if(s<65536){n=new Uint8Array(3);const c=new DataView(n.buffer);c.setUint8(0,126),c.setUint16(1,s)}else{n=new Uint8Array(9);const c=new DataView(n.buffer);c.setUint8(0,127),c.setBigUint64(1,BigInt(s))}i.data&&typeof i.data!="string"&&(n[0]|=128),e.enqueue(n),e.enqueue(t)})}})}let Oe;function re(i){return i.reduce((e,t)=>e+t.length,0)}function oe(i,e){if(i[0].length===e)return i.shift();const t=new Uint8Array(e);let s=0;for(let n=0;n<e;n++)t[n]=i[0][s++],s===i[0].length&&(i.shift(),s=0);return i.length&&s<i[0].length&&(i[0]=i[0].slice(s)),t}function Kt(i,e){Oe||(Oe=new TextDecoder);const t=[];let s=0,n=-1,c=!1;return new TransformStream({transform(u,g){for(t.push(u);;){if(s===0){if(re(t)<1)break;const y=oe(t,1);c=(y[0]&128)===128,n=y[0]&127,n<126?s=3:n===126?s=1:s=2}else if(s===1){if(re(t)<2)break;const y=oe(t,2);n=new DataView(y.buffer,y.byteOffset,y.length).getUint16(0),s=3}else if(s===2){if(re(t)<8)break;const y=oe(t,8),R=new DataView(y.buffer,y.byteOffset,y.length),T=R.getUint32(0);if(T>Math.pow(2,21)-1){g.enqueue(Ce);break}n=T*Math.pow(2,32)+R.getUint32(4),s=3}else{if(re(t)<n)break;const y=oe(t,n);g.enqueue(Ae(c?y:Oe.decode(y),e)),s=0}if(n===0||n>i){g.enqueue(Ce);break}}}})}const it=4;function C(i){if(i)return Yt(i)}function Yt(i){for(var e in C.prototype)i[e]=C.prototype[e];return i}C.prototype.on=C.prototype.addEventListener=function(i,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+i]=this._callbacks["$"+i]||[]).push(e),this},C.prototype.once=function(i,e){function t(){this.off(i,t),e.apply(this,arguments)}return t.fn=e,this.on(i,t),this},C.prototype.off=C.prototype.removeListener=C.prototype.removeAllListeners=C.prototype.removeEventListener=function(i,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+i];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+i],this;for(var s,n=0;n<t.length;n++)if(s=t[n],s===e||s.fn===e){t.splice(n,1);break}return t.length===0&&delete this._callbacks["$"+i],this},C.prototype.emit=function(i){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+i],s=1;s<arguments.length;s++)e[s-1]=arguments[s];if(t){t=t.slice(0);for(var s=0,n=t.length;s<n;++s)t[s].apply(this,e)}return this},C.prototype.emitReserved=C.prototype.emit,C.prototype.listeners=function(i){return this._callbacks=this._callbacks||{},this._callbacks["$"+i]||[]},C.prototype.hasListeners=function(i){return!!this.listeners(i).length};const x=typeof self<"u"?self:typeof window<"u"?window:Function("return this")();function st(i,...e){return e.reduce((t,s)=>(i.hasOwnProperty(s)&&(t[s]=i[s]),t),{})}const jt=x.setTimeout,Gt=x.clearTimeout;function ae(i,e){e.useNativeTimers?(i.setTimeoutFn=jt.bind(x),i.clearTimeoutFn=Gt.bind(x)):(i.setTimeoutFn=x.setTimeout.bind(x),i.clearTimeoutFn=x.clearTimeout.bind(x))}const Xt=1.33;function Jt(i){return typeof i=="string"?Qt(i):Math.ceil((i.byteLength||i.size)*Xt)}function Qt(i){let e=0,t=0;for(let s=0,n=i.length;s<n;s++)e=i.charCodeAt(s),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(s++,t+=4);return t}function $t(i){let e="";for(let t in i)i.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(i[t]));return e}function Zt(i){let e={},t=i.split("&");for(let s=0,n=t.length;s<n;s++){let c=t[s].split("=");e[decodeURIComponent(c[0])]=decodeURIComponent(c[1])}return e}class ei extends Error{constructor(e,t,s){super(e),this.description=t,this.context=s,this.type="TransportError"}}class xe extends C{constructor(e){super(),this.writable=!1,ae(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,t,s){return super.emitReserved("error",new ei(e,t,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=Ae(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const t=$t(e);return t.length?"?"+t:""}}const nt="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),Re=64,ti={};let rt=0,ce=0,ot;function at(i){let e="";do e=nt[i%Re]+e,i=Math.floor(i/Re);while(i>0);return e}function ct(){const i=at(+new Date);return i!==ot?(rt=0,ot=i):i+"."+at(rt++)}for(;ce<Re;ce++)ti[nt[ce]]=ce;let ht=!1;try{ht=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const ii=ht;function lt(i){const e=i.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||ii))return new XMLHttpRequest}catch{}if(!e)try{return new x[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}function Mi(){}function si(){}const ni=function(){return new lt({xdomain:!1}).responseType!=null}();class ri extends xe{constructor(e){if(super(e),this.polling=!1,typeof location<"u"){const s=location.protocol==="https:";let n=location.port;n||(n=s?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||n!==e.port}const t=e&&e.forceBase64;this.supportsBinary=ni&&!t,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this.polling||!this.writable){let s=0;this.polling&&(s++,this.once("pollComplete",function(){--s||t()})),this.writable||(s++,this.once("drain",function(){--s||t()}))}else t()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const t=s=>{if(this.readyState==="opening"&&s.type==="open"&&this.onOpen(),s.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(s)};Wt(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,zt(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=ct()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}request(e={}){return Object.assign(e,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new M(this.uri(),e)}doWrite(e,t){const s=this.request({method:"POST",data:e});s.on("success",t),s.on("error",(n,c)=>{this.onError("xhr post error",n,c)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,s)=>{this.onError("xhr poll error",t,s)}),this.pollXhr=e}}class M extends C{constructor(e,t){super(),ae(this,t),this.opts=t,this.method=t.method||"GET",this.uri=e,this.data=t.data!==void 0?t.data:null,this.create()}create(){var e;const t=st(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this.opts.xd;const s=this.xhr=new lt(t);try{s.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let n in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(n)&&s.setRequestHeader(n,this.opts.extraHeaders[n])}}catch{}if(this.method==="POST")try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{s.setRequestHeader("Accept","*/*")}catch{}(e=this.opts.cookieJar)===null||e===void 0||e.addCookies(s),"withCredentials"in s&&(s.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(s.timeout=this.opts.requestTimeout),s.onreadystatechange=()=>{var n;s.readyState===3&&((n=this.opts.cookieJar)===null||n===void 0||n.parseCookies(s)),s.readyState===4&&(s.status===200||s.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof s.status=="number"?s.status:0)},0))},s.send(this.data)}catch(n){this.setTimeoutFn(()=>{this.onError(n)},0);return}typeof document<"u"&&(this.index=M.requestsCount++,M.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=si,e)try{this.xhr.abort()}catch{}typeof document<"u"&&delete M.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}if(M.requestsCount=0,M.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",ut);else if(typeof addEventListener=="function"){const i="onpagehide"in x?"pagehide":"unload";addEventListener(i,ut,!1)}}function ut(){for(let i in M.requests)M.requests.hasOwnProperty(i)&&M.requests[i].abort()}const Be=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),he=x.WebSocket||x.MozWebSocket,dt=!0,oi="arraybuffer",ft=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class ai extends xe{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),t=this.opts.protocols,s=ft?{}:st(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=dt&&!ft?t?new he(e,t):new he(e):new he(e,t,s)}catch(n){return this.emitReserved("error",n)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const s=e[t],n=t===e.length-1;Se(s,this.supportsBinary,c=>{const u={};try{dt&&this.ws.send(c)}catch{}n&&Be(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=ct()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}check(){return!!he}}class ci extends xe{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(e=>{const t=Kt(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=e.readable.pipeThrough(t).getReader(),n=Ht();n.readable.pipeTo(e.writable),this.writer=n.writable.getWriter();const c=()=>{s.read().then(({done:g,value:y})=>{g||(this.onPacket(y),c())}).catch(g=>{})};c();const u={type:"open"};this.query.sid&&(u.data=`{"sid":"${this.query.sid}"}`),this.writer.write(u).then(()=>this.onOpen())})}))}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const s=e[t],n=t===e.length-1;this.writer.write(s).then(()=>{n&&Be(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this.transport)===null||e===void 0||e.close()}}const hi={websocket:ai,webtransport:ci,polling:ri},li=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,ui=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Le(i){const e=i,t=i.indexOf("["),s=i.indexOf("]");t!=-1&&s!=-1&&(i=i.substring(0,t)+i.substring(t,s).replace(/:/g,";")+i.substring(s,i.length));let n=li.exec(i||""),c={},u=14;for(;u--;)c[ui[u]]=n[u]||"";return t!=-1&&s!=-1&&(c.source=e,c.host=c.host.substring(1,c.host.length-1).replace(/;/g,":"),c.authority=c.authority.replace("[","").replace("]","").replace(/;/g,":"),c.ipv6uri=!0),c.pathNames=di(c,c.path),c.queryKey=fi(c,c.query),c}function di(i,e){const t=/\/{2,9}/g,s=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&s.splice(0,1),e.slice(-1)=="/"&&s.splice(s.length-1,1),s}function fi(i,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,n,c){n&&(t[n]=c)}),t}let pt=class Y extends C{constructor(e,t={}){super(),this.binaryType=oi,this.writeBuffer=[],e&&typeof e=="object"&&(t=e,e=null),e?(e=Le(e),t.hostname=e.host,t.secure=e.protocol==="https"||e.protocol==="wss",t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=Le(t.host).host),ae(this,t),this.secure=t.secure!=null?t.secure:typeof location<"u"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=t.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=t.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Zt(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=it,t.transport=e,this.id&&(t.sid=this.id);const s=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new hi[e](s)}open(){let e;if(this.opts.rememberUpgrade&&Y.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)e="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else e=this.transports[0];this.readyState="opening";try{e=this.createTransport(e)}catch{this.transports.shift(),this.open();return}e.open(),this.setTransport(e)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",t=>this.onClose("transport close",t))}probe(e){let t=this.createTransport(e),s=!1;Y.priorWebsocketSuccess=!1;const n=()=>{s||(t.send([{type:"ping",data:"probe"}]),t.once("packet",I=>{if(!s)if(I.type==="pong"&&I.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;Y.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(T(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const r=new Error("probe error");r.transport=t.name,this.emitReserved("upgradeError",r)}}))};function c(){s||(s=!0,T(),t.close(),t=null)}const u=I=>{const r=new Error("probe error: "+I);r.transport=t.name,c(),this.emitReserved("upgradeError",r)};function g(){u("transport closed")}function y(){u("socket closed")}function R(I){t&&I.name!==t.name&&c()}const T=()=>{t.removeListener("open",n),t.removeListener("error",u),t.removeListener("close",g),this.off("close",y),this.off("upgrading",R)};t.once("open",n),t.once("error",u),t.once("close",g),this.once("close",y),this.once("upgrading",R),this.upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{s||t.open()},200):t.open()}onOpen(){if(this.readyState="open",Y.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let e=0;const t=this.upgrades.length;for(;e<t;e++)this.probe(this.upgrades[e])}}onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),this.resetPingTimeout(),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const t=new Error("server error");t.code=e.data,this.onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn(()=>{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let s=0;s<this.writeBuffer.length;s++){const n=this.writeBuffer[s].data;if(n&&(t+=Jt(n)),s>0&&t>this.maxPayload)return this.writeBuffer.slice(0,s);t+=2}return this.writeBuffer}write(e,t,s){return this.sendPacket("message",e,t,s),this}send(e,t,s){return this.sendPacket("message",e,t,s),this}sendPacket(e,t,s,n){if(typeof t=="function"&&(n=t,t=void 0),typeof s=="function"&&(n=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;s=s||{},s.compress=s.compress!==!1;const c={type:e,data:t,options:s};this.emitReserved("packetCreate",c),this.writeBuffer.push(c),n&&this.once("flush",n),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},s=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():e()}):this.upgrading?s():e()),this}onError(e){Y.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,t){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){const t=[];let s=0;const n=e.length;for(;s<n;s++)~this.transports.indexOf(e[s])&&t.push(e[s]);return t}};pt.protocol=it;function pi(i,e="",t){let s=i;t=t||typeof location<"u"&&location,i==null&&(i=t.protocol+"//"+t.host),typeof i=="string"&&(i.charAt(0)==="/"&&(i.charAt(1)==="/"?i=t.protocol+i:i=t.host+i),/^(https?|wss?):\/\//.test(i)||(typeof t<"u"?i=t.protocol+"//"+i:i="https://"+i),s=Le(i)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";const c=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+c+":"+s.port+e,s.href=s.protocol+"://"+c+(t&&t.port===s.port?"":":"+s.port),s}const mi=typeof ArrayBuffer=="function",wi=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i.buffer instanceof ArrayBuffer,mt=Object.prototype.toString,bi=typeof Blob=="function"||typeof Blob<"u"&&mt.call(Blob)==="[object BlobConstructor]",gi=typeof File=="function"