leafer-game 2.2.6 → 2.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web.js +103 -71
- package/dist/web.min.js +1 -1
- package/dist/web.min.js.map +1 -1
- package/dist/web.module.js +103 -73
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +12 -12
package/dist/web.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var LeaferUI=function(t){"use strict";var e,i;function s(t,e,i,s){var n,r=arguments.length,o=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(r<3?n(o):r>3?n(e,i,o):n(e,i))||o);return r>3&&o&&Object.defineProperty(e,i,o),o}function n(t,e,i,s){return new(i||(i=Promise))(function(n,r){function o(t){try{h(s.next(t))}catch(t){r(t)}}function a(t){try{h(s.throw(t))}catch(t){r(t)}}function h(t){t.done?n(t.value):function(t){return t instanceof i?t:new i(function(e){e(t)})}(t.value).then(o,a)}h((s=s.apply(t,e||[])).next())})}t.PathNodeHandleType=void 0,(e=t.PathNodeHandleType||(t.PathNodeHandleType={}))[e.none=1]="none",e[e.free=2]="free",e[e.mirrorAngle=3]="mirrorAngle",e[e.mirror=4]="mirror","function"==typeof SuppressedError&&SuppressedError,t.Answer=void 0,(i=t.Answer||(t.Answer={}))[i.No=0]="No",i[i.Yes=1]="Yes",i[i.NoAndSkip=2]="NoAndSkip",i[i.YesAndSkip=3]="YesAndSkip";const r={};function o(t){return void 0===t}function a(t){return null==t}function h(t){return"string"==typeof t}const{isFinite:l}=Number;function d(t){return"number"==typeof t}const c=/^-?\d+(?:\.\d+)?$/;const{isArray:u}=Array;function p(t){return t&&"object"==typeof t}function _(t){return"{}"===JSON.stringify(t)}const g={default:(t,e)=>(f(e,t),f(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach(n=>{var r,o;if(s=e[n],(null==s?void 0:s.constructor)===Object&&(null===(r=t[n])||void 0===r?void 0:r.constructor)===Object)return f(t[n],e[n],i&&i[n]);i&&n in i?(null===(o=i[n])||void 0===o?void 0:o.constructor)===Object&&f(t[n]={},e[n],i[n]):t[n]=e[n]})},copyAttrs:(t,e,i)=>(i.forEach(i=>{o(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:f}=g;class y{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __usePathBox(){return this.__pathInputed}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(!o(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let i;for(let s in this)"_"!==s[0]&&(i=e?e[s]:void 0,t[s]=o(i)?this[s]: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(!o(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!o(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(u(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:s}=this;i.tag=this.__leaf.tag;for(let n in this)if("_"!==n[0]&&(t=this["_"+n],!o(t))){if("path"===n&&!this.__pathInputed)continue;e=s?s[n]:void 0,i[n]=o(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:n,e:r,f:o}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:n,e:r,f:o}}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,this.__complexData&&this.__complexData.destroy()}}const m={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CANVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=v;return e[t]?e[t]++:(e[t]=1,0)}},v=m;let w,x,b;const{max:E}=Math,P=[0,0,0,0],S={zero:[...P],tempFour:P,set:(t,e,i,s,n)=>(void 0===i&&(i=s=n=e),t[0]=e,t[1]=i,t[2]=s,t[3]=n,t),setTemp:(t,e,i,s)=>k(P,t,e,i,s),toTempAB(t,e,i){b=i?d(t)?e:t:[],d(t)?(w=B(t),x=e):d(e)?(w=t,x=B(e)):(w=t,x=e),4!==w.length&&(w=T(w)),4!==x.length&&(x=T(x))},get(t,e){let i;if(!d(t))switch(t.length){case 4:i=o(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]),!o(e))for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},max:(t,e,i)=>d(t)&&d(e)?E(t,e):(C(t,e,i),k(b,E(w[0],x[0]),E(w[1],x[1]),E(w[2],x[2]),E(w[3],x[3]))),add:(t,e,i)=>d(t)&&d(e)?t+e:(C(t,e,i),k(b,w[0]+x[0],w[1]+x[1],w[2]+x[2],w[3]+x[3])),swapAndScale(t,e,i,s){if(d(t))return e===i?t*e:[t*i,t*e];const n=s?t:[],[r,o,a,h]=4===t.length?t:T(t);return k(n,a*i,h*e,r*i,o*e)}},{set:k,get:T,setTemp:B,toTempAB:C}=S,{round:R,pow:L,max:D,floor:A,PI:O}=Math,I={},M={within:(t,e,i)=>(p(e)&&(i=e.max,e=e.min),!o(e)&&t<e&&(t=e),!o(i)&&t>i&&(t=i),t),fourNumber:S.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=o(e)?1e12:L(10,e);return-0===(t=R(t*i)/i)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,i,s){if(s||(s={}),e){const t=(d(e)?e:e.width||0)/i.width,n=(d(e)?e:e.height||0)/i.height;s.scaleX=t||n||1,s.scaleY=n||t||1}else t&&M.assignScale(s,t);return s},getScaleFixedData(t,e,i,s,n){let{scaleX:r,scaleY:o}=t;if((s||e)&&(r<0&&(r=-r),o<0&&(o=-o)),e)if(!0===e)r=o=i?1:1/r;else{let t;d(e)?t=e:"zoom-in"===e&&(t=1),t&&(r=o=r>t||o>t?i?1:1/r:i?1:1/t)}return I.scaleX=r,I.scaleY=o,I},assignScale(t,e){d(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>D(A(t),e)/t,randInt:F,randColor:t=>`rgba(${F(255)},${F(255)},${F(255)},${t||1})`};function F(t){return Math.round(Math.random()*t)}const W=O/180,U=2*O,N=O/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:V,sqrt:G}=Math,{float:q}=M,K={};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,n=1,r=0,o=0){t.a=e,t.b=i,t.c=s,t.d=n,t.e=r,t.f=o},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){$.toInnerPoint(t,e,K),$.scaleOfInner(t,K,i,s)},scaleOfInner(t,e,i,s=i){$.translateInner(t,e.x,e.y),$.scale(t,i,s),$.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:n,d:r}=t,o=j(e*=W),a=H(e);t.a=i*o-s*a,t.b=i*a+s*o,t.c=n*o-r*a,t.d=n*a+r*o},rotateOfOuter(t,e,i){$.toInnerPoint(t,e,K),$.rotateOfInner(t,K,i)},rotateOfInner(t,e,i){$.translateInner(t,e.x,e.y),$.rotate(t,i),$.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:n,c:r,d:o}=t;i&&(i*=W,t.a=s+r*i,t.b=n+o*i),e&&(e*=W,t.c=r+s*e,t.d=o+n*e)},skewOfOuter(t,e,i,s){$.toInnerPoint(t,e,K),$.skewOfInner(t,K,i,s)},skewOfInner(t,e,i,s=0){$.translateInner(t,e.x,e.y),$.skew(t,i,s),$.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:n,d:r,e:o,f:a}=t;t.a=e.a*i+e.b*n,t.b=e.a*s+e.b*r,t.c=e.c*i+e.d*n,t.d=e.c*s+e.d*r,t.e=e.e*i+e.f*n+o,t.f=e.e*s+e.f*r+a},multiplyParent(t,e,i,s,n){const{e:r,f:a}=t;if(i||(i=t),o(s)&&(s=1!==t.a||t.b||t.c||1!==t.d),s){const{a:s,b:r,c:o,d:a}=t;i.a=s*e.a+r*e.c,i.b=s*e.b+r*e.d,i.c=o*e.a+a*e.c,i.d=o*e.b+a*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=r*e.a+a*e.c+e.e,i.f=r*e.b+a*e.d+e.f},divide(t,e){$.multiply(t,$.tempInvert(e))},divideParent(t,e){$.multiplyParent(t,$.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=$;return $.copy(e,t),$.invert(e),e},invert(t){const{a:e,b:i,c:s,d:n,e:r,f:o}=t;if(i||s){const a=1/(e*n-i*s);t.a=n*a,t.b=-i*a,t.c=-s*a,t.d=e*a,t.e=-(r*n-o*s)*a,t.f=-(o*e-r*i)*a}else if(1===e&&1===n)t.e=-r,t.f=-o;else{const i=1/(e*n);t.a=n*i,t.d=e*i,t.e=-r*n*i,t.f=-o*e*i}},toOuterPoint(t,e,i,s){const{x:n,y:r}=e;i||(i=e),i.x=n*t.a+r*t.c,i.y=n*t.b+r*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:n,b:r,c:o,d:a}=t,h=1/(n*a-r*o),{x:l,y:d}=e;if(i||(i=e),i.x=(l*a-d*o)*h,i.y=(d*n-l*r)*h,!s){const{e:e,f:s}=t;i.x-=(e*a-s*o)*h,i.y-=(s*n-e*r)*h}},setLayout(t,e,i,s,n){const{x:r,y:a,scaleX:h,scaleY:l}=e;if(o(n)&&(n=e.rotation||e.skewX||e.skewY),n){const{rotation:i,skewX:s,skewY:n}=e,r=i*W,o=j(r),a=H(r);if(s||n){const e=s*W,i=n*W;t.a=(o+i*-a)*h,t.b=(a+i*o)*h,t.c=(e*o-a)*l,t.d=(o+e*a)*l}else t.a=o*h,t.b=a*h,t.c=-a*l,t.d=o*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=r,t.f=a,(i=i||s)&&$.translateInner(t,-i.x,-i.y,!s)},getLayout(t,e,i,s){const{a:n,b:r,c:o,d:a,e:h,f:l}=t;let d,c,u,p,_,g=h,f=l;if(r||o){const t=n*a-r*o;if(o&&!s){d=G(n*n+r*r),c=t/d;const e=n/d;u=r>0?V(e):-V(e)}else{c=G(o*o+a*a),d=t/c;const e=o/c;u=N-(a>0?V(-e):-V(e))}const e=q(j(u)),i=H(u);d=q(d),c=q(c),p=e?q((o/c+i)/e/W,9):0,_=e?q((r/d-i)/e/W,9):0,u=q(u/W)}else d=n,c=a,u=p=_=0;return(e=i||e)&&(g+=e.x*n+e.y*o,f+=e.x*r+e.y*a,i||(g-=e.x,f-=e.y)),{x:g,y:f,scaleX:d,scaleY:c,rotation:u,skewX:p,skewY:_}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:n,c:r,d:o}=t;n||r?i=(s*o-n*r)/(e=G(s*s+n*n)):(e=s,i=o)}return s.scaleX=e,s.scaleY=i,s},reset(t){$.set(t)}},$=Q,{float:J}=M,{toInnerPoint:tt,toOuterPoint:et}=Q,{sin:it,cos:st,abs:nt,sqrt:rt,atan2:ot,min:at,round:ht}=Math,lt={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=o(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?ht(t.x-.5)+.5:ht(t.x),t.y=e?ht(t.y-.5)+.5:ht(t.y)},move(t,e,i){p(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,s=1,n=1){i||(i=dt.defaultPoint);const r=st(e*=W),o=it(e),a=(t.x-i.x)/s,h=(t.y-i.y)/n;t.x=i.x+(a*r-h*o)*s,t.y=i.y+(a*o+h*r)*n},tempToInnerOf(t,e){const{tempPoint:i}=dt;return ut(i,t),tt(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=dt;return ut(i,t),et(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=dt;return ut(i,t),dt.toInnerRadiusPointOf(t,e,i),i},copyRadiusPoint:(t,e,i,s)=>(ut(t,e),pt(t,i,s),t),toInnerRadiusPointOf(t,e,i){i||(i=t),tt(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){tt(e,t,i)},toOuterOf(t,e,i){et(e,t,i)},toVertical(t,e,i,s){const n=e*W;t.x+=-Math.sin(n)*i,t.y+=Math.cos(n)*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)=>ct(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const n=nt(i-t),r=nt(s-e);return rt(n*n+r*r)},getMinDistanceFrom:(t,e,i,s,n,r)=>at(ct(t,e,i,s),ct(i,s,n,r)),getAngle:(t,e,i,s)=>_t(t,e,i,s)/W,getRotation:(t,e,i,s)=>(s||(s=e),dt.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/W),getRadianFrom(t,e,i,s,n,r,a,h){o(a)&&(a=i,h=s);const l=t-i,d=e-s,c=n-a,u=r-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e,i=1,s=1)=>ot((e.y-t.y)/s,(e.x-t.x)/i),getDistancePoint(t,e,i,s,n){const r=_t(t,e);return n&&(t=e),s||(e={}),e.x=t.x+st(r)*i,e.y=t.y+it(r)*i,e},toNumberPoints(t){let e=t;return p(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},isSame:(t,e,i)=>i?t.x===e.x&&t.y===e.y:J(t.x)===J(e.x)&&J(t.y)===J(e.y),reset(t){t.x=t.y=0}},dt=lt,{getDistanceFrom:ct,copy:ut,setRadius:pt,getAtan2:_t}=dt;class gt{constructor(t,e){this.set(t,e)}set(t,e){return p(t)?lt.copy(this,t):lt.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new gt(this)}move(t,e){return lt.move(this,t,e),this}scale(t,e){return lt.scale(this,t,e),this}scaleOf(t,e,i){return lt.scaleOf(this,t,e,i),this}rotate(t,e,i,s){return lt.rotate(this,t,e,i,s),this}rotateOf(t,e,i,s){return lt.rotate(this,e,t,i,s),this}getRotation(t,e,i){return lt.getRotation(this,t,e,i)}toInnerOf(t,e){return lt.toInnerOf(this,t,e),this}toOuterOf(t,e){return lt.toOuterOf(this,t,e),this}getCenter(t){return new gt(lt.getCenter(this,t))}getDistance(t){return lt.getDistance(this,t)}getDistancePoint(t,e,i,s){return new gt(lt.getDistancePoint(this,t,e,i,s))}getAngle(t,e,i){return lt.getAngle(this,t,e,i)}getAtan2(t,e,i){return lt.getAtan2(this,t,e,i)}isSame(t,e){return lt.isSame(this,t,e)}reset(){return lt.reset(this),this}}const ft=new gt;class yt{constructor(t,e,i,s,n,r){this.set(t,e,i,s,n,r)}set(t,e,i,s,n,r){return p(t)?Q.copy(this,t):Q.set(this,t,e,i,s,n,r),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:n,f:r}=this;return{a:t,b:e,c:i,d:s,e:n,f:r}}clone(){return new yt(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(){return Q.reset(this),this}}const mt=new yt,vt={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,n){wt(t,e,i),wt(t,e+s,i+n)},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:wt}=vt;var xt,bt;t.Direction4=void 0,(xt=t.Direction4||(t.Direction4={}))[xt.top=0]="top",xt[xt.right=1]="right",xt[xt.bottom=2]="bottom",xt[xt.left=3]="left",t.Direction9=void 0,(bt=t.Direction9||(t.Direction9={}))[bt.topLeft=0]="topLeft",bt[bt.top=1]="top",bt[bt.topRight=2]="topRight",bt[bt.right=3]="right",bt[bt.bottomRight=4]="bottomRight",bt[bt.bottom=5]="bottom",bt[bt.bottomLeft=6]="bottomLeft",bt[bt.left=7]="left",bt[bt.center=8]="center",bt[bt["top-left"]=0]="top-left",bt[bt["top-right"]=2]="top-right",bt[bt["bottom-right"]=4]="bottom-right",bt[bt["bottom-left"]=6]="bottom-left";const Et=[{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}];Et.forEach(t=>t.type="percent");const Pt={directionData:Et,tempPoint:{},get:St,toPoint(t,e,i,s,n,r){const o=St(t);i.x=o.x,i.y=o.y,"percent"===o.type&&(i.x*=e.width,i.y*=e.height,n&&(r||(i.x-=n.x,i.y-=n.y),o.x&&(i.x-=1===o.x?n.width:.5===o.x?o.x*n.width:0),o.y&&(i.y-=1===o.y?n.height:.5===o.y?o.y*n.height:0))),s||(i.x+=e.x,i.y+=e.y)},getPoint:(t,e,i,s=!0)=>(i||(i={}),Pt.toPoint(t,e,i,s),i)};function St(e){return h(e)?Et[t.Direction9[e]]:e}const{toPoint:kt}=Pt,Tt={toPoint(t,e,i,s,n,r){kt(t,i,s,n,e,r)}},{tempPointBounds:Bt,setPoint:Ct,addPoint:Rt,toBounds:Lt}=vt,{toOuterPoint:Dt}=Q,{float:At,fourNumber:Ot}=M,{floor:It,ceil:Mt}=Math;let Ft,Wt,Ut,Nt;const zt={},Yt={},Xt={},Ht={tempBounds:Xt,set(t,e=0,i=0,s=0,n=0){t.x=e,t.y=i,t.width=s,t.height=n},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,i,s,n){const{x:r,y:o,width:a,height:h}=e;if(u(i)){const e=Ot(i);s?jt.set(t,r+e[3],o+e[0],a-e[1]-e[3],h-e[2]-e[0]):jt.set(t,r-e[3],o-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),jt.set(t,r-i,o-i,a+2*i,h+2*i);n&&("width"===n?(t.y=o,t.height=h):(t.x=r,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,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),jt.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?Gt(e,t):e=t,i||(i=t),e.offsetX=jt.maxX(i),e.offsetY=jt.maxY(i),jt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||lt.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){lt.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(jt.copy(Xt,t),jt.toOuterOf(Xt,e),Xt),getOuterOf:(t,e)=>(t=Object.assign({},t),jt.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:n,e:r,f:o}=e;s>0?(i.width=t.width*s,i.x=r+t.x*s):(i.width=t.width*-s,i.x=r+t.x*s-i.width),n>0?(i.height=t.height*n,i.y=o+t.y*n):(i.height=t.height*-n,i.y=o+t.y*n-i.height)}else zt.x=t.x,zt.y=t.y,Dt(e,zt,Yt),Ct(Bt,Yt.x,Yt.y),zt.x=t.x+t.width,Dt(e,zt,Yt),Rt(Bt,Yt.x,Yt.y),zt.y=t.y+t.height,Dt(e,zt,Yt),Rt(Bt,Yt.x,Yt.y),zt.x=t.x,Dt(e,zt,Yt),Rt(Bt,Yt.x,Yt.y),Lt(Bt,i)},toInnerOf(t,e,i){i||(i=t),jt.move(i,-e.e,-e.f),jt.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,jt.getFitScale(t,e));return new yt(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,n=t.height/e.height;return i?Math.max(s,n):Math.min(s,n)},put(t,e,i="center",s=1,n=!0,r){r||(r=e),h(s)&&(s=jt.getFitScale(t,e,"cover"===s)),Xt.width=n?e.width*=s:e.width*s,Xt.height=n?e.height*=s:e.height*s,Tt.toPoint(i,Xt,t,r,!0,!0)},getSpread(t,e,i){const s={};return jt.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){jt.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){jt.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?Mt(t.width+e-t.x):Mt(t.width),t.height=i>t.y?Mt(t.height+i-t.y):Mt(t.height)},unsign(t){t.width<0&&(t.x+=t.width,t.width=-t.width),t.height<0&&(t.y+=t.height,t.height=-t.height)},float(t,e){t.x=At(t.x,e),t.y=At(t.y,e),t.width=At(t.width,e),t.height=At(t.height,e)},add(t,e,i){Ft=t.x+t.width,Wt=t.y+t.height,Ut=e.x,Nt=e.y,i||(Ut+=e.width,Nt+=e.height),Ft=Ft>Ut?Ft:Ut,Wt=Wt>Nt?Wt:Nt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=Ft-t.x,t.height=Wt-t.y},addList(t,e){jt.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){jt.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){jt.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let n,r=!0;for(let o=0,a=e.length;o<a;o++)n=i?i(e[o],o):e[o],n&&(n.width||n.height)&&(r?(r=!1,s||Gt(t,n)):Vt(t,n));r&&jt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Ct(Bt,t.x,t.y):Rt(Bt,t.x,t.y)),Lt(Bt,t)},setPoint(t,e){jt.set(t,e.x,e.y)},addPoint(t,e){Vt(t,e,!0)},getPoints(t){const{x:e,y:i,width:s,height:n}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+n},{x:e,y:i+n}]},getPoint:(t,e,i=!1,s)=>Pt.getPoint(e,t,s,i),hitRadiusPoint:(t,e,i)=>(i&&(e=lt.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=lt.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=jt.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=jt.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=jt.tempToOuterOf(e,i)),!jt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:n,width:r,height:o}=e;return Ft=s+r,Wt=n+o,Ut=t.x+t.width,Nt=t.y+t.height,s=s>t.x?s:t.x,n=n>t.y?n:t.y,Ft=Ft<Ut?Ft:Ut,Wt=Wt<Nt?Wt:Nt,r=Ft-s,o=Wt-n,{x:s,y:n,width:r,height:o}},intersect(t,e,i){jt.copy(t,jt.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,hasSize:t=>t.width&&t.height,reset(t){jt.set(t)}},jt=Ht,{add:Vt,copy:Gt}=jt;class qt{get minX(){return Ht.minX(this)}get minY(){return Ht.minY(this)}get maxX(){return Ht.maxX(this)}get maxY(){return Ht.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return p(t)?Ht.copy(this,t):Ht.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 qt(this)}move(t,e){return Ht.move(this,t,e),this}scale(t,e,i){return Ht.scale(this,t,e,i),this}scaleOf(t,e,i){return Ht.scaleOf(this,t,e,i),this}toOuterOf(t,e){return Ht.toOuterOf(this,t,e),this}toInnerOf(t,e){return Ht.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Ht.getFitMatrix(this,t,e)}put(t,e,i){Ht.put(this,t,e,i)}spread(t,e){return Ht.spread(this,t,e),this}shrink(t,e){return Ht.shrink(this,t,e),this}ceil(){return Ht.ceil(this),this}unsign(){return Ht.unsign(this),this}float(t){return Ht.float(this,t),this}add(t){return Ht.add(this,t),this}addList(t){return Ht.setList(this,t,!0),this}setList(t){return Ht.setList(this,t),this}addListWithFn(t,e){return Ht.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Ht.setListWithFn(this,t,e),this}setPoint(t){return Ht.setPoint(this,t),this}setPoints(t){return Ht.setPoints(this,t),this}addPoint(t){return Ht.addPoint(this,t),this}getPoints(){return Ht.getPoints(this)}getPoint(t,e,i){return Ht.getPoint(this,t,e,i)}hitPoint(t,e){return Ht.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Ht.hitRadiusPoint(this,t,e)}hit(t,e){return Ht.hit(this,t,e)}includes(t,e){return Ht.includes(this,t,e)}intersect(t,e){return Ht.intersect(this,t,e),this}getIntersect(t,e){return new qt(Ht.getIntersectData(this,t,e))}isSame(t){return Ht.isSame(this,t)}isEmpty(){return Ht.isEmpty(this)}reset(){Ht.reset(this)}}const Kt=new qt;class Zt{constructor(t,e,i,s,n,r){p(t)?this.copy(t):this.set(t,e,i,s,n,r)}set(t=0,e=0,i=0,s=0,n=0,r=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=n,this.height=r}copy(t){const{top:e,right:i,bottom:s,left:n,width:r,height:o}=t;this.set(e,i,s,n,r,o)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:n,width:r,height:o}=this;return new qt(n,e,r||t.width-n-i,o||t.height-e-s)}}const Qt={number:(t,e)=>p(t)?"percent"===t.type?t.value*e:t.value:t},$t={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},{floor:Jt,max:te}=Math,ee={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||ie.maxCacheSize),isSuperLarge:(t,e,i)=>ie.isLarge(t,e,i,ie.maxPatternSize),getRealURL(t){const{prefix:e,suffix:i}=ie;return!i||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+i),e&&"/"===t[0]&&(t=e+t),t},resize(t,e,i,s,n,r,o,a,h,l){const d=te(Jt(e+(s||0)),1),c=te(Jt(i+(n||0)),1);let u,p,_;l&&(_=Qt.number(l.offset,"x"===l.type?e:i))&&("x"===l.type?u=!0:p=!0);const g=ee.origin.createCanvas(p?2*d:d,u?2*c:c),f=g.getContext("2d");if(a&&(f.globalAlpha=a),f.imageSmoothingEnabled=!1!==o,ie.canUse(t)){if(r){const s=e/r.width,n=i/r.height;f.setTransform(s,0,0,n,-r.x*s,-r.y*n),f.drawImage(t,0,0,t.width,t.height)}else f.drawImage(t,0,0,e,i);_&&(f.drawImage(g,0,0,d,c,u?_-d:d,u?c:_-c,d,c),f.drawImage(g,0,0,d,c,u?_:d,u?c:_,d,c))}return g},canUse:t=>t&&t.width&&!t.__closed,setPatternTransform(t,e,i){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}i&&g.stintSet(i,"transform",e)}}},{image:ie}=ee,{randColor:se}=M;class ne{constructor(t){this.repeatMap={},this.name=t}static get(t){return new ne(t)}static set filter(t){this.filterList=re(t)}static set exclude(t){this.excludeList=re(t)}static drawRepaint(t,e){const i=se();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===ne.showBounds,n=t.__nowWorld,r=se();s&&(e.setWorld(n),t.__drawHitPath(e),e.fillStyle=r.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(r,2),s?e.stroke():e.strokeWorld(n,r)}log(...t){if(oe.enable){if(oe.filterList.length&&oe.filterList.every(t=>t!==this.name))return;if(oe.excludeList.length&&oe.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){oe.enable&&this.warn(...t)}warn(...t){oe.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 re(t){return t?h(t)&&(t=[t]):t=[],t}ne.filterList=[],ne.excludeList=[],ne.showWarn=!0;const oe=ne,ae=ne.get("RunTime"),he={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=m.create(m.RUNTIME);return le.currentId=le.idMap[i]=e?performance.now():Date.now(),le.currentName=le.nameMap[i]=t,le.nameToIdMap[t]=i,i},end(t,e){const i=le.idMap[t],s=le.nameMap[t],n=e?(performance.now()-i)/1e3:Date.now()-i;le.idMap[t]=le.nameMap[t]=le.nameToIdMap[s]=void 0,ae.log(s,n,"ms")},endOfName(t,e){const i=le.nameToIdMap[t];o(i)||le.end(i,e)}},le=he,de=[],ce={list:{},add(t,...e){this.list[t]=!0,de.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(()=>de.forEach(t=>ce.has(t,!0)));const ue={editor:t=>ce.need("editor")},pe=ne.get("UICreator"),_e={list:{},register(t){const{__tag:e}=t.prototype;ge[e]&&pe.repeat(e),ge[e]=t},get(t,e,i,s,n,r){if(!ge[t])return void pe.warn("not register "+t);const a=new ge[t](e);return o(i)||(a.x=i,s&&(a.y=s),n&&(a.width=n),r&&(a.height=r)),a}},{list:ge}=_e,fe=ne.get("EventCreator"),ye={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],h(e)&&(me[e]&&fe.repeat(e),me[e]=t)})},changeName(t,e){const i=me[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,me[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new me[t](...e)},{nameList:me}=ye;class ve{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:i}=this;for(let s=0,n=i.length;s<n;s++)if(e=i[s],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const s=ue.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 we(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)}}const xe=[];function be(){return(t,e)=>{xe.push(e)}}const Ee=[];class Pe{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||Ee)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;xe.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,i,s,n,r){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,n,r){p(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,i,s,n,r)}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,n,r,o,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*a;s+=e,e=0,r+=t,a-=t}if(i<0){const t=-i/n*h;n+=i,i=0,o+=t,h-=t}this.context.drawImage(t,e,i,s,n,r,o,a,h);break;case 5:this.context.drawImage(t,e,i,s,n);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,n,r){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,n,r){}arcTo(t,e,i,s,n){}ellipse(t,e,i,s,n,r,o,a){}rect(t,e,i,s){}roundRect(t,e,i,s,n){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,n,r){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}}s([we("imageSmoothingEnabled")],Pe.prototype,"smooth",void 0),s([we("imageSmoothingQuality")],Pe.prototype,"smoothLevel",void 0),s([we("globalAlpha")],Pe.prototype,"opacity",void 0),s([we()],Pe.prototype,"fillStyle",void 0),s([we()],Pe.prototype,"strokeStyle",void 0),s([we("lineWidth")],Pe.prototype,"strokeWidth",void 0),s([we("lineCap")],Pe.prototype,"strokeCap",void 0),s([we("lineJoin")],Pe.prototype,"strokeJoin",void 0),s([we("lineDashOffset")],Pe.prototype,"dashOffset",void 0),s([we()],Pe.prototype,"miterLimit",void 0),s([we()],Pe.prototype,"shadowBlur",void 0),s([we()],Pe.prototype,"shadowColor",void 0),s([we()],Pe.prototype,"shadowOffsetX",void 0),s([we()],Pe.prototype,"shadowOffsetY",void 0),s([we()],Pe.prototype,"filter",void 0),s([we()],Pe.prototype,"font",void 0),s([we()],Pe.prototype,"fontKerning",void 0),s([we()],Pe.prototype,"fontStretch",void 0),s([we()],Pe.prototype,"fontVariantCaps",void 0),s([we()],Pe.prototype,"textAlign",void 0),s([we()],Pe.prototype,"textBaseline",void 0),s([we()],Pe.prototype,"textRendering",void 0),s([we()],Pe.prototype,"wordSpacing",void 0),s([we()],Pe.prototype,"letterSpacing",void 0),s([we()],Pe.prototype,"direction",void 0),s([be()],Pe.prototype,"setTransform",null),s([be()],Pe.prototype,"resetTransform",null),s([be()],Pe.prototype,"getTransform",null),s([be()],Pe.prototype,"save",null),s([be()],Pe.prototype,"restore",null),s([be()],Pe.prototype,"translate",null),s([be()],Pe.prototype,"scale",null),s([be()],Pe.prototype,"rotate",null),s([be()],Pe.prototype,"fill",null),s([be()],Pe.prototype,"stroke",null),s([be()],Pe.prototype,"clip",null),s([be()],Pe.prototype,"fillRect",null),s([be()],Pe.prototype,"strokeRect",null),s([be()],Pe.prototype,"clearRect",null),s([be()],Pe.prototype,"beginPath",null),s([be()],Pe.prototype,"moveTo",null),s([be()],Pe.prototype,"lineTo",null),s([be()],Pe.prototype,"bezierCurveTo",null),s([be()],Pe.prototype,"quadraticCurveTo",null),s([be()],Pe.prototype,"closePath",null),s([be()],Pe.prototype,"arc",null),s([be()],Pe.prototype,"arcTo",null),s([be()],Pe.prototype,"ellipse",null),s([be()],Pe.prototype,"rect",null),s([be()],Pe.prototype,"roundRect",null),s([be()],Pe.prototype,"createConicGradient",null),s([be()],Pe.prototype,"createLinearGradient",null),s([be()],Pe.prototype,"createPattern",null),s([be()],Pe.prototype,"createRadialGradient",null),s([be()],Pe.prototype,"fillText",null),s([be()],Pe.prototype,"measureText",null),s([be()],Pe.prototype,"strokeText",null);const{copy:Se,multiplyParent:ke,pixelScale:Te}=Q,{round:Be}=Math,Ce=new qt,Re=new qt,Le={width:1,height:1,pixelRatio:1},De=["width","height","pixelRatio"];class Ae extends Pe{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=Le),this.manager=e,this.innerId=m.create(m.CANVAS);const{width:i,height:s,pixelRatio:n}=t;this.autoLayout=!i||!s,this.size.pixelRatio=n||ee.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;g.copyAttrs(s,t,De),De.forEach(t=>s[t]||(s[t]=1)),this.bounds=new qt(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,n=this.worldTransform;e&&ke(t,e,n),Te(t,i,n),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(n.e=Be(n.e-.5)+.5,n.f=Be(n.f-.5)+.5):(n.e=Be(n.e),n.f=Be(n.f))),this.setTransform(n.a,n.b,n.c,n.d,n.e,n.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:s,dashPattern:n,dashOffset:r,miterLimit:a}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(s=e.strokeJoin),o(e.dashPattern)||(n=e.dashPattern),o(e.dashOffset)||(r=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=i,this.strokeJoin=s,this.dashPattern=n,this.dashOffset=r,this.miterLimit=a}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return!0}hitStroke(t,e){return!0}hitPixel(t,e,i=1){return!0}setWorldShadow(t,e,i,s){const{pixelRatio:n}=this;this.shadowOffsetX=t*n,this.shadowOffsetY=e*n,this.shadowBlur=i*n,this.shadowColor=s||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,i,s,n){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,n),i?(this.setTempPixelBounds2(i,n),i=Re):i=Ce,this.drawImage(t.view,Ce.x,Ce.y,Ce.width,Ce.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,n){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Ht.tempToOuterOf(i,e),s,n),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,n),this.drawImage(t.view,Ce.x,Ce.y,Ce.width,Ce.height,i.x,i.y,i.width,i.height),s&&(this.blendMode="source-over"))}copyWorldByReset(t,e,i,s,n,r){this.resetTransform(),this.copyWorld(t,e,i,s,r),n||this.useWorldTransform()}useGrayscaleAlpha(t){if(this.setTempPixelBounds(t,!0,!0),!Ce.width||!Ce.height)return;let e,i;const{context:s}=this,n=s.getImageData(Ce.x,Ce.y,Ce.width,Ce.height),{data:r}=n;for(let t=0,s=r.length;t<s;t+=4)i=.299*r[t]+.587*r[t+1]+.114*r[t+2],(e=r[t+3])&&(r[t+3]=255===e?i:e*(i/255));s.putImageData(n,Ce.x,Ce.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(Ce.x,Ce.y,Ce.width,Ce.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(Ce.x,Ce.y,Ce.width,Ce.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(Ce.x,Ce.y,Ce.width,Ce.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(Ce.x,Ce.y,Ce.width,Ce.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(Ce,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(Re,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,n=this.manager?this.manager.get(i):ue.canvas(Object.assign({},i));return n.save(),t&&(Se(n.worldTransform,this.worldTransform),n.useWorldTransform()),e&&(n.smooth=this.smooth),n.pixelSnap!==s&&(n.pixelSnap=s),n}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 Oe={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Ie={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Me=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},Ie),Fe={M:3,m:3,L:3,l:3,H:2,h:2,V:2,v:2,C:7,c:7,S:5,s:5,Q:5,q:5,T:3,t:3,A:8,a:8,Z:1,z:1,N:5,D:9,X:6,G:9,F:5,O:7,P:4,U:6},We={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},Ue=Object.assign(Object.assign({},We),Ie),Ne=Me,ze={};for(let t in Ne)ze[Ne[t]]=t;const Ye={};for(let t in Ne)Ye[Ne[t]]=Fe[t];const Xe={drawRoundRect(t,e,i,s,n,r){const o=M.fourNumber(r,Math.min(s/2,n/2)),a=e+s,h=i+n;o[0]?t.moveTo(e+o[0],i):t.moveTo(e,i),o[1]?t.arcTo(a,i,a,h,o[1]):t.lineTo(a,i),o[2]?t.arcTo(a,h,e,h,o[2]):t.lineTo(a,h),o[3]?t.arcTo(e,h,e,i,o[3]):t.lineTo(e,h),o[0]?t.arcTo(e,i,a,i,o[0]):t.lineTo(e,i)}},{sin:He,cos:je,hypot:Ve,atan2:Ge,ceil:qe,abs:Ke,PI:Ze,sqrt:Qe,pow:$e}=Math,{setPoint:Je,addPoint:ti}=vt,{set:ei,toNumberPoints:ii}=lt,{M:si,L:ni,C:ri,Q:oi,Z:ai}=Me,hi={},li={points(t,e,i,s){let n=ii(e);if(t.push(si,n[0],n[1]),i&&n.length>5){let e,r,o,a,h,l,d,c,u,p,_,g,f,y,m,v=n.length;const w=!0===i?.5:i;s&&(n=[n[v-2],n[v-1],...n,n[0],n[1],n[2],n[3]],v=n.length);for(let i=2;i<v-2;i+=2)e=n[i-2],r=n[i-1],o=n[i],a=n[i+1],h=n[i+2],l=n[i+3],_=o-e,g=a-r,f=Qe($e(_,2)+$e(g,2)),y=Qe($e(h-o,2)+$e(l-a,2)),(f||y)&&(m=f+y,f=w*f/m,y=w*y/m,h-=e,l-=r,d=o-f*h,c=a-f*l,2===i?s||t.push(oi,d,c,o,a):(_||g)&&t.push(ri,u,p,d,c,o,a),u=o+y*h,p=a+y*l);s||t.push(oi,u,p,n[v-2],n[v-1])}else for(let e=2,i=n.length;e<i;e+=2)t.push(ni,n[e],n[e+1]);s&&t.push(ai)},rect(t,e,i,s,n){Oe.creator.path=t,Oe.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+n).lineTo(e,i+n).lineTo(e,i)},roundRect(t,e,i,s,n,r){Oe.creator.path=[],Xe.drawRoundRect(Oe.creator,e,i,s,n,r),t.push(...Oe.convertToCanvasData(Oe.creator.path,!0))},arcTo(t,e,i,s,n,r,o,a,h,l,d){const c=s-e,u=n-i,p=r-s,_=o-n;let g=Ge(u,c),f=Ge(_,p);const y=Ve(c,u),m=Ve(p,_);let v=f-g;if(v<0&&(v+=U),y<1e-12||m<1e-12||v<1e-12||Ke(v-Ze)<1e-12)return t&&t.push(ni,s,n),h&&(Je(h,e,i),ti(h,s,n)),d&&ei(d,e,i),void(l&&ei(l,s,n));const w=c*_-p*u<0,x=w?-1:1,b=a/je(v/2),E=s+b*je(g+v/2+N*x),P=n+b*He(g+v/2+N*x);return g-=N*x,f-=N*x,ui(t,E,P,a,a,0,g/W,f/W,w,h,l,d)},arc:(t,e,i,s,n,r,o,a,h,l)=>ui(t,e,i,s,s,0,n,r,o,a,h,l),ellipse(t,e,i,s,n,r,o,a,h,l,d,c){const u=r*W,p=He(u),_=je(u);let g=o*W,f=a*W;g>Ze&&(g-=U),f<0&&(f+=U);let y=f-g;if(y<0?y+=U:y>U&&(y-=U),h){360===Ke(a-o)?y=-U:y-=U}const m=qe(Ke(y/N)),v=y/m,w=He(v/4),x=8/3*w*w/He(v/2);f=g+v;let b,E,P,S,k,T,B,C,R=je(g),L=He(g),D=P=_*s*R-p*n*L,A=S=p*s*R+_*n*L,O=e+P,I=i+S;t&&t.push(t.length?ni:si,O,I),l&&Je(l,O,I),c&&ei(c,O,I);for(let r=0;r<m;r++)b=je(f),E=He(f),P=_*s*b-p*n*E,S=p*s*b+_*n*E,k=e+D-x*(_*s*L+p*n*R),T=i+A-x*(p*s*L-_*n*R),B=e+P+x*(_*s*E+p*n*b),C=i+S+x*(p*s*E-_*n*b),t&&t.push(ri,k,T,B,C,e+P,i+S),l&&ci(e+D,i+A,k,T,B,C,e+P,i+S,l,!0),D=P,A=S,R=b,L=E,g=f,f+=v;d&&ei(d,e+P,i+S)},quadraticCurveTo(t,e,i,s,n,r,o){t.push(ri,(e+2*s)/3,(i+2*n)/3,(r+2*s)/3,(o+2*n)/3,r,o)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,n,r,o,a){ci(t,e,(t+2*i)/3,(e+2*s)/3,(n+2*i)/3,(r+2*s)/3,n,r,o,a)},toTwoPointBounds(t,e,i,s,n,r,o,a,h,l){const d=[];let c,u,p,_,g,f,y,m,v=t,w=i,x=n,b=o;for(let t=0;t<2;++t)if(1==t&&(v=e,w=s,x=r,b=a),c=-3*v+9*w-9*x+3*b,u=6*v-12*w+6*x,p=3*w-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;_=-p/u,0<_&&_<1&&d.push(_)}else y=u*u-4*p*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?ti(h,t,e):Je(h,t,e),ti(h,o,a);for(let l=0,c=d.length;l<c;l++)di(d[l],t,e,i,s,n,r,o,a,hi),ti(h,hi.x,hi.y)},getPointAndSet(t,e,i,s,n,r,o,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,p=3*d*t*t,_=t*t*t;l.x=c*e+u*s+p*r+_*a,l.y=c*i+u*n+p*o+_*h},getPoint(t,e,i,s,n,r,o,a,h){const l={};return di(t,e,i,s,n,r,o,a,h,l),l},getDerivative(t,e,i,s,n){const r=1-t;return 3*r*r*(i-e)+6*r*t*(s-i)+3*t*t*(n-s)},cut(t,e,i,s,n,r,o,a,h){if(t<=0)return{left:null,right:[s,n,r,o,a,h]};if(t>=1)return{left:[s,n,r,o,a,h],right:null};const l=1-t,d=e*l+s*t,c=i*l+n*t,u=s*l+r*t,p=n*l+o*t,_=r*l+a*t,g=o*l+h*t,f=d*l+u*t,y=c*l+p*t,m=u*l+_*t,v=p*l+g*t;return{left:[d,c,f,y,f*l+m*t,y*l+v*t],right:[m,v,_,g,a,h]}}},{getPointAndSet:di,toTwoPointBounds:ci,ellipse:ui}=li,{sin:pi,cos:_i,sqrt:gi,atan2:fi}=Math,{ellipse:yi}=li,mi={ellipticalArc(t,e,i,s,n,r,o,a,h,l,d){const c=(h-e)/2,u=(l-i)/2,p=r*W,_=pi(p),g=_i(p),f=-g*c-_*u,y=-g*u+_*c,m=s*s,v=n*n,w=y*y,x=f*f,b=m*v-m*w-v*x;let E=0;if(b<0){const t=gi(1-b/(m*v));s*=t,n*=t}else E=(o===a?-1:1)*gi(b/(m*w+v*x));const P=E*s*y/n,S=-E*n*f/s,k=fi((y-S)/n,(f-P)/s),T=fi((-y-S)/n,(-f-P)/s);let B=T-k;0===a&&B>0?B-=U:1===a&&B<0&&(B+=U);const C=e+c+g*P-_*S,R=i+u+_*P+g*S,L=B<0?1:0;d||ee.ellipseToCurve?yi(t,C,R,s,n,r,k/W,T/W,L):s!==n||r?t.push(Me.G,C,R,s,n,r,k/W,T/W,L):t.push(Me.O,C,R,s,k/W,T/W,L)}},vi={toCommand:t=>[],toNode:t=>[]},{M:wi,m:xi,L:bi,l:Ei,H:Pi,h:Si,V:ki,v:Ti,C:Bi,c:Ci,S:Ri,s:Li,Q:Di,q:Ai,T:Oi,t:Ii,A:Mi,a:Fi,Z:Wi,z:Ui,N:Ni,D:zi,X:Yi,G:Xi,F:Hi,O:ji,P:Vi,U:Gi}=Me,{rect:qi,roundRect:Ki,arcTo:Zi,arc:Qi,ellipse:$i,quadraticCurveTo:Ji}=li,{ellipticalArc:ts}=mi,es=ne.get("PathConvert"),is={},ss={current:{dot:0},stringify(t,e){let i,s,n,r=0,o=t.length,a="";for(;r<o;){s=t[r],i=Ye[s],a+=s===n?" ":ze[s];for(let s=1;s<i;s++)a+=M.float(t[r+s],e),s===i-1||(a+=" ");n=s,r+=i}return a},parse(t,e){let i,s,n,r="";const o=[],a=e?Ue:We;for(let e=0,h=t.length;e<h;e++)s=t[e],$t[s]?("."===s&&(ns.dot&&(rs(o,r),r=""),ns.dot++),"0"===r&&"."!==s&&(rs(o,r),r=""),r+=s):Me[s]?(r&&(rs(o,r),r=""),ns.name=Me[s],ns.length=Fe[s],ns.index=0,rs(o,ns.name),"m"===s?ns.name=Me.l:"M"===s&&(ns.name=Me.L),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===n||"E"===n?r+=s:(r&&rs(o,r),r=s):r&&(rs(o,r),r=""),n=s;return r&&rs(o,r),i?ss.toCanvasData(o,e):o},toCanvasData(t,e){let i,s,n,r,o,a=0,h=0,l=0,d=0,c=0,u=0,p=0,_=t.length;const g=[];for(;p<_;){switch(n=t[p],n){case xi:t[p+1]+=a,t[p+2]+=h;case wi:a=c=t[p+1],h=u=t[p+2],g.push(wi,a,h),p+=3;break;case Si:t[p+1]+=a;case Pi:a=t[p+1],g.push(bi,a,h),p+=2;break;case Ti:t[p+1]+=h;case ki:h=t[p+1],g.push(bi,a,h),p+=2;break;case Ei:t[p+1]+=a,t[p+2]+=h;case bi:a=t[p+1],h=t[p+2],g.push(bi,a,h),p+=3;break;case Li:t[p+1]+=a,t[p+2]+=h,t[p+3]+=a,t[p+4]+=h,n=Ri;case Ri:o=r===Bi||r===Ri,l=o?2*a-i:a,d=o?2*h-s:h,i=t[p+1],s=t[p+2],a=t[p+3],h=t[p+4],g.push(Bi,l,d,i,s,a,h),p+=5;break;case Ci:t[p+1]+=a,t[p+2]+=h,t[p+3]+=a,t[p+4]+=h,t[p+5]+=a,t[p+6]+=h,n=Bi;case Bi:i=t[p+3],s=t[p+4],a=t[p+5],h=t[p+6],g.push(Bi,t[p+1],t[p+2],i,s,a,h),p+=7;break;case Ii:t[p+1]+=a,t[p+2]+=h,n=Oi;case Oi:o=r===Di||r===Oi,i=o?2*a-i:a,s=o?2*h-s:h,e?Ji(g,a,h,i,s,t[p+1],t[p+2]):g.push(Di,i,s,t[p+1],t[p+2]),a=t[p+1],h=t[p+2],p+=3;break;case Ai:t[p+1]+=a,t[p+2]+=h,t[p+3]+=a,t[p+4]+=h,n=Di;case Di:i=t[p+1],s=t[p+2],e?Ji(g,a,h,i,s,t[p+3],t[p+4]):g.push(Di,i,s,t[p+3],t[p+4]),a=t[p+3],h=t[p+4],p+=5;break;case Fi:t[p+6]+=a,t[p+7]+=h;case Mi:ts(g,a,h,t[p+1],t[p+2],t[p+3],t[p+4],t[p+5],t[p+6],t[p+7],e),a=t[p+6],h=t[p+7],p+=8;break;case Ui:case Wi:g.push(Wi),a=c,h=u,p++;break;case Ni:a=t[p+1],h=t[p+2],e?qi(g,a,h,t[p+3],t[p+4]):os(g,t,p,5),p+=5;break;case zi:a=t[p+1],h=t[p+2],e?Ki(g,a,h,t[p+3],t[p+4],[t[p+5],t[p+6],t[p+7],t[p+8]]):os(g,t,p,9),p+=9;break;case Yi:a=t[p+1],h=t[p+2],e?Ki(g,a,h,t[p+3],t[p+4],t[p+5]):os(g,t,p,6),p+=6;break;case Xi:$i(e?g:os(g,t,p,9),t[p+1],t[p+2],t[p+3],t[p+4],t[p+5],t[p+6],t[p+7],t[p+8],null,is),a=is.x,h=is.y,p+=9;break;case Hi:e?$i(g,t[p+1],t[p+2],t[p+3],t[p+4],0,0,360,!1):os(g,t,p,5),a=t[p+1]+t[p+3],h=t[p+2],p+=5;break;case ji:Qi(e?g:os(g,t,p,7),t[p+1],t[p+2],t[p+3],t[p+4],t[p+5],t[p+6],null,is),a=is.x,h=is.y,p+=7;break;case Vi:e?Qi(g,t[p+1],t[p+2],t[p+3],0,360,!1):os(g,t,p,4),a=t[p+1]+t[p+3],h=t[p+2],p+=4;break;case Gi:Zi(e?g:os(g,t,p,6),a,h,t[p+1],t[p+2],t[p+3],t[p+4],t[p+5],null,is),a=is.x,h=is.y,p+=6;break;default:return es.error(`command: ${n} [index:${p}]`,t),g}r=n}return g},objectToCanvasData(t){if(t[0].name.length>1)return vi.toCommand(t);{const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(wi,t.x,t.y);break;case"L":e.push(bi,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(Di,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Wi)}}),e}},copyData(t,e,i,s){for(let n=i,r=i+s;n<r;n++)t.push(e[n])},pushData(t,e){ns.index===ns.length&&(ns.index=1,t.push(ns.name)),t.push(Number(e)),ns.index++,ns.dot=0}},{current:ns,pushData:rs,copyData:os}=ss,{M:as,L:hs,C:ls,Q:ds,Z:cs,N:us,D:ps,X:_s,G:gs,F:fs,O:ys,P:ms,U:vs}=Me,{getMinDistanceFrom:ws,getRadianFrom:xs}=lt,{tan:bs,min:Es,abs:Ps}=Math,Ss={},ks=ne.get("PointsCurve"),Ts={pointsCurveList:{},beginPath(t){t.length=0},moveTo(t,e,i){t.push(as,e,i)},lineTo(t,e,i){t.push(hs,e,i)},bezierCurveTo(t,e,i,s,n,r,o){t.push(ls,e,i,s,n,r,o)},quadraticCurveTo(t,e,i,s,n){t.push(ds,e,i,s,n)},closePath(t){t.push(cs)},rect(t,e,i,s,n){t.push(us,e,i,s,n)},roundRect(t,e,i,s,n,r){if(d(r))t.push(_s,e,i,s,n,r);else{const o=M.fourNumber(r);o?t.push(ps,e,i,s,n,...o):t.push(us,e,i,s,n)}},ellipse(t,e,i,s,n,r,o,h,l){if(s===n)return Cs(t,e,i,s,o,h,l);a(r)?t.push(fs,e,i,s,n):(a(o)&&(o=0),a(h)&&(h=360),t.push(gs,e,i,s,n,r,o,h,l?1:0))},arc(t,e,i,s,n,r,o){a(n)?t.push(ms,e,i,s):(a(n)&&(n=0),a(r)&&(r=360),t.push(ys,e,i,s,n,r,o?1:0))},arcTo(t,e,i,s,n,r,a,h,l){if(!o(a)){const t=ws(a,h,e,i,s,n)/(l?1:2);r=Es(r,Es(t,t*Ps(bs(xs(a,h,e,i,s,n)/2))))}t.push(vs,e,i,s,n,r)},drawEllipse(t,e,i,s,n,r,o,h,l){li.ellipse(null,e,i,s,n,a(r)?0:r,a(o)?0:o,a(h)?360:h,l,null,null,Ss),t.push(as,Ss.x,Ss.y),Bs(t,e,i,s,n,r,o,h,l)},drawArc(t,e,i,s,n,r,o){li.arc(null,e,i,s,a(n)?0:n,a(r)?360:r,o,null,null,Ss),t.push(as,Ss.x,Ss.y),Cs(t,e,i,s,n,r,o)},drawPoints(t,e,i,s,n){let r="Q";p(i)&&(r=i.type,i=i.value),Rs[r]||(ks.warn("not found:",r),r="Q"),Rs[r](t,e,i,s,n)}},{ellipse:Bs,arc:Cs,pointsCurveList:Rs}=Ts;function Ls(t,e){Rs[t]&&ks.repeat(t),Rs[t]=e}Ls("Q",li.points);const{moveTo:Ds,lineTo:As,quadraticCurveTo:Os,bezierCurveTo:Is,closePath:Ms,beginPath:Fs,rect:Ws,roundRect:Us,ellipse:Ns,arc:zs,arcTo:Ys,drawEllipse:Xs,drawArc:Hs,drawPoints:js}=Ts;class Vs{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?h(t)?Oe.parse(t):t:[],this}beginPath(){return Fs(this.__path),this.paint(),this}moveTo(t,e){return Ds(this.__path,t,e),this.paint(),this}lineTo(t,e){return As(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,n,r){return Is(this.__path,t,e,i,s,n,r),this.paint(),this}quadraticCurveTo(t,e,i,s){return Os(this.__path,t,e,i,s),this.paint(),this}closePath(){return Ms(this.__path),this.paint(),this}rect(t,e,i,s){return Ws(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,n){return Us(this.__path,t,e,i,s,n),this.paint(),this}ellipse(t,e,i,s,n,r,o,a){return Ns(this.__path,t,e,i,s,n,r,o,a),this.paint(),this}arc(t,e,i,s,n,r){return zs(this.__path,t,e,i,s,n,r),this.paint(),this}arcTo(t,e,i,s,n){return Ys(this.__path,t,e,i,s,n),this.paint(),this}drawEllipse(t,e,i,s,n,r,o,a){return Xs(this.__path,t,e,i,s,n,r,o,a),this.paint(),this}drawArc(t,e,i,s,n,r){return Hs(this.__path,t,e,i,s,n,r),this.paint(),this}drawPoints(t,e,i){return js(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Gs,L:qs,C:Ks,Q:Zs,Z:Qs,N:$s,D:Js,X:tn,G:en,F:sn,O:nn,P:rn,U:on}=Me,an=ne.get("PathDrawer"),hn={drawPathByData(t,e){if(!e)return;let i,s=0,n=e.length;for(;s<n;)switch(i=e[s],i){case Gs:t.moveTo(e[s+1],e[s+2]),s+=3;break;case qs:t.lineTo(e[s+1],e[s+2]),s+=3;break;case Ks: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 Qs:t.closePath(),s+=1;break;case $s: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 tn:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case en:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*W,e[s+6]*W,e[s+7]*W,e[s+8]),s+=9;break;case sn:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,U,!1),s+=5;break;case nn:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*W,e[s+5]*W,e[s+6]),s+=7;break;case rn:t.arc(e[s+1],e[s+2],e[s+3],0,U,!1),s+=4;break;case on:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void an.error(`command: ${i} [index:${s}]`,e)}},drawPathByPoints(t,e,i){}},{M:ln,L:dn,C:cn,Q:un,Z:pn,N:_n,D:gn,X:fn,G:yn,F:mn,O:vn,P:wn,U:xn}=Me,{toTwoPointBounds:bn,toTwoPointBoundsByQuadraticCurve:En,arcTo:Pn,arc:Sn,ellipse:kn}=li,{addPointBounds:Tn,copy:Bn,addPoint:Cn,setPoint:Rn,addBounds:Ln,toBounds:Dn}=vt,An=ne.get("PathBounds");let On,In,Mn;const Fn={},Wn={},Un={},Nn={toBounds(t,e){Nn.toTwoPointBounds(t,Wn),Dn(Wn,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Rn(e,0,0);let i,s,n,r,o,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(o=t[a],0===a&&(o===pn||o===cn||o===un?Rn(e,h,l):Rn(e,t[a+1],t[a+2])),o){case ln:case dn:h=t[a+1],l=t[a+2],Cn(e,h,l),a+=3;break;case cn:n=t[a+5],r=t[a+6],bn(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,r,Fn),Tn(e,Fn),h=n,l=r,a+=7;break;case un:i=t[a+1],s=t[a+2],n=t[a+3],r=t[a+4],En(h,l,i,s,n,r,Fn),Tn(e,Fn),h=n,l=r,a+=5;break;case pn:a+=1;break;case _n:h=t[a+1],l=t[a+2],Ln(e,h,l,t[a+3],t[a+4]),a+=5;break;case gn:case fn:h=t[a+1],l=t[a+2],Ln(e,h,l,t[a+3],t[a+4]),a+=o===gn?9:6;break;case yn:kn(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],t[a+7],t[a+8],Fn,Un),0===a?Bn(e,Fn):Tn(e,Fn),h=Un.x,l=Un.y,a+=9;break;case mn:h=t[a+1],l=t[a+2],In=t[a+3],Mn=t[a+4],Ln(e,h-In,l-Mn,2*In,2*Mn),h+=In,a+=5;break;case vn:Sn(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Fn,Un),0===a?Bn(e,Fn):Tn(e,Fn),h=Un.x,l=Un.y,a+=7;break;case wn:h=t[a+1],l=t[a+2],On=t[a+3],Ln(e,h-On,l-On,2*On,2*On),h+=On,a+=4;break;case xn:Pn(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Fn,Un),0===a?Bn(e,Fn):Tn(e,Fn),h=Un.x,l=Un.y,a+=6;break;default:return void An.error(`command: ${o} [index:${a}]`,t)}}},{M:zn,L:Yn,Z:Xn}=Me,{getCenterX:Hn,getCenterY:jn}=lt,{arcTo:Vn}=Ts,Gn={smooth(t,e,i){let s,n,r,o,a,h,l=0,d=0,c=0,p=0,_=0,g=0,f=0,y=0,m=0;u(e)&&(e=e[0]||0);const v=t.length,w=9===v,x=[];for(;l<v;){switch(s=t[l],s){case zn:h=x.length,h&&n!==Xn&&(x[o]=p,x[a]=_),p=y=t[l+1],_=m=t[l+2],l+=3,t[l]===Yn?(g=t[l+1],f=t[l+2],w?x.push(zn,p,_):x.push(zn,Hn(p,g),jn(_,f))):x.push(zn,p,_),o=h+1,a=h+2;break;case Yn:switch(d=t[l+1],c=t[l+2],l+=3,t[l]){case Yn:Vn(x,d,c,t[l+1],t[l+2],e,y,m,w);break;case Xn:Vn(x,d,c,p,_,e,y,m,w);break;default:x.push(Yn,d,c)}y=d,m=c;break;case Xn:n!==Xn&&(Vn(x,p,_,g,f,e,y,m,w),x.push(Xn)),l+=1;break;default:r=Ye[s];for(let e=0;e<r;e++)x.push(t[l+e]);l+=r}n=s}return s!==Xn&&(x[o]=p,x[a]=_),x}};function qn(t){return new Vs(t)}const Kn=qn();Oe.creator=qn(),Oe.parse=ss.parse,Oe.convertToCanvasData=ss.toCanvasData;const{drawRoundRect:Zn}=Xe;function Qn(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,n){Zn(this,t,e,i,s,n)})}(t)}const $n={alphaPixelTypes:["png","webp","svg"],upperCaseTypeMap:{},mimeType:(t,e="image")=>!t||t.startsWith(e)?t:("jpg"===t&&(t="jpeg"),e+"/"+t),fileType(t){const e=t.split(".");return e[e.length-1]},isOpaqueImage(t){const e=Jn.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{}}}},Jn=$n;Jn.mineType=Jn.mimeType,Jn.alphaPixelTypes.forEach(t=>Jn.upperCaseTypeMap[t]=t.toUpperCase());const tr=ne.get("TaskProcessor");class er{constructor(t){this.parallel=!0,this.time=1,this.id=m.create(m.TASK),this.task=t}run(){return n(this,void 0,void 0,function*(){try{if(this.isComplete||this.runing)return;if(this.runing=!0,this.canUse&&!this.canUse())return this.cancel();this.task&&(yield this.task())}catch(t){tr.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}}class ir{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&&g.assign(this.config,t),this.empty()}add(t,e,i){let s,n,r,a;const h=new er(t);return h.parent=this,d(e)?a=e:e&&(n=e.parallel,s=e.start,r=e.time,a=e.delay,i||(i=e.canUse)),r&&(h.time=r),!1===n&&(h.parallel=!1),i&&(h.canUse=i),o(a)?this.push(h,s):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(h,s))},a)),this.isComplete=!1,h}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.run()}),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 n=s+e.parallel;if(n>i.length&&(n=i.length),e.parallel>1)for(let e=s;e<n&&(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 sr=ne.get("Resource"),nr={tasker:new ir,queue:new ir({parallel:1}),map:{},get isComplete(){return rr.tasker.isComplete},set(t,e){rr.map[t]&&sr.repeat(t),rr.map[t]=e},get:t=>rr.map[t],remove(t){const e=rr.map[t];e&&(e.destroy&&e.destroy(),delete rr.map[t])},loadImage(t,e){return new Promise((i,s)=>{const n=this.setImage(t,t,e);n.load(()=>i(n),t=>s(t))})},setImage(t,e,i){let s;return h(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=ue.image(s)),rr.set(t,e),e},loadFilm(t,e){},loadVideo(t,e){},destroy(){rr.map={}}},rr=nr,or={maxRecycled:10,recycledList:[],patternTasker:nr.queue,get(t,e){let i=nr.get(t.url);return i||nr.set(t.url,i=ue[e||"image"](t)),i.use++,i},recycle(t){t.parent&&(t=t.parent),t.use--,setTimeout(()=>{t.use||(ee.image.isLarge(t)?t.url&&nr.remove(t.url):(t.clearLevels(),ar.recycledList.push(t)))})},recyclePaint(t){ar.recycle(t.image)},clearRecycled(t){const e=ar.recycledList;(e.length>ar.maxRecycled||t)&&(e.forEach(e=>(!e.use||t)&&e.url&&nr.remove(e.url)),e.length=0)},clearLevels(){},hasAlphaPixel:t=>$n.alphaPixelTypes.some(e=>ar.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:"+$n.mimeType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+$n.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){this.clearRecycled(!0)}},ar=or,{IMAGE:hr,create:lr}=m;class dr{get tag(){return"Image"}get url(){return this.config.url}get crossOrigin(){const{crossOrigin:t}=this.config;return o(t)?ee.image.crossOrigin:t}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=lr(hr),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}or.isFormat("svg",t)&&(this.isSVG=!0),or.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,e,i){return this.loading||(this.loading=!0,nr.tasker.add(()=>n(this,void 0,void 0,function*(){return yield ee.origin["load"+this.tag](this.getLoadUrl(i),this.crossOrigin,this).then(t=>{i&&this.setThumbView(t),this.setView(t)}).catch(t=>{this.error=t,this.onComplete(!1)})}))),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||(this.width=t.width,this.height=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,n,r,o,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 h=ee.image.resize(this.view,t,e,n,r,void 0,o,i,s,a);return this.cache=this.use>1?{data:h,params:arguments}:null,h}getPattern(t,e,i,s){const n=ee.canvas.createPattern(t,e);return ee.image.setPatternTransform(n,i,s),n}render(t,e,i,s,n,r,o,a,h){t.drawImage(this.view,e,i,s,n)}getLoadUrl(t){return this.url}setThumbView(t){}getThumbSize(t){}getMinLevel(){}getLevelData(t,e,i){}clearLevels(t){}destroyFilter(){}destroy(){this.clearLevels(),this.destroyFilter();const{view:t}=this;t&&t.close&&t.close(),this.config={url:""},this.cache=this.view=null,this.waitComplete.length=0}}function cr(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function ur(t,e){return Object.getOwnPropertyDescriptor(t,e)}function pr(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function _r(t,e){return(i,s)=>fr(i,s,t,e&&e(s))}function gr(t){return t}function fr(t,e,i,s){const n={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};cr(t,e,Object.assign(n,s||{})),jr(t,e,i)}function yr(t){return _r(t)}function mr(t,e){return _r(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function vr(t,e){return _r(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function wr(t){return _r(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),Sr(this))}}))}function xr(t,e){return _r(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function br(t,e){return _r(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function Er(t,e){return _r(t,t=>({set(i){this.__setAttr(t,i,e)&&Sr(this)}}))}function Pr(t){return _r(t,t=>({set(e){this.__setAttr(t,e)&&(Sr(this),this.__.__removeNaturalSize())}}))}function Sr(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function kr(t){return _r(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),Sr(this)}}))}const Tr=Er;function Br(t,e){return _r(t,t=>({set(i){this.__setAttr(t,i)&&(Cr(this),e&&(this.__.__useStroke=!0))}}))}function Cr(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&Sr(t)}const Rr=Br;function Lr(t){return _r(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Dr(t){return _r(t,t=>({set(e){this.__setAttr(t,e)&&Ar(this)}}))}function Ar(t){t.__layout.surfaceChanged||t.__layout.surfaceChange()}function Or(t){return _r(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;g.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip)}}}))}function Ir(t){return _r(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Fr(this)}}))}function Mr(t){return _r(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>Wr(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Wr(this,t,e,i),this.mask&&Fr(this)}}))}function Fr(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Wr(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||Sr(t))}function Ur(t){return _r(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{const{parent:t}=this;t.__layout.childrenSortChange(),t.__.flow&&t.__layout.boxChange()})}}))}function Nr(t,e){return _r(t,t=>({set(i){this.__setAttr(t,i)&&(this.__layout.boxChanged||this.__layout.boxChange(),e?this.__updateMask():this.waitParent(()=>{this.parent.__updateMask(i)}))}}))}function zr(t){return _r(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function Yr(t){return _r(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,this.leafer&&this.leafer.updateCursor())}}))}function Xr(t){return _r(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function Hr(t){return(e,i)=>{cr(e,"__DataProcessor",{get:()=>t})}}function jr(t,e,i){const s=t.__DataProcessor.prototype,n="_"+e,r=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=pr(e,i);if(o(i))a.get=function(){return this[n]};else if("function"==typeof i)a.get=function(){const t=this[n];return null==t?i(this.__leaf):t};else if(p(i)){const t=_(i);a.get=function(){const e=this[n];return null==e?this[n]=t?{}:g.clone(i):e}}const h=t.isBranchLeaf;"width"===e?a.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&&(a.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,d=s;for(;!l&&d;)l=ur(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),s[r]&&(a.set=s[r],delete s[r]),cr(s,e,a)}const Vr=new ne("rewrite"),Gr=[],qr=["destroy","constructor"];function Kr(t){return(e,i)=>{Gr.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function Zr(){return t=>{Qr()}}function Qr(t){Gr.length&&(Gr.forEach(e=>{t&&Vr.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),Gr.length=0)}function $r(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(qr.includes(s)||e&&e.includes(s)))if(t.prototype){const e=ur(t.prototype,s);e&&Object.defineProperty(i.prototype,s,e)}else i.prototype[s]=t[s]})}}function Jr(){return t=>{_e.register(t)}}function to(){return t=>{ye.register(t)}}setTimeout(()=>Qr(!0));const{copy:eo,toInnerPoint:io,toOuterPoint:so,scaleOfOuter:no,rotateOfOuter:ro,skewOfOuter:oo,multiplyParent:ao,divideParent:ho,getLayout:lo}=Q,co={},{round:uo}=Math,po={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),fo(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,n=s.length;t<n;t++)go(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++)yo(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&yo(t),t.__updateChange(),e.surfaceChanged&&(t.__hasComplex&&_o.updateComplex(t),e.surfaceChanged=!1)},updateAllChange(t){if(vo(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)mo(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,n,r){s||(s=t.__nowWorld),t.__worldFlipped||ee.fullImageShadow?e.copyWorldByReset(i,s,t.__nowWorld,n,r):e.copyWorldToInner(i,s,t.__layout.renderBounds,n)},renderComplex(t,e,i){},updateComplex(t){},checkComplex(t){},moveWorld(t,e,i=0,s,n){const r=p(e)?Object.assign({},e):{x:e,y:i};s?so(t.localTransform,r,r,!0):t.parent&&io(t.parent.scrollWorldTransform,r,r,!0),_o.moveLocal(t,r.x,r.y,n)},moveLocal(t,e,i=0,s){p(e)&&(i=e.y,e=e.x),e+=t.x,i+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=uo(e),i=uo(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,n,r,o){_o.zoomOfLocal(t,wo(t,e),i,s,n,r,o)},zoomOfLocal(t,e,i,s=i,n,r,o){const a=t.__localMatrix;if(d(s)||(s&&(r=s),s=i),eo(co,a),no(co,e,i,s),_o.hasHighPosition(t))_o.setTransform(t,co,n,r,o);else{const e=t.x+co.e-a.e,h=t.y+co.f-a.f;r&&!n?t.animate({x:e,y:h,scaleX:t.scaleX*i,scaleY:t.scaleY*s},r):(t.x=e,t.y=h,t.scaleResize(i,s,!0!==n,o))}},rotateOfWorld(t,e,i,s){_o.rotateOfLocal(t,wo(t,e),i,s)},rotateOfLocal(t,e,i,s){const n=t.__localMatrix;eo(co,n),ro(co,e,i),_o.hasHighPosition(t)?_o.setTransform(t,co,!1,s):t.set({x:t.x+co.e-n.e,y:t.y+co.f-n.f,rotation:M.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,n,r){_o.skewOfLocal(t,wo(t,e),i,s,n,r)},skewOfLocal(t,e,i,s=0,n,r){eo(co,t.__localMatrix),oo(co,e,i,s),_o.setTransform(t,co,n,r)},transformWorld(t,e,i,s,n){eo(co,t.worldTransform),ao(co,e),t.parent&&ho(co,t.parent.scrollWorldTransform),_o.setTransform(t,co,i,s,n)},transform(t,e,i,s,n){eo(co,t.localTransform),ao(co,e),_o.setTransform(t,co,i,s,n)},setTransform(t,e,i,s,n){const r=t.__,o=r.origin&&_o.getInnerOrigin(t,r.origin),a=lo(e,o,r.around&&_o.getInnerOrigin(t,r.around));if(_o.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,o){Ht.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=_o.getInnerOrigin(t,r.origin);lt.move(a,o.x-s.x,o.y-s.y)}t.set(a),t.scaleResize(e,i,!1,n)}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 no(i,_o.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>lt.tempToOuterOf(_o.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return Pt.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(eo(co,t.worldTransform),ho(co,e.scrollWorldTransform),i?co:Object.assign({},co)),updateScaleFixedWorld(t){},updateOuterBounds(t){},cacheId(t){},drop(t,e,i,s){t.setTransform(_o.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||_o.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,s){if(e.x||e.y){if(Math.abs(e.x)<1&&Math.abs(e.y)<1)t.move(e);else{const n=e.x*i,r=e.y*i;e.x-=n,e.y-=r,t.move(n,r),ee.requestRender(()=>_o.animateMove(t,e,i,s))}s&&s()}}},_o=po,{updateAllMatrix:go,updateMatrix:fo,updateAllWorldOpacity:yo,updateAllChange:mo,updateChange:vo}=_o;function wo(t,e){return t.updateLayout(),t.parent?lt.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const xo={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){const{__:e,__layout:i}=t;return e.eraser||0===e.visible?null:i.localOuterBounds||i.localRenderBounds},maskLocalBoxBounds:(t,e)=>Eo(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>Eo(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds(t,e){const{__layout:i}=t;return Eo(t,e)&&(i.localOuterBounds||i.localRenderBounds)},excludeRenderBounds:(t,e)=>!(!e.bounds||e.bounds.hit(t.__world,e.matrix))||!(!e.hideBounds||!e.hideBounds.includes(t.__world,e.matrix))};let bo;function Eo(t,e){return e||(bo=0),t.__.mask&&(bo=1),bo<0?null:(bo&&(bo=-1),!0)}const{updateBounds:Po}=po,So={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,n=i.length;s<n;s++)(t=i[s]).isBranch&&(t.__tempNumber=1,e.add(t),ko(t,e))}},pushAllParent(t,e){const{keys:i}=e;if(i)for(;t.parent&&o(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++)To(e[t],e)},updateBounds(t,e){const i=[t];To(t,i),Bo(i,e)},updateBoundsByBranchStack(t,e){let i,s;for(let n=t.length-1;n>-1;n--){i=t[n],s=i.children;for(let t=0,e=s.length;t<e;t++)Po(s[t]);e&&e===i||Po(i)}},move(t,e,i){let s;const{children:n}=t;for(let r=0,o=n.length;r<o;r++)s=(t=n[r]).__world,s.e+=e,s.f+=i,s.x+=e,s.y+=i,t.isBranch&&Co(t,e,i)},scale(t,e,i,s,n,r,o){let a;const{children:h}=t,l=s-1,d=n-1;for(let c=0,u=h.length;c<u;c++)a=(t=h[c]).__world,a.a*=s,a.d*=n,(a.b||a.c)&&(a.b*=s,a.c*=n),a.e===a.x&&a.f===a.y?(a.x=a.e+=(a.e-r)*l+e,a.y=a.f+=(a.f-o)*d+i):(a.e+=(a.e-r)*l+e,a.f+=(a.f-o)*d+i,a.x+=(a.x-r)*l+e,a.y+=(a.y-o)*d+i),a.width*=s,a.height*=n,a.scaleX*=s,a.scaleY*=n,t.isBranch&&Ro(t,e,i,s,n,r,o)}},{pushAllChildBranch:ko,pushAllBranchStack:To,updateBoundsByBranchStack:Bo,move:Co,scale:Ro}=So,Lo={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:Do,updateBounds:Ao}=po,{toOuterOf:Oo,getPoints:Io,copy:Mo}=Ht,Fo="_localContentBounds",Wo="_worldContentBounds",Uo="_worldBoxBounds",No="_worldStrokeBounds";class zo{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 Oo(this.contentBounds,this.leaf.__localMatrix,this[Fo]||(this[Fo]={})),this[Fo]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return Oo(this.contentBounds,this.leaf.__world,this[Wo]||(this[Wo]={})),this[Wo]}get worldBoxBounds(){return Oo(this.boxBounds,this.leaf.__world,this[Uo]||(this[Uo]={})),this[Uo]}get worldStrokeBounds(){return Oo(this.strokeBounds,this.leaf.__world,this[No]||(this[No]={})),this[No]}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 Ao(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,ee.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 Do(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 qt(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 n,r,o,a=this.getInnerBounds(t);switch(e){case"world":n=s.getWorldPoint(a),r=s.__world;break;case"local":const{scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d}=s.__;o={scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d},n=s.getLocalPointByInner(a);break;case"inner":n=a,r=Q.defaultMatrix;break;case"page":e=s.zoomLayer;default:n=s.getWorldPoint(a,e),r=Do(s,e,!0)}if(o||(o=Q.getLayout(r)),Mo(o,a),lt.copy(o,n),i){const{scaleX:t,scaleY:e}=o,i=Math.abs(t),s=Math.abs(e);1===i&&1===s||(o.scaleX/=i,o.scaleY/=s,o.width*=i,o.height*=s)}return o}getLayoutPoints(t,e="world"){const{leaf:i}=this,s=Io(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 o(n)||s.forEach(t=>i.innerToWorld(t,null,!1,n)),s}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,this.hitCanvasChanged=!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}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=this.affectChildrenSort=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class Yo{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&ee.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&ee.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&ee.event.stop(this.origin)}}class Xo extends Yo{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}Xo.ADD="child.add",Xo.REMOVE="child.remove",Xo.CREATED="created",Xo.MOUNTED="mounted",Xo.UNMOUNTED="unmounted",Xo.DESTROY="destroy";const Ho="property.scroll";class jo extends Yo{constructor(t,e,i,s,n){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=n}}jo.CHANGE="property.change",jo.LEAFER_CHANGE="property.leafer_change",jo.SCROLL=Ho;const Vo={scrollX:Ho,scrollY:Ho};class Go extends Yo{constructor(t,e){super(t),Object.assign(this,e)}}Go.LOAD="image.load",Go.LOADED="image.loaded",Go.ERROR="image.error";class qo extends Yo{static checkHas(t,e,i){"on"===i?e===$o?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(Ko)||t.hasEvent(Zo)||t.hasEvent(Qo),t.__hasWorldEvent=t.hasEvent($o))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(Ko,t),"inner"===e&&t.emit(Zo,t)),t.emit(Qo,t)}}static emitWorld(t){t.leaferIsReady&&t.emit($o,t)}}qo.RESIZE="bounds.resize",qo.INNER="bounds.inner",qo.LOCAL="bounds.local",qo.WORLD="bounds.world";const{RESIZE:Ko,INNER:Zo,LOCAL:Qo,WORLD:$o}=qo,Jo={};[Ko,Zo,Qo,$o].forEach(t=>Jo[t]=1);class ta extends Yo{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){p(t)?(super(ta.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!o(this.resizingKeys[t.innerId])}}ta.RESIZE="resize";class ea extends Yo{constructor(t,e){super(t),this.data=e}}ea.REQUEST="watch.request",ea.DATA="watch.data";class ia extends Yo{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}ia.REQUEST="layout.request",ia.START="layout.start",ia.BEFORE="layout.before",ia.LAYOUT="layout",ia.AFTER="layout.after",ia.AGAIN="layout.again",ia.END="layout.end";class sa extends Yo{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}sa.REQUEST="render.request",sa.CHILD_START="render.child_start",sa.CHILD_END="render.child_end",sa.START="render.start",sa.BEFORE="render.before",sa.RENDER="render",sa.AFTER="render.after",sa.AGAIN="render.again",sa.END="render.end",sa.NEXT="render.next";class na extends Yo{}na.START="leafer.start",na.BEFORE_READY="leafer.before_ready",na.READY="leafer.ready",na.AFTER_READY="leafer.after_ready",na.VIEW_READY="leafer.view_ready",na.VIEW_COMPLETED="leafer.view_completed",na.STOP="leafer.stop",na.RESTART="leafer.restart",na.END="leafer.end",na.UPDATE_MODE="leafer.update_mode",na.TRANSFORM="leafer.transform",na.MOVE="leafer.move",na.SCALE="leafer.scale",na.ROTATE="leafer.rotate",na.SKEW="leafer.skew";const{MOVE:ra,SCALE:oa,ROTATE:aa,SKEW:ha}=na,la={x:ra,y:ra,scaleX:oa,scaleY:oa,rotation:aa,skewX:ha,skewY:ha},da={};class ca{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(u(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let i in t)u(e=t[i])?this.on(i,e[0],e[1]):this.on(i,e);return}let s,n,r;i&&("once"===i?n=!0:"boolean"==typeof i?s=i:(s=i.capture,n=i.once));const o=ua(this,s,!0),a=h(t)?t.split(" "):t,l=n?{listener:e,once:n}:{listener:e};a.forEach(t=>{t&&(r=o[t],r?-1===r.findIndex(t=>t.listener===e)&&r.push(l):o[t]=[l],Jo[t]&&qo.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=h(t)?t.split(" "):t;if(e){let t,n,r;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const o=ua(this,t);s.forEach(t=>{t&&(n=o[t],n&&(r=n.findIndex(t=>t.listener===e),r>-1&&n.splice(r,1),n.length||delete o[t],Jo[t]&&qo.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):u(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=u(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):u(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 u(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));p(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&ye.has(t)&&(e=ye.get(t,{type:t,target:this,current:this}));const s=ua(this,i)[t];if(s){let n;for(let r=0,o=s.length;r<o&&!((n=s[r])&&(n.listener(e),n.once&&(this.off(t,n.listener,i),r--,o--),e&&e.isStopNow));r++);}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:s}=this,n=i&&i[t],r=s&&s[t];return!!(o(e)?n||r:e?r:n)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function ua(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:da)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:da)}}const{on:pa,on_:_a,off:ga,off_:fa,once:ya,emit:ma,emitEvent:va,hasEvent:wa,destroy:xa}=ca.prototype,ba={on:pa,on_:_a,off:ga,off_:fa,once:ya,emit:ma,emitEvent:va,hasEvent:wa,destroyEventer:xa},Ea=ne.get("setAttr"),Pa={__setAttr(t,e,i){if(this.leaferIsCreated){const s=this.__.__getInput(t);if(!i||l(e)||o(e)||(Ea.warn(this.innerName,t,e),e=void 0),p(e)||s!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new jo(jo.LEAFER_CHANGE,this,t,s,e));const i=la[t];i&&(this.emitEvent(new na(i,this)),this.emitEvent(new na(na.TRANSFORM,this)))}this.emitPropertyEvent(jo.CHANGE,t,s,e);const i=Vo[t];return i&&this.emitPropertyEvent(i,t,s,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,i,s){const n=new jo(t,this,e,i,s);this.isLeafer||this.hasEvent(t)&&this.emitEvent(n),this.leafer.emitEvent(n)},__realSetAttr(t,e){const i=this.__;i[t]=e,this.__proxyData&&this.setProxyAttr(t,e),i.normalStyle&&(this.lockNormalStyle||o(i.normalStyle[t])||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:Sa,multiplyParent:ka,translateInner:Ta,defaultWorld:Ba}=Q,{toPoint:Ca,tempPoint:Ra}=Pt,La={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:n}=this;ka(this.__local||e,t?t.__scrollWorld||t.__world:Ba,i,!!e.affectScaleOrRotation,n),s&&Ta(Object.assign(s,i),n.scrollX,n.scrollY),e.scaleFixed&&po.updateScaleFixedWorld(this)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,i=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(Sa(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)&&(Ca(i.around||i.origin,t.boxBounds,Ra),Ta(e,-Ra.x,-Ra.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:Da,updateAllMatrix:Aa}=po,{updateBounds:Oa}=So,{toOuterOf:Ia,copyAndSpread:Ma,copy:Fa}=Ht,{toBounds:Wa}=Nn,Ua={__updateWorldBounds(){const{__layout:t,__world:e}=this;Ia(t.renderBounds,e,e),this.__hasComplex&&po.checkComplex(this),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&qo.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&qo.emitWorld(this)},__updateLocalBounds(){const t=this.__layout,e=this.__;t.boxChanged&&(e.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.resized="inner"),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=void 0,t.strokeSpread&&!t.strokeChanged&&(t.strokeChanged=!!t.boxChanged||2),t.renderSpread&&!t.renderChanged&&(t.renderChanged=!!t.boxChanged||2),this.parent&&this.parent.__layout.boxChange()),t.boxChanged=void 0,t.strokeChanged&&(2===t.strokeChanged?this.__updateLocalStrokeBounds():(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.resized="inner",(t.renderSpread||t.strokeSpread!==t.strokeBoxSpread)&&(t.renderChanged=!0)),t.strokeChanged=void 0,this.parent&&this.parent.__layout.strokeChange()),t.renderChanged&&(2===t.renderChanged?this.__updateLocalRenderBounds():(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.outerScale&&po.updateOuterBounds(this),t.resized||(t.resized="local"),t.boundsChanged=void 0},__updateLocalBoxBounds(){this.__hasMotionPath&&this.__updateMotionPath(),this.__hasAutoLayout&&this.__updateAutoLayout(),Ia(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Ia(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Ia(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const i=this.__layout.boxBounds,s=this.__;s.__usePathBox?Wa(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.childrenSortChanged&&this.__updateSortChildren(),this.__layout.boxChanged&&this.__updateFlowLayout(),Aa(this),Oa(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(Aa(this),Oa(this,this))):Da(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;Ma(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:i}=e;d(i)&&i<=0?Fa(e.renderBounds,e.strokeBounds):Ma(e.renderBounds,e.boxBounds,i)}},Na={__render(t,e){if(e.shape)return this.__renderShape(t,e);if((!e.cellList||e.cellList.has(this))&&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.ignoreOpacity?1: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),po.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);ne.showBounds&&ne.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:za}=xo,{hasSize:Ya}=Ht,Xa={__updateChange(){this.__layout.childrenSortChanged&&this.__updateSortChildren(),this.__.__checkSingle()},__render(t,e){const i=this.__nowWorld=this.__getNowWorld(e);if(this.__worldOpacity&&Ya(i)){const s=this.__;if(s.__useDim){if(s.bright&&!e.topRendering)return e.topList.add(this);s.dim?e.dimOpacity=!0===s.dim?.2:s.dim:s.dimskip&&e.dimOpacity&&(e.dimOpacity=0)}if(s.__single&&!this.isBranchLeaf){if("path"===s.eraser)return this.__renderEraser(t,e);const n=t.getSameCanvas(!1,!0);this.__renderBranch(n,e),t.opacity=e.ignoreOpacity?1:e.dimOpacity?s.opacity*e.dimOpacity:s.opacity,t.copyWorldByReset(n,i,i,s.__blendMode,!0),n.recycle(i)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{let i;const{children:s}=this;for(let n=0,r=s.length;n<r;n++)i=s[n],za(i,e)||(i.__hasComplex?po.renderComplex(i,t,e):i.__render(t,e));0===this.__hasMask&&this.__rerenderMask(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,n=i.length;s<n;s++)za(i[s],e)||i[s].__clip(t,e)}}},{LEAF:Ha,create:ja}=m,{stintSet:Va}=g,{toInnerPoint:Ga,toOuterPoint:qa,multiplyParent:Ka}=Q,{toOuterOf:Za}=Ht,{copy:Qa,move:$a}=lt,{getScaleFixedData:Ja}=M,{moveLocal:th,zoomOfLocal:eh,rotateOfLocal:ih,skewOfLocal:sh,moveWorld:nh,zoomOfWorld:rh,rotateOfWorld:oh,skewOfWorld:ah,transform:hh,transformWorld:lh,setTransform:dh,getFlipTransform:ch,getLocalOrigin:uh,getRelativeWorld:ph,drop:_h}=po;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 y}get __LayoutProcessor(){return zo}get leaferIsCreated(){return this.leafer&&this.leafer.created}get leaferIsReady(){return this.leafer&&this.leafer.ready}get isLeafer(){return!1}get isFrame(){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=ja(Ha),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Xo.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(Xo.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Xo.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(Xo.MOUNTED),t.cacheId&&po.cacheId(this)):this.__emitLifeEvent(Xo.UNMOUNTED),this.isBranch){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__bindLeafer(t)}}__bindFrame(t){if(this.isFrame&&null!==t&&(t=this),this.frame=t,this.isBranch){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__bindFrame(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))}scaleResize(t,e=t,i,s){this.scaleX*=t,this.scaleY*=e}updateLayout(){this.__layout.update()}forceUpdate(t){let e;if(t&&"bounds"!==t?"surface"===t?(Ar(this),e=!0):"stroke"===t&&(Cr(this),e=!0):(Sr(this),e=!0),e){const{leafer:t}=this;return t&&t.watcher&&t.watcher.__onAttrChange({target:this})}const i=this.__.__getInput(t);this.__[t]=o(i)?null:void 0,this[t]=i}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__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){const e=this.children.some(t=>t.__.mask&&t.__.visible&&t.__.opacity);this.__hasMask=this.__.maskskip?e&&0:e}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld,i=this.__world;return Ka(i,t.matrix,e,void 0,i),Za(this.__layout.renderBounds,e,e),Va(e,"half",i.half),Va(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,i=!0){return Ja(or.patternLocked?this.__world:this.__nowWorld||this.__world,e,i,t)}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?ph(this,e):this.worldTransform,n=i?t:{};return Za(t,s,n),n}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&Qa(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&Qa(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),Ga(this.worldTransform,t,e,i)}innerToWorld(t,e,i,s){qa(this.worldTransform,t,e,i),s&&s.worldToInner(e||t,null,i)}getBoxPoint(t,e,i,s){const n=this.getInnerPoint(t,e,i,s);return i?n:this.getBoxPointByInner(n,null,null,!0)}getBoxPointByInner(t,e,i,s){const n=s?t:Object.assign({},t),{x:r,y:o}=this.boxBounds;return $a(n,-r,-o),n}getInnerPoint(t,e,i,s){const n=s?t:{};return this.worldToInner(t,n,i,e),n}getInnerPointByBox(t,e,i,s){const n=s?t:Object.assign({},t),{x:r,y:o}=this.boxBounds;return $a(n,r,o),n}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const n=s?t:{};return this.worldToLocal(t,n,i,e),n}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 n=s?t:{};return this.innerToWorld(t,n,i,e),n}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const n=s?t:{};return this.localToWorld(t,n,i,e),n}getWorldPointByPage(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,i,s)}setTransform(t,e,i,s){dh(this,t,e,i,s)}transform(t,e,i,s){hh(this,t,e,i,s)}move(t,e,i){th(this,t,e,i)}moveInner(t,e,i){nh(this,t,e,!0,i)}scaleOf(t,e,i,s,n,r){eh(this,uh(this,t),e,i,s,n,r)}rotateOf(t,e,i){ih(this,uh(this,t),e,i)}skewOf(t,e,i,s,n){sh(this,uh(this,t),e,i,s,n)}transformWorld(t,e,i,s){lh(this,t,e,i,s)}moveWorld(t,e,i){nh(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,n,r){rh(this,t,e,i,s,n,r)}rotateOfWorld(t,e){oh(this,t,e)}skewOfWorld(t,e,i,s,n){ah(this,t,e,i,s,n)}flip(t,e){hh(this,ch(this,t),!1,e)}remove(t,e){this.parent&&this.parent.remove(this,e)}dropTo(t,e,i){_h(this,t,e,i)}static changeAttr(t,e,i){i?this.addAttr(t,e,i):jr(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=Er),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Xo(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Xo.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}},t.Leaf=s([$r(Pa),$r(La),$r(Ua),$r(ba),$r(Na)],t.Leaf);const{setListWithFn:gh}=Ht,{sort:fh}=So,{localBoxBounds:yh,localStrokeBounds:mh,localRenderBounds:vh,maskLocalBoxBounds:wh,maskLocalStrokeBounds:xh,maskLocalRenderBounds:bh}=xo,Eh=new ne("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(){let t;const{children:e}=this;for(let i=0,s=e.length;i<s;i++)if(t=e[i].__layout,t.renderSpread||t.localOuterBounds)return 1;return 0}__updateBoxBounds(t,e){gh(e||this.__layout.boxBounds,this.children,this.__hasMask?wh:yh)}__updateStrokeBounds(t){gh(t||this.__layout.strokeBounds,this.children,this.__hasMask?xh:mh)}__updateRenderBounds(t){gh(t||this.__layout.renderBounds,this.children,this.__hasMask?bh:vh)}__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(fh),this.__layout.affectChildrenSort=t}this.__layout.childrenSortChanged=!1}add(t,e){if(t===this||t.destroyed)return Eh.warn("add self or destroyed");const i=o(e);if(!t.__){if(u(t))return t.forEach(t=>{this.add(t,e),i||e++});if(!(t=_e.get(t.tag,t)))return}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 s=t.__layout;s.boxChanged||s.boxChange(),s.matrixChanged||s.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(Xo.ADD),this.isFrame&&t.__bindFrame(this),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Xo.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){this.add(t)}remove(t,e){t?t.__?t.animationOut?t.__runAnimation("out",()=>this.__remove(t,e)):this.__remove(t,e):this.find(t).forEach(t=>this.remove(t,e)):o(t)&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach(e=>{this.__realRemoveChild(e),t&&e.destroy()}))}clear(){this.removeAll(!0)}__remove(t,e){const 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(Xo.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Xo.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear())),this.isFrame&&t.__bindFrame(null)}__emitChildEvent(t,e){const i=new Xo(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}},t.Branch=s([$r(Xa)],t.Branch);class Ph{get length(){return this.list.length}constructor(t){this.reset(),t&&(u(t)?this.addList(t):this.add(t))}has(t){return t&&!o(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return o(e)?-1:e}add(t){const{list:e,keys:i}=this;o(i[t.innerId])&&(e.push(t),i[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:i}=this;if(o(i[t.innerId])){const{list:s}=this;for(let t=e,n=s.length;t<n;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 s=0,n=e.length;s<n;s++)o(i)?e[s].innerId===t.innerId&&(i=s,delete this.keys[t.innerId]):this.keys[e[s].innerId]=s-1;o(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 Ph;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 Sh{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(u(t)?this.addList(t):this.add(t))}has(t){return!o(this.keys[t.innerId])}without(t){return o(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap: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}}const kh=ne.get("LeaferCanvas");class Th extends Ae{set zIndex(t){const{style:e}=this.view;e.zIndex=t,this.setAbsolute(this.view)}set childIndex(t){const{view:e,parentView:i}=this;if(e&&i){const s=i.children[t];s?(this.setAbsolute(s),i.insertBefore(e,s)):i.appendChild(s)}}init(){const{config:t}=this,e=t.view||t.canvas;e?this.__createViewFrom(e):this.__createView();const{style:i}=this.view;if(i.display||(i.display="block"),this.parentView=this.view.parentElement,this.parentView){const t=this.parentView.style;t.webkitUserSelect=t.userSelect="none",this.view.classList.add("leafer-canvas-view")}ee.syncDomFont&&!this.parentView&&(i.display="none",document.body&&document.body.appendChild(this.view)),this.__createContext(),this.autoLayout||this.resize(t)}set backgroundColor(t){this.view.style.backgroundColor=t}get backgroundColor(){return this.view.style.backgroundColor}set hittable(t){this.view.style.pointerEvents=t?"auto":"none"}get hittable(){return"none"!==this.view.style.pointerEvents}__createView(){this.view=document.createElement("canvas")}__createViewFrom(t){let e=h(t)?document.getElementById(t):t;if(e)if(e instanceof HTMLCanvasElement)this.view=e;else{let t=e;if(e===window||e===document){const e=document.createElement("div"),{style:i}=e;i.position="absolute",i.top=i.bottom=i.left=i.right="0px",document.body.appendChild(e),t=e}this.__createView();const i=this.view;t.hasChildNodes()&&(this.setAbsolute(i),t.style.position||(t.style.position="relative")),t.appendChild(i)}else kh.error(`no id: ${t}`),this.__createView()}setAbsolute(t){const{style:e}=t;e.position="absolute",e.top=e.left="0px"}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this,{style:s}=this.view;s.width=t+"px",s.height=e+"px",this.unreal||(this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i))}updateClientBounds(){this.view.parentElement&&(this.clientBounds=this.view.getBoundingClientRect())}startAutoLayout(t,e){if(this.resizeListener=e,t){if(this.autoBounds=t,this.resizeObserver)return;try{this.resizeObserver=new ResizeObserver(t=>{this.updateClientBounds();for(const e of t)this.checkAutoBounds(e.contentRect)});const t=this.parentView;t?(this.resizeObserver.observe(t),this.checkAutoBounds(t.getBoundingClientRect())):(this.checkAutoBounds(this.view),kh.warn("no parent"))}catch(t){this.imitateResizeObserver()}this.stopListenPixelRatio()}else this.listenPixelRatio(),this.unreal&&this.updateViewSize()}imitateResizeObserver(){this.autoLayout&&(this.parentView&&this.checkAutoBounds(this.parentView.getBoundingClientRect()),ee.requestRender(this.imitateResizeObserver.bind(this)))}listenPixelRatio(){this.windowListener||window.addEventListener("resize",this.windowListener=()=>{const t=ee.devicePixelRatio;if(!this.config.pixelRatio&&this.pixelRatio!==t){const{width:e,height:i}=this;this.emitResize({width:e,height:i,pixelRatio:t})}})}stopListenPixelRatio(){this.windowListener&&(window.removeEventListener("resize",this.windowListener),this.windowListener=null)}checkAutoBounds(t){const e=this.view,{x:i,y:s,width:n,height:r}=this.autoBounds.getBoundsFrom(t),o={width:n,height:r,pixelRatio:this.config.pixelRatio?this.pixelRatio:ee.devicePixelRatio};if(!this.isSameSize(o)){const{style:t}=e;t.marginLeft=i+"px",t.marginTop=s+"px",this.emitResize(o)}}stopAutoLayout(){this.autoLayout=!1,this.resizeObserver&&this.resizeObserver.disconnect(),this.resizeListener=this.resizeObserver=null}emitResize(t){const e={};g.copyAttrs(e,this,De),this.resize(t),this.resizeListener&&!o(this.width)&&this.resizeListener(new ta(t,e))}unrealCanvas(){if(!this.unreal&&this.parentView){let t=this.view;t&&t.remove(),t=this.view=document.createElement("div"),this.parentView.appendChild(this.view),t.classList.add("leafer-app-view"),this.unreal=!0}}destroy(){const{view:t}=this;t&&(this.stopAutoLayout(),this.stopListenPixelRatio(),t.parentElement&&t.remove(),super.destroy())}}function Bh(t,e){ee.origin={createCanvas(t,e){const i=document.createElement("canvas");return i.width=t,i.height=e,i},canvasToDataURL:(t,e,i)=>{const s=$n.mimeType(e),n=t.toDataURL(s,i);return"image/bmp"===s?n.replace("image/png;","image/bmp;"):n},canvasToBolb:(t,e,i)=>new Promise(s=>t.toBlob(s,$n.mimeType(e),i)),canvasSaveAs:(t,e,i)=>{const s=t.toDataURL($n.mimeType($n.fileType(e)),i);return ee.origin.download(s,e)},download(t,e){return n(this,void 0,void 0,function*(){let i=document.createElement("a");i.href=t,i.download=e,document.body.appendChild(i),i.click(),document.body.removeChild(i)})},loadImage:(t,e,i)=>new Promise((i,s)=>{const n=new ee.origin.Image;e&&(n.setAttribute("crossOrigin",e),n.crossOrigin=e),n.onload=()=>{i(n)},n.onerror=t=>{s(t)},n.src=ee.image.getRealURL(t)}),loadContent(t){return n(this,arguments,void 0,function*(t,e="text"){const i=yield fetch(t);if(!i.ok)throw new Error(`${i.status}`);return yield i[e]()})},Image:Image,PointerEvent:PointerEvent,DragEvent:DragEvent},ee.event={stopDefault(t){t.preventDefault()},stopNow(t){t.stopImmediatePropagation()},stop(t){t.stopPropagation()}},ee.canvas=ue.canvas(),ee.conicGradientSupport=!!ee.canvas.context.createConicGradient}Qn(CanvasRenderingContext2D.prototype),Qn(Path2D.prototype),Object.assign(ue,{canvas:(t,e)=>new Th(t,e),image:t=>new dr(t)}),ee.name="web",ee.isMobile="ontouchstart"in window,ee.requestRender=function(t){window.requestAnimationFrame(t)},cr(ee,"devicePixelRatio",{get:()=>devicePixelRatio});const{userAgent:Ch}=navigator;Ch.indexOf("Firefox")>-1?(ee.intWheelDeltaY=!0,ee.syncDomFont=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(ee.fullImageShadow=!0),Ch.indexOf("Windows")>-1?(ee.os="Windows",ee.intWheelDeltaY=!0):Ch.indexOf("Mac")>-1?ee.os="Mac":Ch.indexOf("Linux")>-1&&(ee.os="Linux");class Rh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove&&this.config.usePartLayout){const t=new Ph;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 Ph,this.target=t,e&&(this.config=g.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(sa.REQUEST)}__onAttrChange(t){this.add(t.target)}add(t){this.config.usePartLayout&&this.__updatedList.add(t),this.update()}__onChildEvent(t){this.config.usePartLayout&&(t.type===Xo.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 ea(ea.DATA,{updatedList:this.updatedList})),this.__updatedList=new Ph,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[jo.CHANGE,this.__onAttrChange,this],[[Xo.ADD,Xo.REMOVE],this.__onChildEvent,this],[ea.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:Lh,updateBounds:Dh,updateChange:Ah}=po,{pushAllChildBranch:Oh,pushAllParent:Ih}=So;const{worldBounds:Mh}=xo;class Fh{constructor(t){this.updatedBounds=new qt,this.beforeBounds=new qt,this.afterBounds=new qt,u(t)&&(t=new Ph(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Mh)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Mh),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:Wh,updateAllChange:Uh}=po,Nh=ne.get("Layouter");class zh{constructor(t,e){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new Sh,this.target=t,e&&(this.config=g.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(ia.START),this.layoutOnce(),t.emitEvent(new ia(ia.END,this.layoutedBlocks,this.times))}catch(t){Nh.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Nh.warn("layouting"):this.times>3?Nh.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(ea.REQUEST),this.totalTimes>1&&this.config.usePartLayout?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=he.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:r,AFTER:o}=ia,a=this.getBlocks(s);a.forEach(t=>t.setBefore()),i.emitEvent(new ia(n,a,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?(Lh(t,!0),e.add(t),t.isBranch&&Oh(t,e),Ih(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Ih(t,e)))})}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach(n=>{e=t.levelMap[n];for(let t=0,n=e.length;t<n;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||Dh(s[t])}Dh(i)}})}(this.__levelList),function(t){t.list.forEach(Ah)}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),i.emitEvent(new ia(r,a,this.times)),i.emitEvent(new ia(o,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,he.end(e)}fullLayout(){const t=he.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=ia,r=this.getBlocks(new Ph(e));e.emitEvent(new ia(i,r,this.times)),zh.fullLayout(e),r.forEach(t=>{t.setAfter()}),e.emitEvent(new ia(s,r,this.times)),e.emitEvent(new ia(n,r,this.times)),this.addBlocks(r),he.end(t)}static fullLayout(t){Wh(t,!0),t.isBranch?So.updateBounds(t):po.updateBounds(t),Uh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Fh([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Fh(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_([[ia.REQUEST,this.layout,this],[ia.AGAIN,this.layoutAgain,this],[ea.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Yh=ne.get("Renderer");class Xh{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,ceilPartPixel:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,i&&(this.config=g.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.requestTime||this.__requestRender()}requestLayout(){this.target.emit(ia.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(sa.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(sa.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(sa.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new qt,Yh.log(e.innerName,"---\x3e");try{this.emitRender(sa.START),this.renderOnce(t),this.emitRender(sa.END,this.totalBounds),or.clearRecycled()}catch(t){this.rendering=!1,Yh.error(t)}Yh.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Yh.warn("rendering");if(this.times>3)return Yh.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new qt,this.renderOptions={},t)this.emitRender(sa.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(sa.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(sa.RENDER,this.renderBounds,this.renderOptions),this.emitRender(sa.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=he.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new qt(s);i.save(),s.spread(Xh.clipSpread).ceil();const{ceilPartPixel:r}=this.config;i.clipWorld(s,r),i.clearWorld(s,r),this.__render(s,n),i.restore(),he.end(e)}fullRender(){const t=he.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),he.end(t)}__render(t,e){const{canvas:i,target:s}=this,n=t.includes(s.__world),r=n?{includes:n}:{bounds:t,includes:n};this.needFill&&i.fillWorld(t,this.config.fill),ne.showRepaint&&ne.drawRepaint(i,t),this.config.useCellRender&&(r.cellList=this.getCellList()),ee.render(s,i,r),this.renderBounds=e=e||t,this.renderOptions=r,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}getCellList(){}addBlock(t,e){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new qt;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 ee.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()};ee.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new qt(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 qt(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;const{updatedList:i}=t;i&&i.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||Yh.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds,i)})}emitRender(t,e,i){this.target.emitEvent(new sa(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[sa.REQUEST,this.update,this],[ia.END,this.__onLayoutEnd,this],[sa.AGAIN,this.renderAgain,this],[ta.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}Xh.clipSpread=10;const Hh={},{copyRadiusPoint:jh}=lt,{hitRadiusPoint:Vh}=Ht;class Gh{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,n=i.ignoreHittable||!1,r=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new Ph(i.findList),i.findList||this.hitBranch(r.isBranchLeaf?{children:[r]}:r);const{list:o}=this.findList,a=this.getBestMatchLeaf(o,i.bottomList,n,!!i.findList),h=n?this.getPath(a):this.getHitablePath(a);return this.clear(),s?{path:h,target:a,throughPath:o.length?this.getThroughPath(o):h}:{path:h,target:a}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(t,e,i,s){const n=this.findList=new Ph;if(t.length){let e;const{x:s,y:r}=this.point,o={x:s,y:r,radiusX:0,radiusY:0};for(let s=0,r=t.length;s<r;s++)if(e=t[s],(i||po.worldHittable(e))&&(this.hitChild(e,e.hitThrough?this.point:o),n.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&po.hasParent(t,e))){n.reset();break}return n.list[0]}}if(e)for(let t=0,i=e.length;t<i;t++)if(this.hitChild(e[t].target,this.point,void 0,e[t].proxy),n.length)return n.list[0];return s?null:i?t[0]:t.find(t=>po.worldHittable(t))}getPath(t){const e=new Ph,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 Ph;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 Ph,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,n,r;for(let t=0,o=i.length;t<o;t++){s=i[t],n=i[t+1];for(let t=0,i=s.length;t<i&&(r=s.list[t],!n||!n.has(r));t++)e.add(r)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s,n;const{point:r}=this;for(let o=t.length-1;o>-1;o--)if(i=t[o],n=i.__,n.visible&&(!e||n.mask))if(s=Vh(i.__world,n.hitRadius?jh(Hh,r,n.hitRadius):r),i.isBranch){if(s||i.__ignoreHitWorld){if(i.isBranchLeaf&&n.__clipAfterFill&&!i.__hitWorld(r,!0))continue;i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,r,e)}}else s&&this.hitChild(i,r,e)}hitChild(t,e,i,s){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e,!(!i||"path"!==t.mask)||void 0)){const{parent:i,mask:n}=t;if(i&&i.__hasMask&&n&&"clipping"!==n&&"clipping-path"!==n&&!i.children.some(t=>!t.mask&&this.isHitLeaf(t,e)))return;const r=s||t,{hitThrough:o}=t,{findList:a}=this;if(o){const e=a.list.findIndex(e=>e[o]===t[o]);if(e>0)return a.addAt(r,e)}a.add(r)}}isHitLeaf(t,e){if(t.isBranch){const{findList:e}=this,i=e.length;this.eachFind([t],!1);const s=e.length-i;for(let t=0;t<s;t++)e.remove(e.indexAt(e.length-1));return!!s}return t.__hitWorld(e)}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class qh{constructor(t,e){this.config={},e&&(this.config=g.default(e,this.config)),this.picker=new Gh(this.target=t,this),this.finder=ue.finder&&ue.finder(t,this.config)}getByPoint(t,e,i){const{target:s,picker:n}=this;return ee.backgrounder&&s&&s.updateLayout(),n.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):ce.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Kh(t){return _r(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0);const i=this.__layout;i.renderChanged||i.renderChange(),i.surfaceChange()}}))}function Zh(t){return _r(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Qh(){return(t,e)=>{const i="_"+e;cr(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(ue,{watcher:(t,e)=>new Rh(t,e),layouter:(t,e)=>new zh(t,e),renderer:(t,e,i)=>new Xh(t,e,i),selector:(t,e)=>new qh(t,e)}),ee.layout=zh.fullLayout,ee.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new Ph,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const $h={},Jh={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}},tl=Qt,el={},il={},sl={},nl={},rl={},ol={apply(){ce.need("filter")}},al={},hl={setStyleName:()=>ce.need("state"),set:()=>ce.need("state")},ll={list:{},register(t,e){ll.list[t]=e},get:t=>ll.list[t]},{parse:dl,objectToCanvasData:cl}=ss,{stintSet:ul}=g,{hasTransparent:pl}=Jh,_l={originPaint:{}},gl=ne.get("UIData");class fl extends y{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,e=t.__hasStrokeSides||t.strokeWidth;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,e):e}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 null==this._width}get __autoHeight(){return null==this._height}get __autoSide(){return null==this._width||null==this._height}get __autoSize(){return null==this._width&&null==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,gl.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,gl.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),h(t)||!t?(ul(this,"__isTransparentFill",pl(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):p(t)&&this.__setPaint("fill",t)}setStroke(t){h(t)||!t?(ul(this,"__isTransparentStroke",pl(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):p(t)&&this.__setPaint("stroke",t)}setPath(t){const e=h(t);e||t&&p(t[0])?(this.__setInput("path",t),this._path=e?dl(t,this.__useArrow):cl(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){yl(this,"shadow",t)}setInnerShadow(t){yl(this,"innerShadow",t)}setFilter(t){yl(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&il.compute("fill",this.__leaf),e&&il.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeScaleFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),o(t.strokeScaleFixed)||(i=t.strokeScaleFixed)),i){const{scaleX:t}=this.__leaf.getRenderScaleData(!0,i,!1);if(1!==t)return e*t}return e}__checkComplex(){const t=this;ul(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),u(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=_l)):(this.__isStrokes=!0,this._stroke||(this._stroke=_l))}__removePaint(t,e){e&&this.__removeInput(t),sl.recycleImage(t,this),"fill"===t?(ul(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(ul(this,"__isAlphaPixelStroke",void 0),ul(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function yl(t,e,i){t.__setInput(e,i),u(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 ml extends fl{}class vl extends ml{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 wl extends ml{__getInputData(t,e){const i=super.__getInputData(t,e);return De.forEach(t=>delete i[t]),i}}class xl extends vl{}class bl extends fl{get __usePathBox(){return this.points||this.__pathInputed}}class El extends fl{get __boxStroke(){return!this.__pathInputed}}class Pl extends fl{get __boxStroke(){return!this.__pathInputed}}class Sl extends fl{get __usePathBox(){return this.points||this.__pathInputed}}class kl extends fl{}class Tl extends fl{get __pathInputed(){return 2}}class Bl extends ml{}const Cl={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class Rl extends fl{get __useNaturalRatio(){return!1}setFontWeight(t){h(t)?(this.__setInput("fontWeight",t),t=Cl[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=_e.get("Rect",0);const n=e.__layout,r=i.__layout;s||(i.parent=e,i.__world=e.__world,r.boxBounds=n.boxBounds),i.set(t),r.strokeChanged&&n.strokeChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.textEditing&&delete i.textEditing,i}}class Ll extends El{get __urlType(){return"image"}setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:this.__urlType,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 Dl extends El{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:Al,add:Ol}=S,Il={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:n}=i,r=this.__box;if((i.stroke||"all"===i.hitStroke)&&n&&"inside"!==s&&(e=t="center"===s?n/2:n,!i.__boxStroke||i.__useArrow)){const e=i.__isLinePath?0:("miter"===i.strokeJoin?10:1)*t,s="none"===i.strokeCap?0:n;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*n),r&&(t=Al(t,r.__layout.strokeSpread=r.__updateStrokeSpread()),e=Math.max(e,r.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:n,filter:r,renderSpread:o}=this.__,{strokeSpread:a}=this.__layout,h=this.__box;e&&(t=rl.getShadowRenderSpread(this,e)),s&&(t=Al(t,s)),r&&(t=Ol(t,ol.getSpread(r))),o&&(t=Ol(t,o)),a&&(t=Ol(t,a));let l=t;return i&&(l=Al(l,rl.getInnerShadowSpread(this,i))),n&&(l=Al(l,n)),this.__layout.renderShapeSpread=l,h?Al(h.__updateRenderSpread(),t):t}},{stintSet:Ml}=g,Fl={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);Ml(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),Ml(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,n=t.innerShadow||t.blur||t.backgroundBlur||t.filter;Ml(t,"__isFastShadow",e&&!n&&e.length<2&&!e[0].spread&&!rl.isTransformShadow(e[0])&&!(e[0].blendMode&&"pass-through"!==e[0].blendMode)&&i&&!t.__isTransparentFill&&!(u(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!n)}t.__checkSingle(),t.__checkComplex()},__drawFast(t,e){Wl(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:n,stroke:r,__drawAfterFill:o,__fillAfterStroke:a,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=il.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&rl.shadow(this,t,h),a&&(s.__isStrokes?il.strokes(r,this,t,e):il.stroke(r,this,t,e)),n&&(s.__isFills?il.fills(n,this,t,e):il.fill(n,this,t,e)),o&&this.__drawAfterFill(t,e),d&&rl.innerShadow(this,t,h),r&&!a&&(s.__isStrokes?il.strokes(r,this,t,e):il.stroke(r,this,t,e)),c&&ol.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?il.strokes(r,this,t,e):il.stroke(r,this,t,e)),h){const e=s.shadow[0],{scaleX:i,scaleY:n}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*n,e.blur*i,Jh.string(e.color))}n&&(s.__isFills?il.fills(n,this,t,e):il.fill(n,this,t,e)),h&&t.restore(),o&&this.__drawAfterFill(t,e),r&&!a&&(s.__isStrokes?il.strokes(r,this,t,e):il.stroke(r,this,t,e))}}else s.__pathForRender?Wl(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:n}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?il.fills(s,this,t,e):il.fill("#000000",this,t,e)),i.__isCanvas&&this.__drawAfterFill(t,e),n&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?il.strokes(n,this,t,e):il.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 Wl(t,e,i){const{fill:s,stroke:n,__drawAfterFill:r,__fillAfterStroke:o}=t.__;t.__drawRenderPath(e),o&&il.stroke(n,t,e,i),s&&il.fill(s,t,e,i),r&&t.__drawAfterFill(e,i),n&&!o&&il.stroke(n,t,e,i)}const Ul={__drawFast(t,e){let{x:i,y:s,width:n,height:r}=this.__layout.boxBounds;const{fill:o,stroke:a,__drawAfterFill:h}=this.__;if(o&&(t.fillStyle=o,t.fillRect(i,s,n,r)),h&&this.__drawAfterFill(t,e),a){const{strokeAlign:o,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(a,h,this.__);const l=h/2;switch(o){case"center":t.strokeRect(0,0,n,r);break;case"inside":n-=h,r-=h,n<0||r<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,n,r),t.restore()):t.strokeRect(i+l,s+l,n,r);break;case"outside":t.strokeRect(i-l,s-l,n+h,r+h)}}}};var Nl,zl;t.UI=Nl=class extends t.Leaf{get app(){return this.leafer&&this.leafer.app}set strokeWidthFixed(t){this.strokeScaleFixed=t}get strokeWidthFixed(){return this.strokeScaleFixed}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 Kn.set(this.path=t||[]),t||this.__drawPathByBox(Kn),Kn}set(t,e){t&&Object.assign(this,t)}get(t){return h(t)?this.__.__getInput(t):this.__.__getInputData(t)}find(t,e){return ce.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return ce.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(Kn.set(i=[]),this.__drawPathByBox(Kn,!e)),t?ss.toCanvasData(i,!0):i}getPathString(t,e,i){return ss.stringify(this.getPath(t,e),i)}asPath(t,e){this.path=this.getPath(t,e)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||al.running?t.__computePaint():t.__needComputePaint=!0}}__updatePath(){}__updateRenderPath(t){const e=this.__;e.path?(e.__pathForRender=e.cornerRadius||e.path.radius?Gn.smooth(e.path,e.cornerRadius,e.cornerSmoothing):e.path,e.__useArrow&&el.addArrows(this,t)):e.__pathForRender&&(e.__pathForRender=void 0)}__drawRenderPath(t){const e=this.__;t.beginPath(),e.__useArrow&&el.updateArrow(this),this.__drawPathByData(t,e.__pathForRender)}__drawPath(t){const e=this.__;t.beginPath(),e.__usePointsMode?hn.drawPathByPoints(t,e.points,e.closed):this.__drawPathByData(t,e.path,!0)}__drawPathByData(t,e,i){e?hn.drawPathByData(t,e):this.__drawPathByBox(t,i)}__drawPathByBox(t,e){const{x:i,y:s,width:n,height:r}=this.__layout.boxBounds;if(this.__.cornerRadius&&!e){const{cornerRadius:e}=this.__;t.roundRect(i,s,n,r,d(e)?[e]:e)}else t.rect(i,s,n,r);t.closePath()}drawImagePlaceholder(t,e,i){il.fill(this.__.placeholderColor,this,e,i)}animate(t,e,i,s){return this.set(t),ce.need("animate")}killAnimate(t,e){}export(t,e){return ce.need("export")}syncExport(t,e){return ce.need("export")}clone(t){const e=g.clone(this.toJSON());return t&&Object.assign(e,t),Nl.one(e)}static one(t,e,i,s,n){return _e.get(t.tag||this.prototype.__tag,t,e,i,s,n)}static registerUI(){Jr()(this)}static registerData(t){Hr(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.__.__willDestroy=!0,this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}},s([Hr(fl)],t.UI.prototype,"__",void 0),s([Qh()],t.UI.prototype,"zoomLayer",void 0),s([yr("")],t.UI.prototype,"id",void 0),s([yr("")],t.UI.prototype,"name",void 0),s([yr("")],t.UI.prototype,"className",void 0),s([Dr("pass-through")],t.UI.prototype,"blendMode",void 0),s([Ir(1)],t.UI.prototype,"opacity",void 0),s([Mr(!0)],t.UI.prototype,"visible",void 0),s([Dr(!1)],t.UI.prototype,"locked",void 0),s([Or(!1)],t.UI.prototype,"dim",void 0),s([Or(!1)],t.UI.prototype,"dimskip",void 0),s([Ur(0)],t.UI.prototype,"zIndex",void 0),s([Nr(!1)],t.UI.prototype,"mask",void 0),s([zr(!1)],t.UI.prototype,"eraser",void 0),s([mr(0,!0)],t.UI.prototype,"x",void 0),s([mr(0,!0)],t.UI.prototype,"y",void 0),s([Er(100,!0)],t.UI.prototype,"width",void 0),s([Er(100,!0)],t.UI.prototype,"height",void 0),s([xr(1,!0)],t.UI.prototype,"scaleX",void 0),s([xr(1,!0)],t.UI.prototype,"scaleY",void 0),s([br(0,!0)],t.UI.prototype,"rotation",void 0),s([br(0,!0)],t.UI.prototype,"skewX",void 0),s([br(0,!0)],t.UI.prototype,"skewY",void 0),s([mr(0,!0)],t.UI.prototype,"offsetX",void 0),s([mr(0,!0)],t.UI.prototype,"offsetY",void 0),s([vr(0,!0)],t.UI.prototype,"scrollX",void 0),s([vr(0,!0)],t.UI.prototype,"scrollY",void 0),s([wr()],t.UI.prototype,"origin",void 0),s([wr()],t.UI.prototype,"around",void 0),s([yr(!1)],t.UI.prototype,"lazy",void 0),s([Pr(1)],t.UI.prototype,"pixelRatio",void 0),s([Lr(0)],t.UI.prototype,"renderSpread",void 0),s([kr()],t.UI.prototype,"path",void 0),s([Tr()],t.UI.prototype,"windingRule",void 0),s([Tr(!0)],t.UI.prototype,"closed",void 0),s([Er(0)],t.UI.prototype,"padding",void 0),s([Er(!1)],t.UI.prototype,"lockRatio",void 0),s([Er()],t.UI.prototype,"widthRange",void 0),s([Er()],t.UI.prototype,"heightRange",void 0),s([yr(!1)],t.UI.prototype,"draggable",void 0),s([yr()],t.UI.prototype,"dragBounds",void 0),s([yr("auto")],t.UI.prototype,"dragBoundsType",void 0),s([yr(!1)],t.UI.prototype,"editable",void 0),s([Yr(!0)],t.UI.prototype,"hittable",void 0),s([Yr()],t.UI.prototype,"hitThrough",void 0),s([Yr("path")],t.UI.prototype,"hitFill",void 0),s([Rr("path")],t.UI.prototype,"hitStroke",void 0),s([Yr(!1)],t.UI.prototype,"hitBox",void 0),s([Yr(!0)],t.UI.prototype,"hitChildren",void 0),s([Yr(!0)],t.UI.prototype,"hitSelf",void 0),s([Yr()],t.UI.prototype,"hitRadius",void 0),s([Xr("")],t.UI.prototype,"cursor",void 0),s([Dr()],t.UI.prototype,"fill",void 0),s([Rr(void 0,!0)],t.UI.prototype,"stroke",void 0),s([Rr("inside")],t.UI.prototype,"strokeAlign",void 0),s([Rr(1,!0)],t.UI.prototype,"strokeWidth",void 0),s([Rr(!1)],t.UI.prototype,"strokeScaleFixed",void 0),s([Rr("none")],t.UI.prototype,"strokeCap",void 0),s([Rr("miter")],t.UI.prototype,"strokeJoin",void 0),s([Rr()],t.UI.prototype,"dashPattern",void 0),s([Rr(0)],t.UI.prototype,"dashOffset",void 0),s([Rr(10)],t.UI.prototype,"miterLimit",void 0),s([Tr(0)],t.UI.prototype,"cornerRadius",void 0),s([Tr()],t.UI.prototype,"cornerSmoothing",void 0),s([Kh()],t.UI.prototype,"shadow",void 0),s([Kh()],t.UI.prototype,"innerShadow",void 0),s([Kh()],t.UI.prototype,"blur",void 0),s([Kh()],t.UI.prototype,"backgroundBlur",void 0),s([Kh()],t.UI.prototype,"grayscale",void 0),s([Kh()],t.UI.prototype,"filter",void 0),s([Dr()],t.UI.prototype,"placeholderColor",void 0),s([yr(100)],t.UI.prototype,"placeholderDelay",void 0),s([yr({})],t.UI.prototype,"data",void 0),t.UI=Nl=s([$r(Il),$r(Fl),Zr()],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);if(!this.childlessJSON){const i=e.children=[];this.children.forEach(e=>e.skipJSON||i.push(e.toJSON(t)))}return 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))}},s([Hr(ml)],t.Group.prototype,"__",void 0),s([Er(0)],t.Group.prototype,"width",void 0),s([Er(0)],t.Group.prototype,"height",void 0),t.Group=s([$r(t.Branch),Jr()],t.Group);const Yl=ne.get("Leafer");t.Leafer=zl=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&&nr.isComplete}get layoutLocked(){return!this.layouter.running}get view(){return this.canvas&&this.canvas.view}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),zl.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,g.assign(s,t));const n=this.canvas=ue.canvas(s);this.__controllers.push(this.renderer=ue.renderer(this,n,s),this.watcher=ue.watcher(this,s),this.layouter=ue.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),e||(this.selector=ue.selector(this),this.interaction=ue.interaction(this,n,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=ue.hitCanvasManager()),this.canvasManager=new ve,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(n),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),Lo.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(na.RESTART):this.emitLeafer(na.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(na.STOP))}unlockLayout(t=!0){this.layouter.start(),t&&this.updateLayout()}lockLayout(t=!0){t&&this.updateLayout(),this.layouter.stop()}resize(t){const e=g.copyAttrs({},t,De);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new qt(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=g.copyAttrs({},this.canvas,De);e.resize(t),this.updateLazyBounds(),this.__onResize(new ta(t,i))}__onResize(t){this.emitEvent(t),g.copyAttrs(this.__,t,De),setTimeout(()=>{this.canvasManager&&this.canvasManager.clearRecycled()},0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager}__setLeafer(t){this.leafer=t,this.__level=1}__checkAutoLayout(){const{config:t,parentApp:e}=this;e||(t.width&&t.height||(this.autoLayout=new Zt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(De.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t?this.parent||(this.canvas.hittable=e):"zIndex"===t?(this.canvas.zIndex=e,setTimeout(()=>this.parent&&this.parent.__updateSortChildren())):"mode"===t&&this.emit(na.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&De.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,n=g.copyAttrs({},s,De);n[t]=i[t]=e,i.width&&i.height?s.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(n)}__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(na.BEFORE_READY),this.emitLeafer(na.READY),this.emitLeafer(na.AFTER_READY),Lo.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(na.VIEW_READY),Lo.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:n,pixelRatio:r}=this;const o="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,o.x+o.width)),i||(n=Math.max(1,o.y+o.height)),this.__doResize({width:s,height:n,pixelRatio:r})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){Lo.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(na.VIEW_COMPLETED),Lo.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 ce.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 na(t,this))}__listenEvents(){const t=he.start("FirstCreate "+this.innerName);this.once([[na.START,()=>he.end(t)],[ia.START,this.updateLazyBounds,this],[sa.START,this.__onCreated,this],[sa.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[ea.DATA,this.__onWatchData,this],[ia.END,this.__onLayoutEnd,this],[sa.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){zl.list.remove(this);try{this.stop(),this.emitLeafer(na.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.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{or.clearRecycled()},100)}catch(t){Yl.error(t)}}};t?e():setTimeout(e)}},t.Leafer.list=new Ph,s([Hr(wl)],t.Leafer.prototype,"__",void 0),s([Er()],t.Leafer.prototype,"pixelRatio",void 0),s([yr("normal")],t.Leafer.prototype,"mode",void 0),t.Leafer=zl=s([Jr()],t.Leafer),t.Rect=class extends t.UI{get __tag(){return"Rect"}},s([Hr(El)],t.Rect.prototype,"__",void 0),t.Rect=s([$r(Ul),Zr(),Jr()],t.Rect);const{add:Xl,includes:Hl,scroll:jl}=Ht,Vl=t.Rect.prototype,Gl=t.Group.prototype;t.Box=class extends t.Group{get __tag(){return"Box"}get isBranchLeaf(){return!0}get __useSelfBox(){return this.pathInputed}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.__useSelfBox){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:n,boxBounds:r}=s,{overflow:o}=i,a=s.childrenRenderBounds||(s.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(a),(e=o&&o.includes("scroll"))&&(Xl(a,r),jl(a,i)),this.__updateRectRenderBounds(),t=!Hl(r,a),t&&"show"===o&&Xl(n,a)}else this.__updateRectRenderBounds();g.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))}},s([Hr(vl)],t.Box.prototype,"__",void 0),s([Er(100)],t.Box.prototype,"width",void 0),s([Er(100)],t.Box.prototype,"height",void 0),s([yr(!1)],t.Box.prototype,"resizeChildren",void 0),s([Lr("show")],t.Box.prototype,"overflow",void 0),s([Kr(Vl.__updateStrokeSpread)],t.Box.prototype,"__updateStrokeSpread",null),s([Kr(Vl.__updateRenderSpread)],t.Box.prototype,"__updateRectRenderSpread",null),s([Kr(Vl.__updateBoxBounds)],t.Box.prototype,"__updateRectBoxBounds",null),s([Kr(Vl.__updateStrokeBounds)],t.Box.prototype,"__updateStrokeBounds",null),s([Kr(Vl.__updateRenderBounds)],t.Box.prototype,"__updateRectRenderBounds",null),s([Kr(Vl.__updateChange)],t.Box.prototype,"__updateRectChange",null),s([Kr(Vl.__render)],t.Box.prototype,"__renderRect",null),s([Kr(Gl.__render)],t.Box.prototype,"__renderGroup",null),t.Box=s([Zr(),Jr()],t.Box),t.Frame=class extends t.Box{get __tag(){return"Frame"}get isFrame(){return!0}},s([Hr(xl)],t.Frame.prototype,"__",void 0),s([Dr("#FFFFFF")],t.Frame.prototype,"fill",void 0),s([Lr("hide")],t.Frame.prototype,"overflow",void 0),t.Frame=s([Jr()],t.Frame);const{moveTo:ql,closePath:Kl,ellipse:Zl}=Ts,{tempPoint:Ql,set:$l,rotate:Jl}=lt,{abs:td}=Math,ed={};t.Ellipse=class extends t.UI{get __tag(){return"Ellipse"}__updatePath(){const t=this.__,{width:e,height:i,innerRadius:s,startAngle:n,endAngle:r,closed:o}=t,a=e/2,h=i/2,l=t.path=[];let d,c,u;if((n||r)&&(c=!0),c&&(u=360===td(r-n)),s){const t=s<1||o,e=a*s,i=h*s;c?(Zl(l,a,h,a,h,0,n,r),t?(u&&(Kl(l),$l(Ql,a+e,h),$l(ed,a,h),Jl(Ql,r,ed,a,h),ql(l,Ql.x,Ql.y)),Zl(l,a,h,e,i,0,r,n,!0)):u||(d=!0)):(Zl(l,a,h,a,h),t&&(Kl(l),ql(l,a+e,h),Zl(l,a,h,e,i,0,360,0,!0)))}else c?(u||(o||(d=!0),d||ql(l,a,h)),Zl(l,a,h,a,h,0,n,r)):Zl(l,a,h,a,h);d||Kl(l),(ee.ellipseToCurve||t.__useArrow||t.cornerRadius)&&(t.path=this.getPath(!0))}},s([Hr(Pl)],t.Ellipse.prototype,"__",void 0),s([Tr(0)],t.Ellipse.prototype,"innerRadius",void 0),s([Tr(0)],t.Ellipse.prototype,"startAngle",void 0),s([Tr(0)],t.Ellipse.prototype,"endAngle",void 0),t.Ellipse=s([Jr()],t.Ellipse);const{sin:id,cos:sd,PI:nd}=Math,{moveTo:rd,lineTo:od,closePath:ad,drawPoints:hd}=Ts;t.Polygon=class extends t.UI{get __tag(){return"Polygon"}get isPointsMode(){return this.points&&!this.pathInputed}__updatePath(){const t=this.__,e=t.path=[];if(t.points)hd(e,t.points,t.curve,t.closed,t);else{const{width:i,height:s,sides:n,startAngle:r}=t,o=i/2,a=s/2;let h,l=0;r?(l=r*W,rd(e,o+o*id(l),a-a*sd(l))):rd(e,o,0);for(let t=1;t<n;t++)h=2*t*nd/n+l,od(e,o+o*id(h),a-a*sd(h));ad(e)}}},s([Hr(Sl)],t.Polygon.prototype,"__",void 0),s([Tr(3)],t.Polygon.prototype,"sides",void 0),s([Tr(0)],t.Polygon.prototype,"startAngle",void 0),s([Tr()],t.Polygon.prototype,"points",void 0),s([Tr(0)],t.Polygon.prototype,"curve",void 0),t.Polygon=s([Zr(),Jr()],t.Polygon);const{sin:ld,cos:dd,PI:cd}=Math,{moveTo:ud,lineTo:pd,closePath:_d}=Ts;t.Star=class extends t.UI{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s,startAngle:n}=this.__,r=t/2,o=e/2,a=this.__.path=[];let h,l=0;n?(l=n*W,ud(a,r+r*ld(l),o-o*dd(l))):ud(a,r,0);for(let t=1;t<2*i;t++)h=t*cd/i+l,pd(a,r+(t%2==0?r:r*s)*ld(h),o-(t%2==0?o:o*s)*dd(h));_d(a)}},s([Hr(kl)],t.Star.prototype,"__",void 0),s([Tr(5)],t.Star.prototype,"corners",void 0),s([Tr(.382)],t.Star.prototype,"innerRadius",void 0),s([Tr(0)],t.Star.prototype,"startAngle",void 0),t.Star=s([Jr()],t.Star);const{moveTo:gd,lineTo:fd,drawPoints:yd}=Ts,{rotate:md,getAngle:vd,getDistance:wd,defaultPoint:xd}=lt;t.Line=class extends t.UI{get __tag(){return"Line"}get isPointsMode(){return this.points&&!this.pathInputed}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&md(i,e),i}set toPoint(t){this.width=wd(xd,t),this.rotation=vd(xd,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?yd(e,t.points,t.curve,t.closed,t):(gd(e,0,0),fd(e,this.width,0))}},s([Hr(bl)],t.Line.prototype,"__",void 0),s([Br("center")],t.Line.prototype,"strokeAlign",void 0),s([Er(0)],t.Line.prototype,"height",void 0),s([Tr()],t.Line.prototype,"points",void 0),s([Tr(0)],t.Line.prototype,"curve",void 0),s([Tr(!1)],t.Line.prototype,"closed",void 0),t.Line=s([Jr()],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 u(t)&&t[0].image}},s([Hr(Ll)],t.Image.prototype,"__",void 0),s([Er("")],t.Image.prototype,"url",void 0),t.Image=s([Jr()],t.Image);const bd=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=ue.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new dr({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new Go(Go.LOADED,{image:t}))})}draw(t,e,i,s){const n=new yt(t.worldTransform).invert(),r=new yt;e&&r.translate(e.x,e.y),i&&(d(i)?r.scale(i):r.scale(i.x,i.y)),s&&r.rotate(s),n.multiplyParent(r),t.__render(this.canvas,{matrix:n.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:n}=this.canvas;t.drawImage(n,0,0,n.width,n.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()}},s([Hr(Dl)],t.Canvas.prototype,"__",void 0),s([Zh(100)],t.Canvas.prototype,"width",void 0),s([Zh(100)],t.Canvas.prototype,"height",void 0),s([Zh(1)],t.Canvas.prototype,"pixelRatio",void 0),s([Zh(!0)],t.Canvas.prototype,"smooth",void 0),s([yr(!1)],t.Canvas.prototype,"safeResize",void 0),s([Zh()],t.Canvas.prototype,"contextSettings",void 0),t.Canvas=s([Jr()],t.Canvas);const{copyAndSpread:Ed,includes:Pd,setList:Sd}=Ht,{stintSet:kd}=g;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:n,fontWeight:r,italic:o,textCase:a,textOverflow:h,padding:l,width:d,height:c}=t;t.__lineHeight=tl.number(e,n),t.__letterSpacing=tl.number(i,n),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*n)/2,t.__font=`${o?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==r?r+" ":""}${n||12}px ${s||"caption"}`,kd(t,"__padding",l&&M.fourNumber(l)),kd(t,"__clipText","show"!==h&&!t.__autoSize),kd(t,"__isCharMode",d||c||t.__letterSpacing||t.motionText||"none"!==a),t.__textDrawData=$h.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:n,__autoWidth:r,__autoHeight:o}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&(e.renderChanged=!0),r||o){if(h.x=r?a.x:0,h.y=o?a.y:0,h.width=r?a.width:t.width,h.height=o?a.height:t.height,n){const[e,i,s,n]=t.__padding;r&&(h.x-=n,h.width+=i+n),o&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),g.stintSet(this,"isOverflow",!Pd(h,a)&&!t.motionText),this.isOverflow?(Sd(t.__textBoxBounds={},[h,a]),e.renderChanged=!0):t.__textBoxBounds=h}__updateRenderSpread(){let t=super.__updateRenderSpread();t||(t=this.isOverflow?1:0);const{__lineHeight:e,fontSize:i}=this.__;return e<i&&(t=S.max(t,(i-e)/2)),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;Ed(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()}},s([Hr(Rl)],t.Text.prototype,"__",void 0),s([Er(0)],t.Text.prototype,"width",void 0),s([Er(0)],t.Text.prototype,"height",void 0),s([Dr()],t.Text.prototype,"boxStyle",void 0),s([yr(!1)],t.Text.prototype,"resizeFontSize",void 0),s([Dr("#000000")],t.Text.prototype,"fill",void 0),s([Br("outside")],t.Text.prototype,"strokeAlign",void 0),s([Yr("all")],t.Text.prototype,"hitFill",void 0),s([Er("")],t.Text.prototype,"text",void 0),s([Er("")],t.Text.prototype,"placeholder",void 0),s([Er("caption")],t.Text.prototype,"fontFamily",void 0),s([Er(12)],t.Text.prototype,"fontSize",void 0),s([Er("normal")],t.Text.prototype,"fontWeight",void 0),s([Er(!1)],t.Text.prototype,"italic",void 0),s([Er("none")],t.Text.prototype,"textCase",void 0),s([Er("none")],t.Text.prototype,"textDecoration",void 0),s([Er(0)],t.Text.prototype,"letterSpacing",void 0),s([Er({type:"percent",value:1.5})],t.Text.prototype,"lineHeight",void 0),s([Er(0)],t.Text.prototype,"paraIndent",void 0),s([Er(0)],t.Text.prototype,"paraSpacing",void 0),s([Er("x")],t.Text.prototype,"writingMode",void 0),s([Er("left")],t.Text.prototype,"textAlign",void 0),s([Er("top")],t.Text.prototype,"verticalAlign",void 0),s([Er(!0)],t.Text.prototype,"autoSizeAlign",void 0),s([Er("normal")],t.Text.prototype,"textWrap",void 0),s([Er("show")],t.Text.prototype,"textOverflow",void 0),s([Dr(!1)],t.Text.prototype,"textEditing",void 0),t.Text=s([Jr()],t.Text),t.Path=class extends t.UI{get __tag(){return"Path"}},s([Hr(Tl)],t.Path.prototype,"__",void 0),s([Br("center")],t.Path.prototype,"strokeAlign",void 0),t.Path=s([Jr()],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}paint(){const{pathElement:t}=this;t.__layout.boxChanged||t.forceUpdate("path")}},s([Hr(Bl)],t.Pen.prototype,"__",void 0),s([(t,e)=>{cr(t,e,{get(){return this.__path}})}],t.Pen.prototype,"path",void 0),t.Pen=s([$r(Vs,["set","path","paint"]),Jr()],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:n}=t;e&&(this.ground=this.addLeafer(e)),(i||n)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||n)&&(this.sky=this.addLeafer(s)),n&&ue.editor(n,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),o(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,void 0,void 0,!0))}__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&&g.assign(e,t),this.autoLayout&&g.copyAttrs(e,this,De),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[ia.END,this.__onReady,this],[sa.START,this.__onCreated,this],[sa.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(sa.END,this.__onChildRenderEnd,this))}},t.App=s([Jr()],t.App);const Td={},Bd={isHoldSpaceKey:()=>Bd.isHold("Space"),isHold:t=>Td[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){Td[t]||(Td[t]=!0)},setUpCode(t){Td[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 Rd extends Yo{get spaceKey(){return Bd.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 Bd.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){ye.changeName(t,e)}}const{min:Ld,max:Dd,abs:Ad}=Math,{float:Od,sign:Id}=M,{minX:Md,maxX:Fd,minY:Wd,maxY:Ud}=Ht,Nd=new qt,zd=new qt,Yd={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&Xd.getValidMove(t.__localBoxBounds,Xd.getDragBounds(t),s,e,!0),Xd.axisMove(t,e)},limitScaleOf(t,e,i,s){const{dragBounds:n,dragBoundsType:r}=t;n&&Xd.getValidScaleOf(t.__localBoxBounds,Xd.getDragBounds(t),r,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&&Od(t[s])>Od(e[s]),getValidMove(t,e,i,s,n){const r=t.x+s.x,o=t.y+s.y,a=r+t.width,h=o+t.height,l=e.x+e.width,d=e.y+e.height;return n||(s=Object.assign({},s)),Xd.isInnerMode(t,e,i,"width")?r>e.x?s.x+=e.x-r:a<l&&(s.x+=l-a):r<e.x?s.x+=e.x-r:a>l&&(s.x+=l-a),Xd.isInnerMode(t,e,i,"height")?o>e.y?s.y+=e.y-o:h<d&&(s.y+=d-h):o<e.y?s.y+=e.y-o:h>d&&(s.y+=d-h),s.x=Od(s.x),s.y=Od(s.y),s},getValidScaleOf(t,e,i,s,n,r,o){o||(n=Object.assign({},n)),zd.set(e),Nd.set(t).scaleOf(s,n.x,n.y);const a=Od((s.x-t.x)/t.width),h=Od(1-a),d=Od((s.y-t.y)/t.height),c=Od(1-d);let u,p,_,g,f=1,y=1;return Xd.isInnerMode(t,e,i,"width")?(n.x<0&&Nd.scaleOf(s,f=1/n.x,1),_=Od(Nd.minX-zd.minX),g=Od(zd.maxX-Nd.maxX),u=a&&_>0?1+_/(a*Nd.width):1,p=h&&g>0?1+g/(h*Nd.width):1,f*=Dd(u,p)):(n.x<0&&((Od(Md(t)-Md(e),2)<=0||Od(Fd(e)-Fd(t),2)<=0)&&(Nd.scaleOf(s,f=1/n.x,1),Nd.width>1&&(f*=1/Nd.width,Nd.width=1)),Nd.unsign()),_=Od(zd.minX-Nd.minX),g=Od(Nd.maxX-zd.maxX),u=a&&_>0?1-_/(a*Nd.width):1,p=h&&g>0?1-g/(h*Nd.width):1,f*=Ld(u,p)),Xd.isInnerMode(t,e,i,"height")?(n.y<0&&Nd.scaleOf(s,1,y=1/n.y),_=Od(Nd.minY-zd.minY),g=Od(zd.maxY-Nd.maxY),u=d&&_>0?1+_/(d*Nd.height):1,p=c&&g>0?1+g/(c*Nd.height):1,y*=Dd(u,p),r&&(u=Dd(Ad(f),Ad(y)),f=Id(f)*u,y=Id(y)*u)):(n.y<0&&((Od(Wd(t)-Wd(e),2)<=0||Od(Ud(e)-Ud(t),2)<=0)&&(Nd.scaleOf(s,1,y=1/n.y),Nd.height>1&&(y*=1/Nd.height,Nd.height=1)),Nd.unsign()),_=Od(zd.minY-Nd.minY),g=Od(Nd.maxY-zd.maxY),u=d&&_>0?1-_/(d*Nd.height):1,p=c&&g>0?1-g/(c*Nd.height):1,y*=Ld(u,p)),n.x*=l(f)?f:1,n.y*=l(y)?y:1,n}},Xd=Yd;t.PointerEvent=class extends Rd{},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=s([to()],t.PointerEvent);const Hd=t.PointerEvent,jd={};t.DragEvent=class extends t.PointerEvent{static setList(t){this.list=t instanceof Ph?t:new Ph(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const n=t.getLocalPoint(i,null,!0);return lt.move(n,e.x-t.x,e.y-t.y),s&&this.limitMove(t,n),Yd.axisMove(t,n),n}static limitMove(t,e){Yd.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(jd,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(jd,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(jd,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 Ht.set(i,e.x-t.x,e.y-t.y,t.x,t.y),Ht.unsign(i),i}assignMove(t){jd.x=t?this.totalX:this.moveX,jd.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.ANIMATE="drag.animate",t.DragEvent=s([to()],t.DragEvent);const Vd=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=s([to()],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.DRAG_ANIMATE="move.drag_animate",t.MoveEvent.END="move.end",t.MoveEvent.PULL_DOWN="move.pull_down",t.MoveEvent.REACH_BOTTOM="move.reach_bottom",t.MoveEvent=s([to()],t.MoveEvent),t.TouchEvent=class extends Rd{},t.TouchEvent=s([to()],t.TouchEvent);const Gd=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=s([to()],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=s([to()],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=s([to()],t.ZoomEvent),t.KeyEvent=class extends Rd{},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=s([to()],t.KeyEvent);const qd={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:Kd.getSwipeDirection(lt.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,time:Date.now(),buttons:o(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 Ph,{list:s}=t;for(let t=0,n=s.length;t<n;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:e=>e&&e.list.some(e=>po.draggable(e)||!e.isLeafer&&e.hasEvent(t.DragEvent.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},Kd=qd,Zd=new Ph,{getDragEventData:Qd,getDropEventData:$d,getSwipeEventData:Jd}=qd;class tc{constructor(t){this.dragDataList=[],this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=Qd(t,t,t),this.canAnimate=this.canDragOut=!0}getList(e,i){const{proxy:s}=this.interaction.selector,n=s&&s.list.length,r=t.DragEvent.list||this.draggableList||Zd;return this.dragging&&(n?e?Zd:new Ph(i?[...s.list,...s.dragHoverExclude]:s.list):r)}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],po.draggable(e)){this.draggableList=new Ph(e);break}}drag(e){const{interaction:i,dragData:s,downData:n}=this,{path:r,throughPath:o}=n;this.dragData=Qd(n,s,e),o&&(this.dragData.throughPath=o),this.dragData.path=r,this.dragDataList.push(this.dragData),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,n=this.realDraggableList;if(n.length&&s){const{totalX:s,totalY:r}=this.dragData,{dragLimitAnimate:o}=i.p,a=!o||!!e;n.forEach(i=>{if(i.draggable){const n=h(i.draggable),l=t.DragEvent.getValidMove(i,this.dragStartPoints[i.innerId],{x:s,y:r},a||n);o&&!n&&e?po.animateMove(i,l,d(o)?o:.3,()=>i.emit(t.DragEvent.ANIMATE)):i.move(l)}})}}dragOverOrOut(e){const{interaction:i}=this,{dragOverPath:s}=this,{path:n}=e;this.dragOverPath=n,s?n.indexAt(0)!==s.indexAt(0)&&(i.emit(t.DragEvent.OUT,e,s),i.emit(t.DragEvent.OVER,e,n)):i.emit(t.DragEvent.OVER,e,n)}dragEnterOrLeave(e){const{interaction:i}=this,{dragEnterPath:s}=this,{path:n}=e;i.emit(t.DragEvent.LEAVE,e,s,n),i.emit(t.DragEvent.ENTER,e,n,s),this.dragEnterPath=n}dragEnd(t){(this.dragging||this.moving)&&(setTimeout(()=>this.interaction.pointerMove(t)),this.checkDragEndAnimate(t)||this.dragEndReal(t))}dragEndReal(e){const{interaction:i,downData:s,dragData:n}=this;e||(e=n);const{path:r,throughPath:o}=s,a=Qd(s,e,e);if(o&&(a.throughPath=o),a.path=r,this.moving&&(this.moving=!1,a.moveType="drag",i.emit(t.MoveEvent.END,a)),this.dragging){const r=this.getList();this.dragging=!1,i.p.dragLimitAnimate&&this.dragReal(!0),i.emit(t.DragEvent.END,a),this.swipe(e,s,n,a),this.drop(e,r,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:n}=this;if(lt.getDistance(e,t)>n.config.pointer.swipeDistance){const t=Jd(e,i,s);this.interaction.emit(t.type,t)}}drop(e,i,s){const n=$d(e,i,t.DragEvent.data);n.path=s,this.interaction.emit(t.DropEvent.DROP,n),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,this.dragDataList=[]}checkDragEndAnimate(t,e){return!1}animate(t,e){}stopAnimate(){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const ec=ne.get("emit");const ic=["move","zoom","rotate","key"];function sc(t,e,i,s,n){if(ic.some(t=>e.startsWith(t))&&t.__.hitChildren&&!rc(t,n)){let r;for(let o=0,a=t.children.length;o<a;o++)r=t.children[o],!i.path.has(r)&&r.__.hittable&&nc(r,e,i,s,n)}}function nc(t,e,i,s,n){if(t.destroyed)return!1;if(t.__.hitSelf&&!rc(t,n)&&(hl.updateEventStyle&&!s&&hl.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const n=ye.get(e,i);if(t.emitEvent(n,s),n.isStop)return!0}return!1}function rc(t,e){return e&&e.has(t)}const oc={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:ac,pathCanDrag:hc,pathHasOutside:lc}=qd;class dc{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&&Bd.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=g.clone(oc),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new Ph(t),this.createTransformer(),this.dragger=new tc(this),s&&(this.config=g.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),e.path.needUpdate&&this.updateDownData(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=lt.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,Bd.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,Bd.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 Ph),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 n=Date.now()-this.downTime,r=[t.PointerEvent.DOUBLE_TAP,t.PointerEvent.DOUBLE_CLICK].some(t=>ac(e.path,t));n<i.tapTime+50&&r?(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:n,target:r}=this;ee.backgrounder||t.origin||r&&r.updateLayout();const o=this.selector.getByPoint(t,i,Object.assign({bottomList:n,name:t.type},e||{through:s}));return o.throughPath&&(t.throughPath=o.throughPath),t.path=o.path,o.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&&!lc(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!hc(t.path))&&!lc(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))}stopDragAnimate(){this.dragger.stopAnimate()}replaceDownTarget(t){const{downData:e}=this;if(e&&t){const{path:i}=e;i.remove(i.list[0]),i.addAt(t,0)}}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,n=s.length;t<n&&(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:n}=this.canvas;return s.x*=n.width/i.width,s.y*=n.height/i.height,this.p.snap&<.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),(ac(e.path,t.PointerEvent.LONG_TAP)||ac(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 qt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(d(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(ta.RESIZE,this.__onResize,this)],t.once(na.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 n;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let r=i.length-1;r>-1;r--){if(n=i.list[r],nc(n,t,e,!0,s))return;n.isApp&&sc(n,t,e,!0,s)}for(let r=0,o=i.length;r<o;r++)if(n=i.list[r],n.isApp&&sc(n,t,e,!1,s),nc(n,t,e,!1,s))return}catch(t){ec.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 cc{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}cc.custom={};class uc extends ve{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new Ph,this.pixelList=new Ph}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),ue.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),ue.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()}}ee.getSelector=function(t){return t.leafer?t.leafer.selector:ee.selector||(ee.selector=ue.selector())};const{toInnerRadiusPointOf:pc,copyRadiusPoint:_c}=lt,{hitRadiusPoint:gc,hitPoint:fc}=Ht,yc={},mc={},vc=t.Leaf.prototype;vc.hit=function(t,e=0){this.updateLayout(),_c(mc,t,e);const i=this.__world;return!!(e?gc(i,mc):fc(i,mc))&&(this.isBranch?ee.getSelector(this).hitPoint(Object.assign({},mc),e,{target:this}):this.__hitWorld(mc))},vc.__hitWorld=function(t,e){const i=this.__;if(!i.hitSelf)return!1;const s=this.__world,n=this.__layout,r=s.width<10&&s.height<10;if(i.hitRadius&&(_c(yc,t,i.hitRadius),t=yc),pc(t,s,yc),i.hitBox||r){if(Ht.hitRadiusPoint(n.boxBounds,yc))return!0;if(r)return!1}return!n.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),n.boundsChanged||(n.hitCanvasChanged=!1)),this.__hit(yc,e)},vc.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},vc.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},vc.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},vc.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const wc=new yt,xc=t.UI.prototype;xc.__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,n=i||s;this.__hitCanvas||(this.__hitCanvas=n?t.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):t.getPathType(this));const r=this.__hitCanvas;if(n){const{renderBounds:t}=this.__layout,n=ee.image.hitCanvasSize,o=r.hitScale=Kt.set(0,0,n,n).getFitMatrix(t).a,{x:a,y:h,width:l,height:d}=Kt.set(t).scale(o);r.resize({width:l,height:d,pixelRatio:1}),r.clear(),or.patternLocked=!0,this.__renderShape(r,{matrix:wc.setWith(this.__world).scaleWith(1/o).invertWith().translate(-a,-h),snapshot:!0,ignoreFill:!i,ignoreStroke:!s}),or.patternLocked=!1,r.resetTransform(),e.__isHitPixel=!0}else e.__isHitPixel&&(e.__isHitPixel=!1);this.__drawHitPath(r),r.setStrokeOptions(e)},xc.__hit=function(t,e){if(this.__box&&this.__box.__hit(t))return!0;const i=this.__;if(i.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:s}=i,n=(i.fill||i.__isCanvas)&&("path"===s||"pixel"===s&&!(i.__isAlphaPixelFill||i.__isCanvas))||"all"===s||e;if(n&&this.__hitFill(t))return!0;const{hitStroke:r,strokeScaleFixed:o}=i,a=i.__maxStrokeWidth*(o?this.getRenderScaleData(!0,o,!1).scaleX:1),h=i.stroke&&("path"===r||"pixel"===r&&!i.__isAlphaPixelStroke)||"all"===r;if(!n&&!h)return!1;const l=2*t.radiusX;let d=l,{strokeAlign:c}=i;if(i.motionText&&(d+=i.fontSize/2,c="center"),h)switch(c){case"inside":if(d+=2*a,!n&&this.__hitFill(t)&&this.__hitStroke(t,d))return!0;d=l;break;case"center":d+=a;break;case"outside":if(d+=2*a,!n){if(!this.__hitFill(t)&&this.__hitStroke(t,d))return!0;d=l}}return!!d&&this.__hitStroke(t,d)};const bc=t.UI.prototype,Ec=t.Rect.prototype,Pc=t.Box.prototype;Ec.__updateHitCanvas=Pc.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?bc.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},Ec.__hitFill=Pc.__hitFill=function(t){return this.__hitCanvas?bc.__hitFill.call(this,t):Ht.hitRadiusPoint(this.__layout.boxBounds,t)},t.Text.prototype.__drawHitPath=function(t){const e=this.__,{__lineHeight:i,fontSize:s,__baseLine:n,__letterSpacing:r,__textDrawData:o}=e;t.beginPath(),e.motionText?this.__drawPathByData(t,e.__pathForMotionText):r<0?this.__drawPathByBox(t):o.rows.forEach(e=>t.rect(e.x,e.y-n,e.width,i<s?s:i))},t.Group.prototype.pick=function(t,e){return e||(e=r),this.updateLayout(),ee.getSelector(this).getByPoint(t,e.hitRadius||0,Object.assign(Object.assign({},e),{target:this}))};const Sc=Ae.prototype;Sc.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},Sc.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},Sc.hitPixel=function(t,e,i=1){let{x:s,y:n,radiusX:r,radiusY:o}=t;e&&(s-=e.x,n-=e.y),Kt.set(s-r,n-o,2*r,2*o).scale(i).ceil();const{data:a}=this.context.getImageData(Kt.x,Kt.y,Kt.width||1,Kt.height||1);for(let t=0,e=a.length;t<e;t+=4)if(a[t+3]>0)return!0;return a[3]>0};const kc={convert(t,e){const i=qd.getBase(t),{x:s,y:n}=e,r=Object.assign(Object.assign({},i),{x:s,y:n,width:t.width,height:t.height,pointerType:t.pointerType,pressure:t.pressure});return"pen"===r.pointerType&&(r.tangentialPressure=t.tangentialPressure,r.tiltX=t.tiltX,r.tiltY=t.tiltY,r.twist=t.twist),r},convertMouse(t,e){const i=qd.getBase(t),{x:s,y:n}=e;return Object.assign(Object.assign({},i),{x:s,y:n,width:1,height:1,pointerType:"mouse",pressure:.5})},convertTouch(t,e){const i=kc.getTouch(t),s=qd.getBase(t),{x:n,y:r}=e;return Object.assign(Object.assign({},s),{x:n,y:r,width:1,height:1,pointerType:"touch",multiTouch:t.touches.length>1,pressure:i.force})},getTouch:t=>t.targetTouches[0]||t.changedTouches[0]},Tc={convert(t){const e=qd.getBase(t);return Object.assign(Object.assign({},e),{code:t.code,key:t.key})}},{pathCanDrag:Bc}=qd;class Cc extends dc{get windowTarget(){const{view:t}=this;return t&&t.ownerDocument||window}get notPointer(){const{p:t}=this;return"pointer"!==t.type||t.touch||this.useMultiTouch}get notTouch(){const{p:t}=this;return"mouse"===t.type||this.usePointer}get notMouse(){return this.usePointer||this.useTouch}__listenEvents(){super.__listenEvents();const t=this.view=this.canvas.view;this.viewEvents={pointerdown:this.onPointerDown,mousedown:this.onMouseDown,touchstart:this.onTouchStart,pointerleave:this.onPointerLeave,contextmenu:this.onContextMenu,wheel:this.onWheel,gesturestart:this.onGesturestart,gesturechange:this.onGesturechange,gestureend:this.onGestureend},this.windowEvents={pointermove:this.onPointerMove,pointerup:this.onPointerUp,pointercancel:this.onPointerCancel,mousemove:this.onMouseMove,mouseup:this.onMouseUp,touchmove:this.onTouchMove,touchend:this.onTouchEnd,touchcancel:this.onTouchCancel,keydown:this.onKeyDown,keyup:this.onKeyUp,scroll:this.onScroll};const{viewEvents:e,windowEvents:i}=this;for(let i in e)e[i]=e[i].bind(this),t.addEventListener(i,e[i]);for(let t in i)i[t]=i[t].bind(this),this.windowTarget.addEventListener(t,i[t])}__removeListenEvents(){super.__removeListenEvents();const{viewEvents:t,windowEvents:e}=this;for(let e in t)this.view.removeEventListener(e,t[e]),this.viewEvents={};for(let t in e)this.windowTarget.removeEventListener(t,e[t]),this.windowEvents={}}getTouches(t){const e=[];for(let i=0,s=t.length;i<s;i++)e.push(t[i]);return e}preventDefaultPointer(t){const{pointer:e}=this.config;e.preventDefault&&t.preventDefault()}preventDefaultWheel(t){const{wheel:e}=this.config;e.preventDefault&&t.preventDefault()}preventWindowPointer(t){return!this.downData&&t.target!==this.view&&(!this.config.shadowDOM||!t.composedPath||!t.composedPath().includes(this.view))}onKeyDown(t){this.keyDown(Tc.convert(t))}onKeyUp(t){this.keyUp(Tc.convert(t))}onContextMenu(t){this.config.pointer.preventDefaultMenu&&t.preventDefault(),this.menu(kc.convert(t,this.getLocal(t)))}onScroll(){this.canvas.updateClientBounds()}onPointerDown(t){this.preventDefaultPointer(t),this.notPointer||(this.usePointer||(this.usePointer=!0),this.pointerDown(kc.convert(t,this.getLocal(t))))}onPointerMove(t,e){if(this.notPointer||this.preventWindowPointer(t))return;this.usePointer||(this.usePointer=!0);const i=kc.convert(t,this.getLocal(t,!0));e?this.pointerHover(i):this.pointerMove(i)}onPointerLeave(t){this.onPointerMove(t,!0)}onPointerUp(t){this.downData&&this.preventDefaultPointer(t),this.notPointer||this.preventWindowPointer(t)||this.pointerUp(kc.convert(t,this.getLocal(t)))}onPointerCancel(){this.useMultiTouch||this.pointerCancel()}onMouseDown(t){this.preventDefaultPointer(t),this.notMouse||this.pointerDown(kc.convertMouse(t,this.getLocal(t)))}onMouseMove(t){this.notMouse||this.preventWindowPointer(t)||this.pointerMove(kc.convertMouse(t,this.getLocal(t,!0)))}onMouseUp(t){this.downData&&this.preventDefaultPointer(t),this.notMouse||this.preventWindowPointer(t)||this.pointerUp(kc.convertMouse(t,this.getLocal(t)))}onMouseCancel(){this.notMouse||this.pointerCancel()}onTouchStart(t){const e=kc.getTouch(t),i=this.getLocal(e,!0),{preventDefault:s}=this.config.touch;(!0===s||"auto"===s&&Bc(this.findPath(i)))&&t.preventDefault(),this.multiTouchStart(t),this.notTouch||(this.touchTimer&&(window.clearTimeout(this.touchTimer),this.touchTimer=0),this.useTouch=!0,this.pointerDown(kc.convertTouch(t,i)))}onTouchMove(t){if(this.multiTouchMove(t),this.notTouch||this.preventWindowPointer(t))return;const e=kc.getTouch(t);this.pointerMove(kc.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){if(this.multiTouchEnd(),this.notTouch||this.preventWindowPointer(t))return;this.touchTimer&&clearTimeout(this.touchTimer),this.touchTimer=setTimeout(()=>{this.useTouch=!1},500);const e=kc.getTouch(t);this.pointerUp(kc.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.notTouch||this.pointerCancel()}multiTouchStart(t){this.useMultiTouch=t.touches.length>1,this.touches=this.useMultiTouch?this.getTouches(t.touches):void 0,this.useMultiTouch&&this.pointerCancel()}multiTouchMove(t){if(this.useMultiTouch&&t.touches.length>1){const e=this.getTouches(t.touches),i=this.getKeepTouchList(this.touches,e);i.length>1&&(this.multiTouch(qd.getBase(t),i),this.touches=e)}}multiTouchEnd(){this.touches=null,this.useMultiTouch=!1,this.transformEnd()}getKeepTouchList(t,e){let i;const s=[];return t.forEach(t=>{i=e.find(e=>e.identifier===t.identifier),i&&s.push({from:this.getLocal(t),to:this.getLocal(i)})}),s}getLocalTouchs(t){return t.map(t=>this.getLocal(t))}onWheel(t){this.preventDefaultWheel(t),this.wheel(Object.assign(Object.assign(Object.assign({},qd.getBase(t)),this.getLocal(t)),{deltaX:t.deltaX,deltaY:t.deltaY}))}onGesturestart(t){this.useMultiTouch||(this.preventDefaultWheel(t),this.lastGestureScale=1,this.lastGestureRotation=0)}onGesturechange(t){if(this.useMultiTouch)return;this.preventDefaultWheel(t);const e=qd.getBase(t);Object.assign(e,this.getLocal(t));const i=t.scale/this.lastGestureScale,s=(t.rotation-this.lastGestureRotation)/Math.PI*180*(M.within(this.config.wheel.rotateSpeed,0,1)/4+.1);this.zoom(Object.assign(Object.assign({},e),{scale:i*i})),this.rotate(Object.assign(Object.assign({},e),{rotation:s})),this.lastGestureScale=t.scale,this.lastGestureRotation=t.rotation}onGestureend(t){this.useMultiTouch||(this.preventDefaultWheel(t),this.transformEnd())}setCursor(t){super.setCursor(t);const e=[];this.eachCursor(t,e),p(e[e.length-1])&&e.push("default"),this.canvas.view.style.cursor=e.map(t=>p(t)?`url(${t.url}) ${t.x||0} ${t.y||0}`:t).join(",")}eachCursor(t,e,i=0){if(i++,u(t))t.forEach(t=>this.eachCursor(t,e,i));else{const s=h(t)&&cc.get(t);s&&i<2?this.eachCursor(s,e,i):e.push(t)}}destroy(){this.view&&(super.destroy(),this.view=this.touches=null)}}function Rc(t,e,i){t.__.__font?il.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Lc(t,e,i,s,n){const r=i.__;p(t)?il.drawStrokesStyle(t,e,!1,i,s,n):(s.setStroke(t,r.__strokeWidth*e,r),s.stroke()),r.__useArrow&&il.strokeArrow(t,i,s,n)}function Dc(t,e,i,s,n){const r=i.__;p(t)?il.drawStrokesStyle(t,e,!0,i,s,n):(s.setStroke(t,r.__strokeWidth*e,r),il.drawTextStroke(i,s,n))}function Ac(t,e,i,s,n){const r=s.getSameCanvas(!0,!0);r.font=i.__.__font,Dc(t,2,i,r,n),r.blendMode="outside"===e?"destination-out":"destination-in",il.fillText(i,r,n),r.blendMode="normal",po.copyCanvasByWorld(i,s,r),r.recycle(i.__nowWorld)}const{getSpread:Oc,copyAndSpread:Ic,toOuterOf:Mc,getOuterOf:Fc,getByMove:Wc,move:Uc,getIntersectData:Nc}=Ht,zc={};let Yc;const{stintSet:Xc}=g,{hasTransparent:Hc}=Jh;function jc(t,e,i){if(!p(e)||!1===e.visible||0===e.opacity)return;let s;const{boxBounds:n}=i.__layout,{type:r}=e;switch(r){case"image":case"film":case"video":if(!e.url)return;s=sl.image(i,t,e,n,!Yc||!Yc[e.url]),"image"!==r&&sl[r](s);break;case"linear":s=nl.linearGradient(e,n);break;case"radial":s=nl.radialGradient(e,n);break;case"angular":s=nl.conicGradient(e,n);break;case"solid":const{color:a,opacity:h}=e;s={type:r,style:Jh.string(a,h)};break;default:o(e.r)||(s={type:"solid",style:Jh.string(e)})}if(s&&(s.originPaint=e,h(s.style)&&Hc(s.style)&&(s.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;s.strokeStyle=e.style}return s}const Vc={compute:function(t,e){const i=e.__,s=[];let n,r,o,a=i.__input[t];u(a)||(a=[a]),Yc=sl.recycleImage(t,i);for(let i,n=0,r=a.length;n<r;n++)(i=jc(t,a[n],e))&&(s.push(i),i.strokeStyle&&(o||(o=1),i.strokeStyle.strokeWidth&&(o=Math.max(o,i.strokeStyle.strokeWidth))));s.length?(i["_"+t]=s,s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(n=!0),r=!0),"fill"===t?(Xc(i,"__isAlphaPixelFill",n),Xc(i,"__isTransparentFill",r)):(Xc(i,"__isAlphaPixelStroke",n),Xc(i,"__isTransparentStroke",r),Xc(i,"__hasMultiStrokeStyle",o))):(i.__removePaint(t,!1),i["_"+t]="")},fill:function(t,e,i,s){i.fillStyle=t,Rc(e,i,s)},fills:function(t,e,i,s){let n,r,o;for(let a=0,h=t.length;a<h;a++){if(n=t[a],r=n.originPaint,n.image){if(o?o++:o=1,sl.checkImage(n,!e.__.__font,e,i,s))continue;if(!n.style){1===o&&n.image.isPlacehold&&e.drawImagePlaceholder(n,i,s);continue}}if(i.fillStyle=n.style,n.transform||r.scaleFixed){if(i.save(),n.transform&&i.transform(n.transform),r.scaleFixed){const{scaleX:t,scaleY:s}=e.getRenderScaleData(!0,r.scaleFixed,!1);1!==t&&i.scale(t,s)}r.blendMode&&(i.blendMode=r.blendMode),Rc(e,i,s),i.restore()}else r.blendMode?(i.saveBlendMode(r.blendMode),Rc(e,i,s),i.restoreBlendMode()):Rc(e,i,s)}},fillPathOrText:Rc,fillText:function(t,e,i){if(t.motionText)return il.fillMotionText(t,e,i);const s=t.__,{rows:n,decorationY:r}=s.__textDrawData;let o;s.__isPlacehold&&s.placeholderColor&&(e.fillStyle=s.placeholderColor);for(let t=0,i=n.length;t<i;t++)o=n[t],o.text?e.fillText(o.text,o.x,o.y):o.data&&o.data.forEach(t=>{e.fillText(t.char,t.x,o.y)});if(r){const{decorationColor:t,decorationHeight:i}=s.__textDrawData;t&&(e.fillStyle=t),n.forEach(t=>r.forEach(s=>e.fillRect(t.x,t.y+s,t.width,i)))}},stroke:function(t,e,i,s){const n=e.__;if(n.__strokeWidth)if(n.__font)il.strokeText(t,e,i,s);else if(n.__pathForStroke)il.fillStroke(t,e,i,s);else switch(n.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 n=e.__;if(n.__fillAfterStroke)Lc(t,2,e,i,s);else{const{renderBounds:r}=e.__layout,o=i.getSameCanvas(!0,!0);e.__drawRenderPath(o),Lc(t,2,e,o,s),o.clipUI(n),o.clearWorld(r),po.copyCanvasByWorld(e,i,o),o.recycle(e.__nowWorld)}}(t,e,i,s)}},strokes:function(t,e,i,s){il.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":Ac(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?Dc(t,2,e,i,s):Ac(t,"outside",e,i,s)}},drawTextStroke:function(t,e,i){let s,n=t.__.__textDrawData;const{rows:r,decorationY:o}=n;for(let t=0,i=r.length;t<i;t++)s=r[t],s.text?e.strokeText(s.text,s.x,s.y):s.data&&s.data.forEach(t=>{e.strokeText(t.char,t.x,s.y)});if(o){const{decorationHeight:t}=n;r.forEach(i=>o.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}},drawStrokesStyle:function(t,e,i,s,n,r){let o;const a=s.__,{__hasMultiStrokeStyle:h}=a;h||n.setStroke(void 0,a.__strokeWidth*e,a);for(let l=0,d=t.length;l<d;l++)if(o=t[l],(!o.image||!sl.checkImage(o,!1,s,n,r))&&o.style){if(h){const{strokeStyle:t}=o;t?n.setStroke(o.style,a.__getRealStrokeWidth(t)*e,a,t):n.setStroke(o.style,a.__strokeWidth*e,a)}else n.strokeStyle=o.style;o.originPaint.blendMode?(n.saveBlendMode(o.originPaint.blendMode),i?il.drawTextStroke(s,n,r):n.stroke(),n.restoreBlendMode()):i?il.drawTextStroke(s,n,r):n.stroke()}},shape:function(t,e,i){const s=e.getSameCanvas(),n=e.bounds,r=t.__nowWorld,o=t.__layout,a=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let h,l,d,c,u,p;Mc(o.strokeSpread?(Ic(zc,o.boxBounds,o.strokeSpread),zc):o.boxBounds,r,a);let{scaleX:_,scaleY:g}=t.getRenderScaleData(!0);if(n.includes(a))p=s,h=u=a,l=r;else{let s;if(ee.fullImageShadow)s=a;else{const t=o.renderShapeSpread?Oc(n,S.swapAndScale(o.renderShapeSpread,_,g)):n;s=Nc(t,a)}c=n.getFitMatrix(s);let{a:f,d:y}=c;c.a<1&&(p=e.getSameCanvas(),t.__renderShape(p,i),_*=f,g*=y),u=Fc(a,c),h=Wc(u,-c.e,-c.f),l=Fc(r,c),Uc(l,-c.e,-c.f);const m=i.matrix;m?(d=new yt(c),d.multiply(m),f*=m.scaleX,y*=m.scaleY):d=c,d.withScale(f,y),i=Object.assign(Object.assign({},i),{matrix:d})}return t.__renderShape(s,i),{canvas:s,matrix:d,fitMatrix:c,bounds:h,renderBounds:l,worldCanvas:p,shapeBounds:u,scaleX:_,scaleY:g}}};let Gc,qc=new qt;const{isSame:Kc}=Ht;function Zc(t,e,i,s,n,r){let o=!0;const a=t.__;if("fill"!==e||a.__naturalWidth||(a.__naturalWidth=s.width/a.pixelRatio,a.__naturalHeight=s.height/a.pixelRatio,a.__autoSide&&(t.forceUpdate(),po.updateBounds(t),t.__layout.boundsChanged=!0,t.__proxyData&&(t.setProxyAttr("width",a.width),t.setProxyAttr("height",a.height)),o=!1)),"brush"===i.mode&&sl.brush(t,e,n),!n.data){sl.createData(n,s,i,r);const{transform:t}=n.data,{opacity:e}=i,o=(t&&!t.onlyScale||a.path||a.cornerRadius)&&!n.brush;(o||e&&e<1||i.blendMode)&&(n.complex=!o||2)}return i.filter&&sl.applyFilter(n,s,i.filter,t),o}function Qc(t,e){tu(t,Go.LOAD,e)}function $c(t,e){tu(t,Go.LOADED,e)}function Jc(t,e,i){e.error=i,t.forceUpdate("surface"),tu(t,Go.ERROR,e)}function tu(t,e,i){t.hasEvent(e)&&t.emitEvent(new Go(e,i))}function eu(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:iu,translate:su}=Q,nu=new qt,ru={},ou={};function au(t,e,i,s){const n=h(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&n<0?0:n}let hu={},lu={a:1,b:0,c:0,d:1,e:0,f:0};const{get:du,set:cu,rotateOfOuter:uu,translate:pu,scaleOfOuter:_u,multiplyParent:gu,scale:fu,rotate:yu,skew:mu}=Q;function vu(t,e,i,s,n,r,o,a){o&&yu(t,o),a&&mu(t,a.x,a.y),n&&fu(t,n,r),pu(t,e.x+i,e.y+s)}const{get:wu,scale:xu,copy:bu}=Q,{getFloorScale:Eu}=M,{abs:Pu}=Math;const Su={image:function(t,e,i,s,n){let r,o;const a=or.get(i,i.type);return Gc&&i===Gc.paint&&Kc(s,Gc.boxBounds)?r=Gc.leafPaint:(r={type:i.type,image:a},a.hasAlphaPixel&&(r.isTransparent=!0),Gc=a.use>1?{leafPaint:r,paint:i,boxBounds:qc.set(s)}:null),(n||a.loading)&&(o={image:a,attrName:e,attrValue:i}),a.ready?(Zc(t,e,i,a,r,s),n&&(Qc(t,o),$c(t,o))):a.error?n&&Jc(t,o,a.error):(n&&(eu(t,!0),Qc(t,o)),r.loadId=a.load(()=>{eu(t,!1),t.destroyed||(Zc(t,e,i,a,r,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),$c(t,o)),r.loadId=void 0},e=>{eu(t,!1),Jc(t,o,e),r.loadId=void 0},i.lod&&a.getThumbSize(i.lod)),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),r},checkImage:function(t,e,i,s,n){const{scaleX:r,scaleY:o}=sl.getImageRenderScaleData(t,i,s,n),a=t.film?t.nowIndex:r+"-"+o,{image:h,brush:l,data:d,originPaint:c}=t,{exporting:u,snapshot:p}=n;if(!d||t.patternId===a&&!u||p){if(!l||!t.style)return!1}else if(e&&(d.repeat?e=!1:c.changeful||t.film||"miniapp"===ee.name||u||(e=ee.image.isLarge(h,r,o)||h.width*r>8096||h.height*o>8096)),e)i.__.__isFastShadow&&(s.fillStyle=t.style||"#000",s.fill());else if(!t.style||c.sync||u?sl.createPattern(t,i,s,n):sl.createPatternTask(t,i,s,n),!l||!t.style)return!1;return sl.drawImage(t,r,o,i,s,n),!0},drawImage:function(t,e,i,s,n,r){const{data:o,image:a,brush:h,complex:l}=t;let{width:d,height:c}=a,u=h||a;if(l){const{blendMode:r,opacity:a}=t.originPaint,{transform:h}=o;n.save(),2===l&&n.clipUI(s),r&&(n.blendMode=r),a&&(n.opacity*=a),h&&n.transform(h),u.render(n,0,0,d,c,s,t,e,i),n.restore()}else o.scaleX&&(d*=o.scaleX,c*=o.scaleY),u.render(n,0,0,d,c,s,t,e,i)},getImageRenderScaleData:function(t,e,i,s){const n=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:r}=t;if(t.brush&&sl.addBrushScale(n,t,e),i){const{pixelRatio:t}=i;n.scaleX*=t,n.scaleY*=t}return r&&r.scaleX&&(n.scaleX*=Math.abs(r.scaleX),n.scaleY*=Math.abs(r.scaleY)),n},recycleImage:function(t,e){const i=e["_"+t];if(u(i)){let s,n,r,o,a;const h=e.__leaf;for(let l=0,d=i.length;l<d;l++)s=i[l],n=s.image,a=n&&n.url,a&&(r||(r={}),r[a]=!0,or.recyclePaint(s),s.brush&&sl.recycleBrush(s,h),e.__willDestroy&&n.parent&&sl.recycleFilter(n,h),n.loading&&(o||(o=e.__input&&e.__input[t]||[],u(o)||(o=[o])),n.unload(i[l].loadId,!o.some(t=>t.url===a))));return r}return null},createPatternTask:function(t,e,i,s){t.patternTask||(t.patternTask=or.patternTasker.add(()=>n(this,void 0,void 0,function*(){sl.createPattern(t,e,i,s),e.forceUpdate("surface")}),0,()=>(t.patternTask=null,i.bounds.hit(e.__nowWorld))))},createPattern:function(t,e,i,s){let{scaleX:n,scaleY:r}=sl.getImageRenderScaleData(t,e,i,s),o=t.film?t.nowIndex:n+"-"+r;if(t.patternId!==o&&!e.destroyed&&(!ee.image.isLarge(t.image,n,r)||t.data.repeat)){const{image:a,brush:h,data:l}=t,{transform:d,gap:c}=l,u=sl.getPatternFixScale(t,n,r);let p,_,g,{width:f,height:y}=a,{opacity:m}=t.originPaint;(h||1===m)&&(m=void 0),u&&(n*=u,r*=u),f*=n,y*=r,c&&!h&&(_=c.x*n/Pu(l.scaleX||1),g=c.y*r/Pu(l.scaleY||1)),(d||1!==n||1!==r)&&(n*=Eu(f+(_||0)),r*=Eu(y+(g||0)),p=wu(),d&&bu(p,d),xu(p,1/n,1/r));const v=a.getCanvas(f,y,m,void 0,_,g,e.leafer&&e.leafer.config.smooth,l.interlace);h?(t.style=v,sl.cacheBrush(t,e,i,s)):t.style=a.getPattern(v,l.repeat||ee.origin.noRepeat||"no-repeat",p,t),t.patternId=o}},getPatternFixScale:function(t,e,i){const{image:s}=t;let n,r=ee.image.maxPatternSize,o=s.width*s.height;return s.isSVG?e>1&&(n=Math.ceil(e)/e):r>o&&(r=o),(o*=e*i)>r&&(n=Math.sqrt(r/o)),n},createData:function(t,e,i,s){t.data=sl.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=nu.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:s,height:n}=i,{mode:r,align:o,offset:a,scale:l,size:c,rotation:u,skew:_,clipSize:g,repeat:f,gap:y,interlace:m}=t,v=e.width===s&&e.height===n,w={mode:r},x="center"!==o&&(u||0)%180==90;let b,E;switch(Ht.set(ou,0,0,x?n:s,x?s:n),r&&"cover"!==r&&"fit"!==r?((l||c)&&(M.getScaleData(l,c,i,ru),b=ru.scaleX,E=ru.scaleY),(o||y||f)&&(b&&Ht.scale(ou,b,E,!0),o&&Tt.toPoint(o,ou,e,ou,!0,!0))):v&&!u||(b=E=Ht.getFitScale(e,ou,"fit"!==r),Ht.put(e,i,o,b,!1,ou),Ht.scale(ou,b,E,!0)),a&<.move(ou,a),r){case"stretch":v?b&&(b=E=void 0):(b=e.width/s,E=e.height/n,sl.stretchMode(w,e,b,E));break;case"normal":case"clip":if(ou.x||ou.y||b||g||u||_){let t,i;g&&(t=e.width/g.width,i=e.height/g.height),sl.clipMode(w,e,ou.x,ou.y,b,E,u,_,t,i),t&&(b=b?b*t:t,E=E?E*i:i)}break;case"repeat":(!v||b||u||_)&&sl.repeatMode(w,e,s,n,ou.x,ou.y,b,E,u,_,o,t.freeTransform);case"brush":f||(w.repeat="repeat");const i=p(f);(y||i)&&(w.gap=function(t,e,i,s,n){let r,o;p(t)?(r=t.x,o=t.y):r=o=t;return{x:au(r,i,n.width,e&&e.x),y:au(o,s,n.height,e&&e.y)}}(y,i&&f,ou.width,ou.height,e));break;default:b&&sl.fillOrFitMode(w,e,ou.x,ou.y,b,E,u)}return w.transform||"brush"===r||(e.x||e.y)&&su(w.transform=iu(),e.x,e.y),b&&(w.scaleX=b,w.scaleY=E),f&&(w.repeat=h(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),m&&(w.interlace=d(m)||"percent"===m.type?{type:"x",offset:m}:m),w},stretchMode:function(t,e,i,s){const n=du(),{x:r,y:o}=e;r||o?pu(n,r,o):i>0&&s>0&&(n.onlyScale=!0),fu(n,i,s),t.transform=n},fillOrFitMode:function(t,e,i,s,n,r,o){const a=du();pu(a,e.x+i,e.y+s),fu(a,n,r),o&&uu(a,{x:e.x+e.width/2,y:e.y+e.height/2},o),t.transform=a},clipMode:function(t,e,i,s,n,r,o,a,h,l){const d=du();vu(d,e,i,s,n,r,o,a),h&&(o||a?(cu(lu),_u(lu,e,h,l),gu(d,lu)):_u(d,e,h,l)),t.transform=d},repeatMode:function(t,e,i,s,n,r,o,a,h,l,d,c){const u=du();if(c)vu(u,e,n,r,o,a,h,l);else{if(h)if("center"===d)uu(u,{x:i/2,y:s/2},h);else switch(yu(u,h),h){case 90:pu(u,s,0);break;case 180:pu(u,i,s);break;case 270:pu(u,0,i)}hu.x=e.x+n,hu.y=e.y+r,pu(u,hu.x,hu.y),o&&_u(u,hu,o,a)}t.transform=u}},{toPoint:ku}=Pt,{hasTransparent:Tu}=Jh,Bu={},Cu={};function Ru(t,e,i,s){if(i){let n,r,o,a;for(let t=0,l=i.length;t<l;t++)n=i[t],h(n)?(o=t/(l-1),r=Jh.string(n,s)):(o=n.offset,r=Jh.string(n.color,s)),e.addColorStop(o,r),!a&&Tu(r)&&(a=!0);a&&(t.isTransparent=!0)}}const{getAngle:Lu,getDistance:Du}=lt,{get:Au,rotateOfOuter:Ou,scaleOfOuter:Iu}=Q,{toPoint:Mu}=Pt,Fu={},Wu={};function Uu(t,e,i,s,n){let r;const{width:o,height:a}=t;if(o!==a||s){const t=Lu(e,i);r=Au(),n?(Iu(r,e,o/a*(s||1),1),Ou(r,e,t+90)):(Iu(r,e,1,o/a*(s||1)),Ou(r,e,t))}return r}const{getDistance:Nu}=lt,{toPoint:zu}=Pt,Yu={},Xu={};const Hu={linearGradient:function(t,e){let{from:i,to:s,type:n,opacity:r}=t;ku(i||"top",e,Bu),ku(s||"bottom",e,Cu);const o=ee.canvas.createLinearGradient(Bu.x,Bu.y,Cu.x,Cu.y),a={type:n,style:o};return Ru(a,o,t.stops,r),a},radialGradient:function(t,e){let{from:i,to:s,type:n,opacity:r,stretch:o}=t;Mu(i||"center",e,Fu),Mu(s||"bottom",e,Wu);const a=ee.canvas.createRadialGradient(Fu.x,Fu.y,0,Fu.x,Fu.y,Du(Fu,Wu)),h={type:n,style:a};Ru(h,a,t.stops,r);const l=Uu(e,Fu,Wu,o,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:i,to:s,type:n,opacity:r,rotation:o,stretch:a}=t;zu(i||"center",e,Yu),zu(s||"bottom",e,Xu);const h=ee.conicGradientSupport?ee.canvas.createConicGradient(o?o*W:0,Yu.x,Yu.y):ee.canvas.createRadialGradient(Yu.x,Yu.y,0,Yu.x,Yu.y,Nu(Yu,Xu)),l={type:n,style:h};Ru(l,h,t.stops,r);const d=Uu(e,Yu,Xu,a||1,ee.conicGradientRotate90);return d&&(l.transform=d),l},getTransform:Uu},{copy:ju,move:Vu,toOffsetOutBounds:Gu}=Ht,{max:qu,abs:Ku}=Math,Zu={},Qu=new yt,$u={};function Ju(t,e){let i,s,n,r,o=0,a=0,h=0,l=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,r=1.5*(t.blur||0),n=Ku(t.spread||0),o=qu(o,n+r-s),a=qu(a,n+r+i),h=qu(h,n+r+s),l=qu(l,n+r-i)}),o===a&&a===h&&h===l?o:[o,a,h,l]}function tp(t,e,i){const{shapeBounds:s}=i;let n,r;ee.fullImageShadow?(ju(Zu,t.bounds),Vu(Zu,e.x-s.x,e.y-s.y),n=t.bounds,r=Zu):(n=s,r=e),t.copyWorld(i.canvas,n,r)}const{toOffsetOutBounds:ep}=Ht,ip={};const sp=Ju;const np={shadow:function(t,e,i){let s,n;const{__nowWorld:r}=t,{shadow:o}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,p=e.getSameCanvas(),_=o.length-1;Gu(h,$u,l),o.forEach((o,g)=>{let f=1;if(o.scaleFixed){const t=Math.abs(r.scaleX);t>1&&(f=1/t)}p.setWorldShadow($u.offsetX+(o.x||0)*c*f,$u.offsetY+(o.y||0)*u*f,(o.blur||0)*c*f,Jh.string(o.color)),n=rl.getShadowTransform(t,p,i,o,$u,f),n&&p.setTransform(n),tp(p,$u,i),n&&p.resetTransform(),s=l,o.box&&(p.restore(),p.save(),a&&(p.copyWorld(p,l,r,"copy"),s=r),a?p.copyWorld(a,r,r,"destination-out"):p.copyWorld(i.canvas,d,h,"destination-out")),po.copyCanvasByWorld(t,e,p,s,o.blendMode),_&&g<_&&p.clearWorld(s)}),p.recycle(s)},innerShadow:function(t,e,i){let s,n;const{__nowWorld:r}=t,{innerShadow:o}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,p=e.getSameCanvas(),_=o.length-1;ep(h,ip,l),o.forEach((o,g)=>{let f=1;if(o.scaleFixed){const t=Math.abs(r.scaleX);t>1&&(f=1/t)}p.save(),p.setWorldShadow(ip.offsetX+(o.x||0)*c*f,ip.offsetY+(o.y||0)*u*f,(o.blur||0)*c*f),n=rl.getShadowTransform(t,p,i,o,ip,f,!0),n&&p.setTransform(n),tp(p,ip,i),p.restore(),a?(p.copyWorld(p,l,r,"copy"),p.copyWorld(a,r,r,"source-out"),s=r):(p.copyWorld(i.canvas,d,h,"source-out"),s=l),p.fillWorld(s,Jh.string(o.color),"source-in"),po.copyCanvasByWorld(t,e,p,s,o.blendMode),_&&g<_&&p.clearWorld(s)}),p.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:Ju,getShadowTransform:function(t,e,i,s,n,r,o){if(s.spread){const i=2*s.spread*r*(o?-1:1),{width:a,height:h}=t.__layout.strokeBounds;return Qu.set().scaleOfOuter({x:(n.x+n.width/2)*e.pixelRatio,y:(n.y+n.height/2)*e.pixelRatio},1+i/a,1+i/h),Qu}},isTransformShadow(t){},getInnerShadowSpread:sp},{excludeRenderBounds:rp}=xo;let op;function ap(t,e,i,s,n,r,o,a){switch(e){case"grayscale":op||(op=!0,n.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,n,r){const o=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,o),r&&s.recycle(o);lp(t,e,i,1,n,r)}(t,i,s,n,o,a);break;case"opacity-path":lp(t,i,s,r,o,a);break;case"path":a&&i.restore()}}function hp(t){return t.getSameCanvas(!1,!0)}function lp(t,e,i,s,n,r){const o=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,o,void 0,n),r?i.recycle(o):i.clearWorld(o)}t.Group.prototype.__renderMask=function(t,e){let i,s,n,r,o,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(i=h[l],a=i.__.mask,a){o&&(ap(this,o,t,n,s,r,void 0,!0),s=n=null),"clipping"!==a&&"clipping-path"!==a||rp(i,e)||i.__render(t,e),r=i.__.opacity,op=!1,"path"===a||"clipping-path"===a?(r<1?(o="opacity-path",n||(n=hp(t))):(o="path",t.save()),i.__clip(n||t,e)):(o="grayscale"===a?"grayscale":"alpha",s||(s=hp(t)),n||(n=hp(t)),i.__render(s,e));continue}const d=1===r&&i.__.__blendMode;d&&ap(this,o,t,n,s,r,void 0,!1),rp(i,e)||i.__render(n||t,e),d&&ap(this,o,t,n,s,r,d,!1)}ap(this,o,t,n,s,r,void 0,!0)};const dp=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",cp=dp+"_#~&*+\\=|≮≯≈≠=…",up=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 pp(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const _p=pp("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),gp=pp("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),fp=pp(dp),yp=pp(cp),mp=pp("- —/~|┆·");var vp;!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"}(vp||(vp={}));const{Letter:wp,Single:xp,Before:bp,After:Ep,Symbol:Pp,Break:Sp}=vp;function kp(t){return _p[t]?wp:mp[t]?Sp:gp[t]?bp:fp[t]?Ep:yp[t]?Pp:up.test(t)?xp:wp}const Tp={trimRight(t){const{words:e}=t;let i,s=0,n=e.length;for(let r=n-1;r>-1&&(i=e[r].data[0]," "===i.char);r--)s++,t.width-=i.width;s&&e.splice(n-s,s)}};function Bp(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:Cp}=Tp,{Letter:Rp,Single:Lp,Before:Dp,After:Ap,Symbol:Op,Break:Ip}=vp;let Mp,Fp,Wp,Up,Np,zp,Yp,Xp,Hp,jp,Vp,Gp,qp,Kp,Zp,Qp,$p,Jp=[];function t_(t,e){Hp&&!Xp&&(Xp=Hp),Mp.data.push({char:t,width:e}),Wp+=e}function e_(){Up+=Wp,Mp.width=Wp,Fp.words.push(Mp),Mp={data:[]},Wp=0}function i_(){Kp&&(Zp.paraNumber++,Fp.paraStart=!0,Kp=!1),Hp&&(Fp.startCharSize=Xp,Fp.endCharSize=Hp,Xp=0),Fp.width=Up,Qp.width?Cp(Fp):$p&&s_(),Jp.push(Fp),Fp={words:[]},Up=0}function s_(){Up>(Zp.maxWidth||0)&&(Zp.maxWidth=Up)}const{top:n_,right:r_,bottom:o_,left:a_}=t.Direction4;function h_(t,e,i){const{bounds:s,rows:n}=t;s[e]+=i;for(let t=0;t<n.length;t++)n[t][e]+=i}const l_={getDrawData:function(t,e){h(t)||(t=String(t));let i=0,s=0,n=e.__getInput("width")||0,r=e.__getInput("height")||0;const{__padding:o}=e;e.motionText&&(n=r=0),o&&(n?(i=o[a_],n-=o[r_]+o[a_],!n&&(n=.01)):e.autoSizeAlign||(i=o[a_]),r?(s=o[n_],r-=o[n_]+o[o_],!r&&(r=.01)):e.autoSizeAlign||(s=o[n_]));const a={bounds:{x:i,y:s,width:n,height:r},rows:[],paraNumber:0,font:ee.canvas.font=e.__font};return function(t,e,i){Zp=t,Jp=t.rows,Qp=t.bounds,$p=!Qp.width&&!i.autoSizeAlign;const{__letterSpacing:s,paraIndent:n,textCase:r}=i,{canvas:o}=ee,{width:a}=Qp;if(i.__isCharMode){const t="none"!==i.textWrap,h="break"===i.textWrap;Kp=!0,Vp=null,Xp=Yp=Hp=Wp=Up=0,Mp={data:[]},Fp={words:[]};for(let i=0,l=(e=[...e]).length;i<l;i++)zp=e[i],"\n"===zp?(Wp&&e_(),Fp.paraEnd=!0,i_(),Kp=!0):(jp=kp(zp),jp===Rp&&"none"!==r&&(zp=Bp(zp,r,!Wp)),Yp=o.measureText(zp).width,s&&(s<0&&(Hp=Yp),Yp+=s),Gp=jp===Lp&&(Vp===Lp||Vp===Rp)||Vp===Lp&&jp!==Ap,qp=!(jp!==Dp&&jp!==Lp||Vp!==Op&&Vp!==Ap),Np=Kp&&n?a-n:a,t&&a&&Up+Wp+Yp>Np&&(h?(Wp&&e_(),Up&&i_()):(qp||(qp=jp===Rp&&Vp==Ap),Gp||qp||jp===Ip||jp===Dp||jp===Lp||Wp+Yp>Np?(Wp&&e_(),Up&&i_()):Up&&i_()))," "===zp&&!0!==Kp&&Up+Wp===0||(jp===Ip?(" "===zp&&Wp&&e_(),t_(zp,Yp),e_()):Gp||qp?(Wp&&e_(),t_(zp,Yp)):t_(zp,Yp)),Vp=jp);Wp&&e_(),Up&&i_(),Jp.length>0&&(Jp[Jp.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{Zp.paraNumber++,Up=o.measureText(t).width,Jp.push({x:n||0,text:t,width:Up,paraStart:!0}),$p&&s_()})}(a,t,e),o&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":h_(e,"x",t[a_]);break;case"right":h_(e,"x",-t[r_])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":h_(e,"y",t[n_]);break;case"bottom":h_(e,"y",-t[o_])}}(o,a,e,n,r),function(t,e){const{rows:i,bounds:s}=t,n=i.length,{__lineHeight:r,__baseLine:o,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:p,y:_,width:g,height:f}=s,y=r*n+(c?c*(t.paraNumber-1):0),m=o;if(h&&y>f)y=Math.max(e.__autoHeight?y:f,r),n>1&&(t.overflow=n);else if(f||u)switch(d){case"middle":_+=(f-y)/2;break;case"bottom":_+=f-y}m+=_;let v,w,x,b=g||u?g:t.maxWidth;for(let o=0,d=n;o<d;o++){if(v=i[o],v.x=p,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&&o>0&&(m+=c),v.y=m,m+=r,t.overflow>o&&m>y&&(v.isOverflow=!0,t.overflow=o+1),w=v.x,x=v.width,a<0&&(v.width<0?(x=-v.width+e.fontSize+a,w-=x,x+=e.fontSize):x-=a),w<s.x&&(s.x=w),x>s.width&&(s.width=x),h&&g&&g<x&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=_,s.height=y}(a,e),e.__isCharMode&&function(t,e,i){const{rows:s}=t,{textAlign:n,paraIndent:r}=e,o=e.__letterSpacing||e.motionText,a=i&&n.includes("both"),h=a||i&&n.includes("justify"),l=h&&n.includes("letter");let d,c,u,p,_,g,f,y,m,v;s.forEach(t=>{t.words&&(_=r&&t.paraStart?r:0,y=t.words.length,h&&(v=!t.paraEnd||a,c=i-t.width-_,l?p=c/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=y>1?c/(y-1):0),g=o||t.isOverflow||l?0:u?1:2,t.isOverflow&&!o&&(t.textMode=!0),2===g?(t.x+=_,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=_,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,n){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width,n&&(e+=n)}),e}(e.data,d,t.data,t.isOverflow,v&&p),v&&(m=i===y-1,u?m||(d+=u,t.width+=u):p&&(t.width+=p*(e.data.length-(m?1:0))))})),t.words=null)})}(a,e,n),a.overflow&&function(t,e,i,s){const{rows:n,overflow:r}=t;let{textOverflow:o}=e;if(r&&n.splice(r),s&&o&&"show"!==o){let t,a;"hide"===o?o="":"ellipsis"===o&&(o="...");const h=o?ee.canvas.measureText(o).width:0,l=i+s-h;("none"===e.textWrap?n:[n[r-1]]).forEach(e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],a=t.x+t.width,!(s===i&&a<l));s--){if(a<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:o,x:a}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(a,e,i,n),"none"!==e.textDecoration&&function(t,e){let i,s=0;const{fontSize:n,textDecoration:r}=e;switch(t.decorationHeight=n/11,p(r)?(i=r.type,r.color&&(t.decorationColor=Jh.string(r.color)),r.offset&&(s=Math.min(.3*n,Math.max(r.offset,.15*-n)))):i=r,i){case"under":t.decorationY=[.15*n+s];break;case"delete":t.decorationY=[.35*-n];break;case"under-delete":t.decorationY=[.15*n+s,.35*-n]}}(a,e),a}};const d_={string:function(t,e){if(!t)return"#000";const i=d(e)&&e<1;if(h(t)){if(!i||!Jh.object)return t;t=Jh.object(t)}let s=o(t.a)?1:t.a;i&&(s*=e);const n=t.r+","+t.g+","+t.b;return 1===s?"rgb("+n+")":"rgba("+n+","+s+")"}};Object.assign($h,l_),Object.assign(Jh,d_),Object.assign(il,Vc),Object.assign(sl,Su),Object.assign(nl,Hu),Object.assign(rl,np),Object.assign(ue,{interaction:(t,e,i,s)=>new Cc(t,e,i,s),hitCanvas:(t,e)=>new Th(t,e),hitCanvasManager:()=>new uc}),Bh();class c_ extends fl{get __drawAfterFill(){return!0}setRobot(t){this._robot=t,this.__leaf.__updateRobot()}setAction(t){this._action=t,this.__leaf.__updateAction()}}function u_(t,e){return _r(t,t=>({set(i){this.__setAttr(t,i),this.leaferIsReady?e?hl.setStyleName(this,e,i):hl.set(this,i):this.__layout.stateStyleChanged=!0}}))}function p_(t){return _r(t,t=>({set(e){this.__setAttr(t,e),this.__layout.stateStyleChanged=!0}}))}function __(t,e){if(e&&!0!==e)return e;if(!t.button){let{parent:e}=t;for(let t=0;t<2;t++)if(e){if(e.button)return e;e=e.parent}}return null}function g_(t,e){p(e)||(e=void 0),m_(t,e,"in")}function f_(t,e){const{normalStyle:i}=t;p(e)||(e=void 0),i&&(e||(e=i),m_(t,e,"out"))}t.Robot=class extends t.UI{get __tag(){return"Robot"}get nowFrame(){return this.robotFrames&&this.robotFrames[this.now]}constructor(t){super(t)}togglePlay(){this.running?this.pause():this.play()}play(){this.running=!0}pause(){this.running=!1}stop(){this.pause()}__updateRobot(){const{robot:t}=this;if(this.robotFrames=[],!t)return;let e=0;u(t)?t.forEach(t=>this.__loadRobot(t,e,e+=t.total||1)):this.__loadRobot(t,0,t.total)}__updateAction(){const t=this.actions[this.action];if(this.stop(),this.__timer&&clearTimeout(this.__timer),!o(t))if(d(t))this.now=t;else if(p(t)){const e=u(t),i=e?t:t.keyframes;this.__action=e?void 0:t;const{length:s}=i;if(s>1){const t=this.now=i[0],e=i[i.length-1];this.play(),this.__runAction(t,e)}else s&&(this.now=i[0])}}__loadRobot(t,e,i){for(let t=e;t<i;t++)this.robotFrames.push(void 0);const s=or.get(t);s.ready?this.__createFrames(s,t,e,i):s.load(()=>this.__createFrames(s,t,e,i))}__createFrames(t,e,i,s){const{offset:n,size:r,total:o}=e,{width:a,height:h}=r&&(d(r)?{width:r,height:r}:r)||(o>1?this:t);let l=n?n.x:0,c=n?n.y:0;for(let e=i;e<s;e++)this.robotFrames[e]={view:t.view,x:l,y:c,width:a,height:h},l+a>=t.width?(l=0,c+=h):l+=a;this.__updateRobotBounds(),this.forceRender(),this.emitEvent(new Go(Go.LOADED,{image:t}))}__runAction(t,e){let{FPS:i,loop:s,__action:n}=this;n&&(n.FPS&&(i=n.FPS),o(n.loop)||(s=n.loop)),this.__timer=setTimeout(()=>{if(this.running){if(this.now===e){if(!s)return this.stop();this.now=t}else this.now++;this.__updateRobotBounds()}this.__runAction(t,e)},1e3/i)}__updateRobotBounds(){const{nowFrame:t}=this;if(t){const e=this.__,i=t.width/e.pixelRatio,s=t.height/e.pixelRatio;e.width===i&&e.height===s||this.forceUpdate(),e.__naturalWidth=i,e.__naturalHeight=s}}__drawContent(t,e){const{nowFrame:i}=this,{width:s,height:n}=this.__;i&&t.drawImage(i.view,i.x,i.y,i.width,i.height,0,0,s,n)}destroy(){this.robotFrames&&(this.robotFrames=null),super.destroy()}},s([Hr(c_)],t.Robot.prototype,"__",void 0),s([Er()],t.Robot.prototype,"robot",void 0),s([yr()],t.Robot.prototype,"actions",void 0),s([yr("")],t.Robot.prototype,"action",void 0),s([Dr(0)],t.Robot.prototype,"now",void 0),s([yr(12)],t.Robot.prototype,"FPS",void 0),s([yr(!0)],t.Robot.prototype,"loop",void 0),t.Robot=s([Jr()],t.Robot),ce.add("robot");const y_={};function m_(t,e,i){const{normalStyle:s}=t;e||(e=y_),e.scale&&(M.assignScale(e,e.scale),delete e.scale),e!==y_&&hl.canAnimate||(i=null);let n=!!i&&function(t,e,i){let s="in"===t?"transition":"transitionOut";"out"===t&&a(i[s])&&a(e[s])&&(s="transition");return a(e[s])?i[s]:e[s]}(i,e,t);const r=n?function(t,e){const i=x_(e,t),s=t.animate();s&&x_(i,t,s.fromStyle);return i}(t,e):void 0;hl.canAnimate&&v_(t)&&t.killAnimate("transition"),s&&t.set(s,"temp");const o=v_(t);if(o){const{animation:s}=o;if(s){const r=t.animate(s,void 0,"animation",!0);Object.assign(o,r.endingStyle),"in"!==i||e.animation!==s?r.kill():n=!1,delete o.animation}t.normalStyle=w_(o,t),t.set(o,"temp")}else t.normalStyle=void 0;if(n){const e=w_(r,t);t.set(r,"temp"),t.animate([r,e],n,"transition",!0)}t.__layout.stateStyleChanged=!1}function v_(t){let e;const i={},s=__(t),n=s?t.state||s.state:t.state,r=n&&t.states[n];r&&hl.isState(n,t,s)&&(e=b_(i,r));const o=i.selectedStyle||t.selectedStyle;o&&hl.isSelected(t,s)&&(e=b_(i,o));const a=i.placeholderStyle||t.placeholderStyle;if(a&&hl.isPlacehold(t,s)&&(e=b_(i,a)),hl.isDisabled(t,s)){const s=i.disabledStyle||t.disabledStyle;s&&(e=b_(i,s))}else{const n=i.focusStyle||t.focusStyle;n&&hl.isFocus(t,s)&&(e=b_(i,n));const r=i.hoverStyle||t.hoverStyle;r&&hl.isHover(t,s)&&(e=b_(i,r));const o=i.pressStyle||t.pressStyle;o&&hl.isPress(t,s)&&(e=b_(i,o))}return e?i:void 0}function w_(t,e,i,s){const n=i?t:{},r=i||t;for(let t in r)s&&hl.animateExcludes[t]||(n[t]=e[t]);return n}function x_(t,e,i){return w_(t,e,i,!0)}function b_(t,e){return Object.assign(t,e),!0}function E_(t,e){const i=t[e];i&&g_(t,i),t.button&&S_(t.children,e)}function P_(t,e,i){i||(i=t.states[e]),g_(t,i),t.button&&S_(t.children,null,e)}function S_(t,e,i){if(!t)return;let s,n;for(let r=0,a=t.length;r<a;r++){if(s=t[r],e){switch(n=!0,e){case"hoverStyle":hl.isHover(s)&&(n=!1);break;case"pressStyle":hl.isPress(s)&&(n=!1);break;case"focusStyle":hl.isFocus(s)&&(n=!1)}n&&E_(s,e)}else o(i)||P_(s,i);s.isBranch&&S_(s.children,e,i)}}function k_(t,e){const i=t[e];i&&f_(t,i),t.button&&B_(t.children,e)}function T_(t,e,i){f_(t,i),t.button&&B_(t.children,null,e)}function B_(t,e,i){if(!t)return;let s;for(let n=0,r=t.length;n<r;n++)s=t[n],e?k_(s,e):o(i)||T_(s,i),s.isBranch&&B_(s.children,e,i)}function C_(t,e,i){let s;const n=e.leafer?e.leafer.interaction:null;if(n&&(s=n[t](e),!s&&i)){const r=__(e,i);r&&(s=n[t](r))}return s}function R_(t,e,i){let s=e[t];if(!s&&i){const n=__(e,i);n&&(s=n[t])}return s}ce.add("state"),hl.animateExcludes={animation:1,animationOut:1,transition:1,transitionOut:1,states:1,state:1,placeholder:1,normalStyle:1,hoverStyle:1,pressStyle:1,focusStyle:1,selectedStyle:1,disabledStyle:1,placeholderStyle:1},hl.isState=function(t,e,i){return function(t,e,i){let s=e.states[t];if(!s&&i){const n=__(e,i);n&&(s=n.states[t])}return!!s}(t,e,i)},hl.isSelected=function(t,e){return R_("selected",t,e)},hl.isDisabled=function(t,e){return R_("disabled",t,e)},hl.isFocus=function(t,e){return C_("isFocus",t,e)},hl.isHover=function(t,e){return C_("isHover",t,e)},hl.isPress=function(t,e){return C_("isPress",t,e)},hl.isPlacehold=function(t,e){return t.__.__isPlacehold},hl.isDrag=function(t,e){return C_("isDrag",t,e)},hl.setStyleName=function(t,e,i){i?P_(t,e,t[e]):T_(t,e,t[e])},hl.set=function(t,e){const i=t.states[e];i?P_(t,e,i):T_(t,e,i)},hl.getStyle=v_,hl.updateStyle=m_,hl.updateEventStyle=function(e,i){switch(i){case t.PointerEvent.ENTER:E_(e,"hoverStyle");break;case t.PointerEvent.LEAVE:k_(e,"hoverStyle");break;case t.PointerEvent.DOWN:E_(e,"pressStyle");break;case t.PointerEvent.UP:k_(e,"pressStyle")}};const L_=t.UI.prototype;t.UI.addAttr("selected",!1,u_,"selectedStyle"),t.UI.addAttr("disabled",!1,u_,"disabledStyle"),t.UI.addAttr("states",{},p_),t.UI.addAttr("state","",u_),t.UI.addAttr("normalStyle",void 0,yr),t.UI.addAttr("hoverStyle",void 0,p_),t.UI.addAttr("pressStyle",void 0,p_),t.UI.addAttr("focusStyle",void 0,p_),t.UI.addAttr("selectedStyle",void 0,p_),t.UI.addAttr("disabledStyle",void 0,p_),t.UI.addAttr("placeholderStyle",void 0,p_),t.UI.addAttr("button",!1,yr),L_.set=function(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):Object.assign(this,t))},L_.focus=function(t=!0){this.waitLeafer(()=>{let{focusData:e}=this.app.interaction;t?(e&&e.focus(!1),e=this):e=null,this.app.interaction.focusData=e,t?E_(this,"focusStyle"):k_(this,"focusStyle")})},L_.updateState=function(){hl.updateStyle(this,void 0,"in")};const D_=t.Text.prototype,A_="text";cr(D_,A_,Object.assign(Object.assign({},ur(D_,A_)),{set(t){const e=this,i=e.text;e.__setAttr(A_,t)&&(Sr(e),e.placeholderStyle&&e.placeholder&&(""===i||""===t)&&(e.__layout.stateStyleChanged=!0))}}));const{cos:O_,sin:I_,pow:M_,sqrt:F_,abs:W_,ceil:U_,floor:N_,round:z_,PI:Y_}=Math,X_=5*Y_,H_=1.70158,j_=2.5949095,V_=7.5625,G_=2.75;function q_(t){return e=>M_(e,t)}function K_(t){return e=>1-M_(1-e,t)}function Z_(t){return e=>e<.5?.5*M_(2*e,t):1-.5*M_(2-2*e,t)}function Q_(t){return t<1/G_?V_*t*t:t<2/G_?V_*(t-=1.5/G_)*t+.75:t<2.5/G_?V_*(t-=2.25/G_)*t+.9375:V_*(t-=2.625/G_)*t+.984375}function $_(t,e,i,s){const n={};return r=>{const o=~~(1e4*r),a=n[o];if(a)return a;let h,l,d,c=r;for(let e=0;e<8&&(h=1-c,d=J_(c,t,i)-r,l=3*h*h*t+6*h*c*(i-t)+3*c*c*(1-i),!(W_(l)<1e-6));e++)c-=d/l;return n[o]=J_(c,e,s)}}function J_(t,e,i){const s=1-t;return 3*s*s*t*e+3*s*t*t*i+t*t*t}const tg={get(t){const{list:e}=tg;return h(t)?e[t||"ease"]:p(t)?e[t.name].apply(e,u(t.value)?t.value:[t.value]):e.ease},register(t,e){tg.list[t]=e},list:{linear:t=>t,ease:$_(.25,.1,.25,1),"ease-in":$_(.42,0,1,1),"ease-out":$_(0,0,.58,1),"ease-in-out":$_(.42,0,.58,1),"sine-in":t=>1-O_(t*Y_*.5),"sine-out":t=>I_(t*Y_*.5),"sine-in-out":t=>.5*(1-O_(t*Y_)),"quad-in":q_(2),"quad-out":K_(2),"quad-in-out":Z_(2),"cubic-in":q_(3),"cubic-out":K_(3),"cubic-in-out":Z_(3),"quart-in":q_(4),"quart-out":K_(4),"quart-in-out":Z_(4),"quint-in":q_(5),"quint-out":K_(5),"quint-in-out":Z_(5),"expo-in":t=>t?M_(2,10*t-10):0,"expo-out":t=>1===t?1:1-M_(2,10*-t),"expo-in-out":t=>0===t||1===t?t:t<.5?.5*M_(2,2*t*10-10):.5*(2-M_(2,10-2*t*10)),"circ-in":t=>1-F_(1-M_(t,2)),"circ-out":t=>F_(1-M_(t-1,2)),"circ-in-out":t=>t<.5?.5*(1-F_(1-M_(2*t,2))):.5*(F_(1-M_(2-2*t,2))+1),"back-in":t=>((H_+1)*t-H_)*t*t,"back-out":t=>(t-=1)*t*((H_+1)*t+H_)+1,"back-in-out":t=>t<.5?(t*=2)*t*((j_+1)*t-j_)*.5:.5*((t=2*t-2)*t*((j_+1)*t+j_)+2),"elastic-in":t=>0===t||1===t?t:-M_(2,10*(t-1))*I_((t-1.1)*X_),"elastic-out":t=>0===t||1===t?t:M_(2,-10*t)*I_((t-.1)*X_)+1,"elastic-in-out":t=>0===t||1===t?t:t<.5?-M_(2,10*((t*=2)-1))*I_((t-1.1)*X_)*.5:M_(2,10*(1-(t*=2)))*I_((t-1.1)*X_)*.5+1,"bounce-in":t=>1-Q_(1-t),"bounce-out":Q_,"bounce-in-out":t=>t<.5?.5*(1-Q_(1-2*t)):.5*(1+Q_(2*t-1)),"cubic-bezier":$_,steps:function(t,e="floor"){return i=>("floor"===e?N_(i*t):"ceil"===e?U_(i*t):z_(i*t))/t}}};function eg(t){return(e,i)=>{Object.defineProperty(e,i,{get(){const e=this.config&&this.config[i];return void 0===e?t:e},set(t){this.config||(this.config={}),this.config[i]=t}})}}class ig{}ig.CREATED="created",ig.PLAY="play",ig.PAUSE="pause",ig.STOP="stop",ig.SEEK="seek",ig.UPDATE="update",ig.COMPLETED="completed";t.Animate=class extends ca{get endingStyle(){return"from"===this.realEnding?this.fromStyle:this.toStyle}get started(){return!!this.requestAnimateTime}get completed(){return this.time>=this.duration&&!this.started}get frame(){return this.frames[this.nowIndex]}get frameTotalTime(){return this.frame.totalTime||this.frame.duration||0}get nowReverse(){return(this.mainReverse?1:0)+(this.frameReverse?1:0)==1}get realEnding(){let t;const{ending:e,reverse:i,swing:s,loop:n}=this;return"from"===e?t=0:"to"===e?t=1:(t=i?0:1,s&&n&&d(n)&&(t+=n-1)),t%2?"to":"from"}constructor(t,e,i,s){super(),this.nowIndex=0,this.playedTotalTime=0,e&&(e.keyframes?(i=e,e=e.keyframes):e.style&&(i=e,e=e.style)),this.init(t,e,i,s)}init(t,e,i,s){switch(this.target=t,(s||this.isTemp)&&(this.isTemp=s),typeof i){case"number":this.config={duration:i};break;case"string":this.config={easing:i};break;case"object":this.config=i,i.event&&(this.event=i.event)}this.keyframes=u(e)?e:e?[e]:[];const{easing:n,attrs:r}=this;this.easingFn=tg.get(n),(r||this.attrsMap)&&(this.attrsMap=r?r.reduce((t,e)=>(t[e]=!0,t),{}):void 0),this.frames=[],this.create(),this.autoplay&&this.frames.length&&(this.timer=setTimeout(()=>{this.timer=0,this.play()},0))}emitType(t){this.emit(t,this),this.parent&&this.parent.onChildEvent(t,this)}play(){this.destroyed||(this.running=!0,this.started?this.timer||this.startRequestAnimate():(this.clearTimer(),this.start()),this.emitType(ig.PLAY))}pause(){this.destroyed||(this.running=!1,this.clearTimer(),this.emitType(ig.PAUSE))}stop(){this.destroyed||(this.complete(),this.emitType(ig.STOP))}seek(t,e){if(this.destroyed)return;const{delay:i}=this;let s;p(t)&&(t=tl.number(t,this.duration+(e?i:0))),e&&(t-=i),t&&(t/=this.speed),t<0&&(s=-t,t=0),(!this.started||t<this.time||!t)&&this.start(!0),this.time=t,s||this.animate(0,!0),this.clearTimer(()=>{s?this.timer=setTimeout(()=>{this.timer=0,this.begin()},1e3*s):this.startRequestAnimate()}),this.emitType(ig.SEEK)}kill(t=!0,e){this.killStyle=e,this.destroy(t)}create(){const{target:t,frames:e,keyframes:i,config:s}=this,{length:n}=i,r=!(n>1)||this.join;let a,h,l,c,u,p=0,_=0;n>1&&(this.fromStyle={},this.toStyle={});for(let s=0;s<n;s++){if(h=i[s],c=h.style||h,a||(a=r?t:c),l={style:c,beforeStyle:{}},u=1,h.style){const{duration:t,autoDuration:e,delay:i,autoDelay:s,easing:n,swing:r,loop:o}=h;r&&(l.swing=d(r)?r:2,u=2*l.swing-1),o&&(l.loop=u=d(o)?o:2),t?(l.duration=t,p+=t*u,i&&(l.totalTime=t+i)):e&&(l.autoDuration=e,_+=e*u),i?(l.delay=i,p+=i*u):s&&(l.autoDelay=s,_+=s*u),n&&(l.easingFn=tg.get(n))}if(!l.autoDuration&&o(l.duration)&&(n>1?s>0||r?_+=u:l.duration=0:l.duration=this.duration),n>1)this.setBefore(l,c,a);else{for(let e in c)l.beforeStyle[e]=t[e];this.fromStyle=l.beforeStyle,this.toStyle=l.style}a=c,e.push(l)}_?((this.duration<=p||!s||!s.duration)&&this.changeDuration(p+.2*_),this.allocateTime((this.duration-p)/_)):p&&this.changeDuration(p),this.emitType(ig.CREATED)}changeDuration(t){const{config:e}=this;this.config=e?Object.assign(Object.assign({},e),{duration:t}):{duration:t}}setBefore(t,e,i){const{fromStyle:s,toStyle:n,target:r}=this;for(let a in e)o(s[a])&&(s[a]=n[a]=e===i?i[a]:r[a]),t.beforeStyle[a]=o(i[a])?n[a]:i[a],n[a]=e[a]}allocateTime(t){let e,{frames:i}=this,{length:s}=i;for(let n=0;n<s;n++)e=i[n],o(e.duration)&&(e.duration=e.autoDuration?t*e.autoDuration:t),e.totalTime||(e.autoDelay&&(e.delay=e.autoDelay*t),e.delay&&(e.totalTime=e.duration+e.delay))}startRequestAnimate(){this.requestAnimateTime=Date.now(),this.requestAnimatePageTime=0,this.waitRequestRender||this.requestAnimate()}requestAnimate(){this.waitRequestRender=!0,ee.requestRender(this.animate.bind(this))}animate(t,e){if(!e){if(this.waitRequestRender=!1,!this.running)return;let e;e=t&&this.requestAnimatePageTime?t-this.requestAnimatePageTime:Date.now()-this.requestAnimateTime,this.time+=e/1e3,this.requestAnimatePageTime=t,this.requestAnimateTime=Date.now()}const{duration:i}=this,s=this.time*this.speed;if(s<i){for(;s-this.playedTotalTime>this.frameTotalTime;)this.transition(1),this.mainReverse?this.reverseNextFrame():this.nextFrame();const t=this.nowReverse?0:this.frame.delay||0,e=s-this.playedTotalTime-t,i=this.frame.duration;if(e>i)this.transition(1);else if(e>=0){const t=i?e/i:1;this.transition(this.frame.easingFn?this.frame.easingFn(t):this.easingFn(t))}}else this.end();if(!e)if(s<i)this.requestAnimate();else{const{loop:t,loopDelay:e,swing:i}=this;if((!1!==t||i)&&(this.looped?this.looped++:this.looped=1,this.needLoop(this.looped,t,i)))return i&&(this.mainReverse=!this.mainReverse),void(e?this.timer=setTimeout(()=>{this.timer=0,this.begin()},e/this.speed*1e3):this.begin());this.complete()}}start(t){this.requestAnimateTime=1;const{reverse:e,jump:i}=this;if((e||this.mainReverse)&&(this.mainReverse=e),this.looped&&(this.looped=0),t)this.begin(!0);else{const{delay:t}=this;t?(i&&this.begin(!0),this.timer=setTimeout(()=>{this.timer=0,this.begin()},t/this.speed*1e3)):this.begin()}}begin(t){this.playedTotalTime=this.time=0,this.mainReverse?this.setTo():this.setFrom(),t||this.startRequestAnimate()}end(){this.mainReverse?this.setFrom():this.setTo()}complete(){this.requestAnimateTime=0,this.running=!1;const{endingStyle:t,killStyle:e}=this,i=e?{}:t;if(e)for(let s in t)s in e||(i[s]=t[s]);this.setStyle(i),this.clearTimer(),this.emitType(ig.COMPLETED)}setFrom(){this.nowIndex=0,this.setStyle(this.fromStyle)}setTo(){this.nowIndex=this.frames.length-1,this.setStyle(this.toStyle)}nextFrame(){if(this.needLoopFrame())return this.increaseTime();this.nowIndex+1>=this.frames.length||(this.increaseTime(),this.nowIndex++)}reverseNextFrame(){if(this.needLoopFrame())return this.increaseTime();this.nowIndex-1<0||(this.increaseTime(),this.nowIndex--)}transition(t){const{style:e,beforeStyle:i}=this.frame,s=this.nowReverse?e:i,n=this.nowReverse?i:e;if(0===t)this.setStyle(s);else if(1===t)this.setStyle(n);else{const{attrsMap:i,target:r}=this;let{betweenStyle:o}=this.frame;o||(o=this.frame.betweenStyle={}),ll.setBetweenStyle(o,s,n,e,t,r,i),this.setStyle(o)}this.emitType(ig.UPDATE)}setStyle(t){const{target:e}=this;e&&t&&(this.style=t,e.__?e.set(t,!!this.isTemp&&"temp"):Object.assign(e,t))}increaseTime(){this.playedTotalTime+=this.frameTotalTime}needLoop(t,e,i){return!(this.needStopLoop(t,e)||this.needStopLoop(t,i,!0))}needStopLoop(t,e,i){return d(e)&&(!e||t>=(i?2*e-1:e))}needLoopFrame(){const{loop:t,swing:e}=this.frame;if(t||e){if(this.frameLooped?this.frameLooped++:this.frameLooped=1,e&&(this.frameReverse=!this.frameReverse),this.needLoop(this.frameLooped,t,e))return!0;this.frameLooped=this.frameReverse=void 0}return!1}clearTimer(t){this.timer&&(clearTimeout(this.timer),this.timer=0,t&&t())}destroy(t){this.destroyed||(super.destroy(),t&&!this.completed?this.stop():this.pause(),this.target=this.parent=this.config=this.frames=this.fromStyle=this.toStyle=this.style=this.killStyle=null,this.destroyed=!0)}},s([eg("ease")],t.Animate.prototype,"easing",void 0),s([eg(0)],t.Animate.prototype,"delay",void 0),s([eg(.2)],t.Animate.prototype,"duration",void 0),s([eg("auto")],t.Animate.prototype,"ending",void 0),s([eg(!1)],t.Animate.prototype,"reverse",void 0),s([eg(!1)],t.Animate.prototype,"swing",void 0),s([eg(!1)],t.Animate.prototype,"loop",void 0),s([eg(0)],t.Animate.prototype,"loopDelay",void 0),s([eg(1)],t.Animate.prototype,"speed",void 0),s([eg(!0)],t.Animate.prototype,"autoplay",void 0),s([eg()],t.Animate.prototype,"join",void 0),s([eg()],t.Animate.prototype,"jump",void 0),s([eg()],t.Animate.prototype,"attrs",void 0),t.Animate=s([$r(ba)],t.Animate),t.AnimateList=class extends t.Animate{get completed(){return this.list.every(t=>t.completed)}get endingStyle(){return this._endingStyle}constructor(t,e,i){super(t,null),this.list=[],this.updateList(e,i)}updateList(e,i){this.fromStyle={},this.toStyle={},this._endingStyle={},e||(e=this.list.filter(t=>{const{completed:e}=t;return e&&t.destroy(),!e})),this.list=e.map(e=>{const s=e.target?e:new t.Animate(this.target,e,i);return s.parent=this,Object.assign(this.fromStyle,s.fromStyle),Object.assign(this.toStyle,s.toStyle),Object.assign(this._endingStyle,s.endingStyle),s})}play(){this.each(t=>t.play()),this.emitType(ig.PLAY)}pause(){this.each(t=>t.pause()),this.emitType(ig.PAUSE)}stop(){this.each(t=>t.stop()),this.emitType(ig.STOP)}seek(t,e){this.each(i=>i.seek(t,e)),this.emitType(ig.SEEK)}kill(t,e){this.each(i=>i.kill(t,e)),this.destroy()}onChildEvent(t,e){switch(t){case ig.COMPLETED:this.completed&&this.emitType(t);break;case ig.UPDATE:this.emitType(t)}}each(t){this.list.forEach(t)}destroy(t){const{list:e}=this;e.length&&(this.each(e=>e.destroy(t)),e.length=0)}},t.AnimateList=s([$r(ba)],t.AnimateList);const sg={transparent:"FFF0",aliceblue:"F0F8FF",antiquewhite:"FAEBD7",aqua:"0FF",aquamarine:"7FFFD4",azure:"F0FFFF",beige:"F5F5DC",bisque:"FFE4C4",black:"0",blanchedalmond:"FFEBCD",blue:"00F",blueviolet:"8A2BE2",brown:"A52A2A",burlywood:"DEB887",cadetblue:"5F9EA0",chartreuse:"7FFF00",chocolate:"D2691E",coral:"FF7F50",cornflowerblue:"6495ED",cornsilk:"FFF8DC",crimson:"DC143C",cyan:"0FF",darkblue:"00008B",darkcyan:"008B8B",darkgoldenrod:"B8860B",darkgray:"A9",darkgreen:"006400",darkgrey:"A9",darkkhaki:"BDB76B",darkmagenta:"8B008B",darkolivegreen:"556B2F",darkorange:"FF8C00",darkorchid:"9932CC",darkred:"8B0000",darksalmon:"E9967A",darkseagreen:"8FBC8F",darkslateblue:"483D8B",darkslategray:"2F4F4F",darkslategrey:"2F4F4F",darkturquoise:"00CED1",darkviolet:"9400D3",deeppink:"FF1493",deepskyblue:"00BFFF",dimgray:"69",dimgrey:"69",dodgerblue:"1E90FF",firebrick:"B22222",floralwhite:"FFFAF0",forestgreen:"228B22",fuchsia:"F0F",gainsboro:"DC",ghostwhite:"F8F8FF",gold:"FFD700",goldenrod:"DAA520",gray:"80",green:"008000",greenyellow:"ADFF2F",grey:"80",honeydew:"F0FFF0",hotpink:"FF69B4",indianred:"CD5C5C",indigo:"4B0082",ivory:"FFFFF0",khaki:"F0E68C",lavender:"E6E6FA",lavenderblush:"FFF0F5",lawngreen:"7CFC00",lemonchiffon:"FFFACD",lightblue:"ADD8E6",lightcoral:"F08080",lightcyan:"E0FFFF",lightgoldenrodyellow:"FAFAD2",lightgray:"D3",lightgreen:"90EE90",lightgrey:"D3",lightpink:"FFB6C1",lightsalmon:"FFA07A",lightseagreen:"20B2AA",lightskyblue:"87CEFA",lightslategray:"789",lightslategrey:"789",lightsteelblue:"B0C4DE",lightyellow:"FFFFE0",lime:"00FF00",limegreen:"32CD32",linen:"FAF0E6",magenta:"FF00FF",maroon:"800000",mediumaquamarine:"66CDAA",mediumblue:"0000CD",mediumorchid:"BA55D3",mediumpurple:"9370DB",mediumseagreen:"3CB371",mediumslateblue:"7B68EE",mediumspringgreen:"00FA9A",mediumturquoise:"48D1CC",mediumvioletred:"C71585",midnightblue:"191970",mintcream:"F5FFFA",mistyrose:"FFE4E1",moccasin:"FFE4B5",navajowhite:"FFDEAD",navy:"000080",oldlace:"FDF5E6",olive:"808000",olivedrab:"6B8E23",orange:"FFA500",orangered:"FF4500",orchid:"DA70D6",palegoldenrod:"EEE8AA",palegreen:"98FB98",paleturquoise:"AFEEEE",palevioletred:"D87093",papayawhip:"FFEFD5",peachpuff:"FFDAB9",peru:"CD853F",pink:"FFC0CB",plum:"DDA0DD",powderblue:"B0E0E6",purple:"800080",rebeccapurple:"639",red:"F00",rosybrown:"BC8F8F",royalblue:"4169E1",saddlebrown:"8B4513",salmon:"FA8072",sandybrown:"F4A460",seagreen:"2E8B57",seashell:"FFF5EE",sienna:"A0522D",silver:"C0",skyblue:"87CEEB",slateblue:"6A5ACD",slategray:"708090",slategrey:"708090",snow:"FFFAFA",springgreen:"00FF7F",steelblue:"4682B4",tan:"D2B48C",teal:"008080",thistle:"D8BFD8",tomato:"FF6347",turquoise:"40E0D0",violet:"EE82EE",wheat:"F5DEB3",white:"F",whitesmoke:"F5",yellow:"FF0",yellowgreen:"9ACD32"},ng=/^rgb\((\d+),\s*(\d+),\s*(\d+)/i,rg=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)/i,og=/^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i,ag=/^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i,hg=parseInt,lg=parseFloat,{round:dg}=Math;let cg={},ug=0;function pg(t){let e,i,s,n=1;switch(t.length){case 9:e=hg(t.slice(1,3),16),i=hg(t.slice(3,5),16),s=hg(t.slice(5,7),16),n=hg(t.slice(7,9),16)/255;break;case 7:e=hg(t.slice(1,3),16),i=hg(t.slice(3,5),16),s=hg(t.slice(5,7),16);break;case 5:e=hg(t[1]+t[1],16),i=hg(t[2]+t[2],16),s=hg(t[3]+t[3],16),n=hg(t[4]+t[4],16)/255;break;case 4:e=hg(t[1]+t[1],16),i=hg(t[2]+t[2],16),s=hg(t[3]+t[3],16);break;case 3:e=i=s=hg(t[1]+t[2],16);break;case 2:e=i=s=hg(t[1]+t[1],16)}return{r:e,g:i,b:s,a:n}}const _g=1/6,gg=.5,fg=2/3,yg=1/3;function mg(t,e,i){return i<0?i++:i>1&&i--,i<_g?t+6*(e-t)*i:i<gg?e:i<fg?t+(e-t)*(fg-i)*6:t}function vg(t,e,i,s=1){let n,r,o;if(t/=360,i/=100,0===(e/=100))n=r=o=i;else{let s=i<.5?i*(1+e):i+e-i*e,a=2*i-s;n=mg(a,s,t+yg),r=mg(a,s,t),o=mg(a,s,t-yg)}return{r:dg(255*n),g:dg(255*r),b:dg(255*o),a:s}}ce.add("color"),Jh.object=function(t,e){let i,s=!o(e)&&e<1;if(h(t)){const e=cg[t];if(e)i=Object.assign({},e);else{switch(t[0]){case"#":i=pg(t);break;case"R":case"r":"("===t[4]&&rg.test(t)?i=function(t){const e=rg.exec(t);return{r:hg(e[1]),g:hg(e[2]),b:hg(e[3]),a:lg(e[4])}}(t):"("===t[3]&&ng.test(t)&&(i=function(t){const e=ng.exec(t);return{r:hg(e[1]),g:hg(e[2]),b:hg(e[3]),a:1}}(t));break;case"H":case"h":"("===t[4]&&ag.test(t)?i=function(t){const e=ag.exec(t);return vg(lg(e[1]),lg(e[2]),lg(e[3]),lg(e[4]))}(t):"("===t[3]&&og.test(t)&&(i=function(t){const e=og.exec(t);return vg(lg(e[1]),lg(e[2]),lg(e[3]),1)}(t))}if(!i){const e=sg[t.toLowerCase()];e&&(i=pg("#"+e))}i&&(ug++,ug>1e4&&(cg={},ug=0),cg[t]=Object.assign({},i))}}else p(t)&&(o(t.a)&&(t.a=1),s&&(t=Object.assign({},t)),i=t);return i||(i={r:255,g:255,b:255,a:1}),s&&(i.a*=e),i};const{round:wg}=Math,{fourNumber:xg}=M,bg={fill:Tg,stroke:Tg,cornerRadius:(t,e,i)=>d(t)&&d(e)?Sg(t,e,i):(t=xg(t),e=xg(e),t.map((t,s)=>Sg(t,e[s],i))),text(t,e,i){if(h(t)&&h(e)){const s=t.length,n=e.length,r=Sg(s,n,i,1);return s<n?e.substring(0,r):t.substring(0,r)}return d(t)||d(e)?M.float(Sg(t,e,i),Math.max(Pg(t),Pg(e))):e},boxStyle(t,e,i,s){t||(t={}),e||(e={});const n=Object.assign(Object.assign({},t),e);return ll.setBetweenStyle(n,t,e,n,i,s),n},shadow:Bg,innerShadow:Bg},Eg={value:function(t,e,i){const s=d(t),n=d(e);return s&&n?t+(e-t)*i:n||s?Sg(t,e,i):t},number:Sg,color:kg,setBetweenStyle:function(t,e,i,s,n,r,o){let a,h,l;const{list:d,value:c}=ll;for(let u in s)o&&!o[u]||(a=e[u],h=i[u],l=d[u]||c,a!==h&&(t[u]=l(a,h,n,r)))}};function Pg(t){const e=String(t).split(".")[1];return e?e.length:0}function Sg(t,e,i,s){t||(t=0),e||(e=0);const n=t+(e-t)*i;return s?wg(n):n}function kg(t,e,i){t=Jh.object(t),e=Jh.object(e);const s=Sg(t.r,e.r,i,1)+","+Sg(t.g,e.g,i,1)+","+Sg(t.b,e.b,i,1),n=Sg(t.a,e.a,i);return 1===n?"rgb("+s+")":"rgba("+s+","+n+")"}function Tg(t,e,i){return h(t)&&h(e)?kg(t,e,i):e}function Bg(t,e,i){return u(t)||u(e)?e:(e=e||{},{x:Sg((t=t||{}).x,e.x,i),y:Sg(t.y,e.y,i),blur:Sg(t.blur,e.blur,i),spread:Sg(t.spread,e.spread,i),color:kg(t.color||"#FFFFFF00",e.color||"#FFFFFF00",i),visible:e.visible,blendMode:e.blendMode,box:e.box||t.box})}ce.add("animate","color"),hl.canAnimate=!0,Object.assign(ll.list,bg),Object.assign(ll,Eg);const Cg=t.UI.prototype;t.UI.addAttr("animation",void 0,function(t){return _r(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&(this.killAnimate("animation"),e&&this.animate(e,void 0,"animation"))}}))}),t.UI.addAttr("animationOut",void 0,yr),t.UI.addAttr("transition",!0,yr),t.UI.addAttr("transitionOut",void 0,yr),Cg.set=function(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):Object.assign(this,t))},Cg.animate=function(e,i,s,n){if(o(e))return this.__animate;let r=u(e)&&!i&&s?new t.AnimateList(this,e,n):new t.Animate(this,e,i,n);this.killAnimate(s,r.toStyle);const a=this.__animate;return a&&(r instanceof t.AnimateList?r.list.unshift(a):r=new t.AnimateList(this,[a,r])),this.__animate=r},Cg.killAnimate=function(e,i){const s=this.__animate;if(s){let e=!1;if(i&&!s.completed){s instanceof t.AnimateList&&s.updateList();const{toStyle:n}=s;for(let t in i)if(t in n){e=!0;break}}else e=!0;e&&(s.kill(!0,i),this.__animate=null)}},Cg.__runAnimation=function(t,e){this.animate("in"===t?this.animation:this.animationOut,void 0,"animation"),e&&this.__animate.on(ig.COMPLETED,e)};const Rg=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],Lg=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:Dg}=Math,{getDerivative:Ag}=li,Og={getDistance(t,e,i,s,n,r,o,a,h=1){let l,d,c,u,p,_,g=0,f=h/2;for(let h=0;h<Rg.length;h++)l=f*(1+Rg[h]),d=f*(1-Rg[h]),c=Ag(l,t,i,n,o),u=Ag(l,e,s,r,a),p=Ag(d,t,i,n,o),_=Ag(d,e,s,r,a),g+=Lg[h]*(Dg(c*c+u*u)+Dg(p*p+_*_));return g*f},getRotation(t,e,i,s,n,r,o,a,h){const l=Ag(t,e,s,r,a),d=Ag(t,i,n,o,h);return Math.atan2(d,l)/W},getT(t,e,i,s,n,r,o,a,h,l,d=1){let c=0,u=1,p=t/e,_=d/e/3;if(p>=1)return 1;if(p<=0)return 0;for(;u-c>_;)Ig(i,s,n,r,o,a,h,l,p)<t?c=p:u=p,p=(c+u)/2;return p},cut(t,e,i,s,n,r,o,a,h,l){const d=1-e,c=d*i+e*n,u=d*s+e*r,p=d*n+e*o,_=d*r+e*a,g=d*c+e*p,f=d*u+e*_,y=d*g+e*(d*p+e*(d*o+e*h)),m=d*f+e*(d*_+e*(d*a+e*l));t.push(Me.C,c,u,g,f,y,m)}},{getDistance:Ig}=Og,{M:Mg,L:Fg,C:Wg,Z:Ug}=Me,{float:Ng}=M,{set:zg,getAngle:Yg,getDistanceFrom:Xg,getDistancePoint:Hg}=lt,jg={},Vg={},Gg={transform(t,e){let i,s=0;const n=t.length;for(;s<n;)switch(i=t[s],i){case Mg:case Fg:Gg.transformPoints(t,e,s,1),s+=3;break;case Wg:Gg.transformPoints(t,e,s,3),s+=7;break;case Ug:s+=1}},transformPoints(t,e,i,s){for(let n=i+1,r=n+2*s;n<r;n+=2)jg.x=t[n],jg.y=t[n+1],Q.toOuterPoint(e,jg),t[n]=jg.x,t[n+1]=jg.y},getMotionPathData(t){let e,i,s,n,r,o=0,a=[],h=0,l=0,d=0,c=0,u=0;const p=t.length;for(;h<p;){switch(n=t[h],n){case Mg:c=t[h+1],u=t[h+2];case Fg:i=t[h+1],s=t[h+2],e=n===Fg&&h>0?Xg(l,d,i,s):0,l=i,d=s,h+=3;break;case Wg:i=t[h+5],s=t[h+6],e=Og.getDistance(l,d,t[h+1],t[h+2],t[h+3],t[h+4],i,s),l=i,d=s,h+=7;break;case Ug:r=!0,e=Xg(l,d,c,u),h+=1;break;default:e=0}a.push(e),o+=e}return{total:o,segments:a,data:t,closed:r}},getDistancePoint(t,e,i,s){const{segments:n,data:r,total:o}=t;e=tl.number(e,o),s&&(e+=s),e>o&&(e%=o);let a,h,l,d,c,u,p,_,g,f=0,y={},m=0,v=0,w=0,x=0,b=0,E=0;const P=r.length;for(;m<P;){switch(d=r[m],d){case Mg:b=r[m+1],E=r[m+2];case Fg:if(h=r[m+1],l=r[m+2],a=n[v],f+a>=e||!t.total){if(zg(y,h,l),m)return zg(Vg,w,x),Hg(Vg,y,e-f,!0),y.rotation=Yg(Vg,y),y;{const e=Gg.getDistancePoint(t,i,i,s);return y.rotation=e.rotation,y}}w=h,x=l,m+=3;break;case Wg:if(h=r[m+5],l=r[m+6],a=n[v],f+a>=e)return c=r[m+1],u=r[m+2],p=r[m+3],_=r[m+4],g=Og.getT(e-f,a,w,x,c,u,p,_,h,l,i),li.getPointAndSet(g,w,x,c,u,p,_,h,l,y),y.rotation=Og.getRotation(g,w,x,c,u,p,_,h,l),y;w=h,x=l,m+=7;break;case Ug:if(h=b,l=E,a=n[v],f+a>=e)return zg(Vg,w,x),zg(y,h,l),Hg(Vg,y,e-f,!0),y.rotation=Yg(Vg,y),y;w=h,x=l,m+=1;break;default:a=0}v++,f+=a}return y},getDistancePath(t,e,i){const{segments:s,data:n}=t,r=[];e=tl.number(e,t.total);let o,a,h,l,d,c,u,p,_,g,f=0,y={},m=0,v=0,w=0,x=0,b=0,E=0;const P=n.length;for(;m<P;){switch(d=n[m],d){case Mg:b=n[m+1],E=n[m+2];case Fg:if(h=n[m+1],l=n[m+2],o=s[v],f+o>e||!t.total)return m||(w=h,x=l),zg(Vg,w,x),zg(y,h,l),a=Ng(e-f),a&&(Hg(Vg,y,a,!0),r.push(d,y.x,y.y)),r;w=h,x=l,m+=3,r.push(d,w,x);break;case Wg:if(c=n[m+1],u=n[m+2],p=n[m+3],_=n[m+4],h=n[m+5],l=n[m+6],o=s[v],f+o>e)return a=Ng(e-f),a&&(g=Og.getT(a,o,w,x,c,u,p,_,h,l,i),Og.cut(r,g,w,x,c,u,p,_,h,l)),r;w=h,x=l,m+=7,r.push(d,c,u,p,_,h,l);break;case Ug:if(h=b,l=E,o=s[v],f+o>e)return zg(Vg,w,x),zg(y,h,l),a=Ng(e-f),a&&(Hg(Vg,y,a,!0),r.push(Fg,y.x,y.y)),r;w=h,x=l,m+=1,r.push(d);break;default:o=0}v++,f+=o}return r}};function qg(t){return _r(t,t=>({set(e){this.__setAttr(t,e),this.__hasMotionPath=this.motionPath||!a(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}}))}ce.add("motion-path"),ll.register("motion",function(t,e,i,s){return p(t)&&(t=tl.number(t,s.getMotionTotal())),p(e)&&(e=tl.number(e,s.getMotionTotal())),ll.number(t||0,e||0,i)}),ll.register("motionRotation",function(t,e,i){return ll.number(t,e,i)});const Kg=t.UI.prototype,{updateMatrix:Zg,updateAllMatrix:Qg}=po,{updateBounds:$g}=So,{toVertical:Jg}=lt,tf={};function ef(t){const{motion:e,leaferIsCreated:i}=t;if(!a(e)){if(i&&(t.leafer.created=!1),t.motionPath){const i=nf(t);i.total&&(t.__.__pathForRender=Gg.getDistancePath(i,e,t.motionPrecision))}else{if(t.motionText)t.__updateMotionText();else{const i=t.getMotionPoint(e);!1===t.motionRotation&&delete i.rotation,t.set(i)}t.__hasAutoLayout||(t.isBranch?(Qg(t),$g(t,t)):Zg(t))}i&&(t.leafer.created=!0)}}function sf(t){const{parent:e}=t;if(!t.motionPath&&e){const{children:t}=e;for(let e=0;e<t.length;e++)if(t[e].motionPath)return t[e]}return t}function nf(t){const e=t.__;if(e.__pathForMotion)return e.__pathForMotion;return e.__pathForMotion=Gg.getMotionPathData(t.getPath(!0,!0))}t.UI.addAttr("motionPath",void 0,qg),t.UI.addAttr("motionPrecision",1,qg),t.UI.addAttr("motion",void 0,qg),t.UI.addAttr("motionAround",void 0,qg),t.UI.addAttr("motionVertical","below",qg),t.UI.addAttr("motionRotation",!0,qg),Kg.getMotionPath=function(){return sf(this)},Kg.getMotionPathData=function(){return nf(sf(this))},Kg.getMotionContentHeight=function(){return this.__layout.boxBounds.height},Kg.getMotionPoint=function(t,e,i,s=0,n=0){i||(i=sf(this));const r=nf(i);if(!r.total)return{};const o=Gg.getDistancePoint(r,t,i.motionPrecision,s),{motionRotation:a,motionAround:h}=this;let l,c;if(d(a)&&(o.rotation+=a),h&&"top-left"!==h&&(Pt.toPoint(h,this.__layout.boxBounds,tf),lt.set(tf,o.x-tf.x*this.scaleX,o.y-tf.y*this.scaleY),o.rotation&<.rotate(tf,o.rotation,o),lt.copy(o,tf)),p(e)?(l=e.type,c=e.offset):d(e)?c=e:l=e,"below"!==l||n){const{rotation:t}=o,e=this.getMotionContentHeight();switch(c&&(n+="above"===l?-c:c),l){case"above":Jg(o,t,-e+n);break;case"center":Jg(o,t,-e/2+n);break;default:Jg(o,t,n)}}return Q.toOuterPoint(i.localTransform,o),o},Kg.getMotionTotal=function(){return this.getMotionPathData().total},Kg.__updateMotionPath=function(){const t=this.__;if(this.__layout.resized&&t.__pathForMotion&&(t.__pathForMotion=void 0),this.motionPath){let t;const{children:e}=this.parent;for(let i=0;i<e.length;i++)t=e[i],a(t.motion)||t.__layout.matrixChanged||(t!==this&&t.__extraUpdate(),ef(t))}else ef(this)};const{Yes:rf,NoAndSkip:of,YesAndSkip:af}=t.Answer,hf={},lf={},df={};class cf{constructor(t,e){this.methods={id:(t,e)=>t.id===e?(this.target&&(this.idMap[e]=t),1):0,innerId:(t,e)=>t.innerId===e?(this.target&&(this.innerIdMap[e]=t),1):0,className:(t,e)=>t.className===e?1:0,tag:(t,e)=>t.__tag===e?1:0,tags:(t,e)=>e[t.__tag]?1:0},this.idMap={},this.innerIdMap={};const i=t&&t.app;i&&(i.idMap?this.idMap=i.idMap:i.idMap=this.idMap,i.innerIdMap?this.innerIdMap=i.innerIdMap:i.innerIdMap=this.innerIdMap),(this.target=t)&&this.__listenEvents()}getBy(t,e,i,s){switch(typeof t){case"number":const n=this.getByInnerId(t,e);return i?n:n?[n]:[];case"string":switch(t[0]){case"#":hf.id=t.substring(1),t=hf;break;case".":lf.className=t.substring(1),t=lf;break;default:df.tag=t,t=df}case"object":if(o(t.id)){if(t.tag){const{tag:s}=t,n=u(s);return this.getByMethod(n?this.methods.tags:this.methods.tag,e,i,n?g.toMap(s):s)}return this.getByMethod(this.methods.className,e,i,t.className)}{const s=this.getById(t.id,e);return i?s:s?[s]:[]}case"function":return this.getByMethod(t,e,i,s)}}getByInnerId(t,e){const i=this.innerIdMap[t];return i||(this.eachFind(this.toChildren(e),this.methods.innerId,null,t),this.findLeaf)}getById(t,e){const i=this.idMap[t];return i&&po.hasParent(i,e||this.target)?i:(this.eachFind(this.toChildren(e),this.methods.id,null,t),this.findLeaf)}getByClassName(t,e){return this.getByMethod(this.methods.className,e,!1,t)}getByTag(t,e){return this.getByMethod(this.methods.tag,e,!1,t)}getByMethod(t,e,i,s){const n=i?null:[];return this.eachFind(this.toChildren(e),t,n,s),n||this.findLeaf}eachFind(t,e,i,s){let n,r;for(let o=0,a=t.length;o<a;o++){if(n=t[o],r=e(n,s),"boolean"==typeof r&&(r=r?1:0),r===rf||r===af){if(!i)return void(this.findLeaf=n);i.push(n)}n.isBranch&&r<of&&this.eachFind(n.children,e,i,s)}}toChildren(t){return this.findLeaf=null,[t||this.target]}__onRemoveChild(t){const{id:e,innerId:i}=t.child;this.idMap[e]&&delete this.idMap[e],this.innerIdMap[i]&&delete this.innerIdMap[i]}__checkIdChange(t){if("id"===t.attrName){const e=t.oldValue;this.idMap[e]&&delete this.idMap[e]}}__listenEvents(){this.__eventIds=[this.target.on_(Xo.REMOVE,this.__onRemoveChild,this),this.target.on_(jo.CHANGE,this.__checkIdChange,this)]}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}destroy(){const{__eventIds:t}=this;t&&t.length&&(this.__removeListenEvents(),this.innerIdMap={},this.idMap={}),this.findLeaf=null}}const uf=t.UI.prototype;function pf(t){return t.leafer?t.leafer.selector:ee.selector||(ee.selector=ue.selector())}return uf.find=function(t,e){return pf(this).getBy(t,this,!1,e)},uf.findOne=function(t,e){return pf(this).getBy(t,this,!0,e)},ce.add("find"),ue.finder=function(t,e){return new cf(t,e)},po.cacheId=function(t){const{leafer:e,id:i}=t;i&&(e.app.idMap[i]=t),e.cacheInnerId&&(e.app.innerIdMap[t.innerId]=t)},t.AlignHelper=Tt,t.AnimateEasing=tg,t.AnimateEvent=ig,t.AroundHelper=Pt,t.AutoBounds=Zt,t.BezierHelper=li,t.Bounds=qt,t.BoundsEvent=qo,t.BoundsHelper=Ht,t.BoxData=vl,t.BranchHelper=So,t.BranchRender=Xa,t.CanvasData=Dl,t.CanvasManager=ve,t.ChildEvent=Xo,t.ColorConvert=Jh,t.Creator=ue,t.Cursor=cc,t.DataHelper=g,t.Debug=ne,t.DragBoundsHelper=Yd,t.Dragger=tc,t.Effect=rl,t.EllipseData=Pl,t.EllipseHelper=mi,t.Event=Yo,t.EventCreator=ye,t.Eventer=ca,t.Export=al,t.FileHelper=$n,t.Filter=ol,t.Finder=cf,t.FourNumberHelper=S,t.FrameData=xl,t.GroupData=ml,t.HighBezierHelper=Og,t.HighCurveHelper=Gg,t.HitCanvasManager=uc,t.ImageData=Ll,t.ImageEvent=Go,t.ImageManager=or,t.IncrementId=m,t.Interaction=Cc,t.InteractionBase=dc,t.InteractionHelper=qd,t.Keyboard=Bd,t.LayoutEvent=ia,t.Layouter=zh,t.LeafBounds=Ua,t.LeafBoundsHelper=xo,t.LeafData=y,t.LeafDataProxy=Pa,t.LeafEventer=ba,t.LeafHelper=po,t.LeafLayout=zo,t.LeafLevelList=Sh,t.LeafList=Ph,t.LeafMatrix=La,t.LeafRender=Na,t.LeaferCanvas=Th,t.LeaferCanvasBase=Ae,t.LeaferData=wl,t.LeaferEvent=na,t.LeaferFilm=class extends dr{get tag(){return"Film"}},t.LeaferImage=dr,t.LeaferVideo=class extends dr{get tag(){return"Video"}},t.LineData=bl,t.MathHelper=M,t.Matrix=yt,t.MatrixHelper=Q,t.MyDragEvent=Vd,t.MyImage=bd,t.MyPointerEvent=Hd,t.MyTouchEvent=Gd,t.NeedConvertToCanvasCommandMap=We,t.OneRadian=W,t.PI2=U,t.PI_2=N,t.Paint=il,t.PaintGradient=nl,t.PaintImage=sl,t.PathArrow=el,t.PathBounds=Nn,t.PathCommandDataHelper=Ts,t.PathCommandMap=Me,t.PathCommandNodeHelper=vi,t.PathConvert=ss,t.PathCorner=Gn,t.PathCreator=Vs,t.PathData=Tl,t.PathDrawer=hn,t.PathHelper=Oe,t.PathNumberCommandLengthMap=Ye,t.PathNumberCommandMap=ze,t.PenData=Bl,t.Picker=Gh,t.Platform=ee,t.Plugin=ce,t.Point=gt,t.PointHelper=lt,t.PointerButton=Cd,t.PolygonData=Sl,t.PropertyEvent=jo,t.RectData=El,t.RectHelper=Xe,t.RectRender=Ul,t.RenderEvent=sa,t.Renderer=Xh,t.ResizeEvent=ta,t.Resource=nr,t.RobotData=c_,t.Run=he,t.Selector=qh,t.StarData=kl,t.State=hl,t.StringNumberMap=$t,t.TaskItem=er,t.TaskProcessor=ir,t.TextConvert=$h,t.TextData=Rl,t.Transition=ll,t.TwoPointBoundsHelper=vt,t.UIBounds=Il,t.UICreator=_e,t.UIData=fl,t.UIEvent=Rd,t.UIRender=Fl,t.UnitConvert=tl,t.UnitConvertHelper=Qt,t.WaitHelper=Lo,t.WatchEvent=ea,t.Watcher=Rh,t.affectRenderBoundsType=Lr,t.affectStrokeBoundsType=Br,t.attr=gr,t.autoLayoutType=wr,t.boundsType=Er,t.canvasPatch=Qn,t.canvasSizeAttrs=De,t.createAttr=function(t){return(e,i)=>{cr(e,i,pr(i,t))}},t.createDescriptor=pr,t.cursorType=Xr,t.dataProcessor=Hr,t.dataType=yr,t.decorateLeafAttr=_r,t.defineDataProcessor=jr,t.defineKey=cr,t.defineLeafAttr=fr,t.dimType=Or,t.doBoundsType=Sr,t.doStrokeType=Cr,t.doSurfaceType=Ar,t.effectType=Kh,t.emptyData=r,t.eraserType=zr,t.extraPropertyEventMap=Vo,t.getBoundsData=Y,t.getDescriptor=ur,t.getMatrixData=X,t.getPointData=z,t.hitType=Yr,t.isArray=u,t.isData=function(t){return p(t)&&!u(t)},t.isEmptyData=_,t.isFinite=l,t.isNull=a,t.isNumber=d,t.isObject=p,t.isString=h,t.isUndefined=o,t.layoutProcessor=function(t){return(e,i)=>{cr(e,"__LayoutProcessor",{get:()=>t})}},t.leaferTransformAttrMap=la,t.maskType=Nr,t.motionPathType=qg,t.naturalBoundsType=Pr,t.opacityType=Ir,t.path=qn,t.pathInputType=kr,t.pathType=Tr,t.pen=Kn,t.positionType=mr,t.registerPointsCurve=Ls,t.registerUI=Jr,t.registerUIEvent=to,t.resizeType=Zh,t.rewrite=Kr,t.rewriteAble=Zr,t.rotationType=br,t.scaleType=xr,t.scrollType=vr,t.sortType=Ur,t.stateStyleType=p_,t.stateType=u_,t.strokeType=Rr,t.surfaceType=Dr,t.tempBounds=Kt,t.tempMatrix=mt,t.tempPoint=ft,t.tryToNumber=function(t){return"string"==typeof t&&c.test(t)?+t:t},t.useCanvas=Bh,t.useModule=$r,t.version="2.2.6",t.visibleType=Mr,t.zoomLayerType=Qh,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,i;function s(t,e,i,s){var n,r=arguments.length,o=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(r<3?n(o):r>3?n(e,i,o):n(e,i))||o);return r>3&&o&&Object.defineProperty(e,i,o),o}function n(t,e,i,s){return new(i||(i=Promise))(function(n,r){function o(t){try{h(s.next(t))}catch(t){r(t)}}function a(t){try{h(s.throw(t))}catch(t){r(t)}}function h(t){t.done?n(t.value):function(t){return t instanceof i?t:new i(function(e){e(t)})}(t.value).then(o,a)}h((s=s.apply(t,e||[])).next())})}t.PathNodeHandleType=void 0,(e=t.PathNodeHandleType||(t.PathNodeHandleType={}))[e.none=1]="none",e[e.free=2]="free",e[e.mirrorAngle=3]="mirrorAngle",e[e.mirror=4]="mirror","function"==typeof SuppressedError&&SuppressedError,t.Answer=void 0,(i=t.Answer||(t.Answer={}))[i.No=0]="No",i[i.Yes=1]="Yes",i[i.NoAndSkip=2]="NoAndSkip",i[i.YesAndSkip=3]="YesAndSkip";const r={};function o(t){return void 0===t}function a(t){return null==t}function h(t){return"string"==typeof t}const{isFinite:l}=Number;function d(t){return"number"==typeof t}const c=/^-?\d+(?:\.\d+)?$/;const{isArray:u}=Array;function p(t){return t&&"object"==typeof t}function _(t){return"{}"===JSON.stringify(t)}const g={default:(t,e)=>(f(e,t),f(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach(n=>{var r,o;if(s=e[n],(null==s?void 0:s.constructor)===Object&&(null===(r=t[n])||void 0===r?void 0:r.constructor)===Object)return f(t[n],e[n],i&&i[n]);i&&n in i?(null===(o=i[n])||void 0===o?void 0:o.constructor)===Object&&f(t[n]={},e[n],i[n]):t[n]=e[n]})},copyAttrs:(t,e,i)=>(i.forEach(i=>{o(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:f}=g;class y{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __usePathBox(){return this.__pathInputed}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(!o(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let i;for(let s in this)"_"!==s[0]&&(i=e?e[s]:void 0,t[s]=o(i)?this[s]: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(!o(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!o(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(u(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:s}=this;i.tag=this.__leaf.tag;for(let n in this)if("_"!==n[0]&&(t=this["_"+n],!o(t))){if("path"===n&&!this.__pathInputed)continue;e=s?s[n]:void 0,i[n]=o(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:n,e:r,f:o}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:n,e:r,f:o}}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,this.__complexData&&this.__complexData.destroy()}}const m={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CANVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=v;return e[t]?e[t]++:(e[t]=1,0)}},v=m;let w,x,b;const{max:E}=Math,P=[0,0,0,0],S={zero:[...P],tempFour:P,set:(t,e,i,s,n)=>(void 0===i&&(i=s=n=e),t[0]=e,t[1]=i,t[2]=s,t[3]=n,t),setTemp:(t,e,i,s)=>k(P,t,e,i,s),toTempAB(t,e,i){b=i?d(t)?e:t:[],d(t)?(w=T(t),x=e):d(e)?(w=t,x=T(e)):(w=t,x=e),4!==w.length&&(w=B(w)),4!==x.length&&(x=B(x))},get(t,e){let i;if(!d(t))switch(t.length){case 4:i=o(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]),!o(e))for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},max:(t,e,i)=>d(t)&&d(e)?E(t,e):(C(t,e,i),k(b,E(w[0],x[0]),E(w[1],x[1]),E(w[2],x[2]),E(w[3],x[3]))),add:(t,e,i)=>d(t)&&d(e)?t+e:(C(t,e,i),k(b,w[0]+x[0],w[1]+x[1],w[2]+x[2],w[3]+x[3])),swapAndScale(t,e,i,s){if(d(t))return e===i?t*e:[t*i,t*e];const n=s?t:[],[r,o,a,h]=4===t.length?t:B(t);return k(n,a*i,h*e,r*i,o*e)}},{set:k,get:B,setTemp:T,toTempAB:C}=S,{round:R,pow:L,max:D,floor:A,PI:O}=Math,I={},M={within:(t,e,i)=>(p(e)&&(i=e.max,e=e.min),!o(e)&&t<e&&(t=e),!o(i)&&t>i&&(t=i),t),fourNumber:S.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=o(e)?1e12:L(10,e);return-0===(t=R(t*i)/i)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,i,s){if(s||(s={}),e){const t=(d(e)?e:e.width||0)/i.width,n=(d(e)?e:e.height||0)/i.height;s.scaleX=t||n||1,s.scaleY=n||t||1}else t&&M.assignScale(s,t);return s},getScaleFixedData(t,e,i,s,n){let{scaleX:r,scaleY:o}=t;if((s||e)&&(r<0&&(r=-r),o<0&&(o=-o)),e)if(!0===e)r=o=i?1:1/r;else{let t;d(e)?t=e:"zoom-in"===e&&(t=1),t&&(r=o=r>t||o>t?i?1:1/r:i?1:1/t)}return I.scaleX=r,I.scaleY=o,I},assignScale(t,e){d(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>D(A(t),e)/t,randInt:F,randColor:t=>`rgba(${F(255)},${F(255)},${F(255)},${t||1})`};function F(t){return Math.round(Math.random()*t)}const W=O/180,U=2*O,N=O/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:V,sqrt:G}=Math,{float:q}=M,K={};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,n=1,r=0,o=0){t.a=e,t.b=i,t.c=s,t.d=n,t.e=r,t.f=o},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){$.toInnerPoint(t,e,K),$.scaleOfInner(t,K,i,s)},scaleOfInner(t,e,i,s=i){$.translateInner(t,e.x,e.y),$.scale(t,i,s),$.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:n,d:r}=t,o=j(e*=W),a=H(e);t.a=i*o-s*a,t.b=i*a+s*o,t.c=n*o-r*a,t.d=n*a+r*o},rotateOfOuter(t,e,i){$.toInnerPoint(t,e,K),$.rotateOfInner(t,K,i)},rotateOfInner(t,e,i){$.translateInner(t,e.x,e.y),$.rotate(t,i),$.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:n,c:r,d:o}=t;i&&(i*=W,t.a=s+r*i,t.b=n+o*i),e&&(e*=W,t.c=r+s*e,t.d=o+n*e)},skewOfOuter(t,e,i,s){$.toInnerPoint(t,e,K),$.skewOfInner(t,K,i,s)},skewOfInner(t,e,i,s=0){$.translateInner(t,e.x,e.y),$.skew(t,i,s),$.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:n,d:r,e:o,f:a}=t;t.a=e.a*i+e.b*n,t.b=e.a*s+e.b*r,t.c=e.c*i+e.d*n,t.d=e.c*s+e.d*r,t.e=e.e*i+e.f*n+o,t.f=e.e*s+e.f*r+a},multiplyParent(t,e,i,s,n){const{e:r,f:a}=t;if(i||(i=t),o(s)&&(s=1!==t.a||t.b||t.c||1!==t.d),s){const{a:s,b:r,c:o,d:a}=t;i.a=s*e.a+r*e.c,i.b=s*e.b+r*e.d,i.c=o*e.a+a*e.c,i.d=o*e.b+a*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=r*e.a+a*e.c+e.e,i.f=r*e.b+a*e.d+e.f},divide(t,e){$.multiply(t,$.tempInvert(e))},divideParent(t,e){$.multiplyParent(t,$.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=$;return $.copy(e,t),$.invert(e),e},invert(t){const{a:e,b:i,c:s,d:n,e:r,f:o}=t;if(i||s){const a=1/(e*n-i*s);t.a=n*a,t.b=-i*a,t.c=-s*a,t.d=e*a,t.e=-(r*n-o*s)*a,t.f=-(o*e-r*i)*a}else if(1===e&&1===n)t.e=-r,t.f=-o;else{const i=1/(e*n);t.a=n*i,t.d=e*i,t.e=-r*n*i,t.f=-o*e*i}},toOuterPoint(t,e,i,s){const{x:n,y:r}=e;i||(i=e),i.x=n*t.a+r*t.c,i.y=n*t.b+r*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:n,b:r,c:o,d:a}=t,h=1/(n*a-r*o),{x:l,y:d}=e;if(i||(i=e),i.x=(l*a-d*o)*h,i.y=(d*n-l*r)*h,!s){const{e:e,f:s}=t;i.x-=(e*a-s*o)*h,i.y-=(s*n-e*r)*h}},setLayout(t,e,i,s,n){const{x:r,y:a,scaleX:h,scaleY:l}=e;if(o(n)&&(n=e.rotation||e.skewX||e.skewY),n){const{rotation:i,skewX:s,skewY:n}=e,r=i*W,o=j(r),a=H(r);if(s||n){const e=s*W,i=n*W;t.a=(o+i*-a)*h,t.b=(a+i*o)*h,t.c=(e*o-a)*l,t.d=(o+e*a)*l}else t.a=o*h,t.b=a*h,t.c=-a*l,t.d=o*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=r,t.f=a,(i=i||s)&&$.translateInner(t,-i.x,-i.y,!s)},getLayout(t,e,i,s){const{a:n,b:r,c:o,d:a,e:h,f:l}=t;let d,c,u,p,_,g=h,f=l;if(r||o){const t=n*a-r*o;if(o&&!s){d=G(n*n+r*r),c=t/d;const e=n/d;u=r>0?V(e):-V(e)}else{c=G(o*o+a*a),d=t/c;const e=o/c;u=N-(a>0?V(-e):-V(e))}const e=q(j(u)),i=H(u);d=q(d),c=q(c),p=e?q((o/c+i)/e/W,9):0,_=e?q((r/d-i)/e/W,9):0,u=q(u/W)}else d=n,c=a,u=p=_=0;return(e=i||e)&&(g+=e.x*n+e.y*o,f+=e.x*r+e.y*a,i||(g-=e.x,f-=e.y)),{x:g,y:f,scaleX:d,scaleY:c,rotation:u,skewX:p,skewY:_}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:n,c:r,d:o}=t;n||r?i=(s*o-n*r)/(e=G(s*s+n*n)):(e=s,i=o)}return s.scaleX=e,s.scaleY=i,s},reset(t){$.set(t)}},$=Q,{float:J}=M,{toInnerPoint:tt,toOuterPoint:et}=Q,{sin:it,cos:st,abs:nt,sqrt:rt,atan2:ot,min:at,round:ht}=Math,lt={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=o(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?ht(t.x-.5)+.5:ht(t.x),t.y=e?ht(t.y-.5)+.5:ht(t.y)},move(t,e,i){p(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,s=1,n=1){i||(i=dt.defaultPoint);const r=st(e*=W),o=it(e),a=(t.x-i.x)/s,h=(t.y-i.y)/n;t.x=i.x+(a*r-h*o)*s,t.y=i.y+(a*o+h*r)*n},tempToInnerOf(t,e){const{tempPoint:i}=dt;return ut(i,t),tt(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=dt;return ut(i,t),et(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=dt;return ut(i,t),dt.toInnerRadiusPointOf(t,e,i),i},copyRadiusPoint:(t,e,i,s)=>(ut(t,e),pt(t,i,s),t),toInnerRadiusPointOf(t,e,i){i||(i=t),tt(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){tt(e,t,i)},toOuterOf(t,e,i){et(e,t,i)},toVertical(t,e,i,s){const n=e*W;t.x+=-Math.sin(n)*i,t.y+=Math.cos(n)*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)=>ct(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const n=nt(i-t),r=nt(s-e);return rt(n*n+r*r)},getMinDistanceFrom:(t,e,i,s,n,r)=>at(ct(t,e,i,s),ct(i,s,n,r)),getAngle:(t,e,i,s)=>_t(t,e,i,s)/W,getRotation:(t,e,i,s)=>(s||(s=e),dt.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/W),getRadianFrom(t,e,i,s,n,r,a,h){o(a)&&(a=i,h=s);const l=t-i,d=e-s,c=n-a,u=r-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e,i=1,s=1)=>ot((e.y-t.y)/s,(e.x-t.x)/i),getDistancePoint(t,e,i,s,n){const r=_t(t,e);return n&&(t=e),s||(e={}),e.x=t.x+st(r)*i,e.y=t.y+it(r)*i,e},toNumberPoints(t){let e=t;return p(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},isSame:(t,e,i)=>i?t.x===e.x&&t.y===e.y:J(t.x)===J(e.x)&&J(t.y)===J(e.y),reset(t){t.x=t.y=0}},dt=lt,{getDistanceFrom:ct,copy:ut,setRadius:pt,getAtan2:_t}=dt;class gt{constructor(t,e){this.set(t,e)}set(t,e){return p(t)?lt.copy(this,t):lt.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new gt(this)}move(t,e){return lt.move(this,t,e),this}scale(t,e){return lt.scale(this,t,e),this}scaleOf(t,e,i){return lt.scaleOf(this,t,e,i),this}rotate(t,e,i,s){return lt.rotate(this,t,e,i,s),this}rotateOf(t,e,i,s){return lt.rotate(this,e,t,i,s),this}getRotation(t,e,i){return lt.getRotation(this,t,e,i)}toInnerOf(t,e){return lt.toInnerOf(this,t,e),this}toOuterOf(t,e){return lt.toOuterOf(this,t,e),this}getCenter(t){return new gt(lt.getCenter(this,t))}getDistance(t){return lt.getDistance(this,t)}getDistancePoint(t,e,i,s){return new gt(lt.getDistancePoint(this,t,e,i,s))}getAngle(t,e,i){return lt.getAngle(this,t,e,i)}getAtan2(t,e,i){return lt.getAtan2(this,t,e,i)}isSame(t,e){return lt.isSame(this,t,e)}reset(){return lt.reset(this),this}}const ft=new gt;class yt{constructor(t,e,i,s,n,r){this.set(t,e,i,s,n,r)}set(t,e,i,s,n,r){return p(t)?Q.copy(this,t):Q.set(this,t,e,i,s,n,r),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:n,f:r}=this;return{a:t,b:e,c:i,d:s,e:n,f:r}}clone(){return new yt(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(){return Q.reset(this),this}}const mt=new yt,vt={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,n){wt(t,e,i),wt(t,e+s,i+n)},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:wt}=vt;var xt,bt;t.Direction4=void 0,(xt=t.Direction4||(t.Direction4={}))[xt.top=0]="top",xt[xt.right=1]="right",xt[xt.bottom=2]="bottom",xt[xt.left=3]="left",t.Direction9=void 0,(bt=t.Direction9||(t.Direction9={}))[bt.topLeft=0]="topLeft",bt[bt.top=1]="top",bt[bt.topRight=2]="topRight",bt[bt.right=3]="right",bt[bt.bottomRight=4]="bottomRight",bt[bt.bottom=5]="bottom",bt[bt.bottomLeft=6]="bottomLeft",bt[bt.left=7]="left",bt[bt.center=8]="center",bt[bt["top-left"]=0]="top-left",bt[bt["top-right"]=2]="top-right",bt[bt["bottom-right"]=4]="bottom-right",bt[bt["bottom-left"]=6]="bottom-left";const Et=[{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}];Et.forEach(t=>t.type="percent");const Pt={directionData:Et,tempPoint:{},get:St,toPoint(t,e,i,s,n,r){const o=St(t);i.x=o.x,i.y=o.y,"percent"===o.type&&(i.x*=e.width,i.y*=e.height,n&&(r||(i.x-=n.x,i.y-=n.y),o.x&&(i.x-=1===o.x?n.width:.5===o.x?o.x*n.width:0),o.y&&(i.y-=1===o.y?n.height:.5===o.y?o.y*n.height:0))),s||(i.x+=e.x,i.y+=e.y)},getPoint:(t,e,i,s=!0)=>(i||(i={}),Pt.toPoint(t,e,i,s),i)};function St(e){return h(e)?Et[t.Direction9[e]]:e}const{toPoint:kt}=Pt,Bt={toPoint(t,e,i,s,n,r){kt(t,i,s,n,e,r)}},{tempPointBounds:Tt,setPoint:Ct,addPoint:Rt,toBounds:Lt}=vt,{toOuterPoint:Dt}=Q,{float:At,fourNumber:Ot}=M,{floor:It,ceil:Mt}=Math;let Ft,Wt,Ut,Nt;const zt={},Yt={},Xt={},Ht={tempBounds:Xt,set(t,e=0,i=0,s=0,n=0){t.x=e,t.y=i,t.width=s,t.height=n},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,i,s,n){const{x:r,y:o,width:a,height:h}=e;if(u(i)){const e=Ot(i);s?jt.set(t,r+e[3],o+e[0],a-e[1]-e[3],h-e[2]-e[0]):jt.set(t,r-e[3],o-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),jt.set(t,r-i,o-i,a+2*i,h+2*i);n&&("width"===n?(t.y=o,t.height=h):(t.x=r,t.width=a))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,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),jt.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?Gt(e,t):e=t,i||(i=t),e.offsetX=jt.maxX(i),e.offsetY=jt.maxY(i),jt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||lt.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){lt.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(jt.copy(Xt,t),jt.toOuterOf(Xt,e),Xt),getOuterOf:(t,e)=>(t=Object.assign({},t),jt.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:n,e:r,f:o}=e;s>0?(i.width=t.width*s,i.x=r+t.x*s):(i.width=t.width*-s,i.x=r+t.x*s-i.width),n>0?(i.height=t.height*n,i.y=o+t.y*n):(i.height=t.height*-n,i.y=o+t.y*n-i.height)}else zt.x=t.x,zt.y=t.y,Dt(e,zt,Yt),Ct(Tt,Yt.x,Yt.y),zt.x=t.x+t.width,Dt(e,zt,Yt),Rt(Tt,Yt.x,Yt.y),zt.y=t.y+t.height,Dt(e,zt,Yt),Rt(Tt,Yt.x,Yt.y),zt.x=t.x,Dt(e,zt,Yt),Rt(Tt,Yt.x,Yt.y),Lt(Tt,i)},toInnerOf(t,e,i){i||(i=t),jt.move(i,-e.e,-e.f),jt.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,jt.getFitScale(t,e));return new yt(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,n=t.height/e.height;return i?Math.max(s,n):Math.min(s,n)},put(t,e,i="center",s=1,n=!0,r){r||(r=e),h(s)&&(s=jt.getFitScale(t,e,"cover"===s)),Xt.width=n?e.width*=s:e.width*s,Xt.height=n?e.height*=s:e.height*s,Bt.toPoint(i,Xt,t,r,!0,!0)},getSpread(t,e,i){const s={};return jt.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){jt.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){jt.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?Mt(t.width+e-t.x):Mt(t.width),t.height=i>t.y?Mt(t.height+i-t.y):Mt(t.height)},unsign(t){t.width<0&&(t.x+=t.width,t.width=-t.width),t.height<0&&(t.y+=t.height,t.height=-t.height)},float(t,e){t.x=At(t.x,e),t.y=At(t.y,e),t.width=At(t.width,e),t.height=At(t.height,e)},add(t,e,i){Ft=t.x+t.width,Wt=t.y+t.height,Ut=e.x,Nt=e.y,i||(Ut+=e.width,Nt+=e.height),Ft=Ft>Ut?Ft:Ut,Wt=Wt>Nt?Wt:Nt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=Ft-t.x,t.height=Wt-t.y},addList(t,e){jt.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){jt.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){jt.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let n,r=!0;for(let o=0,a=e.length;o<a;o++)n=i?i(e[o],o):e[o],n&&(n.width||n.height)&&(r?(r=!1,s||Gt(t,n)):Vt(t,n));r&&jt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Ct(Tt,t.x,t.y):Rt(Tt,t.x,t.y)),Lt(Tt,t)},setPoint(t,e){jt.set(t,e.x,e.y)},addPoint(t,e){Vt(t,e,!0)},getPoints(t){const{x:e,y:i,width:s,height:n}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+n},{x:e,y:i+n}]},getPoint:(t,e,i=!1,s)=>Pt.getPoint(e,t,s,i),hitRadiusPoint:(t,e,i)=>(i&&(e=lt.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=lt.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=jt.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=jt.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=jt.tempToOuterOf(e,i)),!jt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:n,width:r,height:o}=e;return Ft=s+r,Wt=n+o,Ut=t.x+t.width,Nt=t.y+t.height,s=s>t.x?s:t.x,n=n>t.y?n:t.y,Ft=Ft<Ut?Ft:Ut,Wt=Wt<Nt?Wt:Nt,r=Ft-s,o=Wt-n,{x:s,y:n,width:r,height:o}},intersect(t,e,i){jt.copy(t,jt.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,hasSize:t=>t.width&&t.height,reset(t){jt.set(t)}},jt=Ht,{add:Vt,copy:Gt}=jt;class qt{get minX(){return Ht.minX(this)}get minY(){return Ht.minY(this)}get maxX(){return Ht.maxX(this)}get maxY(){return Ht.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return p(t)?Ht.copy(this,t):Ht.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 qt(this)}move(t,e){return Ht.move(this,t,e),this}scale(t,e,i){return Ht.scale(this,t,e,i),this}scaleOf(t,e,i){return Ht.scaleOf(this,t,e,i),this}toOuterOf(t,e){return Ht.toOuterOf(this,t,e),this}toInnerOf(t,e){return Ht.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Ht.getFitMatrix(this,t,e)}put(t,e,i){Ht.put(this,t,e,i)}spread(t,e){return Ht.spread(this,t,e),this}shrink(t,e){return Ht.shrink(this,t,e),this}ceil(){return Ht.ceil(this),this}unsign(){return Ht.unsign(this),this}float(t){return Ht.float(this,t),this}add(t){return Ht.add(this,t),this}addList(t){return Ht.setList(this,t,!0),this}setList(t){return Ht.setList(this,t),this}addListWithFn(t,e){return Ht.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Ht.setListWithFn(this,t,e),this}setPoint(t){return Ht.setPoint(this,t),this}setPoints(t){return Ht.setPoints(this,t),this}addPoint(t){return Ht.addPoint(this,t),this}getPoints(){return Ht.getPoints(this)}getPoint(t,e,i){return Ht.getPoint(this,t,e,i)}hitPoint(t,e){return Ht.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Ht.hitRadiusPoint(this,t,e)}hit(t,e){return Ht.hit(this,t,e)}includes(t,e){return Ht.includes(this,t,e)}intersect(t,e){return Ht.intersect(this,t,e),this}getIntersect(t,e){return new qt(Ht.getIntersectData(this,t,e))}isSame(t){return Ht.isSame(this,t)}isEmpty(){return Ht.isEmpty(this)}reset(){Ht.reset(this)}}const Kt=new qt;class Zt{constructor(t,e,i,s,n,r){p(t)?this.copy(t):this.set(t,e,i,s,n,r)}set(t=0,e=0,i=0,s=0,n=0,r=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=n,this.height=r}copy(t){const{top:e,right:i,bottom:s,left:n,width:r,height:o}=t;this.set(e,i,s,n,r,o)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:n,width:r,height:o}=this;return new qt(n,e,r||t.width-n-i,o||t.height-e-s)}}const Qt={number:(t,e)=>p(t)?"percent"===t.type?t.value*e:t.value:t},$t={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},{floor:Jt,max:te}=Math,ee={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||ie.maxCacheSize),isSuperLarge:(t,e,i)=>ie.isLarge(t,e,i,ie.maxPatternSize),getRealURL(t){const{prefix:e,suffix:i}=ie;return!i||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+i),e&&"/"===t[0]&&(t=e+t),t},resize(t,e,i,s,n,r,o,a,h,l){const d=te(Jt(e+(s||0)),1),c=te(Jt(i+(n||0)),1);let u,p,_;l&&(_=Qt.number(l.offset,"x"===l.type?e:i))&&("x"===l.type?u=!0:p=!0);const g=ee.origin.createCanvas(p?2*d:d,u?2*c:c),f=g.getContext("2d");if(a&&(f.globalAlpha=a),f.imageSmoothingEnabled=!1!==o,ie.canUse(t)){if(r){const s=e/r.width,n=i/r.height;f.setTransform(s,0,0,n,-r.x*s,-r.y*n),f.drawImage(t,0,0,t.width,t.height)}else f.drawImage(t,0,0,e,i);_&&(f.drawImage(g,0,0,d,c,u?_-d:d,u?c:_-c,d,c),f.drawImage(g,0,0,d,c,u?_:d,u?c:_,d,c))}return g},canUse:t=>t&&t.width&&!t.__closed,setPatternTransform(t,e,i){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}i&&g.stintSet(i,"transform",e)}}},{image:ie}=ee,{randColor:se}=M;class ne{constructor(t){this.repeatMap={},this.name=t}static get(t){return new ne(t)}static set filter(t){this.filterList=re(t)}static set exclude(t){this.excludeList=re(t)}static drawRepaint(t,e){const i=se();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===ne.showBounds,n=t.__nowWorld,r=se();s&&(e.setWorld(n),t.__drawHitPath(e),e.fillStyle=r.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(r,2),s?e.stroke():e.strokeWorld(n,r)}log(...t){if(oe.enable){if(oe.filterList.length&&oe.filterList.every(t=>t!==this.name))return;if(oe.excludeList.length&&oe.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){oe.enable&&this.warn(...t)}warn(...t){oe.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 re(t){return t?h(t)&&(t=[t]):t=[],t}ne.filterList=[],ne.excludeList=[],ne.showWarn=!0;const oe=ne,ae=ne.get("RunTime"),he={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=m.create(m.RUNTIME);return le.currentId=le.idMap[i]=e?performance.now():Date.now(),le.currentName=le.nameMap[i]=t,le.nameToIdMap[t]=i,i},end(t,e){const i=le.idMap[t],s=le.nameMap[t],n=e?(performance.now()-i)/1e3:Date.now()-i;le.idMap[t]=le.nameMap[t]=le.nameToIdMap[s]=void 0,ae.log(s,n,"ms")},endOfName(t,e){const i=le.nameToIdMap[t];o(i)||le.end(i,e)}},le=he,de=[],ce={list:{},add(t,...e){this.list[t]=!0,de.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(()=>de.forEach(t=>ce.has(t,!0)));const ue={editor:t=>ce.need("editor")},pe=ne.get("UICreator"),_e={list:{},register(t){const{__tag:e}=t.prototype;ge[e]&&pe.repeat(e),ge[e]=t},get(t,e,i,s,n,r){if(!ge[t])return void pe.warn("not register "+t);const a=new ge[t](e);return o(i)||(a.x=i,s&&(a.y=s),n&&(a.width=n),r&&(a.height=r)),a}},{list:ge}=_e,fe=ne.get("EventCreator"),ye={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],h(e)&&(me[e]&&fe.repeat(e),me[e]=t)})},changeName(t,e){const i=me[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,me[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new me[t](...e)},{nameList:me}=ye;class ve{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:i}=this;for(let s=0,n=i.length;s<n;s++)if(e=i[s],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const s=ue.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 we(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)}}const xe=[];function be(){return(t,e)=>{xe.push(e)}}const Ee=[];class Pe{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||Ee)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;xe.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,i,s,n,r){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,n,r){p(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,i,s,n,r)}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,n,r,o,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*a;s+=e,e=0,r+=t,a-=t}if(i<0){const t=-i/n*h;n+=i,i=0,o+=t,h-=t}this.context.drawImage(t,e,i,s,n,r,o,a,h);break;case 5:this.context.drawImage(t,e,i,s,n);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,n,r){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,n,r){}arcTo(t,e,i,s,n){}ellipse(t,e,i,s,n,r,o,a){}rect(t,e,i,s){}roundRect(t,e,i,s,n){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,n,r){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}}s([we("imageSmoothingEnabled")],Pe.prototype,"smooth",void 0),s([we("imageSmoothingQuality")],Pe.prototype,"smoothLevel",void 0),s([we("globalAlpha")],Pe.prototype,"opacity",void 0),s([we()],Pe.prototype,"fillStyle",void 0),s([we()],Pe.prototype,"strokeStyle",void 0),s([we("lineWidth")],Pe.prototype,"strokeWidth",void 0),s([we("lineCap")],Pe.prototype,"strokeCap",void 0),s([we("lineJoin")],Pe.prototype,"strokeJoin",void 0),s([we("lineDashOffset")],Pe.prototype,"dashOffset",void 0),s([we()],Pe.prototype,"miterLimit",void 0),s([we()],Pe.prototype,"shadowBlur",void 0),s([we()],Pe.prototype,"shadowColor",void 0),s([we()],Pe.prototype,"shadowOffsetX",void 0),s([we()],Pe.prototype,"shadowOffsetY",void 0),s([we()],Pe.prototype,"filter",void 0),s([we()],Pe.prototype,"font",void 0),s([we()],Pe.prototype,"fontKerning",void 0),s([we()],Pe.prototype,"fontStretch",void 0),s([we()],Pe.prototype,"fontVariantCaps",void 0),s([we()],Pe.prototype,"textAlign",void 0),s([we()],Pe.prototype,"textBaseline",void 0),s([we()],Pe.prototype,"textRendering",void 0),s([we()],Pe.prototype,"wordSpacing",void 0),s([we()],Pe.prototype,"letterSpacing",void 0),s([we()],Pe.prototype,"direction",void 0),s([be()],Pe.prototype,"setTransform",null),s([be()],Pe.prototype,"resetTransform",null),s([be()],Pe.prototype,"getTransform",null),s([be()],Pe.prototype,"save",null),s([be()],Pe.prototype,"restore",null),s([be()],Pe.prototype,"translate",null),s([be()],Pe.prototype,"scale",null),s([be()],Pe.prototype,"rotate",null),s([be()],Pe.prototype,"fill",null),s([be()],Pe.prototype,"stroke",null),s([be()],Pe.prototype,"clip",null),s([be()],Pe.prototype,"fillRect",null),s([be()],Pe.prototype,"strokeRect",null),s([be()],Pe.prototype,"clearRect",null),s([be()],Pe.prototype,"beginPath",null),s([be()],Pe.prototype,"moveTo",null),s([be()],Pe.prototype,"lineTo",null),s([be()],Pe.prototype,"bezierCurveTo",null),s([be()],Pe.prototype,"quadraticCurveTo",null),s([be()],Pe.prototype,"closePath",null),s([be()],Pe.prototype,"arc",null),s([be()],Pe.prototype,"arcTo",null),s([be()],Pe.prototype,"ellipse",null),s([be()],Pe.prototype,"rect",null),s([be()],Pe.prototype,"roundRect",null),s([be()],Pe.prototype,"createConicGradient",null),s([be()],Pe.prototype,"createLinearGradient",null),s([be()],Pe.prototype,"createPattern",null),s([be()],Pe.prototype,"createRadialGradient",null),s([be()],Pe.prototype,"fillText",null),s([be()],Pe.prototype,"measureText",null),s([be()],Pe.prototype,"strokeText",null);const{copy:Se,multiplyParent:ke,pixelScale:Be}=Q,{round:Te}=Math,Ce=new qt,Re=new qt,Le={width:1,height:1,pixelRatio:1},De=["width","height","pixelRatio"];class Ae extends Pe{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=Le),this.manager=e,this.innerId=m.create(m.CANVAS);const{width:i,height:s,pixelRatio:n}=t;this.autoLayout=!i||!s,this.size.pixelRatio=n||ee.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;g.copyAttrs(s,t,De),De.forEach(t=>s[t]||(s[t]=1)),this.bounds=new qt(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,n=this.worldTransform;e&&ke(t,e,n),Be(t,i,n),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(n.e=Te(n.e-.5)+.5,n.f=Te(n.f-.5)+.5):(n.e=Te(n.e),n.f=Te(n.f))),this.setTransform(n.a,n.b,n.c,n.d,n.e,n.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:s,dashPattern:n,dashOffset:r,miterLimit:a}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(s=e.strokeJoin),o(e.dashPattern)||(n=e.dashPattern),o(e.dashOffset)||(r=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=i,this.strokeJoin=s,this.dashPattern=n,this.dashOffset=r,this.miterLimit=a}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return!0}hitStroke(t,e){return!0}hitPixel(t,e,i=1){return!0}setWorldShadow(t,e,i,s){const{pixelRatio:n}=this;this.shadowOffsetX=t*n,this.shadowOffsetY=e*n,this.shadowBlur=i*n,this.shadowColor=s||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,i,s,n){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,n),i?(this.setTempPixelBounds2(i,n),i=Re):i=Ce,this.drawImage(t.view,Ce.x,Ce.y,Ce.width,Ce.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,n){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Ht.tempToOuterOf(i,e),s,n),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,n),this.drawImage(t.view,Ce.x,Ce.y,Ce.width,Ce.height,i.x,i.y,i.width,i.height),s&&(this.blendMode="source-over"))}copyWorldByReset(t,e,i,s,n,r){this.resetTransform(),this.copyWorld(t,e,i,s,r),n||this.useWorldTransform()}useGrayscaleAlpha(t){if(this.setTempPixelBounds(t,!0,!0),!Ce.width||!Ce.height)return;let e,i;const{context:s}=this,n=s.getImageData(Ce.x,Ce.y,Ce.width,Ce.height),{data:r}=n;for(let t=0,s=r.length;t<s;t+=4)i=.299*r[t]+.587*r[t+1]+.114*r[t+2],(e=r[t+3])&&(r[t+3]=255===e?i:e*(i/255));s.putImageData(n,Ce.x,Ce.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(Ce.x,Ce.y,Ce.width,Ce.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(Ce.x,Ce.y,Ce.width,Ce.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(Ce.x,Ce.y,Ce.width,Ce.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(Ce.x,Ce.y,Ce.width,Ce.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(Ce,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(Re,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,n=this.manager?this.manager.get(i):ue.canvas(Object.assign({},i));return n.save(),t&&(Se(n.worldTransform,this.worldTransform),n.useWorldTransform()),e&&(n.smooth=this.smooth),n.pixelSnap!==s&&(n.pixelSnap=s),n}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 Oe={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Ie={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Me=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},Ie),Fe={M:3,m:3,L:3,l:3,H:2,h:2,V:2,v:2,C:7,c:7,S:5,s:5,Q:5,q:5,T:3,t:3,A:8,a:8,Z:1,z:1,N:5,D:9,X:6,G:9,F:5,O:7,P:4,U:6},We={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},Ue=Object.assign(Object.assign({},We),Ie),Ne=Me,ze={};for(let t in Ne)ze[Ne[t]]=t;const Ye={};for(let t in Ne)Ye[Ne[t]]=Fe[t];const Xe={drawRoundRect(t,e,i,s,n,r){const o=M.fourNumber(r,Math.min(s/2,n/2)),a=e+s,h=i+n;o[0]?t.moveTo(e+o[0],i):t.moveTo(e,i),o[1]?t.arcTo(a,i,a,h,o[1]):t.lineTo(a,i),o[2]?t.arcTo(a,h,e,h,o[2]):t.lineTo(a,h),o[3]?t.arcTo(e,h,e,i,o[3]):t.lineTo(e,h),o[0]?t.arcTo(e,i,a,i,o[0]):t.lineTo(e,i)}},{sin:He,cos:je,hypot:Ve,atan2:Ge,ceil:qe,abs:Ke,PI:Ze,sqrt:Qe,pow:$e}=Math,{setPoint:Je,addPoint:ti}=vt,{set:ei,toNumberPoints:ii}=lt,{M:si,L:ni,C:ri,Q:oi,Z:ai}=Me,hi={},li={points(t,e,i,s){let n=ii(e);if(t.push(si,n[0],n[1]),i&&n.length>5){let e,r,o,a,h,l,d,c,u,p,_,g,f,y,m,v=n.length;const w=!0===i?.5:i;s&&(n=[n[v-2],n[v-1],...n,n[0],n[1],n[2],n[3]],v=n.length);for(let i=2;i<v-2;i+=2)e=n[i-2],r=n[i-1],o=n[i],a=n[i+1],h=n[i+2],l=n[i+3],_=o-e,g=a-r,f=Qe($e(_,2)+$e(g,2)),y=Qe($e(h-o,2)+$e(l-a,2)),(f||y)&&(m=f+y,f=w*f/m,y=w*y/m,h-=e,l-=r,d=o-f*h,c=a-f*l,2===i?s||t.push(oi,d,c,o,a):(_||g)&&t.push(ri,u,p,d,c,o,a),u=o+y*h,p=a+y*l);s||t.push(oi,u,p,n[v-2],n[v-1])}else for(let e=2,i=n.length;e<i;e+=2)t.push(ni,n[e],n[e+1]);s&&t.push(ai)},rect(t,e,i,s,n){Oe.creator.path=t,Oe.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+n).lineTo(e,i+n).lineTo(e,i)},roundRect(t,e,i,s,n,r){Oe.creator.path=[],Xe.drawRoundRect(Oe.creator,e,i,s,n,r),t.push(...Oe.convertToCanvasData(Oe.creator.path,!0))},arcTo(t,e,i,s,n,r,o,a,h,l,d){const c=s-e,u=n-i,p=r-s,_=o-n;let g=Ge(u,c),f=Ge(_,p);const y=Ve(c,u),m=Ve(p,_);let v=f-g;if(v<0&&(v+=U),y<1e-12||m<1e-12||v<1e-12||Ke(v-Ze)<1e-12)return t&&t.push(ni,s,n),h&&(Je(h,e,i),ti(h,s,n)),d&&ei(d,e,i),void(l&&ei(l,s,n));const w=c*_-p*u<0,x=w?-1:1,b=a/je(v/2),E=s+b*je(g+v/2+N*x),P=n+b*He(g+v/2+N*x);return g-=N*x,f-=N*x,ui(t,E,P,a,a,0,g/W,f/W,w,h,l,d)},arc:(t,e,i,s,n,r,o,a,h,l)=>ui(t,e,i,s,s,0,n,r,o,a,h,l),ellipse(t,e,i,s,n,r,o,a,h,l,d,c){const u=r*W,p=He(u),_=je(u);let g=o*W,f=a*W;g>Ze&&(g-=U),f<0&&(f+=U);let y=f-g;if(y<0?y+=U:y>U&&(y-=U),h){360===Ke(a-o)?y=-U:y-=U}const m=qe(Ke(y/N)),v=y/m,w=He(v/4),x=8/3*w*w/He(v/2);f=g+v;let b,E,P,S,k,B,T,C,R=je(g),L=He(g),D=P=_*s*R-p*n*L,A=S=p*s*R+_*n*L,O=e+P,I=i+S;t&&t.push(t.length?ni:si,O,I),l&&Je(l,O,I),c&&ei(c,O,I);for(let r=0;r<m;r++)b=je(f),E=He(f),P=_*s*b-p*n*E,S=p*s*b+_*n*E,k=e+D-x*(_*s*L+p*n*R),B=i+A-x*(p*s*L-_*n*R),T=e+P+x*(_*s*E+p*n*b),C=i+S+x*(p*s*E-_*n*b),t&&t.push(ri,k,B,T,C,e+P,i+S),l&&ci(e+D,i+A,k,B,T,C,e+P,i+S,l,!0),D=P,A=S,R=b,L=E,g=f,f+=v;d&&ei(d,e+P,i+S)},quadraticCurveTo(t,e,i,s,n,r,o){t.push(ri,(e+2*s)/3,(i+2*n)/3,(r+2*s)/3,(o+2*n)/3,r,o)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,n,r,o,a){ci(t,e,(t+2*i)/3,(e+2*s)/3,(n+2*i)/3,(r+2*s)/3,n,r,o,a)},toTwoPointBounds(t,e,i,s,n,r,o,a,h,l){const d=[];let c,u,p,_,g,f,y,m,v=t,w=i,x=n,b=o;for(let t=0;t<2;++t)if(1==t&&(v=e,w=s,x=r,b=a),c=-3*v+9*w-9*x+3*b,u=6*v-12*w+6*x,p=3*w-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;_=-p/u,0<_&&_<1&&d.push(_)}else y=u*u-4*p*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?ti(h,t,e):Je(h,t,e),ti(h,o,a);for(let l=0,c=d.length;l<c;l++)di(d[l],t,e,i,s,n,r,o,a,hi),ti(h,hi.x,hi.y)},getPointAndSet(t,e,i,s,n,r,o,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,p=3*d*t*t,_=t*t*t;l.x=c*e+u*s+p*r+_*a,l.y=c*i+u*n+p*o+_*h},getPoint(t,e,i,s,n,r,o,a,h){const l={};return di(t,e,i,s,n,r,o,a,h,l),l},getDerivative(t,e,i,s,n){const r=1-t;return 3*r*r*(i-e)+6*r*t*(s-i)+3*t*t*(n-s)},cut(t,e,i,s,n,r,o,a,h){if(t<=0)return{left:null,right:[s,n,r,o,a,h]};if(t>=1)return{left:[s,n,r,o,a,h],right:null};const l=1-t,d=e*l+s*t,c=i*l+n*t,u=s*l+r*t,p=n*l+o*t,_=r*l+a*t,g=o*l+h*t,f=d*l+u*t,y=c*l+p*t,m=u*l+_*t,v=p*l+g*t;return{left:[d,c,f,y,f*l+m*t,y*l+v*t],right:[m,v,_,g,a,h]}}},{getPointAndSet:di,toTwoPointBounds:ci,ellipse:ui}=li,{sin:pi,cos:_i,sqrt:gi,atan2:fi}=Math,{ellipse:yi}=li,mi={ellipticalArc(t,e,i,s,n,r,o,a,h,l,d){const c=(h-e)/2,u=(l-i)/2,p=r*W,_=pi(p),g=_i(p),f=-g*c-_*u,y=-g*u+_*c,m=s*s,v=n*n,w=y*y,x=f*f,b=m*v-m*w-v*x;let E=0;if(b<0){const t=gi(1-b/(m*v));s*=t,n*=t}else E=(o===a?-1:1)*gi(b/(m*w+v*x));const P=E*s*y/n,S=-E*n*f/s,k=fi((y-S)/n,(f-P)/s),B=fi((-y-S)/n,(-f-P)/s);let T=B-k;0===a&&T>0?T-=U:1===a&&T<0&&(T+=U);const C=e+c+g*P-_*S,R=i+u+_*P+g*S,L=T<0?1:0;d||ee.ellipseToCurve?yi(t,C,R,s,n,r,k/W,B/W,L):s!==n||r?t.push(Me.G,C,R,s,n,r,k/W,B/W,L):t.push(Me.O,C,R,s,k/W,B/W,L)}},vi={toCommand:t=>[],toNode:t=>[]},{M:wi,m:xi,L:bi,l:Ei,H:Pi,h:Si,V:ki,v:Bi,C:Ti,c:Ci,S:Ri,s:Li,Q:Di,q:Ai,T:Oi,t:Ii,A:Mi,a:Fi,Z:Wi,z:Ui,N:Ni,D:zi,X:Yi,G:Xi,F:Hi,O:ji,P:Vi,U:Gi}=Me,{rect:qi,roundRect:Ki,arcTo:Zi,arc:Qi,ellipse:$i,quadraticCurveTo:Ji}=li,{ellipticalArc:ts}=mi,es=ne.get("PathConvert"),is={},ss={current:{dot:0},stringify(t,e){let i,s,n,r=0,o=t.length,a="";for(;r<o;){s=t[r],i=Ye[s],a+=s===n?" ":ze[s];for(let s=1;s<i;s++)a+=M.float(t[r+s],e),s===i-1||(a+=" ");n=s,r+=i}return a},parse(t,e){let i,s,n,r="";const o=[],a=e?Ue:We;for(let e=0,h=t.length;e<h;e++)s=t[e],$t[s]?("."===s&&(ns.dot&&(rs(o,r),r=""),ns.dot++),"0"===r&&"."!==s&&(rs(o,r),r=""),r+=s):Me[s]?(r&&(rs(o,r),r=""),ns.name=Me[s],ns.length=Fe[s],ns.index=0,rs(o,ns.name),"m"===s?ns.name=Me.l:"M"===s&&(ns.name=Me.L),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===n||"E"===n?r+=s:(r&&rs(o,r),r=s):r&&(rs(o,r),r=""),n=s;return r&&rs(o,r),i?ss.toCanvasData(o,e):o},toCanvasData(t,e){let i,s,n,r,o,a=0,h=0,l=0,d=0,c=0,u=0,p=0,_=t.length;const g=[];for(;p<_;){switch(n=t[p],n){case xi:t[p+1]+=a,t[p+2]+=h;case wi:a=c=t[p+1],h=u=t[p+2],g.push(wi,a,h),p+=3;break;case Si:t[p+1]+=a;case Pi:a=t[p+1],g.push(bi,a,h),p+=2;break;case Bi:t[p+1]+=h;case ki:h=t[p+1],g.push(bi,a,h),p+=2;break;case Ei:t[p+1]+=a,t[p+2]+=h;case bi:a=t[p+1],h=t[p+2],g.push(bi,a,h),p+=3;break;case Li:t[p+1]+=a,t[p+2]+=h,t[p+3]+=a,t[p+4]+=h,n=Ri;case Ri:o=r===Ti||r===Ri,l=o?2*a-i:a,d=o?2*h-s:h,i=t[p+1],s=t[p+2],a=t[p+3],h=t[p+4],g.push(Ti,l,d,i,s,a,h),p+=5;break;case Ci:t[p+1]+=a,t[p+2]+=h,t[p+3]+=a,t[p+4]+=h,t[p+5]+=a,t[p+6]+=h,n=Ti;case Ti:i=t[p+3],s=t[p+4],a=t[p+5],h=t[p+6],g.push(Ti,t[p+1],t[p+2],i,s,a,h),p+=7;break;case Ii:t[p+1]+=a,t[p+2]+=h,n=Oi;case Oi:o=r===Di||r===Oi,i=o?2*a-i:a,s=o?2*h-s:h,e?Ji(g,a,h,i,s,t[p+1],t[p+2]):g.push(Di,i,s,t[p+1],t[p+2]),a=t[p+1],h=t[p+2],p+=3;break;case Ai:t[p+1]+=a,t[p+2]+=h,t[p+3]+=a,t[p+4]+=h,n=Di;case Di:i=t[p+1],s=t[p+2],e?Ji(g,a,h,i,s,t[p+3],t[p+4]):g.push(Di,i,s,t[p+3],t[p+4]),a=t[p+3],h=t[p+4],p+=5;break;case Fi:t[p+6]+=a,t[p+7]+=h;case Mi:ts(g,a,h,t[p+1],t[p+2],t[p+3],t[p+4],t[p+5],t[p+6],t[p+7],e),a=t[p+6],h=t[p+7],p+=8;break;case Ui:case Wi:g.push(Wi),a=c,h=u,p++;break;case Ni:a=t[p+1],h=t[p+2],e?qi(g,a,h,t[p+3],t[p+4]):os(g,t,p,5),p+=5;break;case zi:a=t[p+1],h=t[p+2],e?Ki(g,a,h,t[p+3],t[p+4],[t[p+5],t[p+6],t[p+7],t[p+8]]):os(g,t,p,9),p+=9;break;case Yi:a=t[p+1],h=t[p+2],e?Ki(g,a,h,t[p+3],t[p+4],t[p+5]):os(g,t,p,6),p+=6;break;case Xi:$i(e?g:os(g,t,p,9),t[p+1],t[p+2],t[p+3],t[p+4],t[p+5],t[p+6],t[p+7],t[p+8],null,is),a=is.x,h=is.y,p+=9;break;case Hi:e?$i(g,t[p+1],t[p+2],t[p+3],t[p+4],0,0,360,!1):os(g,t,p,5),a=t[p+1]+t[p+3],h=t[p+2],p+=5;break;case ji:Qi(e?g:os(g,t,p,7),t[p+1],t[p+2],t[p+3],t[p+4],t[p+5],t[p+6],null,is),a=is.x,h=is.y,p+=7;break;case Vi:e?Qi(g,t[p+1],t[p+2],t[p+3],0,360,!1):os(g,t,p,4),a=t[p+1]+t[p+3],h=t[p+2],p+=4;break;case Gi:Zi(e?g:os(g,t,p,6),a,h,t[p+1],t[p+2],t[p+3],t[p+4],t[p+5],null,is),a=is.x,h=is.y,p+=6;break;default:return es.error(`command: ${n} [index:${p}]`,t),g}r=n}return g},objectToCanvasData(t){if(t[0].name.length>1)return vi.toCommand(t);{const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(wi,t.x,t.y);break;case"L":e.push(bi,t.x,t.y);break;case"C":e.push(Ti,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Di,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Wi)}}),e}},copyData(t,e,i,s){for(let n=i,r=i+s;n<r;n++)t.push(e[n])},pushData(t,e){ns.index===ns.length&&(ns.index=1,t.push(ns.name)),t.push(Number(e)),ns.index++,ns.dot=0}},{current:ns,pushData:rs,copyData:os}=ss,{M:as,L:hs,C:ls,Q:ds,Z:cs,N:us,D:ps,X:_s,G:gs,F:fs,O:ys,P:ms,U:vs}=Me,{getMinDistanceFrom:ws,getRadianFrom:xs}=lt,{tan:bs,min:Es,abs:Ps}=Math,Ss={},ks=ne.get("PointsCurve"),Bs={pointsCurveList:{},beginPath(t){t.length=0},moveTo(t,e,i){t.push(as,e,i)},lineTo(t,e,i){t.push(hs,e,i)},bezierCurveTo(t,e,i,s,n,r,o){t.push(ls,e,i,s,n,r,o)},quadraticCurveTo(t,e,i,s,n){t.push(ds,e,i,s,n)},closePath(t){t.push(cs)},rect(t,e,i,s,n){t.push(us,e,i,s,n)},roundRect(t,e,i,s,n,r){if(d(r))t.push(_s,e,i,s,n,r);else{const o=M.fourNumber(r);o?t.push(ps,e,i,s,n,...o):t.push(us,e,i,s,n)}},ellipse(t,e,i,s,n,r,o,h,l){if(s===n)return Cs(t,e,i,s,o,h,l);a(r)?t.push(fs,e,i,s,n):(a(o)&&(o=0),a(h)&&(h=360),t.push(gs,e,i,s,n,r,o,h,l?1:0))},arc(t,e,i,s,n,r,o){a(n)?t.push(ms,e,i,s):(a(n)&&(n=0),a(r)&&(r=360),t.push(ys,e,i,s,n,r,o?1:0))},arcTo(t,e,i,s,n,r,a,h,l){if(!o(a)){const t=ws(a,h,e,i,s,n)/(l?1:2);r=Es(r,Es(t,t*Ps(bs(xs(a,h,e,i,s,n)/2))))}t.push(vs,e,i,s,n,r)},drawEllipse(t,e,i,s,n,r,o,h,l){li.ellipse(null,e,i,s,n,a(r)?0:r,a(o)?0:o,a(h)?360:h,l,null,null,Ss),t.push(as,Ss.x,Ss.y),Ts(t,e,i,s,n,r,o,h,l)},drawArc(t,e,i,s,n,r,o){li.arc(null,e,i,s,a(n)?0:n,a(r)?360:r,o,null,null,Ss),t.push(as,Ss.x,Ss.y),Cs(t,e,i,s,n,r,o)},drawPoints(t,e,i,s,n){let r="Q";p(i)&&(r=i.type,i=i.value),Rs[r]||(ks.warn("not found:",r),r="Q"),Rs[r](t,e,i,s,n)}},{ellipse:Ts,arc:Cs,pointsCurveList:Rs}=Bs;function Ls(t,e){Rs[t]&&ks.repeat(t),Rs[t]=e}Ls("Q",li.points);const{moveTo:Ds,lineTo:As,quadraticCurveTo:Os,bezierCurveTo:Is,closePath:Ms,beginPath:Fs,rect:Ws,roundRect:Us,ellipse:Ns,arc:zs,arcTo:Ys,drawEllipse:Xs,drawArc:Hs,drawPoints:js}=Bs;class Vs{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?h(t)?Oe.parse(t):t:[],this}beginPath(){return Fs(this.__path),this.paint(),this}moveTo(t,e){return Ds(this.__path,t,e),this.paint(),this}lineTo(t,e){return As(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,n,r){return Is(this.__path,t,e,i,s,n,r),this.paint(),this}quadraticCurveTo(t,e,i,s){return Os(this.__path,t,e,i,s),this.paint(),this}closePath(){return Ms(this.__path),this.paint(),this}rect(t,e,i,s){return Ws(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,n){return Us(this.__path,t,e,i,s,n),this.paint(),this}ellipse(t,e,i,s,n,r,o,a){return Ns(this.__path,t,e,i,s,n,r,o,a),this.paint(),this}arc(t,e,i,s,n,r){return zs(this.__path,t,e,i,s,n,r),this.paint(),this}arcTo(t,e,i,s,n){return Ys(this.__path,t,e,i,s,n),this.paint(),this}drawEllipse(t,e,i,s,n,r,o,a){return Xs(this.__path,t,e,i,s,n,r,o,a),this.paint(),this}drawArc(t,e,i,s,n,r){return Hs(this.__path,t,e,i,s,n,r),this.paint(),this}drawPoints(t,e,i){return js(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Gs,L:qs,C:Ks,Q:Zs,Z:Qs,N:$s,D:Js,X:tn,G:en,F:sn,O:nn,P:rn,U:on}=Me,an=ne.get("PathDrawer"),hn={drawPathByData(t,e){if(!e)return;let i,s=0,n=e.length;for(;s<n;)switch(i=e[s],i){case Gs:t.moveTo(e[s+1],e[s+2]),s+=3;break;case qs:t.lineTo(e[s+1],e[s+2]),s+=3;break;case Ks: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 Qs:t.closePath(),s+=1;break;case $s: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 tn:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case en:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*W,e[s+6]*W,e[s+7]*W,e[s+8]),s+=9;break;case sn:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,U,!1),s+=5;break;case nn:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*W,e[s+5]*W,e[s+6]),s+=7;break;case rn:t.arc(e[s+1],e[s+2],e[s+3],0,U,!1),s+=4;break;case on:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void an.error(`command: ${i} [index:${s}]`,e)}},drawPathByPoints(t,e,i){}},{M:ln,L:dn,C:cn,Q:un,Z:pn,N:_n,D:gn,X:fn,G:yn,F:mn,O:vn,P:wn,U:xn}=Me,{toTwoPointBounds:bn,toTwoPointBoundsByQuadraticCurve:En,arcTo:Pn,arc:Sn,ellipse:kn}=li,{addPointBounds:Bn,copy:Tn,addPoint:Cn,setPoint:Rn,addBounds:Ln,toBounds:Dn}=vt,An=ne.get("PathBounds");let On,In,Mn;const Fn={},Wn={},Un={},Nn={toBounds(t,e){Nn.toTwoPointBounds(t,Wn),Dn(Wn,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Rn(e,0,0);let i,s,n,r,o,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(o=t[a],0===a&&(o===pn||o===cn||o===un?Rn(e,h,l):Rn(e,t[a+1],t[a+2])),o){case ln:case dn:h=t[a+1],l=t[a+2],Cn(e,h,l),a+=3;break;case cn:n=t[a+5],r=t[a+6],bn(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,r,Fn),Bn(e,Fn),h=n,l=r,a+=7;break;case un:i=t[a+1],s=t[a+2],n=t[a+3],r=t[a+4],En(h,l,i,s,n,r,Fn),Bn(e,Fn),h=n,l=r,a+=5;break;case pn:a+=1;break;case _n:h=t[a+1],l=t[a+2],Ln(e,h,l,t[a+3],t[a+4]),a+=5;break;case gn:case fn:h=t[a+1],l=t[a+2],Ln(e,h,l,t[a+3],t[a+4]),a+=o===gn?9:6;break;case yn:kn(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],t[a+7],t[a+8],Fn,Un),0===a?Tn(e,Fn):Bn(e,Fn),h=Un.x,l=Un.y,a+=9;break;case mn:h=t[a+1],l=t[a+2],In=t[a+3],Mn=t[a+4],Ln(e,h-In,l-Mn,2*In,2*Mn),h+=In,a+=5;break;case vn:Sn(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Fn,Un),0===a?Tn(e,Fn):Bn(e,Fn),h=Un.x,l=Un.y,a+=7;break;case wn:h=t[a+1],l=t[a+2],On=t[a+3],Ln(e,h-On,l-On,2*On,2*On),h+=On,a+=4;break;case xn:Pn(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Fn,Un),0===a?Tn(e,Fn):Bn(e,Fn),h=Un.x,l=Un.y,a+=6;break;default:return void An.error(`command: ${o} [index:${a}]`,t)}}},{M:zn,L:Yn,Z:Xn}=Me,{getCenterX:Hn,getCenterY:jn}=lt,{arcTo:Vn}=Bs,Gn={smooth(t,e,i){let s,n,r,o,a,h,l=0,d=0,c=0,p=0,_=0,g=0,f=0,y=0,m=0;u(e)&&(e=e[0]||0);const v=t.length,w=9===v,x=[];for(;l<v;){switch(s=t[l],s){case zn:h=x.length,h&&n!==Xn&&(x[o]=p,x[a]=_),p=y=t[l+1],_=m=t[l+2],l+=3,t[l]===Yn?(g=t[l+1],f=t[l+2],w?x.push(zn,p,_):x.push(zn,Hn(p,g),jn(_,f))):x.push(zn,p,_),o=h+1,a=h+2;break;case Yn:switch(d=t[l+1],c=t[l+2],l+=3,t[l]){case Yn:Vn(x,d,c,t[l+1],t[l+2],e,y,m,w);break;case Xn:Vn(x,d,c,p,_,e,y,m,w);break;default:x.push(Yn,d,c)}y=d,m=c;break;case Xn:n!==Xn&&(Vn(x,p,_,g,f,e,y,m,w),x.push(Xn)),l+=1;break;default:r=Ye[s];for(let e=0;e<r;e++)x.push(t[l+e]);l+=r}n=s}return s!==Xn&&(x[o]=p,x[a]=_),x}};function qn(t){return new Vs(t)}const Kn=qn();Oe.creator=qn(),Oe.parse=ss.parse,Oe.convertToCanvasData=ss.toCanvasData;const{drawRoundRect:Zn}=Xe;function Qn(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,n){Zn(this,t,e,i,s,n)})}(t)}const $n={alphaPixelTypes:["png","webp","svg"],upperCaseTypeMap:{},mimeType:(t,e="image")=>!t||t.startsWith(e)?t:("jpg"===t&&(t="jpeg"),e+"/"+t),fileType(t){const e=t.split(".");return e[e.length-1]},isOpaqueImage(t){const e=Jn.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{}}}},Jn=$n;Jn.mineType=Jn.mimeType,Jn.alphaPixelTypes.forEach(t=>Jn.upperCaseTypeMap[t]=t.toUpperCase());const tr=ne.get("TaskProcessor");class er{constructor(t){this.parallel=!0,this.time=1,this.id=m.create(m.TASK),this.task=t}run(){return n(this,void 0,void 0,function*(){try{if(this.isComplete||this.runing)return;if(this.runing=!0,this.canUse&&!this.canUse())return this.cancel();this.task&&(yield this.task())}catch(t){tr.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}}class ir{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&&g.assign(this.config,t),this.empty()}add(t,e,i){let s,n,r,a;const h=new er(t);return h.parent=this,d(e)?a=e:e&&(n=e.parallel,s=e.start,r=e.time,a=e.delay,i||(i=e.canUse)),r&&(h.time=r),!1===n&&(h.parallel=!1),i&&(h.canUse=i),o(a)?this.push(h,s):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(h,s))},a)),this.isComplete=!1,h}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.run()}),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 n=s+e.parallel;if(n>i.length&&(n=i.length),e.parallel>1)for(let e=s;e<n&&(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 sr=ne.get("Resource"),nr={tasker:new ir,queue:new ir({parallel:1}),map:{},get isComplete(){return rr.tasker.isComplete},set(t,e){rr.map[t]&&sr.repeat(t),rr.map[t]=e},get:t=>rr.map[t],remove(t){const e=rr.map[t];e&&(e.destroy&&e.destroy(),delete rr.map[t])},loadImage(t,e){return new Promise((i,s)=>{const n=this.setImage(t,t,e);n.load(()=>i(n),t=>s(t))})},setImage(t,e,i){let s;return h(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=ue.image(s)),rr.set(t,e),e},loadFilm(t,e){},loadVideo(t,e){},destroy(){rr.map={}}},rr=nr,or={maxRecycled:10,recycledList:[],patternTasker:nr.queue,get(t,e){let i=nr.get(t.url);return i||nr.set(t.url,i=ue[e||"image"](t)),i.use++,i},recycle(t){t.parent&&(t=t.parent),t.use--,setTimeout(()=>{t.use||(ee.image.isLarge(t)?t.url&&nr.remove(t.url):(t.clearLevels(),ar.recycledList.push(t)))})},recyclePaint(t){ar.recycle(t.image)},clearRecycled(t){const e=ar.recycledList;(e.length>ar.maxRecycled||t)&&(e.forEach(e=>(!e.use||t)&&e.url&&nr.remove(e.url)),e.length=0)},clearLevels(){},hasAlphaPixel:t=>$n.alphaPixelTypes.some(e=>ar.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:"+$n.mimeType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+$n.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){this.clearRecycled(!0)}},ar=or,{IMAGE:hr,create:lr}=m;class dr{get tag(){return"Image"}get url(){return this.config.url}get crossOrigin(){const{crossOrigin:t}=this.config;return o(t)?ee.image.crossOrigin:t}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=lr(hr),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}or.isFormat("svg",t)&&(this.isSVG=!0),or.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,e,i){return this.loading||(this.loading=!0,nr.tasker.add(()=>n(this,void 0,void 0,function*(){return yield ee.origin["load"+this.tag](this.getLoadUrl(i),this.crossOrigin,this).then(t=>{i&&this.setThumbView(t),this.setView(t)}).catch(t=>{this.error=t,this.onComplete(!1)})}))),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||(this.width=t.width,this.height=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,n,r,o,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 h=ee.image.resize(this.view,t,e,n,r,void 0,o,i,s,a);return this.cache=this.use>1?{data:h,params:arguments}:null,h}getPattern(t,e,i,s){const n=ee.canvas.createPattern(t,e);return ee.image.setPatternTransform(n,i,s),n}render(t,e,i,s,n,r,o,a,h){t.drawImage(this.view,e,i,s,n)}getLoadUrl(t){return this.url}setThumbView(t){}getThumbSize(t){}getMinLevel(){}getLevelData(t,e,i){}clearLevels(t){}destroyFilter(){}destroy(){this.clearLevels(),this.destroyFilter();const{view:t}=this;t&&t.close&&t.close(),this.config={url:""},this.cache=this.view=null,this.waitComplete.length=0}}function cr(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function ur(t,e){return Object.getOwnPropertyDescriptor(t,e)}function pr(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function _r(t,e){return(i,s)=>fr(i,s,t,e&&e(s))}function gr(t){return t}function fr(t,e,i,s){const n={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};cr(t,e,Object.assign(n,s||{})),jr(t,e,i)}function yr(t){return _r(t)}function mr(t,e){return _r(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function vr(t,e){return _r(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function wr(t){return _r(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),Sr(this))}}))}function xr(t,e){return _r(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function br(t,e){return _r(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function Er(t,e){return _r(t,t=>({set(i){this.__setAttr(t,i,e)&&Sr(this)}}))}function Pr(t){return _r(t,t=>({set(e){this.__setAttr(t,e)&&(Sr(this),this.__.__removeNaturalSize())}}))}function Sr(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function kr(t){return _r(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),Sr(this)}}))}const Br=Er;function Tr(t,e){return _r(t,t=>({set(i){this.__setAttr(t,i)&&(Cr(this),e&&(this.__.__useStroke=!0))}}))}function Cr(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&Sr(t)}const Rr=Tr;function Lr(t){return _r(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Dr(t){return _r(t,t=>({set(e){this.__setAttr(t,e)&&Ar(this)}}))}function Ar(t){t.__layout.surfaceChanged||t.__layout.surfaceChange()}function Or(t){return _r(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;g.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip)}}}))}function Ir(t){return _r(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Fr(this)}}))}function Mr(t){return _r(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>Wr(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Wr(this,t,e,i),this.mask&&Fr(this)}}))}function Fr(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Wr(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||Sr(t))}function Ur(t){return _r(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{const{parent:t}=this;t.__layout.childrenSortChange(),t.__.flow&&t.__layout.boxChange()})}}))}function Nr(t,e){return _r(t,t=>({set(i){this.__setAttr(t,i)&&(this.__layout.boxChanged||this.__layout.boxChange(),e?this.__updateMask():this.waitParent(()=>{this.parent.__updateMask(i)}))}}))}function zr(t){return _r(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function Yr(t){return _r(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,this.leafer&&this.leafer.updateCursor())}}))}function Xr(t){return _r(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function Hr(t){return(e,i)=>{cr(e,"__DataProcessor",{get:()=>t})}}function jr(t,e,i){const s=t.__DataProcessor.prototype,n="_"+e,r=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=pr(e,i);if(o(i))a.get=function(){return this[n]};else if("function"==typeof i)a.get=function(){const t=this[n];return null==t?i(this.__leaf):t};else if(p(i)){const t=_(i);a.get=function(){const e=this[n];return null==e?this[n]=t?{}:g.clone(i):e}}const h=t.isBranchLeaf;"width"===e?a.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&&(a.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,d=s;for(;!l&&d;)l=ur(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),s[r]&&(a.set=s[r],delete s[r]),cr(s,e,a)}const Vr=new ne("rewrite"),Gr=[],qr=["destroy","constructor"];function Kr(t){return(e,i)=>{Gr.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function Zr(){return t=>{Qr()}}function Qr(t){Gr.length&&(Gr.forEach(e=>{t&&Vr.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),Gr.length=0)}function $r(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(qr.includes(s)||e&&e.includes(s)))if(t.prototype){const e=ur(t.prototype,s);e&&Object.defineProperty(i.prototype,s,e)}else i.prototype[s]=t[s]})}}function Jr(){return t=>{_e.register(t)}}function to(){return t=>{ye.register(t)}}setTimeout(()=>Qr(!0));const{copy:eo,toInnerPoint:io,toOuterPoint:so,scaleOfOuter:no,rotateOfOuter:ro,skewOfOuter:oo,multiplyParent:ao,divideParent:ho,getLayout:lo}=Q,co={},{round:uo}=Math,po={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),fo(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,n=s.length;t<n;t++)go(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,e){const i=t.__layout;i.boundsChanged&&t.__updateLocalBounds(),e&&(i.resized=void 0),i.waitAutoLayout||t.__updateWorldBounds()},updateAllWorldOpacity(t){if(t.__updateWorldOpacity(),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)yo(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&yo(t),t.__updateChange(),e.surfaceChanged&&(t.__hasComplex&&_o.updateComplex(t),e.surfaceChanged=!1)},updateAllChange(t){if(vo(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)mo(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,n,r){s||(s=t.__nowWorld),t.__worldFlipped||ee.fullImageShadow?e.copyWorldByReset(i,s,t.__nowWorld,n,r):e.copyWorldToInner(i,s,t.__layout.renderBounds,n)},renderComplex(t,e,i){},updateComplex(t){},checkComplex(t){},moveWorld(t,e,i=0,s,n){const r=p(e)?Object.assign({},e):{x:e,y:i};s?so(t.localTransform,r,r,!0):t.parent&&io(t.parent.scrollWorldTransform,r,r,!0),_o.moveLocal(t,r.x,r.y,n)},moveLocal(t,e,i=0,s){p(e)&&(i=e.y,e=e.x),e+=t.x,i+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=uo(e),i=uo(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,n,r,o){_o.zoomOfLocal(t,wo(t,e),i,s,n,r,o)},zoomOfLocal(t,e,i,s=i,n,r,o){const a=t.__localMatrix;if(d(s)||(s&&(r=s),s=i),eo(co,a),no(co,e,i,s),_o.hasHighPosition(t))_o.setTransform(t,co,n,r,o);else{const e=t.x+co.e-a.e,h=t.y+co.f-a.f;r&&!n?t.animate({x:e,y:h,scaleX:t.scaleX*i,scaleY:t.scaleY*s},r):(t.x=e,t.y=h,t.scaleResize(i,s,!0!==n,o))}},rotateOfWorld(t,e,i,s){_o.rotateOfLocal(t,wo(t,e),i,s)},rotateOfLocal(t,e,i,s){const n=t.__localMatrix;eo(co,n),ro(co,e,i),_o.hasHighPosition(t)?_o.setTransform(t,co,!1,s):t.set({x:t.x+co.e-n.e,y:t.y+co.f-n.f,rotation:M.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,n,r){_o.skewOfLocal(t,wo(t,e),i,s,n,r)},skewOfLocal(t,e,i,s=0,n,r){eo(co,t.__localMatrix),oo(co,e,i,s),_o.setTransform(t,co,n,r)},transformWorld(t,e,i,s,n){eo(co,t.worldTransform),ao(co,e),t.parent&&ho(co,t.parent.scrollWorldTransform),_o.setTransform(t,co,i,s,n)},transform(t,e,i,s,n){eo(co,t.localTransform),ao(co,e),_o.setTransform(t,co,i,s,n)},setTransform(t,e,i,s,n){const r=t.__,o=r.origin&&_o.getInnerOrigin(t,r.origin),a=lo(e,o,r.around&&_o.getInnerOrigin(t,r.around));if(_o.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,o){Ht.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=_o.getInnerOrigin(t,r.origin);lt.move(a,o.x-s.x,o.y-s.y)}t.set(a),t.scaleResize(e,i,!1,n)}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 no(i,_o.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>lt.tempToOuterOf(_o.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return Pt.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(eo(co,t.worldTransform),ho(co,e.scrollWorldTransform),i?co:Object.assign({},co)),updateScaleFixedWorld(t){},updateOuterBounds(t){},cacheId(t){},drop(t,e,i,s){t.setTransform(_o.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||_o.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,s){if(e.x||e.y){if(Math.abs(e.x)<1&&Math.abs(e.y)<1)t.move(e);else{const n=e.x*i,r=e.y*i;e.x-=n,e.y-=r,t.move(n,r),ee.requestRender(()=>_o.animateMove(t,e,i,s))}s&&s()}}},_o=po,{updateAllMatrix:go,updateMatrix:fo,updateAllWorldOpacity:yo,updateAllChange:mo,updateChange:vo}=_o;function wo(t,e){return t.updateLayout(),t.parent?lt.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const xo={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){const{__:e,__layout:i}=t;return e.eraser||0===e.visible?null:i.localOuterBounds||i.localRenderBounds},maskLocalBoxBounds:(t,e)=>Eo(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>Eo(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds(t,e){const{__layout:i}=t;return Eo(t,e)&&(i.localOuterBounds||i.localRenderBounds)},excludeRenderBounds:(t,e)=>!(!e.bounds||e.bounds.hit(t.__world,e.matrix))||!(!e.hideBounds||!e.hideBounds.includes(t.__world,e.matrix))};let bo;function Eo(t,e){return e||(bo=0),t.__.mask&&(bo=1),bo<0?null:(bo&&(bo=-1),!0)}const{updateBounds:Po}=po,So={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,n=i.length;s<n;s++)(t=i[s]).isBranch&&(t.__tempNumber=1,e.add(t),ko(t,e))}},pushAllParent(t,e){const{keys:i}=e;if(i)for(;t.parent&&o(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++)Bo(e[t],e)},updateBounds(t,e){const i=[t];Bo(t,i),To(i,e)},updateBoundsByBranchStack(t,e){let i,s;for(let n=t.length-1;n>-1;n--){i=t[n],s=i.children;for(let t=0,e=s.length;t<e;t++)Po(s[t]);e&&e===i||Po(i)}},move(t,e,i){let s;const{children:n}=t;for(let r=0,o=n.length;r<o;r++)s=(t=n[r]).__world,s.e+=e,s.f+=i,s.x+=e,s.y+=i,t.isBranch&&Co(t,e,i)},scale(t,e,i,s,n,r,o){let a;const{children:h}=t,l=s-1,d=n-1;for(let c=0,u=h.length;c<u;c++)a=(t=h[c]).__world,a.a*=s,a.d*=n,(a.b||a.c)&&(a.b*=s,a.c*=n),a.e===a.x&&a.f===a.y?(a.x=a.e+=(a.e-r)*l+e,a.y=a.f+=(a.f-o)*d+i):(a.e+=(a.e-r)*l+e,a.f+=(a.f-o)*d+i,a.x+=(a.x-r)*l+e,a.y+=(a.y-o)*d+i),a.width*=s,a.height*=n,a.scaleX*=s,a.scaleY*=n,t.isBranch&&Ro(t,e,i,s,n,r,o)}},{pushAllChildBranch:ko,pushAllBranchStack:Bo,updateBoundsByBranchStack:To,move:Co,scale:Ro}=So,Lo={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:Do,updateBounds:Ao}=po,{toOuterOf:Oo,getPoints:Io,copy:Mo}=Ht,Fo="_localContentBounds",Wo="_worldContentBounds",Uo="_worldBoxBounds",No="_worldStrokeBounds";class zo{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 Oo(this.contentBounds,this.leaf.__localMatrix,this[Fo]||(this[Fo]={})),this[Fo]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return Oo(this.contentBounds,this.leaf.__world,this[Wo]||(this[Wo]={})),this[Wo]}get worldBoxBounds(){return Oo(this.boxBounds,this.leaf.__world,this[Uo]||(this[Uo]={})),this[Uo]}get worldStrokeBounds(){return Oo(this.strokeBounds,this.leaf.__world,this[No]||(this[No]={})),this[No]}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 Ao(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,ee.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 Do(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 qt(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 n,r,o,a=this.getInnerBounds(t);switch(e){case"world":n=s.getWorldPoint(a),r=s.__world;break;case"local":const{scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d}=s.__;o={scaleX:t,scaleY:i,rotation:h,skewX:l,skewY:d},n=s.getLocalPointByInner(a);break;case"inner":n=a,r=Q.defaultMatrix;break;case"page":e=s.zoomLayer;default:n=s.getWorldPoint(a,e),r=Do(s,e,!0)}if(o||(o=Q.getLayout(r)),Mo(o,a),lt.copy(o,n),i){const{scaleX:t,scaleY:e}=o,i=Math.abs(t),s=Math.abs(e);1===i&&1===s||(o.scaleX/=i,o.scaleY/=s,o.width*=i,o.height*=s)}return o}getLayoutPoints(t,e="world"){const{leaf:i}=this,s=Io(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 o(n)||s.forEach(t=>i.innerToWorld(t,null,!1,n)),s}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,this.hitCanvasChanged=!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}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=this.affectChildrenSort=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class Yo{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&ee.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&ee.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&ee.event.stop(this.origin)}}class Xo extends Yo{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}Xo.ADD="child.add",Xo.REMOVE="child.remove",Xo.CREATED="created",Xo.MOUNTED="mounted",Xo.UNMOUNTED="unmounted",Xo.DESTROY="destroy";const Ho="property.scroll";class jo extends Yo{constructor(t,e,i,s,n){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=n}}jo.CHANGE="property.change",jo.LEAFER_CHANGE="property.leafer_change",jo.SCROLL=Ho;const Vo={scrollX:Ho,scrollY:Ho};class Go extends Yo{constructor(t,e){super(t),Object.assign(this,e)}}Go.LOAD="image.load",Go.LOADED="image.loaded",Go.ERROR="image.error";class qo extends Yo{static checkHas(t,e,i){"on"===i?e===$o?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(Ko)||t.hasEvent(Zo)||t.hasEvent(Qo),t.__hasWorldEvent=t.hasEvent($o))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(Ko,t),"inner"===e&&t.emit(Zo,t)),t.emit(Qo,t)}}static emitWorld(t){t.leaferIsReady&&t.emit($o,t)}}qo.RESIZE="bounds.resize",qo.INNER="bounds.inner",qo.LOCAL="bounds.local",qo.WORLD="bounds.world";const{RESIZE:Ko,INNER:Zo,LOCAL:Qo,WORLD:$o}=qo,Jo={};[Ko,Zo,Qo,$o].forEach(t=>Jo[t]=1);class ta extends Yo{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){p(t)?(super(ta.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!o(this.resizingKeys[t.innerId])}}ta.RESIZE="resize";class ea extends Yo{constructor(t,e){super(t),this.data=e}}ea.REQUEST="watch.request",ea.DATA="watch.data";class ia extends Yo{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}ia.REQUEST="layout.request",ia.START="layout.start",ia.BEFORE="layout.before",ia.LAYOUT="layout",ia.AFTER="layout.after",ia.AGAIN="layout.again",ia.END="layout.end";class sa extends Yo{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}sa.REQUEST="render.request",sa.CHILD_START="render.child_start",sa.CHILD_END="render.child_end",sa.START="render.start",sa.BEFORE="render.before",sa.RENDER="render",sa.AFTER="render.after",sa.AGAIN="render.again",sa.END="render.end",sa.NEXT="render.next";class na extends Yo{}na.START="leafer.start",na.BEFORE_READY="leafer.before_ready",na.READY="leafer.ready",na.AFTER_READY="leafer.after_ready",na.VIEW_READY="leafer.view_ready",na.VIEW_COMPLETED="leafer.view_completed",na.STOP="leafer.stop",na.RESTART="leafer.restart",na.END="leafer.end",na.UPDATE_MODE="leafer.update_mode",na.TRANSFORM="leafer.transform",na.MOVE="leafer.move",na.SCALE="leafer.scale",na.ROTATE="leafer.rotate",na.SKEW="leafer.skew";const{MOVE:ra,SCALE:oa,ROTATE:aa,SKEW:ha}=na,la={x:ra,y:ra,scaleX:oa,scaleY:oa,rotation:aa,skewX:ha,skewY:ha},da={};class ca{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(u(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let i in t)u(e=t[i])?this.on(i,e[0],e[1]):this.on(i,e);return}let s,n,r;i&&("once"===i?n=!0:"boolean"==typeof i?s=i:(s=i.capture,n=i.once));const o=ua(this,s,!0),a=h(t)?t.split(" "):t,l=n?{listener:e,once:n}:{listener:e};a.forEach(t=>{t&&(r=o[t],r?-1===r.findIndex(t=>t.listener===e)&&r.push(l):o[t]=[l],Jo[t]&&qo.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=h(t)?t.split(" "):t;if(e){let t,n,r;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const o=ua(this,t);s.forEach(t=>{t&&(n=o[t],n&&(r=n.findIndex(t=>t.listener===e),r>-1&&n.splice(r,1),n.length||delete o[t],Jo[t]&&qo.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):u(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=u(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):u(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 u(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));p(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&ye.has(t)&&(e=ye.get(t,{type:t,target:this,current:this}));const s=ua(this,i)[t];if(s){let n;for(let r=0,o=s.length;r<o&&!((n=s[r])&&(n.listener(e),n.once&&(this.off(t,n.listener,i),r--,o--),e&&e.isStopNow));r++);}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:s}=this,n=i&&i[t],r=s&&s[t];return!!(o(e)?n||r:e?r:n)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function ua(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:da)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:da)}}const{on:pa,on_:_a,off:ga,off_:fa,once:ya,emit:ma,emitEvent:va,hasEvent:wa,destroy:xa}=ca.prototype,ba={on:pa,on_:_a,off:ga,off_:fa,once:ya,emit:ma,emitEvent:va,hasEvent:wa,destroyEventer:xa},Ea=ne.get("setAttr"),Pa={__setAttr(t,e,i){if(this.leaferIsCreated){const s=this.__.__getInput(t);if(!i||l(e)||o(e)||(Ea.warn(this.innerName,t,e),e=void 0),p(e)||s!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new jo(jo.LEAFER_CHANGE,this,t,s,e));const i=la[t];i&&(this.emitEvent(new na(i,this)),this.emitEvent(new na(na.TRANSFORM,this)))}this.emitPropertyEvent(jo.CHANGE,t,s,e);const i=Vo[t];return i&&this.emitPropertyEvent(i,t,s,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,i,s){const{leafer:n}=this;if(n.config.trackChanges||n.zoomLayer===this){const r=new jo(t,this,e,i,s);this.isLeafer||this.hasEvent(t)&&this.emitEvent(r),n.emitEvent(r)}else n.watcher.add(this)},__realSetAttr(t,e){const i=this.__;i[t]=e,this.__proxyData&&this.setProxyAttr(t,e),i.normalStyle&&(this.lockNormalStyle||o(i.normalStyle[t])||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:Sa,multiplyParent:ka,translateInner:Ba,defaultWorld:Ta}=Q,{toPoint:Ca,tempPoint:Ra}=Pt,La={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:n}=this;ka(this.__local||e,t?t.__scrollWorld||t.__world:Ta,i,!!e.affectScaleOrRotation,n),s&&Ba(Object.assign(s,i),n.scrollX,n.scrollY),e.scaleFixed&&po.updateScaleFixedWorld(this)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,i=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(Sa(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)&&(Ca(i.around||i.origin,t.boxBounds,Ra),Ba(e,-Ra.x,-Ra.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:Da,updateAllMatrix:Aa}=po,{updateBounds:Oa}=So,{toOuterOf:Ia,copyAndSpread:Ma,copy:Fa}=Ht,{toBounds:Wa}=Nn,Ua={__updateWorldBounds(){const{__layout:t,__world:e}=this;Ia(t.renderBounds,e,e),this.__hasComplex&&po.checkComplex(this),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&qo.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&qo.emitWorld(this)},__updateLocalBounds(){const t=this.__layout,e=this.__;t.boxChanged&&(e.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.resized="inner"),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=void 0,t.strokeSpread&&!t.strokeChanged&&(t.strokeChanged=!!t.boxChanged||2),t.renderSpread&&!t.renderChanged&&(t.renderChanged=!!t.boxChanged||2),this.parent&&this.parent.__layout.boxChange()),t.boxChanged=void 0,t.strokeChanged&&(2===t.strokeChanged?this.__updateLocalStrokeBounds():(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.resized="inner",(t.renderSpread||t.strokeSpread!==t.strokeBoxSpread)&&(t.renderChanged=!0)),t.strokeChanged=void 0,this.parent&&this.parent.__layout.strokeChange()),t.renderChanged&&(2===t.renderChanged?this.__updateLocalRenderBounds():(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.outerScale&&po.updateOuterBounds(this),t.resized||(t.resized="local"),t.boundsChanged=void 0},__updateLocalBoxBounds(){this.__hasMotionPath&&this.__updateMotionPath(),this.__hasAutoLayout&&this.__updateAutoLayout(),Ia(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Ia(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Ia(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const i=this.__layout.boxBounds,s=this.__;s.__usePathBox?Wa(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.childrenSortChanged&&this.__updateSortChildren(),this.__layout.boxChanged&&this.__updateFlowLayout(),Aa(this),Oa(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(Aa(this),Oa(this,this))):Da(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;Ma(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:i}=e;d(i)&&i<=0?Fa(e.renderBounds,e.strokeBounds):Ma(e.renderBounds,e.boxBounds,i)}},Na={__render(t,e){if(e.shape)return this.__renderShape(t,e);if((!e.cellList||e.cellList.has(this))&&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.ignoreOpacity?1: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),po.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);ne.showBounds&&ne.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:za}=xo,{hasSize:Ya}=Ht,Xa={__updateChange(){this.__layout.childrenSortChanged&&this.__updateSortChildren(),this.__.__checkSingle()},__render(t,e){const i=this.__nowWorld=this.__getNowWorld(e);if(this.__worldOpacity&&Ya(i)){const s=this.__;if(s.__useDim){if(s.bright&&!e.topRendering)return e.topList.add(this);s.dim?e.dimOpacity=!0===s.dim?.2:s.dim:s.dimskip&&e.dimOpacity&&(e.dimOpacity=0)}if(s.__single&&!this.isBranchLeaf){if("path"===s.eraser)return this.__renderEraser(t,e);const n=t.getSameCanvas(!1,!0);this.__renderBranch(n,e),t.opacity=e.ignoreOpacity?1:e.dimOpacity?s.opacity*e.dimOpacity:s.opacity,t.copyWorldByReset(n,i,i,s.__blendMode,!0),n.recycle(i)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{let i;const{children:s}=this;for(let n=0,r=s.length;n<r;n++)i=s[n],za(i,e)||(i.__hasComplex?po.renderComplex(i,t,e):i.__render(t,e));0===this.__hasMask&&this.__rerenderMask(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,n=i.length;s<n;s++)za(i[s],e)||i[s].__clip(t,e)}}},{LEAF:Ha,create:ja}=m,{stintSet:Va}=g,{toInnerPoint:Ga,toOuterPoint:qa,multiplyParent:Ka}=Q,{toOuterOf:Za}=Ht,{copy:Qa,move:$a}=lt,{getScaleFixedData:Ja}=M,{moveLocal:th,zoomOfLocal:eh,rotateOfLocal:ih,skewOfLocal:sh,moveWorld:nh,zoomOfWorld:rh,rotateOfWorld:oh,skewOfWorld:ah,transform:hh,transformWorld:lh,setTransform:dh,getFlipTransform:ch,getLocalOrigin:uh,getRelativeWorld:ph,drop:_h}=po;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 y}get __LayoutProcessor(){return zo}get leaferIsCreated(){return this.leafer&&this.leafer.created}get leaferIsReady(){return this.leafer&&this.leafer.ready}get isLeafer(){return!1}get isFrame(){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=ja(Ha),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Xo.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(Xo.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Xo.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(Xo.MOUNTED),t.cacheId&&po.cacheId(this)):this.__emitLifeEvent(Xo.UNMOUNTED),this.isBranch){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__bindLeafer(t)}}__bindFrame(t){if(this.isFrame&&null!==t&&(t=this),this.frame=t,this.isBranch){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__bindFrame(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))}scaleResize(t,e=t,i,s){this.scaleX*=t,this.scaleY*=e}updateLayout(){this.__layout.update()}forceUpdate(t){let e;if(t&&"bounds"!==t?"surface"===t?(Ar(this),e=!0):"stroke"===t&&(Cr(this),e=!0):(Sr(this),e=!0),e){const{leafer:t}=this;return t&&t.watcher&&t.watcher.__onAttrChange({target:this})}const i=this.__.__getInput(t);this.__[t]=o(i)?null:void 0,this[t]=i}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__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){const e=this.children.some(t=>t.__.mask&&t.__.visible&&t.__.opacity);this.__hasMask=this.__.maskskip?e&&0:e}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld,i=this.__world;return Ka(i,t.matrix,e,void 0,i),Za(this.__layout.renderBounds,e,e),Va(e,"half",i.half),Va(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,i=!0){return Ja(or.patternLocked?this.__world:this.__nowWorld||this.__world,e,i,t)}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?ph(this,e):this.worldTransform,n=i?t:{};return Za(t,s,n),n}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&Qa(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&Qa(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),Ga(this.worldTransform,t,e,i)}innerToWorld(t,e,i,s){qa(this.worldTransform,t,e,i),s&&s.worldToInner(e||t,null,i)}getBoxPoint(t,e,i,s){const n=this.getInnerPoint(t,e,i,s);return i?n:this.getBoxPointByInner(n,null,null,!0)}getBoxPointByInner(t,e,i,s){const n=s?t:Object.assign({},t),{x:r,y:o}=this.boxBounds;return $a(n,-r,-o),n}getInnerPoint(t,e,i,s){const n=s?t:{};return this.worldToInner(t,n,i,e),n}getInnerPointByBox(t,e,i,s){const n=s?t:Object.assign({},t),{x:r,y:o}=this.boxBounds;return $a(n,r,o),n}getInnerPointByLocal(t,e,i,s){return this.getInnerPoint(t,this.parent,i,s)}getLocalPoint(t,e,i,s){const n=s?t:{};return this.worldToLocal(t,n,i,e),n}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 n=s?t:{};return this.innerToWorld(t,n,i,e),n}getWorldPointByBox(t,e,i,s){return this.getWorldPoint(this.getInnerPointByBox(t,null,null,s),e,i,!0)}getWorldPointByLocal(t,e,i,s){const n=s?t:{};return this.localToWorld(t,n,i,e),n}getWorldPointByPage(t,e,i,s){return(this.leafer?this.leafer.zoomLayer:this).getWorldPoint(t,e,i,s)}setTransform(t,e,i,s){dh(this,t,e,i,s)}transform(t,e,i,s){hh(this,t,e,i,s)}move(t,e,i){th(this,t,e,i)}moveInner(t,e,i){nh(this,t,e,!0,i)}scaleOf(t,e,i,s,n,r){eh(this,uh(this,t),e,i,s,n,r)}rotateOf(t,e,i){ih(this,uh(this,t),e,i)}skewOf(t,e,i,s,n){sh(this,uh(this,t),e,i,s,n)}transformWorld(t,e,i,s){lh(this,t,e,i,s)}moveWorld(t,e,i){nh(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,n,r){rh(this,t,e,i,s,n,r)}rotateOfWorld(t,e){oh(this,t,e)}skewOfWorld(t,e,i,s,n){ah(this,t,e,i,s,n)}flip(t,e){hh(this,ch(this,t),!1,e)}remove(t,e){this.parent&&this.parent.remove(this,e)}dropTo(t,e,i){_h(this,t,e,i)}static changeAttr(t,e,i){i?this.addAttr(t,e,i):jr(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=Er),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Xo(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Xo.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}},t.Leaf=s([$r(Pa),$r(La),$r(Ua),$r(ba),$r(Na)],t.Leaf);const{setListWithFn:gh}=Ht,{sort:fh}=So,{localBoxBounds:yh,localStrokeBounds:mh,localRenderBounds:vh,maskLocalBoxBounds:wh,maskLocalStrokeBounds:xh,maskLocalRenderBounds:bh}=xo,Eh=new ne("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(){let t;const{children:e}=this;for(let i=0,s=e.length;i<s;i++)if(t=e[i].__layout,t.renderSpread||t.localOuterBounds)return 1;return 0}__updateBoxBounds(t,e){gh(e||this.__layout.boxBounds,this.children,this.__hasMask?wh:yh)}__updateStrokeBounds(t){gh(t||this.__layout.strokeBounds,this.children,this.__hasMask?xh:mh)}__updateRenderBounds(t){gh(t||this.__layout.renderBounds,this.children,this.__hasMask?bh:vh)}__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(fh),this.__layout.affectChildrenSort=t}this.__layout.childrenSortChanged=!1}add(t,e){if(t===this||t.destroyed)return Eh.warn("add self or destroyed");const i=o(e);if(!t.__){if(u(t))return t.forEach(t=>{this.add(t,e),i||e++});if(!(t=_e.get(t.tag,t)))return}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 s=t.__layout;s.boxChanged||s.boxChange(),s.matrixChanged||s.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(Xo.ADD),this.isFrame&&t.__bindFrame(this),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Xo.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){this.add(t)}remove(t,e){t?t.__?t.animationOut?t.__runAnimation("out",()=>this.__remove(t,e)):this.__remove(t,e):this.find(t).forEach(t=>this.remove(t,e)):o(t)&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach(e=>{this.__realRemoveChild(e),t&&e.destroy()}))}clear(){this.removeAll(!0)}__remove(t,e){const 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(Xo.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Xo.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear())),this.isFrame&&t.__bindFrame(null)}__emitChildEvent(t,e){const{leafer:i}=this;if(i.config.trackChanges||i.zoomLayer===this){const s=new Xo(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(s),i.emitEvent(s)}else i.watcher.addChild(e,this,t)}},t.Branch=s([$r(Xa)],t.Branch);class Ph{get length(){return this.list.length}constructor(t){this.reset(),t&&(u(t)?this.addList(t):this.add(t))}has(t){return t&&!o(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return o(e)?-1:e}add(t){const{list:e,keys:i}=this;o(i[t.innerId])&&(e.push(t),i[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:i}=this;if(o(i[t.innerId])){const{list:s}=this;for(let t=e,n=s.length;t<n;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 s=0,n=e.length;s<n;s++)o(i)?e[s].innerId===t.innerId&&(i=s,delete this.keys[t.innerId]):this.keys[e[s].innerId]=s-1;o(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 Ph;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 Sh{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(u(t)?this.addList(t):this.add(t))}has(t){return!o(this.keys[t.innerId])}without(t){return o(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap: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}}const kh=ne.get("LeaferCanvas");class Bh extends Ae{set zIndex(t){const{style:e}=this.view;e.zIndex=t,this.setAbsolute(this.view)}set childIndex(t){const{view:e,parentView:i}=this;if(e&&i){const s=i.children[t];s?(this.setAbsolute(s),i.insertBefore(e,s)):i.appendChild(s)}}init(){const{config:t}=this,e=t.view||t.canvas;e?this.__createViewFrom(e):this.__createView();const{style:i}=this.view;if(i.display||(i.display="block"),this.parentView=this.view.parentElement,this.parentView){const t=this.parentView.style;t.webkitUserSelect=t.userSelect="none",this.view.classList.add("leafer-canvas-view")}ee.syncDomFont&&!this.parentView&&(i.display="none",document.body&&document.body.appendChild(this.view)),this.__createContext(),this.autoLayout||this.resize(t)}set backgroundColor(t){this.view.style.backgroundColor=t}get backgroundColor(){return this.view.style.backgroundColor}set hittable(t){this.view.style.pointerEvents=t?"auto":"none"}get hittable(){return"none"!==this.view.style.pointerEvents}__createView(){this.view=document.createElement("canvas")}__createViewFrom(t){let e=h(t)?document.getElementById(t):t;if(e)if(e instanceof HTMLCanvasElement)this.view=e;else{let t=e;if(e===window||e===document){const e=document.createElement("div"),{style:i}=e;i.position="absolute",i.top=i.bottom=i.left=i.right="0px",document.body.appendChild(e),t=e}this.__createView();const i=this.view;t.hasChildNodes()&&(this.setAbsolute(i),t.style.position||(t.style.position="relative")),t.appendChild(i)}else kh.error(`no id: ${t}`),this.__createView()}setAbsolute(t){const{style:e}=t;e.position="absolute",e.top=e.left="0px"}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this,{style:s}=this.view;s.width=t+"px",s.height=e+"px",this.unreal||(this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i))}updateClientBounds(){this.view.parentElement&&(this.clientBounds=this.view.getBoundingClientRect())}startAutoLayout(t,e){if(this.resizeListener=e,t){if(this.autoBounds=t,this.resizeObserver)return;try{this.resizeObserver=new ResizeObserver(t=>{this.updateClientBounds();for(const e of t)this.checkAutoBounds(e.contentRect)});const t=this.parentView;t?(this.resizeObserver.observe(t),this.checkAutoBounds(t.getBoundingClientRect())):(this.checkAutoBounds(this.view),kh.warn("no parent"))}catch(t){this.imitateResizeObserver()}this.stopListenPixelRatio()}else this.listenPixelRatio(),this.unreal&&this.updateViewSize()}imitateResizeObserver(){this.autoLayout&&(this.parentView&&this.checkAutoBounds(this.parentView.getBoundingClientRect()),ee.requestRender(this.imitateResizeObserver.bind(this)))}listenPixelRatio(){this.windowListener||window.addEventListener("resize",this.windowListener=()=>{const t=ee.devicePixelRatio;if(!this.config.pixelRatio&&this.pixelRatio!==t){const{width:e,height:i}=this;this.emitResize({width:e,height:i,pixelRatio:t})}})}stopListenPixelRatio(){this.windowListener&&(window.removeEventListener("resize",this.windowListener),this.windowListener=null)}checkAutoBounds(t){const e=this.view,{x:i,y:s,width:n,height:r}=this.autoBounds.getBoundsFrom(t),o={width:n,height:r,pixelRatio:this.config.pixelRatio?this.pixelRatio:ee.devicePixelRatio};if(!this.isSameSize(o)){const{style:t}=e;t.marginLeft=i+"px",t.marginTop=s+"px",this.emitResize(o)}}stopAutoLayout(){this.autoLayout=!1,this.resizeObserver&&this.resizeObserver.disconnect(),this.resizeListener=this.resizeObserver=null}emitResize(t){const e={};g.copyAttrs(e,this,De),this.resize(t),this.resizeListener&&!o(this.width)&&this.resizeListener(new ta(t,e))}unrealCanvas(){if(!this.unreal&&this.parentView){let t=this.view;t&&t.remove(),t=this.view=document.createElement("div"),this.parentView.appendChild(this.view),t.classList.add("leafer-app-view"),this.unreal=!0}}destroy(){const{view:t}=this;t&&(this.stopAutoLayout(),this.stopListenPixelRatio(),t.parentElement&&t.remove(),super.destroy())}}function Th(t,e){ee.origin={createCanvas(t,e){const i=document.createElement("canvas");return i.width=t,i.height=e,i},canvasToDataURL:(t,e,i)=>{const s=$n.mimeType(e),n=t.toDataURL(s,i);return"image/bmp"===s?n.replace("image/png;","image/bmp;"):n},canvasToBolb:(t,e,i)=>new Promise(s=>t.toBlob(s,$n.mimeType(e),i)),canvasSaveAs:(t,e,i)=>{const s=t.toDataURL($n.mimeType($n.fileType(e)),i);return ee.origin.download(s,e)},download(t,e){return n(this,void 0,void 0,function*(){let i=document.createElement("a");i.href=t,i.download=e,document.body.appendChild(i),i.click(),document.body.removeChild(i)})},loadImage:(t,e,i)=>new Promise((i,s)=>{const n=new ee.origin.Image;e&&(n.setAttribute("crossOrigin",e),n.crossOrigin=e),n.onload=()=>{i(n)},n.onerror=t=>{s(t)},n.src=ee.image.getRealURL(t)}),loadContent(t){return n(this,arguments,void 0,function*(t,e="text"){const i=yield fetch(t);if(!i.ok)throw new Error(`${i.status}`);return yield i[e]()})},Image:Image,PointerEvent:PointerEvent,DragEvent:DragEvent},ee.event={stopDefault(t){t.preventDefault()},stopNow(t){t.stopImmediatePropagation()},stop(t){t.stopPropagation()}},ee.canvas=ue.canvas(),ee.conicGradientSupport=!!ee.canvas.context.createConicGradient}Qn(CanvasRenderingContext2D.prototype),Qn(Path2D.prototype),Object.assign(ue,{canvas:(t,e)=>new Bh(t,e),image:t=>new dr(t)}),ee.name="web",ee.isMobile="ontouchstart"in window,ee.requestRender=function(t){window.requestAnimationFrame(t)},cr(ee,"devicePixelRatio",{get:()=>devicePixelRatio});const{userAgent:Ch}=navigator;Ch.indexOf("Firefox")>-1?(ee.intWheelDeltaY=!0,ee.syncDomFont=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(ee.fullImageShadow=!0),Ch.indexOf("Windows")>-1?(ee.os="Windows",ee.intWheelDeltaY=!0):Ch.indexOf("Mac")>-1?ee.os="Mac":Ch.indexOf("Linux")>-1&&(ee.os="Linux");class Rh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove&&this.config.usePartLayout){const t=new Ph;return this.__updatedList.list.forEach(e=>{e.leafer&&t.add(e)}),t}return this.__updatedList}constructor(t,e){this.totalTimes=0,this.changed=0,this.config={},this.__updatedList=new Ph,this.target=t,e&&(this.config=g.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<100&&(this.changed++,this.running&&this.target.emit(sa.REQUEST))}__onAttrChange(t){this.add(t.target)}add(t){this.config.usePartLayout&&this.__updatedList.add(t),this.update()}addChild(t,e,i){this.config.usePartLayout&&(i===Xo.ADD?(this.hasAdd=!0,this.__pushChild(t)):(this.hasRemove=!0,this.__updatedList.add(e))),this.update()}__onChildEvent(t){this.addChild(t.child,t.parent,t.type)}__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 ea(ea.DATA,{updatedList:this.updatedList})),this.__updatedList=new Ph,this.totalTimes++,this.hasVisible=this.hasRemove=this.hasAdd=!1,this.changed=0}__listenEvents(){this.__eventIds=[this.target.on_([[jo.CHANGE,this.__onAttrChange,this],[[Xo.ADD,Xo.REMOVE],this.__onChildEvent,this],[ea.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:Lh,updateBounds:Dh,updateChange:Ah}=po,{pushAllChildBranch:Oh,pushAllParent:Ih}=So,Mh={updateMatrix(t,e){let i,s,n=0;const{list:r}=t;for(;n<r.length;)i=r[n],s=i.__layout,e.without(i)&&!s.proxyZoom&&(s.matrixChanged?(Lh(i,!0),i.isBranch&&Oh(i,e),Fh(i,e)):s.boundsChanged&&(i.isBranch&&(i.__tempNumber=0),Fh(i,e))),n++},updateBounds(t){let e,i,s,n,r=0;const{levels:o,levelMap:a}=t;for(t.sort(!0);r<o.length;){e=o[r],i=a[e];for(let t=0,e=i.length;t<e;t++){if(s=i[t],s.isBranch&&s.__tempNumber){n=s.children;for(let t=0,e=n.length;t<e;t++)n[t].isBranch||Dh(n[t])}Dh(s)}r++}},updateChange(t){t.list.forEach(Ah)},push:Fh};function Fh(t,e){e.add(t),Ih(t,e)}const{worldBounds:Wh}=xo;class Uh{constructor(t){this.updatedBounds=new qt,this.beforeBounds=new qt,this.afterBounds=new qt,u(t)&&(t=new Ph(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Wh)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Wh),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:Nh,updateAllChange:zh}=po,Yh=ne.get("Layouter");class Xh{constructor(t,e){this.totalTimes=0,this.config={usePartLayout:!0},this.__levelList=new Sh,this.target=t,e&&(this.config=g.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(ia.START),this.layoutOnce(),t.emitEvent(new ia(ia.END,this.layoutedBlocks,this.times))}catch(t){Yh.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Yh.warn("layouting"):this.times>3?Yh.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(ea.REQUEST),this.totalTimes>1&&this.config.usePartLayout?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=he.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:r,AFTER:o}=ia,a=this.getBlocks(s);a.forEach(t=>t.setBefore()),i.emitEvent(new ia(n,a,this.times)),this.extraBlock=null,s.sort(),Mh.updateMatrix(s,this.__levelList),Mh.updateBounds(this.__levelList),Mh.updateChange(s),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),i.emitEvent(new ia(r,a,this.times)),i.emitEvent(new ia(o,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,he.end(e)}fullLayout(){const t=he.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=ia,r=this.getBlocks(new Ph(e));e.emitEvent(new ia(i,r,this.times)),Xh.fullLayout(e),r.forEach(t=>{t.setAfter()}),e.emitEvent(new ia(s,r,this.times)),e.emitEvent(new ia(n,r,this.times)),this.addBlocks(r),he.end(t)}static fullLayout(t){Nh(t,!0),t.isBranch?So.updateBounds(t):po.updateBounds(t),zh(t)}addExtra(t,e){if(!this.__updatedList.has(t)){const{updatedList:i,beforeBounds:s}=this.extraBlock||(this.extraBlock=new Uh([]));if(i.length?s.add(t.__world):s.set(t.__world),i.add(t),e){const e=this.__levelList;Mh.push(t,e),e.sort(!0)}}}createBlock(t){return new Uh(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_([[ia.REQUEST,this.layout,this],[ia.AGAIN,this.layoutAgain,this],[ea.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Hh=ne.get("Renderer");class jh{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,ceilPartPixel:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,i&&(this.config=g.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.requestTime||this.__requestRender()}requestLayout(){this.target.emit(ia.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(sa.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(sa.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(sa.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new qt,Hh.log(e.innerName,"---\x3e");try{this.emitRender(sa.START),this.renderOnce(t),this.emitRender(sa.END,this.totalBounds),or.clearRecycled()}catch(t){this.rendering=!1,Hh.error(t)}Hh.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Hh.warn("rendering");if(this.times>3)return Hh.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new qt,this.renderOptions={},t)this.emitRender(sa.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(sa.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(sa.RENDER,this.renderBounds,this.renderOptions),this.emitRender(sa.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=he.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new qt(s);i.save(),s.spread(jh.clipSpread).ceil();const{ceilPartPixel:r}=this.config;i.clipWorld(s,r),i.clearWorld(s,r),this.__render(s,n),i.restore(),he.end(e)}fullRender(){const t=he.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),he.end(t)}__render(t,e){const{canvas:i,target:s}=this,n=t.includes(s.__world),r=n?{includes:n}:{bounds:t,includes:n};this.needFill&&i.fillWorld(t,this.config.fill),ne.showRepaint&&ne.drawRepaint(i,t),this.config.useCellRender&&(r.cellList=this.getCellList()),ee.render(s,i,r),this.renderBounds=e=e||t,this.renderOptions=r,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}getCellList(){}addBlock(t,e){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new qt;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 ee.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()};ee.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new qt(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 qt(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;const{updatedList:i}=t;i&&i.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||Hh.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds,i)})}emitRender(t,e,i){this.target.emitEvent(new sa(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[sa.REQUEST,this.update,this],[ia.END,this.__onLayoutEnd,this],[sa.AGAIN,this.renderAgain,this],[ta.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}jh.clipSpread=10;const Vh={},{copyRadiusPoint:Gh}=lt,{hitRadiusPoint:qh}=Ht;class Kh{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,n=i.ignoreHittable||!1,r=i.target||this.target;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=new Ph(i.findList),i.findList||this.hitBranch(r.isBranchLeaf?{children:[r]}:r);const{list:o}=this.findList,a=this.getBestMatchLeaf(o,i.bottomList,n,!!i.findList),h=n?this.getPath(a):this.getHitablePath(a);return this.clear(),s?{path:h,target:a,throughPath:o.length?this.getThroughPath(o):h}:{path:h,target:a}}hitPoint(t,e,i){return!!this.getByPoint(t,e,i).target}getBestMatchLeaf(t,e,i,s){const n=this.findList=new Ph;if(t.length){let e;const{x:s,y:r}=this.point,o={x:s,y:r,radiusX:0,radiusY:0};for(let s=0,r=t.length;s<r;s++)if(e=t[s],(i||po.worldHittable(e))&&(this.hitChild(e,e.hitThrough?this.point:o,e.mask&&e.parent&&e.parent.__onlyHitMask),n.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&po.hasParent(t,e))){n.reset();break}return n.list[0]}}if(e)for(let t=0,i=e.length;t<i;t++)if(this.hitChild(e[t].target,this.point,void 0,e[t].proxy),n.length)return n.list[0];return s?null:i?t[0]:t.find(t=>po.worldHittable(t))}getPath(t){const e=new Ph,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 Ph;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 Ph,i=[];for(let e=t.length-1;e>-1;e--)i.push(this.getPath(t[e]));let s,n,r;for(let t=0,o=i.length;t<o;t++){s=i[t],n=i[t+1];for(let t=0,i=s.length;t<i&&(r=s.list[t],!n||!n.has(r));t++)e.add(r)}return e}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let i,s,n;const{point:r}=this;for(let o=t.length-1;o>-1;o--)if(i=t[o],n=i.__,n.visible&&(!e||n.mask))if(s=qh(i.__world,n.hitRadius?Gh(Vh,r,n.hitRadius):r),i.isBranch){if(s||i.__ignoreHitWorld){if(i.isBranchLeaf&&n.__clipAfterFill&&!i.__hitWorld(r,!0))continue;i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,r,e)}}else s&&this.hitChild(i,r,e)}hitChild(t,e,i,s){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e,!(!i||"path"!==t.mask)||void 0)){const{parent:i,mask:n}=t;if(i&&i.__hasMask&&n&&"clipping"!==n&&"clipping-path"!==n&&!i.children.some(t=>!t.mask&&this.isHitLeaf(t,e)))return;const r=s||t,{hitThrough:o}=t,{findList:a}=this;if(o){const e=a.list.findIndex(e=>"parent"===o?po.hasParent(e.parent,t.parent):e[o]===t[o]);if(e>0)return a.addAt(r,e)}a.add(r)}}isHitLeaf(t,e){if(t.isBranch){const{findList:e}=this,i=e.length;this.eachFind([t],!1);const s=e.length-i;for(let t=0;t<s;t++)e.remove(e.indexAt(e.length-1));return!!s}return t.__hitWorld(e)}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class Zh{constructor(t,e){this.config={},e&&(this.config=g.default(e,this.config)),this.picker=new Kh(this.target=t,this),this.finder=ue.finder&&ue.finder(t,this.config)}getByPoint(t,e,i){const{target:s,picker:n}=this;return ee.backgrounder&&s&&s.updateLayout(),n.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):ce.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Qh(t){return _r(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0);const i=this.__layout;i.renderChanged||i.renderChange(),i.surfaceChange()}}))}function $h(t){return _r(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Jh(){return(t,e)=>{const i="_"+e;cr(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(ue,{watcher:(t,e)=>new Rh(t,e),layouter:(t,e)=>new Xh(t,e),renderer:(t,e,i)=>new jh(t,e,i),selector:(t,e)=>new Zh(t,e)}),ee.layout=Xh.fullLayout,ee.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new Ph,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const tl={},el={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}},il=Qt,sl={},nl={},rl={},ol={},al={},hl={apply(){ce.need("filter")}},ll={},dl={setStyleName:()=>ce.need("state"),set:()=>ce.need("state")},cl={list:{},register(t,e){cl.list[t]=e},get:t=>cl.list[t]},{parse:ul,objectToCanvasData:pl}=ss,{stintSet:_l}=g,{hasTransparent:gl}=el,fl={originPaint:{}},yl=ne.get("UIData");class ml extends y{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,e=t.__hasStrokeSides||t.strokeWidth;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,e):e}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 null==this._width}get __autoHeight(){return null==this._height}get __autoSide(){return null==this._width||null==this._height}get __autoSize(){return null==this._width&&null==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,yl.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,yl.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),h(t)||!t?(_l(this,"__isTransparentFill",gl(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):p(t)&&this.__setPaint("fill",t)}setStroke(t){h(t)||!t?(_l(this,"__isTransparentStroke",gl(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):p(t)&&this.__setPaint("stroke",t)}setPath(t){const e=h(t);e||t&&p(t[0])?(this.__setInput("path",t),this._path=e?ul(t,this.__useArrow):pl(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){vl(this,"shadow",t)}setInnerShadow(t){vl(this,"innerShadow",t)}setFilter(t){vl(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&nl.compute("fill",this.__leaf),e&&nl.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeScaleFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),o(t.strokeScaleFixed)||(i=t.strokeScaleFixed)),i){const{scaleX:t}=this.__leaf.getRenderScaleData(!0,i,!1);if(1!==t)return e*t}return e}__checkComplex(){const t=this;_l(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),u(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=fl)):(this.__isStrokes=!0,this._stroke||(this._stroke=fl))}__removePaint(t,e){e&&this.__removeInput(t),rl.recycleImage(t,this),"fill"===t?(_l(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(_l(this,"__isAlphaPixelStroke",void 0),_l(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function vl(t,e,i){t.__setInput(e,i),u(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 wl extends ml{}class xl extends wl{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 bl extends wl{__getInputData(t,e){const i=super.__getInputData(t,e);return De.forEach(t=>delete i[t]),i}}class El extends xl{}class Pl extends ml{get __usePathBox(){return this.points||this.__pathInputed}}class Sl extends ml{get __boxStroke(){return!this.__pathInputed}}class kl extends ml{get __boxStroke(){return!this.__pathInputed}}class Bl extends ml{get __usePathBox(){return this.points||this.__pathInputed}}class Tl extends ml{}class Cl extends ml{get __pathInputed(){return 2}}class Rl extends wl{}const Ll={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class Dl extends ml{get __useNaturalRatio(){return!1}setFontWeight(t){h(t)?(this.__setInput("fontWeight",t),t=Ll[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=_e.get("Rect",0);const n=e.__layout,r=i.__layout;s||(i.parent=e,i.__world=e.__world,r.boxBounds=n.boxBounds),i.set(t),r.strokeChanged&&n.strokeChange()}else i&&(e.__box=i.parent=null,i.destroy());this._boxStyle=t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.textEditing&&delete i.textEditing,i}}class Al extends Sl{get __urlType(){return"image"}setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:this.__urlType,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 Ol extends Sl{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:Il,add:Ml}=S,Fl={__updateStrokeSpread(){let t=0,e=0;const i=this.__,{strokeAlign:s,__maxStrokeWidth:n}=i,r=this.__box;if((i.stroke||"all"===i.hitStroke)&&n&&"inside"!==s&&(e=t="center"===s?n/2:n,!i.__boxStroke||i.__useArrow)){const e=i.__isLinePath?0:("miter"===i.strokeJoin?10:1)*t,s="none"===i.strokeCap?0:n;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*n),r&&(t=Il(t,r.__layout.strokeSpread=r.__updateStrokeSpread()),e=Math.max(e,r.__layout.strokeBoxSpread)),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:i,blur:s,backgroundBlur:n,filter:r,renderSpread:o}=this.__,{strokeSpread:a}=this.__layout,h=this.__box;e&&(t=al.getShadowRenderSpread(this,e)),s&&(t=Il(t,s)),r&&(t=Ml(t,hl.getSpread(r))),o&&(t=Ml(t,o)),a&&(t=Ml(t,a));let l=t;return i&&(l=Il(l,al.getInnerShadowSpread(this,i))),n&&(l=Il(l,n)),this.__layout.renderShapeSpread=l,h?Il(h.__updateRenderSpread(),t):t}},{stintSet:Wl}=g,Ul={__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,n=t.innerShadow||t.blur||t.backgroundBlur||t.filter;Wl(t,"__isFastShadow",e&&!n&&e.length<2&&!e[0].spread&&!al.isTransformShadow(e[0])&&!(e[0].blendMode&&"pass-through"!==e[0].blendMode)&&i&&!t.__isTransparentFill&&!(u(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!n)}t.__checkSingle(),t.__checkComplex()},__drawFast(t,e){Nl(this,t,e)},__draw(t,e,i){const s=this.__;if(s.__complex){s.__needComputePaint&&s.__computePaint();const{fill:n,stroke:r,__drawAfterFill:o,__fillAfterStroke:a,__isFastShadow:h}=s;if(this.__drawRenderPath(t),s.__useEffect&&!h){const h=nl.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&al.shadow(this,t,h),a&&(s.__isStrokes?nl.strokes(r,this,t,e):nl.stroke(r,this,t,e)),n&&(s.__isFills?nl.fills(n,this,t,e):nl.fill(n,this,t,e)),o&&this.__drawAfterFill(t,e),d&&al.innerShadow(this,t,h),r&&!a&&(s.__isStrokes?nl.strokes(r,this,t,e):nl.stroke(r,this,t,e)),c&&hl.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?nl.strokes(r,this,t,e):nl.stroke(r,this,t,e)),h){const e=s.shadow[0],{scaleX:i,scaleY:n}=this.getRenderScaleData(!0,e.scaleFixed);t.save(),t.setWorldShadow(e.x*i,e.y*n,e.blur*i,el.string(e.color))}n&&(s.__isFills?nl.fills(n,this,t,e):nl.fill(n,this,t,e)),h&&t.restore(),o&&this.__drawAfterFill(t,e),r&&!a&&(s.__isStrokes?nl.strokes(r,this,t,e):nl.stroke(r,this,t,e))}}else s.__pathForRender?Nl(this,t,e):this.__drawFast(t,e)},__drawShape(t,e){this.__drawRenderPath(t);const i=this.__,{fill:s,stroke:n}=i;s&&!e.ignoreFill&&(i.__isAlphaPixelFill?nl.fills(s,this,t,e):nl.fill("#000000",this,t,e)),i.__isCanvas&&this.__drawAfterFill(t,e),n&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?nl.strokes(n,this,t,e):nl.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 Nl(t,e,i){const{fill:s,stroke:n,__drawAfterFill:r,__fillAfterStroke:o}=t.__;t.__drawRenderPath(e),o&&nl.stroke(n,t,e,i),s&&nl.fill(s,t,e,i),r&&t.__drawAfterFill(e,i),n&&!o&&nl.stroke(n,t,e,i)}const zl={__drawFast(t,e){let{x:i,y:s,width:n,height:r}=this.__layout.boxBounds;const{fill:o,stroke:a,__drawAfterFill:h}=this.__;if(o&&(t.fillStyle=o,t.fillRect(i,s,n,r)),h&&this.__drawAfterFill(t,e),a){const{strokeAlign:o,__strokeWidth:h}=this.__;if(!h)return;t.setStroke(a,h,this.__);const l=h/2;switch(o){case"center":t.strokeRect(0,0,n,r);break;case"inside":n-=h,r-=h,n<0||r<0?(t.save(),this.__clip(t,e),t.strokeRect(i+l,s+l,n,r),t.restore()):t.strokeRect(i+l,s+l,n,r);break;case"outside":t.strokeRect(i-l,s-l,n+h,r+h)}}}};var Yl,Xl;t.UI=Yl=class extends t.Leaf{get app(){return this.leafer&&this.leafer.app}set strokeWidthFixed(t){this.strokeScaleFixed=t}get strokeWidthFixed(){return this.strokeScaleFixed}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 Kn.set(this.path=t||[]),t||this.__drawPathByBox(Kn),Kn}set(t,e){t&&Object.assign(this,t)}get(t){return h(t)?this.__.__getInput(t):this.__.__getInputData(t)}find(t,e){return ce.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return ce.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(Kn.set(i=[]),this.__drawPathByBox(Kn,!e)),t?ss.toCanvasData(i,!0):i}getPathString(t,e,i){return ss.stringify(this.getPath(t,e),i)}asPath(t,e){this.path=this.getPath(t,e)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||ll.running?t.__computePaint():t.__needComputePaint=!0}}__updatePath(){}__updateRenderPath(t){const e=this.__;e.path?(e.__pathForRender=e.cornerRadius||e.path.radius?Gn.smooth(e.path,e.cornerRadius,e.cornerSmoothing):e.path,e.__useArrow&&sl.addArrows(this,t)):e.__pathForRender&&(e.__pathForRender=void 0)}__drawRenderPath(t){const e=this.__;t.beginPath(),e.__useArrow&&sl.updateArrow(this),this.__drawPathByData(t,e.__pathForRender)}__drawPath(t){const e=this.__;t.beginPath(),e.__usePointsMode?hn.drawPathByPoints(t,e.points,e.closed):this.__drawPathByData(t,e.path,!0)}__drawPathByData(t,e,i){e?hn.drawPathByData(t,e):this.__drawPathByBox(t,i)}__drawPathByBox(t,e){const{x:i,y:s,width:n,height:r}=this.__layout.boxBounds;if(this.__.cornerRadius&&!e){const{cornerRadius:e}=this.__;t.roundRect(i,s,n,r,d(e)?[e]:e)}else t.rect(i,s,n,r);t.closePath()}drawImagePlaceholder(t,e,i){nl.fill(this.__.placeholderColor,this,e,i)}animate(t,e,i,s){return this.set(t),ce.need("animate")}killAnimate(t,e){}export(t,e){return ce.need("export")}syncExport(t,e){return ce.need("export")}clone(t){const e=g.clone(this.toJSON());return t&&Object.assign(e,t),Yl.one(e)}static one(t,e,i,s,n){return _e.get(t.tag||this.prototype.__tag,t,e,i,s,n)}static registerUI(){Jr()(this)}static registerData(t){Hr(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.__.__willDestroy=!0,this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}},s([Hr(ml)],t.UI.prototype,"__",void 0),s([Jh()],t.UI.prototype,"zoomLayer",void 0),s([yr("")],t.UI.prototype,"id",void 0),s([yr("")],t.UI.prototype,"name",void 0),s([yr("")],t.UI.prototype,"className",void 0),s([Dr("pass-through")],t.UI.prototype,"blendMode",void 0),s([Ir(1)],t.UI.prototype,"opacity",void 0),s([Mr(!0)],t.UI.prototype,"visible",void 0),s([Dr(!1)],t.UI.prototype,"locked",void 0),s([Or(!1)],t.UI.prototype,"dim",void 0),s([Or(!1)],t.UI.prototype,"dimskip",void 0),s([Ur(0)],t.UI.prototype,"zIndex",void 0),s([Nr(!1)],t.UI.prototype,"mask",void 0),s([zr(!1)],t.UI.prototype,"eraser",void 0),s([mr(0,!0)],t.UI.prototype,"x",void 0),s([mr(0,!0)],t.UI.prototype,"y",void 0),s([Er(100,!0)],t.UI.prototype,"width",void 0),s([Er(100,!0)],t.UI.prototype,"height",void 0),s([xr(1,!0)],t.UI.prototype,"scaleX",void 0),s([xr(1,!0)],t.UI.prototype,"scaleY",void 0),s([br(0,!0)],t.UI.prototype,"rotation",void 0),s([br(0,!0)],t.UI.prototype,"skewX",void 0),s([br(0,!0)],t.UI.prototype,"skewY",void 0),s([mr(0,!0)],t.UI.prototype,"offsetX",void 0),s([mr(0,!0)],t.UI.prototype,"offsetY",void 0),s([vr(0,!0)],t.UI.prototype,"scrollX",void 0),s([vr(0,!0)],t.UI.prototype,"scrollY",void 0),s([wr()],t.UI.prototype,"origin",void 0),s([wr()],t.UI.prototype,"around",void 0),s([yr(!1)],t.UI.prototype,"lazy",void 0),s([Pr(1)],t.UI.prototype,"pixelRatio",void 0),s([Lr(0)],t.UI.prototype,"renderSpread",void 0),s([kr()],t.UI.prototype,"path",void 0),s([Br()],t.UI.prototype,"windingRule",void 0),s([Br(!0)],t.UI.prototype,"closed",void 0),s([Er(0)],t.UI.prototype,"padding",void 0),s([Er(!1)],t.UI.prototype,"lockRatio",void 0),s([Er()],t.UI.prototype,"widthRange",void 0),s([Er()],t.UI.prototype,"heightRange",void 0),s([yr(!1)],t.UI.prototype,"draggable",void 0),s([yr()],t.UI.prototype,"dragBounds",void 0),s([yr("auto")],t.UI.prototype,"dragBoundsType",void 0),s([yr(!1)],t.UI.prototype,"editable",void 0),s([Yr(!0)],t.UI.prototype,"hittable",void 0),s([Yr()],t.UI.prototype,"hitThrough",void 0),s([Yr("path")],t.UI.prototype,"hitFill",void 0),s([Rr("path")],t.UI.prototype,"hitStroke",void 0),s([Yr(!1)],t.UI.prototype,"hitBox",void 0),s([Yr(!0)],t.UI.prototype,"hitChildren",void 0),s([Yr(!0)],t.UI.prototype,"hitSelf",void 0),s([Yr()],t.UI.prototype,"hitRadius",void 0),s([Xr("")],t.UI.prototype,"cursor",void 0),s([Dr()],t.UI.prototype,"fill",void 0),s([Rr(void 0,!0)],t.UI.prototype,"stroke",void 0),s([Rr("inside")],t.UI.prototype,"strokeAlign",void 0),s([Rr(1,!0)],t.UI.prototype,"strokeWidth",void 0),s([Rr(!1)],t.UI.prototype,"strokeScaleFixed",void 0),s([Rr("none")],t.UI.prototype,"strokeCap",void 0),s([Rr("miter")],t.UI.prototype,"strokeJoin",void 0),s([Rr()],t.UI.prototype,"dashPattern",void 0),s([Rr(0)],t.UI.prototype,"dashOffset",void 0),s([Rr(10)],t.UI.prototype,"miterLimit",void 0),s([Br(0)],t.UI.prototype,"cornerRadius",void 0),s([Br()],t.UI.prototype,"cornerSmoothing",void 0),s([Qh()],t.UI.prototype,"shadow",void 0),s([Qh()],t.UI.prototype,"innerShadow",void 0),s([Qh()],t.UI.prototype,"blur",void 0),s([Qh()],t.UI.prototype,"backgroundBlur",void 0),s([Qh()],t.UI.prototype,"grayscale",void 0),s([Qh()],t.UI.prototype,"filter",void 0),s([Dr()],t.UI.prototype,"placeholderColor",void 0),s([yr(100)],t.UI.prototype,"placeholderDelay",void 0),s([yr({})],t.UI.prototype,"data",void 0),t.UI=Yl=s([$r(Fl),$r(Ul),Zr()],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);if(!this.childlessJSON){const i=e.children=[];this.children.forEach(e=>e.skipJSON||i.push(e.toJSON(t)))}return 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))}},s([Hr(wl)],t.Group.prototype,"__",void 0),s([Er(0)],t.Group.prototype,"width",void 0),s([Er(0)],t.Group.prototype,"height",void 0),t.Group=s([$r(t.Branch),Jr()],t.Group);const Hl=ne.get("Leafer");t.Leafer=Xl=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&&nr.isComplete}get layoutLocked(){return!this.layouter.running}get view(){return this.canvas&&this.canvas.view}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,trackChanges:!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),Xl.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,g.assign(s,t));const n=this.canvas=ue.canvas(s);this.__controllers.push(this.renderer=ue.renderer(this,n,s),this.watcher=ue.watcher(this,s),this.layouter=ue.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),e||(this.selector=ue.selector(this),this.interaction=ue.interaction(this,n,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=ue.hitCanvasManager()),this.canvasManager=new ve,i=s.start),this.hittable=s.hittable,this.fill=s.fill,this.canvasManager.add(n),this.__listenEvents(),i&&(this.__startTimer=setTimeout(this.start.bind(this))),Lo.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(na.RESTART):this.emitLeafer(na.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(na.STOP))}unlockLayout(t=!0){this.layouter.start(),t&&this.updateLayout()}lockLayout(t=!0){t&&this.updateLayout(),this.layouter.stop()}resize(t){const e=g.copyAttrs({},t,De);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new qt(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=g.copyAttrs({},this.canvas,De);e.resize(t),this.updateLazyBounds(),this.__onResize(new ta(t,i))}__onResize(t){this.emitEvent(t),g.copyAttrs(this.__,t,De),setTimeout(()=>{this.canvasManager&&this.canvasManager.clearRecycled()},0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager}__setLeafer(t){this.leafer=t,this.__level=1}__checkAutoLayout(){const{config:t,parentApp:e}=this;e||(t.width&&t.height||(this.autoLayout=new Zt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(De.includes(t)?this.__changeCanvasSize(t,e):"fill"===t?this.__changeFill(e):"hittable"===t?this.parent||(this.canvas.hittable=e):"zIndex"===t?(this.canvas.zIndex=e,setTimeout(()=>this.parent&&this.parent.__updateSortChildren())):"mode"===t&&this.emit(na.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&De.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,n=g.copyAttrs({},s,De);n[t]=i[t]=e,i.width&&i.height?s.stopAutoLayout():this.__checkAutoLayout(),this.__doResize(n)}__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(na.BEFORE_READY),this.emitLeafer(na.READY),this.emitLeafer(na.AFTER_READY),Lo.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(na.VIEW_READY),Lo.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:i}=this.config;if(t){let{width:s,height:n,pixelRatio:r}=this;const o="box"===t?this.worldBoxBounds:this.__world;e||(s=Math.max(1,o.x+o.width)),i||(n=Math.max(1,o.y+o.height)),this.__doResize({width:s,height:n,pixelRatio:r})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){Lo.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(na.VIEW_COMPLETED),Lo.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 ce.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 na(t,this))}__listenEvents(){const t=he.start("FirstCreate "+this.innerName);this.once([[na.START,()=>he.end(t)],[ia.START,this.updateLazyBounds,this],[sa.START,this.__onCreated,this],[sa.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[ea.DATA,this.__onWatchData,this],[ia.END,this.__onLayoutEnd,this],[sa.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Xl.list.remove(this);try{this.stop(),this.emitLeafer(na.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.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{or.clearRecycled()},100)}catch(t){Hl.error(t)}}};t?e():setTimeout(e)}},t.Leafer.list=new Ph,s([Hr(bl)],t.Leafer.prototype,"__",void 0),s([Er()],t.Leafer.prototype,"pixelRatio",void 0),s([yr("normal")],t.Leafer.prototype,"mode",void 0),t.Leafer=Xl=s([Jr()],t.Leafer),t.Rect=class extends t.UI{get __tag(){return"Rect"}},s([Hr(Sl)],t.Rect.prototype,"__",void 0),t.Rect=s([$r(zl),Zr(),Jr()],t.Rect);const{add:jl,includes:Vl,scroll:Gl}=Ht,ql=t.Rect.prototype,Kl=t.Group.prototype;t.Box=class extends t.Group{get __tag(){return"Box"}get isBranchLeaf(){return!0}get __useSelfBox(){return this.pathInputed}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.__useSelfBox){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:n,boxBounds:r}=s,{overflow:o}=i,a=s.childrenRenderBounds||(s.childrenRenderBounds={x:0,y:0,width:0,height:0});super.__updateRenderBounds(a),(e=o&&o.includes("scroll"))&&(jl(a,r),Gl(a,i)),this.__updateRectRenderBounds(),t=!Vl(r,a),t&&"show"===o&&jl(n,a)}else this.__updateRectRenderBounds();g.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))}},s([Hr(xl)],t.Box.prototype,"__",void 0),s([Er(100)],t.Box.prototype,"width",void 0),s([Er(100)],t.Box.prototype,"height",void 0),s([yr(!1)],t.Box.prototype,"resizeChildren",void 0),s([Lr("show")],t.Box.prototype,"overflow",void 0),s([Kr(ql.__updateStrokeSpread)],t.Box.prototype,"__updateStrokeSpread",null),s([Kr(ql.__updateRenderSpread)],t.Box.prototype,"__updateRectRenderSpread",null),s([Kr(ql.__updateBoxBounds)],t.Box.prototype,"__updateRectBoxBounds",null),s([Kr(ql.__updateStrokeBounds)],t.Box.prototype,"__updateStrokeBounds",null),s([Kr(ql.__updateRenderBounds)],t.Box.prototype,"__updateRectRenderBounds",null),s([Kr(ql.__updateChange)],t.Box.prototype,"__updateRectChange",null),s([Kr(ql.__render)],t.Box.prototype,"__renderRect",null),s([Kr(Kl.__render)],t.Box.prototype,"__renderGroup",null),t.Box=s([Zr(),Jr()],t.Box),t.Frame=class extends t.Box{get __tag(){return"Frame"}get isFrame(){return!0}},s([Hr(El)],t.Frame.prototype,"__",void 0),s([Dr("#FFFFFF")],t.Frame.prototype,"fill",void 0),s([Lr("hide")],t.Frame.prototype,"overflow",void 0),t.Frame=s([Jr()],t.Frame);const{moveTo:Zl,closePath:Ql,ellipse:$l}=Bs,{tempPoint:Jl,set:td,rotate:ed}=lt,{abs:id}=Math,sd={};t.Ellipse=class extends t.UI{get __tag(){return"Ellipse"}__updatePath(){const t=this.__,{width:e,height:i,innerRadius:s,startAngle:n,endAngle:r,closed:o}=t,a=e/2,h=i/2,l=t.path=[];let d,c,u;if((n||r)&&(c=!0),c&&(u=360===id(r-n)),s){const t=s<1||o,e=a*s,i=h*s;c?($l(l,a,h,a,h,0,n,r),t?(u&&(Ql(l),td(Jl,a+e,h),td(sd,a,h),ed(Jl,r,sd,a,h),Zl(l,Jl.x,Jl.y)),$l(l,a,h,e,i,0,r,n,!0)):u||(d=!0)):($l(l,a,h,a,h),t&&(Ql(l),Zl(l,a+e,h),$l(l,a,h,e,i,0,360,0,!0)))}else c?(u||(o||(d=!0),d||Zl(l,a,h)),$l(l,a,h,a,h,0,n,r)):$l(l,a,h,a,h);d||Ql(l),(ee.ellipseToCurve||t.__useArrow||t.cornerRadius)&&(t.path=this.getPath(!0))}},s([Hr(kl)],t.Ellipse.prototype,"__",void 0),s([Br(0)],t.Ellipse.prototype,"innerRadius",void 0),s([Br(0)],t.Ellipse.prototype,"startAngle",void 0),s([Br(0)],t.Ellipse.prototype,"endAngle",void 0),t.Ellipse=s([Jr()],t.Ellipse);const{sin:nd,cos:rd,PI:od}=Math,{moveTo:ad,lineTo:hd,closePath:ld,drawPoints:dd}=Bs;t.Polygon=class extends t.UI{get __tag(){return"Polygon"}get isPointsMode(){return this.points&&!this.pathInputed}__updatePath(){const t=this.__,e=t.path=[];if(t.points)dd(e,t.points,t.curve,t.closed,t);else{const{width:i,height:s,sides:n,startAngle:r}=t,o=i/2,a=s/2;let h,l=0;r?(l=r*W,ad(e,o+o*nd(l),a-a*rd(l))):ad(e,o,0);for(let t=1;t<n;t++)h=2*t*od/n+l,hd(e,o+o*nd(h),a-a*rd(h));ld(e)}}},s([Hr(Bl)],t.Polygon.prototype,"__",void 0),s([Br(3)],t.Polygon.prototype,"sides",void 0),s([Br(0)],t.Polygon.prototype,"startAngle",void 0),s([Br()],t.Polygon.prototype,"points",void 0),s([Br(0)],t.Polygon.prototype,"curve",void 0),t.Polygon=s([Zr(),Jr()],t.Polygon);const{sin:cd,cos:ud,PI:pd}=Math,{moveTo:_d,lineTo:gd,closePath:fd}=Bs;t.Star=class extends t.UI{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s,startAngle:n}=this.__,r=t/2,o=e/2,a=this.__.path=[];let h,l=0;n?(l=n*W,_d(a,r+r*cd(l),o-o*ud(l))):_d(a,r,0);for(let t=1;t<2*i;t++)h=t*pd/i+l,gd(a,r+(t%2==0?r:r*s)*cd(h),o-(t%2==0?o:o*s)*ud(h));fd(a)}},s([Hr(Tl)],t.Star.prototype,"__",void 0),s([Br(5)],t.Star.prototype,"corners",void 0),s([Br(.382)],t.Star.prototype,"innerRadius",void 0),s([Br(0)],t.Star.prototype,"startAngle",void 0),t.Star=s([Jr()],t.Star);const{moveTo:yd,lineTo:md,drawPoints:vd}=Bs,{rotate:wd,getAngle:xd,getDistance:bd,defaultPoint:Ed}=lt;t.Line=class extends t.UI{get __tag(){return"Line"}get isPointsMode(){return this.points&&!this.pathInputed}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&wd(i,e),i}set toPoint(t){this.width=bd(Ed,t),this.rotation=xd(Ed,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?vd(e,t.points,t.curve,t.closed,t):(yd(e,0,0),md(e,this.width,0))}},s([Hr(Pl)],t.Line.prototype,"__",void 0),s([Tr("center")],t.Line.prototype,"strokeAlign",void 0),s([Er(0)],t.Line.prototype,"height",void 0),s([Br()],t.Line.prototype,"points",void 0),s([Br(0)],t.Line.prototype,"curve",void 0),s([Br(!1)],t.Line.prototype,"closed",void 0),t.Line=s([Jr()],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 u(t)&&t[0].image}},s([Hr(Al)],t.Image.prototype,"__",void 0),s([Er("")],t.Image.prototype,"url",void 0),t.Image=s([Jr()],t.Image);const Pd=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=ue.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new dr({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new Go(Go.LOADED,{image:t}))})}draw(t,e,i,s){const n=new yt(t.worldTransform).invert(),r=new yt;e&&r.translate(e.x,e.y),i&&(d(i)?r.scale(i):r.scale(i.x,i.y)),s&&r.rotate(s),n.multiplyParent(r),t.__render(this.canvas,{matrix:n.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:i,height:s}=this.__,{view:n}=this.canvas;t.drawImage(n,0,0,n.width,n.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()}},s([Hr(Ol)],t.Canvas.prototype,"__",void 0),s([$h(100)],t.Canvas.prototype,"width",void 0),s([$h(100)],t.Canvas.prototype,"height",void 0),s([$h(1)],t.Canvas.prototype,"pixelRatio",void 0),s([$h(!0)],t.Canvas.prototype,"smooth",void 0),s([yr(!1)],t.Canvas.prototype,"safeResize",void 0),s([$h()],t.Canvas.prototype,"contextSettings",void 0),t.Canvas=s([Jr()],t.Canvas);const{copyAndSpread:Sd,includes:kd,setList:Bd}=Ht,{stintSet:Td}=g;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:n,fontWeight:r,italic:o,textCase:a,textOverflow:h,padding:l,width:d,height:c}=t;t.__lineHeight=il.number(e,n),t.__letterSpacing=il.number(i,n),t.__baseLine=t.__lineHeight-(t.__lineHeight-.7*n)/2,t.__font=`${o?"italic ":""}${"small-caps"===a?"small-caps ":""}${"normal"!==r?r+" ":""}${n||12}px ${s||"caption"}`,Td(t,"__padding",l&&M.fourNumber(l)),Td(t,"__clipText","show"!==h&&!t.__autoSize),Td(t,"__isCharMode",d||c||t.__letterSpacing||t.motionText||"none"!==a),t.__textDrawData=tl.getDrawData((t.__isPlacehold=t.placeholder&&""===t.text)?t.placeholder:t.text,this.__)}__updateBoxBounds(){const t=this.__,e=this.__layout,{fontSize:i,italic:s,padding:n,__autoWidth:r,__autoHeight:o}=t;this.__updateTextDrawData();const{bounds:a}=t.__textDrawData,h=e.boxBounds;if(e.contentBounds=a,t.__lineHeight<i&&(e.renderChanged=!0),r||o){if(h.x=r?a.x:0,h.y=o?a.y:0,h.width=r?a.width:t.width,h.height=o?a.height:t.height,n){const[e,i,s,n]=t.__padding;r&&(h.x-=n,h.width+=i+n),o&&(h.y-=e,h.height+=s+e)}this.__updateNaturalSize()}else super.__updateBoxBounds();s&&(h.width+=.16*i),g.stintSet(this,"isOverflow",!kd(h,a)&&!t.motionText),this.isOverflow?(Bd(t.__textBoxBounds={},[h,a]),e.renderChanged=!0):t.__textBoxBounds=h}__updateRenderSpread(){let t=super.__updateRenderSpread();t||(t=this.isOverflow?1:0);const{__lineHeight:e,fontSize:i}=this.__;return e<i&&(t=S.max(t,(i-e)/2)),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()}},s([Hr(Dl)],t.Text.prototype,"__",void 0),s([Er(0)],t.Text.prototype,"width",void 0),s([Er(0)],t.Text.prototype,"height",void 0),s([Dr()],t.Text.prototype,"boxStyle",void 0),s([yr(!1)],t.Text.prototype,"resizeFontSize",void 0),s([Dr("#000000")],t.Text.prototype,"fill",void 0),s([Tr("outside")],t.Text.prototype,"strokeAlign",void 0),s([Yr("all")],t.Text.prototype,"hitFill",void 0),s([Er("")],t.Text.prototype,"text",void 0),s([Er("")],t.Text.prototype,"placeholder",void 0),s([Er("caption")],t.Text.prototype,"fontFamily",void 0),s([Er(12)],t.Text.prototype,"fontSize",void 0),s([Er("normal")],t.Text.prototype,"fontWeight",void 0),s([Er(!1)],t.Text.prototype,"italic",void 0),s([Er("none")],t.Text.prototype,"textCase",void 0),s([Er("none")],t.Text.prototype,"textDecoration",void 0),s([Er(0)],t.Text.prototype,"letterSpacing",void 0),s([Er({type:"percent",value:1.5})],t.Text.prototype,"lineHeight",void 0),s([Er(0)],t.Text.prototype,"paraIndent",void 0),s([Er(0)],t.Text.prototype,"paraSpacing",void 0),s([Er("x")],t.Text.prototype,"writingMode",void 0),s([Er("left")],t.Text.prototype,"textAlign",void 0),s([Er("top")],t.Text.prototype,"verticalAlign",void 0),s([Er(!0)],t.Text.prototype,"autoSizeAlign",void 0),s([Er("normal")],t.Text.prototype,"textWrap",void 0),s([Er("show")],t.Text.prototype,"textOverflow",void 0),s([Dr(!1)],t.Text.prototype,"textEditing",void 0),t.Text=s([Jr()],t.Text),t.Path=class extends t.UI{get __tag(){return"Path"}},s([Hr(Cl)],t.Path.prototype,"__",void 0),s([Tr("center")],t.Path.prototype,"strokeAlign",void 0),t.Path=s([Jr()],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}paint(){const{pathElement:t}=this;t.__layout.boxChanged||t.forceUpdate("path")}},s([Hr(Rl)],t.Pen.prototype,"__",void 0),s([(t,e)=>{cr(t,e,{get(){return this.__path}})}],t.Pen.prototype,"path",void 0),t.Pen=s([$r(Vs,["set","path","paint"]),Jr()],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:n}=t;e&&(this.ground=this.addLeafer(e)),(i||n)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||n)&&(this.sky=this.addLeafer(s)),n&&ue.editor(n,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),o(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,void 0,void 0,!0))}__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&&g.assign(e,t),this.autoLayout&&g.copyAttrs(e,this,De),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[ia.END,this.__onReady,this],[sa.START,this.__onCreated,this],[sa.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(sa.END,this.__onChildRenderEnd,this))}},t.App=s([Jr()],t.App);const Cd={},Rd={isHoldSpaceKey:()=>Rd.isHold("Space"),isHold:t=>Cd[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){Cd[t]||(Cd[t]=!0)},setUpCode(t){Cd[t]=!1}},Ld={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 Dd extends Yo{get spaceKey(){return Rd.isHoldSpaceKey()}get left(){return Ld.left(this)}get right(){return Ld.right(this)}get middle(){return Ld.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return Rd.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){ye.changeName(t,e)}}const{min:Ad,max:Od,abs:Id}=Math,{float:Md,sign:Fd}=M,{minX:Wd,maxX:Ud,minY:Nd,maxY:zd}=Ht,Yd=new qt,Xd=new qt,Hd={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&jd.getValidMove(t.__localBoxBounds,jd.getDragBounds(t),s,e,!0),jd.axisMove(t,e)},limitScaleOf(t,e,i,s){const{dragBounds:n,dragBoundsType:r}=t;n&&jd.getValidScaleOf(t.__localBoxBounds,jd.getDragBounds(t),r,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&&Md(t[s])>Md(e[s]),getValidMove(t,e,i,s,n){const r=t.x+s.x,o=t.y+s.y,a=r+t.width,h=o+t.height,l=e.x+e.width,d=e.y+e.height;return n||(s=Object.assign({},s)),jd.isInnerMode(t,e,i,"width")?r>e.x?s.x+=e.x-r:a<l&&(s.x+=l-a):r<e.x?s.x+=e.x-r:a>l&&(s.x+=l-a),jd.isInnerMode(t,e,i,"height")?o>e.y?s.y+=e.y-o:h<d&&(s.y+=d-h):o<e.y?s.y+=e.y-o:h>d&&(s.y+=d-h),s.x=Md(s.x),s.y=Md(s.y),s},getValidScaleOf(t,e,i,s,n,r,o){o||(n=Object.assign({},n)),Xd.set(e),Yd.set(t).scaleOf(s,n.x,n.y);const a=Md((s.x-t.x)/t.width),h=Md(1-a),d=Md((s.y-t.y)/t.height),c=Md(1-d);let u,p,_,g,f=1,y=1;return jd.isInnerMode(t,e,i,"width")?(n.x<0&&Yd.scaleOf(s,f=1/n.x,1),_=Md(Yd.minX-Xd.minX),g=Md(Xd.maxX-Yd.maxX),u=a&&_>0?1+_/(a*Yd.width):1,p=h&&g>0?1+g/(h*Yd.width):1,f*=Od(u,p)):(n.x<0&&((Md(Wd(t)-Wd(e),2)<=0||Md(Ud(e)-Ud(t),2)<=0)&&(Yd.scaleOf(s,f=1/n.x,1),Yd.width>1&&(f*=1/Yd.width,Yd.width=1)),Yd.unsign()),_=Md(Xd.minX-Yd.minX),g=Md(Yd.maxX-Xd.maxX),u=a&&_>0?1-_/(a*Yd.width):1,p=h&&g>0?1-g/(h*Yd.width):1,f*=Ad(u,p)),jd.isInnerMode(t,e,i,"height")?(n.y<0&&Yd.scaleOf(s,1,y=1/n.y),_=Md(Yd.minY-Xd.minY),g=Md(Xd.maxY-Yd.maxY),u=d&&_>0?1+_/(d*Yd.height):1,p=c&&g>0?1+g/(c*Yd.height):1,y*=Od(u,p),r&&(u=Od(Id(f),Id(y)),f=Fd(f)*u,y=Fd(y)*u)):(n.y<0&&((Md(Nd(t)-Nd(e),2)<=0||Md(zd(e)-zd(t),2)<=0)&&(Yd.scaleOf(s,1,y=1/n.y),Yd.height>1&&(y*=1/Yd.height,Yd.height=1)),Yd.unsign()),_=Md(Xd.minY-Yd.minY),g=Md(Yd.maxY-Xd.maxY),u=d&&_>0?1-_/(d*Yd.height):1,p=c&&g>0?1-g/(c*Yd.height):1,y*=Ad(u,p)),n.x*=l(f)?f:1,n.y*=l(y)?y:1,n}},jd=Hd;t.PointerEvent=class extends Dd{},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=s([to()],t.PointerEvent);const Vd=t.PointerEvent,Gd={};t.DragEvent=class extends t.PointerEvent{static setList(t){this.list=t instanceof Ph?t:new Ph(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const n=t.getLocalPoint(i,null,!0);return lt.move(n,e.x-t.x,e.y-t.y),s&&this.limitMove(t,n),Hd.axisMove(t,n),n}static limitMove(t,e){Hd.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(Gd,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(Gd,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(Gd,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 Ht.set(i,e.x-t.x,e.y-t.y,t.x,t.y),Ht.unsign(i),i}assignMove(t){Gd.x=t?this.totalX:this.moveX,Gd.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.ANIMATE="drag.animate",t.DragEvent=s([to()],t.DragEvent);const qd=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=s([to()],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.DRAG_ANIMATE="move.drag_animate",t.MoveEvent.END="move.end",t.MoveEvent.PULL_DOWN="move.pull_down",t.MoveEvent.REACH_BOTTOM="move.reach_bottom",t.MoveEvent=s([to()],t.MoveEvent),t.TouchEvent=class extends Dd{},t.TouchEvent=s([to()],t.TouchEvent);const Kd=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=s([to()],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=s([to()],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=s([to()],t.ZoomEvent),t.KeyEvent=class extends Dd{},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=s([to()],t.KeyEvent);const Zd={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:Qd.getSwipeDirection(lt.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,time:Date.now(),buttons:o(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 Ph,{list:s}=t;for(let t=0,n=s.length;t<n;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:e=>e&&e.list.some(e=>po.draggable(e)||!e.isLeafer&&e.hasEvent(t.DragEvent.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},Qd=Zd,$d=new Ph,{getDragEventData:Jd,getDropEventData:tc,getSwipeEventData:ec}=Zd;class ic{constructor(t){this.dragDataList=[],this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=Jd(t,t,t),this.canAnimate=this.canDragOut=!0}getList(e,i){const{proxy:s}=this.interaction.selector,n=s&&s.list.length,r=t.DragEvent.list||this.draggableList||$d;return this.dragging&&(n?e?$d:new Ph(i?[...s.list,...s.dragHoverExclude]:s.list):r)}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&&Ld.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],po.draggable(e)){this.draggableList=new Ph(e);break}}drag(e){const{interaction:i,dragData:s,downData:n}=this,{path:r,throughPath:o}=n;this.dragData=Jd(n,s,e),o&&(this.dragData.throughPath=o),this.dragData.path=r,this.dragDataList.push(this.dragData),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,n=this.realDraggableList;if(n.length&&s){const{totalX:s,totalY:r}=this.dragData,{dragLimitAnimate:o}=i.p,a=!o||!!e;n.forEach(i=>{if(i.draggable){const n=h(i.draggable),l=t.DragEvent.getValidMove(i,this.dragStartPoints[i.innerId],{x:s,y:r},a||n);o&&!n&&e?po.animateMove(i,l,d(o)?o:.3,()=>i.emit(t.DragEvent.ANIMATE)):i.move(l)}})}}dragOverOrOut(e){const{interaction:i}=this,{dragOverPath:s}=this,{path:n}=e;this.dragOverPath=n,s?n.indexAt(0)!==s.indexAt(0)&&(i.emit(t.DragEvent.OUT,e,s),i.emit(t.DragEvent.OVER,e,n)):i.emit(t.DragEvent.OVER,e,n)}dragEnterOrLeave(e){const{interaction:i}=this,{dragEnterPath:s}=this,{path:n}=e;i.emit(t.DragEvent.LEAVE,e,s,n),i.emit(t.DragEvent.ENTER,e,n,s),this.dragEnterPath=n}dragEnd(t){(this.dragging||this.moving)&&(setTimeout(()=>this.interaction.pointerMove(t)),this.checkDragEndAnimate(t)||this.dragEndReal(t))}dragEndReal(e){const{interaction:i,downData:s,dragData:n}=this;e||(e=n);const{path:r,throughPath:o}=s,a=Jd(s,e,e);if(o&&(a.throughPath=o),a.path=r,this.moving&&(this.moving=!1,a.moveType="drag",i.emit(t.MoveEvent.END,a)),this.dragging){const r=this.getList();this.dragging=!1,i.p.dragLimitAnimate&&this.dragReal(!0),i.emit(t.DragEvent.END,a),this.swipe(e,s,n,a),this.drop(e,r,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:n}=this;if(lt.getDistance(e,t)>n.config.pointer.swipeDistance){const t=ec(e,i,s);this.interaction.emit(t.type,t)}}drop(e,i,s){const n=tc(e,i,t.DragEvent.data);n.path=s,this.interaction.emit(t.DropEvent.DROP,n),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,this.dragDataList=[]}checkDragEndAnimate(t,e){return!1}animate(t,e){}stopAnimate(){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const sc=ne.get("emit");const nc=["move","zoom","rotate","key"];function rc(t,e,i,s,n){if(nc.some(t=>e.startsWith(t))&&t.__.hitChildren&&!ac(t,n)){let r;for(let o=0,a=t.children.length;o<a;o++)r=t.children[o],!i.path.has(r)&&r.__.hittable&&oc(r,e,i,s,n)}}function oc(t,e,i,s,n){if(t.destroyed)return!1;if(t.__.hitSelf&&!ac(t,n)&&(dl.updateEventStyle&&!s&&dl.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const n=ye.get(e,i);if(t.emitEvent(n,s),n.isStop)return!0}return!1}function ac(t,e){return e&&e.has(t)}const hc={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:lc,pathCanDrag:dc,pathHasOutside:cc}=Zd;class uc{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&&Ld.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&Ld.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&Rd.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=g.clone(hc),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new Ph(t),this.createTransformer(),this.dragger=new ic(this),s&&(this.config=g.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(e,i){e||(e=this.hoverData),e&&(Ld.defaultLeft(e),this.updateDownData(e),this.checkPath(e,i),this.downTime=Date.now(),this.emit(t.PointerEvent.BEFORE_DOWN,e),e.path.needUpdate&&this.updateDownData(e),this.emit(t.PointerEvent.DOWN,e),Ld.left(e)&&(this.tapWait(),this.longPressWait(e)),this.waitRightTap=Ld.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&&Ld.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=lt.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;Ld.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,Rd.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,Rd.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 Ph),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 n=Date.now()-this.downTime,r=[t.PointerEvent.DOUBLE_TAP,t.PointerEvent.DOUBLE_CLICK].some(t=>lc(e.path,t));n<i.tapTime+50&&r?(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:n,target:r}=this;ee.backgrounder||t.origin||r&&r.updateLayout();const o=this.selector.getByPoint(t,i,Object.assign({bottomList:n,name:t.type},e||{through:s}));return o.throughPath&&(t.throughPath=o.throughPath),t.path=o.path,o.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&&!cc(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!dc(t.path))&&!cc(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))}stopDragAnimate(){this.dragger.stopAnimate()}replaceDownTarget(t){const{downData:e}=this;if(e&&t){const{path:i}=e;i.remove(i.list[0]),i.addAt(t,0)}}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,n=s.length;t<n&&(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:n}=this.canvas;return s.x*=n.width/i.width,s.y*=n.height/i.height,this.p.snap&<.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),(lc(e.path,t.PointerEvent.LONG_TAP)||lc(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 qt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(d(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(ta.RESIZE,this.__onResize,this)],t.once(na.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 n;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let r=i.length-1;r>-1;r--){if(n=i.list[r],oc(n,t,e,!0,s))return;n.isApp&&rc(n,t,e,!0,s)}for(let r=0,o=i.length;r<o;r++)if(n=i.list[r],n.isApp&&rc(n,t,e,!1,s),oc(n,t,e,!1,s))return}catch(t){sc.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 pc{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}pc.custom={};class _c extends ve{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new Ph,this.pixelList=new Ph}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),ue.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),ue.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()}}ee.getSelector=function(t){return t.leafer?t.leafer.selector:ee.selector||(ee.selector=ue.selector())};const{toInnerRadiusPointOf:gc,copyRadiusPoint:fc}=lt,{hitRadiusPoint:yc,hitPoint:mc}=Ht,vc={},wc={},xc=t.Leaf.prototype;xc.hit=function(t,e=0){this.updateLayout(),fc(wc,t,e);const i=this.__world;return!!(e?yc(i,wc):mc(i,wc))&&(this.isBranch?ee.getSelector(this).hitPoint(Object.assign({},wc),e,{target:this}):this.__hitWorld(wc))},xc.__hitWorld=function(t,e){const i=this.__;if(!i.hitSelf)return!1;const s=this.__world,n=this.__layout,r=s.width<10&&s.height<10;if(i.hitRadius&&(fc(vc,t,i.hitRadius),t=vc),gc(t,s,vc),i.hitBox||r){if(Ht.hitRadiusPoint(n.boxBounds,vc))return!0;if(r)return!1}return!n.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),n.boundsChanged||(n.hitCanvasChanged=!1)),this.__hit(vc,e)},xc.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},xc.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},xc.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},xc.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const bc=new yt,Ec=t.UI.prototype;Ec.__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,n=i||s;this.__hitCanvas||(this.__hitCanvas=n?t.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):t.getPathType(this));const r=this.__hitCanvas;if(n){const{renderBounds:t}=this.__layout,n=ee.image.hitCanvasSize,o=r.hitScale=Kt.set(0,0,n,n).getFitMatrix(t).a,{x:a,y:h,width:l,height:d}=Kt.set(t).scale(o);r.resize({width:l,height:d,pixelRatio:1}),r.clear(),or.patternLocked=!0,this.__renderShape(r,{matrix:bc.setWith(this.__world).scaleWith(1/o).invertWith().translate(-a,-h),snapshot:!0,ignoreFill:!i,ignoreStroke:!s}),or.patternLocked=!1,r.resetTransform(),e.__isHitPixel=!0}else e.__isHitPixel&&(e.__isHitPixel=!1);this.__drawHitPath(r),r.setStrokeOptions(e)},Ec.__hit=function(t,e){if(this.__box&&this.__box.__hit(t))return!0;const i=this.__;if(i.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:s}=i,n=(i.fill||i.__isCanvas)&&("path"===s||"pixel"===s&&!(i.__isAlphaPixelFill||i.__isCanvas))||"all"===s||e;if(n&&this.__hitFill(t))return!0;const{hitStroke:r,strokeScaleFixed:o}=i,a=i.__maxStrokeWidth*(o?this.getRenderScaleData(!0,o,!1).scaleX:1),h=i.stroke&&("path"===r||"pixel"===r&&!i.__isAlphaPixelStroke)||"all"===r;if(!n&&!h)return!1;const l=2*t.radiusX;let d=l,{strokeAlign:c}=i;if(i.motionText&&(d+=i.fontSize/2,c="center"),h)switch(c){case"inside":if(d+=2*a,!n&&this.__hitFill(t)&&this.__hitStroke(t,d))return!0;d=l;break;case"center":d+=a;break;case"outside":if(d+=2*a,!n){if(!this.__hitFill(t)&&this.__hitStroke(t,d))return!0;d=l}}return!!d&&this.__hitStroke(t,d)};const Pc=t.UI.prototype,Sc=t.Rect.prototype,kc=t.Box.prototype;Sc.__updateHitCanvas=kc.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?Pc.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},Sc.__hitFill=kc.__hitFill=function(t){return this.__hitCanvas?Pc.__hitFill.call(this,t):Ht.hitRadiusPoint(this.__layout.boxBounds,t)},t.Text.prototype.__drawHitPath=function(t){const e=this.__,{__lineHeight:i,fontSize:s,__baseLine:n,__letterSpacing:r,__textDrawData:o}=e;t.beginPath(),e.motionText?this.__drawPathByData(t,e.__pathForMotionText):r<0?this.__drawPathByBox(t):o.rows.forEach(e=>t.rect(e.x,e.y-n,e.width,i<s?s:i))},t.Group.prototype.pick=function(t,e){return e||(e=r),this.updateLayout(),ee.getSelector(this).getByPoint(t,e.hitRadius||0,Object.assign(Object.assign({},e),{target:this}))};const Bc=Ae.prototype;Bc.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},Bc.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},Bc.hitPixel=function(t,e,i=1){let{x:s,y:n,radiusX:r,radiusY:o}=t;e&&(s-=e.x,n-=e.y),Kt.set(s-r,n-o,2*r,2*o).scale(i).ceil();const{data:a}=this.context.getImageData(Kt.x,Kt.y,Kt.width||1,Kt.height||1);for(let t=0,e=a.length;t<e;t+=4)if(a[t+3]>0)return!0;return a[3]>0};const Tc={convert(t,e){const i=Zd.getBase(t),{x:s,y:n}=e,r=Object.assign(Object.assign({},i),{x:s,y:n,width:t.width,height:t.height,pointerType:t.pointerType,pressure:t.pressure});return"pen"===r.pointerType&&(r.tangentialPressure=t.tangentialPressure,r.tiltX=t.tiltX,r.tiltY=t.tiltY,r.twist=t.twist),r},convertMouse(t,e){const i=Zd.getBase(t),{x:s,y:n}=e;return Object.assign(Object.assign({},i),{x:s,y:n,width:1,height:1,pointerType:"mouse",pressure:.5})},convertTouch(t,e){const i=Tc.getTouch(t),s=Zd.getBase(t),{x:n,y:r}=e;return Object.assign(Object.assign({},s),{x:n,y:r,width:1,height:1,pointerType:"touch",multiTouch:t.touches.length>1,pressure:i.force})},getTouch:t=>t.targetTouches[0]||t.changedTouches[0]},Cc={convert(t){const e=Zd.getBase(t);return Object.assign(Object.assign({},e),{code:t.code,key:t.key})}},{pathCanDrag:Rc}=Zd;class Lc extends uc{get windowTarget(){const{view:t}=this;return t&&t.ownerDocument||window}get notPointer(){const{p:t}=this;return"pointer"!==t.type||t.touch||this.useMultiTouch}get notTouch(){const{p:t}=this;return"mouse"===t.type||this.usePointer}get notMouse(){return this.usePointer||this.useTouch}__listenEvents(){super.__listenEvents();const t=this.view=this.canvas.view;this.viewEvents={pointerdown:this.onPointerDown,mousedown:this.onMouseDown,touchstart:this.onTouchStart,pointerleave:this.onPointerLeave,contextmenu:this.onContextMenu,wheel:this.onWheel,gesturestart:this.onGesturestart,gesturechange:this.onGesturechange,gestureend:this.onGestureend},this.windowEvents={pointermove:this.onPointerMove,pointerup:this.onPointerUp,pointercancel:this.onPointerCancel,mousemove:this.onMouseMove,mouseup:this.onMouseUp,touchmove:this.onTouchMove,touchend:this.onTouchEnd,touchcancel:this.onTouchCancel,keydown:this.onKeyDown,keyup:this.onKeyUp,scroll:this.onScroll};const{viewEvents:e,windowEvents:i}=this;for(let i in e)e[i]=e[i].bind(this),t.addEventListener(i,e[i]);for(let t in i)i[t]=i[t].bind(this),this.windowTarget.addEventListener(t,i[t])}__removeListenEvents(){super.__removeListenEvents();const{viewEvents:t,windowEvents:e}=this;for(let e in t)this.view.removeEventListener(e,t[e]),this.viewEvents={};for(let t in e)this.windowTarget.removeEventListener(t,e[t]),this.windowEvents={}}getTouches(t){const e=[];for(let i=0,s=t.length;i<s;i++)e.push(t[i]);return e}preventDefaultPointer(t){const{pointer:e}=this.config;e.preventDefault&&t.preventDefault()}preventDefaultWheel(t){const{wheel:e}=this.config;e.preventDefault&&t.preventDefault()}preventWindowPointer(t){return!this.downData&&t.target!==this.view&&(!this.config.shadowDOM||!t.composedPath||!t.composedPath().includes(this.view))}onKeyDown(t){this.keyDown(Cc.convert(t))}onKeyUp(t){this.keyUp(Cc.convert(t))}onContextMenu(t){this.config.pointer.preventDefaultMenu&&t.preventDefault(),this.menu(Tc.convert(t,this.getLocal(t)))}onScroll(){this.canvas.updateClientBounds()}onPointerDown(t){this.preventDefaultPointer(t),this.notPointer||(this.usePointer||(this.usePointer=!0),this.pointerDown(Tc.convert(t,this.getLocal(t))))}onPointerMove(t,e){if(this.notPointer||this.preventWindowPointer(t))return;this.usePointer||(this.usePointer=!0);const i=Tc.convert(t,this.getLocal(t,!0));e?this.pointerHover(i):this.pointerMove(i)}onPointerLeave(t){this.onPointerMove(t,!0)}onPointerUp(t){this.downData&&this.preventDefaultPointer(t),this.notPointer||this.preventWindowPointer(t)||this.pointerUp(Tc.convert(t,this.getLocal(t)))}onPointerCancel(){this.useMultiTouch||this.pointerCancel()}onMouseDown(t){this.preventDefaultPointer(t),this.notMouse||this.pointerDown(Tc.convertMouse(t,this.getLocal(t)))}onMouseMove(t){this.notMouse||this.preventWindowPointer(t)||this.pointerMove(Tc.convertMouse(t,this.getLocal(t,!0)))}onMouseUp(t){this.downData&&this.preventDefaultPointer(t),this.notMouse||this.preventWindowPointer(t)||this.pointerUp(Tc.convertMouse(t,this.getLocal(t)))}onMouseCancel(){this.notMouse||this.pointerCancel()}onTouchStart(t){const e=Tc.getTouch(t),i=this.getLocal(e,!0),{preventDefault:s}=this.config.touch;(!0===s||"auto"===s&&Rc(this.findPath(i)))&&t.preventDefault(),this.multiTouchStart(t),this.notTouch||(this.touchTimer&&(window.clearTimeout(this.touchTimer),this.touchTimer=0),this.useTouch=!0,this.pointerDown(Tc.convertTouch(t,i)))}onTouchMove(t){if(this.multiTouchMove(t),this.notTouch||this.preventWindowPointer(t))return;const e=Tc.getTouch(t);this.pointerMove(Tc.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){if(this.multiTouchEnd(),this.notTouch||this.preventWindowPointer(t))return;this.touchTimer&&clearTimeout(this.touchTimer),this.touchTimer=setTimeout(()=>{this.useTouch=!1},500);const e=Tc.getTouch(t);this.pointerUp(Tc.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.notTouch||this.pointerCancel()}multiTouchStart(t){this.useMultiTouch=t.touches.length>1,this.touches=this.useMultiTouch?this.getTouches(t.touches):void 0,this.useMultiTouch&&this.pointerCancel()}multiTouchMove(t){if(this.useMultiTouch&&t.touches.length>1){const e=this.getTouches(t.touches),i=this.getKeepTouchList(this.touches,e);i.length>1&&(this.multiTouch(Zd.getBase(t),i),this.touches=e)}}multiTouchEnd(){this.touches=null,this.useMultiTouch=!1,this.transformEnd()}getKeepTouchList(t,e){let i;const s=[];return t.forEach(t=>{i=e.find(e=>e.identifier===t.identifier),i&&s.push({from:this.getLocal(t),to:this.getLocal(i)})}),s}getLocalTouchs(t){return t.map(t=>this.getLocal(t))}onWheel(t){this.preventDefaultWheel(t),this.wheel(Object.assign(Object.assign(Object.assign({},Zd.getBase(t)),this.getLocal(t)),{deltaX:t.deltaX,deltaY:t.deltaY}))}onGesturestart(t){this.useMultiTouch||(this.preventDefaultWheel(t),this.lastGestureScale=1,this.lastGestureRotation=0)}onGesturechange(t){if(this.useMultiTouch)return;this.preventDefaultWheel(t);const e=Zd.getBase(t);Object.assign(e,this.getLocal(t));const i=t.scale/this.lastGestureScale,s=(t.rotation-this.lastGestureRotation)/Math.PI*180*(M.within(this.config.wheel.rotateSpeed,0,1)/4+.1);this.zoom(Object.assign(Object.assign({},e),{scale:i*i})),this.rotate(Object.assign(Object.assign({},e),{rotation:s})),this.lastGestureScale=t.scale,this.lastGestureRotation=t.rotation}onGestureend(t){this.useMultiTouch||(this.preventDefaultWheel(t),this.transformEnd())}setCursor(t){super.setCursor(t);const e=[];this.eachCursor(t,e),p(e[e.length-1])&&e.push("default"),this.canvas.view.style.cursor=e.map(t=>p(t)?`url(${t.url}) ${t.x||0} ${t.y||0}`:t).join(",")}eachCursor(t,e,i=0){if(i++,u(t))t.forEach(t=>this.eachCursor(t,e,i));else{const s=h(t)&&pc.get(t);s&&i<2?this.eachCursor(s,e,i):e.push(t)}}destroy(){this.view&&(super.destroy(),this.view=this.touches=null)}}function Dc(t,e,i){t.__.__font?nl.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function Ac(t,e,i,s,n){const r=i.__;p(t)?nl.drawStrokesStyle(t,e,!1,i,s,n):(s.setStroke(t,r.__strokeWidth*e,r),s.stroke()),r.__useArrow&&nl.strokeArrow(t,i,s,n)}function Oc(t,e,i,s,n){const r=i.__;p(t)?nl.drawStrokesStyle(t,e,!0,i,s,n):(s.setStroke(t,r.__strokeWidth*e,r),nl.drawTextStroke(i,s,n))}function Ic(t,e,i,s,n){const r=s.getSameCanvas(!0,!0);r.font=i.__.__font,Oc(t,2,i,r,n),r.blendMode="outside"===e?"destination-out":"destination-in",nl.fillText(i,r,n),r.blendMode="normal",po.copyCanvasByWorld(i,s,r),r.recycle(i.__nowWorld)}const{getSpread:Mc,copyAndSpread:Fc,toOuterOf:Wc,getOuterOf:Uc,getByMove:Nc,move:zc,getIntersectData:Yc}=Ht,Xc={};let Hc;const{stintSet:jc}=g,{hasTransparent:Vc}=el;function Gc(t,e,i){if(!p(e)||!1===e.visible||0===e.opacity)return;let s;const{boxBounds:n}=i.__layout,{type:r}=e;switch(r){case"image":case"film":case"video":if(!e.url)return;s=rl.image(i,t,e,n,!Hc||!Hc[e.url]),"image"!==r&&rl[r](s);break;case"linear":s=ol.linearGradient(e,n);break;case"radial":s=ol.radialGradient(e,n);break;case"angular":s=ol.conicGradient(e,n);break;case"solid":const{color:a,opacity:h}=e;s={type:r,style:el.string(a,h)};break;default:o(e.r)||(s={type:"solid",style:el.string(e)})}if(s&&(s.originPaint=e,h(s.style)&&Vc(s.style)&&(s.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;s.strokeStyle=e.style}return s}const qc={compute:function(t,e){const i=e.__,s=[];let n,r,o,a=i.__input[t];u(a)||(a=[a]),Hc=rl.recycleImage(t,i);for(let i,n=0,r=a.length;n<r;n++)(i=Gc(t,a[n],e))&&(s.push(i),i.strokeStyle&&(o||(o=1),i.strokeStyle.strokeWidth&&(o=Math.max(o,i.strokeStyle.strokeWidth))));s.length?(i["_"+t]=s,s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(n=!0),r=!0),"fill"===t?(jc(i,"__isAlphaPixelFill",n),jc(i,"__isTransparentFill",r)):(jc(i,"__isAlphaPixelStroke",n),jc(i,"__isTransparentStroke",r),jc(i,"__hasMultiStrokeStyle",o))):(i.__removePaint(t,!1),i["_"+t]="")},fill:function(t,e,i,s){i.fillStyle=t,Dc(e,i,s)},fills:function(t,e,i,s){let n,r,o;for(let a=0,h=t.length;a<h;a++){if(n=t[a],r=n.originPaint,n.image){if(o?o++:o=1,rl.checkImage(n,!e.__.__font,e,i,s))continue;if(!n.style){1===o&&n.image.isPlacehold&&e.drawImagePlaceholder(n,i,s);continue}}if(i.fillStyle=n.style,n.transform||r.scaleFixed){if(i.save(),n.transform&&i.transform(n.transform),r.scaleFixed){const{scaleX:t,scaleY:s}=e.getRenderScaleData(!0,r.scaleFixed,!1);1!==t&&i.scale(t,s)}r.blendMode&&(i.blendMode=r.blendMode),Dc(e,i,s),i.restore()}else r.blendMode?(i.saveBlendMode(r.blendMode),Dc(e,i,s),i.restoreBlendMode()):Dc(e,i,s)}},fillPathOrText:Dc,fillText:function(t,e,i){if(t.motionText)return nl.fillMotionText(t,e,i);const s=t.__,{rows:n,decorationY:r}=s.__textDrawData;let o;s.__isPlacehold&&s.placeholderColor&&(e.fillStyle=s.placeholderColor);for(let t=0,i=n.length;t<i;t++)o=n[t],o.text?e.fillText(o.text,o.x,o.y):o.data&&o.data.forEach(t=>{e.fillText(t.char,t.x,o.y)});if(r){const{decorationColor:t,decorationHeight:i}=s.__textDrawData;t&&(e.fillStyle=t),n.forEach(t=>r.forEach(s=>e.fillRect(t.x,t.y+s,t.width,i)))}},stroke:function(t,e,i,s){const n=e.__;if(n.__strokeWidth)if(n.__font)nl.strokeText(t,e,i,s);else if(n.__pathForStroke)nl.fillStroke(t,e,i,s);else switch(n.strokeAlign){case"center":Ac(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),Ac(t,2,e,i,s),i.restore()}(t,e,i,s);break;case"outside":!function(t,e,i,s){const n=e.__;if(n.__fillAfterStroke)Ac(t,2,e,i,s);else{const{renderBounds:r}=e.__layout,o=i.getSameCanvas(!0,!0);e.__drawRenderPath(o),Ac(t,2,e,o,s),o.clipUI(n),o.clearWorld(r),po.copyCanvasByWorld(e,i,o),o.recycle(e.__nowWorld)}}(t,e,i,s)}},strokes:function(t,e,i,s){nl.stroke(t,e,i,s)},strokeText:function(t,e,i,s){switch(e.__.strokeAlign){case"center":Oc(t,1,e,i,s);break;case"inside":Ic(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?Oc(t,2,e,i,s):Ic(t,"outside",e,i,s)}},drawTextStroke:function(t,e,i){let s,n=t.__.__textDrawData;const{rows:r,decorationY:o}=n;for(let t=0,i=r.length;t<i;t++)s=r[t],s.text?e.strokeText(s.text,s.x,s.y):s.data&&s.data.forEach(t=>{e.strokeText(t.char,t.x,s.y)});if(o){const{decorationHeight:t}=n;r.forEach(i=>o.forEach(s=>e.strokeRect(i.x,i.y+s,i.width,t)))}},drawStrokesStyle:function(t,e,i,s,n,r){let o;const a=s.__,{__hasMultiStrokeStyle:h}=a;h||n.setStroke(void 0,a.__strokeWidth*e,a);for(let l=0,d=t.length;l<d;l++)if(o=t[l],(!o.image||!rl.checkImage(o,!1,s,n,r))&&o.style){if(h){const{strokeStyle:t}=o;t?n.setStroke(o.style,a.__getRealStrokeWidth(t)*e,a,t):n.setStroke(o.style,a.__strokeWidth*e,a)}else n.strokeStyle=o.style;o.originPaint.blendMode?(n.saveBlendMode(o.originPaint.blendMode),i?nl.drawTextStroke(s,n,r):n.stroke(),n.restoreBlendMode()):i?nl.drawTextStroke(s,n,r):n.stroke()}},shape:function(t,e,i){const s=e.getSameCanvas(),n=e.bounds,r=t.__nowWorld,o=t.__layout,a=t.__nowWorldShapeBounds||(t.__nowWorldShapeBounds={});let h,l,d,c,u,p;Wc(o.strokeSpread?(Fc(Xc,o.boxBounds,o.strokeSpread),Xc):o.boxBounds,r,a);let{scaleX:_,scaleY:g}=t.getRenderScaleData(!0);if(n.includes(a))p=s,h=u=a,l=r;else{let s;if(ee.fullImageShadow)s=a;else{const t=o.renderShapeSpread?Mc(n,S.swapAndScale(o.renderShapeSpread,_,g)):n;s=Yc(t,a)}c=n.getFitMatrix(s);let{a:f,d:y}=c;c.a<1&&(p=e.getSameCanvas(),t.__renderShape(p,i),_*=f,g*=y),u=Uc(a,c),h=Nc(u,-c.e,-c.f),l=Uc(r,c),zc(l,-c.e,-c.f);const m=i.matrix;m?(d=new yt(c),d.multiply(m),f*=m.scaleX,y*=m.scaleY):d=c,d.withScale(f,y),i=Object.assign(Object.assign({},i),{matrix:d})}return t.__renderShape(s,i),{canvas:s,matrix:d,fitMatrix:c,bounds:h,renderBounds:l,worldCanvas:p,shapeBounds:u,scaleX:_,scaleY:g}}};let Kc,Zc=new qt;const{isSame:Qc}=Ht;function $c(t,e,i,s,n,r){let o=!0;const a=t.__;if("fill"!==e||a.__naturalWidth||(a.__naturalWidth=s.width/a.pixelRatio,a.__naturalHeight=s.height/a.pixelRatio,a.__autoSide&&(t.forceUpdate(),po.updateBounds(t,!0),t.__layout.boundsChanged=!0,t.__proxyData&&(t.setProxyAttr("width",a.width),t.setProxyAttr("height",a.height)),o=!1)),"brush"===i.mode&&rl.brush(t,e,n),!n.data){rl.createData(n,s,i,r);const{transform:t}=n.data,{opacity:e}=i,o=(t&&!t.onlyScale||a.path||a.cornerRadius)&&!n.brush;(o||e&&e<1||i.blendMode)&&(n.complex=!o||2)}return i.filter&&rl.applyFilter(n,s,i.filter,t),o}function Jc(t,e){iu(t,Go.LOAD,e)}function tu(t,e){iu(t,Go.LOADED,e)}function eu(t,e,i){e.error=i,t.forceUpdate("surface"),iu(t,Go.ERROR,e)}function iu(t,e,i){t.hasEvent(e)&&t.emitEvent(new Go(e,i))}function su(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:nu,translate:ru}=Q,ou=new qt,au={},hu={};function lu(t,e,i,s){const n=h(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&n<0?0:n}let du={},cu={a:1,b:0,c:0,d:1,e:0,f:0};const{get:uu,set:pu,rotateOfOuter:_u,translate:gu,scaleOfOuter:fu,multiplyParent:yu,scale:mu,rotate:vu,skew:wu}=Q;function xu(t,e,i,s,n,r,o,a){o&&vu(t,o),a&&wu(t,a.x,a.y),n&&mu(t,n,r),gu(t,e.x+i,e.y+s)}const{get:bu,scale:Eu,copy:Pu}=Q,{getFloorScale:Su}=M,{abs:ku}=Math;const Bu={image:function(t,e,i,s,n){let r,o;const a=or.get(i,i.type);return Kc&&i===Kc.paint&&Qc(s,Kc.boxBounds)?r=Kc.leafPaint:(r={type:i.type,image:a},a.hasAlphaPixel&&(r.isTransparent=!0),Kc=a.use>1?{leafPaint:r,paint:i,boxBounds:Zc.set(s)}:null),(n||a.loading)&&(o={image:a,attrName:e,attrValue:i}),a.ready?($c(t,e,i,a,r,s),n&&(Jc(t,o),tu(t,o))):a.error?n&&eu(t,o,a.error):(n&&(su(t,!0),Jc(t,o)),r.loadId=a.load(()=>{su(t,!1),t.destroyed||($c(t,e,i,a,r,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),tu(t,o)),r.loadId=void 0},e=>{su(t,!1),eu(t,o,e),r.loadId=void 0},i.lod&&a.getThumbSize(i.lod)),t.placeholderColor&&(t.placeholderDelay?setTimeout(()=>{a.ready||(a.isPlacehold=!0,t.forceUpdate("surface"))},t.placeholderDelay):a.isPlacehold=!0)),r},checkImage:function(t,e,i,s,n){const{scaleX:r,scaleY:o}=rl.getImageRenderScaleData(t,i,s,n),a=t.film?t.nowIndex:r+"-"+o,{image:h,brush:l,data:d,originPaint:c}=t,{exporting:u,snapshot:p}=n;if(!d||t.patternId===a&&!u||p){if(!l||!t.style)return!1}else if(e&&(d.repeat?e=!1:c.changeful||t.film||"miniapp"===ee.name||u||(e=ee.image.isLarge(h,r,o)||h.width*r>8096||h.height*o>8096)),e)i.__.__isFastShadow&&(s.fillStyle=t.style||"#000",s.fill());else if(!t.style||c.sync||u?rl.createPattern(t,i,s,n):rl.createPatternTask(t,i,s,n),!l||!t.style)return!1;return rl.drawImage(t,r,o,i,s,n),!0},drawImage:function(t,e,i,s,n,r){const{data:o,image:a,brush:h,complex:l}=t;let{width:d,height:c}=a,u=h||a;if(l){const{blendMode:r,opacity:a}=t.originPaint,{transform:h}=o;n.save(),2===l&&n.clipUI(s),r&&(n.blendMode=r),a&&(n.opacity*=a),h&&n.transform(h),u.render(n,0,0,d,c,s,t,e,i),n.restore()}else o.scaleX&&(d*=o.scaleX,c*=o.scaleY),u.render(n,0,0,d,c,s,t,e,i)},getImageRenderScaleData:function(t,e,i,s){const n=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:r}=t;if(t.brush&&rl.addBrushScale(n,t,e),i){const{pixelRatio:t}=i;n.scaleX*=t,n.scaleY*=t}return r&&r.scaleX&&(n.scaleX*=Math.abs(r.scaleX),n.scaleY*=Math.abs(r.scaleY)),n},recycleImage:function(t,e){const i=e["_"+t];if(u(i)){let s,n,r,o,a;const h=e.__leaf;for(let l=0,d=i.length;l<d;l++)s=i[l],n=s.image,a=n&&n.url,a&&(r||(r={}),r[a]=!0,or.recyclePaint(s),s.brush&&rl.recycleBrush(s,h),e.__willDestroy&&n.parent&&rl.recycleFilter(n,h),n.loading&&(o||(o=e.__input&&e.__input[t]||[],u(o)||(o=[o])),n.unload(i[l].loadId,!o.some(t=>t.url===a))));return r}return null},createPatternTask:function(t,e,i,s){t.patternTask||(t.patternTask=or.patternTasker.add(()=>n(this,void 0,void 0,function*(){rl.createPattern(t,e,i,s),e.forceUpdate("surface")}),0,()=>(t.patternTask=null,i.bounds.hit(e.__nowWorld))))},createPattern:function(t,e,i,s){let{scaleX:n,scaleY:r}=rl.getImageRenderScaleData(t,e,i,s),o=t.film?t.nowIndex:n+"-"+r;if(t.patternId!==o&&!e.destroyed&&(!ee.image.isLarge(t.image,n,r)||t.data.repeat)){const{image:a,brush:h,data:l}=t,{transform:d,gap:c}=l,u=rl.getPatternFixScale(t,n,r);let p,_,g,{width:f,height:y}=a,{opacity:m}=t.originPaint;(h||1===m)&&(m=void 0),u&&(n*=u,r*=u),f*=n,y*=r,c&&!h&&(_=c.x*n/ku(l.scaleX||1),g=c.y*r/ku(l.scaleY||1)),(d||1!==n||1!==r)&&(n*=Su(f+(_||0)),r*=Su(y+(g||0)),p=bu(),d&&Pu(p,d),Eu(p,1/n,1/r));const v=a.getCanvas(f,y,m,void 0,_,g,e.leafer&&e.leafer.config.smooth,l.interlace);h?(t.style=v,rl.cacheBrush(t,e,i,s)):t.style=a.getPattern(v,l.repeat||ee.origin.noRepeat||"no-repeat",p,t),t.patternId=o}},getPatternFixScale:function(t,e,i){const{image:s}=t;let n,r=ee.image.maxPatternSize,o=s.width*s.height;return s.isSVG?e>1&&(n=Math.ceil(e)/e):r>o&&(r=o),(o*=e*i)>r&&(n=Math.sqrt(r/o)),n},createData:function(t,e,i,s){t.data=rl.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=ou.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:s,height:n}=i,{mode:r,align:o,offset:a,scale:l,size:c,rotation:u,skew:_,clipSize:g,repeat:f,gap:y,interlace:m}=t,v=e.width===s&&e.height===n,w={mode:r},x="center"!==o&&(u||0)%180==90;let b,E;switch(Ht.set(hu,0,0,x?n:s,x?s:n),r&&"cover"!==r&&"fit"!==r?((l||c)&&(M.getScaleData(l,c,i,au),b=au.scaleX,E=au.scaleY),(o||y||f)&&(b&&Ht.scale(hu,b,E,!0),o&&Bt.toPoint(o,hu,e,hu,!0,!0))):v&&!u||(b=E=Ht.getFitScale(e,hu,"fit"!==r),Ht.put(e,i,o,b,!1,hu),Ht.scale(hu,b,E,!0)),a&<.move(hu,a),r){case"stretch":v?b&&(b=E=void 0):(b=e.width/s,E=e.height/n,rl.stretchMode(w,e,b,E));break;case"normal":case"clip":if(hu.x||hu.y||b||g||u||_){let t,i;g&&(t=e.width/g.width,i=e.height/g.height),rl.clipMode(w,e,hu.x,hu.y,b,E,u,_,t,i),t&&(b=b?b*t:t,E=E?E*i:i)}break;case"repeat":(!v||b||u||_)&&rl.repeatMode(w,e,s,n,hu.x,hu.y,b,E,u,_,o,t.freeTransform);case"brush":f||(w.repeat="repeat");const i=p(f);(y||i)&&(w.gap=function(t,e,i,s,n){let r,o;p(t)?(r=t.x,o=t.y):r=o=t;return{x:lu(r,i,n.width,e&&e.x),y:lu(o,s,n.height,e&&e.y)}}(y,i&&f,hu.width,hu.height,e));break;default:b&&rl.fillOrFitMode(w,e,hu.x,hu.y,b,E,u)}return w.transform||"brush"===r||(e.x||e.y)&&ru(w.transform=nu(),e.x,e.y),b&&(w.scaleX=b,w.scaleY=E),f&&(w.repeat=h(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),m&&(w.interlace=d(m)||"percent"===m.type?{type:"x",offset:m}:m),w},stretchMode:function(t,e,i,s){const n=uu(),{x:r,y:o}=e;r||o?gu(n,r,o):i>0&&s>0&&(n.onlyScale=!0),mu(n,i,s),t.transform=n},fillOrFitMode:function(t,e,i,s,n,r,o){const a=uu();gu(a,e.x+i,e.y+s),mu(a,n,r),o&&_u(a,{x:e.x+e.width/2,y:e.y+e.height/2},o),t.transform=a},clipMode:function(t,e,i,s,n,r,o,a,h,l){const d=uu();xu(d,e,i,s,n,r,o,a),h&&(o||a?(pu(cu),fu(cu,e,h,l),yu(d,cu)):fu(d,e,h,l)),t.transform=d},repeatMode:function(t,e,i,s,n,r,o,a,h,l,d,c){const u=uu();if(c)xu(u,e,n,r,o,a,h,l);else{if(h)if("center"===d)_u(u,{x:i/2,y:s/2},h);else switch(vu(u,h),h){case 90:gu(u,s,0);break;case 180:gu(u,i,s);break;case 270:gu(u,0,i)}du.x=e.x+n,du.y=e.y+r,gu(u,du.x,du.y),o&&fu(u,du,o,a)}t.transform=u}},{toPoint:Tu}=Pt,{hasTransparent:Cu}=el,Ru={},Lu={};function Du(t,e,i,s){if(i){let n,r,o,a;for(let t=0,l=i.length;t<l;t++)n=i[t],h(n)?(o=t/(l-1),r=el.string(n,s)):(o=n.offset,r=el.string(n.color,s)),e.addColorStop(o,r),!a&&Cu(r)&&(a=!0);a&&(t.isTransparent=!0)}}const{getAngle:Au,getDistance:Ou}=lt,{get:Iu,rotateOfOuter:Mu,scaleOfOuter:Fu}=Q,{toPoint:Wu}=Pt,Uu={},Nu={};function zu(t,e,i,s,n){let r;const{width:o,height:a}=t;if(o!==a||s){const t=Au(e,i);r=Iu(),n?(Fu(r,e,o/a*(s||1),1),Mu(r,e,t+90)):(Fu(r,e,1,o/a*(s||1)),Mu(r,e,t))}return r}const{getDistance:Yu}=lt,{toPoint:Xu}=Pt,Hu={},ju={};const Vu={linearGradient:function(t,e){let{from:i,to:s,type:n,opacity:r}=t;Tu(i||"top",e,Ru),Tu(s||"bottom",e,Lu);const o=ee.canvas.createLinearGradient(Ru.x,Ru.y,Lu.x,Lu.y),a={type:n,style:o};return Du(a,o,t.stops,r),a},radialGradient:function(t,e){let{from:i,to:s,type:n,opacity:r,stretch:o}=t;Wu(i||"center",e,Uu),Wu(s||"bottom",e,Nu);const a=ee.canvas.createRadialGradient(Uu.x,Uu.y,0,Uu.x,Uu.y,Ou(Uu,Nu)),h={type:n,style:a};Du(h,a,t.stops,r);const l=zu(e,Uu,Nu,o,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:i,to:s,type:n,opacity:r,rotation:o,stretch:a}=t;Xu(i||"center",e,Hu),Xu(s||"bottom",e,ju);const h=ee.conicGradientSupport?ee.canvas.createConicGradient(o?o*W:0,Hu.x,Hu.y):ee.canvas.createRadialGradient(Hu.x,Hu.y,0,Hu.x,Hu.y,Yu(Hu,ju)),l={type:n,style:h};Du(l,h,t.stops,r);const d=zu(e,Hu,ju,a||1,ee.conicGradientRotate90);return d&&(l.transform=d),l},getTransform:zu},{copy:Gu,move:qu,toOffsetOutBounds:Ku}=Ht,{max:Zu,abs:Qu}=Math,$u={},Ju=new yt,tp={};function ep(t,e){let i,s,n,r,o=0,a=0,h=0,l=0;return e.forEach(t=>{i=t.x||0,s=t.y||0,r=1.5*(t.blur||0),n=Qu(t.spread||0),o=Zu(o,n+r-s),a=Zu(a,n+r+i),h=Zu(h,n+r+s),l=Zu(l,n+r-i)}),o===a&&a===h&&h===l?o:[o,a,h,l]}function ip(t,e,i){const{shapeBounds:s}=i;let n,r;ee.fullImageShadow?(Gu($u,t.bounds),qu($u,e.x-s.x,e.y-s.y),n=t.bounds,r=$u):(n=s,r=e),t.copyWorld(i.canvas,n,r)}const{toOffsetOutBounds:sp}=Ht,np={};const rp=ep;const op={shadow:function(t,e,i){let s,n;const{__nowWorld:r}=t,{shadow:o}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,p=e.getSameCanvas(),_=o.length-1;Ku(h,tp,l),o.forEach((o,g)=>{let f=1;if(o.scaleFixed){const t=Math.abs(r.scaleX);t>1&&(f=1/t)}p.setWorldShadow(tp.offsetX+(o.x||0)*c*f,tp.offsetY+(o.y||0)*u*f,(o.blur||0)*c*f,el.string(o.color)),n=al.getShadowTransform(t,p,i,o,tp,f),n&&p.setTransform(n),ip(p,tp,i),n&&p.resetTransform(),s=l,o.box&&(p.restore(),p.save(),a&&(p.copyWorld(p,l,r,"copy"),s=r),a?p.copyWorld(a,r,r,"destination-out"):p.copyWorld(i.canvas,d,h,"destination-out")),po.copyCanvasByWorld(t,e,p,s,o.blendMode),_&&g<_&&p.clearWorld(s)}),p.recycle(s)},innerShadow:function(t,e,i){let s,n;const{__nowWorld:r}=t,{innerShadow:o}=t.__,{worldCanvas:a,bounds:h,renderBounds:l,shapeBounds:d,scaleX:c,scaleY:u}=i,p=e.getSameCanvas(),_=o.length-1;sp(h,np,l),o.forEach((o,g)=>{let f=1;if(o.scaleFixed){const t=Math.abs(r.scaleX);t>1&&(f=1/t)}p.save(),p.setWorldShadow(np.offsetX+(o.x||0)*c*f,np.offsetY+(o.y||0)*u*f,(o.blur||0)*c*f),n=al.getShadowTransform(t,p,i,o,np,f,!0),n&&p.setTransform(n),ip(p,np,i),p.restore(),a?(p.copyWorld(p,l,r,"copy"),p.copyWorld(a,r,r,"source-out"),s=r):(p.copyWorld(i.canvas,d,h,"source-out"),s=l),p.fillWorld(s,el.string(o.color),"source-in"),po.copyCanvasByWorld(t,e,p,s,o.blendMode),_&&g<_&&p.clearWorld(s)}),p.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:ep,getShadowTransform:function(t,e,i,s,n,r,o){if(s.spread){const i=2*s.spread*r*(o?-1:1),{width:a,height:h}=t.__layout.strokeBounds;return Ju.set().scaleOfOuter({x:(n.x+n.width/2)*e.pixelRatio,y:(n.y+n.height/2)*e.pixelRatio},1+i/a,1+i/h),Ju}},isTransformShadow(t){},getInnerShadowSpread:rp},{excludeRenderBounds:ap}=xo;let hp;function lp(t,e,i,s,n,r,o,a){switch(e){case"grayscale":hp||(hp=!0,n.useGrayscaleAlpha(t.__nowWorld));case"alpha":!function(t,e,i,s,n,r){const o=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,o),r&&s.recycle(o);cp(t,e,i,1,n,r)}(t,i,s,n,o,a);break;case"opacity-path":cp(t,i,s,r,o,a);break;case"path":a&&i.restore()}}function dp(t){return t.getSameCanvas(!1,!0)}function cp(t,e,i,s,n,r){const o=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,o,void 0,n),r?i.recycle(o):i.clearWorld(o)}t.Group.prototype.__renderMask=function(t,e){let i,s,n,r,o,a;const{children:h}=this;for(let l=0,d=h.length;l<d;l++){if(i=h[l],a=i.__.mask,a){o&&(lp(this,o,t,n,s,r,void 0,!0),s=n=null),"clipping"!==a&&"clipping-path"!==a||ap(i,e)||i.__render(t,e),r=i.__.opacity,hp=!1,"path"===a||"clipping-path"===a?(r<1?(o="opacity-path",n||(n=dp(t))):(o="path",t.save()),i.__clip(n||t,e)):(o="grayscale"===a?"grayscale":"alpha",s||(s=dp(t)),n||(n=dp(t)),i.__render(s,e));continue}const d=1===r&&i.__.__blendMode;d&&lp(this,o,t,n,s,r,void 0,!1),ap(i,e)||i.__render(n||t,e),d&&lp(this,o,t,n,s,r,d,!1)}lp(this,o,t,n,s,r,void 0,!0)};const up=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",pp=up+"_#~&*+\\=|≮≯≈≠=…",_p=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 gp(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const fp=gp("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),yp=gp("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),mp=gp(up),vp=gp(pp),wp=gp("- —/~|┆·");var xp;!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"}(xp||(xp={}));const{Letter:bp,Single:Ep,Before:Pp,After:Sp,Symbol:kp,Break:Bp}=xp;function Tp(t){return fp[t]?bp:wp[t]?Bp:yp[t]?Pp:mp[t]?Sp:vp[t]?kp:_p.test(t)?Ep:bp}const Cp={trimRight(t){const{words:e}=t;let i,s=0,n=e.length;for(let r=n-1;r>-1&&(i=e[r].data[0]," "===i.char);r--)s++,t.width-=i.width;s&&e.splice(n-s,s)}};function Rp(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:Lp}=Cp,{Letter:Dp,Single:Ap,Before:Op,After:Ip,Symbol:Mp,Break:Fp}=xp;let Wp,Up,Np,zp,Yp,Xp,Hp,jp,Vp,Gp,qp,Kp,Zp,Qp,$p,Jp,t_,e_=[];function i_(t,e){Vp&&!jp&&(jp=Vp),Wp.data.push({char:t,width:e}),Np+=e}function s_(){zp+=Np,Wp.width=Np,Up.words.push(Wp),Wp={data:[]},Np=0}function n_(){Qp&&($p.paraNumber++,Up.paraStart=!0,Qp=!1),Vp&&(Up.startCharSize=jp,Up.endCharSize=Vp,jp=0),Up.width=zp,Jp.width?Lp(Up):t_&&r_(),e_.push(Up),Up={words:[]},zp=0}function r_(){zp>($p.maxWidth||0)&&($p.maxWidth=zp)}const{top:o_,right:a_,bottom:h_,left:l_}=t.Direction4;function d_(t,e,i){const{bounds:s,rows:n}=t;s[e]+=i;for(let t=0;t<n.length;t++)n[t][e]+=i}const c_={getDrawData:function(t,e){h(t)||(t=String(t));let i=0,s=0,n=e.__getInput("width")||0,r=e.__getInput("height")||0;const{__padding:o}=e;e.motionText&&(n=r=0),o&&(n?(i=o[l_],n-=o[a_]+o[l_],!n&&(n=.01)):e.autoSizeAlign||(i=o[l_]),r?(s=o[o_],r-=o[o_]+o[h_],!r&&(r=.01)):e.autoSizeAlign||(s=o[o_]));const a={bounds:{x:i,y:s,width:n,height:r},rows:[],paraNumber:0,font:ee.canvas.font=e.__font};return function(t,e,i){$p=t,e_=t.rows,Jp=t.bounds,t_=!Jp.width&&!i.autoSizeAlign;const{__letterSpacing:s,paraIndent:n,textCase:r}=i,{canvas:o}=ee,{width:a}=Jp;if(i.__isCharMode){const t="none"!==i.textWrap,h="break"===i.textWrap;Qp=!0,qp=null,jp=Hp=Vp=Np=zp=0,Wp={data:[]},Up={words:[]};for(let i=0,l=(e=[...e]).length;i<l;i++)Xp=e[i],"\n"===Xp?(Np&&s_(),Up.paraEnd=!0,n_(),Qp=!0):(Gp=Tp(Xp),Gp===Dp&&"none"!==r&&(Xp=Rp(Xp,r,!Np)),Hp=o.measureText(Xp).width,s&&(s<0&&(Vp=Hp),Hp+=s),Kp=Gp===Ap&&(qp===Ap||qp===Dp)||qp===Ap&&Gp!==Ip,Zp=!(Gp!==Op&&Gp!==Ap||qp!==Mp&&qp!==Ip),Yp=Qp&&n?a-n:a,t&&a&&zp+Np+Hp>Yp&&(h?(Np&&s_(),zp&&n_()):(Zp||(Zp=Gp===Dp&&qp==Ip),Kp||Zp||Gp===Fp||Gp===Op||Gp===Ap||Np+Hp>Yp?(Np&&s_(),zp&&n_()):zp&&n_()))," "===Xp&&!0!==Qp&&zp+Np===0||(Gp===Fp?(" "===Xp&&Np&&s_(),i_(Xp,Hp),s_()):Kp||Zp?(Np&&s_(),i_(Xp,Hp)):i_(Xp,Hp)),qp=Gp);Np&&s_(),zp&&n_(),e_.length>0&&(e_[e_.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{$p.paraNumber++,zp=o.measureText(t).width,e_.push({x:n||0,text:t,width:zp,paraStart:!0}),t_&&r_()})}(a,t,e),o&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":d_(e,"x",t[l_]);break;case"right":d_(e,"x",-t[a_])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":d_(e,"y",t[o_]);break;case"bottom":d_(e,"y",-t[h_])}}(o,a,e,n,r),function(t,e){const{rows:i,bounds:s}=t,n=i.length,{__lineHeight:r,__baseLine:o,__letterSpacing:a,__clipText:h,textAlign:l,verticalAlign:d,paraSpacing:c,autoSizeAlign:u}=e;let{x:p,y:_,width:g,height:f}=s,y=r*n+(c?c*(t.paraNumber-1):0),m=o;if(h&&y>f)y=Math.max(e.__autoHeight?y:f,r),n>1&&(t.overflow=n);else if(f||u)switch(d){case"middle":_+=(f-y)/2;break;case"bottom":_+=f-y}m+=_;let v,w,x,b=g||u?g:t.maxWidth;for(let o=0,d=n;o<d;o++){if(v=i[o],v.x=p,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&&o>0&&(m+=c),v.y=m,m+=r,t.overflow>o&&m>y&&(v.isOverflow=!0,t.overflow=o+1),w=v.x,x=v.width,a<0&&(v.width<0?(x=-v.width+e.fontSize+a,w-=x,x+=e.fontSize):x-=a),w<s.x&&(s.x=w),x>s.width&&(s.width=x),h&&g&&g<x&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=_,s.height=y}(a,e),e.__isCharMode&&function(t,e,i){const{rows:s}=t,{textAlign:n,paraIndent:r}=e,o=e.__letterSpacing||e.motionText,a=i&&n.includes("both"),h=a||i&&n.includes("justify"),l=h&&n.includes("letter");let d,c,u,p,_,g,f,y,m,v;s.forEach(t=>{t.words&&(_=r&&t.paraStart?r:0,y=t.words.length,h&&(v=!t.paraEnd||a,c=i-t.width-_,l?p=c/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=y>1?c/(y-1):0),g=o||t.isOverflow||l?0:u?1:2,t.isOverflow&&!o&&(t.textMode=!0),2===g?(t.x+=_,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=_,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,n){return t.forEach(t=>{(s||" "!==t.char)&&(t.x=e,i.push(t)),e+=t.width,n&&(e+=n)}),e}(e.data,d,t.data,t.isOverflow,v&&p),v&&(m=i===y-1,u?m||(d+=u,t.width+=u):p&&(t.width+=p*(e.data.length-(m?1:0))))})),t.words=null)})}(a,e,n),a.overflow&&function(t,e,i,s){const{rows:n,overflow:r}=t;let{textOverflow:o}=e;if(r&&n.splice(r),s&&o&&"show"!==o){let t,a;"hide"===o?o="":"ellipsis"===o&&(o="...");const h=o?ee.canvas.measureText(o).width:0,l=i+s-h;("none"===e.textWrap?n:[n[r-1]]).forEach(e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],a=t.x+t.width,!(s===i&&a<l));s--){if(a<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:o,x:a}),e.textMode&&function(t){t.text="",t.data.forEach(e=>{t.text+=e.char}),t.data=null}(e)}})}}(a,e,i,n),"none"!==e.textDecoration&&function(t,e){let i,s=0;const{fontSize:n,textDecoration:r}=e;switch(t.decorationHeight=n/11,p(r)?(i=r.type,r.color&&(t.decorationColor=el.string(r.color)),r.offset&&(s=Math.min(.3*n,Math.max(r.offset,.15*-n)))):i=r,i){case"under":t.decorationY=[.15*n+s];break;case"delete":t.decorationY=[.35*-n];break;case"under-delete":t.decorationY=[.15*n+s,.35*-n]}}(a,e),a}};const u_={string:function(t,e){if(!t)return"#000";const i=d(e)&&e<1;if(h(t)){if(!i||!el.object)return t;t=el.object(t)}let s=o(t.a)?1:t.a;i&&(s*=e);const n=t.r+","+t.g+","+t.b;return 1===s?"rgb("+n+")":"rgba("+n+","+s+")"}};Object.assign(tl,c_),Object.assign(el,u_),Object.assign(nl,qc),Object.assign(rl,Bu),Object.assign(ol,Vu),Object.assign(al,op),Object.assign(ue,{interaction:(t,e,i,s)=>new Lc(t,e,i,s),hitCanvas:(t,e)=>new Bh(t,e),hitCanvasManager:()=>new _c}),Th();class p_ extends ml{get __drawAfterFill(){return!0}setRobot(t){this._robot=t,this.__leaf.__updateRobot()}setAction(t){this._action=t,this.__leaf.__updateAction()}}function __(t,e){return _r(t,t=>({set(i){this.__setAttr(t,i),this.leaferIsReady?e?dl.setStyleName(this,e,i):dl.set(this,i):this.__layout.stateStyleChanged=!0}}))}function g_(t){return _r(t,t=>({set(e){this.__setAttr(t,e),this.__layout.stateStyleChanged=!0}}))}function f_(t,e){if(e&&!0!==e)return e;if(!t.button){let{parent:e}=t;for(let t=0;t<2;t++)if(e){if(e.button)return e;e=e.parent}}return null}function y_(t,e){p(e)||(e=void 0),w_(t,e,"in")}function m_(t,e){const{normalStyle:i}=t;p(e)||(e=void 0),i&&(e||(e=i),w_(t,e,"out"))}t.Robot=class extends t.UI{get __tag(){return"Robot"}get nowFrame(){return this.robotFrames&&this.robotFrames[this.now]}constructor(t){super(t)}togglePlay(){this.running?this.pause():this.play()}play(){this.running=!0}pause(){this.running=!1}stop(){this.pause()}__updateRobot(){const{robot:t}=this;if(this.robotFrames=[],!t)return;let e=0;u(t)?t.forEach(t=>this.__loadRobot(t,e,e+=t.total||1)):this.__loadRobot(t,0,t.total)}__updateAction(){const t=this.actions[this.action];if(this.stop(),this.__timer&&clearTimeout(this.__timer),!o(t))if(d(t))this.now=t;else if(p(t)){const e=u(t),i=e?t:t.keyframes;this.__action=e?void 0:t;const{length:s}=i;if(s>1){const t=this.now=i[0],e=i[i.length-1];this.play(),this.__runAction(t,e)}else s&&(this.now=i[0])}}__loadRobot(t,e,i){for(let t=e;t<i;t++)this.robotFrames.push(void 0);const s=or.get(t);s.ready?this.__createFrames(s,t,e,i):s.load(()=>this.__createFrames(s,t,e,i))}__createFrames(t,e,i,s){const{offset:n,size:r,total:o}=e,{width:a,height:h}=r&&(d(r)?{width:r,height:r}:r)||(o>1?this:t);let l=n?n.x:0,c=n?n.y:0;for(let e=i;e<s;e++)this.robotFrames[e]={view:t.view,x:l,y:c,width:a,height:h},l+a>=t.width?(l=0,c+=h):l+=a;this.__updateRobotBounds(),this.forceRender(),this.emitEvent(new Go(Go.LOADED,{image:t}))}__runAction(t,e){let{FPS:i,loop:s,__action:n}=this;n&&(n.FPS&&(i=n.FPS),o(n.loop)||(s=n.loop)),this.__timer=setTimeout(()=>{if(this.running){if(this.now===e){if(!s)return this.stop();this.now=t}else this.now++;this.__updateRobotBounds()}this.__runAction(t,e)},1e3/i)}__updateRobotBounds(){const{nowFrame:t}=this;if(t){const e=this.__,i=t.width/e.pixelRatio,s=t.height/e.pixelRatio;e.width===i&&e.height===s||this.forceUpdate(),e.__naturalWidth=i,e.__naturalHeight=s}}__drawContent(t,e){const{nowFrame:i}=this,{width:s,height:n}=this.__;i&&t.drawImage(i.view,i.x,i.y,i.width,i.height,0,0,s,n)}destroy(){this.robotFrames&&(this.robotFrames=null),super.destroy()}},s([Hr(p_)],t.Robot.prototype,"__",void 0),s([Er()],t.Robot.prototype,"robot",void 0),s([yr()],t.Robot.prototype,"actions",void 0),s([yr("")],t.Robot.prototype,"action",void 0),s([Dr(0)],t.Robot.prototype,"now",void 0),s([yr(12)],t.Robot.prototype,"FPS",void 0),s([yr(!0)],t.Robot.prototype,"loop",void 0),t.Robot=s([Jr()],t.Robot),ce.add("robot");const v_={};function w_(t,e,i){const{normalStyle:s}=t;e||(e=v_),e.scale&&(M.assignScale(e,e.scale),delete e.scale),e!==v_&&dl.canAnimate||(i=null);let n=!!i&&function(t,e,i){let s="in"===t?"transition":"transitionOut";"out"===t&&a(i[s])&&a(e[s])&&(s="transition");return a(e[s])?i[s]:e[s]}(i,e,t);const r=n?function(t,e){const i=E_(e,t),s=t.animate();s&&E_(i,t,s.fromStyle);return i}(t,e):void 0;dl.canAnimate&&x_(t)&&t.killAnimate("transition"),s&&t.set(s,"temp");const o=x_(t);if(o){const{animation:s}=o;if(s){const r=t.animate(s,void 0,"animation",!0);Object.assign(o,r.endingStyle),"in"!==i||e.animation!==s?r.kill():n=!1,delete o.animation}t.normalStyle=b_(o,t),t.set(o,"temp")}else t.normalStyle=void 0;if(n){const e=b_(r,t);t.set(r,"temp"),t.animate([r,e],n,"transition",!0)}t.__layout.stateStyleChanged=!1}function x_(t){let e;const i={},s=f_(t),n=s?t.state||s.state:t.state,r=n&&t.states[n];r&&dl.isState(n,t,s)&&(e=P_(i,r));const o=i.selectedStyle||t.selectedStyle;o&&dl.isSelected(t,s)&&(e=P_(i,o));const a=i.placeholderStyle||t.placeholderStyle;if(a&&dl.isPlacehold(t,s)&&(e=P_(i,a)),dl.isDisabled(t,s)){const s=i.disabledStyle||t.disabledStyle;s&&(e=P_(i,s))}else{const n=i.focusStyle||t.focusStyle;n&&dl.isFocus(t,s)&&(e=P_(i,n));const r=i.hoverStyle||t.hoverStyle;r&&dl.isHover(t,s)&&(e=P_(i,r));const o=i.pressStyle||t.pressStyle;o&&dl.isPress(t,s)&&(e=P_(i,o))}return e?i:void 0}function b_(t,e,i,s){const n=i?t:{},r=i||t;for(let t in r)s&&dl.animateExcludes[t]||(n[t]=e[t]);return n}function E_(t,e,i){return b_(t,e,i,!0)}function P_(t,e){return Object.assign(t,e),!0}function S_(t,e){const i=t[e];i&&y_(t,i),t.button&&B_(t.children,e)}function k_(t,e,i){i||(i=t.states[e]),y_(t,i),t.button&&B_(t.children,null,e)}function B_(t,e,i){if(!t)return;let s,n;for(let r=0,a=t.length;r<a;r++){if(s=t[r],e){switch(n=!0,e){case"hoverStyle":dl.isHover(s)&&(n=!1);break;case"pressStyle":dl.isPress(s)&&(n=!1);break;case"focusStyle":dl.isFocus(s)&&(n=!1)}n&&S_(s,e)}else o(i)||k_(s,i);s.isBranch&&B_(s.children,e,i)}}function T_(t,e){const i=t[e];i&&m_(t,i),t.button&&R_(t.children,e)}function C_(t,e,i){m_(t,i),t.button&&R_(t.children,null,e)}function R_(t,e,i){if(!t)return;let s;for(let n=0,r=t.length;n<r;n++)s=t[n],e?T_(s,e):o(i)||C_(s,i),s.isBranch&&R_(s.children,e,i)}function L_(t,e,i){let s;const n=e.leafer?e.leafer.interaction:null;if(n&&(s=n[t](e),!s&&i)){const r=f_(e,i);r&&(s=n[t](r))}return s}function D_(t,e,i){let s=e[t];if(!s&&i){const n=f_(e,i);n&&(s=n[t])}return s}ce.add("state"),dl.animateExcludes={animation:1,animationOut:1,transition:1,transitionOut:1,states:1,state:1,placeholder:1,normalStyle:1,hoverStyle:1,pressStyle:1,focusStyle:1,selectedStyle:1,disabledStyle:1,placeholderStyle:1},dl.isState=function(t,e,i){return function(t,e,i){let s=e.states[t];if(!s&&i){const n=f_(e,i);n&&(s=n.states[t])}return!!s}(t,e,i)},dl.isSelected=function(t,e){return D_("selected",t,e)},dl.isDisabled=function(t,e){return D_("disabled",t,e)},dl.isFocus=function(t,e){return L_("isFocus",t,e)},dl.isHover=function(t,e){return L_("isHover",t,e)},dl.isPress=function(t,e){return L_("isPress",t,e)},dl.isPlacehold=function(t,e){return t.__.__isPlacehold},dl.isDrag=function(t,e){return L_("isDrag",t,e)},dl.setStyleName=function(t,e,i){i?k_(t,e,t[e]):C_(t,e,t[e])},dl.set=function(t,e){const i=t.states[e];i?k_(t,e,i):C_(t,e,i)},dl.getStyle=x_,dl.updateStyle=w_,dl.updateEventStyle=function(e,i){switch(i){case t.PointerEvent.ENTER:S_(e,"hoverStyle");break;case t.PointerEvent.LEAVE:T_(e,"hoverStyle");break;case t.PointerEvent.DOWN:S_(e,"pressStyle");break;case t.PointerEvent.UP:T_(e,"pressStyle")}};const A_=t.UI.prototype;t.UI.addAttr("selected",!1,__,"selectedStyle"),t.UI.addAttr("disabled",!1,__,"disabledStyle"),t.UI.addAttr("states",{},g_),t.UI.addAttr("state","",__),t.UI.addAttr("normalStyle",void 0,yr),t.UI.addAttr("hoverStyle",void 0,g_),t.UI.addAttr("pressStyle",void 0,g_),t.UI.addAttr("focusStyle",void 0,g_),t.UI.addAttr("selectedStyle",void 0,g_),t.UI.addAttr("disabledStyle",void 0,g_),t.UI.addAttr("placeholderStyle",void 0,g_),t.UI.addAttr("button",!1,yr),A_.set=function(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):Object.assign(this,t))},A_.focus=function(t=!0){this.waitLeafer(()=>{let{focusData:e}=this.app.interaction;t?(e&&e.focus(!1),e=this):e=null,this.app.interaction.focusData=e,t?S_(this,"focusStyle"):T_(this,"focusStyle")})},A_.updateState=function(){dl.updateStyle(this,void 0,"in")};const O_=t.Text.prototype,I_="text";cr(O_,I_,Object.assign(Object.assign({},ur(O_,I_)),{set(t){const e=this,i=e.text;e.__setAttr(I_,t)&&(Sr(e),e.placeholderStyle&&e.placeholder&&(""===i||""===t)&&(e.__layout.stateStyleChanged=!0))}}));const{cos:M_,sin:F_,pow:W_,sqrt:U_,abs:N_,ceil:z_,floor:Y_,round:X_,PI:H_}=Math,j_=5*H_,V_=1.70158,G_=2.5949095,q_=7.5625,K_=2.75;function Z_(t){return e=>W_(e,t)}function Q_(t){return e=>1-W_(1-e,t)}function $_(t){return e=>e<.5?.5*W_(2*e,t):1-.5*W_(2-2*e,t)}function J_(t){return t<1/K_?q_*t*t:t<2/K_?q_*(t-=1.5/K_)*t+.75:t<2.5/K_?q_*(t-=2.25/K_)*t+.9375:q_*(t-=2.625/K_)*t+.984375}function tg(t,e,i,s){const n={};return r=>{const o=~~(1e4*r),a=n[o];if(a)return a;let h,l,d,c=r;for(let e=0;e<8&&(h=1-c,d=eg(c,t,i)-r,l=3*h*h*t+6*h*c*(i-t)+3*c*c*(1-i),!(N_(l)<1e-6));e++)c-=d/l;return n[o]=eg(c,e,s)}}function eg(t,e,i){const s=1-t;return 3*s*s*t*e+3*s*t*t*i+t*t*t}const ig={get(t){const{list:e}=ig;return h(t)?e[t||"ease"]:p(t)?e[t.name].apply(e,u(t.value)?t.value:[t.value]):e.ease},register(t,e){ig.list[t]=e},list:{linear:t=>t,ease:tg(.25,.1,.25,1),"ease-in":tg(.42,0,1,1),"ease-out":tg(0,0,.58,1),"ease-in-out":tg(.42,0,.58,1),"sine-in":t=>1-M_(t*H_*.5),"sine-out":t=>F_(t*H_*.5),"sine-in-out":t=>.5*(1-M_(t*H_)),"quad-in":Z_(2),"quad-out":Q_(2),"quad-in-out":$_(2),"cubic-in":Z_(3),"cubic-out":Q_(3),"cubic-in-out":$_(3),"quart-in":Z_(4),"quart-out":Q_(4),"quart-in-out":$_(4),"quint-in":Z_(5),"quint-out":Q_(5),"quint-in-out":$_(5),"expo-in":t=>t?W_(2,10*t-10):0,"expo-out":t=>1===t?1:1-W_(2,10*-t),"expo-in-out":t=>0===t||1===t?t:t<.5?.5*W_(2,2*t*10-10):.5*(2-W_(2,10-2*t*10)),"circ-in":t=>1-U_(1-W_(t,2)),"circ-out":t=>U_(1-W_(t-1,2)),"circ-in-out":t=>t<.5?.5*(1-U_(1-W_(2*t,2))):.5*(U_(1-W_(2-2*t,2))+1),"back-in":t=>((V_+1)*t-V_)*t*t,"back-out":t=>(t-=1)*t*((V_+1)*t+V_)+1,"back-in-out":t=>t<.5?(t*=2)*t*((G_+1)*t-G_)*.5:.5*((t=2*t-2)*t*((G_+1)*t+G_)+2),"elastic-in":t=>0===t||1===t?t:-W_(2,10*(t-1))*F_((t-1.1)*j_),"elastic-out":t=>0===t||1===t?t:W_(2,-10*t)*F_((t-.1)*j_)+1,"elastic-in-out":t=>0===t||1===t?t:t<.5?-W_(2,10*((t*=2)-1))*F_((t-1.1)*j_)*.5:W_(2,10*(1-(t*=2)))*F_((t-1.1)*j_)*.5+1,"bounce-in":t=>1-J_(1-t),"bounce-out":J_,"bounce-in-out":t=>t<.5?.5*(1-J_(1-2*t)):.5*(1+J_(2*t-1)),"cubic-bezier":tg,steps:function(t,e="floor"){return i=>("floor"===e?Y_(i*t):"ceil"===e?z_(i*t):X_(i*t))/t}}};function sg(t){return(e,i)=>{Object.defineProperty(e,i,{get(){const e=this.config&&this.config[i];return void 0===e?t:e},set(t){this.config||(this.config={}),this.config[i]=t}})}}class ng{}ng.CREATED="created",ng.PLAY="play",ng.PAUSE="pause",ng.STOP="stop",ng.SEEK="seek",ng.UPDATE="update",ng.COMPLETED="completed";t.Animate=class extends ca{get endingStyle(){return"from"===this.realEnding?this.fromStyle:this.toStyle}get started(){return!!this.requestAnimateTime}get completed(){return this.time>=this.duration&&!this.started}get frame(){return this.frames[this.nowIndex]}get frameTotalTime(){return this.frame.totalTime||this.frame.duration||0}get nowReverse(){return(this.mainReverse?1:0)+(this.frameReverse?1:0)==1}get realEnding(){let t;const{ending:e,reverse:i,swing:s,loop:n}=this;return"from"===e?t=0:"to"===e?t=1:(t=i?0:1,s&&n&&d(n)&&(t+=n-1)),t%2?"to":"from"}constructor(t,e,i,s){super(),this.nowIndex=0,this.playedTotalTime=0,e&&(e.keyframes?(i=e,e=e.keyframes):e.style&&(i=e,e=e.style)),this.init(t,e,i,s)}init(t,e,i,s){switch(this.target=t,(s||this.isTemp)&&(this.isTemp=s),typeof i){case"number":this.config={duration:i};break;case"string":this.config={easing:i};break;case"object":this.config=i,i.event&&(this.event=i.event)}this.keyframes=u(e)?e:e?[e]:[];const{easing:n,attrs:r}=this;this.easingFn=ig.get(n),(r||this.attrsMap)&&(this.attrsMap=r?r.reduce((t,e)=>(t[e]=!0,t),{}):void 0),this.frames=[],this.create(),this.autoplay&&this.frames.length&&(this.timer=setTimeout(()=>{this.timer=0,this.play()},0))}emitType(t){this.emit(t,this),this.parent&&this.parent.onChildEvent(t,this)}play(){this.destroyed||(this.running=!0,this.started?this.timer||this.startRequestAnimate():(this.clearTimer(),this.start()),this.emitType(ng.PLAY))}pause(){this.destroyed||(this.running=!1,this.clearTimer(),this.emitType(ng.PAUSE))}stop(){this.destroyed||(this.complete(),this.emitType(ng.STOP))}seek(t,e){if(this.destroyed)return;const{delay:i}=this;let s;p(t)&&(t=il.number(t,this.duration+(e?i:0))),e&&(t-=i),t&&(t/=this.speed),t<0&&(s=-t,t=0),(!this.started||t<this.time||!t)&&this.start(!0),this.time=t,s||this.animate(0,!0),this.clearTimer(()=>{s?this.timer=setTimeout(()=>{this.timer=0,this.begin()},1e3*s):this.startRequestAnimate()}),this.emitType(ng.SEEK)}kill(t=!0,e){this.killStyle=e,this.destroy(t)}create(){const{target:t,frames:e,keyframes:i,config:s}=this,{length:n}=i,r=!(n>1)||this.join;let a,h,l,c,u,p=0,_=0;n>1&&(this.fromStyle={},this.toStyle={});for(let s=0;s<n;s++){if(h=i[s],c=h.style||h,a||(a=r?t:c),l={style:c,beforeStyle:{}},u=1,h.style){const{duration:t,autoDuration:e,delay:i,autoDelay:s,easing:n,swing:r,loop:o}=h;r&&(l.swing=d(r)?r:2,u=2*l.swing-1),o&&(l.loop=u=d(o)?o:2),t?(l.duration=t,p+=t*u,i&&(l.totalTime=t+i)):e&&(l.autoDuration=e,_+=e*u),i?(l.delay=i,p+=i*u):s&&(l.autoDelay=s,_+=s*u),n&&(l.easingFn=ig.get(n))}if(!l.autoDuration&&o(l.duration)&&(n>1?s>0||r?_+=u:l.duration=0:l.duration=this.duration),n>1)this.setBefore(l,c,a);else{for(let e in c)l.beforeStyle[e]=t[e];this.fromStyle=l.beforeStyle,this.toStyle=l.style}a=c,e.push(l)}_?((this.duration<=p||!s||!s.duration)&&this.changeDuration(p+.2*_),this.allocateTime((this.duration-p)/_)):p&&this.changeDuration(p),this.emitType(ng.CREATED)}changeDuration(t){const{config:e}=this;this.config=e?Object.assign(Object.assign({},e),{duration:t}):{duration:t}}setBefore(t,e,i){const{fromStyle:s,toStyle:n,target:r}=this;for(let a in e)o(s[a])&&(s[a]=n[a]=e===i?i[a]:r[a]),t.beforeStyle[a]=o(i[a])?n[a]:i[a],n[a]=e[a]}allocateTime(t){let e,{frames:i}=this,{length:s}=i;for(let n=0;n<s;n++)e=i[n],o(e.duration)&&(e.duration=e.autoDuration?t*e.autoDuration:t),e.totalTime||(e.autoDelay&&(e.delay=e.autoDelay*t),e.delay&&(e.totalTime=e.duration+e.delay))}startRequestAnimate(){this.requestAnimateTime=Date.now(),this.requestAnimatePageTime=0,this.waitRequestRender||this.requestAnimate()}requestAnimate(){this.waitRequestRender=!0,ee.requestRender(this.animate.bind(this))}animate(t,e){if(!e){if(this.waitRequestRender=!1,!this.running)return;let e;e=t&&this.requestAnimatePageTime?t-this.requestAnimatePageTime:Date.now()-this.requestAnimateTime,this.time+=e/1e3,this.requestAnimatePageTime=t,this.requestAnimateTime=Date.now()}const{duration:i}=this,s=this.time*this.speed;if(s<i){for(;s-this.playedTotalTime>this.frameTotalTime;)this.transition(1),this.mainReverse?this.reverseNextFrame():this.nextFrame();const t=this.nowReverse?0:this.frame.delay||0,e=s-this.playedTotalTime-t,i=this.frame.duration;if(e>i)this.transition(1);else if(e>=0){const t=i?e/i:1;this.transition(this.frame.easingFn?this.frame.easingFn(t):this.easingFn(t))}}else this.end();if(!e)if(s<i)this.requestAnimate();else{const{loop:t,loopDelay:e,swing:i}=this;if((!1!==t||i)&&(this.looped?this.looped++:this.looped=1,this.needLoop(this.looped,t,i)))return i&&(this.mainReverse=!this.mainReverse),void(e?this.timer=setTimeout(()=>{this.timer=0,this.begin()},e/this.speed*1e3):this.begin());this.complete()}}start(t){this.requestAnimateTime=1;const{reverse:e,jump:i}=this;if((e||this.mainReverse)&&(this.mainReverse=e),this.looped&&(this.looped=0),t)this.begin(!0);else{const{delay:t}=this;t?(i&&this.begin(!0),this.timer=setTimeout(()=>{this.timer=0,this.begin()},t/this.speed*1e3)):this.begin()}}begin(t){this.playedTotalTime=this.time=0,this.mainReverse?this.setTo():this.setFrom(),t||this.startRequestAnimate()}end(){this.mainReverse?this.setFrom():this.setTo()}complete(){this.requestAnimateTime=0,this.running=!1;const{endingStyle:t,killStyle:e}=this,i=e?{}:t;if(e)for(let s in t)s in e||(i[s]=t[s]);this.setStyle(i),this.clearTimer(),this.emitType(ng.COMPLETED)}setFrom(){this.nowIndex=0,this.setStyle(this.fromStyle)}setTo(){this.nowIndex=this.frames.length-1,this.setStyle(this.toStyle)}nextFrame(){if(this.needLoopFrame())return this.increaseTime();this.nowIndex+1>=this.frames.length||(this.increaseTime(),this.nowIndex++)}reverseNextFrame(){if(this.needLoopFrame())return this.increaseTime();this.nowIndex-1<0||(this.increaseTime(),this.nowIndex--)}transition(t){const{style:e,beforeStyle:i}=this.frame,s=this.nowReverse?e:i,n=this.nowReverse?i:e;if(0===t)this.setStyle(s);else if(1===t)this.setStyle(n);else{const{attrsMap:i,target:r}=this;let{betweenStyle:o}=this.frame;o||(o=this.frame.betweenStyle={}),cl.setBetweenStyle(o,s,n,e,t,r,i),this.setStyle(o)}this.emitType(ng.UPDATE)}setStyle(t){const{target:e}=this;e&&t&&(this.style=t,e.__?e.set(t,!!this.isTemp&&"temp"):Object.assign(e,t))}increaseTime(){this.playedTotalTime+=this.frameTotalTime}needLoop(t,e,i){return!(this.needStopLoop(t,e)||this.needStopLoop(t,i,!0))}needStopLoop(t,e,i){return d(e)&&(!e||t>=(i?2*e-1:e))}needLoopFrame(){const{loop:t,swing:e}=this.frame;if(t||e){if(this.frameLooped?this.frameLooped++:this.frameLooped=1,e&&(this.frameReverse=!this.frameReverse),this.needLoop(this.frameLooped,t,e))return!0;this.frameLooped=this.frameReverse=void 0}return!1}clearTimer(t){this.timer&&(clearTimeout(this.timer),this.timer=0,t&&t())}destroy(t){this.destroyed||(super.destroy(),t&&!this.completed?this.stop():this.pause(),this.target=this.parent=this.config=this.frames=this.fromStyle=this.toStyle=this.style=this.killStyle=null,this.destroyed=!0)}},s([sg("ease")],t.Animate.prototype,"easing",void 0),s([sg(0)],t.Animate.prototype,"delay",void 0),s([sg(.2)],t.Animate.prototype,"duration",void 0),s([sg("auto")],t.Animate.prototype,"ending",void 0),s([sg(!1)],t.Animate.prototype,"reverse",void 0),s([sg(!1)],t.Animate.prototype,"swing",void 0),s([sg(!1)],t.Animate.prototype,"loop",void 0),s([sg(0)],t.Animate.prototype,"loopDelay",void 0),s([sg(1)],t.Animate.prototype,"speed",void 0),s([sg(!0)],t.Animate.prototype,"autoplay",void 0),s([sg()],t.Animate.prototype,"join",void 0),s([sg()],t.Animate.prototype,"jump",void 0),s([sg()],t.Animate.prototype,"attrs",void 0),t.Animate=s([$r(ba)],t.Animate),t.AnimateList=class extends t.Animate{get completed(){return this.list.every(t=>t.completed)}get endingStyle(){return this._endingStyle}constructor(t,e,i){super(t,null),this.list=[],this.updateList(e,i)}updateList(e,i){this.fromStyle={},this.toStyle={},this._endingStyle={},e||(e=this.list.filter(t=>{const{completed:e}=t;return e&&t.destroy(),!e})),this.list=e.map(e=>{const s=e.target?e:new t.Animate(this.target,e,i);return s.parent=this,Object.assign(this.fromStyle,s.fromStyle),Object.assign(this.toStyle,s.toStyle),Object.assign(this._endingStyle,s.endingStyle),s})}play(){this.each(t=>t.play()),this.emitType(ng.PLAY)}pause(){this.each(t=>t.pause()),this.emitType(ng.PAUSE)}stop(){this.each(t=>t.stop()),this.emitType(ng.STOP)}seek(t,e){this.each(i=>i.seek(t,e)),this.emitType(ng.SEEK)}kill(t,e){this.each(i=>i.kill(t,e)),this.destroy()}onChildEvent(t,e){switch(t){case ng.COMPLETED:this.completed&&this.emitType(t);break;case ng.UPDATE:this.emitType(t)}}each(t){this.list.forEach(t)}destroy(t){const{list:e}=this;e.length&&(this.each(e=>e.destroy(t)),e.length=0)}},t.AnimateList=s([$r(ba)],t.AnimateList);const rg={transparent:"FFF0",aliceblue:"F0F8FF",antiquewhite:"FAEBD7",aqua:"0FF",aquamarine:"7FFFD4",azure:"F0FFFF",beige:"F5F5DC",bisque:"FFE4C4",black:"0",blanchedalmond:"FFEBCD",blue:"00F",blueviolet:"8A2BE2",brown:"A52A2A",burlywood:"DEB887",cadetblue:"5F9EA0",chartreuse:"7FFF00",chocolate:"D2691E",coral:"FF7F50",cornflowerblue:"6495ED",cornsilk:"FFF8DC",crimson:"DC143C",cyan:"0FF",darkblue:"00008B",darkcyan:"008B8B",darkgoldenrod:"B8860B",darkgray:"A9",darkgreen:"006400",darkgrey:"A9",darkkhaki:"BDB76B",darkmagenta:"8B008B",darkolivegreen:"556B2F",darkorange:"FF8C00",darkorchid:"9932CC",darkred:"8B0000",darksalmon:"E9967A",darkseagreen:"8FBC8F",darkslateblue:"483D8B",darkslategray:"2F4F4F",darkslategrey:"2F4F4F",darkturquoise:"00CED1",darkviolet:"9400D3",deeppink:"FF1493",deepskyblue:"00BFFF",dimgray:"69",dimgrey:"69",dodgerblue:"1E90FF",firebrick:"B22222",floralwhite:"FFFAF0",forestgreen:"228B22",fuchsia:"F0F",gainsboro:"DC",ghostwhite:"F8F8FF",gold:"FFD700",goldenrod:"DAA520",gray:"80",green:"008000",greenyellow:"ADFF2F",grey:"80",honeydew:"F0FFF0",hotpink:"FF69B4",indianred:"CD5C5C",indigo:"4B0082",ivory:"FFFFF0",khaki:"F0E68C",lavender:"E6E6FA",lavenderblush:"FFF0F5",lawngreen:"7CFC00",lemonchiffon:"FFFACD",lightblue:"ADD8E6",lightcoral:"F08080",lightcyan:"E0FFFF",lightgoldenrodyellow:"FAFAD2",lightgray:"D3",lightgreen:"90EE90",lightgrey:"D3",lightpink:"FFB6C1",lightsalmon:"FFA07A",lightseagreen:"20B2AA",lightskyblue:"87CEFA",lightslategray:"789",lightslategrey:"789",lightsteelblue:"B0C4DE",lightyellow:"FFFFE0",lime:"00FF00",limegreen:"32CD32",linen:"FAF0E6",magenta:"FF00FF",maroon:"800000",mediumaquamarine:"66CDAA",mediumblue:"0000CD",mediumorchid:"BA55D3",mediumpurple:"9370DB",mediumseagreen:"3CB371",mediumslateblue:"7B68EE",mediumspringgreen:"00FA9A",mediumturquoise:"48D1CC",mediumvioletred:"C71585",midnightblue:"191970",mintcream:"F5FFFA",mistyrose:"FFE4E1",moccasin:"FFE4B5",navajowhite:"FFDEAD",navy:"000080",oldlace:"FDF5E6",olive:"808000",olivedrab:"6B8E23",orange:"FFA500",orangered:"FF4500",orchid:"DA70D6",palegoldenrod:"EEE8AA",palegreen:"98FB98",paleturquoise:"AFEEEE",palevioletred:"D87093",papayawhip:"FFEFD5",peachpuff:"FFDAB9",peru:"CD853F",pink:"FFC0CB",plum:"DDA0DD",powderblue:"B0E0E6",purple:"800080",rebeccapurple:"639",red:"F00",rosybrown:"BC8F8F",royalblue:"4169E1",saddlebrown:"8B4513",salmon:"FA8072",sandybrown:"F4A460",seagreen:"2E8B57",seashell:"FFF5EE",sienna:"A0522D",silver:"C0",skyblue:"87CEEB",slateblue:"6A5ACD",slategray:"708090",slategrey:"708090",snow:"FFFAFA",springgreen:"00FF7F",steelblue:"4682B4",tan:"D2B48C",teal:"008080",thistle:"D8BFD8",tomato:"FF6347",turquoise:"40E0D0",violet:"EE82EE",wheat:"F5DEB3",white:"F",whitesmoke:"F5",yellow:"FF0",yellowgreen:"9ACD32"},og=/^rgb\((\d+),\s*(\d+),\s*(\d+)/i,ag=/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)/i,hg=/^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i,lg=/^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i,dg=parseInt,cg=parseFloat,{round:ug}=Math;let pg={},_g=0;function gg(t){let e,i,s,n=1;switch(t.length){case 9:e=dg(t.slice(1,3),16),i=dg(t.slice(3,5),16),s=dg(t.slice(5,7),16),n=dg(t.slice(7,9),16)/255;break;case 7:e=dg(t.slice(1,3),16),i=dg(t.slice(3,5),16),s=dg(t.slice(5,7),16);break;case 5:e=dg(t[1]+t[1],16),i=dg(t[2]+t[2],16),s=dg(t[3]+t[3],16),n=dg(t[4]+t[4],16)/255;break;case 4:e=dg(t[1]+t[1],16),i=dg(t[2]+t[2],16),s=dg(t[3]+t[3],16);break;case 3:e=i=s=dg(t[1]+t[2],16);break;case 2:e=i=s=dg(t[1]+t[1],16)}return{r:e,g:i,b:s,a:n}}const fg=1/6,yg=.5,mg=2/3,vg=1/3;function wg(t,e,i){return i<0?i++:i>1&&i--,i<fg?t+6*(e-t)*i:i<yg?e:i<mg?t+(e-t)*(mg-i)*6:t}function xg(t,e,i,s=1){let n,r,o;if(t/=360,i/=100,0===(e/=100))n=r=o=i;else{let s=i<.5?i*(1+e):i+e-i*e,a=2*i-s;n=wg(a,s,t+vg),r=wg(a,s,t),o=wg(a,s,t-vg)}return{r:ug(255*n),g:ug(255*r),b:ug(255*o),a:s}}ce.add("color"),el.object=function(t,e){let i,s=!o(e)&&e<1;if(h(t)){const e=pg[t];if(e)i=Object.assign({},e);else{switch(t[0]){case"#":i=gg(t);break;case"R":case"r":"("===t[4]&&ag.test(t)?i=function(t){const e=ag.exec(t);return{r:dg(e[1]),g:dg(e[2]),b:dg(e[3]),a:cg(e[4])}}(t):"("===t[3]&&og.test(t)&&(i=function(t){const e=og.exec(t);return{r:dg(e[1]),g:dg(e[2]),b:dg(e[3]),a:1}}(t));break;case"H":case"h":"("===t[4]&&lg.test(t)?i=function(t){const e=lg.exec(t);return xg(cg(e[1]),cg(e[2]),cg(e[3]),cg(e[4]))}(t):"("===t[3]&&hg.test(t)&&(i=function(t){const e=hg.exec(t);return xg(cg(e[1]),cg(e[2]),cg(e[3]),1)}(t))}if(!i){const e=rg[t.toLowerCase()];e&&(i=gg("#"+e))}i&&(_g++,_g>1e4&&(pg={},_g=0),pg[t]=Object.assign({},i))}}else p(t)&&(o(t.a)&&(t.a=1),s&&(t=Object.assign({},t)),i=t);return i||(i={r:255,g:255,b:255,a:1}),s&&(i.a*=e),i};const{round:bg}=Math,{fourNumber:Eg}=M,Pg={fill:Cg,stroke:Cg,cornerRadius:(t,e,i)=>d(t)&&d(e)?Bg(t,e,i):(t=Eg(t),e=Eg(e),t.map((t,s)=>Bg(t,e[s],i))),text(t,e,i){if(h(t)&&h(e)){const s=t.length,n=e.length,r=Bg(s,n,i,1);return s<n?e.substring(0,r):t.substring(0,r)}return d(t)||d(e)?M.float(Bg(t,e,i),Math.max(kg(t),kg(e))):e},boxStyle(t,e,i,s){t||(t={}),e||(e={});const n=Object.assign(Object.assign({},t),e);return cl.setBetweenStyle(n,t,e,n,i,s),n},shadow:Rg,innerShadow:Rg},Sg={value:function(t,e,i){const s=d(t),n=d(e);return s&&n?t+(e-t)*i:n||s?Bg(t,e,i):t},number:Bg,color:Tg,setBetweenStyle:function(t,e,i,s,n,r,o){let a,h,l;const{list:d,value:c}=cl;for(let u in s)o&&!o[u]||(a=e[u],h=i[u],l=d[u]||c,a!==h&&(t[u]=l(a,h,n,r)))}};function kg(t){const e=String(t).split(".")[1];return e?e.length:0}function Bg(t,e,i,s){t||(t=0),e||(e=0);const n=t+(e-t)*i;return s?bg(n):n}function Tg(t,e,i){t=el.object(t),e=el.object(e);const s=Bg(t.r,e.r,i,1)+","+Bg(t.g,e.g,i,1)+","+Bg(t.b,e.b,i,1),n=Bg(t.a,e.a,i);return 1===n?"rgb("+s+")":"rgba("+s+","+n+")"}function Cg(t,e,i){return h(t)&&h(e)?Tg(t,e,i):e}function Rg(t,e,i){return u(t)||u(e)?e:(e=e||{},{x:Bg((t=t||{}).x,e.x,i),y:Bg(t.y,e.y,i),blur:Bg(t.blur,e.blur,i),spread:Bg(t.spread,e.spread,i),color:Tg(t.color||"#FFFFFF00",e.color||"#FFFFFF00",i),visible:e.visible,blendMode:e.blendMode,box:e.box||t.box})}ce.add("animate","color"),dl.canAnimate=!0,Object.assign(cl.list,Pg),Object.assign(cl,Sg);const Lg=t.UI.prototype;t.UI.addAttr("animation",void 0,function(t){return _r(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&(this.killAnimate("animation"),e&&this.animate(e,void 0,"animation"))}}))}),t.UI.addAttr("animationOut",void 0,yr),t.UI.addAttr("transition",!0,yr),t.UI.addAttr("transitionOut",void 0,yr),Lg.set=function(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):Object.assign(this,t))},Lg.animate=function(e,i,s,n){if(o(e))return this.__animate;let r=u(e)&&!i&&s?new t.AnimateList(this,e,n):new t.Animate(this,e,i,n);this.killAnimate(s,r.toStyle);const a=this.__animate;return a&&(r instanceof t.AnimateList?r.list.unshift(a):r=new t.AnimateList(this,[a,r])),this.__animate=r},Lg.killAnimate=function(e,i){const s=this.__animate;if(s){let e=!1;if(i&&!s.completed){s instanceof t.AnimateList&&s.updateList();const{toStyle:n}=s;for(let t in i)if(t in n){e=!0;break}}else e=!0;e&&(s.kill(!0,i),this.__animate=null)}},Lg.__runAnimation=function(t,e){this.animate("in"===t?this.animation:this.animationOut,void 0,"animation"),e&&this.__animate.on(ng.COMPLETED,e)};const Dg=[.1488743389,.4333953941,.6794095682,.8650633666,.9739065285],Ag=[.2955242247,.2692667193,.2190863625,.1494513491,.0666713443],{sqrt:Og}=Math,{getDerivative:Ig}=li,Mg={getDistance(t,e,i,s,n,r,o,a,h=1){let l,d,c,u,p,_,g=0,f=h/2;for(let h=0;h<Dg.length;h++)l=f*(1+Dg[h]),d=f*(1-Dg[h]),c=Ig(l,t,i,n,o),u=Ig(l,e,s,r,a),p=Ig(d,t,i,n,o),_=Ig(d,e,s,r,a),g+=Ag[h]*(Og(c*c+u*u)+Og(p*p+_*_));return g*f},getRotation(t,e,i,s,n,r,o,a,h){const l=Ig(t,e,s,r,a),d=Ig(t,i,n,o,h);return Math.atan2(d,l)/W},getT(t,e,i,s,n,r,o,a,h,l,d=1){let c=0,u=1,p=t/e,_=d/e/3;if(p>=1)return 1;if(p<=0)return 0;for(;u-c>_;)Fg(i,s,n,r,o,a,h,l,p)<t?c=p:u=p,p=(c+u)/2;return p},cut(t,e,i,s,n,r,o,a,h,l){const d=1-e,c=d*i+e*n,u=d*s+e*r,p=d*n+e*o,_=d*r+e*a,g=d*c+e*p,f=d*u+e*_,y=d*g+e*(d*p+e*(d*o+e*h)),m=d*f+e*(d*_+e*(d*a+e*l));t.push(Me.C,c,u,g,f,y,m)}},{getDistance:Fg}=Mg,{M:Wg,L:Ug,C:Ng,Z:zg}=Me,{float:Yg}=M,{set:Xg,getAngle:Hg,getDistanceFrom:jg,getDistancePoint:Vg}=lt,Gg={},qg={},Kg={transform(t,e){let i,s=0;const n=t.length;for(;s<n;)switch(i=t[s],i){case Wg:case Ug:Kg.transformPoints(t,e,s,1),s+=3;break;case Ng:Kg.transformPoints(t,e,s,3),s+=7;break;case zg:s+=1}},transformPoints(t,e,i,s){for(let n=i+1,r=n+2*s;n<r;n+=2)Gg.x=t[n],Gg.y=t[n+1],Q.toOuterPoint(e,Gg),t[n]=Gg.x,t[n+1]=Gg.y},getMotionPathData(t){let e,i,s,n,r,o=0,a=[],h=0,l=0,d=0,c=0,u=0;const p=t.length;for(;h<p;){switch(n=t[h],n){case Wg:c=t[h+1],u=t[h+2];case Ug:i=t[h+1],s=t[h+2],e=n===Ug&&h>0?jg(l,d,i,s):0,l=i,d=s,h+=3;break;case Ng:i=t[h+5],s=t[h+6],e=Mg.getDistance(l,d,t[h+1],t[h+2],t[h+3],t[h+4],i,s),l=i,d=s,h+=7;break;case zg:r=!0,e=jg(l,d,c,u),h+=1;break;default:e=0}a.push(e),o+=e}return{total:o,segments:a,data:t,closed:r}},getDistancePoint(t,e,i,s){const{segments:n,data:r,total:o}=t;e=il.number(e,o),s&&(e+=s),e>o&&(e%=o);let a,h,l,d,c,u,p,_,g,f=0,y={},m=0,v=0,w=0,x=0,b=0,E=0;const P=r.length;for(;m<P;){switch(d=r[m],d){case Wg:b=r[m+1],E=r[m+2];case Ug:if(h=r[m+1],l=r[m+2],a=n[v],f+a>=e||!t.total){if(Xg(y,h,l),m)return Xg(qg,w,x),Vg(qg,y,e-f,!0),y.rotation=Hg(qg,y),y;{const e=Kg.getDistancePoint(t,i,i,s);return y.rotation=e.rotation,y}}w=h,x=l,m+=3;break;case Ng:if(h=r[m+5],l=r[m+6],a=n[v],f+a>=e)return c=r[m+1],u=r[m+2],p=r[m+3],_=r[m+4],g=Mg.getT(e-f,a,w,x,c,u,p,_,h,l,i),li.getPointAndSet(g,w,x,c,u,p,_,h,l,y),y.rotation=Mg.getRotation(g,w,x,c,u,p,_,h,l),y;w=h,x=l,m+=7;break;case zg:if(h=b,l=E,a=n[v],f+a>=e)return Xg(qg,w,x),Xg(y,h,l),Vg(qg,y,e-f,!0),y.rotation=Hg(qg,y),y;w=h,x=l,m+=1;break;default:a=0}v++,f+=a}return y},getDistancePath(t,e,i){const{segments:s,data:n}=t,r=[];e=il.number(e,t.total);let o,a,h,l,d,c,u,p,_,g,f=0,y={},m=0,v=0,w=0,x=0,b=0,E=0;const P=n.length;for(;m<P;){switch(d=n[m],d){case Wg:b=n[m+1],E=n[m+2];case Ug:if(h=n[m+1],l=n[m+2],o=s[v],f+o>e||!t.total)return m||(w=h,x=l),Xg(qg,w,x),Xg(y,h,l),a=Yg(e-f),a&&(Vg(qg,y,a,!0),r.push(d,y.x,y.y)),r;w=h,x=l,m+=3,r.push(d,w,x);break;case Ng:if(c=n[m+1],u=n[m+2],p=n[m+3],_=n[m+4],h=n[m+5],l=n[m+6],o=s[v],f+o>e)return a=Yg(e-f),a&&(g=Mg.getT(a,o,w,x,c,u,p,_,h,l,i),Mg.cut(r,g,w,x,c,u,p,_,h,l)),r;w=h,x=l,m+=7,r.push(d,c,u,p,_,h,l);break;case zg:if(h=b,l=E,o=s[v],f+o>e)return Xg(qg,w,x),Xg(y,h,l),a=Yg(e-f),a&&(Vg(qg,y,a,!0),r.push(Ug,y.x,y.y)),r;w=h,x=l,m+=1,r.push(d);break;default:o=0}v++,f+=o}return r}};function Zg(t){return _r(t,t=>({set(e){this.__setAttr(t,e),this.__hasMotionPath=this.motionPath||!a(this.motion),this.__layout.matrixChanged||this.__layout.matrixChange()}}))}ce.add("motion-path"),cl.register("motion",function(t,e,i,s){return p(t)&&(t=il.number(t,s.getMotionTotal())),p(e)&&(e=il.number(e,s.getMotionTotal())),cl.number(t||0,e||0,i)}),cl.register("motionRotation",function(t,e,i){return cl.number(t,e,i)});const Qg=t.UI.prototype,{updateMatrix:$g,updateAllMatrix:Jg}=po,{updateBounds:tf}=So,{toVertical:ef}=lt,sf={};function nf(t){const{motion:e,leaferIsCreated:i}=t;if(!a(e)){if(i&&(t.leafer.created=!1),t.motionPath){const i=of(t);i.total&&(t.__.__pathForRender=Kg.getDistancePath(i,e,t.motionPrecision))}else{if(t.motionText)t.__updateMotionText();else{const i=t.getMotionPoint(e,t.motionAround);!1===t.motionRotation&&delete i.rotation,t.set(i)}t.__hasAutoLayout||(t.isBranch?(Jg(t),tf(t,t)):$g(t))}i&&(t.leafer.created=!0)}}function rf(t){const{parent:e}=t;if(!t.motionPath&&e){const{children:t}=e;for(let e=0;e<t.length;e++)if(t[e].motionPath)return t[e]}return t}function of(t){const e=t.__;if(e.__pathForMotion)return e.__pathForMotion;return e.__pathForMotion=Kg.getMotionPathData(t.getPath(!0,!0))}t.UI.addAttr("motionPath",void 0,Zg),t.UI.addAttr("motionPrecision",1,Zg),t.UI.addAttr("motion",void 0,Zg),t.UI.addAttr("motionAround",void 0,Zg),t.UI.addAttr("motionVertical","below",Zg),t.UI.addAttr("motionRotation",!0,Zg),Qg.getMotionPath=function(){return rf(this)},Qg.getMotionPathData=function(){return of(rf(this))},Qg.getMotionContentHeight=function(){return this.__layout.boxBounds.height},Qg.getMotionPoint=function(t,e,i,s=0,n=0,r){r||(r=rf(this));const o=of(r);if(!o.total)return{};const a=Kg.getDistancePoint(o,t,r.motionPrecision,s),{motionRotation:h}=this;let l,c;if(d(h)&&(a.rotation+=h),e&&"top-left"!==e&&(Pt.toPoint(e,this.__layout.boxBounds,sf),lt.set(sf,a.x-sf.x*this.scaleX,a.y-sf.y*this.scaleY),a.rotation&<.rotate(sf,a.rotation,a),lt.copy(a,sf)),p(i)?(l=i.type,c=i.offset):d(i)?c=i:l=i,"below"!==l||n){const{rotation:t}=a,e=this.getMotionContentHeight();switch(c&&(n+="above"===l?-c:c),l){case"above":ef(a,t,-e+n);break;case"center":ef(a,t,-e/2+n);break;default:ef(a,t,n)}}return Q.toOuterPoint(r.localTransform,a),a},Qg.getMotionTotal=function(){return this.getMotionPathData().total},Qg.__updateMotionPath=function(){const t=this.__;if(this.__layout.resized&&t.__pathForMotion&&(t.__pathForMotion=void 0),this.motionPath){let t;const{children:e}=this.parent;for(let i=0;i<e.length;i++)t=e[i],a(t.motion)||t.__layout.matrixChanged||(t!==this&&t.__extraUpdate(),nf(t))}else nf(this)};const{Yes:af,NoAndSkip:hf,YesAndSkip:lf}=t.Answer,df={},cf={},uf={};class pf{constructor(t,e){this.methods={id:(t,e)=>t.id===e?(this.target&&(this.idMap[e]=t),1):0,innerId:(t,e)=>t.innerId===e?(this.target&&(this.innerIdMap[e]=t),1):0,className:(t,e)=>t.className===e?1:0,tag:(t,e)=>t.__tag===e?1:0,tags:(t,e)=>e[t.__tag]?1:0},this.idMap={},this.innerIdMap={};const i=t&&t.app;i&&(i.idMap?this.idMap=i.idMap:i.idMap=this.idMap,i.innerIdMap?this.innerIdMap=i.innerIdMap:i.innerIdMap=this.innerIdMap),(this.target=t)&&this.__listenEvents()}getBy(t,e,i,s){switch(typeof t){case"number":const n=this.getByInnerId(t,e);return i?n:n?[n]:[];case"string":switch(t[0]){case"#":df.id=t.substring(1),t=df;break;case".":cf.className=t.substring(1),t=cf;break;default:uf.tag=t,t=uf}case"object":if(o(t.id)){if(t.tag){const{tag:s}=t,n=u(s);return this.getByMethod(n?this.methods.tags:this.methods.tag,e,i,n?g.toMap(s):s)}return this.getByMethod(this.methods.className,e,i,t.className)}{const s=this.getById(t.id,e);return i?s:s?[s]:[]}case"function":return this.getByMethod(t,e,i,s)}}getByInnerId(t,e){const i=this.innerIdMap[t];return i||(this.eachFind(this.toChildren(e),this.methods.innerId,null,t),this.findLeaf)}getById(t,e){const i=this.idMap[t];return i&&po.hasParent(i,e||this.target)?i:(this.eachFind(this.toChildren(e),this.methods.id,null,t),this.findLeaf)}getByClassName(t,e){return this.getByMethod(this.methods.className,e,!1,t)}getByTag(t,e){return this.getByMethod(this.methods.tag,e,!1,t)}getByMethod(t,e,i,s){const n=i?null:[];return this.eachFind(this.toChildren(e),t,n,s),n||this.findLeaf}eachFind(t,e,i,s){let n,r;for(let o=0,a=t.length;o<a;o++){if(n=t[o],r=e(n,s),"boolean"==typeof r&&(r=r?1:0),r===af||r===lf){if(!i)return void(this.findLeaf=n);i.push(n)}n.isBranch&&r<hf&&this.eachFind(n.children,e,i,s)}}toChildren(t){return this.findLeaf=null,[t||this.target]}__onRemoveChild(t){const{id:e,innerId:i}=t.child;this.idMap[e]&&delete this.idMap[e],this.innerIdMap[i]&&delete this.innerIdMap[i]}__checkIdChange(t){if("id"===t.attrName){const e=t.oldValue;this.idMap[e]&&delete this.idMap[e]}}__listenEvents(){this.__eventIds=[this.target.on_(Xo.REMOVE,this.__onRemoveChild,this),this.target.on_(jo.CHANGE,this.__checkIdChange,this)]}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}destroy(){const{__eventIds:t}=this;t&&t.length&&(this.__removeListenEvents(),this.innerIdMap={},this.idMap={}),this.findLeaf=null}}const _f=t.UI.prototype;function gf(t){return t.leafer?t.leafer.selector:ee.selector||(ee.selector=ue.selector())}return _f.find=function(t,e){return gf(this).getBy(t,this,!1,e)},_f.findOne=function(t,e){return gf(this).getBy(t,this,!0,e)},ce.add("find"),ue.finder=function(t,e){return new pf(t,e)},po.cacheId=function(t){const{leafer:e,id:i}=t;i&&(e.app.idMap[i]=t),e.cacheInnerId&&(e.app.innerIdMap[t.innerId]=t)},t.AlignHelper=Bt,t.AnimateEasing=ig,t.AnimateEvent=ng,t.AroundHelper=Pt,t.AutoBounds=Zt,t.BezierHelper=li,t.Bounds=qt,t.BoundsEvent=qo,t.BoundsHelper=Ht,t.BoxData=xl,t.BranchHelper=So,t.BranchRender=Xa,t.CanvasData=Ol,t.CanvasManager=ve,t.ChildEvent=Xo,t.ColorConvert=el,t.Creator=ue,t.Cursor=pc,t.DataHelper=g,t.Debug=ne,t.DragBoundsHelper=Hd,t.Dragger=ic,t.Effect=al,t.EllipseData=kl,t.EllipseHelper=mi,t.Event=Yo,t.EventCreator=ye,t.Eventer=ca,t.Export=ll,t.FileHelper=$n,t.Filter=hl,t.Finder=pf,t.FourNumberHelper=S,t.FrameData=El,t.GroupData=wl,t.HighBezierHelper=Mg,t.HighCurveHelper=Kg,t.HitCanvasManager=_c,t.ImageData=Al,t.ImageEvent=Go,t.ImageManager=or,t.IncrementId=m,t.Interaction=Lc,t.InteractionBase=uc,t.InteractionHelper=Zd,t.Keyboard=Rd,t.LayoutEvent=ia,t.Layouter=Xh,t.LayouterHelper=Mh,t.LeafBounds=Ua,t.LeafBoundsHelper=xo,t.LeafData=y,t.LeafDataProxy=Pa,t.LeafEventer=ba,t.LeafHelper=po,t.LeafLayout=zo,t.LeafLevelList=Sh,t.LeafList=Ph,t.LeafMatrix=La,t.LeafRender=Na,t.LeaferCanvas=Bh,t.LeaferCanvasBase=Ae,t.LeaferData=bl,t.LeaferEvent=na,t.LeaferFilm=class extends dr{get tag(){return"Film"}},t.LeaferImage=dr,t.LeaferVideo=class extends dr{get tag(){return"Video"}},t.LineData=Pl,t.MathHelper=M,t.Matrix=yt,t.MatrixHelper=Q,t.MyDragEvent=qd,t.MyImage=Pd,t.MyPointerEvent=Vd,t.MyTouchEvent=Kd,t.NeedConvertToCanvasCommandMap=We,t.OneRadian=W,t.PI2=U,t.PI_2=N,t.Paint=nl,t.PaintGradient=ol,t.PaintImage=rl,t.PathArrow=sl,t.PathBounds=Nn,t.PathCommandDataHelper=Bs,t.PathCommandMap=Me,t.PathCommandNodeHelper=vi,t.PathConvert=ss,t.PathCorner=Gn,t.PathCreator=Vs,t.PathData=Cl,t.PathDrawer=hn,t.PathHelper=Oe,t.PathNumberCommandLengthMap=Ye,t.PathNumberCommandMap=ze,t.PenData=Rl,t.Picker=Kh,t.Platform=ee,t.Plugin=ce,t.Point=gt,t.PointHelper=lt,t.PointerButton=Ld,t.PolygonData=Bl,t.PropertyEvent=jo,t.RectData=Sl,t.RectHelper=Xe,t.RectRender=zl,t.RenderEvent=sa,t.Renderer=jh,t.ResizeEvent=ta,t.Resource=nr,t.RobotData=p_,t.Run=he,t.Selector=Zh,t.StarData=Tl,t.State=dl,t.StringNumberMap=$t,t.TaskItem=er,t.TaskProcessor=ir,t.TextConvert=tl,t.TextData=Dl,t.Transition=cl,t.TwoPointBoundsHelper=vt,t.UIBounds=Fl,t.UICreator=_e,t.UIData=ml,t.UIEvent=Dd,t.UIRender=Ul,t.UnitConvert=il,t.UnitConvertHelper=Qt,t.WaitHelper=Lo,t.WatchEvent=ea,t.Watcher=Rh,t.affectRenderBoundsType=Lr,t.affectStrokeBoundsType=Tr,t.attr=gr,t.autoLayoutType=wr,t.boundsType=Er,t.canvasPatch=Qn,t.canvasSizeAttrs=De,t.createAttr=function(t){return(e,i)=>{cr(e,i,pr(i,t))}},t.createDescriptor=pr,t.cursorType=Xr,t.dataProcessor=Hr,t.dataType=yr,t.decorateLeafAttr=_r,t.defineDataProcessor=jr,t.defineKey=cr,t.defineLeafAttr=fr,t.dimType=Or,t.doBoundsType=Sr,t.doStrokeType=Cr,t.doSurfaceType=Ar,t.effectType=Qh,t.emptyData=r,t.eraserType=zr,t.extraPropertyEventMap=Vo,t.getBoundsData=Y,t.getDescriptor=ur,t.getMatrixData=X,t.getPointData=z,t.hitType=Yr,t.isArray=u,t.isData=function(t){return p(t)&&!u(t)},t.isEmptyData=_,t.isFinite=l,t.isNull=a,t.isNumber=d,t.isObject=p,t.isString=h,t.isUndefined=o,t.layoutProcessor=function(t){return(e,i)=>{cr(e,"__LayoutProcessor",{get:()=>t})}},t.leaferTransformAttrMap=la,t.maskType=Nr,t.motionPathType=Zg,t.naturalBoundsType=Pr,t.opacityType=Ir,t.path=qn,t.pathInputType=kr,t.pathType=Br,t.pen=Kn,t.positionType=mr,t.registerPointsCurve=Ls,t.registerUI=Jr,t.registerUIEvent=to,t.resizeType=$h,t.rewrite=Kr,t.rewriteAble=Zr,t.rotationType=br,t.scaleType=xr,t.scrollType=vr,t.sortType=Ur,t.stateStyleType=g_,t.stateType=__,t.strokeType=Rr,t.surfaceType=Dr,t.tempBounds=Kt,t.tempMatrix=mt,t.tempPoint=ft,t.tryToNumber=function(t){return"string"==typeof t&&c.test(t)?+t:t},t.useCanvas=Th,t.useModule=$r,t.version="2.2.7",t.visibleType=Mr,t.zoomLayerType=Jh,t}({});function Leafer(t){return new LeaferUI.Leafer(t)}Object.setPrototypeOf(Leafer,LeaferUI),Leafer.prototype=LeaferUI.Leafer.prototype;
|
|
2
2
|
//# sourceMappingURL=web.min.js.map
|