octopus-svga
Version:
高性能SVGA动效播放器,支持Web/微信小程序/支付宝小程序/抖音小程序,设计目标是 解析速度更快、体积更小、性能更高、兼容性更高、功能更丰富。
3 lines • 80.1 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).OctopusSvga={})}(this,(function(t){"use strict";function e(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function n(t,e,n,r,i,a,o){try{var s=t[a](o),u=s.value}catch(t){return void n(t)}s.done?e(u):Promise.resolve(u).then(r,i)}function r(t){return function(){var e=this,r=arguments;return new Promise((function(i,a){var o=t.apply(e,r);function s(t){n(o,i,a,s,u,"next",t)}function u(t){n(o,i,a,s,u,"throw",t)}s(void 0)}))}}function i(t,e,n){return e=l(e),function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,f()?Reflect.construct(e,n||[],l(t).constructor):e.apply(t,n))}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,g(r.key),r)}}function s(t,e,n){return e&&o(t.prototype,e),n&&o(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function u(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=w(t))||e){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return o=t.done,t},e:function(t){s=!0,a=t},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function c(t,e,n){return(e=g(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function l(t){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},l(t)}function f(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(f=function(){return!!t})()}function h(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function v(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?h(Object(n),!0).forEach((function(e){c(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):h(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function d(){
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function a(n,r,i,a){var u=r&&r.prototype instanceof s?r:s,c=Object.create(u.prototype);return y(c,"_invoke",function(n,r,i){var a,s,u,c=0,l=i||[],f=!1,h={p:0,n:0,v:t,a:v,f:v.bind(t,4),d:function(e,n){return a=e,s=0,u=t,h.n=n,o}};function v(n,r){for(s=n,u=r,e=0;!f&&c&&!i&&e<l.length;e++){var i,a=l[e],v=h.p,d=a[2];n>3?(i=d===r)&&(u=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=t):a[0]<=v&&((i=n<2&&v<a[1])?(s=0,h.v=r,h.n=a[1]):v<d&&(i=n<3||a[0]>r||r>d)&&(a[4]=n,a[5]=r,h.n=d,s=0))}if(i||n>1)return o;throw f=!0,r}return function(i,l,d){if(c>1)throw TypeError("Generator is already running");for(f&&1===l&&v(l,d),s=l,u=d;(e=s<2?t:u)||!f;){a||(s?s<3?(s>1&&(h.n=-1),v(s,u)):h.n=u:h.v=u);try{if(c=2,a){if(s||(i="next"),e=a[i]){if(!(e=e.call(a,u)))throw TypeError("iterator result is not an object");if(!e.done)return e;u=e.value,s<2&&(s=0)}else 1===s&&(e=a.return)&&e.call(a),s<2&&(u=TypeError("The iterator does not provide a '"+i+"' method"),s=1);a=t}else if((e=(f=h.n<0)?u:n.call(r,h))!==o)break}catch(e){a=t,s=1,u=e}finally{c=1}}return{value:e,done:f}}}(n,i,a),!0),c}var o={};function s(){}function u(){}function c(){}e=Object.getPrototypeOf;var l=[][r]?e(e([][r]())):(y(e={},r,(function(){return this})),e),f=c.prototype=s.prototype=Object.create(l);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,y(t,i,"GeneratorFunction")),t.prototype=Object.create(f),t}return u.prototype=c,y(f,"constructor",c),y(c,"constructor",u),u.displayName="GeneratorFunction",y(c,i,"GeneratorFunction"),y(f),y(f,i,"Generator"),y(f,r,(function(){return this})),y(f,"toString",(function(){return"[object Generator]"})),(d=function(){return{w:a,m:h}})()}function y(t,e,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}y=function(t,e,n,r){if(e)i?i(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n;else{function a(e,n){y(t,e,(function(t){return this._invoke(e,n,t)}))}a("next",0),a("throw",1),a("return",2)}},y(t,e,n,r)}function p(t,e){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},p(t,e)}function m(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,a,o,s=[],u=!0,c=!1;try{if(a=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=a.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,i=t}finally{try{if(!u&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return s}}(t,e)||w(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==typeof e?e:e+""}function w(t,n){if(t){if("string"==typeof t)return e(t,n);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?e(t,n):void 0}}function k(t,e,n,r){return new(n||(n=Promise))((function(i,a){function o(t){try{u(r.next(t))}catch(t){a(t)}}function s(t){try{u(r.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,s)}u((r=r.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;var b=function(){};function x(t){return C.apply(this,arguments)}function C(){return C=r(d().m((function t(e){var n,r,i,a=arguments;return d().w((function(t){for(;;)switch(t.p=t.n){case 0:n=a.length>1&&void 0!==a[1]?a[1]:[],r=0;case 1:return t.p=2,t.n=3,e();case 3:return t.a(2,t.v);case 4:if(t.p=4,i=t.v,!(r>=n.length)){t.n=5;break}throw i;case 5:return t.n=6,new Promise((function(t){return setTimeout(t,n[r])}));case 6:r++,t.n=1;break;case 7:return t.a(2)}}),t,null,[[2,4]])}))),C.apply(this,arguments)}var T=4096,S=new Uint16Array(T);function P(t,e,n){var r,i=t[e],a=e+1;if(192==(224&i)&&a<n)r=(31&i)<<6|63&t[a++];else if(224==(240&i)&&a+1<n)r=(15&i)<<12|(63&t[a++])<<6|63&t[a++];else if(240==(248&i)&&a+2<n)r=(7&i)<<18|(63&t[a++])<<12|(63&t[a++])<<6|63&t[a++];else for(r=65533;a<n&&128==(192&t[a]);)a++;return{codePoint:r,nextPos:a}}function A(t,e,n,r,i){if(t[e++]=n,e>=4093){for(var a="",o=0;o<e;o++)a+=String.fromCharCode(t[o]);r.push(a),e=0}return e}function M(t,e,n){return function(t,e,n){if(e<0||n>t.length)throw new RangeError("Index out of range")}(t,e,n),n-e<1?"":function(t,e,n){for(var r=e;r<n;r++)if(t[r]>127)return!1;return!0}(t,e,n)?function(t,e,n){for(var r=[],i=e;i<n;i+=T){for(var a=Math.min(i+T,n)-i,o=0;o<a;o++)S[o]=t[i+o];for(var s="",u=0;u<a;u++)s+=String.fromCharCode(S[u]);r.push(s)}return r.join("")}(t,e,n):function(t,e,n){for(var r=[],i=0,a=e;a<n;){var o=t[a++];if(o<128){if(S[i++]=o,i===T){for(var s="",u=0;u<i;u++)s+=String.fromCharCode(S[u]);r.push(s),i=0}}else{if(i>0){for(var c="",l=0;l<i;l++)c+=String.fromCharCode(S[l]);r.push(c),i=0}var f=P(t,a-1,n),h=f.codePoint;if(a=f.nextPos,h>65535){var v=h-65536;if(S[i++]=55296+(v>>10),S[i++]=56320+(1023&v),i>=4094){for(var d="",y=0;y<i;y++)d+=String.fromCharCode(S[y]);r.push(d),i=0}}else i=A(S,i,h,r)}}if(i>0){for(var p="",m=0;m<i;m++)p+=String.fromCharCode(S[m]);r.push(p)}return r.join("")}(t,e,n)}var E=function(){return s((function t(e,n){a(this,t),c(this,"plugins",[]),c(this,"platformVersion","0.2.2"),c(this,"version",""),c(this,"globals",{env:"unknown",br:null,dpr:1,system:""}),c(this,"noop",b),c(this,"retry",x),this.version=n||"",this.plugins=e,this.globals.env=this.autoEnv()}),[{key:"init",value:function(){var t=this.globals,e=this.plugins,n=new Map,r=[],i=new Set;t.br=this.useBridge(),t.dpr=this.usePixelRatio(),t.system=this.useSystem();var a,o=u(e);try{for(o.s();!(a=o.n()).done;){var s=a.value;r.push(s.name),n.set(s.name,s)}}catch(t){o.e(t)}finally{o.f()}this.usePlugins(n,r,i),i.clear()}},{key:"autoEnv",value:function(){for(var t=[{name:"h5",check:function(){return"undefined"!=typeof window}},{name:"tt",check:function(){return"undefined"!=typeof tt}},{name:"alipay",check:function(){return"undefined"!=typeof my}},{name:"weapp",check:function(){return"undefined"!=typeof wx}},{name:"harmony",check:function(){return"undefined"!=typeof has}}],e=0,n=t;e<n.length;e++){var r=n[e];if(r.check())return r.name}throw new Error("Unsupported platform! Available: ".concat(t.map((function(t){return t.name})).join(", ")))}},{key:"useBridge",value:function(){switch(this.globals.env){case"alipay":return my;case"tt":return tt;case"weapp":return wx}return globalThis}},{key:"usePixelRatio",value:function(){var t=this.globals,e=t.env,n=t.br;return"h5"===e?devicePixelRatio:"getWindowInfo"in n?n.getWindowInfo().pixelRatio:"getSystemInfoSync"in n?n.getSystemInfoSync().pixelRatio:1}},{key:"useSystem",value:function(){var t;switch(this.globals.env){case"weapp":t=wx.getDeviceInfo().platform;break;case"alipay":t=my.getDeviceBaseInfo().platform;break;case"tt":t=tt.getDeviceInfoSync().platform;break;case"harmony":t=has.getSystemInfoSync().platform;break;case"h5":if("userAgentData"in navigator)t=navigator.userAgentData.platform;else{var e=navigator.userAgent;t=/(Android|Adr)/i.test(e)?"android":/\(i[^;]+;( U;)? CPU.+Mac OS X/i.test(e)?"ios":/HarmonyOS/i.test(e)?"harmony":"unknown"}break;default:t="unknown"}return t.toLowerCase()}},{key:"usePlugins",value:function(t,e,n){var r,i=u(e);try{for(i.s();!(r=i.n()).done;){var a=r.value;if(!t.has(a))throw new Error("Plugin ".concat(a," not found"));if(n.has(a))return;var o=t.get(a);if(Array.isArray(o.dependencies)){var s,c=u(o.dependencies);try{for(c.s();!(s=c.n()).done;){var l,f=s.value;if("function"!=typeof(null===(l=t.get(f))||void 0===l?void 0:l.install))throw new Error("Plugin ".concat(a," depends on plugin ").concat(f,", but ").concat(f," is not found"))}}catch(t){c.e(t)}finally{c.f()}this.usePlugins(t,o.dependencies,n)}this.installPlugin(o),n.add(a)}}catch(t){i.e(t)}finally{i.f()}}},{key:"switch",value:function(t){this.globals.env=t,this.init()}}])}();var I,O,R={name:"getCanvas",dependencies:["getSelector"],install:function(){var t=this.retry,e=this.getSelector,n=this.globals,r=n.env,i=n.dpr,a=[50,100,100];function o(t,e,n,r){if(!t)throw new Error("canvas not found.");var a=t.getContext(r);return t.width=e*i,t.height=n*i,{canvas:t,context:a}}return"h5"===r?function(n,r){var i=(null==r?void 0:r.type)||"2d";return t((function(){var t=e("canvas[canvas-id=".concat(n.slice(1),"]"))||e(n);return o(t,null==t?void 0:t.clientWidth,null==t?void 0:t.clientHeight,i)}),a)}:function(n,r){var i,s;return r?"function"==typeof r.setData?(i="2d",s=r):(i=r.type||"2d",s=r.component||null):(i="2d",s=null),t((function(){return new Promise((function(t,r){e(n,s).exec((function(e){var n=e[0]||{},a=n.node,s=n.width,u=n.height;try{t(o(a,s,u,i))}catch(t){r(t)}}))}))}),a)}}},D={name:"codec",install:function(){var t=this.globals,e=t.env,n=t.br,r=function(t){return"data:".concat(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"image/png",";base64,").concat(t)},i={toBuffer:function(t){var e=t.buffer,n=t.byteOffset,r=t.byteLength;if(e instanceof ArrayBuffer)return e.slice(n,n+r);var i=new Uint8Array(r);return i.set(t),i.buffer},bytesToString:function(t){for(var e="",n=0;n<t.length;n+=8192){var r=t.slice(n,n+8192);e+=String.fromCharCode.apply(null,Array.from(r))}return e}};if("h5"===e){var a=new TextDecoder("utf-8",{fatal:!0});return v(v({},i),{},{toDataURL:function(t){return r(btoa(i.bytesToString(t)))},utf8:function(t,e,n){return a.decode(t.subarray(e,n))}})}return v(v({},i),{},{toDataURL:function(t){return r(n.arrayBufferToBase64(i.toBuffer(t)))},utf8:M})}},B={name:"remote",install:function(){var t=this.globals,e=t.env,n=t.br,r=function(t){return/^(blob:)?http(s)?:\/\//.test(t)};if("h5"===e)return{is:r,fetch:function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}((function(t){return fetch(t,{priority:"low"}).then((function(t){if(t.ok)return t.arrayBuffer();throw new Error("HTTP error, status=".concat(t.status,", statusText=").concat(t.statusText))}))}))};function i(t,e){return new Promise((function(r,i){n.request({url:t,dataType:"arraybuffer",responseType:"arraybuffer",enableCache:e,success:function(t){return r(t.data)},fail:i})})).catch((function(e){var n=e.errMsg||e.errorMessage||e.message;if(n.includes("ERR_CACHE_WRITE_FAILURE")||n.includes("ERR_CACHE_WRITE_FAILED"))return i(t,!1);throw e}))}return{is:r,fetch:function(t){return i(t,!0)}}}},F={name:"image",dependencies:["local","codec"],install:function(){var t,e,n=this.local,i=this.codec,a=this.globals.env,o=function(t){return console.error("image error: ".concat(t))},s=function(t,e){return"string"==typeof t?t:i.toDataURL(t)};function u(t,e){return new Promise((function(n,r){t.onload=function(){return n(t)},t.onerror=function(){return r(new Error("SVGA LOADING FAILURE: ".concat(e)))},t.crossOrigin="anonymous",t.src=e}))}function c(t){t.onload=null,t.onerror=null,t.src=""}return"h5"===a?{create:function(t){return new Image},load:(t=r(d().m((function t(e,n,r){var a;return d().w((function(t){for(;;)switch(t.p=t.n){case 0:if(!(n instanceof Uint8Array&&"createImageBitmap"in globalThis)){t.n=4;break}return t.p=1,t.n=2,createImageBitmap(new Blob([i.toBuffer(n)]));case 2:n=t.v,t.n=4;break;case 3:t.p=3,a=t.v,o(a.message);case 4:if(!(n instanceof ImageBitmap)){t.n=5;break}return t.a(2,n);case 5:return t.a(2,u(e(),s(n,r)))}}),t,null,[[1,3]])}))),function(e,n,r){return t.apply(this,arguments)}),release:c}:("weapp"===a&&(s=function(){var t=r(d().m((function t(e,r){return d().w((function(t){for(;;)switch(t.n){case 0:if("string"!=typeof e){t.n=1;break}return t.a(2,e);case 1:return t.a(2,n.write(i.toBuffer(e),r).catch((function(t){return o(t.errorMessage||t.errMsg||t.message),i.toDataURL(e)})))}}),t)})));return function(e,n){return t.apply(this,arguments)}}()),{create:function(t){return t.createImage()},load:(e=r(d().m((function t(e,n,r){var i,a,o;return d().w((function(t){for(;;)switch(t.n){case 0:return i=u,a=e(),t.n=1,s(n,r);case 1:return o=t.v,t.a(2,i(a,o))}}),t)}))),function(t,n,r){return e.apply(this,arguments)}),release:c})}},U=(I=[{name:"getSelector",install:function(){var t=this.globals,e=t.env,n=t.br;return"h5"===e?function(t){return document.querySelector(t)}:function(t,e){return(e||n).createSelectorQuery().select(t).fields({node:!0,size:!0})}}},R,{name:"getOfsCanvas",install:function(){var t,e=this.globals.env;return t="h5"===e?function(t){return new OffscreenCanvas(t.width,t.height)}:"alipay"===e?function(t){return my.createOffscreenCanvas(t)}:"tt"===e?function(t){var e=tt.createOffscreenCanvas();return e.width=t.width,e.height=t.height,e}:function(t){return wx.createOffscreenCanvas(t)},function(e){var n=e.type||"2d",r=t(v(v({},e),{},{type:n})),i=r.getContext(n);return{canvas:r,context:i}}}},D,B,{name:"local",install:function(){var t=this.globals,e=t.env,n=t.br;if("h5"===e||"tt"===e)return null;var r=n.getFileSystemManager();return{exists:function(t){return new Promise((function(e){r.access({path:t,success:function(){return e(!0)},fail:function(){return e(!1)}})}))},write:function(t,e){return new Promise((function(n,i){r.writeFile({filePath:e,data:t,success:function(){return n(e)},fail:i})}))},read:function(t){return new Promise((function(e,n){r.readFile({filePath:t,success:function(t){return e(t.data)},fail:n})}))},remove:function(t){return new Promise((function(e,n){r.unlink({filePath:t,success:function(){return e(t)},fail:n})}))}}}},F,{name:"now",install:function(){var t=this.globals,e=t.env,n=t.br,r="h5"===e||"tt"===e?performance:n.getPerformance();return"function"==typeof(null==r?void 0:r.now)?r.now()-Date.now()>1?function(){return r.now()/1e3}:function(){return r.now()}:function(){return Date.now()}}},{name:"path",install:function(){var t=this.globals,e=t.env,n=t.br,r=function(t){var e=t.split(/\?#/g)[0];return e.substring(e.lastIndexOf("/")+1)};if("h5"===e||"tt"===e)return{USER_DATA_PATH:"",is:function(t){return!1},filename:r,resolve:function(t,e){return""}};var i=n.env.USER_DATA_PATH;return{USER_DATA_PATH:i,is:function(t){return null==t?void 0:t.startsWith(i)},filename:r,resolve:function(t,e){return"".concat(i,"/").concat(e?"".concat(e,"__"):"").concat(t)}}}},{name:"rAF",install:function(){function t(){return function(t){return setTimeout(t,Math.max(0,16-Date.now()%16))}}if("h5"===this.globals.env){var e="requestAnimationFrame"in globalThis?requestAnimationFrame:t();return function(t,n){return e(n)}}return function(e,n){try{return e.requestAnimationFrame(n)}catch(e){return console.warn(e.message),t()(n)}}}}],O="2.0.1",new(function(t){function e(){var t;return a(this,e),(t=i(this,e,[I,O])).init(),t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&p(t,e)}(e,t),s(e,[{key:"installPlugin",value:function(t){!function(t,e){var n=e.install.call(t);Object.defineProperty(t,e.name,{get:function(){return n},enumerable:!0,configurable:!0})}(this,t)}}])}(E))),j=function(){function t(e){a(this,t),this.painter=e,this.caches=[],this.dynamicMaterials=new Map,this.materials=new Map,this.point=0}return s(t,[{key:"createImage",value:function(){var t=null;return this.point>0&&(this.point--,t=this.caches.shift()),t||(t=U.image.create(this.painter.F)),this.caches.push(t),t}},{key:"inertBitmapIntoCaches",value:function(e){t.isBitmap(e)&&this.caches.push(e)}},{key:"loadExtImage",value:function(t,e){var n=this;return U.image.load((function(){return n.createImage()}),t,U.path.resolve(e,"ext")).then((function(t){return n.inertBitmapIntoCaches(t),t}))}},{key:"loadImagesWithRecord",value:function(t,e){return k(this,arguments,void 0,(function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"normal";return d().m((function i(){var a,o;return d().w((function(i){for(;;)switch(i.n){case 0:return a=[],o="".concat(e.replace(/\.svga$/g,""),".png"),Object.entries(t).forEach((function(t){var e=m(t,2),i=e[0],s=e[1];if(!(s instanceof Uint8Array&&s.byteLength<70)){var u=U.image.load((function(){return n.createImage()}),s,U.path.resolve(o,"dynamic"===r?"dyn_".concat(i):i)).then((function(t){n.inertBitmapIntoCaches(t),"dynamic"===r?n.dynamicMaterials.set(i,t):n.materials.set(i,t)}));a.push(u)}})),i.n=1,Promise.all(a);case 1:return i.a(2)}}),i)}))()}))}},{key:"release",value:function(){var e,n=u(this.caches);try{for(n.s();!(e=n.n()).done;){var r=e.value;t.releaseOne(r)}}catch(t){n.e(t)}finally{n.f()}this.materials.clear(),this.dynamicMaterials.clear(),"alipay"===U.globals.env?this.cleanup():this.tidyUp()}},{key:"tidyUp",value:function(){this.caches=Array.from(new Set(this.caches)),this.point=this.caches.length}},{key:"cleanup",value:function(){this.caches.length=0,this.point=0}}],[{key:"isBitmap",value:function(t){return"h5"===U.globals.env&&t instanceof ImageBitmap}},{key:"releaseOne",value:function(e){t.isBitmap(e)?e.close():""!==e.src&&(U.path.is(e.src)&&U.local.remove(e.src),U.image.release(e))}}])}();var _,z,L=(_=Array(4).fill(0).map((function(){return new DataView(new ArrayBuffer(8))})),z=0,function(t,e){if(e<0||e+4>t.length)throw new RangeError("Index out of range");var n=_[z];z=(z+1)%4;var r=new Uint8Array(n.buffer);return r[0]=t[e],r[1]=t[e+1],r[2]=t[e+2],r[3]=t[e+3],n.getFloat32(0,!0)});var H=function(){return s((function t(){a(this,t),this.caches=new Map,this.count=0}),[{key:"size",get:function(){return this.caches.size}},{key:"hitCount",get:function(){return this.count}},{key:"calculate",value:function(t,e){var n=t.pos,r=t.buf,i=Math.min(e,t.len);return function(t,e,n,r){for(var i=0,a=e;a<n;a+=r)i=(i<<5)-i+t[a],i|=0;return i=(i<<5)-i+n-e,(i|=0).toString(36)}(r,n,i,Math.max(1,Math.floor((i-n)/100)))}},{key:"has",value:function(t){var e=this.caches.has(t);return e&&this.count++,e}},{key:"get",value:function(t){return this.caches.get(t)}},{key:"set",value:function(t,e){this.caches.set(t,e)}},{key:"clear",value:function(){this.count=0,this.caches.clear()}}])}(),V=function(){function t(e){a(this,t),this.preflight=new H,this.buf=e,this.pos=0,this.len=e.length}return s(t,[{key:"indexOutOfRange",value:function(t,e){return new RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}},{key:"readVarint32Slow",value:function(){var t=this.buf[this.pos++],e=127&t,n=7;do{if(this.pos>=this.len)throw this.indexOutOfRange(this);e|=(127&(t=this.buf[this.pos++]))<<n,n+=7}while(t>=128&&n<32);return e>>>0}},{key:"end",value:function(t){return void 0===t?this.len:this.pos+t}},{key:"uint32",value:function(){var t=this.buf[this.pos];return t<128?(this.pos++,t):this.readVarint32Slow()}},{key:"int32",value:function(){return 0|this.uint32()}},{key:"float",value:function(){var t=this.pos+4;if(t>this.len)throw this.indexOutOfRange(this,4);var e=L(this.buf,this.pos);return this.pos=t,e}},{key:"getBytesRange",value:function(){var t=this.uint32(),e=this.pos,n=e+t;if(n>this.len)throw this.indexOutOfRange(this,t);return[e,n,t]}},{key:"bytes",value:function(){var e=m(this.getBytesRange(),3),n=e[0],r=e[1],i=e[2];return this.pos+=i,0===i?t.EMPTY_UINT8ARRAY:this.buf.subarray(n,r)}},{key:"string",value:function(){var t=m(this.getBytesRange(),2),e=t[0],n=t[1],r=U.codec.utf8(this.buf,e,n);return this.pos=n,r}},{key:"skip",value:function(t){if("number"==typeof t){if(this.pos+t>this.len)throw this.indexOutOfRange(this,t);return this.pos+=t,this}for(var e=this.buf,n=this.len,r=this.pos;r<n;){if(!(128&e[r++]))return this.pos=r,this;if(r<n&&128&e[r]&&++r<n&&128&e[r]&&++r<n&&128&e[r]){for(r++;r<n&&128&e[r];)if(++r-this.pos>=10)throw Error("invalid varint encoding");if(r<n)return this.pos=r+1,this}}throw this.indexOutOfRange(this)}},{key:"skipType",value:function(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(t=7&this.uint32());)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this}}])}();V.EMPTY_UINT8ARRAY=new Uint8Array(0);var W=function(){function t(){a(this,t),this.x=0,this.y=0,this.width=0,this.height=0}return s(t,null,[{key:"decode",value:function(e,n){var r=e.preflight,i=e.end(n),a=r.calculate(e,i);if(r.has(a))return e.pos=i,r.get(a);for(var o,s=new t;e.pos<i;)switch((o=e.uint32())>>>3){case 1:s.x=e.float();break;case 2:s.y=e.float();break;case 3:s.width=e.float();break;case 4:s.height=e.float();break;default:e.skipType(7&o)}return r.set(a,t.format(s)),r.get(a)}},{key:"format",value:function(t){var e=t.x,n=void 0===e?0:e,r=t.y,i=void 0===r?0:r,a=t.width,o=void 0===a?0:a,s=t.height;return{x:n,y:i,width:o,height:void 0===s?0:s}}}])}(),N=function(){function t(){a(this,t),this.a=0,this.b=0,this.c=0,this.d=0,this.tx=0,this.ty=0}return s(t,null,[{key:"decode",value:function(e,n){for(var r,i=e.end(n),a=new t;e.pos<i;)switch((r=e.uint32())>>>3){case 1:a.a=e.float();break;case 2:a.b=e.float();break;case 3:a.c=e.float();break;case 4:a.d=e.float();break;case 5:a.tx=e.float();break;case 6:a.ty=e.float();break;default:e.skipType(7&r)}return a}}])}(),G=function(){function t(){a(this,t),this.d=""}return s(t,null,[{key:"decode",value:function(e,n){var r=e.preflight,i=e.end(n),a=r.calculate(e,i);if(r.has(a))return e.pos=i,r.get(a);for(var o,s=new t;e.pos<i;)if((o=e.uint32())>>>3==1)s.d=e.string();else e.skipType(7&o);return r.set(a,s),r.get(a)}}])}(),Y=function(){function t(){a(this,t),this.x=0,this.y=0,this.width=0,this.height=0,this.cornerRadius=0}return s(t,null,[{key:"decode",value:function(e,n){var r=e.preflight,i=e.end(n),a=r.calculate(e,i);if(r.has(a))return e.pos=i,r.get(a);for(var o,s=new t;e.pos<i;)switch((o=e.uint32())>>>3){case 1:s.x=e.float();break;case 2:s.y=e.float();break;case 3:s.width=e.float();break;case 4:s.height=e.float();break;case 5:s.cornerRadius=e.float();break;default:e.skipType(7&o)}return r.set(a,s),r.get(a)}}])}(),q=function(){function t(){a(this,t),this.x=0,this.y=0,this.radiusX=0,this.radiusY=0}return s(t,null,[{key:"decode",value:function(e,n){var r=e.preflight,i=e.end(n),a=r.calculate(e,i);if(r.has(a))return e.pos=i,r.get(a);for(var o,s=new t;e.pos<i;)switch((o=e.uint32())>>>3){case 1:s.x=e.float();break;case 2:s.y=e.float();break;case 3:s.radiusX=e.float();break;case 4:s.radiusY=e.float();break;default:e.skipType(7&o)}return r.set(a,s),r.get(a)}}])}(),X=function(){function t(){a(this,t),this.r=0,this.g=0,this.b=0,this.a=0}return s(t,null,[{key:"decode",value:function(e,n){var r=e.preflight,i=e.end(n),a=r.calculate(e,i);if(r.has(a))return e.pos=i,r.get(a);for(var o,s=new t;e.pos<i;)switch((o=e.uint32())>>>3){case 1:s.r=e.float();break;case 2:s.g=e.float();break;case 3:s.b=e.float();break;case 4:s.a=e.float();break;default:e.skipType(7&o)}return r.set(a,t.format(s)),r.get(a)}},{key:"format",value:function(t){var e=t.r,n=t.g,r=t.b,i=t.a;return"rgba(".concat(255*e|0,", ").concat(255*n|0,", ").concat(255*r|0,", ").concat(1*i|0,")")}}])}(),K=function(){function t(){a(this,t),this.fill=null,this.stroke=null,this.strokeWidth=0,this.lineCap=0,this.lineJoin=0,this.miterLimit=0,this.lineDashI=0,this.lineDashII=0,this.lineDashIII=0}return s(t,null,[{key:"decode",value:function(e,n){var r=e.preflight,i=e.end(n),a=r.calculate(e,i);if(r.has(a))return e.pos=i,r.get(a);for(var o,s=new t;e.pos<i;)switch((o=e.uint32())>>>3){case 1:s.fill=X.decode(e,e.uint32());break;case 2:s.stroke=X.decode(e,e.uint32());break;case 3:s.strokeWidth=e.float();break;case 4:s.lineCap=e.int32();break;case 5:s.lineJoin=e.int32();break;case 6:s.miterLimit=e.float();break;case 7:s.lineDashI=e.float();break;case 8:s.lineDashII=e.float();break;case 9:s.lineDashIII=e.float();break;default:e.skipType(7&o)}return r.set(a,t.format(s)),r.get(a)}},{key:"format",value:function(t){var e,n,r=t.fill,i=t.stroke,a=t.strokeWidth,o=t.miterLimit,s=t.lineDashI,u=t.lineDashII,c=t.lineDashIII,l=[];switch(s>0&&l.push(s),u>0&&(l.length<1&&l.push(0),l.push(u)),c>0&&(l.length<2&&l.push(0,0),l.push(c)),t.lineCap){case 0:e="butt";break;case 1:e="round";break;case 2:e="square"}switch(t.lineJoin){case 0:n="miter";break;case 1:n="round";break;case 2:n="bevel"}return{lineDash:l,fill:r||null,stroke:i||null,lineCap:e,lineJoin:n,strokeWidth:a,miterLimit:o}}}])}(),J=function(){function t(){a(this,t),this.type=0,this.shape=null,this.rect=null,this.ellipse=null,this.styles=null,this.transform=null}return s(t,null,[{key:"decode",value:function(e,n){for(var r,i=e.end(n),a=new t;e.pos<i;)switch((r=e.uint32())>>>3){case 1:a.type=e.int32();break;case 2:a.shape=G.decode(e,e.uint32());break;case 3:a.rect=Y.decode(e,e.uint32());break;case 4:a.ellipse=q.decode(e,e.uint32());break;case 10:a.styles=K.decode(e,e.uint32());break;case 11:a.transform=N.decode(e,e.uint32());break;default:e.skipType(7&r)}return t.format(a)}},{key:"format",value:function(t){var e=t.type,n=t.shape,r=t.rect,i=t.ellipse,a=t.styles,o=t.transform;switch(e){case 0:return{type:"shape",path:n,styles:a,transform:o};case 1:return{type:"rect",path:r,styles:a,transform:o};case 2:return{type:"ellipse",path:i,styles:a,transform:o}}return null}}])}(),Q=function(){function t(){a(this,t),this.shapes=[],this.alpha=0,this.layout=null,this.transform=null,this.clipPath=""}return s(t,null,[{key:"decode",value:function(e,n){for(var r,i=e.end(n),a=new t;e.pos<i;)switch((r=e.uint32())>>>3){case 1:a.alpha=e.float();break;case 2:a.layout=W.decode(e,e.uint32());break;case 3:a.transform=N.decode(e,e.uint32());break;case 4:a.clipPath=e.string();break;case 5:var o=J.decode(e,e.uint32());null!==o&&a.shapes.push(o);break;default:e.skipType(7&r)}return 0===a.shapes.length?a.shapes=e.preflight.get("latest_shapes"):e.preflight.set("latest_shapes",a.shapes),t.format(a)}},{key:"format",value:function(e){return e.alpha<.05?t.HIDDEN_FRAME:{alpha:e.alpha,layout:e.layout,transform:e.transform,shapes:e.shapes}}}])}();Q.HIDDEN_FRAME={alpha:0};var Z=function(){function t(){a(this,t),this.frames=[],this.imageKey="",this.matteKey=""}return s(t,null,[{key:"decode",value:function(e,n){var r,i=e.end(n),a=new t;for(e.preflight.set("latest_shapes",[]);e.pos<i;)switch((r=e.uint32())>>>3){case 1:a.imageKey=e.string();break;case 2:a.frames&&a.frames.length||(a.frames=[]),a.frames.push(Q.decode(e,e.uint32()));break;case 3:a.matteKey=e.string();break;default:e.skipType(7&r)}return t.format(a)}},{key:"format",value:function(t){return{imageKey:t.imageKey,frames:t.frames}}}])}(),$=function(){function t(){a(this,t),this.viewBoxWidth=0,this.viewBoxHeight=0,this.fps=0,this.frames=0}return s(t,null,[{key:"decode",value:function(e,n){for(var r,i=e.end(n),a=new t;e.pos<i;)switch((r=e.uint32())>>>3){case 1:a.viewBoxWidth=e.float();break;case 2:a.viewBoxHeight=e.float();break;case 3:a.fps=e.int32();break;case 4:a.frames=e.int32();break;default:e.skipType(7&r)}return a}}])}(),et=function(){function t(){a(this,t),this.version="",this.params=null,this.images={},this.sprites=[]}return s(t,null,[{key:"decode",value:function(e,n){for(var r,i,a,o,s,u=e.end(n),c=new t;e.pos<u;)switch((o=e.uint32())>>>3){case 1:c.version=e.string();break;case 2:c.params=$.decode(e,e.uint32());break;case 3:for(a=e.uint32()+e.pos,r="",i=t.EMPTY_U8;e.pos<a;)switch((s=e.uint32())>>>3){case 1:r=e.string();break;case 2:i=e.bytes();break;default:e.skipType(7&s)}c.images[r]=i;break;case 4:c.sprites.push(Z.decode(e,e.uint32()));break;default:e.skipType(7&o)}return t.format(c)}},{key:"format",value:function(t){var e=t.version,n=t.images,r=t.sprites,i=t.params,a=i.fps,o=i.frames;return{version:e,filename:"",locked:!1,dynamicElements:{},size:{width:i.viewBoxWidth,height:i.viewBoxHeight},fps:a,frames:o,images:n,sprites:r}}}])}();et.EMPTY_U8=new Uint8Array(0);var nt=function(){return s((function t(){a(this,t),this.pool=[]}),[{key:"acquire",value:function(){var t=this.pool;return t.length>0?t.pop():{x:0,y:0,x1:0,y1:0,x2:0,y2:0}}},{key:"release",value:function(t){t.x=t.y=t.x1=t.y1=t.x2=t.y2=0,this.pool.push(t)}}])}(),rt=function(){function t(e){a(this,t),this.context=e,this.pointPool=new nt,this.lastResizeKey="",this.globalTransform=void 0,this.currentPoint=this.pointPool.acquire()}return s(t,[{key:"setTransform",value:function(t){t&&this.context&&this.context.transform(t.a,t.b,t.c,t.d,t.tx,t.ty)}},{key:"drawBezier",value:function(e,n,r){var i=this.context,a=this.pointPool;if(this.currentPoint=a.acquire(),i.save(),t.resetShapeStyles(i,r),this.setTransform(n),i.beginPath(),e){var o,s=u(t.parseSVGPath(e));try{for(s.s();!(o=s.n()).done;){var c=o.value,l=c.command,f=c.args;t.SVG_PATH.has(l)&&this.drawBezierElement(this.currentPoint,l,f.split(/[\s,]+/).filter(Boolean))}}catch(t){s.e(t)}finally{s.f()}}t.fillOrStroke(i,r),a.release(this.currentPoint),i.restore()}},{key:"drawBezierElement",value:function(t,e,n){var r=this.context;switch(e){case"M":t.x=+n[0],t.y=+n[1],r.moveTo(t.x,t.y);break;case"m":t.x+=+n[0],t.y+=+n[1],r.moveTo(t.x,t.y);break;case"L":t.x=+n[0],t.y=+n[1],r.lineTo(t.x,t.y);break;case"l":t.x+=+n[0],t.y+=+n[1],r.lineTo(t.x,t.y);break;case"H":t.x=+n[0],r.lineTo(t.x,t.y);break;case"h":t.x+=+n[0],r.lineTo(t.x,t.y);break;case"V":t.y=+n[0],r.lineTo(t.x,t.y);break;case"v":t.y+=+n[0],r.lineTo(t.x,t.y);break;case"C":t.x1=+n[0],t.y1=+n[1],t.x2=+n[2],t.y2=+n[3],t.x=+n[4],t.y=+n[5],r.bezierCurveTo(t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"c":t.x1=t.x+ +n[0],t.y1=t.y+ +n[1],t.x2=t.x+ +n[2],t.y2=t.y+ +n[3],t.x+=+n[4],t.y+=+n[5],r.bezierCurveTo(t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"S":void 0!==t.x1&&void 0!==t.y1&&void 0!==t.x2&&void 0!==t.y2?(t.x1=t.x-t.x2+t.x,t.y1=t.y-t.y2+t.y,t.x2=+n[0],t.y2=+n[1],t.x=+n[2],t.y=+n[3],r.bezierCurveTo(t.x1,t.y1,t.x2,t.y2,t.x,t.y)):(t.x1=+n[0],t.y1=+n[1],t.x=+n[2],t.y=+n[3],r.quadraticCurveTo(t.x1,t.y1,t.x,t.y));break;case"s":void 0!==t.x1&&void 0!==t.y1&&void 0!==t.x2&&void 0!==t.y2?(t.x1=t.x-t.x2+t.x,t.y1=t.y-t.y2+t.y,t.x2=t.x+ +n[0],t.y2=t.y+ +n[1],t.x+=+n[2],t.y+=+n[3],r.bezierCurveTo(t.x1,t.y1,t.x2,t.y2,t.x,t.y)):(t.x1=t.x+ +n[0],t.y1=t.y+ +n[1],t.x+=+n[2],t.y+=+n[3],r.quadraticCurveTo(t.x1,t.y1,t.x,t.y));break;case"Q":t.x1=+n[0],t.y1=+n[1],t.x=+n[2],t.y=+n[3],r.quadraticCurveTo(t.x1,t.y1,t.x,t.y);break;case"q":t.x1=t.x+ +n[0],t.y1=t.y+ +n[1],t.x+=+n[2],t.y+=+n[3],r.quadraticCurveTo(t.x1,t.y1,t.x,t.y);break;case"Z":case"z":r.closePath()}}},{key:"drawEllipse",value:function(e,n,r,i,a,o){var s=this.context;s.save(),t.resetShapeStyles(s,o),this.setTransform(a);var u=2*r,c=2*i,l=.5522848,f=u/2*l,h=c/2*l,v=(e-=r)+u,d=(n-=i)+c,y=e+u/2,p=n+c/2;s.beginPath(),s.moveTo(e,p),s.bezierCurveTo(e,p-h,y-f,n,y,n),s.bezierCurveTo(y+f,n,v,p-h,v,p),s.bezierCurveTo(v,p+h,y+f,d,y,d),s.bezierCurveTo(y-f,d,e,p+h,e,p),t.fillOrStroke(s,o),s.restore()}},{key:"drawRect",value:function(e,n,r,i,a,o,s){var u=this.context;u.save(),t.resetShapeStyles(u,s),this.setTransform(o);var c=a;r<2*c&&(c=r/2),i<2*c&&(c=i/2),u.beginPath(),u.moveTo(e+c,n),u.arcTo(e+r,n,e+r,n+i,c),u.arcTo(e+r,n+i,e,n+i,c),u.arcTo(e,n+i,e,n,c),u.arcTo(e,n,e+r,n,c),u.closePath(),t.fillOrStroke(u,s),u.restore()}},{key:"drawShape",value:function(t){var e,n,r,i,a,o,s,u,c,l=t.type,f=t.path,h=t.transform,v=t.styles;switch(l){case"shape":this.drawBezier(f.d,h,v);break;case"ellipse":this.drawEllipse(null!==(e=f.x)&&void 0!==e?e:0,null!==(n=f.y)&&void 0!==n?n:0,null!==(r=f.radiusX)&&void 0!==r?r:0,null!==(i=f.radiusY)&&void 0!==i?i:0,h,v);break;case"rect":this.drawRect(null!==(a=f.x)&&void 0!==a?a:0,null!==(o=f.y)&&void 0!==o?o:0,null!==(s=f.width)&&void 0!==s?s:0,null!==(u=f.height)&&void 0!==u?u:0,null!==(c=f.cornerRadius)&&void 0!==c?c:0,h,v)}}},{key:"drawSprite",value:function(t,e,n){if(0!==t.alpha){var r=this.context,i=t.alpha,a=t.transform,o=t.layout,s=t.shapes,u=null!=a?a:{},c=u.a,l=void 0===c?1:c,f=u.b,h=void 0===f?0:f,v=u.c,d=void 0===v?0:v,y=u.d,p=void 0===y?1:y,m=u.tx,g=void 0===m?0:m,w=u.ty,k=void 0===w?0:w;r.save(),this.setTransform(this.globalTransform),r.globalAlpha=i,r.transform(l,h,d,p,g,k),e&&r.drawImage(e,0,0,o.width,o.height),n&&r.drawImage(n,(o.width-n.width)/2,(o.height-n.height)/2);for(var b=0;b<s.length;b++)this.drawShape(s[b]);r.restore()}}},{key:"resize",value:function(e,n,r){var i=r.width,a=r.height,o=n.width,s=n.height,u="".concat(e,"-").concat(o,"-").concat(s,"-").concat(i,"-").concat(a),c=this.globalTransform;if(this.lastResizeKey!==u||!c){var l={scaleX:1,scaleY:1,translateX:0,translateY:0};"fill"===e?(l.scaleX=i/o,l.scaleY=a/s):l=t.calculateScale(e,n,r),this.lastResizeKey=u,this.globalTransform={a:l.scaleX,b:0,c:0,d:l.scaleY,tx:l.translateX,ty:l.translateY}}}},{key:"render",value:function(t,e,n,r,i,a){for(var o,s,u,c,l=i;l<a;l++)s=(o=t.sprites[l]).imageKey,u=e.get(s),c=n.get(s),this.drawSprite(o.frames[r],u,c)}},{key:"destroy",value:function(){this.globalTransform=void 0,this.lastResizeKey="",this.context=null}}],[{key:"parseSVGPath",value:function(e){for(var n=t.SVG_LETTER_REGEXP,r=[],i=0,a=0,o="",s="";i<e.length;){var u=e[i];switch(a){case 0:n.test(u)&&(o=u,a=1);break;case 1:n.test(u)?(r.push({command:o,args:s.trim()}),o=u,s=""):s+=u}i++}return o&&1===a&&r.push({command:o,args:s.trim()}),r}},{key:"fillOrStroke",value:function(t,e){e&&(e.fill&&t.fill(),e.stroke&&t.stroke())}},{key:"resetShapeStyles",value:function(t,e){e&&(t.strokeStyle=e.stroke||"transparent",e.strokeWidth>0&&(t.lineWidth=e.strokeWidth),e.miterLimit>0&&(t.miterLimit=e.miterLimit),e.lineCap&&(t.lineCap=e.lineCap),e.lineJoin&&(t.lineJoin=e.lineJoin),t.fillStyle=e.fill||"transparent",e.lineDash&&t.setLineDash(e.lineDash))}},{key:"calculateScale",value:function(t,e,n){var r=e.width/e.height,i=n.width/n.height,a="aspect-fit"===t,o=function(t,e,n){return{scaleX:t,scaleY:t,translateX:e,translateY:n}};if(r>=i&&a||r<=i&&!a){var s=n.width/e.width;return o(s,0,(n.height-e.height*s)/2)}var u=n.height/e.height;return o(u,(n.width-e.width*u)/2,0)}}])}();rt.SVG_PATH=new Set(["M","L","H","V","Z","C","S","Q","m","l","h","v","z","c","s","q"]),rt.SVG_LETTER_REGEXP=/[a-zA-Z]/;var it=function(t,e){return function(){return t.drawImage(e,0,0)}},at=function(t,e,n,r,i){return"CL"===t?function(){e.clearRect(0,0,r,i)}:function(){n.width=r,n.height=i}},ot=function(){return s((function t(){a(this,t),this.isRunning=!1,this.startTime=0,this.duration=0,this.loopStart=0,this.pauseTime=0,this.loopDuration=0,this.onAnimate=U.noop,this.onStart=U.noop,this.onUpdate=U.noop,this.onEnd=U.noop}),[{key:"setConfig",value:function(t,e,n,r){this.duration=t,this.loopStart=e,this.loopDuration=t*n+r-e}},{key:"start",value:function(){this.isRunning=!0,this.startTime=U.now(),this.pauseTime=0,this.onStart(),this.doFrame()}},{key:"resume",value:function(){return 0!==this.startTime&&(this.isRunning=!0,this.doFrame(),!0)}},{key:"pause",value:function(){return 0!==this.startTime&&(this.isRunning=!1,this.pauseTime=(U.now()-this.startTime)%this.duration,!0)}},{key:"stop",value:function(){this.isRunning=!1,this.startTime=0}},{key:"doFrame",value:function(){var t=this;this.isRunning&&(this.doDeltaTime(U.now()-this.startTime),this.isRunning&&this.onAnimate((function(){return t.doFrame()})))}},{key:"doDeltaTime",value:function(t){var e,n=this.duration,r=this.loopStart,i=this.pauseTime,a=!1;t>=this.loopDuration?(e=1,a=!0,this.stop()):e=(t+r+i)%n/n,this.onUpdate(e),!this.isRunning&&a&&this.onEnd()}}])}(),st=Uint8Array,ut=Uint16Array,ct=Int32Array,lt=new st([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),ft=new st([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),ht=new st([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),vt=function(t,e){for(var n=new ut(31),r=0;r<31;++r)n[r]=e+=1<<t[r-1];for(var i=new ct(n[30]),a=1;a<30;++a)for(var o=n[a];o<n[a+1];++o)i[o]=o-n[a]<<5|a;return{b:n,r:i}},dt=vt(lt,2),yt=dt.b,pt=dt.r;yt[28]=258,pt[258]=28;for(var mt=vt(ft,0),gt=mt.b,wt=mt.r,kt=new ut(32768),bt=0;bt<32768;++bt){var xt=(43690&bt)>>1|(21845&bt)<<1;xt=(61680&(xt=(52428&xt)>>2|(13107&xt)<<2))>>4|(3855&xt)<<4,kt[bt]=((65280&xt)>>8|(255&xt)<<8)>>1}for(var Ct=function(t,e,n){for(var r=t.length,i=0,a=new ut(e);i<r;++i)t[i]&&++a[t[i]-1];var o,s=new ut(e);for(i=1;i<e;++i)s[i]=s[i-1]+a[i-1]<<1;if(n){o=new ut(1<<e);var u=15-e;for(i=0;i<r;++i)if(t[i])for(var c=i<<4|t[i],l=e-t[i],f=s[t[i]-1]++<<l,h=f|(1<<l)-1;f<=h;++f)o[kt[f]>>u]=c}else for(o=new ut(r),i=0;i<r;++i)t[i]&&(o[i]=kt[s[t[i]-1]++]>>15-t[i]);return o},Tt=new st(288),St=0;St<144;++St)Tt[St]=8;for(var Pt=144;Pt<256;++Pt)Tt[Pt]=9;for(var At=256;At<280;++At)Tt[At]=7;for(var Mt=280;Mt<288;++Mt)Tt[Mt]=8;for(var Et=new st(32),It=0;It<32;++It)Et[It]=5;var Ot=Ct(Tt,9,0),Rt=Ct(Tt,9,1),Dt=Ct(Et,5,0),Bt=Ct(Et,5,1),Ft=function(t){for(var e=t[0],n=1;n<t.length;++n)t[n]>e&&(e=t[n]);return e},Ut=function(t,e,n){var r=e/8|0;return(t[r]|t[r+1]<<8)>>(7&e)&n},jt=function(t,e){var n=e/8|0;return(t[n]|t[n+1]<<8|t[n+2]<<16)>>(7&e)},_t=function(t){return(t+7)/8|0},zt=function(t,e,n){return(null==n||n>t.length)&&(n=t.length),new st(t.subarray(e,n))},Lt=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Ht=function(t,e,n){var r=new Error(e||Lt[t]);if(r.code=t,Error.captureStackTrace&&Error.captureStackTrace(r,Ht),!n)throw r;return r},Vt=function(t,e,n){n<<=7&e;var r=e/8|0;t[r]|=n,t[r+1]|=n>>8},Wt=function(t,e,n){n<<=7&e;var r=e/8|0;t[r]|=n,t[r+1]|=n>>8,t[r+2]|=n>>16},Nt=function(t,e){for(var n=[],r=0;r<t.length;++r)t[r]&&n.push({s:r,f:t[r]});var i=n.length,a=n.slice();if(!i)return{t:Qt,l:0};if(1==i){var o=new st(n[0].s+1);return o[n[0].s]=1,{t:o,l:1}}n.sort((function(t,e){return t.f-e.f})),n.push({s:-1,f:25001});var s=n[0],u=n[1],c=0,l=1,f=2;for(n[0]={s:-1,f:s.f+u.f,l:s,r:u};l!=i-1;)s=n[n[c].f<n[f].f?c++:f++],u=n[c!=l&&n[c].f<n[f].f?c++:f++],n[l++]={s:-1,f:s.f+u.f,l:s,r:u};for(var h=a[0].s,v=1;v<i;++v)a[v].s>h&&(h=a[v].s);var d=new ut(h+1),y=Gt(n[l-1],d,0);if(y>e){var p=0,m=0,g=y-e,w=1<<g;for(a.sort((function(t,e){return d[e.s]-d[t.s]||t.f-e.f}));p<i;++p){var k=a[p].s;if(!(d[k]>e))break;m+=w-(1<<y-d[k]),d[k]=e}for(m>>=g;m>0;){var b=a[p].s;d[b]<e?m-=1<<e-d[b]++-1:++p}for(;p>=0&&m;--p){var x=a[p].s;d[x]==e&&(--d[x],++m)}y=e}return{t:new st(d),l:y}},Gt=function(t,e,n){return-1==t.s?Math.max(Gt(t.l,e,n+1),Gt(t.r,e,n+1)):e[t.s]=n},Yt=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new ut(++e),r=0,i=t[0],a=1,o=function(t){n[r++]=t},s=1;s<=e;++s)if(t[s]==i&&s!=e)++a;else{if(!i&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(i),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(i);a=1,i=t[s]}return{c:n.subarray(0,r),n:e}},qt=function(t,e){for(var n=0,r=0;r<e.length;++r)n+=t[r]*e[r];return n},Xt=function(t,e,n){var r=n.length,i=_t(e+2);t[i]=255&r,t[i+1]=r>>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var a=0;a<r;++a)t[i+a+4]=n[a];return 8*(i+4+r)},Kt=function(t,e,n,r,i,a,o,s,u,c,l){Vt(e,l++,n),++i[256];for(var f=Nt(i,15),h=f.t,v=f.l,d=Nt(a,15),y=d.t,p=d.l,m=Yt(h),g=m.c,w=m.n,k=Yt(y),b=k.c,x=k.n,C=new ut(19),T=0;T<g.length;++T)++C[31&g[T]];for(var S=0;S<b.length;++S)++C[31&b[S]];for(var P=Nt(C,7),A=P.t,M=P.l,E=19;E>4&&!A[ht[E-1]];--E);var I,O,R,D,B=c+5<<3,F=qt(i,Tt)+qt(a,Et)+o,U=qt(i,h)+qt(a,y)+o+14+3*E+qt(C,A)+2*C[16]+3*C[17]+7*C[18];if(u>=0&&B<=F&&B<=U)return Xt(e,l,t.subarray(u,u+c));if(Vt(e,l,1+(U<F)),l+=2,U<F){I=Ct(h,v,0),O=h,R=Ct(y,p,0),D=y;var j=Ct(A,M,0);Vt(e,l,w-257),Vt(e,l+5,x-1),Vt(e,l+10,E-4),l+=14;for(var _=0;_<E;++_)Vt(e,l+3*_,A[ht[_]]);l+=3*E;for(var z=[g,b],L=0;L<2;++L)for(var H=z[L],V=0;V<H.length;++V){var W=31&H[V];Vt(e,l,j[W]),l+=A[W],W>15&&(Vt(e,l,H[V]>>5&127),l+=H[V]>>12)}}else I=Ot,O=Tt,R=Dt,D=Et;for(var N=0;N<s;++N){var G=r[N];if(G>255){var Y=G>>18&31;Wt(e,l,I[Y+257]),l+=O[Y+257],Y>7&&(Vt(e,l,G>>23&31),l+=lt[Y]);var q=31&G;Wt(e,l,R[q]),l+=D[q],q>3&&(Wt(e,l,G>>5&8191),l+=ft[q])}else Wt(e,l,I[G]),l+=O[G]}return Wt(e,l,I[256]),l+O[256]},Jt=new ct([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Qt=new st(0),Zt=function(){var t=1,e=0;return{p:function(n){for(var r=t,i=e,a=0|n.length,o=0;o!=a;){for(var s=Math.min(o+2655,a);o<s;++o)i+=r+=n[o];r=(65535&r)+15*(r>>16),i=(65535&i)+15*(i>>16)}t=r,e=i},d:function(){return(255&(t%=65521))<<24|(65280&t)<<8|(255&(e%=65521))<<8|e>>8}}},$t=function(t,e,n,r,i){if(!i&&(i={l:1},e.dictionary)){var a=e.dictionary.subarray(-32768),o=new st(a.length+t.length);o.set(a),o.set(t,a.length),t=o,i.w=a.length}return function(t,e,n,r,i,a){var o=a.z||t.length,s=new st(r+o+5*(1+Math.ceil(o/7e3))+i),u=s.subarray(r,s.length-i),c=a.l,l=7&(a.r||0);if(e){l&&(u[0]=a.r>>3);for(var f=Jt[e-1],h=f>>13,v=8191&f,d=(1<<n)-1,y=a.p||new ut(32768),p=a.h||new ut(d+1),m=Math.ceil(n/3),g=2*m,w=function(e){return(t[e]^t[e+1]<<m^t[e+2]<<g)&d},k=new ct(25e3),b=new ut(288),x=new ut(32),C=0,T=0,S=a.i||0,P=0,A=a.w||0,M=0;S+2<o;++S){var E=w(S),I=32767&S,O=p[E];if(y[I]=O,p[E]=I,A<=S){var R=o-S;if((C>7e3||P>24576)&&(R>423||!c)){l=Kt(t,u,0,k,b,x,T,P,M,S-M,l),P=C=T=0,M=S;for(var D=0;D<286;++D)b[D]=0;for(var B=0;B<30;++B)x[B]=0}var F=2,U=0,j=v,_=I-O&32767;if(R>2&&E==w(S-_))for(var z=Math.min(h,R)-1,L=Math.min(32767,S),H=Math.min(258,R);_<=L&&--j&&I!=O;){if(t[S+F]==t[S+F-_]){for(var V=0;V<H&&t[S+V]==t[S+V-_];++V);if(V>F){if(F=V,U=_,V>z)break;for(var W=Math.min(_,V-2),N=0,G=0;G<W;++G){var Y=S-_+G&32767,q=Y-y[Y]&32767;q>N&&(N=q,O=Y)}}}_+=(I=O)-(O=y[I])&32767}if(U){k[P++]=268435456|pt[F]<<18|wt[U];var X=31&pt[F],K=31&wt[U];T+=lt[X]+ft[K],++b[257+X],++x[K],A=S+F,++C}else k[P++]=t[S],++b[t[S]]}}for(S=Math.max(S,A);S<o;++S)k[P++]=t[S],++b[t[S]];l=Kt(t,u,c,k,b,x,T,P,M,S-M,l),c||(a.r=7&l|u[l/8|0]<<3,l-=7,a.h=p,a.p=y,a.i=S,a.w=A)}else{for(var J=a.w||0;J<o+c;J+=65535){var Q=J+65535;Q>=o&&(u[l/8|0]=c,Q=o),l=Xt(u,l+1,t.subarray(J,Q))}a.i=o}return zt(s,0,r+_t(l)+i)}(t,null==e.level?6:e.level,null==e.mem?i.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):20:12+e.mem,n,r,i)},te=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8};function ee(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Zt();n.p(t);var r=$t(t,e,e.dictionary?6:2,4);return function(t,e){var n,r,i=null!==(n=e.level)&&void 0!==n?n:0,a=0==i?0:i<6?1:9==i?3:2;if(t[0]=120,t[1]=a<<6|((null!==(r=e.dictionary)&&void 0!==r?r:0)&&32),t[1]|=31-(t[0]<<8|t[1])%31,e.dictionary){var o=Zt();o.p(e.dictionary),te(t,2,o.d())}}(r,e),te(r,r.length-4,n.d()),r}function ne(t){var e,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e,n,r){var i=t.length,a=r?r.length:0;if(!i||e.f&&!e.l)return n||new st(0);var o=!n,s=o||2!=e.i,u=e.i;o&&(n=new st(3*i));var c=function(t){var e=n.length;if(t>e){var r=new st(Math.max(2*e,t));r.set(n),n=r}},l=e.f||0,f=e.p||0,h=e.b||0,v=e.l,d=e.d,y=e.m,p=e.n,m=8*i;do{if(!v){l=Ut(t,f,1);var g=Ut(t,f+1,3);if(f+=3,!g){var w=_t(f)+4,k=t[w-4]|t[w-3]<<8,b=w+k;if(b>i){u&&Ht(0);break}s&&c(h+k),n.set(t.subarray(w,b),h),e.b=h+=k,e.p=f=8*b,e.f=l;continue}if(1==g)v=Rt,d=Bt,y=9,p=5;else if(2==g){var x=Ut(t,f,31)+257,C=Ut(t,f+10,15)+4,T=x+Ut(t,f+5,31)+1;f+=14;for(var S=new st(T),P=new st(19),A=0;A<C;++A)P[ht[A]]=Ut(t,f+3*A,7);f+=3*C;for(var M=Ft(P),E=(1<<M)-1,I=Ct(P,M,1),O=0;O<T;){var R=I[Ut(t,f,E)];f+=15&R;var D=R>>4;if(D<16)S[O++]=D;else{var B=0,F=0;for(16==D?(F=3+Ut(t,f,3),f+=2,B=S[O-1]):17==D?(F=3+Ut(t,f,7),f+=3):18==D&&(F=11+Ut(t,f,127),f+=7);F--;)S[O++]=B}}var U=S.subarray(0,x),j=S.subarray(x);y=Ft(U),p=Ft(j),v=Ct(U,y,1),d=Ct(j,p,1)}else Ht(1);if(f>m){u&&Ht(0);break}}s&&c(h+131072);for(var _=(1<<y)-1,z=(1<<p)-1,L=f;;L=f){var H=v[jt(t,f)&_],V=H>>4;if((f+=15&H)>m){u&&Ht(0);break}if(H||Ht(2),V<256)n[h++]=V;else{if(256==V){L=f,v=void 0;break}var W=V-254;if(V>264){var N=V-257,G=lt[N];W=Ut(t,f,(1<<G)-1)+yt[N],f+=G}var Y=d[jt(t,f)&z],q=Y>>4;Y||Ht(3),f+=15&Y;var X=gt[q];if(q>3){var K=ft[q];X+=jt(t,f)&(1<<K)-1,f+=K}if(f>m){u&&Ht(0);break}s&&c(h+131072);var J=h+W;if(h<X){var Q=a-X,Z=Math.min(X,J);for(Q+h<0&&Ht(3);h<Z;++h)n[h]=r[Q+h]}for(;h<J;++h)n[h]=n[h-X]}}e.l=v,e.p=L,e.b=h,e.f=l,v&&(l=1,e.m=y,e.d=d,e.n=p)}while(!l);return h!=n.length&&o?zt(n,0,h):n.subarray(0,h)}(t.subarray((e=t,n=r.dictionary,(8!=(15&e[0])||e[0]>>4>7||(e[0]<<8|e[1])%31)&&Ht(6,"invalid zlib data"),(e[1]>>5&1)==+!n&&Ht(6,"invalid zlib data: "+(32&e[1]?"need":"unexpected")+" dictionary"),2+(e[1]>>3&4)),-4),{i:2},r&&r.out,r&&r.dictionary)}var re=function(){function t(){a(this,t),this.caches=new Map}return s(t,[{key:"calculate",value:function(e){if(!(e instanceof Uint8Array))throw new TypeError("Input must be a Uint8Array");var n=this.caches,r=U.codec.bytesToString(e);if(n.has(r))return n.get(r);for(var i=t.WHITE_COLOR,a=0;a<e.length;a++)i=i>>>8^t.table[255&(i^e[a])];return n.set(r,(i^t.WHITE_COLOR)>>>0),n.get(r)}},{key:"clear",value:function(){this.caches.clear()}}])}();re.table=Uint32Array.from(Array(256),(function(t,e){for(var n=e,r=0;r<8;r++)n=1&n?3988292384^n>>>1:n>>>1;return n>>>0})),re.WHITE_COLOR=4294967295;for(var ie=function(){return s((function t(e,n){a(this,t),this.width=e,this.height=n,this.crc32=new re,this.view=new DataView(new ArrayBuffer(4*e*n))}),[{key:"createChunk",value:function(t,e){var n=new Uint8Array(4);new DataView(n.buffer).setUint32(0,e.length,!1);var r=Uint8Array.from(t,(function(t){return t.charCodeAt(0)})),i=new Uint8Array(r.length+e.length);i.set(r),i.set(e,r.length);var a=new Uint8Array(4);new DataView(a.buffer).setUint32(0,this.crc32.calculate(i)>>>0,!1);var o=new Uint8Array(n.length+i.length+a.length);return o.set(n),o.set(i,n.length),o.set(a,n.length+i.length),o}},{key:"createIHDRChunk",value:function(){var t=new Uint8Array(13),e=new DataView(t.buffer);return e.setUint32(0,this.width,!1),e.setUint32(4,this.height,!1),e.setUint8(8,8),e.setUint8(9,6),e.setUint8(10,0),e.setUint8(11,0),e.setUint8(12,0),this.createChunk("IHDR",t)}},{key:"createIDATChunk",value:function(){for(var t,e,n=this.width,r=this.height,i=4*n,a=i+1,o=new Uint8Array(a*r),s=new Uint8Array(this.view.buffer),u=0;u<r;u++)o[t=u*a]=0,e=u*i,o.set(s.subarray(e,e+i),t+1);return this.createChunk("IDAT",ee(o))}},{key:"setPixel",value:function(t,e,n){this.view.setUint32(4*(e*this.width+t),n,!1)}},{key:"write",value:function(t){for(var e,n,r=this.width,i=this.height,a=0;a<i;a++)for(var o=0;o<r;o++)n=(t[e=4*(a*r+o)]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0,this.setPixel(o,a,n);return this}},{key:"flush",value:function(){var t=this.createIHDRChunk(),e=this.createIDATChunk(),n=this.createChunk("IEND",new Uint8Array(0)),r=new Uint8Array(8+t.length+e.length+n.length),i=0;return r.set(new Uint8Array([137,80,78,71,13,10,26,10]),i),i+=8,r.set(t,i),i+=t.length,r.set(e,i),i+=e.len