├── .babelrc ├── .gitignore ├── LICENSE ├── README.md ├── dist └── index.bundle.js ├── package.json ├── src ├── coco_classes.js ├── config.js ├── index.js ├── postprocess.js └── voc_classes.js ├── webpack.config.js └── yarn.lock /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "env" 4 | ], 5 | "plugins": [ 6 | ["transform-runtime", { 7 | "polyfill": false, 8 | "regenerator": true 9 | }] 10 | ] 11 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## System and generated files 2 | .idea 3 | .DS_Store 4 | .sass-cache 5 | 6 | ## Directories 7 | log/ 8 | node_modules/ 9 | bower_components/ 10 | 11 | ## Files 12 | result.xml 13 | npm-debug.log 14 | package-lock.json 15 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2018 Qian Sha 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 14 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 15 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 16 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 17 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 18 | OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE 19 | OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # tfjs-yolo 2 | 3 | [`YOLO`](https://pjreddie.com/darknet/yolo/) object detection with [Tensorflow.js](https://js.tensorflow.org/). Supports YOLO v3 and Tiny YOLO v1, v2, v3. 4 | 5 | ## Demo 6 | 7 | - Detect objects using your webcam: 8 | https://shaqian.github.io/tfjs-yolo-demo/ 9 | ![demo](https://github.com/shaqian/tfjs-yolo-demo/raw/master/demo.gif) 10 | 11 | - Not hotdog PWA: https://shaqian.github.io/Not-Hotdog/ 12 | 13 | ## Install 14 | ``` 15 | npm install tfjs-yolo 16 | ``` 17 | 18 | ## Usage 19 | 20 | ### Import module 21 | 22 | ```javascript 23 | import yolo from 'tfjs-yolo'; 24 | ``` 25 | 26 | ### Initialize and load model 27 | 28 | ```javascript 29 | // Use default models (stored in my GitHub demo repo) 30 | let myYolo = await yolo.v1tiny(); 31 | let myYolo = await yolo.v2tiny(); 32 | let myYolo = await yolo.v3tiny(); 33 | let myYolo = await yolo.v3(); 34 | 35 | // or specify path or handler, see https://js.tensorflow.org/api/0.13.3/#loadModel 36 | let myYolo = await yolo.v3tiny("https://.../model.json"); 37 | 38 | // or use frozen model, see https://js.tensorflow.org/api/0.13.3/#loadFrozenModel 39 | let myYolo = await yolo.v3tiny( 40 | "https://.../weights_manifest.json", 41 | "https://.../tensorflowjs_model.pb" 42 | ); 43 | 44 | ``` 45 | 46 | ### Run model 47 | 48 | Supported input html element: 49 | - img 50 | - canvas 51 | - video 52 | 53 | ```javascript 54 | const boxes = await myYolo.predict(canvas); 55 | 56 | // Optional settings 57 | const boxes = await myYolo.predict( 58 | canvas, 59 | { 60 | maxBoxes: 5, // defaults to 20 61 | scoreThreshold: .2, // defaults to .5 62 | iouThreshold: .5, // defaults to .3 63 | numClasses: 80, // defaults to 80 for yolo v3, tiny yolo v2, v3 and 20 for tiny yolo v1 64 | anchors: [...], // See ./src/config.js for examples 65 | classNames: [...], // defaults to coco classes for yolo v3, tiny yolo v2, v3 and voc classes for tiny yolo v1 66 | inputSize: 416, // defaults to 416 67 | } 68 | ); 69 | ``` 70 | 71 | ### Output box format 72 | 73 | ```javascript 74 | { 75 | top, // Float 76 | left, // Float 77 | bottom, // Float 78 | right, // Float 79 | height, // Float 80 | width, // Float 81 | score, // Float 82 | class // String, e.g. person 83 | } 84 | ``` 85 | 86 | ### Dispose model 87 | 88 | ```javascript 89 | myYolo.dispose(); 90 | ``` 91 | 92 | ## Credits 93 | 94 | - https://github.com/qqwweee/keras-yolo3 95 | - https://github.com/zqingr/tfjs-yolov3 96 | - https://github.com/ModelDepot/tfjs-yolo-tiny 97 | - https://github.com/allanzelener/YAD2K -------------------------------------------------------------------------------- /dist/index.bundle.js: -------------------------------------------------------------------------------- 1 | !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("@tensorflow/tfjs"));else if("function"==typeof define&&define.amd)define(["@tensorflow/tfjs"],e);else{var r="object"==typeof exports?e(require("@tensorflow/tfjs")):e(t["@tensorflow/tfjs"]);for(var n in r)("object"==typeof exports?exports:t)[n]=r[n]}}(window,function(t){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=46)}([function(t,e){var r=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=r)},function(t,e,r){var n=r(32)("wks"),o=r(33),i=r(0).Symbol,u="function"==typeof i;(t.exports=function(t){return n[t]||(n[t]=u&&i[t]||(u?i:o)("Symbol."+t))}).store=n},function(t,e){var r=t.exports={version:"2.6.5"};"number"==typeof __e&&(__e=r)},function(t,e,r){var n=r(9);t.exports=function(t){if(!n(t))throw TypeError(t+" is not an object!");return t}},function(t,e,r){var n=r(8),o=r(19);t.exports=r(10)?function(t,e,r){return n.f(t,e,o(1,r))}:function(t,e,r){return t[e]=r,t}},function(t,e){t.exports={}},function(t,e,r){var n=r(0),o=r(2),i=r(7),u=r(4),a=r(13),c=function(t,e,r){var s,f,l,p=t&c.F,h=t&c.G,d=t&c.S,v=t&c.P,y=t&c.B,m=t&c.W,g=h?o:o[e]||(o[e]={}),x=g.prototype,_=h?n:d?n[e]:(n[e]||{}).prototype;for(s in h&&(r=e),r)(f=!p&&_&&void 0!==_[s])&&a(g,s)||(l=f?_[s]:r[s],g[s]=h&&"function"!=typeof _[s]?r[s]:y&&f?i(l,n):m&&_[s]==l?function(t){var e=function(e,r,n){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,r)}return new t(e,r,n)}return t.apply(this,arguments)};return e.prototype=t.prototype,e}(l):v&&"function"==typeof l?i(Function.call,l):l,v&&((g.virtual||(g.virtual={}))[s]=l,t&c.R&&x&&!x[s]&&u(x,s,l)))};c.F=1,c.G=2,c.S=4,c.P=8,c.B=16,c.W=32,c.U=64,c.R=128,t.exports=c},function(t,e,r){var n=r(12);t.exports=function(t,e,r){if(n(t),void 0===e)return t;switch(r){case 1:return function(r){return t.call(e,r)};case 2:return function(r,n){return t.call(e,r,n)};case 3:return function(r,n,o){return t.call(e,r,n,o)}}return function(){return t.apply(e,arguments)}}},function(t,e,r){var n=r(3),o=r(54),i=r(55),u=Object.defineProperty;e.f=r(10)?Object.defineProperty:function(t,e,r){if(n(t),e=i(e,!0),n(r),o)try{return u(t,e,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(t[e]=r.value),t}},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e,r){t.exports=!r(31)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e,r){"use strict";var n=r(53)(!0);r(30)(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,e=this._t,r=this._i;return r>=e.length?{value:void 0,done:!0}:(t=n(e,r),this._i+=t.length,{value:t,done:!1})})},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e){var r={}.hasOwnProperty;t.exports=function(t,e){return r.call(t,e)}},function(t,e){var r={}.toString;t.exports=function(t){return r.call(t).slice(8,-1)}},function(t,e){var r=Math.ceil,n=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?n:r)(t)}},function(t,e){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},function(t,e){t.exports=!0},function(t,e,r){var n=r(9),o=r(0).document,i=n(o)&&n(o.createElement);t.exports=function(t){return i?o.createElement(t):{}}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,r){var n=r(62),o=r(16);t.exports=function(t){return n(o(t))}},function(t,e,r){var n=r(15),o=Math.min;t.exports=function(t){return t>0?o(n(t),9007199254740991):0}},function(t,e,r){var n=r(32)("keys"),o=r(33);t.exports=function(t){return n[t]||(n[t]=o(t))}},function(t,e,r){var n=r(8).f,o=r(13),i=r(1)("toStringTag");t.exports=function(t,e,r){t&&!o(t=r?t:t.prototype,i)&&n(t,i,{configurable:!0,value:e})}},function(t,e,r){r(66);for(var n=r(0),o=r(4),i=r(5),u=r(1)("toStringTag"),a="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),c=0;cr;)e.push(arguments[r++]);return m[++y]=function(){a("function"==typeof t?t:Function(t),e)},n(y),y},h=function(t){delete m[t]},"process"==r(14)(l)?n=function(t){l.nextTick(u(g,t,1))}:v&&v.now?n=function(t){v.now(u(g,t,1))}:d?(i=(o=new d).port2,o.port1.onmessage=x,n=u(i.postMessage,i,1)):f.addEventListener&&"function"==typeof postMessage&&!f.importScripts?(n=function(t){f.postMessage(t+"","*")},f.addEventListener("message",x,!1)):n="onreadystatechange"in s("script")?function(t){c.appendChild(s("script")).onreadystatechange=function(){c.removeChild(this),g.call(t)}}:function(t){setTimeout(u(g,t,1),0)}),t.exports={set:p,clear:h}},function(t,e){t.exports=function(t){try{return{e:!1,v:t()}}catch(t){return{e:!0,v:t}}}},function(t,e,r){var n=r(3),o=r(9),i=r(27);t.exports=function(t,e){if(n(t),o(e)&&e.constructor===t)return e;var r=i.f(t);return(0,r.resolve)(e),r.promise}},function(t,e,r){var n=r(1)("iterator"),o=!1;try{var i=[7][n]();i.return=function(){o=!0},Array.from(i,function(){throw 2})}catch(t){}t.exports=function(t,e){if(!e&&!o)return!1;var r=!1;try{var i=[7],u=i[n]();u.next=function(){return{done:r=!0}},i[n]=function(){return u},t(i)}catch(t){}return r}},function(e,r){e.exports=t},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.v1_tiny_model="https://raw.githubusercontent.com/shaqian/tfjs-yolo-demo/master/dist/model/v1tiny/model.json",e.v2_tiny_model="https://raw.githubusercontent.com/shaqian/tfjs-yolo-demo/master/dist/model/v2tiny/model.json",e.v3_tiny_model="https://raw.githubusercontent.com/shaqian/tfjs-yolo-demo/master/dist/model/v3tiny/model.json",e.v3_model="https://raw.githubusercontent.com/shaqian/tfjs-yolo-demo/master/dist/model/v3/model.json",e.v1_tiny_anchors=[1.08,1.19,3.42,4.41,6.63,11.38,9.42,5.11,16.62,10.52],e.v2_tiny_anchors=[.57273,.677385,1.87446,2.06253,3.33843,5.47434,7.88282,3.52778,9.77052,9.16828],e.v3_anchors=[10,13,16,30,33,23,30,61,62,45,59,119,116,90,156,198,373,326],e.v3_tiny_anchors=[10,14,23,27,37,58,81,82,135,169,344,319],e.v3_masks={3:[[6,7,8],[3,4,5],[0,1,2]],2:[[3,4,5],[1,2,3]]}},function(t,e,r){t.exports=r(47)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n,o,i,u,a,c,s=b(r(28)),f=b(r(29)),l=(n=(0,f.default)(s.default.mark(function t(e,r){return s.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!r){t.next=6;break}return t.next=3,m.loadGraphModel(r,e);case 3:return t.abrupt("return",t.sent);case 6:return t.next=8,m.loadLayersModel(e);case 8:return t.abrupt("return",t.sent);case 9:case"end":return t.stop()}},t,this)})),function(t,e){return n.apply(this,arguments)}),p=(o=(0,f.default)(s.default.mark(function t(e,r,n,o,i,u,a,c,f,l){var p,h;return s.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return p=m.tidy(function(){var t=document.createElement("canvas");t.width=l,t.height=l,t.getContext("2d").drawImage(n,0,0,l,l);var e=m.browser.fromPixels(t,3);return e=e.expandDims(0).toFloat().div(m.scalar(255)),r.predict(e)}),t.next=3,(0,w.default)(e,p,c,a,f,"HTMLVideoElement"===n.constructor.name?[n.videoHeight,n.videoWidth]:[n.height,n.width],o,i,u);case 3:return h=t.sent,m.dispose(p),t.abrupt("return",h);case 6:case"end":return t.stop()}},t,this)})),function(t,e,r,n,i,u,a,c,s,f){return o.apply(this,arguments)}),h=(i=(0,f.default)(s.default.mark(function t(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:_.v1_tiny_model,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return s.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,l(r,n);case 2:return e=t.sent,t.abrupt("return",{predict:function(){var t=(0,f.default)(s.default.mark(function t(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=n.maxBoxes,i=void 0===o?j:o,u=n.scoreThreshold,a=void 0===u?P:u,c=n.iouThreshold,f=void 0===c?S:c,l=n.numClasses,h=void 0===l?x.default.length:l,d=n.anchors,v=void 0===d?_.v1_tiny_anchors:d,y=n.classNames,m=void 0===y?x.default:y,g=n.inputSize,w=void 0===g?O:g;return s.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,p("v1tiny",e,r,i,a,f,h,v,m,w);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}(),dispose:function(){e.dispose(),e=null}});case 4:case"end":return t.stop()}},t,this)})),function(){return i.apply(this,arguments)}),d=(u=(0,f.default)(s.default.mark(function t(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:_.v2_tiny_model,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return s.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,l(r,n);case 2:return e=t.sent,t.abrupt("return",{predict:function(){var t=(0,f.default)(s.default.mark(function t(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=n.maxBoxes,i=void 0===o?j:o,u=n.scoreThreshold,a=void 0===u?P:u,c=n.iouThreshold,f=void 0===c?S:c,l=n.numClasses,h=void 0===l?g.default.length:l,d=n.anchors,v=void 0===d?_.v2_tiny_anchors:d,y=n.classNames,m=void 0===y?g.default:y,x=n.inputSize,w=void 0===x?O:x;return s.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,p("v2tiny",e,r,i,a,f,h,v,m,w);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}(),dispose:function(){e.dispose(),e=null}});case 4:case"end":return t.stop()}},t,this)})),function(){return u.apply(this,arguments)}),v=(a=(0,f.default)(s.default.mark(function t(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:_.v3_tiny_model,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return s.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,l(r,n);case 2:return e=t.sent,t.abrupt("return",{predict:function(){var t=(0,f.default)(s.default.mark(function t(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=n.maxBoxes,i=void 0===o?j:o,u=n.scoreThreshold,a=void 0===u?P:u,c=n.iouThreshold,f=void 0===c?S:c,l=n.numClasses,h=void 0===l?g.default.length:l,d=n.anchors,v=void 0===d?_.v3_tiny_anchors:d,y=n.classNames,m=void 0===y?g.default:y,x=n.inputSize,w=void 0===x?O:x;return s.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,p("v3tiny",e,r,i,a,f,h,v,m,w);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}(),dispose:function(){e.dispose(),e=null}});case 4:case"end":return t.stop()}},t,this)})),function(){return a.apply(this,arguments)}),y=(c=(0,f.default)(s.default.mark(function t(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:_.v3_model,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return s.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,l(r,n);case 2:return e=t.sent,t.abrupt("return",{predict:function(){var t=(0,f.default)(s.default.mark(function t(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=n.maxBoxes,i=void 0===o?j:o,u=n.scoreThreshold,a=void 0===u?P:u,c=n.iouThreshold,f=void 0===c?S:c,l=n.numClasses,h=void 0===l?g.default.length:l,d=n.anchors,v=void 0===d?_.v3_anchors:d,y=n.classNames,m=void 0===y?g.default:y,x=n.inputSize,w=void 0===x?O:x;return s.default.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,p("v3",e,r,i,a,f,h,v,m,w);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}(),dispose:function(){e.dispose(),e=null}});case 4:case"end":return t.stop()}},t,this)})),function(){return c.apply(this,arguments)}),m=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}(r(44)),g=b(r(79)),x=b(r(80)),_=r(45),w=b(r(81));function b(t){return t&&t.__esModule?t:{default:t}}var j=20,O=416,P=.5,S=.3,k={v1tiny:h,v2tiny:d,v3tiny:v,v3:y};e.default=k},function(t,e,r){var n=function(){return this}()||Function("return this")(),o=n.regeneratorRuntime&&Object.getOwnPropertyNames(n).indexOf("regeneratorRuntime")>=0,i=o&&n.regeneratorRuntime;if(n.regeneratorRuntime=void 0,t.exports=r(49),o)n.regeneratorRuntime=i;else try{delete n.regeneratorRuntime}catch(t){n.regeneratorRuntime=void 0}},function(t,e){!function(e){"use strict";var r,n=Object.prototype,o=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},u=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag",s="object"==typeof t,f=e.regeneratorRuntime;if(f)s&&(t.exports=f);else{(f=e.regeneratorRuntime=s?t.exports:{}).wrap=_;var l="suspendedStart",p="suspendedYield",h="executing",d="completed",v={},y={};y[u]=function(){return this};var m=Object.getPrototypeOf,g=m&&m(m(E([])));g&&g!==n&&o.call(g,u)&&(y=g);var x=O.prototype=b.prototype=Object.create(y);j.prototype=x.constructor=O,O.constructor=j,O[c]=j.displayName="GeneratorFunction",f.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===j||"GeneratorFunction"===(e.displayName||e.name))},f.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,O):(t.__proto__=O,c in t||(t[c]="GeneratorFunction")),t.prototype=Object.create(x),t},f.awrap=function(t){return{__await:t}},P(S.prototype),S.prototype[a]=function(){return this},f.AsyncIterator=S,f.async=function(t,e,r,n){var o=new S(_(t,e,r,n));return f.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},P(x),x[c]="Generator",x[u]=function(){return this},x.toString=function(){return"[object Generator]"},f.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},f.values=E,T.prototype={constructor:T,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(M),!t)for(var e in this)"t"===e.charAt(0)&&o.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=r)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(n,o){return a.type="throw",a.arg=t,e.next=n,o&&(e.method="next",e.arg=r),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var u=this.tryEntries[i],a=u.completion;if("root"===u.tryLoc)return n("end");if(u.tryLoc<=this.prev){var c=o.call(u,"catchLoc"),s=o.call(u,"finallyLoc");if(c&&s){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),M(r),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;M(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:E(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),v}}}function _(t,e,r,n){var o=e&&e.prototype instanceof b?e:b,i=Object.create(o.prototype),u=new T(n||[]);return i._invoke=function(t,e,r){var n=l;return function(o,i){if(n===h)throw new Error("Generator is already running");if(n===d){if("throw"===o)throw i;return A()}for(r.method=o,r.arg=i;;){var u=r.delegate;if(u){var a=k(u,r);if(a){if(a===v)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===l)throw n=d,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=h;var c=w(t,e,r);if("normal"===c.type){if(n=r.done?d:p,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n=d,r.method="throw",r.arg=c.arg)}}}(t,r,u),i}function w(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}function b(){}function j(){}function O(){}function P(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function S(t){var e;this._invoke=function(r,n){function i(){return new Promise(function(e,i){!function e(r,n,i,u){var a=w(t[r],t,n);if("throw"!==a.type){var c=a.arg,s=c.value;return s&&"object"==typeof s&&o.call(s,"__await")?Promise.resolve(s.__await).then(function(t){e("next",t,i,u)},function(t){e("throw",t,i,u)}):Promise.resolve(s).then(function(t){c.value=t,i(c)},u)}u(a.arg)}(r,n,e,i)})}return e=e?e.then(i,i):i()}}function k(t,e){var n=t.iterator[e.method];if(n===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=r,k(t,e),"throw"===e.method))return v;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var o=w(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,v;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,v):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,v)}function L(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function M(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function E(t){if(t){var e=t[u];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n=s?t?"":void 0:(i=a.charCodeAt(c))<55296||i>56319||c+1===s||(u=a.charCodeAt(c+1))<56320||u>57343?t?a.charAt(c):i:t?a.slice(c,c+2):u-56320+(i-55296<<10)+65536}}},function(t,e,r){t.exports=!r(10)&&!r(31)(function(){return 7!=Object.defineProperty(r(18)("div"),"a",{get:function(){return 7}}).a})},function(t,e,r){var n=r(9);t.exports=function(t,e){if(!n(t))return t;var r,o;if(e&&"function"==typeof(r=t.toString)&&!n(o=r.call(t)))return o;if("function"==typeof(r=t.valueOf)&&!n(o=r.call(t)))return o;if(!e&&"function"==typeof(r=t.toString)&&!n(o=r.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,e,r){t.exports=r(4)},function(t,e,r){"use strict";var n=r(58),o=r(19),i=r(23),u={};r(4)(u,r(1)("iterator"),function(){return this}),t.exports=function(t,e,r){t.prototype=n(u,{next:o(1,r)}),i(t,e+" Iterator")}},function(t,e,r){var n=r(3),o=r(59),i=r(34),u=r(22)("IE_PROTO"),a=function(){},c=function(){var t,e=r(18)("iframe"),n=i.length;for(e.style.display="none",r(35).appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write("