leafer-draw 1.9.1 → 1.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web.cjs +5 -5
- package/dist/web.esm.js +5 -5
- package/dist/web.esm.min.js +1 -1
- package/dist/web.esm.min.js.map +1 -1
- package/dist/web.js +214 -129
- package/dist/web.min.cjs +1 -1
- package/dist/web.min.cjs.map +1 -1
- package/dist/web.min.js +1 -1
- package/dist/web.min.js.map +1 -1
- package/dist/web.module.js +219 -131
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +3 -3
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 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 __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}}const{round:y,pow:m,PI:x}=Math,w={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(t,e){let s;if(c(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]),e)for(let t=0;t<4;t++)s[t]>e&&(s[t]=e);return s},formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),w.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:m(10,e);return-0===(t=y(t*s)/s)?0:t},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&&w.assignScale(i,t);return i},assignScale(t,e){l(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},randInt:v,randColor:t=>`rgba(${v(255)},${v(255)},${v(255)},${t||1})`};function v(t){return Math.round(Math.random()*t)}const b=x/180,B=2*x,k=x/2;function S(){return{x:0,y:0}}function R(){return{x:0,y:0,width:0,height:0}}function C(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:T,cos:P,acos:L,sqrt:I}=Math,{float:E}=w,A={};function O(){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 M={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:O(),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:C,getWorld:O,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},scaleOfOuter(t,e,s,i){W.toInnerPoint(t,e,A),W.scaleOfInner(t,A,s,i)},scaleOfInner(t,e,s,i=s){W.translateInner(t,e.x,e.y),W.scale(t,s,i),W.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:s,b:i,c:r,d:o}=t,n=P(e*=b),a=T(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){W.toInnerPoint(t,e,A),W.rotateOfInner(t,A,s)},rotateOfInner(t,e,s){W.translateInner(t,e.x,e.y),W.rotate(t,s),W.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:i,b:r,c:o,d:n}=t;s&&(s*=b,t.a=i+o*s,t.b=r+n*s),e&&(e*=b,t.c=o+i*e,t.d=n+r*e)},skewOfOuter(t,e,s,i){W.toInnerPoint(t,e,A),W.skewOfInner(t,A,s,i)},skewOfInner(t,e,s,i=0){W.translateInner(t,e.x,e.y),W.skew(t,s,i),W.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,n){let{e:a,f:h}=t;if(n&&(a+=n.scrollX,h+=n.scrollY),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=a*e.a+h*e.c+e.e,s.f=a*e.b+h*e.d+e.f},divide(t,e){W.multiply(t,W.tempInvert(e))},divideParent(t,e){W.multiplyParent(t,W.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=W;return W.copy(e,t),W.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*b,n=P(o),a=T(o);if(i||r){const e=i*b,s=r*b;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)&&W.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=I(r*r+o*o),c=t/d;const e=r/d;u=o>0?L(e):-L(e)}else{c=I(n*n+a*a),d=t/c;const e=n/c;u=k-(a>0?L(-e):-L(e))}const e=E(P(u)),s=T(u);d=E(d),c=E(c),_=e?E((n/c+s)/e/b,9):0,p=e?E((o/d-s)/e/b,9):0,u=E(u/b)}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=I(i*i+r*r)):(e=i,s=n)}return i.scaleX=e,i.scaleY=s,i},reset(t){W.set(t)}},W=M,{toInnerPoint:D,toOuterPoint:F}=M,{sin:z,cos:U,abs:N,sqrt:Y,atan2:X,min:H,round:G}=Math,V={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?G(t.x-.5)+.5:G(t.x),t.y=e?G(t.y-.5)+.5:G(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=j.defaultPoint);const i=U(e*=b),r=z(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}=j;return Q(s,t),D(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=j;return Q(s,t),F(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=j;return Q(s,t),j.toInnerRadiusPointOf(t,e,s),s},toInnerRadiusPointOf(t,e,s){s||(s=t),D(e,t,s),s.radiusX=Math.abs(t.radiusX/e.scaleX),s.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,s){D(e,t,s)},toOuterOf(t,e,s){F(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)=>q(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,s,i){const r=N(s-t),o=N(i-e);return Y(r*r+o*o)},getMinDistanceFrom:(t,e,s,i,r,o)=>H(q(t,e,s,i),q(s,i,r,o)),getAngle:(t,e)=>J(t,e)/b,getRotation:(t,e,s,i)=>(i||(i=e),j.getRadianFrom(t.x,t.y,e.x,e.y,s.x,s.y,i.x,i.y)/b),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)=>X(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s,i){const r=J(t,e);return(e=i?e:{}).x=t.x+U(r)*s,e.y=t.y+z(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){j.reset(t)}},j=V,{getDistanceFrom:q,copy:Q,getAtan2:J}=j;class ${constructor(t,e){this.set(t,e)}set(t,e){return u(t)?V.copy(this,t):V.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new $(this)}move(t,e){return V.move(this,t,e),this}scale(t,e){return V.scale(this,t,e),this}scaleOf(t,e,s){return V.scaleOf(this,t,e,s),this}rotate(t,e){return V.rotate(this,t,e),this}rotateOf(t,e){return V.rotate(this,e,t),this}getRotation(t,e,s){return V.getRotation(this,t,e,s)}toInnerOf(t,e){return V.toInnerOf(this,t,e),this}toOuterOf(t,e){return V.toOuterOf(this,t,e),this}getCenter(t){return new $(V.getCenter(this,t))}getDistance(t){return V.getDistance(this,t)}getDistancePoint(t,e,s){return new $(V.getDistancePoint(this,t,e,s))}getAngle(t){return V.getAngle(this,t)}getAtan2(t){return V.getAtan2(this,t)}reset(){return V.reset(this),this}}const Z=new $;class K{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)?M.copy(this,t):M.set(this,t,e,s,i,r,o),this}setWith(t){return M.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 K(this)}translate(t,e){return M.translate(this,t,e),this}translateInner(t,e){return M.translateInner(this,t,e),this}scale(t,e){return M.scale(this,t,e),this}scaleWith(t,e){return M.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}scaleOfOuter(t,e,s){return M.scaleOfOuter(this,t,e,s),this}scaleOfInner(t,e,s){return M.scaleOfInner(this,t,e,s),this}rotate(t){return M.rotate(this,t),this}rotateOfOuter(t,e){return M.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return M.rotateOfInner(this,t,e),this}skew(t,e){return M.skew(this,t,e),this}skewOfOuter(t,e,s){return M.skewOfOuter(this,t,e,s),this}skewOfInner(t,e,s){return M.skewOfInner(this,t,e,s),this}multiply(t){return M.multiply(this,t),this}multiplyParent(t){return M.multiplyParent(this,t),this}divide(t){return M.divide(this,t),this}divideParent(t){return M.divideParent(this,t),this}invert(){return M.invert(this),this}invertWith(){return M.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,s){M.toOuterPoint(this,t,e,s)}toInnerPoint(t,e,s){M.toInnerPoint(this,t,e,s)}setLayout(t,e,s){return M.setLayout(this,t,e,s),this}getLayout(t,e,s){return M.getLayout(this,t,e,s)}withScale(t,e){return M.withScale(this,t,e)}reset(){M.reset(this)}}const tt=new K,et={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){st(t,e,s),st(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:st}=et;var it,rt;t.Direction4=void 0,(it=t.Direction4||(t.Direction4={}))[it.top=0]="top",it[it.right=1]="right",it[it.bottom=2]="bottom",it[it.left=3]="left",t.Direction9=void 0,(rt=t.Direction9||(t.Direction9={}))[rt.topLeft=0]="topLeft",rt[rt.top=1]="top",rt[rt.topRight=2]="topRight",rt[rt.right=3]="right",rt[rt.bottomRight=4]="bottomRight",rt[rt.bottom=5]="bottom",rt[rt.bottomLeft=6]="bottomLeft",rt[rt.left=7]="left",rt[rt.center=8]="center",rt[rt["top-left"]=0]="top-left",rt[rt["top-right"]=2]="top-right",rt[rt["bottom-right"]=4]="bottom-right",rt[rt["bottom-left"]=6]="bottom-left";const ot=[{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}];ot.forEach(t=>t.type="percent");const nt={directionData:ot,tempPoint:{},get:at,toPoint(t,e,s,i,r,o){const n=at(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={}),nt.toPoint(t,e,s,!0),s)};function at(e){return a(e)?ot[t.Direction9[e]]:e}const{toPoint:ht}=nt,lt={toPoint(t,e,s,i,r,o){ht(t,s,i,r,e,o)}},{tempPointBounds:dt,setPoint:ct,addPoint:ut,toBounds:_t}=et,{toOuterPoint:pt}=M,{float:ft,fourNumber:gt}=w,{floor:yt,ceil:mt}=Math;let xt,wt,vt,bt;const Bt={},kt={},St={},Rt={tempBounds:St,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=gt(s);i?Ct.set(t,o+e[3],n+e[0],a-e[1]-e[3],h-e[2]-e[0]):Ct.set(t,o-e[3],n-e[0],a+e[1]+e[3],h+e[2]+e[0])}else i&&(s=-s),Ct.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},getByMove:(t,e,s)=>(t=Object.assign({},t),Ct.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?Pt(e,t):e=t,s?(e.offsetX=-(Ct.maxX(s)-t.x),e.offsetY=-(Ct.maxY(s)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),Ct.move(e,-e.offsetX,-e.offsetY)},scale(t,e,s=e,i){i||V.scale(t,e,s),t.width*=e,t.height*=s},scaleOf(t,e,s,i=s){V.scaleOf(t,e,s,i),t.width*=s,t.height*=i},tempToOuterOf:(t,e)=>(Ct.copy(St,t),Ct.toOuterOf(St,e),St),getOuterOf:(t,e)=>(t=Object.assign({},t),Ct.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 Bt.x=t.x,Bt.y=t.y,pt(e,Bt,kt),ct(dt,kt.x,kt.y),Bt.x=t.x+t.width,pt(e,Bt,kt),ut(dt,kt.x,kt.y),Bt.y=t.y+t.height,pt(e,Bt,kt),ut(dt,kt.x,kt.y),Bt.x=t.x,pt(e,Bt,kt),ut(dt,kt.x,kt.y),_t(dt,s)},toInnerOf(t,e,s){s||(s=t),Ct.move(s,-e.e,-e.f),Ct.scale(s,1/e.a,1/e.d)},getFitMatrix(t,e,s=1){const i=Math.min(s,Ct.getFitScale(t,e));return new K(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=Ct.getFitScale(t,e,"cover"===i)),St.width=r?e.width*=i:e.width*i,St.height=r?e.height*=i:e.height*i,lt.toPoint(s,St,t,o,!0,!0)},getSpread(t,e,s){const i={};return Ct.copyAndSpread(i,t,e,!1,s),i},spread(t,e,s){Ct.copyAndSpread(t,t,e,!1,s)},shrink(t,e,s){Ct.copyAndSpread(t,t,e,!0,s)},ceil(t){const{x:e,y:s}=t;t.x=yt(t.x),t.y=yt(t.y),t.width=e>t.x?mt(t.width+e-t.x):mt(t.width),t.height=s>t.y?mt(t.height+s-t.y):mt(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=ft(t.x,e),t.y=ft(t.y,e),t.width=ft(t.width,e),t.height=ft(t.height,e)},add(t,e,s){xt=t.x+t.width,wt=t.y+t.height,vt=e.x,bt=e.y,s||(vt+=e.width,bt+=e.height),xt=xt>vt?xt:vt,wt=wt>bt?wt:bt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=xt-t.x,t.height=wt-t.y},addList(t,e){Ct.setListWithFn(t,e,void 0,!0)},setList(t,e,s=!1){Ct.setListWithFn(t,e,void 0,s)},addListWithFn(t,e,s){Ct.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||Pt(t,r)):Tt(t,r));o&&Ct.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?ct(dt,t.x,t.y):ut(dt,t.x,t.y)),_t(dt,t)},setPoint(t,e){Ct.set(t,e.x,e.y)},addPoint(t,e){Tt(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=V.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=V.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=Ct.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=Ct.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=Ct.tempToOuterOf(e,s)),!Ct.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:i,y:r,width:o,height:n}=e;return xt=i+o,wt=r+n,vt=t.x+t.width,bt=t.y+t.height,i=i>t.x?i:t.x,r=r>t.y?r:t.y,xt=xt<vt?xt:vt,wt=wt<bt?wt:bt,o=xt-i,n=wt-r,{x:i,y:r,width:o,height:n}},intersect(t,e,s){Ct.copy(t,Ct.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){Ct.set(t)}},Ct=Rt,{add:Tt,copy:Pt}=Ct;class Lt{get minX(){return Rt.minX(this)}get minY(){return Rt.minY(this)}get maxX(){return Rt.maxX(this)}get maxY(){return Rt.maxY(this)}constructor(t,e,s,i){this.set(t,e,s,i)}set(t,e,s,i){return u(t)?Rt.copy(this,t):Rt.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 Lt(this)}move(t,e){return Rt.move(this,t,e),this}scale(t,e,s){return Rt.scale(this,t,e,s),this}scaleOf(t,e,s){return Rt.scaleOf(this,t,e,s),this}toOuterOf(t,e){return Rt.toOuterOf(this,t,e),this}toInnerOf(t,e){return Rt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Rt.getFitMatrix(this,t,e)}put(t,e,s){Rt.put(this,t,e,s)}spread(t,e){return Rt.spread(this,t,e),this}shrink(t,e){return Rt.shrink(this,t,e),this}ceil(){return Rt.ceil(this),this}unsign(){return Rt.unsign(this),this}float(t){return Rt.float(this,t),this}add(t){return Rt.add(this,t),this}addList(t){return Rt.setList(this,t,!0),this}setList(t){return Rt.setList(this,t),this}addListWithFn(t,e){return Rt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Rt.setListWithFn(this,t,e),this}setPoint(t){return Rt.setPoint(this,t),this}setPoints(t){return Rt.setPoints(this,t),this}addPoint(t){return Rt.addPoint(this,t),this}getPoints(){return Rt.getPoints(this)}hitPoint(t,e){return Rt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Rt.hitRadiusPoint(this,t,e)}hit(t,e){return Rt.hit(this,t,e)}includes(t,e){return Rt.includes(this,t,e)}intersect(t,e){return Rt.intersect(this,t,e),this}getIntersect(t,e){return new Lt(Rt.getIntersectData(this,t,e))}isSame(t){return Rt.isSame(this,t)}isEmpty(){return Rt.isEmpty(this)}reset(){Rt.reset(this)}}const It=new Lt;class Et{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 Lt(r,e,o||t.width-r-s,n||t.height-e-i)}}const At={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:Ot}=w;class Mt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new Mt(t)}static set filter(t){this.filterList=Wt(t)}static set exclude(t){this.excludeList=Wt(t)}static drawRepaint(t,e){const s=Ot();t.fillWorld(e,s.replace("1)",".1)")),t.strokeWorld(e,s)}static drawBounds(t,e,s){const i="hit"===Mt.showBounds,r=t.__nowWorld,o=Ot();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(Dt.enable){if(Dt.filterList.length&&Dt.filterList.every(t=>t!==this.name))return;if(Dt.excludeList.length&&Dt.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){Dt.enable&&this.warn(...t)}warn(...t){Dt.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 Wt(t){return t?a(t)&&(t=[t]):t=[],t}Mt.filterList=[],Mt.excludeList=[],Mt.showWarn=!0;const Dt=Mt,Ft=Mt.get("RunTime"),zt={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=s.create(s.RUNTIME);return Ut.currentId=Ut.idMap[i]=e?performance.now():Date.now(),Ut.currentName=Ut.nameMap[i]=t,Ut.nameToIdMap[t]=i,i},end(t,e){const s=Ut.idMap[t],i=Ut.nameMap[t],r=e?(performance.now()-s)/1e3:Date.now()-s;Ut.idMap[t]=Ut.nameMap[t]=Ut.nameToIdMap[i]=void 0,Ft.log(i,r,"ms")},endOfName(t,e){const s=Ut.nameToIdMap[t];o(s)||Ut.end(s,e)}},Ut=zt,Nt=[],Yt={list:{},add(t,...e){this.list[t]=!0,Nt.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(()=>Nt.forEach(t=>Yt.has(t,!0)));const Xt={editor:t=>Yt.need("editor")},Ht=Mt.get("UICreator"),Gt={list:{},register(t){const{__tag:e}=t.prototype;Vt[e]&&Ht.repeat(e),Vt[e]=t},get(t,e,s,i,r,n){Vt[t]||Ht.error("not register "+t);const a=new Vt[t](e);return o(s)||(a.x=s,i&&(a.y=i),r&&(a.width=r),n&&(a.height=n)),a}},{list:Vt}=Gt,jt=Mt.get("EventCreator"),qt={nameList:{},register(t){let e;Object.keys(t).forEach(s=>{e=t[s],a(e)&&(Qt[e]&&jt.repeat(e),Qt[e]=t)})},changeName(t,e){const s=Qt[t];if(s){const i=Object.keys(s).find(e=>s[e]===t);i&&(s[i]=e,Qt[e]=s)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new Qt[t](...e)},{nameList:Qt}=qt;class Jt{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=Xt.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 $t(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 Zt(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 Kt(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 te=[];function ee(){return(t,e)=>{te.push(e)}}const se=[];class ie{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||se)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;te.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}}$t([Kt("imageSmoothingEnabled")],ie.prototype,"smooth",void 0),$t([Kt("imageSmoothingQuality")],ie.prototype,"smoothLevel",void 0),$t([Kt("globalAlpha")],ie.prototype,"opacity",void 0),$t([Kt()],ie.prototype,"fillStyle",void 0),$t([Kt()],ie.prototype,"strokeStyle",void 0),$t([Kt("lineWidth")],ie.prototype,"strokeWidth",void 0),$t([Kt("lineCap")],ie.prototype,"strokeCap",void 0),$t([Kt("lineJoin")],ie.prototype,"strokeJoin",void 0),$t([Kt("lineDashOffset")],ie.prototype,"dashOffset",void 0),$t([Kt()],ie.prototype,"miterLimit",void 0),$t([Kt()],ie.prototype,"shadowBlur",void 0),$t([Kt()],ie.prototype,"shadowColor",void 0),$t([Kt()],ie.prototype,"shadowOffsetX",void 0),$t([Kt()],ie.prototype,"shadowOffsetY",void 0),$t([Kt()],ie.prototype,"filter",void 0),$t([Kt()],ie.prototype,"font",void 0),$t([Kt()],ie.prototype,"fontKerning",void 0),$t([Kt()],ie.prototype,"fontStretch",void 0),$t([Kt()],ie.prototype,"fontVariantCaps",void 0),$t([Kt()],ie.prototype,"textAlign",void 0),$t([Kt()],ie.prototype,"textBaseline",void 0),$t([Kt()],ie.prototype,"textRendering",void 0),$t([Kt()],ie.prototype,"wordSpacing",void 0),$t([Kt()],ie.prototype,"letterSpacing",void 0),$t([Kt()],ie.prototype,"direction",void 0),$t([ee()],ie.prototype,"setTransform",null),$t([ee()],ie.prototype,"resetTransform",null),$t([ee()],ie.prototype,"getTransform",null),$t([ee()],ie.prototype,"save",null),$t([ee()],ie.prototype,"restore",null),$t([ee()],ie.prototype,"translate",null),$t([ee()],ie.prototype,"scale",null),$t([ee()],ie.prototype,"rotate",null),$t([ee()],ie.prototype,"fill",null),$t([ee()],ie.prototype,"stroke",null),$t([ee()],ie.prototype,"clip",null),$t([ee()],ie.prototype,"fillRect",null),$t([ee()],ie.prototype,"strokeRect",null),$t([ee()],ie.prototype,"clearRect",null),$t([ee()],ie.prototype,"beginPath",null),$t([ee()],ie.prototype,"moveTo",null),$t([ee()],ie.prototype,"lineTo",null),$t([ee()],ie.prototype,"bezierCurveTo",null),$t([ee()],ie.prototype,"quadraticCurveTo",null),$t([ee()],ie.prototype,"closePath",null),$t([ee()],ie.prototype,"arc",null),$t([ee()],ie.prototype,"arcTo",null),$t([ee()],ie.prototype,"ellipse",null),$t([ee()],ie.prototype,"rect",null),$t([ee()],ie.prototype,"roundRect",null),$t([ee()],ie.prototype,"createConicGradient",null),$t([ee()],ie.prototype,"createLinearGradient",null),$t([ee()],ie.prototype,"createPattern",null),$t([ee()],ie.prototype,"createRadialGradient",null),$t([ee()],ie.prototype,"fillText",null),$t([ee()],ie.prototype,"measureText",null),$t([ee()],ie.prototype,"strokeText",null);const{copy:re,multiplyParent:oe}=M,{round:ne}=Math,ae={width:1,height:1,pixelRatio:1},he=["width","height","pixelRatio"];class le extends ie{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=ae),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,he),he.forEach(t=>i[t]||(i[t]=1)),this.bounds=new Lt(0,0,this.width,this.height),this.context&&!this.unreal&&(this.updateViewSize(),this.smooth=this.config.smooth),this.updateClientBounds(),this.context&&!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&&oe(t,e,r),r.a=t.a*s,r.b=t.b*s,r.c=t.c*s,r.d=t.d*s,r.e=t.e*s,r.f=t.f*s,i&&(t.half&&t.half*s%2?(r.e=ne(r.e-.5)+.5,r.f=ne(r.f-.5)+.5):(r.e=ne(r.e),r.f=ne(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){if(i&&(this.blendMode=i),e){const{pixelRatio:i}=this;s||(s=e),this.drawImage(t.view,e.x*i,e.y*i,e.width*i,e.height*i,s.x*i,s.y*i,s.width*i,s.height*i)}else this.drawImage(t.view,0,0);i&&(this.blendMode="source-over")}copyWorldToInner(t,e,s,i){if(i&&(this.blendMode=i),e.b||e.c)this.save(),this.resetTransform(),this.copyWorld(t,e,Rt.tempToOuterOf(s,e)),this.restore();else{const{pixelRatio:i}=this;this.drawImage(t.view,e.x*i,e.y*i,e.width*i,e.height*i,s.x,s.y,s.width,s.height)}i&&(this.blendMode="source-over")}copyWorldByReset(t,e,s,i,r){this.resetTransform(),this.copyWorld(t,e,s,i),r||this.useWorldTransform()}useGrayscaleAlpha(t){let e,s;this.setTempBounds(t,!0,!0);const{context:i}=this,r=i.getImageData(It.x,It.y,It.width,It.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,It.x,It.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){s&&(this.blendMode=s),this.fillStyle=e,this.setTempBounds(t),this.fillRect(It.x,It.y,It.width,It.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s){s&&(this.blendMode=s),this.strokeStyle=e,this.setTempBounds(t),this.strokeRect(It.x,It.y,It.width,It.height),s&&(this.blendMode="source-over")}clipWorld(t,e){this.beginPath(),this.setTempBounds(t,e),this.rect(It.x,It.y,It.width,It.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e){this.setTempBounds(t,e),this.clearRect(It.x,It.y,It.width,It.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempBounds(t,e,s){It.set(t),s&&It.intersect(this.bounds),It.scale(this.pixelRatio),e&&It.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):Xt.canvas(Object.assign({},s));return r.save(),t&&(re(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,!0):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(t){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const de={creator:{},parse(t,e){},convertToCanvasData(t,e){}},ce={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},ue=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},ce),_e={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},pe={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},fe=Object.assign(Object.assign({},pe),ce),ge=ue,ye={};for(let t in ge)ye[ge[t]]=t;const me={};for(let t in ge)me[ge[t]]=_e[t];const xe={drawRoundRect(t,e,s,i,r,o){const n=w.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:we,cos:ve,atan2:be,ceil:Be,abs:ke,PI:Se,sqrt:Re,pow:Ce}=Math,{setPoint:Te,addPoint:Pe}=et,{set:Le,toNumberPoints:Ie}=V,{M:Ee,L:Ae,C:Oe,Q:Me,Z:We}=ue,De={},Fe={points(t,e,s,i){let r=Ie(e);if(t.push(Ee,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=Re(Ce(n-e,2)+Ce(a-o,2)),f=Re(Ce(h-n,2)+Ce(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(Me,d,c,n,a):t.push(Oe,u,_,d,c,n,a),u=n+f*h,_=a+f*l);i||t.push(Me,u,_,r[y-2],r[y-1])}else for(let e=2,s=r.length;e<s;e+=2)t.push(Ae,r[e],r[e+1]);i&&t.push(We)},rect(t,e,s,i,r){de.creator.path=t,de.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){de.creator.path=[],xe.drawRoundRect(de.creator,e,s,i,r,o),t.push(...de.convertToCanvasData(de.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=be(u,c),g=be(p,_),y=g-f;if(y<0&&(y+=B),y===Se||ke(c+u)<1e-12||ke(_+p)<1e-12)return t&&t.push(Ae,i,r),h&&(Te(h,e,s),Pe(h,i,r)),d&&Le(d,e,s),void(l&&Le(l,i,r));const m=c*p-_*u<0,x=m?-1:1,w=a/ve(y/2),v=i+w*ve(f+y/2+k*x),S=r+w*we(f+y/2+k*x);return f-=k*x,g-=k*x,Ne(t,v,S,a,a,0,f/b,g/b,m,h,l,d)},arc:(t,e,s,i,r,o,n,a,h,l)=>Ne(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*b,_=we(u),p=ve(u);let f=n*b,g=a*b;f>Se&&(f-=B),g<0&&(g+=B);let y=g-f;y<0?y+=B:y>B&&(y-=B),h&&(y-=B);const m=Be(ke(y/k)),x=y/m,w=we(x/4),v=8/3*w*w/we(x/2);g=f+x;let S,R,C,T,P,L,I,E,A=ve(f),O=we(f),M=C=p*i*A-_*r*O,W=T=_*i*A+p*r*O,D=e+C,F=s+T;t&&t.push(t.length?Ae:Ee,D,F),l&&Te(l,D,F),c&&Le(c,D,F);for(let o=0;o<m;o++)S=ve(g),R=we(g),C=p*i*S-_*r*R,T=_*i*S+p*r*R,P=e+M-v*(p*i*O+_*r*A),L=s+W-v*(_*i*O-p*r*A),I=e+C+v*(p*i*R+_*r*S),E=s+T+v*(_*i*R-p*r*S),t&&t.push(Oe,P,L,I,E,e+C,s+T),l&&Ue(e+M,s+W,P,L,I,E,e+C,s+T,l,!0),M=C,W=T,A=S,O=R,f=g,g+=x;d&&Le(d,e+C,s+T)},quadraticCurveTo(t,e,s,i,r,o,n){t.push(Oe,(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){Ue(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?Pe(h,t,e):Te(h,t,e),Pe(h,n,a);for(let l=0,c=d.length;l<c;l++)ze(d[l],t,e,s,i,r,o,n,a,De),Pe(h,De.x,De.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 ze(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:ze,toTwoPointBounds:Ue,ellipse:Ne}=Fe,{sin:Ye,cos:Xe,sqrt:He,atan2:Ge}=Math,{ellipse:Ve}=Fe,je={ellipticalArc(t,s,i,r,o,n,a,h,l,d,c){const u=(l-s)/2,_=(d-i)/2,p=n*b,f=Ye(p),g=Xe(p),y=-g*u-f*_,m=-g*_+f*u,x=r*r,w=o*o,v=m*m,k=y*y,S=x*w-x*v-w*k;let R=0;if(S<0){const t=He(1-S/(x*w));r*=t,o*=t}else R=(a===h?-1:1)*He(S/(x*v+w*k));const C=R*r*m/o,T=-R*o*y/r,P=Ge((m-T)/o,(y-C)/r),L=Ge((-m-T)/o,(-y-C)/r);let I=L-P;0===h&&I>0?I-=B:1===h&&I<0&&(I+=B);const E=s+u+g*C-f*T,A=i+_+f*C+g*T,O=I<0?1:0;c||e.ellipseToCurve?Ve(t,E,A,r,o,n,P/b,L/b,O):r!==o||n?t.push(ue.G,E,A,r,o,n,P/b,L/b,O):t.push(ue.O,E,A,r,P/b,L/b,O)}},{M:qe,m:Qe,L:Je,l:$e,H:Ze,h:Ke,V:ts,v:es,C:ss,c:is,S:rs,s:os,Q:ns,q:as,T:hs,t:ls,A:ds,a:cs,Z:us,z:_s,N:ps,D:fs,X:gs,G:ys,F:ms,O:xs,P:ws,U:vs}=ue,{rect:bs,roundRect:Bs,arcTo:ks,arc:Ss,ellipse:Rs,quadraticCurveTo:Cs}=Fe,{ellipticalArc:Ts}=je,Ps=Mt.get("PathConvert"),Ls={},Is={current:{dot:0},stringify(t,e){let s,i,r,o=0,n=t.length,a="";for(;o<n;){i=t[o],s=me[i],a+=i===r?" ":ye[i];for(let i=1;i<s;i++)a+=w.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?fe:pe;for(let e=0,h=t.length;e<h;e++)i=t[e],At[i]?("."===i&&(Es.dot&&(As(n,o),o=""),Es.dot++),"0"===o&&"."!==i&&(As(n,o),o=""),o+=i):ue[i]?(o&&(As(n,o),o=""),Es.name=ue[i],Es.length=_e[i],Es.index=0,As(n,Es.name),!s&&a[i]&&(s=!0)):"-"===i||"+"===i?"e"===r||"E"===r?o+=i:(o&&As(n,o),o=i):o&&(As(n,o),o=""),r=i;return o&&As(n,o),s?Is.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 Qe:t[c+1]+=a,t[c+2]+=h;case qe:a=t[c+1],h=t[c+2],_.push(qe,a,h),c+=3;break;case Ke:t[c+1]+=a;case Ze:a=t[c+1],_.push(Je,a,h),c+=2;break;case es:t[c+1]+=h;case ts:h=t[c+1],_.push(Je,a,h),c+=2;break;case $e:t[c+1]+=a,t[c+2]+=h;case Je:a=t[c+1],h=t[c+2],_.push(Je,a,h),c+=3;break;case os:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=rs;case rs:n=o===ss||o===rs,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(ss,l,d,s,i,a,h),c+=5;break;case is: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=ss;case ss:s=t[c+3],i=t[c+4],a=t[c+5],h=t[c+6],_.push(ss,t[c+1],t[c+2],s,i,a,h),c+=7;break;case ls:t[c+1]+=a,t[c+2]+=h,r=hs;case hs:n=o===ns||o===hs,s=n?2*a-s:t[c+1],i=n?2*h-i:t[c+2],e?Cs(_,a,h,s,i,t[c+1],t[c+2]):_.push(ns,s,i,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case as:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=ns;case ns:s=t[c+1],i=t[c+2],e?Cs(_,a,h,s,i,t[c+3],t[c+4]):_.push(ns,s,i,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case cs:t[c+6]+=a,t[c+7]+=h;case ds:Ts(_,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 _s:case us:_.push(us),c++;break;case ps:a=t[c+1],h=t[c+2],e?bs(_,a,h,t[c+3],t[c+4]):Os(_,t,c,5),c+=5;break;case fs:a=t[c+1],h=t[c+2],e?Bs(_,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):Os(_,t,c,9),c+=9;break;case gs:a=t[c+1],h=t[c+2],e?Bs(_,a,h,t[c+3],t[c+4],t[c+5]):Os(_,t,c,6),c+=6;break;case ys:Rs(e?_:Os(_,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,Ls),a=Ls.x,h=Ls.y,c+=9;break;case ms:e?Rs(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):Os(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case xs:Ss(e?_:Os(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Ls),a=Ls.x,h=Ls.y,c+=7;break;case ws:e?Ss(_,t[c+1],t[c+2],t[c+3],0,360,!1):Os(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case vs:ks(e?_:Os(_,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Ls),a=Ls.x,h=Ls.y,c+=6;break;default:return Ps.error(`command: ${r} [index:${c}]`,t),_}o=r}return _},objectToCanvasData(t){const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(qe,t.x,t.y);break;case"L":e.push(Je,t.x,t.y);break;case"C":e.push(ss,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(ns,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(us)}}),e},copyData(t,e,s,i){for(let r=s,o=s+i;r<o;r++)t.push(e[r])},pushData(t,e){Es.index===Es.length&&(Es.index=1,t.push(Es.name)),t.push(Number(e)),Es.index++,Es.dot=0}},{current:Es,pushData:As,copyData:Os}=Is,{M:Ms,L:Ws,C:Ds,Q:Fs,Z:zs,N:Us,D:Ns,X:Ys,G:Xs,F:Hs,O:Gs,P:Vs,U:js}=ue,{getMinDistanceFrom:qs,getRadianFrom:Qs}=V,{tan:Js,min:$s,abs:Zs}=Math,Ks={},ti={beginPath(t){t.length=0},moveTo(t,e,s){t.push(Ms,e,s)},lineTo(t,e,s){t.push(Ws,e,s)},bezierCurveTo(t,e,s,i,r,o,n){t.push(Ds,e,s,i,r,o,n)},quadraticCurveTo(t,e,s,i,r){t.push(Fs,e,s,i,r)},closePath(t){t.push(zs)},rect(t,e,s,i,r){t.push(Us,e,s,i,r)},roundRect(t,e,s,i,r,o){if(l(o))t.push(Ys,e,s,i,r,o);else{const n=w.fourNumber(o);n?t.push(Ns,e,s,i,r,...n):t.push(Us,e,s,i,r)}},ellipse(t,e,s,i,r,o,a,h,l){n(o)?t.push(Hs,e,s,i,r):(n(a)&&(a=0),n(h)&&(h=360),t.push(Xs,e,s,i,r,o,a,h,l?1:0))},arc(t,e,s,i,r,o,a){n(r)?t.push(Vs,e,s,i):(n(o)&&(o=360),t.push(Gs,e,s,i,r,o,a?1:0))},arcTo(t,e,s,i,r,n,a,h){if(!o(a)){const t=qs(a,h,e,s,i,r);n=$s(n,$s(t/2,t/2*Zs(Js(Qs(a,h,e,s,i,r)/2))))}t.push(js,e,s,i,r,n)},drawEllipse(t,e,s,i,r,o,a,h,l){Fe.ellipse(null,e,s,i,r,n(o)?0:o,n(a)?0:a,n(h)?360:h,l,null,null,Ks),t.push(Ms,Ks.x,Ks.y),ei(t,e,s,i,r,o,a,h,l)},drawArc(t,e,s,i,r,o,a){Fe.arc(null,e,s,i,n(r)?0:r,n(o)?360:o,a,null,null,Ks),t.push(Ms,Ks.x,Ks.y),si(t,e,s,i,r,o,a)},drawPoints(t,e,s,i){Fe.points(t,e,s,i)}},{ellipse:ei,arc:si}=ti,{moveTo:ii,lineTo:ri,quadraticCurveTo:oi,bezierCurveTo:ni,closePath:ai,beginPath:hi,rect:li,roundRect:di,ellipse:ci,arc:ui,arcTo:_i,drawEllipse:pi,drawArc:fi,drawPoints:gi}=ti;class yi{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?a(t)?de.parse(t):t:[],this}beginPath(){return hi(this.__path),this.paint(),this}moveTo(t,e){return ii(this.__path,t,e),this.paint(),this}lineTo(t,e){return ri(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,s,i,r,o){return ni(this.__path,t,e,s,i,r,o),this.paint(),this}quadraticCurveTo(t,e,s,i){return oi(this.__path,t,e,s,i),this.paint(),this}closePath(){return ai(this.__path),this.paint(),this}rect(t,e,s,i){return li(this.__path,t,e,s,i),this.paint(),this}roundRect(t,e,s,i,r){return di(this.__path,t,e,s,i,r),this.paint(),this}ellipse(t,e,s,i,r,o,n,a){return ci(this.__path,t,e,s,i,r,o,n,a),this.paint(),this}arc(t,e,s,i,r,o){return ui(this.__path,t,e,s,i,r,o),this.paint(),this}arcTo(t,e,s,i,r){return _i(this.__path,t,e,s,i,r),this.paint(),this}drawEllipse(t,e,s,i,r,o,n,a){return pi(this.__path,t,e,s,i,r,o,n,a),this.paint(),this}drawArc(t,e,s,i,r,o){return fi(this.__path,t,e,s,i,r,o),this.paint(),this}drawPoints(t,e,s){return gi(this.__path,t,e,s),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:mi,L:xi,C:wi,Q:vi,Z:bi,N:Bi,D:ki,X:Si,G:Ri,F:Ci,O:Ti,P:Pi,U:Li}=ue,Ii=Mt.get("PathDrawer"),Ei={drawPathByData(t,e){if(!e)return;let s,i=0,r=e.length;for(;i<r;)switch(s=e[i],s){case mi:t.moveTo(e[i+1],e[i+2]),i+=3;break;case xi:t.lineTo(e[i+1],e[i+2]),i+=3;break;case wi:t.bezierCurveTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5],e[i+6]),i+=7;break;case vi:t.quadraticCurveTo(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case bi:t.closePath(),i+=1;break;case Bi:t.rect(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case ki: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 Si:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;case Ri:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]*b,e[i+6]*b,e[i+7]*b,e[i+8]),i+=9;break;case Ci:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],0,0,B,!1),i+=5;break;case Ti:t.arc(e[i+1],e[i+2],e[i+3],e[i+4]*b,e[i+5]*b,e[i+6]),i+=7;break;case Pi:t.arc(e[i+1],e[i+2],e[i+3],0,B,!1),i+=4;break;case Li:t.arcTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;default:return void Ii.error(`command: ${s} [index:${i}]`,e)}}},{M:Ai,L:Oi,C:Mi,Q:Wi,Z:Di,N:Fi,D:zi,X:Ui,G:Ni,F:Yi,O:Xi,P:Hi,U:Gi}=ue,{toTwoPointBounds:Vi,toTwoPointBoundsByQuadraticCurve:ji,arcTo:qi,arc:Qi,ellipse:Ji}=Fe,{addPointBounds:$i,copy:Zi,addPoint:Ki,setPoint:tr,addBounds:er,toBounds:sr}=et,ir=Mt.get("PathBounds");let rr,or,nr;const ar={},hr={},lr={},dr={toBounds(t,e){dr.toTwoPointBounds(t,hr),sr(hr,e)},toTwoPointBounds(t,e){if(!t||!t.length)return tr(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===Di||n===Mi||n===Wi?tr(e,h,l):tr(e,t[a+1],t[a+2])),n){case Ai:case Oi:h=t[a+1],l=t[a+2],Ki(e,h,l),a+=3;break;case Mi:r=t[a+5],o=t[a+6],Vi(h,l,t[a+1],t[a+2],t[a+3],t[a+4],r,o,ar),$i(e,ar),h=r,l=o,a+=7;break;case Wi:s=t[a+1],i=t[a+2],r=t[a+3],o=t[a+4],ji(h,l,s,i,r,o,ar),$i(e,ar),h=r,l=o,a+=5;break;case Di:a+=1;break;case Fi:h=t[a+1],l=t[a+2],er(e,h,l,t[a+3],t[a+4]),a+=5;break;case zi:case Ui:h=t[a+1],l=t[a+2],er(e,h,l,t[a+3],t[a+4]),a+=n===zi?9:6;break;case Ni:Ji(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],ar,lr),0===a?Zi(e,ar):$i(e,ar),h=lr.x,l=lr.y,a+=9;break;case Yi:h=t[a+1],l=t[a+2],or=t[a+3],nr=t[a+4],er(e,h-or,l-nr,2*or,2*nr),h+=or,a+=5;break;case Xi:Qi(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],ar,lr),0===a?Zi(e,ar):$i(e,ar),h=lr.x,l=lr.y,a+=7;break;case Hi:h=t[a+1],l=t[a+2],rr=t[a+3],er(e,h-rr,l-rr,2*rr,2*rr),h+=rr,a+=4;break;case Gi:qi(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],ar,lr),0===a?Zi(e,ar):$i(e,ar),h=lr.x,l=lr.y,a+=6;break;default:return void ir.error(`command: ${n} [index:${a}]`,t)}}},{M:cr,L:ur,Z:_r}=ue,{getCenterX:pr,getCenterY:fr}=V,{arcTo:gr}=ti,yr={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 cr:l=_=t[n+1],d=p=t[n+2],n+=3,t[n]===ur?(c=t[n+1],u=t[n+2],g.push(cr,pr(l,c),fr(d,u))):g.push(cr,l,d);break;case ur:switch(a=t[n+1],h=t[n+2],n+=3,t[n]){case ur:gr(g,a,h,t[n+1],t[n+2],e,_,p);break;case _r:gr(g,a,h,l,d,e,_,p);break;default:g.push(ur,a,h)}_=a,p=h;break;case _r:r!==_r&&(gr(g,l,d,c,u,e,_,p),g.push(_r)),n+=1;break;default:o=me[i];for(let e=0;e<o;e++)g.push(t[n+e]);n+=o}r=i}return i!==_r&&(g[1]=l,g[2]=d),g}};de.creator=new yi,de.parse=Is.parse,de.convertToCanvasData=Is.toCanvasData;const mr=new yi,{drawRoundRect:xr}=xe;function wr(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,s,i,r){xr(this,t,e,s,i,r)})}(t)}const vr={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=br.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{}}}},br=vr;br.alphaPixelTypes.forEach(t=>br.upperCaseTypeMap[t]=t.toUpperCase());const Br=Mt.get("TaskProcessor");class kr{constructor(t){this.parallel=!0,this.time=1,this.id=s.create(s.TASK),this.task=t}run(){return Zt(this,void 0,void 0,function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){Br.error(t)}})}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class Sr{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 kr(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 Rr=Mt.get("Resource"),Cr={tasker:new Sr,map:{},get isComplete(){return Tr.tasker.isComplete},set(t,e){Tr.map[t]&&Rr.repeat(t),Tr.map[t]=e},get:t=>Tr.map[t],remove(t){const e=Tr.map[t];e&&(e.destroy&&e.destroy(),delete Tr.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=Xt.image(i)),Tr.set(t,e),e},destroy(){Tr.map={}}},Tr=Cr,Pr={maxRecycled:10,recycledList:[],patternTasker:new Sr,get(t){let e=Cr.get(t.url);return e||Cr.set(t.url,e=Xt.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||Lr.recycledList.push(t)})},clearRecycled(){const t=Lr.recycledList;t.length>Lr.maxRecycled&&(t.forEach(t=>!t.use&&t.url&&Cr.remove(t.url)),t.length=0)},hasAlphaPixel:t=>vr.alphaPixelTypes.some(e=>Lr.isFormat(e,t)),isFormat(t,e){if(e.format===t)return!0;const{url:s}=e;if(s.startsWith("data:")){if(s.startsWith("data:"+vr.mineType(t)))return!0}else{if(s.includes("."+t)||s.includes("."+vr.upperCaseTypeMap[t]))return!0;if("png"===t&&!s.includes("."))return!0}return!1},destroy(){Lr.recycledList=[]}},Lr=Pr,{IMAGE:Ir,create:Er}=s,{floor:Ar,max:Or}=Math;class Mr{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=Er(Ir),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}Pr.isFormat("svg",t)&&(this.isSVG=!0),Pr.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),Cr.tasker.add(()=>Zt(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){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 a=e.origin.createCanvas(Or(Ar(t+(o||0)),1),Or(Ar(s+(n||0)),1)),h=a.getContext("2d");return i&&(h.globalAlpha=i),h.drawImage(this.view,0,0,t,s),this.cache=this.use>1?{data:a,params:arguments}:null,a}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 Wr(t,e,s,i){i||(s.configurable=s.enumerable=!0),Object.defineProperty(t,e,s)}function Dr(t,e){return Object.getOwnPropertyDescriptor(t,e)}function Fr(t,e){const s="_"+t;return{get(){const t=this[s];return o(t)?e:t},set(t){this[s]=t}}}function zr(t,e){return(s,i)=>Nr(s,i,t,e&&e(i))}function Ur(t){return t}function Nr(t,e,s,i){const r={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};Wr(t,e,Object.assign(r,i||{})),po(t,e,s)}function Yr(t){return zr(t)}function Xr(t,e){return zr(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function Hr(t){return zr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),Qr(this))}}))}function Gr(t,e){return zr(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function Vr(t,e){return zr(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function jr(t,e){return zr(t,t=>({set(s){this.__setAttr(t,s,e)&&Qr(this)}}))}function qr(t){return zr(t,t=>({set(e){this.__setAttr(t,e)&&(Qr(this),this.__.__removeNaturalSize())}}))}function Qr(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function Jr(t){return zr(t,t=>({set(e){const s=this.__;2!==s.__pathInputed&&(s.__pathInputed=e?1:0),e||(s.__pathForRender=void 0),this.__setAttr(t,e),Qr(this)}}))}const $r=jr;function Zr(t,e){return zr(t,t=>({set(s){this.__setAttr(t,s)&&(Kr(this),e&&(this.__.__useStroke=!0))}}))}function Kr(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&Qr(t)}const to=Zr;function eo(t){return zr(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function so(t){return zr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function io(t){return zr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&oo(this)}}))}function ro(t){return zr(t,t=>({set(e){const s=this.visible;if(!0===s&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>no(this,t,e,s))}else 0===s&&!0===e&&this.animation&&this.__runAnimation("in");no(this,t,e,s),this.mask&&oo(this)}}))}function oo(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function no(t,e,s,i){t.__setAttr(e,s)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==i&&0!==s||Qr(t))}function ao(t){return zr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function ho(t){return zr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function lo(t){return zr(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function co(t){return zr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===Mt.showBounds&&(this.__layout.surfaceChanged||this.__layout.surfaceChange()),this.leafer&&this.leafer.updateCursor())}}))}function uo(t){return zr(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function _o(t){return(e,s)=>{Wr(e,"__DataProcessor",{get:()=>t})}}function po(t,e,s){const i=t.__DataProcessor.prototype,r="_"+e,n=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=Fr(e,s);if(o(s))a.get=function(){return this[r]};else if("function"==typeof s)a.get=function(){let t=this[r];return void 0===t?s(this.__leaf):t};else if(u(s)){const t=_(s);a.get=function(){let e=this[r];return void 0===e?this[r]=t?{}:p.clone(s):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[r];if(void 0===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(void 0===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=Dr(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),i[n]&&(a.set=i[n],delete i[n]),Wr(i,e,a)}const fo=new Mt("rewrite"),go=[],yo=["destroy","constructor"];function mo(t){return(e,s)=>{go.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}}function xo(){return t=>{wo()}}function wo(t){go.length&&(go.forEach(e=>{t&&fo.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),go.length=0)}function vo(t,e){return s=>{var i;(t.prototype?(i=t.prototype,Object.getOwnPropertyNames(i)):Object.keys(t)).forEach(i=>{if(!(yo.includes(i)||e&&e.includes(i)))if(t.prototype){Dr(t.prototype,i).writable&&(s.prototype[i]=t.prototype[i])}else s.prototype[i]=t[i]})}}function bo(){return t=>{Gt.register(t)}}setTimeout(()=>wo(!0));const{copy:Bo,toInnerPoint:ko,toOuterPoint:So,scaleOfOuter:Ro,rotateOfOuter:Co,skewOfOuter:To,multiplyParent:Po,divideParent:Lo,getLayout:Io}=M,Eo={},{round:Ao}=Math,Oo={updateAllMatrix(t,e,s){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(s=!0),Do(t,e,s),t.isBranch){const{children:i}=t;for(let t=0,r=i.length;t<r;t++)Wo(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++)Fo(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&Fo(t),t.__updateChange()},updateAllChange(t){if(Uo(t),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)zo(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?So(t.localTransform,o,o,!0):t.parent&&ko(t.parent.worldTransform,o,o,!0),Mo.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=Ao(e),s=Ao(s)),i?t.animate({x:e,y:s},i):(t.x=e,t.y=s)},zoomOfWorld(t,e,s,i,r,o){Mo.zoomOfLocal(t,No(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),Bo(Eo,n),Ro(Eo,e,s,i),t.origin||t.around)Mo.setTransform(t,Eo,r,o);else{const e=t.x+Eo.e-n.e,a=t.y+Eo.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){Mo.rotateOfLocal(t,No(t,e),s,i)},rotateOfLocal(t,e,s,i){const r=t.__localMatrix;Bo(Eo,r),Co(Eo,e,s),t.origin||t.around?Mo.setTransform(t,Eo,!1,i):t.set({x:t.x+Eo.e-r.e,y:t.y+Eo.f-r.f,rotation:w.formatRotation(t.rotation+s)},i)},skewOfWorld(t,e,s,i,r,o){Mo.skewOfLocal(t,No(t,e),s,i,r,o)},skewOfLocal(t,e,s,i=0,r,o){Bo(Eo,t.__localMatrix),To(Eo,e,s,i),Mo.setTransform(t,Eo,r,o)},transformWorld(t,e,s,i){Bo(Eo,t.worldTransform),Po(Eo,e),t.parent&&Lo(Eo,t.parent.worldTransform),Mo.setTransform(t,Eo,s,i)},transform(t,e,s,i){Bo(Eo,t.localTransform),Po(Eo,e),Mo.setTransform(t,Eo,s,i)},setTransform(t,e,s,i){const r=t.__,o=r.origin&&Mo.getInnerOrigin(t,r.origin),n=Io(e,o,r.around&&Mo.getInnerOrigin(t,r.around));if(s){const e=n.scaleX/t.scaleX,s=n.scaleY/t.scaleY;if(delete n.scaleX,delete n.scaleY,o){Rt.scale(t.boxBounds,Math.abs(e),Math.abs(s));const i=Mo.getInnerOrigin(t,r.origin);V.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 Ro(s,Mo.getLocalOrigin(t,"center"),-1*i,1*i),s},getLocalOrigin:(t,e)=>V.tempToOuterOf(Mo.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const s={};return nt.toPoint(e,t.boxBounds,s),s},getRelativeWorld:(t,e,s)=>(Bo(Eo,t.worldTransform),Lo(Eo,e.worldTransform),s?Eo:Object.assign({},Eo)),drop(t,e,s,i){t.setTransform(Mo.getRelativeWorld(t,e,!0),i),e.add(t,s)},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(()=>Mo.animateMove(t,s,i))}}},Mo=Oo,{updateAllMatrix:Wo,updateMatrix:Do,updateAllWorldOpacity:Fo,updateAllChange:zo,updateChange:Uo}=Mo;function No(t,e){return t.__layout.update(),t.parent?V.tempToInnerOf(e,t.parent.__world):e}const Yo={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)=>Ho(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>Ho(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>Ho(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 Xo;function Ho(t,e){return e||(Xo=0),t.__.mask&&(Xo=1),Xo<0?null:(Xo&&(Xo=-1),!0)}const{updateBounds:Go}=Oo,Vo={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),jo(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++)qo(e[t],e)},updateBounds(t,e){const s=[t];qo(t,s),Qo(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++)Go(i[t]);e&&e===s||Go(s)}}},{pushAllChildBranch:jo,pushAllBranchStack:qo,updateBoundsByBranchStack:Qo}=Vo,Jo={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:$o,updateBounds:Zo}=Oo,{toOuterOf:Ko,getPoints:tn,copy:en}=Rt,sn="_localContentBounds",rn="_worldContentBounds",on="_worldBoxBounds",nn="_worldStrokeBounds";class an{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 Ko(this.contentBounds,this.leaf.__localMatrix,this[sn]||(this[sn]={})),this[sn]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return Ko(this.contentBounds,this.leaf.__world,this[rn]||(this[rn]={})),this[rn]}get worldBoxBounds(){return Ko(this.boxBounds,this.leaf.__world,this[on]||(this[on]={})),this[on]}get worldStrokeBounds(){return Ko(this.strokeBounds,this.leaf.__world,this[nn]||(this[nn]={})),this[nn]}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 Zo(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 M.defaultMatrix;case"page":t=e.zoomLayer;default:return $o(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 Lt(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=M.defaultMatrix;break;case"page":e=i.zoomLayer;default:r=i.getWorldPoint(a,e),o=$o(i,e,!0)}if(n||(n=M.getLayout(o)),en(n,a),V.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=tn(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.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.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 hn{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 ln extends hn{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}ln.ADD="child.add",ln.REMOVE="child.remove",ln.CREATED="created",ln.MOUNTED="mounted",ln.UNMOUNTED="unmounted",ln.DESTROY="destroy";class dn extends hn{constructor(t,e,s,i,r){super(t,e),this.attrName=s,this.oldValue=i,this.newValue=r}}dn.CHANGE="property.change",dn.LEAFER_CHANGE="property.leafer_change";class cn extends hn{constructor(t,e){super(t),Object.assign(this,e)}}cn.LOAD="image.load",cn.LOADED="image.loaded",cn.ERROR="image.error";class un extends hn{static checkHas(t,e,s){"on"===s?e===gn?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(_n)||t.hasEvent(pn)||t.hasEvent(fn),t.__hasWorldEvent=t.hasEvent(gn))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(_n,t),"inner"===e&&t.emit(pn,t)),t.emit(fn,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(gn,this)}}un.RESIZE="bounds.resize",un.INNER="bounds.inner",un.LOCAL="bounds.local",un.WORLD="bounds.world";const{RESIZE:_n,INNER:pn,LOCAL:fn,WORLD:gn}=un,yn={};[_n,pn,fn,gn].forEach(t=>yn[t]=1);class mn extends hn{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(mn.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!o(this.resizingKeys[t.innerId])}}mn.RESIZE="resize";class xn extends hn{constructor(t,e){super(t),this.data=e}}xn.REQUEST="watch.request",xn.DATA="watch.data";class wn extends hn{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}wn.REQUEST="layout.request",wn.START="layout.start",wn.BEFORE="layout.before",wn.LAYOUT="layout",wn.AFTER="layout.after",wn.AGAIN="layout.again",wn.END="layout.end";class vn extends hn{constructor(t,e,s,i){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=i)}}vn.REQUEST="render.request",vn.CHILD_START="render.child_start",vn.CHILD_END="render.child_end",vn.START="render.start",vn.BEFORE="render.before",vn.RENDER="render",vn.AFTER="render.after",vn.AGAIN="render.again",vn.END="render.end",vn.NEXT="render.next";class bn extends hn{}bn.START="leafer.start",bn.BEFORE_READY="leafer.before_ready",bn.READY="leafer.ready",bn.AFTER_READY="leafer.after_ready",bn.VIEW_READY="leafer.view_ready",bn.VIEW_COMPLETED="leafer.view_completed",bn.STOP="leafer.stop",bn.RESTART="leafer.restart",bn.END="leafer.end",bn.TRANSFORM="leafer.transform",bn.MOVE="leafer.move",bn.SCALE="leafer.scale",bn.ROTATE="leafer.rotate",bn.SKEW="leafer.skew";const{MOVE:Bn,SCALE:kn,ROTATE:Sn,SKEW:Rn}=bn,Cn={x:Bn,y:Bn,scaleX:kn,scaleY:kn,rotation:Sn,skewX:Rn,skewY:Rn},Tn={};class Pn{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=Ln(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],yn[t]&&un.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=Ln(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],yn[t]&&un.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.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&&qt.has(t)&&(e=qt.get(t,{type:t,target:this,current:this}));const i=Ln(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 Ln(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:Tn)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:Tn)}}const{on:In,on_:En,off:An,off_:On,once:Mn,emit:Wn,emitEvent:Dn,hasEvent:Fn,destroy:zn}=Pn.prototype,Un={on:In,on_:En,off:An,off_:On,once:Mn,emit:Wn,emitEvent:Dn,hasEvent:Fn,destroyEventer:zn},Nn=Mt.get("setAttr"),Yn={__setAttr(t,e,s){if(this.leaferIsCreated){const i=this.__.__getInput(t);if(!s||h(e)||o(e)||(Nn.warn(this.innerName,t,e),e=void 0),u(e)||i!==e){this.__realSetAttr(t,e);const{CHANGE:s}=dn,r=new dn(s,this,t,i,e);if(this.isLeafer){this.emitEvent(new dn(dn.LEAFER_CHANGE,this,t,i,e));const s=Cn[t];s&&(this.emitEvent(new bn(s,this)),this.emitEvent(new bn(bn.TRANSFORM,this)))}else this.hasEvent(s)&&this.emitEvent(r);return this.leafer.emitEvent(r),!0}return!1}return this.__realSetAttr(t,e),!0},__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:Xn,multiplyParent:Hn,translateInner:Gn,defaultWorld:Vn}=M,{toPoint:jn,tempPoint:qn}=nt,Qn={__updateWorldMatrix(){const{parent:t,__layout:e}=this;Hn(this.__local||e,t?t.__world:Vn,this.__world,!!e.affectScaleOrRotation,this.__,t&&(t.scrollY||t.scrollX)&&t.__)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,s=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(Xn(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)&&(jn(s.around||s.origin,t.boxBounds,qn),Gn(e,-qn.x,-qn.y,!s.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:Jn,updateAllMatrix:$n}=Oo,{updateBounds:Zn}=Vo,{toOuterOf:Kn,copyAndSpread:ta,copy:ea}=Rt,{toBounds:sa}=dr,ia={__updateWorldBounds(){const t=this.__layout;Kn(t.renderBounds,this.__world,this.__world),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&un.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&un.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(),Kn(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Kn(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Kn(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(){const t=this.__layout.boxBounds,e=this.__;e.__pathInputed?sa(e.path,t):(t.x=0,t.y=0,t.width=e.width,t.height=e.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),$n(this),Zn(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):($n(this),Zn(this,this))):Jn(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(){const t=this.__layout;ta(t.strokeBounds,t.boxBounds,t.strokeBoxSpread)},__updateRenderBounds(){const t=this.__layout;t.renderSpread>0?ta(t.renderBounds,t.boxBounds,t.renderSpread):ea(t.renderBounds,t.strokeBounds)}},ra={__render(t,e){if(e.shape)return this.__renderShape(t,e);if(this.__worldOpacity){const s=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),Oo.copyCanvasByWorld(this,t,i,this.__nowWorld,s.__blendMode,!0),i.recycle(this.__nowWorld)}else this.__draw(t,e);Mt.showBounds&&Mt.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:oa}=Yo,na={__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.dim?e.dimOpacity=!0===s.dim?.2:s.dim:s.dimskip&&e.dimOpacity&&(e.dimOpacity=0),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++)oa(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++)oa(s[i],e)||s[i].__clip(t,e)}}},aa={},{LEAF:ha,create:la}=s,{toInnerPoint:da,toOuterPoint:ca,multiplyParent:ua}=M,{toOuterOf:_a}=Rt,{copy:pa,move:fa}=V,{moveLocal:ga,zoomOfLocal:ya,rotateOfLocal:ma,skewOfLocal:xa,moveWorld:wa,zoomOfWorld:va,rotateOfWorld:ba,skewOfWorld:Ba,transform:ka,transformWorld:Sa,setTransform:Ra,getFlipTransform:Ca,getLocalOrigin:Ta,getRelativeWorld:Pa,drop:La}=Oo;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 an}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 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.__layout.update(),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=la(ha),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(ln.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(ln.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(ln.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(ln.MOUNTED)):this.__emitLifeEvent(ln.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(){}__updateContentBounds(){}__updateStrokeBounds(){}__updateRenderBounds(){}__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 ua(s,t.matrix,e,void 0,s),_a(this.__layout.renderBounds,e,e),e.half!==s.half&&(e.half=s.half),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}=Pr.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),aa.scaleX=s,aa.scaleY=i,aa}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?Pa(this,e):this.worldTransform,r=s?t:{};return _a(t,i,r),r}worldToLocal(t,e,s,i){this.parent?this.parent.worldToInner(t,e,s,i):e&&pa(e,t)}localToWorld(t,e,s,i){this.parent?this.parent.innerToWorld(t,e,s,i):e&&pa(e,t)}worldToInner(t,e,s,i){i&&(i.innerToWorld(t,e,s),t=e||t),da(this.worldTransform,t,e,s)}innerToWorld(t,e,s,i){ca(this.worldTransform,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 fa(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 fa(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){Ra(this,t,e,s)}transform(t,e,s){ka(this,t,e,s)}move(t,e,s){ga(this,t,e,s)}moveInner(t,e,s){wa(this,t,e,!0,s)}scaleOf(t,e,s,i,r){ya(this,Ta(this,t),e,s,i,r)}rotateOf(t,e,s){ma(this,Ta(this,t),e,s)}skewOf(t,e,s,i,r){xa(this,Ta(this,t),e,s,i,r)}transformWorld(t,e,s){Sa(this,t,e,s)}moveWorld(t,e,s){wa(this,t,e,!1,s)}scaleOfWorld(t,e,s,i,r){va(this,t,e,s,i,r)}rotateOfWorld(t,e){ba(this,t,e)}skewOfWorld(t,e,s,i,r){Ba(this,t,e,s,i,r)}flip(t,e){ka(this,Ca(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 Yt.need("path")}getMotionPoint(t){return Yt.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){La(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):po(this.prototype,t,e)}static addAttr(t,e,s,i){s||(s=jr),s(e,i)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new ln(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(ln.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}},t.Leaf=$t([vo(Yn),vo(Qn),vo(ia),vo(Un),vo(ra)],t.Leaf);const{setListWithFn:Ia}=Rt,{sort:Ea}=Vo,{localBoxBounds:Aa,localStrokeBounds:Oa,localRenderBounds:Ma,maskLocalBoxBounds:Wa,maskLocalStrokeBounds:Da,maskLocalRenderBounds:Fa}=Yo,za=new Mt("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(){Ia(this.__layout.boxBounds,this.children,this.__hasMask?Wa:Aa)}__updateStrokeBounds(){Ia(this.__layout.strokeBounds,this.children,this.__hasMask?Da:Oa)}__updateRenderBounds(){Ia(this.__layout.renderBounds,this.children,this.__hasMask?Fa:Ma)}__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(Ea),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return za.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=Gt.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(ln.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(ln.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(ln.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(ln.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const s=new ln(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),this.leafer.emitEvent(s)}},t.Branch=$t([vo(na)],t.Branch);class Ua{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 Ua;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 Na{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 Ya=Mt.get("LeaferCanvas");class Xa extends le{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.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 Ya.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;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,s){if(this.resizeListener=s,t){this.autoBounds=t;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),Ya.warn("no parent"))}catch(t){this.imitateResizeObserver()}}else 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})}})}imitateResizeObserver(){this.autoLayout&&(this.parentView&&this.checkAutoBounds(this.parentView.getBoundingClientRect()),e.requestRender(this.imitateResizeObserver.bind(this)))}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,he),this.resize(t),this.resizeListener&&!o(this.width)&&this.resizeListener(new mn(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.windowListener&&(window.removeEventListener("resize",this.windowListener),this.windowListener=null),!this.unreal){const t=this.view;t.parentElement&&t.remove()}super.destroy()}}}wr(CanvasRenderingContext2D.prototype),wr(Path2D.prototype);const{mineType:Ha,fileType:Ga}=vr;function Va(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=Ha(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,Ha(e),s)),canvasSaveAs:(t,s,i)=>{const r=t.toDataURL(Ha(Ga(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=Xt.canvas(),e.conicGradientSupport=!!e.canvas.context.createConicGradient}Object.assign(Xt,{canvas:(t,e)=>new Xa(t,e),image:t=>new Mr(t)}),e.name="web",e.isMobile="ontouchstart"in window,e.requestRender=function(t){window.requestAnimationFrame(t)},Wr(e,"devicePixelRatio",{get:()=>devicePixelRatio});const{userAgent:ja}=navigator;ja.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),ja.indexOf("Windows")>-1?(e.os="Windows",e.intWheelDeltaY=!0):ja.indexOf("Mac")>-1?e.os="Mac":ja.indexOf("Linux")>-1&&(e.os="Linux");class qa{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new Ua;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 Ua,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(vn.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===ln.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 xn(xn.DATA,{updatedList:this.updatedList})),this.__updatedList=new Ua,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[dn.CHANGE,this.__onAttrChange,this],[[ln.ADD,ln.REMOVE],this.__onChildEvent,this],[xn.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:Qa,updateBounds:Ja,updateChange:$a}=Oo,{pushAllChildBranch:Za,pushAllParent:Ka}=Vo;const{worldBounds:th}=Yo;class eh{constructor(t){this.updatedBounds=new Lt,this.beforeBounds=new Lt,this.afterBounds=new Lt,c(t)&&(t=new Ua(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,th)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,th),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:sh,updateAllChange:ih}=Oo,rh=Mt.get("Layouter");class oh{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new Na,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(wn.START),this.layoutOnce(),t.emitEvent(new wn(wn.END,this.layoutedBlocks,this.times))}catch(t){rh.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?rh.warn("layouting"):this.times>3?rh.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(xn.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=zt.start("PartLayout"),{target:s,__updatedList:i}=this,{BEFORE:r,LAYOUT:o,AFTER:n}=wn,a=this.getBlocks(i);a.forEach(t=>t.setBefore()),s.emitEvent(new wn(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?(Qa(t,!0),e.add(t),t.isBranch&&Za(t,e),Ka(t,e)):s.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Ka(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||Ja(i[t])}Ja(s)}})}(this.__levelList),function(t){t.list.forEach($a)}(i),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),s.emitEvent(new wn(o,a,this.times)),s.emitEvent(new wn(n,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,zt.end(e)}fullLayout(){const t=zt.start("FullLayout"),{target:e}=this,{BEFORE:s,LAYOUT:i,AFTER:r}=wn,o=this.getBlocks(new Ua(e));e.emitEvent(new wn(s,o,this.times)),oh.fullLayout(e),o.forEach(t=>{t.setAfter()}),e.emitEvent(new wn(i,o,this.times)),e.emitEvent(new wn(r,o,this.times)),this.addBlocks(o),zt.end(t)}static fullLayout(t){sh(t,!0),t.isBranch?Vo.updateBounds(t):Oo.updateBounds(t),ih(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:s}=this.extraBlock||(this.extraBlock=new eh([]));e.length?s.add(t.__world):s.set(t.__world),e.add(t)}}createBlock(t){return new eh(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_([[wn.REQUEST,this.layout,this],[wn.AGAIN,this.layoutAgain,this],[xn.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const nh=Mt.get("Renderer");class ah{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:60},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(wn.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(vn.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(vn.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(vn.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new Lt,nh.log(e.innerName,"---\x3e");try{this.emitRender(vn.START),this.renderOnce(t),this.emitRender(vn.END,this.totalBounds),Pr.clearRecycled()}catch(t){this.rendering=!1,nh.error(t)}nh.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return nh.warn("rendering");if(this.times>3)return nh.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Lt,this.renderOptions={},t)this.emitRender(vn.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(vn.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(vn.RENDER,this.renderBounds,this.renderOptions),this.emitRender(vn.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=zt.start("PartRender"),{canvas:s}=this,i=t.getIntersect(s.bounds),r=new Lt(i);s.save(),i.spread(ah.clipSpread).ceil(),s.clearWorld(i,!0),s.clipWorld(i,!0),this.__render(i,r),s.restore(),zt.end(e)}fullRender(){const t=zt.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),zt.end(t)}__render(t,e){const{canvas:s}=this,i=t.includes(this.target.__world),r=i?{includes:i}:{bounds:t,includes:i};this.needFill&&s.fillWorld(t,this.config.fill),Mt.showRepaint&&Mt.drawRepaint(s,t),this.target.__render(s,r),this.renderBounds=e=e||t,this.renderOptions=r,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),s.updateRender(e)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new Lt;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);const s=this.requestTime=Date.now();e.requestRender(()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-s))),this.requestTime=0,this.checkRender()})}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:s}=t.old;if(!new Lt(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 Lt(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||nh.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 vn(t,this.times,e,s))}__listenEvents(){this.__eventIds=[this.target.on_([[vn.REQUEST,this.update,this],[wn.END,this.__onLayoutEnd,this],[vn.AGAIN,this.renderAgain,this],[mn.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.canvas=this.config=null)}}function hh(t){return zr(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function lh(t){return zr(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function dh(){return(t,e)=>{const s="_"+e;Wr(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}})}}ah.clipSpread=10,Object.assign(Xt,{watcher:(t,e)=>new qa(t,e),layouter:(t,e)=>new oh(t,e),renderer:(t,e,s)=>new ah(t,e,s),selector:(t,e)=>{},interaction:(t,e,s,i)=>{}}),e.layout=oh.fullLayout;const ch={},uh={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}},_h={number:(t,e)=>u(t)?"percent"===t.type?t.value*e:t.value:t},ph={},fh={},gh={},yh={},mh={},xh={apply(){Yt.need("filter")}},wh={},vh={setStyleName:()=>Yt.need("state"),set:()=>Yt.need("state")},bh={list:{},register(t,e){bh.list[t]=e},get:t=>bh.list[t]},{parse:Bh,objectToCanvasData:kh}=Is,{stintSet:Sh}=p,{hasTransparent:Rh}=uh,Ch={},Th=Mt.get("UIData");class Ph 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,Th.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,Th.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),a(t)||!t?(Sh(this,"__isTransparentFill",Rh(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):u(t)&&this.__setPaint("fill",t)}setStroke(t){a(t)||!t?(Sh(this,"__isTransparentStroke",Rh(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?Bh(t):kh(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){Lh(this,"shadow",t)}setInnerShadow(t){Lh(this,"innerShadow",t)}setFilter(t){Lh(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&fh.compute("fill",this.__leaf),e&&fh.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=Ch)):(this.__isStrokes=!0,this._stroke||(this._stroke=Ch))}__removePaint(t,e){e&&this.__removeInput(t),gh.recycleImage(t,this),"fill"===t?(Sh(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(Sh(this,"__isAlphaPixelStroke",void 0),Sh(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function Lh(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 Ih extends Ph{}class Eh extends Ih{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){return this.__single||this.__clipAfterFill}get __clipAfterFill(){const t=this;return"hide"===t.overflow&&t.__leaf.children.length&&(t.__leaf.isOverflow||super.__clipAfterFill)}}class Ah extends Ih{__getInputData(t,e){const s=super.__getInputData(t,e);return he.forEach(t=>delete s[t]),s}}class Oh extends Eh{}class Mh extends Ph{}class Wh extends Ph{get __boxStroke(){return!this.__pathInputed}}class Dh extends Ph{get __boxStroke(){return!this.__pathInputed}}class Fh extends Ph{}class zh extends Ph{}class Uh extends Ph{get __pathInputed(){return 2}}class Nh extends Ih{}const Yh={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class Xh extends Ph{get __useNaturalRatio(){return!1}setFontWeight(t){a(t)?(this.__setInput("fontWeight",t),t=Yh[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=Gt.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(),o.renderChanged&&r.renderChange(),s.__updateChange()}else s&&(e.__box=s.parent=null,s.destroy());this._boxStyle=t}}class Hh extends Wh{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 Gh extends Wh{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 Vh={__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=Math.max(o.__layout.strokeSpread=o.__updateStrokeSpread(),t),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.__;e&&e.forEach(e=>t=Math.max(t,Math.max(Math.abs(e.y),Math.abs(e.x))+(e.spread>0?e.spread:0)+1.5*e.blur)),i&&(t=Math.max(t,i)),o&&(t+=xh.getSpread(o)),n&&(t+=n);let a=t=Math.ceil(t);return s&&s.forEach(t=>a=Math.max(a,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur)),r&&(a=Math.max(a,r)),this.__layout.renderShapeSpread=a,t+=this.__layout.strokeSpread||0,this.__box?Math.max(this.__box.__updateRenderSpread(),t):t}},{stintSet:jh}=p,qh={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);jh(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),jh(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;jh(t,"__isFastShadow",e&&!r&&e.length<2&&!e[0].spread&&s&&!t.__isTransparentFill&&!(c(s)&&s.length>1)&&(this.useFastShadow||!i||i&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!r)}t.__checkSingle(),jh(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){Qh(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=fh.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=i;l&&mh.shadow(this,t,h),a&&(i.__isStrokes?fh.strokes(o,this,t):fh.stroke(o,this,t)),r&&(i.__isFills?fh.fills(r,this,t):fh.fill(r,this,t)),n&&this.__drawAfterFill(t,e),d&&mh.innerShadow(this,t,h),o&&!a&&(i.__isStrokes?fh.strokes(o,this,t):fh.stroke(o,this,t)),c&&xh.apply(c,this,this.__nowWorld,t,s,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(i.__isStrokes?fh.strokes(o,this,t):fh.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,uh.string(e.color))}r&&(i.__isFills?fh.fills(r,this,t):fh.fill(r,this,t)),h&&t.restore(),n&&this.__drawAfterFill(t,e),o&&!a&&(i.__isStrokes?fh.strokes(o,this,t):fh.stroke(o,this,t))}}else i.__pathInputed?Qh(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?fh.fills(i,this,t):fh.fill("#000000",this,t)),s.__isCanvas&&this.__drawAfterFill(t,e),r&&!e.ignoreStroke&&(s.__isAlphaPixelStroke?fh.strokes(r,this,t):fh.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 Qh(t,e,s){const{fill:i,stroke:r,__drawAfterFill:o,__fillAfterStroke:n}=t.__;t.__drawRenderPath(e),n&&fh.stroke(r,t,e),i&&fh.fill(i,t,e),o&&t.__drawAfterFill(e,s),r&&!n&&fh.stroke(r,t,e)}const Jh={__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 $h,Zh;t.UI=$h=class extends t.Leaf{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){w.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 mr.set(this.path=t||[]),t||this.__drawPathByBox(mr),mr}constructor(t){super(t)}reset(t){}set(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):Object.assign(this,t))}get(t){return a(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return Yt.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return Yt.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let s=e?this.__.__pathForRender:this.__.path;return s||(mr.set(s=[]),this.__drawPathByBox(mr)),t?Is.toCanvasData(s,!0):s}getPathString(t,e,s){return Is.stringify(this.getPath(t,e),s)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||wh.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?yr.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&ph.addArrows(this,!t.cornerRadius)):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?Ei.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){fh.fill(this.__.placeholderColor,this,t)}animate(t,e,s,i){return Yt.need("animate")}killAnimate(t,e){}export(t,e){return Yt.need("export")}syncExport(t,e){return Yt.need("export")}clone(t){const e=p.clone(this.toJSON());return t&&Object.assign(e,t),$h.one(e)}static one(t,e,s,i,r){return Gt.get(t.tag||this.prototype.__tag,t,e,s,i,r)}static registerUI(){bo()(this)}static registerData(t){_o(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}},$t([_o(Ph)],t.UI.prototype,"__",void 0),$t([dh()],t.UI.prototype,"zoomLayer",void 0),$t([Yr("")],t.UI.prototype,"id",void 0),$t([Yr("")],t.UI.prototype,"name",void 0),$t([Yr("")],t.UI.prototype,"className",void 0),$t([so("pass-through")],t.UI.prototype,"blendMode",void 0),$t([io(1)],t.UI.prototype,"opacity",void 0),$t([ro(!0)],t.UI.prototype,"visible",void 0),$t([so(!1)],t.UI.prototype,"locked",void 0),$t([so(!1)],t.UI.prototype,"dim",void 0),$t([so(!1)],t.UI.prototype,"dimskip",void 0),$t([ao(0)],t.UI.prototype,"zIndex",void 0),$t([ho(!1)],t.UI.prototype,"mask",void 0),$t([lo(!1)],t.UI.prototype,"eraser",void 0),$t([Xr(0,!0)],t.UI.prototype,"x",void 0),$t([Xr(0,!0)],t.UI.prototype,"y",void 0),$t([jr(100,!0)],t.UI.prototype,"width",void 0),$t([jr(100,!0)],t.UI.prototype,"height",void 0),$t([Gr(1,!0)],t.UI.prototype,"scaleX",void 0),$t([Gr(1,!0)],t.UI.prototype,"scaleY",void 0),$t([Vr(0,!0)],t.UI.prototype,"rotation",void 0),$t([Vr(0,!0)],t.UI.prototype,"skewX",void 0),$t([Vr(0,!0)],t.UI.prototype,"skewY",void 0),$t([Xr(0,!0)],t.UI.prototype,"offsetX",void 0),$t([Xr(0,!0)],t.UI.prototype,"offsetY",void 0),$t([Xr(0,!0)],t.UI.prototype,"scrollX",void 0),$t([Xr(0,!0)],t.UI.prototype,"scrollY",void 0),$t([Hr()],t.UI.prototype,"origin",void 0),$t([Hr()],t.UI.prototype,"around",void 0),$t([Yr(!1)],t.UI.prototype,"lazy",void 0),$t([qr(1)],t.UI.prototype,"pixelRatio",void 0),$t([eo(0)],t.UI.prototype,"renderSpread",void 0),$t([Jr()],t.UI.prototype,"path",void 0),$t([$r()],t.UI.prototype,"windingRule",void 0),$t([$r(!0)],t.UI.prototype,"closed",void 0),$t([jr(0)],t.UI.prototype,"padding",void 0),$t([jr(!1)],t.UI.prototype,"lockRatio",void 0),$t([jr()],t.UI.prototype,"widthRange",void 0),$t([jr()],t.UI.prototype,"heightRange",void 0),$t([Yr(!1)],t.UI.prototype,"draggable",void 0),$t([Yr()],t.UI.prototype,"dragBounds",void 0),$t([Yr(!1)],t.UI.prototype,"editable",void 0),$t([co(!0)],t.UI.prototype,"hittable",void 0),$t([co("path")],t.UI.prototype,"hitFill",void 0),$t([to("path")],t.UI.prototype,"hitStroke",void 0),$t([co(!1)],t.UI.prototype,"hitBox",void 0),$t([co(!0)],t.UI.prototype,"hitChildren",void 0),$t([co(!0)],t.UI.prototype,"hitSelf",void 0),$t([co()],t.UI.prototype,"hitRadius",void 0),$t([uo("")],t.UI.prototype,"cursor",void 0),$t([so()],t.UI.prototype,"fill",void 0),$t([to(void 0,!0)],t.UI.prototype,"stroke",void 0),$t([to("inside")],t.UI.prototype,"strokeAlign",void 0),$t([to(1,!0)],t.UI.prototype,"strokeWidth",void 0),$t([to(!1)],t.UI.prototype,"strokeWidthFixed",void 0),$t([to("none")],t.UI.prototype,"strokeCap",void 0),$t([to("miter")],t.UI.prototype,"strokeJoin",void 0),$t([to()],t.UI.prototype,"dashPattern",void 0),$t([to(0)],t.UI.prototype,"dashOffset",void 0),$t([to(10)],t.UI.prototype,"miterLimit",void 0),$t([$r(0)],t.UI.prototype,"cornerRadius",void 0),$t([$r()],t.UI.prototype,"cornerSmoothing",void 0),$t([hh()],t.UI.prototype,"shadow",void 0),$t([hh()],t.UI.prototype,"innerShadow",void 0),$t([hh()],t.UI.prototype,"blur",void 0),$t([hh()],t.UI.prototype,"backgroundBlur",void 0),$t([hh()],t.UI.prototype,"grayscale",void 0),$t([hh()],t.UI.prototype,"filter",void 0),$t([so()],t.UI.prototype,"placeholderColor",void 0),$t([Yr(100)],t.UI.prototype,"placeholderDelay",void 0),$t([Yr({})],t.UI.prototype,"data",void 0),$t([mo(t.Leaf.prototype.reset)],t.UI.prototype,"reset",null),t.UI=$h=$t([vo(Vh),vo(qh),xo()],t.UI),t.Group=class extends t.UI{get __tag(){return"Group"}get isBranch(){return!0}constructor(t){super(t)}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(){}},$t([_o(Ih)],t.Group.prototype,"__",void 0),$t([jr(0)],t.Group.prototype,"width",void 0),$t([jr(0)],t.Group.prototype,"height",void 0),t.Group=$t([vo(t.Branch),bo()],t.Group);const Kh=Mt.get("Leafer");t.Leafer=Zh=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&&Cr.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),Zh.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=Xt.canvas(i);this.__controllers.push(this.renderer=Xt.renderer(this,r,i),this.watcher=Xt.watcher(this,i),this.layouter=Xt.layouter(this,i)),this.isApp&&this.__setApp(),this.__checkAutoLayout(i,e),this.view=r.view,e||(this.selector=Xt.selector(this),this.interaction=Xt.interaction(this,r,this.selector,i),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=Xt.hitCanvasManager()),this.canvasManager=new Jt,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))),Jo.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(bn.RESTART):this.emitLeafer(bn.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(bn.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=p.copyAttrs({},t,he);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:s}=this;s&&(s.addBlock(t?new Lt(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,he);e.resize(t),this.updateLazyBounds(),this.__onResize(new mn(t,s))}__onResize(t){this.emitEvent(t),p.copyAttrs(this.__,t,he),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(t,e){e||(t.width&&t.height||(this.autoLayout=new Et(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(he.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()))),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&he.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const s=p.copyAttrs({},this.canvas,he);s[t]=this.config[t]=e,e&&this.canvas.stopAutoLayout(),this.__doResize(s)}__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(bn.BEFORE_READY),this.emitLeafer(bn.READY),this.emitLeafer(bn.AFTER_READY),Jo.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(bn.VIEW_READY),Jo.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){Jo.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(bn.VIEW_COMPLETED),Jo.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 Yt.need("view")}getValidMove(t,e){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 bn(t,this))}__listenEvents(){const t=zt.start("FirstCreate "+this.innerName);this.once([[bn.START,()=>zt.end(t)],[wn.START,this.updateLazyBounds,this],[vn.START,this.__onCreated,this],[vn.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[xn.DATA,this.__onWatchData,this],[wn.END,this.__onLayoutEnd,this],[vn.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Zh.list.remove(this);try{this.stop(),this.emitLeafer(bn.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.destroy()),this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{Pr.clearRecycled()},100)}catch(t){Kh.error(t)}}};t?e():setTimeout(e)}},t.Leafer.list=new Ua,$t([_o(Ah)],t.Leafer.prototype,"__",void 0),$t([jr()],t.Leafer.prototype,"pixelRatio",void 0),t.Leafer=Zh=$t([bo()],t.Leafer),t.Rect=class extends t.UI{get __tag(){return"Rect"}constructor(t){super(t)}},$t([_o(Wh)],t.Rect.prototype,"__",void 0),t.Rect=$t([vo(Jh),xo(),bo()],t.Rect);const{copy:tl,add:el,includes:sl}=Rt,il=t.Rect.prototype,rl=t.Group.prototype,ol={};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;if(this.children.length){const e=this.__,{renderBounds:s,boxBounds:i}=this.__layout;super.__updateRenderBounds(),tl(ol,s),this.__updateRectRenderBounds(),(e.scrollY||e.scrollX)&&(ol.x+=e.scrollX,ol.y+=e.scrollY),t=!sl(i,ol),t&&"hide"!==e.overflow&&el(s,ol)}else this.__updateRectRenderBounds();p.stintSet(this,"isOverflow",t),this.__updateScrollBar()}__updateRectRenderBounds(){}__updateScrollBar(){}__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.scrollBar&&this.scrollBar.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}},$t([_o(Eh)],t.Box.prototype,"__",void 0),$t([jr(100)],t.Box.prototype,"width",void 0),$t([jr(100)],t.Box.prototype,"height",void 0),$t([Yr(!1)],t.Box.prototype,"resizeChildren",void 0),$t([eo("show")],t.Box.prototype,"overflow",void 0),$t([mo(il.__updateStrokeSpread)],t.Box.prototype,"__updateStrokeSpread",null),$t([mo(il.__updateRenderSpread)],t.Box.prototype,"__updateRectRenderSpread",null),$t([mo(il.__updateBoxBounds)],t.Box.prototype,"__updateRectBoxBounds",null),$t([mo(il.__updateStrokeBounds)],t.Box.prototype,"__updateStrokeBounds",null),$t([mo(il.__updateRenderBounds)],t.Box.prototype,"__updateRectRenderBounds",null),$t([mo(il.__updateChange)],t.Box.prototype,"__updateRectChange",null),$t([mo(il.__render)],t.Box.prototype,"__renderRect",null),$t([mo(rl.__render)],t.Box.prototype,"__renderGroup",null),t.Box=$t([xo(),bo()],t.Box),t.Frame=class extends t.Box{get __tag(){return"Frame"}get isFrame(){return!0}constructor(t){super(t)}},$t([_o(Oh)],t.Frame.prototype,"__",void 0),$t([so("#FFFFFF")],t.Frame.prototype,"fill",void 0),$t([eo("hide")],t.Frame.prototype,"overflow",void 0),t.Frame=$t([bo()],t.Frame);const{moveTo:nl,closePath:al,ellipse:hl}=ti;t.Ellipse=class extends t.UI{get __tag(){return"Ellipse"}constructor(t){super(t)}__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&&hl(h,n,a,n*i,a*i,0,r,o,!1),hl(h,n,a,n,a,0,o,r,!0),i<1&&al(h)):(i<1&&(hl(h,n,a,n*i,a*i),nl(h,t,a)),hl(h,n,a,n,a,0,360,0,!0)),e.ellipseToCurve&&(this.__.path=this.getPath(!0))):r||o?(nl(h,n,a),hl(h,n,a,n,a,0,r,o,!1),al(h)):hl(h,n,a,n,a)}},$t([_o(Dh)],t.Ellipse.prototype,"__",void 0),$t([$r(0)],t.Ellipse.prototype,"innerRadius",void 0),$t([$r(0)],t.Ellipse.prototype,"startAngle",void 0),$t([$r(0)],t.Ellipse.prototype,"endAngle",void 0),t.Ellipse=$t([bo()],t.Ellipse);const{moveTo:ll,lineTo:dl,drawPoints:cl}=ti,{rotate:ul,getAngle:_l,getDistance:pl,defaultPoint:fl}=V,{toBounds:gl}=dr;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&&ul(s,e),s}set toPoint(t){this.width=pl(fl,t),this.rotation=_l(fl,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__,e=t.path=[];t.points?cl(e,t.points,!1,t.closed):(ll(e,0,0),dl(e,this.width,0))}__updateRenderPath(){const t=this.__;!this.pathInputed&&t.points&&t.curve?(cl(t.__pathForRender=[],t.points,t.curve,t.closed),t.__useArrow&&ph.addArrows(this,!1)):super.__updateRenderPath()}__updateBoxBounds(){this.points?gl(this.__.__pathForRender,this.__layout.boxBounds):super.__updateBoxBounds()}},$t([_o(Mh)],t.Line.prototype,"__",void 0),$t([Zr("center")],t.Line.prototype,"strokeAlign",void 0),$t([jr(0)],t.Line.prototype,"height",void 0),$t([$r()],t.Line.prototype,"points",void 0),$t([$r(0)],t.Line.prototype,"curve",void 0),$t([$r(!1)],t.Line.prototype,"closed",void 0),t.Line=$t([bo()],t.Line);const{sin:yl,cos:ml,PI:xl}=Math,{moveTo:wl,lineTo:vl,closePath:bl,drawPoints:Bl}=ti,kl=t.Line.prototype;t.Polygon=class extends t.UI{get __tag(){return"Polygon"}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];if(this.__.points)Bl(t,this.__.points,!1,!0);else{const{width:e,height:s,sides:i}=this.__,r=e/2,o=s/2;wl(t,r,0);for(let e=1;e<i;e++)vl(t,r+r*yl(2*e*xl/i),o-o*ml(2*e*xl/i));bl(t)}}__updateRenderPath(){}__updateBoxBounds(){}},$t([_o(Fh)],t.Polygon.prototype,"__",void 0),$t([$r(3)],t.Polygon.prototype,"sides",void 0),$t([$r()],t.Polygon.prototype,"points",void 0),$t([$r(0)],t.Polygon.prototype,"curve",void 0),$t([mo(kl.__updateRenderPath)],t.Polygon.prototype,"__updateRenderPath",null),$t([mo(kl.__updateBoxBounds)],t.Polygon.prototype,"__updateBoxBounds",null),t.Polygon=$t([xo(),bo()],t.Polygon);const{sin:Sl,cos:Rl,PI:Cl}=Math,{moveTo:Tl,lineTo:Pl,closePath:Ll}=ti;t.Star=class extends t.UI{get __tag(){return"Star"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,corners:s,innerRadius:i}=this.__,r=t/2,o=e/2,n=this.__.path=[];Tl(n,r,0);for(let t=1;t<2*s;t++)Pl(n,r+(t%2==0?r:r*i)*Sl(t*Cl/s),o-(t%2==0?o:o*i)*Rl(t*Cl/s));Ll(n)}},$t([_o(zh)],t.Star.prototype,"__",void 0),$t([$r(5)],t.Star.prototype,"corners",void 0),$t([$r(.382)],t.Star.prototype,"innerRadius",void 0),t.Star=$t([bo()],t.Star),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}constructor(t){super(t)}},$t([_o(Hh)],t.Image.prototype,"__",void 0),$t([jr("")],t.Image.prototype,"url",void 0),t.Image=$t([bo()],t.Image);const Il=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=Xt.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new Mr({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new cn(cn.LOADED,{image:t}))})}draw(t,e,s,i){const r=new K(t.worldTransform).invert(),o=new K;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()}},$t([_o(Gh)],t.Canvas.prototype,"__",void 0),$t([lh(100)],t.Canvas.prototype,"width",void 0),$t([lh(100)],t.Canvas.prototype,"height",void 0),$t([lh(1)],t.Canvas.prototype,"pixelRatio",void 0),$t([lh(!0)],t.Canvas.prototype,"smooth",void 0),$t([Yr(!1)],t.Canvas.prototype,"safeResize",void 0),$t([lh()],t.Canvas.prototype,"contextSettings",void 0),t.Canvas=$t([bo()],t.Canvas);const{copyAndSpread:El,includes:Al,spread:Ol,setList:Ml}=Rt;function Wl(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 Dl(t,e){t.__.__font?Wl(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Fl(t,e,s){switch(e.__.strokeAlign){case"center":zl(t,1,e,s);break;case"inside":Ul(t,"inside",e,s);break;case"outside":e.__.__fillAfterStroke?zl(t,2,e,s):Ul(t,"outside",e,s)}}function zl(t,e,s,i){const r=s.__;u(t)?Yl(t,e,!0,s,i):(i.setStroke(t,r.__strokeWidth*e,r),Nl(s,i))}function Ul(t,e,s,i){const r=i.getSameCanvas(!0,!0);r.font=s.__.__font,zl(t,2,s,r),r.blendMode="outside"===e?"destination-out":"destination-in",Wl(s,r),r.blendMode="normal",Oo.copyCanvasByWorld(s,i,r),r.recycle(s.__nowWorld)}function Nl(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 Yl(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||!gh.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?Nl(i,r):r.stroke(),r.restoreBlendMode()):s?Nl(i,r):r.stroke()}}function Xl(t,e,s){const i=e.__;if(i.__strokeWidth)if(i.__font)Fl(t,e,s);else switch(i.strokeAlign){case"center":Hl(t,1,e,s);break;case"inside":!function(t,e,s){s.save(),s.clipUI(e),Hl(t,2,e,s),s.restore()}(t,e,s);break;case"outside":!function(t,e,s){const i=e.__;if(i.__fillAfterStroke)Hl(t,2,e,s);else{const{renderBounds:r}=e.__layout,o=s.getSameCanvas(!0,!0);e.__drawRenderPath(o),Hl(t,2,e,o),o.clipUI(i),o.clearWorld(r),Oo.copyCanvasByWorld(e,s,o),o.recycle(e.__nowWorld)}}(t,e,s)}}function Hl(t,e,s,i){const r=s.__;u(t)?Yl(t,e,!1,s,i):(i.setStroke(t,r.__strokeWidth*e,r),i.stroke()),r.__useArrow&&fh.strokeArrow(t,s,i)}t.Text=class extends t.UI{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}constructor(t){super(t)}__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=_h.number(e,r),t.__letterSpacing=_h.number(s,r),t.__padding=l?w.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=ch.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&&Ol(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",!Al(h,a)),this.isOverflow?(Ml(t.__textBoxBounds={},[h,a]),e.renderChanged=!0):t.__textBoxBounds=h}__onUpdateSize(){this.__box&&this.__box.__onUpdateSize(),super.__onUpdateSize()}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;El(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__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()}},$t([_o(Xh)],t.Text.prototype,"__",void 0),$t([jr(0)],t.Text.prototype,"width",void 0),$t([jr(0)],t.Text.prototype,"height",void 0),$t([so()],t.Text.prototype,"boxStyle",void 0),$t([Yr(!1)],t.Text.prototype,"resizeFontSize",void 0),$t([so("#000000")],t.Text.prototype,"fill",void 0),$t([Zr("outside")],t.Text.prototype,"strokeAlign",void 0),$t([co("all")],t.Text.prototype,"hitFill",void 0),$t([jr("")],t.Text.prototype,"text",void 0),$t([jr("")],t.Text.prototype,"placeholder",void 0),$t([jr("caption")],t.Text.prototype,"fontFamily",void 0),$t([jr(12)],t.Text.prototype,"fontSize",void 0),$t([jr("normal")],t.Text.prototype,"fontWeight",void 0),$t([jr(!1)],t.Text.prototype,"italic",void 0),$t([jr("none")],t.Text.prototype,"textCase",void 0),$t([jr("none")],t.Text.prototype,"textDecoration",void 0),$t([jr(0)],t.Text.prototype,"letterSpacing",void 0),$t([jr({type:"percent",value:1.5})],t.Text.prototype,"lineHeight",void 0),$t([jr(0)],t.Text.prototype,"paraIndent",void 0),$t([jr(0)],t.Text.prototype,"paraSpacing",void 0),$t([jr("x")],t.Text.prototype,"writingMode",void 0),$t([jr("left")],t.Text.prototype,"textAlign",void 0),$t([jr("top")],t.Text.prototype,"verticalAlign",void 0),$t([jr(!0)],t.Text.prototype,"autoSizeAlign",void 0),$t([jr("normal")],t.Text.prototype,"textWrap",void 0),$t([jr("show")],t.Text.prototype,"textOverflow",void 0),$t([so(!1)],t.Text.prototype,"textEditing",void 0),t.Text=$t([bo()],t.Text),t.Path=class extends t.UI{get __tag(){return"Path"}constructor(t){super(t)}},$t([_o(Uh)],t.Path.prototype,"__",void 0),$t([Zr("center")],t.Path.prototype,"strokeAlign",void 0),t.Path=$t([bo()],t.Path),t.Pen=class extends t.Group{get __tag(){return"Pen"}constructor(t){super(t)}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")}},$t([_o(Nh)],t.Pen.prototype,"__",void 0),$t([(t,e)=>{Wr(t,e,{get(){return this.__path}})}],t.Pen.prototype,"path",void 0),t.Pen=$t([vo(yi,["set","path","paint"]),bo()],t.Pen);const{getSpread:Gl,getOuterOf:Vl,getByMove:jl,getIntersectData:ql}=Rt;let Ql;const{stintSet:Jl}=p,{hasTransparent:$l}=uh;function Zl(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=gh.image(s,t,e,r,!Ql||!Ql[e.url]);break;case"linear":i=yh.linearGradient(e,r);break;case"radial":i=yh.radialGradient(e,r);break;case"angular":i=yh.conicGradient(e,r);break;case"solid":const{type:n,color:a,opacity:h}=e;i={type:n,style:uh.string(a,h)};break;default:o(e.r)||(i={type:"solid",style:uh.string(e)})}if(i){if(a(i.style)&&$l(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 Kl={compute:function(t,e){const s=e.__,i=[];let r,o,n,a=s.__input[t];c(a)||(a=[a]),Ql=gh.recycleImage(t,s);for(let s,r=0,o=a.length;r<o;r++)(s=Zl(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?(Jl(s,"__isAlphaPixelFill",r),Jl(s,"__isTransparentFill",o)):(Jl(s,"__isAlphaPixelStroke",r),Jl(s,"__isTransparentStroke",o),Jl(s,"__hasMultiStrokeStyle",n))},fill:function(t,e,s){s.fillStyle=t,Dl(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(gh.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),Dl(e,s),s.restore()}else i.blendMode?(s.saveBlendMode(i.blendMode),Dl(e,s),s.restoreBlendMode()):Dl(e,s)}},fillPathOrText:Dl,fillText:Wl,stroke:Xl,strokes:function(t,e,s){Xl(t,e,s)},strokeText:Fl,drawTextStroke:Nl,shape:function(t,s,i){const r=s.getSameCanvas(),o=t.__nowWorld,n=s.bounds;let a,h,l,d,c,{scaleX:u,scaleY:_}=t.getRenderScaleData(!0);if(n.includes(o))c=r,a=d=o;else{const{renderShapeSpread:r}=t.__layout;let p;if(e.fullImageShadow)p=o;else{const t=r?Gl(n,u===_?r*u:[r*_,r*u]):n;p=ql(t,o)}l=n.getFitMatrix(p);let{a:f,d:g}=l;l.a<1&&(c=s.getSameCanvas(),t.__renderShape(c,i),u*=f,_*=g),d=Vl(o,l),a=jl(d,-l.e,-l.f);const y=i.matrix;y?(h=new K(l),h.multiply(y),f*=y.scaleX,g*=y.scaleY):h=l,h.withScale(f,g),i=Object.assign(Object.assign({},i),{matrix:h})}return t.__renderShape(r,i),{canvas:r,matrix:h,fitMatrix:l,bounds:a,worldCanvas:c,shapeBounds:d,scaleX:u,scaleY:_}}};let td={},ed={a:1,b:0,c:0,d:1,e:0,f:0};const{get:sd,rotateOfOuter:id,translate:rd,scaleOfOuter:od,multiplyParent:nd,scale:ad,rotate:hd,skew:ld}=M;function dd(t,e,s,i,r,o,n){const a=sd();rd(a,e.x+s,e.y+i),ad(a,r,o),n&&id(a,{x:e.x+e.width/2,y:e.y+e.height/2},n),t.transform=a}function cd(t,e,s,i,r,o,n,a,h){const l=sd();_d(l,e,s,i,r,o,n,a),h&&(ed.a=e.width/h.width,ed.d=e.height/h.height,nd(l,ed)),t.transform=l}function ud(t,e,s,i,r,o,n,a,h,l,d,c){const u=sd();if(c)_d(u,e,r,o,n,a,h,l);else{if(h)if("center"===d)id(u,{x:s/2,y:i/2},h);else switch(hd(u,h),h){case 90:rd(u,i,0);break;case 180:rd(u,s,i);break;case 270:rd(u,0,s)}td.x=e.x+r,td.y=e.y+o,rd(u,td.x,td.y),n&&od(u,td,n,a)}t.transform=u}function _d(t,e,s,i,r,o,n,a){n&&hd(t,n),a&&ld(t,a.x,a.y),r&&ad(t,r,o),rd(t,e.x+s,e.y+i)}const{get:pd,translate:fd}=M,gd=new Lt,yd={},md={};function xd(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=wd(s,i,e)}function wd(t,e,s){t.padding&&(e=gd.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,v={mode:n},b="center"!==h&&(_||0)%180==90;let B,k;switch(Rt.set(md,0,0,b?r:i,b?i:r),n&&"cover"!==n&&"fit"!==n?((d||c)&&(w.getScaleData(d,c,s,yd),B=yd.scaleX,k=yd.scaleY),(h||y||g)&&(B&&Rt.scale(md,B,k,!0),h&<.toPoint(h,md,e,md,!0,!0))):x&&!_||(B=k=Rt.getFitScale(e,md,"fit"!==n),Rt.put(e,s,h,B,!1,md),Rt.scale(md,B,k,!0)),l&&V.move(md,l),n){case"stretch":x||(i=e.width,r=e.height);break;case"normal":case"clip":(md.x||md.y||B||f||_||p)&&cd(v,e,md.x,md.y,B,k,_,p,t.clipSize);break;case"repeat":(!x||B||_||p)&&ud(v,e,i,r,md.x,md.y,B,k,_,p,h,t.freeTransform),g||(v.repeat="repeat");const s=u(g);(y||s)&&(v.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,md.width,md.height,e));break;default:B&&dd(v,e,md.x,md.y,B,k,_)}return v.transform||(e.x||e.y)&&(v.transform=pd(),fd(v.transform,e.x,e.y)),B&&"stretch"!==n&&(v.scaleX=B,v.scaleY=k),v.width=i,v.height=r,o&&(v.opacity=o),m&&(v.filters=m),g&&(v.repeat=a(g)?"x"===g?"repeat-x":"repeat-y":"repeat"),v}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 bd,Bd=new Lt;const{isSame:kd}=Rt;function Sd(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||xd(r,i,s,o),!0}function Rd(t,e){Pd(t,cn.LOAD,e)}function Cd(t,e){Pd(t,cn.LOADED,e)}function Td(t,e,s){e.error=s,t.forceUpdate("surface"),Pd(t,cn.ERROR,e)}function Pd(t,e,s){t.hasEvent(e)&&t.emitEvent(new cn(e,s))}function Ld(t,e){const{leafer:s}=t;s&&s.viewReady&&(s.renderer.ignore=e)}const{get:Id,scale:Ed,copy:Ad}=M,{floor:Od,max:Md,abs:Wd}=Math;function Dd(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:t,data:a}=s;let h,l,{width:d,height:c,scaleX:u,scaleY:_,transform:p,repeat:f,gap:g}=a;r*=i,o*=i;const y=g&&g.x*r,m=g&&g.y*o;u&&(u=Wd(u),_=Wd(_),l=Id(),Ad(l,p),Ed(l,1/u,1/_),r*=u,o*=_),d*=r,c*=o;const x=d*c;if(!f&&x>e.image.maxCacheSize)return!1;let w=e.image.maxPatternSize;if(!t.isSVG){const e=t.width*t.height;w>e&&(w=e)}if(x>w&&(h=Math.sqrt(x/w)),h&&(r/=h,o/=h,d/=h,c/=h),u&&(r/=u,o/=_),(p||1!==r||1!==o)&&(l||(l=Id(),p&&Ad(l,p)),Ed(l,1/r,1/o)),l){const t=d+(y||0),e=c+(m||0);Ed(l,t/Md(Od(t),1),e/Md(Od(e),1))}const v=t.getCanvas(d,c,a.opacity,a.filters,y,m),b=t.getPattern(v,f||e.origin.noRepeat||"no-repeat",l,s);return s.style=b,s.patternId=n,!0}}const Fd={image:function(t,e,s,i,r){let o,n;const a=Pr.get(s);return bd&&s===bd.paint&&kd(i,bd.boxBounds)?o=bd.leafPaint:(o={type:s.type,image:a},a.hasAlphaPixel&&(o.isTransparent=!0),bd=a.use>1?{leafPaint:o,paint:s,boxBounds:Bd.set(i)}:null),(r||a.loading)&&(n={image:a,attrName:e,attrValue:s}),a.ready?(Sd(t,e,s,a,o,i),r&&(Rd(t,n),Cd(t,n))):a.error?r&&Td(t,n,a.error):(r&&(Ld(t,!0),Rd(t,n)),o.loadId=a.load(()=>{Ld(t,!1),t.destroyed||(Sd(t,e,s,a,o,i)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Cd(t,n)),o.loadId=void 0},e=>{Ld(t,!1),Td(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&&!wh.running)return!1;if(r)if(h.repeat)r=!1;else if(!(i.changeful||"miniapp"===e.name&&mn.isResizing(t)||wh.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||wh.running?Dd(t,i,a):i.patternTask||(i.patternTask=Pr.patternTasker.add(()=>Zt(this,void 0,void 0,function*(){i.patternTask=null,s.bounds.hit(t.__nowWorld)&&Dd(t,i,a),t.forceUpdate("surface")}),300)),!1)},createPattern:Dd,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,Pr.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:xd,getPatternData:wd,fillOrFitMode:dd,clipMode:cd,repeatMode:ud},{toPoint:zd}=nt,{hasTransparent:Ud}=uh,Nd={},Yd={};function Xd(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=uh.string(r,i)):(n=r.offset,o=uh.string(r.color,i)),e.addColorStop(n,o),!h&&Ud(o)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:Hd,getDistance:Gd}=V,{get:Vd,rotateOfOuter:jd,scaleOfOuter:qd}=M,{toPoint:Qd}=nt,Jd={},$d={};function Zd(t,e,s,i,r){let o;const{width:n,height:a}=t;if(n!==a||i){const t=Hd(e,s);o=Vd(),r?(qd(o,e,n/a*(i||1),1),jd(o,e,t+90)):(qd(o,e,1,n/a*(i||1)),jd(o,e,t))}return o}const{getDistance:Kd}=V,{toPoint:tc}=nt,ec={},sc={};const ic={linearGradient:function(t,s){let{from:i,to:r,type:o,opacity:n}=t;zd(i||"top",s,Nd),zd(r||"bottom",s,Yd);const a=e.canvas.createLinearGradient(Nd.x,Nd.y,Yd.x,Yd.y),h={type:o,style:a};return Xd(h,a,t.stops,n),h},radialGradient:function(t,s){let{from:i,to:r,type:o,opacity:n,stretch:a}=t;Qd(i||"center",s,Jd),Qd(r||"bottom",s,$d);const h=e.canvas.createRadialGradient(Jd.x,Jd.y,0,Jd.x,Jd.y,Gd(Jd,$d)),l={type:o,style:h};Xd(l,h,t.stops,n);const d=Zd(s,Jd,$d,a,!0);return d&&(l.transform=d),l},conicGradient:function(t,s){let{from:i,to:r,type:o,opacity:n,stretch:a}=t;tc(i||"center",s,ec),tc(r||"bottom",s,sc);const h=e.conicGradientSupport?e.canvas.createConicGradient(0,ec.x,ec.y):e.canvas.createRadialGradient(ec.x,ec.y,0,ec.x,ec.y,Kd(ec,sc)),l={type:o,style:h};Xd(l,h,t.stops,n);const d=Zd(s,ec,sc,a||1,e.conicGradientRotate90);return d&&(l.transform=d),l},getTransform:Zd},{copy:rc,toOffsetOutBounds:oc}=Rt,nc={},ac={};function hc(t,s,i,r){const{bounds:o,shapeBounds:n}=r;if(e.fullImageShadow){if(rc(nc,t.bounds),nc.x+=s.x-n.x,nc.y+=s.y-n.y,i){const{fitMatrix:t}=r;nc.x-=(o.x+(t?t.e:0)+o.width/2)*(i-1),nc.y-=(o.y+(t?t.f:0)+o.height/2)*(i-1),nc.width*=i,nc.height*=i}t.copyWorld(r.canvas,t.bounds,nc)}else i&&(rc(nc,s),nc.x-=s.width/2*(i-1),nc.y-=s.height/2*(i-1),nc.width*=i,nc.height*=i),t.copyWorld(r.canvas,n,i?nc:s)}const{toOffsetOutBounds:lc}=Rt,dc={};const cc={shadow:function(t,e,s){let i,r;const{__nowWorld:o,__layout:n}=t,{shadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=s,_=e.getSameCanvas(),p=a.length-1;oc(l,ac),a.forEach((a,f)=>{let g=1;if(a.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(g=1/t)}_.setWorldShadow(ac.offsetX+a.x*c*g,ac.offsetY+a.y*u*g,a.blur*c*g,uh.string(a.color)),r=a.spread?1+2*a.spread/(n.boxBounds.width+2*(n.strokeBoxSpread||0))*g:0,hc(_,ac,r,s),i=l,a.box&&(_.restore(),_.save(),h&&(_.copyWorld(_,l,o,"copy"),i=o),h?_.copyWorld(h,o,o,"destination-out"):_.copyWorld(s.canvas,d,l,"destination-out")),Oo.copyCanvasByWorld(t,e,_,i,a.blendMode),p&&f<p&&_.clearWorld(i,!0)}),_.recycle(i)},innerShadow:function(t,e,s){let i,r;const{__nowWorld:o,__layout:n}=t,{innerShadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=s,_=e.getSameCanvas(),p=a.length-1;lc(l,dc),a.forEach((a,f)=>{let g=1;if(a.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(g=1/t)}_.save(),_.setWorldShadow(dc.offsetX+a.x*c*g,dc.offsetY+a.y*u*g,a.blur*c*g),r=a.spread?1-2*a.spread/(n.boxBounds.width+2*(n.strokeBoxSpread||0))*g:0,hc(_,dc,r,s),_.restore(),h?(_.copyWorld(_,l,o,"copy"),_.copyWorld(h,o,o,"source-out"),i=o):(_.copyWorld(s.canvas,d,l,"source-out"),i=l),_.fillWorld(i,uh.string(a.color),"source-in"),Oo.copyCanvasByWorld(t,e,_,i,a.blendMode),p&&f<p&&_.clearWorld(i,!0)}),_.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){}},{excludeRenderBounds:uc}=Yo;let _c;function pc(t,e,s,i,r,o,n,a){switch(e){case"grayscale":_c||(_c=!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);gc(t,e,s,1,r,o)}(t,s,i,r,n,a);break;case"opacity-path":gc(t,s,i,o,n,a);break;case"path":a&&s.restore()}}function fc(t){return t.getSameCanvas(!1,!0)}function gc(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,!0)}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&&(pc(this,n,t,r,i,o,void 0,!0),i=r=null),o=s.__.opacity,_c=!1,"path"===a||"clipping-path"===a?(o<1?(n="opacity-path",r||(r=fc(t))):(n="path",t.save()),s.__clip(r||t,e)):(n="grayscale"===a?"grayscale":"alpha",i||(i=fc(t)),r||(r=fc(t)),s.__render(i,e)),"clipping"!==a&&"clipping-path"!==a||uc(s,e)||s.__render(t,e);continue}const d=1===o&&s.__.__blendMode;d&&pc(this,n,t,r,i,o,void 0,!1),uc(s,e)||s.__render(r||t,e),d&&pc(this,n,t,r,i,o,d,!1)}pc(this,n,t,r,i,o,void 0,!0)};const yc=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",mc=yc+"_#~&*+\\=|≮≯≈≠=…",xc=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 wc(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const vc=wc("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),bc=wc("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Bc=wc(yc),kc=wc(mc),Sc=wc("- —/~|┆·");var Rc;!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"}(Rc||(Rc={}));const{Letter:Cc,Single:Tc,Before:Pc,After:Lc,Symbol:Ic,Break:Ec}=Rc;function Ac(t){return vc[t]?Cc:Sc[t]?Ec:bc[t]?Pc:Bc[t]?Lc:kc[t]?Ic:xc.test(t)?Tc:Cc}const Oc={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 Mc(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:Wc}=Oc,{Letter:Dc,Single:Fc,Before:zc,After:Uc,Symbol:Nc,Break:Yc}=Rc;let Xc,Hc,Gc,Vc,jc,qc,Qc,Jc,$c,Zc,Kc,tu,eu,su,iu,ru,ou,nu=[];function au(t,e){$c&&!Jc&&(Jc=$c),Xc.data.push({char:t,width:e}),Gc+=e}function hu(){Vc+=Gc,Xc.width=Gc,Hc.words.push(Xc),Xc={data:[]},Gc=0}function lu(){su&&(iu.paraNumber++,Hc.paraStart=!0,su=!1),$c&&(Hc.startCharSize=Jc,Hc.endCharSize=$c,Jc=0),Hc.width=Vc,ru.width?Wc(Hc):ou&&du(),nu.push(Hc),Hc={words:[]},Vc=0}function du(){Vc>(iu.maxWidth||0)&&(iu.maxWidth=Vc)}const{top:cu,right:uu,bottom:_u,left:pu}=t.Direction4;function fu(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 gu={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[pu],o-=d[uu]+d[pu]):s.autoSizeAlign||(i=d[pu]),n?(r=d[cu],n-=d[cu]+d[_u]):s.autoSizeAlign||(r=d[cu]));const c={bounds:{x:i,y:r,width:o,height:n},rows:[],paraNumber:0,font:e.canvas.font=l};return function(t,s,i){iu=t,nu=t.rows,ru=t.bounds,ou=!ru.width&&!i.autoSizeAlign;const{__letterSpacing:r,paraIndent:o,textCase:n}=i,{canvas:a}=e,{width:h,height:l}=ru;if(h||l||r||"none"!==n){const t="none"!==i.textWrap,e="break"===i.textWrap;su=!0,Kc=null,Jc=Qc=$c=Gc=Vc=0,Xc={data:[]},Hc={words:[]},r&&(s=[...s]);for(let i=0,l=s.length;i<l;i++)qc=s[i],"\n"===qc?(Gc&&hu(),Hc.paraEnd=!0,lu(),su=!0):(Zc=Ac(qc),Zc===Dc&&"none"!==n&&(qc=Mc(qc,n,!Gc)),Qc=a.measureText(qc).width,r&&(r<0&&($c=Qc),Qc+=r),tu=Zc===Fc&&(Kc===Fc||Kc===Dc)||Kc===Fc&&Zc!==Uc,eu=!(Zc!==zc&&Zc!==Fc||Kc!==Nc&&Kc!==Uc),jc=su&&o?h-o:h,t&&h&&Vc+Gc+Qc>jc&&(e?(Gc&&hu(),Vc&&lu()):(eu||(eu=Zc===Dc&&Kc==Uc),tu||eu||Zc===Yc||Zc===zc||Zc===Fc||Gc+Qc>jc?(Gc&&hu(),Vc&&lu()):Vc&&lu()))," "===qc&&!0!==su&&Vc+Gc===0||(Zc===Yc?(" "===qc&&Gc&&hu(),au(qc,Qc),hu()):tu||eu?(Gc&&hu(),au(qc,Qc)):au(qc,Qc)),Kc=Zc);Gc&&hu(),Vc&&lu(),nu.length>0&&(nu[nu.length-1].paraEnd=!0)}else s.split("\n").forEach(t=>{iu.paraNumber++,Vc=a.measureText(t).width,nu.push({x:o||0,text:t,width:Vc,paraStart:!0}),ou&&du()})}(c,t,s),d&&function(t,e,s,i,r){if(!i&&s.autoSizeAlign)switch(s.textAlign){case"left":fu(e,"x",t[pu]);break;case"right":fu(e,"x",-t[uu])}if(!r&&s.autoSizeAlign)switch(s.verticalAlign){case"top":fu(e,"y",t[cu]);break;case"bottom":fu(e,"y",-t[_u])}}(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;const{fontSize:i,textDecoration:r}=e;switch(t.decorationHeight=i/11,u(r)?(s=r.type,r.color&&(t.decorationColor=uh.string(r.color))):s=r,s){case"under":t.decorationY=[.15*i];break;case"delete":t.decorationY=[.35*-i];break;case"under-delete":t.decorationY=[.15*i,.35*-i]}}(c,s),c}};const yu={string:function(t,e){const s=l(e)&&e<1;if(a(t)){if(!s||!uh.object)return t;t=uh.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(ch,gu),Object.assign(uh,yu),Object.assign(fh,Kl),Object.assign(gh,Fd),Object.assign(yh,ic),Object.assign(mh,cc),Va(),t.AlignHelper=lt,t.AroundHelper=nt,t.AutoBounds=Et,t.BezierHelper=Fe,t.Bounds=Lt,t.BoundsEvent=un,t.BoundsHelper=Rt,t.BoxData=Eh,t.BranchHelper=Vo,t.BranchRender=na,t.CanvasData=Gh,t.CanvasManager=Jt,t.ChildEvent=ln,t.ColorConvert=uh,t.Creator=Xt,t.DataHelper=p,t.Debug=Mt,t.Effect=mh,t.EllipseData=Dh,t.EllipseHelper=je,t.Event=hn,t.EventCreator=qt,t.Eventer=Pn,t.Export=wh,t.FileHelper=vr,t.Filter=xh,t.FrameData=Oh,t.GroupData=Ih,t.ImageData=Hh,t.ImageEvent=cn,t.ImageManager=Pr,t.IncrementId=s,t.LayoutEvent=wn,t.Layouter=oh,t.LeafBounds=ia,t.LeafBoundsHelper=Yo,t.LeafData=g,t.LeafDataProxy=Yn,t.LeafEventer=Un,t.LeafHelper=Oo,t.LeafLayout=an,t.LeafLevelList=Na,t.LeafList=Ua,t.LeafMatrix=Qn,t.LeafRender=ra,t.LeaferCanvas=Xa,t.LeaferCanvasBase=le,t.LeaferData=Ah,t.LeaferEvent=bn,t.LeaferImage=Mr,t.LineData=Mh,t.MathHelper=w,t.Matrix=K,t.MatrixHelper=M,t.MyImage=Il,t.NeedConvertToCanvasCommandMap=pe,t.OneRadian=b,t.PI2=B,t.PI_2=k,t.Paint=fh,t.PaintGradient=yh,t.PaintImage=gh,t.PathArrow=ph,t.PathBounds=dr,t.PathCommandDataHelper=ti,t.PathCommandMap=ue,t.PathConvert=Is,t.PathCorner=yr,t.PathCreator=yi,t.PathData=Uh,t.PathDrawer=Ei,t.PathHelper=de,t.PathNumberCommandLengthMap=me,t.PathNumberCommandMap=ye,t.PenData=Nh,t.Platform=e,t.Plugin=Yt,t.Point=$,t.PointHelper=V,t.PolygonData=Fh,t.PropertyEvent=dn,t.RectData=Wh,t.RectHelper=xe,t.RectRender=Jh,t.RenderEvent=vn,t.Renderer=ah,t.ResizeEvent=mn,t.Resource=Cr,t.Run=zt,t.StarData=zh,t.State=vh,t.StringNumberMap=At,t.TaskItem=kr,t.TaskProcessor=Sr,t.TextConvert=ch,t.TextData=Xh,t.Transition=bh,t.TwoPointBoundsHelper=et,t.UIBounds=Vh,t.UICreator=Gt,t.UIData=Ph,t.UIRender=qh,t.UnitConvert=_h,t.WaitHelper=Jo,t.WatchEvent=xn,t.Watcher=qa,t.affectRenderBoundsType=eo,t.affectStrokeBoundsType=Zr,t.attr=Ur,t.autoLayoutType=Hr,t.boundsType=jr,t.canvasPatch=wr,t.canvasSizeAttrs=he,t.createAttr=function(t){return(e,s)=>{Wr(e,s,Fr(s,t))}},t.createDescriptor=Fr,t.cursorType=uo,t.dataProcessor=_o,t.dataType=Yr,t.decorateLeafAttr=zr,t.defineDataProcessor=po,t.defineKey=Wr,t.defineLeafAttr=Nr,t.doBoundsType=Qr,t.doStrokeType=Kr,t.effectType=hh,t.emptyData={},t.eraserType=lo,t.getBoundsData=R,t.getDescriptor=Dr,t.getMatrixData=C,t.getPointData=S,t.hitType=co,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)=>{Wr(e,"__LayoutProcessor",{get:()=>t})}},t.leaferTransformAttrMap=Cn,t.maskType=ho,t.naturalBoundsType=qr,t.opacityType=io,t.pathInputType=Jr,t.pathType=$r,t.pen=mr,t.positionType=Xr,t.registerUI=bo,t.registerUIEvent=function(){return t=>{qt.register(t)}},t.resizeType=lh,t.rewrite=mo,t.rewriteAble=xo,t.rotationType=Vr,t.scaleType=Gr,t.sortType=ao,t.strokeType=to,t.surfaceType=so,t.tempBounds=It,t.tempMatrix=tt,t.tempPoint=Z,t.tryToNumber=function(t){return"string"==typeof t&&d.test(t)?+t:t},t.useCanvas=Va,t.useModule=vo,t.version="1.9.1",t.visibleType=ro,t.zoomLayerType=dh,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 __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}}const{round:y,pow:m,PI:x}=Math,w={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(t,e){let s;if(c(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]),e)for(let t=0;t<4;t++)s[t]>e&&(s[t]=e);return s},formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),w.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:m(10,e);return-0===(t=y(t*s)/s)?0:t},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&&w.assignScale(i,t);return i},assignScale(t,e){l(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},randInt:v,randColor:t=>`rgba(${v(255)},${v(255)},${v(255)},${t||1})`};function v(t){return Math.round(Math.random()*t)}const b=x/180,B=2*x,k=x/2;function S(){return{x:0,y:0}}function R(){return{x:0,y:0,width:0,height:0}}function C(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:P,cos:T,acos:L,sqrt:E}=Math,{float:I}=w,O={};function A(){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 M={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:A(),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:C,getWorld:A,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},scaleOfOuter(t,e,s,i){W.toInnerPoint(t,e,O),W.scaleOfInner(t,O,s,i)},scaleOfInner(t,e,s,i=s){W.translateInner(t,e.x,e.y),W.scale(t,s,i),W.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:s,b:i,c:r,d:o}=t,n=T(e*=b),a=P(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){W.toInnerPoint(t,e,O),W.rotateOfInner(t,O,s)},rotateOfInner(t,e,s){W.translateInner(t,e.x,e.y),W.rotate(t,s),W.translateInner(t,-e.x,-e.y)},skew(t,e,s){const{a:i,b:r,c:o,d:n}=t;s&&(s*=b,t.a=i+o*s,t.b=r+n*s),e&&(e*=b,t.c=o+i*e,t.d=n+r*e)},skewOfOuter(t,e,s,i){W.toInnerPoint(t,e,O),W.skewOfInner(t,O,s,i)},skewOfInner(t,e,s,i=0){W.translateInner(t,e.x,e.y),W.skew(t,s,i),W.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){W.multiply(t,W.tempInvert(e))},divideParent(t,e){W.multiplyParent(t,W.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=W;return W.copy(e,t),W.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*b,n=T(o),a=P(o);if(i||r){const e=i*b,s=r*b;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)&&W.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=E(r*r+o*o),c=t/d;const e=r/d;u=o>0?L(e):-L(e)}else{c=E(n*n+a*a),d=t/c;const e=n/c;u=k-(a>0?L(-e):-L(e))}const e=I(T(u)),s=P(u);d=I(d),c=I(c),_=e?I((n/c+s)/e/b,9):0,p=e?I((o/d-s)/e/b,9):0,u=I(u/b)}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=E(i*i+r*r)):(e=i,s=n)}return i.scaleX=e,i.scaleY=s,i},reset(t){W.set(t)}},W=M,{toInnerPoint:D,toOuterPoint:F}=M,{sin:z,cos:U,abs:N,sqrt:Y,atan2:X,min:H,round:G}=Math,V={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?G(t.x-.5)+.5:G(t.x),t.y=e?G(t.y-.5)+.5:G(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=j.defaultPoint);const i=U(e*=b),r=z(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}=j;return Q(s,t),D(e,s,s),s},tempToOuterOf(t,e){const{tempPoint:s}=j;return Q(s,t),F(e,s,s),s},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:s}=j;return Q(s,t),j.toInnerRadiusPointOf(t,e,s),s},toInnerRadiusPointOf(t,e,s){s||(s=t),D(e,t,s),s.radiusX=Math.abs(t.radiusX/e.scaleX),s.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,s){D(e,t,s)},toOuterOf(t,e,s){F(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)=>q(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,s,i){const r=N(s-t),o=N(i-e);return Y(r*r+o*o)},getMinDistanceFrom:(t,e,s,i,r,o)=>H(q(t,e,s,i),q(s,i,r,o)),getAngle:(t,e)=>J(t,e)/b,getRotation:(t,e,s,i)=>(i||(i=e),j.getRadianFrom(t.x,t.y,e.x,e.y,s.x,s.y,i.x,i.y)/b),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)=>X(e.y-t.y,e.x-t.x),getDistancePoint(t,e,s,i){const r=J(t,e);return(e=i?e:{}).x=t.x+U(r)*s,e.y=t.y+z(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){j.reset(t)}},j=V,{getDistanceFrom:q,copy:Q,getAtan2:J}=j;class ${constructor(t,e){this.set(t,e)}set(t,e){return u(t)?V.copy(this,t):V.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new $(this)}move(t,e){return V.move(this,t,e),this}scale(t,e){return V.scale(this,t,e),this}scaleOf(t,e,s){return V.scaleOf(this,t,e,s),this}rotate(t,e){return V.rotate(this,t,e),this}rotateOf(t,e){return V.rotate(this,e,t),this}getRotation(t,e,s){return V.getRotation(this,t,e,s)}toInnerOf(t,e){return V.toInnerOf(this,t,e),this}toOuterOf(t,e){return V.toOuterOf(this,t,e),this}getCenter(t){return new $(V.getCenter(this,t))}getDistance(t){return V.getDistance(this,t)}getDistancePoint(t,e,s){return new $(V.getDistancePoint(this,t,e,s))}getAngle(t){return V.getAngle(this,t)}getAtan2(t){return V.getAtan2(this,t)}reset(){return V.reset(this),this}}const Z=new $;class K{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)?M.copy(this,t):M.set(this,t,e,s,i,r,o),this}setWith(t){return M.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 K(this)}translate(t,e){return M.translate(this,t,e),this}translateInner(t,e){return M.translateInner(this,t,e),this}scale(t,e){return M.scale(this,t,e),this}scaleWith(t,e){return M.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}scaleOfOuter(t,e,s){return M.scaleOfOuter(this,t,e,s),this}scaleOfInner(t,e,s){return M.scaleOfInner(this,t,e,s),this}rotate(t){return M.rotate(this,t),this}rotateOfOuter(t,e){return M.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return M.rotateOfInner(this,t,e),this}skew(t,e){return M.skew(this,t,e),this}skewOfOuter(t,e,s){return M.skewOfOuter(this,t,e,s),this}skewOfInner(t,e,s){return M.skewOfInner(this,t,e,s),this}multiply(t){return M.multiply(this,t),this}multiplyParent(t){return M.multiplyParent(this,t),this}divide(t){return M.divide(this,t),this}divideParent(t){return M.divideParent(this,t),this}invert(){return M.invert(this),this}invertWith(){return M.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,s){M.toOuterPoint(this,t,e,s)}toInnerPoint(t,e,s){M.toInnerPoint(this,t,e,s)}setLayout(t,e,s){return M.setLayout(this,t,e,s),this}getLayout(t,e,s){return M.getLayout(this,t,e,s)}withScale(t,e){return M.withScale(this,t,e)}reset(){M.reset(this)}}const tt=new K,et={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){st(t,e,s),st(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:st}=et;var it,rt;t.Direction4=void 0,(it=t.Direction4||(t.Direction4={}))[it.top=0]="top",it[it.right=1]="right",it[it.bottom=2]="bottom",it[it.left=3]="left",t.Direction9=void 0,(rt=t.Direction9||(t.Direction9={}))[rt.topLeft=0]="topLeft",rt[rt.top=1]="top",rt[rt.topRight=2]="topRight",rt[rt.right=3]="right",rt[rt.bottomRight=4]="bottomRight",rt[rt.bottom=5]="bottom",rt[rt.bottomLeft=6]="bottomLeft",rt[rt.left=7]="left",rt[rt.center=8]="center",rt[rt["top-left"]=0]="top-left",rt[rt["top-right"]=2]="top-right",rt[rt["bottom-right"]=4]="bottom-right",rt[rt["bottom-left"]=6]="bottom-left";const ot=[{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}];ot.forEach(t=>t.type="percent");const nt={directionData:ot,tempPoint:{},get:at,toPoint(t,e,s,i,r,o){const n=at(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={}),nt.toPoint(t,e,s,!0),s)};function at(e){return a(e)?ot[t.Direction9[e]]:e}const{toPoint:ht}=nt,lt={toPoint(t,e,s,i,r,o){ht(t,s,i,r,e,o)}},{tempPointBounds:dt,setPoint:ct,addPoint:ut,toBounds:_t}=et,{toOuterPoint:pt}=M,{float:ft,fourNumber:gt}=w,{floor:yt,ceil:mt}=Math;let xt,wt,vt,bt;const Bt={},kt={},St={},Rt={tempBounds:St,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=gt(s);i?Ct.set(t,o+e[3],n+e[0],a-e[1]-e[3],h-e[2]-e[0]):Ct.set(t,o-e[3],n-e[0],a+e[1]+e[3],h+e[2]+e[0])}else i&&(s=-s),Ct.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),Ct.move(t,e,s),t),toOffsetOutBounds(t,e,s){e?Tt(e,t):e=t,s?(e.offsetX=-(Ct.maxX(s)-t.x),e.offsetY=-(Ct.maxY(s)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),Ct.move(e,-e.offsetX,-e.offsetY)},scale(t,e,s=e,i){i||V.scale(t,e,s),t.width*=e,t.height*=s},scaleOf(t,e,s,i=s){V.scaleOf(t,e,s,i),t.width*=s,t.height*=i},tempToOuterOf:(t,e)=>(Ct.copy(St,t),Ct.toOuterOf(St,e),St),getOuterOf:(t,e)=>(t=Object.assign({},t),Ct.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 Bt.x=t.x,Bt.y=t.y,pt(e,Bt,kt),ct(dt,kt.x,kt.y),Bt.x=t.x+t.width,pt(e,Bt,kt),ut(dt,kt.x,kt.y),Bt.y=t.y+t.height,pt(e,Bt,kt),ut(dt,kt.x,kt.y),Bt.x=t.x,pt(e,Bt,kt),ut(dt,kt.x,kt.y),_t(dt,s)},toInnerOf(t,e,s){s||(s=t),Ct.move(s,-e.e,-e.f),Ct.scale(s,1/e.a,1/e.d)},getFitMatrix(t,e,s=1){const i=Math.min(s,Ct.getFitScale(t,e));return new K(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=Ct.getFitScale(t,e,"cover"===i)),St.width=r?e.width*=i:e.width*i,St.height=r?e.height*=i:e.height*i,lt.toPoint(s,St,t,o,!0,!0)},getSpread(t,e,s){const i={};return Ct.copyAndSpread(i,t,e,!1,s),i},spread(t,e,s){Ct.copyAndSpread(t,t,e,!1,s)},shrink(t,e,s){Ct.copyAndSpread(t,t,e,!0,s)},ceil(t){const{x:e,y:s}=t;t.x=yt(t.x),t.y=yt(t.y),t.width=e>t.x?mt(t.width+e-t.x):mt(t.width),t.height=s>t.y?mt(t.height+s-t.y):mt(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=ft(t.x,e),t.y=ft(t.y,e),t.width=ft(t.width,e),t.height=ft(t.height,e)},add(t,e,s){xt=t.x+t.width,wt=t.y+t.height,vt=e.x,bt=e.y,s||(vt+=e.width,bt+=e.height),xt=xt>vt?xt:vt,wt=wt>bt?wt:bt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=xt-t.x,t.height=wt-t.y},addList(t,e){Ct.setListWithFn(t,e,void 0,!0)},setList(t,e,s=!1){Ct.setListWithFn(t,e,void 0,s)},addListWithFn(t,e,s){Ct.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||Tt(t,r)):Pt(t,r));o&&Ct.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?ct(dt,t.x,t.y):ut(dt,t.x,t.y)),_t(dt,t)},setPoint(t,e){Ct.set(t,e.x,e.y)},addPoint(t,e){Pt(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=V.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=V.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=Ct.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=Ct.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=Ct.tempToOuterOf(e,s)),!Ct.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:i,y:r,width:o,height:n}=e;return xt=i+o,wt=r+n,vt=t.x+t.width,bt=t.y+t.height,i=i>t.x?i:t.x,r=r>t.y?r:t.y,xt=xt<vt?xt:vt,wt=wt<bt?wt:bt,o=xt-i,n=wt-r,{x:i,y:r,width:o,height:n}},intersect(t,e,s){Ct.copy(t,Ct.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){Ct.set(t)}},Ct=Rt,{add:Pt,copy:Tt}=Ct;class Lt{get minX(){return Rt.minX(this)}get minY(){return Rt.minY(this)}get maxX(){return Rt.maxX(this)}get maxY(){return Rt.maxY(this)}constructor(t,e,s,i){this.set(t,e,s,i)}set(t,e,s,i){return u(t)?Rt.copy(this,t):Rt.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 Lt(this)}move(t,e){return Rt.move(this,t,e),this}scale(t,e,s){return Rt.scale(this,t,e,s),this}scaleOf(t,e,s){return Rt.scaleOf(this,t,e,s),this}toOuterOf(t,e){return Rt.toOuterOf(this,t,e),this}toInnerOf(t,e){return Rt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Rt.getFitMatrix(this,t,e)}put(t,e,s){Rt.put(this,t,e,s)}spread(t,e){return Rt.spread(this,t,e),this}shrink(t,e){return Rt.shrink(this,t,e),this}ceil(){return Rt.ceil(this),this}unsign(){return Rt.unsign(this),this}float(t){return Rt.float(this,t),this}add(t){return Rt.add(this,t),this}addList(t){return Rt.setList(this,t,!0),this}setList(t){return Rt.setList(this,t),this}addListWithFn(t,e){return Rt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Rt.setListWithFn(this,t,e),this}setPoint(t){return Rt.setPoint(this,t),this}setPoints(t){return Rt.setPoints(this,t),this}addPoint(t){return Rt.addPoint(this,t),this}getPoints(){return Rt.getPoints(this)}hitPoint(t,e){return Rt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Rt.hitRadiusPoint(this,t,e)}hit(t,e){return Rt.hit(this,t,e)}includes(t,e){return Rt.includes(this,t,e)}intersect(t,e){return Rt.intersect(this,t,e),this}getIntersect(t,e){return new Lt(Rt.getIntersectData(this,t,e))}isSame(t){return Rt.isSame(this,t)}isEmpty(){return Rt.isEmpty(this)}reset(){Rt.reset(this)}}const Et=new Lt;class It{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 Lt(r,e,o||t.width-r-s,n||t.height-e-i)}}const Ot={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:At}=w;class Mt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new Mt(t)}static set filter(t){this.filterList=Wt(t)}static set exclude(t){this.excludeList=Wt(t)}static drawRepaint(t,e){const s=At();t.fillWorld(e,s.replace("1)",".1)")),t.strokeWorld(e,s)}static drawBounds(t,e,s){const i="hit"===Mt.showBounds,r=t.__nowWorld,o=At();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(Dt.enable){if(Dt.filterList.length&&Dt.filterList.every(t=>t!==this.name))return;if(Dt.excludeList.length&&Dt.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){Dt.enable&&this.warn(...t)}warn(...t){Dt.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 Wt(t){return t?a(t)&&(t=[t]):t=[],t}Mt.filterList=[],Mt.excludeList=[],Mt.showWarn=!0;const Dt=Mt,Ft=Mt.get("RunTime"),zt={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=s.create(s.RUNTIME);return Ut.currentId=Ut.idMap[i]=e?performance.now():Date.now(),Ut.currentName=Ut.nameMap[i]=t,Ut.nameToIdMap[t]=i,i},end(t,e){const s=Ut.idMap[t],i=Ut.nameMap[t],r=e?(performance.now()-s)/1e3:Date.now()-s;Ut.idMap[t]=Ut.nameMap[t]=Ut.nameToIdMap[i]=void 0,Ft.log(i,r,"ms")},endOfName(t,e){const s=Ut.nameToIdMap[t];o(s)||Ut.end(s,e)}},Ut=zt,Nt=[],Yt={list:{},add(t,...e){this.list[t]=!0,Nt.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(()=>Nt.forEach(t=>Yt.has(t,!0)));const Xt={editor:t=>Yt.need("editor")},Ht=Mt.get("UICreator"),Gt={list:{},register(t){const{__tag:e}=t.prototype;Vt[e]&&Ht.repeat(e),Vt[e]=t},get(t,e,s,i,r,n){Vt[t]||Ht.error("not register "+t);const a=new Vt[t](e);return o(s)||(a.x=s,i&&(a.y=i),r&&(a.width=r),n&&(a.height=n)),a}},{list:Vt}=Gt,jt=Mt.get("EventCreator"),qt={nameList:{},register(t){let e;Object.keys(t).forEach(s=>{e=t[s],a(e)&&(Qt[e]&&jt.repeat(e),Qt[e]=t)})},changeName(t,e){const s=Qt[t];if(s){const i=Object.keys(s).find(e=>s[e]===t);i&&(s[i]=e,Qt[e]=s)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new Qt[t](...e)},{nameList:Qt}=qt;class Jt{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=Xt.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 $t(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 Zt(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 Kt(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 te=[];function ee(){return(t,e)=>{te.push(e)}}const se=[];class ie{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||se)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;te.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}}$t([Kt("imageSmoothingEnabled")],ie.prototype,"smooth",void 0),$t([Kt("imageSmoothingQuality")],ie.prototype,"smoothLevel",void 0),$t([Kt("globalAlpha")],ie.prototype,"opacity",void 0),$t([Kt()],ie.prototype,"fillStyle",void 0),$t([Kt()],ie.prototype,"strokeStyle",void 0),$t([Kt("lineWidth")],ie.prototype,"strokeWidth",void 0),$t([Kt("lineCap")],ie.prototype,"strokeCap",void 0),$t([Kt("lineJoin")],ie.prototype,"strokeJoin",void 0),$t([Kt("lineDashOffset")],ie.prototype,"dashOffset",void 0),$t([Kt()],ie.prototype,"miterLimit",void 0),$t([Kt()],ie.prototype,"shadowBlur",void 0),$t([Kt()],ie.prototype,"shadowColor",void 0),$t([Kt()],ie.prototype,"shadowOffsetX",void 0),$t([Kt()],ie.prototype,"shadowOffsetY",void 0),$t([Kt()],ie.prototype,"filter",void 0),$t([Kt()],ie.prototype,"font",void 0),$t([Kt()],ie.prototype,"fontKerning",void 0),$t([Kt()],ie.prototype,"fontStretch",void 0),$t([Kt()],ie.prototype,"fontVariantCaps",void 0),$t([Kt()],ie.prototype,"textAlign",void 0),$t([Kt()],ie.prototype,"textBaseline",void 0),$t([Kt()],ie.prototype,"textRendering",void 0),$t([Kt()],ie.prototype,"wordSpacing",void 0),$t([Kt()],ie.prototype,"letterSpacing",void 0),$t([Kt()],ie.prototype,"direction",void 0),$t([ee()],ie.prototype,"setTransform",null),$t([ee()],ie.prototype,"resetTransform",null),$t([ee()],ie.prototype,"getTransform",null),$t([ee()],ie.prototype,"save",null),$t([ee()],ie.prototype,"restore",null),$t([ee()],ie.prototype,"translate",null),$t([ee()],ie.prototype,"scale",null),$t([ee()],ie.prototype,"rotate",null),$t([ee()],ie.prototype,"fill",null),$t([ee()],ie.prototype,"stroke",null),$t([ee()],ie.prototype,"clip",null),$t([ee()],ie.prototype,"fillRect",null),$t([ee()],ie.prototype,"strokeRect",null),$t([ee()],ie.prototype,"clearRect",null),$t([ee()],ie.prototype,"beginPath",null),$t([ee()],ie.prototype,"moveTo",null),$t([ee()],ie.prototype,"lineTo",null),$t([ee()],ie.prototype,"bezierCurveTo",null),$t([ee()],ie.prototype,"quadraticCurveTo",null),$t([ee()],ie.prototype,"closePath",null),$t([ee()],ie.prototype,"arc",null),$t([ee()],ie.prototype,"arcTo",null),$t([ee()],ie.prototype,"ellipse",null),$t([ee()],ie.prototype,"rect",null),$t([ee()],ie.prototype,"roundRect",null),$t([ee()],ie.prototype,"createConicGradient",null),$t([ee()],ie.prototype,"createLinearGradient",null),$t([ee()],ie.prototype,"createPattern",null),$t([ee()],ie.prototype,"createRadialGradient",null),$t([ee()],ie.prototype,"fillText",null),$t([ee()],ie.prototype,"measureText",null),$t([ee()],ie.prototype,"strokeText",null);const{copy:re,multiplyParent:oe}=M,{round:ne}=Math,ae=new Lt,he=new Lt,le={width:1,height:1,pixelRatio:1},de=["width","height","pixelRatio"];class ce extends ie{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=le),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,de),de.forEach(t=>i[t]||(i[t]=1)),this.bounds=new Lt(0,0,this.width,this.height),this.context&&!this.unreal&&(this.updateViewSize(),this.smooth=this.config.smooth),this.updateClientBounds(),this.context&&!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&&oe(t,e,r),r.a=t.a*s,r.b=t.b*s,r.c=t.c*s,r.d=t.d*s,r.e=t.e*s,r.f=t.f*s,i&&(t.half&&t.half*s%2?(r.e=ne(r.e-.5)+.5,r.f=ne(r.f-.5)+.5):(r.e=ne(r.e),r.f=ne(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=he):s=ae,this.drawImage(t.view,ae.x,ae.y,ae.width,ae.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,Rt.tempToOuterOf(s,e),i,r),this.restore()):(i&&(this.blendMode=i),this.setTempPixelBounds(e,r),this.drawImage(t.view,ae.x,ae.y,ae.width,ae.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(ae.x,ae.y,ae.width,ae.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,ae.x,ae.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(ae.x,ae.y,ae.width,ae.height),s&&(this.blendMode="source-over")}strokeWorld(t,e,s,i){s&&(this.blendMode=s),this.strokeStyle=e,this.setTempPixelBounds(t,i),this.strokeRect(ae.x,ae.y,ae.width,ae.height),s&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(ae.x,ae.y,ae.width,ae.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(ae.x,ae.y,ae.width,ae.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,s){this.copyToPixelBounds(ae,t,e,s)}setTempPixelBounds2(t,e,s){this.copyToPixelBounds(he,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):Xt.canvas(Object.assign({},s));return r.save(),t&&(re(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 ue={creator:{},parse(t,e){},convertToCanvasData(t,e){}},_e={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},pe=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},_e),fe={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},ge={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},ye=Object.assign(Object.assign({},ge),_e),me=pe,xe={};for(let t in me)xe[me[t]]=t;const we={};for(let t in me)we[me[t]]=fe[t];const ve={drawRoundRect(t,e,s,i,r,o){const n=w.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:be,cos:Be,atan2:ke,ceil:Se,abs:Re,PI:Ce,sqrt:Pe,pow:Te}=Math,{setPoint:Le,addPoint:Ee}=et,{set:Ie,toNumberPoints:Oe}=V,{M:Ae,L:Me,C:We,Q:De,Z:Fe}=pe,ze={},Ue={points(t,e,s,i){let r=Oe(e);if(t.push(Ae,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=Pe(Te(n-e,2)+Te(a-o,2)),f=Pe(Te(h-n,2)+Te(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(De,d,c,n,a):t.push(We,u,_,d,c,n,a),u=n+f*h,_=a+f*l);i||t.push(De,u,_,r[y-2],r[y-1])}else for(let e=2,s=r.length;e<s;e+=2)t.push(Me,r[e],r[e+1]);i&&t.push(Fe)},rect(t,e,s,i,r){ue.creator.path=t,ue.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){ue.creator.path=[],ve.drawRoundRect(ue.creator,e,s,i,r,o),t.push(...ue.convertToCanvasData(ue.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=ke(u,c),g=ke(p,_),y=g-f;if(y<0&&(y+=B),y===Ce||Re(c+u)<1e-12||Re(_+p)<1e-12)return t&&t.push(Me,i,r),h&&(Le(h,e,s),Ee(h,i,r)),d&&Ie(d,e,s),void(l&&Ie(l,i,r));const m=c*p-_*u<0,x=m?-1:1,w=a/Be(y/2),v=i+w*Be(f+y/2+k*x),S=r+w*be(f+y/2+k*x);return f-=k*x,g-=k*x,Xe(t,v,S,a,a,0,f/b,g/b,m,h,l,d)},arc:(t,e,s,i,r,o,n,a,h,l)=>Xe(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*b,_=be(u),p=Be(u);let f=n*b,g=a*b;f>Ce&&(f-=B),g<0&&(g+=B);let y=g-f;y<0?y+=B:y>B&&(y-=B),h&&(y-=B);const m=Se(Re(y/k)),x=y/m,w=be(x/4),v=8/3*w*w/be(x/2);g=f+x;let S,R,C,P,T,L,E,I,O=Be(f),A=be(f),M=C=p*i*O-_*r*A,W=P=_*i*O+p*r*A,D=e+C,F=s+P;t&&t.push(t.length?Me:Ae,D,F),l&&Le(l,D,F),c&&Ie(c,D,F);for(let o=0;o<m;o++)S=Be(g),R=be(g),C=p*i*S-_*r*R,P=_*i*S+p*r*R,T=e+M-v*(p*i*A+_*r*O),L=s+W-v*(_*i*A-p*r*O),E=e+C+v*(p*i*R+_*r*S),I=s+P+v*(_*i*R-p*r*S),t&&t.push(We,T,L,E,I,e+C,s+P),l&&Ye(e+M,s+W,T,L,E,I,e+C,s+P,l,!0),M=C,W=P,O=S,A=R,f=g,g+=x;d&&Ie(d,e+C,s+P)},quadraticCurveTo(t,e,s,i,r,o,n){t.push(We,(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){Ye(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?Ee(h,t,e):Le(h,t,e),Ee(h,n,a);for(let l=0,c=d.length;l<c;l++)Ne(d[l],t,e,s,i,r,o,n,a,ze),Ee(h,ze.x,ze.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 Ne(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:Ne,toTwoPointBounds:Ye,ellipse:Xe}=Ue,{sin:He,cos:Ge,sqrt:Ve,atan2:je}=Math,{ellipse:qe}=Ue,Qe={ellipticalArc(t,s,i,r,o,n,a,h,l,d,c){const u=(l-s)/2,_=(d-i)/2,p=n*b,f=He(p),g=Ge(p),y=-g*u-f*_,m=-g*_+f*u,x=r*r,w=o*o,v=m*m,k=y*y,S=x*w-x*v-w*k;let R=0;if(S<0){const t=Ve(1-S/(x*w));r*=t,o*=t}else R=(a===h?-1:1)*Ve(S/(x*v+w*k));const C=R*r*m/o,P=-R*o*y/r,T=je((m-P)/o,(y-C)/r),L=je((-m-P)/o,(-y-C)/r);let E=L-T;0===h&&E>0?E-=B:1===h&&E<0&&(E+=B);const I=s+u+g*C-f*P,O=i+_+f*C+g*P,A=E<0?1:0;c||e.ellipseToCurve?qe(t,I,O,r,o,n,T/b,L/b,A):r!==o||n?t.push(pe.G,I,O,r,o,n,T/b,L/b,A):t.push(pe.O,I,O,r,T/b,L/b,A)}},{M:Je,m:$e,L:Ze,l:Ke,H:ts,h:es,V:ss,v:is,C:rs,c:os,S:ns,s:as,Q:hs,q:ls,T:ds,t:cs,A:us,a:_s,Z:ps,z:fs,N:gs,D:ys,X:ms,G:xs,F:ws,O:vs,P:bs,U:Bs}=pe,{rect:ks,roundRect:Ss,arcTo:Rs,arc:Cs,ellipse:Ps,quadraticCurveTo:Ts}=Ue,{ellipticalArc:Ls}=Qe,Es=Mt.get("PathConvert"),Is={},Os={current:{dot:0},stringify(t,e){let s,i,r,o=0,n=t.length,a="";for(;o<n;){i=t[o],s=we[i],a+=i===r?" ":xe[i];for(let i=1;i<s;i++)a+=w.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?ye:ge;for(let e=0,h=t.length;e<h;e++)i=t[e],Ot[i]?("."===i&&(As.dot&&(Ms(n,o),o=""),As.dot++),"0"===o&&"."!==i&&(Ms(n,o),o=""),o+=i):pe[i]?(o&&(Ms(n,o),o=""),As.name=pe[i],As.length=fe[i],As.index=0,Ms(n,As.name),!s&&a[i]&&(s=!0)):"-"===i||"+"===i?"e"===r||"E"===r?o+=i:(o&&Ms(n,o),o=i):o&&(Ms(n,o),o=""),r=i;return o&&Ms(n,o),s?Os.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 $e:t[c+1]+=a,t[c+2]+=h;case Je:a=t[c+1],h=t[c+2],_.push(Je,a,h),c+=3;break;case es:t[c+1]+=a;case ts:a=t[c+1],_.push(Ze,a,h),c+=2;break;case is:t[c+1]+=h;case ss:h=t[c+1],_.push(Ze,a,h),c+=2;break;case Ke:t[c+1]+=a,t[c+2]+=h;case Ze:a=t[c+1],h=t[c+2],_.push(Ze,a,h),c+=3;break;case as:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=ns;case ns:n=o===rs||o===ns,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(rs,l,d,s,i,a,h),c+=5;break;case os: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=rs;case rs:s=t[c+3],i=t[c+4],a=t[c+5],h=t[c+6],_.push(rs,t[c+1],t[c+2],s,i,a,h),c+=7;break;case cs:t[c+1]+=a,t[c+2]+=h,r=ds;case ds:n=o===hs||o===ds,s=n?2*a-s:t[c+1],i=n?2*h-i:t[c+2],e?Ts(_,a,h,s,i,t[c+1],t[c+2]):_.push(hs,s,i,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case ls:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=hs;case hs:s=t[c+1],i=t[c+2],e?Ts(_,a,h,s,i,t[c+3],t[c+4]):_.push(hs,s,i,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case _s:t[c+6]+=a,t[c+7]+=h;case us:Ls(_,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 fs:case ps:_.push(ps),c++;break;case gs:a=t[c+1],h=t[c+2],e?ks(_,a,h,t[c+3],t[c+4]):Ws(_,t,c,5),c+=5;break;case ys:a=t[c+1],h=t[c+2],e?Ss(_,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):Ws(_,t,c,9),c+=9;break;case ms:a=t[c+1],h=t[c+2],e?Ss(_,a,h,t[c+3],t[c+4],t[c+5]):Ws(_,t,c,6),c+=6;break;case xs:Ps(e?_:Ws(_,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,Is),a=Is.x,h=Is.y,c+=9;break;case ws:e?Ps(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):Ws(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case vs:Cs(e?_:Ws(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Is),a=Is.x,h=Is.y,c+=7;break;case bs:e?Cs(_,t[c+1],t[c+2],t[c+3],0,360,!1):Ws(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Bs:Rs(e?_:Ws(_,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Is),a=Is.x,h=Is.y,c+=6;break;default:return Es.error(`command: ${r} [index:${c}]`,t),_}o=r}return _},objectToCanvasData(t){const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(Je,t.x,t.y);break;case"L":e.push(Ze,t.x,t.y);break;case"C":e.push(rs,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(hs,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(ps)}}),e},copyData(t,e,s,i){for(let r=s,o=s+i;r<o;r++)t.push(e[r])},pushData(t,e){As.index===As.length&&(As.index=1,t.push(As.name)),t.push(Number(e)),As.index++,As.dot=0}},{current:As,pushData:Ms,copyData:Ws}=Os,{M:Ds,L:Fs,C:zs,Q:Us,Z:Ns,N:Ys,D:Xs,X:Hs,G:Gs,F:Vs,O:js,P:qs,U:Qs}=pe,{getMinDistanceFrom:Js,getRadianFrom:$s}=V,{tan:Zs,min:Ks,abs:ti}=Math,ei={},si={beginPath(t){t.length=0},moveTo(t,e,s){t.push(Ds,e,s)},lineTo(t,e,s){t.push(Fs,e,s)},bezierCurveTo(t,e,s,i,r,o,n){t.push(zs,e,s,i,r,o,n)},quadraticCurveTo(t,e,s,i,r){t.push(Us,e,s,i,r)},closePath(t){t.push(Ns)},rect(t,e,s,i,r){t.push(Ys,e,s,i,r)},roundRect(t,e,s,i,r,o){if(l(o))t.push(Hs,e,s,i,r,o);else{const n=w.fourNumber(o);n?t.push(Xs,e,s,i,r,...n):t.push(Ys,e,s,i,r)}},ellipse(t,e,s,i,r,o,a,h,l){n(o)?t.push(Vs,e,s,i,r):(n(a)&&(a=0),n(h)&&(h=360),t.push(Gs,e,s,i,r,o,a,h,l?1:0))},arc(t,e,s,i,r,o,a){n(r)?t.push(qs,e,s,i):(n(o)&&(o=360),t.push(js,e,s,i,r,o,a?1:0))},arcTo(t,e,s,i,r,n,a,h){if(!o(a)){const t=Js(a,h,e,s,i,r);n=Ks(n,Ks(t/2,t/2*ti(Zs($s(a,h,e,s,i,r)/2))))}t.push(Qs,e,s,i,r,n)},drawEllipse(t,e,s,i,r,o,a,h,l){Ue.ellipse(null,e,s,i,r,n(o)?0:o,n(a)?0:a,n(h)?360:h,l,null,null,ei),t.push(Ds,ei.x,ei.y),ii(t,e,s,i,r,o,a,h,l)},drawArc(t,e,s,i,r,o,a){Ue.arc(null,e,s,i,n(r)?0:r,n(o)?360:o,a,null,null,ei),t.push(Ds,ei.x,ei.y),ri(t,e,s,i,r,o,a)},drawPoints(t,e,s,i){Ue.points(t,e,s,i)}},{ellipse:ii,arc:ri}=si,{moveTo:oi,lineTo:ni,quadraticCurveTo:ai,bezierCurveTo:hi,closePath:li,beginPath:di,rect:ci,roundRect:ui,ellipse:_i,arc:pi,arcTo:fi,drawEllipse:gi,drawArc:yi,drawPoints:mi}=si;class xi{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?a(t)?ue.parse(t):t:[],this}beginPath(){return di(this.__path),this.paint(),this}moveTo(t,e){return oi(this.__path,t,e),this.paint(),this}lineTo(t,e){return ni(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,s,i,r,o){return hi(this.__path,t,e,s,i,r,o),this.paint(),this}quadraticCurveTo(t,e,s,i){return ai(this.__path,t,e,s,i),this.paint(),this}closePath(){return li(this.__path),this.paint(),this}rect(t,e,s,i){return ci(this.__path,t,e,s,i),this.paint(),this}roundRect(t,e,s,i,r){return ui(this.__path,t,e,s,i,r),this.paint(),this}ellipse(t,e,s,i,r,o,n,a){return _i(this.__path,t,e,s,i,r,o,n,a),this.paint(),this}arc(t,e,s,i,r,o){return pi(this.__path,t,e,s,i,r,o),this.paint(),this}arcTo(t,e,s,i,r){return fi(this.__path,t,e,s,i,r),this.paint(),this}drawEllipse(t,e,s,i,r,o,n,a){return gi(this.__path,t,e,s,i,r,o,n,a),this.paint(),this}drawArc(t,e,s,i,r,o){return yi(this.__path,t,e,s,i,r,o),this.paint(),this}drawPoints(t,e,s){return mi(this.__path,t,e,s),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:wi,L:vi,C:bi,Q:Bi,Z:ki,N:Si,D:Ri,X:Ci,G:Pi,F:Ti,O:Li,P:Ei,U:Ii}=pe,Oi=Mt.get("PathDrawer"),Ai={drawPathByData(t,e){if(!e)return;let s,i=0,r=e.length;for(;i<r;)switch(s=e[i],s){case wi:t.moveTo(e[i+1],e[i+2]),i+=3;break;case vi:t.lineTo(e[i+1],e[i+2]),i+=3;break;case bi:t.bezierCurveTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5],e[i+6]),i+=7;break;case Bi:t.quadraticCurveTo(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case ki:t.closePath(),i+=1;break;case Si:t.rect(e[i+1],e[i+2],e[i+3],e[i+4]),i+=5;break;case Ri: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 Ci:t.roundRect(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;case Pi:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]*b,e[i+6]*b,e[i+7]*b,e[i+8]),i+=9;break;case Ti:t.ellipse(e[i+1],e[i+2],e[i+3],e[i+4],0,0,B,!1),i+=5;break;case Li:t.arc(e[i+1],e[i+2],e[i+3],e[i+4]*b,e[i+5]*b,e[i+6]),i+=7;break;case Ei:t.arc(e[i+1],e[i+2],e[i+3],0,B,!1),i+=4;break;case Ii:t.arcTo(e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]),i+=6;break;default:return void Oi.error(`command: ${s} [index:${i}]`,e)}}},{M:Mi,L:Wi,C:Di,Q:Fi,Z:zi,N:Ui,D:Ni,X:Yi,G:Xi,F:Hi,O:Gi,P:Vi,U:ji}=pe,{toTwoPointBounds:qi,toTwoPointBoundsByQuadraticCurve:Qi,arcTo:Ji,arc:$i,ellipse:Zi}=Ue,{addPointBounds:Ki,copy:tr,addPoint:er,setPoint:sr,addBounds:ir,toBounds:rr}=et,or=Mt.get("PathBounds");let nr,ar,hr;const lr={},dr={},cr={},ur={toBounds(t,e){ur.toTwoPointBounds(t,dr),rr(dr,e)},toTwoPointBounds(t,e){if(!t||!t.length)return sr(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===zi||n===Di||n===Fi?sr(e,h,l):sr(e,t[a+1],t[a+2])),n){case Mi:case Wi:h=t[a+1],l=t[a+2],er(e,h,l),a+=3;break;case Di:r=t[a+5],o=t[a+6],qi(h,l,t[a+1],t[a+2],t[a+3],t[a+4],r,o,lr),Ki(e,lr),h=r,l=o,a+=7;break;case Fi:s=t[a+1],i=t[a+2],r=t[a+3],o=t[a+4],Qi(h,l,s,i,r,o,lr),Ki(e,lr),h=r,l=o,a+=5;break;case zi:a+=1;break;case Ui:h=t[a+1],l=t[a+2],ir(e,h,l,t[a+3],t[a+4]),a+=5;break;case Ni:case Yi:h=t[a+1],l=t[a+2],ir(e,h,l,t[a+3],t[a+4]),a+=n===Ni?9:6;break;case Xi:Zi(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],lr,cr),0===a?tr(e,lr):Ki(e,lr),h=cr.x,l=cr.y,a+=9;break;case Hi:h=t[a+1],l=t[a+2],ar=t[a+3],hr=t[a+4],ir(e,h-ar,l-hr,2*ar,2*hr),h+=ar,a+=5;break;case Gi:$i(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],lr,cr),0===a?tr(e,lr):Ki(e,lr),h=cr.x,l=cr.y,a+=7;break;case Vi:h=t[a+1],l=t[a+2],nr=t[a+3],ir(e,h-nr,l-nr,2*nr,2*nr),h+=nr,a+=4;break;case ji:Ji(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],lr,cr),0===a?tr(e,lr):Ki(e,lr),h=cr.x,l=cr.y,a+=6;break;default:return void or.error(`command: ${n} [index:${a}]`,t)}}},{M:_r,L:pr,Z:fr}=pe,{getCenterX:gr,getCenterY:yr}=V,{arcTo:mr}=si,xr={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 _r:l=_=t[n+1],d=p=t[n+2],n+=3,t[n]===pr?(c=t[n+1],u=t[n+2],g.push(_r,gr(l,c),yr(d,u))):g.push(_r,l,d);break;case pr:switch(a=t[n+1],h=t[n+2],n+=3,t[n]){case pr:mr(g,a,h,t[n+1],t[n+2],e,_,p);break;case fr:mr(g,a,h,l,d,e,_,p);break;default:g.push(pr,a,h)}_=a,p=h;break;case fr:r!==fr&&(mr(g,l,d,c,u,e,_,p),g.push(fr)),n+=1;break;default:o=we[i];for(let e=0;e<o;e++)g.push(t[n+e]);n+=o}r=i}return i!==fr&&(g[1]=l,g[2]=d),g}};ue.creator=new xi,ue.parse=Os.parse,ue.convertToCanvasData=Os.toCanvasData;const wr=new xi,{drawRoundRect:vr}=ve;function br(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,s,i,r){vr(this,t,e,s,i,r)})}(t)}const Br={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=kr.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{}}}},kr=Br;kr.alphaPixelTypes.forEach(t=>kr.upperCaseTypeMap[t]=t.toUpperCase());const Sr=Mt.get("TaskProcessor");class Rr{constructor(t){this.parallel=!0,this.time=1,this.id=s.create(s.TASK),this.task=t}run(){return Zt(this,void 0,void 0,function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){Sr.error(t)}})}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class Cr{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 Rr(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 Pr=Mt.get("Resource"),Tr={tasker:new Cr,map:{},get isComplete(){return Lr.tasker.isComplete},set(t,e){Lr.map[t]&&Pr.repeat(t),Lr.map[t]=e},get:t=>Lr.map[t],remove(t){const e=Lr.map[t];e&&(e.destroy&&e.destroy(),delete Lr.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=Xt.image(i)),Lr.set(t,e),e},destroy(){Lr.map={}}},Lr=Tr,Er={maxRecycled:10,recycledList:[],patternTasker:new Cr,get(t){let e=Tr.get(t.url);return e||Tr.set(t.url,e=Xt.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||Ir.recycledList.push(t)})},clearRecycled(){const t=Ir.recycledList;t.length>Ir.maxRecycled&&(t.forEach(t=>!t.use&&t.url&&Tr.remove(t.url)),t.length=0)},hasAlphaPixel:t=>Br.alphaPixelTypes.some(e=>Ir.isFormat(e,t)),isFormat(t,e){if(e.format===t)return!0;const{url:s}=e;if(s.startsWith("data:")){if(s.startsWith("data:"+Br.mineType(t)))return!0}else{if(s.includes("."+t)||s.includes("."+Br.upperCaseTypeMap[t]))return!0;if("png"===t&&!s.includes("."))return!0}return!1},destroy(){Ir.recycledList=[]}},Ir=Er,{IMAGE:Or,create:Ar}=s,{floor:Mr,max:Wr}=Math;class Dr{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=Ar(Or),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}Er.isFormat("svg",t)&&(this.isSVG=!0),Er.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),Tr.tasker.add(()=>Zt(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){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 a=e.origin.createCanvas(Wr(Mr(t+(o||0)),1),Wr(Mr(s+(n||0)),1)),h=a.getContext("2d");return i&&(h.globalAlpha=i),h.drawImage(this.view,0,0,t,s),this.cache=this.use>1?{data:a,params:arguments}:null,a}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 Fr(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 Ur(t,e){const s="_"+t;return{get(){const t=this[s];return o(t)?e:t},set(t){this[s]=t}}}function Nr(t,e){return(s,i)=>Xr(s,i,t,e&&e(i))}function Yr(t){return t}function Xr(t,e,s,i){const r={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};Fr(t,e,Object.assign(r,i||{})),yo(t,e,s)}function Hr(t){return Nr(t)}function Gr(t,e){return Nr(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function Vr(t,e){return Nr(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function jr(t){return Nr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),Zr(this))}}))}function qr(t,e){return Nr(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function Qr(t,e){return Nr(t,t=>({set(s){this.__setAttr(t,s,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function Jr(t,e){return Nr(t,t=>({set(s){this.__setAttr(t,s,e)&&Zr(this)}}))}function $r(t){return Nr(t,t=>({set(e){this.__setAttr(t,e)&&(Zr(this),this.__.__removeNaturalSize())}}))}function Zr(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function Kr(t){return Nr(t,t=>({set(e){const s=this.__;2!==s.__pathInputed&&(s.__pathInputed=e?1:0),e||(s.__pathForRender=void 0),this.__setAttr(t,e),Zr(this)}}))}const to=Jr;function eo(t,e){return Nr(t,t=>({set(s){this.__setAttr(t,s)&&(so(this),e&&(this.__.__useStroke=!0))}}))}function so(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&Zr(t)}const io=eo;function ro(t){return Nr(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function oo(t){return Nr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function no(t){return Nr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&ho(this)}}))}function ao(t){return Nr(t,t=>({set(e){const s=this.visible;if(!0===s&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>lo(this,t,e,s))}else 0===s&&!0===e&&this.animation&&this.__runAnimation("in");lo(this,t,e,s),this.mask&&ho(this)}}))}function ho(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function lo(t,e,s,i){t.__setAttr(e,s)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==i&&0!==s||Zr(t))}function co(t){return Nr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function uo(t){return Nr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function _o(t){return Nr(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function po(t){return Nr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===Mt.showBounds&&(this.__layout.surfaceChanged||this.__layout.surfaceChange()),this.leafer&&this.leafer.updateCursor())}}))}function fo(t){return Nr(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function go(t){return(e,s)=>{Fr(e,"__DataProcessor",{get:()=>t})}}function yo(t,e,s){const i=t.__DataProcessor.prototype,r="_"+e,n=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=Ur(e,s);if(o(s))a.get=function(){return this[r]};else if("function"==typeof s)a.get=function(){let t=this[r];return void 0===t?s(this.__leaf):t};else if(u(s)){const t=_(s);a.get=function(){let e=this[r];return void 0===e?this[r]=t?{}:p.clone(s):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[r];if(void 0===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(void 0===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]),Fr(i,e,a)}const mo=new Mt("rewrite"),xo=[],wo=["destroy","constructor"];function vo(t){return(e,s)=>{xo.push({name:e.constructor.name+"."+s,run:()=>{e[s]=t}})}}function bo(){return t=>{Bo()}}function Bo(t){xo.length&&(xo.forEach(e=>{t&&mo.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),xo.length=0)}function ko(t,e){return s=>{var i;(t.prototype?(i=t.prototype,Object.getOwnPropertyNames(i)):Object.keys(t)).forEach(i=>{if(!(wo.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 So(){return t=>{Gt.register(t)}}setTimeout(()=>Bo(!0));const{copy:Ro,toInnerPoint:Co,toOuterPoint:Po,scaleOfOuter:To,rotateOfOuter:Lo,skewOfOuter:Eo,multiplyParent:Io,divideParent:Oo,getLayout:Ao}=M,Mo={},{round:Wo}=Math,Do={updateAllMatrix(t,e,s){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(s=!0),Uo(t,e,s),t.isBranch){const{children:i}=t;for(let t=0,r=i.length;t<r;t++)zo(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++)No(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&No(t),t.__updateChange()},updateAllChange(t){if(Xo(t),t.isBranch){const{children:e}=t;for(let t=0,s=e.length;t<s;t++)Yo(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?Po(t.localTransform,o,o,!0):t.parent&&Co(t.parent.scrollWorldTransform,o,o,!0),Fo.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=Wo(e),s=Wo(s)),i?t.animate({x:e,y:s},i):(t.x=e,t.y=s)},zoomOfWorld(t,e,s,i,r,o){Fo.zoomOfLocal(t,Ho(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),Ro(Mo,n),To(Mo,e,s,i),Fo.hasHighPosition(t))Fo.setTransform(t,Mo,r,o);else{const e=t.x+Mo.e-n.e,a=t.y+Mo.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){Fo.rotateOfLocal(t,Ho(t,e),s,i)},rotateOfLocal(t,e,s,i){const r=t.__localMatrix;Ro(Mo,r),Lo(Mo,e,s),Fo.hasHighPosition(t)?Fo.setTransform(t,Mo,!1,i):t.set({x:t.x+Mo.e-r.e,y:t.y+Mo.f-r.f,rotation:w.formatRotation(t.rotation+s)},i)},skewOfWorld(t,e,s,i,r,o){Fo.skewOfLocal(t,Ho(t,e),s,i,r,o)},skewOfLocal(t,e,s,i=0,r,o){Ro(Mo,t.__localMatrix),Eo(Mo,e,s,i),Fo.setTransform(t,Mo,r,o)},transformWorld(t,e,s,i){Ro(Mo,t.worldTransform),Io(Mo,e),t.parent&&Oo(Mo,t.parent.scrollWorldTransform),Fo.setTransform(t,Mo,s,i)},transform(t,e,s,i){Ro(Mo,t.localTransform),Io(Mo,e),Fo.setTransform(t,Mo,s,i)},setTransform(t,e,s,i){const r=t.__,o=r.origin&&Fo.getInnerOrigin(t,r.origin),n=Ao(e,o,r.around&&Fo.getInnerOrigin(t,r.around));if(Fo.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){Rt.scale(t.boxBounds,Math.abs(e),Math.abs(s));const i=Fo.getInnerOrigin(t,r.origin);V.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 To(s,Fo.getLocalOrigin(t,"center"),-1*i,1*i),s},getLocalOrigin:(t,e)=>V.tempToOuterOf(Fo.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const s={};return nt.toPoint(e,t.boxBounds,s),s},getRelativeWorld:(t,e,s)=>(Ro(Mo,t.worldTransform),Oo(Mo,e.scrollWorldTransform),s?Mo:Object.assign({},Mo)),drop(t,e,s,i){t.setTransform(Fo.getRelativeWorld(t,e,!0),i),e.add(t,s)},hasHighPosition:t=>t.origin||t.around||Fo.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(()=>Fo.animateMove(t,s,i))}}},Fo=Do,{updateAllMatrix:zo,updateMatrix:Uo,updateAllWorldOpacity:No,updateAllChange:Yo,updateChange:Xo}=Fo;function Ho(t,e){return t.parent?V.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const Go={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)=>jo(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>jo(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>jo(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 Vo;function jo(t,e){return e||(Vo=0),t.__.mask&&(Vo=1),Vo<0?null:(Vo&&(Vo=-1),!0)}const{updateBounds:qo}=Do,Qo={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),Jo(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++)$o(e[t],e)},updateBounds(t,e){const s=[t];$o(t,s),Zo(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++)qo(i[t]);e&&e===s||qo(s)}}},{pushAllChildBranch:Jo,pushAllBranchStack:$o,updateBoundsByBranchStack:Zo}=Qo,Ko={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:tn,updateBounds:en}=Do,{toOuterOf:sn,getPoints:rn,copy:on}=Rt,nn="_localContentBounds",an="_worldContentBounds",hn="_worldBoxBounds",ln="_worldStrokeBounds";class dn{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 sn(this.contentBounds,this.leaf.__localMatrix,this[nn]||(this[nn]={})),this[nn]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return sn(this.contentBounds,this.leaf.__world,this[an]||(this[an]={})),this[an]}get worldBoxBounds(){return sn(this.boxBounds,this.leaf.__world,this[hn]||(this[hn]={})),this[hn]}get worldStrokeBounds(){return sn(this.strokeBounds,this.leaf.__world,this[ln]||(this[ln]={})),this[ln]}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 en(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 M.defaultMatrix;case"page":t=e.zoomLayer;default:return tn(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 Lt(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=M.defaultMatrix;break;case"page":e=i.zoomLayer;default:r=i.getWorldPoint(a,e),o=tn(i,e,!0)}if(n||(n=M.getLayout(o)),on(n,a),V.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=rn(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.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.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 cn{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 un extends cn{constructor(t,e,s){super(t,e),this.parent=s,this.child=e}}un.ADD="child.add",un.REMOVE="child.remove",un.CREATED="created",un.MOUNTED="mounted",un.UNMOUNTED="unmounted",un.DESTROY="destroy";const _n="property.scroll";class pn extends cn{constructor(t,e,s,i,r){super(t,e),this.attrName=s,this.oldValue=i,this.newValue=r}}pn.CHANGE="property.change",pn.LEAFER_CHANGE="property.leafer_change",pn.SCROLL=_n;const fn={scrollX:_n,scrollY:_n};class gn extends cn{constructor(t,e){super(t),Object.assign(this,e)}}gn.LOAD="image.load",gn.LOADED="image.loaded",gn.ERROR="image.error";class yn extends cn{static checkHas(t,e,s){"on"===s?e===vn?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(mn)||t.hasEvent(xn)||t.hasEvent(wn),t.__hasWorldEvent=t.hasEvent(vn))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(mn,t),"inner"===e&&t.emit(xn,t)),t.emit(wn,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(vn,this)}}yn.RESIZE="bounds.resize",yn.INNER="bounds.inner",yn.LOCAL="bounds.local",yn.WORLD="bounds.world";const{RESIZE:mn,INNER:xn,LOCAL:wn,WORLD:vn}=yn,bn={};[mn,xn,wn,vn].forEach(t=>bn[t]=1);class Bn extends cn{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(Bn.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!o(this.resizingKeys[t.innerId])}}Bn.RESIZE="resize";class kn extends cn{constructor(t,e){super(t),this.data=e}}kn.REQUEST="watch.request",kn.DATA="watch.data";class Sn extends cn{constructor(t,e,s){super(t),e&&(this.data=e,this.times=s)}}Sn.REQUEST="layout.request",Sn.START="layout.start",Sn.BEFORE="layout.before",Sn.LAYOUT="layout",Sn.AFTER="layout.after",Sn.AGAIN="layout.again",Sn.END="layout.end";class Rn extends cn{constructor(t,e,s,i){super(t),e&&(this.times=e),s&&(this.renderBounds=s,this.renderOptions=i)}}Rn.REQUEST="render.request",Rn.CHILD_START="render.child_start",Rn.CHILD_END="render.child_end",Rn.START="render.start",Rn.BEFORE="render.before",Rn.RENDER="render",Rn.AFTER="render.after",Rn.AGAIN="render.again",Rn.END="render.end",Rn.NEXT="render.next";class Cn extends cn{}Cn.START="leafer.start",Cn.BEFORE_READY="leafer.before_ready",Cn.READY="leafer.ready",Cn.AFTER_READY="leafer.after_ready",Cn.VIEW_READY="leafer.view_ready",Cn.VIEW_COMPLETED="leafer.view_completed",Cn.STOP="leafer.stop",Cn.RESTART="leafer.restart",Cn.END="leafer.end",Cn.TRANSFORM="leafer.transform",Cn.MOVE="leafer.move",Cn.SCALE="leafer.scale",Cn.ROTATE="leafer.rotate",Cn.SKEW="leafer.skew";const{MOVE:Pn,SCALE:Tn,ROTATE:Ln,SKEW:En}=Cn,In={x:Pn,y:Pn,scaleX:Tn,scaleY:Tn,rotation:Ln,skewX:En,skewY:En},On={};class An{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=Mn(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],bn[t]&&yn.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=Mn(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],bn[t]&&yn.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&&qt.has(t)&&(e=qt.get(t,{type:t,target:this,current:this}));const i=Mn(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 Mn(t,e,s){if(e){const{__captureMap:e}=t;return e||(s?t.__captureMap={}:On)}{const{__bubbleMap:e}=t;return e||(s?t.__bubbleMap={}:On)}}const{on:Wn,on_:Dn,off:Fn,off_:zn,once:Un,emit:Nn,emitEvent:Yn,hasEvent:Xn,destroy:Hn}=An.prototype,Gn={on:Wn,on_:Dn,off:Fn,off_:zn,once:Un,emit:Nn,emitEvent:Yn,hasEvent:Xn,destroyEventer:Hn},Vn=Mt.get("setAttr"),jn={__setAttr(t,e,s){if(this.leaferIsCreated){const i=this.__.__getInput(t);if(!s||h(e)||o(e)||(Vn.warn(this.innerName,t,e),e=void 0),u(e)||i!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new pn(pn.LEAFER_CHANGE,this,t,i,e));const s=In[t];s&&(this.emitEvent(new Cn(s,this)),this.emitEvent(new Cn(Cn.TRANSFORM,this)))}this.emitPropertyEvent(pn.CHANGE,t,i,e);const s=fn[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 pn(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:qn,multiplyParent:Qn,translateInner:Jn,defaultWorld:$n}=M,{toPoint:Zn,tempPoint:Kn}=nt,ta={__updateWorldMatrix(){const{parent:t,__layout:e,__world:s,__scrollWorld:i,__:r}=this;Qn(this.__local||e,t?t.__scrollWorld||t.__world:$n,s,!!e.affectScaleOrRotation,r),i&&Jn(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)&&(qn(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)&&(Zn(s.around||s.origin,t.boxBounds,Kn),Jn(e,-Kn.x,-Kn.y,!s.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:ea,updateAllMatrix:sa}=Do,{updateBounds:ia}=Qo,{toOuterOf:ra,copyAndSpread:oa,copy:na}=Rt,{toBounds:aa}=ur,ha={__updateWorldBounds(){const t=this.__layout;ra(t.renderBounds,this.__world,this.__world),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&yn.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&yn.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(),ra(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){ra(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){ra(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const s=this.__layout.boxBounds,i=this.__;i.__pathInputed?aa(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(),sa(this),ia(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(sa(this),ia(this,this))):ea(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;oa(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout;e.renderSpread>0?oa(e.renderBounds,e.boxBounds,e.renderSpread):na(e.renderBounds,e.strokeBounds)}},la={__render(t,e){if(e.shape)return this.__renderShape(t,e);if(this.__worldOpacity){const s=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),Do.copyCanvasByWorld(this,t,i,this.__nowWorld,s.__blendMode,!0),i.recycle(this.__nowWorld)}else this.__draw(t,e);Mt.showBounds&&Mt.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:da}=Go,ca={__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.dim?e.dimOpacity=!0===s.dim?.2:s.dim:s.dimskip&&e.dimOpacity&&(e.dimOpacity=0),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++)da(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++)da(s[i],e)||s[i].__clip(t,e)}}},ua={},{LEAF:_a,create:pa}=s,{toInnerPoint:fa,toOuterPoint:ga,multiplyParent:ya}=M,{toOuterOf:ma}=Rt,{copy:xa,move:wa}=V,{moveLocal:va,zoomOfLocal:ba,rotateOfLocal:Ba,skewOfLocal:ka,moveWorld:Sa,zoomOfWorld:Ra,rotateOfWorld:Ca,skewOfWorld:Pa,transform:Ta,transformWorld:La,setTransform:Ea,getFlipTransform:Ia,getLocalOrigin:Oa,getRelativeWorld:Aa,drop:Ma}=Do;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 dn}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=pa(_a),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(un.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(un.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(un.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(un.MOUNTED)):this.__emitLifeEvent(un.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 ya(s,t.matrix,e,void 0,s),ma(this.__layout.renderBounds,e,e),e.half!==s.half&&(e.half=s.half),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}=Er.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),ua.scaleX=s,ua.scaleY=i,ua}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?Aa(this,e):this.worldTransform,r=s?t:{};return ma(t,i,r),r}worldToLocal(t,e,s,i){this.parent?this.parent.worldToInner(t,e,s,i):e&&xa(e,t)}localToWorld(t,e,s,i){this.parent?this.parent.innerToWorld(t,e,s,i):e&&xa(e,t)}worldToInner(t,e,s,i){i&&(i.innerToWorld(t,e,s),t=e||t),fa(this.worldTransform,t,e,s)}innerToWorld(t,e,s,i){ga(this.worldTransform,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){Ea(this,t,e,s)}transform(t,e,s){Ta(this,t,e,s)}move(t,e,s){va(this,t,e,s)}moveInner(t,e,s){Sa(this,t,e,!0,s)}scaleOf(t,e,s,i,r){ba(this,Oa(this,t),e,s,i,r)}rotateOf(t,e,s){Ba(this,Oa(this,t),e,s)}skewOf(t,e,s,i,r){ka(this,Oa(this,t),e,s,i,r)}transformWorld(t,e,s){La(this,t,e,s)}moveWorld(t,e,s){Sa(this,t,e,!1,s)}scaleOfWorld(t,e,s,i,r){Ra(this,t,e,s,i,r)}rotateOfWorld(t,e){Ca(this,t,e)}skewOfWorld(t,e,s,i,r){Pa(this,t,e,s,i,r)}flip(t,e){Ta(this,Ia(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 Yt.need("path")}getMotionPoint(t){return Yt.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){Ma(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):yo(this.prototype,t,e)}static addAttr(t,e,s,i){s||(s=Jr),s(e,i)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new un(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(un.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}},t.Leaf=$t([ko(jn),ko(ta),ko(ha),ko(Gn),ko(la)],t.Leaf);const{setListWithFn:Wa}=Rt,{sort:Da}=Qo,{localBoxBounds:Fa,localStrokeBounds:za,localRenderBounds:Ua,maskLocalBoxBounds:Na,maskLocalStrokeBounds:Ya,maskLocalRenderBounds:Xa}=Go,Ha=new Mt("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){Wa(e||this.__layout.boxBounds,this.children,this.__hasMask?Na:Fa)}__updateStrokeBounds(t){Wa(t||this.__layout.strokeBounds,this.children,this.__hasMask?Ya:za)}__updateRenderBounds(t){Wa(t||this.__layout.renderBounds,this.children,this.__hasMask?Xa:Ua)}__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(Da),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return Ha.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=Gt.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(un.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(un.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(un.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(un.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const s=new un(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),this.leafer.emitEvent(s)}},t.Branch=$t([ko(ca)],t.Branch);class Ga{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 Ga;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 Va{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 ja=Mt.get("LeaferCanvas");class qa extends ce{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.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 ja.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;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,s){if(this.resizeListener=s,t){this.autoBounds=t;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),ja.warn("no parent"))}catch(t){this.imitateResizeObserver()}}else 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})}})}imitateResizeObserver(){this.autoLayout&&(this.parentView&&this.checkAutoBounds(this.parentView.getBoundingClientRect()),e.requestRender(this.imitateResizeObserver.bind(this)))}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,de),this.resize(t),this.resizeListener&&!o(this.width)&&this.resizeListener(new Bn(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.windowListener&&(window.removeEventListener("resize",this.windowListener),this.windowListener=null),!this.unreal){const t=this.view;t.parentElement&&t.remove()}super.destroy()}}}br(CanvasRenderingContext2D.prototype),br(Path2D.prototype);const{mineType:Qa,fileType:Ja}=Br;function $a(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=Qa(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,Qa(e),s)),canvasSaveAs:(t,s,i)=>{const r=t.toDataURL(Qa(Ja(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=Xt.canvas(),e.conicGradientSupport=!!e.canvas.context.createConicGradient}Object.assign(Xt,{canvas:(t,e)=>new qa(t,e),image:t=>new Dr(t)}),e.name="web",e.isMobile="ontouchstart"in window,e.requestRender=function(t){window.requestAnimationFrame(t)},Fr(e,"devicePixelRatio",{get:()=>devicePixelRatio});const{userAgent:Za}=navigator;Za.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),Za.indexOf("Windows")>-1?(e.os="Windows",e.intWheelDeltaY=!0):Za.indexOf("Mac")>-1?e.os="Mac":Za.indexOf("Linux")>-1&&(e.os="Linux");class Ka{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new Ga;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 Ga,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(Rn.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===un.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 kn(kn.DATA,{updatedList:this.updatedList})),this.__updatedList=new Ga,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[pn.CHANGE,this.__onAttrChange,this],[[un.ADD,un.REMOVE],this.__onChildEvent,this],[kn.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:th,updateBounds:eh,updateChange:sh}=Do,{pushAllChildBranch:ih,pushAllParent:rh}=Qo;const{worldBounds:oh}=Go;class nh{constructor(t){this.updatedBounds=new Lt,this.beforeBounds=new Lt,this.afterBounds=new Lt,c(t)&&(t=new Ga(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,oh)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,oh),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:ah,updateAllChange:hh}=Do,lh=Mt.get("Layouter");class dh{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new Va,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(Sn.START),this.layoutOnce(),t.emitEvent(new Sn(Sn.END,this.layoutedBlocks,this.times))}catch(t){lh.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?lh.warn("layouting"):this.times>3?lh.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(kn.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=zt.start("PartLayout"),{target:s,__updatedList:i}=this,{BEFORE:r,LAYOUT:o,AFTER:n}=Sn,a=this.getBlocks(i);a.forEach(t=>t.setBefore()),s.emitEvent(new Sn(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?(th(t,!0),e.add(t),t.isBranch&&ih(t,e),rh(t,e)):s.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),rh(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||eh(i[t])}eh(s)}})}(this.__levelList),function(t){t.list.forEach(sh)}(i),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),s.emitEvent(new Sn(o,a,this.times)),s.emitEvent(new Sn(n,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,zt.end(e)}fullLayout(){const t=zt.start("FullLayout"),{target:e}=this,{BEFORE:s,LAYOUT:i,AFTER:r}=Sn,o=this.getBlocks(new Ga(e));e.emitEvent(new Sn(s,o,this.times)),dh.fullLayout(e),o.forEach(t=>{t.setAfter()}),e.emitEvent(new Sn(i,o,this.times)),e.emitEvent(new Sn(r,o,this.times)),this.addBlocks(o),zt.end(t)}static fullLayout(t){ah(t,!0),t.isBranch?Qo.updateBounds(t):Do.updateBounds(t),hh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:s}=this.extraBlock||(this.extraBlock=new nh([]));e.length?s.add(t.__world):s.set(t.__world),e.add(t)}}createBlock(t){return new nh(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_([[Sn.REQUEST,this.layout,this],[Sn.AGAIN,this.layoutAgain,this],[kn.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const ch=Mt.get("Renderer");class uh{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:60},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(Sn.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(Rn.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(Rn.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(Rn.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new Lt,ch.log(e.innerName,"---\x3e");try{this.emitRender(Rn.START),this.renderOnce(t),this.emitRender(Rn.END,this.totalBounds),Er.clearRecycled()}catch(t){this.rendering=!1,ch.error(t)}ch.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return ch.warn("rendering");if(this.times>3)return ch.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Lt,this.renderOptions={},t)this.emitRender(Rn.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(Rn.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(Rn.RENDER,this.renderBounds,this.renderOptions),this.emitRender(Rn.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=zt.start("PartRender"),{canvas:s}=this,i=t.getIntersect(s.bounds),r=new Lt(i);s.save(),i.spread(uh.clipSpread).ceil(),s.clearWorld(i),s.clipWorld(i),this.__render(i,r),s.restore(),zt.end(e)}fullRender(){const t=zt.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),zt.end(t)}__render(t,e){const{canvas:s}=this,i=t.includes(this.target.__world),r=i?{includes:i}:{bounds:t,includes:i};this.needFill&&s.fillWorld(t,this.config.fill),Mt.showRepaint&&Mt.drawRepaint(s,t),this.target.__render(s,r),this.renderBounds=e=e||t,this.renderOptions=r,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),s.updateRender(e)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new Lt;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);const s=this.requestTime=Date.now();e.requestRender(()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-s))),this.requestTime=0,this.checkRender()})}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:s}=t.old;if(!new Lt(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 Lt(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||ch.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 Rn(t,this.times,e,s))}__listenEvents(){this.__eventIds=[this.target.on_([[Rn.REQUEST,this.update,this],[Sn.END,this.__onLayoutEnd,this],[Rn.AGAIN,this.renderAgain,this],[Bn.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.canvas=this.config=null)}}function _h(t){return Nr(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function ph(t){return Nr(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function fh(){return(t,e)=>{const s="_"+e;Fr(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}})}}uh.clipSpread=10,Object.assign(Xt,{watcher:(t,e)=>new Ka(t,e),layouter:(t,e)=>new dh(t,e),renderer:(t,e,s)=>new uh(t,e,s),selector:(t,e)=>{},interaction:(t,e,s,i)=>{}}),e.layout=dh.fullLayout;const gh={},yh={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}},mh={number:(t,e)=>u(t)?"percent"===t.type?t.value*e:t.value:t},xh={},wh={},vh={},bh={},Bh={},kh={apply(){Yt.need("filter")}},Sh={},Rh={setStyleName:()=>Yt.need("state"),set:()=>Yt.need("state")},Ch={list:{},register(t,e){Ch.list[t]=e},get:t=>Ch.list[t]},{parse:Ph,objectToCanvasData:Th}=Os,{stintSet:Lh}=p,{hasTransparent:Eh}=yh,Ih={},Oh=Mt.get("UIData");class Ah 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,Oh.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,Oh.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),a(t)||!t?(Lh(this,"__isTransparentFill",Eh(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):u(t)&&this.__setPaint("fill",t)}setStroke(t){a(t)||!t?(Lh(this,"__isTransparentStroke",Eh(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?Ph(t):Th(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){Mh(this,"shadow",t)}setInnerShadow(t){Mh(this,"innerShadow",t)}setFilter(t){Mh(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=Ih)):(this.__isStrokes=!0,this._stroke||(this._stroke=Ih))}__removePaint(t,e){e&&this.__removeInput(t),vh.recycleImage(t,this),"fill"===t?(Lh(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(Lh(this,"__isAlphaPixelStroke",void 0),Lh(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function Mh(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 Wh extends Ah{}class Dh extends Wh{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 Fh extends Wh{__getInputData(t,e){const s=super.__getInputData(t,e);return de.forEach(t=>delete s[t]),s}}class zh extends Dh{}class Uh extends Ah{}class Nh extends Ah{get __boxStroke(){return!this.__pathInputed}}class Yh extends Ah{get __boxStroke(){return!this.__pathInputed}}class Xh extends Ah{}class Hh extends Ah{}class Gh extends Ah{get __pathInputed(){return 2}}class Vh extends Wh{}const jh={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class qh extends Ah{get __useNaturalRatio(){return!1}setFontWeight(t){a(t)?(this.__setInput("fontWeight",t),t=jh[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=Gt.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(),o.renderChanged&&r.renderChange(),s.__updateChange()}else s&&(e.__box=s.parent=null,s.destroy());this._boxStyle=t}}class Qh extends Nh{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 Jh extends Nh{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 $h={__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=Math.max(o.__layout.strokeSpread=o.__updateStrokeSpread(),t),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.__;e&&e.forEach(e=>t=Math.max(t,Math.max(Math.abs(e.y),Math.abs(e.x))+(e.spread>0?e.spread:0)+1.5*e.blur)),i&&(t=Math.max(t,i)),o&&(t+=kh.getSpread(o)),n&&(t+=n);let a=t=Math.ceil(t);return s&&s.forEach(t=>a=Math.max(a,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur)),r&&(a=Math.max(a,r)),this.__layout.renderShapeSpread=a,t+=this.__layout.strokeSpread||0,this.__box?Math.max(this.__box.__updateRenderSpread(),t):t}},Zh={getValidMove(t,e,s,i,r){const o=t.x+i.x,n=t.y+i.y,a=o+t.width,h=n+t.height,l=e.x+e.width,d=e.y+e.height;r||(i=Object.assign({},i));const c=t.width>e.width,u=t.height>e.height;return c&&"outer"!==s?o>e.x?i.x+=e.x-o:a<l&&(i.x+=l-a):o<e.x?i.x+=e.x-o:a>l&&(i.x+=l-a),u&&"outer"!==s?n>e.y?i.y+=e.y-n:h<d&&(i.y+=d-h):n<e.y?i.y+=e.y-n:h>d&&(i.y+=d-h),i.x=w.float(i.x),i.y=w.float(i.y),i},axisMove(t,e){const{draggable:s}=t;"x"===s&&(e.y=0),"y"===s&&(e.x=0)},limitMove(t,e){const{dragBounds:s,dragBoundsType:i}=t;s&&Kh.getValidMove(t.__localBoxBounds,"parent"===s?t.parent.boxBounds:s,i,e,!0),Kh.axisMove(t,e)}},Kh=Zh,{stintSet:tl}=p,el={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);tl(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),tl(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;tl(t,"__isFastShadow",e&&!r&&e.length<2&&!e[0].spread&&s&&!t.__isTransparentFill&&!(c(s)&&s.length>1)&&(this.useFastShadow||!i||i&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!r)}t.__checkSingle(),tl(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){sl(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&&Bh.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&&Bh.innerShadow(this,t,h),o&&!a&&(i.__isStrokes?wh.strokes(o,this,t):wh.stroke(o,this,t)),c&&kh.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,yh.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?sl(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 sl(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 il={__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 rl,ol;t.UI=rl=class extends t.Leaf{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){w.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 wr.set(this.path=t||[]),t||this.__drawPathByBox(wr),wr}constructor(t){super(t)}reset(t){}set(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):Object.assign(this,t))}get(t){return a(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return Yt.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return Yt.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let s=e?this.__.__pathForRender:this.__.path;return s||(wr.set(s=[]),this.__drawPathByBox(wr)),t?Os.toCanvasData(s,!0):s}getPathString(t,e,s){return Os.stringify(this.getPath(t,e),s)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||Sh.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?xr.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&xh.addArrows(this,!t.cornerRadius)):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?Ai.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 Yt.need("animate")}killAnimate(t,e){}export(t,e){return Yt.need("export")}syncExport(t,e){return Yt.need("export")}clone(t){const e=p.clone(this.toJSON());return t&&Object.assign(e,t),rl.one(e)}static one(t,e,s,i,r){return Gt.get(t.tag||this.prototype.__tag,t,e,s,i,r)}static registerUI(){So()(this)}static registerData(t){go(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}},$t([go(Ah)],t.UI.prototype,"__",void 0),$t([fh()],t.UI.prototype,"zoomLayer",void 0),$t([Hr("")],t.UI.prototype,"id",void 0),$t([Hr("")],t.UI.prototype,"name",void 0),$t([Hr("")],t.UI.prototype,"className",void 0),$t([oo("pass-through")],t.UI.prototype,"blendMode",void 0),$t([no(1)],t.UI.prototype,"opacity",void 0),$t([ao(!0)],t.UI.prototype,"visible",void 0),$t([oo(!1)],t.UI.prototype,"locked",void 0),$t([oo(!1)],t.UI.prototype,"dim",void 0),$t([oo(!1)],t.UI.prototype,"dimskip",void 0),$t([co(0)],t.UI.prototype,"zIndex",void 0),$t([uo(!1)],t.UI.prototype,"mask",void 0),$t([_o(!1)],t.UI.prototype,"eraser",void 0),$t([Gr(0,!0)],t.UI.prototype,"x",void 0),$t([Gr(0,!0)],t.UI.prototype,"y",void 0),$t([Jr(100,!0)],t.UI.prototype,"width",void 0),$t([Jr(100,!0)],t.UI.prototype,"height",void 0),$t([qr(1,!0)],t.UI.prototype,"scaleX",void 0),$t([qr(1,!0)],t.UI.prototype,"scaleY",void 0),$t([Qr(0,!0)],t.UI.prototype,"rotation",void 0),$t([Qr(0,!0)],t.UI.prototype,"skewX",void 0),$t([Qr(0,!0)],t.UI.prototype,"skewY",void 0),$t([Gr(0,!0)],t.UI.prototype,"offsetX",void 0),$t([Gr(0,!0)],t.UI.prototype,"offsetY",void 0),$t([Vr(0,!0)],t.UI.prototype,"scrollX",void 0),$t([Vr(0,!0)],t.UI.prototype,"scrollY",void 0),$t([jr()],t.UI.prototype,"origin",void 0),$t([jr()],t.UI.prototype,"around",void 0),$t([Hr(!1)],t.UI.prototype,"lazy",void 0),$t([$r(1)],t.UI.prototype,"pixelRatio",void 0),$t([ro(0)],t.UI.prototype,"renderSpread",void 0),$t([Kr()],t.UI.prototype,"path",void 0),$t([to()],t.UI.prototype,"windingRule",void 0),$t([to(!0)],t.UI.prototype,"closed",void 0),$t([Jr(0)],t.UI.prototype,"padding",void 0),$t([Jr(!1)],t.UI.prototype,"lockRatio",void 0),$t([Jr()],t.UI.prototype,"widthRange",void 0),$t([Jr()],t.UI.prototype,"heightRange",void 0),$t([Hr(!1)],t.UI.prototype,"draggable",void 0),$t([Hr()],t.UI.prototype,"dragBounds",void 0),$t([Hr("auto")],t.UI.prototype,"dragBoundsType",void 0),$t([Hr(!1)],t.UI.prototype,"editable",void 0),$t([po(!0)],t.UI.prototype,"hittable",void 0),$t([po("path")],t.UI.prototype,"hitFill",void 0),$t([io("path")],t.UI.prototype,"hitStroke",void 0),$t([po(!1)],t.UI.prototype,"hitBox",void 0),$t([po(!0)],t.UI.prototype,"hitChildren",void 0),$t([po(!0)],t.UI.prototype,"hitSelf",void 0),$t([po()],t.UI.prototype,"hitRadius",void 0),$t([fo("")],t.UI.prototype,"cursor",void 0),$t([oo()],t.UI.prototype,"fill",void 0),$t([io(void 0,!0)],t.UI.prototype,"stroke",void 0),$t([io("inside")],t.UI.prototype,"strokeAlign",void 0),$t([io(1,!0)],t.UI.prototype,"strokeWidth",void 0),$t([io(!1)],t.UI.prototype,"strokeWidthFixed",void 0),$t([io("none")],t.UI.prototype,"strokeCap",void 0),$t([io("miter")],t.UI.prototype,"strokeJoin",void 0),$t([io()],t.UI.prototype,"dashPattern",void 0),$t([io(0)],t.UI.prototype,"dashOffset",void 0),$t([io(10)],t.UI.prototype,"miterLimit",void 0),$t([to(0)],t.UI.prototype,"cornerRadius",void 0),$t([to()],t.UI.prototype,"cornerSmoothing",void 0),$t([_h()],t.UI.prototype,"shadow",void 0),$t([_h()],t.UI.prototype,"innerShadow",void 0),$t([_h()],t.UI.prototype,"blur",void 0),$t([_h()],t.UI.prototype,"backgroundBlur",void 0),$t([_h()],t.UI.prototype,"grayscale",void 0),$t([_h()],t.UI.prototype,"filter",void 0),$t([oo()],t.UI.prototype,"placeholderColor",void 0),$t([Hr(100)],t.UI.prototype,"placeholderDelay",void 0),$t([Hr({})],t.UI.prototype,"data",void 0),$t([vo(t.Leaf.prototype.reset)],t.UI.prototype,"reset",null),t.UI=rl=$t([ko($h),ko(el),bo()],t.UI),t.Group=class extends t.UI{get __tag(){return"Group"}get isBranch(){return!0}constructor(t){super(t)}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(){}},$t([go(Wh)],t.Group.prototype,"__",void 0),$t([Jr(0)],t.Group.prototype,"width",void 0),$t([Jr(0)],t.Group.prototype,"height",void 0),t.Group=$t([ko(t.Branch),So()],t.Group);const nl=Mt.get("Leafer");t.Leafer=ol=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&&Tr.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),ol.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=Xt.canvas(i);this.__controllers.push(this.renderer=Xt.renderer(this,r,i),this.watcher=Xt.watcher(this,i),this.layouter=Xt.layouter(this,i)),this.isApp&&this.__setApp(),this.__checkAutoLayout(i,e),this.view=r.view,e||(this.selector=Xt.selector(this),this.interaction=Xt.interaction(this,r,this.selector,i),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=Xt.hitCanvasManager()),this.canvasManager=new Jt,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))),Ko.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(Cn.RESTART):this.emitLeafer(Cn.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(Cn.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=p.copyAttrs({},t,de);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:s}=this;s&&(s.addBlock(t?new Lt(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,de);e.resize(t),this.updateLazyBounds(),this.__onResize(new Bn(t,s))}__onResize(t){this.emitEvent(t),p.copyAttrs(this.__,t,de),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(t,e){e||(t.width&&t.height||(this.autoLayout=new It(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(de.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()))),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&de.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const s=p.copyAttrs({},this.canvas,de);s[t]=this.config[t]=e,e&&this.canvas.stopAutoLayout(),this.__doResize(s)}__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(Cn.BEFORE_READY),this.emitLeafer(Cn.READY),this.emitLeafer(Cn.AFTER_READY),Ko.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(Cn.VIEW_READY),Ko.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){Ko.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(Cn.VIEW_COMPLETED),Ko.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 Yt.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 Cn(t,this))}__listenEvents(){const t=zt.start("FirstCreate "+this.innerName);this.once([[Cn.START,()=>zt.end(t)],[Sn.START,this.updateLazyBounds,this],[Rn.START,this.__onCreated,this],[Rn.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[kn.DATA,this.__onWatchData,this],[Sn.END,this.__onLayoutEnd,this],[Rn.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){ol.list.remove(this);try{this.stop(),this.emitLeafer(Cn.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.destroy()),this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{Er.clearRecycled()},100)}catch(t){nl.error(t)}}};t?e():setTimeout(e)}},t.Leafer.list=new Ga,$t([go(Fh)],t.Leafer.prototype,"__",void 0),$t([Jr()],t.Leafer.prototype,"pixelRatio",void 0),t.Leafer=ol=$t([So()],t.Leafer),t.Rect=class extends t.UI{get __tag(){return"Rect"}constructor(t){super(t)}},$t([go(Nh)],t.Rect.prototype,"__",void 0),t.Rect=$t([ko(il),bo(),So()],t.Rect);const{add:al,includes:hl,scroll:ll}=Rt,dl=t.Rect.prototype,cl=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;if(this.children.length){const e=this.__,s=this.__layout,{renderBounds:i,boxBounds:r}=s,o=s.childrenRenderBounds||(s.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(o),e.overflow.includes("scroll")&&(al(o,r),ll(o,e)),this.__updateRectRenderBounds(),t=!hl(r,o),t&&"show"===e.overflow&&al(i,o)}else this.__updateRectRenderBounds();p.stintSet(this,"isOverflow",t),this.__checkScroll()}__updateRectRenderBounds(){}__updateWorldBounds(){this.hasScroller&&this.__updateScroll(),super.__updateWorldBounds()}__checkScroll(){}__updateScroll(){}__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))}},$t([go(Dh)],t.Box.prototype,"__",void 0),$t([Jr(100)],t.Box.prototype,"width",void 0),$t([Jr(100)],t.Box.prototype,"height",void 0),$t([Hr(!1)],t.Box.prototype,"resizeChildren",void 0),$t([ro("show")],t.Box.prototype,"overflow",void 0),$t([vo(dl.__updateStrokeSpread)],t.Box.prototype,"__updateStrokeSpread",null),$t([vo(dl.__updateRenderSpread)],t.Box.prototype,"__updateRectRenderSpread",null),$t([vo(dl.__updateBoxBounds)],t.Box.prototype,"__updateRectBoxBounds",null),$t([vo(dl.__updateStrokeBounds)],t.Box.prototype,"__updateStrokeBounds",null),$t([vo(dl.__updateRenderBounds)],t.Box.prototype,"__updateRectRenderBounds",null),$t([vo(dl.__updateChange)],t.Box.prototype,"__updateRectChange",null),$t([vo(dl.__render)],t.Box.prototype,"__renderRect",null),$t([vo(cl.__render)],t.Box.prototype,"__renderGroup",null),t.Box=$t([bo(),So()],t.Box),t.Frame=class extends t.Box{get __tag(){return"Frame"}get isFrame(){return!0}constructor(t){super(t)}},$t([go(zh)],t.Frame.prototype,"__",void 0),$t([oo("#FFFFFF")],t.Frame.prototype,"fill",void 0),$t([ro("hide")],t.Frame.prototype,"overflow",void 0),t.Frame=$t([So()],t.Frame);const{moveTo:ul,closePath:_l,ellipse:pl}=si;t.Ellipse=class extends t.UI{get __tag(){return"Ellipse"}constructor(t){super(t)}__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&&_l(h)):(i<1&&(pl(h,n,a,n*i,a*i),ul(h,t,a)),pl(h,n,a,n,a,0,360,0,!0)),e.ellipseToCurve&&(this.__.path=this.getPath(!0))):r||o?(ul(h,n,a),pl(h,n,a,n,a,0,r,o,!1),_l(h)):pl(h,n,a,n,a)}},$t([go(Yh)],t.Ellipse.prototype,"__",void 0),$t([to(0)],t.Ellipse.prototype,"innerRadius",void 0),$t([to(0)],t.Ellipse.prototype,"startAngle",void 0),$t([to(0)],t.Ellipse.prototype,"endAngle",void 0),t.Ellipse=$t([So()],t.Ellipse);const{moveTo:fl,lineTo:gl,drawPoints:yl}=si,{rotate:ml,getAngle:xl,getDistance:wl,defaultPoint:vl}=V,{toBounds:bl}=ur;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&&ml(s,e),s}set toPoint(t){this.width=wl(vl,t),this.rotation=xl(vl,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__,e=t.path=[];t.points?yl(e,t.points,!1,t.closed):(fl(e,0,0),gl(e,this.width,0))}__updateRenderPath(){const t=this.__;!this.pathInputed&&t.points&&t.curve?(yl(t.__pathForRender=[],t.points,t.curve,t.closed),t.__useArrow&&xh.addArrows(this,!1)):super.__updateRenderPath()}__updateBoxBounds(){this.points?bl(this.__.__pathForRender,this.__layout.boxBounds):super.__updateBoxBounds()}},$t([go(Uh)],t.Line.prototype,"__",void 0),$t([eo("center")],t.Line.prototype,"strokeAlign",void 0),$t([Jr(0)],t.Line.prototype,"height",void 0),$t([to()],t.Line.prototype,"points",void 0),$t([to(0)],t.Line.prototype,"curve",void 0),$t([to(!1)],t.Line.prototype,"closed",void 0),t.Line=$t([So()],t.Line);const{sin:Bl,cos:kl,PI:Sl}=Math,{moveTo:Rl,lineTo:Cl,closePath:Pl,drawPoints:Tl}=si,Ll=t.Line.prototype;t.Polygon=class extends t.UI{get __tag(){return"Polygon"}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];if(this.__.points)Tl(t,this.__.points,!1,!0);else{const{width:e,height:s,sides:i}=this.__,r=e/2,o=s/2;Rl(t,r,0);for(let e=1;e<i;e++)Cl(t,r+r*Bl(2*e*Sl/i),o-o*kl(2*e*Sl/i));Pl(t)}}__updateRenderPath(){}__updateBoxBounds(){}},$t([go(Xh)],t.Polygon.prototype,"__",void 0),$t([to(3)],t.Polygon.prototype,"sides",void 0),$t([to()],t.Polygon.prototype,"points",void 0),$t([to(0)],t.Polygon.prototype,"curve",void 0),$t([vo(Ll.__updateRenderPath)],t.Polygon.prototype,"__updateRenderPath",null),$t([vo(Ll.__updateBoxBounds)],t.Polygon.prototype,"__updateBoxBounds",null),t.Polygon=$t([bo(),So()],t.Polygon);const{sin:El,cos:Il,PI:Ol}=Math,{moveTo:Al,lineTo:Ml,closePath:Wl}=si;t.Star=class extends t.UI{get __tag(){return"Star"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,corners:s,innerRadius:i}=this.__,r=t/2,o=e/2,n=this.__.path=[];Al(n,r,0);for(let t=1;t<2*s;t++)Ml(n,r+(t%2==0?r:r*i)*El(t*Ol/s),o-(t%2==0?o:o*i)*Il(t*Ol/s));Wl(n)}},$t([go(Hh)],t.Star.prototype,"__",void 0),$t([to(5)],t.Star.prototype,"corners",void 0),$t([to(.382)],t.Star.prototype,"innerRadius",void 0),t.Star=$t([So()],t.Star),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}constructor(t){super(t)}},$t([go(Qh)],t.Image.prototype,"__",void 0),$t([Jr("")],t.Image.prototype,"url",void 0),t.Image=$t([So()],t.Image);const Dl=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=Xt.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new Dr({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new gn(gn.LOADED,{image:t}))})}draw(t,e,s,i){const r=new K(t.worldTransform).invert(),o=new K;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()}},$t([go(Jh)],t.Canvas.prototype,"__",void 0),$t([ph(100)],t.Canvas.prototype,"width",void 0),$t([ph(100)],t.Canvas.prototype,"height",void 0),$t([ph(1)],t.Canvas.prototype,"pixelRatio",void 0),$t([ph(!0)],t.Canvas.prototype,"smooth",void 0),$t([Hr(!1)],t.Canvas.prototype,"safeResize",void 0),$t([ph()],t.Canvas.prototype,"contextSettings",void 0),t.Canvas=$t([So()],t.Canvas);const{copyAndSpread:Fl,includes:zl,spread:Ul,setList:Nl}=Rt;function Yl(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 Xl(t,e){t.__.__font?Yl(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Hl(t,e,s){switch(e.__.strokeAlign){case"center":Gl(t,1,e,s);break;case"inside":Vl(t,"inside",e,s);break;case"outside":e.__.__fillAfterStroke?Gl(t,2,e,s):Vl(t,"outside",e,s)}}function Gl(t,e,s,i){const r=s.__;u(t)?ql(t,e,!0,s,i):(i.setStroke(t,r.__strokeWidth*e,r),jl(s,i))}function Vl(t,e,s,i){const r=i.getSameCanvas(!0,!0);r.font=s.__.__font,Gl(t,2,s,r),r.blendMode="outside"===e?"destination-out":"destination-in",Yl(s,r),r.blendMode="normal",Do.copyCanvasByWorld(s,i,r),r.recycle(s.__nowWorld)}function jl(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 ql(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||!vh.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?jl(i,r):r.stroke(),r.restoreBlendMode()):s?jl(i,r):r.stroke()}}function Ql(t,e,s){const i=e.__;if(i.__strokeWidth)if(i.__font)Hl(t,e,s);else switch(i.strokeAlign){case"center":Jl(t,1,e,s);break;case"inside":!function(t,e,s){s.save(),s.clipUI(e),Jl(t,2,e,s),s.restore()}(t,e,s);break;case"outside":!function(t,e,s){const i=e.__;if(i.__fillAfterStroke)Jl(t,2,e,s);else{const{renderBounds:r}=e.__layout,o=s.getSameCanvas(!0,!0);e.__drawRenderPath(o),Jl(t,2,e,o),o.clipUI(i),o.clearWorld(r),Do.copyCanvasByWorld(e,s,o),o.recycle(e.__nowWorld)}}(t,e,s)}}function Jl(t,e,s,i){const r=s.__;u(t)?ql(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}constructor(t){super(t)}__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=mh.number(e,r),t.__letterSpacing=mh.number(s,r),t.__padding=l?w.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=gh.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&&Ul(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?(Nl(t.__textBoxBounds={},[h,a]),e.renderChanged=!0):t.__textBoxBounds=h}__onUpdateSize(){this.__box&&this.__box.__onUpdateSize(),super.__onUpdateSize()}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;Fl(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__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()}},$t([go(qh)],t.Text.prototype,"__",void 0),$t([Jr(0)],t.Text.prototype,"width",void 0),$t([Jr(0)],t.Text.prototype,"height",void 0),$t([oo()],t.Text.prototype,"boxStyle",void 0),$t([Hr(!1)],t.Text.prototype,"resizeFontSize",void 0),$t([oo("#000000")],t.Text.prototype,"fill",void 0),$t([eo("outside")],t.Text.prototype,"strokeAlign",void 0),$t([po("all")],t.Text.prototype,"hitFill",void 0),$t([Jr("")],t.Text.prototype,"text",void 0),$t([Jr("")],t.Text.prototype,"placeholder",void 0),$t([Jr("caption")],t.Text.prototype,"fontFamily",void 0),$t([Jr(12)],t.Text.prototype,"fontSize",void 0),$t([Jr("normal")],t.Text.prototype,"fontWeight",void 0),$t([Jr(!1)],t.Text.prototype,"italic",void 0),$t([Jr("none")],t.Text.prototype,"textCase",void 0),$t([Jr("none")],t.Text.prototype,"textDecoration",void 0),$t([Jr(0)],t.Text.prototype,"letterSpacing",void 0),$t([Jr({type:"percent",value:1.5})],t.Text.prototype,"lineHeight",void 0),$t([Jr(0)],t.Text.prototype,"paraIndent",void 0),$t([Jr(0)],t.Text.prototype,"paraSpacing",void 0),$t([Jr("x")],t.Text.prototype,"writingMode",void 0),$t([Jr("left")],t.Text.prototype,"textAlign",void 0),$t([Jr("top")],t.Text.prototype,"verticalAlign",void 0),$t([Jr(!0)],t.Text.prototype,"autoSizeAlign",void 0),$t([Jr("normal")],t.Text.prototype,"textWrap",void 0),$t([Jr("show")],t.Text.prototype,"textOverflow",void 0),$t([oo(!1)],t.Text.prototype,"textEditing",void 0),t.Text=$t([So()],t.Text),t.Path=class extends t.UI{get __tag(){return"Path"}constructor(t){super(t)}},$t([go(Gh)],t.Path.prototype,"__",void 0),$t([eo("center")],t.Path.prototype,"strokeAlign",void 0),t.Path=$t([So()],t.Path),t.Pen=class extends t.Group{get __tag(){return"Pen"}constructor(t){super(t)}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")}},$t([go(Vh)],t.Pen.prototype,"__",void 0),$t([(t,e)=>{Fr(t,e,{get(){return this.__path}})}],t.Pen.prototype,"path",void 0),t.Pen=$t([ko(xi,["set","path","paint"]),So()],t.Pen);const{getSpread:$l,getOuterOf:Zl,getByMove:Kl,getIntersectData:td}=Rt;let ed;const{stintSet:sd}=p,{hasTransparent:id}=yh;function rd(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=vh.image(s,t,e,r,!ed||!ed[e.url]);break;case"linear":i=bh.linearGradient(e,r);break;case"radial":i=bh.radialGradient(e,r);break;case"angular":i=bh.conicGradient(e,r);break;case"solid":const{type:n,color:a,opacity:h}=e;i={type:n,style:yh.string(a,h)};break;default:o(e.r)||(i={type:"solid",style:yh.string(e)})}if(i){if(a(i.style)&&id(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 od={compute:function(t,e){const s=e.__,i=[];let r,o,n,a=s.__input[t];c(a)||(a=[a]),ed=vh.recycleImage(t,s);for(let s,r=0,o=a.length;r<o;r++)(s=rd(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?(sd(s,"__isAlphaPixelFill",r),sd(s,"__isTransparentFill",o)):(sd(s,"__isAlphaPixelStroke",r),sd(s,"__isTransparentStroke",o),sd(s,"__hasMultiStrokeStyle",n))},fill:function(t,e,s){s.fillStyle=t,Xl(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(vh.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),Xl(e,s),s.restore()}else i.blendMode?(s.saveBlendMode(i.blendMode),Xl(e,s),s.restoreBlendMode()):Xl(e,s)}},fillPathOrText:Xl,fillText:Yl,stroke:Ql,strokes:function(t,e,s){Ql(t,e,s)},strokeText:Hl,drawTextStroke:jl,shape:function(t,s,i){const r=s.getSameCanvas(),o=t.__nowWorld,n=s.bounds;let a,h,l,d,c,{scaleX:u,scaleY:_}=t.getRenderScaleData(!0);if(n.includes(o))c=r,a=d=o;else{const{renderShapeSpread:r}=t.__layout;let p;if(e.fullImageShadow)p=o;else{const t=r?$l(n,u===_?r*u:[r*_,r*u]):n;p=td(t,o)}l=n.getFitMatrix(p);let{a:f,d:g}=l;l.a<1&&(c=s.getSameCanvas(),t.__renderShape(c,i),u*=f,_*=g),d=Zl(o,l),a=Kl(d,-l.e,-l.f);const y=i.matrix;y?(h=new K(l),h.multiply(y),f*=y.scaleX,g*=y.scaleY):h=l,h.withScale(f,g),i=Object.assign(Object.assign({},i),{matrix:h})}return t.__renderShape(r,i),{canvas:r,matrix:h,fitMatrix:l,bounds:a,worldCanvas:c,shapeBounds:d,scaleX:u,scaleY:_}}};let nd={},ad={a:1,b:0,c:0,d:1,e:0,f:0};const{get:hd,rotateOfOuter:ld,translate:dd,scaleOfOuter:cd,multiplyParent:ud,scale:_d,rotate:pd,skew:fd}=M;function gd(t,e,s,i,r,o,n){const a=hd();dd(a,e.x+s,e.y+i),_d(a,r,o),n&&ld(a,{x:e.x+e.width/2,y:e.y+e.height/2},n),t.transform=a}function yd(t,e,s,i,r,o,n,a,h){const l=hd();xd(l,e,s,i,r,o,n,a),h&&(ad.a=e.width/h.width,ad.d=e.height/h.height,ud(l,ad)),t.transform=l}function md(t,e,s,i,r,o,n,a,h,l,d,c){const u=hd();if(c)xd(u,e,r,o,n,a,h,l);else{if(h)if("center"===d)ld(u,{x:s/2,y:i/2},h);else switch(pd(u,h),h){case 90:dd(u,i,0);break;case 180:dd(u,s,i);break;case 270:dd(u,0,s)}nd.x=e.x+r,nd.y=e.y+o,dd(u,nd.x,nd.y),n&&cd(u,nd,n,a)}t.transform=u}function xd(t,e,s,i,r,o,n,a){n&&pd(t,n),a&&fd(t,a.x,a.y),r&&_d(t,r,o),dd(t,e.x+s,e.y+i)}const{get:wd,translate:vd}=M,bd=new Lt,Bd={},kd={};function Sd(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=Rd(s,i,e)}function Rd(t,e,s){t.padding&&(e=bd.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,v={mode:n},b="center"!==h&&(_||0)%180==90;let B,k;switch(Rt.set(kd,0,0,b?r:i,b?i:r),n&&"cover"!==n&&"fit"!==n?((d||c)&&(w.getScaleData(d,c,s,Bd),B=Bd.scaleX,k=Bd.scaleY),(h||y||g)&&(B&&Rt.scale(kd,B,k,!0),h&<.toPoint(h,kd,e,kd,!0,!0))):x&&!_||(B=k=Rt.getFitScale(e,kd,"fit"!==n),Rt.put(e,s,h,B,!1,kd),Rt.scale(kd,B,k,!0)),l&&V.move(kd,l),n){case"stretch":x||(i=e.width,r=e.height);break;case"normal":case"clip":(kd.x||kd.y||B||f||_||p)&&yd(v,e,kd.x,kd.y,B,k,_,p,t.clipSize);break;case"repeat":(!x||B||_||p)&&md(v,e,i,r,kd.x,kd.y,B,k,_,p,h,t.freeTransform),g||(v.repeat="repeat");const s=u(g);(y||s)&&(v.gap=function(t,e,s,i,r){let o,n;u(t)?(o=t.x,n=t.y):o=n=t;return{x:Cd(o,s,r.width,e&&e.x),y:Cd(n,i,r.height,e&&e.y)}}(y,s&&g,kd.width,kd.height,e));break;default:B&&gd(v,e,kd.x,kd.y,B,k,_)}return v.transform||(e.x||e.y)&&(v.transform=wd(),vd(v.transform,e.x,e.y)),B&&"stretch"!==n&&(v.scaleX=B,v.scaleY=k),v.width=i,v.height=r,o&&(v.opacity=o),m&&(v.filters=m),g&&(v.repeat=a(g)?"x"===g?"repeat-x":"repeat-y":"repeat"),v}function Cd(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 Pd,Td=new Lt;const{isSame:Ld}=Rt;function Ed(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||Sd(r,i,s,o),!0}function Id(t,e){Md(t,gn.LOAD,e)}function Od(t,e){Md(t,gn.LOADED,e)}function Ad(t,e,s){e.error=s,t.forceUpdate("surface"),Md(t,gn.ERROR,e)}function Md(t,e,s){t.hasEvent(e)&&t.emitEvent(new gn(e,s))}function Wd(t,e){const{leafer:s}=t;s&&s.viewReady&&(s.renderer.ignore=e)}const{get:Dd,scale:Fd,copy:zd}=M,{floor:Ud,max:Nd,abs:Yd}=Math;function Xd(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:t,data:a}=s;let h,l,{width:d,height:c,scaleX:u,scaleY:_,transform:p,repeat:f,gap:g}=a;r*=i,o*=i;const y=g&&g.x*r,m=g&&g.y*o;u&&(u=Yd(u),_=Yd(_),l=Dd(),zd(l,p),Fd(l,1/u,1/_),r*=u,o*=_),d*=r,c*=o;const x=d*c;if(!f&&x>e.image.maxCacheSize)return!1;let w=e.image.maxPatternSize;if(!t.isSVG){const e=t.width*t.height;w>e&&(w=e)}if(x>w&&(h=Math.sqrt(x/w)),h&&(r/=h,o/=h,d/=h,c/=h),u&&(r/=u,o/=_),(p||1!==r||1!==o)&&(l||(l=Dd(),p&&zd(l,p)),Fd(l,1/r,1/o)),l){const t=d+(y||0),e=c+(m||0);Fd(l,t/Nd(Ud(t),1),e/Nd(Ud(e),1))}const v=t.getCanvas(d,c,a.opacity,a.filters,y,m),b=t.getPattern(v,f||e.origin.noRepeat||"no-repeat",l,s);return s.style=b,s.patternId=n,!0}}const Hd={image:function(t,e,s,i,r){let o,n;const a=Er.get(s);return Pd&&s===Pd.paint&&Ld(i,Pd.boxBounds)?o=Pd.leafPaint:(o={type:s.type,image:a},a.hasAlphaPixel&&(o.isTransparent=!0),Pd=a.use>1?{leafPaint:o,paint:s,boxBounds:Td.set(i)}:null),(r||a.loading)&&(n={image:a,attrName:e,attrValue:s}),a.ready?(Ed(t,e,s,a,o,i),r&&(Id(t,n),Od(t,n))):a.error?r&&Ad(t,n,a.error):(r&&(Wd(t,!0),Id(t,n)),o.loadId=a.load(()=>{Wd(t,!1),t.destroyed||(Ed(t,e,s,a,o,i)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Od(t,n)),o.loadId=void 0},e=>{Wd(t,!1),Ad(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&&!Sh.running)return!1;if(r)if(h.repeat)r=!1;else if(!(i.changeful||"miniapp"===e.name&&Bn.isResizing(t)||Sh.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||Sh.running?Xd(t,i,a):i.patternTask||(i.patternTask=Er.patternTasker.add(()=>Zt(this,void 0,void 0,function*(){i.patternTask=null,s.bounds.hit(t.__nowWorld)&&Xd(t,i,a),t.forceUpdate("surface")}),300)),!1)},createPattern:Xd,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,Er.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:Sd,getPatternData:Rd,fillOrFitMode:gd,clipMode:yd,repeatMode:md},{toPoint:Gd}=nt,{hasTransparent:Vd}=yh,jd={},qd={};function Qd(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=yh.string(r,i)):(n=r.offset,o=yh.string(r.color,i)),e.addColorStop(n,o),!h&&Vd(o)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:Jd,getDistance:$d}=V,{get:Zd,rotateOfOuter:Kd,scaleOfOuter:tc}=M,{toPoint:ec}=nt,sc={},ic={};function rc(t,e,s,i,r){let o;const{width:n,height:a}=t;if(n!==a||i){const t=Jd(e,s);o=Zd(),r?(tc(o,e,n/a*(i||1),1),Kd(o,e,t+90)):(tc(o,e,1,n/a*(i||1)),Kd(o,e,t))}return o}const{getDistance:oc}=V,{toPoint:nc}=nt,ac={},hc={};const lc={linearGradient:function(t,s){let{from:i,to:r,type:o,opacity:n}=t;Gd(i||"top",s,jd),Gd(r||"bottom",s,qd);const a=e.canvas.createLinearGradient(jd.x,jd.y,qd.x,qd.y),h={type:o,style:a};return Qd(h,a,t.stops,n),h},radialGradient:function(t,s){let{from:i,to:r,type:o,opacity:n,stretch:a}=t;ec(i||"center",s,sc),ec(r||"bottom",s,ic);const h=e.canvas.createRadialGradient(sc.x,sc.y,0,sc.x,sc.y,$d(sc,ic)),l={type:o,style:h};Qd(l,h,t.stops,n);const d=rc(s,sc,ic,a,!0);return d&&(l.transform=d),l},conicGradient:function(t,s){let{from:i,to:r,type:o,opacity:n,stretch:a}=t;nc(i||"center",s,ac),nc(r||"bottom",s,hc);const h=e.conicGradientSupport?e.canvas.createConicGradient(0,ac.x,ac.y):e.canvas.createRadialGradient(ac.x,ac.y,0,ac.x,ac.y,oc(ac,hc)),l={type:o,style:h};Qd(l,h,t.stops,n);const d=rc(s,ac,hc,a||1,e.conicGradientRotate90);return d&&(l.transform=d),l},getTransform:rc},{copy:dc,toOffsetOutBounds:cc}=Rt,uc={},_c={};function pc(t,s,i,r){const{bounds:o,shapeBounds:n}=r;if(e.fullImageShadow){if(dc(uc,t.bounds),uc.x+=s.x-n.x,uc.y+=s.y-n.y,i){const{fitMatrix:t}=r;uc.x-=(o.x+(t?t.e:0)+o.width/2)*(i-1),uc.y-=(o.y+(t?t.f:0)+o.height/2)*(i-1),uc.width*=i,uc.height*=i}t.copyWorld(r.canvas,t.bounds,uc)}else i&&(dc(uc,s),uc.x-=s.width/2*(i-1),uc.y-=s.height/2*(i-1),uc.width*=i,uc.height*=i),t.copyWorld(r.canvas,n,i?uc:s)}const{toOffsetOutBounds:fc}=Rt,gc={};const yc={shadow:function(t,e,s){let i,r;const{__nowWorld:o,__layout:n}=t,{shadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=s,_=e.getSameCanvas(),p=a.length-1;cc(l,_c),a.forEach((a,f)=>{let g=1;if(a.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(g=1/t)}_.setWorldShadow(_c.offsetX+a.x*c*g,_c.offsetY+a.y*u*g,a.blur*c*g,yh.string(a.color)),r=a.spread?1+2*a.spread/(n.boxBounds.width+2*(n.strokeBoxSpread||0))*g:0,pc(_,_c,r,s),i=l,a.box&&(_.restore(),_.save(),h&&(_.copyWorld(_,l,o,"copy"),i=o),h?_.copyWorld(h,o,o,"destination-out"):_.copyWorld(s.canvas,d,l,"destination-out")),Do.copyCanvasByWorld(t,e,_,i,a.blendMode),p&&f<p&&_.clearWorld(i)}),_.recycle(i)},innerShadow:function(t,e,s){let i,r;const{__nowWorld:o,__layout:n}=t,{innerShadow:a}=t.__,{worldCanvas:h,bounds:l,shapeBounds:d,scaleX:c,scaleY:u}=s,_=e.getSameCanvas(),p=a.length-1;fc(l,gc),a.forEach((a,f)=>{let g=1;if(a.scaleFixed){const t=Math.abs(o.scaleX);t>1&&(g=1/t)}_.save(),_.setWorldShadow(gc.offsetX+a.x*c*g,gc.offsetY+a.y*u*g,a.blur*c*g),r=a.spread?1-2*a.spread/(n.boxBounds.width+2*(n.strokeBoxSpread||0))*g:0,pc(_,gc,r,s),_.restore(),h?(_.copyWorld(_,l,o,"copy"),_.copyWorld(h,o,o,"source-out"),i=o):(_.copyWorld(s.canvas,d,l,"source-out"),i=l),_.fillWorld(i,yh.string(a.color),"source-in"),Do.copyCanvasByWorld(t,e,_,i,a.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){}},{excludeRenderBounds:mc}=Go;let xc;function wc(t,e,s,i,r,o,n,a){switch(e){case"grayscale":xc||(xc=!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);bc(t,e,s,1,r,o)}(t,s,i,r,n,a);break;case"opacity-path":bc(t,s,i,o,n,a);break;case"path":a&&s.restore()}}function vc(t){return t.getSameCanvas(!1,!0)}function bc(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&&(wc(this,n,t,r,i,o,void 0,!0),i=r=null),o=s.__.opacity,xc=!1,"path"===a||"clipping-path"===a?(o<1?(n="opacity-path",r||(r=vc(t))):(n="path",t.save()),s.__clip(r||t,e)):(n="grayscale"===a?"grayscale":"alpha",i||(i=vc(t)),r||(r=vc(t)),s.__render(i,e)),"clipping"!==a&&"clipping-path"!==a||mc(s,e)||s.__render(t,e);continue}const d=1===o&&s.__.__blendMode;d&&wc(this,n,t,r,i,o,void 0,!1),mc(s,e)||s.__render(r||t,e),d&&wc(this,n,t,r,i,o,d,!1)}wc(this,n,t,r,i,o,void 0,!0)};const Bc=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",kc=Bc+"_#~&*+\\=|≮≯≈≠=…",Sc=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 Rc(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const Cc=Rc("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Pc=Rc("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Tc=Rc(Bc),Lc=Rc(kc),Ec=Rc("- —/~|┆·");var Ic;!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"}(Ic||(Ic={}));const{Letter:Oc,Single:Ac,Before:Mc,After:Wc,Symbol:Dc,Break:Fc}=Ic;function zc(t){return Cc[t]?Oc:Ec[t]?Fc:Pc[t]?Mc:Tc[t]?Wc:Lc[t]?Dc:Sc.test(t)?Ac:Oc}const Uc={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 Nc(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:Yc}=Uc,{Letter:Xc,Single:Hc,Before:Gc,After:Vc,Symbol:jc,Break:qc}=Ic;let Qc,Jc,$c,Zc,Kc,tu,eu,su,iu,ru,ou,nu,au,hu,lu,du,cu,uu=[];function _u(t,e){iu&&!su&&(su=iu),Qc.data.push({char:t,width:e}),$c+=e}function pu(){Zc+=$c,Qc.width=$c,Jc.words.push(Qc),Qc={data:[]},$c=0}function fu(){hu&&(lu.paraNumber++,Jc.paraStart=!0,hu=!1),iu&&(Jc.startCharSize=su,Jc.endCharSize=iu,su=0),Jc.width=Zc,du.width?Yc(Jc):cu&&gu(),uu.push(Jc),Jc={words:[]},Zc=0}function gu(){Zc>(lu.maxWidth||0)&&(lu.maxWidth=Zc)}const{top:yu,right:mu,bottom:xu,left:wu}=t.Direction4;function vu(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 bu={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[wu],o-=d[mu]+d[wu]):s.autoSizeAlign||(i=d[wu]),n?(r=d[yu],n-=d[yu]+d[xu]):s.autoSizeAlign||(r=d[yu]));const c={bounds:{x:i,y:r,width:o,height:n},rows:[],paraNumber:0,font:e.canvas.font=l};return function(t,s,i){lu=t,uu=t.rows,du=t.bounds,cu=!du.width&&!i.autoSizeAlign;const{__letterSpacing:r,paraIndent:o,textCase:n}=i,{canvas:a}=e,{width:h,height:l}=du;if(h||l||r||"none"!==n){const t="none"!==i.textWrap,e="break"===i.textWrap;hu=!0,ou=null,su=eu=iu=$c=Zc=0,Qc={data:[]},Jc={words:[]},r&&(s=[...s]);for(let i=0,l=s.length;i<l;i++)tu=s[i],"\n"===tu?($c&&pu(),Jc.paraEnd=!0,fu(),hu=!0):(ru=zc(tu),ru===Xc&&"none"!==n&&(tu=Nc(tu,n,!$c)),eu=a.measureText(tu).width,r&&(r<0&&(iu=eu),eu+=r),nu=ru===Hc&&(ou===Hc||ou===Xc)||ou===Hc&&ru!==Vc,au=!(ru!==Gc&&ru!==Hc||ou!==jc&&ou!==Vc),Kc=hu&&o?h-o:h,t&&h&&Zc+$c+eu>Kc&&(e?($c&&pu(),Zc&&fu()):(au||(au=ru===Xc&&ou==Vc),nu||au||ru===qc||ru===Gc||ru===Hc||$c+eu>Kc?($c&&pu(),Zc&&fu()):Zc&&fu()))," "===tu&&!0!==hu&&Zc+$c===0||(ru===qc?(" "===tu&&$c&&pu(),_u(tu,eu),pu()):nu||au?($c&&pu(),_u(tu,eu)):_u(tu,eu)),ou=ru);$c&&pu(),Zc&&fu(),uu.length>0&&(uu[uu.length-1].paraEnd=!0)}else s.split("\n").forEach(t=>{lu.paraNumber++,Zc=a.measureText(t).width,uu.push({x:o||0,text:t,width:Zc,paraStart:!0}),cu&&gu()})}(c,t,s),d&&function(t,e,s,i,r){if(!i&&s.autoSizeAlign)switch(s.textAlign){case"left":vu(e,"x",t[wu]);break;case"right":vu(e,"x",-t[mu])}if(!r&&s.autoSizeAlign)switch(s.verticalAlign){case"top":vu(e,"y",t[yu]);break;case"bottom":vu(e,"y",-t[xu])}}(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;const{fontSize:i,textDecoration:r}=e;switch(t.decorationHeight=i/11,u(r)?(s=r.type,r.color&&(t.decorationColor=yh.string(r.color))):s=r,s){case"under":t.decorationY=[.15*i];break;case"delete":t.decorationY=[.35*-i];break;case"under-delete":t.decorationY=[.15*i,.35*-i]}}(c,s),c}};const Bu={string:function(t,e){const s=l(e)&&e<1;if(a(t)){if(!s||!yh.object)return t;t=yh.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(gh,bu),Object.assign(yh,Bu),Object.assign(wh,od),Object.assign(vh,Hd),Object.assign(bh,lc),Object.assign(Bh,yc),$a(),t.AlignHelper=lt,t.AroundHelper=nt,t.AutoBounds=It,t.BezierHelper=Ue,t.Bounds=Lt,t.BoundsEvent=yn,t.BoundsHelper=Rt,t.BoxData=Dh,t.BranchHelper=Qo,t.BranchRender=ca,t.CanvasData=Jh,t.CanvasManager=Jt,t.ChildEvent=un,t.ColorConvert=yh,t.Creator=Xt,t.DataHelper=p,t.Debug=Mt,t.DragBoundsHelper=Zh,t.Effect=Bh,t.EllipseData=Yh,t.EllipseHelper=Qe,t.Event=cn,t.EventCreator=qt,t.Eventer=An,t.Export=Sh,t.FileHelper=Br,t.Filter=kh,t.FrameData=zh,t.GroupData=Wh,t.ImageData=Qh,t.ImageEvent=gn,t.ImageManager=Er,t.IncrementId=s,t.LayoutEvent=Sn,t.Layouter=dh,t.LeafBounds=ha,t.LeafBoundsHelper=Go,t.LeafData=g,t.LeafDataProxy=jn,t.LeafEventer=Gn,t.LeafHelper=Do,t.LeafLayout=dn,t.LeafLevelList=Va,t.LeafList=Ga,t.LeafMatrix=ta,t.LeafRender=la,t.LeaferCanvas=qa,t.LeaferCanvasBase=ce,t.LeaferData=Fh,t.LeaferEvent=Cn,t.LeaferImage=Dr,t.LineData=Uh,t.MathHelper=w,t.Matrix=K,t.MatrixHelper=M,t.MyImage=Dl,t.NeedConvertToCanvasCommandMap=ge,t.OneRadian=b,t.PI2=B,t.PI_2=k,t.Paint=wh,t.PaintGradient=bh,t.PaintImage=vh,t.PathArrow=xh,t.PathBounds=ur,t.PathCommandDataHelper=si,t.PathCommandMap=pe,t.PathConvert=Os,t.PathCorner=xr,t.PathCreator=xi,t.PathData=Gh,t.PathDrawer=Ai,t.PathHelper=ue,t.PathNumberCommandLengthMap=we,t.PathNumberCommandMap=xe,t.PenData=Vh,t.Platform=e,t.Plugin=Yt,t.Point=$,t.PointHelper=V,t.PolygonData=Xh,t.PropertyEvent=pn,t.RectData=Nh,t.RectHelper=ve,t.RectRender=il,t.RenderEvent=Rn,t.Renderer=uh,t.ResizeEvent=Bn,t.Resource=Tr,t.Run=zt,t.StarData=Hh,t.State=Rh,t.StringNumberMap=Ot,t.TaskItem=Rr,t.TaskProcessor=Cr,t.TextConvert=gh,t.TextData=qh,t.Transition=Ch,t.TwoPointBoundsHelper=et,t.UIBounds=$h,t.UICreator=Gt,t.UIData=Ah,t.UIRender=el,t.UnitConvert=mh,t.WaitHelper=Ko,t.WatchEvent=kn,t.Watcher=Ka,t.affectRenderBoundsType=ro,t.affectStrokeBoundsType=eo,t.attr=Yr,t.autoLayoutType=jr,t.boundsType=Jr,t.canvasPatch=br,t.canvasSizeAttrs=de,t.createAttr=function(t){return(e,s)=>{Fr(e,s,Ur(s,t))}},t.createDescriptor=Ur,t.cursorType=fo,t.dataProcessor=go,t.dataType=Hr,t.decorateLeafAttr=Nr,t.defineDataProcessor=yo,t.defineKey=Fr,t.defineLeafAttr=Xr,t.doBoundsType=Zr,t.doStrokeType=so,t.effectType=_h,t.emptyData={},t.eraserType=_o,t.extraPropertyEventMap=fn,t.getBoundsData=R,t.getDescriptor=zr,t.getMatrixData=C,t.getPointData=S,t.hitType=po,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)=>{Fr(e,"__LayoutProcessor",{get:()=>t})}},t.leaferTransformAttrMap=In,t.maskType=uo,t.naturalBoundsType=$r,t.opacityType=no,t.pathInputType=Kr,t.pathType=to,t.pen=wr,t.positionType=Gr,t.registerUI=So,t.registerUIEvent=function(){return t=>{qt.register(t)}},t.resizeType=ph,t.rewrite=vo,t.rewriteAble=bo,t.rotationType=Qr,t.scaleType=qr,t.scrollType=Vr,t.sortType=co,t.strokeType=io,t.surfaceType=oo,t.tempBounds=Et,t.tempMatrix=tt,t.tempPoint=Z,t.tryToNumber=function(t){return"string"==typeof t&&d.test(t)?+t:t},t.useCanvas=$a,t.useModule=ko,t.version="1.9.3",t.visibleType=ao,t.zoomLayerType=fh,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
|