!function(t,e){"object"==typeofexports&&"undefined"!=typeofmodule?e(exports,require("@tensorflow/tfjs-core"),require("@tensorflow/tfjs-converter")):"function"==typeofdefine&&define.amd?define(["exports","@tensorflow/tfjs-core","@tensorflow/tfjs-converter"],e):e(t.bodyPix={},t.tf,t.tf)}(this,function(t,e,n){"use strict";varr=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceofArray&&function(t,e){t.__proto__=e}||function(t,e){for(varnine)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};functiono(t,e){functionn(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,newn)}vari=function(){return(i=Object.assign||function(t){for(vare,n=1,r=arguments.length;n<r;n++)for(varoine=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);returnt}).apply(this,arguments)};functiona(t,e,n,r){returnnew(n||(n=Promise))(function(o,i){functiona(t){try{u(r.next(t))}catch(t){i(t)}}functions(t){try{u(r.throw(t))}catch(t){i(t)}}functionu(t){t.done?o(t.value):newn(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})}functions(t,e){varn,r,o,i,a={label:0,sent:function(){if(1&o[0])throwo[1];returno[1]},trys:[],ops:[]};returni={next:s(0),throw:s(1),return:s(2)},"function"==typeofSymbol&&(i[Symbol.iterator]=function(){returnthis}),i;functions(i){returnfunction(s){returnfunction(i){if(n)thrownewTypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)returno;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case0:case1:o=i;break;case4:returna.label++,{value:i[1],done:!1};case5:a.label++,r=i[1],i=[0];continue;case7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throwi[1];return{value:i[0]?i[1]:void0,done:!0}}([i,s])}}}functionu(t){varn=t.shape[2],r=t.argMax(2).reshape([-1]);returne.oneHot(r,n)}functiond(t,n){returne.tidy(function(){returnt.greater(e.scalar(n)).toInt()})}varf=function(){functiont(t,n){this.model=t,this.outputStride=n;varr=this.model.inputs[0].shape;e.util.assert(-1===r[1]&&-1===r[2],function(){return"Input shape ["+r[1]+", "+r[2]+"] must both be equal to or -1"})}returnt.prototype.predict=function(t){varn=this;returne.tidy(function(){vare=n.preprocessInput(t.toFloat()).expandDims(0),r=n.model.predict(e).map(function(t){returnt.squeeze([0])}),o=n.nameOutputResults(r);return{heatmapScores:o.heatmap.sigmoid(),offsets:o.offsets,displacementFwd:o.displacementFwd,displacementBwd:o.displacementBwd,segmentation:o.segmentation,partHeatmaps:o.partHeatmaps,longOffsets:o.longOffsets,partOffsets:o.partOffsets}})},t.prototype.dispose=function(){this.model.dispose()},t}(),l=function(t){functionn(){returnnull!==t&&t.apply(this,arguments)||this}returno(n,t),n.prototype.preprocessInput=function(t){returne.tidy(function(){returne.div(t,127.5).sub(1)})},n.prototype.nameOutputResults=function(t){return{offsets:t[0],segmentation:t[1],partHeatmaps:t[2],longOffsets:t[3],heatmap:t[4],displacementFwd:t[5],displacementBwd:t[6],partOffsets:t[7]}},n}(f),c=["nose","leftEye","rightEye","leftEar","rightEar","leftShoulder","rightShoulder","leftElbow","rightElbow","leftWrist","rightWrist","leftHip","rightHip","leftKnee","rightKnee","leftAnkle","rightAnkle"],h=c.length,p=c.reduce(function(t,e,n){returnt[e]=n,t},{});[["leftHip","leftShoulder"],["leftElbow","leftShoulder"],["leftElbow","leftWrist"],["leftHip","leftKnee"],["leftKnee","leftAnkle"],["rightHip","rightShoulder"],["rightElbow","rightShoulder"],["rightElbow","rightWrist"],["rightHip","rightKnee"],["rightKnee","rightAnkle"],["leftShoulder","rightShoulder"],["leftHip","rightHip"]].map(function(t){vare=t[0],n=t[1];return[p[e],p[n]]});functionm(t,e,n){v