/** * @license * Copyright 2023 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ !function(e,a){"object"==typeof exports&&"undefined"!=typeof module?a(exports,require("@tensorflow/tfjs-converter"),require("@tensorflow/tfjs-core")):"function"==typeof define&&define.amd?define(["exports","@tensorflow/tfjs-converter","@tensorflow/tfjs-core"],a):a((e=e||self).cocoSsd=e.cocoSsd||{},e.tf,e.tf)}(this,(function(e,a,i){"use strict";function n(e,a,i,n){return new(i||(i=Promise))((function(t,m){function d(e){try{o(n.next(e))}catch(e){m(e)}}function s(e){try{o(n.throw(e))}catch(e){m(e)}}function o(e){var a;e.done?t(e.value):(a=e.value,a instanceof i?a:new i((function(e){e(a)}))).then(d,s)}o((n=n.apply(e,a||[])).next())}))}function t(e,a){var i,n,t,m,d={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return m={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(m[Symbol.iterator]=function(){return this}),m;function s(m){return function(s){return function(m){if(i)throw new TypeError("Generator is already executing.");for(;d;)try{if(i=1,n&&(t=2&m[0]?n.return:m[0]?n.throw||((t=n.return)&&t.call(n),0):n.next)&&!(t=t.call(n,m[1])).done)return t;switch(n=0,t&&(m=[2&m[0],t.value]),m[0]){case 0:case 1:t=m;break;case 4:return d.label++,{value:m[1],done:!1};case 5:d.label++,n=m[1],m=[0];continue;case 7:m=d.ops.pop(),d.trys.pop();continue;default:if(!(t=d.trys,(t=t.length>0&&t[t.length-1])||6!==m[0]&&2!==m[0])){d=0;continue}if(3===m[0]&&(!t||m[1]>t[0]&&m[1]d&&(d=e[m*i+o],s=o);n[m]=d,t[m]=s}return[n,t]},e.prototype.detect=function(e,a,i){return void 0===a&&(a=20),void 0===i&&(i=.5),n(this,void 0,void 0,(function(){return t(this,(function(n){return[2,this.infer(e,a,i)]}))}))},e.prototype.dispose=function(){null!=this.model&&this.model.dispose()},e}();e.ObjectDetection=d,e.load=function(e){return void 0===e&&(e={}),n(this,void 0,void 0,(function(){var a,n,m;return t(this,(function(t){switch(t.label){case 0:if(null==i)throw new Error("Cannot find TensorFlow.js. If you are using a