@leafer-ui/worker 1.10.1 → 1.11.1
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/worker.js +54 -34
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +55 -35
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +11 -11
package/dist/worker.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var LeaferUI=function(t){"use strict";var e;t.Answer=void 0,(e=t.Answer||(t.Answer={}))[e.No=0]="No",e[e.Yes=1]="Yes",e[e.NoAndSkip=2]="NoAndSkip",e[e.YesAndSkip=3]="YesAndSkip";const i={};function s(t){return void 0===t}function r(t){return null==t}function n(t){return"string"==typeof t}const{isFinite:a}=Number;function o(t){return"number"==typeof t}const h=/^-?\d+(?:\.\d+)?$/;const{isArray:l}=Array;function d(t){return t&&"object"==typeof t}function c(t){return"{}"===JSON.stringify(t)}const u={default:(t,e)=>(_(e,t),_(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach(r=>{var n,a;if(s=e[r],(null==s?void 0:s.constructor)===Object&&(null===(n=t[r])||void 0===n?void 0:n.constructor)===Object)return _(t[r],e[r],i&&i[r]);i&&r in i?(null===(a=i[r])||void 0===a?void 0:a.constructor)===Object&&_(t[r]={},e[r],i[r]):t[r]=e[r]})},copyAttrs:(t,e,i)=>(i.forEach(i=>{s(e[i])||(t[i]=e[i])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let i=0,s=t.length;i<s;i++)e[t[i]]=!0;return e},stintSet(t,e,i){i||(i=void 0),t[e]!==i&&(t[e]=i)}},{assign:_}=u;class p{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __usePathBox(){return this.__pathInputed}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(!s(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let i;for(let r in this)"_"!==r[0]&&(i=e?e[r]:void 0,t[r]=s(i)?this[r]:i);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(!s(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!s(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(l(t))for(let e of t)i[e]=this.__getInput(e);else for(let e in t)i[e]=this.__getInput(e);else{let t,e,{__input:r}=this;i.tag=this.__leaf.tag;for(let n in this)if("_"!==n[0]&&(t=this["_"+n],!s(t))){if("path"===n&&!this.__pathInputed)continue;e=r?r[n]:void 0,i[n]=s(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:r,e:n,f:a}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:r,e:n,f:a}}return i}__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{floor:g,max:f}=Math,y={toURL(t,e){let i=encodeURIComponent(t);return"text"===e?i="data:text/plain;charset=utf-8,"+i:"svg"===e&&(i="data:image/svg+xml,"+i),i},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",isLarge:(t,e,i,s)=>t.width*t.height*(e?e*i:1)>(s||m.maxCacheSize),isSuperLarge:(t,e,i)=>m.isLarge(t,e,i,m.maxPatternSize),getRealURL(t){const{prefix:e,suffix:i}=y.image;return!i||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+i),e&&"/"===t[0]&&(t=e+t),t},resize(t,e,i,s,r,n,a,o,h){const l=y.origin.createCanvas(f(g(e+(s||0)),1),f(g(i+(r||0)),1)),d=l.getContext("2d");if(o&&(d.globalAlpha=o),d.imageSmoothingEnabled=!1!==a,n){const s=e/n.width,r=i/n.height;d.setTransform(s,0,0,r,-n.x*s,-n.y*r),d.drawImage(t,0,0,t.width,t.height)}else d.drawImage(t,0,0,e,i);return l},setPatternTransform(t,e,i){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}i&&u.stintSet(i,"transform",e)}}},{image:m}=y,v={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=x;return e[t]?e[t]++:(e[t]=1,0)}},x=v;let w,b,E;const{max:P}=Math,B=[0,0,0,0],k={zero:[...B],tempFour:B,set:(t,e,i,s,r)=>(void 0===i&&(i=s=r=e),t[0]=e,t[1]=i,t[2]=s,t[3]=r,t),setTemp:(t,e,i,s)=>S(B,t,e,i,s),toTempAB(t,e,i){E=i?o(t)?e:t:[],o(t)?(w=T(t),b=e):o(e)?(w=t,b=T(e)):(w=t,b=e),4!==w.length&&(w=R(w)),4!==b.length&&(b=R(b))},get(t,e){let i;if(!o(t))switch(t.length){case 4:i=s(e)?t:[...t];break;case 2:i=[t[0],t[1],t[0],t[1]];break;case 3:i=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(i||(i=[t,t,t,t]),!s(e))for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},max:(t,e,i)=>o(t)&&o(e)?P(t,e):(C(t,e,i),S(E,P(w[0],b[0]),P(w[1],b[1]),P(w[2],b[2]),P(w[3],b[3]))),add:(t,e,i)=>o(t)&&o(e)?t+e:(C(t,e,i),S(E,w[0]+b[0],w[1]+b[1],w[2]+b[2],w[3]+b[3])),swapAndScale(t,e,i,s){if(o(t))return e===i?t*e:[t*i,t*e];const r=s?t:[],[n,a,h,l]=4===t.length?t:R(t);return S(r,h*i,l*e,n*i,a*e)}},{set:S,get:R,setTemp:T,toTempAB:C}=k,{round:L,pow:O,max:I,floor:D,PI:A}=Math,M={within:(t,e,i)=>(d(e)&&(i=e.max,e=e.min),!s(e)&&t<e&&(t=e),!s(i)&&t>i&&(t=i),t),fourNumber:k.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),M.float(t)),getGapRotation(t,e,i=0){let s=t+i;if(e>1){const t=Math.abs(s%e);(t<1||t>e-1)&&(s=Math.round(s/e)*e)}return s-i},float(t,e){const i=s(e)?1e12:O(10,e);return-0===(t=L(t*i)/i)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,i,s){if(s||(s={}),e){const t=(o(e)?e:e.width||0)/i.width,r=(o(e)?e:e.height||0)/i.height;s.scaleX=t||r||1,s.scaleY=r||t||1}else t&&M.assignScale(s,t);return s},assignScale(t,e){o(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>I(D(t),e)/t,randInt:W,randColor:t=>`rgba(${W(255)},${W(255)},${W(255)},${t||1})`};function W(t){return Math.round(Math.random()*t)}const F=A/180,U=2*A,N=A/2;function z(){return{x:0,y:0}}function Y(){return{x:0,y:0,width:0,height:0}}function X(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:H,cos:j,acos:G,sqrt:V}=Math,{float:K}=M,q={};function Z(){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 Q={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:Z(),tempMatrix:{},set(t,e=1,i=0,s=0,r=1,n=0,a=0){t.a=e,t.b=i,t.c=s,t.d=r,t.e=n,t.f=a},get:X,getWorld:Z,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,i){t.e+=e,t.f+=i},translateInner(t,e,i,s){t.e+=t.a*e+t.c*i,t.f+=t.b*e+t.d*i,s&&(t.e-=e,t.f-=i)},scale(t,e,i=e){t.a*=e,t.b*=e,t.c*=i,t.d*=i},pixelScale(t,e,i){i||(i=t),i.a=t.a*e,i.b=t.b*e,i.c=t.c*e,i.d=t.d*e,i.e=t.e*e,i.f=t.f*e},scaleOfOuter(t,e,i,s){J.toInnerPoint(t,e,q),J.scaleOfInner(t,q,i,s)},scaleOfInner(t,e,i,s=i){J.translateInner(t,e.x,e.y),J.scale(t,i,s),J.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:r,d:n}=t,a=j(e*=F),o=H(e);t.a=i*a-s*o,t.b=i*o+s*a,t.c=r*a-n*o,t.d=r*o+n*a},rotateOfOuter(t,e,i){J.toInnerPoint(t,e,q),J.rotateOfInner(t,q,i)},rotateOfInner(t,e,i){J.translateInner(t,e.x,e.y),J.rotate(t,i),J.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:r,c:n,d:a}=t;i&&(i*=F,t.a=s+n*i,t.b=r+a*i),e&&(e*=F,t.c=n+s*e,t.d=a+r*e)},skewOfOuter(t,e,i,s){J.toInnerPoint(t,e,q),J.skewOfInner(t,q,i,s)},skewOfInner(t,e,i,s=0){J.translateInner(t,e.x,e.y),J.skew(t,i,s),J.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:r,d:n,e:a,f:o}=t;t.a=e.a*i+e.b*r,t.b=e.a*s+e.b*n,t.c=e.c*i+e.d*r,t.d=e.c*s+e.d*n,t.e=e.e*i+e.f*r+a,t.f=e.e*s+e.f*n+o},multiplyParent(t,e,i,r,n){const{e:a,f:o}=t;if(i||(i=t),s(r)&&(r=1!==t.a||t.b||t.c||1!==t.d),r){const{a:s,b:r,c:a,d:o}=t;i.a=s*e.a+r*e.c,i.b=s*e.b+r*e.d,i.c=a*e.a+o*e.c,i.d=a*e.b+o*e.d,n&&(i.scaleX=e.scaleX*n.scaleX,i.scaleY=e.scaleY*n.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,n&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=a*e.a+o*e.c+e.e,i.f=a*e.b+o*e.d+e.f},divide(t,e){J.multiply(t,J.tempInvert(e))},divideParent(t,e){J.multiplyParent(t,J.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=J;return J.copy(e,t),J.invert(e),e},invert(t){const{a:e,b:i,c:s,d:r,e:n,f:a}=t;if(i||s){const o=1/(e*r-i*s);t.a=r*o,t.b=-i*o,t.c=-s*o,t.d=e*o,t.e=-(n*r-a*s)*o,t.f=-(a*e-n*i)*o}else if(1===e&&1===r)t.e=-n,t.f=-a;else{const i=1/(e*r);t.a=r*i,t.d=e*i,t.e=-n*r*i,t.f=-a*e*i}},toOuterPoint(t,e,i,s){const{x:r,y:n}=e;i||(i=e),i.x=r*t.a+n*t.c,i.y=r*t.b+n*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:r,b:n,c:a,d:o}=t,h=1/(r*o-n*a),{x:l,y:d}=e;if(i||(i=e),i.x=(l*o-d*a)*h,i.y=(d*r-l*n)*h,!s){const{e:e,f:s}=t;i.x-=(e*o-s*a)*h,i.y-=(s*r-e*n)*h}},setLayout(t,e,i,r,n){const{x:a,y:o,scaleX:h,scaleY:l}=e;if(s(n)&&(n=e.rotation||e.skewX||e.skewY),n){const{rotation:i,skewX:s,skewY:r}=e,n=i*F,a=j(n),o=H(n);if(s||r){const e=s*F,i=r*F;t.a=(a+i*-o)*h,t.b=(o+i*a)*h,t.c=(e*a-o)*l,t.d=(a+e*o)*l}else t.a=a*h,t.b=o*h,t.c=-o*l,t.d=a*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=a,t.f=o,(i=i||r)&&J.translateInner(t,-i.x,-i.y,!r)},getLayout(t,e,i,s){const{a:r,b:n,c:a,d:o,e:h,f:l}=t;let d,c,u,_,p,g=h,f=l;if(n||a){const t=r*o-n*a;if(a&&!s){d=V(r*r+n*n),c=t/d;const e=r/d;u=n>0?G(e):-G(e)}else{c=V(a*a+o*o),d=t/c;const e=a/c;u=N-(o>0?G(-e):-G(e))}const e=K(j(u)),i=H(u);d=K(d),c=K(c),_=e?K((a/c+i)/e/F,9):0,p=e?K((n/d-i)/e/F,9):0,u=K(u/F)}else d=r,c=o,u=_=p=0;return(e=i||e)&&(g+=e.x*r+e.y*a,f+=e.x*n+e.y*o,i||(g-=e.x,f-=e.y)),{x:g,y:f,scaleX:d,scaleY:c,rotation:u,skewX:_,skewY:p}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:r,c:n,d:a}=t;r||n?i=(s*a-r*n)/(e=V(s*s+r*r)):(e=s,i=a)}return s.scaleX=e,s.scaleY=i,s},reset(t){J.set(t)}},J=Q,{toInnerPoint:$,toOuterPoint:tt}=Q,{sin:et,cos:it,abs:st,sqrt:rt,atan2:nt,min:at,round:ot}=Math,ht={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,i=0){t.x=e,t.y=i},setRadius(t,e,i){t.radiusX=e,t.radiusY=s(i)?e:i},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,i){t.x=e,t.y=i},round(t,e){t.x=e?ot(t.x-.5)+.5:ot(t.x),t.y=e?ot(t.y-.5)+.5:ot(t.y)},move(t,e,i){d(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=i)},scale(t,e,i=e){t.x&&(t.x*=e),t.y&&(t.y*=i)},scaleOf(t,e,i,s=i){t.x+=(t.x-e.x)*(i-1),t.y+=(t.y-e.y)*(s-1)},rotate(t,e,i){i||(i=lt.defaultPoint);const s=it(e*=F),r=et(e),n=t.x-i.x,a=t.y-i.y;t.x=i.x+n*s-a*r,t.y=i.y+n*r+a*s},tempToInnerOf(t,e){const{tempPoint:i}=lt;return ct(i,t),$(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=lt;return ct(i,t),tt(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=lt;return ct(i,t),lt.toInnerRadiusPointOf(t,e,i),i},toInnerRadiusPointOf(t,e,i){i||(i=t),$(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){$(e,t,i)},toOuterOf(t,e,i){tt(e,t,i)},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)=>dt(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const r=st(i-t),n=st(s-e);return rt(r*r+n*n)},getMinDistanceFrom:(t,e,i,s,r,n)=>at(dt(t,e,i,s),dt(i,s,r,n)),getAngle:(t,e)=>ut(t,e)/F,getRotation:(t,e,i,s)=>(s||(s=e),lt.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/F),getRadianFrom(t,e,i,r,n,a,o,h){s(o)&&(o=i,h=r);const l=t-i,d=e-r,c=n-o,u=a-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>nt(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s){const r=ut(t,e);return(e=s?e:{}).x=t.x+it(r)*i,e.y=t.y+et(r)*i,e},toNumberPoints(t){let e=t;return d(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},reset(t){lt.reset(t)}},lt=ht,{getDistanceFrom:dt,copy:ct,getAtan2:ut}=lt;class _t{constructor(t,e){this.set(t,e)}set(t,e){return d(t)?ht.copy(this,t):ht.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new _t(this)}move(t,e){return ht.move(this,t,e),this}scale(t,e){return ht.scale(this,t,e),this}scaleOf(t,e,i){return ht.scaleOf(this,t,e,i),this}rotate(t,e){return ht.rotate(this,t,e),this}rotateOf(t,e){return ht.rotate(this,e,t),this}getRotation(t,e,i){return ht.getRotation(this,t,e,i)}toInnerOf(t,e){return ht.toInnerOf(this,t,e),this}toOuterOf(t,e){return ht.toOuterOf(this,t,e),this}getCenter(t){return new _t(ht.getCenter(this,t))}getDistance(t){return ht.getDistance(this,t)}getDistancePoint(t,e,i){return new _t(ht.getDistancePoint(this,t,e,i))}getAngle(t){return ht.getAngle(this,t)}getAtan2(t){return ht.getAtan2(this,t)}reset(){return ht.reset(this),this}}const pt=new _t;class gt{constructor(t,e,i,s,r,n){this.set(t,e,i,s,r,n)}set(t,e,i,s,r,n){return d(t)?Q.copy(this,t):Q.set(this,t,e,i,s,r,n),this}setWith(t){return Q.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:r,f:n}=this;return{a:t,b:e,c:i,d:s,e:r,f:n}}clone(){return new gt(this)}translate(t,e){return Q.translate(this,t,e),this}translateInner(t,e){return Q.translateInner(this,t,e),this}scale(t,e){return Q.scale(this,t,e),this}scaleWith(t,e){return Q.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return Q.pixelScale(this,t),this}scaleOfOuter(t,e,i){return Q.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return Q.scaleOfInner(this,t,e,i),this}rotate(t){return Q.rotate(this,t),this}rotateOfOuter(t,e){return Q.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return Q.rotateOfInner(this,t,e),this}skew(t,e){return Q.skew(this,t,e),this}skewOfOuter(t,e,i){return Q.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return Q.skewOfInner(this,t,e,i),this}multiply(t){return Q.multiply(this,t),this}multiplyParent(t){return Q.multiplyParent(this,t),this}divide(t){return Q.divide(this,t),this}divideParent(t){return Q.divideParent(this,t),this}invert(){return Q.invert(this),this}invertWith(){return Q.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){Q.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){Q.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return Q.setLayout(this,t,e,i),this}getLayout(t,e,i){return Q.getLayout(this,t,e,i)}withScale(t,e){return Q.withScale(this,t,e)}reset(){Q.reset(this)}}const ft=new gt,yt={tempPointBounds:{},setPoint(t,e,i){t.minX=t.maxX=e,t.minY=t.maxY=i},addPoint(t,e,i){t.minX=e<t.minX?e:t.minX,t.minY=i<t.minY?i:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=i>t.maxY?i:t.maxY},addBounds(t,e,i,s,r){mt(t,e,i),mt(t,e+s,i+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:mt}=yt;var vt,xt;t.Direction4=void 0,(vt=t.Direction4||(t.Direction4={}))[vt.top=0]="top",vt[vt.right=1]="right",vt[vt.bottom=2]="bottom",vt[vt.left=3]="left",t.Direction9=void 0,(xt=t.Direction9||(t.Direction9={}))[xt.topLeft=0]="topLeft",xt[xt.top=1]="top",xt[xt.topRight=2]="topRight",xt[xt.right=3]="right",xt[xt.bottomRight=4]="bottomRight",xt[xt.bottom=5]="bottom",xt[xt.bottomLeft=6]="bottomLeft",xt[xt.left=7]="left",xt[xt.center=8]="center",xt[xt["top-left"]=0]="top-left",xt[xt["top-right"]=2]="top-right",xt[xt["bottom-right"]=4]="bottom-right",xt[xt["bottom-left"]=6]="bottom-left";const wt=[{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}];wt.forEach(t=>t.type="percent");const bt={directionData:wt,tempPoint:{},get:Et,toPoint(t,e,i,s,r,n){const a=Et(t);i.x=a.x,i.y=a.y,"percent"===a.type&&(i.x*=e.width,i.y*=e.height,r&&(n||(i.x-=r.x,i.y-=r.y),a.x&&(i.x-=1===a.x?r.width:.5===a.x?a.x*r.width:0),a.y&&(i.y-=1===a.y?r.height:.5===a.y?a.y*r.height:0))),s||(i.x+=e.x,i.y+=e.y)},getPoint:(t,e,i)=>(i||(i={}),bt.toPoint(t,e,i,!0),i)};function Et(e){return n(e)?wt[t.Direction9[e]]:e}const{toPoint:Pt}=bt,Bt={toPoint(t,e,i,s,r,n){Pt(t,i,s,r,e,n)}},{tempPointBounds:kt,setPoint:St,addPoint:Rt,toBounds:Tt}=yt,{toOuterPoint:Ct}=Q,{float:Lt,fourNumber:Ot}=M,{floor:It,ceil:Dt}=Math;let At,Mt,Wt,Ft;const Ut={},Nt={},zt={},Yt={tempBounds:zt,set(t,e=0,i=0,s=0,r=0){t.x=e,t.y=i,t.width=s,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,i,s,r){const{x:n,y:a,width:o,height:h}=e;if(l(i)){const e=Ot(i);s?Xt.set(t,n+e[3],a+e[0],o-e[1]-e[3],h-e[2]-e[0]):Xt.set(t,n-e[3],a-e[0],o+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),Xt.set(t,n-i,a-i,o+2*i,h+2*i);r&&("width"===r?(t.y=a,t.height=h):(t.x=n,t.width=o))},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,i){t.x+=e,t.y+=i},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,i)=>(t=Object.assign({},t),Xt.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?jt(e,t):e=t,i||(i=t),e.offsetX=Xt.maxX(i),e.offsetY=Xt.maxY(i),Xt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||ht.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){ht.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(Xt.copy(zt,t),Xt.toOuterOf(zt,e),zt),getOuterOf:(t,e)=>(t=Object.assign({},t),Xt.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:r,e:n,f:a}=e;s>0?(i.width=t.width*s,i.x=n+t.x*s):(i.width=t.width*-s,i.x=n+t.x*s-i.width),r>0?(i.height=t.height*r,i.y=a+t.y*r):(i.height=t.height*-r,i.y=a+t.y*r-i.height)}else Ut.x=t.x,Ut.y=t.y,Ct(e,Ut,Nt),St(kt,Nt.x,Nt.y),Ut.x=t.x+t.width,Ct(e,Ut,Nt),Rt(kt,Nt.x,Nt.y),Ut.y=t.y+t.height,Ct(e,Ut,Nt),Rt(kt,Nt.x,Nt.y),Ut.x=t.x,Ct(e,Ut,Nt),Rt(kt,Nt.x,Nt.y),Tt(kt,i)},toInnerOf(t,e,i){i||(i=t),Xt.move(i,-e.e,-e.f),Xt.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,Xt.getFitScale(t,e));return new gt(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,r=t.height/e.height;return i?Math.max(s,r):Math.min(s,r)},put(t,e,i="center",s=1,r=!0,a){a||(a=e),n(s)&&(s=Xt.getFitScale(t,e,"cover"===s)),zt.width=r?e.width*=s:e.width*s,zt.height=r?e.height*=s:e.height*s,Bt.toPoint(i,zt,t,a,!0,!0)},getSpread(t,e,i){const s={};return Xt.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){Xt.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){Xt.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=It(t.x),t.y=It(t.y),t.width=e>t.x?Dt(t.width+e-t.x):Dt(t.width),t.height=i>t.y?Dt(t.height+i-t.y):Dt(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=Lt(t.x,e),t.y=Lt(t.y,e),t.width=Lt(t.width,e),t.height=Lt(t.height,e)},add(t,e,i){At=t.x+t.width,Mt=t.y+t.height,Wt=e.x,Ft=e.y,i||(Wt+=e.width,Ft+=e.height),At=At>Wt?At:Wt,Mt=Mt>Ft?Mt:Ft,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=At-t.x,t.height=Mt-t.y},addList(t,e){Xt.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){Xt.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){Xt.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let r,n=!0;for(let a=0,o=e.length;a<o;a++)r=i?i(e[a],a):e[a],r&&(r.width||r.height)&&(n?(n=!1,s||jt(t,r)):Ht(t,r));n&&Xt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?St(kt,t.x,t.y):Rt(kt,t.x,t.y)),Tt(kt,t)},setPoint(t,e){Xt.set(t,e.x,e.y)},addPoint(t,e){Ht(t,e,!0)},getPoints(t){const{x:e,y:i,width:s,height:r}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+r},{x:e,y:i+r}]},hitRadiusPoint:(t,e,i)=>(i&&(e=ht.tempToInnerRadiusPointOf(e,i)),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,i)=>(i&&(e=ht.tempToInnerOf(e,i)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,i)=>(i&&(e=Xt.tempToOuterOf(e,i)),!(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,i)=>(i&&(e=Xt.tempToOuterOf(e,i)),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,i){if(i&&(e=Xt.tempToOuterOf(e,i)),!Xt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:r,width:n,height:a}=e;return At=s+n,Mt=r+a,Wt=t.x+t.width,Ft=t.y+t.height,s=s>t.x?s:t.x,r=r>t.y?r:t.y,At=At<Wt?At:Wt,Mt=Mt<Ft?Mt:Ft,n=At-s,a=Mt-r,{x:s,y:r,width:n,height:a}},intersect(t,e,i){Xt.copy(t,Xt.getIntersectData(t,e,i))},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){Xt.set(t)}},Xt=Yt,{add:Ht,copy:jt}=Xt;class Gt{get minX(){return Yt.minX(this)}get minY(){return Yt.minY(this)}get maxX(){return Yt.maxX(this)}get maxY(){return Yt.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return d(t)?Yt.copy(this,t):Yt.set(this,t,e,i,s),this}get(){const{x:t,y:e,width:i,height:s}=this;return{x:t,y:e,width:i,height:s}}clone(){return new Gt(this)}move(t,e){return Yt.move(this,t,e),this}scale(t,e,i){return Yt.scale(this,t,e,i),this}scaleOf(t,e,i){return Yt.scaleOf(this,t,e,i),this}toOuterOf(t,e){return Yt.toOuterOf(this,t,e),this}toInnerOf(t,e){return Yt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Yt.getFitMatrix(this,t,e)}put(t,e,i){Yt.put(this,t,e,i)}spread(t,e){return Yt.spread(this,t,e),this}shrink(t,e){return Yt.shrink(this,t,e),this}ceil(){return Yt.ceil(this),this}unsign(){return Yt.unsign(this),this}float(t){return Yt.float(this,t),this}add(t){return Yt.add(this,t),this}addList(t){return Yt.setList(this,t,!0),this}setList(t){return Yt.setList(this,t),this}addListWithFn(t,e){return Yt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Yt.setListWithFn(this,t,e),this}setPoint(t){return Yt.setPoint(this,t),this}setPoints(t){return Yt.setPoints(this,t),this}addPoint(t){return Yt.addPoint(this,t),this}getPoints(){return Yt.getPoints(this)}hitPoint(t,e){return Yt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Yt.hitRadiusPoint(this,t,e)}hit(t,e){return Yt.hit(this,t,e)}includes(t,e){return Yt.includes(this,t,e)}intersect(t,e){return Yt.intersect(this,t,e),this}getIntersect(t,e){return new Gt(Yt.getIntersectData(this,t,e))}isSame(t){return Yt.isSame(this,t)}isEmpty(){return Yt.isEmpty(this)}reset(){Yt.reset(this)}}const Vt=new Gt;class Kt{constructor(t,e,i,s,r,n){d(t)?this.copy(t):this.set(t,e,i,s,r,n)}set(t=0,e=0,i=0,s=0,r=0,n=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=r,this.height=n}copy(t){const{top:e,right:i,bottom:s,left:r,width:n,height:a}=t;this.set(e,i,s,r,n,a)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:r,width:n,height:a}=this;return new Gt(r,e,n||t.width-r-i,a||t.height-e-s)}}const qt={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:Zt}=M;class Qt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new Qt(t)}static set filter(t){this.filterList=Jt(t)}static set exclude(t){this.excludeList=Jt(t)}static drawRepaint(t,e){const i=Zt();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===Qt.showBounds,r=t.__nowWorld,n=Zt();s&&(e.setWorld(r),t.__drawHitPath(e),e.fillStyle=n.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(n,2),s?e.stroke():e.strokeWorld(r,n)}log(...t){if($t.enable){if($t.filterList.length&&$t.filterList.every(t=>t!==this.name))return;if($t.excludeList.length&&$t.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){$t.enable&&this.warn(...t)}warn(...t){$t.showWarn&&console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(this.warn("repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}function Jt(t){return t?n(t)&&(t=[t]):t=[],t}Qt.filterList=[],Qt.excludeList=[],Qt.showWarn=!0;const $t=Qt,te=Qt.get("RunTime"),ee={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=v.create(v.RUNTIME);return ie.currentId=ie.idMap[i]=e?performance.now():Date.now(),ie.currentName=ie.nameMap[i]=t,ie.nameToIdMap[t]=i,i},end(t,e){const i=ie.idMap[t],s=ie.nameMap[t],r=e?(performance.now()-i)/1e3:Date.now()-i;ie.idMap[t]=ie.nameMap[t]=ie.nameToIdMap[s]=void 0,te.log(s,r,"ms")},endOfName(t,e){const i=ie.nameToIdMap[t];s(i)||ie.end(i,e)}},ie=ee,se=[],re={list:{},add(t,...e){this.list[t]=!0,se.push(...e)},has(t,e){const i=this.list[t];return!i&&e&&this.need(t),i},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout(()=>se.forEach(t=>re.has(t,!0)));const ne={editor:t=>re.need("editor")},ae=Qt.get("UICreator"),oe={list:{},register(t){const{__tag:e}=t.prototype;he[e]&&ae.repeat(e),he[e]=t},get(t,e,i,r,n,a){he[t]||ae.error("not register "+t);const o=new he[t](e);return s(i)||(o.x=i,r&&(o.y=r),n&&(o.width=n),a&&(o.height=a)),o}},{list:he}=oe,le=Qt.get("EventCreator"),de={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],n(e)&&(ce[e]&&le.repeat(e),ce[e]=t)})},changeName(t,e){const i=ce[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,ce[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new ce[t](...e)},{nameList:ce}=de;class ue{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:i}=this;for(let s=0,r=i.length;s<r;s++)if(e=i[s],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const s=ne.canvas(t);return this.add(s),s}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let i=0,s=this.list.length;i<s;i++)t=this.list[i],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 _e(t,e,i,s){var r,n=arguments.length,a=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(n<3?r(a):n>3?r(e,i,a):r(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a}function pe(t,e,i,s){return new(i||(i=Promise))(function(r,n){function a(t){try{h(s.next(t))}catch(t){n(t)}}function o(t){try{h(s.throw(t))}catch(t){n(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(a,o)}h((s=s.apply(t,e||[])).next())})}function ge(t){return(e,i)=>{t||(t=i);const s={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===i&&(s.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,i,s)}}"function"==typeof SuppressedError&&SuppressedError;const fe=[];function ye(){return(t,e)=>{fe.push(e)}}const me=[];class ve{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||me)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;fe.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,i,s,r,n){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,r,n){d(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,i,s,r,n)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,i,s){}strokeRect(t,e,i,s){}clearRect(t,e,i,s){}drawImage(t,e,i,s,r,n,a,o,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*o;s+=e,e=0,n+=t,o-=t}if(i<0){const t=-i/r*h;r+=i,i=0,a+=t,h-=t}this.context.drawImage(t,e,i,s,r,n,a,o,h);break;case 5:this.context.drawImage(t,e,i,s,r);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,r,n){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,r,n){}arcTo(t,e,i,s,r){}ellipse(t,e,i,s,r,n,a,o){}rect(t,e,i,s){}roundRect(t,e,i,s,r){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,r,n){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}}_e([ge("imageSmoothingEnabled")],ve.prototype,"smooth",void 0),_e([ge("imageSmoothingQuality")],ve.prototype,"smoothLevel",void 0),_e([ge("globalAlpha")],ve.prototype,"opacity",void 0),_e([ge()],ve.prototype,"fillStyle",void 0),_e([ge()],ve.prototype,"strokeStyle",void 0),_e([ge("lineWidth")],ve.prototype,"strokeWidth",void 0),_e([ge("lineCap")],ve.prototype,"strokeCap",void 0),_e([ge("lineJoin")],ve.prototype,"strokeJoin",void 0),_e([ge("lineDashOffset")],ve.prototype,"dashOffset",void 0),_e([ge()],ve.prototype,"miterLimit",void 0),_e([ge()],ve.prototype,"shadowBlur",void 0),_e([ge()],ve.prototype,"shadowColor",void 0),_e([ge()],ve.prototype,"shadowOffsetX",void 0),_e([ge()],ve.prototype,"shadowOffsetY",void 0),_e([ge()],ve.prototype,"filter",void 0),_e([ge()],ve.prototype,"font",void 0),_e([ge()],ve.prototype,"fontKerning",void 0),_e([ge()],ve.prototype,"fontStretch",void 0),_e([ge()],ve.prototype,"fontVariantCaps",void 0),_e([ge()],ve.prototype,"textAlign",void 0),_e([ge()],ve.prototype,"textBaseline",void 0),_e([ge()],ve.prototype,"textRendering",void 0),_e([ge()],ve.prototype,"wordSpacing",void 0),_e([ge()],ve.prototype,"letterSpacing",void 0),_e([ge()],ve.prototype,"direction",void 0),_e([ye()],ve.prototype,"setTransform",null),_e([ye()],ve.prototype,"resetTransform",null),_e([ye()],ve.prototype,"getTransform",null),_e([ye()],ve.prototype,"save",null),_e([ye()],ve.prototype,"restore",null),_e([ye()],ve.prototype,"translate",null),_e([ye()],ve.prototype,"scale",null),_e([ye()],ve.prototype,"rotate",null),_e([ye()],ve.prototype,"fill",null),_e([ye()],ve.prototype,"stroke",null),_e([ye()],ve.prototype,"clip",null),_e([ye()],ve.prototype,"fillRect",null),_e([ye()],ve.prototype,"strokeRect",null),_e([ye()],ve.prototype,"clearRect",null),_e([ye()],ve.prototype,"beginPath",null),_e([ye()],ve.prototype,"moveTo",null),_e([ye()],ve.prototype,"lineTo",null),_e([ye()],ve.prototype,"bezierCurveTo",null),_e([ye()],ve.prototype,"quadraticCurveTo",null),_e([ye()],ve.prototype,"closePath",null),_e([ye()],ve.prototype,"arc",null),_e([ye()],ve.prototype,"arcTo",null),_e([ye()],ve.prototype,"ellipse",null),_e([ye()],ve.prototype,"rect",null),_e([ye()],ve.prototype,"roundRect",null),_e([ye()],ve.prototype,"createConicGradient",null),_e([ye()],ve.prototype,"createLinearGradient",null),_e([ye()],ve.prototype,"createPattern",null),_e([ye()],ve.prototype,"createRadialGradient",null),_e([ye()],ve.prototype,"fillText",null),_e([ye()],ve.prototype,"measureText",null),_e([ye()],ve.prototype,"strokeText",null);const{copy:xe,multiplyParent:we,pixelScale:be}=Q,{round:Ee}=Math,Pe=new Gt,Be=new Gt,ke={width:1,height:1,pixelRatio:1},Se=["width","height","pixelRatio"];class Re extends ve{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,e){super(),this.size={},this.worldTransform={},t||(t=ke),this.manager=e,this.innerId=v.create(v.CNAVAS);const{width:i,height:s,pixelRatio:r}=t;this.autoLayout=!i||!s,this.size.pixelRatio=r||y.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 i;this.context&&!this.unreal&&e&&this.width&&(i=this.getSameCanvas(),i.copyWorld(this));const s=this.size;u.copyAttrs(s,t,Se),Se.forEach(t=>s[t]||(s[t]=1)),this.bounds=new Gt(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!this.unreal&&i&&(this.clearWorld(i.bounds),this.copyWorld(i),i.recycle()))}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:i,pixelSnap:s}=this,r=this.worldTransform;e&&we(t,e,r),be(t,i,r),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(r.e=Ee(r.e-.5)+.5,r.f=Ee(r.f-.5)+.5):(r.e=Ee(r.e),r.f=Ee(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,i,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),i&&this.setStrokeOptions(i,s)}setStrokeOptions(t,e){let{strokeCap:i,strokeJoin:r,dashPattern:n,dashOffset:a,miterLimit:o}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(r=e.strokeJoin),s(e.dashPattern)||(n=e.dashPattern),s(e.dashOffset)||(a=e.dashOffset),e.miterLimit&&(o=e.miterLimit)),this.strokeCap=i,this.strokeJoin=r,this.dashPattern=n,this.dashOffset=a,this.miterLimit=o}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,i=1){return!0}setWorldShadow(t,e,i,s){const{pixelRatio:r}=this;this.shadowOffsetX=t*r,this.shadowOffsetY=e*r,this.shadowBlur=i*r,this.shadowColor=s||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,i,s,r=!0){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,r),i?(this.setTempPixelBounds2(i,r),i=Be):i=Pe,this.drawImage(t.view,Pe.x,Pe.y,Pe.width,Pe.height,i.x,i.y,i.width,i.height)):this.drawImage(t.view,0,0),s&&(this.blendMode="source-over")}copyWorldToInner(t,e,i,s,r=!0){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Yt.tempToOuterOf(i,e),s,r),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,r),this.drawImage(t.view,Pe.x,Pe.y,Pe.width,Pe.height,i.x,i.y,i.width,i.height),s&&(this.blendMode="source-over"))}copyWorldByReset(t,e,i,s,r,n=!0){this.resetTransform(),this.copyWorld(t,e,i,s,n),r||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempPixelBounds(t,!0,!0);const{context:s}=this,r=s.getImageData(Pe.x,Pe.y,Pe.width,Pe.height),{data:n}=r;for(let t=0,s=n.length;t<s;t+=4)i=.299*n[t]+.587*n[t+1]+.114*n[t+2],(e=n[t+3])&&(n[t+3]=255===e?i:e*(i/255));s.putImageData(r,Pe.x,Pe.y)}useMask(t,e,i){this.copyWorld(t,e,i,"destination-in")}useEraser(t,e,i){this.copyWorld(t,e,i,"destination-out")}fillWorld(t,e,i,s){i&&(this.blendMode=i),this.fillStyle=e,this.setTempPixelBounds(t,s),this.fillRect(Pe.x,Pe.y,Pe.width,Pe.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(Pe.x,Pe.y,Pe.width,Pe.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(Pe.x,Pe.y,Pe.width,Pe.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(Pe.x,Pe.y,Pe.width,Pe.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(Pe,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(Be,t,e,i)}copyToPixelBounds(t,e,i,s){t.set(e),s&&t.intersect(this.bounds),t.scale(this.pixelRatio),i&&t.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:i,pixelSnap:s}=this,r=this.manager?this.manager.get(i):ne.canvas(Object.assign({},i));return r.save(),t&&(xe(r.worldTransform,this.worldTransform),r.useWorldTransform()),e&&(r.smooth=this.smooth),r.pixelSnap!==s&&(r.pixelSnap=s),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 Te={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Ce={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Le=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),Oe={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},Ie={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},De=Object.assign(Object.assign({},Ie),Ce),Ae=Le,Me={};for(let t in Ae)Me[Ae[t]]=t;const We={};for(let t in Ae)We[Ae[t]]=Oe[t];const Fe={drawRoundRect(t,e,i,s,r,n){const a=M.fourNumber(n,Math.min(s/2,r/2)),o=e+s,h=i+r;a[0]?t.moveTo(e+a[0],i):t.moveTo(e,i),a[1]?t.arcTo(o,i,o,h,a[1]):t.lineTo(o,i),a[2]?t.arcTo(o,h,e,h,a[2]):t.lineTo(o,h),a[3]?t.arcTo(e,h,e,i,a[3]):t.lineTo(e,h),a[0]?t.arcTo(e,i,o,i,a[0]):t.lineTo(e,i)}},{sin:Ue,cos:Ne,hypot:ze,atan2:Ye,ceil:Xe,abs:He,PI:je,sqrt:Ge,pow:Ve}=Math,{setPoint:Ke,addPoint:qe}=yt,{set:Ze,toNumberPoints:Qe}=ht,{M:Je,L:$e,C:ti,Q:ei,Z:ii}=Le,si={},ri={points(t,e,i,s){let r=Qe(e);if(t.push(Je,r[0],r[1]),i&&r.length>5){let e,n,a,o,h,l,d,c,u,_,p,g,f,y=r.length;const m=!0===i?.5:i;s&&(r=[r[y-2],r[y-1],...r,r[0],r[1],r[2],r[3]],y=r.length);for(let i=2;i<y-2;i+=2)e=r[i-2],n=r[i-1],a=r[i],o=r[i+1],h=r[i+2],l=r[i+3],p=Ge(Ve(a-e,2)+Ve(o-n,2)),g=Ge(Ve(h-a,2)+Ve(l-o,2)),(p||g)&&(f=p+g,p=m*p/f,g=m*g/f,h-=e,l-=n,d=a-p*h,c=o-p*l,2===i?s||t.push(ei,d,c,a,o):t.push(ti,u,_,d,c,a,o),u=a+g*h,_=o+g*l);s||t.push(ei,u,_,r[y-2],r[y-1])}else for(let e=2,i=r.length;e<i;e+=2)t.push($e,r[e],r[e+1]);s&&t.push(ii)},rect(t,e,i,s,r){Te.creator.path=t,Te.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+r).lineTo(e,i+r).lineTo(e,i)},roundRect(t,e,i,s,r,n){Te.creator.path=[],Fe.drawRoundRect(Te.creator,e,i,s,r,n),t.push(...Te.convertToCanvasData(Te.creator.path,!0))},arcTo(t,e,i,s,r,n,a,o,h,l,d){const c=s-e,u=r-i,_=n-s,p=a-r;let g=Ye(u,c),f=Ye(p,_);const y=ze(c,u),m=ze(_,p);let v=f-g;if(v<0&&(v+=U),y<1e-12||m<1e-12||v<1e-12||He(v-je)<1e-12)return t&&t.push($e,s,r),h&&(Ke(h,e,i),qe(h,s,r)),d&&Ze(d,e,i),void(l&&Ze(l,s,r));const x=c*p-_*u<0,w=x?-1:1,b=o/Ne(v/2),E=s+b*Ne(g+v/2+N*w),P=r+b*Ue(g+v/2+N*w);return g-=N*w,f-=N*w,oi(t,E,P,o,o,0,g/F,f/F,x,h,l,d)},arc:(t,e,i,s,r,n,a,o,h,l)=>oi(t,e,i,s,s,0,r,n,a,o,h,l),ellipse(t,e,i,s,r,n,a,o,h,l,d,c){const u=n*F,_=Ue(u),p=Ne(u);let g=a*F,f=o*F;g>je&&(g-=U),f<0&&(f+=U);let y=f-g;y<0?y+=U:y>U&&(y-=U),h&&(y-=U);const m=Xe(He(y/N)),v=y/m,x=Ue(v/4),w=8/3*x*x/Ue(v/2);f=g+v;let b,E,P,B,k,S,R,T,C=Ne(g),L=Ue(g),O=P=p*s*C-_*r*L,I=B=_*s*C+p*r*L,D=e+P,A=i+B;t&&t.push(t.length?$e:Je,D,A),l&&Ke(l,D,A),c&&Ze(c,D,A);for(let n=0;n<m;n++)b=Ne(f),E=Ue(f),P=p*s*b-_*r*E,B=_*s*b+p*r*E,k=e+O-w*(p*s*L+_*r*C),S=i+I-w*(_*s*L-p*r*C),R=e+P+w*(p*s*E+_*r*b),T=i+B+w*(_*s*E-p*r*b),t&&t.push(ti,k,S,R,T,e+P,i+B),l&&ai(e+O,i+I,k,S,R,T,e+P,i+B,l,!0),O=P,I=B,C=b,L=E,g=f,f+=v;d&&Ze(d,e+P,i+B)},quadraticCurveTo(t,e,i,s,r,n,a){t.push(ti,(e+2*s)/3,(i+2*r)/3,(n+2*s)/3,(a+2*r)/3,n,a)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,r,n,a,o){ai(t,e,(t+2*i)/3,(e+2*s)/3,(r+2*i)/3,(n+2*s)/3,r,n,a,o)},toTwoPointBounds(t,e,i,s,r,n,a,o,h,l){const d=[];let c,u,_,p,g,f,y,m,v=t,x=i,w=r,b=a;for(let t=0;t<2;++t)if(1==t&&(v=e,x=s,w=n,b=o),c=-3*v+9*x-9*w+3*b,u=6*v-12*x+6*w,_=3*x-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;p=-_/u,0<p&&p<1&&d.push(p)}else y=u*u-4*_*c,m=Math.sqrt(y),y<0||(g=(-u+m)/(2*c),0<g&&g<1&&d.push(g),f=(-u-m)/(2*c),0<f&&f<1&&d.push(f));l?qe(h,t,e):Ke(h,t,e),qe(h,a,o);for(let l=0,c=d.length;l<c;l++)ni(d[l],t,e,i,s,r,n,a,o,si),qe(h,si.x,si.y)},getPointAndSet(t,e,i,s,r,n,a,o,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*s+_*n+p*o,l.y=c*i+u*r+_*a+p*h},getPoint(t,e,i,s,r,n,a,o,h){const l={};return ni(t,e,i,s,r,n,a,o,h,l),l},getDerivative(t,e,i,s,r){const n=1-t;return 3*n*n*(i-e)+6*n*t*(s-i)+3*t*t*(r-s)}},{getPointAndSet:ni,toTwoPointBounds:ai,ellipse:oi}=ri,{sin:hi,cos:li,sqrt:di,atan2:ci}=Math,{ellipse:ui}=ri,_i={ellipticalArc(t,e,i,s,r,n,a,o,h,l,d){const c=(h-e)/2,u=(l-i)/2,_=n*F,p=hi(_),g=li(_),f=-g*c-p*u,m=-g*u+p*c,v=s*s,x=r*r,w=m*m,b=f*f,E=v*x-v*w-x*b;let P=0;if(E<0){const t=di(1-E/(v*x));s*=t,r*=t}else P=(a===o?-1:1)*di(E/(v*w+x*b));const B=P*s*m/r,k=-P*r*f/s,S=ci((m-k)/r,(f-B)/s),R=ci((-m-k)/r,(-f-B)/s);let T=R-S;0===o&&T>0?T-=U:1===o&&T<0&&(T+=U);const C=e+c+g*B-p*k,L=i+u+p*B+g*k,O=T<0?1:0;d||y.ellipseToCurve?ui(t,C,L,s,r,n,S/F,R/F,O):s!==r||n?t.push(Le.G,C,L,s,r,n,S/F,R/F,O):t.push(Le.O,C,L,s,S/F,R/F,O)}},{M:pi,m:gi,L:fi,l:yi,H:mi,h:vi,V:xi,v:wi,C:bi,c:Ei,S:Pi,s:Bi,Q:ki,q:Si,T:Ri,t:Ti,A:Ci,a:Li,Z:Oi,z:Ii,N:Di,D:Ai,X:Mi,G:Wi,F:Fi,O:Ui,P:Ni,U:zi}=Le,{rect:Yi,roundRect:Xi,arcTo:Hi,arc:ji,ellipse:Gi,quadraticCurveTo:Vi}=ri,{ellipticalArc:Ki}=_i,qi=Qt.get("PathConvert"),Zi={},Qi={current:{dot:0},stringify(t,e){let i,s,r,n=0,a=t.length,o="";for(;n<a;){s=t[n],i=We[s],o+=s===r?" ":Me[s];for(let s=1;s<i;s++)o+=M.float(t[n+s],e),s===i-1||(o+=" ");r=s,n+=i}return o},parse(t,e){let i,s,r,n="";const a=[],o=e?De:Ie;for(let e=0,h=t.length;e<h;e++)s=t[e],qt[s]?("."===s&&(Ji.dot&&($i(a,n),n=""),Ji.dot++),"0"===n&&"."!==s&&($i(a,n),n=""),n+=s):Le[s]?(n&&($i(a,n),n=""),Ji.name=Le[s],Ji.length=Oe[s],Ji.index=0,$i(a,Ji.name),!i&&o[s]&&(i=!0)):"-"===s||"+"===s?"e"===r||"E"===r?n+=s:(n&&$i(a,n),n=s):n&&($i(a,n),n=""),r=s;return n&&$i(a,n),i?Qi.toCanvasData(a,e):a},toCanvasData(t,e){let i,s,r,n,a,o=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(r=t[c],r){case gi:t[c+1]+=o,t[c+2]+=h;case pi:o=t[c+1],h=t[c+2],_.push(pi,o,h),c+=3;break;case vi:t[c+1]+=o;case mi:o=t[c+1],_.push(fi,o,h),c+=2;break;case wi:t[c+1]+=h;case xi:h=t[c+1],_.push(fi,o,h),c+=2;break;case yi:t[c+1]+=o,t[c+2]+=h;case fi:o=t[c+1],h=t[c+2],_.push(fi,o,h),c+=3;break;case Bi:t[c+1]+=o,t[c+2]+=h,t[c+3]+=o,t[c+4]+=h,r=Pi;case Pi:a=n===bi||n===Pi,l=a?2*o-i:t[c+1],d=a?2*h-s:t[c+2],i=t[c+1],s=t[c+2],o=t[c+3],h=t[c+4],_.push(bi,l,d,i,s,o,h),c+=5;break;case Ei:t[c+1]+=o,t[c+2]+=h,t[c+3]+=o,t[c+4]+=h,t[c+5]+=o,t[c+6]+=h,r=bi;case bi:i=t[c+3],s=t[c+4],o=t[c+5],h=t[c+6],_.push(bi,t[c+1],t[c+2],i,s,o,h),c+=7;break;case Ti:t[c+1]+=o,t[c+2]+=h,r=Ri;case Ri:a=n===ki||n===Ri,i=a?2*o-i:t[c+1],s=a?2*h-s:t[c+2],e?Vi(_,o,h,i,s,t[c+1],t[c+2]):_.push(ki,i,s,t[c+1],t[c+2]),o=t[c+1],h=t[c+2],c+=3;break;case Si:t[c+1]+=o,t[c+2]+=h,t[c+3]+=o,t[c+4]+=h,r=ki;case ki:i=t[c+1],s=t[c+2],e?Vi(_,o,h,i,s,t[c+3],t[c+4]):_.push(ki,i,s,t[c+3],t[c+4]),o=t[c+3],h=t[c+4],c+=5;break;case Li:t[c+6]+=o,t[c+7]+=h;case Ci:Ki(_,o,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],e),o=t[c+6],h=t[c+7],c+=8;break;case Ii:case Oi:_.push(Oi),c++;break;case Di:o=t[c+1],h=t[c+2],e?Yi(_,o,h,t[c+3],t[c+4]):ts(_,t,c,5),c+=5;break;case Ai:o=t[c+1],h=t[c+2],e?Xi(_,o,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):ts(_,t,c,9),c+=9;break;case Mi:o=t[c+1],h=t[c+2],e?Xi(_,o,h,t[c+3],t[c+4],t[c+5]):ts(_,t,c,6),c+=6;break;case Wi:Gi(e?_:ts(_,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,Zi),o=Zi.x,h=Zi.y,c+=9;break;case Fi:e?Gi(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):ts(_,t,c,5),o=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Ui:ji(e?_:ts(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Zi),o=Zi.x,h=Zi.y,c+=7;break;case Ni:e?ji(_,t[c+1],t[c+2],t[c+3],0,360,!1):ts(_,t,c,4),o=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case zi:Hi(e?_:ts(_,t,c,6),o,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Zi),o=Zi.x,h=Zi.y,c+=6;break;default:return qi.error(`command: ${r} [index:${c}]`,t),_}n=r}return _},objectToCanvasData(t){const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(pi,t.x,t.y);break;case"L":e.push(fi,t.x,t.y);break;case"C":e.push(bi,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(ki,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Oi)}}),e},copyData(t,e,i,s){for(let r=i,n=i+s;r<n;r++)t.push(e[r])},pushData(t,e){Ji.index===Ji.length&&(Ji.index=1,t.push(Ji.name)),t.push(Number(e)),Ji.index++,Ji.dot=0}},{current:Ji,pushData:$i,copyData:ts}=Qi,{M:es,L:is,C:ss,Q:rs,Z:ns,N:as,D:os,X:hs,G:ls,F:ds,O:cs,P:us,U:_s}=Le,{getMinDistanceFrom:ps,getRadianFrom:gs}=ht,{tan:fs,min:ys,abs:ms}=Math,vs={},xs={beginPath(t){t.length=0},moveTo(t,e,i){t.push(es,e,i)},lineTo(t,e,i){t.push(is,e,i)},bezierCurveTo(t,e,i,s,r,n,a){t.push(ss,e,i,s,r,n,a)},quadraticCurveTo(t,e,i,s,r){t.push(rs,e,i,s,r)},closePath(t){t.push(ns)},rect(t,e,i,s,r){t.push(as,e,i,s,r)},roundRect(t,e,i,s,r,n){if(o(n))t.push(hs,e,i,s,r,n);else{const a=M.fourNumber(n);a?t.push(os,e,i,s,r,...a):t.push(as,e,i,s,r)}},ellipse(t,e,i,s,n,a,o,h,l){r(a)?t.push(ds,e,i,s,n):(r(o)&&(o=0),r(h)&&(h=360),t.push(ls,e,i,s,n,a,o,h,l?1:0))},arc(t,e,i,s,n,a,o){r(n)?t.push(us,e,i,s):(r(a)&&(a=360),t.push(cs,e,i,s,n,a,o?1:0))},arcTo(t,e,i,r,n,a,o,h){if(!s(o)){const t=ps(o,h,e,i,r,n);a=ys(a,ys(t/2,t/2*ms(fs(gs(o,h,e,i,r,n)/2))))}t.push(_s,e,i,r,n,a)},drawEllipse(t,e,i,s,n,a,o,h,l){ri.ellipse(null,e,i,s,n,r(a)?0:a,r(o)?0:o,r(h)?360:h,l,null,null,vs),t.push(es,vs.x,vs.y),ws(t,e,i,s,n,a,o,h,l)},drawArc(t,e,i,s,n,a,o){ri.arc(null,e,i,s,r(n)?0:n,r(a)?360:a,o,null,null,vs),t.push(es,vs.x,vs.y),bs(t,e,i,s,n,a,o)},drawPoints(t,e,i,s){ri.points(t,e,i,s)}},{ellipse:ws,arc:bs}=xs,{moveTo:Es,lineTo:Ps,quadraticCurveTo:Bs,bezierCurveTo:ks,closePath:Ss,beginPath:Rs,rect:Ts,roundRect:Cs,ellipse:Ls,arc:Os,arcTo:Is,drawEllipse:Ds,drawArc:As,drawPoints:Ms}=xs;class Ws{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?n(t)?Te.parse(t):t:[],this}beginPath(){return Rs(this.__path),this.paint(),this}moveTo(t,e){return Es(this.__path,t,e),this.paint(),this}lineTo(t,e){return Ps(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,r,n){return ks(this.__path,t,e,i,s,r,n),this.paint(),this}quadraticCurveTo(t,e,i,s){return Bs(this.__path,t,e,i,s),this.paint(),this}closePath(){return Ss(this.__path),this.paint(),this}rect(t,e,i,s){return Ts(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,r){return Cs(this.__path,t,e,i,s,r),this.paint(),this}ellipse(t,e,i,s,r,n,a,o){return Ls(this.__path,t,e,i,s,r,n,a,o),this.paint(),this}arc(t,e,i,s,r,n){return Os(this.__path,t,e,i,s,r,n),this.paint(),this}arcTo(t,e,i,s,r){return Is(this.__path,t,e,i,s,r),this.paint(),this}drawEllipse(t,e,i,s,r,n,a,o){return Ds(this.__path,t,e,i,s,r,n,a,o),this.paint(),this}drawArc(t,e,i,s,r,n){return As(this.__path,t,e,i,s,r,n),this.paint(),this}drawPoints(t,e,i){return Ms(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Fs,L:Us,C:Ns,Q:zs,Z:Ys,N:Xs,D:Hs,X:js,G:Gs,F:Vs,O:Ks,P:qs,U:Zs}=Le,Qs=Qt.get("PathDrawer"),Js={drawPathByData(t,e){if(!e)return;let i,s=0,r=e.length;for(;s<r;)switch(i=e[s],i){case Fs:t.moveTo(e[s+1],e[s+2]),s+=3;break;case Us:t.lineTo(e[s+1],e[s+2]),s+=3;break;case Ns:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case zs:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Ys:t.closePath(),s+=1;break;case Xs:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Hs:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],[e[s+5],e[s+6],e[s+7],e[s+8]]),s+=9;break;case js:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case Gs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*F,e[s+6]*F,e[s+7]*F,e[s+8]),s+=9;break;case Vs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,U,!1),s+=5;break;case Ks:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*F,e[s+5]*F,e[s+6]),s+=7;break;case qs:t.arc(e[s+1],e[s+2],e[s+3],0,U,!1),s+=4;break;case Zs:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void Qs.error(`command: ${i} [index:${s}]`,e)}}},{M:$s,L:tr,C:er,Q:ir,Z:sr,N:rr,D:nr,X:ar,G:or,F:hr,O:lr,P:dr,U:cr}=Le,{toTwoPointBounds:ur,toTwoPointBoundsByQuadraticCurve:_r,arcTo:pr,arc:gr,ellipse:fr}=ri,{addPointBounds:yr,copy:mr,addPoint:vr,setPoint:xr,addBounds:wr,toBounds:br}=yt,Er=Qt.get("PathBounds");let Pr,Br,kr;const Sr={},Rr={},Tr={},Cr={toBounds(t,e){Cr.toTwoPointBounds(t,Rr),br(Rr,e)},toTwoPointBounds(t,e){if(!t||!t.length)return xr(e,0,0);let i,s,r,n,a,o=0,h=0,l=0;const d=t.length;for(;o<d;)switch(a=t[o],0===o&&(a===sr||a===er||a===ir?xr(e,h,l):xr(e,t[o+1],t[o+2])),a){case $s:case tr:h=t[o+1],l=t[o+2],vr(e,h,l),o+=3;break;case er:r=t[o+5],n=t[o+6],ur(h,l,t[o+1],t[o+2],t[o+3],t[o+4],r,n,Sr),yr(e,Sr),h=r,l=n,o+=7;break;case ir:i=t[o+1],s=t[o+2],r=t[o+3],n=t[o+4],_r(h,l,i,s,r,n,Sr),yr(e,Sr),h=r,l=n,o+=5;break;case sr:o+=1;break;case rr:h=t[o+1],l=t[o+2],wr(e,h,l,t[o+3],t[o+4]),o+=5;break;case nr:case ar:h=t[o+1],l=t[o+2],wr(e,h,l,t[o+3],t[o+4]),o+=a===nr?9:6;break;case or:fr(null,t[o+1],t[o+2],t[o+3],t[o+4],t[o+5],t[o+6],t[o+7],t[o+8],Sr,Tr),0===o?mr(e,Sr):yr(e,Sr),h=Tr.x,l=Tr.y,o+=9;break;case hr:h=t[o+1],l=t[o+2],Br=t[o+3],kr=t[o+4],wr(e,h-Br,l-kr,2*Br,2*kr),h+=Br,o+=5;break;case lr:gr(null,t[o+1],t[o+2],t[o+3],t[o+4],t[o+5],t[o+6],Sr,Tr),0===o?mr(e,Sr):yr(e,Sr),h=Tr.x,l=Tr.y,o+=7;break;case dr:h=t[o+1],l=t[o+2],Pr=t[o+3],wr(e,h-Pr,l-Pr,2*Pr,2*Pr),h+=Pr,o+=4;break;case cr:pr(null,h,l,t[o+1],t[o+2],t[o+3],t[o+4],t[o+5],Sr,Tr),0===o?mr(e,Sr):yr(e,Sr),h=Tr.x,l=Tr.y,o+=6;break;default:return void Er.error(`command: ${a} [index:${o}]`,t)}}},{M:Lr,L:Or,Z:Ir}=Le,{getCenterX:Dr,getCenterY:Ar}=ht,{arcTo:Mr}=xs,Wr={smooth(t,e,i){let s,r,n,a=0,o=0,h=0,l=0,d=0,c=0,u=0,_=0,p=0;const g=t.length,f=[];for(;a<g;){switch(s=t[a],s){case Lr:l=_=t[a+1],d=p=t[a+2],a+=3,t[a]===Or?(c=t[a+1],u=t[a+2],f.push(Lr,Dr(l,c),Ar(d,u))):f.push(Lr,l,d);break;case Or:switch(o=t[a+1],h=t[a+2],a+=3,t[a]){case Or:Mr(f,o,h,t[a+1],t[a+2],e,_,p);break;case Ir:Mr(f,o,h,l,d,e,_,p);break;default:f.push(Or,o,h)}_=o,p=h;break;case Ir:r!==Ir&&(Mr(f,l,d,c,u,e,_,p),f.push(Ir)),a+=1;break;default:n=We[s];for(let e=0;e<n;e++)f.push(t[a+e]);a+=n}r=s}return s!==Ir&&(f[1]=l,f[2]=d),f}};function Fr(t){return new Ws(t)}const Ur=Fr();Te.creator=Fr(),Te.parse=Qi.parse,Te.convertToCanvasData=Qi.toCanvasData;const{drawRoundRect:Nr}=Fe;function zr(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,r){Nr(this,t,e,i,s,r)})}(t)}const Yr={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=Xr.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{}}}},Xr=Yr;Xr.alphaPixelTypes.forEach(t=>Xr.upperCaseTypeMap[t]=t.toUpperCase());const Hr=Qt.get("TaskProcessor");class jr{constructor(t){this.parallel=!0,this.time=1,this.id=v.create(v.TASK),this.task=t}run(){return pe(this,void 0,void 0,function*(){try{if(this.isComplete)return;if(this.canUse&&!this.canUse())return this.cancel();this.task&&this.parent.running&&(yield this.task())}catch(t){Hr.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}}class Gr{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,i=0;for(let s=0;s<t;s++)s<=this.finishedIndex?(i+=this.list[s].time,s===this.finishedIndex&&(e=i)):e+=this.list[s].time;return this.isComplete?1:i/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&u.assign(this.config,t),this.empty()}add(t,e,i){let r,n,a,h;const l=new jr(t);return l.parent=this,o(e)?h=e:e&&(n=e.parallel,r=e.start,a=e.time,h=e.delay,i||(i=e.canUse)),a&&(l.time=a),!1===n&&(l.parallel=!1),i&&(l.canUse=i),s(h)?this.push(l,r):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(l,r))},h)),this.isComplete=!1,l}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++,t.isCancel?this.runTask():this.nextTask()}).catch(t=>{this.onError(t)}):this.timer=setTimeout(()=>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;const{config:e,list:i,index:s}=this;this.parallelList=[],this.parallelSuccessNumber=0;let r=s+e.parallel;if(r>i.length&&(r=i.length),e.parallel>1)for(let e=s;e<r&&(t=i[e],t.parallel);e++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const i=e.length,s=this.finishedIndex+i;if(e.length){if(!this.running)return;s<this.total&&(t=this.list[s],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 Vr=Qt.get("Resource"),Kr={tasker:new Gr,map:{},get isComplete(){return qr.tasker.isComplete},set(t,e){qr.map[t]&&Vr.repeat(t),qr.map[t]=e},get:t=>qr.map[t],remove(t){const e=qr.map[t];e&&(e.destroy&&e.destroy(),delete qr.map[t])},loadImage(t,e){return new Promise((i,s)=>{const r=this.setImage(t,t,e);r.load(()=>i(r),t=>s(t))})},setImage(t,e,i){let s;return n(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=ne.image(s)),qr.set(t,e),e},destroy(){qr.map={}}},qr=Kr,Zr={maxRecycled:10,recycledList:[],patternTasker:new Gr,get(t){let e=Kr.get(t.url);return e||Kr.set(t.url,e=ne.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||Qr.recycledList.push(t)})},clearRecycled(){const t=Qr.recycledList;t.length>Qr.maxRecycled&&(t.forEach(t=>!t.use&&t.url&&Kr.remove(t.url)),t.length=0)},hasAlphaPixel:t=>Yr.alphaPixelTypes.some(e=>Qr.isFormat(e,t)),isFormat(t,e){if(e.format)return e.format===t;const{url:i}=e;if(i.startsWith("data:")){if(i.startsWith("data:"+Yr.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+Yr.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){Qr.recycledList=[]}},Qr=Zr,{IMAGE:Jr,create:$r}=v;class tn{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=$r(Jr),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}Zr.isFormat("svg",t)&&(this.isSVG=!0),Zr.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,e){if(!this.loading){this.loading=!0;const{crossOrigin:t}=this.config;Kr.tasker.add(()=>pe(this,void 0,void 0,function*(){return yield y.origin.loadImage(this.url,s(t)?y.image.crossOrigin:t,this).then(t=>this.setView(t)).catch(t=>{this.error=t,this.onComplete(!1)})}))}return this.waitComplete.push(t,e),this.waitComplete.length-2}unload(t,e){const i=this.waitComplete;if(e){const e=i[t+1];e&&e({type:"stop"})}i[t]=i[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)}onComplete(t){let e;this.waitComplete.forEach((i,s)=>{e=s%2,i&&(t?e||i(this):e&&i(this.error))}),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(t,e,i,s,r,n,a){if(t||(t=this.width),e||(e=this.height),this.cache){let{params:t,data:e}=this.cache;for(let i in t)if(t[i]!==arguments[i]){e=null;break}if(e)return e}const o=y.image.resize(this.view,t,e,r,n,void 0,a,i,s);return this.cache=this.use>1?{data:o,params:arguments}:null,o}getPattern(t,e,i,s){const r=y.canvas.createPattern(t,e);return y.image.setPatternTransform(r,i,s),r}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function en(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function sn(t,e){return Object.getOwnPropertyDescriptor(t,e)}function rn(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function nn(t,e){return(i,s)=>on(i,s,t,e&&e(s))}function an(t){return t}function on(t,e,i,s){const r={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};en(t,e,Object.assign(r,s||{})),An(t,e,i)}function hn(t){return nn(t)}function ln(t,e){return nn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function dn(t,e){return nn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function cn(t){return nn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),fn(this))}}))}function un(t,e){return nn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function _n(t,e){return nn(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function pn(t,e){return nn(t,t=>({set(i){this.__setAttr(t,i,e)&&fn(this)}}))}function gn(t){return nn(t,t=>({set(e){this.__setAttr(t,e)&&(fn(this),this.__.__removeNaturalSize())}}))}function fn(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function yn(t){return nn(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),fn(this)}}))}const mn=pn;function vn(t,e){return nn(t,t=>({set(i){this.__setAttr(t,i)&&(xn(this),e&&(this.__.__useStroke=!0))}}))}function xn(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&fn(t)}const wn=vn;function bn(t){return nn(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function En(t){return nn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function Pn(t){return nn(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;u.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip),this.__layout.surfaceChange()}}}))}function Bn(t){return nn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Sn(this)}}))}function kn(t){return nn(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>Rn(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Rn(this,t,e,i),this.mask&&Sn(this)}}))}function Sn(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Rn(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||fn(t))}function Tn(t){return nn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function Cn(t){return nn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function Ln(t){return nn(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function On(t){return nn(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===Qt.showBounds&&this.__layout.surfaceChange(),this.leafer&&this.leafer.updateCursor())}}))}function In(t){return nn(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function Dn(t){return(e,i)=>{en(e,"__DataProcessor",{get:()=>t})}}function An(t,e,i){const r=t.__DataProcessor.prototype,n="_"+e,a=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),o=rn(e,i);if(s(i))o.get=function(){return this[n]};else if("function"==typeof i)o.get=function(){const t=this[n];return null==t?i(this.__leaf):t};else if(d(i)){const t=c(i);o.get=function(){const e=this[n];return null==e?this[n]=t?{}:u.clone(i):e}}const h=t.isBranchLeaf;"width"===e?o.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalWidth,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:h&&s.children.length?s.boxBounds.width:i}return t}:"height"===e&&(o.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalHeight,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:h&&s.children.length?s.boxBounds.height:i}return t});let l,_=r;for(;!l&&_;)l=sn(_,e),_=_.__proto__;l&&l.set&&(o.set=l.set),r[a]&&(o.set=r[a],delete r[a]),en(r,e,o)}const Mn=new Qt("rewrite"),Wn=[],Fn=["destroy","constructor"];function Un(t){return(e,i)=>{Wn.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function Nn(){return t=>{zn()}}function zn(t){Wn.length&&(Wn.forEach(e=>{t&&Mn.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),Wn.length=0)}function Yn(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(Fn.includes(s)||e&&e.includes(s)))if(t.prototype){sn(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function Xn(){return t=>{oe.register(t)}}function Hn(){return t=>{de.register(t)}}setTimeout(()=>zn(!0));const{copy:jn,toInnerPoint:Gn,toOuterPoint:Vn,scaleOfOuter:Kn,rotateOfOuter:qn,skewOfOuter:Zn,multiplyParent:Qn,divideParent:Jn,getLayout:$n}=Q,ta={},{round:ea}=Math,ia={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),na(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,r=s.length;t<r;t++)ra(s[t],e,i)}},updateMatrix(t,e,i){const s=t.__layout;e?i&&(s.waitAutoLayout=!0,t.__hasAutoLayout&&(s.matrixChanged=!1)):s.waitAutoLayout&&(s.waitAutoLayout=!1),s.matrixChanged&&t.__updateLocalMatrix(),s.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,i=e.length;t<i;t++)aa(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&aa(t),t.__updateChange()},updateAllChange(t){if(ha(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)oa(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,e,i,s,r,n){s||(s=t.__nowWorld),t.__worldFlipped||y.fullImageShadow?e.copyWorldByReset(i,s,t.__nowWorld,r,n):e.copyWorldToInner(i,s,t.__layout.renderBounds,r)},moveWorld(t,e,i=0,s,r){const n=d(e)?Object.assign({},e):{x:e,y:i};s?Vn(t.localTransform,n,n,!0):t.parent&&Gn(t.parent.scrollWorldTransform,n,n,!0),sa.moveLocal(t,n.x,n.y,r)},moveLocal(t,e,i=0,s){d(e)&&(i=e.y,e=e.x),e+=t.x,i+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=ea(e),i=ea(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,r,n){sa.zoomOfLocal(t,la(t,e),i,s,r,n)},zoomOfLocal(t,e,i,s=i,r,n){const a=t.__localMatrix;if(o(s)||(s&&(n=s),s=i),jn(ta,a),Kn(ta,e,i,s),sa.hasHighPosition(t))sa.setTransform(t,ta,r,n);else{const e=t.x+ta.e-a.e,o=t.y+ta.f-a.f;n&&!r?t.animate({x:e,y:o,scaleX:t.scaleX*i,scaleY:t.scaleY*s},n):(t.x=e,t.y=o,t.scaleResize(i,s,!0!==r))}},rotateOfWorld(t,e,i,s){sa.rotateOfLocal(t,la(t,e),i,s)},rotateOfLocal(t,e,i,s){const r=t.__localMatrix;jn(ta,r),qn(ta,e,i),sa.hasHighPosition(t)?sa.setTransform(t,ta,!1,s):t.set({x:t.x+ta.e-r.e,y:t.y+ta.f-r.f,rotation:M.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,r,n){sa.skewOfLocal(t,la(t,e),i,s,r,n)},skewOfLocal(t,e,i,s=0,r,n){jn(ta,t.__localMatrix),Zn(ta,e,i,s),sa.setTransform(t,ta,r,n)},transformWorld(t,e,i,s){jn(ta,t.worldTransform),Qn(ta,e),t.parent&&Jn(ta,t.parent.scrollWorldTransform),sa.setTransform(t,ta,i,s)},transform(t,e,i,s){jn(ta,t.localTransform),Qn(ta,e),sa.setTransform(t,ta,i,s)},setTransform(t,e,i,s){const r=t.__,n=r.origin&&sa.getInnerOrigin(t,r.origin),a=$n(e,n,r.around&&sa.getInnerOrigin(t,r.around));if(sa.hasOffset(t)&&(a.x-=r.offsetX,a.y-=r.offsetY),i){const e=a.scaleX/t.scaleX,i=a.scaleY/t.scaleY;if(delete a.scaleX,delete a.scaleY,n){Yt.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=sa.getInnerOrigin(t,r.origin);ht.move(a,n.x-s.x,n.y-s.y)}t.set(a),t.scaleResize(e,i,!1)}else t.set(a,s)},getFlipTransform(t,e){const i={a:1,b:0,c:0,d:1,e:0,f:0},s="x"===e?1:-1;return Kn(i,sa.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>ht.tempToOuterOf(sa.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return bt.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(jn(ta,t.worldTransform),Jn(ta,e.scrollWorldTransform),i?ta:Object.assign({},ta)),drop(t,e,i,s){t.setTransform(sa.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||sa.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,e,i=.3){if(e.x||e.y)if(Math.abs(e.x)<1&&Math.abs(e.y)<1)t.move(e);else{const s=e.x*i,r=e.y*i;e.x-=s,e.y-=r,t.move(s,r),y.requestRender(()=>sa.animateMove(t,e,i))}}},sa=ia,{updateAllMatrix:ra,updateMatrix:na,updateAllWorldOpacity:aa,updateAllChange:oa,updateChange:ha}=sa;function la(t,e){return t.updateLayout(),t.parent?ht.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const da={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)=>ua(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>ua(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>ua(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 ca;function ua(t,e){return e||(ca=0),t.__.mask&&(ca=1),ca<0?null:(ca&&(ca=-1),!0)}const{updateBounds:_a}=ia,pa={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:i}=t;for(let s=0,r=i.length;s<r;s++)(t=i[s]).isBranch&&(t.__tempNumber=1,e.add(t),ga(t,e))}},pushAllParent(t,e){const{keys:i}=e;if(i)for(;t.parent&&s(i[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 i=e.length;const{children:s}=t;for(let t=0,i=s.length;t<i;t++)s[t].isBranch&&e.push(s[t]);for(let t=i,s=e.length;t<s;t++)fa(e[t],e)},updateBounds(t,e){const i=[t];fa(t,i),ya(i,e)},updateBoundsByBranchStack(t,e){let i,s;for(let r=t.length-1;r>-1;r--){i=t[r],s=i.children;for(let t=0,e=s.length;t<e;t++)_a(s[t]);e&&e===i||_a(i)}}},{pushAllChildBranch:ga,pushAllBranchStack:fa,updateBoundsByBranchStack:ya}=pa,ma={run(t){if(t&&t.length){const e=t.length;for(let i=0;i<e;i++)t[i]();t.length===e?t.length=0:t.splice(0,e)}}},{getRelativeWorld:va,updateBounds:xa}=ia,{toOuterOf:wa,getPoints:ba,copy:Ea}=Yt,Pa="_localContentBounds",Ba="_worldContentBounds",ka="_worldBoxBounds",Sa="_worldStrokeBounds";class Ra{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 wa(this.contentBounds,this.leaf.__localMatrix,this[Pa]||(this[Pa]={})),this[Pa]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return wa(this.contentBounds,this.leaf.__world,this[Ba]||(this[Ba]={})),this[Ba]}get worldBoxBounds(){return wa(this.boxBounds,this.leaf.__world,this[ka]||(this[ka]={})),this[ka]}get worldStrokeBounds(){return wa(this.strokeBounds,this.leaf.__world,this[Sa]||(this[Sa]={})),this[Sa]}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:e}=t;if(t.isApp)return xa(t);if(e)e.ready?e.watcher.changed&&e.layouter.layout():e.start();else{let e=t;for(;e.parent&&!e.parent.leafer;)e=e.parent;const i=e;if(i.__fullLayouting)return;i.__fullLayouting=!0,y.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 Q.defaultMatrix;case"page":t=e.zoomLayer;default:return va(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 Gt(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",i){const{leaf:s}=this;let r,n,a,o=this.getInnerBounds(t);switch(e){case"world":r=s.getWorldPoint(o),n=s.__world;break;case"local":const{scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d}=s.__;a={scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d},r=s.getLocalPointByInner(o);break;case"inner":r=o,n=Q.defaultMatrix;break;case"page":e=s.zoomLayer;default:r=s.getWorldPoint(o,e),n=va(s,e,!0)}if(a||(a=Q.getLayout(n)),Ea(a,o),ht.copy(a,r),i){const{scaleX:t,scaleY:e}=a,i=Math.abs(t),s=Math.abs(e);1===i&&1===s||(a.scaleX/=i,a.scaleY/=s,a.width*=i,a.height*=s)}return a}getLayoutPoints(t,e="world"){const{leaf:i}=this,r=ba(this.getInnerBounds(t));let n;switch(e){case"world":n=null;break;case"local":n=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:n=e}return s(n)||r.forEach(t=>i.innerToWorld(t,null,!1,n)),r}shrinkContent(){const{x:t,y:e,width:i,height:s}=this.boxBounds;this._contentBounds={x:t,y:e,width:i,height:s}}spreadStroke(){const{x:t,y:e,width:i,height:s}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:i,height:s},this._localStrokeBounds={x:t,y:e,width:i,height:s},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:i,height:s}=this.renderBounds;this._renderBounds={x:t,y:e,width:i,height:s},this._localRenderBounds={x:t,y:e,width:i,height:s}}shrinkContentCancel(){this._contentBounds=void 0}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this._strokeBounds=this.boxBounds,this._localStrokeBounds=this.leaf.__localBoxBounds,t&&this.spreadRenderCancel()}spreadRenderCancel(){this._renderBounds=this._strokeBounds,this._localRenderBounds=this._localStrokeBounds}boxChange(){this.boxChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange(),this.hitCanvasChanged=!0}localBoxChange(){this.localBoxChanged=!0,this.boundsChanged=!0}strokeChange(){this.strokeChanged=!0,this.strokeSpread||(this.strokeSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}renderChange(){this.renderChanged=!0,this.renderSpread||(this.renderSpread=1),this.boundsChanged=!0}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChange(),this.leaf.__local||this.createLocal()}matrixChange(){this.matrixChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=this.affectChildrenSort=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class Ta{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&y.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&y.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&y.event.stop(this.origin)}}class Ca extends Ta{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}Ca.ADD="child.add",Ca.REMOVE="child.remove",Ca.CREATED="created",Ca.MOUNTED="mounted",Ca.UNMOUNTED="unmounted",Ca.DESTROY="destroy";const La="property.scroll";class Oa extends Ta{constructor(t,e,i,s,r){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=r}}Oa.CHANGE="property.change",Oa.LEAFER_CHANGE="property.leafer_change",Oa.SCROLL=La;const Ia={scrollX:La,scrollY:La};class Da extends Ta{constructor(t,e){super(t),Object.assign(this,e)}}Da.LOAD="image.load",Da.LOADED="image.loaded",Da.ERROR="image.error";class Aa extends Ta{static checkHas(t,e,i){"on"===i?e===Ua?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(Ma)||t.hasEvent(Wa)||t.hasEvent(Fa),t.__hasWorldEvent=t.hasEvent(Ua))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(Ma,t),"inner"===e&&t.emit(Wa,t)),t.emit(Fa,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(Ua,this)}}Aa.RESIZE="bounds.resize",Aa.INNER="bounds.inner",Aa.LOCAL="bounds.local",Aa.WORLD="bounds.world";const{RESIZE:Ma,INNER:Wa,LOCAL:Fa,WORLD:Ua}=Aa,Na={};[Ma,Wa,Fa,Ua].forEach(t=>Na[t]=1);class za extends Ta{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){d(t)?(super(za.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!s(this.resizingKeys[t.innerId])}}za.RESIZE="resize";class Ya extends Ta{constructor(t,e){super(t),this.data=e}}Ya.REQUEST="watch.request",Ya.DATA="watch.data";class Xa extends Ta{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}Xa.REQUEST="layout.request",Xa.START="layout.start",Xa.BEFORE="layout.before",Xa.LAYOUT="layout",Xa.AFTER="layout.after",Xa.AGAIN="layout.again",Xa.END="layout.end";class Ha extends Ta{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}Ha.REQUEST="render.request",Ha.CHILD_START="render.child_start",Ha.CHILD_END="render.child_end",Ha.START="render.start",Ha.BEFORE="render.before",Ha.RENDER="render",Ha.AFTER="render.after",Ha.AGAIN="render.again",Ha.END="render.end",Ha.NEXT="render.next";class ja extends Ta{}ja.START="leafer.start",ja.BEFORE_READY="leafer.before_ready",ja.READY="leafer.ready",ja.AFTER_READY="leafer.after_ready",ja.VIEW_READY="leafer.view_ready",ja.VIEW_COMPLETED="leafer.view_completed",ja.STOP="leafer.stop",ja.RESTART="leafer.restart",ja.END="leafer.end",ja.UPDATE_MODE="leafer.update_mode",ja.TRANSFORM="leafer.transform",ja.MOVE="leafer.move",ja.SCALE="leafer.scale",ja.ROTATE="leafer.rotate",ja.SKEW="leafer.skew";const{MOVE:Ga,SCALE:Va,ROTATE:Ka,SKEW:qa}=ja,Za={x:Ga,y:Ga,scaleX:Va,scaleY:Va,rotation:Ka,skewX:qa,skewY:qa},Qa={};class Ja{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(l(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let i in t)l(e=t[i])?this.on(i,e[0],e[1]):this.on(i,e);return}let s,r,a;i&&("once"===i?r=!0:"boolean"==typeof i?s=i:(s=i.capture,r=i.once));const o=$a(this,s,!0),h=n(t)?t.split(" "):t,d=r?{listener:e,once:r}:{listener:e};h.forEach(t=>{t&&(a=o[t],a?-1===a.findIndex(t=>t.listener===e)&&a.push(d):o[t]=[d],Na[t]&&Aa.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=n(t)?t.split(" "):t;if(e){let t,r,n;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const a=$a(this,t);s.forEach(t=>{t&&(r=a[t],r&&(n=r.findIndex(t=>t.listener===e),n>-1&&r.splice(n,1),r.length||delete a[t],Na[t]&&Aa.checkHas(this,t,"off")))})}else{const{__bubbleMap:t,__captureMap:e}=this;s.forEach(i=>{t&&delete t[i],e&&delete e[i]})}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,i,s){return e?this.on(t,i?e=e.bind(i):e,s):l(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:s}}off_(t){if(!t)return;const e=l(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):l(t.type)&&t.type.forEach(e=>t.current.off(e[0],e[1],e[3])))}),e.length=0}once(t,e,i,s){if(!e)return l(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));d(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&de.has(t)&&(e=de.get(t,{type:t,target:this,current:this}));const s=$a(this,i)[t];if(s){let r;for(let n=0,a=s.length;n<a&&!((r=s[n])&&(r.listener(e),r.once&&(this.off(t,r.listener,i),n--,a--),e&&e.isStopNow));n++);}this.syncEventer&&this.syncEventer.emitEvent(e,i)}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:i,__captureMap:r}=this,n=i&&i[t],a=r&&r[t];return!!(s(e)?n||a:e?a:n)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function $a(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:Qa)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:Qa)}}const{on:to,on_:eo,off:io,off_:so,once:ro,emit:no,emitEvent:ao,hasEvent:oo,destroy:ho}=Ja.prototype,lo={on:to,on_:eo,off:io,off_:so,once:ro,emit:no,emitEvent:ao,hasEvent:oo,destroyEventer:ho},co=Qt.get("setAttr"),uo={__setAttr(t,e,i){if(this.leaferIsCreated){const r=this.__.__getInput(t);if(!i||a(e)||s(e)||(co.warn(this.innerName,t,e),e=void 0),d(e)||r!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new Oa(Oa.LEAFER_CHANGE,this,t,r,e));const i=Za[t];i&&(this.emitEvent(new ja(i,this)),this.emitEvent(new ja(ja.TRANSFORM,this)))}this.emitPropertyEvent(Oa.CHANGE,t,r,e);const i=Ia[t];return i&&this.emitPropertyEvent(i,t,r,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,i,s){const r=new Oa(t,this,e,i,s);this.isLeafer||this.hasEvent(t)&&this.emitEvent(r),this.leafer.emitEvent(r)},__realSetAttr(t,e){const i=this.__;i[t]=e,this.__proxyData&&this.setProxyAttr(t,e),i.normalStyle&&(this.lockNormalStyle||s(i.normalStyle[t])||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:_o,multiplyParent:po,translateInner:go,defaultWorld:fo}=Q,{toPoint:yo,tempPoint:mo}=bt,vo={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:r}=this;po(this.__local||e,t?t.__scrollWorld||t.__world:fo,i,!!e.affectScaleOrRotation,r),s&&go(Object.assign(s,i),r.scrollX,r.scrollY)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,i=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(_o(e,i,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=void 0),e.e=i.x+i.offsetX,e.f=i.y+i.offsetY,(i.around||i.origin)&&(yo(i.around||i.origin,t.boxBounds,mo),go(e,-mo.x,-mo.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:xo,updateAllMatrix:wo}=ia,{updateBounds:bo}=pa,{toOuterOf:Eo,copyAndSpread:Po,copy:Bo}=Yt,{toBounds:ko}=Cr,So={__updateWorldBounds(){const{__layout:t,__world:e}=this;Eo(t.renderBounds,e,e),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&Aa.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&Aa.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(),Eo(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Eo(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Eo(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const i=this.__layout.boxBounds,s=this.__;s.__usePathBox?ko(s.path,i):(i.x=0,i.y=0,i.width=s.width,i.height=s.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),wo(this),bo(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(wo(this),bo(this,this))):xo(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;Po(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:i}=e;o(i)&&i<=0?Bo(e.renderBounds,e.strokeBounds):Po(e.renderBounds,e.boxBounds,i)}},Ro={__render(t,e){if(e.shape)return this.__renderShape(t,e);if(this.__worldOpacity){const i=this.__;if(i.bright&&!e.topRendering)return e.topList.add(this);if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.dimOpacity&&!i.dimskip?i.opacity*e.dimOpacity:i.opacity,this.__.__single){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!0,!0);this.__draw(s,e,t),ia.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);Qt.showBounds&&Qt.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:To}=da,Co={__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 i=this.__;if(i.__useDim)if(i.dim)e.dimOpacity=!0===i.dim?.2:i.dim;else{if(i.bright&&!e.topRendering)return e.topList.add(this);i.dimskip&&e.dimOpacity&&(e.dimOpacity=0)}if(i.__single&&!this.isBranchLeaf){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!1,!0);this.__renderBranch(s,e);const r=this.__nowWorld;t.opacity=e.dimOpacity?i.opacity*e.dimOpacity:i.opacity,t.copyWorldByReset(s,r,r,i.__blendMode,!0),s.recycle(r)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:i}=this;for(let s=0,r=i.length;s<r;s++)To(i[s],e)||i[s].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,r=i.length;s<r;s++)To(i[s],e)||i[s].__clip(t,e)}}},Lo={},{LEAF:Oo,create:Io}=v,{stintSet:Do}=u,{toInnerPoint:Ao,toOuterPoint:Mo,multiplyParent:Wo}=Q,{toOuterOf:Fo}=Yt,{copy:Uo,move:No}=ht,{moveLocal:zo,zoomOfLocal:Yo,rotateOfLocal:Xo,skewOfLocal:Ho,moveWorld:jo,zoomOfWorld:Go,rotateOfWorld:Vo,skewOfWorld:Ko,transform:qo,transformWorld:Zo,setTransform:Qo,getFlipTransform:Jo,getLocalOrigin:$o,getRelativeWorld:th,drop:eh}=ia;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 p}get __LayoutProcessor(){return Ra}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=Io(Oo),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Ca.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(Ca.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Ca.MOUNTED,t,"once")}nextRender(t,e,i){this.leafer?this.leafer.nextRender(t,e,i):this.waitLeafer(()=>this.leafer.nextRender(t,e,i))}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(Ca.MOUNTED)):this.__emitLifeEvent(Ca.UNMOUNTED),this.isBranch){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__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){s(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=s(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:i}=this.__layout;t.clearRect(i.x,i.y,i.width,i.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,i=this.__world;return Wo(i,t.matrix,e,void 0,i),Fo(this.__layout.renderBounds,e,e),Do(e,"half",i.half),Do(e,"ignorePixelSnap",i.ignorePixelSnap),e}return this.__world}getClampRenderScale(){let{scaleX:t}=this.__nowWorld||this.__world;return t<0&&(t=-t),t>1?t:1}getRenderScaleData(t,e){let{scaleX:i,scaleY:s}=Zr.patternLocked?this.__world:this.__nowWorld;return t&&(i<0&&(i=-i),s<0&&(s=-s)),(!0===e||"zoom-in"===e&&i>1&&s>1)&&(i=s=1),Lo.scaleX=i,Lo.scaleY=s,Lo}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,i){return this.__layout.getLayoutBounds(t,e,i)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,i){const s=e?th(this,e):this.worldTransform,r=i?t:{};return Fo(t,s,r),r}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&Uo(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&Uo(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),Ao(this.scrollWorldTransform,t,e,i)}innerToWorld(t,e,i,s){Mo(this.scrollWorldTransform,t,e,i),s&&s.worldToInner(e||t,null,i)}getBoxPoint(t,e,i,s){return this.getBoxPointByInner(this.getInnerPoint(t,e,i,s),null,null,!0)}getBoxPointByInner(t,e,i,s){const r=s?t:Object.assign({},t),{x:n,y:a}=this.boxBounds;return No(r,-n,-a),r}getInnerPoint(t,e,i,s){const r=s?t:{};return this.worldToInner(t,r,i,e),r}getInnerPointByBox(t,e,i,s){const r=s?t:Object.assign({},t),{x:n,y:a}=this.boxBounds;return No(r,n,a),r}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const r=s?t:{};return this.worldToLocal(t,r,i,e),r}getLocalPointByInner(t,e,i,s){return this.getWorldPoint(t,this.parent,i,s)}getPagePoint(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,i,s)}getWorldPoint(t,e,i,s){const r=s?t:{};return this.innerToWorld(t,r,i,e),r}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const r=s?t:{};return this.localToWorld(t,r,i,e),r}getWorldPointByPage(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,i,s)}setTransform(t,e,i){Qo(this,t,e,i)}transform(t,e,i){qo(this,t,e,i)}move(t,e,i){zo(this,t,e,i)}moveInner(t,e,i){jo(this,t,e,!0,i)}scaleOf(t,e,i,s,r){Yo(this,$o(this,t),e,i,s,r)}rotateOf(t,e,i){Xo(this,$o(this,t),e,i)}skewOf(t,e,i,s,r){Ho(this,$o(this,t),e,i,s,r)}transformWorld(t,e,i){Zo(this,t,e,i)}moveWorld(t,e,i){jo(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,r){Go(this,t,e,i,s,r)}rotateOfWorld(t,e){Vo(this,t,e)}skewOfWorld(t,e,i,s,r){Ko(this,t,e,i,s,r)}flip(t,e){qo(this,Jo(this,t),!1,e)}scaleResize(t,e=t,i){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,i){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return re.need("path")}getMotionPoint(t){return re.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,i){eh(this,t,e,i)}on(t,e,i){}off(t,e,i){}on_(t,e,i,s){}off_(t){}once(t,e,i,s){}emit(t,e,i){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,i){i?this.addAttr(t,e,i):An(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=pn),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Ca(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Ca.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}},t.Leaf=_e([Yn(uo),Yn(vo),Yn(So),Yn(lo),Yn(Ro)],t.Leaf);const{setListWithFn:ih}=Yt,{sort:sh}=pa,{localBoxBounds:rh,localStrokeBounds:nh,localRenderBounds:ah,maskLocalBoxBounds:oh,maskLocalStrokeBounds:hh,maskLocalRenderBounds:lh}=da,dh=new Qt("Branch");t.Branch=class extends t.Leaf{__updateStrokeSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(t,e){ih(e||this.__layout.boxBounds,this.children,this.__hasMask?oh:rh)}__updateStrokeBounds(t){ih(t||this.__layout.strokeBounds,this.children,this.__hasMask?hh:nh)}__updateRenderBounds(t){ih(t||this.__layout.renderBounds,this.children,this.__hasMask?lh:ah)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let i=0,s=e.length;i<s;i++)e[i].__tempNumber=i,e[i].__.zIndex&&(t=!0);e.sort(sh),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return dh.warn("add self or destroyed");const i=s(e);if(!t.__){if(l(t))return t.forEach(t=>{this.add(t,e),i||e++});t=oe.get(t.tag,t)}t.parent&&t.parent.remove(t),t.parent=this,i?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const r=t.__layout;r.boxChanged||r.boxChange(),r.matrixChanged||r.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(Ca.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Ca.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)):s(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 i=this.children.indexOf(t);i>-1&&(this.children.splice(i,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(Ca.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Ca.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new Ca(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}},t.Branch=_e([Yn(Co)],t.Branch);class ch{get length(){return this.list.length}constructor(t){this.reset(),t&&(l(t)?this.addList(t):this.add(t))}has(t){return t&&!s(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return s(e)?-1:e}add(t){const{list:e,keys:i}=this;s(i[t.innerId])&&(e.push(t),i[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:i}=this;if(s(i[t.innerId])){const{list:s}=this;for(let t=e,r=s.length;t<r;t++)i[s[t].innerId]++;0===e?s.unshift(t):(e>s.length&&(e=s.length),s.splice(e,0,t)),i[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let i;for(let r=0,n=e.length;r<n;r++)s(i)?e[r].innerId===t.innerId&&(i=r,delete this.keys[t.innerId]):this.keys[e[r].innerId]=r-1;s(i)||e.splice(i,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 ch;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let i=0,s=t.length;i<s;i++)e[t[i].innerId]=i}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class uh{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(l(t)?this.addList(t):this.add(t))}has(t){return!s(this.keys[t.innerId])}without(t){return s(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:i}=this;e[t.innerId]||(e[t.innerId]=1,i[t.__level]?i[t.__level].push(t):(i[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(i=>{e=this.levelMap[i];for(let i=0,s=e.length;i<s;i++)t(e[i])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}class _h extends Re{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=y.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i),this.clientBounds=this.bounds}}zr(OffscreenCanvasRenderingContext2D.prototype),zr(Path2D.prototype);const{mineType:ph}=Yr;function gh(t,e){y.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise((s,r)=>{t.convertToBlob({type:ph(e),quality:i}).then(t=>{var e=new FileReader;e.onload=t=>s(t.target.result),e.onerror=t=>r(t),e.readAsDataURL(t)}).catch(t=>{r(t)})}),canvasToBolb:(t,e,i)=>t.convertToBlob({type:ph(e),quality:i}),canvasSaveAs:(t,e,i)=>new Promise(t=>t()),download(t,e){},loadImage:t=>new Promise((e,i)=>{let s=new XMLHttpRequest;s.open("GET",y.image.getRealURL(t),!0),s.responseType="blob",s.onload=()=>{createImageBitmap(s.response).then(t=>{e(t)}).catch(t=>{i(t)})},s.onerror=t=>i(t),s.send()})},y.canvas=ne.canvas(),y.conicGradientSupport=!!y.canvas.context.createConicGradient}Object.assign(ne,{canvas:(t,e)=>new _h(t,e),image:t=>new tn(t)}),y.name="web",y.isWorker=!0,y.backgrounder=!0,y.requestRender=function(t){requestAnimationFrame(t)},en(y,"devicePixelRatio",{get:()=>1});const{userAgent:fh}=navigator;fh.indexOf("Firefox")>-1?(y.conicGradientRotate90=!0,y.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(y.fullImageShadow=!0),fh.indexOf("Windows")>-1?(y.os="Windows",y.intWheelDeltaY=!0):fh.indexOf("Mac")>-1?y.os="Mac":fh.indexOf("Linux")>-1&&(y.os="Linux");class yh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new ch;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 ch,this.target=t,e&&(this.config=u.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(Ha.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===Ca.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,i=e.length;t<i;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new Ya(Ya.DATA,{updatedList:this.updatedList})),this.__updatedList=new ch,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[Oa.CHANGE,this.__onAttrChange,this],[[Ca.ADD,Ca.REMOVE],this.__onChildEvent,this],[Ya.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:mh,updateBounds:vh,updateChange:xh}=ia,{pushAllChildBranch:wh,pushAllParent:bh}=pa;const{worldBounds:Eh}=da;class Ph{constructor(t){this.updatedBounds=new Gt,this.beforeBounds=new Gt,this.afterBounds=new Gt,l(t)&&(t=new ch(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Eh)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Eh),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:Bh,updateAllChange:kh}=ia,Sh=Qt.get("Layouter");class Rh{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new uh,this.target=t,e&&(this.config=u.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(Xa.START),this.layoutOnce(),t.emitEvent(new Xa(Xa.END,this.layoutedBlocks,this.times))}catch(t){Sh.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Sh.warn("layouting"):this.times>3?Sh.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(Ya.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=ee.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:r,LAYOUT:n,AFTER:a}=Xa,o=this.getBlocks(s);o.forEach(t=>t.setBefore()),i.emitEvent(new Xa(r,o,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach(t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(mh(t,!0),e.add(t),t.isBranch&&wh(t,e),bh(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),bh(t,e)))})}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(r=>{e=t.levelMap[r];for(let t=0,r=e.length;t<r;t++){if(i=e[t],i.isBranch&&i.__tempNumber){s=i.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||vh(s[t])}vh(i)}})}(this.__levelList),function(t){t.list.forEach(xh)}(s),this.extraBlock&&o.push(this.extraBlock),o.forEach(t=>t.setAfter()),i.emitEvent(new Xa(n,o,this.times)),i.emitEvent(new Xa(a,o,this.times)),this.addBlocks(o),this.__levelList.reset(),this.__updatedList=null,ee.end(e)}fullLayout(){const t=ee.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:r}=Xa,n=this.getBlocks(new ch(e));e.emitEvent(new Xa(i,n,this.times)),Rh.fullLayout(e),n.forEach(t=>{t.setAfter()}),e.emitEvent(new Xa(s,n,this.times)),e.emitEvent(new Xa(r,n,this.times)),this.addBlocks(n),ee.end(t)}static fullLayout(t){Bh(t,!0),t.isBranch?pa.updateBounds(t):ia.updateBounds(t),kh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Ph([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Ph(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_([[Xa.REQUEST,this.layout,this],[Xa.AGAIN,this.layoutAgain,this],[Ya.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Th=Qt.get("Renderer");class Ch{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,i&&(this.config=u.default(i,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(Xa.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(Ha.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(Ha.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(Ha.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new Gt,Th.log(e.innerName,"---\x3e");try{this.emitRender(Ha.START),this.renderOnce(t),this.emitRender(Ha.END,this.totalBounds),Zr.clearRecycled()}catch(t){this.rendering=!1,Th.error(t)}Th.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Th.warn("rendering");if(this.times>3)return Th.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Gt,this.renderOptions={},t)this.emitRender(Ha.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(Ha.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(Ha.RENDER,this.renderBounds,this.renderOptions),this.emitRender(Ha.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=ee.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),r=new Gt(s);i.save(),s.spread(Ch.clipSpread).ceil(),i.clearWorld(s),i.clipWorld(s),this.__render(s,r),i.restore(),ee.end(e)}fullRender(){const t=ee.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),ee.end(t)}__render(t,e){const{canvas:i}=this,s=t.includes(this.target.__world),r=s?{includes:s}:{bounds:t,includes:s};this.needFill&&i.fillWorld(t,this.config.fill),Qt.showRepaint&&Qt.drawRepaint(i,t),y.render(this.target,i,r),this.renderBounds=e=e||t,this.renderOptions=r,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new Gt;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const e=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:i}=this.config;if(i&&t>i)return y.requestRender(e);const{frames:s}=this;s.length>30&&s.shift(),s.push(t),this.FPS=Math.round(s.reduce((t,e)=>t+e,0)/s.length),this.requestTime=0,this.checkRender()};y.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new Gt(0,0,e,i).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new Gt(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||Th.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,e,i){this.target.emitEvent(new Ha(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[Ha.REQUEST,this.update,this],[Xa.END,this.__onLayoutEnd,this],[Ha.AGAIN,this.renderAgain,this],[za.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}Ch.clipSpread=10;const{hitRadiusPoint:Lh}=Yt;class Oh{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,r=i.ignoreHittable||!1,n=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new ch(i.findList),i.findList||this.hitBranch(n.isBranchLeaf?{children:[n]}:n);const{list:a}=this.findList,o=this.getBestMatchLeaf(a,i.bottomList,r,!!i.findList),h=r?this.getPath(o):this.getHitablePath(o);return this.clear(),s?{path:h,target:o,throughPath:a.length?this.getThroughPath(a):h}:{path:h,target:o}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(t,e,i,s){const r=this.findList=new ch;if(t.length){let e;const{x:s,y:n}=this.point,a={x:s,y:n,radiusX:0,radiusY:0};for(let s=0,n=t.length;s<n;s++)if(e=t[s],(i||ia.worldHittable(e))&&(this.hitChild(e,a),r.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&ia.hasParent(t,e))){r.reset();break}return r.list[0]}}if(e)for(let t=0,i=e.length;t<i;t++)if(this.hitChild(e[t].target,this.point,e[t].proxy),r.length)return r.list[0];return s?null:i?t[0]:t.find(t=>ia.worldHittable(t))}getPath(t){const e=new ch,i=[],{target:s}=this;for(;t&&(t.syncEventer&&i.push(t.syncEventer),e.add(t),(t=t.parent)!==s););return i.length&&i.forEach(t=>{for(;t&&(t.__.hittable&&e.add(t),(t=t.parent)!==s););}),s&&e.add(s),e}getHitablePath(t){const e=this.getPath(t&&t.hittable?t:null);let i,s=new ch;for(let t=e.list.length-1;t>-1&&(i=e.list[t],i.__.hittable)&&(s.addAt(i,0),i.__.hitChildren&&(!i.isLeafer||"draw"!==i.mode));t--);return s}getThroughPath(t){const e=new ch,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,r,n;for(let t=0,a=i.length;t<a;t++){s=i[t],r=i[t+1];for(let t=0,i=s.length;t<i&&(n=s.list[t],!r||!r.has(n));t++)e.add(n)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s;const{point:r}=this;for(let n=t.length-1;n>-1;n--)if(i=t[n],i.__.visible&&(!e||i.__.mask))if(s=!!i.__.hitRadius||Lh(i.__world,r),i.isBranch){if(s||i.__ignoreHitWorld){if(i.isBranchLeaf&&i.__.__clipAfterFill&&!i.__hitWorld(r))continue;i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,r)}}else s&&this.hitChild(i,r)}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask){let i,r=[];const{children:n}=s;for(let s=0,a=n.length;s<a;s++)if(i=n[s],i.__.mask&&r.push(i),i===t){if(r&&!r.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class Ih{constructor(t,e){this.config={},e&&(this.config=u.default(e,this.config)),this.picker=new Oh(this.target=t,this),this.finder=ne.finder&&ne.finder()}getByPoint(t,e,i){const{target:s,picker:r}=this;return y.backgrounder&&s&&s.updateLayout(),r.getByPoint(t,e,i)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):re.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Dh(t){return nn(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Ah(t){return nn(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Mh(){return(t,e)=>{const i="_"+e;en(t,e,{set(t){this.isLeafer&&(this[i]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[i]||this:this.leafer&&this.leafer.zoomLayer}})}}Object.assign(ne,{watcher:(t,e)=>new yh(t,e),layouter:(t,e)=>new Rh(t,e),renderer:(t,e,i)=>new Ch(t,e,i),selector:(t,e)=>new Ih(t,e)}),y.layout=Rh.fullLayout,y.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new ch,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const Wh={},Fh={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}},Uh={number:(t,e)=>d(t)?"percent"===t.type?t.value*e:t.value:t},Nh={},zh={},Yh={},Xh={},Hh={},jh={apply(){re.need("filter")}},Gh={},Vh={setStyleName:()=>re.need("state"),set:()=>re.need("state")},Kh={list:{},register(t,e){Kh.list[t]=e},get:t=>Kh.list[t]},{parse:qh,objectToCanvasData:Zh}=Qi,{stintSet:Qh}=u,{hasTransparent:Jh}=Fh,$h={},tl=Qt.get("UIData");class el extends p{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,tl.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,tl.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),n(t)||!t?(Qh(this,"__isTransparentFill",Jh(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):d(t)&&this.__setPaint("fill",t)}setStroke(t){n(t)||!t?(Qh(this,"__isTransparentStroke",Jh(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):d(t)&&this.__setPaint("stroke",t)}setPath(t){const e=n(t);e||t&&d(t[0])?(this.__setInput("path",t),this._path=e?qh(t):Zh(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){il(this,"shadow",t)}setInnerShadow(t){il(this,"innerShadow",t)}setFilter(t){il(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&zh.compute("fill",this.__leaf),e&&zh.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),s(t.strokeWidthFixed)||(i=t.strokeWidthFixed)),i){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),l(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=$h)):(this.__isStrokes=!0,this._stroke||(this._stroke=$h))}__removePaint(t,e){e&&this.__removeInput(t),Yh.recycleImage(t,this),"fill"===t?(Qh(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(Qh(this,"__isAlphaPixelStroke",void 0),Qh(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function il(t,e,i){t.__setInput(e,i),l(i)?(i.some(t=>!1===t.visible)&&(i=i.filter(t=>!1!==t.visible)),i.length||(i=void 0)):i=i&&!1!==i.visible?[i]:void 0,t["_"+e]=i}class sl extends el{}class rl extends sl{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 nl extends sl{__getInputData(t,e){const i=super.__getInputData(t,e);return Se.forEach(t=>delete i[t]),i}}class al extends rl{}class ol extends el{get __usePathBox(){return this.points||this.__pathInputed}}class hl extends el{get __boxStroke(){return!this.__pathInputed}}class ll extends el{get __boxStroke(){return!this.__pathInputed}}class dl extends ol{}class cl extends el{}class ul extends el{get __pathInputed(){return 2}}class _l extends sl{}const pl={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class gl extends el{get __useNaturalRatio(){return!1}setFontWeight(t){n(t)?(this.__setInput("fontWeight",t),t=pl[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,i=e.__box;if(t){const{boxStyle:s}=this;if(i)for(let t in s)i[t]=void 0;else i=e.__box=oe.get("Rect",0);const r=e.__layout,n=i.__layout;s||(i.parent=e,i.__world=e.__world,n.boxBounds=r.boxBounds),i.set(t),n.strokeChanged&&r.strokeChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}}class fl extends hl{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:"image",mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return t.url&&delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url&&delete i.fill,i}}class yl extends hl{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url=this.__leaf.canvas.toDataURL("image/png"),i}}const{max:ml,add:vl}=k,xl={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:r}=i,n=this.__box;if((i.stroke||"all"===i.hitStroke)&&r&&"inside"!==s&&(e=t="center"===s?r/2:r,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:r;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*r),n&&(t=ml(t,n.__layout.strokeSpread=n.__updateStrokeSpread()),e=Math.max(e,n.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:r,filter:n,renderSpread:a}=this.__,{strokeSpread:o}=this.__layout,h=this.__box;e&&(t=Hh.getShadowRenderSpread(this,e)),s&&(t=ml(t,s)),n&&(t=vl(t,jh.getSpread(n))),a&&(t=vl(t,a)),o&&(t=vl(t,o));let l=t;return i&&(l=ml(l,Hh.getInnerShadowSpread(this,i))),r&&(l=ml(l,r)),this.__layout.renderShapeSpread=l,h?ml(h.__updateRenderSpread(),t):t}},{stintSet:wl}=u,bl={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);wl(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),wl(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,r=t.innerShadow||t.blur||t.backgroundBlur||t.filter;wl(t,"__isFastShadow",e&&!r&&e.length<2&&!e[0].spread&&!Hh.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(l(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!r)}t.__checkSingle(),wl(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){El(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:r,stroke:n,__drawAfterFill:a,__fillAfterStroke:o,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=zh.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&Hh.shadow(this,t,h),o&&(s.__isStrokes?zh.strokes(n,this,t,e):zh.stroke(n,this,t,e)),r&&(s.__isFills?zh.fills(r,this,t,e):zh.fill(r,this,t,e)),a&&this.__drawAfterFill(t,e),d&&Hh.innerShadow(this,t,h),n&&!o&&(s.__isStrokes?zh.strokes(n,this,t,e):zh.stroke(n,this,t,e)),c&&jh.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(o&&(s.__isStrokes?zh.strokes(n,this,t,e):zh.stroke(n,this,t,e)),h){const e=s.shadow[0],{scaleX:i,scaleY:r}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*r,e.blur*i,Fh.string(e.color))}r&&(s.__isFills?zh.fills(r,this,t,e):zh.fill(r,this,t,e)),h&&t.restore(),a&&this.__drawAfterFill(t,e),n&&!o&&(s.__isStrokes?zh.strokes(n,this,t,e):zh.stroke(n,this,t,e))}}else s.__pathInputed?El(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:r}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?zh.fills(s,this,t,e):zh.fill("#000000",this,t,e)),i.__isCanvas&&this.__drawAfterFill(t,e),r&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?zh.strokes(r,this,t,e):zh.stroke("#000000",this,t,e))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function El(t,e,i){const{fill:s,stroke:r,__drawAfterFill:n,__fillAfterStroke:a}=t.__;t.__drawRenderPath(e),a&&zh.stroke(r,t,e,i),s&&zh.fill(s,t,e,i),n&&t.__drawAfterFill(e,i),r&&!a&&zh.stroke(r,t,e,i)}const Pl={__drawFast(t,e){let{x:i,y:s,width:r,height:n}=this.__layout.boxBounds;const{fill:a,stroke:o,__drawAfterFill:h}=this.__;if(a&&(t.fillStyle=a,t.fillRect(i,s,r,n)),h&&this.__drawAfterFill(t,e),o){const{strokeAlign:a,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(o,h,this.__);const l=h/2;switch(a){case"center":t.strokeRect(0,0,r,n);break;case"inside":r-=h,n-=h,r<0||n<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,r,n),t.restore()):t.strokeRect(i+l,s+l,r,n);break;case"outside":t.strokeRect(i-l,s-l,r+h,n+h)}}}};var Bl,kl;t.UI=Bl=class extends t.Leaf{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){M.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 Ur.set(this.path=t||[]),t||this.__drawPathByBox(Ur),Ur}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return n(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return re.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return re.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(Ur.set(i=[]),this.__drawPathByBox(Ur)),t?Qi.toCanvasData(i,!0):i}getPathString(t,e,i){return Qi.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||Gh.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?Wr.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&Nh.addArrows(this)):t.__pathForRender&&(t.__pathForRender=void 0)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){e?Js.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:i,width:s,height:r}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:n}=this.__;t.roundRect(e,i,s,r,o(n)?[n]:n)}else t.rect(e,i,s,r)}drawImagePlaceholder(t,e,i){zh.fill(this.__.placeholderColor,this,e,i)}animate(t,e,i,s){return this.set(t),re.need("animate")}killAnimate(t,e){}export(t,e){return re.need("export")}syncExport(t,e){return re.need("export")}clone(t){const e=u.clone(this.toJSON());return t&&Object.assign(e,t),Bl.one(e)}static one(t,e,i,s,r){return oe.get(t.tag||this.prototype.__tag,t,e,i,s,r)}static registerUI(){Xn()(this)}static registerData(t){Dn(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}},_e([Dn(el)],t.UI.prototype,"__",void 0),_e([Mh()],t.UI.prototype,"zoomLayer",void 0),_e([hn("")],t.UI.prototype,"id",void 0),_e([hn("")],t.UI.prototype,"name",void 0),_e([hn("")],t.UI.prototype,"className",void 0),_e([En("pass-through")],t.UI.prototype,"blendMode",void 0),_e([Bn(1)],t.UI.prototype,"opacity",void 0),_e([kn(!0)],t.UI.prototype,"visible",void 0),_e([En(!1)],t.UI.prototype,"locked",void 0),_e([Pn(!1)],t.UI.prototype,"dim",void 0),_e([Pn(!1)],t.UI.prototype,"dimskip",void 0),_e([Tn(0)],t.UI.prototype,"zIndex",void 0),_e([Cn(!1)],t.UI.prototype,"mask",void 0),_e([Ln(!1)],t.UI.prototype,"eraser",void 0),_e([ln(0,!0)],t.UI.prototype,"x",void 0),_e([ln(0,!0)],t.UI.prototype,"y",void 0),_e([pn(100,!0)],t.UI.prototype,"width",void 0),_e([pn(100,!0)],t.UI.prototype,"height",void 0),_e([un(1,!0)],t.UI.prototype,"scaleX",void 0),_e([un(1,!0)],t.UI.prototype,"scaleY",void 0),_e([_n(0,!0)],t.UI.prototype,"rotation",void 0),_e([_n(0,!0)],t.UI.prototype,"skewX",void 0),_e([_n(0,!0)],t.UI.prototype,"skewY",void 0),_e([ln(0,!0)],t.UI.prototype,"offsetX",void 0),_e([ln(0,!0)],t.UI.prototype,"offsetY",void 0),_e([dn(0,!0)],t.UI.prototype,"scrollX",void 0),_e([dn(0,!0)],t.UI.prototype,"scrollY",void 0),_e([cn()],t.UI.prototype,"origin",void 0),_e([cn()],t.UI.prototype,"around",void 0),_e([hn(!1)],t.UI.prototype,"lazy",void 0),_e([gn(1)],t.UI.prototype,"pixelRatio",void 0),_e([bn(0)],t.UI.prototype,"renderSpread",void 0),_e([yn()],t.UI.prototype,"path",void 0),_e([mn()],t.UI.prototype,"windingRule",void 0),_e([mn(!0)],t.UI.prototype,"closed",void 0),_e([pn(0)],t.UI.prototype,"padding",void 0),_e([pn(!1)],t.UI.prototype,"lockRatio",void 0),_e([pn()],t.UI.prototype,"widthRange",void 0),_e([pn()],t.UI.prototype,"heightRange",void 0),_e([hn(!1)],t.UI.prototype,"draggable",void 0),_e([hn()],t.UI.prototype,"dragBounds",void 0),_e([hn("auto")],t.UI.prototype,"dragBoundsType",void 0),_e([hn(!1)],t.UI.prototype,"editable",void 0),_e([On(!0)],t.UI.prototype,"hittable",void 0),_e([On("path")],t.UI.prototype,"hitFill",void 0),_e([wn("path")],t.UI.prototype,"hitStroke",void 0),_e([On(!1)],t.UI.prototype,"hitBox",void 0),_e([On(!0)],t.UI.prototype,"hitChildren",void 0),_e([On(!0)],t.UI.prototype,"hitSelf",void 0),_e([On()],t.UI.prototype,"hitRadius",void 0),_e([In("")],t.UI.prototype,"cursor",void 0),_e([En()],t.UI.prototype,"fill",void 0),_e([wn(void 0,!0)],t.UI.prototype,"stroke",void 0),_e([wn("inside")],t.UI.prototype,"strokeAlign",void 0),_e([wn(1,!0)],t.UI.prototype,"strokeWidth",void 0),_e([wn(!1)],t.UI.prototype,"strokeWidthFixed",void 0),_e([wn("none")],t.UI.prototype,"strokeCap",void 0),_e([wn("miter")],t.UI.prototype,"strokeJoin",void 0),_e([wn()],t.UI.prototype,"dashPattern",void 0),_e([wn(0)],t.UI.prototype,"dashOffset",void 0),_e([wn(10)],t.UI.prototype,"miterLimit",void 0),_e([mn(0)],t.UI.prototype,"cornerRadius",void 0),_e([mn()],t.UI.prototype,"cornerSmoothing",void 0),_e([Dh()],t.UI.prototype,"shadow",void 0),_e([Dh()],t.UI.prototype,"innerShadow",void 0),_e([Dh()],t.UI.prototype,"blur",void 0),_e([Dh()],t.UI.prototype,"backgroundBlur",void 0),_e([Dh()],t.UI.prototype,"grayscale",void 0),_e([Dh()],t.UI.prototype,"filter",void 0),_e([En()],t.UI.prototype,"placeholderColor",void 0),_e([hn(100)],t.UI.prototype,"placeholderDelay",void 0),_e([hn({})],t.UI.prototype,"data",void 0),_e([Un(t.Leaf.prototype.reset)],t.UI.prototype,"reset",null),t.UI=Bl=_e([Yn(xl),Yn(bl),Nn()],t.UI),t.Group=class extends t.UI{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}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(){}},_e([Dn(sl)],t.Group.prototype,"__",void 0),_e([pn(0)],t.Group.prototype,"width",void 0),_e([pn(0)],t.Group.prototype,"height",void 0),t.Group=_e([Yn(t.Branch),Xn()],t.Group);const Sl=Qt.get("Leafer");t.Leafer=kl=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&&Kr.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),kl.list.add(this)}init(t,e){if(this.canvas)return;let i;const{config:s}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),i=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,u.assign(s,t));const r=this.canvas=ne.canvas(s);this.__controllers.push(this.renderer=ne.renderer(this,r,s),this.watcher=ne.watcher(this,s),this.layouter=ne.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),this.view=r.view,e||(this.selector=ne.selector(this),this.interaction=ne.interaction(this,r,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=ne.hitCanvasManager()),this.canvasManager=new ue,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(r),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),ma.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(ja.RESTART):this.emitLeafer(ja.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(ja.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=u.copyAttrs({},t,Se);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new Gt(t):this.canvas.bounds),this.viewReady&&(e?i.render():i.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 i=u.copyAttrs({},this.canvas,Se);e.resize(t),this.updateLazyBounds(),this.__onResize(new za(t,i))}__onResize(t){this.emitEvent(t),u.copyAttrs(this.__,t,Se),setTimeout(()=>{this.canvasManager&&this.canvasManager.clearRecycled()},0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager}__setLeafer(t){this.leafer=t,this.__level=1}__checkAutoLayout(){const{config:t,parentApp:e}=this;e||(t.width&&t.height||(this.autoLayout=new Kt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(Se.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t?this.parent||(this.canvas.hittable=e):"zIndex"===t?(this.canvas.zIndex=e,setTimeout(()=>this.parent&&this.parent.__updateSortChildren())):"mode"===t&&this.emit(ja.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&Se.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,r=u.copyAttrs({},s,Se);r[t]=i[t]=e,i.width&&i.height?s.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(r)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.backgroundColor=t:this.forceRender()}__onCreated(){this.created=!0}__onReady(){this.ready=!0,this.emitLeafer(ja.BEFORE_READY),this.emitLeafer(ja.READY),this.emitLeafer(ja.AFTER_READY),ma.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(ja.VIEW_READY),ma.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:r,pixelRatio:n}=this;const a="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,a.x+a.width)),i||(r=Math.max(1,a.y+a.height)),this.__doResize({width:s,height:r,pixelRatio:n})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){ma.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(ja.VIEW_COMPLETED),ma.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,i){e&&(t=t.bind(e));const s=this.__nextRenderWait;if(i){for(let e=0;e<s.length;e++)if(s[e]===t){s.splice(e,1);break}}else s.push(t);this.requestRender()}zoom(t,e,i,s){return re.need("view")}getValidMove(t,e,i){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:i}=this.clientBounds;return{x:e+t.x,y:i+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(t){this.emitEvent(new ja(t,this))}__listenEvents(){const t=ee.start("FirstCreate "+this.innerName);this.once([[ja.START,()=>ee.end(t)],[Xa.START,this.updateLazyBounds,this],[Ha.START,this.__onCreated,this],[Ha.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Ya.DATA,this.__onWatchData,this],[Xa.END,this.__onLayoutEnd,this],[Ha.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){kl.list.remove(this);try{this.stop(),this.emitLeafer(ja.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{Zr.clearRecycled()},100)}catch(t){Sl.error(t)}}};t?e():setTimeout(e)}},t.Leafer.list=new ch,_e([Dn(nl)],t.Leafer.prototype,"__",void 0),_e([pn()],t.Leafer.prototype,"pixelRatio",void 0),_e([hn("normal")],t.Leafer.prototype,"mode",void 0),t.Leafer=kl=_e([Xn()],t.Leafer),t.Rect=class extends t.UI{get __tag(){return"Rect"}},_e([Dn(hl)],t.Rect.prototype,"__",void 0),t.Rect=_e([Yn(Pl),Nn(),Xn()],t.Rect);const{add:Rl,includes:Tl,scroll:Cl}=Yt,Ll=t.Rect.prototype,Ol=t.Group.prototype;t.Box=class extends t.Group{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const i=this.__,s=this.__layout,{renderBounds:r,boxBounds:n}=s,{overflow:a}=i,o=s.childrenRenderBounds||(s.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(o),(e=a.includes("scroll"))&&(Rl(o,n),Cl(o,i)),this.__updateRectRenderBounds(),t=!Tl(n,o),t&&"show"===a&&Rl(r,o)}else this.__updateRectRenderBounds();u.stintSet(this,"isOverflow",t),this.__checkScroll(e)}__updateRectRenderBounds(){}__checkScroll(t){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e)),this.hasScroller&&this.scroller.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}},_e([Dn(rl)],t.Box.prototype,"__",void 0),_e([pn(100)],t.Box.prototype,"width",void 0),_e([pn(100)],t.Box.prototype,"height",void 0),_e([hn(!1)],t.Box.prototype,"resizeChildren",void 0),_e([bn("show")],t.Box.prototype,"overflow",void 0),_e([Un(Ll.__updateStrokeSpread)],t.Box.prototype,"__updateStrokeSpread",null),_e([Un(Ll.__updateRenderSpread)],t.Box.prototype,"__updateRectRenderSpread",null),_e([Un(Ll.__updateBoxBounds)],t.Box.prototype,"__updateRectBoxBounds",null),_e([Un(Ll.__updateStrokeBounds)],t.Box.prototype,"__updateStrokeBounds",null),_e([Un(Ll.__updateRenderBounds)],t.Box.prototype,"__updateRectRenderBounds",null),_e([Un(Ll.__updateChange)],t.Box.prototype,"__updateRectChange",null),_e([Un(Ll.__render)],t.Box.prototype,"__renderRect",null),_e([Un(Ol.__render)],t.Box.prototype,"__renderGroup",null),t.Box=_e([Nn(),Xn()],t.Box),t.Frame=class extends t.Box{get __tag(){return"Frame"}get isFrame(){return!0}},_e([Dn(al)],t.Frame.prototype,"__",void 0),_e([En("#FFFFFF")],t.Frame.prototype,"fill",void 0),_e([bn("hide")],t.Frame.prototype,"overflow",void 0),t.Frame=_e([Xn()],t.Frame);const{moveTo:Il,closePath:Dl,ellipse:Al}=xs;t.Ellipse=class extends t.UI{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:e,innerRadius:i,startAngle:s,endAngle:r}=this.__,n=t/2,a=e/2,o=this.__.path=[];i?(s||r?(i<1&&Al(o,n,a,n*i,a*i,0,s,r,!1),Al(o,n,a,n,a,0,r,s,!0),i<1&&Dl(o)):(i<1&&(Al(o,n,a,n*i,a*i),Il(o,t,a)),Al(o,n,a,n,a,0,360,0,!0)),y.ellipseToCurve&&(this.__.path=this.getPath(!0))):s||r?(Il(o,n,a),Al(o,n,a,n,a,0,s,r,!1),Dl(o)):Al(o,n,a,n,a)}},_e([Dn(ll)],t.Ellipse.prototype,"__",void 0),_e([mn(0)],t.Ellipse.prototype,"innerRadius",void 0),_e([mn(0)],t.Ellipse.prototype,"startAngle",void 0),_e([mn(0)],t.Ellipse.prototype,"endAngle",void 0),t.Ellipse=_e([Xn()],t.Ellipse);const{sin:Ml,cos:Wl,PI:Fl}=Math,{moveTo:Ul,lineTo:Nl,closePath:zl,drawPoints:Yl}=xs;t.Polygon=class extends t.UI{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)Yl(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:r}=t,n=i/2,a=s/2;Ul(e,n,0);for(let t=1;t<r;t++)Nl(e,n+n*Ml(2*t*Fl/r),a-a*Wl(2*t*Fl/r));zl(e)}}},_e([Dn(dl)],t.Polygon.prototype,"__",void 0),_e([mn(3)],t.Polygon.prototype,"sides",void 0),_e([mn()],t.Polygon.prototype,"points",void 0),_e([mn(0)],t.Polygon.prototype,"curve",void 0),t.Polygon=_e([Nn(),Xn()],t.Polygon);const{sin:Xl,cos:Hl,PI:jl}=Math,{moveTo:Gl,lineTo:Vl,closePath:Kl}=xs;t.Star=class extends t.UI{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,r=t/2,n=e/2,a=this.__.path=[];Gl(a,r,0);for(let t=1;t<2*i;t++)Vl(a,r+(t%2==0?r:r*s)*Xl(t*jl/i),n-(t%2==0?n:n*s)*Hl(t*jl/i));Kl(a)}},_e([Dn(cl)],t.Star.prototype,"__",void 0),_e([mn(5)],t.Star.prototype,"corners",void 0),_e([mn(.382)],t.Star.prototype,"innerRadius",void 0),t.Star=_e([Xn()],t.Star);const{moveTo:ql,lineTo:Zl,drawPoints:Ql}=xs,{rotate:Jl,getAngle:$l,getDistance:td,defaultPoint:ed}=ht;t.Line=class extends t.UI{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&Jl(i,e),i}set toPoint(t){this.width=td(ed,t),this.rotation=$l(ed,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?Ql(e,t.points,t.curve,t.closed):(ql(e,0,0),Zl(e,this.width,0))}},_e([Dn(ol)],t.Line.prototype,"__",void 0),_e([vn("center")],t.Line.prototype,"strokeAlign",void 0),_e([pn(0)],t.Line.prototype,"height",void 0),_e([mn()],t.Line.prototype,"points",void 0),_e([mn(0)],t.Line.prototype,"curve",void 0),_e([mn(!1)],t.Line.prototype,"closed",void 0),t.Line=_e([Xn()],t.Line),t.Image=class extends t.Rect{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return l(t)&&t[0].image}},_e([Dn(fl)],t.Image.prototype,"__",void 0),_e([pn("")],t.Image.prototype,"url",void 0),t.Image=_e([Xn()],t.Image);const id=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=ne.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new tn({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new Da(Da.LOADED,{image:t}))})}draw(t,e,i,s){const r=new gt(t.worldTransform).invert(),n=new gt;e&&n.translate(e.x,e.y),i&&(o(i)?n.scale(i):n.scale(i.x,i.y)),s&&n.rotate(s),r.multiplyParent(n),t.__render(this.canvas,{matrix:r.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:r}=this.canvas;t.drawImage(r,0,0,r.width,r.height,0,0,i,s)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:i}=this.__;t.resize(this.__,i),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}},_e([Dn(yl)],t.Canvas.prototype,"__",void 0),_e([Ah(100)],t.Canvas.prototype,"width",void 0),_e([Ah(100)],t.Canvas.prototype,"height",void 0),_e([Ah(1)],t.Canvas.prototype,"pixelRatio",void 0),_e([Ah(!0)],t.Canvas.prototype,"smooth",void 0),_e([hn(!1)],t.Canvas.prototype,"safeResize",void 0),_e([Ah()],t.Canvas.prototype,"contextSettings",void 0),t.Canvas=_e([Xn()],t.Canvas);const{copyAndSpread:sd,includes:rd,spread:nd,setList:ad}=Yt,{stintSet:od}=u;t.Text=class extends t.UI{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:r,fontWeight:n,italic:a,textCase:o,textOverflow:h,padding:l,width:d,height:c}=t;t.__lineHeight=Uh.number(e,r),t.__letterSpacing=Uh.number(i,r),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*r)/2,t.__font=`${a?"italic ":""}${"small-caps"===o?"small-caps ":""}${"normal"!==n?n+" ":""}${r||12}px ${s||"caption"}`,od(t,"__padding",l&&M.fourNumber(l)),od(t,"__clipText","show"!==h&&!t.__autoSize),od(t,"__isCharMode",d||c||t.__letterSpacing||"none"!==o),t.__textDrawData=Wh.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:r,__autoWidth:n,__autoHeight:a}=t;this.__updateTextDrawData();const{bounds:o}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=o,t.__lineHeight<i&&nd(o,i/2),n||a){if(h.x=n?o.x:0,h.y=a?o.y:0,h.width=n?o.width:t.width,h.height=a?o.height:t.height,r){const[e,i,s,r]=t.__padding;n&&(h.x-=r,h.width+=i+r),a&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),u.stintSet(this,"isOverflow",!rd(h,o)),this.isOverflow?(ad(t.__textBoxBounds={},[h,o]),e.renderChanged=!0):t.__textBoxBounds=h}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;sd(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__updateChange(){super.__updateChange();const t=this.__box;t&&(t.__onUpdateSize(),t.__updateChange())}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!e.exporting||super.__draw(t,e,i)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}},_e([Dn(gl)],t.Text.prototype,"__",void 0),_e([pn(0)],t.Text.prototype,"width",void 0),_e([pn(0)],t.Text.prototype,"height",void 0),_e([En()],t.Text.prototype,"boxStyle",void 0),_e([hn(!1)],t.Text.prototype,"resizeFontSize",void 0),_e([En("#000000")],t.Text.prototype,"fill",void 0),_e([vn("outside")],t.Text.prototype,"strokeAlign",void 0),_e([On("all")],t.Text.prototype,"hitFill",void 0),_e([pn("")],t.Text.prototype,"text",void 0),_e([pn("")],t.Text.prototype,"placeholder",void 0),_e([pn("caption")],t.Text.prototype,"fontFamily",void 0),_e([pn(12)],t.Text.prototype,"fontSize",void 0),_e([pn("normal")],t.Text.prototype,"fontWeight",void 0),_e([pn(!1)],t.Text.prototype,"italic",void 0),_e([pn("none")],t.Text.prototype,"textCase",void 0),_e([pn("none")],t.Text.prototype,"textDecoration",void 0),_e([pn(0)],t.Text.prototype,"letterSpacing",void 0),_e([pn({type:"percent",value:1.5})],t.Text.prototype,"lineHeight",void 0),_e([pn(0)],t.Text.prototype,"paraIndent",void 0),_e([pn(0)],t.Text.prototype,"paraSpacing",void 0),_e([pn("x")],t.Text.prototype,"writingMode",void 0),_e([pn("left")],t.Text.prototype,"textAlign",void 0),_e([pn("top")],t.Text.prototype,"verticalAlign",void 0),_e([pn(!0)],t.Text.prototype,"autoSizeAlign",void 0),_e([pn("normal")],t.Text.prototype,"textWrap",void 0),_e([pn("show")],t.Text.prototype,"textOverflow",void 0),_e([En(!1)],t.Text.prototype,"textEditing",void 0),t.Text=_e([Xn()],t.Text),t.Path=class extends t.UI{get __tag(){return"Path"}},_e([Dn(ul)],t.Path.prototype,"__",void 0),_e([vn("center")],t.Path.prototype,"strokeAlign",void 0),t.Path=_e([Xn()],t.Path),t.Pen=class extends t.Group{get __tag(){return"Pen"}setStyle(e){const i=this.pathElement=new t.Path(e);return this.pathStyle=e,this.__path=i.path||(i.path=[]),this.add(i),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,r,n){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,r){return this}ellipse(t,e,i,s,r,n,a,o){return this}arc(t,e,i,s,r,n){return this}arcTo(t,e,i,s,r){return this}drawEllipse(t,e,i,s,r,n,a,o){return this}drawArc(t,e,i,s,r,n){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}},_e([Dn(_l)],t.Pen.prototype,"__",void 0),_e([(t,e)=>{en(t,e,{get(){return this.__path}})}],t.Pen.prototype,"path",void 0),t.Pen=_e([Yn(Ws,["set","path","paint"]),Xn()],t.Pen),t.App=class extends t.Leafer{get __tag(){return"App"}get isApp(){return!0}constructor(t,e){super(t,e)}init(t,e){if(super.init(t,e),t){const{ground:e,tree:i,sky:s,editor:r}=t;e&&(this.ground=this.addLeafer(e)),(i||r)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||r)&&(this.sky=this.addLeafer(s)),r&&ne.editor(r,this)}}__setApp(){const{canvas:t}=this,{realCanvas:e,view:i}=this.config;e||i===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable()}__updateLocalBounds(){this.forEach(t=>t.updateLayout()),super.__updateLocalBounds()}start(){super.start(),this.forEach(t=>t.start())}stop(){this.forEach(t=>t.stop()),super.stop()}unlockLayout(){super.unlockLayout(),this.forEach(t=>t.unlockLayout())}lockLayout(){super.lockLayout(),this.forEach(t=>t.lockLayout())}forceRender(t,e){this.forEach(i=>i.forceRender(t,e))}addLeafer(e){const i=new t.Leafer(e);return this.add(i),i}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout(()=>this.add(t,e),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),s(e)||(t.canvas.childIndex=e),this.__listenChildEvents(t)}forEach(t){this.children.forEach(t)}__onCreated(){this.created=this.children.every(t=>t.created)}__onReady(){this.children.every(t=>t.ready)&&super.__onReady()}__onViewReady(){this.children.every(t=>t.viewReady)&&super.__onViewReady()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){t.context&&this.forEach(i=>e.matrix?i.__render(t,e):t.copyWorld(i.canvas,e.bounds))}__onResize(t){this.forEach(e=>e.resize(t)),super.__onResize(t)}updateLayout(){this.forEach(t=>t.updateLayout())}__getChildConfig(t){const e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&u.assign(e,t),this.autoLayout&&u.copyAttrs(e,this,Se),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[Xa.END,this.__onReady,this],[Ha.START,this.__onCreated,this],[Ha.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(Ha.END,this.__onChildRenderEnd,this))}},t.App=_e([Xn()],t.App);const hd={},ld={isHoldSpaceKey:()=>ld.isHold("Space"),isHold:t=>hd[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){hd[t]||(hd[t]=!0)},setUpCode(t){hd[t]=!1}},dd={LEFT:1,RIGHT:2,MIDDLE:4,defaultLeft(t){t.buttons||(t.buttons=1)},left:t=>1===t.buttons,right:t=>2===t.buttons,middle:t=>4===t.buttons};class cd extends Ta{get spaceKey(){return ld.isHoldSpaceKey()}get left(){return dd.left(this)}get right(){return dd.right(this)}get middle(){return dd.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return ld.isHoldKeys(t,this)}getBoxPoint(t){return(t||this.current).getBoxPoint(this)}getInnerPoint(t){return(t||this.current).getInnerPoint(this)}getLocalPoint(t){return(t||this.current).getLocalPoint(this)}getPagePoint(){return this.current.getPagePoint(this)}getInner(t){return this.getInnerPoint(t)}getLocal(t){return this.getLocalPoint(t)}getPage(){return this.getPagePoint()}static changeName(t,e){de.changeName(t,e)}}const{min:ud,max:_d,abs:pd}=Math,{float:gd,sign:fd}=M,{minX:yd,maxX:md,minY:vd,maxY:xd}=Yt,wd=new Gt,bd=new Gt,Ed={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&Pd.getValidMove(t.__localBoxBounds,Pd.getDragBounds(t),s,e,!0),Pd.axisMove(t,e)},limitScaleOf(t,e,i,s){const{dragBounds:r,dragBoundsType:n}=t;r&&Pd.getValidScaleOf(t.__localBoxBounds,Pd.getDragBounds(t),n,t.getLocalPointByInner(t.getInnerPointByBox(e)),i,s,!0)},axisMove(t,e){const{draggable:i}=t;"x"===i&&(e.y=0),"y"===i&&(e.x=0)},getDragBounds(t){const{dragBounds:e}=t;return"parent"===e?t.parent.boxBounds:e},isInnerMode:(t,e,i,s)=>"inner"===i||"auto"===i&&t[s]>e[s],getValidMove(t,e,i,s,r){const n=t.x+s.x,a=t.y+s.y,o=n+t.width,h=a+t.height,l=e.x+e.width,d=e.y+e.height;return r||(s=Object.assign({},s)),Pd.isInnerMode(t,e,i,"width")?n>e.x?s.x+=e.x-n:o<l&&(s.x+=l-o):n<e.x?s.x+=e.x-n:o>l&&(s.x+=l-o),Pd.isInnerMode(t,e,i,"height")?a>e.y?s.y+=e.y-a:h<d&&(s.y+=d-h):a<e.y?s.y+=e.y-a:h>d&&(s.y+=d-h),s.x=gd(s.x),s.y=gd(s.y),s},getValidScaleOf(t,e,i,s,r,n,o){o||(r=Object.assign({},r)),bd.set(e),wd.set(t).scaleOf(s,r.x,r.y);const h=(s.x-t.x)/t.width,l=1-h,d=(s.y-t.y)/t.height,c=1-d;let u,_,p,g,f=1,y=1;return Pd.isInnerMode(t,e,i,"width")?(r.x<0&&wd.scaleOf(s,f=1/r.x,1),p=gd(wd.minX-bd.minX),g=gd(bd.maxX-wd.maxX),u=h&&p>0?1+p/(h*wd.width):1,_=l&&g>0?1+g/(l*wd.width):1,f*=_d(u,_)):(r.x<0&&((gd(yd(t)-yd(e))<=0||gd(md(e)-md(t))<=0)&&wd.scaleOf(s,f=1/r.x,1),wd.unsign()),p=gd(bd.minX-wd.minX),g=gd(wd.maxX-bd.maxX),u=h&&p>0?1-p/(h*wd.width):1,_=l&&g>0?1-g/(l*wd.width):1,f*=ud(u,_)),Pd.isInnerMode(t,e,i,"height")?(r.y<0&&wd.scaleOf(s,1,y=1/r.y),p=gd(wd.minY-bd.minY),g=gd(bd.maxY-wd.maxY),u=d&&p>0?1+p/(d*wd.height):1,_=c&&g>0?1+g/(c*wd.height):1,y*=_d(u,_),n&&(u=_d(pd(f),pd(y)),f=fd(f)*u,y=fd(y)*u)):(r.y<0&&((gd(vd(t)-vd(e))<=0||gd(xd(e)-xd(t))<=0)&&wd.scaleOf(s,1,y=1/r.y),wd.unsign()),p=gd(bd.minY-wd.minY),g=gd(wd.maxY-bd.maxY),u=d&&p>0?1-p/(d*wd.height):1,_=c&&g>0?1-g/(c*wd.height):1,y*=ud(u,_)),r.x*=a(f)?f:1,r.y*=a(y)?y:1,r}},Pd=Ed;t.PointerEvent=class extends cd{},t.PointerEvent.POINTER="pointer",t.PointerEvent.BEFORE_DOWN="pointer.before_down",t.PointerEvent.BEFORE_MOVE="pointer.before_move",t.PointerEvent.BEFORE_UP="pointer.before_up",t.PointerEvent.DOWN="pointer.down",t.PointerEvent.MOVE="pointer.move",t.PointerEvent.UP="pointer.up",t.PointerEvent.OVER="pointer.over",t.PointerEvent.OUT="pointer.out",t.PointerEvent.ENTER="pointer.enter",t.PointerEvent.LEAVE="pointer.leave",t.PointerEvent.TAP="tap",t.PointerEvent.DOUBLE_TAP="double_tap",t.PointerEvent.CLICK="click",t.PointerEvent.DOUBLE_CLICK="double_click",t.PointerEvent.LONG_PRESS="long_press",t.PointerEvent.LONG_TAP="long_tap",t.PointerEvent.MENU="pointer.menu",t.PointerEvent.MENU_TAP="pointer.menu_tap",t.PointerEvent=_e([Hn()],t.PointerEvent);const Bd=t.PointerEvent,kd={};t.DragEvent=class extends t.PointerEvent{static setList(t){this.list=t instanceof ch?t:new ch(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const r=t.getLocalPoint(i,null,!0);return ht.move(r,e.x-t.x,e.y-t.y),s&&this.limitMove(t,r),Ed.axisMove(t,r),r}static limitMove(t,e){Ed.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(kd,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(kd,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(kd,null,!0)}getPageTotal(){return this.getPageMove(!0)}getInnerTotal(t){return this.getInnerMove(t,!0)}getLocalTotal(t){return this.getLocalMove(t,!0)}getPageBounds(){const t=this.getPageTotal(),e=this.getPagePoint(),i={};return Yt.set(i,e.x-t.x,e.y-t.y,t.x,t.y),Yt.unsign(i),i}assignMove(t){kd.x=t?this.totalX:this.moveX,kd.y=t?this.totalY:this.moveY}},t.DragEvent.BEFORE_DRAG="drag.before_drag",t.DragEvent.START="drag.start",t.DragEvent.DRAG="drag",t.DragEvent.END="drag.end",t.DragEvent.OVER="drag.over",t.DragEvent.OUT="drag.out",t.DragEvent.ENTER="drag.enter",t.DragEvent.LEAVE="drag.leave",t.DragEvent=_e([Hn()],t.DragEvent);const Sd=t.DragEvent;t.DropEvent=class extends t.PointerEvent{static setList(e){t.DragEvent.setList(e)}static setData(e){t.DragEvent.setData(e)}},t.DropEvent.DROP="drop",t.DropEvent=_e([Hn()],t.DropEvent),t.MoveEvent=class extends t.DragEvent{},t.MoveEvent.BEFORE_MOVE="move.before_move",t.MoveEvent.START="move.start",t.MoveEvent.MOVE="move",t.MoveEvent.END="move.end",t.MoveEvent=_e([Hn()],t.MoveEvent),t.TouchEvent=class extends cd{},t.TouchEvent=_e([Hn()],t.TouchEvent);const Rd=t.TouchEvent;t.RotateEvent=class extends t.PointerEvent{},t.RotateEvent.BEFORE_ROTATE="rotate.before_rotate",t.RotateEvent.START="rotate.start",t.RotateEvent.ROTATE="rotate",t.RotateEvent.END="rotate.end",t.RotateEvent=_e([Hn()],t.RotateEvent),t.SwipeEvent=class extends t.DragEvent{},t.SwipeEvent.SWIPE="swipe",t.SwipeEvent.LEFT="swipe.left",t.SwipeEvent.RIGHT="swipe.right",t.SwipeEvent.UP="swipe.up",t.SwipeEvent.DOWN="swipe.down",t.SwipeEvent=_e([Hn()],t.SwipeEvent),t.ZoomEvent=class extends t.PointerEvent{},t.ZoomEvent.BEFORE_ZOOM="zoom.before_zoom",t.ZoomEvent.START="zoom.start",t.ZoomEvent.ZOOM="zoom",t.ZoomEvent.END="zoom.end",t.ZoomEvent=_e([Hn()],t.ZoomEvent),t.KeyEvent=class extends cd{},t.KeyEvent.BEFORE_DOWN="key.before_down",t.KeyEvent.BEFORE_UP="key.before_up",t.KeyEvent.DOWN="key.down",t.KeyEvent.HOLD="key.hold",t.KeyEvent.UP="key.up",t.KeyEvent=_e([Hn()],t.KeyEvent);const Td={getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e,i)=>Object.assign(Object.assign({},t),{list:e,data:i}),getSwipeDirection:e=>e<-45&&e>-135?t.SwipeEvent.UP:e>45&&e<135?t.SwipeEvent.DOWN:e<=45&&e>=-45?t.SwipeEvent.RIGHT:t.SwipeEvent.LEFT,getSwipeEventData:(t,e,i)=>Object.assign(Object.assign({},i),{moveX:e.moveX,moveY:e.moveY,totalX:i.x-t.x,totalY:i.y-t.y,type:Cd.getSwipeDirection(ht.getAngle(t,i))}),getBase(t){const e=1===t.button?4:t.button;return{altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,buttons:s(t.buttons)?1:0===t.buttons?e:t.buttons,origin:t}},pathHasEventType(t,e){const{list:i}=t;for(let t=0,s=i.length;t<s;t++)if(i[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const i=new ch,{list:s}=t;for(let t=0,r=s.length;t<r;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:e=>e&&e.list.some(e=>ia.draggable(e)||!e.isLeafer&&e.hasEvent(t.DragEvent.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},Cd=Td,Ld=new ch,{getDragEventData:Od,getDropEventData:Id,getSwipeEventData:Dd}=Td;class Ad{constructor(t){this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=Od(t,t,t),this.canAnimate=this.canDragOut=!0}getList(e,i){const{proxy:s}=this.interaction.selector,r=s&&s.list.length,n=t.DragEvent.list||this.draggableList||Ld;return this.dragging&&(r?e?Ld:new ch(i?[...s.list,...s.dragHoverExclude]:s.list):n)}checkDrag(e,i){const{interaction:s}=this;if(this.moving&&e.buttons<1)return this.canAnimate=!1,void s.pointerCancel();!this.moving&&i&&(this.moving=s.canMove(this.downData)||s.isHoldRightKey||s.isMobileDragEmpty)&&(this.dragData.moveType="drag",s.emit(t.MoveEvent.START,this.dragData)),this.moving||this.dragStart(e,i),this.drag(e)}dragStart(e,i){this.dragging||(this.dragging=i&&dd.left(e),this.dragging&&(this.interaction.emit(t.DragEvent.START,this.dragData),this.getDraggableList(this.dragData.path),this.setDragStartPoints(this.realDraggableList=this.getList(!0))))}setDragStartPoints(t){this.dragStartPoints={},t.forEach(t=>this.dragStartPoints[t.innerId]={x:t.x,y:t.y})}getDraggableList(t){let e;for(let i=0,s=t.length;i<s;i++)if(e=t.list[i],ia.draggable(e)){this.draggableList=new ch(e);break}}drag(e){const{interaction:i,dragData:s,downData:r}=this,{path:n,throughPath:a}=r;this.dragData=Od(r,s,e),a&&(this.dragData.throughPath=a),this.dragData.path=n,this.moving?(this.dragData.moveType="drag",i.emit(t.MoveEvent.BEFORE_MOVE,this.dragData),i.emit(t.MoveEvent.MOVE,this.dragData)):this.dragging&&(this.dragReal(),i.emit(t.DragEvent.BEFORE_DRAG,this.dragData),i.emit(t.DragEvent.DRAG,this.dragData))}dragReal(e){const{interaction:i}=this,{running:s}=i,r=this.realDraggableList;if(r.length&&s){const{totalX:s,totalY:a}=this.dragData,{dragLimitAnimate:h}=i.p,l=!h||!!e;r.forEach(i=>{if(i.draggable){const r=n(i.draggable),d=t.DragEvent.getValidMove(i,this.dragStartPoints[i.innerId],{x:s,y:a},l||r);h&&!r&&e?ia.animateMove(i,d,o(h)?h:.3):i.move(d)}})}}dragOverOrOut(e){const{interaction:i}=this,{dragOverPath:s}=this,{path:r}=e;this.dragOverPath=r,s?r.indexAt(0)!==s.indexAt(0)&&(i.emit(t.DragEvent.OUT,e,s),i.emit(t.DragEvent.OVER,e,r)):i.emit(t.DragEvent.OVER,e,r)}dragEnterOrLeave(e){const{interaction:i}=this,{dragEnterPath:s}=this,{path:r}=e;i.emit(t.DragEvent.LEAVE,e,s,r),i.emit(t.DragEvent.ENTER,e,r,s),this.dragEnterPath=r}dragEnd(t,e){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t,e)||this.dragEndReal(t))}dragEndReal(e){const{interaction:i,downData:s,dragData:r}=this;e||(e=r);const{path:n,throughPath:a}=s,o=Od(s,e,e);if(a&&(o.throughPath=a),o.path=n,this.moving&&(this.moving=!1,o.moveType="drag",i.emit(t.MoveEvent.END,o)),this.dragging){const n=this.getList();this.dragging=!1,i.p.dragLimitAnimate&&this.dragReal(!0),i.emit(t.DragEvent.END,o),this.swipe(e,s,r,o),this.drop(e,n,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:r}=this;if(ht.getDistance(e,t)>r.config.pointer.swipeDistance){const t=Dd(e,i,s);this.interaction.emit(t.type,t)}}drop(e,i,s){const r=Id(e,i,t.DragEvent.data);r.path=s,this.interaction.emit(t.DropEvent.DROP,r),this.interaction.emit(t.DragEvent.LEAVE,e,s)}dragReset(){t.DragEvent.list=t.DragEvent.data=this.draggableList=this.dragData=this.downData=this.dragOverPath=this.dragEnterPath=null}checkDragEndAnimate(t,e){return!1}animate(t,e){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const Md=Qt.get("emit");const Wd=["move","zoom","rotate","key"];function Fd(t,e,i,s,r){if(Wd.some(t=>e.startsWith(t))&&t.__.hitChildren&&!Nd(t,r)){let n;for(let a=0,o=t.children.length;a<o;a++)n=t.children[a],!i.path.has(n)&&n.__.hittable&&Ud(n,e,i,s,r)}}function Ud(t,e,i,s,r){if(t.destroyed)return!1;if(t.__.hitSelf&&!Nd(t,r)&&(Vh.updateEventStyle&&!s&&Vh.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const r=de.get(e,i);if(t.emitEvent(r,s),r.isStop)return!0}return!1}function Nd(t,e){return e&&e.has(t)}const zd={wheel:{zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:{x:20,y:8}},pointer:{type:"pointer",snap:!0,hitRadius:5,tapTime:120,longPressTime:800,transformTime:500,hover:!0,dragHover:!0,dragDistance:2,swipeDistance:20},touch:{preventDefault:"auto"},multiTouch:{},move:{autoDistance:2},zoom:{},cursor:!0,keyEvent:!0},{pathHasEventType:Yd,pathCanDrag:Xd,pathHasOutside:Hd}=Td;class jd{get dragging(){return this.dragger.dragging}get transforming(){return this.transformer.transforming}get moveMode(){return!0===this.m.drag||this.isHoldSpaceKey||this.isHoldMiddleKey||this.isHoldRightKey&&this.dragger.moving||this.isDragEmpty}get canHover(){return this.p.hover&&!this.config.mobile}get isDragEmpty(){return this.m.dragEmpty&&this.isRootPath(this.hoverData)&&(!this.downData||this.isRootPath(this.downData))}get isMobileDragEmpty(){return this.m.dragEmpty&&!this.canHover&&this.downData&&this.isTreePath(this.downData)}get isHoldMiddleKey(){return this.m.holdMiddleKey&&this.downData&&dd.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&dd.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&ld.isHoldSpaceKey()}get m(){return this.config.move}get p(){return this.config.pointer}get hitRadius(){return this.p.hitRadius}constructor(t,e,i,s){this.config=u.clone(zd),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new ch(t),this.createTransformer(),this.dragger=new Ad(this),s&&(this.config=u.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(e,i){e||(e=this.hoverData),e&&(dd.defaultLeft(e),this.updateDownData(e),this.checkPath(e,i),this.downTime=Date.now(),this.emit(t.PointerEvent.BEFORE_DOWN,e),this.emit(t.PointerEvent.DOWN,e),dd.left(e)&&(this.tapWait(),this.longPressWait(e)),this.waitRightTap=dd.right(e),this.dragger.setDragData(e),this.isHoldRightKey||this.updateCursor(e))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&dd.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(e){if(this.emit(t.PointerEvent.BEFORE_MOVE,e,this.defaultPath),this.downData){const t=ht.getDistance(this.downData,e)>this.p.dragDistance;t&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(e,t)}this.dragger.moving||(this.updateHoverData(e),this.checkPath(e),this.emit(t.PointerEvent.MOVE,e),this.pointerHover(e),this.dragging&&(this.dragger.dragOverOrOut(e),this.dragger.dragEnterOrLeave(e))),this.updateCursor(this.downData||e)}pointerUp(e){const{downData:i}=this;if(e||(e=i),!i)return;dd.defaultLeft(e),e.multiTouch=i.multiTouch,this.findPath(e);const s=Object.assign(Object.assign({},e),{path:e.path.clone()});e.path.addList(i.path.list),this.checkPath(e),this.downData=null,this.emit(t.PointerEvent.BEFORE_UP,e),this.emit(t.PointerEvent.UP,e),this.touchLeave(e),e.isCancel||(this.tap(e),this.menuTap(e)),this.dragger.dragEnd(e),this.updateCursor(s)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(e){this.findPath(e),this.emit(t.PointerEvent.MENU,e),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(e)}menuTap(e){this.waitRightTap&&this.waitMenuTap&&(this.emit(t.PointerEvent.MENU_TAP,e),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(e){if(!this.config.keyEvent)return;this.emit(t.KeyEvent.BEFORE_DOWN,e,this.defaultPath);const{code:i}=e;this.downKeyMap[i]||(this.downKeyMap[i]=!0,ld.setDownCode(i),this.emit(t.KeyEvent.HOLD,e,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(t.KeyEvent.DOWN,e,this.defaultPath)}keyUp(e){if(!this.config.keyEvent)return;this.emit(t.KeyEvent.BEFORE_UP,e,this.defaultPath);const{code:i}=e;this.downKeyMap[i]=!1,ld.setUpCode(i),this.emit(t.KeyEvent.UP,e,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new ch),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(e){const{path:i}=e,{overPath:s}=this;this.overPath=i,s?i.indexAt(0)!==s.indexAt(0)&&(this.emit(t.PointerEvent.OUT,e,s),this.emit(t.PointerEvent.OVER,e,i)):this.emit(t.PointerEvent.OVER,e,i)}pointerEnterOrLeave(e){let{path:i}=e;this.downData&&!this.moveMode&&(i=i.clone(),this.downData.path.forEach(t=>i.add(t)));const{enterPath:s}=this;this.enterPath=i,this.emit(t.PointerEvent.LEAVE,e,s,i),this.emit(t.PointerEvent.ENTER,e,i,s)}touchLeave(e){"touch"===e.pointerType&&this.enterPath&&(this.emit(t.PointerEvent.LEAVE,e),this.dragger.dragging&&this.emit(t.DropEvent.LEAVE,e))}tap(e){const{pointer:i}=this.config,s=this.longTap(e);if(!i.tapMore&&s)return;if(!this.waitTap)return;i.tapMore&&this.emitTap(e);const r=Date.now()-this.downTime,n=[t.PointerEvent.DOUBLE_TAP,t.PointerEvent.DOUBLE_CLICK].some(t=>Yd(e.path,t));r<i.tapTime+50&&n?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(e)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout(()=>{i.tapMore||(this.tapWaitCancel(),this.emitTap(e))},i.tapTime))):i.tapMore||(this.tapWaitCancel(),this.emitTap(e))}findPath(t,e){const{hitRadius:i,through:s}=this.p,{bottomList:r,target:n}=this;y.backgrounder||t.origin||n&&n.updateLayout();const a=this.selector.getByPoint(t,i,Object.assign({bottomList:r,name:t.type},e||{through:s}));return a.throughPath&&(t.throughPath=a.throughPath),t.path=a.path,a.path}isRootPath(t){return t&&t.path.list[0].isLeafer}isTreePath(t){const e=this.target.app;return!(!e||!e.isApp)&&(e.editor&&!t.path.has(e.editor)&&t.path.has(e.tree)&&!t.target.syncEventer)}checkPath(t,e){(e||this.moveMode&&!Hd(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!Xd(t.path))&&!Hd(t.path)}isDrag(t){return this.dragger.getList().has(t)}isPress(t){return this.downData&&this.downData.path.has(t)}isHover(t){return this.enterPath&&this.enterPath.has(t)}isFocus(t){return this.focusData===t}cancelHover(){const{hoverData:t}=this;t&&(t.path=this.defaultPath,this.pointerHover(t))}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(e){e||(e=this.hoverData),e&&(this.findPath(e,{exclude:this.dragger.getList(!1,!0),name:t.PointerEvent.MOVE}),this.hoverData=e)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let t=0,r=s.length;t<r&&(e=s.list[t],i=e.syncEventer&&e.syncEventer.cursor||e.cursor,!i);t++);this.setCursor(i)}setCursor(t){this.cursor=t}getLocal(t,e){const i=this.canvas.getClientBounds(e),s={x:t.clientX-i.x,y:t.clientY-i.y},{bounds:r}=this.canvas;return s.x*=r.width/i.width,s.y*=r.height/i.height,this.p.snap&&ht.round(s),s}emitTap(e){this.emit(t.PointerEvent.TAP,e),this.emit(t.PointerEvent.CLICK,e)}emitDoubleTap(e){this.emit(t.PointerEvent.DOUBLE_TAP,e),this.emit(t.PointerEvent.DOUBLE_CLICK,e)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){this.waitTap&&(clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0)}longPressWait(e){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout(()=>{this.longPressed=!0,this.emit(t.PointerEvent.LONG_PRESS,e)},this.p.longPressTime)}longTap(e){let i;return this.longPressed&&(this.emit(t.PointerEvent.LONG_TAP,e),(Yd(e.path,t.PointerEvent.LONG_TAP)||Yd(e.path,t.PointerEvent.LONG_PRESS))&&(i=!0)),this.longPressWaitCancel(),i}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new Gt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(o(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(za.RESIZE,this.__onResize,this)],t.once(ja.READY,()=>this.__onResize())}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,i,s){this.running&&function(t,e,i,s){if(!i&&!e.path)return;let r;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let n=i.length-1;n>-1;n--){if(r=i.list[n],Ud(r,t,e,!0,s))return;r.isApp&&Fd(r,t,e,!0,s)}for(let n=0,a=i.length;n<a;n++)if(r=i.list[n],r.isApp&&Fd(r,t,e,!1,s),Ud(r,t,e,!1,s))return}catch(t){Md.error(t)}}(t,e,i,s)}destroy(){this.__eventIds.length&&(this.stop(),this.__removeListenEvents(),this.dragger.destroy(),this.transformer&&this.transformer.destroy(),this.downData=this.overPath=this.enterPath=null)}}class Gd{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}Gd.custom={};class Vd extends ue{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new ch,this.pixelList=new ch}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),ne.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),ne.hitCanvas()}clearImageType(){this.__clearLeafList(this.pixelList)}clearPathType(){this.__clearLeafList(this.pathList)}__clearLeafList(t){t.length&&(t.forEach(t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)}),t.reset())}__autoClear(){this.pathList.length+this.pixelList.length>this.maxTotal&&this.clear()}clear(){this.clearPathType(),this.clearImageType()}}y.getSelector=function(t){return t.leafer?t.leafer.selector:y.selector||(y.selector=ne.selector())};const{toInnerRadiusPointOf:Kd,copy:qd,setRadius:Zd}=ht,{hitRadiusPoint:Qd,hitPoint:Jd}=Yt,$d={},tc={},ec=t.Leaf.prototype;ec.hit=function(t,e=0){this.updateLayout(),qd(tc,t),Zd(tc,e);const i=this.__world;return!!(e?Qd(i,tc):Jd(i,tc))&&(this.isBranch?y.getSelector(this).hitPoint(Object.assign({},tc),e,{target:this}):this.__hitWorld(tc))},ec.__hitWorld=function(t){const e=this.__;if(!e.hitSelf)return!1;const i=this.__world,s=this.__layout,r=i.width<10&&i.height<10;if(e.hitRadius&&(qd($d,t),Zd(t=$d,e.hitRadius)),Kd(t,i,$d),e.hitBox||r){if(Yt.hitRadiusPoint(s.boxBounds,$d))return!0;if(r)return!1}return!s.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),s.boundsChanged||(s.hitCanvasChanged=!1)),this.__hit($d)},ec.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},ec.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},ec.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},ec.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const ic=new gt,sc=t.UI.prototype;sc.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const{hitCanvasManager:t}=this.leafer||this.parent&&this.parent.leafer||{};if(!t)return;const e=this.__,i=(e.__isAlphaPixelFill||e.__isCanvas)&&"pixel"===e.hitFill,s=e.__isAlphaPixelStroke&&"pixel"===e.hitStroke,r=i||s;this.__hitCanvas||(this.__hitCanvas=r?t.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):t.getPathType(this));const n=this.__hitCanvas;if(r){const{renderBounds:t}=this.__layout,r=y.image.hitCanvasSize,a=n.hitScale=Vt.set(0,0,r,r).getFitMatrix(t).a,{x:o,y:h,width:l,height:d}=Vt.set(t).scale(a);n.resize({width:l,height:d,pixelRatio:1}),n.clear(),Zr.patternLocked=!0,this.__renderShape(n,{matrix:ic.setWith(this.__world).scaleWith(1/a).invertWith().translate(-o,-h),ignoreFill:!i,ignoreStroke:!s}),Zr.patternLocked=!1,n.resetTransform(),e.__isHitPixel=!0}else e.__isHitPixel&&(e.__isHitPixel=!1);this.__drawHitPath(n),n.setStrokeOptions(e)},sc.__hit=function(t){if(this.__box&&this.__box.__hit(t))return!0;const e=this.__;if(e.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:i}=e,s=(e.fill||e.__isCanvas)&&("path"===i||"pixel"===i&&!(e.__isAlphaPixelFill||e.__isCanvas))||"all"===i;if(s&&this.__hitFill(t))return!0;const{hitStroke:r,__maxStrokeWidth:n}=e,a=e.stroke&&("path"===r||"pixel"===r&&!e.__isAlphaPixelStroke)||"all"===r;if(!s&&!a)return!1;const o=2*t.radiusX;let h=o;if(a)switch(e.strokeAlign){case"inside":if(h+=2*n,!s&&this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=o;break;case"center":h+=n;break;case"outside":if(h+=2*n,!s){if(!this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=o}}return!!h&&this.__hitStroke(t,h)};const rc=t.UI.prototype,nc=t.Rect.prototype,ac=t.Box.prototype;nc.__updateHitCanvas=ac.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?rc.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},nc.__hitFill=ac.__hitFill=function(t){return this.__hitCanvas?rc.__hitFill.call(this,t):Yt.hitRadiusPoint(this.__layout.boxBounds,t)},t.Text.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:r,__textDrawData:n}=this.__;t.beginPath(),r<0?this.__drawPathByBox(t):n.rows.forEach(r=>t.rect(r.x,r.y-s,r.width,e<i?i:e))},t.Group.prototype.pick=function(t,e){return e||(e=i),this.updateLayout(),y.getSelector(this).getByPoint(t,e.hitRadius||0,Object.assign(Object.assign({},e),{target:this}))};const oc=Re.prototype;function hc(t,e,i){t.__.__font?zh.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function lc(t,e,i,s,r){const n=i.__;d(t)?zh.drawStrokesStyle(t,e,!1,i,s,r):(s.setStroke(t,n.__strokeWidth*e,n),s.stroke()),n.__useArrow&&zh.strokeArrow(t,i,s,r)}function dc(t,e,i,s,r){const n=i.__;d(t)?zh.drawStrokesStyle(t,e,!0,i,s,r):(s.setStroke(t,n.__strokeWidth*e,n),zh.drawTextStroke(i,s,r))}function cc(t,e,i,s,r){const n=s.getSameCanvas(!0,!0);n.font=i.__.__font,dc(t,2,i,n,r),n.blendMode="outside"===e?"destination-out":"destination-in",zh.fillText(i,n,r),n.blendMode="normal",ia.copyCanvasByWorld(i,s,n),n.recycle(i.__nowWorld)}oc.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},oc.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},oc.hitPixel=function(t,e,i=1){let{x:s,y:r,radiusX:n,radiusY:a}=t;e&&(s-=e.x,r-=e.y),Vt.set(s-n,r-a,2*n,2*a).scale(i).ceil();const{data:o}=this.context.getImageData(Vt.x,Vt.y,Vt.width||1,Vt.height||1);for(let t=0,e=o.length;t<e;t+=4)if(o[t+3]>0)return!0;return o[3]>0};const{getSpread:uc,copyAndSpread:_c,toOuterOf:pc,getOuterOf:gc,getByMove:fc,move:yc,getIntersectData:mc}=Yt,vc={};let xc;const{stintSet:wc}=u,{hasTransparent:bc}=Fh;function Ec(t,e,i){if(!d(e)||!1===e.visible||0===e.opacity)return;let r;const{boxBounds:a}=i.__layout;switch(e.type){case"image":r=Yh.image(i,t,e,a,!xc||!xc[e.url]);break;case"linear":r=Xh.linearGradient(e,a);break;case"radial":r=Xh.radialGradient(e,a);break;case"angular":r=Xh.conicGradient(e,a);break;case"solid":const{type:n,color:o,opacity:h}=e;r={type:n,style:Fh.string(o,h)};break;default:s(e.r)||(r={type:"solid",style:Fh.string(e)})}if(r&&(r.originPaint=e,n(r.style)&&bc(r.style)&&(r.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;r.strokeStyle=e.style}return r}const Pc={compute:function(t,e){const i=e.__,s=[];let r,n,a,o=i.__input[t];l(o)||(o=[o]),xc=Yh.recycleImage(t,i);for(let i,r=0,n=o.length;r<n;r++)(i=Ec(t,o[r],e))&&(s.push(i),i.strokeStyle&&(a||(a=1),i.strokeStyle.strokeWidth&&(a=Math.max(a,i.strokeStyle.strokeWidth))));i["_"+t]=s.length?s:void 0,s.length?(s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(r=!0),n=!0),"fill"===t?(wc(i,"__isAlphaPixelFill",r),wc(i,"__isTransparentFill",n)):(wc(i,"__isAlphaPixelStroke",r),wc(i,"__isTransparentStroke",n),wc(i,"__hasMultiStrokeStyle",a))):i.__removePaint(t,!1)},fill:function(t,e,i,s){i.fillStyle=t,hc(e,i,s)},fills:function(t,e,i,s){let r,n,a;for(let o=0,h=t.length;o<h;o++){if(r=t[o],n=r.originPaint,r.image){if(a?a++:a=1,Yh.checkImage(r,!e.__.__font,e,i,s))continue;if(!r.style){1===a&&r.image.isPlacehold&&e.drawImagePlaceholder(r,i,s);continue}}if(i.fillStyle=r.style,r.transform||n.scaleFixed){if(i.save(),r.transform&&i.transform(r.transform),n.scaleFixed){const{scaleX:t,scaleY:s}=e.getRenderScaleData(!0);(!0===n.scaleFixed||"zoom-in"===n.scaleFixed&&t>1&&s>1)&&i.scale(1/t,1/s)}n.blendMode&&(i.blendMode=n.blendMode),hc(e,i,s),i.restore()}else n.blendMode?(i.saveBlendMode(n.blendMode),hc(e,i,s),i.restoreBlendMode()):hc(e,i,s)}},fillPathOrText:hc,fillText:function(t,e,i){const s=t.__,{rows:r,decorationY:n}=s.__textDrawData;let a;s.__isPlacehold&&s.placeholderColor&&(e.fillStyle=s.placeholderColor);for(let t=0,i=r.length;t<i;t++)a=r[t],a.text?e.fillText(a.text,a.x,a.y):a.data&&a.data.forEach(t=>{e.fillText(t.char,t.x,a.y)});if(n){const{decorationColor:t,decorationHeight:i}=s.__textDrawData;t&&(e.fillStyle=t),r.forEach(t=>n.forEach(s=>e.fillRect(t.x,t.y+s,t.width,i)))}},stroke:function(t,e,i,s){const r=e.__;if(r.__strokeWidth)if(r.__font)zh.strokeText(t,e,i,s);else switch(r.strokeAlign){case"center":lc(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),lc(t,2,e,i,s),i.restore()}(t,e,i,s);break;case"outside":!function(t,e,i,s){const r=e.__;if(r.__fillAfterStroke)lc(t,2,e,i,s);else{const{renderBounds:n}=e.__layout,a=i.getSameCanvas(!0,!0);e.__drawRenderPath(a),lc(t,2,e,a,s),a.clipUI(r),a.clearWorld(n),ia.copyCanvasByWorld(e,i,a),a.recycle(e.__nowWorld)}}(t,e,i,s)}},strokes:function(t,e,i,s){zh.stroke(t,e,i,s)},strokeText:function(t,e,i,s){switch(e.__.strokeAlign){case"center":dc(t,1,e,i,s);break;case"inside":cc(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?dc(t,2,e,i,s):cc(t,"outside",e,i,s)}},drawTextStroke:function(t,e,i){let s,r=t.__.__textDrawData;const{rows:n,decorationY:a}=r;for(let t=0,i=n.length;t<i;t++)s=n[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(a){const{decorationHeight:t}=r;n.forEach(i=>a.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}},drawStrokesStyle:function(t,e,i,s,r,n){let a;const o=s.__,{__hasMultiStrokeStyle:h}=o;h||r.setStroke(void 0,o.__strokeWidth*e,o);for(let l=0,d=t.length;l<d;l++)if(a=t[l],(!a.image||!Yh.checkImage(a,!1,s,r,n))&&a.style){if(h){const{strokeStyle:t}=a;t?r.setStroke(a.style,o.__getRealStrokeWidth(t)*e,o,t):r.setStroke(a.style,o.__strokeWidth*e,o)}else r.strokeStyle=a.style;a.originPaint.blendMode?(r.saveBlendMode(a.originPaint.blendMode),i?zh.drawTextStroke(s,r,n):r.stroke(),r.restoreBlendMode()):i?zh.drawTextStroke(s,r,n):r.stroke()}},shape:function(t,e,i){const s=e.getSameCanvas(),r=e.bounds,n=t.__nowWorld,a=t.__layout,o=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let h,l,d,c,u,_;pc(a.strokeSpread?(_c(vc,a.boxBounds,a.strokeSpread),vc):a.boxBounds,n,o);let{scaleX:p,scaleY:g}=t.getRenderScaleData(!0);if(r.includes(o))_=s,h=u=o,l=n;else{let s;if(y.fullImageShadow)s=o;else{const t=a.renderShapeSpread?uc(r,k.swapAndScale(a.renderShapeSpread,p,g)):r;s=mc(t,o)}c=r.getFitMatrix(s);let{a:f,d:m}=c;c.a<1&&(_=e.getSameCanvas(),t.__renderShape(_,i),p*=f,g*=m),u=gc(o,c),h=fc(u,-c.e,-c.f),l=gc(n,c),yc(l,-c.e,-c.f);const v=i.matrix;v?(d=new gt(c),d.multiply(v),f*=v.scaleX,m*=v.scaleY):d=c,d.withScale(f,m),i=Object.assign(Object.assign({},i),{matrix:d})}return t.__renderShape(s,i),{canvas:s,matrix:d,fitMatrix:c,bounds:h,renderBounds:l,worldCanvas:_,shapeBounds:u,scaleX:p,scaleY:g}}};let Bc,kc=new Gt;const{isSame:Sc}=Yt;function Rc(t,e,i,s,r,n){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=s.width/e.pixelRatio,e.__naturalHeight=s.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||Yh.createData(r,s,i,n),!0}function Tc(t,e){Oc(t,Da.LOAD,e)}function Cc(t,e){Oc(t,Da.LOADED,e)}function Lc(t,e,i){e.error=i,t.forceUpdate("surface"),Oc(t,Da.ERROR,e)}function Oc(t,e,i){t.hasEvent(e)&&t.emitEvent(new Da(e,i))}function Ic(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:Dc,translate:Ac}=Q,Mc=new Gt,Wc={},Fc={};function Uc(t,e,i,s){const r=n(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&r<0?0:r}let Nc={},zc={a:1,b:0,c:0,d:1,e:0,f:0};const{get:Yc,set:Xc,rotateOfOuter:Hc,translate:jc,scaleOfOuter:Gc,multiplyParent:Vc,scale:Kc,rotate:qc,skew:Zc}=Q;function Qc(t,e,i,s,r,n,a,o){a&&qc(t,a),o&&Zc(t,o.x,o.y),r&&Kc(t,r,n),jc(t,e.x+i,e.y+s)}const{get:Jc,scale:$c,copy:tu}=Q,{getFloorScale:eu}=M,{abs:iu}=Math;const su={image:function(t,e,i,s,r){let n,a;const o=Zr.get(i);return Bc&&i===Bc.paint&&Sc(s,Bc.boxBounds)?n=Bc.leafPaint:(n={type:i.type,image:o},o.hasAlphaPixel&&(n.isTransparent=!0),Bc=o.use>1?{leafPaint:n,paint:i,boxBounds:kc.set(s)}:null),(r||o.loading)&&(a={image:o,attrName:e,attrValue:i}),o.ready?(Rc(t,e,i,o,n,s),r&&(Tc(t,a),Cc(t,a))):o.error?r&&Lc(t,a,o.error):(r&&(Ic(t,!0),Tc(t,a)),n.loadId=o.load(()=>{Ic(t,!1),t.destroyed||(Rc(t,e,i,o,n,s)&&(o.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Cc(t,a)),n.loadId=void 0},e=>{Ic(t,!1),Lc(t,a,e),n.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{o.ready||(o.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):o.isPlacehold=!0)),n},checkImage:function(t,e,i,s,r){const{scaleX:n,scaleY:a}=Yh.getImageRenderScaleData(t,i,s,r),{image:o,data:h,originPaint:l}=t,{exporting:d}=r;return!(!h||t.patternId===n+"-"+a&&!d)&&(e&&(h.repeat?e=!1:l.changeful||"miniapp"===y.name&&za.isResizing(i)||d||(e=y.image.isLarge(o,n,a))),e?(i.__.__isFastShadow&&(s.fillStyle=t.style||"#000",s.fill()),Yh.drawImage(t,n,a,i,s,r),!0):(!t.style||l.sync||d?Yh.createPattern(t,i,s,r):Yh.createPatternTask(t,i,s,r),!1))},drawImage:function(t,e,i,s,r,n){const{data:a,image:o}=t,{blendMode:h}=t.originPaint,{opacity:l,transform:d}=a,c=o.getFull(a.filters),u=s.__;let _,{width:p,height:g}=o;(_=d&&!d.onlyScale||u.path||u.cornerRadius)||l||h?(r.save(),_&&r.clipUI(s),h&&(r.blendMode=h),l&&(r.opacity*=l),d&&r.transform(d),r.drawImage(c,0,0,p,g),r.restore()):(a.scaleX&&(p*=a.scaleX,g*=a.scaleY),r.drawImage(c,0,0,p,g))},getImageRenderScaleData:function(t,e,i,s){const r=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:n}=t;if(i){const{pixelRatio:t}=i;r.scaleX*=t,r.scaleY*=t}return n&&n.scaleX&&(r.scaleX*=Math.abs(n.scaleX),r.scaleY*=Math.abs(n.scaleY)),r},recycleImage:function(t,e){const i=e["_"+t];if(l(i)){let s,r,n,a,o;for(let h=0,d=i.length;h<d;h++)s=i[h],r=s.image,o=r&&r.url,o&&(n||(n={}),n[o]=!0,Zr.recycle(r),r.loading&&(a||(a=e.__input&&e.__input[t]||[],l(a)||(a=[a])),r.unload(i[h].loadId,!a.some(t=>t.url===o))));return n}return null},createPatternTask:function(t,e,i,s){t.patternTask||(t.patternTask=Zr.patternTasker.add(()=>pe(this,void 0,void 0,function*(){t.patternTask=null,i.bounds.hit(e.__nowWorld)&&Yh.createPattern(t,e,i,s),e.forceUpdate("surface")}),300))},createPattern:function(t,e,i,s){let{scaleX:r,scaleY:n}=Yh.getImageRenderScaleData(t,e,i,s),a=r+"-"+n;if(t.patternId!==a&&!e.destroyed&&(!y.image.isLarge(t.image,r,n)||t.data.repeat)){const{image:i,data:s}=t,{transform:o,gap:h}=s,l=Yh.getPatternFixScale(t,r,n);let d,c,u,{width:_,height:p}=i;l&&(r*=l,n*=l),_*=r,p*=n,h&&(c=h.x*r/iu(s.scaleX||1),u=h.y*n/iu(s.scaleY||1)),(o||1!==r||1!==n)&&(r*=eu(_+(c||0)),n*=eu(p+(u||0)),d=Jc(),o&&tu(d,o),$c(d,1/r,1/n));const g=i.getCanvas(_,p,s.opacity,s.filters,c,u,e.leafer&&e.leafer.config.smooth),f=i.getPattern(g,s.repeat||y.origin.noRepeat||"no-repeat",d,t);t.style=f,t.patternId=a}},getPatternFixScale:function(t,e,i){const{image:s}=t;let r,n=y.image.maxPatternSize,a=s.width*s.height;return s.isSVG?e>1&&(r=Math.ceil(e)/e):n>a&&(n=a),(a*=e*i)>n&&(r=Math.sqrt(n/a)),r},createData:function(t,e,i,s){t.data=Yh.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=Mc.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:s,height:r}=i,{opacity:a,mode:o,align:h,offset:l,scale:c,size:u,rotation:_,skew:p,clipSize:g,repeat:f,gap:y,filters:m}=t,v=e.width===s&&e.height===r,x={mode:o},w="center"!==h&&(_||0)%180==90;let b,E;switch(Yt.set(Fc,0,0,w?r:s,w?s:r),o&&"cover"!==o&&"fit"!==o?((c||u)&&(M.getScaleData(c,u,i,Wc),b=Wc.scaleX,E=Wc.scaleY),(h||y||f)&&(b&&Yt.scale(Fc,b,E,!0),h&&Bt.toPoint(h,Fc,e,Fc,!0,!0))):v&&!_||(b=E=Yt.getFitScale(e,Fc,"fit"!==o),Yt.put(e,i,h,b,!1,Fc),Yt.scale(Fc,b,E,!0)),l&&ht.move(Fc,l),o){case"stretch":v?b&&(b=E=void 0):(b=e.width/s,E=e.height/r,Yh.stretchMode(x,e,b,E));break;case"normal":case"clip":if(Fc.x||Fc.y||b||g||_||p){let t,i;g&&(t=e.width/g.width,i=e.height/g.height),Yh.clipMode(x,e,Fc.x,Fc.y,b,E,_,p,t,i),t&&(b=b?b*t:t,E=E?E*i:i)}break;case"repeat":(!v||b||_||p)&&Yh.repeatMode(x,e,s,r,Fc.x,Fc.y,b,E,_,p,h,t.freeTransform),f||(x.repeat="repeat");const i=d(f);(y||i)&&(x.gap=function(t,e,i,s,r){let n,a;d(t)?(n=t.x,a=t.y):n=a=t;return{x:Uc(n,i,r.width,e&&e.x),y:Uc(a,s,r.height,e&&e.y)}}(y,i&&f,Fc.width,Fc.height,e));break;default:b&&Yh.fillOrFitMode(x,e,Fc.x,Fc.y,b,E,_)}return x.transform||(e.x||e.y)&&Ac(x.transform=Dc(),e.x,e.y),b&&(x.scaleX=b,x.scaleY=E),a&&a<1&&(x.opacity=a),m&&(x.filters=m),f&&(x.repeat=n(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),x},stretchMode:function(t,e,i,s){const r=Yc(),{x:n,y:a}=e;n||a?jc(r,n,a):r.onlyScale=!0,Kc(r,i,s),t.transform=r},fillOrFitMode:function(t,e,i,s,r,n,a){const o=Yc();jc(o,e.x+i,e.y+s),Kc(o,r,n),a&&Hc(o,{x:e.x+e.width/2,y:e.y+e.height/2},a),t.transform=o},clipMode:function(t,e,i,s,r,n,a,o,h,l){const d=Yc();Qc(d,e,i,s,r,n,a,o),h&&(a||o?(Xc(zc),Gc(zc,e,h,l),Vc(d,zc)):Gc(d,e,h,l)),t.transform=d},repeatMode:function(t,e,i,s,r,n,a,o,h,l,d,c){const u=Yc();if(c)Qc(u,e,r,n,a,o,h,l);else{if(h)if("center"===d)Hc(u,{x:i/2,y:s/2},h);else switch(qc(u,h),h){case 90:jc(u,s,0);break;case 180:jc(u,i,s);break;case 270:jc(u,0,i)}Nc.x=e.x+r,Nc.y=e.y+n,jc(u,Nc.x,Nc.y),a&&Gc(u,Nc,a,o)}t.transform=u}},{toPoint:ru}=bt,{hasTransparent:nu}=Fh,au={},ou={};function hu(t,e,i,s){if(i){let r,a,o,h;for(let t=0,l=i.length;t<l;t++)r=i[t],n(r)?(o=t/(l-1),a=Fh.string(r,s)):(o=r.offset,a=Fh.string(r.color,s)),e.addColorStop(o,a),!h&&nu(a)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:lu,getDistance:du}=ht,{get:cu,rotateOfOuter:uu,scaleOfOuter:_u}=Q,{toPoint:pu}=bt,gu={},fu={};function yu(t,e,i,s,r){let n;const{width:a,height:o}=t;if(a!==o||s){const t=lu(e,i);n=cu(),r?(_u(n,e,a/o*(s||1),1),uu(n,e,t+90)):(_u(n,e,1,a/o*(s||1)),uu(n,e,t))}return n}const{getDistance:mu}=ht,{toPoint:vu}=bt,xu={},wu={};const bu={linearGradient:function(t,e){let{from:i,to:s,type:r,opacity:n}=t;ru(i||"top",e,au),ru(s||"bottom",e,ou);const a=y.canvas.createLinearGradient(au.x,au.y,ou.x,ou.y),o={type:r,style:a};return hu(o,a,t.stops,n),o},radialGradient:function(t,e){let{from:i,to:s,type:r,opacity:n,stretch:a}=t;pu(i||"center",e,gu),pu(s||"bottom",e,fu);const o=y.canvas.createRadialGradient(gu.x,gu.y,0,gu.x,gu.y,du(gu,fu)),h={type:r,style:o};hu(h,o,t.stops,n);const l=yu(e,gu,fu,a,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:i,to:s,type:r,opacity:n,stretch:a}=t;vu(i||"center",e,xu),vu(s||"bottom",e,wu);const o=y.conicGradientSupport?y.canvas.createConicGradient(0,xu.x,xu.y):y.canvas.createRadialGradient(xu.x,xu.y,0,xu.x,xu.y,mu(xu,wu)),h={type:r,style:o};hu(h,o,t.stops,n);const l=yu(e,xu,wu,a||1,y.conicGradientRotate90);return l&&(h.transform=l),h},getTransform:yu},{copy:Eu,move:Pu,toOffsetOutBounds:Bu}=Yt,{max:ku,abs:Su}=Math,Ru={},Tu=new gt,Cu={};function Lu(t,e){let i,s,r,n,a=0,o=0,h=0,l=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,n=1.5*(t.blur||0),r=Su(t.spread||0),a=ku(a,r+n-s),o=ku(o,r+n+i),h=ku(h,r+n+s),l=ku(l,r+n-i)}),a===o&&o===h&&h===l?a:[a,o,h,l]}function Ou(t,e,i){const{shapeBounds:s}=i;let r,n;y.fullImageShadow?(Eu(Ru,t.bounds),Pu(Ru,e.x-s.x,e.y-s.y),r=t.bounds,n=Ru):(r=s,n=e),t.copyWorld(i.canvas,r,n)}const{toOffsetOutBounds:Iu}=Yt,Du={};const Au=Lu;const Mu={shadow:function(t,e,i){let s,r;const{__nowWorld:n}=t,{shadow:a}=t.__,{worldCanvas:o,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=a.length-1;Bu(h,Cu,l),a.forEach((a,g)=>{let f=1;if(a.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}_.setWorldShadow(Cu.offsetX+(a.x||0)*c*f,Cu.offsetY+(a.y||0)*u*f,(a.blur||0)*c*f,Fh.string(a.color)),r=Hh.getShadowTransform(t,_,i,a,Cu,f),r&&_.setTransform(r),Ou(_,Cu,i),r&&_.resetTransform(),s=l,a.box&&(_.restore(),_.save(),o&&(_.copyWorld(_,l,n,"copy"),s=n),o?_.copyWorld(o,n,n,"destination-out"):_.copyWorld(i.canvas,d,h,"destination-out")),ia.copyCanvasByWorld(t,e,_,s,a.blendMode),p&&g<p&&_.clearWorld(s)}),_.recycle(s)},innerShadow:function(t,e,i){let s,r;const{__nowWorld:n}=t,{innerShadow:a}=t.__,{worldCanvas:o,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=a.length-1;Iu(h,Du,l),a.forEach((a,g)=>{let f=1;if(a.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}_.save(),_.setWorldShadow(Du.offsetX+(a.x||0)*c*f,Du.offsetY+(a.y||0)*u*f,(a.blur||0)*c*f),r=Hh.getShadowTransform(t,_,i,a,Du,f,!0),r&&_.setTransform(r),Ou(_,Du,i),_.restore(),o?(_.copyWorld(_,l,n,"copy"),_.copyWorld(o,n,n,"source-out"),s=n):(_.copyWorld(i.canvas,d,h,"source-out"),s=l),_.fillWorld(s,Fh.string(a.color),"source-in"),ia.copyCanvasByWorld(t,e,_,s,a.blendMode),p&&g<p&&_.clearWorld(s)}),_.recycle(s)},blur:function(t,e,i){const{blur:s}=t.__;i.setWorldBlur(s*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){},getShadowRenderSpread:Lu,getShadowTransform:function(t,e,i,s,r,n,a){if(s.spread){const i=2*s.spread*n*(a?-1:1),{width:o,height:h}=t.__layout.strokeBounds;return Tu.set().scaleOfOuter({x:(r.x+r.width/2)*e.pixelRatio,y:(r.y+r.height/2)*e.pixelRatio},1+i/o,1+i/h),Tu}},isTransformShadow(t){},getInnerShadowSpread:Au},{excludeRenderBounds:Wu}=da;let Fu;function Uu(t,e,i,s,r,n,a,o){switch(e){case"grayscale":Fu||(Fu=!0,r.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,r,n){const a=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,a),n&&s.recycle(a);zu(t,e,i,1,r,n)}(t,i,s,r,a,o);break;case"opacity-path":zu(t,i,s,n,a,o);break;case"path":o&&i.restore()}}function Nu(t){return t.getSameCanvas(!1,!0)}function zu(t,e,i,s,r,n){const a=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,a,void 0,r),n?i.recycle(a):i.clearWorld(a)}t.Group.prototype.__renderMask=function(t,e){let i,s,r,n,a,o;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(i=h[l],o=i.__.mask,o){a&&(Uu(this,a,t,r,s,n,void 0,!0),s=r=null),"clipping"!==o&&"clipping-path"!==o||Wu(i,e)||i.__render(t,e),n=i.__.opacity,Fu=!1,"path"===o||"clipping-path"===o?(n<1?(a="opacity-path",r||(r=Nu(t))):(a="path",t.save()),i.__clip(r||t,e)):(a="grayscale"===o?"grayscale":"alpha",s||(s=Nu(t)),r||(r=Nu(t)),i.__render(s,e));continue}const d=1===n&&i.__.__blendMode;d&&Uu(this,a,t,r,s,n,void 0,!1),Wu(i,e)||i.__render(r||t,e),d&&Uu(this,a,t,r,s,n,d,!1)}Uu(this,a,t,r,s,n,void 0,!0)};const Yu=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Xu=Yu+"_#~&*+\\=|≮≯≈≠=…",Hu=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 ju(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const Gu=ju("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Vu=ju("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Ku=ju(Yu),qu=ju(Xu),Zu=ju("- —/~|┆·");var Qu;!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"}(Qu||(Qu={}));const{Letter:Ju,Single:$u,Before:t_,After:e_,Symbol:i_,Break:s_}=Qu;function r_(t){return Gu[t]?Ju:Zu[t]?s_:Vu[t]?t_:Ku[t]?e_:qu[t]?i_:Hu.test(t)?$u:Ju}const n_={trimRight(t){const{words:e}=t;let i,s=0,r=e.length;for(let n=r-1;n>-1&&(i=e[n].data[0]," "===i.char);n--)s++,t.width-=i.width;s&&e.splice(r-s,s)}};function a_(t,e,i){switch(e){case"title":return i?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:o_}=n_,{Letter:h_,Single:l_,Before:d_,After:c_,Symbol:u_,Break:__}=Qu;let p_,g_,f_,y_,m_,v_,x_,w_,b_,E_,P_,B_,k_,S_,R_,T_,C_,L_=[];function O_(t,e){b_&&!w_&&(w_=b_),p_.data.push({char:t,width:e}),f_+=e}function I_(){y_+=f_,p_.width=f_,g_.words.push(p_),p_={data:[]},f_=0}function D_(){S_&&(R_.paraNumber++,g_.paraStart=!0,S_=!1),b_&&(g_.startCharSize=w_,g_.endCharSize=b_,w_=0),g_.width=y_,T_.width?o_(g_):C_&&A_(),L_.push(g_),g_={words:[]},y_=0}function A_(){y_>(R_.maxWidth||0)&&(R_.maxWidth=y_)}const{top:M_,right:W_,bottom:F_,left:U_}=t.Direction4;function N_(t,e,i){const{bounds:s,rows:r}=t;s[e]+=i;for(let t=0;t<r.length;t++)r[t][e]+=i}const z_={getDrawData:function(t,e){n(t)||(t=String(t));let i=0,s=0,r=e.__getInput("width")||0,a=e.__getInput("height")||0;const{__padding:o}=e;o&&(r?(i=o[U_],r-=o[W_]+o[U_],!r&&(r=.01)):e.autoSizeAlign||(i=o[U_]),a?(s=o[M_],a-=o[M_]+o[F_],!a&&(a=.01)):e.autoSizeAlign||(s=o[M_]));const h={bounds:{x:i,y:s,width:r,height:a},rows:[],paraNumber:0,font:y.canvas.font=e.__font};return function(t,e,i){R_=t,L_=t.rows,T_=t.bounds,C_=!T_.width&&!i.autoSizeAlign;const{__letterSpacing:s,paraIndent:r,textCase:n}=i,{canvas:a}=y,{width:o}=T_;if(i.__isCharMode){const t="none"!==i.textWrap,h="break"===i.textWrap;S_=!0,P_=null,w_=x_=b_=f_=y_=0,p_={data:[]},g_={words:[]},s&&(e=[...e]);for(let i=0,l=e.length;i<l;i++)v_=e[i],"\n"===v_?(f_&&I_(),g_.paraEnd=!0,D_(),S_=!0):(E_=r_(v_),E_===h_&&"none"!==n&&(v_=a_(v_,n,!f_)),x_=a.measureText(v_).width,s&&(s<0&&(b_=x_),x_+=s),B_=E_===l_&&(P_===l_||P_===h_)||P_===l_&&E_!==c_,k_=!(E_!==d_&&E_!==l_||P_!==u_&&P_!==c_),m_=S_&&r?o-r:o,t&&o&&y_+f_+x_>m_&&(h?(f_&&I_(),y_&&D_()):(k_||(k_=E_===h_&&P_==c_),B_||k_||E_===__||E_===d_||E_===l_||f_+x_>m_?(f_&&I_(),y_&&D_()):y_&&D_()))," "===v_&&!0!==S_&&y_+f_===0||(E_===__?(" "===v_&&f_&&I_(),O_(v_,x_),I_()):B_||k_?(f_&&I_(),O_(v_,x_)):O_(v_,x_)),P_=E_);f_&&I_(),y_&&D_(),L_.length>0&&(L_[L_.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{R_.paraNumber++,y_=a.measureText(t).width,L_.push({x:r||0,text:t,width:y_,paraStart:!0}),C_&&A_()})}(h,t,e),o&&function(t,e,i,s,r){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":N_(e,"x",t[U_]);break;case"right":N_(e,"x",-t[W_])}if(!r&&i.autoSizeAlign)switch(i.verticalAlign){case"top":N_(e,"y",t[M_]);break;case"bottom":N_(e,"y",-t[F_])}}(o,h,e,r,a),function(t,e){const{rows:i,bounds:s}=t,r=i.length,{__lineHeight:n,__baseLine:a,__letterSpacing:o,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:_,y:p,width:g,height:f}=s,y=n*r+(c?c*(t.paraNumber-1):0),m=a;if(h&&y>f)y=Math.max(f,n),r>1&&(t.overflow=r);else if(f||u)switch(d){case"middle":p+=(f-y)/2;break;case"bottom":p+=f-y}m+=p;let v,x,w,b=g||u?g:t.maxWidth;for(let a=0,d=r;a<d;a++){if(v=i[a],v.x=_,v.width<g||v.width>g&&!h)switch(l){case"center":v.x+=(b-v.width)/2;break;case"right":v.x+=b-v.width}v.paraStart&&c&&a>0&&(m+=c),v.y=m,m+=n,t.overflow>a&&m>y&&(v.isOverflow=!0,t.overflow=a+1),x=v.x,w=v.width,o<0&&(v.width<0?(w=-v.width+e.fontSize+o,x-=w,w+=e.fontSize):w-=o),x<s.x&&(s.x=x),w>s.width&&(s.width=w),h&&g&&g<w&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=p,s.height=y}(h,e),e.__isCharMode&&function(t,e,i){const{rows:s}=t,{textAlign:r,paraIndent:n,letterSpacing:a}=e,o=i&&r.includes("both"),h=o||i&&r.includes("justify"),l=h&&r.includes("letter");let d,c,u,_,p,g,f,y,m,v;s.forEach(t=>{t.words&&(p=n&&t.paraStart?n:0,y=t.words.length,h&&(v=!t.paraEnd||o,c=i-t.width-p,l?_=c/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=y>1?c/(y-1):0),g=a||t.isOverflow||l?0:u?1:2,t.isOverflow&&!a&&(t.textMode=!0),2===g?(t.x+=p,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=p,d=t.x,t.data=[],t.words.forEach((e,i)=>{1===g?(f={char:"",x:d},d=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,d,f),(t.isOverflow||" "!==f.char)&&t.data.push(f)):d=function(t,e,i,s,r){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width,r&&(e+=r)}),e}(e.data,d,t.data,t.isOverflow,v&&_),v&&(m=i===y-1,u?m||(d+=u,t.width+=u):_&&(t.width+=_*(e.data.length-(m?1:0))))})),t.words=null)})}(h,e,r),h.overflow&&function(t,e,i,s){if(!s)return;const{rows:r,overflow:n}=t;let{textOverflow:a}=e;if(r.splice(n),a&&"show"!==a){let t,o;"hide"===a?a="":"ellipsis"===a&&(a="...");const h=a?y.canvas.measureText(a).width:0,l=i+s-h;("none"===e.textWrap?r:[r[n-1]]).forEach(e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],o=t.x+t.width,!(s===i&&o<l));s--){if(o<l&&" "!==t.char||!s){e.data.splice(s+1),e.width-=t.width;break}e.width-=t.width}e.width+=h,e.data.push({char:a,x:o}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(h,e,i,r),"none"!==e.textDecoration&&function(t,e){let i,s=0;const{fontSize:r,textDecoration:n}=e;switch(t.decorationHeight=r/11,d(n)?(i=n.type,n.color&&(t.decorationColor=Fh.string(n.color)),n.offset&&(s=Math.min(.3*r,Math.max(n.offset,.15*-r)))):i=n,i){case"under":t.decorationY=[.15*r+s];break;case"delete":t.decorationY=[.35*-r];break;case"under-delete":t.decorationY=[.15*r+s,.35*-r]}}(h,e),h}};const Y_={string:function(t,e){if(!t)return"#000";const i=o(e)&&e<1;if(n(t)){if(!i||!Fh.object)return t;t=Fh.object(t)}let r=s(t.a)?1:t.a;i&&(r*=e);const a=t.r+","+t.g+","+t.b;return 1===r?"rgb("+a+")":"rgba("+a+","+r+")"}};return Object.assign(Wh,z_),Object.assign(Fh,Y_),Object.assign(zh,Pc),Object.assign(Yh,su),Object.assign(Xh,bu),Object.assign(Hh,Mu),Object.assign(ne,{interaction:(t,e,i,s)=>new jd(t,e,i,s),hitCanvas:(t,e)=>new _h(t,e),hitCanvasManager:()=>new Vd}),gh(),t.AlignHelper=Bt,t.AroundHelper=bt,t.AutoBounds=Kt,t.BezierHelper=ri,t.Bounds=Gt,t.BoundsEvent=Aa,t.BoundsHelper=Yt,t.BoxData=rl,t.BranchHelper=pa,t.BranchRender=Co,t.CanvasData=yl,t.CanvasManager=ue,t.ChildEvent=Ca,t.ColorConvert=Fh,t.Creator=ne,t.Cursor=Gd,t.DataHelper=u,t.Debug=Qt,t.DragBoundsHelper=Ed,t.Dragger=Ad,t.Effect=Hh,t.EllipseData=ll,t.EllipseHelper=_i,t.Event=Ta,t.EventCreator=de,t.Eventer=Ja,t.Export=Gh,t.FileHelper=Yr,t.Filter=jh,t.FourNumberHelper=k,t.FrameData=al,t.GroupData=sl,t.HitCanvasManager=Vd,t.ImageData=fl,t.ImageEvent=Da,t.ImageManager=Zr,t.IncrementId=v,t.InteractionBase=jd,t.InteractionHelper=Td,t.Keyboard=ld,t.LayoutEvent=Xa,t.Layouter=Rh,t.LeafBounds=So,t.LeafBoundsHelper=da,t.LeafData=p,t.LeafDataProxy=uo,t.LeafEventer=lo,t.LeafHelper=ia,t.LeafLayout=Ra,t.LeafLevelList=uh,t.LeafList=ch,t.LeafMatrix=vo,t.LeafRender=Ro,t.LeaferCanvas=_h,t.LeaferCanvasBase=Re,t.LeaferData=nl,t.LeaferEvent=ja,t.LeaferImage=tn,t.LineData=ol,t.MathHelper=M,t.Matrix=gt,t.MatrixHelper=Q,t.MyDragEvent=Sd,t.MyImage=id,t.MyPointerEvent=Bd,t.MyTouchEvent=Rd,t.NeedConvertToCanvasCommandMap=Ie,t.OneRadian=F,t.PI2=U,t.PI_2=N,t.Paint=zh,t.PaintGradient=Xh,t.PaintImage=Yh,t.PathArrow=Nh,t.PathBounds=Cr,t.PathCommandDataHelper=xs,t.PathCommandMap=Le,t.PathConvert=Qi,t.PathCorner=Wr,t.PathCreator=Ws,t.PathData=ul,t.PathDrawer=Js,t.PathHelper=Te,t.PathNumberCommandLengthMap=We,t.PathNumberCommandMap=Me,t.PenData=_l,t.Picker=Oh,t.Platform=y,t.Plugin=re,t.Point=_t,t.PointHelper=ht,t.PointerButton=dd,t.PolygonData=dl,t.PropertyEvent=Oa,t.RectData=hl,t.RectHelper=Fe,t.RectRender=Pl,t.RenderEvent=Ha,t.Renderer=Ch,t.ResizeEvent=za,t.Resource=Kr,t.Run=ee,t.Selector=Ih,t.StarData=cl,t.State=Vh,t.StringNumberMap=qt,t.TaskItem=jr,t.TaskProcessor=Gr,t.TextConvert=Wh,t.TextData=gl,t.Transition=Kh,t.TwoPointBoundsHelper=yt,t.UIBounds=xl,t.UICreator=oe,t.UIData=el,t.UIEvent=cd,t.UIRender=bl,t.UnitConvert=Uh,t.WaitHelper=ma,t.WatchEvent=Ya,t.Watcher=yh,t.affectRenderBoundsType=bn,t.affectStrokeBoundsType=vn,t.attr=an,t.autoLayoutType=cn,t.boundsType=pn,t.canvasPatch=zr,t.canvasSizeAttrs=Se,t.createAttr=function(t){return(e,i)=>{en(e,i,rn(i,t))}},t.createDescriptor=rn,t.cursorType=In,t.dataProcessor=Dn,t.dataType=hn,t.decorateLeafAttr=nn,t.defineDataProcessor=An,t.defineKey=en,t.defineLeafAttr=on,t.dimType=Pn,t.doBoundsType=fn,t.doStrokeType=xn,t.effectType=Dh,t.emptyData=i,t.eraserType=Ln,t.extraPropertyEventMap=Ia,t.getBoundsData=Y,t.getDescriptor=sn,t.getMatrixData=X,t.getPointData=z,t.hitType=On,t.isArray=l,t.isData=function(t){return d(t)&&!l(t)},t.isEmptyData=c,t.isFinite=a,t.isNull=r,t.isNumber=o,t.isObject=d,t.isString=n,t.isUndefined=s,t.layoutProcessor=function(t){return(e,i)=>{en(e,"__LayoutProcessor",{get:()=>t})}},t.leaferTransformAttrMap=Za,t.maskType=Cn,t.naturalBoundsType=gn,t.opacityType=Bn,t.path=Fr,t.pathInputType=yn,t.pathType=mn,t.pen=Ur,t.positionType=ln,t.registerUI=Xn,t.registerUIEvent=Hn,t.resizeType=Ah,t.rewrite=Un,t.rewriteAble=Nn,t.rotationType=_n,t.scaleType=un,t.scrollType=dn,t.sortType=Tn,t.strokeType=wn,t.surfaceType=En,t.tempBounds=Vt,t.tempMatrix=ft,t.tempPoint=pt,t.tryToNumber=function(t){return"string"==typeof t&&h.test(t)?+t:t},t.useCanvas=gh,t.useModule=Yn,t.version="1.10.1",t.visibleType=kn,t.zoomLayerType=Mh,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";var e;t.Answer=void 0,(e=t.Answer||(t.Answer={}))[e.No=0]="No",e[e.Yes=1]="Yes",e[e.NoAndSkip=2]="NoAndSkip",e[e.YesAndSkip=3]="YesAndSkip";const i={};function s(t){return void 0===t}function r(t){return null==t}function n(t){return"string"==typeof t}const{isFinite:a}=Number;function o(t){return"number"==typeof t}const h=/^-?\d+(?:\.\d+)?$/;const{isArray:l}=Array;function d(t){return t&&"object"==typeof t}function c(t){return"{}"===JSON.stringify(t)}const u={default:(t,e)=>(_(e,t),_(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach(r=>{var n,a;if(s=e[r],(null==s?void 0:s.constructor)===Object&&(null===(n=t[r])||void 0===n?void 0:n.constructor)===Object)return _(t[r],e[r],i&&i[r]);i&&r in i?(null===(a=i[r])||void 0===a?void 0:a.constructor)===Object&&_(t[r]={},e[r],i[r]):t[r]=e[r]})},copyAttrs:(t,e,i)=>(i.forEach(i=>{s(e[i])||(t[i]=e[i])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let i=0,s=t.length;i<s;i++)e[t[i]]=!0;return e},stintSet(t,e,i){i||(i=void 0),t[e]!==i&&(t[e]=i)}},{assign:_}=u;class p{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __usePathBox(){return this.__pathInputed}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(!s(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let i;for(let r in this)"_"!==r[0]&&(i=e?e[r]:void 0,t[r]=s(i)?this[r]:i);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(!s(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!s(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(l(t))for(let e of t)i[e]=this.__getInput(e);else for(let e in t)i[e]=this.__getInput(e);else{let t,e,{__input:r}=this;i.tag=this.__leaf.tag;for(let n in this)if("_"!==n[0]&&(t=this["_"+n],!s(t))){if("path"===n&&!this.__pathInputed)continue;e=r?r[n]:void 0,i[n]=s(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:r,e:n,f:a}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:r,e:n,f:a}}return i}__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{floor:g,max:f}=Math,y={toURL(t,e){let i=encodeURIComponent(t);return"text"===e?i="data:text/plain;charset=utf-8,"+i:"svg"===e&&(i="data:image/svg+xml,"+i),i},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",isLarge:(t,e,i,s)=>t.width*t.height*(e?e*i:1)>(s||m.maxCacheSize),isSuperLarge:(t,e,i)=>m.isLarge(t,e,i,m.maxPatternSize),getRealURL(t){const{prefix:e,suffix:i}=y.image;return!i||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+i),e&&"/"===t[0]&&(t=e+t),t},resize(t,e,i,s,r,n,a,o,h){const l=y.origin.createCanvas(f(g(e+(s||0)),1),f(g(i+(r||0)),1)),d=l.getContext("2d");if(o&&(d.globalAlpha=o),d.imageSmoothingEnabled=!1!==a,n){const s=e/n.width,r=i/n.height;d.setTransform(s,0,0,r,-n.x*s,-n.y*r),d.drawImage(t,0,0,t.width,t.height)}else d.drawImage(t,0,0,e,i);return l},setPatternTransform(t,e,i){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}i&&u.stintSet(i,"transform",e)}}},{image:m}=y,v={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=x;return e[t]?e[t]++:(e[t]=1,0)}},x=v;let w,b,E;const{max:P}=Math,B=[0,0,0,0],k={zero:[...B],tempFour:B,set:(t,e,i,s,r)=>(void 0===i&&(i=s=r=e),t[0]=e,t[1]=i,t[2]=s,t[3]=r,t),setTemp:(t,e,i,s)=>S(B,t,e,i,s),toTempAB(t,e,i){E=i?o(t)?e:t:[],o(t)?(w=C(t),b=e):o(e)?(w=t,b=C(e)):(w=t,b=e),4!==w.length&&(w=R(w)),4!==b.length&&(b=R(b))},get(t,e){let i;if(!o(t))switch(t.length){case 4:i=s(e)?t:[...t];break;case 2:i=[t[0],t[1],t[0],t[1]];break;case 3:i=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(i||(i=[t,t,t,t]),!s(e))for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},max:(t,e,i)=>o(t)&&o(e)?P(t,e):(T(t,e,i),S(E,P(w[0],b[0]),P(w[1],b[1]),P(w[2],b[2]),P(w[3],b[3]))),add:(t,e,i)=>o(t)&&o(e)?t+e:(T(t,e,i),S(E,w[0]+b[0],w[1]+b[1],w[2]+b[2],w[3]+b[3])),swapAndScale(t,e,i,s){if(o(t))return e===i?t*e:[t*i,t*e];const r=s?t:[],[n,a,h,l]=4===t.length?t:R(t);return S(r,h*i,l*e,n*i,a*e)}},{set:S,get:R,setTemp:C,toTempAB:T}=k,{round:L,pow:O,max:I,floor:D,PI:A}=Math,M={within:(t,e,i)=>(d(e)&&(i=e.max,e=e.min),!s(e)&&t<e&&(t=e),!s(i)&&t>i&&(t=i),t),fourNumber:k.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),M.float(t)),getGapRotation(t,e,i=0){let s=t+i;if(e>1){const t=Math.abs(s%e);(t<1||t>e-1)&&(s=Math.round(s/e)*e)}return s-i},float(t,e){const i=s(e)?1e12:O(10,e);return-0===(t=L(t*i)/i)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,i,s){if(s||(s={}),e){const t=(o(e)?e:e.width||0)/i.width,r=(o(e)?e:e.height||0)/i.height;s.scaleX=t||r||1,s.scaleY=r||t||1}else t&&M.assignScale(s,t);return s},assignScale(t,e){o(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>I(D(t),e)/t,randInt:W,randColor:t=>`rgba(${W(255)},${W(255)},${W(255)},${t||1})`};function W(t){return Math.round(Math.random()*t)}const F=A/180,U=2*A,N=A/2;function z(){return{x:0,y:0}}function Y(){return{x:0,y:0,width:0,height:0}}function X(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:H,cos:j,acos:G,sqrt:V}=Math,{float:K}=M,q={};function Z(){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 Q={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:Z(),tempMatrix:{},set(t,e=1,i=0,s=0,r=1,n=0,a=0){t.a=e,t.b=i,t.c=s,t.d=r,t.e=n,t.f=a},get:X,getWorld:Z,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,i){t.e+=e,t.f+=i},translateInner(t,e,i,s){t.e+=t.a*e+t.c*i,t.f+=t.b*e+t.d*i,s&&(t.e-=e,t.f-=i)},scale(t,e,i=e){t.a*=e,t.b*=e,t.c*=i,t.d*=i},pixelScale(t,e,i){i||(i=t),i.a=t.a*e,i.b=t.b*e,i.c=t.c*e,i.d=t.d*e,i.e=t.e*e,i.f=t.f*e},scaleOfOuter(t,e,i,s){J.toInnerPoint(t,e,q),J.scaleOfInner(t,q,i,s)},scaleOfInner(t,e,i,s=i){J.translateInner(t,e.x,e.y),J.scale(t,i,s),J.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:r,d:n}=t,a=j(e*=F),o=H(e);t.a=i*a-s*o,t.b=i*o+s*a,t.c=r*a-n*o,t.d=r*o+n*a},rotateOfOuter(t,e,i){J.toInnerPoint(t,e,q),J.rotateOfInner(t,q,i)},rotateOfInner(t,e,i){J.translateInner(t,e.x,e.y),J.rotate(t,i),J.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:r,c:n,d:a}=t;i&&(i*=F,t.a=s+n*i,t.b=r+a*i),e&&(e*=F,t.c=n+s*e,t.d=a+r*e)},skewOfOuter(t,e,i,s){J.toInnerPoint(t,e,q),J.skewOfInner(t,q,i,s)},skewOfInner(t,e,i,s=0){J.translateInner(t,e.x,e.y),J.skew(t,i,s),J.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:r,d:n,e:a,f:o}=t;t.a=e.a*i+e.b*r,t.b=e.a*s+e.b*n,t.c=e.c*i+e.d*r,t.d=e.c*s+e.d*n,t.e=e.e*i+e.f*r+a,t.f=e.e*s+e.f*n+o},multiplyParent(t,e,i,r,n){const{e:a,f:o}=t;if(i||(i=t),s(r)&&(r=1!==t.a||t.b||t.c||1!==t.d),r){const{a:s,b:r,c:a,d:o}=t;i.a=s*e.a+r*e.c,i.b=s*e.b+r*e.d,i.c=a*e.a+o*e.c,i.d=a*e.b+o*e.d,n&&(i.scaleX=e.scaleX*n.scaleX,i.scaleY=e.scaleY*n.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,n&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=a*e.a+o*e.c+e.e,i.f=a*e.b+o*e.d+e.f},divide(t,e){J.multiply(t,J.tempInvert(e))},divideParent(t,e){J.multiplyParent(t,J.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=J;return J.copy(e,t),J.invert(e),e},invert(t){const{a:e,b:i,c:s,d:r,e:n,f:a}=t;if(i||s){const o=1/(e*r-i*s);t.a=r*o,t.b=-i*o,t.c=-s*o,t.d=e*o,t.e=-(n*r-a*s)*o,t.f=-(a*e-n*i)*o}else if(1===e&&1===r)t.e=-n,t.f=-a;else{const i=1/(e*r);t.a=r*i,t.d=e*i,t.e=-n*r*i,t.f=-a*e*i}},toOuterPoint(t,e,i,s){const{x:r,y:n}=e;i||(i=e),i.x=r*t.a+n*t.c,i.y=r*t.b+n*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:r,b:n,c:a,d:o}=t,h=1/(r*o-n*a),{x:l,y:d}=e;if(i||(i=e),i.x=(l*o-d*a)*h,i.y=(d*r-l*n)*h,!s){const{e:e,f:s}=t;i.x-=(e*o-s*a)*h,i.y-=(s*r-e*n)*h}},setLayout(t,e,i,r,n){const{x:a,y:o,scaleX:h,scaleY:l}=e;if(s(n)&&(n=e.rotation||e.skewX||e.skewY),n){const{rotation:i,skewX:s,skewY:r}=e,n=i*F,a=j(n),o=H(n);if(s||r){const e=s*F,i=r*F;t.a=(a+i*-o)*h,t.b=(o+i*a)*h,t.c=(e*a-o)*l,t.d=(a+e*o)*l}else t.a=a*h,t.b=o*h,t.c=-o*l,t.d=a*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=a,t.f=o,(i=i||r)&&J.translateInner(t,-i.x,-i.y,!r)},getLayout(t,e,i,s){const{a:r,b:n,c:a,d:o,e:h,f:l}=t;let d,c,u,_,p,g=h,f=l;if(n||a){const t=r*o-n*a;if(a&&!s){d=V(r*r+n*n),c=t/d;const e=r/d;u=n>0?G(e):-G(e)}else{c=V(a*a+o*o),d=t/c;const e=a/c;u=N-(o>0?G(-e):-G(e))}const e=K(j(u)),i=H(u);d=K(d),c=K(c),_=e?K((a/c+i)/e/F,9):0,p=e?K((n/d-i)/e/F,9):0,u=K(u/F)}else d=r,c=o,u=_=p=0;return(e=i||e)&&(g+=e.x*r+e.y*a,f+=e.x*n+e.y*o,i||(g-=e.x,f-=e.y)),{x:g,y:f,scaleX:d,scaleY:c,rotation:u,skewX:_,skewY:p}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:r,c:n,d:a}=t;r||n?i=(s*a-r*n)/(e=V(s*s+r*r)):(e=s,i=a)}return s.scaleX=e,s.scaleY=i,s},reset(t){J.set(t)}},J=Q,{toInnerPoint:$,toOuterPoint:tt}=Q,{sin:et,cos:it,abs:st,sqrt:rt,atan2:nt,min:at,round:ot}=Math,ht={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,i=0){t.x=e,t.y=i},setRadius(t,e,i){t.radiusX=e,t.radiusY=s(i)?e:i},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,i){t.x=e,t.y=i},round(t,e){t.x=e?ot(t.x-.5)+.5:ot(t.x),t.y=e?ot(t.y-.5)+.5:ot(t.y)},move(t,e,i){d(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=i)},scale(t,e,i=e){t.x&&(t.x*=e),t.y&&(t.y*=i)},scaleOf(t,e,i,s=i){t.x+=(t.x-e.x)*(i-1),t.y+=(t.y-e.y)*(s-1)},rotate(t,e,i){i||(i=lt.defaultPoint);const s=it(e*=F),r=et(e),n=t.x-i.x,a=t.y-i.y;t.x=i.x+n*s-a*r,t.y=i.y+n*r+a*s},tempToInnerOf(t,e){const{tempPoint:i}=lt;return ct(i,t),$(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=lt;return ct(i,t),tt(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=lt;return ct(i,t),lt.toInnerRadiusPointOf(t,e,i),i},toInnerRadiusPointOf(t,e,i){i||(i=t),$(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){$(e,t,i)},toOuterOf(t,e,i){tt(e,t,i)},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)=>dt(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const r=st(i-t),n=st(s-e);return rt(r*r+n*n)},getMinDistanceFrom:(t,e,i,s,r,n)=>at(dt(t,e,i,s),dt(i,s,r,n)),getAngle:(t,e)=>ut(t,e)/F,getRotation:(t,e,i,s)=>(s||(s=e),lt.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/F),getRadianFrom(t,e,i,r,n,a,o,h){s(o)&&(o=i,h=r);const l=t-i,d=e-r,c=n-o,u=a-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>nt(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s,r){const n=ut(t,e);return r&&(t=e),s||(e={}),e.x=t.x+it(n)*i,e.y=t.y+et(n)*i,e},toNumberPoints(t){let e=t;return d(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},isSame:(t,e)=>t.x===e.x&&t.y===e.y,reset(t){lt.reset(t)}},lt=ht,{getDistanceFrom:dt,copy:ct,getAtan2:ut}=lt;class _t{constructor(t,e){this.set(t,e)}set(t,e){return d(t)?ht.copy(this,t):ht.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new _t(this)}move(t,e){return ht.move(this,t,e),this}scale(t,e){return ht.scale(this,t,e),this}scaleOf(t,e,i){return ht.scaleOf(this,t,e,i),this}rotate(t,e){return ht.rotate(this,t,e),this}rotateOf(t,e){return ht.rotate(this,e,t),this}getRotation(t,e,i){return ht.getRotation(this,t,e,i)}toInnerOf(t,e){return ht.toInnerOf(this,t,e),this}toOuterOf(t,e){return ht.toOuterOf(this,t,e),this}getCenter(t){return new _t(ht.getCenter(this,t))}getDistance(t){return ht.getDistance(this,t)}getDistancePoint(t,e,i,s){return new _t(ht.getDistancePoint(this,t,e,i,s))}getAngle(t){return ht.getAngle(this,t)}getAtan2(t){return ht.getAtan2(this,t)}isSame(t){return ht.isSame(this,t)}reset(){return ht.reset(this),this}}const pt=new _t;class gt{constructor(t,e,i,s,r,n){this.set(t,e,i,s,r,n)}set(t,e,i,s,r,n){return d(t)?Q.copy(this,t):Q.set(this,t,e,i,s,r,n),this}setWith(t){return Q.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:r,f:n}=this;return{a:t,b:e,c:i,d:s,e:r,f:n}}clone(){return new gt(this)}translate(t,e){return Q.translate(this,t,e),this}translateInner(t,e){return Q.translateInner(this,t,e),this}scale(t,e){return Q.scale(this,t,e),this}scaleWith(t,e){return Q.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return Q.pixelScale(this,t),this}scaleOfOuter(t,e,i){return Q.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return Q.scaleOfInner(this,t,e,i),this}rotate(t){return Q.rotate(this,t),this}rotateOfOuter(t,e){return Q.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return Q.rotateOfInner(this,t,e),this}skew(t,e){return Q.skew(this,t,e),this}skewOfOuter(t,e,i){return Q.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return Q.skewOfInner(this,t,e,i),this}multiply(t){return Q.multiply(this,t),this}multiplyParent(t){return Q.multiplyParent(this,t),this}divide(t){return Q.divide(this,t),this}divideParent(t){return Q.divideParent(this,t),this}invert(){return Q.invert(this),this}invertWith(){return Q.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){Q.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){Q.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return Q.setLayout(this,t,e,i),this}getLayout(t,e,i){return Q.getLayout(this,t,e,i)}withScale(t,e){return Q.withScale(this,t,e)}reset(){Q.reset(this)}}const ft=new gt,yt={tempPointBounds:{},setPoint(t,e,i){t.minX=t.maxX=e,t.minY=t.maxY=i},addPoint(t,e,i){t.minX=e<t.minX?e:t.minX,t.minY=i<t.minY?i:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=i>t.maxY?i:t.maxY},addBounds(t,e,i,s,r){mt(t,e,i),mt(t,e+s,i+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:mt}=yt;var vt,xt;t.Direction4=void 0,(vt=t.Direction4||(t.Direction4={}))[vt.top=0]="top",vt[vt.right=1]="right",vt[vt.bottom=2]="bottom",vt[vt.left=3]="left",t.Direction9=void 0,(xt=t.Direction9||(t.Direction9={}))[xt.topLeft=0]="topLeft",xt[xt.top=1]="top",xt[xt.topRight=2]="topRight",xt[xt.right=3]="right",xt[xt.bottomRight=4]="bottomRight",xt[xt.bottom=5]="bottom",xt[xt.bottomLeft=6]="bottomLeft",xt[xt.left=7]="left",xt[xt.center=8]="center",xt[xt["top-left"]=0]="top-left",xt[xt["top-right"]=2]="top-right",xt[xt["bottom-right"]=4]="bottom-right",xt[xt["bottom-left"]=6]="bottom-left";const wt=[{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}];wt.forEach(t=>t.type="percent");const bt={directionData:wt,tempPoint:{},get:Et,toPoint(t,e,i,s,r,n){const a=Et(t);i.x=a.x,i.y=a.y,"percent"===a.type&&(i.x*=e.width,i.y*=e.height,r&&(n||(i.x-=r.x,i.y-=r.y),a.x&&(i.x-=1===a.x?r.width:.5===a.x?a.x*r.width:0),a.y&&(i.y-=1===a.y?r.height:.5===a.y?a.y*r.height:0))),s||(i.x+=e.x,i.y+=e.y)},getPoint:(t,e,i)=>(i||(i={}),bt.toPoint(t,e,i,!0),i)};function Et(e){return n(e)?wt[t.Direction9[e]]:e}const{toPoint:Pt}=bt,Bt={toPoint(t,e,i,s,r,n){Pt(t,i,s,r,e,n)}},{tempPointBounds:kt,setPoint:St,addPoint:Rt,toBounds:Ct}=yt,{toOuterPoint:Tt}=Q,{float:Lt,fourNumber:Ot}=M,{floor:It,ceil:Dt}=Math;let At,Mt,Wt,Ft;const Ut={},Nt={},zt={},Yt={tempBounds:zt,set(t,e=0,i=0,s=0,r=0){t.x=e,t.y=i,t.width=s,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,i,s,r){const{x:n,y:a,width:o,height:h}=e;if(l(i)){const e=Ot(i);s?Xt.set(t,n+e[3],a+e[0],o-e[1]-e[3],h-e[2]-e[0]):Xt.set(t,n-e[3],a-e[0],o+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),Xt.set(t,n-i,a-i,o+2*i,h+2*i);r&&("width"===r?(t.y=a,t.height=h):(t.x=n,t.width=o))},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,i){t.x+=e,t.y+=i},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,i)=>(t=Object.assign({},t),Xt.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?jt(e,t):e=t,i||(i=t),e.offsetX=Xt.maxX(i),e.offsetY=Xt.maxY(i),Xt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||ht.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){ht.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(Xt.copy(zt,t),Xt.toOuterOf(zt,e),zt),getOuterOf:(t,e)=>(t=Object.assign({},t),Xt.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:r,e:n,f:a}=e;s>0?(i.width=t.width*s,i.x=n+t.x*s):(i.width=t.width*-s,i.x=n+t.x*s-i.width),r>0?(i.height=t.height*r,i.y=a+t.y*r):(i.height=t.height*-r,i.y=a+t.y*r-i.height)}else Ut.x=t.x,Ut.y=t.y,Tt(e,Ut,Nt),St(kt,Nt.x,Nt.y),Ut.x=t.x+t.width,Tt(e,Ut,Nt),Rt(kt,Nt.x,Nt.y),Ut.y=t.y+t.height,Tt(e,Ut,Nt),Rt(kt,Nt.x,Nt.y),Ut.x=t.x,Tt(e,Ut,Nt),Rt(kt,Nt.x,Nt.y),Ct(kt,i)},toInnerOf(t,e,i){i||(i=t),Xt.move(i,-e.e,-e.f),Xt.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,Xt.getFitScale(t,e));return new gt(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,r=t.height/e.height;return i?Math.max(s,r):Math.min(s,r)},put(t,e,i="center",s=1,r=!0,a){a||(a=e),n(s)&&(s=Xt.getFitScale(t,e,"cover"===s)),zt.width=r?e.width*=s:e.width*s,zt.height=r?e.height*=s:e.height*s,Bt.toPoint(i,zt,t,a,!0,!0)},getSpread(t,e,i){const s={};return Xt.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){Xt.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){Xt.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=It(t.x),t.y=It(t.y),t.width=e>t.x?Dt(t.width+e-t.x):Dt(t.width),t.height=i>t.y?Dt(t.height+i-t.y):Dt(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=Lt(t.x,e),t.y=Lt(t.y,e),t.width=Lt(t.width,e),t.height=Lt(t.height,e)},add(t,e,i){At=t.x+t.width,Mt=t.y+t.height,Wt=e.x,Ft=e.y,i||(Wt+=e.width,Ft+=e.height),At=At>Wt?At:Wt,Mt=Mt>Ft?Mt:Ft,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=At-t.x,t.height=Mt-t.y},addList(t,e){Xt.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){Xt.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){Xt.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let r,n=!0;for(let a=0,o=e.length;a<o;a++)r=i?i(e[a],a):e[a],r&&(r.width||r.height)&&(n?(n=!1,s||jt(t,r)):Ht(t,r));n&&Xt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?St(kt,t.x,t.y):Rt(kt,t.x,t.y)),Ct(kt,t)},setPoint(t,e){Xt.set(t,e.x,e.y)},addPoint(t,e){Ht(t,e,!0)},getPoints(t){const{x:e,y:i,width:s,height:r}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+r},{x:e,y:i+r}]},hitRadiusPoint:(t,e,i)=>(i&&(e=ht.tempToInnerRadiusPointOf(e,i)),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,i)=>(i&&(e=ht.tempToInnerOf(e,i)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,i)=>(i&&(e=Xt.tempToOuterOf(e,i)),!(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,i)=>(i&&(e=Xt.tempToOuterOf(e,i)),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,i){if(i&&(e=Xt.tempToOuterOf(e,i)),!Xt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:r,width:n,height:a}=e;return At=s+n,Mt=r+a,Wt=t.x+t.width,Ft=t.y+t.height,s=s>t.x?s:t.x,r=r>t.y?r:t.y,At=At<Wt?At:Wt,Mt=Mt<Ft?Mt:Ft,n=At-s,a=Mt-r,{x:s,y:r,width:n,height:a}},intersect(t,e,i){Xt.copy(t,Xt.getIntersectData(t,e,i))},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){Xt.set(t)}},Xt=Yt,{add:Ht,copy:jt}=Xt;class Gt{get minX(){return Yt.minX(this)}get minY(){return Yt.minY(this)}get maxX(){return Yt.maxX(this)}get maxY(){return Yt.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return d(t)?Yt.copy(this,t):Yt.set(this,t,e,i,s),this}get(){const{x:t,y:e,width:i,height:s}=this;return{x:t,y:e,width:i,height:s}}clone(){return new Gt(this)}move(t,e){return Yt.move(this,t,e),this}scale(t,e,i){return Yt.scale(this,t,e,i),this}scaleOf(t,e,i){return Yt.scaleOf(this,t,e,i),this}toOuterOf(t,e){return Yt.toOuterOf(this,t,e),this}toInnerOf(t,e){return Yt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Yt.getFitMatrix(this,t,e)}put(t,e,i){Yt.put(this,t,e,i)}spread(t,e){return Yt.spread(this,t,e),this}shrink(t,e){return Yt.shrink(this,t,e),this}ceil(){return Yt.ceil(this),this}unsign(){return Yt.unsign(this),this}float(t){return Yt.float(this,t),this}add(t){return Yt.add(this,t),this}addList(t){return Yt.setList(this,t,!0),this}setList(t){return Yt.setList(this,t),this}addListWithFn(t,e){return Yt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Yt.setListWithFn(this,t,e),this}setPoint(t){return Yt.setPoint(this,t),this}setPoints(t){return Yt.setPoints(this,t),this}addPoint(t){return Yt.addPoint(this,t),this}getPoints(){return Yt.getPoints(this)}hitPoint(t,e){return Yt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Yt.hitRadiusPoint(this,t,e)}hit(t,e){return Yt.hit(this,t,e)}includes(t,e){return Yt.includes(this,t,e)}intersect(t,e){return Yt.intersect(this,t,e),this}getIntersect(t,e){return new Gt(Yt.getIntersectData(this,t,e))}isSame(t){return Yt.isSame(this,t)}isEmpty(){return Yt.isEmpty(this)}reset(){Yt.reset(this)}}const Vt=new Gt;class Kt{constructor(t,e,i,s,r,n){d(t)?this.copy(t):this.set(t,e,i,s,r,n)}set(t=0,e=0,i=0,s=0,r=0,n=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=r,this.height=n}copy(t){const{top:e,right:i,bottom:s,left:r,width:n,height:a}=t;this.set(e,i,s,r,n,a)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:r,width:n,height:a}=this;return new Gt(r,e,n||t.width-r-i,a||t.height-e-s)}}const qt={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:Zt}=M;class Qt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new Qt(t)}static set filter(t){this.filterList=Jt(t)}static set exclude(t){this.excludeList=Jt(t)}static drawRepaint(t,e){const i=Zt();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===Qt.showBounds,r=t.__nowWorld,n=Zt();s&&(e.setWorld(r),t.__drawHitPath(e),e.fillStyle=n.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(n,2),s?e.stroke():e.strokeWorld(r,n)}log(...t){if($t.enable){if($t.filterList.length&&$t.filterList.every(t=>t!==this.name))return;if($t.excludeList.length&&$t.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){$t.enable&&this.warn(...t)}warn(...t){$t.showWarn&&console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(this.warn("repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}function Jt(t){return t?n(t)&&(t=[t]):t=[],t}Qt.filterList=[],Qt.excludeList=[],Qt.showWarn=!0;const $t=Qt,te=Qt.get("RunTime"),ee={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=v.create(v.RUNTIME);return ie.currentId=ie.idMap[i]=e?performance.now():Date.now(),ie.currentName=ie.nameMap[i]=t,ie.nameToIdMap[t]=i,i},end(t,e){const i=ie.idMap[t],s=ie.nameMap[t],r=e?(performance.now()-i)/1e3:Date.now()-i;ie.idMap[t]=ie.nameMap[t]=ie.nameToIdMap[s]=void 0,te.log(s,r,"ms")},endOfName(t,e){const i=ie.nameToIdMap[t];s(i)||ie.end(i,e)}},ie=ee,se=[],re={list:{},add(t,...e){this.list[t]=!0,se.push(...e)},has(t,e){const i=this.list[t];return!i&&e&&this.need(t),i},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout(()=>se.forEach(t=>re.has(t,!0)));const ne={editor:t=>re.need("editor")},ae=Qt.get("UICreator"),oe={list:{},register(t){const{__tag:e}=t.prototype;he[e]&&ae.repeat(e),he[e]=t},get(t,e,i,r,n,a){he[t]||ae.error("not register "+t);const o=new he[t](e);return s(i)||(o.x=i,r&&(o.y=r),n&&(o.width=n),a&&(o.height=a)),o}},{list:he}=oe,le=Qt.get("EventCreator"),de={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],n(e)&&(ce[e]&&le.repeat(e),ce[e]=t)})},changeName(t,e){const i=ce[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,ce[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new ce[t](...e)},{nameList:ce}=de;class ue{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:i}=this;for(let s=0,r=i.length;s<r;s++)if(e=i[s],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const s=ne.canvas(t);return this.add(s),s}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let i=0,s=this.list.length;i<s;i++)t=this.list[i],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 _e(t,e,i,s){var r,n=arguments.length,a=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(n<3?r(a):n>3?r(e,i,a):r(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a}function pe(t,e,i,s){return new(i||(i=Promise))(function(r,n){function a(t){try{h(s.next(t))}catch(t){n(t)}}function o(t){try{h(s.throw(t))}catch(t){n(t)}}function h(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(a,o)}h((s=s.apply(t,e||[])).next())})}function ge(t){return(e,i)=>{t||(t=i);const s={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===i&&(s.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,i,s)}}"function"==typeof SuppressedError&&SuppressedError;const fe=[];function ye(){return(t,e)=>{fe.push(e)}}const me=[];class ve{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||me)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;fe.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,i,s,r,n){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,r,n){d(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,i,s,r,n)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,i,s){}strokeRect(t,e,i,s){}clearRect(t,e,i,s){}drawImage(t,e,i,s,r,n,a,o,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*o;s+=e,e=0,n+=t,o-=t}if(i<0){const t=-i/r*h;r+=i,i=0,a+=t,h-=t}this.context.drawImage(t,e,i,s,r,n,a,o,h);break;case 5:this.context.drawImage(t,e,i,s,r);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,r,n){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,r,n){}arcTo(t,e,i,s,r){}ellipse(t,e,i,s,r,n,a,o){}rect(t,e,i,s){}roundRect(t,e,i,s,r){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,r,n){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}}_e([ge("imageSmoothingEnabled")],ve.prototype,"smooth",void 0),_e([ge("imageSmoothingQuality")],ve.prototype,"smoothLevel",void 0),_e([ge("globalAlpha")],ve.prototype,"opacity",void 0),_e([ge()],ve.prototype,"fillStyle",void 0),_e([ge()],ve.prototype,"strokeStyle",void 0),_e([ge("lineWidth")],ve.prototype,"strokeWidth",void 0),_e([ge("lineCap")],ve.prototype,"strokeCap",void 0),_e([ge("lineJoin")],ve.prototype,"strokeJoin",void 0),_e([ge("lineDashOffset")],ve.prototype,"dashOffset",void 0),_e([ge()],ve.prototype,"miterLimit",void 0),_e([ge()],ve.prototype,"shadowBlur",void 0),_e([ge()],ve.prototype,"shadowColor",void 0),_e([ge()],ve.prototype,"shadowOffsetX",void 0),_e([ge()],ve.prototype,"shadowOffsetY",void 0),_e([ge()],ve.prototype,"filter",void 0),_e([ge()],ve.prototype,"font",void 0),_e([ge()],ve.prototype,"fontKerning",void 0),_e([ge()],ve.prototype,"fontStretch",void 0),_e([ge()],ve.prototype,"fontVariantCaps",void 0),_e([ge()],ve.prototype,"textAlign",void 0),_e([ge()],ve.prototype,"textBaseline",void 0),_e([ge()],ve.prototype,"textRendering",void 0),_e([ge()],ve.prototype,"wordSpacing",void 0),_e([ge()],ve.prototype,"letterSpacing",void 0),_e([ge()],ve.prototype,"direction",void 0),_e([ye()],ve.prototype,"setTransform",null),_e([ye()],ve.prototype,"resetTransform",null),_e([ye()],ve.prototype,"getTransform",null),_e([ye()],ve.prototype,"save",null),_e([ye()],ve.prototype,"restore",null),_e([ye()],ve.prototype,"translate",null),_e([ye()],ve.prototype,"scale",null),_e([ye()],ve.prototype,"rotate",null),_e([ye()],ve.prototype,"fill",null),_e([ye()],ve.prototype,"stroke",null),_e([ye()],ve.prototype,"clip",null),_e([ye()],ve.prototype,"fillRect",null),_e([ye()],ve.prototype,"strokeRect",null),_e([ye()],ve.prototype,"clearRect",null),_e([ye()],ve.prototype,"beginPath",null),_e([ye()],ve.prototype,"moveTo",null),_e([ye()],ve.prototype,"lineTo",null),_e([ye()],ve.prototype,"bezierCurveTo",null),_e([ye()],ve.prototype,"quadraticCurveTo",null),_e([ye()],ve.prototype,"closePath",null),_e([ye()],ve.prototype,"arc",null),_e([ye()],ve.prototype,"arcTo",null),_e([ye()],ve.prototype,"ellipse",null),_e([ye()],ve.prototype,"rect",null),_e([ye()],ve.prototype,"roundRect",null),_e([ye()],ve.prototype,"createConicGradient",null),_e([ye()],ve.prototype,"createLinearGradient",null),_e([ye()],ve.prototype,"createPattern",null),_e([ye()],ve.prototype,"createRadialGradient",null),_e([ye()],ve.prototype,"fillText",null),_e([ye()],ve.prototype,"measureText",null),_e([ye()],ve.prototype,"strokeText",null);const{copy:xe,multiplyParent:we,pixelScale:be}=Q,{round:Ee}=Math,Pe=new Gt,Be=new Gt,ke={width:1,height:1,pixelRatio:1},Se=["width","height","pixelRatio"];class Re extends ve{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,e){super(),this.size={},this.worldTransform={},t||(t=ke),this.manager=e,this.innerId=v.create(v.CNAVAS);const{width:i,height:s,pixelRatio:r}=t;this.autoLayout=!i||!s,this.size.pixelRatio=r||y.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 i;this.context&&!this.unreal&&e&&this.width&&(i=this.getSameCanvas(),i.copyWorld(this));const s=this.size;u.copyAttrs(s,t,Se),Se.forEach(t=>s[t]||(s[t]=1)),this.bounds=new Gt(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!this.unreal&&i&&(this.clearWorld(i.bounds),this.copyWorld(i),i.recycle()))}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:i,pixelSnap:s}=this,r=this.worldTransform;e&&we(t,e,r),be(t,i,r),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(r.e=Ee(r.e-.5)+.5,r.f=Ee(r.f-.5)+.5):(r.e=Ee(r.e),r.f=Ee(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,i,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),i&&this.setStrokeOptions(i,s)}setStrokeOptions(t,e){let{strokeCap:i,strokeJoin:r,dashPattern:n,dashOffset:a,miterLimit:o}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(r=e.strokeJoin),s(e.dashPattern)||(n=e.dashPattern),s(e.dashOffset)||(a=e.dashOffset),e.miterLimit&&(o=e.miterLimit)),this.strokeCap=i,this.strokeJoin=r,this.dashPattern=n,this.dashOffset=a,this.miterLimit=o}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,i=1){return!0}setWorldShadow(t,e,i,s){const{pixelRatio:r}=this;this.shadowOffsetX=t*r,this.shadowOffsetY=e*r,this.shadowBlur=i*r,this.shadowColor=s||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,i,s,r=!0){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,r),i?(this.setTempPixelBounds2(i,r),i=Be):i=Pe,this.drawImage(t.view,Pe.x,Pe.y,Pe.width,Pe.height,i.x,i.y,i.width,i.height)):this.drawImage(t.view,0,0),s&&(this.blendMode="source-over")}copyWorldToInner(t,e,i,s,r=!0){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Yt.tempToOuterOf(i,e),s,r),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,r),this.drawImage(t.view,Pe.x,Pe.y,Pe.width,Pe.height,i.x,i.y,i.width,i.height),s&&(this.blendMode="source-over"))}copyWorldByReset(t,e,i,s,r,n=!0){this.resetTransform(),this.copyWorld(t,e,i,s,n),r||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempPixelBounds(t,!0,!0);const{context:s}=this,r=s.getImageData(Pe.x,Pe.y,Pe.width,Pe.height),{data:n}=r;for(let t=0,s=n.length;t<s;t+=4)i=.299*n[t]+.587*n[t+1]+.114*n[t+2],(e=n[t+3])&&(n[t+3]=255===e?i:e*(i/255));s.putImageData(r,Pe.x,Pe.y)}useMask(t,e,i){this.copyWorld(t,e,i,"destination-in")}useEraser(t,e,i){this.copyWorld(t,e,i,"destination-out")}fillWorld(t,e,i,s){i&&(this.blendMode=i),this.fillStyle=e,this.setTempPixelBounds(t,s),this.fillRect(Pe.x,Pe.y,Pe.width,Pe.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(Pe.x,Pe.y,Pe.width,Pe.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(Pe.x,Pe.y,Pe.width,Pe.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(Pe.x,Pe.y,Pe.width,Pe.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(Pe,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(Be,t,e,i)}copyToPixelBounds(t,e,i,s){t.set(e),s&&t.intersect(this.bounds),t.scale(this.pixelRatio),i&&t.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:i,pixelSnap:s}=this,r=this.manager?this.manager.get(i):ne.canvas(Object.assign({},i));return r.save(),t&&(xe(r.worldTransform,this.worldTransform),r.useWorldTransform()),e&&(r.smooth=this.smooth),r.pixelSnap!==s&&(r.pixelSnap=s),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 Ce={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Te={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Le=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},Te),Oe={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},Ie={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},De=Object.assign(Object.assign({},Ie),Te),Ae=Le,Me={};for(let t in Ae)Me[Ae[t]]=t;const We={};for(let t in Ae)We[Ae[t]]=Oe[t];const Fe={drawRoundRect(t,e,i,s,r,n){const a=M.fourNumber(n,Math.min(s/2,r/2)),o=e+s,h=i+r;a[0]?t.moveTo(e+a[0],i):t.moveTo(e,i),a[1]?t.arcTo(o,i,o,h,a[1]):t.lineTo(o,i),a[2]?t.arcTo(o,h,e,h,a[2]):t.lineTo(o,h),a[3]?t.arcTo(e,h,e,i,a[3]):t.lineTo(e,h),a[0]?t.arcTo(e,i,o,i,a[0]):t.lineTo(e,i)}},{sin:Ue,cos:Ne,hypot:ze,atan2:Ye,ceil:Xe,abs:He,PI:je,sqrt:Ge,pow:Ve}=Math,{setPoint:Ke,addPoint:qe}=yt,{set:Ze,toNumberPoints:Qe}=ht,{M:Je,L:$e,C:ti,Q:ei,Z:ii}=Le,si={},ri={points(t,e,i,s){let r=Qe(e);if(t.push(Je,r[0],r[1]),i&&r.length>5){let e,n,a,o,h,l,d,c,u,_,p,g,f,y=r.length;const m=!0===i?.5:i;s&&(r=[r[y-2],r[y-1],...r,r[0],r[1],r[2],r[3]],y=r.length);for(let i=2;i<y-2;i+=2)e=r[i-2],n=r[i-1],a=r[i],o=r[i+1],h=r[i+2],l=r[i+3],p=Ge(Ve(a-e,2)+Ve(o-n,2)),g=Ge(Ve(h-a,2)+Ve(l-o,2)),(p||g)&&(f=p+g,p=m*p/f,g=m*g/f,h-=e,l-=n,d=a-p*h,c=o-p*l,2===i?s||t.push(ei,d,c,a,o):t.push(ti,u,_,d,c,a,o),u=a+g*h,_=o+g*l);s||t.push(ei,u,_,r[y-2],r[y-1])}else for(let e=2,i=r.length;e<i;e+=2)t.push($e,r[e],r[e+1]);s&&t.push(ii)},rect(t,e,i,s,r){Ce.creator.path=t,Ce.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+r).lineTo(e,i+r).lineTo(e,i)},roundRect(t,e,i,s,r,n){Ce.creator.path=[],Fe.drawRoundRect(Ce.creator,e,i,s,r,n),t.push(...Ce.convertToCanvasData(Ce.creator.path,!0))},arcTo(t,e,i,s,r,n,a,o,h,l,d){const c=s-e,u=r-i,_=n-s,p=a-r;let g=Ye(u,c),f=Ye(p,_);const y=ze(c,u),m=ze(_,p);let v=f-g;if(v<0&&(v+=U),y<1e-12||m<1e-12||v<1e-12||He(v-je)<1e-12)return t&&t.push($e,s,r),h&&(Ke(h,e,i),qe(h,s,r)),d&&Ze(d,e,i),void(l&&Ze(l,s,r));const x=c*p-_*u<0,w=x?-1:1,b=o/Ne(v/2),E=s+b*Ne(g+v/2+N*w),P=r+b*Ue(g+v/2+N*w);return g-=N*w,f-=N*w,oi(t,E,P,o,o,0,g/F,f/F,x,h,l,d)},arc:(t,e,i,s,r,n,a,o,h,l)=>oi(t,e,i,s,s,0,r,n,a,o,h,l),ellipse(t,e,i,s,r,n,a,o,h,l,d,c){const u=n*F,_=Ue(u),p=Ne(u);let g=a*F,f=o*F;g>je&&(g-=U),f<0&&(f+=U);let y=f-g;y<0?y+=U:y>U&&(y-=U),h&&(y-=U);const m=Xe(He(y/N)),v=y/m,x=Ue(v/4),w=8/3*x*x/Ue(v/2);f=g+v;let b,E,P,B,k,S,R,C,T=Ne(g),L=Ue(g),O=P=p*s*T-_*r*L,I=B=_*s*T+p*r*L,D=e+P,A=i+B;t&&t.push(t.length?$e:Je,D,A),l&&Ke(l,D,A),c&&Ze(c,D,A);for(let n=0;n<m;n++)b=Ne(f),E=Ue(f),P=p*s*b-_*r*E,B=_*s*b+p*r*E,k=e+O-w*(p*s*L+_*r*T),S=i+I-w*(_*s*L-p*r*T),R=e+P+w*(p*s*E+_*r*b),C=i+B+w*(_*s*E-p*r*b),t&&t.push(ti,k,S,R,C,e+P,i+B),l&&ai(e+O,i+I,k,S,R,C,e+P,i+B,l,!0),O=P,I=B,T=b,L=E,g=f,f+=v;d&&Ze(d,e+P,i+B)},quadraticCurveTo(t,e,i,s,r,n,a){t.push(ti,(e+2*s)/3,(i+2*r)/3,(n+2*s)/3,(a+2*r)/3,n,a)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,r,n,a,o){ai(t,e,(t+2*i)/3,(e+2*s)/3,(r+2*i)/3,(n+2*s)/3,r,n,a,o)},toTwoPointBounds(t,e,i,s,r,n,a,o,h,l){const d=[];let c,u,_,p,g,f,y,m,v=t,x=i,w=r,b=a;for(let t=0;t<2;++t)if(1==t&&(v=e,x=s,w=n,b=o),c=-3*v+9*x-9*w+3*b,u=6*v-12*x+6*w,_=3*x-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;p=-_/u,0<p&&p<1&&d.push(p)}else y=u*u-4*_*c,m=Math.sqrt(y),y<0||(g=(-u+m)/(2*c),0<g&&g<1&&d.push(g),f=(-u-m)/(2*c),0<f&&f<1&&d.push(f));l?qe(h,t,e):Ke(h,t,e),qe(h,a,o);for(let l=0,c=d.length;l<c;l++)ni(d[l],t,e,i,s,r,n,a,o,si),qe(h,si.x,si.y)},getPointAndSet(t,e,i,s,r,n,a,o,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*s+_*n+p*o,l.y=c*i+u*r+_*a+p*h},getPoint(t,e,i,s,r,n,a,o,h){const l={};return ni(t,e,i,s,r,n,a,o,h,l),l},getDerivative(t,e,i,s,r){const n=1-t;return 3*n*n*(i-e)+6*n*t*(s-i)+3*t*t*(r-s)}},{getPointAndSet:ni,toTwoPointBounds:ai,ellipse:oi}=ri,{sin:hi,cos:li,sqrt:di,atan2:ci}=Math,{ellipse:ui}=ri,_i={ellipticalArc(t,e,i,s,r,n,a,o,h,l,d){const c=(h-e)/2,u=(l-i)/2,_=n*F,p=hi(_),g=li(_),f=-g*c-p*u,m=-g*u+p*c,v=s*s,x=r*r,w=m*m,b=f*f,E=v*x-v*w-x*b;let P=0;if(E<0){const t=di(1-E/(v*x));s*=t,r*=t}else P=(a===o?-1:1)*di(E/(v*w+x*b));const B=P*s*m/r,k=-P*r*f/s,S=ci((m-k)/r,(f-B)/s),R=ci((-m-k)/r,(-f-B)/s);let C=R-S;0===o&&C>0?C-=U:1===o&&C<0&&(C+=U);const T=e+c+g*B-p*k,L=i+u+p*B+g*k,O=C<0?1:0;d||y.ellipseToCurve?ui(t,T,L,s,r,n,S/F,R/F,O):s!==r||n?t.push(Le.G,T,L,s,r,n,S/F,R/F,O):t.push(Le.O,T,L,s,S/F,R/F,O)}},pi={toCommand:t=>[],toNode:t=>[]},{M:gi,m:fi,L:yi,l:mi,H:vi,h:xi,V:wi,v:bi,C:Ei,c:Pi,S:Bi,s:ki,Q:Si,q:Ri,T:Ci,t:Ti,A:Li,a:Oi,Z:Ii,z:Di,N:Ai,D:Mi,X:Wi,G:Fi,F:Ui,O:Ni,P:zi,U:Yi}=Le,{rect:Xi,roundRect:Hi,arcTo:ji,arc:Gi,ellipse:Vi,quadraticCurveTo:Ki}=ri,{ellipticalArc:qi}=_i,Zi=Qt.get("PathConvert"),Qi={},Ji={current:{dot:0},stringify(t,e){let i,s,r,n=0,a=t.length,o="";for(;n<a;){s=t[n],i=We[s],o+=s===r?" ":Me[s];for(let s=1;s<i;s++)o+=M.float(t[n+s],e),s===i-1||(o+=" ");r=s,n+=i}return o},parse(t,e){let i,s,r,n="";const a=[],o=e?De:Ie;for(let e=0,h=t.length;e<h;e++)s=t[e],qt[s]?("."===s&&($i.dot&&(ts(a,n),n=""),$i.dot++),"0"===n&&"."!==s&&(ts(a,n),n=""),n+=s):Le[s]?(n&&(ts(a,n),n=""),$i.name=Le[s],$i.length=Oe[s],$i.index=0,ts(a,$i.name),!i&&o[s]&&(i=!0)):"-"===s||"+"===s?"e"===r||"E"===r?n+=s:(n&&ts(a,n),n=s):n&&(ts(a,n),n=""),r=s;return n&&ts(a,n),i?Ji.toCanvasData(a,e):a},toCanvasData(t,e){let i,s,r,n,a,o=0,h=0,l=0,d=0,c=0,u=t.length;const _=[];for(;c<u;){switch(r=t[c],r){case fi:t[c+1]+=o,t[c+2]+=h;case gi:o=t[c+1],h=t[c+2],_.push(gi,o,h),c+=3;break;case xi:t[c+1]+=o;case vi:o=t[c+1],_.push(yi,o,h),c+=2;break;case bi:t[c+1]+=h;case wi:h=t[c+1],_.push(yi,o,h),c+=2;break;case mi:t[c+1]+=o,t[c+2]+=h;case yi:o=t[c+1],h=t[c+2],_.push(yi,o,h),c+=3;break;case ki:t[c+1]+=o,t[c+2]+=h,t[c+3]+=o,t[c+4]+=h,r=Bi;case Bi:a=n===Ei||n===Bi,l=a?2*o-i:t[c+1],d=a?2*h-s:t[c+2],i=t[c+1],s=t[c+2],o=t[c+3],h=t[c+4],_.push(Ei,l,d,i,s,o,h),c+=5;break;case Pi:t[c+1]+=o,t[c+2]+=h,t[c+3]+=o,t[c+4]+=h,t[c+5]+=o,t[c+6]+=h,r=Ei;case Ei:i=t[c+3],s=t[c+4],o=t[c+5],h=t[c+6],_.push(Ei,t[c+1],t[c+2],i,s,o,h),c+=7;break;case Ti:t[c+1]+=o,t[c+2]+=h,r=Ci;case Ci:a=n===Si||n===Ci,i=a?2*o-i:t[c+1],s=a?2*h-s:t[c+2],e?Ki(_,o,h,i,s,t[c+1],t[c+2]):_.push(Si,i,s,t[c+1],t[c+2]),o=t[c+1],h=t[c+2],c+=3;break;case Ri:t[c+1]+=o,t[c+2]+=h,t[c+3]+=o,t[c+4]+=h,r=Si;case Si:i=t[c+1],s=t[c+2],e?Ki(_,o,h,i,s,t[c+3],t[c+4]):_.push(Si,i,s,t[c+3],t[c+4]),o=t[c+3],h=t[c+4],c+=5;break;case Oi:t[c+6]+=o,t[c+7]+=h;case Li:qi(_,o,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],e),o=t[c+6],h=t[c+7],c+=8;break;case Di:case Ii:_.push(Ii),c++;break;case Ai:o=t[c+1],h=t[c+2],e?Xi(_,o,h,t[c+3],t[c+4]):es(_,t,c,5),c+=5;break;case Mi:o=t[c+1],h=t[c+2],e?Hi(_,o,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):es(_,t,c,9),c+=9;break;case Wi:o=t[c+1],h=t[c+2],e?Hi(_,o,h,t[c+3],t[c+4],t[c+5]):es(_,t,c,6),c+=6;break;case Fi:Vi(e?_:es(_,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,Qi),o=Qi.x,h=Qi.y,c+=9;break;case Ui:e?Vi(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):es(_,t,c,5),o=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Ni:Gi(e?_:es(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Qi),o=Qi.x,h=Qi.y,c+=7;break;case zi:e?Gi(_,t[c+1],t[c+2],t[c+3],0,360,!1):es(_,t,c,4),o=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Yi:ji(e?_:es(_,t,c,6),o,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Qi),o=Qi.x,h=Qi.y,c+=6;break;default:return Zi.error(`command: ${r} [index:${c}]`,t),_}n=r}return _},objectToCanvasData(t){if(t[0].name.length>1)return pi.toCommand(t);{const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(gi,t.x,t.y);break;case"L":e.push(yi,t.x,t.y);break;case"C":e.push(Ei,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Si,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Ii)}}),e}},copyData(t,e,i,s){for(let r=i,n=i+s;r<n;r++)t.push(e[r])},pushData(t,e){$i.index===$i.length&&($i.index=1,t.push($i.name)),t.push(Number(e)),$i.index++,$i.dot=0}},{current:$i,pushData:ts,copyData:es}=Ji,{M:is,L:ss,C:rs,Q:ns,Z:as,N:os,D:hs,X:ls,G:ds,F:cs,O:us,P:_s,U:ps}=Le,{getMinDistanceFrom:gs,getRadianFrom:fs}=ht,{tan:ys,min:ms,abs:vs}=Math,xs={},ws={beginPath(t){t.length=0},moveTo(t,e,i){t.push(is,e,i)},lineTo(t,e,i){t.push(ss,e,i)},bezierCurveTo(t,e,i,s,r,n,a){t.push(rs,e,i,s,r,n,a)},quadraticCurveTo(t,e,i,s,r){t.push(ns,e,i,s,r)},closePath(t){t.push(as)},rect(t,e,i,s,r){t.push(os,e,i,s,r)},roundRect(t,e,i,s,r,n){if(o(n))t.push(ls,e,i,s,r,n);else{const a=M.fourNumber(n);a?t.push(hs,e,i,s,r,...a):t.push(os,e,i,s,r)}},ellipse(t,e,i,s,n,a,o,h,l){r(a)?t.push(cs,e,i,s,n):(r(o)&&(o=0),r(h)&&(h=360),t.push(ds,e,i,s,n,a,o,h,l?1:0))},arc(t,e,i,s,n,a,o){r(n)?t.push(_s,e,i,s):(r(a)&&(a=360),t.push(us,e,i,s,n,a,o?1:0))},arcTo(t,e,i,r,n,a,o,h){if(!s(o)){const t=gs(o,h,e,i,r,n);a=ms(a,ms(t/2,t/2*vs(ys(fs(o,h,e,i,r,n)/2))))}t.push(ps,e,i,r,n,a)},drawEllipse(t,e,i,s,n,a,o,h,l){ri.ellipse(null,e,i,s,n,r(a)?0:a,r(o)?0:o,r(h)?360:h,l,null,null,xs),t.push(is,xs.x,xs.y),bs(t,e,i,s,n,a,o,h,l)},drawArc(t,e,i,s,n,a,o){ri.arc(null,e,i,s,r(n)?0:n,r(a)?360:a,o,null,null,xs),t.push(is,xs.x,xs.y),Es(t,e,i,s,n,a,o)},drawPoints(t,e,i,s){ri.points(t,e,i,s)}},{ellipse:bs,arc:Es}=ws,{moveTo:Ps,lineTo:Bs,quadraticCurveTo:ks,bezierCurveTo:Ss,closePath:Rs,beginPath:Cs,rect:Ts,roundRect:Ls,ellipse:Os,arc:Is,arcTo:Ds,drawEllipse:As,drawArc:Ms,drawPoints:Ws}=ws;class Fs{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?n(t)?Ce.parse(t):t:[],this}beginPath(){return Cs(this.__path),this.paint(),this}moveTo(t,e){return Ps(this.__path,t,e),this.paint(),this}lineTo(t,e){return Bs(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,r,n){return Ss(this.__path,t,e,i,s,r,n),this.paint(),this}quadraticCurveTo(t,e,i,s){return ks(this.__path,t,e,i,s),this.paint(),this}closePath(){return Rs(this.__path),this.paint(),this}rect(t,e,i,s){return Ts(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,r){return Ls(this.__path,t,e,i,s,r),this.paint(),this}ellipse(t,e,i,s,r,n,a,o){return Os(this.__path,t,e,i,s,r,n,a,o),this.paint(),this}arc(t,e,i,s,r,n){return Is(this.__path,t,e,i,s,r,n),this.paint(),this}arcTo(t,e,i,s,r){return Ds(this.__path,t,e,i,s,r),this.paint(),this}drawEllipse(t,e,i,s,r,n,a,o){return As(this.__path,t,e,i,s,r,n,a,o),this.paint(),this}drawArc(t,e,i,s,r,n){return Ms(this.__path,t,e,i,s,r,n),this.paint(),this}drawPoints(t,e,i){return Ws(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Us,L:Ns,C:zs,Q:Ys,Z:Xs,N:Hs,D:js,X:Gs,G:Vs,F:Ks,O:qs,P:Zs,U:Qs}=Le,Js=Qt.get("PathDrawer"),$s={drawPathByData(t,e){if(!e)return;let i,s=0,r=e.length;for(;s<r;)switch(i=e[s],i){case Us:t.moveTo(e[s+1],e[s+2]),s+=3;break;case Ns:t.lineTo(e[s+1],e[s+2]),s+=3;break;case zs:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case Ys:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Xs:t.closePath(),s+=1;break;case Hs:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case js:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],[e[s+5],e[s+6],e[s+7],e[s+8]]),s+=9;break;case Gs:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case Vs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*F,e[s+6]*F,e[s+7]*F,e[s+8]),s+=9;break;case Ks:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,U,!1),s+=5;break;case qs:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*F,e[s+5]*F,e[s+6]),s+=7;break;case Zs:t.arc(e[s+1],e[s+2],e[s+3],0,U,!1),s+=4;break;case Qs:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void Js.error(`command: ${i} [index:${s}]`,e)}}},{M:tr,L:er,C:ir,Q:sr,Z:rr,N:nr,D:ar,X:or,G:hr,F:lr,O:dr,P:cr,U:ur}=Le,{toTwoPointBounds:_r,toTwoPointBoundsByQuadraticCurve:pr,arcTo:gr,arc:fr,ellipse:yr}=ri,{addPointBounds:mr,copy:vr,addPoint:xr,setPoint:wr,addBounds:br,toBounds:Er}=yt,Pr=Qt.get("PathBounds");let Br,kr,Sr;const Rr={},Cr={},Tr={},Lr={toBounds(t,e){Lr.toTwoPointBounds(t,Cr),Er(Cr,e)},toTwoPointBounds(t,e){if(!t||!t.length)return wr(e,0,0);let i,s,r,n,a,o=0,h=0,l=0;const d=t.length;for(;o<d;)switch(a=t[o],0===o&&(a===rr||a===ir||a===sr?wr(e,h,l):wr(e,t[o+1],t[o+2])),a){case tr:case er:h=t[o+1],l=t[o+2],xr(e,h,l),o+=3;break;case ir:r=t[o+5],n=t[o+6],_r(h,l,t[o+1],t[o+2],t[o+3],t[o+4],r,n,Rr),mr(e,Rr),h=r,l=n,o+=7;break;case sr:i=t[o+1],s=t[o+2],r=t[o+3],n=t[o+4],pr(h,l,i,s,r,n,Rr),mr(e,Rr),h=r,l=n,o+=5;break;case rr:o+=1;break;case nr:h=t[o+1],l=t[o+2],br(e,h,l,t[o+3],t[o+4]),o+=5;break;case ar:case or:h=t[o+1],l=t[o+2],br(e,h,l,t[o+3],t[o+4]),o+=a===ar?9:6;break;case hr:yr(null,t[o+1],t[o+2],t[o+3],t[o+4],t[o+5],t[o+6],t[o+7],t[o+8],Rr,Tr),0===o?vr(e,Rr):mr(e,Rr),h=Tr.x,l=Tr.y,o+=9;break;case lr:h=t[o+1],l=t[o+2],kr=t[o+3],Sr=t[o+4],br(e,h-kr,l-Sr,2*kr,2*Sr),h+=kr,o+=5;break;case dr:fr(null,t[o+1],t[o+2],t[o+3],t[o+4],t[o+5],t[o+6],Rr,Tr),0===o?vr(e,Rr):mr(e,Rr),h=Tr.x,l=Tr.y,o+=7;break;case cr:h=t[o+1],l=t[o+2],Br=t[o+3],br(e,h-Br,l-Br,2*Br,2*Br),h+=Br,o+=4;break;case ur:gr(null,h,l,t[o+1],t[o+2],t[o+3],t[o+4],t[o+5],Rr,Tr),0===o?vr(e,Rr):mr(e,Rr),h=Tr.x,l=Tr.y,o+=6;break;default:return void Pr.error(`command: ${a} [index:${o}]`,t)}}},{M:Or,L:Ir,Z:Dr}=Le,{getCenterX:Ar,getCenterY:Mr}=ht,{arcTo:Wr}=ws,Fr={smooth(t,e,i){let s,r,n,a=0,o=0,h=0,l=0,d=0,c=0,u=0,_=0,p=0;const g=t.length,f=[];for(;a<g;){switch(s=t[a],s){case Or:l=_=t[a+1],d=p=t[a+2],a+=3,t[a]===Ir?(c=t[a+1],u=t[a+2],f.push(Or,Ar(l,c),Mr(d,u))):f.push(Or,l,d);break;case Ir:switch(o=t[a+1],h=t[a+2],a+=3,t[a]){case Ir:Wr(f,o,h,t[a+1],t[a+2],e,_,p);break;case Dr:Wr(f,o,h,l,d,e,_,p);break;default:f.push(Ir,o,h)}_=o,p=h;break;case Dr:r!==Dr&&(Wr(f,l,d,c,u,e,_,p),f.push(Dr)),a+=1;break;default:n=We[s];for(let e=0;e<n;e++)f.push(t[a+e]);a+=n}r=s}return s!==Dr&&(f[1]=l,f[2]=d),f}};function Ur(t){return new Fs(t)}const Nr=Ur();Ce.creator=Ur(),Ce.parse=Ji.parse,Ce.convertToCanvasData=Ji.toCanvasData;const{drawRoundRect:zr}=Fe;function Yr(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,r){zr(this,t,e,i,s,r)})}(t)}const Xr={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=Hr.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{}}}},Hr=Xr;Hr.alphaPixelTypes.forEach(t=>Hr.upperCaseTypeMap[t]=t.toUpperCase());const jr=Qt.get("TaskProcessor");class Gr{constructor(t){this.parallel=!0,this.time=1,this.id=v.create(v.TASK),this.task=t}run(){return pe(this,void 0,void 0,function*(){try{if(this.isComplete)return;if(this.canUse&&!this.canUse())return this.cancel();this.task&&this.parent.running&&(yield this.task())}catch(t){jr.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}}class Vr{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,i=0;for(let s=0;s<t;s++)s<=this.finishedIndex?(i+=this.list[s].time,s===this.finishedIndex&&(e=i)):e+=this.list[s].time;return this.isComplete?1:i/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&u.assign(this.config,t),this.empty()}add(t,e,i){let r,n,a,h;const l=new Gr(t);return l.parent=this,o(e)?h=e:e&&(n=e.parallel,r=e.start,a=e.time,h=e.delay,i||(i=e.canUse)),a&&(l.time=a),!1===n&&(l.parallel=!1),i&&(l.canUse=i),s(h)?this.push(l,r):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(l,r))},h)),this.isComplete=!1,l}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++,t.isCancel?this.runTask():this.nextTask()}).catch(t=>{this.onError(t)}):this.timer=setTimeout(()=>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;const{config:e,list:i,index:s}=this;this.parallelList=[],this.parallelSuccessNumber=0;let r=s+e.parallel;if(r>i.length&&(r=i.length),e.parallel>1)for(let e=s;e<r&&(t=i[e],t.parallel);e++)this.parallelList.push(t)}fillParallelTask(){let t;const e=this.parallelList;this.parallelSuccessNumber++,e.pop();const i=e.length,s=this.finishedIndex+i;if(e.length){if(!this.running)return;s<this.total&&(t=this.list[s],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 Kr=Qt.get("Resource"),qr={tasker:new Vr,map:{},get isComplete(){return Zr.tasker.isComplete},set(t,e){Zr.map[t]&&Kr.repeat(t),Zr.map[t]=e},get:t=>Zr.map[t],remove(t){const e=Zr.map[t];e&&(e.destroy&&e.destroy(),delete Zr.map[t])},loadImage(t,e){return new Promise((i,s)=>{const r=this.setImage(t,t,e);r.load(()=>i(r),t=>s(t))})},setImage(t,e,i){let s;return n(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=ne.image(s)),Zr.set(t,e),e},destroy(){Zr.map={}}},Zr=qr,Qr={maxRecycled:10,recycledList:[],patternTasker:new Vr,get(t){let e=qr.get(t.url);return e||qr.set(t.url,e=ne.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||Jr.recycledList.push(t)})},clearRecycled(){const t=Jr.recycledList;t.length>Jr.maxRecycled&&(t.forEach(t=>!t.use&&t.url&&qr.remove(t.url)),t.length=0)},hasAlphaPixel:t=>Xr.alphaPixelTypes.some(e=>Jr.isFormat(e,t)),isFormat(t,e){if(e.format)return e.format===t;const{url:i}=e;if(i.startsWith("data:")){if(i.startsWith("data:"+Xr.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+Xr.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){Jr.recycledList=[]}},Jr=Qr,{IMAGE:$r,create:tn}=v;class en{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=tn($r),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}Qr.isFormat("svg",t)&&(this.isSVG=!0),Qr.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,e){if(!this.loading){this.loading=!0;const{crossOrigin:t}=this.config;qr.tasker.add(()=>pe(this,void 0,void 0,function*(){return yield y.origin.loadImage(this.url,s(t)?y.image.crossOrigin:t,this).then(t=>this.setView(t)).catch(t=>{this.error=t,this.onComplete(!1)})}))}return this.waitComplete.push(t,e),this.waitComplete.length-2}unload(t,e){const i=this.waitComplete;if(e){const e=i[t+1];e&&e({type:"stop"})}i[t]=i[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)}onComplete(t){let e;this.waitComplete.forEach((i,s)=>{e=s%2,i&&(t?e||i(this):e&&i(this.error))}),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(t,e,i,s,r,n,a){if(t||(t=this.width),e||(e=this.height),this.cache){let{params:t,data:e}=this.cache;for(let i in t)if(t[i]!==arguments[i]){e=null;break}if(e)return e}const o=y.image.resize(this.view,t,e,r,n,void 0,a,i,s);return this.cache=this.use>1?{data:o,params:arguments}:null,o}getPattern(t,e,i,s){const r=y.canvas.createPattern(t,e);return y.image.setPatternTransform(r,i,s),r}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function sn(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function rn(t,e){return Object.getOwnPropertyDescriptor(t,e)}function nn(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function an(t,e){return(i,s)=>hn(i,s,t,e&&e(s))}function on(t){return t}function hn(t,e,i,s){const r={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};sn(t,e,Object.assign(r,s||{})),Mn(t,e,i)}function ln(t){return an(t)}function dn(t,e){return an(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function cn(t,e){return an(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function un(t){return an(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),yn(this))}}))}function _n(t,e){return an(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function pn(t,e){return an(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function gn(t,e){return an(t,t=>({set(i){this.__setAttr(t,i,e)&&yn(this)}}))}function fn(t){return an(t,t=>({set(e){this.__setAttr(t,e)&&(yn(this),this.__.__removeNaturalSize())}}))}function yn(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function mn(t){return an(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),yn(this)}}))}const vn=gn;function xn(t,e){return an(t,t=>({set(i){this.__setAttr(t,i)&&(wn(this),e&&(this.__.__useStroke=!0))}}))}function wn(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&yn(t)}const bn=xn;function En(t){return an(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Pn(t){return an(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function Bn(t){return an(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;u.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip),this.__layout.surfaceChange()}}}))}function kn(t){return an(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Rn(this)}}))}function Sn(t){return an(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>Cn(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Cn(this,t,e,i),this.mask&&Rn(this)}}))}function Rn(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Cn(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||yn(t))}function Tn(t){return an(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function Ln(t){return an(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function On(t){return an(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function In(t){return an(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===Qt.showBounds&&this.__layout.surfaceChange(),this.leafer&&this.leafer.updateCursor())}}))}function Dn(t){return an(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function An(t){return(e,i)=>{sn(e,"__DataProcessor",{get:()=>t})}}function Mn(t,e,i){const r=t.__DataProcessor.prototype,n="_"+e,a=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),o=nn(e,i);if(s(i))o.get=function(){return this[n]};else if("function"==typeof i)o.get=function(){const t=this[n];return null==t?i(this.__leaf):t};else if(d(i)){const t=c(i);o.get=function(){const e=this[n];return null==e?this[n]=t?{}:u.clone(i):e}}const h=t.isBranchLeaf;"width"===e?o.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalWidth,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.width:e?t._height&&t.__useNaturalRatio?t._height*e/t.__naturalHeight:e:h&&s.children.length?s.boxBounds.width:i}return t}:"height"===e&&(o.get=function(){const t=this[n];if(null==t){const t=this,e=t.__naturalHeight,s=t.__leaf;return!i||s.pathInputed?s.boxBounds.height:e?t._width&&t.__useNaturalRatio?t._width*e/t.__naturalWidth:e:h&&s.children.length?s.boxBounds.height:i}return t});let l,_=r;for(;!l&&_;)l=rn(_,e),_=_.__proto__;l&&l.set&&(o.set=l.set),r[a]&&(o.set=r[a],delete r[a]),sn(r,e,o)}const Wn=new Qt("rewrite"),Fn=[],Un=["destroy","constructor"];function Nn(t){return(e,i)=>{Fn.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function zn(){return t=>{Yn()}}function Yn(t){Fn.length&&(Fn.forEach(e=>{t&&Wn.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),Fn.length=0)}function Xn(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(Un.includes(s)||e&&e.includes(s)))if(t.prototype){rn(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function Hn(){return t=>{oe.register(t)}}function jn(){return t=>{de.register(t)}}setTimeout(()=>Yn(!0));const{copy:Gn,toInnerPoint:Vn,toOuterPoint:Kn,scaleOfOuter:qn,rotateOfOuter:Zn,skewOfOuter:Qn,multiplyParent:Jn,divideParent:$n,getLayout:ta}=Q,ea={},{round:ia}=Math,sa={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),aa(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,r=s.length;t<r;t++)na(s[t],e,i)}},updateMatrix(t,e,i){const s=t.__layout;e?i&&(s.waitAutoLayout=!0,t.__hasAutoLayout&&(s.matrixChanged=!1)):s.waitAutoLayout&&(s.waitAutoLayout=!1),s.matrixChanged&&t.__updateLocalMatrix(),s.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,i=e.length;t<i;t++)oa(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&oa(t),t.__updateChange()},updateAllChange(t){if(la(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)ha(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,e,i,s,r,n){s||(s=t.__nowWorld),t.__worldFlipped||y.fullImageShadow?e.copyWorldByReset(i,s,t.__nowWorld,r,n):e.copyWorldToInner(i,s,t.__layout.renderBounds,r)},moveWorld(t,e,i=0,s,r){const n=d(e)?Object.assign({},e):{x:e,y:i};s?Kn(t.localTransform,n,n,!0):t.parent&&Vn(t.parent.scrollWorldTransform,n,n,!0),ra.moveLocal(t,n.x,n.y,r)},moveLocal(t,e,i=0,s){d(e)&&(i=e.y,e=e.x),e+=t.x,i+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=ia(e),i=ia(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,r,n){ra.zoomOfLocal(t,da(t,e),i,s,r,n)},zoomOfLocal(t,e,i,s=i,r,n){const a=t.__localMatrix;if(o(s)||(s&&(n=s),s=i),Gn(ea,a),qn(ea,e,i,s),ra.hasHighPosition(t))ra.setTransform(t,ea,r,n);else{const e=t.x+ea.e-a.e,o=t.y+ea.f-a.f;n&&!r?t.animate({x:e,y:o,scaleX:t.scaleX*i,scaleY:t.scaleY*s},n):(t.x=e,t.y=o,t.scaleResize(i,s,!0!==r))}},rotateOfWorld(t,e,i,s){ra.rotateOfLocal(t,da(t,e),i,s)},rotateOfLocal(t,e,i,s){const r=t.__localMatrix;Gn(ea,r),Zn(ea,e,i),ra.hasHighPosition(t)?ra.setTransform(t,ea,!1,s):t.set({x:t.x+ea.e-r.e,y:t.y+ea.f-r.f,rotation:M.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,r,n){ra.skewOfLocal(t,da(t,e),i,s,r,n)},skewOfLocal(t,e,i,s=0,r,n){Gn(ea,t.__localMatrix),Qn(ea,e,i,s),ra.setTransform(t,ea,r,n)},transformWorld(t,e,i,s){Gn(ea,t.worldTransform),Jn(ea,e),t.parent&&$n(ea,t.parent.scrollWorldTransform),ra.setTransform(t,ea,i,s)},transform(t,e,i,s){Gn(ea,t.localTransform),Jn(ea,e),ra.setTransform(t,ea,i,s)},setTransform(t,e,i,s){const r=t.__,n=r.origin&&ra.getInnerOrigin(t,r.origin),a=ta(e,n,r.around&&ra.getInnerOrigin(t,r.around));if(ra.hasOffset(t)&&(a.x-=r.offsetX,a.y-=r.offsetY),i){const e=a.scaleX/t.scaleX,i=a.scaleY/t.scaleY;if(delete a.scaleX,delete a.scaleY,n){Yt.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=ra.getInnerOrigin(t,r.origin);ht.move(a,n.x-s.x,n.y-s.y)}t.set(a),t.scaleResize(e,i,!1)}else t.set(a,s)},getFlipTransform(t,e){const i={a:1,b:0,c:0,d:1,e:0,f:0},s="x"===e?1:-1;return qn(i,ra.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>ht.tempToOuterOf(ra.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return bt.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(Gn(ea,t.worldTransform),$n(ea,e.scrollWorldTransform),i?ea:Object.assign({},ea)),drop(t,e,i,s){t.setTransform(ra.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||ra.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,e,i=.3){if(e.x||e.y)if(Math.abs(e.x)<1&&Math.abs(e.y)<1)t.move(e);else{const s=e.x*i,r=e.y*i;e.x-=s,e.y-=r,t.move(s,r),y.requestRender(()=>ra.animateMove(t,e,i))}}},ra=sa,{updateAllMatrix:na,updateMatrix:aa,updateAllWorldOpacity:oa,updateAllChange:ha,updateChange:la}=ra;function da(t,e){return t.updateLayout(),t.parent?ht.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const ca={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)=>_a(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>_a(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>_a(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 ua;function _a(t,e){return e||(ua=0),t.__.mask&&(ua=1),ua<0?null:(ua&&(ua=-1),!0)}const{updateBounds:pa}=sa,ga={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:i}=t;for(let s=0,r=i.length;s<r;s++)(t=i[s]).isBranch&&(t.__tempNumber=1,e.add(t),fa(t,e))}},pushAllParent(t,e){const{keys:i}=e;if(i)for(;t.parent&&s(i[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 i=e.length;const{children:s}=t;for(let t=0,i=s.length;t<i;t++)s[t].isBranch&&e.push(s[t]);for(let t=i,s=e.length;t<s;t++)ya(e[t],e)},updateBounds(t,e){const i=[t];ya(t,i),ma(i,e)},updateBoundsByBranchStack(t,e){let i,s;for(let r=t.length-1;r>-1;r--){i=t[r],s=i.children;for(let t=0,e=s.length;t<e;t++)pa(s[t]);e&&e===i||pa(i)}}},{pushAllChildBranch:fa,pushAllBranchStack:ya,updateBoundsByBranchStack:ma}=ga,va={run(t){if(t&&t.length){const e=t.length;for(let i=0;i<e;i++)t[i]();t.length===e?t.length=0:t.splice(0,e)}}},{getRelativeWorld:xa,updateBounds:wa}=sa,{toOuterOf:ba,getPoints:Ea,copy:Pa}=Yt,Ba="_localContentBounds",ka="_worldContentBounds",Sa="_worldBoxBounds",Ra="_worldStrokeBounds";class Ca{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 ba(this.contentBounds,this.leaf.__localMatrix,this[Ba]||(this[Ba]={})),this[Ba]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return ba(this.contentBounds,this.leaf.__world,this[ka]||(this[ka]={})),this[ka]}get worldBoxBounds(){return ba(this.boxBounds,this.leaf.__world,this[Sa]||(this[Sa]={})),this[Sa]}get worldStrokeBounds(){return ba(this.strokeBounds,this.leaf.__world,this[Ra]||(this[Ra]={})),this[Ra]}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:e}=t;if(t.isApp)return wa(t);if(e)e.ready?e.watcher.changed&&e.layouter.layout():e.start();else{let e=t;for(;e.parent&&!e.parent.leafer;)e=e.parent;const i=e;if(i.__fullLayouting)return;i.__fullLayouting=!0,y.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 Q.defaultMatrix;case"page":t=e.zoomLayer;default:return xa(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 Gt(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",i){const{leaf:s}=this;let r,n,a,o=this.getInnerBounds(t);switch(e){case"world":r=s.getWorldPoint(o),n=s.__world;break;case"local":const{scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d}=s.__;a={scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d},r=s.getLocalPointByInner(o);break;case"inner":r=o,n=Q.defaultMatrix;break;case"page":e=s.zoomLayer;default:r=s.getWorldPoint(o,e),n=xa(s,e,!0)}if(a||(a=Q.getLayout(n)),Pa(a,o),ht.copy(a,r),i){const{scaleX:t,scaleY:e}=a,i=Math.abs(t),s=Math.abs(e);1===i&&1===s||(a.scaleX/=i,a.scaleY/=s,a.width*=i,a.height*=s)}return a}getLayoutPoints(t,e="world"){const{leaf:i}=this,r=Ea(this.getInnerBounds(t));let n;switch(e){case"world":n=null;break;case"local":n=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:n=e}return s(n)||r.forEach(t=>i.innerToWorld(t,null,!1,n)),r}shrinkContent(){const{x:t,y:e,width:i,height:s}=this.boxBounds;this._contentBounds={x:t,y:e,width:i,height:s}}spreadStroke(){const{x:t,y:e,width:i,height:s}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:i,height:s},this._localStrokeBounds={x:t,y:e,width:i,height:s},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:i,height:s}=this.renderBounds;this._renderBounds={x:t,y:e,width:i,height:s},this._localRenderBounds={x:t,y:e,width:i,height:s}}shrinkContentCancel(){this._contentBounds=void 0}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this._strokeBounds=this.boxBounds,this._localStrokeBounds=this.leaf.__localBoxBounds,t&&this.spreadRenderCancel()}spreadRenderCancel(){this._renderBounds=this._strokeBounds,this._localRenderBounds=this._localStrokeBounds}boxChange(){this.boxChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange(),this.hitCanvasChanged=!0}localBoxChange(){this.localBoxChanged=!0,this.boundsChanged=!0}strokeChange(){this.strokeChanged=!0,this.strokeSpread||(this.strokeSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}renderChange(){this.renderChanged=!0,this.renderSpread||(this.renderSpread=1),this.boundsChanged=!0}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChange(),this.leaf.__local||this.createLocal()}matrixChange(){this.matrixChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=this.affectChildrenSort=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class Ta{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&y.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&y.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&y.event.stop(this.origin)}}class La extends Ta{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}La.ADD="child.add",La.REMOVE="child.remove",La.CREATED="created",La.MOUNTED="mounted",La.UNMOUNTED="unmounted",La.DESTROY="destroy";const Oa="property.scroll";class Ia extends Ta{constructor(t,e,i,s,r){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=r}}Ia.CHANGE="property.change",Ia.LEAFER_CHANGE="property.leafer_change",Ia.SCROLL=Oa;const Da={scrollX:Oa,scrollY:Oa};class Aa extends Ta{constructor(t,e){super(t),Object.assign(this,e)}}Aa.LOAD="image.load",Aa.LOADED="image.loaded",Aa.ERROR="image.error";class Ma extends Ta{static checkHas(t,e,i){"on"===i?e===Na?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(Wa)||t.hasEvent(Fa)||t.hasEvent(Ua),t.__hasWorldEvent=t.hasEvent(Na))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(Wa,t),"inner"===e&&t.emit(Fa,t)),t.emit(Ua,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(Na,this)}}Ma.RESIZE="bounds.resize",Ma.INNER="bounds.inner",Ma.LOCAL="bounds.local",Ma.WORLD="bounds.world";const{RESIZE:Wa,INNER:Fa,LOCAL:Ua,WORLD:Na}=Ma,za={};[Wa,Fa,Ua,Na].forEach(t=>za[t]=1);class Ya extends Ta{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){d(t)?(super(Ya.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!s(this.resizingKeys[t.innerId])}}Ya.RESIZE="resize";class Xa extends Ta{constructor(t,e){super(t),this.data=e}}Xa.REQUEST="watch.request",Xa.DATA="watch.data";class Ha extends Ta{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}Ha.REQUEST="layout.request",Ha.START="layout.start",Ha.BEFORE="layout.before",Ha.LAYOUT="layout",Ha.AFTER="layout.after",Ha.AGAIN="layout.again",Ha.END="layout.end";class ja extends Ta{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}ja.REQUEST="render.request",ja.CHILD_START="render.child_start",ja.CHILD_END="render.child_end",ja.START="render.start",ja.BEFORE="render.before",ja.RENDER="render",ja.AFTER="render.after",ja.AGAIN="render.again",ja.END="render.end",ja.NEXT="render.next";class Ga extends Ta{}Ga.START="leafer.start",Ga.BEFORE_READY="leafer.before_ready",Ga.READY="leafer.ready",Ga.AFTER_READY="leafer.after_ready",Ga.VIEW_READY="leafer.view_ready",Ga.VIEW_COMPLETED="leafer.view_completed",Ga.STOP="leafer.stop",Ga.RESTART="leafer.restart",Ga.END="leafer.end",Ga.UPDATE_MODE="leafer.update_mode",Ga.TRANSFORM="leafer.transform",Ga.MOVE="leafer.move",Ga.SCALE="leafer.scale",Ga.ROTATE="leafer.rotate",Ga.SKEW="leafer.skew";const{MOVE:Va,SCALE:Ka,ROTATE:qa,SKEW:Za}=Ga,Qa={x:Va,y:Va,scaleX:Ka,scaleY:Ka,rotation:qa,skewX:Za,skewY:Za},Ja={};class $a{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(l(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let i in t)l(e=t[i])?this.on(i,e[0],e[1]):this.on(i,e);return}let s,r,a;i&&("once"===i?r=!0:"boolean"==typeof i?s=i:(s=i.capture,r=i.once));const o=to(this,s,!0),h=n(t)?t.split(" "):t,d=r?{listener:e,once:r}:{listener:e};h.forEach(t=>{t&&(a=o[t],a?-1===a.findIndex(t=>t.listener===e)&&a.push(d):o[t]=[d],za[t]&&Ma.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=n(t)?t.split(" "):t;if(e){let t,r,n;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const a=to(this,t);s.forEach(t=>{t&&(r=a[t],r&&(n=r.findIndex(t=>t.listener===e),n>-1&&r.splice(n,1),r.length||delete a[t],za[t]&&Ma.checkHas(this,t,"off")))})}else{const{__bubbleMap:t,__captureMap:e}=this;s.forEach(i=>{t&&delete t[i],e&&delete e[i]})}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,i,s){return e?this.on(t,i?e=e.bind(i):e,s):l(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:s}}off_(t){if(!t)return;const e=l(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):l(t.type)&&t.type.forEach(e=>t.current.off(e[0],e[1],e[3])))}),e.length=0}once(t,e,i,s){if(!e)return l(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));d(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&de.has(t)&&(e=de.get(t,{type:t,target:this,current:this}));const s=to(this,i)[t];if(s){let r;for(let n=0,a=s.length;n<a&&!((r=s[n])&&(r.listener(e),r.once&&(this.off(t,r.listener,i),n--,a--),e&&e.isStopNow));n++);}this.syncEventer&&this.syncEventer.emitEvent(e,i)}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:i,__captureMap:r}=this,n=i&&i[t],a=r&&r[t];return!!(s(e)?n||a:e?a:n)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function to(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:Ja)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:Ja)}}const{on:eo,on_:io,off:so,off_:ro,once:no,emit:ao,emitEvent:oo,hasEvent:ho,destroy:lo}=$a.prototype,co={on:eo,on_:io,off:so,off_:ro,once:no,emit:ao,emitEvent:oo,hasEvent:ho,destroyEventer:lo},uo=Qt.get("setAttr"),_o={__setAttr(t,e,i){if(this.leaferIsCreated){const r=this.__.__getInput(t);if(!i||a(e)||s(e)||(uo.warn(this.innerName,t,e),e=void 0),d(e)||r!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new Ia(Ia.LEAFER_CHANGE,this,t,r,e));const i=Qa[t];i&&(this.emitEvent(new Ga(i,this)),this.emitEvent(new Ga(Ga.TRANSFORM,this)))}this.emitPropertyEvent(Ia.CHANGE,t,r,e);const i=Da[t];return i&&this.emitPropertyEvent(i,t,r,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,i,s){const r=new Ia(t,this,e,i,s);this.isLeafer||this.hasEvent(t)&&this.emitEvent(r),this.leafer.emitEvent(r)},__realSetAttr(t,e){const i=this.__;i[t]=e,this.__proxyData&&this.setProxyAttr(t,e),i.normalStyle&&(this.lockNormalStyle||s(i.normalStyle[t])||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:po,multiplyParent:go,translateInner:fo,defaultWorld:yo}=Q,{toPoint:mo,tempPoint:vo}=bt,xo={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:r}=this;go(this.__local||e,t?t.__scrollWorld||t.__world:yo,i,!!e.affectScaleOrRotation,r),s&&fo(Object.assign(s,i),r.scrollX,r.scrollY)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,i=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(po(e,i,null,null,t.affectRotation),t.scaleChanged=t.rotationChanged=void 0),e.e=i.x+i.offsetX,e.f=i.y+i.offsetY,(i.around||i.origin)&&(mo(i.around||i.origin,t.boxBounds,vo),fo(e,-vo.x,-vo.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:wo,updateAllMatrix:bo}=sa,{updateBounds:Eo}=ga,{toOuterOf:Po,copyAndSpread:Bo,copy:ko}=Yt,{toBounds:So}=Lr,Ro={__updateWorldBounds(){const{__layout:t,__world:e}=this;Po(t.renderBounds,e,e),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&Ma.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&Ma.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(),Po(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Po(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Po(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const i=this.__layout.boxBounds,s=this.__;s.__usePathBox?So(s.path,i):(i.x=0,i.y=0,i.width=s.width,i.height=s.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),bo(this),Eo(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(bo(this),Eo(this,this))):wo(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;Bo(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:i}=e;o(i)&&i<=0?ko(e.renderBounds,e.strokeBounds):Bo(e.renderBounds,e.boxBounds,i)}},Co={__render(t,e){if(e.shape)return this.__renderShape(t,e);if(this.__worldOpacity){const i=this.__;if(i.bright&&!e.topRendering)return e.topList.add(this);if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.dimOpacity&&!i.dimskip?i.opacity*e.dimOpacity:i.opacity,this.__.__single){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!0,!0);this.__draw(s,e,t),sa.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);Qt.showBounds&&Qt.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:To}=ca,Lo={__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 i=this.__;if(i.__useDim)if(i.dim)e.dimOpacity=!0===i.dim?.2:i.dim;else{if(i.bright&&!e.topRendering)return e.topList.add(this);i.dimskip&&e.dimOpacity&&(e.dimOpacity=0)}if(i.__single&&!this.isBranchLeaf){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!1,!0);this.__renderBranch(s,e);const r=this.__nowWorld;t.opacity=e.dimOpacity?i.opacity*e.dimOpacity:i.opacity,t.copyWorldByReset(s,r,r,i.__blendMode,!0),s.recycle(r)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:i}=this;for(let s=0,r=i.length;s<r;s++)To(i[s],e)||i[s].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,r=i.length;s<r;s++)To(i[s],e)||i[s].__clip(t,e)}}},Oo={},{LEAF:Io,create:Do}=v,{stintSet:Ao}=u,{toInnerPoint:Mo,toOuterPoint:Wo,multiplyParent:Fo}=Q,{toOuterOf:Uo}=Yt,{copy:No,move:zo}=ht,{moveLocal:Yo,zoomOfLocal:Xo,rotateOfLocal:Ho,skewOfLocal:jo,moveWorld:Go,zoomOfWorld:Vo,rotateOfWorld:Ko,skewOfWorld:qo,transform:Zo,transformWorld:Qo,setTransform:Jo,getFlipTransform:$o,getLocalOrigin:th,getRelativeWorld:eh,drop:ih}=sa;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 p}get __LayoutProcessor(){return Ca}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=Do(Io),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(La.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(La.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(La.MOUNTED,t,"once")}nextRender(t,e,i){this.leafer?this.leafer.nextRender(t,e,i):this.waitLeafer(()=>this.leafer.nextRender(t,e,i))}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(La.MOUNTED)):this.__emitLifeEvent(La.UNMOUNTED),this.isBranch){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__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){s(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=s(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:i}=this.__layout;t.clearRect(i.x,i.y,i.width,i.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,i=this.__world;return Fo(i,t.matrix,e,void 0,i),Uo(this.__layout.renderBounds,e,e),Ao(e,"half",i.half),Ao(e,"ignorePixelSnap",i.ignorePixelSnap),e}return this.__world}getClampRenderScale(){let{scaleX:t}=this.__nowWorld||this.__world;return t<0&&(t=-t),t>1?t:1}getRenderScaleData(t,e){let{scaleX:i,scaleY:s}=Qr.patternLocked?this.__world:this.__nowWorld;return t&&(i<0&&(i=-i),s<0&&(s=-s)),(!0===e||"zoom-in"===e&&i>1&&s>1)&&(i=s=1),Oo.scaleX=i,Oo.scaleY=s,Oo}getTransform(t){return this.__layout.getTransform(t||"local")}getBounds(t,e){return this.__layout.getBounds(t,e)}getLayoutBounds(t,e,i){return this.__layout.getLayoutBounds(t,e,i)}getLayoutPoints(t,e){return this.__layout.getLayoutPoints(t,e)}getWorldBounds(t,e,i){const s=e?eh(this,e):this.worldTransform,r=i?t:{};return Uo(t,s,r),r}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&No(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&No(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),Mo(this.scrollWorldTransform,t,e,i)}innerToWorld(t,e,i,s){Wo(this.scrollWorldTransform,t,e,i),s&&s.worldToInner(e||t,null,i)}getBoxPoint(t,e,i,s){return this.getBoxPointByInner(this.getInnerPoint(t,e,i,s),null,null,!0)}getBoxPointByInner(t,e,i,s){const r=s?t:Object.assign({},t),{x:n,y:a}=this.boxBounds;return zo(r,-n,-a),r}getInnerPoint(t,e,i,s){const r=s?t:{};return this.worldToInner(t,r,i,e),r}getInnerPointByBox(t,e,i,s){const r=s?t:Object.assign({},t),{x:n,y:a}=this.boxBounds;return zo(r,n,a),r}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const r=s?t:{};return this.worldToLocal(t,r,i,e),r}getLocalPointByInner(t,e,i,s){return this.getWorldPoint(t,this.parent,i,s)}getPagePoint(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getInnerPoint(t,e,i,s)}getWorldPoint(t,e,i,s){const r=s?t:{};return this.innerToWorld(t,r,i,e),r}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const r=s?t:{};return this.localToWorld(t,r,i,e),r}getWorldPointByPage(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,i,s)}setTransform(t,e,i){Jo(this,t,e,i)}transform(t,e,i){Zo(this,t,e,i)}move(t,e,i){Yo(this,t,e,i)}moveInner(t,e,i){Go(this,t,e,!0,i)}scaleOf(t,e,i,s,r){Xo(this,th(this,t),e,i,s,r)}rotateOf(t,e,i){Ho(this,th(this,t),e,i)}skewOf(t,e,i,s,r){jo(this,th(this,t),e,i,s,r)}transformWorld(t,e,i){Qo(this,t,e,i)}moveWorld(t,e,i){Go(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,r){Vo(this,t,e,i,s,r)}rotateOfWorld(t,e){Ko(this,t,e)}skewOfWorld(t,e,i,s,r){qo(this,t,e,i,s,r)}flip(t,e){Zo(this,$o(this,t),!1,e)}scaleResize(t,e=t,i){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,i){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return re.need("path")}getMotionPoint(t){return re.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,i){ih(this,t,e,i)}on(t,e,i){}off(t,e,i){}on_(t,e,i,s){}off_(t){}once(t,e,i,s){}emit(t,e,i){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,i){i?this.addAttr(t,e,i):Mn(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=gn),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new La(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(La.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}},t.Leaf=_e([Xn(_o),Xn(xo),Xn(Ro),Xn(co),Xn(Co)],t.Leaf);const{setListWithFn:sh}=Yt,{sort:rh}=ga,{localBoxBounds:nh,localStrokeBounds:ah,localRenderBounds:oh,maskLocalBoxBounds:hh,maskLocalStrokeBounds:lh,maskLocalRenderBounds:dh}=ca,ch=new Qt("Branch");t.Branch=class extends t.Leaf{__updateStrokeSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(t,e){sh(e||this.__layout.boxBounds,this.children,this.__hasMask?hh:nh)}__updateStrokeBounds(t){sh(t||this.__layout.strokeBounds,this.children,this.__hasMask?lh:ah)}__updateRenderBounds(t){sh(t||this.__layout.renderBounds,this.children,this.__hasMask?dh:oh)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let i=0,s=e.length;i<s;i++)e[i].__tempNumber=i,e[i].__.zIndex&&(t=!0);e.sort(rh),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return ch.warn("add self or destroyed");const i=s(e);if(!t.__){if(l(t))return t.forEach(t=>{this.add(t,e),i||e++});t=oe.get(t.tag,t)}t.parent&&t.parent.remove(t),t.parent=this,i?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const r=t.__layout;r.boxChanged||r.boxChange(),r.matrixChanged||r.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(La.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(La.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)):s(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 i=this.children.indexOf(t);i>-1&&(this.children.splice(i,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(La.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(La.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new La(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}},t.Branch=_e([Xn(Lo)],t.Branch);class uh{get length(){return this.list.length}constructor(t){this.reset(),t&&(l(t)?this.addList(t):this.add(t))}has(t){return t&&!s(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return s(e)?-1:e}add(t){const{list:e,keys:i}=this;s(i[t.innerId])&&(e.push(t),i[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:i}=this;if(s(i[t.innerId])){const{list:s}=this;for(let t=e,r=s.length;t<r;t++)i[s[t].innerId]++;0===e?s.unshift(t):(e>s.length&&(e=s.length),s.splice(e,0,t)),i[t.innerId]=e}}addList(t){for(let e=0;e<t.length;e++)this.add(t[e])}remove(t){const{list:e}=this;let i;for(let r=0,n=e.length;r<n;r++)s(i)?e[r].innerId===t.innerId&&(i=r,delete this.keys[t.innerId]):this.keys[e[r].innerId]=r-1;s(i)||e.splice(i,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 uh;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let i=0,s=t.length;i<s;i++)e[t[i].innerId]=i}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class _h{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(l(t)?this.addList(t):this.add(t))}has(t){return!s(this.keys[t.innerId])}without(t){return s(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:i}=this;e[t.innerId]||(e[t.innerId]=1,i[t.__level]?i[t.__level].push(t):(i[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(i=>{e=this.levelMap[i];for(let i=0,s=e.length;i<s;i++)t(e[i])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}class ph extends Re{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=y.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i),this.clientBounds=this.bounds}}Yr(OffscreenCanvasRenderingContext2D.prototype),Yr(Path2D.prototype);const{mineType:gh}=Xr;function fh(t,e){y.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise((s,r)=>{t.convertToBlob({type:gh(e),quality:i}).then(t=>{var e=new FileReader;e.onload=t=>s(t.target.result),e.onerror=t=>r(t),e.readAsDataURL(t)}).catch(t=>{r(t)})}),canvasToBolb:(t,e,i)=>t.convertToBlob({type:gh(e),quality:i}),canvasSaveAs:(t,e,i)=>new Promise(t=>t()),download(t,e){},loadImage:t=>new Promise((e,i)=>{let s=new XMLHttpRequest;s.open("GET",y.image.getRealURL(t),!0),s.responseType="blob",s.onload=()=>{createImageBitmap(s.response).then(t=>{e(t)}).catch(t=>{i(t)})},s.onerror=t=>i(t),s.send()})},y.canvas=ne.canvas(),y.conicGradientSupport=!!y.canvas.context.createConicGradient}Object.assign(ne,{canvas:(t,e)=>new ph(t,e),image:t=>new en(t)}),y.name="web",y.isWorker=!0,y.backgrounder=!0,y.requestRender=function(t){requestAnimationFrame(t)},sn(y,"devicePixelRatio",{get:()=>1});const{userAgent:yh}=navigator;yh.indexOf("Firefox")>-1?(y.conicGradientRotate90=!0,y.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(y.fullImageShadow=!0),yh.indexOf("Windows")>-1?(y.os="Windows",y.intWheelDeltaY=!0):yh.indexOf("Mac")>-1?y.os="Mac":yh.indexOf("Linux")>-1&&(y.os="Linux");class mh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new uh;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 uh,this.target=t,e&&(this.config=u.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(ja.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===La.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,i=e.length;t<i;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new Xa(Xa.DATA,{updatedList:this.updatedList})),this.__updatedList=new uh,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[Ia.CHANGE,this.__onAttrChange,this],[[La.ADD,La.REMOVE],this.__onChildEvent,this],[Xa.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:vh,updateBounds:xh,updateChange:wh}=sa,{pushAllChildBranch:bh,pushAllParent:Eh}=ga;const{worldBounds:Ph}=ca;class Bh{constructor(t){this.updatedBounds=new Gt,this.beforeBounds=new Gt,this.afterBounds=new Gt,l(t)&&(t=new uh(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Ph)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Ph),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:kh,updateAllChange:Sh}=sa,Rh=Qt.get("Layouter");class Ch{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new _h,this.target=t,e&&(this.config=u.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(Ha.START),this.layoutOnce(),t.emitEvent(new Ha(Ha.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(Xa.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=ee.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:r,LAYOUT:n,AFTER:a}=Ha,o=this.getBlocks(s);o.forEach(t=>t.setBefore()),i.emitEvent(new Ha(r,o,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach(t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(vh(t,!0),e.add(t),t.isBranch&&bh(t,e),Eh(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Eh(t,e)))})}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(r=>{e=t.levelMap[r];for(let t=0,r=e.length;t<r;t++){if(i=e[t],i.isBranch&&i.__tempNumber){s=i.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||xh(s[t])}xh(i)}})}(this.__levelList),function(t){t.list.forEach(wh)}(s),this.extraBlock&&o.push(this.extraBlock),o.forEach(t=>t.setAfter()),i.emitEvent(new Ha(n,o,this.times)),i.emitEvent(new Ha(a,o,this.times)),this.addBlocks(o),this.__levelList.reset(),this.__updatedList=null,ee.end(e)}fullLayout(){const t=ee.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:r}=Ha,n=this.getBlocks(new uh(e));e.emitEvent(new Ha(i,n,this.times)),Ch.fullLayout(e),n.forEach(t=>{t.setAfter()}),e.emitEvent(new Ha(s,n,this.times)),e.emitEvent(new Ha(r,n,this.times)),this.addBlocks(n),ee.end(t)}static fullLayout(t){kh(t,!0),t.isBranch?ga.updateBounds(t):sa.updateBounds(t),Sh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Bh([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Bh(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_([[Ha.REQUEST,this.layout,this],[Ha.AGAIN,this.layoutAgain,this],[Xa.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Th=Qt.get("Renderer");class Lh{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,i&&(this.config=u.default(i,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(Ha.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(ja.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(ja.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(ja.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new Gt,Th.log(e.innerName,"---\x3e");try{this.emitRender(ja.START),this.renderOnce(t),this.emitRender(ja.END,this.totalBounds),Qr.clearRecycled()}catch(t){this.rendering=!1,Th.error(t)}Th.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Th.warn("rendering");if(this.times>3)return Th.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Gt,this.renderOptions={},t)this.emitRender(ja.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(ja.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(ja.RENDER,this.renderBounds,this.renderOptions),this.emitRender(ja.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=ee.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),r=new Gt(s);i.save(),s.spread(Lh.clipSpread).ceil(),i.clearWorld(s),i.clipWorld(s),this.__render(s,r),i.restore(),ee.end(e)}fullRender(){const t=ee.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),ee.end(t)}__render(t,e){const{canvas:i}=this,s=t.includes(this.target.__world),r=s?{includes:s}:{bounds:t,includes:s};this.needFill&&i.fillWorld(t,this.config.fill),Qt.showRepaint&&Qt.drawRepaint(i,t),y.render(this.target,i,r),this.renderBounds=e=e||t,this.renderOptions=r,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new Gt;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const e=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:i}=this.config;if(i&&t>i)return y.requestRender(e);const{frames:s}=this;s.length>30&&s.shift(),s.push(t),this.FPS=Math.round(s.reduce((t,e)=>t+e,0)/s.length),this.requestTime=0,this.checkRender()};y.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new Gt(0,0,e,i).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new Gt(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||Th.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,e,i){this.target.emitEvent(new ja(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[ja.REQUEST,this.update,this],[Ha.END,this.__onLayoutEnd,this],[ja.AGAIN,this.renderAgain,this],[Ya.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}Lh.clipSpread=10;const{hitRadiusPoint:Oh}=Yt;class Ih{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,r=i.ignoreHittable||!1,n=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new uh(i.findList),i.findList||this.hitBranch(n.isBranchLeaf?{children:[n]}:n);const{list:a}=this.findList,o=this.getBestMatchLeaf(a,i.bottomList,r,!!i.findList),h=r?this.getPath(o):this.getHitablePath(o);return this.clear(),s?{path:h,target:o,throughPath:a.length?this.getThroughPath(a):h}:{path:h,target:o}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(t,e,i,s){const r=this.findList=new uh;if(t.length){let e;const{x:s,y:n}=this.point,a={x:s,y:n,radiusX:0,radiusY:0};for(let s=0,n=t.length;s<n;s++)if(e=t[s],(i||sa.worldHittable(e))&&(this.hitChild(e,a),r.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&sa.hasParent(t,e))){r.reset();break}return r.list[0]}}if(e)for(let t=0,i=e.length;t<i;t++)if(this.hitChild(e[t].target,this.point,e[t].proxy),r.length)return r.list[0];return s?null:i?t[0]:t.find(t=>sa.worldHittable(t))}getPath(t){const e=new uh,i=[],{target:s}=this;for(;t&&(t.syncEventer&&i.push(t.syncEventer),e.add(t),(t=t.parent)!==s););return i.length&&i.forEach(t=>{for(;t&&(t.__.hittable&&e.add(t),(t=t.parent)!==s););}),s&&e.add(s),e}getHitablePath(t){const e=this.getPath(t&&t.hittable?t:null);let i,s=new uh;for(let t=e.list.length-1;t>-1&&(i=e.list[t],i.__.hittable)&&(s.addAt(i,0),i.__.hitChildren&&(!i.isLeafer||"draw"!==i.mode));t--);return s}getThroughPath(t){const e=new uh,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,r,n;for(let t=0,a=i.length;t<a;t++){s=i[t],r=i[t+1];for(let t=0,i=s.length;t<i&&(n=s.list[t],!r||!r.has(n));t++)e.add(n)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s;const{point:r}=this;for(let n=t.length-1;n>-1;n--)if(i=t[n],i.__.visible&&(!e||i.__.mask))if(s=!!i.__.hitRadius||Oh(i.__world,r),i.isBranch){if(s||i.__ignoreHitWorld){if(i.isBranchLeaf&&i.__.__clipAfterFill&&!i.__hitWorld(r))continue;i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,r)}}else s&&this.hitChild(i,r)}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask){let i,r=[];const{children:n}=s;for(let s=0,a=n.length;s<a;s++)if(i=n[s],i.__.mask&&r.push(i),i===t){if(r&&!r.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class Dh{constructor(t,e){this.config={},e&&(this.config=u.default(e,this.config)),this.picker=new Ih(this.target=t,this),this.finder=ne.finder&&ne.finder()}getByPoint(t,e,i){const{target:s,picker:r}=this;return y.backgrounder&&s&&s.updateLayout(),r.getByPoint(t,e,i)}hitPoint(t,e,i){return this.picker.hitPoint(t,e,i)}getBy(t,e,i,s){return this.finder?this.finder.getBy(t,e,i,s):re.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Ah(t){return an(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Mh(t){return an(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Wh(){return(t,e)=>{const i="_"+e;sn(t,e,{set(t){this.isLeafer&&(this[i]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[i]||this:this.leafer&&this.leafer.zoomLayer}})}}Object.assign(ne,{watcher:(t,e)=>new mh(t,e),layouter:(t,e)=>new Ch(t,e),renderer:(t,e,i)=>new Lh(t,e,i),selector:(t,e)=>new Dh(t,e)}),y.layout=Ch.fullLayout,y.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new uh,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const Fh={},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}},Nh={number:(t,e)=>d(t)?"percent"===t.type?t.value*e:t.value:t},zh={},Yh={},Xh={},Hh={},jh={},Gh={apply(){re.need("filter")}},Vh={},Kh={setStyleName:()=>re.need("state"),set:()=>re.need("state")},qh={list:{},register(t,e){qh.list[t]=e},get:t=>qh.list[t]},{parse:Zh,objectToCanvasData:Qh}=Ji,{stintSet:Jh}=u,{hasTransparent:$h}=Uh,tl={originPaint:{}},el=Qt.get("UIData");class il extends p{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,el.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,el.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),n(t)||!t?(Jh(this,"__isTransparentFill",$h(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):d(t)&&this.__setPaint("fill",t)}setStroke(t){n(t)||!t?(Jh(this,"__isTransparentStroke",$h(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):d(t)&&this.__setPaint("stroke",t)}setPath(t){const e=n(t);e||t&&d(t[0])?(this.__setInput("path",t),this._path=e?Zh(t):Qh(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){sl(this,"shadow",t)}setInnerShadow(t){sl(this,"innerShadow",t)}setFilter(t){sl(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Yh.compute("fill",this.__leaf),e&&Yh.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),s(t.strokeWidthFixed)||(i=t.strokeWidthFixed)),i){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),l(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=tl)):(this.__isStrokes=!0,this._stroke||(this._stroke=tl))}__removePaint(t,e){e&&this.__removeInput(t),Xh.recycleImage(t,this),"fill"===t?(Jh(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(Jh(this,"__isAlphaPixelStroke",void 0),Jh(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function sl(t,e,i){t.__setInput(e,i),l(i)?(i.some(t=>!1===t.visible)&&(i=i.filter(t=>!1!==t.visible)),i.length||(i=void 0)):i=i&&!1!==i.visible?[i]:void 0,t["_"+e]=i}class rl extends il{}class nl extends rl{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 al extends rl{__getInputData(t,e){const i=super.__getInputData(t,e);return Se.forEach(t=>delete i[t]),i}}class ol extends nl{}class hl extends il{get __usePathBox(){return this.points||this.__pathInputed}}class ll extends il{get __boxStroke(){return!this.__pathInputed}}class dl extends il{get __boxStroke(){return!this.__pathInputed}}class cl extends hl{}class ul extends il{}class _l extends il{get __pathInputed(){return 2}}class pl extends rl{}const gl={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class fl extends il{get __useNaturalRatio(){return!1}setFontWeight(t){n(t)?(this.__setInput("fontWeight",t),t=gl[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(t){let e=this.__leaf,i=e.__box;if(t){const{boxStyle:s}=this;if(i)for(let t in s)i[t]=void 0;else i=e.__box=oe.get("Rect",0);const r=e.__layout,n=i.__layout;s||(i.parent=e,i.__world=e.__world,n.boxBounds=r.boxBounds),i.set(t),n.strokeChanged&&r.strokeChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}}class yl extends ll{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:"image",mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return t.url&&delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url&&delete i.fill,i}}class ml extends ll{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url=this.__leaf.canvas.toDataURL("image/png"),i}}const{max:vl,add:xl}=k,wl={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:r}=i,n=this.__box;if((i.stroke||"all"===i.hitStroke)&&r&&"inside"!==s&&(e=t="center"===s?r/2:r,!i.__boxStroke)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:r;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*r),n&&(t=vl(t,n.__layout.strokeSpread=n.__updateStrokeSpread()),e=Math.max(e,n.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:r,filter:n,renderSpread:a}=this.__,{strokeSpread:o}=this.__layout,h=this.__box;e&&(t=jh.getShadowRenderSpread(this,e)),s&&(t=vl(t,s)),n&&(t=xl(t,Gh.getSpread(n))),a&&(t=xl(t,a)),o&&(t=xl(t,o));let l=t;return i&&(l=vl(l,jh.getInnerShadowSpread(this,i))),r&&(l=vl(l,r)),this.__layout.renderShapeSpread=l,h?vl(h.__updateRenderSpread(),t):t}},{stintSet:bl}=u,El={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);bl(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),bl(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,r=t.innerShadow||t.blur||t.backgroundBlur||t.filter;bl(t,"__isFastShadow",e&&!r&&e.length<2&&!e[0].spread&&!jh.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(l(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!r)}t.__checkSingle(),bl(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){Pl(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:r,stroke:n,__drawAfterFill:a,__fillAfterStroke:o,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=Yh.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&jh.shadow(this,t,h),o&&(s.__isStrokes?Yh.strokes(n,this,t,e):Yh.stroke(n,this,t,e)),r&&(s.__isFills?Yh.fills(r,this,t,e):Yh.fill(r,this,t,e)),a&&this.__drawAfterFill(t,e),d&&jh.innerShadow(this,t,h),n&&!o&&(s.__isStrokes?Yh.strokes(n,this,t,e):Yh.stroke(n,this,t,e)),c&&Gh.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(o&&(s.__isStrokes?Yh.strokes(n,this,t,e):Yh.stroke(n,this,t,e)),h){const e=s.shadow[0],{scaleX:i,scaleY:r}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*r,e.blur*i,Uh.string(e.color))}r&&(s.__isFills?Yh.fills(r,this,t,e):Yh.fill(r,this,t,e)),h&&t.restore(),a&&this.__drawAfterFill(t,e),n&&!o&&(s.__isStrokes?Yh.strokes(n,this,t,e):Yh.stroke(n,this,t,e))}}else s.__pathInputed?Pl(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:r}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?Yh.fills(s,this,t,e):Yh.fill("#000000",this,t,e)),i.__isCanvas&&this.__drawAfterFill(t,e),r&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?Yh.strokes(r,this,t,e):Yh.stroke("#000000",this,t,e))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function Pl(t,e,i){const{fill:s,stroke:r,__drawAfterFill:n,__fillAfterStroke:a}=t.__;t.__drawRenderPath(e),a&&Yh.stroke(r,t,e,i),s&&Yh.fill(s,t,e,i),n&&t.__drawAfterFill(e,i),r&&!a&&Yh.stroke(r,t,e,i)}const Bl={__drawFast(t,e){let{x:i,y:s,width:r,height:n}=this.__layout.boxBounds;const{fill:a,stroke:o,__drawAfterFill:h}=this.__;if(a&&(t.fillStyle=a,t.fillRect(i,s,r,n)),h&&this.__drawAfterFill(t,e),o){const{strokeAlign:a,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(o,h,this.__);const l=h/2;switch(a){case"center":t.strokeRect(0,0,r,n);break;case"inside":r-=h,n-=h,r<0||n<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,r,n),t.restore()):t.strokeRect(i+l,s+l,r,n);break;case"outside":t.strokeRect(i-l,s-l,r+h,n+h)}}}};var kl,Sl;t.UI=kl=class extends t.Leaf{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){M.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 Nr.set(this.path=t||[]),t||this.__drawPathByBox(Nr),Nr}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return n(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return re.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return re.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(Nr.set(i=[]),this.__drawPathByBox(Nr)),t?Ji.toCanvasData(i,!0):i}getPathString(t,e,i){return Ji.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||Vh.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?Fr.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&zh.addArrows(this)):t.__pathForRender&&(t.__pathForRender=void 0)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){e?$s.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:i,width:s,height:r}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:n}=this.__;t.roundRect(e,i,s,r,o(n)?[n]:n)}else t.rect(e,i,s,r)}drawImagePlaceholder(t,e,i){Yh.fill(this.__.placeholderColor,this,e,i)}animate(t,e,i,s){return this.set(t),re.need("animate")}killAnimate(t,e){}export(t,e){return re.need("export")}syncExport(t,e){return re.need("export")}clone(t){const e=u.clone(this.toJSON());return t&&Object.assign(e,t),kl.one(e)}static one(t,e,i,s,r){return oe.get(t.tag||this.prototype.__tag,t,e,i,s,r)}static registerUI(){Hn()(this)}static registerData(t){An(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}},_e([An(il)],t.UI.prototype,"__",void 0),_e([Wh()],t.UI.prototype,"zoomLayer",void 0),_e([ln("")],t.UI.prototype,"id",void 0),_e([ln("")],t.UI.prototype,"name",void 0),_e([ln("")],t.UI.prototype,"className",void 0),_e([Pn("pass-through")],t.UI.prototype,"blendMode",void 0),_e([kn(1)],t.UI.prototype,"opacity",void 0),_e([Sn(!0)],t.UI.prototype,"visible",void 0),_e([Pn(!1)],t.UI.prototype,"locked",void 0),_e([Bn(!1)],t.UI.prototype,"dim",void 0),_e([Bn(!1)],t.UI.prototype,"dimskip",void 0),_e([Tn(0)],t.UI.prototype,"zIndex",void 0),_e([Ln(!1)],t.UI.prototype,"mask",void 0),_e([On(!1)],t.UI.prototype,"eraser",void 0),_e([dn(0,!0)],t.UI.prototype,"x",void 0),_e([dn(0,!0)],t.UI.prototype,"y",void 0),_e([gn(100,!0)],t.UI.prototype,"width",void 0),_e([gn(100,!0)],t.UI.prototype,"height",void 0),_e([_n(1,!0)],t.UI.prototype,"scaleX",void 0),_e([_n(1,!0)],t.UI.prototype,"scaleY",void 0),_e([pn(0,!0)],t.UI.prototype,"rotation",void 0),_e([pn(0,!0)],t.UI.prototype,"skewX",void 0),_e([pn(0,!0)],t.UI.prototype,"skewY",void 0),_e([dn(0,!0)],t.UI.prototype,"offsetX",void 0),_e([dn(0,!0)],t.UI.prototype,"offsetY",void 0),_e([cn(0,!0)],t.UI.prototype,"scrollX",void 0),_e([cn(0,!0)],t.UI.prototype,"scrollY",void 0),_e([un()],t.UI.prototype,"origin",void 0),_e([un()],t.UI.prototype,"around",void 0),_e([ln(!1)],t.UI.prototype,"lazy",void 0),_e([fn(1)],t.UI.prototype,"pixelRatio",void 0),_e([En(0)],t.UI.prototype,"renderSpread",void 0),_e([mn()],t.UI.prototype,"path",void 0),_e([vn()],t.UI.prototype,"windingRule",void 0),_e([vn(!0)],t.UI.prototype,"closed",void 0),_e([gn(0)],t.UI.prototype,"padding",void 0),_e([gn(!1)],t.UI.prototype,"lockRatio",void 0),_e([gn()],t.UI.prototype,"widthRange",void 0),_e([gn()],t.UI.prototype,"heightRange",void 0),_e([ln(!1)],t.UI.prototype,"draggable",void 0),_e([ln()],t.UI.prototype,"dragBounds",void 0),_e([ln("auto")],t.UI.prototype,"dragBoundsType",void 0),_e([ln(!1)],t.UI.prototype,"editable",void 0),_e([In(!0)],t.UI.prototype,"hittable",void 0),_e([In("path")],t.UI.prototype,"hitFill",void 0),_e([bn("path")],t.UI.prototype,"hitStroke",void 0),_e([In(!1)],t.UI.prototype,"hitBox",void 0),_e([In(!0)],t.UI.prototype,"hitChildren",void 0),_e([In(!0)],t.UI.prototype,"hitSelf",void 0),_e([In()],t.UI.prototype,"hitRadius",void 0),_e([Dn("")],t.UI.prototype,"cursor",void 0),_e([Pn()],t.UI.prototype,"fill",void 0),_e([bn(void 0,!0)],t.UI.prototype,"stroke",void 0),_e([bn("inside")],t.UI.prototype,"strokeAlign",void 0),_e([bn(1,!0)],t.UI.prototype,"strokeWidth",void 0),_e([bn(!1)],t.UI.prototype,"strokeWidthFixed",void 0),_e([bn("none")],t.UI.prototype,"strokeCap",void 0),_e([bn("miter")],t.UI.prototype,"strokeJoin",void 0),_e([bn()],t.UI.prototype,"dashPattern",void 0),_e([bn(0)],t.UI.prototype,"dashOffset",void 0),_e([bn(10)],t.UI.prototype,"miterLimit",void 0),_e([vn(0)],t.UI.prototype,"cornerRadius",void 0),_e([vn()],t.UI.prototype,"cornerSmoothing",void 0),_e([Ah()],t.UI.prototype,"shadow",void 0),_e([Ah()],t.UI.prototype,"innerShadow",void 0),_e([Ah()],t.UI.prototype,"blur",void 0),_e([Ah()],t.UI.prototype,"backgroundBlur",void 0),_e([Ah()],t.UI.prototype,"grayscale",void 0),_e([Ah()],t.UI.prototype,"filter",void 0),_e([Pn()],t.UI.prototype,"placeholderColor",void 0),_e([ln(100)],t.UI.prototype,"placeholderDelay",void 0),_e([ln({})],t.UI.prototype,"data",void 0),_e([Nn(t.Leaf.prototype.reset)],t.UI.prototype,"reset",null),t.UI=kl=_e([Xn(wl),Xn(El),zn()],t.UI),t.Group=class extends t.UI{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}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(){}},_e([An(rl)],t.Group.prototype,"__",void 0),_e([gn(0)],t.Group.prototype,"width",void 0),_e([gn(0)],t.Group.prototype,"height",void 0),t.Group=_e([Xn(t.Branch),Hn()],t.Group);const Rl=Qt.get("Leafer");t.Leafer=Sl=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&&qr.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),Sl.list.add(this)}init(t,e){if(this.canvas)return;let i;const{config:s}=this;this.__setLeafer(this),e&&(this.parentApp=e,this.__bindApp(e),i=e.running),t&&(this.parent=e,this.initType(t.type),this.parent=void 0,u.assign(s,t));const r=this.canvas=ne.canvas(s);this.__controllers.push(this.renderer=ne.renderer(this,r,s),this.watcher=ne.watcher(this,s),this.layouter=ne.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),this.view=r.view,e||(this.selector=ne.selector(this),this.interaction=ne.interaction(this,r,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=ne.hitCanvasManager()),this.canvasManager=new ue,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(r),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),va.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(Ga.RESTART):this.emitLeafer(Ga.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(Ga.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=u.copyAttrs({},t,Se);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new Gt(t):this.canvas.bounds),this.viewReady&&(e?i.render():i.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 i=u.copyAttrs({},this.canvas,Se);e.resize(t),this.updateLazyBounds(),this.__onResize(new Ya(t,i))}__onResize(t){this.emitEvent(t),u.copyAttrs(this.__,t,Se),setTimeout(()=>{this.canvasManager&&this.canvasManager.clearRecycled()},0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager}__setLeafer(t){this.leafer=t,this.__level=1}__checkAutoLayout(){const{config:t,parentApp:e}=this;e||(t.width&&t.height||(this.autoLayout=new Kt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(Se.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t?this.parent||(this.canvas.hittable=e):"zIndex"===t?(this.canvas.zIndex=e,setTimeout(()=>this.parent&&this.parent.__updateSortChildren())):"mode"===t&&this.emit(Ga.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&Se.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,r=u.copyAttrs({},s,Se);r[t]=i[t]=e,i.width&&i.height?s.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(r)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.backgroundColor=t:this.forceRender()}__onCreated(){this.created=!0}__onReady(){this.ready=!0,this.emitLeafer(Ga.BEFORE_READY),this.emitLeafer(Ga.READY),this.emitLeafer(Ga.AFTER_READY),va.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(Ga.VIEW_READY),va.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:r,pixelRatio:n}=this;const a="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,a.x+a.width)),i||(r=Math.max(1,a.y+a.height)),this.__doResize({width:s,height:r,pixelRatio:n})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){va.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(Ga.VIEW_COMPLETED),va.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,i){e&&(t=t.bind(e));const s=this.__nextRenderWait;if(i){for(let e=0;e<s.length;e++)if(s[e]===t){s.splice(e,1);break}}else s.push(t);this.requestRender()}zoom(t,e,i,s){return re.need("view")}getValidMove(t,e,i){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:i}=this.clientBounds;return{x:e+t.x,y:i+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(t){this.emitEvent(new Ga(t,this))}__listenEvents(){const t=ee.start("FirstCreate "+this.innerName);this.once([[Ga.START,()=>ee.end(t)],[Ha.START,this.updateLazyBounds,this],[ja.START,this.__onCreated,this],[ja.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Xa.DATA,this.__onWatchData,this],[Ha.END,this.__onLayoutEnd,this],[ja.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Sl.list.remove(this);try{this.stop(),this.emitLeafer(Ga.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{Qr.clearRecycled()},100)}catch(t){Rl.error(t)}}};t?e():setTimeout(e)}},t.Leafer.list=new uh,_e([An(al)],t.Leafer.prototype,"__",void 0),_e([gn()],t.Leafer.prototype,"pixelRatio",void 0),_e([ln("normal")],t.Leafer.prototype,"mode",void 0),t.Leafer=Sl=_e([Hn()],t.Leafer),t.Rect=class extends t.UI{get __tag(){return"Rect"}},_e([An(ll)],t.Rect.prototype,"__",void 0),t.Rect=_e([Xn(Bl),zn(),Hn()],t.Rect);const{add:Cl,includes:Tl,scroll:Ll}=Yt,Ol=t.Rect.prototype,Il=t.Group.prototype;t.Box=class extends t.Group{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const i=this.__,s=this.__layout,{renderBounds:r,boxBounds:n}=s,{overflow:a}=i,o=s.childrenRenderBounds||(s.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(o),(e=a&&a.includes("scroll"))&&(Cl(o,n),Ll(o,i)),this.__updateRectRenderBounds(),t=!Tl(n,o),t&&"show"===a&&Cl(r,o)}else this.__updateRectRenderBounds();u.stintSet(this,"isOverflow",t),this.__checkScroll(e)}__updateRectRenderBounds(){}__checkScroll(t){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e)),this.hasScroller&&this.scroller.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}},_e([An(nl)],t.Box.prototype,"__",void 0),_e([gn(100)],t.Box.prototype,"width",void 0),_e([gn(100)],t.Box.prototype,"height",void 0),_e([ln(!1)],t.Box.prototype,"resizeChildren",void 0),_e([En("show")],t.Box.prototype,"overflow",void 0),_e([Nn(Ol.__updateStrokeSpread)],t.Box.prototype,"__updateStrokeSpread",null),_e([Nn(Ol.__updateRenderSpread)],t.Box.prototype,"__updateRectRenderSpread",null),_e([Nn(Ol.__updateBoxBounds)],t.Box.prototype,"__updateRectBoxBounds",null),_e([Nn(Ol.__updateStrokeBounds)],t.Box.prototype,"__updateStrokeBounds",null),_e([Nn(Ol.__updateRenderBounds)],t.Box.prototype,"__updateRectRenderBounds",null),_e([Nn(Ol.__updateChange)],t.Box.prototype,"__updateRectChange",null),_e([Nn(Ol.__render)],t.Box.prototype,"__renderRect",null),_e([Nn(Il.__render)],t.Box.prototype,"__renderGroup",null),t.Box=_e([zn(),Hn()],t.Box),t.Frame=class extends t.Box{get __tag(){return"Frame"}get isFrame(){return!0}},_e([An(ol)],t.Frame.prototype,"__",void 0),_e([Pn("#FFFFFF")],t.Frame.prototype,"fill",void 0),_e([En("hide")],t.Frame.prototype,"overflow",void 0),t.Frame=_e([Hn()],t.Frame);const{moveTo:Dl,closePath:Al,ellipse:Ml}=ws;t.Ellipse=class extends t.UI{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:e,innerRadius:i,startAngle:s,endAngle:r}=this.__,n=t/2,a=e/2,o=this.__.path=[];i?(s||r?(i<1&&Ml(o,n,a,n*i,a*i,0,s,r,!1),Ml(o,n,a,n,a,0,r,s,!0),i<1&&Al(o)):(i<1&&(Ml(o,n,a,n*i,a*i),Dl(o,t,a)),Ml(o,n,a,n,a,0,360,0,!0)),y.ellipseToCurve&&(this.__.path=this.getPath(!0))):s||r?(Dl(o,n,a),Ml(o,n,a,n,a,0,s,r,!1),Al(o)):Ml(o,n,a,n,a)}},_e([An(dl)],t.Ellipse.prototype,"__",void 0),_e([vn(0)],t.Ellipse.prototype,"innerRadius",void 0),_e([vn(0)],t.Ellipse.prototype,"startAngle",void 0),_e([vn(0)],t.Ellipse.prototype,"endAngle",void 0),t.Ellipse=_e([Hn()],t.Ellipse);const{sin:Wl,cos:Fl,PI:Ul}=Math,{moveTo:Nl,lineTo:zl,closePath:Yl,drawPoints:Xl}=ws;t.Polygon=class extends t.UI{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)Xl(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:r}=t,n=i/2,a=s/2;Nl(e,n,0);for(let t=1;t<r;t++)zl(e,n+n*Wl(2*t*Ul/r),a-a*Fl(2*t*Ul/r));Yl(e)}}},_e([An(cl)],t.Polygon.prototype,"__",void 0),_e([vn(3)],t.Polygon.prototype,"sides",void 0),_e([vn()],t.Polygon.prototype,"points",void 0),_e([vn(0)],t.Polygon.prototype,"curve",void 0),t.Polygon=_e([zn(),Hn()],t.Polygon);const{sin:Hl,cos:jl,PI:Gl}=Math,{moveTo:Vl,lineTo:Kl,closePath:ql}=ws;t.Star=class extends t.UI{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,r=t/2,n=e/2,a=this.__.path=[];Vl(a,r,0);for(let t=1;t<2*i;t++)Kl(a,r+(t%2==0?r:r*s)*Hl(t*Gl/i),n-(t%2==0?n:n*s)*jl(t*Gl/i));ql(a)}},_e([An(ul)],t.Star.prototype,"__",void 0),_e([vn(5)],t.Star.prototype,"corners",void 0),_e([vn(.382)],t.Star.prototype,"innerRadius",void 0),t.Star=_e([Hn()],t.Star);const{moveTo:Zl,lineTo:Ql,drawPoints:Jl}=ws,{rotate:$l,getAngle:td,getDistance:ed,defaultPoint:id}=ht;t.Line=class extends t.UI{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&$l(i,e),i}set toPoint(t){this.width=ed(id,t),this.rotation=td(id,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?Jl(e,t.points,t.curve,t.closed):(Zl(e,0,0),Ql(e,this.width,0))}},_e([An(hl)],t.Line.prototype,"__",void 0),_e([xn("center")],t.Line.prototype,"strokeAlign",void 0),_e([gn(0)],t.Line.prototype,"height",void 0),_e([vn()],t.Line.prototype,"points",void 0),_e([vn(0)],t.Line.prototype,"curve",void 0),_e([vn(!1)],t.Line.prototype,"closed",void 0),t.Line=_e([Hn()],t.Line),t.Image=class extends t.Rect{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return l(t)&&t[0].image}},_e([An(yl)],t.Image.prototype,"__",void 0),_e([gn("")],t.Image.prototype,"url",void 0),t.Image=_e([Hn()],t.Image);const sd=t.Image;t.Canvas=class extends t.Rect{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(t){super(t),this.canvas=ne.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new en({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new Aa(Aa.LOADED,{image:t}))})}draw(t,e,i,s){const r=new gt(t.worldTransform).invert(),n=new gt;e&&n.translate(e.x,e.y),i&&(o(i)?n.scale(i):n.scale(i.x,i.y)),s&&n.rotate(s),r.multiplyParent(n),t.__render(this.canvas,{matrix:r.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:r}=this.canvas;t.drawImage(r,0,0,r.width,r.height,0,0,i,s)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:i}=this.__;t.resize(this.__,i),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}},_e([An(ml)],t.Canvas.prototype,"__",void 0),_e([Mh(100)],t.Canvas.prototype,"width",void 0),_e([Mh(100)],t.Canvas.prototype,"height",void 0),_e([Mh(1)],t.Canvas.prototype,"pixelRatio",void 0),_e([Mh(!0)],t.Canvas.prototype,"smooth",void 0),_e([ln(!1)],t.Canvas.prototype,"safeResize",void 0),_e([Mh()],t.Canvas.prototype,"contextSettings",void 0),t.Canvas=_e([Hn()],t.Canvas);const{copyAndSpread:rd,includes:nd,spread:ad,setList:od}=Yt,{stintSet:hd}=u;t.Text=class extends t.UI{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}__updateTextDrawData(){const t=this.__,{lineHeight:e,letterSpacing:i,fontFamily:s,fontSize:r,fontWeight:n,italic:a,textCase:o,textOverflow:h,padding:l,width:d,height:c}=t;t.__lineHeight=Nh.number(e,r),t.__letterSpacing=Nh.number(i,r),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*r)/2,t.__font=`${a?"italic ":""}${"small-caps"===o?"small-caps ":""}${"normal"!==n?n+" ":""}${r||12}px ${s||"caption"}`,hd(t,"__padding",l&&M.fourNumber(l)),hd(t,"__clipText","show"!==h&&!t.__autoSize),hd(t,"__isCharMode",d||c||t.__letterSpacing||"none"!==o),t.__textDrawData=Fh.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:r,__autoWidth:n,__autoHeight:a}=t;this.__updateTextDrawData();const{bounds:o}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=o,t.__lineHeight<i&&ad(o,i/2),n||a){if(h.x=n?o.x:0,h.y=a?o.y:0,h.width=n?o.width:t.width,h.height=a?o.height:t.height,r){const[e,i,s,r]=t.__padding;n&&(h.x-=r,h.width+=i+r),a&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),u.stintSet(this,"isOverflow",!nd(h,o)),this.isOverflow?(od(t.__textBoxBounds={},[h,o]),e.renderChanged=!0):t.__textBoxBounds=h}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;rd(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__updateChange(){super.__updateChange();const t=this.__box;t&&(t.__onUpdateSize(),t.__updateChange())}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!e.exporting||super.__draw(t,e,i)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}},_e([An(fl)],t.Text.prototype,"__",void 0),_e([gn(0)],t.Text.prototype,"width",void 0),_e([gn(0)],t.Text.prototype,"height",void 0),_e([Pn()],t.Text.prototype,"boxStyle",void 0),_e([ln(!1)],t.Text.prototype,"resizeFontSize",void 0),_e([Pn("#000000")],t.Text.prototype,"fill",void 0),_e([xn("outside")],t.Text.prototype,"strokeAlign",void 0),_e([In("all")],t.Text.prototype,"hitFill",void 0),_e([gn("")],t.Text.prototype,"text",void 0),_e([gn("")],t.Text.prototype,"placeholder",void 0),_e([gn("caption")],t.Text.prototype,"fontFamily",void 0),_e([gn(12)],t.Text.prototype,"fontSize",void 0),_e([gn("normal")],t.Text.prototype,"fontWeight",void 0),_e([gn(!1)],t.Text.prototype,"italic",void 0),_e([gn("none")],t.Text.prototype,"textCase",void 0),_e([gn("none")],t.Text.prototype,"textDecoration",void 0),_e([gn(0)],t.Text.prototype,"letterSpacing",void 0),_e([gn({type:"percent",value:1.5})],t.Text.prototype,"lineHeight",void 0),_e([gn(0)],t.Text.prototype,"paraIndent",void 0),_e([gn(0)],t.Text.prototype,"paraSpacing",void 0),_e([gn("x")],t.Text.prototype,"writingMode",void 0),_e([gn("left")],t.Text.prototype,"textAlign",void 0),_e([gn("top")],t.Text.prototype,"verticalAlign",void 0),_e([gn(!0)],t.Text.prototype,"autoSizeAlign",void 0),_e([gn("normal")],t.Text.prototype,"textWrap",void 0),_e([gn("show")],t.Text.prototype,"textOverflow",void 0),_e([Pn(!1)],t.Text.prototype,"textEditing",void 0),t.Text=_e([Hn()],t.Text),t.Path=class extends t.UI{get __tag(){return"Path"}},_e([An(_l)],t.Path.prototype,"__",void 0),_e([xn("center")],t.Path.prototype,"strokeAlign",void 0),t.Path=_e([Hn()],t.Path),t.Pen=class extends t.Group{get __tag(){return"Pen"}setStyle(e){const i=this.pathElement=new t.Path(e);return this.pathStyle=e,this.__path=i.path||(i.path=[]),this.add(i),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,r,n){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,r){return this}ellipse(t,e,i,s,r,n,a,o){return this}arc(t,e,i,s,r,n){return this}arcTo(t,e,i,s,r){return this}drawEllipse(t,e,i,s,r,n,a,o){return this}drawArc(t,e,i,s,r,n){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}},_e([An(pl)],t.Pen.prototype,"__",void 0),_e([(t,e)=>{sn(t,e,{get(){return this.__path}})}],t.Pen.prototype,"path",void 0),t.Pen=_e([Xn(Fs,["set","path","paint"]),Hn()],t.Pen),t.App=class extends t.Leafer{get __tag(){return"App"}get isApp(){return!0}constructor(t,e){super(t,e)}init(t,e){if(super.init(t,e),t){const{ground:e,tree:i,sky:s,editor:r}=t;e&&(this.ground=this.addLeafer(e)),(i||r)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||r)&&(this.sky=this.addLeafer(s)),r&&ne.editor(r,this)}}__setApp(){const{canvas:t}=this,{realCanvas:e,view:i}=this.config;e||i===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable()}__updateLocalBounds(){this.forEach(t=>t.updateLayout()),super.__updateLocalBounds()}start(){super.start(),this.forEach(t=>t.start())}stop(){this.forEach(t=>t.stop()),super.stop()}unlockLayout(){super.unlockLayout(),this.forEach(t=>t.unlockLayout())}lockLayout(){super.lockLayout(),this.forEach(t=>t.lockLayout())}forceRender(t,e){this.forEach(i=>i.forceRender(t,e))}addLeafer(e){const i=new t.Leafer(e);return this.add(i),i}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout(()=>this.add(t,e),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),s(e)||(t.canvas.childIndex=e),this.__listenChildEvents(t)}forEach(t){this.children.forEach(t)}__onCreated(){this.created=this.children.every(t=>t.created)}__onReady(){this.children.every(t=>t.ready)&&super.__onReady()}__onViewReady(){this.children.every(t=>t.viewReady)&&super.__onViewReady()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){t.context&&this.forEach(i=>e.matrix?i.__render(t,e):t.copyWorld(i.canvas,e.bounds))}__onResize(t){this.forEach(e=>e.resize(t)),super.__onResize(t)}updateLayout(){this.forEach(t=>t.updateLayout())}__getChildConfig(t){const e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&u.assign(e,t),this.autoLayout&&u.copyAttrs(e,this,Se),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[Ha.END,this.__onReady,this],[ja.START,this.__onCreated,this],[ja.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(ja.END,this.__onChildRenderEnd,this))}},t.App=_e([Hn()],t.App);const ld={},dd={isHoldSpaceKey:()=>dd.isHold("Space"),isHold:t=>ld[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){ld[t]||(ld[t]=!0)},setUpCode(t){ld[t]=!1}},cd={LEFT:1,RIGHT:2,MIDDLE:4,defaultLeft(t){t.buttons||(t.buttons=1)},left:t=>1===t.buttons,right:t=>2===t.buttons,middle:t=>4===t.buttons};class ud extends Ta{get spaceKey(){return dd.isHoldSpaceKey()}get left(){return cd.left(this)}get right(){return cd.right(this)}get middle(){return cd.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return dd.isHoldKeys(t,this)}getBoxPoint(t){return(t||this.current).getBoxPoint(this)}getInnerPoint(t){return(t||this.current).getInnerPoint(this)}getLocalPoint(t){return(t||this.current).getLocalPoint(this)}getPagePoint(){return this.current.getPagePoint(this)}getInner(t){return this.getInnerPoint(t)}getLocal(t){return this.getLocalPoint(t)}getPage(){return this.getPagePoint()}static changeName(t,e){de.changeName(t,e)}}const{min:_d,max:pd,abs:gd}=Math,{float:fd,sign:yd}=M,{minX:md,maxX:vd,minY:xd,maxY:wd}=Yt,bd=new Gt,Ed=new Gt,Pd={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&Bd.getValidMove(t.__localBoxBounds,Bd.getDragBounds(t),s,e,!0),Bd.axisMove(t,e)},limitScaleOf(t,e,i,s){const{dragBounds:r,dragBoundsType:n}=t;r&&Bd.getValidScaleOf(t.__localBoxBounds,Bd.getDragBounds(t),n,t.getLocalPointByInner(t.getInnerPointByBox(e)),i,s,!0)},axisMove(t,e){const{draggable:i}=t;"x"===i&&(e.y=0),"y"===i&&(e.x=0)},getDragBounds(t){const{dragBounds:e}=t;return"parent"===e?t.parent.boxBounds:e},isInnerMode:(t,e,i,s)=>"inner"===i||"auto"===i&&t[s]>e[s],getValidMove(t,e,i,s,r){const n=t.x+s.x,a=t.y+s.y,o=n+t.width,h=a+t.height,l=e.x+e.width,d=e.y+e.height;return r||(s=Object.assign({},s)),Bd.isInnerMode(t,e,i,"width")?n>e.x?s.x+=e.x-n:o<l&&(s.x+=l-o):n<e.x?s.x+=e.x-n:o>l&&(s.x+=l-o),Bd.isInnerMode(t,e,i,"height")?a>e.y?s.y+=e.y-a:h<d&&(s.y+=d-h):a<e.y?s.y+=e.y-a:h>d&&(s.y+=d-h),s.x=fd(s.x),s.y=fd(s.y),s},getValidScaleOf(t,e,i,s,r,n,o){o||(r=Object.assign({},r)),Ed.set(e),bd.set(t).scaleOf(s,r.x,r.y);const h=(s.x-t.x)/t.width,l=1-h,d=(s.y-t.y)/t.height,c=1-d;let u,_,p,g,f=1,y=1;return Bd.isInnerMode(t,e,i,"width")?(r.x<0&&bd.scaleOf(s,f=1/r.x,1),p=fd(bd.minX-Ed.minX),g=fd(Ed.maxX-bd.maxX),u=h&&p>0?1+p/(h*bd.width):1,_=l&&g>0?1+g/(l*bd.width):1,f*=pd(u,_)):(r.x<0&&((fd(md(t)-md(e))<=0||fd(vd(e)-vd(t))<=0)&&bd.scaleOf(s,f=1/r.x,1),bd.unsign()),p=fd(Ed.minX-bd.minX),g=fd(bd.maxX-Ed.maxX),u=h&&p>0?1-p/(h*bd.width):1,_=l&&g>0?1-g/(l*bd.width):1,f*=_d(u,_)),Bd.isInnerMode(t,e,i,"height")?(r.y<0&&bd.scaleOf(s,1,y=1/r.y),p=fd(bd.minY-Ed.minY),g=fd(Ed.maxY-bd.maxY),u=d&&p>0?1+p/(d*bd.height):1,_=c&&g>0?1+g/(c*bd.height):1,y*=pd(u,_),n&&(u=pd(gd(f),gd(y)),f=yd(f)*u,y=yd(y)*u)):(r.y<0&&((fd(xd(t)-xd(e))<=0||fd(wd(e)-wd(t))<=0)&&bd.scaleOf(s,1,y=1/r.y),bd.unsign()),p=fd(Ed.minY-bd.minY),g=fd(bd.maxY-Ed.maxY),u=d&&p>0?1-p/(d*bd.height):1,_=c&&g>0?1-g/(c*bd.height):1,y*=_d(u,_)),r.x*=a(f)?f:1,r.y*=a(y)?y:1,r}},Bd=Pd;t.PointerEvent=class extends ud{},t.PointerEvent.POINTER="pointer",t.PointerEvent.BEFORE_DOWN="pointer.before_down",t.PointerEvent.BEFORE_MOVE="pointer.before_move",t.PointerEvent.BEFORE_UP="pointer.before_up",t.PointerEvent.DOWN="pointer.down",t.PointerEvent.MOVE="pointer.move",t.PointerEvent.UP="pointer.up",t.PointerEvent.OVER="pointer.over",t.PointerEvent.OUT="pointer.out",t.PointerEvent.ENTER="pointer.enter",t.PointerEvent.LEAVE="pointer.leave",t.PointerEvent.TAP="tap",t.PointerEvent.DOUBLE_TAP="double_tap",t.PointerEvent.CLICK="click",t.PointerEvent.DOUBLE_CLICK="double_click",t.PointerEvent.LONG_PRESS="long_press",t.PointerEvent.LONG_TAP="long_tap",t.PointerEvent.MENU="pointer.menu",t.PointerEvent.MENU_TAP="pointer.menu_tap",t.PointerEvent=_e([jn()],t.PointerEvent);const kd=t.PointerEvent,Sd={};t.DragEvent=class extends t.PointerEvent{static setList(t){this.list=t instanceof uh?t:new uh(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const r=t.getLocalPoint(i,null,!0);return ht.move(r,e.x-t.x,e.y-t.y),s&&this.limitMove(t,r),Pd.axisMove(t,r),r}static limitMove(t,e){Pd.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(Sd,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(Sd,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(Sd,null,!0)}getPageTotal(){return this.getPageMove(!0)}getInnerTotal(t){return this.getInnerMove(t,!0)}getLocalTotal(t){return this.getLocalMove(t,!0)}getPageBounds(){const t=this.getPageTotal(),e=this.getPagePoint(),i={};return Yt.set(i,e.x-t.x,e.y-t.y,t.x,t.y),Yt.unsign(i),i}assignMove(t){Sd.x=t?this.totalX:this.moveX,Sd.y=t?this.totalY:this.moveY}},t.DragEvent.BEFORE_DRAG="drag.before_drag",t.DragEvent.START="drag.start",t.DragEvent.DRAG="drag",t.DragEvent.END="drag.end",t.DragEvent.OVER="drag.over",t.DragEvent.OUT="drag.out",t.DragEvent.ENTER="drag.enter",t.DragEvent.LEAVE="drag.leave",t.DragEvent=_e([jn()],t.DragEvent);const Rd=t.DragEvent;t.DropEvent=class extends t.PointerEvent{static setList(e){t.DragEvent.setList(e)}static setData(e){t.DragEvent.setData(e)}},t.DropEvent.DROP="drop",t.DropEvent=_e([jn()],t.DropEvent),t.MoveEvent=class extends t.DragEvent{},t.MoveEvent.BEFORE_MOVE="move.before_move",t.MoveEvent.START="move.start",t.MoveEvent.MOVE="move",t.MoveEvent.END="move.end",t.MoveEvent=_e([jn()],t.MoveEvent),t.TouchEvent=class extends ud{},t.TouchEvent=_e([jn()],t.TouchEvent);const Cd=t.TouchEvent;t.RotateEvent=class extends t.PointerEvent{},t.RotateEvent.BEFORE_ROTATE="rotate.before_rotate",t.RotateEvent.START="rotate.start",t.RotateEvent.ROTATE="rotate",t.RotateEvent.END="rotate.end",t.RotateEvent=_e([jn()],t.RotateEvent),t.SwipeEvent=class extends t.DragEvent{},t.SwipeEvent.SWIPE="swipe",t.SwipeEvent.LEFT="swipe.left",t.SwipeEvent.RIGHT="swipe.right",t.SwipeEvent.UP="swipe.up",t.SwipeEvent.DOWN="swipe.down",t.SwipeEvent=_e([jn()],t.SwipeEvent),t.ZoomEvent=class extends t.PointerEvent{},t.ZoomEvent.BEFORE_ZOOM="zoom.before_zoom",t.ZoomEvent.START="zoom.start",t.ZoomEvent.ZOOM="zoom",t.ZoomEvent.END="zoom.end",t.ZoomEvent=_e([jn()],t.ZoomEvent),t.KeyEvent=class extends ud{},t.KeyEvent.BEFORE_DOWN="key.before_down",t.KeyEvent.BEFORE_UP="key.before_up",t.KeyEvent.DOWN="key.down",t.KeyEvent.HOLD="key.hold",t.KeyEvent.UP="key.up",t.KeyEvent=_e([jn()],t.KeyEvent);const Td={getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e,i)=>Object.assign(Object.assign({},t),{list:e,data:i}),getSwipeDirection:e=>e<-45&&e>-135?t.SwipeEvent.UP:e>45&&e<135?t.SwipeEvent.DOWN:e<=45&&e>=-45?t.SwipeEvent.RIGHT:t.SwipeEvent.LEFT,getSwipeEventData:(t,e,i)=>Object.assign(Object.assign({},i),{moveX:e.moveX,moveY:e.moveY,totalX:i.x-t.x,totalY:i.y-t.y,type:Ld.getSwipeDirection(ht.getAngle(t,i))}),getBase(t){const e=1===t.button?4:t.button;return{altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,buttons:s(t.buttons)?1:0===t.buttons?e:t.buttons,origin:t}},pathHasEventType(t,e){const{list:i}=t;for(let t=0,s=i.length;t<s;t++)if(i[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const i=new uh,{list:s}=t;for(let t=0,r=s.length;t<r;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:e=>e&&e.list.some(e=>sa.draggable(e)||!e.isLeafer&&e.hasEvent(t.DragEvent.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},Ld=Td,Od=new uh,{getDragEventData:Id,getDropEventData:Dd,getSwipeEventData:Ad}=Td;class Md{constructor(t){this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=Id(t,t,t),this.canAnimate=this.canDragOut=!0}getList(e,i){const{proxy:s}=this.interaction.selector,r=s&&s.list.length,n=t.DragEvent.list||this.draggableList||Od;return this.dragging&&(r?e?Od:new uh(i?[...s.list,...s.dragHoverExclude]:s.list):n)}checkDrag(e,i){const{interaction:s}=this;if(this.moving&&e.buttons<1)return this.canAnimate=!1,void s.pointerCancel();!this.moving&&i&&(this.moving=s.canMove(this.downData)||s.isHoldRightKey||s.isMobileDragEmpty)&&(this.dragData.moveType="drag",s.emit(t.MoveEvent.START,this.dragData)),this.moving||this.dragStart(e,i),this.drag(e)}dragStart(e,i){this.dragging||(this.dragging=i&&cd.left(e),this.dragging&&(this.interaction.emit(t.DragEvent.START,this.dragData),this.getDraggableList(this.dragData.path),this.setDragStartPoints(this.realDraggableList=this.getList(!0))))}setDragStartPoints(t){this.dragStartPoints={},t.forEach(t=>this.dragStartPoints[t.innerId]={x:t.x,y:t.y})}getDraggableList(t){let e;for(let i=0,s=t.length;i<s;i++)if(e=t.list[i],sa.draggable(e)){this.draggableList=new uh(e);break}}drag(e){const{interaction:i,dragData:s,downData:r}=this,{path:n,throughPath:a}=r;this.dragData=Id(r,s,e),a&&(this.dragData.throughPath=a),this.dragData.path=n,this.moving?(e.moving=!0,this.dragData.moveType="drag",i.emit(t.MoveEvent.BEFORE_MOVE,this.dragData),i.emit(t.MoveEvent.MOVE,this.dragData)):this.dragging&&(e.dragging=!0,this.dragReal(),i.emit(t.DragEvent.BEFORE_DRAG,this.dragData),i.emit(t.DragEvent.DRAG,this.dragData))}dragReal(e){const{interaction:i}=this,{running:s}=i,r=this.realDraggableList;if(r.length&&s){const{totalX:s,totalY:a}=this.dragData,{dragLimitAnimate:h}=i.p,l=!h||!!e;r.forEach(i=>{if(i.draggable){const r=n(i.draggable),d=t.DragEvent.getValidMove(i,this.dragStartPoints[i.innerId],{x:s,y:a},l||r);h&&!r&&e?sa.animateMove(i,d,o(h)?h:.3):i.move(d)}})}}dragOverOrOut(e){const{interaction:i}=this,{dragOverPath:s}=this,{path:r}=e;this.dragOverPath=r,s?r.indexAt(0)!==s.indexAt(0)&&(i.emit(t.DragEvent.OUT,e,s),i.emit(t.DragEvent.OVER,e,r)):i.emit(t.DragEvent.OVER,e,r)}dragEnterOrLeave(e){const{interaction:i}=this,{dragEnterPath:s}=this,{path:r}=e;i.emit(t.DragEvent.LEAVE,e,s,r),i.emit(t.DragEvent.ENTER,e,r,s),this.dragEnterPath=r}dragEnd(t,e){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t,e)||this.dragEndReal(t))}dragEndReal(e){const{interaction:i,downData:s,dragData:r}=this;e||(e=r);const{path:n,throughPath:a}=s,o=Id(s,e,e);if(a&&(o.throughPath=a),o.path=n,this.moving&&(this.moving=!1,o.moveType="drag",i.emit(t.MoveEvent.END,o)),this.dragging){const n=this.getList();this.dragging=!1,i.p.dragLimitAnimate&&this.dragReal(!0),i.emit(t.DragEvent.END,o),this.swipe(e,s,r,o),this.drop(e,n,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:r}=this;if(ht.getDistance(e,t)>r.config.pointer.swipeDistance){const t=Ad(e,i,s);this.interaction.emit(t.type,t)}}drop(e,i,s){const r=Dd(e,i,t.DragEvent.data);r.path=s,this.interaction.emit(t.DropEvent.DROP,r),this.interaction.emit(t.DragEvent.LEAVE,e,s)}dragReset(){t.DragEvent.list=t.DragEvent.data=this.draggableList=this.dragData=this.downData=this.dragOverPath=this.dragEnterPath=null}checkDragEndAnimate(t,e){return!1}animate(t,e){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const Wd=Qt.get("emit");const Fd=["move","zoom","rotate","key"];function Ud(t,e,i,s,r){if(Fd.some(t=>e.startsWith(t))&&t.__.hitChildren&&!zd(t,r)){let n;for(let a=0,o=t.children.length;a<o;a++)n=t.children[a],!i.path.has(n)&&n.__.hittable&&Nd(n,e,i,s,r)}}function Nd(t,e,i,s,r){if(t.destroyed)return!1;if(t.__.hitSelf&&!zd(t,r)&&(Kh.updateEventStyle&&!s&&Kh.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const r=de.get(e,i);if(t.emitEvent(r,s),r.isStop)return!0}return!1}function zd(t,e){return e&&e.has(t)}const Yd={wheel:{zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:{x:20,y:8}},pointer:{type:"pointer",snap:!0,hitRadius:5,tapTime:120,longPressTime:800,transformTime:500,hover:!0,dragHover:!0,dragDistance:2,swipeDistance:20},touch:{preventDefault:"auto"},multiTouch:{},move:{autoDistance:2},zoom:{},cursor:!0,keyEvent:!0},{pathHasEventType:Xd,pathCanDrag:Hd,pathHasOutside:jd}=Td;class Gd{get dragging(){return this.dragger.dragging}get transforming(){return this.transformer.transforming}get moveMode(){return!0===this.m.drag||this.isHoldSpaceKey||this.isHoldMiddleKey||this.isHoldRightKey&&this.dragger.moving||this.isDragEmpty}get canHover(){return this.p.hover&&!this.config.mobile}get isDragEmpty(){return this.m.dragEmpty&&this.isRootPath(this.hoverData)&&(!this.downData||this.isRootPath(this.downData))}get isMobileDragEmpty(){return this.m.dragEmpty&&!this.canHover&&this.downData&&this.isTreePath(this.downData)}get isHoldMiddleKey(){return this.m.holdMiddleKey&&this.downData&&cd.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&cd.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&dd.isHoldSpaceKey()}get m(){return this.config.move}get p(){return this.config.pointer}get hitRadius(){return this.p.hitRadius}constructor(t,e,i,s){this.config=u.clone(Yd),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new uh(t),this.createTransformer(),this.dragger=new Md(this),s&&(this.config=u.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(e,i){e||(e=this.hoverData),e&&(cd.defaultLeft(e),this.updateDownData(e),this.checkPath(e,i),this.downTime=Date.now(),this.emit(t.PointerEvent.BEFORE_DOWN,e),this.emit(t.PointerEvent.DOWN,e),cd.left(e)&&(this.tapWait(),this.longPressWait(e)),this.waitRightTap=cd.right(e),this.dragger.setDragData(e),this.isHoldRightKey||this.updateCursor(e))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&cd.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(e){if(this.emit(t.PointerEvent.BEFORE_MOVE,e,this.defaultPath),this.downData){const t=ht.getDistance(this.downData,e)>this.p.dragDistance;t&&(this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(e,t)}this.dragger.moving||(this.updateHoverData(e),this.checkPath(e),this.emit(t.PointerEvent.MOVE,e),this.pointerHover(e),this.dragging&&(this.dragger.dragOverOrOut(e),this.dragger.dragEnterOrLeave(e))),this.updateCursor(this.downData||e)}pointerUp(e){const{downData:i}=this;if(e||(e=i),!i)return;cd.defaultLeft(e),e.multiTouch=i.multiTouch,this.findPath(e);const s=Object.assign(Object.assign({},e),{path:e.path.clone()});e.path.addList(i.path.list),this.checkPath(e),this.downData=null,this.emit(t.PointerEvent.BEFORE_UP,e),this.emit(t.PointerEvent.UP,e),this.touchLeave(e),e.isCancel||(this.tap(e),this.menuTap(e)),this.dragger.dragEnd(e),this.updateCursor(s)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(e){this.findPath(e),this.emit(t.PointerEvent.MENU,e),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(e)}menuTap(e){this.waitRightTap&&this.waitMenuTap&&(this.emit(t.PointerEvent.MENU_TAP,e),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(e){if(!this.config.keyEvent)return;this.emit(t.KeyEvent.BEFORE_DOWN,e,this.defaultPath);const{code:i}=e;this.downKeyMap[i]||(this.downKeyMap[i]=!0,dd.setDownCode(i),this.emit(t.KeyEvent.HOLD,e,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(t.KeyEvent.DOWN,e,this.defaultPath)}keyUp(e){if(!this.config.keyEvent)return;this.emit(t.KeyEvent.BEFORE_UP,e,this.defaultPath);const{code:i}=e;this.downKeyMap[i]=!1,dd.setUpCode(i),this.emit(t.KeyEvent.UP,e,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){!this.canHover||this.dragging&&!this.p.dragHover||(t.path||(t.path=new uh),this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(e){const{path:i}=e,{overPath:s}=this;this.overPath=i,s?i.indexAt(0)!==s.indexAt(0)&&(this.emit(t.PointerEvent.OUT,e,s),this.emit(t.PointerEvent.OVER,e,i)):this.emit(t.PointerEvent.OVER,e,i)}pointerEnterOrLeave(e){let{path:i}=e;this.downData&&!this.moveMode&&(i=i.clone(),this.downData.path.forEach(t=>i.add(t)));const{enterPath:s}=this;this.enterPath=i,this.emit(t.PointerEvent.LEAVE,e,s,i),this.emit(t.PointerEvent.ENTER,e,i,s)}touchLeave(e){"touch"===e.pointerType&&this.enterPath&&(this.emit(t.PointerEvent.LEAVE,e),this.dragger.dragging&&this.emit(t.DropEvent.LEAVE,e))}tap(e){const{pointer:i}=this.config,s=this.longTap(e);if(!i.tapMore&&s)return;if(!this.waitTap)return;i.tapMore&&this.emitTap(e);const r=Date.now()-this.downTime,n=[t.PointerEvent.DOUBLE_TAP,t.PointerEvent.DOUBLE_CLICK].some(t=>Xd(e.path,t));r<i.tapTime+50&&n?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(e)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout(()=>{i.tapMore||(this.tapWaitCancel(),this.emitTap(e))},i.tapTime))):i.tapMore||(this.tapWaitCancel(),this.emitTap(e))}findPath(t,e){const{hitRadius:i,through:s}=this.p,{bottomList:r,target:n}=this;y.backgrounder||t.origin||n&&n.updateLayout();const a=this.selector.getByPoint(t,i,Object.assign({bottomList:r,name:t.type},e||{through:s}));return a.throughPath&&(t.throughPath=a.throughPath),t.path=a.path,a.path}isRootPath(t){return t&&t.path.list[0].isLeafer}isTreePath(t){const e=this.target.app;return!(!e||!e.isApp)&&(e.editor&&!t.path.has(e.editor)&&t.path.has(e.tree)&&!t.target.syncEventer)}checkPath(t,e){(e||this.moveMode&&!jd(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!Hd(t.path))&&!jd(t.path)}isDrag(t){return this.dragger.getList().has(t)}isPress(t){return this.downData&&this.downData.path.has(t)}isHover(t){return this.enterPath&&this.enterPath.has(t)}isFocus(t){return this.focusData===t}cancelHover(){const{hoverData:t}=this;t&&(t.path=this.defaultPath,this.pointerHover(t))}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(e){e||(e=this.hoverData),e&&(this.findPath(e,{exclude:this.dragger.getList(!1,!0),name:t.PointerEvent.MOVE}),this.hoverData=e)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let t=0,r=s.length;t<r&&(e=s.list[t],i=e.syncEventer&&e.syncEventer.cursor||e.cursor,!i);t++);this.setCursor(i)}setCursor(t){this.cursor=t}getLocal(t,e){const i=this.canvas.getClientBounds(e),s={x:t.clientX-i.x,y:t.clientY-i.y},{bounds:r}=this.canvas;return s.x*=r.width/i.width,s.y*=r.height/i.height,this.p.snap&&ht.round(s),s}emitTap(e){this.emit(t.PointerEvent.TAP,e),this.emit(t.PointerEvent.CLICK,e)}emitDoubleTap(e){this.emit(t.PointerEvent.DOUBLE_TAP,e),this.emit(t.PointerEvent.DOUBLE_CLICK,e)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){this.waitTap&&(clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0)}longPressWait(e){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout(()=>{this.longPressed=!0,this.emit(t.PointerEvent.LONG_PRESS,e)},this.p.longPressTime)}longTap(e){let i;return this.longPressed&&(this.emit(t.PointerEvent.LONG_TAP,e),(Xd(e.path,t.PointerEvent.LONG_TAP)||Xd(e.path,t.PointerEvent.LONG_PRESS))&&(i=!0)),this.longPressWaitCancel(),i}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new Gt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(o(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(Ya.RESIZE,this.__onResize,this)],t.once(Ga.READY,()=>this.__onResize())}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,i,s){this.running&&function(t,e,i,s){if(!i&&!e.path)return;let r;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let n=i.length-1;n>-1;n--){if(r=i.list[n],Nd(r,t,e,!0,s))return;r.isApp&&Ud(r,t,e,!0,s)}for(let n=0,a=i.length;n<a;n++)if(r=i.list[n],r.isApp&&Ud(r,t,e,!1,s),Nd(r,t,e,!1,s))return}catch(t){Wd.error(t)}}(t,e,i,s)}destroy(){this.__eventIds.length&&(this.stop(),this.__removeListenEvents(),this.dragger.destroy(),this.transformer&&this.transformer.destroy(),this.downData=this.overPath=this.enterPath=null)}}class Vd{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}Vd.custom={};class Kd extends ue{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new uh,this.pixelList=new uh}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),ne.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),ne.hitCanvas()}clearImageType(){this.__clearLeafList(this.pixelList)}clearPathType(){this.__clearLeafList(this.pathList)}__clearLeafList(t){t.length&&(t.forEach(t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)}),t.reset())}__autoClear(){this.pathList.length+this.pixelList.length>this.maxTotal&&this.clear()}clear(){this.clearPathType(),this.clearImageType()}}y.getSelector=function(t){return t.leafer?t.leafer.selector:y.selector||(y.selector=ne.selector())};const{toInnerRadiusPointOf:qd,copy:Zd,setRadius:Qd}=ht,{hitRadiusPoint:Jd,hitPoint:$d}=Yt,tc={},ec={},ic=t.Leaf.prototype;ic.hit=function(t,e=0){this.updateLayout(),Zd(ec,t),Qd(ec,e);const i=this.__world;return!!(e?Jd(i,ec):$d(i,ec))&&(this.isBranch?y.getSelector(this).hitPoint(Object.assign({},ec),e,{target:this}):this.__hitWorld(ec))},ic.__hitWorld=function(t){const e=this.__;if(!e.hitSelf)return!1;const i=this.__world,s=this.__layout,r=i.width<10&&i.height<10;if(e.hitRadius&&(Zd(tc,t),Qd(t=tc,e.hitRadius)),qd(t,i,tc),e.hitBox||r){if(Yt.hitRadiusPoint(s.boxBounds,tc))return!0;if(r)return!1}return!s.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),s.boundsChanged||(s.hitCanvasChanged=!1)),this.__hit(tc)},ic.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},ic.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},ic.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},ic.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const sc=new gt,rc=t.UI.prototype;rc.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const{hitCanvasManager:t}=this.leafer||this.parent&&this.parent.leafer||{};if(!t)return;const e=this.__,i=(e.__isAlphaPixelFill||e.__isCanvas)&&"pixel"===e.hitFill,s=e.__isAlphaPixelStroke&&"pixel"===e.hitStroke,r=i||s;this.__hitCanvas||(this.__hitCanvas=r?t.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):t.getPathType(this));const n=this.__hitCanvas;if(r){const{renderBounds:t}=this.__layout,r=y.image.hitCanvasSize,a=n.hitScale=Vt.set(0,0,r,r).getFitMatrix(t).a,{x:o,y:h,width:l,height:d}=Vt.set(t).scale(a);n.resize({width:l,height:d,pixelRatio:1}),n.clear(),Qr.patternLocked=!0,this.__renderShape(n,{matrix:sc.setWith(this.__world).scaleWith(1/a).invertWith().translate(-o,-h),ignoreFill:!i,ignoreStroke:!s}),Qr.patternLocked=!1,n.resetTransform(),e.__isHitPixel=!0}else e.__isHitPixel&&(e.__isHitPixel=!1);this.__drawHitPath(n),n.setStrokeOptions(e)},rc.__hit=function(t){if(this.__box&&this.__box.__hit(t))return!0;const e=this.__;if(e.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:i}=e,s=(e.fill||e.__isCanvas)&&("path"===i||"pixel"===i&&!(e.__isAlphaPixelFill||e.__isCanvas))||"all"===i;if(s&&this.__hitFill(t))return!0;const{hitStroke:r,__maxStrokeWidth:n}=e,a=e.stroke&&("path"===r||"pixel"===r&&!e.__isAlphaPixelStroke)||"all"===r;if(!s&&!a)return!1;const o=2*t.radiusX;let h=o;if(a)switch(e.strokeAlign){case"inside":if(h+=2*n,!s&&this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=o;break;case"center":h+=n;break;case"outside":if(h+=2*n,!s){if(!this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=o}}return!!h&&this.__hitStroke(t,h)};const nc=t.UI.prototype,ac=t.Rect.prototype,oc=t.Box.prototype;ac.__updateHitCanvas=oc.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?nc.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},ac.__hitFill=oc.__hitFill=function(t){return this.__hitCanvas?nc.__hitFill.call(this,t):Yt.hitRadiusPoint(this.__layout.boxBounds,t)},t.Text.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:r,__textDrawData:n}=this.__;t.beginPath(),r<0?this.__drawPathByBox(t):n.rows.forEach(r=>t.rect(r.x,r.y-s,r.width,e<i?i:e))},t.Group.prototype.pick=function(t,e){return e||(e=i),this.updateLayout(),y.getSelector(this).getByPoint(t,e.hitRadius||0,Object.assign(Object.assign({},e),{target:this}))};const hc=Re.prototype;function lc(t,e,i){t.__.__font?Yh.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function dc(t,e,i,s,r){const n=i.__;d(t)?Yh.drawStrokesStyle(t,e,!1,i,s,r):(s.setStroke(t,n.__strokeWidth*e,n),s.stroke()),n.__useArrow&&Yh.strokeArrow(t,i,s,r)}function cc(t,e,i,s,r){const n=i.__;d(t)?Yh.drawStrokesStyle(t,e,!0,i,s,r):(s.setStroke(t,n.__strokeWidth*e,n),Yh.drawTextStroke(i,s,r))}function uc(t,e,i,s,r){const n=s.getSameCanvas(!0,!0);n.font=i.__.__font,cc(t,2,i,n,r),n.blendMode="outside"===e?"destination-out":"destination-in",Yh.fillText(i,n,r),n.blendMode="normal",sa.copyCanvasByWorld(i,s,n),n.recycle(i.__nowWorld)}hc.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},hc.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},hc.hitPixel=function(t,e,i=1){let{x:s,y:r,radiusX:n,radiusY:a}=t;e&&(s-=e.x,r-=e.y),Vt.set(s-n,r-a,2*n,2*a).scale(i).ceil();const{data:o}=this.context.getImageData(Vt.x,Vt.y,Vt.width||1,Vt.height||1);for(let t=0,e=o.length;t<e;t+=4)if(o[t+3]>0)return!0;return o[3]>0};const{getSpread:_c,copyAndSpread:pc,toOuterOf:gc,getOuterOf:fc,getByMove:yc,move:mc,getIntersectData:vc}=Yt,xc={};let wc;const{stintSet:bc}=u,{hasTransparent:Ec}=Uh;function Pc(t,e,i){if(!d(e)||!1===e.visible||0===e.opacity)return;let r;const{boxBounds:a}=i.__layout;switch(e.type){case"image":r=Xh.image(i,t,e,a,!wc||!wc[e.url]);break;case"linear":r=Hh.linearGradient(e,a);break;case"radial":r=Hh.radialGradient(e,a);break;case"angular":r=Hh.conicGradient(e,a);break;case"solid":const{type:n,color:o,opacity:h}=e;r={type:n,style:Uh.string(o,h)};break;default:s(e.r)||(r={type:"solid",style:Uh.string(e)})}if(r&&(r.originPaint=e,n(r.style)&&Ec(r.style)&&(r.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;r.strokeStyle=e.style}return r}const Bc={compute:function(t,e){const i=e.__,s=[];let r,n,a,o=i.__input[t];l(o)||(o=[o]),wc=Xh.recycleImage(t,i);for(let i,r=0,n=o.length;r<n;r++)(i=Pc(t,o[r],e))&&(s.push(i),i.strokeStyle&&(a||(a=1),i.strokeStyle.strokeWidth&&(a=Math.max(a,i.strokeStyle.strokeWidth))));i["_"+t]=s.length?s:void 0,s.length?(s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(r=!0),n=!0),"fill"===t?(bc(i,"__isAlphaPixelFill",r),bc(i,"__isTransparentFill",n)):(bc(i,"__isAlphaPixelStroke",r),bc(i,"__isTransparentStroke",n),bc(i,"__hasMultiStrokeStyle",a))):i.__removePaint(t,!1)},fill:function(t,e,i,s){i.fillStyle=t,lc(e,i,s)},fills:function(t,e,i,s){let r,n,a;for(let o=0,h=t.length;o<h;o++){if(r=t[o],n=r.originPaint,r.image){if(a?a++:a=1,Xh.checkImage(r,!e.__.__font,e,i,s))continue;if(!r.style){1===a&&r.image.isPlacehold&&e.drawImagePlaceholder(r,i,s);continue}}if(i.fillStyle=r.style,r.transform||n.scaleFixed){if(i.save(),r.transform&&i.transform(r.transform),n.scaleFixed){const{scaleX:t,scaleY:s}=e.getRenderScaleData(!0);(!0===n.scaleFixed||"zoom-in"===n.scaleFixed&&t>1&&s>1)&&i.scale(1/t,1/s)}n.blendMode&&(i.blendMode=n.blendMode),lc(e,i,s),i.restore()}else n.blendMode?(i.saveBlendMode(n.blendMode),lc(e,i,s),i.restoreBlendMode()):lc(e,i,s)}},fillPathOrText:lc,fillText:function(t,e,i){const s=t.__,{rows:r,decorationY:n}=s.__textDrawData;let a;s.__isPlacehold&&s.placeholderColor&&(e.fillStyle=s.placeholderColor);for(let t=0,i=r.length;t<i;t++)a=r[t],a.text?e.fillText(a.text,a.x,a.y):a.data&&a.data.forEach(t=>{e.fillText(t.char,t.x,a.y)});if(n){const{decorationColor:t,decorationHeight:i}=s.__textDrawData;t&&(e.fillStyle=t),r.forEach(t=>n.forEach(s=>e.fillRect(t.x,t.y+s,t.width,i)))}},stroke:function(t,e,i,s){const r=e.__;if(r.__strokeWidth)if(r.__font)Yh.strokeText(t,e,i,s);else switch(r.strokeAlign){case"center":dc(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),dc(t,2,e,i,s),i.restore()}(t,e,i,s);break;case"outside":!function(t,e,i,s){const r=e.__;if(r.__fillAfterStroke)dc(t,2,e,i,s);else{const{renderBounds:n}=e.__layout,a=i.getSameCanvas(!0,!0);e.__drawRenderPath(a),dc(t,2,e,a,s),a.clipUI(r),a.clearWorld(n),sa.copyCanvasByWorld(e,i,a),a.recycle(e.__nowWorld)}}(t,e,i,s)}},strokes:function(t,e,i,s){Yh.stroke(t,e,i,s)},strokeText:function(t,e,i,s){switch(e.__.strokeAlign){case"center":cc(t,1,e,i,s);break;case"inside":uc(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?cc(t,2,e,i,s):uc(t,"outside",e,i,s)}},drawTextStroke:function(t,e,i){let s,r=t.__.__textDrawData;const{rows:n,decorationY:a}=r;for(let t=0,i=n.length;t<i;t++)s=n[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(a){const{decorationHeight:t}=r;n.forEach(i=>a.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}},drawStrokesStyle:function(t,e,i,s,r,n){let a;const o=s.__,{__hasMultiStrokeStyle:h}=o;h||r.setStroke(void 0,o.__strokeWidth*e,o);for(let l=0,d=t.length;l<d;l++)if(a=t[l],(!a.image||!Xh.checkImage(a,!1,s,r,n))&&a.style){if(h){const{strokeStyle:t}=a;t?r.setStroke(a.style,o.__getRealStrokeWidth(t)*e,o,t):r.setStroke(a.style,o.__strokeWidth*e,o)}else r.strokeStyle=a.style;a.originPaint.blendMode?(r.saveBlendMode(a.originPaint.blendMode),i?Yh.drawTextStroke(s,r,n):r.stroke(),r.restoreBlendMode()):i?Yh.drawTextStroke(s,r,n):r.stroke()}},shape:function(t,e,i){const s=e.getSameCanvas(),r=e.bounds,n=t.__nowWorld,a=t.__layout,o=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let h,l,d,c,u,_;gc(a.strokeSpread?(pc(xc,a.boxBounds,a.strokeSpread),xc):a.boxBounds,n,o);let{scaleX:p,scaleY:g}=t.getRenderScaleData(!0);if(r.includes(o))_=s,h=u=o,l=n;else{let s;if(y.fullImageShadow)s=o;else{const t=a.renderShapeSpread?_c(r,k.swapAndScale(a.renderShapeSpread,p,g)):r;s=vc(t,o)}c=r.getFitMatrix(s);let{a:f,d:m}=c;c.a<1&&(_=e.getSameCanvas(),t.__renderShape(_,i),p*=f,g*=m),u=fc(o,c),h=yc(u,-c.e,-c.f),l=fc(n,c),mc(l,-c.e,-c.f);const v=i.matrix;v?(d=new gt(c),d.multiply(v),f*=v.scaleX,m*=v.scaleY):d=c,d.withScale(f,m),i=Object.assign(Object.assign({},i),{matrix:d})}return t.__renderShape(s,i),{canvas:s,matrix:d,fitMatrix:c,bounds:h,renderBounds:l,worldCanvas:_,shapeBounds:u,scaleX:p,scaleY:g}}};let kc,Sc=new Gt;const{isSame:Rc}=Yt;function Cc(t,e,i,s,r,n){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=s.width/e.pixelRatio,e.__naturalHeight=s.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||Xh.createData(r,s,i,n),!0}function Tc(t,e){Ic(t,Aa.LOAD,e)}function Lc(t,e){Ic(t,Aa.LOADED,e)}function Oc(t,e,i){e.error=i,t.forceUpdate("surface"),Ic(t,Aa.ERROR,e)}function Ic(t,e,i){t.hasEvent(e)&&t.emitEvent(new Aa(e,i))}function Dc(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:Ac,translate:Mc}=Q,Wc=new Gt,Fc={},Uc={};function Nc(t,e,i,s){const r=n(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&r<0?0:r}let zc={},Yc={a:1,b:0,c:0,d:1,e:0,f:0};const{get:Xc,set:Hc,rotateOfOuter:jc,translate:Gc,scaleOfOuter:Vc,multiplyParent:Kc,scale:qc,rotate:Zc,skew:Qc}=Q;function Jc(t,e,i,s,r,n,a,o){a&&Zc(t,a),o&&Qc(t,o.x,o.y),r&&qc(t,r,n),Gc(t,e.x+i,e.y+s)}const{get:$c,scale:tu,copy:eu}=Q,{getFloorScale:iu}=M,{abs:su}=Math;const ru={image:function(t,e,i,s,r){let n,a;const o=Qr.get(i);return kc&&i===kc.paint&&Rc(s,kc.boxBounds)?n=kc.leafPaint:(n={type:i.type,image:o},o.hasAlphaPixel&&(n.isTransparent=!0),kc=o.use>1?{leafPaint:n,paint:i,boxBounds:Sc.set(s)}:null),(r||o.loading)&&(a={image:o,attrName:e,attrValue:i}),o.ready?(Cc(t,e,i,o,n,s),r&&(Tc(t,a),Lc(t,a))):o.error?r&&Oc(t,a,o.error):(r&&(Dc(t,!0),Tc(t,a)),n.loadId=o.load(()=>{Dc(t,!1),t.destroyed||(Cc(t,e,i,o,n,s)&&(o.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Lc(t,a)),n.loadId=void 0},e=>{Dc(t,!1),Oc(t,a,e),n.loadId=void 0}),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{o.ready||(o.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):o.isPlacehold=!0)),n},checkImage:function(t,e,i,s,r){const{scaleX:n,scaleY:a}=Xh.getImageRenderScaleData(t,i,s,r),{image:o,data:h,originPaint:l}=t,{exporting:d}=r;return!(!h||t.patternId===n+"-"+a&&!d)&&(e&&(h.repeat?e=!1:l.changeful||"miniapp"===y.name&&Ya.isResizing(i)||d||(e=y.image.isLarge(o,n,a))),e?(i.__.__isFastShadow&&(s.fillStyle=t.style||"#000",s.fill()),Xh.drawImage(t,n,a,i,s,r),!0):(!t.style||l.sync||d?Xh.createPattern(t,i,s,r):Xh.createPatternTask(t,i,s,r),!1))},drawImage:function(t,e,i,s,r,n){const{data:a,image:o}=t,{blendMode:h}=t.originPaint,{opacity:l,transform:d}=a,c=o.getFull(a.filters),u=s.__;let _,{width:p,height:g}=o;(_=d&&!d.onlyScale||u.path||u.cornerRadius)||l||h?(r.save(),_&&r.clipUI(s),h&&(r.blendMode=h),l&&(r.opacity*=l),d&&r.transform(d),r.drawImage(c,0,0,p,g),r.restore()):(a.scaleX&&(p*=a.scaleX,g*=a.scaleY),r.drawImage(c,0,0,p,g))},getImageRenderScaleData:function(t,e,i,s){const r=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:n}=t;if(i){const{pixelRatio:t}=i;r.scaleX*=t,r.scaleY*=t}return n&&n.scaleX&&(r.scaleX*=Math.abs(n.scaleX),r.scaleY*=Math.abs(n.scaleY)),r},recycleImage:function(t,e){const i=e["_"+t];if(l(i)){let s,r,n,a,o;for(let h=0,d=i.length;h<d;h++)s=i[h],r=s.image,o=r&&r.url,o&&(n||(n={}),n[o]=!0,Qr.recycle(r),r.loading&&(a||(a=e.__input&&e.__input[t]||[],l(a)||(a=[a])),r.unload(i[h].loadId,!a.some(t=>t.url===o))));return n}return null},createPatternTask:function(t,e,i,s){t.patternTask||(t.patternTask=Qr.patternTasker.add(()=>pe(this,void 0,void 0,function*(){t.patternTask=null,i.bounds.hit(e.__nowWorld)&&Xh.createPattern(t,e,i,s),e.forceUpdate("surface")}),300))},createPattern:function(t,e,i,s){let{scaleX:r,scaleY:n}=Xh.getImageRenderScaleData(t,e,i,s),a=r+"-"+n;if(t.patternId!==a&&!e.destroyed&&(!y.image.isLarge(t.image,r,n)||t.data.repeat)){const{image:i,data:s}=t,{transform:o,gap:h}=s,l=Xh.getPatternFixScale(t,r,n);let d,c,u,{width:_,height:p}=i;l&&(r*=l,n*=l),_*=r,p*=n,h&&(c=h.x*r/su(s.scaleX||1),u=h.y*n/su(s.scaleY||1)),(o||1!==r||1!==n)&&(r*=iu(_+(c||0)),n*=iu(p+(u||0)),d=$c(),o&&eu(d,o),tu(d,1/r,1/n));const g=i.getCanvas(_,p,s.opacity,s.filters,c,u,e.leafer&&e.leafer.config.smooth),f=i.getPattern(g,s.repeat||y.origin.noRepeat||"no-repeat",d,t);t.style=f,t.patternId=a}},getPatternFixScale:function(t,e,i){const{image:s}=t;let r,n=y.image.maxPatternSize,a=s.width*s.height;return s.isSVG?e>1&&(r=Math.ceil(e)/e):n>a&&(n=a),(a*=e*i)>n&&(r=Math.sqrt(n/a)),r},createData:function(t,e,i,s){t.data=Xh.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=Wc.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:s,height:r}=i,{opacity:a,mode:o,align:h,offset:l,scale:c,size:u,rotation:_,skew:p,clipSize:g,repeat:f,gap:y,filters:m}=t,v=e.width===s&&e.height===r,x={mode:o},w="center"!==h&&(_||0)%180==90;let b,E;switch(Yt.set(Uc,0,0,w?r:s,w?s:r),o&&"cover"!==o&&"fit"!==o?((c||u)&&(M.getScaleData(c,u,i,Fc),b=Fc.scaleX,E=Fc.scaleY),(h||y||f)&&(b&&Yt.scale(Uc,b,E,!0),h&&Bt.toPoint(h,Uc,e,Uc,!0,!0))):v&&!_||(b=E=Yt.getFitScale(e,Uc,"fit"!==o),Yt.put(e,i,h,b,!1,Uc),Yt.scale(Uc,b,E,!0)),l&&ht.move(Uc,l),o){case"stretch":v?b&&(b=E=void 0):(b=e.width/s,E=e.height/r,Xh.stretchMode(x,e,b,E));break;case"normal":case"clip":if(Uc.x||Uc.y||b||g||_||p){let t,i;g&&(t=e.width/g.width,i=e.height/g.height),Xh.clipMode(x,e,Uc.x,Uc.y,b,E,_,p,t,i),t&&(b=b?b*t:t,E=E?E*i:i)}break;case"repeat":(!v||b||_||p)&&Xh.repeatMode(x,e,s,r,Uc.x,Uc.y,b,E,_,p,h,t.freeTransform),f||(x.repeat="repeat");const i=d(f);(y||i)&&(x.gap=function(t,e,i,s,r){let n,a;d(t)?(n=t.x,a=t.y):n=a=t;return{x:Nc(n,i,r.width,e&&e.x),y:Nc(a,s,r.height,e&&e.y)}}(y,i&&f,Uc.width,Uc.height,e));break;default:b&&Xh.fillOrFitMode(x,e,Uc.x,Uc.y,b,E,_)}return x.transform||(e.x||e.y)&&Mc(x.transform=Ac(),e.x,e.y),b&&(x.scaleX=b,x.scaleY=E),a&&a<1&&(x.opacity=a),m&&(x.filters=m),f&&(x.repeat=n(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),x},stretchMode:function(t,e,i,s){const r=Xc(),{x:n,y:a}=e;n||a?Gc(r,n,a):r.onlyScale=!0,qc(r,i,s),t.transform=r},fillOrFitMode:function(t,e,i,s,r,n,a){const o=Xc();Gc(o,e.x+i,e.y+s),qc(o,r,n),a&&jc(o,{x:e.x+e.width/2,y:e.y+e.height/2},a),t.transform=o},clipMode:function(t,e,i,s,r,n,a,o,h,l){const d=Xc();Jc(d,e,i,s,r,n,a,o),h&&(a||o?(Hc(Yc),Vc(Yc,e,h,l),Kc(d,Yc)):Vc(d,e,h,l)),t.transform=d},repeatMode:function(t,e,i,s,r,n,a,o,h,l,d,c){const u=Xc();if(c)Jc(u,e,r,n,a,o,h,l);else{if(h)if("center"===d)jc(u,{x:i/2,y:s/2},h);else switch(Zc(u,h),h){case 90:Gc(u,s,0);break;case 180:Gc(u,i,s);break;case 270:Gc(u,0,i)}zc.x=e.x+r,zc.y=e.y+n,Gc(u,zc.x,zc.y),a&&Vc(u,zc,a,o)}t.transform=u}},{toPoint:nu}=bt,{hasTransparent:au}=Uh,ou={},hu={};function lu(t,e,i,s){if(i){let r,a,o,h;for(let t=0,l=i.length;t<l;t++)r=i[t],n(r)?(o=t/(l-1),a=Uh.string(r,s)):(o=r.offset,a=Uh.string(r.color,s)),e.addColorStop(o,a),!h&&au(a)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:du,getDistance:cu}=ht,{get:uu,rotateOfOuter:_u,scaleOfOuter:pu}=Q,{toPoint:gu}=bt,fu={},yu={};function mu(t,e,i,s,r){let n;const{width:a,height:o}=t;if(a!==o||s){const t=du(e,i);n=uu(),r?(pu(n,e,a/o*(s||1),1),_u(n,e,t+90)):(pu(n,e,1,a/o*(s||1)),_u(n,e,t))}return n}const{getDistance:vu}=ht,{toPoint:xu}=bt,wu={},bu={};const Eu={linearGradient:function(t,e){let{from:i,to:s,type:r,opacity:n}=t;nu(i||"top",e,ou),nu(s||"bottom",e,hu);const a=y.canvas.createLinearGradient(ou.x,ou.y,hu.x,hu.y),o={type:r,style:a};return lu(o,a,t.stops,n),o},radialGradient:function(t,e){let{from:i,to:s,type:r,opacity:n,stretch:a}=t;gu(i||"center",e,fu),gu(s||"bottom",e,yu);const o=y.canvas.createRadialGradient(fu.x,fu.y,0,fu.x,fu.y,cu(fu,yu)),h={type:r,style:o};lu(h,o,t.stops,n);const l=mu(e,fu,yu,a,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:i,to:s,type:r,opacity:n,stretch:a}=t;xu(i||"center",e,wu),xu(s||"bottom",e,bu);const o=y.conicGradientSupport?y.canvas.createConicGradient(0,wu.x,wu.y):y.canvas.createRadialGradient(wu.x,wu.y,0,wu.x,wu.y,vu(wu,bu)),h={type:r,style:o};lu(h,o,t.stops,n);const l=mu(e,wu,bu,a||1,y.conicGradientRotate90);return l&&(h.transform=l),h},getTransform:mu},{copy:Pu,move:Bu,toOffsetOutBounds:ku}=Yt,{max:Su,abs:Ru}=Math,Cu={},Tu=new gt,Lu={};function Ou(t,e){let i,s,r,n,a=0,o=0,h=0,l=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,n=1.5*(t.blur||0),r=Ru(t.spread||0),a=Su(a,r+n-s),o=Su(o,r+n+i),h=Su(h,r+n+s),l=Su(l,r+n-i)}),a===o&&o===h&&h===l?a:[a,o,h,l]}function Iu(t,e,i){const{shapeBounds:s}=i;let r,n;y.fullImageShadow?(Pu(Cu,t.bounds),Bu(Cu,e.x-s.x,e.y-s.y),r=t.bounds,n=Cu):(r=s,n=e),t.copyWorld(i.canvas,r,n)}const{toOffsetOutBounds:Du}=Yt,Au={};const Mu=Ou;const Wu={shadow:function(t,e,i){let s,r;const{__nowWorld:n}=t,{shadow:a}=t.__,{worldCanvas:o,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=a.length-1;ku(h,Lu,l),a.forEach((a,g)=>{let f=1;if(a.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}_.setWorldShadow(Lu.offsetX+(a.x||0)*c*f,Lu.offsetY+(a.y||0)*u*f,(a.blur||0)*c*f,Uh.string(a.color)),r=jh.getShadowTransform(t,_,i,a,Lu,f),r&&_.setTransform(r),Iu(_,Lu,i),r&&_.resetTransform(),s=l,a.box&&(_.restore(),_.save(),o&&(_.copyWorld(_,l,n,"copy"),s=n),o?_.copyWorld(o,n,n,"destination-out"):_.copyWorld(i.canvas,d,h,"destination-out")),sa.copyCanvasByWorld(t,e,_,s,a.blendMode),p&&g<p&&_.clearWorld(s)}),_.recycle(s)},innerShadow:function(t,e,i){let s,r;const{__nowWorld:n}=t,{innerShadow:a}=t.__,{worldCanvas:o,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,_=e.getSameCanvas(),p=a.length-1;Du(h,Au,l),a.forEach((a,g)=>{let f=1;if(a.scaleFixed){const t=Math.abs(n.scaleX);t>1&&(f=1/t)}_.save(),_.setWorldShadow(Au.offsetX+(a.x||0)*c*f,Au.offsetY+(a.y||0)*u*f,(a.blur||0)*c*f),r=jh.getShadowTransform(t,_,i,a,Au,f,!0),r&&_.setTransform(r),Iu(_,Au,i),_.restore(),o?(_.copyWorld(_,l,n,"copy"),_.copyWorld(o,n,n,"source-out"),s=n):(_.copyWorld(i.canvas,d,h,"source-out"),s=l),_.fillWorld(s,Uh.string(a.color),"source-in"),sa.copyCanvasByWorld(t,e,_,s,a.blendMode),p&&g<p&&_.clearWorld(s)}),_.recycle(s)},blur:function(t,e,i){const{blur:s}=t.__;i.setWorldBlur(s*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){},getShadowRenderSpread:Ou,getShadowTransform:function(t,e,i,s,r,n,a){if(s.spread){const i=2*s.spread*n*(a?-1:1),{width:o,height:h}=t.__layout.strokeBounds;return Tu.set().scaleOfOuter({x:(r.x+r.width/2)*e.pixelRatio,y:(r.y+r.height/2)*e.pixelRatio},1+i/o,1+i/h),Tu}},isTransformShadow(t){},getInnerShadowSpread:Mu},{excludeRenderBounds:Fu}=ca;let Uu;function Nu(t,e,i,s,r,n,a,o){switch(e){case"grayscale":Uu||(Uu=!0,r.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,r,n){const a=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,a),n&&s.recycle(a);Yu(t,e,i,1,r,n)}(t,i,s,r,a,o);break;case"opacity-path":Yu(t,i,s,n,a,o);break;case"path":o&&i.restore()}}function zu(t){return t.getSameCanvas(!1,!0)}function Yu(t,e,i,s,r,n){const a=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,a,void 0,r),n?i.recycle(a):i.clearWorld(a)}t.Group.prototype.__renderMask=function(t,e){let i,s,r,n,a,o;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(i=h[l],o=i.__.mask,o){a&&(Nu(this,a,t,r,s,n,void 0,!0),s=r=null),"clipping"!==o&&"clipping-path"!==o||Fu(i,e)||i.__render(t,e),n=i.__.opacity,Uu=!1,"path"===o||"clipping-path"===o?(n<1?(a="opacity-path",r||(r=zu(t))):(a="path",t.save()),i.__clip(r||t,e)):(a="grayscale"===o?"grayscale":"alpha",s||(s=zu(t)),r||(r=zu(t)),i.__render(s,e));continue}const d=1===n&&i.__.__blendMode;d&&Nu(this,a,t,r,s,n,void 0,!1),Fu(i,e)||i.__render(r||t,e),d&&Nu(this,a,t,r,s,n,d,!1)}Nu(this,a,t,r,s,n,void 0,!0)};const Xu=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Hu=Xu+"_#~&*+\\=|≮≯≈≠=…",ju=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 Gu(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const Vu=Gu("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Ku=Gu("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),qu=Gu(Xu),Zu=Gu(Hu),Qu=Gu("- —/~|┆·");var Ju;!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"}(Ju||(Ju={}));const{Letter:$u,Single:t_,Before:e_,After:i_,Symbol:s_,Break:r_}=Ju;function n_(t){return Vu[t]?$u:Qu[t]?r_:Ku[t]?e_:qu[t]?i_:Zu[t]?s_:ju.test(t)?t_:$u}const a_={trimRight(t){const{words:e}=t;let i,s=0,r=e.length;for(let n=r-1;n>-1&&(i=e[n].data[0]," "===i.char);n--)s++,t.width-=i.width;s&&e.splice(r-s,s)}};function o_(t,e,i){switch(e){case"title":return i?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:h_}=a_,{Letter:l_,Single:d_,Before:c_,After:u_,Symbol:__,Break:p_}=Ju;let g_,f_,y_,m_,v_,x_,w_,b_,E_,P_,B_,k_,S_,R_,C_,T_,L_,O_=[];function I_(t,e){E_&&!b_&&(b_=E_),g_.data.push({char:t,width:e}),y_+=e}function D_(){m_+=y_,g_.width=y_,f_.words.push(g_),g_={data:[]},y_=0}function A_(){R_&&(C_.paraNumber++,f_.paraStart=!0,R_=!1),E_&&(f_.startCharSize=b_,f_.endCharSize=E_,b_=0),f_.width=m_,T_.width?h_(f_):L_&&M_(),O_.push(f_),f_={words:[]},m_=0}function M_(){m_>(C_.maxWidth||0)&&(C_.maxWidth=m_)}const{top:W_,right:F_,bottom:U_,left:N_}=t.Direction4;function z_(t,e,i){const{bounds:s,rows:r}=t;s[e]+=i;for(let t=0;t<r.length;t++)r[t][e]+=i}const Y_={getDrawData:function(t,e){n(t)||(t=String(t));let i=0,s=0,r=e.__getInput("width")||0,a=e.__getInput("height")||0;const{__padding:o}=e;o&&(r?(i=o[N_],r-=o[F_]+o[N_],!r&&(r=.01)):e.autoSizeAlign||(i=o[N_]),a?(s=o[W_],a-=o[W_]+o[U_],!a&&(a=.01)):e.autoSizeAlign||(s=o[W_]));const h={bounds:{x:i,y:s,width:r,height:a},rows:[],paraNumber:0,font:y.canvas.font=e.__font};return function(t,e,i){C_=t,O_=t.rows,T_=t.bounds,L_=!T_.width&&!i.autoSizeAlign;const{__letterSpacing:s,paraIndent:r,textCase:n}=i,{canvas:a}=y,{width:o}=T_;if(i.__isCharMode){const t="none"!==i.textWrap,h="break"===i.textWrap;R_=!0,B_=null,b_=w_=E_=y_=m_=0,g_={data:[]},f_={words:[]},s&&(e=[...e]);for(let i=0,l=e.length;i<l;i++)x_=e[i],"\n"===x_?(y_&&D_(),f_.paraEnd=!0,A_(),R_=!0):(P_=n_(x_),P_===l_&&"none"!==n&&(x_=o_(x_,n,!y_)),w_=a.measureText(x_).width,s&&(s<0&&(E_=w_),w_+=s),k_=P_===d_&&(B_===d_||B_===l_)||B_===d_&&P_!==u_,S_=!(P_!==c_&&P_!==d_||B_!==__&&B_!==u_),v_=R_&&r?o-r:o,t&&o&&m_+y_+w_>v_&&(h?(y_&&D_(),m_&&A_()):(S_||(S_=P_===l_&&B_==u_),k_||S_||P_===p_||P_===c_||P_===d_||y_+w_>v_?(y_&&D_(),m_&&A_()):m_&&A_()))," "===x_&&!0!==R_&&m_+y_===0||(P_===p_?(" "===x_&&y_&&D_(),I_(x_,w_),D_()):k_||S_?(y_&&D_(),I_(x_,w_)):I_(x_,w_)),B_=P_);y_&&D_(),m_&&A_(),O_.length>0&&(O_[O_.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{C_.paraNumber++,m_=a.measureText(t).width,O_.push({x:r||0,text:t,width:m_,paraStart:!0}),L_&&M_()})}(h,t,e),o&&function(t,e,i,s,r){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":z_(e,"x",t[N_]);break;case"right":z_(e,"x",-t[F_])}if(!r&&i.autoSizeAlign)switch(i.verticalAlign){case"top":z_(e,"y",t[W_]);break;case"bottom":z_(e,"y",-t[U_])}}(o,h,e,r,a),function(t,e){const{rows:i,bounds:s}=t,r=i.length,{__lineHeight:n,__baseLine:a,__letterSpacing:o,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:_,y:p,width:g,height:f}=s,y=n*r+(c?c*(t.paraNumber-1):0),m=a;if(h&&y>f)y=Math.max(f,n),r>1&&(t.overflow=r);else if(f||u)switch(d){case"middle":p+=(f-y)/2;break;case"bottom":p+=f-y}m+=p;let v,x,w,b=g||u?g:t.maxWidth;for(let a=0,d=r;a<d;a++){if(v=i[a],v.x=_,v.width<g||v.width>g&&!h)switch(l){case"center":v.x+=(b-v.width)/2;break;case"right":v.x+=b-v.width}v.paraStart&&c&&a>0&&(m+=c),v.y=m,m+=n,t.overflow>a&&m>y&&(v.isOverflow=!0,t.overflow=a+1),x=v.x,w=v.width,o<0&&(v.width<0?(w=-v.width+e.fontSize+o,x-=w,w+=e.fontSize):w-=o),x<s.x&&(s.x=x),w>s.width&&(s.width=w),h&&g&&g<w&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=p,s.height=y}(h,e),e.__isCharMode&&function(t,e,i){const{rows:s}=t,{textAlign:r,paraIndent:n,letterSpacing:a}=e,o=i&&r.includes("both"),h=o||i&&r.includes("justify"),l=h&&r.includes("letter");let d,c,u,_,p,g,f,y,m,v;s.forEach(t=>{t.words&&(p=n&&t.paraStart?n:0,y=t.words.length,h&&(v=!t.paraEnd||o,c=i-t.width-p,l?_=c/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=y>1?c/(y-1):0),g=a||t.isOverflow||l?0:u?1:2,t.isOverflow&&!a&&(t.textMode=!0),2===g?(t.x+=p,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=p,d=t.x,t.data=[],t.words.forEach((e,i)=>{1===g?(f={char:"",x:d},d=function(t,e,i){return t.forEach(t=>{i.char+=t.char,e+=t.width}),e}(e.data,d,f),(t.isOverflow||" "!==f.char)&&t.data.push(f)):d=function(t,e,i,s,r){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width,r&&(e+=r)}),e}(e.data,d,t.data,t.isOverflow,v&&_),v&&(m=i===y-1,u?m||(d+=u,t.width+=u):_&&(t.width+=_*(e.data.length-(m?1:0))))})),t.words=null)})}(h,e,r),h.overflow&&function(t,e,i,s){if(!s)return;const{rows:r,overflow:n}=t;let{textOverflow:a}=e;if(r.splice(n),a&&"show"!==a){let t,o;"hide"===a?a="":"ellipsis"===a&&(a="...");const h=a?y.canvas.measureText(a).width:0,l=i+s-h;("none"===e.textWrap?r:[r[n-1]]).forEach(e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],o=t.x+t.width,!(s===i&&o<l));s--){if(o<l&&" "!==t.char||!s){e.data.splice(s+1),e.width-=t.width;break}e.width-=t.width}e.width+=h,e.data.push({char:a,x:o}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(h,e,i,r),"none"!==e.textDecoration&&function(t,e){let i,s=0;const{fontSize:r,textDecoration:n}=e;switch(t.decorationHeight=r/11,d(n)?(i=n.type,n.color&&(t.decorationColor=Uh.string(n.color)),n.offset&&(s=Math.min(.3*r,Math.max(n.offset,.15*-r)))):i=n,i){case"under":t.decorationY=[.15*r+s];break;case"delete":t.decorationY=[.35*-r];break;case"under-delete":t.decorationY=[.15*r+s,.35*-r]}}(h,e),h}};const X_={string:function(t,e){if(!t)return"#000";const i=o(e)&&e<1;if(n(t)){if(!i||!Uh.object)return t;t=Uh.object(t)}let r=s(t.a)?1:t.a;i&&(r*=e);const a=t.r+","+t.g+","+t.b;return 1===r?"rgb("+a+")":"rgba("+a+","+r+")"}};return Object.assign(Fh,Y_),Object.assign(Uh,X_),Object.assign(Yh,Bc),Object.assign(Xh,ru),Object.assign(Hh,Eu),Object.assign(jh,Wu),Object.assign(ne,{interaction:(t,e,i,s)=>new Gd(t,e,i,s),hitCanvas:(t,e)=>new ph(t,e),hitCanvasManager:()=>new Kd}),fh(),t.AlignHelper=Bt,t.AroundHelper=bt,t.AutoBounds=Kt,t.BezierHelper=ri,t.Bounds=Gt,t.BoundsEvent=Ma,t.BoundsHelper=Yt,t.BoxData=nl,t.BranchHelper=ga,t.BranchRender=Lo,t.CanvasData=ml,t.CanvasManager=ue,t.ChildEvent=La,t.ColorConvert=Uh,t.Creator=ne,t.Cursor=Vd,t.DataHelper=u,t.Debug=Qt,t.DragBoundsHelper=Pd,t.Dragger=Md,t.Effect=jh,t.EllipseData=dl,t.EllipseHelper=_i,t.Event=Ta,t.EventCreator=de,t.Eventer=$a,t.Export=Vh,t.FileHelper=Xr,t.Filter=Gh,t.FourNumberHelper=k,t.FrameData=ol,t.GroupData=rl,t.HitCanvasManager=Kd,t.ImageData=yl,t.ImageEvent=Aa,t.ImageManager=Qr,t.IncrementId=v,t.InteractionBase=Gd,t.InteractionHelper=Td,t.Keyboard=dd,t.LayoutEvent=Ha,t.Layouter=Ch,t.LeafBounds=Ro,t.LeafBoundsHelper=ca,t.LeafData=p,t.LeafDataProxy=_o,t.LeafEventer=co,t.LeafHelper=sa,t.LeafLayout=Ca,t.LeafLevelList=_h,t.LeafList=uh,t.LeafMatrix=xo,t.LeafRender=Co,t.LeaferCanvas=ph,t.LeaferCanvasBase=Re,t.LeaferData=al,t.LeaferEvent=Ga,t.LeaferImage=en,t.LineData=hl,t.MathHelper=M,t.Matrix=gt,t.MatrixHelper=Q,t.MyDragEvent=Rd,t.MyImage=sd,t.MyPointerEvent=kd,t.MyTouchEvent=Cd,t.NeedConvertToCanvasCommandMap=Ie,t.OneRadian=F,t.PI2=U,t.PI_2=N,t.Paint=Yh,t.PaintGradient=Hh,t.PaintImage=Xh,t.PathArrow=zh,t.PathBounds=Lr,t.PathCommandDataHelper=ws,t.PathCommandMap=Le,t.PathCommandNodeHelper=pi,t.PathConvert=Ji,t.PathCorner=Fr,t.PathCreator=Fs,t.PathData=_l,t.PathDrawer=$s,t.PathHelper=Ce,t.PathNumberCommandLengthMap=We,t.PathNumberCommandMap=Me,t.PenData=pl,t.Picker=Ih,t.Platform=y,t.Plugin=re,t.Point=_t,t.PointHelper=ht,t.PointerButton=cd,t.PolygonData=cl,t.PropertyEvent=Ia,t.RectData=ll,t.RectHelper=Fe,t.RectRender=Bl,t.RenderEvent=ja,t.Renderer=Lh,t.ResizeEvent=Ya,t.Resource=qr,t.Run=ee,t.Selector=Dh,t.StarData=ul,t.State=Kh,t.StringNumberMap=qt,t.TaskItem=Gr,t.TaskProcessor=Vr,t.TextConvert=Fh,t.TextData=fl,t.Transition=qh,t.TwoPointBoundsHelper=yt,t.UIBounds=wl,t.UICreator=oe,t.UIData=il,t.UIEvent=ud,t.UIRender=El,t.UnitConvert=Nh,t.WaitHelper=va,t.WatchEvent=Xa,t.Watcher=mh,t.affectRenderBoundsType=En,t.affectStrokeBoundsType=xn,t.attr=on,t.autoLayoutType=un,t.boundsType=gn,t.canvasPatch=Yr,t.canvasSizeAttrs=Se,t.createAttr=function(t){return(e,i)=>{sn(e,i,nn(i,t))}},t.createDescriptor=nn,t.cursorType=Dn,t.dataProcessor=An,t.dataType=ln,t.decorateLeafAttr=an,t.defineDataProcessor=Mn,t.defineKey=sn,t.defineLeafAttr=hn,t.dimType=Bn,t.doBoundsType=yn,t.doStrokeType=wn,t.effectType=Ah,t.emptyData=i,t.eraserType=On,t.extraPropertyEventMap=Da,t.getBoundsData=Y,t.getDescriptor=rn,t.getMatrixData=X,t.getPointData=z,t.hitType=In,t.isArray=l,t.isData=function(t){return d(t)&&!l(t)},t.isEmptyData=c,t.isFinite=a,t.isNull=r,t.isNumber=o,t.isObject=d,t.isString=n,t.isUndefined=s,t.layoutProcessor=function(t){return(e,i)=>{sn(e,"__LayoutProcessor",{get:()=>t})}},t.leaferTransformAttrMap=Qa,t.maskType=Ln,t.naturalBoundsType=fn,t.opacityType=kn,t.path=Ur,t.pathInputType=mn,t.pathType=vn,t.pen=Nr,t.positionType=dn,t.registerUI=Hn,t.registerUIEvent=jn,t.resizeType=Mh,t.rewrite=Nn,t.rewriteAble=zn,t.rotationType=pn,t.scaleType=_n,t.scrollType=cn,t.sortType=Tn,t.strokeType=bn,t.surfaceType=Pn,t.tempBounds=Vt,t.tempMatrix=ft,t.tempPoint=pt,t.tryToNumber=function(t){return"string"==typeof t&&h.test(t)?+t:t},t.useCanvas=fh,t.useModule=Xn,t.version="1.11.1",t.visibleType=Sn,t.zoomLayerType=Wh,t}({});function Leafer(t){return new LeaferUI.Leafer(t)}Object.setPrototypeOf(Leafer,LeaferUI),Leafer.prototype=LeaferUI.Leafer.prototype;
|
|
2
2
|
//# sourceMappingURL=worker.min.js.map
|