leafer-draw 1.9.8 → 1.9.10

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/web.min.js CHANGED
@@ -1,2 +1,2 @@
1
- var LeaferUI=function(t){"use strict";const e={toURL(t,e){let s=encodeURIComponent(t);return"text"===e?s="data:text/plain;charset=utf-8,"+s:"svg"===e&&(s="data:image/svg+xml,"+s),s},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",getRealURL(t){const{prefix:s,suffix:i}=e.image;return!i||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+i),s&&"/"===t[0]&&(t=s+t),t}}},s={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=i;return e[t]?e[t]++:(e[t]=1,0)}},i=s;var r;t.Answer=void 0,(r=t.Answer||(t.Answer={}))[r.No=0]="No",r[r.Yes=1]="Yes",r[r.NoAndSkip=2]="NoAndSkip",r[r.YesAndSkip=3]="YesAndSkip";function n(t){return void 0===t}function o(t){return null==t}function a(t){return"string"==typeof t}const{isFinite:h}=Number;function l(t){return"number"==typeof t}const d=/^-?\d+(?:\.\d+)?$/;const{isArray:c}=Array;function u(t){return t&&"object"==typeof t}function _(t){return"{}"===JSON.stringify(t)}const p={default:(t,e)=>(g(e,t),g(t,e),t),assign(t,e,s){let i;Object.keys(e).forEach(r=>{var n,o;if(i=e[r],(null==i?void 0:i.constructor)===Object&&(null===(n=t[r])||void 0===n?void 0:n.constructor)===Object)return g(t[r],e[r],s&&s[r]);s&&r in s?(null===(o=s[r])||void 0===o?void 0:o.constructor)===Object&&g(t[r]={},e[r],s[r]):t[r]=e[r]})},copyAttrs:(t,e,s)=>(s.forEach(s=>{n(e[s])||(t[s]=e[s])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let s=0,i=t.length;s<i;s++)e[t[s]]=!0;return e},stintSet(t,e,s){s||(s=void 0),t[e]!==s&&(t[e]=s)}},{assign:g}=p;class f{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __usePathBox(){return this.__pathInputed}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(!n(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let s;for(let i in this)"_"!==i[0]&&(s=e?e[i]:void 0,t[i]=n(s)?this[i]:s);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(!n(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!n(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const s={};if(t)if(c(t))for(let e of t)s[e]=this.__getInput(e);else for(let e in t)s[e]=this.__getInput(e);else{let t,e,{__input:i}=this;s.tag=this.__leaf.tag;for(let r in this)if("_"!==r[0]&&(t=this["_"+r],!n(t))){if("path"===r&&!this.__pathInputed)continue;e=i?i[r]:void 0,s[r]=n(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:i,d:r,e:n,f:o}=this.__leaf.__localMatrix;s.matrix={a:t,b:e,c:i,d:r,e:n,f:o}}return s}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&(e.isBranch||t.__hasMultiPaint)||e.__hasEraser||t.eraser||t.filter?t.__single=!0:t.__single&&(t.__single=!1)}else t.__single=!0}__removeNaturalSize(){this.__naturalWidth=this.__naturalHeight=void 0}destroy(){this.__input=this.__middle=null}}let y,m,x;const{max:w}=Math,v=[0,0,0,0],b={zero:[...v],tempFour:v,set:(t,e,s,i,r)=>(void 0===s&&(s=i=r=e),t[0]=e,t[1]=s,t[2]=i,t[3]=r,t),setTemp:(t,e,s,i)=>B(v,t,e,s,i),toTempAB(t,e,s){x=s?l(t)?e:t:[],l(t)?(y=S(t),m=e):l(e)?(y=t,m=S(e)):(y=t,m=e),4!==y.length&&(y=k(y)),4!==m.length&&(m=k(m))},get(t,e){let s;if(!l(t))switch(t.length){case 4:s=n(e)?t:[...t];break;case 2:s=[t[0],t[1],t[0],t[1]];break;case 3:s=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(s||(s=[t,t,t,t]),!n(e))for(let t=0;t<4;t++)s[t]>e&&(s[t]=e);return s},max:(t,e,s)=>l(t)&&l(e)?w(t,e):(R(t,e,s),B(x,w(y[0],m[0]),w(y[1],m[1]),w(y[2],m[2]),w(y[3],m[3]))),add:(t,e,s)=>l(t)&&l(e)?t+e:(R(t,e,s),B(x,y[0]+m[0],y[1]+m[1],y[2]+m[2],y[3]+m[3])),swapAndScale(t,e,s,i){if(l(t))return e===s?t*e:[t*s,t*e];const r=i?t:[],[n,o,a,h]=4===t.length?t:k(t);return B(r,a*s,h*e,n*s,o*e)}},{set:B,get:k,setTemp:S,toTempAB:R}=b,{round:C,pow:T,PI:P}=Math,L={within:(t,e,s)=>(u(e)&&(s=e.max,e=e.min),!n(e)&&t<e&&(t=e),!n(s)&&t>s&&(t=s),t),fourNumber:b.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),L.float(t)),getGapRotation(t,e,s=0){let i=t+s;if(e>1){const t=Math.abs(i%e);(t<1||t>e-1)&&(i=Math.round(i/e)*e)}return i-s},float(t,e){const s=n(e)?1e12:T(10,e);return-0===(t=C(t*s)/s)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,s,i){if(i||(i={}),e){const t=(l(e)?e:e.width||0)/s.width,r=(l(e)?e:e.height||0)/s.height;i.scaleX=t||r||1,i.scaleY=r||t||1}else t&&L.assignScale(i,t);return i},assignScale(t,e){l(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},randInt:I,randColor:t=>`rgba(${I(255)},${I(255)},${I(255)},${t||1})`};function I(t){return Math.round(Math.random()*t)}const E=P/180,O=2*P,A=P/2;function M(){return{x:0,y:0}}function W(){return{x:0,y:0,width:0,height:0}}function D(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:F,cos:z,acos:U,sqrt:N}=Math,{float:Y}=L,X={};function H(){return Object.assign(Object.assign(Object.assign({},{a:1,b:0,c:0,d:1,e:0,f:0}),{x:0,y:0,width:0,height:0}),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0})}const V={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:H(),tempMatrix:{},set(t,e=1,s=0,i=0,r=1,n=0,o=0){t.a=e,t.b=s,t.c=i,t.d=r,t.e=n,t.f=o},get:D,getWorld:H,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,s){t.e+=e,t.f+=s},translateInner(t,e,s,i){t.e+=t.a*e+t.c*s,t.f+=t.b*e+t.d*s,i&&(t.e-=e,t.f-=s)},scale(t,e,s=e){t.a*=e,t.b*=e,t.c*=s,t.d*=s},pixelScale(t,e,s){s||(s=t),s.a=t.a*e,s.b=t.b*e,s.c=t.c*e,s.d=t.d*e,s.e=t.e*e,s.f=t.f*e},scaleOfOuter(t,e,s,i){j.toInnerPoint(t,e,X),j.scaleOfInner(t,X,s,i)},scaleOfInner(t,e,s,i=s){j.translateInner(t,e.x,e.y),j.scale(t,s,i),j.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:s,b:i,c:r,d:n}=t,o=z(e*=E),a=F(e);t.a=s*o-i*a,t.b=s*a+i*o,t.c=r*o-n*a,t.d=r*a+n*o},rotateOfOuter(t,e,s){j.toInnerPoint(t,e,X),j.rotateOfInner(t,X,s)},rotateOfInner(t,e,s){j.translateInner(t,e.x,e.y),j.rotate(t,s),j.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:i,b:r,c:n,d:o}=t;s&&(s*=E,t.a=i+n*s,t.b=r+o*s),e&&(e*=E,t.c=n+i*e,t.d=o+r*e)},skewOfOuter(t,e,s,i){j.toInnerPoint(t,e,X),j.skewOfInner(t,X,s,i)},skewOfInner(t,e,s,i=0){j.translateInner(t,e.x,e.y),j.skew(t,s,i),j.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:s,b:i,c:r,d:n,e:o,f:a}=t;t.a=e.a*s+e.b*r,t.b=e.a*i+e.b*n,t.c=e.c*s+e.d*r,t.d=e.c*i+e.d*n,t.e=e.e*s+e.f*r+o,t.f=e.e*i+e.f*n+a},multiplyParent(t,e,s,i,r){const{e:o,f:a}=t;if(s||(s=t),n(i)&&(i=1!==t.a||t.b||t.c||1!==t.d),i){const{a:i,b:n,c:o,d:a}=t;s.a=i*e.a+n*e.c,s.b=i*e.b+n*e.d,s.c=o*e.a+a*e.c,s.d=o*e.b+a*e.d,r&&(s.scaleX=e.scaleX*r.scaleX,s.scaleY=e.scaleY*r.scaleY)}else s.a=e.a,s.b=e.b,s.c=e.c,s.d=e.d,r&&(s.scaleX=e.scaleX,s.scaleY=e.scaleY);s.e=o*e.a+a*e.c+e.e,s.f=o*e.b+a*e.d+e.f},divide(t,e){j.multiply(t,j.tempInvert(e))},divideParent(t,e){j.multiplyParent(t,j.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=j;return j.copy(e,t),j.invert(e),e},invert(t){const{a:e,b:s,c:i,d:r,e:n,f:o}=t;if(s||i){const a=1/(e*r-s*i);t.a=r*a,t.b=-s*a,t.c=-i*a,t.d=e*a,t.e=-(n*r-o*i)*a,t.f=-(o*e-n*s)*a}else if(1===e&&1===r)t.e=-n,t.f=-o;else{const s=1/(e*r);t.a=r*s,t.d=e*s,t.e=-n*r*s,t.f=-o*e*s}},toOuterPoint(t,e,s,i){const{x:r,y:n}=e;s||(s=e),s.x=r*t.a+n*t.c,s.y=r*t.b+n*t.d,i||(s.x+=t.e,s.y+=t.f)},toInnerPoint(t,e,s,i){const{a:r,b:n,c:o,d:a}=t,h=1/(r*a-n*o),{x:l,y:d}=e;if(s||(s=e),s.x=(l*a-d*o)*h,s.y=(d*r-l*n)*h,!i){const{e:e,f:i}=t;s.x-=(e*a-i*o)*h,s.y-=(i*r-e*n)*h}},setLayout(t,e,s,i,r){const{x:o,y:a,scaleX:h,scaleY:l}=e;if(n(r)&&(r=e.rotation||e.skewX||e.skewY),r){const{rotation:s,skewX:i,skewY:r}=e,n=s*E,o=z(n),a=F(n);if(i||r){const e=i*E,s=r*E;t.a=(o+s*-a)*h,t.b=(a+s*o)*h,t.c=(e*o-a)*l,t.d=(o+e*a)*l}else t.a=o*h,t.b=a*h,t.c=-a*l,t.d=o*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=o,t.f=a,(s=s||i)&&j.translateInner(t,-s.x,-s.y,!i)},getLayout(t,e,s,i){const{a:r,b:n,c:o,d:a,e:h,f:l}=t;let d,c,u,_,p,g=h,f=l;if(n||o){const t=r*a-n*o;if(o&&!i){d=N(r*r+n*n),c=t/d;const e=r/d;u=n>0?U(e):-U(e)}else{c=N(o*o+a*a),d=t/c;const e=o/c;u=A-(a>0?U(-e):-U(e))}const e=Y(z(u)),s=F(u);d=Y(d),c=Y(c),_=e?Y((o/c+s)/e/E,9):0,p=e?Y((n/d-s)/e/E,9):0,u=Y(u/E)}else d=r,c=a,u=_=p=0;return(e=s||e)&&(g+=e.x*r+e.y*o,f+=e.x*n+e.y*a,s||(g-=e.x,f-=e.y)),{x:g,y:f,scaleX:d,scaleY:c,rotation:u,skewX:_,skewY:p}},withScale(t,e,s=e){const i=t;if(!e||!s){const{a:i,b:r,c:n,d:o}=t;r||n?s=(i*o-r*n)/(e=N(i*i+r*r)):(e=i,s=o)}return i.scaleX=e,i.scaleY=s,i},reset(t){j.set(t)}},j=V,{toInnerPoint:G,toOuterPoint:q}=V,{sin:Q,cos:J,abs:$,sqrt:Z,atan2:K,min:tt,round:et}=Math,st={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,s=0){t.x=e,t.y=s},setRadius(t,e,s){t.radiusX=e,t.radiusY=n(s)?e:s},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,s){t.x=e,t.y=s},round(t,e){t.x=e?et(t.x-.5)+.5:et(t.x),t.y=e?et(t.y-.5)+.5:et(t.y)},move(t,e,s){u(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=s)},scale(t,e,s=e){t.x&&(t.x*=e),t.y&&(t.y*=s)},scaleOf(t,e,s,i=s){t.x+=(t.x-e.x)*(s-1),t.y+=(t.y-e.y)*(i-1)},rotate(t,e,s){s||(s=it.defaultPoint);const i=J(e*=E),r=Q(e),n=t.x-s.x,o=t.y-s.y;t.x=s.x+n*i-o*r,t.y=s.y+n*r+o*i},tempToInnerOf(t,e){const{tempPoint:s}=it;return nt(s,t),G(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=it;return nt(s,t),q(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=it;return nt(s,t),it.toInnerRadiusPointOf(t,e,s),s},toInnerRadiusPointOf(t,e,s){s||(s=t),G(e,t,s),s.radiusX=Math.abs(t.radiusX/e.scaleX),s.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,s){G(e,t,s)},toOuterOf(t,e,s){q(e,t,s)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getCenterX:(t,e)=>t+(e-t)/2,getCenterY:(t,e)=>t+(e-t)/2,getDistance:(t,e)=>rt(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,s,i){const r=$(s-t),n=$(i-e);return Z(r*r+n*n)},getMinDistanceFrom:(t,e,s,i,r,n)=>tt(rt(t,e,s,i),rt(s,i,r,n)),getAngle:(t,e)=>ot(t,e)/E,getRotation:(t,e,s,i)=>(i||(i=e),it.getRadianFrom(t.x,t.y,e.x,e.y,s.x,s.y,i.x,i.y)/E),getRadianFrom(t,e,s,i,r,o,a,h){n(a)&&(a=s,h=i);const l=t-s,d=e-i,c=r-a,u=o-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>K(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s,i){const r=ot(t,e);return(e=i?e:{}).x=t.x+J(r)*s,e.y=t.y+Q(r)*s,e},toNumberPoints(t){let e=t;return u(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},reset(t){it.reset(t)}},it=st,{getDistanceFrom:rt,copy:nt,getAtan2:ot}=it;class at{constructor(t,e){this.set(t,e)}set(t,e){return u(t)?st.copy(this,t):st.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new at(this)}move(t,e){return st.move(this,t,e),this}scale(t,e){return st.scale(this,t,e),this}scaleOf(t,e,s){return st.scaleOf(this,t,e,s),this}rotate(t,e){return st.rotate(this,t,e),this}rotateOf(t,e){return st.rotate(this,e,t),this}getRotation(t,e,s){return st.getRotation(this,t,e,s)}toInnerOf(t,e){return st.toInnerOf(this,t,e),this}toOuterOf(t,e){return st.toOuterOf(this,t,e),this}getCenter(t){return new at(st.getCenter(this,t))}getDistance(t){return st.getDistance(this,t)}getDistancePoint(t,e,s){return new at(st.getDistancePoint(this,t,e,s))}getAngle(t){return st.getAngle(this,t)}getAtan2(t){return st.getAtan2(this,t)}reset(){return st.reset(this),this}}const ht=new at;class lt{constructor(t,e,s,i,r,n){this.set(t,e,s,i,r,n)}set(t,e,s,i,r,n){return u(t)?V.copy(this,t):V.set(this,t,e,s,i,r,n),this}setWith(t){return V.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:s,d:i,e:r,f:n}=this;return{a:t,b:e,c:s,d:i,e:r,f:n}}clone(){return new lt(this)}translate(t,e){return V.translate(this,t,e),this}translateInner(t,e){return V.translateInner(this,t,e),this}scale(t,e){return V.scale(this,t,e),this}scaleWith(t,e){return V.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return V.pixelScale(this,t),this}scaleOfOuter(t,e,s){return V.scaleOfOuter(this,t,e,s),this}scaleOfInner(t,e,s){return V.scaleOfInner(this,t,e,s),this}rotate(t){return V.rotate(this,t),this}rotateOfOuter(t,e){return V.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return V.rotateOfInner(this,t,e),this}skew(t,e){return V.skew(this,t,e),this}skewOfOuter(t,e,s){return V.skewOfOuter(this,t,e,s),this}skewOfInner(t,e,s){return V.skewOfInner(this,t,e,s),this}multiply(t){return V.multiply(this,t),this}multiplyParent(t){return V.multiplyParent(this,t),this}divide(t){return V.divide(this,t),this}divideParent(t){return V.divideParent(this,t),this}invert(){return V.invert(this),this}invertWith(){return V.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,s){V.toOuterPoint(this,t,e,s)}toInnerPoint(t,e,s){V.toInnerPoint(this,t,e,s)}setLayout(t,e,s){return V.setLayout(this,t,e,s),this}getLayout(t,e,s){return V.getLayout(this,t,e,s)}withScale(t,e){return V.withScale(this,t,e)}reset(){V.reset(this)}}const dt=new lt,ct={tempPointBounds:{},setPoint(t,e,s){t.minX=t.maxX=e,t.minY=t.maxY=s},addPoint(t,e,s){t.minX=e<t.minX?e:t.minX,t.minY=s<t.minY?s:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=s>t.maxY?s:t.maxY},addBounds(t,e,s,i,r){ut(t,e,s),ut(t,e+i,s+r)},copy(t,e){t.minX=e.minX,t.minY=e.minY,t.maxX=e.maxX,t.maxY=e.maxY},addPointBounds(t,e){t.minX=e.minX<t.minX?e.minX:t.minX,t.minY=e.minY<t.minY?e.minY:t.minY,t.maxX=e.maxX>t.maxX?e.maxX:t.maxX,t.maxY=e.maxY>t.maxY?e.maxY:t.maxY},toBounds(t,e){e.x=t.minX,e.y=t.minY,e.width=t.maxX-t.minX,e.height=t.maxY-t.minY}},{addPoint:ut}=ct;var _t,pt;t.Direction4=void 0,(_t=t.Direction4||(t.Direction4={}))[_t.top=0]="top",_t[_t.right=1]="right",_t[_t.bottom=2]="bottom",_t[_t.left=3]="left",t.Direction9=void 0,(pt=t.Direction9||(t.Direction9={}))[pt.topLeft=0]="topLeft",pt[pt.top=1]="top",pt[pt.topRight=2]="topRight",pt[pt.right=3]="right",pt[pt.bottomRight=4]="bottomRight",pt[pt.bottom=5]="bottom",pt[pt.bottomLeft=6]="bottomLeft",pt[pt.left=7]="left",pt[pt.center=8]="center",pt[pt["top-left"]=0]="top-left",pt[pt["top-right"]=2]="top-right",pt[pt["bottom-right"]=4]="bottom-right",pt[pt["bottom-left"]=6]="bottom-left";const gt=[{x:0,y:0},{x:.5,y:0},{x:1,y:0},{x:1,y:.5},{x:1,y:1},{x:.5,y:1},{x:0,y:1},{x:0,y:.5},{x:.5,y:.5}];gt.forEach(t=>t.type="percent");const ft={directionData:gt,tempPoint:{},get:yt,toPoint(t,e,s,i,r,n){const o=yt(t);s.x=o.x,s.y=o.y,"percent"===o.type&&(s.x*=e.width,s.y*=e.height,r&&(n||(s.x-=r.x,s.y-=r.y),o.x&&(s.x-=1===o.x?r.width:.5===o.x?o.x*r.width:0),o.y&&(s.y-=1===o.y?r.height:.5===o.y?o.y*r.height:0))),i||(s.x+=e.x,s.y+=e.y)},getPoint:(t,e,s)=>(s||(s={}),ft.toPoint(t,e,s,!0),s)};function yt(e){return a(e)?gt[t.Direction9[e]]:e}const{toPoint:mt}=ft,xt={toPoint(t,e,s,i,r,n){mt(t,s,i,r,e,n)}},{tempPointBounds:wt,setPoint:vt,addPoint:bt,toBounds:Bt}=ct,{toOuterPoint:kt}=V,{float:St,fourNumber:Rt}=L,{floor:Ct,ceil:Tt}=Math;let Pt,Lt,It,Et;const Ot={},At={},Mt={},Wt={tempBounds:Mt,set(t,e=0,s=0,i=0,r=0){t.x=e,t.y=s,t.width=i,t.height=r},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,s,i,r){const{x:n,y:o,width:a,height:h}=e;if(c(s)){const e=Rt(s);i?Dt.set(t,n+e[3],o+e[0],a-e[1]-e[3],h-e[2]-e[0]):Dt.set(t,n-e[3],o-e[0],a+e[1]+e[3],h+e[2]+e[0])}else i&&(s=-s),Dt.set(t,n-s,o-s,a+2*s,h+2*s);r&&("width"===r?(t.y=o,t.height=h):(t.x=n,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,s){t.x+=e,t.y+=s},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,s)=>(t=Object.assign({},t),Dt.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?zt(e,t):e=t,s||(s=t),e.offsetX=Dt.maxX(s),e.offsetY=Dt.maxY(s),Dt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,s=e,i){i||st.scale(t,e,s),t.width*=e,t.height*=s},scaleOf(t,e,s,i=s){st.scaleOf(t,e,s,i),t.width*=s,t.height*=i},tempToOuterOf:(t,e)=>(Dt.copy(Mt,t),Dt.toOuterOf(Mt,e),Mt),getOuterOf:(t,e)=>(t=Object.assign({},t),Dt.toOuterOf(t,e),t),toOuterOf(t,e,s){if(s||(s=t),0===e.b&&0===e.c){const{a:i,d:r}=e;i>0?(s.width=t.width*i,s.x=e.e+t.x*i):(s.width=t.width*-i,s.x=e.e+t.x*i-s.width),r>0?(s.height=t.height*r,s.y=e.f+t.y*r):(s.height=t.height*-r,s.y=e.f+t.y*r-s.height)}else Ot.x=t.x,Ot.y=t.y,kt(e,Ot,At),vt(wt,At.x,At.y),Ot.x=t.x+t.width,kt(e,Ot,At),bt(wt,At.x,At.y),Ot.y=t.y+t.height,kt(e,Ot,At),bt(wt,At.x,At.y),Ot.x=t.x,kt(e,Ot,At),bt(wt,At.x,At.y),Bt(wt,s)},toInnerOf(t,e,s){s||(s=t),Dt.move(s,-e.e,-e.f),Dt.scale(s,1/e.a,1/e.d)},getFitMatrix(t,e,s=1){const i=Math.min(s,Dt.getFitScale(t,e));return new lt(i,0,0,i,-e.x*i,-e.y*i)},getFitScale(t,e,s){const i=t.width/e.width,r=t.height/e.height;return s?Math.max(i,r):Math.min(i,r)},put(t,e,s="center",i=1,r=!0,n){n||(n=e),a(i)&&(i=Dt.getFitScale(t,e,"cover"===i)),Mt.width=r?e.width*=i:e.width*i,Mt.height=r?e.height*=i:e.height*i,xt.toPoint(s,Mt,t,n,!0,!0)},getSpread(t,e,s){const i={};return Dt.copyAndSpread(i,t,e,!1,s),i},spread(t,e,s){Dt.copyAndSpread(t,t,e,!1,s)},shrink(t,e,s){Dt.copyAndSpread(t,t,e,!0,s)},ceil(t){const{x:e,y:s}=t;t.x=Ct(t.x),t.y=Ct(t.y),t.width=e>t.x?Tt(t.width+e-t.x):Tt(t.width),t.height=s>t.y?Tt(t.height+s-t.y):Tt(t.height)},unsign(t){t.width<0&&(t.x+=t.width,t.width=-t.width),t.height<0&&(t.y+=t.height,t.height=-t.height)},float(t,e){t.x=St(t.x,e),t.y=St(t.y,e),t.width=St(t.width,e),t.height=St(t.height,e)},add(t,e,s){Pt=t.x+t.width,Lt=t.y+t.height,It=e.x,Et=e.y,s||(It+=e.width,Et+=e.height),Pt=Pt>It?Pt:It,Lt=Lt>Et?Lt:Et,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=Pt-t.x,t.height=Lt-t.y},addList(t,e){Dt.setListWithFn(t,e,void 0,!0)},setList(t,e,s=!1){Dt.setListWithFn(t,e,void 0,s)},addListWithFn(t,e,s){Dt.setListWithFn(t,e,s,!0)},setListWithFn(t,e,s,i=!1){let r,n=!0;for(let o=0,a=e.length;o<a;o++)r=s?s(e[o],o):e[o],r&&(r.width||r.height)&&(n?(n=!1,i||zt(t,r)):Ft(t,r));n&&Dt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?vt(wt,t.x,t.y):bt(wt,t.x,t.y)),Bt(wt,t)},setPoint(t,e){Dt.set(t,e.x,e.y)},addPoint(t,e){Ft(t,e,!0)},getPoints(t){const{x:e,y:s,width:i,height:r}=t;return[{x:e,y:s},{x:e+i,y:s},{x:e+i,y:s+r},{x:e,y:s+r}]},hitRadiusPoint:(t,e,s)=>(s&&(e=st.tempToInnerRadiusPointOf(e,s)),e.x>=t.x-e.radiusX&&e.x<=t.x+t.width+e.radiusX&&e.y>=t.y-e.radiusY&&e.y<=t.y+t.height+e.radiusY),hitPoint:(t,e,s)=>(s&&(e=st.tempToInnerOf(e,s)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,s)=>(s&&(e=Dt.tempToOuterOf(e,s)),!(t.y+t.height<e.y||e.y+e.height<t.y||t.x+t.width<e.x||e.x+e.width<t.x)),includes:(t,e,s)=>(s&&(e=Dt.tempToOuterOf(e,s)),t.x<=e.x&&t.y<=e.y&&t.x+t.width>=e.x+e.width&&t.y+t.height>=e.y+e.height),getIntersectData(t,e,s){if(s&&(e=Dt.tempToOuterOf(e,s)),!Dt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:i,y:r,width:n,height:o}=e;return Pt=i+n,Lt=r+o,It=t.x+t.width,Et=t.y+t.height,i=i>t.x?i:t.x,r=r>t.y?r:t.y,Pt=Pt<It?Pt:It,Lt=Lt<Et?Lt:Et,n=Pt-i,o=Lt-r,{x:i,y:r,width:n,height:o}},intersect(t,e,s){Dt.copy(t,Dt.getIntersectData(t,e,s))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,reset(t){Dt.set(t)}},Dt=Wt,{add:Ft,copy:zt}=Dt;class Ut{get minX(){return Wt.minX(this)}get minY(){return Wt.minY(this)}get maxX(){return Wt.maxX(this)}get maxY(){return Wt.maxY(this)}constructor(t,e,s,i){this.set(t,e,s,i)}set(t,e,s,i){return u(t)?Wt.copy(this,t):Wt.set(this,t,e,s,i),this}get(){const{x:t,y:e,width:s,height:i}=this;return{x:t,y:e,width:s,height:i}}clone(){return new Ut(this)}move(t,e){return Wt.move(this,t,e),this}scale(t,e,s){return Wt.scale(this,t,e,s),this}scaleOf(t,e,s){return Wt.scaleOf(this,t,e,s),this}toOuterOf(t,e){return Wt.toOuterOf(this,t,e),this}toInnerOf(t,e){return Wt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Wt.getFitMatrix(this,t,e)}put(t,e,s){Wt.put(this,t,e,s)}spread(t,e){return Wt.spread(this,t,e),this}shrink(t,e){return Wt.shrink(this,t,e),this}ceil(){return Wt.ceil(this),this}unsign(){return Wt.unsign(this),this}float(t){return Wt.float(this,t),this}add(t){return Wt.add(this,t),this}addList(t){return Wt.setList(this,t,!0),this}setList(t){return Wt.setList(this,t),this}addListWithFn(t,e){return Wt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Wt.setListWithFn(this,t,e),this}setPoint(t){return Wt.setPoint(this,t),this}setPoints(t){return Wt.setPoints(this,t),this}addPoint(t){return Wt.addPoint(this,t),this}getPoints(){return Wt.getPoints(this)}hitPoint(t,e){return Wt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Wt.hitRadiusPoint(this,t,e)}hit(t,e){return Wt.hit(this,t,e)}includes(t,e){return Wt.includes(this,t,e)}intersect(t,e){return Wt.intersect(this,t,e),this}getIntersect(t,e){return new Ut(Wt.getIntersectData(this,t,e))}isSame(t){return Wt.isSame(this,t)}isEmpty(){return Wt.isEmpty(this)}reset(){Wt.reset(this)}}const Nt=new Ut;class Yt{constructor(t,e,s,i,r,n){u(t)?this.copy(t):this.set(t,e,s,i,r,n)}set(t=0,e=0,s=0,i=0,r=0,n=0){this.top=t,this.right=e,this.bottom=s,this.left=i,this.width=r,this.height=n}copy(t){const{top:e,right:s,bottom:i,left:r,width:n,height:o}=t;this.set(e,s,i,r,n,o)}getBoundsFrom(t){const{top:e,right:s,bottom:i,left:r,width:n,height:o}=this;return new Ut(r,e,n||t.width-r-s,o||t.height-e-i)}}const Xt={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1},{randColor:Ht}=L;class Vt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new Vt(t)}static set filter(t){this.filterList=jt(t)}static set exclude(t){this.excludeList=jt(t)}static drawRepaint(t,e){const s=Ht();t.fillWorld(e,s.replace("1)",".1)")),t.strokeWorld(e,s)}static drawBounds(t,e,s){const i="hit"===Vt.showBounds,r=t.__nowWorld,n=Ht();i&&(e.setWorld(r),t.__drawHitPath(e),e.fillStyle=n.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(n,2),i?e.stroke():e.strokeWorld(r,n)}log(...t){if(Gt.enable){if(Gt.filterList.length&&Gt.filterList.every(t=>t!==this.name))return;if(Gt.excludeList.length&&Gt.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){Gt.enable&&this.warn(...t)}warn(...t){Gt.showWarn&&console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(this.warn("repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}function jt(t){return t?a(t)&&(t=[t]):t=[],t}Vt.filterList=[],Vt.excludeList=[],Vt.showWarn=!0;const Gt=Vt,qt=Vt.get("RunTime"),Qt={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=s.create(s.RUNTIME);return Jt.currentId=Jt.idMap[i]=e?performance.now():Date.now(),Jt.currentName=Jt.nameMap[i]=t,Jt.nameToIdMap[t]=i,i},end(t,e){const s=Jt.idMap[t],i=Jt.nameMap[t],r=e?(performance.now()-s)/1e3:Date.now()-s;Jt.idMap[t]=Jt.nameMap[t]=Jt.nameToIdMap[i]=void 0,qt.log(i,r,"ms")},endOfName(t,e){const s=Jt.nameToIdMap[t];n(s)||Jt.end(s,e)}},Jt=Qt,$t=[],Zt={list:{},add(t,...e){this.list[t]=!0,$t.push(...e)},has(t,e){const s=this.list[t];return!s&&e&&this.need(t),s},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout(()=>$t.forEach(t=>Zt.has(t,!0)));const Kt={editor:t=>Zt.need("editor")},te=Vt.get("UICreator"),ee={list:{},register(t){const{__tag:e}=t.prototype;se[e]&&te.repeat(e),se[e]=t},get(t,e,s,i,r,o){se[t]||te.error("not register "+t);const a=new se[t](e);return n(s)||(a.x=s,i&&(a.y=i),r&&(a.width=r),o&&(a.height=o)),a}},{list:se}=ee,ie=Vt.get("EventCreator"),re={nameList:{},register(t){let e;Object.keys(t).forEach(s=>{e=t[s],a(e)&&(ne[e]&&ie.repeat(e),ne[e]=t)})},changeName(t,e){const s=ne[t];if(s){const i=Object.keys(s).find(e=>s[e]===t);i&&(s[i]=e,ne[e]=s)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new ne[t](...e)},{nameList:ne}=re;class oe{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:s}=this;for(let i=0,r=s.length;i<r;i++)if(e=s[i],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const i=Kt.canvas(t);return this.add(i),i}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let s=0,i=this.list.length;s<i;s++)t=this.list[s],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach(t=>{t.destroy()}),this.list.length=0}destroy(){this.clear()}}function ae(t,e,s,i){var r,n=arguments.length,o=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(o=(n<3?r(o):n>3?r(e,s,o):r(e,s))||o);return n>3&&o&&Object.defineProperty(e,s,o),o}function he(t,e,s,i){return new(s||(s=Promise))(function(r,n){function o(t){try{h(i.next(t))}catch(t){n(t)}}function a(t){try{h(i.throw(t))}catch(t){n(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s(function(t){t(e)})).then(o,a)}h((i=i.apply(t,e||[])).next())})}function le(t){return(e,s)=>{t||(t=s);const i={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===s&&(i.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,s,i)}}"function"==typeof SuppressedError&&SuppressedError;const de=[];function ce(){return(t,e)=>{de.push(e)}}const ue=[];class _e{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||ue)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;de.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,s,i,r,n){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,s,i,r,n){u(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,s,i,r,n)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,s,i){}strokeRect(t,e,s,i){}clearRect(t,e,s,i){}drawImage(t,e,s,i,r,n,o,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/i*a;i+=e,e=0,n+=t,a-=t}if(s<0){const t=-s/r*h;r+=s,s=0,o+=t,h-=t}this.context.drawImage(t,e,s,i,r,n,o,a,h);break;case 5:this.context.drawImage(t,e,s,i,r);break;case 3:this.context.drawImage(t,e,s)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,s,i,r,n){}quadraticCurveTo(t,e,s,i){}closePath(){}arc(t,e,s,i,r,n){}arcTo(t,e,s,i,r){}ellipse(t,e,s,i,r,n,o,a){}rect(t,e,s,i){}roundRect(t,e,s,i,r){}createConicGradient(t,e,s){}createLinearGradient(t,e,s,i){}createPattern(t,e){}createRadialGradient(t,e,s,i,r,n){}fillText(t,e,s,i){}measureText(t){}strokeText(t,e,s,i){}destroy(){this.context=null}}ae([le("imageSmoothingEnabled")],_e.prototype,"smooth",void 0),ae([le("imageSmoothingQuality")],_e.prototype,"smoothLevel",void 0),ae([le("globalAlpha")],_e.prototype,"opacity",void 0),ae([le()],_e.prototype,"fillStyle",void 0),ae([le()],_e.prototype,"strokeStyle",void 0),ae([le("lineWidth")],_e.prototype,"strokeWidth",void 0),ae([le("lineCap")],_e.prototype,"strokeCap",void 0),ae([le("lineJoin")],_e.prototype,"strokeJoin",void 0),ae([le("lineDashOffset")],_e.prototype,"dashOffset",void 0),ae([le()],_e.prototype,"miterLimit",void 0),ae([le()],_e.prototype,"shadowBlur",void 0),ae([le()],_e.prototype,"shadowColor",void 0),ae([le()],_e.prototype,"shadowOffsetX",void 0),ae([le()],_e.prototype,"shadowOffsetY",void 0),ae([le()],_e.prototype,"filter",void 0),ae([le()],_e.prototype,"font",void 0),ae([le()],_e.prototype,"fontKerning",void 0),ae([le()],_e.prototype,"fontStretch",void 0),ae([le()],_e.prototype,"fontVariantCaps",void 0),ae([le()],_e.prototype,"textAlign",void 0),ae([le()],_e.prototype,"textBaseline",void 0),ae([le()],_e.prototype,"textRendering",void 0),ae([le()],_e.prototype,"wordSpacing",void 0),ae([le()],_e.prototype,"letterSpacing",void 0),ae([le()],_e.prototype,"direction",void 0),ae([ce()],_e.prototype,"setTransform",null),ae([ce()],_e.prototype,"resetTransform",null),ae([ce()],_e.prototype,"getTransform",null),ae([ce()],_e.prototype,"save",null),ae([ce()],_e.prototype,"restore",null),ae([ce()],_e.prototype,"translate",null),ae([ce()],_e.prototype,"scale",null),ae([ce()],_e.prototype,"rotate",null),ae([ce()],_e.prototype,"fill",null),ae([ce()],_e.prototype,"stroke",null),ae([ce()],_e.prototype,"clip",null),ae([ce()],_e.prototype,"fillRect",null),ae([ce()],_e.prototype,"strokeRect",null),ae([ce()],_e.prototype,"clearRect",null),ae([ce()],_e.prototype,"beginPath",null),ae([ce()],_e.prototype,"moveTo",null),ae([ce()],_e.prototype,"lineTo",null),ae([ce()],_e.prototype,"bezierCurveTo",null),ae([ce()],_e.prototype,"quadraticCurveTo",null),ae([ce()],_e.prototype,"closePath",null),ae([ce()],_e.prototype,"arc",null),ae([ce()],_e.prototype,"arcTo",null),ae([ce()],_e.prototype,"ellipse",null),ae([ce()],_e.prototype,"rect",null),ae([ce()],_e.prototype,"roundRect",null),ae([ce()],_e.prototype,"createConicGradient",null),ae([ce()],_e.prototype,"createLinearGradient",null),ae([ce()],_e.prototype,"createPattern",null),ae([ce()],_e.prototype,"createRadialGradient",null),ae([ce()],_e.prototype,"fillText",null),ae([ce()],_e.prototype,"measureText",null),ae([ce()],_e.prototype,"strokeText",null);const{copy:pe,multiplyParent:ge,pixelScale:fe}=V,{round:ye}=Math,me=new Ut,xe=new Ut,we={width:1,height:1,pixelRatio:1},ve=["width","height","pixelRatio"];class be extends _e{get width(){return this.size.width}get height(){return this.size.height}get pixelRatio(){return this.size.pixelRatio}get pixelWidth(){return this.width*this.pixelRatio||0}get pixelHeight(){return this.height*this.pixelRatio||0}get pixelSnap(){return this.config.pixelSnap}set pixelSnap(t){this.config.pixelSnap=t}get allowBackgroundColor(){return this.view&&this.parentView}constructor(t,i){super(),this.size={},this.worldTransform={},t||(t=we),this.manager=i,this.innerId=s.create(s.CNAVAS);const{width:r,height:n,pixelRatio:o}=t;this.autoLayout=!r||!n,this.size.pixelRatio=o||e.devicePixelRatio,this.config=t,this.init()}init(){}__createContext(){const{view:t}=this,{contextSettings:e}=this.config;this.context=e?t.getContext("2d",e):t.getContext("2d"),this.__bindContext()}export(t,e){}toBlob(t,e){}toDataURL(t,e){}saveAs(t,e){}resize(t,e=!0){if(this.isSameSize(t))return;let s;this.context&&!this.unreal&&e&&this.width&&(s=this.getSameCanvas(),s.copyWorld(this));const i=this.size;p.copyAttrs(i,t,ve),ve.forEach(t=>i[t]||(i[t]=1)),this.bounds=new Ut(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!this.unreal&&s&&(this.clearWorld(s.bounds),this.copyWorld(s),s.recycle()))}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:s,pixelSnap:i}=this,r=this.worldTransform;e&&ge(t,e,r),fe(t,s,r),i&&!t.ignorePixelSnap&&(t.half&&t.half*s%2?(r.e=ye(r.e-.5)+.5,r.f=ye(r.f-.5)+.5):(r.e=ye(r.e),r.f=ye(r.f))),this.setTransform(r.a,r.b,r.c,r.d,r.e,r.f)}useWorldTransform(t){t&&(this.worldTransform=t);const e=this.worldTransform;e&&this.setTransform(e.a,e.b,e.c,e.d,e.e,e.f)}setStroke(t,e,s,i){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),s&&this.setStrokeOptions(s,i)}setStrokeOptions(t,e){let{strokeCap:s,strokeJoin:i,dashPattern:r,dashOffset:o,miterLimit:a}=t;e&&(e.strokeCap&&(s=e.strokeCap),e.strokeJoin&&(i=e.strokeJoin),n(e.dashPattern)||(r=e.dashPattern),n(e.dashOffset)||(o=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=s,this.strokeJoin=i,this.dashPattern=r,this.dashOffset=o,this.miterLimit=a}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return!0}hitStroke(t,e){return!0}hitPixel(t,e,s=1){return!0}setWorldShadow(t,e,s,i){const{pixelRatio:r}=this;this.shadowOffsetX=t*r,this.shadowOffsetY=e*r,this.shadowBlur=s*r,this.shadowColor=i||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,s,i,r=!0){i&&(this.blendMode=i),e?(this.setTempPixelBounds(e,r),s?(this.setTempPixelBounds2(s,r),s=xe):s=me,this.drawImage(t.view,me.x,me.y,me.width,me.height,s.x,s.y,s.width,s.height)):this.drawImage(t.view,0,0),i&&(this.blendMode="source-over")}copyWorldToInner(t,e,s,i,r=!0){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Wt.tempToOuterOf(s,e),i,r),this.restore()):(i&&(this.blendMode=i),this.setTempPixelBounds(e,r),this.drawImage(t.view,me.x,me.y,me.width,me.height,s.x,s.y,s.width,s.height),i&&(this.blendMode="source-over"))}copyWorldByReset(t,e,s,i,r,n=!0){this.resetTransform(),this.copyWorld(t,e,s,i,n),r||this.useWorldTransform()}useGrayscaleAlpha(t){let e,s;this.setTempPixelBounds(t,!0,!0);const{context:i}=this,r=i.getImageData(me.x,me.y,me.width,me.height),{data:n}=r;for(let t=0,i=n.length;t<i;t+=4)s=.299*n[t]+.587*n[t+1]+.114*n[t+2],(e=n[t+3])&&(n[t+3]=255===e?s:e*(s/255));i.putImageData(r,me.x,me.y)}useMask(t,e,s){this.copyWorld(t,e,s,"destination-in")}useEraser(t,e,s){this.copyWorld(t,e,s,"destination-out")}fillWorld(t,e,s,i){s&&(this.blendMode=s),this.fillStyle=e,this.setTempPixelBounds(t,i),this.fillRect(me.x,me.y,me.width,me.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s,i){s&&(this.blendMode=s),this.strokeStyle=e,this.setTempPixelBounds(t,i),this.strokeRect(me.x,me.y,me.width,me.height),s&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(me.x,me.y,me.width,me.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(me.x,me.y,me.width,me.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,s){this.copyToPixelBounds(me,t,e,s)}setTempPixelBounds2(t,e,s){this.copyToPixelBounds(xe,t,e,s)}copyToPixelBounds(t,e,s,i){t.set(e),i&&t.intersect(this.bounds),t.scale(this.pixelRatio),s&&t.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:s,pixelSnap:i}=this,r=this.manager?this.manager.get(s):Kt.canvas(Object.assign({},s));return r.save(),t&&(pe(r.worldTransform,this.worldTransform),r.useWorldTransform()),e&&(r.smooth=this.smooth),r.pixelSnap!==i&&(r.pixelSnap=i),r}recycle(t){this.recycled||(this.restore(),t?this.clearWorld(t):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(t){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const Be={creator:{},parse(t,e){},convertToCanvasData(t,e){}},ke={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Se=Object.assign({M:1,m:10,L:2,l:20,H:3,h:30,V:4,v:40,C:5,c:50,S:6,s:60,Q:7,q:70,T:8,t:80,A:9,a:90,Z:11,z:11,R:12},ke),Re={M:3,m:3,L:3,l:3,H:2,h:2,V:2,v:2,C:7,c:7,S:5,s:5,Q:5,q:5,T:3,t:3,A:8,a:8,Z:1,z:1,N:5,D:9,X:6,G:9,F:5,O:7,P:4,U:6},Ce={m:10,l:20,H:3,h:30,V:4,v:40,c:50,S:6,s:60,q:70,T:8,t:80,A:9,a:90},Te=Object.assign(Object.assign({},Ce),ke),Pe=Se,Le={};for(let t in Pe)Le[Pe[t]]=t;const Ie={};for(let t in Pe)Ie[Pe[t]]=Re[t];const Ee={drawRoundRect(t,e,s,i,r,n){const o=L.fourNumber(n,Math.min(i/2,r/2)),a=e+i,h=s+r;o[0]?t.moveTo(e+o[0],s):t.moveTo(e,s),o[1]?t.arcTo(a,s,a,h,o[1]):t.lineTo(a,s),o[2]?t.arcTo(a,h,e,h,o[2]):t.lineTo(a,h),o[3]?t.arcTo(e,h,e,s,o[3]):t.lineTo(e,h),o[0]?t.arcTo(e,s,a,s,o[0]):t.lineTo(e,s)}},{sin:Oe,cos:Ae,hypot:Me,atan2:We,ceil:De,abs:Fe,PI:ze,sqrt:Ue,pow:Ne}=Math,{setPoint:Ye,addPoint:Xe}=ct,{set:He,toNumberPoints:Ve}=st,{M:je,L:Ge,C:qe,Q:Qe,Z:Je}=Se,$e={},Ze={points(t,e,s,i){let r=Ve(e);if(t.push(je,r[0],r[1]),s&&r.length>5){let e,n,o,a,h,l,d,c,u,_,p,g,f,y=r.length;const m=!0===s?.5:s;i&&(r=[r[y-2],r[y-1],...r,r[0],r[1],r[2],r[3]],y=r.length);for(let s=2;s<y-2;s+=2)e=r[s-2],n=r[s-1],o=r[s],a=r[s+1],h=r[s+2],l=r[s+3],p=Ue(Ne(o-e,2)+Ne(a-n,2)),g=Ue(Ne(h-o,2)+Ne(l-a,2)),(p||g)&&(f=p+g,p=m*p/f,g=m*g/f,h-=e,l-=n,d=o-p*h,c=a-p*l,2===s?i||t.push(Qe,d,c,o,a):t.push(qe,u,_,d,c,o,a),u=o+g*h,_=a+g*l);i||t.push(Qe,u,_,r[y-2],r[y-1])}else for(let e=2,s=r.length;e<s;e+=2)t.push(Ge,r[e],r[e+1]);i&&t.push(Je)},rect(t,e,s,i,r){Be.creator.path=t,Be.creator.moveTo(e,s).lineTo(e+i,s).lineTo(e+i,s+r).lineTo(e,s+r).lineTo(e,s)},roundRect(t,e,s,i,r,n){Be.creator.path=[],Ee.drawRoundRect(Be.creator,e,s,i,r,n),t.push(...Be.convertToCanvasData(Be.creator.path,!0))},arcTo(t,e,s,i,r,n,o,a,h,l,d){const c=i-e,u=r-s,_=n-i,p=o-r;let g=We(u,c),f=We(p,_);const y=Me(c,u),m=Me(_,p);let x=f-g;if(x<0&&(x+=O),y<1e-12||m<1e-12||x<1e-12||Fe(x-ze)<1e-12)return t&&t.push(Ge,i,r),h&&(Ye(h,e,s),Xe(h,i,r)),d&&He(d,e,s),void(l&&He(l,i,r));const w=c*p-_*u<0,v=w?-1:1,b=a/Ae(x/2),B=i+b*Ae(g+x/2+A*v),k=r+b*Oe(g+x/2+A*v);return g-=A*v,f-=A*v,es(t,B,k,a,a,0,g/E,f/E,w,h,l,d)},arc:(t,e,s,i,r,n,o,a,h,l)=>es(t,e,s,i,i,0,r,n,o,a,h,l),ellipse(t,e,s,i,r,n,o,a,h,l,d,c){const u=n*E,_=Oe(u),p=Ae(u);let g=o*E,f=a*E;g>ze&&(g-=O),f<0&&(f+=O);let y=f-g;y<0?y+=O:y>O&&(y-=O),h&&(y-=O);const m=De(Fe(y/A)),x=y/m,w=Oe(x/4),v=8/3*w*w/Oe(x/2);f=g+x;let b,B,k,S,R,C,T,P,L=Ae(g),I=Oe(g),M=k=p*i*L-_*r*I,W=S=_*i*L+p*r*I,D=e+k,F=s+S;t&&t.push(t.length?Ge:je,D,F),l&&Ye(l,D,F),c&&He(c,D,F);for(let n=0;n<m;n++)b=Ae(f),B=Oe(f),k=p*i*b-_*r*B,S=_*i*b+p*r*B,R=e+M-v*(p*i*I+_*r*L),C=s+W-v*(_*i*I-p*r*L),T=e+k+v*(p*i*B+_*r*b),P=s+S+v*(_*i*B-p*r*b),t&&t.push(qe,R,C,T,P,e+k,s+S),l&&ts(e+M,s+W,R,C,T,P,e+k,s+S,l,!0),M=k,W=S,L=b,I=B,g=f,f+=x;d&&He(d,e+k,s+S)},quadraticCurveTo(t,e,s,i,r,n,o){t.push(qe,(e+2*i)/3,(s+2*r)/3,(n+2*i)/3,(o+2*r)/3,n,o)},toTwoPointBoundsByQuadraticCurve(t,e,s,i,r,n,o,a){ts(t,e,(t+2*s)/3,(e+2*i)/3,(r+2*s)/3,(n+2*i)/3,r,n,o,a)},toTwoPointBounds(t,e,s,i,r,n,o,a,h,l){const d=[];let c,u,_,p,g,f,y,m,x=t,w=s,v=r,b=o;for(let t=0;t<2;++t)if(1==t&&(x=e,w=i,v=n,b=a),c=-3*x+9*w-9*v+3*b,u=6*x-12*w+6*v,_=3*w-3*x,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;p=-_/u,0<p&&p<1&&d.push(p)}else y=u*u-4*_*c,m=Math.sqrt(y),y<0||(g=(-u+m)/(2*c),0<g&&g<1&&d.push(g),f=(-u-m)/(2*c),0<f&&f<1&&d.push(f));l?Xe(h,t,e):Ye(h,t,e),Xe(h,o,a);for(let l=0,c=d.length;l<c;l++)Ke(d[l],t,e,s,i,r,n,o,a,$e),Xe(h,$e.x,$e.y)},getPointAndSet(t,e,s,i,r,n,o,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,_=3*d*t*t,p=t*t*t;l.x=c*e+u*i+_*n+p*a,l.y=c*s+u*r+_*o+p*h},getPoint(t,e,s,i,r,n,o,a,h){const l={};return Ke(t,e,s,i,r,n,o,a,h,l),l},getDerivative(t,e,s,i,r){const n=1-t;return 3*n*n*(s-e)+6*n*t*(i-s)+3*t*t*(r-i)}},{getPointAndSet:Ke,toTwoPointBounds:ts,ellipse:es}=Ze,{sin:ss,cos:is,sqrt:rs,atan2:ns}=Math,{ellipse:os}=Ze,as={ellipticalArc(t,s,i,r,n,o,a,h,l,d,c){const u=(l-s)/2,_=(d-i)/2,p=o*E,g=ss(p),f=is(p),y=-f*u-g*_,m=-f*_+g*u,x=r*r,w=n*n,v=m*m,b=y*y,B=x*w-x*v-w*b;let k=0;if(B<0){const t=rs(1-B/(x*w));r*=t,n*=t}else k=(a===h?-1:1)*rs(B/(x*v+w*b));const S=k*r*m/n,R=-k*n*y/r,C=ns((m-R)/n,(y-S)/r),T=ns((-m-R)/n,(-y-S)/r);let P=T-C;0===h&&P>0?P-=O:1===h&&P<0&&(P+=O);const L=s+u+f*S-g*R,I=i+_+g*S+f*R,A=P<0?1:0;c||e.ellipseToCurve?os(t,L,I,r,n,o,C/E,T/E,A):r!==n||o?t.push(Se.G,L,I,r,n,o,C/E,T/E,A):t.push(Se.O,L,I,r,C/E,T/E,A)}},{M:hs,m:ls,L:ds,l:cs,H:us,h:_s,V:ps,v:gs,C:fs,c:ys,S:ms,s:xs,Q:ws,q:vs,T:bs,t:Bs,A:ks,a:Ss,Z:Rs,z:Cs,N:Ts,D:Ps,X:Ls,G:Is,F:Es,O:Os,P:As,U:Ms}=Se,{rect:Ws,roundRect:Ds,arcTo:Fs,arc:zs,ellipse:Us,quadraticCurveTo:Ns}=Ze,{ellipticalArc:Ys}=as,Xs=Vt.get("PathConvert"),Hs={},Vs={current:{dot:0},stringify(t,e){let s,i,r,n=0,o=t.length,a="";for(;n<o;){i=t[n],s=Ie[i],a+=i===r?" ":Le[i];for(let i=1;i<s;i++)a+=L.float(t[n+i],e),i===s-1||(a+=" ");r=i,n+=s}return a},parse(t,e){let s,i,r,n="";const o=[],a=e?Te:Ce;for(let e=0,h=t.length;e<h;e++)i=t[e],Xt[i]?("."===i&&(js.dot&&(Gs(o,n),n=""),js.dot++),"0"===n&&"."!==i&&(Gs(o,n),n=""),n+=i):Se[i]?(n&&(Gs(o,n),n=""),js.name=Se[i],js.length=Re[i],js.index=0,Gs(o,js.name),!s&&a[i]&&(s=!0)):"-"===i||"+"===i?"e"===r||"E"===r?n+=i:(n&&Gs(o,n),n=i):n&&(Gs(o,n),n=""),r=i;return n&&Gs(o,n),s?Vs.toCanvasData(o,e):o},toCanvasData(t,e){let s,i,r,n,o,a=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(r=t[c],r){case ls:t[c+1]+=a,t[c+2]+=h;case hs:a=t[c+1],h=t[c+2],_.push(hs,a,h),c+=3;break;case _s:t[c+1]+=a;case us:a=t[c+1],_.push(ds,a,h),c+=2;break;case gs:t[c+1]+=h;case ps:h=t[c+1],_.push(ds,a,h),c+=2;break;case cs:t[c+1]+=a,t[c+2]+=h;case ds:a=t[c+1],h=t[c+2],_.push(ds,a,h),c+=3;break;case xs:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=ms;case ms:o=n===fs||n===ms,l=o?2*a-s:t[c+1],d=o?2*h-i:t[c+2],s=t[c+1],i=t[c+2],a=t[c+3],h=t[c+4],_.push(fs,l,d,s,i,a,h),c+=5;break;case ys:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,r=fs;case fs:s=t[c+3],i=t[c+4],a=t[c+5],h=t[c+6],_.push(fs,t[c+1],t[c+2],s,i,a,h),c+=7;break;case Bs:t[c+1]+=a,t[c+2]+=h,r=bs;case bs:o=n===ws||n===bs,s=o?2*a-s:t[c+1],i=o?2*h-i:t[c+2],e?Ns(_,a,h,s,i,t[c+1],t[c+2]):_.push(ws,s,i,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case vs:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=ws;case ws:s=t[c+1],i=t[c+2],e?Ns(_,a,h,s,i,t[c+3],t[c+4]):_.push(ws,s,i,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case Ss:t[c+6]+=a,t[c+7]+=h;case ks:Ys(_,a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],e),a=t[c+6],h=t[c+7],c+=8;break;case Cs:case Rs:_.push(Rs),c++;break;case Ts:a=t[c+1],h=t[c+2],e?Ws(_,a,h,t[c+3],t[c+4]):qs(_,t,c,5),c+=5;break;case Ps:a=t[c+1],h=t[c+2],e?Ds(_,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):qs(_,t,c,9),c+=9;break;case Ls:a=t[c+1],h=t[c+2],e?Ds(_,a,h,t[c+3],t[c+4],t[c+5]):qs(_,t,c,6),c+=6;break;case Is:Us(e?_:qs(_,t,c,9),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],t[c+8],null,Hs),a=Hs.x,h=Hs.y,c+=9;break;case Es:e?Us(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):qs(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Os:zs(e?_:qs(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Hs),a=Hs.x,h=Hs.y,c+=7;break;case As:e?zs(_,t[c+1],t[c+2],t[c+3],0,360,!1):qs(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Ms:Fs(e?_:qs(_,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Hs),a=Hs.x,h=Hs.y,c+=6;break;default:return Xs.error(`command: ${r} [index:${c}]`,t),_}n=r}return _},objectToCanvasData(t){const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(hs,t.x,t.y);break;case"L":e.push(ds,t.x,t.y);break;case"C":e.push(fs,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(ws,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Rs)}}),e},copyData(t,e,s,i){for(let r=s,n=s+i;r<n;r++)t.push(e[r])},pushData(t,e){js.index===js.length&&(js.index=1,t.push(js.name)),t.push(Number(e)),js.index++,js.dot=0}},{current:js,pushData:Gs,copyData:qs}=Vs,{M:Qs,L:Js,C:$s,Q:Zs,Z:Ks,N:ti,D:ei,X:si,G:ii,F:ri,O:ni,P:oi,U:ai}=Se,{getMinDistanceFrom:hi,getRadianFrom:li}=st,{tan:di,min:ci,abs:ui}=Math,_i={},pi={beginPath(t){t.length=0},moveTo(t,e,s){t.push(Qs,e,s)},lineTo(t,e,s){t.push(Js,e,s)},bezierCurveTo(t,e,s,i,r,n,o){t.push($s,e,s,i,r,n,o)},quadraticCurveTo(t,e,s,i,r){t.push(Zs,e,s,i,r)},closePath(t){t.push(Ks)},rect(t,e,s,i,r){t.push(ti,e,s,i,r)},roundRect(t,e,s,i,r,n){if(l(n))t.push(si,e,s,i,r,n);else{const o=L.fourNumber(n);o?t.push(ei,e,s,i,r,...o):t.push(ti,e,s,i,r)}},ellipse(t,e,s,i,r,n,a,h,l){o(n)?t.push(ri,e,s,i,r):(o(a)&&(a=0),o(h)&&(h=360),t.push(ii,e,s,i,r,n,a,h,l?1:0))},arc(t,e,s,i,r,n,a){o(r)?t.push(oi,e,s,i):(o(n)&&(n=360),t.push(ni,e,s,i,r,n,a?1:0))},arcTo(t,e,s,i,r,o,a,h){if(!n(a)){const t=hi(a,h,e,s,i,r);o=ci(o,ci(t/2,t/2*ui(di(li(a,h,e,s,i,r)/2))))}t.push(ai,e,s,i,r,o)},drawEllipse(t,e,s,i,r,n,a,h,l){Ze.ellipse(null,e,s,i,r,o(n)?0:n,o(a)?0:a,o(h)?360:h,l,null,null,_i),t.push(Qs,_i.x,_i.y),gi(t,e,s,i,r,n,a,h,l)},drawArc(t,e,s,i,r,n,a){Ze.arc(null,e,s,i,o(r)?0:r,o(n)?360:n,a,null,null,_i),t.push(Qs,_i.x,_i.y),fi(t,e,s,i,r,n,a)},drawPoints(t,e,s,i){Ze.points(t,e,s,i)}},{ellipse:gi,arc:fi}=pi,{moveTo:yi,lineTo:mi,quadraticCurveTo:xi,bezierCurveTo:wi,closePath:vi,beginPath:bi,rect:Bi,roundRect:ki,ellipse:Si,arc:Ri,arcTo:Ci,drawEllipse:Ti,drawArc:Pi,drawPoints:Li}=pi;class Ii{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?a(t)?Be.parse(t):t:[],this}beginPath(){return bi(this.__path),this.paint(),this}moveTo(t,e){return yi(this.__path,t,e),this.paint(),this}lineTo(t,e){return mi(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,s,i,r,n){return wi(this.__path,t,e,s,i,r,n),this.paint(),this}quadraticCurveTo(t,e,s,i){return xi(this.__path,t,e,s,i),this.paint(),this}closePath(){return vi(this.__path),this.paint(),this}rect(t,e,s,i){return Bi(this.__path,t,e,s,i),this.paint(),this}roundRect(t,e,s,i,r){return ki(this.__path,t,e,s,i,r),this.paint(),this}ellipse(t,e,s,i,r,n,o,a){return Si(this.__path,t,e,s,i,r,n,o,a),this.paint(),this}arc(t,e,s,i,r,n){return Ri(this.__path,t,e,s,i,r,n),this.paint(),this}arcTo(t,e,s,i,r){return Ci(this.__path,t,e,s,i,r),this.paint(),this}drawEllipse(t,e,s,i,r,n,o,a){return Ti(this.__path,t,e,s,i,r,n,o,a),this.paint(),this}drawArc(t,e,s,i,r,n){return Pi(this.__path,t,e,s,i,r,n),this.paint(),this}drawPoints(t,e,s){return Li(this.__path,t,e,s),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Ei,L:Oi,C:Ai,Q:Mi,Z:Wi,N:Di,D:Fi,X:zi,G:Ui,F:Ni,O:Yi,P:Xi,U:Hi}=Se,Vi=Vt.get("PathDrawer"),ji={drawPathByData(t,e){if(!e)return;let s,i=0,r=e.length;for(;i<r;)switch(s=e[i],s){case Ei:t.moveTo(e[i+1],e[i+2]),i+=3;break;case Oi:t.lineTo(e[i+1],e[i+2]),i+=3;break;case Ai:t.bezierCurveTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5],e[i+6]),i+=7;break;case Mi:t.quadraticCurveTo(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case Wi:t.closePath(),i+=1;break;case Di:t.rect(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case Fi:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],[e[i+5],e[i+6],e[i+7],e[i+8]]),i+=9;break;case zi:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;case Ui:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]*E,e[i+6]*E,e[i+7]*E,e[i+8]),i+=9;break;case Ni:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],0,0,O,!1),i+=5;break;case Yi:t.arc(e[i+1],e[i+2],e[i+3],e[i+4]*E,e[i+5]*E,e[i+6]),i+=7;break;case Xi:t.arc(e[i+1],e[i+2],e[i+3],0,O,!1),i+=4;break;case Hi:t.arcTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;default:return void Vi.error(`command: ${s} [index:${i}]`,e)}}},{M:Gi,L:qi,C:Qi,Q:Ji,Z:$i,N:Zi,D:Ki,X:tr,G:er,F:sr,O:ir,P:rr,U:nr}=Se,{toTwoPointBounds:or,toTwoPointBoundsByQuadraticCurve:ar,arcTo:hr,arc:lr,ellipse:dr}=Ze,{addPointBounds:cr,copy:ur,addPoint:_r,setPoint:pr,addBounds:gr,toBounds:fr}=ct,yr=Vt.get("PathBounds");let mr,xr,wr;const vr={},br={},Br={},kr={toBounds(t,e){kr.toTwoPointBounds(t,br),fr(br,e)},toTwoPointBounds(t,e){if(!t||!t.length)return pr(e,0,0);let s,i,r,n,o,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(o=t[a],0===a&&(o===$i||o===Qi||o===Ji?pr(e,h,l):pr(e,t[a+1],t[a+2])),o){case Gi:case qi:h=t[a+1],l=t[a+2],_r(e,h,l),a+=3;break;case Qi:r=t[a+5],n=t[a+6],or(h,l,t[a+1],t[a+2],t[a+3],t[a+4],r,n,vr),cr(e,vr),h=r,l=n,a+=7;break;case Ji:s=t[a+1],i=t[a+2],r=t[a+3],n=t[a+4],ar(h,l,s,i,r,n,vr),cr(e,vr),h=r,l=n,a+=5;break;case $i:a+=1;break;case Zi:h=t[a+1],l=t[a+2],gr(e,h,l,t[a+3],t[a+4]),a+=5;break;case Ki:case tr:h=t[a+1],l=t[a+2],gr(e,h,l,t[a+3],t[a+4]),a+=o===Ki?9:6;break;case er:dr(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],t[a+7],t[a+8],vr,Br),0===a?ur(e,vr):cr(e,vr),h=Br.x,l=Br.y,a+=9;break;case sr:h=t[a+1],l=t[a+2],xr=t[a+3],wr=t[a+4],gr(e,h-xr,l-wr,2*xr,2*wr),h+=xr,a+=5;break;case ir:lr(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],vr,Br),0===a?ur(e,vr):cr(e,vr),h=Br.x,l=Br.y,a+=7;break;case rr:h=t[a+1],l=t[a+2],mr=t[a+3],gr(e,h-mr,l-mr,2*mr,2*mr),h+=mr,a+=4;break;case nr:hr(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],vr,Br),0===a?ur(e,vr):cr(e,vr),h=Br.x,l=Br.y,a+=6;break;default:return void yr.error(`command: ${o} [index:${a}]`,t)}}},{M:Sr,L:Rr,Z:Cr}=Se,{getCenterX:Tr,getCenterY:Pr}=st,{arcTo:Lr}=pi,Ir={smooth(t,e,s){let i,r,n,o=0,a=0,h=0,l=0,d=0,c=0,u=0,_=0,p=0;const g=t.length,f=[];for(;o<g;){switch(i=t[o],i){case Sr:l=_=t[o+1],d=p=t[o+2],o+=3,t[o]===Rr?(c=t[o+1],u=t[o+2],f.push(Sr,Tr(l,c),Pr(d,u))):f.push(Sr,l,d);break;case Rr:switch(a=t[o+1],h=t[o+2],o+=3,t[o]){case Rr:Lr(f,a,h,t[o+1],t[o+2],e,_,p);break;case Cr:Lr(f,a,h,l,d,e,_,p);break;default:f.push(Rr,a,h)}_=a,p=h;break;case Cr:r!==Cr&&(Lr(f,l,d,c,u,e,_,p),f.push(Cr)),o+=1;break;default:n=Ie[i];for(let e=0;e<n;e++)f.push(t[o+e]);o+=n}r=i}return i!==Cr&&(f[1]=l,f[2]=d),f}};function Er(t){return new Ii(t)}const Or=Er();Be.creator=Er(),Be.parse=Vs.parse,Be.convertToCanvasData=Vs.toCanvasData;const{drawRoundRect:Ar}=Ee;function Mr(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,s,i,r){Ar(this,t,e,s,i,r)})}(t)}const Wr={alphaPixelTypes:["png","webp","svg"],upperCaseTypeMap:{},mineType:t=>!t||t.startsWith("image")?t:("jpg"===t&&(t="jpeg"),"image/"+t),fileType(t){const e=t.split(".");return e[e.length-1]},isOpaqueImage(t){const e=Dr.fileType(t);return["jpg","jpeg"].some(t=>t===e)},getExportOptions(t){switch(typeof t){case"object":return t;case"number":return{quality:t};case"boolean":return{blob:t};default:return{}}}},Dr=Wr;Dr.alphaPixelTypes.forEach(t=>Dr.upperCaseTypeMap[t]=t.toUpperCase());const Fr=Vt.get("TaskProcessor");class zr{constructor(t){this.parallel=!0,this.time=1,this.id=s.create(s.TASK),this.task=t}run(){return he(this,void 0,void 0,function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){Fr.error(t)}})}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class Ur{get total(){return this.list.length+this.delayNumber}get finishedIndex(){return this.isComplete?0:this.index+this.parallelSuccessNumber}get remain(){return this.isComplete?this.total:this.total-this.finishedIndex}get percent(){const{total:t}=this;let e=0,s=0;for(let i=0;i<t;i++)i<=this.finishedIndex?(s+=this.list[i].time,i===this.finishedIndex&&(e=s)):e+=this.list[i].time;return this.isComplete?1:s/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&p.assign(this.config,t),this.empty()}add(t,e){let s,i,r,o;const a=new zr(t);return a.parent=this,l(e)?o=e:e&&(i=e.parallel,s=e.start,r=e.time,o=e.delay),r&&(a.time=r),!1===i&&(a.parallel=!1),n(o)?this.push(a,s):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(a,s))},o)),this.isComplete=!1,a}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout(()=>this.start()))}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[],this.delayNumber=0}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach(t=>{t.isComplete||t.cancel()}),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then(()=>{this.onTask(t),this.index++,this.nextTask()}).catch(t=>{this.onError(t)}):this.nextTask()}runParallelTasks(){this.parallelList.forEach(t=>this.runParallelTask(t))}runParallelTask(t){t.run().then(()=>{this.onTask(t),this.fillParallelTask()}).catch(t=>{this.onParallelError(t)})}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout(()=>this.run())}setParallelList(){let t;this.parallelList=[],this.parallelSuccessNumber=0;let e=this.index+this.config.parallel;e>this.list.length&&(e=this.list.length);for(let s=this.index;s<e&&(t=this.list[s],t.parallel);s++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const s=e.length,i=this.finishedIndex+s;if(e.length){if(!this.running)return;i<this.total&&(t=this.list[i],t&&t.parallel&&(e.push(t),this.runParallelTask(t)))}else this.index+=this.parallelSuccessNumber,this.parallelSuccessNumber=0,this.nextTask()}onComplete(){this.stop(),this.config.onComplete&&this.config.onComplete()}onTask(t){t.complete(),this.config.onTask&&this.config.onTask()}onParallelError(t){this.parallelList.forEach(t=>{t.parallel=!1}),this.parallelList.length=0,this.parallelSuccessNumber=0,this.onError(t)}onError(t){this.pause(),this.config.onError&&this.config.onError(t)}destroy(){this.stop()}}const Nr=Vt.get("Resource"),Yr={tasker:new Ur,map:{},get isComplete(){return Xr.tasker.isComplete},set(t,e){Xr.map[t]&&Nr.repeat(t),Xr.map[t]=e},get:t=>Xr.map[t],remove(t){const e=Xr.map[t];e&&(e.destroy&&e.destroy(),delete Xr.map[t])},loadImage(t,e){return new Promise((s,i)=>{const r=this.setImage(t,t,e);r.load(()=>s(r),t=>i(t))})},setImage(t,e,s){let i;return a(e)?i={url:e}:e.url||(i={url:t,view:e}),i&&(s&&(i.format=s),e=Kt.image(i)),Xr.set(t,e),e},destroy(){Xr.map={}}},Xr=Yr,Hr={maxRecycled:10,recycledList:[],patternTasker:new Ur,get(t){let e=Yr.get(t.url);return e||Yr.set(t.url,e=Kt.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||Vr.recycledList.push(t)})},clearRecycled(){const t=Vr.recycledList;t.length>Vr.maxRecycled&&(t.forEach(t=>!t.use&&t.url&&Yr.remove(t.url)),t.length=0)},hasAlphaPixel:t=>Wr.alphaPixelTypes.some(e=>Vr.isFormat(e,t)),isFormat(t,e){if(e.format)return e.format===t;const{url:s}=e;if(s.startsWith("data:")){if(s.startsWith("data:"+Wr.mineType(t)))return!0}else{if(s.includes("."+t)||s.includes("."+Wr.upperCaseTypeMap[t]))return!0;if("png"===t&&!s.includes("."))return!0}return!1},destroy(){Vr.recycledList=[]}},Vr=Hr,{IMAGE:jr,create:Gr}=s,{floor:qr,max:Qr}=Math;class Jr{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=Gr(jr),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}Hr.isFormat("svg",t)&&(this.isSVG=!0),Hr.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,s){if(!this.loading){this.loading=!0;let{loadImage:t,loadImageWithProgress:s}=e.origin,i=this.config.showProgress&&s&&this.onProgress.bind(this);i&&(t=s),Yr.tasker.add(()=>he(this,void 0,void 0,function*(){return yield t(this.url,i).then(t=>this.setView(t)).catch(t=>{this.error=t,this.onComplete(!1)})}))}return this.waitComplete.push(t,s),this.waitComplete.length-2}unload(t,e){const s=this.waitComplete;if(e){const e=s[t+1];e&&e({type:"stop"})}s[t]=s[t+1]=void 0}setView(t){this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)}onProgress(t){this.progress=t}onComplete(t){let e;this.waitComplete.forEach((s,i)=>{e=i%2,s&&(t?e||s(this):e&&s(this.error))}),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(t,s,i,r,n,o,a){if(t||(t=this.width),s||(s=this.height),this.cache){let{params:t,data:e}=this.cache;for(let s in t)if(t[s]!==arguments[s]){e=null;break}if(e)return e}const h=e.origin.createCanvas(Qr(qr(t+(n||0)),1),Qr(qr(s+(o||0)),1)),l=h.getContext("2d");return i&&(l.globalAlpha=i),l.imageSmoothingEnabled=!1!==a,l.drawImage(this.view,0,0,t,s),this.cache=this.use>1?{data:h,params:arguments}:null,h}getPattern(t,s,i,r){const n=e.canvas.createPattern(t,s);try{i&&n.setTransform&&(n.setTransform(i),i=void 0)}catch(t){}return r&&p.stintSet(r,"transform",i),n}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function $r(t,e,s,i){i||(s.configurable=s.enumerable=!0),Object.defineProperty(t,e,s)}function Zr(t,e){return Object.getOwnPropertyDescriptor(t,e)}function Kr(t,e){const s="_"+t;return{get(){const t=this[s];return null==t?e:t},set(t){this[s]=t}}}function tn(t,e){return(s,i)=>sn(s,i,t,e&&e(i))}function en(t){return t}function sn(t,e,s,i){const r={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};$r(t,e,Object.assign(r,i||{})),In(t,e,s)}function rn(t){return tn(t)}function nn(t,e){return tn(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function on(t,e){return tn(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function an(t){return tn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),un(this))}}))}function hn(t,e){return tn(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function ln(t,e){return tn(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function dn(t,e){return tn(t,t=>({set(s){this.__setAttr(t,s,e)&&un(this)}}))}function cn(t){return tn(t,t=>({set(e){this.__setAttr(t,e)&&(un(this),this.__.__removeNaturalSize())}}))}function un(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function _n(t){return tn(t,t=>({set(e){const s=this.__;2!==s.__pathInputed&&(s.__pathInputed=e?1:0),e||(s.__pathForRender=void 0),this.__setAttr(t,e),un(this)}}))}const pn=dn;function gn(t,e){return tn(t,t=>({set(s){this.__setAttr(t,s)&&(fn(this),e&&(this.__.__useStroke=!0))}}))}function fn(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&un(t)}const yn=gn;function mn(t){return tn(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function xn(t){return tn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function wn(t){return tn(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;p.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip),this.__layout.surfaceChange()}}}))}function vn(t){return tn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Bn(this)}}))}function bn(t){return tn(t,t=>({set(e){const s=this.visible;if(!0===s&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>kn(this,t,e,s))}else 0===s&&!0===e&&this.animation&&this.__runAnimation("in");kn(this,t,e,s),this.mask&&Bn(this)}}))}function Bn(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function kn(t,e,s,i){t.__setAttr(e,s)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==i&&0!==s||un(t))}function Sn(t){return tn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function Rn(t){return tn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function Cn(t){return tn(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function Tn(t){return tn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===Vt.showBounds&&this.__layout.surfaceChange(),this.leafer&&this.leafer.updateCursor())}}))}function Pn(t){return tn(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function Ln(t){return(e,s)=>{$r(e,"__DataProcessor",{get:()=>t})}}function In(t,e,s){const i=t.__DataProcessor.prototype,r="_"+e,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=Kr(e,s);if(n(s))a.get=function(){return this[r]};else if("function"==typeof s)a.get=function(){const t=this[r];return null==t?s(this.__leaf):t};else if(u(s)){const t=_(s);a.get=function(){const e=this[r];return null==e?this[r]=t?{}:p.clone(s):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[r];if(null==t){const t=this,e=t.__naturalWidth,i=t.__leaf;return!s||i.pathInputed?i.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:h&&i.children.length?i.boxBounds.width:s}return t}:"height"===e&&(a.get=function(){const t=this[r];if(null==t){const t=this,e=t.__naturalHeight,i=t.__leaf;return!s||i.pathInputed?i.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:h&&i.children.length?i.boxBounds.height:s}return t});let l,d=i;for(;!l&&d;)l=Zr(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),i[o]&&(a.set=i[o],delete i[o]),$r(i,e,a)}const En=new Vt("rewrite"),On=[],An=["destroy","constructor"];function Mn(t){return(e,s)=>{On.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}}function Wn(){return t=>{Dn()}}function Dn(t){On.length&&(On.forEach(e=>{t&&En.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),On.length=0)}function Fn(t,e){return s=>{var i;(t.prototype?(i=t.prototype,Object.getOwnPropertyNames(i)):Object.keys(t)).forEach(i=>{if(!(An.includes(i)||e&&e.includes(i)))if(t.prototype){Zr(t.prototype,i).writable&&(s.prototype[i]=t.prototype[i])}else s.prototype[i]=t[i]})}}function zn(){return t=>{ee.register(t)}}setTimeout(()=>Dn(!0));const{copy:Un,toInnerPoint:Nn,toOuterPoint:Yn,scaleOfOuter:Xn,rotateOfOuter:Hn,skewOfOuter:Vn,multiplyParent:jn,divideParent:Gn,getLayout:qn}=V,Qn={},{round:Jn}=Math,$n={updateAllMatrix(t,e,s){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(s=!0),to(t,e,s),t.isBranch){const{children:i}=t;for(let t=0,r=i.length;t<r;t++)Kn(i[t],e,s)}},updateMatrix(t,e,s){const i=t.__layout;e?s&&(i.waitAutoLayout=!0,t.__hasAutoLayout&&(i.matrixChanged=!1)):i.waitAutoLayout&&(i.waitAutoLayout=!1),i.matrixChanged&&t.__updateLocalMatrix(),i.waitAutoLayout||t.__updateWorldMatrix()},updateBounds(t){const e=t.__layout;e.boundsChanged&&t.__updateLocalBounds(),e.waitAutoLayout||t.__updateWorldBounds()},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)eo(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&eo(t),t.__updateChange()},updateAllChange(t){if(io(t),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)so(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},draggable:t=>(t.draggable||t.editable)&&t.hitSelf&&!t.locked,copyCanvasByWorld(t,s,i,r,n,o){r||(r=t.__nowWorld),t.__worldFlipped||e.fullImageShadow?s.copyWorldByReset(i,r,t.__nowWorld,n,o):s.copyWorldToInner(i,r,t.__layout.renderBounds,n)},moveWorld(t,e,s=0,i,r){const n=u(e)?Object.assign({},e):{x:e,y:s};i?Yn(t.localTransform,n,n,!0):t.parent&&Nn(t.parent.scrollWorldTransform,n,n,!0),Zn.moveLocal(t,n.x,n.y,r)},moveLocal(t,e,s=0,i){u(e)&&(s=e.y,e=e.x),e+=t.x,s+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=Jn(e),s=Jn(s)),i?t.animate({x:e,y:s},i):(t.x=e,t.y=s)},zoomOfWorld(t,e,s,i,r,n){Zn.zoomOfLocal(t,ro(t,e),s,i,r,n)},zoomOfLocal(t,e,s,i=s,r,n){const o=t.__localMatrix;if(l(i)||(i&&(n=i),i=s),Un(Qn,o),Xn(Qn,e,s,i),Zn.hasHighPosition(t))Zn.setTransform(t,Qn,r,n);else{const e=t.x+Qn.e-o.e,a=t.y+Qn.f-o.f;n&&!r?t.animate({x:e,y:a,scaleX:t.scaleX*s,scaleY:t.scaleY*i},n):(t.x=e,t.y=a,t.scaleResize(s,i,!0!==r))}},rotateOfWorld(t,e,s,i){Zn.rotateOfLocal(t,ro(t,e),s,i)},rotateOfLocal(t,e,s,i){const r=t.__localMatrix;Un(Qn,r),Hn(Qn,e,s),Zn.hasHighPosition(t)?Zn.setTransform(t,Qn,!1,i):t.set({x:t.x+Qn.e-r.e,y:t.y+Qn.f-r.f,rotation:L.formatRotation(t.rotation+s)},i)},skewOfWorld(t,e,s,i,r,n){Zn.skewOfLocal(t,ro(t,e),s,i,r,n)},skewOfLocal(t,e,s,i=0,r,n){Un(Qn,t.__localMatrix),Vn(Qn,e,s,i),Zn.setTransform(t,Qn,r,n)},transformWorld(t,e,s,i){Un(Qn,t.worldTransform),jn(Qn,e),t.parent&&Gn(Qn,t.parent.scrollWorldTransform),Zn.setTransform(t,Qn,s,i)},transform(t,e,s,i){Un(Qn,t.localTransform),jn(Qn,e),Zn.setTransform(t,Qn,s,i)},setTransform(t,e,s,i){const r=t.__,n=r.origin&&Zn.getInnerOrigin(t,r.origin),o=qn(e,n,r.around&&Zn.getInnerOrigin(t,r.around));if(Zn.hasOffset(t)&&(o.x-=r.offsetX,o.y-=r.offsetY),s){const e=o.scaleX/t.scaleX,s=o.scaleY/t.scaleY;if(delete o.scaleX,delete o.scaleY,n){Wt.scale(t.boxBounds,Math.abs(e),Math.abs(s));const i=Zn.getInnerOrigin(t,r.origin);st.move(o,n.x-i.x,n.y-i.y)}t.set(o),t.scaleResize(e,s,!1)}else t.set(o,i)},getFlipTransform(t,e){const s={a:1,b:0,c:0,d:1,e:0,f:0},i="x"===e?1:-1;return Xn(s,Zn.getLocalOrigin(t,"center"),-1*i,1*i),s},getLocalOrigin:(t,e)=>st.tempToOuterOf(Zn.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const s={};return ft.toPoint(e,t.boxBounds,s),s},getRelativeWorld:(t,e,s)=>(Un(Qn,t.worldTransform),Gn(Qn,e.scrollWorldTransform),s?Qn:Object.assign({},Qn)),drop(t,e,s,i){t.setTransform(Zn.getRelativeWorld(t,e,!0),i),e.add(t,s)},hasHighPosition:t=>t.origin||t.around||Zn.hasOffset(t),hasOffset:t=>t.offsetX||t.offsetY,hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}},animateMove(t,s,i=.3){if(s.x||s.y)if(Math.abs(s.x)<1&&Math.abs(s.y)<1)t.move(s);else{const r=s.x*i,n=s.y*i;s.x-=r,s.y-=n,t.move(r,n),e.requestRender(()=>Zn.animateMove(t,s,i))}}},Zn=$n,{updateAllMatrix:Kn,updateMatrix:to,updateAllWorldOpacity:eo,updateAllChange:so,updateChange:io}=Zn;function ro(t,e){return t.updateLayout(),t.parent?st.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const no={worldBounds:t=>t.__world,localBoxBounds:t=>t.__.eraser||0===t.__.visible?null:t.__local||t.__layout,localStrokeBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localStrokeBounds,localRenderBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localRenderBounds,maskLocalBoxBounds:(t,e)=>ao(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>ao(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>ao(t,e)&&t.__layout.localRenderBounds,excludeRenderBounds:(t,e)=>!(!e.bounds||e.bounds.hit(t.__world,e.matrix))||!(!e.hideBounds||!e.hideBounds.includes(t.__world,e.matrix))};let oo;function ao(t,e){return e||(oo=0),t.__.mask&&(oo=1),oo<0?null:(oo&&(oo=-1),!0)}const{updateBounds:ho}=$n,lo={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__.__childBranchNumber){const{children:s}=t;for(let i=0,r=s.length;i<r;i++)(t=s[i]).isBranch&&(t.__tempNumber=1,e.add(t),co(t,e))}},pushAllParent(t,e){const{keys:s}=e;if(s)for(;t.parent&&n(s[t.parent.innerId]);)e.add(t.parent),t=t.parent;else for(;t.parent;)e.add(t.parent),t=t.parent},pushAllBranchStack(t,e){let s=e.length;const{children:i}=t;for(let t=0,s=i.length;t<s;t++)i[t].isBranch&&e.push(i[t]);for(let t=s,i=e.length;t<i;t++)uo(e[t],e)},updateBounds(t,e){const s=[t];uo(t,s),_o(s,e)},updateBoundsByBranchStack(t,e){let s,i;for(let r=t.length-1;r>-1;r--){s=t[r],i=s.children;for(let t=0,e=i.length;t<e;t++)ho(i[t]);e&&e===s||ho(s)}}},{pushAllChildBranch:co,pushAllBranchStack:uo,updateBoundsByBranchStack:_o}=lo,po={run(t){if(t&&t.length){const e=t.length;for(let s=0;s<e;s++)t[s]();t.length===e?t.length=0:t.splice(0,e)}}},{getRelativeWorld:go,updateBounds:fo}=$n,{toOuterOf:yo,getPoints:mo,copy:xo}=Wt,wo="_localContentBounds",vo="_worldContentBounds",bo="_worldBoxBounds",Bo="_worldStrokeBounds";class ko{get contentBounds(){return this._contentBounds||this.boxBounds}set contentBounds(t){this._contentBounds=t}get strokeBounds(){return this._strokeBounds||this.boxBounds}get renderBounds(){return this._renderBounds||this.boxBounds}set renderBounds(t){this._renderBounds=t}get localContentBounds(){return yo(this.contentBounds,this.leaf.__localMatrix,this[wo]||(this[wo]={})),this[wo]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return yo(this.contentBounds,this.leaf.__world,this[vo]||(this[vo]={})),this[vo]}get worldBoxBounds(){return yo(this.boxBounds,this.leaf.__world,this[bo]||(this[bo]={})),this[bo]}get worldStrokeBounds(){return yo(this.strokeBounds,this.leaf.__world,this[Bo]||(this[Bo]={})),this[Bo]}get a(){return 1}get b(){return 0}get c(){return 0}get d(){return 1}get e(){return this.leaf.__.x}get f(){return this.leaf.__.y}get x(){return this.e+this.boxBounds.x}get y(){return this.f+this.boxBounds.y}get width(){return this.boxBounds.width}get height(){return this.boxBounds.height}constructor(t){this.leaf=t,this.leaf.__local&&(this._localRenderBounds=this._localStrokeBounds=this.leaf.__local),t.__world&&(this.boxBounds={x:0,y:0,width:0,height:0},this.boxChange(),this.matrixChange())}createLocal(){const t=this.leaf.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0};this._localStrokeBounds||(this._localStrokeBounds=t),this._localRenderBounds||(this._localRenderBounds=t)}update(){const{leaf:t}=this,{leafer:s}=t;if(t.isApp)return fo(t);if(s)s.ready?s.watcher.changed&&s.layouter.layout():s.start();else{let s=t;for(;s.parent&&!s.parent.leafer;)s=s.parent;const i=s;if(i.__fullLayouting)return;i.__fullLayouting=!0,e.layout(i),delete i.__fullLayouting}}getTransform(t="world"){this.update();const{leaf:e}=this;switch(t){case"world":return e.__world;case"local":return e.__localMatrix;case"inner":return V.defaultMatrix;case"page":t=e.zoomLayer;default:return go(e,t)}}getBounds(t,e="world"){switch(this.update(),e){case"world":return this.getWorldBounds(t);case"local":return this.getLocalBounds(t);case"inner":return this.getInnerBounds(t);case"page":e=this.leaf.zoomLayer;default:return new Ut(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",s){const{leaf:i}=this;let r,n,o,a=this.getInnerBounds(t);switch(e){case"world":r=i.getWorldPoint(a),n=i.__world;break;case"local":const{scaleX:t,scaleY:s,rotation:h,skewX:l,skewY:d}=i.__;o={scaleX:t,scaleY:s,rotation:h,skewX:l,skewY:d},r=i.getLocalPointByInner(a);break;case"inner":r=a,n=V.defaultMatrix;break;case"page":e=i.zoomLayer;default:r=i.getWorldPoint(a,e),n=go(i,e,!0)}if(o||(o=V.getLayout(n)),xo(o,a),st.copy(o,r),s){const{scaleX:t,scaleY:e}=o,s=Math.abs(t),i=Math.abs(e);1===s&&1===i||(o.scaleX/=s,o.scaleY/=i,o.width*=s,o.height*=i)}return o}getLayoutPoints(t,e="world"){const{leaf:s}=this,i=mo(this.getInnerBounds(t));let r;switch(e){case"world":r=null;break;case"local":r=s.parent;break;case"inner":break;case"page":e=s.zoomLayer;default:r=e}return n(r)||i.forEach(t=>s.innerToWorld(t,null,!1,r)),i}shrinkContent(){const{x:t,y:e,width:s,height:i}=this.boxBounds;this._contentBounds={x:t,y:e,width:s,height:i}}spreadStroke(){const{x:t,y:e,width:s,height:i}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:s,height:i},this._localStrokeBounds={x:t,y:e,width:s,height:i},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:s,height:i}=this.renderBounds;this._renderBounds={x:t,y:e,width:s,height:i},this._localRenderBounds={x:t,y:e,width:s,height:i}}shrinkContentCancel(){this._contentBounds=void 0}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this._strokeBounds=this.boxBounds,this._localStrokeBounds=this.leaf.__localBoxBounds,t&&this.spreadRenderCancel()}spreadRenderCancel(){this._renderBounds=this._strokeBounds,this._localRenderBounds=this._localStrokeBounds}boxChange(){this.boxChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange(),this.hitCanvasChanged=!0}localBoxChange(){this.localBoxChanged=!0,this.boundsChanged=!0}strokeChange(){this.strokeChanged=!0,this.strokeSpread||(this.strokeSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}renderChange(){this.renderChanged=!0,this.renderSpread||(this.renderSpread=1),this.boundsChanged=!0}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChange(),this.leaf.__local||this.createLocal()}matrixChange(){this.matrixChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=this.affectChildrenSort=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class So{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&e.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&e.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&e.event.stop(this.origin)}}class Ro extends So{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}Ro.ADD="child.add",Ro.REMOVE="child.remove",Ro.CREATED="created",Ro.MOUNTED="mounted",Ro.UNMOUNTED="unmounted",Ro.DESTROY="destroy";const Co="property.scroll";class To extends So{constructor(t,e,s,i,r){super(t,e),this.attrName=s,this.oldValue=i,this.newValue=r}}To.CHANGE="property.change",To.LEAFER_CHANGE="property.leafer_change",To.SCROLL=Co;const Po={scrollX:Co,scrollY:Co};class Lo extends So{constructor(t,e){super(t),Object.assign(this,e)}}Lo.LOAD="image.load",Lo.LOADED="image.loaded",Lo.ERROR="image.error";class Io extends So{static checkHas(t,e,s){"on"===s?e===Mo?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(Eo)||t.hasEvent(Oo)||t.hasEvent(Ao),t.__hasWorldEvent=t.hasEvent(Mo))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(Eo,t),"inner"===e&&t.emit(Oo,t)),t.emit(Ao,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(Mo,this)}}Io.RESIZE="bounds.resize",Io.INNER="bounds.inner",Io.LOCAL="bounds.local",Io.WORLD="bounds.world";const{RESIZE:Eo,INNER:Oo,LOCAL:Ao,WORLD:Mo}=Io,Wo={};[Eo,Oo,Ao,Mo].forEach(t=>Wo[t]=1);class Do extends So{get bigger(){if(!this.old)return!0;const{width:t,height:e}=this.old;return this.width>=t&&this.height>=e}get smaller(){return!this.bigger}get samePixelRatio(){return!this.old||this.pixelRatio===this.old.pixelRatio}constructor(t,e){u(t)?(super(Do.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!n(this.resizingKeys[t.innerId])}}Do.RESIZE="resize";class Fo extends So{constructor(t,e){super(t),this.data=e}}Fo.REQUEST="watch.request",Fo.DATA="watch.data";class zo extends So{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}zo.REQUEST="layout.request",zo.START="layout.start",zo.BEFORE="layout.before",zo.LAYOUT="layout",zo.AFTER="layout.after",zo.AGAIN="layout.again",zo.END="layout.end";class Uo extends So{constructor(t,e,s,i){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=i)}}Uo.REQUEST="render.request",Uo.CHILD_START="render.child_start",Uo.CHILD_END="render.child_end",Uo.START="render.start",Uo.BEFORE="render.before",Uo.RENDER="render",Uo.AFTER="render.after",Uo.AGAIN="render.again",Uo.END="render.end",Uo.NEXT="render.next";class No extends So{}No.START="leafer.start",No.BEFORE_READY="leafer.before_ready",No.READY="leafer.ready",No.AFTER_READY="leafer.after_ready",No.VIEW_READY="leafer.view_ready",No.VIEW_COMPLETED="leafer.view_completed",No.STOP="leafer.stop",No.RESTART="leafer.restart",No.END="leafer.end",No.UPDATE_MODE="leafer.update_mode",No.TRANSFORM="leafer.transform",No.MOVE="leafer.move",No.SCALE="leafer.scale",No.ROTATE="leafer.rotate",No.SKEW="leafer.skew";const{MOVE:Yo,SCALE:Xo,ROTATE:Ho,SKEW:Vo}=No,jo={x:Yo,y:Yo,scaleX:Xo,scaleY:Xo,rotation:Ho,skewX:Vo,skewY:Vo},Go={};class qo{set event(t){this.on(t)}on(t,e,s){if(!e){let e;if(c(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let s in t)c(e=t[s])?this.on(s,e[0],e[1]):this.on(s,e);return}let i,r,n;s&&("once"===s?r=!0:"boolean"==typeof s?i=s:(i=s.capture,r=s.once));const o=Qo(this,i,!0),h=a(t)?t.split(" "):t,l=r?{listener:e,once:r}:{listener:e};h.forEach(t=>{t&&(n=o[t],n?-1===n.findIndex(t=>t.listener===e)&&n.push(l):o[t]=[l],Wo[t]&&Io.checkHas(this,t,"on"))})}off(t,e,s){if(t){const i=a(t)?t.split(" "):t;if(e){let t,r,n;s&&(t="boolean"==typeof s?s:"once"!==s&&s.capture);const o=Qo(this,t);i.forEach(t=>{t&&(r=o[t],r&&(n=r.findIndex(t=>t.listener===e),n>-1&&r.splice(n,1),r.length||delete o[t],Wo[t]&&Io.checkHas(this,t,"off")))})}else{const{__bubbleMap:t,__captureMap:e}=this;i.forEach(s=>{t&&delete t[s],e&&delete e[s]})}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,s,i){return e?this.on(t,s?e=e.bind(s):e,i):c(t)&&t.forEach(t=>this.on(t[0],t[2]?t[1]=t[1].bind(t[2]):t[1],t[3])),{type:t,current:this,listener:e,options:i}}off_(t){if(!t)return;const e=c(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):c(t.type)&&t.type.forEach(e=>t.current.off(e[0],e[1],e[3])))}),e.length=0}once(t,e,s,i){if(!e)return c(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));u(s)?e=e.bind(s):i=s,this.on(t,e,{once:!0,capture:i})}emit(t,e,s){!e&&re.has(t)&&(e=re.get(t,{type:t,target:this,current:this}));const i=Qo(this,s)[t];if(i){let r;for(let n=0,o=i.length;n<o&&!((r=i[n])&&(r.listener(e),r.once&&(this.off(t,r.listener,s),n--,o--),e&&e.isStopNow));n++);}this.syncEventer&&this.syncEventer.emitEvent(e,s)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:s,__captureMap:i}=this,r=s&&s[t],o=i&&i[t];return!!(n(e)?r||o:e?o:r)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function Qo(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:Go)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:Go)}}const{on:Jo,on_:$o,off:Zo,off_:Ko,once:ta,emit:ea,emitEvent:sa,hasEvent:ia,destroy:ra}=qo.prototype,na={on:Jo,on_:$o,off:Zo,off_:Ko,once:ta,emit:ea,emitEvent:sa,hasEvent:ia,destroyEventer:ra},oa=Vt.get("setAttr"),aa={__setAttr(t,e,s){if(this.leaferIsCreated){const i=this.__.__getInput(t);if(!s||h(e)||n(e)||(oa.warn(this.innerName,t,e),e=void 0),u(e)||i!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new To(To.LEAFER_CHANGE,this,t,i,e));const s=jo[t];s&&(this.emitEvent(new No(s,this)),this.emitEvent(new No(No.TRANSFORM,this)))}this.emitPropertyEvent(To.CHANGE,t,i,e);const s=Po[t];return s&&this.emitPropertyEvent(s,t,i,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,s,i){const r=new To(t,this,e,s,i);this.isLeafer||this.hasEvent(t)&&this.emitEvent(r),this.leafer.emitEvent(r)},__realSetAttr(t,e){const s=this.__;s[t]=e,this.__proxyData&&this.setProxyAttr(t,e),s.normalStyle&&(this.lockNormalStyle||n(s.normalStyle[t])||(s.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:ha,multiplyParent:la,translateInner:da,defaultWorld:ca}=V,{toPoint:ua,tempPoint:_a}=ft,pa={__updateWorldMatrix(){const{parent:t,__layout:e,__world:s,__scrollWorld:i,__:r}=this;la(this.__local||e,t?t.__scrollWorld||t.__world:ca,s,!!e.affectScaleOrRotation,r),i&&da(Object.assign(i,s),r.scrollX,r.scrollY)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,s=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(ha(e,s,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=void 0),e.e=s.x+s.offsetX,e.f=s.y+s.offsetY,(s.around||s.origin)&&(ua(s.around||s.origin,t.boxBounds,_a),da(e,-_a.x,-_a.y,!s.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:ga,updateAllMatrix:fa}=$n,{updateBounds:ya}=lo,{toOuterOf:ma,copyAndSpread:xa,copy:wa}=Wt,{toBounds:va}=kr,ba={__updateWorldBounds(){const t=this.__layout;ma(t.renderBounds,this.__world,this.__world),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&Io.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&Io.emitWorld(this)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.resized="inner"),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=void 0,t.strokeSpread&&(t.strokeChanged=!0),t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.boxChange()),t.boxChanged=void 0,t.strokeChanged&&(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.strokeChanged=void 0,(t.renderSpread||t.strokeSpread!==t.strokeBoxSpread)&&(t.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),t.resized="inner"),t.renderChanged&&(t.renderSpread=this.__updateRenderSpread(),t.renderSpread?(t.renderBounds!==t.boxBounds&&t.renderBounds!==t.strokeBounds||t.spreadRender(),this.__updateRenderBounds(),this.__updateLocalRenderBounds()):t.spreadRenderCancel(),t.renderChanged=void 0,this.parent&&this.parent.__layout.renderChange()),t.resized||(t.resized="local"),t.boundsChanged=void 0},__updateLocalBoxBounds(){this.__hasMotionPath&&this.__updateMotionPath(),this.__hasAutoLayout&&this.__updateAutoLayout(),ma(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){ma(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){ma(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const s=this.__layout.boxBounds,i=this.__;i.__usePathBox?va(i.path,s):(s.x=0,s.y=0,s.width=i.width,s.height=i.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),fa(this),ya(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(fa(this),ya(this,this))):ga(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;xa(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:s}=e;l(s)&&s<=0?wa(e.renderBounds,e.strokeBounds):xa(e.renderBounds,e.boxBounds,s)}},Ba={__render(t,e){if(e.shape)return this.__renderShape(t,e);if(this.__worldOpacity){const s=this.__;if(s.bright&&!e.topRendering)return e.topList.add(this);if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.dimOpacity&&!s.dimskip?s.opacity*e.dimOpacity:s.opacity,this.__.__single){if("path"===s.eraser)return this.__renderEraser(t,e);const i=t.getSameCanvas(!0,!0);this.__draw(i,e,t),$n.copyCanvasByWorld(this,t,i,this.__nowWorld,s.__blendMode,!0),i.recycle(this.__nowWorld)}else this.__draw(t,e);Vt.showBounds&&Vt.drawBounds(this,t,e)}},__renderShape(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawShape(t,e))},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),t.clipUI(this))},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:ka}=no,Sa={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__nowWorld=this.__getNowWorld(e),this.__worldOpacity){const s=this.__;if(s.__useDim)if(s.dim)e.dimOpacity=!0===s.dim?.2:s.dim;else{if(s.bright&&!e.topRendering)return e.topList.add(this);s.dimskip&&e.dimOpacity&&(e.dimOpacity=0)}if(s.__single&&!this.isBranchLeaf){if("path"===s.eraser)return this.__renderEraser(t,e);const i=t.getSameCanvas(!1,!0);this.__renderBranch(i,e);const r=this.__nowWorld;t.opacity=e.dimOpacity?s.opacity*e.dimOpacity:s.opacity,t.copyWorldByReset(i,r,r,s.__blendMode,!0),i.recycle(r)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:s}=this;for(let i=0,r=s.length;i<r;i++)ka(s[i],e)||s[i].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:s}=this;for(let i=0,r=s.length;i<r;i++)ka(s[i],e)||s[i].__clip(t,e)}}},Ra={},{LEAF:Ca,create:Ta}=s,{stintSet:Pa}=p,{toInnerPoint:La,toOuterPoint:Ia,multiplyParent:Ea}=V,{toOuterOf:Oa}=Wt,{copy:Aa,move:Ma}=st,{moveLocal:Wa,zoomOfLocal:Da,rotateOfLocal:Fa,skewOfLocal:za,moveWorld:Ua,zoomOfWorld:Na,rotateOfWorld:Ya,skewOfWorld:Xa,transform:Ha,transformWorld:Va,setTransform:ja,getFlipTransform:Ga,getLocalOrigin:qa,getRelativeWorld:Qa,drop:Ja}=$n;t.Leaf=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return f}get __LayoutProcessor(){return ko}get leaferIsCreated(){return this.leafer&&this.leafer.created}get leaferIsReady(){return this.leafer&&this.leafer.ready}get isLeafer(){return!1}get isBranch(){return!1}get isBranchLeaf(){return!1}get __localMatrix(){return this.__local||this.__layout}get __localBoxBounds(){return this.__local||this.__layout}get worldTransform(){return this.__layout.getTransform("world")}get localTransform(){return this.__layout.getTransform("local")}get scrollWorldTransform(){return this.updateLayout(),this.__scrollWorld||this.__world}get boxBounds(){return this.getBounds("box","inner")}get renderBounds(){return this.getBounds("render","inner")}get worldBoxBounds(){return this.getBounds("box")}get worldStrokeBounds(){return this.getBounds("stroke")}get worldRenderBounds(){return this.getBounds("render")}get worldOpacity(){return this.updateLayout(),this.__worldOpacity}get __worldFlipped(){return this.__world.scaleX<0||this.__world.scaleY<0}get __onlyHitMask(){return this.__hasMask&&!this.__.hitChildren}get __ignoreHitWorld(){return(this.__hasMask||this.__hasEraser)&&this.__.hitChildren}get __inLazyBounds(){return this.leaferIsCreated&&this.leafer.lazyBounds.hit(this.__world)}get pathInputed(){return this.__.__pathInputed}set event(t){this.on(t)}constructor(t){this.innerId=Ta(Ca),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Ro.CREATED)}reset(t){this.leafer&&this.leafer.forceRender(this.__world),0!==t&&(this.__world={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0,scaleX:1,scaleY:1},null!==t&&(this.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0})),this.__worldOpacity=1,this.__=new this.__DataProcessor(this),this.__layout=new this.__LayoutProcessor(this),this.__level&&this.resetCustom(),t&&(t.__&&(t=t.toJSON()),t.children?this.set(t):Object.assign(this,t))}resetCustom(){this.__hasMask=this.__hasEraser=null,this.forceUpdate()}waitParent(t,e){e&&(t=t.bind(e)),this.parent?t():this.on(Ro.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Ro.MOUNTED,t,"once")}nextRender(t,e,s){this.leafer?this.leafer.nextRender(t,e,s):this.waitLeafer(()=>this.leafer.nextRender(t,e,s))}removeNextRender(t){this.nextRender(t,null,"off")}__bindLeafer(t){if(this.isLeafer&&null!==t&&(t=this),this.leafer&&!t&&this.leafer.leafs--,this.leafer=t,t?(t.leafs++,this.__level=this.parent?this.parent.__level+1:1,this.animation&&this.__runAnimation("in"),this.__bubbleMap&&this.__emitLifeEvent(Ro.MOUNTED)):this.__emitLifeEvent(Ro.UNMOUNTED),this.isBranch){const{children:e}=this;for(let s=0,i=e.length;s<i;s++)e[s].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){n(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=n(e)?null:void 0,this[t]=e}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(t,e){}__updateContentBounds(){}__updateStrokeBounds(t){}__updateRenderBounds(t){}__updateAutoLayout(){}__updateFlowLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some(t=>t.__.eraser)}__renderEraser(t,e){t.save(),this.__clip(t,e);const{renderBounds:s}=this.__layout;t.clearRect(s.x,s.y,s.width,s.height),t.restore()}__updateMask(t){this.__hasMask=this.children.some(t=>t.__.mask&&t.__.visible&&t.__.opacity)}__renderMask(t,e){}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld,s=this.__world;return Ea(s,t.matrix,e,void 0,s),Oa(this.__layout.renderBounds,e,e),Pa(e,"half",s.half),Pa(e,"ignorePixelSnap",s.ignorePixelSnap),e}return this.__world}getClampRenderScale(){let{scaleX:t}=this.__nowWorld||this.__world;return t<0&&(t=-t),t>1?t:1}getRenderScaleData(t,e){let{scaleX:s,scaleY:i}=Hr.patternLocked?this.__world:this.__nowWorld;return t&&(s<0&&(s=-s),i<0&&(i=-i)),(!0===e||"zoom-in"===e&&s>1&&i>1)&&(s=i=1),Ra.scaleX=s,Ra.scaleY=i,Ra}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,s){return this.__layout.getLayoutBounds(t,e,s)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,s){const i=e?Qa(this,e):this.worldTransform,r=s?t:{};return Oa(t,i,r),r}worldToLocal(t,e,s,i){this.parent?this.parent.worldToInner(t,e,s,i):e&&Aa(e,t)}localToWorld(t,e,s,i){this.parent?this.parent.innerToWorld(t,e,s,i):e&&Aa(e,t)}worldToInner(t,e,s,i){i&&(i.innerToWorld(t,e,s),t=e||t),La(this.scrollWorldTransform,t,e,s)}innerToWorld(t,e,s,i){Ia(this.scrollWorldTransform,t,e,s),i&&i.worldToInner(e||t,null,s)}getBoxPoint(t,e,s,i){return this.getBoxPointByInner(this.getInnerPoint(t,e,s,i),null,null,!0)}getBoxPointByInner(t,e,s,i){const r=i?t:Object.assign({},t),{x:n,y:o}=this.boxBounds;return Ma(r,-n,-o),r}getInnerPoint(t,e,s,i){const r=i?t:{};return this.worldToInner(t,r,s,e),r}getInnerPointByBox(t,e,s,i){const r=i?t:Object.assign({},t),{x:n,y:o}=this.boxBounds;return Ma(r,n,o),r}getInnerPointByLocal(t,e,s,i){return this.getInnerPoint(t,this.parent,s,i)}getLocalPoint(t,e,s,i){const r=i?t:{};return this.worldToLocal(t,r,s,e),r}getLocalPointByInner(t,e,s,i){return this.getWorldPoint(t,this.parent,s,i)}getPagePoint(t,e,s,i){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,s,i)}getWorldPoint(t,e,s,i){const r=i?t:{};return this.innerToWorld(t,r,s,e),r}getWorldPointByBox(t,e,s,i){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,i),e,s,!0)}getWorldPointByLocal(t,e,s,i){const r=i?t:{};return this.localToWorld(t,r,s,e),r}getWorldPointByPage(t,e,s,i){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,s,i)}setTransform(t,e,s){ja(this,t,e,s)}transform(t,e,s){Ha(this,t,e,s)}move(t,e,s){Wa(this,t,e,s)}moveInner(t,e,s){Ua(this,t,e,!0,s)}scaleOf(t,e,s,i,r){Da(this,qa(this,t),e,s,i,r)}rotateOf(t,e,s){Fa(this,qa(this,t),e,s)}skewOf(t,e,s,i,r){za(this,qa(this,t),e,s,i,r)}transformWorld(t,e,s){Va(this,t,e,s)}moveWorld(t,e,s){Ua(this,t,e,!1,s)}scaleOfWorld(t,e,s,i,r){Na(this,t,e,s,i,r)}rotateOfWorld(t,e){Ya(this,t,e)}skewOfWorld(t,e,s,i,r){Xa(this,t,e,s,i,r)}flip(t,e){Ha(this,Ga(this,t),!1,e)}scaleResize(t,e=t,s){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}hit(t,e){return!0}__hitWorld(t){return!0}__hit(t){return!0}__hitFill(t){return!0}__hitStroke(t,e){return!0}__hitPixel(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e,s){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return Zt.need("path")}getMotionPoint(t){return Zt.need("path")}getMotionTotal(){return 0}__updateMotionPath(){}__runAnimation(t,e){}__updateSortChildren(){}add(t,e){}remove(t,e){this.parent&&this.parent.remove(this,e)}dropTo(t,e,s){Ja(this,t,e,s)}on(t,e,s){}off(t,e,s){}on_(t,e,s,i){}off_(t){}once(t,e,s,i){}emit(t,e,s){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,s){s?this.addAttr(t,e,s):In(this.prototype,t,e)}static addAttr(t,e,s,i){s||(s=dn),s(e,i)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Ro(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Ro.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}},t.Leaf=ae([Fn(aa),Fn(pa),Fn(ba),Fn(na),Fn(Ba)],t.Leaf);const{setListWithFn:$a}=Wt,{sort:Za}=lo,{localBoxBounds:Ka,localStrokeBounds:th,localRenderBounds:eh,maskLocalBoxBounds:sh,maskLocalStrokeBounds:ih,maskLocalRenderBounds:rh}=no,nh=new Vt("Branch");t.Branch=class extends t.Leaf{__updateStrokeSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(t,e){$a(e||this.__layout.boxBounds,this.children,this.__hasMask?sh:Ka)}__updateStrokeBounds(t){$a(t||this.__layout.strokeBounds,this.children,this.__hasMask?ih:th)}__updateRenderBounds(t){$a(t||this.__layout.renderBounds,this.children,this.__hasMask?rh:eh)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let s=0,i=e.length;s<i;s++)e[s].__tempNumber=s,e[s].__.zIndex&&(t=!0);e.sort(Za),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return nh.warn("add self or destroyed");const s=n(e);if(!t.__){if(c(t))return t.forEach(t=>{this.add(t,e),s||e++});t=ee.get(t.tag,t)}t.parent&&t.parent.remove(t),t.parent=this,s?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const i=t.__layout;i.boxChanged||i.boxChange(),i.matrixChanged||i.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(Ro.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Ro.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){this.add(t)}remove(t,e){t?t.__?t.animationOut?t.__runAnimation("out",()=>this.__remove(t,e)):this.__remove(t,e):this.find(t).forEach(t=>this.remove(t,e)):n(t)&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach(e=>{this.__realRemoveChild(e),t&&e.destroy()}))}clear(){this.removeAll(!0)}__remove(t,e){const s=this.children.indexOf(t);s>-1&&(this.children.splice(s,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.__emitLifeEvent(Ro.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Ro.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const s=new Ro(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),this.leafer.emitEvent(s)}},t.Branch=ae([Fn(Sa)],t.Branch);class oh{get length(){return this.list.length}constructor(t){this.reset(),t&&(c(t)?this.addList(t):this.add(t))}has(t){return t&&!n(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return n(e)?-1:e}add(t){const{list:e,keys:s}=this;n(s[t.innerId])&&(e.push(t),s[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:s}=this;if(n(s[t.innerId])){const{list:i}=this;for(let t=e,r=i.length;t<r;t++)s[i[t].innerId]++;0===e?i.unshift(t):(e>i.length&&(e=i.length),i.splice(e,0,t)),s[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let s;for(let i=0,r=e.length;i<r;i++)n(s)?e[i].innerId===t.innerId&&(s=i,delete this.keys[t.innerId]):this.keys[e[i].innerId]=i-1;n(s)||e.splice(s,1)}sort(t){const{list:e}=this;t?e.sort((t,e)=>e.__level-t.__level):e.sort((t,e)=>t.__level-e.__level)}forEach(t){this.list.forEach(t)}clone(){const t=new oh;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let s=0,i=t.length;s<i;s++)e[t[s].innerId]=s}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class ah{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(c(t)?this.addList(t):this.add(t))}has(t){return!n(this.keys[t.innerId])}without(t){return n(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap:s}=this;e[t.innerId]||(e[t.innerId]=1,s[t.__level]?s[t.__level].push(t):(s[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(s=>{e=this.levelMap[s];for(let s=0,i=e.length;s<i;s++)t(e[s])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}const hh=Vt.get("LeaferCanvas");class lh extends be{set zIndex(t){const{style:e}=this.view;e.zIndex=t,this.setAbsolute(this.view)}set childIndex(t){const{view:e,parentView:s}=this;if(e&&s){const i=s.children[t];i?(this.setAbsolute(i),s.insertBefore(e,i)):s.appendChild(i)}}init(){const{config:t}=this,s=t.view||t.canvas;s?this.__createViewFrom(s):this.__createView();const{style:i}=this.view;if(i.display||(i.display="block"),this.parentView=this.view.parentElement,this.parentView){const t=this.parentView.style;t.webkitUserSelect=t.userSelect="none"}e.syncDomFont&&!this.parentView&&(i.display="none",document.body&&document.body.appendChild(this.view)),this.__createContext(),this.autoLayout||this.resize(t)}set backgroundColor(t){this.view.style.backgroundColor=t}get backgroundColor(){return this.view.style.backgroundColor}set hittable(t){this.view.style.pointerEvents=t?"auto":"none"}get hittable(){return"none"!==this.view.style.pointerEvents}__createView(){this.view=document.createElement("canvas")}__createViewFrom(t){let e=a(t)?document.getElementById(t):t;if(e)if(e instanceof HTMLCanvasElement)this.view=e;else{let t=e;if(e===window||e===document){const e=document.createElement("div"),{style:s}=e;s.position="absolute",s.top=s.bottom=s.left=s.right="0px",document.body.appendChild(e),t=e}this.__createView();const s=this.view;t.hasChildNodes()&&(this.setAbsolute(s),t.style.position||(t.style.position="relative")),t.appendChild(s)}else hh.error(`no id: ${t}`),this.__createView()}setAbsolute(t){const{style:e}=t;e.position="absolute",e.top=e.left="0px"}updateViewSize(){const{width:t,height:e,pixelRatio:s}=this,{style:i}=this.view;if(this.unreal){const{config:t,autoWidthStr:e,autoHeightStr:s}=this;t.width?(n(e)&&(this.autoWidthStr=i.width||""),i.width=t.width+"px"):n(e)||(i.width=e),t.height?(n(s)&&(this.autoHeightStr=i.height||""),i.height=t.height+"px"):n(s)||(i.height=s)}else i.width=t+"px",i.height=e+"px",this.view.width=Math.ceil(t*s),this.view.height=Math.ceil(e*s)}updateClientBounds(){this.view.parentElement&&(this.clientBounds=this.view.getBoundingClientRect())}startAutoLayout(t,e){if(this.resizeListener=e,t){if(this.autoBounds=t,this.resizeObserver)return;try{this.resizeObserver=new ResizeObserver(t=>{this.updateClientBounds();for(const e of t)this.checkAutoBounds(e.contentRect)});const t=this.parentView;t?(this.resizeObserver.observe(t),this.checkAutoBounds(t.getBoundingClientRect())):(this.checkAutoBounds(this.view),hh.warn("no parent"))}catch(t){this.imitateResizeObserver()}this.stopListenPixelRatio()}else this.listenPixelRatio(),this.unreal&&this.updateViewSize()}imitateResizeObserver(){this.autoLayout&&(this.parentView&&this.checkAutoBounds(this.parentView.getBoundingClientRect()),e.requestRender(this.imitateResizeObserver.bind(this)))}listenPixelRatio(){this.windowListener||window.addEventListener("resize",this.windowListener=()=>{const t=e.devicePixelRatio;if(!this.config.pixelRatio&&this.pixelRatio!==t){const{width:e,height:s}=this;this.emitResize({width:e,height:s,pixelRatio:t})}})}stopListenPixelRatio(){this.windowListener&&(window.removeEventListener("resize",this.windowListener),this.windowListener=null)}checkAutoBounds(t){const s=this.view,{x:i,y:r,width:n,height:o}=this.autoBounds.getBoundsFrom(t),a={width:n,height:o,pixelRatio:this.config.pixelRatio?this.pixelRatio:e.devicePixelRatio};if(!this.isSameSize(a)){const{style:t}=s;t.marginLeft=i+"px",t.marginTop=r+"px",this.emitResize(a)}}stopAutoLayout(){this.autoLayout=!1,this.resizeObserver&&this.resizeObserver.disconnect(),this.resizeListener=this.resizeObserver=null}emitResize(t){const e={};p.copyAttrs(e,this,ve),this.resize(t),this.resizeListener&&!n(this.width)&&this.resizeListener(new Do(t,e))}unrealCanvas(){if(!this.unreal&&this.parentView){const t=this.view;t&&t.remove(),this.view=this.parentView,this.unreal=!0}}destroy(){if(this.view){if(this.stopAutoLayout(),this.stopListenPixelRatio(),!this.unreal){const t=this.view;t.parentElement&&t.remove()}super.destroy()}}}Mr(CanvasRenderingContext2D.prototype),Mr(Path2D.prototype);const{mineType:dh,fileType:ch}=Wr;function uh(t,s){e.origin={createCanvas(t,e){const s=document.createElement("canvas");return s.width=t,s.height=e,s},canvasToDataURL:(t,e,s)=>{const i=dh(e),r=t.toDataURL(i,s);return"image/bmp"===i?r.replace("image/png;","image/bmp;"):r},canvasToBolb:(t,e,s)=>new Promise(i=>t.toBlob(i,dh(e),s)),canvasSaveAs:(t,s,i)=>{const r=t.toDataURL(dh(ch(s)),i);return e.origin.download(r,s)},download:(t,e)=>new Promise(s=>{let i=document.createElement("a");i.href=t,i.download=e,document.body.appendChild(i),i.click(),document.body.removeChild(i),s()}),loadImage:t=>new Promise((s,i)=>{const r=new e.origin.Image,{crossOrigin:n}=e.image;n&&(r.setAttribute("crossOrigin",n),r.crossOrigin=n),r.onload=()=>{s(r)},r.onerror=t=>{i(t)},r.src=e.image.getRealURL(t)}),Image:Image,PointerEvent:PointerEvent,DragEvent:DragEvent},e.event={stopDefault(t){t.preventDefault()},stopNow(t){t.stopImmediatePropagation()},stop(t){t.stopPropagation()}},e.canvas=Kt.canvas(),e.conicGradientSupport=!!e.canvas.context.createConicGradient}Object.assign(Kt,{canvas:(t,e)=>new lh(t,e),image:t=>new Jr(t)}),e.name="web",e.isMobile="ontouchstart"in window,e.requestRender=function(t){window.requestAnimationFrame(t)},$r(e,"devicePixelRatio",{get:()=>devicePixelRatio});const{userAgent:_h}=navigator;_h.indexOf("Firefox")>-1?(e.conicGradientRotate90=!0,e.intWheelDeltaY=!0,e.syncDomFont=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(e.fullImageShadow=!0),_h.indexOf("Windows")>-1?(e.os="Windows",e.intWheelDeltaY=!0):_h.indexOf("Mac")>-1?e.os="Mac":_h.indexOf("Linux")>-1&&(e.os="Linux");class ph{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new oh;return this.__updatedList.list.forEach(e=>{e.leafer&&t.add(e)}),t}return this.__updatedList}constructor(t,e){this.totalTimes=0,this.config={},this.__updatedList=new oh,this.target=t,e&&(this.config=p.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(Uo.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===Ro.ADD?(this.hasAdd=!0,this.__pushChild(t.child)):(this.hasRemove=!0,this.__updatedList.add(t.parent)),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new Fo(Fo.DATA,{updatedList:this.updatedList})),this.__updatedList=new oh,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[To.CHANGE,this.__onAttrChange,this],[[Ro.ADD,Ro.REMOVE],this.__onChildEvent,this],[Fo.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:gh,updateBounds:fh,updateChange:yh}=$n,{pushAllChildBranch:mh,pushAllParent:xh}=lo;const{worldBounds:wh}=no;class vh{constructor(t){this.updatedBounds=new Ut,this.beforeBounds=new Ut,this.afterBounds=new Ut,c(t)&&(t=new oh(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,wh)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,wh),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:bh,updateAllChange:Bh}=$n,kh=Vt.get("Layouter");class Sh{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new ah,this.target=t,e&&(this.config=p.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target:t}=this;this.times=0;try{t.emit(zo.START),this.layoutOnce(),t.emitEvent(new zo(zo.END,this.layoutedBlocks,this.times))}catch(t){kh.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?kh.warn("layouting"):this.times>3?kh.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(Fo.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=Qt.start("PartLayout"),{target:s,__updatedList:i}=this,{BEFORE:r,LAYOUT:n,AFTER:o}=zo,a=this.getBlocks(i);a.forEach(t=>t.setBefore()),s.emitEvent(new zo(r,a,this.times)),this.extraBlock=null,i.sort(),function(t,e){let s;t.list.forEach(t=>{s=t.__layout,e.without(t)&&!s.proxyZoom&&(s.matrixChanged?(gh(t,!0),e.add(t),t.isBranch&&mh(t,e),xh(t,e)):s.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),xh(t,e)))})}(i,this.__levelList),function(t){let e,s,i;t.sort(!0),t.levels.forEach(r=>{e=t.levelMap[r];for(let t=0,r=e.length;t<r;t++){if(s=e[t],s.isBranch&&s.__tempNumber){i=s.children;for(let t=0,e=i.length;t<e;t++)i[t].isBranch||fh(i[t])}fh(s)}})}(this.__levelList),function(t){t.list.forEach(yh)}(i),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),s.emitEvent(new zo(n,a,this.times)),s.emitEvent(new zo(o,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,Qt.end(e)}fullLayout(){const t=Qt.start("FullLayout"),{target:e}=this,{BEFORE:s,LAYOUT:i,AFTER:r}=zo,n=this.getBlocks(new oh(e));e.emitEvent(new zo(s,n,this.times)),Sh.fullLayout(e),n.forEach(t=>{t.setAfter()}),e.emitEvent(new zo(i,n,this.times)),e.emitEvent(new zo(r,n,this.times)),this.addBlocks(n),Qt.end(t)}static fullLayout(t){bh(t,!0),t.isBranch?lo.updateBounds(t):$n.updateBounds(t),Bh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:s}=this.extraBlock||(this.extraBlock=new vh([]));e.length?s.add(t.__world):s.set(t.__world),e.add(t)}}createBlock(t){return new vh(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){this.__eventIds=[this.target.on_([[zo.REQUEST,this.layout,this],[zo.AGAIN,this.layoutAgain,this],[Fo.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Rh=Vt.get("Renderer");class Ch{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,s){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,s&&(this.config=p.default(s,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.__requestRender()}requestLayout(){this.target.emit(zo.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(Uo.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(Uo.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(Uo.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new Ut,Rh.log(e.innerName,"---\x3e");try{this.emitRender(Uo.START),this.renderOnce(t),this.emitRender(Uo.END,this.totalBounds),Hr.clearRecycled()}catch(t){this.rendering=!1,Rh.error(t)}Rh.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Rh.warn("rendering");if(this.times>3)return Rh.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Ut,this.renderOptions={},t)this.emitRender(Uo.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(Uo.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(Uo.RENDER,this.renderBounds,this.renderOptions),this.emitRender(Uo.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;e&&(this.mergeBlocks(),e.forEach(e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=Qt.start("PartRender"),{canvas:s}=this,i=t.getIntersect(s.bounds),r=new Ut(i);s.save(),i.spread(Ch.clipSpread).ceil(),s.clearWorld(i),s.clipWorld(i),this.__render(i,r),s.restore(),Qt.end(e)}fullRender(){const t=Qt.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),Qt.end(t)}__render(t,s){const{canvas:i}=this,r=t.includes(this.target.__world),n=r?{includes:r}:{bounds:t,includes:r};this.needFill&&i.fillWorld(t,this.config.fill),Vt.showRepaint&&Vt.drawRepaint(i,t),e.render(this.target,i,n),this.renderBounds=s=s||t,this.renderOptions=n,this.totalBounds.isEmpty()?this.totalBounds=s:this.totalBounds.add(s),i.updateRender(s)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new Ut;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const s=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:i}=this.config;if(i&&t>i)return e.requestRender(s);const{frames:r}=this;r.length>30&&r.shift(),r.push(t),this.FPS=Math.round(r.reduce((t,e)=>t+e,0)/r.length),this.requestTime=0,this.checkRender()};e.requestRender(s)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:s}=t.old;if(!new Ut(0,0,e,s).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new Ut(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;t.updatedList&&t.updatedList.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||Rh.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,e,s){this.target.emitEvent(new Uo(t,this.times,e,s))}__listenEvents(){this.__eventIds=[this.target.on_([[Uo.REQUEST,this.update,this],[zo.END,this.__onLayoutEnd,this],[Uo.AGAIN,this.renderAgain,this],[Do.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}function Th(t){return tn(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Ph(t){return tn(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Lh(){return(t,e)=>{const s="_"+e;$r(t,e,{set(t){this.isLeafer&&(this[s]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[s]||this:this.leafer&&this.leafer.zoomLayer}})}}Ch.clipSpread=10,Object.assign(Kt,{watcher:(t,e)=>new ph(t,e),layouter:(t,e)=>new Sh(t,e),renderer:(t,e,s)=>new Ch(t,e,s),selector:(t,e)=>{},interaction:(t,e,s,i)=>{}}),e.layout=Sh.fullLayout,e.render=function(t,e,s){const i=Object.assign(Object.assign({},s),{topRendering:!0});s.topList=new oh,t.__render(e,s),s.topList.length&&s.topList.forEach(t=>t.__render(e,i))};const Ih={},Eh={hasTransparent:function(t){if(!t||7===t.length||4===t.length)return!1;if("transparent"===t)return!0;const e=t[0];if("#"===e)switch(t.length){case 5:return"f"!==t[4]&&"F"!==t[4];case 9:return"f"!==t[7]&&"F"!==t[7]||"f"!==t[8]&&"F"!==t[8]}else if(("r"===e||"h"===e)&&"a"===t[3]){const e=t.lastIndexOf(",");if(e>-1)return parseFloat(t.slice(e+1))<1}return!1}},Oh={number:(t,e)=>u(t)?"percent"===t.type?t.value*e:t.value:t},Ah={},Mh={},Wh={},Dh={},Fh={},zh={apply(){Zt.need("filter")}},Uh={},Nh={setStyleName:()=>Zt.need("state"),set:()=>Zt.need("state")},Yh={list:{},register(t,e){Yh.list[t]=e},get:t=>Yh.list[t]},{parse:Xh,objectToCanvasData:Hh}=Vs,{stintSet:Vh}=p,{hasTransparent:jh}=Eh,Gh={},qh=Vt.get("UIData");class Qh extends f{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){return this.__getRealStrokeWidth()}get __maxStrokeWidth(){const t=this;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,t.strokeWidth):t.strokeWidth}get __hasMultiPaint(){const t=this;return t.fill&&this.__useStroke||t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return!this._width}get __autoHeight(){return!this._height}get __autoSide(){return!this._width||!this._height}get __autoSize(){return!this._width&&!this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,qh.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,qh.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),a(t)||!t?(Vh(this,"__isTransparentFill",jh(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):u(t)&&this.__setPaint("fill",t)}setStroke(t){a(t)||!t?(Vh(this,"__isTransparentStroke",jh(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):u(t)&&this.__setPaint("stroke",t)}setPath(t){const e=a(t);e||t&&u(t[0])?(this.__setInput("path",t),this._path=e?Xh(t):Hh(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){Jh(this,"shadow",t)}setInnerShadow(t){Jh(this,"innerShadow",t)}setFilter(t){Jh(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Mh.compute("fill",this.__leaf),e&&Mh.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:s}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),n(t.strokeWidthFixed)||(s=t.strokeWidthFixed)),s){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const s=this.__leaf.__layout;s.boxChanged||s.boxChange(),c(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=Gh)):(this.__isStrokes=!0,this._stroke||(this._stroke=Gh))}__removePaint(t,e){e&&this.__removeInput(t),Wh.recycleImage(t,this),"fill"===t?(Vh(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(Vh(this,"__isAlphaPixelStroke",void 0),Vh(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function Jh(t,e,s){t.__setInput(e,s),c(s)?(s.some(t=>!1===t.visible)&&(s=s.filter(t=>!1!==t.visible)),s.length||(s=void 0)):s=s&&!1!==s.visible?[s]:void 0,t["_"+e]=s}class $h extends Qh{}class Zh extends $h{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){return this.__single||this.__clipAfterFill}get __clipAfterFill(){const t=this;return"show"!==t.overflow&&t.__leaf.children.length&&(t.__leaf.isOverflow||super.__clipAfterFill)}}class Kh extends $h{__getInputData(t,e){const s=super.__getInputData(t,e);return ve.forEach(t=>delete s[t]),s}}class tl extends Zh{}class el extends Qh{get __usePathBox(){return this.points||this.__pathInputed}}class sl extends Qh{get __boxStroke(){return!this.__pathInputed}}class il extends Qh{get __boxStroke(){return!this.__pathInputed}}class rl extends el{}class nl extends Qh{}class ol extends Qh{get __pathInputed(){return 2}}class al extends $h{}const hl={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class ll extends Qh{get __useNaturalRatio(){return!1}setFontWeight(t){a(t)?(this.__setInput("fontWeight",t),t=hl[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,s=e.__box;if(t){const{boxStyle:i}=this;if(s)for(let t in i)s[t]=void 0;else s=e.__box=ee.get("Rect",0);const r=e.__layout,n=s.__layout;i||(s.parent=e,s.__world=e.__world,n.boxBounds=r.boxBounds),s.set(t),n.strokeChanged&&r.strokeChange()}else s&&(e.__box=s.parent=null,s.destroy());this._boxStyle=t}}class dl extends sl{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:"image",mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return delete t.fill,t}__getInputData(t,e){const s=super.__getInputData(t,e);return delete s.fill,s}}class cl extends sl{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const s=super.__getInputData(t,e);return s.url=this.__leaf.canvas.toDataURL("image/png"),s}}const{max:ul,add:_l}=b,pl={__updateStrokeSpread(){let t=0,e=0;const s=this.__,{strokeAlign:i,__maxStrokeWidth:r}=s,n=this.__box;if((s.stroke||"all"===s.hitStroke)&&r&&"inside"!==i&&(e=t="center"===i?r/2:r,!s.__boxStroke)){const e=s.__isLinePath?0:10*t,i="none"===s.strokeCap?0:r;t+=Math.max(e,i)}return s.__useArrow&&(t+=5*r),n&&(t=ul(t,n.__layout.strokeSpread=n.__updateStrokeSpread()),e=Math.max(e,n.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:s,blur:i,backgroundBlur:r,filter:n,renderSpread:o}=this.__,{strokeSpread:a}=this.__layout,h=this.__box;e&&(t=Fh.getShadowRenderSpread(this,e)),i&&(t=ul(t,i)),n&&(t=_l(t,zh.getSpread(n))),o&&(t=_l(t,o)),a&&(t=_l(t,a));let l=t;return s&&(l=ul(l,Fh.getInnerShadowSpread(this,s))),r&&(l=ul(l,r)),this.__layout.renderShapeSpread=l,h?ul(h.__updateRenderSpread(),t):t}},{float:gl}=L,fl=new Ut,yl=new Ut,ml=new Ut,xl={limitMove(t,e){const{dragBounds:s,dragBoundsType:i}=t;s&&wl.getValidMove(t.__localBoxBounds,wl.getDragBounds(t),i,e,!0),wl.axisMove(t,e)},limitScaleOf(t,e,s){const{dragBounds:i,dragBoundsType:r}=t;i&&wl.getValidScaleOf(t.__localBoxBounds,wl.getDragBounds(t),r,t.getLocalPointByInner(t.getInnerPointByBox(e)),s,!0)},axisMove(t,e){const{draggable:s}=t;"x"===s&&(e.y=0),"y"===s&&(e.x=0)},getDragBounds(t){const{dragBounds:e}=t;return"parent"===e?t.parent.boxBounds:e},isInnerMode:(t,e,s,i)=>"inner"===s||"auto"===s&&t[i]>e[i],getValidMove(t,e,s,i,r){const n=t.x+i.x,o=t.y+i.y,a=n+t.width,h=o+t.height,l=e.x+e.width,d=e.y+e.height;return r||(i=Object.assign({},i)),wl.isInnerMode(t,e,s,"width")?n>e.x?i.x+=e.x-n:a<l&&(i.x+=l-a):n<e.x?i.x+=e.x-n:a>l&&(i.x+=l-a),wl.isInnerMode(t,e,s,"height")?o>e.y?i.y+=e.y-o:h<d&&(i.y+=d-h):o<e.y?i.y+=e.y-o:h>d&&(i.y+=d-h),i.x=gl(i.x),i.y=gl(i.y),i},getValidScaleOf(t,e,s,i,r,n){let o,a;return n||(r=Object.assign({},r)),fl.set(t).scaleOf(i,r.x,r.y).unsign(),yl.set(fl).add(e),ml.set(fl).intersect(e),o=wl.isInnerMode(t,e,s,"width")?yl.width/fl.width:ml.width/fl.width,a=wl.isInnerMode(t,e,s,"height")?yl.height/fl.height:ml.height/fl.height,r.x=gl(ml.width)?r.x*o:1,r.y=gl(ml.height)?r.y*a:1,r}},wl=xl,{stintSet:vl}=p,bl={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);vl(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),vl(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:s,stroke:i}=t,r=t.innerShadow||t.blur||t.backgroundBlur||t.filter;vl(t,"__isFastShadow",e&&!r&&e.length<2&&!e[0].spread&&!Fh.isTransformShadow(e[0])&&s&&!t.__isTransparentFill&&!(c(s)&&s.length>1)&&(this.useFastShadow||!i||i&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!r)}t.__checkSingle(),vl(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){Bl(this,t,e)},__draw(t,e,s){const i=this.__;if(i.__complex){i.__needComputePaint&&i.__computePaint();const{fill:r,stroke:n,__drawAfterFill:o,__fillAfterStroke:a,__isFastShadow:h}=i;if(this.__drawRenderPath(t),i.__useEffect&&!h){const h=Mh.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=i;l&&Fh.shadow(this,t,h),a&&(i.__isStrokes?Mh.strokes(n,this,t):Mh.stroke(n,this,t)),r&&(i.__isFills?Mh.fills(r,this,t):Mh.fill(r,this,t)),o&&this.__drawAfterFill(t,e),d&&Fh.innerShadow(this,t,h),n&&!a&&(i.__isStrokes?Mh.strokes(n,this,t):Mh.stroke(n,this,t)),c&&zh.apply(c,this,this.__nowWorld,t,s,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(i.__isStrokes?Mh.strokes(n,this,t):Mh.stroke(n,this,t)),h){const e=i.shadow[0],{scaleX:s,scaleY:r}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*s,e.y*r,e.blur*s,Eh.string(e.color))}r&&(i.__isFills?Mh.fills(r,this,t):Mh.fill(r,this,t)),h&&t.restore(),o&&this.__drawAfterFill(t,e),n&&!a&&(i.__isStrokes?Mh.strokes(n,this,t):Mh.stroke(n,this,t))}}else i.__pathInputed?Bl(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const s=this.__,{fill:i,stroke:r}=s;i&&!e.ignoreFill&&(s.__isAlphaPixelFill?Mh.fills(i,this,t):Mh.fill("#000000",this,t)),s.__isCanvas&&this.__drawAfterFill(t,e),r&&!e.ignoreStroke&&(s.__isAlphaPixelStroke?Mh.strokes(r,this,t):Mh.stroke("#000000",this,t))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function Bl(t,e,s){const{fill:i,stroke:r,__drawAfterFill:n,__fillAfterStroke:o}=t.__;t.__drawRenderPath(e),o&&Mh.stroke(r,t,e),i&&Mh.fill(i,t,e),n&&t.__drawAfterFill(e,s),r&&!o&&Mh.stroke(r,t,e)}const kl={__drawFast(t,e){let{x:s,y:i,width:r,height:n}=this.__layout.boxBounds;const{fill:o,stroke:a,__drawAfterFill:h}=this.__;if(o&&(t.fillStyle=o,t.fillRect(s,i,r,n)),h&&this.__drawAfterFill(t,e),a){const{strokeAlign:o,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(a,h,this.__);const l=h/2;switch(o){case"center":t.strokeRect(0,0,r,n);break;case"inside":r-=h,n-=h,r<0||n<0?(t.save(),this.__clip(t,e),t.strokeRect(s+l,i+l,r,n),t.restore()):t.strokeRect(s+l,i+l,r,n);break;case"outside":t.strokeRect(s-l,i-l,r+h,n+h)}}}};var Sl,Rl;t.UI=Sl=class extends t.Leaf{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){L.assignScale(this,t)}get scale(){return this.__.scale}get isAutoWidth(){const t=this.__;return t.__autoWidth||t.autoWidth}get isAutoHeight(){const t=this.__;return t.__autoHeight||t.autoHeight}get pen(){const{path:t}=this.__;return Or.set(this.path=t||[]),t||this.__drawPathByBox(Or),Or}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return a(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return Zt.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return Zt.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let s=e?this.__.__pathForRender:this.__.path;return s||(Or.set(s=[]),this.__drawPathByBox(Or)),t?Vs.toCanvasData(s,!0):s}getPathString(t,e,s){return Vs.stringify(this.getPath(t,e),s)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||Uh.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?Ir.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&Ah.addArrows(this)):t.__pathForRender&&(t.__pathForRender=void 0)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){e?ji.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:s,width:i,height:r}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:n}=this.__;t.roundRect(e,s,i,r,l(n)?[n]:n)}else t.rect(e,s,i,r)}drawImagePlaceholder(t,e){Mh.fill(this.__.placeholderColor,this,t)}animate(t,e,s,i){return this.set(t),Zt.need("animate")}killAnimate(t,e){}export(t,e){return Zt.need("export")}syncExport(t,e){return Zt.need("export")}clone(t){const e=p.clone(this.toJSON());return t&&Object.assign(e,t),Sl.one(e)}static one(t,e,s,i,r){return ee.get(t.tag||this.prototype.__tag,t,e,s,i,r)}static registerUI(){zn()(this)}static registerData(t){Ln(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}},ae([Ln(Qh)],t.UI.prototype,"__",void 0),ae([Lh()],t.UI.prototype,"zoomLayer",void 0),ae([rn("")],t.UI.prototype,"id",void 0),ae([rn("")],t.UI.prototype,"name",void 0),ae([rn("")],t.UI.prototype,"className",void 0),ae([xn("pass-through")],t.UI.prototype,"blendMode",void 0),ae([vn(1)],t.UI.prototype,"opacity",void 0),ae([bn(!0)],t.UI.prototype,"visible",void 0),ae([xn(!1)],t.UI.prototype,"locked",void 0),ae([wn(!1)],t.UI.prototype,"dim",void 0),ae([wn(!1)],t.UI.prototype,"dimskip",void 0),ae([Sn(0)],t.UI.prototype,"zIndex",void 0),ae([Rn(!1)],t.UI.prototype,"mask",void 0),ae([Cn(!1)],t.UI.prototype,"eraser",void 0),ae([nn(0,!0)],t.UI.prototype,"x",void 0),ae([nn(0,!0)],t.UI.prototype,"y",void 0),ae([dn(100,!0)],t.UI.prototype,"width",void 0),ae([dn(100,!0)],t.UI.prototype,"height",void 0),ae([hn(1,!0)],t.UI.prototype,"scaleX",void 0),ae([hn(1,!0)],t.UI.prototype,"scaleY",void 0),ae([ln(0,!0)],t.UI.prototype,"rotation",void 0),ae([ln(0,!0)],t.UI.prototype,"skewX",void 0),ae([ln(0,!0)],t.UI.prototype,"skewY",void 0),ae([nn(0,!0)],t.UI.prototype,"offsetX",void 0),ae([nn(0,!0)],t.UI.prototype,"offsetY",void 0),ae([on(0,!0)],t.UI.prototype,"scrollX",void 0),ae([on(0,!0)],t.UI.prototype,"scrollY",void 0),ae([an()],t.UI.prototype,"origin",void 0),ae([an()],t.UI.prototype,"around",void 0),ae([rn(!1)],t.UI.prototype,"lazy",void 0),ae([cn(1)],t.UI.prototype,"pixelRatio",void 0),ae([mn(0)],t.UI.prototype,"renderSpread",void 0),ae([_n()],t.UI.prototype,"path",void 0),ae([pn()],t.UI.prototype,"windingRule",void 0),ae([pn(!0)],t.UI.prototype,"closed",void 0),ae([dn(0)],t.UI.prototype,"padding",void 0),ae([dn(!1)],t.UI.prototype,"lockRatio",void 0),ae([dn()],t.UI.prototype,"widthRange",void 0),ae([dn()],t.UI.prototype,"heightRange",void 0),ae([rn(!1)],t.UI.prototype,"draggable",void 0),ae([rn()],t.UI.prototype,"dragBounds",void 0),ae([rn("auto")],t.UI.prototype,"dragBoundsType",void 0),ae([rn(!1)],t.UI.prototype,"editable",void 0),ae([Tn(!0)],t.UI.prototype,"hittable",void 0),ae([Tn("path")],t.UI.prototype,"hitFill",void 0),ae([yn("path")],t.UI.prototype,"hitStroke",void 0),ae([Tn(!1)],t.UI.prototype,"hitBox",void 0),ae([Tn(!0)],t.UI.prototype,"hitChildren",void 0),ae([Tn(!0)],t.UI.prototype,"hitSelf",void 0),ae([Tn()],t.UI.prototype,"hitRadius",void 0),ae([Pn("")],t.UI.prototype,"cursor",void 0),ae([xn()],t.UI.prototype,"fill",void 0),ae([yn(void 0,!0)],t.UI.prototype,"stroke",void 0),ae([yn("inside")],t.UI.prototype,"strokeAlign",void 0),ae([yn(1,!0)],t.UI.prototype,"strokeWidth",void 0),ae([yn(!1)],t.UI.prototype,"strokeWidthFixed",void 0),ae([yn("none")],t.UI.prototype,"strokeCap",void 0),ae([yn("miter")],t.UI.prototype,"strokeJoin",void 0),ae([yn()],t.UI.prototype,"dashPattern",void 0),ae([yn(0)],t.UI.prototype,"dashOffset",void 0),ae([yn(10)],t.UI.prototype,"miterLimit",void 0),ae([pn(0)],t.UI.prototype,"cornerRadius",void 0),ae([pn()],t.UI.prototype,"cornerSmoothing",void 0),ae([Th()],t.UI.prototype,"shadow",void 0),ae([Th()],t.UI.prototype,"innerShadow",void 0),ae([Th()],t.UI.prototype,"blur",void 0),ae([Th()],t.UI.prototype,"backgroundBlur",void 0),ae([Th()],t.UI.prototype,"grayscale",void 0),ae([Th()],t.UI.prototype,"filter",void 0),ae([xn()],t.UI.prototype,"placeholderColor",void 0),ae([rn(100)],t.UI.prototype,"placeholderDelay",void 0),ae([rn({})],t.UI.prototype,"data",void 0),ae([Mn(t.Leaf.prototype.reset)],t.UI.prototype,"reset",null),t.UI=Sl=ae([Fn(pl),Fn(bl),Wn()],t.UI),t.Group=class extends t.UI{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:s}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),s.forEach(t=>this.add(t)),t.children=s}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return this.childlessJSON||(e.children=this.children.map(e=>e.toJSON(t))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}},ae([Ln($h)],t.Group.prototype,"__",void 0),ae([dn(0)],t.Group.prototype,"width",void 0),ae([dn(0)],t.Group.prototype,"height",void 0),t.Group=ae([Fn(t.Branch),zn()],t.Group);const Cl=Vt.get("Leafer");t.Leafer=Rl=class extends t.Group{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&Yr.isComplete}get layoutLocked(){return!this.layouter.running}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||{x:0,y:0,width:0,height:0}}constructor(t,e){super(e),this.config={start:!0,hittable:!0,smooth:!0,lazySpeard:100},this.leafs=0,this.__eventIds=[],this.__controllers=[],this.__readyWait=[],this.__viewReadyWait=[],this.__viewCompletedWait=[],this.__nextRenderWait=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t),Rl.list.add(this)}init(t,e){if(this.canvas)return;let s;const{config:i}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),s=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,p.assign(i,t));const r=this.canvas=Kt.canvas(i);this.__controllers.push(this.renderer=Kt.renderer(this,r,i),this.watcher=Kt.watcher(this,i),this.layouter=Kt.layouter(this,i)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),this.view=r.view,e||(this.selector=Kt.selector(this),this.interaction=Kt.interaction(this,r,this.selector,i),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=Kt.hitCanvasManager()),this.canvasManager=new oe,s=i.start),this.hittable=i.hittable,this.fill=i.fill,this.canvasManager.add(r),this.__listenEvents(),s&&(this.__startTimer=setTimeout(this.start.bind(this))),po.run(this.__initWait),this.onInit()}onInit(){}initType(t){}set(t,e){this.waitInit(()=>{super.set(t,e)})}start(){clearTimeout(this.__startTimer),!this.running&&this.canvas&&(this.running=!0,this.ready?this.emitLeafer(No.RESTART):this.emitLeafer(No.START),this.__controllers.forEach(t=>t.start()),this.isApp||this.renderer.render())}stop(){clearTimeout(this.__startTimer),this.running&&this.canvas&&(this.__controllers.forEach(t=>t.stop()),this.running=!1,this.emitLeafer(No.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=p.copyAttrs({},t,ve);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:s}=this;s&&(s.addBlock(t?new Ut(t):this.canvas.bounds),this.viewReady&&(e?s.render():s.update()))}requestRender(t=!1){this.renderer&&this.renderer.update(t)}updateCursor(t){const e=this.interaction;e&&(t?e.setCursor(t):e.updateCursor())}updateLazyBounds(){this.lazyBounds=this.canvas.bounds.clone().spread(this.config.lazySpeard)}__doResize(t){const{canvas:e}=this;if(!e||e.isSameSize(t))return;const s=p.copyAttrs({},this.canvas,ve);e.resize(t),this.updateLazyBounds(),this.__onResize(new Do(t,s))}__onResize(t){this.emitEvent(t),p.copyAttrs(this.__,t,ve),setTimeout(()=>{this.canvasManager&&this.canvasManager.clearRecycled()},0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager}__setLeafer(t){this.leafer=t,this.__level=1}__checkAutoLayout(){const{config:t,parentApp:e}=this;e||(t.width&&t.height||(this.autoLayout=new Yt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(ve.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t?this.parent||(this.canvas.hittable=e):"zIndex"===t?(this.canvas.zIndex=e,setTimeout(()=>this.parent&&this.parent.__updateSortChildren())):"mode"===t&&this.emit(No.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&ve.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:s,canvas:i}=this,r=p.copyAttrs({},i,ve);r[t]=s[t]=e,s.width&&s.height?i.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(r)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.backgroundColor=t:this.forceRender()}__onCreated(){this.created=!0}__onReady(){this.ready=!0,this.emitLeafer(No.BEFORE_READY),this.emitLeafer(No.READY),this.emitLeafer(No.AFTER_READY),po.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(No.VIEW_READY),po.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:s}=this.config;if(t){let{width:i,height:r,pixelRatio:n}=this;const o="box"===t?this.worldBoxBounds:this.__world;e||(i=Math.max(1,o.x+o.width)),s||(r=Math.max(1,o.y+o.height)),this.__doResize({width:i,height:r,pixelRatio:n})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){po.run(this.__nextRenderWait);const{imageReady:t}=this;t&&!this.viewCompleted&&this.__checkViewCompleted(),t||(this.viewCompleted=!1,this.requestRender())}else this.requestRender()}__checkViewCompleted(t=!0){this.nextRender(()=>{this.imageReady&&(t&&this.emitLeafer(No.VIEW_COMPLETED),po.run(this.__viewCompletedWait),this.viewCompleted=!0)})}__onWatchData(){this.watcher.childrenChanged&&this.interaction&&this.nextRender(()=>this.interaction.updateCursor())}waitInit(t,e){e&&(t=t.bind(e)),this.__initWait||(this.__initWait=[]),this.canvas?t():this.__initWait.push(t)}waitReady(t,e){e&&(t=t.bind(e)),this.ready?t():this.__readyWait.push(t)}waitViewReady(t,e){e&&(t=t.bind(e)),this.viewReady?t():this.__viewReadyWait.push(t)}waitViewCompleted(t,e){e&&(t=t.bind(e)),this.__viewCompletedWait.push(t),this.viewCompleted?this.__checkViewCompleted(!1):this.running||this.start()}nextRender(t,e,s){e&&(t=t.bind(e));const i=this.__nextRenderWait;if(s){for(let e=0;e<i.length;e++)if(i[e]===t){i.splice(e,1);break}}else i.push(t);this.requestRender()}zoom(t,e,s,i){return Zt.need("view")}getValidMove(t,e,s){return{x:t,y:e}}getValidScale(t){return t}getWorldPointByClient(t,e){return this.interaction&&this.interaction.getLocal(t,e)}getPagePointByClient(t,e){return this.getPagePoint(this.getWorldPointByClient(t,e))}getClientPointByWorld(t){const{x:e,y:s}=this.clientBounds;return{x:e+t.x,y:s+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(t){this.emitEvent(new No(t,this))}__listenEvents(){const t=Qt.start("FirstCreate "+this.innerName);this.once([[No.START,()=>Qt.end(t)],[zo.START,this.updateLazyBounds,this],[Uo.START,this.__onCreated,this],[Uo.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Fo.DATA,this.__onWatchData,this],[zo.END,this.__onLayoutEnd,this],[Uo.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Rl.list.remove(this);try{this.stop(),this.emitLeafer(No.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{Hr.clearRecycled()},100)}catch(t){Cl.error(t)}}};t?e():setTimeout(e)}},t.Leafer.list=new oh,ae([Ln(Kh)],t.Leafer.prototype,"__",void 0),ae([dn()],t.Leafer.prototype,"pixelRatio",void 0),ae([rn("normal")],t.Leafer.prototype,"mode",void 0),t.Leafer=Rl=ae([zn()],t.Leafer),t.Rect=class extends t.UI{get __tag(){return"Rect"}},ae([Ln(sl)],t.Rect.prototype,"__",void 0),t.Rect=ae([Fn(kl),Wn(),zn()],t.Rect);const{add:Tl,includes:Pl,scroll:Ll}=Wt,Il=t.Rect.prototype,El=t.Group.prototype;t.Box=class extends t.Group{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const s=this.__,i=this.__layout,{renderBounds:r,boxBounds:n}=i,{overflow:o}=s,a=i.childrenRenderBounds||(i.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(a),(e=o.includes("scroll"))&&(Tl(a,n),Ll(a,s)),this.__updateRectRenderBounds(),t=!Pl(n,a),t&&"show"===o&&Tl(r,a)}else this.__updateRectRenderBounds();p.stintSet(this,"isOverflow",t),this.__checkScroll(e)}__updateRectRenderBounds(){}__checkScroll(t){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e)),this.hasScroller&&this.scroller.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}},ae([Ln(Zh)],t.Box.prototype,"__",void 0),ae([dn(100)],t.Box.prototype,"width",void 0),ae([dn(100)],t.Box.prototype,"height",void 0),ae([rn(!1)],t.Box.prototype,"resizeChildren",void 0),ae([mn("show")],t.Box.prototype,"overflow",void 0),ae([Mn(Il.__updateStrokeSpread)],t.Box.prototype,"__updateStrokeSpread",null),ae([Mn(Il.__updateRenderSpread)],t.Box.prototype,"__updateRectRenderSpread",null),ae([Mn(Il.__updateBoxBounds)],t.Box.prototype,"__updateRectBoxBounds",null),ae([Mn(Il.__updateStrokeBounds)],t.Box.prototype,"__updateStrokeBounds",null),ae([Mn(Il.__updateRenderBounds)],t.Box.prototype,"__updateRectRenderBounds",null),ae([Mn(Il.__updateChange)],t.Box.prototype,"__updateRectChange",null),ae([Mn(Il.__render)],t.Box.prototype,"__renderRect",null),ae([Mn(El.__render)],t.Box.prototype,"__renderGroup",null),t.Box=ae([Wn(),zn()],t.Box),t.Frame=class extends t.Box{get __tag(){return"Frame"}get isFrame(){return!0}},ae([Ln(tl)],t.Frame.prototype,"__",void 0),ae([xn("#FFFFFF")],t.Frame.prototype,"fill",void 0),ae([mn("hide")],t.Frame.prototype,"overflow",void 0),t.Frame=ae([zn()],t.Frame);const{moveTo:Ol,closePath:Al,ellipse:Ml}=pi;t.Ellipse=class extends t.UI{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:s,innerRadius:i,startAngle:r,endAngle:n}=this.__,o=t/2,a=s/2,h=this.__.path=[];i?(r||n?(i<1&&Ml(h,o,a,o*i,a*i,0,r,n,!1),Ml(h,o,a,o,a,0,n,r,!0),i<1&&Al(h)):(i<1&&(Ml(h,o,a,o*i,a*i),Ol(h,t,a)),Ml(h,o,a,o,a,0,360,0,!0)),e.ellipseToCurve&&(this.__.path=this.getPath(!0))):r||n?(Ol(h,o,a),Ml(h,o,a,o,a,0,r,n,!1),Al(h)):Ml(h,o,a,o,a)}},ae([Ln(il)],t.Ellipse.prototype,"__",void 0),ae([pn(0)],t.Ellipse.prototype,"innerRadius",void 0),ae([pn(0)],t.Ellipse.prototype,"startAngle",void 0),ae([pn(0)],t.Ellipse.prototype,"endAngle",void 0),t.Ellipse=ae([zn()],t.Ellipse);const{sin:Wl,cos:Dl,PI:Fl}=Math,{moveTo:zl,lineTo:Ul,closePath:Nl,drawPoints:Yl}=pi;t.Polygon=class extends t.UI{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)Yl(e,t.points,t.curve,!0);else{const{width:s,height:i,sides:r}=t,n=s/2,o=i/2;zl(e,n,0);for(let t=1;t<r;t++)Ul(e,n+n*Wl(2*t*Fl/r),o-o*Dl(2*t*Fl/r));Nl(e)}}},ae([Ln(rl)],t.Polygon.prototype,"__",void 0),ae([pn(3)],t.Polygon.prototype,"sides",void 0),ae([pn()],t.Polygon.prototype,"points",void 0),ae([pn(0)],t.Polygon.prototype,"curve",void 0),t.Polygon=ae([Wn(),zn()],t.Polygon);const{sin:Xl,cos:Hl,PI:Vl}=Math,{moveTo:jl,lineTo:Gl,closePath:ql}=pi;t.Star=class extends t.UI{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:s,innerRadius:i}=this.__,r=t/2,n=e/2,o=this.__.path=[];jl(o,r,0);for(let t=1;t<2*s;t++)Gl(o,r+(t%2==0?r:r*i)*Xl(t*Vl/s),n-(t%2==0?n:n*i)*Hl(t*Vl/s));ql(o)}},ae([Ln(nl)],t.Star.prototype,"__",void 0),ae([pn(5)],t.Star.prototype,"corners",void 0),ae([pn(.382)],t.Star.prototype,"innerRadius",void 0),t.Star=ae([zn()],t.Star);const{moveTo:Ql,lineTo:Jl,drawPoints:$l}=pi,{rotate:Zl,getAngle:Kl,getDistance:td,defaultPoint:ed}=st;t.Line=class extends t.UI{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,s={x:0,y:0};return t&&(s.x=t),e&&Zl(s,e),s}set toPoint(t){this.width=td(ed,t),this.rotation=Kl(ed,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?$l(e,t.points,t.curve,t.closed):(Ql(e,0,0),Jl(e,this.width,0))}},ae([Ln(el)],t.Line.prototype,"__",void 0),ae([gn("center")],t.Line.prototype,"strokeAlign",void 0),ae([dn(0)],t.Line.prototype,"height",void 0),ae([pn()],t.Line.prototype,"points",void 0),ae([pn(0)],t.Line.prototype,"curve",void 0),ae([pn(!1)],t.Line.prototype,"closed",void 0),t.Line=ae([zn()],t.Line),t.Image=class extends t.Rect{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return c(t)&&t[0].image}},ae([Ln(dl)],t.Image.prototype,"__",void 0),ae([dn("")],t.Image.prototype,"url",void 0),t.Image=ae([zn()],t.Image);const sd=t.Image;t.Canvas=class extends t.Rect{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=Kt.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new Jr({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new Lo(Lo.LOADED,{image:t}))})}draw(t,e,s,i){const r=new lt(t.worldTransform).invert(),n=new lt;e&&n.translate(e.x,e.y),s&&(l(s)?n.scale(s):n.scale(s.x,s.y)),i&&n.rotate(i),r.multiplyParent(n),t.__render(this.canvas,{matrix:r.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:s,height:i}=this.__,{view:r}=this.canvas;t.drawImage(r,0,0,r.width,r.height,0,0,s,i)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:s}=this.__;t.resize(this.__,s),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}},ae([Ln(cl)],t.Canvas.prototype,"__",void 0),ae([Ph(100)],t.Canvas.prototype,"width",void 0),ae([Ph(100)],t.Canvas.prototype,"height",void 0),ae([Ph(1)],t.Canvas.prototype,"pixelRatio",void 0),ae([Ph(!0)],t.Canvas.prototype,"smooth",void 0),ae([rn(!1)],t.Canvas.prototype,"safeResize",void 0),ae([Ph()],t.Canvas.prototype,"contextSettings",void 0),t.Canvas=ae([zn()],t.Canvas);const{copyAndSpread:id,includes:rd,spread:nd,setList:od}=Wt;function ad(t,e){const s=t.__,{rows:i,decorationY:r}=s.__textDrawData;let n;s.__isPlacehold&&s.placeholderColor&&(e.fillStyle=s.placeholderColor);for(let t=0,s=i.length;t<s;t++)n=i[t],n.text?e.fillText(n.text,n.x,n.y):n.data&&n.data.forEach(t=>{e.fillText(t.char,t.x,n.y)});if(r){const{decorationColor:t,decorationHeight:n}=s.__textDrawData;t&&(e.fillStyle=t),i.forEach(t=>r.forEach(s=>e.fillRect(t.x,t.y+s,t.width,n)))}}function hd(t,e){t.__.__font?ad(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function ld(t,e,s){switch(e.__.strokeAlign){case"center":dd(t,1,e,s);break;case"inside":cd(t,"inside",e,s);break;case"outside":e.__.__fillAfterStroke?dd(t,2,e,s):cd(t,"outside",e,s)}}function dd(t,e,s,i){const r=s.__;u(t)?_d(t,e,!0,s,i):(i.setStroke(t,r.__strokeWidth*e,r),ud(s,i))}function cd(t,e,s,i){const r=i.getSameCanvas(!0,!0);r.font=s.__.__font,dd(t,2,s,r),r.blendMode="outside"===e?"destination-out":"destination-in",ad(s,r),r.blendMode="normal",$n.copyCanvasByWorld(s,i,r),r.recycle(s.__nowWorld)}function ud(t,e){let s,i=t.__.__textDrawData;const{rows:r,decorationY:n}=i;for(let t=0,i=r.length;t<i;t++)s=r[t],s.text?e.strokeText(s.text,s.x,s.y):s.data&&s.data.forEach(t=>{e.strokeText(t.char,t.x,s.y)});if(n){const{decorationHeight:t}=i;r.forEach(s=>n.forEach(i=>e.strokeRect(s.x,s.y+i,s.width,t)))}}function _d(t,e,s,i,r){let n;const o=i.__,{__hasMultiStrokeStyle:a}=o;a||r.setStroke(void 0,o.__strokeWidth*e,o);for(let h=0,l=t.length;h<l;h++)if(n=t[h],(!n.image||!Wh.checkImage(i,r,n,!1))&&n.style){if(a){const{strokeStyle:t}=n;t?r.setStroke(n.style,o.__getRealStrokeWidth(t)*e,o,t):r.setStroke(n.style,o.__strokeWidth*e,o)}else r.strokeStyle=n.style;n.blendMode?(r.saveBlendMode(n.blendMode),s?ud(i,r):r.stroke(),r.restoreBlendMode()):s?ud(i,r):r.stroke()}}function pd(t,e,s){const i=e.__;if(i.__strokeWidth)if(i.__font)ld(t,e,s);else switch(i.strokeAlign){case"center":gd(t,1,e,s);break;case"inside":!function(t,e,s){s.save(),s.clipUI(e),gd(t,2,e,s),s.restore()}(t,e,s);break;case"outside":!function(t,e,s){const i=e.__;if(i.__fillAfterStroke)gd(t,2,e,s);else{const{renderBounds:r}=e.__layout,n=s.getSameCanvas(!0,!0);e.__drawRenderPath(n),gd(t,2,e,n),n.clipUI(i),n.clearWorld(r),$n.copyCanvasByWorld(e,s,n),n.recycle(e.__nowWorld)}}(t,e,s)}}function gd(t,e,s,i){const r=s.__;u(t)?_d(t,e,!1,s,i):(i.setStroke(t,r.__strokeWidth*e,r),i.stroke()),r.__useArrow&&Mh.strokeArrow(t,s,i)}t.Text=class extends t.UI{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:s,fontFamily:i,fontSize:r,fontWeight:n,italic:o,textCase:a,textOverflow:h,padding:l}=t;t.__lineHeight=Oh.number(e,r),t.__letterSpacing=Oh.number(s,r),t.__padding=l?L.fourNumber(l):void 0,t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*r)/2,t.__font=`${o?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==n?n+" ":""}${r||12}px ${i||"caption"}`,t.__clipText="show"!==h&&!t.__autoSize,t.__textDrawData=Ih.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:s,italic:i,padding:r,__autoWidth:n,__autoHeight:o}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<s&&nd(a,s/2),n||o){if(h.x=n?a.x:0,h.y=o?a.y:0,h.width=n?a.width:t.width,h.height=o?a.height:t.height,r){const[e,s,i,r]=t.__padding;n&&(h.x-=r,h.width+=s+r),o&&(h.y-=e,h.height+=i+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();i&&(h.width+=.16*s),p.stintSet(this,"isOverflow",!rd(h,a)),this.isOverflow?(od(t.__textBoxBounds={},[h,a]),e.renderChanged=!0):t.__textBoxBounds=h}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;id(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__updateChange(){super.__updateChange();const t=this.__box;t&&(t.__onUpdateSize(),t.__updateChange())}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,s){const i=this.__box;i&&(i.__nowWorld=this.__nowWorld,i.__draw(t,e,s)),this.textEditing&&!e.exporting||super.__draw(t,e,s)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}},ae([Ln(ll)],t.Text.prototype,"__",void 0),ae([dn(0)],t.Text.prototype,"width",void 0),ae([dn(0)],t.Text.prototype,"height",void 0),ae([xn()],t.Text.prototype,"boxStyle",void 0),ae([rn(!1)],t.Text.prototype,"resizeFontSize",void 0),ae([xn("#000000")],t.Text.prototype,"fill",void 0),ae([gn("outside")],t.Text.prototype,"strokeAlign",void 0),ae([Tn("all")],t.Text.prototype,"hitFill",void 0),ae([dn("")],t.Text.prototype,"text",void 0),ae([dn("")],t.Text.prototype,"placeholder",void 0),ae([dn("caption")],t.Text.prototype,"fontFamily",void 0),ae([dn(12)],t.Text.prototype,"fontSize",void 0),ae([dn("normal")],t.Text.prototype,"fontWeight",void 0),ae([dn(!1)],t.Text.prototype,"italic",void 0),ae([dn("none")],t.Text.prototype,"textCase",void 0),ae([dn("none")],t.Text.prototype,"textDecoration",void 0),ae([dn(0)],t.Text.prototype,"letterSpacing",void 0),ae([dn({type:"percent",value:1.5})],t.Text.prototype,"lineHeight",void 0),ae([dn(0)],t.Text.prototype,"paraIndent",void 0),ae([dn(0)],t.Text.prototype,"paraSpacing",void 0),ae([dn("x")],t.Text.prototype,"writingMode",void 0),ae([dn("left")],t.Text.prototype,"textAlign",void 0),ae([dn("top")],t.Text.prototype,"verticalAlign",void 0),ae([dn(!0)],t.Text.prototype,"autoSizeAlign",void 0),ae([dn("normal")],t.Text.prototype,"textWrap",void 0),ae([dn("show")],t.Text.prototype,"textOverflow",void 0),ae([xn(!1)],t.Text.prototype,"textEditing",void 0),t.Text=ae([zn()],t.Text),t.Path=class extends t.UI{get __tag(){return"Path"}},ae([Ln(ol)],t.Path.prototype,"__",void 0),ae([gn("center")],t.Path.prototype,"strokeAlign",void 0),t.Path=ae([zn()],t.Path),t.Pen=class extends t.Group{get __tag(){return"Pen"}setStyle(e){const s=this.pathElement=new t.Path(e);return this.pathStyle=e,this.__path=s.path||(s.path=[]),this.add(s),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,s,i,r,n){return this}quadraticCurveTo(t,e,s,i){return this}closePath(){return this}rect(t,e,s,i){return this}roundRect(t,e,s,i,r){return this}ellipse(t,e,s,i,r,n,o,a){return this}arc(t,e,s,i,r,n){return this}arcTo(t,e,s,i,r){return this}drawEllipse(t,e,s,i,r,n,o,a){return this}drawArc(t,e,s,i,r,n){return this}drawPoints(t,e,s){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}},ae([Ln(al)],t.Pen.prototype,"__",void 0),ae([(t,e)=>{$r(t,e,{get(){return this.__path}})}],t.Pen.prototype,"path",void 0),t.Pen=ae([Fn(Ii,["set","path","paint"]),zn()],t.Pen);const{getSpread:fd,copyAndSpread:yd,toOuterOf:md,getOuterOf:xd,getByMove:wd,move:vd,getIntersectData:bd}=Wt,Bd={};let kd;const{stintSet:Sd}=p,{hasTransparent:Rd}=Eh;function Cd(t,e,s){if(!u(e)||!1===e.visible||0===e.opacity)return;let i;const{boxBounds:r}=s.__layout;switch(e.type){case"image":i=Wh.image(s,t,e,r,!kd||!kd[e.url]);break;case"linear":i=Dh.linearGradient(e,r);break;case"radial":i=Dh.radialGradient(e,r);break;case"angular":i=Dh.conicGradient(e,r);break;case"solid":const{type:o,color:a,opacity:h}=e;i={type:o,style:Eh.string(a,h)};break;default:n(e.r)||(i={type:"solid",style:Eh.string(e)})}if(i){if(a(i.style)&&Rd(i.style)&&(i.isTransparent=!0),e.style){if(0===e.style.strokeWidth)return;i.strokeStyle=e.style}e.editing&&(i.editing=e.editing),e.blendMode&&(i.blendMode=e.blendMode)}return i}const Td={compute:function(t,e){const s=e.__,i=[];let r,n,o,a=s.__input[t];c(a)||(a=[a]),kd=Wh.recycleImage(t,s);for(let s,r=0,n=a.length;r<n;r++)(s=Cd(t,a[r],e))&&(i.push(s),s.strokeStyle&&(o||(o=1),s.strokeStyle.strokeWidth&&(o=Math.max(o,s.strokeStyle.strokeWidth))));s["_"+t]=i.length?i:void 0,i.length&&i.every(t=>t.isTransparent)&&(i.some(t=>t.image)&&(r=!0),n=!0),"fill"===t?(Sd(s,"__isAlphaPixelFill",r),Sd(s,"__isTransparentFill",n)):(Sd(s,"__isAlphaPixelStroke",r),Sd(s,"__isTransparentStroke",n),Sd(s,"__hasMultiStrokeStyle",o))},fill:function(t,e,s){s.fillStyle=t,hd(e,s)},fills:function(t,e,s){let i;for(let r=0,n=t.length;r<n;r++){if(i=t[r],i.image){if(Wh.checkImage(e,s,i,!e.__.__font))continue;if(!i.style){!r&&i.image.isPlacehold&&e.drawImagePlaceholder(s,i.image);continue}}if(s.fillStyle=i.style,i.transform||i.scaleFixed){if(s.save(),i.transform&&s.transform(i.transform),i.scaleFixed){const{scaleX:t,scaleY:r}=e.getRenderScaleData(!0);(!0===i.scaleFixed||"zoom-in"===i.scaleFixed&&t>1&&r>1)&&s.scale(1/t,1/r)}i.blendMode&&(s.blendMode=i.blendMode),hd(e,s),s.restore()}else i.blendMode?(s.saveBlendMode(i.blendMode),hd(e,s),s.restoreBlendMode()):hd(e,s)}},fillPathOrText:hd,fillText:ad,stroke:pd,strokes:function(t,e,s){pd(t,e,s)},strokeText:ld,drawTextStroke:ud,shape:function(t,s,i){const r=s.getSameCanvas(),n=s.bounds,o=t.__nowWorld,a=t.__layout,h=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let l,d,c,u,_,p;md(a.strokeSpread?(yd(Bd,a.boxBounds,a.strokeSpread),Bd):a.boxBounds,o,h);let{scaleX:g,scaleY:f}=t.getRenderScaleData(!0);if(n.includes(h))p=r,l=_=h,d=o;else{let r;if(e.fullImageShadow)r=h;else{const t=a.renderShapeSpread?fd(n,b.swapAndScale(a.renderShapeSpread,g,f)):n;r=bd(t,h)}u=n.getFitMatrix(r);let{a:y,d:m}=u;u.a<1&&(p=s.getSameCanvas(),t.__renderShape(p,i),g*=y,f*=m),_=xd(h,u),l=wd(_,-u.e,-u.f),d=xd(o,u),vd(d,-u.e,-u.f);const x=i.matrix;x?(c=new lt(u),c.multiply(x),y*=x.scaleX,m*=x.scaleY):c=u,c.withScale(y,m),i=Object.assign(Object.assign({},i),{matrix:c})}return t.__renderShape(r,i),{canvas:r,matrix:c,fitMatrix:u,bounds:l,renderBounds:d,worldCanvas:p,shapeBounds:_,scaleX:g,scaleY:f}}};let Pd={},Ld={a:1,b:0,c:0,d:1,e:0,f:0};const{get:Id,rotateOfOuter:Ed,translate:Od,scaleOfOuter:Ad,multiplyParent:Md,scale:Wd,rotate:Dd,skew:Fd}=V;function zd(t,e,s,i,r,n,o){const a=Id();Od(a,e.x+s,e.y+i),Wd(a,r,n),o&&Ed(a,{x:e.x+e.width/2,y:e.y+e.height/2},o),t.transform=a}function Ud(t,e,s,i,r,n,o,a,h,l){const d=Id();Yd(d,e,s,i,r,n,o,a),h&&(Ld.a=h,Ld.d=l,Md(d,Ld)),t.transform=d}function Nd(t,e,s,i,r,n,o,a,h,l,d,c){const u=Id();if(c)Yd(u,e,r,n,o,a,h,l);else{if(h)if("center"===d)Ed(u,{x:s/2,y:i/2},h);else switch(Dd(u,h),h){case 90:Od(u,i,0);break;case 180:Od(u,s,i);break;case 270:Od(u,0,s)}Pd.x=e.x+r,Pd.y=e.y+n,Od(u,Pd.x,Pd.y),o&&Ad(u,Pd,o,a)}t.transform=u}function Yd(t,e,s,i,r,n,o,a){o&&Dd(t,o),a&&Fd(t,a.x,a.y),r&&Wd(t,r,n),Od(t,e.x+s,e.y+i)}const{get:Xd,translate:Hd}=V,Vd=new Ut,jd={},Gd={};function qd(t,e,s,i){const{changeful:r,sync:n,scaleFixed:o}=s;r&&(t.changeful=r),n&&(t.sync=n),o&&(t.scaleFixed=o),t.data=Qd(s,i,e)}function Qd(t,e,s){t.padding&&(e=Vd.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");let{width:i,height:r}=s;const{opacity:n,mode:o,align:h,offset:l,scale:d,size:c,rotation:_,skew:p,clipSize:g,repeat:f,gap:y,filters:m}=t,x=e.width===i&&e.height===r,w={mode:o},v="center"!==h&&(_||0)%180==90;let b,B;switch(Wt.set(Gd,0,0,v?r:i,v?i:r),o&&"cover"!==o&&"fit"!==o?((d||c)&&(L.getScaleData(d,c,s,jd),b=jd.scaleX,B=jd.scaleY),(h||y||f)&&(b&&Wt.scale(Gd,b,B,!0),h&&xt.toPoint(h,Gd,e,Gd,!0,!0))):x&&!_||(b=B=Wt.getFitScale(e,Gd,"fit"!==o),Wt.put(e,s,h,b,!1,Gd),Wt.scale(Gd,b,B,!0)),l&&st.move(Gd,l),o){case"stretch":x||(i=e.width,r=e.height);break;case"normal":case"clip":if(Gd.x||Gd.y||b||g||_||p){let t,s;g&&(t=e.width/g.width,s=e.height/g.height),Ud(w,e,Gd.x,Gd.y,b,B,_,p,t,s),t&&(b=b?b*t:b,B=B?B*s:s)}break;case"repeat":(!x||b||_||p)&&Nd(w,e,i,r,Gd.x,Gd.y,b,B,_,p,h,t.freeTransform),f||(w.repeat="repeat");const s=u(f);(y||s)&&(w.gap=function(t,e,s,i,r){let n,o;u(t)?(n=t.x,o=t.y):n=o=t;return{x:Jd(n,s,r.width,e&&e.x),y:Jd(o,i,r.height,e&&e.y)}}(y,s&&f,Gd.width,Gd.height,e));break;default:b&&zd(w,e,Gd.x,Gd.y,b,B,_)}return w.transform||(e.x||e.y)&&(w.transform=Xd(),Hd(w.transform,e.x,e.y)),b&&"stretch"!==o&&(w.scaleX=b,w.scaleY=B),w.width=i,w.height=r,n&&(w.opacity=n),m&&(w.filters=m),f&&(w.repeat=a(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),w}function Jd(t,e,s,i){const r=a(t)||i?(i?s-i*e:s%e)/((i||Math.floor(s/e))-1):t;return"auto"===t&&r<0?0:r}let $d,Zd=new Ut;const{isSame:Kd}=Wt;function tc(t,e,s,i,r,n){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=i.width/e.pixelRatio,e.__naturalHeight=i.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return r.data||qd(r,i,s,n),!0}function ec(t,e){rc(t,Lo.LOAD,e)}function sc(t,e){rc(t,Lo.LOADED,e)}function ic(t,e,s){e.error=s,t.forceUpdate("surface"),rc(t,Lo.ERROR,e)}function rc(t,e,s){t.hasEvent(e)&&t.emitEvent(new Lo(e,s))}function nc(t,e){const{leafer:s}=t;s&&s.viewReady&&(s.renderer.ignore=e)}const{get:oc,scale:ac,copy:hc}=V,{floor:lc,ceil:dc,max:cc,abs:uc}=Math;function _c(t,s,i){let{scaleX:r,scaleY:n}=t.getRenderScaleData(!0,s.scaleFixed);const o=r+"-"+n+"-"+i;if(s.patternId===o||t.destroyed)return!1;{const{image:a,data:h}=s;let l,d,{width:c,height:u,scaleX:_,scaleY:p,transform:g,repeat:f,gap:y}=h;r*=i,n*=i,_&&(_=uc(_),p=uc(p),d=oc(),hc(d,g),ac(d,1/_,1/p),r*=_,n*=p),c*=r,u*=n;const m=c*u;if(!f&&m>e.image.maxCacheSize)return!1;let x=e.image.maxPatternSize;if(a.isSVG){const t=c/a.width;t>1&&(l=t/dc(t))}else{const t=a.width*a.height;x>t&&(x=t)}m>x&&(l=Math.sqrt(m/x)),l&&(r/=l,n/=l,c/=l,u/=l),_&&(r/=_,n/=p);const w=y&&y.x*r,v=y&&y.y*n;if(g||1!==r||1!==n){const t=c+(w||0),e=u+(v||0);r/=t/cc(lc(t),1),n/=e/cc(lc(e),1),d||(d=oc(),g&&hc(d,g)),ac(d,1/r,1/n)}const b=a.getCanvas(c,u,h.opacity,h.filters,w,v,t.leafer&&t.leafer.config.smooth),B=a.getPattern(b,f||e.origin.noRepeat||"no-repeat",d,s);return s.style=B,s.patternId=o,!0}}const pc={image:function(t,e,s,i,r){let n,o;const a=Hr.get(s);return $d&&s===$d.paint&&Kd(i,$d.boxBounds)?n=$d.leafPaint:(n={type:s.type,image:a},a.hasAlphaPixel&&(n.isTransparent=!0),$d=a.use>1?{leafPaint:n,paint:s,boxBounds:Zd.set(i)}:null),(r||a.loading)&&(o={image:a,attrName:e,attrValue:s}),a.ready?(tc(t,e,s,a,n,i),r&&(ec(t,o),sc(t,o))):a.error?r&&ic(t,o,a.error):(r&&(nc(t,!0),ec(t,o)),n.loadId=a.load(()=>{nc(t,!1),t.destroyed||(tc(t,e,s,a,n,i)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),sc(t,o)),n.loadId=void 0},e=>{nc(t,!1),ic(t,o,e),n.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),n},checkImage:function(t,s,i,r){const{scaleX:n,scaleY:o}=t.getRenderScaleData(!0,i.scaleFixed),{pixelRatio:a}=s,{data:h}=i;if(!h||i.patternId===n+"-"+o+"-"+a&&!Uh.running)return!1;if(r)if(h.repeat)r=!1;else if(!(i.changeful||"miniapp"===e.name&&Do.isResizing(t)||Uh.running)){let{width:t,height:s}=h;t*=n*a,s*=o*a,h.scaleX&&(t*=h.scaleX,s*=h.scaleY),r=t*s>e.image.maxCacheSize}return r?(t.__.__isFastShadow&&(s.fillStyle=i.style||"#000",s.fill()),function(t,e,s,i){e.save(),e.clipUI(t),s.blendMode&&(e.blendMode=s.blendMode);i.opacity&&(e.opacity*=i.opacity);i.transform&&e.transform(i.transform);e.drawImage(s.image.getFull(i.filters),0,0,i.width,i.height),e.restore()}(t,s,i,h),!0):(!i.style||i.sync||Uh.running?_c(t,i,a):i.patternTask||(i.patternTask=Hr.patternTasker.add(()=>he(this,void 0,void 0,function*(){i.patternTask=null,s.bounds.hit(t.__nowWorld)&&_c(t,i,a),t.forceUpdate("surface")}),300)),!1)},createPattern:_c,recycleImage:function(t,e){const s=e["_"+t];if(c(s)){let i,r,n,o,a;for(let h=0,l=s.length;h<l;h++)i=s[h],r=i.image,a=r&&r.url,a&&(n||(n={}),n[a]=!0,Hr.recycle(r),r.loading&&(o||(o=e.__input&&e.__input[t]||[],c(o)||(o=[o])),r.unload(s[h].loadId,!o.some(t=>t.url===a))));return n}return null},createData:qd,getPatternData:Qd,fillOrFitMode:zd,clipMode:Ud,repeatMode:Nd},{toPoint:gc}=ft,{hasTransparent:fc}=Eh,yc={},mc={};function xc(t,e,s,i){if(s){let r,n,o,h;for(let t=0,l=s.length;t<l;t++)r=s[t],a(r)?(o=t/(l-1),n=Eh.string(r,i)):(o=r.offset,n=Eh.string(r.color,i)),e.addColorStop(o,n),!h&&fc(n)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:wc,getDistance:vc}=st,{get:bc,rotateOfOuter:Bc,scaleOfOuter:kc}=V,{toPoint:Sc}=ft,Rc={},Cc={};function Tc(t,e,s,i,r){let n;const{width:o,height:a}=t;if(o!==a||i){const t=wc(e,s);n=bc(),r?(kc(n,e,o/a*(i||1),1),Bc(n,e,t+90)):(kc(n,e,1,o/a*(i||1)),Bc(n,e,t))}return n}const{getDistance:Pc}=st,{toPoint:Lc}=ft,Ic={},Ec={};const Oc={linearGradient:function(t,s){let{from:i,to:r,type:n,opacity:o}=t;gc(i||"top",s,yc),gc(r||"bottom",s,mc);const a=e.canvas.createLinearGradient(yc.x,yc.y,mc.x,mc.y),h={type:n,style:a};return xc(h,a,t.stops,o),h},radialGradient:function(t,s){let{from:i,to:r,type:n,opacity:o,stretch:a}=t;Sc(i||"center",s,Rc),Sc(r||"bottom",s,Cc);const h=e.canvas.createRadialGradient(Rc.x,Rc.y,0,Rc.x,Rc.y,vc(Rc,Cc)),l={type:n,style:h};xc(l,h,t.stops,o);const d=Tc(s,Rc,Cc,a,!0);return d&&(l.transform=d),l},conicGradient:function(t,s){let{from:i,to:r,type:n,opacity:o,stretch:a}=t;Lc(i||"center",s,Ic),Lc(r||"bottom",s,Ec);const h=e.conicGradientSupport?e.canvas.createConicGradient(0,Ic.x,Ic.y):e.canvas.createRadialGradient(Ic.x,Ic.y,0,Ic.x,Ic.y,Pc(Ic,Ec)),l={type:n,style:h};xc(l,h,t.stops,o);const d=Tc(s,Ic,Ec,a||1,e.conicGradientRotate90);return d&&(l.transform=d),l},getTransform:Tc},{copy:Ac,move:Mc,toOffsetOutBounds:Wc}=Wt,{max:Dc}=Math,Fc={},zc=new lt,Uc={};function Nc(t,e){let s,i,r,n,o=0,a=0,h=0,l=0;return e.forEach(t=>{s=t.x||0,i=t.y||0,r=t.spread||0,n=1.5*(t.blur||0),o=Dc(o,r+n-i),a=Dc(a,r+n+s),h=Dc(h,r+n+i),l=Dc(l,r+n-s)}),o===a&&a===h&&h===l?o:[o,a,h,l]}function Yc(t,e,s,i,r,n,o){if(i.spread){const s=1+2*i.spread/t.__layout.strokeBounds.width*n*(o?-1:1);return zc.set().scaleOfOuter({x:(r.x+r.width/2)*e.pixelRatio,y:(r.y+r.height/2)*e.pixelRatio},s),zc}}function Xc(t,s,i){const{shapeBounds:r}=i;let n,o;e.fullImageShadow?(Ac(Fc,t.bounds),Mc(Fc,s.x-r.x,s.y-r.y),n=t.bounds,o=Fc):(n=r,o=s),t.copyWorld(i.canvas,n,o)}const{toOffsetOutBounds:Hc}=Wt,Vc={};const jc=Nc;const Gc={shadow:function(t,e,s){let i,r;const{__nowWorld:n}=t,{shadow:o}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=s,_=e.getSameCanvas(),p=o.length-1;Wc(h,Uc,l),o.forEach((o,g)=>{let f=1;if(o.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}_.setWorldShadow(Uc.offsetX+o.x*c*f,Uc.offsetY+o.y*u*f,o.blur*c*f,Eh.string(o.color)),r=Yc(t,_,s,o,Uc,f),r&&_.setTransform(r),Xc(_,Uc,s),r&&_.resetTransform(),i=l,o.box&&(_.restore(),_.save(),a&&(_.copyWorld(_,l,n,"copy"),i=n),a?_.copyWorld(a,n,n,"destination-out"):_.copyWorld(s.canvas,d,h,"destination-out")),$n.copyCanvasByWorld(t,e,_,i,o.blendMode),p&&g<p&&_.clearWorld(i)}),_.recycle(i)},innerShadow:function(t,e,s){let i,r;const{__nowWorld:n}=t,{innerShadow:o}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=s,_=e.getSameCanvas(),p=o.length-1;Hc(h,Vc,l),o.forEach((o,g)=>{let f=1;if(o.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}_.save(),_.setWorldShadow(Vc.offsetX+o.x*c*f,Vc.offsetY+o.y*u*f,o.blur*c*f),r=Yc(t,_,0,o,Vc,f,!0),r&&_.setTransform(r),Xc(_,Vc,s),_.restore(),a?(_.copyWorld(_,l,n,"copy"),_.copyWorld(a,n,n,"source-out"),i=n):(_.copyWorld(s.canvas,d,h,"source-out"),i=l),_.fillWorld(i,Eh.string(o.color),"source-in"),$n.copyCanvasByWorld(t,e,_,i,o.blendMode),p&&g<p&&_.clearWorld(i)}),_.recycle(i)},blur:function(t,e,s){const{blur:i}=t.__;s.setWorldBlur(i*t.__nowWorld.a),s.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),s.filter="none"},backgroundBlur:function(t,e,s){},getShadowRenderSpread:Nc,getShadowTransform:Yc,isTransformShadow(t){},getInnerShadowSpread:jc},{excludeRenderBounds:qc}=no;let Qc;function Jc(t,e,s,i,r,n,o,a){switch(e){case"grayscale":Qc||(Qc=!0,r.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,s,i,r,n){const o=t.__nowWorld;s.resetTransform(),s.opacity=1,s.useMask(i,o),n&&i.recycle(o);Zc(t,e,s,1,r,n)}(t,s,i,r,o,a);break;case"opacity-path":Zc(t,s,i,n,o,a);break;case"path":a&&s.restore()}}function $c(t){return t.getSameCanvas(!1,!0)}function Zc(t,e,s,i,r,n){const o=t.__nowWorld;e.resetTransform(),e.opacity=i,e.copyWorld(s,o,void 0,r),n?s.recycle(o):s.clearWorld(o)}t.Group.prototype.__renderMask=function(t,e){let s,i,r,n,o,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(s=h[l],a=s.__.mask,a){o&&(Jc(this,o,t,r,i,n,void 0,!0),i=r=null),"clipping"!==a&&"clipping-path"!==a||qc(s,e)||s.__render(t,e),n=s.__.opacity,Qc=!1,"path"===a||"clipping-path"===a?(n<1?(o="opacity-path",r||(r=$c(t))):(o="path",t.save()),s.__clip(r||t,e)):(o="grayscale"===a?"grayscale":"alpha",i||(i=$c(t)),r||(r=$c(t)),s.__render(i,e));continue}const d=1===n&&s.__.__blendMode;d&&Jc(this,o,t,r,i,n,void 0,!1),qc(s,e)||s.__render(r||t,e),d&&Jc(this,o,t,r,i,n,d,!1)}Jc(this,o,t,r,i,n,void 0,!0)};const Kc=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",tu=Kc+"_#~&*+\\=|≮≯≈≠=…",eu=new RegExp([[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[196608,201551],[201552,205743],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12736,12783],[12800,13055],[13056,13311],[63744,64255],[65072,65103],[127488,127743],[194560,195103]].map(([t,e])=>`[\\u${t.toString(16)}-\\u${e.toString(16)}]`).join("|"));function su(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const iu=su("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),ru=su("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),nu=su(Kc),ou=su(tu),au=su("- —/~|┆·");var hu;!function(t){t[t.Letter=0]="Letter",t[t.Single=1]="Single",t[t.Before=2]="Before",t[t.After=3]="After",t[t.Symbol=4]="Symbol",t[t.Break=5]="Break"}(hu||(hu={}));const{Letter:lu,Single:du,Before:cu,After:uu,Symbol:_u,Break:pu}=hu;function gu(t){return iu[t]?lu:au[t]?pu:ru[t]?cu:nu[t]?uu:ou[t]?_u:eu.test(t)?du:lu}const fu={trimRight(t){const{words:e}=t;let s,i=0,r=e.length;for(let n=r-1;n>-1&&(s=e[n].data[0]," "===s.char);n--)i++,t.width-=s.width;i&&e.splice(r-i,i)}};function yu(t,e,s){switch(e){case"title":return s?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:mu}=fu,{Letter:xu,Single:wu,Before:vu,After:bu,Symbol:Bu,Break:ku}=hu;let Su,Ru,Cu,Tu,Pu,Lu,Iu,Eu,Ou,Au,Mu,Wu,Du,Fu,zu,Uu,Nu,Yu=[];function Xu(t,e){Ou&&!Eu&&(Eu=Ou),Su.data.push({char:t,width:e}),Cu+=e}function Hu(){Tu+=Cu,Su.width=Cu,Ru.words.push(Su),Su={data:[]},Cu=0}function Vu(){Fu&&(zu.paraNumber++,Ru.paraStart=!0,Fu=!1),Ou&&(Ru.startCharSize=Eu,Ru.endCharSize=Ou,Eu=0),Ru.width=Tu,Uu.width?mu(Ru):Nu&&ju(),Yu.push(Ru),Ru={words:[]},Tu=0}function ju(){Tu>(zu.maxWidth||0)&&(zu.maxWidth=Tu)}const{top:Gu,right:qu,bottom:Qu,left:Ju}=t.Direction4;function $u(t,e,s){const{bounds:i,rows:r}=t;i[e]+=s;for(let t=0;t<r.length;t++)r[t][e]+=s}const Zu={getDrawData:function(t,s){a(t)||(t=String(t));let i=0,r=0,n=s.__getInput("width")||0,o=s.__getInput("height")||0;const{textDecoration:h,__font:l,__padding:d}=s;d&&(n?(i=d[Ju],n-=d[qu]+d[Ju]):s.autoSizeAlign||(i=d[Ju]),o?(r=d[Gu],o-=d[Gu]+d[Qu]):s.autoSizeAlign||(r=d[Gu]));const c={bounds:{x:i,y:r,width:n,height:o},rows:[],paraNumber:0,font:e.canvas.font=l};return function(t,s,i){zu=t,Yu=t.rows,Uu=t.bounds,Nu=!Uu.width&&!i.autoSizeAlign;const{__letterSpacing:r,paraIndent:n,textCase:o}=i,{canvas:a}=e,{width:h,height:l}=Uu;if(h||l||r||"none"!==o){const t="none"!==i.textWrap,e="break"===i.textWrap;Fu=!0,Mu=null,Eu=Iu=Ou=Cu=Tu=0,Su={data:[]},Ru={words:[]},r&&(s=[...s]);for(let i=0,l=s.length;i<l;i++)Lu=s[i],"\n"===Lu?(Cu&&Hu(),Ru.paraEnd=!0,Vu(),Fu=!0):(Au=gu(Lu),Au===xu&&"none"!==o&&(Lu=yu(Lu,o,!Cu)),Iu=a.measureText(Lu).width,r&&(r<0&&(Ou=Iu),Iu+=r),Wu=Au===wu&&(Mu===wu||Mu===xu)||Mu===wu&&Au!==bu,Du=!(Au!==vu&&Au!==wu||Mu!==Bu&&Mu!==bu),Pu=Fu&&n?h-n:h,t&&h&&Tu+Cu+Iu>Pu&&(e?(Cu&&Hu(),Tu&&Vu()):(Du||(Du=Au===xu&&Mu==bu),Wu||Du||Au===ku||Au===vu||Au===wu||Cu+Iu>Pu?(Cu&&Hu(),Tu&&Vu()):Tu&&Vu()))," "===Lu&&!0!==Fu&&Tu+Cu===0||(Au===ku?(" "===Lu&&Cu&&Hu(),Xu(Lu,Iu),Hu()):Wu||Du?(Cu&&Hu(),Xu(Lu,Iu)):Xu(Lu,Iu)),Mu=Au);Cu&&Hu(),Tu&&Vu(),Yu.length>0&&(Yu[Yu.length-1].paraEnd=!0)}else s.split("\n").forEach(t=>{zu.paraNumber++,Tu=a.measureText(t).width,Yu.push({x:n||0,text:t,width:Tu,paraStart:!0}),Nu&&ju()})}(c,t,s),d&&function(t,e,s,i,r){if(!i&&s.autoSizeAlign)switch(s.textAlign){case"left":$u(e,"x",t[Ju]);break;case"right":$u(e,"x",-t[qu])}if(!r&&s.autoSizeAlign)switch(s.verticalAlign){case"top":$u(e,"y",t[Gu]);break;case"bottom":$u(e,"y",-t[Qu])}}(d,c,s,n,o),function(t,e){const{rows:s,bounds:i}=t,r=s.length,{__lineHeight:n,__baseLine:o,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:_,y:p,width:g,height:f}=i,y=n*r+(c?c*(t.paraNumber-1):0),m=o;if(h&&y>f)y=Math.max(f,n),r>1&&(t.overflow=r);else if(f||u)switch(d){case"middle":p+=(f-y)/2;break;case"bottom":p+=f-y}m+=p;let x,w,v,b=g||u?g:t.maxWidth;for(let o=0,d=r;o<d;o++){if(x=s[o],x.x=_,x.width<g||x.width>g&&!h)switch(l){case"center":x.x+=(b-x.width)/2;break;case"right":x.x+=b-x.width}x.paraStart&&c&&o>0&&(m+=c),x.y=m,m+=n,t.overflow>o&&m>y&&(x.isOverflow=!0,t.overflow=o+1),w=x.x,v=x.width,a<0&&(x.width<0?(v=-x.width+e.fontSize+a,w-=v,v+=e.fontSize):v-=a),w<i.x&&(i.x=w),v>i.width&&(i.width=v),h&&g&&g<v&&(x.isOverflow=!0,t.overflow||(t.overflow=s.length))}i.y=p,i.height=y}(c,s),function(t,e,s){const{rows:i}=t,{textAlign:r,paraIndent:n,letterSpacing:o}=e;let a,h,l,d,c,u;i.forEach(t=>{t.words&&(l=n&&t.paraStart?n:0,u=t.words.length,h=s&&("justify"===r||"both"===r)&&u>1?(s-t.width-l)/(u-1):0,d=o||t.isOverflow?0:h>.01?1:2,t.isOverflow&&!o&&(t.textMode=!0),2===d?(t.x+=l,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=l,a=t.x,t.data=[],t.words.forEach((e,s)=>{1===d?(c={char:"",x:a},a=function(t,e,s){return t.forEach(t=>{s.char+=t.char,e+=t.width}),e}(e.data,a,c),(t.isOverflow||" "!==c.char)&&t.data.push(c)):a=function(t,e,s,i){return t.forEach(t=>{(i||" "!==t.char)&&(t.x=e,s.push(t)),e+=t.width}),e}(e.data,a,t.data,t.isOverflow),!h||t.paraEnd&&"both"!==r||s===u-1||(a+=h,t.width+=h)})),t.words=null)})}(c,s,n),c.overflow&&function(t,s,i,r){if(!r)return;const{rows:n,overflow:o}=t;let{textOverflow:a}=s;if(n.splice(o),a&&"show"!==a){let t,h;"hide"===a?a="":"ellipsis"===a&&(a="...");const l=a?e.canvas.measureText(a).width:0,d=i+r-l;("none"===s.textWrap?n:[n[o-1]]).forEach(e=>{if(e.isOverflow&&e.data){let s=e.data.length-1;for(let i=s;i>-1&&(t=e.data[i],h=t.x+t.width,!(i===s&&h<d));i--){if(h<d&&" "!==t.char||!i){e.data.splice(i+1),e.width-=t.width;break}e.width-=t.width}e.width+=l,e.data.push({char:a,x:h}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(c,s,i,n),"none"!==h&&function(t,e){let s,i=0;const{fontSize:r,textDecoration:n}=e;switch(t.decorationHeight=r/11,u(n)?(s=n.type,n.color&&(t.decorationColor=Eh.string(n.color)),n.offset&&(i=Math.min(.3*r,Math.max(n.offset,.15*-r)))):s=n,s){case"under":t.decorationY=[.15*r+i];break;case"delete":t.decorationY=[.35*-r];break;case"under-delete":t.decorationY=[.15*r+i,.35*-r]}}(c,s),c}};const Ku={string:function(t,e){const s=l(e)&&e<1;if(a(t)){if(!s||!Eh.object)return t;t=Eh.object(t)}let i=n(t.a)?1:t.a;s&&(i*=e);const r=t.r+","+t.g+","+t.b;return 1===i?"rgb("+r+")":"rgba("+r+","+i+")"}};return Object.assign(Ih,Zu),Object.assign(Eh,Ku),Object.assign(Mh,Td),Object.assign(Wh,pc),Object.assign(Dh,Oc),Object.assign(Fh,Gc),uh(),t.AlignHelper=xt,t.AroundHelper=ft,t.AutoBounds=Yt,t.BezierHelper=Ze,t.Bounds=Ut,t.BoundsEvent=Io,t.BoundsHelper=Wt,t.BoxData=Zh,t.BranchHelper=lo,t.BranchRender=Sa,t.CanvasData=cl,t.CanvasManager=oe,t.ChildEvent=Ro,t.ColorConvert=Eh,t.Creator=Kt,t.DataHelper=p,t.Debug=Vt,t.DragBoundsHelper=xl,t.Effect=Fh,t.EllipseData=il,t.EllipseHelper=as,t.Event=So,t.EventCreator=re,t.Eventer=qo,t.Export=Uh,t.FileHelper=Wr,t.Filter=zh,t.FourNumberHelper=b,t.FrameData=tl,t.GroupData=$h,t.ImageData=dl,t.ImageEvent=Lo,t.ImageManager=Hr,t.IncrementId=s,t.LayoutEvent=zo,t.Layouter=Sh,t.LeafBounds=ba,t.LeafBoundsHelper=no,t.LeafData=f,t.LeafDataProxy=aa,t.LeafEventer=na,t.LeafHelper=$n,t.LeafLayout=ko,t.LeafLevelList=ah,t.LeafList=oh,t.LeafMatrix=pa,t.LeafRender=Ba,t.LeaferCanvas=lh,t.LeaferCanvasBase=be,t.LeaferData=Kh,t.LeaferEvent=No,t.LeaferImage=Jr,t.LineData=el,t.MathHelper=L,t.Matrix=lt,t.MatrixHelper=V,t.MyImage=sd,t.NeedConvertToCanvasCommandMap=Ce,t.OneRadian=E,t.PI2=O,t.PI_2=A,t.Paint=Mh,t.PaintGradient=Dh,t.PaintImage=Wh,t.PathArrow=Ah,t.PathBounds=kr,t.PathCommandDataHelper=pi,t.PathCommandMap=Se,t.PathConvert=Vs,t.PathCorner=Ir,t.PathCreator=Ii,t.PathData=ol,t.PathDrawer=ji,t.PathHelper=Be,t.PathNumberCommandLengthMap=Ie,t.PathNumberCommandMap=Le,t.PenData=al,t.Platform=e,t.Plugin=Zt,t.Point=at,t.PointHelper=st,t.PolygonData=rl,t.PropertyEvent=To,t.RectData=sl,t.RectHelper=Ee,t.RectRender=kl,t.RenderEvent=Uo,t.Renderer=Ch,t.ResizeEvent=Do,t.Resource=Yr,t.Run=Qt,t.StarData=nl,t.State=Nh,t.StringNumberMap=Xt,t.TaskItem=zr,t.TaskProcessor=Ur,t.TextConvert=Ih,t.TextData=ll,t.Transition=Yh,t.TwoPointBoundsHelper=ct,t.UIBounds=pl,t.UICreator=ee,t.UIData=Qh,t.UIRender=bl,t.UnitConvert=Oh,t.WaitHelper=po,t.WatchEvent=Fo,t.Watcher=ph,t.affectRenderBoundsType=mn,t.affectStrokeBoundsType=gn,t.attr=en,t.autoLayoutType=an,t.boundsType=dn,t.canvasPatch=Mr,t.canvasSizeAttrs=ve,t.createAttr=function(t){return(e,s)=>{$r(e,s,Kr(s,t))}},t.createDescriptor=Kr,t.cursorType=Pn,t.dataProcessor=Ln,t.dataType=rn,t.decorateLeafAttr=tn,t.defineDataProcessor=In,t.defineKey=$r,t.defineLeafAttr=sn,t.dimType=wn,t.doBoundsType=un,t.doStrokeType=fn,t.effectType=Th,t.emptyData={},t.eraserType=Cn,t.extraPropertyEventMap=Po,t.getBoundsData=W,t.getDescriptor=Zr,t.getMatrixData=D,t.getPointData=M,t.hitType=Tn,t.isArray=c,t.isData=function(t){return u(t)&&!c(t)},t.isEmptyData=_,t.isFinite=h,t.isNull=o,t.isNumber=l,t.isObject=u,t.isString=a,t.isUndefined=n,t.layoutProcessor=function(t){return(e,s)=>{$r(e,"__LayoutProcessor",{get:()=>t})}},t.leaferTransformAttrMap=jo,t.maskType=Rn,t.naturalBoundsType=cn,t.opacityType=vn,t.path=Er,t.pathInputType=_n,t.pathType=pn,t.pen=Or,t.positionType=nn,t.registerUI=zn,t.registerUIEvent=function(){return t=>{re.register(t)}},t.resizeType=Ph,t.rewrite=Mn,t.rewriteAble=Wn,t.rotationType=ln,t.scaleType=hn,t.scrollType=on,t.sortType=Sn,t.strokeType=yn,t.surfaceType=xn,t.tempBounds=Nt,t.tempMatrix=dt,t.tempPoint=ht,t.tryToNumber=function(t){return"string"==typeof t&&d.test(t)?+t:t},t.useCanvas=uh,t.useModule=Fn,t.version="1.9.8",t.visibleType=bn,t.zoomLayerType=Lh,t}({});function Leafer(t){return new LeaferUI.Leafer(t)}Object.setPrototypeOf(Leafer,LeaferUI),Leafer.prototype=LeaferUI.Leafer.prototype;
1
+ var LeaferUI=function(t){"use strict";const e={toURL(t,e){let s=encodeURIComponent(t);return"text"===e?s="data:text/plain;charset=utf-8,"+s:"svg"===e&&(s="data:image/svg+xml,"+s),s},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",getRealURL(t){const{prefix:s,suffix:i}=e.image;return!i||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+i),s&&"/"===t[0]&&(t=s+t),t}}},s={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=i;return e[t]?e[t]++:(e[t]=1,0)}},i=s;var r;t.Answer=void 0,(r=t.Answer||(t.Answer={}))[r.No=0]="No",r[r.Yes=1]="Yes",r[r.NoAndSkip=2]="NoAndSkip",r[r.YesAndSkip=3]="YesAndSkip";function o(t){return void 0===t}function n(t){return null==t}function a(t){return"string"==typeof t}const{isFinite:h}=Number;function l(t){return"number"==typeof t}const d=/^-?\d+(?:\.\d+)?$/;const{isArray:c}=Array;function u(t){return t&&"object"==typeof t}function _(t){return"{}"===JSON.stringify(t)}const p={default:(t,e)=>(f(e,t),f(t,e),t),assign(t,e,s){let i;Object.keys(e).forEach(r=>{var o,n;if(i=e[r],(null==i?void 0:i.constructor)===Object&&(null===(o=t[r])||void 0===o?void 0:o.constructor)===Object)return f(t[r],e[r],s&&s[r]);s&&r in s?(null===(n=s[r])||void 0===n?void 0:n.constructor)===Object&&f(t[r]={},e[r],s[r]):t[r]=e[r]})},copyAttrs:(t,e,s)=>(s.forEach(s=>{o(e[s])||(t[s]=e[s])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let s=0,i=t.length;s<i;s++)e[t[s]]=!0;return e},stintSet(t,e,s){s||(s=void 0),t[e]!==s&&(t[e]=s)}},{assign:f}=p;class g{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __usePathBox(){return this.__pathInputed}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(!o(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let s;for(let i in this)"_"!==i[0]&&(s=e?e[i]:void 0,t[i]=o(s)?this[i]:s);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(!o(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!o(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const s={};if(t)if(c(t))for(let e of t)s[e]=this.__getInput(e);else for(let e in t)s[e]=this.__getInput(e);else{let t,e,{__input:i}=this;s.tag=this.__leaf.tag;for(let r in this)if("_"!==r[0]&&(t=this["_"+r],!o(t))){if("path"===r&&!this.__pathInputed)continue;e=i?i[r]:void 0,s[r]=o(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:i,d:r,e:o,f:n}=this.__leaf.__localMatrix;s.matrix={a:t,b:e,c:i,d:r,e:o,f:n}}return s}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&(e.isBranch||t.__hasMultiPaint)||e.__hasEraser||t.eraser||t.filter?t.__single=!0:t.__single&&(t.__single=!1)}else t.__single=!0}__removeNaturalSize(){this.__naturalWidth=this.__naturalHeight=void 0}destroy(){this.__input=this.__middle=null}}let y,m,x;const{max:w}=Math,v=[0,0,0,0],b={zero:[...v],tempFour:v,set:(t,e,s,i,r)=>(void 0===s&&(s=i=r=e),t[0]=e,t[1]=s,t[2]=i,t[3]=r,t),setTemp:(t,e,s,i)=>B(v,t,e,s,i),toTempAB(t,e,s){x=s?l(t)?e:t:[],l(t)?(y=S(t),m=e):l(e)?(y=t,m=S(e)):(y=t,m=e),4!==y.length&&(y=k(y)),4!==m.length&&(m=k(m))},get(t,e){let s;if(!l(t))switch(t.length){case 4:s=o(e)?t:[...t];break;case 2:s=[t[0],t[1],t[0],t[1]];break;case 3:s=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(s||(s=[t,t,t,t]),!o(e))for(let t=0;t<4;t++)s[t]>e&&(s[t]=e);return s},max:(t,e,s)=>l(t)&&l(e)?w(t,e):(R(t,e,s),B(x,w(y[0],m[0]),w(y[1],m[1]),w(y[2],m[2]),w(y[3],m[3]))),add:(t,e,s)=>l(t)&&l(e)?t+e:(R(t,e,s),B(x,y[0]+m[0],y[1]+m[1],y[2]+m[2],y[3]+m[3])),swapAndScale(t,e,s,i){if(l(t))return e===s?t*e:[t*s,t*e];const r=i?t:[],[o,n,a,h]=4===t.length?t:k(t);return B(r,a*s,h*e,o*s,n*e)}},{set:B,get:k,setTemp:S,toTempAB:R}=b,{round:C,pow:T,PI:P}=Math,L={within:(t,e,s)=>(u(e)&&(s=e.max,e=e.min),!o(e)&&t<e&&(t=e),!o(s)&&t>s&&(t=s),t),fourNumber:b.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),L.float(t)),getGapRotation(t,e,s=0){let i=t+s;if(e>1){const t=Math.abs(i%e);(t<1||t>e-1)&&(i=Math.round(i/e)*e)}return i-s},float(t,e){const s=o(e)?1e12:T(10,e);return-0===(t=C(t*s)/s)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,s,i){if(i||(i={}),e){const t=(l(e)?e:e.width||0)/s.width,r=(l(e)?e:e.height||0)/s.height;i.scaleX=t||r||1,i.scaleY=r||t||1}else t&&L.assignScale(i,t);return i},assignScale(t,e){l(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},randInt:E,randColor:t=>`rgba(${E(255)},${E(255)},${E(255)},${t||1})`};function E(t){return Math.round(Math.random()*t)}const I=P/180,O=2*P,A=P/2;function W(){return{x:0,y:0}}function M(){return{x:0,y:0,width:0,height:0}}function D(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:F,cos:z,acos:U,sqrt:N}=Math,{float:Y}=L,X={};function H(){return Object.assign(Object.assign(Object.assign({},{a:1,b:0,c:0,d:1,e:0,f:0}),{x:0,y:0,width:0,height:0}),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0})}const G={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:H(),tempMatrix:{},set(t,e=1,s=0,i=0,r=1,o=0,n=0){t.a=e,t.b=s,t.c=i,t.d=r,t.e=o,t.f=n},get:D,getWorld:H,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,s){t.e+=e,t.f+=s},translateInner(t,e,s,i){t.e+=t.a*e+t.c*s,t.f+=t.b*e+t.d*s,i&&(t.e-=e,t.f-=s)},scale(t,e,s=e){t.a*=e,t.b*=e,t.c*=s,t.d*=s},pixelScale(t,e,s){s||(s=t),s.a=t.a*e,s.b=t.b*e,s.c=t.c*e,s.d=t.d*e,s.e=t.e*e,s.f=t.f*e},scaleOfOuter(t,e,s,i){V.toInnerPoint(t,e,X),V.scaleOfInner(t,X,s,i)},scaleOfInner(t,e,s,i=s){V.translateInner(t,e.x,e.y),V.scale(t,s,i),V.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:s,b:i,c:r,d:o}=t,n=z(e*=I),a=F(e);t.a=s*n-i*a,t.b=s*a+i*n,t.c=r*n-o*a,t.d=r*a+o*n},rotateOfOuter(t,e,s){V.toInnerPoint(t,e,X),V.rotateOfInner(t,X,s)},rotateOfInner(t,e,s){V.translateInner(t,e.x,e.y),V.rotate(t,s),V.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:i,b:r,c:o,d:n}=t;s&&(s*=I,t.a=i+o*s,t.b=r+n*s),e&&(e*=I,t.c=o+i*e,t.d=n+r*e)},skewOfOuter(t,e,s,i){V.toInnerPoint(t,e,X),V.skewOfInner(t,X,s,i)},skewOfInner(t,e,s,i=0){V.translateInner(t,e.x,e.y),V.skew(t,s,i),V.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:s,b:i,c:r,d:o,e:n,f:a}=t;t.a=e.a*s+e.b*r,t.b=e.a*i+e.b*o,t.c=e.c*s+e.d*r,t.d=e.c*i+e.d*o,t.e=e.e*s+e.f*r+n,t.f=e.e*i+e.f*o+a},multiplyParent(t,e,s,i,r){const{e:n,f:a}=t;if(s||(s=t),o(i)&&(i=1!==t.a||t.b||t.c||1!==t.d),i){const{a:i,b:o,c:n,d:a}=t;s.a=i*e.a+o*e.c,s.b=i*e.b+o*e.d,s.c=n*e.a+a*e.c,s.d=n*e.b+a*e.d,r&&(s.scaleX=e.scaleX*r.scaleX,s.scaleY=e.scaleY*r.scaleY)}else s.a=e.a,s.b=e.b,s.c=e.c,s.d=e.d,r&&(s.scaleX=e.scaleX,s.scaleY=e.scaleY);s.e=n*e.a+a*e.c+e.e,s.f=n*e.b+a*e.d+e.f},divide(t,e){V.multiply(t,V.tempInvert(e))},divideParent(t,e){V.multiplyParent(t,V.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=V;return V.copy(e,t),V.invert(e),e},invert(t){const{a:e,b:s,c:i,d:r,e:o,f:n}=t;if(s||i){const a=1/(e*r-s*i);t.a=r*a,t.b=-s*a,t.c=-i*a,t.d=e*a,t.e=-(o*r-n*i)*a,t.f=-(n*e-o*s)*a}else if(1===e&&1===r)t.e=-o,t.f=-n;else{const s=1/(e*r);t.a=r*s,t.d=e*s,t.e=-o*r*s,t.f=-n*e*s}},toOuterPoint(t,e,s,i){const{x:r,y:o}=e;s||(s=e),s.x=r*t.a+o*t.c,s.y=r*t.b+o*t.d,i||(s.x+=t.e,s.y+=t.f)},toInnerPoint(t,e,s,i){const{a:r,b:o,c:n,d:a}=t,h=1/(r*a-o*n),{x:l,y:d}=e;if(s||(s=e),s.x=(l*a-d*n)*h,s.y=(d*r-l*o)*h,!i){const{e:e,f:i}=t;s.x-=(e*a-i*n)*h,s.y-=(i*r-e*o)*h}},setLayout(t,e,s,i,r){const{x:n,y:a,scaleX:h,scaleY:l}=e;if(o(r)&&(r=e.rotation||e.skewX||e.skewY),r){const{rotation:s,skewX:i,skewY:r}=e,o=s*I,n=z(o),a=F(o);if(i||r){const e=i*I,s=r*I;t.a=(n+s*-a)*h,t.b=(a+s*n)*h,t.c=(e*n-a)*l,t.d=(n+e*a)*l}else t.a=n*h,t.b=a*h,t.c=-a*l,t.d=n*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=n,t.f=a,(s=s||i)&&V.translateInner(t,-s.x,-s.y,!i)},getLayout(t,e,s,i){const{a:r,b:o,c:n,d:a,e:h,f:l}=t;let d,c,u,_,p,f=h,g=l;if(o||n){const t=r*a-o*n;if(n&&!i){d=N(r*r+o*o),c=t/d;const e=r/d;u=o>0?U(e):-U(e)}else{c=N(n*n+a*a),d=t/c;const e=n/c;u=A-(a>0?U(-e):-U(e))}const e=Y(z(u)),s=F(u);d=Y(d),c=Y(c),_=e?Y((n/c+s)/e/I,9):0,p=e?Y((o/d-s)/e/I,9):0,u=Y(u/I)}else d=r,c=a,u=_=p=0;return(e=s||e)&&(f+=e.x*r+e.y*n,g+=e.x*o+e.y*a,s||(f-=e.x,g-=e.y)),{x:f,y:g,scaleX:d,scaleY:c,rotation:u,skewX:_,skewY:p}},withScale(t,e,s=e){const i=t;if(!e||!s){const{a:i,b:r,c:o,d:n}=t;r||o?s=(i*n-r*o)/(e=N(i*i+r*r)):(e=i,s=n)}return i.scaleX=e,i.scaleY=s,i},reset(t){V.set(t)}},V=G,{toInnerPoint:j,toOuterPoint:q}=G,{sin:Q,cos:J,abs:$,sqrt:Z,atan2:K,min:tt,round:et}=Math,st={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,s=0){t.x=e,t.y=s},setRadius(t,e,s){t.radiusX=e,t.radiusY=o(s)?e:s},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,s){t.x=e,t.y=s},round(t,e){t.x=e?et(t.x-.5)+.5:et(t.x),t.y=e?et(t.y-.5)+.5:et(t.y)},move(t,e,s){u(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=s)},scale(t,e,s=e){t.x&&(t.x*=e),t.y&&(t.y*=s)},scaleOf(t,e,s,i=s){t.x+=(t.x-e.x)*(s-1),t.y+=(t.y-e.y)*(i-1)},rotate(t,e,s){s||(s=it.defaultPoint);const i=J(e*=I),r=Q(e),o=t.x-s.x,n=t.y-s.y;t.x=s.x+o*i-n*r,t.y=s.y+o*r+n*i},tempToInnerOf(t,e){const{tempPoint:s}=it;return ot(s,t),j(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=it;return ot(s,t),q(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=it;return ot(s,t),it.toInnerRadiusPointOf(t,e,s),s},toInnerRadiusPointOf(t,e,s){s||(s=t),j(e,t,s),s.radiusX=Math.abs(t.radiusX/e.scaleX),s.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,s){j(e,t,s)},toOuterOf(t,e,s){q(e,t,s)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getCenterX:(t,e)=>t+(e-t)/2,getCenterY:(t,e)=>t+(e-t)/2,getDistance:(t,e)=>rt(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,s,i){const r=$(s-t),o=$(i-e);return Z(r*r+o*o)},getMinDistanceFrom:(t,e,s,i,r,o)=>tt(rt(t,e,s,i),rt(s,i,r,o)),getAngle:(t,e)=>nt(t,e)/I,getRotation:(t,e,s,i)=>(i||(i=e),it.getRadianFrom(t.x,t.y,e.x,e.y,s.x,s.y,i.x,i.y)/I),getRadianFrom(t,e,s,i,r,n,a,h){o(a)&&(a=s,h=i);const l=t-s,d=e-i,c=r-a,u=n-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>K(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s,i){const r=nt(t,e);return(e=i?e:{}).x=t.x+J(r)*s,e.y=t.y+Q(r)*s,e},toNumberPoints(t){let e=t;return u(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},reset(t){it.reset(t)}},it=st,{getDistanceFrom:rt,copy:ot,getAtan2:nt}=it;class at{constructor(t,e){this.set(t,e)}set(t,e){return u(t)?st.copy(this,t):st.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new at(this)}move(t,e){return st.move(this,t,e),this}scale(t,e){return st.scale(this,t,e),this}scaleOf(t,e,s){return st.scaleOf(this,t,e,s),this}rotate(t,e){return st.rotate(this,t,e),this}rotateOf(t,e){return st.rotate(this,e,t),this}getRotation(t,e,s){return st.getRotation(this,t,e,s)}toInnerOf(t,e){return st.toInnerOf(this,t,e),this}toOuterOf(t,e){return st.toOuterOf(this,t,e),this}getCenter(t){return new at(st.getCenter(this,t))}getDistance(t){return st.getDistance(this,t)}getDistancePoint(t,e,s){return new at(st.getDistancePoint(this,t,e,s))}getAngle(t){return st.getAngle(this,t)}getAtan2(t){return st.getAtan2(this,t)}reset(){return st.reset(this),this}}const ht=new at;class lt{constructor(t,e,s,i,r,o){this.set(t,e,s,i,r,o)}set(t,e,s,i,r,o){return u(t)?G.copy(this,t):G.set(this,t,e,s,i,r,o),this}setWith(t){return G.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:s,d:i,e:r,f:o}=this;return{a:t,b:e,c:s,d:i,e:r,f:o}}clone(){return new lt(this)}translate(t,e){return G.translate(this,t,e),this}translateInner(t,e){return G.translateInner(this,t,e),this}scale(t,e){return G.scale(this,t,e),this}scaleWith(t,e){return G.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return G.pixelScale(this,t),this}scaleOfOuter(t,e,s){return G.scaleOfOuter(this,t,e,s),this}scaleOfInner(t,e,s){return G.scaleOfInner(this,t,e,s),this}rotate(t){return G.rotate(this,t),this}rotateOfOuter(t,e){return G.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return G.rotateOfInner(this,t,e),this}skew(t,e){return G.skew(this,t,e),this}skewOfOuter(t,e,s){return G.skewOfOuter(this,t,e,s),this}skewOfInner(t,e,s){return G.skewOfInner(this,t,e,s),this}multiply(t){return G.multiply(this,t),this}multiplyParent(t){return G.multiplyParent(this,t),this}divide(t){return G.divide(this,t),this}divideParent(t){return G.divideParent(this,t),this}invert(){return G.invert(this),this}invertWith(){return G.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,s){G.toOuterPoint(this,t,e,s)}toInnerPoint(t,e,s){G.toInnerPoint(this,t,e,s)}setLayout(t,e,s){return G.setLayout(this,t,e,s),this}getLayout(t,e,s){return G.getLayout(this,t,e,s)}withScale(t,e){return G.withScale(this,t,e)}reset(){G.reset(this)}}const dt=new lt,ct={tempPointBounds:{},setPoint(t,e,s){t.minX=t.maxX=e,t.minY=t.maxY=s},addPoint(t,e,s){t.minX=e<t.minX?e:t.minX,t.minY=s<t.minY?s:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=s>t.maxY?s:t.maxY},addBounds(t,e,s,i,r){ut(t,e,s),ut(t,e+i,s+r)},copy(t,e){t.minX=e.minX,t.minY=e.minY,t.maxX=e.maxX,t.maxY=e.maxY},addPointBounds(t,e){t.minX=e.minX<t.minX?e.minX:t.minX,t.minY=e.minY<t.minY?e.minY:t.minY,t.maxX=e.maxX>t.maxX?e.maxX:t.maxX,t.maxY=e.maxY>t.maxY?e.maxY:t.maxY},toBounds(t,e){e.x=t.minX,e.y=t.minY,e.width=t.maxX-t.minX,e.height=t.maxY-t.minY}},{addPoint:ut}=ct;var _t,pt;t.Direction4=void 0,(_t=t.Direction4||(t.Direction4={}))[_t.top=0]="top",_t[_t.right=1]="right",_t[_t.bottom=2]="bottom",_t[_t.left=3]="left",t.Direction9=void 0,(pt=t.Direction9||(t.Direction9={}))[pt.topLeft=0]="topLeft",pt[pt.top=1]="top",pt[pt.topRight=2]="topRight",pt[pt.right=3]="right",pt[pt.bottomRight=4]="bottomRight",pt[pt.bottom=5]="bottom",pt[pt.bottomLeft=6]="bottomLeft",pt[pt.left=7]="left",pt[pt.center=8]="center",pt[pt["top-left"]=0]="top-left",pt[pt["top-right"]=2]="top-right",pt[pt["bottom-right"]=4]="bottom-right",pt[pt["bottom-left"]=6]="bottom-left";const ft=[{x:0,y:0},{x:.5,y:0},{x:1,y:0},{x:1,y:.5},{x:1,y:1},{x:.5,y:1},{x:0,y:1},{x:0,y:.5},{x:.5,y:.5}];ft.forEach(t=>t.type="percent");const gt={directionData:ft,tempPoint:{},get:yt,toPoint(t,e,s,i,r,o){const n=yt(t);s.x=n.x,s.y=n.y,"percent"===n.type&&(s.x*=e.width,s.y*=e.height,r&&(o||(s.x-=r.x,s.y-=r.y),n.x&&(s.x-=1===n.x?r.width:.5===n.x?n.x*r.width:0),n.y&&(s.y-=1===n.y?r.height:.5===n.y?n.y*r.height:0))),i||(s.x+=e.x,s.y+=e.y)},getPoint:(t,e,s)=>(s||(s={}),gt.toPoint(t,e,s,!0),s)};function yt(e){return a(e)?ft[t.Direction9[e]]:e}const{toPoint:mt}=gt,xt={toPoint(t,e,s,i,r,o){mt(t,s,i,r,e,o)}},{tempPointBounds:wt,setPoint:vt,addPoint:bt,toBounds:Bt}=ct,{toOuterPoint:kt}=G,{float:St,fourNumber:Rt}=L,{floor:Ct,ceil:Tt}=Math;let Pt,Lt,Et,It;const Ot={},At={},Wt={},Mt={tempBounds:Wt,set(t,e=0,s=0,i=0,r=0){t.x=e,t.y=s,t.width=i,t.height=r},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,s,i,r){const{x:o,y:n,width:a,height:h}=e;if(c(s)){const e=Rt(s);i?Dt.set(t,o+e[3],n+e[0],a-e[1]-e[3],h-e[2]-e[0]):Dt.set(t,o-e[3],n-e[0],a+e[1]+e[3],h+e[2]+e[0])}else i&&(s=-s),Dt.set(t,o-s,n-s,a+2*s,h+2*s);r&&("width"===r?(t.y=n,t.height=h):(t.x=o,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,s){t.x+=e,t.y+=s},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,s)=>(t=Object.assign({},t),Dt.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?zt(e,t):e=t,s||(s=t),e.offsetX=Dt.maxX(s),e.offsetY=Dt.maxY(s),Dt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,s=e,i){i||st.scale(t,e,s),t.width*=e,t.height*=s},scaleOf(t,e,s,i=s){st.scaleOf(t,e,s,i),t.width*=s,t.height*=i},tempToOuterOf:(t,e)=>(Dt.copy(Wt,t),Dt.toOuterOf(Wt,e),Wt),getOuterOf:(t,e)=>(t=Object.assign({},t),Dt.toOuterOf(t,e),t),toOuterOf(t,e,s){if(s||(s=t),0===e.b&&0===e.c){const{a:i,d:r}=e;i>0?(s.width=t.width*i,s.x=e.e+t.x*i):(s.width=t.width*-i,s.x=e.e+t.x*i-s.width),r>0?(s.height=t.height*r,s.y=e.f+t.y*r):(s.height=t.height*-r,s.y=e.f+t.y*r-s.height)}else Ot.x=t.x,Ot.y=t.y,kt(e,Ot,At),vt(wt,At.x,At.y),Ot.x=t.x+t.width,kt(e,Ot,At),bt(wt,At.x,At.y),Ot.y=t.y+t.height,kt(e,Ot,At),bt(wt,At.x,At.y),Ot.x=t.x,kt(e,Ot,At),bt(wt,At.x,At.y),Bt(wt,s)},toInnerOf(t,e,s){s||(s=t),Dt.move(s,-e.e,-e.f),Dt.scale(s,1/e.a,1/e.d)},getFitMatrix(t,e,s=1){const i=Math.min(s,Dt.getFitScale(t,e));return new lt(i,0,0,i,-e.x*i,-e.y*i)},getFitScale(t,e,s){const i=t.width/e.width,r=t.height/e.height;return s?Math.max(i,r):Math.min(i,r)},put(t,e,s="center",i=1,r=!0,o){o||(o=e),a(i)&&(i=Dt.getFitScale(t,e,"cover"===i)),Wt.width=r?e.width*=i:e.width*i,Wt.height=r?e.height*=i:e.height*i,xt.toPoint(s,Wt,t,o,!0,!0)},getSpread(t,e,s){const i={};return Dt.copyAndSpread(i,t,e,!1,s),i},spread(t,e,s){Dt.copyAndSpread(t,t,e,!1,s)},shrink(t,e,s){Dt.copyAndSpread(t,t,e,!0,s)},ceil(t){const{x:e,y:s}=t;t.x=Ct(t.x),t.y=Ct(t.y),t.width=e>t.x?Tt(t.width+e-t.x):Tt(t.width),t.height=s>t.y?Tt(t.height+s-t.y):Tt(t.height)},unsign(t){t.width<0&&(t.x+=t.width,t.width=-t.width),t.height<0&&(t.y+=t.height,t.height=-t.height)},float(t,e){t.x=St(t.x,e),t.y=St(t.y,e),t.width=St(t.width,e),t.height=St(t.height,e)},add(t,e,s){Pt=t.x+t.width,Lt=t.y+t.height,Et=e.x,It=e.y,s||(Et+=e.width,It+=e.height),Pt=Pt>Et?Pt:Et,Lt=Lt>It?Lt:It,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=Pt-t.x,t.height=Lt-t.y},addList(t,e){Dt.setListWithFn(t,e,void 0,!0)},setList(t,e,s=!1){Dt.setListWithFn(t,e,void 0,s)},addListWithFn(t,e,s){Dt.setListWithFn(t,e,s,!0)},setListWithFn(t,e,s,i=!1){let r,o=!0;for(let n=0,a=e.length;n<a;n++)r=s?s(e[n],n):e[n],r&&(r.width||r.height)&&(o?(o=!1,i||zt(t,r)):Ft(t,r));o&&Dt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?vt(wt,t.x,t.y):bt(wt,t.x,t.y)),Bt(wt,t)},setPoint(t,e){Dt.set(t,e.x,e.y)},addPoint(t,e){Ft(t,e,!0)},getPoints(t){const{x:e,y:s,width:i,height:r}=t;return[{x:e,y:s},{x:e+i,y:s},{x:e+i,y:s+r},{x:e,y:s+r}]},hitRadiusPoint:(t,e,s)=>(s&&(e=st.tempToInnerRadiusPointOf(e,s)),e.x>=t.x-e.radiusX&&e.x<=t.x+t.width+e.radiusX&&e.y>=t.y-e.radiusY&&e.y<=t.y+t.height+e.radiusY),hitPoint:(t,e,s)=>(s&&(e=st.tempToInnerOf(e,s)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,s)=>(s&&(e=Dt.tempToOuterOf(e,s)),!(t.y+t.height<e.y||e.y+e.height<t.y||t.x+t.width<e.x||e.x+e.width<t.x)),includes:(t,e,s)=>(s&&(e=Dt.tempToOuterOf(e,s)),t.x<=e.x&&t.y<=e.y&&t.x+t.width>=e.x+e.width&&t.y+t.height>=e.y+e.height),getIntersectData(t,e,s){if(s&&(e=Dt.tempToOuterOf(e,s)),!Dt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:i,y:r,width:o,height:n}=e;return Pt=i+o,Lt=r+n,Et=t.x+t.width,It=t.y+t.height,i=i>t.x?i:t.x,r=r>t.y?r:t.y,Pt=Pt<Et?Pt:Et,Lt=Lt<It?Lt:It,o=Pt-i,n=Lt-r,{x:i,y:r,width:o,height:n}},intersect(t,e,s){Dt.copy(t,Dt.getIntersectData(t,e,s))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,reset(t){Dt.set(t)}},Dt=Mt,{add:Ft,copy:zt}=Dt;class Ut{get minX(){return Mt.minX(this)}get minY(){return Mt.minY(this)}get maxX(){return Mt.maxX(this)}get maxY(){return Mt.maxY(this)}constructor(t,e,s,i){this.set(t,e,s,i)}set(t,e,s,i){return u(t)?Mt.copy(this,t):Mt.set(this,t,e,s,i),this}get(){const{x:t,y:e,width:s,height:i}=this;return{x:t,y:e,width:s,height:i}}clone(){return new Ut(this)}move(t,e){return Mt.move(this,t,e),this}scale(t,e,s){return Mt.scale(this,t,e,s),this}scaleOf(t,e,s){return Mt.scaleOf(this,t,e,s),this}toOuterOf(t,e){return Mt.toOuterOf(this,t,e),this}toInnerOf(t,e){return Mt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Mt.getFitMatrix(this,t,e)}put(t,e,s){Mt.put(this,t,e,s)}spread(t,e){return Mt.spread(this,t,e),this}shrink(t,e){return Mt.shrink(this,t,e),this}ceil(){return Mt.ceil(this),this}unsign(){return Mt.unsign(this),this}float(t){return Mt.float(this,t),this}add(t){return Mt.add(this,t),this}addList(t){return Mt.setList(this,t,!0),this}setList(t){return Mt.setList(this,t),this}addListWithFn(t,e){return Mt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Mt.setListWithFn(this,t,e),this}setPoint(t){return Mt.setPoint(this,t),this}setPoints(t){return Mt.setPoints(this,t),this}addPoint(t){return Mt.addPoint(this,t),this}getPoints(){return Mt.getPoints(this)}hitPoint(t,e){return Mt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Mt.hitRadiusPoint(this,t,e)}hit(t,e){return Mt.hit(this,t,e)}includes(t,e){return Mt.includes(this,t,e)}intersect(t,e){return Mt.intersect(this,t,e),this}getIntersect(t,e){return new Ut(Mt.getIntersectData(this,t,e))}isSame(t){return Mt.isSame(this,t)}isEmpty(){return Mt.isEmpty(this)}reset(){Mt.reset(this)}}const Nt=new Ut;class Yt{constructor(t,e,s,i,r,o){u(t)?this.copy(t):this.set(t,e,s,i,r,o)}set(t=0,e=0,s=0,i=0,r=0,o=0){this.top=t,this.right=e,this.bottom=s,this.left=i,this.width=r,this.height=o}copy(t){const{top:e,right:s,bottom:i,left:r,width:o,height:n}=t;this.set(e,s,i,r,o,n)}getBoundsFrom(t){const{top:e,right:s,bottom:i,left:r,width:o,height:n}=this;return new Ut(r,e,o||t.width-r-s,n||t.height-e-i)}}const Xt={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1},{randColor:Ht}=L;class Gt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new Gt(t)}static set filter(t){this.filterList=Vt(t)}static set exclude(t){this.excludeList=Vt(t)}static drawRepaint(t,e){const s=Ht();t.fillWorld(e,s.replace("1)",".1)")),t.strokeWorld(e,s)}static drawBounds(t,e,s){const i="hit"===Gt.showBounds,r=t.__nowWorld,o=Ht();i&&(e.setWorld(r),t.__drawHitPath(e),e.fillStyle=o.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(o,2),i?e.stroke():e.strokeWorld(r,o)}log(...t){if(jt.enable){if(jt.filterList.length&&jt.filterList.every(t=>t!==this.name))return;if(jt.excludeList.length&&jt.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){jt.enable&&this.warn(...t)}warn(...t){jt.showWarn&&console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(this.warn("repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}function Vt(t){return t?a(t)&&(t=[t]):t=[],t}Gt.filterList=[],Gt.excludeList=[],Gt.showWarn=!0;const jt=Gt,qt=Gt.get("RunTime"),Qt={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=s.create(s.RUNTIME);return Jt.currentId=Jt.idMap[i]=e?performance.now():Date.now(),Jt.currentName=Jt.nameMap[i]=t,Jt.nameToIdMap[t]=i,i},end(t,e){const s=Jt.idMap[t],i=Jt.nameMap[t],r=e?(performance.now()-s)/1e3:Date.now()-s;Jt.idMap[t]=Jt.nameMap[t]=Jt.nameToIdMap[i]=void 0,qt.log(i,r,"ms")},endOfName(t,e){const s=Jt.nameToIdMap[t];o(s)||Jt.end(s,e)}},Jt=Qt,$t=[],Zt={list:{},add(t,...e){this.list[t]=!0,$t.push(...e)},has(t,e){const s=this.list[t];return!s&&e&&this.need(t),s},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout(()=>$t.forEach(t=>Zt.has(t,!0)));const Kt={editor:t=>Zt.need("editor")},te=Gt.get("UICreator"),ee={list:{},register(t){const{__tag:e}=t.prototype;se[e]&&te.repeat(e),se[e]=t},get(t,e,s,i,r,n){se[t]||te.error("not register "+t);const a=new se[t](e);return o(s)||(a.x=s,i&&(a.y=i),r&&(a.width=r),n&&(a.height=n)),a}},{list:se}=ee,ie=Gt.get("EventCreator"),re={nameList:{},register(t){let e;Object.keys(t).forEach(s=>{e=t[s],a(e)&&(oe[e]&&ie.repeat(e),oe[e]=t)})},changeName(t,e){const s=oe[t];if(s){const i=Object.keys(s).find(e=>s[e]===t);i&&(s[i]=e,oe[e]=s)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new oe[t](...e)},{nameList:oe}=re;class ne{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:s}=this;for(let i=0,r=s.length;i<r;i++)if(e=s[i],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const i=Kt.canvas(t);return this.add(i),i}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let s=0,i=this.list.length;s<i;s++)t=this.list[s],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach(t=>{t.destroy()}),this.list.length=0}destroy(){this.clear()}}function ae(t,e,s,i){var r,o=arguments.length,n=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(n=(o<3?r(n):o>3?r(e,s,n):r(e,s))||n);return o>3&&n&&Object.defineProperty(e,s,n),n}function he(t,e,s,i){return new(s||(s=Promise))(function(r,o){function n(t){try{h(i.next(t))}catch(t){o(t)}}function a(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s(function(t){t(e)})).then(n,a)}h((i=i.apply(t,e||[])).next())})}function le(t){return(e,s)=>{t||(t=s);const i={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===s&&(i.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,s,i)}}"function"==typeof SuppressedError&&SuppressedError;const de=[];function ce(){return(t,e)=>{de.push(e)}}const ue=[];class _e{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||ue)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;de.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,s,i,r,o){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,s,i,r,o){u(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,s,i,r,o)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,s,i){}strokeRect(t,e,s,i){}clearRect(t,e,s,i){}drawImage(t,e,s,i,r,o,n,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/i*a;i+=e,e=0,o+=t,a-=t}if(s<0){const t=-s/r*h;r+=s,s=0,n+=t,h-=t}this.context.drawImage(t,e,s,i,r,o,n,a,h);break;case 5:this.context.drawImage(t,e,s,i,r);break;case 3:this.context.drawImage(t,e,s)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,s,i,r,o){}quadraticCurveTo(t,e,s,i){}closePath(){}arc(t,e,s,i,r,o){}arcTo(t,e,s,i,r){}ellipse(t,e,s,i,r,o,n,a){}rect(t,e,s,i){}roundRect(t,e,s,i,r){}createConicGradient(t,e,s){}createLinearGradient(t,e,s,i){}createPattern(t,e){}createRadialGradient(t,e,s,i,r,o){}fillText(t,e,s,i){}measureText(t){}strokeText(t,e,s,i){}destroy(){this.context=null}}ae([le("imageSmoothingEnabled")],_e.prototype,"smooth",void 0),ae([le("imageSmoothingQuality")],_e.prototype,"smoothLevel",void 0),ae([le("globalAlpha")],_e.prototype,"opacity",void 0),ae([le()],_e.prototype,"fillStyle",void 0),ae([le()],_e.prototype,"strokeStyle",void 0),ae([le("lineWidth")],_e.prototype,"strokeWidth",void 0),ae([le("lineCap")],_e.prototype,"strokeCap",void 0),ae([le("lineJoin")],_e.prototype,"strokeJoin",void 0),ae([le("lineDashOffset")],_e.prototype,"dashOffset",void 0),ae([le()],_e.prototype,"miterLimit",void 0),ae([le()],_e.prototype,"shadowBlur",void 0),ae([le()],_e.prototype,"shadowColor",void 0),ae([le()],_e.prototype,"shadowOffsetX",void 0),ae([le()],_e.prototype,"shadowOffsetY",void 0),ae([le()],_e.prototype,"filter",void 0),ae([le()],_e.prototype,"font",void 0),ae([le()],_e.prototype,"fontKerning",void 0),ae([le()],_e.prototype,"fontStretch",void 0),ae([le()],_e.prototype,"fontVariantCaps",void 0),ae([le()],_e.prototype,"textAlign",void 0),ae([le()],_e.prototype,"textBaseline",void 0),ae([le()],_e.prototype,"textRendering",void 0),ae([le()],_e.prototype,"wordSpacing",void 0),ae([le()],_e.prototype,"letterSpacing",void 0),ae([le()],_e.prototype,"direction",void 0),ae([ce()],_e.prototype,"setTransform",null),ae([ce()],_e.prototype,"resetTransform",null),ae([ce()],_e.prototype,"getTransform",null),ae([ce()],_e.prototype,"save",null),ae([ce()],_e.prototype,"restore",null),ae([ce()],_e.prototype,"translate",null),ae([ce()],_e.prototype,"scale",null),ae([ce()],_e.prototype,"rotate",null),ae([ce()],_e.prototype,"fill",null),ae([ce()],_e.prototype,"stroke",null),ae([ce()],_e.prototype,"clip",null),ae([ce()],_e.prototype,"fillRect",null),ae([ce()],_e.prototype,"strokeRect",null),ae([ce()],_e.prototype,"clearRect",null),ae([ce()],_e.prototype,"beginPath",null),ae([ce()],_e.prototype,"moveTo",null),ae([ce()],_e.prototype,"lineTo",null),ae([ce()],_e.prototype,"bezierCurveTo",null),ae([ce()],_e.prototype,"quadraticCurveTo",null),ae([ce()],_e.prototype,"closePath",null),ae([ce()],_e.prototype,"arc",null),ae([ce()],_e.prototype,"arcTo",null),ae([ce()],_e.prototype,"ellipse",null),ae([ce()],_e.prototype,"rect",null),ae([ce()],_e.prototype,"roundRect",null),ae([ce()],_e.prototype,"createConicGradient",null),ae([ce()],_e.prototype,"createLinearGradient",null),ae([ce()],_e.prototype,"createPattern",null),ae([ce()],_e.prototype,"createRadialGradient",null),ae([ce()],_e.prototype,"fillText",null),ae([ce()],_e.prototype,"measureText",null),ae([ce()],_e.prototype,"strokeText",null);const{copy:pe,multiplyParent:fe,pixelScale:ge}=G,{round:ye}=Math,me=new Ut,xe=new Ut,we={width:1,height:1,pixelRatio:1},ve=["width","height","pixelRatio"];class be extends _e{get width(){return this.size.width}get height(){return this.size.height}get pixelRatio(){return this.size.pixelRatio}get pixelWidth(){return this.width*this.pixelRatio||0}get pixelHeight(){return this.height*this.pixelRatio||0}get pixelSnap(){return this.config.pixelSnap}set pixelSnap(t){this.config.pixelSnap=t}get allowBackgroundColor(){return this.view&&this.parentView}constructor(t,i){super(),this.size={},this.worldTransform={},t||(t=we),this.manager=i,this.innerId=s.create(s.CNAVAS);const{width:r,height:o,pixelRatio:n}=t;this.autoLayout=!r||!o,this.size.pixelRatio=n||e.devicePixelRatio,this.config=t,this.init()}init(){}__createContext(){const{view:t}=this,{contextSettings:e}=this.config;this.context=e?t.getContext("2d",e):t.getContext("2d"),this.__bindContext()}export(t,e){}toBlob(t,e){}toDataURL(t,e){}saveAs(t,e){}resize(t,e=!0){if(this.isSameSize(t))return;let s;this.context&&!this.unreal&&e&&this.width&&(s=this.getSameCanvas(),s.copyWorld(this));const i=this.size;p.copyAttrs(i,t,ve),ve.forEach(t=>i[t]||(i[t]=1)),this.bounds=new Ut(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!this.unreal&&s&&(this.clearWorld(s.bounds),this.copyWorld(s),s.recycle()))}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:s,pixelSnap:i}=this,r=this.worldTransform;e&&fe(t,e,r),ge(t,s,r),i&&!t.ignorePixelSnap&&(t.half&&t.half*s%2?(r.e=ye(r.e-.5)+.5,r.f=ye(r.f-.5)+.5):(r.e=ye(r.e),r.f=ye(r.f))),this.setTransform(r.a,r.b,r.c,r.d,r.e,r.f)}useWorldTransform(t){t&&(this.worldTransform=t);const e=this.worldTransform;e&&this.setTransform(e.a,e.b,e.c,e.d,e.e,e.f)}setStroke(t,e,s,i){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),s&&this.setStrokeOptions(s,i)}setStrokeOptions(t,e){let{strokeCap:s,strokeJoin:i,dashPattern:r,dashOffset:n,miterLimit:a}=t;e&&(e.strokeCap&&(s=e.strokeCap),e.strokeJoin&&(i=e.strokeJoin),o(e.dashPattern)||(r=e.dashPattern),o(e.dashOffset)||(n=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=s,this.strokeJoin=i,this.dashPattern=r,this.dashOffset=n,this.miterLimit=a}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return!0}hitStroke(t,e){return!0}hitPixel(t,e,s=1){return!0}setWorldShadow(t,e,s,i){const{pixelRatio:r}=this;this.shadowOffsetX=t*r,this.shadowOffsetY=e*r,this.shadowBlur=s*r,this.shadowColor=i||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,s,i,r=!0){i&&(this.blendMode=i),e?(this.setTempPixelBounds(e,r),s?(this.setTempPixelBounds2(s,r),s=xe):s=me,this.drawImage(t.view,me.x,me.y,me.width,me.height,s.x,s.y,s.width,s.height)):this.drawImage(t.view,0,0),i&&(this.blendMode="source-over")}copyWorldToInner(t,e,s,i,r=!0){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Mt.tempToOuterOf(s,e),i,r),this.restore()):(i&&(this.blendMode=i),this.setTempPixelBounds(e,r),this.drawImage(t.view,me.x,me.y,me.width,me.height,s.x,s.y,s.width,s.height),i&&(this.blendMode="source-over"))}copyWorldByReset(t,e,s,i,r,o=!0){this.resetTransform(),this.copyWorld(t,e,s,i,o),r||this.useWorldTransform()}useGrayscaleAlpha(t){let e,s;this.setTempPixelBounds(t,!0,!0);const{context:i}=this,r=i.getImageData(me.x,me.y,me.width,me.height),{data:o}=r;for(let t=0,i=o.length;t<i;t+=4)s=.299*o[t]+.587*o[t+1]+.114*o[t+2],(e=o[t+3])&&(o[t+3]=255===e?s:e*(s/255));i.putImageData(r,me.x,me.y)}useMask(t,e,s){this.copyWorld(t,e,s,"destination-in")}useEraser(t,e,s){this.copyWorld(t,e,s,"destination-out")}fillWorld(t,e,s,i){s&&(this.blendMode=s),this.fillStyle=e,this.setTempPixelBounds(t,i),this.fillRect(me.x,me.y,me.width,me.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s,i){s&&(this.blendMode=s),this.strokeStyle=e,this.setTempPixelBounds(t,i),this.strokeRect(me.x,me.y,me.width,me.height),s&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(me.x,me.y,me.width,me.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(me.x,me.y,me.width,me.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,s){this.copyToPixelBounds(me,t,e,s)}setTempPixelBounds2(t,e,s){this.copyToPixelBounds(xe,t,e,s)}copyToPixelBounds(t,e,s,i){t.set(e),i&&t.intersect(this.bounds),t.scale(this.pixelRatio),s&&t.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:s,pixelSnap:i}=this,r=this.manager?this.manager.get(s):Kt.canvas(Object.assign({},s));return r.save(),t&&(pe(r.worldTransform,this.worldTransform),r.useWorldTransform()),e&&(r.smooth=this.smooth),r.pixelSnap!==i&&(r.pixelSnap=i),r}recycle(t){this.recycled||(this.restore(),t?this.clearWorld(t):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(t){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const Be={creator:{},parse(t,e){},convertToCanvasData(t,e){}},ke={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Se=Object.assign({M:1,m:10,L:2,l:20,H:3,h:30,V:4,v:40,C:5,c:50,S:6,s:60,Q:7,q:70,T:8,t:80,A:9,a:90,Z:11,z:11,R:12},ke),Re={M:3,m:3,L:3,l:3,H:2,h:2,V:2,v:2,C:7,c:7,S:5,s:5,Q:5,q:5,T:3,t:3,A:8,a:8,Z:1,z:1,N:5,D:9,X:6,G:9,F:5,O:7,P:4,U:6},Ce={m:10,l:20,H:3,h:30,V:4,v:40,c:50,S:6,s:60,q:70,T:8,t:80,A:9,a:90},Te=Object.assign(Object.assign({},Ce),ke),Pe=Se,Le={};for(let t in Pe)Le[Pe[t]]=t;const Ee={};for(let t in Pe)Ee[Pe[t]]=Re[t];const Ie={drawRoundRect(t,e,s,i,r,o){const n=L.fourNumber(o,Math.min(i/2,r/2)),a=e+i,h=s+r;n[0]?t.moveTo(e+n[0],s):t.moveTo(e,s),n[1]?t.arcTo(a,s,a,h,n[1]):t.lineTo(a,s),n[2]?t.arcTo(a,h,e,h,n[2]):t.lineTo(a,h),n[3]?t.arcTo(e,h,e,s,n[3]):t.lineTo(e,h),n[0]?t.arcTo(e,s,a,s,n[0]):t.lineTo(e,s)}},{sin:Oe,cos:Ae,hypot:We,atan2:Me,ceil:De,abs:Fe,PI:ze,sqrt:Ue,pow:Ne}=Math,{setPoint:Ye,addPoint:Xe}=ct,{set:He,toNumberPoints:Ge}=st,{M:Ve,L:je,C:qe,Q:Qe,Z:Je}=Se,$e={},Ze={points(t,e,s,i){let r=Ge(e);if(t.push(Ve,r[0],r[1]),s&&r.length>5){let e,o,n,a,h,l,d,c,u,_,p,f,g,y=r.length;const m=!0===s?.5:s;i&&(r=[r[y-2],r[y-1],...r,r[0],r[1],r[2],r[3]],y=r.length);for(let s=2;s<y-2;s+=2)e=r[s-2],o=r[s-1],n=r[s],a=r[s+1],h=r[s+2],l=r[s+3],p=Ue(Ne(n-e,2)+Ne(a-o,2)),f=Ue(Ne(h-n,2)+Ne(l-a,2)),(p||f)&&(g=p+f,p=m*p/g,f=m*f/g,h-=e,l-=o,d=n-p*h,c=a-p*l,2===s?i||t.push(Qe,d,c,n,a):t.push(qe,u,_,d,c,n,a),u=n+f*h,_=a+f*l);i||t.push(Qe,u,_,r[y-2],r[y-1])}else for(let e=2,s=r.length;e<s;e+=2)t.push(je,r[e],r[e+1]);i&&t.push(Je)},rect(t,e,s,i,r){Be.creator.path=t,Be.creator.moveTo(e,s).lineTo(e+i,s).lineTo(e+i,s+r).lineTo(e,s+r).lineTo(e,s)},roundRect(t,e,s,i,r,o){Be.creator.path=[],Ie.drawRoundRect(Be.creator,e,s,i,r,o),t.push(...Be.convertToCanvasData(Be.creator.path,!0))},arcTo(t,e,s,i,r,o,n,a,h,l,d){const c=i-e,u=r-s,_=o-i,p=n-r;let f=Me(u,c),g=Me(p,_);const y=We(c,u),m=We(_,p);let x=g-f;if(x<0&&(x+=O),y<1e-12||m<1e-12||x<1e-12||Fe(x-ze)<1e-12)return t&&t.push(je,i,r),h&&(Ye(h,e,s),Xe(h,i,r)),d&&He(d,e,s),void(l&&He(l,i,r));const w=c*p-_*u<0,v=w?-1:1,b=a/Ae(x/2),B=i+b*Ae(f+x/2+A*v),k=r+b*Oe(f+x/2+A*v);return f-=A*v,g-=A*v,es(t,B,k,a,a,0,f/I,g/I,w,h,l,d)},arc:(t,e,s,i,r,o,n,a,h,l)=>es(t,e,s,i,i,0,r,o,n,a,h,l),ellipse(t,e,s,i,r,o,n,a,h,l,d,c){const u=o*I,_=Oe(u),p=Ae(u);let f=n*I,g=a*I;f>ze&&(f-=O),g<0&&(g+=O);let y=g-f;y<0?y+=O:y>O&&(y-=O),h&&(y-=O);const m=De(Fe(y/A)),x=y/m,w=Oe(x/4),v=8/3*w*w/Oe(x/2);g=f+x;let b,B,k,S,R,C,T,P,L=Ae(f),E=Oe(f),W=k=p*i*L-_*r*E,M=S=_*i*L+p*r*E,D=e+k,F=s+S;t&&t.push(t.length?je:Ve,D,F),l&&Ye(l,D,F),c&&He(c,D,F);for(let o=0;o<m;o++)b=Ae(g),B=Oe(g),k=p*i*b-_*r*B,S=_*i*b+p*r*B,R=e+W-v*(p*i*E+_*r*L),C=s+M-v*(_*i*E-p*r*L),T=e+k+v*(p*i*B+_*r*b),P=s+S+v*(_*i*B-p*r*b),t&&t.push(qe,R,C,T,P,e+k,s+S),l&&ts(e+W,s+M,R,C,T,P,e+k,s+S,l,!0),W=k,M=S,L=b,E=B,f=g,g+=x;d&&He(d,e+k,s+S)},quadraticCurveTo(t,e,s,i,r,o,n){t.push(qe,(e+2*i)/3,(s+2*r)/3,(o+2*i)/3,(n+2*r)/3,o,n)},toTwoPointBoundsByQuadraticCurve(t,e,s,i,r,o,n,a){ts(t,e,(t+2*s)/3,(e+2*i)/3,(r+2*s)/3,(o+2*i)/3,r,o,n,a)},toTwoPointBounds(t,e,s,i,r,o,n,a,h,l){const d=[];let c,u,_,p,f,g,y,m,x=t,w=s,v=r,b=n;for(let t=0;t<2;++t)if(1==t&&(x=e,w=i,v=o,b=a),c=-3*x+9*w-9*v+3*b,u=6*x-12*w+6*v,_=3*w-3*x,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;p=-_/u,0<p&&p<1&&d.push(p)}else y=u*u-4*_*c,m=Math.sqrt(y),y<0||(f=(-u+m)/(2*c),0<f&&f<1&&d.push(f),g=(-u-m)/(2*c),0<g&&g<1&&d.push(g));l?Xe(h,t,e):Ye(h,t,e),Xe(h,n,a);for(let l=0,c=d.length;l<c;l++)Ke(d[l],t,e,s,i,r,o,n,a,$e),Xe(h,$e.x,$e.y)},getPointAndSet(t,e,s,i,r,o,n,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,_=3*d*t*t,p=t*t*t;l.x=c*e+u*i+_*o+p*a,l.y=c*s+u*r+_*n+p*h},getPoint(t,e,s,i,r,o,n,a,h){const l={};return Ke(t,e,s,i,r,o,n,a,h,l),l},getDerivative(t,e,s,i,r){const o=1-t;return 3*o*o*(s-e)+6*o*t*(i-s)+3*t*t*(r-i)}},{getPointAndSet:Ke,toTwoPointBounds:ts,ellipse:es}=Ze,{sin:ss,cos:is,sqrt:rs,atan2:os}=Math,{ellipse:ns}=Ze,as={ellipticalArc(t,s,i,r,o,n,a,h,l,d,c){const u=(l-s)/2,_=(d-i)/2,p=n*I,f=ss(p),g=is(p),y=-g*u-f*_,m=-g*_+f*u,x=r*r,w=o*o,v=m*m,b=y*y,B=x*w-x*v-w*b;let k=0;if(B<0){const t=rs(1-B/(x*w));r*=t,o*=t}else k=(a===h?-1:1)*rs(B/(x*v+w*b));const S=k*r*m/o,R=-k*o*y/r,C=os((m-R)/o,(y-S)/r),T=os((-m-R)/o,(-y-S)/r);let P=T-C;0===h&&P>0?P-=O:1===h&&P<0&&(P+=O);const L=s+u+g*S-f*R,E=i+_+f*S+g*R,A=P<0?1:0;c||e.ellipseToCurve?ns(t,L,E,r,o,n,C/I,T/I,A):r!==o||n?t.push(Se.G,L,E,r,o,n,C/I,T/I,A):t.push(Se.O,L,E,r,C/I,T/I,A)}},{M:hs,m:ls,L:ds,l:cs,H:us,h:_s,V:ps,v:fs,C:gs,c:ys,S:ms,s:xs,Q:ws,q:vs,T:bs,t:Bs,A:ks,a:Ss,Z:Rs,z:Cs,N:Ts,D:Ps,X:Ls,G:Es,F:Is,O:Os,P:As,U:Ws}=Se,{rect:Ms,roundRect:Ds,arcTo:Fs,arc:zs,ellipse:Us,quadraticCurveTo:Ns}=Ze,{ellipticalArc:Ys}=as,Xs=Gt.get("PathConvert"),Hs={},Gs={current:{dot:0},stringify(t,e){let s,i,r,o=0,n=t.length,a="";for(;o<n;){i=t[o],s=Ee[i],a+=i===r?" ":Le[i];for(let i=1;i<s;i++)a+=L.float(t[o+i],e),i===s-1||(a+=" ");r=i,o+=s}return a},parse(t,e){let s,i,r,o="";const n=[],a=e?Te:Ce;for(let e=0,h=t.length;e<h;e++)i=t[e],Xt[i]?("."===i&&(Vs.dot&&(js(n,o),o=""),Vs.dot++),"0"===o&&"."!==i&&(js(n,o),o=""),o+=i):Se[i]?(o&&(js(n,o),o=""),Vs.name=Se[i],Vs.length=Re[i],Vs.index=0,js(n,Vs.name),!s&&a[i]&&(s=!0)):"-"===i||"+"===i?"e"===r||"E"===r?o+=i:(o&&js(n,o),o=i):o&&(js(n,o),o=""),r=i;return o&&js(n,o),s?Gs.toCanvasData(n,e):n},toCanvasData(t,e){let s,i,r,o,n,a=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(r=t[c],r){case ls:t[c+1]+=a,t[c+2]+=h;case hs:a=t[c+1],h=t[c+2],_.push(hs,a,h),c+=3;break;case _s:t[c+1]+=a;case us:a=t[c+1],_.push(ds,a,h),c+=2;break;case fs:t[c+1]+=h;case ps:h=t[c+1],_.push(ds,a,h),c+=2;break;case cs:t[c+1]+=a,t[c+2]+=h;case ds:a=t[c+1],h=t[c+2],_.push(ds,a,h),c+=3;break;case xs:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=ms;case ms:n=o===gs||o===ms,l=n?2*a-s:t[c+1],d=n?2*h-i:t[c+2],s=t[c+1],i=t[c+2],a=t[c+3],h=t[c+4],_.push(gs,l,d,s,i,a,h),c+=5;break;case ys:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,r=gs;case gs:s=t[c+3],i=t[c+4],a=t[c+5],h=t[c+6],_.push(gs,t[c+1],t[c+2],s,i,a,h),c+=7;break;case Bs:t[c+1]+=a,t[c+2]+=h,r=bs;case bs:n=o===ws||o===bs,s=n?2*a-s:t[c+1],i=n?2*h-i:t[c+2],e?Ns(_,a,h,s,i,t[c+1],t[c+2]):_.push(ws,s,i,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case vs:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=ws;case ws:s=t[c+1],i=t[c+2],e?Ns(_,a,h,s,i,t[c+3],t[c+4]):_.push(ws,s,i,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case Ss:t[c+6]+=a,t[c+7]+=h;case ks:Ys(_,a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],e),a=t[c+6],h=t[c+7],c+=8;break;case Cs:case Rs:_.push(Rs),c++;break;case Ts:a=t[c+1],h=t[c+2],e?Ms(_,a,h,t[c+3],t[c+4]):qs(_,t,c,5),c+=5;break;case Ps:a=t[c+1],h=t[c+2],e?Ds(_,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):qs(_,t,c,9),c+=9;break;case Ls:a=t[c+1],h=t[c+2],e?Ds(_,a,h,t[c+3],t[c+4],t[c+5]):qs(_,t,c,6),c+=6;break;case Es:Us(e?_:qs(_,t,c,9),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],t[c+8],null,Hs),a=Hs.x,h=Hs.y,c+=9;break;case Is:e?Us(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):qs(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Os:zs(e?_:qs(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Hs),a=Hs.x,h=Hs.y,c+=7;break;case As:e?zs(_,t[c+1],t[c+2],t[c+3],0,360,!1):qs(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Ws:Fs(e?_:qs(_,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Hs),a=Hs.x,h=Hs.y,c+=6;break;default:return Xs.error(`command: ${r} [index:${c}]`,t),_}o=r}return _},objectToCanvasData(t){const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(hs,t.x,t.y);break;case"L":e.push(ds,t.x,t.y);break;case"C":e.push(gs,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(ws,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Rs)}}),e},copyData(t,e,s,i){for(let r=s,o=s+i;r<o;r++)t.push(e[r])},pushData(t,e){Vs.index===Vs.length&&(Vs.index=1,t.push(Vs.name)),t.push(Number(e)),Vs.index++,Vs.dot=0}},{current:Vs,pushData:js,copyData:qs}=Gs,{M:Qs,L:Js,C:$s,Q:Zs,Z:Ks,N:ti,D:ei,X:si,G:ii,F:ri,O:oi,P:ni,U:ai}=Se,{getMinDistanceFrom:hi,getRadianFrom:li}=st,{tan:di,min:ci,abs:ui}=Math,_i={},pi={beginPath(t){t.length=0},moveTo(t,e,s){t.push(Qs,e,s)},lineTo(t,e,s){t.push(Js,e,s)},bezierCurveTo(t,e,s,i,r,o,n){t.push($s,e,s,i,r,o,n)},quadraticCurveTo(t,e,s,i,r){t.push(Zs,e,s,i,r)},closePath(t){t.push(Ks)},rect(t,e,s,i,r){t.push(ti,e,s,i,r)},roundRect(t,e,s,i,r,o){if(l(o))t.push(si,e,s,i,r,o);else{const n=L.fourNumber(o);n?t.push(ei,e,s,i,r,...n):t.push(ti,e,s,i,r)}},ellipse(t,e,s,i,r,o,a,h,l){n(o)?t.push(ri,e,s,i,r):(n(a)&&(a=0),n(h)&&(h=360),t.push(ii,e,s,i,r,o,a,h,l?1:0))},arc(t,e,s,i,r,o,a){n(r)?t.push(ni,e,s,i):(n(o)&&(o=360),t.push(oi,e,s,i,r,o,a?1:0))},arcTo(t,e,s,i,r,n,a,h){if(!o(a)){const t=hi(a,h,e,s,i,r);n=ci(n,ci(t/2,t/2*ui(di(li(a,h,e,s,i,r)/2))))}t.push(ai,e,s,i,r,n)},drawEllipse(t,e,s,i,r,o,a,h,l){Ze.ellipse(null,e,s,i,r,n(o)?0:o,n(a)?0:a,n(h)?360:h,l,null,null,_i),t.push(Qs,_i.x,_i.y),fi(t,e,s,i,r,o,a,h,l)},drawArc(t,e,s,i,r,o,a){Ze.arc(null,e,s,i,n(r)?0:r,n(o)?360:o,a,null,null,_i),t.push(Qs,_i.x,_i.y),gi(t,e,s,i,r,o,a)},drawPoints(t,e,s,i){Ze.points(t,e,s,i)}},{ellipse:fi,arc:gi}=pi,{moveTo:yi,lineTo:mi,quadraticCurveTo:xi,bezierCurveTo:wi,closePath:vi,beginPath:bi,rect:Bi,roundRect:ki,ellipse:Si,arc:Ri,arcTo:Ci,drawEllipse:Ti,drawArc:Pi,drawPoints:Li}=pi;class Ei{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?a(t)?Be.parse(t):t:[],this}beginPath(){return bi(this.__path),this.paint(),this}moveTo(t,e){return yi(this.__path,t,e),this.paint(),this}lineTo(t,e){return mi(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,s,i,r,o){return wi(this.__path,t,e,s,i,r,o),this.paint(),this}quadraticCurveTo(t,e,s,i){return xi(this.__path,t,e,s,i),this.paint(),this}closePath(){return vi(this.__path),this.paint(),this}rect(t,e,s,i){return Bi(this.__path,t,e,s,i),this.paint(),this}roundRect(t,e,s,i,r){return ki(this.__path,t,e,s,i,r),this.paint(),this}ellipse(t,e,s,i,r,o,n,a){return Si(this.__path,t,e,s,i,r,o,n,a),this.paint(),this}arc(t,e,s,i,r,o){return Ri(this.__path,t,e,s,i,r,o),this.paint(),this}arcTo(t,e,s,i,r){return Ci(this.__path,t,e,s,i,r),this.paint(),this}drawEllipse(t,e,s,i,r,o,n,a){return Ti(this.__path,t,e,s,i,r,o,n,a),this.paint(),this}drawArc(t,e,s,i,r,o){return Pi(this.__path,t,e,s,i,r,o),this.paint(),this}drawPoints(t,e,s){return Li(this.__path,t,e,s),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Ii,L:Oi,C:Ai,Q:Wi,Z:Mi,N:Di,D:Fi,X:zi,G:Ui,F:Ni,O:Yi,P:Xi,U:Hi}=Se,Gi=Gt.get("PathDrawer"),Vi={drawPathByData(t,e){if(!e)return;let s,i=0,r=e.length;for(;i<r;)switch(s=e[i],s){case Ii:t.moveTo(e[i+1],e[i+2]),i+=3;break;case Oi:t.lineTo(e[i+1],e[i+2]),i+=3;break;case Ai:t.bezierCurveTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5],e[i+6]),i+=7;break;case Wi:t.quadraticCurveTo(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case Mi:t.closePath(),i+=1;break;case Di:t.rect(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case Fi:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],[e[i+5],e[i+6],e[i+7],e[i+8]]),i+=9;break;case zi:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;case Ui:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]*I,e[i+6]*I,e[i+7]*I,e[i+8]),i+=9;break;case Ni:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],0,0,O,!1),i+=5;break;case Yi:t.arc(e[i+1],e[i+2],e[i+3],e[i+4]*I,e[i+5]*I,e[i+6]),i+=7;break;case Xi:t.arc(e[i+1],e[i+2],e[i+3],0,O,!1),i+=4;break;case Hi:t.arcTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;default:return void Gi.error(`command: ${s} [index:${i}]`,e)}}},{M:ji,L:qi,C:Qi,Q:Ji,Z:$i,N:Zi,D:Ki,X:tr,G:er,F:sr,O:ir,P:rr,U:or}=Se,{toTwoPointBounds:nr,toTwoPointBoundsByQuadraticCurve:ar,arcTo:hr,arc:lr,ellipse:dr}=Ze,{addPointBounds:cr,copy:ur,addPoint:_r,setPoint:pr,addBounds:fr,toBounds:gr}=ct,yr=Gt.get("PathBounds");let mr,xr,wr;const vr={},br={},Br={},kr={toBounds(t,e){kr.toTwoPointBounds(t,br),gr(br,e)},toTwoPointBounds(t,e){if(!t||!t.length)return pr(e,0,0);let s,i,r,o,n,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(n=t[a],0===a&&(n===$i||n===Qi||n===Ji?pr(e,h,l):pr(e,t[a+1],t[a+2])),n){case ji:case qi:h=t[a+1],l=t[a+2],_r(e,h,l),a+=3;break;case Qi:r=t[a+5],o=t[a+6],nr(h,l,t[a+1],t[a+2],t[a+3],t[a+4],r,o,vr),cr(e,vr),h=r,l=o,a+=7;break;case Ji:s=t[a+1],i=t[a+2],r=t[a+3],o=t[a+4],ar(h,l,s,i,r,o,vr),cr(e,vr),h=r,l=o,a+=5;break;case $i:a+=1;break;case Zi:h=t[a+1],l=t[a+2],fr(e,h,l,t[a+3],t[a+4]),a+=5;break;case Ki:case tr:h=t[a+1],l=t[a+2],fr(e,h,l,t[a+3],t[a+4]),a+=n===Ki?9:6;break;case er:dr(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],t[a+7],t[a+8],vr,Br),0===a?ur(e,vr):cr(e,vr),h=Br.x,l=Br.y,a+=9;break;case sr:h=t[a+1],l=t[a+2],xr=t[a+3],wr=t[a+4],fr(e,h-xr,l-wr,2*xr,2*wr),h+=xr,a+=5;break;case ir:lr(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],vr,Br),0===a?ur(e,vr):cr(e,vr),h=Br.x,l=Br.y,a+=7;break;case rr:h=t[a+1],l=t[a+2],mr=t[a+3],fr(e,h-mr,l-mr,2*mr,2*mr),h+=mr,a+=4;break;case or:hr(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],vr,Br),0===a?ur(e,vr):cr(e,vr),h=Br.x,l=Br.y,a+=6;break;default:return void yr.error(`command: ${n} [index:${a}]`,t)}}},{M:Sr,L:Rr,Z:Cr}=Se,{getCenterX:Tr,getCenterY:Pr}=st,{arcTo:Lr}=pi,Er={smooth(t,e,s){let i,r,o,n=0,a=0,h=0,l=0,d=0,c=0,u=0,_=0,p=0;const f=t.length,g=[];for(;n<f;){switch(i=t[n],i){case Sr:l=_=t[n+1],d=p=t[n+2],n+=3,t[n]===Rr?(c=t[n+1],u=t[n+2],g.push(Sr,Tr(l,c),Pr(d,u))):g.push(Sr,l,d);break;case Rr:switch(a=t[n+1],h=t[n+2],n+=3,t[n]){case Rr:Lr(g,a,h,t[n+1],t[n+2],e,_,p);break;case Cr:Lr(g,a,h,l,d,e,_,p);break;default:g.push(Rr,a,h)}_=a,p=h;break;case Cr:r!==Cr&&(Lr(g,l,d,c,u,e,_,p),g.push(Cr)),n+=1;break;default:o=Ee[i];for(let e=0;e<o;e++)g.push(t[n+e]);n+=o}r=i}return i!==Cr&&(g[1]=l,g[2]=d),g}};function Ir(t){return new Ei(t)}const Or=Ir();Be.creator=Ir(),Be.parse=Gs.parse,Be.convertToCanvasData=Gs.toCanvasData;const{drawRoundRect:Ar}=Ie;function Wr(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,s,i,r){Ar(this,t,e,s,i,r)})}(t)}const Mr={alphaPixelTypes:["png","webp","svg"],upperCaseTypeMap:{},mineType:t=>!t||t.startsWith("image")?t:("jpg"===t&&(t="jpeg"),"image/"+t),fileType(t){const e=t.split(".");return e[e.length-1]},isOpaqueImage(t){const e=Dr.fileType(t);return["jpg","jpeg"].some(t=>t===e)},getExportOptions(t){switch(typeof t){case"object":return t;case"number":return{quality:t};case"boolean":return{blob:t};default:return{}}}},Dr=Mr;Dr.alphaPixelTypes.forEach(t=>Dr.upperCaseTypeMap[t]=t.toUpperCase());const Fr=Gt.get("TaskProcessor");class zr{constructor(t){this.parallel=!0,this.time=1,this.id=s.create(s.TASK),this.task=t}run(){return he(this,void 0,void 0,function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){Fr.error(t)}})}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class Ur{get total(){return this.list.length+this.delayNumber}get finishedIndex(){return this.isComplete?0:this.index+this.parallelSuccessNumber}get remain(){return this.isComplete?this.total:this.total-this.finishedIndex}get percent(){const{total:t}=this;let e=0,s=0;for(let i=0;i<t;i++)i<=this.finishedIndex?(s+=this.list[i].time,i===this.finishedIndex&&(e=s)):e+=this.list[i].time;return this.isComplete?1:s/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&p.assign(this.config,t),this.empty()}add(t,e){let s,i,r,n;const a=new zr(t);return a.parent=this,l(e)?n=e:e&&(i=e.parallel,s=e.start,r=e.time,n=e.delay),r&&(a.time=r),!1===i&&(a.parallel=!1),o(n)?this.push(a,s):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(a,s))},n)),this.isComplete=!1,a}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout(()=>this.start()))}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[],this.delayNumber=0}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach(t=>{t.isComplete||t.cancel()}),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then(()=>{this.onTask(t),this.index++,this.nextTask()}).catch(t=>{this.onError(t)}):this.nextTask()}runParallelTasks(){this.parallelList.forEach(t=>this.runParallelTask(t))}runParallelTask(t){t.run().then(()=>{this.onTask(t),this.fillParallelTask()}).catch(t=>{this.onParallelError(t)})}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout(()=>this.run())}setParallelList(){let t;this.parallelList=[],this.parallelSuccessNumber=0;let e=this.index+this.config.parallel;e>this.list.length&&(e=this.list.length);for(let s=this.index;s<e&&(t=this.list[s],t.parallel);s++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const s=e.length,i=this.finishedIndex+s;if(e.length){if(!this.running)return;i<this.total&&(t=this.list[i],t&&t.parallel&&(e.push(t),this.runParallelTask(t)))}else this.index+=this.parallelSuccessNumber,this.parallelSuccessNumber=0,this.nextTask()}onComplete(){this.stop(),this.config.onComplete&&this.config.onComplete()}onTask(t){t.complete(),this.config.onTask&&this.config.onTask()}onParallelError(t){this.parallelList.forEach(t=>{t.parallel=!1}),this.parallelList.length=0,this.parallelSuccessNumber=0,this.onError(t)}onError(t){this.pause(),this.config.onError&&this.config.onError(t)}destroy(){this.stop()}}const Nr=Gt.get("Resource"),Yr={tasker:new Ur,map:{},get isComplete(){return Xr.tasker.isComplete},set(t,e){Xr.map[t]&&Nr.repeat(t),Xr.map[t]=e},get:t=>Xr.map[t],remove(t){const e=Xr.map[t];e&&(e.destroy&&e.destroy(),delete Xr.map[t])},loadImage(t,e){return new Promise((s,i)=>{const r=this.setImage(t,t,e);r.load(()=>s(r),t=>i(t))})},setImage(t,e,s){let i;return a(e)?i={url:e}:e.url||(i={url:t,view:e}),i&&(s&&(i.format=s),e=Kt.image(i)),Xr.set(t,e),e},destroy(){Xr.map={}}},Xr=Yr,Hr={maxRecycled:10,recycledList:[],patternTasker:new Ur,get(t){let e=Yr.get(t.url);return e||Yr.set(t.url,e=Kt.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||Gr.recycledList.push(t)})},clearRecycled(){const t=Gr.recycledList;t.length>Gr.maxRecycled&&(t.forEach(t=>!t.use&&t.url&&Yr.remove(t.url)),t.length=0)},hasAlphaPixel:t=>Mr.alphaPixelTypes.some(e=>Gr.isFormat(e,t)),isFormat(t,e){if(e.format)return e.format===t;const{url:s}=e;if(s.startsWith("data:")){if(s.startsWith("data:"+Mr.mineType(t)))return!0}else{if(s.includes("."+t)||s.includes("."+Mr.upperCaseTypeMap[t]))return!0;if("png"===t&&!s.includes("."))return!0}return!1},destroy(){Gr.recycledList=[]}},Gr=Hr,{IMAGE:Vr,create:jr}=s,{floor:qr,max:Qr}=Math;class Jr{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=jr(Vr),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}Hr.isFormat("svg",t)&&(this.isSVG=!0),Hr.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,s){if(!this.loading){this.loading=!0;let{loadImage:t,loadImageWithProgress:s}=e.origin,i=this.config.showProgress&&s&&this.onProgress.bind(this);i&&(t=s),Yr.tasker.add(()=>he(this,void 0,void 0,function*(){return yield t(this.url,i).then(t=>this.setView(t)).catch(t=>{this.error=t,this.onComplete(!1)})}))}return this.waitComplete.push(t,s),this.waitComplete.length-2}unload(t,e){const s=this.waitComplete;if(e){const e=s[t+1];e&&e({type:"stop"})}s[t]=s[t+1]=void 0}setView(t){this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)}onProgress(t){this.progress=t}onComplete(t){let e;this.waitComplete.forEach((s,i)=>{e=i%2,s&&(t?e||s(this):e&&s(this.error))}),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(t,s,i,r,o,n,a){if(t||(t=this.width),s||(s=this.height),this.cache){let{params:t,data:e}=this.cache;for(let s in t)if(t[s]!==arguments[s]){e=null;break}if(e)return e}const h=e.origin.createCanvas(Qr(qr(t+(o||0)),1),Qr(qr(s+(n||0)),1)),l=h.getContext("2d");return i&&(l.globalAlpha=i),l.imageSmoothingEnabled=!1!==a,l.drawImage(this.view,0,0,t,s),this.cache=this.use>1?{data:h,params:arguments}:null,h}getPattern(t,s,i,r){const o=e.canvas.createPattern(t,s);try{i&&o.setTransform&&(o.setTransform(i),i=void 0)}catch(t){}return r&&p.stintSet(r,"transform",i),o}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function $r(t,e,s,i){i||(s.configurable=s.enumerable=!0),Object.defineProperty(t,e,s)}function Zr(t,e){return Object.getOwnPropertyDescriptor(t,e)}function Kr(t,e){const s="_"+t;return{get(){const t=this[s];return null==t?e:t},set(t){this[s]=t}}}function to(t,e){return(s,i)=>so(s,i,t,e&&e(i))}function eo(t){return t}function so(t,e,s,i){const r={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};$r(t,e,Object.assign(r,i||{})),Eo(t,e,s)}function io(t){return to(t)}function ro(t,e){return to(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function oo(t,e){return to(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function no(t){return to(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),uo(this))}}))}function ao(t,e){return to(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function ho(t,e){return to(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function lo(t,e){return to(t,t=>({set(s){this.__setAttr(t,s,e)&&uo(this)}}))}function co(t){return to(t,t=>({set(e){this.__setAttr(t,e)&&(uo(this),this.__.__removeNaturalSize())}}))}function uo(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function _o(t){return to(t,t=>({set(e){const s=this.__;2!==s.__pathInputed&&(s.__pathInputed=e?1:0),e||(s.__pathForRender=void 0),this.__setAttr(t,e),uo(this)}}))}const po=lo;function fo(t,e){return to(t,t=>({set(s){this.__setAttr(t,s)&&(go(this),e&&(this.__.__useStroke=!0))}}))}function go(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&uo(t)}const yo=fo;function mo(t){return to(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function xo(t){return to(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function wo(t){return to(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;p.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip),this.__layout.surfaceChange()}}}))}function vo(t){return to(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Bo(this)}}))}function bo(t){return to(t,t=>({set(e){const s=this.visible;if(!0===s&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>ko(this,t,e,s))}else 0===s&&!0===e&&this.animation&&this.__runAnimation("in");ko(this,t,e,s),this.mask&&Bo(this)}}))}function Bo(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function ko(t,e,s,i){t.__setAttr(e,s)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==i&&0!==s||uo(t))}function So(t){return to(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function Ro(t){return to(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function Co(t){return to(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function To(t){return to(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===Gt.showBounds&&this.__layout.surfaceChange(),this.leafer&&this.leafer.updateCursor())}}))}function Po(t){return to(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function Lo(t){return(e,s)=>{$r(e,"__DataProcessor",{get:()=>t})}}function Eo(t,e,s){const i=t.__DataProcessor.prototype,r="_"+e,n=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=Kr(e,s);if(o(s))a.get=function(){return this[r]};else if("function"==typeof s)a.get=function(){const t=this[r];return null==t?s(this.__leaf):t};else if(u(s)){const t=_(s);a.get=function(){const e=this[r];return null==e?this[r]=t?{}:p.clone(s):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[r];if(null==t){const t=this,e=t.__naturalWidth,i=t.__leaf;return!s||i.pathInputed?i.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:h&&i.children.length?i.boxBounds.width:s}return t}:"height"===e&&(a.get=function(){const t=this[r];if(null==t){const t=this,e=t.__naturalHeight,i=t.__leaf;return!s||i.pathInputed?i.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:h&&i.children.length?i.boxBounds.height:s}return t});let l,d=i;for(;!l&&d;)l=Zr(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),i[n]&&(a.set=i[n],delete i[n]),$r(i,e,a)}const Io=new Gt("rewrite"),Oo=[],Ao=["destroy","constructor"];function Wo(t){return(e,s)=>{Oo.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}}function Mo(){return t=>{Do()}}function Do(t){Oo.length&&(Oo.forEach(e=>{t&&Io.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),Oo.length=0)}function Fo(t,e){return s=>{var i;(t.prototype?(i=t.prototype,Object.getOwnPropertyNames(i)):Object.keys(t)).forEach(i=>{if(!(Ao.includes(i)||e&&e.includes(i)))if(t.prototype){Zr(t.prototype,i).writable&&(s.prototype[i]=t.prototype[i])}else s.prototype[i]=t[i]})}}function zo(){return t=>{ee.register(t)}}setTimeout(()=>Do(!0));const{copy:Uo,toInnerPoint:No,toOuterPoint:Yo,scaleOfOuter:Xo,rotateOfOuter:Ho,skewOfOuter:Go,multiplyParent:Vo,divideParent:jo,getLayout:qo}=G,Qo={},{round:Jo}=Math,$o={updateAllMatrix(t,e,s){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(s=!0),tn(t,e,s),t.isBranch){const{children:i}=t;for(let t=0,r=i.length;t<r;t++)Ko(i[t],e,s)}},updateMatrix(t,e,s){const i=t.__layout;e?s&&(i.waitAutoLayout=!0,t.__hasAutoLayout&&(i.matrixChanged=!1)):i.waitAutoLayout&&(i.waitAutoLayout=!1),i.matrixChanged&&t.__updateLocalMatrix(),i.waitAutoLayout||t.__updateWorldMatrix()},updateBounds(t){const e=t.__layout;e.boundsChanged&&t.__updateLocalBounds(),e.waitAutoLayout||t.__updateWorldBounds()},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)en(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&en(t),t.__updateChange()},updateAllChange(t){if(rn(t),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)sn(e[t])}},worldHittable(t){for(;t;){if(!t.__.hittable)return!1;t=t.parent}return!0},draggable:t=>(t.draggable||t.editable)&&t.hitSelf&&!t.locked,copyCanvasByWorld(t,s,i,r,o,n){r||(r=t.__nowWorld),t.__worldFlipped||e.fullImageShadow?s.copyWorldByReset(i,r,t.__nowWorld,o,n):s.copyWorldToInner(i,r,t.__layout.renderBounds,o)},moveWorld(t,e,s=0,i,r){const o=u(e)?Object.assign({},e):{x:e,y:s};i?Yo(t.localTransform,o,o,!0):t.parent&&No(t.parent.scrollWorldTransform,o,o,!0),Zo.moveLocal(t,o.x,o.y,r)},moveLocal(t,e,s=0,i){u(e)&&(s=e.y,e=e.x),e+=t.x,s+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=Jo(e),s=Jo(s)),i?t.animate({x:e,y:s},i):(t.x=e,t.y=s)},zoomOfWorld(t,e,s,i,r,o){Zo.zoomOfLocal(t,on(t,e),s,i,r,o)},zoomOfLocal(t,e,s,i=s,r,o){const n=t.__localMatrix;if(l(i)||(i&&(o=i),i=s),Uo(Qo,n),Xo(Qo,e,s,i),Zo.hasHighPosition(t))Zo.setTransform(t,Qo,r,o);else{const e=t.x+Qo.e-n.e,a=t.y+Qo.f-n.f;o&&!r?t.animate({x:e,y:a,scaleX:t.scaleX*s,scaleY:t.scaleY*i},o):(t.x=e,t.y=a,t.scaleResize(s,i,!0!==r))}},rotateOfWorld(t,e,s,i){Zo.rotateOfLocal(t,on(t,e),s,i)},rotateOfLocal(t,e,s,i){const r=t.__localMatrix;Uo(Qo,r),Ho(Qo,e,s),Zo.hasHighPosition(t)?Zo.setTransform(t,Qo,!1,i):t.set({x:t.x+Qo.e-r.e,y:t.y+Qo.f-r.f,rotation:L.formatRotation(t.rotation+s)},i)},skewOfWorld(t,e,s,i,r,o){Zo.skewOfLocal(t,on(t,e),s,i,r,o)},skewOfLocal(t,e,s,i=0,r,o){Uo(Qo,t.__localMatrix),Go(Qo,e,s,i),Zo.setTransform(t,Qo,r,o)},transformWorld(t,e,s,i){Uo(Qo,t.worldTransform),Vo(Qo,e),t.parent&&jo(Qo,t.parent.scrollWorldTransform),Zo.setTransform(t,Qo,s,i)},transform(t,e,s,i){Uo(Qo,t.localTransform),Vo(Qo,e),Zo.setTransform(t,Qo,s,i)},setTransform(t,e,s,i){const r=t.__,o=r.origin&&Zo.getInnerOrigin(t,r.origin),n=qo(e,o,r.around&&Zo.getInnerOrigin(t,r.around));if(Zo.hasOffset(t)&&(n.x-=r.offsetX,n.y-=r.offsetY),s){const e=n.scaleX/t.scaleX,s=n.scaleY/t.scaleY;if(delete n.scaleX,delete n.scaleY,o){Mt.scale(t.boxBounds,Math.abs(e),Math.abs(s));const i=Zo.getInnerOrigin(t,r.origin);st.move(n,o.x-i.x,o.y-i.y)}t.set(n),t.scaleResize(e,s,!1)}else t.set(n,i)},getFlipTransform(t,e){const s={a:1,b:0,c:0,d:1,e:0,f:0},i="x"===e?1:-1;return Xo(s,Zo.getLocalOrigin(t,"center"),-1*i,1*i),s},getLocalOrigin:(t,e)=>st.tempToOuterOf(Zo.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const s={};return gt.toPoint(e,t.boxBounds,s),s},getRelativeWorld:(t,e,s)=>(Uo(Qo,t.worldTransform),jo(Qo,e.scrollWorldTransform),s?Qo:Object.assign({},Qo)),drop(t,e,s,i){t.setTransform(Zo.getRelativeWorld(t,e,!0),i),e.add(t,s)},hasHighPosition:t=>t.origin||t.around||Zo.hasOffset(t),hasOffset:t=>t.offsetX||t.offsetY,hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}},animateMove(t,s,i=.3){if(s.x||s.y)if(Math.abs(s.x)<1&&Math.abs(s.y)<1)t.move(s);else{const r=s.x*i,o=s.y*i;s.x-=r,s.y-=o,t.move(r,o),e.requestRender(()=>Zo.animateMove(t,s,i))}}},Zo=$o,{updateAllMatrix:Ko,updateMatrix:tn,updateAllWorldOpacity:en,updateAllChange:sn,updateChange:rn}=Zo;function on(t,e){return t.updateLayout(),t.parent?st.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const nn={worldBounds:t=>t.__world,localBoxBounds:t=>t.__.eraser||0===t.__.visible?null:t.__local||t.__layout,localStrokeBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localStrokeBounds,localRenderBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localRenderBounds,maskLocalBoxBounds:(t,e)=>hn(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>hn(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>hn(t,e)&&t.__layout.localRenderBounds,excludeRenderBounds:(t,e)=>!(!e.bounds||e.bounds.hit(t.__world,e.matrix))||!(!e.hideBounds||!e.hideBounds.includes(t.__world,e.matrix))};let an;function hn(t,e){return e||(an=0),t.__.mask&&(an=1),an<0?null:(an&&(an=-1),!0)}const{updateBounds:ln}=$o,dn={sort:(t,e)=>t.__.zIndex===e.__.zIndex?t.__tempNumber-e.__tempNumber:t.__.zIndex-e.__.zIndex,pushAllChildBranch(t,e){if(t.__tempNumber=1,t.__.__childBranchNumber){const{children:s}=t;for(let i=0,r=s.length;i<r;i++)(t=s[i]).isBranch&&(t.__tempNumber=1,e.add(t),cn(t,e))}},pushAllParent(t,e){const{keys:s}=e;if(s)for(;t.parent&&o(s[t.parent.innerId]);)e.add(t.parent),t=t.parent;else for(;t.parent;)e.add(t.parent),t=t.parent},pushAllBranchStack(t,e){let s=e.length;const{children:i}=t;for(let t=0,s=i.length;t<s;t++)i[t].isBranch&&e.push(i[t]);for(let t=s,i=e.length;t<i;t++)un(e[t],e)},updateBounds(t,e){const s=[t];un(t,s),_n(s,e)},updateBoundsByBranchStack(t,e){let s,i;for(let r=t.length-1;r>-1;r--){s=t[r],i=s.children;for(let t=0,e=i.length;t<e;t++)ln(i[t]);e&&e===s||ln(s)}}},{pushAllChildBranch:cn,pushAllBranchStack:un,updateBoundsByBranchStack:_n}=dn,pn={run(t){if(t&&t.length){const e=t.length;for(let s=0;s<e;s++)t[s]();t.length===e?t.length=0:t.splice(0,e)}}},{getRelativeWorld:fn,updateBounds:gn}=$o,{toOuterOf:yn,getPoints:mn,copy:xn}=Mt,wn="_localContentBounds",vn="_worldContentBounds",bn="_worldBoxBounds",Bn="_worldStrokeBounds";class kn{get contentBounds(){return this._contentBounds||this.boxBounds}set contentBounds(t){this._contentBounds=t}get strokeBounds(){return this._strokeBounds||this.boxBounds}get renderBounds(){return this._renderBounds||this.boxBounds}set renderBounds(t){this._renderBounds=t}get localContentBounds(){return yn(this.contentBounds,this.leaf.__localMatrix,this[wn]||(this[wn]={})),this[wn]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return yn(this.contentBounds,this.leaf.__world,this[vn]||(this[vn]={})),this[vn]}get worldBoxBounds(){return yn(this.boxBounds,this.leaf.__world,this[bn]||(this[bn]={})),this[bn]}get worldStrokeBounds(){return yn(this.strokeBounds,this.leaf.__world,this[Bn]||(this[Bn]={})),this[Bn]}get a(){return 1}get b(){return 0}get c(){return 0}get d(){return 1}get e(){return this.leaf.__.x}get f(){return this.leaf.__.y}get x(){return this.e+this.boxBounds.x}get y(){return this.f+this.boxBounds.y}get width(){return this.boxBounds.width}get height(){return this.boxBounds.height}constructor(t){this.leaf=t,this.leaf.__local&&(this._localRenderBounds=this._localStrokeBounds=this.leaf.__local),t.__world&&(this.boxBounds={x:0,y:0,width:0,height:0},this.boxChange(),this.matrixChange())}createLocal(){const t=this.leaf.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0};this._localStrokeBounds||(this._localStrokeBounds=t),this._localRenderBounds||(this._localRenderBounds=t)}update(){const{leaf:t}=this,{leafer:s}=t;if(t.isApp)return gn(t);if(s)s.ready?s.watcher.changed&&s.layouter.layout():s.start();else{let s=t;for(;s.parent&&!s.parent.leafer;)s=s.parent;const i=s;if(i.__fullLayouting)return;i.__fullLayouting=!0,e.layout(i),delete i.__fullLayouting}}getTransform(t="world"){this.update();const{leaf:e}=this;switch(t){case"world":return e.__world;case"local":return e.__localMatrix;case"inner":return G.defaultMatrix;case"page":t=e.zoomLayer;default:return fn(e,t)}}getBounds(t,e="world"){switch(this.update(),e){case"world":return this.getWorldBounds(t);case"local":return this.getLocalBounds(t);case"inner":return this.getInnerBounds(t);case"page":e=this.leaf.zoomLayer;default:return new Ut(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",s){const{leaf:i}=this;let r,o,n,a=this.getInnerBounds(t);switch(e){case"world":r=i.getWorldPoint(a),o=i.__world;break;case"local":const{scaleX:t,scaleY:s,rotation:h,skewX:l,skewY:d}=i.__;n={scaleX:t,scaleY:s,rotation:h,skewX:l,skewY:d},r=i.getLocalPointByInner(a);break;case"inner":r=a,o=G.defaultMatrix;break;case"page":e=i.zoomLayer;default:r=i.getWorldPoint(a,e),o=fn(i,e,!0)}if(n||(n=G.getLayout(o)),xn(n,a),st.copy(n,r),s){const{scaleX:t,scaleY:e}=n,s=Math.abs(t),i=Math.abs(e);1===s&&1===i||(n.scaleX/=s,n.scaleY/=i,n.width*=s,n.height*=i)}return n}getLayoutPoints(t,e="world"){const{leaf:s}=this,i=mn(this.getInnerBounds(t));let r;switch(e){case"world":r=null;break;case"local":r=s.parent;break;case"inner":break;case"page":e=s.zoomLayer;default:r=e}return o(r)||i.forEach(t=>s.innerToWorld(t,null,!1,r)),i}shrinkContent(){const{x:t,y:e,width:s,height:i}=this.boxBounds;this._contentBounds={x:t,y:e,width:s,height:i}}spreadStroke(){const{x:t,y:e,width:s,height:i}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:s,height:i},this._localStrokeBounds={x:t,y:e,width:s,height:i},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:s,height:i}=this.renderBounds;this._renderBounds={x:t,y:e,width:s,height:i},this._localRenderBounds={x:t,y:e,width:s,height:i}}shrinkContentCancel(){this._contentBounds=void 0}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this._strokeBounds=this.boxBounds,this._localStrokeBounds=this.leaf.__localBoxBounds,t&&this.spreadRenderCancel()}spreadRenderCancel(){this._renderBounds=this._strokeBounds,this._localRenderBounds=this._localStrokeBounds}boxChange(){this.boxChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange(),this.hitCanvasChanged=!0}localBoxChange(){this.localBoxChanged=!0,this.boundsChanged=!0}strokeChange(){this.strokeChanged=!0,this.strokeSpread||(this.strokeSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}renderChange(){this.renderChanged=!0,this.renderSpread||(this.renderSpread=1),this.boundsChanged=!0}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChange(),this.leaf.__local||this.createLocal()}matrixChange(){this.matrixChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=this.affectChildrenSort=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class Sn{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&e.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&e.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&e.event.stop(this.origin)}}class Rn extends Sn{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}Rn.ADD="child.add",Rn.REMOVE="child.remove",Rn.CREATED="created",Rn.MOUNTED="mounted",Rn.UNMOUNTED="unmounted",Rn.DESTROY="destroy";const Cn="property.scroll";class Tn extends Sn{constructor(t,e,s,i,r){super(t,e),this.attrName=s,this.oldValue=i,this.newValue=r}}Tn.CHANGE="property.change",Tn.LEAFER_CHANGE="property.leafer_change",Tn.SCROLL=Cn;const Pn={scrollX:Cn,scrollY:Cn};class Ln extends Sn{constructor(t,e){super(t),Object.assign(this,e)}}Ln.LOAD="image.load",Ln.LOADED="image.loaded",Ln.ERROR="image.error";class En extends Sn{static checkHas(t,e,s){"on"===s?e===Wn?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(In)||t.hasEvent(On)||t.hasEvent(An),t.__hasWorldEvent=t.hasEvent(Wn))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(In,t),"inner"===e&&t.emit(On,t)),t.emit(An,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(Wn,this)}}En.RESIZE="bounds.resize",En.INNER="bounds.inner",En.LOCAL="bounds.local",En.WORLD="bounds.world";const{RESIZE:In,INNER:On,LOCAL:An,WORLD:Wn}=En,Mn={};[In,On,An,Wn].forEach(t=>Mn[t]=1);class Dn extends Sn{get bigger(){if(!this.old)return!0;const{width:t,height:e}=this.old;return this.width>=t&&this.height>=e}get smaller(){return!this.bigger}get samePixelRatio(){return!this.old||this.pixelRatio===this.old.pixelRatio}constructor(t,e){u(t)?(super(Dn.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!o(this.resizingKeys[t.innerId])}}Dn.RESIZE="resize";class Fn extends Sn{constructor(t,e){super(t),this.data=e}}Fn.REQUEST="watch.request",Fn.DATA="watch.data";class zn extends Sn{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}zn.REQUEST="layout.request",zn.START="layout.start",zn.BEFORE="layout.before",zn.LAYOUT="layout",zn.AFTER="layout.after",zn.AGAIN="layout.again",zn.END="layout.end";class Un extends Sn{constructor(t,e,s,i){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=i)}}Un.REQUEST="render.request",Un.CHILD_START="render.child_start",Un.CHILD_END="render.child_end",Un.START="render.start",Un.BEFORE="render.before",Un.RENDER="render",Un.AFTER="render.after",Un.AGAIN="render.again",Un.END="render.end",Un.NEXT="render.next";class Nn extends Sn{}Nn.START="leafer.start",Nn.BEFORE_READY="leafer.before_ready",Nn.READY="leafer.ready",Nn.AFTER_READY="leafer.after_ready",Nn.VIEW_READY="leafer.view_ready",Nn.VIEW_COMPLETED="leafer.view_completed",Nn.STOP="leafer.stop",Nn.RESTART="leafer.restart",Nn.END="leafer.end",Nn.UPDATE_MODE="leafer.update_mode",Nn.TRANSFORM="leafer.transform",Nn.MOVE="leafer.move",Nn.SCALE="leafer.scale",Nn.ROTATE="leafer.rotate",Nn.SKEW="leafer.skew";const{MOVE:Yn,SCALE:Xn,ROTATE:Hn,SKEW:Gn}=Nn,Vn={x:Yn,y:Yn,scaleX:Xn,scaleY:Xn,rotation:Hn,skewX:Gn,skewY:Gn},jn={};class qn{set event(t){this.on(t)}on(t,e,s){if(!e){let e;if(c(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let s in t)c(e=t[s])?this.on(s,e[0],e[1]):this.on(s,e);return}let i,r,o;s&&("once"===s?r=!0:"boolean"==typeof s?i=s:(i=s.capture,r=s.once));const n=Qn(this,i,!0),h=a(t)?t.split(" "):t,l=r?{listener:e,once:r}:{listener:e};h.forEach(t=>{t&&(o=n[t],o?-1===o.findIndex(t=>t.listener===e)&&o.push(l):n[t]=[l],Mn[t]&&En.checkHas(this,t,"on"))})}off(t,e,s){if(t){const i=a(t)?t.split(" "):t;if(e){let t,r,o;s&&(t="boolean"==typeof s?s:"once"!==s&&s.capture);const n=Qn(this,t);i.forEach(t=>{t&&(r=n[t],r&&(o=r.findIndex(t=>t.listener===e),o>-1&&r.splice(o,1),r.length||delete n[t],Mn[t]&&En.checkHas(this,t,"off")))})}else{const{__bubbleMap:t,__captureMap:e}=this;i.forEach(s=>{t&&delete t[s],e&&delete e[s]})}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,s,i){return e?this.on(t,s?e=e.bind(s):e,i):c(t)&&t.forEach(t=>this.on(t[0],t[2]?t[1]=t[1].bind(t[2]):t[1],t[3])),{type:t,current:this,listener:e,options:i}}off_(t){if(!t)return;const e=c(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):c(t.type)&&t.type.forEach(e=>t.current.off(e[0],e[1],e[3])))}),e.length=0}once(t,e,s,i){if(!e)return c(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));u(s)?e=e.bind(s):i=s,this.on(t,e,{once:!0,capture:i})}emit(t,e,s){!e&&re.has(t)&&(e=re.get(t,{type:t,target:this,current:this}));const i=Qn(this,s)[t];if(i){let r;for(let o=0,n=i.length;o<n&&!((r=i[o])&&(r.listener(e),r.once&&(this.off(t,r.listener,s),o--,n--),e&&e.isStopNow));o++);}this.syncEventer&&this.syncEventer.emitEvent(e,s)}emitEvent(t,e){t.current=this,this.emit(t.type,t,e)}hasEvent(t,e){if(this.syncEventer&&this.syncEventer.hasEvent(t,e))return!0;const{__bubbleMap:s,__captureMap:i}=this,r=s&&s[t],n=i&&i[t];return!!(o(e)?r||n:e?n:r)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function Qn(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:jn)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:jn)}}const{on:Jn,on_:$n,off:Zn,off_:Kn,once:ta,emit:ea,emitEvent:sa,hasEvent:ia,destroy:ra}=qn.prototype,oa={on:Jn,on_:$n,off:Zn,off_:Kn,once:ta,emit:ea,emitEvent:sa,hasEvent:ia,destroyEventer:ra},na=Gt.get("setAttr"),aa={__setAttr(t,e,s){if(this.leaferIsCreated){const i=this.__.__getInput(t);if(!s||h(e)||o(e)||(na.warn(this.innerName,t,e),e=void 0),u(e)||i!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new Tn(Tn.LEAFER_CHANGE,this,t,i,e));const s=Vn[t];s&&(this.emitEvent(new Nn(s,this)),this.emitEvent(new Nn(Nn.TRANSFORM,this)))}this.emitPropertyEvent(Tn.CHANGE,t,i,e);const s=Pn[t];return s&&this.emitPropertyEvent(s,t,i,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,s,i){const r=new Tn(t,this,e,s,i);this.isLeafer||this.hasEvent(t)&&this.emitEvent(r),this.leafer.emitEvent(r)},__realSetAttr(t,e){const s=this.__;s[t]=e,this.__proxyData&&this.setProxyAttr(t,e),s.normalStyle&&(this.lockNormalStyle||o(s.normalStyle[t])||(s.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:ha,multiplyParent:la,translateInner:da,defaultWorld:ca}=G,{toPoint:ua,tempPoint:_a}=gt,pa={__updateWorldMatrix(){const{parent:t,__layout:e,__world:s,__scrollWorld:i,__:r}=this;la(this.__local||e,t?t.__scrollWorld||t.__world:ca,s,!!e.affectScaleOrRotation,r),i&&da(Object.assign(i,s),r.scrollX,r.scrollY)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,s=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(ha(e,s,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=void 0),e.e=s.x+s.offsetX,e.f=s.y+s.offsetY,(s.around||s.origin)&&(ua(s.around||s.origin,t.boxBounds,_a),da(e,-_a.x,-_a.y,!s.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:fa,updateAllMatrix:ga}=$o,{updateBounds:ya}=dn,{toOuterOf:ma,copyAndSpread:xa,copy:wa}=Mt,{toBounds:va}=kr,ba={__updateWorldBounds(){const t=this.__layout;ma(t.renderBounds,this.__world,this.__world),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&En.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&En.emitWorld(this)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.resized="inner"),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=void 0,t.strokeSpread&&(t.strokeChanged=!0),t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.boxChange()),t.boxChanged=void 0,t.strokeChanged&&(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.strokeChanged=void 0,(t.renderSpread||t.strokeSpread!==t.strokeBoxSpread)&&(t.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),t.resized="inner"),t.renderChanged&&(t.renderSpread=this.__updateRenderSpread(),t.renderSpread?(t.renderBounds!==t.boxBounds&&t.renderBounds!==t.strokeBounds||t.spreadRender(),this.__updateRenderBounds(),this.__updateLocalRenderBounds()):t.spreadRenderCancel(),t.renderChanged=void 0,this.parent&&this.parent.__layout.renderChange()),t.resized||(t.resized="local"),t.boundsChanged=void 0},__updateLocalBoxBounds(){this.__hasMotionPath&&this.__updateMotionPath(),this.__hasAutoLayout&&this.__updateAutoLayout(),ma(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){ma(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){ma(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const s=this.__layout.boxBounds,i=this.__;i.__usePathBox?va(i.path,s):(s.x=0,s.y=0,s.width=i.width,s.height=i.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),ga(this),ya(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(ga(this),ya(this,this))):fa(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;xa(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:s}=e;l(s)&&s<=0?wa(e.renderBounds,e.strokeBounds):xa(e.renderBounds,e.boxBounds,s)}},Ba={__render(t,e){if(e.shape)return this.__renderShape(t,e);if(this.__worldOpacity){const s=this.__;if(s.bright&&!e.topRendering)return e.topList.add(this);if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.dimOpacity&&!s.dimskip?s.opacity*e.dimOpacity:s.opacity,this.__.__single){if("path"===s.eraser)return this.__renderEraser(t,e);const i=t.getSameCanvas(!0,!0);this.__draw(i,e,t),$o.copyCanvasByWorld(this,t,i,this.__nowWorld,s.__blendMode,!0),i.recycle(this.__nowWorld)}else this.__draw(t,e);Gt.showBounds&&Gt.drawBounds(this,t,e)}},__renderShape(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawShape(t,e))},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),t.clipUI(this))},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:ka}=nn,Sa={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__nowWorld=this.__getNowWorld(e),this.__worldOpacity){const s=this.__;if(s.__useDim)if(s.dim)e.dimOpacity=!0===s.dim?.2:s.dim;else{if(s.bright&&!e.topRendering)return e.topList.add(this);s.dimskip&&e.dimOpacity&&(e.dimOpacity=0)}if(s.__single&&!this.isBranchLeaf){if("path"===s.eraser)return this.__renderEraser(t,e);const i=t.getSameCanvas(!1,!0);this.__renderBranch(i,e);const r=this.__nowWorld;t.opacity=e.dimOpacity?s.opacity*e.dimOpacity:s.opacity,t.copyWorldByReset(i,r,r,s.__blendMode,!0),i.recycle(r)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:s}=this;for(let i=0,r=s.length;i<r;i++)ka(s[i],e)||s[i].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:s}=this;for(let i=0,r=s.length;i<r;i++)ka(s[i],e)||s[i].__clip(t,e)}}},Ra={},{LEAF:Ca,create:Ta}=s,{stintSet:Pa}=p,{toInnerPoint:La,toOuterPoint:Ea,multiplyParent:Ia}=G,{toOuterOf:Oa}=Mt,{copy:Aa,move:Wa}=st,{moveLocal:Ma,zoomOfLocal:Da,rotateOfLocal:Fa,skewOfLocal:za,moveWorld:Ua,zoomOfWorld:Na,rotateOfWorld:Ya,skewOfWorld:Xa,transform:Ha,transformWorld:Ga,setTransform:Va,getFlipTransform:ja,getLocalOrigin:qa,getRelativeWorld:Qa,drop:Ja}=$o;t.Leaf=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return g}get __LayoutProcessor(){return kn}get leaferIsCreated(){return this.leafer&&this.leafer.created}get leaferIsReady(){return this.leafer&&this.leafer.ready}get isLeafer(){return!1}get isBranch(){return!1}get isBranchLeaf(){return!1}get __localMatrix(){return this.__local||this.__layout}get __localBoxBounds(){return this.__local||this.__layout}get worldTransform(){return this.__layout.getTransform("world")}get localTransform(){return this.__layout.getTransform("local")}get scrollWorldTransform(){return this.updateLayout(),this.__scrollWorld||this.__world}get boxBounds(){return this.getBounds("box","inner")}get renderBounds(){return this.getBounds("render","inner")}get worldBoxBounds(){return this.getBounds("box")}get worldStrokeBounds(){return this.getBounds("stroke")}get worldRenderBounds(){return this.getBounds("render")}get worldOpacity(){return this.updateLayout(),this.__worldOpacity}get __worldFlipped(){return this.__world.scaleX<0||this.__world.scaleY<0}get __onlyHitMask(){return this.__hasMask&&!this.__.hitChildren}get __ignoreHitWorld(){return(this.__hasMask||this.__hasEraser)&&this.__.hitChildren}get __inLazyBounds(){return this.leaferIsCreated&&this.leafer.lazyBounds.hit(this.__world)}get pathInputed(){return this.__.__pathInputed}set event(t){this.on(t)}constructor(t){this.innerId=Ta(Ca),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Rn.CREATED)}reset(t){this.leafer&&this.leafer.forceRender(this.__world),0!==t&&(this.__world={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0,scaleX:1,scaleY:1},null!==t&&(this.__local={a:1,b:0,c:0,d:1,e:0,f:0,x:0,y:0,width:0,height:0})),this.__worldOpacity=1,this.__=new this.__DataProcessor(this),this.__layout=new this.__LayoutProcessor(this),this.__level&&this.resetCustom(),t&&(t.__&&(t=t.toJSON()),t.children?this.set(t):Object.assign(this,t))}resetCustom(){this.__hasMask=this.__hasEraser=null,this.forceUpdate()}waitParent(t,e){e&&(t=t.bind(e)),this.parent?t():this.on(Rn.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Rn.MOUNTED,t,"once")}nextRender(t,e,s){this.leafer?this.leafer.nextRender(t,e,s):this.waitLeafer(()=>this.leafer.nextRender(t,e,s))}removeNextRender(t){this.nextRender(t,null,"off")}__bindLeafer(t){if(this.isLeafer&&null!==t&&(t=this),this.leafer&&!t&&this.leafer.leafs--,this.leafer=t,t?(t.leafs++,this.__level=this.parent?this.parent.__level+1:1,this.animation&&this.__runAnimation("in"),this.__bubbleMap&&this.__emitLifeEvent(Rn.MOUNTED)):this.__emitLifeEvent(Rn.UNMOUNTED),this.isBranch){const{children:e}=this;for(let s=0,i=e.length;s<i;s++)e[s].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){o(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=o(e)?null:void 0,this[t]=e}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(t,e){}__updateContentBounds(){}__updateStrokeBounds(t){}__updateRenderBounds(t){}__updateAutoLayout(){}__updateFlowLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some(t=>t.__.eraser)}__renderEraser(t,e){t.save(),this.__clip(t,e);const{renderBounds:s}=this.__layout;t.clearRect(s.x,s.y,s.width,s.height),t.restore()}__updateMask(t){this.__hasMask=this.children.some(t=>t.__.mask&&t.__.visible&&t.__.opacity)}__renderMask(t,e){}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld,s=this.__world;return Ia(s,t.matrix,e,void 0,s),Oa(this.__layout.renderBounds,e,e),Pa(e,"half",s.half),Pa(e,"ignorePixelSnap",s.ignorePixelSnap),e}return this.__world}getClampRenderScale(){let{scaleX:t}=this.__nowWorld||this.__world;return t<0&&(t=-t),t>1?t:1}getRenderScaleData(t,e){let{scaleX:s,scaleY:i}=Hr.patternLocked?this.__world:this.__nowWorld;return t&&(s<0&&(s=-s),i<0&&(i=-i)),(!0===e||"zoom-in"===e&&s>1&&i>1)&&(s=i=1),Ra.scaleX=s,Ra.scaleY=i,Ra}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,s){return this.__layout.getLayoutBounds(t,e,s)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,s){const i=e?Qa(this,e):this.worldTransform,r=s?t:{};return Oa(t,i,r),r}worldToLocal(t,e,s,i){this.parent?this.parent.worldToInner(t,e,s,i):e&&Aa(e,t)}localToWorld(t,e,s,i){this.parent?this.parent.innerToWorld(t,e,s,i):e&&Aa(e,t)}worldToInner(t,e,s,i){i&&(i.innerToWorld(t,e,s),t=e||t),La(this.scrollWorldTransform,t,e,s)}innerToWorld(t,e,s,i){Ea(this.scrollWorldTransform,t,e,s),i&&i.worldToInner(e||t,null,s)}getBoxPoint(t,e,s,i){return this.getBoxPointByInner(this.getInnerPoint(t,e,s,i),null,null,!0)}getBoxPointByInner(t,e,s,i){const r=i?t:Object.assign({},t),{x:o,y:n}=this.boxBounds;return Wa(r,-o,-n),r}getInnerPoint(t,e,s,i){const r=i?t:{};return this.worldToInner(t,r,s,e),r}getInnerPointByBox(t,e,s,i){const r=i?t:Object.assign({},t),{x:o,y:n}=this.boxBounds;return Wa(r,o,n),r}getInnerPointByLocal(t,e,s,i){return this.getInnerPoint(t,this.parent,s,i)}getLocalPoint(t,e,s,i){const r=i?t:{};return this.worldToLocal(t,r,s,e),r}getLocalPointByInner(t,e,s,i){return this.getWorldPoint(t,this.parent,s,i)}getPagePoint(t,e,s,i){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,s,i)}getWorldPoint(t,e,s,i){const r=i?t:{};return this.innerToWorld(t,r,s,e),r}getWorldPointByBox(t,e,s,i){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,i),e,s,!0)}getWorldPointByLocal(t,e,s,i){const r=i?t:{};return this.localToWorld(t,r,s,e),r}getWorldPointByPage(t,e,s,i){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,s,i)}setTransform(t,e,s){Va(this,t,e,s)}transform(t,e,s){Ha(this,t,e,s)}move(t,e,s){Ma(this,t,e,s)}moveInner(t,e,s){Ua(this,t,e,!0,s)}scaleOf(t,e,s,i,r){Da(this,qa(this,t),e,s,i,r)}rotateOf(t,e,s){Fa(this,qa(this,t),e,s)}skewOf(t,e,s,i,r){za(this,qa(this,t),e,s,i,r)}transformWorld(t,e,s){Ga(this,t,e,s)}moveWorld(t,e,s){Ua(this,t,e,!1,s)}scaleOfWorld(t,e,s,i,r){Na(this,t,e,s,i,r)}rotateOfWorld(t,e){Ya(this,t,e)}skewOfWorld(t,e,s,i,r){Xa(this,t,e,s,i,r)}flip(t,e){Ha(this,ja(this,t),!1,e)}scaleResize(t,e=t,s){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}hit(t,e){return!0}__hitWorld(t){return!0}__hit(t){return!0}__hitFill(t){return!0}__hitStroke(t,e){return!0}__hitPixel(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e,s){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return Zt.need("path")}getMotionPoint(t){return Zt.need("path")}getMotionTotal(){return 0}__updateMotionPath(){}__runAnimation(t,e){}__updateSortChildren(){}add(t,e){}remove(t,e){this.parent&&this.parent.remove(this,e)}dropTo(t,e,s){Ja(this,t,e,s)}on(t,e,s){}off(t,e,s){}on_(t,e,s,i){}off_(t){}once(t,e,s,i){}emit(t,e,s){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,s){s?this.addAttr(t,e,s):Eo(this.prototype,t,e)}static addAttr(t,e,s,i){s||(s=lo),s(e,i)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Rn(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Rn.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}},t.Leaf=ae([Fo(aa),Fo(pa),Fo(ba),Fo(oa),Fo(Ba)],t.Leaf);const{setListWithFn:$a}=Mt,{sort:Za}=dn,{localBoxBounds:Ka,localStrokeBounds:th,localRenderBounds:eh,maskLocalBoxBounds:sh,maskLocalStrokeBounds:ih,maskLocalRenderBounds:rh}=nn,oh=new Gt("Branch");t.Branch=class extends t.Leaf{__updateStrokeSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,s=t.length;e<s;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(t,e){$a(e||this.__layout.boxBounds,this.children,this.__hasMask?sh:Ka)}__updateStrokeBounds(t){$a(t||this.__layout.strokeBounds,this.children,this.__hasMask?ih:th)}__updateRenderBounds(t){$a(t||this.__layout.renderBounds,this.children,this.__hasMask?rh:eh)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let s=0,i=e.length;s<i;s++)e[s].__tempNumber=s,e[s].__.zIndex&&(t=!0);e.sort(Za),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return oh.warn("add self or destroyed");const s=o(e);if(!t.__){if(c(t))return t.forEach(t=>{this.add(t,e),s||e++});t=ee.get(t.tag,t)}t.parent&&t.parent.remove(t),t.parent=this,s?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const i=t.__layout;i.boxChanged||i.boxChange(),i.matrixChanged||i.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(Rn.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Rn.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){this.add(t)}remove(t,e){t?t.__?t.animationOut?t.__runAnimation("out",()=>this.__remove(t,e)):this.__remove(t,e):this.find(t).forEach(t=>this.remove(t,e)):o(t)&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach(e=>{this.__realRemoveChild(e),t&&e.destroy()}))}clear(){this.removeAll(!0)}__remove(t,e){const s=this.children.indexOf(t);s>-1&&(this.children.splice(s,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.__emitLifeEvent(Rn.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Rn.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const s=new Rn(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),this.leafer.emitEvent(s)}},t.Branch=ae([Fo(Sa)],t.Branch);class nh{get length(){return this.list.length}constructor(t){this.reset(),t&&(c(t)?this.addList(t):this.add(t))}has(t){return t&&!o(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return o(e)?-1:e}add(t){const{list:e,keys:s}=this;o(s[t.innerId])&&(e.push(t),s[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:s}=this;if(o(s[t.innerId])){const{list:i}=this;for(let t=e,r=i.length;t<r;t++)s[i[t].innerId]++;0===e?i.unshift(t):(e>i.length&&(e=i.length),i.splice(e,0,t)),s[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let s;for(let i=0,r=e.length;i<r;i++)o(s)?e[i].innerId===t.innerId&&(s=i,delete this.keys[t.innerId]):this.keys[e[i].innerId]=i-1;o(s)||e.splice(s,1)}sort(t){const{list:e}=this;t?e.sort((t,e)=>e.__level-t.__level):e.sort((t,e)=>t.__level-e.__level)}forEach(t){this.list.forEach(t)}clone(){const t=new nh;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let s=0,i=t.length;s<i;s++)e[t[s].innerId]=s}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class ah{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(c(t)?this.addList(t):this.add(t))}has(t){return!o(this.keys[t.innerId])}without(t){return o(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap:s}=this;e[t.innerId]||(e[t.innerId]=1,s[t.__level]?s[t.__level].push(t):(s[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(s=>{e=this.levelMap[s];for(let s=0,i=e.length;s<i;s++)t(e[s])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}const hh=Gt.get("LeaferCanvas");class lh extends be{set zIndex(t){const{style:e}=this.view;e.zIndex=t,this.setAbsolute(this.view)}set childIndex(t){const{view:e,parentView:s}=this;if(e&&s){const i=s.children[t];i?(this.setAbsolute(i),s.insertBefore(e,i)):s.appendChild(i)}}init(){const{config:t}=this,s=t.view||t.canvas;s?this.__createViewFrom(s):this.__createView();const{style:i}=this.view;if(i.display||(i.display="block"),this.parentView=this.view.parentElement,this.parentView){const t=this.parentView.style;t.webkitUserSelect=t.userSelect="none"}e.syncDomFont&&!this.parentView&&(i.display="none",document.body&&document.body.appendChild(this.view)),this.__createContext(),this.autoLayout||this.resize(t)}set backgroundColor(t){this.view.style.backgroundColor=t}get backgroundColor(){return this.view.style.backgroundColor}set hittable(t){this.view.style.pointerEvents=t?"auto":"none"}get hittable(){return"none"!==this.view.style.pointerEvents}__createView(){this.view=document.createElement("canvas")}__createViewFrom(t){let e=a(t)?document.getElementById(t):t;if(e)if(e instanceof HTMLCanvasElement)this.view=e;else{let t=e;if(e===window||e===document){const e=document.createElement("div"),{style:s}=e;s.position="absolute",s.top=s.bottom=s.left=s.right="0px",document.body.appendChild(e),t=e}this.__createView();const s=this.view;t.hasChildNodes()&&(this.setAbsolute(s),t.style.position||(t.style.position="relative")),t.appendChild(s)}else hh.error(`no id: ${t}`),this.__createView()}setAbsolute(t){const{style:e}=t;e.position="absolute",e.top=e.left="0px"}updateViewSize(){const{width:t,height:e,pixelRatio:s}=this,{style:i}=this.view;if(this.unreal){const{config:t,autoWidthStr:e,autoHeightStr:s}=this;t.width?(o(e)&&(this.autoWidthStr=i.width||""),i.width=t.width+"px"):o(e)||(i.width=e),t.height?(o(s)&&(this.autoHeightStr=i.height||""),i.height=t.height+"px"):o(s)||(i.height=s)}else i.width=t+"px",i.height=e+"px",this.view.width=Math.ceil(t*s),this.view.height=Math.ceil(e*s)}updateClientBounds(){this.view.parentElement&&(this.clientBounds=this.view.getBoundingClientRect())}startAutoLayout(t,e){if(this.resizeListener=e,t){if(this.autoBounds=t,this.resizeObserver)return;try{this.resizeObserver=new ResizeObserver(t=>{this.updateClientBounds();for(const e of t)this.checkAutoBounds(e.contentRect)});const t=this.parentView;t?(this.resizeObserver.observe(t),this.checkAutoBounds(t.getBoundingClientRect())):(this.checkAutoBounds(this.view),hh.warn("no parent"))}catch(t){this.imitateResizeObserver()}this.stopListenPixelRatio()}else this.listenPixelRatio(),this.unreal&&this.updateViewSize()}imitateResizeObserver(){this.autoLayout&&(this.parentView&&this.checkAutoBounds(this.parentView.getBoundingClientRect()),e.requestRender(this.imitateResizeObserver.bind(this)))}listenPixelRatio(){this.windowListener||window.addEventListener("resize",this.windowListener=()=>{const t=e.devicePixelRatio;if(!this.config.pixelRatio&&this.pixelRatio!==t){const{width:e,height:s}=this;this.emitResize({width:e,height:s,pixelRatio:t})}})}stopListenPixelRatio(){this.windowListener&&(window.removeEventListener("resize",this.windowListener),this.windowListener=null)}checkAutoBounds(t){const s=this.view,{x:i,y:r,width:o,height:n}=this.autoBounds.getBoundsFrom(t),a={width:o,height:n,pixelRatio:this.config.pixelRatio?this.pixelRatio:e.devicePixelRatio};if(!this.isSameSize(a)){const{style:t}=s;t.marginLeft=i+"px",t.marginTop=r+"px",this.emitResize(a)}}stopAutoLayout(){this.autoLayout=!1,this.resizeObserver&&this.resizeObserver.disconnect(),this.resizeListener=this.resizeObserver=null}emitResize(t){const e={};p.copyAttrs(e,this,ve),this.resize(t),this.resizeListener&&!o(this.width)&&this.resizeListener(new Dn(t,e))}unrealCanvas(){if(!this.unreal&&this.parentView){const t=this.view;t&&t.remove(),this.view=this.parentView,this.unreal=!0}}destroy(){if(this.view){if(this.stopAutoLayout(),this.stopListenPixelRatio(),!this.unreal){const t=this.view;t.parentElement&&t.remove()}super.destroy()}}}Wr(CanvasRenderingContext2D.prototype),Wr(Path2D.prototype);const{mineType:dh,fileType:ch}=Mr;function uh(t,s){e.origin={createCanvas(t,e){const s=document.createElement("canvas");return s.width=t,s.height=e,s},canvasToDataURL:(t,e,s)=>{const i=dh(e),r=t.toDataURL(i,s);return"image/bmp"===i?r.replace("image/png;","image/bmp;"):r},canvasToBolb:(t,e,s)=>new Promise(i=>t.toBlob(i,dh(e),s)),canvasSaveAs:(t,s,i)=>{const r=t.toDataURL(dh(ch(s)),i);return e.origin.download(r,s)},download:(t,e)=>new Promise(s=>{let i=document.createElement("a");i.href=t,i.download=e,document.body.appendChild(i),i.click(),document.body.removeChild(i),s()}),loadImage:t=>new Promise((s,i)=>{const r=new e.origin.Image,{crossOrigin:o}=e.image;o&&(r.setAttribute("crossOrigin",o),r.crossOrigin=o),r.onload=()=>{s(r)},r.onerror=t=>{i(t)},r.src=e.image.getRealURL(t)}),Image:Image,PointerEvent:PointerEvent,DragEvent:DragEvent},e.event={stopDefault(t){t.preventDefault()},stopNow(t){t.stopImmediatePropagation()},stop(t){t.stopPropagation()}},e.canvas=Kt.canvas(),e.conicGradientSupport=!!e.canvas.context.createConicGradient}Object.assign(Kt,{canvas:(t,e)=>new lh(t,e),image:t=>new Jr(t)}),e.name="web",e.isMobile="ontouchstart"in window,e.requestRender=function(t){window.requestAnimationFrame(t)},$r(e,"devicePixelRatio",{get:()=>devicePixelRatio});const{userAgent:_h}=navigator;_h.indexOf("Firefox")>-1?(e.conicGradientRotate90=!0,e.intWheelDeltaY=!0,e.syncDomFont=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(e.fullImageShadow=!0),_h.indexOf("Windows")>-1?(e.os="Windows",e.intWheelDeltaY=!0):_h.indexOf("Mac")>-1?e.os="Mac":_h.indexOf("Linux")>-1&&(e.os="Linux");class ph{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new nh;return this.__updatedList.list.forEach(e=>{e.leafer&&t.add(e)}),t}return this.__updatedList}constructor(t,e){this.totalTimes=0,this.config={},this.__updatedList=new nh,this.target=t,e&&(this.config=p.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(Un.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===Rn.ADD?(this.hasAdd=!0,this.__pushChild(t.child)):(this.hasRemove=!0,this.__updatedList.add(t.parent)),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new Fn(Fn.DATA,{updatedList:this.updatedList})),this.__updatedList=new nh,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[Tn.CHANGE,this.__onAttrChange,this],[[Rn.ADD,Rn.REMOVE],this.__onChildEvent,this],[Fn.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:fh,updateBounds:gh,updateChange:yh}=$o,{pushAllChildBranch:mh,pushAllParent:xh}=dn;const{worldBounds:wh}=nn;class vh{constructor(t){this.updatedBounds=new Ut,this.beforeBounds=new Ut,this.afterBounds=new Ut,c(t)&&(t=new nh(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,wh)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,wh),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:bh,updateAllChange:Bh}=$o,kh=Gt.get("Layouter");class Sh{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new ah,this.target=t,e&&(this.config=p.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target:t}=this;this.times=0;try{t.emit(zn.START),this.layoutOnce(),t.emitEvent(new zn(zn.END,this.layoutedBlocks,this.times))}catch(t){kh.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?kh.warn("layouting"):this.times>3?kh.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(Fn.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=Qt.start("PartLayout"),{target:s,__updatedList:i}=this,{BEFORE:r,LAYOUT:o,AFTER:n}=zn,a=this.getBlocks(i);a.forEach(t=>t.setBefore()),s.emitEvent(new zn(r,a,this.times)),this.extraBlock=null,i.sort(),function(t,e){let s;t.list.forEach(t=>{s=t.__layout,e.without(t)&&!s.proxyZoom&&(s.matrixChanged?(fh(t,!0),e.add(t),t.isBranch&&mh(t,e),xh(t,e)):s.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),xh(t,e)))})}(i,this.__levelList),function(t){let e,s,i;t.sort(!0),t.levels.forEach(r=>{e=t.levelMap[r];for(let t=0,r=e.length;t<r;t++){if(s=e[t],s.isBranch&&s.__tempNumber){i=s.children;for(let t=0,e=i.length;t<e;t++)i[t].isBranch||gh(i[t])}gh(s)}})}(this.__levelList),function(t){t.list.forEach(yh)}(i),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),s.emitEvent(new zn(o,a,this.times)),s.emitEvent(new zn(n,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,Qt.end(e)}fullLayout(){const t=Qt.start("FullLayout"),{target:e}=this,{BEFORE:s,LAYOUT:i,AFTER:r}=zn,o=this.getBlocks(new nh(e));e.emitEvent(new zn(s,o,this.times)),Sh.fullLayout(e),o.forEach(t=>{t.setAfter()}),e.emitEvent(new zn(i,o,this.times)),e.emitEvent(new zn(r,o,this.times)),this.addBlocks(o),Qt.end(t)}static fullLayout(t){bh(t,!0),t.isBranch?dn.updateBounds(t):$o.updateBounds(t),Bh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:s}=this.extraBlock||(this.extraBlock=new vh([]));e.length?s.add(t.__world):s.set(t.__world),e.add(t)}}createBlock(t){return new vh(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){this.__eventIds=[this.target.on_([[zn.REQUEST,this.layout,this],[zn.AGAIN,this.layoutAgain,this],[Fn.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Rh=Gt.get("Renderer");class Ch{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,s){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,s&&(this.config=p.default(s,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.__requestRender()}requestLayout(){this.target.emit(zn.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(Un.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(Un.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(Un.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new Ut,Rh.log(e.innerName,"---\x3e");try{this.emitRender(Un.START),this.renderOnce(t),this.emitRender(Un.END,this.totalBounds),Hr.clearRecycled()}catch(t){this.rendering=!1,Rh.error(t)}Rh.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Rh.warn("rendering");if(this.times>3)return Rh.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Ut,this.renderOptions={},t)this.emitRender(Un.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(Un.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(Un.RENDER,this.renderBounds,this.renderOptions),this.emitRender(Un.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,this.waitAgain&&(this.waitAgain=!1,this.renderOnce())}partRender(){const{canvas:t,updateBlocks:e}=this;e&&(this.mergeBlocks(),e.forEach(e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=Qt.start("PartRender"),{canvas:s}=this,i=t.getIntersect(s.bounds),r=new Ut(i);s.save(),i.spread(Ch.clipSpread).ceil(),s.clearWorld(i),s.clipWorld(i),this.__render(i,r),s.restore(),Qt.end(e)}fullRender(){const t=Qt.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),Qt.end(t)}__render(t,s){const{canvas:i}=this,r=t.includes(this.target.__world),o=r?{includes:r}:{bounds:t,includes:r};this.needFill&&i.fillWorld(t,this.config.fill),Gt.showRepaint&&Gt.drawRepaint(i,t),e.render(this.target,i,o),this.renderBounds=s=s||t,this.renderOptions=o,this.totalBounds.isEmpty()?this.totalBounds=s:this.totalBounds.add(s),i.updateRender(s)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new Ut;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const s=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:i}=this.config;if(i&&t>i)return e.requestRender(s);const{frames:r}=this;r.length>30&&r.shift(),r.push(t),this.FPS=Math.round(r.reduce((t,e)=>t+e,0)/r.length),this.requestTime=0,this.checkRender()};e.requestRender(s)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:s}=t.old;if(!new Ut(0,0,e,s).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new Ut(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;t.updatedList&&t.updatedList.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||Rh.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,e,s){this.target.emitEvent(new Un(t,this.times,e,s))}__listenEvents(){this.__eventIds=[this.target.on_([[Un.REQUEST,this.update,this],[zn.END,this.__onLayoutEnd,this],[Un.AGAIN,this.renderAgain,this],[Dn.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}function Th(t){return to(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Ph(t){return to(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Lh(){return(t,e)=>{const s="_"+e;$r(t,e,{set(t){this.isLeafer&&(this[s]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[s]||this:this.leafer&&this.leafer.zoomLayer}})}}Ch.clipSpread=10,Object.assign(Kt,{watcher:(t,e)=>new ph(t,e),layouter:(t,e)=>new Sh(t,e),renderer:(t,e,s)=>new Ch(t,e,s),selector:(t,e)=>{},interaction:(t,e,s,i)=>{}}),e.layout=Sh.fullLayout,e.render=function(t,e,s){const i=Object.assign(Object.assign({},s),{topRendering:!0});s.topList=new nh,t.__render(e,s),s.topList.length&&s.topList.forEach(t=>t.__render(e,i))};const Eh={},Ih={hasTransparent:function(t){if(!t||7===t.length||4===t.length)return!1;if("transparent"===t)return!0;const e=t[0];if("#"===e)switch(t.length){case 5:return"f"!==t[4]&&"F"!==t[4];case 9:return"f"!==t[7]&&"F"!==t[7]||"f"!==t[8]&&"F"!==t[8]}else if(("r"===e||"h"===e)&&"a"===t[3]){const e=t.lastIndexOf(",");if(e>-1)return parseFloat(t.slice(e+1))<1}return!1}},Oh={number:(t,e)=>u(t)?"percent"===t.type?t.value*e:t.value:t},Ah={},Wh={},Mh={},Dh={},Fh={},zh={apply(){Zt.need("filter")}},Uh={},Nh={setStyleName:()=>Zt.need("state"),set:()=>Zt.need("state")},Yh={list:{},register(t,e){Yh.list[t]=e},get:t=>Yh.list[t]},{parse:Xh,objectToCanvasData:Hh}=Gs,{stintSet:Gh}=p,{hasTransparent:Vh}=Ih,jh={},qh=Gt.get("UIData");class Qh extends g{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){return this.__getRealStrokeWidth()}get __maxStrokeWidth(){const t=this;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,t.strokeWidth):t.strokeWidth}get __hasMultiPaint(){const t=this;return t.fill&&this.__useStroke||t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return!this._width}get __autoHeight(){return!this._height}get __autoSide(){return!this._width||!this._height}get __autoSize(){return!this._width&&!this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,qh.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,qh.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),a(t)||!t?(Gh(this,"__isTransparentFill",Vh(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):u(t)&&this.__setPaint("fill",t)}setStroke(t){a(t)||!t?(Gh(this,"__isTransparentStroke",Vh(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):u(t)&&this.__setPaint("stroke",t)}setPath(t){const e=a(t);e||t&&u(t[0])?(this.__setInput("path",t),this._path=e?Xh(t):Hh(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){Jh(this,"shadow",t)}setInnerShadow(t){Jh(this,"innerShadow",t)}setFilter(t){Jh(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Wh.compute("fill",this.__leaf),e&&Wh.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:s}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),o(t.strokeWidthFixed)||(s=t.strokeWidthFixed)),s){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const s=this.__leaf.__layout;s.boxChanged||s.boxChange(),c(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=jh)):(this.__isStrokes=!0,this._stroke||(this._stroke=jh))}__removePaint(t,e){e&&this.__removeInput(t),Mh.recycleImage(t,this),"fill"===t?(Gh(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(Gh(this,"__isAlphaPixelStroke",void 0),Gh(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function Jh(t,e,s){t.__setInput(e,s),c(s)?(s.some(t=>!1===t.visible)&&(s=s.filter(t=>!1!==t.visible)),s.length||(s=void 0)):s=s&&!1!==s.visible?[s]:void 0,t["_"+e]=s}class $h extends Qh{}class Zh extends $h{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){return this.__single||this.__clipAfterFill}get __clipAfterFill(){const t=this;return"show"!==t.overflow&&t.__leaf.children.length&&(t.__leaf.isOverflow||super.__clipAfterFill)}}class Kh extends $h{__getInputData(t,e){const s=super.__getInputData(t,e);return ve.forEach(t=>delete s[t]),s}}class tl extends Zh{}class el extends Qh{get __usePathBox(){return this.points||this.__pathInputed}}class sl extends Qh{get __boxStroke(){return!this.__pathInputed}}class il extends Qh{get __boxStroke(){return!this.__pathInputed}}class rl extends el{}class ol extends Qh{}class nl extends Qh{get __pathInputed(){return 2}}class al extends $h{}const hl={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class ll extends Qh{get __useNaturalRatio(){return!1}setFontWeight(t){a(t)?(this.__setInput("fontWeight",t),t=hl[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,s=e.__box;if(t){const{boxStyle:i}=this;if(s)for(let t in i)s[t]=void 0;else s=e.__box=ee.get("Rect",0);const r=e.__layout,o=s.__layout;i||(s.parent=e,s.__world=e.__world,o.boxBounds=r.boxBounds),s.set(t),o.strokeChanged&&r.strokeChange()}else s&&(e.__box=s.parent=null,s.destroy());this._boxStyle=t}}class dl extends sl{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:"image",mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return t.url&&delete t.fill,t}__getInputData(t,e){const s=super.__getInputData(t,e);return s.url&&delete s.fill,s}}class cl extends sl{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const s=super.__getInputData(t,e);return s.url=this.__leaf.canvas.toDataURL("image/png"),s}}const{max:ul,add:_l}=b,pl={__updateStrokeSpread(){let t=0,e=0;const s=this.__,{strokeAlign:i,__maxStrokeWidth:r}=s,o=this.__box;if((s.stroke||"all"===s.hitStroke)&&r&&"inside"!==i&&(e=t="center"===i?r/2:r,!s.__boxStroke)){const e=s.__isLinePath?0:10*t,i="none"===s.strokeCap?0:r;t+=Math.max(e,i)}return s.__useArrow&&(t+=5*r),o&&(t=ul(t,o.__layout.strokeSpread=o.__updateStrokeSpread()),e=Math.max(e,o.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:s,blur:i,backgroundBlur:r,filter:o,renderSpread:n}=this.__,{strokeSpread:a}=this.__layout,h=this.__box;e&&(t=Fh.getShadowRenderSpread(this,e)),i&&(t=ul(t,i)),o&&(t=_l(t,zh.getSpread(o))),n&&(t=_l(t,n)),a&&(t=_l(t,a));let l=t;return s&&(l=ul(l,Fh.getInnerShadowSpread(this,s))),r&&(l=ul(l,r)),this.__layout.renderShapeSpread=l,h?ul(h.__updateRenderSpread(),t):t}},{stintSet:fl}=p,gl={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);fl(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),fl(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:s,stroke:i}=t,r=t.innerShadow||t.blur||t.backgroundBlur||t.filter;fl(t,"__isFastShadow",e&&!r&&e.length<2&&!e[0].spread&&!Fh.isTransformShadow(e[0])&&s&&!t.__isTransparentFill&&!(c(s)&&s.length>1)&&(this.useFastShadow||!i||i&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!r)}t.__checkSingle(),fl(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){yl(this,t,e)},__draw(t,e,s){const i=this.__;if(i.__complex){i.__needComputePaint&&i.__computePaint();const{fill:r,stroke:o,__drawAfterFill:n,__fillAfterStroke:a,__isFastShadow:h}=i;if(this.__drawRenderPath(t),i.__useEffect&&!h){const h=Wh.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=i;l&&Fh.shadow(this,t,h),a&&(i.__isStrokes?Wh.strokes(o,this,t):Wh.stroke(o,this,t)),r&&(i.__isFills?Wh.fills(r,this,t):Wh.fill(r,this,t)),n&&this.__drawAfterFill(t,e),d&&Fh.innerShadow(this,t,h),o&&!a&&(i.__isStrokes?Wh.strokes(o,this,t):Wh.stroke(o,this,t)),c&&zh.apply(c,this,this.__nowWorld,t,s,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(i.__isStrokes?Wh.strokes(o,this,t):Wh.stroke(o,this,t)),h){const e=i.shadow[0],{scaleX:s,scaleY:r}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*s,e.y*r,e.blur*s,Ih.string(e.color))}r&&(i.__isFills?Wh.fills(r,this,t):Wh.fill(r,this,t)),h&&t.restore(),n&&this.__drawAfterFill(t,e),o&&!a&&(i.__isStrokes?Wh.strokes(o,this,t):Wh.stroke(o,this,t))}}else i.__pathInputed?yl(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const s=this.__,{fill:i,stroke:r}=s;i&&!e.ignoreFill&&(s.__isAlphaPixelFill?Wh.fills(i,this,t):Wh.fill("#000000",this,t)),s.__isCanvas&&this.__drawAfterFill(t,e),r&&!e.ignoreStroke&&(s.__isAlphaPixelStroke?Wh.strokes(r,this,t):Wh.stroke("#000000",this,t))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function yl(t,e,s){const{fill:i,stroke:r,__drawAfterFill:o,__fillAfterStroke:n}=t.__;t.__drawRenderPath(e),n&&Wh.stroke(r,t,e),i&&Wh.fill(i,t,e),o&&t.__drawAfterFill(e,s),r&&!n&&Wh.stroke(r,t,e)}const ml={__drawFast(t,e){let{x:s,y:i,width:r,height:o}=this.__layout.boxBounds;const{fill:n,stroke:a,__drawAfterFill:h}=this.__;if(n&&(t.fillStyle=n,t.fillRect(s,i,r,o)),h&&this.__drawAfterFill(t,e),a){const{strokeAlign:n,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(a,h,this.__);const l=h/2;switch(n){case"center":t.strokeRect(0,0,r,o);break;case"inside":r-=h,o-=h,r<0||o<0?(t.save(),this.__clip(t,e),t.strokeRect(s+l,i+l,r,o),t.restore()):t.strokeRect(s+l,i+l,r,o);break;case"outside":t.strokeRect(s-l,i-l,r+h,o+h)}}}};var xl,wl;t.UI=xl=class extends t.Leaf{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){L.assignScale(this,t)}get scale(){return this.__.scale}get isAutoWidth(){const t=this.__;return t.__autoWidth||t.autoWidth}get isAutoHeight(){const t=this.__;return t.__autoHeight||t.autoHeight}get pen(){const{path:t}=this.__;return Or.set(this.path=t||[]),t||this.__drawPathByBox(Or),Or}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return a(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return Zt.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return Zt.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let s=e?this.__.__pathForRender:this.__.path;return s||(Or.set(s=[]),this.__drawPathByBox(Or)),t?Gs.toCanvasData(s,!0):s}getPathString(t,e,s){return Gs.stringify(this.getPath(t,e),s)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||Uh.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?Er.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&Ah.addArrows(this)):t.__pathForRender&&(t.__pathForRender=void 0)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){e?Vi.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:s,width:i,height:r}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:o}=this.__;t.roundRect(e,s,i,r,l(o)?[o]:o)}else t.rect(e,s,i,r)}drawImagePlaceholder(t,e){Wh.fill(this.__.placeholderColor,this,t)}animate(t,e,s,i){return this.set(t),Zt.need("animate")}killAnimate(t,e){}export(t,e){return Zt.need("export")}syncExport(t,e){return Zt.need("export")}clone(t){const e=p.clone(this.toJSON());return t&&Object.assign(e,t),xl.one(e)}static one(t,e,s,i,r){return ee.get(t.tag||this.prototype.__tag,t,e,s,i,r)}static registerUI(){zo()(this)}static registerData(t){Lo(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}},ae([Lo(Qh)],t.UI.prototype,"__",void 0),ae([Lh()],t.UI.prototype,"zoomLayer",void 0),ae([io("")],t.UI.prototype,"id",void 0),ae([io("")],t.UI.prototype,"name",void 0),ae([io("")],t.UI.prototype,"className",void 0),ae([xo("pass-through")],t.UI.prototype,"blendMode",void 0),ae([vo(1)],t.UI.prototype,"opacity",void 0),ae([bo(!0)],t.UI.prototype,"visible",void 0),ae([xo(!1)],t.UI.prototype,"locked",void 0),ae([wo(!1)],t.UI.prototype,"dim",void 0),ae([wo(!1)],t.UI.prototype,"dimskip",void 0),ae([So(0)],t.UI.prototype,"zIndex",void 0),ae([Ro(!1)],t.UI.prototype,"mask",void 0),ae([Co(!1)],t.UI.prototype,"eraser",void 0),ae([ro(0,!0)],t.UI.prototype,"x",void 0),ae([ro(0,!0)],t.UI.prototype,"y",void 0),ae([lo(100,!0)],t.UI.prototype,"width",void 0),ae([lo(100,!0)],t.UI.prototype,"height",void 0),ae([ao(1,!0)],t.UI.prototype,"scaleX",void 0),ae([ao(1,!0)],t.UI.prototype,"scaleY",void 0),ae([ho(0,!0)],t.UI.prototype,"rotation",void 0),ae([ho(0,!0)],t.UI.prototype,"skewX",void 0),ae([ho(0,!0)],t.UI.prototype,"skewY",void 0),ae([ro(0,!0)],t.UI.prototype,"offsetX",void 0),ae([ro(0,!0)],t.UI.prototype,"offsetY",void 0),ae([oo(0,!0)],t.UI.prototype,"scrollX",void 0),ae([oo(0,!0)],t.UI.prototype,"scrollY",void 0),ae([no()],t.UI.prototype,"origin",void 0),ae([no()],t.UI.prototype,"around",void 0),ae([io(!1)],t.UI.prototype,"lazy",void 0),ae([co(1)],t.UI.prototype,"pixelRatio",void 0),ae([mo(0)],t.UI.prototype,"renderSpread",void 0),ae([_o()],t.UI.prototype,"path",void 0),ae([po()],t.UI.prototype,"windingRule",void 0),ae([po(!0)],t.UI.prototype,"closed",void 0),ae([lo(0)],t.UI.prototype,"padding",void 0),ae([lo(!1)],t.UI.prototype,"lockRatio",void 0),ae([lo()],t.UI.prototype,"widthRange",void 0),ae([lo()],t.UI.prototype,"heightRange",void 0),ae([io(!1)],t.UI.prototype,"draggable",void 0),ae([io()],t.UI.prototype,"dragBounds",void 0),ae([io("auto")],t.UI.prototype,"dragBoundsType",void 0),ae([io(!1)],t.UI.prototype,"editable",void 0),ae([To(!0)],t.UI.prototype,"hittable",void 0),ae([To("path")],t.UI.prototype,"hitFill",void 0),ae([yo("path")],t.UI.prototype,"hitStroke",void 0),ae([To(!1)],t.UI.prototype,"hitBox",void 0),ae([To(!0)],t.UI.prototype,"hitChildren",void 0),ae([To(!0)],t.UI.prototype,"hitSelf",void 0),ae([To()],t.UI.prototype,"hitRadius",void 0),ae([Po("")],t.UI.prototype,"cursor",void 0),ae([xo()],t.UI.prototype,"fill",void 0),ae([yo(void 0,!0)],t.UI.prototype,"stroke",void 0),ae([yo("inside")],t.UI.prototype,"strokeAlign",void 0),ae([yo(1,!0)],t.UI.prototype,"strokeWidth",void 0),ae([yo(!1)],t.UI.prototype,"strokeWidthFixed",void 0),ae([yo("none")],t.UI.prototype,"strokeCap",void 0),ae([yo("miter")],t.UI.prototype,"strokeJoin",void 0),ae([yo()],t.UI.prototype,"dashPattern",void 0),ae([yo(0)],t.UI.prototype,"dashOffset",void 0),ae([yo(10)],t.UI.prototype,"miterLimit",void 0),ae([po(0)],t.UI.prototype,"cornerRadius",void 0),ae([po()],t.UI.prototype,"cornerSmoothing",void 0),ae([Th()],t.UI.prototype,"shadow",void 0),ae([Th()],t.UI.prototype,"innerShadow",void 0),ae([Th()],t.UI.prototype,"blur",void 0),ae([Th()],t.UI.prototype,"backgroundBlur",void 0),ae([Th()],t.UI.prototype,"grayscale",void 0),ae([Th()],t.UI.prototype,"filter",void 0),ae([xo()],t.UI.prototype,"placeholderColor",void 0),ae([io(100)],t.UI.prototype,"placeholderDelay",void 0),ae([io({})],t.UI.prototype,"data",void 0),ae([Wo(t.Leaf.prototype.reset)],t.UI.prototype,"reset",null),t.UI=xl=ae([Fo(pl),Fo(gl),Mo()],t.UI),t.Group=class extends t.UI{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:s}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),s.forEach(t=>this.add(t)),t.children=s}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return this.childlessJSON||(e.children=this.children.map(e=>e.toJSON(t))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}},ae([Lo($h)],t.Group.prototype,"__",void 0),ae([lo(0)],t.Group.prototype,"width",void 0),ae([lo(0)],t.Group.prototype,"height",void 0),t.Group=ae([Fo(t.Branch),zo()],t.Group);const vl=Gt.get("Leafer");t.Leafer=wl=class extends t.Group{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&Yr.isComplete}get layoutLocked(){return!this.layouter.running}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||{x:0,y:0,width:0,height:0}}constructor(t,e){super(e),this.config={start:!0,hittable:!0,smooth:!0,lazySpeard:100},this.leafs=0,this.__eventIds=[],this.__controllers=[],this.__readyWait=[],this.__viewReadyWait=[],this.__viewCompletedWait=[],this.__nextRenderWait=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t),wl.list.add(this)}init(t,e){if(this.canvas)return;let s;const{config:i}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),s=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,p.assign(i,t));const r=this.canvas=Kt.canvas(i);this.__controllers.push(this.renderer=Kt.renderer(this,r,i),this.watcher=Kt.watcher(this,i),this.layouter=Kt.layouter(this,i)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),this.view=r.view,e||(this.selector=Kt.selector(this),this.interaction=Kt.interaction(this,r,this.selector,i),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=Kt.hitCanvasManager()),this.canvasManager=new ne,s=i.start),this.hittable=i.hittable,this.fill=i.fill,this.canvasManager.add(r),this.__listenEvents(),s&&(this.__startTimer=setTimeout(this.start.bind(this))),pn.run(this.__initWait),this.onInit()}onInit(){}initType(t){}set(t,e){this.waitInit(()=>{super.set(t,e)})}start(){clearTimeout(this.__startTimer),!this.running&&this.canvas&&(this.running=!0,this.ready?this.emitLeafer(Nn.RESTART):this.emitLeafer(Nn.START),this.__controllers.forEach(t=>t.start()),this.isApp||this.renderer.render())}stop(){clearTimeout(this.__startTimer),this.running&&this.canvas&&(this.__controllers.forEach(t=>t.stop()),this.running=!1,this.emitLeafer(Nn.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=p.copyAttrs({},t,ve);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:s}=this;s&&(s.addBlock(t?new Ut(t):this.canvas.bounds),this.viewReady&&(e?s.render():s.update()))}requestRender(t=!1){this.renderer&&this.renderer.update(t)}updateCursor(t){const e=this.interaction;e&&(t?e.setCursor(t):e.updateCursor())}updateLazyBounds(){this.lazyBounds=this.canvas.bounds.clone().spread(this.config.lazySpeard)}__doResize(t){const{canvas:e}=this;if(!e||e.isSameSize(t))return;const s=p.copyAttrs({},this.canvas,ve);e.resize(t),this.updateLazyBounds(),this.__onResize(new Dn(t,s))}__onResize(t){this.emitEvent(t),p.copyAttrs(this.__,t,ve),setTimeout(()=>{this.canvasManager&&this.canvasManager.clearRecycled()},0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager}__setLeafer(t){this.leafer=t,this.__level=1}__checkAutoLayout(){const{config:t,parentApp:e}=this;e||(t.width&&t.height||(this.autoLayout=new Yt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(ve.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t?this.parent||(this.canvas.hittable=e):"zIndex"===t?(this.canvas.zIndex=e,setTimeout(()=>this.parent&&this.parent.__updateSortChildren())):"mode"===t&&this.emit(Nn.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&ve.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:s,canvas:i}=this,r=p.copyAttrs({},i,ve);r[t]=s[t]=e,s.width&&s.height?i.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(r)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.backgroundColor=t:this.forceRender()}__onCreated(){this.created=!0}__onReady(){this.ready=!0,this.emitLeafer(Nn.BEFORE_READY),this.emitLeafer(Nn.READY),this.emitLeafer(Nn.AFTER_READY),pn.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(Nn.VIEW_READY),pn.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:s}=this.config;if(t){let{width:i,height:r,pixelRatio:o}=this;const n="box"===t?this.worldBoxBounds:this.__world;e||(i=Math.max(1,n.x+n.width)),s||(r=Math.max(1,n.y+n.height)),this.__doResize({width:i,height:r,pixelRatio:o})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){pn.run(this.__nextRenderWait);const{imageReady:t}=this;t&&!this.viewCompleted&&this.__checkViewCompleted(),t||(this.viewCompleted=!1,this.requestRender())}else this.requestRender()}__checkViewCompleted(t=!0){this.nextRender(()=>{this.imageReady&&(t&&this.emitLeafer(Nn.VIEW_COMPLETED),pn.run(this.__viewCompletedWait),this.viewCompleted=!0)})}__onWatchData(){this.watcher.childrenChanged&&this.interaction&&this.nextRender(()=>this.interaction.updateCursor())}waitInit(t,e){e&&(t=t.bind(e)),this.__initWait||(this.__initWait=[]),this.canvas?t():this.__initWait.push(t)}waitReady(t,e){e&&(t=t.bind(e)),this.ready?t():this.__readyWait.push(t)}waitViewReady(t,e){e&&(t=t.bind(e)),this.viewReady?t():this.__viewReadyWait.push(t)}waitViewCompleted(t,e){e&&(t=t.bind(e)),this.__viewCompletedWait.push(t),this.viewCompleted?this.__checkViewCompleted(!1):this.running||this.start()}nextRender(t,e,s){e&&(t=t.bind(e));const i=this.__nextRenderWait;if(s){for(let e=0;e<i.length;e++)if(i[e]===t){i.splice(e,1);break}}else i.push(t);this.requestRender()}zoom(t,e,s,i){return Zt.need("view")}getValidMove(t,e,s){return{x:t,y:e}}getValidScale(t){return t}getWorldPointByClient(t,e){return this.interaction&&this.interaction.getLocal(t,e)}getPagePointByClient(t,e){return this.getPagePoint(this.getWorldPointByClient(t,e))}getClientPointByWorld(t){const{x:e,y:s}=this.clientBounds;return{x:e+t.x,y:s+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(t){this.emitEvent(new Nn(t,this))}__listenEvents(){const t=Qt.start("FirstCreate "+this.innerName);this.once([[Nn.START,()=>Qt.end(t)],[zn.START,this.updateLazyBounds,this],[Un.START,this.__onCreated,this],[Un.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Fn.DATA,this.__onWatchData,this],[zn.END,this.__onLayoutEnd,this],[Un.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){wl.list.remove(this);try{this.stop(),this.emitLeafer(Nn.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{Hr.clearRecycled()},100)}catch(t){vl.error(t)}}};t?e():setTimeout(e)}},t.Leafer.list=new nh,ae([Lo(Kh)],t.Leafer.prototype,"__",void 0),ae([lo()],t.Leafer.prototype,"pixelRatio",void 0),ae([io("normal")],t.Leafer.prototype,"mode",void 0),t.Leafer=wl=ae([zo()],t.Leafer),t.Rect=class extends t.UI{get __tag(){return"Rect"}},ae([Lo(sl)],t.Rect.prototype,"__",void 0),t.Rect=ae([Fo(ml),Mo(),zo()],t.Rect);const{add:bl,includes:Bl,scroll:kl}=Mt,Sl=t.Rect.prototype,Rl=t.Group.prototype;t.Box=class extends t.Group{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const s=this.__,i=this.__layout,{renderBounds:r,boxBounds:o}=i,{overflow:n}=s,a=i.childrenRenderBounds||(i.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(a),(e=n.includes("scroll"))&&(bl(a,o),kl(a,s)),this.__updateRectRenderBounds(),t=!Bl(o,a),t&&"show"===n&&bl(r,a)}else this.__updateRectRenderBounds();p.stintSet(this,"isOverflow",t),this.__checkScroll(e)}__updateRectRenderBounds(){}__checkScroll(t){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e)),this.hasScroller&&this.scroller.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}},ae([Lo(Zh)],t.Box.prototype,"__",void 0),ae([lo(100)],t.Box.prototype,"width",void 0),ae([lo(100)],t.Box.prototype,"height",void 0),ae([io(!1)],t.Box.prototype,"resizeChildren",void 0),ae([mo("show")],t.Box.prototype,"overflow",void 0),ae([Wo(Sl.__updateStrokeSpread)],t.Box.prototype,"__updateStrokeSpread",null),ae([Wo(Sl.__updateRenderSpread)],t.Box.prototype,"__updateRectRenderSpread",null),ae([Wo(Sl.__updateBoxBounds)],t.Box.prototype,"__updateRectBoxBounds",null),ae([Wo(Sl.__updateStrokeBounds)],t.Box.prototype,"__updateStrokeBounds",null),ae([Wo(Sl.__updateRenderBounds)],t.Box.prototype,"__updateRectRenderBounds",null),ae([Wo(Sl.__updateChange)],t.Box.prototype,"__updateRectChange",null),ae([Wo(Sl.__render)],t.Box.prototype,"__renderRect",null),ae([Wo(Rl.__render)],t.Box.prototype,"__renderGroup",null),t.Box=ae([Mo(),zo()],t.Box),t.Frame=class extends t.Box{get __tag(){return"Frame"}get isFrame(){return!0}},ae([Lo(tl)],t.Frame.prototype,"__",void 0),ae([xo("#FFFFFF")],t.Frame.prototype,"fill",void 0),ae([mo("hide")],t.Frame.prototype,"overflow",void 0),t.Frame=ae([zo()],t.Frame);const{moveTo:Cl,closePath:Tl,ellipse:Pl}=pi;t.Ellipse=class extends t.UI{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:s,innerRadius:i,startAngle:r,endAngle:o}=this.__,n=t/2,a=s/2,h=this.__.path=[];i?(r||o?(i<1&&Pl(h,n,a,n*i,a*i,0,r,o,!1),Pl(h,n,a,n,a,0,o,r,!0),i<1&&Tl(h)):(i<1&&(Pl(h,n,a,n*i,a*i),Cl(h,t,a)),Pl(h,n,a,n,a,0,360,0,!0)),e.ellipseToCurve&&(this.__.path=this.getPath(!0))):r||o?(Cl(h,n,a),Pl(h,n,a,n,a,0,r,o,!1),Tl(h)):Pl(h,n,a,n,a)}},ae([Lo(il)],t.Ellipse.prototype,"__",void 0),ae([po(0)],t.Ellipse.prototype,"innerRadius",void 0),ae([po(0)],t.Ellipse.prototype,"startAngle",void 0),ae([po(0)],t.Ellipse.prototype,"endAngle",void 0),t.Ellipse=ae([zo()],t.Ellipse);const{sin:Ll,cos:El,PI:Il}=Math,{moveTo:Ol,lineTo:Al,closePath:Wl,drawPoints:Ml}=pi;t.Polygon=class extends t.UI{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)Ml(e,t.points,t.curve,!0);else{const{width:s,height:i,sides:r}=t,o=s/2,n=i/2;Ol(e,o,0);for(let t=1;t<r;t++)Al(e,o+o*Ll(2*t*Il/r),n-n*El(2*t*Il/r));Wl(e)}}},ae([Lo(rl)],t.Polygon.prototype,"__",void 0),ae([po(3)],t.Polygon.prototype,"sides",void 0),ae([po()],t.Polygon.prototype,"points",void 0),ae([po(0)],t.Polygon.prototype,"curve",void 0),t.Polygon=ae([Mo(),zo()],t.Polygon);const{sin:Dl,cos:Fl,PI:zl}=Math,{moveTo:Ul,lineTo:Nl,closePath:Yl}=pi;t.Star=class extends t.UI{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:s,innerRadius:i}=this.__,r=t/2,o=e/2,n=this.__.path=[];Ul(n,r,0);for(let t=1;t<2*s;t++)Nl(n,r+(t%2==0?r:r*i)*Dl(t*zl/s),o-(t%2==0?o:o*i)*Fl(t*zl/s));Yl(n)}},ae([Lo(ol)],t.Star.prototype,"__",void 0),ae([po(5)],t.Star.prototype,"corners",void 0),ae([po(.382)],t.Star.prototype,"innerRadius",void 0),t.Star=ae([zo()],t.Star);const{moveTo:Xl,lineTo:Hl,drawPoints:Gl}=pi,{rotate:Vl,getAngle:jl,getDistance:ql,defaultPoint:Ql}=st;t.Line=class extends t.UI{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,s={x:0,y:0};return t&&(s.x=t),e&&Vl(s,e),s}set toPoint(t){this.width=ql(Ql,t),this.rotation=jl(Ql,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?Gl(e,t.points,t.curve,t.closed):(Xl(e,0,0),Hl(e,this.width,0))}},ae([Lo(el)],t.Line.prototype,"__",void 0),ae([fo("center")],t.Line.prototype,"strokeAlign",void 0),ae([lo(0)],t.Line.prototype,"height",void 0),ae([po()],t.Line.prototype,"points",void 0),ae([po(0)],t.Line.prototype,"curve",void 0),ae([po(!1)],t.Line.prototype,"closed",void 0),t.Line=ae([zo()],t.Line),t.Image=class extends t.Rect{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return c(t)&&t[0].image}},ae([Lo(dl)],t.Image.prototype,"__",void 0),ae([lo("")],t.Image.prototype,"url",void 0),t.Image=ae([zo()],t.Image);const Jl=t.Image;t.Canvas=class extends t.Rect{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=Kt.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new Jr({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new Ln(Ln.LOADED,{image:t}))})}draw(t,e,s,i){const r=new lt(t.worldTransform).invert(),o=new lt;e&&o.translate(e.x,e.y),s&&(l(s)?o.scale(s):o.scale(s.x,s.y)),i&&o.rotate(i),r.multiplyParent(o),t.__render(this.canvas,{matrix:r.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:s,height:i}=this.__,{view:r}=this.canvas;t.drawImage(r,0,0,r.width,r.height,0,0,s,i)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:s}=this.__;t.resize(this.__,s),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}},ae([Lo(cl)],t.Canvas.prototype,"__",void 0),ae([Ph(100)],t.Canvas.prototype,"width",void 0),ae([Ph(100)],t.Canvas.prototype,"height",void 0),ae([Ph(1)],t.Canvas.prototype,"pixelRatio",void 0),ae([Ph(!0)],t.Canvas.prototype,"smooth",void 0),ae([io(!1)],t.Canvas.prototype,"safeResize",void 0),ae([Ph()],t.Canvas.prototype,"contextSettings",void 0),t.Canvas=ae([zo()],t.Canvas);const{copyAndSpread:$l,includes:Zl,spread:Kl,setList:td}=Mt;function ed(t,e){const s=t.__,{rows:i,decorationY:r}=s.__textDrawData;let o;s.__isPlacehold&&s.placeholderColor&&(e.fillStyle=s.placeholderColor);for(let t=0,s=i.length;t<s;t++)o=i[t],o.text?e.fillText(o.text,o.x,o.y):o.data&&o.data.forEach(t=>{e.fillText(t.char,t.x,o.y)});if(r){const{decorationColor:t,decorationHeight:o}=s.__textDrawData;t&&(e.fillStyle=t),i.forEach(t=>r.forEach(s=>e.fillRect(t.x,t.y+s,t.width,o)))}}function sd(t,e){t.__.__font?ed(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function id(t,e,s){switch(e.__.strokeAlign){case"center":rd(t,1,e,s);break;case"inside":od(t,"inside",e,s);break;case"outside":e.__.__fillAfterStroke?rd(t,2,e,s):od(t,"outside",e,s)}}function rd(t,e,s,i){const r=s.__;u(t)?ad(t,e,!0,s,i):(i.setStroke(t,r.__strokeWidth*e,r),nd(s,i))}function od(t,e,s,i){const r=i.getSameCanvas(!0,!0);r.font=s.__.__font,rd(t,2,s,r),r.blendMode="outside"===e?"destination-out":"destination-in",ed(s,r),r.blendMode="normal",$o.copyCanvasByWorld(s,i,r),r.recycle(s.__nowWorld)}function nd(t,e){let s,i=t.__.__textDrawData;const{rows:r,decorationY:o}=i;for(let t=0,i=r.length;t<i;t++)s=r[t],s.text?e.strokeText(s.text,s.x,s.y):s.data&&s.data.forEach(t=>{e.strokeText(t.char,t.x,s.y)});if(o){const{decorationHeight:t}=i;r.forEach(s=>o.forEach(i=>e.strokeRect(s.x,s.y+i,s.width,t)))}}function ad(t,e,s,i,r){let o;const n=i.__,{__hasMultiStrokeStyle:a}=n;a||r.setStroke(void 0,n.__strokeWidth*e,n);for(let h=0,l=t.length;h<l;h++)if(o=t[h],(!o.image||!Mh.checkImage(i,r,o,!1))&&o.style){if(a){const{strokeStyle:t}=o;t?r.setStroke(o.style,n.__getRealStrokeWidth(t)*e,n,t):r.setStroke(o.style,n.__strokeWidth*e,n)}else r.strokeStyle=o.style;o.blendMode?(r.saveBlendMode(o.blendMode),s?nd(i,r):r.stroke(),r.restoreBlendMode()):s?nd(i,r):r.stroke()}}function hd(t,e,s){const i=e.__;if(i.__strokeWidth)if(i.__font)id(t,e,s);else switch(i.strokeAlign){case"center":ld(t,1,e,s);break;case"inside":!function(t,e,s){s.save(),s.clipUI(e),ld(t,2,e,s),s.restore()}(t,e,s);break;case"outside":!function(t,e,s){const i=e.__;if(i.__fillAfterStroke)ld(t,2,e,s);else{const{renderBounds:r}=e.__layout,o=s.getSameCanvas(!0,!0);e.__drawRenderPath(o),ld(t,2,e,o),o.clipUI(i),o.clearWorld(r),$o.copyCanvasByWorld(e,s,o),o.recycle(e.__nowWorld)}}(t,e,s)}}function ld(t,e,s,i){const r=s.__;u(t)?ad(t,e,!1,s,i):(i.setStroke(t,r.__strokeWidth*e,r),i.stroke()),r.__useArrow&&Wh.strokeArrow(t,s,i)}t.Text=class extends t.UI{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:s,fontFamily:i,fontSize:r,fontWeight:o,italic:n,textCase:a,textOverflow:h,padding:l}=t;t.__lineHeight=Oh.number(e,r),t.__letterSpacing=Oh.number(s,r),t.__padding=l?L.fourNumber(l):void 0,t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*r)/2,t.__font=`${n?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==o?o+" ":""}${r||12}px ${i||"caption"}`,t.__clipText="show"!==h&&!t.__autoSize,t.__textDrawData=Eh.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:s,italic:i,padding:r,__autoWidth:o,__autoHeight:n}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<s&&Kl(a,s/2),o||n){if(h.x=o?a.x:0,h.y=n?a.y:0,h.width=o?a.width:t.width,h.height=n?a.height:t.height,r){const[e,s,i,r]=t.__padding;o&&(h.x-=r,h.width+=s+r),n&&(h.y-=e,h.height+=i+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();i&&(h.width+=.16*s),p.stintSet(this,"isOverflow",!Zl(h,a)),this.isOverflow?(td(t.__textBoxBounds={},[h,a]),e.renderChanged=!0):t.__textBoxBounds=h}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;$l(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__updateChange(){super.__updateChange();const t=this.__box;t&&(t.__onUpdateSize(),t.__updateChange())}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,s){const i=this.__box;i&&(i.__nowWorld=this.__nowWorld,i.__draw(t,e,s)),this.textEditing&&!e.exporting||super.__draw(t,e,s)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}},ae([Lo(ll)],t.Text.prototype,"__",void 0),ae([lo(0)],t.Text.prototype,"width",void 0),ae([lo(0)],t.Text.prototype,"height",void 0),ae([xo()],t.Text.prototype,"boxStyle",void 0),ae([io(!1)],t.Text.prototype,"resizeFontSize",void 0),ae([xo("#000000")],t.Text.prototype,"fill",void 0),ae([fo("outside")],t.Text.prototype,"strokeAlign",void 0),ae([To("all")],t.Text.prototype,"hitFill",void 0),ae([lo("")],t.Text.prototype,"text",void 0),ae([lo("")],t.Text.prototype,"placeholder",void 0),ae([lo("caption")],t.Text.prototype,"fontFamily",void 0),ae([lo(12)],t.Text.prototype,"fontSize",void 0),ae([lo("normal")],t.Text.prototype,"fontWeight",void 0),ae([lo(!1)],t.Text.prototype,"italic",void 0),ae([lo("none")],t.Text.prototype,"textCase",void 0),ae([lo("none")],t.Text.prototype,"textDecoration",void 0),ae([lo(0)],t.Text.prototype,"letterSpacing",void 0),ae([lo({type:"percent",value:1.5})],t.Text.prototype,"lineHeight",void 0),ae([lo(0)],t.Text.prototype,"paraIndent",void 0),ae([lo(0)],t.Text.prototype,"paraSpacing",void 0),ae([lo("x")],t.Text.prototype,"writingMode",void 0),ae([lo("left")],t.Text.prototype,"textAlign",void 0),ae([lo("top")],t.Text.prototype,"verticalAlign",void 0),ae([lo(!0)],t.Text.prototype,"autoSizeAlign",void 0),ae([lo("normal")],t.Text.prototype,"textWrap",void 0),ae([lo("show")],t.Text.prototype,"textOverflow",void 0),ae([xo(!1)],t.Text.prototype,"textEditing",void 0),t.Text=ae([zo()],t.Text),t.Path=class extends t.UI{get __tag(){return"Path"}},ae([Lo(nl)],t.Path.prototype,"__",void 0),ae([fo("center")],t.Path.prototype,"strokeAlign",void 0),t.Path=ae([zo()],t.Path),t.Pen=class extends t.Group{get __tag(){return"Pen"}setStyle(e){const s=this.pathElement=new t.Path(e);return this.pathStyle=e,this.__path=s.path||(s.path=[]),this.add(s),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,s,i,r,o){return this}quadraticCurveTo(t,e,s,i){return this}closePath(){return this}rect(t,e,s,i){return this}roundRect(t,e,s,i,r){return this}ellipse(t,e,s,i,r,o,n,a){return this}arc(t,e,s,i,r,o){return this}arcTo(t,e,s,i,r){return this}drawEllipse(t,e,s,i,r,o,n,a){return this}drawArc(t,e,s,i,r,o){return this}drawPoints(t,e,s){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}},ae([Lo(al)],t.Pen.prototype,"__",void 0),ae([(t,e)=>{$r(t,e,{get(){return this.__path}})}],t.Pen.prototype,"path",void 0),t.Pen=ae([Fo(Ei,["set","path","paint"]),zo()],t.Pen);const{getSpread:dd,copyAndSpread:cd,toOuterOf:ud,getOuterOf:_d,getByMove:pd,move:fd,getIntersectData:gd}=Mt,yd={};let md;const{stintSet:xd}=p,{hasTransparent:wd}=Ih;function vd(t,e,s){if(!u(e)||!1===e.visible||0===e.opacity)return;let i;const{boxBounds:r}=s.__layout;switch(e.type){case"image":i=Mh.image(s,t,e,r,!md||!md[e.url]);break;case"linear":i=Dh.linearGradient(e,r);break;case"radial":i=Dh.radialGradient(e,r);break;case"angular":i=Dh.conicGradient(e,r);break;case"solid":const{type:n,color:a,opacity:h}=e;i={type:n,style:Ih.string(a,h)};break;default:o(e.r)||(i={type:"solid",style:Ih.string(e)})}if(i){if(a(i.style)&&wd(i.style)&&(i.isTransparent=!0),e.style){if(0===e.style.strokeWidth)return;i.strokeStyle=e.style}e.editing&&(i.editing=e.editing),e.blendMode&&(i.blendMode=e.blendMode)}return i}const bd={compute:function(t,e){const s=e.__,i=[];let r,o,n,a=s.__input[t];c(a)||(a=[a]),md=Mh.recycleImage(t,s);for(let s,r=0,o=a.length;r<o;r++)(s=vd(t,a[r],e))&&(i.push(s),s.strokeStyle&&(n||(n=1),s.strokeStyle.strokeWidth&&(n=Math.max(n,s.strokeStyle.strokeWidth))));s["_"+t]=i.length?i:void 0,i.length&&i.every(t=>t.isTransparent)&&(i.some(t=>t.image)&&(r=!0),o=!0),"fill"===t?(xd(s,"__isAlphaPixelFill",r),xd(s,"__isTransparentFill",o)):(xd(s,"__isAlphaPixelStroke",r),xd(s,"__isTransparentStroke",o),xd(s,"__hasMultiStrokeStyle",n))},fill:function(t,e,s){s.fillStyle=t,sd(e,s)},fills:function(t,e,s){let i;for(let r=0,o=t.length;r<o;r++){if(i=t[r],i.image){if(Mh.checkImage(e,s,i,!e.__.__font))continue;if(!i.style){!r&&i.image.isPlacehold&&e.drawImagePlaceholder(s,i.image);continue}}if(s.fillStyle=i.style,i.transform||i.scaleFixed){if(s.save(),i.transform&&s.transform(i.transform),i.scaleFixed){const{scaleX:t,scaleY:r}=e.getRenderScaleData(!0);(!0===i.scaleFixed||"zoom-in"===i.scaleFixed&&t>1&&r>1)&&s.scale(1/t,1/r)}i.blendMode&&(s.blendMode=i.blendMode),sd(e,s),s.restore()}else i.blendMode?(s.saveBlendMode(i.blendMode),sd(e,s),s.restoreBlendMode()):sd(e,s)}},fillPathOrText:sd,fillText:ed,stroke:hd,strokes:function(t,e,s){hd(t,e,s)},strokeText:id,drawTextStroke:nd,shape:function(t,s,i){const r=s.getSameCanvas(),o=s.bounds,n=t.__nowWorld,a=t.__layout,h=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let l,d,c,u,_,p;ud(a.strokeSpread?(cd(yd,a.boxBounds,a.strokeSpread),yd):a.boxBounds,n,h);let{scaleX:f,scaleY:g}=t.getRenderScaleData(!0);if(o.includes(h))p=r,l=_=h,d=n;else{let r;if(e.fullImageShadow)r=h;else{const t=a.renderShapeSpread?dd(o,b.swapAndScale(a.renderShapeSpread,f,g)):o;r=gd(t,h)}u=o.getFitMatrix(r);let{a:y,d:m}=u;u.a<1&&(p=s.getSameCanvas(),t.__renderShape(p,i),f*=y,g*=m),_=_d(h,u),l=pd(_,-u.e,-u.f),d=_d(n,u),fd(d,-u.e,-u.f);const x=i.matrix;x?(c=new lt(u),c.multiply(x),y*=x.scaleX,m*=x.scaleY):c=u,c.withScale(y,m),i=Object.assign(Object.assign({},i),{matrix:c})}return t.__renderShape(r,i),{canvas:r,matrix:c,fitMatrix:u,bounds:l,renderBounds:d,worldCanvas:p,shapeBounds:_,scaleX:f,scaleY:g}}};let Bd={},kd={a:1,b:0,c:0,d:1,e:0,f:0};const{get:Sd,set:Rd,rotateOfOuter:Cd,translate:Td,scaleOfOuter:Pd,multiplyParent:Ld,scale:Ed,rotate:Id,skew:Od}=G;function Ad(t,e,s,i){const r=Sd();Td(r,e.x,e.y),s&&Ed(r,s,i),t.transform=r}function Wd(t,e,s,i,r,o,n){const a=Sd();Td(a,e.x+s,e.y+i),Ed(a,r,o),n&&Cd(a,{x:e.x+e.width/2,y:e.y+e.height/2},n),t.transform=a}function Md(t,e,s,i,r,o,n,a,h,l){const d=Sd();Fd(d,e,s,i,r,o,n,a),h&&(n||a?(Rd(kd),Pd(kd,e,h,l),Ld(d,kd)):Pd(d,e,h,l)),t.transform=d}function Dd(t,e,s,i,r,o,n,a,h,l,d,c){const u=Sd();if(c)Fd(u,e,r,o,n,a,h,l);else{if(h)if("center"===d)Cd(u,{x:s/2,y:i/2},h);else switch(Id(u,h),h){case 90:Td(u,i,0);break;case 180:Td(u,s,i);break;case 270:Td(u,0,s)}Bd.x=e.x+r,Bd.y=e.y+o,Td(u,Bd.x,Bd.y),n&&Pd(u,Bd,n,a)}t.transform=u}function Fd(t,e,s,i,r,o,n,a){n&&Id(t,n),a&&Od(t,a.x,a.y),r&&Ed(t,r,o),Td(t,e.x+s,e.y+i)}const{get:zd,translate:Ud}=G,Nd=new Ut,Yd={},Xd={};function Hd(t,e,s,i){const{changeful:r,sync:o,scaleFixed:n}=s;r&&(t.changeful=r),o&&(t.sync=o),n&&(t.scaleFixed=n),t.data=Gd(s,i,e)}function Gd(t,e,s){t.padding&&(e=Nd.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");let{width:i,height:r}=s;const{opacity:o,mode:n,align:h,offset:l,scale:d,size:c,rotation:_,skew:p,clipSize:f,repeat:g,gap:y,filters:m}=t,x=e.width===i&&e.height===r,w={mode:n},v="center"!==h&&(_||0)%180==90;let b,B;switch(Mt.set(Xd,0,0,v?r:i,v?i:r),n&&"cover"!==n&&"fit"!==n?((d||c)&&(L.getScaleData(d,c,s,Yd),b=Yd.scaleX,B=Yd.scaleY),(h||y||g)&&(b&&Mt.scale(Xd,b,B,!0),h&&xt.toPoint(h,Xd,e,Xd,!0,!0))):x&&!_||(b=B=Mt.getFitScale(e,Xd,"fit"!==n),Mt.put(e,s,h,b,!1,Xd),Mt.scale(Xd,b,B,!0)),l&&st.move(Xd,l),n){case"stretch":x||(b=e.width/i,B=e.height/r,Ad(w,e,b,B));break;case"normal":case"clip":if(Xd.x||Xd.y||b||f||_||p){let t,s;f&&(t=e.width/f.width,s=e.height/f.height),Md(w,e,Xd.x,Xd.y,b,B,_,p,t,s),t&&(b=b?b*t:t,B=B?B*s:s)}break;case"repeat":(!x||b||_||p)&&Dd(w,e,i,r,Xd.x,Xd.y,b,B,_,p,h,t.freeTransform),g||(w.repeat="repeat");const s=u(g);(y||s)&&(w.gap=function(t,e,s,i,r){let o,n;u(t)?(o=t.x,n=t.y):o=n=t;return{x:Vd(o,s,r.width,e&&e.x),y:Vd(n,i,r.height,e&&e.y)}}(y,s&&g,Xd.width,Xd.height,e));break;default:b&&Wd(w,e,Xd.x,Xd.y,b,B,_)}return w.transform||(e.x||e.y)&&Ud(w.transform=zd(),e.x,e.y),w.width=i,w.height=r,b&&(w.scaleX=b,w.scaleY=B),o&&(w.opacity=o),m&&(w.filters=m),g&&(w.repeat=a(g)?"x"===g?"repeat-x":"repeat-y":"repeat"),w}function Vd(t,e,s,i){const r=a(t)||i?(i?s-i*e:s%e)/((i||Math.floor(s/e))-1):t;return"auto"===t&&r<0?0:r}let jd,qd=new Ut;const{isSame:Qd}=Mt;function Jd(t,e,s,i,r,o){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=i.width/e.pixelRatio,e.__naturalHeight=i.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return r.data||Hd(r,i,s,o),!0}function $d(t,e){tc(t,Ln.LOAD,e)}function Zd(t,e){tc(t,Ln.LOADED,e)}function Kd(t,e,s){e.error=s,t.forceUpdate("surface"),tc(t,Ln.ERROR,e)}function tc(t,e,s){t.hasEvent(e)&&t.emitEvent(new Ln(e,s))}function ec(t,e){const{leafer:s}=t;s&&s.viewReady&&(s.renderer.ignore=e)}const{get:sc,scale:ic,copy:rc}=G,{floor:oc,ceil:nc,max:ac,abs:hc}=Math;function lc(t,s,i){let{scaleX:r,scaleY:o}=t.getRenderScaleData(!0,s.scaleFixed);const n=r+"-"+o+"-"+i;if(s.patternId===n||t.destroyed)return!1;{const{image:a,data:h}=s;let l,d,{width:c,height:u,scaleX:_,scaleY:p,transform:f,repeat:g,gap:y}=h;r*=i,o*=i,_&&(_=hc(_),p=hc(p),d=sc(),rc(d,f),ic(d,1/_,1/p),r*=_,o*=p),c*=r,u*=o;const m=c*u;if(!g&&m>e.image.maxCacheSize)return!1;let x=e.image.maxPatternSize;if(a.isSVG){const t=c/a.width;t>1&&(l=t/nc(t))}else{const t=a.width*a.height;x>t&&(x=t)}m>x&&(l=Math.sqrt(m/x)),l&&(r/=l,o/=l,c/=l,u/=l),_&&(r/=_,o/=p);const w=y&&y.x*r,v=y&&y.y*o;if(f||1!==r||1!==o){const t=c+(w||0),e=u+(v||0);r/=t/ac(oc(t),1),o/=e/ac(oc(e),1),d||(d=sc(),f&&rc(d,f)),ic(d,1/r,1/o)}const b=a.getCanvas(c,u,h.opacity,h.filters,w,v,t.leafer&&t.leafer.config.smooth),B=a.getPattern(b,g||e.origin.noRepeat||"no-repeat",d,s);return s.style=B,s.patternId=n,!0}}const dc={image:function(t,e,s,i,r){let o,n;const a=Hr.get(s);return jd&&s===jd.paint&&Qd(i,jd.boxBounds)?o=jd.leafPaint:(o={type:s.type,image:a},a.hasAlphaPixel&&(o.isTransparent=!0),jd=a.use>1?{leafPaint:o,paint:s,boxBounds:qd.set(i)}:null),(r||a.loading)&&(n={image:a,attrName:e,attrValue:s}),a.ready?(Jd(t,e,s,a,o,i),r&&($d(t,n),Zd(t,n))):a.error?r&&Kd(t,n,a.error):(r&&(ec(t,!0),$d(t,n)),o.loadId=a.load(()=>{ec(t,!1),t.destroyed||(Jd(t,e,s,a,o,i)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Zd(t,n)),o.loadId=void 0},e=>{ec(t,!1),Kd(t,n,e),o.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),o},checkImage:function(t,s,i,r){const{scaleX:o,scaleY:n}=t.getRenderScaleData(!0,i.scaleFixed),{pixelRatio:a}=s,{data:h}=i;if(!h||i.patternId===o+"-"+n+"-"+a&&!Uh.running)return!1;if(r)if(h.repeat)r=!1;else if(!(i.changeful||"miniapp"===e.name&&Dn.isResizing(t)||Uh.running)){let{width:t,height:s}=h;t*=o*a,s*=n*a,h.scaleX&&(t*=h.scaleX,s*=h.scaleY),r=t*s>e.image.maxCacheSize}return r?(t.__.__isFastShadow&&(s.fillStyle=i.style||"#000",s.fill()),function(t,e,s,i){e.save(),e.clipUI(t),s.blendMode&&(e.blendMode=s.blendMode);i.opacity&&(e.opacity*=i.opacity);i.transform&&e.transform(i.transform);e.drawImage(s.image.getFull(i.filters),0,0,i.width,i.height),e.restore()}(t,s,i,h),!0):(!i.style||i.sync||Uh.running?lc(t,i,a):i.patternTask||(i.patternTask=Hr.patternTasker.add(()=>he(this,void 0,void 0,function*(){i.patternTask=null,s.bounds.hit(t.__nowWorld)&&lc(t,i,a),t.forceUpdate("surface")}),300)),!1)},createPattern:lc,recycleImage:function(t,e){const s=e["_"+t];if(c(s)){let i,r,o,n,a;for(let h=0,l=s.length;h<l;h++)i=s[h],r=i.image,a=r&&r.url,a&&(o||(o={}),o[a]=!0,Hr.recycle(r),r.loading&&(n||(n=e.__input&&e.__input[t]||[],c(n)||(n=[n])),r.unload(s[h].loadId,!n.some(t=>t.url===a))));return o}return null},createData:Hd,getPatternData:Gd,stretchMode:Ad,fillOrFitMode:Wd,clipMode:Md,repeatMode:Dd},{toPoint:cc}=gt,{hasTransparent:uc}=Ih,_c={},pc={};function fc(t,e,s,i){if(s){let r,o,n,h;for(let t=0,l=s.length;t<l;t++)r=s[t],a(r)?(n=t/(l-1),o=Ih.string(r,i)):(n=r.offset,o=Ih.string(r.color,i)),e.addColorStop(n,o),!h&&uc(o)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:gc,getDistance:yc}=st,{get:mc,rotateOfOuter:xc,scaleOfOuter:wc}=G,{toPoint:vc}=gt,bc={},Bc={};function kc(t,e,s,i,r){let o;const{width:n,height:a}=t;if(n!==a||i){const t=gc(e,s);o=mc(),r?(wc(o,e,n/a*(i||1),1),xc(o,e,t+90)):(wc(o,e,1,n/a*(i||1)),xc(o,e,t))}return o}const{getDistance:Sc}=st,{toPoint:Rc}=gt,Cc={},Tc={};const Pc={linearGradient:function(t,s){let{from:i,to:r,type:o,opacity:n}=t;cc(i||"top",s,_c),cc(r||"bottom",s,pc);const a=e.canvas.createLinearGradient(_c.x,_c.y,pc.x,pc.y),h={type:o,style:a};return fc(h,a,t.stops,n),h},radialGradient:function(t,s){let{from:i,to:r,type:o,opacity:n,stretch:a}=t;vc(i||"center",s,bc),vc(r||"bottom",s,Bc);const h=e.canvas.createRadialGradient(bc.x,bc.y,0,bc.x,bc.y,yc(bc,Bc)),l={type:o,style:h};fc(l,h,t.stops,n);const d=kc(s,bc,Bc,a,!0);return d&&(l.transform=d),l},conicGradient:function(t,s){let{from:i,to:r,type:o,opacity:n,stretch:a}=t;Rc(i||"center",s,Cc),Rc(r||"bottom",s,Tc);const h=e.conicGradientSupport?e.canvas.createConicGradient(0,Cc.x,Cc.y):e.canvas.createRadialGradient(Cc.x,Cc.y,0,Cc.x,Cc.y,Sc(Cc,Tc)),l={type:o,style:h};fc(l,h,t.stops,n);const d=kc(s,Cc,Tc,a||1,e.conicGradientRotate90);return d&&(l.transform=d),l},getTransform:kc},{copy:Lc,move:Ec,toOffsetOutBounds:Ic}=Mt,{max:Oc,abs:Ac}=Math,Wc={},Mc=new lt,Dc={};function Fc(t,e){let s,i,r,o,n=0,a=0,h=0,l=0;return e.forEach(t=>{s=t.x||0,i=t.y||0,o=1.5*(t.blur||0),r=Ac(t.spread||0),n=Oc(n,r+o-i),a=Oc(a,r+o+s),h=Oc(h,r+o+i),l=Oc(l,r+o-s)}),n===a&&a===h&&h===l?n:[n,a,h,l]}function zc(t,s,i){const{shapeBounds:r}=i;let o,n;e.fullImageShadow?(Lc(Wc,t.bounds),Ec(Wc,s.x-r.x,s.y-r.y),o=t.bounds,n=Wc):(o=r,n=s),t.copyWorld(i.canvas,o,n)}const{toOffsetOutBounds:Uc}=Mt,Nc={};const Yc=Fc;const Xc={shadow:function(t,e,s){let i,r;const{__nowWorld:o}=t,{shadow:n}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=s,_=e.getSameCanvas(),p=n.length-1;Ic(h,Dc,l),n.forEach((n,f)=>{let g=1;if(n.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(g=1/t)}_.setWorldShadow(Dc.offsetX+(n.x||0)*c*g,Dc.offsetY+(n.y||0)*u*g,(n.blur||0)*c*g,Ih.string(n.color)),r=Fh.getShadowTransform(t,_,s,n,Dc,g),r&&_.setTransform(r),zc(_,Dc,s),r&&_.resetTransform(),i=l,n.box&&(_.restore(),_.save(),a&&(_.copyWorld(_,l,o,"copy"),i=o),a?_.copyWorld(a,o,o,"destination-out"):_.copyWorld(s.canvas,d,h,"destination-out")),$o.copyCanvasByWorld(t,e,_,i,n.blendMode),p&&f<p&&_.clearWorld(i)}),_.recycle(i)},innerShadow:function(t,e,s){let i,r;const{__nowWorld:o}=t,{innerShadow:n}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=s,_=e.getSameCanvas(),p=n.length-1;Uc(h,Nc,l),n.forEach((n,f)=>{let g=1;if(n.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(g=1/t)}_.save(),_.setWorldShadow(Nc.offsetX+(n.x||0)*c*g,Nc.offsetY+(n.y||0)*u*g,(n.blur||0)*c*g),r=Fh.getShadowTransform(t,_,s,n,Nc,g,!0),r&&_.setTransform(r),zc(_,Nc,s),_.restore(),a?(_.copyWorld(_,l,o,"copy"),_.copyWorld(a,o,o,"source-out"),i=o):(_.copyWorld(s.canvas,d,h,"source-out"),i=l),_.fillWorld(i,Ih.string(n.color),"source-in"),$o.copyCanvasByWorld(t,e,_,i,n.blendMode),p&&f<p&&_.clearWorld(i)}),_.recycle(i)},blur:function(t,e,s){const{blur:i}=t.__;s.setWorldBlur(i*t.__nowWorld.a),s.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),s.filter="none"},backgroundBlur:function(t,e,s){},getShadowRenderSpread:Fc,getShadowTransform:function(t,e,s,i,r,o,n){if(i.spread){const s=1+2*i.spread/t.__layout.strokeBounds.width*o*(n?-1:1);return Mc.set().scaleOfOuter({x:(r.x+r.width/2)*e.pixelRatio,y:(r.y+r.height/2)*e.pixelRatio},s),Mc}},isTransformShadow(t){},getInnerShadowSpread:Yc},{excludeRenderBounds:Hc}=nn;let Gc;function Vc(t,e,s,i,r,o,n,a){switch(e){case"grayscale":Gc||(Gc=!0,r.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,s,i,r,o){const n=t.__nowWorld;s.resetTransform(),s.opacity=1,s.useMask(i,n),o&&i.recycle(n);qc(t,e,s,1,r,o)}(t,s,i,r,n,a);break;case"opacity-path":qc(t,s,i,o,n,a);break;case"path":a&&s.restore()}}function jc(t){return t.getSameCanvas(!1,!0)}function qc(t,e,s,i,r,o){const n=t.__nowWorld;e.resetTransform(),e.opacity=i,e.copyWorld(s,n,void 0,r),o?s.recycle(n):s.clearWorld(n)}t.Group.prototype.__renderMask=function(t,e){let s,i,r,o,n,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(s=h[l],a=s.__.mask,a){n&&(Vc(this,n,t,r,i,o,void 0,!0),i=r=null),"clipping"!==a&&"clipping-path"!==a||Hc(s,e)||s.__render(t,e),o=s.__.opacity,Gc=!1,"path"===a||"clipping-path"===a?(o<1?(n="opacity-path",r||(r=jc(t))):(n="path",t.save()),s.__clip(r||t,e)):(n="grayscale"===a?"grayscale":"alpha",i||(i=jc(t)),r||(r=jc(t)),s.__render(i,e));continue}const d=1===o&&s.__.__blendMode;d&&Vc(this,n,t,r,i,o,void 0,!1),Hc(s,e)||s.__render(r||t,e),d&&Vc(this,n,t,r,i,o,d,!1)}Vc(this,n,t,r,i,o,void 0,!0)};const Qc=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Jc=Qc+"_#~&*+\\=|≮≯≈≠=…",$c=new RegExp([[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[196608,201551],[201552,205743],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12736,12783],[12800,13055],[13056,13311],[63744,64255],[65072,65103],[127488,127743],[194560,195103]].map(([t,e])=>`[\\u${t.toString(16)}-\\u${e.toString(16)}]`).join("|"));function Zc(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const Kc=Zc("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),tu=Zc("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),eu=Zc(Qc),su=Zc(Jc),iu=Zc("- —/~|┆·");var ru;!function(t){t[t.Letter=0]="Letter",t[t.Single=1]="Single",t[t.Before=2]="Before",t[t.After=3]="After",t[t.Symbol=4]="Symbol",t[t.Break=5]="Break"}(ru||(ru={}));const{Letter:ou,Single:nu,Before:au,After:hu,Symbol:lu,Break:du}=ru;function cu(t){return Kc[t]?ou:iu[t]?du:tu[t]?au:eu[t]?hu:su[t]?lu:$c.test(t)?nu:ou}const uu={trimRight(t){const{words:e}=t;let s,i=0,r=e.length;for(let o=r-1;o>-1&&(s=e[o].data[0]," "===s.char);o--)i++,t.width-=s.width;i&&e.splice(r-i,i)}};function _u(t,e,s){switch(e){case"title":return s?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:pu}=uu,{Letter:fu,Single:gu,Before:yu,After:mu,Symbol:xu,Break:wu}=ru;let vu,bu,Bu,ku,Su,Ru,Cu,Tu,Pu,Lu,Eu,Iu,Ou,Au,Wu,Mu,Du,Fu=[];function zu(t,e){Pu&&!Tu&&(Tu=Pu),vu.data.push({char:t,width:e}),Bu+=e}function Uu(){ku+=Bu,vu.width=Bu,bu.words.push(vu),vu={data:[]},Bu=0}function Nu(){Au&&(Wu.paraNumber++,bu.paraStart=!0,Au=!1),Pu&&(bu.startCharSize=Tu,bu.endCharSize=Pu,Tu=0),bu.width=ku,Mu.width?pu(bu):Du&&Yu(),Fu.push(bu),bu={words:[]},ku=0}function Yu(){ku>(Wu.maxWidth||0)&&(Wu.maxWidth=ku)}const{top:Xu,right:Hu,bottom:Gu,left:Vu}=t.Direction4;function ju(t,e,s){const{bounds:i,rows:r}=t;i[e]+=s;for(let t=0;t<r.length;t++)r[t][e]+=s}const qu={getDrawData:function(t,s){a(t)||(t=String(t));let i=0,r=0,o=s.__getInput("width")||0,n=s.__getInput("height")||0;const{textDecoration:h,__font:l,__padding:d}=s;d&&(o?(i=d[Vu],o-=d[Hu]+d[Vu]):s.autoSizeAlign||(i=d[Vu]),n?(r=d[Xu],n-=d[Xu]+d[Gu]):s.autoSizeAlign||(r=d[Xu]));const c={bounds:{x:i,y:r,width:o,height:n},rows:[],paraNumber:0,font:e.canvas.font=l};return function(t,s,i){Wu=t,Fu=t.rows,Mu=t.bounds,Du=!Mu.width&&!i.autoSizeAlign;const{__letterSpacing:r,paraIndent:o,textCase:n}=i,{canvas:a}=e,{width:h,height:l}=Mu;if(h||l||r||"none"!==n){const t="none"!==i.textWrap,e="break"===i.textWrap;Au=!0,Eu=null,Tu=Cu=Pu=Bu=ku=0,vu={data:[]},bu={words:[]},r&&(s=[...s]);for(let i=0,l=s.length;i<l;i++)Ru=s[i],"\n"===Ru?(Bu&&Uu(),bu.paraEnd=!0,Nu(),Au=!0):(Lu=cu(Ru),Lu===fu&&"none"!==n&&(Ru=_u(Ru,n,!Bu)),Cu=a.measureText(Ru).width,r&&(r<0&&(Pu=Cu),Cu+=r),Iu=Lu===gu&&(Eu===gu||Eu===fu)||Eu===gu&&Lu!==mu,Ou=!(Lu!==yu&&Lu!==gu||Eu!==xu&&Eu!==mu),Su=Au&&o?h-o:h,t&&h&&ku+Bu+Cu>Su&&(e?(Bu&&Uu(),ku&&Nu()):(Ou||(Ou=Lu===fu&&Eu==mu),Iu||Ou||Lu===wu||Lu===yu||Lu===gu||Bu+Cu>Su?(Bu&&Uu(),ku&&Nu()):ku&&Nu()))," "===Ru&&!0!==Au&&ku+Bu===0||(Lu===wu?(" "===Ru&&Bu&&Uu(),zu(Ru,Cu),Uu()):Iu||Ou?(Bu&&Uu(),zu(Ru,Cu)):zu(Ru,Cu)),Eu=Lu);Bu&&Uu(),ku&&Nu(),Fu.length>0&&(Fu[Fu.length-1].paraEnd=!0)}else s.split("\n").forEach(t=>{Wu.paraNumber++,ku=a.measureText(t).width,Fu.push({x:o||0,text:t,width:ku,paraStart:!0}),Du&&Yu()})}(c,t,s),d&&function(t,e,s,i,r){if(!i&&s.autoSizeAlign)switch(s.textAlign){case"left":ju(e,"x",t[Vu]);break;case"right":ju(e,"x",-t[Hu])}if(!r&&s.autoSizeAlign)switch(s.verticalAlign){case"top":ju(e,"y",t[Xu]);break;case"bottom":ju(e,"y",-t[Gu])}}(d,c,s,o,n),function(t,e){const{rows:s,bounds:i}=t,r=s.length,{__lineHeight:o,__baseLine:n,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:_,y:p,width:f,height:g}=i,y=o*r+(c?c*(t.paraNumber-1):0),m=n;if(h&&y>g)y=Math.max(g,o),r>1&&(t.overflow=r);else if(g||u)switch(d){case"middle":p+=(g-y)/2;break;case"bottom":p+=g-y}m+=p;let x,w,v,b=f||u?f:t.maxWidth;for(let n=0,d=r;n<d;n++){if(x=s[n],x.x=_,x.width<f||x.width>f&&!h)switch(l){case"center":x.x+=(b-x.width)/2;break;case"right":x.x+=b-x.width}x.paraStart&&c&&n>0&&(m+=c),x.y=m,m+=o,t.overflow>n&&m>y&&(x.isOverflow=!0,t.overflow=n+1),w=x.x,v=x.width,a<0&&(x.width<0?(v=-x.width+e.fontSize+a,w-=v,v+=e.fontSize):v-=a),w<i.x&&(i.x=w),v>i.width&&(i.width=v),h&&f&&f<v&&(x.isOverflow=!0,t.overflow||(t.overflow=s.length))}i.y=p,i.height=y}(c,s),function(t,e,s){const{rows:i}=t,{textAlign:r,paraIndent:o,letterSpacing:n}=e;let a,h,l,d,c,u;i.forEach(t=>{t.words&&(l=o&&t.paraStart?o:0,u=t.words.length,h=s&&("justify"===r||"both"===r)&&u>1?(s-t.width-l)/(u-1):0,d=n||t.isOverflow?0:h>.01?1:2,t.isOverflow&&!n&&(t.textMode=!0),2===d?(t.x+=l,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=l,a=t.x,t.data=[],t.words.forEach((e,s)=>{1===d?(c={char:"",x:a},a=function(t,e,s){return t.forEach(t=>{s.char+=t.char,e+=t.width}),e}(e.data,a,c),(t.isOverflow||" "!==c.char)&&t.data.push(c)):a=function(t,e,s,i){return t.forEach(t=>{(i||" "!==t.char)&&(t.x=e,s.push(t)),e+=t.width}),e}(e.data,a,t.data,t.isOverflow),!h||t.paraEnd&&"both"!==r||s===u-1||(a+=h,t.width+=h)})),t.words=null)})}(c,s,o),c.overflow&&function(t,s,i,r){if(!r)return;const{rows:o,overflow:n}=t;let{textOverflow:a}=s;if(o.splice(n),a&&"show"!==a){let t,h;"hide"===a?a="":"ellipsis"===a&&(a="...");const l=a?e.canvas.measureText(a).width:0,d=i+r-l;("none"===s.textWrap?o:[o[n-1]]).forEach(e=>{if(e.isOverflow&&e.data){let s=e.data.length-1;for(let i=s;i>-1&&(t=e.data[i],h=t.x+t.width,!(i===s&&h<d));i--){if(h<d&&" "!==t.char||!i){e.data.splice(i+1),e.width-=t.width;break}e.width-=t.width}e.width+=l,e.data.push({char:a,x:h}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(c,s,i,o),"none"!==h&&function(t,e){let s,i=0;const{fontSize:r,textDecoration:o}=e;switch(t.decorationHeight=r/11,u(o)?(s=o.type,o.color&&(t.decorationColor=Ih.string(o.color)),o.offset&&(i=Math.min(.3*r,Math.max(o.offset,.15*-r)))):s=o,s){case"under":t.decorationY=[.15*r+i];break;case"delete":t.decorationY=[.35*-r];break;case"under-delete":t.decorationY=[.15*r+i,.35*-r]}}(c,s),c}};const Qu={string:function(t,e){if(!t)return"#000";const s=l(e)&&e<1;if(a(t)){if(!s||!Ih.object)return t;t=Ih.object(t)}let i=o(t.a)?1:t.a;s&&(i*=e);const r=t.r+","+t.g+","+t.b;return 1===i?"rgb("+r+")":"rgba("+r+","+i+")"}};return Object.assign(Eh,qu),Object.assign(Ih,Qu),Object.assign(Wh,bd),Object.assign(Mh,dc),Object.assign(Dh,Pc),Object.assign(Fh,Xc),uh(),t.AlignHelper=xt,t.AroundHelper=gt,t.AutoBounds=Yt,t.BezierHelper=Ze,t.Bounds=Ut,t.BoundsEvent=En,t.BoundsHelper=Mt,t.BoxData=Zh,t.BranchHelper=dn,t.BranchRender=Sa,t.CanvasData=cl,t.CanvasManager=ne,t.ChildEvent=Rn,t.ColorConvert=Ih,t.Creator=Kt,t.DataHelper=p,t.Debug=Gt,t.Effect=Fh,t.EllipseData=il,t.EllipseHelper=as,t.Event=Sn,t.EventCreator=re,t.Eventer=qn,t.Export=Uh,t.FileHelper=Mr,t.Filter=zh,t.FourNumberHelper=b,t.FrameData=tl,t.GroupData=$h,t.ImageData=dl,t.ImageEvent=Ln,t.ImageManager=Hr,t.IncrementId=s,t.LayoutEvent=zn,t.Layouter=Sh,t.LeafBounds=ba,t.LeafBoundsHelper=nn,t.LeafData=g,t.LeafDataProxy=aa,t.LeafEventer=oa,t.LeafHelper=$o,t.LeafLayout=kn,t.LeafLevelList=ah,t.LeafList=nh,t.LeafMatrix=pa,t.LeafRender=Ba,t.LeaferCanvas=lh,t.LeaferCanvasBase=be,t.LeaferData=Kh,t.LeaferEvent=Nn,t.LeaferImage=Jr,t.LineData=el,t.MathHelper=L,t.Matrix=lt,t.MatrixHelper=G,t.MyImage=Jl,t.NeedConvertToCanvasCommandMap=Ce,t.OneRadian=I,t.PI2=O,t.PI_2=A,t.Paint=Wh,t.PaintGradient=Dh,t.PaintImage=Mh,t.PathArrow=Ah,t.PathBounds=kr,t.PathCommandDataHelper=pi,t.PathCommandMap=Se,t.PathConvert=Gs,t.PathCorner=Er,t.PathCreator=Ei,t.PathData=nl,t.PathDrawer=Vi,t.PathHelper=Be,t.PathNumberCommandLengthMap=Ee,t.PathNumberCommandMap=Le,t.PenData=al,t.Platform=e,t.Plugin=Zt,t.Point=at,t.PointHelper=st,t.PolygonData=rl,t.PropertyEvent=Tn,t.RectData=sl,t.RectHelper=Ie,t.RectRender=ml,t.RenderEvent=Un,t.Renderer=Ch,t.ResizeEvent=Dn,t.Resource=Yr,t.Run=Qt,t.StarData=ol,t.State=Nh,t.StringNumberMap=Xt,t.TaskItem=zr,t.TaskProcessor=Ur,t.TextConvert=Eh,t.TextData=ll,t.Transition=Yh,t.TwoPointBoundsHelper=ct,t.UIBounds=pl,t.UICreator=ee,t.UIData=Qh,t.UIRender=gl,t.UnitConvert=Oh,t.WaitHelper=pn,t.WatchEvent=Fn,t.Watcher=ph,t.affectRenderBoundsType=mo,t.affectStrokeBoundsType=fo,t.attr=eo,t.autoLayoutType=no,t.boundsType=lo,t.canvasPatch=Wr,t.canvasSizeAttrs=ve,t.createAttr=function(t){return(e,s)=>{$r(e,s,Kr(s,t))}},t.createDescriptor=Kr,t.cursorType=Po,t.dataProcessor=Lo,t.dataType=io,t.decorateLeafAttr=to,t.defineDataProcessor=Eo,t.defineKey=$r,t.defineLeafAttr=so,t.dimType=wo,t.doBoundsType=uo,t.doStrokeType=go,t.effectType=Th,t.emptyData={},t.eraserType=Co,t.extraPropertyEventMap=Pn,t.getBoundsData=M,t.getDescriptor=Zr,t.getMatrixData=D,t.getPointData=W,t.hitType=To,t.isArray=c,t.isData=function(t){return u(t)&&!c(t)},t.isEmptyData=_,t.isFinite=h,t.isNull=n,t.isNumber=l,t.isObject=u,t.isString=a,t.isUndefined=o,t.layoutProcessor=function(t){return(e,s)=>{$r(e,"__LayoutProcessor",{get:()=>t})}},t.leaferTransformAttrMap=Vn,t.maskType=Ro,t.naturalBoundsType=co,t.opacityType=vo,t.path=Ir,t.pathInputType=_o,t.pathType=po,t.pen=Or,t.positionType=ro,t.registerUI=zo,t.registerUIEvent=function(){return t=>{re.register(t)}},t.resizeType=Ph,t.rewrite=Wo,t.rewriteAble=Mo,t.rotationType=ho,t.scaleType=ao,t.scrollType=oo,t.sortType=So,t.strokeType=yo,t.surfaceType=xo,t.tempBounds=Nt,t.tempMatrix=dt,t.tempPoint=ht,t.tryToNumber=function(t){return"string"==typeof t&&d.test(t)?+t:t},t.useCanvas=uh,t.useModule=Fo,t.version="1.9.10",t.visibleType=bo,t.zoomLayerType=Lh,t}({});function Leafer(t){return new LeaferUI.Leafer(t)}Object.setPrototypeOf(Leafer,LeaferUI),Leafer.prototype=LeaferUI.Leafer.prototype;
2
2
  //# sourceMappingURL=web.min.js.map