tencentcloud-webar 1.0.29-2 → 1.0.29-3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- var self = wx;(self.webpackChunktencentcloud_webar=self.webpackChunktencentcloud_webar||[]).push([[321],{6237:(e,t,n)=>{n.d(t,{g:()=>ue});var i,r=n(9522),o=n(3044),s=n(3650),a=n(1206),c=n(617),h=n(9560),u=n(1347),l=n(1084),p=(i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},i(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),f=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s},d=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},_=function(){function e(e,t,n,i,r){this._destroyed=!1,this.type="makeup",this._parentIntensity=1,this._jsonIntensity=1,this.textures=[],this._dir=t,this._options=e,this._container=n,this.renderer=i,this.type=r||"makeup"}return Object.defineProperty(e.prototype,"parentIntensity",{get:function(){return this._parentIntensity},set:function(e){this.shader&&(this.shader.uniforms.parentIntensity=e);this._parentIntensity=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lipMask",{set:function(e){null===e?(this._mesh.removeChild(this._cacheMask),this._mesh.mask=e):(this._mesh.addChild(e),this._mesh.mask=e,this._cacheMask=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"visible",{set:function(e){this.shader&&(this.shader.uniforms.enable=e?1:0,this.renderer.render(this._mesh,{renderTexture:this._maskRenderTexure}))},enumerable:!1,configurable:!0}),e.prototype.updateGeometry=function(e){this._destroyed||"lips"===this.type&&this.renderer.render(this._mesh,{renderTexture:this._maskRenderTexure})},e.prototype.resize=function(e,t){var n;null===(n=this._maskRenderTexure)||void 0===n||n.resize(e,t)},e.prototype.renderMesh=function(){this.renderer.render(this._mesh,{renderTexture:this._maskRenderTexure})},e.prototype.drawMeshBatch=function(e,t,n){var i=this;if(!this._destroyed){this._blendMode=e;var r=this._getVertexShader(),o="\n precision mediump float;\n varying vec2 vUvs;\n ".concat(t.map((function(e,t){return"uniform sampler2D uSamplerMakeup".concat(t,";")})).join("\n"),"\n ").concat(t.map((function(e,t){return"uniform float intensity".concat(t,";")})).join("\n"),"\n uniform float parentIntensity;\n uniform int enable;\n \n void main() {\n if (enable == 0) {\n gl_FragColor = vec4(1.0,0.0,0.0,0.0);\n return;\n }\n \n vec4 result = vec4(0.0);\n\n ").concat(t.map((function(e,t){return"\n vec4 color".concat(t," = texture2D(uSamplerMakeup").concat(t,", vUvs);\n float a").concat(t," = color").concat(t,".a;\n float realIntensity").concat(t," = intensity").concat(t," * parentIntensity;\n result = result * (1.0 - a").concat(t," * realIntensity").concat(t,") + texture2D(uSamplerMakeup").concat(t,", vUvs) * realIntensity").concat(t,";\n ")})).join("\n"),"\n\n gl_FragColor = result;\n }"),s={enable:1};s.parentIntensity=this.parentIntensity,t.forEach((function(e,t){var n="default"===i._dir?e.src:"".concat(i._dir,"|").concat(e.src),r=a.P6.kN[n];s["uSamplerMakeup".concat(t)]=r,s["intensity".concat(t)]=e.intensity,i.textures.push(r)}));var c=a.ex.from(r,o,s);this.shader=c;var u=new h.Kj(n,c),l=this._options,p=l.width,f=l.height;if(t.some((function(e){return"lips"===e.type}))){var d=new a.jd({width:p,height:f});this._maskRenderTexure=new a.TI(d),this.renderer.render(u,{renderTexture:this._maskRenderTexure});var _=new h.jy(this._maskRenderTexure);_.blendMode_1=e,this._mesh=u,this._container.addChild(_)}else u.blendMode_1=e,this._mesh=u,this._container.addChild(u);return u}},e.prototype.drawMesh=function(e,t,n,i){if(!this._destroyed){this._blendMode=t;var r=this._getVertexShader(),o="default"===this._dir?e:"".concat(this._dir,"|").concat(e),s={enable:1,uSamplerMakeup:a.P6.kN[o],intensity:n,parentIntensity:this.parentIntensity},c=a.ex.from(r,"\n precision mediump float;\n varying vec2 vUvs;\n uniform sampler2D uSamplerMakeup;\n uniform float intensity;\n uniform float parentIntensity;\n uniform int enable;\n\n \n void main() {\n // if (enable == 0) {\n // gl_FragColor = vec4(1.0,0.0,0.0,0.0);\n // return;\n // }\n \n vec4 color = texture2D(uSamplerMakeup, vUvs);\n color = vec4(color.rgb, color.a) * intensity * parentIntensity;\n gl_FragColor = color;\n gl_FragColor.a *= float(enable);\n }",s);this.shader=c;var u=new h.Kj(i,c),l=this._options,p=l.width,f=l.height;if("lips"===this.type){var d=new a.jd({width:p,height:f});this._maskRenderTexure=new a.TI(d),this.renderer.render(u,{renderTexture:this._maskRenderTexure});var _=new h.jy(this._maskRenderTexure);_.blendMode_1=t,this._mesh=u,this._container.addChild(_)}else u.blendMode_1=t,this._mesh=u,this._container.addChild(u);return u}},e.prototype._getVertexShader=function(){return"\n precision mediump float;\n attribute vec2 aVertexPosition;\n attribute vec2 aUvs;\n uniform mat3 translationMatrix;\n uniform mat3 projectionMatrix;\n varying vec2 vUvs;\n\n\n void main() {\n vUvs = aUvs;\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n }"},e.prototype.destroy=function(){this._destroyed=!0,this._mesh&&(this._mesh.destroy({children:!0,texture:!1,baseTexture:!1}),this._mesh.mask=null,this._mesh=null),this._maskRenderTexure&&this._maskRenderTexure.destroy(!1)},f([(0,l.M)("MakeupLayer"),d("design:type",Function),d("design:paramtypes",[Array]),d("design:returntype",void 0)],e.prototype,"updateGeometry",null),f([(0,l.M)("MakeupLayer"),d("design:type",Function),d("design:paramtypes",[]),d("design:returntype",void 0)],e.prototype,"destroy",null),e}(),y=function(e){function t(t,n,i,r,o,s,c){var h=e.call(this,t,n,c)||this;return h._maskGraphics=new a.TC,h.maxLConSize=0,h.maxRConSize=0,h._parentIntensity=1,h.jsonIntensity=o,h.getTexture(i,r),h._config=s,h}var n;return p(t,e),Object.defineProperty(t.prototype,"parentIntensity",{get:function(){return this._parentIntensity},set:function(e){this._container&&(this._container.alpha=this.jsonIntensity*e),this._parentIntensity=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"visible",{set:function(e){this._container.visible=e},enumerable:!1,configurable:!0}),t.prototype.getTexture=function(e,t){this._blendMode=t;var n="default"===this._dir?e:"".concat(this._dir,"|").concat(e),i=a.P6.kN[n],r=new h.jy(i),o=new h.jy(i.clone());r.blendMode_1=t,o.blendMode_1=t,r.anchor.set(.5),o.anchor.set(.5),this._leftIris=r,this._rightIris=o;var s=new a.W2;this._container.addChild(s),this._maskGraphics||(this._maskGraphics=new a.TC),s.addChild(this._maskGraphics),s.addChild(r),s.addChild(o),s.alpha=this.parentIntensity*this.jsonIntensity,s.mask=this._maskGraphics,this._container=s},t.prototype.setIrisProps=function(e){if(e.length){var t=this._config.getConfigByKeys(["POINTS_MAP","LEFT_IRIS","RIGHT_IRIS","LEFT_EYE_ORDER","RIGHT_EYE_ORDER"]),n=t.POINTS_MAP,i=(t.LEFT_IRIS,t.RIGHT_IRIS,t.LEFT_EYE_ORDER),r=t.RIGHT_EYE_ORDER,o=(n.left_eye_center,n.right_eye_center,(0,u.Sp)(e[52],e[55])),s=(0,u.Sp)(e[58],e[61]),a=Math.max(this.maxLConSize,(0,u.Sp)(e[72],e[73])/o),c=Math.max(this.maxRConSize,(0,u.Sp)(e[75],e[76])/s),h=o*a,l=o*a,p=s*c,f=s*c;this.maxLConSize=Math.max(Math.min(a,.7),.4),this.maxRConSize=Math.max(Math.min(c,.7),.4);var d=(0,u.qg)(e[74],e[104]),_=(0,u.qg)(e[77],e[105]),y=this._leftIris,m=this._rightIris;y.width=h,y.height=l,y.x=d.x,y.y=d.y,m.width=p,m.height=f,m.x=_.x,m.y=_.y,this._maskGraphics.clear(),this._drawMaskGraphics(i,e),this._drawMaskGraphics(r,e)}},t.prototype._drawMaskGraphics=function(e,t){var n=this,i=this._maskGraphics;i.beginFill(16724736),i.lineStyle(1,16767232,1);var r=[];e.forEach((function(o,s){var a=t[o],c=n._getPixelPosition(a.x,a.y),h=c.x,u=c.y;r.push({x:h,y:u}),0===s?i.moveTo(h,u):s===e.length-1?(i.closePath(),i.endFill()):i.lineTo(h,u)}))},t.prototype._getPixelPosition=function(e,t){return{x:e,y:t}},t.prototype.destroy=function(){this._leftIris&&this._leftIris.destroy({children:!0,texture:!1,baseTexture:!1}),this._rightIris&&this._rightIris.destroy({children:!0,texture:!1,baseTexture:!1}),this._maskGraphics&&this._maskGraphics.destroy({children:!0,texture:!1,baseTexture:!1})},f([(0,l.M)("IrisLayer"),d("design:type",Function),d("design:paramtypes",["function"==typeof(n="undefined"!=typeof Array&&Array)?n:Object]),d("design:returntype",void 0)],t.prototype,"setIrisProps",null),t}(_),m=n(3120),b=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s},v=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},g=function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((i=i.apply(e,t||[])).next())}))},k=function(e,t){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},w=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},x=function(){function e(e,t,n){e&&(this._options=e),t&&(this._lipVertex=t),n&&(this.renderer=n)}return e.prototype.destroy=function(){var e=this._lipMask;this._lipMask=null;try{e.destroy(!0)}catch(e){}try{this._lipMaskMesh.destroy(!0),this._lipMaskMesh=null}catch(e){}try{this._maskRenderTexture.destroy(!0),this._maskRenderTexture=null}catch(e){}this._config=null;try{this._maskSprite.destroy(!0),this._maskSprite=null}catch(e){}},e.prototype.load=function(){return g(this,void 0,void 0,(function(){var e,t,n,i,r;return k(this,(function(o){switch(o.label){case 0:return this._config?[3,2]:(this._config=new c.M,[4,this._config.load()]);case 1:o.sent(),o.label=2;case 2:return this._lipMask?[3,4]:[4,this._getMask()];case 3:o.sent(),o.label=4;case 4:return this._maskSprite&&!this._maskSprite.destroyed||(e=this._options,t=e.width,n=e.height,i=new a.jd({width:t,height:n}),this._maskRenderTexture=new a.TI(i),r=new a.jy(this._maskRenderTexture),this._maskSprite=r),[2,{maskSprite:this._maskSprite,lipmask:this._lipMask,lipmaskmesh:this._lipMaskMesh}]}}))}))},e.prototype.update=function(e){this._lipMaskMesh&&(this._lipMaskMesh.geometry.getBuffer("aVertexPosition").update(e),this.render())},e.prototype.render=function(){this.renderer&&this._lipMask&&this.renderer.render(this._lipMask,{renderTexture:this._maskRenderTexture})},e.prototype._getMask=function(){return g(this,void 0,void 0,(function(){var e,t,n,i,r,o,s,c,h;return k(this,(function(u){switch(u.label){case 0:return this._lipMask?[2,this._lipMask]:(e=new a.W2,(t=new a.jy(a.xE.WHITE)).width=this._options.width,t.height=this._options.height,e.addChild(t),n=this._lipVertex,i=this._config.getDataConfig(29),[4,this._loadLipImage()]);case 1:return r=u.sent(),o=(new a.wG).addAttribute("aVertexPosition",n).addAttribute("aUvs",i),"\n precision mediump float;\n attribute vec2 aVertexPosition;\n attribute vec2 aUvs;\n uniform mat3 translationMatrix;\n uniform mat3 projectionMatrix;\n varying vec2 vUvs;\n\n\n void main() {\n vUvs = aUvs;\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n }","\n precision mediump float;\n varying vec2 vUvs;\n uniform sampler2D uSamplerMakeup;\n\n \n void main() {\n gl_FragColor = texture2D(uSamplerMakeup, vUvs);\n }",s={uSamplerMakeup:r},c=a.ex.from("\n precision mediump float;\n attribute vec2 aVertexPosition;\n attribute vec2 aUvs;\n uniform mat3 translationMatrix;\n uniform mat3 projectionMatrix;\n varying vec2 vUvs;\n\n\n void main() {\n vUvs = aUvs;\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n }","\n precision mediump float;\n varying vec2 vUvs;\n uniform sampler2D uSamplerMakeup;\n\n \n void main() {\n gl_FragColor = texture2D(uSamplerMakeup, vUvs);\n }",s),h=new a.Kj(o,c),this._lipMaskMesh=h,e.addChild(h),this._lipMask=e,[2,e]}}))}))},e.prototype._loadLipImage=function(){return g(this,void 0,Promise,(function(){var e=this;return k(this,(function(t){return[2,new Promise((function(t,n){return g(e,void 0,void 0,(function(){var e,n,i;return k(this,(function(r){switch(r.label){case 0:return[4,(e=new m.KI).init()];case 1:return n=r.sent(),[4,e.loadImage(n)];case 2:return i=r.sent(),t(i[m.X_]),[2]}}))}))}))]}))}))},b([(0,l.M)("ReuseableLipMask"),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",void 0)],e.prototype,"destroy",null),b([(0,l.o)("ReuseableLipMask"),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Promise)],e.prototype,"_getMask",null),e}(),S=function(){function e(e,t,n,i,r,o,s,c){void 0===c&&(c=1),this._container=new a.W2,this._makeupMeshes=[],this._visible=!0,this.mouthShut=!0,this._key=e,this._data=t,this._options=n,this.mesh=i,this.lipmesh=o,this.faceLandMarks=r,this.renderer=s,this.parentIntensity=c;var h=new a.jy(a.xE.WHITE);h.alpha=0,h.width=n.width,h.height=n.height,this._container.addChild(h)}var t;return Object.defineProperty(e.prototype,"visible",{get:function(){return this._visible},set:function(e){this._target&&e!==this._visible&&(this._visible=e,this._makeupMeshes.forEach((function(t){t.visible=e})),this._irises&&(this._irises.visible=e))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mesh",{set:function(e){(this._meshVertex=e,this.geometry)&&(this.geometry.getBuffer("aVertexPosition").update(e),this._makeupMeshes.forEach((function(t){t.updateGeometry(e)})))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lipmesh",{set:function(e){this._lipVertex=e,this._lipMaskIns&&this._lipMaskIns.update(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"faceLandMarks",{set:function(e){var t=this;e&&e.length&&(this._irises&&this._irises.setIrisProps(e),(0,u.Sp)(e[98],e[102])<.03*(0,u.Sp)(e[0],e[32])?this.mouthShut||(this._makeupMeshes.forEach((function(e){"lips"===e.type&&(e.lipMask=null)})),this.mouthShut=!0):this.mouthShut&&(this._makeupMeshes.forEach((function(e){"lips"===e.type&&t._lipMaskIns&&(e.lipMask=t._lipMaskIns._maskSprite)})),this.mouthShut=!1))},enumerable:!1,configurable:!0}),e.prototype.resize=function(e,t){this._makeupMeshes.forEach((function(n){n.resize(e,t)}))},Object.defineProperty(e.prototype,"parentIntensity",{get:function(){return this._intensity},set:function(e){this._irises&&(this._irises.parentIntensity=e),this._makeupMeshes.forEach((function(t){t.parentIntensity=e})),this._intensity=e},enumerable:!1,configurable:!0}),e.prototype.renderMesh=function(){this._lipMaskIns&&this._lipMaskIns.render(),this._makeupMeshes.forEach((function(e){e.renderMesh()}))},e.prototype.load=function(){return g(this,void 0,void 0,(function(){var e,t,n,i,r,o,s,a,h;return k(this,(function(u){switch(u.label){case 0:return this._config=new c.M,[4,this._config.load()];case 1:if(u.sent(),e=this._data,t={},e&&e.length){try{for(n=w(e),i=n.next();!i.done;i=n.next())"iris"===(r=i.value).type?this._irises=this._getIris(r.src,r.blend,r.intensity):"contour"===r.type?(s=this._getMeshLayer(r.src,r.blend,r.intensity,r.type),this._makeupMeshes.push(s)):(o=r.blend+"",t[o]||(t[o]=[]),t[o].push({src:r.src,intensity:r.intensity,type:r.type}))}catch(e){a={error:e}}finally{try{i&&!i.done&&(h=n.return)&&h.call(n)}finally{if(a)throw a.error}}for(o in t)s=this._getMeshLayerByBlendMode(parseInt(o),t[o]),this._makeupMeshes.push(s)}return[4,this._initLipMask()];case 2:return u.sent(),[2]}}))}))},e.prototype._getIris=function(e,t,n){return new y(this._options,this._key,e,t,n,this._config,this._container)},e.prototype._getMeshLayerByBlendMode=function(e,t){var n=t.some((function(e){return"lips"===e.type}))?"lips":"makeup",i=new _(this._options,this._key,this._container,this.renderer,n);i.parentIntensity=this.parentIntensity;var r=this._config.getDataConfig(26);if(!this.geometry){var o=(new a.wG).addAttribute("aVertexPosition",this._meshVertex).addAttribute("aUvs",r);this.geometry=o}return i.drawMeshBatch(e,t,this.geometry),i},e.prototype._getMeshLayer=function(e,t,n,i){var r=new _(this._options,this._key,this._container,this.renderer,i);r.parentIntensity=this.parentIntensity;var o=this._config.getDataConfig(26);if(!this.geometry){var s=(new a.wG).addAttribute("aVertexPosition",this._meshVertex).addAttribute("aUvs",o);this.geometry=s}return r.drawMesh(e,t,n,this.geometry),r},e.prototype.apply=function(e){this._target=e,this._applyMakeup(e)},e.prototype.remove=function(){this._removeMakeup(this._target)},e.prototype._applyMakeup=function(e){e.filters||(e.filters=[]),e.addChild(this._container)},e.prototype._removeMakeup=function(e){e.filters&&e.removeChild(this._container)},e.prototype._initLipMask=function(){return g(this,void 0,void 0,(function(){var e,t,n=this;return k(this,(function(i){switch(i.label){case 0:return(e=new x(this._options,this._lipVertex,this.renderer))._options=this._options,e._lipVertex=this._lipVertex,e.renderer=this.renderer,this._lipMaskIns=e,[4,e.load()];case 1:return t=i.sent().maskSprite,this._makeupMeshes.forEach((function(e){"lips"!==e.type||n.mouthShut||(e.lipMask=t)})),[2]}}))}))},e.prototype.destroy=function(){this.remove(),this._makeupMeshes.forEach((function(e){return e.destroy()})),this._makeupMeshes=[],this._irises&&this._irises.destroy(),this._irises=null,this._container.destroy(),this._target=null,this._lipMaskIns&&this._lipMaskIns.destroy()},b([(0,l.M)("Makeup"),v("design:type",Function),v("design:paramtypes",["function"==typeof(t=void 0!==a.W2&&a.W2)?t:Object]),v("design:returntype",void 0)],e.prototype,"_removeMakeup",null),b([(0,l.M)("Makeup"),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",void 0)],e.prototype,"destroy",null),e}(),M=n(3125),T=n(401),P=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s},E=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},j=function(){function e(e,t,n,i,r,o,s,c){this._container=new a.W2,this._name=e,this._src=t,this._target=i,this._config=n,this._jsonIntensity=n.intensity,this._landmarks=r,this._options=o,this._key=s,this._angles=c}return Object.defineProperty(e.prototype,"parentIntensity",{get:function(){return this._parentIntensity},set:function(e){this._parentIntensity=e,this._sticker&&(this._sticker.alpha=this._jsonIntensity*e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"faceLandMarks",{set:function(e){this._landmarks=e,this._sticker&&this.setStickerProps()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"angles",{set:function(e){this._angles=e,this._sticker&&this.setStickerProps()},enumerable:!1,configurable:!0}),e.prototype.getCircle=function(e){void 0===e&&(e=5);var t=new a.TC;return t.beginFill(16711680),t.drawCircle(0,0,e),t.endFill(),t},e.prototype.getCircle2=function(e){void 0===e&&(e=5);var t=new a.TC;return t.beginFill(255),t.drawCircle(0,0,e),t.endFill(),t},e.prototype.getDisplay=function(){return this._container},e.prototype.load=function(){var e,t=this;if(this.checkAnimated()){var n=[];this._src.forEach((function(e){var i;i=e.indexOf(".json")>-1?e:"".concat(t._key,"|").concat(JSON.parse(e).meta.image);var r=o.iV[i].textures,s=Object.keys(r).map((function(e){return r[e]}));n=n.concat(s)})),(e=new h.Kg(n)).animationSpeed=(this._config.fps||30)/60,e.play()}else{var i=this._src[0],r=a.P6.kN[i];e=new h.jy(r)}this._config.blend&&(e.blendMode_1=this._config.blend);this._config.wxAnchorOffset;e.width=this._config.width,e.height=this._config.height;var s=[.5,.5];this._config.anchor&&(s=this._config.anchor),e.anchor.set(s[0],s[1]),e.alpha=this._jsonIntensity*this.parentIntensity,this._sticker=e,this._container.addChild(this._sticker),this._container.convertTo3d(),this.setStickerProps()},e.prototype.setStickerProps=function(){var e=this._config,t=this._landmarks,n=T.Jp.map((function(e){return t[e]})),i=(0,u.Sp)(n[0],n[1]),r=e.wxAnchorArea,o=(e.wxAnchorOffset,e.wxWeights),s=i/T.jw,a=r.map((function(e){var n=t[e];return{x:n.x,y:n.y,z:0}}));this._container.scale.set(s);var c={x:a[0].x*o[0]+a[1].x*o[1]+a[2].x*o[2],y:a[0].y*o[0]+a[1].y*o[1]+a[2].y*o[2]};this._container.position.x=c.x,this._container.position.y=c.y,this._angles&&(this._container.euler.z=this._angles.roll,this._container.euler.y=this._angles.yaw,this._container.euler.x=this._angles.pitch)},e.prototype.checkAnimated=function(){if(this._src instanceof Array&&this._src.length>1)return!0;try{return JSON.parse(this._src[0]),!0}catch(e){return"json"===this._src[0].split(".").pop()}},e.prototype.tick=function(){},e.prototype.apply=function(){},e.prototype.remove=function(){},e.prototype.destroy=function(){this._sticker.destroy(),this._container.destroy(),this._sticker=null,this._target=null},P([(0,l.M)("StickerLayer"),E("design:type",Function),E("design:paramtypes",[]),E("design:returntype",Boolean)],e.prototype,"checkAnimated",null),P([(0,l.M)("StickerLayer"),E("design:type",Function),E("design:paramtypes",[]),E("design:returntype",void 0)],e.prototype,"destroy",null),e}(),C=function(){function e(e,t,n,i,r,o,s){void 0===s&&(s=1);var a=this;this._stickers=[],this._visible=!0,this._parentIntensity=1,this._target=n,this._options=r,this._landmarks=i;var c=new M.LE;c.setPlanes(400,10,1e4,!0),this._camera=c,this._stickers=t.map((function(t){var s=new j(t.name,t.src,t,n,i,r,e,o);return s.parentIntensity=a.parentIntensity,s.load(),a._camera.addChild(s.getDisplay()),s}))}return Object.defineProperty(e.prototype,"parentIntensity",{get:function(){return this._parentIntensity},set:function(e){this._stickers.forEach((function(t){t.parentIntensity=e})),this._parentIntensity=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"faceLandMarks",{set:function(e){this._stickers.forEach((function(t){t.faceLandMarks=e}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"angles",{set:function(e){this._stickers.forEach((function(t){t.angles=e}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"visible",{get:function(){return this._visible},set:function(e){this._target&&e!==this._visible&&(this._visible=e,e?this.apply():this.remove())},enumerable:!1,configurable:!0}),e.prototype.tick=function(){this._stickers.forEach((function(e){return e.tick()}))},e.prototype.apply=function(){this._target.addChild(this._camera)},e.prototype.remove=function(){this._target.removeChild(this._camera)},e.prototype.destroy=function(){this.remove(),this._stickers.forEach((function(e){return e.destroy()})),this._camera.destroy(),this._stickers=[]},e}(),I=n(6878),O=n(6879),R=n(6109),F=n(201),L=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),V=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s},A=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},N=function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((i=i.apply(e,t||[])).next())}))},U=function(e,t){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},D=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},z=(0,R.jl)("Effect"),G=function(){function e(e,t,n,i,r,o,s,a,c,h,u){this.type="face",this._filters=[],this._destroyed=!1,this._visible=!0,this._intensity=1,this._filterIntensity=1,this.localSpriteSheets={},this._filtersActived=!0,this._target=t,this._stickerTarget=n,this._url=e,this._key=e,this._options=r,this.mesh=o,this.lipmesh=a,this.faceLandMarks=s,c&&(this.angles=c),void 0!==h&&(this.intensity=h),this._app3d=i,this._canvas=u}var t;return Object.defineProperty(e.prototype,"isPureFilter",{get:function(){var e=this._config;return!!e&&((!e.makeup||!e.makeup.length)&&((!e.sticker||!e.sticker.length)&&((!e.sticker3d||!e.sticker3d.length)&&(!e.beautify||!Object.keys(e.beautify).find((function(t){return!!e.beautify[t]}))))))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"filterActived",{get:function(){return this._filtersActived},set:function(e){e!==this._filtersActived&&(this._filterTarget&&(e?this._applyFilter(this._filterTarget):this._removeFilter(this._filterTarget)),this._filtersActived=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"url",{get:function(){return this._url},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"app3d",{get:function(){return this._app3d},set:function(e){this._app3d=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"intensity",{get:function(){return this._intensity},set:function(e){e>1&&(I.Nd.trigger("error",{message:r.Z.t("0015"),code:O.U.SET_INTENSITY_ERROR}),e=1),null!=e&&(this._makeup&&(this._makeup.parentIntensity=e),this._sticker&&(this._sticker.parentIntensity=e),this._intensity=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"filterIntensity",{get:function(){return this._filterIntensity},set:function(e){null!=e&&(this._filters&&this._filters.forEach((function(t){t.uniforms.parentIntensity=e})),this._filterIntensity=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"visible",{get:function(){return this._visible},set:function(e){this._destroyed||(this._visible=e,this._makeup&&(this._makeup.visible=e),this._sticker&&(this._sticker.visible=e),this._app3d&&(this._app3d.visible=e))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mesh",{set:function(e){this._destroyed||(this._meshVertex=e,this._makeup&&(this._makeup.mesh=e))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lipmesh",{set:function(e){this._destroyed||(this._lipVertex=e,this._makeup&&(this._makeup.lipmesh=e))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"faceLandMarks",{get:function(){return this._faceLandMarks},set:function(e){this._destroyed||(this._faceLandMarks=e,this._makeup&&(this._makeup.faceLandMarks=e),this._sticker&&(this._sticker.faceLandMarks=e))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"angles",{set:function(e){this._angles=e,this._sticker&&(this._sticker.angles=e)},enumerable:!1,configurable:!0}),e.prototype.download=function(){return N(this,void 0,Promise,(function(){var e;return U(this,(function(t){switch(t.label){case 0:return[4,this._getLoader()];case 1:return[4,t.sent().preload(this._url)];case 2:return t.sent(),[4,this._getConfig()];case 3:return e=t.sent(),R.D4.info("download:",this._url,e),[2,e]}}))}))},e.prototype.load=function(){return N(this,void 0,Promise,(function(){var e,t,n,i,r,o;return U(this,(function(s){switch(s.label){case 0:return[4,this.download()];case 1:return e=s.sent(),t=e.filter,n=e.makeup,i=e.beautify,r=e.sticker,o=e.sticker3d,[4,this._loadImages(e)];case 2:return s.sent(),this.loadFilter(t),[4,this.setMakeup(n)];case 3:return s.sent(),r?[4,this.loadStickers(r)]:[3,5];case 4:s.sent(),s.label=5;case 5:return[4,this.load3d(o)];case 6:return s.sent(),this.sticker3d=o,[4,this._getLoader()];case 7:return s.sent().removeFromCache(this._url),[2,i]}}))}))},e.prototype._getLoader=function(){return N(this,void 0,void 0,(function(){return U(this,(function(e){switch(e.label){case 0:return this._loader?[3,2]:(this._loader=new o.pF,[4,this._loader.init()]);case 1:e.sent(),e.label=2;case 2:return[2,this._loader]}}))}))},e.prototype._getConfig=function(){return N(this,void 0,void 0,(function(){var e;return U(this,(function(t){switch(t.label){case 0:return this._config?[3,3]:[4,this._getLoader()];case 1:return[4,(e=t.sent()).preload(this._url)];case 2:t.sent(),this._config=e.readJSON("content.json",this._key),t.label=3;case 3:return[2,this._config]}}))}))},e.prototype.hasEyeMakeup=function(){return N(this,void 0,Promise,(function(){var e,t,n,i,r,o,s,a;return U(this,(function(c){switch(c.label){case 0:return[4,this._getConfig()];case 1:e=c.sent(),t=e.makeup,n=!1;try{for(i=D(t),r=i.next();!r.done;r=i.next())if("iris"===(o=r.value).type||"eyes"===o.type){n=!0;break}}catch(e){s={error:e}}finally{try{r&&!r.done&&(a=i.return)&&a.call(i)}finally{if(s)throw s.error}}return[2,n]}}))}))},e.prototype.needDetection=function(){return N(this,void 0,Promise,(function(){var e,t,n,i;return U(this,(function(r){switch(r.label){case 0:return[4,this._getConfig()];case 1:return e=r.sent(),t=e.makeup,n=e.sticker,i=e.sticker3d,[2,t&&t.length||n&&n.length||i&&i.length]}}))}))},e.prototype.hasFilter=function(){return N(this,void 0,Promise,(function(){var e,t;return U(this,(function(n){switch(n.label){case 0:return[4,this._getConfig()];case 1:return e=n.sent(),[2,!(!(t=e.filter)||!t.length)]}}))}))},e.prototype.loadStickers=function(e){return N(this,void 0,Promise,(function(){var t;return U(this,(function(n){return e.length?((t=new C(this._key,e,this._stickerTarget,this.faceLandMarks,this._options,this._angles)).parentIntensity=this.intensity,this._sticker=t,[2]):[2,Promise.resolve()]}))}))},e.prototype.loadSticker3d=function(e){return void 0===e&&(e=[]),N(this,void 0,Promise,(function(){return U(this,(function(e){return[2]}))}))},e.prototype.load3d=function(e){return N(this,void 0,void 0,(function(){return U(this,(function(e){return[2]}))}))},e.prototype.initThreeApp=function(){return N(this,void 0,void 0,(function(){return U(this,(function(e){return[2]}))}))},e.prototype.apply3d=function(){},e.prototype.removeForConsole=function(){},e.prototype.destroyForConosle=function(){},e.prototype.setMakeup=function(e){return e.length?(this._makeup=new S(this._key,e,this._options,this._meshVertex,this.faceLandMarks,this._lipVertex,this.renderer,this.intensity),this._makeup.load()):Promise.resolve()},e.prototype.resize=function(e,t){this._makeup&&this._makeup.resize(e,t)},e.prototype.apply=function(e){this._destroyed||this._applyed||(this.filterActived&&this._applyFilter(e.filterTarget),this._filters.length&&e.filterCallback&&e.filterCallback(),this._filterTarget=e.filterTarget,this._makeup&&this._makeup.apply(this._target),this._sticker&&this._sticker.apply(),this.apply3d(),this._applyed=!0)},e.prototype.getUrl=function(){return this._url},e.prototype.remove=function(){this._makeup&&this._makeup.remove(),this._sticker&&this._sticker.remove(),this.removeForConsole(),this._removeFilter(this._filterTarget),this._applyed=!1},e.prototype.tick=function(){this._sticker&&this._sticker.tick()},e.prototype.tickMesh=function(){this._makeup&&this._makeup.renderMesh()},e.prototype.destroy=function(){this._destroyed=!0,this.remove(),this._makeup&&(this._makeup.destroy(),this._makeup=null),this._sticker&&(this._sticker.destroy(),this._sticker=null),this.destroyForConosle(),this._filters=[],this.clearTexture()},e.prototype.loadFilter=function(e){var t=this;this._destroyed||e&&e.length&&e.forEach((function(e){var n=t._createFilterSync(e.src,e.intensity,t.filterIntensity);t._filters.push(n)}))},e.prototype._applyFilter=function(e){e.filters||(e.filters=[]),e.filters=this._filters.concat(e.filters)},e.prototype._removeFilter=function(e){e&&e.filters&&e.filters.length&&this._filters.forEach((function(t){var n=e.filters.findIndex((function(e){return e===t}));n>-1&&e.filters.splice(n,1)}))},e.prototype._createFilterSync=function(e,t,n){var i="default"===this._key?e:"".concat(this._key,"|").concat(e),r=a.P6.kN[i];return r.baseTexture.scaleMode=a.aH.LINEAR,r.baseTexture.mipmap=a.KI.OFF,new s.f("lut",this._options,{uniforms:{lut:r,intensity:t,parentIntensity:n}})},e.prototype.clearTexture=function(){for(var e in a.P6.kN)if(e.indexOf(this._key)>-1){var t=a.P6.kN[e];a.xE.removeFromCache(t),t.destroy(!0)}for(var e in this.localSpriteSheets)o.iV[e]&&o.iV[e]instanceof a.c2&&(o.iV[e].destroy(),delete o.iV[e])},e.prototype._loadImages=function(e){var t,n,i=this,r=(e.filter||[]).concat(e.makeup||[]).concat(e.sticker||[]),s=this._loader.getIndeLoader(),c={};this.localSpriteSheets=c;try{for(var h=D(r),u=h.next();!u.done;u=h.next()){var l=u.value;if(l.src instanceof Array)l.src.forEach((function(e,t){var n=i.checkSpriteSheetJSON(e);if(n){var r=n.meta.image,o="".concat(i._key,"|").concat(r);if(a.P6.kN[o])return;if(0===r.indexOf("blob:")){var h=a.xE.from(r);a.xE.addToCache(h,o)}else s.add(o,r);n.meta.image="",c[o]=n}else{if(a.P6.kN[e])return;if(s.resources[e])return;s.add(e,e)}}));else{var p="".concat(this._key,"|").concat(l.src);if(a.P6.kN[p])continue;if(0===l.src.indexOf("blob:")){var f=a.xE.from(l.src);a.xE.addToCache(f,p)}else s.add(p,l.src)}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=h.return)&&n.call(h)}finally{if(t)throw t.error}}return new Promise((function(e){s.load((function(t,n){return N(i,void 0,void 0,(function(){var t,i,r,s,h;return U(this,(function(u){switch(u.label){case 0:for(r in t=function(e){var t;return U(this,(function(n){switch(n.label){case 0:return o.iV[e]?[2,"continue"]:c[e]?(t=new a.c2(a.P6.kN[e],c[e],"@".concat((0,F.u)(),"x")),[4,new Promise((function(n){t.parse((function(){o.iV[e]=t,n()}))}))]):[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}}))},i=[],a.P6.kN)i.push(r);s=0,u.label=1;case 1:return s<i.length?(h=i[s],[5,t(h)]):[3,4];case 2:u.sent(),u.label=3;case 3:return s++,[3,1];case 4:for(h in n)o.iV[h]||c[h]||(o.iV[h]=n[h]);return e(),[2]}}))}))}))}))},e.prototype.checkSpriteSheetJSON=function(e){try{return JSON.parse(e)}catch(e){return null}},V([(0,l.M)("Effect"),A("design:type",Function),A("design:paramtypes",[]),A("design:returntype",void 0)],e.prototype,"remove",null),V([(0,l.M)("Effect"),A("design:type",Function),A("design:paramtypes",[]),A("design:returntype",void 0)],e.prototype,"destroy",null),V([(0,l.M)("Effect"),A("design:type",Function),A("design:paramtypes",["function"==typeof(t=void 0!==a.W2&&a.W2)?t:Object]),A("design:returntype",void 0)],e.prototype,"_removeFilter",null),e}(),H=function(e){function t(t,n,i,r,o,s,a,c){var h=e.call(this,"default",n,i,r,o,s,a,c)||this;return h._json=t,h._app3d=r,h}return L(t,e),t.prototype.load=function(){return N(this,void 0,Promise,(function(){var e,t,n,i,r,o;return U(this,(function(s){switch(s.label){case 0:return e=this._json,t=e.filter,n=e.makeup,i=e.beautify,r=e.sticker,o=e.sticker3d,[4,this._loadImages(e)];case 1:return s.sent(),this.loadFilter(t),[4,this.setMakeup(n)];case 2:return s.sent(),r?[4,this.loadStickers(r)]:[3,4];case 3:s.sent(),s.label=4;case 4:return o?this._app3d?[3,6]:[4,this.initThreeApp()]:[3,8];case 5:s.sent(),s.label=6;case 6:return[4,this.loadSticker3d(o||[])];case 7:s.sent(),s.label=8;case 8:return[2,i]}}))}))},t.prototype.loadImage=function(){return N(this,void 0,void 0,(function(){return U(this,(function(e){return[2]}))}))},t.prototype._loadImages=function(e){var t,n,i=this,r=new a.aN,s=(e.filter||[]).concat(e.makeup||[]).concat(e.sticker||[]),c={},h=function(e){if(e.src instanceof Array)e.src.forEach((function(t,n){var o=i.checkSpriteSheetJSON(t);if(o){var s=o.meta.image,h="".concat(i._key,"|").concat(s);if(a.P6.kN[h])return;if(e.objectSrc&&e.objectSrc.length){var u=a.xE.from(e.objectSrc[n]);a.xE.addToCache(u,h)}else if(0===s.indexOf("blob:")){u=a.xE.from(s);a.xE.addToCache(u,h)}else r.add(h,s);o.meta.image="",c[h]=o}else{if(a.P6.kN[t])return;if(r.resources[t])return;if(e.objectSrc&&e.objectSrc.length){u=a.xE.from(e.objectSrc[n],{resolution:(0,F.u)()});a.xE.addToCache(u,t)}else r.add(t,t)}}));else{if(a.P6.kN[e.src])return"continue";if(r.resources[e.src])return z.info("already loaded file",e.src),"continue";if(e.objectSrc){z.info("use imagebitmap to create texture");var t=a.xE.from(e.objectSrc);a.xE.addToCache(t,e.src)}else if(0===e.src.indexOf("blob:")){t=a.xE.from(e.src);z.info("JSONEffect blob texture",t),a.xE.addToCache(t,e.src)}else r.add(e.src)}};try{for(var u=D(s),l=u.next();!l.done;l=u.next()){h(l.value)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}return new Promise((function(e){return N(i,void 0,void 0,(function(){var t=this;return U(this,(function(n){return r.load((function(n,i){return N(t,void 0,void 0,(function(){var t,n,r,s,h;return U(this,(function(u){switch(u.label){case 0:for(r in t=function(e){var t;return U(this,(function(n){switch(n.label){case 0:return o.iV[e]?[2,"continue"]:c[e]?(t=new a.c2(a.P6.kN[e],c[e],"@".concat((0,F.u)(),"x")),[4,new Promise((function(n){t.parse((function(){o.iV[e]=t,n()}))}))]):[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}}))},n=[],a.P6.kN)n.push(r);s=0,u.label=1;case 1:return s<n.length?(h=n[s],[5,t(h)]):[3,4];case 2:u.sent(),u.label=3;case 3:return s++,[3,1];case 4:for(h in i)o.iV[h]||c[h]||(o.iV[h]=i[h]);return e(),[2]}}))}))})),[2]}))}))}))},t.prototype.loadSticker3d=function(e){return N(this,void 0,Promise,(function(){return U(this,(function(e){return[2]}))}))},t}(G),B=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),J=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s},W=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},q=function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((i=i.apply(e,t||[])).next())}))},K=function(e,t){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},Y=((0,R.jl)("Effect"),function(){function e(e,t,n,i){this.type="hand",this._destroyed=!1,this._visible=!0,this._intensity=1,this.localSpriteSheets={},this._url=e,this._key=e,this._app3d=t,this._canvas=i,this._options=n}return Object.defineProperty(e.prototype,"url",{get:function(){return this._url},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"app3d",{get:function(){return this._app3d},set:function(e){this._app3d=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"intensity",{get:function(){return this._intensity},set:function(e){this._intensity=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"visible",{get:function(){return this._visible},set:function(e){this._destroyed||(this._visible=e)},enumerable:!1,configurable:!0}),e.prototype.download=function(){return q(this,void 0,Promise,(function(){var e;return K(this,(function(t){switch(t.label){case 0:return[4,this._getLoader()];case 1:return[4,t.sent().preload(this._url)];case 2:return t.sent(),[4,this._getConfig()];case 3:return e=t.sent(),R.D4.info("download:",this._url,e),[2,e]}}))}))},e.prototype.load=function(){return q(this,void 0,Promise,(function(){var e,t;return K(this,(function(n){switch(n.label){case 0:return[4,this.download()];case 1:return e=n.sent(),t=e.hand,[4,this.load3d(t||[])];case 2:return n.sent(),[4,this._getLoader()];case 3:return n.sent().removeFromCache(this._url),[2,null]}}))}))},e.prototype._getLoader=function(){return q(this,void 0,void 0,(function(){return K(this,(function(e){switch(e.label){case 0:return this._loader?[3,2]:(this._loader=new o.pF,[4,this._loader.init()]);case 1:e.sent(),e.label=2;case 2:return[2,this._loader]}}))}))},e.prototype._getConfig=function(){return q(this,void 0,void 0,(function(){var e;return K(this,(function(t){switch(t.label){case 0:return this._config?[3,3]:[4,this._getLoader()];case 1:return[4,(e=t.sent()).preload(this._url)];case 2:t.sent(),this._config=e.readJSON("content.json",this._key),t.label=3;case 3:return[2,this._config]}}))}))},e.prototype.load3d=function(e){return q(this,void 0,void 0,(function(){return K(this,(function(e){return[2]}))}))},e.prototype.initThreeApp=function(){return q(this,void 0,void 0,(function(){return K(this,(function(e){return[2]}))}))},e.prototype.apply3d=function(){},e.prototype.removeForConsole=function(){},e.prototype.destroyForConosle=function(){},e.prototype.apply=function(){this._destroyed||this._applyed||(this.apply3d(),this._applyed=!0)},e.prototype.getUrl=function(){return this._url},e.prototype.remove=function(){this.removeForConsole(),this._applyed=!1},e.prototype.tick=function(){},e.prototype.tickMesh=function(){},e.prototype.destroy=function(){this._destroyed=!0,this.remove(),this.destroyForConosle(),this.clearTexture()},e.prototype.clearTexture=function(){for(var e in a.P6.kN)if(e.indexOf(this._key)>-1){var t=a.P6.kN[e];a.xE.removeFromCache(t),t.destroy(!0)}for(var e in this.localSpriteSheets)o.iV[e]&&o.iV[e]instanceof a.c2&&(o.iV[e].destroy(),delete o.iV[e])},e.prototype.checkSpriteSheetJSON=function(e){try{return JSON.parse(e)}catch(e){return null}},J([(0,l.M)("Effect"),W("design:type",Function),W("design:paramtypes",[]),W("design:returntype",void 0)],e.prototype,"remove",null),J([(0,l.M)("Effect"),W("design:type",Function),W("design:paramtypes",[]),W("design:returntype",void 0)],e.prototype,"destroy",null),e}()),X=function(e){function t(t,n,i,r){var o=e.call(this,"default",n,i,r)||this;return o._json=t,o._app3d=n,o}return B(t,e),t.prototype.load=function(){return q(this,void 0,Promise,(function(){var e,t;return K(this,(function(n){switch(n.label){case 0:return e=this._json,(t=e.hand)?this._app3d?[3,2]:[4,this.initThreeApp()]:[3,4];case 1:n.sent(),n.label=2;case 2:return[4,this.loadHand3d(t||[])];case 3:n.sent(),n.label=4;case 4:return[2,null]}}))}))},t.prototype.loadImage=function(){return q(this,void 0,void 0,(function(){return K(this,(function(e){return[2]}))}))},t.prototype.loadSticker3d=function(e){return q(this,void 0,Promise,(function(){return K(this,(function(e){return[2]}))}))},t.prototype.loadHand3d=function(e){return q(this,void 0,Promise,(function(){return K(this,(function(e){return[2]}))}))},t}(Y),Z=n(5156),$=n(7959),Q=n(6309),ee=n(1077),te=n(3849),ne=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),ie=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s},re=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},oe=function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((i=i.apply(e,t||[])).next())}))},se=function(e,t){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},ae=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},ce=(0,R.jl)("Renderer"),he=function(){};var ue=function(e){function t(t){var n=e.call(this,t)||this;return n._setup=!1,n._effects=[],n._debug=!0,n._destroyed=!1,n._isVR=!1,n._meshVertexTimer=0,n.lib3dLoaded=!1,n.libHand3dLoaded=!1,ce.info("[@#$] AR Renderer Constructed",location),n._debug=!1,t.output?n._canvas=new wx.window.Canvas(t.output):n._canvas=new wx.window.Canvas(wx.createOffscreenCanvas({type:"webgl",width:t.width,height:t.height})),n._stage=new a.W2,n._options=t,a.Xd.RESOLUTION=(0,F.u)(),a.Xd.FILTER_RESOLUTION=(0,F.u)(),n._renderer=new a.Th({view:n._canvas,width:t.width,height:t.height,useContextAlpha:!1,preserveDrawingBuffer:!1,antialias:!1}),n.setRenderer(),n.initRenderContext(t),n.handleLoading(),n.setup(),n}return ne(t,e),Object.defineProperty(t.prototype,"mirror",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"backGroundVR",{set:function(e){if(e){this._backgroundVR=new a.jy(a.xE.from(e));var t=this._backgroundVR,n=t.width,i=t.height,r=Math.max(this._options.width/n,this._options.height/i);this._backgroundVR.width*=r,this._backgroundVR.height*=r}else this._backgroundVR=null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"options",{set:function(e){var t=e.width,n=e.height;this._canvas.width=t,this._canvas.height=n,this._renderer&&this.resize(t,n),this._baseSprite&&(this._baseSprite.width=t,this._baseSprite.height=n,this._baseSprite.position.set(t/2,n/2),this._baseSprite.anchor.set(.5,.5)),this._baseRenderTexture.resize(t,n),this._makeupRenderTexture.resize(t,n),this._options=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"app3d",{get:function(){return this._app3d},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"avatar3d",{get:function(){return this._avatar3d},enumerable:!1,configurable:!0}),t.prototype.initRenderContext=function(e){this._baseContainer=new a.W2,this._makeupContainer=new a.W2,this._frontContainer=new a.W2,this._frontContainer.sortableChildren=!0,this._finalContainer=new a.W2,this._baseRenderTexture=a.TI.create({width:e.width,height:e.height}),this._makeupRenderTexture=a.TI.create({width:e.width,height:e.height}),this._makeupContainer.addChild(new a.jy(this._baseRenderTexture)),he.baseTexture=this._baseRenderTexture,this._finalContainer.addChild(new a.jy(this._makeupRenderTexture)),this._finalContainer.addChild(this._frontContainer),this._stage.addChild(this._finalContainer),this._target=this._finalContainer},t.prototype.loadLib3d=function(){return oe(this,void 0,Promise,(function(){var e;return se(this,(function(t){switch(t.label){case 0:return e=new Q.e({}),ce.info("loader init"),[4,e.init()];case 1:return t.sent(),ce.info("loader init done"),this._options.plugin3d&&this._options.plugin3d(G,H,e,wx.window),[2]}}))}))},t.prototype.loadHand3d=function(){return oe(this,void 0,Promise,(function(){var e;return se(this,(function(t){switch(t.label){case 0:return e=new Q.e({}),ce.info("+++++loader init"),[4,e.init()];case 1:return t.sent(),ce.info("+++++loader init done"),this._options.plugin3d&&this._options.pluginHand(Y,X,e,wx.window),[2]}}))}))},t.prototype.setup=function(){return oe(this,void 0,void 0,(function(){return se(this,(function(e){switch(e.label){case 0:return this._setup?[2]:(this._config=new c.M,[4,this._config.load()]);case 1:return e.sent(),this._setup=!0,[2]}}))}))},Object.defineProperty(t.prototype,"meshVertex",{get:function(){return this._meshVertex},set:function(e){this._meshVertex=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mirrorFilter",{get:function(){return this._mirrorFilter||(this._mirrorFilter=new s.f("mirror",{width:te.t.instance.options.width,height:te.t.instance.options.height})),this._mirrorFilter},enumerable:!1,configurable:!0}),t.prototype.switchMode=function(e){R.bH.info("switchMode",e),e!==this._mode3d&&("Sticker"===e&&this.setAvatar(null),this._mode3d=e)},t.prototype.logTime=function(e){var t=+new Date;ce.info("".concat(e," time:").concat(t-this.currentTime)),this.currentTime=t},t.prototype.tick=function(t,n){var i=t.landmarks,r=t.meshVertex,o=t.lipVertex,s=t.image,c=t.angles,h=(t.backgroundType,t.background,t.segmentation,t.blendshapes,t.isLivePusher);t.hair;if(!this._destroyed)if(this._renderer)if(this._stage)if(this._setup){this.currentTime=+new Date,this._image=s;try{this._renderer.reset()}catch(e){}if(this._isVR)try{this._renderer.render(this._backgroundVR)}catch(e){}else{if(h)if(this._baseSprite)this._baseSprite.texture.update();else{d=a.xE.from(s);this._baseSprite=new a.jy(d),this._baseSprite.anchor.set(.5,.5),this._baseSprite.position.set(this._options.width/2,this._options.height/2),this._baseSprite.scale.set(1,-1),this._baseContainer.addChild(this._baseSprite)}else{var u=s,l=u.width,p=u.height,f=u.data;if(this._baseSprite){if(this._baseSprite.texture.width===l&&this._baseSprite.texture.height===p)this._baseSprite.texture.baseTexture.resource.data=new Uint8Array(f),this._baseSprite.texture.update();else this._baseSprite.texture.destroy(!0),this._baseSprite.texture=a.xE.fromBuffer(new Uint8Array(f),l,p)}else{var d=a.xE.fromBuffer(new Uint8Array(f),l,p);this._baseSprite=new a.jy(d),this._baseSprite.anchor.set(.5,.5),this._baseSprite.position.set(this._options.width/2,this._options.height/2);var _=Math.max(this._options.width/l,this._options.height/p);this._baseSprite.scale.set(_),this._baseContainer.addChild(this._baseSprite)}}($.s.checkEnabled("beautify")||$.s.checkEnabled("segmentation")||$.s.checkEnabled("hair"))&&(e.prototype.setMesh.call(this,r),e.prototype.setReshapeMarks.call(this,i),i&&i.length?(this._faceLandmarks=i,this._angles=c,this.meshVertex=r,this.lipVertex=o,this.detected=!0,this._effects.forEach((function(e){e.visible||(e.visible=!0),e.lipmesh=o,e.mesh=r,e.angles=c,e.faceLandMarks=i,e.tick()})),"Sticker"===this._mode3d&&this._app3d&&this._app3d.loaded&&(this._app3d.facelandmarks=i,this._app3d.angles=c)):(this.handleNoFace(),this.detected=!1)),this._render()}}else R.b_.info("_renderer waiting for setup");else R.b_.info("_renderer waiting for stage");else R.b_.info("_renderer waiting for renderer")},t.prototype.handleNoFace=function(){this._effects.forEach((function(e){return e.visible=!1})),this._effects.forEach((function(e){e.tickMesh()}));new Date;"AR"===this._mode3d||"Sticker"===this._mode3d&&this._app3d&&this._app3d.loaded&&(this._app3d.facelandmarks=[],this._app3d.angles={})},t.prototype._render=function(){this.renderLayers(),$.s.checkEnabled("beautify")&&"Sticker"===this._mode3d&&this._app3d&&this._app3d.loaded&&this._app3d.render(),$.s.checkEnabled("handLandmark")&&this._appHand3d&&this._appHand3d.render()},t.prototype.renderLayers=function(){this._options.isWxAndroid?(this._renderer.render(this._makeupContainer,{renderTexture:this._makeupRenderTexture}),this._renderer.render(this._baseContainer,{renderTexture:this._baseRenderTexture})):(this._renderer.render(this._baseContainer,{renderTexture:this._baseRenderTexture}),this._renderer.render(this._makeupContainer,{renderTexture:this._makeupRenderTexture})),this._renderer.render(this._stage)},t.prototype.getBaseTexture=function(){return this._baseSprite.texture},t.prototype.removeBackground=function(){this.background&&(this.background.remove(),this.background=null)},t.prototype.disableEdgeOptimization=function(){this.background&&this.background.disableEdgeOptimization()},t.prototype.enableEdgeOptimization=function(){this.background&&this.background.enableEdgeOptimization()},t.prototype.applyBackground=function(e){this.background},t.prototype.removeForeground=function(){this._frontContainer&&(this._frontContainer.children.forEach((function(e){e.destroy()})),this._frontContainer.removeChildren())},t.prototype.addForeground=function(e){var t=this;if(Array.isArray(e)){var n={};for(var i in this._frontContainer.children.forEach((function(e){n[e.id]=e})),e.forEach((function(e,i){var r=n[e.id];r?(r.zIndex=i,delete n[e.id]):t._addForeground(e,i)})),n)n[i].destroy(),this._frontContainer.removeChild(n[i]);this._frontContainer.sortChildren()}else this._addForeground(e)},t.prototype._addForeground=function(e,t){var n=e.image,i=e.type,r=e.id,o=te.t.instance.options,s=o.width,c=o.height,u="data"in n?a.xE.fromBuffer(new Uint8Array(n.data.buffer),n.width,n.height):a.xE.from(n),l=new h.jy(u);"video"===i&&(l.blendMode_1=6),l.width=s,l.height=c,l.id=r,t&&(l.zIndex=t),this._frontContainer.addChild(l)},t.prototype.debugDraw=function(e){if(!this.points){for(var t=[],n=0;2*n<e.length;n++){var i=this.getCircle(2);t.push(i),this._baseContainer.addChild(i)}this.points=t}for(n=0;2*n<e.length;n++)this.points[n].x=e[2*n],this.points[n].y=e[2*n+1]},t.prototype.debugDraw2=function(e){if(ce.info("debug draw 2",e.length),!this.points){for(var t=[],n=0;n<e.length;n++){var i=this.getCircle(2);t.push(i),this._baseContainer.addChild(i)}this.points=t}for(n=0;n<e.length;n++)this.points[n].x=540*e[n].x,this.points[n].y=540*e[n].y},t.prototype.getPixels=function(){var e=this._options,t=e.width,n=e.height,i=new Uint8Array(t*n*4),r=this._renderer.gl;return r.readPixels(0,0,t,n,r.RGBA,r.UNSIGNED_BYTE,i),{data:i,width:t,height:n}},t.prototype.setEffect=function(e,t,n,i){return oe(this,void 0,Promise,(function(){var r,o=this;return se(this,(function(s){return r=!0,this.latestEffectUrls&&this.latestEffectUrls.length===e.length&&e.every((function(e){return o.latestEffectUrls.indexOf(e)>-1}))&&(r=!1,this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null)),this.latestEffectUrls=e,[2,new Promise((function(s,a){r?(o.debounceTimer&&(clearTimeout(o.debounceTimer),o.debounceTimer=null),o.debounceTimer=setTimeout((function(){return o._setEffect(e,t,n,i).then((function(e){clearTimeout(o.debounceTimer),o.debounceTimer=null,s(e)}))}),100)):o._setEffect(e,t,n).then((function(e){s(e)}))}))]}))}))},t.prototype._setEffect=function(e,t,n,i){return oe(this,void 0,Promise,(function(){var r,s=this;return se(this,(function(a){return R.b_.time("waiting for AI init..."),$.s.checkEnabled("beautify")&&!this._meshVertex?[2,new Promise((function(r){clearTimeout(s._meshVertexTimer),s._meshVertexTimer=setInterval((function(){R.b_.info("waiting for AI init..."),s._meshVertex&&(R.b_.info("waiting for AI init...done"),clearTimeout(s._meshVertexTimer),s._setEffect(e,t,n,i).then((function(){r(s._effects)})))}),200)}))]:(R.b_.timeEnd("waiting for AI init..."),r="uid_"+Math.floor(1e8*Math.random()),[2,new Promise((function(a,c){return oe(s,void 0,void 0,(function(){var s,c,h,u,l,p,f,d,_,y,m,b,v,g,k,w,x,S=this;return se(this,(function(M){switch(M.label){case 0:for(s=[].concat(this._effects),c=[],h=[],u=[],l=[],p=[],f=[],d=[],_=[],e.length||(this.filterActivedEffect=null),y=[],m=function(i){var r=s.findIndex((function(t){return t.url===e[i]}));if(r>-1)c.push(s[r]),s[r],h.push(t[i]),u.push(n[i]),s.splice(r,1);else{var a=e[i];_.push(function(e){return oe(this,void 0,Promise,(function(){var t,n;return se(this,(function(i){switch(i.label){case 0:return[4,(t=new o.pF).init()];case 1:return i.sent(),[4,t.preload(e)];case 2:return i.sent(),n=t.readJSON("content.json",e),R.D4.info("download:",e,n),[2,n]}}))}))}(a)),y.push(a),p.push(t[i]),f.push(n[i])}},b=0;b<e.length;b++)m(b);return[4,Promise.all(_)];case 1:for(v=M.sent(),!1,g=!1,k=0;k<v.length;k++)w=y[k],x=void 0,(x=new G(w,this._makeupContainer,this._finalContainer,this._app3d,this._options,this._meshVertex,this._faceLandmarks,this.lipVertex,this._angles,p[k],this._canvas)).filterIntensity=f[k],v[k].sticker3d&&v[k].sticker3d.length&&(g=!0),x.renderer=this._renderer,l.push(x);return R.b_.time("require 3d lib"),this.lib3dLoaded||!g?[3,3]:i&&!i()?[2]:(ce.info("require 3d lib"),[4,this.loadLib3d()]);case 2:M.sent(),this.lib3dLoaded=!0,M.label=3;case 3:return R.b_.timeEnd("require 3d lib"),R.b_.info("check all new Effects",l,s),l.forEach((function(e){d.push(e.load().then((function(){return e.intensity=e.intensity,S._app3d||"face"!==e.type||(S._app3d=e.app3d),S._appHand3d||"hand"!==e.type||(S._appHand3d=e.app3d),e})).catch((function(e){ce.warn("effect load error",e)})))})),R.b_.time("renderer parse effect"),Promise.all(d).then((function(e){R.b_.timeEnd("renderer parse effect"),R.b_.time("renderer apply effect");for(var t=!1,n=0;n<l.length;n++){var i=l[n];S.latestEffectUrls&&-1===S.latestEffectUrls.indexOf(i.getUrl())&&(i.destroy(),t=!0)}if(t)ce.info(r+"end");else{s.forEach((function(e){e.remove()})),S._effects=c,c.forEach((function(e,t){e.intensity=h[t],e.filterIntensity=u[t]}));for(n=0;n<l.length;n++){i=l[n];S._effects.push(i),i.apply({filterTarget:S._baseSprite,filterCallback:function(){}})}s.forEach((function(e){e.destroy()})),R.b_.timeEnd("renderer apply effect"),a(S._effects)}})),[2]}}))}))}))])}))}))},t.prototype.setEffectJSON=function(e){return oe(this,void 0,void 0,(function(){var t,n,i,r,o,s=this;return se(this,(function(a){switch(a.label){case 0:return n=e.sticker3d,i=e.hand,n&&n.length&&!this.lib3dLoaded?(ce.info("require 3d lib"),[4,this.loadLib3d()]):[3,2];case 1:a.sent(),this.lib3dLoaded=!0,a.label=2;case 2:return i&&i.length&&!this.libHand3dLoaded?(ce.info("require 3d hand lib"),[4,this.loadHand3d()]):[3,4];case 3:a.sent(),this.libHand3dLoaded=!0,a.label=4;case 4:return r=!1,(o=function(){$.s.checkEnabled("beautify")&&s._meshVertex&&(t&&clearTimeout(t),r=!0,s.getJSONEffectForFace(e)),$.s.checkEnabled("handLandmark")&&i&&i.length&&(r=!0,s.getJSONEffectForHand(e)),r||(t=setTimeout(o,20))})(),[2]}}))}))},t.prototype.getJSONEffectForHand=function(e){var t=this,n=new X(e,this._appHand3d,this._options,this._canvas);n.renderer=this._renderer,R.b_.info("getJSONEffectForHand"),n.load().then((function(){t._appHand3d||(t._appHand3d=n.app3d),n.apply()}))},t.prototype.getJSONEffectForFace=function(e){var t=this,n=new H(e,this._makeupContainer,this._finalContainer,this._app3d,this._options,this._meshVertex,this._faceLandmarks,this.lipVertex);return n.renderer=this._renderer,n.load().then((function(){t._app3d||(t._app3d=n.app3d);var e=[].concat(t._effects);t._effects=[n],n.apply({filterTarget:t._baseSprite}),e.forEach((function(e){e.destroy()}))})),n},t.prototype.setExclusiveFilter=function(e,t){var n=this;return void 0===t&&(t=1),new Promise((function(i,r){!function(){if(n.exclusiveFilter&&n.exclusiveFilter.getUrl()===e)n.exclusiveFilter.intensity=t,n.exclusiveFilter.filterIntensity=t;else{var r=new G(e,n._makeupContainer,n._finalContainer,n._app3d,n._options,n._meshVertex,n._faceLandmarks,n.lipVertex,n._angles,t);r.filterIntensity=t,r.load().then((function(){n.exclusiveFilter&&n.exclusiveFilter.destroy(),n.exclusiveFilter=r,r.renderer=n._renderer,r.apply({filterTarget:n._baseSprite}),i()}))}}()}))},t.prototype.resize=function(t,n,i){void 0===i&&(i=!0),e.prototype.resize.call(this,t,n),ce.info("renderer resize",t,n,i),this._options.width=t,this._options.height=n,this._renderer.resize(t,n),this.background&&this.background.resize(t,n),this._app3d?this._app3d.resize(t,n):this._avatar3d&&this._avatar3d.resize(t,n),this._makeupRenderTexture&&this._makeupRenderTexture.resize(t,n),this._baseRenderTexture&&this._baseRenderTexture.resize(t,n),i&&this._baseSprite&&(this._baseSprite.width=t,this._baseSprite.height=n,this._baseSprite.position.set(t/2,n/2),this._baseSprite.anchor.set(.5,.5),this._baseSprite.scale.set(1)),this._effects.forEach((function(e){e.resize(t,n)}))},t.prototype.disableExclusiveFilter=function(){this.exclusiveFilter&&this.exclusiveFilter.remove()},t.prototype.enableExclusiveFilter=function(){this.exclusiveFilter&&this.exclusiveFilter.apply({filterTarget:this._baseSprite,filterCallback:function(){}})},t.prototype.disableEffects=function(e){void 0===e&&(e=!1),this._effects.forEach((function(t){!e&&t.isPureFilter||"hand"===t.type||t.remove()}))},t.prototype.enableEffects=function(){var e=this;this._effects.forEach((function(t){t.apply({filterTarget:e._baseSprite,filterCallback:function(){}})}))},t.prototype.removeExclusiveFilter=function(){this.exclusiveFilter&&(this.exclusiveFilter.destroy(),this.exclusiveFilter=null)},t.prototype.initAvatarApp=function(e,t){return oe(this,void 0,void 0,(function(){return se(this,(function(e){return[2]}))}))},t.prototype.setAvatar=function(e,t){return oe(this,void 0,void 0,(function(){return se(this,(function(e){return[2]}))}))},t.prototype.registerAvatar=function(e){},t.prototype.reCorrectAvatar=function(){return oe(this,void 0,void 0,(function(){return se(this,(function(e){return[2]}))}))},t.prototype.getCanvas=function(){return this._canvas},t.prototype.setOptions=function(e){},t.prototype.mount=function(e){this._canvas&&e.appendChild(this._canvas)},t.prototype.getCircle=function(e){void 0===e&&(e=5);var t=new a.TC;return t.beginFill(16711680),t.drawCircle(0,0,e),t.endFill(),t},t.preloadEffects=function(e){return oe(this,void 0,Promise,(function(){var t,n,i,r,s,a,c;return se(this,(function(h){switch(h.label){case 0:return e.length?[4,(t=new o.pF).init()]:[2];case 1:h.sent(),n=[];try{for(i=ae(e),r=i.next();!r.done;r=i.next())(s=r.value)&&n.push(t.preload(s))}catch(e){a={error:e}}finally{try{r&&!r.done&&(c=i.return)&&c.call(i)}finally{if(a)throw a.error}}return[2,Promise.all(n).then((function(){return Promise.resolve()})).catch((function(e){return Promise.reject(e)}))]}}))}))},t.prototype.handleLoading=function(){var e=this._options,n=e.enableLoadingIcon,i=e.loadingIconOptions,r=void 0===i?{}:i;if(n){var o=t.loading=new Z.Z(r);o.zIndex=20;var s=this._options,a=s.width,c=s.height;o.x=a/2,o.y=c/2,this._stage.addChild(o)}},t.prototype.showLoading=function(){t.loading&&t.loading.show()},t.prototype.hideLoading=function(){t.loading&&t.loading.hide()},t.prototype.destroy=function(e){void 0===e&&(e=!0),this.hideLoading(),t.loading&&t.loading.destroy(),e&&he.baseTexture&&(he.baseTexture.destroy(!0),he.baseTexture=null),this._destroyed=!0,this._effects.forEach((function(e){e.destroy()})),this.exclusiveFilter&&this.exclusiveFilter.destroy(),this._stage&&this._stage.destroy(!0),this._renderer&&this._renderer.destroy(!0),this.background&&this.background.destroy(),this._app3d&&this._app3d.destroy(),this._appHand3d&&this._appHand3d.destroy(),this._meshVertexTimer&&clearTimeout(this._meshVertexTimer),this.destroyAvatar()},t.prototype.destroyAvatar=function(){this._avatar3d&&(this._avatar3d.destroy(),this._avatar3d=null)},ie([(0,l.M)("ArRenderer"),re("design:type",Function),re("design:paramtypes",[Object]),re("design:returntype",void 0)],t.prototype,"destroy",null),t}(ee.F)}}]);
1
+ var self = wx;(self.webpackChunktencentcloud_webar=self.webpackChunktencentcloud_webar||[]).push([[321],{7505:(e,t,n)=>{n.d(t,{g:()=>ce});var i,r=n(3044),o=n(3650),s=n(1206),a=n(617),c=n(9560),h=n(1347),u=n(1084),l=(i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},i(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),p=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s},f=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},d=function(){function e(e,t,n,i,r){this._destroyed=!1,this.type="makeup",this._parentIntensity=1,this._jsonIntensity=1,this.textures=[],this._dir=t,this._options=e,this._container=n,this.renderer=i,this.type=r||"makeup"}return Object.defineProperty(e.prototype,"parentIntensity",{get:function(){return this._parentIntensity},set:function(e){this.shader&&(this.shader.uniforms.parentIntensity=e);this._parentIntensity=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lipMask",{set:function(e){null===e?(this._mesh.removeChild(this._cacheMask),this._mesh.mask=e):(this._mesh.addChild(e),this._mesh.mask=e,this._cacheMask=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"visible",{set:function(e){this.shader&&(this.shader.uniforms.enable=e?1:0,this.renderer.render(this._mesh,{renderTexture:this._maskRenderTexure}))},enumerable:!1,configurable:!0}),e.prototype.updateGeometry=function(e){this._destroyed||"lips"===this.type&&this.renderer.render(this._mesh,{renderTexture:this._maskRenderTexure})},e.prototype.resize=function(e,t){var n;null===(n=this._maskRenderTexure)||void 0===n||n.resize(e,t)},e.prototype.renderMesh=function(){this.renderer.render(this._mesh,{renderTexture:this._maskRenderTexure})},e.prototype.drawMeshBatch=function(e,t,n){var i=this;if(!this._destroyed){this._blendMode=e;var r=this._getVertexShader(),o="\n precision mediump float;\n varying vec2 vUvs;\n ".concat(t.map((function(e,t){return"uniform sampler2D uSamplerMakeup".concat(t,";")})).join("\n"),"\n ").concat(t.map((function(e,t){return"uniform float intensity".concat(t,";")})).join("\n"),"\n uniform float parentIntensity;\n uniform int enable;\n \n void main() {\n if (enable == 0) {\n gl_FragColor = vec4(1.0,0.0,0.0,0.0);\n return;\n }\n \n vec4 result = vec4(0.0);\n\n ").concat(t.map((function(e,t){return"\n vec4 color".concat(t," = texture2D(uSamplerMakeup").concat(t,", vUvs);\n float a").concat(t," = color").concat(t,".a;\n float realIntensity").concat(t," = intensity").concat(t," * parentIntensity;\n result = result * (1.0 - a").concat(t," * realIntensity").concat(t,") + texture2D(uSamplerMakeup").concat(t,", vUvs) * realIntensity").concat(t,";\n ")})).join("\n"),"\n\n gl_FragColor = result;\n }"),a={enable:1};a.parentIntensity=this.parentIntensity,t.forEach((function(e,t){var n="default"===i._dir?e.src:"".concat(i._dir,"|").concat(e.src),r=s.P6.kN[n];a["uSamplerMakeup".concat(t)]=r,a["intensity".concat(t)]=e.intensity,i.textures.push(r)}));var h=s.ex.from(r,o,a);this.shader=h;var u=new c.Kj(n,h),l=this._options,p=l.width,f=l.height;if(t.some((function(e){return"lips"===e.type}))){var d=new s.jd({width:p,height:f});this._maskRenderTexure=new s.TI(d),this.renderer.render(u,{renderTexture:this._maskRenderTexure});var _=new c.jy(this._maskRenderTexure);_.blendMode_1=e,this._mesh=u,this._container.addChild(_)}else u.blendMode_1=e,this._mesh=u,this._container.addChild(u);return u}},e.prototype.drawMesh=function(e,t,n,i){if(!this._destroyed){this._blendMode=t;var r=this._getVertexShader(),o="default"===this._dir?e:"".concat(this._dir,"|").concat(e),a={enable:1,uSamplerMakeup:s.P6.kN[o],intensity:n,parentIntensity:this.parentIntensity},h=s.ex.from(r,"\n precision mediump float;\n varying vec2 vUvs;\n uniform sampler2D uSamplerMakeup;\n uniform float intensity;\n uniform float parentIntensity;\n uniform int enable;\n\n \n void main() {\n // if (enable == 0) {\n // gl_FragColor = vec4(1.0,0.0,0.0,0.0);\n // return;\n // }\n \n vec4 color = texture2D(uSamplerMakeup, vUvs);\n color = vec4(color.rgb, color.a) * intensity * parentIntensity;\n gl_FragColor = color;\n gl_FragColor.a *= float(enable);\n }",a);this.shader=h;var u=new c.Kj(i,h),l=this._options,p=l.width,f=l.height;if("lips"===this.type){var d=new s.jd({width:p,height:f});this._maskRenderTexure=new s.TI(d),this.renderer.render(u,{renderTexture:this._maskRenderTexure});var _=new c.jy(this._maskRenderTexure);_.blendMode_1=t,this._mesh=u,this._container.addChild(_)}else u.blendMode_1=t,this._mesh=u,this._container.addChild(u);return u}},e.prototype._getVertexShader=function(){return"\n precision mediump float;\n attribute vec2 aVertexPosition;\n attribute vec2 aUvs;\n uniform mat3 translationMatrix;\n uniform mat3 projectionMatrix;\n varying vec2 vUvs;\n\n\n void main() {\n vUvs = aUvs;\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n }"},e.prototype.destroy=function(){this._destroyed=!0,this._mesh&&(this._mesh.destroy({children:!0,texture:!1,baseTexture:!1}),this._mesh.mask=null,this._mesh=null),this._maskRenderTexure&&this._maskRenderTexure.destroy(!1)},p([(0,u.M)("MakeupLayer"),f("design:type",Function),f("design:paramtypes",[Array]),f("design:returntype",void 0)],e.prototype,"updateGeometry",null),p([(0,u.M)("MakeupLayer"),f("design:type",Function),f("design:paramtypes",[]),f("design:returntype",void 0)],e.prototype,"destroy",null),e}(),_=function(e){function t(t,n,i,r,o,a,c){var h=e.call(this,t,n,c)||this;return h._maskGraphics=new s.TC,h.maxLConSize=0,h.maxRConSize=0,h._parentIntensity=1,h.jsonIntensity=o,h.getTexture(i,r),h._config=a,h}var n;return l(t,e),Object.defineProperty(t.prototype,"parentIntensity",{get:function(){return this._parentIntensity},set:function(e){this._container&&(this._container.alpha=this.jsonIntensity*e),this._parentIntensity=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"visible",{set:function(e){this._container.visible=e},enumerable:!1,configurable:!0}),t.prototype.getTexture=function(e,t){this._blendMode=t;var n="default"===this._dir?e:"".concat(this._dir,"|").concat(e),i=s.P6.kN[n],r=new c.jy(i),o=new c.jy(i.clone());r.blendMode_1=t,o.blendMode_1=t,r.anchor.set(.5),o.anchor.set(.5),this._leftIris=r,this._rightIris=o;var a=new s.W2;this._container.addChild(a),this._maskGraphics||(this._maskGraphics=new s.TC),a.addChild(this._maskGraphics),a.addChild(r),a.addChild(o),a.alpha=this.parentIntensity*this.jsonIntensity,a.mask=this._maskGraphics,this._container=a},t.prototype.setIrisProps=function(e){if(e.length){var t=this._config.getConfigByKeys(["POINTS_MAP","LEFT_IRIS","RIGHT_IRIS","LEFT_EYE_ORDER","RIGHT_EYE_ORDER"]),n=t.POINTS_MAP,i=(t.LEFT_IRIS,t.RIGHT_IRIS,t.LEFT_EYE_ORDER),r=t.RIGHT_EYE_ORDER,o=(n.left_eye_center,n.right_eye_center,(0,h.Sp)(e[52],e[55])),s=(0,h.Sp)(e[58],e[61]),a=Math.max(this.maxLConSize,(0,h.Sp)(e[72],e[73])/o),c=Math.max(this.maxRConSize,(0,h.Sp)(e[75],e[76])/s),u=o*a,l=o*a,p=s*c,f=s*c;this.maxLConSize=Math.max(Math.min(a,.7),.4),this.maxRConSize=Math.max(Math.min(c,.7),.4);var d=(0,h.qg)(e[74],e[104]),_=(0,h.qg)(e[77],e[105]),y=this._leftIris,m=this._rightIris;y.width=u,y.height=l,y.x=d.x,y.y=d.y,m.width=p,m.height=f,m.x=_.x,m.y=_.y,this._maskGraphics.clear(),this._drawMaskGraphics(i,e),this._drawMaskGraphics(r,e)}},t.prototype._drawMaskGraphics=function(e,t){var n=this,i=this._maskGraphics;i.beginFill(16724736),i.lineStyle(1,16767232,1);var r=[];e.forEach((function(o,s){var a=t[o],c=n._getPixelPosition(a.x,a.y),h=c.x,u=c.y;r.push({x:h,y:u}),0===s?i.moveTo(h,u):s===e.length-1?(i.closePath(),i.endFill()):i.lineTo(h,u)}))},t.prototype._getPixelPosition=function(e,t){return{x:e,y:t}},t.prototype.destroy=function(){this._leftIris&&this._leftIris.destroy({children:!0,texture:!1,baseTexture:!1}),this._rightIris&&this._rightIris.destroy({children:!0,texture:!1,baseTexture:!1}),this._maskGraphics&&this._maskGraphics.destroy({children:!0,texture:!1,baseTexture:!1})},p([(0,u.M)("IrisLayer"),f("design:type",Function),f("design:paramtypes",["function"==typeof(n="undefined"!=typeof Array&&Array)?n:Object]),f("design:returntype",void 0)],t.prototype,"setIrisProps",null),t}(d),y=n(3120),m=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s},b=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},g=function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((i=i.apply(e,t||[])).next())}))},v=function(e,t){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},k=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},w=function(){function e(e,t,n){e&&(this._options=e),t&&(this._lipVertex=t),n&&(this.renderer=n)}return e.prototype.destroy=function(){var e=this._lipMask;this._lipMask=null;try{e.destroy(!0)}catch(e){}try{this._lipMaskMesh.destroy(!0),this._lipMaskMesh=null}catch(e){}try{this._maskRenderTexture.destroy(!0),this._maskRenderTexture=null}catch(e){}this._config=null;try{this._maskSprite.destroy(!0),this._maskSprite=null}catch(e){}},e.prototype.load=function(){return g(this,void 0,void 0,(function(){var e,t,n,i,r;return v(this,(function(o){switch(o.label){case 0:return this._config?[3,2]:(this._config=new a.M,[4,this._config.load()]);case 1:o.sent(),o.label=2;case 2:return this._lipMask?[3,4]:[4,this._getMask()];case 3:o.sent(),o.label=4;case 4:return this._maskSprite&&!this._maskSprite.destroyed||(e=this._options,t=e.width,n=e.height,i=new s.jd({width:t,height:n}),this._maskRenderTexture=new s.TI(i),r=new s.jy(this._maskRenderTexture),this._maskSprite=r),[2,{maskSprite:this._maskSprite,lipmask:this._lipMask,lipmaskmesh:this._lipMaskMesh}]}}))}))},e.prototype.update=function(e){this._lipMaskMesh&&(this._lipMaskMesh.geometry.getBuffer("aVertexPosition").update(e),this.render())},e.prototype.render=function(){this.renderer&&this._lipMask&&this.renderer.render(this._lipMask,{renderTexture:this._maskRenderTexture})},e.prototype._getMask=function(){return g(this,void 0,void 0,(function(){var e,t,n,i,r,o,a,c,h;return v(this,(function(u){switch(u.label){case 0:return this._lipMask?[2,this._lipMask]:(e=new s.W2,(t=new s.jy(s.xE.WHITE)).width=this._options.width,t.height=this._options.height,e.addChild(t),n=this._lipVertex,i=this._config.getDataConfig(29),[4,this._loadLipImage()]);case 1:return r=u.sent(),o=(new s.wG).addAttribute("aVertexPosition",n).addAttribute("aUvs",i),"\n precision mediump float;\n attribute vec2 aVertexPosition;\n attribute vec2 aUvs;\n uniform mat3 translationMatrix;\n uniform mat3 projectionMatrix;\n varying vec2 vUvs;\n\n\n void main() {\n vUvs = aUvs;\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n }","\n precision mediump float;\n varying vec2 vUvs;\n uniform sampler2D uSamplerMakeup;\n\n \n void main() {\n gl_FragColor = texture2D(uSamplerMakeup, vUvs);\n }",a={uSamplerMakeup:r},c=s.ex.from("\n precision mediump float;\n attribute vec2 aVertexPosition;\n attribute vec2 aUvs;\n uniform mat3 translationMatrix;\n uniform mat3 projectionMatrix;\n varying vec2 vUvs;\n\n\n void main() {\n vUvs = aUvs;\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n }","\n precision mediump float;\n varying vec2 vUvs;\n uniform sampler2D uSamplerMakeup;\n\n \n void main() {\n gl_FragColor = texture2D(uSamplerMakeup, vUvs);\n }",a),h=new s.Kj(o,c),this._lipMaskMesh=h,e.addChild(h),this._lipMask=e,[2,e]}}))}))},e.prototype._loadLipImage=function(){return g(this,void 0,Promise,(function(){var e=this;return v(this,(function(t){return[2,new Promise((function(t,n){return g(e,void 0,void 0,(function(){var e,n,i;return v(this,(function(r){switch(r.label){case 0:return[4,(e=new y.KI).init()];case 1:return n=r.sent(),[4,e.loadImage(n)];case 2:return i=r.sent(),t(i[y.X_]),[2]}}))}))}))]}))}))},m([(0,u.M)("ReuseableLipMask"),b("design:type",Function),b("design:paramtypes",[]),b("design:returntype",void 0)],e.prototype,"destroy",null),m([(0,u.o)("ReuseableLipMask"),b("design:type",Function),b("design:paramtypes",[]),b("design:returntype",Promise)],e.prototype,"_getMask",null),e}(),x=function(){function e(e,t,n,i,r,o,a,c){void 0===c&&(c=1),this._container=new s.W2,this._makeupMeshes=[],this._visible=!0,this.mouthShut=!0,this._key=e,this._data=t,this._options=n,this.mesh=i,this.lipmesh=o,this.faceLandMarks=r,this.renderer=a,this.parentIntensity=c;var h=new s.jy(s.xE.WHITE);h.alpha=0,h.width=n.width,h.height=n.height,this._container.addChild(h)}var t;return Object.defineProperty(e.prototype,"visible",{get:function(){return this._visible},set:function(e){this._target&&e!==this._visible&&(this._visible=e,this._makeupMeshes.forEach((function(t){t.visible=e})),this._irises&&(this._irises.visible=e))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mesh",{set:function(e){(this._meshVertex=e,this.geometry)&&(this.geometry.getBuffer("aVertexPosition").update(e),this._makeupMeshes.forEach((function(t){t.updateGeometry(e)})))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lipmesh",{set:function(e){this._lipVertex=e,this._lipMaskIns&&this._lipMaskIns.update(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"faceLandMarks",{set:function(e){var t=this;e&&e.length&&(this._irises&&this._irises.setIrisProps(e),(0,h.Sp)(e[98],e[102])<.03*(0,h.Sp)(e[0],e[32])?this.mouthShut||(this._makeupMeshes.forEach((function(e){"lips"===e.type&&(e.lipMask=null)})),this.mouthShut=!0):this.mouthShut&&(this._makeupMeshes.forEach((function(e){"lips"===e.type&&t._lipMaskIns&&(e.lipMask=t._lipMaskIns._maskSprite)})),this.mouthShut=!1))},enumerable:!1,configurable:!0}),e.prototype.resize=function(e,t){this._makeupMeshes.forEach((function(n){n.resize(e,t)}))},Object.defineProperty(e.prototype,"parentIntensity",{get:function(){return this._intensity},set:function(e){this._irises&&(this._irises.parentIntensity=e),this._makeupMeshes.forEach((function(t){t.parentIntensity=e})),this._intensity=e},enumerable:!1,configurable:!0}),e.prototype.renderMesh=function(){this._lipMaskIns&&this._lipMaskIns.render(),this._makeupMeshes.forEach((function(e){e.renderMesh()}))},e.prototype.load=function(){return g(this,void 0,void 0,(function(){var e,t,n,i,r,o,s,c,h;return v(this,(function(u){switch(u.label){case 0:return this._config=new a.M,[4,this._config.load()];case 1:if(u.sent(),e=this._data,t={},e&&e.length){try{for(n=k(e),i=n.next();!i.done;i=n.next())"iris"===(r=i.value).type?this._irises=this._getIris(r.src,r.blend,r.intensity):"contour"===r.type?(s=this._getMeshLayer(r.src,r.blend,r.intensity,r.type),this._makeupMeshes.push(s)):(o=r.blend+"",t[o]||(t[o]=[]),t[o].push({src:r.src,intensity:r.intensity,type:r.type}))}catch(e){c={error:e}}finally{try{i&&!i.done&&(h=n.return)&&h.call(n)}finally{if(c)throw c.error}}for(o in t)s=this._getMeshLayerByBlendMode(parseInt(o),t[o]),this._makeupMeshes.push(s)}return[4,this._initLipMask()];case 2:return u.sent(),[2]}}))}))},e.prototype._getIris=function(e,t,n){return new _(this._options,this._key,e,t,n,this._config,this._container)},e.prototype._getMeshLayerByBlendMode=function(e,t){var n=t.some((function(e){return"lips"===e.type}))?"lips":"makeup",i=new d(this._options,this._key,this._container,this.renderer,n);i.parentIntensity=this.parentIntensity;var r=this._config.getDataConfig(26);if(!this.geometry){var o=(new s.wG).addAttribute("aVertexPosition",this._meshVertex).addAttribute("aUvs",r);this.geometry=o}return i.drawMeshBatch(e,t,this.geometry),i},e.prototype._getMeshLayer=function(e,t,n,i){var r=new d(this._options,this._key,this._container,this.renderer,i);r.parentIntensity=this.parentIntensity;var o=this._config.getDataConfig(26);if(!this.geometry){var a=(new s.wG).addAttribute("aVertexPosition",this._meshVertex).addAttribute("aUvs",o);this.geometry=a}return r.drawMesh(e,t,n,this.geometry),r},e.prototype.apply=function(e){this._target=e,this._applyMakeup(e)},e.prototype.remove=function(){this._removeMakeup(this._target)},e.prototype._applyMakeup=function(e){e.filters||(e.filters=[]),e.addChild(this._container)},e.prototype._removeMakeup=function(e){e.filters&&e.removeChild(this._container)},e.prototype._initLipMask=function(){return g(this,void 0,void 0,(function(){var e,t,n=this;return v(this,(function(i){switch(i.label){case 0:return(e=new w(this._options,this._lipVertex,this.renderer))._options=this._options,e._lipVertex=this._lipVertex,e.renderer=this.renderer,this._lipMaskIns=e,[4,e.load()];case 1:return t=i.sent().maskSprite,this._makeupMeshes.forEach((function(e){"lips"!==e.type||n.mouthShut||(e.lipMask=t)})),[2]}}))}))},e.prototype.destroy=function(){this.remove(),this._makeupMeshes.forEach((function(e){return e.destroy()})),this._makeupMeshes=[],this._irises&&this._irises.destroy(),this._irises=null,this._container.destroy(),this._target=null,this._lipMaskIns&&this._lipMaskIns.destroy()},m([(0,u.M)("Makeup"),b("design:type",Function),b("design:paramtypes",["function"==typeof(t=void 0!==s.W2&&s.W2)?t:Object]),b("design:returntype",void 0)],e.prototype,"_removeMakeup",null),m([(0,u.M)("Makeup"),b("design:type",Function),b("design:paramtypes",[]),b("design:returntype",void 0)],e.prototype,"destroy",null),e}(),M=n(3125),S=n(401),P=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s},T=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},C=function(){function e(e,t,n,i,r,o,a,c){this._container=new s.W2,this._name=e,this._src=t,this._target=i,this._config=n,this._jsonIntensity=n.intensity,this._landmarks=r,this._options=o,this._key=a,this._angles=c}return Object.defineProperty(e.prototype,"parentIntensity",{get:function(){return this._parentIntensity},set:function(e){this._parentIntensity=e,this._sticker&&(this._sticker.alpha=this._jsonIntensity*e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"faceLandMarks",{set:function(e){this._landmarks=e,this._sticker&&this.setStickerProps()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"angles",{set:function(e){this._angles=e,this._sticker&&this.setStickerProps()},enumerable:!1,configurable:!0}),e.prototype.getCircle=function(e){void 0===e&&(e=5);var t=new s.TC;return t.beginFill(16711680),t.drawCircle(0,0,e),t.endFill(),t},e.prototype.getCircle2=function(e){void 0===e&&(e=5);var t=new s.TC;return t.beginFill(255),t.drawCircle(0,0,e),t.endFill(),t},e.prototype.getDisplay=function(){return this._container},e.prototype.load=function(){var e,t=this;if(this.checkAnimated()){var n=[];this._src.forEach((function(e){var i;i=e.indexOf(".json")>-1?e:"".concat(t._key,"|").concat(JSON.parse(e).meta.image);var o=r.iV[i].textures,s=Object.keys(o).map((function(e){return o[e]}));n=n.concat(s)})),(e=new c.Kg(n)).animationSpeed=(this._config.fps||30)/60,e.play()}else{var i=this._src[0],o=s.P6.kN[i];e=new c.jy(o)}this._config.blend&&(e.blendMode_1=this._config.blend);this._config.wxAnchorOffset;e.width=this._config.width,e.height=this._config.height;var a=[.5,.5];this._config.anchor&&(a=this._config.anchor),e.anchor.set(a[0],a[1]),e.alpha=this._jsonIntensity*this.parentIntensity,this._sticker=e,this._container.addChild(this._sticker),this._container.convertTo3d(),this.setStickerProps()},e.prototype.setStickerProps=function(){var e=this._config,t=this._landmarks,n=S.Jp.map((function(e){return t[e]})),i=(0,h.Sp)(n[0],n[1]),r=e.wxAnchorArea,o=(e.wxAnchorOffset,e.wxWeights),s=i/S.jw,a=r.map((function(e){var n=t[e];return{x:n.x,y:n.y,z:0}}));this._container.scale.set(s);var c={x:a[0].x*o[0]+a[1].x*o[1]+a[2].x*o[2],y:a[0].y*o[0]+a[1].y*o[1]+a[2].y*o[2]};this._container.position.x=c.x,this._container.position.y=c.y,this._angles&&(this._container.euler.z=this._angles.roll,this._container.euler.y=this._angles.yaw,this._container.euler.x=this._angles.pitch)},e.prototype.checkAnimated=function(){if(this._src instanceof Array&&this._src.length>1)return!0;try{return JSON.parse(this._src[0]),!0}catch(e){return"json"===this._src[0].split(".").pop()}},e.prototype.tick=function(){},e.prototype.apply=function(){},e.prototype.remove=function(){},e.prototype.destroy=function(){this._sticker.destroy(),this._container.destroy(),this._sticker=null,this._target=null},P([(0,u.M)("StickerLayer"),T("design:type",Function),T("design:paramtypes",[]),T("design:returntype",Boolean)],e.prototype,"checkAnimated",null),P([(0,u.M)("StickerLayer"),T("design:type",Function),T("design:paramtypes",[]),T("design:returntype",void 0)],e.prototype,"destroy",null),e}(),E=function(){function e(e,t,n,i,r,o,s){void 0===s&&(s=1);var a=this;this._stickers=[],this._visible=!0,this._parentIntensity=1,this._target=n,this._options=r,this._landmarks=i;var c=new M.LE;c.setPlanes(400,10,1e4,!0),this._camera=c,this._stickers=t.map((function(t){var s=new C(t.name,t.src,t,n,i,r,e,o);return s.parentIntensity=a.parentIntensity,s.load(),a._camera.addChild(s.getDisplay()),s}))}return Object.defineProperty(e.prototype,"parentIntensity",{get:function(){return this._parentIntensity},set:function(e){this._stickers.forEach((function(t){t.parentIntensity=e})),this._parentIntensity=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"faceLandMarks",{set:function(e){this._stickers.forEach((function(t){t.faceLandMarks=e}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"angles",{set:function(e){this._stickers.forEach((function(t){t.angles=e}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"visible",{get:function(){return this._visible},set:function(e){this._target&&e!==this._visible&&(this._visible=e,e?this.apply():this.remove())},enumerable:!1,configurable:!0}),e.prototype.tick=function(){this._stickers.forEach((function(e){return e.tick()}))},e.prototype.apply=function(){this._target.addChild(this._camera)},e.prototype.remove=function(){this._target.removeChild(this._camera)},e.prototype.destroy=function(){this.remove(),this._stickers.forEach((function(e){return e.destroy()})),this._camera.destroy(),this._stickers=[]},e}(),I=n(6109),j=n(201);const O=function(){function e(){if(e.instance)throw new Error("TextureRefManager 已存在实例,请使用 getInstance() 获取");this.refCounts=new Map}return e.getInstance=function(){return e.instance||(e.instance=new e),e.instance},e.prototype.addRef=function(e){var t=this.refCounts.get(e)||0;this.refCounts.set(e,t+1)},e.prototype.removeRef=function(e){var t=this.refCounts.get(e)||0;return t<=1?(this.refCounts.delete(e),!0):(this.refCounts.set(e,t-1),!1)},e.prototype.getRefCount=function(e){return this.refCounts.get(e)||0},e.prototype.clear=function(){this.refCounts.clear()},e}();var R=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),F=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s},L=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},V=function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((i=i.apply(e,t||[])).next())}))},A=function(e,t){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},N=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},U=(0,I.jl)("Effect"),D=function(){function e(e,t,n,i,r,o,s,a,c,h,u){this.type="face",this._filters=[],this._destroyed=!1,this._visible=!0,this._intensity=1,this._filterIntensity=1,this.localSpriteSheets={},this._filtersActived=!0,this._target=t,this._stickerTarget=n,this._url=e,this._key=e,this._options=r,this.mesh=o,this.lipmesh=a,this.faceLandMarks=s,c&&(this.angles=c),void 0!==h&&(this.intensity=h),this._app3d=i,this._canvas=u}var t;return Object.defineProperty(e.prototype,"isPureFilter",{get:function(){var e=this._config;return!!e&&((!e.makeup||!e.makeup.length)&&((!e.sticker||!e.sticker.length)&&((!e.sticker3d||!e.sticker3d.length)&&(!e.beautify||!Object.keys(e.beautify).find((function(t){return!!e.beautify[t]}))))))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"filterActived",{get:function(){return this._filtersActived},set:function(e){e!==this._filtersActived&&(this._filterTarget&&(e?this._applyFilter(this._filterTarget):this._removeFilter(this._filterTarget)),this._filtersActived=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"url",{get:function(){return this._url},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"app3d",{get:function(){return this._app3d},set:function(e){this._app3d=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"intensity",{get:function(){return this._intensity},set:function(e){e>1&&(e=1),null!=e&&(this._makeup&&(this._makeup.parentIntensity=e),this._sticker&&(this._sticker.parentIntensity=e),this._intensity=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"filterIntensity",{get:function(){return this._filterIntensity},set:function(e){null!=e&&(this._filters&&this._filters.forEach((function(t){t.uniforms.parentIntensity=e})),this._filterIntensity=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"visible",{get:function(){return this._visible},set:function(e){this._destroyed||(this._visible=e,this._makeup&&(this._makeup.visible=e),this._sticker&&(this._sticker.visible=e),this._app3d&&(this._app3d.visible=e))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mesh",{set:function(e){this._destroyed||(this._meshVertex=e,this._makeup&&(this._makeup.mesh=e))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lipmesh",{set:function(e){this._destroyed||(this._lipVertex=e,this._makeup&&(this._makeup.lipmesh=e))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"faceLandMarks",{get:function(){return this._faceLandMarks},set:function(e){this._destroyed||(this._faceLandMarks=e,this._makeup&&(this._makeup.faceLandMarks=e),this._sticker&&(this._sticker.faceLandMarks=e))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"angles",{set:function(e){this._angles=e,this._sticker&&(this._sticker.angles=e)},enumerable:!1,configurable:!0}),e.prototype.download=function(){return V(this,void 0,Promise,(function(){var e;return A(this,(function(t){switch(t.label){case 0:return[4,this._getLoader()];case 1:return[4,t.sent().preload(this._url)];case 2:return t.sent(),[4,this._getConfig()];case 3:return e=t.sent(),I.D4.info("download:",this._url,e),[2,e]}}))}))},e.prototype.load=function(){return V(this,void 0,Promise,(function(){var e,t,n,i,r,o;return A(this,(function(s){switch(s.label){case 0:return[4,this.download()];case 1:return e=s.sent(),t=e.filter,n=e.makeup,i=e.beautify,r=e.sticker,o=e.sticker3d,[4,this._loadImages(e)];case 2:return s.sent(),this.loadFilter(t),[4,this.setMakeup(n)];case 3:return s.sent(),r?[4,this.loadStickers(r)]:[3,5];case 4:s.sent(),s.label=5;case 5:return[4,this.load3d(o)];case 6:return s.sent(),this.sticker3d=o,[4,this._getLoader()];case 7:return s.sent().removeFromCache(this._url),[2,i]}}))}))},e.prototype._getLoader=function(){return V(this,void 0,void 0,(function(){return A(this,(function(e){switch(e.label){case 0:return this._loader?[3,2]:(this._loader=new r.pF,[4,this._loader.init()]);case 1:e.sent(),e.label=2;case 2:return[2,this._loader]}}))}))},e.prototype._getConfig=function(){return V(this,void 0,void 0,(function(){var e;return A(this,(function(t){switch(t.label){case 0:return this._config?[3,3]:[4,this._getLoader()];case 1:return[4,(e=t.sent()).preload(this._url)];case 2:t.sent(),this._config=e.readJSON("content.json",this._key),t.label=3;case 3:return[2,this._config]}}))}))},e.prototype.hasEyeMakeup=function(){return V(this,void 0,Promise,(function(){var e,t,n,i,r,o,s,a;return A(this,(function(c){switch(c.label){case 0:return[4,this._getConfig()];case 1:e=c.sent(),t=e.makeup,n=!1;try{for(i=N(t),r=i.next();!r.done;r=i.next())if("iris"===(o=r.value).type||"eyes"===o.type){n=!0;break}}catch(e){s={error:e}}finally{try{r&&!r.done&&(a=i.return)&&a.call(i)}finally{if(s)throw s.error}}return[2,n]}}))}))},e.prototype.needDetection=function(){return V(this,void 0,Promise,(function(){var e,t,n,i;return A(this,(function(r){switch(r.label){case 0:return[4,this._getConfig()];case 1:return e=r.sent(),t=e.makeup,n=e.sticker,i=e.sticker3d,[2,t&&t.length||n&&n.length||i&&i.length]}}))}))},e.prototype.hasFilter=function(){return V(this,void 0,Promise,(function(){var e,t;return A(this,(function(n){switch(n.label){case 0:return[4,this._getConfig()];case 1:return e=n.sent(),[2,!(!(t=e.filter)||!t.length)]}}))}))},e.prototype.loadStickers=function(e){return V(this,void 0,Promise,(function(){var t;return A(this,(function(n){return e.length?((t=new E(this._key,e,this._stickerTarget,this.faceLandMarks,this._options,this._angles)).parentIntensity=this.intensity,this._sticker=t,[2]):[2,Promise.resolve()]}))}))},e.prototype.loadSticker3d=function(e){return void 0===e&&(e=[]),V(this,void 0,Promise,(function(){return A(this,(function(e){return[2]}))}))},e.prototype.load3d=function(e){return V(this,void 0,void 0,(function(){return A(this,(function(e){return[2]}))}))},e.prototype.initThreeApp=function(){return V(this,void 0,void 0,(function(){return A(this,(function(e){return[2]}))}))},e.prototype.apply3d=function(){},e.prototype.removeForConsole=function(){},e.prototype.destroyForConosle=function(){},e.prototype.setMakeup=function(e){return e.length?(this._makeup=new x(this._key,e,this._options,this._meshVertex,this.faceLandMarks,this._lipVertex,this.renderer,this.intensity),this._makeup.load()):Promise.resolve()},e.prototype.resize=function(e,t){this._makeup&&this._makeup.resize(e,t)},e.prototype.apply=function(e){this._destroyed||this._applyed||(this.filterActived&&this._applyFilter(e.filterTarget),this._filters.length&&e.filterCallback&&e.filterCallback(),this._filterTarget=e.filterTarget,this._makeup&&this._makeup.apply(this._target),this._sticker&&this._sticker.apply(),this.apply3d(),this._applyed=!0)},e.prototype.getUrl=function(){return this._url},e.prototype.remove=function(){this._makeup&&this._makeup.remove(),this._sticker&&this._sticker.remove(),this.removeForConsole(),this._removeFilter(this._filterTarget),this._applyed=!1},e.prototype.tick=function(){this._sticker&&this._sticker.tick()},e.prototype.tickMesh=function(){this._makeup&&this._makeup.renderMesh()},e.prototype.destroy=function(){this._destroyed=!0,this.remove(),this._makeup&&(this._makeup.destroy(),this._makeup=null),this._sticker&&(this._sticker.destroy(),this._sticker=null),this.destroyForConosle(),this._filters=[],this.clearTexture()},e.prototype.loadFilter=function(e){var t=this;this._destroyed||e&&e.length&&e.forEach((function(e){var n=t._createFilterSync(e.src,e.intensity,t.filterIntensity);t._filters.push(n)}))},e.prototype._applyFilter=function(e){e.filters||(e.filters=[]),e.filters=this._filters.concat(e.filters)},e.prototype._removeFilter=function(e){e&&e.filters&&e.filters.length&&this._filters.forEach((function(t){var n=e.filters.findIndex((function(e){return e===t}));n>-1&&e.filters.splice(n,1)}))},e.prototype._createFilterSync=function(e,t,n){var i="default"===this._key?e:"".concat(this._key,"|").concat(e),r=s.P6.kN[i];return r.baseTexture.scaleMode=s.aH.LINEAR,r.baseTexture.mipmap=s.KI.OFF,new o.f("lut",this._options,{uniforms:{lut:r,intensity:t,parentIntensity:n}})},e.prototype.clearTexture=function(){var e=O.getInstance();for(var t in s.P6.kN)if(t.indexOf(this._key)>-1){var n=s.P6.kN[t];e.removeRef(t)&&(s.xE.removeFromCache(n),n.destroy(!0),r.iV[t]&&r.iV[t]instanceof s.c2&&(r.iV[t].destroy(),delete r.iV[t]))}},e.prototype._loadImages=function(e){var t,n,i=this,o=(e.filter||[]).concat(e.makeup||[]).concat(e.sticker||[]),a=this._loader.getIndeLoader(),c={};this.localSpriteSheets=c;try{for(var h=N(o),u=h.next();!u.done;u=h.next()){var l=u.value;if(l.src instanceof Array)l.src.forEach((function(e,t){var n=i.checkSpriteSheetJSON(e);if(n){var r=n.meta.image,o="".concat(i._key,"|").concat(r);if(O.getInstance().addRef(o),s.P6.kN[o])return;if(0===r.indexOf("blob:")){var h=s.xE.from(r);s.xE.addToCache(h,o)}else a.add(o,r);n.meta.image="",c[o]=n}else{if(O.getInstance().addRef(e),s.P6.kN[e])return;if(a.resources[e])return;a.add(e,e)}}));else{var p="".concat(this._key,"|").concat(l.src);if(O.getInstance().addRef(p),s.P6.kN[p])continue;if(0===l.src.indexOf("blob:")){var f=s.xE.from(l.src);s.xE.addToCache(f,p)}else a.add(p,l.src)}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=h.return)&&n.call(h)}finally{if(t)throw t.error}}return new Promise((function(e){a.load((function(t,n){return V(i,void 0,void 0,(function(){var t,i,o,a,h;return A(this,(function(u){switch(u.label){case 0:for(o in t=function(e){var t;return A(this,(function(n){switch(n.label){case 0:return r.iV[e]?[2,"continue"]:c[e]?(t=new s.c2(s.P6.kN[e],c[e],"@".concat((0,j.u)(),"x")),[4,new Promise((function(n){t.parse((function(){r.iV[e]=t,n()}))}))]):[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}}))},i=[],s.P6.kN)i.push(o);a=0,u.label=1;case 1:return a<i.length?(h=i[a],[5,t(h)]):[3,4];case 2:u.sent(),u.label=3;case 3:return a++,[3,1];case 4:for(h in n)r.iV[h]||c[h]||(r.iV[h]=n[h]);return e(),[2]}}))}))}))}))},e.prototype.checkSpriteSheetJSON=function(e){try{return JSON.parse(e)}catch(e){return null}},F([(0,u.M)("Effect"),L("design:type",Function),L("design:paramtypes",[]),L("design:returntype",void 0)],e.prototype,"remove",null),F([(0,u.M)("Effect"),L("design:type",Function),L("design:paramtypes",[]),L("design:returntype",void 0)],e.prototype,"destroy",null),F([(0,u.M)("Effect"),L("design:type",Function),L("design:paramtypes",["function"==typeof(t=void 0!==s.W2&&s.W2)?t:Object]),L("design:returntype",void 0)],e.prototype,"_removeFilter",null),e}(),z=function(e){function t(t,n,i,r,o,s,a,c){var h=e.call(this,"default",n,i,r,o,s,a,c)||this;return h._json=t,h._app3d=r,h}return R(t,e),t.prototype.load=function(){return V(this,void 0,Promise,(function(){var e,t,n,i,r,o;return A(this,(function(s){switch(s.label){case 0:return e=this._json,t=e.filter,n=e.makeup,i=e.beautify,r=e.sticker,o=e.sticker3d,[4,this._loadImages(e)];case 1:return s.sent(),this.loadFilter(t),[4,this.setMakeup(n)];case 2:return s.sent(),r?[4,this.loadStickers(r)]:[3,4];case 3:s.sent(),s.label=4;case 4:return o?this._app3d?[3,6]:[4,this.initThreeApp()]:[3,8];case 5:s.sent(),s.label=6;case 6:return[4,this.loadSticker3d(o||[])];case 7:s.sent(),s.label=8;case 8:return[2,i]}}))}))},t.prototype.loadImage=function(){return V(this,void 0,void 0,(function(){return A(this,(function(e){return[2]}))}))},t.prototype._loadImages=function(e){var t,n,i=this,o=new s.aN,a=(e.filter||[]).concat(e.makeup||[]).concat(e.sticker||[]),c={},h=function(e){if(e.src instanceof Array)e.src.forEach((function(t,n){var r=i.checkSpriteSheetJSON(t);if(r){var a=r.meta.image,h="".concat(i._key,"|").concat(a);if(s.P6.kN[h])return void O.getInstance().addRef(h);if(e.objectSrc&&e.objectSrc.length){var u=s.xE.from(e.objectSrc[n]);s.xE.addToCache(u,h),O.getInstance().addRef(h)}else if(0===a.indexOf("blob:")){u=s.xE.from(a);s.xE.addToCache(u,h)}else o.add(h,a);r.meta.image="",c[h]=r}else{if(s.P6.kN[t])return;if(o.resources[t])return;if(e.objectSrc&&e.objectSrc.length){u=s.xE.from(e.objectSrc[n],{resolution:(0,j.u)()});s.xE.addToCache(u,t)}else o.add(t,t)}}));else{if(O.getInstance().addRef(e.src),s.P6.kN[e.src])return"continue";if(o.resources[e.src])return U.info("already loaded file",e.src),"continue";if(e.objectSrc){U.info("use imagebitmap to create texture");var t=s.xE.from(e.objectSrc);s.xE.addToCache(t,e.src),O.getInstance().addRef(e.src)}else if(0===e.src.indexOf("blob:")){t=s.xE.from(e.src);U.info("JSONEffect blob texture",t),s.xE.addToCache(t,e.src),O.getInstance().addRef(e.src)}else o.add(e.src)}};try{for(var u=N(a),l=u.next();!l.done;l=u.next()){h(l.value)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}return new Promise((function(e){return V(i,void 0,void 0,(function(){var t=this;return A(this,(function(n){return o.load((function(n,i){return V(t,void 0,void 0,(function(){var t,n,o,a,h;return A(this,(function(u){switch(u.label){case 0:for(o in t=function(e){var t;return A(this,(function(n){switch(n.label){case 0:return r.iV[e]?[2,"continue"]:c[e]?(t=new s.c2(s.P6.kN[e],c[e],"@".concat((0,j.u)(),"x")),[4,new Promise((function(n){t.parse((function(){r.iV[e]=t,n()}))}))]):[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}}))},n=[],s.P6.kN)n.push(o);a=0,u.label=1;case 1:return a<n.length?(h=n[a],[5,t(h)]):[3,4];case 2:u.sent(),u.label=3;case 3:return a++,[3,1];case 4:for(h in i)r.iV[h]||c[h]||(r.iV[h]=i[h]);return e(),[2]}}))}))})),[2]}))}))}))},t.prototype.loadSticker3d=function(e){return V(this,void 0,Promise,(function(){return A(this,(function(e){return[2]}))}))},t}(D),G=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),H=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s},B=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},J=function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((i=i.apply(e,t||[])).next())}))},W=function(e,t){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},q=((0,I.jl)("Effect"),function(){function e(e,t,n,i){this.type="hand",this._destroyed=!1,this._visible=!0,this._intensity=1,this.localSpriteSheets={},this._url=e,this._key=e,this._app3d=t,this._canvas=i,this._options=n}return Object.defineProperty(e.prototype,"url",{get:function(){return this._url},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"app3d",{get:function(){return this._app3d},set:function(e){this._app3d=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"intensity",{get:function(){return this._intensity},set:function(e){this._intensity=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"visible",{get:function(){return this._visible},set:function(e){this._destroyed||(this._visible=e)},enumerable:!1,configurable:!0}),e.prototype.download=function(){return J(this,void 0,Promise,(function(){var e;return W(this,(function(t){switch(t.label){case 0:return[4,this._getLoader()];case 1:return[4,t.sent().preload(this._url)];case 2:return t.sent(),[4,this._getConfig()];case 3:return e=t.sent(),I.D4.info("download:",this._url,e),[2,e]}}))}))},e.prototype.load=function(){return J(this,void 0,Promise,(function(){var e,t;return W(this,(function(n){switch(n.label){case 0:return[4,this.download()];case 1:return e=n.sent(),t=e.hand,[4,this.load3d(t||[])];case 2:return n.sent(),[4,this._getLoader()];case 3:return n.sent().removeFromCache(this._url),[2,null]}}))}))},e.prototype._getLoader=function(){return J(this,void 0,void 0,(function(){return W(this,(function(e){switch(e.label){case 0:return this._loader?[3,2]:(this._loader=new r.pF,[4,this._loader.init()]);case 1:e.sent(),e.label=2;case 2:return[2,this._loader]}}))}))},e.prototype._getConfig=function(){return J(this,void 0,void 0,(function(){var e;return W(this,(function(t){switch(t.label){case 0:return this._config?[3,3]:[4,this._getLoader()];case 1:return[4,(e=t.sent()).preload(this._url)];case 2:t.sent(),this._config=e.readJSON("content.json",this._key),t.label=3;case 3:return[2,this._config]}}))}))},e.prototype.load3d=function(e){return J(this,void 0,void 0,(function(){return W(this,(function(e){return[2]}))}))},e.prototype.initThreeApp=function(){return J(this,void 0,void 0,(function(){return W(this,(function(e){return[2]}))}))},e.prototype.apply3d=function(){},e.prototype.removeForConsole=function(){},e.prototype.destroyForConosle=function(){},e.prototype.apply=function(){this._destroyed||this._applyed||(this.apply3d(),this._applyed=!0)},e.prototype.getUrl=function(){return this._url},e.prototype.remove=function(){this.removeForConsole(),this._applyed=!1},e.prototype.tick=function(){},e.prototype.tickMesh=function(){},e.prototype.destroy=function(){this._destroyed=!0,this.remove(),this.destroyForConosle(),this.clearTexture()},e.prototype.clearTexture=function(){var e=O.getInstance();for(var t in s.P6.kN)if(t.indexOf(this._key)>-1){var n=s.P6.kN[t];e.removeRef(t)&&(s.xE.removeFromCache(n),n.destroy(!0),r.iV[t]&&r.iV[t]instanceof s.c2&&(r.iV[t].destroy(),delete r.iV[t]))}},e.prototype.checkSpriteSheetJSON=function(e){try{return JSON.parse(e)}catch(e){return null}},H([(0,u.M)("Effect"),B("design:type",Function),B("design:paramtypes",[]),B("design:returntype",void 0)],e.prototype,"remove",null),H([(0,u.M)("Effect"),B("design:type",Function),B("design:paramtypes",[]),B("design:returntype",void 0)],e.prototype,"destroy",null),e}()),K=function(e){function t(t,n,i,r){var o=e.call(this,"default",n,i,r)||this;return o._json=t,o._app3d=n,o}return G(t,e),t.prototype.load=function(){return J(this,void 0,Promise,(function(){var e,t;return W(this,(function(n){switch(n.label){case 0:return e=this._json,(t=e.hand)?this._app3d?[3,2]:[4,this.initThreeApp()]:[3,4];case 1:n.sent(),n.label=2;case 2:return[4,this.loadHand3d(t||[])];case 3:n.sent(),n.label=4;case 4:return[2,null]}}))}))},t.prototype.loadImage=function(){return J(this,void 0,void 0,(function(){return W(this,(function(e){return[2]}))}))},t.prototype.loadSticker3d=function(e){return J(this,void 0,Promise,(function(){return W(this,(function(e){return[2]}))}))},t.prototype.loadHand3d=function(e){return J(this,void 0,Promise,(function(){return W(this,(function(e){return[2]}))}))},t}(q),Y=n(5156),X=n(7959),Z=n(6309),$=n(1077),Q=n(3849),ee=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),te=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s},ne=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},ie=function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((i=i.apply(e,t||[])).next())}))},re=function(e,t){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},oe=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},se=(0,I.jl)("Renderer"),ae=function(){};var ce=function(e){function t(t){var n=e.call(this,t)||this;return n._setup=!1,n._effects=[],n._debug=!0,n._destroyed=!1,n._isVR=!1,n._meshVertexTimer=0,n.lib3dLoaded=!1,n.libHand3dLoaded=!1,se.info("[@#$] AR Renderer Constructed",location),n._debug=!1,t.output?n._canvas=new wx.window.Canvas(t.output):n._canvas=new wx.window.Canvas(wx.createOffscreenCanvas({type:"webgl",width:t.width,height:t.height})),n._stage=new s.W2,n._options=t,s.Xd.RESOLUTION=(0,j.u)(),s.Xd.FILTER_RESOLUTION=(0,j.u)(),n._renderer=new s.Th({view:n._canvas,width:t.width,height:t.height,useContextAlpha:!1,preserveDrawingBuffer:!1,antialias:!1}),n.setRenderer(),n.initRenderContext(t),n.handleLoading(),n.setup(),n}return ee(t,e),Object.defineProperty(t.prototype,"mirror",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"backGroundVR",{set:function(e){if(e){this._backgroundVR=new s.jy(s.xE.from(e));var t=this._backgroundVR,n=t.width,i=t.height,r=Math.max(this._options.width/n,this._options.height/i);this._backgroundVR.width*=r,this._backgroundVR.height*=r}else this._backgroundVR=null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"options",{set:function(e){var t=e.width,n=e.height;this._canvas.width=t,this._canvas.height=n,this._renderer&&this.resize(t,n),this._baseSprite&&(this._baseSprite.width=t,this._baseSprite.height=n,this._baseSprite.position.set(t/2,n/2),this._baseSprite.anchor.set(.5,.5)),this._baseRenderTexture.resize(t,n),this._makeupRenderTexture.resize(t,n),this._options=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"app3d",{get:function(){return this._app3d},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"avatar3d",{get:function(){return this._avatar3d},enumerable:!1,configurable:!0}),t.prototype.initRenderContext=function(e){this._baseContainer=new s.W2,this._makeupContainer=new s.W2,this._frontContainer=new s.W2,this._frontContainer.sortableChildren=!0,this._finalContainer=new s.W2,this._baseRenderTexture=s.TI.create({width:e.width,height:e.height}),this._makeupRenderTexture=s.TI.create({width:e.width,height:e.height}),this._makeupContainer.addChild(new s.jy(this._baseRenderTexture)),ae.baseTexture=this._baseRenderTexture,this._finalContainer.addChild(new s.jy(this._makeupRenderTexture)),this._finalContainer.addChild(this._frontContainer),this._stage.addChild(this._finalContainer),this._target=this._finalContainer},t.prototype.loadLib3d=function(){return ie(this,void 0,Promise,(function(){var e;return re(this,(function(t){switch(t.label){case 0:return e=new Z.e({}),se.info("loader init"),[4,e.init()];case 1:return t.sent(),se.info("loader init done"),this._options.plugin3d&&this._options.plugin3d(D,z,e,wx.window),[2]}}))}))},t.prototype.loadHand3d=function(){return ie(this,void 0,Promise,(function(){var e;return re(this,(function(t){switch(t.label){case 0:return e=new Z.e({}),se.info("+++++loader init"),[4,e.init()];case 1:return t.sent(),se.info("+++++loader init done"),this._options.plugin3d&&this._options.pluginHand(q,K,e,wx.window),[2]}}))}))},t.prototype.setup=function(){return ie(this,void 0,void 0,(function(){return re(this,(function(e){switch(e.label){case 0:return this._setup?[2]:(this._config=new a.M,[4,this._config.load()]);case 1:return e.sent(),this._setup=!0,[2]}}))}))},Object.defineProperty(t.prototype,"meshVertex",{get:function(){return this._meshVertex},set:function(e){this._meshVertex=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mirrorFilter",{get:function(){return this._mirrorFilter||(this._mirrorFilter=new o.f("mirror",{width:Q.t.instance.options.width,height:Q.t.instance.options.height})),this._mirrorFilter},enumerable:!1,configurable:!0}),t.prototype.switchMode=function(e){I.bH.info("switchMode",e),e!==this._mode3d&&("Sticker"===e&&this.setAvatar(null),this._mode3d=e)},t.prototype.logTime=function(e){var t=+new Date;se.info("".concat(e," time:").concat(t-this.currentTime)),this.currentTime=t},t.prototype.tick=function(t,n){var i=t.landmarks,r=t.meshVertex,o=t.lipVertex,a=t.image,c=t.angles,h=(t.backgroundType,t.background,t.segmentation,t.blendshapes,t.isLivePusher);t.hair;if(!this._destroyed)if(this._renderer)if(this._stage)if(this._setup){this.currentTime=+new Date,this._image=a;try{this._renderer.reset()}catch(e){}if(this._isVR)try{this._renderer.render(this._backgroundVR)}catch(e){}else{if(h)if(this._baseSprite)this._baseSprite.texture.update();else{d=s.xE.from(a);this._baseSprite=new s.jy(d),this._baseSprite.anchor.set(.5,.5),this._baseSprite.position.set(this._options.width/2,this._options.height/2),this._baseSprite.scale.set(1,-1),this._baseContainer.addChild(this._baseSprite)}else{var u=a,l=u.width,p=u.height,f=u.data;if(this._baseSprite){if(this._baseSprite.texture.width===l&&this._baseSprite.texture.height===p)this._baseSprite.texture.baseTexture.resource.data=new Uint8Array(f),this._baseSprite.texture.update();else this._baseSprite.texture.destroy(!0),this._baseSprite.texture=s.xE.fromBuffer(new Uint8Array(f),l,p)}else{var d=s.xE.fromBuffer(new Uint8Array(f),l,p);this._baseSprite=new s.jy(d),this._baseSprite.anchor.set(.5,.5),this._baseSprite.position.set(this._options.width/2,this._options.height/2);var _=Math.max(this._options.width/l,this._options.height/p);this._baseSprite.scale.set(_),this._baseContainer.addChild(this._baseSprite)}}(X.s.checkEnabled("beautify")||X.s.checkEnabled("segmentation")||X.s.checkEnabled("hair"))&&(e.prototype.setMesh.call(this,r),e.prototype.setReshapeMarks.call(this,i),i&&i.length?(this._faceLandmarks=i,this._angles=c,this.meshVertex=r,this.lipVertex=o,this.detected=!0,this._effects.forEach((function(e){e.visible||(e.visible=!0),e.lipmesh=o,e.mesh=r,e.angles=c,e.faceLandMarks=i,e.tick()})),"Sticker"===this._mode3d&&this._app3d&&this._app3d.loaded&&(this._app3d.facelandmarks=i,this._app3d.angles=c)):(this.handleNoFace(),this.detected=!1)),this._render()}}else I.b_.info("_renderer waiting for setup");else I.b_.info("_renderer waiting for stage");else I.b_.info("_renderer waiting for renderer")},t.prototype.handleNoFace=function(){this._effects.forEach((function(e){return e.visible=!1})),this._effects.forEach((function(e){e.tickMesh()}));new Date;"AR"===this._mode3d||"Sticker"===this._mode3d&&this._app3d&&this._app3d.loaded&&(this._app3d.facelandmarks=[],this._app3d.angles={})},t.prototype._render=function(){this.renderLayers(),X.s.checkEnabled("beautify")&&"Sticker"===this._mode3d&&this._app3d&&this._app3d.loaded&&this._app3d.render(),X.s.checkEnabled("handLandmark")&&this._appHand3d&&this._appHand3d.render()},t.prototype.renderLayers=function(){this._options.isWxAndroid?(this._renderer.render(this._makeupContainer,{renderTexture:this._makeupRenderTexture}),this._renderer.render(this._baseContainer,{renderTexture:this._baseRenderTexture})):(this._renderer.render(this._baseContainer,{renderTexture:this._baseRenderTexture}),this._renderer.render(this._makeupContainer,{renderTexture:this._makeupRenderTexture})),this._renderer.render(this._stage)},t.prototype.getBaseTexture=function(){return this._baseSprite.texture},t.prototype.removeBackground=function(){this.background&&(this.background.remove(),this.background=null)},t.prototype.disableEdgeOptimization=function(){this.background&&this.background.disableEdgeOptimization()},t.prototype.enableEdgeOptimization=function(){this.background&&this.background.enableEdgeOptimization()},t.prototype.applyBackground=function(e){this.background},t.prototype.removeForeground=function(){this._frontContainer&&(this._frontContainer.children.forEach((function(e){e.destroy()})),this._frontContainer.removeChildren())},t.prototype.addForeground=function(e){var t=this;if(Array.isArray(e)){var n={};for(var i in this._frontContainer.children.forEach((function(e){n[e.id]=e})),e.forEach((function(e,i){var r=n[e.id];r?(r.zIndex=i,delete n[e.id]):t._addForeground(e,i)})),n)n[i].destroy(),this._frontContainer.removeChild(n[i]);this._frontContainer.sortChildren()}else this._addForeground(e)},t.prototype._addForeground=function(e,t){var n=e.image,i=e.type,r=e.id,o=Q.t.instance.options,a=o.width,h=o.height,u="data"in n?s.xE.fromBuffer(new Uint8Array(n.data.buffer),n.width,n.height):s.xE.from(n),l=new c.jy(u);"video"===i&&(l.blendMode_1=6),l.width=a,l.height=h,l.id=r,t&&(l.zIndex=t),this._frontContainer.addChild(l)},t.prototype.debugDraw=function(e){if(null==e?void 0:e.length){if(!this.points){for(var t=[],n=0;2*n<e.length;n++){var i=this.getCircle(2);t.push(i),this._baseContainer.addChild(i)}this.points=t}for(n=0;2*n<e.length;n++)this.points[n].x=e[2*n],this.points[n].y=e[2*n+1]}},t.prototype.debugDraw2=function(e){if(null==e?void 0:e.length){if(se.info("debug draw 2",e.length),!this.points){for(var t=[],n=0;n<e.length;n++){var i=this.getCircle(2);t.push(i),this._baseContainer.addChild(i)}this.points=t}for(n=0;n<e.length;n++)this.points[n].x=540*e[n].x,this.points[n].y=540*e[n].y}},t.prototype.getPixels=function(){var e=this._options,t=e.width,n=e.height,i=new Uint8Array(t*n*4),r=this._renderer.gl;return r.readPixels(0,0,t,n,r.RGBA,r.UNSIGNED_BYTE,i),{data:i,width:t,height:n}},t.prototype.setEffect=function(e,t,n,i){return ie(this,void 0,Promise,(function(){var r,o=this;return re(this,(function(s){return r=!0,this.latestEffectUrls&&this.latestEffectUrls.length===e.length&&e.every((function(e){return o.latestEffectUrls.indexOf(e)>-1}))&&(r=!1,this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null)),this.latestEffectUrls=e,[2,new Promise((function(s,a){r?(o.debounceTimer&&(clearTimeout(o.debounceTimer),o.debounceTimer=null),o.debounceTimer=setTimeout((function(){return o._setEffect(e,t,n,i).then((function(e){clearTimeout(o.debounceTimer),o.debounceTimer=null,s(e)}))}),100)):o._setEffect(e,t,n).then((function(e){s(e)}))}))]}))}))},t.prototype._setEffect=function(e,t,n,i){return ie(this,void 0,Promise,(function(){var o,s=this;return re(this,(function(a){return I.b_.time("waiting for AI init..."),X.s.checkEnabled("beautify")&&!this._meshVertex?[2,new Promise((function(r){clearTimeout(s._meshVertexTimer),s._meshVertexTimer=setInterval((function(){I.b_.info("waiting for AI init..."),s._meshVertex&&(I.b_.info("waiting for AI init...done"),clearTimeout(s._meshVertexTimer),s._setEffect(e,t,n,i).then((function(){r(s._effects)})))}),200)}))]:(I.b_.timeEnd("waiting for AI init..."),o="uid_"+Math.floor(1e8*Math.random()),[2,new Promise((function(a,c){return ie(s,void 0,void 0,(function(){var s,c,h,u,l,p,f,d,_,y,m,b,g,v,k,w,x,M=this;return re(this,(function(S){switch(S.label){case 0:for(s=[].concat(this._effects),c=[],h=[],u=[],l=[],p=[],f=[],d=[],_=[],e.length||(this.filterActivedEffect=null),y=[],m=function(i){var o=s.findIndex((function(t){return t.url===e[i]}));if(o>-1)c.push(s[o]),s[o],h.push(t[i]),u.push(n[i]),s.splice(o,1);else{var a=e[i];_.push(function(e){return ie(this,void 0,Promise,(function(){var t,n;return re(this,(function(i){switch(i.label){case 0:return[4,(t=new r.pF).init()];case 1:return i.sent(),[4,t.preload(e)];case 2:return i.sent(),n=t.readJSON("content.json",e),I.D4.info("download:",e,n),[2,n]}}))}))}(a)),y.push(a),p.push(t[i]),f.push(n[i])}},b=0;b<e.length;b++)m(b);return[4,Promise.all(_)];case 1:for(g=S.sent(),!1,v=!1,k=0;k<g.length;k++)w=y[k],x=void 0,(x=new D(w,this._makeupContainer,this._finalContainer,this._app3d,this._options,this._meshVertex,this._faceLandmarks,this.lipVertex,this._angles,p[k],this._canvas)).filterIntensity=f[k],g[k].sticker3d&&g[k].sticker3d.length&&(v=!0),x.renderer=this._renderer,l.push(x);return I.b_.time("require 3d lib"),this.lib3dLoaded||!v?[3,3]:i&&!i()?[2]:(se.info("require 3d lib"),[4,this.loadLib3d()]);case 2:S.sent(),this.lib3dLoaded=!0,S.label=3;case 3:return I.b_.timeEnd("require 3d lib"),I.b_.info("check all new Effects",l,s),l.forEach((function(e){d.push(e.load().then((function(){return e.intensity=e.intensity,M._app3d||"face"!==e.type||(M._app3d=e.app3d),M._appHand3d||"hand"!==e.type||(M._appHand3d=e.app3d),e})).catch((function(e){se.warn("effect load error",e)})))})),I.b_.time("renderer parse effect"),Promise.all(d).then((function(e){I.b_.timeEnd("renderer parse effect"),I.b_.time("renderer apply effect");for(var t=!1,n=0;n<l.length;n++){var i=l[n];M.latestEffectUrls&&-1===M.latestEffectUrls.indexOf(i.getUrl())&&(i.destroy(),t=!0)}if(t)se.info(o+"end");else{s.forEach((function(e){e.remove()})),M._effects=c,c.forEach((function(e,t){e.intensity=h[t],e.filterIntensity=u[t]}));for(n=0;n<l.length;n++){i=l[n];M._effects.push(i),i.apply({filterTarget:M._baseSprite,filterCallback:function(){}})}s.forEach((function(e){e.destroy()})),I.b_.timeEnd("renderer apply effect"),a(M._effects)}})),[2]}}))}))}))])}))}))},t.prototype.setEffectJSON=function(e){return ie(this,void 0,void 0,(function(){var t,n,i,r,o,s=this;return re(this,(function(a){switch(a.label){case 0:return n=e.sticker3d,i=e.hand,n&&n.length&&!this.lib3dLoaded?(se.info("require 3d lib"),[4,this.loadLib3d()]):[3,2];case 1:a.sent(),this.lib3dLoaded=!0,a.label=2;case 2:return i&&i.length&&!this.libHand3dLoaded?(se.info("require 3d hand lib"),[4,this.loadHand3d()]):[3,4];case 3:a.sent(),this.libHand3dLoaded=!0,a.label=4;case 4:return r=!1,(o=function(){X.s.checkEnabled("beautify")&&s._meshVertex&&(t&&clearTimeout(t),r=!0,s.getJSONEffectForFace(e)),X.s.checkEnabled("handLandmark")&&i&&i.length&&(r=!0,s.getJSONEffectForHand(e)),r||(t=setTimeout(o,20))})(),[2]}}))}))},t.prototype.getJSONEffectForHand=function(e){var t=this,n=new K(e,this._appHand3d,this._options,this._canvas);n.renderer=this._renderer,I.b_.info("getJSONEffectForHand"),n.load().then((function(){t._appHand3d||(t._appHand3d=n.app3d),n.apply()}))},t.prototype.getJSONEffectForFace=function(e){var t=this,n=new z(e,this._makeupContainer,this._finalContainer,this._app3d,this._options,this._meshVertex,this._faceLandmarks,this.lipVertex);return n.renderer=this._renderer,n.load().then((function(){t._app3d||(t._app3d=n.app3d);var e=[].concat(t._effects);t._effects=[n],n.apply({filterTarget:t._baseSprite}),e.forEach((function(e){e.destroy()}))})),n},t.prototype.setExclusiveFilter=function(e,t){var n=this;return void 0===t&&(t=1),new Promise((function(i,r){!function(){if(n.exclusiveFilter&&n.exclusiveFilter.getUrl()===e)n.exclusiveFilter.intensity=t,n.exclusiveFilter.filterIntensity=t;else{var r=new D(e,n._makeupContainer,n._finalContainer,n._app3d,n._options,n._meshVertex,n._faceLandmarks,n.lipVertex,n._angles,t);r.filterIntensity=t,r.load().then((function(){n.exclusiveFilter&&n.exclusiveFilter.destroy(),n.exclusiveFilter=r,r.renderer=n._renderer,r.apply({filterTarget:n._baseSprite}),i()}))}}()}))},t.prototype.resize=function(t,n,i){void 0===i&&(i=!0),e.prototype.resize.call(this,t,n),se.info("renderer resize",t,n,i),this._options.width=t,this._options.height=n,this._renderer.resize(t,n),this.background&&this.background.resize(t,n),this._app3d?this._app3d.resize(t,n):this._avatar3d&&this._avatar3d.resize(t,n),this._makeupRenderTexture&&this._makeupRenderTexture.resize(t,n),this._baseRenderTexture&&this._baseRenderTexture.resize(t,n),i&&this._baseSprite&&(this._baseSprite.width=t,this._baseSprite.height=n,this._baseSprite.position.set(t/2,n/2),this._baseSprite.anchor.set(.5,.5),this._baseSprite.scale.set(1)),this._effects.forEach((function(e){e.resize(t,n)}))},t.prototype.disableExclusiveFilter=function(){this.exclusiveFilter&&this.exclusiveFilter.remove()},t.prototype.enableExclusiveFilter=function(){this.exclusiveFilter&&this.exclusiveFilter.apply({filterTarget:this._baseSprite,filterCallback:function(){}})},t.prototype.disableEffects=function(e){void 0===e&&(e=!1),this._effects.forEach((function(t){!e&&t.isPureFilter||"hand"===t.type||t.remove()}))},t.prototype.enableEffects=function(){var e=this;this._effects.forEach((function(t){t.apply({filterTarget:e._baseSprite,filterCallback:function(){}})}))},t.prototype.removeExclusiveFilter=function(){this.exclusiveFilter&&(this.exclusiveFilter.destroy(),this.exclusiveFilter=null)},t.prototype.initAvatarApp=function(e,t){return ie(this,void 0,void 0,(function(){return re(this,(function(e){return[2]}))}))},t.prototype.setAvatar=function(e,t){return ie(this,void 0,void 0,(function(){return re(this,(function(e){return[2]}))}))},t.prototype.registerAvatar=function(e){},t.prototype.reCorrectAvatar=function(){return ie(this,void 0,void 0,(function(){return re(this,(function(e){return[2]}))}))},t.prototype.getCanvas=function(){return this._canvas},t.prototype.setOptions=function(e){},t.prototype.mount=function(e){this._canvas&&e.appendChild(this._canvas)},t.prototype.getCircle=function(e){void 0===e&&(e=5);var t=new s.TC;return t.beginFill(16711680),t.drawCircle(0,0,e),t.endFill(),t},t.preloadEffects=function(e){return ie(this,void 0,Promise,(function(){var t,n,i,o,s,a,c;return re(this,(function(h){switch(h.label){case 0:return e.length?[4,(t=new r.pF).init()]:[2];case 1:h.sent(),n=[];try{for(i=oe(e),o=i.next();!o.done;o=i.next())(s=o.value)&&n.push(t.preload(s))}catch(e){a={error:e}}finally{try{o&&!o.done&&(c=i.return)&&c.call(i)}finally{if(a)throw a.error}}return[2,Promise.all(n).then((function(){return Promise.resolve()})).catch((function(e){return Promise.reject(e)}))]}}))}))},t.prototype.handleLoading=function(){var e=this._options,n=e.enableLoadingIcon,i=e.loadingIconOptions,r=void 0===i?{}:i;if(n){var o=t.loading=new Y.Z(r);o.zIndex=20;var s=this._options,a=s.width,c=s.height;o.x=a/2,o.y=c/2,this._stage.addChild(o)}},t.prototype.showLoading=function(){t.loading&&t.loading.show()},t.prototype.hideLoading=function(){t.loading&&t.loading.hide()},t.prototype.destroy=function(e){void 0===e&&(e=!0),this.hideLoading(),t.loading&&t.loading.destroy(),e&&ae.baseTexture&&(ae.baseTexture.destroy(!0),ae.baseTexture=null),this._destroyed=!0,this._effects.forEach((function(e){e.destroy()})),this.exclusiveFilter&&this.exclusiveFilter.destroy(),this._stage&&this._stage.destroy(!0),this._renderer&&this._renderer.destroy(!0),this.background&&this.background.destroy(),this._app3d&&this._app3d.destroy(),this._appHand3d&&this._appHand3d.destroy(),this._meshVertexTimer&&clearTimeout(this._meshVertexTimer),this.destroyAvatar()},t.prototype.destroyAvatar=function(){this._avatar3d&&(this._avatar3d.destroy(),this._avatar3d=null)},te([(0,u.M)("ArRenderer"),ne("design:type",Function),ne("design:paramtypes",[Object]),ne("design:returntype",void 0)],t.prototype,"destroy",null),t}($.F)}}]);