krono-flow 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +73 -38
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +73 -38
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).kronoFlow=t()}(this,function(){"use strict";var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};function t(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}var r=function(){return r=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},r.apply(this,arguments)};function i(e,t,r,i){return new(r||(r=Promise))(function(a,n){function o(e){try{c(i.next(e))}catch(e){n(e)}}function s(e){try{c(i.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,s)}c((i=i.apply(e,t||[])).next())})}function a(e,t){var r,i,a,n={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(n=0)),n;)try{if(r=1,i&&(a=2&s[0]?i.return:s[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,s[1])).done)return a;switch(i=0,a&&(s=[2&s[0],a.value]),s[0]){case 0:case 1:a=s;break;case 4:return n.label++,{value:s[1],done:!1};case 5:n.label++,i=s[1],s=[0];continue;case 7:s=n.ops.pop(),n.trys.pop();continue;default:if(!(a=n.trys,(a=a.length>0&&a[a.length-1])||6!==s[0]&&2!==s[0])){n=0;continue}if(3===s[0]&&(!a||s[1]>a[0]&&s[1]<a[3])){n.label=s[1];break}if(6===s[0]&&n.label<a[1]){n.label=a[1],a=s;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(s);break}a[2]&&n.ops.pop(),n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e],i=0}finally{r=a=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}function n(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.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.")}function o(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=n(e),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(r){t[r]=e[r]&&function(t){return new Promise(function(i,a){(function(e,t,r,i){Promise.resolve(i).then(function(t){e({value:t,done:r})},t)})(i,a,(t=e[r](t)).done,t.value)})}}}"function"==typeof SuppressedError&&SuppressedError;const s=[];for(let e=0;e<256;++e)s.push((e+256).toString(16).slice(1));let c;const u=new Uint8Array(16);var l={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function h(e,t,r){const i=(e=e||{}).random??e.rng?.()??function(){if(!c){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");c=crypto.getRandomValues.bind(crypto)}return c(u)}();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=15&i[6]|64,i[8]=63&i[8]|128,function(e,t=0){return(s[e[t+0]]+s[e[t+1]]+s[e[t+2]]+s[e[t+3]]+"-"+s[e[t+4]]+s[e[t+5]]+"-"+s[e[t+6]]+s[e[t+7]]+"-"+s[e[t+8]]+s[e[t+9]]+"-"+s[e[t+10]]+s[e[t+11]]+s[e[t+12]]+s[e[t+13]]+s[e[t+14]]+s[e[t+15]]).toLowerCase()}(i)}var d={}.toString;function f(e){return function(t){return d.call(t)==="[object "+e+"]"}}var m,p=f("Object"),g=f("String"),v=(m=["Function","AsyncFunction","GeneratorFunction"],function(e){for(var t=d.call(e),r=0,i=m.length;r<i;r++)if(t==="[object "+m[r]+"]")return!0;return!1}),y=f("Number"),b=f("Boolean"),x=f("Date"),T={}.hasOwnProperty,w=T.toString,k=w.call(Object);function S(e){return null==e}function E(e){if(!e||"[object Object]"!==d.call(e))return!1;var t=Object.getPrototypeOf(e);if(!t)return!0;var r=T.call(t,"constructor")&&t.constructor;return"function"==typeof r&&w.call(r)===k}function C(e){if(S(e)||"object"!=typeof e)return e;if(x(e))return new Date(e);if(!E(e)&&!Array.isArray(e))return e;var t=Array.isArray(e)?[]:{};return Object.keys(e).forEach(function(r){t[r]=C(e[r])}),t}function A(e,t,r){if(e===t)return!0;if(p(e)&&p(t)){for(var i={},a=r||Object.keys(e),n=0,o=a.length;n<o;n++){var s=a[n];if(!t.hasOwnProperty(s)||!A(e[s],t[s]))return!1;i[s]=!0}for(n=0,o=(a=r||Object.keys(t)).length;n<o;n++){s=a[n];if(!i.hasOwnProperty(s))return!1}return!0}if(x(e)&&x(t))return e.getTime()===t.getTime();if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(n=0,o=e.length;n<o;n++)if(!A(e[n],t[n]))return!1;return!0}return e===t}var _={isNil:S,isString:g,isNumber:y,isObject:p,isBoolean:b,isDate:x,isFunction:v,isPlainObject:E,equal:A,extend:function(e,t,r){if(null===t||"object"!=typeof t)return e;r||(r=Object.keys(t));for(var i=0,a=r.length;i<a;){var n=r[i];e[n]=t[n],i++}return e},clone:C},M=function(){function e(){this.__eHash={}}return e.prototype.on=function(e,t){if(v(t))if(Array.isArray(e))for(var r=0,i=e.length;r<i;r++)this.on(e[r],t);else{this.__eHash.hasOwnProperty(e)||(this.__eHash[e]=[]);r=0;var a=this.__eHash[e];for(i=a.length;r<i;r++)if(a[r]===t)return;this.__eHash[e].push(t)}},e.prototype.once=function(e,t){var r=this;if(v(t))if(Array.isArray(e))for(var i=0,a=e.length;i<a;i++)this.once(e[i],t);else{var n=function(){t.apply(r,Array.prototype.slice.call(arguments)),r.off(e,n)};if(n.__eventCb=t,Array.isArray(e))for(i=0,a=e.length;i<a;i++)this.once(e[i],t);else this.on(e,n)}},e.prototype.off=function(e,t){if(Array.isArray(e))for(var r=0,i=e.length;r<i;r++)this.off(e[r],t);else if(this.__eHash.hasOwnProperty(e))if(t){r=0;var a=this.__eHash[e];for(i=a.length;r<i;r++)if(a[r]===t||a[r].__eventCb===t){a.splice(r,1);break}}else delete this.__eHash[e]},e.prototype.emit=function(e){for(var t=this,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];if(Array.isArray(e))e.forEach(function(e){if(e&&t.__eHash.hasOwnProperty(e)){var i=t.__eHash[e];if(i.length)for(var a=0,n=(i=i.slice()).length;a<n;a++){var o=i[a];v(o)&&o.apply(t,r)}}});else if(e){var a=this.__eHash[e];if(a&&a.length)for(var n=0,o=(a=a.slice()).length;n<o;n++){var s=a[n];v(s)&&s.apply(this,r)}}},e}(),I={left:"auto",top:"auto",right:"auto",bottom:"auto",width:"auto",height:"auto",lineHeight:"normal",fontFamily:"Arial",fontSize:16,fontWeight:400,fontStyle:"normal",letterSpacing:0,paragraphSpacing:0,textAlign:"left",textVerticalAlign:"top",textDecoration:[],textShadow:"none",color:[0,0,0,1],visibility:"visible",opacity:1,backgroundColor:"transparent",fill:[],fillOpacity:[],fillEnable:[],fillMode:[],fillRule:"nonzero",stroke:[],strokeEnable:[],strokeWidth:[],strokePosition:[],strokeMode:[],strokeDasharray:[],strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:4,translateX:0,translateY:0,translateZ:0,skewX:0,skewY:0,scaleX:1,scaleY:1,rotateX:0,rotateY:0,rotateZ:0,transformOrigin:["center","center"],perspective:0,perspectiveOrigin:["center","center"],perspectiveSelf:0,mixBlendMode:"normal",pointerEvents:!0,maskMode:"none",breakMask:!1,objectFit:"fill",borderTopLeftRadius:0,borderTopRightRadius:0,borderBottomLeftRadius:0,borderBottomRightRadius:0,overflow:"visible",filter:[]};function R(e){var t=Object.assign({},I);return["transformOrigin","perspectiveOrigin","color","strokeDasharray","filter"].forEach(function(e){t[e]=t[e].slice(0)}),Object.assign(t,e)}var P={getDefaultStyle:R},O=2048,D=!1,B=O,F=!1,L={debug:!1,offscreenCanvas:!1,get maxTextureSize(){return O},set maxTextureSize(e){O=F?Math.min(e,B):e,D=!0},get MAX_TEXTURE_SIZE(){return B},MAX_TEXTURE_IMAGE_UNITS:8,MAX_VARYING_VECTORS:15,init:function(e,t,r){D?e<O&&(O=e):O=Math.min(O,e),F=!0,B=e,this.MAX_TEXTURE_IMAGE_UNITS=t,this.MAX_VARYING_VECTORS=r},defaultFontFamily:"Arial",defaultFontSize:16,historyTime:1e3,decoderWorker:"",decoderWorkerStr:"",encoderWorker:"",encoderWorkerStr:"",decodeNextDuration:0,releasePrevDuration:0,gopMinDuration:0,preloadAll:!1,mute:!1,indexedDB:!1,encoderFrameQue:0},N=1e3/60,U={},z="function"==typeof OffscreenCanvas&&OffscreenCanvas.prototype.getContext;var W,V,H,X,j,G,Y,q,K,$,Q,Z,J,ee,te,re,ie,ae,ne={},oe={requestAnimationFrame:function(e){return e?("undefined"!=typeof requestAnimationFrame?(oe.requestAnimationFrame=requestAnimationFrame.bind(null),t=requestAnimationFrame(e)):(t=setTimeout(e,N),oe.requestAnimationFrame=function(e){return setTimeout(e,N)}),t):-1;var t},cancelAnimationFrame:function(e){var t;return"undefined"!=typeof cancelAnimationFrame?(oe.cancelAnimationFrame=cancelAnimationFrame.bind(null),t=cancelAnimationFrame(e)):(t=clearTimeout(e),oe.cancelAnimationFrame=function(e){return clearTimeout(e)}),t},now:function(){return"undefined"!=typeof performance?(oe.now=function(){return Math.floor(performance.now())},Math.floor(performance.now())):(oe.now=Date.now.bind(Date),Date.now())},hasOffscreenCanvas:function(e){return e&&U.hasOwnProperty(e)},getOffscreenCanvas:function(e,t,r,i){return function(e,t,r,i){var a;a=r?U[r]?U[r]:U[r]=!L.debug&&L.offscreenCanvas&&z?new OffscreenCanvas(e,t):document.createElement("canvas"):!L.debug&&L.offscreenCanvas&&z?new OffscreenCanvas(e,t):document.createElement("canvas"),e=Math.ceil(e),t=Math.ceil(t),a.width=e,a.height=t,a.style.position="fixed",a.style.left="9999px",a.style.top="0px",a.style.webkitFontSmoothing="antialiased",a.style.mozOsxFontSmoothing="grayscale",L.debug&&(a.style.width=e+"px",a.style.height=t+"px"),a instanceof HTMLCanvasElement&&(document.body.appendChild(a),r&&a.setAttribute("key",r));var n=a.getContext("2d",i);return n||oe.error("Total canvas memory use exceeds the maximum limit"),{canvas:a,ctx:n,width:e,height:t,available:!0,release:function(){this.available&&!L.debug&&(this.available=!1,n.globalAlpha=1,n.globalCompositeOperation="source-over",n.setTransform(1,0,0,1,0,0),n.clearRect(0,0,e,t),a.width=a.height=0,a instanceof HTMLCanvasElement&&document.body.removeChild(a),a=null)}}}(e,t,r,i)},isWebGLTexture:function(e){if(e&&"undefined"!=typeof WebGLTexture)return e instanceof WebGLTexture},getFontCanvas:function(){return oe.getOffscreenCanvas(16,16,"__$$CHECK_SUPPORT_FONT_FAMILY$$__",{willReadFrequently:!0})},checkSupportFontFamily:function(e){if(e===L.defaultFontFamily)return!0;if(ne.hasOwnProperty(e))return ne[e];var t=oe.getFontCanvas().ctx;t.textAlign="center",t.fillStyle="#000",t.textBaseline="middle",W||(t.clearRect(0,0,16,16),t.font="16px "+L.defaultFontFamily,t.fillText("a",8,8),W=t.getImageData(0,0,16,16).data),t.clearRect(0,0,16,16),/\s/.test(e)&&(e='"'+e.replace(/"/g,'\\"')+'"'),t.font="16px "+e+","+L.defaultFontFamily,t.fillText("a",8,8);for(var r=t.getImageData(0,0,16,16).data,i=0,a=r.length;i<a;i++)if(W[i]!==r[i])return ne[e]=!0;return ne[e]=!1},addArrayBufferFont:function(e,t){return i(this,void 0,void 0,function(){var r;return a(this,function(i){switch(i.label){case 0:return"undefined"==typeof document||"undefined"==typeof FontFace?[3,2]:[4,(r=new FontFace(e,t)).load()];case 1:i.sent(),document.fonts.add(r),i.label=2;case 2:return[2]}})})},addLocalFont:function(e){return i(this,void 0,void 0,function(){var t;return a(this,function(r){switch(r.label){case 0:return"undefined"==typeof document||"undefined"==typeof FontFace?[3,2]:[4,(t=new FontFace(e,"local(".concat(e))).load()];case 1:r.sent(),document.fonts.add(t),r.label=2;case 2:return[2]}})})},loadArrayBufferImg:function(e){return i(this,void 0,void 0,function(){var t,r;return a(this,function(i){return t=new Blob([e]),r=new Image,[2,new Promise(function(e,i){r.onload=function(){e(r)},r.onerror=function(e){i(e)},r.src=URL.createObjectURL(t)})]})})},pdfjsLibWorkerSrc:"https://gw.alipayobjects.com/os/lib/pdfjs-dist/3.11.174/build/pdf.worker.min.js",loadArrayBufferPdf:function(e){return i(this,void 0,void 0,function(){var t,r,i,n,o,s,c,u,l;return a(this,function(a){switch(a.label){case 0:return(t=window.pdfjsLib).GlobalWorkerOptions.workerSrc=oe.pdfjsLibWorkerSrc,r=new Blob([e]),i=URL.createObjectURL(r),[4,t.getDocument(i).promise];case 1:return[4,a.sent().getPage(1)];case 2:return n=a.sent(),o=n.getViewport({scale:1}),(s=document.createElement("canvas")).width=o.width,s.height=o.height,c=s.getContext("2d"),[4,n.render({viewport:o,canvasContext:c,background:"transparent"}).promise];case 3:return a.sent(),[4,new Promise(function(e,t){s.toBlob(function(r){r?e(r):t("")})})];case 4:return u=a.sent(),l=new Image,[2,new Promise(function(e,t){l.onload=function(){e(l)},l.onerror=function(e){t(e)},l.src=URL.createObjectURL(u)})]}})})},loadLocalFonts:function(){return i(this,void 0,void 0,function(){var e;return a(this,function(t){switch(t.label){case 0:if("undefined"==typeof navigator)return[3,5];t.label=1;case 1:return t.trys.push([1,4,,5]),[4,navigator.permissions.query({name:"local-fonts"})];case 2:return"denied"===t.sent().state?(oe.error("No Permission."),[2,[]]):[4,window.queryLocalFonts()];case 3:return[2,t.sent()];case 4:return e=t.sent(),oe.error(e),[2,[]];case 5:return[2,[]]}})})},uploadBlobImgSrc:function(e){return i(this,void 0,void 0,function(){return a(this,function(e){return[2]})})},log:function(e){console.log(e)},warn:function(e){console.warn(e)},error:function(e){console.error(e)}};function se(e,t){if(void 0===t&&(t=!1),"auto"===e)return{v:0,u:V.AUTO};var r=parseFloat(e)||0;return/%$/.test(e)?{v:r,u:V.PERCENT}:/px$/i.test(e)?{v:r,u:V.PX}:/deg$/i.test(e)?{v:r,u:t?V.PX:V.DEG}:{v:r,u:t?V.PX:V.NUMBER}}!function(e){e[e.AUTO=0]="AUTO",e[e.PX=1]="PX",e[e.PERCENT=2]="PERCENT",e[e.NUMBER=3]="NUMBER",e[e.DEG=4]="DEG",e[e.RGBA=5]="RGBA",e[e.BOOLEAN=6]="BOOLEAN",e[e.STRING=7]="STRING",e[e.GRADIENT=8]="GRADIENT",e[e.MATRIX=9]="MATRIX",e[e.SHADOW=10]="SHADOW",e[e.PATTERN=11]="PATTERN",e[e.GAUSS_BLUR=12]="GAUSS_BLUR",e[e.MOTION_BLUR=13]="MOTION_BLUR",e[e.RADIAL_BLUR=14]="RADIAL_BLUR",e[e.BLOOM=15]="BLOOM",e[e.LIGHT_DARK=16]="LIGHT_DARK",e[e.HUE_ROTATE=17]="HUE_ROTATE",e[e.SATURATE=18]="SATURATE",e[e.BRIGHTNESS=19]="BRIGHTNESS",e[e.CONTRAST=20]="CONTRAST",e[e.SEPIA=21]="SEPIA"}(V||(V={})),function(e){e[e.LEFT=0]="LEFT",e[e.RIGHT=1]="RIGHT",e[e.CENTER=2]="CENTER",e[e.JUSTIFY=3]="JUSTIFY"}(H||(H={})),function(e){e[e.TOP=0]="TOP",e[e.MIDDLE=1]="MIDDLE",e[e.BOTTOM=2]="BOTTOM"}(X||(X={})),function(e){e[e.NORMAL=0]="NORMAL",e[e.MULTIPLY=1]="MULTIPLY",e[e.SCREEN=2]="SCREEN",e[e.OVERLAY=3]="OVERLAY",e[e.DARKEN=4]="DARKEN",e[e.LIGHTEN=5]="LIGHTEN",e[e.COLOR_DODGE=6]="COLOR_DODGE",e[e.COLOR_BURN=7]="COLOR_BURN",e[e.HARD_LIGHT=8]="HARD_LIGHT",e[e.SOFT_LIGHT=9]="SOFT_LIGHT",e[e.DIFFERENCE=10]="DIFFERENCE",e[e.EXCLUSION=11]="EXCLUSION",e[e.HUE=12]="HUE",e[e.SATURATION=13]="SATURATION",e[e.COLOR=14]="COLOR",e[e.LUMINOSITY=15]="LUMINOSITY"}(j||(j={})),function(e){e[e.NORMAL=0]="NORMAL",e[e.ITALIC=1]="ITALIC",e[e.OBLIQUE=2]="OBLIQUE"}(G||(G={})),function(e){e[e.LINEAR=0]="LINEAR",e[e.RADIAL=1]="RADIAL",e[e.CONIC=2]="CONIC"}(Y||(Y={})),function(e){e[e.NONE=0]="NONE",e[e.UNION=1]="UNION",e[e.SUBTRACT=2]="SUBTRACT",e[e.INTERSECT=3]="INTERSECT",e[e.XOR=4]="XOR"}(q||(q={})),function(e){e[e.NON_ZERO=0]="NON_ZERO",e[e.EVEN_ODD=1]="EVEN_ODD"}(K||(K={})),function(e){e[e.NONE=0]="NONE",e[e.OUTLINE=1]="OUTLINE",e[e.ALPHA=2]="ALPHA",e[e.GRAY=3]="GRAY",e[e.ALPHA_WITH=4]="ALPHA_WITH",e[e.GRAY_WITH=5]="GRAY_WITH"}($||($={})),function(e){e[e.BUTT=0]="BUTT",e[e.ROUND=1]="ROUND",e[e.SQUARE=2]="SQUARE"}(Q||(Q={})),function(e){e[e.MITER=0]="MITER",e[e.ROUND=1]="ROUND",e[e.BEVEL=2]="BEVEL"}(Z||(Z={})),function(e){e[e.CENTER=0]="CENTER",e[e.INSIDE=1]="INSIDE",e[e.OUTSIDE=2]="OUTSIDE"}(J||(J={})),function(e){e[e.TILE=0]="TILE",e[e.FILL=1]="FILL",e[e.STRETCH=2]="STRETCH",e[e.FIT=3]="FIT"}(ee||(ee={})),function(e){e[e.VISIBLE=0]="VISIBLE",e[e.HIDDEN=1]="HIDDEN"}(te||(te={})),function(e){e[e.NONE=0]="NONE",e[e.UNDERLINE=1]="UNDERLINE",e[e.LINE_THROUGH=2]="LINE_THROUGH"}(re||(re={})),function(e){e[e.VISIBLE=0]="VISIBLE",e[e.HIDDEN=1]="HIDDEN",e[e.CLIP=2]="CLIP"}(ie||(ie={})),function(e){e[e.FILL=0]="FILL",e[e.CONTAIN=1]="CONTAIN",e[e.COVER=2]="COVER"}(ae||(ae={}));var ce,ue=["fontFamily","fontSize","fontWeight","lineHeight","letterSpacing","paragraphSpacing","fontStyle","textAlign","textDecoration","color","textShadow","stroke","strokeWidth","strokeEnable"];!function(e){e[e.NONE=0]="NONE",e[e.STRAIGHT=1]="STRAIGHT",e[e.MIRRORED=2]="MIRRORED",e[e.ASYMMETRIC=3]="ASYMMETRIC",e[e.DISCONNECTED=4]="DISCONNECTED"}(ce||(ce={}));var le={StyleUnit:V,TEXT_ALIGN:H,TEXT_VERTICAL_ALIGN:X,MIX_BLEND_MODE:j,FONT_STYLE:G,GRADIENT:Y,FILL_RULE:K,MASK:$,STROKE_LINE_CAP:Q,STROKE_LINE_JOIN:Z,STROKE_POSITION:J,PATTERN_FILL_TYPE:ee,VISIBILITY:te,TEXT_DECORATION:re,OVERFLOW:ie,calUnit:se,RICH_KEYS:ue},he={position:/(([-+]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e[-+]?\d+)?[pxremvwhina%]*)|(left|top|right|bottom|center)){1,2}/gi,gradient:/\b(\w+)-?gradient\s*\((.+)\)/i,img:/(?:\burl\((['"]?)(.*?)\1\))|(?:\b((data:)))/i,shadow:/([-+]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:px)?)\s+([-+]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:px)?)\s+((?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:px)?)\s+((?:#[a-f\d]{3,8})|(?:rgba?\s*\(.+?\)))/i};function de(e){if(Array.isArray(e))return e;var t=[];if(!e||/transparent/i.test(e))t=[0,0,0,0];else if(/^#?[a-f\d]{3,8}$/i.test(e))3===(e=e.replace("#","")).length||4===e.length?(t.push(parseInt(e.charAt(0)+e.charAt(0),16)),t.push(parseInt(e.charAt(1)+e.charAt(1),16)),t.push(parseInt(e.charAt(2)+e.charAt(2),16)),4===e.length?t[3]=parseInt(e.charAt(3)+e.charAt(3),16):t[3]=1):6===e.length?(t.push(parseInt(e.slice(0,2),16)),t.push(parseInt(e.slice(2,4),16)),t.push(parseInt(e.slice(4),16)),t[3]=1):8===e.length?(t.push(parseInt(e.slice(0,2),16)),t.push(parseInt(e.slice(2,4),16)),t.push(parseInt(e.slice(4,6),16)),t.push(parseInt(e.slice(6),16)/255)):(t[0]=t[1]=t[2]=0,t[3]=1);else{var r=e.match(/rgba?\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)(?:\s*,\s*([\d.]+))?\s*\)/i);r?(t=[parseInt(r[1]),parseInt(r[2]),parseInt(r[3])],S(r[4])?t[3]=1:t[3]=parseFloat(r[4])):t=[0,0,0,0]}return t}function fe(e){var t=de(e);if(Array.isArray(t)){var r=Math.min(255,Math.max(Math.round(t[0]),0)),i=Math.min(255,Math.max(Math.round(t[1]),0)),a=Math.min(255,Math.max(Math.round(t[2]),0));if(3===t.length||4===t.length){if(4===t.length){var n=Math.min(1,Math.max(t[3],0));if(n<1)return"rgba("+r+","+i+","+a+","+n+")"}return"rgba("+r+","+i+","+a+",1)"}}return e||"rgba(0,0,0,0)"}function me(e){var t=e.toString(16).toUpperCase();return 1===t.length&&(t="0"+t),t}var pe={color2rgbaInt:de,color2rgbaStr:fe,color2hexStr:function(e){var t=de(e);if(Array.isArray(t)){var r=Math.min(255,Math.max(Math.round(t[0]),0)),i=Math.min(255,Math.max(Math.round(t[1]),0)),a=Math.min(255,Math.max(Math.round(t[2]),0));if(3===t.length||4===t.length){if(4===t.length){var n=Math.min(1,Math.max(t[3],0));if(n<1)return"#"+me(r)+me(i)+me(a)+me(Math.floor(255*n))}return"#"+me(r)+me(i)+me(a)}}return e||"#000"},color2gl:function(e){return Array.isArray(e)||(e=de(e)),[e[0]/255,e[1]/255,e[2]/255,3===e.length?1:e[3]]},clampColor:function(e){var t=Math.min(255,Math.max(Math.round(e[0]),0)),r=Math.min(255,Math.max(Math.round(e[1]),0)),i=Math.min(255,Math.max(Math.round(e[2]),0));return e.length>3?[t,r,i,Math.min(1,Math.max(0,e[3]))]:[t,r,i]}},ge=function(){function e(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function t(t,r){this.source=t,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=r,this.destLen=0,this.ltree=new e,this.dtree=new e}var r=new e,i=new e,a=new Uint8Array(30),n=new Uint16Array(30),o=new Uint8Array(30),s=new Uint16Array(30),c=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),u=new e,l=new Uint8Array(320);function h(e,t,r,i){var a,n;for(a=0;a<r;++a)e[a]=0;for(a=0;a<30-r;++a)e[a+r]=a/r|0;for(n=i,a=0;a<30;++a)t[a]=n,n+=1<<e[a]}var d=new Uint16Array(16);function f(e,t,r,i){var a,n;for(a=0;a<16;++a)e.table[a]=0;for(a=0;a<i;++a)e.table[t[r+a]]++;for(e.table[0]=0,n=0,a=0;a<16;++a)d[a]=n,n+=e.table[a];for(a=0;a<i;++a)t[r+a]&&(e.trans[d[t[r+a]]++]=a)}function m(e){e.bitcount--||(e.tag=e.source[e.sourceIndex++],e.bitcount=7);var t=1&e.tag;return e.tag>>>=1,t}function p(e,t,r){if(!t)return r;for(;e.bitcount<24;)e.tag|=e.source[e.sourceIndex++]<<e.bitcount,e.bitcount+=8;var i=e.tag&65535>>>16-t;return e.tag>>>=t,e.bitcount-=t,i+r}function g(e,t){for(;e.bitcount<24;)e.tag|=e.source[e.sourceIndex++]<<e.bitcount,e.bitcount+=8;var r=0,i=0,a=0,n=e.tag;do{i=2*i+(1&n),n>>>=1,++a,r+=t.table[a],i-=t.table[a]}while(i>=0);return e.tag=n,e.bitcount-=a,t.trans[r+i]}function v(e,t,r){var i,a,n,o,s,h;for(i=p(e,5,257),a=p(e,5,1),n=p(e,4,4),o=0;o<19;++o)l[o]=0;for(o=0;o<n;++o){var d=p(e,3,0);l[c[o]]=d}for(f(u,l,0,19),s=0;s<i+a;){var m=g(e,u),v=void 0;switch(m){case 16:for(v=l[s-1],h=p(e,2,3);h;--h)l[s++]=v;break;case 17:for(h=p(e,3,3);h;--h)l[s++]=0;break;case 18:for(h=p(e,7,11);h;--h)l[s++]=0;break;default:l[s++]=m}}f(t,l,0,i),f(r,l,i,a)}function y(e,t,r){for(;;){var i=g(e,t);if(256===i)return 0;if(i<256)e.dest[e.destLen++]=i;else{var c,u,l,h=void 0;for(c=p(e,a[i-=257],n[i]),u=g(e,r),h=l=e.destLen-p(e,o[u],s[u]);h<l+c;++h)e.dest[e.destLen++]=e.dest[h]}}}function b(e){for(var t,r;e.bitcount>8;)e.sourceIndex--,e.bitcount-=8;if((t=256*(t=e.source[e.sourceIndex+1])+e.source[e.sourceIndex])!==(65535&~(256*e.source[e.sourceIndex+3]+e.source[e.sourceIndex+2])))return-3;for(e.sourceIndex+=4,r=t;r;--r)e.dest[e.destLen++]=e.source[e.sourceIndex++];return e.bitcount=0,0}return function(e,t){var r;for(r=0;r<7;++r)e.table[r]=0;for(e.table[7]=24,e.table[8]=152,e.table[9]=112,r=0;r<24;++r)e.trans[r]=256+r;for(r=0;r<144;++r)e.trans[24+r]=r;for(r=0;r<8;++r)e.trans[168+r]=280+r;for(r=0;r<112;++r)e.trans[176+r]=144+r;for(r=0;r<5;++r)t.table[r]=0;for(t.table[5]=32,r=0;r<32;++r)t.trans[r]=r}(r,i),h(a,n,4,3),h(o,s,2,1),a[28]=0,n[28]=258,function(e,a){var n,o,s=new t(e,a);do{switch(n=m(s),p(s,2,0)){case 0:o=b(s);break;case 1:o=y(s,r,i);break;case 2:v(s,s.ltree,s.dtree),o=y(s,s.ltree,s.dtree);break;default:o=-3}if(0!==o)throw new Error("Data error")}while(!n);return s.destLen<s.dest.length?"function"==typeof s.dest.slice?s.dest.slice(0,s.destLen):s.dest.subarray(0,s.destLen):s.dest}}(),ve={UTF16:function(e,t,r){for(var i=[],a=r/2,n=0;n<a;n++,t+=2)i[n]=e.getUint16(t);return String.fromCharCode.apply(null,i)}},ye={"x-mac-croatian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®Š™´¨≠ŽØ∞±≤≥∆µ∂∑∏š∫ªºΩžø¿¡¬√ƒ≈ƫȅ ÀÃÕŒœĐ—“”‘’÷◊©⁄€‹›Æ»–·‚„‰ÂćÁčÈÍÎÏÌÓÔđÒÚÛÙıˆ˜¯πË˚¸Êæˇ","x-mac-cyrillic":"АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°Ґ£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµґЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю","x-mac-gaelic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØḂ±≤≥ḃĊċḊḋḞḟĠġṀæøṁṖṗɼƒſṠ«»… ÀÃÕŒœ–—“”‘’ṡẛÿŸṪ€‹›Ŷŷṫ·Ỳỳ⁊ÂÊÁËÈÍÎÏÌÓÔ♣ÒÚÛÙıÝýŴŵẄẅẀẁẂẃ","x-mac-greek":"Ĺ²É³ÖÜ΅àâä΄¨çéèê룙î‰ôö¦€ùûü†ΓΔΘΛΞΠß®©ΣΪ§≠°·Α±≤≥¥ΒΕΖΗΙΚΜΦΫΨΩάΝ¬ΟΡ≈Τ«»… ΥΧΆΈœ–―“”‘’÷ΉΊΌΎέήίόΏύαβψδεφγηιξκλμνοπώρστθωςχυζϊϋΐΰ","x-mac-icelandic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüݰ¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€ÐðÞþý·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-inuit":"ᐃᐄᐅᐆᐊᐋᐱᐲᐳᐴᐸᐹᑉᑎᑏᑐᑑᑕᑖᑦᑭᑮᑯᑰᑲᑳᒃᒋᒌᒍᒎᒐᒑ°ᒡᒥᒦ•¶ᒧ®©™ᒨᒪᒫᒻᓂᓃᓄᓅᓇᓈᓐᓯᓰᓱᓲᓴᓵᔅᓕᓖᓗᓘᓚᓛᓪᔨᔩᔪᔫᔭ… ᔮᔾᕕᕖᕗ–—“”‘’ᕘᕙᕚᕝᕆᕇᕈᕉᕋᕌᕐᕿᖀᖁᖂᖃᖄᖅᖏᖐᖑᖒᖓᖔᖕᙱᙲᙳᙴᙵᙶᖖᖠᖡᖢᖣᖤᖥᖦᕼŁł","x-mac-ce":"ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅņѬ√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ",macintosh:"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-romanian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ĂȘ∞±≤≥¥µ∂∑∏π∫ªºΩăș¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›Țț‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-turkish":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ"};function be(e,t){for(var r="",i=t;i<t+4;i++)r+=String.fromCharCode(e.getInt8(i));return r}function xe(e,t){return e.getUint16(t,!1)}function Te(e,t){return e.getUint32(t,!1)}ve.MACSTRING=function(e,t,r,i){var a=ye[i];if(void 0!==a){for(var n="",o=0;o<r;o++){var s=e.getUint8(t+o);n+=s<=127?String.fromCharCode(s):a[127&s]}return n}};var we={byte:1,uShort:2,short:2,uLong:4,fixed:4,longDateTime:8,tag:4};function ke(e,t){for(var r=[],i=12,a=0;a<t;a+=1){var n=be(e,i),o=Te(e,i+4),s=Te(e,i+8),c=Te(e,i+12);r.push({tag:n,checksum:o,offset:s,length:c,compression:!1}),i+=16}return r}function Se(e,t){if("WOFF"===t.compression){var r=new Uint8Array(e.buffer,t.offset+2,t.compressedLength-2),i=new Uint8Array(t.length);return ge(r,i),i.byteLength!==t.length&&oe.error("Decompression error: "+t.tag+" decompressed length doesn't match recorded length"),{data:new DataView(i.buffer,0),offset:0}}return{data:e,offset:t.offset}}var Ee=function(){function e(e,t){this.data=e,this.offset=t,this.relativeOffset=0}return e.prototype.parseByte=function(){var e=this.data.getUint8(this.offset+this.relativeOffset);return this.relativeOffset+=1,e},e.prototype.parseUShort=function(){var e=this.data.getUint16(this.offset+this.relativeOffset);return this.relativeOffset+=2,e},e.prototype.parseULong=function(){var e=Te(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,e},e.prototype.parseShort=function(){var e=this.data.getInt16(this.offset+this.relativeOffset);return this.relativeOffset+=2,e},e.prototype.parseFixed=function(){var e,t,r=(e=this.data,t=this.offset+this.relativeOffset,e.getInt16(t,!1)+e.getUint16(t+2,!1)/65535);return this.relativeOffset+=4,r},e.prototype.parseVersion=function(e){var t=xe(this.data,this.offset+this.relativeOffset),r=xe(this.data,this.offset+this.relativeOffset+2);return this.relativeOffset+=4,void 0===e&&(e=4096),t+r/e/10},e.prototype.skip=function(e,t){void 0===t&&(t=1),this.relativeOffset+=we[e]*t},e}(),Ce=["copyright","fontFamily","fontSubfamily","uniqueID","fullName","version","postScriptName","trademark","manufacturer","designer","description","manufacturerURL","designerURL","license","licenseURL","reserved","preferredFamily","preferredSubfamily","compatibleFullName","sampleText","postScriptFindFontName","wwsFamily","wwsSubfamily"],Ae={0:"en",1:"fr",2:"de",3:"it",4:"nl",5:"sv",6:"es",7:"da",8:"pt",9:"no",10:"he",11:"ja",12:"ar",13:"fi",14:"el",15:"is",16:"mt",17:"tr",18:"hr",19:"zh-Hant",20:"ur",21:"hi",22:"th",23:"ko",24:"lt",25:"pl",26:"hu",27:"es",28:"lv",29:"se",30:"fo",31:"fa",32:"ru",33:"zh",34:"nl-BE",35:"ga",36:"sq",37:"ro",38:"cz",39:"sk",40:"si",41:"yi",42:"sr",43:"mk",44:"bg",45:"uk",46:"be",47:"uz",48:"kk",49:"az-Cyrl",50:"az-Arab",51:"hy",52:"ka",53:"mo",54:"ky",55:"tg",56:"tk",57:"mn-CN",58:"mn",59:"ps",60:"ks",61:"ku",62:"sd",63:"bo",64:"ne",65:"sa",66:"mr",67:"bn",68:"as",69:"gu",70:"pa",71:"or",72:"ml",73:"kn",74:"ta",75:"te",76:"si",77:"my",78:"km",79:"lo",80:"vi",81:"id",82:"tl",83:"ms",84:"ms-Arab",85:"am",86:"ti",87:"om",88:"so",89:"sw",90:"rw",91:"rn",92:"ny",93:"mg",94:"eo",128:"cy",129:"eu",130:"ca",131:"la",132:"qu",133:"gn",134:"ay",135:"tt",136:"ug",137:"dz",138:"jv",139:"su",140:"gl",141:"af",142:"br",143:"iu",144:"gd",145:"gv",146:"ga",147:"to",148:"el-polyton",149:"kl",150:"az",151:"nn"},_e={1078:"af",1052:"sq",1156:"gsw",1118:"am",5121:"ar-DZ",15361:"ar-BH",3073:"ar",2049:"ar-IQ",11265:"ar-JO",13313:"ar-KW",12289:"ar-LB",4097:"ar-LY",6145:"ary",8193:"ar-OM",16385:"ar-QA",1025:"ar-SA",10241:"ar-SY",7169:"aeb",14337:"ar-AE",9217:"ar-YE",1067:"hy",1101:"as",2092:"az-Cyrl",1068:"az",1133:"ba",1069:"eu",1059:"be",2117:"bn",1093:"bn-IN",8218:"bs-Cyrl",5146:"bs",1150:"br",1026:"bg",1027:"ca",3076:"zh-HK",5124:"zh-MO",2052:"zh",4100:"zh-SG",1028:"zh-TW",1155:"co",1050:"hr",4122:"hr-BA",1029:"cs",1030:"da",1164:"prs",1125:"dv",2067:"nl-BE",1043:"nl",3081:"en-AU",10249:"en-BZ",4105:"en-CA",9225:"en-029",16393:"en-IN",6153:"en-IE",8201:"en-JM",17417:"en-MY",5129:"en-NZ",13321:"en-PH",18441:"en-SG",7177:"en-ZA",11273:"en-TT",2057:"en-GB",1033:"en",12297:"en-ZW",1061:"et",1080:"fo",1124:"fil",1035:"fi",2060:"fr-BE",3084:"fr-CA",1036:"fr",5132:"fr-LU",6156:"fr-MC",4108:"fr-CH",1122:"fy",1110:"gl",1079:"ka",3079:"de-AT",1031:"de",5127:"de-LI",4103:"de-LU",2055:"de-CH",1032:"el",1135:"kl",1095:"gu",1128:"ha",1037:"he",1081:"hi",1038:"hu",1039:"is",1136:"ig",1057:"id",1117:"iu",2141:"iu-Latn",2108:"ga",1076:"xh",1077:"zu",1040:"it",2064:"it-CH",1041:"ja",1099:"kn",1087:"kk",1107:"km",1158:"quc",1159:"rw",1089:"sw",1111:"kok",1042:"ko",1088:"ky",1108:"lo",1062:"lv",1063:"lt",2094:"dsb",1134:"lb",1071:"mk",2110:"ms-BN",1086:"ms",1100:"ml",1082:"mt",1153:"mi",1146:"arn",1102:"mr",1148:"moh",1104:"mn",2128:"mn-CN",1121:"ne",1044:"nb",2068:"nn",1154:"oc",1096:"or",1123:"ps",1045:"pl",1046:"pt",2070:"pt-PT",1094:"pa",1131:"qu-BO",2155:"qu-EC",3179:"qu",1048:"ro",1047:"rm",1049:"ru",9275:"smn",4155:"smj-NO",5179:"smj",3131:"se-FI",1083:"se",2107:"se-SE",8251:"sms",6203:"sma-NO",7227:"sms",1103:"sa",7194:"sr-Cyrl-BA",3098:"sr",6170:"sr-Latn-BA",2074:"sr-Latn",1132:"nso",1074:"tn",1115:"si",1051:"sk",1060:"sl",11274:"es-AR",16394:"es-BO",13322:"es-CL",9226:"es-CO",5130:"es-CR",7178:"es-DO",12298:"es-EC",17418:"es-SV",4106:"es-GT",18442:"es-HN",2058:"es-MX",19466:"es-NI",6154:"es-PA",15370:"es-PY",10250:"es-PE",20490:"es-PR",3082:"es",1034:"es",21514:"es-US",14346:"es-UY",8202:"es-VE",2077:"sv-FI",1053:"sv",1114:"syr",1064:"tg",2143:"tzm",1097:"ta",1092:"tt",1098:"te",1054:"th",1105:"bo",1055:"tr",1090:"tk",1152:"ug",1058:"uk",1070:"hsb",1056:"ur",2115:"uz-Cyrl",1091:"uz",1066:"vi",1106:"cy",1160:"wo",1157:"sah",1144:"ii",1130:"yo"},Me={0:"macintosh",1:"x-mac-japanese",2:"x-mac-chinesetrad",3:"x-mac-korean",6:"x-mac-greek",7:"x-mac-cyrillic",9:"x-mac-devanagai",10:"x-mac-gurmukhi",11:"x-mac-gujarati",12:"x-mac-oriya",13:"x-mac-bengali",14:"x-mac-tamil",15:"x-mac-telugu",16:"x-mac-kannada",17:"x-mac-malayalam",18:"x-mac-sinhalese",19:"x-mac-burmese",20:"x-mac-khmer",21:"x-mac-thai",22:"x-mac-lao",23:"x-mac-georgian",24:"x-mac-armenian",25:"x-mac-chinesesimp",26:"x-mac-tibetan",27:"x-mac-mongolian",28:"x-mac-ethiopic",29:"x-mac-ce",30:"x-mac-vietnamese",31:"x-mac-extarabic"},Ie={15:"x-mac-icelandic",17:"x-mac-turkish",18:"x-mac-croatian",24:"x-mac-ce",25:"x-mac-ce",26:"x-mac-ce",27:"x-mac-ce",28:"x-mac-ce",30:"x-mac-icelandic",37:"x-mac-romanian",38:"x-mac-ce",39:"x-mac-ce",40:"x-mac-ce",143:"x-mac-inuit",146:"x-mac-gaelic"};function Re(e,t,r){switch(e){case 0:if(65535===t)return"und";if(r)return r[t];break;case 1:return Ae[t];case 3:return _e[t]}}var Pe="utf-16";function Oe(e,t,r){switch(e){case 0:return Pe;case 1:return Ie[r]||Me[t];case 3:if(1===t||10===t)return Pe}}var De={0:"unicode",1:"macintosh",2:"reserved",3:"windows"};function Be(e){return De[e]}function Fe(e,t){var r,i=new Ee(e,t),a=i.parseULong();r="Unsupported ltag table version.",1===a||fail(r),i.skip("uLong",1);for(var n=i.parseULong(),o=[],s=0;s<n;s++){for(var c="",u=t+i.parseUShort(),l=i.parseUShort(),h=u;h<u+l;++h)c+=String.fromCharCode(e.getInt8(h));o.push(c)}return o}var Le={parse:function(e){var t,r,i=new DataView(e,0),a=be(i,0),n=!1;if(a===String.fromCharCode(0,1,0,0)||"true"===a||"typ1"===a)r=ke(i,t=xe(i,4));else if("OTTO"===a)r=ke(i,t=xe(i,4)),n=!0;else if("wOFF"===a){var o=be(i,4);if(o===String.fromCharCode(0,1,0,0));else if("OTTO"!==o)return void oe.error("Unsupported OpenType flavor "+a);r=function(e,t){for(var r=[],i=44,a=0;a<t;a+=1){var n=be(e,i),o=Te(e,i+4),s=Te(e,i+8),c=Te(e,i+12),u=void 0;u=s<c&&"WOFF",r.push({tag:n,offset:o,compression:u,compressedLength:s,length:c}),i+=20}return r}(i,t=xe(i,12))}else if("wOF2"===a){oe.error("WOFF2 require an external decompressor library, see examples at: https://github.com/opentypejs/opentype.js/issues/183#issuecomment-1147228025")}else oe.error("Unsupported OpenType signature "+a);for(var s,c,u,l,h=2048,d=0,f=!1,m=0;m<t;m++){var p=r[m];if("head"===p.tag){var g=Se(i,p);(v=new Ee(g.data,g.offset)).parseVersion(),v.parseFixed(),v.parseULong(),v.parseULong(),v.parseUShort(),h=v.parseUShort()}else if("hhea"===p.tag){if(!f){g=Se(i,p);(v=new Ee(g.data,g.offset)).parseVersion(),s=Math.abs(v.parseShort()),c=Math.abs(v.parseShort()),d=Math.abs(v.parseShort()||0)}}else if("ltag"===p.tag){l=Fe((g=Se(i,p)).data,g.offset)}else if("name"===p.tag)u=Se(i,p);else if("OS/2"===p.tag){g=Se(i,p);var v,y=(v=new Ee(g.data,g.offset)).parseUShort();v.parseShort(),v.parseUShort(),v.parseUShort(),v.parseUShort(),v.parseShort(),v.parseShort(),v.parseShort(),v.parseShort(),v.parseShort(),v.parseShort(),v.parseShort(),v.parseShort(),v.parseShort(),v.parseShort(),v.parseShort();for(var b=0;b<10;b++)v.parseByte();v.parseULong(),v.parseULong(),v.parseULong(),v.parseULong(),v.parseByte(),v.parseByte(),v.parseByte(),v.parseByte();var x=v.parseUShort(),T=y>=4&&(128&x||n);(T||void 0===s)&&(v.parseUShort(),v.parseUShort(),s=Math.abs(v.parseShort()),c=Math.abs(v.parseShort()),d=Math.abs(v.parseShort()||0),T&&(f=!0))}}var w=u?function(e,t,r){for(var i={},a=new Ee(e,t),n=a.parseUShort(),o=a.parseUShort(),s=a.offset+a.parseUShort(),c=0;c<o;c++){var u=a.parseUShort(),l=a.parseUShort(),h=a.parseUShort(),d=a.parseUShort(),f=Ce[d]||d,m=a.parseUShort(),p=a.parseUShort(),g=Re(u,h,r),v=Oe(u,l,h),y=Be(u);if(void 0!==v&&void 0!==g&&void 0!==y){var b=void 0;if(b=v===Pe?ve.UTF16(e,s+p,m):ve.MACSTRING(e,s+p,m,v)){var x=i[y];void 0===x&&(x=i[y]={});var T=x[f];void 0===T&&(T=x[f]={}),T[g]=b}}}return 1===n&&a.parseUShort(),i}(u.data,u.offset,l):{},k={};return w.macintosh&&Object.assign(k,w.macintosh),w.windows&&Object.assign(k,w.windows),{name:k,emSquare:h,ascent:s,descent:c,lineGap:d}}},Ne={name:"Arial",family:"Arial",lhr:1.14990234375,car:1.1171875,blr:.9052734375,lgr:.03271484375,list:[{style:"Regular",postscriptName:"Arial"}]},Ue="localFonts",ze="undefined"!=typeof navigator&&/win/i.test(navigator.platform),We={Arial:Ne},Ve={Arial:Ne},He={},Xe={KEY_INFO:Ue,info:We,data:Ve,hasRegister:function(e){return Ve.hasOwnProperty(e)},registerLocalFonts:function(e){return i(this,void 0,void 0,function(){var t,r,i,n,o,s,c,u,l,h,d,f,m,p,g,v;return a(this,function(a){switch(a.label){case 0:return e?[3,2]:[4,oe.loadLocalFonts()];case 1:e=a.sent()||[],a.label=2;case 2:if(t={},"undefined"!=typeof localStorage)try{t=JSON.parse(localStorage.getItem(Ue)||"{}")}catch(e){}r=t.data||{},(!t.version||t.version<2)&&(r={}),i=0,n=e.length,a.label=3;case 3:return i<n?(o=e[i],s=o.postscriptName,c=o.family,u=o.style,ze?[4,oe.addLocalFont(s)]:[3,5]):[3,10];case 4:a.sent(),a.label=5;case 5:return r.hasOwnProperty(c)&&(l=r[c],We[c]=We[c]||{name:l.name,family:c,lhr:l.lhr,car:l.car,blr:l.blr,lgr:l.lgr,list:[]}),We.hasOwnProperty(c)?[3,8]:(h=We[c]={name:"",family:"",lhr:0,car:0,blr:0,lgr:0,list:[]},[4,o.blob()]);case 6:return[4,a.sent().arrayBuffer()];case 7:d=a.sent(),(f=Le.parse(d))&&f.name&&(h.name=(null===(p=f.name.preferredFamily)||void 0===p?void 0:p.zh)||(null===(g=f.name.preferredFamily)||void 0===g?void 0:g.en)||(null===(v=f.name.fontFamily)||void 0===v?void 0:v.zh)),h.name=h.name||c,h.family=c,m=this._cal(c,f),Object.assign(h,m),a.label=8;case 8:this._register(c,u,s),je(c),s!==c&&je(s),a.label=9;case 9:return i++,[3,3];case 10:return this.updateLocalStorage(),[2]}})})},registerAb:function(e,t){return i(this,void 0,void 0,function(){var r,i,n,o,s,c,u,l,h,d,f,m,p,g;return a(this,function(a){switch(a.label){case 0:return t&&Ve.hasOwnProperty(t)?[2]:(r={},(i=Le.parse(e))&&i.name&&(r.family=(null===(u=i.name.preferredFamily)||void 0===u?void 0:u.en)||(null===(l=i.name.fontFamily)||void 0===l?void 0:l.en),r.name=(null===(h=i.name.preferredFamily)||void 0===h?void 0:h.zh)||(null===(d=i.name.preferredFamily)||void 0===d?void 0:d.en)||(null===(f=i.name.fontFamily)||void 0===f?void 0:f.zh)||r.family),n=r.family,o=(null===(m=i.name.preferredSubfamily)||void 0===m?void 0:m.en)||(null===(p=i.name.fontSubfamily)||void 0===p?void 0:p.en),s=null===(g=i.name.postScriptName)||void 0===g?void 0:g.en,n&&o&&s?[4,oe.addArrayBufferFont(n,e)]:[2]);case 1:return a.sent(),s===n?[3,3]:[4,oe.addArrayBufferFont(s,e)];case 2:a.sent(),a.label=3;case 3:return t&&t!==n&&t!==s?[4,oe.addArrayBufferFont(t,e)]:[3,5];case 4:a.sent(),a.label=5;case 5:return We.hasOwnProperty(n)||(c=this._cal(n,i),Object.assign(r,c),r.list=[],We[n]=Ve[n]=r),this._register(n,o,s),t&&t!==n&&t!==s&&(We[t]=Ve[t]=Ve[n]),je(n),s!==n&&je(s),t&&t!==n&&t!==s&&je(t),[2,Ve[n]]}})})},_cal:function(e,t){var r=0;return["times","helvetica","courier"].indexOf(e.toLowerCase())>-1&&(r=Math.round(.15*(t.ascent+t.descent))),{lhr:(t.ascent+r+t.descent+t.lineGap)/t.emSquare,car:(t.ascent+r+t.descent)/t.emSquare,blr:(t.ascent+r)/t.emSquare,lgr:t.lineGap/t.emSquare}},_register:function(e,t,r){for(var i=We[e],a=i.list=i.list||[],n=!1,o=0,s=a.length;o<s;o++){if(a[o].postscriptName===r){n=!0;break}}return n||a.push({style:t,postscriptName:r}),{family:e,postscriptName:r,data:Ve[e]=Ve[r]=i}},waitIfNotRegister:function(e,t){Ve[e]||(He[e]=He[e]||[]).push(t)},updateLocalStorage:function(){var e={};for(var t in We)if(We.hasOwnProperty(t)){var r=We[t];e[t]={name:r.name,lhr:r.lhr,car:r.car,blr:r.blr,lgr:r.lgr}}"undefined"!=typeof localStorage&&localStorage.setItem(Ue,JSON.stringify({version:2,data:e}))}};function je(e){He.hasOwnProperty(e)&&(He[e].slice(0).forEach(function(e){e()}),delete He[e])}function Ge(e,t,r,i){return e*r+t*i}function Ye(e,t,r,i,a,n){return e*i+t*a+r*n}function qe(e,t,r,i){return e*i-r*t}function Ke(e,t,r,i,a){void 0===a&&(a=!1);var n=0;return n=e===r&&t===i?1:t===i&&0===t?e>0&&r>0||e<0&&r<0?1:-1:e===r&&0===e?t>0&&i>0||t<0&&i<0?1:-1:Ge(e,t,r,i)/($e(e,t)*$e(r,i)),a?n:Math.acos(n)||0}function $e(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Qe(e,t,r){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2)+Math.pow(r,2))}function Ze(e,t){var r=$e(e,t);return{x:e/r,y:t/r}}function Je(e,t,r,i){return Math.abs(e)<1e-9&&Math.abs(t)<1e-9&&Math.abs(r)<1e-9&&Math.abs(i)<1e-9}function et(e,t,r,i,a,n){return Math.abs(e)<1e-9&&Math.abs(t)<1e-9&&Math.abs(r)<1e-9&&Math.abs(i)<1e-9&&Math.abs(a)<1e-9&&Math.abs(n)<1e-9}function tt(e,t,r,i){var a=Ge(e,t,r,i)/($e(e,t)*$e(r,i));return a<-1?a=-1:a>1&&(a=1),Math.acos(a)}function rt(e,t,r,i,a,n){var o=Ye(e,t,r,i,a,n)/(Qe(e,t,r)*Qe(i,a,n));return o<-1?o=-1:o>1&&(o=1),Math.acos(o)}var it={dotProduct:Ge,dotProduct3:Ye,crossProduct:qe,crossProduct3:function(e,t,r,i,a,n){return{x:t*n-a*r,y:r*i-n*e,z:e*a-i*t}},projection:function(e,t,r,i){var a=Ge(e,t,r,i),n=Math.pow(r,2)+Math.pow(i,2);return{x:a*r/n,y:a*i/n}},includedAngle:Ke,length:$e,length3:Qe,unitize:Ze,unitize3:function(e,t,r){var i=Qe(e,t,r);return{x:e/i,y:t/i,z:r/i}},angle:tt,angle3:rt,isParallel:function(e,t,r,i){if(Je(e,t,r,i))return!0;var a=tt(e,t,r,i);return Math.abs(a)<1e-9||Math.PI-Math.abs(a)<1e-9},isParallel3:function(e,t,r,i,a,n){if(et(e,t,r,i,a,n))return!0;var o=rt(e,t,r,i,a,n);return Math.abs(o)<1e-9||Math.PI-Math.abs(o)<1e-9},isZero:Je,isZero3:et};function at(){return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}function nt(e){return!e||!e.length||1===e[0]&&0===e[1]&&0===e[2]&&0===e[3]&&0===e[4]&&1===e[5]&&0===e[6]&&0===e[7]&&0===e[8]&&0===e[9]&&1===e[10]&&0===e[11]&&0===e[12]&&0===e[13]&&0===e[14]&&1===e[15]}function ot(e,t){if(nt(e))return new Float32Array(t);if(nt(t))return new Float32Array(e);for(var r=at(),i=0;i<4;i++){var a=e[i],n=e[i+4],o=e[i+8],s=e[i+12];r[i]=a*t[0]+n*t[1]+o*t[2]+s*t[3],r[i+4]=a*t[4]+n*t[5]+o*t[6]+s*t[7],r[i+8]=a*t[8]+n*t[9]+o*t[10]+s*t[11],r[i+12]=a*t[12]+n*t[13]+o*t[14]+s*t[15]}return r}function st(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function ct(e){if(nt(e))return at();var t=new Float32Array(16);t[0]=e[5]*e[10]*e[15]-e[5]*e[11]*e[14]-e[9]*e[6]*e[15]+e[9]*e[7]*e[14]+e[13]*e[6]*e[11]-e[13]*e[7]*e[10],t[4]=-e[4]*e[10]*e[15]+e[4]*e[11]*e[14]+e[8]*e[6]*e[15]-e[8]*e[7]*e[14]-e[12]*e[6]*e[11]+e[12]*e[7]*e[10],t[8]=e[4]*e[9]*e[15]-e[4]*e[11]*e[13]-e[8]*e[5]*e[15]+e[8]*e[7]*e[13]+e[12]*e[5]*e[11]-e[12]*e[7]*e[9],t[12]=-e[4]*e[9]*e[14]+e[4]*e[10]*e[13]+e[8]*e[5]*e[14]-e[8]*e[6]*e[13]-e[12]*e[5]*e[10]+e[12]*e[6]*e[9],t[1]=-e[1]*e[10]*e[15]+e[1]*e[11]*e[14]+e[9]*e[2]*e[15]-e[9]*e[3]*e[14]-e[13]*e[2]*e[11]+e[13]*e[3]*e[10],t[5]=e[0]*e[10]*e[15]-e[0]*e[11]*e[14]-e[8]*e[2]*e[15]+e[8]*e[3]*e[14]+e[12]*e[2]*e[11]-e[12]*e[3]*e[10],t[9]=-e[0]*e[9]*e[15]+e[0]*e[11]*e[13]+e[8]*e[1]*e[15]-e[8]*e[3]*e[13]-e[12]*e[1]*e[11]+e[12]*e[3]*e[9],t[13]=e[0]*e[9]*e[14]-e[0]*e[10]*e[13]-e[8]*e[1]*e[14]+e[8]*e[2]*e[13]+e[12]*e[1]*e[10]-e[12]*e[2]*e[9],t[2]=e[1]*e[6]*e[15]-e[1]*e[7]*e[14]-e[5]*e[2]*e[15]+e[5]*e[3]*e[14]+e[13]*e[2]*e[7]-e[13]*e[3]*e[6],t[6]=-e[0]*e[6]*e[15]+e[0]*e[7]*e[14]+e[4]*e[2]*e[15]-e[4]*e[3]*e[14]-e[12]*e[2]*e[7]+e[12]*e[3]*e[6],t[10]=e[0]*e[5]*e[15]-e[0]*e[7]*e[13]-e[4]*e[1]*e[15]+e[4]*e[3]*e[13]+e[12]*e[1]*e[7]-e[12]*e[3]*e[5],t[14]=-e[0]*e[5]*e[14]+e[0]*e[6]*e[13]+e[4]*e[1]*e[14]-e[4]*e[2]*e[13]-e[12]*e[1]*e[6]+e[12]*e[2]*e[5],t[3]=-e[1]*e[6]*e[11]+e[1]*e[7]*e[10]+e[5]*e[2]*e[11]-e[5]*e[3]*e[10]-e[9]*e[2]*e[7]+e[9]*e[3]*e[6],t[7]=e[0]*e[6]*e[11]-e[0]*e[7]*e[10]-e[4]*e[2]*e[11]+e[4]*e[3]*e[10]+e[8]*e[2]*e[7]-e[8]*e[3]*e[6],t[11]=-e[0]*e[5]*e[11]+e[0]*e[7]*e[9]+e[4]*e[1]*e[11]-e[4]*e[3]*e[9]-e[8]*e[1]*e[7]+e[8]*e[3]*e[5],t[15]=e[0]*e[5]*e[10]-e[0]*e[6]*e[9]-e[4]*e[1]*e[10]+e[4]*e[2]*e[9]+e[8]*e[1]*e[6]-e[8]*e[2]*e[5];var r=e[0]*t[0]+e[1]*t[4]+e[2]*t[8]+e[3]*t[12];if(0===r)return at();r=1/r;for(var i=new Float32Array(16),a=0;a<16;a++)i[a]=t[a]*r;return i}function ut(e,t){return e&&t&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e}function lt(e,t,r){return t||r?(e[12]+=e[0]*t+e[4]*r,e[13]+=e[1]*t+e[5]*r,e[14]+=e[2]*t+e[6]*r,e[15]+=e[3]*t+e[7]*r,e):e}function ht(e,t,r){if(!e&&!t)return r;var i=r[3],a=r[7],n=r[11],o=r[15];return r[0]+=i*e,r[1]+=i*t,r[4]+=a*e,r[5]+=a*t,r[8]+=n*e,r[9]+=n*t,r[12]+=o*e,r[13]+=o*t,r}function dt(e,t){if(!t)return e;var r=Math.tan(t);return e[4]+=e[0]*r,e[5]+=e[1]*r,e[6]+=e[2]*r,e[7]+=e[3]*r,e}function ft(e,t){if(!t)return e;var r=Math.tan(t);return e[0]+=e[4]*r,e[1]+=e[5]*r,e[2]+=e[6]*r,e[3]+=e[7]*r,e}function mt(e,t){if(!t)return e;var r=Math.sin(t),i=Math.cos(t),a=e[4],n=e[5],o=e[6],s=e[7],c=e[8],u=e[10],l=e[11];return e[4]=a*i+c*r,e[5]=n*i+o*r,e[6]=o*i+u*r,e[7]=s*i+l*r,e[8]=a*-r+c*i,e[9]=n*-r+o*i,e[10]=o*-r+u*i,e[11]=s*-r+l*i,e}function pt(e,t){if(!t)return e;var r=Math.sin(t),i=Math.cos(t),a=e[0],n=e[1],o=e[2],s=e[3],c=e[8],u=e[9],l=e[10],h=e[11];return e[0]=a*i+c*-r,e[1]=n*i+u*-r,e[2]=o*i+l*-r,e[3]=s*i+h*-r,e[8]=a*r+c*i,e[9]=n*r+u*i,e[10]=o*r+l*i,e[11]=s*r+h*i,e}function gt(e,t){if(!t)return e;var r=Math.sin(t),i=Math.cos(t),a=e[0],n=e[1],o=e[2],s=e[3],c=e[4],u=e[5],l=e[6],h=e[7];return e[0]=a*i+c*r,e[1]=n*i+u*r,e[2]=o*i+l*r,e[3]=s*i+h*r,e[4]=a*-r+c*i,e[5]=n*-r+u*i,e[6]=o*-r+l*i,e[7]=s*-r+h*i,e}function vt(e,t){return 1===t||(e[0]*=t,e[1]*=t,e[2]*=t,e[3]*=t),e}function yt(e,t){return 1===t||(e[4]*=t,e[5]*=t,e[6]*=t,e[7]*=t),e}function bt(e,t){if(t&&!nt(t)){var r=e.x,i=e.y,a=e.z,n=void 0===a?0:a,o=e.w,s=void 0===o?1:o,c=t[0],u=t[1],l=t[2],h=t[3],d=t[4],f=t[5],m=t[6],p=t[7],g=t[8],v=t[9],y=t[10],b=t[11],x=t[12],T=t[13],w=t[14],k=t[15],S={x:(1===c?r:r*c)+(d?i*d:0)+(1===s?x:x*s),y:(1===u?r:r*u)+(f?i*f:0)+(1===s?T:T*s),z:n,w:s};return h||p||b?S.w=r*h+i*p+n*b+k*s:1!==k&&(S.w*=k),n?(S.x+=n*g,S.y+=n*v,S.z=r*l+i*m+w+n*y):(l||m||w)&&(S.z=r*l+i*m+w),S}return e}function xt(e){if(16===e.length)return ct(e);var t=e[0],r=e[1],i=e[2],a=e[3],n=e[4],o=e[5];if(1===t&&0===r&&0===i&&1===a&&0===n&&0===o)return e;var s=t*a-r*i;return 0===s?e:new Float32Array([a/s,-r/s,-i/s,t/s,(i*o-a*n)/s,(r*n-t*o)/s])}function Tt(e,t,r,i,a){var n,o,s,c,u,l,h,d,f=bt({x:e,y:t},a),m=f.x,p=f.y,g=f.z,v=f.w,y=bt({x:r,y:i},a),b=y.x,x=y.y,T=y.z,w=y.w;if(a&&a.length&&(a[1]||a[2]||a[4]||a[6]||a[7]||a[8])){var k=bt({x:r,y:t},a);n=k.x,o=k.y,s=k.z,c=k.w,u=(k=bt({x:e,y:i},a)).x,l=k.y,h=k.z,d=k.w}else n=b,o=p,u=m,l=x;return{x1:m,y1:p,z1:g,w1:v,x2:n,y2:o,z2:s,w2:c,x3:b,y3:x,z3:T,w3:w,x4:u,y4:l,z4:h,w4:d}}var wt={identity:at,isE:nt,toE:st,assignMatrix:ut,inverse:xt,inverse4:ct,calPoint:bt,calRectPoints:Tt,tfoMultiply:ht,multiplyTfo:lt,multiply:ot,multiplyRef:function(e,t){if(nt(e))return t;if(nt(t))return ut(t,e),t;for(var r=t[0],i=t[1],a=t[2],n=t[3],o=t[4],s=t[5],c=t[6],u=t[7],l=t[8],h=t[9],d=t[10],f=t[11],m=t[12],p=t[13],g=t[14],v=t[15],y=0;y<4;y++){var b=e[y],x=e[y+4],T=e[y+8],w=e[y+12];t[y]=b*r+x*i+T*a+w*n,t[y+4]=b*o+x*s+T*c+w*u,t[y+8]=b*l+x*h+T*d+w*f,t[y+12]=b*m+x*p+T*g+w*v}return t},multiplyTranslate:function(e,t,r){return t||r?(e[12]+=e[0]*t+e[4]*r,e[13]+=e[1]*t+e[5]*r,e[14]+=e[2]*t+e[6]*r,e[15]+=e[3]*t+e[7]*r,e):e},multiplyTranslateX:function(e,t){return t?(e[12]+=e[0]*t,e[13]+=e[1]*t,e[14]+=e[2]*t,e[15]+=e[3]*t,e):e},multiplyTranslateY:function(e,t){return t?(e[12]+=e[4]*t,e[13]+=e[5]*t,e[14]+=e[6]*t,e[15]+=e[7]*t,e):e},multiplyTranslateZ:function(e,t){return t?(e[12]+=e[8]*t,e[13]+=e[9]*t,e[14]+=e[10]*t,e[15]+=e[11]*t,e):e},multiplyRotateX:mt,multiplyRotateY:pt,multiplyRotateZ:gt,multiplySkewX:dt,multiplySkewY:ft,multiplyScale:function(e,t){return 1===t||(e[0]*=t,e[1]*=t,e[2]*=t,e[3]*=t,e[4]*=t,e[5]*=t,e[6]*=t,e[7]*=t),e},multiplyScaleX:vt,multiplyScaleY:yt},kt=1e-9;function St(e){var t=[],r=e[3],i=e[2]/r,a=e[1]/r,n=(3*a-i*i)/3,o=(2*i*i*i-9*a*i+27*(e[0]/r))/27,s=i/3,c=o*o/4+n*n*n/27,u=o/2;if(Math.abs(c)<=kt&&(c=0),c>0){var l=Math.sqrt(c),h=void 0,d=void 0;d=(h=-u+l)>=0?Math.pow(h,1/3):-Math.pow(-h,1/3),(h=-u-l)>=0?d+=Math.pow(h,1/3):d-=Math.pow(-h,1/3),t.push(d-s)}else if(c<0){var f=Math.sqrt(-n/3),m=Math.atan2(Math.sqrt(-c),-u)/3,p=Math.cos(m),g=Math.sin(m),v=Math.sqrt(3);t.push(2*f*p-s),t.push(-f*(p+v*g)-s),t.push(-f*(p-v*g)-s)}else{h=void 0;h=u>=0?-Math.pow(u,1/3):Math.pow(-u,1/3),t.push(2*h-s),t.push(-h-s)}return t}function Et(e){for(var t=e.length-1,r=t;r>=0&&0===e[r];r--)t--;var i=[];switch(t){case 1:i=function(e){var t=[],r=e[1];return 0!==r&&t.push(-e[0]/r),t}(e);break;case 2:i=function(e){var t=[],r=e[2],i=e[1]/r,a=i*i-e[0]/r*4;if(a>0){var n=Math.sqrt(a);t.push(.5*(-i+n)),t.push(.5*(-i-n))}else 0===a&&t.push(.5*-i);return t}(e);break;case 3:i=St(e);break;case 4:i=function(e){var t=[],r=e[4],i=e[3]/r,a=e[2]/r,n=e[1]/r,o=e[0]/r,s=St([1,-a,i*n-4*o,-i*i*o+4*a*o-n*n].reverse())[0],c=i*i/4-a+s;if(Math.abs(c)<=kt&&(c=0),c>0){var u=Math.sqrt(c),l=(m=3*i*i/4-u*u-2*a)+(f=(4*i*a-8*n-i*i*i)/(4*u)),h=m-f;if(Math.abs(l)<=kt&&(l=0),Math.abs(h)<=kt&&(h=0),l>=0){var d=Math.sqrt(l);t.push(-i/4+(u+d)/2),t.push(-i/4+(u-d)/2)}h>=0&&(d=Math.sqrt(h),t.push(-i/4+(d-u)/2),t.push(-i/4-(d+u)/2))}else if(c<0);else{var f;if((f=s*s-4*o)>=-1e-9){var m;if(f<0&&(f=0),(m=3*i*i/4-2*a)+(f=2*Math.sqrt(f))>=kt){var p=Math.sqrt(m+f);t.push(-i/4+p/2),t.push(-i/4-p/2)}m-f>=kt&&(p=Math.sqrt(m-f),t.push(-i/4+p/2),t.push(-i/4-p/2))}}return t}(e)}return i}function Ct(e,t,r){return[r,-1,t-r*e]}function At(e,t,r,i,a,n){var o=Math.min(e,a),s=Math.min(t,n),c=Math.max(e,a),u=Math.max(t,n);if(r<o||i<s||r>c||i>u){var l=(e-r)/(e-2*r+a);isNaN(l)||l<0?l=0:l>1&&(l=1);var h=(t-i)/(t-2*i+n);isNaN(h)||h<0?h=0:h>1&&(h=1);var d=1-l,f=1-h,m=d*d*e+2*d*l*r+l*l*a,p=f*f*t+2*f*h*i+h*h*n;o=Math.min(o,m),s=Math.min(s,p),c=Math.max(c,m),u=Math.max(u,p)}return[o,s,c,u]}function _t(e,t,r,i,a,n,o,s){Array.isArray(e)&&(o=e[3].x,s=e[3].y,a=e[2].x,n=e[2].y,r=e[1].x,i=e[1].y,t=e[0].y,e=e[0].x);var c=Math.min(e,o),u=Math.min(t,s),l=Math.max(e,o),h=Math.max(t,s);(r<c||i<u||r>l||i>h||a<c||n<u||a>l||n>h)&&Ht(e,t,r,i,a,n,o,s).forEach(function(d){var f=Ft([{x:e,y:t},{x:r,y:i},{x:a,y:n},{x:o,y:s}],d);c=Math.min(c,f.x),u=Math.min(u,f.y),l=Math.max(l,f.x),h=Math.max(h,f.y)});return[c,u,l,h]}function Mt(e,t,r,i,a,n,o,s){var c=arguments.length;if(Array.isArray(e)){if((c=e.length)<2||c>4)throw new Error("Unsupported order");return 4===c?_t(e[0].x,e[0].y,e[1].x,e[1].y,e[2].x,e[2].y,e[3].x,e[3].y):3===c?At(e[0].x,e[0].y,e[1].x,e[1].y,e[2].x,e[2].y):[Math.min(e[0].x,e[1].x),Math.min(e[0].y,e[1].y),Math.max(e[0].x,e[1].x),Math.max(e[0].y,e[1].y)]}if(4===c||void 0===a||void 0===n)return[Math.min(e,r),Math.min(t,i),Math.max(e,r),Math.max(t,i)];if(6===c||void 0===o||void 0===s)return At(e,t,r,i,a,n);if(8===c)return _t(e,t,r,i,a,n,o,s);throw new Error("Unsupported order")}function It(e,t,r){var i=e,a=(2*t+r)/3,n=(t+2*r)/3;return(i(t)+3*i(a)+3*i(n)+i(r))*(r-t)/8}function Rt(e,t,r,i){void 0===i&&(i=1e-9);var a=e,n=(t+r)/2,o=It(a,t,r),s=It(a,t,n),c=It(a,n,r),u=s+c-o;return Math.abs(u)<=15*i?s+c+u/15:Rt(a,t,n,i/2)+Rt(a,n,r,i/2)}function Pt(e,t,r){if(void 0===t&&(t=0),void 0===r&&(r=1),2===e.length){var i=e[0],a=i.x,n=i.y,o=e[1],s=o.x,c=o.y;return Math.sqrt(Math.pow(s-a,2)+Math.pow(c-n,2))}if(e.length>4)throw new Error("Unsupported order");return Rt(function(t){var r=Ot(t,e);return Math.sqrt(Math.pow(r.x,2)+Math.pow(r.y,2))},t,r)}function Ot(e,t,r){if(void 0===r&&(r=1),4===t.length)return function(e,t,r){void 0===r&&(r=1);var i=t[0],a=i.x,n=i.y,o=t[1],s=o.x,c=o.y,u=t[2],l=u.x,h=u.y,d=t[3],f=d.x,m=d.y,p=0,g=0;return 0===r?(p=Math.pow(1-e,3)*a+3*e*Math.pow(1-e,2)*s+3*(1-e)*Math.pow(e,2)*l+Math.pow(e,3)*f,g=Math.pow(1-e,3)*n+3*e*Math.pow(1-e,2)*c+3*(1-e)*Math.pow(e,2)*h+Math.pow(e,3)*m):1===r?(p=3*((1-e)*(1-e)*(s-a)+2*(1-e)*e*(l-s)+e*e*(f-l)),g=3*((1-e)*(1-e)*(c-n)+2*(1-e)*e*(h-c)+e*e*(m-h))):2===r?(p=6*(l-2*s+a)*(1-e)+6*(f-2*l+s)*e,g=6*(h-2*c+n)*(1-e)+6*(m-2*h+c)*e):3===r&&(p=6*(f-3*l+3*s-a),g=6*(m-3*h+3*c-n)),{x:p,y:g}}(e,t,r);if(3===t.length)return function(e,t,r){void 0===r&&(r=1);var i=t[0],a=i.x,n=i.y,o=t[1],s=o.x,c=o.y,u=t[2],l=u.x,h=u.y,d=0,f=0;return 0===r?(d=Math.pow(1-e,2)*a+2*e*(1-e)*s+Math.pow(e,2)*l,f=Math.pow(1-e,2)*n+2*e*(1-e)*c+Math.pow(e,2)*h):1===r?(d=2*(1-e)*(s-a)+2*e*(l-s),f=2*(1-e)*(c-n)+2*e*(h-c)):2===r&&(d=2*(l-2*s+a),f=2*(h-2*c+n)),{x:d,y:f}}(e,t,r);throw new Error("Unsupported order")}function Dt(e,t){var r=e[0],i=r.x,a=r.y,n=e[1],o=n.x,s=n.y,c=(o-i)*t+i,u=(s-a)*t+a;if(2===e.length)return[{x:i,y:a},{x:c,y:u}];var l=e[2],h=l.x,d=l.y,f=(h-o)*t+o,m=(d-s)*t+s,p=(f-c)*t+c,g=(m-u)*t+u;if(4===e.length){var v=e[3];return[{x:i,y:a},{x:c,y:u},{x:p,y:g},{x:(((v.x-h)*t+h-f)*t+f-p)*t+p,y:(((v.y-d)*t+d-m)*t+m-g)*t+g}]}if(3===e.length)return[{x:i,y:a},{x:c,y:u},{x:p,y:g}];throw new Error("Unsupported order")}function Bt(e,t,r){var i;void 0===t&&(t=0),void 0===r&&(r=1),t=Math.max(t,0),t=Math.min(t,1),r=Math.max(r,0),r=Math.min(r,1);var a=e.slice(0);if(0===t&&1===r)return a;var n=r<t;return n&&(t=(i=[r,t])[0],r=i[1]),r<1&&(a=Dt(e,r)),t>0&&(r<1&&(t/=r),a=Dt(a.reverse(),1-t).reverse()),n&&a.reverse(),a}function Ft(e,t){if(void 0===t&&(t=0),0===t)return e[0];if(1===t)return e[e.length-1];if(4===e.length)return Nt(e,t);if(3===e.length)return Lt(e,t);if(2===e.length)return{x:e[0].x+(e[1].x-e[0].x)*t,y:e[0].y+(e[1].y-e[0].y)*t};throw new Error("Unsupported order")}function Lt(e,t){return{x:e[0].x*(1-t)*(1-t)+2*e[1].x*t*(1-t)+e[2].x*t*t,y:e[0].y*(1-t)*(1-t)+2*e[1].y*t*(1-t)+e[2].y*t*t}}function Nt(e,t){return{x:e[0].x*(1-t)*(1-t)*(1-t)+3*e[1].x*t*(1-t)*(1-t)+3*e[2].x*t*t*(1-t)+e[3].x*t*t*t,y:e[0].y*(1-t)*(1-t)*(1-t)+3*e[1].y*t*(1-t)*(1-t)+3*e[2].y*t*t*(1-t)+e[3].y*t*t*t}}function Ut(e,t,r,i){if(void 0===i&&(i=1e-9),4===e.length)return function(e,t,r,i){void 0===i&&(i=1e-9);for(var a=Qt(e,t,!0),n=Qt(e,r,!1),o=[],s=0,c=a.length;s<c;s++)for(var u=a[s],l=0,h=n.length;l<h;l++){var d=n[l],f=Math.abs(u-d);f<=i&&o.push({x:u,y:d,diff:f})}o.sort(function(e,t){return e.diff-t.diff}),o.length>3&&o.splice(3);o=o.map(function(e){return.5*(e.x+e.y)});var m=[];return o.forEach(function(a){var n=$t(e,a,!0),o=$t(e,a,!1);Math.abs(n-t)<=i&&Math.abs(o-r)<=i&&m.push(a)}),m}(e,t,r,i);if(3===e.length)return function(e,t,r,i){void 0===i&&(i=1e-9);for(var a=Qt(e,t,!0),n=Qt(e,r,!1),o=[],s=0,c=a.length;s<c;s++)for(var u=a[s],l=0,h=n.length;l<h;l++){var d=n[l],f=Math.abs(u-d);f<=i&&o.push({x:u,y:d,diff:f})}o.sort(function(e,t){return e.diff-t.diff}),o.length>2&&o.splice(2);o=o.map(function(e){return.5*(e.x+e.y)});var m=[];return o.forEach(function(a){var n=$t(e,a,!0),o=$t(e,a,!1);Math.abs(n-t)<=i&&Math.abs(o-r)<=i&&m.push(a)}),m}(e,t,r,i);if(2===e.length)return function(e,t,r,i){void 0===i&&(i=1e-9);var a=(t-e[0].x)/(e[1].x-e[0].x),n=(r-e[0].y)/(e[1].y-e[0].y);if(Math.abs(a-n)<=i)return[.5*(a+n)];return[]}(e,t,r,i);throw new Error("Unsupported order")}function zt(e,t){if(void 0===t&&(t=0),2===e.length){var r=e[0],i=r.x,a=r.y,n=e[1];return function(e,t,r,i){return t===i?0:e===r?i>t?1/0:-1/0:(i-t)/(r-e)}(i,a,n.x,n.y)}if(3===e.length)return Wt(e,t);if(4===e.length)return Vt(e,t);throw new Error("Unsupported order")}function Wt(e,t){void 0===t&&(t=0);var r=qt(e,t,!0);return 0===r?1/0:qt(e,t,!1)/r}function Vt(e,t){var r=qt(e,t,!0);return 0===r?1/0:qt(e,t,!1)/r}function Ht(e,t,r,i,a,n,o,s){var c=arguments.length;if(4===c)return[0,1];if(6===c)return function(e,t,r,i,a,n){var o=(e-r)/(e-2*r+a);isNaN(o)||o<0?o=0:o>1&&(o=1);var s=(t-i)/(t-2*i+n);isNaN(s)||s<0?s=0:s>1&&(s=1);var c=[o];return s!==o&&c.push(s),c.sort(function(e,t){return e-t}),c[0]>0&&c.unshift(0),c[c.length-1]<1&&c.push(1),c}(e,t,r,i,a,n);if(8===c)return function(e,t,r,i,a,n,o,s){var c=-3*t+3*i,u=6*t-12*i+6*n,l=-3*t+9*i-9*n+3*s,h=Et([-3*e+3*r,6*e-12*r+6*a,-3*e+9*r-9*a+3*o]).filter(function(e){return e>=0&&e<=1}),d=Et([c,u,l]).filter(function(e){return e>=0&&e<=1}),f=h.concat(d);f.sort(function(e,t){return e-t});for(var m=f.length-1;m>0;m--)f[m]===f[m-1]&&f.splice(m,1);return f}(e,t,r,i,a,n,o,s);throw new Error("Unsupported order")}function Xt(e,t,r){if(void 0===t&&(t=!0),void 0===r&&(r=1e-9),e.length<3||e.length>4)throw new Error("Unsupported order");var i=t?e[0].x:e[0].y,a=t?e[1].x:e[1].y,n=t?e[2].x:e[2].y;if(4===e.length){var o=Et([3*a-3*i,2*(3*i-6*a+3*n),3*(3*a-i-3*n+(t?e[3].x:e[3].y))]).filter(function(e){return e>r&&e<1-r});return o.sort(function(e,t){return e-t})}if(3===e.length){o=Et([2*(a-i),2*(i-2*a+n)]).filter(function(e){return e>r&&e<1-r});return o}}function jt(e,t,r){if(void 0===t&&(t=!0),void 0===r&&(r=1e-9),e.length<3||e.length>4)throw new Error("Unsupported order");var i=t?e[0].x:e[0].y,a=t?e[1].x:e[1].y,n=t?e[2].x:e[2].y;if(4===e.length){var o=Et([2*(3*i-6*a+3*n),6*(3*a-i-3*n+(t?e[3].x:e[3].y))]).filter(function(e){return e>r&&e<1-r});return o.sort(function(e,t){return e-t})}if(3===e.length)return(o=2*(i-2*a+n))>r&&o<1-r?[o]:[]}function Gt(e,t,r,i,a,n,o,s){void 0===n&&(n=1e-9),void 0===o&&(o=3),void 0===s&&(s=30);var c=[],u=Yt(e,t,r,t,i,a,n,o,s);if(u&&c.push(u),1===r){var l=Yt(e,t,r,r,i,a,n,o,s);l&&c.push(l)}var h=Yt(e,t,r,.5*(t+r),i,a,n,o,s);if(h&&c.push(h),c.length)return c.sort(function(e,t){return e.d-t.d}),c[0]}function Yt(e,t,r,i,a,n,o,s,c){void 0===o&&(o=1e-9),void 0===s&&(s=5),void 0===c&&(c=30);for(var u=i,l=0;l++<c;){var h=$t(e,i,!0)-a,d=$t(e,i,!1)-n,f=qt(e,i,!0),m=qt(e,i,!1),p=Kt(e,i,!0),g=Kt(e,i,!1),v=h*f+d*m,y=Math.pow(f,2)+h*p+Math.pow(m,2)+d*g;if(y<0)return;if((i-=v/y)>r?i=r:i<t&&(i=t),l>s){var b=$t(e,i,!0),x=$t(e,i,!1),T=$t(e,u,!0),w=$t(e,u,!1),k=Math.sqrt(Math.pow(b-T,2)+Math.pow(x-w,2));if(Math.abs(k)<o)break}u=i}var S=$t(e,i,!0),E=$t(e,i,!1);return{x:S,y:E,t:i,d:Math.sqrt(Math.pow(a-S,2)+Math.pow(n-E,2))}}function qt(e,t,r){if(void 0===r&&(r=!0),e.length<3||e.length>4)throw new Error("Unsupported order");var i=r?e[0].x:e[0].y,a=r?e[1].x:e[1].y,n=r?e[2].x:e[2].y;return 3===e.length?2*(i-2*a+n)*t+2*(a-i):4===e.length?3*(3*a-i-3*n+(r?e[3].x:e[3].y))*t*t+2*(3*i-6*a+3*n)*t+3*a-3*i:void 0}function Kt(e,t,r){if(void 0===r&&(r=!0),e.length<2||e.length>4)throw new Error("Unsupported order");if(2===e.length)return 0;var i=r?e[0].x:e[0].y,a=r?e[1].x:e[1].y,n=r?e[2].x:e[2].y;return 3===e.length?2*(i-2*a+n):4===e.length?6*(3*a-i-3*n+(r?e[3].x:e[3].y))*t+2*(3*i-6*a+3*n):void 0}function $t(e,t,r){if(void 0===r&&(r=!0),e.length<2||e.length>4)throw new Error("Unsupported order");var i=r?e[0].x:e[0].y,a=r?e[1].x:e[1].y;if(2===e.length)return i+(a-i)*t;var n=r?e[2].x:e[2].y;if(3===e.length)return Math.pow(1-t,2)*i+2*t*(1-t)*a+Math.pow(t,2)*n;if(4===e.length){var o=r?e[3].x:e[3].y;return Math.pow(1-t,3)*i+3*Math.pow(1-t,2)*t*a+3*Math.pow(t,2)*(1-t)*n+Math.pow(t,3)*o}}function Qt(e,t,r){void 0===r&&(r=!0);var i=r?e[0].x:e[0].y,a=r?e[1].x:e[1].y,n=r?e[2].x:e[2].y;return 4===e.length?Et([i-t,3*(a-i),3*(n+i-2*a),(r?e[3].x:e[3].y)-i+3*a-3*n]).filter(function(e){return e>=0&&e<=1}):Et([i-t,2*(a-i),n+i-2*a]).filter(function(e){return e>=0&&e<=1})}var Zt={bboxBezier:Mt,bezierLength:Pt,bezierAt:Ot,sliceBezier:Bt,getPointByT:Ft,getT:Qt,getPointT:Ut,getPointWithDByApprox:function(e,t,r,i){if(void 0===i&&(i=1e-9),e.length<2||e.length>4)throw new Error("Unsupported order");if(2===e.length){var a=e[1].x-e[0].x,n=e[1].y-e[0].y,o=t-e[0].x,s=r-e[0].y,c=Math.sqrt(Math.pow(a,2)+Math.pow(n,2)),u=Math.sqrt(Math.pow(o,2)+Math.pow(s,2))*Ke(a,n,o,s,!0)/c,l=a*u,h=n*u;return{x:l+=e[0].x,y:h+=e[0].y,d:Math.sqrt(Math.pow(l-t,2)+Math.pow(h-r,2)),t:u}}var d=Xt(e,!0),f=Xt(e,!1),m=jt(e,!0),p=jt(e,!1),g=[];d&&g.push.apply(g,d),f&&f.forEach(function(e){g.includes(e)||g.push(e)}),m&&m.forEach(function(e){g.includes(e)||g.push(e)}),p&&p.forEach(function(e){g.includes(e)||g.push(e)}),g.sort(function(e,t){return e-t});var v=[];if(g.forEach(function(a,n){if(!n){var o=Gt(e,0,a,t,r,i);void 0!==o&&v.push(o)}var s=Gt(e,a,g[n+1]||1,t,r,i);void 0!==s&&v.push(s)}),!g.length){var y=Gt(e,0,1,t,r,i);void 0!==y&&v.push(y)}if(v.sort(function(e,t){return e.d-t.d}),v.length)return{x:v[0].x,y:v[0].y,t:v[0].t,d:v[0].d}},bezierSlope:zt,bezierExtremaT:Ht,bezierTangent:function(e,t){if(void 0===t&&(t=0),2===e.length)return r=e[0].x,i=e[0].y,a=e[1].x,[(n=e[1].y)-i,r-a,i*(a-r)-r*(n-i)];var r,i,a,n;if(3===e.length)return function(e,t){void 0===t&&(t=0);var r=Wt(e,t),i=Lt(e,t);return Ct(i.x,i.y,r)}(e,t);if(4===e.length)return function(e,t){void 0===t&&(t=0);var r=Vt(e,t),i=Nt(e,t);return Ct(i.x,i.y,r)}(e,t);throw new Error("Unsupported order")},splitBezierT:function(e,t,r,i){if(void 0===r&&(r=5),t<2)return[];if(e.length>4||e.length<2)throw new Error("Unsupported order");for(var a=e[0],n=e[e.length-1],o=[{x:a.x,y:a.y,t:0}],s=1/t,c=1;c<t;c++){var u=s*c,l=Ft(e,u);o.push({x:l.x,y:l.y,t:u})}if(o.push({x:n.x,y:n.y,t:1}),2===e.length)return o;var h=(i=i||Pt(e))/t;for(c=0;c<r;c++){for(var d=[0],f=1;f<t;f++)d[f]=Math.sqrt(Math.pow(o[f].x-o[f-1].x,2)+Math.pow(o[f].y-o[f-1].y,2));var m=0;for(f=1;f<t;f++){m+=d[f]-h;var p=o[f],g=Ot(p.t,e,1),v=Math.sqrt(Math.pow(g.x,2)+Math.pow(g.y,2)),y=Ot(p.t,e,2),b=m*v,x=m*Math.sqrt(Math.pow(y.x,2)+Math.pow(y.y,2))+v*v;p.t=p.t-b/x;l=Ft(e,p.t);p.x=l.x,p.y=l.y}}return o},getBezierMonotonicityT:Xt,getBezierMonotonicityT2:jt,bezierDerivative:qt,bezierDerivative2:Kt,bezierValue:$t},Jt=it.unitize3,er=it.crossProduct3,tr=it.dotProduct3,rr=it.isParallel3,ir=it.length3;function ar(e){var t=e[0],r=e[e.length-1];return[Math.min(t.x,r.x),Math.min(t.y,r.y),Math.max(t.x,r.x),Math.max(t.y,r.y)]}function nr(e,t,r,i,a,n){var o,s,c,u,l,h,d,f,m=[{a:e,b:t,t1:0,t2:1,t3:0,t4:1}],p=e.length,g=t.length;if(2===p&&2===g){var v=cr(e[0].x,e[0].y,e[1].x,e[1].y,t[0].x,t[0].y,t[1].x,t[1].y,!0,r);return v&&n.push({x:v.x,y:v.y,t1:v.toSource,t2:v.toClip}),n}for(var y=function(){var e=m.pop(),t=e.a,i=e.b,v=e.t1,y=e.t2,b=e.t3,x=e.t4,T=a?ar(t):Mt(t[0].x,t[0].y,t[1].x,t[1].y,null===(o=t[2])||void 0===o?void 0:o.x,null===(s=t[2])||void 0===s?void 0:s.y,null===(c=t[3])||void 0===c?void 0:c.x,null===(u=t[3])||void 0===u?void 0:u.y),w=a?ar(i):Mt(i[0].x,i[0].y,i[1].x,i[1].y,null===(l=i[2])||void 0===l?void 0:l.x,null===(h=i[2])||void 0===h?void 0:h.y,null===(d=i[3])||void 0===d?void 0:d.x,null===(f=i[3])||void 0===f?void 0:f.y);if(a){if(t[0].x===i[0].x&&t[0].y===i[0].y)return n.push({x:t[0].x,y:t[0].y,t1:v,t2:b}),"continue";if(t[0].x===i[g-1].x&&t[0].y===i[g-1].y)return n.push({x:t[0].x,y:t[0].y,t1:v,t2:x}),"continue";if(t[p-1].x===i[0].x&&t[p-1].y===i[0].y)return n.push({x:i[0].x,y:i[0].y,t1:y,t2:b}),"continue";if(t[p-1].x===i[g-1].x&&t[p-1].y===i[g-1].y)return n.push({x:t[p-1].x,y:t[p-1].y,t1:y,t2:x}),"continue";if((T[0]===w[2]||T[2]===w[0])&&T[1]<=w[3]&&T[3]>=w[1]){var k=T[2]===w[0];if(2===p){if(C=sr(t,i,T,k)){var S=v+C.tl*(y-v),E=b+C.tb*(x-b);n.push({x:C.x,y:C.y,t1:S,t2:E})}}else if(2===g){if(C=sr(i,t,w,!k)){S=b+C.tl*(x-b),E=v+C.tb*(y-v);n.push({x:C.x,y:C.y,t1:E,t2:S})}}else{var C=function(e,t,r,i){var a,n,o,s,c,u;void 0===i&&(i=!0);var l=e.length,h=t.length,d=i?r[2]:r[0];if(e[0].x===d||e[l-1].x===d)if(t[0].x===d||t[h-1].x===d){if(e[0].x===d&&t[0].x===d&&e[0].y===t[0].y)return{x:d,y:e[0].y,ta:0,tb:0};if(e[0].x===d&&t[h-1].x===d&&e[0].y===t[h-1].y)return{x:d,y:e[0].y,ta:0,tb:1};if(e[l-1].x===d&&t[h-1].x===d&&e[l-1].y===t[h-1].y)return{x:d,y:e[l-1].y,ta:1,tb:1};if(e[l-1].x===d&&t[0].x===d&&e[l-1].y===t[0].y)return{x:d,y:e[l-1].y,ta:1,tb:0}}else{var f=Ht(t[0].x,t[0].y,t[1].x,t[1].y,t[2].x,t[2].y,null===(a=t[3])||void 0===a?void 0:a.x,null===(n=t[3])||void 0===n?void 0:n.y).filter(function(e){return e>0&&e<1}),m=Ft(t,f[0]);if(e[0].x===d&&e[0].y===m.y)return{x:d,y:m.y,ta:0,tb:f[0]};if(e[l-1].x===d&&e[l-1].y===m.y)return{x:d,y:m.y,ta:1,tb:f[0]}}else{var p=Ht(e[0].x,e[0].y,e[1].x,e[1].y,e[2].x,e[2].y,null===(o=e[3])||void 0===o?void 0:o.x,null===(s=e[3])||void 0===s?void 0:s.y).filter(function(e){return e>0&&e<1}),g=Ft(e,p[0]);if(t[0].x===d||t[h-1].x===d){if(t[0].x===d&&t[0].y===g.y)return{x:d,y:g.y,ta:p[0],tb:0};if(t[h-1].x===d&&t[h-1].y===g.y)return{x:d,y:g.y,ta:p[0],tb:1}}else{var v=Ht(t[0].x,t[0].y,t[1].x,t[1].y,t[2].x,t[2].y,null===(c=t[3])||void 0===c?void 0:c.x,null===(u=t[3])||void 0===u?void 0:u.y).filter(function(e){return e>0&&e<1}),y=Ft(t,v[0]);if(g.y===y.y)return{x:d,y:g.y,ta:p[0],tb:v[0]}}}}(t,i,T,k);if(C){var A=v+C.ta*(y-v);E=b+C.tb*(x-b);n.push({x:C.x,y:C.y,t1:A,t2:E})}}return"continue"}if((T[1]===w[3]||T[3]===w[1])&&T[0]<=w[2]&&T[2]>=w[0]){var _=T[3]===w[1];if(2===p){if(C=or(t,i,T,_)){S=v+C.tl*(y-v),E=b+C.tb*(x-b);n.push({x:C.x,y:C.y,t1:S,t2:E})}}else if(2===g){if(C=or(i,t,w,!_)){S=b+C.tl*(x-b),E=v+C.tb*(y-v);n.push({x:C.x,y:C.y,t1:E,t2:S})}}else{C=function(e,t,r,i){var a,n,o,s,c,u;void 0===i&&(i=!0);var l=e.length,h=t.length,d=i?r[3]:r[1];if(e[0].y===d||e[l-1].y===d)if(t[0].y===d||t[h-1].y===d){if(e[0].y===d&&t[0].y===d&&e[0].x===t[0].x)return{x:e[0].x,y:d,ta:0,tb:0};if(e[0].y===d&&t[h-1].y===d&&e[0].x===t[h-1].x)return{x:e[0].x,y:d,ta:0,tb:1};if(e[l-1].y===d&&t[h-1].y===d&&e[l-1].x===t[h-1].x)return{x:e[l-1].x,y:d,ta:1,tb:1};if(e[l-1].y===d&&t[0].y===d&&e[l-1].x===t[0].x)return{x:e[l-1].x,y:d,ta:1,tb:0}}else{var f=Ht(t[0].x,t[0].y,t[1].x,t[1].y,t[2].x,t[2].y,null===(a=t[3])||void 0===a?void 0:a.x,null===(n=t[3])||void 0===n?void 0:n.y).filter(function(e){return e>0&&e<1}),m=Ft(t,f[0]);if(e[0].y===d&&e[0].x===m.x)return{x:m.x,y:d,ta:0,tb:f[0]};if(e[l-1].y===d&&e[l-1].x===m.x)return{x:m.x,y:d,ta:1,tb:f[0]}}else{var p=Ht(e[0].x,e[0].y,e[1].x,e[1].y,e[2].x,e[2].y,null===(o=e[3])||void 0===o?void 0:o.x,null===(s=e[3])||void 0===s?void 0:s.y).filter(function(e){return e>0&&e<1}),g=Ft(e,p[0]);if(t[0].y===d||t[h-1].y===d){if(t[0].y===d&&t[0].x===g.x)return{x:g.x,y:d,ta:p[0],tb:0};if(t[h-1].y===d&&t[h-1].x===g.x)return{x:g.x,y:d,ta:p[0],tb:1}}else{var v=Ht(t[0].x,t[0].y,t[1].x,t[1].y,t[2].x,t[2].y,null===(c=t[3])||void 0===c?void 0:c.x,null===(u=t[3])||void 0===u?void 0:u.y).filter(function(e){return e>0&&e<1}),y=Ft(t,v[0]);if(g.x===y.x)return{x:g.x,y:d,ta:p[0],tb:v[0]}}}}(t,i,T,_);if(C){A=v+C.ta*(y-v),E=b+C.tb*(x-b);n.push({x:C.x,y:C.y,t1:A,t2:E})}}return"continue"}if(2===p){if(t[0].x===t[1].x)return Qt(i,t[0].x,!0).forEach(function(e){if(!(e<0||e>1)){var r=Ft(i,e),a=(r.y-t[0].y)/(t[1].y-t[0].y);a>=0&&a<=1&&n.push({x:r.x,y:r.y,t1:a,t2:e})}}),"continue";if(t[0].y===t[1].y)return Qt(i,t[0].y,!1).forEach(function(e){if(!(e<0||e>1)){var r=Ft(i,e),a=(r.x-t[0].x)/(t[1].x-t[0].x);a>=0&&a<=1&&n.push({x:r.x,y:r.y,t1:a,t2:e})}}),"continue"}else if(2===g){if(i[0].x===i[1].x)return Qt(t,i[0].x,!0).forEach(function(e){if(!(e<0||e>1)){var r=Ft(t,e),a=(r.y-i[0].y)/(i[1].y-i[0].y);a>=0&&a<=1&&n.push({x:r.x,y:r.y,t1:e,t2:a})}}),"continue";if(i[0].y===i[1].y)return Qt(t,i[0].y,!1).forEach(function(e){if(!(e<0||e>1)){var r=Ft(t,e),a=(r.x-i[0].x)/(i[1].x-i[0].x);a>=0&&a<=1&&n.push({x:r.x,y:r.y,t1:e,t2:a})}}),"continue"}}if(function(e,t,r,i,a){if(e[0]>t[2]||e[1]>t[3]||t[0]>e[2]||t[1]>e[3])return!1;if((e[2]===t[0]||e[0]===t[2])&&(t[3]<e[1]||e[1]>t[3]))return!1;if((e[3]===t[1]||e[1]===t[3])&&(t[2]<e[0]||e[0]>t[2]))return!1;var n=r.length,o=i.length;if(a){if(n===o){for(var s=r[0].x-i[0].x,c=r[0].y-i[0].y,u=!0,l=!0,h=0;h<n&&(r[h].x-i[h].x!==s&&(u=!1),r[h].y-i[h].y!==c&&(l=!1),u||l);h++);if(u&&l)return!1;if(u){for(var d=r[0].y-i[0].y,f=jt(r.map(function(e,t){return{x:e.x-i[t].x,y:e.y-i[t].y}}),!1)||[],m=(h=0,f.length);h<m;h++){var p=Ft(r,f[h]),g=Ft(i,f[h]);if(d>0&&p.y-g.y<=0||d<0&&p.y-g.y>=0)return!0}return!1}if(l){for(d=r[0].x-i[0].x,f=jt(r.map(function(e,t){return{x:e.x-i[t].x,y:e.y-i[t].y}}),!0)||[],h=0,m=f.length;h<m;h++){p=Ft(r,f[h]),g=Ft(i,f[h]);if(d>0&&p.x-g.x<=0||d<0&&p.x-g.x>=0)return!0}return!1}}}else{if(e[1]===t[3]||e[3]===t[1]){var v=e[1]===t[3]?e[1]:e[3];return 2===n?e[1]===e[3]||(i[1].y===v||i[o-2].y===v):2===o?t[1]===t[3]||(r[1].y===v||r[n-2].y===v):r[1].y===v||r[n-2].y===v||i[1].y===v||i[o-2].y===v}if(e[0]===t[2]||e[2]===t[0]){var y=e[0]===t[2]?e[0]:e[2];return 2===n?e[0]===e[2]||(i[1].x===y||i[o-2].y===y):2===o?t[0]===t[2]||(r[1].x===y||r[n-2].x===y):r[1].x===y||r[n-2].x===y||i[1].x===y||i[o-2].x===y}}return!0}(T,w,t,i,a)){if(p===g){for(var M=!0,I=0;I<p;I++)if(Math.abs(t[I].x-i[I].x)>.1*r||Math.abs(t[I].y-i[I].y)>.1*r){M=!1;break}if(M)return n.push({x:.5*(t[0].x+i[0].x),y:.5*(t[0].y+i[0].y),t1:v,t2:b}),n.push({x:.5*(t[p-1].x+i[g-1].x),y:.5*(t[p-1].y+i[g-1].y),t1:y,t2:x}),"continue"}var R=T[2]-T[0]||Number.EPSILON,P=T[3]-T[1]||Number.EPSILON,O=w[2]-w[0]||Number.EPSILON,D=w[3]-w[1]||Number.EPSILON;if(R<=r&&P<=r&&O<=r&&D<=r){A=.5*(v+y),E=.5*(b+x);if(0===v)((B=t[0]).x===i[0].x&&B.y===i[0].y||B.x===i[g-1].x&&B.y===i[g-1].y)&&(A=0);else if(1===y){((B=t[p-1]).x===i[0].x&&B.y===i[0].y||B.x===i[g-1].x&&B.y===i[g-1].y)&&(A=1)}if(0===b)((B=i[0]).x===t[0].x&&B.y===t[0].y||B.x===t[p-1].x&&B.y===t[p-1].y)&&(E=0);else if(1===x){var B;((B=i[g-1]).x===t[0].x&&B.y===t[0].y||B.x===t[p-1].x&&B.y===t[p-1].y)&&(E=1)}var F=Ft(t,A),L=Ft(i,E);n.push({x:.5*(F.x+L.x),y:.5*(F.y+L.y),t1:A,t2:E})}else if((R>r||P>r)&&(O>r||D>r)){var N=Bt(t,0,.5),U=Bt(t,.5,1),z=Bt(i,0,.5),W=Bt(i,.5,1);m.push({a:N,b:z,t1:v,t2:v+.5*(y-v),t3:b,t4:b+.5*(x-b)}),m.push({a:N,b:W,t1:v,t2:v+.5*(y-v),t3:b+.5*(x-b),t4:x}),m.push({a:U,b:z,t1:v+.5*(y-v),t2:y,t3:b,t4:b+.5*(x-b)}),m.push({a:U,b:W,t1:v+.5*(y-v),t2:y,t3:b+.5*(x-b),t4:x})}else if(R>r||P>r){N=Bt(t,0,.5),U=Bt(t,.5,1);m.push({a:N,b:i,t1:v,t2:v+.5*(y-v),t3:b,t4:x}),m.push({a:U,b:i,t1:v+.5*(y-v),t2:y,t3:b,t4:x})}else if(O>r||D>r){z=Bt(i,0,.5),W=Bt(i,.5,1);m.push({a:t,b:z,t1:v,t2:y,t3:b,t4:b+.5*(x-b)}),m.push({a:t,b:W,t1:v,t2:y,t3:b+.5*(x-b),t4:x})}}};m.length;)y();n.sort(function(e,t){return e.t1===t.t1?e.t2-t.t2:e.t1-t.t1});for(var b=n.length-1;b>0;b--){var x=n[b],T=n[b-1];if(Math.abs(x.x-T.x)<=i&&Math.abs(x.y-T.y)<=i)if(1===b)0===x.t1||1===x.t1||0===x.t2||1===x.t2?n.shift():n.splice(1,1);else for(var w=b-1;w>0;w--){var k=n[w],S=n[w-1],E=Math.abs(k.x-S.x)>i&&Math.abs(k.y-S.y)>i;if(E||1===w){var C=E?w:w-1,A=n[C];if(Math.abs(x.x-A.x)<=i&&Math.abs(x.y-A.y)<=i)if(0===x.t1||1===x.t1||0===x.t2||1===x.t2)n.splice(C,b-C);else if(0===A.t1||1===A.t1||0===A.t2||1===A.t2)n.splice(C+1,b-C);else{var _=n[C+b>>1];n.splice(C,b-C+1,_)}else n.splice(C+1,b-C-1);b=C;break}}}return n}function or(e,t,r,i){var a,n,o,s;void 0===i&&(i=!0);var c=t.length,u=i?r[3]:r[1];if(r[1]===r[3])if(t[0].y===u||t[c-1].y===u){if((l=((d=t[0].y===u?t[0].x:t[c-1].x)-r[0])/(r[2]-r[0]))>=0&&l<=1)return{x:d,y:u,tl:l,tb:t[0].y===u?0:1}}else{var l,h=Ht(t[0].x,t[0].y,t[1].x,t[1].y,t[2].x,t[2].y,null===(a=t[3])||void 0===a?void 0:a.x,null===(n=t[3])||void 0===n?void 0:n.y).filter(function(e){return e>0&&e<1});if((l=((f=Ft(t,h[0])).x-r[0])/(r[2]-r[0]))>=0&&l<=1)return{x:f.x,y:u,tl:l,tb:h[0]}}else if(t[0].y===u||t[c-1].y===u){var d=t[0].y===u?t[0].x:t[c-1].x;if(e[0].x===d&&e[0].y===u||e[1].x===d&&e[1].y===u)return{x:d,y:u,tl:e[0].y===u?0:1,tb:t[0].y===u?0:1}}else{var f;h=Ht(t[0].x,t[0].y,t[1].x,t[1].y,t[2].x,t[2].y,null===(o=t[3])||void 0===o?void 0:o.x,null===(s=t[3])||void 0===s?void 0:s.y).filter(function(e){return e>0&&e<1});if((f=Ft(t,h[0])).x===e[0].x&&e[0].y===u||f.x===e[1].x&&e[1].y===u)return{x:f.x,y:u,tl:f.x===e[0].x?0:1,tb:h[0]}}}function sr(e,t,r,i){var a,n,o,s;void 0===i&&(i=!0);var c=t.length,u=i?r[2]:r[0];if(r[0]===r[2])if(t[0].x===u||t[c-1].x===u){if((l=((d=t[0].x===u?t[0].y:t[c-1].y)-r[1])/(r[3]-r[1]))>=0&&l<=1)return{x:u,y:d,tl:l,tb:t[0].x===u?0:1}}else{var l,h=Ht(t[0].x,t[0].y,t[1].x,t[1].y,t[2].x,t[2].y,null===(a=t[3])||void 0===a?void 0:a.x,null===(n=t[3])||void 0===n?void 0:n.y).filter(function(e){return e>0&&e<1});if((l=((f=Ft(t,h[0])).y-r[1])/(r[3]-r[1]))>=0&&l<=1)return{x:u,y:f.y,tl:(f.y-r[1])/(r[3]-r[1]),tb:h[0]}}else if(t[0].x===u||t[c-1].x===u){var d=t[0].x===u?t[0].x:t[c-1].x;if(e[0].x===u&&e[0].y===d||e[1].x===u&&e[1].y===d)return{x:u,y:d,tl:e[0].x===u?0:1,tb:t[0].x===u?0:1}}else{var f;h=Ht(t[0].x,t[0].y,t[1].x,t[1].y,t[2].x,t[2].y,null===(o=t[3])||void 0===o?void 0:o.x,null===(s=t[3])||void 0===s?void 0:s.y).filter(function(e){return e>0&&e<1});if((f=Ft(t,h[0])).y===e[0].y&&e[0].x===u||f.y===e[1].y&&e[1].x===u)return{x:u,y:f.y,tl:f.y===e[0].y?0:1,tb:h[0]}}}function cr(e,t,r,i,a,n,o,s,c,u){void 0===c&&(c=!0),void 0===u&&(u=0);var l=(s-n)*(r-e)-(o-a)*(i-t);if(0!==l){var h=((o-a)*(t-n)-(s-n)*(e-a))/l,d=((r-e)*(t-n)-(i-t)*(e-a))/l,f=1-u;if(c&&(h<u||h>f||d<u||d>f))return;return{x:e+h*(r-e),y:t+h*(i-t),toSource:h,toClip:d}}}function ur(e,t){return{x:e.x-t.x,y:e.y-t.y,z:e.z-t.z}}function lr(e,t){return{x:e.x+t.x,y:e.y+t.y,z:e.z+t.z}}function hr(e,t,r){var i=ur(e,t),a=ur(r,t),n=tr(a.x,a.y,a.z,a.x,a.y,a.z);return tr(a.x,a.y,a.z,i.x,i.y,i.z)/n}var dr={intersectLineLine:cr,intersectBezier2Line:function(e,t,r,i,a,n,o,s,c,u,l,h,d){void 0===l&&(l=.1),void 0===h&&(h=.5),void 0===d&&(d=!1);var f=[];return nr([{x:e,y:t},{x:r,y:i},{x:a,y:n}],[{x:o,y:s},{x:c,y:u}],l,h,d,f),f},intersectBezier3Line:function(e,t,r,i,a,n,o,s,c,u,l,h,d,f,m){void 0===d&&(d=.1),void 0===f&&(f=.5),void 0===m&&(m=!1);var p=[];return nr([{x:e,y:t},{x:r,y:i},{x:a,y:n},{x:o,y:s}],[{x:c,y:u},{x:l,y:h}],d,f,m,p),p},intersectBezier2Bezier2:function(e,t,r,i,a,n,o,s,c,u,l,h,d,f,m){void 0===d&&(d=.1),void 0===f&&(f=.5),void 0===m&&(m=!1);var p=[];return nr([{x:e,y:t},{x:r,y:i},{x:a,y:n}],[{x:o,y:s},{x:c,y:u},{x:l,y:h}],d,f,m,p),p},intersectBezier3Bezier3:function(e,t,r,i,a,n,o,s,c,u,l,h,d,f,m,p,g,v,y){void 0===g&&(g=.1),void 0===v&&(v=.5),void 0===y&&(y=!1);var b=[];return nr([{x:e,y:t},{x:r,y:i},{x:a,y:n},{x:o,y:s}],[{x:c,y:u},{x:l,y:h},{x:d,y:f},{x:m,y:p}],g,v,y,b),b},intersectBezier2Bezier3:function(e,t,r,i,a,n,o,s,c,u,l,h,d,f,m,p,g){void 0===m&&(m=.1),void 0===p&&(p=.5),void 0===g&&(g=!1);var v=[];return nr([{x:e,y:t},{x:r,y:i},{x:a,y:n}],[{x:o,y:s},{x:c,y:u},{x:l,y:h},{x:d,y:f}],m,p,g,v),v},intersectLineLine3:function(e,t,r,i,a,n){void 0===a&&(a=0),void 0===n&&(n=1e-9);var o=ur(e,r),s=ur(i,r),c=ur(t,e),u=o.x*s.x+o.y*s.y+o.z*s.z,l=s.x*c.x+s.y*c.y+s.z*c.z,h=o.x*c.x+o.y*c.y+o.z*c.z,d=s.x*s.x+s.y*s.y+s.z*s.z,f=(c.x*c.x+c.y*c.y+c.z*c.z)*d-l*l;if(!(Math.abs(f)<n)){var m,p,g=(u*l-h*d)/f,v=(u+l*g)/d,y={x:e.x+g*c.x,y:e.y+g*c.y,z:e.z+g*c.z},b={x:r.x+v*s.x,y:r.y+v*s.y,z:r.z+v*s.z};if(!((m=y,p=b,Math.sqrt(Math.pow(m.x-p.x,2)+Math.pow(m.y-p.y,2)+Math.pow(m.z-p.z,2)))>n)){var x=function(e,t){var r=1/t;return{x:e.x*r,y:e.y*r,z:e.z*r}}(lr(y,b),2);if(!a)return x;var T=hr(x,e,t),w=hr(x,r,i);return T<0&&Math.abs(T)<1e-9?T=0:T>1&&T-1<1e-9&&(T=1),w<0&&Math.abs(w)<1e-9?w=0:w>1&&w-1<1e-9&&(w=1),x.pa=T,x.pb=w,1===a&&T>=0&&T<=1||2===a&&w>=0&&w<=1||3===a&&T>=0&&T<=1&&w>=0&&w<=1?x:void 0}}},intersectPlanePlane:function(e,t,r,i,a,n){var o=Jt(t.x-e.x,t.y-e.y,t.z-e.z),s=Jt(r.x-e.x,r.y-e.y,r.z-e.z),c=Jt(a.x-i.x,a.y-i.y,a.z-i.z),u=Jt(n.x-i.x,n.y-i.y,n.z-i.z),l=er(o.x,o.y,o.z,s.x,s.y,s.z),h=Jt(l.x,l.y,l.z),d=er(c.x,c.y,c.z,u.x,u.y,u.z),f=Jt(d.x,d.y,d.z);if(rr(h.x,h.y,h.z,f.x,f.y,f.z))return null;var m=er(f.x,f.y,f.z,h.x,h.y,h.z),p=lr(o,c),g=Jt(m.x,m.y,m.z),v=h.x,y=h.y,b=h.z,x=-v*e.x-y*e.y-b*e.z,T=f.x,w=f.y,k=f.z,S=-T*i.x-w*i.y-k*i.z,E=g.x,C=g.y,A=g.z,_=[-x,-S,-(-E*p.x-C*p.y-A*p.z)],M=v*(w*A-k*C)-y*(T*A-k*E)+b*(T*C-w*E);if(Math.abs(M)<1e-9)return null;var I=1/M,R={x:I*(w*A-k*C)*_[0]+I*(b*C-y*A)*_[1]+I*(y*k-b*w)*_[2],y:I*(k*E-T*A)*_[0]+I*(v*A-b*E)*_[1]+I*(b*T-v*k)*_[2],z:I*(T*C-w*E)*_[0]+I*(y*E-v*C)*_[1]+I*(v*w-y*T)*_[2]};return[R,lr(R,g)]},pointOnLine3:function(e,t,r,i){void 0===i&&(i=1e-9);var a=t.x-e.x,n=t.y-e.y,o=t.z-e.z,s=r.x-e.x,c=r.y-e.y,u=r.z-e.z,l=er(a,n,o,s,c,u);return ir(l.x,l.y,l.z)<i}};function fr(e){return e*Math.PI/180}function mr(e){return 180*e/Math.PI}function pr(e,t,r,i){void 0===i&&(i=!1);for(var a,n=r[0],o=n.x,s=n.y,c=r[0],u=c.x,l=c.y,h=r.length,d=1;d<h;d++){var f=r[d],m=f.x,p=f.y;o=Math.max(o,m),s=Math.max(s,p),u=Math.min(u,m),l=Math.min(l,p)}if(e<u||t<l||e>o||t>s)return!1;if((e<=u||t<=l||e>=o||t>=s)&&!i)return!1;d=0;for(var g=r.length;d<g;d++){var v=r[d],y=v.x,b=v.y,x=r[(d+1)%g],T=x.x,w=x.y,k=qe(T-y,w-b,e-y,t-b);if(0!==k){if(k=k>0?1:0,void 0===a)a=k;else if(a^k)return!1}else if(i){if(e===y&&t===b||e===T&&t===w)return!0;var S=e-y,E=T-e,C=t-b,A=w-t;if(0===S||0===E){if(C^A)return!0}else if(0===C||0===A){if(S^E)return!0}else if(S^E&&C^A)return!0}}return!0}function gr(e,t,r,i,a,n,o,s){var c,u;if(void 0===s&&(s=!1),r>=a&&(r=(c=[a,r])[0],a=c[1]),i>=n&&(i=(u=[n,i])[0],n=u[1]),o&&!nt(o)){var l=bt({x:r,y:i},o),h=bt({x:a,y:i},o),d=bt({x:a,y:n},o),f=bt({x:r,y:n},o);return pr(e,t,[{x:l.x,y:l.y},{x:h.x,y:h.y},{x:d.x,y:d.y},{x:f.x,y:f.y}])}return s?e>=r&&t>=i&&e<=a&&t<=n:e>r&&t>i&&e<a&&t<n}function vr(e,t,r,i){return Math.sqrt(Math.pow(r-e,2)+Math.pow(i-t,2))}function yr(e,t,r){var i=(Math.pow(t,2)+Math.pow(r,2)-Math.pow(e,2))/(2*t*r);return Math.acos(i)||0}var br=4*(Math.sqrt(2)-1)/3;function xr(e,t,r,i,a,n,o,s,c){if(void 0===c&&(c=!1),c){if(e>o||t>s||a>r||n>i)return!1;if((r===a||e===o)&&(i<n||t>s))return!1;if((i===t||t===i)&&(r<a||e>o))return!1}else if(e>=o||t>=s||a>=r||n>=i)return!1;return!0}function Tr(e,t,r,i,a,n){var o,s;void 0===n&&(n=!1),e>r&&(e=(o=[r,e])[0],r=o[1]),t>i&&(t=(s=[i,t])[0],i=s[1]);for(var c=0,u=0,l=0,h=0,d=0,f=a.length;d<f;d++){var m=a[d],p=m.x,g=m.y;if(d?(c=Math.min(c,p),u=Math.min(u,g),l=Math.max(l,p),h=Math.max(h,g)):(c=p,u=g,l=p,h=g),n){if(p>=e&&p<=r&&g>=t&&g<=i)return!0}else if(p>e&&p<r&&g>t&&g<i)return!0;var v=a[(d+1)%f],y=v.x,b=v.y,x=cr(e,t,r,t,p,g,y,b);if(x){if(x.toSource>0&&x.toSource<1&&x.toClip>0&&x.toClip<1)return!0;if(n&&x.toSource>=0&&x.toSource<=1&&x.toClip>=0&&x.toClip<=1)return!0}if(x=cr(e,t,e,i,p,g,y,b)){if(x.toSource>0&&x.toSource<1&&x.toClip>0&&x.toClip<1)return!0;if(n&&x.toSource>=0&&x.toSource<=1&&x.toClip>=0&&x.toClip<=1)return!0}if(x=cr(r,t,r,i,p,g,y,b)){if(x.toSource>0&&x.toSource<1&&x.toClip>0&&x.toClip<1)return!0;if(n&&x.toSource>=0&&x.toSource<=1&&x.toClip>=0&&x.toClip<=1)return!0}if(x=cr(e,i,r,i,p,g,y,b)){if(x.toSource>0&&x.toSource<1&&x.toClip>0&&x.toClip<1)return!0;if(n&&x.toSource>=0&&x.toSource<=1&&x.toClip>=0&&x.toClip<=1)return!0}}return c<=e&&u<=t&&l>=r&&h>=i}var wr={d2r:fr,r2d:mr,H:br,h:function(e){return e*=.5,(1-Math.cos(e))/Math.sin(e)*4/3},pointInConvexPolygon:pr,pointInRect:gr,pointsDistance:vr,angleBySides:yr,isRectsOverlap:xr,isRectsInside:function(e,t,r,i,a,n,o,s,c){if(void 0===c&&(c=!1),c){if(e<=a&&t<=n&&r>=o&&i>=s)return!0}else if(e<a&&t<n&&r>o&&i>s)return!0;return!1},isConvexPolygonsOverlap:function(e,t,r){void 0===r&&(r=!1);for(var i=0,a=0,n=0,o=0,s=0,c=e.length;s<c;s++){var u=e[s],l=u.x,h=u.y;s?(i=Math.min(i,l),a=Math.min(a,h),n=Math.max(n,l),o=Math.max(o,h)):(i=l,a=h,n=l,o=h)}var d=0,f=0,m=0,p=0;for(s=0,c=t.length;s<c;s++){var g=t[s];l=g.x,h=g.y;s?(d=Math.min(d,l),f=Math.min(f,h),m=Math.max(m,l),p=Math.max(p,h)):(d=l,f=h,m=l,p=h)}if(r){if(i>m||a>p||n<d||o<f)return!1}else if(i>=m||a>=p||n<=d||o<=f)return!1;for(s=0,c=e.length;s<c;s++)if(pr(e[s].x,e[s].y,t,r))return!0;for(s=0,c=t.length;s<c;s++)if(pr(t[s].x,t[s].y,e,r))return!0;for(s=0,c=e.length;s<c;s++)for(var v=[e[s].x,e[s].y,e[(s+1)%c].x,e[(s+1)%c].y],y=0,b=t.length;y<b;y++){var x=[t[y].x,t[y].y,t[(y+1)%b].x,t[(y+1)%b].y],T=cr(v[0],v[1],v[2],v[3],x[0],x[1],x[2],x[3]);if(T){if(r)return!0;if(T.toSource||T.toClip)return!0}}return!1},isConvexPolygonOverlapRect:Tr,isConvexPolygonInAnother:function(e,t,r){void 0===r&&(r=!1);for(var i=0,a=e.length;i<a;i++)if(!pr(e[i].x,e[i].y,t,r))return!1;return!0}};function kr(e,t){return Sr(e,fr(t))}function Sr(e,t){var r=Math.sin(t),i=Math.cos(t);return e[5]=e[10]=i,e[6]=r,e[9]=-r,e}function Er(e,t){return function(e,t){var r=Math.sin(t),i=Math.cos(t);return e[0]=e[10]=i,e[8]=r,e[2]=-r,e}(e,fr(t))}function Cr(e,t){return Ar(e,fr(t))}function Ar(e,t){var r=Math.sin(t),i=Math.cos(t);return e[0]=e[5]=i,e[1]=r,e[4]=-r,e}function _r(e,t,r){var i=e.slice(0);return 0===t&&0===r||nt(e)?i:i=lt(i=ht(t,r,i),-t,-r)}function Mr(e,t,r){var i=at();return e>=1&&(i[11]=-1/e,(t||r)&&(i=lt(i=ht(t,r,i),-t,-r))),i}function Ir(e,t){t||(t=at());var r=e.translateX,i=e.translateY,a=e.translateZ,n=e.rotateX,o=e.rotateY,s=e.rotateZ,c=e.scaleX,u=e.scaleY,l=e.skewX,h=e.skewY;return t[12]=r||0,t[13]=i||0,t[14]=a||0,n&&(nt(t)?kr(t,n):mt(t,fr(n))),o&&(nt(t)?Er(t,o):pt(t,fr(o))),s&&(nt(t)?Cr(t,s):gt(t,fr(s))),l&&(nt(t)?t[4]=Math.tan(fr(l)):dt(t,fr(l))),h&&(nt(t)?t[1]=Math.tan(fr(h)):ft(t,fr(h))),void 0!==c&&1!==c&&(nt(t)?t[0]=c:vt(t,c)),void 0!==u&&1!==u&&(nt(t)?t[5]=u:yt(t,u)),t}var Rr={calRotateX:kr,calRotateXRadian:Sr,calRotateZ:Cr,calRotateZRadian:Ar,calMatrixByOrigin:_r,calTransform:Ir,calTransformByMatrixAndOrigin:function(e,t,r){var i=e.slice(0);return i=ht(-t,-r,i=lt(i,t,r))},calPerspectiveMatrix:Mr};function Pr(e){if(e<=0)return 0;var t=Math.floor(3*e*Math.sqrt(2*Math.PI)/4+.5);return t<2&&(t=2),t%2==0&&t++,t}function Or(e){return Dr(Pr(e))}function Dr(e){return 3*Math.floor(.5*e)}function Br(e,t){void 0===t&&(t=3);var r=Math.sqrt(12*e*e/t+1),i=Math.floor(r);i%2==0&&i--;for(var a=i+2,n=(12*e*e-t*i*i-4*t*i-3*t)/(-4*i-4),o=Math.round(n),s=[],c=0;c<t;c++)s.push(c<o?i:a);return s}function Fr(e){var t,r=Math.abs(e);if(r>=1.5)return 0;if(r<.5)t=.75-e*e;else{var i=1.5-r;t=.5*i*i}return t*(4/3)}var Lr={gaussKernel:Pr,gaussSize:Or,gaussSizeByD:Dr,gaussianWeight:function(e,t){if(e<=0||t<=0)return[1];for(var r=[],i=Math.floor(.5*t),a=0,n=i;n>=0;n--){var o=Math.pow(Math.E,-Math.pow(n,2)/(2*Math.pow(e,2)))/(e*Math.sqrt(2*Math.PI));r.push(o),a+=o}for(n=1;n<=i;n++){o=r[i-n];r.push(o),a+=o}if(1!==a)for(n=0;n<t;n++)r[n]/=a;return r},boxesForGauss:Br,dualKawase:function(e){var t=Math.max(1,Math.round(4/3*Math.log(e)));return{passes:t,distance:Math.pow(.4538,t)*e}},n2Kernel:Fr,n2Size:function(e){return e<1?0:(e%2==0&&e++,2*(e>>1)+1)},n2Weight:function(e){if(e<1)return[];e%2==0&&e++;for(var t=e>>1,r=t/1.5,i=[],a=0,n=-t;n<=t;n++){var o=Fr(Math.abs(n)/r);i.push(o),a+=o}return i.map(function(e){return e/a})}};function Nr(e,t){void 0===t&&(t=2);var r=Math.pow(10,t);return Math.round(e*r)/r}var Ur={geom:wr,matrix:wt,vector:it,isec:dr,bezier:Zt,toPrecision:Nr,blur:Lr};function zr(e,t,r){void 0===r&&(r=!1);for(var i=[],a=e[0].color,n=0,o=e.length;n<o;n++)i.push(e[n]);(1===i.length&&i.push(C(i[0])),void 0===i[0].offset&&(i[0].offset=0),i.length>1)&&(void 0===i[n=i.length-1].offset&&(i[n].offset=1));var s=i[0].offset;for(n=1,o=i.length;n<o-1;n++){if(void 0!==(b=i[n]).offset)s=b.offset;else{for(var c=n+1,u=i[i.length-1].offset;c<o-1;c++){var l=i[c];if(void 0!==l.offset){u=l.offset;break}}for(var h=(u-s)/(c-n+1),d=n;d<c;d++){i[d].offset=s+h*(d+1-n)}n=c}}i.sort(function(e,t){return e.offset-t.offset});for(n=0,o=i.length;n<o;n++){if((b=i[n]).offset>1){i.splice(n);var f=i[n-1];if(f&&f.offset<1){var m=b.color[0]-f.color[0],p=b.color[1]-f.color[1],g=b.color[2]-f.color[2],v=b.color[3]-f.color[3],y=(1-f.offset)/(b.offset-f.offset);i.push({color:[b.color[0]+m*y,b.color[1]+p*y,b.color[2]+g*y,b.color[3]+v*y],offset:1})}break}}for(n=i.length-1;n>=0;n--){var b;if((b=i[n]).offset<0){i.splice(0,n+1);var x=i[n];if(x&&x.offset>0){m=x.color[0]-b.color[0],p=x.color[1]-b.color[1],g=x.color[2]-b.color[2],v=x.color[3]-b.color[3],y=-b.offset/(x.offset-b.offset);i.unshift({color:[b.color[0]+m*y,b.color[1]+p*y,b.color[2]+g*y,b.color[3]+v*y],offset:0})}break}}if(i.forEach(function(e){e.offset<0?e.offset=0:e.offset>1&&(e.offset=1)}),i.length||i.push({color:a,offset:0},{color:a,offset:1}),r){var T=i[0],w=i[i.length-1];if(T.offset>0||w.offset<1){m=w.color[0]-T.color[0],p=w.color[1]-T.color[1],g=w.color[2]-T.color[2],v=w.color[3]-T.color[3];var k=T.offset+(1-w.offset);if(T.offset>0){y=T.offset/k;i.unshift({color:[T.color[0]+m*y,T.color[1]+p*y,T.color[2]+g*y,T.color[3]+v*y],offset:0})}if(w.offset<1){y=(1-w.offset)/k;i.push({color:[w.color[0]-m*y,w.color[1]-p*y,w.color[2]-g*y,w.color[3]-v*y],offset:1})}}}return i}function Wr(e){if(he.gradient.test(e)){var t=he.gradient.exec(e);if(t&&["linear","radial","conic"].indexOf(t[1].toLowerCase())>-1)return!0}return!1}function Vr(e){var t=he.gradient.exec(e);if(t){var r={linear:Y.LINEAR,radial:Y.RADIAL,conic:Y.CONIC}[t[1].toLowerCase()],i=void 0;if(r===Y.LINEAR)if(n=/([-+]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e[-+]?\d+)?)\s+([-+]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e[-+]?\d+)?)\s+([-+]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e[-+]?\d+)?)\s+([-+]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e[-+]?\d+)?)/.exec(t[2]))i=[parseFloat(n[1]),parseFloat(n[2]),parseFloat(n[3]),parseFloat(n[4])];else{var a=/([-+]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e[-+]?\d+)?)/.exec(t[2]);i=a?[fr(parseFloat(a[1]))]:[]}else if(r===Y.RADIAL){var n;i=(n=/([-+]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e[-+]?\d+)?)\s+([-+]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e[-+]?\d+)?)\s+([-+]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e[-+]?\d+)?)\s+([-+]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e[-+]?\d+)?)(\s+([-+]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e[-+]?\d+)?))?/.exec(t[2]))?[parseFloat(n[1]),parseFloat(n[2]),parseFloat(n[3]),parseFloat(n[4]),parseFloat(n[5])||0]:[.5,.5,1,1]}else r===Y.CONIC&&(i=[]);var o=t[2].match(/(([-+]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e[-+]?\d+)?[pxremvwhina%]*)?\s*((#[0-9a-f]{3,8})|(rgba?\s*\(.+?\)))\s*([-+]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e[-+]?\d+)?[pxremvwhina%]*)?)|(transparent)/gi)||[],s=o.map(function(e,t){var r,i=/(?:#[0-9a-f]{3,8})|(?:rgba?\s*\(.+?\))|(?:transparent)/i.exec(e),a=/[-+]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e[-+]?\d+)?(?:(?:px)|%)?/.exec(e.replace(i[0],""));if(a){var n=se(a[0]);n.u!==V.PERCENT&&(n.v*=100,n.u=V.PERCENT),r=n}else t?t===o.length-1&&(r={v:100,u:V.PERCENT}):r={v:0,u:V.PERCENT};return{color:{v:i?de(i[0]):[0,0,0,1],u:V.RGBA},offset:r}});s.sort(function(e,t){return e.offset&&t.offset?e.offset.v-t.offset.v:0});for(var c=s.length-2;c>0;c--){if(!s[c].offset){for(var u=s[c+1].offset.v,l=s[0].offset.v,h=c,d=c-1;d>=0;d--){if(0===d){c=d;break}if(s[d].offset){c=d,l=s[d].offset.v;break}}for(var f=(u-l)/(h-c+1),m=c+1;m<=h;m++)s[c].offset={v:l+(m-c)*f,u:V.PERCENT}}}return{t:r,d:i,stops:s}}}function Hr(e,t,r,i,a,n){var o,s,c,u,l;if(t.length<=1){var h=function(e,t,r,i,a){var n,o,s,c;if(e%(2*Math.PI)==0)n=s=.5*i,o=0,c=a;else if(e%Math.PI===0)n=s=.5*i,o=a,c=0;else if(e%(.5*Math.PI)==0)n=0,s=i,o=c=.5*a;else if(e%(1.5*Math.PI)==0)n=i,s=0,o=c=.5*a;else{var u=.5*i,l=.5*a,h=Math.min(u,l),d=Math.sin(e%360),f=Math.cos(e%360);n=u-h*d,o=l-h*f,s=u+h*d,c=l+h*f}return{x1:n+=t,y1:o+=r,x2:s+=t,y2:c+=r}}(null!==(o=t[0])&&void 0!==o?o:Math.PI,r,i,a,n);s=h.x1,c=h.y1,u=h.x2,l=h.y2}else s=r+t[0]*a,c=i+t[1]*n,u=r+t[2]*a,l=i+t[3]*n;var d=Math.sqrt(Math.pow(u-s,2)+Math.pow(l-c,2));return{x1:s,y1:c,x2:u,y2:l,total:d,stop:zr(e,0,!1)}}function Xr(e,t,r,i,a,n){var o,s=r+t[0]*a,c=i+t[1]*n,u=r+t[2]*a,l=i+t[3]*n,h=t[4],d=Math.sqrt(Math.pow(u-s,2)+Math.pow(l-c,2)),f=zr(e,0,!1);if(h&&1!==h){if(o=at(),l!==c)if(u===s)gt(o,fr(l>=c?90:270));else gt(o,Math.atan((l-c)/(u-s)));yt(o,h),o=_r(o,s,c)}return{cx:s,cy:c,tx:u,ty:l,ellipseLength:h,matrix:o,total:d,stop:f}}function jr(e,t,r,i,a,n){var o=Math.floor(r+.5*a),s=Math.floor(i+.5*n),c=Math.floor(r+.5*a)-o,u=Math.floor(i+.5*n)-s,l=0;l=0===c?u>=0?0:Math.PI:Math.atan(u/c);Math.sqrt(Math.pow(c,2)+Math.pow(u,2));return{angle:l,cx:o,cy:s,stop:zr(e,0,!0)}}function Gr(e){var t={};if(["left","top","right","bottom","width","height","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"].forEach(function(r){var i=e[r];if(void 0!==i){var a=se(i||0,!0);"width"!==r&&"height"!==r||a.v<0&&(a.v=0),t[r]=a}}),void 0!==e.lineHeight){var r,i=e.lineHeight;if(S(i)||"normal"===i)t.lineHeight={v:0,u:V.AUTO};else(r=se(i||0,!0)).v<=0&&(r={v:0,u:V.AUTO}),t.lineHeight=r}(void 0!==e.fontFamily&&(t.fontFamily={v:e.fontFamily.trim().replace(/['"]/g,"").replace(/\s*,\s*/g,","),u:V.STRING}),void 0!==e.fontSize)&&((r=se(e.fontSize||L.defaultFontSize,!0)).v<=0&&(r.v=L.defaultFontSize),t.fontSize=r);if(void 0!==e.fontWeight){var a=e.fontWeight;g(a)?/thin/i.test(a)?t.fontWeight={v:100,u:V.NUMBER}:/lighter/i.test(a)?t.fontWeight={v:200,u:V.NUMBER}:/light/i.test(a)?t.fontWeight={v:300,u:V.NUMBER}:/medium/i.test(a)?t.fontWeight={v:500,u:V.NUMBER}:/semiBold/i.test(a)?t.fontWeight={v:600,u:V.NUMBER}:/bold/i.test(a)?t.fontWeight={v:700,u:V.NUMBER}:/extraBold/i.test(a)?t.fontWeight={v:800,u:V.NUMBER}:/black/i.test(a)?t.fontWeight={v:900,u:V.NUMBER}:t.fontWeight={v:400,u:V.NUMBER}:t.fontWeight={v:Math.min(900,Math.max(100,parseInt(a)||400)),u:V.NUMBER}}if(void 0!==e.fontStyle){var n=e.fontStyle,o=G.NORMAL;n&&/italic/i.test(n)?o=G.ITALIC:n&&/oblique/i.test(n)&&(o=G.OBLIQUE),t.fontStyle={v:o,u:V.NUMBER}}if(void 0!==e.letterSpacing&&(t.letterSpacing=se(e.letterSpacing||0,!0)),void 0!==e.paragraphSpacing&&(t.paragraphSpacing=se(e.paragraphSpacing||0,!0)),void 0!==e.textAlign){var s=e.textAlign,o=H.LEFT;"center"===s?o=H.CENTER:"right"===s?o=H.RIGHT:"justify"===s&&(o=H.JUSTIFY),t.textAlign={v:o,u:V.NUMBER}}if(void 0!==e.textVerticalAlign){var c=e.textVerticalAlign;o=X.TOP;"middle"===c?o=X.MIDDLE:"bottom"===c&&(o=X.BOTTOM),t.textVerticalAlign={v:o,u:V.NUMBER}}if(void 0!==e.textDecoration){var u=e.textDecoration;Array.isArray(u)?t.textDecoration=u.map(function(e){var t=re.NONE;return"underline"===e?t=re.UNDERLINE:"line-through"!==e&&"lineThrough"!==e||(t=re.LINE_THROUGH),{v:t,u:V.NUMBER}}):t.textDecoration=[]}void 0!==e.textShadow&&(he.shadow.test(e.textShadow)?(o=he.shadow.exec(e.textShadow))&&(t.textShadow={v:{x:parseFloat(o[1]),y:parseFloat(o[2]),blur:parseFloat(o[3]),color:de(o[4])},u:V.SHADOW}):t.textShadow={u:V.SHADOW});if(void 0!==e.color&&(t.color={v:de(e.color),u:V.RGBA}),void 0!==e.visibility&&(t.visibility={v:/hidden/i.test(e.visibility)?te.HIDDEN:te.VISIBLE,u:V.NUMBER}),void 0!==e.opacity&&(t.opacity={v:Math.max(0,Math.min(1,e.opacity)),u:V.NUMBER}),void 0!==e.backgroundColor&&(t.backgroundColor={v:de(e.backgroundColor),u:V.RGBA}),void 0!==e.fill){var l=e.fill;Array.isArray(l)?t.fill=l.map(function(e){if(g(e)&&Wr(e)){var t=Vr(e);if(t)return{v:t,u:V.GRADIENT}}return{v:de(e),u:V.RGBA}}):t.fill=[]}if(void 0!==e.fillEnable){var h=e.fillEnable;Array.isArray(h)?t.fillEnable=h.map(function(e){return{v:e,u:V.BOOLEAN}}):t.fillEnable=t.fill.map(function(){return{v:!0,u:V.BOOLEAN}})}if(void 0!==e.fillOpacity){var d=e.fillOpacity;Array.isArray(d)?t.fillOpacity=d.map(function(e){return{v:Math.max(0,Math.min(1,e)),u:V.NUMBER}}):t.fillOpacity=t.fill.map(function(){return{v:1,u:V.NUMBER}})}if(void 0!==e.fillMode){var f=e.fillMode;Array.isArray(f)?t.fillMode=f.map(function(e){return{v:Zr(e),u:V.NUMBER}}):t.fillMode=t.fill.map(function(){return{v:j.NORMAL,u:V.NUMBER}})}if(void 0!==e.fillRule){var m=e.fillRule;t.fillRule={v:"evenodd"===m?K.EVEN_ODD:K.NON_ZERO,u:V.NUMBER}}if(void 0!==e.stroke){var p=e.stroke;Array.isArray(p)?t.stroke=p.map(function(e){if(g(e))if(Wr(e)){if(t=Vr(e))return{v:t,u:V.GRADIENT}}else if(he.img.test(e)){var t;if(t=he.img.exec(e)){var r=ee.TILE,i=e.replace(t[0],"");i.indexOf("fill")>-1?r=ee.FILL:i.indexOf("stretch")>-1?r=ee.STRETCH:i.indexOf("fit")>-1&&(r=ee.FIT);var a=void 0,n=/([\d.]+)%/.exec(i);return n&&(a={v:parseFloat(n[1]),u:V.PERCENT}),{v:{url:t[2],type:r,scale:a},u:V.PATTERN}}}return{v:de(e),u:V.RGBA}}):t.stroke=[]}if(void 0!==e.strokeEnable){var v=e.strokeEnable;Array.isArray(v)?t.strokeEnable=v.map(function(e){return{v:e,u:V.BOOLEAN}}):t.strokeEnable=t.stroke.map(function(){return{v:!0,u:V.BOOLEAN}})}if(void 0!==e.strokeWidth){var y=e.strokeWidth;Array.isArray(y)?t.strokeWidth=y.map(function(e){return{v:Math.max(0,e),u:V.PX}}):t.strokeWidth=t.stroke.map(function(){return{v:1,u:V.NUMBER}})}if(void 0!==e.strokePosition){var b=e.strokePosition;Array.isArray(b)?t.strokePosition=b.map(function(e){var t=J.CENTER;return"inside"===e?t=J.INSIDE:"outside"===e&&(t=J.OUTSIDE),{v:t,u:V.NUMBER}}):t.strokePosition=t.stroke.map(function(){return{v:J.CENTER,u:V.NUMBER}})}if(void 0!==e.strokeMode){var x=e.strokeMode;Array.isArray(x)?t.strokeMode=x.map(function(e){return{v:Zr(e),u:V.NUMBER}}):t.strokeMode=t.stroke.map(function(){return{v:j.NORMAL,u:V.NUMBER}})}if(void 0!==e.strokeDasharray){var T=e.strokeDasharray;Array.isArray(T)?t.strokeDasharray=T.map(function(e){return{v:Math.max(0,e),u:V.PX}}):t.strokeDasharray=[]}if(void 0!==e.strokeLinecap){var w=e.strokeLinecap;o=Q.BUTT;"round"===w?o=Q.ROUND:"square"===w&&(o=Q.SQUARE),t.strokeLinecap={v:o,u:V.NUMBER}}if(void 0!==e.strokeLinejoin){var k=e.strokeLinejoin;o=Z.MITER;"round"===k?o=Z.ROUND:"bevel"===k&&(o=Z.BEVEL),t.strokeLinejoin={v:o,u:V.NUMBER}}if(void 0!==e.strokeMiterlimit&&(t.strokeMiterlimit={v:e.strokeMiterlimit,u:V.NUMBER}),["translateX","translateY","translateZ","skewX","skewY","scaleX","scaleY","rotateX","rotateY","rotateZ","perspective","perspectiveSelf"].forEach(function(r){var i=e[r];if(void 0!==i){var a=se(i);!function(e,t){"scaleX"===e||"scaleY"===e?t.u=V.NUMBER:"translateX"===e||"translateY"===e||"translateZ"===e||"perspective"===e||"perspectiveSelf"===e?t.u===V.NUMBER&&(t.u=V.PX):"rotateX"!==e&&"rotateY"!==e&&"rotateZ"!==e||t.u===V.NUMBER&&(t.u=V.DEG)}(r,a),t[r]=a}}),["transformOrigin","perspectiveOrigin"].forEach(function(r){var i=e[r];if(void 0!==i){var a;(a=Array.isArray(i)?i:(i||"").toString().match(he.position))&&a.length?1===a.length&&(a[1]=a[0]):a=[50,50];for(var n=[],o=0;o<2;o++){var s=a[o];if(/^[-+]?[\d.]/.test(s)){var c=se(s,!0);n.push(c)}else n.push({v:{top:0,left:0,center:50,right:100,bottom:100}[s],u:V.PERCENT}),S(n[o].v)&&(n[o].v=50)}t[r]=n}}),void 0!==e.mixBlendMode&&(t.mixBlendMode={v:Zr(e.mixBlendMode),u:V.NUMBER}),void 0!==e.pointerEvents&&(t.pointerEvents={v:e.pointerEvents,u:V.BOOLEAN}),e.hasOwnProperty("maskMode")){var E=e.maskMode;o=$.NONE;"alpha"===E?o=$.ALPHA:"gray"===E?o=$.GRAY:"alpha-with"===E?o=$.ALPHA_WITH:"gray-with"===E&&(o=$.GRAY_WITH),t.maskMode={v:o,u:V.NUMBER}}if(e.hasOwnProperty("breakMask")&&(t.breakMask={v:!!e.breakMask,u:V.BOOLEAN}),void 0!==e.objectFit&&(t.objectFit={v:Jr(e.objectFit),u:V.NUMBER}),void 0!==e.overflow){var C=e.overflow;o=ie.VISIBLE;"hidden"===C&&(o=ie.HIDDEN),t.overflow={v:o,u:V.NUMBER}}if(void 0!==e.filter){var A=Array.isArray(e.filter)?e.filter:[e.filter],_=[];A.forEach(function(e){var t=/([\w-]+)\s*\((\s*.+\s*)\)/i.exec(e);if(t){var r=t[1],i=t[2];if("gaussBlur"===r){var a=parseFloat(i)||0;_.push({v:{radius:{v:Math.max(a,0),u:V.PX}},u:V.GAUSS_BLUR})}else if("radiaBlur"===r){a=parseFloat(i)||0;var n=/,\s*(.+)\s*(?:,\s*(.+))?/.exec(i),o=[{v:50,u:V.PERCENT},{v:50,u:V.PERCENT}];if(n)if((h=se(n[1])).u!==V.PX&&h.u!==V.PERCENT&&(h.u=V.PX),o[0]=h,n[2]){var s=se(n[2]);s.u!==V.PX&&s.u!==V.PERCENT&&(s.u=V.PX),o[1]=s}else o[1]={v:h.v,u:h.u};_.push({v:{radius:{v:Math.max(a,0),u:V.PX},center:o},u:V.RADIAL_BLUR})}else if("motionBlur"===r){a=parseFloat(i)||0;var c={v:0,u:V.DEG},u={v:0,u:V.DEG};if(p=/,\s*(.+)\s*(?:,\s*(.+))?/.exec(i)){var l=parseFloat(p[1]);if(c.v=l||0,p[2]){var h=se(p[2]);u.v=h.v}}_.push({v:{radius:{v:Math.max(a,0),u:V.PX},angle:c,offset:u},u:V.MOTION_BLUR})}else if("bloom"===r){a=parseFloat(i)||0;var d=/,\s*([^,]+)/.exec(i),f={v:.5,u:V.NUMBER};if(d){var m=se(d[1]);f.v=Math.max(0,m.v)}_.push({v:{threshold:{v:Math.max(a,0),u:V.NUMBER},knee:f},u:V.BLOOM})}else if("lightDark"===r){var p;a=parseFloat(i)||0,c={v:0,u:V.DEG};if(p=/,\s*(.+)\s*(?:,\s*(.+))?/.exec(i)){l=parseFloat(p[1]);c.v=l||0}_.push({v:{radius:{v:Math.max(a,0),u:V.PX},angle:c},u:V.LIGHT_DARK})}else if("hueRotate"===r){a=parseFloat(i)||0;_.push({v:{radius:{v:a,u:V.DEG}},u:V.HUE_ROTATE})}else if("saturate"===r){a=parseFloat(i)||0;_.push({v:{radius:{v:.01*a,u:V.PERCENT}},u:V.SATURATE})}else if("brightness"===r){a=parseFloat(i)||0;_.push({v:{radius:{v:.01*a,u:V.PERCENT}},u:V.BRIGHTNESS})}else if("contrast"===r){a=parseFloat(i)||0;_.push({v:{radius:{v:.01*a,u:V.PERCENT}},u:V.CONTRAST})}else if("sepia"===r){a=parseFloat(i)||0;_.push({v:{radius:{v:.01*a,u:V.PERCENT}},u:V.SEPIA})}}}),t.filter=_}return t}function Yr(e){var t=e.fontSize||L.defaultFontSize,r=e.fontFamily||L.defaultFontFamily;/[\s.,/\\]/.test(r)&&(r='"'+r.replace(/"/g,'\\"')+'"');var i="";e.fontStyle===G.ITALIC&&(i="italic ");var a="";return 400!==e.fontWeight&&(a=e.fontWeight+" "),i+a+t+"px "+r}function qr(e){for(var t=e.split(/\s*,\s*/),r=0,i=t.length;r<i;r++){var a=t[r].replace(/^['"]/,"").replace(/['"]$/,"");if(Xe.hasRegister(a)||oe.checkSupportFontFamily(a))return a}return L.defaultFontFamily}function Kr(e,t){t||(t=qr(e.fontFamily));var r=(Xe.data[t]||Xe.data[L.defaultFontFamily]||Xe.data.Arial||{}).lhr;return e.fontSize*r}function $r(e,t){var r=e.fontSize,i=qr(e.fontFamily),a=Kr(e,i),n=(Xe.data[i]||Xe.data[L.defaultFontFamily]||Xe.data.Arial||{}).blr||1;return.5*((null!=t?t:e.lineHeight)-a)+r*n}function Qr(e,t){var r=e.fontSize,i=qr(e.fontFamily),a=Kr(e,i),n=(Xe.data[i]||Xe.data[L.defaultFontFamily]||Xe.data.Arial||{}).car||1;return.5*((null!=t?t:e.lineHeight)-a)+r*n}function Zr(e){var t=j.NORMAL;return/multiply/i.test(e)?t=j.MULTIPLY:/screen/i.test(e)?t=j.SCREEN:/overlay/i.test(e)?t=j.OVERLAY:/darken/i.test(e)?t=j.DARKEN:/lighten/i.test(e)?t=j.LIGHTEN:/color[-\s]dodge/i.test(e)||/colorDodge/.test(e)?t=j.COLOR_DODGE:/color[-\s]burn/i.test(e)||/colorBurn/.test(e)?t=j.COLOR_BURN:/hard[\-\s]light/i.test(e)||/hardLight/.test(e)?t=j.HARD_LIGHT:/soft[-\s]light/i.test(e)||/softLight/.test(e)?t=j.SOFT_LIGHT:/difference/i.test(e)?t=j.DIFFERENCE:/exclusion/i.test(e)?t=j.EXCLUSION:/hue/i.test(e)?t=j.HUE:/saturation/i.test(e)?t=j.SATURATION:/color/i.test(e)?t=j.COLOR:/luminosity/i.test(e)&&(t=j.LUMINOSITY),t}function Jr(e){var t=ae.FILL;return"contain"===e?t=ae.CONTAIN:"cover"===e&&(t=ae.COVER),t}function ei(e,t,r){if(e===t)return!0;var i=e[r],a=t[r];if(void 0===i&&void 0===a)return!0;if(void 0===i||void 0===a)return!1;if("transformOrigin"===r||"perspectiveOrigin"===r)return i[0].v===a[0].v&&i[0].u===a[0].u&&i[1].v===a[1].v&&i[1].u===a[1].u;if("color"===r||"backgroundColor"===r)return i.v[0]===a.v[0]&&i.v[1]===a.v[1]&&i.v[2]===a.v[2]&&i.v[3]===a.v[3];if("fill"===r||"stroke"===r){if(i.length!==a.length)return!1;for(var n=0,o=i.length;n<o;n++){var s=i[n],c=a[n];if(s.u!==c.u)return!1;if(s.u===V.RGBA){if(s.v[0]!==c.v[0]||s.v[1]!==c.v[1]||s.v[2]!==c.v[2]||s.v[3]!==c.v[3])return!1}else if(s.u===V.GRADIENT){if(s.v.t!==c.v.t)return!1;if(s.v.d.length!==c.v.d.length)return!1;for(var u=0,l=s.v.d.length;u<l;u++)if(s.v.d[u]!==c.v.d[u])return!1;if(s.v.stops.length!==c.v.stops.length)return!1;for(var h=0,d=s.v.stops.length;h<d;h++){var f=s.v.stops[h],m=c.v.stops[h];if(f.color.v[0]!==m.color.v[0]||f.color.v[1]!==m.color.v[1]||f.color.v[2]!==m.color.v[2]||f.color.v[3]!==m.color.v[3])return!1;if(f.offset&&!m.offset||!f.offset&&m.offset)return!1;if(f.offset.u!==m.offset.u||f.offset.v!==m.offset.v)return!1}}}return!0}if("filter"===r){if(i.length!==a.length)return!1;for(n=0,o=i.length;n<o;n++){s=i[n],c=a[n];if(s.u!==c.u)return!1;if(s.u===V.GAUSS_BLUR){if(s.v.radius.v!==c.v.radius.v)return!1}else if(s.u===V.RADIAL_BLUR){if(s.v.radius.v!==c.v.radius.v)return!1;if(s.v.center[0].v!==c.v.center[0].v||s.v.center[1].v!==c.v.center[1].v)return!1}else if(s.u===V.MOTION_BLUR){if(s.v.radius.v!==c.v.radius.v)return!1;if(s.v.angle.v!==c.v.angle.v||s.v.offset.v!==c.v.offset.v)return!1}else if(s.u===V.BLOOM){if(s.v.threshold.v!==c.v.threshold.v||s.v.knee.v!==c.v.knee.v)return!1}else if(s.u===V.LIGHT_DARK){if(s.v.radius.v!==c.v.radius.v||s.v.angle.v!==c.v.angle.v)return!1}else if((s.u===V.HUE_ROTATE||s.u===V.SATURATE||s.u===V.BRIGHTNESS||s.u===V.CONTRAST||s.u===V.SEPIA)&&s.v.radius.v!==c.v.radius.v)return!1}return!0}if("fillEnable"===r||"fillRule"===r||"fillOpacity"===r||"strokeEnable"===r||"strokeWidth"===r||"strokePosition"===r||"strokeDasharray"===r){if(i.length!==a.length)return!1;for(n=0,o=i.length;n<o;n++){s=i[n],c=a[n];if(s.u!==c.u||s.v!==c.v)return!1}return!0}return i.v===a.v&&i.u===a.u}function ti(e,t){t?Array.isArray(t)||(t=[t]):t=Object.keys(e);for(var r={},i=0,a=t.length;i<a;i++){var n=t[i],o=e[n];o&&(r[n]="transformOrigin"===n||"perspectiveOrigin"===n?[Object.assign({},o[0]),Object.assign({},o[1])]:"color"===n||"backgroundColor"===n?{v:o.v.slice(0),u:o.u}:"fill"===n||"stroke"===n||"filter"===n?o.map(function(e){return C(e)}):"filter"===n?o.map(function(e){var t={};return e.u===V.RADIAL_BLUR?(t.radius=Object.assign({},e.v.radius),t.center=e.v.center.map(function(e){return Object.assign({},e)})):e.u===V.MOTION_BLUR?(t.radius=Object.assign({},e.v.radius),t.angle=Object.assign({},e.v.angle),t.offset=Object.assign({},e.v.offset)):e.u===V.BLOOM&&(t.threshold=Object.assign({},e.v.threshold),t.knee=Object.assign({},e.v.knee)),{v:t,u:e.u}}):"fillEnable"===n||"fillRule"===n||"fillOpacity"===n||"strokeEnable"===n||"strokeWidth"===n||"strokePosition"===n||"strokeDasharray"===n?o.map(function(e){return Object.assign({},e)}):Object.assign({},o))}return r}function ri(e,t){return e.u===V.PX?e.v:e.u===V.PERCENT?e.v*t*.01:0}function ii(e,t){var i={};return ue.forEach(function(e){var r=t[e];void 0!==r&&(i[e]=r)}),r(r({location:e.location,length:e.length},i),Gr(e))}function ai(e){return["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"][e]}function ni(e,t,r,i){return void 0===i&&(i=!1),Array.isArray(e)?fe(e):function(e,t,r,i){var a,n,o,s;void 0===t&&(t=100),void 0===r&&(r=100),void 0===i&&(i=!1);var c=e.t,u=e.d,l=e.stops,h=u[0],d=u[1],f=u[2],m=u[3];h*=t,f*=t,d*=r,m*=r;var p=0;1===u.length?p=u[0]:h===f?d<m&&(p=180):p=f>h?m>=d?90+mr(Math.atan((m-d)/(f-h))):mr(Math.atan((f-h)/(d-m))):m>=d?180+mr(Math.atan((h-f)/(m-d))):360-mr(Math.atan((h-f)/(d-m)));var g=l.slice(0);if(g.sort(function(e,t){return e.offset-t.offset}),c===Y.LINEAR){var v=void 0,y=void 0;p<=90?(v={x:0,y:r},y={x:t,y:0}):p<=180?(v={x:0,y:0},y={x:t,y:r}):p<=270?(v={x:t,y:0},y={x:0,y:r}):(v={x:t,y:r},y={x:0,y:0});var b=C(g).sort(function(e,t){return e.offset-t.offset});if(i){var x=Math.sqrt(Math.pow(m-v.y,2)+Math.pow(f-v.x,2)),T=Math.sqrt(Math.pow(d-v.y,2)+Math.pow(h-v.x,2)),w=Math.sqrt(Math.pow(m-d,2)+Math.pow(f-h,2)),k=yr(x,T,w),S=k?T*Math.cos(k):T,E=(k=yr(x=Math.sqrt(Math.pow(d-y.y,2)+Math.pow(h-y.x,2)),T=Math.sqrt(Math.pow(m-y.y,2)+Math.pow(f-y.x,2)),w))?T*Math.cos(k):T;if(b[0].offset>0&&b.unshift({color:b[0].color.slice(0),offset:0}),b[b.length-1].offset<1&&b.push({color:b[b.length-1].color.slice(0),offset:1}),S>1e-9)for(var A=S/w,_=function(e,t){var r=b[e];if(r.offset>=A){var i=b[e-1]||{color:r.color,offset:0};if(b.splice(0,e),r.offset>A){var a=w*(r.offset-i.offset),n=(S-i.offset*w)/a,o=i.color.map(function(e,t){return 3===t?e+(r.color[t]-e)*n:e+Math.floor((r.color[t]-e)*n)}),s={color:o,offset:0};b.unshift(s)}return"break"}},M=0,I=b.length;M<I&&"break"!==_(M);M++);else S<-1e-9&&b.forEach(function(e){e.offset=(e.offset*w-S)/(w-S)});if(E>1e-9){A=(w-E)/w;var R=function(e){var t=b[e];if(t.offset<=A){var r=b[e+1]||{color:t.color,offset:1};if(b.splice(e+1),t.offset<A){var i=w*(r.offset-t.offset),a=(E-(1-r.offset)*w)/i,n=r.color.map(function(e,r){return 3===r?e+(t.color[r]-e)*a:e+Math.floor((t.color[r]-e)*a)}),o={color:n,offset:1};b.push(o)}return"break"}};for(M=b.length-1;M>=0&&"break"!==R(M);M--);}else E<-1e-9&&b.forEach(function(e){e.offset=e.offset*(w-S)/(w-S-E)})}var P="linear-gradient(";return P+=i?Nr(p)+"deg":u.join(" "),b.forEach(function(e){P+=", ",e.color[3]=Nr(e.color[3]),P+=fe(e.color)+" "+Nr(100*e.offset)+"%"}),P+")"}if(c===Y.RADIAL){var O=1;if(i){var D=Math.sqrt(Math.pow(f-h,2)+Math.pow(m-d,2)),B=Math.sqrt(Math.pow(h,2)+Math.pow(d,2)),F=Math.sqrt(Math.pow(h-t,2)+Math.pow(d,2)),L=Math.sqrt(Math.pow(h-t,2)+Math.pow(d-r,2)),N=Math.sqrt(Math.pow(h,2)+Math.pow(d-r,2)),U=Math.max(B,F,L,N);O=U/D}var z="radial-gradient(";return z+=i?"circle at ".concat(100*Nr(u[0]),"% ").concat(100*Nr(u[1]),"%, "):u.join(" ")+", ",g.forEach(function(e,t){t&&(z+=", ");var r=e.color.map(function(e,t){return 3===t?Nr(e):Math.min(255,Math.floor(e*O))});z+=fe(r)+" "+Nr(100*e.offset)+"%"}),z+")"}if(c===Y.CONIC){var W="conic-gradient(";i&&(W+="from 90deg, ");var V=g[0],H=g[g.length-1];if(i&&(V.offset>0||H.offset<1)){var X=null!==(a=V.color[3])&&void 0!==a?a:1,j=null!==(n=H.color[3])&&void 0!==n?n:1,G=[V.color[0]-H.color[0],V.color[1]-H.color[1],V.color[2]-H.color[2],X-j],q=1-H.offset+V.offset;if(V.offset>0){var K=V.offset/q;g.unshift({color:[Math.min(255,Math.max(0,Math.round(V.color[0]-G[0]*K))),Math.min(255,Math.max(0,Math.round(V.color[1]-G[1]*K))),Math.min(255,Math.max(0,Math.round(V.color[2]-G[2]*K))),Math.min(1,Math.max(0,null!==(o=V.color[3])&&void 0!==o?o:1-G[3]*K))],offset:0})}H.offset<1&&(K=(1-H.offset)/q,g.push({color:[Math.min(255,Math.max(0,Math.round(H.color[0]+G[0]*K))),Math.min(255,Math.max(0,Math.round(H.color[1]+G[1]*K))),Math.min(255,Math.max(0,Math.round(H.color[2]+G[2]*K))),Math.min(1,Math.max(0,null!==(s=H.color[3])&&void 0!==s?s:1+G[3]*K))],offset:1}))}return g.forEach(function(e,t){t&&(W+=", "),e.color[3]=Nr(e.color[3]),W+=fe(e.color)+" "+Nr(100*e.offset)+"%"}),W+")"}return""}(e,t,r,i)}function oi(e){return["center","inside","outside"][e]||"inside"}function si(e){var t,r,i,a;return{x:e.x,y:e.y,cornerRadius:e.cornerRadius||0,fx:null!==(t=e.fx)&&void 0!==t?t:e.x,fy:null!==(r=e.fy)&&void 0!==r?r:e.y,tx:null!==(i=e.tx)&&void 0!==i?i:e.x,ty:null!==(a=e.ty)&&void 0!==a?a:e.y,hasCurveFrom:e.hasCurveFrom||!1,hasCurveTo:e.hasCurveTo||!1,curveMode:{none:ce.NONE,straight:ce.STRAIGHT,mirrored:ce.MIRRORED,asymmetric:ce.ASYMMETRIC,disconnected:ce.DISCONNECTED}[e.curveMode||"none"]||ce.NONE,absX:0,absY:0,absFx:0,absFy:0,absTx:0,absTy:0,dspX:0,dspY:0,dspFx:0,dspFy:0,dspTx:0,dspTy:0}}var ci,ui={normalize:Gr,equalStyle:ei,cloneStyle:ti,calSize:ri,normalizeRich:ii,getCssMbm:ai,getCssFillStroke:ni,getCssStrokePosition:oi,normalizePoints:si,getPropsRich:function(e){return r(r({},e),{textAlign:["left","right","center","justify"][e.textAlign]||"left",textDecoration:e.textDecoration.map(function(e){return["none","underline","lineThrough"][e]||"none"}),color:fe(e.color)})}};function li(e){return"pointerEvents"===e||"constrainProportions"===e||"isLocked"===e||"isSelected"===e||"resizesContent"===e||"isRectangle"===e?ci.NONE:"translateX"===e?ci.TRANSLATE_X:"translateY"===e?ci.TRANSLATE_Y:"translateZ"===e?ci.TRANSLATE_Z:"rotateX"===e?ci.ROTATE_X:"rotateY"===e?ci.ROTATE_Y:"rotateZ"===e?ci.ROTATE_Z:"scaleX"===e?ci.SCALE_X:"scaleY"===e?ci.SCALE_Y:"matrix"===e?ci.MATRIX:"transformOrigin"===e?ci.TRANSFORM_ORIGIN:"opacity"===e?ci.OPACITY:"perspective"===e||"perspectiveOrigin"===e?ci.PERSPECTIVE:"perspectiveSelf"===e?ci.PERSPECTIVE_SELF:"filter"===e?ci.FILTER:"mixBlendMode"===e?ci.MIX_BLEND_MODE:"maskMode"===e?ci.MASK:"breakMask"===e?ci.BREAK_MASK:function(e){return"width"===e||"height"===e||"letterSpacing"===e||"paragraphSpacing"===e||"textAlign"===e||"textVerticalAlign"===e||"fontFamily"===e||"fontSize"===e||"fontWeight"===e||"fontStyle"===e||"lineHeight"===e||"left"===e||"top"===e||"right"===e||"bottom"===e}(e)?ci.REFLOW:ci.REPAINT}function hi(e,t,r,i,a){if(3===arguments.length){var n=t,o=n[0],s=n[1],c=n[2],u=n[3];if(!nt(r)){var l=bt({x:o,y:s},r),h=bt({x:o,y:u},r),d=bt({x:c,y:s},r),f=bt({x:c,y:u},r);l.w&&1!==l.w&&(l.x/=l.w,l.y/=l.w),h.w&&1!==h.w&&(h.x/=h.w,h.y/=h.w),d.w&&1!==d.w&&(d.x/=d.w,d.y/=d.w),f.w&&1!==f.w&&(f.x/=f.w,f.y/=f.w),o=Math.min(l.x,h.x,d.x,f.x),s=Math.min(l.y,h.y,d.y,f.y),c=Math.max(l.x,h.x,d.x,f.x),u=Math.max(l.y,h.y,d.y,f.y)}e[0]=Math.min(e[0],o),e[1]=Math.min(e[1],s),e[2]=Math.max(e[2],c),e[3]=Math.max(e[3],u)}else 2===arguments.length?(e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[2]),e[3]=Math.max(e[3],t[3])):5===arguments.length&&(e[0]=Math.min(e[0],t),e[1]=Math.min(e[1],r),e[2]=Math.max(e[2],i),e[3]=Math.max(e[3],a))}function di(e,t){var r,i;if(6===e.length)r=e[4],i=e[5];else if(4===e.length)r=e[2],i=e[3];else{if(2!==e.length)return void oe.error("Unsupported point data: "+e.join(","));r=e[0],i=e[1]}return t[0]=r,t[1]=i,t[2]=r,t[3]=i,{x:r,y:i}}function fi(e,t,r,i){var a,n;if(4===e.length)a=e[2],n=e[3],hi(i,(o=Zt.bboxBezier(t,r,e[0],e[1],a,n))[0],o[1],o[2],o[3]);else if(6===e.length){var o;a=e[4],n=e[5],hi(i,(o=Zt.bboxBezier(t,r,e[0],e[1],e[2],e[3],a,n))[0],o[1],o[2],o[3])}else{if(2!==e.length)return void oe.error("Unsupported point data: "+e.join(","));hi(i,a=e[0],n=e[1],a,n)}return{x:a,y:n}}function mi(e){e[0]=Math.floor(e[0]),e[1]=Math.floor(e[1]),e[2]=Math.ceil(e[2]),e[3]=Math.ceil(e[3])}!function(e){e[e.NONE=0]="NONE",e[e.CACHE=1]="CACHE",e[e.TRANSLATE_X=2]="TRANSLATE_X",e[e.TRANSLATE_Y=4]="TRANSLATE_Y",e[e.TRANSLATE=6]="TRANSLATE",e[e.TRANSLATE_Z=8]="TRANSLATE_Z",e[e.ROTATE_X=16]="ROTATE_X",e[e.ROTATE_Y=32]="ROTATE_Y",e[e.ROTATE_Z=64]="ROTATE_Z",e[e.SCALE_X=128]="SCALE_X",e[e.SCALE_Y=256]="SCALE_Y",e[e.SCALE=384]="SCALE",e[e.MATRIX=512]="MATRIX",e[e.TRANSFORM_ORIGIN=1024]="TRANSFORM_ORIGIN",e[e.TRANSFORM_ALL=2046]="TRANSFORM_ALL",e[e.PERSPECTIVE=2048]="PERSPECTIVE",e[e.PERSPECTIVE_SELF=4096]="PERSPECTIVE_SELF",e[e.OPACITY=8192]="OPACITY",e[e.FILTER=16384]="FILTER",e[e.MIX_BLEND_MODE=32768]="MIX_BLEND_MODE",e[e.MASK=65536]="MASK",e[e.BREAK_MASK=131072]="BREAK_MASK",e[e.MASK_OPACITY=139264]="MASK_OPACITY",e[e.HOOK=262144]="HOOK",e[e.REPAINT=524288]="REPAINT",e[e.REFLOW=1048576]="REFLOW",e[e.REFLOW_REPAINT=1572864]="REFLOW_REPAINT",e[e.REFLOW_REPAINT_MASK=1638400]="REFLOW_REPAINT_MASK",e[e.REFLOW_REPAINT_HOOK=1835008]="REFLOW_REPAINT_HOOK",e[e.REFLOW_TRANSFORM=1050622]="REFLOW_TRANSFORM",e[e.REFLOW_PERSPECTIVE=1050624]="REFLOW_PERSPECTIVE",e[e.REFLOW_PERSPECTIVE_SELF=1052672]="REFLOW_PERSPECTIVE_SELF",e[e.REFLOW_OPACITY=1056768]="REFLOW_OPACITY",e[e.REFLOW_FILTER=1064960]="REFLOW_FILTER",e[e.ADD_DOM=2097152]="ADD_DOM",e[e.REMOVE_DOM=4194304]="REMOVE_DOM",e[e.FULL=8388607]="FULL"}(ci||(ci={}));var pi,gi,vi={},yi=new WeakMap,bi=new WeakMap,xi=function(){function e(e,t,r,i){void 0===r&&(r=0),void 0===i&&(i=0),this.available=!1,this.w=e,this.h=t,this.dx=r,this.dy=i,this.list=[];for(var a=L.maxTextureSize,n=0,o=Math.ceil(t/a);n<o;n++)for(var s=0,c=Math.ceil(e/a);s<c;s++){var u=s===c-1?e-s*a:a,l=n===o-1?t-n*a:a;this.list.push({x:s*a-r,y:n*a-i,w:u,h:l,os:oe.getOffscreenCanvas(u,l)})}}return e.prototype.release=function(){return this.url?this.releaseImg(this.url):this.videoFrame?this.releaseVideoFrame(this.videoFrame):this.canvas?this.releaseCanvas(this.canvas):!!this.available&&(this.available=!1,this.list.splice(0).forEach(function(e){return e.os.release()}),!0)},e.prototype.releaseImg=function(e){if(!this.available)return!1;this.available=!1;var t=vi[e];return t&&(t.count--,t.count||(delete vi[e],this.list.splice(0).forEach(function(e){return e.os.release()}))),!0},e.prototype.releaseVideoFrame=function(e){if(!this.available)return!1;this.available=!1;var t=bi.get(e);return t&&(t.count--,t.count||(bi.delete(e),this.list.splice(0).forEach(function(e){return e.os.release()}))),!0},e.prototype.releaseCanvas=function(e){if(!this.available)return!1;this.available=!1;var t=yi.get(e);return t&&(t.count--,t.count||(yi.delete(e),this.list.splice(0).forEach(function(e){return e.os.release()}))),!0},e.prototype.getCount=function(){var e,t;return this.url?null===(e=vi[this.url])||void 0===e?void 0:e.count:this.videoFrame?null===(t=bi.get(this.videoFrame))||void 0===t?void 0:t.count:void 0},e.getImgInstance=function(t,r,i,a,n){void 0===a&&(a=0),void 0===n&&(n=0);var o=vi[i];if(o)return o.count++,o.value;var s=new e(t,r,a,n);return s.url=i,vi[i]={value:s,count:1},s},e.getVideoFrameInstance=function(t,r,i,a,n){void 0===a&&(a=0),void 0===n&&(n=0);var o=bi.get(i);if(o)return o.count++,o.value;var s=new e(t,r,a,n);return s.videoFrame=i,bi.set(i,{value:s,count:1}),s},e.getCanvasInstance=function(t,r,i,a,n){void 0===a&&(a=0),void 0===n&&(n=0);var o=yi.get(i);if(o)return o.count++,o.value;var s=new e(t,r,a,n);return s.canvas=i,yi.set(i,{value:s,count:1}),s},e}();function Ti(e,t,r){var i=function(e,t,r){var i=wi(e,e.VERTEX_SHADER,t),a=wi(e,e.FRAGMENT_SHADER,r);if(!i||!a)return null;var n=e.createProgram();if(!n)return null;n.vertexShader=i,n.fragmentShader=a,e.attachShader(n,i),e.attachShader(n,a),e.linkProgram(n);var o=e.getProgramParameter(n,e.LINK_STATUS);if(!o){var s=e.getProgramInfoLog(n);throw e.deleteProgram(n),e.deleteShader(a),e.deleteShader(i),new Error("Failed to link program: "+s)}return n}(e,t,r);if(!i)throw new Error("Failed to create program");return e.enable(e.BLEND),e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA),i}function wi(e,t,r){var i=e.createShader(t);if(null===i)throw new Error("unable to create shader");if(e.shaderSource(i,r),e.compileShader(i),!e.getShaderParameter(i,e.COMPILE_STATUS)){var a=e.getShaderInfoLog(i);throw e.deleteShader(i),new Error("Failed to compile shader: "+a)}return i}function ki(e,t,r,i,a){var n=e.createTexture();if(Si(e,n,t),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),r)e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,r);else{if(!i||!a)throw new Error("Missing texImageSource or w/h");e.texImage2D(e.TEXTURE_2D,0,e.RGBA,i,a,0,e.RGBA,e.UNSIGNED_BYTE,null)}return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),n}function Si(e,t,r){e.activeTexture(e["TEXTURE"+r]),e.bindTexture(e.TEXTURE_2D,t)}function Ei(e,t,r,i,a){var n,o;n=pi||(pi=new Float32Array(12)),o=gi||(gi=new Float32Array(8));var s=a.matrix,c=a.bbox,u=a.tc,l=a.t,h=a.dx,d=void 0===h?0:h,f=a.dy,m=void 0===f?0:f;Si(e,l,0);var p=Gi(c,t,r,d,m,s),g=p.t1,v=p.t2,y=p.t3,b=p.t4;n[0]=g.x,n[1]=g.y,n[2]=g.w||1,n[3]=b.x,n[4]=b.y,n[5]=b.w||1,n[6]=v.x,n[7]=v.y,n[8]=v.w||1,n[9]=y.x,n[10]=y.y,n[11]=y.w||1,u?(o[0]=u.x1,o[1]=u.y3,o[2]=u.x1,o[3]=u.y1,o[4]=u.x3,o[5]=u.y3,o[6]=u.x3,o[7]=u.y1):(o[0]=0,o[1]=1,o[2]=0,o[3]=0,o[4]=1,o[5]=1,o[6]=1,o[7]=0);var x=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,x),e.bufferData(e.ARRAY_BUFFER,n,e.STATIC_DRAW);var T=i.attrib.a_position;e.vertexAttribPointer(T,3,e.FLOAT,!1,0,0),e.enableVertexAttribArray(T);var w=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,w),e.bufferData(e.ARRAY_BUFFER,o,e.STATIC_DRAW);var k=i.attrib.a_texCoords;e.vertexAttribPointer(k,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(k);var S=i.uniformValue;if(S.u_opacity!==a.opacity){S.u_opacity=a.opacity;var E=i.uniform.u_opacity;e.uniform1f(E,a.opacity)}if(0!==S.u_texture){S.u_texture=0;var C=i.uniform.u_texture;e.uniform1i(C,0)}e.drawArrays(e.TRIANGLE_STRIP,0,4),e.deleteBuffer(x),e.deleteBuffer(w),e.disableVertexAttribArray(T),e.disableVertexAttribArray(k)}for(var Ci=16,Ai=new Float32Array(192),_i=new Float32Array(128),Mi=new Float32Array(64),Ii=new Uint16Array(64),Ri=new Uint16Array(Ci),Pi=0;Pi<Ci;Pi++)Ri[Pi]=Pi;var Oi=new Uint16Array(79);for(Pi=0;Pi<Oi.length;Pi++){var Di=(Pi+1)%5;if(Di){var Bi=Math.floor(Pi/5);Oi[Pi]=4*Bi+Di-1}else Oi[Pi]=65535}function Fi(e,t,r,i,a){var n=a.length;if(n>Ci)throw new Error("DrawData size is "+n+", max is "+Ci);for(var o=0;o<n;o++){var s=a[o],c=s.opacity,u=s.matrix,l=s.bbox,h=s.tc,d=s.t,f=s.dx,m=void 0===f?0:f,p=s.dy,g=void 0===p?0:p;Si(e,d,o);var v=Gi(l,t,r,m,g,u),y=v.t1,b=v.t2,x=v.t3,T=v.t4;Ai[12*o]=y.x,Ai[12*o+1]=y.y,Ai[12*o+2]=y.w||1,Ai[12*o+3]=T.x,Ai[12*o+4]=T.y,Ai[12*o+5]=T.w||1,Ai[12*o+6]=b.x,Ai[12*o+7]=b.y,Ai[12*o+8]=b.w||1,Ai[12*o+9]=x.x,Ai[12*o+10]=x.y,Ai[12*o+11]=x.w||1,h?(_i[8*o]=h.x1,_i[8*o+1]=h.y1,_i[8*o+2]=h.x1,_i[8*o+3]=h.y3,_i[8*o+4]=h.x3,_i[8*o+5]=h.y1,_i[8*o+6]=h.x3,_i[8*o+7]=h.y3):(_i[8*o]=0,_i[8*o+1]=1,_i[8*o+2]=0,_i[8*o+3]=0,_i[8*o+4]=1,_i[8*o+5]=1,_i[8*o+6]=1,_i[8*o+7]=0),Mi[4*o]=c,Mi[4*o+1]=c,Mi[4*o+2]=c,Mi[4*o+3]=c,Ii[4*o]=o,Ii[4*o+1]=o,Ii[4*o+2]=o,Ii[4*o+3]=o}var w=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,w),e.bufferData(e.ARRAY_BUFFER,Ai,e.STATIC_DRAW);var k=i.attrib.a_position;e.vertexAttribPointer(k,3,e.FLOAT,!1,0,0),e.enableVertexAttribArray(k);var S=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,S),e.bufferData(e.ARRAY_BUFFER,_i,e.STATIC_DRAW);var E=i.attrib.a_texCoords;e.vertexAttribPointer(E,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(E);var C=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,C),e.bufferData(e.ARRAY_BUFFER,Mi,e.STATIC_DRAW);var A=i.attrib.a_opacity;e.vertexAttribPointer(A,1,e.FLOAT,!1,0,0),e.enableVertexAttribArray(A);var _=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,_),e.bufferData(e.ARRAY_BUFFER,Ii,e.STATIC_DRAW);var M=i.attrib.a_textureIndex;e.vertexAttribPointer(M,1,e.UNSIGNED_SHORT,!1,0,0),e.enableVertexAttribArray(M);var I=i.uniformValue;Ri.forEach(function(t){var r="u_texture["+t+"]";if(I[r]!==t){I[r]=t;var a=i.uniform[r];e.uniform1i(a,t)}});var R=e.createBuffer();e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,R),e.bufferData(e.ELEMENT_ARRAY_BUFFER,Oi,e.STATIC_DRAW),e.drawElements(e.TRIANGLE_STRIP,5*n-1,e.UNSIGNED_SHORT,0)}function Li(e,t){var r=function(){var e=new Float32Array(8),t=new Float32Array(8);return e[0]=-1,e[1]=-1,e[2]=-1,e[3]=1,e[4]=1,e[5]=-1,e[6]=1,e[7]=1,t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=1,t[5]=0,t[6]=1,t[7]=1,{vtPoint:e,vtTex:t}}(),i=r.vtPoint,a=r.vtTex,n=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,n),e.bufferData(e.ARRAY_BUFFER,i,e.STATIC_DRAW);var o=t.attrib.a_position;e.vertexAttribPointer(o,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(o);var s=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,s),e.bufferData(e.ARRAY_BUFFER,a,e.STATIC_DRAW);var c=t.attrib.a_texCoords;return e.vertexAttribPointer(c,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(c),{pointBuffer:n,a_position:o,texBuffer:s,a_texCoords:c}}function Ni(e,t,r,i,a,n){void 0===a&&(a=0),void 0===n&&(n=0);var o=Li(e,t),s=o.pointBuffer,c=o.a_position,u=o.texBuffer,l=o.a_texCoords;Si(e,r,0),Si(e,i,1);var h=t.uniform.u_texture1;e.uniform1i(h,0);var d=t.uniform.u_texture2;e.uniform1i(d,1);var f=t.uniform.u_d;void 0!==f&&e.uniform2f(f,a,n),e.drawArrays(e.TRIANGLE_STRIP,0,4),e.deleteBuffer(s),e.deleteBuffer(u),e.disableVertexAttribArray(c),e.disableVertexAttribArray(l)}function Ui(e,t,r,i,a,n,o,s){void 0===s&&(s=1);var c=Li(e,t),u=c.pointBuffer,l=c.a_position,h=c.texBuffer,d=c.a_texCoords,f=t.uniform.u_xy;e.uniform2f(f,s/i,s/a);var m=ki(e,0,void 0,n,o),p=t.uniform.u_texture;return e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,m,0),Si(e,r,0),e.uniform1i(p,0),e.drawArrays(e.TRIANGLE_STRIP,0,4),e.deleteBuffer(u),e.deleteBuffer(h),e.disableVertexAttribArray(l),e.disableVertexAttribArray(d),m}function zi(e,t,r,i,a,n,o,s,c){void 0===c&&(c=!1);var u=Li(e,t),l=u.pointBuffer,h=u.a_position,d=u.texBuffer,f=u.a_texCoords;if(Math.floor(i)!==t.uniformValue.u_kernel){var m=t.uniform.u_kernel;e.uniform1i(m,Math.floor(i))}if(c!==t.uniformValue.u_limit){var p=t.uniform.u_limit;e.uniform1i(p,c?1:0)}var g=Math.sin(a)*i/s,v=Math.cos(a)*i/o,y=Math.sin(a)*n/s,b=Math.cos(a)*n/o,x=t.uniform.u_velocity;e.uniform4f(x,v,g,b,y);for(var T=t.uniform.u_texture,w=r,k=ki(e,0,void 0,o,s),S=ki(e,0,void 0,o,s),E=0;E<3;E++)e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,[k,S,k][E],0),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),Si(e,[w,k,S][E],0),e.uniform1i(T,0),e.drawArrays(e.TRIANGLE_STRIP,0,4);return e.deleteBuffer(l),e.deleteBuffer(d),e.disableVertexAttribArray(h),e.disableVertexAttribArray(f),e.deleteTexture(S),k}function Wi(e,t,r,i,a,n,o,s){var c=Li(e,t),u=c.pointBuffer,l=c.a_position,h=c.texBuffer,d=c.a_texCoords,f=t.uniform.u_kernel;e.uniform1i(f,a);var m=t.uniform.u_center;e.uniform2f(m,n[0],n[1]);var p=t.uniform.u_ratio;e.uniform1f(p,i);for(var g=r,v=[],y=0;y<1;y++){var b=ki(e,0,void 0,o,s);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,b,0),Si(e,g,0);var x=t.uniform.u_texture;e.uniform1i(x,0),e.drawArrays(e.TRIANGLE_STRIP,0,4),v.push(g),g=b}return e.deleteBuffer(u),e.deleteBuffer(h),e.disableVertexAttribArray(l),e.disableVertexAttribArray(d),v.forEach(function(t){t!==r&&e.deleteTexture(t)}),g}var Vi=Ni;function Hi(e,t,r,i){var a=Li(e,t),n=a.pointBuffer,o=a.a_position,s=a.texBuffer,c=a.a_texCoords;Si(e,r,0);var u=t.uniform.u_texture;e.uniform1i(u,0);var l=t.uniform["u_m[0]"];e.uniform1fv(l,new Float32Array(i)),e.drawArrays(e.TRIANGLE_STRIP,0,4),e.deleteBuffer(n),e.deleteBuffer(s),e.disableVertexAttribArray(o),e.disableVertexAttribArray(c)}function Xi(e,t,r,i,a,n,o){var s=Li(e,t),c=s.pointBuffer,u=s.a_position,l=s.texBuffer,h=s.a_texCoords,d=Math.sin(a)/o,f=Math.cos(a)/n,m=t.uniform.u_velocity;e.uniform2f(m,d,f);var p=Math.floor(i);if(p!==t.uniformValue.u_radius){var g=t.uniform.u_radius;e.uniform1i(g,p)}Si(e,r,0);var v=t.uniform.u_texture;e.uniform1i(v,0),e.drawArrays(e.TRIANGLE_STRIP,0,4),e.deleteBuffer(c),e.deleteBuffer(l),e.disableVertexAttribArray(u),e.disableVertexAttribArray(h)}function ji(e,t,r,i,a,n,o,s){return void 0===s&&(s=!0),i&&1!==i&&(e/=i,t/=i,r/=i),o&&(r/=-o),{x:(e=e===a?0:(e-a)/a)*i,y:(t=t===n?0:s?(n-t)/n:(t-n)/n)*i,z:r*i,w:i}}function Gi(e,t,r,i,a,n,o,s){void 0===i&&(i=0),void 0===a&&(a=0),void 0===o&&(o=0),void 0===s&&(s=0);var c=Tt(e[0]+i,e[1]+a,e[2]+i,e[3]+a,n),u=c.x1,l=c.y1,h=c.z1,d=c.w1,f=c.x2,m=c.y2,p=c.z2,g=c.w2,v=c.x3,y=c.y3,b=c.z3,x=c.w3,T=c.x4,w=c.y4,k=c.z4,S=c.w4,E=Math.max(h||0,p||0,b||0,k||0,Math.sqrt(t*t+r*r));return{t1:ji(u+o,l+s,h||0,d||1,t,r,E),t2:ji(f+o,m+s,p||0,g||1,t,r,E),t3:ji(v+o,y+s,b||0,x||1,t,r,E),t4:ji(T+o,w+s,k||0,S||1,t,r,E)}}var Yi=new WeakMap,qi=new WeakMap,Ki=new WeakMap,$i=new WeakMap,Qi=0,Zi=function(){function e(e,t,r,i){this.id=Qi++,this.gl=e,this.bbox=t.slice(0);var a=t[2],n=t[3];if(this.list=[],r)if(this.available=!0,r instanceof xi){this.canvasCache=r;for(var o=r.list,s=r.w,c=r.h,u=o.length,l=(t[2]-t[0])/s,h=(t[3]-t[1])/c,d=0;d<u;d++){var f=o[d],m=ki(e,0,f.os.canvas);this.list.push({bbox:new Float32Array([f.x*l,f.y*h,Math.min(a,(f.x+f.w)*l),Math.min(n,(f.y+f.h)*h)]),w:f.w,h:f.h,t:m,tc:i})}}else{m=ki(e,0,r);r instanceof HTMLImageElement?(this.image=r,this.list.push({bbox:new Float32Array(t),w:r.width,h:r.height,t:m,tc:i})):r instanceof VideoFrame?(this.videoFrame=r,this.list.push({bbox:new Float32Array(t),w:r.codedWidth,h:r.codedHeight,t:m,tc:i})):r instanceof HTMLCanvasElement&&(this.canvas=r,this.list.push({bbox:new Float32Array(t),w:r.width,h:r.height,t:m,tc:i}))}else this.available=!1}return e.prototype.release=function(){var e=this;return this.image?this.releaseImg(this.image):this.videoFrame?this.releaseVideoFrame(this.videoFrame):this.canvasCache?this.releaseCanvasCache(this.canvasCache):!!this.available&&(this.available=!1,this.list.splice(0).forEach(function(t){t.t&&e.gl.deleteTexture(t.t)}),!0)},e.prototype.releaseImg=function(e){var t=this;if(!this.available)return!1;this.available=!1;var r=qi.get(e);return!!r&&(r.count--,r.count||(qi.delete(e),this.list.splice(0).forEach(function(e){e.t&&t.gl.deleteTexture(e.t)})),!0)},e.prototype.releaseVideoFrame=function(e){var t=this;if(!this.available)return!1;this.available=!1;var r=Ki.get(e);return!!r&&(r.count--,r.count||(Ki.delete(e),this.list.splice(0).forEach(function(e){e.t&&t.gl.deleteTexture(e.t)})),!0)},e.prototype.releaseCanvasCache=function(e){var t=this;if(!this.available)return!1;this.available=!1;var r=Yi.get(e);return!!r&&(r.count--,r.count||(Yi.delete(e),this.list.splice(0).forEach(function(e){e.t&&t.gl.deleteTexture(e.t)})),!0)},e.hasCanvasCacheInstance=function(e){return Yi.has(e)},e.getCanvasCacheInstance=function(t,r,i){var a=Yi.get(r);if(a){a.count++;var n=new e(t,i);n.available=!0,n.canvasCache=r;for(var o=i[2]-i[0],s=i[3]-i[1],c=o/a.w,u=s/a.h,l=i[2],h=i[3],d=a.value,f=d.length,m=0;m<f;m++){var p=d[m];n.list.push({bbox:new Float32Array([p.x*c,p.y*u,Math.min(l,(p.x+p.w)*c),Math.min(h,(p.y+p.h)*u)]),w:p.w,h:p.h,t:p.t})}return n}var g=new e(t,i,r);return Yi.set(r,{value:g.list.map(function(e,t){return{x:r.list[t].x,y:r.list[t].y,w:e.w,h:e.h,t:e.t}}),w:r.w,h:r.h,count:1}),g},e.hasImageCache=function(e){return qi.has(e)},e.getImgInstance=function(t,r,i,a){var n=qi.get(r);if(n){n.count++;var o=new e(t,i);return o.available=!0,o.image=r,o.list=[{bbox:i.slice(0),w:r.width,h:r.height,t:n.t,tc:a}],o}var s=new e(t,i,r,a);return qi.set(r,{t:s.list[0].t,count:1}),s},e.hasVideoFrameInstance=function(e){return Ki.has(e)},e.getVideoFrameInstance=function(t,r,i,a){var n=Ki.get(r);if(n){n.count++;var o=new e(t,i);return o.available=!0,o.videoFrame=r,o.list=[{bbox:i.slice(0),w:r.codedWidth,h:r.codedHeight,t:n.t,tc:a}],o}var s=new e(t,i,r,a);return Ki.set(r,{t:s.list[0].t,count:1}),s},e.getCanvasInstance=function(t,r,i,a){var n=$i.get(r);if(n){n.count++;var o=new e(t,i);return o.available=!0,o.canvas=r,o.list=[{bbox:i.slice(0),w:r.width,h:r.height,t:n.t,tc:a}],o}var s=new e(t,i,r,a);return $i.set(r,{t:s.list[0].t,count:1}),s},e.getEmptyInstance=function(t,r){return new e(t,r)},e}(),Ji=.1,ea="function"==typeof Float32Array;function ta(e,t){return 1-3*t+3*e}function ra(e,t){return 3*t-6*e}function ia(e){return 3*e}function aa(e,t,r){return((ta(t,r)*e+ra(t,r))*e+ia(t))*e}function na(e,t,r){return 3*ta(t,r)*e*e+2*ra(t,r)*e+ia(t)}function oa(e){return e}function sa(e,t,r,i){if(!(0<=e&&e<=1&&0<=r&&r<=1))throw new Error("bezier x values must be in [0, 1] range");if(e===t&&r===i)return oa;for(var a=ea?new Float32Array(11):new Array(11),n=0;n<11;++n)a[n]=aa(n*Ji,e,r);function o(t){for(var i=0,n=1;10!==n&&a[n]<=t;++n)i+=Ji;--n;var o=i+(t-a[n])/(a[n+1]-a[n])*Ji,s=na(o,e,r);return s>=.001?function(e,t,r,i){for(var a=0;a<4;++a){var n=na(t,r,i);if(0===n)return t;t-=(aa(t,r,i)-e)/n}return t}(t,o,e,r):0===s?o:function(e,t,r,i,a){var n,o,s=0;do{(n=aa(o=t+(r-t)/2,i,a)-e)>0?r=o:t=o}while(Math.abs(n)>1e-7&&++s<10);return o}(t,i,i+Ji,e,r)}return function(e){return 0===e||1===e?e:aa(o(e),t,i)}}var ca={linear:sa(1,1,0,0),easeIn:sa(.42,0,1,1),easeOut:sa(0,0,.58,1),ease:sa(.25,.1,.25,1),easeInOut:sa(.42,0,.58,1),cubicBezier:sa,getEasing:function(e,t,r,i){if(4===arguments.length)return sa(e,t,r,i);if(Array.isArray(e)&&4===e.length)return sa(e[0],e[1],e[2],e[3]);if(e){var a=e.toString(),n=void 0;if(/^\s*(?:cubic-bezier\s*)?\(\s*[\d.]+\s*,\s*[-\d.]+\s*,\s*[\d.]+\s*,\s*[-\d.]+\s*\)\s*$/i.test(a)){var o=a.match(/[\d.]+/g);n=sa(parseFloat(o[0]),parseFloat(o[1]),parseFloat(o[2]),parseFloat(o[3]))}return n}}},ua="frame",la="begin",ha={FRAME:ua,BEGIN:la,END:"end"},da=function(e){function r(t,r){var i=e.call(this)||this;return i.node=t,i.duration=r.duration||0,i.direction=r.direction||"forwards",i.fill=r.fill||"none",i.delay=Math.max(0,r.delay||0),i.endDelay=Math.max(0,r.endDelay||0),r.easing&&(v(r.easing)?i.easing=r.easing:Array.isArray(r.easing)?i.easing=ca.getEasing(r.easing):i.easing=ca[r.easing]),i.iterations=r.iterations||1,i.playbackRate=r.playbackRate||1,i._currentTime=0,i.time=0,i._playCount=r.iterationStart||0,i._playState="idle",i.isBegin=0===i._playCount&&!i.delay,i.isEnd=!1,i.isFirstInDelay=!0,i}return t(r,e),r.prototype.play=function(){var e,t=this._playState;"running"!==t&&("finished"!==t&&"idle"!==t||(this._playCount=0,this._currentTime=0,this.time=0,this.isBegin=!this.delay,this.isEnd=!1,this.isFirstInDelay=!0),this._playState="running",null===(e=this.node.root)||void 0===e||e.addAnimation(this))},r.prototype.pause=function(){var e;"paused"!==this._playState&&(this._playState="paused",null===(e=this.node.root)||void 0===e||e.removeAnimation(this))},r.prototype.resume=function(){var e;"paused"===this._playState&&(this._playState="running",null===(e=this.node.root)||void 0===e||e.addAnimation(this))},r.prototype.finish=function(){var e;"finished"!==this._playState&&(this._playCount=this.iterations,this._currentTime=this.delay+this.duration*this._playCount+this.endDelay,this.time=this.duration+this.endDelay,this._playState="finished",null===(e=this.node.root)||void 0===e||e.removeAnimation(this))},r.prototype.cancel=function(){var e;"idle"!==this._playState&&(this._playCount=0,this._currentTime=0,this.time=0,this._playState="idle",null===(e=this.node.root)||void 0===e||e.removeAnimation(this))},r.prototype.remove=function(){var e;this.cancel();var t=this.node.animationList,r=t.indexOf(this);r>-1&&t.splice(r,1),null===(e=this.node.root)||void 0===e||e.aniController.removeAni(this)},r.prototype.gotoAndPlay=function(e){if(this._currentTime!==e||"running"!==this._playState){this.play();var t=this._currentTime;this.currentTime=e,this.onRunning(0,t)}},r.prototype.gotoAndStop=function(e){if(this._currentTime!==e||"paused"!==this._playState){this.pause();var t=this._currentTime;this.currentTime=e,this.onRunning(0,t)}},r.prototype.onRunning=function(e,t){var r=this,i=r.playbackRate,a=r.delay,n=r.endDelay,o=r.duration,s=r.iterations;i>0&&1!==i&&(e*=i),t=null!=t?t:this._currentTime;var c=this._currentTime+=e;if(a&&c<a)this.isFirstInDelay&&this.onFirstInDelay();else{this.isFirstInDelay=!1,a&&t<a&&c>=a&&(this.isBegin=!0),c-=a;var u=Math.min(s-1,Math.floor(c/o));c-=o*u,this.time=c,this._playCount<u&&(this._playCount=u,this.onChangePlayCount(),this.isBegin=!0),this._playCount>=s-1&&(t-=a,t-=o*u,n&&t<o&&c>=o&&c<o+n&&this.onFirstInEndDelay(),t<o&&c>=o&&(this.isEnd=!0),c>=o+n&&this.finish())}},r.prototype.afterRunning=function(){this.emit(ua),this.isFirstInDelay&&(this.isFirstInDelay=!1),this.isBegin&&(this.isBegin=!1,this.emit(la,this._playCount,this.time)),this.isEnd&&(this.isEnd=!1,this.emit("end"))},Object.defineProperty(r.prototype,"currentTime",{get:function(){return this._currentTime},set:function(e){var t=this._currentTime;if(e!==t){var r=this.delay;this._currentTime=e;var i=t-r;this.time=i%this.duration,e<=r&&(this.isBegin=!0),t>=r&&e<r&&(this.isFirstInDelay=!0)}},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"playCount",{get:function(){return this._playCount},set:function(e){if(e!==this._playCount){var t=this._currentTime,r=this.delay;if(t>=r){var i=(t-r)%this.duration;this.currentTime=i+r+e*this.duration,this.time=i}this._playCount=e}},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"playState",{get:function(){return this._playState},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"pending",{get:function(){return"running"!==this._playState},enumerable:!1,configurable:!0}),r}(M),fa=function(e){function r(t,r,i){var a=e.call(this,t,i)||this;return a._keyFrames=[],a._keyFramesR=[],a.currentKeyFrames=a._keyFrames,a.originStyle={},a.initKeyFrames(r),a.setCurrentFrames(),a}return t(r,e),r.prototype.initKeyFrames=function(e){var t=function(e,t,r,i){for(var a=[],n=0,o=0,s=t.length;o<s;o++){var c=t[o];if(y(c.offset)){var u=c.offset;if(u<0||u>1)continue;if(u<=n&&o)continue;n=u}a.push(Object.assign({},c))}if(1===a.length){a.push(Object.assign({},a[0]));var l=Object.assign({},a[0]);1===a[0].offset?(l.offset=0,a.unshift(l)):(l.offset=1,a.push(l))}var h=a[0];h.offset&&h.offset>0?a.unshift({offset:0}):h.offset=0;var d=a[a.length-1];d.offset&&d.offset<1?a.push({offset:1}):d.offset=1;for(o=1,s=a.length;o<s;o++){c=a[o];if(!y(c.offset)){for(var f=void 0,m=o+1;m<s&&!(f=a[m]).offset;m++);for(var p=m-o+1,b=a[o-1],x=(f.offset-b.offset)/p,T=o;T<m;T++)a[T].offset=b.offset+x*(T+1-o);o=m}}var w=[],k={},S=[];for(o=0,s=a.length;o<s;o++){c=a[o];var E=ui.normalize(c);Object.keys(E).forEach(function(e){k.hasOwnProperty(e)||(k[e]=!0,S.push(e))});var C={style:E,time:c.offset*r,easing:i,transition:[],fixed:[]};c.easing&&(v(c.easing)?C.easing=c.easing:Array.isArray(c.easing)?C.easing=ca.getEasing(c.easing):g(c.easing)&&(C.easing=ca[c.easing])),w.push(C)}w.forEach(function(t){var r=t.style;S.forEach(function(t){r.hasOwnProperty(t)||Object.assign(r,ti(e.style,[t]))})});var A=w.map(function(e){return Object.assign({},e,{transition:[],fixed:[]})}).reverse();A.forEach(function(e){e.time=r-e.time});var _=ti(e.style,S);return{keys:S,keyFrames:w,keyFramesR:A,originStyle:_}}(this.node,e,this.duration,this.easing),r=t.keys,i=t.keyFrames,a=t.keyFramesR,n=t.originStyle;this._keyFrames=i,this._keyFramesR=a,ma(this.node,this._keyFrames,r),ma(this.node,this._keyFramesR,r),this.originStyle=n},r.prototype.finish=function(){"finished"!==this._playState&&(e.prototype.finish.call(this),this.onFirstInEndDelay())},r.prototype.cancel=function(){"idle"!==this._playState&&(e.prototype.cancel.call(this),this.node.updateFormatStyle(this.originStyle))},r.prototype.setCurrentFrames=function(){var e=this,t=e.direction,r=e._keyFrames,i=e._keyFramesR,a=e._playCount;this.currentKeyFrames="backwards"===t?i:"alternate"===t?a%2==0?r:i:"alternateReverse"===t&&a%2==0?i:r},r.prototype.onRunning=function(t,r){e.prototype.onRunning.call(this,t,r);var i=this,a=i.duration,n=i.delay,o=i.iterations,s=i.time;if(!(this._currentTime<n)){var c,u=this._playCount>=o-1,l=this.currentKeyFrames,h=l.length;c=2===h?s<a?0:1:function(e,t,r,i){for(;e<t;){if(e===t-1)return i[t].time<=r?t:e;var a=e+(t-e>>1),n=i[a].time;if(n===r)return a;n>r?t=Math.max(a-1,e):e=Math.min(a,t)}return e}(0,h-1,s,l);var d=l[c],f=u&&c===h-1,m=0;if(f);else if(2===h)m=s/a;else{var p=d.time,g=l[c+1].time-p;m=(s-p)/g}if(f);else{d.easing?m=d.easing(m):this.easing&&(m=this.easing(m));var v=d.transition,y=d.fixed,b=d.style,x={};v.forEach(function(e){var t=e.key,r=e.diff;if("opacity"===t||"translateX"===t||"translateY"===t||"translateZ"===t||"scaleX"===t||"scaleY"===t||"rotateX"===t||"rotateY"===t||"rotateZ"===t||"perspective"===t||"perspectiveSelf"===t)(a=Object.assign({},b[t])).v+=r*m,x[t]=a;else if("transformOrigin"===t||"perspectiveOrigin"===t){var i=b[t];(a=[Object.assign({},i[0]),Object.assign({},i[1])])[0].v+=r[0]*m,a[1].v+=r[1]*m,x[t]=a}else if("filter"===t){var a;(a=ti(b,t).filter).forEach(function(e,t){var i=r[t];i&&(e.u===V.GAUSS_BLUR&&(e.v.radius.v+=i.radius*m),e.u===V.RADIAL_BLUR?(e.v.radius.v+=i.radius*m,e.v.center[0].v+=i.center[0]*m,e.v.center[1].v+=i.center[1]*m):e.u===V.MOTION_BLUR?(e.v.radius.v+=i.radius*m,e.v.angle.v+=i.angle*m,e.v.offset.v+=i.offset*m):e.u===V.BLOOM?(e.v.threshold.v+=i.threshold*m,e.v.knee.v+=i.knee*m):e.u===V.LIGHT_DARK?(e.v.radius.v+=i.radius*m,e.v.angle.v+=i.angle*m):e.u!==V.HUE_ROTATE&&e.u!==V.SATURATE&&e.u!==V.BRIGHTNESS&&e.u!==V.CONTRAST&&e.u!==V.SEPIA||(e.v.radius.v+=i.radius*m))}),x[t]=a}}),y.forEach(function(e){x[e]=Object.assign({},b[e])}),this.node.updateFormatStyle(x)}}},r.prototype.onFirstInDelay=function(){var e=this.fill,t=this.node;"backwards"===e||"both"===e?t.updateFormatStyle(this.currentKeyFrames[0].style):t.updateFormatStyle(this.originStyle)},r.prototype.onFirstInEndDelay=function(){var e=this.fill,t=this.node;if("forwards"===e||"both"===e){var r=this.currentKeyFrames;t.updateFormatStyle(r[r.length-1].style)}else t.updateFormatStyle(this.originStyle)},r.prototype.onChangePlayCount=function(){this.setCurrentFrames()},r}(da);function ma(e,t,r){for(var i=function(i,a){var n=t[i-1],o=t[i],s=n.style,c=o.style;r.forEach(function(t){var r=s[t],a=c[t];if("opacity"===t||"scaleX"===t||"scaleY"===t||"rotateX"===t||"rotateY"===t||"rotateZ"===t)n.transition.push({key:t,diff:a.v-r.v});else if("translateX"===t||"translateY"===t||"translateZ"===t||"perspective"===t||"perspectiveSelf"===t)if(r.u===a.u)n.transition.push({key:t,diff:a.v-r.v});else{var u=0;"translateX"===t||"translateZ"===t||"perspective"===t||"perspectiveSelf"===t?u=e.computedStyle.width:"translateY"===t&&(u=e.computedStyle.height),n.transition.push({key:t,diff:pa(r,a,u)})}else if("transformOrigin"===t||"perspectiveOrigin"===t){for(var l=r,h=a,d=[0,0],f=0;f<2;f++)if(l[f].u===h[f].u)d.push(h[f].v-l[f].v);else{u=f?e.computedStyle.height:e.computedStyle.width;n.transition.push({key:t,diff:pa(h[f],l[f],u)})}n.transition.push({key:t,diff:d})}else if("visibility"===t||"overflow"===t)o.fixed.push(t),1===i&&n.fixed.push(t);else if("filter"===t){for(var m=r,p=a,g=!0,v=0,y=Math.min(m.length,p.length);v<y;v++)if(m[v].u!==p[v].u){g=!1;break}if(g){d=[];for(var b=0,x=Math.min(m.length,p.length);b<x;b++){var T=m[b],w=p[b],k={};T.u===V.GAUSS_BLUR?k.radius=w.v.radius.v-T.v.radius.v:T.u===V.RADIAL_BLUR?(k.radius=w.v.radius.v-T.v.radius.v,k.center=[pa(w.v.center[0],T.v.center[0],e.computedStyle.width),pa(w.v.center[1],T.v.center[1],e.computedStyle.height)]):T.u===V.MOTION_BLUR?(k.radius=w.v.radius.v-T.v.radius.v,k.angle=w.v.angle.v-T.v.angle.v,k.offset=w.v.offset.v-T.v.offset.v):T.u===V.BLOOM?(k.threshold=w.v.threshold.v-T.v.threshold.v,k.knee=w.v.knee.v-T.v.knee.v):T.u===V.LIGHT_DARK?(k.radius=w.v.radius.v-T.v.radius.v,k.angle=w.v.angle.v-T.v.angle.v):T.u!==V.HUE_ROTATE&&T.u!==V.SATURATE&&T.u!==V.BRIGHTNESS&&T.u!==V.CONTRAST&&T.u!==V.SEPIA||(k.radius=w.v.radius.v-T.v.radius.v),d.push(k)}n.transition.push({key:t,diff:d})}else o.fixed.push(t),1===i&&n.fixed.push(t)}})},a=1,n=t.length;a<n;a++)i(a)}function pa(e,t,r){if(e.u===V.PX){if(t.u===V.PERCENT)return.01*t.v*r-e.v}else if(e.u===V.PERCENT&&t.u===V.PX)return 100*t.v/r-e.v;return 0}function ga(e){return e.map(function(e){if(Array.isArray(e.v))return e.v.slice(0);var t=e.v;return{t:t.t,d:t.d.slice(0),stops:t.stops.map(function(e){var t=.01*e.offset.v;return{color:e.color.v.slice(0),offset:t}})}})}function va(e){return e.map(function(e){if(Array.isArray(e.v))return e.v.slice(0);var t=e.v;return{t:t.t,d:t.d.slice(0),stops:t.stops.map(function(e){var t=e.offset?.01*e.offset.v:void 0;return{color:e.color.v.slice(0),offset:t}})}})}function ya(e,t,r){return e.map(function(e){var i=e.v,a=e.u;if(a===V.GAUSS_BLUR)return{radius:n=i.radius.u===V.PERCENT?i.radius.v*t*.01:i.radius.v,u:a};if(a===V.RADIAL_BLUR){var n=i.radius.u===V.PERCENT?i.radius.v*t*.01:i.radius.v,o=i.center.map(function(e,i){return e.u===V.PERCENT?e.v*(i?r:t)*.01:e.v});return{radius:n,center:o,u:a}}return a===V.MOTION_BLUR?{radius:n=i.radius.u===V.PERCENT?i.radius.v*t*.01:i.radius.v,angle:i.angle.v,offset:i.offset.v,u:a}:a===V.BLOOM?{threshold:i.threshold.v,knee:i.knee.v,u:a}:a===V.LIGHT_DARK?{radius:i.radius.v,angle:i.angle.v,u:a}:a===V.HUE_ROTATE||a===V.SATURATE||a===V.BRIGHTNESS||a===V.CONTRAST||a===V.SEPIA?{radius:i.radius.v,u:a}:void 0})}function ba(e,t,r,i){if(void 0===r&&(r=0),void 0===i&&(i=0),t&&t.length){for(var a=-1,n=0,o=t.length;n<o;n++){var s=t[n];if(Array.isArray(s)&&s.length){a=n;break}}if(-1!==a){var c=t[a];4===c.length?e.moveTo(c[2]+r,c[3]+i):6===c.length?e.moveTo(c[4]+r,c[5]+i):e.moveTo(c[0]+r,c[1]+i);for(n=a+1,o=t.length;n<o;n++){s=t[n];Array.isArray(s)&&(2===s.length?e.lineTo(s[0]+r,s[1]+i):4===s.length?e.quadraticCurveTo(s[0]+r,s[1]+i,s[2]+r,s[3]+i):6===s.length&&e.bezierCurveTo(s[0]+r,s[1]+i,s[2]+r,s[3]+i,s[4]+r,s[5]+i))}}}}function xa(e){switch(e){case j.MULTIPLY:return"multiply";case j.SCREEN:return"screen";case j.OVERLAY:return"overlay";case j.DARKEN:return"darken";case j.LIGHTEN:return"lighten";case j.COLOR_DODGE:return"color-dodge";case j.COLOR_BURN:return"color-burn";case j.HARD_LIGHT:return"hard-light";case j.SOFT_LIGHT:return"soft-light";case j.DIFFERENCE:return"difference";case j.EXCLUSION:return"exclusion";case j.HUE:return"hue";case j.SATURATION:return"saturation";case j.COLOR:return"color";case j.LUMINOSITY:return"luminosity";default:return"source-over"}}var Ta,wa=0,ka=function(e){function r(t){var r,i=e.call(this)||this;return i.id=wa++,i.props=t,i.uuid=t.uuid||(l.randomUUID&&!r?l.randomUUID():h(r)),i.name=t.name,i.isLocked=!!t.isLocked,i.style=Gr(R(t.style)),i.computedStyle={},i.struct={node:i,num:0,total:0,lv:0,next:0},i.isMounted=!1,i.isDestroyed=!1,i.refreshLevel=ci.REFLOW,i._opacity=0,i.hasCacheOp=!1,i.localOpId=0,i.parentOpId=0,i.transform=at(),i.matrix=at(),i._matrixWorld=at(),i.hasCacheMw=!1,i.localMwId=0,i.parentMwId=0,i.hasContent=!1,i.animationList=[],i.contentLoadingNum=0,i.tempOpacity=1,i.tempMatrix=at(),i}return t(r,e),r.prototype.didMount=function(){var e=this;this.isMounted=!0;var t=this.parent;if(t){this.parentOpId=t.localOpId,this.parentMwId=t.localMwId;var r=this.root=t.root,i=this.uuid;r&&i&&(r.refs[i]=this),this.animationList.forEach(function(t){e.root.aniController.addAni(t)})}},r.prototype.didUnmount=function(){this.clearTexCache(!0),this.isMounted=!1;var e=this.root,t=this.uuid;e&&t&&delete e.refs[t],this.animationList.forEach(function(t){t.cancel(),e.aniController.removeAni(t)}),this.prev=this.next=void 0,this.parent=this.root=void 0},r.prototype.structure=function(e){var t=this.struct;return t.lv=e,[t]},r.prototype.lay=function(e){var t=this.style,r=this.computedStyle,i=t.left,a=t.top,n=t.right,o=t.bottom,s=t.width,c=t.height,u=!1,l=!1,h=!1,d=!1;i.u!==V.AUTO&&(u=!0,r.left=ri(i,e.w)),n.u!==V.AUTO&&(h=!0,r.right=ri(n,e.w)),a.u!==V.AUTO&&(l=!0,r.top=ri(a,e.h)),o.u!==V.AUTO&&(d=!0,r.bottom=ri(o,e.h)),u&&h?r.width=Math.max(0,e.w-r.left-r.right):u?(s.u!==V.AUTO?r.width=Math.max(0,ri(s,e.w)):r.width=0,r.right=e.w-r.left-r.width):h?(s.u!==V.AUTO?r.width=Math.max(0,ri(s,e.w)):r.width=0,r.left=e.w-r.right-r.width):(s.u!==V.AUTO?r.width=Math.max(0,ri(s,e.w)):r.width=0,r.left=0,r.right=e.w-r.width),l&&d?r.height=Math.max(0,e.h-r.top-r.bottom):l?(c.u!==V.AUTO?r.height=Math.max(0,ri(c,e.h)):r.height=0,r.bottom=e.h-r.top-r.height):d?(c.u!==V.AUTO?r.height=Math.max(0,ri(c,e.h)):r.height=0,r.top=e.h-r.bottom-r.height):(c.u!==V.AUTO?r.height=Math.max(0,ri(c,e.h)):r.height=0,r.top=0,r.bottom=e.h-r.height)},r.prototype.layout=function(e){if(this.isDestroyed)throw new Error("Node is destroyed");this.refreshLevel=ci.REFLOW,this.calReflowStyle(),this.lay(e),this.calRepaintStyle(ci.REFLOW),this._rect=void 0},r.prototype.calReflowStyle=function(){var e=this,t=e.style,r=e.computedStyle,i=e.parent;r.fontFamily=t.fontFamily.v,r.fontSize=t.fontSize.v,r.fontWeight=t.fontWeight.v,r.fontStyle=t.fontStyle.v;var a=t.lineHeight;a.u===V.AUTO?r.lineHeight=Kr(r):r.lineHeight=a.v,r.width=r.height=0;var n=t.width,o=t.height;i?(n.u!==V.AUTO&&(r.width=Math.max(0,ri(n,i.width))),o.u!==V.AUTO&&(r.height=Math.max(0,ri(o,i.height)))):(n.u===V.PX&&(r.width=Math.max(0,n.v)),o.u===V.PX&&(r.height=Math.max(0,o.v))),r.letterSpacing=t.letterSpacing.v,r.paragraphSpacing=t.paragraphSpacing.v,r.textAlign=t.textAlign.v,r.textVerticalAlign=t.textVerticalAlign.v},r.prototype.calRepaintStyle=function(e){var t=this.style,r=this.computedStyle;r.visibility=t.visibility.v,r.textDecoration=t.textDecoration.map(function(e){return e.v}),r.textShadow=t.textShadow.v,r.color=t.color.v,r.backgroundColor=t.backgroundColor.v,r.fill=ga(t.fill),r.fillEnable=t.fillEnable.map(function(e){return e.v}),r.fillOpacity=t.fillOpacity.map(function(e){return e.v}),r.fillMode=t.fillMode.map(function(e){return e.v}),r.fillRule=t.fillRule.v,r.stroke=va(t.stroke),r.strokeEnable=t.strokeEnable.map(function(e){return e.v}),r.strokeWidth=t.strokeWidth.map(function(e){return e.v}),r.strokePosition=t.strokePosition.map(function(e){return e.v}),r.strokeMode=t.strokeMode.map(function(e){return e.v}),r.strokeDasharray=t.strokeDasharray.map(function(e){return e.v}),r.strokeLinecap=t.strokeLinecap.v,r.strokeLinejoin=t.strokeLinejoin.v,r.strokeMiterlimit=t.strokeMiterlimit.v,r.mixBlendMode=t.mixBlendMode.v,r.pointerEvents=t.pointerEvents.v,r.objectFit=t.objectFit.v,r.borderTopLeftRadius=t.borderTopLeftRadius.v,r.borderTopRightRadius=t.borderTopRightRadius.v,r.borderBottomLeftRadius=t.borderBottomLeftRadius.v,r.borderBottomRightRadius=t.borderBottomRightRadius.v,r.overflow=t.overflow.v,this.clearTexCache(!0),e&ci.REFLOW_TRANSFORM&&this.calMatrix(e),e&ci.REFLOW_PERSPECTIVE&&this.calPerspective(),e&ci.REFLOW_PERSPECTIVE_SELF&&this.calPerspectiveSelf(),e&ci.REFLOW_OPACITY&&this.calOpacity(),e&ci.REFLOW_FILTER&&this.calFilter(e),e&ci.REFLOW_REPAINT_MASK&&this.calMask(),this._bbox=void 0,this._bboxInt=void 0,this._filterBbox=void 0,this._filterBboxInt=void 0,this.tempBbox=void 0},r.prototype.calMask=function(){var e=this.style,t=this.computedStyle;t.maskMode=e.maskMode.v,t.breakMask=e.breakMask.v;var r=this.prev;if(r&&!t.breakMask&&(r.computedStyle.maskMode?this.mask=r:r.mask&&(this.mask=r.mask)),t.maskMode){this.mask=void 0;for(var i=this.next;i;){if(i.computedStyle.maskMode){i.mask=this;break}if(i.computedStyle.breakMask)break;i.mask=this,i=i.next}}else{var a=t.breakMask?void 0:this.mask;this.mask=a;for(i=this.next;i;){if(i.computedStyle.maskMode){i.mask=a;break}if(i.computedStyle.breakMask)break;i.mask=a,i=i.next}}this.clearMask()},r.prototype.calFilter=function(e){var t,r=this.style,i=this.computedStyle;i.filter=ya(r.filter,i.width,i.height),e<ci.REPAINT&&(this._filterBbox=void 0,this._filterBboxInt=void 0,this.tempBbox=void 0,null===(t=this.textureFilter)||void 0===t||t.release(),this.resetTextureTarget())},r.prototype.calMatrix=function(e){var t=this,r=this,i=r.style,a=r.computedStyle,n=r.matrix,o=r.transform;!this.hasCacheMw&&this.localMwId||(this.hasCacheMw=!1,this.localMwId++);var s=!0;if((e>=ci.REFLOW||e&ci.SCALE_X&&!a.scaleX||e&ci.SCALE_Y&&!a.scaleY||e&ci.ROTATE_Z&&(a.rotateX||a.rotateY||a.skewX||a.skewY)||e&ci.ROTATE_X||e&ci.ROTATE_Y)&&(s=!1),s){if(e&ci.TRANSLATE_X){var c=(u=ri(i.translateX,this.computedStyle.width))-a.translateX;a.translateX=u,o[12]+=c,n[12]+=c}if(e&ci.TRANSLATE_Y){c=(u=ri(i.translateY,this.computedStyle.height))-a.translateY;a.translateY=u,o[13]+=c,n[13]+=c}if(e&ci.ROTATE_Z){var u=i.rotateZ.v;a.rotateZ=u;var l=fr(u),h=Math.sin(l),d=Math.cos(l),f=a.scaleX,m=a.scaleY;n[0]=o[0]=d*f,n[1]=o[1]=h*m,n[4]=o[4]=-h*f,n[5]=o[5]=d*m;var p=(y=a.transformOrigin)[0],g=y[1];n[12]=o[12]+p-o[0]*p-g*o[4],n[13]=o[13]+g-o[1]*p-g*o[5]}if(e&ci.SCALE){if(e&ci.SCALE_X){f=(u=i.scaleX.v)/a.scaleX;a.scaleX=u,o[0]*=f,o[4]*=f,n[0]*=f,n[4]*=f}if(e&ci.SCALE_Y){m=(u=i.scaleY.v)/a.scaleY;a.scaleY=u,o[1]*=m,o[5]*=m,n[1]*=m,n[5]*=m}p=(y=a.transformOrigin)[0],g=y[1];n[12]=o[12]+p-o[0]*p-o[4]*g,n[13]=o[13]+g-o[1]*p-o[5]*g,n[14]=o[14]-o[2]*p-o[6]*g}if(e&ci.TRANSFORM_ORIGIN){var v=i.transformOrigin.map(function(e,r){return ri(e,r?t.computedStyle.height:t.computedStyle.width)});ut(n,y=_r(o,v[0],v[1]))}}else{st(o);v=i.transformOrigin.map(function(e,r){return ri(e,r?t.computedStyle.height:t.computedStyle.width)});a.transformOrigin=v,a.translateX=ri(i.translateX,this.computedStyle.width),a.translateY=ri(i.translateY,this.computedStyle.height),a.translateZ=ri(i.translateZ,this.computedStyle.width);var y,b=i.rotateX?i.rotateX.v:0,x=i.rotateY?i.rotateY.v:0,T=i.rotateZ?i.rotateZ.v:0,w=i.skewX?i.skewX.v:0,k=i.skewY?i.skewY.v:0,S=i.scaleX?i.scaleX.v:1,E=i.scaleY?i.scaleY.v:1;a.rotateX=b,a.rotateY=x,a.rotateZ=T,a.skewX=w,a.skewY=k,a.scaleX=S,a.scaleY=E,Ir({translateX:a.left+a.translateX,translateY:a.top+a.translateY,translateZ:a.translateZ,rotateX:b,rotateY:x,rotateZ:T,skewX:w,skewY:k,scaleX:S,scaleY:E},o),ut(n,y=_r(o,v[0],v[1]))}},r.prototype.calPerspective=function(){var e=this,t=this.style,r=this.computedStyle;!this.hasCacheMw&&this.localMwId||(this.hasCacheMw=!1,this.localMwId++);var i=t.perspectiveOrigin.map(function(t,r){return ri(t,r?e.computedStyle.height:e.computedStyle.width)});r.perspectiveOrigin=i,r.perspective=ri(t.perspective,this.computedStyle.width),r.perspective>=1?this.perspectiveMatrix=Mr(r.perspective,i[0],i[1]):this.perspectiveMatrix=void 0},r.prototype.calPerspectiveSelf=function(){var e=this,t=e.style,r=e.computedStyle,i=e.transform;if(!this.hasCacheMw&&this.localMwId||(this.hasCacheMw=!1,this.localMwId++),r.perspectiveSelf=ri(t.perspectiveSelf,this.computedStyle.width),r.perspectiveSelf>=1){var a=r.transformOrigin;this.perspectiveMatrixSelf=Mr(r.perspectiveSelf,a[0]+i[12],a[1]+i[13])}else this.perspectiveMatrixSelf=void 0},r.prototype.calOpacity=function(){var e=this.style,t=this.computedStyle;!this.hasCacheOp&&this.localOpId||(this.hasCacheOp=!1,this.localOpId++),t.opacity=e.opacity.v},r.prototype.calContent=function(){var e=this.computedStyle;return this.hasContent=e.backgroundColor[3]>0,this.hasContent},r.prototype.calContentLoading=function(){var e=this.computedStyle;return e.width&&e.height?this.contentLoadingNum:0},r.prototype.renderCanvas=function(){var e=this.canvasCache;if(e&&e.available&&e.release(),this.hasContent){var t=this._bboxInt||this.bboxInt,r=t[0],i=t[1],a=t[2]-r,n=t[3]-i;(e=this.canvasCache=new xi(a,n,-r,-i)).available=!0,this.renderCanvasBgc(e)}},r.prototype.renderCanvasBgc=function(e){var t=this.computedStyle.backgroundColor;if(t[3]>0){var r=this.getBackgroundCoords(-e.dx,-e.dy);e.list.forEach(function(e){var i=e.x,a=e.y,n=e.os.ctx;n.fillStyle=fe(t),n.beginPath(),ba(n,r,-i,-a),n.closePath(),n.fill()})}},r.prototype.renderFillStroke=function(e,t,r){var i;if(void 0===t&&(t=!0),void 0===r&&(r=this.computedStyle),e.length){var a=this._bboxInt||this.bboxInt,n=a[0],o=a[1],s=a[2]-n,c=a[3]-o,u=-n,l=-o,h=r.fill,d=r.fillOpacity,f=r.fillRule,m=r.fillEnable,p=r.fillMode,g=r.stroke,v=r.strokeEnable,y=r.strokeWidth,b=r.strokePosition,x=r.strokeMode,T=r.strokeDasharray,w=r.strokeLinecap,k=r.strokeLinejoin,S=r.strokeMiterlimit,E=(null===(i=this.canvasCache)||void 0===i?void 0:i.available)?this.canvasCache:new xi(s,c,u,l);E.available=!0;for(var C=E.list,A=function(r,i){var a=C[r],n=a.x,o=a.y,E=a.os.ctx,A=-n,_=-o;E.setLineDash(T),E.beginPath(),e.forEach(function(e){ba(E,e,A,_)}),t&&E.closePath();for(var M=function(r,i){if(!m[r]||!d[r])return"continue";var a=h[r],n=void 0,o=p[r];if(E.globalAlpha=d[r],Array.isArray(a)){if(a[3]<=0)return"continue";E.fillStyle=fe(a)}else if(a.t===Y.LINEAR){var g=Hr(a.stops,a.d,0,0,s-2*u,c-2*l),v=E.createLinearGradient(g.x1+A,g.y1+_,g.x2+A,g.y2+_);g.stop.forEach(function(e){v.addColorStop(e.offset,fe(e.color))}),E.fillStyle=v}else if(a.t===Y.RADIAL){g=Xr(a.stops,a.d,0,0,s-2*u,c-2*l);var y=E.createRadialGradient(g.cx+A,g.cy+_,0,g.cx+A,g.cy+_,g.total);g.stop.forEach(function(e){y.addColorStop(e.offset,fe(e.color))});var b=g.matrix;if(b){var x=(n=oe.getOffscreenCanvas(s,c)).ctx;x.beginPath(),e.forEach(function(e){ba(x,e,A,_)}),t&&x.closePath(),x.clip(),x.fillStyle=y,x.setTransform(b[0],b[1],b[4],b[5],b[12],b[13]),x.fill(f===K.EVEN_ODD?"evenodd":"nonzero")}else E.fillStyle=y}else if(a.t===Y.CONIC){g=jr(a.stops,a.d,0,0,s-2*u,c-2*l);var T=E.createConicGradient(g.angle,g.cx+A,g.cy+_);g.stop.forEach(function(e){T.addColorStop(e.offset,fe(e.color))}),E.fillStyle=T}o!==j.NORMAL&&(E.globalCompositeOperation=xa(o)),n?(E.drawImage(n.canvas,0,0),n.release()):E.fill(f===K.EVEN_ODD?"evenodd":"nonzero"),o!==j.NORMAL&&(E.globalCompositeOperation="source-over")},I=0,R=h.length;I<R;I++)M(I);E.globalAlpha=1,E.globalCompositeOperation="source-over",w===Q.ROUND?E.lineCap="round":w===Q.SQUARE?E.lineCap="square":E.lineCap="butt",k===Z.ROUND?E.lineJoin="round":k===Z.BEVEL?E.lineJoin="bevel":E.lineJoin="miter",E.miterLimit=S;for(var P=function(r,i){if(!v[r]||!y[r])return"continue";var h=g[r],d=b[r];if(E.globalCompositeOperation=xa(x[r]),Array.isArray(h))E.strokeStyle=fe(h);else if(h.t===Y.LINEAR){var f=Hr(h.stops,h.d,0,0,s+2*n,c+2*o),m=E.createLinearGradient(f.x1+A,f.y1+_,f.x2+A,f.y2+_);f.stop.forEach(function(e){m.addColorStop(e.offset,fe(e.color))}),E.strokeStyle=m}else if(h.t===Y.RADIAL){f=Xr(h.stops,h.d,0,0,s-2*u,c-2*l);var p=E.createRadialGradient(f.cx+A,f.cy+_,0,f.cx+A,f.cy+_,f.total);f.stop.forEach(function(e){p.addColorStop(e.offset,fe(e.color))});var T=f.matrix;if(T){var w=oe.getOffscreenCanvas(a.w,a.h),k=w.ctx;return k.setLineDash(E.getLineDash()),k.lineCap=E.lineCap,k.lineJoin=E.lineJoin,k.miterLimit=E.miterLimit,k.lineWidth=y[r],k.strokeStyle="#FFF",k.beginPath(),e.forEach(function(e){ba(k,e,A,_)}),t&&k.closePath(),d===J.INSIDE&&t?(k.lineWidth=2*y[r],k.save(),k.clip(),k.stroke(),k.restore()):d===J.OUTSIDE&&t?(k.lineWidth=2*y[r],k.stroke(),k.save(),k.clip(),k.globalCompositeOperation="destination-out",k.strokeStyle="#FFF",k.stroke(),k.restore()):k.stroke(),k.fillStyle=p,k.globalCompositeOperation="source-in",k.setTransform(T[0],T[1],T[4],T[5],T[12],T[13]),k.fillRect(0,0,s,c),E.drawImage(w.canvas,0,0),w.release(),"continue"}E.strokeStyle=p}else if(h.t===Y.CONIC){f=jr(h.stops,h.d,0,0,s-2*u,c-2*l);var S=E.createConicGradient(f.angle,f.cx+A,f.cy+_);f.stop.forEach(function(e){S.addColorStop(e.offset,fe(e.color))}),E.strokeStyle=S}var C,M=void 0;d===J.INSIDE&&t?E.lineWidth=2*y[r]:d===J.OUTSIDE&&t?(M=oe.getOffscreenCanvas(a.w,a.h),(C=M.ctx).setLineDash(E.getLineDash()),C.lineCap=E.lineCap,C.lineJoin=E.lineJoin,C.miterLimit=E.miterLimit,C.strokeStyle=E.strokeStyle,C.lineWidth=2*y[r],C.beginPath(),e.forEach(function(e){ba(C,e,A,_)})):E.lineWidth=y[r],t&&C&&C.closePath(),d===J.INSIDE&&t?(E.save(),E.clip(),E.stroke(),E.restore()):d===J.OUTSIDE&&t?(C.stroke(),C.save(),C.clip(),C.globalCompositeOperation="destination-out",C.strokeStyle="#FFF",C.stroke(),C.restore(),E.drawImage(M.canvas,0,0),M.release()):E.stroke()},O=(I=0,g.length);I<O;I++)P(I);E.globalCompositeOperation="source-over"},_=0,M=C.length;_<M;_++)A(_)}},r.prototype.genTexture=function(e){var t;this.renderCanvas(),null===(t=this.textureCache)||void 0===t||t.release();var r=this.canvasCache;(null==r?void 0:r.available)?(this.textureTarget=this.textureCache=new Zi(e,this._bboxInt||this.bboxInt,r),r.release()):this.textureTarget=this.textureCache=void 0},r.prototype.resetTextureTarget=function(){var e=this,t=e.textureCache,r=e.textureTotal,i=e.textureFilter;(null==i?void 0:i.available)&&(this.textureTarget=i),(null==r?void 0:r.available)&&(this.textureTarget=r),(null==t?void 0:t.available)&&(this.textureTarget=t)},r.prototype.updateStyle=function(e,t){var r=Gr(e);return this.updateFormatStyle(r,t)},r.prototype.updateFormatStyle=function(e,t){var r,i=this.updateFormatStyleData(e);return i.length||t&&t(!0),null===(r=this.root)||void 0===r?void 0:r.addUpdate(this,i,void 0,t)},r.prototype.updateFormatStyleData=function(e){var t=[];for(var r in e)e.hasOwnProperty(r)&&(ei(e,this.style,r)||(this.style[r]=e[r],t.push(r)));return t},r.prototype.clearTexCache=function(e){var t,r,i;void 0===e&&(e=!1),e&&(this.refreshLevel|=ci.REPAINT,null===(t=this.textureCache)||void 0===t||t.release()),null===(r=this.textureTotal)||void 0===r||r.release(),null===(i=this.textureFilter)||void 0===i||i.release()},r.prototype.clearTexCacheUpward=function(e){void 0===e&&(e=!1);for(var t=this.parent;t;)t.clearTexCache(e),t=t.parent},r.prototype.clearMask=function(e){var t;if(void 0===e&&(e=!0),null===(t=this.textureMask)||void 0===t||t.release(),this.resetTextureTarget(),this.struct.next=0,this.refreshLevel|=ci.MASK,e)for(var r=this.parent;r&&r!==this.root;)r.clearTexCache(),r._rect=void 0,r._bbox=void 0,r._bboxInt=void 0,r._filterBbox=void 0,r._filterBboxInt=void 0,r.tempBbox=void 0,r=r.parent},r.prototype.refresh=function(e,t){var r;void 0===e&&(e=ci.REPAINT),null===(r=this.root)||void 0===r||r.addUpdate(this,[],e,t)},r.prototype.getBackgroundCoords=function(e,t){void 0===e&&(e=0),void 0===t&&(t=0);var r=this.computedStyle,i=r.borderTopLeftRadius,a=r.borderTopRightRadius,n=r.borderBottomLeftRadius,o=r.borderBottomRightRadius,s=Math.min(.5*r.width,.5*r.height),c=Math.min(s,i),u=Math.min(s,a),l=Math.min(s,n),h=Math.min(s,o);return 0===c&&0===u&&0===l&&0===h?[[e,t],[r.width,t],[r.width,r.height],[e,r.height],[e,t]]:[[c,t],[r.width-u,t],[r.width-u+u*br,t,r.width,u*br,r.width,u],[r.width,r.height-h],[r.width,r.height-h+h*br,r.width-h+h*br,r.height,r.width-h,r.height],[l,r.height],[l*br,r.height,e,r.height-l+l*br,e,r.height-l],[e,c],[e,c-c*br,c-c*br,t,c,t]]},r.prototype.getStyle=function(){return C(this.style)},r.prototype.getComputedStyle=function(){var e=Object.assign({},this.computedStyle);return this.isMounted&&(e.color=e.color.slice(0),e.backgroundColor=e.backgroundColor.slice(0),e.fill=C(e.fill),e.stroke=C(e.stroke),e.fillOpacity=e.fillOpacity.slice(0),e.fillEnable=e.fillEnable.slice(0),e.fillMode=e.fillMode.slice(0),e.strokeEnable=e.strokeEnable.slice(0),e.strokeWidth=e.strokeWidth.slice(0),e.transformOrigin=e.transformOrigin.slice(0),e.strokeDasharray=e.strokeDasharray.slice(0)),e},r.prototype.getCssStyle=function(e){var t=this;void 0===e&&(e=!1);var r=this.style,i=this.computedStyle,a={};return["top","right","bottom","left","width","height","translateX","translateY","scaleX","scaleY","rotateZ","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"].forEach(function(e){var t=r[e];t.u===V.AUTO?a[e]="auto":t.u===V.PERCENT?a[e]=t.v+"%":t.u!==V.PX&&t.u!==V.NUMBER&&t.u!==V.DEG||(a[e]=t.v)}),a.opacity=r.opacity.v,a.visibility=r.visibility.v===te.VISIBLE?"visible":"hidden",a.color=fe(r.color.v),a.backgroundColor=fe(r.backgroundColor.v),a.fontStyle=["normal","italic","oblique"][r.fontStyle.v],a.textAlign=["left","right","center","justify"][r.textAlign.v],a.textVerticalAlign=["top","middle","bottom"][r.textVerticalAlign.v],a.mixBlendMode=ai(r.mixBlendMode.v),a.objectFit=["fill","contain","cover"][r.objectFit.v],["strokeEnable","fillEnable","fillOpacity","strokeWidth"].forEach(function(e){a[e]=r[e].map(function(e){return e.v})}),e?this.isMounted?a.fill=i.fill.map(function(e){return ni(e,t.width,t.height,!0)}):oe.error("Can not get CSS standard fill unmounted"):a.fill=ga(r.fill).map(function(e){return ni(e)}),a.fillRule=["nonzero","evenodd"][r.fillRule.v],a.fillMode=r.fillMode.map(function(e){return ai(e.v)}),e?this.isMounted?a.stroke=i.stroke.map(function(e){return ni(e,t.width,t.height,!0)}):oe.error("Can not get CSS standard stroke unmounted"):a.stroke=va(r.stroke).map(function(e){return ni(e,t.width,t.height)}),a.strokeLinecap=["butt","round","square"][r.strokeLinecap.v],a.strokeLinejoin=["miter","round","bevel"][r.strokeLinejoin.v],a.strokePosition=r.strokePosition.map(function(e){return oi(e.v)}),a.strokeMiterlimit=r.strokeMiterlimit.v,a.strokeDasharray=r.strokeDasharray.map(function(e){return e.v}),a.strokeMode=r.strokeMode.map(function(e){return ai(e.v)}),a.transformOrigin=r.transformOrigin.map(function(e){return e.u===V.PERCENT?e.v+"%":e}),a.overflow=["visible","hidden"][r.overflow.v],a.filter=ya(r.filter,i.width,i.height).map(function(e){return(t=e).u===V.GAUSS_BLUR?"gaussBlur("+t.radius+")":t.u===V.RADIAL_BLUR?"radialBlur("+t.radius+","+t.center.join(", ")+")":t.u===V.MOTION_BLUR?"motionBlur("+t.radius+","+t.offset+")":t.u===V.BLOOM?"bloom("+t.threshold+","+t.knee+")":t.u===V.LIGHT_DARK?"lightDark("+t.radius+","+t.angle+")":void 0;var t}),a},r.prototype.isParent=function(e){for(var t=this.parent;t;){if(t===e)return!0;t=t.parent}return!1},r.prototype.isChild=function(e){return e.isParent(this)},r.prototype.insertAfter=function(e,t){e.remove();var r=this.root,i=this.parent;if(!i)throw new Error("Can not appendSelf without parent");e.parent=i,e.prev=this,this.next&&(this.next.prev=e),e.next=this.next,this.next=e,e.root=r;var a=i.children,n=a.indexOf(this);a.splice(n+1,0,e),i.isDestroyed?t&&t(!0):(i.insertStruct(e,n+1),r.addUpdate(e,[],ci.ADD_DOM,t))},r.prototype.insertBefore=function(e,t){e.remove();var r=this.root,i=this.parent;if(!i)throw new Error("Can not prependBefore without parent");e.parent=i,e.prev=this.prev,this.prev&&(this.prev.next=e),e.next=this,this.prev=e,e.root=r;var a=i.children,n=a.indexOf(this);a.splice(n,0,e),i.isDestroyed?t&&t(!0):(i.insertStruct(e,n),r.addUpdate(e,[],ci.ADD_DOM,t))},r.prototype.remove=function(e){var t=this.root,r=this.parent;if(r){var i=r.children.indexOf(this);if(-1===i)throw new Error("Invalid index of remove()");r.children.splice(i,1);var a=this.prev,n=this.next;a&&(a.next=n),n&&(n.prev=a),r.deleteStruct(this)}t&&this.isMounted?t.addUpdate(this,[],ci.REMOVE_DOM,e):e&&e(!0)},r.prototype.getBoundingClientRect=function(e){var t=(null==e?void 0:e.includeBbox)?this._bbox||this.bbox:this._rect||this.rect,r=Tt(t[0],t[1],t[2],t[3],this.matrixWorld),i=r.x1,a=r.y1,n=r.x2,o=r.y2,s=r.x3,c=r.y3,u=r.x4,l=r.y4,h=Math.min(i,n,s,u),d=Math.min(a,o,c,l),f=Math.max(i,n,s,u),m=Math.max(a,o,c,l);return{left:h,top:d,right:f,bottom:m,width:f-h,height:m-d,points:[{x:i,y:a},{x:n,y:o},{x:s,y:c},{x:u,y:l}]}},r.prototype.getOffsetRect=function(){var e=this.computedStyle,t=e.left+e.translateX,r=e.top+e.translateY;return{left:t,top:r,right:t+this.width,bottom:r+this.height}},r.prototype.startSizeChange=function(){var e=this,t=e.width,r=e.height,i=e.style,a=e.computedStyle,n=e.parent;if(e.isDestroyed||!n)throw new Error("Can not resize a destroyed Node or Root");var o=i.left,s=i.right,c=i.top,u=i.bottom,l=i.translateX,h=i.translateY,d=n.width,f=n.height;if(l.v&&l.u===V.PERCENT){var m=l.v*t*.01;o.u===V.PERCENT?o.v+=100*m/d:o.u===V.PX&&(o.v+=m),a.left+=m,s.u===V.PERCENT?s.v-=100*m/d:s.u===V.PX&&(s.v-=m),a.right-=m,l.v=0}if(h.v&&h.u===V.PERCENT){m=h.v*r*.01;c.u===V.PERCENT?c.v+=100*m/f:c.u===V.PX&&(c.v+=m),a.top+=m,u.u===V.PERCENT?u.v-=100*m/f:u.u===V.PX&&(u.v-=m),a.bottom-=m,h.v=0}},r.prototype.endSizeChange=function(e){var t=e.translateX,r=e.translateY,i=this,a=i.style,n=i.computedStyle,o=i.parent,s=i.width,c=i.height,u=a.left,l=a.right,h=a.top,d=a.bottom,f=o,m=f.width,p=f.height;if(t.v&&t.u===V.PERCENT){var g=t.v*s*.01;u.u===V.PX?u.v-=g:u.u===V.PERCENT&&(u.v-=100*g/m),n.left-=g,l.u===V.PX?l.v+=g:l.u===V.PERCENT&&(l.v+=100*g/m),n.right+=g,n.translateX+=g}if(r.v&&r.u===V.PERCENT){g=r.v*c*.01;h.u===V.PX?h.v-=g:a.top.u===V.PERCENT&&(h.v-=100*g/p),n.top-=g,d.u===V.PX?d.v+=g:d.u===V.PERCENT&&(d.v+=100*g/p),n.bottom+=g,n.translateY+=g}a.translateX.v=t.v,a.translateX.u=t.u,a.translateY.v=r.v,a.translateY.u=r.u},r.prototype.endPosChange=function(e,t,r){var i=this,a=i.style,n=i.computedStyle,o=i.parent;if(o){var s=e.translateX,c=e.translateY,u=a.top,l=a.right,h=a.bottom,d=a.left,f=o.width,m=o.height;t&&(d.u===V.PX?d.v+=t:d.u===V.PERCENT&&(d.v+=100*t/f),n.left+=t,l.u===V.PX?l.v-=t:l.u===V.PERCENT&&(l.v-=100*t/f),n.right-=t,n.translateX-=t),r&&(u.u===V.PX?u.v+=r:u.u===V.PERCENT&&(u.v+=100*r/m),n.top+=r,h.u===V.PX?h.v-=r:h.u===V.PERCENT&&(h.v-=100*r/m),n.bottom-=r,n.translateY-=r),a.translateX.v=s.v,a.translateX.u=s.u,a.translateY.v=c.v,a.translateY.u=c.u}},r.prototype.adjustPosAndSizeSelf=function(e,t,r,i){var a=this,n=a.style,o=a.computedStyle,s=a.parent,c=a.root;if(s&&c&&(e||t||r||i)){var u=s.width,l=s.height,h=n.top,d=n.right,f=n.bottom,m=n.left,p=n.width,g=n.height,v=n.translateX,y=n.translateY,b=(e||r)&&v.u===V.PERCENT&&v.v;if(b){var x=.01*b*this.width;m.u===V.PX?m.v+=x:m.u===V.PERCENT&&(m.v+=100*x/u),o.left+=x,d.u===V.PX?d.v-=x:d.u===V.PERCENT&&(d.v-=100*x/u),o.right-=x}if(e&&(m.u===V.PX?m.v+=e:m.u===V.PERCENT&&(m.v+=100*e/u),o.left+=e),r&&(d.u===V.PX?d.v-=r:d.u===V.PERCENT&&(d.v-=100*r/u),o.right-=r),r-e&&(p.u===V.PX?p.v=r+this.width-e:p.u===V.PERCENT&&(p.v=100*(r+this.width-e)/s.width),o.width=s.width-o.left-o.right),this.width<0){o.width=-this.width;var T=o.left,w=o.right;o.left=u-w,m.u===V.PX?m.v=o.left:m.u===V.PERCENT&&(m.v=100*o.left/u),o.right=u-T,d.u===V.PX?d.v=o.right:d.u===V.PERCENT&&(d.v=100*o.right/u)}if(b){x=.01*b*this.width;m.u===V.PX?m.v-=x:m.u===V.PERCENT&&(m.v-=100*x/u),o.left-=x,d.u===V.PX?d.v+=x:d.u===V.PERCENT&&(d.v+=100*x/u),o.right+=x}var k=(t||i)&&y.u===V.PERCENT&&y.v;if(k){x=.01*k*this.height;h.u===V.PX?h.v+=x:h.u===V.PERCENT&&(h.v+=100*x/l),o.top+=x,f.u===V.PX?f.v-=x:f.u===V.PERCENT&&(f.v-=100*x/l),o.bottom-=x}if(t&&(h.u===V.PX?h.v+=t:h.u===V.PERCENT&&(h.v+=100*t/l),o.top+=t),i&&(f.u===V.PX?f.v-=i:f.u===V.PERCENT&&(f.v-=100*i/l),o.bottom-=i),i-t&&(g.u===V.PX?g.v=i+this.height-t:g.u===V.PERCENT&&(g.v=100*(i+this.height-t)/s.height),o.height=s.height-o.top-o.bottom),this.height<0){o.height=-this.height;var S=o.top,E=o.bottom;o.top=l-S,h.u===V.PX?h.v=o.top:h.u===V.PERCENT&&(h.v=100*o.top/l),o.bottom=l-E,f.u===V.PX?f.v=o.bottom:f.u===V.PERCENT&&(f.v=100*o.bottom/l)}if(k){x=.01*k*this.height;h.u===V.PX?h.v-=x:h.u===V.PERCENT&&(h.v-=100*x/l),o.top-=x,f.u===V.PX?f.v+=x:f.u===V.PERCENT&&(f.v+=100*x/l),o.bottom+=x}this.refreshLevel|=ci.TRANSFORM_ALL,c.rl|=ci.TRANSFORM_ALL,this.calMatrix(ci.TRANSFORM_ALL),this._rect=void 0,this._bbox=void 0,this._bboxInt=void 0,this._filterBbox=void 0,this._filterBboxInt=void 0,this.tempBbox=void 0}},r.prototype.checkPosSizeUpward=function(){for(var e=this.root,t=this.parent;t&&t!==e&&t.adjustPosAndSize();)t=t.parent},r.prototype.adjustPosAndSize=function(){return!1},r.prototype.initAnimate=function(e,t){this.animationList.push(e);var r=this.root;return this.isDestroyed||!r?(e.cancel(),e):(r.aniController.addAni(e),t.autoPlay?e.play():"backwards"!==t.fill&&"both"!==t.fill||e.gotoAndStop(0),e)},r.prototype.animate=function(e,t){var r=new fa(this,e,t);return this.initAnimate(r,t)},r.prototype.release=function(){this.remove(),this.animationList.splice(0).forEach(function(e){return e.remove()}),this.clearTexCache()},r.prototype.cloneProps=function(){var e=Object.assign({},this.props);return e.name=this.name,e.style=this.getCssStyle(),e},r.prototype.clone=function(){return new r(this.cloneProps())},Object.defineProperty(r.prototype,"width",{get:function(){return this.computedStyle.width||0},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"height",{get:function(){return this.computedStyle.height||0},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"matrixWorld",{get:function(){var e,t=this.root,r=this._matrixWorld;if(!t)return r;for(var i=this,a=this.hasCacheMw,n=i.parent,o=-1,s=[];n;)s.push(n),n.hasCacheMw&&n.localMwId===i.parentMwId||(a=!1,o=s.length),i=n,n=n.parent;if(!a){if(o>-1){s.splice(o),s.reverse();for(var c=0,u=s.length;c<u;c++){var l=s[c];if(l.hasCacheMw&&l.parentMwId!==(null===(e=l.parent)||void 0===e?void 0:e.localMwId)&&l.localMwId++,l.hasCacheMw=!0,l===t)ut(l._matrixWorld,l.matrix);else{var h=l.parent.perspectiveMatrix,d=l.perspectiveMatrixSelf,f=l.matrix;d&&(f=ot(d,f)),h&&(f=ot(h,f));var m=ot(l.parent._matrixWorld,f);ut(l._matrixWorld,m),l.parentMwId=l.parent.localMwId}}}if(this.hasCacheMw&&this.localMwId++,this.hasCacheMw=!0,n=this.parent){h=n.perspectiveMatrix,d=this.perspectiveMatrixSelf,f=this.matrix;d&&(f=ot(d,f)),h&&(f=ot(h,f)),ut(r,m=ot(n._matrixWorld,f)),this.parentMwId=n.localMwId}else{ut(r,(d=this.perspectiveMatrixSelf)?ot(d,this.matrix):this.matrix)}}return r},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"rect",{get:function(){var e=this._rect;return e||((e=this._rect=new Float32Array(4))[0]=0,e[1]=0,e[2]=this.computedStyle.width,e[3]=this.computedStyle.height),e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"bbox",{get:function(){var e=this._bbox;if(!e){var t=this._rect||this.rect;e=this._bbox=t.slice(0)}return e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"filterBbox",{get:function(){var e=this._filterBbox;if(!e){var t=this._bbox||this.bbox;e=this._filterBbox=t.slice(0)}return e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"bboxInt",{get:function(){var e=this._bboxInt;return e||mi(e=this._bboxInt=(this._bbox||this.bbox).slice(0)),e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"filterBboxInt",{get:function(){var e=this._filterBboxInt;return e||mi(e=this._filterBboxInt=(this._filterBbox||this.filterBbox).slice(0)),e},enumerable:!1,configurable:!0}),r}(M);!function(e){e[e.NONE=0]="NONE",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED"}(Ta||(Ta={}));var Sa={};function Ea(e,t){return i(this,void 0,void 0,function(){var r,i,n,o,s,c,u,l,h;return a(this,function(a){switch(a.label){case 0:if(r=Sa[e]){if(r.count++,r.state===Ta.LOADED)return[2,r.res];if(r.state===Ta.LOADING)return[2,new Promise(function(e){r.list.push(e)})]}return r=Sa[e]={state:Ta.LOADING,list:[],count:0,res:{success:!1,frames:[],width:0,height:0,release:function(){r.count--,r.count<=0&&(r.res.source&&URL.revokeObjectURL(r.res.source.src),r.res.frames.forEach(function(e){return e.close()}),delete Sa[e])}}},[4,fetch(e,Object.assign({mode:"cors"},t))];case 1:return 200!==(i=a.sent()).status&&304!==i.status?(r.state=Ta.LOADED,[2,r.res]):[4,i.arrayBuffer()];case 2:return n=a.sent(),"undefined"==typeof ImageDecoder?[3,9]:function(e){var t=[71,73,70,56,55,97];return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&(e[4]===t[4]||57===e[4])&&e[5]===t[5]}(new Uint8Array(n))?[4,(o=new ImageDecoder({data:n,type:"image/gif"})).tracks.ready]:[3,9];case 3:if(a.sent(),!(s=o.tracks.selectedTrack))return[3,8];c=0,a.label=4;case 4:return c<s.frameCount?[4,o.decode({frameIndex:c})]:[3,7];case 5:u=a.sent(),r.res.frames.push(u.image),a.label=6;case 6:return c++,[3,4];case 7:return r.state=Ta.LOADED,r.res.success=!0,r.res.width=r.res.frames[0].codedWidth,r.res.height=r.res.frames[0].codedHeight,r.count++,r.list.splice(0).forEach(function(e){r.count++,e(r.res)}),o.close(),[2,r.res];case 8:o.close(),a.label=9;case 9:return l=new Blob([n]),(h=new Image).src=URL.createObjectURL(l),r.count++,[2,new Promise(function(e){h.onload=function(){r.state=Ta.LOADED,r.res.success=!0,r.res.source=h,r.res.width=h.width,r.res.height=h.height,e(r.res),r.list.splice(0).forEach(function(e){r.count++,e(r.res)})},h.onerror=function(){r.state=Ta.LOADED,e(r.res),r.list.splice(0).forEach(function(e){r.count++,e(r.res)})}})]}})})}var Ca=function(e){function r(t,r,i){var a=e.call(this,t,i)||this;return a.node=t,a._frameArea=r,a._frameAreaR=r.slice(0).reverse(),a.currentFrameArea=a._frameArea,a.originFrameIndex=t.frameIndex,a.setCurrentFrameArea(),a}return t(r,e),r.prototype.setCurrentFrameArea=function(){var e=this.direction,t=this._playCount;this.currentFrameArea="backwards"===e?this._frameAreaR:"alternate"===e?t%2==0?this._frameArea:this._frameAreaR:"alternateReverse"===e&&t%2==0?this._frameAreaR:this._frameArea},r.prototype.finish=function(){"finished"!==this._playState&&(e.prototype.finish.call(this),this.onFirstInEndDelay())},r.prototype.cancel=function(){"idle"!==this._playState&&(e.prototype.cancel.call(this),this.node.frameIndex=this.originFrameIndex)},r.prototype.onRunning=function(t){e.prototype.onRunning.call(this,t);var r=this,i=r.node,a=r.duration,n=r.delay,o=r.iterations,s=r.currentFrameArea,c=r.time;if(!(this._currentTime<n)){var u=this._playCount>=o-1,l=c/a;this.easing&&(l=this.easing(l)),u&&l>=1||(i.frameIndex=Math.floor(s[0]+(s[1]-s[0])*l))}},r.prototype.onFirstInDelay=function(){var e=this,t=e.fill,r=e.currentFrameArea,i=e.node;"backwards"!==t&&"both"!==t||(i.frameIndex=r[0])},r.prototype.onFirstInEndDelay=function(){var e=this.fill,t=this.node;if("forwards"===e||"both"===e){var r=this.currentFrameArea;t.frameIndex=r[r.length-1]}else t.frameIndex=this.originFrameIndex},r.prototype.onChangePlayCount=function(){this.setCurrentFrameArea()},r}(da),Aa="refresh_complete",_a="waiting",Ma="can_play",Ia="meta",Ra="error",Pa="load",Oa=function(e){function r(t){var r=e.call(this,t)||this;t.onLoad&&(r.onLoad=t.onLoad),r._frameIndex=t.frameIndex||0,r.isPure=!0;var i=r._src=t.src||"";if(i){var a=function(){if(r.isMounted){var e=r.style,t=e.left,i=e.top,a=e.right,n=e.bottom,o=e.width,s=e.height;(t.u===V.AUTO||a.u===V.AUTO)&&o.u===V.AUTO||(i.u===V.AUTO||n.u===V.AUTO)&&s.u===V.AUTO?r.refresh(ci.REFLOW):r.refresh()}r.onLoad&&r.onLoad(),r.emit(Pa)},n=function(e){var t=Sa[e];if((null==t?void 0:t.state)===Ta.LOADED)return t.res}(i);n?n.success&&(r.loader=n,a()):(r.contentLoadingNum=1,Ea(i).then(function(e){r.loader=e,r.contentLoadingNum=0,e.success&&a()}))}return r}return t(r,e),r.prototype.lay=function(t){e.prototype.lay.call(this,t);var r=this,i=r.style,a=r.computedStyle,n=r.loader,o=i.left,s=i.top,c=i.right,u=i.bottom,l=i.width,h=i.height;if(n){var d=(o.u===V.AUTO||c.u===V.AUTO)&&l.u===V.AUTO,f=(s.u===V.AUTO||u.u===V.AUTO)&&h.u===V.AUTO;d&&(a.width=f?n.width:n.width*a.height/n.height,o.u===V.AUTO&&c.u===V.AUTO?(a.left=0,a.right=t.w-a.width):o.u===V.AUTO?a.left=t.w-a.right-a.width:c.u===V.AUTO&&(a.right=t.w-a.left-a.width)),f&&(a.height=d?n.height:n.height*a.width/n.width,s.u===V.AUTO&&u.u===V.AUTO?(a.top=0,a.bottom=t.h-a.height):s.u===V.AUTO?a.top=t.h-a.bottom-a.height:u.u===V.AUTO&&(a.bottom=t.h-a.top-a.height))}},r.prototype.calRepaintStyle=function(t){e.prototype.calRepaintStyle.call(this,t);var r=this.computedStyle,i=this.loader;if(this.isPure=r.backgroundColor[3]<=0,this.isPure&&(null==i?void 0:i.success)){var a=r.objectFit,n=r.borderTopLeftRadius,o=r.borderTopRightRadius,s=r.borderBottomLeftRadius,c=r.borderBottomRightRadius;if(a!==ae.COVER&&a!==ae.FILL||!(n||o||s||c)){if(a===ae.CONTAIN&&(n||o||s||c)){var u=i.width/i.height,l=r.width/r.height;if(l>u){var h=r.height*u,d=.5*(r.width-h);(n>d||o>d||s>d||c>d)&&(this.isPure=!1)}else if(l<u){var f=r.width/u,m=.5*(r.height-f);(n>m||o>m||s>m||c>m)&&(this.isPure=!1)}else this.isPure=!1}}else this.isPure=!1}},r.prototype.calContent=function(){this.hasContent=!1;var e=this.loader;return(null==e?void 0:e.success)?e.frames.length?this._frameIndex>=0&&this._frameIndex<e.frames.length&&(this.hasContent=!0):e.source&&(this.hasContent=!0):this.hasContent=this.computedStyle.backgroundColor[3]>0,this.hasContent},r.prototype.renderCanvas=function(){var t,r,i=this,a=i.isPure,n=i.loader,o=i.computedStyle;if(a){if(null===(t=this.canvasCache)||void 0===t||t.release(),null==n?void 0:n.success){var s=n.width,c=n.height;if(n.frames.length){var u=Math.min(n.frames.length-1,Math.max(0,this._frameIndex));if((Q=n.frames[u])&&(s>L.maxTextureSize||c>L.maxTextureSize))if((R=this.canvasCache=xi.getVideoFrameInstance(s,c,Q)).available=!0,1===R.getCount()){var l=o.width,h=o.height,d=o.objectFit,f=0,m=0,p=n.width/n.height,g=l/h;if(d===ae.CONTAIN){if(g>p){var v=h*p;f=.5*(l-v),l=v}else if(g<p){var y=l/p;m=.5*(h-y),h=y}}else if(d===ae.COVER)if(g>p){var b=l/p;m=.5*(h-b),h=b}else if(g<p){var x=h*p;f=.5*(l-x),l=x}for(var T=0,w=(U=R.list).length;T<w;T++){var k=U[T],S=k.x,E=k.y;k.os.ctx.drawImage(Q,-S+f,-E+m,l,h)}}}else if(n.source&&(n.width>L.maxTextureSize||n.height>L.maxTextureSize)){if((R=this.canvasCache=xi.getImgInstance(s,c,this._src)).available=!0,1===R.getCount()){l=o.width,h=o.height,d=o.objectFit,f=0,m=0,p=n.width/n.height,g=l/h;if(d===ae.CONTAIN){if(g>p){var C=h*p;f=.5*(l-C),l=C}else if(g<p){var A=l/p;m=.5*(h-A),h=A}}else if(d===ae.COVER)if(g>p){var _=l/p;m=.5*(h-_),h=_}else if(g<p){var M=h*p;f=.5*(l-M),l=M}for(T=0,w=(U=R.list).length;T<w;T++){var I=U[T];S=I.x,E=I.y;I.os.ctx.drawImage(n.source,-S+f,-E+m,l,h)}}}}}else{e.prototype.renderCanvas.call(this);var R,P=this.computedStyle,O=this._bboxInt||this.bboxInt;S=O[0],E=O[1],s=O[2]-S,c=O[3]-E,l=P.width,h=P.height,d=P.objectFit,f=0,m=0;if(null==n?void 0:n.success){p=n.width/n.height,g=l/h;if(d===ae.CONTAIN){if(g>p){var D=h*p;f=.5*(l-D),l=D}else if(g<p){var B=l/p;m=.5*(h-B),h=B}}else if(d===ae.COVER)if(g>p){var F=l/p;m=.5*(h-F),h=F}else if(g<p){var N=h*p;f=.5*(l-N),l=N}}(R=this.canvasCache=(null===(r=this.canvasCache)||void 0===r?void 0:r.available)?this.canvasCache:new xi(s,c,-S,-E)).available=!0;var U;for(T=0,w=(U=R.list).length;T<w;T++){var z=U[T],W=z.x,V=z.y,H=z.os.ctx,X=-W,j=-V;if(null==n?void 0:n.success){var G=P.borderTopLeftRadius,Y=P.borderTopRightRadius,q=P.borderBottomLeftRadius,K=P.borderBottomRightRadius;if(G||Y||q||K){var $=this.getBackgroundCoords(W,V);H.save(),H.beginPath(),ba(H,$,-W,-V),H.closePath(),H.clip()}if(n.frames.length){var Q;u=Math.min(n.frames.length-1,Math.max(0,this._frameIndex));(Q=n.frames[u])&&H.drawImage(Q,X+f,j+m,l,h)}else n.source&&H.drawImage(n.source,X+f,j+m,l,h);(G||Y||q||K)&&H.restore()}}}},r.prototype.genTexture=function(t){var r=this,i=r.isPure,a=r.loader,n=r.canvasCache;if(i){if(null==a?void 0:a.success)if(a.width>L.maxTextureSize||a.height>L.maxTextureSize)if((null==n?void 0:n.available)&&Zi.hasCanvasCacheInstance(n)){var o=Zi.getCanvasCacheInstance(t,n,this._rect||this.rect);this.textureTarget=this.textureCache=o}else{this.renderCanvas();o=Zi.getCanvasCacheInstance(t,this.canvasCache,this._rect||this.rect);this.textureTarget=this.textureCache=o,this.canvasCache.release()}else{var s=this.computedStyle,c=s.width,u=s.height,l=s.objectFit,h=this._rect||this.rect,d=(o=void 0,a.width/a.height),f=c/u;if(l===ae.CONTAIN){if(f>d){var m=.5*(c-(v=u*d));(h=h.slice(0))[0]+=m,h[2]-=m}else if(f<d){m=.5*(u-(p=c/d));(h=h.slice(0))[1]+=m,h[3]-=m}}else if(l===ae.COVER)if(f>d){var p=c/d;o={x1:0,y3:g=(m=.5*Math.abs(u-p))/p,x3:1,y1:1-g}}else if(f<d){var g,v=u*d;o={x1:g=(m=.5*Math.abs(c-v))/v,y3:0,x3:1-g,y1:1}}if(a.frames.length){var y=Math.min(a.frames.length-1,Math.max(0,this._frameIndex)),b=a.frames[y];if(b){var x=Zi.getVideoFrameInstance(t,b,h,o);this.textureTarget=this.textureCache=x}}else if(a.source){x=Zi.getImgInstance(t,a.source,h,o);this.textureTarget=this.textureCache=x}}}else e.prototype.genTexture.call(this,t)},r.prototype.release=function(){e.prototype.release.call(this);var t=this.loader;(null==t?void 0:t.success)&&t.release()},r.prototype.gifAnimate=function(e,t){var r=new Ca(this,e,t);return this.initAnimate(r,t)},r.prototype.cloneProps=function(){var t=e.prototype.cloneProps.call(this);return t.src=this._src,t},r.prototype.clone=function(){return new r(this.cloneProps())},Object.defineProperty(r.prototype,"src",{get:function(){return this._src},set:function(e){this._src!==e&&(this._src=e,this.refresh())},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"frameIndex",{get:function(){return this._frameIndex},set:function(e){this._frameIndex!==e&&(this._frameIndex=e,this.refresh())},enumerable:!1,configurable:!0}),r}(ka);var Da={parseJSON:function(e){var t=e.tagName,r=e.props,i=void 0===r?{}:r,a=e.children,n=void 0===a?[]:a,o=e.animation,s=void 0===o?[]:o;if(!t)throw new Error("Missing tagName");if(!Array.isArray(n))throw new Error("Children must be an array");if(!Array.isArray(s))throw new Error("Animation must be an array");if("img"!==t)throw new Error("Unknown tagName");return new Oa(i)}},Ba=function(e){function r(t,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return i.children=r,i}return t(r,e),r.prototype.didMount=function(){e.prototype.didMount.call(this);var t=this.children,r=t.length;if(r){var i=t[0];i.parent=this,i.didMount();for(var a=i,n=1;n<r;n++){var o=t[n];o.didMount(),o.parent=this,a.next=o,o.prev=a,a=o}}},r.prototype.didUnmount=function(){e.prototype.didUnmount.call(this),this.children.forEach(function(e){e.didUnmount()})},r.prototype.layout=function(t){e.prototype.layout.call(this,t);for(var r=this.children,i=0,a=r.length;i<a;i++){r[i].layout({w:this.computedStyle.width,h:this.computedStyle.height})}},r.prototype.structure=function(t){var r=e.prototype.structure.call(this,t);return this.children.forEach(function(e){r=r.concat(e.structure(t+1))}),r[0].num=this.children.length,r[0].total=r.length-1,r},r.prototype.insertStruct=function(e,t){var r,i=this.struct,a=this.root,n=e.structure(i.lv+1),o=a.structs;if(t){var s=this.children[t-1].struct,c=s.total;r=o.indexOf(s)+c+1}else r=o.indexOf(i)+1;o.splice.apply(o,function(e,t,r){if(r||2===arguments.length)for(var i,a=0,n=t.length;a<n;a++)!i&&a in t||(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))}([r,0],n,!1));var u=n[0].total+1;i.num++,i.total+=u;for(var l=this.parent;l;)l.struct.total+=u,l=l.parent},r.prototype.deleteStruct=function(e){var t=e.struct,r=t.total+1,i=this.root.structs,a=i.indexOf(t);i.splice(a,r);var n=this.struct;n.num--,n.total-=r;for(var o=this.parent;o;)o.struct.total-=r,o=o.parent},r.prototype.appendChild=function(e,t){e.remove();var r=this.root,i=this.children,a=i.length;if(a){var n=i[i.length-1];n.next=e,e.prev=n}e.parent=this,e.root=r,i.push(e),r&&this.isMounted?(this.insertStruct(e,a),r.addUpdate(e,[],ci.ADD_DOM,t)):t&&t(!0)},r.prototype.prependChild=function(e,t){e.remove();var r=this.root,i=this.children;if(i.length){var a=i[0];a.next=e,e.prev=a}e.parent=this,e.root=r,i.push(e),r&&!this.isDestroyed?(this.insertStruct(e,0),r.addUpdate(e,[],ci.ADD_DOM,t)):t&&t(!0)},r.prototype.removeChild=function(e,t){e.parent===this?e.remove(t):oe.error("Invalid parameter of removeChild()")},r.prototype.removeAllChildren=function(e){for(var t=this.children.length-1;t>=0;t--)t?this.children[t].remove():this.children[t].remove(e)},r}(ka),Fa={alpha:!0,antialias:!0,premultipliedAlpha:!0,preserveDrawingBuffer:!0,depth:!0,stencil:!0};function La(e,t,r,i){var a=e.createFramebuffer();return e.bindFramebuffer(e.FRAMEBUFFER,a),t&&e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0),e.viewport(0,0,r,i),a}function Na(e,t,r,i){e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,null,0),e.bindFramebuffer(e.FRAMEBUFFER,null),e.deleteFramebuffer(t),r&&i&&e.viewport(0,0,r,i)}function Ua(e,t,r,i){return za(e,t,0,0,r,i)}function za(e,t,r,i,a,n){var o,s,c=Tt(e[0],e[1],e[2],e[3],t),u=c.x1,l=c.y1,h=c.x2,d=c.y2,f=c.x3,m=c.y3,p=c.x4,g=c.y4;return u===p&&l===d&&h===f&&m===g?(u>h&&(u=(o=[f,u])[0],f=o[1]),d>m&&(l=(s=[m,l])[0],m=s[1]),xr(r,i,r+a,i+n,u,l,f,m,!1)):Tr(r,i,r+a,i+n,[{x:u,y:l},{x:h,y:d},{x:f,y:m},{x:p,y:g}],!1)}var Wa=void 0,Va=function(){function e(e,t,r){this.program=t,this.options=r||{},this.uniform={},this.attrib={},this.uniformValue={},this.initLocations(e)}return e.prototype.initLocations=function(e){var t=this;this.options.uniform&&this.options.uniform.forEach(function(r){t.uniform[r]=e.getUniformLocation(t.program,r)}),this.options.attrib&&this.options.attrib.forEach(function(r){t.attrib[r]=e.getAttribLocation(t.program,r)})},e.useProgram=function(e,t){Wa!==t&&(Wa=t,e.useProgram(t.program))},e}(),Ha=function(e){function r(t,r,i){var a=e.call(this,t,i)||this;return a.node=t,a._timeArea=[r,r+a.duration],a._timeAreaR=a._timeArea.slice(0).reverse(),a.currentTimeArea=a._timeArea,a.originTime=t.currentTime,a.setCurrentTimeArea(),a}return t(r,e),r.prototype.setCurrentTimeArea=function(){var e=this.direction,t=this._playCount;this.currentTimeArea="backwards"===e?this._timeArea:"alternate"===e?t%2==0?this._timeAreaR:this._timeArea:"alternateReverse"===e?t%2==0?this._timeArea:this._timeAreaR:this._timeArea},r.prototype.finish=function(){"finished"!==this._playState&&(e.prototype.finish.call(this),this.onFirstInEndDelay())},r.prototype.cancel=function(){"idle"!==this._playState&&(e.prototype.cancel.call(this),this.node.currentTime=this.originTime)},r.prototype.play=function(){e.prototype.play.call(this),"running"!==this._playState||this._currentTime||(this.node.currentTime=0)},r.prototype.onRunning=function(t,r){var i;e.prototype.onRunning.call(this,t,r);var a=this,n=a.node,o=a.duration,s=a.delay,c=a.iterations,u=a.currentTimeArea,l=a.time,h=this._currentTime;if(h<s)n.currentTime=h-s;else{var d=this._playCount>=c-1,f=l/o;this.easing&&(f=this.easing(f)),d&&f>=1?n instanceof ef&&l-o>=L.releasePrevDuration&&n.computedStyle.visibility===te.HIDDEN&&(null===(i=n.decoder)||void 0===i||i.releaseGOPList(),n.videoFrame=void 0):n.currentTime=Math.floor(u[0]+(u[1]-u[0])*f)}},r.prototype.onFirstInDelay=function(){var e=this,t=e.fill,r=e.currentTimeArea,i=e.node;"backwards"!==t&&"both"!==t||(i.currentTime=r[0])},r.prototype.onFirstInEndDelay=function(){var e=this.fill,t=this.node;if("forwards"===e||"both"===e){var r=this.currentTimeArea;t.currentTime=r[r.length-1]}else t.currentTime=this.originTime},r.prototype.onChangePlayCount=function(){this.setCurrentTimeArea()},Object.defineProperty(r.prototype,"timeArea",{get:function(){return this._timeArea.slice(0)},enumerable:!1,configurable:!0}),r}(da);
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).kronoFlow=t()}(this,function(){"use strict";var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};function t(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}var r=function(){return r=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},r.apply(this,arguments)};function i(e,t,r,i){return new(r||(r=Promise))(function(a,n){function o(e){try{c(i.next(e))}catch(e){n(e)}}function s(e){try{c(i.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,s)}c((i=i.apply(e,t||[])).next())})}function a(e,t){var r,i,a,n={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(n=0)),n;)try{if(r=1,i&&(a=2&s[0]?i.return:s[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,s[1])).done)return a;switch(i=0,a&&(s=[2&s[0],a.value]),s[0]){case 0:case 1:a=s;break;case 4:return n.label++,{value:s[1],done:!1};case 5:n.label++,i=s[1],s=[0];continue;case 7:s=n.ops.pop(),n.trys.pop();continue;default:if(!(a=n.trys,(a=a.length>0&&a[a.length-1])||6!==s[0]&&2!==s[0])){n=0;continue}if(3===s[0]&&(!a||s[1]>a[0]&&s[1]<a[3])){n.label=s[1];break}if(6===s[0]&&n.label<a[1]){n.label=a[1],a=s;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(s);break}a[2]&&n.ops.pop(),n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e],i=0}finally{r=a=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}function n(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.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.")}function o(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=n(e),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(r){t[r]=e[r]&&function(t){return new Promise(function(i,a){(function(e,t,r,i){Promise.resolve(i).then(function(t){e({value:t,done:r})},t)})(i,a,(t=e[r](t)).done,t.value)})}}}"function"==typeof SuppressedError&&SuppressedError;const s=[];for(let e=0;e<256;++e)s.push((e+256).toString(16).slice(1));let c;const u=new Uint8Array(16);var l={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function h(e,t,r){const i=(e=e||{}).random??e.rng?.()??function(){if(!c){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");c=crypto.getRandomValues.bind(crypto)}return c(u)}();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=15&i[6]|64,i[8]=63&i[8]|128,function(e,t=0){return(s[e[t+0]]+s[e[t+1]]+s[e[t+2]]+s[e[t+3]]+"-"+s[e[t+4]]+s[e[t+5]]+"-"+s[e[t+6]]+s[e[t+7]]+"-"+s[e[t+8]]+s[e[t+9]]+"-"+s[e[t+10]]+s[e[t+11]]+s[e[t+12]]+s[e[t+13]]+s[e[t+14]]+s[e[t+15]]).toLowerCase()}(i)}var d={}.toString;function f(e){return function(t){return d.call(t)==="[object "+e+"]"}}var m,p=f("Object"),g=f("String"),v=(m=["Function","AsyncFunction","GeneratorFunction"],function(e){for(var t=d.call(e),r=0,i=m.length;r<i;r++)if(t==="[object "+m[r]+"]")return!0;return!1}),y=f("Number"),b=f("Boolean"),x=f("Date"),T={}.hasOwnProperty,w=T.toString,k=w.call(Object);function S(e){return null==e}function E(e){if(!e||"[object Object]"!==d.call(e))return!1;var t=Object.getPrototypeOf(e);if(!t)return!0;var r=T.call(t,"constructor")&&t.constructor;return"function"==typeof r&&w.call(r)===k}function C(e){if(S(e)||"object"!=typeof e)return e;if(x(e))return new Date(e);if(!E(e)&&!Array.isArray(e))return e;var t=Array.isArray(e)?[]:{};return Object.keys(e).forEach(function(r){t[r]=C(e[r])}),t}function A(e,t,r){if(e===t)return!0;if(p(e)&&p(t)){for(var i={},a=r||Object.keys(e),n=0,o=a.length;n<o;n++){var s=a[n];if(!t.hasOwnProperty(s)||!A(e[s],t[s]))return!1;i[s]=!0}for(n=0,o=(a=r||Object.keys(t)).length;n<o;n++){s=a[n];if(!i.hasOwnProperty(s))return!1}return!0}if(x(e)&&x(t))return e.getTime()===t.getTime();if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(n=0,o=e.length;n<o;n++)if(!A(e[n],t[n]))return!1;return!0}return e===t}var _={isNil:S,isString:g,isNumber:y,isObject:p,isBoolean:b,isDate:x,isFunction:v,isPlainObject:E,equal:A,extend:function(e,t,r){if(null===t||"object"!=typeof t)return e;r||(r=Object.keys(t));for(var i=0,a=r.length;i<a;){var n=r[i];e[n]=t[n],i++}return e},clone:C},M=function(){function e(){this.__eHash={}}return e.prototype.on=function(e,t){if(v(t))if(Array.isArray(e))for(var r=0,i=e.length;r<i;r++)this.on(e[r],t);else{this.__eHash.hasOwnProperty(e)||(this.__eHash[e]=[]);r=0;var a=this.__eHash[e];for(i=a.length;r<i;r++)if(a[r]===t)return;this.__eHash[e].push(t)}},e.prototype.once=function(e,t){var r=this;if(v(t))if(Array.isArray(e))for(var i=0,a=e.length;i<a;i++)this.once(e[i],t);else{var n=function(){t.apply(r,Array.prototype.slice.call(arguments)),r.off(e,n)};if(n.__eventCb=t,Array.isArray(e))for(i=0,a=e.length;i<a;i++)this.once(e[i],t);else this.on(e,n)}},e.prototype.off=function(e,t){if(Array.isArray(e))for(var r=0,i=e.length;r<i;r++)this.off(e[r],t);else if(this.__eHash.hasOwnProperty(e))if(t){r=0;var a=this.__eHash[e];for(i=a.length;r<i;r++)if(a[r]===t||a[r].__eventCb===t){a.splice(r,1);break}}else delete this.__eHash[e]},e.prototype.emit=function(e){for(var t=this,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];if(Array.isArray(e))e.forEach(function(e){if(e&&t.__eHash.hasOwnProperty(e)){var i=t.__eHash[e];if(i.length)for(var a=0,n=(i=i.slice()).length;a<n;a++){var o=i[a];v(o)&&o.apply(t,r)}}});else if(e){var a=this.__eHash[e];if(a&&a.length)for(var n=0,o=(a=a.slice()).length;n<o;n++){var s=a[n];v(s)&&s.apply(this,r)}}},e}(),I={left:"auto",top:"auto",right:"auto",bottom:"auto",width:"auto",height:"auto",lineHeight:"normal",fontFamily:"Arial",fontSize:16,fontWeight:400,fontStyle:"normal",letterSpacing:0,paragraphSpacing:0,textAlign:"left",textVerticalAlign:"top",textDecoration:[],textShadow:"none",color:[0,0,0,1],visibility:"visible",opacity:1,backgroundColor:"transparent",fill:[],fillOpacity:[],fillEnable:[],fillMode:[],fillRule:"nonzero",stroke:[],strokeEnable:[],strokeWidth:[],strokePosition:[],strokeMode:[],strokeDasharray:[],strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:4,translateX:0,translateY:0,translateZ:0,skewX:0,skewY:0,scaleX:1,scaleY:1,rotateX:0,rotateY:0,rotateZ:0,transformOrigin:["center","center"],perspective:0,perspectiveOrigin:["center","center"],perspectiveSelf:0,mixBlendMode:"normal",pointerEvents:!0,maskMode:"none",breakMask:!1,objectFit:"fill",borderTopLeftRadius:0,borderTopRightRadius:0,borderBottomLeftRadius:0,borderBottomRightRadius:0,overflow:"visible",filter:[]};function R(e){var t=Object.assign({},I);return["transformOrigin","perspectiveOrigin","color","strokeDasharray","filter"].forEach(function(e){t[e]=t[e].slice(0)}),Object.assign(t,e)}var P={getDefaultStyle:R},O=2048,D=!1,B=O,F=!1,L={debug:!1,offscreenCanvas:!1,get maxTextureSize(){return O},set maxTextureSize(e){O=F?Math.min(e,B):e,D=!0},get MAX_TEXTURE_SIZE(){return B},MAX_TEXTURE_IMAGE_UNITS:8,MAX_VARYING_VECTORS:15,init:function(e,t,r){D?e<O&&(O=e):O=Math.min(O,e),F=!0,B=e,this.MAX_TEXTURE_IMAGE_UNITS=t,this.MAX_VARYING_VECTORS=r},defaultFontFamily:"Arial",defaultFontSize:16,historyTime:1e3,decoderWorker:"",decoderWorkerStr:"",encoderWorker:"",encoderWorkerStr:"",decodeNextDuration:0,releasePrevDuration:0,gopMinDuration:0,preloadAll:!1,mute:!1,indexedDB:!1,encoderFrameQue:0},N=1e3/60,U={},z="function"==typeof OffscreenCanvas&&OffscreenCanvas.prototype.getContext;var W,V,H,X,j,G,Y,q,K,$,Q,Z,J,ee,te,re,ie,ae,ne={},oe={requestAnimationFrame:function(e){return e?("undefined"!=typeof requestAnimationFrame?(oe.requestAnimationFrame=requestAnimationFrame.bind(null),t=requestAnimationFrame(e)):(t=setTimeout(e,N),oe.requestAnimationFrame=function(e){return setTimeout(e,N)}),t):-1;var t},cancelAnimationFrame:function(e){var t;return"undefined"!=typeof cancelAnimationFrame?(oe.cancelAnimationFrame=cancelAnimationFrame.bind(null),t=cancelAnimationFrame(e)):(t=clearTimeout(e),oe.cancelAnimationFrame=function(e){return clearTimeout(e)}),t},now:function(){return"undefined"!=typeof performance?(oe.now=function(){return Math.floor(performance.now())},Math.floor(performance.now())):(oe.now=Date.now.bind(Date),Date.now())},hasOffscreenCanvas:function(e){return e&&U.hasOwnProperty(e)},getOffscreenCanvas:function(e,t,r,i){return function(e,t,r,i){var a;a=r?U[r]?U[r]:U[r]=!L.debug&&L.offscreenCanvas&&z?new OffscreenCanvas(e,t):document.createElement("canvas"):!L.debug&&L.offscreenCanvas&&z?new OffscreenCanvas(e,t):document.createElement("canvas"),e=Math.ceil(e),t=Math.ceil(t),a.width=e,a.height=t,a.style.position="fixed",a.style.left="9999px",a.style.top="0px",a.style.webkitFontSmoothing="antialiased",a.style.mozOsxFontSmoothing="grayscale",L.debug&&(a.style.width=e+"px",a.style.height=t+"px"),a instanceof HTMLCanvasElement&&(document.body.appendChild(a),r&&a.setAttribute("key",r));var n=a.getContext("2d",i);return n||oe.error("Total canvas memory use exceeds the maximum limit"),{canvas:a,ctx:n,width:e,height:t,available:!0,release:function(){this.available&&!L.debug&&(this.available=!1,n.globalAlpha=1,n.globalCompositeOperation="source-over",n.setTransform(1,0,0,1,0,0),n.clearRect(0,0,e,t),a.width=a.height=0,a instanceof HTMLCanvasElement&&document.body.removeChild(a),a=null)}}}(e,t,r,i)},isWebGLTexture:function(e){if(e&&"undefined"!=typeof WebGLTexture)return e instanceof WebGLTexture},getFontCanvas:function(){return oe.getOffscreenCanvas(16,16,"__$$CHECK_SUPPORT_FONT_FAMILY$$__",{willReadFrequently:!0})},checkSupportFontFamily:function(e){if(e===L.defaultFontFamily)return!0;if(ne.hasOwnProperty(e))return ne[e];var t=oe.getFontCanvas().ctx;t.textAlign="center",t.fillStyle="#000",t.textBaseline="middle",W||(t.clearRect(0,0,16,16),t.font="16px "+L.defaultFontFamily,t.fillText("a",8,8),W=t.getImageData(0,0,16,16).data),t.clearRect(0,0,16,16),/\s/.test(e)&&(e='"'+e.replace(/"/g,'\\"')+'"'),t.font="16px "+e+","+L.defaultFontFamily,t.fillText("a",8,8);for(var r=t.getImageData(0,0,16,16).data,i=0,a=r.length;i<a;i++)if(W[i]!==r[i])return ne[e]=!0;return ne[e]=!1},addArrayBufferFont:function(e,t){return i(this,void 0,void 0,function(){var r;return a(this,function(i){switch(i.label){case 0:return"undefined"==typeof document||"undefined"==typeof FontFace?[3,2]:[4,(r=new FontFace(e,t)).load()];case 1:i.sent(),document.fonts.add(r),i.label=2;case 2:return[2]}})})},addLocalFont:function(e){return i(this,void 0,void 0,function(){var t;return a(this,function(r){switch(r.label){case 0:return"undefined"==typeof document||"undefined"==typeof FontFace?[3,2]:[4,(t=new FontFace(e,"local(".concat(e))).load()];case 1:r.sent(),document.fonts.add(t),r.label=2;case 2:return[2]}})})},loadArrayBufferImg:function(e){return i(this,void 0,void 0,function(){var t,r;return a(this,function(i){return t=new Blob([e]),r=new Image,[2,new Promise(function(e,i){r.onload=function(){e(r)},r.onerror=function(e){i(e)},r.src=URL.createObjectURL(t)})]})})},pdfjsLibWorkerSrc:"https://gw.alipayobjects.com/os/lib/pdfjs-dist/3.11.174/build/pdf.worker.min.js",loadArrayBufferPdf:function(e){return i(this,void 0,void 0,function(){var t,r,i,n,o,s,c,u,l;return a(this,function(a){switch(a.label){case 0:return(t=window.pdfjsLib).GlobalWorkerOptions.workerSrc=oe.pdfjsLibWorkerSrc,r=new Blob([e]),i=URL.createObjectURL(r),[4,t.getDocument(i).promise];case 1:return[4,a.sent().getPage(1)];case 2:return n=a.sent(),o=n.getViewport({scale:1}),(s=document.createElement("canvas")).width=o.width,s.height=o.height,c=s.getContext("2d"),[4,n.render({viewport:o,canvasContext:c,background:"transparent"}).promise];case 3:return a.sent(),[4,new Promise(function(e,t){s.toBlob(function(r){r?e(r):t("")})})];case 4:return u=a.sent(),l=new Image,[2,new Promise(function(e,t){l.onload=function(){e(l)},l.onerror=function(e){t(e)},l.src=URL.createObjectURL(u)})]}})})},loadLocalFonts:function(){return i(this,void 0,void 0,function(){var e;return a(this,function(t){switch(t.label){case 0:if("undefined"==typeof navigator)return[3,5];t.label=1;case 1:return t.trys.push([1,4,,5]),[4,navigator.permissions.query({name:"local-fonts"})];case 2:return"denied"===t.sent().state?(oe.error("No Permission."),[2,[]]):[4,window.queryLocalFonts()];case 3:return[2,t.sent()];case 4:return e=t.sent(),oe.error(e),[2,[]];case 5:return[2,[]]}})})},uploadBlobImgSrc:function(e){return i(this,void 0,void 0,function(){return a(this,function(e){return[2]})})},log:function(e){console.log(e)},warn:function(e){console.warn(e)},error:function(e){console.error(e)}};function se(e,t){if(void 0===t&&(t=!1),"auto"===e)return{v:0,u:V.AUTO};var r=parseFloat(e)||0;return/%$/.test(e)?{v:r,u:V.PERCENT}:/px$/i.test(e)?{v:r,u:V.PX}:/deg$/i.test(e)?{v:r,u:t?V.PX:V.DEG}:{v:r,u:t?V.PX:V.NUMBER}}!function(e){e[e.AUTO=0]="AUTO",e[e.PX=1]="PX",e[e.PERCENT=2]="PERCENT",e[e.NUMBER=3]="NUMBER",e[e.DEG=4]="DEG",e[e.RGBA=5]="RGBA",e[e.BOOLEAN=6]="BOOLEAN",e[e.STRING=7]="STRING",e[e.GRADIENT=8]="GRADIENT",e[e.MATRIX=9]="MATRIX",e[e.SHADOW=10]="SHADOW",e[e.PATTERN=11]="PATTERN",e[e.GAUSS_BLUR=12]="GAUSS_BLUR",e[e.MOTION_BLUR=13]="MOTION_BLUR",e[e.RADIAL_BLUR=14]="RADIAL_BLUR",e[e.BLOOM=15]="BLOOM",e[e.LIGHT_DARK=16]="LIGHT_DARK",e[e.HUE_ROTATE=17]="HUE_ROTATE",e[e.SATURATE=18]="SATURATE",e[e.BRIGHTNESS=19]="BRIGHTNESS",e[e.CONTRAST=20]="CONTRAST",e[e.SEPIA=21]="SEPIA"}(V||(V={})),function(e){e[e.LEFT=0]="LEFT",e[e.RIGHT=1]="RIGHT",e[e.CENTER=2]="CENTER",e[e.JUSTIFY=3]="JUSTIFY"}(H||(H={})),function(e){e[e.TOP=0]="TOP",e[e.MIDDLE=1]="MIDDLE",e[e.BOTTOM=2]="BOTTOM"}(X||(X={})),function(e){e[e.NORMAL=0]="NORMAL",e[e.MULTIPLY=1]="MULTIPLY",e[e.SCREEN=2]="SCREEN",e[e.OVERLAY=3]="OVERLAY",e[e.DARKEN=4]="DARKEN",e[e.LIGHTEN=5]="LIGHTEN",e[e.COLOR_DODGE=6]="COLOR_DODGE",e[e.COLOR_BURN=7]="COLOR_BURN",e[e.HARD_LIGHT=8]="HARD_LIGHT",e[e.SOFT_LIGHT=9]="SOFT_LIGHT",e[e.DIFFERENCE=10]="DIFFERENCE",e[e.EXCLUSION=11]="EXCLUSION",e[e.HUE=12]="HUE",e[e.SATURATION=13]="SATURATION",e[e.COLOR=14]="COLOR",e[e.LUMINOSITY=15]="LUMINOSITY"}(j||(j={})),function(e){e[e.NORMAL=0]="NORMAL",e[e.ITALIC=1]="ITALIC",e[e.OBLIQUE=2]="OBLIQUE"}(G||(G={})),function(e){e[e.LINEAR=0]="LINEAR",e[e.RADIAL=1]="RADIAL",e[e.CONIC=2]="CONIC"}(Y||(Y={})),function(e){e[e.NONE=0]="NONE",e[e.UNION=1]="UNION",e[e.SUBTRACT=2]="SUBTRACT",e[e.INTERSECT=3]="INTERSECT",e[e.XOR=4]="XOR"}(q||(q={})),function(e){e[e.NON_ZERO=0]="NON_ZERO",e[e.EVEN_ODD=1]="EVEN_ODD"}(K||(K={})),function(e){e[e.NONE=0]="NONE",e[e.OUTLINE=1]="OUTLINE",e[e.ALPHA=2]="ALPHA",e[e.GRAY=3]="GRAY",e[e.ALPHA_WITH=4]="ALPHA_WITH",e[e.GRAY_WITH=5]="GRAY_WITH"}($||($={})),function(e){e[e.BUTT=0]="BUTT",e[e.ROUND=1]="ROUND",e[e.SQUARE=2]="SQUARE"}(Q||(Q={})),function(e){e[e.MITER=0]="MITER",e[e.ROUND=1]="ROUND",e[e.BEVEL=2]="BEVEL"}(Z||(Z={})),function(e){e[e.CENTER=0]="CENTER",e[e.INSIDE=1]="INSIDE",e[e.OUTSIDE=2]="OUTSIDE"}(J||(J={})),function(e){e[e.TILE=0]="TILE",e[e.FILL=1]="FILL",e[e.STRETCH=2]="STRETCH",e[e.FIT=3]="FIT"}(ee||(ee={})),function(e){e[e.VISIBLE=0]="VISIBLE",e[e.HIDDEN=1]="HIDDEN"}(te||(te={})),function(e){e[e.NONE=0]="NONE",e[e.UNDERLINE=1]="UNDERLINE",e[e.LINE_THROUGH=2]="LINE_THROUGH"}(re||(re={})),function(e){e[e.VISIBLE=0]="VISIBLE",e[e.HIDDEN=1]="HIDDEN",e[e.CLIP=2]="CLIP"}(ie||(ie={})),function(e){e[e.FILL=0]="FILL",e[e.CONTAIN=1]="CONTAIN",e[e.COVER=2]="COVER"}(ae||(ae={}));var ce,ue=["fontFamily","fontSize","fontWeight","lineHeight","letterSpacing","paragraphSpacing","fontStyle","textAlign","textDecoration","color","textShadow","stroke","strokeWidth","strokeEnable"];!function(e){e[e.NONE=0]="NONE",e[e.STRAIGHT=1]="STRAIGHT",e[e.MIRRORED=2]="MIRRORED",e[e.ASYMMETRIC=3]="ASYMMETRIC",e[e.DISCONNECTED=4]="DISCONNECTED"}(ce||(ce={}));var le={StyleUnit:V,TEXT_ALIGN:H,TEXT_VERTICAL_ALIGN:X,MIX_BLEND_MODE:j,FONT_STYLE:G,GRADIENT:Y,FILL_RULE:K,MASK:$,STROKE_LINE_CAP:Q,STROKE_LINE_JOIN:Z,STROKE_POSITION:J,PATTERN_FILL_TYPE:ee,VISIBILITY:te,TEXT_DECORATION:re,OVERFLOW:ie,calUnit:se,RICH_KEYS:ue},he={position:/(([-+]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e[-+]?\d+)?[pxremvwhina%]*)|(left|top|right|bottom|center)){1,2}/gi,gradient:/\b(\w+)-?gradient\s*\((.+)\)/i,img:/(?:\burl\((['"]?)(.*?)\1\))|(?:\b((data:)))/i,shadow:/([-+]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:px)?)\s+([-+]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:px)?)\s+((?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:px)?)\s+((?:#[a-f\d]{3,8})|(?:rgba?\s*\(.+?\)))/i};function de(e){if(Array.isArray(e))return e;var t=[];if(!e||/transparent/i.test(e))t=[0,0,0,0];else if(/^#?[a-f\d]{3,8}$/i.test(e))3===(e=e.replace("#","")).length||4===e.length?(t.push(parseInt(e.charAt(0)+e.charAt(0),16)),t.push(parseInt(e.charAt(1)+e.charAt(1),16)),t.push(parseInt(e.charAt(2)+e.charAt(2),16)),4===e.length?t[3]=parseInt(e.charAt(3)+e.charAt(3),16):t[3]=1):6===e.length?(t.push(parseInt(e.slice(0,2),16)),t.push(parseInt(e.slice(2,4),16)),t.push(parseInt(e.slice(4),16)),t[3]=1):8===e.length?(t.push(parseInt(e.slice(0,2),16)),t.push(parseInt(e.slice(2,4),16)),t.push(parseInt(e.slice(4,6),16)),t.push(parseInt(e.slice(6),16)/255)):(t[0]=t[1]=t[2]=0,t[3]=1);else{var r=e.match(/rgba?\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)(?:\s*,\s*([\d.]+))?\s*\)/i);r?(t=[parseInt(r[1]),parseInt(r[2]),parseInt(r[3])],S(r[4])?t[3]=1:t[3]=parseFloat(r[4])):t=[0,0,0,0]}return t}function fe(e){var t=de(e);if(Array.isArray(t)){var r=Math.min(255,Math.max(Math.round(t[0]),0)),i=Math.min(255,Math.max(Math.round(t[1]),0)),a=Math.min(255,Math.max(Math.round(t[2]),0));if(3===t.length||4===t.length){if(4===t.length){var n=Math.min(1,Math.max(t[3],0));if(n<1)return"rgba("+r+","+i+","+a+","+n+")"}return"rgba("+r+","+i+","+a+",1)"}}return e||"rgba(0,0,0,0)"}function me(e){var t=e.toString(16).toUpperCase();return 1===t.length&&(t="0"+t),t}var pe={color2rgbaInt:de,color2rgbaStr:fe,color2hexStr:function(e){var t=de(e);if(Array.isArray(t)){var r=Math.min(255,Math.max(Math.round(t[0]),0)),i=Math.min(255,Math.max(Math.round(t[1]),0)),a=Math.min(255,Math.max(Math.round(t[2]),0));if(3===t.length||4===t.length){if(4===t.length){var n=Math.min(1,Math.max(t[3],0));if(n<1)return"#"+me(r)+me(i)+me(a)+me(Math.floor(255*n))}return"#"+me(r)+me(i)+me(a)}}return e||"#000"},color2gl:function(e){return Array.isArray(e)||(e=de(e)),[e[0]/255,e[1]/255,e[2]/255,3===e.length?1:e[3]]},clampColor:function(e){var t=Math.min(255,Math.max(Math.round(e[0]),0)),r=Math.min(255,Math.max(Math.round(e[1]),0)),i=Math.min(255,Math.max(Math.round(e[2]),0));return e.length>3?[t,r,i,Math.min(1,Math.max(0,e[3]))]:[t,r,i]}},ge=function(){function e(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function t(t,r){this.source=t,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=r,this.destLen=0,this.ltree=new e,this.dtree=new e}var r=new e,i=new e,a=new Uint8Array(30),n=new Uint16Array(30),o=new Uint8Array(30),s=new Uint16Array(30),c=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),u=new e,l=new Uint8Array(320);function h(e,t,r,i){var a,n;for(a=0;a<r;++a)e[a]=0;for(a=0;a<30-r;++a)e[a+r]=a/r|0;for(n=i,a=0;a<30;++a)t[a]=n,n+=1<<e[a]}var d=new Uint16Array(16);function f(e,t,r,i){var a,n;for(a=0;a<16;++a)e.table[a]=0;for(a=0;a<i;++a)e.table[t[r+a]]++;for(e.table[0]=0,n=0,a=0;a<16;++a)d[a]=n,n+=e.table[a];for(a=0;a<i;++a)t[r+a]&&(e.trans[d[t[r+a]]++]=a)}function m(e){e.bitcount--||(e.tag=e.source[e.sourceIndex++],e.bitcount=7);var t=1&e.tag;return e.tag>>>=1,t}function p(e,t,r){if(!t)return r;for(;e.bitcount<24;)e.tag|=e.source[e.sourceIndex++]<<e.bitcount,e.bitcount+=8;var i=e.tag&65535>>>16-t;return e.tag>>>=t,e.bitcount-=t,i+r}function g(e,t){for(;e.bitcount<24;)e.tag|=e.source[e.sourceIndex++]<<e.bitcount,e.bitcount+=8;var r=0,i=0,a=0,n=e.tag;do{i=2*i+(1&n),n>>>=1,++a,r+=t.table[a],i-=t.table[a]}while(i>=0);return e.tag=n,e.bitcount-=a,t.trans[r+i]}function v(e,t,r){var i,a,n,o,s,h;for(i=p(e,5,257),a=p(e,5,1),n=p(e,4,4),o=0;o<19;++o)l[o]=0;for(o=0;o<n;++o){var d=p(e,3,0);l[c[o]]=d}for(f(u,l,0,19),s=0;s<i+a;){var m=g(e,u),v=void 0;switch(m){case 16:for(v=l[s-1],h=p(e,2,3);h;--h)l[s++]=v;break;case 17:for(h=p(e,3,3);h;--h)l[s++]=0;break;case 18:for(h=p(e,7,11);h;--h)l[s++]=0;break;default:l[s++]=m}}f(t,l,0,i),f(r,l,i,a)}function y(e,t,r){for(;;){var i=g(e,t);if(256===i)return 0;if(i<256)e.dest[e.destLen++]=i;else{var c,u,l,h=void 0;for(c=p(e,a[i-=257],n[i]),u=g(e,r),h=l=e.destLen-p(e,o[u],s[u]);h<l+c;++h)e.dest[e.destLen++]=e.dest[h]}}}function b(e){for(var t,r;e.bitcount>8;)e.sourceIndex--,e.bitcount-=8;if((t=256*(t=e.source[e.sourceIndex+1])+e.source[e.sourceIndex])!==(65535&~(256*e.source[e.sourceIndex+3]+e.source[e.sourceIndex+2])))return-3;for(e.sourceIndex+=4,r=t;r;--r)e.dest[e.destLen++]=e.source[e.sourceIndex++];return e.bitcount=0,0}return function(e,t){var r;for(r=0;r<7;++r)e.table[r]=0;for(e.table[7]=24,e.table[8]=152,e.table[9]=112,r=0;r<24;++r)e.trans[r]=256+r;for(r=0;r<144;++r)e.trans[24+r]=r;for(r=0;r<8;++r)e.trans[168+r]=280+r;for(r=0;r<112;++r)e.trans[176+r]=144+r;for(r=0;r<5;++r)t.table[r]=0;for(t.table[5]=32,r=0;r<32;++r)t.trans[r]=r}(r,i),h(a,n,4,3),h(o,s,2,1),a[28]=0,n[28]=258,function(e,a){var n,o,s=new t(e,a);do{switch(n=m(s),p(s,2,0)){case 0:o=b(s);break;case 1:o=y(s,r,i);break;case 2:v(s,s.ltree,s.dtree),o=y(s,s.ltree,s.dtree);break;default:o=-3}if(0!==o)throw new Error("Data error")}while(!n);return s.destLen<s.dest.length?"function"==typeof s.dest.slice?s.dest.slice(0,s.destLen):s.dest.subarray(0,s.destLen):s.dest}}(),ve={UTF16:function(e,t,r){for(var i=[],a=r/2,n=0;n<a;n++,t+=2)i[n]=e.getUint16(t);return String.fromCharCode.apply(null,i)}},ye={"x-mac-croatian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®Š™´¨≠ŽØ∞±≤≥∆µ∂∑∏š∫ªºΩžø¿¡¬√ƒ≈ƫȅ ÀÃÕŒœĐ—“”‘’÷◊©⁄€‹›Æ»–·‚„‰ÂćÁčÈÍÎÏÌÓÔđÒÚÛÙıˆ˜¯πË˚¸Êæˇ","x-mac-cyrillic":"АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°Ґ£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµґЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю","x-mac-gaelic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØḂ±≤≥ḃĊċḊḋḞḟĠġṀæøṁṖṗɼƒſṠ«»… ÀÃÕŒœ–—“”‘’ṡẛÿŸṪ€‹›Ŷŷṫ·Ỳỳ⁊ÂÊÁËÈÍÎÏÌÓÔ♣ÒÚÛÙıÝýŴŵẄẅẀẁẂẃ","x-mac-greek":"Ĺ²É³ÖÜ΅àâä΄¨çéèê룙î‰ôö¦€ùûü†ΓΔΘΛΞΠß®©ΣΪ§≠°·Α±≤≥¥ΒΕΖΗΙΚΜΦΫΨΩάΝ¬ΟΡ≈Τ«»… ΥΧΆΈœ–―“”‘’÷ΉΊΌΎέήίόΏύαβψδεφγηιξκλμνοπώρστθωςχυζϊϋΐΰ","x-mac-icelandic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüݰ¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€ÐðÞþý·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-inuit":"ᐃᐄᐅᐆᐊᐋᐱᐲᐳᐴᐸᐹᑉᑎᑏᑐᑑᑕᑖᑦᑭᑮᑯᑰᑲᑳᒃᒋᒌᒍᒎᒐᒑ°ᒡᒥᒦ•¶ᒧ®©™ᒨᒪᒫᒻᓂᓃᓄᓅᓇᓈᓐᓯᓰᓱᓲᓴᓵᔅᓕᓖᓗᓘᓚᓛᓪᔨᔩᔪᔫᔭ… ᔮᔾᕕᕖᕗ–—“”‘’ᕘᕙᕚᕝᕆᕇᕈᕉᕋᕌᕐᕿᖀᖁᖂᖃᖄᖅᖏᖐᖑᖒᖓᖔᖕᙱᙲᙳᙴᙵᙶᖖᖠᖡᖢᖣᖤᖥᖦᕼŁł","x-mac-ce":"ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅņѬ√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ",macintosh:"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-romanian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ĂȘ∞±≤≥¥µ∂∑∏π∫ªºΩăș¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›Țț‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-turkish":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ"};function be(e,t){for(var r="",i=t;i<t+4;i++)r+=String.fromCharCode(e.getInt8(i));return r}function xe(e,t){return e.getUint16(t,!1)}function Te(e,t){return e.getUint32(t,!1)}ve.MACSTRING=function(e,t,r,i){var a=ye[i];if(void 0!==a){for(var n="",o=0;o<r;o++){var s=e.getUint8(t+o);n+=s<=127?String.fromCharCode(s):a[127&s]}return n}};var we={byte:1,uShort:2,short:2,uLong:4,fixed:4,longDateTime:8,tag:4};function ke(e,t){for(var r=[],i=12,a=0;a<t;a+=1){var n=be(e,i),o=Te(e,i+4),s=Te(e,i+8),c=Te(e,i+12);r.push({tag:n,checksum:o,offset:s,length:c,compression:!1}),i+=16}return r}function Se(e,t){if("WOFF"===t.compression){var r=new Uint8Array(e.buffer,t.offset+2,t.compressedLength-2),i=new Uint8Array(t.length);return ge(r,i),i.byteLength!==t.length&&oe.error("Decompression error: "+t.tag+" decompressed length doesn't match recorded length"),{data:new DataView(i.buffer,0),offset:0}}return{data:e,offset:t.offset}}var Ee=function(){function e(e,t){this.data=e,this.offset=t,this.relativeOffset=0}return e.prototype.parseByte=function(){var e=this.data.getUint8(this.offset+this.relativeOffset);return this.relativeOffset+=1,e},e.prototype.parseUShort=function(){var e=this.data.getUint16(this.offset+this.relativeOffset);return this.relativeOffset+=2,e},e.prototype.parseULong=function(){var e=Te(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,e},e.prototype.parseShort=function(){var e=this.data.getInt16(this.offset+this.relativeOffset);return this.relativeOffset+=2,e},e.prototype.parseFixed=function(){var e,t,r=(e=this.data,t=this.offset+this.relativeOffset,e.getInt16(t,!1)+e.getUint16(t+2,!1)/65535);return this.relativeOffset+=4,r},e.prototype.parseVersion=function(e){var t=xe(this.data,this.offset+this.relativeOffset),r=xe(this.data,this.offset+this.relativeOffset+2);return this.relativeOffset+=4,void 0===e&&(e=4096),t+r/e/10},e.prototype.skip=function(e,t){void 0===t&&(t=1),this.relativeOffset+=we[e]*t},e}(),Ce=["copyright","fontFamily","fontSubfamily","uniqueID","fullName","version","postScriptName","trademark","manufacturer","designer","description","manufacturerURL","designerURL","license","licenseURL","reserved","preferredFamily","preferredSubfamily","compatibleFullName","sampleText","postScriptFindFontName","wwsFamily","wwsSubfamily"],Ae={0:"en",1:"fr",2:"de",3:"it",4:"nl",5:"sv",6:"es",7:"da",8:"pt",9:"no",10:"he",11:"ja",12:"ar",13:"fi",14:"el",15:"is",16:"mt",17:"tr",18:"hr",19:"zh-Hant",20:"ur",21:"hi",22:"th",23:"ko",24:"lt",25:"pl",26:"hu",27:"es",28:"lv",29:"se",30:"fo",31:"fa",32:"ru",33:"zh",34:"nl-BE",35:"ga",36:"sq",37:"ro",38:"cz",39:"sk",40:"si",41:"yi",42:"sr",43:"mk",44:"bg",45:"uk",46:"be",47:"uz",48:"kk",49:"az-Cyrl",50:"az-Arab",51:"hy",52:"ka",53:"mo",54:"ky",55:"tg",56:"tk",57:"mn-CN",58:"mn",59:"ps",60:"ks",61:"ku",62:"sd",63:"bo",64:"ne",65:"sa",66:"mr",67:"bn",68:"as",69:"gu",70:"pa",71:"or",72:"ml",73:"kn",74:"ta",75:"te",76:"si",77:"my",78:"km",79:"lo",80:"vi",81:"id",82:"tl",83:"ms",84:"ms-Arab",85:"am",86:"ti",87:"om",88:"so",89:"sw",90:"rw",91:"rn",92:"ny",93:"mg",94:"eo",128:"cy",129:"eu",130:"ca",131:"la",132:"qu",133:"gn",134:"ay",135:"tt",136:"ug",137:"dz",138:"jv",139:"su",140:"gl",141:"af",142:"br",143:"iu",144:"gd",145:"gv",146:"ga",147:"to",148:"el-polyton",149:"kl",150:"az",151:"nn"},_e={1078:"af",1052:"sq",1156:"gsw",1118:"am",5121:"ar-DZ",15361:"ar-BH",3073:"ar",2049:"ar-IQ",11265:"ar-JO",13313:"ar-KW",12289:"ar-LB",4097:"ar-LY",6145:"ary",8193:"ar-OM",16385:"ar-QA",1025:"ar-SA",10241:"ar-SY",7169:"aeb",14337:"ar-AE",9217:"ar-YE",1067:"hy",1101:"as",2092:"az-Cyrl",1068:"az",1133:"ba",1069:"eu",1059:"be",2117:"bn",1093:"bn-IN",8218:"bs-Cyrl",5146:"bs",1150:"br",1026:"bg",1027:"ca",3076:"zh-HK",5124:"zh-MO",2052:"zh",4100:"zh-SG",1028:"zh-TW",1155:"co",1050:"hr",4122:"hr-BA",1029:"cs",1030:"da",1164:"prs",1125:"dv",2067:"nl-BE",1043:"nl",3081:"en-AU",10249:"en-BZ",4105:"en-CA",9225:"en-029",16393:"en-IN",6153:"en-IE",8201:"en-JM",17417:"en-MY",5129:"en-NZ",13321:"en-PH",18441:"en-SG",7177:"en-ZA",11273:"en-TT",2057:"en-GB",1033:"en",12297:"en-ZW",1061:"et",1080:"fo",1124:"fil",1035:"fi",2060:"fr-BE",3084:"fr-CA",1036:"fr",5132:"fr-LU",6156:"fr-MC",4108:"fr-CH",1122:"fy",1110:"gl",1079:"ka",3079:"de-AT",1031:"de",5127:"de-LI",4103:"de-LU",2055:"de-CH",1032:"el",1135:"kl",1095:"gu",1128:"ha",1037:"he",1081:"hi",1038:"hu",1039:"is",1136:"ig",1057:"id",1117:"iu",2141:"iu-Latn",2108:"ga",1076:"xh",1077:"zu",1040:"it",2064:"it-CH",1041:"ja",1099:"kn",1087:"kk",1107:"km",1158:"quc",1159:"rw",1089:"sw",1111:"kok",1042:"ko",1088:"ky",1108:"lo",1062:"lv",1063:"lt",2094:"dsb",1134:"lb",1071:"mk",2110:"ms-BN",1086:"ms",1100:"ml",1082:"mt",1153:"mi",1146:"arn",1102:"mr",1148:"moh",1104:"mn",2128:"mn-CN",1121:"ne",1044:"nb",2068:"nn",1154:"oc",1096:"or",1123:"ps",1045:"pl",1046:"pt",2070:"pt-PT",1094:"pa",1131:"qu-BO",2155:"qu-EC",3179:"qu",1048:"ro",1047:"rm",1049:"ru",9275:"smn",4155:"smj-NO",5179:"smj",3131:"se-FI",1083:"se",2107:"se-SE",8251:"sms",6203:"sma-NO",7227:"sms",1103:"sa",7194:"sr-Cyrl-BA",3098:"sr",6170:"sr-Latn-BA",2074:"sr-Latn",1132:"nso",1074:"tn",1115:"si",1051:"sk",1060:"sl",11274:"es-AR",16394:"es-BO",13322:"es-CL",9226:"es-CO",5130:"es-CR",7178:"es-DO",12298:"es-EC",17418:"es-SV",4106:"es-GT",18442:"es-HN",2058:"es-MX",19466:"es-NI",6154:"es-PA",15370:"es-PY",10250:"es-PE",20490:"es-PR",3082:"es",1034:"es",21514:"es-US",14346:"es-UY",8202:"es-VE",2077:"sv-FI",1053:"sv",1114:"syr",1064:"tg",2143:"tzm",1097:"ta",1092:"tt",1098:"te",1054:"th",1105:"bo",1055:"tr",1090:"tk",1152:"ug",1058:"uk",1070:"hsb",1056:"ur",2115:"uz-Cyrl",1091:"uz",1066:"vi",1106:"cy",1160:"wo",1157:"sah",1144:"ii",1130:"yo"},Me={0:"macintosh",1:"x-mac-japanese",2:"x-mac-chinesetrad",3:"x-mac-korean",6:"x-mac-greek",7:"x-mac-cyrillic",9:"x-mac-devanagai",10:"x-mac-gurmukhi",11:"x-mac-gujarati",12:"x-mac-oriya",13:"x-mac-bengali",14:"x-mac-tamil",15:"x-mac-telugu",16:"x-mac-kannada",17:"x-mac-malayalam",18:"x-mac-sinhalese",19:"x-mac-burmese",20:"x-mac-khmer",21:"x-mac-thai",22:"x-mac-lao",23:"x-mac-georgian",24:"x-mac-armenian",25:"x-mac-chinesesimp",26:"x-mac-tibetan",27:"x-mac-mongolian",28:"x-mac-ethiopic",29:"x-mac-ce",30:"x-mac-vietnamese",31:"x-mac-extarabic"},Ie={15:"x-mac-icelandic",17:"x-mac-turkish",18:"x-mac-croatian",24:"x-mac-ce",25:"x-mac-ce",26:"x-mac-ce",27:"x-mac-ce",28:"x-mac-ce",30:"x-mac-icelandic",37:"x-mac-romanian",38:"x-mac-ce",39:"x-mac-ce",40:"x-mac-ce",143:"x-mac-inuit",146:"x-mac-gaelic"};function Re(e,t,r){switch(e){case 0:if(65535===t)return"und";if(r)return r[t];break;case 1:return Ae[t];case 3:return _e[t]}}var Pe="utf-16";function Oe(e,t,r){switch(e){case 0:return Pe;case 1:return Ie[r]||Me[t];case 3:if(1===t||10===t)return Pe}}var De={0:"unicode",1:"macintosh",2:"reserved",3:"windows"};function Be(e){return De[e]}function Fe(e,t){var r,i=new Ee(e,t),a=i.parseULong();r="Unsupported ltag table version.",1===a||fail(r),i.skip("uLong",1);for(var n=i.parseULong(),o=[],s=0;s<n;s++){for(var c="",u=t+i.parseUShort(),l=i.parseUShort(),h=u;h<u+l;++h)c+=String.fromCharCode(e.getInt8(h));o.push(c)}return o}var Le={parse:function(e){var t,r,i=new DataView(e,0),a=be(i,0),n=!1;if(a===String.fromCharCode(0,1,0,0)||"true"===a||"typ1"===a)r=ke(i,t=xe(i,4));else if("OTTO"===a)r=ke(i,t=xe(i,4)),n=!0;else if("wOFF"===a){var o=be(i,4);if(o===String.fromCharCode(0,1,0,0));else if("OTTO"!==o)return void oe.error("Unsupported OpenType flavor "+a);r=function(e,t){for(var r=[],i=44,a=0;a<t;a+=1){var n=be(e,i),o=Te(e,i+4),s=Te(e,i+8),c=Te(e,i+12),u=void 0;u=s<c&&"WOFF",r.push({tag:n,offset:o,compression:u,compressedLength:s,length:c}),i+=20}return r}(i,t=xe(i,12))}else if("wOF2"===a){oe.error("WOFF2 require an external decompressor library, see examples at: https://github.com/opentypejs/opentype.js/issues/183#issuecomment-1147228025")}else oe.error("Unsupported OpenType signature "+a);for(var s,c,u,l,h=2048,d=0,f=!1,m=0;m<t;m++){var p=r[m];if("head"===p.tag){var g=Se(i,p);(v=new Ee(g.data,g.offset)).parseVersion(),v.parseFixed(),v.parseULong(),v.parseULong(),v.parseUShort(),h=v.parseUShort()}else if("hhea"===p.tag){if(!f){g=Se(i,p);(v=new Ee(g.data,g.offset)).parseVersion(),s=Math.abs(v.parseShort()),c=Math.abs(v.parseShort()),d=Math.abs(v.parseShort()||0)}}else if("ltag"===p.tag){l=Fe((g=Se(i,p)).data,g.offset)}else if("name"===p.tag)u=Se(i,p);else if("OS/2"===p.tag){g=Se(i,p);var v,y=(v=new Ee(g.data,g.offset)).parseUShort();v.parseShort(),v.parseUShort(),v.parseUShort(),v.parseUShort(),v.parseShort(),v.parseShort(),v.parseShort(),v.parseShort(),v.parseShort(),v.parseShort(),v.parseShort(),v.parseShort(),v.parseShort(),v.parseShort(),v.parseShort();for(var b=0;b<10;b++)v.parseByte();v.parseULong(),v.parseULong(),v.parseULong(),v.parseULong(),v.parseByte(),v.parseByte(),v.parseByte(),v.parseByte();var x=v.parseUShort(),T=y>=4&&(128&x||n);(T||void 0===s)&&(v.parseUShort(),v.parseUShort(),s=Math.abs(v.parseShort()),c=Math.abs(v.parseShort()),d=Math.abs(v.parseShort()||0),T&&(f=!0))}}var w=u?function(e,t,r){for(var i={},a=new Ee(e,t),n=a.parseUShort(),o=a.parseUShort(),s=a.offset+a.parseUShort(),c=0;c<o;c++){var u=a.parseUShort(),l=a.parseUShort(),h=a.parseUShort(),d=a.parseUShort(),f=Ce[d]||d,m=a.parseUShort(),p=a.parseUShort(),g=Re(u,h,r),v=Oe(u,l,h),y=Be(u);if(void 0!==v&&void 0!==g&&void 0!==y){var b=void 0;if(b=v===Pe?ve.UTF16(e,s+p,m):ve.MACSTRING(e,s+p,m,v)){var x=i[y];void 0===x&&(x=i[y]={});var T=x[f];void 0===T&&(T=x[f]={}),T[g]=b}}}return 1===n&&a.parseUShort(),i}(u.data,u.offset,l):{},k={};return w.macintosh&&Object.assign(k,w.macintosh),w.windows&&Object.assign(k,w.windows),{name:k,emSquare:h,ascent:s,descent:c,lineGap:d}}},Ne={name:"Arial",family:"Arial",lhr:1.14990234375,car:1.1171875,blr:.9052734375,lgr:.03271484375,list:[{style:"Regular",postscriptName:"Arial"}]},Ue="localFonts",ze="undefined"!=typeof navigator&&/win/i.test(navigator.platform),We={Arial:Ne},Ve={Arial:Ne},He={},Xe={KEY_INFO:Ue,info:We,data:Ve,hasRegister:function(e){return Ve.hasOwnProperty(e)},registerLocalFonts:function(e){return i(this,void 0,void 0,function(){var t,r,i,n,o,s,c,u,l,h,d,f,m,p,g,v;return a(this,function(a){switch(a.label){case 0:return e?[3,2]:[4,oe.loadLocalFonts()];case 1:e=a.sent()||[],a.label=2;case 2:if(t={},"undefined"!=typeof localStorage)try{t=JSON.parse(localStorage.getItem(Ue)||"{}")}catch(e){}r=t.data||{},(!t.version||t.version<2)&&(r={}),i=0,n=e.length,a.label=3;case 3:return i<n?(o=e[i],s=o.postscriptName,c=o.family,u=o.style,ze?[4,oe.addLocalFont(s)]:[3,5]):[3,10];case 4:a.sent(),a.label=5;case 5:return r.hasOwnProperty(c)&&(l=r[c],We[c]=We[c]||{name:l.name,family:c,lhr:l.lhr,car:l.car,blr:l.blr,lgr:l.lgr,list:[]}),We.hasOwnProperty(c)?[3,8]:(h=We[c]={name:"",family:"",lhr:0,car:0,blr:0,lgr:0,list:[]},[4,o.blob()]);case 6:return[4,a.sent().arrayBuffer()];case 7:d=a.sent(),(f=Le.parse(d))&&f.name&&(h.name=(null===(p=f.name.preferredFamily)||void 0===p?void 0:p.zh)||(null===(g=f.name.preferredFamily)||void 0===g?void 0:g.en)||(null===(v=f.name.fontFamily)||void 0===v?void 0:v.zh)),h.name=h.name||c,h.family=c,m=this._cal(c,f),Object.assign(h,m),a.label=8;case 8:this._register(c,u,s),je(c),s!==c&&je(s),a.label=9;case 9:return i++,[3,3];case 10:return this.updateLocalStorage(),[2]}})})},registerAb:function(e,t){return i(this,void 0,void 0,function(){var r,i,n,o,s,c,u,l,h,d,f,m,p,g;return a(this,function(a){switch(a.label){case 0:return t&&Ve.hasOwnProperty(t)?[2]:(r={},(i=Le.parse(e))&&i.name&&(r.family=(null===(u=i.name.preferredFamily)||void 0===u?void 0:u.en)||(null===(l=i.name.fontFamily)||void 0===l?void 0:l.en),r.name=(null===(h=i.name.preferredFamily)||void 0===h?void 0:h.zh)||(null===(d=i.name.preferredFamily)||void 0===d?void 0:d.en)||(null===(f=i.name.fontFamily)||void 0===f?void 0:f.zh)||r.family),n=r.family,o=(null===(m=i.name.preferredSubfamily)||void 0===m?void 0:m.en)||(null===(p=i.name.fontSubfamily)||void 0===p?void 0:p.en),s=null===(g=i.name.postScriptName)||void 0===g?void 0:g.en,n&&o&&s?[4,oe.addArrayBufferFont(n,e)]:[2]);case 1:return a.sent(),s===n?[3,3]:[4,oe.addArrayBufferFont(s,e)];case 2:a.sent(),a.label=3;case 3:return t&&t!==n&&t!==s?[4,oe.addArrayBufferFont(t,e)]:[3,5];case 4:a.sent(),a.label=5;case 5:return We.hasOwnProperty(n)||(c=this._cal(n,i),Object.assign(r,c),r.list=[],We[n]=Ve[n]=r),this._register(n,o,s),t&&t!==n&&t!==s&&(We[t]=Ve[t]=Ve[n]),je(n),s!==n&&je(s),t&&t!==n&&t!==s&&je(t),[2,Ve[n]]}})})},_cal:function(e,t){var r=0;return["times","helvetica","courier"].indexOf(e.toLowerCase())>-1&&(r=Math.round(.15*(t.ascent+t.descent))),{lhr:(t.ascent+r+t.descent+t.lineGap)/t.emSquare,car:(t.ascent+r+t.descent)/t.emSquare,blr:(t.ascent+r)/t.emSquare,lgr:t.lineGap/t.emSquare}},_register:function(e,t,r){for(var i=We[e],a=i.list=i.list||[],n=!1,o=0,s=a.length;o<s;o++){if(a[o].postscriptName===r){n=!0;break}}return n||a.push({style:t,postscriptName:r}),{family:e,postscriptName:r,data:Ve[e]=Ve[r]=i}},waitIfNotRegister:function(e,t){Ve[e]||(He[e]=He[e]||[]).push(t)},updateLocalStorage:function(){var e={};for(var t in We)if(We.hasOwnProperty(t)){var r=We[t];e[t]={name:r.name,lhr:r.lhr,car:r.car,blr:r.blr,lgr:r.lgr}}"undefined"!=typeof localStorage&&localStorage.setItem(Ue,JSON.stringify({version:2,data:e}))}};function je(e){He.hasOwnProperty(e)&&(He[e].slice(0).forEach(function(e){e()}),delete He[e])}function Ge(e,t,r,i){return e*r+t*i}function Ye(e,t,r,i,a,n){return e*i+t*a+r*n}function qe(e,t,r,i){return e*i-r*t}function Ke(e,t,r,i,a){void 0===a&&(a=!1);var n=0;return n=e===r&&t===i?1:t===i&&0===t?e>0&&r>0||e<0&&r<0?1:-1:e===r&&0===e?t>0&&i>0||t<0&&i<0?1:-1:Ge(e,t,r,i)/($e(e,t)*$e(r,i)),a?n:Math.acos(n)||0}function $e(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Qe(e,t,r){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2)+Math.pow(r,2))}function Ze(e,t){var r=$e(e,t);return{x:e/r,y:t/r}}function Je(e,t,r,i){return Math.abs(e)<1e-9&&Math.abs(t)<1e-9&&Math.abs(r)<1e-9&&Math.abs(i)<1e-9}function et(e,t,r,i,a,n){return Math.abs(e)<1e-9&&Math.abs(t)<1e-9&&Math.abs(r)<1e-9&&Math.abs(i)<1e-9&&Math.abs(a)<1e-9&&Math.abs(n)<1e-9}function tt(e,t,r,i){var a=Ge(e,t,r,i)/($e(e,t)*$e(r,i));return a<-1?a=-1:a>1&&(a=1),Math.acos(a)}function rt(e,t,r,i,a,n){var o=Ye(e,t,r,i,a,n)/(Qe(e,t,r)*Qe(i,a,n));return o<-1?o=-1:o>1&&(o=1),Math.acos(o)}var it={dotProduct:Ge,dotProduct3:Ye,crossProduct:qe,crossProduct3:function(e,t,r,i,a,n){return{x:t*n-a*r,y:r*i-n*e,z:e*a-i*t}},projection:function(e,t,r,i){var a=Ge(e,t,r,i),n=Math.pow(r,2)+Math.pow(i,2);return{x:a*r/n,y:a*i/n}},includedAngle:Ke,length:$e,length3:Qe,unitize:Ze,unitize3:function(e,t,r){var i=Qe(e,t,r);return{x:e/i,y:t/i,z:r/i}},angle:tt,angle3:rt,isParallel:function(e,t,r,i){if(Je(e,t,r,i))return!0;var a=tt(e,t,r,i);return Math.abs(a)<1e-9||Math.PI-Math.abs(a)<1e-9},isParallel3:function(e,t,r,i,a,n){if(et(e,t,r,i,a,n))return!0;var o=rt(e,t,r,i,a,n);return Math.abs(o)<1e-9||Math.PI-Math.abs(o)<1e-9},isZero:Je,isZero3:et};function at(){return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}function nt(e){return!e||!e.length||1===e[0]&&0===e[1]&&0===e[2]&&0===e[3]&&0===e[4]&&1===e[5]&&0===e[6]&&0===e[7]&&0===e[8]&&0===e[9]&&1===e[10]&&0===e[11]&&0===e[12]&&0===e[13]&&0===e[14]&&1===e[15]}function ot(e,t){if(nt(e))return new Float32Array(t);if(nt(t))return new Float32Array(e);for(var r=at(),i=0;i<4;i++){var a=e[i],n=e[i+4],o=e[i+8],s=e[i+12];r[i]=a*t[0]+n*t[1]+o*t[2]+s*t[3],r[i+4]=a*t[4]+n*t[5]+o*t[6]+s*t[7],r[i+8]=a*t[8]+n*t[9]+o*t[10]+s*t[11],r[i+12]=a*t[12]+n*t[13]+o*t[14]+s*t[15]}return r}function st(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function ct(e){if(nt(e))return at();var t=new Float32Array(16);t[0]=e[5]*e[10]*e[15]-e[5]*e[11]*e[14]-e[9]*e[6]*e[15]+e[9]*e[7]*e[14]+e[13]*e[6]*e[11]-e[13]*e[7]*e[10],t[4]=-e[4]*e[10]*e[15]+e[4]*e[11]*e[14]+e[8]*e[6]*e[15]-e[8]*e[7]*e[14]-e[12]*e[6]*e[11]+e[12]*e[7]*e[10],t[8]=e[4]*e[9]*e[15]-e[4]*e[11]*e[13]-e[8]*e[5]*e[15]+e[8]*e[7]*e[13]+e[12]*e[5]*e[11]-e[12]*e[7]*e[9],t[12]=-e[4]*e[9]*e[14]+e[4]*e[10]*e[13]+e[8]*e[5]*e[14]-e[8]*e[6]*e[13]-e[12]*e[5]*e[10]+e[12]*e[6]*e[9],t[1]=-e[1]*e[10]*e[15]+e[1]*e[11]*e[14]+e[9]*e[2]*e[15]-e[9]*e[3]*e[14]-e[13]*e[2]*e[11]+e[13]*e[3]*e[10],t[5]=e[0]*e[10]*e[15]-e[0]*e[11]*e[14]-e[8]*e[2]*e[15]+e[8]*e[3]*e[14]+e[12]*e[2]*e[11]-e[12]*e[3]*e[10],t[9]=-e[0]*e[9]*e[15]+e[0]*e[11]*e[13]+e[8]*e[1]*e[15]-e[8]*e[3]*e[13]-e[12]*e[1]*e[11]+e[12]*e[3]*e[9],t[13]=e[0]*e[9]*e[14]-e[0]*e[10]*e[13]-e[8]*e[1]*e[14]+e[8]*e[2]*e[13]+e[12]*e[1]*e[10]-e[12]*e[2]*e[9],t[2]=e[1]*e[6]*e[15]-e[1]*e[7]*e[14]-e[5]*e[2]*e[15]+e[5]*e[3]*e[14]+e[13]*e[2]*e[7]-e[13]*e[3]*e[6],t[6]=-e[0]*e[6]*e[15]+e[0]*e[7]*e[14]+e[4]*e[2]*e[15]-e[4]*e[3]*e[14]-e[12]*e[2]*e[7]+e[12]*e[3]*e[6],t[10]=e[0]*e[5]*e[15]-e[0]*e[7]*e[13]-e[4]*e[1]*e[15]+e[4]*e[3]*e[13]+e[12]*e[1]*e[7]-e[12]*e[3]*e[5],t[14]=-e[0]*e[5]*e[14]+e[0]*e[6]*e[13]+e[4]*e[1]*e[14]-e[4]*e[2]*e[13]-e[12]*e[1]*e[6]+e[12]*e[2]*e[5],t[3]=-e[1]*e[6]*e[11]+e[1]*e[7]*e[10]+e[5]*e[2]*e[11]-e[5]*e[3]*e[10]-e[9]*e[2]*e[7]+e[9]*e[3]*e[6],t[7]=e[0]*e[6]*e[11]-e[0]*e[7]*e[10]-e[4]*e[2]*e[11]+e[4]*e[3]*e[10]+e[8]*e[2]*e[7]-e[8]*e[3]*e[6],t[11]=-e[0]*e[5]*e[11]+e[0]*e[7]*e[9]+e[4]*e[1]*e[11]-e[4]*e[3]*e[9]-e[8]*e[1]*e[7]+e[8]*e[3]*e[5],t[15]=e[0]*e[5]*e[10]-e[0]*e[6]*e[9]-e[4]*e[1]*e[10]+e[4]*e[2]*e[9]+e[8]*e[1]*e[6]-e[8]*e[2]*e[5];var r=e[0]*t[0]+e[1]*t[4]+e[2]*t[8]+e[3]*t[12];if(0===r)return at();r=1/r;for(var i=new Float32Array(16),a=0;a<16;a++)i[a]=t[a]*r;return i}function ut(e,t){return e&&t&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e}function lt(e,t,r){return t||r?(e[12]+=e[0]*t+e[4]*r,e[13]+=e[1]*t+e[5]*r,e[14]+=e[2]*t+e[6]*r,e[15]+=e[3]*t+e[7]*r,e):e}function ht(e,t,r){if(!e&&!t)return r;var i=r[3],a=r[7],n=r[11],o=r[15];return r[0]+=i*e,r[1]+=i*t,r[4]+=a*e,r[5]+=a*t,r[8]+=n*e,r[9]+=n*t,r[12]+=o*e,r[13]+=o*t,r}function dt(e,t){if(!t)return e;var r=Math.tan(t);return e[4]+=e[0]*r,e[5]+=e[1]*r,e[6]+=e[2]*r,e[7]+=e[3]*r,e}function ft(e,t){if(!t)return e;var r=Math.tan(t);return e[0]+=e[4]*r,e[1]+=e[5]*r,e[2]+=e[6]*r,e[3]+=e[7]*r,e}function mt(e,t){if(!t)return e;var r=Math.sin(t),i=Math.cos(t),a=e[4],n=e[5],o=e[6],s=e[7],c=e[8],u=e[10],l=e[11];return e[4]=a*i+c*r,e[5]=n*i+o*r,e[6]=o*i+u*r,e[7]=s*i+l*r,e[8]=a*-r+c*i,e[9]=n*-r+o*i,e[10]=o*-r+u*i,e[11]=s*-r+l*i,e}function pt(e,t){if(!t)return e;var r=Math.sin(t),i=Math.cos(t),a=e[0],n=e[1],o=e[2],s=e[3],c=e[8],u=e[9],l=e[10],h=e[11];return e[0]=a*i+c*-r,e[1]=n*i+u*-r,e[2]=o*i+l*-r,e[3]=s*i+h*-r,e[8]=a*r+c*i,e[9]=n*r+u*i,e[10]=o*r+l*i,e[11]=s*r+h*i,e}function gt(e,t){if(!t)return e;var r=Math.sin(t),i=Math.cos(t),a=e[0],n=e[1],o=e[2],s=e[3],c=e[4],u=e[5],l=e[6],h=e[7];return e[0]=a*i+c*r,e[1]=n*i+u*r,e[2]=o*i+l*r,e[3]=s*i+h*r,e[4]=a*-r+c*i,e[5]=n*-r+u*i,e[6]=o*-r+l*i,e[7]=s*-r+h*i,e}function vt(e,t){return 1===t||(e[0]*=t,e[1]*=t,e[2]*=t,e[3]*=t),e}function yt(e,t){return 1===t||(e[4]*=t,e[5]*=t,e[6]*=t,e[7]*=t),e}function bt(e,t){if(t&&!nt(t)){var r=e.x,i=e.y,a=e.z,n=void 0===a?0:a,o=e.w,s=void 0===o?1:o,c=t[0],u=t[1],l=t[2],h=t[3],d=t[4],f=t[5],m=t[6],p=t[7],g=t[8],v=t[9],y=t[10],b=t[11],x=t[12],T=t[13],w=t[14],k=t[15],S={x:(1===c?r:r*c)+(d?i*d:0)+(1===s?x:x*s),y:(1===u?r:r*u)+(f?i*f:0)+(1===s?T:T*s),z:n,w:s};return h||p||b?S.w=r*h+i*p+n*b+k*s:1!==k&&(S.w*=k),n?(S.x+=n*g,S.y+=n*v,S.z=r*l+i*m+w+n*y):(l||m||w)&&(S.z=r*l+i*m+w),S}return e}function xt(e){if(16===e.length)return ct(e);var t=e[0],r=e[1],i=e[2],a=e[3],n=e[4],o=e[5];if(1===t&&0===r&&0===i&&1===a&&0===n&&0===o)return e;var s=t*a-r*i;return 0===s?e:new Float32Array([a/s,-r/s,-i/s,t/s,(i*o-a*n)/s,(r*n-t*o)/s])}function Tt(e,t,r,i,a){var n,o,s,c,u,l,h,d,f=bt({x:e,y:t},a),m=f.x,p=f.y,g=f.z,v=f.w,y=bt({x:r,y:i},a),b=y.x,x=y.y,T=y.z,w=y.w;if(a&&a.length&&(a[1]||a[2]||a[4]||a[6]||a[7]||a[8])){var k=bt({x:r,y:t},a);n=k.x,o=k.y,s=k.z,c=k.w,u=(k=bt({x:e,y:i},a)).x,l=k.y,h=k.z,d=k.w}else n=b,o=p,u=m,l=x;return{x1:m,y1:p,z1:g,w1:v,x2:n,y2:o,z2:s,w2:c,x3:b,y3:x,z3:T,w3:w,x4:u,y4:l,z4:h,w4:d}}var wt={identity:at,isE:nt,toE:st,assignMatrix:ut,inverse:xt,inverse4:ct,calPoint:bt,calRectPoints:Tt,tfoMultiply:ht,multiplyTfo:lt,multiply:ot,multiplyRef:function(e,t){if(nt(e))return t;if(nt(t))return ut(t,e),t;for(var r=t[0],i=t[1],a=t[2],n=t[3],o=t[4],s=t[5],c=t[6],u=t[7],l=t[8],h=t[9],d=t[10],f=t[11],m=t[12],p=t[13],g=t[14],v=t[15],y=0;y<4;y++){var b=e[y],x=e[y+4],T=e[y+8],w=e[y+12];t[y]=b*r+x*i+T*a+w*n,t[y+4]=b*o+x*s+T*c+w*u,t[y+8]=b*l+x*h+T*d+w*f,t[y+12]=b*m+x*p+T*g+w*v}return t},multiplyTranslate:function(e,t,r){return t||r?(e[12]+=e[0]*t+e[4]*r,e[13]+=e[1]*t+e[5]*r,e[14]+=e[2]*t+e[6]*r,e[15]+=e[3]*t+e[7]*r,e):e},multiplyTranslateX:function(e,t){return t?(e[12]+=e[0]*t,e[13]+=e[1]*t,e[14]+=e[2]*t,e[15]+=e[3]*t,e):e},multiplyTranslateY:function(e,t){return t?(e[12]+=e[4]*t,e[13]+=e[5]*t,e[14]+=e[6]*t,e[15]+=e[7]*t,e):e},multiplyTranslateZ:function(e,t){return t?(e[12]+=e[8]*t,e[13]+=e[9]*t,e[14]+=e[10]*t,e[15]+=e[11]*t,e):e},multiplyRotateX:mt,multiplyRotateY:pt,multiplyRotateZ:gt,multiplySkewX:dt,multiplySkewY:ft,multiplyScale:function(e,t){return 1===t||(e[0]*=t,e[1]*=t,e[2]*=t,e[3]*=t,e[4]*=t,e[5]*=t,e[6]*=t,e[7]*=t),e},multiplyScaleX:vt,multiplyScaleY:yt},kt=1e-9;function St(e){var t=[],r=e[3],i=e[2]/r,a=e[1]/r,n=(3*a-i*i)/3,o=(2*i*i*i-9*a*i+27*(e[0]/r))/27,s=i/3,c=o*o/4+n*n*n/27,u=o/2;if(Math.abs(c)<=kt&&(c=0),c>0){var l=Math.sqrt(c),h=void 0,d=void 0;d=(h=-u+l)>=0?Math.pow(h,1/3):-Math.pow(-h,1/3),(h=-u-l)>=0?d+=Math.pow(h,1/3):d-=Math.pow(-h,1/3),t.push(d-s)}else if(c<0){var f=Math.sqrt(-n/3),m=Math.atan2(Math.sqrt(-c),-u)/3,p=Math.cos(m),g=Math.sin(m),v=Math.sqrt(3);t.push(2*f*p-s),t.push(-f*(p+v*g)-s),t.push(-f*(p-v*g)-s)}else{h=void 0;h=u>=0?-Math.pow(u,1/3):Math.pow(-u,1/3),t.push(2*h-s),t.push(-h-s)}return t}function Et(e){for(var t=e.length-1,r=t;r>=0&&0===e[r];r--)t--;var i=[];switch(t){case 1:i=function(e){var t=[],r=e[1];return 0!==r&&t.push(-e[0]/r),t}(e);break;case 2:i=function(e){var t=[],r=e[2],i=e[1]/r,a=i*i-e[0]/r*4;if(a>0){var n=Math.sqrt(a);t.push(.5*(-i+n)),t.push(.5*(-i-n))}else 0===a&&t.push(.5*-i);return t}(e);break;case 3:i=St(e);break;case 4:i=function(e){var t=[],r=e[4],i=e[3]/r,a=e[2]/r,n=e[1]/r,o=e[0]/r,s=St([1,-a,i*n-4*o,-i*i*o+4*a*o-n*n].reverse())[0],c=i*i/4-a+s;if(Math.abs(c)<=kt&&(c=0),c>0){var u=Math.sqrt(c),l=(m=3*i*i/4-u*u-2*a)+(f=(4*i*a-8*n-i*i*i)/(4*u)),h=m-f;if(Math.abs(l)<=kt&&(l=0),Math.abs(h)<=kt&&(h=0),l>=0){var d=Math.sqrt(l);t.push(-i/4+(u+d)/2),t.push(-i/4+(u-d)/2)}h>=0&&(d=Math.sqrt(h),t.push(-i/4+(d-u)/2),t.push(-i/4-(d+u)/2))}else if(c<0);else{var f;if((f=s*s-4*o)>=-1e-9){var m;if(f<0&&(f=0),(m=3*i*i/4-2*a)+(f=2*Math.sqrt(f))>=kt){var p=Math.sqrt(m+f);t.push(-i/4+p/2),t.push(-i/4-p/2)}m-f>=kt&&(p=Math.sqrt(m-f),t.push(-i/4+p/2),t.push(-i/4-p/2))}}return t}(e)}return i}function Ct(e,t,r){return[r,-1,t-r*e]}function At(e,t,r,i,a,n){var o=Math.min(e,a),s=Math.min(t,n),c=Math.max(e,a),u=Math.max(t,n);if(r<o||i<s||r>c||i>u){var l=(e-r)/(e-2*r+a);isNaN(l)||l<0?l=0:l>1&&(l=1);var h=(t-i)/(t-2*i+n);isNaN(h)||h<0?h=0:h>1&&(h=1);var d=1-l,f=1-h,m=d*d*e+2*d*l*r+l*l*a,p=f*f*t+2*f*h*i+h*h*n;o=Math.min(o,m),s=Math.min(s,p),c=Math.max(c,m),u=Math.max(u,p)}return[o,s,c,u]}function _t(e,t,r,i,a,n,o,s){Array.isArray(e)&&(o=e[3].x,s=e[3].y,a=e[2].x,n=e[2].y,r=e[1].x,i=e[1].y,t=e[0].y,e=e[0].x);var c=Math.min(e,o),u=Math.min(t,s),l=Math.max(e,o),h=Math.max(t,s);(r<c||i<u||r>l||i>h||a<c||n<u||a>l||n>h)&&Ht(e,t,r,i,a,n,o,s).forEach(function(d){var f=Ft([{x:e,y:t},{x:r,y:i},{x:a,y:n},{x:o,y:s}],d);c=Math.min(c,f.x),u=Math.min(u,f.y),l=Math.max(l,f.x),h=Math.max(h,f.y)});return[c,u,l,h]}function Mt(e,t,r,i,a,n,o,s){var c=arguments.length;if(Array.isArray(e)){if((c=e.length)<2||c>4)throw new Error("Unsupported order");return 4===c?_t(e[0].x,e[0].y,e[1].x,e[1].y,e[2].x,e[2].y,e[3].x,e[3].y):3===c?At(e[0].x,e[0].y,e[1].x,e[1].y,e[2].x,e[2].y):[Math.min(e[0].x,e[1].x),Math.min(e[0].y,e[1].y),Math.max(e[0].x,e[1].x),Math.max(e[0].y,e[1].y)]}if(4===c||void 0===a||void 0===n)return[Math.min(e,r),Math.min(t,i),Math.max(e,r),Math.max(t,i)];if(6===c||void 0===o||void 0===s)return At(e,t,r,i,a,n);if(8===c)return _t(e,t,r,i,a,n,o,s);throw new Error("Unsupported order")}function It(e,t,r){var i=e,a=(2*t+r)/3,n=(t+2*r)/3;return(i(t)+3*i(a)+3*i(n)+i(r))*(r-t)/8}function Rt(e,t,r,i){void 0===i&&(i=1e-9);var a=e,n=(t+r)/2,o=It(a,t,r),s=It(a,t,n),c=It(a,n,r),u=s+c-o;return Math.abs(u)<=15*i?s+c+u/15:Rt(a,t,n,i/2)+Rt(a,n,r,i/2)}function Pt(e,t,r){if(void 0===t&&(t=0),void 0===r&&(r=1),2===e.length){var i=e[0],a=i.x,n=i.y,o=e[1],s=o.x,c=o.y;return Math.sqrt(Math.pow(s-a,2)+Math.pow(c-n,2))}if(e.length>4)throw new Error("Unsupported order");return Rt(function(t){var r=Ot(t,e);return Math.sqrt(Math.pow(r.x,2)+Math.pow(r.y,2))},t,r)}function Ot(e,t,r){if(void 0===r&&(r=1),4===t.length)return function(e,t,r){void 0===r&&(r=1);var i=t[0],a=i.x,n=i.y,o=t[1],s=o.x,c=o.y,u=t[2],l=u.x,h=u.y,d=t[3],f=d.x,m=d.y,p=0,g=0;return 0===r?(p=Math.pow(1-e,3)*a+3*e*Math.pow(1-e,2)*s+3*(1-e)*Math.pow(e,2)*l+Math.pow(e,3)*f,g=Math.pow(1-e,3)*n+3*e*Math.pow(1-e,2)*c+3*(1-e)*Math.pow(e,2)*h+Math.pow(e,3)*m):1===r?(p=3*((1-e)*(1-e)*(s-a)+2*(1-e)*e*(l-s)+e*e*(f-l)),g=3*((1-e)*(1-e)*(c-n)+2*(1-e)*e*(h-c)+e*e*(m-h))):2===r?(p=6*(l-2*s+a)*(1-e)+6*(f-2*l+s)*e,g=6*(h-2*c+n)*(1-e)+6*(m-2*h+c)*e):3===r&&(p=6*(f-3*l+3*s-a),g=6*(m-3*h+3*c-n)),{x:p,y:g}}(e,t,r);if(3===t.length)return function(e,t,r){void 0===r&&(r=1);var i=t[0],a=i.x,n=i.y,o=t[1],s=o.x,c=o.y,u=t[2],l=u.x,h=u.y,d=0,f=0;return 0===r?(d=Math.pow(1-e,2)*a+2*e*(1-e)*s+Math.pow(e,2)*l,f=Math.pow(1-e,2)*n+2*e*(1-e)*c+Math.pow(e,2)*h):1===r?(d=2*(1-e)*(s-a)+2*e*(l-s),f=2*(1-e)*(c-n)+2*e*(h-c)):2===r&&(d=2*(l-2*s+a),f=2*(h-2*c+n)),{x:d,y:f}}(e,t,r);throw new Error("Unsupported order")}function Dt(e,t){var r=e[0],i=r.x,a=r.y,n=e[1],o=n.x,s=n.y,c=(o-i)*t+i,u=(s-a)*t+a;if(2===e.length)return[{x:i,y:a},{x:c,y:u}];var l=e[2],h=l.x,d=l.y,f=(h-o)*t+o,m=(d-s)*t+s,p=(f-c)*t+c,g=(m-u)*t+u;if(4===e.length){var v=e[3];return[{x:i,y:a},{x:c,y:u},{x:p,y:g},{x:(((v.x-h)*t+h-f)*t+f-p)*t+p,y:(((v.y-d)*t+d-m)*t+m-g)*t+g}]}if(3===e.length)return[{x:i,y:a},{x:c,y:u},{x:p,y:g}];throw new Error("Unsupported order")}function Bt(e,t,r){var i;void 0===t&&(t=0),void 0===r&&(r=1),t=Math.max(t,0),t=Math.min(t,1),r=Math.max(r,0),r=Math.min(r,1);var a=e.slice(0);if(0===t&&1===r)return a;var n=r<t;return n&&(t=(i=[r,t])[0],r=i[1]),r<1&&(a=Dt(e,r)),t>0&&(r<1&&(t/=r),a=Dt(a.reverse(),1-t).reverse()),n&&a.reverse(),a}function Ft(e,t){if(void 0===t&&(t=0),0===t)return e[0];if(1===t)return e[e.length-1];if(4===e.length)return Nt(e,t);if(3===e.length)return Lt(e,t);if(2===e.length)return{x:e[0].x+(e[1].x-e[0].x)*t,y:e[0].y+(e[1].y-e[0].y)*t};throw new Error("Unsupported order")}function Lt(e,t){return{x:e[0].x*(1-t)*(1-t)+2*e[1].x*t*(1-t)+e[2].x*t*t,y:e[0].y*(1-t)*(1-t)+2*e[1].y*t*(1-t)+e[2].y*t*t}}function Nt(e,t){return{x:e[0].x*(1-t)*(1-t)*(1-t)+3*e[1].x*t*(1-t)*(1-t)+3*e[2].x*t*t*(1-t)+e[3].x*t*t*t,y:e[0].y*(1-t)*(1-t)*(1-t)+3*e[1].y*t*(1-t)*(1-t)+3*e[2].y*t*t*(1-t)+e[3].y*t*t*t}}function Ut(e,t,r,i){if(void 0===i&&(i=1e-9),4===e.length)return function(e,t,r,i){void 0===i&&(i=1e-9);for(var a=Qt(e,t,!0),n=Qt(e,r,!1),o=[],s=0,c=a.length;s<c;s++)for(var u=a[s],l=0,h=n.length;l<h;l++){var d=n[l],f=Math.abs(u-d);f<=i&&o.push({x:u,y:d,diff:f})}o.sort(function(e,t){return e.diff-t.diff}),o.length>3&&o.splice(3);o=o.map(function(e){return.5*(e.x+e.y)});var m=[];return o.forEach(function(a){var n=$t(e,a,!0),o=$t(e,a,!1);Math.abs(n-t)<=i&&Math.abs(o-r)<=i&&m.push(a)}),m}(e,t,r,i);if(3===e.length)return function(e,t,r,i){void 0===i&&(i=1e-9);for(var a=Qt(e,t,!0),n=Qt(e,r,!1),o=[],s=0,c=a.length;s<c;s++)for(var u=a[s],l=0,h=n.length;l<h;l++){var d=n[l],f=Math.abs(u-d);f<=i&&o.push({x:u,y:d,diff:f})}o.sort(function(e,t){return e.diff-t.diff}),o.length>2&&o.splice(2);o=o.map(function(e){return.5*(e.x+e.y)});var m=[];return o.forEach(function(a){var n=$t(e,a,!0),o=$t(e,a,!1);Math.abs(n-t)<=i&&Math.abs(o-r)<=i&&m.push(a)}),m}(e,t,r,i);if(2===e.length)return function(e,t,r,i){void 0===i&&(i=1e-9);var a=(t-e[0].x)/(e[1].x-e[0].x),n=(r-e[0].y)/(e[1].y-e[0].y);if(Math.abs(a-n)<=i)return[.5*(a+n)];return[]}(e,t,r,i);throw new Error("Unsupported order")}function zt(e,t){if(void 0===t&&(t=0),2===e.length){var r=e[0],i=r.x,a=r.y,n=e[1];return function(e,t,r,i){return t===i?0:e===r?i>t?1/0:-1/0:(i-t)/(r-e)}(i,a,n.x,n.y)}if(3===e.length)return Wt(e,t);if(4===e.length)return Vt(e,t);throw new Error("Unsupported order")}function Wt(e,t){void 0===t&&(t=0);var r=qt(e,t,!0);return 0===r?1/0:qt(e,t,!1)/r}function Vt(e,t){var r=qt(e,t,!0);return 0===r?1/0:qt(e,t,!1)/r}function Ht(e,t,r,i,a,n,o,s){var c=arguments.length;if(4===c)return[0,1];if(6===c)return function(e,t,r,i,a,n){var o=(e-r)/(e-2*r+a);isNaN(o)||o<0?o=0:o>1&&(o=1);var s=(t-i)/(t-2*i+n);isNaN(s)||s<0?s=0:s>1&&(s=1);var c=[o];return s!==o&&c.push(s),c.sort(function(e,t){return e-t}),c[0]>0&&c.unshift(0),c[c.length-1]<1&&c.push(1),c}(e,t,r,i,a,n);if(8===c)return function(e,t,r,i,a,n,o,s){var c=-3*t+3*i,u=6*t-12*i+6*n,l=-3*t+9*i-9*n+3*s,h=Et([-3*e+3*r,6*e-12*r+6*a,-3*e+9*r-9*a+3*o]).filter(function(e){return e>=0&&e<=1}),d=Et([c,u,l]).filter(function(e){return e>=0&&e<=1}),f=h.concat(d);f.sort(function(e,t){return e-t});for(var m=f.length-1;m>0;m--)f[m]===f[m-1]&&f.splice(m,1);return f}(e,t,r,i,a,n,o,s);throw new Error("Unsupported order")}function Xt(e,t,r){if(void 0===t&&(t=!0),void 0===r&&(r=1e-9),e.length<3||e.length>4)throw new Error("Unsupported order");var i=t?e[0].x:e[0].y,a=t?e[1].x:e[1].y,n=t?e[2].x:e[2].y;if(4===e.length){var o=Et([3*a-3*i,2*(3*i-6*a+3*n),3*(3*a-i-3*n+(t?e[3].x:e[3].y))]).filter(function(e){return e>r&&e<1-r});return o.sort(function(e,t){return e-t})}if(3===e.length){o=Et([2*(a-i),2*(i-2*a+n)]).filter(function(e){return e>r&&e<1-r});return o}}function jt(e,t,r){if(void 0===t&&(t=!0),void 0===r&&(r=1e-9),e.length<3||e.length>4)throw new Error("Unsupported order");var i=t?e[0].x:e[0].y,a=t?e[1].x:e[1].y,n=t?e[2].x:e[2].y;if(4===e.length){var o=Et([2*(3*i-6*a+3*n),6*(3*a-i-3*n+(t?e[3].x:e[3].y))]).filter(function(e){return e>r&&e<1-r});return o.sort(function(e,t){return e-t})}if(3===e.length)return(o=2*(i-2*a+n))>r&&o<1-r?[o]:[]}function Gt(e,t,r,i,a,n,o,s){void 0===n&&(n=1e-9),void 0===o&&(o=3),void 0===s&&(s=30);var c=[],u=Yt(e,t,r,t,i,a,n,o,s);if(u&&c.push(u),1===r){var l=Yt(e,t,r,r,i,a,n,o,s);l&&c.push(l)}var h=Yt(e,t,r,.5*(t+r),i,a,n,o,s);if(h&&c.push(h),c.length)return c.sort(function(e,t){return e.d-t.d}),c[0]}function Yt(e,t,r,i,a,n,o,s,c){void 0===o&&(o=1e-9),void 0===s&&(s=5),void 0===c&&(c=30);for(var u=i,l=0;l++<c;){var h=$t(e,i,!0)-a,d=$t(e,i,!1)-n,f=qt(e,i,!0),m=qt(e,i,!1),p=Kt(e,i,!0),g=Kt(e,i,!1),v=h*f+d*m,y=Math.pow(f,2)+h*p+Math.pow(m,2)+d*g;if(y<0)return;if((i-=v/y)>r?i=r:i<t&&(i=t),l>s){var b=$t(e,i,!0),x=$t(e,i,!1),T=$t(e,u,!0),w=$t(e,u,!1),k=Math.sqrt(Math.pow(b-T,2)+Math.pow(x-w,2));if(Math.abs(k)<o)break}u=i}var S=$t(e,i,!0),E=$t(e,i,!1);return{x:S,y:E,t:i,d:Math.sqrt(Math.pow(a-S,2)+Math.pow(n-E,2))}}function qt(e,t,r){if(void 0===r&&(r=!0),e.length<3||e.length>4)throw new Error("Unsupported order");var i=r?e[0].x:e[0].y,a=r?e[1].x:e[1].y,n=r?e[2].x:e[2].y;return 3===e.length?2*(i-2*a+n)*t+2*(a-i):4===e.length?3*(3*a-i-3*n+(r?e[3].x:e[3].y))*t*t+2*(3*i-6*a+3*n)*t+3*a-3*i:void 0}function Kt(e,t,r){if(void 0===r&&(r=!0),e.length<2||e.length>4)throw new Error("Unsupported order");if(2===e.length)return 0;var i=r?e[0].x:e[0].y,a=r?e[1].x:e[1].y,n=r?e[2].x:e[2].y;return 3===e.length?2*(i-2*a+n):4===e.length?6*(3*a-i-3*n+(r?e[3].x:e[3].y))*t+2*(3*i-6*a+3*n):void 0}function $t(e,t,r){if(void 0===r&&(r=!0),e.length<2||e.length>4)throw new Error("Unsupported order");var i=r?e[0].x:e[0].y,a=r?e[1].x:e[1].y;if(2===e.length)return i+(a-i)*t;var n=r?e[2].x:e[2].y;if(3===e.length)return Math.pow(1-t,2)*i+2*t*(1-t)*a+Math.pow(t,2)*n;if(4===e.length){var o=r?e[3].x:e[3].y;return Math.pow(1-t,3)*i+3*Math.pow(1-t,2)*t*a+3*Math.pow(t,2)*(1-t)*n+Math.pow(t,3)*o}}function Qt(e,t,r){void 0===r&&(r=!0);var i=r?e[0].x:e[0].y,a=r?e[1].x:e[1].y,n=r?e[2].x:e[2].y;return 4===e.length?Et([i-t,3*(a-i),3*(n+i-2*a),(r?e[3].x:e[3].y)-i+3*a-3*n]).filter(function(e){return e>=0&&e<=1}):Et([i-t,2*(a-i),n+i-2*a]).filter(function(e){return e>=0&&e<=1})}var Zt={bboxBezier:Mt,bezierLength:Pt,bezierAt:Ot,sliceBezier:Bt,getPointByT:Ft,getT:Qt,getPointT:Ut,getPointWithDByApprox:function(e,t,r,i){if(void 0===i&&(i=1e-9),e.length<2||e.length>4)throw new Error("Unsupported order");if(2===e.length){var a=e[1].x-e[0].x,n=e[1].y-e[0].y,o=t-e[0].x,s=r-e[0].y,c=Math.sqrt(Math.pow(a,2)+Math.pow(n,2)),u=Math.sqrt(Math.pow(o,2)+Math.pow(s,2))*Ke(a,n,o,s,!0)/c,l=a*u,h=n*u;return{x:l+=e[0].x,y:h+=e[0].y,d:Math.sqrt(Math.pow(l-t,2)+Math.pow(h-r,2)),t:u}}var d=Xt(e,!0),f=Xt(e,!1),m=jt(e,!0),p=jt(e,!1),g=[];d&&g.push.apply(g,d),f&&f.forEach(function(e){g.includes(e)||g.push(e)}),m&&m.forEach(function(e){g.includes(e)||g.push(e)}),p&&p.forEach(function(e){g.includes(e)||g.push(e)}),g.sort(function(e,t){return e-t});var v=[];if(g.forEach(function(a,n){if(!n){var o=Gt(e,0,a,t,r,i);void 0!==o&&v.push(o)}var s=Gt(e,a,g[n+1]||1,t,r,i);void 0!==s&&v.push(s)}),!g.length){var y=Gt(e,0,1,t,r,i);void 0!==y&&v.push(y)}if(v.sort(function(e,t){return e.d-t.d}),v.length)return{x:v[0].x,y:v[0].y,t:v[0].t,d:v[0].d}},bezierSlope:zt,bezierExtremaT:Ht,bezierTangent:function(e,t){if(void 0===t&&(t=0),2===e.length)return r=e[0].x,i=e[0].y,a=e[1].x,[(n=e[1].y)-i,r-a,i*(a-r)-r*(n-i)];var r,i,a,n;if(3===e.length)return function(e,t){void 0===t&&(t=0);var r=Wt(e,t),i=Lt(e,t);return Ct(i.x,i.y,r)}(e,t);if(4===e.length)return function(e,t){void 0===t&&(t=0);var r=Vt(e,t),i=Nt(e,t);return Ct(i.x,i.y,r)}(e,t);throw new Error("Unsupported order")},splitBezierT:function(e,t,r,i){if(void 0===r&&(r=5),t<2)return[];if(e.length>4||e.length<2)throw new Error("Unsupported order");for(var a=e[0],n=e[e.length-1],o=[{x:a.x,y:a.y,t:0}],s=1/t,c=1;c<t;c++){var u=s*c,l=Ft(e,u);o.push({x:l.x,y:l.y,t:u})}if(o.push({x:n.x,y:n.y,t:1}),2===e.length)return o;var h=(i=i||Pt(e))/t;for(c=0;c<r;c++){for(var d=[0],f=1;f<t;f++)d[f]=Math.sqrt(Math.pow(o[f].x-o[f-1].x,2)+Math.pow(o[f].y-o[f-1].y,2));var m=0;for(f=1;f<t;f++){m+=d[f]-h;var p=o[f],g=Ot(p.t,e,1),v=Math.sqrt(Math.pow(g.x,2)+Math.pow(g.y,2)),y=Ot(p.t,e,2),b=m*v,x=m*Math.sqrt(Math.pow(y.x,2)+Math.pow(y.y,2))+v*v;p.t=p.t-b/x;l=Ft(e,p.t);p.x=l.x,p.y=l.y}}return o},getBezierMonotonicityT:Xt,getBezierMonotonicityT2:jt,bezierDerivative:qt,bezierDerivative2:Kt,bezierValue:$t},Jt=it.unitize3,er=it.crossProduct3,tr=it.dotProduct3,rr=it.isParallel3,ir=it.length3;function ar(e){var t=e[0],r=e[e.length-1];return[Math.min(t.x,r.x),Math.min(t.y,r.y),Math.max(t.x,r.x),Math.max(t.y,r.y)]}function nr(e,t,r,i,a,n){var o,s,c,u,l,h,d,f,m=[{a:e,b:t,t1:0,t2:1,t3:0,t4:1}],p=e.length,g=t.length;if(2===p&&2===g){var v=cr(e[0].x,e[0].y,e[1].x,e[1].y,t[0].x,t[0].y,t[1].x,t[1].y,!0,r);return v&&n.push({x:v.x,y:v.y,t1:v.toSource,t2:v.toClip}),n}for(var y=function(){var e=m.pop(),t=e.a,i=e.b,v=e.t1,y=e.t2,b=e.t3,x=e.t4,T=a?ar(t):Mt(t[0].x,t[0].y,t[1].x,t[1].y,null===(o=t[2])||void 0===o?void 0:o.x,null===(s=t[2])||void 0===s?void 0:s.y,null===(c=t[3])||void 0===c?void 0:c.x,null===(u=t[3])||void 0===u?void 0:u.y),w=a?ar(i):Mt(i[0].x,i[0].y,i[1].x,i[1].y,null===(l=i[2])||void 0===l?void 0:l.x,null===(h=i[2])||void 0===h?void 0:h.y,null===(d=i[3])||void 0===d?void 0:d.x,null===(f=i[3])||void 0===f?void 0:f.y);if(a){if(t[0].x===i[0].x&&t[0].y===i[0].y)return n.push({x:t[0].x,y:t[0].y,t1:v,t2:b}),"continue";if(t[0].x===i[g-1].x&&t[0].y===i[g-1].y)return n.push({x:t[0].x,y:t[0].y,t1:v,t2:x}),"continue";if(t[p-1].x===i[0].x&&t[p-1].y===i[0].y)return n.push({x:i[0].x,y:i[0].y,t1:y,t2:b}),"continue";if(t[p-1].x===i[g-1].x&&t[p-1].y===i[g-1].y)return n.push({x:t[p-1].x,y:t[p-1].y,t1:y,t2:x}),"continue";if((T[0]===w[2]||T[2]===w[0])&&T[1]<=w[3]&&T[3]>=w[1]){var k=T[2]===w[0];if(2===p){if(C=sr(t,i,T,k)){var S=v+C.tl*(y-v),E=b+C.tb*(x-b);n.push({x:C.x,y:C.y,t1:S,t2:E})}}else if(2===g){if(C=sr(i,t,w,!k)){S=b+C.tl*(x-b),E=v+C.tb*(y-v);n.push({x:C.x,y:C.y,t1:E,t2:S})}}else{var C=function(e,t,r,i){var a,n,o,s,c,u;void 0===i&&(i=!0);var l=e.length,h=t.length,d=i?r[2]:r[0];if(e[0].x===d||e[l-1].x===d)if(t[0].x===d||t[h-1].x===d){if(e[0].x===d&&t[0].x===d&&e[0].y===t[0].y)return{x:d,y:e[0].y,ta:0,tb:0};if(e[0].x===d&&t[h-1].x===d&&e[0].y===t[h-1].y)return{x:d,y:e[0].y,ta:0,tb:1};if(e[l-1].x===d&&t[h-1].x===d&&e[l-1].y===t[h-1].y)return{x:d,y:e[l-1].y,ta:1,tb:1};if(e[l-1].x===d&&t[0].x===d&&e[l-1].y===t[0].y)return{x:d,y:e[l-1].y,ta:1,tb:0}}else{var f=Ht(t[0].x,t[0].y,t[1].x,t[1].y,t[2].x,t[2].y,null===(a=t[3])||void 0===a?void 0:a.x,null===(n=t[3])||void 0===n?void 0:n.y).filter(function(e){return e>0&&e<1}),m=Ft(t,f[0]);if(e[0].x===d&&e[0].y===m.y)return{x:d,y:m.y,ta:0,tb:f[0]};if(e[l-1].x===d&&e[l-1].y===m.y)return{x:d,y:m.y,ta:1,tb:f[0]}}else{var p=Ht(e[0].x,e[0].y,e[1].x,e[1].y,e[2].x,e[2].y,null===(o=e[3])||void 0===o?void 0:o.x,null===(s=e[3])||void 0===s?void 0:s.y).filter(function(e){return e>0&&e<1}),g=Ft(e,p[0]);if(t[0].x===d||t[h-1].x===d){if(t[0].x===d&&t[0].y===g.y)return{x:d,y:g.y,ta:p[0],tb:0};if(t[h-1].x===d&&t[h-1].y===g.y)return{x:d,y:g.y,ta:p[0],tb:1}}else{var v=Ht(t[0].x,t[0].y,t[1].x,t[1].y,t[2].x,t[2].y,null===(c=t[3])||void 0===c?void 0:c.x,null===(u=t[3])||void 0===u?void 0:u.y).filter(function(e){return e>0&&e<1}),y=Ft(t,v[0]);if(g.y===y.y)return{x:d,y:g.y,ta:p[0],tb:v[0]}}}}(t,i,T,k);if(C){var A=v+C.ta*(y-v);E=b+C.tb*(x-b);n.push({x:C.x,y:C.y,t1:A,t2:E})}}return"continue"}if((T[1]===w[3]||T[3]===w[1])&&T[0]<=w[2]&&T[2]>=w[0]){var _=T[3]===w[1];if(2===p){if(C=or(t,i,T,_)){S=v+C.tl*(y-v),E=b+C.tb*(x-b);n.push({x:C.x,y:C.y,t1:S,t2:E})}}else if(2===g){if(C=or(i,t,w,!_)){S=b+C.tl*(x-b),E=v+C.tb*(y-v);n.push({x:C.x,y:C.y,t1:E,t2:S})}}else{C=function(e,t,r,i){var a,n,o,s,c,u;void 0===i&&(i=!0);var l=e.length,h=t.length,d=i?r[3]:r[1];if(e[0].y===d||e[l-1].y===d)if(t[0].y===d||t[h-1].y===d){if(e[0].y===d&&t[0].y===d&&e[0].x===t[0].x)return{x:e[0].x,y:d,ta:0,tb:0};if(e[0].y===d&&t[h-1].y===d&&e[0].x===t[h-1].x)return{x:e[0].x,y:d,ta:0,tb:1};if(e[l-1].y===d&&t[h-1].y===d&&e[l-1].x===t[h-1].x)return{x:e[l-1].x,y:d,ta:1,tb:1};if(e[l-1].y===d&&t[0].y===d&&e[l-1].x===t[0].x)return{x:e[l-1].x,y:d,ta:1,tb:0}}else{var f=Ht(t[0].x,t[0].y,t[1].x,t[1].y,t[2].x,t[2].y,null===(a=t[3])||void 0===a?void 0:a.x,null===(n=t[3])||void 0===n?void 0:n.y).filter(function(e){return e>0&&e<1}),m=Ft(t,f[0]);if(e[0].y===d&&e[0].x===m.x)return{x:m.x,y:d,ta:0,tb:f[0]};if(e[l-1].y===d&&e[l-1].x===m.x)return{x:m.x,y:d,ta:1,tb:f[0]}}else{var p=Ht(e[0].x,e[0].y,e[1].x,e[1].y,e[2].x,e[2].y,null===(o=e[3])||void 0===o?void 0:o.x,null===(s=e[3])||void 0===s?void 0:s.y).filter(function(e){return e>0&&e<1}),g=Ft(e,p[0]);if(t[0].y===d||t[h-1].y===d){if(t[0].y===d&&t[0].x===g.x)return{x:g.x,y:d,ta:p[0],tb:0};if(t[h-1].y===d&&t[h-1].x===g.x)return{x:g.x,y:d,ta:p[0],tb:1}}else{var v=Ht(t[0].x,t[0].y,t[1].x,t[1].y,t[2].x,t[2].y,null===(c=t[3])||void 0===c?void 0:c.x,null===(u=t[3])||void 0===u?void 0:u.y).filter(function(e){return e>0&&e<1}),y=Ft(t,v[0]);if(g.x===y.x)return{x:g.x,y:d,ta:p[0],tb:v[0]}}}}(t,i,T,_);if(C){A=v+C.ta*(y-v),E=b+C.tb*(x-b);n.push({x:C.x,y:C.y,t1:A,t2:E})}}return"continue"}if(2===p){if(t[0].x===t[1].x)return Qt(i,t[0].x,!0).forEach(function(e){if(!(e<0||e>1)){var r=Ft(i,e),a=(r.y-t[0].y)/(t[1].y-t[0].y);a>=0&&a<=1&&n.push({x:r.x,y:r.y,t1:a,t2:e})}}),"continue";if(t[0].y===t[1].y)return Qt(i,t[0].y,!1).forEach(function(e){if(!(e<0||e>1)){var r=Ft(i,e),a=(r.x-t[0].x)/(t[1].x-t[0].x);a>=0&&a<=1&&n.push({x:r.x,y:r.y,t1:a,t2:e})}}),"continue"}else if(2===g){if(i[0].x===i[1].x)return Qt(t,i[0].x,!0).forEach(function(e){if(!(e<0||e>1)){var r=Ft(t,e),a=(r.y-i[0].y)/(i[1].y-i[0].y);a>=0&&a<=1&&n.push({x:r.x,y:r.y,t1:e,t2:a})}}),"continue";if(i[0].y===i[1].y)return Qt(t,i[0].y,!1).forEach(function(e){if(!(e<0||e>1)){var r=Ft(t,e),a=(r.x-i[0].x)/(i[1].x-i[0].x);a>=0&&a<=1&&n.push({x:r.x,y:r.y,t1:e,t2:a})}}),"continue"}}if(function(e,t,r,i,a){if(e[0]>t[2]||e[1]>t[3]||t[0]>e[2]||t[1]>e[3])return!1;if((e[2]===t[0]||e[0]===t[2])&&(t[3]<e[1]||e[1]>t[3]))return!1;if((e[3]===t[1]||e[1]===t[3])&&(t[2]<e[0]||e[0]>t[2]))return!1;var n=r.length,o=i.length;if(a){if(n===o){for(var s=r[0].x-i[0].x,c=r[0].y-i[0].y,u=!0,l=!0,h=0;h<n&&(r[h].x-i[h].x!==s&&(u=!1),r[h].y-i[h].y!==c&&(l=!1),u||l);h++);if(u&&l)return!1;if(u){for(var d=r[0].y-i[0].y,f=jt(r.map(function(e,t){return{x:e.x-i[t].x,y:e.y-i[t].y}}),!1)||[],m=(h=0,f.length);h<m;h++){var p=Ft(r,f[h]),g=Ft(i,f[h]);if(d>0&&p.y-g.y<=0||d<0&&p.y-g.y>=0)return!0}return!1}if(l){for(d=r[0].x-i[0].x,f=jt(r.map(function(e,t){return{x:e.x-i[t].x,y:e.y-i[t].y}}),!0)||[],h=0,m=f.length;h<m;h++){p=Ft(r,f[h]),g=Ft(i,f[h]);if(d>0&&p.x-g.x<=0||d<0&&p.x-g.x>=0)return!0}return!1}}}else{if(e[1]===t[3]||e[3]===t[1]){var v=e[1]===t[3]?e[1]:e[3];return 2===n?e[1]===e[3]||(i[1].y===v||i[o-2].y===v):2===o?t[1]===t[3]||(r[1].y===v||r[n-2].y===v):r[1].y===v||r[n-2].y===v||i[1].y===v||i[o-2].y===v}if(e[0]===t[2]||e[2]===t[0]){var y=e[0]===t[2]?e[0]:e[2];return 2===n?e[0]===e[2]||(i[1].x===y||i[o-2].y===y):2===o?t[0]===t[2]||(r[1].x===y||r[n-2].x===y):r[1].x===y||r[n-2].x===y||i[1].x===y||i[o-2].x===y}}return!0}(T,w,t,i,a)){if(p===g){for(var M=!0,I=0;I<p;I++)if(Math.abs(t[I].x-i[I].x)>.1*r||Math.abs(t[I].y-i[I].y)>.1*r){M=!1;break}if(M)return n.push({x:.5*(t[0].x+i[0].x),y:.5*(t[0].y+i[0].y),t1:v,t2:b}),n.push({x:.5*(t[p-1].x+i[g-1].x),y:.5*(t[p-1].y+i[g-1].y),t1:y,t2:x}),"continue"}var R=T[2]-T[0]||Number.EPSILON,P=T[3]-T[1]||Number.EPSILON,O=w[2]-w[0]||Number.EPSILON,D=w[3]-w[1]||Number.EPSILON;if(R<=r&&P<=r&&O<=r&&D<=r){A=.5*(v+y),E=.5*(b+x);if(0===v)((B=t[0]).x===i[0].x&&B.y===i[0].y||B.x===i[g-1].x&&B.y===i[g-1].y)&&(A=0);else if(1===y){((B=t[p-1]).x===i[0].x&&B.y===i[0].y||B.x===i[g-1].x&&B.y===i[g-1].y)&&(A=1)}if(0===b)((B=i[0]).x===t[0].x&&B.y===t[0].y||B.x===t[p-1].x&&B.y===t[p-1].y)&&(E=0);else if(1===x){var B;((B=i[g-1]).x===t[0].x&&B.y===t[0].y||B.x===t[p-1].x&&B.y===t[p-1].y)&&(E=1)}var F=Ft(t,A),L=Ft(i,E);n.push({x:.5*(F.x+L.x),y:.5*(F.y+L.y),t1:A,t2:E})}else if((R>r||P>r)&&(O>r||D>r)){var N=Bt(t,0,.5),U=Bt(t,.5,1),z=Bt(i,0,.5),W=Bt(i,.5,1);m.push({a:N,b:z,t1:v,t2:v+.5*(y-v),t3:b,t4:b+.5*(x-b)}),m.push({a:N,b:W,t1:v,t2:v+.5*(y-v),t3:b+.5*(x-b),t4:x}),m.push({a:U,b:z,t1:v+.5*(y-v),t2:y,t3:b,t4:b+.5*(x-b)}),m.push({a:U,b:W,t1:v+.5*(y-v),t2:y,t3:b+.5*(x-b),t4:x})}else if(R>r||P>r){N=Bt(t,0,.5),U=Bt(t,.5,1);m.push({a:N,b:i,t1:v,t2:v+.5*(y-v),t3:b,t4:x}),m.push({a:U,b:i,t1:v+.5*(y-v),t2:y,t3:b,t4:x})}else if(O>r||D>r){z=Bt(i,0,.5),W=Bt(i,.5,1);m.push({a:t,b:z,t1:v,t2:y,t3:b,t4:b+.5*(x-b)}),m.push({a:t,b:W,t1:v,t2:y,t3:b+.5*(x-b),t4:x})}}};m.length;)y();n.sort(function(e,t){return e.t1===t.t1?e.t2-t.t2:e.t1-t.t1});for(var b=n.length-1;b>0;b--){var x=n[b],T=n[b-1];if(Math.abs(x.x-T.x)<=i&&Math.abs(x.y-T.y)<=i)if(1===b)0===x.t1||1===x.t1||0===x.t2||1===x.t2?n.shift():n.splice(1,1);else for(var w=b-1;w>0;w--){var k=n[w],S=n[w-1],E=Math.abs(k.x-S.x)>i&&Math.abs(k.y-S.y)>i;if(E||1===w){var C=E?w:w-1,A=n[C];if(Math.abs(x.x-A.x)<=i&&Math.abs(x.y-A.y)<=i)if(0===x.t1||1===x.t1||0===x.t2||1===x.t2)n.splice(C,b-C);else if(0===A.t1||1===A.t1||0===A.t2||1===A.t2)n.splice(C+1,b-C);else{var _=n[C+b>>1];n.splice(C,b-C+1,_)}else n.splice(C+1,b-C-1);b=C;break}}}return n}function or(e,t,r,i){var a,n,o,s;void 0===i&&(i=!0);var c=t.length,u=i?r[3]:r[1];if(r[1]===r[3])if(t[0].y===u||t[c-1].y===u){if((l=((d=t[0].y===u?t[0].x:t[c-1].x)-r[0])/(r[2]-r[0]))>=0&&l<=1)return{x:d,y:u,tl:l,tb:t[0].y===u?0:1}}else{var l,h=Ht(t[0].x,t[0].y,t[1].x,t[1].y,t[2].x,t[2].y,null===(a=t[3])||void 0===a?void 0:a.x,null===(n=t[3])||void 0===n?void 0:n.y).filter(function(e){return e>0&&e<1});if((l=((f=Ft(t,h[0])).x-r[0])/(r[2]-r[0]))>=0&&l<=1)return{x:f.x,y:u,tl:l,tb:h[0]}}else if(t[0].y===u||t[c-1].y===u){var d=t[0].y===u?t[0].x:t[c-1].x;if(e[0].x===d&&e[0].y===u||e[1].x===d&&e[1].y===u)return{x:d,y:u,tl:e[0].y===u?0:1,tb:t[0].y===u?0:1}}else{var f;h=Ht(t[0].x,t[0].y,t[1].x,t[1].y,t[2].x,t[2].y,null===(o=t[3])||void 0===o?void 0:o.x,null===(s=t[3])||void 0===s?void 0:s.y).filter(function(e){return e>0&&e<1});if((f=Ft(t,h[0])).x===e[0].x&&e[0].y===u||f.x===e[1].x&&e[1].y===u)return{x:f.x,y:u,tl:f.x===e[0].x?0:1,tb:h[0]}}}function sr(e,t,r,i){var a,n,o,s;void 0===i&&(i=!0);var c=t.length,u=i?r[2]:r[0];if(r[0]===r[2])if(t[0].x===u||t[c-1].x===u){if((l=((d=t[0].x===u?t[0].y:t[c-1].y)-r[1])/(r[3]-r[1]))>=0&&l<=1)return{x:u,y:d,tl:l,tb:t[0].x===u?0:1}}else{var l,h=Ht(t[0].x,t[0].y,t[1].x,t[1].y,t[2].x,t[2].y,null===(a=t[3])||void 0===a?void 0:a.x,null===(n=t[3])||void 0===n?void 0:n.y).filter(function(e){return e>0&&e<1});if((l=((f=Ft(t,h[0])).y-r[1])/(r[3]-r[1]))>=0&&l<=1)return{x:u,y:f.y,tl:(f.y-r[1])/(r[3]-r[1]),tb:h[0]}}else if(t[0].x===u||t[c-1].x===u){var d=t[0].x===u?t[0].x:t[c-1].x;if(e[0].x===u&&e[0].y===d||e[1].x===u&&e[1].y===d)return{x:u,y:d,tl:e[0].x===u?0:1,tb:t[0].x===u?0:1}}else{var f;h=Ht(t[0].x,t[0].y,t[1].x,t[1].y,t[2].x,t[2].y,null===(o=t[3])||void 0===o?void 0:o.x,null===(s=t[3])||void 0===s?void 0:s.y).filter(function(e){return e>0&&e<1});if((f=Ft(t,h[0])).y===e[0].y&&e[0].x===u||f.y===e[1].y&&e[1].x===u)return{x:u,y:f.y,tl:f.y===e[0].y?0:1,tb:h[0]}}}function cr(e,t,r,i,a,n,o,s,c,u){void 0===c&&(c=!0),void 0===u&&(u=0);var l=(s-n)*(r-e)-(o-a)*(i-t);if(0!==l){var h=((o-a)*(t-n)-(s-n)*(e-a))/l,d=((r-e)*(t-n)-(i-t)*(e-a))/l,f=1-u;if(c&&(h<u||h>f||d<u||d>f))return;return{x:e+h*(r-e),y:t+h*(i-t),toSource:h,toClip:d}}}function ur(e,t){return{x:e.x-t.x,y:e.y-t.y,z:e.z-t.z}}function lr(e,t){return{x:e.x+t.x,y:e.y+t.y,z:e.z+t.z}}function hr(e,t,r){var i=ur(e,t),a=ur(r,t),n=tr(a.x,a.y,a.z,a.x,a.y,a.z);return tr(a.x,a.y,a.z,i.x,i.y,i.z)/n}var dr={intersectLineLine:cr,intersectBezier2Line:function(e,t,r,i,a,n,o,s,c,u,l,h,d){void 0===l&&(l=.1),void 0===h&&(h=.5),void 0===d&&(d=!1);var f=[];return nr([{x:e,y:t},{x:r,y:i},{x:a,y:n}],[{x:o,y:s},{x:c,y:u}],l,h,d,f),f},intersectBezier3Line:function(e,t,r,i,a,n,o,s,c,u,l,h,d,f,m){void 0===d&&(d=.1),void 0===f&&(f=.5),void 0===m&&(m=!1);var p=[];return nr([{x:e,y:t},{x:r,y:i},{x:a,y:n},{x:o,y:s}],[{x:c,y:u},{x:l,y:h}],d,f,m,p),p},intersectBezier2Bezier2:function(e,t,r,i,a,n,o,s,c,u,l,h,d,f,m){void 0===d&&(d=.1),void 0===f&&(f=.5),void 0===m&&(m=!1);var p=[];return nr([{x:e,y:t},{x:r,y:i},{x:a,y:n}],[{x:o,y:s},{x:c,y:u},{x:l,y:h}],d,f,m,p),p},intersectBezier3Bezier3:function(e,t,r,i,a,n,o,s,c,u,l,h,d,f,m,p,g,v,y){void 0===g&&(g=.1),void 0===v&&(v=.5),void 0===y&&(y=!1);var b=[];return nr([{x:e,y:t},{x:r,y:i},{x:a,y:n},{x:o,y:s}],[{x:c,y:u},{x:l,y:h},{x:d,y:f},{x:m,y:p}],g,v,y,b),b},intersectBezier2Bezier3:function(e,t,r,i,a,n,o,s,c,u,l,h,d,f,m,p,g){void 0===m&&(m=.1),void 0===p&&(p=.5),void 0===g&&(g=!1);var v=[];return nr([{x:e,y:t},{x:r,y:i},{x:a,y:n}],[{x:o,y:s},{x:c,y:u},{x:l,y:h},{x:d,y:f}],m,p,g,v),v},intersectLineLine3:function(e,t,r,i,a,n){void 0===a&&(a=0),void 0===n&&(n=1e-9);var o=ur(e,r),s=ur(i,r),c=ur(t,e),u=o.x*s.x+o.y*s.y+o.z*s.z,l=s.x*c.x+s.y*c.y+s.z*c.z,h=o.x*c.x+o.y*c.y+o.z*c.z,d=s.x*s.x+s.y*s.y+s.z*s.z,f=(c.x*c.x+c.y*c.y+c.z*c.z)*d-l*l;if(!(Math.abs(f)<n)){var m,p,g=(u*l-h*d)/f,v=(u+l*g)/d,y={x:e.x+g*c.x,y:e.y+g*c.y,z:e.z+g*c.z},b={x:r.x+v*s.x,y:r.y+v*s.y,z:r.z+v*s.z};if(!((m=y,p=b,Math.sqrt(Math.pow(m.x-p.x,2)+Math.pow(m.y-p.y,2)+Math.pow(m.z-p.z,2)))>n)){var x=function(e,t){var r=1/t;return{x:e.x*r,y:e.y*r,z:e.z*r}}(lr(y,b),2);if(!a)return x;var T=hr(x,e,t),w=hr(x,r,i);return T<0&&Math.abs(T)<1e-9?T=0:T>1&&T-1<1e-9&&(T=1),w<0&&Math.abs(w)<1e-9?w=0:w>1&&w-1<1e-9&&(w=1),x.pa=T,x.pb=w,1===a&&T>=0&&T<=1||2===a&&w>=0&&w<=1||3===a&&T>=0&&T<=1&&w>=0&&w<=1?x:void 0}}},intersectPlanePlane:function(e,t,r,i,a,n){var o=Jt(t.x-e.x,t.y-e.y,t.z-e.z),s=Jt(r.x-e.x,r.y-e.y,r.z-e.z),c=Jt(a.x-i.x,a.y-i.y,a.z-i.z),u=Jt(n.x-i.x,n.y-i.y,n.z-i.z),l=er(o.x,o.y,o.z,s.x,s.y,s.z),h=Jt(l.x,l.y,l.z),d=er(c.x,c.y,c.z,u.x,u.y,u.z),f=Jt(d.x,d.y,d.z);if(rr(h.x,h.y,h.z,f.x,f.y,f.z))return null;var m=er(f.x,f.y,f.z,h.x,h.y,h.z),p=lr(o,c),g=Jt(m.x,m.y,m.z),v=h.x,y=h.y,b=h.z,x=-v*e.x-y*e.y-b*e.z,T=f.x,w=f.y,k=f.z,S=-T*i.x-w*i.y-k*i.z,E=g.x,C=g.y,A=g.z,_=[-x,-S,-(-E*p.x-C*p.y-A*p.z)],M=v*(w*A-k*C)-y*(T*A-k*E)+b*(T*C-w*E);if(Math.abs(M)<1e-9)return null;var I=1/M,R={x:I*(w*A-k*C)*_[0]+I*(b*C-y*A)*_[1]+I*(y*k-b*w)*_[2],y:I*(k*E-T*A)*_[0]+I*(v*A-b*E)*_[1]+I*(b*T-v*k)*_[2],z:I*(T*C-w*E)*_[0]+I*(y*E-v*C)*_[1]+I*(v*w-y*T)*_[2]};return[R,lr(R,g)]},pointOnLine3:function(e,t,r,i){void 0===i&&(i=1e-9);var a=t.x-e.x,n=t.y-e.y,o=t.z-e.z,s=r.x-e.x,c=r.y-e.y,u=r.z-e.z,l=er(a,n,o,s,c,u);return ir(l.x,l.y,l.z)<i}};function fr(e){return e*Math.PI/180}function mr(e){return 180*e/Math.PI}function pr(e,t,r,i){void 0===i&&(i=!1);for(var a,n=r[0],o=n.x,s=n.y,c=r[0],u=c.x,l=c.y,h=r.length,d=1;d<h;d++){var f=r[d],m=f.x,p=f.y;o=Math.max(o,m),s=Math.max(s,p),u=Math.min(u,m),l=Math.min(l,p)}if(e<u||t<l||e>o||t>s)return!1;if((e<=u||t<=l||e>=o||t>=s)&&!i)return!1;d=0;for(var g=r.length;d<g;d++){var v=r[d],y=v.x,b=v.y,x=r[(d+1)%g],T=x.x,w=x.y,k=qe(T-y,w-b,e-y,t-b);if(0!==k){if(k=k>0?1:0,void 0===a)a=k;else if(a^k)return!1}else if(i){if(e===y&&t===b||e===T&&t===w)return!0;var S=e-y,E=T-e,C=t-b,A=w-t;if(0===S||0===E){if(C^A)return!0}else if(0===C||0===A){if(S^E)return!0}else if(S^E&&C^A)return!0}}return!0}function gr(e,t,r,i,a,n,o,s){var c,u;if(void 0===s&&(s=!1),r>=a&&(r=(c=[a,r])[0],a=c[1]),i>=n&&(i=(u=[n,i])[0],n=u[1]),o&&!nt(o)){var l=bt({x:r,y:i},o),h=bt({x:a,y:i},o),d=bt({x:a,y:n},o),f=bt({x:r,y:n},o);return pr(e,t,[{x:l.x,y:l.y},{x:h.x,y:h.y},{x:d.x,y:d.y},{x:f.x,y:f.y}])}return s?e>=r&&t>=i&&e<=a&&t<=n:e>r&&t>i&&e<a&&t<n}function vr(e,t,r,i){return Math.sqrt(Math.pow(r-e,2)+Math.pow(i-t,2))}function yr(e,t,r){var i=(Math.pow(t,2)+Math.pow(r,2)-Math.pow(e,2))/(2*t*r);return Math.acos(i)||0}var br=4*(Math.sqrt(2)-1)/3;function xr(e,t,r,i,a,n,o,s,c){if(void 0===c&&(c=!1),c){if(e>o||t>s||a>r||n>i)return!1;if((r===a||e===o)&&(i<n||t>s))return!1;if((i===t||t===i)&&(r<a||e>o))return!1}else if(e>=o||t>=s||a>=r||n>=i)return!1;return!0}function Tr(e,t,r,i,a,n){var o,s;void 0===n&&(n=!1),e>r&&(e=(o=[r,e])[0],r=o[1]),t>i&&(t=(s=[i,t])[0],i=s[1]);for(var c=0,u=0,l=0,h=0,d=0,f=a.length;d<f;d++){var m=a[d],p=m.x,g=m.y;if(d?(c=Math.min(c,p),u=Math.min(u,g),l=Math.max(l,p),h=Math.max(h,g)):(c=p,u=g,l=p,h=g),n){if(p>=e&&p<=r&&g>=t&&g<=i)return!0}else if(p>e&&p<r&&g>t&&g<i)return!0;var v=a[(d+1)%f],y=v.x,b=v.y,x=cr(e,t,r,t,p,g,y,b);if(x){if(x.toSource>0&&x.toSource<1&&x.toClip>0&&x.toClip<1)return!0;if(n&&x.toSource>=0&&x.toSource<=1&&x.toClip>=0&&x.toClip<=1)return!0}if(x=cr(e,t,e,i,p,g,y,b)){if(x.toSource>0&&x.toSource<1&&x.toClip>0&&x.toClip<1)return!0;if(n&&x.toSource>=0&&x.toSource<=1&&x.toClip>=0&&x.toClip<=1)return!0}if(x=cr(r,t,r,i,p,g,y,b)){if(x.toSource>0&&x.toSource<1&&x.toClip>0&&x.toClip<1)return!0;if(n&&x.toSource>=0&&x.toSource<=1&&x.toClip>=0&&x.toClip<=1)return!0}if(x=cr(e,i,r,i,p,g,y,b)){if(x.toSource>0&&x.toSource<1&&x.toClip>0&&x.toClip<1)return!0;if(n&&x.toSource>=0&&x.toSource<=1&&x.toClip>=0&&x.toClip<=1)return!0}}return c<=e&&u<=t&&l>=r&&h>=i}var wr={d2r:fr,r2d:mr,H:br,h:function(e){return e*=.5,(1-Math.cos(e))/Math.sin(e)*4/3},pointInConvexPolygon:pr,pointInRect:gr,pointsDistance:vr,angleBySides:yr,isRectsOverlap:xr,isRectsInside:function(e,t,r,i,a,n,o,s,c){if(void 0===c&&(c=!1),c){if(e<=a&&t<=n&&r>=o&&i>=s)return!0}else if(e<a&&t<n&&r>o&&i>s)return!0;return!1},isConvexPolygonsOverlap:function(e,t,r){void 0===r&&(r=!1);for(var i=0,a=0,n=0,o=0,s=0,c=e.length;s<c;s++){var u=e[s],l=u.x,h=u.y;s?(i=Math.min(i,l),a=Math.min(a,h),n=Math.max(n,l),o=Math.max(o,h)):(i=l,a=h,n=l,o=h)}var d=0,f=0,m=0,p=0;for(s=0,c=t.length;s<c;s++){var g=t[s];l=g.x,h=g.y;s?(d=Math.min(d,l),f=Math.min(f,h),m=Math.max(m,l),p=Math.max(p,h)):(d=l,f=h,m=l,p=h)}if(r){if(i>m||a>p||n<d||o<f)return!1}else if(i>=m||a>=p||n<=d||o<=f)return!1;for(s=0,c=e.length;s<c;s++)if(pr(e[s].x,e[s].y,t,r))return!0;for(s=0,c=t.length;s<c;s++)if(pr(t[s].x,t[s].y,e,r))return!0;for(s=0,c=e.length;s<c;s++)for(var v=[e[s].x,e[s].y,e[(s+1)%c].x,e[(s+1)%c].y],y=0,b=t.length;y<b;y++){var x=[t[y].x,t[y].y,t[(y+1)%b].x,t[(y+1)%b].y],T=cr(v[0],v[1],v[2],v[3],x[0],x[1],x[2],x[3]);if(T){if(r)return!0;if(T.toSource||T.toClip)return!0}}return!1},isConvexPolygonOverlapRect:Tr,isConvexPolygonInAnother:function(e,t,r){void 0===r&&(r=!1);for(var i=0,a=e.length;i<a;i++)if(!pr(e[i].x,e[i].y,t,r))return!1;return!0}};function kr(e,t){return Sr(e,fr(t))}function Sr(e,t){var r=Math.sin(t),i=Math.cos(t);return e[5]=e[10]=i,e[6]=r,e[9]=-r,e}function Er(e,t){return function(e,t){var r=Math.sin(t),i=Math.cos(t);return e[0]=e[10]=i,e[8]=r,e[2]=-r,e}(e,fr(t))}function Cr(e,t){return Ar(e,fr(t))}function Ar(e,t){var r=Math.sin(t),i=Math.cos(t);return e[0]=e[5]=i,e[1]=r,e[4]=-r,e}function _r(e,t,r){var i=e.slice(0);return 0===t&&0===r||nt(e)?i:i=lt(i=ht(t,r,i),-t,-r)}function Mr(e,t,r){var i=at();return e>=1&&(i[11]=-1/e,(t||r)&&(i=lt(i=ht(t,r,i),-t,-r))),i}function Ir(e,t){t||(t=at());var r=e.translateX,i=e.translateY,a=e.translateZ,n=e.rotateX,o=e.rotateY,s=e.rotateZ,c=e.scaleX,u=e.scaleY,l=e.skewX,h=e.skewY;return t[12]=r||0,t[13]=i||0,t[14]=a||0,n&&(nt(t)?kr(t,n):mt(t,fr(n))),o&&(nt(t)?Er(t,o):pt(t,fr(o))),s&&(nt(t)?Cr(t,s):gt(t,fr(s))),l&&(nt(t)?t[4]=Math.tan(fr(l)):dt(t,fr(l))),h&&(nt(t)?t[1]=Math.tan(fr(h)):ft(t,fr(h))),void 0!==c&&1!==c&&(nt(t)?t[0]=c:vt(t,c)),void 0!==u&&1!==u&&(nt(t)?t[5]=u:yt(t,u)),t}var Rr={calRotateX:kr,calRotateXRadian:Sr,calRotateZ:Cr,calRotateZRadian:Ar,calMatrixByOrigin:_r,calTransform:Ir,calTransformByMatrixAndOrigin:function(e,t,r){var i=e.slice(0);return i=ht(-t,-r,i=lt(i,t,r))},calPerspectiveMatrix:Mr};function Pr(e){if(e<=0)return 0;var t=Math.floor(3*e*Math.sqrt(2*Math.PI)/4+.5);return t<2&&(t=2),t%2==0&&t++,t}function Or(e){return Dr(Pr(e))}function Dr(e){return 3*Math.floor(.5*e)}function Br(e,t){void 0===t&&(t=3);var r=Math.sqrt(12*e*e/t+1),i=Math.floor(r);i%2==0&&i--;for(var a=i+2,n=(12*e*e-t*i*i-4*t*i-3*t)/(-4*i-4),o=Math.round(n),s=[],c=0;c<t;c++)s.push(c<o?i:a);return s}function Fr(e){var t,r=Math.abs(e);if(r>=1.5)return 0;if(r<.5)t=.75-e*e;else{var i=1.5-r;t=.5*i*i}return t*(4/3)}var Lr={gaussKernel:Pr,gaussSize:Or,gaussSizeByD:Dr,gaussianWeight:function(e,t){if(e<=0||t<=0)return[1];for(var r=[],i=Math.floor(.5*t),a=0,n=i;n>=0;n--){var o=Math.pow(Math.E,-Math.pow(n,2)/(2*Math.pow(e,2)))/(e*Math.sqrt(2*Math.PI));r.push(o),a+=o}for(n=1;n<=i;n++){o=r[i-n];r.push(o),a+=o}if(1!==a)for(n=0;n<t;n++)r[n]/=a;return r},boxesForGauss:Br,dualKawase:function(e){var t=Math.max(1,Math.round(4/3*Math.log(e)));return{passes:t,distance:Math.pow(.4538,t)*e}},n2Kernel:Fr,n2Size:function(e){return e<1?0:(e%2==0&&e++,2*(e>>1)+1)},n2Weight:function(e){if(e<1)return[];e%2==0&&e++;for(var t=e>>1,r=t/1.5,i=[],a=0,n=-t;n<=t;n++){var o=Fr(Math.abs(n)/r);i.push(o),a+=o}return i.map(function(e){return e/a})}};function Nr(e,t){void 0===t&&(t=2);var r=Math.pow(10,t);return Math.round(e*r)/r}var Ur={geom:wr,matrix:wt,vector:it,isec:dr,bezier:Zt,toPrecision:Nr,blur:Lr};function zr(e,t,r){void 0===r&&(r=!1);for(var i=[],a=e[0].color,n=0,o=e.length;n<o;n++)i.push(e[n]);(1===i.length&&i.push(C(i[0])),void 0===i[0].offset&&(i[0].offset=0),i.length>1)&&(void 0===i[n=i.length-1].offset&&(i[n].offset=1));var s=i[0].offset;for(n=1,o=i.length;n<o-1;n++){if(void 0!==(b=i[n]).offset)s=b.offset;else{for(var c=n+1,u=i[i.length-1].offset;c<o-1;c++){var l=i[c];if(void 0!==l.offset){u=l.offset;break}}for(var h=(u-s)/(c-n+1),d=n;d<c;d++){i[d].offset=s+h*(d+1-n)}n=c}}i.sort(function(e,t){return e.offset-t.offset});for(n=0,o=i.length;n<o;n++){if((b=i[n]).offset>1){i.splice(n);var f=i[n-1];if(f&&f.offset<1){var m=b.color[0]-f.color[0],p=b.color[1]-f.color[1],g=b.color[2]-f.color[2],v=b.color[3]-f.color[3],y=(1-f.offset)/(b.offset-f.offset);i.push({color:[b.color[0]+m*y,b.color[1]+p*y,b.color[2]+g*y,b.color[3]+v*y],offset:1})}break}}for(n=i.length-1;n>=0;n--){var b;if((b=i[n]).offset<0){i.splice(0,n+1);var x=i[n];if(x&&x.offset>0){m=x.color[0]-b.color[0],p=x.color[1]-b.color[1],g=x.color[2]-b.color[2],v=x.color[3]-b.color[3],y=-b.offset/(x.offset-b.offset);i.unshift({color:[b.color[0]+m*y,b.color[1]+p*y,b.color[2]+g*y,b.color[3]+v*y],offset:0})}break}}if(i.forEach(function(e){e.offset<0?e.offset=0:e.offset>1&&(e.offset=1)}),i.length||i.push({color:a,offset:0},{color:a,offset:1}),r){var T=i[0],w=i[i.length-1];if(T.offset>0||w.offset<1){m=w.color[0]-T.color[0],p=w.color[1]-T.color[1],g=w.color[2]-T.color[2],v=w.color[3]-T.color[3];var k=T.offset+(1-w.offset);if(T.offset>0){y=T.offset/k;i.unshift({color:[T.color[0]+m*y,T.color[1]+p*y,T.color[2]+g*y,T.color[3]+v*y],offset:0})}if(w.offset<1){y=(1-w.offset)/k;i.push({color:[w.color[0]-m*y,w.color[1]-p*y,w.color[2]-g*y,w.color[3]-v*y],offset:1})}}}return i}function Wr(e){if(he.gradient.test(e)){var t=he.gradient.exec(e);if(t&&["linear","radial","conic"].indexOf(t[1].toLowerCase())>-1)return!0}return!1}function Vr(e){var t=he.gradient.exec(e);if(t){var r={linear:Y.LINEAR,radial:Y.RADIAL,conic:Y.CONIC}[t[1].toLowerCase()],i=void 0;if(r===Y.LINEAR)if(n=/([-+]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e[-+]?\d+)?)\s+([-+]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e[-+]?\d+)?)\s+([-+]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e[-+]?\d+)?)\s+([-+]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e[-+]?\d+)?)/.exec(t[2]))i=[parseFloat(n[1]),parseFloat(n[2]),parseFloat(n[3]),parseFloat(n[4])];else{var a=/([-+]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e[-+]?\d+)?)/.exec(t[2]);i=a?[fr(parseFloat(a[1]))]:[]}else if(r===Y.RADIAL){var n;i=(n=/([-+]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e[-+]?\d+)?)\s+([-+]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e[-+]?\d+)?)\s+([-+]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e[-+]?\d+)?)\s+([-+]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e[-+]?\d+)?)(\s+([-+]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e[-+]?\d+)?))?/.exec(t[2]))?[parseFloat(n[1]),parseFloat(n[2]),parseFloat(n[3]),parseFloat(n[4]),parseFloat(n[5])||0]:[.5,.5,1,1]}else r===Y.CONIC&&(i=[]);var o=t[2].match(/(([-+]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e[-+]?\d+)?[pxremvwhina%]*)?\s*((#[0-9a-f]{3,8})|(rgba?\s*\(.+?\)))\s*([-+]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e[-+]?\d+)?[pxremvwhina%]*)?)|(transparent)/gi)||[],s=o.map(function(e,t){var r,i=/(?:#[0-9a-f]{3,8})|(?:rgba?\s*\(.+?\))|(?:transparent)/i.exec(e),a=/[-+]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e[-+]?\d+)?(?:(?:px)|%)?/.exec(e.replace(i[0],""));if(a){var n=se(a[0]);n.u!==V.PERCENT&&(n.v*=100,n.u=V.PERCENT),r=n}else t?t===o.length-1&&(r={v:100,u:V.PERCENT}):r={v:0,u:V.PERCENT};return{color:{v:i?de(i[0]):[0,0,0,1],u:V.RGBA},offset:r}});s.sort(function(e,t){return e.offset&&t.offset?e.offset.v-t.offset.v:0});for(var c=s.length-2;c>0;c--){if(!s[c].offset){for(var u=s[c+1].offset.v,l=s[0].offset.v,h=c,d=c-1;d>=0;d--){if(0===d){c=d;break}if(s[d].offset){c=d,l=s[d].offset.v;break}}for(var f=(u-l)/(h-c+1),m=c+1;m<=h;m++)s[c].offset={v:l+(m-c)*f,u:V.PERCENT}}}return{t:r,d:i,stops:s}}}function Hr(e,t,r,i,a,n){var o,s,c,u,l;if(t.length<=1){var h=function(e,t,r,i,a){var n,o,s,c;if(e%(2*Math.PI)==0)n=s=.5*i,o=0,c=a;else if(e%Math.PI===0)n=s=.5*i,o=a,c=0;else if(e%(.5*Math.PI)==0)n=0,s=i,o=c=.5*a;else if(e%(1.5*Math.PI)==0)n=i,s=0,o=c=.5*a;else{var u=.5*i,l=.5*a,h=Math.min(u,l),d=Math.sin(e%360),f=Math.cos(e%360);n=u-h*d,o=l-h*f,s=u+h*d,c=l+h*f}return{x1:n+=t,y1:o+=r,x2:s+=t,y2:c+=r}}(null!==(o=t[0])&&void 0!==o?o:Math.PI,r,i,a,n);s=h.x1,c=h.y1,u=h.x2,l=h.y2}else s=r+t[0]*a,c=i+t[1]*n,u=r+t[2]*a,l=i+t[3]*n;var d=Math.sqrt(Math.pow(u-s,2)+Math.pow(l-c,2));return{x1:s,y1:c,x2:u,y2:l,total:d,stop:zr(e,0,!1)}}function Xr(e,t,r,i,a,n){var o,s=r+t[0]*a,c=i+t[1]*n,u=r+t[2]*a,l=i+t[3]*n,h=t[4],d=Math.sqrt(Math.pow(u-s,2)+Math.pow(l-c,2)),f=zr(e,0,!1);if(h&&1!==h){if(o=at(),l!==c)if(u===s)gt(o,fr(l>=c?90:270));else gt(o,Math.atan((l-c)/(u-s)));yt(o,h),o=_r(o,s,c)}return{cx:s,cy:c,tx:u,ty:l,ellipseLength:h,matrix:o,total:d,stop:f}}function jr(e,t,r,i,a,n){var o=Math.floor(r+.5*a),s=Math.floor(i+.5*n),c=Math.floor(r+.5*a)-o,u=Math.floor(i+.5*n)-s,l=0;l=0===c?u>=0?0:Math.PI:Math.atan(u/c);Math.sqrt(Math.pow(c,2)+Math.pow(u,2));return{angle:l,cx:o,cy:s,stop:zr(e,0,!0)}}function Gr(e){var t={};if(["left","top","right","bottom","width","height","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"].forEach(function(r){var i=e[r];if(void 0!==i){var a=se(i||0,!0);"width"!==r&&"height"!==r||a.v<0&&(a.v=0),t[r]=a}}),void 0!==e.lineHeight){var r,i=e.lineHeight;if(S(i)||"normal"===i)t.lineHeight={v:0,u:V.AUTO};else(r=se(i||0,!0)).v<=0&&(r={v:0,u:V.AUTO}),t.lineHeight=r}(void 0!==e.fontFamily&&(t.fontFamily={v:e.fontFamily.trim().replace(/['"]/g,"").replace(/\s*,\s*/g,","),u:V.STRING}),void 0!==e.fontSize)&&((r=se(e.fontSize||L.defaultFontSize,!0)).v<=0&&(r.v=L.defaultFontSize),t.fontSize=r);if(void 0!==e.fontWeight){var a=e.fontWeight;g(a)?/thin/i.test(a)?t.fontWeight={v:100,u:V.NUMBER}:/lighter/i.test(a)?t.fontWeight={v:200,u:V.NUMBER}:/light/i.test(a)?t.fontWeight={v:300,u:V.NUMBER}:/medium/i.test(a)?t.fontWeight={v:500,u:V.NUMBER}:/semiBold/i.test(a)?t.fontWeight={v:600,u:V.NUMBER}:/bold/i.test(a)?t.fontWeight={v:700,u:V.NUMBER}:/extraBold/i.test(a)?t.fontWeight={v:800,u:V.NUMBER}:/black/i.test(a)?t.fontWeight={v:900,u:V.NUMBER}:t.fontWeight={v:400,u:V.NUMBER}:t.fontWeight={v:Math.min(900,Math.max(100,parseInt(a)||400)),u:V.NUMBER}}if(void 0!==e.fontStyle){var n=e.fontStyle,o=G.NORMAL;n&&/italic/i.test(n)?o=G.ITALIC:n&&/oblique/i.test(n)&&(o=G.OBLIQUE),t.fontStyle={v:o,u:V.NUMBER}}if(void 0!==e.letterSpacing&&(t.letterSpacing=se(e.letterSpacing||0,!0)),void 0!==e.paragraphSpacing&&(t.paragraphSpacing=se(e.paragraphSpacing||0,!0)),void 0!==e.textAlign){var s=e.textAlign,o=H.LEFT;"center"===s?o=H.CENTER:"right"===s?o=H.RIGHT:"justify"===s&&(o=H.JUSTIFY),t.textAlign={v:o,u:V.NUMBER}}if(void 0!==e.textVerticalAlign){var c=e.textVerticalAlign;o=X.TOP;"middle"===c?o=X.MIDDLE:"bottom"===c&&(o=X.BOTTOM),t.textVerticalAlign={v:o,u:V.NUMBER}}if(void 0!==e.textDecoration){var u=e.textDecoration;Array.isArray(u)?t.textDecoration=u.map(function(e){var t=re.NONE;return"underline"===e?t=re.UNDERLINE:"line-through"!==e&&"lineThrough"!==e||(t=re.LINE_THROUGH),{v:t,u:V.NUMBER}}):t.textDecoration=[]}void 0!==e.textShadow&&(he.shadow.test(e.textShadow)?(o=he.shadow.exec(e.textShadow))&&(t.textShadow={v:{x:parseFloat(o[1]),y:parseFloat(o[2]),blur:parseFloat(o[3]),color:de(o[4])},u:V.SHADOW}):t.textShadow={u:V.SHADOW});if(void 0!==e.color&&(t.color={v:de(e.color),u:V.RGBA}),void 0!==e.visibility&&(t.visibility={v:/hidden/i.test(e.visibility)?te.HIDDEN:te.VISIBLE,u:V.NUMBER}),void 0!==e.opacity&&(t.opacity={v:Math.max(0,Math.min(1,e.opacity)),u:V.NUMBER}),void 0!==e.backgroundColor&&(t.backgroundColor={v:de(e.backgroundColor),u:V.RGBA}),void 0!==e.fill){var l=e.fill;Array.isArray(l)?t.fill=l.map(function(e){if(g(e)&&Wr(e)){var t=Vr(e);if(t)return{v:t,u:V.GRADIENT}}return{v:de(e),u:V.RGBA}}):t.fill=[]}if(void 0!==e.fillEnable){var h=e.fillEnable;Array.isArray(h)?t.fillEnable=h.map(function(e){return{v:e,u:V.BOOLEAN}}):t.fillEnable=t.fill.map(function(){return{v:!0,u:V.BOOLEAN}})}if(void 0!==e.fillOpacity){var d=e.fillOpacity;Array.isArray(d)?t.fillOpacity=d.map(function(e){return{v:Math.max(0,Math.min(1,e)),u:V.NUMBER}}):t.fillOpacity=t.fill.map(function(){return{v:1,u:V.NUMBER}})}if(void 0!==e.fillMode){var f=e.fillMode;Array.isArray(f)?t.fillMode=f.map(function(e){return{v:Zr(e),u:V.NUMBER}}):t.fillMode=t.fill.map(function(){return{v:j.NORMAL,u:V.NUMBER}})}if(void 0!==e.fillRule){var m=e.fillRule;t.fillRule={v:"evenodd"===m?K.EVEN_ODD:K.NON_ZERO,u:V.NUMBER}}if(void 0!==e.stroke){var p=e.stroke;Array.isArray(p)?t.stroke=p.map(function(e){if(g(e))if(Wr(e)){if(t=Vr(e))return{v:t,u:V.GRADIENT}}else if(he.img.test(e)){var t;if(t=he.img.exec(e)){var r=ee.TILE,i=e.replace(t[0],"");i.indexOf("fill")>-1?r=ee.FILL:i.indexOf("stretch")>-1?r=ee.STRETCH:i.indexOf("fit")>-1&&(r=ee.FIT);var a=void 0,n=/([\d.]+)%/.exec(i);return n&&(a={v:parseFloat(n[1]),u:V.PERCENT}),{v:{url:t[2],type:r,scale:a},u:V.PATTERN}}}return{v:de(e),u:V.RGBA}}):t.stroke=[]}if(void 0!==e.strokeEnable){var v=e.strokeEnable;Array.isArray(v)?t.strokeEnable=v.map(function(e){return{v:e,u:V.BOOLEAN}}):t.strokeEnable=t.stroke.map(function(){return{v:!0,u:V.BOOLEAN}})}if(void 0!==e.strokeWidth){var y=e.strokeWidth;Array.isArray(y)?t.strokeWidth=y.map(function(e){return{v:Math.max(0,e),u:V.PX}}):t.strokeWidth=t.stroke.map(function(){return{v:1,u:V.NUMBER}})}if(void 0!==e.strokePosition){var b=e.strokePosition;Array.isArray(b)?t.strokePosition=b.map(function(e){var t=J.CENTER;return"inside"===e?t=J.INSIDE:"outside"===e&&(t=J.OUTSIDE),{v:t,u:V.NUMBER}}):t.strokePosition=t.stroke.map(function(){return{v:J.CENTER,u:V.NUMBER}})}if(void 0!==e.strokeMode){var x=e.strokeMode;Array.isArray(x)?t.strokeMode=x.map(function(e){return{v:Zr(e),u:V.NUMBER}}):t.strokeMode=t.stroke.map(function(){return{v:j.NORMAL,u:V.NUMBER}})}if(void 0!==e.strokeDasharray){var T=e.strokeDasharray;Array.isArray(T)?t.strokeDasharray=T.map(function(e){return{v:Math.max(0,e),u:V.PX}}):t.strokeDasharray=[]}if(void 0!==e.strokeLinecap){var w=e.strokeLinecap;o=Q.BUTT;"round"===w?o=Q.ROUND:"square"===w&&(o=Q.SQUARE),t.strokeLinecap={v:o,u:V.NUMBER}}if(void 0!==e.strokeLinejoin){var k=e.strokeLinejoin;o=Z.MITER;"round"===k?o=Z.ROUND:"bevel"===k&&(o=Z.BEVEL),t.strokeLinejoin={v:o,u:V.NUMBER}}if(void 0!==e.strokeMiterlimit&&(t.strokeMiterlimit={v:e.strokeMiterlimit,u:V.NUMBER}),["translateX","translateY","translateZ","skewX","skewY","scaleX","scaleY","rotateX","rotateY","rotateZ","perspective","perspectiveSelf"].forEach(function(r){var i=e[r];if(void 0!==i){var a=se(i);!function(e,t){"scaleX"===e||"scaleY"===e?t.u=V.NUMBER:"translateX"===e||"translateY"===e||"translateZ"===e||"perspective"===e||"perspectiveSelf"===e?t.u===V.NUMBER&&(t.u=V.PX):"rotateX"!==e&&"rotateY"!==e&&"rotateZ"!==e||t.u===V.NUMBER&&(t.u=V.DEG)}(r,a),t[r]=a}}),["transformOrigin","perspectiveOrigin"].forEach(function(r){var i=e[r];if(void 0!==i){var a;(a=Array.isArray(i)?i:(i||"").toString().match(he.position))&&a.length?1===a.length&&(a[1]=a[0]):a=[50,50];for(var n=[],o=0;o<2;o++){var s=a[o];if(/^[-+]?[\d.]/.test(s)){var c=se(s,!0);n.push(c)}else n.push({v:{top:0,left:0,center:50,right:100,bottom:100}[s],u:V.PERCENT}),S(n[o].v)&&(n[o].v=50)}t[r]=n}}),void 0!==e.mixBlendMode&&(t.mixBlendMode={v:Zr(e.mixBlendMode),u:V.NUMBER}),void 0!==e.pointerEvents&&(t.pointerEvents={v:e.pointerEvents,u:V.BOOLEAN}),e.hasOwnProperty("maskMode")){var E=e.maskMode;o=$.NONE;"alpha"===E?o=$.ALPHA:"gray"===E?o=$.GRAY:"alpha-with"===E?o=$.ALPHA_WITH:"gray-with"===E&&(o=$.GRAY_WITH),t.maskMode={v:o,u:V.NUMBER}}if(e.hasOwnProperty("breakMask")&&(t.breakMask={v:!!e.breakMask,u:V.BOOLEAN}),void 0!==e.objectFit&&(t.objectFit={v:Jr(e.objectFit),u:V.NUMBER}),void 0!==e.overflow){var C=e.overflow;o=ie.VISIBLE;"hidden"===C&&(o=ie.HIDDEN),t.overflow={v:o,u:V.NUMBER}}if(void 0!==e.filter){var A=Array.isArray(e.filter)?e.filter:[e.filter],_=[];A.forEach(function(e){var t=/([\w-]+)\s*\((\s*.+\s*)\)/i.exec(e);if(t){var r=t[1],i=t[2];if("gaussBlur"===r){var a=parseFloat(i)||0;_.push({v:{radius:{v:Math.max(a,0),u:V.PX}},u:V.GAUSS_BLUR})}else if("radiaBlur"===r){a=parseFloat(i)||0;var n=/,\s*(.+)\s*(?:,\s*(.+))?/.exec(i),o=[{v:50,u:V.PERCENT},{v:50,u:V.PERCENT}];if(n)if((h=se(n[1])).u!==V.PX&&h.u!==V.PERCENT&&(h.u=V.PX),o[0]=h,n[2]){var s=se(n[2]);s.u!==V.PX&&s.u!==V.PERCENT&&(s.u=V.PX),o[1]=s}else o[1]={v:h.v,u:h.u};_.push({v:{radius:{v:Math.max(a,0),u:V.PX},center:o},u:V.RADIAL_BLUR})}else if("motionBlur"===r){a=parseFloat(i)||0;var c={v:0,u:V.DEG},u={v:0,u:V.DEG};if(p=/,\s*(.+)\s*(?:,\s*(.+))?/.exec(i)){var l=parseFloat(p[1]);if(c.v=l||0,p[2]){var h=se(p[2]);u.v=h.v}}_.push({v:{radius:{v:Math.max(a,0),u:V.PX},angle:c,offset:u},u:V.MOTION_BLUR})}else if("bloom"===r){a=parseFloat(i)||0;var d=/,\s*([^,]+)/.exec(i),f={v:.5,u:V.NUMBER};if(d){var m=se(d[1]);f.v=Math.max(0,m.v)}_.push({v:{threshold:{v:Math.max(a,0),u:V.NUMBER},knee:f},u:V.BLOOM})}else if("lightDark"===r){var p;a=parseFloat(i)||0,c={v:0,u:V.DEG};if(p=/,\s*(.+)\s*(?:,\s*(.+))?/.exec(i)){l=parseFloat(p[1]);c.v=l||0}_.push({v:{radius:{v:Math.max(a,0),u:V.PX},angle:c},u:V.LIGHT_DARK})}else if("hueRotate"===r){a=parseFloat(i)||0;_.push({v:{radius:{v:a,u:V.DEG}},u:V.HUE_ROTATE})}else if("saturate"===r){a=parseFloat(i)||0;_.push({v:{radius:{v:.01*a,u:V.PERCENT}},u:V.SATURATE})}else if("brightness"===r){a=parseFloat(i)||0;_.push({v:{radius:{v:.01*a,u:V.PERCENT}},u:V.BRIGHTNESS})}else if("contrast"===r){a=parseFloat(i)||0;_.push({v:{radius:{v:.01*a,u:V.PERCENT}},u:V.CONTRAST})}else if("sepia"===r){a=parseFloat(i)||0;_.push({v:{radius:{v:.01*a,u:V.PERCENT}},u:V.SEPIA})}}}),t.filter=_}return t}function Yr(e){var t=e.fontSize||L.defaultFontSize,r=e.fontFamily||L.defaultFontFamily;/[\s.,/\\]/.test(r)&&(r='"'+r.replace(/"/g,'\\"')+'"');var i="";e.fontStyle===G.ITALIC&&(i="italic ");var a="";return 400!==e.fontWeight&&(a=e.fontWeight+" "),i+a+t+"px "+r}function qr(e){for(var t=e.split(/\s*,\s*/),r=0,i=t.length;r<i;r++){var a=t[r].replace(/^['"]/,"").replace(/['"]$/,"");if(Xe.hasRegister(a)||oe.checkSupportFontFamily(a))return a}return L.defaultFontFamily}function Kr(e,t){t||(t=qr(e.fontFamily));var r=(Xe.data[t]||Xe.data[L.defaultFontFamily]||Xe.data.Arial||{}).lhr;return e.fontSize*r}function $r(e,t){var r=e.fontSize,i=qr(e.fontFamily),a=Kr(e,i),n=(Xe.data[i]||Xe.data[L.defaultFontFamily]||Xe.data.Arial||{}).blr||1;return.5*((null!=t?t:e.lineHeight)-a)+r*n}function Qr(e,t){var r=e.fontSize,i=qr(e.fontFamily),a=Kr(e,i),n=(Xe.data[i]||Xe.data[L.defaultFontFamily]||Xe.data.Arial||{}).car||1;return.5*((null!=t?t:e.lineHeight)-a)+r*n}function Zr(e){var t=j.NORMAL;return/multiply/i.test(e)?t=j.MULTIPLY:/screen/i.test(e)?t=j.SCREEN:/overlay/i.test(e)?t=j.OVERLAY:/darken/i.test(e)?t=j.DARKEN:/lighten/i.test(e)?t=j.LIGHTEN:/color[-\s]dodge/i.test(e)||/colorDodge/.test(e)?t=j.COLOR_DODGE:/color[-\s]burn/i.test(e)||/colorBurn/.test(e)?t=j.COLOR_BURN:/hard[\-\s]light/i.test(e)||/hardLight/.test(e)?t=j.HARD_LIGHT:/soft[-\s]light/i.test(e)||/softLight/.test(e)?t=j.SOFT_LIGHT:/difference/i.test(e)?t=j.DIFFERENCE:/exclusion/i.test(e)?t=j.EXCLUSION:/hue/i.test(e)?t=j.HUE:/saturation/i.test(e)?t=j.SATURATION:/color/i.test(e)?t=j.COLOR:/luminosity/i.test(e)&&(t=j.LUMINOSITY),t}function Jr(e){var t=ae.FILL;return"contain"===e?t=ae.CONTAIN:"cover"===e&&(t=ae.COVER),t}function ei(e,t,r){if(e===t)return!0;var i=e[r],a=t[r];if(void 0===i&&void 0===a)return!0;if(void 0===i||void 0===a)return!1;if("transformOrigin"===r||"perspectiveOrigin"===r)return i[0].v===a[0].v&&i[0].u===a[0].u&&i[1].v===a[1].v&&i[1].u===a[1].u;if("color"===r||"backgroundColor"===r)return i.v[0]===a.v[0]&&i.v[1]===a.v[1]&&i.v[2]===a.v[2]&&i.v[3]===a.v[3];if("fill"===r||"stroke"===r){if(i.length!==a.length)return!1;for(var n=0,o=i.length;n<o;n++){var s=i[n],c=a[n];if(s.u!==c.u)return!1;if(s.u===V.RGBA){if(s.v[0]!==c.v[0]||s.v[1]!==c.v[1]||s.v[2]!==c.v[2]||s.v[3]!==c.v[3])return!1}else if(s.u===V.GRADIENT){if(s.v.t!==c.v.t)return!1;if(s.v.d.length!==c.v.d.length)return!1;for(var u=0,l=s.v.d.length;u<l;u++)if(s.v.d[u]!==c.v.d[u])return!1;if(s.v.stops.length!==c.v.stops.length)return!1;for(var h=0,d=s.v.stops.length;h<d;h++){var f=s.v.stops[h],m=c.v.stops[h];if(f.color.v[0]!==m.color.v[0]||f.color.v[1]!==m.color.v[1]||f.color.v[2]!==m.color.v[2]||f.color.v[3]!==m.color.v[3])return!1;if(f.offset&&!m.offset||!f.offset&&m.offset)return!1;if(f.offset.u!==m.offset.u||f.offset.v!==m.offset.v)return!1}}}return!0}if("filter"===r){if(i.length!==a.length)return!1;for(n=0,o=i.length;n<o;n++){s=i[n],c=a[n];if(s.u!==c.u)return!1;if(s.u===V.GAUSS_BLUR){if(s.v.radius.v!==c.v.radius.v)return!1}else if(s.u===V.RADIAL_BLUR){if(s.v.radius.v!==c.v.radius.v)return!1;if(s.v.center[0].v!==c.v.center[0].v||s.v.center[1].v!==c.v.center[1].v)return!1}else if(s.u===V.MOTION_BLUR){if(s.v.radius.v!==c.v.radius.v)return!1;if(s.v.angle.v!==c.v.angle.v||s.v.offset.v!==c.v.offset.v)return!1}else if(s.u===V.BLOOM){if(s.v.threshold.v!==c.v.threshold.v||s.v.knee.v!==c.v.knee.v)return!1}else if(s.u===V.LIGHT_DARK){if(s.v.radius.v!==c.v.radius.v||s.v.angle.v!==c.v.angle.v)return!1}else if((s.u===V.HUE_ROTATE||s.u===V.SATURATE||s.u===V.BRIGHTNESS||s.u===V.CONTRAST||s.u===V.SEPIA)&&s.v.radius.v!==c.v.radius.v)return!1}return!0}if("fillEnable"===r||"fillRule"===r||"fillOpacity"===r||"strokeEnable"===r||"strokeWidth"===r||"strokePosition"===r||"strokeDasharray"===r){if(i.length!==a.length)return!1;for(n=0,o=i.length;n<o;n++){s=i[n],c=a[n];if(s.u!==c.u||s.v!==c.v)return!1}return!0}return i.v===a.v&&i.u===a.u}function ti(e,t){t?Array.isArray(t)||(t=[t]):t=Object.keys(e);for(var r={},i=0,a=t.length;i<a;i++){var n=t[i],o=e[n];o&&(r[n]="transformOrigin"===n||"perspectiveOrigin"===n?[Object.assign({},o[0]),Object.assign({},o[1])]:"color"===n||"backgroundColor"===n?{v:o.v.slice(0),u:o.u}:"fill"===n||"stroke"===n||"filter"===n?o.map(function(e){return C(e)}):"filter"===n?o.map(function(e){var t={};return e.u===V.RADIAL_BLUR?(t.radius=Object.assign({},e.v.radius),t.center=e.v.center.map(function(e){return Object.assign({},e)})):e.u===V.MOTION_BLUR?(t.radius=Object.assign({},e.v.radius),t.angle=Object.assign({},e.v.angle),t.offset=Object.assign({},e.v.offset)):e.u===V.BLOOM&&(t.threshold=Object.assign({},e.v.threshold),t.knee=Object.assign({},e.v.knee)),{v:t,u:e.u}}):"fillEnable"===n||"fillRule"===n||"fillOpacity"===n||"strokeEnable"===n||"strokeWidth"===n||"strokePosition"===n||"strokeDasharray"===n?o.map(function(e){return Object.assign({},e)}):Object.assign({},o))}return r}function ri(e,t){return e.u===V.PX?e.v:e.u===V.PERCENT?e.v*t*.01:0}function ii(e,t){var i={};return ue.forEach(function(e){var r=t[e];void 0!==r&&(i[e]=r)}),r(r({location:e.location,length:e.length},i),Gr(e))}function ai(e){return["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"][e]}function ni(e,t,r,i){return void 0===i&&(i=!1),Array.isArray(e)?fe(e):function(e,t,r,i){var a,n,o,s;void 0===t&&(t=100),void 0===r&&(r=100),void 0===i&&(i=!1);var c=e.t,u=e.d,l=e.stops,h=u[0],d=u[1],f=u[2],m=u[3];h*=t,f*=t,d*=r,m*=r;var p=0;1===u.length?p=u[0]:h===f?d<m&&(p=180):p=f>h?m>=d?90+mr(Math.atan((m-d)/(f-h))):mr(Math.atan((f-h)/(d-m))):m>=d?180+mr(Math.atan((h-f)/(m-d))):360-mr(Math.atan((h-f)/(d-m)));var g=l.slice(0);if(g.sort(function(e,t){return e.offset.v-t.offset.v}),c===Y.LINEAR){var v=void 0,y=void 0;p<=90?(v={x:0,y:r},y={x:t,y:0}):p<=180?(v={x:0,y:0},y={x:t,y:r}):p<=270?(v={x:t,y:0},y={x:0,y:r}):(v={x:t,y:r},y={x:0,y:0});var b=C(g).sort(function(e,t){return e.offset-t.offset});if(i){var x=Math.sqrt(Math.pow(m-v.y,2)+Math.pow(f-v.x,2)),T=Math.sqrt(Math.pow(d-v.y,2)+Math.pow(h-v.x,2)),w=Math.sqrt(Math.pow(m-d,2)+Math.pow(f-h,2)),k=yr(x,T,w),S=k?T*Math.cos(k):T,E=(k=yr(x=Math.sqrt(Math.pow(d-y.y,2)+Math.pow(h-y.x,2)),T=Math.sqrt(Math.pow(m-y.y,2)+Math.pow(f-y.x,2)),w))?T*Math.cos(k):T;if(b[0].offset>0&&b.unshift({color:b[0].color.slice(0),offset:0}),b[b.length-1].offset<1&&b.push({color:b[b.length-1].color.slice(0),offset:1}),S>1e-9)for(var A=S/w,_=function(e,t){var r=b[e];if(r.offset>=A){var i=b[e-1]||{color:r.color,offset:0};if(b.splice(0,e),r.offset>A){var a=w*(r.offset-i.offset),n=(S-i.offset*w)/a,o=i.color.map(function(e,t){return 3===t?e+(r.color[t]-e)*n:e+Math.floor((r.color[t]-e)*n)}),s={color:o,offset:0};b.unshift(s)}return"break"}},M=0,I=b.length;M<I&&"break"!==_(M);M++);else S<-1e-9&&b.forEach(function(e){e.offset=(e.offset*w-S)/(w-S)});if(E>1e-9){A=(w-E)/w;var R=function(e){var t=b[e];if(t.offset<=A){var r=b[e+1]||{color:t.color,offset:1};if(b.splice(e+1),t.offset<A){var i=w*(r.offset-t.offset),a=(E-(1-r.offset)*w)/i,n=r.color.map(function(e,r){return 3===r?e+(t.color[r]-e)*a:e+Math.floor((t.color[r]-e)*a)}),o={color:n,offset:1};b.push(o)}return"break"}};for(M=b.length-1;M>=0&&"break"!==R(M);M--);}else E<-1e-9&&b.forEach(function(e){e.offset=e.offset*(w-S)/(w-S-E)})}var P="linear-gradient(";return P+=i?Nr(p)+"deg":u.join(" "),b.forEach(function(e){P+=", ",e.color[3]=Nr(e.color[3]),P+=fe(e.color)+" "+Nr(100*e.offset)+"%"}),P+")"}if(c===Y.RADIAL){var O=1;if(i){var D=Math.sqrt(Math.pow(f-h,2)+Math.pow(m-d,2)),B=Math.sqrt(Math.pow(h,2)+Math.pow(d,2)),F=Math.sqrt(Math.pow(h-t,2)+Math.pow(d,2)),L=Math.sqrt(Math.pow(h-t,2)+Math.pow(d-r,2)),N=Math.sqrt(Math.pow(h,2)+Math.pow(d-r,2)),U=Math.max(B,F,L,N);O=U/D}var z="radial-gradient(";return z+=i?"circle at ".concat(100*Nr(u[0]),"% ").concat(100*Nr(u[1]),"%, "):u.join(" ")+", ",g.forEach(function(e,t){t&&(z+=", ");var r=e.color.v.map(function(e,t){return 3===t?Nr(e):Math.min(255,Math.floor(e*O))});z+=fe(r)+" "+Nr(100*e.offset.v)+"%"}),z+")"}if(c===Y.CONIC){var W="conic-gradient(";i&&(W+="from 90deg, ");var H=g[0],X=g[g.length-1];if(i&&(H.offset.v>0||X.offset.v<1)){var j=null!==(a=H.color.v[3])&&void 0!==a?a:1,G=null!==(n=X.color.v[3])&&void 0!==n?n:1,q=[H.color.v[0]-X.color.v[0],H.color.v[1]-X.color.v[1],H.color.v[2]-X.color.v[2],j-G],K=1-X.offset.v+H.offset.v;if(H.offset.v>0){var $=H.offset.v/K;g.unshift({color:{v:[Math.min(255,Math.max(0,Math.round(H.color.v[0]-q[0]*$))),Math.min(255,Math.max(0,Math.round(H.color.v[1]-q[1]*$))),Math.min(255,Math.max(0,Math.round(H.color.v[2]-q[2]*$))),Math.min(1,Math.max(0,null!==(o=H.color.v[3])&&void 0!==o?o:1-q[3]*$))],u:V.RGBA},offset:{v:0,u:V.PERCENT}})}X.offset.v<1&&($=(1-X.offset.v)/K,g.push({color:{v:[Math.min(255,Math.max(0,Math.round(X.color.v[0]+q[0]*$))),Math.min(255,Math.max(0,Math.round(X.color.v[1]+q[1]*$))),Math.min(255,Math.max(0,Math.round(X.color.v[2]+q[2]*$))),Math.min(1,Math.max(0,null!==(s=X.color.v[3])&&void 0!==s?s:1+q[3]*$))],u:V.RGBA},offset:{v:100,u:V.PERCENT}}))}return g.forEach(function(e,t){t&&(W+=", "),e.color.v[3]=Nr(e.color.v[3]),W+=fe(e.color.v)+" "+Nr(100*e.offset.v)+"%"}),W+")"}return""}(e,t,r,i)}function oi(e){return["center","inside","outside"][e]||"inside"}function si(e){var t,r,i,a;return{x:e.x,y:e.y,cornerRadius:e.cornerRadius||0,fx:null!==(t=e.fx)&&void 0!==t?t:e.x,fy:null!==(r=e.fy)&&void 0!==r?r:e.y,tx:null!==(i=e.tx)&&void 0!==i?i:e.x,ty:null!==(a=e.ty)&&void 0!==a?a:e.y,hasCurveFrom:e.hasCurveFrom||!1,hasCurveTo:e.hasCurveTo||!1,curveMode:{none:ce.NONE,straight:ce.STRAIGHT,mirrored:ce.MIRRORED,asymmetric:ce.ASYMMETRIC,disconnected:ce.DISCONNECTED}[e.curveMode||"none"]||ce.NONE,absX:0,absY:0,absFx:0,absFy:0,absTx:0,absTy:0,dspX:0,dspY:0,dspFx:0,dspFy:0,dspTx:0,dspTy:0}}function ci(e){return{fontFamily:e.fontFamily.v,fontSize:e.fontSize.v,fontWeight:e.fontWeight.v,lineHeight:e.lineHeight.v,letterSpacing:e.letterSpacing.v,paragraphSpacing:e.paragraphSpacing.v,fontStyle:["normal","italic","oblique"][e.fontStyle.v]||"normal",color:fe(e.color.v),textAlign:["left","right","center","justify"][e.textAlign.v]||"left",textDecoration:e.textDecoration.map(function(e){return["none","underline","lineThrough"][e.v]||"none"}),textShadow:(t=e.textShadow.v,t?t.x+"px "+t.y+"px "+t.blur+" px "+fe(t.color):"none"),stroke:e.stroke.map(function(e){return ni(e.v,1,1,!0)}),strokeWidth:e.strokeWidth.map(function(e){return e.v}),strokeEnable:e.strokeEnable.map(function(e){return e.v})};var t}var ui,li={normalize:Gr,equalStyle:ei,cloneStyle:ti,calSize:ri,normalizeRich:ii,getCssMbm:ai,getCssFillStroke:ni,getCssStrokePosition:oi,normalizePoints:si,getPropsRich:ci};function hi(e){return"pointerEvents"===e||"constrainProportions"===e||"isLocked"===e||"isSelected"===e||"resizesContent"===e||"isRectangle"===e?ui.NONE:"translateX"===e?ui.TRANSLATE_X:"translateY"===e?ui.TRANSLATE_Y:"translateZ"===e?ui.TRANSLATE_Z:"rotateX"===e?ui.ROTATE_X:"rotateY"===e?ui.ROTATE_Y:"rotateZ"===e?ui.ROTATE_Z:"scaleX"===e?ui.SCALE_X:"scaleY"===e?ui.SCALE_Y:"matrix"===e?ui.MATRIX:"transformOrigin"===e?ui.TRANSFORM_ORIGIN:"opacity"===e?ui.OPACITY:"perspective"===e||"perspectiveOrigin"===e?ui.PERSPECTIVE:"perspectiveSelf"===e?ui.PERSPECTIVE_SELF:"filter"===e?ui.FILTER:"mixBlendMode"===e?ui.MIX_BLEND_MODE:"maskMode"===e?ui.MASK:"breakMask"===e?ui.BREAK_MASK:function(e){return"width"===e||"height"===e||"letterSpacing"===e||"paragraphSpacing"===e||"textAlign"===e||"textVerticalAlign"===e||"fontFamily"===e||"fontSize"===e||"fontWeight"===e||"fontStyle"===e||"lineHeight"===e||"left"===e||"top"===e||"right"===e||"bottom"===e}(e)?ui.REFLOW:ui.REPAINT}function di(e,t,r,i,a){if(3===arguments.length){var n=t,o=n[0],s=n[1],c=n[2],u=n[3];if(!nt(r)){var l=bt({x:o,y:s},r),h=bt({x:o,y:u},r),d=bt({x:c,y:s},r),f=bt({x:c,y:u},r);l.w&&1!==l.w&&(l.x/=l.w,l.y/=l.w),h.w&&1!==h.w&&(h.x/=h.w,h.y/=h.w),d.w&&1!==d.w&&(d.x/=d.w,d.y/=d.w),f.w&&1!==f.w&&(f.x/=f.w,f.y/=f.w),o=Math.min(l.x,h.x,d.x,f.x),s=Math.min(l.y,h.y,d.y,f.y),c=Math.max(l.x,h.x,d.x,f.x),u=Math.max(l.y,h.y,d.y,f.y)}e[0]=Math.min(e[0],o),e[1]=Math.min(e[1],s),e[2]=Math.max(e[2],c),e[3]=Math.max(e[3],u)}else 2===arguments.length?(e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[2]),e[3]=Math.max(e[3],t[3])):5===arguments.length&&(e[0]=Math.min(e[0],t),e[1]=Math.min(e[1],r),e[2]=Math.max(e[2],i),e[3]=Math.max(e[3],a))}function fi(e,t){var r,i;if(6===e.length)r=e[4],i=e[5];else if(4===e.length)r=e[2],i=e[3];else{if(2!==e.length)return void oe.error("Unsupported point data: "+e.join(","));r=e[0],i=e[1]}return t[0]=r,t[1]=i,t[2]=r,t[3]=i,{x:r,y:i}}function mi(e,t,r,i){var a,n;if(4===e.length)a=e[2],n=e[3],di(i,(o=Zt.bboxBezier(t,r,e[0],e[1],a,n))[0],o[1],o[2],o[3]);else if(6===e.length){var o;a=e[4],n=e[5],di(i,(o=Zt.bboxBezier(t,r,e[0],e[1],e[2],e[3],a,n))[0],o[1],o[2],o[3])}else{if(2!==e.length)return void oe.error("Unsupported point data: "+e.join(","));di(i,a=e[0],n=e[1],a,n)}return{x:a,y:n}}function pi(e){e[0]=Math.floor(e[0]),e[1]=Math.floor(e[1]),e[2]=Math.ceil(e[2]),e[3]=Math.ceil(e[3])}!function(e){e[e.NONE=0]="NONE",e[e.CACHE=1]="CACHE",e[e.TRANSLATE_X=2]="TRANSLATE_X",e[e.TRANSLATE_Y=4]="TRANSLATE_Y",e[e.TRANSLATE=6]="TRANSLATE",e[e.TRANSLATE_Z=8]="TRANSLATE_Z",e[e.ROTATE_X=16]="ROTATE_X",e[e.ROTATE_Y=32]="ROTATE_Y",e[e.ROTATE_Z=64]="ROTATE_Z",e[e.SCALE_X=128]="SCALE_X",e[e.SCALE_Y=256]="SCALE_Y",e[e.SCALE=384]="SCALE",e[e.MATRIX=512]="MATRIX",e[e.TRANSFORM_ORIGIN=1024]="TRANSFORM_ORIGIN",e[e.TRANSFORM_ALL=2046]="TRANSFORM_ALL",e[e.PERSPECTIVE=2048]="PERSPECTIVE",e[e.PERSPECTIVE_SELF=4096]="PERSPECTIVE_SELF",e[e.OPACITY=8192]="OPACITY",e[e.FILTER=16384]="FILTER",e[e.MIX_BLEND_MODE=32768]="MIX_BLEND_MODE",e[e.MASK=65536]="MASK",e[e.BREAK_MASK=131072]="BREAK_MASK",e[e.MASK_OPACITY=139264]="MASK_OPACITY",e[e.HOOK=262144]="HOOK",e[e.REPAINT=524288]="REPAINT",e[e.REFLOW=1048576]="REFLOW",e[e.REFLOW_REPAINT=1572864]="REFLOW_REPAINT",e[e.REFLOW_REPAINT_MASK=1638400]="REFLOW_REPAINT_MASK",e[e.REFLOW_REPAINT_HOOK=1835008]="REFLOW_REPAINT_HOOK",e[e.REFLOW_TRANSFORM=1050622]="REFLOW_TRANSFORM",e[e.REFLOW_PERSPECTIVE=1050624]="REFLOW_PERSPECTIVE",e[e.REFLOW_PERSPECTIVE_SELF=1052672]="REFLOW_PERSPECTIVE_SELF",e[e.REFLOW_OPACITY=1056768]="REFLOW_OPACITY",e[e.REFLOW_FILTER=1064960]="REFLOW_FILTER",e[e.ADD_DOM=2097152]="ADD_DOM",e[e.REMOVE_DOM=4194304]="REMOVE_DOM",e[e.FULL=8388607]="FULL"}(ui||(ui={}));var gi,vi,yi={},bi=new WeakMap,xi=new WeakMap,Ti=function(){function e(e,t,r,i){void 0===r&&(r=0),void 0===i&&(i=0),this.available=!1,this.w=e,this.h=t,this.dx=r,this.dy=i,this.list=[];for(var a=L.maxTextureSize,n=0,o=Math.ceil(t/a);n<o;n++)for(var s=0,c=Math.ceil(e/a);s<c;s++){var u=s===c-1?e-s*a:a,l=n===o-1?t-n*a:a;this.list.push({x:s*a-r,y:n*a-i,w:u,h:l,os:oe.getOffscreenCanvas(u,l)})}}return e.prototype.release=function(){return this.url?this.releaseImg(this.url):this.videoFrame?this.releaseVideoFrame(this.videoFrame):this.canvas?this.releaseCanvas(this.canvas):!!this.available&&(this.available=!1,this.list.splice(0).forEach(function(e){return e.os.release()}),!0)},e.prototype.releaseImg=function(e){if(!this.available)return!1;this.available=!1;var t=yi[e];return t&&(t.count--,t.count||(delete yi[e],this.list.splice(0).forEach(function(e){return e.os.release()}))),!0},e.prototype.releaseVideoFrame=function(e){if(!this.available)return!1;this.available=!1;var t=xi.get(e);return t&&(t.count--,t.count||(xi.delete(e),this.list.splice(0).forEach(function(e){return e.os.release()}))),!0},e.prototype.releaseCanvas=function(e){if(!this.available)return!1;this.available=!1;var t=bi.get(e);return t&&(t.count--,t.count||(bi.delete(e),this.list.splice(0).forEach(function(e){return e.os.release()}))),!0},e.prototype.getCount=function(){var e,t;return this.url?null===(e=yi[this.url])||void 0===e?void 0:e.count:this.videoFrame?null===(t=xi.get(this.videoFrame))||void 0===t?void 0:t.count:void 0},e.getImgInstance=function(t,r,i,a,n){void 0===a&&(a=0),void 0===n&&(n=0);var o=yi[i];if(o)return o.count++,o.value;var s=new e(t,r,a,n);return s.url=i,yi[i]={value:s,count:1},s},e.getVideoFrameInstance=function(t,r,i,a,n){void 0===a&&(a=0),void 0===n&&(n=0);var o=xi.get(i);if(o)return o.count++,o.value;var s=new e(t,r,a,n);return s.videoFrame=i,xi.set(i,{value:s,count:1}),s},e.getCanvasInstance=function(t,r,i,a,n){void 0===a&&(a=0),void 0===n&&(n=0);var o=bi.get(i);if(o)return o.count++,o.value;var s=new e(t,r,a,n);return s.canvas=i,bi.set(i,{value:s,count:1}),s},e}();function wi(e,t,r){var i=function(e,t,r){var i=ki(e,e.VERTEX_SHADER,t),a=ki(e,e.FRAGMENT_SHADER,r);if(!i||!a)return null;var n=e.createProgram();if(!n)return null;n.vertexShader=i,n.fragmentShader=a,e.attachShader(n,i),e.attachShader(n,a),e.linkProgram(n);var o=e.getProgramParameter(n,e.LINK_STATUS);if(!o){var s=e.getProgramInfoLog(n);throw e.deleteProgram(n),e.deleteShader(a),e.deleteShader(i),new Error("Failed to link program: "+s)}return n}(e,t,r);if(!i)throw new Error("Failed to create program");return e.enable(e.BLEND),e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA),i}function ki(e,t,r){var i=e.createShader(t);if(null===i)throw new Error("unable to create shader");if(e.shaderSource(i,r),e.compileShader(i),!e.getShaderParameter(i,e.COMPILE_STATUS)){var a=e.getShaderInfoLog(i);throw e.deleteShader(i),new Error("Failed to compile shader: "+a)}return i}function Si(e,t,r,i,a){var n=e.createTexture();if(Ei(e,n,t),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),r)e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,r);else{if(!i||!a)throw new Error("Missing texImageSource or w/h");e.texImage2D(e.TEXTURE_2D,0,e.RGBA,i,a,0,e.RGBA,e.UNSIGNED_BYTE,null)}return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),n}function Ei(e,t,r){e.activeTexture(e["TEXTURE"+r]),e.bindTexture(e.TEXTURE_2D,t)}function Ci(e,t,r,i,a){var n,o;n=gi||(gi=new Float32Array(12)),o=vi||(vi=new Float32Array(8));var s=a.matrix,c=a.bbox,u=a.tc,l=a.t,h=a.dx,d=void 0===h?0:h,f=a.dy,m=void 0===f?0:f;Ei(e,l,0);var p=Yi(c,t,r,d,m,s),g=p.t1,v=p.t2,y=p.t3,b=p.t4;n[0]=g.x,n[1]=g.y,n[2]=g.w||1,n[3]=b.x,n[4]=b.y,n[5]=b.w||1,n[6]=v.x,n[7]=v.y,n[8]=v.w||1,n[9]=y.x,n[10]=y.y,n[11]=y.w||1,u?(o[0]=u.x1,o[1]=u.y3,o[2]=u.x1,o[3]=u.y1,o[4]=u.x3,o[5]=u.y3,o[6]=u.x3,o[7]=u.y1):(o[0]=0,o[1]=1,o[2]=0,o[3]=0,o[4]=1,o[5]=1,o[6]=1,o[7]=0);var x=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,x),e.bufferData(e.ARRAY_BUFFER,n,e.STATIC_DRAW);var T=i.attrib.a_position;e.vertexAttribPointer(T,3,e.FLOAT,!1,0,0),e.enableVertexAttribArray(T);var w=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,w),e.bufferData(e.ARRAY_BUFFER,o,e.STATIC_DRAW);var k=i.attrib.a_texCoords;e.vertexAttribPointer(k,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(k);var S=i.uniformValue;if(S.u_opacity!==a.opacity){S.u_opacity=a.opacity;var E=i.uniform.u_opacity;e.uniform1f(E,a.opacity)}if(0!==S.u_texture){S.u_texture=0;var C=i.uniform.u_texture;e.uniform1i(C,0)}e.drawArrays(e.TRIANGLE_STRIP,0,4),e.deleteBuffer(x),e.deleteBuffer(w),e.disableVertexAttribArray(T),e.disableVertexAttribArray(k)}for(var Ai=16,_i=new Float32Array(192),Mi=new Float32Array(128),Ii=new Float32Array(64),Ri=new Uint16Array(64),Pi=new Uint16Array(Ai),Oi=0;Oi<Ai;Oi++)Pi[Oi]=Oi;var Di=new Uint16Array(79);for(Oi=0;Oi<Di.length;Oi++){var Bi=(Oi+1)%5;if(Bi){var Fi=Math.floor(Oi/5);Di[Oi]=4*Fi+Bi-1}else Di[Oi]=65535}function Li(e,t,r,i,a){var n=a.length;if(n>Ai)throw new Error("DrawData size is "+n+", max is "+Ai);for(var o=0;o<n;o++){var s=a[o],c=s.opacity,u=s.matrix,l=s.bbox,h=s.tc,d=s.t,f=s.dx,m=void 0===f?0:f,p=s.dy,g=void 0===p?0:p;Ei(e,d,o);var v=Yi(l,t,r,m,g,u),y=v.t1,b=v.t2,x=v.t3,T=v.t4;_i[12*o]=y.x,_i[12*o+1]=y.y,_i[12*o+2]=y.w||1,_i[12*o+3]=T.x,_i[12*o+4]=T.y,_i[12*o+5]=T.w||1,_i[12*o+6]=b.x,_i[12*o+7]=b.y,_i[12*o+8]=b.w||1,_i[12*o+9]=x.x,_i[12*o+10]=x.y,_i[12*o+11]=x.w||1,h?(Mi[8*o]=h.x1,Mi[8*o+1]=h.y1,Mi[8*o+2]=h.x1,Mi[8*o+3]=h.y3,Mi[8*o+4]=h.x3,Mi[8*o+5]=h.y1,Mi[8*o+6]=h.x3,Mi[8*o+7]=h.y3):(Mi[8*o]=0,Mi[8*o+1]=1,Mi[8*o+2]=0,Mi[8*o+3]=0,Mi[8*o+4]=1,Mi[8*o+5]=1,Mi[8*o+6]=1,Mi[8*o+7]=0),Ii[4*o]=c,Ii[4*o+1]=c,Ii[4*o+2]=c,Ii[4*o+3]=c,Ri[4*o]=o,Ri[4*o+1]=o,Ri[4*o+2]=o,Ri[4*o+3]=o}var w=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,w),e.bufferData(e.ARRAY_BUFFER,_i,e.STATIC_DRAW);var k=i.attrib.a_position;e.vertexAttribPointer(k,3,e.FLOAT,!1,0,0),e.enableVertexAttribArray(k);var S=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,S),e.bufferData(e.ARRAY_BUFFER,Mi,e.STATIC_DRAW);var E=i.attrib.a_texCoords;e.vertexAttribPointer(E,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(E);var C=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,C),e.bufferData(e.ARRAY_BUFFER,Ii,e.STATIC_DRAW);var A=i.attrib.a_opacity;e.vertexAttribPointer(A,1,e.FLOAT,!1,0,0),e.enableVertexAttribArray(A);var _=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,_),e.bufferData(e.ARRAY_BUFFER,Ri,e.STATIC_DRAW);var M=i.attrib.a_textureIndex;e.vertexAttribPointer(M,1,e.UNSIGNED_SHORT,!1,0,0),e.enableVertexAttribArray(M);var I=i.uniformValue;Pi.forEach(function(t){var r="u_texture["+t+"]";if(I[r]!==t){I[r]=t;var a=i.uniform[r];e.uniform1i(a,t)}});var R=e.createBuffer();e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,R),e.bufferData(e.ELEMENT_ARRAY_BUFFER,Di,e.STATIC_DRAW),e.drawElements(e.TRIANGLE_STRIP,5*n-1,e.UNSIGNED_SHORT,0)}function Ni(e,t){var r=function(){var e=new Float32Array(8),t=new Float32Array(8);return e[0]=-1,e[1]=-1,e[2]=-1,e[3]=1,e[4]=1,e[5]=-1,e[6]=1,e[7]=1,t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=1,t[5]=0,t[6]=1,t[7]=1,{vtPoint:e,vtTex:t}}(),i=r.vtPoint,a=r.vtTex,n=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,n),e.bufferData(e.ARRAY_BUFFER,i,e.STATIC_DRAW);var o=t.attrib.a_position;e.vertexAttribPointer(o,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(o);var s=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,s),e.bufferData(e.ARRAY_BUFFER,a,e.STATIC_DRAW);var c=t.attrib.a_texCoords;return e.vertexAttribPointer(c,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(c),{pointBuffer:n,a_position:o,texBuffer:s,a_texCoords:c}}function Ui(e,t,r,i,a,n){void 0===a&&(a=0),void 0===n&&(n=0);var o=Ni(e,t),s=o.pointBuffer,c=o.a_position,u=o.texBuffer,l=o.a_texCoords;Ei(e,r,0),Ei(e,i,1);var h=t.uniform.u_texture1;e.uniform1i(h,0);var d=t.uniform.u_texture2;e.uniform1i(d,1);var f=t.uniform.u_d;void 0!==f&&e.uniform2f(f,a,n),e.drawArrays(e.TRIANGLE_STRIP,0,4),e.deleteBuffer(s),e.deleteBuffer(u),e.disableVertexAttribArray(c),e.disableVertexAttribArray(l)}function zi(e,t,r,i,a,n,o,s){void 0===s&&(s=1);var c=Ni(e,t),u=c.pointBuffer,l=c.a_position,h=c.texBuffer,d=c.a_texCoords,f=t.uniform.u_xy;e.uniform2f(f,s/i,s/a);var m=Si(e,0,void 0,n,o),p=t.uniform.u_texture;return e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,m,0),Ei(e,r,0),e.uniform1i(p,0),e.drawArrays(e.TRIANGLE_STRIP,0,4),e.deleteBuffer(u),e.deleteBuffer(h),e.disableVertexAttribArray(l),e.disableVertexAttribArray(d),m}function Wi(e,t,r,i,a,n,o,s,c){void 0===c&&(c=!1);var u=Ni(e,t),l=u.pointBuffer,h=u.a_position,d=u.texBuffer,f=u.a_texCoords;if(Math.floor(i)!==t.uniformValue.u_kernel){var m=t.uniform.u_kernel;e.uniform1i(m,Math.floor(i))}if(c!==t.uniformValue.u_limit){var p=t.uniform.u_limit;e.uniform1i(p,c?1:0)}var g=Math.sin(a)*i/s,v=Math.cos(a)*i/o,y=Math.sin(a)*n/s,b=Math.cos(a)*n/o,x=t.uniform.u_velocity;e.uniform4f(x,v,g,b,y);for(var T=t.uniform.u_texture,w=r,k=Si(e,0,void 0,o,s),S=Si(e,0,void 0,o,s),E=0;E<3;E++)e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,[k,S,k][E],0),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),Ei(e,[w,k,S][E],0),e.uniform1i(T,0),e.drawArrays(e.TRIANGLE_STRIP,0,4);return e.deleteBuffer(l),e.deleteBuffer(d),e.disableVertexAttribArray(h),e.disableVertexAttribArray(f),e.deleteTexture(S),k}function Vi(e,t,r,i,a,n,o,s){var c=Ni(e,t),u=c.pointBuffer,l=c.a_position,h=c.texBuffer,d=c.a_texCoords,f=t.uniform.u_kernel;e.uniform1i(f,a);var m=t.uniform.u_center;e.uniform2f(m,n[0],n[1]);var p=t.uniform.u_ratio;e.uniform1f(p,i);for(var g=r,v=[],y=0;y<1;y++){var b=Si(e,0,void 0,o,s);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,b,0),Ei(e,g,0);var x=t.uniform.u_texture;e.uniform1i(x,0),e.drawArrays(e.TRIANGLE_STRIP,0,4),v.push(g),g=b}return e.deleteBuffer(u),e.deleteBuffer(h),e.disableVertexAttribArray(l),e.disableVertexAttribArray(d),v.forEach(function(t){t!==r&&e.deleteTexture(t)}),g}var Hi=Ui;function Xi(e,t,r,i){var a=Ni(e,t),n=a.pointBuffer,o=a.a_position,s=a.texBuffer,c=a.a_texCoords;Ei(e,r,0);var u=t.uniform.u_texture;e.uniform1i(u,0);var l=t.uniform["u_m[0]"];e.uniform1fv(l,new Float32Array(i)),e.drawArrays(e.TRIANGLE_STRIP,0,4),e.deleteBuffer(n),e.deleteBuffer(s),e.disableVertexAttribArray(o),e.disableVertexAttribArray(c)}function ji(e,t,r,i,a,n,o){var s=Ni(e,t),c=s.pointBuffer,u=s.a_position,l=s.texBuffer,h=s.a_texCoords,d=Math.sin(a)/o,f=Math.cos(a)/n,m=t.uniform.u_velocity;e.uniform2f(m,d,f);var p=Math.floor(i);if(p!==t.uniformValue.u_radius){var g=t.uniform.u_radius;e.uniform1i(g,p)}Ei(e,r,0);var v=t.uniform.u_texture;e.uniform1i(v,0),e.drawArrays(e.TRIANGLE_STRIP,0,4),e.deleteBuffer(c),e.deleteBuffer(l),e.disableVertexAttribArray(u),e.disableVertexAttribArray(h)}function Gi(e,t,r,i,a,n,o,s){return void 0===s&&(s=!0),i&&1!==i&&(e/=i,t/=i,r/=i),o&&(r/=-o),{x:(e=e===a?0:(e-a)/a)*i,y:(t=t===n?0:s?(n-t)/n:(t-n)/n)*i,z:r*i,w:i}}function Yi(e,t,r,i,a,n,o,s){void 0===i&&(i=0),void 0===a&&(a=0),void 0===o&&(o=0),void 0===s&&(s=0);var c=Tt(e[0]+i,e[1]+a,e[2]+i,e[3]+a,n),u=c.x1,l=c.y1,h=c.z1,d=c.w1,f=c.x2,m=c.y2,p=c.z2,g=c.w2,v=c.x3,y=c.y3,b=c.z3,x=c.w3,T=c.x4,w=c.y4,k=c.z4,S=c.w4,E=Math.max(h||0,p||0,b||0,k||0,Math.sqrt(t*t+r*r));return{t1:Gi(u+o,l+s,h||0,d||1,t,r,E),t2:Gi(f+o,m+s,p||0,g||1,t,r,E),t3:Gi(v+o,y+s,b||0,x||1,t,r,E),t4:Gi(T+o,w+s,k||0,S||1,t,r,E)}}var qi=new WeakMap,Ki=new WeakMap,$i=new WeakMap,Qi=new WeakMap,Zi=0,Ji=function(){function e(e,t,r,i){this.id=Zi++,this.gl=e,this.bbox=t.slice(0);var a=t[2],n=t[3];if(this.list=[],r)if(this.available=!0,r instanceof Ti){this.canvasCache=r;for(var o=r.list,s=r.w,c=r.h,u=o.length,l=(t[2]-t[0])/s,h=(t[3]-t[1])/c,d=0;d<u;d++){var f=o[d],m=Si(e,0,f.os.canvas);this.list.push({bbox:new Float32Array([f.x*l,f.y*h,Math.min(a,(f.x+f.w)*l),Math.min(n,(f.y+f.h)*h)]),w:f.w,h:f.h,t:m,tc:i})}}else{m=Si(e,0,r);r instanceof HTMLImageElement?(this.image=r,this.list.push({bbox:new Float32Array(t),w:r.width,h:r.height,t:m,tc:i})):r instanceof VideoFrame?(this.videoFrame=r,this.list.push({bbox:new Float32Array(t),w:r.codedWidth,h:r.codedHeight,t:m,tc:i})):r instanceof HTMLCanvasElement&&(this.canvas=r,this.list.push({bbox:new Float32Array(t),w:r.width,h:r.height,t:m,tc:i}))}else this.available=!1}return e.prototype.release=function(){var e=this;return this.image?this.releaseImg(this.image):this.videoFrame?this.releaseVideoFrame(this.videoFrame):this.canvasCache?this.releaseCanvasCache(this.canvasCache):!!this.available&&(this.available=!1,this.list.splice(0).forEach(function(t){t.t&&e.gl.deleteTexture(t.t)}),!0)},e.prototype.releaseImg=function(e){var t=this;if(!this.available)return!1;this.available=!1;var r=Ki.get(e);return!!r&&(r.count--,r.count||(Ki.delete(e),this.list.splice(0).forEach(function(e){e.t&&t.gl.deleteTexture(e.t)})),!0)},e.prototype.releaseVideoFrame=function(e){var t=this;if(!this.available)return!1;this.available=!1;var r=$i.get(e);return!!r&&(r.count--,r.count||($i.delete(e),this.list.splice(0).forEach(function(e){e.t&&t.gl.deleteTexture(e.t)})),!0)},e.prototype.releaseCanvasCache=function(e){var t=this;if(!this.available)return!1;this.available=!1;var r=qi.get(e);return!!r&&(r.count--,r.count||(qi.delete(e),this.list.splice(0).forEach(function(e){e.t&&t.gl.deleteTexture(e.t)})),!0)},e.hasCanvasCacheInstance=function(e){return qi.has(e)},e.getCanvasCacheInstance=function(t,r,i){var a=qi.get(r);if(a){a.count++;var n=new e(t,i);n.available=!0,n.canvasCache=r;for(var o=i[2]-i[0],s=i[3]-i[1],c=o/a.w,u=s/a.h,l=i[2],h=i[3],d=a.value,f=d.length,m=0;m<f;m++){var p=d[m];n.list.push({bbox:new Float32Array([p.x*c,p.y*u,Math.min(l,(p.x+p.w)*c),Math.min(h,(p.y+p.h)*u)]),w:p.w,h:p.h,t:p.t})}return n}var g=new e(t,i,r);return qi.set(r,{value:g.list.map(function(e,t){return{x:r.list[t].x,y:r.list[t].y,w:e.w,h:e.h,t:e.t}}),w:r.w,h:r.h,count:1}),g},e.hasImageCache=function(e){return Ki.has(e)},e.getImgInstance=function(t,r,i,a){var n=Ki.get(r);if(n){n.count++;var o=new e(t,i);return o.available=!0,o.image=r,o.list=[{bbox:i.slice(0),w:r.width,h:r.height,t:n.t,tc:a}],o}var s=new e(t,i,r,a);return Ki.set(r,{t:s.list[0].t,count:1}),s},e.hasVideoFrameInstance=function(e){return $i.has(e)},e.getVideoFrameInstance=function(t,r,i,a){var n=$i.get(r);if(n){n.count++;var o=new e(t,i);return o.available=!0,o.videoFrame=r,o.list=[{bbox:i.slice(0),w:r.codedWidth,h:r.codedHeight,t:n.t,tc:a}],o}var s=new e(t,i,r,a);return $i.set(r,{t:s.list[0].t,count:1}),s},e.getCanvasInstance=function(t,r,i,a){var n=Qi.get(r);if(n){n.count++;var o=new e(t,i);return o.available=!0,o.canvas=r,o.list=[{bbox:i.slice(0),w:r.width,h:r.height,t:n.t,tc:a}],o}var s=new e(t,i,r,a);return Qi.set(r,{t:s.list[0].t,count:1}),s},e.getEmptyInstance=function(t,r){return new e(t,r)},e}(),ea=.1,ta="function"==typeof Float32Array;function ra(e,t){return 1-3*t+3*e}function ia(e,t){return 3*t-6*e}function aa(e){return 3*e}function na(e,t,r){return((ra(t,r)*e+ia(t,r))*e+aa(t))*e}function oa(e,t,r){return 3*ra(t,r)*e*e+2*ia(t,r)*e+aa(t)}function sa(e){return e}function ca(e,t,r,i){if(!(0<=e&&e<=1&&0<=r&&r<=1))throw new Error("bezier x values must be in [0, 1] range");if(e===t&&r===i)return sa;for(var a=ta?new Float32Array(11):new Array(11),n=0;n<11;++n)a[n]=na(n*ea,e,r);function o(t){for(var i=0,n=1;10!==n&&a[n]<=t;++n)i+=ea;--n;var o=i+(t-a[n])/(a[n+1]-a[n])*ea,s=oa(o,e,r);return s>=.001?function(e,t,r,i){for(var a=0;a<4;++a){var n=oa(t,r,i);if(0===n)return t;t-=(na(t,r,i)-e)/n}return t}(t,o,e,r):0===s?o:function(e,t,r,i,a){var n,o,s=0;do{(n=na(o=t+(r-t)/2,i,a)-e)>0?r=o:t=o}while(Math.abs(n)>1e-7&&++s<10);return o}(t,i,i+ea,e,r)}return function(e){return 0===e||1===e?e:na(o(e),t,i)}}var ua={linear:ca(1,1,0,0),easeIn:ca(.42,0,1,1),easeOut:ca(0,0,.58,1),ease:ca(.25,.1,.25,1),easeInOut:ca(.42,0,.58,1),cubicBezier:ca,getEasing:function(e,t,r,i){if(4===arguments.length)return ca(e,t,r,i);if(Array.isArray(e)&&4===e.length)return ca(e[0],e[1],e[2],e[3]);if(e){var a=e.toString(),n=void 0;if(/^\s*(?:cubic-bezier\s*)?\(\s*[\d.]+\s*,\s*[-\d.]+\s*,\s*[\d.]+\s*,\s*[-\d.]+\s*\)\s*$/i.test(a)){var o=a.match(/[\d.]+/g);n=ca(parseFloat(o[0]),parseFloat(o[1]),parseFloat(o[2]),parseFloat(o[3]))}return n}}},la="frame",ha="begin",da={FRAME:la,BEGIN:ha,END:"end"},fa=function(e){function r(t,r){var i=e.call(this)||this;return i.node=t,i.duration=r.duration||0,i.direction=r.direction||"forwards",i.fill=r.fill||"none",i.delay=Math.max(0,r.delay||0),i.endDelay=Math.max(0,r.endDelay||0),r.easing&&(v(r.easing)?i.easing=r.easing:Array.isArray(r.easing)?i.easing=ua.getEasing(r.easing):i.easing=ua[r.easing]),i.iterations=r.iterations||1,i.playbackRate=r.playbackRate||1,i._currentTime=0,i.time=0,i._playCount=r.iterationStart||0,i._playState="idle",i.isBegin=0===i._playCount&&!i.delay,i.isEnd=!1,i.isFirstInDelay=!0,i}return t(r,e),r.prototype.play=function(){var e,t=this._playState;"running"!==t&&("finished"!==t&&"idle"!==t||(this._playCount=0,this._currentTime=0,this.time=0,this.isBegin=!this.delay,this.isEnd=!1,this.isFirstInDelay=!0),this._playState="running",null===(e=this.node.root)||void 0===e||e.addAnimation(this))},r.prototype.pause=function(){var e;"paused"!==this._playState&&(this._playState="paused",null===(e=this.node.root)||void 0===e||e.removeAnimation(this))},r.prototype.resume=function(){var e;"paused"===this._playState&&(this._playState="running",null===(e=this.node.root)||void 0===e||e.addAnimation(this))},r.prototype.finish=function(){var e;"finished"!==this._playState&&(this._playCount=this.iterations,this._currentTime=this.delay+this.duration*this._playCount+this.endDelay,this.time=this.duration+this.endDelay,this._playState="finished",null===(e=this.node.root)||void 0===e||e.removeAnimation(this))},r.prototype.cancel=function(){var e;"idle"!==this._playState&&(this._playCount=0,this._currentTime=0,this.time=0,this._playState="idle",null===(e=this.node.root)||void 0===e||e.removeAnimation(this))},r.prototype.remove=function(){var e;this.cancel();var t=this.node.animationList,r=t.indexOf(this);r>-1&&t.splice(r,1),null===(e=this.node.root)||void 0===e||e.aniController.removeAni(this)},r.prototype.gotoAndPlay=function(e){if(this._currentTime!==e||"running"!==this._playState){this.play();var t=this._currentTime;this.currentTime=e,this.onRunning(0,t)}},r.prototype.gotoAndStop=function(e){if(this._currentTime!==e||"paused"!==this._playState){this.pause();var t=this._currentTime;this.currentTime=e,this.onRunning(0,t)}},r.prototype.onRunning=function(e,t){var r=this,i=r.playbackRate,a=r.delay,n=r.endDelay,o=r.duration,s=r.iterations;i>0&&1!==i&&(e*=i),t=null!=t?t:this._currentTime;var c=this._currentTime+=e;if(a&&c<a)this.isFirstInDelay&&this.onFirstInDelay();else{this.isFirstInDelay=!1,a&&t<a&&c>=a&&(this.isBegin=!0),c-=a;var u=Math.min(s-1,Math.floor(c/o));c-=o*u,this.time=c,this._playCount<u&&(this._playCount=u,this.onChangePlayCount(),this.isBegin=!0),this._playCount>=s-1&&(t-=a,t-=o*u,n&&t<o&&c>=o&&c<o+n&&this.onFirstInEndDelay(),t<o&&c>=o&&(this.isEnd=!0),c>=o+n&&this.finish())}},r.prototype.afterRunning=function(){this.emit(la),this.isFirstInDelay&&(this.isFirstInDelay=!1),this.isBegin&&(this.isBegin=!1,this.emit(ha,this._playCount,this.time)),this.isEnd&&(this.isEnd=!1,this.emit("end"))},Object.defineProperty(r.prototype,"currentTime",{get:function(){return this._currentTime},set:function(e){var t=this._currentTime;if(e!==t){var r=this.delay;this._currentTime=e;var i=t-r;this.time=i%this.duration,e<=r&&(this.isBegin=!0),t>=r&&e<r&&(this.isFirstInDelay=!0)}},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"playCount",{get:function(){return this._playCount},set:function(e){if(e!==this._playCount){var t=this._currentTime,r=this.delay;if(t>=r){var i=(t-r)%this.duration;this.currentTime=i+r+e*this.duration,this.time=i}this._playCount=e}},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"playState",{get:function(){return this._playState},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"pending",{get:function(){return"running"!==this._playState},enumerable:!1,configurable:!0}),r}(M),ma=function(e){function r(t,r,i){var a=e.call(this,t,i)||this;return a._keyFrames=[],a._keyFramesR=[],a.currentKeyFrames=a._keyFrames,a.originStyle={},a.initKeyFrames(r),a.setCurrentFrames(),a}return t(r,e),r.prototype.initKeyFrames=function(e){var t=function(e,t,r,i){for(var a=[],n=0,o=0,s=t.length;o<s;o++){var c=t[o];if(y(c.offset)){var u=c.offset;if(u<0||u>1)continue;if(u<=n&&o)continue;n=u}a.push(Object.assign({},c))}if(1===a.length){a.push(Object.assign({},a[0]));var l=Object.assign({},a[0]);1===a[0].offset?(l.offset=0,a.unshift(l)):(l.offset=1,a.push(l))}var h=a[0];h.offset&&h.offset>0?a.unshift({offset:0}):h.offset=0;var d=a[a.length-1];d.offset&&d.offset<1?a.push({offset:1}):d.offset=1;for(o=1,s=a.length;o<s;o++){c=a[o];if(!y(c.offset)){for(var f=void 0,m=o+1;m<s&&!(f=a[m]).offset;m++);for(var p=m-o+1,b=a[o-1],x=(f.offset-b.offset)/p,T=o;T<m;T++)a[T].offset=b.offset+x*(T+1-o);o=m}}var w=[],k={},S=[];for(o=0,s=a.length;o<s;o++){c=a[o];var E=li.normalize(c);Object.keys(E).forEach(function(e){k.hasOwnProperty(e)||(k[e]=!0,S.push(e))});var C={style:E,time:c.offset*r,easing:i,transition:[],fixed:[]};c.easing&&(v(c.easing)?C.easing=c.easing:Array.isArray(c.easing)?C.easing=ua.getEasing(c.easing):g(c.easing)&&(C.easing=ua[c.easing])),w.push(C)}w.forEach(function(t){var r=t.style;S.forEach(function(t){r.hasOwnProperty(t)||Object.assign(r,ti(e.style,[t]))})});var A=w.map(function(e){return Object.assign({},e,{transition:[],fixed:[]})}).reverse();A.forEach(function(e){e.time=r-e.time});var _=ti(e.style,S);return{keys:S,keyFrames:w,keyFramesR:A,originStyle:_}}(this.node,e,this.duration,this.easing),r=t.keys,i=t.keyFrames,a=t.keyFramesR,n=t.originStyle;this._keyFrames=i,this._keyFramesR=a,pa(this.node,this._keyFrames,r),pa(this.node,this._keyFramesR,r),this.originStyle=n},r.prototype.finish=function(){"finished"!==this._playState&&(e.prototype.finish.call(this),this.onFirstInEndDelay())},r.prototype.cancel=function(){"idle"!==this._playState&&(e.prototype.cancel.call(this),this.node.updateFormatStyle(this.originStyle))},r.prototype.setCurrentFrames=function(){var e=this,t=e.direction,r=e._keyFrames,i=e._keyFramesR,a=e._playCount;this.currentKeyFrames="backwards"===t?i:"alternate"===t?a%2==0?r:i:"alternateReverse"===t&&a%2==0?i:r},r.prototype.onRunning=function(t,r){e.prototype.onRunning.call(this,t,r);var i=this,a=i.duration,n=i.delay,o=i.iterations,s=i.time;if(!(this._currentTime<n)){var c,u=this._playCount>=o-1,l=this.currentKeyFrames,h=l.length;c=2===h?s<a?0:1:function(e,t,r,i){for(;e<t;){if(e===t-1)return i[t].time<=r?t:e;var a=e+(t-e>>1),n=i[a].time;if(n===r)return a;n>r?t=Math.max(a-1,e):e=Math.min(a,t)}return e}(0,h-1,s,l);var d=l[c],f=u&&c===h-1,m=0;if(f);else if(2===h)m=s/a;else{var p=d.time,g=l[c+1].time-p;m=(s-p)/g}if(f);else{d.easing?m=d.easing(m):this.easing&&(m=this.easing(m));var v=d.transition,y=d.fixed,b=d.style,x={};v.forEach(function(e){var t=e.key,r=e.diff;if("opacity"===t||"translateX"===t||"translateY"===t||"translateZ"===t||"scaleX"===t||"scaleY"===t||"rotateX"===t||"rotateY"===t||"rotateZ"===t||"perspective"===t||"perspectiveSelf"===t)(a=Object.assign({},b[t])).v+=r*m,x[t]=a;else if("transformOrigin"===t||"perspectiveOrigin"===t){var i=b[t];(a=[Object.assign({},i[0]),Object.assign({},i[1])])[0].v+=r[0]*m,a[1].v+=r[1]*m,x[t]=a}else if("filter"===t){var a;(a=ti(b,t).filter).forEach(function(e,t){var i=r[t];i&&(e.u===V.GAUSS_BLUR&&(e.v.radius.v+=i.radius*m),e.u===V.RADIAL_BLUR?(e.v.radius.v+=i.radius*m,e.v.center[0].v+=i.center[0]*m,e.v.center[1].v+=i.center[1]*m):e.u===V.MOTION_BLUR?(e.v.radius.v+=i.radius*m,e.v.angle.v+=i.angle*m,e.v.offset.v+=i.offset*m):e.u===V.BLOOM?(e.v.threshold.v+=i.threshold*m,e.v.knee.v+=i.knee*m):e.u===V.LIGHT_DARK?(e.v.radius.v+=i.radius*m,e.v.angle.v+=i.angle*m):e.u!==V.HUE_ROTATE&&e.u!==V.SATURATE&&e.u!==V.BRIGHTNESS&&e.u!==V.CONTRAST&&e.u!==V.SEPIA||(e.v.radius.v+=i.radius*m))}),x[t]=a}}),y.forEach(function(e){x[e]=Object.assign({},b[e])}),this.node.updateFormatStyle(x)}}},r.prototype.onFirstInDelay=function(){var e=this.fill,t=this.node;"backwards"===e||"both"===e?t.updateFormatStyle(this.currentKeyFrames[0].style):t.updateFormatStyle(this.originStyle)},r.prototype.onFirstInEndDelay=function(){var e=this.fill,t=this.node;if("forwards"===e||"both"===e){var r=this.currentKeyFrames;t.updateFormatStyle(r[r.length-1].style)}else t.updateFormatStyle(this.originStyle)},r.prototype.onChangePlayCount=function(){this.setCurrentFrames()},r}(fa);function pa(e,t,r){for(var i=function(i,a){var n=t[i-1],o=t[i],s=n.style,c=o.style;r.forEach(function(t){var r=s[t],a=c[t];if("opacity"===t||"scaleX"===t||"scaleY"===t||"rotateX"===t||"rotateY"===t||"rotateZ"===t)n.transition.push({key:t,diff:a.v-r.v});else if("translateX"===t||"translateY"===t||"translateZ"===t||"perspective"===t||"perspectiveSelf"===t)if(r.u===a.u)n.transition.push({key:t,diff:a.v-r.v});else{var u=0;"translateX"===t||"translateZ"===t||"perspective"===t||"perspectiveSelf"===t?u=e.computedStyle.width:"translateY"===t&&(u=e.computedStyle.height),n.transition.push({key:t,diff:ga(r,a,u)})}else if("transformOrigin"===t||"perspectiveOrigin"===t){for(var l=r,h=a,d=[0,0],f=0;f<2;f++)if(l[f].u===h[f].u)d.push(h[f].v-l[f].v);else{u=f?e.computedStyle.height:e.computedStyle.width;n.transition.push({key:t,diff:ga(h[f],l[f],u)})}n.transition.push({key:t,diff:d})}else if("visibility"===t||"overflow"===t)o.fixed.push(t),1===i&&n.fixed.push(t);else if("filter"===t){for(var m=r,p=a,g=!0,v=0,y=Math.min(m.length,p.length);v<y;v++)if(m[v].u!==p[v].u){g=!1;break}if(g){d=[];for(var b=0,x=Math.min(m.length,p.length);b<x;b++){var T=m[b],w=p[b],k={};T.u===V.GAUSS_BLUR?k.radius=w.v.radius.v-T.v.radius.v:T.u===V.RADIAL_BLUR?(k.radius=w.v.radius.v-T.v.radius.v,k.center=[ga(w.v.center[0],T.v.center[0],e.computedStyle.width),ga(w.v.center[1],T.v.center[1],e.computedStyle.height)]):T.u===V.MOTION_BLUR?(k.radius=w.v.radius.v-T.v.radius.v,k.angle=w.v.angle.v-T.v.angle.v,k.offset=w.v.offset.v-T.v.offset.v):T.u===V.BLOOM?(k.threshold=w.v.threshold.v-T.v.threshold.v,k.knee=w.v.knee.v-T.v.knee.v):T.u===V.LIGHT_DARK?(k.radius=w.v.radius.v-T.v.radius.v,k.angle=w.v.angle.v-T.v.angle.v):T.u!==V.HUE_ROTATE&&T.u!==V.SATURATE&&T.u!==V.BRIGHTNESS&&T.u!==V.CONTRAST&&T.u!==V.SEPIA||(k.radius=w.v.radius.v-T.v.radius.v),d.push(k)}n.transition.push({key:t,diff:d})}else o.fixed.push(t),1===i&&n.fixed.push(t)}})},a=1,n=t.length;a<n;a++)i(a)}function ga(e,t,r){if(e.u===V.PX){if(t.u===V.PERCENT)return.01*t.v*r-e.v}else if(e.u===V.PERCENT&&t.u===V.PX)return 100*t.v/r-e.v;return 0}function va(e){return e.map(function(e){if(Array.isArray(e.v))return e.v.slice(0);var t=e.v;return{t:t.t,d:t.d.slice(0),stops:t.stops.map(function(e){var t=e.offset?.01*e.offset.v:void 0;return{color:e.color.v.slice(0),offset:t}})}})}function ya(e,t,r){return e.map(function(e){var i=e.v,a=e.u;if(a===V.GAUSS_BLUR)return{radius:n=i.radius.u===V.PERCENT?i.radius.v*t*.01:i.radius.v,u:a};if(a===V.RADIAL_BLUR){var n=i.radius.u===V.PERCENT?i.radius.v*t*.01:i.radius.v,o=i.center.map(function(e,i){return e.u===V.PERCENT?e.v*(i?r:t)*.01:e.v});return{radius:n,center:o,u:a}}return a===V.MOTION_BLUR?{radius:n=i.radius.u===V.PERCENT?i.radius.v*t*.01:i.radius.v,angle:i.angle.v,offset:i.offset.v,u:a}:a===V.BLOOM?{threshold:i.threshold.v,knee:i.knee.v,u:a}:a===V.LIGHT_DARK?{radius:i.radius.v,angle:i.angle.v,u:a}:a===V.HUE_ROTATE||a===V.SATURATE||a===V.BRIGHTNESS||a===V.CONTRAST||a===V.SEPIA?{radius:i.radius.v,u:a}:void 0})}function ba(e,t,r,i){if(void 0===r&&(r=0),void 0===i&&(i=0),t&&t.length){for(var a=-1,n=0,o=t.length;n<o;n++){var s=t[n];if(Array.isArray(s)&&s.length){a=n;break}}if(-1!==a){var c=t[a];4===c.length?e.moveTo(c[2]+r,c[3]+i):6===c.length?e.moveTo(c[4]+r,c[5]+i):e.moveTo(c[0]+r,c[1]+i);for(n=a+1,o=t.length;n<o;n++){s=t[n];Array.isArray(s)&&(2===s.length?e.lineTo(s[0]+r,s[1]+i):4===s.length?e.quadraticCurveTo(s[0]+r,s[1]+i,s[2]+r,s[3]+i):6===s.length&&e.bezierCurveTo(s[0]+r,s[1]+i,s[2]+r,s[3]+i,s[4]+r,s[5]+i))}}}}function xa(e){switch(e){case j.MULTIPLY:return"multiply";case j.SCREEN:return"screen";case j.OVERLAY:return"overlay";case j.DARKEN:return"darken";case j.LIGHTEN:return"lighten";case j.COLOR_DODGE:return"color-dodge";case j.COLOR_BURN:return"color-burn";case j.HARD_LIGHT:return"hard-light";case j.SOFT_LIGHT:return"soft-light";case j.DIFFERENCE:return"difference";case j.EXCLUSION:return"exclusion";case j.HUE:return"hue";case j.SATURATION:return"saturation";case j.COLOR:return"color";case j.LUMINOSITY:return"luminosity";default:return"source-over"}}var Ta,wa=0,ka=function(e){function r(t){var r,i=e.call(this)||this;return i.id=wa++,i.props=t,i.uuid=t.uuid||(l.randomUUID&&!r?l.randomUUID():h(r)),i.name=t.name,i.isLocked=!!t.isLocked,i.style=Gr(R(t.style)),i.computedStyle={},i.struct={node:i,num:0,total:0,lv:0,next:0},i.isMounted=!1,i.isDestroyed=!1,i.refreshLevel=ui.REFLOW,i._opacity=0,i.hasCacheOp=!1,i.localOpId=0,i.parentOpId=0,i.transform=at(),i.matrix=at(),i._matrixWorld=at(),i.hasCacheMw=!1,i.localMwId=0,i.parentMwId=0,i.hasContent=!1,i.animationList=[],i.contentLoadingNum=0,i.tempOpacity=1,i.tempMatrix=at(),i}return t(r,e),r.prototype.didMount=function(){var e=this;this.isMounted=!0;var t=this.parent;if(t){this.parentOpId=t.localOpId,this.parentMwId=t.localMwId;var r=this.root=t.root,i=this.uuid;r&&i&&(r.refs[i]=this),this.animationList.forEach(function(t){e.root.aniController.addAni(t)})}},r.prototype.didUnmount=function(){this.clearTexCache(!0),this.isMounted=!1;var e=this.root,t=this.uuid;e&&t&&delete e.refs[t],this.animationList.forEach(function(t){t.cancel(),e.aniController.removeAni(t)}),this.prev=this.next=void 0,this.parent=this.root=void 0},r.prototype.structure=function(e){var t=this.struct;return t.lv=e,[t]},r.prototype.lay=function(e){var t=this.style,r=this.computedStyle,i=t.left,a=t.top,n=t.right,o=t.bottom,s=t.width,c=t.height,u=!1,l=!1,h=!1,d=!1;i.u!==V.AUTO&&(u=!0,r.left=ri(i,e.w)),n.u!==V.AUTO&&(h=!0,r.right=ri(n,e.w)),a.u!==V.AUTO&&(l=!0,r.top=ri(a,e.h)),o.u!==V.AUTO&&(d=!0,r.bottom=ri(o,e.h)),u&&h?r.width=Math.max(0,e.w-r.left-r.right):u?(s.u!==V.AUTO?r.width=Math.max(0,ri(s,e.w)):r.width=0,r.right=e.w-r.left-r.width):h?(s.u!==V.AUTO?r.width=Math.max(0,ri(s,e.w)):r.width=0,r.left=e.w-r.right-r.width):(s.u!==V.AUTO?r.width=Math.max(0,ri(s,e.w)):r.width=0,r.left=0,r.right=e.w-r.width),l&&d?r.height=Math.max(0,e.h-r.top-r.bottom):l?(c.u!==V.AUTO?r.height=Math.max(0,ri(c,e.h)):r.height=0,r.bottom=e.h-r.top-r.height):d?(c.u!==V.AUTO?r.height=Math.max(0,ri(c,e.h)):r.height=0,r.top=e.h-r.bottom-r.height):(c.u!==V.AUTO?r.height=Math.max(0,ri(c,e.h)):r.height=0,r.top=0,r.bottom=e.h-r.height)},r.prototype.layout=function(e){if(this.isDestroyed)throw new Error("Node is destroyed");this.refreshLevel=ui.REFLOW,this.calReflowStyle(),this.lay(e),this.calRepaintStyle(ui.REFLOW),this._rect=void 0},r.prototype.calReflowStyle=function(){var e=this,t=e.style,r=e.computedStyle,i=e.parent;r.fontFamily=t.fontFamily.v,r.fontSize=t.fontSize.v,r.fontWeight=t.fontWeight.v,r.fontStyle=t.fontStyle.v;var a=t.lineHeight;a.u===V.AUTO?r.lineHeight=Kr(r):r.lineHeight=a.v,r.width=r.height=0;var n=t.width,o=t.height;i?(n.u!==V.AUTO&&(r.width=Math.max(0,ri(n,i.width))),o.u!==V.AUTO&&(r.height=Math.max(0,ri(o,i.height)))):(n.u===V.PX&&(r.width=Math.max(0,n.v)),o.u===V.PX&&(r.height=Math.max(0,o.v))),r.letterSpacing=t.letterSpacing.v,r.paragraphSpacing=t.paragraphSpacing.v,r.textAlign=t.textAlign.v,r.textVerticalAlign=t.textVerticalAlign.v},r.prototype.calRepaintStyle=function(e){var t=this.style,r=this.computedStyle;r.visibility=t.visibility.v,r.textDecoration=t.textDecoration.map(function(e){return e.v}),r.textShadow=t.textShadow.v,r.color=t.color.v,r.backgroundColor=t.backgroundColor.v,r.fill=t.fill.map(function(e){if(Array.isArray(e.v))return e.v.slice(0);var t=e.v;return{t:t.t,d:t.d.slice(0),stops:t.stops.map(function(e){var t=.01*e.offset.v;return{color:e.color.v.slice(0),offset:t}})}}),r.fillEnable=t.fillEnable.map(function(e){return e.v}),r.fillOpacity=t.fillOpacity.map(function(e){return e.v}),r.fillMode=t.fillMode.map(function(e){return e.v}),r.fillRule=t.fillRule.v,r.stroke=va(t.stroke),r.strokeEnable=t.strokeEnable.map(function(e){return e.v}),r.strokeWidth=t.strokeWidth.map(function(e){return e.v}),r.strokePosition=t.strokePosition.map(function(e){return e.v}),r.strokeMode=t.strokeMode.map(function(e){return e.v}),r.strokeDasharray=t.strokeDasharray.map(function(e){return e.v}),r.strokeLinecap=t.strokeLinecap.v,r.strokeLinejoin=t.strokeLinejoin.v,r.strokeMiterlimit=t.strokeMiterlimit.v,r.mixBlendMode=t.mixBlendMode.v,r.pointerEvents=t.pointerEvents.v,r.objectFit=t.objectFit.v,r.borderTopLeftRadius=t.borderTopLeftRadius.v,r.borderTopRightRadius=t.borderTopRightRadius.v,r.borderBottomLeftRadius=t.borderBottomLeftRadius.v,r.borderBottomRightRadius=t.borderBottomRightRadius.v,r.overflow=t.overflow.v,this.clearTexCache(!0),e&ui.REFLOW_TRANSFORM&&this.calMatrix(e),e&ui.REFLOW_PERSPECTIVE&&this.calPerspective(),e&ui.REFLOW_PERSPECTIVE_SELF&&this.calPerspectiveSelf(),e&ui.REFLOW_OPACITY&&this.calOpacity(),e&ui.REFLOW_FILTER&&this.calFilter(e),e&ui.REFLOW_REPAINT_MASK&&this.calMask(),this._bbox=void 0,this._bboxInt=void 0,this._filterBbox=void 0,this._filterBboxInt=void 0,this.tempBbox=void 0},r.prototype.calMask=function(){var e=this.style,t=this.computedStyle;t.maskMode=e.maskMode.v,t.breakMask=e.breakMask.v;var r=this.prev;if(r&&!t.breakMask&&(r.computedStyle.maskMode?this.mask=r:r.mask&&(this.mask=r.mask)),t.maskMode){this.mask=void 0;for(var i=this.next;i;){if(i.computedStyle.maskMode){i.mask=this;break}if(i.computedStyle.breakMask)break;i.mask=this,i=i.next}}else{var a=t.breakMask?void 0:this.mask;this.mask=a;for(i=this.next;i;){if(i.computedStyle.maskMode){i.mask=a;break}if(i.computedStyle.breakMask)break;i.mask=a,i=i.next}}this.clearMask()},r.prototype.calFilter=function(e){var t,r=this.style,i=this.computedStyle;i.filter=ya(r.filter,i.width,i.height),e<ui.REPAINT&&(this._filterBbox=void 0,this._filterBboxInt=void 0,this.tempBbox=void 0,null===(t=this.textureFilter)||void 0===t||t.release(),this.resetTextureTarget())},r.prototype.calMatrix=function(e){var t=this,r=this,i=r.style,a=r.computedStyle,n=r.matrix,o=r.transform;!this.hasCacheMw&&this.localMwId||(this.hasCacheMw=!1,this.localMwId++);var s=!0;if((e>=ui.REFLOW||e&ui.SCALE_X&&!a.scaleX||e&ui.SCALE_Y&&!a.scaleY||e&ui.ROTATE_Z&&(a.rotateX||a.rotateY||a.skewX||a.skewY)||e&ui.ROTATE_X||e&ui.ROTATE_Y)&&(s=!1),s){if(e&ui.TRANSLATE_X){var c=(u=ri(i.translateX,this.computedStyle.width))-a.translateX;a.translateX=u,o[12]+=c,n[12]+=c}if(e&ui.TRANSLATE_Y){c=(u=ri(i.translateY,this.computedStyle.height))-a.translateY;a.translateY=u,o[13]+=c,n[13]+=c}if(e&ui.ROTATE_Z){var u=i.rotateZ.v;a.rotateZ=u;var l=fr(u),h=Math.sin(l),d=Math.cos(l),f=a.scaleX,m=a.scaleY;n[0]=o[0]=d*f,n[1]=o[1]=h*m,n[4]=o[4]=-h*f,n[5]=o[5]=d*m;var p=(y=a.transformOrigin)[0],g=y[1];n[12]=o[12]+p-o[0]*p-g*o[4],n[13]=o[13]+g-o[1]*p-g*o[5]}if(e&ui.SCALE){if(e&ui.SCALE_X){f=(u=i.scaleX.v)/a.scaleX;a.scaleX=u,o[0]*=f,o[4]*=f,n[0]*=f,n[4]*=f}if(e&ui.SCALE_Y){m=(u=i.scaleY.v)/a.scaleY;a.scaleY=u,o[1]*=m,o[5]*=m,n[1]*=m,n[5]*=m}p=(y=a.transformOrigin)[0],g=y[1];n[12]=o[12]+p-o[0]*p-o[4]*g,n[13]=o[13]+g-o[1]*p-o[5]*g,n[14]=o[14]-o[2]*p-o[6]*g}if(e&ui.TRANSFORM_ORIGIN){var v=i.transformOrigin.map(function(e,r){return ri(e,r?t.computedStyle.height:t.computedStyle.width)});ut(n,y=_r(o,v[0],v[1]))}}else{st(o);v=i.transformOrigin.map(function(e,r){return ri(e,r?t.computedStyle.height:t.computedStyle.width)});a.transformOrigin=v,a.translateX=ri(i.translateX,this.computedStyle.width),a.translateY=ri(i.translateY,this.computedStyle.height),a.translateZ=ri(i.translateZ,this.computedStyle.width);var y,b=i.rotateX?i.rotateX.v:0,x=i.rotateY?i.rotateY.v:0,T=i.rotateZ?i.rotateZ.v:0,w=i.skewX?i.skewX.v:0,k=i.skewY?i.skewY.v:0,S=i.scaleX?i.scaleX.v:1,E=i.scaleY?i.scaleY.v:1;a.rotateX=b,a.rotateY=x,a.rotateZ=T,a.skewX=w,a.skewY=k,a.scaleX=S,a.scaleY=E,Ir({translateX:a.left+a.translateX,translateY:a.top+a.translateY,translateZ:a.translateZ,rotateX:b,rotateY:x,rotateZ:T,skewX:w,skewY:k,scaleX:S,scaleY:E},o),ut(n,y=_r(o,v[0],v[1]))}},r.prototype.calPerspective=function(){var e=this,t=this.style,r=this.computedStyle;!this.hasCacheMw&&this.localMwId||(this.hasCacheMw=!1,this.localMwId++);var i=t.perspectiveOrigin.map(function(t,r){return ri(t,r?e.computedStyle.height:e.computedStyle.width)});r.perspectiveOrigin=i,r.perspective=ri(t.perspective,this.computedStyle.width),r.perspective>=1?this.perspectiveMatrix=Mr(r.perspective,i[0],i[1]):this.perspectiveMatrix=void 0},r.prototype.calPerspectiveSelf=function(){var e=this,t=e.style,r=e.computedStyle,i=e.transform;if(!this.hasCacheMw&&this.localMwId||(this.hasCacheMw=!1,this.localMwId++),r.perspectiveSelf=ri(t.perspectiveSelf,this.computedStyle.width),r.perspectiveSelf>=1){var a=r.transformOrigin;this.perspectiveMatrixSelf=Mr(r.perspectiveSelf,a[0]+i[12],a[1]+i[13])}else this.perspectiveMatrixSelf=void 0},r.prototype.calOpacity=function(){var e=this.style,t=this.computedStyle;!this.hasCacheOp&&this.localOpId||(this.hasCacheOp=!1,this.localOpId++),t.opacity=e.opacity.v},r.prototype.calContent=function(){var e=this.computedStyle;return this.hasContent=e.backgroundColor[3]>0,this.hasContent},r.prototype.calContentLoading=function(){var e=this.computedStyle;return e.width&&e.height?this.contentLoadingNum:0},r.prototype.renderCanvas=function(){var e=this.canvasCache;if(e&&e.available&&e.release(),this.hasContent){var t=this._bboxInt||this.bboxInt,r=t[0],i=t[1],a=t[2]-r,n=t[3]-i;(e=this.canvasCache=new Ti(a,n,-r,-i)).available=!0,this.renderCanvasBgc(e)}},r.prototype.renderCanvasBgc=function(e){var t=this.computedStyle.backgroundColor;if(t[3]>0){var r=this.getBackgroundCoords(-e.dx,-e.dy);e.list.forEach(function(e){var i=e.x,a=e.y,n=e.os.ctx;n.fillStyle=fe(t),n.beginPath(),ba(n,r,-i,-a),n.closePath(),n.fill()})}},r.prototype.renderFillStroke=function(e,t,r){var i;if(void 0===t&&(t=!0),void 0===r&&(r=this.computedStyle),e.length){var a=this._bboxInt||this.bboxInt,n=a[0],o=a[1],s=a[2]-n,c=a[3]-o,u=-n,l=-o,h=r.fill,d=r.fillOpacity,f=r.fillRule,m=r.fillEnable,p=r.fillMode,g=r.stroke,v=r.strokeEnable,y=r.strokeWidth,b=r.strokePosition,x=r.strokeMode,T=r.strokeDasharray,w=r.strokeLinecap,k=r.strokeLinejoin,S=r.strokeMiterlimit,E=(null===(i=this.canvasCache)||void 0===i?void 0:i.available)?this.canvasCache:new Ti(s,c,u,l);E.available=!0;for(var C=E.list,A=function(r,i){var a=C[r],n=a.x,o=a.y,E=a.os.ctx,A=-n,_=-o;E.setLineDash(T),E.beginPath(),e.forEach(function(e){ba(E,e,A,_)}),t&&E.closePath();for(var M=function(r,i){if(!m[r]||!d[r])return"continue";var a=h[r],n=void 0,o=p[r];if(E.globalAlpha=d[r],Array.isArray(a)){if(a[3]<=0)return"continue";E.fillStyle=fe(a)}else if(a.t===Y.LINEAR){var g=Hr(a.stops,a.d,0,0,s-2*u,c-2*l),v=E.createLinearGradient(g.x1+A,g.y1+_,g.x2+A,g.y2+_);g.stop.forEach(function(e){v.addColorStop(e.offset,fe(e.color))}),E.fillStyle=v}else if(a.t===Y.RADIAL){g=Xr(a.stops,a.d,0,0,s-2*u,c-2*l);var y=E.createRadialGradient(g.cx+A,g.cy+_,0,g.cx+A,g.cy+_,g.total);g.stop.forEach(function(e){y.addColorStop(e.offset,fe(e.color))});var b=g.matrix;if(b){var x=(n=oe.getOffscreenCanvas(s,c)).ctx;x.beginPath(),e.forEach(function(e){ba(x,e,A,_)}),t&&x.closePath(),x.clip(),x.fillStyle=y,x.setTransform(b[0],b[1],b[4],b[5],b[12],b[13]),x.fill(f===K.EVEN_ODD?"evenodd":"nonzero")}else E.fillStyle=y}else if(a.t===Y.CONIC){g=jr(a.stops,a.d,0,0,s-2*u,c-2*l);var T=E.createConicGradient(g.angle,g.cx+A,g.cy+_);g.stop.forEach(function(e){T.addColorStop(e.offset,fe(e.color))}),E.fillStyle=T}o!==j.NORMAL&&(E.globalCompositeOperation=xa(o)),n?(E.drawImage(n.canvas,0,0),n.release()):E.fill(f===K.EVEN_ODD?"evenodd":"nonzero"),o!==j.NORMAL&&(E.globalCompositeOperation="source-over")},I=0,R=h.length;I<R;I++)M(I);E.globalAlpha=1,E.globalCompositeOperation="source-over",w===Q.ROUND?E.lineCap="round":w===Q.SQUARE?E.lineCap="square":E.lineCap="butt",k===Z.ROUND?E.lineJoin="round":k===Z.BEVEL?E.lineJoin="bevel":E.lineJoin="miter",E.miterLimit=S;for(var P=function(r,i){if(!v[r]||!y[r])return"continue";var h=g[r],d=b[r];if(E.globalCompositeOperation=xa(x[r]),Array.isArray(h))E.strokeStyle=fe(h);else if(h.t===Y.LINEAR){var f=Hr(h.stops,h.d,0,0,s+2*n,c+2*o),m=E.createLinearGradient(f.x1+A,f.y1+_,f.x2+A,f.y2+_);f.stop.forEach(function(e){m.addColorStop(e.offset,fe(e.color))}),E.strokeStyle=m}else if(h.t===Y.RADIAL){f=Xr(h.stops,h.d,0,0,s-2*u,c-2*l);var p=E.createRadialGradient(f.cx+A,f.cy+_,0,f.cx+A,f.cy+_,f.total);f.stop.forEach(function(e){p.addColorStop(e.offset,fe(e.color))});var T=f.matrix;if(T){var w=oe.getOffscreenCanvas(a.w,a.h),k=w.ctx;return k.setLineDash(E.getLineDash()),k.lineCap=E.lineCap,k.lineJoin=E.lineJoin,k.miterLimit=E.miterLimit,k.lineWidth=y[r],k.strokeStyle="#FFF",k.beginPath(),e.forEach(function(e){ba(k,e,A,_)}),t&&k.closePath(),d===J.INSIDE&&t?(k.lineWidth=2*y[r],k.save(),k.clip(),k.stroke(),k.restore()):d===J.OUTSIDE&&t?(k.lineWidth=2*y[r],k.stroke(),k.save(),k.clip(),k.globalCompositeOperation="destination-out",k.strokeStyle="#FFF",k.stroke(),k.restore()):k.stroke(),k.fillStyle=p,k.globalCompositeOperation="source-in",k.setTransform(T[0],T[1],T[4],T[5],T[12],T[13]),k.fillRect(0,0,s,c),E.drawImage(w.canvas,0,0),w.release(),"continue"}E.strokeStyle=p}else if(h.t===Y.CONIC){f=jr(h.stops,h.d,0,0,s-2*u,c-2*l);var S=E.createConicGradient(f.angle,f.cx+A,f.cy+_);f.stop.forEach(function(e){S.addColorStop(e.offset,fe(e.color))}),E.strokeStyle=S}var C,M=void 0;d===J.INSIDE&&t?E.lineWidth=2*y[r]:d===J.OUTSIDE&&t?(M=oe.getOffscreenCanvas(a.w,a.h),(C=M.ctx).setLineDash(E.getLineDash()),C.lineCap=E.lineCap,C.lineJoin=E.lineJoin,C.miterLimit=E.miterLimit,C.strokeStyle=E.strokeStyle,C.lineWidth=2*y[r],C.beginPath(),e.forEach(function(e){ba(C,e,A,_)})):E.lineWidth=y[r],t&&C&&C.closePath(),d===J.INSIDE&&t?(E.save(),E.clip(),E.stroke(),E.restore()):d===J.OUTSIDE&&t?(C.stroke(),C.save(),C.clip(),C.globalCompositeOperation="destination-out",C.strokeStyle="#FFF",C.stroke(),C.restore(),E.drawImage(M.canvas,0,0),M.release()):E.stroke()},O=(I=0,g.length);I<O;I++)P(I);E.globalCompositeOperation="source-over"},_=0,M=C.length;_<M;_++)A(_)}},r.prototype.genTexture=function(e){var t;this.renderCanvas(),null===(t=this.textureCache)||void 0===t||t.release();var r=this.canvasCache;(null==r?void 0:r.available)?(this.textureTarget=this.textureCache=new Ji(e,this._bboxInt||this.bboxInt,r),r.release()):this.textureTarget=this.textureCache=void 0},r.prototype.resetTextureTarget=function(){var e=this,t=e.textureCache,r=e.textureTotal,i=e.textureFilter;(null==i?void 0:i.available)&&(this.textureTarget=i),(null==r?void 0:r.available)&&(this.textureTarget=r),(null==t?void 0:t.available)&&(this.textureTarget=t)},r.prototype.updateStyle=function(e,t){var r=Gr(e);return this.updateFormatStyle(r,t)},r.prototype.updateFormatStyle=function(e,t){var r,i=this.updateFormatStyleData(e);return i.length||t&&t(!0),null===(r=this.root)||void 0===r?void 0:r.addUpdate(this,i,void 0,t)},r.prototype.updateFormatStyleData=function(e){var t=[];for(var r in e)e.hasOwnProperty(r)&&(ei(e,this.style,r)||(this.style[r]=e[r],t.push(r)));return t},r.prototype.clearTexCache=function(e){var t,r,i;void 0===e&&(e=!1),e&&(this.refreshLevel|=ui.REPAINT,null===(t=this.textureCache)||void 0===t||t.release()),null===(r=this.textureTotal)||void 0===r||r.release(),null===(i=this.textureFilter)||void 0===i||i.release()},r.prototype.clearTexCacheUpward=function(e){void 0===e&&(e=!1);for(var t=this.parent;t;)t.clearTexCache(e),t=t.parent},r.prototype.clearMask=function(e){var t;if(void 0===e&&(e=!0),null===(t=this.textureMask)||void 0===t||t.release(),this.resetTextureTarget(),this.struct.next=0,this.refreshLevel|=ui.MASK,e)for(var r=this.parent;r&&r!==this.root;)r.clearTexCache(),r._rect=void 0,r._bbox=void 0,r._bboxInt=void 0,r._filterBbox=void 0,r._filterBboxInt=void 0,r.tempBbox=void 0,r=r.parent},r.prototype.refresh=function(e,t){var r;void 0===e&&(e=ui.REPAINT),null===(r=this.root)||void 0===r||r.addUpdate(this,[],e,t)},r.prototype.getBackgroundCoords=function(e,t){void 0===e&&(e=0),void 0===t&&(t=0);var r=this.computedStyle,i=r.borderTopLeftRadius,a=r.borderTopRightRadius,n=r.borderBottomLeftRadius,o=r.borderBottomRightRadius,s=Math.min(.5*r.width,.5*r.height),c=Math.min(s,i),u=Math.min(s,a),l=Math.min(s,n),h=Math.min(s,o);return 0===c&&0===u&&0===l&&0===h?[[e,t],[r.width,t],[r.width,r.height],[e,r.height],[e,t]]:[[c,t],[r.width-u,t],[r.width-u+u*br,t,r.width,u*br,r.width,u],[r.width,r.height-h],[r.width,r.height-h+h*br,r.width-h+h*br,r.height,r.width-h,r.height],[l,r.height],[l*br,r.height,e,r.height-l+l*br,e,r.height-l],[e,c],[e,c-c*br,c-c*br,t,c,t]]},r.prototype.getStyle=function(){return C(this.style)},r.prototype.getComputedStyle=function(){var e=Object.assign({},this.computedStyle);return this.isMounted&&(e.color=e.color.slice(0),e.backgroundColor=e.backgroundColor.slice(0),e.fill=C(e.fill),e.stroke=C(e.stroke),e.fillOpacity=e.fillOpacity.slice(0),e.fillEnable=e.fillEnable.slice(0),e.fillMode=e.fillMode.slice(0),e.strokeEnable=e.strokeEnable.slice(0),e.strokeWidth=e.strokeWidth.slice(0),e.transformOrigin=e.transformOrigin.slice(0),e.strokeDasharray=e.strokeDasharray.slice(0)),e},r.prototype.getCssStyle=function(e){var t=this;void 0===e&&(e=!1);var r=this.style,i=this.computedStyle,a={};return["top","right","bottom","left","width","height","translateX","translateY","scaleX","scaleY","rotateZ","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"].forEach(function(e){var t=r[e];t.u===V.AUTO?a[e]="auto":t.u===V.PERCENT?a[e]=t.v+"%":t.u!==V.PX&&t.u!==V.NUMBER&&t.u!==V.DEG||(a[e]=t.v)}),a.opacity=r.opacity.v,a.visibility=r.visibility.v===te.VISIBLE?"visible":"hidden",a.color=fe(r.color.v),a.backgroundColor=fe(r.backgroundColor.v),a.fontStyle=["normal","italic","oblique"][r.fontStyle.v],a.textAlign=["left","right","center","justify"][r.textAlign.v],a.textVerticalAlign=["top","middle","bottom"][r.textVerticalAlign.v],a.mixBlendMode=ai(r.mixBlendMode.v),a.objectFit=["fill","contain","cover"][r.objectFit.v],["strokeEnable","fillEnable","fillOpacity","strokeWidth"].forEach(function(e){a[e]=r[e].map(function(e){return e.v})}),e?this.isMounted?a.fill=r.fill.map(function(e){return ni(e.v,t.width,t.height,!0)}):oe.error("Can not get CSS standard fill unmounted"):a.fill=r.fill.map(function(e){return ni(e.v)}),a.fillRule=["nonzero","evenodd"][r.fillRule.v],a.fillMode=r.fillMode.map(function(e){return ai(e.v)}),e?this.isMounted?a.stroke=r.stroke.map(function(e){return ni(e.v,t.width,t.height,!0)}):oe.error("Can not get CSS standard stroke unmounted"):a.stroke=r.stroke.map(function(e){return ni(e.v)}),a.strokeLinecap=["butt","round","square"][r.strokeLinecap.v],a.strokeLinejoin=["miter","round","bevel"][r.strokeLinejoin.v],a.strokePosition=r.strokePosition.map(function(e){return oi(e.v)}),a.strokeMiterlimit=r.strokeMiterlimit.v,a.strokeDasharray=r.strokeDasharray.map(function(e){return e.v}),a.strokeMode=r.strokeMode.map(function(e){return ai(e.v)}),a.transformOrigin=r.transformOrigin.map(function(e){return e.u===V.PERCENT?e.v+"%":e}),a.overflow=["visible","hidden"][r.overflow.v],a.filter=ya(r.filter,i.width,i.height).map(function(e){return(t=e).u===V.GAUSS_BLUR?"gaussBlur("+t.radius+")":t.u===V.RADIAL_BLUR?"radialBlur("+t.radius+","+t.center.join(", ")+")":t.u===V.MOTION_BLUR?"motionBlur("+t.radius+","+t.offset+")":t.u===V.BLOOM?"bloom("+t.threshold+","+t.knee+")":t.u===V.LIGHT_DARK?"lightDark("+t.radius+","+t.angle+")":void 0;var t}),a},r.prototype.isParent=function(e){for(var t=this.parent;t;){if(t===e)return!0;t=t.parent}return!1},r.prototype.isChild=function(e){return e.isParent(this)},r.prototype.insertAfter=function(e,t){e.remove();var r=this.root,i=this.parent;if(!i)throw new Error("Can not appendSelf without parent");e.parent=i,e.prev=this,this.next&&(this.next.prev=e),e.next=this.next,this.next=e,e.root=r;var a=i.children,n=a.indexOf(this);a.splice(n+1,0,e),i.isDestroyed?t&&t(!0):(i.insertStruct(e,n+1),r.addUpdate(e,[],ui.ADD_DOM,t))},r.prototype.insertBefore=function(e,t){e.remove();var r=this.root,i=this.parent;if(!i)throw new Error("Can not prependBefore without parent");e.parent=i,e.prev=this.prev,this.prev&&(this.prev.next=e),e.next=this,this.prev=e,e.root=r;var a=i.children,n=a.indexOf(this);a.splice(n,0,e),i.isDestroyed?t&&t(!0):(i.insertStruct(e,n),r.addUpdate(e,[],ui.ADD_DOM,t))},r.prototype.remove=function(e){var t=this.root,r=this.parent;if(r){var i=r.children.indexOf(this);if(-1===i)throw new Error("Invalid index of remove()");r.children.splice(i,1);var a=this.prev,n=this.next;a&&(a.next=n),n&&(n.prev=a),r.deleteStruct(this)}t&&this.isMounted?t.addUpdate(this,[],ui.REMOVE_DOM,e):e&&e(!0)},r.prototype.getBoundingClientRect=function(e){var t=(null==e?void 0:e.includeBbox)?this._bbox||this.bbox:this._rect||this.rect,r=Tt(t[0],t[1],t[2],t[3],this.matrixWorld),i=r.x1,a=r.y1,n=r.x2,o=r.y2,s=r.x3,c=r.y3,u=r.x4,l=r.y4,h=Math.min(i,n,s,u),d=Math.min(a,o,c,l),f=Math.max(i,n,s,u),m=Math.max(a,o,c,l);return{left:h,top:d,right:f,bottom:m,width:f-h,height:m-d,points:[{x:i,y:a},{x:n,y:o},{x:s,y:c},{x:u,y:l}]}},r.prototype.getOffsetRect=function(){var e=this.computedStyle,t=e.left+e.translateX,r=e.top+e.translateY;return{left:t,top:r,right:t+this.width,bottom:r+this.height}},r.prototype.startSizeChange=function(){var e=this,t=e.width,r=e.height,i=e.style,a=e.computedStyle,n=e.parent;if(e.isDestroyed||!n)throw new Error("Can not resize a destroyed Node or Root");var o=i.left,s=i.right,c=i.top,u=i.bottom,l=i.translateX,h=i.translateY,d=n.width,f=n.height;if(l.v&&l.u===V.PERCENT){var m=l.v*t*.01;o.u===V.PERCENT?o.v+=100*m/d:o.u===V.PX&&(o.v+=m),a.left+=m,s.u===V.PERCENT?s.v-=100*m/d:s.u===V.PX&&(s.v-=m),a.right-=m,l.v=0}if(h.v&&h.u===V.PERCENT){m=h.v*r*.01;c.u===V.PERCENT?c.v+=100*m/f:c.u===V.PX&&(c.v+=m),a.top+=m,u.u===V.PERCENT?u.v-=100*m/f:u.u===V.PX&&(u.v-=m),a.bottom-=m,h.v=0}},r.prototype.endSizeChange=function(e){var t=e.translateX,r=e.translateY,i=this,a=i.style,n=i.computedStyle,o=i.parent,s=i.width,c=i.height,u=a.left,l=a.right,h=a.top,d=a.bottom,f=o,m=f.width,p=f.height;if(t.v&&t.u===V.PERCENT){var g=t.v*s*.01;u.u===V.PX?u.v-=g:u.u===V.PERCENT&&(u.v-=100*g/m),n.left-=g,l.u===V.PX?l.v+=g:l.u===V.PERCENT&&(l.v+=100*g/m),n.right+=g,n.translateX+=g}if(r.v&&r.u===V.PERCENT){g=r.v*c*.01;h.u===V.PX?h.v-=g:a.top.u===V.PERCENT&&(h.v-=100*g/p),n.top-=g,d.u===V.PX?d.v+=g:d.u===V.PERCENT&&(d.v+=100*g/p),n.bottom+=g,n.translateY+=g}a.translateX.v=t.v,a.translateX.u=t.u,a.translateY.v=r.v,a.translateY.u=r.u},r.prototype.endPosChange=function(e,t,r){var i=this,a=i.style,n=i.computedStyle,o=i.parent;if(o){var s=e.translateX,c=e.translateY,u=a.top,l=a.right,h=a.bottom,d=a.left,f=o.width,m=o.height;t&&(d.u===V.PX?d.v+=t:d.u===V.PERCENT&&(d.v+=100*t/f),n.left+=t,l.u===V.PX?l.v-=t:l.u===V.PERCENT&&(l.v-=100*t/f),n.right-=t,n.translateX-=t),r&&(u.u===V.PX?u.v+=r:u.u===V.PERCENT&&(u.v+=100*r/m),n.top+=r,h.u===V.PX?h.v-=r:h.u===V.PERCENT&&(h.v-=100*r/m),n.bottom-=r,n.translateY-=r),a.translateX.v=s.v,a.translateX.u=s.u,a.translateY.v=c.v,a.translateY.u=c.u}},r.prototype.adjustPosAndSizeSelf=function(e,t,r,i){var a=this,n=a.style,o=a.computedStyle,s=a.parent,c=a.root;if(s&&c&&(e||t||r||i)){var u=s.width,l=s.height,h=n.top,d=n.right,f=n.bottom,m=n.left,p=n.width,g=n.height,v=n.translateX,y=n.translateY,b=(e||r)&&v.u===V.PERCENT&&v.v;if(b){var x=.01*b*this.width;m.u===V.PX?m.v+=x:m.u===V.PERCENT&&(m.v+=100*x/u),o.left+=x,d.u===V.PX?d.v-=x:d.u===V.PERCENT&&(d.v-=100*x/u),o.right-=x}if(e&&(m.u===V.PX?m.v+=e:m.u===V.PERCENT&&(m.v+=100*e/u),o.left+=e),r&&(d.u===V.PX?d.v-=r:d.u===V.PERCENT&&(d.v-=100*r/u),o.right-=r),r-e&&(p.u===V.PX?p.v=r+this.width-e:p.u===V.PERCENT&&(p.v=100*(r+this.width-e)/s.width),o.width=s.width-o.left-o.right),this.width<0){o.width=-this.width;var T=o.left,w=o.right;o.left=u-w,m.u===V.PX?m.v=o.left:m.u===V.PERCENT&&(m.v=100*o.left/u),o.right=u-T,d.u===V.PX?d.v=o.right:d.u===V.PERCENT&&(d.v=100*o.right/u)}if(b){x=.01*b*this.width;m.u===V.PX?m.v-=x:m.u===V.PERCENT&&(m.v-=100*x/u),o.left-=x,d.u===V.PX?d.v+=x:d.u===V.PERCENT&&(d.v+=100*x/u),o.right+=x}var k=(t||i)&&y.u===V.PERCENT&&y.v;if(k){x=.01*k*this.height;h.u===V.PX?h.v+=x:h.u===V.PERCENT&&(h.v+=100*x/l),o.top+=x,f.u===V.PX?f.v-=x:f.u===V.PERCENT&&(f.v-=100*x/l),o.bottom-=x}if(t&&(h.u===V.PX?h.v+=t:h.u===V.PERCENT&&(h.v+=100*t/l),o.top+=t),i&&(f.u===V.PX?f.v-=i:f.u===V.PERCENT&&(f.v-=100*i/l),o.bottom-=i),i-t&&(g.u===V.PX?g.v=i+this.height-t:g.u===V.PERCENT&&(g.v=100*(i+this.height-t)/s.height),o.height=s.height-o.top-o.bottom),this.height<0){o.height=-this.height;var S=o.top,E=o.bottom;o.top=l-S,h.u===V.PX?h.v=o.top:h.u===V.PERCENT&&(h.v=100*o.top/l),o.bottom=l-E,f.u===V.PX?f.v=o.bottom:f.u===V.PERCENT&&(f.v=100*o.bottom/l)}if(k){x=.01*k*this.height;h.u===V.PX?h.v-=x:h.u===V.PERCENT&&(h.v-=100*x/l),o.top-=x,f.u===V.PX?f.v+=x:f.u===V.PERCENT&&(f.v+=100*x/l),o.bottom+=x}this.refreshLevel|=ui.TRANSFORM_ALL,c.rl|=ui.TRANSFORM_ALL,this.calMatrix(ui.TRANSFORM_ALL),this._rect=void 0,this._bbox=void 0,this._bboxInt=void 0,this._filterBbox=void 0,this._filterBboxInt=void 0,this.tempBbox=void 0}},r.prototype.checkPosSizeUpward=function(){for(var e=this.root,t=this.parent;t&&t!==e&&t.adjustPosAndSize();)t=t.parent},r.prototype.adjustPosAndSize=function(){return!1},r.prototype.initAnimate=function(e,t){this.animationList.push(e);var r=this.root;return this.isDestroyed||!r?(e.cancel(),e):(r.aniController.addAni(e),t.autoPlay?e.play():"backwards"!==t.fill&&"both"!==t.fill||e.gotoAndStop(0),e)},r.prototype.animate=function(e,t){var r=new ma(this,e,t);return this.initAnimate(r,t)},r.prototype.release=function(){this.remove(),this.animationList.splice(0).forEach(function(e){return e.remove()}),this.clearTexCache()},r.prototype.cloneProps=function(){var e=Object.assign({},this.props);return e.name=this.name,e.style=this.getCssStyle(),e},r.prototype.clone=function(){return new r(this.cloneProps())},Object.defineProperty(r.prototype,"width",{get:function(){return this.computedStyle.width||0},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"height",{get:function(){return this.computedStyle.height||0},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"matrixWorld",{get:function(){var e,t=this.root,r=this._matrixWorld;if(!t)return r;for(var i=this,a=this.hasCacheMw,n=i.parent,o=-1,s=[];n;)s.push(n),n.hasCacheMw&&n.localMwId===i.parentMwId||(a=!1,o=s.length),i=n,n=n.parent;if(!a){if(o>-1){s.splice(o),s.reverse();for(var c=0,u=s.length;c<u;c++){var l=s[c];if(l.hasCacheMw&&l.parentMwId!==(null===(e=l.parent)||void 0===e?void 0:e.localMwId)&&l.localMwId++,l.hasCacheMw=!0,l===t)ut(l._matrixWorld,l.matrix);else{var h=l.parent.perspectiveMatrix,d=l.perspectiveMatrixSelf,f=l.matrix;d&&(f=ot(d,f)),h&&(f=ot(h,f));var m=ot(l.parent._matrixWorld,f);ut(l._matrixWorld,m),l.parentMwId=l.parent.localMwId}}}if(this.hasCacheMw&&this.localMwId++,this.hasCacheMw=!0,n=this.parent){h=n.perspectiveMatrix,d=this.perspectiveMatrixSelf,f=this.matrix;d&&(f=ot(d,f)),h&&(f=ot(h,f)),ut(r,m=ot(n._matrixWorld,f)),this.parentMwId=n.localMwId}else{ut(r,(d=this.perspectiveMatrixSelf)?ot(d,this.matrix):this.matrix)}}return r},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"rect",{get:function(){var e=this._rect;return e||((e=this._rect=new Float32Array(4))[0]=0,e[1]=0,e[2]=this.computedStyle.width,e[3]=this.computedStyle.height),e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"bbox",{get:function(){var e=this._bbox;if(!e){var t=this._rect||this.rect;e=this._bbox=t.slice(0)}return e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"filterBbox",{get:function(){var e=this._filterBbox;if(!e){var t=this._bbox||this.bbox;e=this._filterBbox=t.slice(0)}return e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"bboxInt",{get:function(){var e=this._bboxInt;return e||pi(e=this._bboxInt=(this._bbox||this.bbox).slice(0)),e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"filterBboxInt",{get:function(){var e=this._filterBboxInt;return e||pi(e=this._filterBboxInt=(this._filterBbox||this.filterBbox).slice(0)),e},enumerable:!1,configurable:!0}),r}(M);!function(e){e[e.NONE=0]="NONE",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED"}(Ta||(Ta={}));var Sa={};function Ea(e,t){return i(this,void 0,void 0,function(){var r,i,n,o,s,c,u,l,h;return a(this,function(a){switch(a.label){case 0:if(r=Sa[e]){if(r.count++,r.state===Ta.LOADED)return[2,r.res];if(r.state===Ta.LOADING)return[2,new Promise(function(e){r.list.push(e)})]}return r=Sa[e]={state:Ta.LOADING,list:[],count:0,res:{success:!1,frames:[],width:0,height:0,release:function(){r.count--,r.count<=0&&(r.res.source&&URL.revokeObjectURL(r.res.source.src),r.res.frames.forEach(function(e){return e.close()}),delete Sa[e])}}},[4,fetch(e,Object.assign({mode:"cors"},t))];case 1:return 200!==(i=a.sent()).status&&304!==i.status?(r.state=Ta.LOADED,[2,r.res]):[4,i.arrayBuffer()];case 2:return n=a.sent(),"undefined"==typeof ImageDecoder?[3,9]:function(e){var t=[71,73,70,56,55,97];return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&(e[4]===t[4]||57===e[4])&&e[5]===t[5]}(new Uint8Array(n))?[4,(o=new ImageDecoder({data:n,type:"image/gif"})).tracks.ready]:[3,9];case 3:if(a.sent(),!(s=o.tracks.selectedTrack))return[3,8];c=0,a.label=4;case 4:return c<s.frameCount?[4,o.decode({frameIndex:c})]:[3,7];case 5:u=a.sent(),r.res.frames.push(u.image),a.label=6;case 6:return c++,[3,4];case 7:return r.state=Ta.LOADED,r.res.success=!0,r.res.width=r.res.frames[0].codedWidth,r.res.height=r.res.frames[0].codedHeight,r.count++,r.list.splice(0).forEach(function(e){r.count++,e(r.res)}),o.close(),[2,r.res];case 8:o.close(),a.label=9;case 9:return l=new Blob([n]),(h=new Image).src=URL.createObjectURL(l),r.count++,[2,new Promise(function(e){h.onload=function(){r.state=Ta.LOADED,r.res.success=!0,r.res.source=h,r.res.width=h.width,r.res.height=h.height,e(r.res),r.list.splice(0).forEach(function(e){r.count++,e(r.res)})},h.onerror=function(){r.state=Ta.LOADED,e(r.res),r.list.splice(0).forEach(function(e){r.count++,e(r.res)})}})]}})})}var Ca=function(e){function r(t,r,i){var a=e.call(this,t,i)||this;return a.node=t,a._frameArea=r,a._frameAreaR=r.slice(0).reverse(),a.currentFrameArea=a._frameArea,a.originFrameIndex=t.frameIndex,a.setCurrentFrameArea(),a}return t(r,e),r.prototype.setCurrentFrameArea=function(){var e=this.direction,t=this._playCount;this.currentFrameArea="backwards"===e?this._frameAreaR:"alternate"===e?t%2==0?this._frameArea:this._frameAreaR:"alternateReverse"===e&&t%2==0?this._frameAreaR:this._frameArea},r.prototype.finish=function(){"finished"!==this._playState&&(e.prototype.finish.call(this),this.onFirstInEndDelay())},r.prototype.cancel=function(){"idle"!==this._playState&&(e.prototype.cancel.call(this),this.node.frameIndex=this.originFrameIndex)},r.prototype.onRunning=function(t){e.prototype.onRunning.call(this,t);var r=this,i=r.node,a=r.duration,n=r.delay,o=r.iterations,s=r.currentFrameArea,c=r.time;if(!(this._currentTime<n)){var u=this._playCount>=o-1,l=c/a;this.easing&&(l=this.easing(l)),u&&l>=1||(i.frameIndex=Math.floor(s[0]+(s[1]-s[0])*l))}},r.prototype.onFirstInDelay=function(){var e=this,t=e.fill,r=e.currentFrameArea,i=e.node;"backwards"!==t&&"both"!==t||(i.frameIndex=r[0])},r.prototype.onFirstInEndDelay=function(){var e=this.fill,t=this.node;if("forwards"===e||"both"===e){var r=this.currentFrameArea;t.frameIndex=r[r.length-1]}else t.frameIndex=this.originFrameIndex},r.prototype.onChangePlayCount=function(){this.setCurrentFrameArea()},r}(fa),Aa="refresh_complete",_a="waiting",Ma="can_play",Ia="meta",Ra="error",Pa="load",Oa=function(e){function r(t){var r=e.call(this,t)||this;t.onLoad&&(r.onLoad=t.onLoad),r._frameIndex=t.frameIndex||0,r.isPure=!0;var i=r._src=t.src||"";if(i){var a=function(){if(r.isMounted){var e=r.style,t=e.left,i=e.top,a=e.right,n=e.bottom,o=e.width,s=e.height;(t.u===V.AUTO||a.u===V.AUTO)&&o.u===V.AUTO||(i.u===V.AUTO||n.u===V.AUTO)&&s.u===V.AUTO?r.refresh(ui.REFLOW):r.refresh()}r.onLoad&&r.onLoad(),r.emit(Pa)},n=function(e){var t=Sa[e];if((null==t?void 0:t.state)===Ta.LOADED)return t.res}(i);n?n.success&&(r.loader=n,a()):(r.contentLoadingNum=1,Ea(i).then(function(e){r.loader=e,r.contentLoadingNum=0,e.success&&a()}))}return r}return t(r,e),r.prototype.lay=function(t){e.prototype.lay.call(this,t);var r=this,i=r.style,a=r.computedStyle,n=r.loader,o=i.left,s=i.top,c=i.right,u=i.bottom,l=i.width,h=i.height;if(n){var d=(o.u===V.AUTO||c.u===V.AUTO)&&l.u===V.AUTO,f=(s.u===V.AUTO||u.u===V.AUTO)&&h.u===V.AUTO;d&&(a.width=f?n.width:n.width*a.height/n.height,o.u===V.AUTO&&c.u===V.AUTO?(a.left=0,a.right=t.w-a.width):o.u===V.AUTO?a.left=t.w-a.right-a.width:c.u===V.AUTO&&(a.right=t.w-a.left-a.width)),f&&(a.height=d?n.height:n.height*a.width/n.width,s.u===V.AUTO&&u.u===V.AUTO?(a.top=0,a.bottom=t.h-a.height):s.u===V.AUTO?a.top=t.h-a.bottom-a.height:u.u===V.AUTO&&(a.bottom=t.h-a.top-a.height))}},r.prototype.calRepaintStyle=function(t){e.prototype.calRepaintStyle.call(this,t);var r=this.computedStyle,i=this.loader;if(this.isPure=r.backgroundColor[3]<=0,this.isPure&&(null==i?void 0:i.success)){var a=r.objectFit,n=r.borderTopLeftRadius,o=r.borderTopRightRadius,s=r.borderBottomLeftRadius,c=r.borderBottomRightRadius;if(a!==ae.COVER&&a!==ae.FILL||!(n||o||s||c)){if(a===ae.CONTAIN&&(n||o||s||c)){var u=i.width/i.height,l=r.width/r.height;if(l>u){var h=r.height*u,d=.5*(r.width-h);(n>d||o>d||s>d||c>d)&&(this.isPure=!1)}else if(l<u){var f=r.width/u,m=.5*(r.height-f);(n>m||o>m||s>m||c>m)&&(this.isPure=!1)}else this.isPure=!1}}else this.isPure=!1}},r.prototype.calContent=function(){this.hasContent=!1;var e=this.loader;return(null==e?void 0:e.success)?e.frames.length?this._frameIndex>=0&&this._frameIndex<e.frames.length&&(this.hasContent=!0):e.source&&(this.hasContent=!0):this.hasContent=this.computedStyle.backgroundColor[3]>0,this.hasContent},r.prototype.renderCanvas=function(){var t,r,i=this,a=i.isPure,n=i.loader,o=i.computedStyle;if(a){if(null===(t=this.canvasCache)||void 0===t||t.release(),null==n?void 0:n.success){var s=n.width,c=n.height;if(n.frames.length){var u=Math.min(n.frames.length-1,Math.max(0,this._frameIndex));if((Q=n.frames[u])&&(s>L.maxTextureSize||c>L.maxTextureSize))if((R=this.canvasCache=Ti.getVideoFrameInstance(s,c,Q)).available=!0,1===R.getCount()){var l=o.width,h=o.height,d=o.objectFit,f=0,m=0,p=n.width/n.height,g=l/h;if(d===ae.CONTAIN){if(g>p){var v=h*p;f=.5*(l-v),l=v}else if(g<p){var y=l/p;m=.5*(h-y),h=y}}else if(d===ae.COVER)if(g>p){var b=l/p;m=.5*(h-b),h=b}else if(g<p){var x=h*p;f=.5*(l-x),l=x}for(var T=0,w=(U=R.list).length;T<w;T++){var k=U[T],S=k.x,E=k.y;k.os.ctx.drawImage(Q,-S+f,-E+m,l,h)}}}else if(n.source&&(n.width>L.maxTextureSize||n.height>L.maxTextureSize)){if((R=this.canvasCache=Ti.getImgInstance(s,c,this._src)).available=!0,1===R.getCount()){l=o.width,h=o.height,d=o.objectFit,f=0,m=0,p=n.width/n.height,g=l/h;if(d===ae.CONTAIN){if(g>p){var C=h*p;f=.5*(l-C),l=C}else if(g<p){var A=l/p;m=.5*(h-A),h=A}}else if(d===ae.COVER)if(g>p){var _=l/p;m=.5*(h-_),h=_}else if(g<p){var M=h*p;f=.5*(l-M),l=M}for(T=0,w=(U=R.list).length;T<w;T++){var I=U[T];S=I.x,E=I.y;I.os.ctx.drawImage(n.source,-S+f,-E+m,l,h)}}}}}else{e.prototype.renderCanvas.call(this);var R,P=this.computedStyle,O=this._bboxInt||this.bboxInt;S=O[0],E=O[1],s=O[2]-S,c=O[3]-E,l=P.width,h=P.height,d=P.objectFit,f=0,m=0;if(null==n?void 0:n.success){p=n.width/n.height,g=l/h;if(d===ae.CONTAIN){if(g>p){var D=h*p;f=.5*(l-D),l=D}else if(g<p){var B=l/p;m=.5*(h-B),h=B}}else if(d===ae.COVER)if(g>p){var F=l/p;m=.5*(h-F),h=F}else if(g<p){var N=h*p;f=.5*(l-N),l=N}}(R=this.canvasCache=(null===(r=this.canvasCache)||void 0===r?void 0:r.available)?this.canvasCache:new Ti(s,c,-S,-E)).available=!0;var U;for(T=0,w=(U=R.list).length;T<w;T++){var z=U[T],W=z.x,V=z.y,H=z.os.ctx,X=-W,j=-V;if(null==n?void 0:n.success){var G=P.borderTopLeftRadius,Y=P.borderTopRightRadius,q=P.borderBottomLeftRadius,K=P.borderBottomRightRadius;if(G||Y||q||K){var $=this.getBackgroundCoords(W,V);H.save(),H.beginPath(),ba(H,$,-W,-V),H.closePath(),H.clip()}if(n.frames.length){var Q;u=Math.min(n.frames.length-1,Math.max(0,this._frameIndex));(Q=n.frames[u])&&H.drawImage(Q,X+f,j+m,l,h)}else n.source&&H.drawImage(n.source,X+f,j+m,l,h);(G||Y||q||K)&&H.restore()}}}},r.prototype.genTexture=function(t){var r=this,i=r.isPure,a=r.loader,n=r.canvasCache;if(i){if(null==a?void 0:a.success)if(a.width>L.maxTextureSize||a.height>L.maxTextureSize)if((null==n?void 0:n.available)&&Ji.hasCanvasCacheInstance(n)){var o=Ji.getCanvasCacheInstance(t,n,this._rect||this.rect);this.textureTarget=this.textureCache=o}else{this.renderCanvas();o=Ji.getCanvasCacheInstance(t,this.canvasCache,this._rect||this.rect);this.textureTarget=this.textureCache=o,this.canvasCache.release()}else{var s=this.computedStyle,c=s.width,u=s.height,l=s.objectFit,h=this._rect||this.rect,d=(o=void 0,a.width/a.height),f=c/u;if(l===ae.CONTAIN){if(f>d){var m=.5*(c-(v=u*d));(h=h.slice(0))[0]+=m,h[2]-=m}else if(f<d){m=.5*(u-(p=c/d));(h=h.slice(0))[1]+=m,h[3]-=m}}else if(l===ae.COVER)if(f>d){var p=c/d;o={x1:0,y3:g=(m=.5*Math.abs(u-p))/p,x3:1,y1:1-g}}else if(f<d){var g,v=u*d;o={x1:g=(m=.5*Math.abs(c-v))/v,y3:0,x3:1-g,y1:1}}if(a.frames.length){var y=Math.min(a.frames.length-1,Math.max(0,this._frameIndex)),b=a.frames[y];if(b){var x=Ji.getVideoFrameInstance(t,b,h,o);this.textureTarget=this.textureCache=x}}else if(a.source){x=Ji.getImgInstance(t,a.source,h,o);this.textureTarget=this.textureCache=x}}}else e.prototype.genTexture.call(this,t)},r.prototype.release=function(){e.prototype.release.call(this);var t=this.loader;(null==t?void 0:t.success)&&t.release()},r.prototype.gifAnimate=function(e,t){var r=new Ca(this,e,t);return this.initAnimate(r,t)},r.prototype.cloneProps=function(){var t=e.prototype.cloneProps.call(this);return t.src=this._src,t},r.prototype.clone=function(){return new r(this.cloneProps())},Object.defineProperty(r.prototype,"src",{get:function(){return this._src},set:function(e){this._src!==e&&(this._src=e,this.refresh())},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"frameIndex",{get:function(){return this._frameIndex},set:function(e){this._frameIndex!==e&&(this._frameIndex=e,this.refresh())},enumerable:!1,configurable:!0}),r}(ka);var Da={parseJSON:function(e){var t=e.tagName,r=e.props,i=void 0===r?{}:r,a=e.children,n=void 0===a?[]:a,o=e.animation,s=void 0===o?[]:o;if(!t)throw new Error("Missing tagName");if(!Array.isArray(n))throw new Error("Children must be an array");if(!Array.isArray(s))throw new Error("Animation must be an array");if("img"!==t)throw new Error("Unknown tagName");return new Oa(i)}},Ba=function(e){function r(t,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return i.children=r,i}return t(r,e),r.prototype.didMount=function(){e.prototype.didMount.call(this);var t=this.children,r=t.length;if(r){var i=t[0];i.parent=this,i.didMount();for(var a=i,n=1;n<r;n++){var o=t[n];o.didMount(),o.parent=this,a.next=o,o.prev=a,a=o}}},r.prototype.didUnmount=function(){e.prototype.didUnmount.call(this),this.children.forEach(function(e){e.didUnmount()})},r.prototype.layout=function(t){e.prototype.layout.call(this,t);for(var r=this.children,i=0,a=r.length;i<a;i++){r[i].layout({w:this.computedStyle.width,h:this.computedStyle.height})}},r.prototype.structure=function(t){var r=e.prototype.structure.call(this,t);return this.children.forEach(function(e){r=r.concat(e.structure(t+1))}),r[0].num=this.children.length,r[0].total=r.length-1,r},r.prototype.insertStruct=function(e,t){var r,i=this.struct,a=this.root,n=e.structure(i.lv+1),o=a.structs;if(t){var s=this.children[t-1].struct,c=s.total;r=o.indexOf(s)+c+1}else r=o.indexOf(i)+1;o.splice.apply(o,function(e,t,r){if(r||2===arguments.length)for(var i,a=0,n=t.length;a<n;a++)!i&&a in t||(i||(i=Array.prototype.slice.call(t,0,a)),i[a]=t[a]);return e.concat(i||Array.prototype.slice.call(t))}([r,0],n,!1));var u=n[0].total+1;i.num++,i.total+=u;for(var l=this.parent;l;)l.struct.total+=u,l=l.parent},r.prototype.deleteStruct=function(e){var t=e.struct,r=t.total+1,i=this.root.structs,a=i.indexOf(t);i.splice(a,r);var n=this.struct;n.num--,n.total-=r;for(var o=this.parent;o;)o.struct.total-=r,o=o.parent},r.prototype.appendChild=function(e,t){e.remove();var r=this.root,i=this.children,a=i.length;if(a){var n=i[i.length-1];n.next=e,e.prev=n}e.parent=this,e.root=r,i.push(e),r&&this.isMounted?(this.insertStruct(e,a),r.addUpdate(e,[],ui.ADD_DOM,t)):t&&t(!0)},r.prototype.prependChild=function(e,t){e.remove();var r=this.root,i=this.children;if(i.length){var a=i[0];a.next=e,e.prev=a}e.parent=this,e.root=r,i.push(e),r&&!this.isDestroyed?(this.insertStruct(e,0),r.addUpdate(e,[],ui.ADD_DOM,t)):t&&t(!0)},r.prototype.removeChild=function(e,t){e.parent===this?e.remove(t):oe.error("Invalid parameter of removeChild()")},r.prototype.removeAllChildren=function(e){for(var t=this.children.length-1;t>=0;t--)t?this.children[t].remove():this.children[t].remove(e)},r}(ka),Fa={alpha:!0,antialias:!0,premultipliedAlpha:!0,preserveDrawingBuffer:!0,depth:!0,stencil:!0};function La(e,t,r,i){var a=e.createFramebuffer();return e.bindFramebuffer(e.FRAMEBUFFER,a),t&&e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0),e.viewport(0,0,r,i),a}function Na(e,t,r,i){e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,null,0),e.bindFramebuffer(e.FRAMEBUFFER,null),e.deleteFramebuffer(t),r&&i&&e.viewport(0,0,r,i)}function Ua(e,t,r,i){return za(e,t,0,0,r,i)}function za(e,t,r,i,a,n){var o,s,c=Tt(e[0],e[1],e[2],e[3],t),u=c.x1,l=c.y1,h=c.x2,d=c.y2,f=c.x3,m=c.y3,p=c.x4,g=c.y4;return u===p&&l===d&&h===f&&m===g?(u>h&&(u=(o=[f,u])[0],f=o[1]),d>m&&(l=(s=[m,l])[0],m=s[1]),xr(r,i,r+a,i+n,u,l,f,m,!1)):Tr(r,i,r+a,i+n,[{x:u,y:l},{x:h,y:d},{x:f,y:m},{x:p,y:g}],!1)}var Wa=void 0,Va=function(){function e(e,t,r){this.program=t,this.options=r||{},this.uniform={},this.attrib={},this.uniformValue={},this.initLocations(e)}return e.prototype.initLocations=function(e){var t=this;this.options.uniform&&this.options.uniform.forEach(function(r){t.uniform[r]=e.getUniformLocation(t.program,r)}),this.options.attrib&&this.options.attrib.forEach(function(r){t.attrib[r]=e.getAttribLocation(t.program,r)})},e.useProgram=function(e,t){Wa!==t&&(Wa=t,e.useProgram(t.program))},e}(),Ha=function(e){function r(t,r,i){var a=e.call(this,t,i)||this;return a.node=t,a._timeArea=[r,r+a.duration],a._timeAreaR=a._timeArea.slice(0).reverse(),a.currentTimeArea=a._timeArea,a.originTime=t.currentTime,a.setCurrentTimeArea(),a}return t(r,e),r.prototype.setCurrentTimeArea=function(){var e=this.direction,t=this._playCount;this.currentTimeArea="backwards"===e?this._timeArea:"alternate"===e?t%2==0?this._timeAreaR:this._timeArea:"alternateReverse"===e?t%2==0?this._timeArea:this._timeAreaR:this._timeArea},r.prototype.finish=function(){"finished"!==this._playState&&(e.prototype.finish.call(this),this.onFirstInEndDelay())},r.prototype.cancel=function(){"idle"!==this._playState&&(e.prototype.cancel.call(this),this.node.currentTime=this.originTime)},r.prototype.play=function(){e.prototype.play.call(this),"running"!==this._playState||this._currentTime||(this.node.currentTime=0)},r.prototype.onRunning=function(t,r){var i;e.prototype.onRunning.call(this,t,r);var a=this,n=a.node,o=a.duration,s=a.delay,c=a.iterations,u=a.currentTimeArea,l=a.time,h=this._currentTime;if(h<s)n.currentTime=h-s;else{var d=this._playCount>=c-1,f=l/o;this.easing&&(f=this.easing(f)),d&&f>=1?n instanceof ef&&l-o>=L.releasePrevDuration&&n.computedStyle.visibility===te.HIDDEN&&(null===(i=n.decoder)||void 0===i||i.releaseGOPList(),n.videoFrame=void 0):n.currentTime=Math.floor(u[0]+(u[1]-u[0])*f)}},r.prototype.onFirstInDelay=function(){var e=this,t=e.fill,r=e.currentTimeArea,i=e.node;"backwards"!==t&&"both"!==t||(i.currentTime=r[0])},r.prototype.onFirstInEndDelay=function(){var e=this.fill,t=this.node;if("forwards"===e||"both"===e){var r=this.currentTimeArea;t.currentTime=r[r.length-1]}else t.currentTime=this.originTime},r.prototype.onChangePlayCount=function(){this.setCurrentTimeArea()},Object.defineProperty(r.prototype,"timeArea",{get:function(){return this._timeArea.slice(0)},enumerable:!1,configurable:!0}),r}(fa);
|
|
2
2
|
/*!
|
|
3
3
|
* Copyright (c) 2025-present, Vanilagy and contributors
|
|
4
4
|
*
|
|
@@ -270,5 +270,5 @@ class nd{constructor(){this.ensureMonotonicity=!1,this.trackedWrites=null,this.t
|
|
|
270
270
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
271
271
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
272
272
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
273
|
-
*/const Id=["video","audio","subtitle"],Rd=e=>{if(!e||"object"!=typeof e)throw new TypeError("metadata must be an object.");if(void 0!==e.languageCode&&!_n(e.languageCode))throw new TypeError("metadata.languageCode, when provided, must be a three-letter, ISO 639-2/T language code.");if(void 0!==e.name&&"string"!=typeof e.name)throw new TypeError("metadata.name, when provided, must be a string.");if(void 0!==e.disposition&&(e=>{if(!e||"object"!=typeof e)throw new TypeError("disposition must be an object.");if(void 0!==e.default&&"boolean"!=typeof e.default)throw new TypeError("disposition.default must be a boolean.");if(void 0!==e.forced&&"boolean"!=typeof e.forced)throw new TypeError("disposition.forced must be a boolean.");if(void 0!==e.original&&"boolean"!=typeof e.original)throw new TypeError("disposition.original must be a boolean.");if(void 0!==e.commentary&&"boolean"!=typeof e.commentary)throw new TypeError("disposition.commentary must be a boolean.");if(void 0!==e.hearingImpaired&&"boolean"!=typeof e.hearingImpaired)throw new TypeError("disposition.hearingImpaired must be a boolean.");if(void 0!==e.visuallyImpaired&&"boolean"!=typeof e.visuallyImpaired)throw new TypeError("disposition.visuallyImpaired must be a boolean.")})(e.disposition),void 0!==e.maximumPacketCount&&(!Number.isInteger(e.maximumPacketCount)||e.maximumPacketCount<0))throw new TypeError("metadata.maximumPacketCount, when provided, must be a non-negative integer.")};class Pd{constructor(e){if(this.state="pending",this._tracks=[],this._startPromise=null,this._cancelPromise=null,this._finalizePromise=null,this._mutex=new hn,this._metadataTags={},!e||"object"!=typeof e)throw new TypeError("options must be an object.");if(!(e.format instanceof yd))throw new TypeError("options.format must be an OutputFormat.");if(!(e.target instanceof ud))throw new TypeError("options.target must be a Target.");if(e.target._output)throw new Error("Target is already used for another output.");e.target._output=this,this.format=e.format,this.target=e.target,this._writer=e.target._createWriter(),this._muxer=e.format._createMuxer(this)}addVideoTrack(e,t={}){if(!(e instanceof Ed))throw new TypeError("source must be a VideoSource.");if(Rd(t),void 0!==t.rotation&&![0,90,180,270].includes(t.rotation))throw new TypeError(`Invalid video rotation: ${t.rotation}. Has to be 0, 90, 180 or 270.`);if(!this.format.supportsVideoRotationMetadata&&t.rotation)throw new Error(`${this.format._name} does not support video rotation metadata.`);if(void 0!==t.frameRate&&(!Number.isFinite(t.frameRate)||t.frameRate<=0))throw new TypeError(`Invalid video frame rate: ${t.frameRate}. Must be a positive number.`);this._addTrack("video",e,t)}addAudioTrack(e,t={}){if(!(e instanceof Ad))throw new TypeError("source must be an AudioSource.");Rd(t),this._addTrack("audio",e,t)}addSubtitleTrack(e,t={}){if(!(e instanceof Md))throw new TypeError("source must be a SubtitleSource.");Rd(t),this._addTrack("subtitle",e,t)}setMetadataTags(e){if((e=>{if(!e||"object"!=typeof e)throw new TypeError("tags must be an object.");if(void 0!==e.title&&"string"!=typeof e.title)throw new TypeError("tags.title, when provided, must be a string.");if(void 0!==e.description&&"string"!=typeof e.description)throw new TypeError("tags.description, when provided, must be a string.");if(void 0!==e.artist&&"string"!=typeof e.artist)throw new TypeError("tags.artist, when provided, must be a string.");if(void 0!==e.album&&"string"!=typeof e.album)throw new TypeError("tags.album, when provided, must be a string.");if(void 0!==e.albumArtist&&"string"!=typeof e.albumArtist)throw new TypeError("tags.albumArtist, when provided, must be a string.");if(void 0!==e.trackNumber&&(!Number.isInteger(e.trackNumber)||e.trackNumber<=0))throw new TypeError("tags.trackNumber, when provided, must be a positive integer.");if(void 0!==e.tracksTotal&&(!Number.isInteger(e.tracksTotal)||e.tracksTotal<=0))throw new TypeError("tags.tracksTotal, when provided, must be a positive integer.");if(void 0!==e.discNumber&&(!Number.isInteger(e.discNumber)||e.discNumber<=0))throw new TypeError("tags.discNumber, when provided, must be a positive integer.");if(void 0!==e.discsTotal&&(!Number.isInteger(e.discsTotal)||e.discsTotal<=0))throw new TypeError("tags.discsTotal, when provided, must be a positive integer.");if(void 0!==e.genre&&"string"!=typeof e.genre)throw new TypeError("tags.genre, when provided, must be a string.");if(void 0!==e.date&&(!(e.date instanceof Date)||Number.isNaN(e.date.getTime())))throw new TypeError("tags.date, when provided, must be a valid Date.");if(void 0!==e.lyrics&&"string"!=typeof e.lyrics)throw new TypeError("tags.lyrics, when provided, must be a string.");if(void 0!==e.images){if(!Array.isArray(e.images))throw new TypeError("tags.images, when provided, must be an array.");for(const t of e.images){if(!t||"object"!=typeof t)throw new TypeError("Each image in tags.images must be an object.");if(!(t.data instanceof Uint8Array))throw new TypeError("Each image.data must be a Uint8Array.");if("string"!=typeof t.mimeType)throw new TypeError("Each image.mimeType must be a string.");if(!["coverFront","coverBack","unknown"].includes(t.kind))throw new TypeError("Each image.kind must be 'coverFront', 'coverBack', or 'unknown'.")}}if(void 0!==e.comment&&"string"!=typeof e.comment)throw new TypeError("tags.comment, when provided, must be a string.");if(void 0!==e.raw){if(!e.raw||"object"!=typeof e.raw)throw new TypeError("tags.raw, when provided, must be an object.");for(const t of Object.values(e.raw))if(!(null===t||"string"==typeof t||t instanceof Uint8Array||t instanceof qn||t instanceof Kn))throw new TypeError("Each value in tags.raw must be a string, Uint8Array, RichImageData, AttachedFile, or null.")}})(e),"pending"!==this.state)throw new Error("Cannot set metadata tags after output has been started or canceled.");this._metadataTags=e}_addTrack(e,t,r){if("pending"!==this.state)throw new Error("Cannot add track after output has been started or canceled.");if(t._connectedTrack)throw new Error("Source is already used for a track.");const i=this.format.getSupportedTrackCounts(),a=this._tracks.reduce((t,r)=>t+(r.type===e?1:0),0),n=i[e].max;if(a===n)throw new Error(0===n?`${this.format._name} does not support ${e} tracks.`:`${this.format._name} does not support more than ${n} ${e} track`+(1===n?"":"s")+".");const o=i.total.max;if(this._tracks.length===o)throw new Error(`${this.format._name} does not support more than ${o} tracks`+(1===o?"":"s")+" in total.");const s={id:this._tracks.length+1,output:this,type:e,source:t,metadata:r};if("video"===s.type){const e=this.format.getSupportedVideoCodecs();if(0===e.length)throw new Error(`${this.format._name} does not support video tracks.`+this.format._codecUnsupportedHint(s.source._codec));if(!e.includes(s.source._codec))throw new Error(`Codec '${s.source._codec}' cannot be contained within ${this.format._name}. Supported video codecs are: ${e.map(e=>`'${e}'`).join(", ")}.`+this.format._codecUnsupportedHint(s.source._codec))}else if("audio"===s.type){const e=this.format.getSupportedAudioCodecs();if(0===e.length)throw new Error(`${this.format._name} does not support audio tracks.`+this.format._codecUnsupportedHint(s.source._codec));if(!e.includes(s.source._codec))throw new Error(`Codec '${s.source._codec}' cannot be contained within ${this.format._name}. Supported audio codecs are: ${e.map(e=>`'${e}'`).join(", ")}.`+this.format._codecUnsupportedHint(s.source._codec))}else if("subtitle"===s.type){const e=this.format.getSupportedSubtitleCodecs();if(0===e.length)throw new Error(`${this.format._name} does not support subtitle tracks.`+this.format._codecUnsupportedHint(s.source._codec));if(!e.includes(s.source._codec))throw new Error(`Codec '${s.source._codec}' cannot be contained within ${this.format._name}. Supported subtitle codecs are: ${e.map(e=>`'${e}'`).join(", ")}.`+this.format._codecUnsupportedHint(s.source._codec))}this._tracks.push(s),t._connectedTrack=s}async start(){const e=this.format.getSupportedTrackCounts();for(const t of Id){const r=this._tracks.reduce((e,r)=>e+(r.type===t?1:0),0),i=e[t].min;if(r<i)throw new Error(i===e[t].max?`${this.format._name} requires exactly ${i} ${t} track${1===i?"":"s"}.`:`${this.format._name} requires at least ${i} ${t} track${1===i?"":"s"}.`)}const t=e.total.min;if(this._tracks.length<t)throw new Error(t===e.total.max?`${this.format._name} requires exactly ${t} track`+(1===t?"":"s")+".":`${this.format._name} requires at least ${t} track`+(1===t?"":"s")+".");if("canceled"===this.state)throw new Error("Output has been canceled.");return this._startPromise?(console.warn("Output has already been started."),this._startPromise):this._startPromise=(async()=>{this.state="started",this._writer.start();const e=await this._mutex.acquire();await this._muxer.start();const t=this._tracks.map(e=>e.source._start());await Promise.all(t),e()})()}getMimeType(){return this._muxer.getMimeType()}async cancel(){return this._cancelPromise?(console.warn("Output has already been canceled."),this._cancelPromise):"finalizing"!==this.state&&"finalized"!==this.state?this._cancelPromise=(async()=>{this.state="canceled";const e=await this._mutex.acquire(),t=this._tracks.map(e=>e.source._flushOrWaitForOngoingClose(!0));await Promise.all(t),await this._writer.close(),e()})():void console.warn("Output has already been finalized.")}async finalize(){if("pending"===this.state)throw new Error("Cannot finalize before starting.");if("canceled"===this.state)throw new Error("Cannot finalize after canceling.");return this._finalizePromise?(console.warn("Output has already been finalized."),this._finalizePromise):this._finalizePromise=(async()=>{this.state="finalizing";const e=await this._mutex.acquire(),t=this._tracks.map(e=>e.source._flushOrWaitForOngoingClose(!1));await Promise.all(t),await this._muxer.finalize(),await this._writer.flush(),await this._writer.finalize(),this.state="finalized",e()})()}}var Od="VideoRange";function Dd(){return i(this,void 0,void 0,function(){return a(this,function(e){return[2,new Promise(function(e,t){var r=indexedDB.open("VideoEditorDB",1);r.onupgradeneeded=function(e){var t=e.target.result;t.objectStoreNames.contains(Od)||t.createObjectStore(Od,{keyPath:"id"})},r.onsuccess=function(){e(r.result)},r.onerror=function(){t("IndexedDB Error: ".concat(r.error))}})]})})}function Bd(e){return new Promise(function(t,r){e.onsuccess=function(){return t(e.result)},e.onerror=function(){return r(e.error)}})}function Fd(e){return new Promise(function(t,r){e.oncomplete=function(){return t(void 0)},e.onerror=function(){return r(e.error)}})}function Ld(e,t){return i(this,void 0,void 0,function(){var r;return a(this,function(i){switch(i.label){case 0:return t?[3,2]:[4,Dd()];case 1:t=i.sent(),i.label=2;case 2:return r=t.transaction(Od,"readonly"),[2,Bd(r.objectStore(Od).get(e))]}})})}function Nd(e,t){return i(this,void 0,void 0,function(){var r;return a(this,function(i){switch(i.label){case 0:return t?[3,2]:[4,Dd()];case 1:t=i.sent(),i.label=2;case 2:return r=t.transaction(Od,"readwrite"),[4,Bd(r.objectStore(Od).put(e))];case 3:return i.sent(),[4,Fd(r)];case 4:return i.sent(),[2]}})})}var Ud,zd,Wd,Vd=4194304;function Hd(e,t,n,o,s){return i(this,void 0,void 0,function(){var c,u,l,h,d,f,m,p,g,v,y,b;return a(this,function(x){switch(x.label){case 0:return(null==s?void 0:s.indexedDB)?[3,4]:[4,fetch(e,r(r({},s),{cache:"force-cache",headers:{"Cache-Control":"max-age=31536000",Range:"bytes=".concat(t,"-").concat(n)}}))];case 1:return 206!==(c=x.sent()).status?[3,3]:[4,c.arrayBuffer()];case 2:return[2,{status:206,arrayBuffer:x.sent()}];case 3:return[2,{status:c.status}];case 4:for(u=[],l=Vd*Math.floor(t/Vd),h=l;l<=n;)d=Math.min(o-1,l+Vd-1),u.push([l,d]),l=d+1;return[4,Dd()];case 5:return f=x.sent(),[4,Promise.all(u.map(function(t){return function(e,t,n,o,s){return i(this,void 0,void 0,function(){var i,c,u,l;return a(this,function(a){switch(a.label){case 0:return[4,Ld(i=e+":"+t+"-"+n,o)];case 1:return(c=a.sent())?[2,{status:206,arrayBuffer:c.arrayBuffer}]:[4,fetch(e,r(r({},s),{cache:"force-cache",headers:{"Cache-Control":"max-age=31536000",Range:"bytes=".concat(t,"-").concat(n)}}))];case 2:return 206!==(u=a.sent()).status?[3,5]:[4,u.arrayBuffer()];case 3:return l=a.sent(),[4,Nd({id:i,arrayBuffer:l})];case 4:return a.sent(),[2,{status:206,arrayBuffer:l}];case 5:return[2,{status:u.status}]}})})}(e,t[0],t[1],f,s)}))];case 6:for(m=x.sent(),p=new Uint8Array(u.length*Vd*8),g=0,v=m.length;g<v;g++){if(206!==(y=m[g]).status)return[2,{status:y.status}];b=new Uint8Array(y.arrayBuffer),p.set(b,g*Vd)}return[2,{status:206,arrayBuffer:p.buffer.slice(t-h,n-h+1)}]}})})}function Xd(e){return i(this,void 0,void 0,function(){return a(this,function(t){return[2,new Promise(function(t){return setTimeout(t,e)})]})})}!function(e){e[e.META=0]="META",e[e.DECODE=1]="DECODE",e[e.RELEASE=2]="RELEASE"}(Ud||(Ud={})),function(e){e.META="meta",e.ERROR="error",e.DECODED="decoded"}(zd||(zd={})),function(e){e[e.NONE=0]="NONE",e[e.DECODING=1]="DECODING",e[e.DECODED=2]="DECODED",e[e.DECODED_FRAME=3]="DECODED_FRAME",e[e.ERROR=4]="ERROR"}(Wd||(Wd={}));var jd,Gd,Yd={},qd=function(e){return i(void 0,void 0,void 0,function(){var t,r,n,s,c,u,l,h,d,f,m,p,g,v,y,b,x,T,w,k,S,E,C,A,_,M,I,R,P,O,D,B,F,L,N,U,z,W,V,H,X,j,G,Y,q,K,$,Q,Z,J,ee,te,re,ie,ae,ne,oe,se,ce,ue,le,he,de,fe,me,pe,ge,ve,ye,be,xe,Te,we,ke,Se,Ee,Ce,Ae,_e,Me,Ie;return a(this,function(Re){switch(Re.label){case 0:return t=e.data,r=t.url,n=t.id,s=t.type,c=t.isWorker,u=function(e){var t={url:r,type:zd.ERROR,data:e};return c&&self.postMessage(t),{data:t}},Yd[r]||(Yd[r]={gopList:[]}),l=Yd[r],s!==Ud.META?[3,38]:[4,fetch(r,{method:"HEAD"})];case 1:if(h=Re.sent(),!(d=h.headers.get("content-length"))||200!==h.status&&304!==h.status)return[2,u("Unknown content-length")];f=parseInt(d),m={duration:0,fileSize:f},p=void 0,p=e.data.preloadAll?new Zu(r):new Ju({read:function(t,n){return i(void 0,void 0,void 0,function(){var i;return a(this,function(a){switch(a.label){case 0:return[4,Hd(r,t,n-1,f,{indexedDB:e.data.indexedDB})];case 1:if(!(i=a.sent().arrayBuffer))throw new Error("Missing buffer in range: "+t+"-"+(n-1));return[2,new Uint8Array(i)]}})})},getSize:function(){return i(void 0,void 0,void 0,function(){return a(this,function(e){return[2,f]})})},prefetchProfile:"network"}),g=new rl({formats:qu,source:p}),Re.label=2;case 2:return Re.trys.push([2,4,,5]),[4,g.computeDuration()];case 3:return v=Re.sent(),m.duration=1e3*v,[3,5];case 4:return y=Re.sent(),[2,u(y.message)];case 5:return[4,g.getPrimaryVideoTrack()];case 6:return(b=Re.sent())?(l.videoTrack=b,[4,b.computeDuration()]):[3,21];case 7:oe=Re.sent(),K=new Ps(b),Re.label=8;case 8:Re.trys.push([8,13,14,19]),x=!0,T=o(K.packets(void 0,void 0,{metadataOnly:!0})),Re.label=9;case 9:return[4,T.next()];case 10:if(w=Re.sent(),pe=w.done)return[3,12];if(ye=w.value,x=!1,"key"===(O=ye).type){if(k=l.gopList.length){if(N=l.gopList[k-1],e.data.gopMinDuration&&1e3*O.timestamp-N.timestamp<e.data.gopMinDuration)return[3,11];N.duration=N.audioDuration=1e3*O.timestamp-N.timestamp}l.gopList.push({state:Wd.NONE,index:l.gopList.length,sequenceNumber:O.sequenceNumber,timestamp:1e3*O.timestamp,duration:1e3*O.duration,audioTimestamp:1e3*O.timestamp,audioDuration:1e3*O.duration,users:[]})}Re.label=11;case 11:return x=!0,[3,9];case 12:return[3,19];case 13:return S=Re.sent(),ge={error:S},[3,19];case 14:return Re.trys.push([14,,17,18]),x||pe||!(ve=T.return)?[3,16]:[4,ve.call(T)];case 15:Re.sent(),Re.label=16;case 16:return[3,18];case 17:if(ge)throw ge.error;return[7];case 18:return[7];case 19:return(L=l.gopList.length)&&((N=l.gopList[L-1]).duration=N.audioDuration=1e3*oe-N.timestamp),[4,b.getFirstTimestamp()];case 20:ne=Re.sent(),m.video={id:b.id,languageCode:b.languageCode,codec:b.codec,name:b.name,codedWidth:b.codedWidth,codedHeight:b.codedHeight,displayWidth:b.displayWidth,displayHeight:b.displayHeight,width:b.displayWidth,height:b.displayHeight,timeResolution:b.timeResolution,rotation:b.rotation,timestamp:1e3*ne,duration:1e3*oe},Re.label=21;case 21:return[4,g.getPrimaryAudioTrack()];case 22:return(E=Re.sent())?(l.audioTrack=E,[4,E.computeDuration()]):[3,37];case 23:return oe=Re.sent(),[4,E.getFirstTimestamp()];case 24:if(ne=Re.sent(),m.audio={id:E.id,languageCode:E.languageCode,codec:E.codec,name:E.name,numberOfChannels:E.numberOfChannels,sampleRate:E.sampleRate,timestamp:1e3*ne,duration:1e3*oe},b)return[3,37];C=e.data.gopMinDuration||5e3,K=new Ps(E),A=-1,_=!0,M=0,Re.label=25;case 25:Re.trys.push([25,30,31,36]),I=!0,R=o(K.packets(void 0,void 0,{metadataOnly:!0})),Re.label=26;case 26:return[4,R.next()];case 27:if(P=Re.sent(),be=P.done)return[3,29];we=P.value,I=!1,O=we,-1===A&&(A=O.timestamp),D=O.timestamp-A,(_||1e3*D>=C)&&(_=!1,(B=l.gopList.length)&&((N=l.gopList[B-1]).duration=N.audioDuration=1e3*O.timestamp-N.timestamp),l.gopList.push({state:Wd.NONE,index:l.gopList.length,sequenceNumber:M,timestamp:1e3*O.timestamp,duration:1e3*O.duration,audioTimestamp:1e3*O.timestamp,audioDuration:1e3*O.duration,users:[]}),A=O.timestamp),M++,Re.label=28;case 28:return I=!0,[3,26];case 29:return[3,36];case 30:return F=Re.sent(),xe={error:F},[3,36];case 31:return Re.trys.push([31,,34,35]),I||be||!(Te=R.return)?[3,33]:[4,Te.call(R)];case 32:Re.sent(),Re.label=33;case 33:return[3,35];case 34:if(xe)throw xe.error;return[7];case 35:return[7];case 36:(L=l.gopList.length)&&((N=l.gopList[L-1]).duration=N.audioDuration=1e3*oe-N.timestamp),Re.label=37;case 37:return U=l.gopList.map(function(e){return{index:e.index,sequenceNumber:e.sequenceNumber,timestamp:e.timestamp,duration:e.duration,audioTimestamp:e.audioTimestamp,audioDuration:e.audioDuration}}),de={url:r,type:zd.META,data:{meta:m,simpleGOPList:U}},c&&self.postMessage(de),[2,{data:de}];case 38:return s!==Ud.DECODE?[3,64]:(fe=l.gopList[e.data.index])&&fe.state!==Wd.ERROR?fe.state===Wd.DECODED?[2]:(fe.users.includes(n)||fe.users.push(n),[4,Xd(100)]):[2];case 39:if(Re.sent(),!fe.users.includes(n))return[2];if(fe.state===Wd.DECODING||fe.state===Wd.DECODED)return[2];if(fe.state=Wd.DECODING,z=[],!l.videoTrack)return[3,51];K=new Ns(l.videoTrack),Re.label=40;case 40:Re.trys.push([40,45,46,51]),W=!0,V=o(K.samples(.001*fe.timestamp,.001*(fe.timestamp+fe.duration))),Re.label=41;case 41:return[4,V.next()];case 42:if(H=Re.sent(),ke=H.done)return[3,44];Ce=H.value,W=!1,re=Ce,z.push(re.toVideoFrame()),re.close(),Re.label=43;case 43:return W=!0,[3,41];case 44:return[3,51];case 45:return X=Re.sent(),Se={error:X},[3,51];case 46:return Re.trys.push([46,,49,50]),W||ke||!(Ee=V.return)?[3,48]:[4,Ee.call(V)];case 47:Re.sent(),Re.label=48;case 48:return[3,50];case 49:if(Se)throw Se.error;return[7];case 50:return[7];case 51:if(j=[],G=0,Y=-1,q=0,!l.audioTrack||e.data.mute||fe.didAudioChunk)return[3,63];fe.didAudioChunk=!0,K=new Ws(l.audioTrack),$=.001*fe.timestamp,Q=.001*(fe.timestamp+fe.duration),Z=K.samples($,Q),Re.label=52;case 52:Re.trys.push([52,57,58,63]),J=!0,ee=o(Z),Re.label=53;case 53:return[4,ee.next()];case 54:if(te=Re.sent(),Ae=te.done)return[3,56];if(Ie=te.value,J=!1,G=(re=Ie).sampleRate,ie=re.numberOfChannels,ae=re.numberOfFrames,ne=re.timestamp,oe=re.duration,ne>=Q&&fe.index<l.gopList.length-1||ne<$)return[3,55];for(-1===Y&&(Y=1e3*ne),q=1e3*ne-Y+1e3*oe,se=[],ce=0;ce<ie;ce++)ue=new Float32Array(ae),re.copyTo(ue,{planeIndex:ce,format:"f32-planar"}),se.push(ue);j.push({format:"f32-planar",channels:se,sampleRate:G,numberOfFrames:ae,numberOfChannels:ie,timestamp:1e3*ne,duration:1e3*oe}),re.close(),Re.label=55;case 55:return J=!0,[3,53];case 56:return[3,63];case 57:return le=Re.sent(),_e={error:le},[3,63];case 58:return Re.trys.push([58,,61,62]),J||Ae||!(Me=ee.return)?[3,60]:[4,Me.call(ee)];case 59:Re.sent(),Re.label=60;case 60:return[3,62];case 61:if(_e)throw _e.error;return[7];case 62:return[7];case 63:return fe.state!==Wd.DECODING?(fe.didAudioChunk=!1,z.forEach(function(e){e.close()}),[2]):(fe.state=Wd.DECODED,he=[],z.forEach(function(e){return he.push(e)}),j.forEach(function(e){e.channels.forEach(function(e){he.push(e.buffer)})}),de={url:r,type:zd.DECODED,data:{index:e.data.index,videoFrames:z,audioChunks:j,sampleRate:G,audioTimeStamp:Y,audioDuration:q}},c&&self.postMessage(de,he),[2,{data:de}]);case 64:if(s===Ud.RELEASE){if(!(fe=l.gopList[e.data.index]))return[2];(me=fe.users.indexOf(e.data.id))>-1&&fe.users.splice(me,1),fe.users.length||(fe.state=Wd.NONE,fe.didAudioChunk=!1)}Re.label=65;case 65:return[2]}})})};self.onmessage=qd,function(e){e.META="meta",e.LOADED="loaded",e.ERROR="error",e.PROGRESS="progress",e.CANPLAY="canplay",e.AUDIO_BUFFER="audio_buffer"}(jd||(jd={})),function(e){e[e.NONE=0]="NONE",e[e.LOADING_META=1]="LOADING_META",e[e.META=2]="META",e[e.LOADED=3]="LOADED",e[e.ERROR=4]="ERROR"}(Gd||(Gd={}));var Kd,$d={},Qd=0,Zd=0,Jd=function(e){function i(t){var r=e.call(this)||this;return r.url=t,r.id=Qd++,r.currentTime=-1/0,r.gopIndex=-1,r.error=!1,r}return t(i,e),i.prototype.initWorker=function(){if(!Kd){if(L.decoderWorker)Kd=new Worker(L.decoderWorker);else if(L.decoderWorkerStr){var e=new Blob([L.decoderWorkerStr.trim()],{type:"application/javascript"}),t=URL.createObjectURL(e);Kd=new Worker(t)}var i=function(e){var t,i,a;if(null==e?void 0:e.data){var n=e.data,o=n.url,s=n.type,c=n.data,u=$d[o];if(u)if(s===zd.META)u.state=Gd.META,u.meta=c.meta,u.gopList=c.simpleGOPList.map(function(e){return r(r({},e),{state:Wd.NONE,videoFrames:[],users:[]})}),u.metaList.splice(0).forEach(function(e){e.start(e.currentTime),e.emit(jd.META,c.meta)});else if(s===zd.DECODED){var l=u.gopList[c.index];if(l){if(l.state=Wd.DECODED,l.videoFrames.forEach(function(e){return e.close()}),null===(t=l.audioBufferSourceNode)||void 0===t||t.stop(),null===(i=l.audioBufferSourceNode)||void 0===i||i.disconnect(),l.audioBuffer=void 0,l.videoFrames=c.videoFrames,null===(a=c.audioChunks)||void 0===a?void 0:a.length){var h=c.audioChunks.reduce(function(e,t){return e+t.numberOfFrames},0),d=new OfflineAudioContext(c.audioChunks[0].numberOfChannels,h,c.sampleRate).createBuffer(c.audioChunks[0].channels.length,h,c.sampleRate),f=0;c.audioChunks.forEach(function(e){for(var t=0;t<e.channels.length;t++){d.getChannelData(t).set(e.channels[t],f)}f+=e.numberOfFrames}),l.audioBuffer=d}l.users.forEach(function(e){e.gopIndex===l.index&&e.emit(jd.CANPLAY,l),l.audioBuffer&&e.gopIndex<l.index&&e.emit(jd.AUDIO_BUFFER,l)})}}else s===zd.ERROR&&u.metaList.forEach(function(e){e.error=!0,e.emit(jd.ERROR,c)})}};Kd?Kd.onmessage=i:this.onMessage=i}},i.prototype.start=function(e){var t=this;this.initWorker(),this.currentTime,this.currentTime=e;var r=this.url,i=this.id,a=$d[r];if(a)a.state===Gd.LOADING_META?a.metaList.includes(this)||(a.metaList.push(this),a.loadList.push(this),a.count++):a.state===Gd.META?(a.loadList.includes(this)||(a.loadList.push(this),a.count++,this.emit(jd.META,a.meta)),this.process(e)):a.state===Gd.ERROR&&this.emit(jd.ERROR,a.error);else{$d[r]={state:Gd.LOADING_META,metaList:[this],loadList:[this],meta:{duration:0,fileSize:0},gopList:[],singleHash:{},count:1};var n={url:r,id:i,type:Ud.META,messageId:Zd++,isWorker:!!L.decoderWorker||!!L.decoderWorkerStr,indexedDB:L.indexedDB,preloadAll:L.preloadAll,gopMinDuration:L.gopMinDuration};Kd?Kd.postMessage(n):qd({data:n}).then(function(e){t.onMessage&&t.onMessage(e)})}},i.prototype.process=function(e){if(e<-L.decodeNextDuration)this.releaseGOPList();else{var t=$d[this.url];if(t&&t.state!==Gd.NONE&&t.state!==Gd.LOADING_META){var r=t.meta.duration,i=t.gopList;if(i.length)if(e>=r+L.decodeNextDuration)this.releaseGOPList();else{var a=this.getForwardsNearestGOPIndex(e);this.gopIndex=a;var n=i[a];if(n){this.decodeGOP(n);for(var o=a-1;o>=0;o--){var s=i[o];s&&s.timestamp+s.duration<e-L.releasePrevDuration&&this.releaseGOP(s)}o=a+1;for(var c=i.length;o<c;o++){var u=i[o];u&&u.timestamp<e+L.decodeNextDuration?this.decodeGOP(u):u&&u.timestamp>=e+L.decodeNextDuration&&this.releaseGOP(u)}}}}}},i.prototype.getForwardsNearestGOPIndex=function(e){var t=$d[this.url],r=t.meta.duration,i=t.gopList;if(e<-L.decodeNextDuration||!i.length||e>r+.001)return-1;if(1===i.length||e<=0)return 0;if(e>r)return i.length-1;for(var a=0,n=i.length-1;a<n;){if(a===n-1)return i[n].timestamp<=e?n:a;var o=a+(n-a>>1),s=i[o].timestamp;if(s===e)return o;s>e?n=Math.max(o-1,a+1):a=Math.min(o,n-1)}return-1},i.prototype.getFrameByTime=function(e){var t=$d[this.url],r=t.meta.duration,i=t.gopList;if(!(e<0||!i.length||e>r+.001)){var a;if(1===i.length)a=i[0];else(o=this.getForwardsNearestGOPIndex(e))>-1&&(a=i[o]);if(a&&a.state===Wd.DECODED){var n=a.videoFrames;if(!n.length)return;if(1===n.length)return n[0];for(var o=0,s=n.length-1;o<s;){if(o===s-1){var c=n[s];return.001*c.timestamp<=e?c:n[o]}var u=o+(s-o>>1),l=n[u],h=.001*l.timestamp;if(h===e||h<e&&h+.001*(l.duration||0)>e)return n[u];h>e?s=Math.max(u-1,o+1):o=Math.min(u,s-1)}}}},i.prototype.decodeGOP=function(e){var t=this;if(e.state!==Wd.ERROR){var r=!1;if(e.users.includes(this)||(r=!0,e.users.push(this)),e.state!==Wd.DECODED){if(e.state!==Wd.DECODING){e.state=Wd.DECODING,e.videoFrames.splice(0).forEach(function(e){return e.close()}),e.audioBufferSourceNode&&(e.audioBufferSourceNode.stop(),e.audioBufferSourceNode.disconnect(),e.audioBufferSourceNode=void 0),e.audioBuffer=void 0;var i={url:this.url,type:Ud.DECODE,id:this.id,messageId:Zd++,isWorker:!!L.decoderWorker||!!L.decoderWorkerStr,index:e.index,mute:L.mute};Kd?Kd.postMessage(i):qd({data:i}).then(function(e){t.onMessage&&t.onMessage(e)})}}else r&&this.emit(jd.CANPLAY,e)}},i.prototype.releaseGOP=function(e){var t,r,i=this,a=e.users.indexOf(this);if(a>-1){e.users.splice(a,1),e.users.length||(e.state!==Wd.DECODING&&e.state!==Wd.DECODED||(e.state=Wd.NONE),e.videoFrames.splice(0).forEach(function(e){return e.close()}),null===(t=e.audioBufferSourceNode)||void 0===t||t.stop(),null===(r=e.audioBufferSourceNode)||void 0===r||r.disconnect(),e.audioBuffer=void 0);var n={url:this.url,type:Ud.RELEASE,id:this.id,index:e.index,messageId:Zd++,isWorker:!!L.decoderWorker||!!L.decoderWorkerStr};Kd?Kd.postMessage(n):qd({data:n}).then(function(e){i.onMessage&&i.onMessage(e)})}},i.prototype.releaseGOPList=function(){var e=this;$d[this.url].gopList.forEach(function(t){e.releaseGOP(t)})},i.prototype.release=function(){this.releaseGOPList();var e=$d[this.url];if(!e)throw new Error("Unknown release url: "+this.url);var t=e.metaList.indexOf(this);t>-1&&e.metaList.splice(t,1),(t=e.loadList.indexOf(this))>-1&&e.loadList.splice(t,1),e.count--,e.count||delete $d[this.url]},Object.defineProperty(i.prototype,"gopList",{get:function(){var e;return null===(e=$d[this.url])||void 0===e?void 0:e.gopList},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"currentGOP",{get:function(){var e;return null===(e=$d[this.url])||void 0===e?void 0:e.gopList[this.gopIndex]},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"cache",{get:function(){return $d[this.url]},enumerable:!1,configurable:!0}),i}(M),ef=function(e){function r(t){var r,i=e.call(this,t)||this;t.onMeta&&(i.onMeta=t.onMeta),t.onCanplay&&(i.onCanplay=t.onCanplay),t.onError&&(i.onError=t.onError),t.onWaiting&&(i.onWaiting=t.onWaiting),i._currentTime=t.currentTime||0,i._volumn=Math.max(0,Math.min(1,null!==(r=t.volumn)&&void 0!==r?r:1)),i.isPure=!0;var a=i._src=t.src||"";if(a){i._currentTime>=0&&(i.contentLoadingNum=1);var n=i._decoder=new Jd(a);n.on(jd.META,function(e){if(i._metaData=e,i._currentTime>=0&&i._currentTime<e.duration?i.contentLoadingNum=1:i.contentLoadingNum=0,i.isMounted){var t=i.style,r=t.left,a=t.top,n=t.right,o=t.bottom,s=t.width,c=t.height;(r.u!==V.AUTO&&n.u!==V.AUTO||s.u!==V.AUTO)&&(a.u!==V.AUTO&&o.u!==V.AUTO||c.u!==V.AUTO)||i.refresh(ci.REFLOW)}i.onMeta&&i.onMeta(e),i.emit(Ia,e)}),n.on(jd.ERROR,function(e){oe.error(e),i.contentLoadingNum=0,i.onError&&i.onError(e),i.emit(Ra,e),i.refresh()}),n.on(jd.CANPLAY,function(e){var t=n.getFrameByTime(i._currentTime);i.videoFrame=t,i.contentLoadingNum=0,i.onCanplay&&i.onCanplay(),i.emit(Ma),i.refresh()}),n.on([jd.CANPLAY,jd.AUDIO_BUFFER],function(e){var t=i.root;if(t&&e.audioBuffer){var r=t.audioContext,a=i.timeAnimation;if("running"===(null==a?void 0:a.playState)&&r){var n=a.currentTime-a.delay;if(n>=e.timestamp+e.duration||a.duration<=e.timestamp)return;var o=r.createBufferSource();o.buffer=e.audioBuffer,i.gainNode||(i.gainNode=r.createGain(),i.gainNode.gain.value=i.volumn,i.gainNode.connect(r.destination)),o.connect(i.gainNode),n>=e.audioTimestamp?o.start(0,.001*(n-e.audioTimestamp),.001*(a.duration-n)):o.start(r.currentTime+.001*(e.audioTimestamp-n),0,.001*(a.duration-e.audioTimestamp))}}}),n.start(i._currentTime)}return i}return t(r,e),r.prototype.lay=function(t){e.prototype.lay.call(this,t);var r=this,i=r.style,a=r.computedStyle,n=r._metaData,o=i.left,s=i.top,c=i.right,u=i.bottom,l=i.width,h=i.height;if(null==n?void 0:n.video){var d=(o.u===V.AUTO||c.u===V.AUTO)&&l.u===V.AUTO,f=(s.u===V.AUTO||u.u===V.AUTO)&&h.u===V.AUTO;d&&(a.width=f?n.video.width:n.video.height*a.height/n.video.height,o.u===V.AUTO&&c.u===V.AUTO?(a.left=0,a.right=t.w-a.width):o.u===V.AUTO?a.left=t.w-a.right-a.width:c.u===V.AUTO&&(a.right=t.w-a.left-a.width)),f&&(a.height=d?n.video.height:n.video.height*a.width/n.video.width,s.u===V.AUTO&&u.u===V.AUTO?(a.top=0,a.bottom=t.h-a.height):s.u===V.AUTO?a.top=t.h-a.bottom-a.height:u.u===V.AUTO&&(a.bottom=t.h-a.top-a.height))}},r.prototype.calRepaintStyle=function(t){e.prototype.calRepaintStyle.call(this,t);var r=this.computedStyle,i=this.videoFrame;if(this.isPure=r.backgroundColor[3]<=0,this.isPure&&i){var a=r.objectFit,n=r.borderTopLeftRadius,o=r.borderTopRightRadius,s=r.borderBottomLeftRadius,c=r.borderBottomRightRadius;if(a!==ae.COVER&&a!==ae.FILL||!(n||o||s||c)){if(a===ae.CONTAIN&&(n||o||s||c)){var u=i.displayWidth/i.displayHeight,l=r.width/r.height;if(l>u){var h=r.height*u,d=.5*(r.width-h);(n>d||o>d||s>d||c>d)&&(this.isPure=!1)}else if(l<u){var f=r.width/u,m=.5*(r.height-f);(n>m||o>m||s>m||c>m)&&(this.isPure=!1)}else this.isPure=!1}}else this.isPure=!1}},r.prototype.calContent=function(){return this.hasContent=!1,(this._videoFrame||this.computedStyle.backgroundColor[3]>0)&&(this.hasContent=!0),this.hasContent},r.prototype.renderCanvas=function(){var t,r,i=this,a=i.isPure,n=i.videoFrame,o=i.computedStyle;if(a){if(null===(t=this.canvasCache)||void 0===t||t.release(),n&&(n.displayWidth>L.maxTextureSize||n.displayHeight>L.maxTextureSize))if((b=this.canvasCache=xi.getVideoFrameInstance(n.displayWidth,n.displayHeight,n)).available=!0,1===b.getCount()){var s=o.width,c=o.height,u=o.objectFit,l=0,h=0,d=n.displayWidth/n.displayHeight,f=s/c;if(u===ae.CONTAIN){if(f>d)l=.5*(s-(T=c*d)),s=T;else if(f<d){h=.5*(c-(w=s/d)),c=w}}else if(u===ae.COVER){if(f>d)h=.5*(c-(w=s/d)),c=w;else if(f<d){l=.5*(s-(T=c*d)),s=T}}for(var m=0,p=(A=b.list).length;m<p;m++){var g=A[m],v=g.x,y=g.y;g.os.ctx.drawImage(n,-v+l,-y+h,s,c)}}}else{e.prototype.renderCanvas.call(this);var b,x=this._bboxInt||this.bboxInt,T=(v=x[0],y=x[1],x[2]-v),w=x[3]-y;l=0,h=0,s=o.width,c=o.height,u=o.objectFit;if(n){d=n.displayWidth/n.displayHeight,f=s/c;if(u===ae.CONTAIN){if(f>d){var k=c*d;l+=.5*(s-k),s=k}else if(f<d){var S=s/d;h+=.5*(c-S),c=S}}else if(u===ae.COVER)if(f>d){var E=s/d;h=.5*(c-E),c=E}else if(f<d){var C=c*d;l=.5*(s-C),s=C}}(b=this.canvasCache=(null===(r=this.canvasCache)||void 0===r?void 0:r.available)?this.canvasCache:new xi(T,w,-v,-y)).available=!0;var A;for(m=0,p=(A=b.list).length;m<p;m++){var _=A[m],M=_.x,I=_.y,R=_.os.ctx,P=-M,O=-I;n&&R.drawImage(n,P+l,O+h,s,c)}}},r.prototype.genTexture=function(t){var r=this,i=r.isPure,a=r.videoFrame,n=r.canvasCache;if(i){if(a)if(a.displayWidth>L.maxTextureSize||a.displayHeight>L.maxTextureSize)if((null==n?void 0:n.available)&&Zi.hasCanvasCacheInstance(n)){var o=Zi.getCanvasCacheInstance(t,n,this._rect||this.rect);this.textureTarget=this.textureCache=o}else{this.renderCanvas();o=Zi.getCanvasCacheInstance(t,this.canvasCache,this._rect||this.rect);this.textureTarget=this.textureCache=o,this.canvasCache.release()}else{var s=this.computedStyle,c=s.width,u=s.height,l=s.objectFit,h=this._rect||this.rect,d=(o=void 0,a.displayWidth/a.displayHeight),f=c/u;if(l===ae.CONTAIN){if(f>d){var m=.5*(c-(v=u*d));(h=h.slice(0))[0]+=m,h[2]-=m}else if(f<d){m=.5*(u-(p=c/d));(h=h.slice(0))[1]+=m,h[3]-=m}}else if(l===ae.COVER)if(f>d){var p=c/d;o={x1:0,y3:g=(m=.5*Math.abs(u-p))/p,x3:1,y1:1-g}}else if(f<d){var g,v=u*d;o={x1:g=(m=.5*Math.abs(c-v))/v,y3:0,x3:1-g,y1:1}}var y=Zi.getVideoFrameInstance(t,a,h,o);this.textureTarget=this.textureCache=y}}else e.prototype.genTexture.call(this,t)},r.prototype.calContentLoading=function(){var t=e.prototype.calContentLoading.call(this);if(t){if(this._currentTime>=0){if(!this._metaData)return t;if(this._currentTime<this._metaData.duration)return t}return 0}return t},r.prototype.release=function(){e.prototype.release.call(this);var t=this._decoder,r=this.gainNode;t&&t.release(),r&&(r.disconnect(),this.gainNode=void 0)},r.prototype.timeAnimate=function(e,t){var r;null===(r=this.timeAnimation)||void 0===r||r.remove();var i=this.timeAnimation=new Ha(this,e,t);return this.initAnimate(i,t)},r.prototype.cloneProps=function(){var t=e.prototype.cloneProps.call(this);return t.src=this._src,t.currentTime=this._currentTime,t.volumn=this._volumn,t},r.prototype.clone=function(){return new r(this.cloneProps())},Object.defineProperty(r.prototype,"src",{get:function(){return this._src},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"currentTime",{get:function(){return this._currentTime},set:function(e){var t;if(this._currentTime!==e){this._currentTime=e;var r=this._decoder;if(r){var i=e;r.start(i);var a=this._videoFrame,n=r.getFrameByTime(i);this.videoFrame=n,this.contentLoadingNum=0,!n&&(null===(t=r.currentGOP)||void 0===t?void 0:t.state)===Wd.DECODING&&e>=0&&!r.error&&(this._metaData&&this._metaData.duration,this.contentLoadingNum=1),a&&!n&&this._metaData&&e>=0&&e<this._metaData.duration&&!r.error&&(this.onWaiting&&this.onWaiting(),this.emit(_a))}}},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"duration",{get:function(){var e;return(null===(e=this._metaData)||void 0===e?void 0:e.duration)||0},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"metaData",{get:function(){return this._metaData},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"volumn",{get:function(){return this._volumn},set:function(e){var t=Math.max(0,Math.min(1,e));this._volumn!==t&&(this._volumn=t,this.gainNode&&(this.gainNode.gain.value=t))},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"decoder",{get:function(){return this._decoder},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"videoFrame",{get:function(){return this._videoFrame},set:function(e){this._videoFrame!==e&&(this._videoFrame=e,this.refresh())},enumerable:!1,configurable:!0}),r}(ka);function tf(e,t,r,i,a,n,o){for(var s=L.maxTextureSize,c=s-2*o,u=[],l=t.bbox,h=a,d=n,f=0,m=Math.ceil(d/c);f<m;f++)for(var p=1,g=Math.ceil(h/s);p<g;p++){var v=Math.max(l[0],r+p*s-2*o),y=Math.max(l[1],i+f*c-o),b=Math.min(l[2],v+4*o),x=Math.min(l[3],y+c+2*o),T=new Float32Array([v,y,b,x]);v>l[2]-2*o&&(v=T[0]=Math.max(l[0],l[2]-2*o),b=T[2]=l[2]),y>l[3]-2*o&&(y=T[1]=Math.max(l[1],l[3]-2*o),x=T[3]=l[3]);var w=T[2]-T[0],k=T[3]-T[1];u.push({bbox:T,w:w,h:k,t:ki(e,0,void 0,w,k),x1:Math.max(l[0],v+o),y1:Math.max(l[1],f?y+o:y),x2:Math.min(l[2],b-o),y2:Math.min(l[3],f===m-1?x:y+c+o)})}for(f=1,m=Math.ceil(d/s);f<m;f++)for(p=0,g=Math.ceil(h/c);p<g;p++){v=Math.max(l[0],r+p*c-o),y=Math.max(l[1],i+f*s-2*o),b=Math.min(l[2],v+c+2*o),x=Math.min(l[3],y+4*o),T=new Float32Array([v,y,b,x]);v>l[2]-2*o&&(v=T[0]=Math.max(l[0],l[2]-2*o),b=T[2]=l[2]),y>l[3]-2*o&&(y=T[1]=Math.max(l[1],l[3]-2*o),x=T[3]=l[3]);var S=T[2]-T[0],E=T[3]-T[1];u.push({bbox:T,w:S,h:E,t:ki(e,0,void 0,S,E),x1:Math.max(l[0],p?v+o:v),y1:Math.max(l[1],y+o),x2:Math.min(l[2],p===g-1?b:v+c+o),y2:Math.min(l[3],x-o)})}return u}function rf(e,t,r,i,a,n){Va.useProgram(e,t),e.blendFunc(e.ONE,e.ZERO);for(var o=r.list,s=0,c=o.length;s<c;s++){var u=o[s],l=u.bbox,h=u.w,d=u.h,f=u.t;e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,f,0),e.viewport(0,0,h,d);for(var m=.5*h,p=.5*d,g=0,v=i.length;g<v;g++){var y=i[g],b=y.bbox,x=y.w,T=y.h,w=y.t,k=b.slice(0);k[0]!==a[0]&&(k[0]+=n),k[1]!==a[1]&&(k[1]+=n),k[2]!==a[2]&&(k[2]-=n),k[3]!==a[3]&&(k[3]-=n);var S=k[2]-k[0],E=k[3]-k[1];za(l,void 0,k[0],k[1],S,E)&&Ei(e,m,p,t,{opacity:1,bbox:k,t:w,tc:{x1:(k[0]===a[0]?0:n)/x,y1:(k[1]===a[1]?0:n)/T,x3:(k[2]===a[2]?x:x-n)/x,y3:(k[3]===a[3]?T:T-n)/T},dx:-l[0],dy:-l[1]})}}e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA),i.forEach(function(t){return e.deleteTexture(t.t)})}function af(e,t,r,i,a,n,o,s){for(var c,u=L.maxTextureSize,l=r.list,h=i.list,d=0,f=Math.ceil(s/u);d<f;d++)for(var m=0,p=Math.ceil(o/u);m<p;m++){var g=m===p-1?o-m*u:u,v=d===f-1?s-d*u:u,y=ki(e,0,void 0,g,v),b=a+m*u,x=n+d*u,T=g,w=v,k={bbox:new Float32Array([b,x,b+T,x+w]),w:g,h:v,t:y};h.push(k),c?(e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,y,0),e.viewport(0,0,g,v)):c=La(e,y,g,v);for(var S=.5*g,E=.5*v,C=0,A=l.length;C<A;C++){var _=l[C],M=_.bbox,I=_.t;I&&za(M,void 0,b,x,T,w)&&Ei(e,S,E,t,{opacity:1,bbox:M,t:I,dx:-b,dy:-x})}}return c}function nf(e,t,r){var i,a;if((e instanceof ef||e instanceof Oa)&&e.isPure)if(e instanceof ef){var n=e.metaData;if((null===(i=null==n?void 0:n.video)||void 0===i?void 0:i.displayWidth)!==t||n.video.displayHeight!==r)return!0}else if((null===(a=e.loader)||void 0===a?void 0:a.width)!==t||e.loader.height!==r)return!0;return!1}function of(e,t,r,i,a,n,o){var s=t.programs,c=s.box,u=s.dualDown,l=s.dualUp,h=n,d=o,f=void 0;if(i){Va.useProgram(e,u),f=a;for(var m=1;m<=i;m++){var p=Math.ceil(n*Math.pow(.5,m)),g=Math.ceil(o*Math.pow(.5,m));e.viewport(0,0,p,g),f=Ui(e,u,y=f,h,d,p,g),y!==a&&e.deleteTexture(y),h=p,d=g}}Va.useProgram(e,c),e.viewport(0,0,h,d);var v=function(e,t,r,i,a,n){var o=Li(e,t),s=o.pointBuffer,c=o.a_position,u=o.texBuffer,l=o.a_texCoords,h=t.uniform.u_texture,d=t.uniform.u_pw,f=t.uniform.u_ph;e.uniform1f(d,1/i),e.uniform1f(f,1/a);for(var m=t.uniform.u_direction,p=t.uniform.u_r,g=r,v=ki(e,0,void 0,i,a),y=ki(e,0,void 0,i,a),b=0,x=n.length;b<x;b++){var T=n[b]-1>>1;e.uniform1i(p,T),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,v,0),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),Si(e,g,0),e.uniform1i(h,0),e.uniform1i(m,0),e.drawArrays(e.TRIANGLE_STRIP,0,4),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,y,0),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),Si(e,v,0),e.uniform1i(m,1),e.drawArrays(e.TRIANGLE_STRIP,0,4),g=y}return e.deleteBuffer(s),e.deleteBuffer(u),e.disableVertexAttribArray(c),e.disableVertexAttribArray(l),e.deleteTexture(v),y}(e,c,f||a,h,d,r);if(i){Va.useProgram(e,l),f=v;for(m=i-1;m>=0;m--){var y;p=Math.ceil(n*Math.pow(.5,m)),g=Math.ceil(o*Math.pow(.5,m));e.viewport(0,0,p,g),f=Ui(e,l,y=f,h,d,p,g),e.deleteTexture(y),h=p,d=g}v=f}return e.viewport(0,0,n,o),Va.useProgram(e,s.main),v}function sf(e,t,r,i,a,n,o,s){var c,u=i.bbox.slice(0),l=u[0],h=u[1],d=u[2]-u[0],f=u[3]-u[1],m=t.programs,p=m.bloom,g=m.bloomBlur,v=m.main;Va.useProgram(e,v),nf(r,d,f)&&((c=Zi.getEmptyInstance(e,u)).available=!0);var y=c?af(e,v,i,c,l,h,d,f):La(e,i.list[0].t,d,f),b=Zi.getEmptyInstance(e,u);b.available=!0,Va.useProgram(e,g),function(e,t,r,i,a,n){var o,s=r.list,c=i.list;s.forEach(function(r){var i=r.t,s=r.w,u=r.h,l=r.bbox,h=ki(e,0,void 0,s,u);o?(e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,h,0),e.viewport(0,0,s,u)):o=La(e,h,s,u),function(e,t,r,i,a){var n=Li(e,t),o=n.pointBuffer,s=n.a_position,c=n.texBuffer,u=n.a_texCoords;if(i!==t.uniformValue.u_threshold){var l=t.uniform.u_threshold;e.uniform1f(l,i)}if(a!==t.uniformValue.u_knee){var h=t.uniform.u_knee;e.uniform1f(h,a)}Si(e,r,0);var d=t.uniform.u_texture;e.uniform1i(d,0),e.drawArrays(e.TRIANGLE_STRIP,0,4),e.deleteBuffer(o),e.deleteBuffer(c),e.disableVertexAttribArray(s),e.disableVertexAttribArray(u)}(e,t,i,a,n),c.push({bbox:l.slice(0),t:h,w:s,h:u})}),Na(e,o)}(e,g,c||i,b,a,n);for(var x=Math.min(d,f),T=0;x>=8&&(x>>=1,!(++T>=4)););var w=Zi.getEmptyInstance(e,u);w.available=!0,w.list=function(e,t,r,i,a){var n=r.list,o=i.list,s=t.programs,c=s.dualDown13,u=s.dualUp13;Va.useProgram(e,c);for(var l,h=[],d=function(t){var r=[];n.forEach(function(i){var a=i.t,n=i.w,o=i.h,s=n>>t+1,u=o>>t+1,h=ki(e,0,void 0,s,u),d={w:n>>t,h:o>>t,t:h};l?(e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,h,0),e.viewport(0,0,s,u)):l=La(e,h,s,u),function(e,t,r,i,a,n){void 0===n&&(n=1);var o=Li(e,t),s=o.pointBuffer,c=o.a_position,u=o.texBuffer,l=o.a_texCoords,h=t.uniform.u_xy;e.uniform2f(h,n/i,n/a),Si(e,r,0),e.uniform1i(t.uniform.u_texture,0),e.drawArrays(e.TRIANGLE_STRIP,0,4),e.deleteBuffer(s),e.deleteBuffer(u),e.disableVertexAttribArray(c),e.disableVertexAttribArray(l)}(e,c,a,s,u),r.push(d)}),h.push(r)},f=0;f<a;f++)d(f);Va.useProgram(e,u);var m=function(t){h[t].forEach(function(r,i){var a=r.t,s=r.w,c=r.h,l=ki(e,0,void 0,s,c);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,l,0),t?e.viewport(0,0,s,c):e.viewport(0,0,n[i].w,n[i].h);var d=t?h[t-1][i].t:n[i].t;!function(e,t,r,i,a,n,o){void 0===o&&(o=1);var s=Li(e,t),c=s.pointBuffer,u=s.a_position,l=s.texBuffer,h=s.a_texCoords,d=t.uniform.u_xy;e.uniform2f(d,o/a,o/n),Si(e,r,0),Si(e,i,1),e.uniform1i(t.uniform.u_texture1,0),e.uniform1i(t.uniform.u_texture2,1),e.drawArrays(e.TRIANGLE_STRIP,0,4),e.deleteBuffer(c),e.deleteBuffer(l),e.disableVertexAttribArray(u),e.disableVertexAttribArray(h)}(e,u,d,a,s,c),e.deleteTexture(h[t][i].t),t?(e.deleteTexture(h[t-1][i].t),h[t-1][i].t=l):o[i]={bbox:n[i].bbox.slice(0),w:n[i].w,h:n[i].h,t:l}})};for(f=a-1;f>=0;f--)m(f);return Na(e,l),o}(e,t,b,w,T),b.release(),Va.useProgram(e,p);var k=Zi.getEmptyInstance(e,u);k.available=!0;var S=c?c.list:i.list;return e.bindFramebuffer(e.FRAMEBUFFER,y),w.list.forEach(function(t,r){var i=t.w,a=t.h,n=t.t,o=t.bbox,s=ki(e,0,void 0,i,a);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,s,0),e.viewport(0,0,i,a),function(e,t,r,i){var a=Li(e,t),n=a.pointBuffer,o=a.a_position,s=a.texBuffer,c=a.a_texCoords;Si(e,r,0),Si(e,i,1),e.uniform1i(t.uniform.u_texture1,0),e.uniform1i(t.uniform.u_texture2,1),e.drawArrays(e.TRIANGLE_STRIP,0,4),e.deleteBuffer(n),e.deleteBuffer(s),e.disableVertexAttribArray(o),e.disableVertexAttribArray(c)}(e,p,S[r].t,n),k.list.push({bbox:o.slice(0),w:i,h:a,t:s})}),Va.useProgram(e,v),e.viewport(0,0,o,s),c&&c.release(),w&&w.release(),Na(e,y),k}function cf(e,t,r,i,a,n,o,s,c,u){var l=t.programs,h=l.cm;Va.useProgram(e,h);var d,f=r;if(i||1!==a||1!==n||1!==o||1!==s){var m=fr(i%360),p=Math.cos(m),g=Math.sin(m),v=.213*(1-a),y=.715*(1-a),b=.072*(1-a),x=n-1,T=.5*(1-o),w=ot(i?new Float32Array([.213+.787*p-.213*g,.715-.715*p-.715*g,.072-.072*p+.928*g,0,.213-.213*p+.143*g,.715+.285*p+.14*g,.072-.072*p-.283*g,0,.213-.213*p-.787*g,.715-.715*p+.715*g,.072+.928*p+.072*g,0,0,0,0,1]):at(),1!==a?new Float32Array([v+a,y,b,0,v,y+a,b,0,v,y,b+a,0,0,0,0,1]):at());if(1!==o&&(w[0]*=o,w[1]*=o,w[2]*=o,w[4]*=o,w[5]*=o,w[6]*=o,w[8]*=o,w[9]*=o,w[10]*=o),1!==s){var k=Math.min(1,Math.max(0,1-s));ut(w,ot(w,new Float32Array([.393+.607*k,.769-.769*k,.189-.189*k,0,.349-.349*k,.686+.314*k,.168-.168*k,0,.272-.272*k,.534-.534*k,.131+.869*k,0,0,0,0,1])))}var S=f,E=function(e,t,r,i,a){var n=Zi.getEmptyInstance(e,r.bbox);n.available=!0;for(var o=r.list,s=n.list,c=0,u=o.length;c<u;c++){var l=o[c],h=l.bbox,d=l.w,f=l.h,m=l.t,p=ki(e,0,void 0,d,f);a?(e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,p,0),e.viewport(0,0,d,f)):a=La(e,p,d,f),m&&Hi(e,t,m,i),s.push({bbox:h.slice(0),w:d,h:f,t:p})}return{res:n,frameBuffer:a}}(e,h,S,[w[0],w[1],w[2],w[3],x+T,w[4],w[5],w[6],w[7],x+T,w[8],w[9],w[10],w[11],x+T,0,0,0,1],d);f=E.res,d=E.frameBuffer,S!==r&&S.release()}if(Va.useProgram(e,l.main),d)return Na(e,d,c,u),f;e.viewport(0,0,c,u)}function uf(e){return(e.visibility===te.HIDDEN||e.opacity<=0)&&!e.maskMode}function lf(e,t,r,i,a){for(var n=r+a+1,o=t.length;n<o;n++){var s=t[n],c=s.node,u=s.lv,l=c.computedStyle;if(i>u){e.struct.next=n-r-a-1;break}if(n===o-1||l.breakMask&&i===u){e.struct.next=n-r-a;break}}}function hf(e,t,r,i,a,n,o){var s=(t.tempBbox||t._bbox||t.bbox).slice(0);if(st(t.tempMatrix),t.computedStyle.overflow===ie.HIDDEN||t.computedStyle.overflow===ie.CLIP)return s;for(var c=r+1,u=r+i+1;c<u;c++){var l=e[c],h=l.node,d=l.total,f=h.textureTarget;if(a){var m=h.parent,p=m.perspectiveMatrix,g=h.perspectiveMatrixSelf,v=h.matrix;g&&(v=ot(g,v)),p&&(v=ot(p,v));var y=ot(m.tempMatrix,v);ut(h.tempMatrix,y);var b=f&&f!==h.textureCache?f.bbox:h._filterBboxInt||h.filterBboxInt;b[2]-b[0]&&b[3]-b[1]&&hi(s,b,v)}var x=o[c];x&&(x.isTop=!1,n.subList.push(x)),(null==f?void 0:f.available)&&f!==h.textureCache&&(c+=d)}return s}function df(e,t,r,i,a,n,o,s,c){var u;if(void 0===c&&(c=!1),null===(u=r.textureTotal)||void 0===u?void 0:u.available){if(!c)return r.textureTotal;if(r.textureTotal!==r.textureCache)return r.textureTotal}var l=r.tempBbox;if(r.tempBbox=void 0,mi(l),!n&&!c){var h=r.textureCache;return!(null==h?void 0:h.available)&&r.hasContent&&(r.genTexture(e),h=r.textureCache),h}var d=t.programs,f=d.main;Va.useProgram(e,f);var m=l[0],p=l[1],g=Math.ceil(l[2]-m),v=Math.ceil(l[3]-p),y=Zi.getEmptyInstance(e,l);y.available=!0;for(var b,x=y.list,T=L.maxTextureSize,w=[],k=0,S=Math.ceil(v/T);k<S;k++)for(var E=0,C=Math.ceil(g/T);E<C;E++){var A=E===C-1?g-E*T:T,_=k===S-1?v-k*T:T,M=m+E*T,I=p+k*T,R=new Float32Array([M,I,M+A,I+_]);w.push({x:m+E*T,y:p+k*T,w:A,h:_,bbox:R})}for(k=a,S=a+n+1;k<S;k++){var P=i[k],O=P.node,D=P.total,B=P.next,F=O.computedStyle;if(uf(F))k+=D+B;else{var N=void 0,U=void 0;if(k===a){if(N=O.tempOpacity=1,st(O.tempMatrix),U=O.tempMatrix,F.perspectiveSelf>=1){var z=F.transformOrigin;ut(U,H=Mr(F.perspectiveSelf,z[0]-m,z[1]-p))}if(F.perspective>=1){var W=F.perspectiveOrigin;ut(U,re=ot(Mr(F.perspective,W[0]-m,W[1]-p),U))}}else{var V=O.parent;N=O.tempOpacity=F.opacity*V.tempOpacity;var H=void 0;if(F.perspectiveSelf>=1){z=F.transformOrigin;H=Mr(F.perspectiveSelf,z[0]-m,z[1]-p)}var X=O.transform;if(nt(X))U=V.tempMatrix,H&&(U=ot(U,H));else{var G=_r(X,(z=F.transformOrigin)[0]-m,z[1]-p);U=ot(V.tempMatrix,H?ot(H,G):G)}}ut(O.tempMatrix,U);var Y=O.textureTarget;if(!(null==Y?void 0:Y.available)&&O.hasContent&&(O.genTexture(e),Y=O.textureTarget),Y&&Y.available)for(var q=F.mixBlendMode,K=Y.list,$=(E=0,w.length);E<$;E++)for(var Q=w[E],Z=Q.x,J=Q.y,ee=Q.w,te=Q.h,re=Q.t,ie=.5*ee,ae=.5*te,ne=0,oe=K.length;ne<oe;ne++){var se=K[ne],ce=se.bbox,ue=se.t,le=se.tc;if(ue&&za(ce,U,Z,J,ee,te)){re||(re=Q.t=ki(e,0,void 0,ee,te)),b?(e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,re,0),e.viewport(0,0,ee,te)):b=La(e,re,ee,te);var he=void 0;q!==j.NORMAL&&k>a&&(he=ki(e,0,void 0,ee,te),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,he,0)),Ei(e,ie,ae,f,{opacity:N,matrix:U,bbox:ce,t:ue,tc:le,dx:-Q.x,dy:-Q.y}),q!==j.NORMAL&&he&&(re=Q.t=pf(e,re,he,q,d,ee,te))}}(null==Y?void 0:Y.available)&&Y!==O.textureCache&&(k+=D+B)}}return b&&Na(e,b,o,s),w.forEach(function(e){x.push({bbox:e.bbox,w:e.w,h:e.h,t:e.t})}),y}function ff(e,t,r,i,a){var n,o;if(null===(n=r.textureFilter)||void 0===n?void 0:n.available)return r.textureFilter;var s=r.computedStyle.filter,c=r.textureTarget;return s.forEach(function(n){if(n.u===V.GAUSS_BLUR){if(n.radius>=1){var s=function(e,t,r,i,a,n,o,s){void 0===s&&(s=!1);var c=Pr(a),u=s?Dr(c):0,l=i.bbox.slice(0);u&&(l[0]-=u,l[1]-=u,l[2]+=u,l[3]+=u);var h,d=l[0],f=l[1],m=l[2]-l[0],p=l[3]-l[1],g=t.programs.main;Va.useProgram(e,g),(u||nf(r,m,p))&&((h=Zi.getEmptyInstance(e,l)).available=!0);var v=h?h.list:i.list,y=h?af(e,g,i,h,d,f,m,p):La(e,i.list[0].t,m,p),b=function(e){var t=0;return e>=256?t=4:e>=64?t=3:e>=16?t=2:e>=4&&(t=1),t}(a),x=Br(a*Math.pow(.5,b)),T=Zi.getEmptyInstance(e,l);T.available=!0;for(var w=T.list,k=0,S=v.length;k<S;k++){var E=v[k],C=E.bbox,A=E.w,_=E.h,M=E.t;w.push({bbox:C.slice(0),w:A,h:_,t:M&&of(e,t,x,b,M,A,_)})}if(v.length>1){var I=tf(e,T,d,f,m,p,u);for(k=0,S=I.length;k<S;k++){var R=I[k],P=(C=R.bbox,R.w),O=R.h;M=R.t,Va.useProgram(e,g),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,M,0),e.viewport(0,0,P,O);for(var D=.5*P,B=.5*O,F=!1,L=0,N=v.length;L<N;L++){var U=v[L],z=U.bbox,W=U.t,V=z[2]-z[0],H=z[3]-z[1];W&&za(C,void 0,z[0],z[1],V,H)&&(Ei(e,D,B,g,{opacity:1,bbox:z,t:W,dx:-C[0],dy:-C[1]}),F=!0)}F&&(R.t=of(e,t,x,b,M,P,O),e.deleteTexture(M))}rf(e,g,T,I,l,u)}return h&&h.release(),Va.useProgram(e,g),Na(e,y,n,o),T}(e,t,r,o||c,n.radius,i,a);o&&o.release(),o=s}}else if(n.u===V.RADIAL_BLUR){if(n.radius>=1){s=function(e,t,r,i,a,n,o,s,c){void 0===c&&(c=!1);var u=i.bbox,l=Pr(a),h=c?Dr(l):0,d=u.slice(0),f=d[2]-d[0],m=d[3]-d[1],p=n[0]*f,g=n[1]*m,v=2*h/Math.sqrt(f*f+m*m),y=Math.ceil(v*p),b=Math.ceil(v*(f-p)),x=Math.ceil(v*g),T=Math.ceil(v*(m-g));d[0]-=y,d[1]-=x,d[2]+=b,d[3]+=T;var w,k=d[0],S=d[1],E=d[2]-d[0],C=d[3]-d[1],A=t.programs,_=A.main;(h||nf(r,E,C))&&((w=Zi.getEmptyInstance(e,d)).available=!0);var M=w?w.list:i.list,I=w?af(e,_,i,w,k,S,E,C):La(e,i.list[0].t,E,C),R=A.radial;Va.useProgram(e,R);var P=Zi.getEmptyInstance(e,d);P.available=!0;for(var O=P.list,D=p+y,B=g+x,F=0,L=M.length;F<L;F++){var N=M[F],U=N.bbox,z=N.w,W=N.h,V=N.t;e.viewport(0,0,z,W);var H=U[2]-U[0],X=U[3]-U[1],j=[(D-U[0]+d[0])/H,(B-U[1]+d[1])/X],G=V&&Wi(e,R,V,v,h,j,z,W);O.push({bbox:U.slice(0),w:z,h:W,t:G})}if(M.length>1){var Y=tf(e,P,k,S,E,C,h);for(F=0,L=Y.length;F<L;F++){var q=Y[F],K=(U=q.bbox,q.w),$=q.h;V=q.t,Va.useProgram(e,_),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,V,0),e.viewport(0,0,K,$),j=[(D-U[0]+d[0])/(U[2]-U[0]),(B-U[1]+d[0])/(U[3]-U[1])];for(var Q=.5*K,Z=.5*$,J=!1,ee=0,te=M.length;ee<te;ee++){var re=M[ee],ie=re.bbox,ae=re.t;H=ie[2]-ie[0],X=ie[3]-ie[1],ae&&za(U,void 0,ie[0],ie[1],H,X)&&(Ei(e,Q,Z,_,{opacity:1,bbox:new Float32Array([ie[0],ie[1],ie[2],ie[3]]),t:ae,dx:-U[0],dy:-U[1]}),J=!0)}J&&(Va.useProgram(e,R),q.t=Wi(e,R,V,v,h,j,K,$)),e.deleteTexture(V)}rf(e,_,P,Y,d,h)}return w&&w.release(),Va.useProgram(e,_),Na(e,I,o,s),P}(e,t,r,o||c,n.radius,n.center,i,a);o&&o.release(),o=s}}else if(n.u===V.MOTION_BLUR){if(n.radius>=1){s=function(e,t,r,i,a,n,o,s,c,u,l){void 0===u&&(u=!1),void 0===l&&(l=!1);var h=fr(n),d=u?3*a:0,f=a,m=i.bbox.slice(0);if(d){var p=Math.sin(h),g=Math.cos(h),v=Math.abs(Math.ceil(p*d)),y=Math.abs(Math.ceil(g*d));m[0]-=y,m[1]-=v,m[2]+=y,m[3]+=v}var b,x=m[0],T=m[1],w=m[2]-m[0],k=m[3]-m[1],S=t.programs,E=S.main;(d||nf(r,w,k))&&((b=Zi.getEmptyInstance(e,m)).available=!0);var C=b?b.list:i.list,A=b?af(e,E,i,b,x,T,w,k):La(e,i.list[0].t,w,k),_=S.motion;Va.useProgram(e,_);var M=Zi.getEmptyInstance(e,m);M.available=!0;for(var I=M.list,R=0,P=C.length;R<P;R++){var O=C[R],D=O.bbox,B=O.w,F=O.h,L=O.t;e.viewport(0,0,B,F);var N=L&&zi(e,_,L,f,h,o,B,F,l);I.push({bbox:D.slice(0),w:B,h:F,t:N})}if(C.length>1){var U=tf(e,M,x,T,w,k,d);for(R=0,P=U.length;R<P;R++){var z=U[R],W=(D=z.bbox,z.w),V=z.h;L=z.t,Va.useProgram(e,E),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,L,0),e.viewport(0,0,W,V);for(var H=.5*W,X=.5*V,j=!1,G=0,Y=C.length;G<Y;G++){var q=C[G],K=q.bbox,$=q.t,Q=K[2]-K[0],Z=K[3]-K[1];$&&za(D,void 0,K[0],K[1],Q,Z)&&(Ei(e,H,X,E,{opacity:1,bbox:K,t:$,dx:-D[0],dy:-D[1]}),j=!0)}j&&(Va.useProgram(e,_),z.t=zi(e,_,L,f,h,o,W,V,l)),e.deleteTexture(L)}rf(e,E,M,U,m,d)}return b&&b.release(),Va.useProgram(e,E),Na(e,A,s,c),M}(e,t,r,o||c,n.radius,n.angle,n.offset,i,a);o&&o.release(),o=s}}else if(n.u===V.BLOOM){if(n.threshold>0){s=sf(e,t,r,o||c,n.threshold,n.knee,i,a);o&&o.release(),o=s}}else if(n.u===V.LIGHT_DARK){s=function(e,t,r,i,a,n,o,s){var c,u=fr(n),l=i.bbox.slice(0),h=l[0],d=l[1],f=l[2]-l[0],m=l[3]-l[1],p=t.programs,g=p.main;nf(r,f,m)&&((c=Zi.getEmptyInstance(e,l)).available=!0);var v=c?c.list:i.list,y=c?af(e,g,i,c,h,d,f,m):La(e,i.list[0].t,f,m),b=p.lightDark;Va.useProgram(e,b);var x=Zi.getEmptyInstance(e,l);x.available=!0;for(var T=x.list,w=0,k=v.length;w<k;w++){var S=v[w],E=S.bbox,C=S.w,A=S.h,_=S.t,M=ki(e,0,void 0,C,A);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,M,0),e.viewport(0,0,C,A),Xi(e,b,_,a,u,C,A),T.push({bbox:E.slice(0),w:C,h:A,t:M})}return v.length,Va.useProgram(e,g),e.viewport(0,0,o,s),c&&c.release(),Na(e,y),x}(e,t,r,o||c,n.radius,n.angle,i,a);o&&o.release(),o=s}else if(n.u===V.HUE_ROTATE&&n.radius%360||n.u===V.SATURATE&&1!==n.radius||n.u===V.BRIGHTNESS&&1!==n.radius||n.u===V.CONTRAST&&1!==n.radius||n.u===V.SEPIA&&n.radius>0&&n.radius<1){s=cf(e,t,o||c,n.u===V.HUE_ROTATE?n.radius:0,n.u===V.SATURATE?n.radius:1,n.u===V.BRIGHTNESS?n.radius:1,n.u===V.CONTRAST?n.radius:1,n.u===V.SEPIA?n.radius:0,i,a);o&&o.release(),o=s}}),o}function mf(e,t,r,i,a,n,o,s,c,u){var l,h,d;if((null===(l=r.textureMask)||void 0===l?void 0:l.available)||!r.hasContent)return r.textureMask;(null===(h=r.textureTarget)||void 0===h?void 0:h.available)||r.genTexture(e);var f=r.textureTarget;if(!r.next)return f;var m=f.list,p=t.programs;Va.useProgram(e,p.main);var g=f.bbox,v=r.computedStyle,y=g[0],b=g[1],x=g[2]-y,T=g[3]-b,w=Zi.getEmptyInstance(e,g);w.available=!0;var k,S,E=w.list,C=L.maxTextureSize;nf(r,x,T)&&(r.tempBbox=(r.tempBbox||r._rect||r.rect).slice(0),m=(S=df(e,t,r,a,n,s,c,u,!0)).list);for(var A=xt(r.matrix),_=0,M=Math.ceil(T/C);_<M;_++)for(var I=0,R=Math.ceil(x/C);I<R;I++){var P=I===R-1?x-I*C:C,O=_===M-1?T-_*C:C,D=ki(e,0,void 0,P,O),B=y+I*C,F=b+_*C,N={bbox:new Float32Array([B,F,B+P,F+O]),w:P,h:O,t:D};E.push(N);var U=y+I*C,z=b+_*C;k?(e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,D,0),e.viewport(0,0,P,O)):k=La(e,D,P,O);var W=.5*P,V=.5*O;if([$.ALPHA_WITH,$.GRAY_WITH].includes(i)&&v.visibility===te.VISIBLE&&v.opacity>0&&f.available){var H=null===(d=m[_*R+I])||void 0===d?void 0:d.t;H&&Ei(e,W,V,p.main,{opacity:1,bbox:new Float32Array([0,0,P,O]),t:H})}for(var X=!_&&!I,G=n+s+1,Y=a.length;G<Y;G++){var q=a[G],K=q.node,Q=q.lv,Z=q.total,J=q.next,ee=K.computedStyle;if(o>Q){r.struct.next=G-n-s-1;break}if(G===Y||(ee.breakMask||ee.maskMode)&&o===Q){r.struct.next=G-n-s-1;break}if(uf(ee))G+=Z+J;else{var re=void 0,ie=void 0;if(X){if(o===Q)re=K.tempOpacity=ee.opacity,ie=ot(A,K.matrix);else{var ae=K.parent;re=K.tempOpacity=ee.opacity*ae.tempOpacity,ie=ot(ae.tempMatrix,K.matrix)}ut(K.tempMatrix,ie)}else re=K.tempOpacity,ie=K.tempMatrix;var ne=K.textureTarget;if(!(null==ne?void 0:ne.available)&&K.hasContent&&(K.genTexture(e),ne=K.textureTarget),null==ne?void 0:ne.available){var oe=ee.mixBlendMode;if(!za(ne.bbox,ie,U,z,P,O))continue;for(var se=ne.list,ce=0,ue=se.length;ce<ue;ce++){var le=se[ce],he=le.bbox,de=le.t;if(de&&za(he,ie,U,z,P,O)){var fe=void 0;oe!==j.NORMAL&&(G>n+s+1&&[$.OUTLINE,$.ALPHA,$.GRAY].includes(i)||G>n+s&&[$.ALPHA_WITH,$.GRAY_WITH].includes(i))&&(fe=ki(e,0,void 0,P,O),k?(e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,fe,0),e.viewport(0,0,P,O)):k=La(e,fe,P,O)),Ei(e,W,V,p.main,{opacity:re,matrix:ie,bbox:he,t:de,dx:-U,dy:-z}),oe!==j.NORMAL&&fe&&(N.t=pf(e,N.t,fe,oe,p,P,O))}}}((null==ne?void 0:ne.available)&&ne!==K.textureCache||ee.maskMode)&&(![$.OUTLINE,$.ALPHA_WITH,$.GRAY_WITH].includes(ee.maskMode)||K.next&&!K.next.computedStyle.breakMask)&&(G+=Z+J)}}}var me=Zi.getEmptyInstance(e,g);me.available=!0;var pe=me.list;if(i===$.GRAY||i===$.GRAY_WITH){Va.useProgram(e,p.maskGray);for(_=0,M=E.length;_<M;_++){var ge=E[_],ve=ge.bbox,ye=ge.w,be=ge.h;D=ge.t,fe=void 0;m[_]&&m[_].t&&D&&(fe=ki(e,0,void 0,ye,be),k?(e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,fe,0),e.viewport(0,0,ye,be)):k=La(e,fe,ye,be),m[_]&&m[_].t&&Ni(e,p.maskGray,m[_].t,D)),pe.push({bbox:ve.slice(0),w:ye,h:be,t:fe})}}else{Va.useProgram(e,p.mask);for(_=0,M=E.length;_<M;_++){var xe=E[_],Te=xe.bbox,we=xe.w,ke=xe.h;D=xe.t,fe=ki(e,0,void 0,we,ke);k?(e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,fe,0),e.viewport(0,0,we,ke)):k=La(e,fe,we,ke),Ni(e,p.mask,m[_].t,D),pe.push({bbox:Te.slice(0),w:we,h:ke,t:fe})}}return Va.useProgram(e,p.main),w.release(),S&&S.release(),k?Na(e,k,c,u):e.viewport(0,0,c,u),me}function pf(e,t,r,i,a,n,o){var s;i===j.MULTIPLY?s=a.multiplyProgram:i===j.SCREEN?s=a.screenProgram:i===j.OVERLAY?s=a.overlayProgram:i===j.DARKEN?s=a.darkenProgram:i===j.LIGHTEN?s=a.lightenProgram:i===j.COLOR_DODGE?s=a.colorDodgeProgram:i===j.COLOR_BURN?s=a.colorBurnProgram:i===j.HARD_LIGHT?s=a.hardLightProgram:i===j.SOFT_LIGHT?s=a.softLightProgram:i===j.DIFFERENCE?s=a.differenceProgram:i===j.EXCLUSION?s=a.exclusionProgram:i===j.HUE?s=a.hueProgram:i===j.SATURATION?s=a.saturationProgram:i===j.COLOR?s=a.colorProgram:i===j.LUMINOSITY?s=a.luminosityProgram:(oe.error("Unknown mixBlendMode: "+i),s=a.program),e.useProgram(s);var c=ki(e,0,void 0,n,o);return e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,c,0),Vi(e,s,t,r),e.deleteTexture(t),e.deleteTexture(r),e.useProgram(a.program),c}function gf(e){e.valid=!0;for(var t=e.subList;t.length;){var r=t.pop();r.valid=!0;for(var i=r.subList;i.length;)t.push(i.pop())}}var vf,yf={genTotal:df,genFilter:ff,genMask:function(e){var t=e.root,r=e.computedStyle,i=e.struct;t&&i&&mf(t.ctx,t,e,r.maskMode,t.structs,t.structs.indexOf(i),i.lv,i.total,t.width,t.height)}};function bf(e,t){var r=t.structs,i=t.width,a=t.height,n=t.isWebgl2;!function(e,t,r,i,a,n){var o,s,c,u,l,h=t.structs,d=t.width,f=t.height;t.contentLoadingCount=0;for(var m=[],p=[],g=0,v=h.length;g<v;g++){var y=h[g],b=y.node,x=y.lv,T=y.total,w=y.next,k=b.refreshLevel,S=b.computedStyle,E=b.textureTotal,C=b.textureFilter,A=b.textureMask;b.refreshLevel=ci.NONE,k>=ci.REPAINT&&b.calContent(),t.contentLoadingCount+=b.calContentLoading();var _=S.filter,M=S.opacity,I=S.mixBlendMode,R=S.overflow,P=S.maskMode,O=(M>0&&M<1||I!==j.NORMAL||R===ie.HIDDEN)&&T>0&&!(null==E?void 0:E.available),D=_.map(function(e){return e.u===V.BLOOM?e.threshold>0:e.u===V.SEPIA?e.radius>0&&e.radius<1:e.radius>=1}).filter(function(e){return e}).length>0&&!(null==C?void 0:C.available),B=P>0&&!(null==A?void 0:A.available);if(B&&(b.next&&!b.next.computedStyle.breakMask&&b.next.computedStyle.maskMode===$.NONE||(B=!1,null===(o=b.textureMask)||void 0===o||o.release(),b.textureMask=void 0)),O||D||B){var F={i:g,lv:x,total:T,node:b,valid:!1,subList:[],isNew:!1,isTop:!0};m.push(F),p[g]=F}(null==E?void 0:E.available)&&(g+=T),(null==A?void 0:A.available)&&(g+=w)}m.sort(function(e,t){return e.lv===t.lv?t.i-e.i:t.lv-e.lv});var L=0;for(v=m.length;L<v;L++){g=(U=m[L]).i,T=U.total,b=U.node;var N=U.isNew=!b.tempBbox;b.tempBbox=hf(h,b,g,T,N,U,p)}for(L=0,v=m.length;L<v;L++){b=(U=m[L]).node;var U,z=U.isTop;if(g=U.i,x=U.lv,T=U.total,z&&za(b.tempBbox,b.matrixWorld,r,i,a-r,n-i)&&(gf(U),b.computedStyle.maskMode)){lf(b,h,g,x,T);for(var W=L;W>=0;W--){var H=m[W];if(H.i>g+T+b.struct.next)break;gf(H)}}}for(L=0,v=m.length;L<v;L++){var X=m[L],G=(g=X.i,x=X.lv,T=X.total,b=X.node,X.valid);if(N=X.isNew,P=b.computedStyle.maskMode,G){if(!uf(b.computedStyle)){var Y=void 0;(null===(s=b.textureTotal)||void 0===s?void 0:s.available)||(F=df(e,t,b,h,g,T,d,f))&&!Y&&(b.textureTotal=b.textureTarget=F,Y=F),b.textureTarget&&!(null===(c=b.textureFilter)||void 0===c?void 0:c.available)&&(F=ff(e,t,b,d,f))&&(b.textureFilter=b.textureTarget=F,Y=F),P&&(null===(u=b.textureTarget)||void 0===u?void 0:u.available)&&!(null===(l=b.textureMask)||void 0===l?void 0:l.available)&&b.next&&(F=mf(e,t,b,P,h,g,x,T,d,f))&&(b.textureMask=b.textureTarget=F,Y=F)}}else N&&P&&lf(b,h,g,x,T)}}(e,t,0,0,i,a);var o=.5*i,s=.5*a,c=t.programs,u=c.main,l=c.pr;Va.useProgram(e,u),e.viewport(0,0,i,a);for(var h=[],d=0,f=r.length;d<f;d++){var m=r[d],p=m.node,g=m.total,v=m.next;if(uf(p.computedStyle)){for(var y=d+1;y<d+g;y++){var b=r[y].node;xf(b,y,b.parent)}d+=g+v}else{xf(p,d,p.parent);var x=p._opacity,T=p._matrixWorld,w=p.textureTarget,k=!1;if((null==w?void 0:w.available)?k=Ua(w.bbox,T,i,a):(k=Ua(p._filterBbox||p.filterBbox,T,i,a))&&p.hasContent&&(p.genTexture(e),w=p.textureTarget),k&&(null==w?void 0:w.available))for(var S=w.list,E=0,C=S.length;E<C;E++){var A=S[E],_=A.bbox,M=A.t,I=A.tc;M&&(n?h.push({opacity:x,matrix:T,bbox:_,t:M,tc:I}):Ei(e,o,s,u,{opacity:x,matrix:T,bbox:_,t:M,tc:I}))}(null==w?void 0:w.available)&&w!==p.textureCache&&(d+=g+v)}}n&&(Va.useProgram(e,l),function(e,t,r,i,a){if(a.length){var n=e.createVertexArray();e.bindVertexArray(n);for(var o=Math.floor(a.length/Ci),s=0;s<o;s++)Fi(e,t,r,i,a.slice(s*Ci,s*Ci+16));a.length%Ci&&Fi(e,t,r,i,a.slice(o*Ci)),e.bindVertexArray(null)}}(e,o,s,l,h),Va.useProgram(e,u))}function xf(e,t,r){var i=!1,a=!1;if(t?(i=e.hasCacheOp&&e.parentOpId===r.localOpId,a=e.hasCacheMw&&e.parentMwId===r.localMwId):(i=e.hasCacheOp,a=e.hasCacheMw),i||(e._opacity=r?r._opacity*e.computedStyle.opacity:e.computedStyle.opacity,r&&(e.parentOpId=r.localOpId),e.hasCacheOp=!0),!a){var n=null==r?void 0:r.perspectiveMatrix,o=e.perspectiveMatrixSelf,s=e.matrix;o&&(s=ot(o,s)),n&&(s=ot(n,s)),ut(e._matrixWorld,r?ot(r._matrixWorld,s):s),r&&(e.parentMwId=r.localMwId),e.hasCacheMw&&e.localMwId++,e.hasCacheMw=!0}}var Tf=function(){function e(){this.task=[],this.now=oe.now(),this.id=0}return e.prototype.init=function(){var e=this,t=this.task;oe.cancelAnimationFrame(this.id);var r=this.now=oe.now(),i=function(){oe.cancelAnimationFrame(e.id),e.id=oe.requestAnimationFrame(function(){var a=e.now=oe.now();if(!vf&&t.length){var n=a-r;n=Math.max(n,0),r=a,t.slice(0).forEach(function(e){e(n)}),t.length&&i()}})};i()},e.prototype.onFrame=function(e){var t=this.task;t.length||this.init(),t.push(e)},e.prototype.offFrame=function(e){var t=this.task,r=t.indexOf(e);r>-1&&t.splice(r,1),t.length||(oe.cancelAnimationFrame(this.id),this.now=0)},e.prototype.nextFrame=function(e){var t=this,r=function(i){e(i),t.offFrame(r)};return this.onFrame(r),r},e.prototype.pause=function(){vf=!0},e.prototype.resume=function(){vf&&(this.init(),vf=!1)},e}(),wf=new Tf;var kf="#define GLSLIFY 1\nattribute vec2 a_position;attribute vec2 a_texCoords;varying vec2 v_texCoords;void main(){gl_Position=vec4(a_position,0,1);v_texCoords=a_texCoords;}",Sf=function(e){function r(t){var r,i=e.call(this,t)||this;t.onMeta&&(i.onMeta=t.onMeta),t.onCanplay&&(i.onCanplay=t.onCanplay),t.onError&&(i.onError=t.onError),t.onWaiting&&(i.onWaiting=t.onWaiting),i._currentTime=t.currentTime||0,i._volumn=Math.max(0,Math.min(1,null!==(r=t.volumn)&&void 0!==r?r:1));var a=i._src=t.src||"";if(a){i._currentTime>=0&&(i.contentLoadingNum=1);var n=i._decoder=new Jd(a);n.on(jd.META,function(e){i._metaData=e,i._currentTime>=0&&i._currentTime<=e.duration?i.contentLoadingNum=1:i.contentLoadingNum=0,i.onMeta&&i.onMeta(e),i.emit(Ia)}),n.on(jd.ERROR,function(e){oe.error(e),i.contentLoadingNum=0,i.onError&&i.onError(e),i.emit(Ra),i.refresh()}),n.on(jd.CANPLAY,function(e){i.contentLoadingNum=0,i.onCanplay&&i.onCanplay(),i.emit(Ma),i.refresh()}),n.on([jd.CANPLAY,jd.AUDIO_BUFFER],function(e){var t=i.root;if(t&&e.audioBuffer){var r=t.audioContext,a=i.timeAnimation;if("running"===(null==a?void 0:a.playState)&&r){var n=a.currentTime-a.delay;if(n>=e.timestamp+e.duration||a.duration<=e.timestamp)return;var o=r.createBufferSource();o.buffer=e.audioBuffer,i.gainNode||(i.gainNode=r.createGain(),i.gainNode.gain.value=i.volumn,i.gainNode.connect(r.destination)),o.connect(i.gainNode),n>=e.audioTimestamp?o.start(0,.001*(n-e.audioTimestamp),.001*(a.duration-n)):o.start(r.currentTime+.001*(e.audioTimestamp-n),0,.001*(a.duration-e.audioTimestamp))}}}),n.start(i._currentTime)}return i}return t(r,e),r.prototype.calContentLoading=function(){var t=e.prototype.calContentLoading.call(this);if(t){if(this._currentTime>=0){if(!this._metaData)return t;if(this._currentTime<this._metaData.duration)return t}return 0}return t},r.prototype.release=function(){e.prototype.release.call(this);var t=this,r=t.loader,i=t.audioBufferSourceNode,a=t.gainNode;(null==r?void 0:r.success)&&r.release(),i&&(i.stop(),i.disconnect(),this.audioBufferSourceNode=void 0),a&&(a.disconnect(),this.gainNode=void 0)},r.prototype.timeAnimate=function(e,t){var r;null===(r=this.timeAnimation)||void 0===r||r.remove();var i=this.timeAnimation=new Ha(this,e,t);return this.initAnimate(i,t)},Object.defineProperty(r.prototype,"src",{get:function(){return this._src},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"currentTime",{get:function(){return this._currentTime},set:function(e){if(this._currentTime!==e){this._currentTime=e;var t=this._decoder;if(t){var r=e,i=t.currentGOP;t.start(r);var a=t.currentGOP;!(null==a?void 0:a.audioBuffer)&&(null==a?void 0:a.state)===Wd.DECODING&&e>=0&&!t.error&&(this._metaData&&this._metaData.duration,this.contentLoadingNum=1),(null==i?void 0:i.audioBuffer)&&!(null==a?void 0:a.audioBuffer)&&this._metaData&&e>=0&&e<this._metaData.duration&&!t.error&&(this.onWaiting&&this.onWaiting(),this.emit(_a))}}},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"duration",{get:function(){var e;return(null===(e=this.loader)||void 0===e?void 0:e.duration)||0},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"metaData",{get:function(){return this._metaData},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"volumn",{get:function(){return this._volumn},set:function(e){var t=Math.max(0,Math.min(1,e));this._volumn!==t&&(this._volumn=t,this.gainNode&&(this.gainNode.gain.value=t))},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"decoder",{get:function(){return this._decoder},enumerable:!1,configurable:!0}),r}(ka),Ef=function(e){function r(t){var r=e.call(this)||this;return r.aniList=[],r.audioContext=t,r}return t(r,e),r.prototype.addAni=function(e){-1===this.aniList.indexOf(e)&&(this.aniList.push(e),1===this.aniList.length&&this.checkEvent())},r.prototype.removeAni=function(e){var t=this.aniList.indexOf(e);t>-1&&(this.aniList.splice(t,1),0===t&&this.checkEvent())},r.prototype.play=function(){this.aniList.forEach(function(e){e.play(),Cf(e)})},r.prototype.pause=function(){this.aniList.forEach(function(e){e.pause(),Af(e)})},r.prototype.resume=function(){this.aniList.forEach(function(e){e.resume(),Cf(e)})},r.prototype.finish=function(){this.aniList.forEach(function(e){e.finish(),Af(e)})},r.prototype.cancel=function(){this.aniList.forEach(function(e){e.cancel(),Af(e)})},r.prototype.gotoAndPlay=function(e){this.aniList.forEach(function(t){t.gotoAndPlay(e),Cf(t)})},r.prototype.gotoAndStop=function(e){this.aniList.forEach(function(t){t.gotoAndStop(e),Af(t)}),this.aniList.forEach(function(e){e.afterRunning()})},r.prototype.checkEvent=function(){var e=this,t=this.aniList[0];t&&Object.keys(this.__eHash).forEach(function(r){e.__eHash[r].forEach(function(e){t.on(r,e)})})},r.prototype.on=function(t,r){e.prototype.on.call(this,t,r),this.aniList.length&&this.aniList[0].on(t,r)},r.prototype.once=function(t,r){e.prototype.once.call(this,t,r),this.aniList.length&&this.aniList[0].once(t,r)},r.prototype.off=function(t,r){e.prototype.off.call(this,t,r),this.aniList.length&&this.aniList[0].off(t,r)},Object.defineProperty(r.prototype,"currentTime",{get:function(){var e=this.aniList[0];return e?e.currentTime:0},set:function(e){this.aniList.forEach(function(t){t.currentTime=e})},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"duration",{get:function(){var e=this.aniList[0];return e?e.delay+e.duration+e.endDelay:0},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"playCount",{get:function(){var e=this.aniList[0];return e?e.playCount:0},set:function(e){this.aniList.forEach(function(t){t.playCount=e})},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"playState",{get:function(){var e=this.aniList[0];return e?e.playState:"idle"},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"pending",{get:function(){var e=this.aniList[0];return!e||"running"!==e.playState},enumerable:!1,configurable:!0}),r}(M);function Cf(e){if(!(e.currentTime>=e.delay+e.duration)&&e instanceof Ha){var t=e.node;if(!(t instanceof Sf||t instanceof ef))return;if(t.gainNode&&(t.gainNode.disconnect(),t.gainNode=void 0),t.decoder){var r=t.decoder.currentGOP;if((null==r?void 0:r.audioBuffer)&&t.root){var i=t.root.audioContext;if(t.gainNode||(t.gainNode=i.createGain(),t.gainNode.gain.value=t.volumn),r.audioBufferSourceNode){try{r.audioBufferSourceNode.stop()}catch(e){}r.audioBufferSourceNode.disconnect(),r.audioBufferSourceNode=void 0}var a=i.createBufferSource();a.buffer=r.audioBuffer,a.connect(t.gainNode),t.gainNode.connect(i.destination),r.audioBufferSourceNode=a;var n=e.currentTime-e.delay;n>=r.audioTimestamp?a.start(0,.001*(n-r.audioTimestamp),.001*(e.duration-n)):a.start(i.currentTime+.001*(r.audioTimestamp-n),0,.001*(e.duration-r.audioTimestamp));for(var o=t.decoder.gopList,s=t.decoder.gopIndex+1,c=o.length;s<c;s++){var u=o[s];if(e.duration<=u.timestamp)return;if(u.audioBufferSourceNode){try{u.audioBufferSourceNode.stop()}catch(e){}u.audioBufferSourceNode.disconnect(),u.audioBufferSourceNode=void 0}if(u.audioBuffer){var l=i.createBufferSource();l.buffer=u.audioBuffer,t.gainNode||(t.gainNode=i.createGain(),t.gainNode.gain.value=t.volumn),l.connect(t.gainNode),t.gainNode.connect(i.destination),u.audioBufferSourceNode=l,l.start(i.currentTime+.001*(u.audioTimestamp-n),0,.001*(e.duration-u.audioTimestamp))}}}}}}function Af(e){var t,r;if(e instanceof Ha){var i=e.node;if(!(i instanceof Sf||i instanceof ef))return;i.gainNode&&(i.gainNode.disconnect(),i.gainNode=void 0),null===(r=null===(t=i.decoder)||void 0===t?void 0:t.gopList)||void 0===r||r.forEach(function(e){var t,r;try{null===(t=e.audioBufferSourceNode)||void 0===t||t.stop()}catch(e){}null===(r=e.audioBufferSourceNode)||void 0===r||r.disconnect(),e.audioBufferSourceNode=void 0})}}var _f,Mf,If,Rf,Pf,Of,Df,Bf,Ff=function(e){function r(t){var r=e.call(this,t)||this;t.onMeta&&(r.onMeta=t.onMeta),t.onLoad&&(r.onLoad=t.onLoad),r._currentTime=t.currentTime||0;var i=function(){var e=window.lottie;if(!e)throw new Error("Missing lottie-web library");r._metaData={duration:1e3*r._json.op/r._json.fr},r.contentLoadingNum=0,r.onMeta&&r.onMeta(r._metaData),r.emit(Ia,r._metaData);var t=document.createElement("div");t.style.width=r._json.w+"px",t.style.height=r._json.h+"px",t.style.position="fixed",t.style.visibility="hidden",t.style.transform="translate(9999px, 9999px)",t.style.pointerEvents="none",document.body.appendChild(t);var i=r._lottie=e.loadAnimation({container:t,renderer:"canvas",loop:!0,autoplay:!0,animationData:r._json,rendererSettings:{preserveDrawingBuffer:!0}});i.addEventListener("DOMLoaded",function(){if(r.canvas=t.querySelector("canvas"),r._currentTime>=0&&r._currentTime<r._metaData.duration&&i.goToAndStop(r._currentTime),r.isMounted){var e=r.style,a=e.left,n=e.top,o=e.right,s=e.bottom,c=e.width,u=e.height;(a.u===V.AUTO||o.u===V.AUTO)&&c.u===V.AUTO||(n.u===V.AUTO||s.u===V.AUTO)&&u.u===V.AUTO?r.refresh(ci.REFLOW):r.refresh()}r.onLoad&&r.onLoad(),r.emit(Pa)})};if(t.src)r._src=t.src,r._currentTime>=0&&(r.contentLoadingNum=1),fetch(t.src,t.options).then(function(e){return e.json()}).then(function(e){r._json=e,i()});else{if(!t.json)throw new Error("Missing src or json in Lottie");r._json=t.json,i()}return r}return t(r,e),r.prototype.lay=function(t){e.prototype.lay.call(this,t);var r=this,i=r.style,a=r.computedStyle,n=r._json,o=i.left,s=i.top,c=i.right,u=i.bottom,l=i.width,h=i.height;if(n){var d=(o.u===V.AUTO||c.u===V.AUTO)&&l.u===V.AUTO,f=(s.u===V.AUTO||u.u===V.AUTO)&&h.u===V.AUTO;d&&(a.width=f?n.w:n.w*a.height/n.h,o.u===V.AUTO&&c.u===V.AUTO?(a.left=0,a.right=t.w-a.width):o.u===V.AUTO?a.left=t.w-a.right-a.width:c.u===V.AUTO&&(a.right=t.w-a.left-a.width)),f&&(a.height=d?n.h:n.h*a.width/n.w,s.u===V.AUTO&&u.u===V.AUTO?(a.top=0,a.bottom=t.h-a.height):s.u===V.AUTO?a.top=t.h-a.bottom-a.height:u.u===V.AUTO&&(a.bottom=t.h-a.top-a.height))}},r.prototype.calContent=function(){return this.hasContent=!1,this._metaData?this._currentTime>=0&&this._currentTime<this._metaData.duration&&(this.hasContent=!0):this.hasContent=this.computedStyle.backgroundColor[3]>0,this.hasContent},r.prototype.renderCanvas=function(){var t=this,r=t._json,i=t._currentTime,a=t._metaData,n=t.canvas,o=t.computedStyle;e.prototype.renderCanvas.call(this);var s=this._bboxInt||this.bboxInt,c=s[0],u=s[1],l=s[2]-c,h=s[3]-u,d=0,f=0,m=o.width,p=o.height,g=o.objectFit;if(r&&n&&a&&i>=0&&i<a.duration){var v=r.w/r.h,y=m/p;if(g===ae.CONTAIN){if(y>v){var b=p*v;d+=.5*(m-b),m=b}else if(y<v){var x=m/v;f+=.5*(p-x),p=x}}else if(g===ae.COVER)if(y>v){var T=m/v;f=.5*(p-T),p=T}else if(y<v){var w=p*v;d=.5*(m-w),m=w}}var k=this.canvasCache=new xi(l,h,-c,-u);k.available=!0;var S=k.list;if(o.backgroundColor[3]>0){var E=this.getBackgroundCoords(c,u);S.forEach(function(e){var t=e.x,r=e.y,i=e.os.ctx;i.fillStyle=fe(o.backgroundColor),i.beginPath(),ba(i,E,-t,-r),i.closePath(),i.fill()})}for(var C=0,A=S.length;C<A;C++){var _=S[C],M=_.x,I=_.y,R=_.os.ctx,P=-M,O=-I;n&&R.drawImage(n,P+d,O+f,m,p)}},r.prototype.calContentLoading=function(){var t=e.prototype.calContentLoading.call(this);return t?this._currentTime>=0&&this._metaData&&this._currentTime<this._metaData.duration?t:0:t},r.prototype.release=function(){e.prototype.release.call(this);var t=this.lottie;t&&t.destroy()},r.prototype.timeAnimate=function(e,t){var r;null===(r=this.timeAnimation)||void 0===r||r.remove();var i=this.timeAnimation=new Ha(this,e,t);return this.initAnimate(i,t)},Object.defineProperty(r.prototype,"src",{get:function(){return this._src},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"json",{get:function(){return this._json},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"currentTime",{get:function(){return this._currentTime},set:function(e){if(this._currentTime!==e){this._currentTime=e;var t=this._lottie;t&&(t.goToAndStop(e),this.refresh())}},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"duration",{get:function(){var e;return(null===(e=this._metaData)||void 0===e?void 0:e.duration)||0},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"metaData",{get:function(){return this._metaData},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"lottie",{get:function(){return this._lottie},enumerable:!1,configurable:!0}),r}(ka);!function(e){e[e.INIT=0]="INIT",e[e.FRAME=1]="FRAME",e[e.END=2]="END"}(_f||(_f={})),function(e){e[e.PROGRESS=0]="PROGRESS",e[e.FINISH=1]="FINISH",e[e.ERROR=2]="ERROR"}(Mf||(Mf={}));var Lf,Nf=0,Uf=0,zf=[],Wf=0,Vf=0;function Hf(e,t,r){var i=t.numberOfChannels,a=t.sampleRate;if(e&&"configured"===e.state&&r){var n=Math.floor(.001*r*a);if(n>Wf){for(var o=n-Wf,s=new Float32Array(o*zf.length),c=0;c<zf.length;c++){var u=zf[c].subarray(Wf,n);s.set(u,c*o)}var l=new AudioData({format:"f32-planar",sampleRate:a,numberOfFrames:o,numberOfChannels:i,timestamp:Vf,data:s});Wf=n,Vf=r,e.encode(l)}}}var Xf=function(e){return i(void 0,void 0,void 0,function(){var t,r,i,n,o,s,c,u,l,h,d,f,m,p,g,v,y,b,x,T,w,k,S,E,C,A,_,M,I,R,P;return a(this,function(a){switch(a.label){case 0:if(t=e.data,r=t.type,i=t.isWorker,n=function(e){var t={type:Mf.ERROR,error:e};return i&&self.postMessage(t),{data:t}},Nf>=0&&(Lf=new Promise(function(e){Bf=e})),r!==_f.INIT)return[3,2];if(Lf=void 0,Nf=e.data.encoderFrameQue||0,Uf=0,Nf>=0&&(Lf=new Promise(function(e){Bf=e})),If&&(If.close(),If=void 0),Rf&&(Rf.close(),Rf=void 0),o=function(){if(Lf&&(! --Uf||Uf<Nf)){var e={type:Mf.PROGRESS};i&&self.postMessage(e),Bf({data:e})}},s=null===(R=e.data.videoEncoderConfig)||void 0===R?void 0:R.codec,c=void 0,c=/^vp/.test(s)?new kd:new xd,Pf=new Pd({format:c,target:new ld}),/^vp8/.test(s)?Of=new Cd("vp8"):/^vp09\./.test(s)?Of=new Cd("vp9"):/^av01\./.test(s)?Of=new Cd("av1"):/^hev1\./.test(s)||/^hvc1\./.test(s)?Of=new Cd("hevc"):(/^avc1\./.test(s)||/^avc3\./.test(s))&&(Of=new Cd("avc")),Of&&(Pf.addVideoTrack(Of),If=new VideoEncoder({output:function(t,r){var i=ss.fromEncodedChunk(t);Of.add(i,r),Rf&&Hf(Rf,e.data.audioEncoderConfig,.001*t.timestamp),o()},error:function(e){n(e.message)}}),If.configure(e.data.videoEncoderConfig)),u=null===(P=e.data.audioEncoderConfig)||void 0===P?void 0:P.codec,e.data.mute?Df=void 0:/^mp3/.test(u)?Df=new _d("mp3"):/^flac/.test(u)?Df=new _d("flac"):/^opus/.test(u)?Df=new _d("opus"):/^vorbis/.test(u)?Df=new _d("vorbis"):/^pcm-/.test(u)?Df=new _d(u):/^mp4a\./.test(u)?Df=new _d("aac"):/^ulaw/.test(u)?Df=new _d("ulaw"):/^alaw/.test(u)&&(Df=new _d("alaw")),Df){for(Pf.addAudioTrack(Df),Rf=new AudioEncoder({output:function(e,t){var r=ss.fromEncodedChunk(e);Df.add(r,t)},error:function(e){n(e.message)}}),Rf.configure(e.data.audioEncoderConfig),zf.splice(0),l=e.data.audioEncoderConfig.sampleRate*Math.ceil(.001*e.data.duration),g=0;g<e.data.audioEncoderConfig.numberOfChannels;g++)zf.push(new Float32Array(l));Wf=0,Vf=0}return[4,Pf.start()];case 1:return a.sent(),[3,15];case 2:return r!==_f.FRAME?[3,10]:(Uf++,h=e.data.videoFrame,If&&"configured"===If.state&&h?If.encodeQueueSize>5?[4,Xd(100)]:[3,8]:[3,9]);case 3:a.sent(),oe.warn("encodeQueueSize: "+If.encodeQueueSize),g=0,a.label=4;case 4:return g<20?If.encodeQueueSize>5?[4,Xd(100)]:[3,6]:[3,8];case 5:return a.sent(),oe.warn("encodeQueueSize: "+If.encodeQueueSize+", "+g),[3,7];case 6:return[3,8];case 7:return g++,[3,4];case 8:If.encode(h),a.label=9;case 9:if(null==h||h.close(),Rf){if((d=e.data.audioList).length&&d.length)for(f=e.data.audioEncoderConfig,m=f.numberOfChannels,p=f.sampleRate,g=0,v=d.length;g<v;g++)for(y=d[g],b=y.audioChunk,x=y.volume,T=Math.round(.001*b.timestamp*p),w=b.numberOfFrames,k=0;k<m;k++)for(S=zf[k],E=b.channels[k],C=0;C<w;C++)_=S[A=T+C]+E[C]*x,S[A]=Math.max(-1,Math.min(1,_));Hf(Rf,e.data.audioEncoderConfig,e.data.timestamp)}return!Lf||Uf<Nf?(I={type:Mf.PROGRESS},i&&self.postMessage(I),[2,{data:I}]):[2,Lf];case 10:return r!==_f.END?[3,15]:If&&Pf?[4,If.flush()]:[2];case 11:return a.sent(),If.close(),If=void 0,"configured"!==(null==Rf?void 0:Rf.state)?[3,13]:(Hf(Rf,e.data.audioEncoderConfig,e.data.timestamp),[4,Rf.flush()]);case 12:a.sent(),Rf.close(),Rf=void 0,a.label=13;case 13:return[4,Pf.finalize()];case 14:if(a.sent(),M=Pf.target.buffer,Pf=void 0,I={type:Mf.FINISH,buffer:M},!i)return[2,{data:I}];self.postMessage(I,[M]),a.label=15;case 15:return[2]}})})};function jf(e,t,r){return i(this,void 0,void 0,function(){var i,n,o,s,c,u;return a(this,function(a){switch(a.label){case 0:return e.numberOfChannels===t&&e.sampleRate===r?[2,e]:(i=Math.round(e.length*r/e.sampleRate),n=new OfflineAudioContext(t,i,r),o=n.createBufferSource(),1===e.numberOfChannels&&2===t?(s=new OfflineAudioContext(2,e.length,e.sampleRate),c=s.createBuffer(2,e.length,e.sampleRate),u=e.getChannelData(0),c.copyToChannel(u,0,0),c.copyToChannel(u,1,0),o.buffer=c):o.buffer=e,o.connect(n.destination),o.start(0),[4,n.startRendering()]);case 1:return[2,a.sent()]}})})}function Gf(e,t,r){var i=Math.floor(.001*t*e.sampleRate),a=Math.min(Math.ceil(.001*r*e.sampleRate),e.length);if(i>a||i>=e.length)throw new Error("Invalid range");if(0===i&&a>=e.length-1)return e;for(var n=new OfflineAudioContext(e.numberOfChannels,a-i+1,e.sampleRate).createBuffer(e.numberOfChannels,a-i+1,e.sampleRate),o=0;o<e.numberOfChannels;o++){var s=e.getChannelData(o).subarray(i,a+1);n.copyToChannel(s,o,0)}return n}self.onmessage=Xf;var Yf,qf,Kf,$f={stereo2Mono:function(e,t){for(var r=e.length,i=new Float32Array(r),a=0;a<r;a++)i[a]=.5*(e[a]+t[a]);return i},extractAudioBuffer:function(e,t,r){var i=e.sampleRate,a=e.numberOfChannels,n=Math.floor(.001*t*i),o=Math.min(Math.ceil(.001*r*i),e.length),s=o-n;if(!(s<=0)){for(var c=1e3*n/i,u=1e3*s/i,l=[],h=0;h<a;h++){var d=e.getChannelData(h).subarray(n,o);l.push(new Float32Array(d))}return{format:"f32-planar",channels:l,numberOfFrames:s,startFrame:n,endFrame:o,sampleRate:i,numberOfChannels:a,timestamp:c,duration:u}}},reSample:jf,sliceAudioBuffer:Gf,convertS16ToFloat32:function(e,t){var r=new Int16Array(e instanceof ArrayBuffer?e:e.buffer);r.length!==t&&console.error("数据长度校验失败:预期 ".concat(t," 个样本,实际 Int16Array 长度为 ").concat(r.length,"。"));for(var i=new Float32Array(t),a=0;a<t;a++){var n=r[a];i[a]=n/32768}return i}},Qf=0;!function(e){e.START="start",e.PROGRESS="progress",e.FINISH="finish",e.ERROR="error"}(Kf||(Kf={}));var Zf=function(e){function r(){return e.call(this)||this}return t(r,e),r.prototype.initWorker=function(){if(!Yf)if(L.encoderWorker)Yf=new Worker(L.encoderWorker);else if(L.encoderWorkerStr){var e=new Blob([L.encoderWorkerStr.trim()],{type:"application/javascript"}),t=URL.createObjectURL(e);Yf=new Worker(t)}},r.prototype.start=function(e,t){return i(this,void 0,void 0,function(){var r,n,o,s,c,u,l,h,d,f,m,p,g,v=this;return a(this,function(y){switch(y.label){case 0:if(!e.canvas)throw new Error("Root Missing appendTo canvas");return this.initWorker(),r=Object.assign({codec:"avc1.420028",width:e.width,height:e.height,bitrate:5e6,bitrateMode:"variable",framerate:30,hardwareAcceleration:"no-preference"},null==t?void 0:t.video),[4,VideoEncoder.isConfigSupported(r)];case 1:if(!(n=y.sent())||!n.supported)throw new Error("Unsupported video encoder config");return o=Object.assign({codec:"opus",sampleRate:44100,numberOfChannels:2},null==t?void 0:t.audio),s=(null==t?void 0:t.timestamp)||0,(c=(null==t?void 0:t.duration)||e.aniController.duration)&&r.framerate?(u=1e3/r.framerate,l=Math.ceil((c-s)/u),h=Math.floor(s/u),d={type:_f.INIT,messageId:Qf++,isWorker:!!L.encoderWorker||!!L.encoderWorkerStr,duration:c,num:l,videoEncoderConfig:r,audioEncoderConfig:o,mute:L.mute,encoderFrameQue:L.encoderFrameQue},Yf?(Yf.postMessage(d),[3,4]):[3,2]):[2];case 2:return[4,Xf({data:d})];case 3:y.sent(),y.label=4;case 4:this.emit(Kf.START,l),f={},m=function(t){var r;return a(this,function(n){switch(n.label){case 0:return r=(t+h)*u,e.aniController.gotoAndStop(r),p.emit(Kf.PROGRESS,t,l,!0),[4,new Promise(function(n,s){var c=function(){return i(v,void 0,void 0,function(){var i,c,h,d,m,p,g,v,y,b,x,T,w,k,S,E,C,A,_,M,I,R=this;return a(this,function(a){switch(a.label){case 0:return[4,createImageBitmap(e.canvas)];case 1:if(i=a.sent(),c=new VideoFrame(i,{timestamp:1e3*r,duration:1e3*u}),h=[],L.mute)return[3,5];d=0,m=e.aniController.aniList.length,a.label=2;case 2:return d<m?(p=e.aniController.aniList[d],g=p.delay,v=p.duration,p instanceof Ha&&p.currentTime>=g&&p.currentTime<v+g?(y=p.node)instanceof Ff||!y.volumn?[3,4]:(b=y.decoder)&&(x=b.currentGOP)&&(T=x.audioBuffer)?(w=y.id+"-"+x.index,f[w]?[3,4]:(f[w]=!0,k=x.audioTimestamp-x.timestamp,[4,jf(Gf(T,0,p.duration-x.audioTimestamp),o.numberOfChannels,o.sampleRate)])):[3,4]:[3,4]):[3,5];case 3:for(S=a.sent(),E=[],C=0;C<o.numberOfChannels;C++)A=S.getChannelData(C),E.push(A);h.push({audioChunk:{format:"f32-planar",channels:E,sampleRate:o.sampleRate,numberOfChannels:o.numberOfChannels,numberOfFrames:S.length,timestamp:r+k,duration:1e3*S.duration},volume:y.volumn}),a.label=4;case 4:return d++,[3,2];case 5:return _=function(e){e.data.type===Mf.PROGRESS?(n(),R.emit(Kf.PROGRESS,t,l,!1)):(s(e.data.error),R.emit(Kf.ERROR,e.data.error))},M={type:_f.FRAME,messageId:Qf++,isWorker:!!L.encoderWorker||!!L.encoderWorkerStr,timestamp:r,videoFrame:c,audioList:h,audioEncoderConfig:o,mute:L.mute},(I=[]).push(c),h.forEach(function(e){e.audioChunk.channels.forEach(function(e){I.push(e.buffer)})}),Yf?(Yf.onmessage=_,Yf.postMessage(M,I)):Xf({data:M}).then(function(e){_(e)}),[2]}})})};e.contentLoadingCount?e.once(Ma,c):e.rl?e.once(Aa,c):c()})];case 1:return n.sent(),[2]}})},p=this,g=0,y.label=5;case 5:return g<l?[5,m(g)]:[3,8];case 6:y.sent(),y.label=7;case 7:return g++,[3,5];case 8:return[2,new Promise(function(e){var t=function(t){t.data.type===Mf.FINISH&&e(t.data.buffer),v.emit(Kf.FINISH)},i={type:_f.END,messageId:Qf++,isWorker:!!L.encoderWorker||!!L.encoderWorkerStr,videoEncoderConfig:r,audioEncoderConfig:o,timestamp:s+u};Yf?(Yf.onmessage=t,Yf.postMessage(i)):Xf({data:i}).then(function(e){t(e)})})]}})})},r.getInstance=function(){return qf||(qf=new r),qf},r}(M),Jf=function(e){function r(t,r){void 0===r&&(r=[]);var i=e.call(this,t,r)||this;return i.root=i,i.refs={},i.structs=[],i.task=[],i.aniTask=[],i.rl=ci.NONE,i.programs={},i.frameCb=function(e){var t=i.aniTask.slice(0);t.forEach(function(t){t.onRunning(e)});var r=i.task.splice(0);r.length&&i.draw(),t.forEach(function(e){e.afterRunning()}),r.forEach(function(e){e&&e(!1)}),i.task.length||i.aniTask.length||wf.offFrame(i.frameCb)},i.audioContext=new AudioContext,i.aniController=new Ef(i.audioContext),i.contentLoadingCount=0,i.lastContentLoadingCount=0,i.firstDraw=!0,i}return t(r,e),r.prototype.appendTo=function(e){this.canvas=e;var t=Object.assign(Fa,this.props.contextAttributes),r=e.getContext("webgl2",t);if(r?this.isWebgl2=!0:(r=e.getContext("webgl",t),this.isWebgl2=!1),!r)throw new Error("Webgl unsupported!");this.appendToGl(r)},r.prototype.appendToGl=function(e){this.ctx?oe.error("Duplicate appendToGl"):(this.ctx=e,L.init(e.getParameter(e.MAX_TEXTURE_SIZE),e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),e.getParameter(e.MAX_VARYING_VECTORS)),this.initProgram(e),this.reLayout(),this.didMount(),this.structs=this.structure(0),this.asyncDraw())},r.prototype.reLayout=function(){this.checkRoot(),this.layout({w:this.computedStyle.width,h:this.computedStyle.height})},r.prototype.checkRoot=function(){var e,t=this.style,r=t.width,i=t.height,a=this.canvas;r.u===V.AUTO?a&&(r.u=V.PX,this.computedStyle.width=r.v=Math.max(1,a.width)):this.computedStyle.width=Math.max(1,this.style.width.v),i.u===V.AUTO?a&&(i.u=V.PX,this.computedStyle.height=i.v=Math.max(1,a.height)):this.computedStyle.height=Math.max(1,this.style.height.v),null===(e=this.ctx)||void 0===e||e.viewport(0,0,this.computedStyle.width,this.computedStyle.height)},r.prototype.addUpdate=function(e,t,r,i){if(void 0===r&&(r=ci.NONE),!this.isMounted)return ci.NONE;var a=r;if(t&&t.length)for(var n=0,o=t.length;n<o;n++){a|=li(t[n])}return this.calUpdate(e,a)?this.asyncDraw(i):i&&i(!0),a},r.prototype.calUpdate=function(e,t){if(t===ci.NONE||!this.isMounted)return!1;var r=function(e){return e>=ci.REFLOW}(t);if(r)e===this?this.reLayout():function(e,t){var r=e.parent;t&ci.REMOVE_DOM?e.didUnmount():(e.layout({w:r.computedStyle.width,h:r.computedStyle.height}),t&ci.ADD_DOM&&e.didMount())}(e,t);else if(t>=ci.REPAINT)e.calRepaintStyle(t);else{var i=e.style,a=e.computedStyle;t&ci.TRANSFORM_ALL&&e.calMatrix(t),t&(ci.PERSPECTIVE|ci.TRANSLATE|ci.TRANSFORM_ALL)&&e.calPerspective(),t&(ci.PERSPECTIVE_SELF|ci.TRANSLATE|ci.TRANSFORM_ORIGIN|ci.TRANSFORM_ALL)&&e.calPerspectiveSelf(),t&ci.OPACITY&&e.calOpacity(),t&ci.FILTER&&e.calFilter(t),t&ci.MIX_BLEND_MODE&&(a.mixBlendMode=i.mixBlendMode.v);var n=!1;if(t&ci.MASK&&(e.clearMask(),n=!0,e.calMask()),t&ci.BREAK_MASK){var o=e.mask;e.calMask();var s=e.mask;if(a.breakMask&&o?o.clearMask():!a.breakMask&&s||(t&=ci.FULL^ci.BREAK_MASK),!a.breakMask||o)for(var c=e.prev;c;){if(c.computedStyle.maskMode){c.clearMask();break}if(c.computedStyle.breakMask)break;c=c.prev}}a.maskMode&&!n&&t&&e.clearMask()}e.clearTexCacheUpward(),e.refreshLevel|=t,this.rl|=t;var u=e.mask;!u||t&ci.MASK||t&ci.BREAK_MASK||u.clearMask();for(var l=e.parent;l;){if(l.computedStyle.visibility===te.HIDDEN)return!1;l=l.parent}return t>ci.NONE},r.prototype.asyncDraw=function(e){var t=this.task,r=this.aniTask;t.length||r.length||wf.onFrame(this.frameCb),t.push(e)},r.prototype.cancelAsyncDraw=function(e){var t=this.task,r=this.aniTask,i=t.indexOf(e);i>-1&&(t.splice(i,1),t.length||r.length||wf.offFrame(this.frameCb))},r.prototype.addAnimation=function(e){var t=this.task,r=this.aniTask;t.length||r.length||wf.onFrame(this.frameCb),-1===r.indexOf(e)&&r.push(e)},r.prototype.removeAnimation=function(e){var t=this.task,r=this.aniTask,i=r.indexOf(e);i>-1&&(r.splice(i,1),t.length||r.length||wf.offFrame(this.frameCb))},r.prototype.draw=function(){this.isMounted&&(this.rl>ci.NONE&&(this.clear(),this.rl=ci.NONE,this.ctx&&(bf(this.ctx,this),this.emit("refresh"),this.contentLoadingCount?this.lastContentLoadingCount||this.emit(_a):((this.lastContentLoadingCount||this.firstDraw)&&this.emit(Ma),this.emit(Aa)),this.lastContentLoadingCount=this.contentLoadingCount,this.firstDraw=!1)))},r.prototype.clear=function(){var e=this.ctx;e&&(e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT))},r.prototype.initProgram=function(e){var t=this.isWebgl2;this.programs.main=new Va(e,Ti(e,"#define GLSLIFY 1\nattribute vec4 a_position;varying vec4 v_position;attribute vec2 a_texCoords;varying vec2 v_texCoords;void main(){gl_Position=vec4(a_position.xy,0,a_position.z);v_position=gl_Position;v_texCoords=a_texCoords;}","#ifdef GL_ES\nprecision mediump float;\n#define GLSLIFY 1\n#endif\nvarying vec4 v_position;varying vec2 v_texCoords;uniform float u_opacity;uniform sampler2D u_texture;void main(){if(u_opacity<=0.0){discard;}vec4 color=texture2D(u_texture,v_texCoords);if(color.a<=0.0){discard;}gl_FragColor=color*u_opacity;}"),{uniform:["u_clip","u_texture","u_opacity"],attrib:["a_position","a_texCoords"]}),t&&(this.programs.pr=new Va(e,Ti(e,"#version 300 es\n#define GLSLIFY 1\nin vec3 a_position;in vec2 a_texCoords;in float a_opacity;in float a_textureIndex;in vec4 a_clip;out vec4 v_position;out vec2 v_texCoords;out float v_opacity;out float v_textureIndex;out vec4 v_clip;void main(){gl_Position=vec4(a_position.xy,0,a_position.z);v_position=gl_Position;v_texCoords=a_texCoords;v_opacity=a_opacity;v_textureIndex=a_textureIndex;v_clip=a_clip;}","#version 300 es\n#ifdef GL_ES\nprecision mediump float;\n#define GLSLIFY 1\n#endif\nin vec4 v_position;in vec2 v_texCoords;in float v_opacity;in float v_textureIndex;out vec4 fragColor;uniform sampler2D u_texture[16];void main(){if(v_opacity<=0.0){discard;}vec4 color;if(v_textureIndex==0.0){color=texture(u_texture[0],v_texCoords);}else if(v_textureIndex==1.0){color=texture(u_texture[1],v_texCoords);}else if(v_textureIndex==2.0){color=texture(u_texture[2],v_texCoords);}else if(v_textureIndex==3.0){color=texture(u_texture[3],v_texCoords);}else if(v_textureIndex==4.0){color=texture(u_texture[4],v_texCoords);}else if(v_textureIndex==5.0){color=texture(u_texture[5],v_texCoords);}else if(v_textureIndex==6.0){color=texture(u_texture[6],v_texCoords);}else if(v_textureIndex==7.0){color=texture(u_texture[7],v_texCoords);}else if(v_textureIndex==8.0){color=texture(u_texture[8],v_texCoords);}else if(v_textureIndex==9.0){color=texture(u_texture[9],v_texCoords);}else if(v_textureIndex==10.0){color=texture(u_texture[10],v_texCoords);}else if(v_textureIndex==11.0){color=texture(u_texture[11],v_texCoords);}else if(v_textureIndex==12.0){color=texture(u_texture[12],v_texCoords);}else if(v_textureIndex==13.0){color=texture(u_texture[13],v_texCoords);}else if(v_textureIndex==14.0){color=texture(u_texture[14],v_texCoords);}else if(v_textureIndex==15.0){color=texture(u_texture[15],v_texCoords);}fragColor=color*v_opacity;}"),{uniform:["u_texture[0]","u_texture[1]","u_texture[2]","u_texture[3]","u_texture[4]","u_texture[5]","u_texture[6]","u_texture[7]","u_texture[8]","u_texture[9]","u_texture[10]","u_texture[11]","u_texture[12]","u_texture[13]","u_texture[14]","u_texture[15]"],attrib:["a_position","a_texCoords","a_opacity","a_clip","a_textureIndex"]})),this.programs.box=new Va(e,Ti(e,kf,"#ifdef GL_ES\nprecision mediump float;\n#define GLSLIFY 1\n#endif\nvarying vec2 v_texCoords;uniform sampler2D u_texture;uniform float u_pw;uniform float u_ph;uniform int u_r;uniform int u_direction;const int MAX_KERNEL_SIZE=1024;void main(){vec4 color=texture2D(u_texture,v_texCoords);float total=1.0;if(u_r==0){if(u_direction==0){color+=texture2D(u_texture,vec2(v_texCoords.x+u_pw,v_texCoords.y))*0.125;color+=texture2D(u_texture,vec2(v_texCoords.x-u_pw,v_texCoords.y))*0.125;}else{color+=texture2D(u_texture,vec2(v_texCoords.x,v_texCoords.y+u_ph))*0.125;color+=texture2D(u_texture,vec2(v_texCoords.x,v_texCoords.y-u_ph))*0.125;}total+=0.25;}else{for(int i=1;i<MAX_KERNEL_SIZE;i++){if(u_direction==0){float offset=float(i)*u_pw;color+=texture2D(u_texture,vec2(v_texCoords.x+offset,v_texCoords.y));color+=texture2D(u_texture,vec2(v_texCoords.x-offset,v_texCoords.y));}else{float offset=float(i)*u_ph;color+=texture2D(u_texture,vec2(v_texCoords.x,v_texCoords.y+offset));color+=texture2D(u_texture,vec2(v_texCoords.x,v_texCoords.y-offset));}total+=2.0;if(i>=u_r){break;}}}gl_FragColor=color/total;}"),{uniform:["u_texture","u_pw","u_ph","u_r","u_direction"],attrib:["a_position","a_texCoords"]}),this.programs.dualDown=new Va(e,Ti(e,kf,"#ifdef GL_ES\nprecision mediump float;\n#define GLSLIFY 1\n#endif\nvarying vec2 v_texCoords;uniform vec2 u_xy;uniform sampler2D u_texture;void main(){vec4 color=texture2D(u_texture,v_texCoords);color+=texture2D(u_texture,v_texCoords+vec2(u_xy.x,u_xy.y))*0.125;color+=texture2D(u_texture,v_texCoords+vec2(u_xy.x,-u_xy.y))*0.125;color+=texture2D(u_texture,v_texCoords+vec2(-u_xy.x,u_xy.y))*0.125;color+=texture2D(u_texture,v_texCoords+vec2(-u_xy.x,-u_xy.y))*0.125;gl_FragColor=color;}"),{uniform:["u_xy","u_texture"],attrib:["a_position","a_texCoords"]}),this.programs.dualUp=new Va(e,Ti(e,kf,"#ifdef GL_ES\nprecision mediump float;\n#define GLSLIFY 1\n#endif\nvarying vec2 v_texCoords;uniform float u_x;uniform float u_y;uniform sampler2D u_texture;void main(){vec4 color=texture2D(u_texture,v_texCoords+vec2(u_x,u_y)*0.5)*2.0;color+=texture2D(u_texture,v_texCoords+vec2(u_x,-u_y)*0.5)*2.0;color+=texture2D(u_texture,v_texCoords+vec2(-u_x,u_y)*0.5)*2.0;color+=texture2D(u_texture,v_texCoords+vec2(-u_x,-u_y)*0.5)*2.0;color+=texture2D(u_texture,v_texCoords+vec2(u_x,0.0));color+=texture2D(u_texture,v_texCoords+vec2(-u_x,0.0));color+=texture2D(u_texture,v_texCoords+vec2(0.0,u_y));color+=texture2D(u_texture,v_texCoords+vec2(0.0,-u_y));gl_FragColor=color/12.0;}"),{uniform:["u_x","u_y","u_texture"],attrib:["a_position","a_texCoords"]}),this.programs.motion=new Va(e,Ti(e,kf,"#ifdef GL_ES\nprecision mediump float;\n#define GLSLIFY 1\n#endif\nvarying vec2 v_texCoords;uniform sampler2D u_texture;uniform int u_kernel;uniform vec4 u_velocity;uniform int u_limit;const int MAX_KERNEL_SIZE=1024;void main(){vec4 color=texture2D(u_texture,v_texCoords+u_velocity.zw);for(int i=1;i<MAX_KERNEL_SIZE;i++){if(i>=u_kernel){break;}vec2 bias=u_velocity.xy*(float(i)/float(u_kernel));vec2 c1=v_texCoords+bias+u_velocity.zw;vec2 c2=v_texCoords-bias+u_velocity.zw;if(u_limit==1){if(c1.x<0.0){c1.x+=1.0;}else if(c1.x>1.0){c1.x-=1.0;}if(c1.y<0.0){c1.y+=1.0;}else if(c1.y>1.0){c1.y-=1.0;}if(c2.x<0.0){c2.x+=1.0;}else if(c2.x>1.0){c2.x-=1.0;}if(c2.y<0.0){c2.y+=1.0;}else if(c2.y>1.0){c2.y-=1.0;}}color+=texture2D(u_texture,c1);color+=texture2D(u_texture,c2);}gl_FragColor=color/float((u_kernel-1)*2+1);}"),{uniform:["u_kernel","u_velocity","u_texture","u_limit"],attrib:["a_position","a_texCoords"]}),this.programs.radial=new Va(e,Ti(e,kf,"#ifdef GL_ES\nprecision mediump float;\n#define GLSLIFY 1\n#endif\nvarying vec2 v_texCoords;uniform sampler2D u_texture;uniform int u_kernel;uniform vec2 u_center;uniform float u_ratio;const int MAX_KERNEL_SIZE=1024;void main(void){if(v_texCoords.x==u_center.x&&v_texCoords.y==u_center.y){gl_FragColor=texture2D(u_texture,v_texCoords);return;}vec4 color=texture2D(u_texture,v_texCoords);int k=u_kernel-1;float total=1.0;for(int i=1;i<MAX_KERNEL_SIZE-1;i++){if(i>=k){break;}total++;vec2 velocity=-(v_texCoords-u_center)*u_ratio;vec2 bias=velocity*(float(i)/float(k));color+=texture2D(u_texture,v_texCoords+bias);}gl_FragColor=color/total;}"),{uniform:["u_kernel","u_center","u_ratio","u_texture"],attrib:["a_position","a_texCoords"]}),this.programs.cm=new Va(e,Ti(e,kf,"#ifdef GL_ES\nprecision mediump float;\n#define GLSLIFY 1\n#endif\nvarying vec2 v_texCoords;uniform sampler2D u_texture;uniform float u_m[20];void main(){vec4 c=texture2D(u_texture,v_texCoords);if(c.a>0.0){c.rgb/=c.a;}vec4 result;result.r=(u_m[0]*c.r);result.r+=(u_m[1]*c.g);result.r+=(u_m[2]*c.b);result.r+=(u_m[3]*c.a);result.r+=u_m[4];result.g=(u_m[5]*c.r);result.g+=(u_m[6]*c.g);result.g+=(u_m[7]*c.b);result.g+=(u_m[8]*c.a);result.g+=u_m[9];result.b=(u_m[10]*c.r);result.b+=(u_m[11]*c.g);result.b+=(u_m[12]*c.b);result.b+=(u_m[13]*c.a);result.b+=u_m[14];result.a=(u_m[15]*c.r);result.a+=(u_m[16]*c.g);result.a+=(u_m[17]*c.b);result.a+=(u_m[18]*c.a);result.a+=u_m[19];gl_FragColor=vec4(result.rgb*result.a,result.a);}"),{uniform:["u_m","u_m[0]","u_texture"],attrib:["a_position","a_texCoords"]}),this.programs.mask=new Va(e,Ti(e,kf,"#ifdef GL_ES\nprecision mediump float;\n#define GLSLIFY 1\n#endif\nvarying vec2 v_texCoords;uniform sampler2D u_texture1;uniform sampler2D u_texture2;void main(){vec4 color1=texture2D(u_texture1,v_texCoords);if(color1.a<=0.0){discard;}vec4 color2=texture2D(u_texture2,v_texCoords);if(color2.a<=0.0){discard;}gl_FragColor=color2*color1.a;}"),{uniform:["u_texture1","u_texture2"],attrib:["a_position","a_texCoords"]}),this.programs.maskGray=new Va(e,Ti(e,kf,"#ifdef GL_ES\nprecision mediump float;\n#define GLSLIFY 1\n#endif\nvarying vec2 v_texCoords;uniform sampler2D u_texture1;uniform sampler2D u_texture2;uniform vec2 u_d;void main(){vec4 color1=texture2D(u_texture1,v_texCoords);if(color1.a<=0.0){discard;}vec4 color2=texture2D(u_texture2,v_texCoords+u_d);if(color2.a<=0.0){discard;}float gray=max(color1.r,max(color1.g,color1.b));gl_FragColor=color2*color1.a*gray;}"),{uniform:["u_texture1","u_texture2","u_d"],attrib:["a_position","a_texCoords"]}),this.programs.bloom=new Va(e,Ti(e,kf,"#ifdef GL_ES\nprecision mediump float;\n#define GLSLIFY 1\n#endif\nvarying vec2 v_texCoords;uniform sampler2D u_texture1;uniform sampler2D u_texture2;vec3 ACESFilm(vec3 x){float a=2.51;float b=0.03;float c=2.43;float d=0.59;float e=0.14;return clamp((x*(a*x+b))/(x*(c*x+d)+e),0.0,1.0);}void main(){vec3 sceneColor=texture2D(u_texture1,v_texCoords).rgb;sceneColor=pow(sceneColor,vec3(2.2));vec3 bloomColor=texture2D(u_texture2,v_texCoords).rgb;vec3 result=sceneColor+bloomColor;result=ACESFilm(result);result=pow(result,vec3(1.0/2.2));gl_FragColor=vec4(result,1.0);}"),{uniform:["u_texture1","u_texture2","u_threshold"],attrib:["a_position","a_texCoords"]}),this.programs.bloomBlur=new Va(e,Ti(e,kf,"#ifdef GL_ES\nprecision mediump float;\n#define GLSLIFY 1\n#endif\nvarying vec2 v_texCoords;uniform sampler2D u_texture;uniform float u_threshold;uniform float u_knee;void main(){vec4 color=texture2D(u_texture,v_texCoords);vec3 linearColor=pow(color.rgb,vec3(2.2));float brightness=dot(linearColor,vec3(0.299,0.587,0.114));float k=u_threshold*u_knee;float soft=brightness-u_threshold+k;soft=clamp(soft,0.0,2.0*k);soft=(soft*soft)/(4.0*k+0.0001);float factor=max(soft,brightness-u_threshold)/max(brightness,0.0001);vec3 brightPart=linearColor*factor;gl_FragColor=vec4(brightPart,1.0);}"),{uniform:["u_texture","u_threshold"],attrib:["a_position","a_texCoords"]}),this.programs.dualDown13=new Va(e,Ti(e,kf,"#ifdef GL_ES\nprecision mediump float;\n#define GLSLIFY 1\n#endif\nvarying vec2 v_texCoords;uniform vec2 u_xy;uniform sampler2D u_texture;void main(){vec4 color=texture2D(u_texture,v_texCoords)*0.125;color+=texture2D(u_texture,v_texCoords+vec2(u_xy.x,u_xy.y))*0.125;color+=texture2D(u_texture,v_texCoords+vec2(u_xy.x,-u_xy.y))*0.125;color+=texture2D(u_texture,v_texCoords+vec2(-u_xy.x,u_xy.y))*0.125;color+=texture2D(u_texture,v_texCoords+vec2(-u_xy.x,-u_xy.y))*0.125;color+=texture2D(u_texture,v_texCoords+vec2(u_xy.x*2.0,u_xy.y*2.0))*0.03125;color+=texture2D(u_texture,v_texCoords+vec2(u_xy.x*2.0,-u_xy.y*2.0))*0.03125;color+=texture2D(u_texture,v_texCoords+vec2(-u_xy.x*2.0,u_xy.y*2.0))*0.03125;color+=texture2D(u_texture,v_texCoords+vec2(-u_xy.x*2.0,-u_xy.y*2.0))*0.03125;color+=texture2D(u_texture,v_texCoords+vec2(u_xy.x*2.0,0))*0.0625;color+=texture2D(u_texture,v_texCoords+vec2(-u_xy.x*2.0,0))*0.0625;color+=texture2D(u_texture,v_texCoords+vec2(0,u_xy.y*2.0))*0.0625;color+=texture2D(u_texture,v_texCoords+vec2(0,-u_xy.y*2.0))*0.0625;gl_FragColor=color;}"),{uniform:["u_xy","u_texture"],attrib:["a_position","a_texCoords"]}),this.programs.dualUp13=new Va(e,Ti(e,kf,"#ifdef GL_ES\nprecision mediump float;\n#define GLSLIFY 1\n#endif\nvarying vec2 v_texCoords;uniform vec2 u_xy;uniform sampler2D u_texture1;uniform sampler2D u_texture2;void main(){vec4 color1=texture2D(u_texture1,v_texCoords);vec4 color2=texture2D(u_texture2,v_texCoords)*0.25;color2+=texture2D(u_texture2,v_texCoords+vec2(u_xy.x,u_xy.y))*0.125;color2+=texture2D(u_texture2,v_texCoords+vec2(u_xy.x,-u_xy.y))*0.125;color2+=texture2D(u_texture2,v_texCoords+vec2(-u_xy.x,u_xy.y))*0.125;color2+=texture2D(u_texture2,v_texCoords+vec2(-u_xy.x,-u_xy.y))*0.125;color2+=texture2D(u_texture2,v_texCoords+vec2(u_xy.x,0))*0.0625;color2+=texture2D(u_texture2,v_texCoords+vec2(-u_xy.x,0))*0.0625;color2+=texture2D(u_texture2,v_texCoords+vec2(0,u_xy.y))*0.0625;color2+=texture2D(u_texture2,v_texCoords+vec2(0,-u_xy.y))*0.0625;gl_FragColor=vec4(color1.rgb+color2.rgb*0.6,1.0);}"),{uniform:["u_xy","u_texture1","u_texture2"],attrib:["a_position","a_texCoords"]}),this.programs.lightDark=new Va(e,Ti(e,kf,"#ifdef GL_ES\nprecision mediump float;\n#define GLSLIFY 1\n#endif\nvarying vec2 v_texCoords;uniform sampler2D u_texture;uniform vec2 u_velocity;uniform int u_radius;const int MAX_KERNEL_SIZE=1024;void main(){vec4 color=texture2D(u_texture,v_texCoords);float total=float(u_radius);for(int i=1;i<MAX_KERNEL_SIZE;i++){if(i>u_radius){break;}vec2 bias=u_velocity.xy*float(i);vec2 bias1=v_texCoords+bias;vec2 bias2=v_texCoords-bias;float add=0.0;float reduce=0.0;if(bias1.x<0.0||bias1.x>1.0||bias1.y<0.0||bias1.y>1.0){add=1.0;}else{add=1.0-texture2D(u_texture,bias1).a;}if(bias2.x<0.0||bias2.x>1.0||bias2.y<0.0||bias2.y>1.0){reduce=-1.0;}else{reduce=texture2D(u_texture,bias2).a-1.0;}if(add>0.0){float f=(total-float(i))/total/total;color.r+=add*f;color.g+=add*f;color.b+=add*f;}if(reduce<0.0){float f=(total-float(i))/total/total;color.r+=reduce*f;color.g+=reduce*f;color.b+=reduce*f;}}gl_FragColor=vec4(clamp(0.0,color.r,1.0),clamp(0.0,color.g,1.0),clamp(0.0,color.b,1.0),color.a);}"),{uniform:["u_texture","u_velocity","u_radius"],attrib:["a_position","a_texCoords"]}),Va.useProgram(e,this.programs.main)},r.prototype.encode=function(e){return i(this,void 0,void 0,function(){return a(this,function(t){return[2,Zf.getInstance().start(this,e)]})})},r}(Ba),em=function(){function e(e,t,r,i,a){void 0===i&&(i=!1),void 0===a&&(a=!1),this.x=0,this.y=e,this.w=0,this.h=t,this.index=r,this.list=[],this.startEnter=i,this.endEnter=a}return e.prototype.add=function(e){this.list.push(e),this.w+=e.w},e.prototype.verticalAlign=function(){for(var e=this.baseline,t=this.list,r=0,i=t.length;r<i;r++){var a=t[r],n=a.baseline;if(n!==e){var o=e-n;a.y+=o}}},e.prototype.offsetX=function(e){this.x+=e;for(var t=this.list,r=0,i=t.length;r<i;r++)t[r].x+=e},e.prototype.offsetY=function(e){this.y+=e;for(var t=this.list,r=0,i=t.length;r<i;r++)t[r].y+=e},Object.defineProperty(e.prototype,"size",{get:function(){return this.list.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseline",{get:function(){for(var e=0,t=this.list,r=0,i=t.length;r<i;r++)e=Math.max(e,t[r].baseline);return e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lineHeight",{get:function(){var e=this.list;if(e.length){for(var t=0,r=0,i=e.length;r<i;r++)t=Math.max(t,e[r].lineHeight);return t}return this.h},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return Math.ceil(this.w)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return Math.ceil(this.lineHeight)},enumerable:!1,configurable:!0}),e}(),tm=function(e,t,r,i,a,n,o,s,c,u,l,h,d,f,m,p,g,v){this.x=e,this.y=t,this.w=r,this.lineHeight=i,this.baseline=a,this.contentArea=n,this.index=o,this.str=s,this.font=c,this.fontFamily=u,this.fontSize=l,this.color=h,this.letterSpacing=d,this.textDecoration=f,this.textShadow=m,this.stroke=p,this.strokeWidth=g,this.strokeEnable=v};function rm(e){return"\n"===e||"\u2028"===e}function im(e,t,r,i,a,n,o){var s=t,c=r,u=0,l=!1,h=Math.round(a/n);for(h<=0?h=1:h>r-t&&(h=r-t);s<c;){var d=e.measureText(i.slice(t,t+h)).width;if(d===a){u=a,l=!0;break}if(d>a+1e-10){if(l=!0,1===h){u=d;break}if(s===c-1||s-t===h-1){h=s-t;break}c=h+t-1;var f=Math.round((d-a)/n);f<=0&&(f=1),(h-=f)<s-t&&(h=s-t)}else{if(u=d,h===r-t)break;s=h+t;var m=Math.round((a-d)/n);m<=0&&(m=1),(h+=m)>c-t&&(h=c-t)}}for(var p=t,g=t+h;p<g;p++)if(rm(i.charAt(p)))return{hypotheticalNum:h=p-t,rw:u=e.measureText(i.slice(t,t+h)).width,newLine:l=!1};if(t+h<r&&/[\w.-]/.test(i.charAt(t+h-1)))for(var v=t+h-2;v>t;v--)if(!/[\w.-]/.test(i.charAt(v)))return{hypotheticalNum:h=v-t+1,rw:u=e.measureText(i.slice(t,t+h)).width,newLine:l=!0};return rm(i.charAt(t+h))&&(l=!1),{hypotheticalNum:h,rw:u,newLine:l}}function am(e,t,r){void 0===r&&(r=1),1!==r?(e.font=t.font.replace(/([\d.e+-]+)px/gi,function(e,t){return t*r+"px"}),e.letterSpacing=t.letterSpacing*r+"px"):(e.font=t.font,e.letterSpacing=t.letterSpacing+"px")}var nm=1e-4,om=function(e){function i(t){var r,i=e.call(this,t)||this;return i._content=t.content.toString()||"",i.rich=((null===(r=t.rich)||void 0===r?void 0:r.slice(0))||[]).map(function(e){return ii(e,i.style)}),i.computedRich=i.rich.map(function(e){return i.calComputedRich(e)}),i.mergeRich(),i.lineBoxList=[],i.cursor={isMulti:!1,startLineBox:0,endLineBox:0,startTextBox:0,endTextBox:0,startString:0,endString:0,start:0,end:0},i.tempCursorX=0,i}return t(i,e),i.prototype.didMount=function(){e.prototype.didMount.call(this);var t=this.props.textBehaviour,r=this,i=r.style,a=r.computedStyle,n=r.parent,o=i.left,s=i.right,c=i.top,u=i.bottom,l=i.width,h=i.height,d=i.transformOrigin,f=!1;if("auto"===t&&l.u!==V.AUTO&&(o.u===V.AUTO||s.u===V.AUTO)){var m=this.width;if(l.u===V.PX?m=this.width-l.v:l.u===V.PERCENT&&(m=this.width-.01*l.v*n.width),Math.abs(m)>nm&&d[0].u===V.PERCENT){var p=this.getOffsetRect(),g=ri(l,n.width);p.left=a.left+ri(i.translateX,g),p.right=p.left+g;var v=a.textAlign;if(v===H.LEFT){var y=m*d[0].v*.01;this.adjustPosAndSizeSelf(y,0,y,0),f=!0}else if(v===H.RIGHT){y=m*d[0].v*.01;this.adjustPosAndSizeSelf(-y,0,-y,0),f=!0}}i.width={v:0,u:V.AUTO}}if(!("auto"!==t&&"autoH"!==t||h.u===V.AUTO||c.u!==V.AUTO&&u.u!==V.AUTO)){m=0;if(h.u===V.PX?m=this.height-h.v:h.u===V.PERCENT&&(m=this.height-.01*h.v*n.height),Math.abs(m)>nm&&d[1].u===V.PERCENT){p=this.getOffsetRect();var b=ri(h,n.height);p.top=a.top+ri(i.translateY,b),p.bottom=p.top+b;var x=a.textVerticalAlign;if(x===X.TOP){y=m*d[1].v*.01;this.adjustPosAndSizeSelf(0,y,0,y),f=!0}else if(x===X.BOTTOM){y=m*d[1].v*.01;this.adjustPosAndSizeSelf(0,-y,0,-y),f=!0}}i.height={v:0,u:V.AUTO}}f&&this.checkPosSizeUpward()},i.prototype.lay=function(t){var r=this;e.prototype.lay.call(this,t);var i=this,a=i.computedRich,n=i.style,o=i.computedStyle,s=i._content,c=i.lineBoxList,u=n.left,l=n.right,h=n.top,d=n.bottom,f=n.width,m=n.height,p=f.u===V.AUTO&&(u.u===V.AUTO||l.u===V.AUTO),g=m.u===V.AUTO&&(h.u===V.AUTO||d.u===V.AUTO);if(!this.isMounted){var v=this.props.textBehaviour;"auto"!==v||f.u===V.AUTO||u.u!==V.AUTO&&l.u!==V.AUTO||(p=!0),"auto"!==v&&"autoH"!==v||m.u===V.AUTO||h.u!==V.AUTO&&d.u!==V.AUTO||(g=!0)}var y,b,x,T,w,k,S,E,C,A,_,M,I,R,P=0,O=s.length,D=0,B=0,F=0,L={};if(a.length)for(var N=0,U=a.length;N<U;N++){var z=a[N];L[z.location]=N;var W=z.fontFamily;Xe.waitIfNotRegister(W,function(){r.refresh(ci.REFLOW)})}else{W=o.fontFamily;Xe.waitIfNotRegister(W,function(){r.refresh(ci.REFLOW)})}var j=oe.getFontCanvas().ctx;if(a.length){var G=a[0];b=G.letterSpacing||0,x=G.paragraphSpacing||0,y=.8*G.fontSize+b,w=$r(G,T=G.lineHeight||Kr(G)),k=Qr(G,T),S=G.fontFamily,E=G.fontSize,C=fe(G.color),A=G.textDecoration||[],_=G.textShadow,M=G.stroke,I=G.strokeWidth,R=G.strokeEnable,j.font=Yr(G),j.letterSpacing=b+"px"}else b=o.letterSpacing,x=o.paragraphSpacing,y=.8*o.fontWeight+b,w=$r(o,T=o.lineHeight||Kr(o)),k=Qr(o,T),S=o.fontFamily,E=o.fontSize,C=fe(this.style.color.v),A=this.style.textDecoration.map(function(e){return e.v}),_=this.style.textShadow.v,M=va(this.style.stroke),I=this.style.strokeWidth.map(function(e){return e.v}),R=this.style.strokeEnable.map(function(e){return e.v}),j.font=Yr(o),j.letterSpacing=b+"px";var Y=new em(F,T,P,!1);c.splice(0),c.push(Y);for(var q=p?Number.MAX_SAFE_INTEGER:this.width;P<O;){var K=L[P];if(P&&K){var $=a[K];b=$.letterSpacing||0,x=$.paragraphSpacing||0,y=.8*$.fontSize+b,w=$r($,T=$.lineHeight||Kr($)),k=Qr($,T),S=$.fontFamily,E=$.fontSize,C=fe($.color),A=$.textDecoration||[],_=$.textShadow,M=$.stroke,I=$.strokeWidth,R=$.strokeEnable,j.font=Yr($),j.letterSpacing=b+"px"}if(rm(s.charAt(P)))P++,B=0,F+=Y.height+x,Y.verticalAlign(),Y.endEnter=!0,Y=new em(F,T,P,!0),c.push(Y);else{U=O;if(a.length)for(var Q=P+1;Q<U;Q++)if(L[Q]){U=Q;break}if(j.measureText(s.charAt(P)).width>q-B+1e-10&&B)B=0,F+=Y.height,P<O&&(Y.verticalAlign(),Y=new em(F,T,P,!1),c.push(Y));else{var Z=im(j,P,U,s,q-B,y),J=Z.hypotheticalNum,ee=Z.rw,te=Z.newLine,re=new tm(B,F,ee,T,w,k,P,s.slice(P,P+J),j.font,S,E,C,b,A,_,M,I,R);Y.add(re),P+=J,D=Math.max(D,Math.ceil(ee+B)),te?(B=0,F+=Y.height,P<O&&(Y.verticalAlign(),Y=new em(F,T,P,!1),c.push(Y))):B+=ee}}}if((Y.verticalAlign(),D=Math.max(D,Y.width),b&&b<0&&(D-=b),p)&&(ve=D-this.width)){o.width=D;var ie=n.left,ae=n.right;ie.u!==V.AUTO&&ae.u!==V.AUTO||(ie.u!==V.AUTO?o.right-=ve:ae.u!==V.AUTO&&(o.left-=ve))}if(g){var ne=Y.y+Y.height;if(ve=ne-this.height){o.height=ne;var se=n.top,ce=n.bottom;se.u!==V.AUTO&&ce.u!==V.AUTO||(se.u!==V.AUTO?o.bottom-=ve:ce.u!==V.AUTO&&(o.top-=ve))}}if(a&&a.length){var ue={};a.forEach(function(e){ue[e.location]=e});var le=a[0].textAlign,he=0;for(U=c.length;he<U;he++){var de=c[he];if(de.startEnter||!de.index){var me=ue[de.index];me&&(le=me.textAlign)}if(le===H.CENTER)(ve=this.width-de.width)&&de.offsetX(.5*ve);else if(le===H.RIGHT){(ve=this.width-de.width)&&de.offsetX(ve)}}}else if(s&&o.textAlign!==H.LEFT){var pe=0;for(U=c.length;pe<U;pe++){var ge=c[pe];if(o.textAlign===H.CENTER)(ve=this.width-ge.width)&&ge.offsetX(.5*ve);else if(o.textAlign===H.RIGHT){var ve;(ve=this.width-ge.width)&&ge.offsetX(ve)}}}var ye=this.height-Y.y-Y.height;if(ye){var be=o.textVerticalAlign;if(be===X.MIDDLE){var xe=0;for(U=c.length;xe<U;xe++){c[xe].offsetY(.5*ye)}}else if(be===X.BOTTOM){var Te=0;for(U=c.length;Te<U;Te++){c[Te].offsetY(ye)}}}},i.prototype.cutRich=function(e,t){var r=this.rich;if(r.length){for(var i=t-e,a=0,n=r.length;a<n;a++){var o=r[a];if(o.location<=e&&o.location+o.length>e){if(o.location+o.length>=t){o.length-=i;for(var s=a+1;s<n;s++)r[s].location-=i;o.length||r.splice(a,1)}else{o.length=e-o.location;for(var c=a+1,u=r.length;c<u;c++){var l=r[c];if(l.location<=t&&(l.location+l.length>t||c===u-1)){l.length-=t-l.location,l.location-=i;s=c+1;for(var h=r.length;s<h;s++)r[s].location-=i;a<c-1&&r.splice(a+1,c-a-1),l.length||r.splice(c,1);break}}o.length||r.splice(a,1)}break}}this.mergeRich()}},i.prototype.expandRich=function(e,t){var r=this,i=r.rich,a=r.computedRich,n=r.style,o=r._content;if(!i.length){var s={location:e,length:t,fontFamily:n.fontFamily,fontSize:n.fontSize,fontWeight:n.fontWeight,fontStyle:n.fontStyle,letterSpacing:n.letterSpacing,lineHeight:n.lineHeight,paragraphSpacing:n.paragraphSpacing,textAlign:n.textAlign,textDecoration:n.textDecoration,textShadow:n.textShadow,color:n.color,stroke:n.stroke.slice(0),strokeEnable:n.strokeEnable.slice(0),strokeWidth:n.strokeWidth.slice(0)};return i.push(s),void a.push(this.calComputedRich(s))}e=Math.max(0,e);for(var c=0,u=i.length;c<u;c++){var l=i[c];if(l.location<=e&&l.location+l.length>=e){if(e===l.location+l.length&&rm(o.charAt(e-1)))continue;l.length+=t,a[c].length+=t;for(var h=c+1;h<u;h++)i[h].location+=t,a[h].location+=t;return}}i[i.length-1].length+=t,a[a.length-1].length+=t},i.prototype.insertRich=function(e,t,r){var i=this,a=i.rich,n=i.computedRich,o=i.style,s=Object.assign({location:t,length:r,fontFamily:o.fontFamily,fontSize:o.fontSize,fontWeight:o.fontWeight,fontStyle:o.fontStyle,letterSpacing:o.letterSpacing,lineHeight:o.lineHeight,paragraphSpacing:o.paragraphSpacing,textAlign:o.textAlign,textDecoration:o.textDecoration,textShadow:o.textShadow,color:o.color,stroke:o.stroke,strokeEnable:o.strokeEnable,strokeWidth:o.strokeWidth},e),c=this.calComputedRich(s);if(!a.length)return a.push(s),void n.push(c);for(var u=0,l=a.length;u<l;u++){var h=a[u];if(h.location<=t&&h.location+h.length>=t){for(var d=u+1;d<l;d++)a[d].location+=r,n[d].location+=r;if(h.location===t)a.splice(u,0,s),n.splice(u,0,c),h.location+=r,n[u].location+=r;else if(h.location+h.length===t)a.splice(u+1,0,s),n.splice(u+1,0,c);else if(h.location+h.length>t){var f=C(h);h.length=t-h.location,f.location=t+r,f.length-=h.length,a.splice(u+1,0,s),a.splice(u+2,0,f);var m=n[u],p=C(m);m.length=h.length,p.location=f.location,p.length=f.length,n.splice(u+1,0,c),n.splice(u+2,0,p)}return void this.mergeRich()}}a.push(s),n.push(c),this.mergeRich()},i.prototype.mergeRich=function(){var e=this,t=e.rich,i=e.computedRich,a=e._content,n=e.style;if(t.length){for(var o=t.length-1;o>=0;o--){var s=t[o];(s.location<0||s.length<=0)&&(t.splice(o,1),i.splice(o,1))}t.sort(function(e,t){return e.location===t.location?e.length-t.length:e.location-t.location}),i.sort(function(e,t){return e.location===t.location?e.length-t.length:e.location-t.location});var c=!1,u=ii({location:0,length:0},n);if(a.length){var l=t[t.length-1],h=i[i.length-1];if(l.location+l.length>a.length)l.length=a.length-l.location,h.length=a.length-h.location,c=!0;else if(l.location+l.length<a.length){var d=r(r({},u),{location:l.location+l.length,length:a.length-l.location-l.length});t.push(d),i.push(this.calComputedRich(d))}var f=t[0];if(f.location>0){d=r(r({},u),{location:0,length:f.location});t.unshift(d),i.unshift(this.calComputedRich(d)),c=!0}}for(o=t.length-2;o>=0;o--){var m=t[o],p=t[o+1];if(p.length)if(m.length){var g=m.location+m.length;if(g===p.location)A(m,p,["color","fontFamily","fontSize","letterSpacing","lineHeight","textDecoration","paragraphSpacing","textShadow","stroke","strokeEnable","strokeWidth"])?(m.textAlign.v===p.textAlign.v||rm(a.charAt(p.location-1)))&&(m.length+=p.length,t.splice(o+1,1),i[o].length=m.length,i.splice(o+1,1),c=!0):1===p.length&&rm(a.charAt(p.location))&&(m.length+=p.length,t.splice(o+1,1),i[o].length=m.length,i.splice(o+1,1),c=!0);else{if(g<p.location){d=r(r({},u),{location:g,length:p.location-g});t.splice(o+1,0,d),i.splice(o+1,0,this.calComputedRich(d))}else{var v=m.location+m.length-p.location;p.location+=v,p.length-=v,i[o+1].location=p.location,i[o+1].length=p.length}c=!0}}else t.splice(o,1),i.splice(o,1),o++;else t.splice(o+1,1),i.splice(o+1,1)}return c}},i.prototype.calComputedRich=function(e){return{location:e.location,length:e.length,fontFamily:e.fontFamily.v,fontSize:e.fontSize.v,fontWeight:e.fontWeight.v,fontStyle:e.fontStyle.v,lineHeight:e.lineHeight.v,letterSpacing:e.letterSpacing.v,paragraphSpacing:e.paragraphSpacing.v,textAlign:e.textAlign.v,textDecoration:e.textDecoration.map(function(e){return e.v}),color:e.color.v,textShadow:e.textShadow.v,stroke:va(e.stroke),strokeWidth:e.strokeWidth.map(function(e){return e.v}),strokeEnable:e.strokeEnable.map(function(e){return e.v})}},i.prototype.calReflowStyle=function(){var t=this;e.prototype.calReflowStyle.call(this),this.computedRich=this.rich.map(function(e){return t.calComputedRich(e)})},i.prototype.calRepaintStyle=function(t){e.prototype.calRepaintStyle.call(this,t);var r=this.rich;if(r.length)this.computedRich.forEach(function(e,t){e.textDecoration=r[t].textDecoration.map(function(e){return e.v}),e.color=r[t].color.v,e.textShadow=r[t].textShadow.v,e.stroke=va(r[t].stroke),e.strokeWidth=r[t].strokeWidth.map(function(e){return e.v}),e.strokeEnable=r[t].strokeEnable.map(function(e){return e.v})});else{var i=this.computedStyle;this.lineBoxList.forEach(function(e){e.list.forEach(function(e){e.color=fe(i.color),e.stroke=i.stroke,e.strokeWidth=i.strokeWidth,e.strokeEnable=i.strokeEnable})})}},i.prototype.calContent=function(){this.hasContent=!1;var e=this.computedStyle;return(this._content||e.backgroundColor[3]>0)&&(this.hasContent=!0),this.hasContent},i.prototype.renderCanvas=function(){var t;e.prototype.renderCanvas.call(this);var r=this._bboxInt||this.bboxInt,i=r[0],a=r[1],n=r[2]-i,o=r[3]-a,s=-i,c=-a,u=this.computedStyle,l=this.lineBoxList,h=this.canvasCache=(null===(t=this.canvasCache)||void 0===t?void 0:t.available)?this.canvasCache:new xi(n,o,-i,-a);h.available=!0;var d=h.list,f=this.getSortedCursor(),m=f.isMulti,p=f.startLineBox,g=f.startTextBox,v=f.startString,y=f.endLineBox,b=f.endTextBox,x=f.endString,T=f.start,w=f.end;if(m&&T!==w)for(var k=0,S=d.length;k<S;k++){var E=d[k],C=E.x,A=E.y,_=E.os.ctx,M=-C,I=-A;if(_.fillStyle="#f4d3c1",p===y){var R=(D=l[p]).list,P=(B=R[g]).x+M;_.font=B.font,_.letterSpacing=B.letterSpacing+"px",P+=_.measureText(B.str.slice(0,v)).width;var O=(B=R[b]).x+M;_.font=B.font,O+=_.measureText(B.str.slice(0,x)).width,_.fillRect(P,D.y+I,O-P,D.lineHeight)}else{var D,B,F=(D=l[p]).list;if(B=F[g]){P=B.x+M;_.font=B.font,_.letterSpacing=B.letterSpacing+"px",P+=_.measureText(B.str.slice(0,v)).width,_.fillRect(P,D.y+I,D.w+M-P,D.lineHeight)}for(var L=p+1,N=y;L<N;L++){var U=l[L];U.list.length&&_.fillRect(U.list[0].x+M,U.y+I,U.w,U.lineHeight)}if(B=(F=(D=l[y]).list)[b]){P=B.x+M;_.font=B.font,_.letterSpacing=B.letterSpacing+"px",P+=_.measureText(B.str.slice(0,x)).width,_.fillRect(D.x+M,D.y+I,P-(D.x+M),D.lineHeight)}}}var z=u.strokeDasharray,W=u.strokeLinecap,V=u.strokeLinejoin,H=function(e,t){var r=d[e],i=r.x,a=r.y,u=r.os.ctx;u.miterLimit=1,u.fillStyle="transparent",u.setLineDash(z),W===Q.ROUND?u.lineCap="round":W===Q.SQUARE?u.lineCap="square":u.lineCap="butt",V===Z.ROUND?u.lineJoin="round":V===Z.BEVEL?u.lineJoin="bevel":u.lineJoin="miter";for(var h=-i,f=-a,m=0,p=l.length;m<p;m++){var g=l[m];if(g.y>=o)break;for(var v=g.list,y=v.length,b=function(e){var t=v[e],r=t.textDecoration,i=t.textShadow,a=t.stroke,l=t.strokeWidth,d=t.strokeEnable;am(u,t);for(var m=function(e,r){if(!d[e]||!l[e])return"continue";var i=a[e];if(Array.isArray(i))u.strokeStyle=fe(i);else if(i.t===Y.LINEAR){var m=Hr(i.stops,i.d,h,f,n-2*s,o-2*c),p=u.createLinearGradient(m.x1,m.y1,m.x2,m.y2);m.stop.forEach(function(e){p.addColorStop(e.offset,fe(e.color))}),u.strokeStyle=p}else if(i.t===Y.RADIAL){m=Xr(i.stops,i.d,h,f,n-2*s,o-2*c);var g=u.createRadialGradient(m.cx,m.cy,0,m.cx,m.cy,m.total);m.stop.forEach(function(e){g.addColorStop(e.offset,fe(e.color))});var v=m.matrix;if(v){var y=oe.getOffscreenCanvas(n,o),b=y.ctx;return b.setLineDash(u.getLineDash()),b.lineCap=u.lineCap,b.lineJoin=u.lineJoin,b.miterLimit=u.miterLimit,b.lineWidth=l[e],b.lineWidth=l[e],b.strokeStyle="#FFF",b.strokeText(t.str,t.x+h,t.y+t.baseline+f),b.globalCompositeOperation="source-in",b.setTransform(v[0],v[1],v[4],v[5],v[12],v[13]),b.fillStyle=g,b.fillRect(0,0,n,o),u.drawImage(y.canvas,0,0),y.release(),"continue"}u.strokeStyle=g}else if(i.t===Y.CONIC){m=jr(i.stops,i.d,h,f,n-2*s,o-2*c);var x=u.createConicGradient(m.angle,m.cx+h,m.cy+f);m.stop.forEach(function(e){x.addColorStop(e.offset,fe(e.color))}),u.strokeStyle=x}u.lineWidth=l[e],u.strokeText(t.str,t.x+h,t.y+t.baseline+f)},p=0,g=a.length;p<g;p++)m(p);u.fillStyle=t.color,i?(u.shadowOffsetX=i.x,u.shadowOffsetY=i.y,u.shadowBlur=i.blur,u.shadowColor=fe(i.color)):(u.shadowOffsetX=0,u.shadowOffsetY=0,u.shadowBlur=0,u.shadowColor="transparent"),u.fillText(t.str,t.x+h,t.y+t.baseline+f),u.shadowOffsetX=0,u.shadowOffsetY=0,u.shadowBlur=0,u.shadowColor="transparent",r.length&&r.forEach(function(e){if(e===re.UNDERLINE){var r=Math.min(3,.05*t.lineHeight);u.fillRect(t.x+h,t.y+t.contentArea+f-.5*r,t.w,r)}else if(e===re.LINE_THROUGH){var i=Math.min(3,.05*t.lineHeight);u.fillRect(t.x+h,t.y+.5*t.lineHeight+f-.5*i,t.w,i)}})},x=0;x<y;x++)b(x)}};for(k=0,S=d.length;k<S;k++)H(k)},i.prototype.setCursorStartByAbsCoords=function(e,t){var r=this.matrixWorld,i=bt({x:e,y:t},ct(r)),a=this.lineBoxList,n=this.cursor,o=n.start;n.isMulti=!1;for(var s=a.length,c=0;c<s;c++){var u=a[c];if(i.y>=u.y&&i.y<u.y+u.lineHeight){n.startLineBox=n.endLineBox=c;var l=this.getCursorByLocalX(i.x,u,!1);n.endTextBox=n.startTextBox,n.endString=n.startString,n.end=n.start,this.tempCursorX=l.x,n.start!==o&&(this.inputStyle=void 0);var h=bt({x:l.x,y:l.y},r);return{x:h.x,y:h.y,h:l.h*r[0]}}}var d=a[s-1];n.startLineBox=n.endLineBox=s-1;var f=this.getCursorByLocalX(this.width,d,!1);n.endTextBox=n.startTextBox,n.endString=n.startString,n.end=n.start,this.tempCursorX=f.x,n.start!==o&&(this.inputStyle=void 0);var m=bt({x:f.x,y:f.y},r);return{x:m.x,y:m.y,h:f.h*r[0]}},i.prototype.setCursorEndByAbsCoords=function(e,t){var r=this.matrixWorld,i=bt({x:e,y:t},ct(r)),a=this.lineBoxList,n=this.cursor,o=n.end;n.isMulti=!0;for(var s=a.length,c=0;c<s;c++){var u=a[c];if(i.y>=u.y&&i.y<u.y+u.lineHeight){n.endLineBox=c;var l=this.getCursorByLocalX(i.x,u,!0);n.end!==o&&this.refresh();var h=bt({x:l.x,y:l.y},r);return{x:h.x,y:h.y,h:l.h*r[0]}}}var d=a[s-1];n.endLineBox=s-1;var f=this.getCursorByLocalX(this.width,d,!0);n.end!==o&&this.refresh(),n.end!==n.start&&(this.inputStyle=void 0);var m=bt({x:f.x,y:f.y},r);return{x:m.x,y:m.y,h:f.h*r[0]}},i.prototype.resetCursor=function(){var e=this.cursor;e.isMulti&&(e.isMulti=!1,e.start!==e.end&&(this.refresh(),e.endLineBox=e.startLineBox,e.endTextBox=e.startTextBox,e.endString=e.startString,e.end=e.start))},i.prototype.reLocateCursor=function(){var e=this.cursor,t=this.lineBoxList,r=e.start,i=e.end,a=e.isMulti,n=0;e:for(var o=0,s=t.length;o<s;o++)for(var c=0,u=(l=t[o]).list.length;c<u;c++){if((d=n+l.list[c].str.length)>=r){e.startLineBox=o,e.startTextBox=c,e.startString=r-n;break e}n=d}if(a&&i!==r){n=0;e:for(o=0,s=t.length;o<s;o++){c=0;for(var l,h=(l=t[o]).list.length;c<h;c++){var d;if((d=n+l.list[c].str.length)>=i){e.endLineBox=o,e.endTextBox=c,e.endString=i-n;break e}n=d}}}else e.endLineBox=e.startLineBox,e.endTextBox=e.startTextBox,e.endString=e.startString},i.prototype.beforeEdit=function(){var e=this,t=e.style,r=e.computedStyle,i=e.parent,a=e.isDestroyed,n=e.width,o=e.height;if(a||!i)throw new Error("Can not edit a destroyed Text");var s=this.getStyle(),c=t.left,u=t.right,l=t.top,h=t.bottom,d=t.width,f=t.height,m=t.translateX,p=t.translateY,g=t.textAlign,v=t.textVerticalAlign,y=c.u!==V.AUTO&&u.u!==V.AUTO||d.u!==V.AUTO,b=g.v===H.LEFT&&!y&&(c.u!==V.AUTO&&m.v&&m.u===V.PERCENT||u.u!==V.AUTO),x=g.v===H.CENTER&&!y&&(-50!==m.v||m.u!==V.PERCENT),T=g.v===H.RIGHT&&u.u===V.AUTO,w=l.u!==V.AUTO&&h.u!==V.AUTO||f.u!==V.AUTO,k=v.v===X.TOP&&!w&&(l.u!==V.AUTO&&p.v&&p.u===V.PERCENT||h.u!==V.AUTO),S=v.v===X.MIDDLE&&!w&&(-50!==p.v||p.u!==V.PERCENT),E=v.v===X.BOTTOM&&!w&&h.u===V.AUTO,C=i.width,A=i.height,_=!1,M=0;if(m.u===V.PX?M=m.v:m.u===V.PERCENT&&(M=.01*m.v*n),b)c.u!==V.AUTO&&m.v&&m.u===V.PERCENT?(_=!0,r.left+=M,c.u===V.PX?c.v+=M:c.u===V.PERCENT&&(c.v+=100*M/C),r.right-=M,u.u===V.PX?u.v-=M:u.u===V.PERCENT&&(u.v-=100*M/C)):u.u!==V.AUTO&&(_=!0,r.left+=M,c.v=r.left,c.u=V.PX,r.right-=M,u.v=0,u.u=V.AUTO),m.v=0;else if(x){if(m.u===V.AUTO||m.u===V.PX){_=!0;var I=.5*n-m.v;r.left+=I,r.right-=I,c.u===V.PX?(c.v+=I,m.v=-50):c.u===V.PERCENT?(c.v+=100*I/C,m.v=-50):u.u===V.PX?(u.v+=I,m.v=50):u.u===V.PERCENT&&(u.v+=100*I/C,m.v=50),m.u=V.PERCENT}else if(m.u===V.PERCENT&&-50!==m.v){_=!0;I=.5*n-m.v*n;r.left+=I,r.right-=I,c.u===V.PX?(c.v+=I,m.v=-50):c.u===V.PERCENT?(c.v+=100*I/C,m.v=-50):u.u===V.PX?(u.v+=I,m.v=50):u.u===V.PERCENT&&(u.v+=100*I/C,m.v=50)}}else T&&(_=!0,r.left+=M,c.u!==V.AUTO&&(c.v=0,c.u=V.AUTO),r.right-=M,u.v=r.right,u.u=V.PX,m.v=0);var R=0;if(p.u===V.PX?R=p.v:p.u===V.PERCENT&&(R=.01*p.v*o),k)l.u!==V.AUTO&&p.v&&p.u===V.PERCENT?(_=!0,r.top+=R,l.u===V.PX?l.v+=R:l.u===V.PERCENT&&(l.v+=100*R/A),r.bottom-=R,h.u===V.PX?h.v-=R:h.u===V.PERCENT&&(h.v-=100*R/A)):h.u!==V.AUTO&&(_=!0,r.top+=R,l.v=r.top,l.u=V.PX,r.bottom-=R,h.v=0,h.u=V.AUTO),p.v=0;else if(S){if(p.u===V.AUTO||p.u===V.PX){_=!0;var P=.5*o-p.v;r.top+=P,r.bottom-=P,l.u===V.PX?(l.v+=P,p.v=-50):l.u===V.PERCENT?(l.v+=100*P/A,p.v=-50):h.u===V.PX?(h.v+=P,p.v=50):h.u===V.PERCENT&&(h.v+=100*P/A,p.v=50),p.u=V.PERCENT}else if(p.u===V.PERCENT&&-50!==p.v){_=!0;P=.5*o-p.v*o;r.top+=P,r.bottom-=P,l.u===V.PX?(l.v+=P,p.v=-50):l.u===V.PERCENT?(l.v+=100*P/A,p.v=-50):h.u===V.PX?(h.v-=P,p.v=50):h.u===V.PERCENT&&(h.v-=100*P/A,p.v=50),p.v=-50}}else E&&(_=!0,r.top+=R,l.u!==V.AUTO&&(l.v=0,l.u=V.AUTO),r.bottom-=R,h.v=r.bottom,h.u=V.PX,p.v=0);if(_)return this.editStyle={isLeft:b,isCenter:x,isRight:T,isTop:k,isMiddle:S,isBottom:E,isFixedHeight:w,prev:s}},i.prototype.afterEdit=function(){if(this.editStyle){var e=this.editStyle,t=e.isLeft,r=e.isCenter,i=e.isRight,a=e.isTop,n=e.isMiddle,o=e.isBottom;e.isFixedHeight;var s=e.prev,c=this,u=c.style,l=c.computedStyle,h=c.parent,d=c.width,f=c.height,m=s.left,p=s.right,g=s.top,v=s.bottom,y=s.translateX,b=s.translateY,x=h,T=x.width,w=x.height,k=0;if(y.u===V.PX?k=y.v:y.u===V.PERCENT&&(k=.01*y.v*d),t){if(m.u!==V.AUTO&&y.v&&y.u===V.PERCENT){if(m.u===V.PX)u.left.v-=k,l.left-=k;else if(m.u===V.PERCENT){var S=100*k/T;u.left.v-=S,l.left-=k}if(p.u===V.PX)u.right.v+=k,l.right+=k;else if(p.u===V.PERCENT){S=100*k/T;u.right.v+=S,l.right+=k}l.translateX+=k}else p.u!==V.AUTO&&(u.left.v=0,u.left.u=V.AUTO,l.left-=k,u.right.v=p.v,u.right.u=p.u,l.right+=k);u.translateX.v=y.v}else if(r){if(y.u===V.AUTO||y.u===V.PX){var E=.5*d-y.v;m.u===V.PX?u.left.v-=E:m.u===V.PERCENT?u.left.v-=100*E/T:p.u===V.PX?u.right.v-=E:p.u===V.PERCENT&&(u.right.v-=100*E/T),u.translateX.v=y.v,u.translateX.u=y.u}else if(y.u===V.PERCENT&&-50!==y.v){E=.5*d-y.v*d;m.u===V.PX?u.left.v-=E:m.u===V.PERCENT&&(u.left.v-=100*E/T),p.u===V.PX?u.right.v-=E:p.u===V.PERCENT&&(u.right.v-=100*E/T),u.translateX.v=y.v}}else i&&(l.left-=k,m.u===V.PX?u.left.v=l.left:m.u===V.PERCENT&&(u.left.v=100*l.left/T),u.left.u=m.u,l.right+=k,p.u===V.AUTO&&(u.right.v=0,u.right.u=V.AUTO),u.translateX.v=y.v,u.translateX.u=y.u);var C=0;if(b.u===V.PX?C=b.v:b.u===V.PERCENT&&(C=.01*b.v*f),a){if(g.u!==V.AUTO&&b.v&&b.u===V.PERCENT){if(g.u===V.PX)u.top.v-=C,l.top-=C;else if(g.u===V.PERCENT){S=100*C/w;u.top.v-=S,l.top-=C}if(v.u===V.PX)u.bottom.v+=C,l.bottom+=C;else if(v.u===V.PERCENT){S=100*C/w;u.bottom.v+=S,l.bottom+=C}}else v.u!==V.AUTO&&(u.top.v=0,u.top.u=V.AUTO,l.top-=C,u.bottom.v=v.v,u.bottom.u=v.u,l.bottom+=C);u.translateY.v=b.v,l.translateY+=C}else if(n){if(b.u===V.AUTO||b.u===V.PX){var A=.5*f-b.v;g.u===V.PX?u.top.v-=A:g.u===V.PERCENT?u.top.v-=100*A/w:v.u===V.PX?u.bottom.v-=A:v.u===V.PERCENT&&(u.bottom.v-=100*A/w),u.translateY.v=b.v,u.translateY.u=V.PX}else if(b.u===V.PERCENT&&-50!==b.v){A=.5*f-b.v*f;g.u===V.PX?u.top.v-=A:g.u===V.PERCENT?u.top.v-=100*A/w:v.u===V.PX?u.bottom.v-=A:v.u===V.PERCENT&&(u.bottom.v-=100*A/w),u.translateY.v=b.v}}else o&&(l.top-=C,g.u===V.PX?u.top.v=l.top:g.u===V.PERCENT&&(u.top.v=100*l.top/w),l.bottom+=C,v.u===V.AUTO&&(u.bottom.v=0,u.bottom.u=V.AUTO),u.translateY.v=b.v,u.translateY.u=b.u)}},i.prototype.updateCursorByIndex=function(e){var t=this.setCursorByIndex(e,!1),r=t.lineBox,i=t.textBox,a=this.cursor,n=this.matrixWorld;if(i){var o=oe.getFontCanvas().ctx;o.font=i.font,o.letterSpacing=i.letterSpacing+"px";var s=i.str,c=o.measureText(s.slice(0,a.startString)).width;this.tempCursorX=i.x+c}else{var u=this.computedStyle.textAlign;u===H.CENTER?this.tempCursorX=.5*this.width:u===H.RIGHT?this.tempCursorX=this.width:this.tempCursorX=0}var l=bt({x:this.tempCursorX,y:r.y},n);return{x:l.x,y:l.y,h:r.lineHeight*n[0]}},i.prototype.setCursorByIndex=function(e,t){void 0===t&&(t=!1);var r=this.lineBoxList,i=this.cursor;t?i.end=e:i.start=e;for(var a=0,n=r.length;a<n;a++){var o=r[a],s=o.list;if(!s.length&&o.index===e)return i.startLineBox=a,i.startTextBox=0,i.startString=0,{lineBox:o,textBox:void 0};for(var c=0,u=s.length;c<u;c++){var l=s[c];if(e>=l.index&&(e<l.index+l.str.length||c===u-1&&o.endEnter&&e<=l.index+l.str.length))return t?(i.endLineBox=a,i.endTextBox=c,i.endString=e-l.index):(i.startLineBox=a,i.startTextBox=c,i.startString=e-l.index),{lineBox:o,textBox:l}}}var h=r.length-1,d=r[h],f=d.list;if(t?i.endLineBox=h:i.startLineBox=h,!f||!f.length)return t?(i.endTextBox=0,i.endString=0):(i.startTextBox=0,i.startString=0),{lineBox:d,textBox:void 0};var m=f.length-1,p=f[m];return t?(i.endTextBox=m,i.endString=p.str.length):(i.startTextBox=m,i.startString=p.str.length),{lineBox:d,textBox:p}},i.prototype.checkCursorMulti=function(){var e=this.cursor;return e.isMulti&&e.start===e.end&&(e.isMulti=!1),e.isMulti},i.prototype.getCursorAbsCoords=function(){var e=this.matrixWorld,t=this.lineBoxList,r=this.cursor;if(!r.isMulti){var i=t[r.startLineBox],a=i.list,n=i.lineHeight;if(!a.length){var o=this.computedStyle.textAlign,s=0;o===H.CENTER?s=.5*this.width:o===H.RIGHT&&(s=this.width);var c=bt({x:s,y:i.y},e);return{x:c.x,y:c.y,h:n*e[0]}}var u=bt({x:this.tempCursorX,y:i.y},e);return{x:u.x,y:u.y,h:n*e[0]}}},i.prototype.moveCursor=function(e,t){void 0===t&&(t=!1);var r=this.matrixWorld,i=this.cursor,a=this.getSortedCursor(),n=t?a.endLineBox:a.startLineBox,o=t?a.endTextBox:a.startTextBox,s=t?a.endString:a.startString,c=this.lineBoxList,u=c[n],l=u.list,h=l[o],d=t?a.end:a.start;if(i.isMulti&&!t){if(i.isMulti=!1,i.start!==i.end&&this.refresh(),39===e||40===e){var f=a.endLineBox,m=a.endTextBox,p=a.endString;d=(h=(l=(u=c[f]).list)[m])?h.index+p:u.index+p}return this.inputStyle=void 0,this.updateCursorByIndex(d)}if(t&&(i.isMulti=!0),37===e){if(0===d)return;0===s?0===o?(t?i.endLineBox=--n:i.startLineBox=--n,(l=(u=c[n]).list).length?(t?i.endTextBox=o=l.length-1:i.startTextBox=o=l.length-1,h=l[o],t?(i.endString=h.str.length-(u.endEnter?0:1),i.end=h.index+i.endString):(i.startString=h.str.length-(u.endEnter?0:1),i.start=h.index+i.startString)):t?(i.endTextBox=0,i.endString=0,i.end=u.index):(i.startTextBox=0,i.startString=0,i.start=u.index)):(t?i.endTextBox=--o:i.startTextBox=--o,h=l[o],t?(i.endString=h.str.length-1,i.end=h.index+i.endString):(i.startString=h.str.length-1,i.start=h.index+i.startString)):t?(i.endString=--s,i.end=h.index+i.endString):(i.startString=--s,i.start=h.index+i.startString)}else if(38===e){if(0===d)return;if(0!==n){u=c[--n],t?i.endLineBox=n:i.startLineBox=n;var g=this.getCursorByLocalX(this.tempCursorX,u,t);t&&this.refresh(),this.inputStyle=void 0;var v=bt({x:g.x,y:g.y},r);return{x:v.x,y:v.y,h:u.lineHeight*r[0]}}t?i.endTextBox=0:i.startTextBox=0,h=l[0],t?(i.endString=0,i.end=0):(i.startString=0,i.start=0)}else if(39===e){if(d===this._content.length)return;!h||o===l.length-1&&s===h.str.length&&u.endEnter?(t?(i.endLineBox=++n,i.endTextBox=0,i.endString=0):(i.startLineBox=++n,i.startTextBox=0,i.startString=0),h=(l=(u=c[n]).list)[0],t?i.end=h.index:i.start=h.index):o===l.length-1&&s===h.str.length?(t?(i.endLineBox=++n,i.endTextBox=0,i.endString=1):(i.startLineBox=++n,i.startTextBox=0,i.startString=1),h=(l=(u=c[n]).list)[0],t?i.end=h.index+1:i.start=h.index+1):s===h.str.length?(t?i.endTextBox=++o:i.startTextBox=++o,h=l[o],t?(i.endString=1,i.end=h.index+1):(i.startString=1,i.start=h.index+1),o===l.length-1&&1===h.str.length&&!u.endEnter&&n<c.length-1&&(t?i.endLineBox=++n:i.startLineBox=++n,l=(u=c[n]).list,t?i.endTextBox=o=0:i.startTextBox=o=0,h=l[o],t?(i.endString=0,i.end=h.index):(i.startString=0,i.start=h.index))):s===h.str.length-1?o===l.length-1?u.endEnter||n===c.length-1?t?(i.endString++,i.end=h.index+i.endString):(i.startString++,i.start=h.index+i.startString):(t?i.endLineBox=++n:i.startLineBox=++n,l=(u=c[n]).list,t?i.endTextBox=o=0:i.startTextBox=o=0,h=l[o],t?(i.endString=0,i.end=h.index):(i.startString=0,i.start=h.index)):(t?i.endTextBox=++o:i.startTextBox=++o,h=l[o],t?(i.endString=0,i.end=h.index):(i.startString=0,i.start=h.index)):t?(i.endString=++s,i.end=h.index+i.endString):(i.startString=++s,i.start=h.index+i.startString)}else if(40===e){if(d===this._content.length)return;if(n!==c.length-1){u=c[++n],t?i.endLineBox=n:i.startLineBox=n;g=this.getCursorByLocalX(this.tempCursorX,u,t);t&&this.refresh(),this.inputStyle=void 0;var y=bt({x:g.x,y:g.y},r);return{x:y.x,y:y.y,h:u.lineHeight*r[0]}}t?i.endTextBox=o=l.length-1:i.startTextBox=o=l.length-1,h=l[o],t?(i.endString=h?h.str.length:0,i.end=h.index+i.endString):(i.startString=h?h.str.length:0,i.start=h.index+i.startString)}if(h){var b=oe.getFontCanvas().ctx;b.font=h.font,b.letterSpacing=h.letterSpacing+"px";var x=h.str,T=b.measureText(x.slice(0,i.startString)).width;this.tempCursorX=h.x+T}else{var w=this.computedStyle.textAlign;w===H.CENTER?this.tempCursorX=.5*this.width:w===H.RIGHT?this.tempCursorX=this.width:this.tempCursorX=0}t&&this.refresh(),this.inputStyle=void 0;var k=bt({x:this.tempCursorX,y:u.y},r);return{x:k.x,y:k.y,h:u.lineHeight*r[0]}},i.prototype.selectAll=function(){var e=this.lineBoxList,t=e.length,r=e[t-1],i=null==r?void 0:r.list,a=i?i[i.length-1]:void 0;Object.assign(this.cursor,{isMulti:!0,startLineBox:0,startTextBox:0,startString:0,start:0,endLineBox:t-1,endTextBox:i?i.length-1:0,endString:a?a.str.length:0,end:this._content.length}),this.refresh()},i.prototype.input=function(e){var t=this.getSortedCursor(),r=t.isMulti,i=t.start,a=t.end,n=this._content;if(r){var o=this.getCursorRich();this.cursor.isMulti=!1,this._content=n.slice(0,i)+n.slice(a),this.cutRich(i,a),n=this._content,this._content=n.slice(0,i)+e+n.slice(i),this.insertRich(o[0],i,e.length)}else if(this.inputStyle){o=this.getCursorRich();this._content=n.slice(0,i)+e+n.slice(i),this.insertRich(Object.assign({},o[0],this.inputStyle),i,e.length),this.inputStyle=void 0}else this._content=n.slice(0,i)+e+n.slice(i),this.expandRich(i,e.length);this.refresh(ci.REFLOW),this.updateCursorByIndex(i+e.length)},i.prototype.enter=function(){this.inputStyle=void 0;var e=this.getSortedCursor(),t=e.isMulti,r=e.start,i=e.end;if(t){this.cursor.isMulti=!1,this.cutRich(r,i);var a=this._content;this._content=a.slice(0,r)+a.slice(i)}this.expandRich(r,1);var n=this._content;this._content=n.slice(0,r)+"\n"+n.slice(r),this.refresh(ci.REFLOW),this.updateCursorByIndex(r+1)},i.prototype.delete=function(e){void 0===e&&(e=!1),this.inputStyle=void 0;var t=this._content;if(t){var r=this.getSortedCursor(),i=r.isMulti,a=r.start,n=r.end;a<1&&!i&&!e||a===t.length&&e||(i?(this.cursor.isMulti=!1,this._content=t.slice(0,a)+t.slice(n),this.cutRich(a,n)):e?(this._content=t.slice(0,a)+t.slice(a+1),this.cutRich(a,a+1)):(this._content=t.slice(0,a-1)+t.slice(a),this.cutRich(a-1,a)),this.refresh(ci.REFLOW),i||e?this.updateCursorByIndex(a):this.updateCursorByIndex(a-1))}},i.prototype.getSortedCursor=function(){var e,t=this.cursor,r=t.isMulti,i=t.startLineBox,a=t.startTextBox,n=t.startString,o=t.endLineBox,s=t.endTextBox,c=t.endString,u=t.start,l=t.end,h=!1;return r?u>l&&(i=(e=[o,s,c,l,i,a,n,u])[0],a=e[1],n=e[2],u=e[3],o=e[4],s=e[5],c=e[6],l=e[7],h=!0):(o=i,s=a,c=n,l=u),{isMulti:r,startLineBox:i,startTextBox:a,startString:n,endLineBox:o,endTextBox:s,endString:c,start:u,end:l,isReversed:h}},i.prototype.getCursorRich=function(){var e=this.rich,t=this.lineBoxList,r=[];if(!e.length)return r;function i(t,r,i){for(void 0===r&&(r=0),void 0===i&&(i=e.length-1);r<i;){var a=Math.floor(.5*(r+i)),n=e[a];if(n.location<t&&n.location+n.length>=t)return n;n.location>=t?i=Math.min(a,i-1):r=Math.max(a,r+1)}return e[r]}var a=this.getSortedCursor(),n=a.isMulti,o=a.startLineBox,s=a.startTextBox,c=a.startString,u=a.start,l=a.end;if(n)for(var h=0,d=e.length;h<d;h++){if((f=e[h]).location>=l)break;f.location+f.length>u&&r.push(f)}if(!n||!r.length){var f,m=t[o],p=m.list;if(p.length)(f=i(p[s].index+(s+c===0?1:c)))&&-1===r.indexOf(f)&&r.push(f);else(f=i(m.index))&&-1===r.indexOf(f)&&r.push(f)}return r},i.prototype.getCursorByLocalX=function(e,t,r){void 0===r&&(r=!1);var i=t.list,a=this.cursor,n=0,o=t.y,s=t.lineHeight;r?a.endString=a.end=0:a.startString=a.start=0;e:for(var c=0,u=i.length;c<u;c++){var l=(k=i[c]).x,h=k.w,d=k.str,f=k.font,m=k.letterSpacing;if(!c&&e<l||e>=l&&e<l+h||c===u-1){r?a.endTextBox=c:a.startTextBox=c;var p=oe.getFontCanvas().ctx;p.font=f,p.letterSpacing=m+"px";for(var g=0,v=d.length;g<v;){if(g===v-1){var y=p.measureText(d.slice(0,g)).width,b=p.measureText(d.slice(0,v)).width;e-(l+y)>l+b-e?(n=l+b,r?(a.endString=v,a.end=k.index+v):(a.startString=v,a.start=k.index+v)):(n=l+y,r?(a.endString=g,a.end=k.index+g):(a.startString=g,a.start=k.index+g));break e}var x=g+(v-g>>1),T=p.measureText(d.slice(0,x)).width;if(e>l+T)g=x;else{if(!(e<l+T)){r?(a.endString=x,a.end=k.index+x):(a.startString=x,a.start=k.index+x),n=l+T;break e}v=x}}}}var w=r?a.endTextBox:a.startTextBox;if(w<i.length-1){var k=i[w];(r?a.endString:a.startString)===k.str.length&&(r?(a.endTextBox++,a.endString=0,a.end=i[w+1].index):(a.startTextBox++,a.startString=0,a.start=i[w+1].index))}if(!i.length){r?(a.endString=0,a.end=t.index):(a.startString=0,a.start=t.index);var S=this.computedStyle.textAlign;S===H.CENTER?n=.5*this.width:S===H.RIGHT&&(n=this.width)}return{x:n,y:o,h:s}},i.prototype.getRich=function(){return this.rich.map(function(e){return Object.assign({},e)})},i.prototype.getCursor=function(){return Object.assign({},this.cursor)},i.prototype.updateStyle=function(t,r){var i=e.prototype.updateStyle.call(this,t,r);return i&&i&ci.REFLOW_REPAINT&&this.reLocateCursor(),i},i.prototype.updateRangeStyle=function(e,t,r,i){var a=Gr(r),n=this.updateRangeStyleData(e,t,a);return n&&this.refresh(n,i),n&ci.REFLOW_REPAINT&&this.reLocateCursor(),n},i.prototype.updateRangeStyleData=function(e,t,i){var a=ci.NONE,n=this,o=n.rich,s=n.computedRich,c=n.style;if(o.length)for(var u=0,l=o.length;u<l&&!(t<1);u++){var h=o[u],d=s[u];if(e>=h.location&&e<h.location+h.length){if(e>h.location){var f=r(r({},h),{length:e-h.location});o.splice(u,0,f),u++,l++,h.location+=f.length,h.length-=f.length,s.splice(u,0,this.calComputedRich(f)),d.location=h.location,d.length=h.length}var m=!1;if(e+t<h.location+h.length){var p=r(r({},h),{location:e+t,length:h.location+h.length-e-t});o.splice(u+1,0,p),h.length-=p.length,s.splice(u+1,0,this.calComputedRich(p)),d.length=h.length,m=!0}if(a|=this.updateRichItem(h,d,i),m)break;e+=h.length,t-=h.length}}else if(0===e&&t>=this._content.length){var g=this.updateFormatStyle(i);g&&(a|=g)}else{if(e>0){var v=ii({location:0,length:e},c);o.push(v),s.push(this.calComputedRich(v))}var y={location:e,length:t};if(ue.forEach(function(e){y[e]=c[e]}),Object.assign(y,i),o.push(y),s.push(this.calComputedRich(y)),e+t<this._content.length){v=ii({location:e+t,length:this._content.length-e-t},c);o.push(v),s.push(this.calComputedRich(v))}a|=ci.REFLOW}return this.mergeRich(),0===e&&this.updateFormatStyleData(i),a},i.prototype.updateRichItem=function(e,t,r){var i=ci.NONE;if(r.fontFamily&&r.fontFamily.v!==e.fontFamily.v&&(e.fontFamily=r.fontFamily,i|=ci.REFLOW),r.fontSize&&r.fontSize.v!==e.fontSize.v&&(e.fontSize=r.fontSize,i|=ci.REFLOW),r.color&&(e.color.v[0]===r.color.v[0]&&e.color.v[1]===r.color.v[1]&&e.color.v[2]===r.color.v[2]&&e.color.v[3]===r.color.v[3]||(e.color=r.color,i|=ci.REFLOW)),r.letterSpacing&&r.letterSpacing.v!==e.letterSpacing.v&&(e.letterSpacing=r.letterSpacing,i|=ci.REFLOW),r.lineHeight&&r.lineHeight.v!==e.lineHeight.v&&(e.lineHeight=r.lineHeight,i|=ci.REFLOW),r.paragraphSpacing&&r.paragraphSpacing.v!==e.paragraphSpacing.v&&(e.paragraphSpacing=r.paragraphSpacing,i|=ci.REFLOW),r.textAlign&&r.textAlign.v!==e.textAlign.v&&(e.textAlign=r.textAlign,i|=ci.REFLOW),r.textDecoration)if(r.textDecoration.length!==e.textDecoration.length)e.textDecoration=r.textDecoration,i|=ci.REFLOW;else for(var a=0,n=e.textDecoration.length;a<n;a++)if(r.textDecoration[a].v!==e.textDecoration[a].v){e.textDecoration=r.textDecoration,i|=ci.REFLOW;break}return r.textShadow&&r.textShadow.v!==e.textShadow.v&&(e.textShadow=r.textShadow,i|=ci.REFLOW),Object.assign(t,this.calComputedRich(e)),i},i.prototype.getTextBehaviour=function(){var e=this.style,t=e.left,r=e.right,i=e.top,a=e.bottom,n=e.width,o=e.height,s=n.u===V.AUTO&&(t.u===V.AUTO||r.u===V.AUTO),c=o.u===V.AUTO&&(i.u===V.AUTO||a.u===V.AUTO);return s?"auto":c?"autoH":"fixed"},i.prototype.cloneProps=function(){var t=e.prototype.cloneProps.call(this);if(this.isMounted){var r=t.textBehaviour=this.getTextBehaviour(),i=t.style;"auto"===r?(i.width=this.width,i.height=this.height):"autoH"===r&&(i.height=this.height)}return t.content=this._content,t},i.prototype.clone=function(){return new i(this.cloneProps())},Object.defineProperty(i.prototype,"bbox",{get:function(){var e=this._bbox;if(!e){var t=this._rect||this.rect;e=this._bbox=t.slice(0),this.lineBoxList.forEach(function(t){t.list.forEach(function(t){var r=t.fontFamily,i=t.fontSize,a=t.lineHeight,n=t.str,o=t.font,s=t.textShadow,c=a;if(Xe.hasRegister(r)){c=Xe.data[r].lhr*i}else{var u=oe.getFontCanvas().ctx;u.font=o;var l=u.measureText(n);c=l.actualBoundingBoxAscent+l.actualBoundingBoxDescent}var h=Math.max(0,.5*(c-a));if(h>0){var d=t.y-h,f=t.lineHeight+h;e[1]=Math.min(e[1],d),e[3]=Math.max(e[3],f)}if(s){var m=Or(s.blur),p=s.x+m,g=s.y+m;p>0?e[2]=Math.max(e[2],t.x+t.w+p):p<0&&(e[0]=Math.min(e[0],t.x+p)),g>0?e[3]=Math.max(e[3],t.y+t.lineHeight+g+h):g<0&&(e[1]=Math.min(e[1],t.y+g-h))}})});var r=this.computedStyle,i=r.strokeWidth,a=r.strokeEnable,n=r.strokePosition,o=0;i.forEach(function(e,t){a[t]&&(n[t]===J.INSIDE||(o=n[t]===J.OUTSIDE?Math.max(o,2*e):Math.max(o,.5*e*2)))}),e[0]-=o,e[1]-=o,e[2]+=o,e[3]+=o}return e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"content",{get:function(){return this._content},set:function(e){this._content!==e&&(this._content=e,this.refresh(ci.REFLOW))},enumerable:!1,configurable:!0}),i}(ka);function sm(e){return(e.curveMode===ce.STRAIGHT||e.curveMode===ce.NONE||"straight"===e.curveMode||"none"===e.curveMode)&&!!e.cornerRadius&&e.cornerRadius>0}function cm(e,t,r,i,a,n){var o=vr(e.absX,e.absY,t.absX,t.absY),s=vr(t.absX,t.absY,r.absX,r.absY),c=yr(vr(e.absX,e.absY,r.absX,r.absY),o,s),u=Math.tan(.5*c),l=n/u,h=Math.min(i?.5*o:o,a?.5*s:s);l>h&&(n=(l=h)*u);var d=Ze(e.absX-t.absX,e.absY-t.absY),f=Ze(r.absX-t.absX,r.absY-t.absY),m={x:d.x*l,y:d.y*l};m.x+=t.absX,m.y+=t.absY;var p={x:f.x*l,y:f.y*l};p.x+=t.absX,p.y+=t.absY;var g=4/3*Math.tan((Math.PI-c)/4),v={x:d.x*-n*g,y:d.y*-n*g};v.x+=m.x,v.y+=m.y;var y={x:f.x*-n*g,y:f.y*-n*g};return y.x+=p.x,y.y+=p.y,{prevTangent:m,prevHandle:v,nextTangent:p,nextHandle:y}}function um(e,t,r,i,a,n){var o,s,c,u;if(i){var l=Math.sqrt(Math.pow(t.absX-e.absX,2)+Math.pow(t.absY-e.absY,2));n=Math.min(n,.5*l)}if(a){l=Math.sqrt(Math.pow(t.absX-r.absX,2)+Math.pow(t.absY-r.absY,2));n=Math.min(n,.5*l)}var h=e.absFx-t.absX,d=e.absFy-t.absY,f=r.absTx-t.absX,m=r.absTy-t.absY,p=e.absX-t.absX,g=e.absY-t.absY,v=r.absX-t.absX,y=r.absY-t.absY,b=qe(h,d,f,m),x=qe(p,g,v,y),T=qe(h,d,p,g),w=qe(f,m,v,y);if(!(Math.abs(b)<1e-6)){var k=[{x:e.absX,y:e.absY},{x:null!==(o=e.absFx)&&void 0!==o?o:e.absX,y:null!==(s=e.absFy)&&void 0!==s?s:e.absY},{x:t.absX,y:t.absY}],S=[{x:t.absX,y:t.absY},{x:null!==(c=r.absTx)&&void 0!==c?c:r.absX,y:null!==(u=r.absTy)&&void 0!==u?u:r.absY},{x:r.absX,y:r.absY}],E=dr.intersectBezier2Bezier2(k[0].x,k[0].y,k[1].x,k[1].y,k[2].x,k[2].y,S[0].x,S[0].y,S[1].x,S[1].y,S[2].x,S[2].y).filter(function(e){return e.x!==S[0].x&&e.y!==S[0].y}).sort(function(e,t){return e.t1===t.t1?t.t2-e.t2:t.t1-e.t1}),C=E.length;if(!C)return lm(k,S,t,C,!1,b,x,T,w,n,0,1,0,1);var A=E.map(function(e){return e.t1}),_=E.map(function(e){return Ut(S,e.x,e.y)[0]});if(!_.find(function(e){return void 0===e})){var M=!1;A.unshift(1),A.push(0),_.unshift(0),_.push(1);for(var I=0;I<=C;I++){var R=lm(k,S,t,C,M,b,x,T,w,n,A[I+1],A[I],_[I],_[I+1]);if(R)return R;M=!M}}}}function lm(e,t,r,i,a,n,o,s,c,u,l,h,d,f){var m=dm(e,i,a,n,o,s,u,!0,l,h),p=dm(t,i,a,n,o,c,u,!1,d,f);if(!(!m||m.length<2||!p||p.length<2)){var g=function(e,t){var r=pm(e,0),i=pm(t,1),a=function(e){var t={};e.forEach(function(e){var r,i=e.x1,a=e.x2;i>a&&(i=(r=[a,i])[0],a=r[1]),fm(t,i,e),fm(t,a,e)});var r=[];return Object.keys(t).forEach(function(e){return r.push({x:parseFloat(e),arr:t[e]})}),r.sort(function(e,t){return e.x-t.x})}(r.concat(i)),n=[],o=[],s=[];for(;a.length;){o.length&&o.splice(0).forEach(function(e){var t=n.indexOf(e);n.splice(t,1)});for(var c=a.shift().arr;c.length;){var u=c.shift();if(!u.isDeleted){var l=u.belong,h=u.bbox;if(u.isVisited)o.push(u);else{if(n.length)for(var d=u.x1,f=u.y1,m=u.x2,p=u.y2,g=u.bbox,v=0;v<n.length;v++){var y=n[v];if(!y.isDeleted&&!u.isDeleted&&y.belong!==l){var b=y.x1,x=y.y1,T=y.x2,w=y.y2;if(xr(h[0],h[1],h[2],h[3],g[0],g[1],g[2],g[3],!0)){var k=(w-x)*(m-d)-(T-b)*(p-f);if(0!==k){var S=((T-b)*(f-x)-(w-x)*(d-b))/k,E=((m-d)*(f-x)-(p-f)*(d-b))/k;if(S>=0&&S<=1&&E>=0&&E<=1){var C=d+S*(m-d),A=f+S*(p-f);s.push({x:C,y:A,t1:0===l?u.t:y.t,t2:0===l?y.t:u.t}),u.isDeleted=!0;break}}}}}u.isDeleted||(n.push(u),u.isVisited=!0)}}}}return s}(m,p);if(g.length){var v=g[0];if(g.length>1)for(var y=Math.pow(r.absX-v.x,2)+Math.pow(r.absY-v.y,2),b=1,x=g.length;b<x;b++){var T=g[b],w=Math.pow(r.absX-T.x,2)+Math.pow(r.absY-T.y,2);w<y&&(v=T,y=w)}var k=Ft(e,v.t1),S=Ft(t,v.t2),E=zt(e,v.t1),C=zt(t,v.t2),A=k.y-E*k.x,_=(S.y-C*S.x-A)/(E-C),M=E*_+A;Math.abs(E)<1e-9?(M=k.y,C!==1/0&&C!==-1/0||(_=S.x)):Math.abs(C)<1e-9?(M=S.y,E!==1/0&&E!==-1/0||(_=k.x)):E===1/0||E===-1/0?(_=k.x,M=S.y):C!==1/0&&C!==-1/0||(_=S.x,M=k.y);var I=vr(k.x,k.y,_,M),R=vr(_,M,S.x,S.y),P=yr(vr(k.x,k.y,S.x,S.y),I,R),O=4/3*Math.tan((Math.PI-P)/4),D=Ze(k.x-_,k.y-M),B=Ze(S.x-_,S.y-M),F={x:D.x*-u*O,y:D.y*-u*O};F.x+=k.x,F.y+=k.y;var L={x:B.x*-u*O,y:B.y*-u*O};return L.x+=S.x,L.y+=S.y,{prevTangent:k,prevHandle:F,nextTangent:S,nextHandle:L,t1:v.t1,t2:v.t2}}}}var hm={11010:1,11e3:1,11110:1,11100:1,11001:1,11111:1,11012:1,11002:1,11112:1,11102:1,11013:1,11103:1,10010:0,10100:0,10011:0,10001:0,10111:0,10101:0,"00010":0,"00000":0,"00110":0,"00100":0,"00011":0,"00101":0,"00002":0,"00012":0,"00102":0,"00112":0,"00003":0,"00103":0,"01000":1,"01110":1,"01001":1,"01011":1,"01101":1,"01111":1};function dm(e,t,r,i,a,n,o,s,c,u){var l=(a>=0?"0":"1")+(i>=0?"0":"1")+(s?"0":"1")+(n>=0?"0":"1")+t;if(hm.hasOwnProperty(l)){for(var h=Math.ceil(Pt(e)),d=[],f=function(t){var i=t/h;if(i<=c||i>u)return"continue";var a,n=2*(e[0].x-2*e[1].x+e[2].x)*i+2*e[1].x-2*e[0].x,s=2*(e[0].y-2*e[1].y+e[2].y)*i+2*e[1].y-2*e[0].y,f=Ft(e,i),m=zt(e,i),p=0;p=Math.abs(m)<1e-12?1/0:m===1/0||m===-1/0?0:-1/m,a=p===1/0?f.y:f.y-p*f.x;var g=void 0,v=void 0;p===1/0?(g=[f.x,f.x],v=[f.y-o,f.y+o]):v=(g=Et([Math.pow(f.x,2)+Math.pow(a,2)-2*f.y*a+Math.pow(f.y,2)-Math.pow(o,2),2*(a*p-f.x-f.y*p),Math.pow(p,2)+1])).map(function(e){return p*e+a});var y=qe(g[0]-f.x,v[0]-f.y,n,s)>=0?0:1;r&&(y=(y+1)%2),hm[l]===y?d.push({x:g[0],y:v[0],t:i}):d.push({x:g[1],y:v[1],t:i})},m=0;m<=h;m++)f(m);return d}}function fm(e,t,r){var i=e[t]=e[t]||[];r.isVisited?(i.unshift(r),r.isVisited=!1):(i.push(r),r.isVisited=!0)}var mm=0;function pm(e,t){for(var r,i,a=[],n=1,o=e.length;n<o;n++){var s=e[n-1],c=s.x,u=s.y,l=s.t,h=e[n],d=h.x,f=h.y,m=h.t;(d<c||c===d&&f<u)&&(c=(r=[d,c])[0],d=r[1],u=(i=[f,u])[0],f=i[1]);var p=[c,Math.min(u,f),d,Math.max(u,f)];a.push({id:mm++,x1:c,y1:u,x2:d,y2:f,bbox:p,belong:t,isVisited:!1,isDeleted:!1,t:.5*(l+m)})}return a}var gm,vm=function(e){function r(t){var r=e.call(this,t)||this;return r.props=t,r.points=[],t.points.forEach(function(e){r.points.push(si(e))}),r.isClosed=t.isClosed||!1,r}return t(r,e),r.prototype.lay=function(t){e.prototype.lay.call(this,t),this.coords=void 0},r.prototype.calRepaintStyle=function(t){e.prototype.calRepaintStyle.call(this,t),this.coords=void 0,this._rect=void 0},r.prototype.buildPoints=function(){this.coords||(this.coords=function(e,t,r,i){if(void 0===r&&(r=1),void 0===i&&(i=1),!e.length)return[];for(var a=[],n=!1,o=0,s=e.length;o<s;o++)(O=e[o]).absX=(O.x||0)*r,O.absY=(O.y||0)*i,O.absTx=O.tx*r,O.absTy=O.ty*i,O.absFx=O.fx*r,O.absFy=O.fy*i,sm(O)&&(n=!0);var c=[];if(n){o=0;for(var u=e.length;o<u;o++){var l=e[o];if(sm(l)){var h=(o+1)%u,d=e[o?o-1:u-1],f=e[h],m=l.cornerRadius,p=sm(d),g=p||d.curveMode===ce.STRAIGHT||!d.hasCurveFrom,v=sm(f),y=v||f.curveMode===ce.STRAIGHT||!f.hasCurveTo;c[o]=g&&y?cm(d,l,f,p,v,m):um(d,l,f,p,v,m)}}}for(var b=e.map(function(e){return Object.assign({},e)}),x=(o=0,b.length);o<x;o++){var T=c[o];if(T){var w=T.prevTangent,k=T.prevHandle,S=T.nextTangent,E=T.nextHandle,C={x:0,y:0,cornerRadius:0,curveMode:ce.NONE,hasCurveFrom:!0,fx:0,fy:0,hasCurveTo:!1,tx:0,ty:0,absX:w.x,absY:w.y,absFx:k.x,absFy:k.y,absTx:0,absTy:0,dspX:0,dspY:0,dspFx:0,dspFy:0,dspTx:0,dspTy:0},A={x:0,y:0,cornerRadius:0,curveMode:ce.NONE,hasCurveFrom:!1,fx:0,fy:0,hasCurveTo:!0,tx:0,ty:0,absX:S.x,absY:S.y,absFx:0,absFy:0,absTx:E.x,absTy:E.y,dspX:0,dspY:0,dspFx:0,dspFy:0,dspTx:0,dspTy:0};if(T.t1){var _=Bt([{x:(D=b[(o+x-1)%x]).absX,y:D.absY},{x:D.absFx,y:D.absFy},{x:b[o].absX,y:b[o].absY}],0,T.t1);D.absFx=_[1].x,D.absFy=_[1].y}if(T.t2){var M=b[(o+1)%x];_=Bt([{x:M.absX,y:M.absY},{x:M.absTx,y:M.absTy},{x:b[o].absX,y:b[o].absY}],0,1-T.t2),M.absTx=_[1].x,M.absTy=_[1].y}b.splice(o,1,C,A),o++,x++,c.splice(o,0,void 0)}}var I=b[0],R=[I.absX,I.absY];a.push(R);var P=b.length;for(o=1;o<P;o++){var O=b[o],D=b[o-1],B=[O.absX,O.absY];O.hasCurveTo&&B.unshift(O.absTx,O.absTy),D.hasCurveFrom&&B.unshift(D.absFx,D.absFy),a.push(B)}if(t){var F=b[P-1],L=[I.absX,I.absY];I.hasCurveTo&&L.unshift(I.absTx,I.absTy),F.hasCurveFrom&&L.unshift(F.absFx,F.absFy),a.push(L)}return a}(this.points,this.isClosed,this.width,this.height))},r.prototype.calContent=function(){return this.buildPoints(),this.hasContent=!!this.coords&&this.coords.length>1},r.prototype.isLine=function(){this.buildPoints();var e=this.coords;return!!e&&2===e.length&&2===e[0].length&&2===e[1].length},r.prototype.refresh=function(t,r){void 0===t&&(t=ci.REPAINT),t>=ci.REPAINT&&(this.coords=void 0),e.prototype.refresh.call(this,t,r)},r.prototype.renderCanvas=function(){e.prototype.renderCanvas.call(this),this.buildPoints();var t=this.coords;t&&t.length&&this.renderFillStroke([t],!1)},Object.defineProperty(r.prototype,"rect",{get:function(){var e=this._rect;if(!e){e=this._rect=new Float32Array(4),this.buildPoints();var t=this.coords;t&&t.length&&function(e,t){var r=!0;t=t||new Float32Array(4);for(var i=0,a=0,n=0,o=e.length;n<o;n++){var s=e[n];if(r){if(!(c=di(s,t))){oe.error("Unsupported point data: "+n+" - "+s.join(","));continue}i=c.x,a=c.y,r=!1}else{var c;if(!(c=fi(s,i,a,t))){oe.error("Unsupported point data: "+n+" - "+s.join(","));continue}i=c.x,a=c.y}}}(t,e)}return e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"bbox",{get:function(){var e=this._bbox;if(!e){var t=this._rect||this.rect;e=this._bbox=t.slice(0),this.buildPoints();var r=this.computedStyle,i=r.strokeWidth,a=r.strokeEnable,n=r.strokePosition,o=r.strokeLinecap,s=r.strokeLinejoin,c=r.strokeMiterlimit,u=this.isClosed,l=0;i.forEach(function(e,t){a[t]&&(n[t]===J.OUTSIDE&&u?l=Math.max(l,e):n[t]!==J.CENTER&&u||(l=Math.max(l,.5*e)))});var h=e[0]-l,d=e[1]-l,f=e[2]+l,m=e[3]+l;e=this._bbox=u?function(e,t,r,i,a){var n=e.slice(0);if(i===Z.ROUND)return n[0]-=t,n[1]-=t,n[2]+=t,n[3]+=t,n;if(!r.length)return n;for(var o=[],s=[],c=r[0],u=c[0],l=c[1],h=1,d=r.length;h<d;h++){var f=0,m=0;2===(y=r[h]).length?(f=y[0]-u,m=y[1]-l,u=y[0],l=y[1],o.push([f,m])):4===y.length?(f=2*(u-2*y[0]+y[2])+2*y[0]-2*u,m=2*(l-2*y[1]+y[3])+2*y[1]-2*l,u=y[2],l=y[3],o.push([f,m])):6===y.length&&(f=3*(-u+3*y[0]-3*y[2]+y[4])+2*(3*u-6*y[0]+3*y[2])+3*y[0]-3*u,m=3*(-l+3*y[1]-3*y[3]+y[5])+2*(3*l-6*y[1]+3*y[3])+3*y[1]-3*l,u=y[4],l=y[5],o.push([f,m]));var p=Math.atan(Math.abs(m/f)),g=Math.sin(p)*t,v=Math.cos(p)*t;f>=0?m>=0?s.push([-g,v]):s.push([g,v]):m>=0?s.push([-g,-v]):s.push([g,-v])}for(h=0,d=o.length;h<d;h++){var y=o[h],b=o[(h+1)%d];if(y[0]&&y[1]&&b[0]&&b[1]){var x=qe(y[0],y[1],b[0],b[1]),T=s[h],w=s[(h+1)%d];if(T[0]||T[1]||w[0]||w[1]){var k=0,S=0,E=0,C=0,A=[y[0]+T[0],y[1]+T[1]],_=qe(y[0],y[1],A[0],A[1]);x>=0&&_>=0||x<0&&_<0?(k=-T[0],S=-T[1]):(k=T[0],S=T[1]);var M=[b[0]+w[0],b[1]+w[1]],I=qe(b[0],b[1],M[0],M[1]);x>=0&&I>=0||x<0&&I<0?(E=-w[0],C=-w[1]):(E=w[0],C=w[1]);var R=r[h],P=r[h+1],O=r[(h+2)%d],D=R.length,B=P.length,F=O.length,L=R[D-2]+k,N=R[D-1]+S,U=P[B-2]+k,z=P[B-1]+S,W=P[B-2]+E,V=P[B-1]+C,H=cr(L,N,U,z,W,V,O[F-2]+E,O[F-1]+C,!1);if(H&&1!==H.toSource&&0!==H.toClip)if(i===Z.BEVEL)if((q=2*t/Math.sqrt(Math.pow(W-U,2)+Math.pow(V-z,2)))>=1)n[0]=Math.min(n[0],U,W),n[1]=Math.min(n[1],z,V),n[2]=Math.max(n[2],U,W),n[3]=Math.max(n[3],z,V);else{var X=H.x-(H.x-U)*q,j=H.y-(H.y-z)*q,G=H.x-(H.x-W)*q,Y=H.y-(H.y-V)*q;n[0]=Math.min(n[0],X,G),n[1]=Math.min(n[1],j,Y),n[2]=Math.max(n[2],X,G),n[3]=Math.max(n[3],j,Y)}else if(i===Z.MITER){var q;if((q=Math.sqrt(Math.pow(H.x-P[B-2],2)+Math.pow(H.y-P[B-1],2))/t)>a){var K=2*t/Math.sqrt(Math.pow(W-U,2)+Math.pow(V-z,2));K>=1?(n[0]=Math.min(n[0],U,W),n[1]=Math.min(n[1],z,V),n[2]=Math.max(n[2],U,W),n[3]=Math.max(n[3],z,V)):(X=H.x-(H.x-U)*K,j=H.y-(H.y-z)*K,G=H.x-(H.x-W)*K,Y=H.y-(H.y-V)*K,n[0]=Math.min(n[0],X,G),n[1]=Math.min(n[1],j,Y),n[2]=Math.max(n[2],X,G),n[3]=Math.max(n[3],j,Y))}else n[0]=Math.min(n[0],H.x),n[1]=Math.min(n[1],H.y),n[2]=Math.max(n[2],H.x),n[3]=Math.max(n[3],H.y)}}}}return n}(e,l,this.coords||[],s,c):function(e,t,r,i){var a=e.slice(0);if(i===Q.ROUND&&(a[0]-=t,a[1]-=t,a[2]+=t,a[3]+=t),!r.length)return a;for(var n=r[0],o=r[r.length-1],s=o.length,c=[],u=0;u<s;u+=2)c.push({x:o[u],y:o[u+1]});var l=0,h=0;s>2?(l=Math.abs(zt(c,0)),h=Math.abs(zt(c,1))):l=h=Math.abs(o[s-1]-n[1])/Math.abs(o[s-2]-n[0]);var d=Math.atan(l),f=Math.atan(h),m=Math.sin(d),p=Math.cos(d),g=Math.sin(f),v=Math.cos(f),y=m===1/0?t:Math.abs(m*t),b=p===1/0?t:Math.abs(p*t),x=g===1/0?t:Math.abs(g*t),T=v===1/0?t:Math.abs(v*t);return i===Q.BUTT?(a[0]=Math.min(a[0],n[0]-y,o[s-2]-x),a[1]=Math.min(a[1],n[1]-b,o[s-1]-T),a[2]=Math.max(a[2],n[0]+y,o[s-2]+x),a[3]=Math.max(a[3],n[1]+b,o[s-1]+T)):i===Q.SQUARE&&(a[0]=Math.min(a[0],n[0]-y-b,o[s-2]-x-T),a[1]=Math.min(a[1],n[1]-y-b,o[s-1]-x-T),a[2]=Math.max(a[2],n[0]+y+b,o[s-2]+x+T),a[3]=Math.max(a[3],n[1]+y+b,o[s-1]+x+T)),a}(e,l,this.coords||[],o),e[0]=Math.min(e[0],h),e[1]=Math.min(e[1],d),e[2]=Math.max(e[2],f),e[3]=Math.max(e[3],m)}return e},enumerable:!1,configurable:!0}),r}(ka),ym={Container:Ba,Bitmap:Oa,Node:ka,Root:Jf,Video:ef,Audio:Sf,Text:om,Lottie:Ff,Polyline:vm};!function(e){e[e.NONE=0]="NONE",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED"}(gm||(gm={}));var bm,xm={};!function(e){e[e.NONE=0]="NONE",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED"}(bm||(bm={}));var Tm={};var wm,km={type:_,Event:M,inject:oe,opentype:Le,loadImg:Ea,loadAudio:function(e,t){return i(this,void 0,void 0,function(){var r,i,n,o;return a(this,function(a){switch(a.label){case 0:if(r=xm[e]){if(r.count++,r.state===gm.LOADED)return[2,r.res];if(r.state===gm.LOADING)return[2,new Promise(function(e){r.list.push(e)})]}return r=xm[e]={state:gm.LOADING,list:[],count:0,res:{success:!1,duration:0,release:function(){r.count--,r.count<=0&&(r.res.audioBuffer=void 0,delete xm[e])}}},[4,fetch(e,Object.assign({mode:"cors"},t))];case 1:return 200!==(i=a.sent()).status&&304!==i.status?(r.state=gm.LOADED,[2,r.res]):[4,i.arrayBuffer()];case 2:return n=a.sent(),[4,(new AudioContext).decodeAudioData(n)];case 3:return o=a.sent(),r.count++,[2,new Promise(function(e){r.res.success=!0,r.res.audioBuffer=o,r.res.duration=Math.ceil(1e3*o.duration),r.state=gm.LOADED,e(r.res),r.list.splice(0).forEach(function(e){r.count++,e(r.res)})})]}})})},loadFont:function(e,t,r){return i(this,void 0,void 0,function(){var i,n,o;return a(this,function(a){switch(a.label){case 0:if(i=Tm[e]){if(i.count++,i.state===bm.LOADED)return[2,i.res];if(i.state===bm.LOADING)return[2,new Promise(function(e){i.list.push(e)})]}return i=Tm[e]={state:bm.LOADING,list:[],count:0,res:{success:!1,release:function(){i.count--,i.count<=0&&delete Tm[e]}}},[4,fetch(e,Object.assign({mode:"cors"},r))];case 1:return 200!==(n=a.sent()).status&&304!==n.status?(i.state=bm.LOADED,[2,i.res]):[4,n.arrayBuffer()];case 2:return o=a.sent(),[4,Xe.registerAb(o,t)];case 3:return a.sent(),i.count++,[2,new Promise(function(e){i.res.success=!0,i.res.arrayBuffer=o,i.state=bm.LOADED,e(i.res),i.list.splice(0).forEach(function(e){i.count++,e(i.res)})})]}})})},loadRange:Hd,MbVideoDecoder:Jd,MbVideoDecoderEvent:jd,MbVideoEncoder:Zf,MbVideoEncoderEvent:Kf,sound:$f},Sm={font:Xe,transform:Rr,define:le,css:ui,color:pe},Em=function(){function e(e,t){this.root=e,this.dom=t;var r=this.select=document.createElement("div");r.className="select",r.style.display="none",r.innerHTML='\n <div class="sub"></div>\n <span class="l">\n <b></b>\n </span>\n <span class="t">\n <b></b>\n </span>\n <span class="r">\n <b></b>\n </span>\n <span class="b">\n <b></b>\n </span>\n <span class="tl">\n <b></b>\n </span>\n <span class="tr">\n <b></b>\n </span>\n <span class="br">\n <b></b>\n </span>\n <span class="bl">\n <b></b>\n </span>\n',t.appendChild(r)}return e.prototype.showSelect=function(e){this.updateSelect(e),this.select.style.display="block"},e.prototype.updateSelect=function(e){var t=this.select.querySelector(".sub");if(1===e.length){t.innerHTML="",this.select.classList.remove("multi"),e[0].computedStyle.visibility===te.VISIBLE?this.select.classList.remove("hide"):this.select.classList.add("hide");var r=this.calRect(e[0]);this.select.style.left=r.left+"px",this.select.style.top=r.top+"px",this.select.style.width=r.width+"px",this.select.style.height=r.height+"px",this.select.style.transform=r.transform}},e.prototype.calRect=function(e){var t=this.root.canvas,r=e._rect||e.rect,i=e.matrixWorld,a=t.clientWidth/t.width,n=t.clientHeight/t.height;if(1!==a||1!==n){var o=at();i=ot(o,i),vt(o,a),yt(o,n),i=ot(o,i)}var s=Tt(r[0],r[1],r[2],r[3],i),c=s.x1,u=s.y1,l=s.x2,h=s.y2,d=s.x3,f=s.y3;s.x4,s.y4;var m={left:c,top:u,width:Math.sqrt(Math.pow(c-l,2)+Math.pow(u-h,2)),height:Math.sqrt(Math.pow(l-d,2)+Math.pow(h-f,2)),transform:""};if(l>c){if(h!==u){var p=mr(Math.atan((h-u)/(l-c)));m.transform="rotateZ(".concat(p,"deg)")}}else if(l<c){p=mr(Math.atan((h-u)/(l-c)));m.transform="rotateZ(".concat(p+180,"deg)")}else h>u?m.transform="rotateZ(90deg)":h<u&&(m.transform="rotateZ(-90deg)");return m},e.prototype.hideSelect=function(){this.select.style.display="none"},e.prototype.release=function(){this.select.remove()},e.prototype.metaKey=function(e){e?this.select.classList.add("rotate"):this.select.classList.remove("rotate")},e.prototype.isSelectControlDom=function(e){return e.parentElement===this.select},e.prototype.getAspectRatio=function(){var e=this.select.style;return{x:parseFloat(e.left),y:parseFloat(e.top),w:parseFloat(e.width),h:parseFloat(e.height)}},e}();!function(e){e[e.NORMAL=0]="NORMAL",e[e.HAND=1]="HAND",e[e.RESIZE=2]="RESIZE",e[e.EDIT_TEXT=3]="EDIT_TEXT",e[e.EDIT_GRADIENT=4]="EDIT_GRADIENT",e[e.EDIT_GEOM=5]="EDIT_GEOM",e[e.ADD_TEXT=6]="ADD_TEXT",e[e.ADD_RECT=7]="ADD_RECT",e[e.ADD_OVAL=8]="ADD_OVAL",e[e.ADD_ROUND=9]="ADD_ROUND",e[e.ADD_TRIANGLE=10]="ADD_TRIANGLE",e[e.ADD_LINE=11]="ADD_LINE",e[e.ADD_STAR=12]="ADD_STAR",e[e.ADD_IMG=13]="ADD_IMG",e[e.ADD_PEN=14]="ADD_PEN",e[e.ADD_CUSTOM_GEOM=15]="ADD_CUSTOM_GEOM"}(wm||(wm={}));var Cm,Am=wm,_m="cursor",Mm="content",Im="state_change",Rm={SELECT:"select",MOVE:"move",REMOVE:"remove",ADD:"add",RESIZE:"resize",ROTATE:"rotate",CURSOR:_m,CONTENT:Mm,STATE_CHANGE:Im},Pm=function(e){this.nodes=e},Om=function(e){function r(t,r){var i=e.call(this,t)||this;return i.data=r,i}return t(r,e),r.prototype.execute=function(){var e=this.nodes,t=this.data;e.forEach(function(e,i){var a=t[i],n=a.dx,o=a.dy,s=e.getStyle(),c=e.computedStyle;r.operate(e,c,n,o),e.endPosChange(s,n,o),e.checkPosSizeUpward()})},r.prototype.undo=function(){var e=this.nodes,t=this.data;e.forEach(function(e,i){var a=t[i],n=a.dx,o=a.dy,s=e.getStyle(),c=e.computedStyle;r.operate(e,c,-n,-o),e.endPosChange(s,-n,-o),e.checkPosSizeUpward()})},r.operate=function(e,t,r,i){e.updateStyle({translateX:t.translateX+r,translateY:t.translateY+i})},r}(Pm);var Dm=function(){function e(e){void 0===e&&(e=100),this.commands=[],this.commandsR=[],this.size=Math.max(1,e),this.lastTime=0}return e.prototype.addCommand=function(e,t){void 0===t&&(t=!1),this.commandsR.splice(0);var r=this.commands.length;if(!t&&r>0){var i=this.commands[r-1];if(Date.now()-this.lastTime<L.historyTime&&function(e,t){if(e.constructor!==t.constructor)return!1;var r=e.nodes,i=t.nodes;if(r.length!==i.length)return!1;for(var a=0,n=r.length;a<n;a++)if(r[a]!==i[a])return!1;return!0}(i,e)){var a=!0;if(i instanceof Om){var n=e.data;i.data.forEach(function(e,t){e.dx+=n[t].dx,e.dy+=n[t].dy})}else a=!1;if(a)return void(this.lastTime=Date.now())}}this.lastTime=Date.now(),r>=this.size&&this.commands.slice(0,r-this.size+1),this.commands.push(e)},e.prototype.undo=function(){if(this.commands.length){var e=this.commands.pop();return e.undo(),this.commandsR.push(e),e}},e.prototype.redo=function(){if(this.commandsR.length){var e=this.commandsR.pop();return e.execute(),this.commands.push(e),e}},e.getInstance=function(){return Cm||(Cm=new e),Cm},e}();var Bm,Fm=function(e){function r(t,r){var i=e.call(this,t)||this;return i.data=r,i}return t(r,e),r.prototype.execute=function(){this.nodes.forEach(function(e){e.remove()})},r.prototype.undo=function(){var e=this.nodes,t=this.data;e.forEach(function(e,r){!function(e,t){var r=e.style,i=e.computedStyle,a=t.x,n=t.y,o=t.parent,s=t.index,c=C(r.top),u=C(r.right),l=C(r.bottom),h=C(r.left),d=C(r.width),f=C(r.height);r.left={v:a,u:V.PX},r.right={v:0,u:V.AUTO},r.top={v:n,u:V.PX},r.bottom={v:0,u:V.AUTO},r.width={v:i.width,u:V.PX},r.height={v:i.height,u:V.PX},function(e,t,r){var i=e.children;r<=0?e.prependChild(t):r>=i.length?e.appendChild(t):i[r].insertAfter(t)}(o,e,s),h.u===V.PERCENT?r.left={v:100*i.left/o.width,u:V.PERCENT}:h.u===V.PX?r.left={v:i.left,u:V.PX}:h.u===V.AUTO&&(r.left={v:0,u:V.AUTO}),u.u===V.PERCENT?r.right={v:100*i.right/o.width,u:V.PERCENT}:u.u===V.PX?r.right={v:i.right,u:V.PX}:u.u===V.AUTO&&(r.right={v:0,u:V.AUTO}),c.u===V.PERCENT?r.top={v:100*i.top/o.height,u:V.PERCENT}:c.u===V.PX?r.top={v:i.top,u:V.PX}:c.u===V.AUTO&&(r.top={v:0,u:V.AUTO}),l.u===V.PERCENT?r.bottom={v:100*i.bottom/o.height,u:V.PERCENT}:l.u===V.PX?r.bottom={v:i.bottom,u:V.PX}:l.u===V.AUTO&&(r.bottom={v:0,u:V.AUTO}),d.u===V.PERCENT?r.width={v:100*i.width/o.width,u:V.PERCENT}:d.u===V.PX?r.width={v:i.width,u:V.PX}:d.u===V.AUTO&&(r.width={v:0,u:V.AUTO}),f.u===V.PERCENT?r.height={v:100*i.height/o.height,u:V.PERCENT}:f.u===V.PX?r.height={v:i.height,u:V.PX}:f.u===V.AUTO&&(r.height={v:0,u:V.AUTO})}(e,t[r])})},r.operate=function(e){var t=e.parent,r=t.children.indexOf(e),i={x:e.computedStyle.left,y:e.computedStyle.top,parent:t,index:r};return e.remove(),i},r}(Pm);function Lm(e,t,r,i){void 0===i&&(i=!1);var a=e.style,n={};if(r>t.height){r-=t.height,r=Math.max(r,1),a.top.u===V.PX?n.top=t.top+t.height:a.left.u===V.PERCENT&&(n.top=100*(t.top+t.height)/e.parent.height+"%");var o=Object.assign({},t);o.height=0,Object.assign(n,Nm(e,o,r)),n.scaleY=-1*t.scaleY}else r=Math.min(r,t.height-1),n.scaleY=t.scaleY,a.top.u===V.PX||a.top.u===V.PERCENT?(a.top.u===V.PX?n.top=t.top+r:n.top=100*(t.top+r)/e.parent.height+"%",a.height.u===V.PX||a.height.u===V.AUTO&&a.bottom.u===V.AUTO?n.height=t.height-r:a.height.u===V.PERCENT&&(n.height=100*(t.height-r)/e.parent.height+"%")):a.height.u!==V.PX&&a.height.u!==V.PERCENT&&a.height.u!==V.AUTO||(a.height.u===V.PX||a.height.u===V.AUTO?n.height=t.height-r:n.height=100*(t.height-r)/e.parent.height+"%");if(i){var s=Nm(e,t,-r);s.height&&("number"==typeof s.height?s.height=t.height-2*r:s.height=100*(t.height-2*r)/e.parent.height+"%"),Object.assign(n,s)}return n}function Nm(e,t,r,i){void 0===i&&(i=!1);var a=e.style,n={};if(r<-t.height){r+=t.height,r=Math.min(r,-1),a.bottom.u===V.PX?n.bottom=t.bottom+t.height:a.bottom.u===V.PERCENT&&(n.bottom=100*(t.bottom+t.height)/e.parent.height+"%");var o=Object.assign({},t);o.height=0,Object.assign(n,Lm(e,o,r)),n.scaleY=-1*t.scaleY}else r=Math.max(r,1-t.height),n.scaleY=t.scaleY,a.bottom.u===V.PX||a.bottom.u===V.PERCENT?(a.bottom.u===V.PX?n.bottom=t.bottom-r:n.bottom=100*(t.bottom-r)/e.parent.height+"%",a.height.u===V.PX||a.height.u===V.AUTO&&a.top.u===V.AUTO?n.height=t.height+r:a.height.u===V.PERCENT&&(n.height=100*(t.height+r)/e.parent.height+"%")):a.height.u!==V.PX&&a.height.u!==V.PERCENT&&a.height.u!==V.AUTO||(a.height.u===V.PX||a.height.u===V.AUTO?n.height=t.height+r:n.height=100*(t.height+r)/e.parent.height+"%");if(i){var s=Lm(e,t,-r);s.height&&("number"==typeof s.height?s.height=t.height+2*r:s.height=100*(t.height+2*r)/e.parent.height+"%"),Object.assign(n,s)}return n}function Um(e,t,r,i){void 0===i&&(i=!1);var a=e.style,n={};if(r>t.width){r-=t.width,r=Math.max(r,1),a.left.u===V.PX?n.left=t.left+t.width:a.left.u===V.PERCENT&&(n.left=100*(t.left+t.width)/e.parent.width+"%");var o=Object.assign({},t);o.width=0,Object.assign(n,zm(e,o,r)),n.scaleX=-1*t.scaleX}else r=Math.min(r,t.width-1),n.scaleX=t.scaleX,a.left.u===V.PX||a.left.u===V.PERCENT?(a.left.u===V.PX?n.left=t.left+r:n.left=100*(t.left+r)/e.parent.width+"%",a.width.u===V.PX||a.width.u===V.AUTO&&a.right.u===V.AUTO?n.width=t.width-r:a.width.u===V.PERCENT&&(n.width=100*(t.width-r)/e.parent.width+"%")):a.width.u!==V.PX&&a.width.u!==V.PERCENT&&a.width.u!==V.AUTO||(a.width.u===V.PX||a.width.u===V.AUTO?n.width=t.width-r:n.width=100*(t.width-r)/e.parent.width+"%");if(i){var s=zm(e,t,-r);s.width&&("number"==typeof s.width?s.width=t.width-2*r:s.width=100*(t.width-2*r)/e.parent.width+"%"),Object.assign(n,s)}return n}function zm(e,t,r,i){void 0===i&&(i=!1);var a=e.style,n={};if(r<-t.width){r+=t.width,r=Math.min(r,-1),a.right.u===V.PX?n.right=t.right+t.width:a.right.u===V.PERCENT&&(n.right=100*(t.right+t.width)/e.parent.width+"%");var o=Object.assign({},t);o.width=0,Object.assign(n,Um(e,o,r)),n.scaleX=-1*t.scaleX}else r=Math.max(r,1-t.width),n.scaleX=t.scaleX,a.right.u===V.PX||a.right.u===V.PERCENT?(a.right.u===V.PX?n.right=t.right-r:n.right=100*(t.right-r)/e.parent.width+"%",a.width.u===V.PX||a.width.u===V.AUTO&&a.left.u===V.AUTO?n.width=t.width+r:a.width.u===V.PERCENT&&(n.width=100*(t.width+r)/e.parent.width+"%")):a.width.u!==V.PX&&a.width.u!==V.PERCENT&&a.width.u!==V.AUTO||(a.width.u===V.PX||a.width.u===V.AUTO?n.width=t.width+r:n.width=100*(t.width+r)/e.parent.width+"%");if(i){var s=Um(e,t,-r);s.width&&("number"==typeof s.width?s.width=t.width+2*r:s.width=100*(t.width+2*r)/e.parent.width+"%"),Object.assign(n,s)}return n}function Wm(e,t,r){var i=r*(t.width/t.height),a=Um(e,t,.5*-i),n=zm(e,t,.5*i),o=Object.assign({},a,n);if(o.width)if("number"==typeof o.width){var s=o.width-t.width;o.width=t.width+2*s}else{var c=e.parent.width;s=parseFloat(o.width)*c*.01-t.width;o.width=100*(t.width+2*s)/c+"%"}return o}function Vm(e,t,r,i){void 0===i&&(i=!1);var a=Lm(e,t,r);if(i){var n=Nm(e,t,-r);n.height&&("number"==typeof n.height?n.height=t.height-2*r:n.height=100*(t.height-2*r)/e.parent.height+"%"),Object.assign(a,n)}var o=Wm(e,t,i?2*-r:-r);return Object.assign(a,o)}function Hm(e,t,r,i){void 0===i&&(i=!1);var a=Nm(e,t,r);if(i){var n=Lm(e,t,-r);n.height&&("number"==typeof n.height?n.height=t.height+2*r:n.height=100*(t.height+2*r)/e.parent.height+"%"),Object.assign(a,n)}var o=Wm(e,t,i?2*r:r);return Object.assign(a,o)}function Xm(e,t,r){var i=r/(t.width/t.height),a=Lm(e,t,.5*-i),n=Nm(e,t,.5*i),o=Object.assign({},a,n);if(o.height)if("number"==typeof o.height){var s=o.height-t.height;o.height=t.height+2*s}else{var c=e.parent.height;s=parseFloat(o.height)*c*.01-t.height;o.height=100*(t.height+2*s)/c+"%"}return o}function jm(e,t,r,i){void 0===i&&(i=!1);var a=Um(e,t,r);if(i){var n=zm(e,t,-r);n.width&&("number"==typeof n.width?n.width=t.width-2*r:n.width=100*(t.width-2*r)/e.parent.width+"%"),Object.assign(a,n)}var o=Xm(e,t,i?2*-r:-r);return Object.assign(a,o)}function Gm(e,t,r,i){void 0===i&&(i=!1);var a=zm(e,t,r);if(i){var n=Um(e,t,-r);n.width&&("number"==typeof n.width?n.width=t.width+2*r:n.width=100*(t.width+2*r)/e.parent.width+"%"),Object.assign(a,n)}var o=Xm(e,t,i?2*r:r);return Object.assign(a,o)}function Ym(e,t,r,i){void 0===i&&(i=!0);var a=e.width,n=e.height,o=n/a;i||(o*=-1);var s=-1/o,c=a+t,u=n+r,l=(u-n+o*a-s*c)/(o-s);return{x:l,y:s*l-s*c+u}}function qm(e,t,r,i){i&&(e.left?"number"==typeof e.left?e.left+=i:e.left=parseFloat(e.left)+i/t.parent.width*100+"%":e.width||(t.style.left.u===V.PERCENT?e.left=100*(r.left+i)/t.parent.width+"%":t.style.left.u===V.PX&&(e.left=r.left+i)),e.right?"number"==typeof e.right?e.right-=i:e.right=parseFloat(e.right)-i/t.parent.width*100+"%":e.width||(t.style.right.u===V.PERCENT?e.right=100*(r.right-i)/t.parent.width+"%":t.style.right.u===V.PX&&(e.right=r.right-i)))}function Km(e,t,r,i){i&&(e.top?"number"==typeof e.top?e.top+=i:e.top=parseFloat(e.top)+i/t.parent.height*100+"%":e.height||(t.style.top.u===V.PERCENT?e.top=100*(r.top+i)/t.parent.height+"%":t.style.top.u===V.PX&&(e.top=r.top+i)),e.bottom?"number"==typeof e.bottom?e.bottom-=i:e.bottom=parseFloat(e.bottom)-i/t.parent.height*100+"%":e.height||(t.style.bottom.u===V.PERCENT?e.bottom=100*(r.bottom-i)/t.parent.height+"%":t.style.bottom.u===V.PX&&(e.bottom=r.bottom-i)))}function $m(e,t,r){var i=e*r.h/r.w,a=r.y+.5*r.h;return(t.y+.5*t.h-a)*i/r.h}function Qm(e,t,r){var i=e*r.w/r.h,a=r.x+.5*r.w;return(t.x+.5*t.w-a)*i/r.w}function Zm(e,t,r,i,a,n,o){void 0===n&&(n=!1),void 0===o&&(o=!1);var s=n?Vm(e,t,r*i.h/a.h,o):Lm(e,t,r*i.h/a.h,o),c=Qm(r,i,a);o&&(c*=2),qm(s,e,t,-c);return Km(s,e,t,o?-r*(i.y+.5*i.h-a.y-.5*a.h)*2/a.h:r*(a.y+a.h-i.y-i.h)/a.h),s}function Jm(e,t,r,i,a,n,o){void 0===n&&(n=!1),void 0===o&&(o=!1);var s=n?Hm(e,t,r*i.h/a.h,o):Nm(e,t,r*i.h/a.h,o);if(n){var c=Qm(r,i,a);o&&(c*=2),qm(s,e,t,c)}return Km(s,e,t,o?r*(i.y+.5*i.h-a.y-.5*a.h)*2/a.h:r*(i.y-a.y)/a.h),s}function ep(e,t,r,i,a,n,o){void 0===n&&(n=!1),void 0===o&&(o=!1);var s=n?jm(e,t,r*i.w/a.w,o):Um(e,t,r*i.w/a.w,o);if(n){var c=$m(r,i,a);o&&(c*=2),Km(s,e,t,-c)}return qm(s,e,t,o?-r*(i.x+.5*i.w-a.x-.5*a.w)*2/a.w:r*(a.x+a.w-i.x-i.w)/a.w),s}function tp(e,t,r,i,a,n,o){void 0===n&&(n=!1),void 0===o&&(o=!1);var s=n?Gm(e,t,r*i.w/a.w,o):zm(e,t,r*i.w/a.w,o);if(n){var c=$m(r,i,a);o&&(c*=2),Km(s,e,t,c)}return qm(s,e,t,o?r*(i.x+.5*i.w-a.x-.5*a.w)*2/a.w:r*(i.x-a.x)/a.w),s}function rp(e,t,r,i,a,n){var o=Zm(e,t,r,i,a);delete n.top,delete n.height,delete n.bottom,void 0!==o.top&&(n.top=o.top),void 0!==o.height&&(n.height=o.height),void 0!==o.bottom&&(n.bottom=o.bottom)}function ip(e,t,r,i,a,n){var o=Jm(e,t,r,i,a);delete n.top,delete n.height,delete n.bottom,void 0!==o.top&&(n.top=o.top),void 0!==o.height&&(n.height=o.height),void 0!==o.bottom&&(n.bottom=o.bottom)}!function(e){e[e.T=0]="T",e[e.R=1]="R",e[e.B=2]="B",e[e.L=3]="L",e[e.TL=4]="TL",e[e.TR=5]="TR",e[e.BL=6]="BL",e[e.BR=7]="BR"}(Bm||(Bm={}));var ap=function(e){function r(t,r){var i=e.call(this,t)||this;return i.data=r,i}return t(r,e),r.prototype.execute=function(){var e=this.nodes,t=this.data;e.forEach(function(e,i){var a=t[i],n=a.dx,o=a.dy,s=a.controlType,c=a.aspectRatio,u=a.clientRect,l=a.selectRect,h=a.fromCenter,d=a.widthToAuto,f=a.heightToAuto,m=e.getStyle();e.startSizeChange();var p=e.getComputedStyle(),g=e.getCssStyle();u?r.operateMultiAr(e,p,g,n,o,s,u,l,c,h,d,f):r.operate(e,p,g,n,o,s,c,h,d,f),e.endSizeChange(m),e.checkPosSizeUpward()})},r.prototype.undo=function(){var e=this.nodes,t=this.data;e.forEach(function(e,i){var a=t[i],n=a.dx,o=a.dy,s=a.controlType,c=a.aspectRatio,u=a.clientRect,l=a.selectRect,h=a.fromCenter,d=a.widthFromAuto,f=a.heightFromAuto,m=e.getStyle();e.startSizeChange();var p=e.getComputedStyle(),g=e.getCssStyle();s=function(e){return e}(s),u?r.operateMultiAr(e,p,g,-n,-o,s,u,l,c,h,d,f):r.operate(e,p,g,-n,-o,s,c,h,d,f),e.endSizeChange(m),e.checkPosSizeUpward()})},r.operate=function(e,t,r,i,a,n,o,s,c,u){void 0===s&&(s=!1),void 0===c&&(c=!1),void 0===u&&(u=!1);var l={left:r.left,right:r.right,top:r.top,bottom:r.bottom,width:r.width,height:r.height,scaleX:r.scaleX,scaleY:r.scaleY};o?n===Bm.T?Object.assign(l,Vm(e,t,a,s)):n===Bm.R?Object.assign(l,Gm(e,t,i,s)):n===Bm.B?Object.assign(l,Hm(e,t,a,s)):n===Bm.L?Object.assign(l,jm(e,t,i,s)):n===Bm.TL?Object.assign(l,function(e,t,r,i,a){void 0===a&&(a=!1);var n=Ym(t,r,i,!0),o=n.x,s=n.y,c=Um(e,t,o-t.width,a);return Object.assign(c,Lm(e,t,s-t.height,a)),c}(e,t,i,a,s)):n===Bm.TR?Object.assign(l,function(e,t,r,i,a){void 0===a&&(a=!1);var n=Ym(t,r,i,!1),o=n.x,s=n.y,c=zm(e,t,o-t.width,a);return Object.assign(c,Lm(e,t,s-t.height,a)),c}(e,t,i,a,s)):n===Bm.BL?Object.assign(l,function(e,t,r,i,a){void 0===a&&(a=!1);var n=Ym(t,r,i,!1),o=n.x,s=n.y,c=Um(e,t,o-t.width,a);return Object.assign(c,Nm(e,t,s-t.height,a)),c}(e,t,i,a,s)):n===Bm.BR&&Object.assign(l,function(e,t,r,i,a){void 0===a&&(a=!1);var n=Ym(t,r,i,!0),o=n.x,s=n.y,c=zm(e,t,o-t.width,a);return Object.assign(c,Nm(e,t,s-t.height,a)),c}(e,t,i,a,s)):(n===Bm.T||n===Bm.TL||n===Bm.TR?Object.assign(l,Lm(e,t,a,s)):n!==Bm.B&&n!==Bm.BL&&n!==Bm.BR||Object.assign(l,Nm(e,t,a,s)),n===Bm.L||n===Bm.TL||n===Bm.BL?Object.assign(l,Um(e,t,i,s)):n!==Bm.R&&n!==Bm.TR&&n!==Bm.BR||Object.assign(l,zm(e,t,i,s))),c&&(l.width="auto"),u&&(l.height="auto"),e.updateStyle(l)},r.operateMultiAr=function(e,t,r,i,a,n,o,s,c,u,l,h){void 0===u&&(u=!1),void 0===l&&(l=!1),void 0===h&&(h=!1);var d={left:r.left,right:r.right,top:r.top,bottom:r.bottom,width:r.width,height:r.height,scaleX:r.scaleX,scaleY:r.scaleY};if(n===Bm.T)Object.assign(d,Zm(e,t,a,o,s,c,u));else if(n===Bm.R)Object.assign(d,tp(e,t,i,o,s,c,u));else if(n===Bm.B)Object.assign(d,Jm(e,t,a,o,s,c,u));else if(n===Bm.L)Object.assign(d,ep(e,t,i,o,s,c,u));else{if(c){var f={width:s.w,height:s.h},m=Ym(f,i,a,[Bm.TL,Bm.BR].includes(n)),p=m.x,g=m.y;i=p-f.width,a=g-f.height}n===Bm.TL?Object.assign(d,function(e,t,r,i,a,n,o,s){void 0===o&&(o=!1),void 0===s&&(s=!1);var c=ep(e,t,r,a,n,o,s);if(s)return c;if(o)rp(e,t,i,a,n,c);else{var u=Zm(e,t,i,a,n,o,s);Object.assign(c,u)}return c}(e,t,i,a,o,s,c,u)):n===Bm.TR?Object.assign(d,function(e,t,r,i,a,n,o,s){void 0===o&&(o=!1),void 0===s&&(s=!1);var c=tp(e,t,r,a,n,o,s);if(s)return c;if(o)rp(e,t,i,a,n,c);else{var u=Zm(e,t,i,a,n,o,s);Object.assign(c,u)}return c}(e,t,i,a,o,s,c,u)):n===Bm.BL?Object.assign(d,function(e,t,r,i,a,n,o,s){void 0===o&&(o=!1),void 0===s&&(s=!1);var c=ep(e,t,r,a,n,o,s);if(s)return c;if(o)ip(e,t,i,a,n,c);else{var u=Jm(e,t,i,a,n,o,s);Object.assign(c,u)}return c}(e,t,i,a,o,s,c,u)):n===Bm.BR&&Object.assign(d,function(e,t,r,i,a,n,o,s){void 0===o&&(o=!1),void 0===s&&(s=!1);var c=tp(e,t,r,a,n,o,s);if(s)return c;if(o)ip(e,t,i,a,n,c);else{var u=Jm(e,t,i,a,n,o,s);Object.assign(c,u)}return c}(e,t,i,a,o,s,c,u))}l&&(d.width="auto"),h&&(d.height="auto"),e.updateStyle(d)},r}(Pm);var np=function(e){function r(t,r){var i=e.call(this,t)||this;return i.data=r,i}return t(r,e),r.prototype.execute=function(){var e=this.nodes,t=this.data;e.forEach(function(e,r){e.updateStyle(t[r].next)})},r.prototype.undo=function(){var e=this.nodes,t=this.data;e.forEach(function(e,r){e.updateStyle(t[r].prev)})},r}(Pm),op=function(e){function r(t,r){return e.call(this,t,r)||this}return t(r,e),r}(np);function sp(e,t,r){for(var i=e.children,a=i.length-1;a>=0;a--){var n=i[a],o=n.matrixWorld;if(n.hasContent&&n.computedStyle.visibility!==te.HIDDEN&&n.computedStyle.pointerEvents){var s=n._rect||n.rect;if(gr(t,r,s[0],s[1],s[2],s[3],o,!0)){if(n instanceof Ba){var c;if(c=sp(n,t,r))return c}else{var u=n.prev;if(u&&cp(u,t,r))return u}return n}if(n instanceof Ba&&(c=sp(n,t,r)))return c}}}function cp(e,t,r){var i=e.computedStyle;if(i.maskMode!==$.NONE&&i.pointerEvents){var a=e._rect||e.rect,n=e.matrixWorld;return gr(t,r,a[0],a[1],a[2],a[3],n,!0)}return!1}function up(e,t,r,i){return sp(e,t,r)}var lp=function(e){function r(t,r){var i=e.call(this,t)||this;return i.data=r,i}return t(r,e),r.prototype.execute=function(){var e=this.nodes,t=this.data;e.forEach(function(e,r){e.beforeEdit(),e.cursor=t[r].next.cursor,e.content=t[r].next.content,e.rich=t[r].next.rich,e.afterEdit()})},r.prototype.undo=function(){var e=this.nodes,t=this.data;e.forEach(function(e,r){e.beforeEdit(),e.cursor=t[r].prev.cursor,e.content=t[r].prev.content,e.rich=t[r].prev.rich,e.afterEdit()})},r}(Pm),hp=function(){function e(e,t,r){var i=this;this.root=e,this.dom=t,this.listener=r,this.ignoreBlur=[],this.ignoreBlurUnFocus=[],this.hasBlur=!0;var a=this.containerEl=document.createElement("div");a.className="input",a.style.position="absolute",a.style.pointerEvents="none",a.style.opacity="0",t.appendChild(a);var n=this.inputEl=document.createElement("input");n.style.position="absolute",n.style.left="0px",n.style.top="0px",n.style.width="10px",n.style.height="100%",n.style.boxSizing="content-box",n.style.border="none",n.style.pointerEvents="none",n.style.opacity="0",n.type="text",n.autocomplete="off",n.spellcheck=!1,a.appendChild(n);var o=function(e){if(i.node){var t=i.node.content,a=i.node.getRich(),o=i.node.getCursor();e(),i.updateCursor(),i.showCursor(),n.value="",i.listener.select.updateSelect([i.node]),r.emit([Mm,_m],[i.node]),i.listener.history.addCommand(new lp([i.node],[{prev:{content:t,rich:a,cursor:o},next:{content:i.node.content,rich:i.node.getRich(),cursor:i.node.getCursor()}}]),i.hasBlur),i.hasBlur=!1}},s=function(e){e&&o(function(){var t;null===(t=i.node)||void 0===t||t.input(e)})},c=!1;n.addEventListener("keydown",function(e){var t=e.keyCode,a=e.code;if(i.node)if(13===t||"Enter"===a)o(function(){var e;null===(e=i.node)||void 0===e||e.enter()});else if(8===t||46===t||"Backspace"===a||"Delete"===a)e.stopPropagation(),c||o(function(){var e;null===(e=i.node)||void 0===e||e.delete(46===t||"Delete"===a)});else if((t>=37&&t<=40||["ArrowUp","ArrowRight","ArrowDown","ArrowLeft"].includes(a))&&(e.stopPropagation(),!c)){var n=i.node.moveCursor(t,e.shiftKey);e.shiftKey?i.hideCursor():(i.showCursor(),i.updateCursor(n)),r.emit(_m,[i.node])}}),n.addEventListener("input",function(e){if(!c){var t=e.data;t&&s(t)}}),n.addEventListener("paste",function(e){var t;e.stopPropagation(),null===(t=e.clipboardData)||void 0===t||t.getData("text")}),n.addEventListener("compositionstart",function(e){c=!0}),n.addEventListener("compositionend",function(e){c=!1;var t=e.data;t&&s(t)});var u=this.cursorEl=document.createElement("div");u.style.position="absolute",u.style.left="0px",u.style.top="0px",u.style.width="10px",u.style.height="100%",u.style.borderLeft="1px solid #000",u.style.pointerEvents="none",a.appendChild(u),u.animate([{visibility:"visible",borderColor:"#000"},{visibility:"visible",borderColor:"#FFF"},{visibility:"hidden"},{visibility:"hidden"}],{duration:800,iterations:1/0}),this.onClick=function(e){if(r.state===Am.EDIT_TEXT){for(var t=e.target,a=t;a;){if(i.ignoreBlurUnFocus.includes(a))return;if(a===r.dom||i.ignoreBlur.includes(a))return void(["INPUT","SELECT","TEXTAREA"].includes(t.tagName.toUpperCase())||i.focus());a=a.parentElement}var n=i.node;r.cancelEditText(),n.resetCursor(),n.afterEdit(),n.inputStyle=void 0}},document.addEventListener("click",this.onClick)}return e.prototype.show=function(e,t,r){this.node=e,this.update(t,r),this.focus(),this.showCursor()},e.prototype.update=function(e,t){var r=this.node.setCursorStartByAbsCoords(e,t);this.updateCursor(r)},e.prototype.hide=function(){if(this.hideCursor(),this.blur(),this.node){if(!this.node.content.length){var e=this.listener.history.commands[0];e&&e instanceof lp&&e.nodes[0]===this.node&&e.undo(),this.listener.removeNode()}this.node=void 0}},e.prototype.focus=function(){this.inputEl.focus()},e.prototype.blur=function(){this.inputEl.blur(),this.hasBlur=!0},e.prototype.showCursor=function(){this.containerEl.style.opacity="1"},e.prototype.hideCursor=function(){this.containerEl.style.opacity="0"},e.prototype.updateCursor=function(e){if(e=e||this.node.getCursorAbsCoords()){var t=this.node.root.canvas;this.containerEl.style.left=e.x*t.clientWidth/t.width+"px",this.containerEl.style.top=e.y*t.clientWidth/t.width+"px",this.containerEl.style.height=e.h*t.clientWidth/t.width+"px"}},e.prototype.release=function(){this.containerEl.remove(),document.removeEventListener("click",this.onClick)},e}(),dp="undefined"!=typeof navigator&&/win/i.test(navigator.platform),fp=function(e){function r(t,r,i){var a=e.call(this)||this;return a.root=t,a.dom=r,a.options=i,a.state=wm.NORMAL,a.isMouseDown=!1,a.isMouseMove=!1,a.originX=0,a.originY=0,a.startX=0,a.startY=0,a.centerX=0,a.centerY=0,a.metaKey=!1,a.shiftKey=!1,a.ctrlKey=!1,a.altKey=!1,a.eventListenerList=[{type:"mousedown",cb:a.onMouseDown.bind(a)},{type:"mousemove",cb:a.onMouseMove.bind(a)},{type:"mouseup",cb:a.onMouseUp.bind(a)},{type:"dblclick",cb:a.onDblClick.bind(a)},{type:"keydown",cb:a.onKeyDown.bind(a)},{type:"keyup",cb:a.onKeyUp.bind(a)}],a.eventListenerList.forEach(function(e){"keydown"===e.type||"keyup"===e.type?document.addEventListener(e.type,e.cb):r.addEventListener(e.type,e.cb)}),a.history=new Dm,a.selected=[],a.select=new Em(t,r),a.computedStyle=[],a.originStyle=[],a.cssStyle=[],a.input=new hp(t,r,a),a.dx=0,a.dy=0,a.isControl=!1,a.isRotate=!1,a.controlType=Bm.T,a}return t(r,e),r.prototype.updateOrigin=function(){var e=this.dom.getBoundingClientRect();this.originX=e.left,this.originY=e.top},r.prototype.prepare=function(){var e=this.selected;this.computedStyle=e.map(function(e){return e.getComputedStyle()}),this.originStyle=e.map(function(e){return e.getStyle()})},r.prototype.getNode=function(e,t){return this.metaKey||dp&&this.ctrlKey,up(this.root,e,t)},r.prototype.onMouseDown=function(e){var t,r;if(0===e.button){var i=this.selected;this.isMouseDown=!0,this.updateOrigin(),this.startX=e.clientX-this.originX,this.startY=e.clientY-this.originY;var a=this.root.canvas,n=this.startX*a.width/a.clientWidth,o=this.startY*a.height/a.clientHeight,s=e.target;if(this.isControl=this.select.isSelectControlDom(s)){this.state===wm.EDIT_TEXT&&this.cancelEditText();var c=this.controlType={t:Bm.T,r:Bm.R,b:Bm.B,l:Bm.L,tl:Bm.TL,tr:Bm.TR,bl:Bm.BL,br:Bm.BR}[s.className];this.prepare();var u=this.metaKey||dp&&this.ctrlKey;if(!(null===(r=null===(t=this.options)||void 0===t?void 0:t.disabled)||void 0===r?void 0:r.rotate)&&1===i.length&&u&&[Bm.TL,Bm.TR,Bm.BL,Bm.BR].indexOf(c)>-1){var l=i[0].getBoundingClientRect().points,h=cr(l[0].x,l[0].y,l[2].x,l[2].y,l[1].x,l[1].y,l[3].x,l[3].y);this.centerX=h.x*a.clientWidth/a.width,this.centerY=h.y*a.clientHeight/a.height,this.isRotate=!0}else this.beforeResize()}else{var d=this.getNode(n,o),f=i.slice(0);if(d){if((h=i.indexOf(d))>-1){if(this.state===wm.EDIT_TEXT){var m=d;if(this.shiftKey)m.setCursorEndByAbsCoords(n,o),m.inputStyle=void 0,this.input.hideCursor();else{var p=m.cursor,g=p.isMulti,v=p.startLineBox,y=p.startTextBox,b=p.startString;m.resetCursor();var x=m.setCursorStartByAbsCoords(n,o);if(this.input.updateCursor(x),this.input.showCursor(),m.cursor.isMulti===g&&m.cursor.startLineBox===v&&m.cursor.startTextBox===y&&m.cursor.startString===b)return}return void this.emit(_m,[m])}}else{if(this.state===wm.EDIT_TEXT)return void this.cancelEditText(f[0]);if(this.shiftKey)for(var T=i.length-1;T>=0;T--){var w=i[T];if(d.isParent(w))i.splice(T,1);else if(d.isChild(w))return}else i.splice(0);i.push(d)}}else{if(this.state===wm.EDIT_TEXT)return void this.cancelEditText(f[0]);i.splice(0)}this.updateActive(!0)}}},r.prototype.onMouseMove=function(e){var t=this,r=this.root.canvas,i=e.clientX-this.originX-this.startX,a=e.clientY-this.originY-this.startY,n=this.dx=i*r.width/r.clientWidth,o=this.dy=a*r.height/r.clientHeight,s=this.selected;if(this.isControl){if(Math.abs(i)<=1&&Math.abs(a)<=1&&!this.isMouseMove)return;if(this.isRotate){var c=this.centerX,u=this.centerY,l=this.startX,h=this.startY,d=e.clientX-this.originX,f=e.clientY-this.originY,m=mr(yr(Math.sqrt(Math.pow(l-d,2)+Math.pow(h-f,2)),Math.sqrt(Math.pow(c-d,2)+Math.pow(u-f,2)),Math.sqrt(Math.pow(l-c,2)+Math.pow(h-u,2)))),p=qe(l-c,h-u,d-c,f-u);if(this.shiftKey)for(var g=0;g<=180;g+=15)if(Math.abs(m-g)<=7.5){m=g;break}var v=s[0],y=(this.computedStyle[0].rotateZ+m*(p>=0?1:-1))%360;v.updateStyle({rotateZ:y}),this.select.updateSelect(s),this.emit(Rm.ROTATE,s.slice(0))}else{var b=this.shiftKey,x=this.altKey,T=this.controlType;s.forEach(function(e,r){t.isMouseMove||(e.startSizeChange(),t.computedStyle[r]=e.getComputedStyle(),t.cssStyle[r]=e.getCssStyle());var i=t.computedStyle[r],a=t.cssStyle[r];t.selectRect&&t.clientRect&&t.clientRect[r]?ap.operateMultiAr(e,i,a,n,o,T,t.clientRect[r],t.selectRect,b,x):ap.operate(e,i,a,n,o,T,b,x)}),this.select.updateSelect(s),this.emit(Rm.RESIZE,s.slice(0))}this.isMouseMove=!0}else if(this.isMouseDown){if(Math.abs(i)<=1&&Math.abs(a)<=1&&!this.isMouseMove)return;if(this.isMouseMove=!0,this.state===wm.EDIT_TEXT){var w=(e.clientX-this.originX)*r.width/r.clientWidth,k=(e.clientY-this.originY)*r.height/r.clientHeight,S=s[0],E=S.cursor,C=E.isMulti,A=E.start,_=E.end;S.setCursorEndByAbsCoords(w,k),this.input.hideCursor();var M=S.cursor;C===M.isMulti&&A===M.start&&_===M.end||this.emit(_m,s.slice(0))}else this.select.select.classList.add("move"),this.shiftKey&&(Math.abs(n)>=Math.abs(o)?this.dy=a=o=0:this.dx=i=n=0),s.forEach(function(e,r){var i=t.computedStyle[r];Om.operate(e,i,n,o)}),this.select.updateSelect(s),this.emit(Rm.MOVE,s.slice(0))}},r.prototype.onMouseUp=function(){var e=this,t=this.selected,r=this.dx,i=this.dy;if(this.isControl){if(this.isRotate){var a=t[0];(r||i)&&this.history.addCommand(new op([a],[{prev:{rotateZ:this.computedStyle[0].rotateZ},next:{rotateZ:a.computedStyle.rotateZ}}]),!0)}else if(this.isMouseMove){var n=this.shiftKey,o=this.altKey,s=this.controlType,c=[];t.forEach(function(t,a){if(t.endSizeChange(e.originStyle[a]),r||i){var u={dx:r,dy:i,controlType:s,aspectRatio:n,clientRect:e.clientRect&&e.clientRect[a],selectRect:e.selectRect,fromCenter:o},l=e.originStyle[a];l.width.u===V.AUTO&&(u.widthFromAuto=!0),l.height.u===V.AUTO&&(u.heightFromAuto=!0),c.push(u)}}),c.length&&this.history.addCommand(new ap(t.slice(0),c))}}else if(this.isMouseMove)if(this.state===wm.EDIT_TEXT){t[0].checkCursorMulti()?this.input.hideCursor():(this.input.updateCursor(),this.input.showCursor()),this.input.focus()}else{this.select.select.classList.remove("move");var u=this.dx,l=this.dy,h=[];t.forEach(function(t,r){(u||l)&&(t.endPosChange(e.originStyle[r],u,l),h.push({dx:u,dy:l}))}),h.length&&this.history.addCommand(new Om(t.slice(0),h),!0)}this.isControl=!1,this.isRotate=!1,this.isMouseDown=!1,this.isMouseMove=!1},r.prototype.onDblClick=function(e){if(0===e.button){var t=this.root.canvas,r=this.startX*t.width/t.clientWidth,i=this.startY*t.height/t.clientHeight,a=this.getNode(r,i);if(1!==this.selected.length||a!==this.selected[0])this.selected.splice(0),a&&this.selected.push(a),this.updateActive(!0);else if(a instanceof om){this.input.show(a,r,i),a.beforeEdit();var n=this.state;this.state=wm.EDIT_TEXT,this.select.select.classList.add("text"),this.emit(Im,n,this.state)}}},r.prototype.onKeyDown=function(e){var t,r,i,a;this.metaKey=e.metaKey,this.altKey=e.altKey,this.ctrlKey=e.ctrlKey,this.shiftKey=e.shiftKey;var n=this.metaKey||dp&&this.ctrlKey;!(null===(a=null===(i=this.options)||void 0===i?void 0:i.disabled)||void 0===a?void 0:a.rotate)&&n&&1===this.selected.length&&this.select.metaKey(!0);var o=e.keyCode,s=e.code,c=e.target,u=["INPUT","TEXTAREA","SELECT"].includes(c.tagName.toUpperCase());if(8===o||46===o||"Backspace"===s||"Delete"===s){if(u)return;this.removeNode()}else if(27===o||"Escape"===s)this.state===wm.EDIT_TEXT?this.cancelEditText():(this.selected.splice(0),this.select.hideSelect(),this.emit(Rm.SELECT,[]));else if(o>=37&&o<=40||["ArrowUp","ArrowRight","ArrowDown","ArrowLeft"].includes(s)){if(u)return;e.preventDefault();var l=0,h=0;37===o?l=this.shiftKey?-10:this.altKey?-.1:-1:38===o?h=this.shiftKey?-10:this.altKey?-.1:-1:39===o?l=this.shiftKey?10:this.altKey?.1:1:40===o&&(h=this.shiftKey?10:this.altKey?.1:1);var d=this.selected.slice(0),f=[];d.forEach(function(e){var t=e.getStyle();Om.operate(e,e.computedStyle,l,h),e.endPosChange(t,l,h),f.push({dx:l,dy:h})}),d.length&&(this.select.updateSelect(d),this.emit(Rm.MOVE,d.slice(0)),this.history.addCommand(new Om(d,f)))}else if(65!==o&&"KeyA"!==s||!n){if((90===o||"KeyZ"===s)&&n){if(u&&c!==this.input.inputEl)return;e.preventDefault();var m=void 0;if(m=this.shiftKey?this.history.redo():this.history.undo()){d=m.nodes.slice(0);var p=this.selected.slice(0),g=!1;if(m instanceof Fm||(this.selected.splice(0),(t=this.selected).push.apply(t,d),this.updateActive(),g=!0),m instanceof Om)this.emit(Rm.MOVE,d.slice(0));else if(m instanceof ap)this.emit(Rm.RESIZE,d.slice(0));else if(m instanceof Fm)this.shiftKey?(this.selected.splice(0),this.select.hideSelect(),this.emit(Rm.REMOVE,d.slice(0)),this.emit(Rm.SELECT,[])):(this.selected.splice(0),(r=this.selected).push.apply(r,d),this.updateActive(),this.emit(Rm.ADD,d.slice(0)),this.emit(Rm.SELECT,d.slice(0)));else if(m instanceof op)this.emit(Rm.ROTATE,d.slice(0));else if(m instanceof lp){if(this.state===wm.EDIT_TEXT){var v=d[0],y=v.getSortedCursor(),b=y.isMulti,x=y.start;if(b)this.input.hideCursor();else{var T=v.updateCursorByIndex(x);this.input.updateCursor(T),this.input.showCursor()}this.input.focus()}this.emit(Mm,d.slice(0))}if(g)if(d.length!==p.length)this.emit(Rm.SELECT,d.slice(0));else for(var w=0,k=d.length;w<k;w++)if(d[w]!==p[w]){this.emit(Rm.SELECT,d.slice(0));break}}}}else this.state===wm.EDIT_TEXT&&c===this.input.inputEl&&(e.preventDefault(),this.input.node.selectAll(),this.input.hideCursor())},r.prototype.onKeyUp=function(e){var t,r;this.metaKey=e.metaKey,this.altKey=e.altKey,this.ctrlKey=e.ctrlKey,this.shiftKey=e.shiftKey;var i=this.metaKey||dp&&this.ctrlKey;(null===(r=null===(t=this.options)||void 0===t?void 0:t.disabled)||void 0===r?void 0:r.rotate)||i||this.isRotate||this.select.metaKey(!1)},r.prototype.removeNode=function(e){if(void 0===e&&(e=this.selected),e.length){var t=e.splice(0).filter(function(e){return!e.isLocked}),r=[];e.forEach(function(e,t){var i=Fm.operate(e);r.push(i)}),this.select.hideSelect(),this.history.addCommand(new Fm(t,r)),this.emit(Rm.REMOVE,t.slice(0)),this.emit(Rm.SELECT,[])}},r.prototype.active=function(e){var t=this.selected,r=!1;if(e.length!==t.length)r=!0;else for(var i=0,a=e.length;i<a;i++)if(e[i]!==t[i]){r=!0;break}r&&(t.splice(0),t.push.apply(t,e),this.updateActive(!0))},r.prototype.updateActive=function(e){void 0===e&&(e=!1),this.prepare();var t=this.selected;t.length?this.select.showSelect(t):this.select.hideSelect(),e&&this.emit(Rm.SELECT,t.slice(0))},r.prototype.beforeResize=function(){this.selected.length>1&&this.shiftKey?(this.selectRect=this.select.getAspectRatio(),this.clientRect=this.selected.map(function(e){var t=e.getBoundingClientRect();return{x:t.left,y:t.top,w:t.width,h:t.height}})):(this.selectRect=void 0,this.clientRect=void 0)},r.prototype.cancelEditText=function(e){if(this.state===wm.EDIT_TEXT){var t=e||this.selected[0];t&&(t.resetCursor(),t.afterEdit(),t.inputStyle=void 0),this.input.hide(),this.state=wm.NORMAL,this.select.select.classList.remove("text"),this.emit(Im,wm.EDIT_TEXT,this.state)}},r.prototype.release=function(){var e=this;this.eventListenerList.splice(0).forEach(function(t){"keydown"===t.type||"keyup"===t.type?document.removeEventListener(t.type,t.cb):e.dom.removeEventListener(t.type,t.cb)}),this.select.release(),this.input.release()},r}(M);return{parser:Da,node:ym,util:km,config:L,style:Sm,interaction:{Listener:fp,interactionEvent:Rm,state:Am,Select:Em,Input:hp},animation:{frame:wf,AbstractAnimation:da,CssAnimation:fa,GifAnimation:Ca,TimeAnimation:Ha,AniController:Ef,animationEvent:ha},math:Ur,history:{History:Dm,AbstractCommand:Pm,MoveCommand:Om,RemoveCommand:Fm,ResizeCommand:ap,RotateCommand:op,TextCommand:lp},refresh:{CanvasCache:xi,TextureCache:Zi,merge:yf},format:P}});
|
|
273
|
+
*/const Id=["video","audio","subtitle"],Rd=e=>{if(!e||"object"!=typeof e)throw new TypeError("metadata must be an object.");if(void 0!==e.languageCode&&!_n(e.languageCode))throw new TypeError("metadata.languageCode, when provided, must be a three-letter, ISO 639-2/T language code.");if(void 0!==e.name&&"string"!=typeof e.name)throw new TypeError("metadata.name, when provided, must be a string.");if(void 0!==e.disposition&&(e=>{if(!e||"object"!=typeof e)throw new TypeError("disposition must be an object.");if(void 0!==e.default&&"boolean"!=typeof e.default)throw new TypeError("disposition.default must be a boolean.");if(void 0!==e.forced&&"boolean"!=typeof e.forced)throw new TypeError("disposition.forced must be a boolean.");if(void 0!==e.original&&"boolean"!=typeof e.original)throw new TypeError("disposition.original must be a boolean.");if(void 0!==e.commentary&&"boolean"!=typeof e.commentary)throw new TypeError("disposition.commentary must be a boolean.");if(void 0!==e.hearingImpaired&&"boolean"!=typeof e.hearingImpaired)throw new TypeError("disposition.hearingImpaired must be a boolean.");if(void 0!==e.visuallyImpaired&&"boolean"!=typeof e.visuallyImpaired)throw new TypeError("disposition.visuallyImpaired must be a boolean.")})(e.disposition),void 0!==e.maximumPacketCount&&(!Number.isInteger(e.maximumPacketCount)||e.maximumPacketCount<0))throw new TypeError("metadata.maximumPacketCount, when provided, must be a non-negative integer.")};class Pd{constructor(e){if(this.state="pending",this._tracks=[],this._startPromise=null,this._cancelPromise=null,this._finalizePromise=null,this._mutex=new hn,this._metadataTags={},!e||"object"!=typeof e)throw new TypeError("options must be an object.");if(!(e.format instanceof yd))throw new TypeError("options.format must be an OutputFormat.");if(!(e.target instanceof ud))throw new TypeError("options.target must be a Target.");if(e.target._output)throw new Error("Target is already used for another output.");e.target._output=this,this.format=e.format,this.target=e.target,this._writer=e.target._createWriter(),this._muxer=e.format._createMuxer(this)}addVideoTrack(e,t={}){if(!(e instanceof Ed))throw new TypeError("source must be a VideoSource.");if(Rd(t),void 0!==t.rotation&&![0,90,180,270].includes(t.rotation))throw new TypeError(`Invalid video rotation: ${t.rotation}. Has to be 0, 90, 180 or 270.`);if(!this.format.supportsVideoRotationMetadata&&t.rotation)throw new Error(`${this.format._name} does not support video rotation metadata.`);if(void 0!==t.frameRate&&(!Number.isFinite(t.frameRate)||t.frameRate<=0))throw new TypeError(`Invalid video frame rate: ${t.frameRate}. Must be a positive number.`);this._addTrack("video",e,t)}addAudioTrack(e,t={}){if(!(e instanceof Ad))throw new TypeError("source must be an AudioSource.");Rd(t),this._addTrack("audio",e,t)}addSubtitleTrack(e,t={}){if(!(e instanceof Md))throw new TypeError("source must be a SubtitleSource.");Rd(t),this._addTrack("subtitle",e,t)}setMetadataTags(e){if((e=>{if(!e||"object"!=typeof e)throw new TypeError("tags must be an object.");if(void 0!==e.title&&"string"!=typeof e.title)throw new TypeError("tags.title, when provided, must be a string.");if(void 0!==e.description&&"string"!=typeof e.description)throw new TypeError("tags.description, when provided, must be a string.");if(void 0!==e.artist&&"string"!=typeof e.artist)throw new TypeError("tags.artist, when provided, must be a string.");if(void 0!==e.album&&"string"!=typeof e.album)throw new TypeError("tags.album, when provided, must be a string.");if(void 0!==e.albumArtist&&"string"!=typeof e.albumArtist)throw new TypeError("tags.albumArtist, when provided, must be a string.");if(void 0!==e.trackNumber&&(!Number.isInteger(e.trackNumber)||e.trackNumber<=0))throw new TypeError("tags.trackNumber, when provided, must be a positive integer.");if(void 0!==e.tracksTotal&&(!Number.isInteger(e.tracksTotal)||e.tracksTotal<=0))throw new TypeError("tags.tracksTotal, when provided, must be a positive integer.");if(void 0!==e.discNumber&&(!Number.isInteger(e.discNumber)||e.discNumber<=0))throw new TypeError("tags.discNumber, when provided, must be a positive integer.");if(void 0!==e.discsTotal&&(!Number.isInteger(e.discsTotal)||e.discsTotal<=0))throw new TypeError("tags.discsTotal, when provided, must be a positive integer.");if(void 0!==e.genre&&"string"!=typeof e.genre)throw new TypeError("tags.genre, when provided, must be a string.");if(void 0!==e.date&&(!(e.date instanceof Date)||Number.isNaN(e.date.getTime())))throw new TypeError("tags.date, when provided, must be a valid Date.");if(void 0!==e.lyrics&&"string"!=typeof e.lyrics)throw new TypeError("tags.lyrics, when provided, must be a string.");if(void 0!==e.images){if(!Array.isArray(e.images))throw new TypeError("tags.images, when provided, must be an array.");for(const t of e.images){if(!t||"object"!=typeof t)throw new TypeError("Each image in tags.images must be an object.");if(!(t.data instanceof Uint8Array))throw new TypeError("Each image.data must be a Uint8Array.");if("string"!=typeof t.mimeType)throw new TypeError("Each image.mimeType must be a string.");if(!["coverFront","coverBack","unknown"].includes(t.kind))throw new TypeError("Each image.kind must be 'coverFront', 'coverBack', or 'unknown'.")}}if(void 0!==e.comment&&"string"!=typeof e.comment)throw new TypeError("tags.comment, when provided, must be a string.");if(void 0!==e.raw){if(!e.raw||"object"!=typeof e.raw)throw new TypeError("tags.raw, when provided, must be an object.");for(const t of Object.values(e.raw))if(!(null===t||"string"==typeof t||t instanceof Uint8Array||t instanceof qn||t instanceof Kn))throw new TypeError("Each value in tags.raw must be a string, Uint8Array, RichImageData, AttachedFile, or null.")}})(e),"pending"!==this.state)throw new Error("Cannot set metadata tags after output has been started or canceled.");this._metadataTags=e}_addTrack(e,t,r){if("pending"!==this.state)throw new Error("Cannot add track after output has been started or canceled.");if(t._connectedTrack)throw new Error("Source is already used for a track.");const i=this.format.getSupportedTrackCounts(),a=this._tracks.reduce((t,r)=>t+(r.type===e?1:0),0),n=i[e].max;if(a===n)throw new Error(0===n?`${this.format._name} does not support ${e} tracks.`:`${this.format._name} does not support more than ${n} ${e} track`+(1===n?"":"s")+".");const o=i.total.max;if(this._tracks.length===o)throw new Error(`${this.format._name} does not support more than ${o} tracks`+(1===o?"":"s")+" in total.");const s={id:this._tracks.length+1,output:this,type:e,source:t,metadata:r};if("video"===s.type){const e=this.format.getSupportedVideoCodecs();if(0===e.length)throw new Error(`${this.format._name} does not support video tracks.`+this.format._codecUnsupportedHint(s.source._codec));if(!e.includes(s.source._codec))throw new Error(`Codec '${s.source._codec}' cannot be contained within ${this.format._name}. Supported video codecs are: ${e.map(e=>`'${e}'`).join(", ")}.`+this.format._codecUnsupportedHint(s.source._codec))}else if("audio"===s.type){const e=this.format.getSupportedAudioCodecs();if(0===e.length)throw new Error(`${this.format._name} does not support audio tracks.`+this.format._codecUnsupportedHint(s.source._codec));if(!e.includes(s.source._codec))throw new Error(`Codec '${s.source._codec}' cannot be contained within ${this.format._name}. Supported audio codecs are: ${e.map(e=>`'${e}'`).join(", ")}.`+this.format._codecUnsupportedHint(s.source._codec))}else if("subtitle"===s.type){const e=this.format.getSupportedSubtitleCodecs();if(0===e.length)throw new Error(`${this.format._name} does not support subtitle tracks.`+this.format._codecUnsupportedHint(s.source._codec));if(!e.includes(s.source._codec))throw new Error(`Codec '${s.source._codec}' cannot be contained within ${this.format._name}. Supported subtitle codecs are: ${e.map(e=>`'${e}'`).join(", ")}.`+this.format._codecUnsupportedHint(s.source._codec))}this._tracks.push(s),t._connectedTrack=s}async start(){const e=this.format.getSupportedTrackCounts();for(const t of Id){const r=this._tracks.reduce((e,r)=>e+(r.type===t?1:0),0),i=e[t].min;if(r<i)throw new Error(i===e[t].max?`${this.format._name} requires exactly ${i} ${t} track${1===i?"":"s"}.`:`${this.format._name} requires at least ${i} ${t} track${1===i?"":"s"}.`)}const t=e.total.min;if(this._tracks.length<t)throw new Error(t===e.total.max?`${this.format._name} requires exactly ${t} track`+(1===t?"":"s")+".":`${this.format._name} requires at least ${t} track`+(1===t?"":"s")+".");if("canceled"===this.state)throw new Error("Output has been canceled.");return this._startPromise?(console.warn("Output has already been started."),this._startPromise):this._startPromise=(async()=>{this.state="started",this._writer.start();const e=await this._mutex.acquire();await this._muxer.start();const t=this._tracks.map(e=>e.source._start());await Promise.all(t),e()})()}getMimeType(){return this._muxer.getMimeType()}async cancel(){return this._cancelPromise?(console.warn("Output has already been canceled."),this._cancelPromise):"finalizing"!==this.state&&"finalized"!==this.state?this._cancelPromise=(async()=>{this.state="canceled";const e=await this._mutex.acquire(),t=this._tracks.map(e=>e.source._flushOrWaitForOngoingClose(!0));await Promise.all(t),await this._writer.close(),e()})():void console.warn("Output has already been finalized.")}async finalize(){if("pending"===this.state)throw new Error("Cannot finalize before starting.");if("canceled"===this.state)throw new Error("Cannot finalize after canceling.");return this._finalizePromise?(console.warn("Output has already been finalized."),this._finalizePromise):this._finalizePromise=(async()=>{this.state="finalizing";const e=await this._mutex.acquire(),t=this._tracks.map(e=>e.source._flushOrWaitForOngoingClose(!1));await Promise.all(t),await this._muxer.finalize(),await this._writer.flush(),await this._writer.finalize(),this.state="finalized",e()})()}}var Od="VideoRange";function Dd(){return i(this,void 0,void 0,function(){return a(this,function(e){return[2,new Promise(function(e,t){var r=indexedDB.open("VideoEditorDB",1);r.onupgradeneeded=function(e){var t=e.target.result;t.objectStoreNames.contains(Od)||t.createObjectStore(Od,{keyPath:"id"})},r.onsuccess=function(){e(r.result)},r.onerror=function(){t("IndexedDB Error: ".concat(r.error))}})]})})}function Bd(e){return new Promise(function(t,r){e.onsuccess=function(){return t(e.result)},e.onerror=function(){return r(e.error)}})}function Fd(e){return new Promise(function(t,r){e.oncomplete=function(){return t(void 0)},e.onerror=function(){return r(e.error)}})}function Ld(e,t){return i(this,void 0,void 0,function(){var r;return a(this,function(i){switch(i.label){case 0:return t?[3,2]:[4,Dd()];case 1:t=i.sent(),i.label=2;case 2:return r=t.transaction(Od,"readonly"),[2,Bd(r.objectStore(Od).get(e))]}})})}function Nd(e,t){return i(this,void 0,void 0,function(){var r;return a(this,function(i){switch(i.label){case 0:return t?[3,2]:[4,Dd()];case 1:t=i.sent(),i.label=2;case 2:return r=t.transaction(Od,"readwrite"),[4,Bd(r.objectStore(Od).put(e))];case 3:return i.sent(),[4,Fd(r)];case 4:return i.sent(),[2]}})})}var Ud,zd,Wd,Vd=4194304;function Hd(e,t,n,o,s){return i(this,void 0,void 0,function(){var c,u,l,h,d,f,m,p,g,v,y,b;return a(this,function(x){switch(x.label){case 0:return(null==s?void 0:s.indexedDB)?[3,4]:[4,fetch(e,r(r({},s),{cache:"force-cache",headers:{"Cache-Control":"max-age=31536000",Range:"bytes=".concat(t,"-").concat(n)}}))];case 1:return 206!==(c=x.sent()).status?[3,3]:[4,c.arrayBuffer()];case 2:return[2,{status:206,arrayBuffer:x.sent()}];case 3:return[2,{status:c.status}];case 4:for(u=[],l=Vd*Math.floor(t/Vd),h=l;l<=n;)d=Math.min(o-1,l+Vd-1),u.push([l,d]),l=d+1;return[4,Dd()];case 5:return f=x.sent(),[4,Promise.all(u.map(function(t){return function(e,t,n,o,s){return i(this,void 0,void 0,function(){var i,c,u,l;return a(this,function(a){switch(a.label){case 0:return[4,Ld(i=e+":"+t+"-"+n,o)];case 1:return(c=a.sent())?[2,{status:206,arrayBuffer:c.arrayBuffer}]:[4,fetch(e,r(r({},s),{cache:"force-cache",headers:{"Cache-Control":"max-age=31536000",Range:"bytes=".concat(t,"-").concat(n)}}))];case 2:return 206!==(u=a.sent()).status?[3,5]:[4,u.arrayBuffer()];case 3:return l=a.sent(),[4,Nd({id:i,arrayBuffer:l})];case 4:return a.sent(),[2,{status:206,arrayBuffer:l}];case 5:return[2,{status:u.status}]}})})}(e,t[0],t[1],f,s)}))];case 6:for(m=x.sent(),p=new Uint8Array(u.length*Vd*8),g=0,v=m.length;g<v;g++){if(206!==(y=m[g]).status)return[2,{status:y.status}];b=new Uint8Array(y.arrayBuffer),p.set(b,g*Vd)}return[2,{status:206,arrayBuffer:p.buffer.slice(t-h,n-h+1)}]}})})}function Xd(e){return i(this,void 0,void 0,function(){return a(this,function(t){return[2,new Promise(function(t){return setTimeout(t,e)})]})})}!function(e){e[e.META=0]="META",e[e.DECODE=1]="DECODE",e[e.RELEASE=2]="RELEASE"}(Ud||(Ud={})),function(e){e.META="meta",e.ERROR="error",e.DECODED="decoded"}(zd||(zd={})),function(e){e[e.NONE=0]="NONE",e[e.DECODING=1]="DECODING",e[e.DECODED=2]="DECODED",e[e.DECODED_FRAME=3]="DECODED_FRAME",e[e.ERROR=4]="ERROR"}(Wd||(Wd={}));var jd,Gd,Yd={},qd=function(e){return i(void 0,void 0,void 0,function(){var t,r,n,s,c,u,l,h,d,f,m,p,g,v,y,b,x,T,w,k,S,E,C,A,_,M,I,R,P,O,D,B,F,L,N,U,z,W,V,H,X,j,G,Y,q,K,$,Q,Z,J,ee,te,re,ie,ae,ne,oe,se,ce,ue,le,he,de,fe,me,pe,ge,ve,ye,be,xe,Te,we,ke,Se,Ee,Ce,Ae,_e,Me,Ie;return a(this,function(Re){switch(Re.label){case 0:return t=e.data,r=t.url,n=t.id,s=t.type,c=t.isWorker,u=function(e){var t={url:r,type:zd.ERROR,data:e};return c&&self.postMessage(t),{data:t}},Yd[r]||(Yd[r]={gopList:[]}),l=Yd[r],s!==Ud.META?[3,38]:[4,fetch(r,{method:"HEAD"})];case 1:if(h=Re.sent(),!(d=h.headers.get("content-length"))||200!==h.status&&304!==h.status)return[2,u("Unknown content-length")];f=parseInt(d),m={duration:0,fileSize:f},p=void 0,p=e.data.preloadAll?new Zu(r):new Ju({read:function(t,n){return i(void 0,void 0,void 0,function(){var i;return a(this,function(a){switch(a.label){case 0:return[4,Hd(r,t,n-1,f,{indexedDB:e.data.indexedDB})];case 1:if(!(i=a.sent().arrayBuffer))throw new Error("Missing buffer in range: "+t+"-"+(n-1));return[2,new Uint8Array(i)]}})})},getSize:function(){return i(void 0,void 0,void 0,function(){return a(this,function(e){return[2,f]})})},prefetchProfile:"network"}),g=new rl({formats:qu,source:p}),Re.label=2;case 2:return Re.trys.push([2,4,,5]),[4,g.computeDuration()];case 3:return v=Re.sent(),m.duration=1e3*v,[3,5];case 4:return y=Re.sent(),[2,u(y.message)];case 5:return[4,g.getPrimaryVideoTrack()];case 6:return(b=Re.sent())?(l.videoTrack=b,[4,b.computeDuration()]):[3,21];case 7:oe=Re.sent(),K=new Ps(b),Re.label=8;case 8:Re.trys.push([8,13,14,19]),x=!0,T=o(K.packets(void 0,void 0,{metadataOnly:!0})),Re.label=9;case 9:return[4,T.next()];case 10:if(w=Re.sent(),pe=w.done)return[3,12];if(ye=w.value,x=!1,"key"===(O=ye).type){if(k=l.gopList.length){if(N=l.gopList[k-1],e.data.gopMinDuration&&1e3*O.timestamp-N.timestamp<e.data.gopMinDuration)return[3,11];N.duration=N.audioDuration=1e3*O.timestamp-N.timestamp}l.gopList.push({state:Wd.NONE,index:l.gopList.length,sequenceNumber:O.sequenceNumber,timestamp:1e3*O.timestamp,duration:1e3*O.duration,audioTimestamp:1e3*O.timestamp,audioDuration:1e3*O.duration,users:[]})}Re.label=11;case 11:return x=!0,[3,9];case 12:return[3,19];case 13:return S=Re.sent(),ge={error:S},[3,19];case 14:return Re.trys.push([14,,17,18]),x||pe||!(ve=T.return)?[3,16]:[4,ve.call(T)];case 15:Re.sent(),Re.label=16;case 16:return[3,18];case 17:if(ge)throw ge.error;return[7];case 18:return[7];case 19:return(L=l.gopList.length)&&((N=l.gopList[L-1]).duration=N.audioDuration=1e3*oe-N.timestamp),[4,b.getFirstTimestamp()];case 20:ne=Re.sent(),m.video={id:b.id,languageCode:b.languageCode,codec:b.codec,name:b.name,codedWidth:b.codedWidth,codedHeight:b.codedHeight,displayWidth:b.displayWidth,displayHeight:b.displayHeight,width:b.displayWidth,height:b.displayHeight,timeResolution:b.timeResolution,rotation:b.rotation,timestamp:1e3*ne,duration:1e3*oe},Re.label=21;case 21:return[4,g.getPrimaryAudioTrack()];case 22:return(E=Re.sent())?(l.audioTrack=E,[4,E.computeDuration()]):[3,37];case 23:return oe=Re.sent(),[4,E.getFirstTimestamp()];case 24:if(ne=Re.sent(),m.audio={id:E.id,languageCode:E.languageCode,codec:E.codec,name:E.name,numberOfChannels:E.numberOfChannels,sampleRate:E.sampleRate,timestamp:1e3*ne,duration:1e3*oe},b)return[3,37];C=e.data.gopMinDuration||5e3,K=new Ps(E),A=-1,_=!0,M=0,Re.label=25;case 25:Re.trys.push([25,30,31,36]),I=!0,R=o(K.packets(void 0,void 0,{metadataOnly:!0})),Re.label=26;case 26:return[4,R.next()];case 27:if(P=Re.sent(),be=P.done)return[3,29];we=P.value,I=!1,O=we,-1===A&&(A=O.timestamp),D=O.timestamp-A,(_||1e3*D>=C)&&(_=!1,(B=l.gopList.length)&&((N=l.gopList[B-1]).duration=N.audioDuration=1e3*O.timestamp-N.timestamp),l.gopList.push({state:Wd.NONE,index:l.gopList.length,sequenceNumber:M,timestamp:1e3*O.timestamp,duration:1e3*O.duration,audioTimestamp:1e3*O.timestamp,audioDuration:1e3*O.duration,users:[]}),A=O.timestamp),M++,Re.label=28;case 28:return I=!0,[3,26];case 29:return[3,36];case 30:return F=Re.sent(),xe={error:F},[3,36];case 31:return Re.trys.push([31,,34,35]),I||be||!(Te=R.return)?[3,33]:[4,Te.call(R)];case 32:Re.sent(),Re.label=33;case 33:return[3,35];case 34:if(xe)throw xe.error;return[7];case 35:return[7];case 36:(L=l.gopList.length)&&((N=l.gopList[L-1]).duration=N.audioDuration=1e3*oe-N.timestamp),Re.label=37;case 37:return U=l.gopList.map(function(e){return{index:e.index,sequenceNumber:e.sequenceNumber,timestamp:e.timestamp,duration:e.duration,audioTimestamp:e.audioTimestamp,audioDuration:e.audioDuration}}),de={url:r,type:zd.META,data:{meta:m,simpleGOPList:U}},c&&self.postMessage(de),[2,{data:de}];case 38:return s!==Ud.DECODE?[3,64]:(fe=l.gopList[e.data.index])&&fe.state!==Wd.ERROR?fe.state===Wd.DECODED?[2]:(fe.users.includes(n)||fe.users.push(n),[4,Xd(100)]):[2];case 39:if(Re.sent(),!fe.users.includes(n))return[2];if(fe.state===Wd.DECODING||fe.state===Wd.DECODED)return[2];if(fe.state=Wd.DECODING,z=[],!l.videoTrack)return[3,51];K=new Ns(l.videoTrack),Re.label=40;case 40:Re.trys.push([40,45,46,51]),W=!0,V=o(K.samples(.001*fe.timestamp,.001*(fe.timestamp+fe.duration))),Re.label=41;case 41:return[4,V.next()];case 42:if(H=Re.sent(),ke=H.done)return[3,44];Ce=H.value,W=!1,re=Ce,z.push(re.toVideoFrame()),re.close(),Re.label=43;case 43:return W=!0,[3,41];case 44:return[3,51];case 45:return X=Re.sent(),Se={error:X},[3,51];case 46:return Re.trys.push([46,,49,50]),W||ke||!(Ee=V.return)?[3,48]:[4,Ee.call(V)];case 47:Re.sent(),Re.label=48;case 48:return[3,50];case 49:if(Se)throw Se.error;return[7];case 50:return[7];case 51:if(j=[],G=0,Y=-1,q=0,!l.audioTrack||e.data.mute||fe.didAudioChunk)return[3,63];fe.didAudioChunk=!0,K=new Ws(l.audioTrack),$=.001*fe.timestamp,Q=.001*(fe.timestamp+fe.duration),Z=K.samples($,Q),Re.label=52;case 52:Re.trys.push([52,57,58,63]),J=!0,ee=o(Z),Re.label=53;case 53:return[4,ee.next()];case 54:if(te=Re.sent(),Ae=te.done)return[3,56];if(Ie=te.value,J=!1,G=(re=Ie).sampleRate,ie=re.numberOfChannels,ae=re.numberOfFrames,ne=re.timestamp,oe=re.duration,ne>=Q&&fe.index<l.gopList.length-1||ne<$)return[3,55];for(-1===Y&&(Y=1e3*ne),q=1e3*ne-Y+1e3*oe,se=[],ce=0;ce<ie;ce++)ue=new Float32Array(ae),re.copyTo(ue,{planeIndex:ce,format:"f32-planar"}),se.push(ue);j.push({format:"f32-planar",channels:se,sampleRate:G,numberOfFrames:ae,numberOfChannels:ie,timestamp:1e3*ne,duration:1e3*oe}),re.close(),Re.label=55;case 55:return J=!0,[3,53];case 56:return[3,63];case 57:return le=Re.sent(),_e={error:le},[3,63];case 58:return Re.trys.push([58,,61,62]),J||Ae||!(Me=ee.return)?[3,60]:[4,Me.call(ee)];case 59:Re.sent(),Re.label=60;case 60:return[3,62];case 61:if(_e)throw _e.error;return[7];case 62:return[7];case 63:return fe.state!==Wd.DECODING?(fe.didAudioChunk=!1,z.forEach(function(e){e.close()}),[2]):(fe.state=Wd.DECODED,he=[],z.forEach(function(e){return he.push(e)}),j.forEach(function(e){e.channels.forEach(function(e){he.push(e.buffer)})}),de={url:r,type:zd.DECODED,data:{index:e.data.index,videoFrames:z,audioChunks:j,sampleRate:G,audioTimeStamp:Y,audioDuration:q}},c&&self.postMessage(de,he),[2,{data:de}]);case 64:if(s===Ud.RELEASE){if(!(fe=l.gopList[e.data.index]))return[2];(me=fe.users.indexOf(e.data.id))>-1&&fe.users.splice(me,1),fe.users.length||(fe.state=Wd.NONE,fe.didAudioChunk=!1)}Re.label=65;case 65:return[2]}})})};self.onmessage=qd,function(e){e.META="meta",e.LOADED="loaded",e.ERROR="error",e.PROGRESS="progress",e.CANPLAY="canplay",e.AUDIO_BUFFER="audio_buffer"}(jd||(jd={})),function(e){e[e.NONE=0]="NONE",e[e.LOADING_META=1]="LOADING_META",e[e.META=2]="META",e[e.LOADED=3]="LOADED",e[e.ERROR=4]="ERROR"}(Gd||(Gd={}));var Kd,$d={},Qd=0,Zd=0,Jd=function(e){function i(t){var r=e.call(this)||this;return r.url=t,r.id=Qd++,r.currentTime=-1/0,r.gopIndex=-1,r.error=!1,r}return t(i,e),i.prototype.initWorker=function(){if(!Kd){if(L.decoderWorker)Kd=new Worker(L.decoderWorker);else if(L.decoderWorkerStr){var e=new Blob([L.decoderWorkerStr.trim()],{type:"application/javascript"}),t=URL.createObjectURL(e);Kd=new Worker(t)}var i=function(e){var t,i,a;if(null==e?void 0:e.data){var n=e.data,o=n.url,s=n.type,c=n.data,u=$d[o];if(u)if(s===zd.META)u.state=Gd.META,u.meta=c.meta,u.gopList=c.simpleGOPList.map(function(e){return r(r({},e),{state:Wd.NONE,videoFrames:[],users:[]})}),u.metaList.splice(0).forEach(function(e){e.start(e.currentTime),e.emit(jd.META,c.meta)});else if(s===zd.DECODED){var l=u.gopList[c.index];if(l){if(l.state=Wd.DECODED,l.videoFrames.forEach(function(e){return e.close()}),null===(t=l.audioBufferSourceNode)||void 0===t||t.stop(),null===(i=l.audioBufferSourceNode)||void 0===i||i.disconnect(),l.audioBuffer=void 0,l.videoFrames=c.videoFrames,null===(a=c.audioChunks)||void 0===a?void 0:a.length){var h=c.audioChunks.reduce(function(e,t){return e+t.numberOfFrames},0),d=new OfflineAudioContext(c.audioChunks[0].numberOfChannels,h,c.sampleRate).createBuffer(c.audioChunks[0].channels.length,h,c.sampleRate),f=0;c.audioChunks.forEach(function(e){for(var t=0;t<e.channels.length;t++){d.getChannelData(t).set(e.channels[t],f)}f+=e.numberOfFrames}),l.audioBuffer=d}l.users.forEach(function(e){e.gopIndex===l.index&&e.emit(jd.CANPLAY,l),l.audioBuffer&&e.gopIndex<l.index&&e.emit(jd.AUDIO_BUFFER,l)})}}else s===zd.ERROR&&u.metaList.forEach(function(e){e.error=!0,e.emit(jd.ERROR,c)})}};Kd?Kd.onmessage=i:this.onMessage=i}},i.prototype.start=function(e){var t=this;this.initWorker(),this.currentTime,this.currentTime=e;var r=this.url,i=this.id,a=$d[r];if(a)a.state===Gd.LOADING_META?a.metaList.includes(this)||(a.metaList.push(this),a.loadList.push(this),a.count++):a.state===Gd.META?(a.loadList.includes(this)||(a.loadList.push(this),a.count++,this.emit(jd.META,a.meta)),this.process(e)):a.state===Gd.ERROR&&this.emit(jd.ERROR,a.error);else{$d[r]={state:Gd.LOADING_META,metaList:[this],loadList:[this],meta:{duration:0,fileSize:0},gopList:[],singleHash:{},count:1};var n={url:r,id:i,type:Ud.META,messageId:Zd++,isWorker:!!L.decoderWorker||!!L.decoderWorkerStr,indexedDB:L.indexedDB,preloadAll:L.preloadAll,gopMinDuration:L.gopMinDuration};Kd?Kd.postMessage(n):qd({data:n}).then(function(e){t.onMessage&&t.onMessage(e)})}},i.prototype.process=function(e){if(e<-L.decodeNextDuration)this.releaseGOPList();else{var t=$d[this.url];if(t&&t.state!==Gd.NONE&&t.state!==Gd.LOADING_META){var r=t.meta.duration,i=t.gopList;if(i.length)if(e>=r+L.decodeNextDuration)this.releaseGOPList();else{var a=this.getForwardsNearestGOPIndex(e);this.gopIndex=a;var n=i[a];if(n){this.decodeGOP(n);for(var o=a-1;o>=0;o--){var s=i[o];s&&s.timestamp+s.duration<e-L.releasePrevDuration&&this.releaseGOP(s)}o=a+1;for(var c=i.length;o<c;o++){var u=i[o];u&&u.timestamp<e+L.decodeNextDuration?this.decodeGOP(u):u&&u.timestamp>=e+L.decodeNextDuration&&this.releaseGOP(u)}}}}}},i.prototype.getForwardsNearestGOPIndex=function(e){var t=$d[this.url],r=t.meta.duration,i=t.gopList;if(e<-L.decodeNextDuration||!i.length||e>r+.001)return-1;if(1===i.length||e<=0)return 0;if(e>r)return i.length-1;for(var a=0,n=i.length-1;a<n;){if(a===n-1)return i[n].timestamp<=e?n:a;var o=a+(n-a>>1),s=i[o].timestamp;if(s===e)return o;s>e?n=Math.max(o-1,a+1):a=Math.min(o,n-1)}return-1},i.prototype.getFrameByTime=function(e){var t=$d[this.url],r=t.meta.duration,i=t.gopList;if(!(e<0||!i.length||e>r+.001)){var a;if(1===i.length)a=i[0];else(o=this.getForwardsNearestGOPIndex(e))>-1&&(a=i[o]);if(a&&a.state===Wd.DECODED){var n=a.videoFrames;if(!n.length)return;if(1===n.length)return n[0];for(var o=0,s=n.length-1;o<s;){if(o===s-1){var c=n[s];return.001*c.timestamp<=e?c:n[o]}var u=o+(s-o>>1),l=n[u],h=.001*l.timestamp;if(h===e||h<e&&h+.001*(l.duration||0)>e)return n[u];h>e?s=Math.max(u-1,o+1):o=Math.min(u,s-1)}}}},i.prototype.decodeGOP=function(e){var t=this;if(e.state!==Wd.ERROR){var r=!1;if(e.users.includes(this)||(r=!0,e.users.push(this)),e.state!==Wd.DECODED){if(e.state!==Wd.DECODING){e.state=Wd.DECODING,e.videoFrames.splice(0).forEach(function(e){return e.close()}),e.audioBufferSourceNode&&(e.audioBufferSourceNode.stop(),e.audioBufferSourceNode.disconnect(),e.audioBufferSourceNode=void 0),e.audioBuffer=void 0;var i={url:this.url,type:Ud.DECODE,id:this.id,messageId:Zd++,isWorker:!!L.decoderWorker||!!L.decoderWorkerStr,index:e.index,mute:L.mute};Kd?Kd.postMessage(i):qd({data:i}).then(function(e){t.onMessage&&t.onMessage(e)})}}else r&&this.emit(jd.CANPLAY,e)}},i.prototype.releaseGOP=function(e){var t,r,i=this,a=e.users.indexOf(this);if(a>-1){e.users.splice(a,1),e.users.length||(e.state!==Wd.DECODING&&e.state!==Wd.DECODED||(e.state=Wd.NONE),e.videoFrames.splice(0).forEach(function(e){return e.close()}),null===(t=e.audioBufferSourceNode)||void 0===t||t.stop(),null===(r=e.audioBufferSourceNode)||void 0===r||r.disconnect(),e.audioBuffer=void 0);var n={url:this.url,type:Ud.RELEASE,id:this.id,index:e.index,messageId:Zd++,isWorker:!!L.decoderWorker||!!L.decoderWorkerStr};Kd?Kd.postMessage(n):qd({data:n}).then(function(e){i.onMessage&&i.onMessage(e)})}},i.prototype.releaseGOPList=function(){var e=this;$d[this.url].gopList.forEach(function(t){e.releaseGOP(t)})},i.prototype.release=function(){this.releaseGOPList();var e=$d[this.url];if(!e)throw new Error("Unknown release url: "+this.url);var t=e.metaList.indexOf(this);t>-1&&e.metaList.splice(t,1),(t=e.loadList.indexOf(this))>-1&&e.loadList.splice(t,1),e.count--,e.count||delete $d[this.url]},Object.defineProperty(i.prototype,"gopList",{get:function(){var e;return null===(e=$d[this.url])||void 0===e?void 0:e.gopList},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"currentGOP",{get:function(){var e;return null===(e=$d[this.url])||void 0===e?void 0:e.gopList[this.gopIndex]},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"cache",{get:function(){return $d[this.url]},enumerable:!1,configurable:!0}),i}(M),ef=function(e){function r(t){var r,i=e.call(this,t)||this;t.onMeta&&(i.onMeta=t.onMeta),t.onCanplay&&(i.onCanplay=t.onCanplay),t.onError&&(i.onError=t.onError),t.onWaiting&&(i.onWaiting=t.onWaiting),i._currentTime=t.currentTime||0,i._volumn=Math.max(0,Math.min(1,null!==(r=t.volumn)&&void 0!==r?r:1)),i.isPure=!0;var a=i._src=t.src||"";if(a){i._currentTime>=0&&(i.contentLoadingNum=1);var n=i._decoder=new Jd(a);n.on(jd.META,function(e){if(i._metaData=e,i._currentTime>=0&&i._currentTime<e.duration?i.contentLoadingNum=1:i.contentLoadingNum=0,i.isMounted){var t=i.style,r=t.left,a=t.top,n=t.right,o=t.bottom,s=t.width,c=t.height;(r.u!==V.AUTO&&n.u!==V.AUTO||s.u!==V.AUTO)&&(a.u!==V.AUTO&&o.u!==V.AUTO||c.u!==V.AUTO)||i.refresh(ui.REFLOW)}i.onMeta&&i.onMeta(e),i.emit(Ia,e)}),n.on(jd.ERROR,function(e){oe.error(e),i.contentLoadingNum=0,i.onError&&i.onError(e),i.emit(Ra,e),i.refresh()}),n.on(jd.CANPLAY,function(e){var t=n.getFrameByTime(i._currentTime);i.videoFrame=t,i.contentLoadingNum=0,i.onCanplay&&i.onCanplay(),i.emit(Ma),i.refresh()}),n.on([jd.CANPLAY,jd.AUDIO_BUFFER],function(e){var t=i.root;if(t&&e.audioBuffer){var r=t.audioContext,a=i.timeAnimation;if("running"===(null==a?void 0:a.playState)&&r){var n=a.currentTime-a.delay;if(n>=e.timestamp+e.duration||a.duration<=e.timestamp)return;var o=r.createBufferSource();o.buffer=e.audioBuffer,i.gainNode||(i.gainNode=r.createGain(),i.gainNode.gain.value=i.volumn,i.gainNode.connect(r.destination)),o.connect(i.gainNode),n>=e.audioTimestamp?o.start(0,.001*(n-e.audioTimestamp),.001*(a.duration-n)):o.start(r.currentTime+.001*(e.audioTimestamp-n),0,.001*(a.duration-e.audioTimestamp))}}}),n.start(i._currentTime)}return i}return t(r,e),r.prototype.lay=function(t){e.prototype.lay.call(this,t);var r=this,i=r.style,a=r.computedStyle,n=r._metaData,o=i.left,s=i.top,c=i.right,u=i.bottom,l=i.width,h=i.height;if(null==n?void 0:n.video){var d=(o.u===V.AUTO||c.u===V.AUTO)&&l.u===V.AUTO,f=(s.u===V.AUTO||u.u===V.AUTO)&&h.u===V.AUTO;d&&(a.width=f?n.video.width:n.video.height*a.height/n.video.height,o.u===V.AUTO&&c.u===V.AUTO?(a.left=0,a.right=t.w-a.width):o.u===V.AUTO?a.left=t.w-a.right-a.width:c.u===V.AUTO&&(a.right=t.w-a.left-a.width)),f&&(a.height=d?n.video.height:n.video.height*a.width/n.video.width,s.u===V.AUTO&&u.u===V.AUTO?(a.top=0,a.bottom=t.h-a.height):s.u===V.AUTO?a.top=t.h-a.bottom-a.height:u.u===V.AUTO&&(a.bottom=t.h-a.top-a.height))}},r.prototype.calRepaintStyle=function(t){e.prototype.calRepaintStyle.call(this,t);var r=this.computedStyle,i=this.videoFrame;if(this.isPure=r.backgroundColor[3]<=0,this.isPure&&i){var a=r.objectFit,n=r.borderTopLeftRadius,o=r.borderTopRightRadius,s=r.borderBottomLeftRadius,c=r.borderBottomRightRadius;if(a!==ae.COVER&&a!==ae.FILL||!(n||o||s||c)){if(a===ae.CONTAIN&&(n||o||s||c)){var u=i.displayWidth/i.displayHeight,l=r.width/r.height;if(l>u){var h=r.height*u,d=.5*(r.width-h);(n>d||o>d||s>d||c>d)&&(this.isPure=!1)}else if(l<u){var f=r.width/u,m=.5*(r.height-f);(n>m||o>m||s>m||c>m)&&(this.isPure=!1)}else this.isPure=!1}}else this.isPure=!1}},r.prototype.calContent=function(){return this.hasContent=!1,(this._videoFrame||this.computedStyle.backgroundColor[3]>0)&&(this.hasContent=!0),this.hasContent},r.prototype.renderCanvas=function(){var t,r,i=this,a=i.isPure,n=i.videoFrame,o=i.computedStyle;if(a){if(null===(t=this.canvasCache)||void 0===t||t.release(),n&&(n.displayWidth>L.maxTextureSize||n.displayHeight>L.maxTextureSize))if((b=this.canvasCache=Ti.getVideoFrameInstance(n.displayWidth,n.displayHeight,n)).available=!0,1===b.getCount()){var s=o.width,c=o.height,u=o.objectFit,l=0,h=0,d=n.displayWidth/n.displayHeight,f=s/c;if(u===ae.CONTAIN){if(f>d)l=.5*(s-(T=c*d)),s=T;else if(f<d){h=.5*(c-(w=s/d)),c=w}}else if(u===ae.COVER){if(f>d)h=.5*(c-(w=s/d)),c=w;else if(f<d){l=.5*(s-(T=c*d)),s=T}}for(var m=0,p=(A=b.list).length;m<p;m++){var g=A[m],v=g.x,y=g.y;g.os.ctx.drawImage(n,-v+l,-y+h,s,c)}}}else{e.prototype.renderCanvas.call(this);var b,x=this._bboxInt||this.bboxInt,T=(v=x[0],y=x[1],x[2]-v),w=x[3]-y;l=0,h=0,s=o.width,c=o.height,u=o.objectFit;if(n){d=n.displayWidth/n.displayHeight,f=s/c;if(u===ae.CONTAIN){if(f>d){var k=c*d;l+=.5*(s-k),s=k}else if(f<d){var S=s/d;h+=.5*(c-S),c=S}}else if(u===ae.COVER)if(f>d){var E=s/d;h=.5*(c-E),c=E}else if(f<d){var C=c*d;l=.5*(s-C),s=C}}(b=this.canvasCache=(null===(r=this.canvasCache)||void 0===r?void 0:r.available)?this.canvasCache:new Ti(T,w,-v,-y)).available=!0;var A;for(m=0,p=(A=b.list).length;m<p;m++){var _=A[m],M=_.x,I=_.y,R=_.os.ctx,P=-M,O=-I;n&&R.drawImage(n,P+l,O+h,s,c)}}},r.prototype.genTexture=function(t){var r=this,i=r.isPure,a=r.videoFrame,n=r.canvasCache;if(i){if(a)if(a.displayWidth>L.maxTextureSize||a.displayHeight>L.maxTextureSize)if((null==n?void 0:n.available)&&Ji.hasCanvasCacheInstance(n)){var o=Ji.getCanvasCacheInstance(t,n,this._rect||this.rect);this.textureTarget=this.textureCache=o}else{this.renderCanvas();o=Ji.getCanvasCacheInstance(t,this.canvasCache,this._rect||this.rect);this.textureTarget=this.textureCache=o,this.canvasCache.release()}else{var s=this.computedStyle,c=s.width,u=s.height,l=s.objectFit,h=this._rect||this.rect,d=(o=void 0,a.displayWidth/a.displayHeight),f=c/u;if(l===ae.CONTAIN){if(f>d){var m=.5*(c-(v=u*d));(h=h.slice(0))[0]+=m,h[2]-=m}else if(f<d){m=.5*(u-(p=c/d));(h=h.slice(0))[1]+=m,h[3]-=m}}else if(l===ae.COVER)if(f>d){var p=c/d;o={x1:0,y3:g=(m=.5*Math.abs(u-p))/p,x3:1,y1:1-g}}else if(f<d){var g,v=u*d;o={x1:g=(m=.5*Math.abs(c-v))/v,y3:0,x3:1-g,y1:1}}var y=Ji.getVideoFrameInstance(t,a,h,o);this.textureTarget=this.textureCache=y}}else e.prototype.genTexture.call(this,t)},r.prototype.calContentLoading=function(){var t=e.prototype.calContentLoading.call(this);if(t){if(this._currentTime>=0){if(!this._metaData)return t;if(this._currentTime<this._metaData.duration)return t}return 0}return t},r.prototype.release=function(){e.prototype.release.call(this);var t=this._decoder,r=this.gainNode;t&&t.release(),r&&(r.disconnect(),this.gainNode=void 0)},r.prototype.timeAnimate=function(e,t){var r;null===(r=this.timeAnimation)||void 0===r||r.remove();var i=this.timeAnimation=new Ha(this,e,t);return this.initAnimate(i,t)},r.prototype.cloneProps=function(){var t=e.prototype.cloneProps.call(this);return t.src=this._src,t.currentTime=this._currentTime,t.volumn=this._volumn,t},r.prototype.clone=function(){return new r(this.cloneProps())},Object.defineProperty(r.prototype,"src",{get:function(){return this._src},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"currentTime",{get:function(){return this._currentTime},set:function(e){var t;if(this._currentTime!==e){this._currentTime=e;var r=this._decoder;if(r){var i=e;r.start(i);var a=this._videoFrame,n=r.getFrameByTime(i);this.videoFrame=n,this.contentLoadingNum=0,!n&&(null===(t=r.currentGOP)||void 0===t?void 0:t.state)===Wd.DECODING&&e>=0&&!r.error&&(this._metaData&&this._metaData.duration,this.contentLoadingNum=1),a&&!n&&this._metaData&&e>=0&&e<this._metaData.duration&&!r.error&&(this.onWaiting&&this.onWaiting(),this.emit(_a))}}},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"duration",{get:function(){var e;return(null===(e=this._metaData)||void 0===e?void 0:e.duration)||0},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"metaData",{get:function(){return this._metaData},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"volumn",{get:function(){return this._volumn},set:function(e){var t=Math.max(0,Math.min(1,e));this._volumn!==t&&(this._volumn=t,this.gainNode&&(this.gainNode.gain.value=t))},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"decoder",{get:function(){return this._decoder},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"videoFrame",{get:function(){return this._videoFrame},set:function(e){this._videoFrame!==e&&(this._videoFrame=e,this.refresh())},enumerable:!1,configurable:!0}),r}(ka);function tf(e,t,r,i,a,n,o){for(var s=L.maxTextureSize,c=s-2*o,u=[],l=t.bbox,h=a,d=n,f=0,m=Math.ceil(d/c);f<m;f++)for(var p=1,g=Math.ceil(h/s);p<g;p++){var v=Math.max(l[0],r+p*s-2*o),y=Math.max(l[1],i+f*c-o),b=Math.min(l[2],v+4*o),x=Math.min(l[3],y+c+2*o),T=new Float32Array([v,y,b,x]);v>l[2]-2*o&&(v=T[0]=Math.max(l[0],l[2]-2*o),b=T[2]=l[2]),y>l[3]-2*o&&(y=T[1]=Math.max(l[1],l[3]-2*o),x=T[3]=l[3]);var w=T[2]-T[0],k=T[3]-T[1];u.push({bbox:T,w:w,h:k,t:Si(e,0,void 0,w,k),x1:Math.max(l[0],v+o),y1:Math.max(l[1],f?y+o:y),x2:Math.min(l[2],b-o),y2:Math.min(l[3],f===m-1?x:y+c+o)})}for(f=1,m=Math.ceil(d/s);f<m;f++)for(p=0,g=Math.ceil(h/c);p<g;p++){v=Math.max(l[0],r+p*c-o),y=Math.max(l[1],i+f*s-2*o),b=Math.min(l[2],v+c+2*o),x=Math.min(l[3],y+4*o),T=new Float32Array([v,y,b,x]);v>l[2]-2*o&&(v=T[0]=Math.max(l[0],l[2]-2*o),b=T[2]=l[2]),y>l[3]-2*o&&(y=T[1]=Math.max(l[1],l[3]-2*o),x=T[3]=l[3]);var S=T[2]-T[0],E=T[3]-T[1];u.push({bbox:T,w:S,h:E,t:Si(e,0,void 0,S,E),x1:Math.max(l[0],p?v+o:v),y1:Math.max(l[1],y+o),x2:Math.min(l[2],p===g-1?b:v+c+o),y2:Math.min(l[3],x-o)})}return u}function rf(e,t,r,i,a,n){Va.useProgram(e,t),e.blendFunc(e.ONE,e.ZERO);for(var o=r.list,s=0,c=o.length;s<c;s++){var u=o[s],l=u.bbox,h=u.w,d=u.h,f=u.t;e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,f,0),e.viewport(0,0,h,d);for(var m=.5*h,p=.5*d,g=0,v=i.length;g<v;g++){var y=i[g],b=y.bbox,x=y.w,T=y.h,w=y.t,k=b.slice(0);k[0]!==a[0]&&(k[0]+=n),k[1]!==a[1]&&(k[1]+=n),k[2]!==a[2]&&(k[2]-=n),k[3]!==a[3]&&(k[3]-=n);var S=k[2]-k[0],E=k[3]-k[1];za(l,void 0,k[0],k[1],S,E)&&Ci(e,m,p,t,{opacity:1,bbox:k,t:w,tc:{x1:(k[0]===a[0]?0:n)/x,y1:(k[1]===a[1]?0:n)/T,x3:(k[2]===a[2]?x:x-n)/x,y3:(k[3]===a[3]?T:T-n)/T},dx:-l[0],dy:-l[1]})}}e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA),i.forEach(function(t){return e.deleteTexture(t.t)})}function af(e,t,r,i,a,n,o,s){for(var c,u=L.maxTextureSize,l=r.list,h=i.list,d=0,f=Math.ceil(s/u);d<f;d++)for(var m=0,p=Math.ceil(o/u);m<p;m++){var g=m===p-1?o-m*u:u,v=d===f-1?s-d*u:u,y=Si(e,0,void 0,g,v),b=a+m*u,x=n+d*u,T=g,w=v,k={bbox:new Float32Array([b,x,b+T,x+w]),w:g,h:v,t:y};h.push(k),c?(e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,y,0),e.viewport(0,0,g,v)):c=La(e,y,g,v);for(var S=.5*g,E=.5*v,C=0,A=l.length;C<A;C++){var _=l[C],M=_.bbox,I=_.t;I&&za(M,void 0,b,x,T,w)&&Ci(e,S,E,t,{opacity:1,bbox:M,t:I,dx:-b,dy:-x})}}return c}function nf(e,t,r){var i,a;if((e instanceof ef||e instanceof Oa)&&e.isPure)if(e instanceof ef){var n=e.metaData;if((null===(i=null==n?void 0:n.video)||void 0===i?void 0:i.displayWidth)!==t||n.video.displayHeight!==r)return!0}else if((null===(a=e.loader)||void 0===a?void 0:a.width)!==t||e.loader.height!==r)return!0;return!1}function of(e,t,r,i,a,n,o){var s=t.programs,c=s.box,u=s.dualDown,l=s.dualUp,h=n,d=o,f=void 0;if(i){Va.useProgram(e,u),f=a;for(var m=1;m<=i;m++){var p=Math.ceil(n*Math.pow(.5,m)),g=Math.ceil(o*Math.pow(.5,m));e.viewport(0,0,p,g),f=zi(e,u,y=f,h,d,p,g),y!==a&&e.deleteTexture(y),h=p,d=g}}Va.useProgram(e,c),e.viewport(0,0,h,d);var v=function(e,t,r,i,a,n){var o=Ni(e,t),s=o.pointBuffer,c=o.a_position,u=o.texBuffer,l=o.a_texCoords,h=t.uniform.u_texture,d=t.uniform.u_pw,f=t.uniform.u_ph;e.uniform1f(d,1/i),e.uniform1f(f,1/a);for(var m=t.uniform.u_direction,p=t.uniform.u_r,g=r,v=Si(e,0,void 0,i,a),y=Si(e,0,void 0,i,a),b=0,x=n.length;b<x;b++){var T=n[b]-1>>1;e.uniform1i(p,T),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,v,0),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),Ei(e,g,0),e.uniform1i(h,0),e.uniform1i(m,0),e.drawArrays(e.TRIANGLE_STRIP,0,4),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,y,0),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),Ei(e,v,0),e.uniform1i(m,1),e.drawArrays(e.TRIANGLE_STRIP,0,4),g=y}return e.deleteBuffer(s),e.deleteBuffer(u),e.disableVertexAttribArray(c),e.disableVertexAttribArray(l),e.deleteTexture(v),y}(e,c,f||a,h,d,r);if(i){Va.useProgram(e,l),f=v;for(m=i-1;m>=0;m--){var y;p=Math.ceil(n*Math.pow(.5,m)),g=Math.ceil(o*Math.pow(.5,m));e.viewport(0,0,p,g),f=zi(e,l,y=f,h,d,p,g),e.deleteTexture(y),h=p,d=g}v=f}return e.viewport(0,0,n,o),Va.useProgram(e,s.main),v}function sf(e,t,r,i,a,n,o,s){var c,u=i.bbox.slice(0),l=u[0],h=u[1],d=u[2]-u[0],f=u[3]-u[1],m=t.programs,p=m.bloom,g=m.bloomBlur,v=m.main;Va.useProgram(e,v),nf(r,d,f)&&((c=Ji.getEmptyInstance(e,u)).available=!0);var y=c?af(e,v,i,c,l,h,d,f):La(e,i.list[0].t,d,f),b=Ji.getEmptyInstance(e,u);b.available=!0,Va.useProgram(e,g),function(e,t,r,i,a,n){var o,s=r.list,c=i.list;s.forEach(function(r){var i=r.t,s=r.w,u=r.h,l=r.bbox,h=Si(e,0,void 0,s,u);o?(e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,h,0),e.viewport(0,0,s,u)):o=La(e,h,s,u),function(e,t,r,i,a){var n=Ni(e,t),o=n.pointBuffer,s=n.a_position,c=n.texBuffer,u=n.a_texCoords;if(i!==t.uniformValue.u_threshold){var l=t.uniform.u_threshold;e.uniform1f(l,i)}if(a!==t.uniformValue.u_knee){var h=t.uniform.u_knee;e.uniform1f(h,a)}Ei(e,r,0);var d=t.uniform.u_texture;e.uniform1i(d,0),e.drawArrays(e.TRIANGLE_STRIP,0,4),e.deleteBuffer(o),e.deleteBuffer(c),e.disableVertexAttribArray(s),e.disableVertexAttribArray(u)}(e,t,i,a,n),c.push({bbox:l.slice(0),t:h,w:s,h:u})}),Na(e,o)}(e,g,c||i,b,a,n);for(var x=Math.min(d,f),T=0;x>=8&&(x>>=1,!(++T>=4)););var w=Ji.getEmptyInstance(e,u);w.available=!0,w.list=function(e,t,r,i,a){var n=r.list,o=i.list,s=t.programs,c=s.dualDown13,u=s.dualUp13;Va.useProgram(e,c);for(var l,h=[],d=function(t){var r=[];n.forEach(function(i){var a=i.t,n=i.w,o=i.h,s=n>>t+1,u=o>>t+1,h=Si(e,0,void 0,s,u),d={w:n>>t,h:o>>t,t:h};l?(e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,h,0),e.viewport(0,0,s,u)):l=La(e,h,s,u),function(e,t,r,i,a,n){void 0===n&&(n=1);var o=Ni(e,t),s=o.pointBuffer,c=o.a_position,u=o.texBuffer,l=o.a_texCoords,h=t.uniform.u_xy;e.uniform2f(h,n/i,n/a),Ei(e,r,0),e.uniform1i(t.uniform.u_texture,0),e.drawArrays(e.TRIANGLE_STRIP,0,4),e.deleteBuffer(s),e.deleteBuffer(u),e.disableVertexAttribArray(c),e.disableVertexAttribArray(l)}(e,c,a,s,u),r.push(d)}),h.push(r)},f=0;f<a;f++)d(f);Va.useProgram(e,u);var m=function(t){h[t].forEach(function(r,i){var a=r.t,s=r.w,c=r.h,l=Si(e,0,void 0,s,c);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,l,0),t?e.viewport(0,0,s,c):e.viewport(0,0,n[i].w,n[i].h);var d=t?h[t-1][i].t:n[i].t;!function(e,t,r,i,a,n,o){void 0===o&&(o=1);var s=Ni(e,t),c=s.pointBuffer,u=s.a_position,l=s.texBuffer,h=s.a_texCoords,d=t.uniform.u_xy;e.uniform2f(d,o/a,o/n),Ei(e,r,0),Ei(e,i,1),e.uniform1i(t.uniform.u_texture1,0),e.uniform1i(t.uniform.u_texture2,1),e.drawArrays(e.TRIANGLE_STRIP,0,4),e.deleteBuffer(c),e.deleteBuffer(l),e.disableVertexAttribArray(u),e.disableVertexAttribArray(h)}(e,u,d,a,s,c),e.deleteTexture(h[t][i].t),t?(e.deleteTexture(h[t-1][i].t),h[t-1][i].t=l):o[i]={bbox:n[i].bbox.slice(0),w:n[i].w,h:n[i].h,t:l}})};for(f=a-1;f>=0;f--)m(f);return Na(e,l),o}(e,t,b,w,T),b.release(),Va.useProgram(e,p);var k=Ji.getEmptyInstance(e,u);k.available=!0;var S=c?c.list:i.list;return e.bindFramebuffer(e.FRAMEBUFFER,y),w.list.forEach(function(t,r){var i=t.w,a=t.h,n=t.t,o=t.bbox,s=Si(e,0,void 0,i,a);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,s,0),e.viewport(0,0,i,a),function(e,t,r,i){var a=Ni(e,t),n=a.pointBuffer,o=a.a_position,s=a.texBuffer,c=a.a_texCoords;Ei(e,r,0),Ei(e,i,1),e.uniform1i(t.uniform.u_texture1,0),e.uniform1i(t.uniform.u_texture2,1),e.drawArrays(e.TRIANGLE_STRIP,0,4),e.deleteBuffer(n),e.deleteBuffer(s),e.disableVertexAttribArray(o),e.disableVertexAttribArray(c)}(e,p,S[r].t,n),k.list.push({bbox:o.slice(0),w:i,h:a,t:s})}),Va.useProgram(e,v),e.viewport(0,0,o,s),c&&c.release(),w&&w.release(),Na(e,y),k}function cf(e,t,r,i,a,n,o,s,c,u){var l=t.programs,h=l.cm;Va.useProgram(e,h);var d,f=r;if(i||1!==a||1!==n||1!==o||1!==s){var m=fr(i%360),p=Math.cos(m),g=Math.sin(m),v=.213*(1-a),y=.715*(1-a),b=.072*(1-a),x=n-1,T=.5*(1-o),w=ot(i?new Float32Array([.213+.787*p-.213*g,.715-.715*p-.715*g,.072-.072*p+.928*g,0,.213-.213*p+.143*g,.715+.285*p+.14*g,.072-.072*p-.283*g,0,.213-.213*p-.787*g,.715-.715*p+.715*g,.072+.928*p+.072*g,0,0,0,0,1]):at(),1!==a?new Float32Array([v+a,y,b,0,v,y+a,b,0,v,y,b+a,0,0,0,0,1]):at());if(1!==o&&(w[0]*=o,w[1]*=o,w[2]*=o,w[4]*=o,w[5]*=o,w[6]*=o,w[8]*=o,w[9]*=o,w[10]*=o),1!==s){var k=Math.min(1,Math.max(0,1-s));ut(w,ot(w,new Float32Array([.393+.607*k,.769-.769*k,.189-.189*k,0,.349-.349*k,.686+.314*k,.168-.168*k,0,.272-.272*k,.534-.534*k,.131+.869*k,0,0,0,0,1])))}var S=f,E=function(e,t,r,i,a){var n=Ji.getEmptyInstance(e,r.bbox);n.available=!0;for(var o=r.list,s=n.list,c=0,u=o.length;c<u;c++){var l=o[c],h=l.bbox,d=l.w,f=l.h,m=l.t,p=Si(e,0,void 0,d,f);a?(e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,p,0),e.viewport(0,0,d,f)):a=La(e,p,d,f),m&&Xi(e,t,m,i),s.push({bbox:h.slice(0),w:d,h:f,t:p})}return{res:n,frameBuffer:a}}(e,h,S,[w[0],w[1],w[2],w[3],x+T,w[4],w[5],w[6],w[7],x+T,w[8],w[9],w[10],w[11],x+T,0,0,0,1],d);f=E.res,d=E.frameBuffer,S!==r&&S.release()}if(Va.useProgram(e,l.main),d)return Na(e,d,c,u),f;e.viewport(0,0,c,u)}function uf(e){return(e.visibility===te.HIDDEN||e.opacity<=0)&&!e.maskMode}function lf(e,t,r,i,a){for(var n=r+a+1,o=t.length;n<o;n++){var s=t[n],c=s.node,u=s.lv,l=c.computedStyle;if(i>u){e.struct.next=n-r-a-1;break}if(n===o-1||l.breakMask&&i===u){e.struct.next=n-r-a;break}}}function hf(e,t,r,i,a,n,o){var s=(t.tempBbox||t._bbox||t.bbox).slice(0);if(st(t.tempMatrix),t.computedStyle.overflow===ie.HIDDEN||t.computedStyle.overflow===ie.CLIP)return s;for(var c=r+1,u=r+i+1;c<u;c++){var l=e[c],h=l.node,d=l.total,f=h.textureTarget;if(a){var m=h.parent,p=m.perspectiveMatrix,g=h.perspectiveMatrixSelf,v=h.matrix;g&&(v=ot(g,v)),p&&(v=ot(p,v));var y=ot(m.tempMatrix,v);ut(h.tempMatrix,y);var b=f&&f!==h.textureCache?f.bbox:h._filterBboxInt||h.filterBboxInt;b[2]-b[0]&&b[3]-b[1]&&di(s,b,v)}var x=o[c];x&&(x.isTop=!1,n.subList.push(x)),(null==f?void 0:f.available)&&f!==h.textureCache&&(c+=d)}return s}function df(e,t,r,i,a,n,o,s,c){var u;if(void 0===c&&(c=!1),null===(u=r.textureTotal)||void 0===u?void 0:u.available){if(!c)return r.textureTotal;if(r.textureTotal!==r.textureCache)return r.textureTotal}var l=r.tempBbox;if(r.tempBbox=void 0,pi(l),!n&&!c){var h=r.textureCache;return!(null==h?void 0:h.available)&&r.hasContent&&(r.genTexture(e),h=r.textureCache),h}var d=t.programs,f=d.main;Va.useProgram(e,f);var m=l[0],p=l[1],g=Math.ceil(l[2]-m),v=Math.ceil(l[3]-p),y=Ji.getEmptyInstance(e,l);y.available=!0;for(var b,x=y.list,T=L.maxTextureSize,w=[],k=0,S=Math.ceil(v/T);k<S;k++)for(var E=0,C=Math.ceil(g/T);E<C;E++){var A=E===C-1?g-E*T:T,_=k===S-1?v-k*T:T,M=m+E*T,I=p+k*T,R=new Float32Array([M,I,M+A,I+_]);w.push({x:m+E*T,y:p+k*T,w:A,h:_,bbox:R})}for(k=a,S=a+n+1;k<S;k++){var P=i[k],O=P.node,D=P.total,B=P.next,F=O.computedStyle;if(uf(F))k+=D+B;else{var N=void 0,U=void 0;if(k===a){if(N=O.tempOpacity=1,st(O.tempMatrix),U=O.tempMatrix,F.perspectiveSelf>=1){var z=F.transformOrigin;ut(U,H=Mr(F.perspectiveSelf,z[0]-m,z[1]-p))}if(F.perspective>=1){var W=F.perspectiveOrigin;ut(U,re=ot(Mr(F.perspective,W[0]-m,W[1]-p),U))}}else{var V=O.parent;N=O.tempOpacity=F.opacity*V.tempOpacity;var H=void 0;if(F.perspectiveSelf>=1){z=F.transformOrigin;H=Mr(F.perspectiveSelf,z[0]-m,z[1]-p)}var X=O.transform;if(nt(X))U=V.tempMatrix,H&&(U=ot(U,H));else{var G=_r(X,(z=F.transformOrigin)[0]-m,z[1]-p);U=ot(V.tempMatrix,H?ot(H,G):G)}}ut(O.tempMatrix,U);var Y=O.textureTarget;if(!(null==Y?void 0:Y.available)&&O.hasContent&&(O.genTexture(e),Y=O.textureTarget),Y&&Y.available)for(var q=F.mixBlendMode,K=Y.list,$=(E=0,w.length);E<$;E++)for(var Q=w[E],Z=Q.x,J=Q.y,ee=Q.w,te=Q.h,re=Q.t,ie=.5*ee,ae=.5*te,ne=0,oe=K.length;ne<oe;ne++){var se=K[ne],ce=se.bbox,ue=se.t,le=se.tc;if(ue&&za(ce,U,Z,J,ee,te)){re||(re=Q.t=Si(e,0,void 0,ee,te)),b?(e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,re,0),e.viewport(0,0,ee,te)):b=La(e,re,ee,te);var he=void 0;q!==j.NORMAL&&k>a&&(he=Si(e,0,void 0,ee,te),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,he,0)),Ci(e,ie,ae,f,{opacity:N,matrix:U,bbox:ce,t:ue,tc:le,dx:-Q.x,dy:-Q.y}),q!==j.NORMAL&&he&&(re=Q.t=pf(e,re,he,q,d,ee,te))}}(null==Y?void 0:Y.available)&&Y!==O.textureCache&&(k+=D+B)}}return b&&Na(e,b,o,s),w.forEach(function(e){x.push({bbox:e.bbox,w:e.w,h:e.h,t:e.t})}),y}function ff(e,t,r,i,a){var n,o;if(null===(n=r.textureFilter)||void 0===n?void 0:n.available)return r.textureFilter;var s=r.computedStyle.filter,c=r.textureTarget;return s.forEach(function(n){if(n.u===V.GAUSS_BLUR){if(n.radius>=1){var s=function(e,t,r,i,a,n,o,s){void 0===s&&(s=!1);var c=Pr(a),u=s?Dr(c):0,l=i.bbox.slice(0);u&&(l[0]-=u,l[1]-=u,l[2]+=u,l[3]+=u);var h,d=l[0],f=l[1],m=l[2]-l[0],p=l[3]-l[1],g=t.programs.main;Va.useProgram(e,g),(u||nf(r,m,p))&&((h=Ji.getEmptyInstance(e,l)).available=!0);var v=h?h.list:i.list,y=h?af(e,g,i,h,d,f,m,p):La(e,i.list[0].t,m,p),b=function(e){var t=0;return e>=256?t=4:e>=64?t=3:e>=16?t=2:e>=4&&(t=1),t}(a),x=Br(a*Math.pow(.5,b)),T=Ji.getEmptyInstance(e,l);T.available=!0;for(var w=T.list,k=0,S=v.length;k<S;k++){var E=v[k],C=E.bbox,A=E.w,_=E.h,M=E.t;w.push({bbox:C.slice(0),w:A,h:_,t:M&&of(e,t,x,b,M,A,_)})}if(v.length>1){var I=tf(e,T,d,f,m,p,u);for(k=0,S=I.length;k<S;k++){var R=I[k],P=(C=R.bbox,R.w),O=R.h;M=R.t,Va.useProgram(e,g),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,M,0),e.viewport(0,0,P,O);for(var D=.5*P,B=.5*O,F=!1,L=0,N=v.length;L<N;L++){var U=v[L],z=U.bbox,W=U.t,V=z[2]-z[0],H=z[3]-z[1];W&&za(C,void 0,z[0],z[1],V,H)&&(Ci(e,D,B,g,{opacity:1,bbox:z,t:W,dx:-C[0],dy:-C[1]}),F=!0)}F&&(R.t=of(e,t,x,b,M,P,O),e.deleteTexture(M))}rf(e,g,T,I,l,u)}return h&&h.release(),Va.useProgram(e,g),Na(e,y,n,o),T}(e,t,r,o||c,n.radius,i,a);o&&o.release(),o=s}}else if(n.u===V.RADIAL_BLUR){if(n.radius>=1){s=function(e,t,r,i,a,n,o,s,c){void 0===c&&(c=!1);var u=i.bbox,l=Pr(a),h=c?Dr(l):0,d=u.slice(0),f=d[2]-d[0],m=d[3]-d[1],p=n[0]*f,g=n[1]*m,v=2*h/Math.sqrt(f*f+m*m),y=Math.ceil(v*p),b=Math.ceil(v*(f-p)),x=Math.ceil(v*g),T=Math.ceil(v*(m-g));d[0]-=y,d[1]-=x,d[2]+=b,d[3]+=T;var w,k=d[0],S=d[1],E=d[2]-d[0],C=d[3]-d[1],A=t.programs,_=A.main;(h||nf(r,E,C))&&((w=Ji.getEmptyInstance(e,d)).available=!0);var M=w?w.list:i.list,I=w?af(e,_,i,w,k,S,E,C):La(e,i.list[0].t,E,C),R=A.radial;Va.useProgram(e,R);var P=Ji.getEmptyInstance(e,d);P.available=!0;for(var O=P.list,D=p+y,B=g+x,F=0,L=M.length;F<L;F++){var N=M[F],U=N.bbox,z=N.w,W=N.h,V=N.t;e.viewport(0,0,z,W);var H=U[2]-U[0],X=U[3]-U[1],j=[(D-U[0]+d[0])/H,(B-U[1]+d[1])/X],G=V&&Vi(e,R,V,v,h,j,z,W);O.push({bbox:U.slice(0),w:z,h:W,t:G})}if(M.length>1){var Y=tf(e,P,k,S,E,C,h);for(F=0,L=Y.length;F<L;F++){var q=Y[F],K=(U=q.bbox,q.w),$=q.h;V=q.t,Va.useProgram(e,_),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,V,0),e.viewport(0,0,K,$),j=[(D-U[0]+d[0])/(U[2]-U[0]),(B-U[1]+d[0])/(U[3]-U[1])];for(var Q=.5*K,Z=.5*$,J=!1,ee=0,te=M.length;ee<te;ee++){var re=M[ee],ie=re.bbox,ae=re.t;H=ie[2]-ie[0],X=ie[3]-ie[1],ae&&za(U,void 0,ie[0],ie[1],H,X)&&(Ci(e,Q,Z,_,{opacity:1,bbox:new Float32Array([ie[0],ie[1],ie[2],ie[3]]),t:ae,dx:-U[0],dy:-U[1]}),J=!0)}J&&(Va.useProgram(e,R),q.t=Vi(e,R,V,v,h,j,K,$)),e.deleteTexture(V)}rf(e,_,P,Y,d,h)}return w&&w.release(),Va.useProgram(e,_),Na(e,I,o,s),P}(e,t,r,o||c,n.radius,n.center,i,a);o&&o.release(),o=s}}else if(n.u===V.MOTION_BLUR){if(n.radius>=1){s=function(e,t,r,i,a,n,o,s,c,u,l){void 0===u&&(u=!1),void 0===l&&(l=!1);var h=fr(n),d=u?3*a:0,f=a,m=i.bbox.slice(0);if(d){var p=Math.sin(h),g=Math.cos(h),v=Math.abs(Math.ceil(p*d)),y=Math.abs(Math.ceil(g*d));m[0]-=y,m[1]-=v,m[2]+=y,m[3]+=v}var b,x=m[0],T=m[1],w=m[2]-m[0],k=m[3]-m[1],S=t.programs,E=S.main;(d||nf(r,w,k))&&((b=Ji.getEmptyInstance(e,m)).available=!0);var C=b?b.list:i.list,A=b?af(e,E,i,b,x,T,w,k):La(e,i.list[0].t,w,k),_=S.motion;Va.useProgram(e,_);var M=Ji.getEmptyInstance(e,m);M.available=!0;for(var I=M.list,R=0,P=C.length;R<P;R++){var O=C[R],D=O.bbox,B=O.w,F=O.h,L=O.t;e.viewport(0,0,B,F);var N=L&&Wi(e,_,L,f,h,o,B,F,l);I.push({bbox:D.slice(0),w:B,h:F,t:N})}if(C.length>1){var U=tf(e,M,x,T,w,k,d);for(R=0,P=U.length;R<P;R++){var z=U[R],W=(D=z.bbox,z.w),V=z.h;L=z.t,Va.useProgram(e,E),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,L,0),e.viewport(0,0,W,V);for(var H=.5*W,X=.5*V,j=!1,G=0,Y=C.length;G<Y;G++){var q=C[G],K=q.bbox,$=q.t,Q=K[2]-K[0],Z=K[3]-K[1];$&&za(D,void 0,K[0],K[1],Q,Z)&&(Ci(e,H,X,E,{opacity:1,bbox:K,t:$,dx:-D[0],dy:-D[1]}),j=!0)}j&&(Va.useProgram(e,_),z.t=Wi(e,_,L,f,h,o,W,V,l)),e.deleteTexture(L)}rf(e,E,M,U,m,d)}return b&&b.release(),Va.useProgram(e,E),Na(e,A,s,c),M}(e,t,r,o||c,n.radius,n.angle,n.offset,i,a);o&&o.release(),o=s}}else if(n.u===V.BLOOM){if(n.threshold>0){s=sf(e,t,r,o||c,n.threshold,n.knee,i,a);o&&o.release(),o=s}}else if(n.u===V.LIGHT_DARK){s=function(e,t,r,i,a,n,o,s){var c,u=fr(n),l=i.bbox.slice(0),h=l[0],d=l[1],f=l[2]-l[0],m=l[3]-l[1],p=t.programs,g=p.main;nf(r,f,m)&&((c=Ji.getEmptyInstance(e,l)).available=!0);var v=c?c.list:i.list,y=c?af(e,g,i,c,h,d,f,m):La(e,i.list[0].t,f,m),b=p.lightDark;Va.useProgram(e,b);var x=Ji.getEmptyInstance(e,l);x.available=!0;for(var T=x.list,w=0,k=v.length;w<k;w++){var S=v[w],E=S.bbox,C=S.w,A=S.h,_=S.t,M=Si(e,0,void 0,C,A);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,M,0),e.viewport(0,0,C,A),ji(e,b,_,a,u,C,A),T.push({bbox:E.slice(0),w:C,h:A,t:M})}return v.length,Va.useProgram(e,g),e.viewport(0,0,o,s),c&&c.release(),Na(e,y),x}(e,t,r,o||c,n.radius,n.angle,i,a);o&&o.release(),o=s}else if(n.u===V.HUE_ROTATE&&n.radius%360||n.u===V.SATURATE&&1!==n.radius||n.u===V.BRIGHTNESS&&1!==n.radius||n.u===V.CONTRAST&&1!==n.radius||n.u===V.SEPIA&&n.radius>0&&n.radius<1){s=cf(e,t,o||c,n.u===V.HUE_ROTATE?n.radius:0,n.u===V.SATURATE?n.radius:1,n.u===V.BRIGHTNESS?n.radius:1,n.u===V.CONTRAST?n.radius:1,n.u===V.SEPIA?n.radius:0,i,a);o&&o.release(),o=s}}),o}function mf(e,t,r,i,a,n,o,s,c,u){var l,h,d;if((null===(l=r.textureMask)||void 0===l?void 0:l.available)||!r.hasContent)return r.textureMask;(null===(h=r.textureTarget)||void 0===h?void 0:h.available)||r.genTexture(e);var f=r.textureTarget;if(!r.next)return f;var m=f.list,p=t.programs;Va.useProgram(e,p.main);var g=f.bbox,v=r.computedStyle,y=g[0],b=g[1],x=g[2]-y,T=g[3]-b,w=Ji.getEmptyInstance(e,g);w.available=!0;var k,S,E=w.list,C=L.maxTextureSize;nf(r,x,T)&&(r.tempBbox=(r.tempBbox||r._rect||r.rect).slice(0),m=(S=df(e,t,r,a,n,s,c,u,!0)).list);for(var A=xt(r.matrix),_=0,M=Math.ceil(T/C);_<M;_++)for(var I=0,R=Math.ceil(x/C);I<R;I++){var P=I===R-1?x-I*C:C,O=_===M-1?T-_*C:C,D=Si(e,0,void 0,P,O),B=y+I*C,F=b+_*C,N={bbox:new Float32Array([B,F,B+P,F+O]),w:P,h:O,t:D};E.push(N);var U=y+I*C,z=b+_*C;k?(e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,D,0),e.viewport(0,0,P,O)):k=La(e,D,P,O);var W=.5*P,V=.5*O;if([$.ALPHA_WITH,$.GRAY_WITH].includes(i)&&v.visibility===te.VISIBLE&&v.opacity>0&&f.available){var H=null===(d=m[_*R+I])||void 0===d?void 0:d.t;H&&Ci(e,W,V,p.main,{opacity:1,bbox:new Float32Array([0,0,P,O]),t:H})}for(var X=!_&&!I,G=n+s+1,Y=a.length;G<Y;G++){var q=a[G],K=q.node,Q=q.lv,Z=q.total,J=q.next,ee=K.computedStyle;if(o>Q){r.struct.next=G-n-s-1;break}if(G===Y||(ee.breakMask||ee.maskMode)&&o===Q){r.struct.next=G-n-s-1;break}if(uf(ee))G+=Z+J;else{var re=void 0,ie=void 0;if(X){if(o===Q)re=K.tempOpacity=ee.opacity,ie=ot(A,K.matrix);else{var ae=K.parent;re=K.tempOpacity=ee.opacity*ae.tempOpacity,ie=ot(ae.tempMatrix,K.matrix)}ut(K.tempMatrix,ie)}else re=K.tempOpacity,ie=K.tempMatrix;var ne=K.textureTarget;if(!(null==ne?void 0:ne.available)&&K.hasContent&&(K.genTexture(e),ne=K.textureTarget),null==ne?void 0:ne.available){var oe=ee.mixBlendMode;if(!za(ne.bbox,ie,U,z,P,O))continue;for(var se=ne.list,ce=0,ue=se.length;ce<ue;ce++){var le=se[ce],he=le.bbox,de=le.t;if(de&&za(he,ie,U,z,P,O)){var fe=void 0;oe!==j.NORMAL&&(G>n+s+1&&[$.OUTLINE,$.ALPHA,$.GRAY].includes(i)||G>n+s&&[$.ALPHA_WITH,$.GRAY_WITH].includes(i))&&(fe=Si(e,0,void 0,P,O),k?(e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,fe,0),e.viewport(0,0,P,O)):k=La(e,fe,P,O)),Ci(e,W,V,p.main,{opacity:re,matrix:ie,bbox:he,t:de,dx:-U,dy:-z}),oe!==j.NORMAL&&fe&&(N.t=pf(e,N.t,fe,oe,p,P,O))}}}((null==ne?void 0:ne.available)&&ne!==K.textureCache||ee.maskMode)&&(![$.OUTLINE,$.ALPHA_WITH,$.GRAY_WITH].includes(ee.maskMode)||K.next&&!K.next.computedStyle.breakMask)&&(G+=Z+J)}}}var me=Ji.getEmptyInstance(e,g);me.available=!0;var pe=me.list;if(i===$.GRAY||i===$.GRAY_WITH){Va.useProgram(e,p.maskGray);for(_=0,M=E.length;_<M;_++){var ge=E[_],ve=ge.bbox,ye=ge.w,be=ge.h;D=ge.t,fe=void 0;m[_]&&m[_].t&&D&&(fe=Si(e,0,void 0,ye,be),k?(e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,fe,0),e.viewport(0,0,ye,be)):k=La(e,fe,ye,be),m[_]&&m[_].t&&Ui(e,p.maskGray,m[_].t,D)),pe.push({bbox:ve.slice(0),w:ye,h:be,t:fe})}}else{Va.useProgram(e,p.mask);for(_=0,M=E.length;_<M;_++){var xe=E[_],Te=xe.bbox,we=xe.w,ke=xe.h;D=xe.t,fe=Si(e,0,void 0,we,ke);k?(e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,fe,0),e.viewport(0,0,we,ke)):k=La(e,fe,we,ke),Ui(e,p.mask,m[_].t,D),pe.push({bbox:Te.slice(0),w:we,h:ke,t:fe})}}return Va.useProgram(e,p.main),w.release(),S&&S.release(),k?Na(e,k,c,u):e.viewport(0,0,c,u),me}function pf(e,t,r,i,a,n,o){var s;i===j.MULTIPLY?s=a.multiplyProgram:i===j.SCREEN?s=a.screenProgram:i===j.OVERLAY?s=a.overlayProgram:i===j.DARKEN?s=a.darkenProgram:i===j.LIGHTEN?s=a.lightenProgram:i===j.COLOR_DODGE?s=a.colorDodgeProgram:i===j.COLOR_BURN?s=a.colorBurnProgram:i===j.HARD_LIGHT?s=a.hardLightProgram:i===j.SOFT_LIGHT?s=a.softLightProgram:i===j.DIFFERENCE?s=a.differenceProgram:i===j.EXCLUSION?s=a.exclusionProgram:i===j.HUE?s=a.hueProgram:i===j.SATURATION?s=a.saturationProgram:i===j.COLOR?s=a.colorProgram:i===j.LUMINOSITY?s=a.luminosityProgram:(oe.error("Unknown mixBlendMode: "+i),s=a.program),e.useProgram(s);var c=Si(e,0,void 0,n,o);return e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,c,0),Hi(e,s,t,r),e.deleteTexture(t),e.deleteTexture(r),e.useProgram(a.program),c}function gf(e){e.valid=!0;for(var t=e.subList;t.length;){var r=t.pop();r.valid=!0;for(var i=r.subList;i.length;)t.push(i.pop())}}var vf,yf={genTotal:df,genFilter:ff,genMask:function(e){var t=e.root,r=e.computedStyle,i=e.struct;t&&i&&mf(t.ctx,t,e,r.maskMode,t.structs,t.structs.indexOf(i),i.lv,i.total,t.width,t.height)}};function bf(e,t){var r=t.structs,i=t.width,a=t.height,n=t.isWebgl2;!function(e,t,r,i,a,n){var o,s,c,u,l,h=t.structs,d=t.width,f=t.height;t.contentLoadingCount=0;for(var m=[],p=[],g=0,v=h.length;g<v;g++){var y=h[g],b=y.node,x=y.lv,T=y.total,w=y.next,k=b.refreshLevel,S=b.computedStyle,E=b.textureTotal,C=b.textureFilter,A=b.textureMask;b.refreshLevel=ui.NONE,k>=ui.REPAINT&&b.calContent(),t.contentLoadingCount+=b.calContentLoading();var _=S.filter,M=S.opacity,I=S.mixBlendMode,R=S.overflow,P=S.maskMode,O=(M>0&&M<1||I!==j.NORMAL||R===ie.HIDDEN)&&T>0&&!(null==E?void 0:E.available),D=_.map(function(e){return e.u===V.BLOOM?e.threshold>0:e.u===V.SEPIA?e.radius>0&&e.radius<1:e.radius>=1}).filter(function(e){return e}).length>0&&!(null==C?void 0:C.available),B=P>0&&!(null==A?void 0:A.available);if(B&&(b.next&&!b.next.computedStyle.breakMask&&b.next.computedStyle.maskMode===$.NONE||(B=!1,null===(o=b.textureMask)||void 0===o||o.release(),b.textureMask=void 0)),O||D||B){var F={i:g,lv:x,total:T,node:b,valid:!1,subList:[],isNew:!1,isTop:!0};m.push(F),p[g]=F}(null==E?void 0:E.available)&&(g+=T),(null==A?void 0:A.available)&&(g+=w)}m.sort(function(e,t){return e.lv===t.lv?t.i-e.i:t.lv-e.lv});var L=0;for(v=m.length;L<v;L++){g=(U=m[L]).i,T=U.total,b=U.node;var N=U.isNew=!b.tempBbox;b.tempBbox=hf(h,b,g,T,N,U,p)}for(L=0,v=m.length;L<v;L++){b=(U=m[L]).node;var U,z=U.isTop;if(g=U.i,x=U.lv,T=U.total,z&&za(b.tempBbox,b.matrixWorld,r,i,a-r,n-i)&&(gf(U),b.computedStyle.maskMode)){lf(b,h,g,x,T);for(var W=L;W>=0;W--){var H=m[W];if(H.i>g+T+b.struct.next)break;gf(H)}}}for(L=0,v=m.length;L<v;L++){var X=m[L],G=(g=X.i,x=X.lv,T=X.total,b=X.node,X.valid);if(N=X.isNew,P=b.computedStyle.maskMode,G){if(!uf(b.computedStyle)){var Y=void 0;(null===(s=b.textureTotal)||void 0===s?void 0:s.available)||(F=df(e,t,b,h,g,T,d,f))&&!Y&&(b.textureTotal=b.textureTarget=F,Y=F),b.textureTarget&&!(null===(c=b.textureFilter)||void 0===c?void 0:c.available)&&(F=ff(e,t,b,d,f))&&(b.textureFilter=b.textureTarget=F,Y=F),P&&(null===(u=b.textureTarget)||void 0===u?void 0:u.available)&&!(null===(l=b.textureMask)||void 0===l?void 0:l.available)&&b.next&&(F=mf(e,t,b,P,h,g,x,T,d,f))&&(b.textureMask=b.textureTarget=F,Y=F)}}else N&&P&&lf(b,h,g,x,T)}}(e,t,0,0,i,a);var o=.5*i,s=.5*a,c=t.programs,u=c.main,l=c.pr;Va.useProgram(e,u),e.viewport(0,0,i,a);for(var h=[],d=0,f=r.length;d<f;d++){var m=r[d],p=m.node,g=m.total,v=m.next;if(uf(p.computedStyle)){for(var y=d+1;y<d+g;y++){var b=r[y].node;xf(b,y,b.parent)}d+=g+v}else{xf(p,d,p.parent);var x=p._opacity,T=p._matrixWorld,w=p.textureTarget,k=!1;if((null==w?void 0:w.available)?k=Ua(w.bbox,T,i,a):(k=Ua(p._filterBbox||p.filterBbox,T,i,a))&&p.hasContent&&(p.genTexture(e),w=p.textureTarget),k&&(null==w?void 0:w.available))for(var S=w.list,E=0,C=S.length;E<C;E++){var A=S[E],_=A.bbox,M=A.t,I=A.tc;M&&(n?h.push({opacity:x,matrix:T,bbox:_,t:M,tc:I}):Ci(e,o,s,u,{opacity:x,matrix:T,bbox:_,t:M,tc:I}))}(null==w?void 0:w.available)&&w!==p.textureCache&&(d+=g+v)}}n&&(Va.useProgram(e,l),function(e,t,r,i,a){if(a.length){var n=e.createVertexArray();e.bindVertexArray(n);for(var o=Math.floor(a.length/Ai),s=0;s<o;s++)Li(e,t,r,i,a.slice(s*Ai,s*Ai+16));a.length%Ai&&Li(e,t,r,i,a.slice(o*Ai)),e.bindVertexArray(null)}}(e,o,s,l,h),Va.useProgram(e,u))}function xf(e,t,r){var i=!1,a=!1;if(t?(i=e.hasCacheOp&&e.parentOpId===r.localOpId,a=e.hasCacheMw&&e.parentMwId===r.localMwId):(i=e.hasCacheOp,a=e.hasCacheMw),i||(e._opacity=r?r._opacity*e.computedStyle.opacity:e.computedStyle.opacity,r&&(e.parentOpId=r.localOpId),e.hasCacheOp=!0),!a){var n=null==r?void 0:r.perspectiveMatrix,o=e.perspectiveMatrixSelf,s=e.matrix;o&&(s=ot(o,s)),n&&(s=ot(n,s)),ut(e._matrixWorld,r?ot(r._matrixWorld,s):s),r&&(e.parentMwId=r.localMwId),e.hasCacheMw&&e.localMwId++,e.hasCacheMw=!0}}var Tf=function(){function e(){this.task=[],this.now=oe.now(),this.id=0}return e.prototype.init=function(){var e=this,t=this.task;oe.cancelAnimationFrame(this.id);var r=this.now=oe.now(),i=function(){oe.cancelAnimationFrame(e.id),e.id=oe.requestAnimationFrame(function(){var a=e.now=oe.now();if(!vf&&t.length){var n=a-r;n=Math.max(n,0),r=a,t.slice(0).forEach(function(e){e(n)}),t.length&&i()}})};i()},e.prototype.onFrame=function(e){var t=this.task;t.length||this.init(),t.push(e)},e.prototype.offFrame=function(e){var t=this.task,r=t.indexOf(e);r>-1&&t.splice(r,1),t.length||(oe.cancelAnimationFrame(this.id),this.now=0)},e.prototype.nextFrame=function(e){var t=this,r=function(i){e(i),t.offFrame(r)};return this.onFrame(r),r},e.prototype.pause=function(){vf=!0},e.prototype.resume=function(){vf&&(this.init(),vf=!1)},e}(),wf=new Tf;var kf="#define GLSLIFY 1\nattribute vec2 a_position;attribute vec2 a_texCoords;varying vec2 v_texCoords;void main(){gl_Position=vec4(a_position,0,1);v_texCoords=a_texCoords;}",Sf=function(e){function r(t){var r,i=e.call(this,t)||this;t.onMeta&&(i.onMeta=t.onMeta),t.onCanplay&&(i.onCanplay=t.onCanplay),t.onError&&(i.onError=t.onError),t.onWaiting&&(i.onWaiting=t.onWaiting),i._currentTime=t.currentTime||0,i._volumn=Math.max(0,Math.min(1,null!==(r=t.volumn)&&void 0!==r?r:1));var a=i._src=t.src||"";if(a){i._currentTime>=0&&(i.contentLoadingNum=1);var n=i._decoder=new Jd(a);n.on(jd.META,function(e){i._metaData=e,i._currentTime>=0&&i._currentTime<=e.duration?i.contentLoadingNum=1:i.contentLoadingNum=0,i.onMeta&&i.onMeta(e),i.emit(Ia)}),n.on(jd.ERROR,function(e){oe.error(e),i.contentLoadingNum=0,i.onError&&i.onError(e),i.emit(Ra),i.refresh()}),n.on(jd.CANPLAY,function(e){i.contentLoadingNum=0,i.onCanplay&&i.onCanplay(),i.emit(Ma),i.refresh()}),n.on([jd.CANPLAY,jd.AUDIO_BUFFER],function(e){var t=i.root;if(t&&e.audioBuffer){var r=t.audioContext,a=i.timeAnimation;if("running"===(null==a?void 0:a.playState)&&r){var n=a.currentTime-a.delay;if(n>=e.timestamp+e.duration||a.duration<=e.timestamp)return;var o=r.createBufferSource();o.buffer=e.audioBuffer,i.gainNode||(i.gainNode=r.createGain(),i.gainNode.gain.value=i.volumn,i.gainNode.connect(r.destination)),o.connect(i.gainNode),n>=e.audioTimestamp?o.start(0,.001*(n-e.audioTimestamp),.001*(a.duration-n)):o.start(r.currentTime+.001*(e.audioTimestamp-n),0,.001*(a.duration-e.audioTimestamp))}}}),n.start(i._currentTime)}return i}return t(r,e),r.prototype.calContentLoading=function(){var t=e.prototype.calContentLoading.call(this);if(t){if(this._currentTime>=0){if(!this._metaData)return t;if(this._currentTime<this._metaData.duration)return t}return 0}return t},r.prototype.release=function(){e.prototype.release.call(this);var t=this,r=t.loader,i=t.audioBufferSourceNode,a=t.gainNode;(null==r?void 0:r.success)&&r.release(),i&&(i.stop(),i.disconnect(),this.audioBufferSourceNode=void 0),a&&(a.disconnect(),this.gainNode=void 0)},r.prototype.timeAnimate=function(e,t){var r;null===(r=this.timeAnimation)||void 0===r||r.remove();var i=this.timeAnimation=new Ha(this,e,t);return this.initAnimate(i,t)},Object.defineProperty(r.prototype,"src",{get:function(){return this._src},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"currentTime",{get:function(){return this._currentTime},set:function(e){if(this._currentTime!==e){this._currentTime=e;var t=this._decoder;if(t){var r=e,i=t.currentGOP;t.start(r);var a=t.currentGOP;!(null==a?void 0:a.audioBuffer)&&(null==a?void 0:a.state)===Wd.DECODING&&e>=0&&!t.error&&(this._metaData&&this._metaData.duration,this.contentLoadingNum=1),(null==i?void 0:i.audioBuffer)&&!(null==a?void 0:a.audioBuffer)&&this._metaData&&e>=0&&e<this._metaData.duration&&!t.error&&(this.onWaiting&&this.onWaiting(),this.emit(_a))}}},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"duration",{get:function(){var e;return(null===(e=this.loader)||void 0===e?void 0:e.duration)||0},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"metaData",{get:function(){return this._metaData},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"volumn",{get:function(){return this._volumn},set:function(e){var t=Math.max(0,Math.min(1,e));this._volumn!==t&&(this._volumn=t,this.gainNode&&(this.gainNode.gain.value=t))},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"decoder",{get:function(){return this._decoder},enumerable:!1,configurable:!0}),r}(ka),Ef=function(e){function r(t){var r=e.call(this)||this;return r.aniList=[],r.audioContext=t,r}return t(r,e),r.prototype.addAni=function(e){-1===this.aniList.indexOf(e)&&(this.aniList.push(e),1===this.aniList.length&&this.checkEvent())},r.prototype.removeAni=function(e){var t=this.aniList.indexOf(e);t>-1&&(this.aniList.splice(t,1),0===t&&this.checkEvent())},r.prototype.play=function(){this.aniList.forEach(function(e){e.play(),Cf(e)})},r.prototype.pause=function(){this.aniList.forEach(function(e){e.pause(),Af(e)})},r.prototype.resume=function(){this.aniList.forEach(function(e){e.resume(),Cf(e)})},r.prototype.finish=function(){this.aniList.forEach(function(e){e.finish(),Af(e)})},r.prototype.cancel=function(){this.aniList.forEach(function(e){e.cancel(),Af(e)})},r.prototype.gotoAndPlay=function(e){this.aniList.forEach(function(t){t.gotoAndPlay(e),Cf(t)})},r.prototype.gotoAndStop=function(e){this.aniList.forEach(function(t){t.gotoAndStop(e),Af(t)}),this.aniList.forEach(function(e){e.afterRunning()})},r.prototype.checkEvent=function(){var e=this,t=this.aniList[0];t&&Object.keys(this.__eHash).forEach(function(r){e.__eHash[r].forEach(function(e){t.on(r,e)})})},r.prototype.on=function(t,r){e.prototype.on.call(this,t,r),this.aniList.length&&this.aniList[0].on(t,r)},r.prototype.once=function(t,r){e.prototype.once.call(this,t,r),this.aniList.length&&this.aniList[0].once(t,r)},r.prototype.off=function(t,r){e.prototype.off.call(this,t,r),this.aniList.length&&this.aniList[0].off(t,r)},Object.defineProperty(r.prototype,"currentTime",{get:function(){var e=this.aniList[0];return e?e.currentTime:0},set:function(e){this.aniList.forEach(function(t){t.currentTime=e})},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"duration",{get:function(){var e=this.aniList[0];return e?e.delay+e.duration+e.endDelay:0},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"playCount",{get:function(){var e=this.aniList[0];return e?e.playCount:0},set:function(e){this.aniList.forEach(function(t){t.playCount=e})},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"playState",{get:function(){var e=this.aniList[0];return e?e.playState:"idle"},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"pending",{get:function(){var e=this.aniList[0];return!e||"running"!==e.playState},enumerable:!1,configurable:!0}),r}(M);function Cf(e){if(!(e.currentTime>=e.delay+e.duration)&&e instanceof Ha){var t=e.node;if(!(t instanceof Sf||t instanceof ef))return;if(t.gainNode&&(t.gainNode.disconnect(),t.gainNode=void 0),t.decoder){var r=t.decoder.currentGOP;if((null==r?void 0:r.audioBuffer)&&t.root){var i=t.root.audioContext;if(t.gainNode||(t.gainNode=i.createGain(),t.gainNode.gain.value=t.volumn),r.audioBufferSourceNode){try{r.audioBufferSourceNode.stop()}catch(e){}r.audioBufferSourceNode.disconnect(),r.audioBufferSourceNode=void 0}var a=i.createBufferSource();a.buffer=r.audioBuffer,a.connect(t.gainNode),t.gainNode.connect(i.destination),r.audioBufferSourceNode=a;var n=e.currentTime-e.delay;n>=r.audioTimestamp?a.start(0,.001*(n-r.audioTimestamp),.001*(e.duration-n)):a.start(i.currentTime+.001*(r.audioTimestamp-n),0,.001*(e.duration-r.audioTimestamp));for(var o=t.decoder.gopList,s=t.decoder.gopIndex+1,c=o.length;s<c;s++){var u=o[s];if(e.duration<=u.timestamp)return;if(u.audioBufferSourceNode){try{u.audioBufferSourceNode.stop()}catch(e){}u.audioBufferSourceNode.disconnect(),u.audioBufferSourceNode=void 0}if(u.audioBuffer){var l=i.createBufferSource();l.buffer=u.audioBuffer,t.gainNode||(t.gainNode=i.createGain(),t.gainNode.gain.value=t.volumn),l.connect(t.gainNode),t.gainNode.connect(i.destination),u.audioBufferSourceNode=l,l.start(i.currentTime+.001*(u.audioTimestamp-n),0,.001*(e.duration-u.audioTimestamp))}}}}}}function Af(e){var t,r;if(e instanceof Ha){var i=e.node;if(!(i instanceof Sf||i instanceof ef))return;i.gainNode&&(i.gainNode.disconnect(),i.gainNode=void 0),null===(r=null===(t=i.decoder)||void 0===t?void 0:t.gopList)||void 0===r||r.forEach(function(e){var t,r;try{null===(t=e.audioBufferSourceNode)||void 0===t||t.stop()}catch(e){}null===(r=e.audioBufferSourceNode)||void 0===r||r.disconnect(),e.audioBufferSourceNode=void 0})}}var _f,Mf,If,Rf,Pf,Of,Df,Bf,Ff=function(e){function r(t){var r=e.call(this,t)||this;t.onMeta&&(r.onMeta=t.onMeta),t.onLoad&&(r.onLoad=t.onLoad),r._currentTime=t.currentTime||0;var i=function(){var e=window.lottie;if(!e)throw new Error("Missing lottie-web library");r._metaData={duration:1e3*r._json.op/r._json.fr},r.contentLoadingNum=0,r.onMeta&&r.onMeta(r._metaData),r.emit(Ia,r._metaData);var t=document.createElement("div");t.style.width=r._json.w+"px",t.style.height=r._json.h+"px",t.style.position="fixed",t.style.visibility="hidden",t.style.transform="translate(9999px, 9999px)",t.style.pointerEvents="none",document.body.appendChild(t);var i=r._lottie=e.loadAnimation({container:t,renderer:"canvas",loop:!0,autoplay:!0,animationData:r._json,rendererSettings:{preserveDrawingBuffer:!0}});i.addEventListener("DOMLoaded",function(){if(r.canvas=t.querySelector("canvas"),r._currentTime>=0&&r._currentTime<r._metaData.duration&&i.goToAndStop(r._currentTime),r.isMounted){var e=r.style,a=e.left,n=e.top,o=e.right,s=e.bottom,c=e.width,u=e.height;(a.u===V.AUTO||o.u===V.AUTO)&&c.u===V.AUTO||(n.u===V.AUTO||s.u===V.AUTO)&&u.u===V.AUTO?r.refresh(ui.REFLOW):r.refresh()}r.onLoad&&r.onLoad(),r.emit(Pa)})};if(t.src)r._src=t.src,r._currentTime>=0&&(r.contentLoadingNum=1),fetch(t.src,t.options).then(function(e){return e.json()}).then(function(e){r._json=e,i()});else{if(!t.json)throw new Error("Missing src or json in Lottie");r._json=t.json,i()}return r}return t(r,e),r.prototype.lay=function(t){e.prototype.lay.call(this,t);var r=this,i=r.style,a=r.computedStyle,n=r._json,o=i.left,s=i.top,c=i.right,u=i.bottom,l=i.width,h=i.height;if(n){var d=(o.u===V.AUTO||c.u===V.AUTO)&&l.u===V.AUTO,f=(s.u===V.AUTO||u.u===V.AUTO)&&h.u===V.AUTO;d&&(a.width=f?n.w:n.w*a.height/n.h,o.u===V.AUTO&&c.u===V.AUTO?(a.left=0,a.right=t.w-a.width):o.u===V.AUTO?a.left=t.w-a.right-a.width:c.u===V.AUTO&&(a.right=t.w-a.left-a.width)),f&&(a.height=d?n.h:n.h*a.width/n.w,s.u===V.AUTO&&u.u===V.AUTO?(a.top=0,a.bottom=t.h-a.height):s.u===V.AUTO?a.top=t.h-a.bottom-a.height:u.u===V.AUTO&&(a.bottom=t.h-a.top-a.height))}},r.prototype.calContent=function(){return this.hasContent=!1,this._metaData?this._currentTime>=0&&this._currentTime<this._metaData.duration&&(this.hasContent=!0):this.hasContent=this.computedStyle.backgroundColor[3]>0,this.hasContent},r.prototype.renderCanvas=function(){var t=this,r=t._json,i=t._currentTime,a=t._metaData,n=t.canvas,o=t.computedStyle;e.prototype.renderCanvas.call(this);var s=this._bboxInt||this.bboxInt,c=s[0],u=s[1],l=s[2]-c,h=s[3]-u,d=0,f=0,m=o.width,p=o.height,g=o.objectFit;if(r&&n&&a&&i>=0&&i<a.duration){var v=r.w/r.h,y=m/p;if(g===ae.CONTAIN){if(y>v){var b=p*v;d+=.5*(m-b),m=b}else if(y<v){var x=m/v;f+=.5*(p-x),p=x}}else if(g===ae.COVER)if(y>v){var T=m/v;f=.5*(p-T),p=T}else if(y<v){var w=p*v;d=.5*(m-w),m=w}}var k=this.canvasCache=new Ti(l,h,-c,-u);k.available=!0;var S=k.list;if(o.backgroundColor[3]>0){var E=this.getBackgroundCoords(c,u);S.forEach(function(e){var t=e.x,r=e.y,i=e.os.ctx;i.fillStyle=fe(o.backgroundColor),i.beginPath(),ba(i,E,-t,-r),i.closePath(),i.fill()})}for(var C=0,A=S.length;C<A;C++){var _=S[C],M=_.x,I=_.y,R=_.os.ctx,P=-M,O=-I;n&&R.drawImage(n,P+d,O+f,m,p)}},r.prototype.calContentLoading=function(){var t=e.prototype.calContentLoading.call(this);return t?this._currentTime>=0&&this._metaData&&this._currentTime<this._metaData.duration?t:0:t},r.prototype.release=function(){e.prototype.release.call(this);var t=this.lottie;t&&t.destroy()},r.prototype.timeAnimate=function(e,t){var r;null===(r=this.timeAnimation)||void 0===r||r.remove();var i=this.timeAnimation=new Ha(this,e,t);return this.initAnimate(i,t)},Object.defineProperty(r.prototype,"src",{get:function(){return this._src},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"json",{get:function(){return this._json},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"currentTime",{get:function(){return this._currentTime},set:function(e){if(this._currentTime!==e){this._currentTime=e;var t=this._lottie;t&&(t.goToAndStop(e),this.refresh())}},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"duration",{get:function(){var e;return(null===(e=this._metaData)||void 0===e?void 0:e.duration)||0},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"metaData",{get:function(){return this._metaData},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"lottie",{get:function(){return this._lottie},enumerable:!1,configurable:!0}),r}(ka);!function(e){e[e.INIT=0]="INIT",e[e.FRAME=1]="FRAME",e[e.END=2]="END"}(_f||(_f={})),function(e){e[e.PROGRESS=0]="PROGRESS",e[e.FINISH=1]="FINISH",e[e.ERROR=2]="ERROR"}(Mf||(Mf={}));var Lf,Nf=0,Uf=0,zf=[],Wf=0,Vf=0;function Hf(e,t,r){var i=t.numberOfChannels,a=t.sampleRate;if(e&&"configured"===e.state&&r){var n=Math.floor(.001*r*a);if(n>Wf){for(var o=n-Wf,s=new Float32Array(o*zf.length),c=0;c<zf.length;c++){var u=zf[c].subarray(Wf,n);s.set(u,c*o)}var l=new AudioData({format:"f32-planar",sampleRate:a,numberOfFrames:o,numberOfChannels:i,timestamp:Vf,data:s});Wf=n,Vf=r,e.encode(l)}}}var Xf=function(e){return i(void 0,void 0,void 0,function(){var t,r,i,n,o,s,c,u,l,h,d,f,m,p,g,v,y,b,x,T,w,k,S,E,C,A,_,M,I,R,P;return a(this,function(a){switch(a.label){case 0:if(t=e.data,r=t.type,i=t.isWorker,n=function(e){var t={type:Mf.ERROR,error:e};return i&&self.postMessage(t),{data:t}},Nf>=0&&(Lf=new Promise(function(e){Bf=e})),r!==_f.INIT)return[3,2];if(Lf=void 0,Nf=e.data.encoderFrameQue||0,Uf=0,Nf>=0&&(Lf=new Promise(function(e){Bf=e})),If&&(If.close(),If=void 0),Rf&&(Rf.close(),Rf=void 0),o=function(){if(Lf&&(! --Uf||Uf<Nf)){var e={type:Mf.PROGRESS};i&&self.postMessage(e),Bf({data:e})}},s=null===(R=e.data.videoEncoderConfig)||void 0===R?void 0:R.codec,c=void 0,c=/^vp/.test(s)?new kd:new xd,Pf=new Pd({format:c,target:new ld}),/^vp8/.test(s)?Of=new Cd("vp8"):/^vp09\./.test(s)?Of=new Cd("vp9"):/^av01\./.test(s)?Of=new Cd("av1"):/^hev1\./.test(s)||/^hvc1\./.test(s)?Of=new Cd("hevc"):(/^avc1\./.test(s)||/^avc3\./.test(s))&&(Of=new Cd("avc")),Of&&(Pf.addVideoTrack(Of),If=new VideoEncoder({output:function(t,r){var i=ss.fromEncodedChunk(t);Of.add(i,r),Rf&&Hf(Rf,e.data.audioEncoderConfig,.001*t.timestamp),o()},error:function(e){n(e.message)}}),If.configure(e.data.videoEncoderConfig)),u=null===(P=e.data.audioEncoderConfig)||void 0===P?void 0:P.codec,e.data.mute?Df=void 0:/^mp3/.test(u)?Df=new _d("mp3"):/^flac/.test(u)?Df=new _d("flac"):/^opus/.test(u)?Df=new _d("opus"):/^vorbis/.test(u)?Df=new _d("vorbis"):/^pcm-/.test(u)?Df=new _d(u):/^mp4a\./.test(u)?Df=new _d("aac"):/^ulaw/.test(u)?Df=new _d("ulaw"):/^alaw/.test(u)&&(Df=new _d("alaw")),Df){for(Pf.addAudioTrack(Df),Rf=new AudioEncoder({output:function(e,t){var r=ss.fromEncodedChunk(e);Df.add(r,t)},error:function(e){n(e.message)}}),Rf.configure(e.data.audioEncoderConfig),zf.splice(0),l=e.data.audioEncoderConfig.sampleRate*Math.ceil(.001*e.data.duration),g=0;g<e.data.audioEncoderConfig.numberOfChannels;g++)zf.push(new Float32Array(l));Wf=0,Vf=0}return[4,Pf.start()];case 1:return a.sent(),[3,15];case 2:return r!==_f.FRAME?[3,10]:(Uf++,h=e.data.videoFrame,If&&"configured"===If.state&&h?If.encodeQueueSize>5?[4,Xd(100)]:[3,8]:[3,9]);case 3:a.sent(),oe.warn("encodeQueueSize: "+If.encodeQueueSize),g=0,a.label=4;case 4:return g<20?If.encodeQueueSize>5?[4,Xd(100)]:[3,6]:[3,8];case 5:return a.sent(),oe.warn("encodeQueueSize: "+If.encodeQueueSize+", "+g),[3,7];case 6:return[3,8];case 7:return g++,[3,4];case 8:If.encode(h),a.label=9;case 9:if(null==h||h.close(),Rf){if((d=e.data.audioList).length&&d.length)for(f=e.data.audioEncoderConfig,m=f.numberOfChannels,p=f.sampleRate,g=0,v=d.length;g<v;g++)for(y=d[g],b=y.audioChunk,x=y.volume,T=Math.round(.001*b.timestamp*p),w=b.numberOfFrames,k=0;k<m;k++)for(S=zf[k],E=b.channels[k],C=0;C<w;C++)_=S[A=T+C]+E[C]*x,S[A]=Math.max(-1,Math.min(1,_));Hf(Rf,e.data.audioEncoderConfig,e.data.timestamp)}return!Lf||Uf<Nf?(I={type:Mf.PROGRESS},i&&self.postMessage(I),[2,{data:I}]):[2,Lf];case 10:return r!==_f.END?[3,15]:If&&Pf?[4,If.flush()]:[2];case 11:return a.sent(),If.close(),If=void 0,"configured"!==(null==Rf?void 0:Rf.state)?[3,13]:(Hf(Rf,e.data.audioEncoderConfig,e.data.timestamp),[4,Rf.flush()]);case 12:a.sent(),Rf.close(),Rf=void 0,a.label=13;case 13:return[4,Pf.finalize()];case 14:if(a.sent(),M=Pf.target.buffer,Pf=void 0,I={type:Mf.FINISH,buffer:M},!i)return[2,{data:I}];self.postMessage(I,[M]),a.label=15;case 15:return[2]}})})};function jf(e,t,r){return i(this,void 0,void 0,function(){var i,n,o,s,c,u;return a(this,function(a){switch(a.label){case 0:return e.numberOfChannels===t&&e.sampleRate===r?[2,e]:(i=Math.round(e.length*r/e.sampleRate),n=new OfflineAudioContext(t,i,r),o=n.createBufferSource(),1===e.numberOfChannels&&2===t?(s=new OfflineAudioContext(2,e.length,e.sampleRate),c=s.createBuffer(2,e.length,e.sampleRate),u=e.getChannelData(0),c.copyToChannel(u,0,0),c.copyToChannel(u,1,0),o.buffer=c):o.buffer=e,o.connect(n.destination),o.start(0),[4,n.startRendering()]);case 1:return[2,a.sent()]}})})}function Gf(e,t,r){var i=Math.floor(.001*t*e.sampleRate),a=Math.min(Math.ceil(.001*r*e.sampleRate),e.length);if(i>a||i>=e.length)throw new Error("Invalid range");if(0===i&&a>=e.length-1)return e;for(var n=new OfflineAudioContext(e.numberOfChannels,a-i+1,e.sampleRate).createBuffer(e.numberOfChannels,a-i+1,e.sampleRate),o=0;o<e.numberOfChannels;o++){var s=e.getChannelData(o).subarray(i,a+1);n.copyToChannel(s,o,0)}return n}self.onmessage=Xf;var Yf,qf,Kf,$f={stereo2Mono:function(e,t){for(var r=e.length,i=new Float32Array(r),a=0;a<r;a++)i[a]=.5*(e[a]+t[a]);return i},extractAudioBuffer:function(e,t,r){var i=e.sampleRate,a=e.numberOfChannels,n=Math.floor(.001*t*i),o=Math.min(Math.ceil(.001*r*i),e.length),s=o-n;if(!(s<=0)){for(var c=1e3*n/i,u=1e3*s/i,l=[],h=0;h<a;h++){var d=e.getChannelData(h).subarray(n,o);l.push(new Float32Array(d))}return{format:"f32-planar",channels:l,numberOfFrames:s,startFrame:n,endFrame:o,sampleRate:i,numberOfChannels:a,timestamp:c,duration:u}}},reSample:jf,sliceAudioBuffer:Gf,convertS16ToFloat32:function(e,t){var r=new Int16Array(e instanceof ArrayBuffer?e:e.buffer);r.length!==t&&console.error("数据长度校验失败:预期 ".concat(t," 个样本,实际 Int16Array 长度为 ").concat(r.length,"。"));for(var i=new Float32Array(t),a=0;a<t;a++){var n=r[a];i[a]=n/32768}return i}},Qf=0;!function(e){e.START="start",e.PROGRESS="progress",e.FINISH="finish",e.ERROR="error"}(Kf||(Kf={}));var Zf=function(e){function r(){return e.call(this)||this}return t(r,e),r.prototype.initWorker=function(){if(!Yf)if(L.encoderWorker)Yf=new Worker(L.encoderWorker);else if(L.encoderWorkerStr){var e=new Blob([L.encoderWorkerStr.trim()],{type:"application/javascript"}),t=URL.createObjectURL(e);Yf=new Worker(t)}},r.prototype.start=function(e,t){return i(this,void 0,void 0,function(){var r,n,o,s,c,u,l,h,d,f,m,p,g,v=this;return a(this,function(y){switch(y.label){case 0:if(!e.canvas)throw new Error("Root Missing appendTo canvas");return this.initWorker(),r=Object.assign({codec:"avc1.420028",width:e.width,height:e.height,bitrate:5e6,bitrateMode:"variable",framerate:30,hardwareAcceleration:"no-preference"},null==t?void 0:t.video),[4,VideoEncoder.isConfigSupported(r)];case 1:if(!(n=y.sent())||!n.supported)throw new Error("Unsupported video encoder config");return o=Object.assign({codec:"opus",sampleRate:44100,numberOfChannels:2},null==t?void 0:t.audio),s=(null==t?void 0:t.timestamp)||0,(c=(null==t?void 0:t.duration)||e.aniController.duration)&&r.framerate?(u=1e3/r.framerate,l=Math.ceil((c-s)/u),h=Math.floor(s/u),d={type:_f.INIT,messageId:Qf++,isWorker:!!L.encoderWorker||!!L.encoderWorkerStr,duration:c,num:l,videoEncoderConfig:r,audioEncoderConfig:o,mute:L.mute,encoderFrameQue:L.encoderFrameQue},Yf?(Yf.postMessage(d),[3,4]):[3,2]):[2];case 2:return[4,Xf({data:d})];case 3:y.sent(),y.label=4;case 4:this.emit(Kf.START,l),f={},m=function(t){var r;return a(this,function(n){switch(n.label){case 0:return r=(t+h)*u,e.aniController.gotoAndStop(r),p.emit(Kf.PROGRESS,t,l,!0),[4,new Promise(function(n,s){var c=function(){return i(v,void 0,void 0,function(){var i,c,h,d,m,p,g,v,y,b,x,T,w,k,S,E,C,A,_,M,I,R=this;return a(this,function(a){switch(a.label){case 0:return[4,createImageBitmap(e.canvas)];case 1:if(i=a.sent(),c=new VideoFrame(i,{timestamp:1e3*r,duration:1e3*u}),h=[],L.mute)return[3,5];d=0,m=e.aniController.aniList.length,a.label=2;case 2:return d<m?(p=e.aniController.aniList[d],g=p.delay,v=p.duration,p instanceof Ha&&p.currentTime>=g&&p.currentTime<v+g?(y=p.node)instanceof Ff||!y.volumn?[3,4]:(b=y.decoder)&&(x=b.currentGOP)&&(T=x.audioBuffer)?(w=y.id+"-"+x.index,f[w]?[3,4]:(f[w]=!0,k=x.audioTimestamp-x.timestamp,[4,jf(Gf(T,0,p.duration-x.audioTimestamp),o.numberOfChannels,o.sampleRate)])):[3,4]:[3,4]):[3,5];case 3:for(S=a.sent(),E=[],C=0;C<o.numberOfChannels;C++)A=S.getChannelData(C),E.push(A);h.push({audioChunk:{format:"f32-planar",channels:E,sampleRate:o.sampleRate,numberOfChannels:o.numberOfChannels,numberOfFrames:S.length,timestamp:r+k,duration:1e3*S.duration},volume:y.volumn}),a.label=4;case 4:return d++,[3,2];case 5:return _=function(e){e.data.type===Mf.PROGRESS?(n(),R.emit(Kf.PROGRESS,t,l,!1)):(s(e.data.error),R.emit(Kf.ERROR,e.data.error))},M={type:_f.FRAME,messageId:Qf++,isWorker:!!L.encoderWorker||!!L.encoderWorkerStr,timestamp:r,videoFrame:c,audioList:h,audioEncoderConfig:o,mute:L.mute},(I=[]).push(c),h.forEach(function(e){e.audioChunk.channels.forEach(function(e){I.push(e.buffer)})}),Yf?(Yf.onmessage=_,Yf.postMessage(M,I)):Xf({data:M}).then(function(e){_(e)}),[2]}})})};e.contentLoadingCount?e.once(Ma,c):e.rl?e.once(Aa,c):c()})];case 1:return n.sent(),[2]}})},p=this,g=0,y.label=5;case 5:return g<l?[5,m(g)]:[3,8];case 6:y.sent(),y.label=7;case 7:return g++,[3,5];case 8:return[2,new Promise(function(e){var t=function(t){t.data.type===Mf.FINISH&&e(t.data.buffer),v.emit(Kf.FINISH)},i={type:_f.END,messageId:Qf++,isWorker:!!L.encoderWorker||!!L.encoderWorkerStr,videoEncoderConfig:r,audioEncoderConfig:o,timestamp:s+u};Yf?(Yf.onmessage=t,Yf.postMessage(i)):Xf({data:i}).then(function(e){t(e)})})]}})})},r.getInstance=function(){return qf||(qf=new r),qf},r}(M),Jf=function(e){function r(t,r){void 0===r&&(r=[]);var i=e.call(this,t,r)||this;return i.root=i,i.refs={},i.structs=[],i.task=[],i.aniTask=[],i.rl=ui.NONE,i.programs={},i.frameCb=function(e){var t=i.aniTask.slice(0);t.forEach(function(t){t.onRunning(e)});var r=i.task.splice(0);r.length&&i.draw(),t.forEach(function(e){e.afterRunning()}),r.forEach(function(e){e&&e(!1)}),i.task.length||i.aniTask.length||wf.offFrame(i.frameCb)},i.audioContext=new AudioContext,i.aniController=new Ef(i.audioContext),i.contentLoadingCount=0,i.lastContentLoadingCount=0,i.firstDraw=!0,i}return t(r,e),r.prototype.appendTo=function(e){this.canvas=e;var t=Object.assign(Fa,this.props.contextAttributes),r=e.getContext("webgl2",t);if(r?this.isWebgl2=!0:(r=e.getContext("webgl",t),this.isWebgl2=!1),!r)throw new Error("Webgl unsupported!");this.appendToGl(r)},r.prototype.appendToGl=function(e){this.ctx?oe.error("Duplicate appendToGl"):(this.ctx=e,L.init(e.getParameter(e.MAX_TEXTURE_SIZE),e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),e.getParameter(e.MAX_VARYING_VECTORS)),this.initProgram(e),this.reLayout(),this.didMount(),this.structs=this.structure(0),this.asyncDraw())},r.prototype.reLayout=function(){this.checkRoot(),this.layout({w:this.computedStyle.width,h:this.computedStyle.height})},r.prototype.checkRoot=function(){var e,t=this.style,r=t.width,i=t.height,a=this.canvas;r.u===V.AUTO?a&&(r.u=V.PX,this.computedStyle.width=r.v=Math.max(1,a.width)):this.computedStyle.width=Math.max(1,this.style.width.v),i.u===V.AUTO?a&&(i.u=V.PX,this.computedStyle.height=i.v=Math.max(1,a.height)):this.computedStyle.height=Math.max(1,this.style.height.v),null===(e=this.ctx)||void 0===e||e.viewport(0,0,this.computedStyle.width,this.computedStyle.height)},r.prototype.addUpdate=function(e,t,r,i){if(void 0===r&&(r=ui.NONE),!this.isMounted)return ui.NONE;var a=r;if(t&&t.length)for(var n=0,o=t.length;n<o;n++){a|=hi(t[n])}return this.calUpdate(e,a)?this.asyncDraw(i):i&&i(!0),a},r.prototype.calUpdate=function(e,t){if(t===ui.NONE||!this.isMounted)return!1;var r=function(e){return e>=ui.REFLOW}(t);if(r)e===this?this.reLayout():function(e,t){var r=e.parent;t&ui.REMOVE_DOM?e.didUnmount():(e.layout({w:r.computedStyle.width,h:r.computedStyle.height}),t&ui.ADD_DOM&&e.didMount())}(e,t);else if(t>=ui.REPAINT)e.calRepaintStyle(t);else{var i=e.style,a=e.computedStyle;t&ui.TRANSFORM_ALL&&e.calMatrix(t),t&(ui.PERSPECTIVE|ui.TRANSLATE|ui.TRANSFORM_ALL)&&e.calPerspective(),t&(ui.PERSPECTIVE_SELF|ui.TRANSLATE|ui.TRANSFORM_ORIGIN|ui.TRANSFORM_ALL)&&e.calPerspectiveSelf(),t&ui.OPACITY&&e.calOpacity(),t&ui.FILTER&&e.calFilter(t),t&ui.MIX_BLEND_MODE&&(a.mixBlendMode=i.mixBlendMode.v);var n=!1;if(t&ui.MASK&&(e.clearMask(),n=!0,e.calMask()),t&ui.BREAK_MASK){var o=e.mask;e.calMask();var s=e.mask;if(a.breakMask&&o?o.clearMask():!a.breakMask&&s||(t&=ui.FULL^ui.BREAK_MASK),!a.breakMask||o)for(var c=e.prev;c;){if(c.computedStyle.maskMode){c.clearMask();break}if(c.computedStyle.breakMask)break;c=c.prev}}a.maskMode&&!n&&t&&e.clearMask()}e.clearTexCacheUpward(),e.refreshLevel|=t,this.rl|=t;var u=e.mask;!u||t&ui.MASK||t&ui.BREAK_MASK||u.clearMask();for(var l=e.parent;l;){if(l.computedStyle.visibility===te.HIDDEN)return!1;l=l.parent}return t>ui.NONE},r.prototype.asyncDraw=function(e){var t=this.task,r=this.aniTask;t.length||r.length||wf.onFrame(this.frameCb),t.push(e)},r.prototype.cancelAsyncDraw=function(e){var t=this.task,r=this.aniTask,i=t.indexOf(e);i>-1&&(t.splice(i,1),t.length||r.length||wf.offFrame(this.frameCb))},r.prototype.addAnimation=function(e){var t=this.task,r=this.aniTask;t.length||r.length||wf.onFrame(this.frameCb),-1===r.indexOf(e)&&r.push(e)},r.prototype.removeAnimation=function(e){var t=this.task,r=this.aniTask,i=r.indexOf(e);i>-1&&(r.splice(i,1),t.length||r.length||wf.offFrame(this.frameCb))},r.prototype.draw=function(){this.isMounted&&(this.rl>ui.NONE&&(this.clear(),this.rl=ui.NONE,this.ctx&&(bf(this.ctx,this),this.emit("refresh"),this.contentLoadingCount?this.lastContentLoadingCount||this.emit(_a):((this.lastContentLoadingCount||this.firstDraw)&&this.emit(Ma),this.emit(Aa)),this.lastContentLoadingCount=this.contentLoadingCount,this.firstDraw=!1)))},r.prototype.clear=function(){var e=this.ctx;e&&(e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT))},r.prototype.initProgram=function(e){var t=this.isWebgl2;this.programs.main=new Va(e,wi(e,"#define GLSLIFY 1\nattribute vec4 a_position;varying vec4 v_position;attribute vec2 a_texCoords;varying vec2 v_texCoords;void main(){gl_Position=vec4(a_position.xy,0,a_position.z);v_position=gl_Position;v_texCoords=a_texCoords;}","#ifdef GL_ES\nprecision mediump float;\n#define GLSLIFY 1\n#endif\nvarying vec4 v_position;varying vec2 v_texCoords;uniform float u_opacity;uniform sampler2D u_texture;void main(){if(u_opacity<=0.0){discard;}vec4 color=texture2D(u_texture,v_texCoords);if(color.a<=0.0){discard;}gl_FragColor=color*u_opacity;}"),{uniform:["u_clip","u_texture","u_opacity"],attrib:["a_position","a_texCoords"]}),t&&(this.programs.pr=new Va(e,wi(e,"#version 300 es\n#define GLSLIFY 1\nin vec3 a_position;in vec2 a_texCoords;in float a_opacity;in float a_textureIndex;in vec4 a_clip;out vec4 v_position;out vec2 v_texCoords;out float v_opacity;out float v_textureIndex;out vec4 v_clip;void main(){gl_Position=vec4(a_position.xy,0,a_position.z);v_position=gl_Position;v_texCoords=a_texCoords;v_opacity=a_opacity;v_textureIndex=a_textureIndex;v_clip=a_clip;}","#version 300 es\n#ifdef GL_ES\nprecision mediump float;\n#define GLSLIFY 1\n#endif\nin vec4 v_position;in vec2 v_texCoords;in float v_opacity;in float v_textureIndex;out vec4 fragColor;uniform sampler2D u_texture[16];void main(){if(v_opacity<=0.0){discard;}vec4 color;if(v_textureIndex==0.0){color=texture(u_texture[0],v_texCoords);}else if(v_textureIndex==1.0){color=texture(u_texture[1],v_texCoords);}else if(v_textureIndex==2.0){color=texture(u_texture[2],v_texCoords);}else if(v_textureIndex==3.0){color=texture(u_texture[3],v_texCoords);}else if(v_textureIndex==4.0){color=texture(u_texture[4],v_texCoords);}else if(v_textureIndex==5.0){color=texture(u_texture[5],v_texCoords);}else if(v_textureIndex==6.0){color=texture(u_texture[6],v_texCoords);}else if(v_textureIndex==7.0){color=texture(u_texture[7],v_texCoords);}else if(v_textureIndex==8.0){color=texture(u_texture[8],v_texCoords);}else if(v_textureIndex==9.0){color=texture(u_texture[9],v_texCoords);}else if(v_textureIndex==10.0){color=texture(u_texture[10],v_texCoords);}else if(v_textureIndex==11.0){color=texture(u_texture[11],v_texCoords);}else if(v_textureIndex==12.0){color=texture(u_texture[12],v_texCoords);}else if(v_textureIndex==13.0){color=texture(u_texture[13],v_texCoords);}else if(v_textureIndex==14.0){color=texture(u_texture[14],v_texCoords);}else if(v_textureIndex==15.0){color=texture(u_texture[15],v_texCoords);}fragColor=color*v_opacity;}"),{uniform:["u_texture[0]","u_texture[1]","u_texture[2]","u_texture[3]","u_texture[4]","u_texture[5]","u_texture[6]","u_texture[7]","u_texture[8]","u_texture[9]","u_texture[10]","u_texture[11]","u_texture[12]","u_texture[13]","u_texture[14]","u_texture[15]"],attrib:["a_position","a_texCoords","a_opacity","a_clip","a_textureIndex"]})),this.programs.box=new Va(e,wi(e,kf,"#ifdef GL_ES\nprecision mediump float;\n#define GLSLIFY 1\n#endif\nvarying vec2 v_texCoords;uniform sampler2D u_texture;uniform float u_pw;uniform float u_ph;uniform int u_r;uniform int u_direction;const int MAX_KERNEL_SIZE=1024;void main(){vec4 color=texture2D(u_texture,v_texCoords);float total=1.0;if(u_r==0){if(u_direction==0){color+=texture2D(u_texture,vec2(v_texCoords.x+u_pw,v_texCoords.y))*0.125;color+=texture2D(u_texture,vec2(v_texCoords.x-u_pw,v_texCoords.y))*0.125;}else{color+=texture2D(u_texture,vec2(v_texCoords.x,v_texCoords.y+u_ph))*0.125;color+=texture2D(u_texture,vec2(v_texCoords.x,v_texCoords.y-u_ph))*0.125;}total+=0.25;}else{for(int i=1;i<MAX_KERNEL_SIZE;i++){if(u_direction==0){float offset=float(i)*u_pw;color+=texture2D(u_texture,vec2(v_texCoords.x+offset,v_texCoords.y));color+=texture2D(u_texture,vec2(v_texCoords.x-offset,v_texCoords.y));}else{float offset=float(i)*u_ph;color+=texture2D(u_texture,vec2(v_texCoords.x,v_texCoords.y+offset));color+=texture2D(u_texture,vec2(v_texCoords.x,v_texCoords.y-offset));}total+=2.0;if(i>=u_r){break;}}}gl_FragColor=color/total;}"),{uniform:["u_texture","u_pw","u_ph","u_r","u_direction"],attrib:["a_position","a_texCoords"]}),this.programs.dualDown=new Va(e,wi(e,kf,"#ifdef GL_ES\nprecision mediump float;\n#define GLSLIFY 1\n#endif\nvarying vec2 v_texCoords;uniform vec2 u_xy;uniform sampler2D u_texture;void main(){vec4 color=texture2D(u_texture,v_texCoords);color+=texture2D(u_texture,v_texCoords+vec2(u_xy.x,u_xy.y))*0.125;color+=texture2D(u_texture,v_texCoords+vec2(u_xy.x,-u_xy.y))*0.125;color+=texture2D(u_texture,v_texCoords+vec2(-u_xy.x,u_xy.y))*0.125;color+=texture2D(u_texture,v_texCoords+vec2(-u_xy.x,-u_xy.y))*0.125;gl_FragColor=color;}"),{uniform:["u_xy","u_texture"],attrib:["a_position","a_texCoords"]}),this.programs.dualUp=new Va(e,wi(e,kf,"#ifdef GL_ES\nprecision mediump float;\n#define GLSLIFY 1\n#endif\nvarying vec2 v_texCoords;uniform float u_x;uniform float u_y;uniform sampler2D u_texture;void main(){vec4 color=texture2D(u_texture,v_texCoords+vec2(u_x,u_y)*0.5)*2.0;color+=texture2D(u_texture,v_texCoords+vec2(u_x,-u_y)*0.5)*2.0;color+=texture2D(u_texture,v_texCoords+vec2(-u_x,u_y)*0.5)*2.0;color+=texture2D(u_texture,v_texCoords+vec2(-u_x,-u_y)*0.5)*2.0;color+=texture2D(u_texture,v_texCoords+vec2(u_x,0.0));color+=texture2D(u_texture,v_texCoords+vec2(-u_x,0.0));color+=texture2D(u_texture,v_texCoords+vec2(0.0,u_y));color+=texture2D(u_texture,v_texCoords+vec2(0.0,-u_y));gl_FragColor=color/12.0;}"),{uniform:["u_x","u_y","u_texture"],attrib:["a_position","a_texCoords"]}),this.programs.motion=new Va(e,wi(e,kf,"#ifdef GL_ES\nprecision mediump float;\n#define GLSLIFY 1\n#endif\nvarying vec2 v_texCoords;uniform sampler2D u_texture;uniform int u_kernel;uniform vec4 u_velocity;uniform int u_limit;const int MAX_KERNEL_SIZE=1024;void main(){vec4 color=texture2D(u_texture,v_texCoords+u_velocity.zw);for(int i=1;i<MAX_KERNEL_SIZE;i++){if(i>=u_kernel){break;}vec2 bias=u_velocity.xy*(float(i)/float(u_kernel));vec2 c1=v_texCoords+bias+u_velocity.zw;vec2 c2=v_texCoords-bias+u_velocity.zw;if(u_limit==1){if(c1.x<0.0){c1.x+=1.0;}else if(c1.x>1.0){c1.x-=1.0;}if(c1.y<0.0){c1.y+=1.0;}else if(c1.y>1.0){c1.y-=1.0;}if(c2.x<0.0){c2.x+=1.0;}else if(c2.x>1.0){c2.x-=1.0;}if(c2.y<0.0){c2.y+=1.0;}else if(c2.y>1.0){c2.y-=1.0;}}color+=texture2D(u_texture,c1);color+=texture2D(u_texture,c2);}gl_FragColor=color/float((u_kernel-1)*2+1);}"),{uniform:["u_kernel","u_velocity","u_texture","u_limit"],attrib:["a_position","a_texCoords"]}),this.programs.radial=new Va(e,wi(e,kf,"#ifdef GL_ES\nprecision mediump float;\n#define GLSLIFY 1\n#endif\nvarying vec2 v_texCoords;uniform sampler2D u_texture;uniform int u_kernel;uniform vec2 u_center;uniform float u_ratio;const int MAX_KERNEL_SIZE=1024;void main(void){if(v_texCoords.x==u_center.x&&v_texCoords.y==u_center.y){gl_FragColor=texture2D(u_texture,v_texCoords);return;}vec4 color=texture2D(u_texture,v_texCoords);int k=u_kernel-1;float total=1.0;for(int i=1;i<MAX_KERNEL_SIZE-1;i++){if(i>=k){break;}total++;vec2 velocity=-(v_texCoords-u_center)*u_ratio;vec2 bias=velocity*(float(i)/float(k));color+=texture2D(u_texture,v_texCoords+bias);}gl_FragColor=color/total;}"),{uniform:["u_kernel","u_center","u_ratio","u_texture"],attrib:["a_position","a_texCoords"]}),this.programs.cm=new Va(e,wi(e,kf,"#ifdef GL_ES\nprecision mediump float;\n#define GLSLIFY 1\n#endif\nvarying vec2 v_texCoords;uniform sampler2D u_texture;uniform float u_m[20];void main(){vec4 c=texture2D(u_texture,v_texCoords);if(c.a>0.0){c.rgb/=c.a;}vec4 result;result.r=(u_m[0]*c.r);result.r+=(u_m[1]*c.g);result.r+=(u_m[2]*c.b);result.r+=(u_m[3]*c.a);result.r+=u_m[4];result.g=(u_m[5]*c.r);result.g+=(u_m[6]*c.g);result.g+=(u_m[7]*c.b);result.g+=(u_m[8]*c.a);result.g+=u_m[9];result.b=(u_m[10]*c.r);result.b+=(u_m[11]*c.g);result.b+=(u_m[12]*c.b);result.b+=(u_m[13]*c.a);result.b+=u_m[14];result.a=(u_m[15]*c.r);result.a+=(u_m[16]*c.g);result.a+=(u_m[17]*c.b);result.a+=(u_m[18]*c.a);result.a+=u_m[19];gl_FragColor=vec4(result.rgb*result.a,result.a);}"),{uniform:["u_m","u_m[0]","u_texture"],attrib:["a_position","a_texCoords"]}),this.programs.mask=new Va(e,wi(e,kf,"#ifdef GL_ES\nprecision mediump float;\n#define GLSLIFY 1\n#endif\nvarying vec2 v_texCoords;uniform sampler2D u_texture1;uniform sampler2D u_texture2;void main(){vec4 color1=texture2D(u_texture1,v_texCoords);if(color1.a<=0.0){discard;}vec4 color2=texture2D(u_texture2,v_texCoords);if(color2.a<=0.0){discard;}gl_FragColor=color2*color1.a;}"),{uniform:["u_texture1","u_texture2"],attrib:["a_position","a_texCoords"]}),this.programs.maskGray=new Va(e,wi(e,kf,"#ifdef GL_ES\nprecision mediump float;\n#define GLSLIFY 1\n#endif\nvarying vec2 v_texCoords;uniform sampler2D u_texture1;uniform sampler2D u_texture2;uniform vec2 u_d;void main(){vec4 color1=texture2D(u_texture1,v_texCoords);if(color1.a<=0.0){discard;}vec4 color2=texture2D(u_texture2,v_texCoords+u_d);if(color2.a<=0.0){discard;}float gray=max(color1.r,max(color1.g,color1.b));gl_FragColor=color2*color1.a*gray;}"),{uniform:["u_texture1","u_texture2","u_d"],attrib:["a_position","a_texCoords"]}),this.programs.bloom=new Va(e,wi(e,kf,"#ifdef GL_ES\nprecision mediump float;\n#define GLSLIFY 1\n#endif\nvarying vec2 v_texCoords;uniform sampler2D u_texture1;uniform sampler2D u_texture2;vec3 ACESFilm(vec3 x){float a=2.51;float b=0.03;float c=2.43;float d=0.59;float e=0.14;return clamp((x*(a*x+b))/(x*(c*x+d)+e),0.0,1.0);}void main(){vec3 sceneColor=texture2D(u_texture1,v_texCoords).rgb;sceneColor=pow(sceneColor,vec3(2.2));vec3 bloomColor=texture2D(u_texture2,v_texCoords).rgb;vec3 result=sceneColor+bloomColor;result=ACESFilm(result);result=pow(result,vec3(1.0/2.2));gl_FragColor=vec4(result,1.0);}"),{uniform:["u_texture1","u_texture2","u_threshold"],attrib:["a_position","a_texCoords"]}),this.programs.bloomBlur=new Va(e,wi(e,kf,"#ifdef GL_ES\nprecision mediump float;\n#define GLSLIFY 1\n#endif\nvarying vec2 v_texCoords;uniform sampler2D u_texture;uniform float u_threshold;uniform float u_knee;void main(){vec4 color=texture2D(u_texture,v_texCoords);vec3 linearColor=pow(color.rgb,vec3(2.2));float brightness=dot(linearColor,vec3(0.299,0.587,0.114));float k=u_threshold*u_knee;float soft=brightness-u_threshold+k;soft=clamp(soft,0.0,2.0*k);soft=(soft*soft)/(4.0*k+0.0001);float factor=max(soft,brightness-u_threshold)/max(brightness,0.0001);vec3 brightPart=linearColor*factor;gl_FragColor=vec4(brightPart,1.0);}"),{uniform:["u_texture","u_threshold"],attrib:["a_position","a_texCoords"]}),this.programs.dualDown13=new Va(e,wi(e,kf,"#ifdef GL_ES\nprecision mediump float;\n#define GLSLIFY 1\n#endif\nvarying vec2 v_texCoords;uniform vec2 u_xy;uniform sampler2D u_texture;void main(){vec4 color=texture2D(u_texture,v_texCoords)*0.125;color+=texture2D(u_texture,v_texCoords+vec2(u_xy.x,u_xy.y))*0.125;color+=texture2D(u_texture,v_texCoords+vec2(u_xy.x,-u_xy.y))*0.125;color+=texture2D(u_texture,v_texCoords+vec2(-u_xy.x,u_xy.y))*0.125;color+=texture2D(u_texture,v_texCoords+vec2(-u_xy.x,-u_xy.y))*0.125;color+=texture2D(u_texture,v_texCoords+vec2(u_xy.x*2.0,u_xy.y*2.0))*0.03125;color+=texture2D(u_texture,v_texCoords+vec2(u_xy.x*2.0,-u_xy.y*2.0))*0.03125;color+=texture2D(u_texture,v_texCoords+vec2(-u_xy.x*2.0,u_xy.y*2.0))*0.03125;color+=texture2D(u_texture,v_texCoords+vec2(-u_xy.x*2.0,-u_xy.y*2.0))*0.03125;color+=texture2D(u_texture,v_texCoords+vec2(u_xy.x*2.0,0))*0.0625;color+=texture2D(u_texture,v_texCoords+vec2(-u_xy.x*2.0,0))*0.0625;color+=texture2D(u_texture,v_texCoords+vec2(0,u_xy.y*2.0))*0.0625;color+=texture2D(u_texture,v_texCoords+vec2(0,-u_xy.y*2.0))*0.0625;gl_FragColor=color;}"),{uniform:["u_xy","u_texture"],attrib:["a_position","a_texCoords"]}),this.programs.dualUp13=new Va(e,wi(e,kf,"#ifdef GL_ES\nprecision mediump float;\n#define GLSLIFY 1\n#endif\nvarying vec2 v_texCoords;uniform vec2 u_xy;uniform sampler2D u_texture1;uniform sampler2D u_texture2;void main(){vec4 color1=texture2D(u_texture1,v_texCoords);vec4 color2=texture2D(u_texture2,v_texCoords)*0.25;color2+=texture2D(u_texture2,v_texCoords+vec2(u_xy.x,u_xy.y))*0.125;color2+=texture2D(u_texture2,v_texCoords+vec2(u_xy.x,-u_xy.y))*0.125;color2+=texture2D(u_texture2,v_texCoords+vec2(-u_xy.x,u_xy.y))*0.125;color2+=texture2D(u_texture2,v_texCoords+vec2(-u_xy.x,-u_xy.y))*0.125;color2+=texture2D(u_texture2,v_texCoords+vec2(u_xy.x,0))*0.0625;color2+=texture2D(u_texture2,v_texCoords+vec2(-u_xy.x,0))*0.0625;color2+=texture2D(u_texture2,v_texCoords+vec2(0,u_xy.y))*0.0625;color2+=texture2D(u_texture2,v_texCoords+vec2(0,-u_xy.y))*0.0625;gl_FragColor=vec4(color1.rgb+color2.rgb*0.6,1.0);}"),{uniform:["u_xy","u_texture1","u_texture2"],attrib:["a_position","a_texCoords"]}),this.programs.lightDark=new Va(e,wi(e,kf,"#ifdef GL_ES\nprecision mediump float;\n#define GLSLIFY 1\n#endif\nvarying vec2 v_texCoords;uniform sampler2D u_texture;uniform vec2 u_velocity;uniform int u_radius;const int MAX_KERNEL_SIZE=1024;void main(){vec4 color=texture2D(u_texture,v_texCoords);float total=float(u_radius);for(int i=1;i<MAX_KERNEL_SIZE;i++){if(i>u_radius){break;}vec2 bias=u_velocity.xy*float(i);vec2 bias1=v_texCoords+bias;vec2 bias2=v_texCoords-bias;float add=0.0;float reduce=0.0;if(bias1.x<0.0||bias1.x>1.0||bias1.y<0.0||bias1.y>1.0){add=1.0;}else{add=1.0-texture2D(u_texture,bias1).a;}if(bias2.x<0.0||bias2.x>1.0||bias2.y<0.0||bias2.y>1.0){reduce=-1.0;}else{reduce=texture2D(u_texture,bias2).a-1.0;}if(add>0.0){float f=(total-float(i))/total/total;color.r+=add*f;color.g+=add*f;color.b+=add*f;}if(reduce<0.0){float f=(total-float(i))/total/total;color.r+=reduce*f;color.g+=reduce*f;color.b+=reduce*f;}}gl_FragColor=vec4(clamp(0.0,color.r,1.0),clamp(0.0,color.g,1.0),clamp(0.0,color.b,1.0),color.a);}"),{uniform:["u_texture","u_velocity","u_radius"],attrib:["a_position","a_texCoords"]}),Va.useProgram(e,this.programs.main)},r.prototype.encode=function(e){return i(this,void 0,void 0,function(){return a(this,function(t){return[2,Zf.getInstance().start(this,e)]})})},r}(Ba),em=function(){function e(e,t,r,i,a){void 0===i&&(i=!1),void 0===a&&(a=!1),this.x=0,this.y=e,this.w=0,this.h=t,this.index=r,this.list=[],this.startEnter=i,this.endEnter=a}return e.prototype.add=function(e){this.list.push(e),this.w+=e.w},e.prototype.verticalAlign=function(){for(var e=this.baseline,t=this.list,r=0,i=t.length;r<i;r++){var a=t[r],n=a.baseline;if(n!==e){var o=e-n;a.y+=o}}},e.prototype.offsetX=function(e){this.x+=e;for(var t=this.list,r=0,i=t.length;r<i;r++)t[r].x+=e},e.prototype.offsetY=function(e){this.y+=e;for(var t=this.list,r=0,i=t.length;r<i;r++)t[r].y+=e},Object.defineProperty(e.prototype,"size",{get:function(){return this.list.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseline",{get:function(){for(var e=0,t=this.list,r=0,i=t.length;r<i;r++)e=Math.max(e,t[r].baseline);return e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lineHeight",{get:function(){var e=this.list;if(e.length){for(var t=0,r=0,i=e.length;r<i;r++)t=Math.max(t,e[r].lineHeight);return t}return this.h},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return Math.ceil(this.w)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return Math.ceil(this.lineHeight)},enumerable:!1,configurable:!0}),e}(),tm=function(e,t,r,i,a,n,o,s,c,u,l,h,d,f,m,p,g,v){this.x=e,this.y=t,this.w=r,this.lineHeight=i,this.baseline=a,this.contentArea=n,this.index=o,this.str=s,this.font=c,this.fontFamily=u,this.fontSize=l,this.color=h,this.letterSpacing=d,this.textDecoration=f,this.textShadow=m,this.stroke=p,this.strokeWidth=g,this.strokeEnable=v};function rm(e){return"\n"===e||"\u2028"===e}function im(e,t,r,i,a,n,o){var s=t,c=r,u=0,l=!1,h=Math.round(a/n);for(h<=0?h=1:h>r-t&&(h=r-t);s<c;){var d=e.measureText(i.slice(t,t+h)).width;if(d===a){u=a,l=!0;break}if(d>a+1e-10){if(l=!0,1===h){u=d;break}if(s===c-1||s-t===h-1){h=s-t;break}c=h+t-1;var f=Math.round((d-a)/n);f<=0&&(f=1),(h-=f)<s-t&&(h=s-t)}else{if(u=d,h===r-t)break;s=h+t;var m=Math.round((a-d)/n);m<=0&&(m=1),(h+=m)>c-t&&(h=c-t)}}for(var p=t,g=t+h;p<g;p++)if(rm(i.charAt(p)))return{hypotheticalNum:h=p-t,rw:u=e.measureText(i.slice(t,t+h)).width,newLine:l=!1};if(t+h<r&&/[\w.-]/.test(i.charAt(t+h-1)))for(var v=t+h-2;v>t;v--)if(!/[\w.-]/.test(i.charAt(v)))return{hypotheticalNum:h=v-t+1,rw:u=e.measureText(i.slice(t,t+h)).width,newLine:l=!0};return rm(i.charAt(t+h))&&(l=!1),{hypotheticalNum:h,rw:u,newLine:l}}function am(e,t,r){void 0===r&&(r=1),1!==r?(e.font=t.font.replace(/([\d.e+-]+)px/gi,function(e,t){return t*r+"px"}),e.letterSpacing=t.letterSpacing*r+"px"):(e.font=t.font,e.letterSpacing=t.letterSpacing+"px")}var nm=1e-4,om=function(e){function i(t){var r,i=e.call(this,t)||this;return i._content=t.content.toString()||"",i.rich=((null===(r=t.rich)||void 0===r?void 0:r.slice(0))||[]).map(function(e){return ii(e,i.style)}),i.computedRich=i.rich.map(function(e){return i.calComputedRich(e)}),i.mergeRich(),i.lineBoxList=[],i.cursor={isMulti:!1,startLineBox:0,endLineBox:0,startTextBox:0,endTextBox:0,startString:0,endString:0,start:0,end:0},i.tempCursorX=0,i}return t(i,e),i.prototype.didMount=function(){e.prototype.didMount.call(this);var t=this.props.textBehaviour,r=this,i=r.style,a=r.computedStyle,n=r.parent,o=i.left,s=i.right,c=i.top,u=i.bottom,l=i.width,h=i.height,d=i.transformOrigin,f=!1;if("auto"===t&&l.u!==V.AUTO&&(o.u===V.AUTO||s.u===V.AUTO)){var m=this.width;if(l.u===V.PX?m=this.width-l.v:l.u===V.PERCENT&&(m=this.width-.01*l.v*n.width),Math.abs(m)>nm&&d[0].u===V.PERCENT){var p=this.getOffsetRect(),g=ri(l,n.width);p.left=a.left+ri(i.translateX,g),p.right=p.left+g;var v=a.textAlign;if(v===H.LEFT){var y=m*d[0].v*.01;this.adjustPosAndSizeSelf(y,0,y,0),f=!0}else if(v===H.RIGHT){y=m*d[0].v*.01;this.adjustPosAndSizeSelf(-y,0,-y,0),f=!0}}i.width={v:0,u:V.AUTO}}if(!("auto"!==t&&"autoH"!==t||h.u===V.AUTO||c.u!==V.AUTO&&u.u!==V.AUTO)){m=0;if(h.u===V.PX?m=this.height-h.v:h.u===V.PERCENT&&(m=this.height-.01*h.v*n.height),Math.abs(m)>nm&&d[1].u===V.PERCENT){p=this.getOffsetRect();var b=ri(h,n.height);p.top=a.top+ri(i.translateY,b),p.bottom=p.top+b;var x=a.textVerticalAlign;if(x===X.TOP){y=m*d[1].v*.01;this.adjustPosAndSizeSelf(0,y,0,y),f=!0}else if(x===X.BOTTOM){y=m*d[1].v*.01;this.adjustPosAndSizeSelf(0,-y,0,-y),f=!0}}i.height={v:0,u:V.AUTO}}f&&this.checkPosSizeUpward()},i.prototype.lay=function(t){var r=this;e.prototype.lay.call(this,t);var i=this,a=i.computedRich,n=i.style,o=i.computedStyle,s=i._content,c=i.lineBoxList,u=n.left,l=n.right,h=n.top,d=n.bottom,f=n.width,m=n.height,p=f.u===V.AUTO&&(u.u===V.AUTO||l.u===V.AUTO),g=m.u===V.AUTO&&(h.u===V.AUTO||d.u===V.AUTO);if(!this.isMounted){var v=this.props.textBehaviour;"auto"!==v||f.u===V.AUTO||u.u!==V.AUTO&&l.u!==V.AUTO||(p=!0),"auto"!==v&&"autoH"!==v||m.u===V.AUTO||h.u!==V.AUTO&&d.u!==V.AUTO||(g=!0)}var y,b,x,T,w,k,S,E,C,A,_,M,I,R,P=0,O=s.length,D=0,B=0,F=0,L={};if(a.length)for(var N=0,U=a.length;N<U;N++){var z=a[N];L[z.location]=N;var W=z.fontFamily;Xe.waitIfNotRegister(W,function(){r.refresh(ui.REFLOW)})}else{W=o.fontFamily;Xe.waitIfNotRegister(W,function(){r.refresh(ui.REFLOW)})}var j=oe.getFontCanvas().ctx;if(a.length){var G=a[0];b=G.letterSpacing||0,x=G.paragraphSpacing||0,y=.8*G.fontSize+b,w=$r(G,T=G.lineHeight||Kr(G)),k=Qr(G,T),S=G.fontFamily,E=G.fontSize,C=fe(G.color),A=G.textDecoration||[],_=G.textShadow,M=G.stroke,I=G.strokeWidth,R=G.strokeEnable,j.font=Yr(G),j.letterSpacing=b+"px"}else b=o.letterSpacing,x=o.paragraphSpacing,y=.8*o.fontWeight+b,w=$r(o,T=o.lineHeight||Kr(o)),k=Qr(o,T),S=o.fontFamily,E=o.fontSize,C=fe(this.style.color.v),A=this.style.textDecoration.map(function(e){return e.v}),_=this.style.textShadow.v,M=va(this.style.stroke),I=this.style.strokeWidth.map(function(e){return e.v}),R=this.style.strokeEnable.map(function(e){return e.v}),j.font=Yr(o),j.letterSpacing=b+"px";var Y=new em(F,T,P,!1);c.splice(0),c.push(Y);for(var q=p?Number.MAX_SAFE_INTEGER:this.width;P<O;){var K=L[P];if(P&&K){var $=a[K];b=$.letterSpacing||0,x=$.paragraphSpacing||0,y=.8*$.fontSize+b,w=$r($,T=$.lineHeight||Kr($)),k=Qr($,T),S=$.fontFamily,E=$.fontSize,C=fe($.color),A=$.textDecoration||[],_=$.textShadow,M=$.stroke,I=$.strokeWidth,R=$.strokeEnable,j.font=Yr($),j.letterSpacing=b+"px"}if(rm(s.charAt(P)))P++,B=0,F+=Y.height+x,Y.verticalAlign(),Y.endEnter=!0,Y=new em(F,T,P,!0),c.push(Y);else{U=O;if(a.length)for(var Q=P+1;Q<U;Q++)if(L[Q]){U=Q;break}if(j.measureText(s.charAt(P)).width>q-B+1e-10&&B)B=0,F+=Y.height,P<O&&(Y.verticalAlign(),Y=new em(F,T,P,!1),c.push(Y));else{var Z=im(j,P,U,s,q-B,y),J=Z.hypotheticalNum,ee=Z.rw,te=Z.newLine,re=new tm(B,F,ee,T,w,k,P,s.slice(P,P+J),j.font,S,E,C,b,A,_,M,I,R);Y.add(re),P+=J,D=Math.max(D,Math.ceil(ee+B)),te?(B=0,F+=Y.height,P<O&&(Y.verticalAlign(),Y=new em(F,T,P,!1),c.push(Y))):B+=ee}}}if((Y.verticalAlign(),D=Math.max(D,Y.width),b&&b<0&&(D-=b),p)&&(ve=D-this.width)){o.width=D;var ie=n.left,ae=n.right;ie.u!==V.AUTO&&ae.u!==V.AUTO||(ie.u!==V.AUTO?o.right-=ve:ae.u!==V.AUTO&&(o.left-=ve))}if(g){var ne=Y.y+Y.height;if(ve=ne-this.height){o.height=ne;var se=n.top,ce=n.bottom;se.u!==V.AUTO&&ce.u!==V.AUTO||(se.u!==V.AUTO?o.bottom-=ve:ce.u!==V.AUTO&&(o.top-=ve))}}if(a&&a.length){var ue={};a.forEach(function(e){ue[e.location]=e});var le=a[0].textAlign,he=0;for(U=c.length;he<U;he++){var de=c[he];if(de.startEnter||!de.index){var me=ue[de.index];me&&(le=me.textAlign)}if(le===H.CENTER)(ve=this.width-de.width)&&de.offsetX(.5*ve);else if(le===H.RIGHT){(ve=this.width-de.width)&&de.offsetX(ve)}}}else if(s&&o.textAlign!==H.LEFT){var pe=0;for(U=c.length;pe<U;pe++){var ge=c[pe];if(o.textAlign===H.CENTER)(ve=this.width-ge.width)&&ge.offsetX(.5*ve);else if(o.textAlign===H.RIGHT){var ve;(ve=this.width-ge.width)&&ge.offsetX(ve)}}}var ye=this.height-Y.y-Y.height;if(ye){var be=o.textVerticalAlign;if(be===X.MIDDLE){var xe=0;for(U=c.length;xe<U;xe++){c[xe].offsetY(.5*ye)}}else if(be===X.BOTTOM){var Te=0;for(U=c.length;Te<U;Te++){c[Te].offsetY(ye)}}}},i.prototype.cutRich=function(e,t){var r=this.rich;if(r.length){for(var i=t-e,a=0,n=r.length;a<n;a++){var o=r[a];if(o.location<=e&&o.location+o.length>e){if(o.location+o.length>=t){o.length-=i;for(var s=a+1;s<n;s++)r[s].location-=i;o.length||r.splice(a,1)}else{o.length=e-o.location;for(var c=a+1,u=r.length;c<u;c++){var l=r[c];if(l.location<=t&&(l.location+l.length>t||c===u-1)){l.length-=t-l.location,l.location-=i;s=c+1;for(var h=r.length;s<h;s++)r[s].location-=i;a<c-1&&r.splice(a+1,c-a-1),l.length||r.splice(c,1);break}}o.length||r.splice(a,1)}break}}this.mergeRich()}},i.prototype.expandRich=function(e,t){var r=this,i=r.rich,a=r.computedRich,n=r.style,o=r._content;if(!i.length){var s={location:e,length:t,fontFamily:n.fontFamily,fontSize:n.fontSize,fontWeight:n.fontWeight,fontStyle:n.fontStyle,letterSpacing:n.letterSpacing,lineHeight:n.lineHeight,paragraphSpacing:n.paragraphSpacing,textAlign:n.textAlign,textDecoration:n.textDecoration,textShadow:n.textShadow,color:n.color,stroke:n.stroke.slice(0),strokeEnable:n.strokeEnable.slice(0),strokeWidth:n.strokeWidth.slice(0)};return i.push(s),void a.push(this.calComputedRich(s))}e=Math.max(0,e);for(var c=0,u=i.length;c<u;c++){var l=i[c];if(l.location<=e&&l.location+l.length>=e){if(e===l.location+l.length&&rm(o.charAt(e-1)))continue;l.length+=t,a[c].length+=t;for(var h=c+1;h<u;h++)i[h].location+=t,a[h].location+=t;return}}i[i.length-1].length+=t,a[a.length-1].length+=t},i.prototype.insertRich=function(e,t,r){var i=this,a=i.rich,n=i.computedRich,o=i.style,s=Object.assign({location:t,length:r,fontFamily:o.fontFamily,fontSize:o.fontSize,fontWeight:o.fontWeight,fontStyle:o.fontStyle,letterSpacing:o.letterSpacing,lineHeight:o.lineHeight,paragraphSpacing:o.paragraphSpacing,textAlign:o.textAlign,textDecoration:o.textDecoration,textShadow:o.textShadow,color:o.color,stroke:o.stroke,strokeEnable:o.strokeEnable,strokeWidth:o.strokeWidth},e),c=this.calComputedRich(s);if(!a.length)return a.push(s),void n.push(c);for(var u=0,l=a.length;u<l;u++){var h=a[u];if(h.location<=t&&h.location+h.length>=t){for(var d=u+1;d<l;d++)a[d].location+=r,n[d].location+=r;if(h.location===t)a.splice(u,0,s),n.splice(u,0,c),h.location+=r,n[u].location+=r;else if(h.location+h.length===t)a.splice(u+1,0,s),n.splice(u+1,0,c);else if(h.location+h.length>t){var f=C(h);h.length=t-h.location,f.location=t+r,f.length-=h.length,a.splice(u+1,0,s),a.splice(u+2,0,f);var m=n[u],p=C(m);m.length=h.length,p.location=f.location,p.length=f.length,n.splice(u+1,0,c),n.splice(u+2,0,p)}return void this.mergeRich()}}a.push(s),n.push(c),this.mergeRich()},i.prototype.mergeRich=function(){var e=this,t=e.rich,i=e.computedRich,a=e._content,n=e.style;if(t.length){for(var o=t.length-1;o>=0;o--){var s=t[o];(s.location<0||s.length<=0)&&(t.splice(o,1),i.splice(o,1))}t.sort(function(e,t){return e.location===t.location?e.length-t.length:e.location-t.location}),i.sort(function(e,t){return e.location===t.location?e.length-t.length:e.location-t.location});var c=!1,u=ii({location:0,length:0},n);if(a.length){var l=t[t.length-1],h=i[i.length-1];if(l.location+l.length>a.length)l.length=a.length-l.location,h.length=a.length-h.location,c=!0;else if(l.location+l.length<a.length){var d=r(r({},u),{location:l.location+l.length,length:a.length-l.location-l.length});t.push(d),i.push(this.calComputedRich(d))}var f=t[0];if(f.location>0){d=r(r({},u),{location:0,length:f.location});t.unshift(d),i.unshift(this.calComputedRich(d)),c=!0}}for(o=t.length-2;o>=0;o--){var m=t[o],p=t[o+1];if(p.length)if(m.length){var g=m.location+m.length;if(g===p.location)A(m,p,["color","fontFamily","fontSize","letterSpacing","lineHeight","textDecoration","paragraphSpacing","textShadow","stroke","strokeEnable","strokeWidth"])?(m.textAlign.v===p.textAlign.v||rm(a.charAt(p.location-1)))&&(m.length+=p.length,t.splice(o+1,1),i[o].length=m.length,i.splice(o+1,1),c=!0):1===p.length&&rm(a.charAt(p.location))&&(m.length+=p.length,t.splice(o+1,1),i[o].length=m.length,i.splice(o+1,1),c=!0);else{if(g<p.location){d=r(r({},u),{location:g,length:p.location-g});t.splice(o+1,0,d),i.splice(o+1,0,this.calComputedRich(d))}else{var v=m.location+m.length-p.location;p.location+=v,p.length-=v,i[o+1].location=p.location,i[o+1].length=p.length}c=!0}}else t.splice(o,1),i.splice(o,1),o++;else t.splice(o+1,1),i.splice(o+1,1)}return c}},i.prototype.calComputedRich=function(e){return{location:e.location,length:e.length,fontFamily:e.fontFamily.v,fontSize:e.fontSize.v,fontWeight:e.fontWeight.v,fontStyle:e.fontStyle.v,lineHeight:e.lineHeight.v,letterSpacing:e.letterSpacing.v,paragraphSpacing:e.paragraphSpacing.v,textAlign:e.textAlign.v,textDecoration:e.textDecoration.map(function(e){return e.v}),color:e.color.v,textShadow:e.textShadow.v,stroke:va(e.stroke),strokeWidth:e.strokeWidth.map(function(e){return e.v}),strokeEnable:e.strokeEnable.map(function(e){return e.v})}},i.prototype.calReflowStyle=function(){var t=this;e.prototype.calReflowStyle.call(this),this.computedRich=this.rich.map(function(e){return t.calComputedRich(e)})},i.prototype.calRepaintStyle=function(t){e.prototype.calRepaintStyle.call(this,t);var r=this.rich;if(r.length)this.computedRich.forEach(function(e,t){e.textDecoration=r[t].textDecoration.map(function(e){return e.v}),e.color=r[t].color.v,e.textShadow=r[t].textShadow.v,e.stroke=va(r[t].stroke),e.strokeWidth=r[t].strokeWidth.map(function(e){return e.v}),e.strokeEnable=r[t].strokeEnable.map(function(e){return e.v})});else{var i=this.computedStyle;this.lineBoxList.forEach(function(e){e.list.forEach(function(e){e.color=fe(i.color),e.stroke=i.stroke,e.strokeWidth=i.strokeWidth,e.strokeEnable=i.strokeEnable})})}},i.prototype.calContent=function(){this.hasContent=!1;var e=this.computedStyle;return(this._content||e.backgroundColor[3]>0)&&(this.hasContent=!0),this.hasContent},i.prototype.renderCanvas=function(){var t;e.prototype.renderCanvas.call(this);var r=this._bboxInt||this.bboxInt,i=r[0],a=r[1],n=r[2]-i,o=r[3]-a,s=-i,c=-a,u=this.computedStyle,l=this.lineBoxList,h=this.canvasCache=(null===(t=this.canvasCache)||void 0===t?void 0:t.available)?this.canvasCache:new Ti(n,o,-i,-a);h.available=!0;var d=h.list,f=this.getSortedCursor(),m=f.isMulti,p=f.startLineBox,g=f.startTextBox,v=f.startString,y=f.endLineBox,b=f.endTextBox,x=f.endString,T=f.start,w=f.end;if(m&&T!==w)for(var k=0,S=d.length;k<S;k++){var E=d[k],C=E.x,A=E.y,_=E.os.ctx,M=-C,I=-A;if(_.fillStyle="#f4d3c1",p===y){var R=(D=l[p]).list,P=(B=R[g]).x+M;_.font=B.font,_.letterSpacing=B.letterSpacing+"px",P+=_.measureText(B.str.slice(0,v)).width;var O=(B=R[b]).x+M;_.font=B.font,O+=_.measureText(B.str.slice(0,x)).width,_.fillRect(P,D.y+I,O-P,D.lineHeight)}else{var D,B,F=(D=l[p]).list;if(B=F[g]){P=B.x+M;_.font=B.font,_.letterSpacing=B.letterSpacing+"px",P+=_.measureText(B.str.slice(0,v)).width,_.fillRect(P,D.y+I,D.w+M-P,D.lineHeight)}for(var L=p+1,N=y;L<N;L++){var U=l[L];U.list.length&&_.fillRect(U.list[0].x+M,U.y+I,U.w,U.lineHeight)}if(B=(F=(D=l[y]).list)[b]){P=B.x+M;_.font=B.font,_.letterSpacing=B.letterSpacing+"px",P+=_.measureText(B.str.slice(0,x)).width,_.fillRect(D.x+M,D.y+I,P-(D.x+M),D.lineHeight)}}}var z=u.strokeDasharray,W=u.strokeLinecap,V=u.strokeLinejoin,H=function(e,t){var r=d[e],i=r.x,a=r.y,u=r.os.ctx;u.miterLimit=1,u.fillStyle="transparent",u.setLineDash(z),W===Q.ROUND?u.lineCap="round":W===Q.SQUARE?u.lineCap="square":u.lineCap="butt",V===Z.ROUND?u.lineJoin="round":V===Z.BEVEL?u.lineJoin="bevel":u.lineJoin="miter";for(var h=-i,f=-a,m=0,p=l.length;m<p;m++){var g=l[m];if(g.y>=o)break;for(var v=g.list,y=v.length,b=function(e){var t=v[e],r=t.textDecoration,i=t.textShadow,a=t.stroke,l=t.strokeWidth,d=t.strokeEnable;am(u,t);for(var m=function(e,r){if(!d[e]||!l[e])return"continue";var i=a[e];if(Array.isArray(i))u.strokeStyle=fe(i);else if(i.t===Y.LINEAR){var m=Hr(i.stops,i.d,h,f,n-2*s,o-2*c),p=u.createLinearGradient(m.x1,m.y1,m.x2,m.y2);m.stop.forEach(function(e){p.addColorStop(e.offset,fe(e.color))}),u.strokeStyle=p}else if(i.t===Y.RADIAL){m=Xr(i.stops,i.d,h,f,n-2*s,o-2*c);var g=u.createRadialGradient(m.cx,m.cy,0,m.cx,m.cy,m.total);m.stop.forEach(function(e){g.addColorStop(e.offset,fe(e.color))});var v=m.matrix;if(v){var y=oe.getOffscreenCanvas(n,o),b=y.ctx;return b.setLineDash(u.getLineDash()),b.lineCap=u.lineCap,b.lineJoin=u.lineJoin,b.miterLimit=u.miterLimit,b.lineWidth=l[e],b.lineWidth=l[e],b.strokeStyle="#FFF",b.strokeText(t.str,t.x+h,t.y+t.baseline+f),b.globalCompositeOperation="source-in",b.setTransform(v[0],v[1],v[4],v[5],v[12],v[13]),b.fillStyle=g,b.fillRect(0,0,n,o),u.drawImage(y.canvas,0,0),y.release(),"continue"}u.strokeStyle=g}else if(i.t===Y.CONIC){m=jr(i.stops,i.d,h,f,n-2*s,o-2*c);var x=u.createConicGradient(m.angle,m.cx+h,m.cy+f);m.stop.forEach(function(e){x.addColorStop(e.offset,fe(e.color))}),u.strokeStyle=x}u.lineWidth=l[e],u.strokeText(t.str,t.x+h,t.y+t.baseline+f)},p=0,g=a.length;p<g;p++)m(p);u.fillStyle=t.color,i?(u.shadowOffsetX=i.x,u.shadowOffsetY=i.y,u.shadowBlur=i.blur,u.shadowColor=fe(i.color)):(u.shadowOffsetX=0,u.shadowOffsetY=0,u.shadowBlur=0,u.shadowColor="transparent"),u.fillText(t.str,t.x+h,t.y+t.baseline+f),u.shadowOffsetX=0,u.shadowOffsetY=0,u.shadowBlur=0,u.shadowColor="transparent",r.length&&r.forEach(function(e){if(e===re.UNDERLINE){var r=Math.min(3,.05*t.lineHeight);u.fillRect(t.x+h,t.y+t.contentArea+f-.5*r,t.w,r)}else if(e===re.LINE_THROUGH){var i=Math.min(3,.05*t.lineHeight);u.fillRect(t.x+h,t.y+.5*t.lineHeight+f-.5*i,t.w,i)}})},x=0;x<y;x++)b(x)}};for(k=0,S=d.length;k<S;k++)H(k)},i.prototype.setCursorStartByAbsCoords=function(e,t){var r=this.matrixWorld,i=bt({x:e,y:t},ct(r)),a=this.lineBoxList,n=this.cursor,o=n.start;n.isMulti=!1;for(var s=a.length,c=0;c<s;c++){var u=a[c];if(i.y>=u.y&&i.y<u.y+u.lineHeight){n.startLineBox=n.endLineBox=c;var l=this.getCursorByLocalX(i.x,u,!1);n.endTextBox=n.startTextBox,n.endString=n.startString,n.end=n.start,this.tempCursorX=l.x,n.start!==o&&(this.inputStyle=void 0);var h=bt({x:l.x,y:l.y},r);return{x:h.x,y:h.y,h:l.h*r[0]}}}var d=a[s-1];n.startLineBox=n.endLineBox=s-1;var f=this.getCursorByLocalX(this.width,d,!1);n.endTextBox=n.startTextBox,n.endString=n.startString,n.end=n.start,this.tempCursorX=f.x,n.start!==o&&(this.inputStyle=void 0);var m=bt({x:f.x,y:f.y},r);return{x:m.x,y:m.y,h:f.h*r[0]}},i.prototype.setCursorEndByAbsCoords=function(e,t){var r=this.matrixWorld,i=bt({x:e,y:t},ct(r)),a=this.lineBoxList,n=this.cursor,o=n.end;n.isMulti=!0;for(var s=a.length,c=0;c<s;c++){var u=a[c];if(i.y>=u.y&&i.y<u.y+u.lineHeight){n.endLineBox=c;var l=this.getCursorByLocalX(i.x,u,!0);n.end!==o&&this.refresh();var h=bt({x:l.x,y:l.y},r);return{x:h.x,y:h.y,h:l.h*r[0]}}}var d=a[s-1];n.endLineBox=s-1;var f=this.getCursorByLocalX(this.width,d,!0);n.end!==o&&this.refresh(),n.end!==n.start&&(this.inputStyle=void 0);var m=bt({x:f.x,y:f.y},r);return{x:m.x,y:m.y,h:f.h*r[0]}},i.prototype.resetCursor=function(){var e=this.cursor;e.isMulti&&(e.isMulti=!1,e.start!==e.end&&(this.refresh(),e.endLineBox=e.startLineBox,e.endTextBox=e.startTextBox,e.endString=e.startString,e.end=e.start))},i.prototype.reLocateCursor=function(){var e=this.cursor,t=this.lineBoxList,r=e.start,i=e.end,a=e.isMulti,n=0;e:for(var o=0,s=t.length;o<s;o++)for(var c=0,u=(l=t[o]).list.length;c<u;c++){if((d=n+l.list[c].str.length)>=r){e.startLineBox=o,e.startTextBox=c,e.startString=r-n;break e}n=d}if(a&&i!==r){n=0;e:for(o=0,s=t.length;o<s;o++){c=0;for(var l,h=(l=t[o]).list.length;c<h;c++){var d;if((d=n+l.list[c].str.length)>=i){e.endLineBox=o,e.endTextBox=c,e.endString=i-n;break e}n=d}}}else e.endLineBox=e.startLineBox,e.endTextBox=e.startTextBox,e.endString=e.startString},i.prototype.beforeEdit=function(){var e=this,t=e.style,r=e.computedStyle,i=e.parent,a=e.isDestroyed,n=e.width,o=e.height;if(a||!i)throw new Error("Can not edit a destroyed Text");var s=this.getStyle(),c=t.left,u=t.right,l=t.top,h=t.bottom,d=t.width,f=t.height,m=t.translateX,p=t.translateY,g=t.textAlign,v=t.textVerticalAlign,y=c.u!==V.AUTO&&u.u!==V.AUTO||d.u!==V.AUTO,b=g.v===H.LEFT&&!y&&(c.u!==V.AUTO&&m.v&&m.u===V.PERCENT||u.u!==V.AUTO),x=g.v===H.CENTER&&!y&&(-50!==m.v||m.u!==V.PERCENT),T=g.v===H.RIGHT&&u.u===V.AUTO,w=l.u!==V.AUTO&&h.u!==V.AUTO||f.u!==V.AUTO,k=v.v===X.TOP&&!w&&(l.u!==V.AUTO&&p.v&&p.u===V.PERCENT||h.u!==V.AUTO),S=v.v===X.MIDDLE&&!w&&(-50!==p.v||p.u!==V.PERCENT),E=v.v===X.BOTTOM&&!w&&h.u===V.AUTO,C=i.width,A=i.height,_=!1,M=0;if(m.u===V.PX?M=m.v:m.u===V.PERCENT&&(M=.01*m.v*n),b)c.u!==V.AUTO&&m.v&&m.u===V.PERCENT?(_=!0,r.left+=M,c.u===V.PX?c.v+=M:c.u===V.PERCENT&&(c.v+=100*M/C),r.right-=M,u.u===V.PX?u.v-=M:u.u===V.PERCENT&&(u.v-=100*M/C)):u.u!==V.AUTO&&(_=!0,r.left+=M,c.v=r.left,c.u=V.PX,r.right-=M,u.v=0,u.u=V.AUTO),m.v=0;else if(x){if(m.u===V.AUTO||m.u===V.PX){_=!0;var I=.5*n-m.v;r.left+=I,r.right-=I,c.u===V.PX?(c.v+=I,m.v=-50):c.u===V.PERCENT?(c.v+=100*I/C,m.v=-50):u.u===V.PX?(u.v+=I,m.v=50):u.u===V.PERCENT&&(u.v+=100*I/C,m.v=50),m.u=V.PERCENT}else if(m.u===V.PERCENT&&-50!==m.v){_=!0;I=.5*n-m.v*n;r.left+=I,r.right-=I,c.u===V.PX?(c.v+=I,m.v=-50):c.u===V.PERCENT?(c.v+=100*I/C,m.v=-50):u.u===V.PX?(u.v+=I,m.v=50):u.u===V.PERCENT&&(u.v+=100*I/C,m.v=50)}}else T&&(_=!0,r.left+=M,c.u!==V.AUTO&&(c.v=0,c.u=V.AUTO),r.right-=M,u.v=r.right,u.u=V.PX,m.v=0);var R=0;if(p.u===V.PX?R=p.v:p.u===V.PERCENT&&(R=.01*p.v*o),k)l.u!==V.AUTO&&p.v&&p.u===V.PERCENT?(_=!0,r.top+=R,l.u===V.PX?l.v+=R:l.u===V.PERCENT&&(l.v+=100*R/A),r.bottom-=R,h.u===V.PX?h.v-=R:h.u===V.PERCENT&&(h.v-=100*R/A)):h.u!==V.AUTO&&(_=!0,r.top+=R,l.v=r.top,l.u=V.PX,r.bottom-=R,h.v=0,h.u=V.AUTO),p.v=0;else if(S){if(p.u===V.AUTO||p.u===V.PX){_=!0;var P=.5*o-p.v;r.top+=P,r.bottom-=P,l.u===V.PX?(l.v+=P,p.v=-50):l.u===V.PERCENT?(l.v+=100*P/A,p.v=-50):h.u===V.PX?(h.v+=P,p.v=50):h.u===V.PERCENT&&(h.v+=100*P/A,p.v=50),p.u=V.PERCENT}else if(p.u===V.PERCENT&&-50!==p.v){_=!0;P=.5*o-p.v*o;r.top+=P,r.bottom-=P,l.u===V.PX?(l.v+=P,p.v=-50):l.u===V.PERCENT?(l.v+=100*P/A,p.v=-50):h.u===V.PX?(h.v-=P,p.v=50):h.u===V.PERCENT&&(h.v-=100*P/A,p.v=50),p.v=-50}}else E&&(_=!0,r.top+=R,l.u!==V.AUTO&&(l.v=0,l.u=V.AUTO),r.bottom-=R,h.v=r.bottom,h.u=V.PX,p.v=0);if(_)return this.editStyle={isLeft:b,isCenter:x,isRight:T,isTop:k,isMiddle:S,isBottom:E,isFixedHeight:w,prev:s}},i.prototype.afterEdit=function(){if(this.editStyle){var e=this.editStyle,t=e.isLeft,r=e.isCenter,i=e.isRight,a=e.isTop,n=e.isMiddle,o=e.isBottom;e.isFixedHeight;var s=e.prev,c=this,u=c.style,l=c.computedStyle,h=c.parent,d=c.width,f=c.height,m=s.left,p=s.right,g=s.top,v=s.bottom,y=s.translateX,b=s.translateY,x=h,T=x.width,w=x.height,k=0;if(y.u===V.PX?k=y.v:y.u===V.PERCENT&&(k=.01*y.v*d),t){if(m.u!==V.AUTO&&y.v&&y.u===V.PERCENT){if(m.u===V.PX)u.left.v-=k,l.left-=k;else if(m.u===V.PERCENT){var S=100*k/T;u.left.v-=S,l.left-=k}if(p.u===V.PX)u.right.v+=k,l.right+=k;else if(p.u===V.PERCENT){S=100*k/T;u.right.v+=S,l.right+=k}l.translateX+=k}else p.u!==V.AUTO&&(u.left.v=0,u.left.u=V.AUTO,l.left-=k,u.right.v=p.v,u.right.u=p.u,l.right+=k);u.translateX.v=y.v}else if(r){if(y.u===V.AUTO||y.u===V.PX){var E=.5*d-y.v;m.u===V.PX?u.left.v-=E:m.u===V.PERCENT?u.left.v-=100*E/T:p.u===V.PX?u.right.v-=E:p.u===V.PERCENT&&(u.right.v-=100*E/T),u.translateX.v=y.v,u.translateX.u=y.u}else if(y.u===V.PERCENT&&-50!==y.v){E=.5*d-y.v*d;m.u===V.PX?u.left.v-=E:m.u===V.PERCENT&&(u.left.v-=100*E/T),p.u===V.PX?u.right.v-=E:p.u===V.PERCENT&&(u.right.v-=100*E/T),u.translateX.v=y.v}}else i&&(l.left-=k,m.u===V.PX?u.left.v=l.left:m.u===V.PERCENT&&(u.left.v=100*l.left/T),u.left.u=m.u,l.right+=k,p.u===V.AUTO&&(u.right.v=0,u.right.u=V.AUTO),u.translateX.v=y.v,u.translateX.u=y.u);var C=0;if(b.u===V.PX?C=b.v:b.u===V.PERCENT&&(C=.01*b.v*f),a){if(g.u!==V.AUTO&&b.v&&b.u===V.PERCENT){if(g.u===V.PX)u.top.v-=C,l.top-=C;else if(g.u===V.PERCENT){S=100*C/w;u.top.v-=S,l.top-=C}if(v.u===V.PX)u.bottom.v+=C,l.bottom+=C;else if(v.u===V.PERCENT){S=100*C/w;u.bottom.v+=S,l.bottom+=C}}else v.u!==V.AUTO&&(u.top.v=0,u.top.u=V.AUTO,l.top-=C,u.bottom.v=v.v,u.bottom.u=v.u,l.bottom+=C);u.translateY.v=b.v,l.translateY+=C}else if(n){if(b.u===V.AUTO||b.u===V.PX){var A=.5*f-b.v;g.u===V.PX?u.top.v-=A:g.u===V.PERCENT?u.top.v-=100*A/w:v.u===V.PX?u.bottom.v-=A:v.u===V.PERCENT&&(u.bottom.v-=100*A/w),u.translateY.v=b.v,u.translateY.u=V.PX}else if(b.u===V.PERCENT&&-50!==b.v){A=.5*f-b.v*f;g.u===V.PX?u.top.v-=A:g.u===V.PERCENT?u.top.v-=100*A/w:v.u===V.PX?u.bottom.v-=A:v.u===V.PERCENT&&(u.bottom.v-=100*A/w),u.translateY.v=b.v}}else o&&(l.top-=C,g.u===V.PX?u.top.v=l.top:g.u===V.PERCENT&&(u.top.v=100*l.top/w),l.bottom+=C,v.u===V.AUTO&&(u.bottom.v=0,u.bottom.u=V.AUTO),u.translateY.v=b.v,u.translateY.u=b.u)}},i.prototype.updateCursorByIndex=function(e){var t=this.setCursorByIndex(e,!1),r=t.lineBox,i=t.textBox,a=this.cursor,n=this.matrixWorld;if(i){var o=oe.getFontCanvas().ctx;o.font=i.font,o.letterSpacing=i.letterSpacing+"px";var s=i.str,c=o.measureText(s.slice(0,a.startString)).width;this.tempCursorX=i.x+c}else{var u=this.computedStyle.textAlign;u===H.CENTER?this.tempCursorX=.5*this.width:u===H.RIGHT?this.tempCursorX=this.width:this.tempCursorX=0}var l=bt({x:this.tempCursorX,y:r.y},n);return{x:l.x,y:l.y,h:r.lineHeight*n[0]}},i.prototype.setCursorByIndex=function(e,t){void 0===t&&(t=!1);var r=this.lineBoxList,i=this.cursor;t?i.end=e:i.start=e;for(var a=0,n=r.length;a<n;a++){var o=r[a],s=o.list;if(!s.length&&o.index===e)return i.startLineBox=a,i.startTextBox=0,i.startString=0,{lineBox:o,textBox:void 0};for(var c=0,u=s.length;c<u;c++){var l=s[c];if(e>=l.index&&(e<l.index+l.str.length||c===u-1&&o.endEnter&&e<=l.index+l.str.length))return t?(i.endLineBox=a,i.endTextBox=c,i.endString=e-l.index):(i.startLineBox=a,i.startTextBox=c,i.startString=e-l.index),{lineBox:o,textBox:l}}}var h=r.length-1,d=r[h],f=d.list;if(t?i.endLineBox=h:i.startLineBox=h,!f||!f.length)return t?(i.endTextBox=0,i.endString=0):(i.startTextBox=0,i.startString=0),{lineBox:d,textBox:void 0};var m=f.length-1,p=f[m];return t?(i.endTextBox=m,i.endString=p.str.length):(i.startTextBox=m,i.startString=p.str.length),{lineBox:d,textBox:p}},i.prototype.checkCursorMulti=function(){var e=this.cursor;return e.isMulti&&e.start===e.end&&(e.isMulti=!1),e.isMulti},i.prototype.getCursorAbsCoords=function(){var e=this.matrixWorld,t=this.lineBoxList,r=this.cursor;if(!r.isMulti){var i=t[r.startLineBox],a=i.list,n=i.lineHeight;if(!a.length){var o=this.computedStyle.textAlign,s=0;o===H.CENTER?s=.5*this.width:o===H.RIGHT&&(s=this.width);var c=bt({x:s,y:i.y},e);return{x:c.x,y:c.y,h:n*e[0]}}var u=bt({x:this.tempCursorX,y:i.y},e);return{x:u.x,y:u.y,h:n*e[0]}}},i.prototype.moveCursor=function(e,t){void 0===t&&(t=!1);var r=this.matrixWorld,i=this.cursor,a=this.getSortedCursor(),n=t?a.endLineBox:a.startLineBox,o=t?a.endTextBox:a.startTextBox,s=t?a.endString:a.startString,c=this.lineBoxList,u=c[n],l=u.list,h=l[o],d=t?a.end:a.start;if(i.isMulti&&!t){if(i.isMulti=!1,i.start!==i.end&&this.refresh(),39===e||40===e){var f=a.endLineBox,m=a.endTextBox,p=a.endString;d=(h=(l=(u=c[f]).list)[m])?h.index+p:u.index+p}return this.inputStyle=void 0,this.updateCursorByIndex(d)}if(t&&(i.isMulti=!0),37===e){if(0===d)return;0===s?0===o?(t?i.endLineBox=--n:i.startLineBox=--n,(l=(u=c[n]).list).length?(t?i.endTextBox=o=l.length-1:i.startTextBox=o=l.length-1,h=l[o],t?(i.endString=h.str.length-(u.endEnter?0:1),i.end=h.index+i.endString):(i.startString=h.str.length-(u.endEnter?0:1),i.start=h.index+i.startString)):t?(i.endTextBox=0,i.endString=0,i.end=u.index):(i.startTextBox=0,i.startString=0,i.start=u.index)):(t?i.endTextBox=--o:i.startTextBox=--o,h=l[o],t?(i.endString=h.str.length-1,i.end=h.index+i.endString):(i.startString=h.str.length-1,i.start=h.index+i.startString)):t?(i.endString=--s,i.end=h.index+i.endString):(i.startString=--s,i.start=h.index+i.startString)}else if(38===e){if(0===d)return;if(0!==n){u=c[--n],t?i.endLineBox=n:i.startLineBox=n;var g=this.getCursorByLocalX(this.tempCursorX,u,t);t&&this.refresh(),this.inputStyle=void 0;var v=bt({x:g.x,y:g.y},r);return{x:v.x,y:v.y,h:u.lineHeight*r[0]}}t?i.endTextBox=0:i.startTextBox=0,h=l[0],t?(i.endString=0,i.end=0):(i.startString=0,i.start=0)}else if(39===e){if(d===this._content.length)return;!h||o===l.length-1&&s===h.str.length&&u.endEnter?(t?(i.endLineBox=++n,i.endTextBox=0,i.endString=0):(i.startLineBox=++n,i.startTextBox=0,i.startString=0),h=(l=(u=c[n]).list)[0],t?i.end=h.index:i.start=h.index):o===l.length-1&&s===h.str.length?(t?(i.endLineBox=++n,i.endTextBox=0,i.endString=1):(i.startLineBox=++n,i.startTextBox=0,i.startString=1),h=(l=(u=c[n]).list)[0],t?i.end=h.index+1:i.start=h.index+1):s===h.str.length?(t?i.endTextBox=++o:i.startTextBox=++o,h=l[o],t?(i.endString=1,i.end=h.index+1):(i.startString=1,i.start=h.index+1),o===l.length-1&&1===h.str.length&&!u.endEnter&&n<c.length-1&&(t?i.endLineBox=++n:i.startLineBox=++n,l=(u=c[n]).list,t?i.endTextBox=o=0:i.startTextBox=o=0,h=l[o],t?(i.endString=0,i.end=h.index):(i.startString=0,i.start=h.index))):s===h.str.length-1?o===l.length-1?u.endEnter||n===c.length-1?t?(i.endString++,i.end=h.index+i.endString):(i.startString++,i.start=h.index+i.startString):(t?i.endLineBox=++n:i.startLineBox=++n,l=(u=c[n]).list,t?i.endTextBox=o=0:i.startTextBox=o=0,h=l[o],t?(i.endString=0,i.end=h.index):(i.startString=0,i.start=h.index)):(t?i.endTextBox=++o:i.startTextBox=++o,h=l[o],t?(i.endString=0,i.end=h.index):(i.startString=0,i.start=h.index)):t?(i.endString=++s,i.end=h.index+i.endString):(i.startString=++s,i.start=h.index+i.startString)}else if(40===e){if(d===this._content.length)return;if(n!==c.length-1){u=c[++n],t?i.endLineBox=n:i.startLineBox=n;g=this.getCursorByLocalX(this.tempCursorX,u,t);t&&this.refresh(),this.inputStyle=void 0;var y=bt({x:g.x,y:g.y},r);return{x:y.x,y:y.y,h:u.lineHeight*r[0]}}t?i.endTextBox=o=l.length-1:i.startTextBox=o=l.length-1,h=l[o],t?(i.endString=h?h.str.length:0,i.end=h.index+i.endString):(i.startString=h?h.str.length:0,i.start=h.index+i.startString)}if(h){var b=oe.getFontCanvas().ctx;b.font=h.font,b.letterSpacing=h.letterSpacing+"px";var x=h.str,T=b.measureText(x.slice(0,i.startString)).width;this.tempCursorX=h.x+T}else{var w=this.computedStyle.textAlign;w===H.CENTER?this.tempCursorX=.5*this.width:w===H.RIGHT?this.tempCursorX=this.width:this.tempCursorX=0}t&&this.refresh(),this.inputStyle=void 0;var k=bt({x:this.tempCursorX,y:u.y},r);return{x:k.x,y:k.y,h:u.lineHeight*r[0]}},i.prototype.selectAll=function(){var e=this.lineBoxList,t=e.length,r=e[t-1],i=null==r?void 0:r.list,a=i?i[i.length-1]:void 0;Object.assign(this.cursor,{isMulti:!0,startLineBox:0,startTextBox:0,startString:0,start:0,endLineBox:t-1,endTextBox:i?i.length-1:0,endString:a?a.str.length:0,end:this._content.length}),this.refresh()},i.prototype.input=function(e){var t=this.getSortedCursor(),r=t.isMulti,i=t.start,a=t.end,n=this._content;if(r){var o=this.getCursorRich();this.cursor.isMulti=!1,this._content=n.slice(0,i)+n.slice(a),this.cutRich(i,a),n=this._content,this._content=n.slice(0,i)+e+n.slice(i),this.insertRich(o[0],i,e.length)}else if(this.inputStyle){o=this.getCursorRich();this._content=n.slice(0,i)+e+n.slice(i),this.insertRich(Object.assign({},o[0],this.inputStyle),i,e.length),this.inputStyle=void 0}else this._content=n.slice(0,i)+e+n.slice(i),this.expandRich(i,e.length);this.refresh(ui.REFLOW),this.updateCursorByIndex(i+e.length)},i.prototype.enter=function(){this.inputStyle=void 0;var e=this.getSortedCursor(),t=e.isMulti,r=e.start,i=e.end;if(t){this.cursor.isMulti=!1,this.cutRich(r,i);var a=this._content;this._content=a.slice(0,r)+a.slice(i)}this.expandRich(r,1);var n=this._content;this._content=n.slice(0,r)+"\n"+n.slice(r),this.refresh(ui.REFLOW),this.updateCursorByIndex(r+1)},i.prototype.delete=function(e){void 0===e&&(e=!1),this.inputStyle=void 0;var t=this._content;if(t){var r=this.getSortedCursor(),i=r.isMulti,a=r.start,n=r.end;a<1&&!i&&!e||a===t.length&&e||(i?(this.cursor.isMulti=!1,this._content=t.slice(0,a)+t.slice(n),this.cutRich(a,n)):e?(this._content=t.slice(0,a)+t.slice(a+1),this.cutRich(a,a+1)):(this._content=t.slice(0,a-1)+t.slice(a),this.cutRich(a-1,a)),this.refresh(ui.REFLOW),i||e?this.updateCursorByIndex(a):this.updateCursorByIndex(a-1))}},i.prototype.getSortedCursor=function(){var e,t=this.cursor,r=t.isMulti,i=t.startLineBox,a=t.startTextBox,n=t.startString,o=t.endLineBox,s=t.endTextBox,c=t.endString,u=t.start,l=t.end,h=!1;return r?u>l&&(i=(e=[o,s,c,l,i,a,n,u])[0],a=e[1],n=e[2],u=e[3],o=e[4],s=e[5],c=e[6],l=e[7],h=!0):(o=i,s=a,c=n,l=u),{isMulti:r,startLineBox:i,startTextBox:a,startString:n,endLineBox:o,endTextBox:s,endString:c,start:u,end:l,isReversed:h}},i.prototype.getCursorRich=function(){var e=this.rich,t=this.lineBoxList,r=[];if(!e.length)return r;function i(t,r,i){for(void 0===r&&(r=0),void 0===i&&(i=e.length-1);r<i;){var a=Math.floor(.5*(r+i)),n=e[a];if(n.location<t&&n.location+n.length>=t)return n;n.location>=t?i=Math.min(a,i-1):r=Math.max(a,r+1)}return e[r]}var a=this.getSortedCursor(),n=a.isMulti,o=a.startLineBox,s=a.startTextBox,c=a.startString,u=a.start,l=a.end;if(n)for(var h=0,d=e.length;h<d;h++){if((f=e[h]).location>=l)break;f.location+f.length>u&&r.push(f)}if(!n||!r.length){var f,m=t[o],p=m.list;if(p.length)(f=i(p[s].index+(s+c===0?1:c)))&&-1===r.indexOf(f)&&r.push(f);else(f=i(m.index))&&-1===r.indexOf(f)&&r.push(f)}return r},i.prototype.getCursorByLocalX=function(e,t,r){void 0===r&&(r=!1);var i=t.list,a=this.cursor,n=0,o=t.y,s=t.lineHeight;r?a.endString=a.end=0:a.startString=a.start=0;e:for(var c=0,u=i.length;c<u;c++){var l=(k=i[c]).x,h=k.w,d=k.str,f=k.font,m=k.letterSpacing;if(!c&&e<l||e>=l&&e<l+h||c===u-1){r?a.endTextBox=c:a.startTextBox=c;var p=oe.getFontCanvas().ctx;p.font=f,p.letterSpacing=m+"px";for(var g=0,v=d.length;g<v;){if(g===v-1){var y=p.measureText(d.slice(0,g)).width,b=p.measureText(d.slice(0,v)).width;e-(l+y)>l+b-e?(n=l+b,r?(a.endString=v,a.end=k.index+v):(a.startString=v,a.start=k.index+v)):(n=l+y,r?(a.endString=g,a.end=k.index+g):(a.startString=g,a.start=k.index+g));break e}var x=g+(v-g>>1),T=p.measureText(d.slice(0,x)).width;if(e>l+T)g=x;else{if(!(e<l+T)){r?(a.endString=x,a.end=k.index+x):(a.startString=x,a.start=k.index+x),n=l+T;break e}v=x}}}}var w=r?a.endTextBox:a.startTextBox;if(w<i.length-1){var k=i[w];(r?a.endString:a.startString)===k.str.length&&(r?(a.endTextBox++,a.endString=0,a.end=i[w+1].index):(a.startTextBox++,a.startString=0,a.start=i[w+1].index))}if(!i.length){r?(a.endString=0,a.end=t.index):(a.startString=0,a.start=t.index);var S=this.computedStyle.textAlign;S===H.CENTER?n=.5*this.width:S===H.RIGHT&&(n=this.width)}return{x:n,y:o,h:s}},i.prototype.getRich=function(){return this.rich.map(function(e){return Object.assign({},e)})},i.prototype.getCursor=function(){return Object.assign({},this.cursor)},i.prototype.updateStyle=function(t,r){var i=e.prototype.updateStyle.call(this,t,r);return i&&i&ui.REFLOW_REPAINT&&this.reLocateCursor(),i},i.prototype.updateRangeStyle=function(e,t,r,i){var a=Gr(r),n=this.updateRangeStyleData(e,t,a);return n&&this.refresh(n,i),n&ui.REFLOW_REPAINT&&this.reLocateCursor(),n},i.prototype.updateRangeStyleData=function(e,t,i){var a=ui.NONE,n=this,o=n.rich,s=n.computedRich,c=n.style;if(o.length)for(var u=0,l=o.length;u<l&&!(t<1);u++){var h=o[u],d=s[u];if(e>=h.location&&e<h.location+h.length){if(e>h.location){var f=r(r({},h),{length:e-h.location});o.splice(u,0,f),u++,l++,h.location+=f.length,h.length-=f.length,s.splice(u,0,this.calComputedRich(f)),d.location=h.location,d.length=h.length}var m=!1;if(e+t<h.location+h.length){var p=r(r({},h),{location:e+t,length:h.location+h.length-e-t});o.splice(u+1,0,p),h.length-=p.length,s.splice(u+1,0,this.calComputedRich(p)),d.length=h.length,m=!0}if(a|=this.updateRichItem(h,d,i),m)break;e+=h.length,t-=h.length}}else if(0===e&&t>=this._content.length){var g=this.updateFormatStyle(i);g&&(a|=g)}else{if(e>0){var v=ii({location:0,length:e},c);o.push(v),s.push(this.calComputedRich(v))}var y={location:e,length:t};if(ue.forEach(function(e){y[e]=c[e]}),Object.assign(y,i),o.push(y),s.push(this.calComputedRich(y)),e+t<this._content.length){v=ii({location:e+t,length:this._content.length-e-t},c);o.push(v),s.push(this.calComputedRich(v))}a|=ui.REFLOW}return this.mergeRich(),0===e&&this.updateFormatStyleData(i),a},i.prototype.updateRichItem=function(e,t,r){var i=ui.NONE;if(r.fontFamily&&r.fontFamily.v!==e.fontFamily.v&&(e.fontFamily=r.fontFamily,i|=ui.REFLOW),r.fontSize&&r.fontSize.v!==e.fontSize.v&&(e.fontSize=r.fontSize,i|=ui.REFLOW),r.color&&(e.color.v[0]===r.color.v[0]&&e.color.v[1]===r.color.v[1]&&e.color.v[2]===r.color.v[2]&&e.color.v[3]===r.color.v[3]||(e.color=r.color,i|=ui.REFLOW)),r.letterSpacing&&r.letterSpacing.v!==e.letterSpacing.v&&(e.letterSpacing=r.letterSpacing,i|=ui.REFLOW),r.lineHeight&&r.lineHeight.v!==e.lineHeight.v&&(e.lineHeight=r.lineHeight,i|=ui.REFLOW),r.paragraphSpacing&&r.paragraphSpacing.v!==e.paragraphSpacing.v&&(e.paragraphSpacing=r.paragraphSpacing,i|=ui.REFLOW),r.textAlign&&r.textAlign.v!==e.textAlign.v&&(e.textAlign=r.textAlign,i|=ui.REFLOW),r.textDecoration)if(r.textDecoration.length!==e.textDecoration.length)e.textDecoration=r.textDecoration,i|=ui.REFLOW;else for(var a=0,n=e.textDecoration.length;a<n;a++)if(r.textDecoration[a].v!==e.textDecoration[a].v){e.textDecoration=r.textDecoration,i|=ui.REFLOW;break}return r.textShadow&&r.textShadow.v!==e.textShadow.v&&(e.textShadow=r.textShadow,i|=ui.REFLOW),Object.assign(t,this.calComputedRich(e)),i},i.prototype.getTextBehaviour=function(){var e=this.style,t=e.left,r=e.right,i=e.top,a=e.bottom,n=e.width,o=e.height,s=n.u===V.AUTO&&(t.u===V.AUTO||r.u===V.AUTO),c=o.u===V.AUTO&&(i.u===V.AUTO||a.u===V.AUTO);return s?"auto":c?"autoH":"fixed"},i.prototype.cloneProps=function(){var t=e.prototype.cloneProps.call(this);if(t.rich=this.rich.map(function(e){return ci(e)}),this.isMounted){var r=t.textBehaviour=this.getTextBehaviour(),i=t.style;"auto"===r?(i.width=this.width,i.height=this.height):"autoH"===r&&(i.height=this.height)}return t.content=this._content,t},i.prototype.clone=function(){return new i(this.cloneProps())},Object.defineProperty(i.prototype,"bbox",{get:function(){var e=this._bbox;if(!e){var t=this._rect||this.rect;e=this._bbox=t.slice(0),this.lineBoxList.forEach(function(t){t.list.forEach(function(t){var r=t.fontFamily,i=t.fontSize,a=t.lineHeight,n=t.str,o=t.font,s=t.textShadow,c=a;if(Xe.hasRegister(r)){c=Xe.data[r].lhr*i}else{var u=oe.getFontCanvas().ctx;u.font=o;var l=u.measureText(n);c=l.actualBoundingBoxAscent+l.actualBoundingBoxDescent}var h=Math.max(0,.5*(c-a));if(h>0){var d=t.y-h,f=t.lineHeight+h;e[1]=Math.min(e[1],d),e[3]=Math.max(e[3],f)}if(s){var m=Or(s.blur),p=s.x+m,g=s.y+m;p>0?e[2]=Math.max(e[2],t.x+t.w+p):p<0&&(e[0]=Math.min(e[0],t.x+p)),g>0?e[3]=Math.max(e[3],t.y+t.lineHeight+g+h):g<0&&(e[1]=Math.min(e[1],t.y+g-h))}})});var r=this.computedStyle,i=r.strokeWidth,a=r.strokeEnable,n=r.strokePosition,o=0;i.forEach(function(e,t){a[t]&&(n[t]===J.INSIDE||(o=n[t]===J.OUTSIDE?Math.max(o,2*e):Math.max(o,.5*e*2)))}),e[0]-=o,e[1]-=o,e[2]+=o,e[3]+=o}return e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"content",{get:function(){return this._content},set:function(e){this._content!==e&&(this._content=e,this.refresh(ui.REFLOW))},enumerable:!1,configurable:!0}),i}(ka);function sm(e){return(e.curveMode===ce.STRAIGHT||e.curveMode===ce.NONE||"straight"===e.curveMode||"none"===e.curveMode)&&!!e.cornerRadius&&e.cornerRadius>0}function cm(e,t,r,i,a,n){var o=vr(e.absX,e.absY,t.absX,t.absY),s=vr(t.absX,t.absY,r.absX,r.absY),c=yr(vr(e.absX,e.absY,r.absX,r.absY),o,s),u=Math.tan(.5*c),l=n/u,h=Math.min(i?.5*o:o,a?.5*s:s);l>h&&(n=(l=h)*u);var d=Ze(e.absX-t.absX,e.absY-t.absY),f=Ze(r.absX-t.absX,r.absY-t.absY),m={x:d.x*l,y:d.y*l};m.x+=t.absX,m.y+=t.absY;var p={x:f.x*l,y:f.y*l};p.x+=t.absX,p.y+=t.absY;var g=4/3*Math.tan((Math.PI-c)/4),v={x:d.x*-n*g,y:d.y*-n*g};v.x+=m.x,v.y+=m.y;var y={x:f.x*-n*g,y:f.y*-n*g};return y.x+=p.x,y.y+=p.y,{prevTangent:m,prevHandle:v,nextTangent:p,nextHandle:y}}function um(e,t,r,i,a,n){var o,s,c,u;if(i){var l=Math.sqrt(Math.pow(t.absX-e.absX,2)+Math.pow(t.absY-e.absY,2));n=Math.min(n,.5*l)}if(a){l=Math.sqrt(Math.pow(t.absX-r.absX,2)+Math.pow(t.absY-r.absY,2));n=Math.min(n,.5*l)}var h=e.absFx-t.absX,d=e.absFy-t.absY,f=r.absTx-t.absX,m=r.absTy-t.absY,p=e.absX-t.absX,g=e.absY-t.absY,v=r.absX-t.absX,y=r.absY-t.absY,b=qe(h,d,f,m),x=qe(p,g,v,y),T=qe(h,d,p,g),w=qe(f,m,v,y);if(!(Math.abs(b)<1e-6)){var k=[{x:e.absX,y:e.absY},{x:null!==(o=e.absFx)&&void 0!==o?o:e.absX,y:null!==(s=e.absFy)&&void 0!==s?s:e.absY},{x:t.absX,y:t.absY}],S=[{x:t.absX,y:t.absY},{x:null!==(c=r.absTx)&&void 0!==c?c:r.absX,y:null!==(u=r.absTy)&&void 0!==u?u:r.absY},{x:r.absX,y:r.absY}],E=dr.intersectBezier2Bezier2(k[0].x,k[0].y,k[1].x,k[1].y,k[2].x,k[2].y,S[0].x,S[0].y,S[1].x,S[1].y,S[2].x,S[2].y).filter(function(e){return e.x!==S[0].x&&e.y!==S[0].y}).sort(function(e,t){return e.t1===t.t1?t.t2-e.t2:t.t1-e.t1}),C=E.length;if(!C)return lm(k,S,t,C,!1,b,x,T,w,n,0,1,0,1);var A=E.map(function(e){return e.t1}),_=E.map(function(e){return Ut(S,e.x,e.y)[0]});if(!_.find(function(e){return void 0===e})){var M=!1;A.unshift(1),A.push(0),_.unshift(0),_.push(1);for(var I=0;I<=C;I++){var R=lm(k,S,t,C,M,b,x,T,w,n,A[I+1],A[I],_[I],_[I+1]);if(R)return R;M=!M}}}}function lm(e,t,r,i,a,n,o,s,c,u,l,h,d,f){var m=dm(e,i,a,n,o,s,u,!0,l,h),p=dm(t,i,a,n,o,c,u,!1,d,f);if(!(!m||m.length<2||!p||p.length<2)){var g=function(e,t){var r=pm(e,0),i=pm(t,1),a=function(e){var t={};e.forEach(function(e){var r,i=e.x1,a=e.x2;i>a&&(i=(r=[a,i])[0],a=r[1]),fm(t,i,e),fm(t,a,e)});var r=[];return Object.keys(t).forEach(function(e){return r.push({x:parseFloat(e),arr:t[e]})}),r.sort(function(e,t){return e.x-t.x})}(r.concat(i)),n=[],o=[],s=[];for(;a.length;){o.length&&o.splice(0).forEach(function(e){var t=n.indexOf(e);n.splice(t,1)});for(var c=a.shift().arr;c.length;){var u=c.shift();if(!u.isDeleted){var l=u.belong,h=u.bbox;if(u.isVisited)o.push(u);else{if(n.length)for(var d=u.x1,f=u.y1,m=u.x2,p=u.y2,g=u.bbox,v=0;v<n.length;v++){var y=n[v];if(!y.isDeleted&&!u.isDeleted&&y.belong!==l){var b=y.x1,x=y.y1,T=y.x2,w=y.y2;if(xr(h[0],h[1],h[2],h[3],g[0],g[1],g[2],g[3],!0)){var k=(w-x)*(m-d)-(T-b)*(p-f);if(0!==k){var S=((T-b)*(f-x)-(w-x)*(d-b))/k,E=((m-d)*(f-x)-(p-f)*(d-b))/k;if(S>=0&&S<=1&&E>=0&&E<=1){var C=d+S*(m-d),A=f+S*(p-f);s.push({x:C,y:A,t1:0===l?u.t:y.t,t2:0===l?y.t:u.t}),u.isDeleted=!0;break}}}}}u.isDeleted||(n.push(u),u.isVisited=!0)}}}}return s}(m,p);if(g.length){var v=g[0];if(g.length>1)for(var y=Math.pow(r.absX-v.x,2)+Math.pow(r.absY-v.y,2),b=1,x=g.length;b<x;b++){var T=g[b],w=Math.pow(r.absX-T.x,2)+Math.pow(r.absY-T.y,2);w<y&&(v=T,y=w)}var k=Ft(e,v.t1),S=Ft(t,v.t2),E=zt(e,v.t1),C=zt(t,v.t2),A=k.y-E*k.x,_=(S.y-C*S.x-A)/(E-C),M=E*_+A;Math.abs(E)<1e-9?(M=k.y,C!==1/0&&C!==-1/0||(_=S.x)):Math.abs(C)<1e-9?(M=S.y,E!==1/0&&E!==-1/0||(_=k.x)):E===1/0||E===-1/0?(_=k.x,M=S.y):C!==1/0&&C!==-1/0||(_=S.x,M=k.y);var I=vr(k.x,k.y,_,M),R=vr(_,M,S.x,S.y),P=yr(vr(k.x,k.y,S.x,S.y),I,R),O=4/3*Math.tan((Math.PI-P)/4),D=Ze(k.x-_,k.y-M),B=Ze(S.x-_,S.y-M),F={x:D.x*-u*O,y:D.y*-u*O};F.x+=k.x,F.y+=k.y;var L={x:B.x*-u*O,y:B.y*-u*O};return L.x+=S.x,L.y+=S.y,{prevTangent:k,prevHandle:F,nextTangent:S,nextHandle:L,t1:v.t1,t2:v.t2}}}}var hm={11010:1,11e3:1,11110:1,11100:1,11001:1,11111:1,11012:1,11002:1,11112:1,11102:1,11013:1,11103:1,10010:0,10100:0,10011:0,10001:0,10111:0,10101:0,"00010":0,"00000":0,"00110":0,"00100":0,"00011":0,"00101":0,"00002":0,"00012":0,"00102":0,"00112":0,"00003":0,"00103":0,"01000":1,"01110":1,"01001":1,"01011":1,"01101":1,"01111":1};function dm(e,t,r,i,a,n,o,s,c,u){var l=(a>=0?"0":"1")+(i>=0?"0":"1")+(s?"0":"1")+(n>=0?"0":"1")+t;if(hm.hasOwnProperty(l)){for(var h=Math.ceil(Pt(e)),d=[],f=function(t){var i=t/h;if(i<=c||i>u)return"continue";var a,n=2*(e[0].x-2*e[1].x+e[2].x)*i+2*e[1].x-2*e[0].x,s=2*(e[0].y-2*e[1].y+e[2].y)*i+2*e[1].y-2*e[0].y,f=Ft(e,i),m=zt(e,i),p=0;p=Math.abs(m)<1e-12?1/0:m===1/0||m===-1/0?0:-1/m,a=p===1/0?f.y:f.y-p*f.x;var g=void 0,v=void 0;p===1/0?(g=[f.x,f.x],v=[f.y-o,f.y+o]):v=(g=Et([Math.pow(f.x,2)+Math.pow(a,2)-2*f.y*a+Math.pow(f.y,2)-Math.pow(o,2),2*(a*p-f.x-f.y*p),Math.pow(p,2)+1])).map(function(e){return p*e+a});var y=qe(g[0]-f.x,v[0]-f.y,n,s)>=0?0:1;r&&(y=(y+1)%2),hm[l]===y?d.push({x:g[0],y:v[0],t:i}):d.push({x:g[1],y:v[1],t:i})},m=0;m<=h;m++)f(m);return d}}function fm(e,t,r){var i=e[t]=e[t]||[];r.isVisited?(i.unshift(r),r.isVisited=!1):(i.push(r),r.isVisited=!0)}var mm=0;function pm(e,t){for(var r,i,a=[],n=1,o=e.length;n<o;n++){var s=e[n-1],c=s.x,u=s.y,l=s.t,h=e[n],d=h.x,f=h.y,m=h.t;(d<c||c===d&&f<u)&&(c=(r=[d,c])[0],d=r[1],u=(i=[f,u])[0],f=i[1]);var p=[c,Math.min(u,f),d,Math.max(u,f)];a.push({id:mm++,x1:c,y1:u,x2:d,y2:f,bbox:p,belong:t,isVisited:!1,isDeleted:!1,t:.5*(l+m)})}return a}var gm,vm=function(e){function r(t){var r=e.call(this,t)||this;return r.props=t,r.points=[],t.points.forEach(function(e){r.points.push(si(e))}),r.isClosed=t.isClosed||!1,r}return t(r,e),r.prototype.lay=function(t){e.prototype.lay.call(this,t),this.coords=void 0},r.prototype.calRepaintStyle=function(t){e.prototype.calRepaintStyle.call(this,t),this.coords=void 0,this._rect=void 0},r.prototype.buildPoints=function(){this.coords||(this.coords=function(e,t,r,i){if(void 0===r&&(r=1),void 0===i&&(i=1),!e.length)return[];for(var a=[],n=!1,o=0,s=e.length;o<s;o++)(O=e[o]).absX=(O.x||0)*r,O.absY=(O.y||0)*i,O.absTx=O.tx*r,O.absTy=O.ty*i,O.absFx=O.fx*r,O.absFy=O.fy*i,sm(O)&&(n=!0);var c=[];if(n){o=0;for(var u=e.length;o<u;o++){var l=e[o];if(sm(l)){var h=(o+1)%u,d=e[o?o-1:u-1],f=e[h],m=l.cornerRadius,p=sm(d),g=p||d.curveMode===ce.STRAIGHT||!d.hasCurveFrom,v=sm(f),y=v||f.curveMode===ce.STRAIGHT||!f.hasCurveTo;c[o]=g&&y?cm(d,l,f,p,v,m):um(d,l,f,p,v,m)}}}for(var b=e.map(function(e){return Object.assign({},e)}),x=(o=0,b.length);o<x;o++){var T=c[o];if(T){var w=T.prevTangent,k=T.prevHandle,S=T.nextTangent,E=T.nextHandle,C={x:0,y:0,cornerRadius:0,curveMode:ce.NONE,hasCurveFrom:!0,fx:0,fy:0,hasCurveTo:!1,tx:0,ty:0,absX:w.x,absY:w.y,absFx:k.x,absFy:k.y,absTx:0,absTy:0,dspX:0,dspY:0,dspFx:0,dspFy:0,dspTx:0,dspTy:0},A={x:0,y:0,cornerRadius:0,curveMode:ce.NONE,hasCurveFrom:!1,fx:0,fy:0,hasCurveTo:!0,tx:0,ty:0,absX:S.x,absY:S.y,absFx:0,absFy:0,absTx:E.x,absTy:E.y,dspX:0,dspY:0,dspFx:0,dspFy:0,dspTx:0,dspTy:0};if(T.t1){var _=Bt([{x:(D=b[(o+x-1)%x]).absX,y:D.absY},{x:D.absFx,y:D.absFy},{x:b[o].absX,y:b[o].absY}],0,T.t1);D.absFx=_[1].x,D.absFy=_[1].y}if(T.t2){var M=b[(o+1)%x];_=Bt([{x:M.absX,y:M.absY},{x:M.absTx,y:M.absTy},{x:b[o].absX,y:b[o].absY}],0,1-T.t2),M.absTx=_[1].x,M.absTy=_[1].y}b.splice(o,1,C,A),o++,x++,c.splice(o,0,void 0)}}var I=b[0],R=[I.absX,I.absY];a.push(R);var P=b.length;for(o=1;o<P;o++){var O=b[o],D=b[o-1],B=[O.absX,O.absY];O.hasCurveTo&&B.unshift(O.absTx,O.absTy),D.hasCurveFrom&&B.unshift(D.absFx,D.absFy),a.push(B)}if(t){var F=b[P-1],L=[I.absX,I.absY];I.hasCurveTo&&L.unshift(I.absTx,I.absTy),F.hasCurveFrom&&L.unshift(F.absFx,F.absFy),a.push(L)}return a}(this.points,this.isClosed,this.width,this.height))},r.prototype.calContent=function(){return this.buildPoints(),this.hasContent=!!this.coords&&this.coords.length>1},r.prototype.isLine=function(){this.buildPoints();var e=this.coords;return!!e&&2===e.length&&2===e[0].length&&2===e[1].length},r.prototype.refresh=function(t,r){void 0===t&&(t=ui.REPAINT),t>=ui.REPAINT&&(this.coords=void 0),e.prototype.refresh.call(this,t,r)},r.prototype.renderCanvas=function(){e.prototype.renderCanvas.call(this),this.buildPoints();var t=this.coords;t&&t.length&&this.renderFillStroke([t],!1)},Object.defineProperty(r.prototype,"rect",{get:function(){var e=this._rect;if(!e){e=this._rect=new Float32Array(4),this.buildPoints();var t=this.coords;t&&t.length&&function(e,t){var r=!0;t=t||new Float32Array(4);for(var i=0,a=0,n=0,o=e.length;n<o;n++){var s=e[n];if(r){if(!(c=fi(s,t))){oe.error("Unsupported point data: "+n+" - "+s.join(","));continue}i=c.x,a=c.y,r=!1}else{var c;if(!(c=mi(s,i,a,t))){oe.error("Unsupported point data: "+n+" - "+s.join(","));continue}i=c.x,a=c.y}}}(t,e)}return e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"bbox",{get:function(){var e=this._bbox;if(!e){var t=this._rect||this.rect;e=this._bbox=t.slice(0),this.buildPoints();var r=this.computedStyle,i=r.strokeWidth,a=r.strokeEnable,n=r.strokePosition,o=r.strokeLinecap,s=r.strokeLinejoin,c=r.strokeMiterlimit,u=this.isClosed,l=0;i.forEach(function(e,t){a[t]&&(n[t]===J.OUTSIDE&&u?l=Math.max(l,e):n[t]!==J.CENTER&&u||(l=Math.max(l,.5*e)))});var h=e[0]-l,d=e[1]-l,f=e[2]+l,m=e[3]+l;e=this._bbox=u?function(e,t,r,i,a){var n=e.slice(0);if(i===Z.ROUND)return n[0]-=t,n[1]-=t,n[2]+=t,n[3]+=t,n;if(!r.length)return n;for(var o=[],s=[],c=r[0],u=c[0],l=c[1],h=1,d=r.length;h<d;h++){var f=0,m=0;2===(y=r[h]).length?(f=y[0]-u,m=y[1]-l,u=y[0],l=y[1],o.push([f,m])):4===y.length?(f=2*(u-2*y[0]+y[2])+2*y[0]-2*u,m=2*(l-2*y[1]+y[3])+2*y[1]-2*l,u=y[2],l=y[3],o.push([f,m])):6===y.length&&(f=3*(-u+3*y[0]-3*y[2]+y[4])+2*(3*u-6*y[0]+3*y[2])+3*y[0]-3*u,m=3*(-l+3*y[1]-3*y[3]+y[5])+2*(3*l-6*y[1]+3*y[3])+3*y[1]-3*l,u=y[4],l=y[5],o.push([f,m]));var p=Math.atan(Math.abs(m/f)),g=Math.sin(p)*t,v=Math.cos(p)*t;f>=0?m>=0?s.push([-g,v]):s.push([g,v]):m>=0?s.push([-g,-v]):s.push([g,-v])}for(h=0,d=o.length;h<d;h++){var y=o[h],b=o[(h+1)%d];if(y[0]&&y[1]&&b[0]&&b[1]){var x=qe(y[0],y[1],b[0],b[1]),T=s[h],w=s[(h+1)%d];if(T[0]||T[1]||w[0]||w[1]){var k=0,S=0,E=0,C=0,A=[y[0]+T[0],y[1]+T[1]],_=qe(y[0],y[1],A[0],A[1]);x>=0&&_>=0||x<0&&_<0?(k=-T[0],S=-T[1]):(k=T[0],S=T[1]);var M=[b[0]+w[0],b[1]+w[1]],I=qe(b[0],b[1],M[0],M[1]);x>=0&&I>=0||x<0&&I<0?(E=-w[0],C=-w[1]):(E=w[0],C=w[1]);var R=r[h],P=r[h+1],O=r[(h+2)%d],D=R.length,B=P.length,F=O.length,L=R[D-2]+k,N=R[D-1]+S,U=P[B-2]+k,z=P[B-1]+S,W=P[B-2]+E,V=P[B-1]+C,H=cr(L,N,U,z,W,V,O[F-2]+E,O[F-1]+C,!1);if(H&&1!==H.toSource&&0!==H.toClip)if(i===Z.BEVEL)if((q=2*t/Math.sqrt(Math.pow(W-U,2)+Math.pow(V-z,2)))>=1)n[0]=Math.min(n[0],U,W),n[1]=Math.min(n[1],z,V),n[2]=Math.max(n[2],U,W),n[3]=Math.max(n[3],z,V);else{var X=H.x-(H.x-U)*q,j=H.y-(H.y-z)*q,G=H.x-(H.x-W)*q,Y=H.y-(H.y-V)*q;n[0]=Math.min(n[0],X,G),n[1]=Math.min(n[1],j,Y),n[2]=Math.max(n[2],X,G),n[3]=Math.max(n[3],j,Y)}else if(i===Z.MITER){var q;if((q=Math.sqrt(Math.pow(H.x-P[B-2],2)+Math.pow(H.y-P[B-1],2))/t)>a){var K=2*t/Math.sqrt(Math.pow(W-U,2)+Math.pow(V-z,2));K>=1?(n[0]=Math.min(n[0],U,W),n[1]=Math.min(n[1],z,V),n[2]=Math.max(n[2],U,W),n[3]=Math.max(n[3],z,V)):(X=H.x-(H.x-U)*K,j=H.y-(H.y-z)*K,G=H.x-(H.x-W)*K,Y=H.y-(H.y-V)*K,n[0]=Math.min(n[0],X,G),n[1]=Math.min(n[1],j,Y),n[2]=Math.max(n[2],X,G),n[3]=Math.max(n[3],j,Y))}else n[0]=Math.min(n[0],H.x),n[1]=Math.min(n[1],H.y),n[2]=Math.max(n[2],H.x),n[3]=Math.max(n[3],H.y)}}}}return n}(e,l,this.coords||[],s,c):function(e,t,r,i){var a=e.slice(0);if(i===Q.ROUND&&(a[0]-=t,a[1]-=t,a[2]+=t,a[3]+=t),!r.length)return a;for(var n=r[0],o=r[r.length-1],s=o.length,c=[],u=0;u<s;u+=2)c.push({x:o[u],y:o[u+1]});var l=0,h=0;s>2?(l=Math.abs(zt(c,0)),h=Math.abs(zt(c,1))):l=h=Math.abs(o[s-1]-n[1])/Math.abs(o[s-2]-n[0]);var d=Math.atan(l),f=Math.atan(h),m=Math.sin(d),p=Math.cos(d),g=Math.sin(f),v=Math.cos(f),y=m===1/0?t:Math.abs(m*t),b=p===1/0?t:Math.abs(p*t),x=g===1/0?t:Math.abs(g*t),T=v===1/0?t:Math.abs(v*t);return i===Q.BUTT?(a[0]=Math.min(a[0],n[0]-y,o[s-2]-x),a[1]=Math.min(a[1],n[1]-b,o[s-1]-T),a[2]=Math.max(a[2],n[0]+y,o[s-2]+x),a[3]=Math.max(a[3],n[1]+b,o[s-1]+T)):i===Q.SQUARE&&(a[0]=Math.min(a[0],n[0]-y-b,o[s-2]-x-T),a[1]=Math.min(a[1],n[1]-y-b,o[s-1]-x-T),a[2]=Math.max(a[2],n[0]+y+b,o[s-2]+x+T),a[3]=Math.max(a[3],n[1]+y+b,o[s-1]+x+T)),a}(e,l,this.coords||[],o),e[0]=Math.min(e[0],h),e[1]=Math.min(e[1],d),e[2]=Math.max(e[2],f),e[3]=Math.max(e[3],m)}return e},enumerable:!1,configurable:!0}),r}(ka),ym={Container:Ba,Bitmap:Oa,Node:ka,Root:Jf,Video:ef,Audio:Sf,Text:om,Lottie:Ff,Polyline:vm};!function(e){e[e.NONE=0]="NONE",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED"}(gm||(gm={}));var bm,xm={};!function(e){e[e.NONE=0]="NONE",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED"}(bm||(bm={}));var Tm={};var wm,km={type:_,Event:M,inject:oe,opentype:Le,loadImg:Ea,loadAudio:function(e,t){return i(this,void 0,void 0,function(){var r,i,n,o;return a(this,function(a){switch(a.label){case 0:if(r=xm[e]){if(r.count++,r.state===gm.LOADED)return[2,r.res];if(r.state===gm.LOADING)return[2,new Promise(function(e){r.list.push(e)})]}return r=xm[e]={state:gm.LOADING,list:[],count:0,res:{success:!1,duration:0,release:function(){r.count--,r.count<=0&&(r.res.audioBuffer=void 0,delete xm[e])}}},[4,fetch(e,Object.assign({mode:"cors"},t))];case 1:return 200!==(i=a.sent()).status&&304!==i.status?(r.state=gm.LOADED,[2,r.res]):[4,i.arrayBuffer()];case 2:return n=a.sent(),[4,(new AudioContext).decodeAudioData(n)];case 3:return o=a.sent(),r.count++,[2,new Promise(function(e){r.res.success=!0,r.res.audioBuffer=o,r.res.duration=Math.ceil(1e3*o.duration),r.state=gm.LOADED,e(r.res),r.list.splice(0).forEach(function(e){r.count++,e(r.res)})})]}})})},loadFont:function(e,t,r){return i(this,void 0,void 0,function(){var i,n,o;return a(this,function(a){switch(a.label){case 0:if(i=Tm[e]){if(i.count++,i.state===bm.LOADED)return[2,i.res];if(i.state===bm.LOADING)return[2,new Promise(function(e){i.list.push(e)})]}return i=Tm[e]={state:bm.LOADING,list:[],count:0,res:{success:!1,release:function(){i.count--,i.count<=0&&delete Tm[e]}}},[4,fetch(e,Object.assign({mode:"cors"},r))];case 1:return 200!==(n=a.sent()).status&&304!==n.status?(i.state=bm.LOADED,[2,i.res]):[4,n.arrayBuffer()];case 2:return o=a.sent(),[4,Xe.registerAb(o,t)];case 3:return a.sent(),i.count++,[2,new Promise(function(e){i.res.success=!0,i.res.arrayBuffer=o,i.state=bm.LOADED,e(i.res),i.list.splice(0).forEach(function(e){i.count++,e(i.res)})})]}})})},loadRange:Hd,MbVideoDecoder:Jd,MbVideoDecoderEvent:jd,MbVideoEncoder:Zf,MbVideoEncoderEvent:Kf,sound:$f},Sm={font:Xe,transform:Rr,define:le,css:li,color:pe},Em=function(){function e(e,t){this.root=e,this.dom=t;var r=this.select=document.createElement("div");r.className="select",r.style.display="none",r.innerHTML='\n <div class="sub"></div>\n <span class="l">\n <b></b>\n </span>\n <span class="t">\n <b></b>\n </span>\n <span class="r">\n <b></b>\n </span>\n <span class="b">\n <b></b>\n </span>\n <span class="tl">\n <b></b>\n </span>\n <span class="tr">\n <b></b>\n </span>\n <span class="br">\n <b></b>\n </span>\n <span class="bl">\n <b></b>\n </span>\n',t.appendChild(r)}return e.prototype.showSelect=function(e){this.updateSelect(e),this.select.style.display="block"},e.prototype.updateSelect=function(e){var t=this.select.querySelector(".sub");if(1===e.length){t.innerHTML="",this.select.classList.remove("multi"),e[0].computedStyle.visibility===te.VISIBLE?this.select.classList.remove("hide"):this.select.classList.add("hide");var r=this.calRect(e[0]);this.select.style.left=r.left+"px",this.select.style.top=r.top+"px",this.select.style.width=r.width+"px",this.select.style.height=r.height+"px",this.select.style.transform=r.transform}},e.prototype.calRect=function(e){var t=this.root.canvas,r=e._rect||e.rect,i=e.matrixWorld,a=t.clientWidth/t.width,n=t.clientHeight/t.height;if(1!==a||1!==n){var o=at();i=ot(o,i),vt(o,a),yt(o,n),i=ot(o,i)}var s=Tt(r[0],r[1],r[2],r[3],i),c=s.x1,u=s.y1,l=s.x2,h=s.y2,d=s.x3,f=s.y3;s.x4,s.y4;var m={left:c,top:u,width:Math.sqrt(Math.pow(c-l,2)+Math.pow(u-h,2)),height:Math.sqrt(Math.pow(l-d,2)+Math.pow(h-f,2)),transform:""};if(l>c){if(h!==u){var p=mr(Math.atan((h-u)/(l-c)));m.transform="rotateZ(".concat(p,"deg)")}}else if(l<c){p=mr(Math.atan((h-u)/(l-c)));m.transform="rotateZ(".concat(p+180,"deg)")}else h>u?m.transform="rotateZ(90deg)":h<u&&(m.transform="rotateZ(-90deg)");return m},e.prototype.hideSelect=function(){this.select.style.display="none"},e.prototype.release=function(){this.select.remove()},e.prototype.metaKey=function(e){e?this.select.classList.add("rotate"):this.select.classList.remove("rotate")},e.prototype.isSelectControlDom=function(e){return e.parentElement===this.select},e.prototype.getAspectRatio=function(){var e=this.select.style;return{x:parseFloat(e.left),y:parseFloat(e.top),w:parseFloat(e.width),h:parseFloat(e.height)}},e}();!function(e){e[e.NORMAL=0]="NORMAL",e[e.HAND=1]="HAND",e[e.RESIZE=2]="RESIZE",e[e.EDIT_TEXT=3]="EDIT_TEXT",e[e.EDIT_GRADIENT=4]="EDIT_GRADIENT",e[e.EDIT_GEOM=5]="EDIT_GEOM",e[e.ADD_TEXT=6]="ADD_TEXT",e[e.ADD_RECT=7]="ADD_RECT",e[e.ADD_OVAL=8]="ADD_OVAL",e[e.ADD_ROUND=9]="ADD_ROUND",e[e.ADD_TRIANGLE=10]="ADD_TRIANGLE",e[e.ADD_LINE=11]="ADD_LINE",e[e.ADD_STAR=12]="ADD_STAR",e[e.ADD_IMG=13]="ADD_IMG",e[e.ADD_PEN=14]="ADD_PEN",e[e.ADD_CUSTOM_GEOM=15]="ADD_CUSTOM_GEOM"}(wm||(wm={}));var Cm,Am=wm,_m="cursor",Mm="content",Im="state_change",Rm={SELECT:"select",MOVE:"move",REMOVE:"remove",ADD:"add",RESIZE:"resize",ROTATE:"rotate",CURSOR:_m,CONTENT:Mm,STATE_CHANGE:Im},Pm=function(e){this.nodes=e},Om=function(e){function r(t,r){var i=e.call(this,t)||this;return i.data=r,i}return t(r,e),r.prototype.execute=function(){var e=this.nodes,t=this.data;e.forEach(function(e,i){var a=t[i],n=a.dx,o=a.dy,s=e.getStyle(),c=e.computedStyle;r.operate(e,c,n,o),e.endPosChange(s,n,o),e.checkPosSizeUpward()})},r.prototype.undo=function(){var e=this.nodes,t=this.data;e.forEach(function(e,i){var a=t[i],n=a.dx,o=a.dy,s=e.getStyle(),c=e.computedStyle;r.operate(e,c,-n,-o),e.endPosChange(s,-n,-o),e.checkPosSizeUpward()})},r.operate=function(e,t,r,i){e.updateStyle({translateX:t.translateX+r,translateY:t.translateY+i})},r}(Pm);var Dm=function(){function e(e){void 0===e&&(e=100),this.commands=[],this.commandsR=[],this.size=Math.max(1,e),this.lastTime=0}return e.prototype.addCommand=function(e,t){void 0===t&&(t=!1),this.commandsR.splice(0);var r=this.commands.length;if(!t&&r>0){var i=this.commands[r-1];if(Date.now()-this.lastTime<L.historyTime&&function(e,t){if(e.constructor!==t.constructor)return!1;var r=e.nodes,i=t.nodes;if(r.length!==i.length)return!1;for(var a=0,n=r.length;a<n;a++)if(r[a]!==i[a])return!1;return!0}(i,e)){var a=!0;if(i instanceof Om){var n=e.data;i.data.forEach(function(e,t){e.dx+=n[t].dx,e.dy+=n[t].dy})}else a=!1;if(a)return void(this.lastTime=Date.now())}}this.lastTime=Date.now(),r>=this.size&&this.commands.slice(0,r-this.size+1),this.commands.push(e)},e.prototype.undo=function(){if(this.commands.length){var e=this.commands.pop();return e.undo(),this.commandsR.push(e),e}},e.prototype.redo=function(){if(this.commandsR.length){var e=this.commandsR.pop();return e.execute(),this.commands.push(e),e}},e.getInstance=function(){return Cm||(Cm=new e),Cm},e}();var Bm,Fm=function(e){function r(t,r){var i=e.call(this,t)||this;return i.data=r,i}return t(r,e),r.prototype.execute=function(){this.nodes.forEach(function(e){e.remove()})},r.prototype.undo=function(){var e=this.nodes,t=this.data;e.forEach(function(e,r){!function(e,t){var r=e.style,i=e.computedStyle,a=t.x,n=t.y,o=t.parent,s=t.index,c=C(r.top),u=C(r.right),l=C(r.bottom),h=C(r.left),d=C(r.width),f=C(r.height);r.left={v:a,u:V.PX},r.right={v:0,u:V.AUTO},r.top={v:n,u:V.PX},r.bottom={v:0,u:V.AUTO},r.width={v:i.width,u:V.PX},r.height={v:i.height,u:V.PX},function(e,t,r){var i=e.children;r<=0?e.prependChild(t):r>=i.length?e.appendChild(t):i[r].insertAfter(t)}(o,e,s),h.u===V.PERCENT?r.left={v:100*i.left/o.width,u:V.PERCENT}:h.u===V.PX?r.left={v:i.left,u:V.PX}:h.u===V.AUTO&&(r.left={v:0,u:V.AUTO}),u.u===V.PERCENT?r.right={v:100*i.right/o.width,u:V.PERCENT}:u.u===V.PX?r.right={v:i.right,u:V.PX}:u.u===V.AUTO&&(r.right={v:0,u:V.AUTO}),c.u===V.PERCENT?r.top={v:100*i.top/o.height,u:V.PERCENT}:c.u===V.PX?r.top={v:i.top,u:V.PX}:c.u===V.AUTO&&(r.top={v:0,u:V.AUTO}),l.u===V.PERCENT?r.bottom={v:100*i.bottom/o.height,u:V.PERCENT}:l.u===V.PX?r.bottom={v:i.bottom,u:V.PX}:l.u===V.AUTO&&(r.bottom={v:0,u:V.AUTO}),d.u===V.PERCENT?r.width={v:100*i.width/o.width,u:V.PERCENT}:d.u===V.PX?r.width={v:i.width,u:V.PX}:d.u===V.AUTO&&(r.width={v:0,u:V.AUTO}),f.u===V.PERCENT?r.height={v:100*i.height/o.height,u:V.PERCENT}:f.u===V.PX?r.height={v:i.height,u:V.PX}:f.u===V.AUTO&&(r.height={v:0,u:V.AUTO})}(e,t[r])})},r.operate=function(e){var t=e.parent,r=t.children.indexOf(e),i={x:e.computedStyle.left,y:e.computedStyle.top,parent:t,index:r};return e.remove(),i},r}(Pm);function Lm(e,t,r,i){void 0===i&&(i=!1);var a=e.style,n={};if(r>t.height){r-=t.height,r=Math.max(r,1),a.top.u===V.PX?n.top=t.top+t.height:a.left.u===V.PERCENT&&(n.top=100*(t.top+t.height)/e.parent.height+"%");var o=Object.assign({},t);o.height=0,Object.assign(n,Nm(e,o,r)),n.scaleY=-1*t.scaleY}else r=Math.min(r,t.height-1),n.scaleY=t.scaleY,a.top.u===V.PX||a.top.u===V.PERCENT?(a.top.u===V.PX?n.top=t.top+r:n.top=100*(t.top+r)/e.parent.height+"%",a.height.u===V.PX||a.height.u===V.AUTO&&a.bottom.u===V.AUTO?n.height=t.height-r:a.height.u===V.PERCENT&&(n.height=100*(t.height-r)/e.parent.height+"%")):a.height.u!==V.PX&&a.height.u!==V.PERCENT&&a.height.u!==V.AUTO||(a.height.u===V.PX||a.height.u===V.AUTO?n.height=t.height-r:n.height=100*(t.height-r)/e.parent.height+"%");if(i){var s=Nm(e,t,-r);s.height&&("number"==typeof s.height?s.height=t.height-2*r:s.height=100*(t.height-2*r)/e.parent.height+"%"),Object.assign(n,s)}return n}function Nm(e,t,r,i){void 0===i&&(i=!1);var a=e.style,n={};if(r<-t.height){r+=t.height,r=Math.min(r,-1),a.bottom.u===V.PX?n.bottom=t.bottom+t.height:a.bottom.u===V.PERCENT&&(n.bottom=100*(t.bottom+t.height)/e.parent.height+"%");var o=Object.assign({},t);o.height=0,Object.assign(n,Lm(e,o,r)),n.scaleY=-1*t.scaleY}else r=Math.max(r,1-t.height),n.scaleY=t.scaleY,a.bottom.u===V.PX||a.bottom.u===V.PERCENT?(a.bottom.u===V.PX?n.bottom=t.bottom-r:n.bottom=100*(t.bottom-r)/e.parent.height+"%",a.height.u===V.PX||a.height.u===V.AUTO&&a.top.u===V.AUTO?n.height=t.height+r:a.height.u===V.PERCENT&&(n.height=100*(t.height+r)/e.parent.height+"%")):a.height.u!==V.PX&&a.height.u!==V.PERCENT&&a.height.u!==V.AUTO||(a.height.u===V.PX||a.height.u===V.AUTO?n.height=t.height+r:n.height=100*(t.height+r)/e.parent.height+"%");if(i){var s=Lm(e,t,-r);s.height&&("number"==typeof s.height?s.height=t.height+2*r:s.height=100*(t.height+2*r)/e.parent.height+"%"),Object.assign(n,s)}return n}function Um(e,t,r,i){void 0===i&&(i=!1);var a=e.style,n={};if(r>t.width){r-=t.width,r=Math.max(r,1),a.left.u===V.PX?n.left=t.left+t.width:a.left.u===V.PERCENT&&(n.left=100*(t.left+t.width)/e.parent.width+"%");var o=Object.assign({},t);o.width=0,Object.assign(n,zm(e,o,r)),n.scaleX=-1*t.scaleX}else r=Math.min(r,t.width-1),n.scaleX=t.scaleX,a.left.u===V.PX||a.left.u===V.PERCENT?(a.left.u===V.PX?n.left=t.left+r:n.left=100*(t.left+r)/e.parent.width+"%",a.width.u===V.PX||a.width.u===V.AUTO&&a.right.u===V.AUTO?n.width=t.width-r:a.width.u===V.PERCENT&&(n.width=100*(t.width-r)/e.parent.width+"%")):a.width.u!==V.PX&&a.width.u!==V.PERCENT&&a.width.u!==V.AUTO||(a.width.u===V.PX||a.width.u===V.AUTO?n.width=t.width-r:n.width=100*(t.width-r)/e.parent.width+"%");if(i){var s=zm(e,t,-r);s.width&&("number"==typeof s.width?s.width=t.width-2*r:s.width=100*(t.width-2*r)/e.parent.width+"%"),Object.assign(n,s)}return n}function zm(e,t,r,i){void 0===i&&(i=!1);var a=e.style,n={};if(r<-t.width){r+=t.width,r=Math.min(r,-1),a.right.u===V.PX?n.right=t.right+t.width:a.right.u===V.PERCENT&&(n.right=100*(t.right+t.width)/e.parent.width+"%");var o=Object.assign({},t);o.width=0,Object.assign(n,Um(e,o,r)),n.scaleX=-1*t.scaleX}else r=Math.max(r,1-t.width),n.scaleX=t.scaleX,a.right.u===V.PX||a.right.u===V.PERCENT?(a.right.u===V.PX?n.right=t.right-r:n.right=100*(t.right-r)/e.parent.width+"%",a.width.u===V.PX||a.width.u===V.AUTO&&a.left.u===V.AUTO?n.width=t.width+r:a.width.u===V.PERCENT&&(n.width=100*(t.width+r)/e.parent.width+"%")):a.width.u!==V.PX&&a.width.u!==V.PERCENT&&a.width.u!==V.AUTO||(a.width.u===V.PX||a.width.u===V.AUTO?n.width=t.width+r:n.width=100*(t.width+r)/e.parent.width+"%");if(i){var s=Um(e,t,-r);s.width&&("number"==typeof s.width?s.width=t.width+2*r:s.width=100*(t.width+2*r)/e.parent.width+"%"),Object.assign(n,s)}return n}function Wm(e,t,r){var i=r*(t.width/t.height),a=Um(e,t,.5*-i),n=zm(e,t,.5*i),o=Object.assign({},a,n);if(o.width)if("number"==typeof o.width){var s=o.width-t.width;o.width=t.width+2*s}else{var c=e.parent.width;s=parseFloat(o.width)*c*.01-t.width;o.width=100*(t.width+2*s)/c+"%"}return o}function Vm(e,t,r,i){void 0===i&&(i=!1);var a=Lm(e,t,r);if(i){var n=Nm(e,t,-r);n.height&&("number"==typeof n.height?n.height=t.height-2*r:n.height=100*(t.height-2*r)/e.parent.height+"%"),Object.assign(a,n)}var o=Wm(e,t,i?2*-r:-r);return Object.assign(a,o)}function Hm(e,t,r,i){void 0===i&&(i=!1);var a=Nm(e,t,r);if(i){var n=Lm(e,t,-r);n.height&&("number"==typeof n.height?n.height=t.height+2*r:n.height=100*(t.height+2*r)/e.parent.height+"%"),Object.assign(a,n)}var o=Wm(e,t,i?2*r:r);return Object.assign(a,o)}function Xm(e,t,r){var i=r/(t.width/t.height),a=Lm(e,t,.5*-i),n=Nm(e,t,.5*i),o=Object.assign({},a,n);if(o.height)if("number"==typeof o.height){var s=o.height-t.height;o.height=t.height+2*s}else{var c=e.parent.height;s=parseFloat(o.height)*c*.01-t.height;o.height=100*(t.height+2*s)/c+"%"}return o}function jm(e,t,r,i){void 0===i&&(i=!1);var a=Um(e,t,r);if(i){var n=zm(e,t,-r);n.width&&("number"==typeof n.width?n.width=t.width-2*r:n.width=100*(t.width-2*r)/e.parent.width+"%"),Object.assign(a,n)}var o=Xm(e,t,i?2*-r:-r);return Object.assign(a,o)}function Gm(e,t,r,i){void 0===i&&(i=!1);var a=zm(e,t,r);if(i){var n=Um(e,t,-r);n.width&&("number"==typeof n.width?n.width=t.width+2*r:n.width=100*(t.width+2*r)/e.parent.width+"%"),Object.assign(a,n)}var o=Xm(e,t,i?2*r:r);return Object.assign(a,o)}function Ym(e,t,r,i){void 0===i&&(i=!0);var a=e.width,n=e.height,o=n/a;i||(o*=-1);var s=-1/o,c=a+t,u=n+r,l=(u-n+o*a-s*c)/(o-s);return{x:l,y:s*l-s*c+u}}function qm(e,t,r,i){i&&(e.left?"number"==typeof e.left?e.left+=i:e.left=parseFloat(e.left)+i/t.parent.width*100+"%":e.width||(t.style.left.u===V.PERCENT?e.left=100*(r.left+i)/t.parent.width+"%":t.style.left.u===V.PX&&(e.left=r.left+i)),e.right?"number"==typeof e.right?e.right-=i:e.right=parseFloat(e.right)-i/t.parent.width*100+"%":e.width||(t.style.right.u===V.PERCENT?e.right=100*(r.right-i)/t.parent.width+"%":t.style.right.u===V.PX&&(e.right=r.right-i)))}function Km(e,t,r,i){i&&(e.top?"number"==typeof e.top?e.top+=i:e.top=parseFloat(e.top)+i/t.parent.height*100+"%":e.height||(t.style.top.u===V.PERCENT?e.top=100*(r.top+i)/t.parent.height+"%":t.style.top.u===V.PX&&(e.top=r.top+i)),e.bottom?"number"==typeof e.bottom?e.bottom-=i:e.bottom=parseFloat(e.bottom)-i/t.parent.height*100+"%":e.height||(t.style.bottom.u===V.PERCENT?e.bottom=100*(r.bottom-i)/t.parent.height+"%":t.style.bottom.u===V.PX&&(e.bottom=r.bottom-i)))}function $m(e,t,r){var i=e*r.h/r.w,a=r.y+.5*r.h;return(t.y+.5*t.h-a)*i/r.h}function Qm(e,t,r){var i=e*r.w/r.h,a=r.x+.5*r.w;return(t.x+.5*t.w-a)*i/r.w}function Zm(e,t,r,i,a,n,o){void 0===n&&(n=!1),void 0===o&&(o=!1);var s=n?Vm(e,t,r*i.h/a.h,o):Lm(e,t,r*i.h/a.h,o),c=Qm(r,i,a);o&&(c*=2),qm(s,e,t,-c);return Km(s,e,t,o?-r*(i.y+.5*i.h-a.y-.5*a.h)*2/a.h:r*(a.y+a.h-i.y-i.h)/a.h),s}function Jm(e,t,r,i,a,n,o){void 0===n&&(n=!1),void 0===o&&(o=!1);var s=n?Hm(e,t,r*i.h/a.h,o):Nm(e,t,r*i.h/a.h,o);if(n){var c=Qm(r,i,a);o&&(c*=2),qm(s,e,t,c)}return Km(s,e,t,o?r*(i.y+.5*i.h-a.y-.5*a.h)*2/a.h:r*(i.y-a.y)/a.h),s}function ep(e,t,r,i,a,n,o){void 0===n&&(n=!1),void 0===o&&(o=!1);var s=n?jm(e,t,r*i.w/a.w,o):Um(e,t,r*i.w/a.w,o);if(n){var c=$m(r,i,a);o&&(c*=2),Km(s,e,t,-c)}return qm(s,e,t,o?-r*(i.x+.5*i.w-a.x-.5*a.w)*2/a.w:r*(a.x+a.w-i.x-i.w)/a.w),s}function tp(e,t,r,i,a,n,o){void 0===n&&(n=!1),void 0===o&&(o=!1);var s=n?Gm(e,t,r*i.w/a.w,o):zm(e,t,r*i.w/a.w,o);if(n){var c=$m(r,i,a);o&&(c*=2),Km(s,e,t,c)}return qm(s,e,t,o?r*(i.x+.5*i.w-a.x-.5*a.w)*2/a.w:r*(i.x-a.x)/a.w),s}function rp(e,t,r,i,a,n){var o=Zm(e,t,r,i,a);delete n.top,delete n.height,delete n.bottom,void 0!==o.top&&(n.top=o.top),void 0!==o.height&&(n.height=o.height),void 0!==o.bottom&&(n.bottom=o.bottom)}function ip(e,t,r,i,a,n){var o=Jm(e,t,r,i,a);delete n.top,delete n.height,delete n.bottom,void 0!==o.top&&(n.top=o.top),void 0!==o.height&&(n.height=o.height),void 0!==o.bottom&&(n.bottom=o.bottom)}!function(e){e[e.T=0]="T",e[e.R=1]="R",e[e.B=2]="B",e[e.L=3]="L",e[e.TL=4]="TL",e[e.TR=5]="TR",e[e.BL=6]="BL",e[e.BR=7]="BR"}(Bm||(Bm={}));var ap=function(e){function r(t,r){var i=e.call(this,t)||this;return i.data=r,i}return t(r,e),r.prototype.execute=function(){var e=this.nodes,t=this.data;e.forEach(function(e,i){var a=t[i],n=a.dx,o=a.dy,s=a.controlType,c=a.aspectRatio,u=a.clientRect,l=a.selectRect,h=a.fromCenter,d=a.widthToAuto,f=a.heightToAuto,m=e.getStyle();e.startSizeChange();var p=e.getComputedStyle(),g=e.getCssStyle();u?r.operateMultiAr(e,p,g,n,o,s,u,l,c,h,d,f):r.operate(e,p,g,n,o,s,c,h,d,f),e.endSizeChange(m),e.checkPosSizeUpward()})},r.prototype.undo=function(){var e=this.nodes,t=this.data;e.forEach(function(e,i){var a=t[i],n=a.dx,o=a.dy,s=a.controlType,c=a.aspectRatio,u=a.clientRect,l=a.selectRect,h=a.fromCenter,d=a.widthFromAuto,f=a.heightFromAuto,m=e.getStyle();e.startSizeChange();var p=e.getComputedStyle(),g=e.getCssStyle();s=function(e){return e}(s),u?r.operateMultiAr(e,p,g,-n,-o,s,u,l,c,h,d,f):r.operate(e,p,g,-n,-o,s,c,h,d,f),e.endSizeChange(m),e.checkPosSizeUpward()})},r.operate=function(e,t,r,i,a,n,o,s,c,u){void 0===s&&(s=!1),void 0===c&&(c=!1),void 0===u&&(u=!1);var l={left:r.left,right:r.right,top:r.top,bottom:r.bottom,width:r.width,height:r.height,scaleX:r.scaleX,scaleY:r.scaleY};o?n===Bm.T?Object.assign(l,Vm(e,t,a,s)):n===Bm.R?Object.assign(l,Gm(e,t,i,s)):n===Bm.B?Object.assign(l,Hm(e,t,a,s)):n===Bm.L?Object.assign(l,jm(e,t,i,s)):n===Bm.TL?Object.assign(l,function(e,t,r,i,a){void 0===a&&(a=!1);var n=Ym(t,r,i,!0),o=n.x,s=n.y,c=Um(e,t,o-t.width,a);return Object.assign(c,Lm(e,t,s-t.height,a)),c}(e,t,i,a,s)):n===Bm.TR?Object.assign(l,function(e,t,r,i,a){void 0===a&&(a=!1);var n=Ym(t,r,i,!1),o=n.x,s=n.y,c=zm(e,t,o-t.width,a);return Object.assign(c,Lm(e,t,s-t.height,a)),c}(e,t,i,a,s)):n===Bm.BL?Object.assign(l,function(e,t,r,i,a){void 0===a&&(a=!1);var n=Ym(t,r,i,!1),o=n.x,s=n.y,c=Um(e,t,o-t.width,a);return Object.assign(c,Nm(e,t,s-t.height,a)),c}(e,t,i,a,s)):n===Bm.BR&&Object.assign(l,function(e,t,r,i,a){void 0===a&&(a=!1);var n=Ym(t,r,i,!0),o=n.x,s=n.y,c=zm(e,t,o-t.width,a);return Object.assign(c,Nm(e,t,s-t.height,a)),c}(e,t,i,a,s)):(n===Bm.T||n===Bm.TL||n===Bm.TR?Object.assign(l,Lm(e,t,a,s)):n!==Bm.B&&n!==Bm.BL&&n!==Bm.BR||Object.assign(l,Nm(e,t,a,s)),n===Bm.L||n===Bm.TL||n===Bm.BL?Object.assign(l,Um(e,t,i,s)):n!==Bm.R&&n!==Bm.TR&&n!==Bm.BR||Object.assign(l,zm(e,t,i,s))),c&&(l.width="auto"),u&&(l.height="auto"),e.updateStyle(l)},r.operateMultiAr=function(e,t,r,i,a,n,o,s,c,u,l,h){void 0===u&&(u=!1),void 0===l&&(l=!1),void 0===h&&(h=!1);var d={left:r.left,right:r.right,top:r.top,bottom:r.bottom,width:r.width,height:r.height,scaleX:r.scaleX,scaleY:r.scaleY};if(n===Bm.T)Object.assign(d,Zm(e,t,a,o,s,c,u));else if(n===Bm.R)Object.assign(d,tp(e,t,i,o,s,c,u));else if(n===Bm.B)Object.assign(d,Jm(e,t,a,o,s,c,u));else if(n===Bm.L)Object.assign(d,ep(e,t,i,o,s,c,u));else{if(c){var f={width:s.w,height:s.h},m=Ym(f,i,a,[Bm.TL,Bm.BR].includes(n)),p=m.x,g=m.y;i=p-f.width,a=g-f.height}n===Bm.TL?Object.assign(d,function(e,t,r,i,a,n,o,s){void 0===o&&(o=!1),void 0===s&&(s=!1);var c=ep(e,t,r,a,n,o,s);if(s)return c;if(o)rp(e,t,i,a,n,c);else{var u=Zm(e,t,i,a,n,o,s);Object.assign(c,u)}return c}(e,t,i,a,o,s,c,u)):n===Bm.TR?Object.assign(d,function(e,t,r,i,a,n,o,s){void 0===o&&(o=!1),void 0===s&&(s=!1);var c=tp(e,t,r,a,n,o,s);if(s)return c;if(o)rp(e,t,i,a,n,c);else{var u=Zm(e,t,i,a,n,o,s);Object.assign(c,u)}return c}(e,t,i,a,o,s,c,u)):n===Bm.BL?Object.assign(d,function(e,t,r,i,a,n,o,s){void 0===o&&(o=!1),void 0===s&&(s=!1);var c=ep(e,t,r,a,n,o,s);if(s)return c;if(o)ip(e,t,i,a,n,c);else{var u=Jm(e,t,i,a,n,o,s);Object.assign(c,u)}return c}(e,t,i,a,o,s,c,u)):n===Bm.BR&&Object.assign(d,function(e,t,r,i,a,n,o,s){void 0===o&&(o=!1),void 0===s&&(s=!1);var c=tp(e,t,r,a,n,o,s);if(s)return c;if(o)ip(e,t,i,a,n,c);else{var u=Jm(e,t,i,a,n,o,s);Object.assign(c,u)}return c}(e,t,i,a,o,s,c,u))}l&&(d.width="auto"),h&&(d.height="auto"),e.updateStyle(d)},r}(Pm);var np=function(e){function r(t,r){var i=e.call(this,t)||this;return i.data=r,i}return t(r,e),r.prototype.execute=function(){var e=this.nodes,t=this.data;e.forEach(function(e,r){e.updateStyle(t[r].next)})},r.prototype.undo=function(){var e=this.nodes,t=this.data;e.forEach(function(e,r){e.updateStyle(t[r].prev)})},r}(Pm),op=function(e){function r(t,r){return e.call(this,t,r)||this}return t(r,e),r}(np);function sp(e,t,r){for(var i=e.children,a=i.length-1;a>=0;a--){var n=i[a],o=n.matrixWorld;if(n.hasContent&&n.computedStyle.visibility!==te.HIDDEN&&n.computedStyle.pointerEvents){var s=n._rect||n.rect;if(gr(t,r,s[0],s[1],s[2],s[3],o,!0)){if(n instanceof Ba){var c;if(c=sp(n,t,r))return c}else{var u=n.prev;if(u&&cp(u,t,r))return u}return n}if(n instanceof Ba&&(c=sp(n,t,r)))return c}}}function cp(e,t,r){var i=e.computedStyle;if(i.maskMode!==$.NONE&&i.pointerEvents){var a=e._rect||e.rect,n=e.matrixWorld;return gr(t,r,a[0],a[1],a[2],a[3],n,!0)}return!1}function up(e,t,r,i){return sp(e,t,r)}var lp=function(e){function r(t,r){var i=e.call(this,t)||this;return i.data=r,i}return t(r,e),r.prototype.execute=function(){var e=this.nodes,t=this.data;e.forEach(function(e,r){e.beforeEdit(),e.cursor=t[r].next.cursor,e.content=t[r].next.content,e.rich=t[r].next.rich,e.afterEdit()})},r.prototype.undo=function(){var e=this.nodes,t=this.data;e.forEach(function(e,r){e.beforeEdit(),e.cursor=t[r].prev.cursor,e.content=t[r].prev.content,e.rich=t[r].prev.rich,e.afterEdit()})},r}(Pm),hp=function(){function e(e,t,r){var i=this;this.root=e,this.dom=t,this.listener=r,this.ignoreBlur=[],this.ignoreBlurUnFocus=[],this.hasBlur=!0;var a=this.containerEl=document.createElement("div");a.className="input",a.style.position="absolute",a.style.pointerEvents="none",a.style.opacity="0",t.appendChild(a);var n=this.inputEl=document.createElement("input");n.style.position="absolute",n.style.left="0px",n.style.top="0px",n.style.width="10px",n.style.height="100%",n.style.boxSizing="content-box",n.style.border="none",n.style.pointerEvents="none",n.style.opacity="0",n.type="text",n.autocomplete="off",n.spellcheck=!1,a.appendChild(n);var o=function(e){if(i.node){var t=i.node.content,a=i.node.getRich(),o=i.node.getCursor();e(),i.updateCursor(),i.showCursor(),n.value="",i.listener.select.updateSelect([i.node]),r.emit([Mm,_m],[i.node]),i.listener.history.addCommand(new lp([i.node],[{prev:{content:t,rich:a,cursor:o},next:{content:i.node.content,rich:i.node.getRich(),cursor:i.node.getCursor()}}]),i.hasBlur),i.hasBlur=!1}},s=function(e){e&&o(function(){var t;null===(t=i.node)||void 0===t||t.input(e)})},c=!1;n.addEventListener("keydown",function(e){var t=e.keyCode,a=e.code;if(i.node)if(13===t||"Enter"===a)o(function(){var e;null===(e=i.node)||void 0===e||e.enter()});else if(8===t||46===t||"Backspace"===a||"Delete"===a)e.stopPropagation(),c||o(function(){var e;null===(e=i.node)||void 0===e||e.delete(46===t||"Delete"===a)});else if((t>=37&&t<=40||["ArrowUp","ArrowRight","ArrowDown","ArrowLeft"].includes(a))&&(e.stopPropagation(),!c)){var n=i.node.moveCursor(t,e.shiftKey);e.shiftKey?i.hideCursor():(i.showCursor(),i.updateCursor(n)),r.emit(_m,[i.node])}}),n.addEventListener("input",function(e){if(!c){var t=e.data;t&&s(t)}}),n.addEventListener("paste",function(e){var t;e.stopPropagation(),null===(t=e.clipboardData)||void 0===t||t.getData("text")}),n.addEventListener("compositionstart",function(e){c=!0}),n.addEventListener("compositionend",function(e){c=!1;var t=e.data;t&&s(t)});var u=this.cursorEl=document.createElement("div");u.style.position="absolute",u.style.left="0px",u.style.top="0px",u.style.width="10px",u.style.height="100%",u.style.borderLeft="1px solid #000",u.style.pointerEvents="none",a.appendChild(u),u.animate([{visibility:"visible",borderColor:"#000"},{visibility:"visible",borderColor:"#FFF"},{visibility:"hidden"},{visibility:"hidden"}],{duration:800,iterations:1/0}),this.onClick=function(e){if(r.state===Am.EDIT_TEXT){for(var t=e.target,a=t;a;){if(i.ignoreBlurUnFocus.includes(a))return;if(a===r.dom||i.ignoreBlur.includes(a))return void(["INPUT","SELECT","TEXTAREA"].includes(t.tagName.toUpperCase())||i.focus());a=a.parentElement}var n=i.node;r.cancelEditText(),n.resetCursor(),n.afterEdit(),n.inputStyle=void 0}},document.addEventListener("click",this.onClick)}return e.prototype.show=function(e,t,r){this.node=e,this.update(t,r),this.focus(),this.showCursor()},e.prototype.update=function(e,t){var r=this.node.setCursorStartByAbsCoords(e,t);this.updateCursor(r)},e.prototype.hide=function(){if(this.hideCursor(),this.blur(),this.node){if(!this.node.content.length){var e=this.listener.history.commands[0];e&&e instanceof lp&&e.nodes[0]===this.node&&e.undo(),this.listener.removeNode()}this.node=void 0}},e.prototype.focus=function(){this.inputEl.focus()},e.prototype.blur=function(){this.inputEl.blur(),this.hasBlur=!0},e.prototype.showCursor=function(){this.containerEl.style.opacity="1"},e.prototype.hideCursor=function(){this.containerEl.style.opacity="0"},e.prototype.updateCursor=function(e){if(e=e||this.node.getCursorAbsCoords()){var t=this.node.root.canvas;this.containerEl.style.left=e.x*t.clientWidth/t.width+"px",this.containerEl.style.top=e.y*t.clientWidth/t.width+"px",this.containerEl.style.height=e.h*t.clientWidth/t.width+"px"}},e.prototype.release=function(){this.containerEl.remove(),document.removeEventListener("click",this.onClick)},e}(),dp="undefined"!=typeof navigator&&/win/i.test(navigator.platform),fp=function(e){function r(t,r,i){var a=e.call(this)||this;return a.root=t,a.dom=r,a.options=i,a.state=wm.NORMAL,a.isMouseDown=!1,a.isMouseMove=!1,a.originX=0,a.originY=0,a.startX=0,a.startY=0,a.centerX=0,a.centerY=0,a.metaKey=!1,a.shiftKey=!1,a.ctrlKey=!1,a.altKey=!1,a.eventListenerList=[{type:"mousedown",cb:a.onMouseDown.bind(a)},{type:"mousemove",cb:a.onMouseMove.bind(a)},{type:"mouseup",cb:a.onMouseUp.bind(a)},{type:"dblclick",cb:a.onDblClick.bind(a)},{type:"keydown",cb:a.onKeyDown.bind(a)},{type:"keyup",cb:a.onKeyUp.bind(a)}],a.eventListenerList.forEach(function(e){"keydown"===e.type||"keyup"===e.type?document.addEventListener(e.type,e.cb):r.addEventListener(e.type,e.cb)}),a.history=new Dm,a.selected=[],a.select=new Em(t,r),a.computedStyle=[],a.originStyle=[],a.cssStyle=[],a.input=new hp(t,r,a),a.dx=0,a.dy=0,a.isControl=!1,a.isRotate=!1,a.controlType=Bm.T,a}return t(r,e),r.prototype.updateOrigin=function(){var e=this.dom.getBoundingClientRect();this.originX=e.left,this.originY=e.top},r.prototype.prepare=function(){var e=this.selected;this.computedStyle=e.map(function(e){return e.getComputedStyle()}),this.originStyle=e.map(function(e){return e.getStyle()})},r.prototype.getNode=function(e,t){return this.metaKey||dp&&this.ctrlKey,up(this.root,e,t)},r.prototype.onMouseDown=function(e){var t,r;if(0===e.button){var i=this.selected;this.isMouseDown=!0,this.updateOrigin(),this.startX=e.clientX-this.originX,this.startY=e.clientY-this.originY;var a=this.root.canvas,n=this.startX*a.width/a.clientWidth,o=this.startY*a.height/a.clientHeight,s=e.target;if(this.isControl=this.select.isSelectControlDom(s)){this.state===wm.EDIT_TEXT&&this.cancelEditText();var c=this.controlType={t:Bm.T,r:Bm.R,b:Bm.B,l:Bm.L,tl:Bm.TL,tr:Bm.TR,bl:Bm.BL,br:Bm.BR}[s.className];this.prepare();var u=this.metaKey||dp&&this.ctrlKey;if(!(null===(r=null===(t=this.options)||void 0===t?void 0:t.disabled)||void 0===r?void 0:r.rotate)&&1===i.length&&u&&[Bm.TL,Bm.TR,Bm.BL,Bm.BR].indexOf(c)>-1){var l=i[0].getBoundingClientRect().points,h=cr(l[0].x,l[0].y,l[2].x,l[2].y,l[1].x,l[1].y,l[3].x,l[3].y);this.centerX=h.x*a.clientWidth/a.width,this.centerY=h.y*a.clientHeight/a.height,this.isRotate=!0}else this.beforeResize()}else{var d=this.getNode(n,o),f=i.slice(0);if(d){if((h=i.indexOf(d))>-1){if(this.state===wm.EDIT_TEXT){var m=d;if(this.shiftKey)m.setCursorEndByAbsCoords(n,o),m.inputStyle=void 0,this.input.hideCursor();else{var p=m.cursor,g=p.isMulti,v=p.startLineBox,y=p.startTextBox,b=p.startString;m.resetCursor();var x=m.setCursorStartByAbsCoords(n,o);if(this.input.updateCursor(x),this.input.showCursor(),m.cursor.isMulti===g&&m.cursor.startLineBox===v&&m.cursor.startTextBox===y&&m.cursor.startString===b)return}return void this.emit(_m,[m])}}else{if(this.state===wm.EDIT_TEXT)return void this.cancelEditText(f[0]);if(this.shiftKey)for(var T=i.length-1;T>=0;T--){var w=i[T];if(d.isParent(w))i.splice(T,1);else if(d.isChild(w))return}else i.splice(0);i.push(d)}}else{if(this.state===wm.EDIT_TEXT)return void this.cancelEditText(f[0]);i.splice(0)}this.updateActive(!0)}}},r.prototype.onMouseMove=function(e){var t=this,r=this.root.canvas,i=e.clientX-this.originX-this.startX,a=e.clientY-this.originY-this.startY,n=this.dx=i*r.width/r.clientWidth,o=this.dy=a*r.height/r.clientHeight,s=this.selected;if(this.isControl){if(Math.abs(i)<=1&&Math.abs(a)<=1&&!this.isMouseMove)return;if(this.isRotate){var c=this.centerX,u=this.centerY,l=this.startX,h=this.startY,d=e.clientX-this.originX,f=e.clientY-this.originY,m=mr(yr(Math.sqrt(Math.pow(l-d,2)+Math.pow(h-f,2)),Math.sqrt(Math.pow(c-d,2)+Math.pow(u-f,2)),Math.sqrt(Math.pow(l-c,2)+Math.pow(h-u,2)))),p=qe(l-c,h-u,d-c,f-u);if(this.shiftKey)for(var g=0;g<=180;g+=15)if(Math.abs(m-g)<=7.5){m=g;break}var v=s[0],y=(this.computedStyle[0].rotateZ+m*(p>=0?1:-1))%360;v.updateStyle({rotateZ:y}),this.select.updateSelect(s),this.emit(Rm.ROTATE,s.slice(0))}else{var b=this.shiftKey,x=this.altKey,T=this.controlType;s.forEach(function(e,r){t.isMouseMove||(e.startSizeChange(),t.computedStyle[r]=e.getComputedStyle(),t.cssStyle[r]=e.getCssStyle());var i=t.computedStyle[r],a=t.cssStyle[r];t.selectRect&&t.clientRect&&t.clientRect[r]?ap.operateMultiAr(e,i,a,n,o,T,t.clientRect[r],t.selectRect,b,x):ap.operate(e,i,a,n,o,T,b,x)}),this.select.updateSelect(s),this.emit(Rm.RESIZE,s.slice(0))}this.isMouseMove=!0}else if(this.isMouseDown){if(Math.abs(i)<=1&&Math.abs(a)<=1&&!this.isMouseMove)return;if(this.isMouseMove=!0,this.state===wm.EDIT_TEXT){var w=(e.clientX-this.originX)*r.width/r.clientWidth,k=(e.clientY-this.originY)*r.height/r.clientHeight,S=s[0],E=S.cursor,C=E.isMulti,A=E.start,_=E.end;S.setCursorEndByAbsCoords(w,k),this.input.hideCursor();var M=S.cursor;C===M.isMulti&&A===M.start&&_===M.end||this.emit(_m,s.slice(0))}else this.select.select.classList.add("move"),this.shiftKey&&(Math.abs(n)>=Math.abs(o)?this.dy=a=o=0:this.dx=i=n=0),s.forEach(function(e,r){var i=t.computedStyle[r];Om.operate(e,i,n,o)}),this.select.updateSelect(s),this.emit(Rm.MOVE,s.slice(0))}},r.prototype.onMouseUp=function(){var e=this,t=this.selected,r=this.dx,i=this.dy;if(this.isControl){if(this.isRotate){var a=t[0];(r||i)&&this.history.addCommand(new op([a],[{prev:{rotateZ:this.computedStyle[0].rotateZ},next:{rotateZ:a.computedStyle.rotateZ}}]),!0)}else if(this.isMouseMove){var n=this.shiftKey,o=this.altKey,s=this.controlType,c=[];t.forEach(function(t,a){if(t.endSizeChange(e.originStyle[a]),r||i){var u={dx:r,dy:i,controlType:s,aspectRatio:n,clientRect:e.clientRect&&e.clientRect[a],selectRect:e.selectRect,fromCenter:o},l=e.originStyle[a];l.width.u===V.AUTO&&(u.widthFromAuto=!0),l.height.u===V.AUTO&&(u.heightFromAuto=!0),c.push(u)}}),c.length&&this.history.addCommand(new ap(t.slice(0),c))}}else if(this.isMouseMove)if(this.state===wm.EDIT_TEXT){t[0].checkCursorMulti()?this.input.hideCursor():(this.input.updateCursor(),this.input.showCursor()),this.input.focus()}else{this.select.select.classList.remove("move");var u=this.dx,l=this.dy,h=[];t.forEach(function(t,r){(u||l)&&(t.endPosChange(e.originStyle[r],u,l),h.push({dx:u,dy:l}))}),h.length&&this.history.addCommand(new Om(t.slice(0),h),!0)}this.isControl=!1,this.isRotate=!1,this.isMouseDown=!1,this.isMouseMove=!1},r.prototype.onDblClick=function(e){if(0===e.button){var t=this.root.canvas,r=this.startX*t.width/t.clientWidth,i=this.startY*t.height/t.clientHeight,a=this.getNode(r,i);if(1!==this.selected.length||a!==this.selected[0])this.selected.splice(0),a&&this.selected.push(a),this.updateActive(!0);else if(a instanceof om){this.input.show(a,r,i),a.beforeEdit();var n=this.state;this.state=wm.EDIT_TEXT,this.select.select.classList.add("text"),this.emit(Im,n,this.state)}}},r.prototype.onKeyDown=function(e){var t,r,i,a;this.metaKey=e.metaKey,this.altKey=e.altKey,this.ctrlKey=e.ctrlKey,this.shiftKey=e.shiftKey;var n=this.metaKey||dp&&this.ctrlKey;!(null===(a=null===(i=this.options)||void 0===i?void 0:i.disabled)||void 0===a?void 0:a.rotate)&&n&&1===this.selected.length&&this.select.metaKey(!0);var o=e.keyCode,s=e.code,c=e.target,u=["INPUT","TEXTAREA","SELECT"].includes(c.tagName.toUpperCase());if(8===o||46===o||"Backspace"===s||"Delete"===s){if(u)return;this.removeNode()}else if(27===o||"Escape"===s)this.state===wm.EDIT_TEXT?this.cancelEditText():(this.selected.splice(0),this.select.hideSelect(),this.emit(Rm.SELECT,[]));else if(o>=37&&o<=40||["ArrowUp","ArrowRight","ArrowDown","ArrowLeft"].includes(s)){if(u)return;e.preventDefault();var l=0,h=0;37===o?l=this.shiftKey?-10:this.altKey?-.1:-1:38===o?h=this.shiftKey?-10:this.altKey?-.1:-1:39===o?l=this.shiftKey?10:this.altKey?.1:1:40===o&&(h=this.shiftKey?10:this.altKey?.1:1);var d=this.selected.slice(0),f=[];d.forEach(function(e){var t=e.getStyle();Om.operate(e,e.computedStyle,l,h),e.endPosChange(t,l,h),f.push({dx:l,dy:h})}),d.length&&(this.select.updateSelect(d),this.emit(Rm.MOVE,d.slice(0)),this.history.addCommand(new Om(d,f)))}else if(65!==o&&"KeyA"!==s||!n){if((90===o||"KeyZ"===s)&&n){if(u&&c!==this.input.inputEl)return;e.preventDefault();var m=void 0;if(m=this.shiftKey?this.history.redo():this.history.undo()){d=m.nodes.slice(0);var p=this.selected.slice(0),g=!1;if(m instanceof Fm||(this.selected.splice(0),(t=this.selected).push.apply(t,d),this.updateActive(),g=!0),m instanceof Om)this.emit(Rm.MOVE,d.slice(0));else if(m instanceof ap)this.emit(Rm.RESIZE,d.slice(0));else if(m instanceof Fm)this.shiftKey?(this.selected.splice(0),this.select.hideSelect(),this.emit(Rm.REMOVE,d.slice(0)),this.emit(Rm.SELECT,[])):(this.selected.splice(0),(r=this.selected).push.apply(r,d),this.updateActive(),this.emit(Rm.ADD,d.slice(0)),this.emit(Rm.SELECT,d.slice(0)));else if(m instanceof op)this.emit(Rm.ROTATE,d.slice(0));else if(m instanceof lp){if(this.state===wm.EDIT_TEXT){var v=d[0],y=v.getSortedCursor(),b=y.isMulti,x=y.start;if(b)this.input.hideCursor();else{var T=v.updateCursorByIndex(x);this.input.updateCursor(T),this.input.showCursor()}this.input.focus()}this.emit(Mm,d.slice(0))}if(g)if(d.length!==p.length)this.emit(Rm.SELECT,d.slice(0));else for(var w=0,k=d.length;w<k;w++)if(d[w]!==p[w]){this.emit(Rm.SELECT,d.slice(0));break}}}}else this.state===wm.EDIT_TEXT&&c===this.input.inputEl&&(e.preventDefault(),this.input.node.selectAll(),this.input.hideCursor())},r.prototype.onKeyUp=function(e){var t,r;this.metaKey=e.metaKey,this.altKey=e.altKey,this.ctrlKey=e.ctrlKey,this.shiftKey=e.shiftKey;var i=this.metaKey||dp&&this.ctrlKey;(null===(r=null===(t=this.options)||void 0===t?void 0:t.disabled)||void 0===r?void 0:r.rotate)||i||this.isRotate||this.select.metaKey(!1)},r.prototype.removeNode=function(e){if(void 0===e&&(e=this.selected),e.length){var t=e.splice(0).filter(function(e){return!e.isLocked}),r=[];e.forEach(function(e,t){var i=Fm.operate(e);r.push(i)}),this.select.hideSelect(),this.history.addCommand(new Fm(t,r)),this.emit(Rm.REMOVE,t.slice(0)),this.emit(Rm.SELECT,[])}},r.prototype.active=function(e){var t=this.selected,r=!1;if(e.length!==t.length)r=!0;else for(var i=0,a=e.length;i<a;i++)if(e[i]!==t[i]){r=!0;break}r&&(t.splice(0),t.push.apply(t,e),this.updateActive(!0))},r.prototype.updateActive=function(e){void 0===e&&(e=!1),this.prepare();var t=this.selected;t.length?this.select.showSelect(t):this.select.hideSelect(),e&&this.emit(Rm.SELECT,t.slice(0))},r.prototype.beforeResize=function(){this.selected.length>1&&this.shiftKey?(this.selectRect=this.select.getAspectRatio(),this.clientRect=this.selected.map(function(e){var t=e.getBoundingClientRect();return{x:t.left,y:t.top,w:t.width,h:t.height}})):(this.selectRect=void 0,this.clientRect=void 0)},r.prototype.cancelEditText=function(e){if(this.state===wm.EDIT_TEXT){var t=e||this.selected[0];t&&(t.resetCursor(),t.afterEdit(),t.inputStyle=void 0),this.input.hide(),this.state=wm.NORMAL,this.select.select.classList.remove("text"),this.emit(Im,wm.EDIT_TEXT,this.state)}},r.prototype.release=function(){var e=this;this.eventListenerList.splice(0).forEach(function(t){"keydown"===t.type||"keyup"===t.type?document.removeEventListener(t.type,t.cb):e.dom.removeEventListener(t.type,t.cb)}),this.select.release(),this.input.release()},r}(M);return{parser:Da,node:ym,util:km,config:L,style:Sm,interaction:{Listener:fp,interactionEvent:Rm,state:Am,Select:Em,Input:hp},animation:{frame:wf,AbstractAnimation:fa,CssAnimation:ma,GifAnimation:Ca,TimeAnimation:Ha,AniController:Ef,animationEvent:da},math:Ur,history:{History:Dm,AbstractCommand:Pm,MoveCommand:Om,RemoveCommand:Fm,ResizeCommand:ap,RotateCommand:op,TextCommand:lp},refresh:{CanvasCache:Ti,TextureCache:Ji,merge:yf},format:P}});
|
|
274
274
|
//# sourceMappingURL=index.min.js.map
|