tencentcloud-webar 1.0.23-13 → 1.0.23-15
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.
- package/build-esm/450.js +1 -0
- package/build-esm/682.js +1 -0
- package/build-esm/avatar.js +1 -1
- package/build-esm/hand3d.js +1 -0
- package/build-esm/index.js +1 -1
- package/build-esm/lib-3d.js +2 -2
- package/build-esm/sticker3d.js +1 -1
- package/build-umd/avatar.umd.js +3 -3
- package/build-umd/hand-3d.umd.e972b727d39b09879a1c.js +6 -0
- package/build-umd/stickers-3d.umd.js +4 -4
- package/build-umd/webar-sdk.umd.js +2 -2
- package/miniprogram_dist/core.js +1 -1
- package/miniprogram_dist/index.js +1 -1
- package/miniprogram_dist/lib.js +1 -1
- package/miniprogram_dist/plugin-3d.js +1 -1
- package/package.json +3 -1
- package/webpack/esm/hand.dev.js +150 -0
- package/webpack/wx/hand.wx.dev.js +165 -0
- package/build-esm/542.js +0 -1
- package/build-esm/avatar.worker.js +0 -6
- package/build-esm/sticker3d.worker.js +0 -6
package/miniprogram_dist/core.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var self = wx;(self.webpackChunktencentcloud_webar=self.webpackChunktencentcloud_webar||[]).push([[321],{5145:(e,t,i)=>{i.d(t,{g:()=>ie,b:()=>te});var r,n=i(1206),s=i(337),o=i(3044),a=i(5536),c=i(617),u=i(9560),h=i(1347),l=i(1084),p=i(3849),f=(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},r(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 i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),d=function(e,t,i,r){var n,s=arguments.length,o=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,i,o):n(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},_=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},y=function(){function e(e,t,i,r,n,s){this._destroyed=!1,this.type="makeup",this._parentIntensity=1,this._jsonIntensity=1,this.textures=[],this._dir=t,this._options=e,this._container=i,this._lipMaskTexture=s,this.renderer=r,this.type=n||"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)},enumerable:!1,configurable:!0}),e.prototype.updateGeometry=function(e){this._destroyed},e.prototype.renderMesh=function(){},e.prototype.drawMeshBatch=function(e,t){var i=this;if(!this._destroyed){var r=Array.from(e.reduce((function(e,t){return e.add(t.blend),e}),new Set));this.irisRenderTexture&&!r.includes(this.irisBlendMode)&&r.push(this.irisBlendMode);var s="\n precision mediump float;\n varying vec2 vUvs;\n varying vec2 bUvs;\n \n\n ".concat(e.map((function(e,t){return"uniform sampler2D uSamplerMakeup".concat(t,";")})).join("\n"),"\n ").concat(e.map((function(e,t){return"uniform float intensity".concat(t,";")})).join("\n"),"\n uniform float parentIntensity;\n uniform int enable;\n uniform sampler2D baseImage;\n \n uniform sampler2D uSamplerIris;\n\n // uniform int mirror;\n uniform vec2 imageOffset;\n \n ").concat(r.map((function(e){return u.Lc[e].shader})).join("\n"),"\n \n void main() {\n if (enable == 0) {\n gl_FragColor = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n // todo:适配镜像与非镜像\n vec2 baseCoord = bUvs;\n baseCoord += imageOffset;\n // if (mirror == 1) {\n // baseCoord = vec2(1.0 - bUvs.x, bUvs.y);\n // }\n vec4 baseColor = texture2D(baseImage, baseCoord);\n\n vec4 makeupColor = vec4(0.0);\n\n ").concat(e.map((function(e,t){return"\n \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 makeupColor = texture2D(uSamplerMakeup").concat(t,", vUvs) * realIntensity").concat(t,";\n if (makeupColor.a>0.) {\n // 混合\n baseColor.rgb = blend").concat(u.Lc[e.blend].key,"(baseColor.rgb, makeupColor.rgb/makeupColor.a , makeupColor.a);\n }\n \n \n \n\n ")})).join("\n"),"\n\n ").concat(this.irisRenderTexture?"\n // 混合美瞳\n vec4 irisColor = texture2D(uSamplerIris, bUvs);\n if (irisColor.a > 0.) {\n baseColor.rgb = blend".concat(u.Lc[this.irisBlendMode].key,"(baseColor.rgb, irisColor.rgb/irisColor.a , irisColor.a);\n }\n "):"","\n \n \n\n // 输出\n gl_FragColor = baseColor;\n }"),o={enable:1};o.parentIntensity=this.parentIntensity;var a=this._options,c=a.width,h=a.height;o.baseImage=te.baseTexture,o.size=[c*h/te.baseTexture.height,h];var l=te.baseTexture.width*h/te.baseTexture.height;o.imageOffset=[(l-c)/2/l,0],e.forEach((function(e,t){var r="default"===i._dir?e.src:"".concat(i._dir,"|").concat(e.src),s=n.utils.TextureCache[r];o["uSamplerMakeup".concat(t)]=s,o["intensity".concat(t)]=e.intensity,i.textures.push(s)})),this.irisRenderTexture&&(o.uSamplerIris=this.irisRenderTexture);var f=n.Shader.from("\n precision mediump float;\n attribute vec2 aVertexPosition;\n attribute vec2 aUvs;\n\n uniform mat3 translationMatrix;\n uniform mat3 projectionMatrix;\n uniform vec2 size;\n varying vec2 vUvs;\n varying vec2 bUvs;\n\n \n void main() {\n vUvs = aUvs;\n bUvs = aVertexPosition.xy /size;\n // lipUvs = lipAuvs;\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n }",s,o);this.shader=f,p.t.instance.on("mirrorChange",(function(e){}));var d=new u.Kj(t,f);return this._mesh=d,this._container.addChild(d),d}},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)},d([(0,l.M)("MakeupLayer"),_("design:type",Function),_("design:paramtypes",[Array]),_("design:returntype",void 0)],e.prototype,"updateGeometry",null),d([(0,l.M)("MakeupLayer"),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",void 0)],e.prototype,"destroy",null),e}(),m=function(e){function t(t,i,r,s,o,a,c){var u=e.call(this,t,i,c)||this;return u._maskGraphics=new n.Graphics,u.maxLConSize=0,u.maxRConSize=0,u._parentIntensity=1,u.jsonIntensity=o,u.getTexture(r,s),u._config=a,u.renderTexture=n.RenderTexture.create({width:t.width,height:t.height}),u}var i,r;return f(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){var i="default"===this._dir?e:"".concat(this._dir,"|").concat(e),r=n.utils.TextureCache[i],s=new u.jy(r),o=new u.jy(r.clone());s.anchor.set(.5),o.anchor.set(.5),this._leftIris=s,this._rightIris=o;var a=new n.Container;this._maskGraphics||(this._maskGraphics=new n.Graphics),a.addChild(this._maskGraphics),a.addChild(s),a.addChild(o),a.alpha=this.parentIntensity*this.jsonIntensity,a.mask=this._maskGraphics,this._container=a},t.prototype.setIrisProps=function(e,t){if(e.length){var i=this._config.getConfigByKeys(["POINTS_MAP","LEFT_IRIS","RIGHT_IRIS","LEFT_EYE_ORDER","RIGHT_EYE_ORDER"]),r=i.POINTS_MAP,n=(i.LEFT_IRIS,i.RIGHT_IRIS,i.LEFT_EYE_ORDER),s=i.RIGHT_EYE_ORDER,o=(r.left_eye_center,r.right_eye_center,(0,h.Sp)(e[52],e[55])),a=(0,h.Sp)(e[58],e[61]),c=Math.max(this.maxLConSize,(0,h.Sp)(e[72],e[73])/o),u=Math.max(this.maxRConSize,(0,h.Sp)(e[75],e[76])/a),l=o*c,p=o*c,f=a*u,d=a*u;this.maxLConSize=Math.max(Math.min(c,.7),.4),this.maxRConSize=Math.max(Math.min(u,.7),.4);var _=te.baseTexture.width*this._options.height/te.baseTexture.height,y=(0,h.qg)(e[74],e[104]),m=(0,h.qg)(e[77],e[105]);console.log("offset",(_-this._options.width)/2),y.x-=(_-this._options.width)/2,m.x-=(_-this._options.width)/2;var b=this._leftIris,g=this._rightIris;b.width=l,b.height=p,b.x=y.x,b.y=y.y,g.width=f,g.height=d,g.x=m.x,g.y=m.y,this._maskGraphics.clear(),this._drawMaskGraphics(n,e),this._drawMaskGraphics(s,e),t.render(this._container,{renderTexture:this.renderTexture})}},t.prototype._drawMaskGraphics=function(e,t){var i=this,r=this._maskGraphics;r.beginFill(16724736),r.lineStyle(1,16767232,1);var n=[];e.forEach((function(s,o){var a=t[s],c=i._getPixelPosition(a.x,a.y),u=c.x,h=c.y;n.push({x:u,y:h}),0===o?r.moveTo(u,h):o===e.length-1?(r.closePath(),r.endFill()):r.lineTo(u,h)}))},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})},d([(0,l.M)("IrisLayer"),_("design:type",Function),_("design:paramtypes",["function"==typeof(i="undefined"!=typeof Array&&Array)?i:Object,"function"==typeof(r=void 0!==n.Renderer&&n.Renderer)?r:Object]),_("design:returntype",void 0)],t.prototype,"setIrisProps",null),t}(y),b=i(3120),g=i(6109),v=function(e,t,i,r){var n,s=arguments.length,o=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,i,o):n(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},k=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},x=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))},w=function(e,t){var i,r,n,s,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,r&&(n=2&s[0]?r.return:s[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,s[1])).done)return n;switch(r=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(n=o.trys,(n=n.length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){o.label=s[1];break}if(6===s[0]&&o.label<n[1]){o.label=n[1],n=s;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(s);break}n[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{i=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}},T=function(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],r=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},S=(0,g.jl)("makeup"),M=function(){function e(e,t,i){e&&(this._options=e),t&&(this._lipVertex=t),i&&(this.renderer=i)}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 x(this,void 0,void 0,(function(){var e,t,i,r,s;return w(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,i=e.height,r=new n.BaseRenderTexture({width:t,height:i}),this._maskRenderTexture=new n.RenderTexture(r),s=new n.Sprite(this._maskRenderTexture),this._maskSprite=s),[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 x(this,void 0,void 0,(function(){var e,t,i,r,s,o,a,c,u;return w(this,(function(h){switch(h.label){case 0:return this._lipMask?[2,this._lipMask]:(e=new n.Container,(t=new n.Sprite(n.Texture.WHITE)).width=this._options.width,t.height=this._options.height,e.addChild(t),i=this._lipVertex,r=this._config.getDataConfig(29),[4,this._loadLipImage()]);case 1:return s=h.sent(),o=(new n.Geometry).addAttribute("aVertexPosition",i).addAttribute("aUvs",r),"\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:s},c=n.Shader.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),u=new n.Mesh(o,c),this._lipMaskMesh=u,e.addChild(u),this._lipMask=e,[2,e]}}))}))},e.prototype._loadLipImage=function(){return x(this,void 0,Promise,(function(){var e=this;return w(this,(function(t){return[2,new Promise((function(t,i){return x(e,void 0,void 0,(function(){var e,i,r;return w(this,(function(n){switch(n.label){case 0:return[4,(e=new b.KI).init()];case 1:return i=n.sent(),[4,e.loadImage(i)];case 2:return r=n.sent(),t(r[b.X_]),[2]}}))}))}))]}))}))},v([(0,l.M)("ReuseableLipMask"),k("design:type",Function),k("design:paramtypes",[]),k("design:returntype",void 0)],e.prototype,"destroy",null),v([(0,l.o)("ReuseableLipMask"),k("design:type",Function),k("design:paramtypes",[]),k("design:returntype",Promise)],e.prototype,"_getMask",null),e}(),C=function(){function e(e,t,i,r,s,o,a,c){void 0===c&&(c=1),this._container=new n.Container,this._makeupMeshes=[],this._visible=!0,this.mouthShut=!0,this._applyed=!1,this._key=e,this._data=t,this._options=i,this.mesh=r,this.lipmesh=o,this.faceLandMarks=s,this.renderer=a,this.parentIntensity=c;var u=new n.Sprite(n.Texture.WHITE);u.alpha=0,u.width=i.width,u.height=i.height,this._container.addChild(u)}var t;return Object.defineProperty(e.prototype,"visible",{get:function(){return this._visible},set:function(e){var t=this;this._target&&e!==this._visible&&(this._visible=e,this._makeupMeshes.forEach((function(i){e?t.apply(t._target):t.remove()})))},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,this.renderer),(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}),Object.defineProperty(e.prototype,"parentIntensity",{get:function(){return this._intensity},set:function(e){S.info("set parentIntensity",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 x(this,void 0,void 0,(function(){var e,t,i,r,n,s,o,a;return w(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,S.info("makeup info",this._data),t=[],e&&e.length){try{for(i=T(e),r=i.next();!r.done;r=i.next())"iris"===(n=r.value).type?(this._irises=this._getIris(n.src,n.blend,n.intensity),this.irisBlendMode=n.blend):(n.blend+"",t.push({src:n.src,intensity:n.intensity,type:n.type,blend:n.blend}))}catch(e){o={error:e}}finally{try{r&&!r.done&&(a=i.return)&&a.call(i)}finally{if(o)throw o.error}}console.log("makeupLayersByBlendMode",t),s=this._getMeshLayerByBlendMode(t),this._makeupMeshes.push(s)}return[4,this._initLipMask()];case 2:return u.sent(),[2]}}))}))},e.prototype._getIris=function(e,t,i){return new m(this._options,this._key,e,t,i,this._config,this._container)},e.prototype._getMeshLayerByBlendMode=function(e){var t=e.some((function(e){return"lips"===e.type}))?"lips":"makeup",i=new y(this._options,this._key,this._container,this.renderer,t);i.parentIntensity=this.parentIntensity,this._irises&&(i.irisRenderTexture=this._irises.renderTexture.baseTexture,i.irisBlendMode=this.irisBlendMode);var r=this._config.getDataConfig(26);if(!this.geometry){var s=(new n.Geometry).addAttribute("aVertexPosition",this._meshVertex).addAttribute("aUvs",r);this.geometry=s}return i.drawMeshBatch(e,this.geometry),i},e.prototype.apply=function(e){this._target=e,this._applyMakeup(e)},e.prototype.remove=function(){this._removeMakeup(this._target)},e.prototype._applyMakeup=function(e){this._applyed||(this._applyed=!0,e.filters||(e.filters=[]),e.addChild(this._container))},e.prototype._removeMakeup=function(e){this._applyed&&(this._applyed=!1,e.filters&&e.removeChild(this._container))},e.prototype._initLipMask=function(){return x(this,void 0,void 0,(function(){var e,t,i=this;return w(this,(function(r){switch(r.label){case 0:return(e=new M(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=r.sent().maskSprite,this._makeupMeshes.forEach((function(e){console.log("是否闭嘴的",i.mouthShut),"lips"!==e.type||i.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()},v([(0,l.M)("Makeup"),k("design:type",Function),k("design:paramtypes",["function"==typeof(t=void 0!==n.Container&&n.Container)?t:Object]),k("design:returntype",void 0)],e.prototype,"_removeMakeup",null),v([(0,l.M)("Makeup"),k("design:type",Function),k("design:paramtypes",[]),k("design:returntype",void 0)],e.prototype,"destroy",null),e}(),I=i(3125),P=i(401),j=function(e,t,i,r){var n,s=arguments.length,o=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,i,o):n(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},O=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},R=function(){function e(e,t,i,r,s,o,a,c){this._container=new n.Container,this._name=e,this._src=t,this._target=r,this._config=i,this._jsonIntensity=i.intensity,this._landmarks=s,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 n.Graphics;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 n.Graphics;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 i=[];this._src.forEach((function(e){var r;r=e.indexOf(".json")>-1?e:"".concat(t._key,"|").concat(JSON.parse(e).meta.image);var n=o.iV[r].textures,s=Object.keys(n).map((function(e){return n[e]}));i=i.concat(s)})),(e=new u.Kg(i)).animationSpeed=(this._config.fps||30)/60,e.play()}else{var r=this._src[0],s=n.utils.TextureCache[r];e=new u.jy(s)}this._config.blend&&(console.log("sticker blend",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,i=P.Jp.map((function(e){return t[e]})),r=(0,h.Sp)(i[0],i[1]),n=e.wxAnchorArea,s=(e.wxAnchorOffset,e.wxWeights),o=r/P.jw,a=n.map((function(e){var i=t[e];return{x:i.x,y:i.y,z:0}}));this._container.scale.set(o);var c={x:a[0].x*s[0]+a[1].x*s[1]+a[2].x*s[2],y:a[0].y*s[0]+a[1].y*s[1]+a[2].y*s[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},j([(0,l.M)("StickerLayer"),O("design:type",Function),O("design:paramtypes",[]),O("design:returntype",Boolean)],e.prototype,"checkAnimated",null),j([(0,l.M)("StickerLayer"),O("design:type",Function),O("design:paramtypes",[]),O("design:returntype",void 0)],e.prototype,"destroy",null),e}(),E=function(){function e(e,t,i,r,n,s,o){void 0===o&&(o=1);var a=this;this._stickers=[],this._visible=!0,this._parentIntensity=1,this._target=i,this._options=n,this._landmarks=r;var c=new I.LE;c.setPlanes(400,10,1e4,!0),this._camera=c,this._stickers=t.map((function(t){var o=new R(t.name,t.src,t,i,r,n,e,s);return o.parentIntensity=a.parentIntensity,o.load(),a._camera.addChild(o.getDisplay()),o}))}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}(),F=i(6878),V=i(6879),L=function(){var e=function(t,i){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},e(t,i)};return function(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),A=function(e,t,i,r){var n,s=arguments.length,o=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,i,o):n(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},U=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},D=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))},G=function(e,t){var i,r,n,s,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,r&&(n=2&s[0]?r.return:s[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,s[1])).done)return n;switch(r=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(n=o.trys,(n=n.length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){o.label=s[1];break}if(6===s[0]&&o.label<n[1]){o.label=n[1],n=s;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(s);break}n[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{i=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}},B=function(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],r=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},z=(0,g.jl)("Effect"),N=function(){function e(e,t,i,r,n,s,o,a,c,u,h){this._filters=[],this._destroyed=!1,this._visible=!0,this._intensity=1,this._filterIntensity=1,this.localSpriteSheets={},this._filtersActived=!0,this._target=t,this._stickerTarget=i,this._url=e,this._key=e,this._options=n,this.mesh=s,this.lipmesh=a,this.faceLandMarks=o,c&&(this.angles=c),void 0!==u&&(this.intensity=u),this._app3d=r,this._canvas=h}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&&(F.Nd.trigger("error",{message:s.Z.t("0015"),code:V.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))},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 D(this,void 0,Promise,(function(){return G(this,(function(e){switch(e.label){case 0:return g.D4.info("download:",this._url),[4,this._getLoader()];case 1:return[4,e.sent().preload(this._url)];case 2:return e.sent(),[4,this._getConfig()];case 3:return[2,e.sent()]}}))}))},e.prototype.load=function(){return D(this,void 0,Promise,(function(){var e,t,i,r,n,s;return G(this,(function(o){switch(o.label){case 0:return[4,this.download()];case 1:return e=o.sent(),t=e.filter,i=e.makeup,r=e.beautify,n=e.sticker,s=e.sticker3d,[4,this._loadImages(e)];case 2:return o.sent(),this.loadFilter(t),[4,this.setMakeup(i)];case 3:return o.sent(),n?[4,this.loadStickers(n)]:[3,5];case 4:o.sent(),o.label=5;case 5:return[4,this.load3d(s)];case 6:return o.sent(),this.sticker3d=s,[4,this._getLoader()];case 7:return o.sent().removeFromCache(this._url),[2,r]}}))}))},e.prototype._getLoader=function(){return D(this,void 0,void 0,(function(){return G(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 D(this,void 0,void 0,(function(){var e;return G(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 D(this,void 0,Promise,(function(){var e,t,i,r,n,s,o,a;return G(this,(function(c){switch(c.label){case 0:return[4,this._getConfig()];case 1:e=c.sent(),t=e.makeup,i=!1;try{for(r=B(t),n=r.next();!n.done;n=r.next())if("iris"===(s=n.value).type||"eyes"===s.type){i=!0;break}}catch(e){o={error:e}}finally{try{n&&!n.done&&(a=r.return)&&a.call(r)}finally{if(o)throw o.error}}return[2,i]}}))}))},e.prototype.needDetection=function(){return D(this,void 0,Promise,(function(){var e,t,i,r;return G(this,(function(n){switch(n.label){case 0:return[4,this._getConfig()];case 1:return e=n.sent(),t=e.makeup,i=e.sticker,r=e.sticker3d,[2,t&&t.length||i&&i.length||r&&r.length]}}))}))},e.prototype.hasFilter=function(){return D(this,void 0,Promise,(function(){var e,t;return G(this,(function(i){switch(i.label){case 0:return[4,this._getConfig()];case 1:return e=i.sent(),[2,!(!(t=e.filter)||!t.length)]}}))}))},e.prototype.loadStickers=function(e){return D(this,void 0,Promise,(function(){var t;return G(this,(function(i){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=[]),D(this,void 0,Promise,(function(){return G(this,(function(e){return[2]}))}))},e.prototype.load3d=function(e){return D(this,void 0,void 0,(function(){return G(this,(function(e){return[2]}))}))},e.prototype.initThreeApp=function(){return D(this,void 0,void 0,(function(){return G(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 C(this._key,e,this._options,this._meshVertex,this.faceLandMarks,this._lipVertex,this.renderer,this.intensity),this._makeup.load()):Promise.resolve()},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(){z.info("remove effect",this._url,this.getUrl()),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 i=t._createFilterSync(e.src,e.intensity,t.filterIntensity);t._filters.push(i)}))},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 i=e.filters.findIndex((function(e){return e===t}));i>-1&&e.filters.splice(i,1)}))},e.prototype._createFilterSync=function(e,t,i){var r="default"===this._key?e:"".concat(this._key,"|").concat(e),s=n.utils.TextureCache[r];return s.baseTexture.scaleMode=n.SCALE_MODES.LINEAR,s.baseTexture.mipmap=n.MIPMAP_MODES.OFF,new a.f("lut",this._options,{uniforms:{lut:s,intensity:t,parentIntensity:i}})},e.prototype.clearTexture=function(){for(var e in n.utils.TextureCache)if(e.indexOf(this._key)>-1){var t=n.utils.TextureCache[e];n.Texture.removeFromCache(t),t.destroy(!0)}for(var e in this.localSpriteSheets)o.iV[e]&&o.iV[e]instanceof n.Spritesheet&&(o.iV[e].destroy(),delete o.iV[e])},e.prototype._loadImages=function(e){var t,i,r=this,s=(e.filter||[]).concat(e.makeup||[]).concat(e.sticker||[]),a=this._loader.getIndeLoader(),c={};this.localSpriteSheets=c;try{for(var u=B(s),h=u.next();!h.done;h=u.next()){var l=h.value;if(l.src instanceof Array)l.src.forEach((function(e,t){var i=r.checkSpriteSheetJSON(e);if(i){var s=i.meta.image,o="".concat(r._key,"|").concat(s);if(n.utils.TextureCache[o])return;if(0===s.indexOf("blob:")){var u=n.Texture.from(s);n.Texture.addToCache(u,o)}else a.add(o,s);i.meta.image="",c[o]=i}else{if(n.utils.TextureCache[e])return;if(a.resources[e])return;a.add(e,e)}}));else{var p="".concat(this._key,"|").concat(l.src);if(n.utils.TextureCache[p])continue;if(0===l.src.indexOf("blob:")){var f=n.Texture.from(l.src);n.Texture.addToCache(f,p)}else a.add(p,l.src)}}}catch(e){t={error:e}}finally{try{h&&!h.done&&(i=u.return)&&i.call(u)}finally{if(t)throw t.error}}return new Promise((function(e){a.load((function(t,i){return D(r,void 0,void 0,(function(){var t,r,s,a,u;return G(this,(function(h){switch(h.label){case 0:for(s in t=function(e){var t;return G(this,(function(i){switch(i.label){case 0:return o.iV[e]?[2,"continue"]:c[e]?(t=new n.Spritesheet(n.utils.TextureCache[e],c[e]),[4,new Promise((function(i){t.parse((function(){o.iV[e]=t,i()}))}))]):[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}}))},r=[],n.utils.TextureCache)r.push(s);a=0,h.label=1;case 1:return a<r.length?(u=r[a],[5,t(u)]):[3,4];case 2:h.sent(),h.label=3;case 3:return a++,[3,1];case 4:for(u in i)o.iV[u]||c[u]||(o.iV[u]=i[u]);return e(),[2]}}))}))}))}))},e.prototype.checkSpriteSheetJSON=function(e){try{return JSON.parse(e)}catch(e){return null}},A([(0,l.M)("Effect"),U("design:type",Function),U("design:paramtypes",[]),U("design:returntype",void 0)],e.prototype,"remove",null),A([(0,l.M)("Effect"),U("design:type",Function),U("design:paramtypes",[]),U("design:returntype",void 0)],e.prototype,"destroy",null),A([(0,l.M)("Effect"),U("design:type",Function),U("design:paramtypes",["function"==typeof(t=void 0!==n.Container&&n.Container)?t:Object]),U("design:returntype",void 0)],e.prototype,"_removeFilter",null),e}(),J=function(e){function t(t,i,r,n,s,o,a,c){var u=e.call(this,"default",i,r,n,s,o,a,c)||this;return u._json=t,u._app3d=n,u}return L(t,e),t.prototype.load=function(){return D(this,void 0,Promise,(function(){var e,t,i,r,n,s;return G(this,(function(o){switch(o.label){case 0:return e=this._json,t=e.filter,i=e.makeup,r=e.beautify,n=e.sticker,s=e.sticker3d,[4,this._loadImages(e)];case 1:return o.sent(),this.loadFilter(t),[4,this.setMakeup(i)];case 2:return o.sent(),n?[4,this.loadStickers(n)]:[3,4];case 3:o.sent(),o.label=4;case 4:return s?this._app3d?[3,6]:[4,this.initThreeApp()]:[3,8];case 5:o.sent(),o.label=6;case 6:return[4,this.loadSticker3d(s)];case 7:o.sent(),o.label=8;case 8:return[2,r]}}))}))},t.prototype.loadImage=function(){return D(this,void 0,void 0,(function(){return G(this,(function(e){return[2]}))}))},t.prototype._loadImages=function(e){var t,i,r=this,s=new n.Loader,a=(e.filter||[]).concat(e.makeup||[]).concat(e.sticker||[]),c={},u=function(e){if(e.src instanceof Array)e.src.forEach((function(t,i){var o=r.checkSpriteSheetJSON(t);if(o){var a=o.meta.image,u="".concat(r._key,"|").concat(a);if(n.utils.TextureCache[u])return;if(e.objectSrc&&e.objectSrc.length){var h=n.Texture.from(e.objectSrc[i]);n.Texture.addToCache(h,u)}else if(0===a.indexOf("blob:")){h=n.Texture.from(a);n.Texture.addToCache(h,u)}else s.add(u,a);o.meta.image="",c[u]=o}else{if(n.utils.TextureCache[t])return;if(s.resources[t])return;if(e.objectSrc&&e.objectSrc.length){h=n.Texture.from(e.objectSrc[i]);n.Texture.addToCache(h,t)}else s.add(t,t)}}));else{if(n.utils.TextureCache[e.src])return"continue";if(s.resources[e.src])return console.log("already loaded file",e.src),"continue";if(e.objectSrc){console.log("use imagebitmap to create texture");var t=n.Texture.from(e.objectSrc);n.Texture.addToCache(t,e.src)}else if(0===e.src.indexOf("blob:")){t=n.Texture.from(e.src);console.log("JSONEffect blob texture",t),n.Texture.addToCache(t,e.src)}else s.add(e.src)}};try{for(var h=B(a),l=h.next();!l.done;l=h.next()){u(l.value)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(i=h.return)&&i.call(h)}finally{if(t)throw t.error}}return new Promise((function(e){return D(r,void 0,void 0,(function(){var t=this;return G(this,(function(i){return s.load((function(i,r){return D(t,void 0,void 0,(function(){var t,i,s,a,u;return G(this,(function(h){switch(h.label){case 0:for(s in t=function(e){var t;return G(this,(function(i){switch(i.label){case 0:return o.iV[e]?[2,"continue"]:c[e]?(t=new n.Spritesheet(n.utils.TextureCache[e],c[e]),[4,new Promise((function(i){t.parse((function(){o.iV[e]=t,i()}))}))]):[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}}))},i=[],n.utils.TextureCache)i.push(s);a=0,h.label=1;case 1:return a<i.length?(u=i[a],[5,t(u)]):[3,4];case 2:h.sent(),h.label=3;case 3:return a++,[3,1];case 4:for(u in r)o.iV[u]||c[u]||(o.iV[u]=r[u]);return e(),[2]}}))}))})),[2]}))}))}))},t.prototype.loadSticker3d=function(e){return D(this,void 0,Promise,(function(){return G(this,(function(e){return[2]}))}))},t}(N),q=i(5156),H=i(6309),Y=i(1077),K=function(){var e=function(t,i){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},e(t,i)};return function(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),W=function(e,t,i,r){var n,s=arguments.length,o=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,i,o):n(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},Z=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},X=function(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))},$=function(e,t){var i,r,n,s,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,r&&(n=2&s[0]?r.return:s[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,s[1])).done)return n;switch(r=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(n=o.trys,(n=n.length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){o.label=s[1];break}if(6===s[0]&&o.label<n[1]){o.label=n[1],n=s;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(s);break}n[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{i=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}},Q=function(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],r=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},ee=(0,g.jl)("Renderer"),te=function(){},ie=function(e){function t(t){var i=e.call(this,t)||this;return i._setup=!1,i._effects=[],i._debug=!0,i._destroyed=!1,i._isVR=!1,i._meshVertexTimer=0,console.log("[@#$] AR Renderer Constructed",location),i._debug=!1,t.output?i._canvas=new wx.window.Canvas(t.output):i._canvas=new wx.window.Canvas(wx.createOffscreenCanvas({type:"webgl",width:t.width,height:t.height})),i._stage=new n.Container,i._options=t,i._renderer=new n.Renderer({view:i._canvas,width:t.width,height:t.height,preserveDrawingBuffer:!1,antialias:!1}),i.initRenderContext(t),i.handleLoading(),i.setup(),i}return K(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 n.Sprite(n.Texture.from(e));var t=this._backgroundVR,i=t.width,r=t.height,s=Math.max(this._options.width/i,this._options.height/r);this._backgroundVR.width*=s,this._backgroundVR.height*=s}else this._backgroundVR=null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"options",{set:function(e){var t=e.width,i=e.height;this._canvas.width=t,this._canvas.height=i,this._renderer&&this.resize(t,i),this._baseSprite&&(this._baseSprite.width=t,this._baseSprite.height=i,this._baseSprite.position.set(t/2,i/2),this._baseSprite.anchor.set(.5,.5)),this._baseRenderTexture.resize(t,i),this._makeupRenderTexture.resize(t,i),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 n.Container,this._makeupContainer=new n.Container,this._finalContainer=new n.Container,this._baseRenderTexture=n.RenderTexture.create({width:e.width,height:e.height}),this._makeupRenderTexture=n.RenderTexture.create({width:e.width,height:e.height}),this._makeupContainer.addChild(new n.Sprite(this._baseRenderTexture)),te.baseTexture=this._baseRenderTexture,this._finalContainer.addChild(new n.Sprite(this._makeupRenderTexture)),this._stage.addChild(this._finalContainer),this._target=this._finalContainer},t.prototype.loadLib3d=function(){return X(this,void 0,Promise,(function(){var e;return $(this,(function(t){switch(t.label){case 0:return[4,(e=new H.e({})).init()];case 1:return t.sent(),this._options.plugin3d&&this._options.plugin3d(N,J,e,wx.window),[2]}}))}))},t.prototype.setup=function(){return X(this,void 0,void 0,(function(){return $(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 a.f("mirror",{width:p.t.instance.options.width,height:p.t.instance.options.height})),this._mirrorFilter},enumerable:!1,configurable:!0}),t.prototype.switchMode=function(e){e!==this._mode3d&&("Sticker"===e&&this.setAvatar(null),this._mode3d=e)},t.prototype.logTime=function(e){var t=+new Date;console.log("".concat(e," time:").concat(t-this.currentTime)),this.currentTime=t},t.prototype.tick=function(e){var t=e.landmarks,i=e.meshVertex,r=e.lipVertex,s=e.image,o=e.angles,a=(e.backgroundType,e.background,e.segmentation,e.blendshapes,e.isLivePusher);if(!this._destroyed)if(this._renderer)if(this._stage)if(this._setup){this.currentTime=+new Date;try{this._renderer.reset()}catch(e){}if(this._isVR)try{this._renderer.render(this._backgroundVR)}catch(e){}else{if(a)if(this._baseSprite)this._baseSprite.texture.update();else{p=n.Texture.from(s);this._baseSprite=new n.Sprite(p),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 c=s,u=c.width,h=c.height,l=c.data;if(this._baseSprite){if(this._baseSprite.texture.width===u&&this._baseSprite.texture.height===h)this._baseSprite.texture.baseTexture.resource.data=new Uint8Array(l),this._baseSprite.texture.update();else this._baseSprite.texture.destroy(!0),this._baseSprite.texture=n.Texture.fromBuffer(new Uint8Array(l),u,h)}else{var p=n.Texture.fromBuffer(new Uint8Array(l),u,h);this._baseSprite=new n.Sprite(p),this._baseSprite.anchor.set(.5,.5),this._baseSprite.position.set(this._options.width/2,this._options.height/2);var f=Math.max(this._options.width/u,this._options.height/h);this._baseSprite.scale.set(f),this._baseContainer.addChild(this._baseSprite)}}if(!t||!t.length){this._effects.forEach((function(e){return e.visible=!1})),this._effects.forEach((function(e){e.tickMesh()}));new Date;return this._renderer.render(this._baseContainer,{renderTexture:this._baseRenderTexture}),this._renderer.render(this._makeupContainer,{renderTexture:this._makeupRenderTexture}),this._renderer.render(this._stage),void(this.detected=!1)}this.detected=!0,this._faceLandmarks=t,this._angles=o,this.meshVertex=i,this.lipVertex=r,this._effects.forEach((function(e){e.visible||(e.visible=!0),e.lipmesh=r,e.mesh=i,e.angles=o,e.faceLandMarks=t,e.tick()})),this._renderer.render(this._baseContainer,{renderTexture:this._baseRenderTexture}),this._renderer.render(this._makeupContainer,{renderTexture:this._makeupRenderTexture}),this._renderer.render(this._stage),"Sticker"===this._mode3d&&this._app3d&&this._app3d.loaded&&(this._app3d.facelandmarks=t,this._app3d.angles=o,this._app3d.render())}}else g.b_.info("_renderer waiting for setup");else g.b_.info("_renderer waiting for stage");else g.b_.info("_renderer waiting for renderer")},t.prototype.getBaseTexture=function(){return this._baseSprite.texture},t.prototype.removeBackground=function(){this.background&&(this.background.remove(),this.background=null)},t.prototype.applyBackground=function(e){this.background},t.prototype.debugDraw=function(e){if(!this.points){for(var t=[],i=0;2*i<e.length;i++){var r=this.getCircle(2);t.push(r),this._baseContainer.addChild(r)}this.points=t}for(i=0;2*i<e.length;i++)this.points[i].x=e[2*i],this.points[i].y=e[2*i+1]},t.prototype.debugDraw2=function(e){if(console.log("debug draw 2",e.length),!this.points){for(var t=[],i=0;i<e.length;i++){var r=this.getCircle(2);t.push(r),this._baseContainer.addChild(r)}this.points=t}for(i=0;i<e.length;i++)this.points[i].x=540*e[i].x,this.points[i].y=540*e[i].y},t.prototype.getPixels=function(){var e=this._options,t=e.width,i=e.height,r=new Uint8Array(t*i*4),n=this._renderer.gl;return n.readPixels(0,0,t,i,n.RGBA,n.UNSIGNED_BYTE,r),{data:r,width:t,height:i}},t.prototype.setEffect=function(e,t,i,r){return X(this,void 0,Promise,(function(){var n,s=this;return $(this,(function(o){return n=!0,this.latestEffectUrls&&this.latestEffectUrls.length===e.length&&e.every((function(e){return s.latestEffectUrls.indexOf(e)>-1}))&&(n=!1,this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null)),this.latestEffectUrls=e,[2,new Promise((function(o,a){n?(s.debounceTimer&&(clearTimeout(s.debounceTimer),s.debounceTimer=null),s.debounceTimer=setTimeout((function(){return s._setEffect(e,t,i,r).then((function(e){clearTimeout(s.debounceTimer),s.debounceTimer=null,o(e)}))}),100)):s._setEffect(e,t,i).then((function(e){o(e)}))}))]}))}))},t.prototype._setEffect=function(e,t,i,r){return X(this,void 0,Promise,(function(){var n,s=this;return $(this,(function(o){return g.b_.time("waiting for AI init..."),this._meshVertex?(g.b_.timeEnd("waiting for AI init..."),n="uid_"+Math.floor(1e8*Math.random()),[2,new Promise((function(o,a){return X(s,void 0,void 0,(function(){var s,a,c,u,h,l,p,f,d,_,y,m,b,v,k=this;return $(this,(function(x){switch(x.label){case 0:for(s=[].concat(this._effects),a=[],c=[],u=[],h=[],l=[],p=[],e.length||(this.filterActivedEffect=null),f=function(r){var n=s.findIndex((function(t){return t.url===e[r]})),o=void 0;if(n>-1)a.push(s[n]),o=s[n],c.push(t[r]),u.push(i[r]),s.splice(n,1);else{var l=e[r];(o=new N(l,d._makeupContainer,d._finalContainer,d._app3d,d._options,d._meshVertex,d._faceLandmarks,d.lipVertex,d._angles,t[r],d._canvas)).filterIntensity=i[r],o.renderer=d._renderer,h.push(o),p.push(o.download())}},d=this,_=0;_<e.length;_++)f(_);return[4,Promise.all(p)];case 1:if(y=x.sent(),g.b_.time("require 3d lib"),this.lib3dLoaded)return[3,5];m=0,x.label=2;case 2:return m<y.length?(b=y[m],(v=b.sticker3d)&&v.length?r&&!r()?[2]:(console.log("require 3d lib"),[4,this.loadLib3d()]):[3,4]):[3,5];case 3:x.sent(),this.lib3dLoaded=!0,x.label=4;case 4:return m++,[3,2];case 5:return g.b_.timeEnd("require 3d lib"),h.forEach((function(e){l.push(e.load().then((function(){return k._app3d||(k._app3d=e.app3d),e})).catch((function(e){ee.warn("effect load error",e)})))})),g.b_.time("renderer parse effect"),Promise.all(l).then((function(e){g.b_.timeEnd("renderer parse effect"),g.b_.time("renderer apply effect");for(var t=!1,i=0;i<h.length;i++){var r=h[i];k.latestEffectUrls&&-1===k.latestEffectUrls.indexOf(r.getUrl())&&(r.destroy(),t=!0)}if(t)ee.info(n+"end");else{s.forEach((function(e){e.remove()})),k._effects=a,a.forEach((function(e,t){e.intensity=c[t],e.filterIntensity=u[t]}));for(i=0;i<h.length;i++){r=h[i];k._effects.push(r),r.apply({filterTarget:k._baseSprite,filterCallback:function(){}})}s.forEach((function(e){e.destroy()})),g.b_.timeEnd("renderer apply effect"),o(k._effects)}})),[2]}}))}))}))]):[2,new Promise((function(n){clearTimeout(s._meshVertexTimer),s._meshVertexTimer=setInterval((function(){g.b_.info("waiting for AI init..."),s._meshVertex&&(g.b_.info("waiting for AI init...done"),clearTimeout(s._meshVertexTimer),s._setEffect(e,t,i,r).then((function(){n(s._effects)})))}),200)}))]}))}))},t.prototype.setEffectJSON=function(e){return X(this,void 0,void 0,(function(){var t,i,r,n=this;return $(this,(function(s){switch(s.label){case 0:return this.lib3dLoaded?[3,2]:(i=e.sticker3d)&&i.length?(console.log("require 3d lib"),[4,this.loadLib3d()]):[3,2];case 1:s.sent(),this.lib3dLoaded=!0,s.label=2;case 2:return(r=function(){if(n._meshVertex){t&&clearTimeout(t);var i=new J(e,n._makeupContainer,n._finalContainer,n._app3d,n._options,n._meshVertex,n._faceLandmarks,n.lipVertex);i.renderer=n._renderer,i.load().then((function(){n._app3d||(n._app3d=i.app3d);var e=[].concat(n._effects);n._effects=[i],i.apply({filterTarget:n._baseSprite}),e.forEach((function(e){e.destroy()}))}))}else t=setTimeout(r,20)})(),[2]}}))}))},t.prototype.setExclusiveFilter=function(e,t){var i=this;return void 0===t&&(t=1),new Promise((function(r,n){!function(){if(i.exclusiveFilter&&i.exclusiveFilter.getUrl()===e)i.exclusiveFilter.intensity=t,i.exclusiveFilter.filterIntensity=t;else{var n=new N(e,i._makeupContainer,i._finalContainer,i._app3d,i._options,i._meshVertex,i._faceLandmarks,i.lipVertex,i._angles,t);n.filterIntensity=t,n.load().then((function(){i.exclusiveFilter&&i.exclusiveFilter.destroy(),i.exclusiveFilter=n,n.renderer=i._renderer,n.apply({filterTarget:i._baseSprite}),r()}))}}()}))},t.prototype.resize=function(t,i){e.prototype.resize.call(this,t,i),console.log("renderer resize",t,i),this._options.width=t,this._options.height=i,this._renderer.resize(t,i),this.background&&this.background.resize(t,i),this._app3d?this._app3d.resize(t,i):this._avatar3d&&this._avatar3d.resize(t,i),this._baseRenderTexture&&this._baseRenderTexture.resize(t,i),this._makeupRenderTexture&&this._makeupRenderTexture.resize(t,i)},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(){this._effects.forEach((function(e){console.log("disableEffect",e),e.isPureFilter||e.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 X(this,void 0,void 0,(function(){return $(this,(function(e){return[2]}))}))},t.prototype.setAvatar=function(e,t){return X(this,void 0,void 0,(function(){return $(this,(function(e){return[2]}))}))},t.prototype.registerAvatar=function(e){},t.prototype.reCorrectAvatar=function(){return X(this,void 0,void 0,(function(){return $(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 n.Graphics;return t.beginFill(16711680),t.drawCircle(0,0,e),t.endFill(),t},t.preloadEffects=function(e){return X(this,void 0,Promise,(function(){var t,i,r,n,s,a,c;return $(this,(function(u){switch(u.label){case 0:return e.length?[4,(t=new o.pF).init()]:[2];case 1:u.sent(),i=[];try{for(r=Q(e),n=r.next();!n.done;n=r.next())(s=n.value)&&i.push(t.preload(s))}catch(e){a={error:e}}finally{try{n&&!n.done&&(c=r.return)&&c.call(r)}finally{if(a)throw a.error}}return[2,Promise.all(i).then((function(){return Promise.resolve()})).catch((function(e){return Promise.reject(e)}))]}}))}))},t.prototype.handleLoading=function(){var e=this._options,i=e.enableLoadingIcon,r=e.loadingIconOptions,n=void 0===r?{}:r;if(i){var s=t.loading=new q.Z(n);s.zIndex=20;var o=this._options,a=o.width,c=o.height;s.x=a/2,s.y=c/2,this._stage.addChild(s)}},t.prototype.showLoading=function(){t.loading&&t.loading.show()},t.prototype.hideLoading=function(){t.loading&&t.loading.hide()},t.prototype.destroy=function(){this.hideLoading(),t.loading&&t.loading.destroy(),te.baseTexture&&(te.baseTexture.destroy(!0),te.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._meshVertexTimer&&clearTimeout(this._meshVertexTimer),this.destroyAvatar()},t.prototype.destroyAvatar=function(){this._avatar3d&&(this._avatar3d.destroy(),this._avatar3d=null)},W([(0,l.M)("ArRenderer"),Z("design:type",Function),Z("design:paramtypes",[]),Z("design:returntype",void 0)],t.prototype,"destroy",null),t}(Y.F)}}]);
|
|
1
|
+
var self = wx;(self.webpackChunktencentcloud_webar=self.webpackChunktencentcloud_webar||[]).push([[321],{6237:(e,t,n)=>{n.d(t,{g:()=>he,b:()=>ue});var i,r=n(337),o=n(3044),s=n(5536),a=n(1206),c=n(617),u=n(9560),h=n(1084),l=n(3849),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)},y=function(){function e(e,t,n,i,r,o){this._destroyed=!1,this.type="makeup",this._parentIntensity=1,this._jsonIntensity=1,this.textures=[],this._dir=t,this._options=e,this._container=n,this._lipMaskTexture=o,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)},enumerable:!1,configurable:!0}),e.prototype.updateGeometry=function(e){this._destroyed},e.prototype.renderMesh=function(){},e.prototype.drawMeshBatch=function(e,t){var n=this;if(!this._destroyed){var i=Array.from(e.reduce((function(e,t){return e.add(t.blend),e}),new Set));this.irisRenderTexture&&!i.includes(this.irisBlendMode)&&i.push(this.irisBlendMode);var r="\n precision mediump float;\n varying vec2 vUvs;\n varying vec2 bUvs;\n \n\n ".concat(e.map((function(e,t){return"uniform sampler2D uSamplerMakeup".concat(t,";")})).join("\n"),"\n ").concat(e.map((function(e,t){return"uniform float intensity".concat(t,";")})).join("\n"),"\n uniform float parentIntensity;\n uniform int enable;\n uniform sampler2D baseImage;\n \n uniform sampler2D uSamplerIris;\n\n // uniform int mirror;\n uniform vec2 imageOffset;\n \n ").concat(i.map((function(e){return u.Lc[e].shader})).join("\n"),"\n \n void main() {\n if (enable == 0) {\n gl_FragColor = vec4(0.0,0.0,0.0,0.0);\n return;\n }\n\n // todo:适配镜像与非镜像\n vec2 baseCoord = bUvs;\n baseCoord += imageOffset;\n // if (mirror == 1) {\n // baseCoord = vec2(1.0 - bUvs.x, bUvs.y);\n // }\n vec4 baseColor = texture2D(baseImage, baseCoord);\n\n vec4 makeupColor = vec4(0.0);\n\n ").concat(e.map((function(e,t){return"\n \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 makeupColor = texture2D(uSamplerMakeup").concat(t,", vUvs) * realIntensity").concat(t,";\n if (makeupColor.a>0.) {\n // 混合\n baseColor.rgb = blend").concat(u.Lc[e.blend].key,"(baseColor.rgb, makeupColor.rgb/makeupColor.a , makeupColor.a);\n }\n \n \n \n\n ")})).join("\n"),"\n\n ").concat(this.irisRenderTexture?"\n // 混合美瞳\n vec4 irisColor = texture2D(uSamplerIris, bUvs);\n if (irisColor.a > 0.) {\n baseColor.rgb = blend".concat(u.Lc[this.irisBlendMode].key,"(baseColor.rgb, irisColor.rgb/irisColor.a , irisColor.a);\n }\n "):"","\n \n \n\n // 输出\n gl_FragColor = baseColor;\n }"),o={enable:1};o.parentIntensity=this.parentIntensity;var s=this._options,c=s.width,h=s.height;o.baseImage=ue.baseTexture,o.size=[c*h/ue.baseTexture.height,h];var p=ue.baseTexture.width*h/ue.baseTexture.height;o.imageOffset=[(p-c)/2/p,0],e.forEach((function(e,t){var i="default"===n._dir?e.src:"".concat(n._dir,"|").concat(e.src),r=a.P6.kN[i];o["uSamplerMakeup".concat(t)]=r,o["intensity".concat(t)]=e.intensity,n.textures.push(r)})),this.irisRenderTexture&&(o.uSamplerIris=this.irisRenderTexture);var f=a.ex.from("\n precision mediump float;\n attribute vec2 aVertexPosition;\n attribute vec2 aUvs;\n\n uniform mat3 translationMatrix;\n uniform mat3 projectionMatrix;\n uniform vec2 size;\n varying vec2 vUvs;\n varying vec2 bUvs;\n\n \n void main() {\n vUvs = aUvs;\n bUvs = aVertexPosition.xy /size;\n // lipUvs = lipAuvs;\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n }",r,o);this.shader=f,l.t.instance.on("mirrorChange",(function(e){}));var d=new a.Kj(t,f);return this._mesh=d,this._container.addChild(d),d}},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,h.M)("MakeupLayer"),d("design:type",Function),d("design:paramtypes",[Array]),d("design:returntype",void 0)],e.prototype,"updateGeometry",null),f([(0,h.M)("MakeupLayer"),d("design:type",Function),d("design:paramtypes",[]),d("design:returntype",void 0)],e.prototype,"destroy",null),e}(),_=function(e){function t(t,n,i,r,o,s,c){var u=e.call(this,t,n,c)||this;return u._maskGraphics=new a.TC,u.maxLConSize=0,u.maxRConSize=0,u._parentIntensity=1,u.jsonIntensity=o,u.getTexture(i,r),u._config=s,u.renderTexture=a.TI.create({width:t.width,height:t.height}),u}var n,i;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){var n="default"===this._dir?e:"".concat(this._dir,"|").concat(e),i=a.P6.kN[n],r=new a.jy(i),o=new a.jy(i.clone());r.anchor.set(.5),o.anchor.set(.5),this._leftIris=r,this._rightIris=o;var s=new a.W2;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,t){if(e.length){var n=this._config.getConfigByKeys(["POINTS_MAP","LEFT_IRIS","RIGHT_IRIS","LEFT_EYE_ORDER","RIGHT_EYE_ORDER"]),i=n.POINTS_MAP,r=(n.LEFT_IRIS,n.RIGHT_IRIS,n.LEFT_EYE_ORDER),o=n.RIGHT_EYE_ORDER,s=(i.left_eye_center,i.right_eye_center,getDistance(e[52],e[55])),a=getDistance(e[58],e[61]),c=Math.max(this.maxLConSize,getDistance(e[72],e[73])/s),u=Math.max(this.maxRConSize,getDistance(e[75],e[76])/a),h=s*c,l=s*c,p=a*u,f=a*u;this.maxLConSize=Math.max(Math.min(c,.7),.4),this.maxRConSize=Math.max(Math.min(u,.7),.4);var d=ue.baseTexture.width*this._options.height/ue.baseTexture.height,y=getCenter(e[74],e[104]),_=getCenter(e[77],e[105]);console.log("offset",(d-this._options.width)/2),y.x-=(d-this._options.width)/2,_.x-=(d-this._options.width)/2;var b=this._leftIris,m=this._rightIris;b.width=h,b.height=l,b.x=y.x,b.y=y.y,m.width=p,m.height=f,m.x=_.x,m.y=_.y,this._maskGraphics.clear(),this._drawMaskGraphics(r,e),this._drawMaskGraphics(o,e),t.render(this._container,{renderTexture:this.renderTexture})}},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),u=c.x,h=c.y;r.push({x:u,y:h}),0===s?i.moveTo(u,h):s===e.length-1?(i.closePath(),i.endFill()):i.lineTo(u,h)}))},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,h.M)("IrisLayer"),d("design:type",Function),d("design:paramtypes",["function"==typeof(n="undefined"!=typeof Array&&Array)?n:Object,"function"==typeof(i=void 0!==a.Th&&a.Th)?i:Object]),d("design:returntype",void 0)],t.prototype,"setIrisProps",null),t}(y),b=n(3120),m=n(1347),g=n(6109),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},k=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},x=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])}}},S=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.")},M=(0,g.jl)("makeup"),T=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 x(this,void 0,void 0,(function(){var e,t,n,i,r;return w(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 x(this,void 0,void 0,(function(){var e,t,n,i,r,o,s,c,u;return w(this,(function(h){switch(h.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=h.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),u=new a.Kj(o,c),this._lipMaskMesh=u,e.addChild(u),this._lipMask=e,[2,e]}}))}))},e.prototype._loadLipImage=function(){return x(this,void 0,Promise,(function(){var e=this;return w(this,(function(t){return[2,new Promise((function(t,n){return x(e,void 0,void 0,(function(){var e,n,i;return w(this,(function(r){switch(r.label){case 0:return[4,(e=new b.KI).init()];case 1:return n=r.sent(),[4,e.loadImage(n)];case 2:return i=r.sent(),t(i[b.X_]),[2]}}))}))}))]}))}))},v([(0,h.M)("ReuseableLipMask"),k("design:type",Function),k("design:paramtypes",[]),k("design:returntype",void 0)],e.prototype,"destroy",null),v([(0,h.o)("ReuseableLipMask"),k("design:type",Function),k("design:paramtypes",[]),k("design:returntype",Promise)],e.prototype,"_getMask",null),e}(),P=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._applyed=!1,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 u=new a.jy(a.xE.WHITE);u.alpha=0,u.width=n.width,u.height=n.height,this._container.addChild(u)}var t;return Object.defineProperty(e.prototype,"visible",{get:function(){return this._visible},set:function(e){var t=this;this._target&&e!==this._visible&&(this._visible=e,this._makeupMeshes.forEach((function(n){e?t.apply(t._target):t.remove()})))},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,this.renderer),(0,m.Sp)(e[98],e[102])<.03*(0,m.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}),Object.defineProperty(e.prototype,"parentIntensity",{get:function(){return this._intensity},set:function(e){M.info("set parentIntensity",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 x(this,void 0,void 0,(function(){var e,t,n,i,r,o,s,a;return w(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,M.info("makeup info",this._data),t=[],e&&e.length){try{for(n=S(e),i=n.next();!i.done;i=n.next())"iris"===(r=i.value).type?(this._irises=this._getIris(r.src,r.blend,r.intensity),this.irisBlendMode=r.blend):(r.blend+"",t.push({src:r.src,intensity:r.intensity,type:r.type,blend:r.blend}))}catch(e){s={error:e}}finally{try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(s)throw s.error}}console.log("makeupLayersByBlendMode",t),o=this._getMeshLayerByBlendMode(t),this._makeupMeshes.push(o)}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){var t=e.some((function(e){return"lips"===e.type}))?"lips":"makeup",n=new y(this._options,this._key,this._container,this.renderer,t);n.parentIntensity=this.parentIntensity,this._irises&&(n.irisRenderTexture=this._irises.renderTexture.baseTexture,n.irisBlendMode=this.irisBlendMode);var i=this._config.getDataConfig(26);if(!this.geometry){var r=(new a.wG).addAttribute("aVertexPosition",this._meshVertex).addAttribute("aUvs",i);this.geometry=r}return n.drawMeshBatch(e,this.geometry),n},e.prototype.apply=function(e){this._target=e,this._applyMakeup(e)},e.prototype.remove=function(){this._removeMakeup(this._target)},e.prototype._applyMakeup=function(e){this._applyed||(this._applyed=!0,e.filters||(e.filters=[]),e.addChild(this._container))},e.prototype._removeMakeup=function(e){this._applyed&&(this._applyed=!1,e.filters&&e.removeChild(this._container))},e.prototype._initLipMask=function(){return x(this,void 0,void 0,(function(){var e,t,n=this;return w(this,(function(i){switch(i.label){case 0:return(e=new T(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){console.log("是否闭嘴的",n.mouthShut),"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()},v([(0,h.M)("Makeup"),k("design:type",Function),k("design:paramtypes",["function"==typeof(t=void 0!==a.W2&&a.W2)?t:Object]),k("design:returntype",void 0)],e.prototype,"_removeMakeup",null),v([(0,h.M)("Makeup"),k("design:type",Function),k("design:paramtypes",[]),k("design:returntype",void 0)],e.prototype,"destroy",null),e}(),C=n(3125),E=n(401),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},I=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},O=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 u.Kg(n)).animationSpeed=(this._config.fps||30)/60,e.play()}else{var i=this._src[0],r=a.P6.kN[i];e=new u.jy(r)}console.log("sticker blend",e),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=E.Jp.map((function(e){return t[e]})),i=(0,m.Sp)(n[0],n[1]),r=e.wxAnchorArea,o=(e.wxAnchorOffset,e.wxWeights),s=i/E.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},j([(0,h.M)("StickerLayer"),I("design:type",Function),I("design:paramtypes",[]),I("design:returntype",Boolean)],e.prototype,"checkAnimated",null),j([(0,h.M)("StickerLayer"),I("design:type",Function),I("design:paramtypes",[]),I("design:returntype",void 0)],e.prototype,"destroy",null),e}(),R=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 C.LE;c.setPlanes(400,10,1e4,!0),this._camera=c,this._stickers=t.map((function(t){var s=new O(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}(),F=n(6878),L=n(6879),V=n(201),A=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)}}(),N=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},U=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},D=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())}))},G=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])}}},H=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.")},B=((0,g.jl)("Effect"),function(){function e(e,t,n,i,r,o,s,a,c,u,h){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!==u&&(this.intensity=u),this._app3d=i,this._canvas=h}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&&(F.Nd.trigger("error",{message:r.Z.t("0015"),code:L.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))},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 D(this,void 0,Promise,(function(){var e;return G(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(),g.D4.info("download:",this._url,e),[2,e]}}))}))},e.prototype.load=function(){return D(this,void 0,Promise,(function(){var e,t,n,i,r,o;return G(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 D(this,void 0,void 0,(function(){return G(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 D(this,void 0,void 0,(function(){var e;return G(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 D(this,void 0,Promise,(function(){var e,t,n,i,r,o,s,a;return G(this,(function(c){switch(c.label){case 0:return[4,this._getConfig()];case 1:e=c.sent(),t=e.makeup,console.log("美妆配置",e),n=!1;try{for(i=H(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 D(this,void 0,Promise,(function(){var e,t,n,i;return G(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 D(this,void 0,Promise,(function(){var e,t;return G(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 D(this,void 0,Promise,(function(){var t;return G(this,(function(n){return e.length?((t=new R(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=[]),D(this,void 0,Promise,(function(){return G(this,(function(e){return[2]}))}))},e.prototype.load3d=function(e){return D(this,void 0,void 0,(function(){return G(this,(function(e){return[2]}))}))},e.prototype.initThreeApp=function(){return D(this,void 0,void 0,(function(){return G(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 P(this._key,e,this._options,this._meshVertex,this.faceLandMarks,this._lipVertex,this.renderer,this.intensity),this._makeup.load()):Promise.resolve()},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 u=H(r),h=u.next();!h.done;h=u.next()){var l=h.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 u=a.xE.from(r);a.xE.addToCache(u,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{h&&!h.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}return new Promise((function(e){s.load((function(t,n){return D(i,void 0,void 0,(function(){var t,i,r,s,u;return G(this,(function(h){switch(h.label){case 0:for(r in t=function(e){var t;return G(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,V.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,h.label=1;case 1:return s<i.length?(u=i[s],[5,t(u)]):[3,4];case 2:h.sent(),h.label=3;case 3:return s++,[3,1];case 4:for(u in n)o.iV[u]||c[u]||(o.iV[u]=n[u]);return e(),[2]}}))}))}))}))},e.prototype.checkSpriteSheetJSON=function(e){try{return JSON.parse(e)}catch(e){return null}},N([(0,h.M)("Effect"),U("design:type",Function),U("design:paramtypes",[]),U("design:returntype",void 0)],e.prototype,"remove",null),N([(0,h.M)("Effect"),U("design:type",Function),U("design:paramtypes",[]),U("design:returntype",void 0)],e.prototype,"destroy",null),N([(0,h.M)("Effect"),U("design:type",Function),U("design:paramtypes",["function"==typeof(t=void 0!==a.W2&&a.W2)?t:Object]),U("design:returntype",void 0)],e.prototype,"_removeFilter",null),e}()),z=function(e){function t(t,n,i,r,o,s,a,c){var u=e.call(this,"default",n,i,r,o,s,a,c)||this;return u._json=t,u._app3d=r,u}return A(t,e),t.prototype.load=function(){return D(this,void 0,Promise,(function(){var e,t,n,i,r,o;return G(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 D(this,void 0,void 0,(function(){return G(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={},u=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,u="".concat(i._key,"|").concat(s);if(a.P6.kN[u])return;if(e.objectSrc&&e.objectSrc.length){var h=a.xE.from(e.objectSrc[n]);a.xE.addToCache(h,u)}else if(0===s.indexOf("blob:")){h=a.xE.from(s);a.xE.addToCache(h,u)}else r.add(u,s);o.meta.image="",c[u]=o}else{if(a.P6.kN[t])return;if(r.resources[t])return;if(e.objectSrc&&e.objectSrc.length){h=a.xE.from(e.objectSrc[n],{resolution:(0,V.u)()});a.xE.addToCache(h,t)}else r.add(t,t)}}));else{if(a.P6.kN[e.src])return"continue";if(r.resources[e.src])return console.log("already loaded file",e.src),"continue";if(e.objectSrc){console.log("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);console.log("JSONEffect blob texture",t),a.xE.addToCache(t,e.src)}else r.add(e.src)}};try{for(var h=H(s),l=h.next();!l.done;l=h.next()){u(l.value)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=h.return)&&n.call(h)}finally{if(t)throw t.error}}return new Promise((function(e){return D(i,void 0,void 0,(function(){var t=this;return G(this,(function(n){return r.load((function(n,i){return D(t,void 0,void 0,(function(){var t,n,r,s,u;return G(this,(function(h){switch(h.label){case 0:for(r in t=function(e){var t;return G(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,V.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,h.label=1;case 1:return s<n.length?(u=n[s],[5,t(u)]):[3,4];case 2:h.sent(),h.label=3;case 3:return s++,[3,1];case 4:for(u in i)o.iV[u]||c[u]||(o.iV[u]=i[u]);return e(),[2]}}))}))})),[2]}))}))}))},t.prototype.loadSticker3d=function(e){return D(this,void 0,Promise,(function(){return G(this,(function(e){return[2]}))}))},t}(B),J=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)}}(),W=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},K=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},Y=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())}))},q=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])}}},X=((0,g.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},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 Y(this,void 0,Promise,(function(){var e;return q(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(),g.D4.info("download:",this._url,e),[2,e]}}))}))},e.prototype.load=function(){return Y(this,void 0,Promise,(function(){var e,t;return q(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 Y(this,void 0,void 0,(function(){return q(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 Y(this,void 0,void 0,(function(){var e;return q(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 Y(this,void 0,void 0,(function(){return q(this,(function(e){return[2]}))}))},e.prototype.initThreeApp=function(){return Y(this,void 0,void 0,(function(){return q(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}},W([(0,h.M)("Effect"),K("design:type",Function),K("design:paramtypes",[]),K("design:returntype",void 0)],e.prototype,"remove",null),W([(0,h.M)("Effect"),K("design:type",Function),K("design:paramtypes",[]),K("design:returntype",void 0)],e.prototype,"destroy",null),e}()),Z=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 J(t,e),t.prototype.load=function(){return Y(this,void 0,Promise,(function(){var e,t;return q(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 Y(this,void 0,void 0,(function(){return q(this,(function(e){return[2]}))}))},t.prototype.loadSticker3d=function(e){return Y(this,void 0,Promise,(function(){return q(this,(function(e){return[2]}))}))},t.prototype.loadHand3d=function(e){return Y(this,void 0,Promise,(function(){return q(this,(function(e){return[2]}))}))},t}(X),$=n(5156),Q=n(7959),ee=n(6309),te=n(1077),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,g.jl)("Renderer"),ue=function(){};var he=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,console.log("[@#$] 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,V.u)(),a.Xd.FILTER_RESOLUTION=(0,V.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._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)),ue.baseTexture=this._baseRenderTexture,this._finalContainer.addChild(new a.jy(this._makeupRenderTexture)),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 ee.e({}),console.log("+++++loader init"),[4,e.init()];case 1:return t.sent(),console.log("+++++loader init done"),this._options.plugin3d&&this._options.plugin3d(B,z,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 ee.e({}),console.log("+++++loader init"),[4,e.init()];case 1:return t.sent(),console.log("+++++loader init done"),this._options.plugin3d&&this._options.pluginHand(X,Z,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:l.t.instance.options.width,height:l.t.instance.options.height})),this._mirrorFilter},enumerable:!1,configurable:!0}),t.prototype.switchMode=function(e){e!==this._mode3d&&("Sticker"===e&&this.setAvatar(null),this._mode3d=e)},t.prototype.logTime=function(e){var t=+new Date;console.log("".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,u=(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;try{this._renderer.reset()}catch(e){}if(this._isVR)try{this._renderer.render(this._backgroundVR)}catch(e){}else{if(u)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 h=s,l=h.width,p=h.height,f=h.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 y=Math.max(this._options.width/l,this._options.height/p);this._baseSprite.scale.set(y),this._baseContainer.addChild(this._baseSprite)}}(Q.s.checkEnabled("beautify")||Q.s.checkEnabled("segmentation")||Q.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._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._render()}}else g.b_.info("_renderer waiting for setup");else g.b_.info("_renderer waiting for stage");else g.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(),Q.s.checkEnabled("beautify")&&"Sticker"===this._mode3d&&this._app3d&&this._app3d.loaded&&this._app3d.render(),Q.s.checkEnabled("handLandmark")&&this._appHand3d&&this._appHand3d.render()},t.prototype.renderLayers=function(){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.applyBackground=function(e){this.background},t.prototype.removeForeground=function(){this.foreground&&this.foreground.parent.removeChild(this.foreground)},t.prototype.addForeground=function(e,t){var n=l.t.instance.options,i=n.width,r=n.height;this.foreground=new u.jy(a.xE.from(e)),"video"===t&&(this.foreground.blendMode_1=6),this.foreground.width=i,this.foreground.height=r,this._finalContainer.addChild(this.foreground)},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(console.log("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 g.b_.time("waiting for AI init..."),this._meshVertex?(g.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,u,h,l,p,f,d,y,_,b,m,v,k,x,w=this;return se(this,(function(S){switch(S.label){case 0:for(s=[].concat(this._effects),c=[],u=[],h=[],l=[],p=[],f=[],e.length||(this.filterActivedEffect=null),d=[],y=function(i){var r=s.findIndex((function(t){return t.url===e[i]}));if(r>-1)c.push(s[r]),s[r],u.push(t[i]),h.push(n[i]),s.splice(r,1);else{var a=e[i];f.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),g.D4.info("download:",e,n),[2,n]}}))}))}(a)),d.push(a)}},_=0;_<e.length;_++)y(_);return[4,Promise.all(f)];case 1:for(b=S.sent(),!1,m=!1,v=0;v<b.length;v++)k=d[v],console.log("识别 key",k,d),x=void 0,(x=new B(k,this._makeupContainer,this._finalContainer,this._app3d,this._options,this._meshVertex,this._faceLandmarks,this.lipVertex,this._angles,t[v],this._canvas)).filterIntensity=n[v],b[v].sticker3d&&b[v].sticker3d.length&&(m=!0),x.renderer=this._renderer,l.push(x);return g.b_.time("require 3d lib"),this.lib3dLoaded||!m?[3,3]:i&&!i()?[2]:(console.log("require 3d lib"),[4,this.loadLib3d()]);case 2:S.sent(),this.lib3dLoaded=!0,S.label=3;case 3:return g.b_.timeEnd("require 3d lib"),g.b_.info("check all new Effects",l,s),l.forEach((function(e){p.push(e.load().then((function(){return w._app3d||"face"!==e.type||(w._app3d=e.app3d),w._appHand3d||"hand"!==e.type||(w._appHand3d=e.app3d),e})).catch((function(e){ce.warn("effect load error",e)})))})),g.b_.time("renderer parse effect"),Promise.all(p).then((function(e){g.b_.timeEnd("renderer parse effect"),g.b_.time("renderer apply effect");for(var t=!1,n=0;n<l.length;n++){var i=l[n];w.latestEffectUrls&&-1===w.latestEffectUrls.indexOf(i.getUrl())&&(i.destroy(),t=!0)}if(t)ce.info(r+"end");else{s.forEach((function(e){e.remove()})),w._effects=c,c.forEach((function(e,t){e.intensity=u[t],e.filterIntensity=h[t]}));for(n=0;n<l.length;n++){i=l[n];w._effects.push(i),i.apply({filterTarget:w._baseSprite,filterCallback:function(){}})}s.forEach((function(e){e.destroy()})),g.b_.timeEnd("renderer apply effect"),a(w._effects)}})),[2]}}))}))}))]):[2,new Promise((function(r){clearTimeout(s._meshVertexTimer),s._meshVertexTimer=setInterval((function(){g.b_.info("waiting for AI init..."),s._meshVertex&&(g.b_.info("waiting for AI init...done"),clearTimeout(s._meshVertexTimer),s._setEffect(e,t,n,i).then((function(){r(s._effects)})))}),200)}))]}))}))},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?(console.log("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?(console.log("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(){Q.s.checkEnabled("beautify")&&s._meshVertex&&(t&&clearTimeout(t),r=!0,s.getJSONEffectForFace(e)),Q.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 Z(e,this._appHand3d,this._options,this._canvas);n.renderer=this._renderer,g.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 B(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){e.prototype.resize.call(this,t,n),console.log("renderer resize",t,n),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._baseRenderTexture&&this._baseRenderTexture.resize(t,n),this._makeupRenderTexture&&this._makeupRenderTexture.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(){this._effects.forEach((function(e){e.isPureFilter||"hand"===e.type||e.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(u){switch(u.label){case 0:return e.length?[4,(t=new o.pF).init()]:[2];case 1:u.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(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(){this.hideLoading(),t.loading&&t.loading.destroy(),ue.baseTexture&&(ue.baseTexture.destroy(!0),ue.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,h.M)("ArRenderer"),re("design:type",Function),re("design:paramtypes",[]),re("design:returntype",void 0)],t.prototype,"destroy",null),t}(te.F)}}]);
|