@mapsindoors/map-template 1.95.1 → 1.95.2

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.
Files changed (66) hide show
  1. package/dist/{GoogleMapsMap-C5n6Bgtp.mjs → GoogleMapsMap-Dkn60-_e.mjs} +2 -2
  2. package/dist/{MapboxMap-UCqzt1AC.mjs → MapboxMap-B1oo7IUm.mjs} +2 -2
  3. package/dist/_commonjsHelpers-B85MJLTf.js +5 -0
  4. package/dist/app-globals-DQuL1Twl.js +3 -0
  5. package/dist/combo-box-item.entry.js +8 -10
  6. package/dist/icon-DT_sDkmK.js +11 -0
  7. package/dist/index-BZQHyS7V.js +1701 -0
  8. package/dist/loader.js +7 -14
  9. package/dist/mapsindoors-react.es.js +1 -1
  10. package/dist/mapsindoors-react.umd.js +175 -175
  11. package/dist/mapsindoors-webcomponent.es.js +2916 -2904
  12. package/dist/mi-card_2.entry.js +23 -18
  13. package/dist/mi-chip.entry.js +25 -16
  14. package/dist/mi-column.entry.js +47 -23
  15. package/dist/mi-combo-box.entry.js +412 -379
  16. package/dist/mi-components.js +15 -12
  17. package/dist/mi-data-table.entry.js +298 -278
  18. package/dist/mi-distance_2.entry.js +58 -56
  19. package/dist/mi-dropdown-item.entry.js +8 -10
  20. package/dist/mi-dropdown.entry.js +525 -481
  21. package/dist/mi-floor-selector.entry.js +183 -180
  22. package/dist/mi-keyboard.entry.js +207 -186
  23. package/dist/mi-list-item-category.entry.js +44 -41
  24. package/dist/mi-list-item-location.entry.js +168 -162
  25. package/dist/mi-list.entry.js +56 -48
  26. package/dist/mi-location-booking.entry.js +320 -295
  27. package/dist/mi-location-info.entry.js +61 -53
  28. package/dist/mi-map-googlemaps.entry.js +369 -324
  29. package/dist/mi-map-mapbox.entry.js +502 -439
  30. package/dist/mi-metric-card.entry.js +50 -37
  31. package/dist/mi-my-position.entry.js +2341 -874
  32. package/dist/mi-notification.entry.js +112 -102
  33. package/dist/mi-route-instructions-heading.entry.js +70 -65
  34. package/dist/mi-route-instructions-maneuver-legacy.entry.js +80 -76
  35. package/dist/mi-route-instructions-maneuver.entry.js +80 -76
  36. package/dist/mi-route-instructions-step-legacy.entry.js +296 -282
  37. package/dist/mi-route-instructions-step.entry.js +313 -292
  38. package/dist/mi-route-instructions.entry.js +167 -150
  39. package/dist/mi-scroll-buttons.entry.js +104 -98
  40. package/dist/mi-search.entry.js +366 -325
  41. package/dist/mi-share-sms.entry.js +82 -70
  42. package/dist/mi-step-switcher.entry.js +34 -25
  43. package/dist/mi-tab-panel.entry.js +18 -18
  44. package/dist/mi-tab.entry.js +5 -7
  45. package/dist/mi-tabs.entry.js +42 -40
  46. package/dist/mi-time.entry.js +49 -49
  47. package/dist/mi-variables-CDNvnTkH.js +5 -0
  48. package/dist/{reactcomponent-DQsjxRIN.mjs → reactcomponent-2Oa1vSiK.mjs} +8996 -8660
  49. package/dist/route-travel-mode.enum-BvqP1fpw.js +9 -0
  50. package/dist/sort-order.enum-jsLAbYWg.js +566 -0
  51. package/dist/{unit-system.enum-eaefb53e.js → unit-system.enum-BwPgAWqL.js} +2 -2
  52. package/dist/utils-DNHzysQ6.js +61 -0
  53. package/package.json +1 -1
  54. package/dist/_commonjsHelpers-ba3f0406.js +0 -21
  55. package/dist/icon-b8d01d6f.js +0 -24
  56. package/dist/index-7e9696f3.js +0 -1678
  57. package/dist/mi-variables-9a6c8d4d.js +0 -6
  58. package/dist/polyfills/core-js.js +0 -11
  59. package/dist/polyfills/css-shim.js +0 -1
  60. package/dist/polyfills/dom.js +0 -79
  61. package/dist/polyfills/es5-html-element.js +0 -1
  62. package/dist/polyfills/index.js +0 -34
  63. package/dist/polyfills/system.js +0 -6
  64. package/dist/route-travel-mode.enum-7f4ce9c7.js +0 -9
  65. package/dist/sort-order.enum-64ce8998.js +0 -552
  66. package/dist/utils-ae714467.js +0 -61
@@ -1,223 +1,1689 @@
1
- import { r as registerInstance, c as createEvent, h, H as Host } from './index-7e9696f3.js';
2
- import { c as createCommonjsModule, a as commonjsGlobal } from './_commonjsHelpers-ba3f0406.js';
3
-
4
- var uaParser_pack = createCommonjsModule(function (module, exports) {
5
- /* UAParser.js v2.0.3
6
- Copyright © 2012-2025 Faisal Salman <f@faisalman.com>
7
- AGPLv3 License */
8
- ((i,l)=>{function U(i){for(var e={},t=0;t<i.length;t++)e[i[t].toUpperCase()]=i[t];return e}var E=500,P="user-agent",w="",B="?",R="function",n="undefined",c="object",V="string",u="browser",h="cpu",p="device",m="engine",f="os",g="result",v="name",k="type",x="vendor",y="version",C="architecture",L="major",T="model",G="console",S="mobile",r="tablet",e="smarttv",t="wearable",F="xr",D="embedded",$="inapp",W="brands",_="formFactors",X="fullVersionList",q="platform",Y="platformVersion",K="bitness",o="sec-ch-ua",Q=o+"-full-version-list",Z=o+"-arch",J=o+"-"+K,ii=o+"-form-factors",ei=o+"-"+S,ti=o+"-"+T,oi=o+"-"+q,ri=oi+"-version",ai=[W,X,S,T,q,Y,C,_,K],si="Amazon",a="Apple",ni="ASUS",wi="BlackBerry",s="Google",bi="Huawei",di="Microsoft",li="Motorola",ci="Nvidia",ui="OnePlus",hi="OPPO",pi="Samsung",mi="Sony",fi="Xiaomi",gi="Zebra",vi="Chromium",b="Chromecast",ki="Firefox",d="Opera",xi="Facebook",A="Mobile ",yi=" Browser",Ci="Windows",Ti=typeof i!==n,z=Ti&&i.navigator?i.navigator:l,O=z&&z.userAgentData?z.userAgentData:l,Si=function(i,e){if(typeof i===c&&0<i.length){for(var t in i)if(M(i[t])==M(e))return !0;return !1}return !!H(i)&&-1!==M(e).indexOf(M(i))},_i=function(i,e){for(var t in i)return /^(browser|cpu|device|engine|os)$/.test(t)||!!e&&_i(i[t])},H=function(i){return typeof i===V},qi=function(i){if(!i)return l;for(var e,t=[],o=zi(/\\?\"/g,i).split(","),r=0;r<o.length;r++)-1<o[r].indexOf(";")?(e=Hi(o[r]).split(";v="),t[r]={brand:e[0],version:e[1]}):t[r]=Hi(o[r]);return t},M=function(i){return H(i)?i.toLowerCase():i},Ai=function(i){return H(i)?zi(/[^\d\.]/g,i).split(".")[0]:l},j=function(i){for(var e in i){e=i[e];typeof e==c&&2==e.length?this[e[0]]=e[1]:this[e]=l;}return this},zi=function(i,e){return H(e)?e.replace(i,w):e},Oi=function(i){return zi(/\\?\"/g,i)},Hi=function(i,e){if(H(i))return i=zi(/^\s\s*/,i),typeof e===n?i:i.substring(0,E)},Mi=function(i,e){if(i&&e)for(var t,o,r,a,s,n=0;n<e.length&&!a;){for(var w=e[n],b=e[n+1],d=t=0;d<w.length&&!a&&w[d];)if(a=w[d++].exec(i))for(o=0;o<b.length;o++)s=a[++t],typeof(r=b[o])===c&&0<r.length?2===r.length?typeof r[1]==R?this[r[0]]=r[1].call(this,s):this[r[0]]=r[1]:3===r.length?typeof r[1]!==R||r[1].exec&&r[1].test?this[r[0]]=s?s.replace(r[1],r[2]):l:this[r[0]]=s?r[1].call(this,s,r[2]):l:4===r.length&&(this[r[0]]=s?r[3].call(this,s.replace(r[1],r[2])):l):this[r]=s||l;n+=2;}},N=function(i,e){for(var t in e)if(typeof e[t]===c&&0<e[t].length){for(var o=0;o<e[t].length;o++)if(Si(e[t][o],i))return t===B?l:t}else if(Si(e[t],i))return t===B?l:t;return e.hasOwnProperty("*")?e["*"]:i},ji={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"},Ni={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:"Watch",xr:["VR","XR"],"?":["Desktop","Unknown"],"*":l},Ii={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[y,[v,A+"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[y,[v,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[v,y],[/opios[\/ ]+([\w\.]+)/i],[y,[v,d+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[y,[v,d+" GX"]],[/\bopr\/([\w\.]+)/i],[y,[v,d]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[y,[v,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[y,[v,"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|otter|dooble|(?:lg |qute)browser)\/([-\w\.]+)/i,/(heytap|ovi|115|surf)browser\/([\d\.]+)/i,/(ecosia|weibo)(?:__| \w+@)([\d\.]+)/i],[v,y],[/quark(?:pc)?\/([-\w\.]+)/i],[y,[v,"Quark"]],[/\bddg\/([\w\.]+)/i],[y,[v,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[y,[v,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[y,[v,"WeChat"]],[/konqueror\/([\w\.]+)/i],[y,[v,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[y,[v,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[y,[v,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[y,[v,"Smart Lenovo"+yi]],[/(avast|avg)\/([\w\.]+)/i],[[v,/(.+)/,"$1 Secure"+yi],y],[/\bfocus\/([\w\.]+)/i],[y,[v,ki+" Focus"]],[/\bopt\/([\w\.]+)/i],[y,[v,d+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[y,[v,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[y,[v,"Dolphin"]],[/coast\/([\w\.]+)/i],[y,[v,d+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[y,[v,"MIUI"+yi]],[/fxios\/([\w\.-]+)/i],[y,[v,A+ki]],[/\bqihoobrowser\/?([\w\.]*)/i],[y,[v,"360"]],[/\b(qq)\/([\w\.]+)/i],[[v,/(.+)/,"$1Browser"],y],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[v,/(.+)/,"$1"+yi],y],[/samsungbrowser\/([\w\.]+)/i],[y,[v,pi+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[y,[v,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[v,"Sogou Mobile"],y],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[v,y],[/(lbbrowser|rekonq)/i],[v],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[y,v],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[v,xi],y,[k,$]],[/(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,/(instagram|snapchat)[\/ ]([-\w\.]+)/i],[v,y,[k,$]],[/\bgsa\/([\w\.]+) .*safari\//i],[y,[v,"GSA"],[k,$]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[y,[v,"TikTok"],[k,$]],[/\[(linkedin)app\]/i],[v,[k,$]],[/(chromium)[\/ ]([-\w\.]+)/i],[v,y],[/headlesschrome(?:\/([\w\.]+)| )/i],[y,[v,"Chrome Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[v,"Chrome WebView"],y],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[y,[v,"Android"+yi]],[/chrome\/([\w\.]+) mobile/i],[y,[v,A+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[v,y],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[y,[v,A+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[v,A+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[y,v],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[v,[y,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[v,y],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[v,A+ki],y],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[v,"Netscape"],y],[/(wolvic|librewolf)\/([\w\.]+)/i],[v,y],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[y,[v,ki+" 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],[v,[y,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[v,[y,/[^\d\.]+./,w]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[C,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[C,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[C,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[C,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[C,"arm"]],[/((ppc|powerpc)(64)?)( mac|;|\))/i],[[C,/ower/,w,M]],[/ sun4\w[;\)]/i],[[C,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i],[[C,M]]],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],[T,[x,pi],[k,r]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[T,[x,pi],[k,S]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[T,[x,a],[k,S]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[T,[x,a],[k,r]],[/(macintosh);/i],[T,[x,a]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[T,[x,"Sharp"],[k,S]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[T,[x,"Honor"],[k,r]],[/honor([-\w ]+)[;\)]/i],[T,[x,"Honor"],[k,S]],[/\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],[T,[x,bi],[k,r]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[T,[x,bi],[k,S]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[T,/_/g," "],[x,fi],[k,r]],[/\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],[[T,/_/g," "],[x,fi],[k,S]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[T,[x,hi],[k,S]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[T,[x,N,{OnePlus:["304","403","203"],"*":hi}],[k,r]],[/(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i],[T,[x,"BLU"],[k,S]],[/; vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[T,[x,"Vivo"],[k,S]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[T,[x,"Realme"],[k,S]],[/\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],[T,[x,li],[k,S]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[T,[x,li],[k,r]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[T,[x,"LG"],[k,r]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch))(\w+)/i,/\blg-?([\d\w]+) bui/i],[T,[x,"LG"],[k,S]],[/(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],[T,[x,"Lenovo"],[k,r]],[/(nokia) (t[12][01])/i],[x,T,[k,r]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*))/i],[[T,/_/g," "],[k,S],[x,"Nokia"]],[/(pixel (c|tablet))\b/i],[T,[x,s],[k,r]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[T,[x,s],[k,S]],[/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],[T,[x,mi],[k,S]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[T,"Xperia Tablet"],[x,mi],[k,r]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[T,[x,ui],[k,S]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[T,[x,si],[k,r]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[T,/(.+)/g,"Fire Phone $1"],[x,si],[k,S]],[/(playbook);[-\w\),; ]+(rim)/i],[T,x,[k,r]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[T,[x,wi],[k,S]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[T,[x,ni],[k,r]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[T,[x,ni],[k,S]],[/(nexus 9)/i],[T,[x,"HTC"],[k,r]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[x,[T,/_/g," "],[k,S]],[/tcl (xess p17aa)/i,/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i],[T,[x,"TCL"],[k,r]],[/droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i],[T,[x,"TCL"],[k,S]],[/(itel) ((\w+))/i],[[x,M],T,[k,N,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[T,[x,"Acer"],[k,r]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[T,[x,"Meizu"],[k,S]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[T,[x,"Ulefone"],[k,S]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[T,[x,"Energizer"],[k,S]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[T,[x,"Cat"],[k,S]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[T,[x,"Smartfren"],[k,S]],[/droid.+; (a(?:015|06[35]|142p?))/i],[T,[x,"Nothing"],[k,S]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[T,[x,"Archos"],[k,r]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[T,[x,"Archos"],[k,S]],[/(imo) (tab \w+)/i,/(infinix) (x1101b?)/i],[x,T,[k,r]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (blu|hmd|imo|tcl)[_ ]([\w\+ ]+?)(?: bui|\)|; r)/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i,/(oppo) ?([\w ]+) bui/i],[x,T,[k,S]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[x,T,[k,r]],[/(surface duo)/i],[T,[x,di],[k,r]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[T,[x,"Fairphone"],[k,S]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[T,[x,ci],[k,r]],[/(sprint) (\w+)/i],[x,T,[k,S]],[/(kin\.[onetw]{3})/i],[[T,/\./g," "],[x,di],[k,S]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[T,[x,gi],[k,r]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[T,[x,gi],[k,S]],[/smart-tv.+(samsung)/i],[x,[k,e]],[/hbbtv.+maple;(\d+)/i],[[T,/^/,"SmartTV"],[x,pi],[k,e]],[/tcast.+(lg)e?. ([-\w]+)/i],[x,T,[k,e]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[x,"LG"],[k,e]],[/(apple) ?tv/i],[x,[T,a+" TV"],[k,e]],[/crkey.*devicetype\/chromecast/i],[[T,b+" Third Generation"],[x,s],[k,e]],[/crkey.*devicetype\/([^/]*)/i],[[T,/^/,"Chromecast "],[x,s],[k,e]],[/fuchsia.*crkey/i],[[T,b+" Nest Hub"],[x,s],[k,e]],[/crkey/i],[[T,b],[x,s],[k,e]],[/(portaltv)/i],[T,[x,xi],[k,e]],[/droid.+aft(\w+)( bui|\))/i],[T,[x,si],[k,e]],[/(shield \w+ tv)/i],[T,[x,ci],[k,e]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[T,[x,"Sharp"],[k,e]],[/(bravia[\w ]+)( bui|\))/i],[T,[x,mi],[k,e]],[/(mi(tv|box)-?\w+) bui/i],[T,[x,fi],[k,e]],[/Hbbtv.*(technisat) (.*);/i],[x,T,[k,e]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[x,Hi],[T,Hi],[k,e]],[/droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i],[T,[k,e]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[k,e]],[/(ouya)/i,/(nintendo) (\w+)/i],[x,T,[k,G]],[/droid.+; (shield)( bui|\))/i],[T,[x,ci],[k,G]],[/(playstation \w+)/i],[T,[x,mi],[k,G]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[T,[x,di],[k,G]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[T,[x,pi],[k,t]],[/((pebble))app/i,/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[x,T,[k,t]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[T,[x,hi],[k,t]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[T,[x,a],[k,t]],[/(opwwe\d{3})/i],[T,[x,ui],[k,t]],[/(moto 360)/i],[T,[x,li],[k,t]],[/(smartwatch 3)/i],[T,[x,mi],[k,t]],[/(g watch r)/i],[T,[x,"LG"],[k,t]],[/droid.+; (wt63?0{2,3})\)/i],[T,[x,gi],[k,t]],[/droid.+; (glass) \d/i],[T,[x,s],[k,F]],[/(pico) (4|neo3(?: link|pro)?)/i],[x,T,[k,F]],[/(quest( \d| pro)?s?).+vr/i],[T,[x,xi],[k,F]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[x,[k,D]],[/(aeobc)\b/i],[T,[x,si],[k,D]],[/(homepod).+mac os/i],[T,[x,a],[k,D]],[/windows iot/i],[[k,D]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+?(mobile|vr|\d) safari/i],[T,[k,N,{mobile:"Mobile",xr:"VR","*":r}]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[k,r]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[k,S]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[T,[x,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[y,[v,"EdgeHTML"]],[/(arkweb)\/([\w\.]+)/i],[v,y],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[y,[v,"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],[v,y],[/ladybird\//i],[[v,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[y,v]],os:[[/microsoft (windows) (vista|xp)/i],[v,y],[/(windows (?:phone(?: os)?|mobile|iot))[\/ ]?([\d\.\w ]*)/i],[v,[y,N,ji]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[y,N,ji],[v,Ci]],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[y,/_/g,"."],[v,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[v,"macOS"],[y,/_/g,"."]],[/android ([\d\.]+).*crkey/i],[y,[v,b+" Android"]],[/fuchsia.*crkey\/([\d\.]+)/i],[y,[v,b+" Fuchsia"]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[y,[v,b+" SmartSpeaker"]],[/linux.*crkey\/([\d\.]+)/i],[y,[v,b+" Linux"]],[/crkey\/([\d\.]+)/i],[y,[v,b]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[y,v],[/(ubuntu) ([\w\.]+) like android/i],[[v,/(.+)/,"$1 Touch"],y],[/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen|webos)\w*[-\/\.; ]?([\d\.]*)/i],[v,y],[/\(bb(10);/i],[y,[v,wi]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[y,[v,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[y,[v,ki+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[y,[v,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[y,[v,"watchOS"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[v,"Chrome OS"],y],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) (\w+)/i,/(xbox); +xbox ([^\);]+)/i,/(pico) .+os([\w\.]+)/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],[v,y],[/(sunos) ?([\w\.\d]*)/i],[[v,"Solaris"],y],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[v,y]]},Ui=(d={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}},j.call(d.init,[[u,[v,y,L,k]],[h,[C]],[p,[k,T,x]],[m,[v,y]],[f,[v,y]]]),j.call(d.isIgnore,[[u,[y,L]],[m,[y]],[f,[y]]]),j.call(d.isIgnoreRgx,[[u,/ ?browser$/i],[f,/ ?os$/i]]),j.call(d.toString,[[u,[v,y]],[h,[C]],[p,[x,T]],[m,[v,y]],[f,[v,y]]]),d),Ei=function(e,i){var t=Ui.init[i],o=Ui.isIgnore[i]||0,r=Ui.isIgnoreRgx[i]||0,a=Ui.toString[i]||0;function s(){j.call(this,t);}return s.prototype.getItem=function(){return e},s.prototype.withClientHints=function(){return O?O.getHighEntropyValues(ai).then(function(i){return e.setCH(new Pi(i,!1)).parseCH().get()}):e.parseCH().get()},s.prototype.withFeatureCheck=function(){return e.detectFeature().get()},i!=g&&(s.prototype.is=function(i){var e,t=!1;for(e in this)if(this.hasOwnProperty(e)&&!Si(o,e)&&M(r?zi(r,this[e]):this[e])==M(r?zi(r,i):i)){if(t=!0,i!=n)break}else if(i==n&&t){t=!t;break}return t},s.prototype.toString=function(){var i,e=w;for(i in a)typeof this[a[i]]!==n&&(e+=(e?" ":w)+this[a[i]]);return e||n}),O||(s.prototype.then=function(i){function e(){for(var i in t)t.hasOwnProperty(i)&&(this[i]=t[i]);}var t=this,o=(e.prototype={is:s.prototype.is,toString:s.prototype.toString},new e);return i(o),o}),new s};function Pi(i,e){if(i=i||{},j.call(this,ai),e)j.call(this,[[W,qi(i[o])],[X,qi(i[Q])],[S,/\?1/.test(i[ei])],[T,Oi(i[ti])],[q,Oi(i[oi])],[Y,Oi(i[ri])],[C,Oi(i[Z])],[_,qi(i[ii])],[K,Oi(i[J])]]);else for(var t in i)this.hasOwnProperty(t)&&typeof i[t]!==n&&(this[t]=i[t]);}function Bi(i,e,t,o){return this.get=function(i){return i?this.data.hasOwnProperty(i)?this.data[i]:l:this.data},this.set=function(i,e){return this.data[i]=e,this},this.setCH=function(i){return this.uaCH=i,this},this.detectFeature=function(){if(z&&z.userAgent==this.ua)switch(this.itemType){case u:z.brave&&typeof z.brave.isBrave==R&&this.set(v,"Brave");break;case p:!this.get(k)&&O&&O[S]&&this.set(k,S),"Macintosh"==this.get(T)&&z&&typeof z.standalone!==n&&z.maxTouchPoints&&2<z.maxTouchPoints&&this.set(T,"iPad").set(k,r);break;case f:!this.get(v)&&O&&O[q]&&this.set(v,O[q]);break;case g:var e=this.data,i=function(i){return e[i].getItem().detectFeature().get()};this.set(u,i(u)).set(h,i(h)).set(p,i(p)).set(m,i(m)).set(f,i(f));}return this},this.parseUA=function(){return this.itemType!=g&&Mi.call(this.data,this.ua,this.rgxMap),this.itemType==u&&this.set(L,Ai(this.get(y))),this},this.parseCH=function(){var i,e=this.uaCH,t=this.rgxMap;switch(this.itemType){case u:case m:var o,r=e[X]||e[W];if(r)for(var a in r){var s=r[a].brand||r[a],a=r[a].version;this.itemType!=u||/not.a.brand/i.test(s)||o&&(!/chrom/i.test(o)||s==vi)||(s=N(s,{Chrome:"Google Chrome",Edge:"Microsoft Edge","Chrome WebView":"Android WebView","Chrome Headless":"HeadlessChrome","Huawei Browser":"HuaweiBrowser","MIUI Browser":"Miui Browser","Opera Mobi":"OperaMobile",Yandex:"YaBrowser"}),this.set(v,s).set(y,a).set(L,Ai(a)),o=s),this.itemType==m&&s==vi&&this.set(y,a);}break;case h:var n=e[C];n&&("64"==e[K]&&(n+="64"),Mi.call(this.data,n+";",t));break;case p:if(e[S]&&this.set(k,S),e[T]&&(this.set(T,e[T]),this.get(k)&&this.get(x)||(Mi.call(n={},"droid 9; "+e[T]+")",t),!this.get(k)&&n.type&&this.set(k,n.type),!this.get(x)&&n.vendor&&this.set(x,n.vendor))),e[_]){if("string"!=typeof e[_])for(var w=0;!i&&w<e[_].length;)i=N(e[_][w++],Ni);else i=N(e[_],Ni);this.set(k,i);}break;case f:var b,n=e[q];n&&(b=e[Y],n==Ci&&(b=13<=parseInt(Ai(b),10)?"11":"10"),this.set(v,n).set(y,b)),this.get(v)==Ci&&"Xbox"==e[T]&&this.set(v,"Xbox").set(y,l);break;case g:var d=this.data,n=function(i){return d[i].getItem().setCH(e).parseCH().get()};this.set(u,n(u)).set(h,n(h)).set(p,n(p)).set(m,n(m)).set(f,n(f));}return this},j.call(this,[["itemType",i],["ua",e],["uaCH",o],["rgxMap",t],["data",Ei(this,i)]]),this}function I(i,e,t){var o,r,a,s,n;return typeof i===c?(e=_i(i,!0)?(typeof e===c&&(t=e),i):(t=i,l),i=l):typeof i!==V||_i(e,!0)||(t=e,e=l),t&&typeof t.append===R&&(o={},t.forEach(function(i,e){o[e]=i;}),t=o),this instanceof I?(r=typeof i===V?i:t&&t[P]?t[P]:z&&z.userAgent?z.userAgent:w,a=new Pi(t,!0),s=e?((i,e)=>{var t,o={},r=e;if(!_i(e))for(var a in r={},e)for(var s in e[a])r[s]=e[a][s].concat(r[s]||[]);for(t in i)o[t]=r[t]&&r[t].length%2==0?r[t].concat(i[t]):i[t];return o})(Ii,e):Ii,j.call(this,[["getBrowser",(n=function(i){return i==g?function(){return new Bi(i,r,s,a).set("ua",r).set(u,this.getBrowser()).set(h,this.getCPU()).set(p,this.getDevice()).set(m,this.getEngine()).set(f,this.getOS()).get()}:function(){return new Bi(i,r,s[i],a).parseUA().get()}})(u)],["getCPU",n(h)],["getDevice",n(p)],["getEngine",n(m)],["getOS",n(f)],["getResult",n(g)],["getUA",function(){return r}],["setUA",function(i){return H(i)&&(r=i.length>E?Hi(i,E):i),this}]]).setUA(r),this):new I(i,e,t).getResult()}I.VERSION="2.0.3",I.BROWSER=U([v,y,L,k]),I.CPU=U([C]),I.DEVICE=U([T,x,k,G,S,e,r,t,D]),I.ENGINE=I.OS=U([v,y]),(exports=module.exports?module.exports=I:exports).UAParser=I;var Ri,Vi=Ti&&(i.jQuery||i.Zepto);Vi&&!Vi.ua&&(Ri=new I,Vi.ua=Ri.getResult(),Vi.ua.get=function(){return Ri.getUA()},Vi.ua.set=function(i){Ri.setUA(i);var e,t=Ri.getResult();for(e in t)Vi.ua[e]=t[e];});})("object"==typeof window?window:commonjsGlobal);
9
- });
10
-
11
- var isMergeableObject = function isMergeableObject(value) {
12
- return isNonNullObject(value)
13
- && !isSpecial(value)
14
- };
1
+ import { r as registerInstance, c as createEvent, h, H as Host } from './index-BZQHyS7V.js';
2
+ import { g as getDefaultExportFromCjs } from './_commonjsHelpers-B85MJLTf.js';
15
3
 
16
- function isNonNullObject(value) {
17
- return !!value && typeof value === 'object'
18
- }
4
+ var uaParser$1 = {exports: {}};
19
5
 
20
- function isSpecial(value) {
21
- var stringValue = Object.prototype.toString.call(value);
6
+ var uaParser = uaParser$1.exports;
22
7
 
23
- return stringValue === '[object RegExp]'
24
- || stringValue === '[object Date]'
25
- || isReactElement(value)
26
- }
8
+ var hasRequiredUaParser;
27
9
 
28
- // see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
29
- var canUseSymbol = typeof Symbol === 'function' && Symbol.for;
30
- var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;
10
+ function requireUaParser () {
11
+ if (hasRequiredUaParser) return uaParser$1.exports;
12
+ hasRequiredUaParser = 1;
13
+ (function (module, exports) {
14
+ /////////////////////////////////////////////////////////////////////////////////
15
+ /* UAParser.js v2.0.3
16
+ Copyright © 2012-2025 Faisal Salman <f@faisalman.com>
17
+ AGPLv3 License *//*
18
+ Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent data.
19
+ Supports browser & node.js environment.
20
+ Demo : https://uaparser.dev
21
+ Source : https://github.com/faisalman/ua-parser-js */
22
+ /////////////////////////////////////////////////////////////////////////////////
31
23
 
32
- function isReactElement(value) {
33
- return value.$$typeof === REACT_ELEMENT_TYPE
34
- }
24
+ /* jshint esversion: 3 */
25
+ /* globals window */
35
26
 
36
- function emptyTarget(val) {
37
- return Array.isArray(val) ? [] : {}
38
- }
27
+ (function (window, undefined$1) {
28
+
29
+ //////////////
30
+ // Constants
31
+ /////////////
39
32
 
40
- function cloneUnlessOtherwiseSpecified(value, options) {
41
- return (options.clone !== false && options.isMergeableObject(value))
42
- ? deepmerge(emptyTarget(value), value, options)
43
- : value
44
- }
33
+ var LIBVERSION = '2.0.3',
34
+ UA_MAX_LENGTH = 500,
35
+ USER_AGENT = 'user-agent',
36
+ EMPTY = '',
37
+ UNKNOWN = '?',
38
+
39
+ // typeof
40
+ FUNC_TYPE = 'function',
41
+ UNDEF_TYPE = 'undefined',
42
+ OBJ_TYPE = 'object',
43
+ STR_TYPE = 'string',
44
+
45
+ // properties
46
+ UA_BROWSER = 'browser',
47
+ UA_CPU = 'cpu',
48
+ UA_DEVICE = 'device',
49
+ UA_ENGINE = 'engine',
50
+ UA_OS = 'os',
51
+ UA_RESULT = 'result',
52
+
53
+ NAME = 'name',
54
+ TYPE = 'type',
55
+ VENDOR = 'vendor',
56
+ VERSION = 'version',
57
+ ARCHITECTURE= 'architecture',
58
+ MAJOR = 'major',
59
+ MODEL = 'model',
60
+
61
+ // device types
62
+ CONSOLE = 'console',
63
+ MOBILE = 'mobile',
64
+ TABLET = 'tablet',
65
+ SMARTTV = 'smarttv',
66
+ WEARABLE = 'wearable',
67
+ XR = 'xr',
68
+ EMBEDDED = 'embedded',
69
+
70
+ // browser types
71
+ INAPP = 'inapp',
72
+
73
+ // client hints
74
+ BRANDS = 'brands',
75
+ FORMFACTORS = 'formFactors',
76
+ FULLVERLIST = 'fullVersionList',
77
+ PLATFORM = 'platform',
78
+ PLATFORMVER = 'platformVersion',
79
+ BITNESS = 'bitness',
80
+ CH_HEADER = 'sec-ch-ua',
81
+ CH_HEADER_FULL_VER_LIST = CH_HEADER + '-full-version-list',
82
+ CH_HEADER_ARCH = CH_HEADER + '-arch',
83
+ CH_HEADER_BITNESS = CH_HEADER + '-' + BITNESS,
84
+ CH_HEADER_FORM_FACTORS = CH_HEADER + '-form-factors',
85
+ CH_HEADER_MOBILE = CH_HEADER + '-' + MOBILE,
86
+ CH_HEADER_MODEL = CH_HEADER + '-' + MODEL,
87
+ CH_HEADER_PLATFORM = CH_HEADER + '-' + PLATFORM,
88
+ CH_HEADER_PLATFORM_VER = CH_HEADER_PLATFORM + '-version',
89
+ CH_ALL_VALUES = [BRANDS, FULLVERLIST, MOBILE, MODEL, PLATFORM, PLATFORMVER, ARCHITECTURE, FORMFACTORS, BITNESS],
90
+
91
+ // device vendors
92
+ AMAZON = 'Amazon',
93
+ APPLE = 'Apple',
94
+ ASUS = 'ASUS',
95
+ BLACKBERRY = 'BlackBerry',
96
+ GOOGLE = 'Google',
97
+ HUAWEI = 'Huawei',
98
+ LENOVO = 'Lenovo',
99
+ HONOR = 'Honor',
100
+ LG = 'LG',
101
+ MICROSOFT = 'Microsoft',
102
+ MOTOROLA = 'Motorola',
103
+ NVIDIA = 'Nvidia',
104
+ ONEPLUS = 'OnePlus',
105
+ OPPO = 'OPPO',
106
+ SAMSUNG = 'Samsung',
107
+ SHARP = 'Sharp',
108
+ SONY = 'Sony',
109
+ XIAOMI = 'Xiaomi',
110
+ ZEBRA = 'Zebra',
111
+
112
+ // browsers
113
+ CHROME = 'Chrome',
114
+ CHROMIUM = 'Chromium',
115
+ CHROMECAST = 'Chromecast',
116
+ EDGE = 'Edge',
117
+ FIREFOX = 'Firefox',
118
+ OPERA = 'Opera',
119
+ FACEBOOK = 'Facebook',
120
+ SOGOU = 'Sogou',
121
+
122
+ PREFIX_MOBILE = 'Mobile ',
123
+ SUFFIX_BROWSER = ' Browser',
124
+
125
+ // os
126
+ WINDOWS = 'Windows';
127
+
128
+ var isWindow = typeof window !== UNDEF_TYPE,
129
+ NAVIGATOR = (isWindow && window.navigator) ?
130
+ window.navigator :
131
+ undefined$1,
132
+ NAVIGATOR_UADATA = (NAVIGATOR && NAVIGATOR.userAgentData) ?
133
+ NAVIGATOR.userAgentData :
134
+ undefined$1;
135
+
136
+ ///////////
137
+ // Helper
138
+ //////////
139
+
140
+ var extend = function (defaultRgx, extensions) {
141
+ var mergedRgx = {};
142
+ var extraRgx = extensions;
143
+ if (!isExtensions(extensions)) {
144
+ extraRgx = {};
145
+ for (var i in extensions) {
146
+ for (var j in extensions[i]) {
147
+ extraRgx[j] = extensions[i][j].concat(extraRgx[j] ? extraRgx[j] : []);
148
+ }
149
+ }
150
+ }
151
+ for (var k in defaultRgx) {
152
+ mergedRgx[k] = extraRgx[k] && extraRgx[k].length % 2 === 0 ? extraRgx[k].concat(defaultRgx[k]) : defaultRgx[k];
153
+ }
154
+ return mergedRgx;
155
+ },
156
+ enumerize = function (arr) {
157
+ var enums = {};
158
+ for (var i=0; i<arr.length; i++) {
159
+ enums[arr[i].toUpperCase()] = arr[i];
160
+ }
161
+ return enums;
162
+ },
163
+ has = function (str1, str2) {
164
+ if (typeof str1 === OBJ_TYPE && str1.length > 0) {
165
+ for (var i in str1) {
166
+ if (lowerize(str1[i]) == lowerize(str2)) return true;
167
+ }
168
+ return false;
169
+ }
170
+ return isString(str1) ? lowerize(str2).indexOf(lowerize(str1)) !== -1 : false;
171
+ },
172
+ isExtensions = function (obj, deep) {
173
+ for (var prop in obj) {
174
+ return /^(browser|cpu|device|engine|os)$/.test(prop) || (deep ? isExtensions(obj[prop]) : false);
175
+ }
176
+ },
177
+ isString = function (val) {
178
+ return typeof val === STR_TYPE;
179
+ },
180
+ itemListToArray = function (header) {
181
+ if (!header) return undefined$1;
182
+ var arr = [];
183
+ var tokens = strip(/\\?\"/g, header).split(',');
184
+ for (var i = 0; i < tokens.length; i++) {
185
+ if (tokens[i].indexOf(';') > -1) {
186
+ var token = trim(tokens[i]).split(';v=');
187
+ arr[i] = { brand : token[0], version : token[1] };
188
+ } else {
189
+ arr[i] = trim(tokens[i]);
190
+ }
191
+ }
192
+ return arr;
193
+ },
194
+ lowerize = function (str) {
195
+ return isString(str) ? str.toLowerCase() : str;
196
+ },
197
+ majorize = function (version) {
198
+ return isString(version) ? strip(/[^\d\.]/g, version).split('.')[0] : undefined$1;
199
+ },
200
+ setProps = function (arr) {
201
+ for (var i in arr) {
202
+ var propName = arr[i];
203
+ if (typeof propName == OBJ_TYPE && propName.length == 2) {
204
+ this[propName[0]] = propName[1];
205
+ } else {
206
+ this[propName] = undefined$1;
207
+ }
208
+ }
209
+ return this;
210
+ },
211
+ strip = function (pattern, str) {
212
+ return isString(str) ? str.replace(pattern, EMPTY) : str;
213
+ },
214
+ stripQuotes = function (str) {
215
+ return strip(/\\?\"/g, str);
216
+ },
217
+ trim = function (str, len) {
218
+ if (isString(str)) {
219
+ str = strip(/^\s\s*/, str);
220
+ return typeof len === UNDEF_TYPE ? str : str.substring(0, UA_MAX_LENGTH);
221
+ }
222
+ };
223
+
224
+ ///////////////
225
+ // Map helper
226
+ //////////////
227
+
228
+ var rgxMapper = function (ua, arrays) {
229
+
230
+ if(!ua || !arrays) return;
231
+
232
+ var i = 0, j, k, p, q, matches, match;
233
+
234
+ // loop through all regexes maps
235
+ while (i < arrays.length && !matches) {
236
+
237
+ var regex = arrays[i], // even sequence (0,2,4,..)
238
+ props = arrays[i + 1]; // odd sequence (1,3,5,..)
239
+ j = k = 0;
240
+
241
+ // try matching uastring with regexes
242
+ while (j < regex.length && !matches) {
243
+
244
+ if (!regex[j]) { break; }
245
+ matches = regex[j++].exec(ua);
246
+
247
+ if (!!matches) {
248
+ for (p = 0; p < props.length; p++) {
249
+ match = matches[++k];
250
+ q = props[p];
251
+ // check if given property is actually array
252
+ if (typeof q === OBJ_TYPE && q.length > 0) {
253
+ if (q.length === 2) {
254
+ if (typeof q[1] == FUNC_TYPE) {
255
+ // assign modified match
256
+ this[q[0]] = q[1].call(this, match);
257
+ } else {
258
+ // assign given value, ignore regex match
259
+ this[q[0]] = q[1];
260
+ }
261
+ } else if (q.length === 3) {
262
+ // check whether function or regex
263
+ if (typeof q[1] === FUNC_TYPE && !(q[1].exec && q[1].test)) {
264
+ // call function (usually string mapper)
265
+ this[q[0]] = match ? q[1].call(this, match, q[2]) : undefined$1;
266
+ } else {
267
+ // sanitize match using given regex
268
+ this[q[0]] = match ? match.replace(q[1], q[2]) : undefined$1;
269
+ }
270
+ } else if (q.length === 4) {
271
+ this[q[0]] = match ? q[3].call(this, match.replace(q[1], q[2])) : undefined$1;
272
+ }
273
+ } else {
274
+ this[q] = match ? match : undefined$1;
275
+ }
276
+ }
277
+ }
278
+ }
279
+ i += 2;
280
+ }
281
+ },
282
+
283
+ strMapper = function (str, map) {
284
+
285
+ for (var i in map) {
286
+ // check if current value is array
287
+ if (typeof map[i] === OBJ_TYPE && map[i].length > 0) {
288
+ for (var j = 0; j < map[i].length; j++) {
289
+ if (has(map[i][j], str)) {
290
+ return (i === UNKNOWN) ? undefined$1 : i;
291
+ }
292
+ }
293
+ } else if (has(map[i], str)) {
294
+ return (i === UNKNOWN) ? undefined$1 : i;
295
+ }
296
+ }
297
+ return map.hasOwnProperty('*') ? map['*'] : str;
298
+ };
299
+
300
+ ///////////////
301
+ // String map
302
+ //////////////
303
+
304
+ var windowsVersionMap = {
305
+ 'ME' : '4.90',
306
+ 'NT 3.11' : 'NT3.51',
307
+ 'NT 4.0' : 'NT4.0',
308
+ '2000' : 'NT 5.0',
309
+ 'XP' : ['NT 5.1', 'NT 5.2'],
310
+ 'Vista' : 'NT 6.0',
311
+ '7' : 'NT 6.1',
312
+ '8' : 'NT 6.2',
313
+ '8.1' : 'NT 6.3',
314
+ '10' : ['NT 6.4', 'NT 10.0'],
315
+ 'RT' : 'ARM'
316
+ },
317
+
318
+ formFactorsMap = {
319
+ 'embedded' : 'Automotive',
320
+ 'mobile' : 'Mobile',
321
+ 'tablet' : ['Tablet', 'EInk'],
322
+ 'smarttv' : 'TV',
323
+ 'wearable' : 'Watch',
324
+ 'xr' : ['VR', 'XR'],
325
+ '?' : ['Desktop', 'Unknown'],
326
+ '*' : undefined$1
327
+ };
328
+
329
+ //////////////
330
+ // Regex map
331
+ /////////////
332
+
333
+ var defaultRegexes = {
334
+
335
+ browser : [[
336
+
337
+ // Most common regardless engine
338
+ /\b(?:crmo|crios)\/([\w\.]+)/i // Chrome for Android/iOS
339
+ ], [VERSION, [NAME, PREFIX_MOBILE + 'Chrome']], [
340
+ /edg(?:e|ios|a)?\/([\w\.]+)/i // Microsoft Edge
341
+ ], [VERSION, [NAME, 'Edge']], [
342
+
343
+ // Presto based
344
+ /(opera mini)\/([-\w\.]+)/i, // Opera Mini
345
+ /(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i, // Opera Mobi/Tablet
346
+ /(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i // Opera
347
+ ], [NAME, VERSION], [
348
+ /opios[\/ ]+([\w\.]+)/i // Opera mini on iphone >= 8.0
349
+ ], [VERSION, [NAME, OPERA+' Mini']], [
350
+ /\bop(?:rg)?x\/([\w\.]+)/i // Opera GX
351
+ ], [VERSION, [NAME, OPERA+' GX']], [
352
+ /\bopr\/([\w\.]+)/i // Opera Webkit
353
+ ], [VERSION, [NAME, OPERA]], [
354
+
355
+ // Mixed
356
+ /\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i // Baidu
357
+ ], [VERSION, [NAME, 'Baidu']], [
358
+ /\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i // Maxthon
359
+ ], [VERSION, [NAME, 'Maxthon']], [
360
+ /(kindle)\/([\w\.]+)/i, // Kindle
361
+ /(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,
362
+ // Lunascape/Maxthon/Netfront/Jasmine/Blazer/Sleipnir
363
+ // Trident based
364
+ /(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i, // Avant/IEMobile/SlimBrowser/SlimBoat/Slimjet
365
+ /(?:ms|\()(ie) ([\w\.]+)/i, // Internet Explorer
366
+
367
+ // Blink/Webkit/KHTML based // Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium/PhantomJS/Bowser/QupZilla/Falkon/LG Browser/Otter/qutebrowser/Dooble
368
+ /(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|otter|dooble|(?:lg |qute)browser)\/([-\w\.]+)/i,
369
+ // Rekonq/Puffin/Brave/Whale/QQBrowserLite/QQ//Vivaldi/DuckDuckGo/Klar/Helio/Dragon
370
+ /(heytap|ovi|115|surf)browser\/([\d\.]+)/i, // HeyTap/Ovi/115/Surf
371
+ /(ecosia|weibo)(?:__| \w+@)([\d\.]+)/i // Ecosia/Weibo
372
+ ], [NAME, VERSION], [
373
+ /quark(?:pc)?\/([-\w\.]+)/i // Quark
374
+ ], [VERSION, [NAME, 'Quark']], [
375
+ /\bddg\/([\w\.]+)/i // DuckDuckGo
376
+ ], [VERSION, [NAME, 'DuckDuckGo']], [
377
+ /(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i // UCBrowser
378
+ ], [VERSION, [NAME, 'UCBrowser']], [
379
+ /microm.+\bqbcore\/([\w\.]+)/i, // WeChat Desktop for Windows Built-in Browser
380
+ /\bqbcore\/([\w\.]+).+microm/i,
381
+ /micromessenger\/([\w\.]+)/i // WeChat
382
+ ], [VERSION, [NAME, 'WeChat']], [
383
+ /konqueror\/([\w\.]+)/i // Konqueror
384
+ ], [VERSION, [NAME, 'Konqueror']], [
385
+ /trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i // IE11
386
+ ], [VERSION, [NAME, 'IE']], [
387
+ /ya(?:search)?browser\/([\w\.]+)/i // Yandex
388
+ ], [VERSION, [NAME, 'Yandex']], [
389
+ /slbrowser\/([\w\.]+)/i // Smart Lenovo Browser
390
+ ], [VERSION, [NAME, 'Smart ' + LENOVO + SUFFIX_BROWSER]], [
391
+ /(avast|avg)\/([\w\.]+)/i // Avast/AVG Secure Browser
392
+ ], [[NAME, /(.+)/, '$1 Secure' + SUFFIX_BROWSER], VERSION], [
393
+ /\bfocus\/([\w\.]+)/i // Firefox Focus
394
+ ], [VERSION, [NAME, FIREFOX+' Focus']], [
395
+ /\bopt\/([\w\.]+)/i // Opera Touch
396
+ ], [VERSION, [NAME, OPERA+' Touch']], [
397
+ /coc_coc\w+\/([\w\.]+)/i // Coc Coc Browser
398
+ ], [VERSION, [NAME, 'Coc Coc']], [
399
+ /dolfin\/([\w\.]+)/i // Dolphin
400
+ ], [VERSION, [NAME, 'Dolphin']], [
401
+ /coast\/([\w\.]+)/i // Opera Coast
402
+ ], [VERSION, [NAME, OPERA+' Coast']], [
403
+ /miuibrowser\/([\w\.]+)/i // MIUI Browser
404
+ ], [VERSION, [NAME, 'MIUI' + SUFFIX_BROWSER]], [
405
+ /fxios\/([\w\.-]+)/i // Firefox for iOS
406
+ ], [VERSION, [NAME, PREFIX_MOBILE + FIREFOX]], [
407
+ /\bqihoobrowser\/?([\w\.]*)/i // 360
408
+ ], [VERSION, [NAME, '360']], [
409
+ /\b(qq)\/([\w\.]+)/i // QQ
410
+ ], [[NAME, /(.+)/, '$1Browser'], VERSION], [
411
+ /(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i
412
+ ], [[NAME, /(.+)/, '$1' + SUFFIX_BROWSER], VERSION], [ // Oculus/Sailfish/HuaweiBrowser/VivoBrowser/PicoBrowser
413
+ /samsungbrowser\/([\w\.]+)/i // Samsung Internet
414
+ ], [VERSION, [NAME, SAMSUNG + ' Internet']], [
415
+ /metasr[\/ ]?([\d\.]+)/i // Sogou Explorer
416
+ ], [VERSION, [NAME, SOGOU + ' Explorer']], [
417
+ /(sogou)mo\w+\/([\d\.]+)/i // Sogou Mobile
418
+ ], [[NAME, SOGOU + ' Mobile'], VERSION], [
419
+ /(electron)\/([\w\.]+) safari/i, // Electron-based App
420
+ /(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i, // Tesla
421
+ /m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i // QQ/2345
422
+ ], [NAME, VERSION], [
423
+ /(lbbrowser|rekonq)/i // LieBao Browser/Rekonq
424
+ ], [NAME], [
425
+ /ome\/([\w\.]+) \w* ?(iron) saf/i, // Iron
426
+ /ome\/([\w\.]+).+qihu (360)[es]e/i // 360
427
+ ], [VERSION, NAME], [
428
+
429
+ // WebView
430
+ /((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i // Facebook App for iOS & Android
431
+ ], [[NAME, FACEBOOK], VERSION, [TYPE, INAPP]], [
432
+ /(Klarna)\/([\w\.]+)/i, // Klarna Shopping Browser for iOS & Android
433
+ /(kakao(?:talk|story))[\/ ]([\w\.]+)/i, // Kakao App
434
+ /(naver)\(.*?(\d+\.[\w\.]+).*\)/i, // Naver InApp
435
+ /(daum)apps[\/ ]([\w\.]+)/i, // Daum App
436
+ /safari (line)\/([\w\.]+)/i, // Line App for iOS
437
+ /\b(line)\/([\w\.]+)\/iab/i, // Line App for Android
438
+ /(alipay)client\/([\w\.]+)/i, // Alipay
439
+ /(twitter)(?:and| f.+e\/([\w\.]+))/i, // Twitter
440
+ /(instagram|snapchat)[\/ ]([-\w\.]+)/i // Instagram/Snapchat
441
+ ], [NAME, VERSION, [TYPE, INAPP]], [
442
+ /\bgsa\/([\w\.]+) .*safari\//i // Google Search Appliance on iOS
443
+ ], [VERSION, [NAME, 'GSA'], [TYPE, INAPP]], [
444
+ /musical_ly(?:.+app_?version\/|_)([\w\.]+)/i // TikTok
445
+ ], [VERSION, [NAME, 'TikTok'], [TYPE, INAPP]], [
446
+ /\[(linkedin)app\]/i // LinkedIn App for iOS & Android
447
+ ], [NAME, [TYPE, INAPP]], [
448
+
449
+ /(chromium)[\/ ]([-\w\.]+)/i // Chromium
450
+ ], [NAME, VERSION], [
451
+
452
+ /headlesschrome(?:\/([\w\.]+)| )/i // Chrome Headless
453
+ ], [VERSION, [NAME, CHROME+' Headless']], [
454
+
455
+ / wv\).+(chrome)\/([\w\.]+)/i // Chrome WebView
456
+ ], [[NAME, CHROME+' WebView'], VERSION], [
457
+
458
+ /droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i // Android Browser
459
+ ], [VERSION, [NAME, 'Android' + SUFFIX_BROWSER]], [
460
+
461
+ /chrome\/([\w\.]+) mobile/i // Chrome Mobile
462
+ ], [VERSION, [NAME, PREFIX_MOBILE + 'Chrome']], [
463
+
464
+ /(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i // Chrome/OmniWeb/Arora/Tizen/Nokia
465
+ ], [NAME, VERSION], [
466
+
467
+ /version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i // Safari Mobile
468
+ ], [VERSION, [NAME, PREFIX_MOBILE + 'Safari']], [
469
+ /iphone .*mobile(?:\/\w+ | ?)safari/i
470
+ ], [[NAME, PREFIX_MOBILE + 'Safari']], [
471
+ /version\/([\w\.\,]+) .*(safari)/i // Safari
472
+ ], [VERSION, NAME], [
473
+ /webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i // Safari < 3.0
474
+ ], [NAME, [VERSION, '1']], [
475
+
476
+ /(webkit|khtml)\/([\w\.]+)/i
477
+ ], [NAME, VERSION], [
478
+
479
+ // Gecko based
480
+ /(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i // Firefox Mobile
481
+ ], [[NAME, PREFIX_MOBILE + FIREFOX], VERSION], [
482
+ /(navigator|netscape\d?)\/([-\w\.]+)/i // Netscape
483
+ ], [[NAME, 'Netscape'], VERSION], [
484
+ /(wolvic|librewolf)\/([\w\.]+)/i // Wolvic/LibreWolf
485
+ ], [NAME, VERSION], [
486
+ /mobile vr; rv:([\w\.]+)\).+firefox/i // Firefox Reality
487
+ ], [VERSION, [NAME, FIREFOX+' Reality']], [
488
+ /ekiohf.+(flow)\/([\w\.]+)/i, // Flow
489
+ /(swiftfox)/i, // Swiftfox
490
+ /(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,
491
+ // IceDragon/Iceweasel/Camino/Chimera/Fennec/Maemo/Minimo/Conkeror
492
+ /(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,
493
+ // Firefox/SeaMonkey/K-Meleon/IceCat/IceApe/Firebird/Phoenix
494
+ /(firefox)\/([\w\.]+)/i, // Other Firefox-based
495
+ /(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i, // Mozilla
496
+
497
+ // Other
498
+ /(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,
499
+ // Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf/Obigo/Mosaic/Go/ICE/UP.Browser/Ladybird
500
+ /\b(links) \(([\w\.]+)/i // Links
501
+ ], [NAME, [VERSION, /_/g, '.']], [
502
+
503
+ /(cobalt)\/([\w\.]+)/i // Cobalt
504
+ ], [NAME, [VERSION, /[^\d\.]+./, EMPTY]]
505
+ ],
506
+
507
+ cpu : [[
508
+
509
+ /\b((amd|x|x86[-_]?|wow|win)64)\b/i // AMD64 (x64)
510
+ ], [[ARCHITECTURE, 'amd64']], [
511
+
512
+ /(ia32(?=;))/i, // IA32 (quicktime)
513
+ /\b((i[346]|x)86)(pc)?\b/i // IA32 (x86)
514
+ ], [[ARCHITECTURE, 'ia32']], [
515
+
516
+ /\b(aarch64|arm(v?[89]e?l?|_?64))\b/i // ARM64
517
+ ], [[ARCHITECTURE, 'arm64']], [
518
+
519
+ /\b(arm(v[67])?ht?n?[fl]p?)\b/i // ARMHF
520
+ ], [[ARCHITECTURE, 'armhf']], [
521
+
522
+ // PocketPC mistakenly identified as PowerPC
523
+ /( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i
524
+ ], [[ARCHITECTURE, 'arm']], [
525
+
526
+ /((ppc|powerpc)(64)?)( mac|;|\))/i // PowerPC
527
+ ], [[ARCHITECTURE, /ower/, EMPTY, lowerize]], [
528
+
529
+ / sun4\w[;\)]/i // SPARC
530
+ ], [[ARCHITECTURE, 'sparc']], [
531
+
532
+ /\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i
533
+ // IA64, 68K, ARM/64, AVR/32, IRIX/64, MIPS/64, SPARC/64, PA-RISC
534
+ ], [[ARCHITECTURE, lowerize]]
535
+ ],
536
+
537
+ device : [[
538
+
539
+ //////////////////////////
540
+ // MOBILES & TABLETS
541
+ /////////////////////////
542
+
543
+ // Samsung
544
+ /\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
545
+ ], [MODEL, [VENDOR, SAMSUNG], [TYPE, TABLET]], [
546
+ /\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,
547
+ /samsung[- ]((?!sm-[lr])[-\w]+)/i,
548
+ /sec-(sgh\w+)/i
549
+ ], [MODEL, [VENDOR, SAMSUNG], [TYPE, MOBILE]], [
550
+
551
+ // Apple
552
+ /(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i // iPod/iPhone
553
+ ], [MODEL, [VENDOR, APPLE], [TYPE, MOBILE]], [
554
+ /\((ipad);[-\w\),; ]+apple/i, // iPad
555
+ /applecoremedia\/[\w\.]+ \((ipad)/i,
556
+ /\b(ipad)\d\d?,\d\d?[;\]].+ios/i
557
+ ], [MODEL, [VENDOR, APPLE], [TYPE, TABLET]], [
558
+ /(macintosh);/i
559
+ ], [MODEL, [VENDOR, APPLE]], [
560
+
561
+ // Sharp
562
+ /\b(sh-?[altvz]?\d\d[a-ekm]?)/i
563
+ ], [MODEL, [VENDOR, SHARP], [TYPE, MOBILE]], [
564
+
565
+ // Honor
566
+ /\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i
567
+ ], [MODEL, [VENDOR, HONOR], [TYPE, TABLET]], [
568
+ /honor([-\w ]+)[;\)]/i
569
+ ], [MODEL, [VENDOR, HONOR], [TYPE, MOBILE]], [
570
+
571
+ // Huawei
572
+ /\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
573
+ ], [MODEL, [VENDOR, HUAWEI], [TYPE, TABLET]], [
574
+ /(?:huawei)([-\w ]+)[;\)]/i,
575
+ /\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i
576
+ ], [MODEL, [VENDOR, HUAWEI], [TYPE, MOBILE]], [
577
+
578
+ // Xiaomi
579
+ /oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,
580
+ /\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i // Mi Pad tablets
581
+ ],[[MODEL, /_/g, ' '], [VENDOR, XIAOMI], [TYPE, TABLET]], [
582
+
583
+ /\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i, // Xiaomi POCO
584
+ /\b; (\w+) build\/hm\1/i, // Xiaomi Hongmi 'numeric' models
585
+ /\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i, // Xiaomi Hongmi
586
+ /\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i, // Xiaomi Redmi
587
+ /oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i, // Xiaomi Redmi 'numeric' models
588
+ /\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i, // Xiaomi Mi
589
+ / ([\w ]+) miui\/v?\d/i
590
+ ], [[MODEL, /_/g, ' '], [VENDOR, XIAOMI], [TYPE, MOBILE]], [
591
+
592
+ // OPPO
593
+ /; (\w+) bui.+ oppo/i,
594
+ /\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i
595
+ ], [MODEL, [VENDOR, OPPO], [TYPE, MOBILE]], [
596
+ /\b(opd2(\d{3}a?))(?: bui|\))/i
597
+ ], [MODEL, [VENDOR, strMapper, { 'OnePlus' : ['304', '403', '203'], '*' : OPPO }], [TYPE, TABLET]], [
598
+
599
+ // BLU Vivo Series
600
+ /(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i
601
+ ], [MODEL, [VENDOR, 'BLU'], [TYPE, MOBILE]], [
602
+ // Vivo
603
+ /; vivo (\w+)(?: bui|\))/i,
604
+ /\b(v[12]\d{3}\w?[at])(?: bui|;)/i
605
+ ], [MODEL, [VENDOR, 'Vivo'], [TYPE, MOBILE]], [
606
+
607
+ // Realme
608
+ /\b(rmx[1-3]\d{3})(?: bui|;|\))/i
609
+ ], [MODEL, [VENDOR, 'Realme'], [TYPE, MOBILE]], [
610
+
611
+ // Motorola
612
+ /\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,
613
+ /\bmot(?:orola)?[- ](\w*)/i,
614
+ /((?:moto(?! 360)[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i
615
+ ], [MODEL, [VENDOR, MOTOROLA], [TYPE, MOBILE]], [
616
+ /\b(mz60\d|xoom[2 ]{0,2}) build\//i
617
+ ], [MODEL, [VENDOR, MOTOROLA], [TYPE, TABLET]], [
618
+
619
+ // LG
620
+ /((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i
621
+ ], [MODEL, [VENDOR, LG], [TYPE, TABLET]], [
622
+ /(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,
623
+ /\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch))(\w+)/i,
624
+ /\blg-?([\d\w]+) bui/i
625
+ ], [MODEL, [VENDOR, LG], [TYPE, MOBILE]], [
626
+
627
+ // Lenovo
628
+ /(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,
629
+ /lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i
630
+ ], [MODEL, [VENDOR, LENOVO], [TYPE, TABLET]], [
631
+
632
+ // Nokia
633
+ /(nokia) (t[12][01])/i
634
+ ], [VENDOR, MODEL, [TYPE, TABLET]], [
635
+ /(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,
636
+ /nokia[-_ ]?(([-\w\. ]*))/i
637
+ ], [[MODEL, /_/g, ' '], [TYPE, MOBILE], [VENDOR, 'Nokia']], [
638
+
639
+ // Google
640
+ /(pixel (c|tablet))\b/i // Google Pixel C/Tablet
641
+ ], [MODEL, [VENDOR, GOOGLE], [TYPE, TABLET]], [
642
+ /droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i // Google Pixel
643
+ ], [MODEL, [VENDOR, GOOGLE], [TYPE, MOBILE]], [
644
+
645
+ // Sony
646
+ /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
647
+ ], [MODEL, [VENDOR, SONY], [TYPE, MOBILE]], [
648
+ /sony tablet [ps]/i,
649
+ /\b(?:sony)?sgp\w+(?: bui|\))/i
650
+ ], [[MODEL, 'Xperia Tablet'], [VENDOR, SONY], [TYPE, TABLET]], [
651
+
652
+ // OnePlus
653
+ / (kb2005|in20[12]5|be20[12][59])\b/i,
654
+ /(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i
655
+ ], [MODEL, [VENDOR, ONEPLUS], [TYPE, MOBILE]], [
656
+
657
+ // Amazon
658
+ /(alexa)webm/i,
659
+ /(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i, // Kindle Fire without Silk / Echo Show
660
+ /(kf[a-z]+)( bui|\)).+silk\//i // Kindle Fire HD
661
+ ], [MODEL, [VENDOR, AMAZON], [TYPE, TABLET]], [
662
+ /((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i // Fire Phone
663
+ ], [[MODEL, /(.+)/g, 'Fire Phone $1'], [VENDOR, AMAZON], [TYPE, MOBILE]], [
664
+
665
+ // BlackBerry
666
+ /(playbook);[-\w\),; ]+(rim)/i // BlackBerry PlayBook
667
+ ], [MODEL, VENDOR, [TYPE, TABLET]], [
668
+ /\b((?:bb[a-f]|st[hv])100-\d)/i,
669
+ /\(bb10; (\w+)/i // BlackBerry 10
670
+ ], [MODEL, [VENDOR, BLACKBERRY], [TYPE, MOBILE]], [
671
+
672
+ // Asus
673
+ /(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i
674
+ ], [MODEL, [VENDOR, ASUS], [TYPE, TABLET]], [
675
+ / (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i
676
+ ], [MODEL, [VENDOR, ASUS], [TYPE, MOBILE]], [
677
+
678
+ // HTC
679
+ /(nexus 9)/i // HTC Nexus 9
680
+ ], [MODEL, [VENDOR, 'HTC'], [TYPE, TABLET]], [
681
+ /(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i, // HTC
682
+
683
+ // ZTE
684
+ /(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,
685
+ /(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i // Alcatel/GeeksPhone/Nexian/Panasonic/Sony
686
+ ], [VENDOR, [MODEL, /_/g, ' '], [TYPE, MOBILE]], [
687
+
688
+ // TCL
689
+ /tcl (xess p17aa)/i,
690
+ /droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i
691
+ ], [MODEL, [VENDOR, 'TCL'], [TYPE, TABLET]], [
692
+ /droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i
693
+ ], [MODEL, [VENDOR, 'TCL'], [TYPE, MOBILE]], [
694
+
695
+ // itel
696
+ /(itel) ((\w+))/i
697
+ ], [[VENDOR, lowerize], MODEL, [TYPE, strMapper, { 'tablet' : ['p10001l', 'w7001'], '*' : 'mobile' }]], [
698
+
699
+ // Acer
700
+ /droid.+; ([ab][1-7]-?[0178a]\d\d?)/i
701
+ ], [MODEL, [VENDOR, 'Acer'], [TYPE, TABLET]], [
702
+
703
+ // Meizu
704
+ /droid.+; (m[1-5] note) bui/i,
705
+ /\bmz-([-\w]{2,})/i
706
+ ], [MODEL, [VENDOR, 'Meizu'], [TYPE, MOBILE]], [
707
+
708
+ // Ulefone
709
+ /; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i
710
+ ], [MODEL, [VENDOR, 'Ulefone'], [TYPE, MOBILE]], [
711
+
712
+ // Energizer
713
+ /; (energy ?\w+)(?: bui|\))/i,
714
+ /; energizer ([\w ]+)(?: bui|\))/i
715
+ ], [MODEL, [VENDOR, 'Energizer'], [TYPE, MOBILE]], [
716
+
717
+ // Cat
718
+ /; cat (b35);/i,
719
+ /; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i
720
+ ], [MODEL, [VENDOR, 'Cat'], [TYPE, MOBILE]], [
45
721
 
46
- function defaultArrayMerge(target, source, options) {
47
- return target.concat(source).map(function(element) {
48
- return cloneUnlessOtherwiseSpecified(element, options)
49
- })
722
+ // Smartfren
723
+ /((?:new )?andromax[\w- ]+)(?: bui|\))/i
724
+ ], [MODEL, [VENDOR, 'Smartfren'], [TYPE, MOBILE]], [
725
+
726
+ // Nothing
727
+ /droid.+; (a(?:015|06[35]|142p?))/i
728
+ ], [MODEL, [VENDOR, 'Nothing'], [TYPE, MOBILE]], [
729
+
730
+ // Archos
731
+ /; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,
732
+ /archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i
733
+ ], [MODEL, [VENDOR, 'Archos'], [TYPE, TABLET]], [
734
+ /archos ([\w ]+)( b|\))/i,
735
+ /; (ac[3-6]\d\w{2,8})( b|\))/i
736
+ ], [MODEL, [VENDOR, 'Archos'], [TYPE, MOBILE]], [
737
+
738
+ // MIXED
739
+ /(imo) (tab \w+)/i, // IMO
740
+ /(infinix) (x1101b?)/i // Infinix XPad
741
+ ], [VENDOR, MODEL, [TYPE, TABLET]], [
742
+
743
+ /(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,
744
+ // BlackBerry/BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Meizu/Motorola/Polytron/Infinix/Tecno/Micromax/Advan
745
+ /; (blu|hmd|imo|tcl)[_ ]([\w\+ ]+?)(?: bui|\)|; r)/i, // BLU/HMD/IMO/TCL
746
+ /(hp) ([\w ]+\w)/i, // HP iPAQ
747
+ /(microsoft); (lumia[\w ]+)/i, // Microsoft Lumia
748
+ /(lenovo)[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i, // Lenovo
749
+ /(oppo) ?([\w ]+) bui/i // OPPO
750
+ ], [VENDOR, MODEL, [TYPE, MOBILE]], [
751
+
752
+ /(kobo)\s(ereader|touch)/i, // Kobo
753
+ /(hp).+(touchpad(?!.+tablet)|tablet)/i, // HP TouchPad
754
+ /(kindle)\/([\w\.]+)/i // Kindle
755
+ ], [VENDOR, MODEL, [TYPE, TABLET]], [
756
+
757
+ /(surface duo)/i // Surface Duo
758
+ ], [MODEL, [VENDOR, MICROSOFT], [TYPE, TABLET]], [
759
+ /droid [\d\.]+; (fp\du?)(?: b|\))/i // Fairphone
760
+ ], [MODEL, [VENDOR, 'Fairphone'], [TYPE, MOBILE]], [
761
+ /((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i // Nvidia Tablets
762
+ ], [MODEL, [VENDOR, NVIDIA], [TYPE, TABLET]], [
763
+ /(sprint) (\w+)/i // Sprint Phones
764
+ ], [VENDOR, MODEL, [TYPE, MOBILE]], [
765
+ /(kin\.[onetw]{3})/i // Microsoft Kin
766
+ ], [[MODEL, /\./g, ' '], [VENDOR, MICROSOFT], [TYPE, MOBILE]], [
767
+ /droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i // Zebra
768
+ ], [MODEL, [VENDOR, ZEBRA], [TYPE, TABLET]], [
769
+ /droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i
770
+ ], [MODEL, [VENDOR, ZEBRA], [TYPE, MOBILE]], [
771
+
772
+ ///////////////////
773
+ // SMARTTVS
774
+ ///////////////////
775
+
776
+ /smart-tv.+(samsung)/i // Samsung
777
+ ], [VENDOR, [TYPE, SMARTTV]], [
778
+ /hbbtv.+maple;(\d+)/i
779
+ ], [[MODEL, /^/, 'SmartTV'], [VENDOR, SAMSUNG], [TYPE, SMARTTV]], [
780
+ /tcast.+(lg)e?. ([-\w]+)/i // LG SmartTV
781
+ ], [VENDOR, MODEL, [TYPE, SMARTTV]], [
782
+ /(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i
783
+ ], [[VENDOR, LG], [TYPE, SMARTTV]], [
784
+ /(apple) ?tv/i // Apple TV
785
+ ], [VENDOR, [MODEL, APPLE+' TV'], [TYPE, SMARTTV]], [
786
+ /crkey.*devicetype\/chromecast/i // Google Chromecast Third Generation
787
+ ], [[MODEL, CHROMECAST+' Third Generation'], [VENDOR, GOOGLE], [TYPE, SMARTTV]], [
788
+ /crkey.*devicetype\/([^/]*)/i // Google Chromecast with specific device type
789
+ ], [[MODEL, /^/, 'Chromecast '], [VENDOR, GOOGLE], [TYPE, SMARTTV]], [
790
+ /fuchsia.*crkey/i // Google Chromecast Nest Hub
791
+ ], [[MODEL, CHROMECAST+' Nest Hub'], [VENDOR, GOOGLE], [TYPE, SMARTTV]], [
792
+ /crkey/i // Google Chromecast, Linux-based or unknown
793
+ ], [[MODEL, CHROMECAST], [VENDOR, GOOGLE], [TYPE, SMARTTV]], [
794
+ /(portaltv)/i // Facebook Portal TV
795
+ ], [MODEL, [VENDOR, FACEBOOK], [TYPE, SMARTTV]], [
796
+ /droid.+aft(\w+)( bui|\))/i // Fire TV
797
+ ], [MODEL, [VENDOR, AMAZON], [TYPE, SMARTTV]], [
798
+ /(shield \w+ tv)/i // Nvidia Shield TV
799
+ ], [MODEL, [VENDOR, NVIDIA], [TYPE, SMARTTV]], [
800
+ /\(dtv[\);].+(aquos)/i,
801
+ /(aquos-tv[\w ]+)\)/i // Sharp
802
+ ], [MODEL, [VENDOR, SHARP], [TYPE, SMARTTV]],[
803
+ /(bravia[\w ]+)( bui|\))/i // Sony
804
+ ], [MODEL, [VENDOR, SONY], [TYPE, SMARTTV]], [
805
+ /(mi(tv|box)-?\w+) bui/i // Xiaomi
806
+ ], [MODEL, [VENDOR, XIAOMI], [TYPE, SMARTTV]], [
807
+ /Hbbtv.*(technisat) (.*);/i // TechniSAT
808
+ ], [VENDOR, MODEL, [TYPE, SMARTTV]], [
809
+ /\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i, // Roku
810
+ /hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i // HbbTV devices
811
+ ], [[VENDOR, trim], [MODEL, trim], [TYPE, SMARTTV]], [
812
+ // SmartTV from Unidentified Vendors
813
+ /droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i
814
+ ], [MODEL, [TYPE, SMARTTV]], [
815
+ /\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i
816
+ ], [[TYPE, SMARTTV]], [
817
+
818
+ ///////////////////
819
+ // CONSOLES
820
+ ///////////////////
821
+
822
+ /(ouya)/i, // Ouya
823
+ /(nintendo) (\w+)/i // Nintendo
824
+ ], [VENDOR, MODEL, [TYPE, CONSOLE]], [
825
+ /droid.+; (shield)( bui|\))/i // Nvidia Portable
826
+ ], [MODEL, [VENDOR, NVIDIA], [TYPE, CONSOLE]], [
827
+ /(playstation \w+)/i // Playstation
828
+ ], [MODEL, [VENDOR, SONY], [TYPE, CONSOLE]], [
829
+ /\b(xbox(?: one)?(?!; xbox))[\); ]/i // Microsoft Xbox
830
+ ], [MODEL, [VENDOR, MICROSOFT], [TYPE, CONSOLE]], [
831
+
832
+ ///////////////////
833
+ // WEARABLES
834
+ ///////////////////
835
+
836
+ /\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i // Samsung Galaxy Watch
837
+ ], [MODEL, [VENDOR, SAMSUNG], [TYPE, WEARABLE]], [
838
+ /((pebble))app/i, // Pebble
839
+ /(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i // Asus ZenWatch / LG Watch / Pixel Watch
840
+ ], [VENDOR, MODEL, [TYPE, WEARABLE]], [
841
+ /(ow(?:19|20)?we?[1-3]{1,3})/i // Oppo Watch
842
+ ], [MODEL, [VENDOR, OPPO], [TYPE, WEARABLE]], [
843
+ /(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i // Apple Watch
844
+ ], [MODEL, [VENDOR, APPLE], [TYPE, WEARABLE]], [
845
+ /(opwwe\d{3})/i // OnePlus Watch
846
+ ], [MODEL, [VENDOR, ONEPLUS], [TYPE, WEARABLE]], [
847
+ /(moto 360)/i // Motorola 360
848
+ ], [MODEL, [VENDOR, MOTOROLA], [TYPE, WEARABLE]], [
849
+ /(smartwatch 3)/i // Sony SmartWatch
850
+ ], [MODEL, [VENDOR, SONY], [TYPE, WEARABLE]], [
851
+ /(g watch r)/i // LG G Watch R
852
+ ], [MODEL, [VENDOR, LG], [TYPE, WEARABLE]], [
853
+ /droid.+; (wt63?0{2,3})\)/i
854
+ ], [MODEL, [VENDOR, ZEBRA], [TYPE, WEARABLE]], [
855
+
856
+ ///////////////////
857
+ // XR
858
+ ///////////////////
859
+
860
+ /droid.+; (glass) \d/i // Google Glass
861
+ ], [MODEL, [VENDOR, GOOGLE], [TYPE, XR]], [
862
+ /(pico) (4|neo3(?: link|pro)?)/i // Pico
863
+ ], [VENDOR, MODEL, [TYPE, XR]], [
864
+ /(quest( \d| pro)?s?).+vr/i // Meta Quest
865
+ ], [MODEL, [VENDOR, FACEBOOK], [TYPE, XR]], [
866
+
867
+ ///////////////////
868
+ // EMBEDDED
869
+ ///////////////////
870
+
871
+ /(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i // Tesla
872
+ ], [VENDOR, [TYPE, EMBEDDED]], [
873
+ /(aeobc)\b/i // Echo Dot
874
+ ], [MODEL, [VENDOR, AMAZON], [TYPE, EMBEDDED]], [
875
+ /(homepod).+mac os/i // Apple HomePod
876
+ ], [MODEL, [VENDOR, APPLE], [TYPE, EMBEDDED]], [
877
+ /windows iot/i
878
+ ], [[TYPE, EMBEDDED]], [
879
+
880
+ ////////////////////
881
+ // MIXED (GENERIC)
882
+ ///////////////////
883
+
884
+ /droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+?(mobile|vr|\d) safari/i
885
+ ], [MODEL, [TYPE, strMapper, { 'mobile' : 'Mobile', 'xr' : 'VR', '*' : TABLET }]], [
886
+ /\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i // Unidentifiable Tablet
887
+ ], [[TYPE, TABLET]], [
888
+ /(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i // Unidentifiable Mobile
889
+ ], [[TYPE, MOBILE]], [
890
+ /droid .+?; ([\w\. -]+)( bui|\))/i // Generic Android Device
891
+ ], [MODEL, [VENDOR, 'Generic']]
892
+ ],
893
+
894
+ engine : [[
895
+
896
+ /windows.+ edge\/([\w\.]+)/i // EdgeHTML
897
+ ], [VERSION, [NAME, EDGE+'HTML']], [
898
+
899
+ /(arkweb)\/([\w\.]+)/i // ArkWeb
900
+ ], [NAME, VERSION], [
901
+
902
+ /webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i // Blink
903
+ ], [VERSION, [NAME, 'Blink']], [
904
+
905
+ /(presto)\/([\w\.]+)/i, // Presto
906
+ /(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i, // WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m/Goanna/Servo
907
+ /ekioh(flow)\/([\w\.]+)/i, // Flow
908
+ /(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i, // KHTML/Tasman/Links
909
+ /(icab)[\/ ]([23]\.[\d\.]+)/i, // iCab
910
+
911
+ /\b(libweb)/i // LibWeb
912
+ ], [NAME, VERSION], [
913
+ /ladybird\//i
914
+ ], [[NAME, 'LibWeb']], [
915
+
916
+ /rv\:([\w\.]{1,9})\b.+(gecko)/i // Gecko
917
+ ], [VERSION, NAME]
918
+ ],
919
+
920
+ os : [[
921
+
922
+ // Windows
923
+ /microsoft (windows) (vista|xp)/i // Windows (iTunes)
924
+ ], [NAME, VERSION], [
925
+ /(windows (?:phone(?: os)?|mobile|iot))[\/ ]?([\d\.\w ]*)/i // Windows Phone
926
+ ], [NAME, [VERSION, strMapper, windowsVersionMap]], [
927
+ /windows nt 6\.2; (arm)/i, // Windows RT
928
+ /windows[\/ ]([ntce\d\. ]+\w)(?!.+xbox)/i,
929
+ /(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i
930
+ ], [[VERSION, strMapper, windowsVersionMap], [NAME, WINDOWS]], [
931
+
932
+ // iOS/macOS
933
+ /[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i, // iOS
934
+ /(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,
935
+ /cfnetwork\/.+darwin/i
936
+ ], [[VERSION, /_/g, '.'], [NAME, 'iOS']], [
937
+ /(mac os x) ?([\w\. ]*)/i,
938
+ /(macintosh|mac_powerpc\b)(?!.+haiku)/i // Mac OS
939
+ ], [[NAME, 'macOS'], [VERSION, /_/g, '.']], [
940
+
941
+ // Google Chromecast
942
+ /android ([\d\.]+).*crkey/i // Google Chromecast, Android-based
943
+ ], [VERSION, [NAME, CHROMECAST + ' Android']], [
944
+ /fuchsia.*crkey\/([\d\.]+)/i // Google Chromecast, Fuchsia-based
945
+ ], [VERSION, [NAME, CHROMECAST + ' Fuchsia']], [
946
+ /crkey\/([\d\.]+).*devicetype\/smartspeaker/i // Google Chromecast, Linux-based Smart Speaker
947
+ ], [VERSION, [NAME, CHROMECAST + ' SmartSpeaker']], [
948
+ /linux.*crkey\/([\d\.]+)/i // Google Chromecast, Legacy Linux-based
949
+ ], [VERSION, [NAME, CHROMECAST + ' Linux']], [
950
+ /crkey\/([\d\.]+)/i // Google Chromecast, unknown
951
+ ], [VERSION, [NAME, CHROMECAST]], [
952
+
953
+ // Mobile OSes
954
+ /droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i // Android-x86/HarmonyOS
955
+ ], [VERSION, NAME], [
956
+ /(ubuntu) ([\w\.]+) like android/i // Ubuntu Touch
957
+ ], [[NAME, /(.+)/, '$1 Touch'], VERSION], [
958
+ // Android/Blackberry/WebOS/QNX/Bada/RIM/KaiOS/Maemo/MeeGo/S40/Sailfish OS/OpenHarmony/Tizen
959
+ /(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen|webos)\w*[-\/\.; ]?([\d\.]*)/i
960
+ ], [NAME, VERSION], [
961
+ /\(bb(10);/i // BlackBerry 10
962
+ ], [VERSION, [NAME, BLACKBERRY]], [
963
+ /(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i // Symbian
964
+ ], [VERSION, [NAME, 'Symbian']], [
965
+ /mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i // Firefox OS
966
+ ], [VERSION, [NAME, FIREFOX+' OS']], [
967
+ /web0s;.+rt(tv)/i,
968
+ /\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i // WebOS
969
+ ], [VERSION, [NAME, 'webOS']], [
970
+ /watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i // watchOS
971
+ ], [VERSION, [NAME, 'watchOS']], [
972
+
973
+ // Google ChromeOS
974
+ /(cros) [\w]+(?:\)| ([\w\.]+)\b)/i // Chromium OS
975
+ ], [[NAME, "Chrome OS"], VERSION],[
976
+
977
+ // Smart TVs
978
+ /panasonic;(viera)/i, // Panasonic Viera
979
+ /(netrange)mmh/i, // Netrange
980
+ /(nettv)\/(\d+\.[\w\.]+)/i, // NetTV
981
+
982
+ // Console
983
+ /(nintendo|playstation) (\w+)/i, // Nintendo/Playstation
984
+ /(xbox); +xbox ([^\);]+)/i, // Microsoft Xbox (360, One, X, S, Series X, Series S)
985
+ /(pico) .+os([\w\.]+)/i, // Pico
986
+
987
+ // Other
988
+ /\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i, // Joli/Palm
989
+ /(mint)[\/\(\) ]?(\w*)/i, // Mint
990
+ /(mageia|vectorlinux)[; ]/i, // Mageia/VectorLinux
991
+ /([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,
992
+ // Ubuntu/Debian/SUSE/Gentoo/Arch/Slackware/Fedora/Mandriva/CentOS/PCLinuxOS/RedHat/Zenwalk/Linpus/Raspbian/Plan9/Minix/RISCOS/Contiki/Deepin/Manjaro/elementary/Sabayon/Linspire
993
+ /(hurd|linux)(?: arm\w*| x86\w*| ?)([\w\.]*)/i, // Hurd/Linux
994
+ /(gnu) ?([\w\.]*)/i, // GNU
995
+ /\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i, // FreeBSD/NetBSD/OpenBSD/PC-BSD/GhostBSD/DragonFly
996
+ /(haiku) (\w+)/i // Haiku
997
+ ], [NAME, VERSION], [
998
+ /(sunos) ?([\w\.\d]*)/i // Solaris
999
+ ], [[NAME, 'Solaris'], VERSION], [
1000
+ /((?:open)?solaris)[-\/ ]?([\w\.]*)/i, // Solaris
1001
+ /(aix) ((\d)(?=\.|\)| )[\w\.])*/i, // AIX
1002
+ /\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i, // BeOS/OS2/AmigaOS/MorphOS/OpenVMS/Fuchsia/HP-UX/SerenityOS
1003
+ /(unix) ?([\w\.]*)/i // UNIX
1004
+ ], [NAME, VERSION]
1005
+ ]
1006
+ };
1007
+
1008
+ /////////////////
1009
+ // Factories
1010
+ ////////////////
1011
+
1012
+ var defaultProps = (function () {
1013
+ var props = { init : {}, isIgnore : {}, isIgnoreRgx : {}, toString : {}};
1014
+ setProps.call(props.init, [
1015
+ [UA_BROWSER, [NAME, VERSION, MAJOR, TYPE]],
1016
+ [UA_CPU, [ARCHITECTURE]],
1017
+ [UA_DEVICE, [TYPE, MODEL, VENDOR]],
1018
+ [UA_ENGINE, [NAME, VERSION]],
1019
+ [UA_OS, [NAME, VERSION]]
1020
+ ]);
1021
+ setProps.call(props.isIgnore, [
1022
+ [UA_BROWSER, [VERSION, MAJOR]],
1023
+ [UA_ENGINE, [VERSION]],
1024
+ [UA_OS, [VERSION]]
1025
+ ]);
1026
+ setProps.call(props.isIgnoreRgx, [
1027
+ [UA_BROWSER, / ?browser$/i],
1028
+ [UA_OS, / ?os$/i]
1029
+ ]);
1030
+ setProps.call(props.toString, [
1031
+ [UA_BROWSER, [NAME, VERSION]],
1032
+ [UA_CPU, [ARCHITECTURE]],
1033
+ [UA_DEVICE, [VENDOR, MODEL]],
1034
+ [UA_ENGINE, [NAME, VERSION]],
1035
+ [UA_OS, [NAME, VERSION]]
1036
+ ]);
1037
+ return props;
1038
+ })();
1039
+
1040
+ var createIData = function (item, itemType) {
1041
+
1042
+ var init_props = defaultProps.init[itemType],
1043
+ is_ignoreProps = defaultProps.isIgnore[itemType] || 0,
1044
+ is_ignoreRgx = defaultProps.isIgnoreRgx[itemType] || 0,
1045
+ toString_props = defaultProps.toString[itemType] || 0;
1046
+
1047
+ function IData () {
1048
+ setProps.call(this, init_props);
1049
+ }
1050
+
1051
+ IData.prototype.getItem = function () {
1052
+ return item;
1053
+ };
1054
+
1055
+ IData.prototype.withClientHints = function () {
1056
+
1057
+ // nodejs / non-client-hints browsers
1058
+ if (!NAVIGATOR_UADATA) {
1059
+ return item
1060
+ .parseCH()
1061
+ .get();
1062
+ }
1063
+
1064
+ // browsers based on chromium 85+
1065
+ return NAVIGATOR_UADATA
1066
+ .getHighEntropyValues(CH_ALL_VALUES)
1067
+ .then(function (res) {
1068
+ return item
1069
+ .setCH(new UACHData(res, false))
1070
+ .parseCH()
1071
+ .get();
1072
+ });
1073
+ };
1074
+
1075
+ IData.prototype.withFeatureCheck = function () {
1076
+ return item.detectFeature().get();
1077
+ };
1078
+
1079
+ if (itemType != UA_RESULT) {
1080
+ IData.prototype.is = function (strToCheck) {
1081
+ var is = false;
1082
+ for (var i in this) {
1083
+ if (this.hasOwnProperty(i) && !has(is_ignoreProps, i) && lowerize(is_ignoreRgx ? strip(is_ignoreRgx, this[i]) : this[i]) == lowerize(is_ignoreRgx ? strip(is_ignoreRgx, strToCheck) : strToCheck)) {
1084
+ is = true;
1085
+ if (strToCheck != UNDEF_TYPE) break;
1086
+ } else if (strToCheck == UNDEF_TYPE && is) {
1087
+ is = !is;
1088
+ break;
1089
+ }
1090
+ }
1091
+ return is;
1092
+ };
1093
+ IData.prototype.toString = function () {
1094
+ var str = EMPTY;
1095
+ for (var i in toString_props) {
1096
+ if (typeof(this[toString_props[i]]) !== UNDEF_TYPE) {
1097
+ str += (str ? ' ' : EMPTY) + this[toString_props[i]];
1098
+ }
1099
+ }
1100
+ return str || UNDEF_TYPE;
1101
+ };
1102
+ }
1103
+
1104
+ if (!NAVIGATOR_UADATA) {
1105
+ IData.prototype.then = function (cb) {
1106
+ var that = this;
1107
+ var IDataResolve = function () {
1108
+ for (var prop in that) {
1109
+ if (that.hasOwnProperty(prop)) {
1110
+ this[prop] = that[prop];
1111
+ }
1112
+ }
1113
+ };
1114
+ IDataResolve.prototype = {
1115
+ is : IData.prototype.is,
1116
+ toString : IData.prototype.toString
1117
+ };
1118
+ var resolveData = new IDataResolve();
1119
+ cb(resolveData);
1120
+ return resolveData;
1121
+ };
1122
+ }
1123
+
1124
+ return new IData();
1125
+ };
1126
+
1127
+ /////////////////
1128
+ // Constructor
1129
+ ////////////////
1130
+
1131
+ function UACHData (uach, isHttpUACH) {
1132
+ uach = uach || {};
1133
+ setProps.call(this, CH_ALL_VALUES);
1134
+ if (isHttpUACH) {
1135
+ setProps.call(this, [
1136
+ [BRANDS, itemListToArray(uach[CH_HEADER])],
1137
+ [FULLVERLIST, itemListToArray(uach[CH_HEADER_FULL_VER_LIST])],
1138
+ [MOBILE, /\?1/.test(uach[CH_HEADER_MOBILE])],
1139
+ [MODEL, stripQuotes(uach[CH_HEADER_MODEL])],
1140
+ [PLATFORM, stripQuotes(uach[CH_HEADER_PLATFORM])],
1141
+ [PLATFORMVER, stripQuotes(uach[CH_HEADER_PLATFORM_VER])],
1142
+ [ARCHITECTURE, stripQuotes(uach[CH_HEADER_ARCH])],
1143
+ [FORMFACTORS, itemListToArray(uach[CH_HEADER_FORM_FACTORS])],
1144
+ [BITNESS, stripQuotes(uach[CH_HEADER_BITNESS])]
1145
+ ]);
1146
+ } else {
1147
+ for (var prop in uach) {
1148
+ if(this.hasOwnProperty(prop) && typeof uach[prop] !== UNDEF_TYPE) this[prop] = uach[prop];
1149
+ }
1150
+ }
1151
+ }
1152
+
1153
+ function UAItem (itemType, ua, rgxMap, uaCH) {
1154
+
1155
+ this.get = function (prop) {
1156
+ if (!prop) return this.data;
1157
+ return this.data.hasOwnProperty(prop) ? this.data[prop] : undefined$1;
1158
+ };
1159
+
1160
+ this.set = function (prop, val) {
1161
+ this.data[prop] = val;
1162
+ return this;
1163
+ };
1164
+
1165
+ this.setCH = function (ch) {
1166
+ this.uaCH = ch;
1167
+ return this;
1168
+ };
1169
+
1170
+ this.detectFeature = function () {
1171
+ if (NAVIGATOR && NAVIGATOR.userAgent == this.ua) {
1172
+ switch (this.itemType) {
1173
+ case UA_BROWSER:
1174
+ // Brave-specific detection
1175
+ if (NAVIGATOR.brave && typeof NAVIGATOR.brave.isBrave == FUNC_TYPE) {
1176
+ this.set(NAME, 'Brave');
1177
+ }
1178
+ break;
1179
+ case UA_DEVICE:
1180
+ // Chrome-specific detection: check for 'mobile' value of navigator.userAgentData
1181
+ if (!this.get(TYPE) && NAVIGATOR_UADATA && NAVIGATOR_UADATA[MOBILE]) {
1182
+ this.set(TYPE, MOBILE);
1183
+ }
1184
+ // iPadOS-specific detection: identified as Mac, but has some iOS-only properties
1185
+ if (this.get(MODEL) == 'Macintosh' && NAVIGATOR && typeof NAVIGATOR.standalone !== UNDEF_TYPE && NAVIGATOR.maxTouchPoints && NAVIGATOR.maxTouchPoints > 2) {
1186
+ this.set(MODEL, 'iPad')
1187
+ .set(TYPE, TABLET);
1188
+ }
1189
+ break;
1190
+ case UA_OS:
1191
+ // Chrome-specific detection: check for 'platform' value of navigator.userAgentData
1192
+ if (!this.get(NAME) && NAVIGATOR_UADATA && NAVIGATOR_UADATA[PLATFORM]) {
1193
+ this.set(NAME, NAVIGATOR_UADATA[PLATFORM]);
1194
+ }
1195
+ break;
1196
+ case UA_RESULT:
1197
+ var data = this.data;
1198
+ var detect = function (itemType) {
1199
+ return data[itemType]
1200
+ .getItem()
1201
+ .detectFeature()
1202
+ .get();
1203
+ };
1204
+ this.set(UA_BROWSER, detect(UA_BROWSER))
1205
+ .set(UA_CPU, detect(UA_CPU))
1206
+ .set(UA_DEVICE, detect(UA_DEVICE))
1207
+ .set(UA_ENGINE, detect(UA_ENGINE))
1208
+ .set(UA_OS, detect(UA_OS));
1209
+ }
1210
+ }
1211
+ return this;
1212
+ };
1213
+
1214
+ this.parseUA = function () {
1215
+ if (this.itemType != UA_RESULT) {
1216
+ rgxMapper.call(this.data, this.ua, this.rgxMap);
1217
+ }
1218
+ if (this.itemType == UA_BROWSER) {
1219
+ this.set(MAJOR, majorize(this.get(VERSION)));
1220
+ }
1221
+ return this;
1222
+ };
1223
+
1224
+ this.parseCH = function () {
1225
+ var uaCH = this.uaCH,
1226
+ rgxMap = this.rgxMap;
1227
+
1228
+ switch (this.itemType) {
1229
+ case UA_BROWSER:
1230
+ case UA_ENGINE:
1231
+ var brands = uaCH[FULLVERLIST] || uaCH[BRANDS], prevName;
1232
+ if (brands) {
1233
+ for (var i in brands) {
1234
+ var brandName = brands[i].brand || brands[i],
1235
+ brandVersion = brands[i].version;
1236
+ if (this.itemType == UA_BROWSER && !/not.a.brand/i.test(brandName) && (!prevName || (/chrom/i.test(prevName) && brandName != CHROMIUM))) {
1237
+ brandName = strMapper(brandName, {
1238
+ 'Chrome' : 'Google Chrome',
1239
+ 'Edge' : 'Microsoft Edge',
1240
+ 'Chrome WebView' : 'Android WebView',
1241
+ 'Chrome Headless' : 'HeadlessChrome',
1242
+ 'Huawei Browser' : 'HuaweiBrowser',
1243
+ 'MIUI Browser' : 'Miui Browser',
1244
+ 'Opera Mobi' : 'OperaMobile',
1245
+ 'Yandex' : 'YaBrowser'
1246
+ });
1247
+ this.set(NAME, brandName)
1248
+ .set(VERSION, brandVersion)
1249
+ .set(MAJOR, majorize(brandVersion));
1250
+ prevName = brandName;
1251
+ }
1252
+ if (this.itemType == UA_ENGINE && brandName == CHROMIUM) {
1253
+ this.set(VERSION, brandVersion);
1254
+ }
1255
+ }
1256
+ }
1257
+ break;
1258
+ case UA_CPU:
1259
+ var archName = uaCH[ARCHITECTURE];
1260
+ if (archName) {
1261
+ if (archName && uaCH[BITNESS] == '64') archName += '64';
1262
+ rgxMapper.call(this.data, archName + ';', rgxMap);
1263
+ }
1264
+ break;
1265
+ case UA_DEVICE:
1266
+ if (uaCH[MOBILE]) {
1267
+ this.set(TYPE, MOBILE);
1268
+ }
1269
+ if (uaCH[MODEL]) {
1270
+ this.set(MODEL, uaCH[MODEL]);
1271
+ if (!this.get(TYPE) || !this.get(VENDOR)) {
1272
+ var reParse = {};
1273
+ rgxMapper.call(reParse, 'droid 9; ' + uaCH[MODEL] + ')', rgxMap);
1274
+ if (!this.get(TYPE) && !!reParse.type) {
1275
+ this.set(TYPE, reParse.type);
1276
+ }
1277
+ if (!this.get(VENDOR) && !!reParse.vendor) {
1278
+ this.set(VENDOR, reParse.vendor);
1279
+ }
1280
+ }
1281
+ }
1282
+ if (uaCH[FORMFACTORS]) {
1283
+ var ff;
1284
+ if (typeof uaCH[FORMFACTORS] !== 'string') {
1285
+ var idx = 0;
1286
+ while (!ff && idx < uaCH[FORMFACTORS].length) {
1287
+ ff = strMapper(uaCH[FORMFACTORS][idx++], formFactorsMap);
1288
+ }
1289
+ } else {
1290
+ ff = strMapper(uaCH[FORMFACTORS], formFactorsMap);
1291
+ }
1292
+ this.set(TYPE, ff);
1293
+ }
1294
+ break;
1295
+ case UA_OS:
1296
+ var osName = uaCH[PLATFORM];
1297
+ if(osName) {
1298
+ var osVersion = uaCH[PLATFORMVER];
1299
+ if (osName == WINDOWS) osVersion = (parseInt(majorize(osVersion), 10) >= 13 ? '11' : '10');
1300
+ this.set(NAME, osName)
1301
+ .set(VERSION, osVersion);
1302
+ }
1303
+ // Xbox-Specific Detection
1304
+ if (this.get(NAME) == WINDOWS && uaCH[MODEL] == 'Xbox') {
1305
+ this.set(NAME, 'Xbox')
1306
+ .set(VERSION, undefined$1);
1307
+ }
1308
+ break;
1309
+ case UA_RESULT:
1310
+ var data = this.data;
1311
+ var parse = function (itemType) {
1312
+ return data[itemType]
1313
+ .getItem()
1314
+ .setCH(uaCH)
1315
+ .parseCH()
1316
+ .get();
1317
+ };
1318
+ this.set(UA_BROWSER, parse(UA_BROWSER))
1319
+ .set(UA_CPU, parse(UA_CPU))
1320
+ .set(UA_DEVICE, parse(UA_DEVICE))
1321
+ .set(UA_ENGINE, parse(UA_ENGINE))
1322
+ .set(UA_OS, parse(UA_OS));
1323
+ }
1324
+ return this;
1325
+ };
1326
+
1327
+ setProps.call(this, [
1328
+ ['itemType', itemType],
1329
+ ['ua', ua],
1330
+ ['uaCH', uaCH],
1331
+ ['rgxMap', rgxMap],
1332
+ ['data', createIData(this, itemType)]
1333
+ ]);
1334
+
1335
+ return this;
1336
+ }
1337
+
1338
+ function UAParser (ua, extensions, headers) {
1339
+
1340
+ if (typeof ua === OBJ_TYPE) {
1341
+ if (isExtensions(ua, true)) {
1342
+ if (typeof extensions === OBJ_TYPE) {
1343
+ headers = extensions; // case UAParser(extensions, headers)
1344
+ }
1345
+ extensions = ua; // case UAParser(extensions)
1346
+ } else {
1347
+ headers = ua; // case UAParser(headers)
1348
+ extensions = undefined$1;
1349
+ }
1350
+ ua = undefined$1;
1351
+ } else if (typeof ua === STR_TYPE && !isExtensions(extensions, true)) {
1352
+ headers = extensions; // case UAParser(ua, headers)
1353
+ extensions = undefined$1;
1354
+ }
1355
+
1356
+ // Convert Headers object into a plain object
1357
+ if (headers && typeof headers.append === FUNC_TYPE) {
1358
+ var kv = {};
1359
+ headers.forEach(function (v, k) { kv[k] = v; });
1360
+ headers = kv;
1361
+ }
1362
+
1363
+ if (!(this instanceof UAParser)) {
1364
+ return new UAParser(ua, extensions, headers).getResult();
1365
+ }
1366
+
1367
+ var userAgent = typeof ua === STR_TYPE ? ua : // Passed user-agent string
1368
+ (headers && headers[USER_AGENT] ? headers[USER_AGENT] : // User-Agent from passed headers
1369
+ ((NAVIGATOR && NAVIGATOR.userAgent) ? NAVIGATOR.userAgent : // navigator.userAgent
1370
+ EMPTY)), // empty string
1371
+
1372
+ httpUACH = new UACHData(headers, true),
1373
+ regexMap = extensions ?
1374
+ extend(defaultRegexes, extensions) :
1375
+ defaultRegexes,
1376
+
1377
+ createItemFunc = function (itemType) {
1378
+ if (itemType == UA_RESULT) {
1379
+ return function () {
1380
+ return new UAItem(itemType, userAgent, regexMap, httpUACH)
1381
+ .set('ua', userAgent)
1382
+ .set(UA_BROWSER, this.getBrowser())
1383
+ .set(UA_CPU, this.getCPU())
1384
+ .set(UA_DEVICE, this.getDevice())
1385
+ .set(UA_ENGINE, this.getEngine())
1386
+ .set(UA_OS, this.getOS())
1387
+ .get();
1388
+ };
1389
+ } else {
1390
+ return function () {
1391
+ return new UAItem(itemType, userAgent, regexMap[itemType], httpUACH)
1392
+ .parseUA()
1393
+ .get();
1394
+ };
1395
+ }
1396
+ };
1397
+
1398
+ // public methods
1399
+ setProps.call(this, [
1400
+ ['getBrowser', createItemFunc(UA_BROWSER)],
1401
+ ['getCPU', createItemFunc(UA_CPU)],
1402
+ ['getDevice', createItemFunc(UA_DEVICE)],
1403
+ ['getEngine', createItemFunc(UA_ENGINE)],
1404
+ ['getOS', createItemFunc(UA_OS)],
1405
+ ['getResult', createItemFunc(UA_RESULT)],
1406
+ ['getUA', function () { return userAgent; }],
1407
+ ['setUA', function (ua) {
1408
+ if (isString(ua))
1409
+ userAgent = ua.length > UA_MAX_LENGTH ? trim(ua, UA_MAX_LENGTH) : ua;
1410
+ return this;
1411
+ }]
1412
+ ])
1413
+ .setUA(userAgent);
1414
+
1415
+ return this;
1416
+ }
1417
+
1418
+ UAParser.VERSION = LIBVERSION;
1419
+ UAParser.BROWSER = enumerize([NAME, VERSION, MAJOR, TYPE]);
1420
+ UAParser.CPU = enumerize([ARCHITECTURE]);
1421
+ UAParser.DEVICE = enumerize([MODEL, VENDOR, TYPE, CONSOLE, MOBILE, SMARTTV, TABLET, WEARABLE, EMBEDDED]);
1422
+ UAParser.ENGINE = UAParser.OS = enumerize([NAME, VERSION]);
1423
+
1424
+ ///////////
1425
+ // Export
1426
+ //////////
1427
+
1428
+ // check js environment
1429
+ {
1430
+ // nodejs env
1431
+ if (module.exports) {
1432
+ exports = module.exports = UAParser;
1433
+ }
1434
+ exports.UAParser = UAParser;
1435
+ }
1436
+
1437
+ // jQuery/Zepto specific (optional)
1438
+ // Note:
1439
+ // In AMD env the global scope should be kept clean, but jQuery is an exception.
1440
+ // jQuery always exports to global scope, unless jQuery.noConflict(true) is used,
1441
+ // and we should catch that.
1442
+ var $ = isWindow && (window.jQuery || window.Zepto);
1443
+ if ($ && !$.ua) {
1444
+ var parser = new UAParser();
1445
+ $.ua = parser.getResult();
1446
+ $.ua.get = function () {
1447
+ return parser.getUA();
1448
+ };
1449
+ $.ua.set = function (ua) {
1450
+ parser.setUA(ua);
1451
+ var result = parser.getResult();
1452
+ for (var prop in result) {
1453
+ $.ua[prop] = result[prop];
1454
+ }
1455
+ };
1456
+ }
1457
+
1458
+ })(typeof window === 'object' ? window : uaParser);
1459
+ } (uaParser$1, uaParser$1.exports));
1460
+ return uaParser$1.exports;
50
1461
  }
51
1462
 
52
- function getMergeFunction(key, options) {
53
- if (!options.customMerge) {
54
- return deepmerge
1463
+ var uaParserExports = requireUaParser();
1464
+
1465
+ var cjs;
1466
+ var hasRequiredCjs;
1467
+
1468
+ function requireCjs () {
1469
+ if (hasRequiredCjs) return cjs;
1470
+ hasRequiredCjs = 1;
1471
+
1472
+ var isMergeableObject = function isMergeableObject(value) {
1473
+ return isNonNullObject(value)
1474
+ && !isSpecial(value)
1475
+ };
1476
+
1477
+ function isNonNullObject(value) {
1478
+ return !!value && typeof value === 'object'
55
1479
  }
56
- var customMerge = options.customMerge(key);
57
- return typeof customMerge === 'function' ? customMerge : deepmerge
58
- }
59
1480
 
60
- function getEnumerableOwnPropertySymbols(target) {
61
- return Object.getOwnPropertySymbols
62
- ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
63
- return Object.propertyIsEnumerable.call(target, symbol)
64
- })
65
- : []
66
- }
1481
+ function isSpecial(value) {
1482
+ var stringValue = Object.prototype.toString.call(value);
67
1483
 
68
- function getKeys(target) {
69
- return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))
70
- }
1484
+ return stringValue === '[object RegExp]'
1485
+ || stringValue === '[object Date]'
1486
+ || isReactElement(value)
1487
+ }
71
1488
 
72
- function propertyIsOnObject(object, property) {
73
- try {
74
- return property in object
75
- } catch(_) {
76
- return false
1489
+ // see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
1490
+ var canUseSymbol = typeof Symbol === 'function' && Symbol.for;
1491
+ var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;
1492
+
1493
+ function isReactElement(value) {
1494
+ return value.$$typeof === REACT_ELEMENT_TYPE
77
1495
  }
78
- }
79
1496
 
80
- // Protects from prototype poisoning and unexpected merging up the prototype chain.
81
- function propertyIsUnsafe(target, key) {
82
- return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,
83
- && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,
84
- && Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.
85
- }
1497
+ function emptyTarget(val) {
1498
+ return Array.isArray(val) ? [] : {}
1499
+ }
86
1500
 
87
- function mergeObject(target, source, options) {
88
- var destination = {};
89
- if (options.isMergeableObject(target)) {
90
- getKeys(target).forEach(function(key) {
91
- destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
92
- });
1501
+ function cloneUnlessOtherwiseSpecified(value, options) {
1502
+ return (options.clone !== false && options.isMergeableObject(value))
1503
+ ? deepmerge(emptyTarget(value), value, options)
1504
+ : value
93
1505
  }
94
- getKeys(source).forEach(function(key) {
95
- if (propertyIsUnsafe(target, key)) {
96
- return
1506
+
1507
+ function defaultArrayMerge(target, source, options) {
1508
+ return target.concat(source).map(function(element) {
1509
+ return cloneUnlessOtherwiseSpecified(element, options)
1510
+ })
1511
+ }
1512
+
1513
+ function getMergeFunction(key, options) {
1514
+ if (!options.customMerge) {
1515
+ return deepmerge
97
1516
  }
1517
+ var customMerge = options.customMerge(key);
1518
+ return typeof customMerge === 'function' ? customMerge : deepmerge
1519
+ }
98
1520
 
99
- if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
100
- destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
101
- } else {
102
- destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
1521
+ function getEnumerableOwnPropertySymbols(target) {
1522
+ return Object.getOwnPropertySymbols
1523
+ ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
1524
+ return Object.propertyIsEnumerable.call(target, symbol)
1525
+ })
1526
+ : []
1527
+ }
1528
+
1529
+ function getKeys(target) {
1530
+ return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))
1531
+ }
1532
+
1533
+ function propertyIsOnObject(object, property) {
1534
+ try {
1535
+ return property in object
1536
+ } catch(_) {
1537
+ return false
103
1538
  }
104
- });
105
- return destination
106
- }
1539
+ }
107
1540
 
108
- function deepmerge(target, source, options) {
109
- options = options || {};
110
- options.arrayMerge = options.arrayMerge || defaultArrayMerge;
111
- options.isMergeableObject = options.isMergeableObject || isMergeableObject;
112
- // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()
113
- // implementations can use it. The caller may not replace it.
114
- options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
115
-
116
- var sourceIsArray = Array.isArray(source);
117
- var targetIsArray = Array.isArray(target);
118
- var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
119
-
120
- if (!sourceAndTargetTypesMatch) {
121
- return cloneUnlessOtherwiseSpecified(source, options)
122
- } else if (sourceIsArray) {
123
- return options.arrayMerge(target, source, options)
124
- } else {
125
- return mergeObject(target, source, options)
1541
+ // Protects from prototype poisoning and unexpected merging up the prototype chain.
1542
+ function propertyIsUnsafe(target, key) {
1543
+ return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,
1544
+ && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,
1545
+ && Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.
126
1546
  }
127
- }
128
1547
 
129
- deepmerge.all = function deepmergeAll(array, options) {
130
- if (!Array.isArray(array)) {
131
- throw new Error('first argument should be an array')
1548
+ function mergeObject(target, source, options) {
1549
+ var destination = {};
1550
+ if (options.isMergeableObject(target)) {
1551
+ getKeys(target).forEach(function(key) {
1552
+ destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
1553
+ });
1554
+ }
1555
+ getKeys(source).forEach(function(key) {
1556
+ if (propertyIsUnsafe(target, key)) {
1557
+ return
1558
+ }
1559
+
1560
+ if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
1561
+ destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
1562
+ } else {
1563
+ destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
1564
+ }
1565
+ });
1566
+ return destination
132
1567
  }
133
1568
 
134
- return array.reduce(function(prev, next) {
135
- return deepmerge(prev, next, options)
136
- }, {})
137
- };
1569
+ function deepmerge(target, source, options) {
1570
+ options = options || {};
1571
+ options.arrayMerge = options.arrayMerge || defaultArrayMerge;
1572
+ options.isMergeableObject = options.isMergeableObject || isMergeableObject;
1573
+ // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()
1574
+ // implementations can use it. The caller may not replace it.
1575
+ options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
1576
+
1577
+ var sourceIsArray = Array.isArray(source);
1578
+ var targetIsArray = Array.isArray(target);
1579
+ var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
1580
+
1581
+ if (!sourceAndTargetTypesMatch) {
1582
+ return cloneUnlessOtherwiseSpecified(source, options)
1583
+ } else if (sourceIsArray) {
1584
+ return options.arrayMerge(target, source, options)
1585
+ } else {
1586
+ return mergeObject(target, source, options)
1587
+ }
1588
+ }
1589
+
1590
+ deepmerge.all = function deepmergeAll(array, options) {
1591
+ if (!Array.isArray(array)) {
1592
+ throw new Error('first argument should be an array')
1593
+ }
138
1594
 
139
- var deepmerge_1 = deepmerge;
1595
+ return array.reduce(function(prev, next) {
1596
+ return deepmerge(prev, next, options)
1597
+ }, {})
1598
+ };
140
1599
 
141
- var cjs = deepmerge_1;
1600
+ var deepmerge_1 = deepmerge;
1601
+
1602
+ cjs = deepmerge_1;
1603
+ return cjs;
1604
+ }
1605
+
1606
+ var cjsExports = requireCjs();
1607
+ var merge = /*@__PURE__*/getDefaultExportFromCjs(cjsExports);
142
1608
 
143
1609
  /**
144
1610
  * GeoLocationProvider provides methods to access the device's location via the GeoLocation API ({@link https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API GeoLocation API}).
145
1611
  */
146
1612
  class GeoLocationProvider {
147
- /**
148
- * Check if it is possible to get the position of the device using the GeoLocation API.
149
- *
150
- * @returns {boolean} True if the GeoLocation API is available in the browser, false otherwise.
151
- */
152
- isAvailable() {
153
- return 'geolocation' in navigator;
154
- }
155
- /**
156
- * Check if the user has already granted permission to access the device's location.
157
- *
158
- * @returns {Promise<boolean>} A promise that resolves to true if permission is granted, false otherwise.
159
- */
160
- async isAlreadyGranted() {
161
- if ('permissions' in navigator === false || 'query' in navigator.permissions === false) {
162
- return Promise.resolve(false);
1613
+ /**
1614
+ * Check if it is possible to get the position of the device using the GeoLocation API.
1615
+ *
1616
+ * @returns {boolean} True if the GeoLocation API is available in the browser, false otherwise.
1617
+ */
1618
+ isAvailable() {
1619
+ return 'geolocation' in navigator;
163
1620
  }
164
- else {
165
- const result = await navigator.permissions.query({ name: 'geolocation' });
166
- return result.state === 'granted';
1621
+ /**
1622
+ * Check if the user has already granted permission to access the device's location.
1623
+ *
1624
+ * @returns {Promise<boolean>} A promise that resolves to true if permission is granted, false otherwise.
1625
+ */
1626
+ async isAlreadyGranted() {
1627
+ if ('permissions' in navigator === false || 'query' in navigator.permissions === false) {
1628
+ return Promise.resolve(false);
1629
+ }
1630
+ else {
1631
+ const result = await navigator.permissions.query({ name: 'geolocation' });
1632
+ return result.state === 'granted';
1633
+ }
167
1634
  }
168
- }
169
- /**
170
- * Listen for position updates from the GeoLocation API.
171
- *
172
- * @param {number} maxAccuracy - The maximum accuracy of the position to accept.
173
- * @param {Function} positionError - Callback function to call when an error occurs while getting the position.
174
- * @param {Function} positionInaccurate - Callback function to call when the position is inaccurate.
175
- * @param {Function} positionRequesting - Callback function to call when the position is being requested.
176
- * @param {Function} positionReceived - Callback function to call when a position is received.
177
- */
178
- listenForPosition(maxAccuracy, positionError, positionInaccurate, positionRequesting, positionReceived) {
179
- if ('permissions' in navigator === false || 'query' in navigator.permissions === false) {
180
- positionError();
181
- return;
1635
+ /**
1636
+ * Listen for position updates from the GeoLocation API.
1637
+ *
1638
+ * @param {number} maxAccuracy - The maximum accuracy of the position to accept.
1639
+ * @param {Function} positionError - Callback function to call when an error occurs while getting the position.
1640
+ * @param {Function} positionInaccurate - Callback function to call when the position is inaccurate.
1641
+ * @param {Function} positionRequesting - Callback function to call when the position is being requested.
1642
+ * @param {Function} positionReceived - Callback function to call when a position is received.
1643
+ */
1644
+ listenForPosition(maxAccuracy, positionError, positionInaccurate, positionRequesting, positionReceived) {
1645
+ if ('permissions' in navigator === false || 'query' in navigator.permissions === false) {
1646
+ positionError();
1647
+ return;
1648
+ }
1649
+ positionRequesting();
1650
+ const requestTime = Date.now();
1651
+ GeoLocationProvider.positionWatchId = navigator.geolocation.watchPosition(position => {
1652
+ // If position is the same as before, don't do anything.
1653
+ if (GeoLocationProvider.currentPosition
1654
+ && position.coords.accuracy === GeoLocationProvider.currentPosition.coords.accuracy
1655
+ && position.coords.latitude === GeoLocationProvider.currentPosition.coords.latitude
1656
+ && position.coords.longitude === GeoLocationProvider.currentPosition.coords.longitude) {
1657
+ return;
1658
+ }
1659
+ GeoLocationProvider.currentPosition = position;
1660
+ if (!(GeoLocationProvider.currentPosition.coords.accuracy <= maxAccuracy)) {
1661
+ positionInaccurate(position.coords.accuracy);
1662
+ }
1663
+ else {
1664
+ positionReceived(position);
1665
+ }
1666
+ }, error => {
1667
+ // Firefox may throw both success and a timeout error (https://bugzilla.mozilla.org/show_bug.cgi?id=1283563).
1668
+ // We mitigate this by not passing on error if a correct position has been given since asking for it.
1669
+ if (error.code !== 3 || !GeoLocationProvider.currentPosition || GeoLocationProvider.currentPosition.timestamp <= requestTime) {
1670
+ positionError(error);
1671
+ }
1672
+ });
182
1673
  }
183
- positionRequesting();
184
- const requestTime = Date.now();
185
- GeoLocationProvider.positionWatchId = navigator.geolocation.watchPosition(position => {
186
- // If position is the same as before, don't do anything.
187
- if (GeoLocationProvider.currentPosition
188
- && position.coords.accuracy === GeoLocationProvider.currentPosition.coords.accuracy
189
- && position.coords.latitude === GeoLocationProvider.currentPosition.coords.latitude
190
- && position.coords.longitude === GeoLocationProvider.currentPosition.coords.longitude) {
191
- return;
192
- }
193
- GeoLocationProvider.currentPosition = position;
194
- if (!(GeoLocationProvider.currentPosition.coords.accuracy <= maxAccuracy)) {
195
- positionInaccurate(position.coords.accuracy);
196
- }
197
- else {
198
- positionReceived(position);
199
- }
200
- }, error => {
201
- // Firefox may throw both success and a timeout error (https://bugzilla.mozilla.org/show_bug.cgi?id=1283563).
202
- // We mitigate this by not passing on error if a correct position has been given since asking for it.
203
- if (error.code !== 3 || !GeoLocationProvider.currentPosition || GeoLocationProvider.currentPosition.timestamp <= requestTime) {
204
- positionError(error);
205
- }
206
- });
207
- }
208
- /**
209
- * Stop listening for position updates from the GeoLocation API.
210
- * This will clear the watch set by `listenForPosition` and reset the current position.
211
- *
212
- * @returns {void}
213
- */
214
- stopListeningForPosition() {
215
- if (GeoLocationProvider.positionWatchId !== null) {
216
- navigator.geolocation.clearWatch(GeoLocationProvider.positionWatchId);
217
- GeoLocationProvider.positionWatchId = null;
1674
+ /**
1675
+ * Stop listening for position updates from the GeoLocation API.
1676
+ * This will clear the watch set by `listenForPosition` and reset the current position.
1677
+ *
1678
+ * @returns {void}
1679
+ */
1680
+ stopListeningForPosition() {
1681
+ if (GeoLocationProvider.positionWatchId !== null) {
1682
+ navigator.geolocation.clearWatch(GeoLocationProvider.positionWatchId);
1683
+ GeoLocationProvider.positionWatchId = null;
1684
+ }
1685
+ GeoLocationProvider.currentPosition = null;
218
1686
  }
219
- GeoLocationProvider.currentPosition = null;
220
- }
221
1687
  }
222
1688
  /**
223
1689
  * The current position of the device if received.
@@ -232,755 +1698,756 @@ GeoLocationProvider.currentPosition = null;
232
1698
  */
233
1699
  GeoLocationProvider.positionWatchId = null;
234
1700
 
235
- const myPositionCss = ".mi-my-position{display:flex;flex-direction:column;pointer-events:auto;gap:16px;right:0}.mi-my-position__position-button,.mi-my-position__compass-button{margin:0;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;width:48px;height:48px;background-repeat:no-repeat;background-position:center;outline:none;border-color:#e5e7eb;border-style:solid;background-color:#fcfcfc}.mi-my-position__position-button{background-size:23px;border-radius:8px}.mi-my-position__position-button--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zZDMC4zNzI1MSAxNC43Mjg3IDAuMTQ5ODEyIDEwLjgxMTcgMi44Njc2NCA5Ljc2Mkw2LjY0NTEyIDguMzAzMDlMOC4xOTE3NyA5Ljg0OTc0TDMuNTg4MTkgMTEuNjI3N0MyLjY4MjI0IDExLjk3NzYgMi43NTY0OCAxMy4yODMzIDMuNjk2MjUgMTMuNTI4Mkw4LjYzMzUgMTQuODE1MUM5LjMzNDQzIDE0Ljk5NzggOS44ODE3OCAxNS41NDUyIDEwLjA2NDQgMTYuMjQ2TDExLjM1MTMgMjEuMTgzMkMxMS41OTYyIDIyLjEyMjkgMTIuOTAxOSAyMi4xOTcyIDEzLjI1MTggMjEuMjkxMloiIGZpbGw9IiM3MzczNzMiLz4KPC9zdmc+Cg==)}.mi-my-position__position-button--requesting{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTkiIGhlaWdodD0iMTkiIHZpZXdCb3g9IjAgMCAxOSAxOSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTYuODkzNDEgMTEuMjgzTDEuOTU2MTYgOS45OTYxMUMwLjA3NjYyOTIgOS41MDYyIC0wLjA3MTg0MTEgNi44OTQ4NSAxLjc0MDA1IDYuMTk1MDdMMTYuMzg4NiAwLjUzNzYxN0MxNy42MTkxIDAuMDYyMzc2NiAxOC44Mjk0IDEuMjcyNjYgMTguMzU0MSAyLjUwMzE2TDEyLjY5NjcgMTcuMTUxN0MxMS45OTY5IDE4Ljk2MzYgOS4zODU2NCAxOC44MTUxIDguODk1NzQgMTYuOTM1Nkw3LjYwODg0IDExLjk5ODRDNy41MTc1NCAxMS42NDggNy4yNDM4NiAxMS4zNzQzIDYuODkzNDEgMTEuMjgzWiIgZmlsbD0iIzczNzM3MyIvPgo8L3N2Zz4K)}.mi-my-position__position-button--known{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTkiIGhlaWdodD0i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MuOTkyMyAwLjk3MTY4MyAxMy4xNTM4IDEuMzI3ODggMTIuMzYwNkw1LjU0ODEzIDIuOTYyNDFaIiBmaWxsPSIjREMyNjI2Ii8+CjxwYXRoIGQ9Ik03LjM3MjUzIDI3Ljg5OTRDNy4wMTkwNiAyOC42ODY1IDUuOTAxNSAyOC42ODY1IDUuNTQ4MDQgMjcuODk5NEwxLjMyNzc5IDE4LjUwMTJDMC45NzE1OTcgMTcuNzA4IDEuNzI3NTkgMTYuODY5NSAyLjU1MzM0IDE3LjE0Mkw2LjE0Njk4IDE4LjMyNzVDNi4zNTA0NiAxOC4zOTQ3IDYuNTcwMTEgMTguMzk0NyA2Ljc3MzU5IDE4LjMyNzVMMTAuMzY3MiAxNy4xNDJDMTEuMTkzIDE2Ljg2OTUgMTEuOTQ5IDE3LjcwOCAxMS41OTI4IDE4LjUwMTJMNy4zNzI1MyAyNy44OTk0WiIgZmlsbD0iIzlDQTNBRiIvPgo8L3N2Zz4K);border-radius:50%}";
1701
+ const myPositionCss = () => `.mi-my-position{display:flex;flex-direction:column;pointer-events:auto;gap:16px;right:0}.mi-my-position__position-button,.mi-my-position__compass-button{margin:0;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;width:48px;height:48px;background-repeat:no-repeat;background-position:center;outline:none;border-color:#e5e7eb;border-style:solid;background-color:#fcfcfc}.mi-my-position__position-button{background-size:23px;border-radius:8px}.mi-my-position__position-button--unknown{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0zLjY1NTIzIDEuMjIzNTZDMy4yNjQ3IDAuODMzMDMzIDIuNjMxNTQgMC44MzMwMzMgMi4yN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uMTgzMkMxMS41OTYyIDIyLjEyMjkgMTIuOTAxOSAyMi4xOTcyIDEzLjI1MTggMjEuMjkxMloiIGZpbGw9IiM3MzczNzMiLz4KPC9zdmc+Cg==)}.mi-my-position__position-button--requesting{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTkiIGhlaWdodD0iMTkiIHZpZXdCb3g9IjAgMCAxOSAxOSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTYuODkzNDEgMTEuMjgzTDEuOTU2MTYgOS45OTYxMUMwLjA3NjYyOTIgOS41MDYyIC0wLjA3MTg0MTEgNi44OTQ4NSAxLjc0MDA1IDYuMTk1MDdMMTYuMzg4NiAwLjUzNzYxN0MxNy42MTkxIDAuMDYyMzc2NiAxOC44Mjk0IDEuMjcyNjYgMTguMzU0MSAyLjUwMzE2TDEyLjY5NjcgMTcuMTUxN0MxMS45OTY5IDE4Ljk2MzYgOS4zODU2NCAxOC44MTUxIDguODk1NzQgMTYuOTM1Nkw3LjYwODg0IDExLjk5ODRDNy41MTc1NCAxMS42NDggNy4yNDM4NiAxMS4zNzQzIDYuODkzNDEgMTEuMjgzWiIgZmlsbD0iIzczNzM3MyIvPgo8L3N2Zz4K)}.mi-my-position__position-button--known{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTkiIGhlaWdodD0iMTkiIHZpZXdCb3g9IjAgMCAxOSAxOSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTYuODkzNDEgMTEuMjgzTDEuOTU2MTYgOS45OTYxMUMwLjA3NjYyOTIgOS41MDYyIC0wLjA3MTg0MTEgNi44OTQ4NSAxLjc0MDA1IDYuMTk1MDdMMTYuMzg4NiAwLjUzNzYxN0MxNy42MTkxIDAuMDYyMzc2NiAxOC44Mjk0IDEuMjcyNjYgMTguMzU0MSAyLjUwMzE2TDEyLjY5NjcgMTcuMTUxN0MxMS45OTY5IDE4Ljk2MzYgOS4zODU2NCAxOC44MTUxIDguODk1NzQgMTYuOTM1Nkw3LjYwODg0IDExLjk5ODRDNy41MTc1NCAxMS42NDggNy4yNDM4NiAxMS4zNzQzIDYuODkzNDEgMTEuMjgzWiIgZmlsbD0iIzczNzM3MyIvPgo8L3N2Zz4K)}.mi-my-position__position-button--centered{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTkiIGhlaWdodD0iMTkiIHZpZXdCb3g9IjAgMCAxOSAxOSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTYuODkzNDEgMTEuMjgzTDEuOTU2MTYgOS45OTYxMUMwLjA3NjYyOTIgOS41MDYyIC0wLjA3MTg0MTEgNi44OTQ4NSAxLjc0MDA1IDYuMTk1MDdMMTYuMzg4NiAwLjUzNzYxN0MxNy42MTkxIDAuMDYyMzc2NiAxOC44Mjk0IDEuMjcyNjYgMTguMzU0MSAyLjUwMzE2TDEyLjY5NjcgMTcuMTUxN0MxMS45OTY5IDE4Ljk2MzYgOS4zODU2NCAxOC44MTUxIDguODk1NzQgMTYuOTM1Nkw3LjYwODg0IDExLjk5ODRDNy41MTc1NCAxMS42NDggNy4yNDM4NiAxMS4zNzQzIDYuODkzNDEgMTEuMjgzWiIgZmlsbD0iIzI1NjNFQiIvPgo8L3N2Zz4K)}.mi-my-position__position-button--tracked{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjUiIGhlaWdodD0iMjUiIHZpZXdCb3g9IjAgMCAyNSAyNSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTEyLjQ2MDQgMTMuNDMwOUMxMy4wMTI3IDEzLjQzMDkgMTMuNDYwNCAxMi45ODMyIDEzLjQ2MD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4IDE4LjMyNzVDNi4zNTA0NiAxOC4zOTQ3IDYuNTcwMTEgMTguMzk0NyA2Ljc3MzU5IDE4LjMyNzVMMTAuMzY3MiAxNy4xNDJDMTEuMTkzIDE2Ljg2OTUgMTEuOTQ5IDE3LjcwOCAxMS41OTI4IDE4LjUwMTJMNy4zNzI1MyAyNy44OTk0WiIgZmlsbD0iIzlDQTNBRiIvPgo8L3N2Zz4K);border-radius:50%}`;
236
1702
 
237
1703
  var PositionStateTypes;
238
1704
  (function (PositionStateTypes) {
239
- PositionStateTypes["POSITION_UNKNOWN"] = "POSITION_UNKNOWN";
240
- PositionStateTypes["POSITION_REQUESTING"] = "POSITION_REQUESTING";
241
- PositionStateTypes["POSITION_INACCURATE"] = "POSITION_INACCURATE";
242
- PositionStateTypes["POSITION_KNOWN"] = "POSITION_KNOWN";
243
- PositionStateTypes["POSITION_CENTERED"] = "POSITION_CENTERED";
244
- PositionStateTypes["POSITION_TRACKED"] = "POSITION_TRACKED";
245
- PositionStateTypes["POSITION_UNTRACKED"] = "POSITION_UNTRACKED";
246
- PositionStateTypes["POSITION_FOLLOW"] = "POSITION_FOLLOW";
1705
+ PositionStateTypes["POSITION_UNKNOWN"] = "POSITION_UNKNOWN";
1706
+ PositionStateTypes["POSITION_REQUESTING"] = "POSITION_REQUESTING";
1707
+ PositionStateTypes["POSITION_INACCURATE"] = "POSITION_INACCURATE";
1708
+ PositionStateTypes["POSITION_KNOWN"] = "POSITION_KNOWN";
1709
+ PositionStateTypes["POSITION_CENTERED"] = "POSITION_CENTERED";
1710
+ PositionStateTypes["POSITION_TRACKED"] = "POSITION_TRACKED";
1711
+ PositionStateTypes["POSITION_UNTRACKED"] = "POSITION_UNTRACKED";
1712
+ PositionStateTypes["POSITION_FOLLOW"] = "POSITION_FOLLOW";
247
1713
  })(PositionStateTypes || (PositionStateTypes = {}));
248
1714
  const MyPositionComponent = class {
249
- constructor(hostRef) {
250
- registerInstance(this, hostRef);
251
- this.position_error = createEvent(this, "position_error", 7);
252
- this.position_received = createEvent(this, "position_received", 7);
1715
+ constructor(hostRef) {
1716
+ registerInstance(this, hostRef);
1717
+ this.position_error = createEvent(this, "position_error", 7);
1718
+ this.position_received = createEvent(this, "position_received", 7);
1719
+ /**
1720
+ * The current state of device positioning.
1721
+ * Default is 'POSITION_UNKNOWN'.
1722
+ */
1723
+ this.positionState = PositionStateTypes.POSITION_UNKNOWN;
1724
+ /**
1725
+ * New UAParser instance.
1726
+ */
1727
+ this.parser = new uaParserExports.UAParser();
1728
+ /**
1729
+ * Reference to the handleDeviceOrientation function.
1730
+ */
1731
+ this.handleDeviceOrientationReference = this.handleDeviceOrientation.bind(this);
1732
+ /**
1733
+ * Cached current building for validation.
1734
+ * Cached to avoid repeated lookups on every position update.
1735
+ */
1736
+ this.cachedBuilding = null;
1737
+ /**
1738
+ * Reference to the modern provider's onPositionReceived event handler.
1739
+ * Stored to enable proper cleanup when component disconnects or provider changes.
1740
+ */
1741
+ this.onPositionReceivedHandler = null;
1742
+ /**
1743
+ * Reference to the modern provider's onPositionError event handler.
1744
+ * Stored to enable proper cleanup when component disconnects or provider changes.
1745
+ */
1746
+ this.onPositionErrorHandler = null;
1747
+ /**
1748
+ * Reference to the floor_changed event handler.
1749
+ * Stored to enable proper cleanup when component disconnects.
1750
+ */
1751
+ this.floorChangedHandler = null;
1752
+ /**
1753
+ * Track the last applied fillOpacity to avoid unnecessary refreshes.
1754
+ * Only refresh the marker when opacity actually changes (crossing floor boundaries).
1755
+ */
1756
+ this.lastAppliedOpacity = 1;
1757
+ this.defaultFillOpacity = 1;
1758
+ this.reducedFillOpacity = 0.3;
1759
+ /**
1760
+ * Default options.
1761
+ */
1762
+ this.defaultOptions = {
1763
+ maxAccuracy: 200,
1764
+ positionOptions: {
1765
+ timeout: 30000,
1766
+ enableHighAccuracy: true,
1767
+ maximumAge: 0
1768
+ },
1769
+ positionMarkerStyles: {
1770
+ radius: '12px',
1771
+ strokeWeight: '2px',
1772
+ strokeColor: 'white',
1773
+ fillColor: '#4169E1',
1774
+ fillOpacity: this.defaultFillOpacity
1775
+ },
1776
+ accuracyCircleStyles: {
1777
+ fillColor: '#4169E1',
1778
+ fillOpacity: 0.16
1779
+ }
1780
+ };
1781
+ }
253
1782
  /**
254
- * New UAParser instance.
1783
+ * Cleans up modern position provider event listeners.
1784
+ * Removes registered event handlers and nulls the stored references to prevent memory leaks.
255
1785
  */
256
- this.parser = new uaParser_pack.UAParser();
1786
+ cleanupModernProviderListeners() {
1787
+ if (!this.isModernProvider(this.positionProvider)) {
1788
+ return;
1789
+ }
1790
+ const modernProvider = this.positionProvider;
1791
+ // Remove event listeners if they exist
1792
+ if (this.onPositionReceivedHandler) {
1793
+ modernProvider.off('position_received', this.onPositionReceivedHandler);
1794
+ this.onPositionReceivedHandler = null;
1795
+ }
1796
+ if (this.onPositionErrorHandler) {
1797
+ modernProvider.off('position_error', this.onPositionErrorHandler);
1798
+ this.onPositionErrorHandler = null;
1799
+ }
1800
+ }
257
1801
  /**
258
- * Reference to the handleDeviceOrientation function.
1802
+ * Sets up event listeners for modern position providers.
1803
+ * This ensures that position updates are handled immediately when setPosition() is called.
1804
+ *
1805
+ * Note: We use this.positionProvider (not this.customPositionProvider) because:
1806
+ * - this.positionProvider is the resolved, validated provider
1807
+ * - It's guaranteed to exist and be valid
1808
+ * - It handles both custom and default providers consistently
1809
+ * - All other methods in the component use this.positionProvider for consistency.
259
1810
  */
260
- this.handleDeviceOrientationReference = this.handleDeviceOrientation.bind(this);
1811
+ setupModernProviderListeners() {
1812
+ if (!this.isModernProvider(this.positionProvider)) {
1813
+ return;
1814
+ }
1815
+ // Clean up any existing listeners first
1816
+ this.cleanupModernProviderListeners();
1817
+ const modernProvider = this.positionProvider;
1818
+ // Create and store event handler references
1819
+ this.onPositionReceivedHandler = ({ position }) => {
1820
+ this.currentPosition = position;
1821
+ this.positionIsAccurate = position.coords.accuracy <= this.options.maxAccuracy;
1822
+ // Ensure the position provider is set on the MapView so the dot appears
1823
+ this.setPositionProviderOnMapView();
1824
+ // Update state based on current position state
1825
+ if (this.positionState === PositionStateTypes.POSITION_TRACKED) {
1826
+ this.setPositionState(PositionStateTypes.POSITION_UNTRACKED);
1827
+ }
1828
+ else if (this.positionState === PositionStateTypes.POSITION_UNKNOWN || this.positionState === PositionStateTypes.POSITION_REQUESTING) {
1829
+ // Auto-enter FOLLOW mode only on first position (from UNKNOWN or REQUESTING)
1830
+ this.setPositionState(PositionStateTypes.POSITION_FOLLOW);
1831
+ }
1832
+ else if (this.positionState !== PositionStateTypes.POSITION_UNTRACKED && this.positionState !== PositionStateTypes.POSITION_FOLLOW) {
1833
+ // For other states, transition to KNOWN
1834
+ this.setPositionState(PositionStateTypes.POSITION_KNOWN);
1835
+ }
1836
+ // Handle mode-specific behavior
1837
+ if (this.positionState === PositionStateTypes.POSITION_FOLLOW) {
1838
+ // FOLLOW mode: auto-pan and change floors
1839
+ this.handleFollowModePosition(position);
1840
+ this.applyOpacityForPosition(position);
1841
+ }
1842
+ else {
1843
+ // Non-FOLLOW modes: update opacity based on floor match
1844
+ this.applyOpacityForPosition(position);
1845
+ }
1846
+ window.removeEventListener('deviceorientation', this.handleDeviceOrientationReference);
1847
+ this.position_received.emit({
1848
+ position: this.currentPosition,
1849
+ selfInvoked: false,
1850
+ accurate: this.positionIsAccurate
1851
+ });
1852
+ };
1853
+ this.onPositionErrorHandler = (error) => {
1854
+ this.setPositionState(PositionStateTypes.POSITION_UNKNOWN);
1855
+ this.position_error.emit(error);
1856
+ };
1857
+ // Register the event listeners
1858
+ modernProvider.on('position_received', this.onPositionReceivedHandler);
1859
+ modernProvider.on('position_error', this.onPositionErrorHandler);
1860
+ }
261
1861
  /**
262
- * Cached current building for validation.
263
- * Cached to avoid repeated lookups on every position update.
1862
+ * Sets a custom position. Works with any provider that implements setPosition.
1863
+ * Uses this.positionProvider (the resolved provider) instead of this.customPositionProvider
1864
+ * to ensure we're working with the validated, active provider.
264
1865
  */
265
- this.cachedBuilding = null;
1866
+ async setPosition(position) {
1867
+ var _a;
1868
+ if ((_a = this.positionProvider) === null || _a === void 0 ? void 0 : _a.setPosition) {
1869
+ this.positionProvider.setPosition(position);
1870
+ }
1871
+ }
266
1872
  /**
267
- * Reference to the modern provider's onPositionReceived event handler.
268
- * Stored to enable proper cleanup when component disconnects or provider changes.
1873
+ * Removes the event listener for the device's orientation and resets the position button.
269
1874
  */
270
- this.onPositionReceivedHandler = null;
1875
+ resetPositionState() {
1876
+ window.removeEventListener('deviceorientation', this.handleDeviceOrientationReference);
1877
+ if (this.positionState === PositionStateTypes.POSITION_TRACKED) {
1878
+ this.setPositionState(PositionStateTypes.POSITION_UNTRACKED);
1879
+ }
1880
+ else if (this.positionState === PositionStateTypes.POSITION_CENTERED) {
1881
+ this.setPositionState(PositionStateTypes.POSITION_KNOWN);
1882
+ this.mapView.tilt(0);
1883
+ }
1884
+ // Don't reset FOLLOW state - it should persist until user clicks to exit
1885
+ }
271
1886
  /**
272
- * Reference to the modern provider's onPositionError event handler.
273
- * Stored to enable proper cleanup when component disconnects or provider changes.
1887
+ * Returns if position is known and accurate.
1888
+ *
1889
+ * @returns {boolean}
274
1890
  */
275
- this.onPositionErrorHandler = null;
1891
+ hasValidPosition() {
1892
+ return [PositionStateTypes.POSITION_KNOWN, PositionStateTypes.POSITION_CENTERED, PositionStateTypes.POSITION_INACCURATE, PositionStateTypes.POSITION_TRACKED, PositionStateTypes.POSITION_UNTRACKED, PositionStateTypes.POSITION_FOLLOW].includes(this.positionState);
1893
+ }
276
1894
  /**
277
- * Reference to the floor_changed event handler.
278
- * Stored to enable proper cleanup when component disconnects.
1895
+ * Sets the PositionControl as PositionProvider on the MapView.
279
1896
  */
280
- this.floorChangedHandler = null;
1897
+ setPositionProviderOnMapView() {
1898
+ if (this.mapView.isReady) {
1899
+ this.mapView.setPositionProvider(this);
1900
+ }
1901
+ else {
1902
+ this.mapView.once('ready', () => {
1903
+ this.mapView.setPositionProvider(this);
1904
+ });
1905
+ }
1906
+ }
281
1907
  /**
282
- * Track the last applied fillOpacity to avoid unnecessary refreshes.
283
- * Only refresh the marker when opacity actually changes (crossing floor boundaries).
1908
+ * Forces the position provider to refresh by removing and re-adding it.
1909
+ * This makes the SDK re-read the updated options and redraw the marker.
284
1910
  */
285
- this.lastAppliedOpacity = 1;
286
- this.defaultFillOpacity = 1;
287
- this.reducedFillOpacity = 0.3;
1911
+ refreshPositionProvider() {
1912
+ if (this.mapView.isReady) {
1913
+ // Remove the provider
1914
+ this.mapView.setPositionProvider(null);
1915
+ // Re-add it on next frame to force redraw
1916
+ requestAnimationFrame(() => {
1917
+ this.mapView.setPositionProvider(this);
1918
+ });
1919
+ }
1920
+ }
288
1921
  /**
289
- * Default options.
1922
+ * Sets fillOpacity based on floor match and reapplies the provider so SDK re-reads styles.
1923
+ * Only refreshes the marker when opacity actually changes to improve performance.
290
1924
  */
291
- this.defaultOptions = {
292
- maxAccuracy: 200,
293
- positionOptions: {
294
- timeout: 30000,
295
- enableHighAccuracy: true,
296
- maximumAge: 0
297
- },
298
- positionMarkerStyles: {
299
- radius: '12px',
300
- strokeWeight: '2px',
301
- strokeColor: 'white',
302
- fillColor: '#4169E1',
303
- fillOpacity: this.defaultFillOpacity
304
- },
305
- accuracyCircleStyles: {
306
- fillColor: '#4169E1',
307
- fillOpacity: 0.16
308
- }
309
- };
310
- this.mapsindoors = undefined;
311
- this.myPositionOptions = undefined;
312
- this.customPositionProvider = undefined;
313
- this.positionState = PositionStateTypes.POSITION_UNKNOWN;
314
- }
315
- /**
316
- * Cleans up modern position provider event listeners.
317
- * Removes registered event handlers and nulls the stored references to prevent memory leaks.
318
- */
319
- cleanupModernProviderListeners() {
320
- if (!this.isModernProvider(this.positionProvider)) {
321
- return;
322
- }
323
- const modernProvider = this.positionProvider;
324
- // Remove event listeners if they exist
325
- if (this.onPositionReceivedHandler) {
326
- modernProvider.off('position_received', this.onPositionReceivedHandler);
327
- this.onPositionReceivedHandler = null;
328
- }
329
- if (this.onPositionErrorHandler) {
330
- modernProvider.off('position_error', this.onPositionErrorHandler);
331
- this.onPositionErrorHandler = null;
332
- }
333
- }
334
- /**
335
- * Sets up event listeners for modern position providers.
336
- * This ensures that position updates are handled immediately when setPosition() is called.
337
- *
338
- * Note: We use this.positionProvider (not this.customPositionProvider) because:
339
- * - this.positionProvider is the resolved, validated provider
340
- * - It's guaranteed to exist and be valid
341
- * - It handles both custom and default providers consistently
342
- * - All other methods in the component use this.positionProvider for consistency.
343
- */
344
- setupModernProviderListeners() {
345
- if (!this.isModernProvider(this.positionProvider)) {
346
- return;
347
- }
348
- // Clean up any existing listeners first
349
- this.cleanupModernProviderListeners();
350
- const modernProvider = this.positionProvider;
351
- // Create and store event handler references
352
- this.onPositionReceivedHandler = ({ position }) => {
353
- this.currentPosition = position;
354
- this.positionIsAccurate = position.coords.accuracy <= this.options.maxAccuracy;
355
- // Ensure the position provider is set on the MapView so the dot appears
356
- this.setPositionProviderOnMapView();
357
- // Update state based on current position state
358
- if (this.positionState === PositionStateTypes.POSITION_TRACKED) {
359
- this.setPositionState(PositionStateTypes.POSITION_UNTRACKED);
360
- }
361
- else if (this.positionState === PositionStateTypes.POSITION_UNKNOWN || this.positionState === PositionStateTypes.POSITION_REQUESTING) {
362
- // Auto-enter FOLLOW mode only on first position (from UNKNOWN or REQUESTING)
363
- this.setPositionState(PositionStateTypes.POSITION_FOLLOW);
364
- }
365
- else if (this.positionState !== PositionStateTypes.POSITION_UNTRACKED && this.positionState !== PositionStateTypes.POSITION_FOLLOW) {
366
- // For other states, transition to KNOWN
367
- this.setPositionState(PositionStateTypes.POSITION_KNOWN);
368
- }
369
- // Handle mode-specific behavior
370
- if (this.positionState === PositionStateTypes.POSITION_FOLLOW) {
371
- // FOLLOW mode: auto-pan and change floors
372
- this.handleFollowModePosition(position);
373
- this.applyOpacityForPosition(position);
374
- }
375
- else {
376
- // Non-FOLLOW modes: update opacity based on floor match
377
- this.applyOpacityForPosition(position);
378
- }
379
- window.removeEventListener('deviceorientation', this.handleDeviceOrientationReference);
380
- this.position_received.emit({
381
- position: this.currentPosition,
382
- selfInvoked: false,
383
- accurate: this.positionIsAccurate
384
- });
385
- };
386
- this.onPositionErrorHandler = (error) => {
387
- this.setPositionState(PositionStateTypes.POSITION_UNKNOWN);
388
- this.position_error.emit(error);
389
- };
390
- // Register the event listeners
391
- modernProvider.on('position_received', this.onPositionReceivedHandler);
392
- modernProvider.on('position_error', this.onPositionErrorHandler);
393
- }
394
- /**
395
- * Sets a custom position. Works with any provider that implements setPosition.
396
- * Uses this.positionProvider (the resolved provider) instead of this.customPositionProvider
397
- * to ensure we're working with the validated, active provider.
398
- */
399
- async setPosition(position) {
400
- var _a;
401
- if ((_a = this.positionProvider) === null || _a === void 0 ? void 0 : _a.setPosition) {
402
- this.positionProvider.setPosition(position);
403
- }
404
- }
405
- /**
406
- * Removes the event listener for the device's orientation and resets the position button.
407
- */
408
- resetPositionState() {
409
- window.removeEventListener('deviceorientation', this.handleDeviceOrientationReference);
410
- if (this.positionState === PositionStateTypes.POSITION_TRACKED) {
411
- this.setPositionState(PositionStateTypes.POSITION_UNTRACKED);
412
- }
413
- else if (this.positionState === PositionStateTypes.POSITION_CENTERED) {
414
- this.setPositionState(PositionStateTypes.POSITION_KNOWN);
415
- this.mapView.tilt(0);
416
- }
417
- // Don't reset FOLLOW state - it should persist until user clicks to exit
418
- }
419
- /**
420
- * Returns if position is known and accurate.
421
- *
422
- * @returns {boolean}
423
- */
424
- hasValidPosition() {
425
- return [PositionStateTypes.POSITION_KNOWN, PositionStateTypes.POSITION_CENTERED, PositionStateTypes.POSITION_INACCURATE, PositionStateTypes.POSITION_TRACKED, PositionStateTypes.POSITION_UNTRACKED, PositionStateTypes.POSITION_FOLLOW].includes(this.positionState);
426
- }
427
- /**
428
- * Sets the PositionControl as PositionProvider on the MapView.
429
- */
430
- setPositionProviderOnMapView() {
431
- if (this.mapView.isReady) {
432
- this.mapView.setPositionProvider(this);
433
- }
434
- else {
435
- this.mapView.once('ready', () => {
436
- this.mapView.setPositionProvider(this);
437
- });
438
- }
439
- }
440
- /**
441
- * Forces the position provider to refresh by removing and re-adding it.
442
- * This makes the SDK re-read the updated options and redraw the marker.
443
- */
444
- refreshPositionProvider() {
445
- if (this.mapView.isReady) {
446
- // Remove the provider
447
- this.mapView.setPositionProvider(null);
448
- // Re-add it on next frame to force redraw
449
- requestAnimationFrame(() => {
450
- this.mapView.setPositionProvider(this);
451
- });
452
- }
453
- }
454
- /**
455
- * Sets fillOpacity based on floor match and reapplies the provider so SDK re-reads styles.
456
- * Only refreshes the marker when opacity actually changes to improve performance.
457
- */
458
- applyOpacityForPosition(position) {
459
- var _a;
460
- if (!((_a = this.options) === null || _a === void 0 ? void 0 : _a.positionMarkerStyles))
461
- return;
462
- const matches = this.isFloorMatching(position);
463
- const fillOpacity = matches ? this.defaultFillOpacity : this.reducedFillOpacity;
464
- // Only refresh if opacity actually changed (crossing floor boundary)
465
- if (fillOpacity === this.lastAppliedOpacity) {
466
- return; // No change needed, skip expensive refresh
467
- }
468
- // Update fillOpacity directly - no need for new objects since we're forcing a refresh
469
- this.options.positionMarkerStyles.fillOpacity = fillOpacity;
470
- // Track the new opacity to avoid redundant refreshes
471
- this.lastAppliedOpacity = fillOpacity;
472
- // Force refresh to make SDK re-read options and redraw marker
473
- this.refreshPositionProvider();
474
- }
475
- /**
476
- * Compares incoming position floor with current map floor and returns the result.
477
- * Only used for modern providers during position updates.
478
- *
479
- * Returns true (full opacity) when:
480
- * - The incoming floor matches the current map floor
481
- * - The incoming floor is invalid (doesn't exist in the building) - treated as "no floor data"
482
- *
483
- * Returns false (reduced opacity) when:
484
- * - The incoming floor is valid but different from the current map floor.
485
- *
486
- * @param {MapsIndoorsPosition} position - The position to compare.
487
- * @returns {boolean} - True if the floor matches or is invalid, false otherwise.
488
- */
489
- isFloorMatching(position) {
490
- if (!this.mapsindoors)
491
- return false;
492
- const incomingFloor = position.floorIndex;
493
- const currentFloor = this.mapsindoors.getFloor();
494
- if (incomingFloor === undefined || incomingFloor === null || currentFloor === undefined || currentFloor === null) {
495
- return false;
496
- }
497
- const incoming = incomingFloor.toString();
498
- // If the incoming floor doesn't exist in the building, treat it as "no floor data"
499
- // and return true to keep full opacity (don't penalize invalid floor data)
500
- if (!this.isValidFloorForCurrentBuilding(incoming)) {
501
- return true;
502
- }
503
- const matches = incoming === currentFloor;
504
- return matches;
505
- }
506
- /**
507
- * Pan map to center on the current position.
508
- */
509
- panToCurrentPosition() {
510
- if (!this.hasValidPosition()) {
511
- return;
1925
+ applyOpacityForPosition(position) {
1926
+ var _a;
1927
+ if (!((_a = this.options) === null || _a === void 0 ? void 0 : _a.positionMarkerStyles))
1928
+ return;
1929
+ const matches = this.isFloorMatching(position);
1930
+ const fillOpacity = matches ? this.defaultFillOpacity : this.reducedFillOpacity;
1931
+ // Only refresh if opacity actually changed (crossing floor boundary)
1932
+ if (fillOpacity === this.lastAppliedOpacity) {
1933
+ return; // No change needed, skip expensive refresh
1934
+ }
1935
+ // Update fillOpacity directly - no need for new objects since we're forcing a refresh
1936
+ this.options.positionMarkerStyles.fillOpacity = fillOpacity;
1937
+ // Track the new opacity to avoid redundant refreshes
1938
+ this.lastAppliedOpacity = fillOpacity;
1939
+ // Force refresh to make SDK re-read options and redraw marker
1940
+ this.refreshPositionProvider();
512
1941
  }
513
- // Whenever the map viewport changes again, set position state from centered to known.
514
- // The outer event listener catches idle caused by the panTo.
515
- // The inner event listeners catch any subsequent viewport changes caused by user interactions.
516
- this.mapView.once('idle', () => {
517
- this.mapView.on('user_interaction', () => this.resetPositionState());
518
- });
519
- this.mapView.panTo({ lat: this.currentPosition.coords.latitude, lng: this.currentPosition.coords.longitude });
520
- if (this.positionState !== PositionStateTypes.POSITION_TRACKED && this.positionState !== PositionStateTypes.POSITION_FOLLOW) {
521
- this.setPositionState(PositionStateTypes.POSITION_CENTERED);
1942
+ /**
1943
+ * Compares incoming position floor with current map floor and returns the result.
1944
+ * Only used for modern providers during position updates.
1945
+ *
1946
+ * Returns true (full opacity) when:
1947
+ * - The incoming floor matches the current map floor
1948
+ * - The incoming floor is invalid (doesn't exist in the building) - treated as "no floor data"
1949
+ *
1950
+ * Returns false (reduced opacity) when:
1951
+ * - The incoming floor is valid but different from the current map floor.
1952
+ *
1953
+ * @param {MapsIndoorsPosition} position - The position to compare.
1954
+ * @returns {boolean} - True if the floor matches or is invalid, false otherwise.
1955
+ */
1956
+ isFloorMatching(position) {
1957
+ if (!this.mapsindoors)
1958
+ return false;
1959
+ const incomingFloor = position.floorIndex;
1960
+ const currentFloor = this.mapsindoors.getFloor();
1961
+ if (incomingFloor === undefined || incomingFloor === null || currentFloor === undefined || currentFloor === null) {
1962
+ return false;
1963
+ }
1964
+ const incoming = incomingFloor.toString();
1965
+ // If the incoming floor doesn't exist in the building, treat it as "no floor data"
1966
+ // and return true to keep full opacity (don't penalize invalid floor data)
1967
+ if (!this.isValidFloorForCurrentBuilding(incoming)) {
1968
+ return true;
1969
+ }
1970
+ const matches = incoming === currentFloor;
1971
+ return matches;
522
1972
  }
523
- if (!this.canBeTracked)
524
- return;
525
- if (DeviceOrientationEvent.requestPermission) {
526
- DeviceOrientationEvent.requestPermission()
527
- .then(permissionStatus => {
528
- if (permissionStatus === 'granted' && this.positionState === PositionStateTypes.POSITION_TRACKED) {
529
- window.addEventListener('deviceorientation', this.handleDeviceOrientationReference);
1973
+ /**
1974
+ * Pan map to center on the current position.
1975
+ */
1976
+ panToCurrentPosition() {
1977
+ if (!this.hasValidPosition()) {
1978
+ return;
1979
+ }
1980
+ // Whenever the map viewport changes again, set position state from centered to known.
1981
+ // The outer event listener catches idle caused by the panTo.
1982
+ // The inner event listeners catch any subsequent viewport changes caused by user interactions.
1983
+ this.mapView.once('idle', () => {
1984
+ this.mapView.on('user_interaction', () => this.resetPositionState());
1985
+ });
1986
+ this.mapView.panTo({ lat: this.currentPosition.coords.latitude, lng: this.currentPosition.coords.longitude });
1987
+ if (this.positionState !== PositionStateTypes.POSITION_TRACKED && this.positionState !== PositionStateTypes.POSITION_FOLLOW) {
1988
+ this.setPositionState(PositionStateTypes.POSITION_CENTERED);
1989
+ }
1990
+ if (!this.canBeTracked)
1991
+ return;
1992
+ if (DeviceOrientationEvent.requestPermission) {
1993
+ DeviceOrientationEvent.requestPermission()
1994
+ .then(permissionStatus => {
1995
+ if (permissionStatus === 'granted' && this.positionState === PositionStateTypes.POSITION_TRACKED) {
1996
+ window.addEventListener('deviceorientation', this.handleDeviceOrientationReference);
1997
+ }
1998
+ else {
1999
+ window.removeEventListener('deviceorientation', this.handleDeviceOrientationReference);
2000
+ }
2001
+ });
530
2002
  }
531
2003
  else {
532
- window.removeEventListener('deviceorientation', this.handleDeviceOrientationReference);
2004
+ if (this.positionState === PositionStateTypes.POSITION_TRACKED) {
2005
+ window.addEventListener('deviceorientation', this.handleDeviceOrientationReference);
2006
+ }
2007
+ else {
2008
+ window.removeEventListener('deviceorientation', this.handleDeviceOrientationReference);
2009
+ }
533
2010
  }
534
- });
535
- }
536
- else {
537
- if (this.positionState === PositionStateTypes.POSITION_TRACKED) {
538
- window.addEventListener('deviceorientation', this.handleDeviceOrientationReference);
539
- }
540
- else {
541
- window.removeEventListener('deviceorientation', this.handleDeviceOrientationReference);
542
- }
543
2011
  }
544
- }
545
- /**
546
- * Handles position updates in FOLLOW mode.
547
- * Automatically pans the map and changes floors without user interaction listeners.
548
- * Device orientation is handled by the existing handleDeviceOrientation method.
549
- */
550
- handleFollowModePosition(position) {
551
- if (!this.hasValidPosition()) {
552
- return;
2012
+ /**
2013
+ * Handles position updates in FOLLOW mode.
2014
+ * Automatically pans the map and changes floors without user interaction listeners.
2015
+ * Device orientation is handled by the existing handleDeviceOrientation method.
2016
+ */
2017
+ handleFollowModePosition(position) {
2018
+ if (!this.hasValidPosition()) {
2019
+ return;
2020
+ }
2021
+ // Pan to new position - device orientation will be handled by handleDeviceOrientation
2022
+ this.mapView.panTo({ lat: position.coords.latitude, lng: position.coords.longitude });
2023
+ // Check for floor changes if floorIndex is provided
2024
+ if (position.floorIndex !== undefined && position.floorIndex !== null && this.mapsindoors) {
2025
+ const currentFloor = this.mapsindoors.getFloor();
2026
+ const newFloor = position.floorIndex.toString();
2027
+ // Only change floor if it's different and valid for the current building
2028
+ if (newFloor !== currentFloor && this.isValidFloorForCurrentBuilding(newFloor)) {
2029
+ this.mapsindoors.setFloor(newFloor);
2030
+ }
2031
+ }
553
2032
  }
554
- // Pan to new position - device orientation will be handled by handleDeviceOrientation
555
- this.mapView.panTo({ lat: position.coords.latitude, lng: position.coords.longitude });
556
- // Check for floor changes if floorIndex is provided
557
- if (position.floorIndex !== undefined && position.floorIndex !== null && this.mapsindoors) {
558
- const currentFloor = this.mapsindoors.getFloor();
559
- const newFloor = position.floorIndex.toString();
560
- // Only change floor if it's different and valid for the current building
561
- if (newFloor !== currentFloor && this.isValidFloorForCurrentBuilding(newFloor)) {
562
- this.mapsindoors.setFloor(newFloor);
563
- }
2033
+ /**
2034
+ * Validates if a floor index exists in the current building.
2035
+ * Checks the current building's floors to ensure the floor index is valid.
2036
+ * Uses caching to avoid repeated lookups on every position update.
2037
+ *
2038
+ * @param {string} floorIndex - The floor index to validate.
2039
+ * @returns {boolean} - True if the floor exists in the current building.
2040
+ */
2041
+ isValidFloorForCurrentBuilding(floorIndex) {
2042
+ if (!this.mapsindoors) {
2043
+ return false;
2044
+ }
2045
+ try {
2046
+ // Get the current building directly from MapsIndoors SDK
2047
+ const currentBuilding = this.mapsindoors.getBuilding();
2048
+ if (!currentBuilding || !currentBuilding.floors) {
2049
+ // Clear cache if building is invalid
2050
+ this.clearBuildingFloorsCache();
2051
+ return false;
2052
+ }
2053
+ // Verify cache is still valid by checking building ID
2054
+ // If building changed or cache is empty, refresh cache
2055
+ // This avoids repeated property access on every position update
2056
+ if (!this.cachedBuilding || this.cachedBuilding.id !== currentBuilding.id) {
2057
+ this.cachedBuilding = currentBuilding;
2058
+ }
2059
+ // Check if the floor index exists in the building's floors
2060
+ // Floors object has keys like "0", "10", "20", "30", etc. representing floorIndexes
2061
+ // Use 'in' operator which is slightly faster than hasOwnProperty for this use case
2062
+ const floorExists = floorIndex in this.cachedBuilding.floors;
2063
+ return floorExists;
2064
+ }
2065
+ catch (error) {
2066
+ // If there's an error getting building data, allow the floor change
2067
+ // This prevents blocking floor changes due to API issues
2068
+ // Clear cache on error
2069
+ this.clearBuildingFloorsCache();
2070
+ return true;
2071
+ }
564
2072
  }
565
- }
566
- /**
567
- * Validates if a floor index exists in the current building.
568
- * Checks the current building's floors to ensure the floor index is valid.
569
- * Uses caching to avoid repeated lookups on every position update.
570
- *
571
- * @param {string} floorIndex - The floor index to validate.
572
- * @returns {boolean} - True if the floor exists in the current building.
573
- */
574
- isValidFloorForCurrentBuilding(floorIndex) {
575
- if (!this.mapsindoors) {
576
- return false;
2073
+ /**
2074
+ * Clears the cached building.
2075
+ * Should be called when the building changes to ensure fresh validation.
2076
+ */
2077
+ clearBuildingFloorsCache() {
2078
+ this.cachedBuilding = null;
577
2079
  }
578
- try {
579
- // Get the current building directly from MapsIndoors SDK
580
- const currentBuilding = this.mapsindoors.getBuilding();
581
- if (!currentBuilding || !currentBuilding.floors) {
582
- // Clear cache if building is invalid
583
- this.clearBuildingFloorsCache();
584
- return false;
585
- }
586
- // Verify cache is still valid by checking building ID
587
- // If building changed or cache is empty, refresh cache
588
- // This avoids repeated property access on every position update
589
- if (!this.cachedBuilding || this.cachedBuilding.id !== currentBuilding.id) {
590
- this.cachedBuilding = currentBuilding;
591
- }
592
- // Check if the floor index exists in the building's floors
593
- // Floors object has keys like "0", "10", "20", "30", etc. representing floorIndexes
594
- // Use 'in' operator which is slightly faster than hasOwnProperty for this use case
595
- const floorExists = floorIndex in this.cachedBuilding.floors;
596
- return floorExists;
2080
+ /**
2081
+ * Rotates and tilts the map.
2082
+ *
2083
+ * @param {DeviceOrientationEvent} e
2084
+ */
2085
+ handleDeviceOrientation(e) {
2086
+ // Only rotate the map if:
2087
+ // 1. No rotation has been applied before.
2088
+ // 2. The new rotation would differ by more than on degree from the current rotation
2089
+ if (!this.orientation || this.orientation - (360 - e.alpha) > 1 || this.orientation - (360 - e.alpha) < -1) {
2090
+ this.orientation = 360 - e.alpha;
2091
+ this.mapView.easeTo({
2092
+ center: [this.currentPosition.coords.longitude, this.currentPosition.coords.latitude],
2093
+ rotation: this.orientation,
2094
+ tilt: 60,
2095
+ easing: (t) => t * (2 - t)
2096
+ });
2097
+ }
597
2098
  }
598
- catch (error) {
599
- // If there's an error getting building data, allow the floor change
600
- // This prevents blocking floor changes due to API issues
601
- // Clear cache on error
602
- this.clearBuildingFloorsCache();
603
- return true;
2099
+ /**
2100
+ * Rotates the compass button using the transform CSS property.
2101
+ *
2102
+ * @param {number} bearing
2103
+ */
2104
+ setCompassStyle(bearing) {
2105
+ if (this.compassButton) {
2106
+ this.compassButton.style.transform = `rotate(${bearing}deg)`;
2107
+ }
604
2108
  }
605
- }
606
- /**
607
- * Clears the cached building.
608
- * Should be called when the building changes to ensure fresh validation.
609
- */
610
- clearBuildingFloorsCache() {
611
- this.cachedBuilding = null;
612
- }
613
- /**
614
- * Rotates and tilts the map.
615
- *
616
- * @param {DeviceOrientationEvent} e
617
- */
618
- handleDeviceOrientation(e) {
619
- // Only rotate the map if:
620
- // 1. No rotation has been applied before.
621
- // 2. The new rotation would differ by more than on degree from the current rotation
622
- if (!this.orientation || this.orientation - (360 - e.alpha) > 1 || this.orientation - (360 - e.alpha) < -1) {
623
- this.orientation = 360 - e.alpha;
624
- this.mapView.easeTo({
625
- center: [this.currentPosition.coords.longitude, this.currentPosition.coords.latitude],
626
- rotation: this.orientation,
627
- tilt: 60,
628
- easing: (t) => t * (2 - t)
629
- });
2109
+ /**
2110
+ * Method for requesting the current position, emitting events and showing position on map based on result.
2111
+ *
2112
+ * @param {boolean} [selfInvoked=false] - Used to track if call was invoked by clicking on position control or not.
2113
+ */
2114
+ async watchPosition(selfInvoked = false) {
2115
+ this.setPositionProviderOnMapView();
2116
+ if (this.isLegacyProvider(this.positionProvider)) {
2117
+ // Use legacy callback-based interface
2118
+ this.positionProvider.listenForPosition(this.options.maxAccuracy,
2119
+ // Position error callback
2120
+ error => {
2121
+ this.setPositionState(PositionStateTypes.POSITION_UNKNOWN);
2122
+ this.position_error.emit(error);
2123
+ },
2124
+ // Position inaccurate callback
2125
+ accuracy => {
2126
+ this.setPositionState(PositionStateTypes.POSITION_INACCURATE);
2127
+ this.position_error.emit({ code: 11, message: 'Inaccurate position: ' + accuracy });
2128
+ },
2129
+ // Position requesting callback
2130
+ () => {
2131
+ // Don't override FOLLOW state
2132
+ if (this.positionState !== PositionStateTypes.POSITION_FOLLOW) {
2133
+ this.setPositionState(PositionStateTypes.POSITION_REQUESTING);
2134
+ }
2135
+ },
2136
+ // Position received callback
2137
+ position => {
2138
+ this.currentPosition = position;
2139
+ this.positionIsAccurate = this.currentPosition.coords.accuracy <= this.options.maxAccuracy;
2140
+ // Don't override FOLLOW state - let the event handler manage it
2141
+ if (this.positionState === PositionStateTypes.POSITION_TRACKED) {
2142
+ this.setPositionState(PositionStateTypes.POSITION_UNTRACKED);
2143
+ }
2144
+ else if (this.positionState !== PositionStateTypes.POSITION_UNTRACKED && this.positionState !== PositionStateTypes.POSITION_FOLLOW) {
2145
+ this.setPositionState(PositionStateTypes.POSITION_KNOWN);
2146
+ }
2147
+ window.removeEventListener('deviceorientation', this.handleDeviceOrientationReference);
2148
+ this.position_received.emit({
2149
+ position: this.currentPosition,
2150
+ selfInvoked,
2151
+ accurate: this.positionIsAccurate
2152
+ });
2153
+ });
2154
+ }
2155
+ else {
2156
+ // Use modern event-based interface
2157
+ const modernProvider = this.positionProvider;
2158
+ // Event listeners are already set up in setupModernProviderListeners()
2159
+ // Just check if provider already has a valid position
2160
+ if (modernProvider.hasValidPosition && modernProvider.hasValidPosition()) {
2161
+ // Manually trigger the position received logic
2162
+ this.currentPosition = modernProvider.currentPosition;
2163
+ this.positionIsAccurate = this.currentPosition.coords.accuracy <= this.options.maxAccuracy;
2164
+ // Don't override FOLLOW state - let the event handler manage it
2165
+ if (this.positionState === PositionStateTypes.POSITION_TRACKED) {
2166
+ this.setPositionState(PositionStateTypes.POSITION_UNTRACKED);
2167
+ }
2168
+ else if (this.positionState !== PositionStateTypes.POSITION_UNTRACKED && this.positionState !== PositionStateTypes.POSITION_FOLLOW) {
2169
+ this.setPositionState(PositionStateTypes.POSITION_KNOWN);
2170
+ }
2171
+ window.removeEventListener('deviceorientation', this.handleDeviceOrientationReference);
2172
+ this.position_received.emit({
2173
+ position: this.currentPosition,
2174
+ selfInvoked,
2175
+ accurate: this.positionIsAccurate
2176
+ });
2177
+ }
2178
+ else {
2179
+ // Check if this is an empty object case vs a provider that lost position
2180
+ // If currentPosition is null, it's likely an empty object case - stay unknown
2181
+ // If currentPosition exists but is invalid, it's a provider that lost position - request position
2182
+ // Don't override FOLLOW state
2183
+ if (this.positionState !== PositionStateTypes.POSITION_FOLLOW) {
2184
+ if (modernProvider.currentPosition === null) {
2185
+ // Provider was never given position data (empty object case) - stay unknown
2186
+ this.setPositionState(PositionStateTypes.POSITION_UNKNOWN);
2187
+ }
2188
+ else {
2189
+ // Provider had position data but it's now invalid - request position
2190
+ this.setPositionState(PositionStateTypes.POSITION_REQUESTING);
2191
+ }
2192
+ }
2193
+ }
2194
+ }
630
2195
  }
631
- }
632
- /**
633
- * Rotates the compass button using the transform CSS property.
634
- *
635
- * @param {number} bearing
636
- */
637
- setCompassStyle(bearing) {
638
- if (this.compassButton) {
639
- this.compassButton.style.transform = `rotate(${bearing}deg)`;
2196
+ /**
2197
+ * Sets position button state.
2198
+ *
2199
+ * @param {PositionStateTypes} state
2200
+ */
2201
+ setPositionState(state) {
2202
+ this.positionState = state;
640
2203
  }
641
- }
642
- /**
643
- * Method for requesting the current position, emitting events and showing position on map based on result.
644
- *
645
- * @param {boolean} [selfInvoked=false] - Used to track if call was invoked by clicking on position control or not.
646
- */
647
- watchPosition(selfInvoked = false) {
648
- this.setPositionProviderOnMapView();
649
- if (this.isLegacyProvider(this.positionProvider)) {
650
- // Use legacy callback-based interface
651
- this.positionProvider.listenForPosition(this.options.maxAccuracy,
652
- // Position error callback
653
- error => {
654
- this.setPositionState(PositionStateTypes.POSITION_UNKNOWN);
655
- this.position_error.emit(error);
656
- },
657
- // Position inaccurate callback
658
- accuracy => {
659
- this.setPositionState(PositionStateTypes.POSITION_INACCURATE);
660
- this.position_error.emit({ code: 11, message: 'Inaccurate position: ' + accuracy });
661
- },
662
- // Position requesting callback
663
- () => {
664
- // Don't override FOLLOW state
665
- if (this.positionState !== PositionStateTypes.POSITION_FOLLOW) {
666
- this.setPositionState(PositionStateTypes.POSITION_REQUESTING);
667
- }
668
- },
669
- // Position received callback
670
- position => {
671
- this.currentPosition = position;
672
- this.positionIsAccurate = this.currentPosition.coords.accuracy <= this.options.maxAccuracy;
673
- // Don't override FOLLOW state - let the event handler manage it
2204
+ /**
2205
+ * Handle click on the compass button.
2206
+ */
2207
+ onCompassButtonClicked() {
2208
+ this.setCompassStyle(0);
2209
+ this.mapView.rotate(0);
2210
+ this.mapView.tilt(0);
2211
+ window.removeEventListener('deviceorientation', this.handleDeviceOrientationReference);
674
2212
  if (this.positionState === PositionStateTypes.POSITION_TRACKED) {
675
- this.setPositionState(PositionStateTypes.POSITION_UNTRACKED);
2213
+ this.setPositionState(PositionStateTypes.POSITION_CENTERED);
676
2214
  }
677
- else if (this.positionState !== PositionStateTypes.POSITION_UNTRACKED && this.positionState !== PositionStateTypes.POSITION_FOLLOW) {
678
- this.setPositionState(PositionStateTypes.POSITION_KNOWN);
2215
+ else if (this.positionState === PositionStateTypes.POSITION_UNTRACKED) {
2216
+ this.setPositionState(PositionStateTypes.POSITION_KNOWN);
679
2217
  }
680
- window.removeEventListener('deviceorientation', this.handleDeviceOrientationReference);
681
- this.position_received.emit({
682
- position: this.currentPosition,
683
- selfInvoked,
684
- accurate: this.positionIsAccurate
685
- });
686
- });
687
2218
  }
688
- else {
689
- // Use modern event-based interface
690
- const modernProvider = this.positionProvider;
691
- // Event listeners are already set up in setupModernProviderListeners()
692
- // Just check if provider already has a valid position
693
- if (modernProvider.hasValidPosition && modernProvider.hasValidPosition()) {
694
- // Manually trigger the position received logic
695
- this.currentPosition = modernProvider.currentPosition;
696
- this.positionIsAccurate = this.currentPosition.coords.accuracy <= this.options.maxAccuracy;
697
- // Don't override FOLLOW state - let the event handler manage it
698
- if (this.positionState === PositionStateTypes.POSITION_TRACKED) {
699
- this.setPositionState(PositionStateTypes.POSITION_UNTRACKED);
2219
+ /**
2220
+ * Handle click on position button.
2221
+ * Stops propagation to avoid any map click listeners to fire.
2222
+ *
2223
+ * @param {Event} event
2224
+ */
2225
+ onPositionButtonClicked(event) {
2226
+ event.stopPropagation();
2227
+ switch (this.positionState) {
2228
+ case PositionStateTypes.POSITION_UNKNOWN:
2229
+ this.mapView.tilt(0);
2230
+ this.watchPosition(true);
2231
+ break;
2232
+ case PositionStateTypes.POSITION_KNOWN:
2233
+ this.mapView.tilt(0);
2234
+ this.panToCurrentPosition();
2235
+ break;
2236
+ case PositionStateTypes.POSITION_CENTERED:
2237
+ // Check if we have a customPositionProvider to enable FOLLOW mode
2238
+ if (this.customPositionProvider && this.isValidPositionProvider(this.customPositionProvider)) {
2239
+ this.setPositionState(PositionStateTypes.POSITION_FOLLOW);
2240
+ }
2241
+ else if (this.canBeTracked) {
2242
+ this.setPositionState(PositionStateTypes.POSITION_TRACKED);
2243
+ }
2244
+ this.panToCurrentPosition();
2245
+ break;
2246
+ case PositionStateTypes.POSITION_FOLLOW:
2247
+ // Exit FOLLOW mode and return to KNOWN state
2248
+ this.setPositionState(PositionStateTypes.POSITION_KNOWN);
2249
+ break;
2250
+ case PositionStateTypes.POSITION_TRACKED:
2251
+ this.mapView.tilt(0);
2252
+ this.mapView.rotate(0);
2253
+ this.setCompassStyle(0);
2254
+ this.setPositionState(PositionStateTypes.POSITION_CENTERED);
2255
+ this.panToCurrentPosition();
2256
+ break;
2257
+ case PositionStateTypes.POSITION_UNTRACKED:
2258
+ this.setPositionState(PositionStateTypes.POSITION_TRACKED);
2259
+ this.panToCurrentPosition();
2260
+ break;
2261
+ }
2262
+ }
2263
+ /**
2264
+ * Called every time the component has connected to the DOM.
2265
+ * 1. Assigning the mapView and options attributes.
2266
+ * 2. Checking for the navigator's state.
2267
+ * 3. Determining whether the device can be tracked.
2268
+ * 4. Asking for permission to track the device.
2269
+ * 5. Styling the compass button.
2270
+ */
2271
+ connectedCallback() {
2272
+ var _a;
2273
+ this.mapView = this.mapsindoors.getMapView();
2274
+ this.options = merge(this.defaultOptions, (_a = this.myPositionOptions) !== null && _a !== void 0 ? _a : {});
2275
+ // Clean up any existing position provider listeners before assigning a new one
2276
+ // Only clean up if there's an existing position provider
2277
+ if (this.positionProvider) {
2278
+ this.cleanupModernProviderListeners();
700
2279
  }
701
- else if (this.positionState !== PositionStateTypes.POSITION_UNTRACKED && this.positionState !== PositionStateTypes.POSITION_FOLLOW) {
702
- this.setPositionState(PositionStateTypes.POSITION_KNOWN);
2280
+ // Provider Resolution Logic:
2281
+ // 1. Check if user provided a customPositionProvider and it's valid
2282
+ // 2. If yes, use it as this.positionProvider (our internal resolved provider)
2283
+ // 3. If no, fallback to default GeoLocationProvider
2284
+ // This pattern ensures this.positionProvider is always valid and ready to use
2285
+ if (this.customPositionProvider && this.isValidPositionProvider(this.customPositionProvider)) {
2286
+ // Use the custom provider - assign it to our internal resolved provider
2287
+ this.positionProvider = this.customPositionProvider;
2288
+ // If using a modern provider with options, merge them with the component's options
2289
+ if (this.isModernProvider(this.positionProvider) && this.positionProvider.options) {
2290
+ this.options = merge(this.options, this.positionProvider.options);
2291
+ }
2292
+ // Set up event listeners for modern providers immediately
2293
+ // This ensures setPosition() calls are handled without requiring user clicks
2294
+ this.setupModernProviderListeners();
703
2295
  }
704
- window.removeEventListener('deviceorientation', this.handleDeviceOrientationReference);
705
- this.position_received.emit({
706
- position: this.currentPosition,
707
- selfInvoked,
708
- accurate: this.positionIsAccurate
709
- });
710
- }
711
- else {
712
- // Check if this is an empty object case vs a provider that lost position
713
- // If currentPosition is null, it's likely an empty object case - stay unknown
714
- // If currentPosition exists but is invalid, it's a provider that lost position - request position
715
- // Don't override FOLLOW state
716
- if (this.positionState !== PositionStateTypes.POSITION_FOLLOW) {
717
- if (modernProvider.currentPosition === null) {
718
- // Provider was never given position data (empty object case) - stay unknown
2296
+ else {
2297
+ // Fallback to default provider
2298
+ this.positionProvider = new GeoLocationProvider();
2299
+ }
2300
+ // Check availability based on the interface type
2301
+ const isAvailable = this.isLegacyProvider(this.positionProvider)
2302
+ ? this.positionProvider.isAvailable()
2303
+ : true; // Modern providers are always considered available
2304
+ if (isAvailable === false) {
719
2305
  this.setPositionState(PositionStateTypes.POSITION_UNKNOWN);
720
- }
721
- else {
722
- // Provider had position data but it's now invalid - request position
723
- this.setPositionState(PositionStateTypes.POSITION_REQUESTING);
724
- }
2306
+ this.position_error.emit({ code: 10, message: 'Location not available' });
2307
+ return;
725
2308
  }
726
- }
727
- }
728
- }
729
- /**
730
- * Sets position button state.
731
- *
732
- * @param {PositionStateTypes} state
733
- */
734
- setPositionState(state) {
735
- this.positionState = state;
736
- }
737
- /**
738
- * Handle click on the compass button.
739
- */
740
- onCompassButtonClicked() {
741
- this.setCompassStyle(0);
742
- this.mapView.rotate(0);
743
- this.mapView.tilt(0);
744
- window.removeEventListener('deviceorientation', this.handleDeviceOrientationReference);
745
- if (this.positionState === PositionStateTypes.POSITION_TRACKED) {
746
- this.setPositionState(PositionStateTypes.POSITION_CENTERED);
747
- }
748
- else if (this.positionState === PositionStateTypes.POSITION_UNTRACKED) {
749
- this.setPositionState(PositionStateTypes.POSITION_KNOWN);
750
- }
751
- }
752
- /**
753
- * Handle click on position button.
754
- * Stops propagation to avoid any map click listeners to fire.
755
- *
756
- * @param {Event} event
757
- */
758
- onPositionButtonClicked(event) {
759
- event.stopPropagation();
760
- switch (this.positionState) {
761
- case PositionStateTypes.POSITION_UNKNOWN:
762
- this.mapView.tilt(0);
763
- this.watchPosition(true);
764
- break;
765
- case PositionStateTypes.POSITION_KNOWN:
766
- this.mapView.tilt(0);
767
- this.panToCurrentPosition();
768
- break;
769
- case PositionStateTypes.POSITION_CENTERED:
770
- // Check if we have a customPositionProvider to enable FOLLOW mode
771
- if (this.customPositionProvider && this.isValidPositionProvider(this.customPositionProvider)) {
772
- this.setPositionState(PositionStateTypes.POSITION_FOLLOW);
773
- }
774
- else if (this.canBeTracked) {
775
- this.setPositionState(PositionStateTypes.POSITION_TRACKED);
776
- }
777
- this.panToCurrentPosition();
778
- break;
779
- case PositionStateTypes.POSITION_FOLLOW:
780
- // Exit FOLLOW mode and return to KNOWN state
781
- this.setPositionState(PositionStateTypes.POSITION_KNOWN);
782
- break;
783
- case PositionStateTypes.POSITION_TRACKED:
784
- this.mapView.tilt(0);
785
- this.mapView.rotate(0);
786
- this.setCompassStyle(0);
787
- this.setPositionState(PositionStateTypes.POSITION_CENTERED);
788
- this.panToCurrentPosition();
789
- break;
790
- case PositionStateTypes.POSITION_UNTRACKED:
791
- this.setPositionState(PositionStateTypes.POSITION_TRACKED);
792
- this.panToCurrentPosition();
793
- break;
794
- }
795
- }
796
- /**
797
- * Called every time the component has connected to the DOM.
798
- * 1. Assigning the mapView and options attributes.
799
- * 2. Checking for the navigator's state.
800
- * 3. Determining whether the device can be tracked.
801
- * 4. Asking for permission to track the device.
802
- * 5. Styling the compass button.
803
- */
804
- connectedCallback() {
805
- var _a;
806
- this.mapView = this.mapsindoors.getMapView();
807
- this.options = cjs(this.defaultOptions, (_a = this.myPositionOptions) !== null && _a !== void 0 ? _a : {});
808
- // Clean up any existing position provider listeners before assigning a new one
809
- // Only clean up if there's an existing position provider
810
- if (this.positionProvider) {
811
- this.cleanupModernProviderListeners();
812
- }
813
- // Provider Resolution Logic:
814
- // 1. Check if user provided a customPositionProvider and it's valid
815
- // 2. If yes, use it as this.positionProvider (our internal resolved provider)
816
- // 3. If no, fallback to default GeoLocationProvider
817
- // This pattern ensures this.positionProvider is always valid and ready to use
818
- if (this.customPositionProvider && this.isValidPositionProvider(this.customPositionProvider)) {
819
- // Use the custom provider - assign it to our internal resolved provider
820
- this.positionProvider = this.customPositionProvider;
821
- // If using a modern provider with options, merge them with the component's options
822
- if (this.isModernProvider(this.positionProvider) && this.positionProvider.options) {
823
- this.options = cjs(this.options, this.positionProvider.options);
824
- }
825
- // Set up event listeners for modern providers immediately
826
- // This ensures setPosition() calls are handled without requiring user clicks
827
- this.setupModernProviderListeners();
828
- }
829
- else {
830
- // Fallback to default provider
831
- this.positionProvider = new GeoLocationProvider();
832
- }
833
- // Check availability based on the interface type
834
- const isAvailable = this.isLegacyProvider(this.positionProvider)
835
- ? this.positionProvider.isAvailable()
836
- : true; // Modern providers are always considered available
837
- if (isAvailable === false) {
838
- this.setPositionState(PositionStateTypes.POSITION_UNKNOWN);
839
- this.position_error.emit({ code: 10, message: 'Location not available' });
840
- return;
841
- }
842
- const deviceType = this.parser.getDevice().type;
843
- this.canBeTracked = (typeof window.DeviceOrientationEvent === 'function' &&
844
- (deviceType === uaParser_pack.UAParser.DEVICE.MOBILE || deviceType === uaParser_pack.UAParser.DEVICE.TABLET) &&
845
- this.mapView.rotatable &&
846
- this.mapView.tiltable)
847
- ? true : false;
848
- // Check if user has already granted permission to use the position.
849
- // Note that this feature only works in modern browsers due to using the Permissions API (https://caniuse.com/#feat=permissions-api),
850
- if (this.isLegacyProvider(this.positionProvider)) {
851
- this.positionProvider.isAlreadyGranted().then(granted => {
852
- if (granted) {
853
- this.watchPosition();
2309
+ const deviceType = this.parser.getDevice().type;
2310
+ this.canBeTracked = (typeof window.DeviceOrientationEvent === 'function' &&
2311
+ (deviceType === uaParserExports.UAParser.DEVICE.MOBILE || deviceType === uaParserExports.UAParser.DEVICE.TABLET) &&
2312
+ this.mapView.rotatable &&
2313
+ this.mapView.tiltable)
2314
+ ? true : false;
2315
+ // Check if user has already granted permission to use the position.
2316
+ // Note that this feature only works in modern browsers due to using the Permissions API (https://caniuse.com/#feat=permissions-api),
2317
+ if (this.isLegacyProvider(this.positionProvider)) {
2318
+ this.positionProvider.isAlreadyGranted().then(granted => {
2319
+ if (granted) {
2320
+ this.watchPosition();
2321
+ }
2322
+ else {
2323
+ this.setPositionState(PositionStateTypes.POSITION_UNKNOWN);
2324
+ }
2325
+ });
854
2326
  }
855
2327
  else {
856
- this.setPositionState(PositionStateTypes.POSITION_UNKNOWN);
2328
+ // Modern providers: check if they have a valid position immediately
2329
+ if (this.positionProvider.hasValidPosition && this.positionProvider.hasValidPosition()) {
2330
+ this.currentPosition = this.positionProvider.currentPosition;
2331
+ this.setPositionState(PositionStateTypes.POSITION_KNOWN);
2332
+ this.position_received.emit({
2333
+ position: this.currentPosition,
2334
+ selfInvoked: false,
2335
+ accurate: true
2336
+ });
2337
+ // Update marker opacity based on floor match
2338
+ // this.applyOpacityForPosition(this.currentPosition);
2339
+ }
2340
+ else {
2341
+ this.setPositionState(PositionStateTypes.POSITION_UNKNOWN);
2342
+ }
857
2343
  }
858
- });
859
- }
860
- else {
861
- // Modern providers: check if they have a valid position immediately
862
- if (this.positionProvider.hasValidPosition && this.positionProvider.hasValidPosition()) {
863
- this.currentPosition = this.positionProvider.currentPosition;
864
- this.setPositionState(PositionStateTypes.POSITION_KNOWN);
865
- this.position_received.emit({
866
- position: this.currentPosition,
867
- selfInvoked: false,
868
- accurate: true
2344
+ this.mapView.on('rotateend', () => {
2345
+ this.setCompassStyle(this.mapView.getBearing());
869
2346
  });
870
- // Update marker opacity based on floor match
871
- // this.applyOpacityForPosition(this.currentPosition);
872
- }
873
- else {
874
- this.setPositionState(PositionStateTypes.POSITION_UNKNOWN);
875
- }
876
- }
877
- this.mapView.on('rotateend', () => {
878
- this.setCompassStyle(this.mapView.getBearing());
879
- });
880
- // Listen for floor changes to update position marker opacity
881
- // When user manually changes floor via floor selector, update opacity based on position's floor
882
- if (this.mapsindoors && this.isModernProvider(this.positionProvider)) {
883
- this.floorChangedHandler = () => {
884
- // Only update if we have a current position and not in FOLLOW mode
885
- // FOLLOW mode auto-changes floors so this isn't needed
886
- if (this.currentPosition && this.positionState !== PositionStateTypes.POSITION_FOLLOW) {
887
- this.applyOpacityForPosition(this.currentPosition);
888
- }
889
- };
890
- this.mapsindoors.on('floor_changed', this.floorChangedHandler);
891
- }
892
- }
893
- /**
894
- * Checks if the provider is a valid position provider (either legacy or modern).
895
- *
896
- * @param {any} provider - The provider to check.
897
- * @returns {boolean} True if the provider is valid.
898
- */
899
- isValidPositionProvider(provider) {
900
- if (!provider) {
901
- return false;
902
- }
903
- // Check for legacy interface
904
- if (typeof provider.isAvailable === 'function' &&
905
- typeof provider.listenForPosition === 'function') {
906
- return provider.isAvailable();
2347
+ // Listen for floor changes to update position marker opacity
2348
+ // When user manually changes floor via floor selector, update opacity based on position's floor
2349
+ if (this.mapsindoors && this.isModernProvider(this.positionProvider)) {
2350
+ this.floorChangedHandler = () => {
2351
+ // Only update if we have a current position and not in FOLLOW mode
2352
+ // FOLLOW mode auto-changes floors so this isn't needed
2353
+ if (this.currentPosition && this.positionState !== PositionStateTypes.POSITION_FOLLOW) {
2354
+ this.applyOpacityForPosition(this.currentPosition);
2355
+ }
2356
+ };
2357
+ this.mapsindoors.on('floor_changed', this.floorChangedHandler);
2358
+ }
907
2359
  }
908
- // Check for modern interface
909
- if (typeof provider.hasValidPosition === 'function' &&
910
- typeof provider.on === 'function' &&
911
- typeof provider.off === 'function') {
912
- return true;
2360
+ /**
2361
+ * Checks if the provider is a valid position provider (either legacy or modern).
2362
+ *
2363
+ * @param {any} provider - The provider to check.
2364
+ * @returns {boolean} True if the provider is valid.
2365
+ */
2366
+ isValidPositionProvider(provider) {
2367
+ if (!provider) {
2368
+ return false;
2369
+ }
2370
+ // Check for legacy interface
2371
+ if (typeof provider.isAvailable === 'function' &&
2372
+ typeof provider.listenForPosition === 'function') {
2373
+ return provider.isAvailable();
2374
+ }
2375
+ // Check for modern interface
2376
+ if (typeof provider.hasValidPosition === 'function' &&
2377
+ typeof provider.on === 'function' &&
2378
+ typeof provider.off === 'function') {
2379
+ return true;
2380
+ }
2381
+ return false;
913
2382
  }
914
- return false;
915
- }
916
- /**
917
- * Checks if the provider uses the legacy callback-based interface.
918
- *
919
- * @param {IPositionProvider} provider - The provider to check.
920
- * @returns {boolean} True if the provider uses the legacy interface.
921
- */
922
- isLegacyProvider(provider) {
923
- return provider &&
924
- typeof provider.isAvailable === 'function' &&
925
- typeof provider.listenForPosition === 'function';
926
- }
927
- /**
928
- * Checks if the provider uses the modern event-based interface.
929
- *
930
- * @param {IPositionProvider} provider - The provider to check.
931
- * @returns {boolean} True if the provider uses the modern interface.
932
- */
933
- isModernProvider(provider) {
934
- return provider &&
935
- typeof provider.hasValidPosition === 'function' &&
936
- typeof provider.on === 'function' &&
937
- typeof provider.off === 'function';
938
- }
939
- /**
940
- * Component render callback.
941
- */
942
- componentDidRender() {
943
- this.setCompassStyle(this.mapView.getBearing());
944
- }
945
- /**
946
- * Stops listening for position updates.
947
- */
948
- disconnectedCallback() {
949
- if (!this.positionProvider) {
950
- return;
2383
+ /**
2384
+ * Checks if the provider uses the legacy callback-based interface.
2385
+ *
2386
+ * @param {IPositionProvider} provider - The provider to check.
2387
+ * @returns {boolean} True if the provider uses the legacy interface.
2388
+ */
2389
+ isLegacyProvider(provider) {
2390
+ return provider &&
2391
+ typeof provider.isAvailable === 'function' &&
2392
+ typeof provider.listenForPosition === 'function';
951
2393
  }
952
- if (this.isLegacyProvider(this.positionProvider)) {
953
- // Guard the legacy call with an existence check before invoking stopListeningForPosition
954
- if (this.positionProvider.stopListeningForPosition) {
955
- this.positionProvider.stopListeningForPosition();
956
- }
2394
+ /**
2395
+ * Checks if the provider uses the modern event-based interface.
2396
+ *
2397
+ * @param {IPositionProvider} provider - The provider to check.
2398
+ * @returns {boolean} True if the provider uses the modern interface.
2399
+ */
2400
+ isModernProvider(provider) {
2401
+ return provider &&
2402
+ typeof provider.hasValidPosition === 'function' &&
2403
+ typeof provider.on === 'function' &&
2404
+ typeof provider.off === 'function';
957
2405
  }
958
- else {
959
- // Clean up modern provider event listeners
960
- this.cleanupModernProviderListeners();
2406
+ /**
2407
+ * Component render callback.
2408
+ */
2409
+ componentDidRender() {
2410
+ this.setCompassStyle(this.mapView.getBearing());
961
2411
  }
962
- // Clean up floor_changed listener
963
- if (this.mapsindoors && this.floorChangedHandler) {
964
- this.mapsindoors.off('floor_changed', this.floorChangedHandler);
965
- this.floorChangedHandler = null;
2412
+ /**
2413
+ * Stops listening for position updates.
2414
+ */
2415
+ disconnectedCallback() {
2416
+ if (!this.positionProvider) {
2417
+ return;
2418
+ }
2419
+ if (this.isLegacyProvider(this.positionProvider)) {
2420
+ // Guard the legacy call with an existence check before invoking stopListeningForPosition
2421
+ if (this.positionProvider.stopListeningForPosition) {
2422
+ this.positionProvider.stopListeningForPosition();
2423
+ }
2424
+ }
2425
+ else {
2426
+ // Clean up modern provider event listeners
2427
+ this.cleanupModernProviderListeners();
2428
+ }
2429
+ // Clean up floor_changed listener
2430
+ if (this.mapsindoors && this.floorChangedHandler) {
2431
+ this.mapsindoors.off('floor_changed', this.floorChangedHandler);
2432
+ this.floorChangedHandler = null;
2433
+ }
966
2434
  }
967
- }
968
- /**
969
- * Renders the floor selector.
970
- *
971
- * @returns {JSX.Element}
972
- */
973
- render() {
974
- return (h(Host, null, h("div", { class: 'mi-my-position' }, h("button", { class: `mi-my-position__position-button
2435
+ /**
2436
+ * Renders the floor selector.
2437
+ *
2438
+ * @returns {JSX.Element}
2439
+ */
2440
+ render() {
2441
+ return (h(Host, { key: '25b6a75a2f84e4f286fae4d8ab7fd4a1a524fd24' }, h("div", { key: 'bf28f953743107da5c988816f92be936d657c856', class: 'mi-my-position' }, h("button", { key: 'bb93195422107b961e9029421741b40517e7f784', class: `mi-my-position__position-button
975
2442
  ${this.positionState === PositionStateTypes.POSITION_UNKNOWN || this.positionState === PositionStateTypes.POSITION_INACCURATE ? 'mi-my-position__position-button--unknown' : ''}
976
2443
  ${this.positionState === PositionStateTypes.POSITION_REQUESTING ? 'mi-my-position__position-button--requesting' : ''}
977
2444
  ${this.positionState === PositionStateTypes.POSITION_KNOWN ? 'mi-my-position__position-button--known' : ''}
978
2445
  ${this.positionState === PositionStateTypes.POSITION_CENTERED ? 'mi-my-position__position-button--centered' : ''}
979
2446
  ${this.positionState === PositionStateTypes.POSITION_TRACKED ? 'mi-my-position__position-button--tracked' : ''}
980
2447
  ${this.positionState === PositionStateTypes.POSITION_UNTRACKED ? 'mi-my-position__position-button--untracked' : ''}
981
- ${this.positionState === PositionStateTypes.POSITION_FOLLOW ? 'mi-my-position__position-button--follow' : ''}`, onClick: (event) => this.onPositionButtonClicked(event) }), h("button", { ref: (el) => this.compassButton = el, class: 'mi-my-position__compass-button', onClick: () => this.onCompassButtonClicked() }))));
982
- }
2448
+ ${this.positionState === PositionStateTypes.POSITION_FOLLOW ? 'mi-my-position__position-button--follow' : ''}`, onClick: (event) => this.onPositionButtonClicked(event) }), h("button", { key: 'a68ed322c7be7cd6f6584220d7a94243f2d18446', ref: (el) => this.compassButton = el, class: 'mi-my-position__compass-button', onClick: () => this.onCompassButtonClicked() }))));
2449
+ }
983
2450
  };
984
- MyPositionComponent.style = myPositionCss;
2451
+ MyPositionComponent.style = myPositionCss();
985
2452
 
986
2453
  export { MyPositionComponent as mi_my_position };