vendor: 5,317 bytes, lines 1-4
1/* UAParser.js v1.0.2 2 Copyright © 2012-2021 Faisal Salman <[email protected]> 3 MIT License */ 4(function(window,undefined){"use strict";var LIBVERSION="1.0.2",EMPTY="",UNKNOWN="?",FUNC_TYPE="function",UNDEF_TYPE="undefined",OBJ_TYPE="object",STR_TYPE="string",MAJOR="major",MODEL="model",NAME="name",TYPE="type",VENDOR="vendor",VERSION="version",ARCHITECTURE="architecture",CONSOLE="console",MOBILE="mobile",TABLET="tablet",SMARTTV="smarttv",WEARABLE="wearable",EMBEDDED="embedded",UA_MAX_LENGTH=255;var AMAZON="Amazon",APPLE="Apple",ASUS="ASUS",BLACKBERRY="BlackBerry",BROWSER="Browser",CHROME="Chrome",EDGE="Edge",FIREFOX="Firefox",GOOGLE="Google",HUAWEI="Huawei",LG="LG",MICROSOFT="Microsoft",MOTOROLA="Motorola",OPERA="Opera",SAMSUNG="Samsung",SONY="Sony",XIAOMI="Xiaomi",ZEBRA="Zebra",FACEBOOK="Facebook";var extend=function(regexes,extensions){var mergedRegexes={};for(var i in regexes){if(extensions[i]&&extensions[i].length%2===0){mergedRegexes[i]=extensions[i].concat(regexes[i])}else{mergedRegexes[i]=regexes[i]}}return mergedRegexes},enumerize=function(arr){var enums={};for(var i=0;i<arr.length;i++){enums[arr[i].toUpperCase()]=arr[i]}return enums},has=function(str1,str2){return typeof str1===STR_TYPE?lowerize(str2).indexOf(lowerize(str1))!==-1:false},lowerize=function(str){return str.toLowerCase()},majorize=function(version){return typeof version===STR_TYPE?version.replace(/[^\d\.]/g,EMPTY).split(".")[0]:undefined},trim=function(str,len){if(typeof str===STR_TYPE){str=str.replace(/^\s\s*/,EMPTY).replace(/\s\s*$/,EMPTY);return typeof len===UNDEF_TYPE?str:str.substring(0,UA_MAX_LENGTH)}};var rgxMapper=function(ua,arrays){var i=0,j,k,p,q,matches,match;while(i<arrays.length&&!matches){var regex=arrays[i],props=arrays[i+1];j=k=0;while(j<regex.length&&!matches){matches=regex[j++].exec(ua);if(!!matches){for(p=0;p<props.length;p++){match=matches[++k];q=props[p];if(typeof q===OBJ_TYPE&&q.length>0){if(q.length===2){if(typeof q[1]==FUNC_TYPE){this[q[0]]=q[1].call(this,match)}else{this[q[0]]=q[1]}}else if(q.length===3){if(typeof q[1]===FUNC_TYPE&&!(q[1].exec&&q[1].test)){this[q[0]]=match?q[1].call(this,match,q[2]):undefined}else{this[q[0]]=match?match.replace(q[1],q[2]):undefined}}else if(q.length===4){this[q[0]]=match?q[3].call(this,match.replace(q[1],q[2])):undefined}}else{this[q]=match?match:undefined}}}}i+=2}},strMapper=function(str,map){for(var i in map){if(typeof map[i]===OBJ_TYPE&&map[i].length>0){for(var j=0;j<map[i].length;j++){if(has(map[i][j],str)){return i===UNKNOWN?undefined:i}}}else if(has(map[i],str)){return i===UNKNOWN?undefined:i}}return str};var oldSafariMap={"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},windowsVersionMap={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"};var regexes={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[VERSION,[NAME,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[VERSION,[NAME,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[NAME,VERSION],[/opios[\/ ]+([\w\.]+)/i],[VERSION,[NAME,OPERA+" Mini"]],[/\bopr\/([\w\.]+)/i],[VERSION,[NAME,OPERA]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[NAME,VERSION],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[VERSION,[NAME,"UC"+BROWSER]],[/\bqbcore\/([\w\.]+)/i],[VERSION,[NAME,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[VERSION,[NAME,"WeChat"]],[/konqueror\/([\w\.]+)/i],[VERSION,[NAME,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[VERSION,[NAME,"IE"]],[/yabrowser\/([\w\.]+)/i],[VERSION,[NAME,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[NAME,/(.+)/,"$1 Secure "+BROWSER],VERSION],[/\bfocus\/([\w\.]+)/i],[VERSION,[NAME,FIREFOX+" Focus"]],[/\bopt\/([\w\.]+)/i],[VERSION,[NAME,OPERA+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[VERSION,[NAME,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[VERSION,[NAME,"Dolphin"]],[/coast\/([\w\.]+)/i],[VERSION,[NAME,OPERA+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[VERSION,[NAME,"MIUI "+BROWSER]],[/fxios\/([-\w\.]+)/i],[VERSION,[NAME,FIREFOX]],[/\bqihu|(qi?ho?o?|360)browser/i],[[NAME,"360 "+BROWSER]],[/(oculus|samsung|sailfish)browser\/([\w\.]+)/i],[[NAME,/(.+)/,"$1 "+BROWSER],VERSION],[/(comodo_dragon)\/([\w\.]+)/i],[[NAME,/_/g," "],VERSION],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[NAME,VERSION],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i],[NAME],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[NAME,FACEBOOK],VERSION],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[NAME,VERSION],[/\bgsa\/([\w\.]+) .*safari\//i],[VERSION,[NAME,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[VERSION,[NAME,CHROME+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[NAME,CHROME+" WebView"],
vendor: 10,747 bytes, line 4
4VERSION],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[VERSION,[NAME,"Android "+BROWSER]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[NAME,VERSION],[/version\/([\w\.]+) .*mobile\/\w+ (safari)/i],[VERSION,[NAME,"Mobile Safari"]],[/version\/([\w\.]+) .*(mobile ?safari|safari)/i],[VERSION,NAME],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[NAME,[VERSION,strMapper,oldSafariMap]],[/(webkit|khtml)\/([\w\.]+)/i],[NAME,VERSION],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[NAME,"Netscape"],VERSION],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[VERSION,[NAME,FIREFOX+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[NAME,VERSION]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[ARCHITECTURE,"amd64"]],[/(ia32(?=;))/i],[[ARCHITECTURE,lowerize]],[/((?:i[346]|x)86)[;\)]/i],[[ARCHITECTURE,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[ARCHITECTURE,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[ARCHITECTURE,"armhf"]],[/windows (ce|mobile); ppc;/i],[[ARCHITECTURE,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[ARCHITECTURE,/ower/,EMPTY,lowerize]],[/(sun4\w)[;\)]/i],[[ARCHITECTURE,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[ARCHITECTURE,lowerize]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[pt]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[MODEL,[VENDOR,SAMSUNG],[TYPE,TABLET]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[MODEL,[VENDOR,SAMSUNG],[TYPE,MOBILE]],[/\((ip(?:hone|od)[\w ]*);/i],[MODEL,[VENDOR,APPLE],[TYPE,MOBILE]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[MODEL,[VENDOR,APPLE],[TYPE,TABLET]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[MODEL,[VENDOR,HUAWEI],[TYPE,TABLET]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}-[atu]?[ln][01259x][012359][an]?)\b(?!.+d\/s)/i],[MODEL,[VENDOR,HUAWEI],[TYPE,MOBILE]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[MODEL,/_/g," "],[VENDOR,XIAOMI],[TYPE,MOBILE]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[MODEL,/_/g," "],[VENDOR,XIAOMI],[TYPE,TABLET]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[MODEL,[VENDOR,"OPPO"],[TYPE,MOBILE]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[MODEL,[VENDOR,"Vivo"],[TYPE,MOBILE]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[MODEL,[VENDOR,"Realme"],[TYPE,MOBILE]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[MODEL,[VENDOR,MOTOROLA],[TYPE,MOBILE]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[MODEL,[VENDOR,MOTOROLA],[TYPE,TABLET]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[MODEL,[VENDOR,LG],[TYPE,TABLET]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[MODEL,[VENDOR,LG],[TYPE,MOBILE]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[MODEL,[VENDOR,"Lenovo"],[TYPE,TABLET]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[MODEL,/_/g," "],[VENDOR,"Nokia"],[TYPE,MOBILE]],[/(pixel c)\b/i],[MODEL,[VENDOR,GOOGLE],[TYPE,TABLET]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[MODEL,[VENDOR,GOOGLE],[TYPE,MOBILE]],[/droid.+ ([c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[MODEL,[VENDOR,SONY],[TYPE,MOBILE]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[MODEL,"Xperia Tablet"],[VENDOR,SONY],[TYPE,TABLET]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[MODEL,[VENDOR,"OnePlus"],[TYPE,MOBILE]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[MODEL,[VENDOR,AMAZON],[TYPE,TABLET]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[MODEL,/(.+)/g,"Fire Phone $1"],[VENDOR,AMAZON],[TYPE,MOBILE]],[/(playbook);[-\w\),; ]+(rim)/i],[MODEL,VENDOR,[TYPE,TABLET]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[MODEL,[VENDOR,BLACKBERRY],[TYPE,MOBILE]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[MODEL,[VENDOR,ASUS],[TYPE,TABLET]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[MODEL,[VENDOR,ASUS],[TYPE,MOBILE]],[/(nexus 9)/i],[MODEL,[VENDOR,"HTC"],[TYPE,TABLET]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic|sony)[-_ ]?([-\w]*)/i],[VENDOR,[MODEL,/_/g," "],[TYPE,MOBILE]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[MODEL,[VENDOR,"Acer"],[TYPE,TABLET]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[MODEL,[VENDOR,"Meizu"],[TYPE,MOBILE]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[MODEL,[VENDOR,"Sharp"],[TYPE,MOBILE]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[VENDOR,MODEL,[TYPE,MOBILE]],[/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[VENDOR,MODEL,[TYPE,TABLET]],[/(surface duo)/i],[MODEL,[VENDOR,MICROSOFT],[TYPE,TABLET]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[MODEL,[VENDOR,"Fairphone"],[TYPE,MOBILE]],[/(u304aa)/i],[MODEL,[VENDOR,"AT&T"],[TYPE,MOBILE]],[/\bsie-(\w*)/i],[MODEL,[VENDOR,"Siemens"],[TYPE,MOBILE]],[/\b(rct\w+) b/i],[MODEL,[VENDOR,"RCA"],[TYPE,TABLET]],[/\b(venue[\d ]{2,7}) b/i],[MODEL,[VENDOR,"Dell"],[TYPE,TABLET]],[/\b(q(?:mv|ta)\w+) b/i],[MODEL,[VENDOR,"Verizon"],[TYPE,TABLET]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[MODEL,[VENDOR,"Barnes & Noble"],[TYPE,TABLET]],[/\b(tm\d{3}\w+) b/i],[MODEL,[VENDOR,"NuVision"],[TYPE,TABLET]],[/\b(k88) b/i],[MODEL,[VENDOR,"ZTE"],[TYPE,TABLET]],[/\b(nx\d{3}j) b/i],[MODEL,[VENDOR,"ZTE"],[TYPE,MOBILE]],[/\b(gen\d{3}) b.+49h/i],[MODEL,[VENDOR,"Swiss"],[TYPE,MOBILE]],[/\b(zur\d{3}) b/i],[MODEL,[VENDOR,"Swiss"],[TYPE,TABLET]],[/\b((zeki)?tb.*\b) b/i],[MODEL,[VENDOR,"Zeki"],[TYPE,TABLET]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[VENDOR,"Dragon Touch"],MODEL,[TYPE,TABLET]],[/\b(ns-?\w{0,9}) b/i],[MODEL,[VENDOR,"Insignia"],[TYPE,TABLET]],[/\b((nxa|next)-?\w{0,9}) b/i],[MODEL,[VENDOR,"NextBook"],[TYPE,TABLET]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[VENDOR,"Voice"],MODEL,[TYPE,MOBILE]],[/\b(lvtel\-)?(v1[12]) b/i],[[VENDOR,"LvTel"],MODEL,[TYPE,MOBILE]],[/\b(ph-1) /i],[MODEL,[VENDOR,"Essential"],[TYPE,MOBILE]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[MODEL,[VENDOR,"Envizen"],[TYPE,TABLET]],[/\b(trio[-\w\. ]+) b/i],[MODEL,[VENDOR,"MachSpeed"],[TYPE,TABLET]],[/\btu_(1491) b/i],[MODEL,[VENDOR,"Rotor"],[TYPE,TABLET]],[/(shield[\w ]+) b/i],[MODEL,[VENDOR,"Nvidia"],[TYPE,TABLET]],[/(sprint) (\w+)/i],[VENDOR,MODEL,[TYPE,MOBILE]],[/(kin\.[onetw]{3})/i],[[MODEL,/\./g," "],[VENDOR,MICROSOFT],[TYPE,MOBILE]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[MODEL,[VENDOR,ZEBRA],[TYPE,TABLET]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[MODEL,[VENDOR,ZEBRA],[TYPE,MOBILE]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[VENDOR,MODEL,[TYPE,CONSOLE]],[/droid.+; (shield) bui/i],[MODEL,[VENDOR,"Nvidia"],[TYPE,CONSOLE]],[/(playstation [345portablevi]+)/i],[MODEL,[VENDOR,SONY],[TYPE,CONSOLE]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[MODEL,[VENDOR,MICROSOFT],[TYPE,CONSOLE]],[/smart-tv.+(samsung)/i],[VENDOR,[TYPE,SMARTTV]],[/hbbtv.+maple;(\d+)/i],[[MODEL,/^/,"SmartTV"],[VENDOR,SAMSUNG],[TYPE,SMARTTV]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[VENDOR,LG],[TYPE,SMARTTV]],[/(apple) ?tv/i],[VENDOR,[MODEL,APPLE+" TV"],[TYPE,SMARTTV]],[/crkey/i],[[MODEL,CHROME+"cast"],[VENDOR,GOOGLE],[TYPE,SMARTTV]],[/droid.+aft(\w)( bui|\))/i],[MODEL,[VENDOR,AMAZON],[TYPE,SMARTTV]],[/\(dtv[\);].+(aquos)/i],[MODEL,[VENDOR,"Sharp"],[TYPE,SMARTTV]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[VENDOR,trim],[MODEL,trim],[TYPE,SMARTTV]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[TYPE,SMARTTV]],[/((pebble))app/i],[VENDOR,MODEL,[TYPE,WEARABLE]],[/droid.+; (glass) \d/i],[MODEL,[VENDOR,GOOGLE],[TYPE,WEARABLE]],[/droid.+; (wt63?0{2,3})\)/i],[MODEL,[VENDOR,ZEBRA],[TYPE,WEARABLE]],[/(quest( 2)?)/i],[MODEL,[VENDOR,FACEBOOK],[TYPE,WEARABLE]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[VENDOR,[TYPE,EMBEDDED]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[MODEL,[TYPE,MOBILE]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[MODEL,[TYPE,TABLET]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[TYPE,TABLET]],[/(phone|mobile(?:[;\/]| safari)|pda(?=.+windows ce))/i],[[TYPE,MOBILE]],[/(android[-\w\. ]{0,9});.+buil/i],[MODEL,[VENDOR,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[VERSION,[NAME,EDGE+"HTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[VERSION,[NAME,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[NAME,VERSION],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[VERSION,NAME]],os:[[/microsoft (windows) (vista|xp)/i],[NAME,VERSION],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[NAME,[VERSION,strMapper,windowsVersionMap]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[NAME,"Windows"],[VERSION,strMapper,windowsVersionMap]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[VERSION,/_/g,"."],[NAME,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[NAME,"Mac OS"],[VERSION,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[VERSION,NAME],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);
vendor: 4,196 bytes, lines 4-22
4/i],[NAME,VERSION],[/\(bb(10);/i],[VERSION,[NAME,BLACKBERRY]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[VERSION,[NAME,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[VERSION,[NAME,FIREFOX+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[VERSION,[NAME,"webOS"]],[/crkey\/([\d\.]+)/i],[VERSION,[NAME,CHROME+"cast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[NAME,"Chromium OS"],VERSION],[/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[NAME,VERSION],[/(sunos) ?([\w\.\d]*)/i],[[NAME,"Solaris"],VERSION],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[NAME,VERSION]]};var UAParser=function(ua,extensions){if(typeof ua===OBJ_TYPE){extensions=ua;ua=undefined}if(!(this instanceof UAParser)){return new UAParser(ua,extensions).getResult()}var _ua=ua||(typeof window!==UNDEF_TYPE&&window.navigator&&window.navigator.userAgent?window.navigator.userAgent:EMPTY);var _rgxmap=extensions?extend(regexes,extensions):regexes;this.getBrowser=function(){var _browser={};_browser[NAME]=undefined;_browser[VERSION]=undefined;rgxMapper.call(_browser,_ua,_rgxmap.browser);_browser.major=majorize(_browser.version);return _browser};this.getCPU=function(){var _cpu={};_cpu[ARCHITECTURE]=undefined;rgxMapper.call(_cpu,_ua,_rgxmap.cpu);return _cpu};this.getDevice=function(){var _device={};_device[VENDOR]=undefined;_device[MODEL]=undefined;_device[TYPE]=undefined;rgxMapper.call(_device,_ua,_rgxmap.device);return _device};this.getEngine=function(){var _engine={};_engine[NAME]=undefined;_engine[VERSION]=undefined;rgxMapper.call(_engine,_ua,_rgxmap.engine);return _engine};this.getOS=function(){var _os={};_os[NAME]=undefined;_os[VERSION]=undefined;rgxMapper.call(_os,_ua,_rgxmap.os);return _os};this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}};this.getUA=function(){return _ua};this.setUA=function(ua){_ua=typeof ua===STR_TYPE&&ua.length>UA_MAX_LENGTH?trim(ua,UA_MAX_LENGTH):ua;return this};this.setUA(_ua);return this};UAParser.VERSION=LIBVERSION;UAParser.BROWSER=enumerize([NAME,VERSION,MAJOR]);UAParser.CPU=enumerize([ARCHITECTURE]);UAParser.DEVICE=enumerize([MODEL,VENDOR,TYPE,CONSOLE,MOBILE,SMARTTV,TABLET,WEARABLE,EMBEDDED]);UAParser.ENGINE=UAParser.OS=enumerize([NAME,VERSION]);if(typeof exports!==UNDEF_TYPE){if(typeof module!==UNDEF_TYPE&&module.exports){exports=module.exports=UAParser}exports.UAParser=UAParser}else{if(typeof define===FUNC_TYPE&&define.amd){define(function(){return UAParser})}else if(typeof window!==UNDEF_TYPE){window.UAParser=UAParser}}var $=typeof window!==UNDEF_TYPE&&(window.jQuery||window.Zepto);if($&&!$.ua){var parser=new UAParser;$.ua=parser.getResult();$.ua.get=function(){return parser.getUA()};$.ua.set=function(ua){parser.setUA(ua);var result=parser.getResult();for(var prop in result){$.ua[prop]=result[prop]}}}})(typeof window==="object"?window:this); 5(function () 6{ 7 // default feature checks as required 8 var features = true; 9 10 try { 11 var p = UAParser(); 12 var browserName = 'Unknown'; 13 var browserVersion = 0; 14 // specific browser checks 15 if (p && p.browser) 16 { 17 browserName = p.browser.name; 18 browserVersion = parseInt(p.browser.version); 19 } 20 if (browserName == 'Firefox' && browserVersion > 55 || 21 browserName == 'Chrome' && browserVersion > 65 || 22 browserName == 'Safari' && browserVersion > 10 ||
23 browserName == 'Edge' && browserVersion > 15) 24 { 25 // feature checks not needed 26 features = false; 27 } 28 } 29 catch (e) 30 { 31 // console.log('load-polyfill-io', 'exception', e); 32 } 33 34 // if missing features, fetch polyfills 35 if (features) 36 { 37 // static polyfill js from prior settings of 38 // https://cdn.polyfill.io/v2/polyfill.js?features=Intl.~locale.en,Array.prototype.find,default-3.6&flags=gated 39 40 // Custom polyfill added for Uint32Array.from 41 42 /* Polyfill service v3.25.1 43 * For detailed credits and licence information see https://github.com/financial-times/polyfill-service. 44 * 45 * Features requested: Array.prototype.find,Intl.~locale.en,default-3.6 46 * 47 * - Array.prototype.find, License: CC0 48 * - Object.assign, License: CC0 (required by "default-3.6", "_Iterator", "_ArrayIterator", "Array.from") 49 * - Symbol, License: MIT (required by "Map", "default-3.6", "Set", "Symbol.iterator", "Symbol.species", "_Iterator", "_ArrayIterator", "Array.from", "Symbol.toStringTag") 50 * - Symbol.iterator, License: MIT (required by "Map", "default-3.6", "Set", "_Iterator", "_ArrayIterator", "Array.from") 51 * - Symbol.toStringTag, License: MIT (required by "_Iterator", "_ArrayIterator", "Array.from", "default-3.6") 52 * - _Iterator, License: MIT (required by "_ArrayIterator", "Array.from", "default-3.6") 53 * - Object.setPrototypeOf, License: MIT (required by "_ArrayIterator", "Array.from", "default-3.6") 54 * - String.prototype.includes, License: CC0 (required by "default-3.6", "String.prototype.contains", "_ArrayIterator", "Array.from") 55 * - String.prototype.contains, License: CC0 (required by "_ArrayIterator", "Array.from", "default-3.6") 56 * - _ArrayIterator, License: MIT (required by "Array.from", "default-3.6") 57 * - Number.isFinite, License: MIT (required by "Array.from", "default-3.6") 58 * - Number.isNaN, License: MIT (required by "default-3.6", "Array.from", "Map", "Set") 59 * - Array.from, License: CC0 (required by "default-3.6") 60 * - Array.of, License: MIT (required by "default-3.6") 61 * - Array.prototype.fill, License: CC0 (required by "default-3.6") 62 * - Event, License: CC0 (required by "default-3.6", "CustomEvent") 63 * - CustomEvent, License: CC0 (required by "default-3.6") 64 * - _DOMTokenList, License: ISC (required by "DOMTokenList", "default-3.6") 65 * - DOMTokenList, License: CC0 (required by "default-3.6", "Element.prototype.classList") 66 * - _mutation, License: CC0 (required by "DocumentFragment.prototype.append", "default-3.6", "DocumentFragment.prototype.prepend", "Element.prototype.after", "Element.prototype.append", "Element.prototype.before", "Element.prototype.prepend", "Element.prototype.remove", "Element.prototype.replaceWith") 67 * - DocumentFragment.prototype.append, License: CC0 (required by "default-3.6") 68 * - DocumentFragment.prototype.prepend, License: CC0 (required by "default-3.6") 69 * - Element.prototype.after, License: CC0 (required by "default-3.6") 70 * - Element.prototype.append, License: CC0 (required by "default-3.6") 71 * - Element.prototype.before, License: CC0 (required by "default-3.6") 72 * - Element.prototype.classList, License: ISC (required by "default-3.6") 73 * - Element.prototype.matches, License: CC0 (required by "default-3.6", "Element.prototype.closest") 74 * - Element.prototype.closest, License: CC0 (required by "default-3.6") 75 * - Element.prototype.prepend, License: CC0 (required by "default-3.6") 76 * - Element.prototype.remove, License: CC0 (required by "default-3.6") 77 * - Element.prototype.replaceWith, License: CC0 (required by "default-3.6") 78 * - Symbol.species, License: MIT (required by "Map", "default-3.6", "Set") 79 * - Map, License: CC0 (required by "default-3.6") 80 * - Node.prototype.contains, License: CC0 (required by "default-3.6") 81 * - Promise, License: MIT (required by "default-3.6") 82 * - Set, License: CC0 (required by "default-3.6") 83 * - String.prototype.endsWith, License: CC0 (required by "default-3.6") 84 * - String.prototype.startsWith, License: CC0 (required by "default-3.6") 85 * - URL, License: CC0 (required by "default-3.6") */ 86 87 (function(undefined) { 88 if (!Uint8Array.__proto__.from) { 89 Uint8Array.__proto__.from = function (obj, func, thisObj) { 90 var typedArrayClass = Uint8Array.__proto__; 91 if(typeof this !== 'function') { 92 throw new TypeError('# is not a constructor'); 93 } 94 if (this.__proto__ !== typedArrayClass) { 95 throw new TypeError('this is not a typed array.'); 96 } 97 func = func || function (elem) { 98 return elem; 99 }; 100 101 if (typeof func !== 'function') { 102 throw new TypeError('specified argument is not a function'); 103 } 104 obj = Object(obj); 105 if (!obj['length']) { 106 return new this(0); 107 } 108 var copy_data = []; 109 for(var i = 0; i < obj.length; i++) { 110 copy_data.push(obj[i]); 111 } 112 copy_data = copy_data.map(func, thisObj); 113 114 var typed_array = new this(copy_data.length); 115 for(var i = 0; i < typed_array.length; i++) { 116 typed_array[i] = copy_data[i]; 117 } 118 return typed_array; 119 } 120 } 121 if (!Uint32Array.__proto__.from) { 122 Uint32Array.__proto__.from = function (obj, func, thisObj) { 123 var typedArrayClass = Uint32Array.__proto__; 124 if(typeof this !== 'function') { 125 throw new TypeError('# is not a constructor'); 126 } 127 if (this.__proto__ !== typedArrayClass) { 128 throw new TypeError('this is not a typed array.'); 129 } 130 func = func || function (elem) { 131 return elem; 132 }; 133 134 if (typeof func !== 'function') { 135 throw new TypeError('specified argument is not a function'); 136 } 137 obj = Object(obj); 138 if (!obj['length']) { 139 return new this(0); 140 } 141 var copy_data = []; 142 for(var i = 0; i < obj.length; i++) { 143 copy_data.push(obj[i]); 144 } 145 copy_data = copy_data.map(func, thisObj); 146 147 var typed_array = new this(copy_data.length); 148 for(var i = 0; i < typed_array.length; i++) { 149 typed_array[i] = copy_data[i]; 150 } 151 return typed_array; 152 } 153 } 154 if (!('find' in Array.prototype)) { 155 156 // Array.prototype.find 157 Object.defineProperty(Array.prototype, 'find', { 158 configurable: true, 159 value: function find(callback) { 160 if (this === undefined || this === null) { 161 throw new TypeError(this + ' is not an object'); 162 } 163 164 if (typeof callback !== 'function') { 165 throw new TypeError(callback + ' is not a function'); 166 } 167 168 var 169 object = Object(this), 170 scope = arguments[1], 171 arraylike = object instanceof String ? object.split('') : object, 172 length = Math.max(Math.min(arraylike.length, 9007199254740991), 0) || 0, 173 index = -1, 174 element; 175 176 while (++index < length) { 177 if (index in arraylike) { 178 element = arraylike[index]; 179 180 if (callback.call(scope, element, index, object)) { 181 return element; 182 } 183 } 184 } 185 }, 186 writable: true 187 }); 188 189 } 190 191 if (!('assign' in Object)) { 192 193 // Object.assign 194 (function() { 195 196 // 7.1.13 ToObject ( argument ) 197 function toObject(argument) { 198 if (argument === null || argument === undefined) { 199 throw new TypeError('Cannot call method on ' + argument); 200 } 201 return Object(argument); 202 } 203 204 Object.defineProperty(Object, 'assign', { 205 enumerable: false, 206 configurable: true, 207 writable: true, 208 // 19.1.2.1 Object.assign ( target, ...sources ) 209 value: function assign(target, source) { // eslint-disable-line no-unused-vars 210 211 // 1. Let to be ? ToObject(target). 212 var to = toObject(target); 213 214 // 2. If only one argument was passed, return to. 215 if (arguments.length === 1) { 216 return to; 217 } 218 219 // 3. Let sources be the List of argument values starting with the second argument 220 var sources = Array.prototype.slice.call(arguments, 1); 221 222 // 4. For each element nextSource of sources, in ascending index order, do 223 var index1; 224 var index2; 225 var keys; 226 var key; 227 var from; 228 for (index1 = 0; index1 < sources.length; index1++) { 229 var nextSource = sources[index1]; 230 // 4a. If nextSource is undefined or null, let keys be a new empty List. 231 if (nextSource === undefined || nextSource === null) { 232 keys = []; 233 // 4b. Else, 234 } else { 235 // 4bi. Let from be ! ToObject(nextSource).
236 from = toObject(nextSource); 237 // 4bii. Let keys be ? from.[[OwnPropertyKeys]](). 238 /* 239 This step in our polyfill is not complying with the specification. 240 [[OwnPropertyKeys]] is meant to return ALL keys, including non-enumerable and symbols. 241 TODO: When we have Reflect.ownKeys, use that instead as it is the userland equivalent of [[OwnPropertyKeys]]. 242 */ 243 keys = Object.keys(from); 244 } 245 246 // 4c. For each element nextKey of keys in List order, do 247 for (index2 = 0; index2 < keys.length; index2++) { 248 var nextKey = keys[index2]; 249 // 4ci. Let desc be ? from.[[GetOwnProperty]](nextKey). 250 var desc = Object.getOwnPropertyDescriptor(from, nextKey); 251 // 4cii. If desc is not undefined and desc.[[Enumerable]] is true, then 252 if (desc !== undefined && desc.enumerable) { 253 // 4cii1. Let propValue be ? Get(from, nextKey). 254 var propValue = from[nextKey]; 255 // 4cii2. Perform ? Set(to, nextKey, propValue, true). 256 to[nextKey] = propValue; 257 } 258 } 259 } 260 // 5. Return to. 261 return to; 262 } 263 }); 264 }()); 265 266 } 267 268 if (!('Symbol' in this)) { 269 270 // Symbol 271 // A modification of https://github.com/WebReflection/get-own-property-symbols 272 // (C) Andrea Giammarchi - MIT Licensed 273 274 (function (Object, GOPS, global) { 275 276 var setDescriptor; 277 var id = 0; 278 var random = '' + Math.random(); 279 var prefix = '__\x01symbol:'; 280 var prefixLength = prefix.length; 281 var internalSymbol = '__\x01symbol@@' + random; 282 var DP = 'defineProperty'; 283 var DPies = 'defineProperties'; 284 var GOPN = 'getOwnPropertyNames'; 285 var GOPD = 'getOwnPropertyDescriptor'; 286 var PIE = 'propertyIsEnumerable'; 287 var ObjectProto = Object.prototype; 288 var hOP = ObjectProto.hasOwnProperty; 289 var pIE = ObjectProto[PIE]; 290 var toString = ObjectProto.toString; 291 var concat = Array.prototype.concat; 292 var cachedWindowNames = typeof window === 'object' ? Object.getOwnPropertyNames(window) : []; 293 var nGOPN = Object[GOPN]; 294 var gOPN = function getOwnPropertyNames (obj) { 295 if (toString.call(obj) === '[object Window]') { 296 try { 297 return nGOPN(obj); 298 } catch (e) { 299 // IE bug where layout engine calls userland gOPN for cross-domain `window` objects 300 return concat.call([], cachedWindowNames); 301 } 302 } 303 return nGOPN(obj); 304 }; 305 var gOPD = Object[GOPD]; 306 var create = Object.create; 307 var keys = Object.keys; 308 var freeze = Object.freeze || Object; 309 var defineProperty = Object[DP]; 310 var $defineProperties = Object[DPies]; 311 var descriptor = gOPD(Object, GOPN); 312 var addInternalIfNeeded = function (o, uid, enumerable) { 313 if (!hOP.call(o, internalSymbol)) { 314 try { 315 defineProperty(o, internalSymbol, { 316 enumerable: false, 317 configurable: false, 318 writable: false, 319 value: {} 320 }); 321 } catch (e) { 322 o[internalSymbol] = {}; 323 } 324 } 325 o[internalSymbol]['@@' + uid] = enumerable; 326 };
327 var createWithSymbols = function (proto, descriptors) { 328 var self = create(proto); 329 gOPN(descriptors).forEach(function (key) { 330 if (propertyIsEnumerable.call(descriptors, key)) { 331 $defineProperty(self, key, descriptors[key]); 332 } 333 }); 334 return self; 335 }; 336 var copyAsNonEnumerable = function (descriptor) { 337 var newDescriptor = create(descriptor); 338 newDescriptor.enumerable = false; 339 return newDescriptor; 340 }; 341 var get = function get(){}; 342 var onlyNonSymbols = function (name) { 343 return name != internalSymbol && 344 !hOP.call(source, name); 345 }; 346 var onlySymbols = function (name) { 347 return name != internalSymbol && 348 hOP.call(source, name); 349 }; 350 var propertyIsEnumerable = function propertyIsEnumerable(key) { 351 var uid = '' + key; 352 return onlySymbols(uid) ? ( 353 hOP.call(this, uid) && 354 this[internalSymbol]['@@' + uid] 355 ) : pIE.call(this, key); 356 }; 357 var setAndGetSymbol = function (uid) { 358 var descriptor = { 359 enumerable: false, 360 configurable: true, 361 get: get, 362 set: function (value) { 363 setDescriptor(this, uid, { 364 enumerable: false, 365 configurable: true, 366 writable: true, 367 value: value 368 }); 369 addInternalIfNeeded(this, uid, true); 370 } 371 }; 372 try { 373 defineProperty(ObjectProto, uid, descriptor); 374 } catch (e) { 375 ObjectProto[uid] = descriptor.value; 376 } 377 return freeze(source[uid] = defineProperty( 378 Object(uid), 379 'constructor', 380 sourceConstructor 381 )); 382 }; 383 var Symbol = function Symbol(description) { 384 if (this instanceof Symbol) { 385 throw new TypeError('Symbol is not a constructor'); 386 } 387 return setAndGetSymbol( 388 prefix.concat(description || '', random, ++id) 389 ); 390 }; 391 var source = create(null); 392 var sourceConstructor = {value: Symbol}; 393 var sourceMap = function (uid) { 394 return source[uid]; 395 }; 396 var $defineProperty = function defineProp(o, key, descriptor) { 397 var uid = '' + key; 398 if (onlySymbols(uid)) { 399 setDescriptor(o, uid, descriptor.enumerable ? 400 copyAsNonEnumerable(descriptor) : descriptor); 401 addInternalIfNeeded(o, uid, !!descriptor.enumerable); 402 } else { 403 defineProperty(o, key, descriptor); 404 } 405 return o; 406 }; 407 408 var onlyInternalSymbols = function (obj) { 409 return function (name) { 410 return hOP.call(obj, internalSymbol) && hOP.call(obj[internalSymbol], '@@' + name); 411 }; 412 }; 413 var $getOwnPropertySymbols = function getOwnPropertySymbols(o) { 414 return gOPN(o).filter(o === ObjectProto ? onlyInternalSymbols(o) : onlySymbols).map(sourceMap); 415 } 416 ; 417 418 descriptor.value = $defineProperty; 419 defineProperty(Object, DP, descriptor); 420 421 descriptor.value = $getOwnPropertySymbols; 422 defineProperty(Object, GOPS, descriptor); 423 424 descriptor.value = function getOwnPropertyNames(o) { 425 return gOPN(o).filter(onlyNonSymbols); 426 }; 427 defineProperty(Object, GOPN, descriptor); 428 429 descriptor.value = function defineProperties(o, descriptors) { 430 var symbols = $getOwnPropertySymbols(descriptors); 431 if (symbols.length) { 432 keys(descriptors).concat(symbols).forEac
432h(function (uid) { 433 if (propertyIsEnumerable.call(descriptors, uid)) { 434 $defineProperty(o, uid, descriptors[uid]); 435 } 436 }); 437 } else { 438 $defineProperties(o, descriptors); 439 } 440 return o; 441 }; 442 defineProperty(Object, DPies, descriptor); 443 444 descriptor.value = propertyIsEnumerable; 445 defineProperty(ObjectProto, PIE, descriptor); 446 447 descriptor.value = Symbol; 448 defineProperty(global, 'Symbol', descriptor); 449 450 // defining `Symbol.for(key)` 451 descriptor.value = function (key) { 452 var uid = prefix.concat(prefix, key, random); 453 return uid in ObjectProto ? source[uid] : setAndGetSymbol(uid); 454 }; 455 defineProperty(Symbol, 'for', descriptor); 456 457 // defining `Symbol.keyFor(symbol)` 458 descriptor.value = function (symbol) { 459 if (onlyNonSymbols(symbol)) 460 throw new TypeError(symbol + ' is not a symbol'); 461 return hOP.call(source, symbol) ? 462 symbol.slice(prefixLength * 2, -random.length) : 463 void 0 464 ; 465 }; 466 defineProperty(Symbol, 'keyFor', descriptor); 467 468 descriptor.value = function getOwnPropertyDescriptor(o, key) { 469 var descriptor = gOPD(o, key); 470 if (descriptor && onlySymbols(key)) { 471 descriptor.enumerable = propertyIsEnumerable.call(o, key); 472 } 473 return descriptor; 474 }; 475 defineProperty(Object, GOPD, descriptor); 476 477 descriptor.value = function (proto, descriptors) { 478 return arguments.length === 1 || typeof descriptors === "undefined" ? 479 create(proto) : 480 createWithSymbols(proto, descriptors); 481 }; 482 defineProperty(Object, 'create', descriptor); 483 484 descriptor.value = function () { 485 var str = toString.call(this); 486 return (str === '[object String]' && onlySymbols(this)) ? '[object Symbol]' : str; 487 }; 488 defineProperty(ObjectProto, 'toString', descriptor); 489 490 491 setDescriptor = function (o, key, descriptor) { 492 var protoDescriptor = gOPD(ObjectProto, key); 493 delete ObjectProto[key]; 494 defineProperty(o, key, descriptor); 495 if (o !== ObjectProto) { 496 defineProperty(ObjectProto, key, protoDescriptor); 497 } 498 }; 499 500 }(Object, 'getOwnPropertySymbols', this)); 501 502 } 503 504 if (!('Symbol' in this && 'iterator' in this.Symbol)) { 505 506 // Symbol.iterator 507 Object.defineProperty(Symbol, 'iterator', {value: Symbol('iterator')}); 508 509 } 510 511 if (!('Symbol' in this && 'toStringTag' in this.Symbol)) { 512 513 // Symbol.toStringTag 514 Object.defineProperty(Symbol, 'toStringTag', { 515 value: Symbol('toStringTag') 516 }); 517 518 } 519 520 521 // _Iterator 522 // A modification of https://github.com/medikoo/es6-iterator 523 // Copyright (C) 2013-2015 Mariusz Nowak (www.medikoo.com) 524 525 var Iterator = (function () { // eslint-disable-line no-unused-vars 526 var clear = function () { 527 this.length = 0; 528 return this; 529 }; 530 var callable = function (fn) { 531 if (typeof fn !== 'function') throw new TypeError(fn + " is not a function"); 532 return fn; 533 }; 534 535 var Iterator = function (list, context) { 536 if (!(this instanceof Iterator)) { 537 return new Iterator(list, context); 538 } 539 Object.defineProperties(this, { 540 __list__: { 541 writable: true, 542 value: list 543 }, 544 __context__: { 545 writable: true, 546 value: context 547 }, 548 __nextIndex__: { 549 writable: true, 550 value: 0 551 } 552 }); 553 if (!context) return; 554 callable(context.on); 555 context.on('_add', this._onAdd.bind(this)); 556 context.on('_delete', this._onDelete.bind(this)); 557 context.on('_clear', this._onClear.bind(this)); 558 }; 559 560 Object.defineProperties(Iterator.prototype, Object.assign({ 561 constructor: { 562 value: Iterator, 563 configurable: true, 564 enumerable: false, 565 writable: true 566 }, 567 _next: { 568 value: function () { 569 var i; 570 if (!this.__list__) return; 571 if (this.__redo__) { 572 i = this.__redo__.shift(); 573 if (i !== undefined) return i; 574 } 575 if (this.__nextIndex__ < this.__list__.length) return this.__nextIndex__++; 576 this._unBind(); 577 }, 578 configurable: true, 579 enumerable: false, 580 writable: true 581 }, 582 next: { 583 value: function () { 584 return this._createResult(this._next()); 585 }, 586 configurable: true, 587 enumerable: false, 588 writable: true 589 }, 590 _createResult: { 591 value: function (i) { 592 if (i === undefined) return { 593 done: true, 594 value: undefined 595 }; 596 return { 597 done: false, 598 value: this._resolve(i) 599 }; 600 }, 601 configurable: true, 602 enumerable: false, 603 writable: true 604 }, 605 _resolve: { 606 value: function (i) { 607 return this.__list__[i]; 608 }, 609 configurable: true, 610 enumerable: false, 611 writable: true 612 }, 613 _unBind: { 614 value: function () { 615 this.__list__ = null; 616 delete this.__redo__; 617 if (!this.__context__) return; 618 this.__context__.off('_add', this._onAdd.bind(this)); 619 this.__context__.off('_delete', this._onDelete.bind(this)); 620 this.__context__.off('_clear', this._onClear.bind(this)); 621 this.__context__ = null; 622 }, 623 configurable: true, 624 enumerable: false, 625 writable: true 626 }, 627 toString: { 628 value: function () { 629 return '[object Iterator]'; 630 }, 631 configurable: true, 632 enumerable: false, 633 writable: true 634 } 635 }, { 636 _onAdd: { 637 value: function (index) { 638 if (index >= this.__nextIndex__) return; 639 ++this.__nextIndex__; 640 if (!this.__redo__) { 641 Object.defineProperty(this, '__redo__', { 642 value: [index], 643 configurable: true, 644 enumerable: false, 645 writable: false 646 }); 647 return; 648 } 649 this.__redo__.forEach(function (redo, i) { 650 if (redo >= index) this.__redo__[i] = ++redo; 651 }, this); 652 this.__redo__.push(index); 653 }, 654 configurable: true, 655 enumerable: false, 656 writable: true 657 }, 658 _onDelete: { 659 value: function (index) { 660 var i; 661 if (index >= this.__nextIndex__) return; 662 --this.__nextIndex__; 663 if (!this.__redo__) return; 664 i = this.__redo__.indexOf(index); 665 if (i !== -1) this.__redo__.splice(i, 1); 666 this.__redo__.forEach(function (redo, i) { 667 if (redo > index) this.__redo__[i] = --redo; 668 }, this); 669 }, 670 configurable: true, 671 enumerable: false, 672 writable: true 673 }, 674 _onClear: { 675 value: function () { 676 if (this.__redo__) clear.call(this.__redo__); 677 this.__nextIndex__ = 0; 678 }, 679 configurable: true, 680 enumerable: false, 681 writable: true 682 } 683 })); 684 685 Object.defineProperty(Iterator.prototype, Symbol.iterator, { 686 value: function () { 687 return this; 688 }, 689 configurable: true, 690 enumerable: false, 691 writable: true 692 }); 693 Object.defineProperty(Iterator.prototype, Symbol.toStringTag, { 694 value: 'Iterator', 695 configurable: false, 696 enumerable: false, 697 writable: true 698 }); 699 700 return Iterator; 701 }()); 702 703 // Object.setPrototypeOf 704 // ES6-shim 0.16.0 (c) 2013-2014 Paul Miller (http://paulmillr.com) 705 // ES6-shim may be freely distributed under the MIT license. 706 // For more details and documentation: 707 // https://github.com/paulmillr/es6-shim/ 708 709 // NOTE: This versions needs object ownership 710 // because every promoted object needs to be reassigned 711 // otherwise uncompatible browsers cannot work as expected 712 // 713 // NOTE: This might need es5-shim or polyfills upfront 714 // because it's based on ES5 API. 715 // (probably just an IE <= 8 problem) 716 // 717 // NOTE: nodejs is fine in version 0.8, 0.10, and future versions. 718 (function () { 719 if (Object.setPrototypeOf) { return; } 720 721 /*jshint proto: true */ 722 // @author Andrea Giammarchi - @WebReflection 723 724 var getOwnPropertyNames = Object.getOwnPropertyNames; 725 var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; 726 var create = Object.create; 727 var defineProperty = Object.defineProperty; 728 var getPrototypeOf = Object.getPrototypeOf; 729 var objProto = Object.prototype; 730 731 var copyDescriptors = function (target, source) { 732 // define into target descriptors from source 733 getOwnPropertyNames(source).forEach(function (key) { 734 defineProperty( 735 target, 736 key, 737 getOwnPropertyDescriptor(source, key) 738 ); 739 }); 740 return target; 741 }; 742 // used as fallback when no promotion is possible 743 var createAndCopy = function (origin, proto) { 744 return copyDescriptors(create(proto), origin); 745 }; 746 var set, setPrototypeOf; 747 try { 748 // this might fail for various reasons 749 // ignore if Chrome cought it at runtime 750 set = getOwnPropertyDescriptor(objProto, '__proto__').set; 751 set.call({}, null); 752 // setter not poisoned, it can promote 753 // Firefox, Chrome 754 setPrototypeOf = function (origin, proto) { 755 set.call(origin, proto); 756 return origin; 757 }; 758 } catch (e) { 759 // do one or more feature detections 760 set = { __proto__: null }; 761 // if proto does not work, needs to fallback 762 // some Opera, Rhino, ducktape 763 if (set instanceof Object) { 764 setPrototypeOf = createAndCopy; 765 } else { 766 // verify if null objects are buggy 767 /* eslint-disable no-proto */ 768 set.__proto__ = objProto; 769 /* eslint-enable no-proto */ 770 // if null objects are buggy 771 // nodejs 0.8 to 0.10 772 if (set instanceof Object) { 773 setPrototypeOf = function (origin, proto) { 774 // use such bug to promote 775 /* eslint-disable no-proto */ 776 origin.__proto__ = proto; 777 /* eslint-enable no-proto */ 778 return origin; 779 }; 780 } else { 781 // try to use proto or fallback 782 // Safari, old Firefox, many others 783 setPrototypeOf = function (origin, proto) { 784 // if proto is not null 785 if (getPrototypeOf(origin)) { 786 // use __proto__ to promote 787 /* eslint-disable no-proto */ 788 origin.__proto__ = proto; 789 /* eslint-enable no-proto */ 790 return origin; 791 } else { 792 // otherwise unable to promote: fallback 793 return createAndCopy(origin, proto); 794 } 795 }; 796 } 797 } 798 } 799 Object.setPrototypeOf = setPrototypeOf; 800 }()); 801 if (!('includes' in String.prototype)) { 802 803// String.prototype.includes 804 String.prototype
804.includes = function (string, index) { 805 if (typeof string === 'object' && string instanceof RegExp) throw new TypeError("First argument to String.prototype.includes must not be a regular expression"); 806 return this.indexOf(string, index) !== -1; 807 }; 808 809 } 810 811 if (!('contains' in String.prototype)) { 812 813// String.prototype.contains 814 String.prototype.contains = String.prototype.includes; 815 816 } 817 818 819 // _ArrayIterator 820 // A modification of https://github.com/medikoo/es6-iterator 821 // Copyright (C) 2013-2015 Mariusz Nowak (www.medikoo.com) 822 823 var ArrayIterator = (function() { // eslint-disable-line no-unused-vars 824 825 var ArrayIterator = function(arr, kind) { 826 if (!(this instanceof ArrayIterator)) return new ArrayIterator(arr, kind); 827 Iterator.call(this, arr); 828 if (!kind) kind = 'value'; 829 else if (String.prototype.contains.call(kind, 'key+value')) kind = 'key+value'; 830 else if (String.prototype.contains.call(kind, 'key')) kind = 'key'; 831 else kind = 'value'; 832 Object.defineProperty(this, '__kind__', { 833 value: kind, 834 configurable: false, 835 enumerable: false, 836 writable: false 837 }); 838 }; 839 if (Object.setPrototypeOf) Object.setPrototypeOf(ArrayIterator, Iterator.prototype); 840 841 ArrayIterator.prototype = Object.create(Iterator.prototype, { 842 constructor: { 843 value: ArrayIterator, 844 configurable: true, 845 enumerable: false, 846 writable: true 847 }, 848 _resolve: { 849 value: function(i) { 850 if (this.__kind__ === 'value') return this.__list__[i]; 851 if (this.__kind__ === 'key+value') return [i, this.__list__[i]]; 852 return i; 853 }, 854 configurable: true, 855 enumerable: false, 856 writable: true 857 }, 858 toString: { 859 value: function() { 860 return '[object Array Iterator]'; 861 }, 862 configurable: true, 863 enumerable: false, 864 writable: true 865 } 866 }); 867 868 return ArrayIterator; 869 }()); 870 if (!('isFinite' in Number)) { 871 872 // Number.isFinite 873 Number.isFinite = Number.isFinite || function(value) { 874 return typeof value === "number" && isFinite(value); 875 }; 876 877 } 878 879 if (!('isNaN' in Number)) { 880 881 // Number.isNaN 882 Number.isNaN = Number.isNaN || function(value) { 883 return typeof value === "number" && isNaN(value); 884 }; 885 886 } 887 888 if (!('from' in Array && (function () { 889 try { 890 Array.from({ length: -Infinity }); 891 892 return true; 893 } catch (e) { 894 return false; 895 } 896 }()))) { 897 898 // Array.from 899 // Wrapped in IIFE to prevent leaking to global scope. 900 (function () { 901 'use strict'; 902 903 function toInteger(value) { 904 var number = Number(value); 905 return sign(number) * Math.floor(Math.abs(Math.min(Math.max(number || 0, 0), 9007199254740991))); 906 } 907 908 var has = Object.prototype.hasOwnProperty; 909 var strValue = String.prototype.valueOf; 910 911 var tryStringObject = function tryStringObject(value) { 912 try { 913 strValue.call(value); 914 return true; 915 } catch (e) { 916 return false;
917 } 918 }; 919 920 function sign(number) { 921 return number >= 0 ? 1 : -1; 922 } 923 924 var toStr = Object.prototype.toString; 925 var strClass = '[object String]'; 926 var hasSymbols = typeof Symbol === 'function'; 927 var hasToStringTag = hasSymbols && 'toStringTag' in Symbol; 928 929 function isString(value) { 930 if (typeof value === 'string') { 931 return true; 932 } 933 if (typeof value !== 'object') { 934 return false; 935 } 936 return hasToStringTag ? tryStringObject(value) : toStr.call(value) === strClass; 937 } 938 939 var fnToStr = Function.prototype.toString; 940 941 var constructorRegex = /^\s*class /; 942 var isES6ClassFn = function isES6ClassFn(value) { 943 try { 944 var fnStr = fnToStr.call(value); 945 var singleStripped = fnStr.replace(/\/\/.*\n/g, ''); 946 var multiStripped = singleStripped.replace(/\/\*[.\s\S]*\*\//g, ''); 947 var spaceStripped = multiStripped.replace(/\n/mg, ' ').replace(/ {2}/g, ' '); 948 return constructorRegex.test(spaceStripped); 949 } catch (e) { 950 return false; // not a function 951 } 952 }; 953 954 var tryFunctionObject = function tryFunctionObject(value) { 955 try { 956 if (isES6ClassFn(value)) { 957 return false; 958 } 959 fnToStr.call(value); 960 return true; 961 } catch (e) { 962 return false; 963 } 964 }; 965 var fnClass = '[object Function]'; 966 var genClass = '[object GeneratorFunction]'; 967 968 function isCallable(value) { 969 if (!value) { 970 return false; 971 } 972 if (typeof value !== 'function' && typeof value !== 'object') { 973 return false; 974 } 975 if (hasToStringTag) { 976 return tryFunctionObject(value); 977 } 978 if (isES6ClassFn(value)) { 979 return false; 980 } 981 var strClass = toStr.call(value); 982 return strClass === fnClass || strClass === genClass; 983 }; 984 var isArray = Array.isArray; 985 986 var parseIterable = function (iterator) { 987 var done = false; 988 var iterableResponse; 989 var tempArray = []; 990 991 if (iterator && typeof iterator.next === 'function') { 992 while (!done) { 993 iterableResponse = iterator.next(); 994 if ( 995 has.call(iterableResponse, 'value') && 996 has.call(iterableResponse, 'done') 997 ) { 998 if (iterableResponse.done === true) { 999 done = true; 1000 break; // eslint-disable-line no-restricted-syntax 1001 1002 } else if (iterableResponse.done !== false) { 1003 break; // eslint-disable-line no-restricted-syntax 1004 } 1005 1006 tempArray.push(iterableResponse.value); 1007 } else if (iterableResponse.done === true) { 1008 done = true; 1009 break; // eslint-disable-line no-restricted-syntax 1010 } else { 1011 break; // eslint-disable-line no-restricted-syntax 1012 } 1013 } 1014 } 1015 1016 return done ? tempArray : false;
1017 }; 1018 1019 var iteratorSymbol; 1020 var forOf; 1021 var hasSet = typeof Set === 'function'; 1022 var hasMap = typeof Map === 'function'; 1023 1024 if (hasSymbols) { 1025 iteratorSymbol = Symbol.iterator; 1026 } else { 1027 var iterate; 1028 try { 1029 iterate = Function('iterable', 'var arr = []; for (var value of iterable) arr.push(value); return arr;'); // eslint-disable-line no-new-func 1030 } catch (e) {} 1031 var supportsStrIterator = (function () { 1032 try { 1033 var supported = false; 1034 var obj = { // eslint-disable-line no-unused-vars 1035 '@@iterator': function () { 1036 return { 1037 'next': function () { 1038 supported = true; 1039 return { 1040 'done': true, 1041 'value': undefined 1042 }; 1043 } 1044 }; 1045 } 1046 }; 1047 1048 iterate(obj); 1049 return supported; 1050 } catch (e) { 1051 return false; 1052 } 1053 }()); 1054 1055 if (supportsStrIterator) { 1056 iteratorSymbol = '@@iterator'; 1057 } else if (typeof Set === 'function') { 1058 var s = new Set(); 1059 s.add(0); 1060 try { 1061 if (iterate(s).length === 1) { 1062 forOf = iterate; 1063 } 1064 } catch (e) {} 1065 } 1066 } 1067 1068 var isSet; 1069 if (hasSet) { 1070 var setSize = Object.getOwnPropertyDescriptor(Set.prototype, 'size').get; 1071 isSet = function (set) { 1072 try { 1073 setSize.call(set); 1074 return true; 1075 } catch (e) { 1076 return false; 1077 } 1078 }; 1079 } 1080 1081 var isMap; 1082 if (hasMap) { 1083 var mapSize = Object.getOwnPropertyDescriptor(Map.prototype, 'size').get; 1084 isMap = function (m) { 1085 try { 1086 mapSize.call(m); 1087 return true; 1088 } catch (e) { 1089 return false; 1090 } 1091 }; 1092 } 1093 1094 var setForEach = hasSet && Set.prototype.forEach; 1095 var mapForEach = hasMap && Map.prototype.forEach; 1096 var usingIterator = function (items) { 1097 var tempArray = []; 1098 if (has.call(items, iteratorSymbol)) { 1099 return items[iteratorSymbol](); 1100 } else if (setForEach && isSet(items)) { 1101 setForEach.call(items, function (val) { 1102 tempArray.push(val); 1103 }); 1104 return { 1105 next: function () { 1106 return tempArray.length === 0 1107 ? { 1108 done: true 1109 } 1110 : { 1111 value: tempArray.splice(0, 1)[0], 1112 done: false 1113 }; 1114 } 1115 }; 1116 } else if (mapForEach && isMap(items)) { 1117 mapForEach.call(items, function (val, key) { 1118 tempArray.push([key, val]); 1119 }); 1120 return { 1121 next: function () { 1122 return tempArray.length === 0 1123 ? { 1124 done: true 1125 } 1126 : { 1127 value: tempArray.splice(0, 1)[0], 1128 done: false 1129 }; 1130 } 1131 }; 1132 } 1133 return items; 1134 }; 1135 1136 var strMatch = String.prototype.match; 1137 1138 var parseIterableLike = function (items) { 1139 var arr = parseIterable(usingIterator(items)); 1140 1141 if (!arr) { 1142 if (isString(items)) { 1143 arr = strMatch.call(items, /[\uD800-\uDBFF][\uDC00-\uDFFF]?|[^\uD800-\uDFFF]|./g) || []; 1144 } else if (forOf && !isArray(items)) { 1145 // Safari 8's native Map or Set can't be iterated except with for..of 1146 try { 1147 arr = forOf(items); 1148 } catch (e) {} 1149 } 1150 } 1151 return arr || items; 1152 }; 1153 1154 /*! https://mths.be/array-from v0.2.0 by @mathias */ 1155 Object.defineProperty(Array, 'from', { 1156 configurable: true, 1157 value: function from(items) { 1158 var C = this; 1159 if (items === null || typeof items === 'undefined') { 1160 throw new TypeError('`Array.from` requires an array-like object, not `null` or `undefined`'); 1161 } 1162 var mapFn, T; 1163 if (typeof arguments[1] !== 'undefined') { 1164 mapFn = arguments[1]; 1165 if (!isCallable(mapFn)) { 1166 throw new TypeError('When provided, the second argument to `Array.from` must be a function'); 1167 } 1168 if (arguments.length > 2) { 1169 T = arguments[2]; 1170 } 1171 } 1172 1173 var arrayLike = Object(parseIterableLike(items)); 1174 var len = toInteger(arrayLike.length); 1175 var A = isCallable(C) ? Object(new C(len)) : new Array(len); 1176 var k = 0; 1177 var kValue, mappedValue; 1178 1179 while (k < len) { 1180 kValue = arrayLike[k]; 1181 if (mapFn) { 1182 mappedValue = typeof T === 'undefined' ? mapFn(kValue, k) : mapFn.apply(T, [kValue, k]); 1183 } else { 1184 mappedValue = kValue; 1185 } 1186 Object.defineProperty(A, k, { 1187 'configurable': true, 1188 'enumerable': true, 1189 'value': mappedValue, 1190 'writable': true 1191 }); 1192 k += 1; 1193 } 1194 A.length = len; 1195 return A; 1196 }, 1197 writable: true 1198 }); 1199 }()); 1200 1201 } 1202 1203 if (!('of' in Array)) { 1204 1205 // Array.of 1206 /*! https://mths.be/array-of v0.1.0 by @mathias */ 1207 (function () { 1208 'use strict'; 1209 var defineProperty = (function () { 1210 // IE 8 only supports `Object.defineProperty` on DOM elements 1211 try { 1212 var object = {}; 1213 var $defineProperty = Object.defineProperty; 1214 var result = $defineProperty(object, object, object) && $defineProperty; 1215 } catch (error) { /**/ } 1216 return result; 1217 }()); 1218 var isConstructor = function isConstructor(Constructor) { 1219 try { 1220 return !!new Constructor(); 1221 } catch (_) { 1222 return false;
1223 } 1224 }; 1225 var of = function of() { 1226 var items = arguments; 1227 var length = items.length; 1228 var Me = this; 1229 var result = isConstructor(Me) ? new Me(length) : new Array(length); 1230 var index = 0; 1231 var value; 1232 while (index < length) { 1233 value = items[index]; 1234 if (defineProperty) { 1235 defineProperty(result, index, { 1236 'value': value, 1237 'writable': true, 1238 'enumerable': true, 1239 'configurable': true 1240 }); 1241 } else { 1242 result[index] = value; 1243 } 1244 index += 1; 1245 } 1246 result.length = length; 1247 return result; 1248 }; 1249 if (defineProperty) { 1250 defineProperty(Array, 'of', { 1251 'value': of, 1252 'configurable': true, 1253 'writable': true 1254 }); 1255 } else { 1256 Array.of = of; 1257 } 1258 }()); 1259 1260 } 1261 1262 if (!('fill' in Array.prototype)) { 1263 1264 // Array.prototype.fill 1265 Object.defineProperty(Array.prototype, 'fill', { 1266 configurable: true, 1267 value: function fill(value) { 1268 if (this === undefined || this === null) { 1269 throw new TypeError(this + ' is not an object'); 1270 } 1271 1272 var arrayLike = Object(this); 1273 1274 var length = Math.max(Math.min(arrayLike.length, 9007199254740991), 0) || 0; 1275 1276 var relativeStart = 1 in arguments ? parseInt(Number(arguments[1]), 10) || 0 : 0; 1277 1278 relativeStart = relativeStart < 0 ? Math.max(length + relativeStart, 0) : Math.min(relativeStart, length); 1279 1280 var relativeEnd = 2 in arguments && arguments[2] !== undefined ? parseInt(Number(arguments[2]), 10) || 0 : length; 1281 1282 relativeEnd = relativeEnd < 0 ? Math.max(length + arguments[2], 0) : Math.min(relativeEnd, length); 1283 1284 while (relativeStart < relativeEnd) { 1285 arrayLike[relativeStart] = value; 1286 1287 ++relativeStart; 1288 } 1289 1290 return arrayLike; 1291 }, 1292 writable: true 1293 }); 1294 1295 } 1296 1297 if (!((function(global) { 1298 1299 if (!('Event' in global)) return false; 1300 if (typeof global.Event === 'function') return true; 1301 1302 try { 1303 1304 // In IE 9-11, the Event object exists but cannot be instantiated 1305 new Event('click'); 1306 return true; 1307 } catch(e) { 1308 return false; 1309 } 1310 }(this)))) { 1311 1312 // Event 1313 (function () { 1314 var unlistenableWindowEvents = { 1315 click: 1, 1316 dblclick: 1, 1317 keyup: 1, 1318 keypress: 1, 1319 keydown: 1, 1320 mousedown: 1, 1321 mouseup: 1, 1322 mousemove: 1, 1323 mouseover: 1, 1324 mouseenter: 1, 1325 mouseleave: 1, 1326 mouseout: 1, 1327 storage: 1, 1328 storagecommit: 1, 1329 textinput: 1 1330 }; 1331 1332 // This polyfill depends on availability of `document` so will not run in a worker 1333 // However, we asssume there are no browsers with worker support that lack proper 1334 // support for `Event` within the worker 1335 if (typeof document === 'undefined' || typeof window === 'undefined') return; 1336 1337 function indexOf(array, element) { 1338 var 1339 index = -1, 1340 length = array.length; 1341 1342 while (++index < length) { 1343 if (index in array && array[index] === element) { 1344 return index; 1345 } 1346 } 1347 1348 return -1; 1349 } 1350 1351 var existingProto = (window.Event && window.Event.prototype) || null; 1352 window.Event = Window.prototype.Event = function Event(type, eventInitDict) { 1353 if (!type) { 1354 throw new Error('Not enough arguments'); 1355 } 1356 1357 var event; 1358 // Shortcut if browser supports createEvent
1359 if ('createEvent' in document) { 1360 event = document.createEvent('Event'); 1361 var bubbles = eventInitDict && eventInitDict.bubbles !== undefined ? eventInitDict.bubbles : false; 1362 var cancelable = eventInitDict && eventInitDict.cancelable !== undefined ? eventInitDict.cancelable : false; 1363 1364 event.initEvent(type, bubbles, cancelable); 1365 1366 return event; 1367 } 1368 1369 event = document.createEventObject(); 1370 1371 event.type = type; 1372 event.bubbles = eventInitDict && eventInitDict.bubbles !== undefined ? eventInitDict.bubbles : false; 1373 event.cancelable = eventInitDict && eventInitDict.cancelable !== undefined ? eventInitDict.cancelable : false; 1374 1375 return event; 1376 }; 1377 if (existingProto) { 1378 Object.defineProperty(window.Event, 'prototype', { 1379 configurable: false, 1380 enumerable: false, 1381 writable: true, 1382 value: existingProto 1383 }); 1384 } 1385 1386 if (!('createEvent' in document)) { 1387 window.addEventListener = Window.prototype.addEventListener = Document.prototype.addEventListener = Element.prototype.addEventListener = function addEventListener() { 1388 var 1389 element = this, 1390 type = arguments[0], 1391 listener = arguments[1]; 1392 1393 if (element === window && type in unlistenableWindowEvents) { 1394 throw new Error('In IE8 the event: ' + type + ' is not available on the window object. Please see https://github.com/Financial-Times/polyfill-service/issues/317 for more information.'); 1395 } 1396 1397 if (!element._events) { 1398 element._events = {}; 1399 } 1400 1401 if (!element._events[type]) { 1402 element._events[type] = function (event) { 1403 var 1404 list = element._events[event.type].list, 1405 events = list.slice(), 1406 index = -1, 1407 length = events.length, 1408 eventElement; 1409 1410 event.preventDefault = function preventDefault() { 1411 if (event.cancelable !== false) { 1412 event.returnValue = false; 1413 } 1414 }; 1415 1416 event.stopPropagation = function stopPropagation() { 1417 event.cancelBubble = true; 1418 }; 1419 1420 event.stopImmediatePropagation = function stopImmediatePropagation() { 1421 event.cancelBubble = true; 1422 event.cancelImmediate = true; 1423 }; 1424 1425 event.currentTarget = element; 1426 event.relatedTarget = event.fromElement || null; 1427 event.target = event.target || event.srcElement || element; 1428 event.timeStamp = new Date().getTime(); 1429 1430 if (event.clientX) { 1431 event.pageX = event.clientX + document.documentElement.scrollLeft; 1432 event.pageY = event.clientY + document.documentElement.scrollTop; 1433 } 1434 1435 while (++index < length && !event.cancelImmediate) { 1436 if (index in events) { 1437 eventElement = events[index]; 1438 1439 if (indexOf(list, eventElement) !== -1 && typeof eventElement === 'function') { 1440 eventElement.call(element, event); 1441 } 1442 } 1443 } 1444 }; 1445 1446 element._events[type].list = []; 1447 1448 if (element.attachEvent) { 1449 element.attachEvent('on' + type, element._events[type]); 1450 } 1451 } 1452 1453 element._events[type].list.push(listener); 1454 }; 1455
1456 window.removeEventListener = Window.prototype.removeEventListener = Document.prototype.removeEventListener = Element.prototype.removeEventListener = function removeEventListener() { 1457 var 1458 element = this, 1459 type = arguments[0], 1460 listener = arguments[1], 1461 index; 1462 1463 if (element._events && element._events[type] && element._events[type].list) { 1464 index = indexOf(element._events[type].list, listener); 1465 1466 if (index !== -1) { 1467 element._events[type].list.splice(index, 1); 1468 1469 if (!element._events[type].list.length) { 1470 if (element.detachEvent) { 1471 element.detachEvent('on' + type, element._events[type]); 1472 } 1473 delete element._events[type]; 1474 } 1475 } 1476 } 1477 }; 1478 1479 window.dispatchEvent = Window.prototype.dispatchEvent = Document.prototype.dispatchEvent = Element.prototype.dispatchEvent = function dispatchEvent(event) { 1480 if (!arguments.length) { 1481 throw new Error('Not enough arguments'); 1482 } 1483 1484 if (!event || typeof event.type !== 'string') { 1485 throw new Error('DOM Events Exception 0'); 1486 } 1487 1488 var element = this, type = event.type; 1489 1490 try { 1491 if (!event.bubbles) { 1492 event.cancelBubble = true; 1493 1494 var cancelBubbleEvent = function (event) { 1495 event.cancelBubble = true; 1496 1497 (element || window).detachEvent('on' + type, cancelBubbleEvent); 1498 }; 1499 1500 this.attachEvent('on' + type, cancelBubbleEvent); 1501 } 1502 1503 this.fireEvent('on' + type, event); 1504 } catch (error) { 1505 event.target = element; 1506 1507 do { 1508 event.currentTarget = element; 1509 1510 if ('_events' in element && typeof element._events[type] === 'function') { 1511 element._events[type].call(element, event); 1512 } 1513 1514 if (typeof element['on' + type] === 'function') { 1515 element['on' + type].call(element, event); 1516 } 1517 1518 element = element.nodeType === 9 ? element.parentWindow : element.parentNode; 1519 } while (element && !event.cancelBubble); 1520 } 1521 1522 return true; 1523 }; 1524 1525 // Add the DOMContentLoaded Event 1526 document.attachEvent('onreadystatechange', function() { 1527 if (document.readyState === 'complete') { 1528 document.dispatchEvent(new Event('DOMContentLoaded', { 1529 bubbles: true 1530 })); 1531 } 1532 }); 1533 } 1534 }()); 1535 1536 } 1537 1538 if (!('CustomEvent' in this && 1539 1540 // In Safari, typeof CustomEvent == 'object' but it otherwise works fine 1541 (typeof this.CustomEvent === 'function' || 1542 (this.CustomEvent.toString().indexOf('CustomEventConstructor')>-1)))) { 1543 1544 // CustomEvent 1545 this.CustomEvent = function CustomEvent(type, eventInitDict) { 1546 if (!type) { 1547 throw Error('TypeError: Failed to construct "CustomEvent": An event name must be provided.'); 1548 } 1549 1550 var event; 1551 eventInitDict = eventInitDict || {bubbles: false, cancelable: false, detail: null}; 1552
1553 if ('createEvent' in document) { 1554 try { 1555 event = document.createEvent('CustomEvent'); 1556 event.initCustomEvent(type, eventInitDict.bubbles, eventInitDict.cancelable, eventInitDict.detail); 1557 } catch (error) { 1558 // for browsers which don't support CustomEvent at all, we use a regular event instead 1559 event = document.createEvent('Event'); 1560 event.initEvent(type, eventInitDict.bubbles, eventInitDict.cancelable); 1561 event.detail = eventInitDict.detail; 1562 } 1563 } else { 1564 1565 // IE8 1566 event = new Event(type, eventInitDict); 1567 event.detail = eventInitDict && eventInitDict.detail || null; 1568 } 1569 return event; 1570 }; 1571 1572 CustomEvent.prototype = Event.prototype; 1573 1574 } 1575 1576 1577 // _DOMTokenList 1578 /* 1579 Copyright (c) 2016, John Gardner 1580 1581 Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 1582 1583 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 1584 */ 1585 var _DOMTokenList = (function() { // eslint-disable-line no-unused-vars 1586 var dpSupport = true; 1587 var defineGetter = function (object, name, fn, configurable) { 1588 if (Object.defineProperty) 1589 Object.defineProperty(object, name, { 1590 configurable: false === dpSupport ? true : !!configurable, 1591 get: fn 1592 }); 1593 1594 else object.__defineGetter__(name, fn); 1595 }; 1596 1597 /** Ensure the browser allows Object.defineProperty to be used on native JavaScript objects. */ 1598 try { 1599 defineGetter({}, "support"); 1600 } 1601 catch (e) { 1602 dpSupport = false; 1603 } 1604 1605 1606 var _DOMTokenList = function (el, prop) { 1607 var that = this; 1608 var tokens = []; 1609 var tokenMap = {}; 1610 var length = 0; 1611 var maxLength = 0; 1612 var addIndexGetter = function (i) { 1613 defineGetter(that, i, function () { 1614 preop(); 1615 return tokens[i]; 1616 }, false); 1617 1618 }; 1619 var reindex = function () { 1620 1621 /** Define getter functions for array-like access to the tokenList's contents. */ 1622 if (length >= maxLength) 1623 for (; maxLength < length; ++maxLength) { 1624 addIndexGetter(maxLength); 1625 } 1626 }; 1627 1628 /** Helper function called at the start of each class method. Internal use only. */ 1629 var preop = function () { 1630 var error; 1631 var i; 1632 var args = arguments; 1633 var rSpace = /\s+/; 1634 1635 /** Validate the token/s passed to an instance method, if any. */ 1636 if (args.length) 1637 for (i = 0; i < args.length; ++i) 1638 if (rSpace.test(args[i])) { 1639 error = new SyntaxError('String "' + args[i] + '" ' + "contains" + ' an invali
1639d character'); 1640 error.code = 5; 1641 error.name = "InvalidCharacterError"; 1642 throw error; 1643 } 1644 1645 1646 /** Split the new value apart by whitespace*/ 1647 if (typeof el[prop] === "object") { 1648 tokens = ("" + el[prop].baseVal).replace(/^\s+|\s+$/g, "").split(rSpace); 1649 } else { 1650 tokens = ("" + el[prop]).replace(/^\s+|\s+$/g, "").split(rSpace); 1651 } 1652 1653 /** Avoid treating blank strings as single-item token lists */ 1654 if ("" === tokens[0]) tokens = []; 1655 1656 /** Repopulate the internal token lists */ 1657 tokenMap = {}; 1658 for (i = 0; i < tokens.length; ++i) 1659 tokenMap[tokens[i]] = true; 1660 length = tokens.length; 1661 reindex(); 1662 }; 1663 1664 /** Populate our internal token list if the targeted attribute of the subject element isn't empty. */ 1665 preop(); 1666 1667 /** Return the number of tokens in the underlying string. Read-only. */ 1668 defineGetter(that, "length", function () { 1669 preop(); 1670 return length; 1671 }); 1672 1673 /** Override the default toString/toLocaleString methods to return a space-delimited list of tokens when typecast. */ 1674 that.toLocaleString = 1675 that.toString = function () { 1676 preop(); 1677 return tokens.join(" "); 1678 }; 1679 1680 that.item = function (idx) { 1681 preop(); 1682 return tokens[idx]; 1683 }; 1684 1685 that.contains = function (token) { 1686 preop(); 1687 return !!tokenMap[token]; 1688 }; 1689 1690 that.add = function () { 1691 preop.apply(that, args = arguments); 1692 1693 for (var args, token, i = 0, l = args.length; i < l; ++i) { 1694 token = args[i]; 1695 if (!tokenMap[token]) { 1696 tokens.push(token); 1697 tokenMap[token] = true; 1698 } 1699 } 1700 1701 /** Update the targeted attribute of the attached element if the token list's changed. */ 1702 if (length !== tokens.length) { 1703 length = tokens.length >>> 0; 1704 if (typeof el[prop] === "object") { 1705 el[prop].baseVal = tokens.join(" "); 1706 } else { 1707 el[prop] = tokens.join(" "); 1708 } 1709 reindex(); 1710 } 1711 }; 1712 1713 that.remove = function () { 1714 preop.apply(that, args = arguments); 1715 1716 /** Build a hash of token names to compare against when recollecting our token list. */ 1717 for (var args, ignore = {}, i = 0, t = []; i < args.length; ++i) { 1718 ignore[args[i]] = true; 1719 delete tokenMap[args[i]]; 1720 } 1721 1722 /** Run through our tokens list and reassign only those that aren't defined in the hash declared above. */ 1723 for (i = 0; i < tokens.length; ++i) 1724 if (!ignore[tokens[i]]) t.push(tokens[i]); 1725 1726 tokens = t; 1727 length = t.length >>> 0; 1728 1729 /** Update the targeted attribute of the attached element. */ 1730 if (typeof el[prop] === "object") { 1731 el[prop].baseVal = tokens.join(" "); 1732 } else { 1733 el[prop] = tokens.join(" "); 1734 } 1735 reindex(); 1736 }; 1737 1738 that.toggle = function (token, force) { 1739 preop.apply(that, [token]); 1740 1741 /** Token state's being forced. */ 1742 if (undefined !== force) { 1743 if (force) { 1744 that.add(token); 1745 return true; 1746 } else { 1747 that.remove(token); 1748 return false;
1749 } 1750 } 1751 1752 /** Token already exists in tokenList. Remove it, and return FALSE. */ 1753 if (tokenMap[token]) { 1754 that.remove(token); 1755 return false; 1756 } 1757 1758 /** Otherwise, add the token and return TRUE. */ 1759 that.add(token); 1760 return true; 1761 }; 1762 1763 return that; 1764 }; 1765 1766 return _DOMTokenList; 1767 }()); 1768 if (!('DOMTokenList' in this && (function (x) { 1769 return 'classList' in x ? !x.classList.toggle('x', false) && !x.className : true; 1770 })(document.createElement('x')))) { 1771 1772 // DOMTokenList 1773 (function (global) { 1774 var nativeImpl = "DOMTokenList" in global && global.DOMTokenList; 1775 1776 if ( 1777 !nativeImpl || 1778 ( 1779 !!document.createElementNS && 1780 !!document.createElementNS('http://www.w3.org/2000/svg', 'svg') && 1781 !(document.createElementNS("http://www.w3.org/2000/svg", "svg").classList instanceof DOMTokenList) 1782 ) 1783 ) { 1784 global.DOMTokenList = _DOMTokenList; 1785 } 1786 1787 // Add second argument to native DOMTokenList.toggle() if necessary 1788 (function () { 1789 var e = document.createElement('span'); 1790 if (!('classList' in e)) return; 1791 e.classList.toggle('x', false); 1792 if (!e.classList.contains('x')) return; 1793 e.classList.constructor.prototype.toggle = function toggle(token /*, force*/) { 1794 var force = arguments[1]; 1795 if (force === undefined) { 1796 var add = !this.contains(token); 1797 this[add ? 'add' : 'remove'](token); 1798 return add; 1799 } 1800 force = !!force; 1801 this[force ? 'add' : 'remove'](token); 1802 return force; 1803 }; 1804 }()); 1805 1806 // Add multiple arguments to native DOMTokenList.add() if necessary 1807 (function () { 1808 var e = document.createElement('span'); 1809 if (!('classList' in e)) return; 1810 e.classList.add('a', 'b'); 1811 if (e.classList.contains('b')) return; 1812 var native = e.classList.constructor.prototype.add; 1813 e.classList.constructor.prototype.add = function () { 1814 var args = arguments; 1815 var l = arguments.length; 1816 for (var i = 0; i < l; i++) { 1817 native.call(this, args[i]); 1818 } 1819 }; 1820 }()); 1821 1822 // Add multiple arguments to native DOMTokenList.remove() if necessary 1823 (function () { 1824 var e = document.createElement('span'); 1825 if (!('classList' in e)) return; 1826 e.classList.add('a'); 1827 e.classList.add('b'); 1828 e.classList.remove('a', 'b'); 1829 if (!e.classList.contains('b')) return; 1830 var native = e.classList.constructor.prototype.remove; 1831 e.classList.constructor.prototype.remove = function () { 1832 var args = arguments; 1833 var l = arguments.length; 1834 for (var i = 0; i < l; i++) { 1835 native.call(this, args[i]); 1836 } 1837 }; 1838 }()); 1839 1840 }(this)); 1841 1842 } 1843 1844 1845 // _mutation 1846 var _mutation = (function () { // eslint-disable-line no-unused-vars 1847 1848 function isNode(object) { 1849 // DOM, Level2 1850 if (typeof Node === 'function') { 1851 return object instanceof Node; 1852 } 1853 // Older browsers, check if it looks like a Node instance) 1854 return object && 1855 typeof object === "object" && 1856 object.nodeName && 1857 object.nodeType >= 1 && 1858 object.nodeType <= 12; 1859 } 1860 1861 // http://dom.spec.whatwg.org/#mutation-method-macro 1862 return function mutation(nodes) { 1863 if (nodes.length === 1) { 1864 return isNode(nodes[0]) ? nodes[0] : document.createTextNode(nodes[0] + ''); 1865 } 1866 1867 var fragment = document.createDocumentFragment(); 1868 for (var i = 0; i < nodes.length; i++) { 1869 fragment.appendChild(isNode(nodes[i]) ? nodes[i] : document.createTextNode(nodes[i] + '')); 1870 1871 } 1872 return fragment; 1873 }; 1874 }()); 1875 if (!('DocumentFragment' in this && 'append' in DocumentFragment.prototype)) { 1876 1877 // DocumentFragment.prototype.append 1878 DocumentFragment.prototype.append = function append() { 1879 this.appendChild(_mutation(arguments)); 1880 }; 1881 1882 } 1883 1884 if (!('DocumentFragment' in this && 'prepend' in DocumentFragment.prototype)) { 1885 1886 // DocumentFragment.prototype.prepend 1887 DocumentFragment.prototype.prepend = function prepend() { 1888 this.insertBefore(_mutation(arguments), this.firstChild); 1889 }; 1890 1891 } 1892 1893 if (!('Element' in this && 'after' in Element.prototype)) { 1894 1895 // Element.prototype.after 1896 Document.prototype.after = Element.prototype.after = function after() { 1897 if (this.parentNode) { 1898 var args = Array.prototype.slice.call(arguments), 1899 viableNextSibling = this.nextSibling, 1900 idx = viableNextSibling ? args.indexOf(viableNextSibling) : -1; 1901 1902 while (idx !== -1) { 1903 viableNextSibling = viableNextSibling.nextSibling; 1904 if (!viableNextSibling) { 1905 break; 1906 } 1907 idx = args.indexOf(viableNextSibling); 1908 } 1909 1910 this.parentNode.insertBefore(_mutation(arguments), viableNextSibling); 1911 } 1912 }; 1913 1914 // Not all UAs support the Text constructor. Polyfill on the Text constructor only where it exists 1915 // TODO: Add a polyfill for the Text constructor, and make it a dependency of this polyfill. 1916 if ("Text" in this) { 1917 Text.prototype.after = Element.prototype.after; 1918 } 1919 1920 } 1921 1922 if (!('Element' in this && 'append' in Element.prototype)) { 1923 1924 // Element.prototype.append 1925 Document.prototype.append = Element.prototype.append = function append() { 1926 this.appendChild(_mutation(arguments)); 1927 }; 1928 1929 } 1930 1931 if (!('Element' in this && 'before' in Element.prototype)) { 1932 1933 // Element.prototype.before 1934 Document.prototype.before = Element.prototype.before = function before() { 1935 if (this.parentNode) { 1936 var args = Array.prototype.slice.call(arguments), 1937 viablePreviousSibling = this.previousSibling, 1938 idx = viablePreviousSibling ? args.indexOf(viablePreviousSibling) : -1; 1939 1940 while (idx !== -1) { 1941 viablePreviousSibling = viablePreviousSibling.previousSibling; 1942 if (!viablePreviousSibling) { 1943 break; 1944 } 1945 idx = args.indexOf(viablePreviousSibling); 1946 } 1947 1948 this.parentNode.insertBefore( 1949 _mutation(arguments), 1950 viablePreviousSibling ? viablePreviousSibling.nextSibling : this.parentNode.firstChild 1951 ); 1952 } 1953 }; 1954 1955 // Not all UAs support the Text constructor. Polyfill on the Text constructor only where it exists 1956 // TODO: Add a polyfill for the Text constructor, and make it a dependency of this polyfill. 1957 if ("Text" in this) { 1958 Text.prototype.before = Element.prototype.before; 1959 } 1960 1961 } 1962 1963 if (!('document' in this && "classList" in document.documentElement && 'Element' in this && 'classList' in Element.prototype && (function () { 1964 var e = document.createElement('span'); 1965 e.classList.add('a', 'b'); 1966 return e.classList.contains('b'); 1967 }()))) { 1968 1969 // Element.prototype.classList 1970 /* 1971 Copyright (c) 2016, John Gardner 1972 1973 Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 1974 1975 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 1976 */ 1977 (function (global) { 1978 var dpSupport = true; 1979 var defineGetter = function (object, name, fn, configurable) { 1980 if (Object.defineProperty) 1981 Object.defineProperty(object, name, { 1982 configurable: false === dpSupport ? true : !!configurable, 1983 get: fn 1984 }); 1985 1986 else object.__defineGetter__(name, fn); 1987 }; 1988 /** Ensure the browser allows Object.defineProperty to be used on native JavaScript objects. */ 1989 try { 1990 defineGetter({}, "support"); 1991 } 1992 catch (e) { 1993 dpSupport = false;
1994 } 1995 /** Polyfills a property with a DOMTokenList */ 1996 var addProp = function (o, name, attr) { 1997 1998 defineGetter(o.prototype, name, function () { 1999 var tokenList; 2000 2001 var THIS = this, 2002 2003 /** Prevent this from firing twice for some reason. What the hell, IE. */ 2004 gibberishProperty = "__defineGetter__" + "DEFINE_PROPERTY" + name; 2005 if(THIS[gibberishProperty]) return tokenList; 2006 THIS[gibberishProperty] = true; 2007 2008 /** 2009 * IE8 can't define properties on native JavaScript objects, so we'll use a dumb hack instead. 2010 * 2011 * What this is doing is creating a dummy element ("reflection") inside a detached phantom node ("mirror") 2012 * that serves as the target of Object.defineProperty instead. While we could simply use the subject HTML 2013 * element instead, this would conflict with element types which use indexed properties (such as forms and 2014 * select lists). 2015 */ 2016 if (false === dpSupport) { 2017 2018 var visage; 2019 var mirror = addProp.mirror || document.createElement("div"); 2020 var reflections = mirror.childNodes; 2021 var l = reflections.length; 2022 2023 for (var i = 0; i < l; ++i) 2024 if (reflections[i]._R === THIS) { 2025 visage = reflections[i]; 2026 break; 2027 } 2028 2029 /** Couldn't find an element's reflection inside the mirror. Materialise one. */ 2030 visage || (visage = mirror.appendChild(document.createElement("div"))); 2031 2032 tokenList = DOMTokenList.call(visage, THIS, attr); 2033 } else tokenList = new DOMTokenList(THIS, attr); 2034 2035 defineGetter(THIS, name, function () { 2036 return tokenList; 2037 }); 2038 delete THIS[gibberishProperty]; 2039 2040 return tokenList; 2041 }, true); 2042 }; 2043 2044 addProp(global.Element, "classList", "className"); 2045 addProp(global.HTMLElement, "classList", "className"); 2046 addProp(global.HTMLLinkElement, "relList", "rel"); 2047 addProp(global.HTMLAnchorElement, "relList", "rel"); 2048 addProp(global.HTMLAreaElement, "relList", "rel"); 2049 }(this)); 2050 2051 } 2052 2053 if (!('document' in this && "matches" in document.documentElement)) { 2054 2055 // Element.prototype.matches 2056 Element.prototype.matches = Element.prototype.webkitMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.mozMatchesSelector || function matches(selector) { 2057 2058 var element = this; 2059 var elements = (element.document || element.ownerDocument).querySelectorAll(selector); 2060 var index = 0; 2061 2062 while (elements[index] && elements[index] !== element) { 2063 ++index; 2064 } 2065 2066 return !!elements[index]; 2067 }; 2068 2069 } 2070 2071 if (!('document' in this && "closest" in document.documentElement)) { 2072 2073 // Element.prototype.closest 2074 Element.prototype.closest = function closest(selector) { 2075 var node = this; 2076 2077 while (node) { 2078 if (node.matches(selector)) return node; 2079 else node = 'SVGElement' in window && node instanceof SVGElement ? node.parentNode : node.parentElement; 2080 } 2081 2082 return null; 2083 }; 2084 2085 } 2086 2087 if (!('Element' in this && 'prepend' in Element.prototype)) { 2088 2089 // Element.prototype.prepend 2090 Document.prototype.prepend = Element.prototype.prepend = function prepend() { 2091 this.insertBefore(_mutation(arguments), this.firstChild); 2092 }; 2093 2094 } 2095 2096 if (!('Element' in this && 'remove' in Element.prototype)) { 2097 2098 // Element.prototype.remove 2099 Document.prototype.remove = Element.prototype.remove = function remove() { 2100 if (this.parentNode) { 2101 this.parentNode.removeChild(this); 2102 } 2103 }; 2104 2105 // Not all UAs support the Text constructor. Polyfill on the Text constructor only where it exists 2106 // TODO: Add a polyfill for the Text constructor, and make it a dependency of this polyfill. 2107 if ("Text" in this) { 2108 Text.prototype.remove = Element.prototype.remove; 2109 } 2110 2111 } 2112 2113 if (!('Element' in this && 'replaceWith' in Element.prototype)) { 2114 2115 // Element.prototype.replaceWith 2116 Document.prototype.replaceWith = Element.prototype.replaceWith = function replaceWith() { 2117 if (this.parentNode) { 2118 this.parentNode.replaceChild(_mutation(arguments), this); 2119 } 2120 }; 2121 2122 // Not all UAs support the Text constructor. Polyfill on the Text constructor only where it exists 2123 // TODO: Add a polyfill for the Text constructor, and make it a dependency of this polyfill. 2124 if ('Text' in this) { 2125 Text.prototype.replaceWith = Element.prototype.replaceWith; 2126 } 2127 2128 } 2129 2130 if (!('Symbol' in this && 'species' in this.Symbol)) { 2131 2132 // Symbol.species 2133 Object.defineProperty(Symbol, 'species', {value: Symbol('species')}
2133); 2134 2135 } 2136 2137 if (!('Map' in this && (function() { 2138 try { 2139 return (new Map([[1,1], [2,2]])).size === 2; 2140 } catch (e) { 2141 return false; 2142 } 2143 }()))) { 2144 2145 // Map 2146 (function (global) { 2147 // 7.2.11. SameValueZero ( x, y ) 2148 var sameValueZero = function (x, y) { 2149 // 1. If Type(x) is different from Type(y), return false. 2150 if (typeof x !== typeof y) { 2151 return false; 2152 } 2153 // 2. If Type(x) is Number, then 2154 if (typeof x === 'number') { 2155 // a. If x is NaN and y is NaN, return true. 2156 if (isNaN(x) && isNaN(y)) { 2157 return true; 2158 } 2159 // b. If x is +0 and y is -0, return true. 2160 if (x === +0 && y === -0) { 2161 return true; 2162 } 2163 // c. If x is -0 and y is +0, return true. 2164 if (x === -0 && y === +0) { 2165 return true; 2166 } 2167 // d. If x is the same Number value as y, return true. 2168 if (x === y) { 2169 return true; 2170 } 2171 // e. Return false. 2172 return false; 2173 } 2174 // 3. Return SameValueNonNumber(x, y). 2175 return x === y; 2176 }; 2177 2178 // 7.3.9. GetMethod ( V, P ) 2179 function getMethod(V, P) { 2180 // 1. Assert: IsPropertyKey(P) is true. 2181 // 2. Let func be ? GetV(V, P). 2182 var func = V[P]; 2183 // 3. If func is either undefined or null, return undefined. 2184 if (func === null || func === undefined) { 2185 return undefined; 2186 } 2187 // 4. If IsCallable(func) is false, throw a TypeError exception. 2188 if (typeof func !== 'function') { 2189 throw new TypeError('Method not callable: ' + P); 2190 } 2191 // 5. Return func. 2192 return func; 2193 } 2194 2195 // 7.4.1. GetIterator ( obj [ , method ] ) 2196 // The abstract operation GetIterator with argument obj and optional argument method performs the following steps: 2197 function getIterator(obj /*, method */) { 2198 // 1. If method is not present, then 2199 if (!(1 in arguments)) { 2200 // a. Set method to ? GetMethod(obj, @@iterator). 2201 var method = getMethod(obj, Symbol.iterator); 2202 } 2203 // 2. Let iterator be ? Call(method, obj). 2204 var iterator = method.call(obj); 2205 // 3. If Type(iterator) is not Object, throw a TypeError exception. 2206 if (typeof iterator !== 'object') { 2207 throw new TypeError('bad iterator'); 2208 } 2209 // 4. Let nextMethod be ? GetV(iterator, "next"). 2210 var nextMethod = iterator.next; 2211 // 5. Let iteratorRecord be Record {[[Iterator]]: iterator, [[NextMethod]]: nextMethod, [[Done]]: false}. 2212 var iteratorRecord = Object.create(null); 2213 iteratorRecord['[[Iterator]]'] = iterator; 2214 iteratorRecord['[[NextMethod]]'] = nextMethod; 2215 iteratorRecord['[[Done]]'] = false; 2216 // 6. Return iteratorRecord. 2217 return iteratorRecord; 2218 } 2219 2220 // 7.4.2. IteratorNext ( iteratorRecord [ , value ] ) 2221 function iteratorNext(iteratorRecord /* [, value] */) { 2222 // 1. If value is not present, then 2223 if (!(1 in arguments)) { 2224 // a. Let result be ? Call(iteratorRecord.[[NextMethod]], iteratorRecord.[[Iterator]], « »). 2225 var result = iteratorRecord['[[NextMethod]]'].call(iteratorRecord['[[Iterator]]']); 2226 // 2. Else, 2227 } else { 2228 // a. Let result be ? Call(iteratorRecord.[[NextMethod]], iteratorRecord.[[Iterator]], « value »). 2229 var result = iteratorRecord['[[NextMethod]]'].call(iteratorRecord['[[Iterator]]'], arguments[1]); 2230 } 2231 // 3. If Type(result) is not Object, throw a TypeError exception. 2232 if (typeof result !== 'object') { 2233 throw new TypeError('bad iterator'); 2234 } 2235 // 4. Return result. 2236 return result; 2237 } 2238 2239 // 7.4.3 IteratorComplete ( iterResult ) 2240 function iteratorComplete(iterResult) { 2241 // 1. Assert: Type(iterResult) is Object. 2242 if (typeof iterResult !== 'object') { 2243 throw new Error(Object.prototype.toString.call(iterResult) + 'is not an Object.'); 2244 } 2245 // 2. Return ToBoolean(? Get(iterResult, "done")).
2246 return Boolean(iterResult['done']); 2247 } 2248 2249 // 7.4.4 IteratorValue ( iterResult ) 2250 function iteratorValue(iterResult) { 2251 // Assert: Type(iterResult) is Object. 2252 if (typeof iterResult !== 'object') { 2253 throw new Error(Object.prototype.toString.call(iterResult) + 'is not an Object.'); 2254 } 2255 // Return ? Get(iterResult, "value"). 2256 return iterResult.value; 2257 } 2258 2259 // 7.4.5. IteratorStep ( iteratorRecord ) 2260 function iteratorStep(iteratorRecord) { 2261 // 1. Let result be ? IteratorNext(iteratorRecord). 2262 var result = iteratorNext(iteratorRecord); 2263 // 2. Let done be ? IteratorComplete(result). 2264 var done = iteratorComplete(result); 2265 // 3. If done is true, return false. 2266 if (done === true) { 2267 return false; 2268 } 2269 // 4. Return result. 2270 return result; 2271 } 2272 2273 // 7.4.6. IteratorClose ( iteratorRecord, completion ) 2274 function iteratorClose(iteratorRecord, completion) { 2275 // 1. Assert: Type(iteratorRecord.[[Iterator]]) is Object. 2276 if (typeof iteratorRecord['[[Iterator]]'] !== 'object') { 2277 throw new Error(Object.prototype.toString.call(iteratorRecord['[[Iterator]]']) + 'is not an Object.'); 2278 } 2279 // 2. Assert: completion is a Completion Record. 2280 // Polyfill.io - Ignoring this step as there is no way to check if something is a Completion Record in userland JavaScript. 2281 2282 // 3. Let iterator be iteratorRecord.[[Iterator]]. 2283 var iterator = iteratorRecord['[[Iterator]]']; 2284 // 4. Let return be ? GetMethod(iterator, "return"). 2285 // Polyfill.io - We name it returnMethod because return is a keyword and can not be used as an identifier (E.G. variable name, function name etc). 2286 var returnMethod = getMethod(iterator, "return"); 2287 // 5. If return is undefined, return Completion(completion). 2288 if (returnMethod === undefined) { 2289 return completion; 2290 } 2291 // 6. Let innerResult be Call(return, iterator, « »). 2292 try { 2293 var innerResult = returnMethod.call(iterator); 2294 } catch (error) { 2295 var innerException = error; 2296 } 2297 // 7. If completion.[[Type]] is throw, return Completion(completion). 2298 if (completion) { 2299 return completion; 2300 } 2301 // 8. If innerResult.[[Type]] is throw, return Completion(innerResult). 2302 if (innerException) { 2303 throw innerException; 2304 } 2305 // 9. If Type(innerResult.[[Value]]) is not Object, throw a TypeError exception. 2306 if (!(typeof innerResult !== 'object')) { 2307 throw new TypeError("Iterator's return method returned a non-object."); 2308 } 2309 // 10. Return Completion(completion). 2310 return completion; 2311 } 2312 2313 // 7.4.7. CreateIterResultObject ( value, done ) 2314 function createIterResultObject(value, done) { 2315 // 1. Assert: Type(done) is Boolean. 2316 if (typeof done !== 'boolean') { 2317 throw new Error(); 2318 } 2319 // 2. Let obj be ObjectCreate(%ObjectPrototype%). 2320 var obj = {}; 2321 // 3. Perform CreateDataProperty(obj, "value", value). 2322 obj.value = value; 2323 // 4. Perform CreateDataProperty(obj, "done", done). 2324 obj.done = done; 2325 // 5. Return obj. 2326 return obj; 2327 } 2328 // 9.1.13. OrdinaryCreateFromConstructor ( constructor, intrinsicDefaultProto [ , internalSlotsList ] ) 2329 var ordinaryCreateFromConstructor = function (constructor, intrinsicDefaultProto) { // eslint-disable-line no-unused-vars 2330 var internalSlotsList = arguments[2] || {}; 2331 /* 2332 1. Assert: intrinsicDefaultProto is a String value that is this specification's name of an intrinsic object. 2333 The corresponding object must be an intrinsic that is intended to be used as the[[Prototype]] value of an object. 2334 */ 2335 // Polyfill.io - We ignore the above step and instead pass the intrinsic directly. 2336 2337 // 2. Let proto be ? GetPrototypeFromConstructor(constructor, intrinsicDefaultProto). 2338 // Polyfill.io - We ignore the above step and always use the prototype of the constructor. 2339 var proto = Object.getPrototypeOf(constructor); 2340 2341 // 3. Return ObjectCreate(proto, internalSlotsList). 2342 // Polyfill.io - We do not pass internalSlotsList to Object.create because Object.create does use the default ordinary object definitions specified in 9.1. 2343 var obj = Object.create(proto); 2344 for (var name in internalSlotsList) { 2345 if (Object.prototype.hasOwnProperty.call(internalSlotsList, name)) { 2346 Object.defineProperty(obj, name, { 2347 configurable: true, 2348 enumerable: false, 2349 writable: true, 2350 value: internalSlotsList[name] 2351 }); 2352 } 2353 } 2354 return obj; 2355 }; 2356 2357 // Deleted map items mess with iterator pointers, so rather than removing them mark them as deleted. Can't use undefined or null since those both valid keys so use a private symbol. 2358 var undefMarker = Symbol('undef'); 2359 2360 var supportsGetters = (function () { 2361 try { 2362 var a = {}; 2363 Object.defineProperty(a, 't', { 2364 configurable: true, 2365 enumerable: false, 2366 get: function () { 2367 return true; 2368 }, 2369 set: undefined 2370 }); 2371 return !!a.t; 2372 } catch (e) { 2373 return false;
2374 } 2375 }()); 2376 2377 var isCallable = function (fn) { 2378 return typeof fn === 'function'; 2379 }; 2380 2381 // 23.1.1.1 Map ( [ iterable ] ) 2382 var Map = function Map(/* iterable */) { 2383 // 1. If NewTarget is undefined, throw a TypeError exception. 2384 if (!(this instanceof Map)) { 2385 throw new TypeError('Constructor Map requires "new"'); 2386 } 2387 // 2. Let map be ? OrdinaryCreateFromConstructor(NewTarget, "%MapPrototype%", « [[MapData]] »). 2388 var map = ordinaryCreateFromConstructor(this, "%MapPrototype%", { 2389 _keys: [], 2390 _values: [], 2391 _size: 0, 2392 _es6Map: true 2393 }); 2394 2395 // 3. Set map.[[MapData]] to a new empty List. 2396 // Polyfill.io - This step was done as part of step two. 2397 2398 // Some old engines do not support ES5 getters/setters. Since Map only requires these for the size property, we can fall back to setting the size property statically each time the size of the map changes. 2399 if (!supportsGetters) { 2400 Object.defineProperty(map, 'size', { 2401 configurable: true, 2402 enumerable: false, 2403 writable: true, 2404 value: 0 2405 }); 2406 } 2407 2408 // 4. If iterable is not present, let iterable be undefined. 2409 var iterable = arguments[0] || undefined; 2410 2411 // 5. If iterable is either undefined or null, return map. 2412 if (iterable === null || iterable === undefined) { 2413 return map; 2414 } 2415 2416 // 6. Let adder be ? Get(map, "set"). 2417 var adder = map.set; 2418 2419 // 7. If IsCallable(adder) is false, throw a TypeError exception. 2420 if (!isCallable(adder)) { 2421 throw new TypeError("Map.prototype.set is not a function"); 2422 } 2423 2424 // 8. Let iteratorRecord be ? GetIterator(iterable). 2425 try { 2426 var iteratorRecord = getIterator(iterable); 2427 // 9. Repeat, 2428 while (true) { 2429 // a. Let next be ? IteratorStep(iteratorRecord). 2430 var next = iteratorStep(iteratorRecord); 2431 // b. If next is false, return map. 2432 if (next === false) { 2433 return map; 2434 } 2435 // c. Let nextItem be ? IteratorValue(next). 2436 var nextItem = iteratorValue(next); 2437 // d. If Type(nextItem) is not Object, then 2438 if (typeof nextItem !== 'object') { 2439 // i. Let error be Completion{[[Type]]: throw, [[Value]]: a newly created TypeError object, [[Target]]: empty}. 2440 try { 2441 throw new TypeError('Iterator value ' + nextItem + ' is not an entry object'); 2442 } catch (error) { 2443 // ii. Return ? IteratorClose(iteratorRecord, error). 2444 return iteratorClose(iteratorRecord, error); 2445 } 2446 } 2447 try { 2448 // Polyfill.io - The try catch accounts for steps: f, h, and j. 2449 2450 // e. Let k be Get(nextItem, "0"). 2451 var k = nextItem[0];
2452 // f. If k is an abrupt completion, return ? IteratorClose(iteratorRecord, k). 2453 // g. Let v be Get(nextItem, "1"). 2454 var v = nextItem[1]; 2455 // h. If v is an abrupt completion, return ? IteratorClose(iteratorRecord, v). 2456 // i. Let status be Call(adder, map, « k.[[Value]], v.[[Value]] »). 2457 adder.call(map, k, v); 2458 } catch (e) { 2459 // j. If status is an abrupt completion, return ? IteratorClose(iteratorRecord, status). 2460 return iteratorClose(iteratorRecord, e); 2461 } 2462 } 2463 } catch (e) { 2464 // Polyfill.io - For user agents which do not have iteration methods on argument objects or arrays, we can special case those. 2465 if (Array.isArray(iterable) || 2466 Object.prototype.toString.call(iterable) === '[object Arguments]' || 2467 // IE 7 & IE 8 return '[object Object]' for the arguments object, we can detect by checking for the existence of the callee property 2468 (!!iterable.callee)) { 2469 var index; 2470 var length = iterable.length; 2471 for (index = 0; index < length; index++) { 2472 adder.call(map, iterable[index][0], iterable[index][1]); 2473 } 2474 } 2475 } 2476 return map; 2477 }; 2478 2479 // 23.1.2.1. Map.prototype 2480 // The initial value of Map.prototype is the intrinsic object %MapPrototype%. 2481 // This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. 2482 Object.defineProperty(Map, 'prototype', { 2483 configurable: false, 2484 enumerable: false, 2485 writable: false, 2486 value: {} 2487 }); 2488 2489 // 23.1.2.2 get Map [ @@species ] 2490 if (supportsGetters) { 2491 Object.defineProperty(Map, Symbol.species, { 2492 configurable: true, 2493 enumerable: false, 2494 get: function () { 2495 // 1. Return the this value. 2496 return this; 2497 }, 2498 set: undefined 2499 }); 2500 } else { 2501 Object.defineProperty(Map, Symbol.species, { 2502 configurable: true, 2503 enumerable: false, 2504 writable: true, 2505 value: Map 2506 }); 2507 } 2508 2509 // 23.1.3.1 Map.prototype.clear ( ) 2510 Object.defineProperty(Map.prototype, 'clear', { 2511 configurable: true, 2512 enumerable: false, 2513 writable: true, 2514 value: function clear() { 2515 // 1. Let M be the this value. 2516 var M = this; 2517 // 2. If Type(M) is not Object, throw a TypeError exception. 2518 if (typeof M !== 'object') { 2519 throw new TypeError('Method Map.prototype.clear called on incompatible receiver ' + Object.prototype.toString.call(M)); 2520 } 2521 // 3. If M does not have a [[MapData]] internal slot, throw a TypeError exception. 2522 if (M._es6Map !== true) { 2523 throw new TypeError('Method Map.prototype.clear called on incompatible receiver ' + Object.prototype.toString.call(M)); 2524 } 2525 // 4. Let entries be the List that is M.[[MapData]]. 2526 var entries = M._keys; 2527 // 5. For each Record {[[Key]], [[Value]]} p that is an element of entries, do 2528 for (var i = 0; i < entries.length; i++) { 2529 // 5.a. Set p.[[Key]] to empty. 2530 M._keys[i] = undefMarker; 2531 // 5.b. Set p.[[Value]] to empty. 2532 M._values[i] = undefMarker; 2533 } 2534 this._size = 0; 2535 if (!supportsGetters) { 2536 this.size = this._size; 2537 } 2538 // 6. Return undefined. 2539 return undefined; 2540 } 2541 }); 2542 2543 // 23.1.3.2. Map.prototype.constructor 2544 Object.defineProperty(Map.prototype, 'constructor', { 2545 configurable: true, 2546 enumerable: false, 2547 writable: true, 2548 value: Map 2549 }); 2550 2551 // 23.1.3.3. Map.prototype.delete ( key ) 2552 Object.defineProperty(Map.prototype, 'delete', { 2553 configurable: true, 2554 enumerable: false, 2555 writable: true, 2556 value: function (key) { 2557 // 1. Let M be the this value. 2558 var M = this; 2559 // 2. If Type(M) is not Object, throw a TypeError exception. 2560 if (typeof M !== 'object') { 2561 throw new TypeError('Method Map.prototype.clear called on incompatible receiver ' + Object.prototype.toString.call(M)); 2562 } 2563 // 3. If M does not have a [[MapData]] internal slot, throw a TypeError exception. 2564 if (M._es6Map !== true) { 2565 throw new TypeError('Method Map.prototype.clear called on incompatible receiver ' + Object.prototype.toString.call(M)); 2566 } 2567 // 4. Let entries be the List that is M.[[MapData]]. 2568 var entries = M._keys; 2569 // 5. For each Record {[[Key]], [[Value]]} p that is an element of entries, do 2570 for (var i = 0; i < entries.length; i++) { 2571 // a. If p.[[Key]] is not empty and SameValueZero(p.[[Key]], key) is true, then 2572 if (M._keys[i] !== undefMarker && sameValueZero(M._keys[i], key)) { 2573 // i. Set p.[[Key]] to empty. 2574 this._keys[i] = undefMarker; 2575 // ii. Set p.[[Value]] to empty. 2576 this._values[i] = undefMarker; 2577 --this._size; 2578 if (!supportsGetters) { 2579 this.size = this._size; 2580 } 2581 // iii. Return true. 2582 return true; 2583 } 2584 } 2585 // 6. Return false. 2586 return false;
2587 } 2588 }); 2589 2590 // 23.1.3.4. Map.prototype.entries ( ) 2591 Object.defineProperty(Map.prototype, 'entries', { 2592 configurable: true, 2593 enumerable: false, 2594 writable: true, 2595 value: function entries () { 2596 // 1. Let M be the this value. 2597 var M = this; 2598 // 2. Return ? CreateMapIterator(M, "key+value"). 2599 return createMapIterator(M, 'key+value'); 2600 } 2601 }); 2602 2603 // 23.1.3.5. Map.prototype.forEach ( callbackfn [ , thisArg ] ) 2604 Object.defineProperty(Map.prototype, 'forEach', { 2605 configurable: true, 2606 enumerable: false, 2607 writable: true, 2608 value: function (callbackFn) { 2609 // 1. Let M be the this value. 2610 var M = this; 2611 // 2. If Type(M) is not Object, throw a TypeError exception. 2612 if (typeof M !== 'object') { 2613 throw new TypeError('Method Map.prototype.forEach called on incompatible receiver ' + Object.prototype.toString.call(M)); 2614 } 2615 // 3. If M does not have a [[MapData]] internal slot, throw a TypeError exception. 2616 if (M._es6Map !== true) { 2617 throw new TypeError('Method Map.prototype.forEach called on incompatible receiver ' + Object.prototype.toString.call(M)); 2618 } 2619 // 4. If IsCallable(callbackfn) is false, throw a TypeError exception. 2620 if (!isCallable(callbackFn)) { 2621 throw new TypeError(Object.prototype.toString.call(callbackFn) + ' is not a function.'); 2622 } 2623 // 5. If thisArg is present, let T be thisArg; else let T be undefined. 2624 if (arguments[1]) { 2625 var T = arguments[1]; 2626 } 2627 // 6. Let entries be the List that is M.[[MapData]]. 2628 var entries = M._keys; 2629 // 7. For each Record {[[Key]], [[Value]]} e that is an element of entries, in original key insertion order, do 2630 for (var i = 0; i < entries.length; i++) { 2631 // a. If e.[[Key]] is not empty, then 2632 if (M._keys[i] !== undefMarker && M._values[i] !== undefMarker ) { 2633 // i. Perform ? Call(callbackfn, T, « e.[[Value]], e.[[Key]], M »). 2634 callbackFn.call(T, M._values[i], M._keys[i], M); 2635 } 2636 } 2637 // 8. Return undefined. 2638 return undefined; 2639 } 2640 }); 2641 2642 // 23.1.3.6. Map.prototype.get ( key ) 2643 Object.defineProperty(Map.prototype, 'get', { 2644 configurable: true, 2645 enumerable: false, 2646 writable: true, 2647 value: function get(key) { 2648 // 1. Let M be the this value. 2649 var M = this; 2650 // 2. If Type(M) is not Object, throw a TypeError exception. 2651 if (typeof M !== 'object') { 2652 throw new TypeError('Method Map.prototype.get called on incompatible receiver ' + Object.prototype.toString.call(M)); 2653 } 2654 // 3. If M does not have a [[MapData]] internal slot, throw a TypeError exception. 2655 if (M._es6Map !== true) { 2656 throw new TypeError('Method Map.prototype.get called on incompatible receiver ' + Object.prototype.toString.call(M)); 2657 } 2658 // 4. Let entries be the List that is M.[[MapData]]. 2659 var entries = M._keys; 2660 // 5. For each Record {[[Key]], [[Value]]} p that is an element of entries, do 2661 for (var i = 0; i < entries.length; i++) { 2662 // a. If p.[[Key]] is not empty and SameValueZero(p.[[Key]], key) is true, return p.[[Value]]. 2663 if (M._keys[i] !== undefMarker && sameValueZero(M._keys[i], key)) { 2664 return M._values[i]; 2665 } 2666 } 2667 // 6. Return undefined. 2668 return undefined; 2669 } 2670 }); 2671 2672 // 23.1.3.7. Map.prototype.has ( key ) 2673 Object.defineProperty(Map.prototype, 'has', { 2674 configurable: true, 2675 enumerable: false, 2676 writable: true, 2677 value: function has (key) { 2678 // 1. Let M be the this value. 2679 var M = this; 2680 // 2. If Type(M) is not Object, throw a TypeError exception. 2681 if (typeof M !== 'object') { 2682 throw new TypeError('Method Map.prototype.has called on incompatible receiver ' + Object.prototype.toString.call(M)); 2683 } 2684 // 3. If M does not have a [[MapData]] internal slot, throw a TypeError exception. 2685 if (M._es6Map !== true) { 2686 throw new TypeError('Method Map.prototype.has called on incompatible receiver ' + Object.prototype.toString.call(M)); 2687 } 2688 // 4. Let entries be the List that is M.[[MapData]]. 2689 var entries = M._keys; 2690 // 5. For each Record {[[Key]], [[Value]]} p that is an element of entries, do 2691 for (var i = 0; i < entries.length; i++) { 2692 // a. If p.[[Key]] is not empty and SameValueZero(p.[[Key]], key) is true, return true. 2693 if (M._keys[i] !== undefMarker && sameValueZero(M._keys[i], key)) { 2694 return true; 2695 } 2696 } 2697 // 6. Return false. 2698 return false;
2699 } 2700 }); 2701 2702 // 23.1.3.8. Map.prototype.keys ( ) 2703 Object.defineProperty(Map.prototype, 'keys', { 2704 configurable: true, 2705 enumerable: false, 2706 writable: true, 2707 value: function keys () { 2708 // 1. Let M be the this value. 2709 var M = this; 2710 // 2. Return ? CreateMapIterator(M, "key"). 2711 return createMapIterator(M, "key"); 2712 } 2713 }); 2714 2715 // 23.1.3.9. Map.prototype.set ( key, value ) 2716 Object.defineProperty(Map.prototype, 'set', { 2717 configurable: true, 2718 enumerable: false, 2719 writable: true, 2720 value: function set(key, value) { 2721 // 1. Let M be the this value. 2722 var M = this; 2723 // 2. If Type(M) is not Object, throw a TypeError exception. 2724 if (typeof M !== 'object') { 2725 throw new TypeError('Method Map.prototype.set called on incompatible receiver ' + Object.prototype.toString.call(M)); 2726 } 2727 // 3. If M does not have a [[MapData]] internal slot, throw a TypeError exception. 2728 if (M._es6Map !== true) { 2729 throw new TypeError('Method Map.prototype.set called on incompatible receiver ' + Object.prototype.toString.call(M)); 2730 } 2731 // 4. Let entries be the List that is M.[[MapData]]. 2732 var entries = M._keys; 2733 // 5. For each Record {[[Key]], [[Value]]} p that is an element of entries, do 2734 for (var i = 0; i < entries.length; i++) { 2735 // a. If p.[[Key]] is not empty and SameValueZero(p.[[Key]], key) is true, then 2736 if (M._keys[i] !== undefMarker && sameValueZero(M._keys[i], key)) { 2737 // i. Set p.[[Value]] to value. 2738 M._values[i] = value; 2739 // Return M. 2740 return M; 2741 } 2742 } 2743 // 6. If key is -0, let key be +0. 2744 if (key === -0) { 2745 key = 0; 2746 } 2747 // 7. Let p be the Record {[[Key]]: key, [[Value]]: value}. 2748 var p = {}; 2749 p['[[Key]]'] = key; 2750 p['[[Value]]'] = value; 2751 // 8. Append p as the last element of entries. 2752 M._keys.push(p['[[Key]]']); 2753 M._values.push(p['[[Value]]']); 2754 ++M._size; 2755 if (!supportsGetters) { 2756 M.size = M._size; 2757 } 2758 // 9. Return M. 2759 return M; 2760 } 2761 }); 2762 2763 // 23.1.3.10. get Map.prototype.size 2764 if (supportsGetters) { 2765 Object.defineProperty(Map.prototype, 'size', { 2766 configurable: true, 2767 enumerable: false, 2768 get: function () { 2769 // 1. Let M be the this value. 2770 var M = this; 2771 // 2. If Type(M) is not Object, throw a TypeError exception. 2772 if (typeof M !== 'object') { 2773 throw new TypeError('Method Map.prototype.size called on incompatible receiver ' + Object.prototype.toString.call(M)); 2774 } 2775 // 3. If M does not have a [[MapData]] internal slot, throw a TypeError exception. 2776 if (M._es6Map !== true) { 2777 throw new TypeError('Method Map.prototype.size called on incompatible receiver ' + Object.prototype.toString.call(M)); 2778 } 2779 // 4. Let entries be the List that is M.[[MapData]]. 2780 var entries = M._keys; 2781 // 5. Let count be 0. 2782 var count = 0; 2783 // 6. For each Record {[[Key]], [[Value]]} p that is an element of entries, do 2784 for (var i = 0; i < entries.length; i++) { 2785 // a. If p.[[Key]] is not empty, set count to count+1. 2786 if (M._keys[i] !== undefMarker) { 2787 count = count + 1; 2788 } 2789 } 2790 // 7. Return count. 2791 return count; 2792 }, 2793 set: undefined 2794 }); 2795 } 2796 2797 // 23.1.3.11. Map.prototype.values ( ) 2798 Object.defineProperty(Map.prototype, 'values', { 2799 configurable: true, 2800 enumerable: false, 2801 writable: true, 2802 value: function values () { 2803 // 1. Let M be the this value. 2804 var M = this; 2805 // 2. Return ? CreateMapIterator(M, "value"). 2806 return createMapIterator(M, 'value'); 2807 } 2808 }); 2809 2810 // 23.1.3.12. Map.prototype [ @@iterator ] ( ) 2811 // The initial value of the @@iterator property is the same function object as the initial value of the entries property. 2812 Object.defineProperty(Map.prototype, Symbol.iterator, { 2813 configurable: true, 2814 enumerable: false, 2815 writable: true, 2816 value: Map.prototype.entries 2817 }); 2818 2819 // 23.1.3.13. Map.prototype [ @@toStringTag ] 2820 // The initial value of the @@toStringTag property is the String value "Map". 2821 // This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. 2822 2823 // Polyfill.io - Safari 8 implements Map.name but as a non-configurable property, which means it would throw an error if we try and configure it here. 2824 if (!('name' in Map)) { 2825 // 19.2.4.2 name 2826 Object.defineProperty(Map, 'name', { 2827 configurable: true, 2828 enumerable: false, 2829 writable: false, 2830 value: 'Map' 2831 }); 2832 } 2833 2834 // 23.1.5.1. CreateMapIterator ( map, kind )
2835 function createMapIterator(map, kind) { 2836 // 1. If Type(map) is not Object, throw a TypeError exception. 2837 if (typeof map !== 'object') { 2838 throw new TypeError('createMapIterator called on incompatible receiver ' + Object.prototype.toString.call(map)); 2839 } 2840 // 2. If map does not have a [[MapData]] internal slot, throw a TypeError exception. 2841 if (map._es6Map !== true) { 2842 throw new TypeError('createMapIterator called on incompatible receiver ' + Object.prototype.toString.call(map)); 2843 } 2844 // 3. Let iterator be ObjectCreate(%MapIteratorPrototype%, « [[Map]], [[MapNextIndex]], [[MapIterationKind]] »). 2845 var iterator = Object.create(MapIteratorPrototype); 2846 // 4. Set iterator.[[Map]] to map. 2847 Object.defineProperty(iterator, '[[Map]]', { 2848 configurable: true, 2849 enumerable: false, 2850 writable: true, 2851 value: map 2852 }); 2853 // 5. Set iterator.[[MapNextIndex]] to 0. 2854 Object.defineProperty(iterator, '[[MapNextIndex]]', { 2855 configurable: true, 2856 enumerable: false, 2857 writable: true, 2858 value: 0 2859 }); 2860 // 6. Set iterator.[[MapIterationKind]] to kind. 2861 Object.defineProperty(iterator, '[[MapIterationKind]]', { 2862 configurable: true, 2863 enumerable: false, 2864 writable: true, 2865 value: kind 2866 }); 2867 // 7. Return iterator. 2868 return iterator; 2869 } 2870 2871 // 23.1.5.2. The %MapIteratorPrototype% Object 2872 var MapIteratorPrototype = { 2873 // Polyfill.io - We use this as a quick way to check if an object is a Map Iterator instance. 2874 isMapIterator: true, 2875 // 23.1.5.2.1. %MapIteratorPrototype%.next ( ) 2876 next: function next () { 2877 // 1. Let O be the this value. 2878 var O = this; 2879 // 2. If Type(O) is not Object, throw a TypeError exception. 2880 if (typeof O !== 'object') { 2881 throw new TypeError('Method %MapIteratorPrototype%.next called on incompatible receiver ' + Object.prototype.toString.call(O)); 2882 } 2883 // 3. If O does not have all of the internal slots of a Map Iterator Instance (23.1.5.3), throw a TypeError exception. 2884 if (!O.isMapIterator) { 2885 throw new TypeError('Method %MapIteratorPrototype%.next called on incompatible receiver ' + Object.prototype.toString.call(O)); 2886 } 2887 // 4. Let m be O.[[Map]]. 2888 var m = O['[[Map]]']; 2889 // 5. Let index be O.[[MapNextIndex]]. 2890 var index = O['[[MapNextIndex]]']; 2891 // 6. Let itemKind be O.[[MapIterationKind]]. 2892 var itemKind = O['[[MapIterationKind]]']; 2893 // 7. If m is undefined, return CreateIterResultObject(undefined, true). 2894 if (m === undefined) { 2895 return createIterResultObject(undefined, true); 2896 } 2897 // 8. Assert: m has a [[MapData]] internal slot. 2898 if (!m._es6Map) { 2899 throw new Error(); 2900 } 2901 // 9. Let entries be the List that is m.[[MapData]]. 2902 var entries = m._keys; 2903 // 10. Let numEntries be the number of elements of entr
2903ies. 2904 var numEntries = entries.length; 2905 // 11. NOTE: numEntries must be redetermined each time this method is evaluated. 2906 // 12. Repeat, while index is less than numEntries, 2907 while (index < numEntries) { 2908 // a. Let e be the Record {[[Key]], [[Value]]} that is the value of entries[index]. 2909 var e = Object.create(null); 2910 e['[[Key]]'] = m._keys[index]; 2911 e['[[Value]]'] = m._values[index]; 2912 // b. Set index to index+1. 2913 index = index + 1; 2914 // c. Set O.[[MapNextIndex]] to index. 2915 O['[[MapNextIndex]]'] = index; 2916 // d. If e.[[Key]] is not empty, then 2917 if (e['[[Key]]'] !== undefMarker) { 2918 // i. If itemKind is "key", let result be e.[[Key]]. 2919 if (itemKind === 'key') { 2920 var result = e['[[Key]]']; 2921 // ii. Else if itemKind is "value", let result be e.[[Value]]. 2922 } else if (itemKind === 'value') { 2923 var result = e['[[Value]]']; 2924 // iii. Else, 2925 } else { 2926 // 1. Assert: itemKind is "key+value". 2927 if (itemKind !== 'key+value') { 2928 throw new Error(); 2929 } 2930 // 2. Let result be CreateArrayFromList(« e.[[Key]], e.[[Value]] »). 2931 var result = [ 2932 e['[[Key]]'], 2933 e['[[Value]]'] 2934 ]; 2935 } 2936 // iv. Return CreateIterResultObject(result, false). 2937 return createIterResultObject(result, false); 2938 } 2939 } 2940 // 13. Set O.[[Map]] to undefined. 2941 O['[[Map]]'] = undefined; 2942 // 14. Return CreateIterResultObject(undefined, true). 2943 return createIterResultObject(undefined, true); 2944 } 2945 2946 // 23.1.5.2.2 %MapIteratorPrototype% [ @@toStringTag ] 2947 // The initial value of the @@toStringTag property is the String value "Map Iterator". 2948 // This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. 2949 }; 2950 Object.defineProperty(MapIteratorPrototype, Symbol.iterator, { 2951 configurable: true, 2952 enumerable: false, 2953 writable: true, 2954 value: function iterator() { 2955 return this; 2956 } 2957 }); 2958 2959 // Export the object 2960 try { 2961 Object.defineProperty(global, 'Map', { 2962 configurable: true, 2963 enumerable: false, 2964 writable: true, 2965 value: Map 2966 }); 2967 } catch (e) { 2968 // IE8 throws an error here if we set enumerable to false. 2969 // More info on table 2: https://msdn.microsoft.com/en-us/library/dd229916(v=vs.85).aspx 2970 global['Map'] = Map; 2971 } 2972 }(this)); 2973 2974 } 2975 2976 if (!(document.contains)) { 2977 2978 // Node.prototype.contains 2979 (function() { 2980 2981 function contains(node) { 2982 if (!(0 in arguments)) { 2983 throw new TypeError('1 argument is required'); 2984 } 2985 2986 do {
2987 if (this === node) { 2988 return true; 2989 } 2990 } while (node = node && node.parentNode); 2991 2992 return false; 2993 } 2994 2995 // IE 2996 if ('HTMLElement' in this && 'contains' in HTMLElement.prototype) { 2997 try { 2998 delete HTMLElement.prototype.contains; 2999 } catch (e) {} 3000 } 3001 3002 if ('Node' in this) { 3003 Node.prototype.contains = contains; 3004 } else { 3005 document.contains = Element.prototype.contains = contains; 3006 } 3007 3008 }()); 3009 3010 } 3011 3012 if (!('Promise' in this)) { 3013 3014 // Promise 3015 !function(n){function t(e){if(r[e])return r[e].exports;var o=r[e]={exports:{},id:e,loaded:!1};return n[e].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=n,t.c=r,t.p="",t(0)}({0:/*!***********************!*\ 3016 !*** ./src/global.js ***! 3017 \***********************/ 3018 function(n,t,r){(function(n){var t=r(/*! ./yaku */80);try{(n||{}).Promise=t,window.Promise=t}catch(err){}}).call(t,function(){return this}())},80:/*!*********************!*\ 3019 !*** ./src/yaku.js ***! 3020 \*********************/ 3021 function(n,t){(function(t){!function(){"use strict";function r(){return un[B][G]||J}function e(n,t){for(var r in t)n[r]=t[r]}function o(n){return n&&"object"==typeof n}function i(n){return"function"==typeof n}function u(n,t){return n instanceof t}function c(n){return u(n,U)}function f(n,t,r){if(!t(n))throw v(r)}function s(){try{return C.apply(F,arguments)}catch(e){return rn.e=e,rn}}function a(n,t){return C=n,F=t,s}function l(n,t){function r(){for(var r=0;r<o;)t(e[r],e[r+1]),e[r++]=S,e[r++]=S;o=0,e.length>n&&(e.length=n)}var e=O(n),o=0;return function(n,t){e[o++]=n,e[o++]=t,2===o&&un.nextTick(r)}}function h(n,t){var r,e,o,c,f=0;if(!n)throw v(W);var s=n[un[B][D]];if(i(s))e=s.call(n);else{if(!i(n.next)){if(u(n,O)){for(r=n.length;f<r;)t(n[f],f++);return f}throw v(W)}e=n}for(;!(o=e.next()).done;)if(c=a(t)(o.value,f++),c===rn)throw i(e[K])&&e[K](),c.e;return f}function v(n){return new TypeError(n)}function _(n){return(n?"":X)+(new U).stack}function d(n,t){var r="on"+n.toLowerCase(),e=H[r];I&&I.listeners(n).length?n===tn?I.emit(n,t._v,t):I.emit(n,t):e?e({reason:t._v,promise:t}):un[n](t._v,t)}function p(n){return n&&n._s}function w(n){if(p(n))return new n(en);var t,r,e;return t=new n(function(n,o){if(t)throw v();r=n,e=o}),f(r,i),f(e,i),t}function m(n,t){return function(r){A&&(n[Q]=_(!0)),t===q?T(n,r):k(n,t,r)}}function y(n,t,r,e){return i(r)&&(t._onFulfilled=r),i(e)&&(n[M]&&d(nn,n),t._onRejected=e),A&&(t._p=n),n[n._c++]=t,n._s!==z&&cn(n,t),t}
3021function j(n){if(n._umark)return!0;n._umark=!0;for(var t,r=0,e=n._c;r<e;)if(t=n[r++],t._onRejected||j(t))return!0}function x(n,t){function r(n){return e.push(n.replace(/^\s+|\s+$/g,""))}var e=[];return A&&(t[Q]&&r(t[Q]),function o(n){n&&N in n&&(o(n._next),r(n[N]+""),o(n._p))}(t)),(n&&n.stack?n.stack:n)+("\n"+e.join("\n")).replace(on,"")}function g(n,t){return n(t)}function k(n,t,r){var e=0,o=n._c;if(n._s===z)for(n._s=t,n._v=r,t===$&&(A&&c(r)&&(r.longStack=x(r,n)),fn(n));e<o;)cn(n,n[e++]);return n}function T(n,t){if(t===n&&t)return k(n,$,v(Y)),n;if(t!==P&&(i(t)||o(t))){var r=a(b)(t);if(r===rn)return k(n,$,r.e),n;i(r)?(A&&p(t)&&(n._next=t),p(t)?R(n,t,r):un.nextTick(function(){R(n,t,r)})):k(n,q,t)}else k(n,q,t);return n}function b(n){return n.then}function R(n,t,r){var e=a(r,t)(function(r){t&&(t=P,T(n,r))},function(r){t&&(t=P,k(n,$,r))});e===rn&&t&&(k(n,$,e.e),t=P)}var S,C,F,P=null,E="object"==typeof window,H=E?window:t,I=H.process,L=H.console,A=!1,O=Array,U=Error,$=1,q=2,z=3,B="Symbol",D="iterator",G="species",J=B+"("+G+")",K="return",M="_uh",N="_pt",Q="_st",V="Invalid this",W="Invalid argument",X="\nFrom previous ",Y="Chaining cycle detected for promise",Z="Uncaught (in promise)",nn="rejectionHandled",tn="unhandledRejection",rn={e:P},en=function(){},on=/^.+\/node_modules\/yaku\/.+\n?/gm,un=n.exports=function(n){var t,r=this;if(!o(r)||r._s!==S)throw v(V);if(r._s=z,A&&(r[N]=_()),n!==en){if(!i(n))throw v(W);t=a(n)(m(r,q),m(r,$)),t===rn&&k(r,$,t.e)}};un["default"]=un,e(un.prototype,{then:function(n,t){if(void 0===this._s)throw v();return y(this,w(un.speciesConstructor(this,un)),n,t)},"catch":function(n){return this.then(S,n)},"finally":function(n){function t(t){return un.resolve(n()).then(function(){return t})}return this.then(t,t)},_c:0,_p:P}),un.resolve=function(n){return p(n)?n:T(w(this),n)},un.reject=function(n){return k(w(this),$,n)},un.race=function(n){var t=this,r=w(t),e=function(n){k(r,q,n)},o=function(n){k(r,$,n)},i=a(h)(n,function(n){t.resolve(n).then(e,o)});return i===rn?t.reject(i.e):r},un.all=function(n){function t(n){k(o,$,n)}var r,e=this,o=w(e),i=[];return r=a(h)(n,function(n,u){e.resolve(n).then(function(n){i[u]=n,--r||k(o,q,i)},t)}),r===rn?e.reject(r.e):(r||k(o,q,[]),o)},un.Symbol=H[B]||{},a(function(){Object.defineProperty(un,r(),{get:function(){return this}})})(),un.speciesConstructor=function(n,t){var e=n.constructor;return e?e[r()]||t:t},un.unhandledRejection=function(n,t){L&&L.error(Z,A?t.longStack:x(n,t))},un.rejectionHandled=en,un.enableLongStackTrace=function(){A=!0},un.nextTick=E?function(n){setTimeout(n)}:I.nextTick,un._s=1;var cn=l(999,function(n,t){var r,e;return e=n._s!==$?t._onFulfilled:t._onRejected,e===S?void k(t,n._s,n._v):(r=a(g)(e,n._v),r===rn?void k(t,$,r.e):void T(t,r))}),fn=l(9,function(n){j(n)||(n[M]=1,d(tn,n))})}()}).call(t,function(){return this}())}}); 3022 } 3023 3024 if (!('Set' in this && (function() { 3025 return (new Set([1,2])).size === 2; 3026 }()))) { 3027 3028 // Set 3029 (function(global) { 3030 3031 3032 // Deleted map items mess with iterator pointers, so rather than removing them mark them as deleted. Can't use undefined or null since those both valid keys so use a private symbol. 3033 var undefMarker = Symbol('undef'); 3034 3035 // NaN cannot be found in an array using indexOf, so we encode NaNs using a private symbol. 3036 var NaNMarker = Symbol('NaN'); 3037 3038 function encodeVal(data) { 3039 return Number.isNaN(data) ? NaNMarker : data; 3040 } 3041 function decodeVal(encodedData) { 3042 return (encodedData === NaNMarker) ? NaN : encodedData; 3043 } 3044 3045 function makeIterator(setInst, getter) { 3046 var nextIdx = 0; 3047 return { 3048 next: function() { 3049 while (setInst._values[nextIdx] === undefMarker) nextIdx++; 3050 if (nextIdx === setInst._values.length) { 3051 return {value: void 0, done: true}; 3052 } 3053 else { 3054 return {value: getter.call(setInst, nextIdx++), done: false}; 3055 } 3056 } 3057 }; 3058 } 3059 3060 var Set = function Set() { 3061 var data = arguments[0]; 3062 this._values = []; 3063 this.size = this._size = 0; 3064 3065 // If `data` is iterable (indicated by presence of a forEach method), pre-populate the set 3066 data && (typeof data.forEach === 'function') && data.forEach(function (item) { 3067 this.add.call(this, item); 3068 }, this); 3069 }; 3070 3071 // Some old engines do not support ES5 getters/setters. Since Set only requires these for the size property, we can fall back to setting the size property statically each time the size of the set changes. 3072 try { 3073 Object.defineProperty(Set.prototype, 'size', { 3074 get: function() { 3075 return this._size; 3076 } 3077 }); 3078 } catch(e) { 3079 } 3080 3081 Set.prototype['add'] = function(value) { 3082 value = encodeVal(value); 3083 if (this._values.indexOf(value) === -1) { 3084 this._values.push(value); 3085 this.size = ++this._size; 3086 } 3087 return this; 3088 }; 3089 Set.prototype['has'] = function(value) { 3090 return (this._values.indexOf(encodeVal(value)) !== -1); 3091 }; 3092 Set.prototype['delete'] = function(value) { 3093 var idx = this._values.indexOf(encodeVal(value)); 3094 if (idx === -1) return false;
3095 this._values[idx] = undefMarker; 3096 this.size = --this._size; 3097 return true; 3098 }; 3099 Set.prototype['clear'] = function() { 3100 this._values = []; 3101 this.size = this._size = 0; 3102 }; 3103 Set.prototype[Symbol.iterator] = 3104 Set.prototype['values'] = 3105 Set.prototype['keys'] = function() { 3106 var iterator = makeIterator(this, function(i) { return decodeVal(this._values[i]); }); 3107 iterator[Symbol.iterator] = this.keys.bind(this); 3108 return iterator; 3109 }; 3110 Set.prototype['entries'] = function() { 3111 var iterator = makeIterator(this, function(i) { return [decodeVal(this._values[i]), decodeVal(this._values[i])]; }); 3112 iterator[Symbol.iterator] = this.entries.bind(this); 3113 return iterator; 3114 }; 3115 Set.prototype['forEach'] = function(callbackFn, thisArg) { 3116 thisArg = thisArg || global; 3117 var iterator = this.entries(); 3118 var result = iterator.next(); 3119 while (result.done === false) { 3120 callbackFn.call(thisArg, result.value[1], result.value[0], this); 3121 result = iterator.next(); 3122 } 3123 }; 3124 Set.prototype['constructor'] = 3125 Set.prototype[Symbol.species] = Set; 3126 3127 Set.prototype.constructor = Set; 3128 Set.name = "Set"; 3129 3130 // Export the object 3131 global.Set = Set; 3132 3133 }(this)); 3134 3135 } 3136 3137 if (!('endsWith' in String.prototype)) { 3138 3139 // String.prototype.endsWith 3140 String.prototype.endsWith = function (string) { 3141 var index = arguments.length < 2 ? this.length : arguments[1]; 3142 var foundIndex = this.lastIndexOf(string); 3143 return foundIndex !== -1 && foundIndex === index - string.length; 3144 }; 3145 3146 } 3147 3148 if (!('startsWith' in String.prototype)) { 3149 3150 // String.prototype.startsWith 3151 String.prototype.startsWith = function (string) { 3152 var index = arguments.length < 2 ? 0 : arguments[1]; 3153 3154 return this.slice(index).indexOf(string) === 0; 3155 }; 3156 3157 } 3158 3159 if (!((function (global) { 3160 /* 3161 * Browsers may have: 3162 * No global URL object 3163 * URL with static methods only - may have a dummy constructor 3164 * URL with members except searchParams 3165 * Full URL API support 3166 */ 3167 'use strict'; 3168 3169 try { 3170 var nativeURL = new global.URL('http://example.com'); 3171 3172 return 'href' in nativeURL && 'searchParams' in nativeURL; 3173 } 3174 catch (error) { 3175 return false; 3176 } 3177 }(this)))) { 3178 3179 // URL 3180 // URL Polyfill 3181 // Draft specification: https://url.spec.whatwg.org 3182 3183 // Notes: 3184 // - Primarily useful for parsing URLs and modifying query parameters 3185 // - Should work in IE8+ and everything more modern, with es5.js polyfills 3186 3187 (function (global) { 3188 'use strict'; 3189 3190 function isSequence(o) { 3191 if (!o) return false; 3192 if ('Symbol' in global && 'iterator' in global.Symbol && 3193 typeof o[Symbol.iterator] === 'function') return true; 3194 if (Array.isArray(o)) return true; 3195 return false;
vendor: 25,820 bytes, lines 3196-3669
3196 } 3197 3198 function toArray(iter) { 3199 return ('from' in Array) ? Array.from(iter) : Array.prototype.slice.call(iter); 3200 } 3201 3202 (function() { 3203 3204 // Browsers may have: 3205 // * No global URL object 3206 // * URL with static methods only - may have a dummy constructor 3207 // * URL with members except searchParams 3208 // * Full URL API support 3209 var origURL = global.URL; 3210 var nativeURL; 3211 try { 3212 if (origURL) { 3213 nativeURL = new global.URL('http://example.com'); 3214 if ('searchParams' in nativeURL) 3215 return; 3216 if (!('href' in nativeURL)) 3217 nativeURL = undefined; 3218 } 3219 } catch (_) {} 3220 3221 // NOTE: Doesn't do the encoding/decoding dance 3222 function urlencoded_serialize(pairs) { 3223 var output = '', first = true; 3224 pairs.forEach(function (pair) { 3225 var name = encodeURIComponent(pair.name); 3226 var value = encodeURIComponent(pair.value); 3227 if (!first) output += '&'; 3228 output += name + '=' + value; 3229 first = false; 3230 }); 3231 return output.replace(/%20/g, '+'); 3232 } 3233 3234 // NOTE: Doesn't do the encoding/decoding dance 3235 function urlencoded_parse(input, isindex) { 3236 var sequences = input.split('&'); 3237 if (isindex && sequences[0].indexOf('=') === -1) 3238 sequences[0] = '=' + sequences[0]; 3239 var pairs = []; 3240 sequences.forEach(function (bytes) { 3241 if (bytes.length === 0) return; 3242 var index = bytes.indexOf('='); 3243 if (index !== -1) { 3244 var name = bytes.substring(0, index); 3245 var value = bytes.substring(index + 1); 3246 } else { 3247 name = bytes; 3248 value = ''; 3249 } 3250 name = name.replace(/\+/g, ' '); 3251 value = value.replace(/\+/g, ' '); 3252 pairs.push({ name: name, value: value }); 3253 }); 3254 var output = []; 3255 pairs.forEach(function (pair) { 3256 output.push({ 3257 name: decodeURIComponent(pair.name), 3258 value: decodeURIComponent(pair.value) 3259 }); 3260 }); 3261 return output; 3262 } 3263 3264 function URLUtils(url) { 3265 if (nativeURL) 3266 return new origURL(url); 3267 var anchor = document.createElement('a'); 3268 anchor.href = url; 3269 return anchor; 3270 } 3271 3272 function URLSearchParams(init) { 3273 var $this = this; 3274 this._list = []; 3275 3276 if (init === undefined || init === null) { 3277 // no-op 3278 } else if (init instanceof URLSearchParams) { 3279 // In ES6 init would be a sequence, but special case for ES5. 3280 this._list = urlencoded_parse(String(init)); 3281 } else if (typeof init === 'object' && isSequence(init)) { 3282 toArray(init).forEach(function(e) { 3283 if (!isSequence(e)) throw TypeError(); 3284 var nv = toArray(e); 3285 if (nv.length !== 2) throw TypeError(); 3286 $this._list.push({name: String(nv[0]), value: String(nv[1])}); 3287 }); 3288 } else if (typeof init === 'object' && init) { 3289 Object.keys(init).forEach(function(key) { 3290 $this._list.push({name: String(key), value: String(init[key])}); 3291 }); 3292 } else { 3293 init = String(init); 3294 if (init.substring(0, 1) === '?') 3295 init = init.substring(1); 3296 this._list = urlencoded_parse(init); 3297 } 3298 3299 this._url_object = null; 3300 this._setList = function (list) { if (!updating) $this._list = list; }; 3301 3302 var updating = false; 3303 this._update_steps = function() { 3304 if (updating) return; 3305 updating = true; 3306 3307 if (!$this._url_object) return; 3308 3309 // Partial workaround for IE issue with 'about:' 3310 if ($this._url_object.protocol === 'about:' && 3311 $this._url_object.pathname.indexOf('?') !== -1) { 3312 $this._url_object.pathname = $this._url_object.pathname.split('?')[0]; 3313 } 3314 3315 $this._url_object.search = urlencoded_serialize($this._list); 3316 3317 updating = false; 3318 }; 3319 } 3320 3321 3322 Object.defineProperties(URLSearchParams.prototype, { 3323 append: { 3324 value: function (name, value) { 3325 this._list.push({ name: name, value: value }); 3326 this._update_steps(); 3327 }, writable: true, enumerable: true, configurable: true 3328 }, 3329 3330 'delete': { 3331 value: function (name) { 3332 for (var i = 0; i < this._list.length;) { 3333 if (this._list[i].name === name) 3334 this._list.splice(i, 1); 3335 else 3336 ++i; 3337 } 3338 this._update_steps(); 3339 }, writable: true, enumerable: true, configurable: true 3340 }, 3341 3342 get: { 3343 value: function (name) { 3344 for (var i = 0; i < this._list.length; ++i) { 3345 if (this._list[i].name === name) 3346 return this._list[i].value; 3347 } 3348 return null; 3349 }, writable: true, enumerable: true, configurable: true 3350 }, 3351 3352 getAll: { 3353 value: function (name) { 3354 var result = []; 3355 for (var i = 0; i < this._list.length; ++i) { 3356 if (this._list[i].name === name) 3357 result.push(this._list[i].value); 3358 } 3359 return result; 3360 }, writable: true, enumerable: true, configurable: true 3361 }, 3362 3363 has: { 3364 value: function (name) { 3365 for (var i = 0; i < this._list.length; ++i) { 3366 if (this._list[i].name === name) 3367 return true; 3368 } 3369 return false; 3370 }, writable: true, enumerable: true, configurable: true 3371 }, 3372 3373 set: { 3374 value: function (name, value) { 3375 var found = false; 3376 for (var i = 0; i < this._list.length;) { 3377 if (this._list[i].name === name) { 3378 if (!found) { 3379 this._list[i].value = value; 3380 found = true; 3381 ++i; 3382 } else { 3383 this._list.splice(i, 1); 3384 } 3385 } else { 3386 ++i; 3387 } 3388 } 3389 3390 if (!found) 3391 this._list.push({ name: name, value: value }); 3392 3393 this._update_steps(); 3394 }, writable: true, enumerable: true, configurable: true 3395 }, 3396 3397 entries: { 3398 value: function() { return new Iterator(this._list, 'key+value'); }, 3399 writable: true, enumerable: true, configurable: true 3400 }, 3401 3402 keys: { 3403 value: function() { return new Iterator(this._list, 'key'); }, 3404 writable: true, enumerable: true, configurable: true 3405 }, 3406 3407 values: { 3408 value: function() { return new Iterator(this._list, 'value'); }, 3409 writable: true, enumerable: true, configurable: true 3410 }, 3411 3412 forEach: { 3413 value: function(callback) { 3414 var thisArg = (arguments.length > 1) ? arguments[1] : undefined; 3415 this._list.forEach(function(pair, index) { 3416 callback.call(thisArg, pair.value, pair.name); 3417 }); 3418 3419 }, writable: true, enumerable: true, configurable: true 3420 }, 3421 3422 toString: { 3423 value: function () { 3424 return urlencoded_serialize(this._list); 3425 }, writable: true, enumerable: false, configurable: true 3426 } 3427 }); 3428 3429 function Iterator(source, kind) { 3430 var index = 0; 3431 this['next'] = function() { 3432 if (index >= source.length) 3433 return {done: true, value: undefined}; 3434 var pair = source[index++]; 3435 return {done: false, value: 3436 kind === 'key' ? pair.name : 3437 kind === 'value' ? pair.value : 3438 [pair.name, pair.value]}; 3439 }; 3440 } 3441 3442 if ('Symbol' in global && 'iterator' in global.Symbol) { 3443 Object.defineProperty(URLSearchParams.prototype, global.Symbol.iterator, { 3444 value: URLSearchParams.prototype.entries, 3445 writable: true, enumerable: true, configurable: true}); 3446 Object.defineProperty(Iterator.prototype, global.Symbol.iterator, { 3447 value: function() { return this; }, 3448 writable: true, enumerable: true, configurable: true}); 3449 } 3450 3451 function URL(url, base) { 3452 if (!(this instanceof global.URL)) 3453 throw new TypeError("Failed to construct 'URL': Please use the 'new' operator."); 3454 3455 if (base) { 3456 url = (function () { 3457 if (nativeURL) return new origURL(url, base).href; 3458 var iframe; 3459 try { 3460 var doc; 3461 // Use another document/base tag/anchor for relative URL resolution, if possible 3462 if (Object.prototype.toString.call(window.operamini) === "[object OperaMini]") { 3463 iframe = document.createElement('iframe'); 3464 iframe.style.display = 'none'; 3465 document.documentElement.appendChild(iframe); 3466 doc = iframe.contentWindow.document; 3467 } else if (document.implementation && document.implementation.createHTMLDocument) { 3468 doc = document.implementation.createHTMLDocument(''); 3469 } else if (document.implementation && document.implementation.createDocument) { 3470 doc = document.implementation.createDocument('http://www.w3.org/1999/xhtml', 'html', null); 3471 doc.documentElement.appendChild(doc.createElement('head')); 3472 doc.documentElement.appendChild(doc.createElement('body')); 3473 } else if (window.ActiveXObject) { 3474 doc = new window.ActiveXObject('htmlfile'); 3475 doc.write('<head><\/head><body><\/body>'); 3476 doc.close(); 3477 } 3478 3479 if (!doc) throw Error('base not supported'); 3480 3481 var baseTag = doc.createElement('base'); 3482 baseTag.href = base; 3483 doc.getElementsByTagName('head')[0].appendChild(baseTag); 3484 var anchor = doc.createElement('a'); 3485 anchor.href = url; 3486 return anchor.href; 3487 } finally { 3488 if (iframe) 3489 iframe.parentNode.removeChild(iframe); 3490 } 3491 }()); 3492 } 3493 3494 // An inner object implementing URLUtils (either a native URL 3495 // object or an HTMLAnchorElement instance) is used to perform the 3496 // URL algorithms. With full ES5 getter/setter support, return a 3497 // regular object For IE8's limited getter/setter support, a 3498 // different HTMLAnchorElement is returned with properties 3499 // overridden 3500 3501 var instance = URLUtils(url || ''); 3502 3503 // Detect for ES5 getter/setter support 3504 // (an Object.defineProperties polyfill that doesn't support getters/setters may throw) 3505 var ES5_GET_SET = (function() { 3506 if (!('defineProperties' in Object)) return false; 3507 try { 3508 var obj = {}; 3509 Object.defineProperties(obj, { prop: { 'get': function () { return true; } } }); 3510 return obj.prop; 3511 } catch (_) { 3512 return false; 3513 } 3514 })(); 3515 3516 var self = ES5_GET_SET ? this : document.createElement('a'); 3517 3518 3519 3520 var query_object = new URLSearchParams( 3521 instance.search ? instance.search.substring(1) : null); 3522 query_object._url_object = self; 3523 3524 Object.defineProperties(self, { 3525 href: { 3526 get: function () { return instance.href; }, 3527 set: function (v) { instance.href = v; tidy_instance(); update_steps(); }, 3528 enumerable: true, configurable: true 3529 }, 3530 origin: { 3531 get: function () { 3532 if ('origin' in instance) return instance.origin; 3533 return this.protocol + '//' + this.host; 3534 }, 3535 enumerable: true, configurable: true 3536 }, 3537 protocol: { 3538 get: function () { return instance.protocol; }, 3539 set: function (v) { instance.protocol = v; }, 3540 enumerable: true, configurable: true 3541 }, 3542 username: { 3543 get: function () { return instance.username; }, 3544 set: function (v) { instance.username = v; }, 3545 enumerable: true, configurable: true 3546 }, 3547 password: { 3548 get: function () { return instance.password; }, 3549 set: function (v) { instance.password = v; }, 3550 enumerable: true, configurable: true 3551 }, 3552 host: { 3553 get: function () { 3554 // IE returns default port in |host| 3555 var re = {'http:': /:80$/, 'https:': /:443$/, 'ftp:': /:21$/}[instance.protocol]; 3556 return re ? instance.host.replace(re, '') : instance.host; 3557 }, 3558 set: function (v) { instance.host = v; }, 3559 enumerable: true, configurable: true 3560 }, 3561 hostname: { 3562 get: function () { return instance.hostname; }, 3563 set: function (v) { instance.hostname = v; }, 3564 enumerable: true, configurable: true 3565 }, 3566 port: { 3567 get: function () { return instance.port; }, 3568 set: function (v) { instance.port = v; }, 3569 enumerable: true, configurable: true 3570 }, 3571 pathname: { 3572 get: function () { 3573 // IE does not include leading '/' in |pathname| 3574 if (instance.pathname.charAt(0) !== '/') return '/' + instance.pathname; 3575 return instance.pathname; 3576 }, 3577 set: function (v) { instance.pathname = v; }, 3578 enumerable: true, configurable: true 3579 }, 3580 search: { 3581 get: function () { return instance.search; }, 3582 set: function (v) { 3583 if (instance.search === v) return; 3584 instance.search = v; tidy_instance(); update_steps(); 3585 }, 3586 enumerable: true, configurable: true 3587 }, 3588 searchParams: { 3589 get: function () { return query_object; }, 3590 enumerable: true, configurable: true 3591 }, 3592 hash: { 3593 get: function () { return instance.hash; }, 3594 set: function (v) { instance.hash = v; tidy_instance(); }, 3595 enumerable: true, configurable: true 3596 }, 3597 toString: { 3598 value: function() { return instance.toString(); }, 3599 enumerable: false, configurable: true 3600 }, 3601 valueOf: { 3602 value: function() { return instance.valueOf(); }, 3603 enumerable: false, configurable: true 3604 } 3605 }); 3606 3607 function tidy_instance() { 3608 var href = instance.href.replace(/#$|\?$|\?(?=#)/g, ''); 3609 if (instance.href !== href) 3610 instance.href = href; 3611 } 3612 3613 function update_steps() { 3614 query_object._setList(instance.search ? urlencoded_parse(instance.search.substring(1)) : []); 3615 query_object._update_steps(); 3616 }; 3617 3618 return self; 3619 } 3620 3621 if (origURL) { 3622 for (var i in origURL) { 3623 if (origURL.hasOwnProperty(i) && typeof origURL[i] === 'function') 3624 URL[i] = origURL[i]; 3625 } 3626 } 3627 3628 global.URL = URL; 3629 global.URLSearchParams = URLSearchParams; 3630 }()); 3631 3632 // Patch native URLSearchParams constructor to handle sequences/records 3633 // if necessary. 3634 (function() { 3635 if (new global.URLSearchParams([['a', 1]]).get('a') === '1' && 3636 new global.URLSearchParams({a: 1}).get('a') === '1') 3637 return; 3638 var orig = global.URLSearchParams; 3639 global.URLSearchParams = function(init) { 3640 if (init && typeof init === 'object' && isSequence(init)) { 3641 var o = new orig(); 3642 toArray(init).forEach(function(e) { 3643 if (!isSequence(e)) throw TypeError(); 3644 var nv = toArray(e); 3645 if (nv.length !== 2) throw TypeError(); 3646 o.append(nv[0], nv[1]); 3647 }); 3648 return o; 3649 } else if (init && typeof init === 'object') { 3650 o = new orig(); 3651 Object.keys(init).forEach(function(key) { 3652 o.set(key, init[key]); 3653 }); 3654 return o; 3655 } else { 3656 return new orig(init); 3657 } 3658 }; 3659 }()); 3660 3661 }(self)); 3662 3663 } 3664 3665 }) 3666 .call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {}); 3667 } // end if feature 3668 3669})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.