@leafer-editor/worker 1.11.1 → 1.11.2

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.
@@ -1,2 +1,2 @@
1
- var LeaferUI=function(t){"use strict";var e;t.Answer=void 0,(e=t.Answer||(t.Answer={}))[e.No=0]="No",e[e.Yes=1]="Yes",e[e.NoAndSkip=2]="NoAndSkip",e[e.YesAndSkip=3]="YesAndSkip";const i={};function s(t){return void 0===t}function n(t){return null==t}function r(t){return"string"==typeof t}const{isFinite:o}=Number;function a(t){return"number"==typeof t}const h=/^-?\d+(?:\.\d+)?$/;const{isArray:l}=Array;function d(t){return t&&"object"==typeof t}function c(t){return d(t)&&!l(t)}function u(t){return"{}"===JSON.stringify(t)}const p={default:(t,e)=>(g(e,t),g(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 g(t[n],e[n],i&&i[n]);i&&n in i?(null===(o=i[n])||void 0===o?void 0:o.constructor)===Object&&g(t[n]={},e[n],i[n]):t[n]=e[n]})},copyAttrs:(t,e,i)=>(i.forEach(i=>{s(e[i])||(t[i]=e[i])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let i=0,s=t.length;i<s;i++)e[t[i]]=!0;return e},stintSet(t,e,i){i||(i=void 0),t[e]!==i&&(t[e]=i)}},{assign:g}=p;class _{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __usePathBox(){return this.__pathInputed}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(!s(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let i;for(let n in this)"_"!==n[0]&&(i=e?e[n]:void 0,t[n]=s(i)?this[n]:i);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(!s(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!s(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(l(t))for(let e of t)i[e]=this.__getInput(e);else for(let e in t)i[e]=this.__getInput(e);else{let t,e,{__input:n}=this;i.tag=this.__leaf.tag;for(let r in this)if("_"!==r[0]&&(t=this["_"+r],!s(t))){if("path"===r&&!this.__pathInputed)continue;e=n?n[r]:void 0,i[r]=s(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}}const{floor:f,max:m}=Math,y={toURL(t,e){let i=encodeURIComponent(t);return"text"===e?i="data:text/plain;charset=utf-8,"+i:"svg"===e&&(i="data:image/svg+xml,"+i),i},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",isLarge:(t,e,i,s)=>t.width*t.height*(e?e*i:1)>(s||v.maxCacheSize),isSuperLarge:(t,e,i)=>v.isLarge(t,e,i,v.maxPatternSize),getRealURL(t){const{prefix:e,suffix:i}=y.image;return!i||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+i),e&&"/"===t[0]&&(t=e+t),t},resize(t,e,i,s,n,r,o,a,h){const l=y.origin.createCanvas(m(f(e+(s||0)),1),m(f(i+(n||0)),1)),d=l.getContext("2d");if(a&&(d.globalAlpha=a),d.imageSmoothingEnabled=!1!==o,r){const s=e/r.width,n=i/r.height;d.setTransform(s,0,0,n,-r.x*s,-r.y*n),d.drawImage(t,0,0,t.width,t.height)}else d.drawImage(t,0,0,e,i);return l},setPatternTransform(t,e,i){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}i&&p.stintSet(i,"transform",e)}}},{image:v}=y,x={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=w;return e[t]?e[t]++:(e[t]=1,0)}},w=x;let E,b,k;const{max:S}=Math,B=[0,0,0,0],T={zero:[...B],tempFour:B,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)=>P(B,t,e,i,s),toTempAB(t,e,i){k=i?a(t)?e:t:[],a(t)?(E=R(t),b=e):a(e)?(E=t,b=R(e)):(E=t,b=e),4!==E.length&&(E=L(E)),4!==b.length&&(b=L(b))},get(t,e){let i;if(!a(t))switch(t.length){case 4:i=s(e)?t:[...t];break;case 2:i=[t[0],t[1],t[0],t[1]];break;case 3:i=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(i||(i=[t,t,t,t]),!s(e))for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},max:(t,e,i)=>a(t)&&a(e)?S(t,e):(C(t,e,i),P(k,S(E[0],b[0]),S(E[1],b[1]),S(E[2],b[2]),S(E[3],b[3]))),add:(t,e,i)=>a(t)&&a(e)?t+e:(C(t,e,i),P(k,E[0]+b[0],E[1]+b[1],E[2]+b[2],E[3]+b[3])),swapAndScale(t,e,i,s){if(a(t))return e===i?t*e:[t*i,t*e];const n=s?t:[],[r,o,h,l]=4===t.length?t:L(t);return P(n,h*i,l*e,r*i,o*e)}},{set:P,get:L,setTemp:R,toTempAB:C}=T,{round:O,pow:M,max:D,floor:I,PI:A}=Math,W={within:(t,e,i)=>(d(e)&&(i=e.max,e=e.min),!s(e)&&t<e&&(t=e),!s(i)&&t>i&&(t=i),t),fourNumber:T.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),W.float(t)),getGapRotation(t,e,i=0){let s=t+i;if(e>1){const t=Math.abs(s%e);(t<1||t>e-1)&&(s=Math.round(s/e)*e)}return s-i},float(t,e){const i=s(e)?1e12:M(10,e);return-0===(t=O(t*i)/i)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,i,s){if(s||(s={}),e){const t=(a(e)?e:e.width||0)/i.width,n=(a(e)?e:e.height||0)/i.height;s.scaleX=t||n||1,s.scaleY=n||t||1}else t&&W.assignScale(s,t);return s},assignScale(t,e){a(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>D(I(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 z=A/180,U=2*A,H=A/2;function N(){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:V,cos:j,acos:G,sqrt:K}=Math,{float:Z}=W,q={};function J(){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 $={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:J(),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:J,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){Q.toInnerPoint(t,e,q),Q.scaleOfInner(t,q,i,s)},scaleOfInner(t,e,i,s=i){Q.translateInner(t,e.x,e.y),Q.scale(t,i,s),Q.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:n,d:r}=t,o=j(e*=z),a=V(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){Q.toInnerPoint(t,e,q),Q.rotateOfInner(t,q,i)},rotateOfInner(t,e,i){Q.translateInner(t,e.x,e.y),Q.rotate(t,i),Q.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:n,c:r,d:o}=t;i&&(i*=z,t.a=s+r*i,t.b=n+o*i),e&&(e*=z,t.c=r+s*e,t.d=o+n*e)},skewOfOuter(t,e,i,s){Q.toInnerPoint(t,e,q),Q.skewOfInner(t,q,i,s)},skewOfInner(t,e,i,s=0){Q.translateInner(t,e.x,e.y),Q.skew(t,i,s),Q.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,n,r){const{e:o,f:a}=t;if(i||(i=t),s(n)&&(n=1!==t.a||t.b||t.c||1!==t.d),n){const{a:s,b:n,c:o,d:a}=t;i.a=s*e.a+n*e.c,i.b=s*e.b+n*e.d,i.c=o*e.a+a*e.c,i.d=o*e.b+a*e.d,r&&(i.scaleX=e.scaleX*r.scaleX,i.scaleY=e.scaleY*r.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,r&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=o*e.a+a*e.c+e.e,i.f=o*e.b+a*e.d+e.f},divide(t,e){Q.multiply(t,Q.tempInvert(e))},divideParent(t,e){Q.multiplyParent(t,Q.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=Q;return Q.copy(e,t),Q.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,n,r){const{x:o,y:a,scaleX:h,scaleY:l}=e;if(s(r)&&(r=e.rotation||e.skewX||e.skewY),r){const{rotation:i,skewX:s,skewY:n}=e,r=i*z,o=j(r),a=V(r);if(s||n){const e=s*z,i=n*z;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=o,t.f=a,(i=i||n)&&Q.translateInner(t,-i.x,-i.y,!n)},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=K(n*n+r*r),c=t/d;const e=n/d;u=r>0?G(e):-G(e)}else{c=K(o*o+a*a),d=t/c;const e=o/c;u=H-(a>0?G(-e):-G(e))}const e=Z(j(u)),i=V(u);d=Z(d),c=Z(c),p=e?Z((o/c+i)/e/z,9):0,g=e?Z((r/d-i)/e/z,9):0,u=Z(u/z)}else d=n,c=a,u=p=g=0;return(e=i||e)&&(_+=e.x*n+e.y*o,f+=e.x*r+e.y*a,i||(_-=e.x,f-=e.y)),{x:_,y:f,scaleX:d,scaleY:c,rotation:u,skewX:p,skewY:g}},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=K(s*s+n*n)):(e=s,i=o)}return s.scaleX=e,s.scaleY=i,s},reset(t){Q.set(t)}},Q=$,{toInnerPoint:tt,toOuterPoint:et}=$,{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=s(i)?e:i},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,i){t.x=e,t.y=i},round(t,e){t.x=e?ht(t.x-.5)+.5:ht(t.x),t.y=e?ht(t.y-.5)+.5:ht(t.y)},move(t,e,i){d(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=i)},scale(t,e,i=e){t.x&&(t.x*=e),t.y&&(t.y*=i)},scaleOf(t,e,i,s=i){t.x+=(t.x-e.x)*(i-1),t.y+=(t.y-e.y)*(s-1)},rotate(t,e,i){i||(i=dt.defaultPoint);const s=st(e*=z),n=it(e),r=t.x-i.x,o=t.y-i.y;t.x=i.x+r*s-o*n,t.y=i.y+r*n+o*s},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},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)},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)=>pt(t,e)/z,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)/z),getRadianFrom(t,e,i,n,r,o,a,h){s(a)&&(a=i,h=n);const l=t-i,d=e-n,c=r-a,u=o-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>ot(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s,n){const r=pt(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 d(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},isSame:(t,e)=>t.x===e.x&&t.y===e.y,reset(t){dt.reset(t)}},dt=lt,{getDistanceFrom:ct,copy:ut,getAtan2:pt}=dt;class gt{constructor(t,e){this.set(t,e)}set(t,e){return d(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){return lt.rotate(this,t,e),this}rotateOf(t,e){return lt.rotate(this,e,t),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){return lt.getAngle(this,t)}getAtan2(t){return lt.getAtan2(this,t)}isSame(t){return lt.isSame(this,t)}reset(){return lt.reset(this),this}}const _t=new gt;class ft{constructor(t,e,i,s,n,r){this.set(t,e,i,s,n,r)}set(t,e,i,s,n,r){return d(t)?$.copy(this,t):$.set(this,t,e,i,s,n,r),this}setWith(t){return $.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 ft(this)}translate(t,e){return $.translate(this,t,e),this}translateInner(t,e){return $.translateInner(this,t,e),this}scale(t,e){return $.scale(this,t,e),this}scaleWith(t,e){return $.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return $.pixelScale(this,t),this}scaleOfOuter(t,e,i){return $.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return $.scaleOfInner(this,t,e,i),this}rotate(t){return $.rotate(this,t),this}rotateOfOuter(t,e){return $.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return $.rotateOfInner(this,t,e),this}skew(t,e){return $.skew(this,t,e),this}skewOfOuter(t,e,i){return $.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return $.skewOfInner(this,t,e,i),this}multiply(t){return $.multiply(this,t),this}multiplyParent(t){return $.multiplyParent(this,t),this}divide(t){return $.divide(this,t),this}divideParent(t){return $.divideParent(this,t),this}invert(){return $.invert(this),this}invertWith(){return $.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){$.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){$.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return $.setLayout(this,t,e,i),this}getLayout(t,e,i){return $.getLayout(this,t,e,i)}withScale(t,e){return $.withScale(this,t,e)}reset(){$.reset(this)}}const mt=new ft,yt={tempPointBounds:{},setPoint(t,e,i){t.minX=t.maxX=e,t.minY=t.maxY=i},addPoint(t,e,i){t.minX=e<t.minX?e:t.minX,t.minY=i<t.minY?i:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=i>t.maxY?i:t.maxY},addBounds(t,e,i,s,n){vt(t,e,i),vt(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:vt}=yt;var xt,wt;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,(wt=t.Direction9||(t.Direction9={}))[wt.topLeft=0]="topLeft",wt[wt.top=1]="top",wt[wt.topRight=2]="topRight",wt[wt.right=3]="right",wt[wt.bottomRight=4]="bottomRight",wt[wt.bottom=5]="bottom",wt[wt.bottomLeft=6]="bottomLeft",wt[wt.left=7]="left",wt[wt.center=8]="center",wt[wt["top-left"]=0]="top-left",wt[wt["top-right"]=2]="top-right",wt[wt["bottom-right"]=4]="bottom-right",wt[wt["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 bt={directionData:Et,tempPoint:{},get:kt,toPoint(t,e,i,s,n,r){const o=kt(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)=>(i||(i={}),bt.toPoint(t,e,i,!0),i)};function kt(e){return r(e)?Et[t.Direction9[e]]:e}const{toPoint:St}=bt,Bt={toPoint(t,e,i,s,n,r){St(t,i,s,n,e,r)}},{tempPointBounds:Tt,setPoint:Pt,addPoint:Lt,toBounds:Rt}=yt,{toOuterPoint:Ct}=$,{float:Ot,fourNumber:Mt}=W,{floor:Dt,ceil:It}=Math;let At,Wt,Ft,zt;const Ut={},Ht={},Nt={},Yt={tempBounds:Nt,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(l(i)){const e=Mt(i);s?Xt.set(t,r+e[3],o+e[0],a-e[1]-e[3],h-e[2]-e[0]):Xt.set(t,r-e[3],o-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),Xt.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),Xt.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?jt(e,t):e=t,i||(i=t),e.offsetX=Xt.maxX(i),e.offsetY=Xt.maxY(i),Xt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||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)=>(Xt.copy(Nt,t),Xt.toOuterOf(Nt,e),Nt),getOuterOf:(t,e)=>(t=Object.assign({},t),Xt.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d: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 Ut.x=t.x,Ut.y=t.y,Ct(e,Ut,Ht),Pt(Tt,Ht.x,Ht.y),Ut.x=t.x+t.width,Ct(e,Ut,Ht),Lt(Tt,Ht.x,Ht.y),Ut.y=t.y+t.height,Ct(e,Ut,Ht),Lt(Tt,Ht.x,Ht.y),Ut.x=t.x,Ct(e,Ut,Ht),Lt(Tt,Ht.x,Ht.y),Rt(Tt,i)},toInnerOf(t,e,i){i||(i=t),Xt.move(i,-e.e,-e.f),Xt.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,Xt.getFitScale(t,e));return new ft(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,o){o||(o=e),r(s)&&(s=Xt.getFitScale(t,e,"cover"===s)),Nt.width=n?e.width*=s:e.width*s,Nt.height=n?e.height*=s:e.height*s,Bt.toPoint(i,Nt,t,o,!0,!0)},getSpread(t,e,i){const s={};return Xt.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){Xt.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){Xt.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=Dt(t.x),t.y=Dt(t.y),t.width=e>t.x?It(t.width+e-t.x):It(t.width),t.height=i>t.y?It(t.height+i-t.y):It(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=Ot(t.x,e),t.y=Ot(t.y,e),t.width=Ot(t.width,e),t.height=Ot(t.height,e)},add(t,e,i){At=t.x+t.width,Wt=t.y+t.height,Ft=e.x,zt=e.y,i||(Ft+=e.width,zt+=e.height),At=At>Ft?At:Ft,Wt=Wt>zt?Wt:zt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=At-t.x,t.height=Wt-t.y},addList(t,e){Xt.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){Xt.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){Xt.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let 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||jt(t,n)):Vt(t,n));r&&Xt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Pt(Tt,t.x,t.y):Lt(Tt,t.x,t.y)),Rt(Tt,t)},setPoint(t,e){Xt.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}]},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=Xt.tempToOuterOf(e,i)),!(t.y+t.height<e.y||e.y+e.height<t.y||t.x+t.width<e.x||e.x+e.width<t.x)),includes:(t,e,i)=>(i&&(e=Xt.tempToOuterOf(e,i)),t.x<=e.x&&t.y<=e.y&&t.x+t.width>=e.x+e.width&&t.y+t.height>=e.y+e.height),getIntersectData(t,e,i){if(i&&(e=Xt.tempToOuterOf(e,i)),!Xt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:n,width:r,height:o}=e;return At=s+r,Wt=n+o,Ft=t.x+t.width,zt=t.y+t.height,s=s>t.x?s:t.x,n=n>t.y?n:t.y,At=At<Ft?At:Ft,Wt=Wt<zt?Wt:zt,r=At-s,o=Wt-n,{x:s,y:n,width:r,height:o}},intersect(t,e,i){Xt.copy(t,Xt.getIntersectData(t,e,i))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,reset(t){Xt.set(t)}},Xt=Yt,{add:Vt,copy:jt}=Xt;class Gt{get minX(){return Yt.minX(this)}get minY(){return Yt.minY(this)}get maxX(){return Yt.maxX(this)}get maxY(){return Yt.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return d(t)?Yt.copy(this,t):Yt.set(this,t,e,i,s),this}get(){const{x:t,y:e,width:i,height:s}=this;return{x:t,y:e,width:i,height:s}}clone(){return new Gt(this)}move(t,e){return Yt.move(this,t,e),this}scale(t,e,i){return Yt.scale(this,t,e,i),this}scaleOf(t,e,i){return Yt.scaleOf(this,t,e,i),this}toOuterOf(t,e){return Yt.toOuterOf(this,t,e),this}toInnerOf(t,e){return Yt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Yt.getFitMatrix(this,t,e)}put(t,e,i){Yt.put(this,t,e,i)}spread(t,e){return Yt.spread(this,t,e),this}shrink(t,e){return Yt.shrink(this,t,e),this}ceil(){return Yt.ceil(this),this}unsign(){return Yt.unsign(this),this}float(t){return Yt.float(this,t),this}add(t){return Yt.add(this,t),this}addList(t){return Yt.setList(this,t,!0),this}setList(t){return Yt.setList(this,t),this}addListWithFn(t,e){return Yt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Yt.setListWithFn(this,t,e),this}setPoint(t){return Yt.setPoint(this,t),this}setPoints(t){return Yt.setPoints(this,t),this}addPoint(t){return Yt.addPoint(this,t),this}getPoints(){return Yt.getPoints(this)}hitPoint(t,e){return Yt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Yt.hitRadiusPoint(this,t,e)}hit(t,e){return Yt.hit(this,t,e)}includes(t,e){return Yt.includes(this,t,e)}intersect(t,e){return Yt.intersect(this,t,e),this}getIntersect(t,e){return new Gt(Yt.getIntersectData(this,t,e))}isSame(t){return Yt.isSame(this,t)}isEmpty(){return Yt.isEmpty(this)}reset(){Yt.reset(this)}}const Kt=new Gt;class Zt{constructor(t,e,i,s,n,r){d(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 Gt(n,e,r||t.width-n-i,o||t.height-e-s)}}const qt={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1},{randColor:Jt}=W;class $t{constructor(t){this.repeatMap={},this.name=t}static get(t){return new $t(t)}static set filter(t){this.filterList=Qt(t)}static set exclude(t){this.excludeList=Qt(t)}static drawRepaint(t,e){const i=Jt();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===$t.showBounds,n=t.__nowWorld,r=Jt();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(te.enable){if(te.filterList.length&&te.filterList.every(t=>t!==this.name))return;if(te.excludeList.length&&te.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){te.enable&&this.warn(...t)}warn(...t){te.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 Qt(t){return t?r(t)&&(t=[t]):t=[],t}$t.filterList=[],$t.excludeList=[],$t.showWarn=!0;const te=$t,ee=$t.get("RunTime"),ie={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=x.create(x.RUNTIME);return se.currentId=se.idMap[i]=e?performance.now():Date.now(),se.currentName=se.nameMap[i]=t,se.nameToIdMap[t]=i,i},end(t,e){const i=se.idMap[t],s=se.nameMap[t],n=e?(performance.now()-i)/1e3:Date.now()-i;se.idMap[t]=se.nameMap[t]=se.nameToIdMap[s]=void 0,ee.log(s,n,"ms")},endOfName(t,e){const i=se.nameToIdMap[t];s(i)||se.end(i,e)}},se=ie,ne=[],re={list:{},add(t,...e){this.list[t]=!0,ne.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(()=>ne.forEach(t=>re.has(t,!0)));const oe={editor:t=>re.need("editor")},ae=$t.get("UICreator"),he={list:{},register(t){const{__tag:e}=t.prototype;le[e]&&ae.repeat(e),le[e]=t},get(t,e,i,n,r,o){le[t]||ae.error("not register "+t);const a=new le[t](e);return s(i)||(a.x=i,n&&(a.y=n),r&&(a.width=r),o&&(a.height=o)),a}},{list:le}=he,de=$t.get("EventCreator"),ce={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],r(e)&&(ue[e]&&de.repeat(e),ue[e]=t)})},changeName(t,e){const i=ue[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,ue[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new ue[t](...e)},{nameList:ue}=ce;class pe{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=oe.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 ge(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 _e(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){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(o,a)}h((s=s.apply(t,e||[])).next())})}function fe(t){return(e,i)=>{t||(t=i);const s={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===i&&(s.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,i,s)}}"function"==typeof SuppressedError&&SuppressedError;const me=[];function ye(){return(t,e)=>{me.push(e)}}const ve=[];class xe{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||ve)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;me.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){d(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}}ge([fe("imageSmoothingEnabled")],xe.prototype,"smooth",void 0),ge([fe("imageSmoothingQuality")],xe.prototype,"smoothLevel",void 0),ge([fe("globalAlpha")],xe.prototype,"opacity",void 0),ge([fe()],xe.prototype,"fillStyle",void 0),ge([fe()],xe.prototype,"strokeStyle",void 0),ge([fe("lineWidth")],xe.prototype,"strokeWidth",void 0),ge([fe("lineCap")],xe.prototype,"strokeCap",void 0),ge([fe("lineJoin")],xe.prototype,"strokeJoin",void 0),ge([fe("lineDashOffset")],xe.prototype,"dashOffset",void 0),ge([fe()],xe.prototype,"miterLimit",void 0),ge([fe()],xe.prototype,"shadowBlur",void 0),ge([fe()],xe.prototype,"shadowColor",void 0),ge([fe()],xe.prototype,"shadowOffsetX",void 0),ge([fe()],xe.prototype,"shadowOffsetY",void 0),ge([fe()],xe.prototype,"filter",void 0),ge([fe()],xe.prototype,"font",void 0),ge([fe()],xe.prototype,"fontKerning",void 0),ge([fe()],xe.prototype,"fontStretch",void 0),ge([fe()],xe.prototype,"fontVariantCaps",void 0),ge([fe()],xe.prototype,"textAlign",void 0),ge([fe()],xe.prototype,"textBaseline",void 0),ge([fe()],xe.prototype,"textRendering",void 0),ge([fe()],xe.prototype,"wordSpacing",void 0),ge([fe()],xe.prototype,"letterSpacing",void 0),ge([fe()],xe.prototype,"direction",void 0),ge([ye()],xe.prototype,"setTransform",null),ge([ye()],xe.prototype,"resetTransform",null),ge([ye()],xe.prototype,"getTransform",null),ge([ye()],xe.prototype,"save",null),ge([ye()],xe.prototype,"restore",null),ge([ye()],xe.prototype,"translate",null),ge([ye()],xe.prototype,"scale",null),ge([ye()],xe.prototype,"rotate",null),ge([ye()],xe.prototype,"fill",null),ge([ye()],xe.prototype,"stroke",null),ge([ye()],xe.prototype,"clip",null),ge([ye()],xe.prototype,"fillRect",null),ge([ye()],xe.prototype,"strokeRect",null),ge([ye()],xe.prototype,"clearRect",null),ge([ye()],xe.prototype,"beginPath",null),ge([ye()],xe.prototype,"moveTo",null),ge([ye()],xe.prototype,"lineTo",null),ge([ye()],xe.prototype,"bezierCurveTo",null),ge([ye()],xe.prototype,"quadraticCurveTo",null),ge([ye()],xe.prototype,"closePath",null),ge([ye()],xe.prototype,"arc",null),ge([ye()],xe.prototype,"arcTo",null),ge([ye()],xe.prototype,"ellipse",null),ge([ye()],xe.prototype,"rect",null),ge([ye()],xe.prototype,"roundRect",null),ge([ye()],xe.prototype,"createConicGradient",null),ge([ye()],xe.prototype,"createLinearGradient",null),ge([ye()],xe.prototype,"createPattern",null),ge([ye()],xe.prototype,"createRadialGradient",null),ge([ye()],xe.prototype,"fillText",null),ge([ye()],xe.prototype,"measureText",null),ge([ye()],xe.prototype,"strokeText",null);const{copy:we,multiplyParent:Ee,pixelScale:be}=$,{round:ke}=Math,Se=new Gt,Be=new Gt,Te={width:1,height:1,pixelRatio:1},Pe=["width","height","pixelRatio"];class Le extends xe{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=Te),this.manager=e,this.innerId=x.create(x.CNAVAS);const{width:i,height:s,pixelRatio:n}=t;this.autoLayout=!i||!s,this.size.pixelRatio=n||y.devicePixelRatio,this.config=t,this.init()}init(){}__createContext(){const{view:t}=this,{contextSettings:e}=this.config;this.context=e?t.getContext("2d",e):t.getContext("2d"),this.__bindContext()}export(t,e){}toBlob(t,e){}toDataURL(t,e){}saveAs(t,e){}resize(t,e=!0){if(this.isSameSize(t))return;let i;this.context&&!this.unreal&&e&&this.width&&(i=this.getSameCanvas(),i.copyWorld(this));const s=this.size;p.copyAttrs(s,t,Pe),Pe.forEach(t=>s[t]||(s[t]=1)),this.bounds=new Gt(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!this.unreal&&i&&(this.clearWorld(i.bounds),this.copyWorld(i),i.recycle()))}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:i,pixelSnap:s}=this,n=this.worldTransform;e&&Ee(t,e,n),be(t,i,n),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(n.e=ke(n.e-.5)+.5,n.f=ke(n.f-.5)+.5):(n.e=ke(n.e),n.f=ke(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:n,dashPattern:r,dashOffset:o,miterLimit:a}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(n=e.strokeJoin),s(e.dashPattern)||(r=e.dashPattern),s(e.dashOffset)||(o=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=i,this.strokeJoin=n,this.dashPattern=r,this.dashOffset=o,this.miterLimit=a}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return!0}hitStroke(t,e){return!0}hitPixel(t,e,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=!0){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,n),i?(this.setTempPixelBounds2(i,n),i=Be):i=Se,this.drawImage(t.view,Se.x,Se.y,Se.width,Se.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=!0){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Yt.tempToOuterOf(i,e),s,n),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,n),this.drawImage(t.view,Se.x,Se.y,Se.width,Se.height,i.x,i.y,i.width,i.height),s&&(this.blendMode="source-over"))}copyWorldByReset(t,e,i,s,n,r=!0){this.resetTransform(),this.copyWorld(t,e,i,s,r),n||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempPixelBounds(t,!0,!0);const{context:s}=this,n=s.getImageData(Se.x,Se.y,Se.width,Se.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,Se.x,Se.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(Se.x,Se.y,Se.width,Se.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(Se.x,Se.y,Se.width,Se.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(Se.x,Se.y,Se.width,Se.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(Se.x,Se.y,Se.width,Se.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(Se,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(Be,t,e,i)}copyToPixelBounds(t,e,i,s){t.set(e),s&&t.intersect(this.bounds),t.scale(this.pixelRatio),i&&t.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:i,pixelSnap:s}=this,n=this.manager?this.manager.get(i):oe.canvas(Object.assign({},i));return n.save(),t&&(we(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 Re={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Ce={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Oe=Object.assign({M:1,m:10,L:2,l:20,H:3,h:30,V:4,v:40,C:5,c:50,S:6,s:60,Q:7,q:70,T:8,t:80,A:9,a:90,Z:11,z:11,R:12},Ce),Me={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},De={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},Ie=Object.assign(Object.assign({},De),Ce),Ae=Oe,We={};for(let t in Ae)We[Ae[t]]=t;const Fe={};for(let t in Ae)Fe[Ae[t]]=Me[t];const ze={drawRoundRect(t,e,i,s,n,r){const o=W.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:Ue,cos:He,hypot:Ne,atan2:Ye,ceil:Xe,abs:Ve,PI:je,sqrt:Ge,pow:Ke}=Math,{setPoint:Ze,addPoint:qe}=yt,{set:Je,toNumberPoints:$e}=lt,{M:Qe,L:ti,C:ei,Q:ii,Z:si}=Oe,ni={},ri={points(t,e,i,s){let n=$e(e);if(t.push(Qe,n[0],n[1]),i&&n.length>5){let e,r,o,a,h,l,d,c,u,p,g,_,f,m=n.length;const y=!0===i?.5:i;s&&(n=[n[m-2],n[m-1],...n,n[0],n[1],n[2],n[3]],m=n.length);for(let i=2;i<m-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],g=Ge(Ke(o-e,2)+Ke(a-r,2)),_=Ge(Ke(h-o,2)+Ke(l-a,2)),(g||_)&&(f=g+_,g=y*g/f,_=y*_/f,h-=e,l-=r,d=o-g*h,c=a-g*l,2===i?s||t.push(ii,d,c,o,a):t.push(ei,u,p,d,c,o,a),u=o+_*h,p=a+_*l);s||t.push(ii,u,p,n[m-2],n[m-1])}else for(let e=2,i=n.length;e<i;e+=2)t.push(ti,n[e],n[e+1]);s&&t.push(si)},rect(t,e,i,s,n){Re.creator.path=t,Re.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){Re.creator.path=[],ze.drawRoundRect(Re.creator,e,i,s,n,r),t.push(...Re.convertToCanvasData(Re.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,g=o-n;let _=Ye(u,c),f=Ye(g,p);const m=Ne(c,u),y=Ne(p,g);let v=f-_;if(v<0&&(v+=U),m<1e-12||y<1e-12||v<1e-12||Ve(v-je)<1e-12)return t&&t.push(ti,s,n),h&&(Ze(h,e,i),qe(h,s,n)),d&&Je(d,e,i),void(l&&Je(l,s,n));const x=c*g-p*u<0,w=x?-1:1,E=a/He(v/2),b=s+E*He(_+v/2+H*w),k=n+E*Ue(_+v/2+H*w);return _-=H*w,f-=H*w,hi(t,b,k,a,a,0,_/z,f/z,x,h,l,d)},arc:(t,e,i,s,n,r,o,a,h,l)=>hi(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*z,p=Ue(u),g=He(u);let _=o*z,f=a*z;_>je&&(_-=U),f<0&&(f+=U);let m=f-_;m<0?m+=U:m>U&&(m-=U),h&&(m-=U);const y=Xe(Ve(m/H)),v=m/y,x=Ue(v/4),w=8/3*x*x/Ue(v/2);f=_+v;let E,b,k,S,B,T,P,L,R=He(_),C=Ue(_),O=k=g*s*R-p*n*C,M=S=p*s*R+g*n*C,D=e+k,I=i+S;t&&t.push(t.length?ti:Qe,D,I),l&&Ze(l,D,I),c&&Je(c,D,I);for(let r=0;r<y;r++)E=He(f),b=Ue(f),k=g*s*E-p*n*b,S=p*s*E+g*n*b,B=e+O-w*(g*s*C+p*n*R),T=i+M-w*(p*s*C-g*n*R),P=e+k+w*(g*s*b+p*n*E),L=i+S+w*(p*s*b-g*n*E),t&&t.push(ei,B,T,P,L,e+k,i+S),l&&ai(e+O,i+M,B,T,P,L,e+k,i+S,l,!0),O=k,M=S,R=E,C=b,_=f,f+=v;d&&Je(d,e+k,i+S)},quadraticCurveTo(t,e,i,s,n,r,o){t.push(ei,(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){ai(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,m,y,v=t,x=i,w=n,E=o;for(let t=0;t<2;++t)if(1==t&&(v=e,x=s,w=r,E=a),c=-3*v+9*x-9*w+3*E,u=6*v-12*x+6*w,p=3*x-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;g=-p/u,0<g&&g<1&&d.push(g)}else m=u*u-4*p*c,y=Math.sqrt(m),m<0||(_=(-u+y)/(2*c),0<_&&_<1&&d.push(_),f=(-u-y)/(2*c),0<f&&f<1&&d.push(f));l?qe(h,t,e):Ze(h,t,e),qe(h,o,a);for(let l=0,c=d.length;l<c;l++)oi(d[l],t,e,i,s,n,r,o,a,ni),qe(h,ni.x,ni.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,g=t*t*t;l.x=c*e+u*s+p*r+g*a,l.y=c*i+u*n+p*o+g*h},getPoint(t,e,i,s,n,r,o,a,h){const l={};return oi(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)}},{getPointAndSet:oi,toTwoPointBounds:ai,ellipse:hi}=ri,{sin:li,cos:di,sqrt:ci,atan2:ui}=Math,{ellipse:pi}=ri,gi={ellipticalArc(t,e,i,s,n,r,o,a,h,l,d){const c=(h-e)/2,u=(l-i)/2,p=r*z,g=li(p),_=di(p),f=-_*c-g*u,m=-_*u+g*c,v=s*s,x=n*n,w=m*m,E=f*f,b=v*x-v*w-x*E;let k=0;if(b<0){const t=ci(1-b/(v*x));s*=t,n*=t}else k=(o===a?-1:1)*ci(b/(v*w+x*E));const S=k*s*m/n,B=-k*n*f/s,T=ui((m-B)/n,(f-S)/s),P=ui((-m-B)/n,(-f-S)/s);let L=P-T;0===a&&L>0?L-=U:1===a&&L<0&&(L+=U);const R=e+c+_*S-g*B,C=i+u+g*S+_*B,O=L<0?1:0;d||y.ellipseToCurve?pi(t,R,C,s,n,r,T/z,P/z,O):s!==n||r?t.push(Oe.G,R,C,s,n,r,T/z,P/z,O):t.push(Oe.O,R,C,s,T/z,P/z,O)}},_i={toCommand:t=>[],toNode:t=>[]},{M:fi,m:mi,L:yi,l:vi,H:xi,h:wi,V:Ei,v:bi,C:ki,c:Si,S:Bi,s:Ti,Q:Pi,q:Li,T:Ri,t:Ci,A:Oi,a:Mi,Z:Di,z:Ii,N:Ai,D:Wi,X:Fi,G:zi,F:Ui,O:Hi,P:Ni,U:Yi}=Oe,{rect:Xi,roundRect:Vi,arcTo:ji,arc:Gi,ellipse:Ki,quadraticCurveTo:Zi}=ri,{ellipticalArc:qi}=gi,Ji=$t.get("PathConvert"),$i={},Qi={current:{dot:0},stringify(t,e){let i,s,n,r=0,o=t.length,a="";for(;r<o;){s=t[r],i=Fe[s],a+=s===n?" ":We[s];for(let s=1;s<i;s++)a+=W.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?Ie:De;for(let e=0,h=t.length;e<h;e++)s=t[e],qt[s]?("."===s&&(ts.dot&&(es(o,r),r=""),ts.dot++),"0"===r&&"."!==s&&(es(o,r),r=""),r+=s):Oe[s]?(r&&(es(o,r),r=""),ts.name=Oe[s],ts.length=Me[s],ts.index=0,es(o,ts.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===n||"E"===n?r+=s:(r&&es(o,r),r=s):r&&(es(o,r),r=""),n=s;return r&&es(o,r),i?Qi.toCanvasData(o,e):o},toCanvasData(t,e){let i,s,n,r,o,a=0,h=0,l=0,d=0,c=0,u=t.length;const p=[];for(;c<u;){switch(n=t[c],n){case mi:t[c+1]+=a,t[c+2]+=h;case fi:a=t[c+1],h=t[c+2],p.push(fi,a,h),c+=3;break;case wi:t[c+1]+=a;case xi:a=t[c+1],p.push(yi,a,h),c+=2;break;case bi:t[c+1]+=h;case Ei:h=t[c+1],p.push(yi,a,h),c+=2;break;case vi:t[c+1]+=a,t[c+2]+=h;case yi:a=t[c+1],h=t[c+2],p.push(yi,a,h),c+=3;break;case Ti:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=Bi;case Bi:o=r===ki||r===Bi,l=o?2*a-i:t[c+1],d=o?2*h-s:t[c+2],i=t[c+1],s=t[c+2],a=t[c+3],h=t[c+4],p.push(ki,l,d,i,s,a,h),c+=5;break;case Si:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,n=ki;case ki:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],p.push(ki,t[c+1],t[c+2],i,s,a,h),c+=7;break;case Ci:t[c+1]+=a,t[c+2]+=h,n=Ri;case Ri:o=r===Pi||r===Ri,i=o?2*a-i:t[c+1],s=o?2*h-s:t[c+2],e?Zi(p,a,h,i,s,t[c+1],t[c+2]):p.push(Pi,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case Li:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=Pi;case Pi:i=t[c+1],s=t[c+2],e?Zi(p,a,h,i,s,t[c+3],t[c+4]):p.push(Pi,i,s,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case Mi:t[c+6]+=a,t[c+7]+=h;case Oi:qi(p,a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],e),a=t[c+6],h=t[c+7],c+=8;break;case Ii:case Di:p.push(Di),c++;break;case Ai:a=t[c+1],h=t[c+2],e?Xi(p,a,h,t[c+3],t[c+4]):is(p,t,c,5),c+=5;break;case Wi:a=t[c+1],h=t[c+2],e?Vi(p,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):is(p,t,c,9),c+=9;break;case Fi:a=t[c+1],h=t[c+2],e?Vi(p,a,h,t[c+3],t[c+4],t[c+5]):is(p,t,c,6),c+=6;break;case zi:Ki(e?p:is(p,t,c,9),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],t[c+8],null,$i),a=$i.x,h=$i.y,c+=9;break;case Ui:e?Ki(p,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):is(p,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Hi:Gi(e?p:is(p,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,$i),a=$i.x,h=$i.y,c+=7;break;case Ni:e?Gi(p,t[c+1],t[c+2],t[c+3],0,360,!1):is(p,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Yi:ji(e?p:is(p,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,$i),a=$i.x,h=$i.y,c+=6;break;default:return Ji.error(`command: ${n} [index:${c}]`,t),p}r=n}return p},objectToCanvasData(t){if(t[0].name.length>1)return _i.toCommand(t);{const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(fi,t.x,t.y);break;case"L":e.push(yi,t.x,t.y);break;case"C":e.push(ki,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Pi,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Di)}}),e}},copyData(t,e,i,s){for(let n=i,r=i+s;n<r;n++)t.push(e[n])},pushData(t,e){ts.index===ts.length&&(ts.index=1,t.push(ts.name)),t.push(Number(e)),ts.index++,ts.dot=0}},{current:ts,pushData:es,copyData:is}=Qi,{M:ss,L:ns,C:rs,Q:os,Z:as,N:hs,D:ls,X:ds,G:cs,F:us,O:ps,P:gs,U:_s}=Oe,{getMinDistanceFrom:fs,getRadianFrom:ms}=lt,{tan:ys,min:vs,abs:xs}=Math,ws={},Es={beginPath(t){t.length=0},moveTo(t,e,i){t.push(ss,e,i)},lineTo(t,e,i){t.push(ns,e,i)},bezierCurveTo(t,e,i,s,n,r,o){t.push(rs,e,i,s,n,r,o)},quadraticCurveTo(t,e,i,s,n){t.push(os,e,i,s,n)},closePath(t){t.push(as)},rect(t,e,i,s,n){t.push(hs,e,i,s,n)},roundRect(t,e,i,s,n,r){if(a(r))t.push(ds,e,i,s,n,r);else{const o=W.fourNumber(r);o?t.push(ls,e,i,s,n,...o):t.push(hs,e,i,s,n)}},ellipse(t,e,i,s,r,o,a,h,l){n(o)?t.push(us,e,i,s,r):(n(a)&&(a=0),n(h)&&(h=360),t.push(cs,e,i,s,r,o,a,h,l?1:0))},arc(t,e,i,s,r,o,a){n(r)?t.push(gs,e,i,s):(n(o)&&(o=360),t.push(ps,e,i,s,r,o,a?1:0))},arcTo(t,e,i,n,r,o,a,h){if(!s(a)){const t=fs(a,h,e,i,n,r);o=vs(o,vs(t/2,t/2*xs(ys(ms(a,h,e,i,n,r)/2))))}t.push(_s,e,i,n,r,o)},drawEllipse(t,e,i,s,r,o,a,h,l){ri.ellipse(null,e,i,s,r,n(o)?0:o,n(a)?0:a,n(h)?360:h,l,null,null,ws),t.push(ss,ws.x,ws.y),bs(t,e,i,s,r,o,a,h,l)},drawArc(t,e,i,s,r,o,a){ri.arc(null,e,i,s,n(r)?0:r,n(o)?360:o,a,null,null,ws),t.push(ss,ws.x,ws.y),ks(t,e,i,s,r,o,a)},drawPoints(t,e,i,s){ri.points(t,e,i,s)}},{ellipse:bs,arc:ks}=Es,{moveTo:Ss,lineTo:Bs,quadraticCurveTo:Ts,bezierCurveTo:Ps,closePath:Ls,beginPath:Rs,rect:Cs,roundRect:Os,ellipse:Ms,arc:Ds,arcTo:Is,drawEllipse:As,drawArc:Ws,drawPoints:Fs}=Es;class zs{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?r(t)?Re.parse(t):t:[],this}beginPath(){return Rs(this.__path),this.paint(),this}moveTo(t,e){return Ss(this.__path,t,e),this.paint(),this}lineTo(t,e){return Bs(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,n,r){return Ps(this.__path,t,e,i,s,n,r),this.paint(),this}quadraticCurveTo(t,e,i,s){return Ts(this.__path,t,e,i,s),this.paint(),this}closePath(){return Ls(this.__path),this.paint(),this}rect(t,e,i,s){return Cs(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,n){return Os(this.__path,t,e,i,s,n),this.paint(),this}ellipse(t,e,i,s,n,r,o,a){return Ms(this.__path,t,e,i,s,n,r,o,a),this.paint(),this}arc(t,e,i,s,n,r){return Ds(this.__path,t,e,i,s,n,r),this.paint(),this}arcTo(t,e,i,s,n){return Is(this.__path,t,e,i,s,n),this.paint(),this}drawEllipse(t,e,i,s,n,r,o,a){return As(this.__path,t,e,i,s,n,r,o,a),this.paint(),this}drawArc(t,e,i,s,n,r){return Ws(this.__path,t,e,i,s,n,r),this.paint(),this}drawPoints(t,e,i){return Fs(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Us,L:Hs,C:Ns,Q:Ys,Z:Xs,N:Vs,D:js,X:Gs,G:Ks,F:Zs,O:qs,P:Js,U:$s}=Oe,Qs=$t.get("PathDrawer"),tn={drawPathByData(t,e){if(!e)return;let i,s=0,n=e.length;for(;s<n;)switch(i=e[s],i){case Us:t.moveTo(e[s+1],e[s+2]),s+=3;break;case Hs:t.lineTo(e[s+1],e[s+2]),s+=3;break;case Ns:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case Ys:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Xs:t.closePath(),s+=1;break;case Vs:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case js:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],[e[s+5],e[s+6],e[s+7],e[s+8]]),s+=9;break;case Gs:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case Ks:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*z,e[s+6]*z,e[s+7]*z,e[s+8]),s+=9;break;case Zs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,U,!1),s+=5;break;case qs:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*z,e[s+5]*z,e[s+6]),s+=7;break;case Js:t.arc(e[s+1],e[s+2],e[s+3],0,U,!1),s+=4;break;case $s:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void Qs.error(`command: ${i} [index:${s}]`,e)}}},{M:en,L:sn,C:nn,Q:rn,Z:on,N:an,D:hn,X:ln,G:dn,F:cn,O:un,P:pn,U:gn}=Oe,{toTwoPointBounds:_n,toTwoPointBoundsByQuadraticCurve:fn,arcTo:mn,arc:yn,ellipse:vn}=ri,{addPointBounds:xn,copy:wn,addPoint:En,setPoint:bn,addBounds:kn,toBounds:Sn}=yt,Bn=$t.get("PathBounds");let Tn,Pn,Ln;const Rn={},Cn={},On={},Mn={toBounds(t,e){Mn.toTwoPointBounds(t,Cn),Sn(Cn,e)},toTwoPointBounds(t,e){if(!t||!t.length)return bn(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===on||o===nn||o===rn?bn(e,h,l):bn(e,t[a+1],t[a+2])),o){case en:case sn:h=t[a+1],l=t[a+2],En(e,h,l),a+=3;break;case nn:n=t[a+5],r=t[a+6],_n(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,r,Rn),xn(e,Rn),h=n,l=r,a+=7;break;case rn:i=t[a+1],s=t[a+2],n=t[a+3],r=t[a+4],fn(h,l,i,s,n,r,Rn),xn(e,Rn),h=n,l=r,a+=5;break;case on:a+=1;break;case an:h=t[a+1],l=t[a+2],kn(e,h,l,t[a+3],t[a+4]),a+=5;break;case hn:case ln:h=t[a+1],l=t[a+2],kn(e,h,l,t[a+3],t[a+4]),a+=o===hn?9:6;break;case dn:vn(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],Rn,On),0===a?wn(e,Rn):xn(e,Rn),h=On.x,l=On.y,a+=9;break;case cn:h=t[a+1],l=t[a+2],Pn=t[a+3],Ln=t[a+4],kn(e,h-Pn,l-Ln,2*Pn,2*Ln),h+=Pn,a+=5;break;case un:yn(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Rn,On),0===a?wn(e,Rn):xn(e,Rn),h=On.x,l=On.y,a+=7;break;case pn:h=t[a+1],l=t[a+2],Tn=t[a+3],kn(e,h-Tn,l-Tn,2*Tn,2*Tn),h+=Tn,a+=4;break;case gn:mn(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Rn,On),0===a?wn(e,Rn):xn(e,Rn),h=On.x,l=On.y,a+=6;break;default:return void Bn.error(`command: ${o} [index:${a}]`,t)}}},{M:Dn,L:In,Z:An}=Oe,{getCenterX:Wn,getCenterY:Fn}=lt,{arcTo:zn}=Es,Un={smooth(t,e,i){let s,n,r,o=0,a=0,h=0,l=0,d=0,c=0,u=0,p=0,g=0;const _=t.length,f=[];for(;o<_;){switch(s=t[o],s){case Dn:l=p=t[o+1],d=g=t[o+2],o+=3,t[o]===In?(c=t[o+1],u=t[o+2],f.push(Dn,Wn(l,c),Fn(d,u))):f.push(Dn,l,d);break;case In:switch(a=t[o+1],h=t[o+2],o+=3,t[o]){case In:zn(f,a,h,t[o+1],t[o+2],e,p,g);break;case An:zn(f,a,h,l,d,e,p,g);break;default:f.push(In,a,h)}p=a,g=h;break;case An:n!==An&&(zn(f,l,d,c,u,e,p,g),f.push(An)),o+=1;break;default:r=Fe[s];for(let e=0;e<r;e++)f.push(t[o+e]);o+=r}n=s}return s!==An&&(f[1]=l,f[2]=d),f}};function Hn(t){return new zs(t)}const Nn=Hn();Re.creator=Hn(),Re.parse=Qi.parse,Re.convertToCanvasData=Qi.toCanvasData;const{drawRoundRect:Yn}=ze;function Xn(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,n){Yn(this,t,e,i,s,n)})}(t)}const Vn={alphaPixelTypes:["png","webp","svg"],upperCaseTypeMap:{},mineType:t=>!t||t.startsWith("image")?t:("jpg"===t&&(t="jpeg"),"image/"+t),fileType(t){const e=t.split(".");return e[e.length-1]},isOpaqueImage(t){const e=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=Vn;jn.alphaPixelTypes.forEach(t=>jn.upperCaseTypeMap[t]=t.toUpperCase());const Gn=$t.get("TaskProcessor");class Kn{constructor(t){this.parallel=!0,this.time=1,this.id=x.create(x.TASK),this.task=t}run(){return _e(this,void 0,void 0,function*(){try{if(this.isComplete)return;if(this.canUse&&!this.canUse())return this.cancel();this.task&&this.parent.running&&(yield this.task())}catch(t){Gn.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}}class Zn{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&&p.assign(this.config,t),this.empty()}add(t,e,i){let n,r,o,h;const l=new Kn(t);return l.parent=this,a(e)?h=e:e&&(r=e.parallel,n=e.start,o=e.time,h=e.delay,i||(i=e.canUse)),o&&(l.time=o),!1===r&&(l.parallel=!1),i&&(l.canUse=i),s(h)?this.push(l,n):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(l,n))},h)),this.isComplete=!1,l}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout(()=>this.start()))}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[],this.delayNumber=0}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach(t=>{t.isComplete||t.cancel()}),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then(()=>{this.onTask(t),this.index++,t.isCancel?this.runTask():this.nextTask()}).catch(t=>{this.onError(t)}):this.timer=setTimeout(()=>this.nextTask())}runParallelTasks(){this.parallelList.forEach(t=>this.runParallelTask(t))}runParallelTask(t){t.run().then(()=>{this.onTask(t),this.fillParallelTask()}).catch(t=>{this.onParallelError(t)})}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout(()=>this.run())}setParallelList(){let t;const{config:e,list:i,index:s}=this;this.parallelList=[],this.parallelSuccessNumber=0;let 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 qn=$t.get("Resource"),Jn={tasker:new Zn,map:{},get isComplete(){return $n.tasker.isComplete},set(t,e){$n.map[t]&&qn.repeat(t),$n.map[t]=e},get:t=>$n.map[t],remove(t){const e=$n.map[t];e&&(e.destroy&&e.destroy(),delete $n.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 r(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=oe.image(s)),$n.set(t,e),e},destroy(){$n.map={}}},$n=Jn,Qn={maxRecycled:10,recycledList:[],patternTasker:new Zn,get(t){let e=Jn.get(t.url);return e||Jn.set(t.url,e=oe.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||tr.recycledList.push(t)})},clearRecycled(){const t=tr.recycledList;t.length>tr.maxRecycled&&(t.forEach(t=>!t.use&&t.url&&Jn.remove(t.url)),t.length=0)},hasAlphaPixel:t=>Vn.alphaPixelTypes.some(e=>tr.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:"+Vn.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+Vn.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){tr.recycledList=[]}},tr=Qn,{IMAGE:er,create:ir}=x;class sr{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=ir(er),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}Qn.isFormat("svg",t)&&(this.isSVG=!0),Qn.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,e){if(!this.loading){this.loading=!0;const{crossOrigin:t}=this.config;Jn.tasker.add(()=>_e(this,void 0,void 0,function*(){return yield y.origin.loadImage(this.url,s(t)?y.image.crossOrigin:t,this).then(t=>this.setView(t)).catch(t=>{this.error=t,this.onComplete(!1)})}))}return this.waitComplete.push(t,e),this.waitComplete.length-2}unload(t,e){const i=this.waitComplete;if(e){const e=i[t+1];e&&e({type:"stop"})}i[t]=i[t+1]=void 0}setView(t){this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)}onComplete(t){let e;this.waitComplete.forEach((i,s)=>{e=s%2,i&&(t?e||i(this):e&&i(this.error))}),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(t,e,i,s,n,r,o){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 a=y.image.resize(this.view,t,e,n,r,void 0,o,i,s);return this.cache=this.use>1?{data:a,params:arguments}:null,a}getPattern(t,e,i,s){const n=y.canvas.createPattern(t,e);return y.image.setPatternTransform(n,i,s),n}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function nr(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function rr(t,e){return Object.getOwnPropertyDescriptor(t,e)}function or(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function ar(t,e){return(i,s)=>lr(i,s,t,e&&e(s))}function hr(t){return t}function lr(t,e,i,s){const n={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};nr(t,e,Object.assign(n,s||{})),Wr(t,e,i)}function dr(t){return ar(t)}function cr(t,e){return ar(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function ur(t,e){return ar(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function pr(t){return ar(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),yr(this))}}))}function gr(t,e){return ar(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function _r(t,e){return ar(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function fr(t,e){return ar(t,t=>({set(i){this.__setAttr(t,i,e)&&yr(this)}}))}function mr(t){return ar(t,t=>({set(e){this.__setAttr(t,e)&&(yr(this),this.__.__removeNaturalSize())}}))}function yr(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function vr(t){return ar(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),yr(this)}}))}const xr=fr;function wr(t,e){return ar(t,t=>({set(i){this.__setAttr(t,i)&&(Er(this),e&&(this.__.__useStroke=!0))}}))}function Er(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&yr(t)}const br=wr;function kr(t){return ar(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Sr(t){return ar(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function Br(t){return ar(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;p.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip),this.__layout.surfaceChange()}}}))}function Tr(t){return ar(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Lr(this)}}))}function Pr(t){return ar(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>Rr(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Rr(this,t,e,i),this.mask&&Lr(this)}}))}function Lr(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Rr(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||yr(t))}function Cr(t){return ar(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function Or(t){return ar(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function Mr(t){return ar(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function Dr(t){return ar(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===$t.showBounds&&this.__layout.surfaceChange(),this.leafer&&this.leafer.updateCursor())}}))}function Ir(t){return ar(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function Ar(t){return(e,i)=>{nr(e,"__DataProcessor",{get:()=>t})}}function Wr(t,e,i){const n=t.__DataProcessor.prototype,r="_"+e,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=or(e,i);if(s(i))a.get=function(){return this[r]};else if("function"==typeof i)a.get=function(){const t=this[r];return null==t?i(this.__leaf):t};else if(d(i)){const t=u(i);a.get=function(){const e=this[r];return null==e?this[r]=t?{}:p.clone(i):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[r];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[r];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,c=n;for(;!l&&c;)l=rr(c,e),c=c.__proto__;l&&l.set&&(a.set=l.set),n[o]&&(a.set=n[o],delete n[o]),nr(n,e,a)}const Fr=new $t("rewrite"),zr=[],Ur=["destroy","constructor"];function Hr(t){return(e,i)=>{zr.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function Nr(){return t=>{Yr()}}function Yr(t){zr.length&&(zr.forEach(e=>{t&&Fr.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),zr.length=0)}function Xr(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(Ur.includes(s)||e&&e.includes(s)))if(t.prototype){rr(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function Vr(){return t=>{he.register(t)}}function jr(){return t=>{ce.register(t)}}setTimeout(()=>Yr(!0));const{copy:Gr,toInnerPoint:Kr,toOuterPoint:Zr,scaleOfOuter:qr,rotateOfOuter:Jr,skewOfOuter:$r,multiplyParent:Qr,divideParent:to,getLayout:eo}=$,io={},{round:so}=Math,no={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),ao(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,n=s.length;t<n;t++)oo(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++)ho(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&ho(t),t.__updateChange()},updateAllChange(t){if(co(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)lo(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||y.fullImageShadow?e.copyWorldByReset(i,s,t.__nowWorld,n,r):e.copyWorldToInner(i,s,t.__layout.renderBounds,n)},moveWorld(t,e,i=0,s,n){const r=d(e)?Object.assign({},e):{x:e,y:i};s?Zr(t.localTransform,r,r,!0):t.parent&&Kr(t.parent.scrollWorldTransform,r,r,!0),ro.moveLocal(t,r.x,r.y,n)},moveLocal(t,e,i=0,s){d(e)&&(i=e.y,e=e.x),e+=t.x,i+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=so(e),i=so(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,n,r){ro.zoomOfLocal(t,uo(t,e),i,s,n,r)},zoomOfLocal(t,e,i,s=i,n,r){const o=t.__localMatrix;if(a(s)||(s&&(r=s),s=i),Gr(io,o),qr(io,e,i,s),ro.hasHighPosition(t))ro.setTransform(t,io,n,r);else{const e=t.x+io.e-o.e,a=t.y+io.f-o.f;r&&!n?t.animate({x:e,y:a,scaleX:t.scaleX*i,scaleY:t.scaleY*s},r):(t.x=e,t.y=a,t.scaleResize(i,s,!0!==n))}},rotateOfWorld(t,e,i,s){ro.rotateOfLocal(t,uo(t,e),i,s)},rotateOfLocal(t,e,i,s){const n=t.__localMatrix;Gr(io,n),Jr(io,e,i),ro.hasHighPosition(t)?ro.setTransform(t,io,!1,s):t.set({x:t.x+io.e-n.e,y:t.y+io.f-n.f,rotation:W.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,n,r){ro.skewOfLocal(t,uo(t,e),i,s,n,r)},skewOfLocal(t,e,i,s=0,n,r){Gr(io,t.__localMatrix),$r(io,e,i,s),ro.setTransform(t,io,n,r)},transformWorld(t,e,i,s){Gr(io,t.worldTransform),Qr(io,e),t.parent&&to(io,t.parent.scrollWorldTransform),ro.setTransform(t,io,i,s)},transform(t,e,i,s){Gr(io,t.localTransform),Qr(io,e),ro.setTransform(t,io,i,s)},setTransform(t,e,i,s){const n=t.__,r=n.origin&&ro.getInnerOrigin(t,n.origin),o=eo(e,r,n.around&&ro.getInnerOrigin(t,n.around));if(ro.hasOffset(t)&&(o.x-=n.offsetX,o.y-=n.offsetY),i){const e=o.scaleX/t.scaleX,i=o.scaleY/t.scaleY;if(delete o.scaleX,delete o.scaleY,r){Yt.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=ro.getInnerOrigin(t,n.origin);lt.move(o,r.x-s.x,r.y-s.y)}t.set(o),t.scaleResize(e,i,!1)}else t.set(o,s)},getFlipTransform(t,e){const i={a:1,b:0,c:0,d:1,e:0,f:0},s="x"===e?1:-1;return qr(i,ro.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>lt.tempToOuterOf(ro.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return bt.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(Gr(io,t.worldTransform),to(io,e.scrollWorldTransform),i?io:Object.assign({},io)),drop(t,e,i,s){t.setTransform(ro.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||ro.hasOffset(t),hasOffset:t=>t.offsetX||t.offsetY,hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}},animateMove(t,e,i=.3){if(e.x||e.y)if(Math.abs(e.x)<1&&Math.abs(e.y)<1)t.move(e);else{const s=e.x*i,n=e.y*i;e.x-=s,e.y-=n,t.move(s,n),y.requestRender(()=>ro.animateMove(t,e,i))}}},ro=no,{updateAllMatrix:oo,updateMatrix:ao,updateAllWorldOpacity:ho,updateAllChange:lo,updateChange:co}=ro;function uo(t,e){return t.updateLayout(),t.parent?lt.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const po={worldBounds:t=>t.__world,localBoxBounds:t=>t.__.eraser||0===t.__.visible?null:t.__local||t.__layout,localStrokeBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localStrokeBounds,localRenderBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localRenderBounds,maskLocalBoxBounds:(t,e)=>_o(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>_o(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>_o(t,e)&&t.__layout.localRenderBounds,excludeRenderBounds:(t,e)=>!(!e.bounds||e.bounds.hit(t.__world,e.matrix))||!(!e.hideBounds||!e.hideBounds.includes(t.__world,e.matrix))};let go;function _o(t,e){return e||(go=0),t.__.mask&&(go=1),go<0?null:(go&&(go=-1),!0)}const{updateBounds:fo}=no,mo={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),yo(t,e))}},pushAllParent(t,e){const{keys:i}=e;if(i)for(;t.parent&&s(i[t.parent.innerId]);)e.add(t.parent),t=t.parent;else for(;t.parent;)e.add(t.parent),t=t.parent},pushAllBranchStack(t,e){let i=e.length;const{children:s}=t;for(let t=0,i=s.length;t<i;t++)s[t].isBranch&&e.push(s[t]);for(let t=i,s=e.length;t<s;t++)vo(e[t],e)},updateBounds(t,e){const i=[t];vo(t,i),xo(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++)fo(s[t]);e&&e===i||fo(i)}}},{pushAllChildBranch:yo,pushAllBranchStack:vo,updateBoundsByBranchStack:xo}=mo,wo={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:Eo,updateBounds:bo}=no,{toOuterOf:ko,getPoints:So,copy:Bo}=Yt,To="_localContentBounds",Po="_worldContentBounds",Lo="_worldBoxBounds",Ro="_worldStrokeBounds";class Co{get contentBounds(){return this._contentBounds||this.boxBounds}set contentBounds(t){this._contentBounds=t}get strokeBounds(){return this._strokeBounds||this.boxBounds}get renderBounds(){return this._renderBounds||this.boxBounds}set renderBounds(t){this._renderBounds=t}get localContentBounds(){return ko(this.contentBounds,this.leaf.__localMatrix,this[To]||(this[To]={})),this[To]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return ko(this.contentBounds,this.leaf.__world,this[Po]||(this[Po]={})),this[Po]}get worldBoxBounds(){return ko(this.boxBounds,this.leaf.__world,this[Lo]||(this[Lo]={})),this[Lo]}get worldStrokeBounds(){return ko(this.strokeBounds,this.leaf.__world,this[Ro]||(this[Ro]={})),this[Ro]}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 bo(t);if(e)e.ready?e.watcher.changed&&e.layouter.layout():e.start();else{let e=t;for(;e.parent&&!e.parent.leafer;)e=e.parent;const i=e;if(i.__fullLayouting)return;i.__fullLayouting=!0,y.layout(i),delete i.__fullLayouting}}getTransform(t="world"){this.update();const{leaf:e}=this;switch(t){case"world":return e.__world;case"local":return e.__localMatrix;case"inner":return $.defaultMatrix;case"page":t=e.zoomLayer;default:return Eo(e,t)}}getBounds(t,e="world"){switch(this.update(),e){case"world":return this.getWorldBounds(t);case"local":return this.getLocalBounds(t);case"inner":return this.getInnerBounds(t);case"page":e=this.leaf.zoomLayer;default:return new Gt(this.getInnerBounds(t)).toOuterOf(this.getTransform(e))}}getInnerBounds(t="box"){switch(t){case"render":return this.renderBounds;case"content":if(this.contentBounds)return this.contentBounds;case"box":return this.boxBounds;case"stroke":return this.strokeBounds}}getLocalBounds(t="box"){switch(t){case"render":return this.localRenderBounds;case"stroke":return this.localStrokeBounds;case"content":if(this.contentBounds)return this.localContentBounds;case"box":return this.leaf.__localBoxBounds}}getWorldBounds(t="box"){switch(t){case"render":return this.leaf.__world;case"stroke":return this.worldStrokeBounds;case"content":if(this.contentBounds)return this.worldContentBounds;case"box":return this.worldBoxBounds}}getLayoutBounds(t,e="world",i){const{leaf:s}=this;let 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=$.defaultMatrix;break;case"page":e=s.zoomLayer;default:n=s.getWorldPoint(a,e),r=Eo(s,e,!0)}if(o||(o=$.getLayout(r)),Bo(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,n=So(this.getInnerBounds(t));let r;switch(e){case"world":r=null;break;case"local":r=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:r=e}return s(r)||n.forEach(t=>i.innerToWorld(t,null,!1,r)),n}shrinkContent(){const{x:t,y:e,width:i,height:s}=this.boxBounds;this._contentBounds={x:t,y:e,width:i,height:s}}spreadStroke(){const{x:t,y:e,width:i,height:s}=this.strokeBounds;this._strokeBounds={x:t,y:e,width:i,height:s},this._localStrokeBounds={x:t,y:e,width:i,height:s},this.renderSpread||this.spreadRenderCancel()}spreadRender(){const{x:t,y:e,width:i,height:s}=this.renderBounds;this._renderBounds={x:t,y:e,width:i,height:s},this._localRenderBounds={x:t,y:e,width:i,height:s}}shrinkContentCancel(){this._contentBounds=void 0}spreadStrokeCancel(){const t=this.renderBounds===this.strokeBounds;this._strokeBounds=this.boxBounds,this._localStrokeBounds=this.leaf.__localBoxBounds,t&&this.spreadRenderCancel()}spreadRenderCancel(){this._renderBounds=this._strokeBounds,this._localRenderBounds=this._localStrokeBounds}boxChange(){this.boxChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange(),this.hitCanvasChanged=!0}localBoxChange(){this.localBoxChanged=!0,this.boundsChanged=!0}strokeChange(){this.strokeChanged=!0,this.strokeSpread||(this.strokeSpread=1),this.boundsChanged=!0,this.hitCanvasChanged=!0}renderChange(){this.renderChanged=!0,this.renderSpread||(this.renderSpread=1),this.boundsChanged=!0}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChange(),this.leaf.__local||this.createLocal()}matrixChange(){this.matrixChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=this.affectChildrenSort=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class Oo{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&y.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&y.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&y.event.stop(this.origin)}}class Mo extends Oo{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}Mo.ADD="child.add",Mo.REMOVE="child.remove",Mo.CREATED="created",Mo.MOUNTED="mounted",Mo.UNMOUNTED="unmounted",Mo.DESTROY="destroy";const Do="property.scroll";class Io extends Oo{constructor(t,e,i,s,n){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=n}}Io.CHANGE="property.change",Io.LEAFER_CHANGE="property.leafer_change",Io.SCROLL=Do;const Ao={scrollX:Do,scrollY:Do};class Wo extends Oo{constructor(t,e){super(t),Object.assign(this,e)}}Wo.LOAD="image.load",Wo.LOADED="image.loaded",Wo.ERROR="image.error";class Fo extends Oo{static checkHas(t,e,i){"on"===i?e===No?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(zo)||t.hasEvent(Uo)||t.hasEvent(Ho),t.__hasWorldEvent=t.hasEvent(No))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(zo,t),"inner"===e&&t.emit(Uo,t)),t.emit(Ho,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(No,this)}}Fo.RESIZE="bounds.resize",Fo.INNER="bounds.inner",Fo.LOCAL="bounds.local",Fo.WORLD="bounds.world";const{RESIZE:zo,INNER:Uo,LOCAL:Ho,WORLD:No}=Fo,Yo={};[zo,Uo,Ho,No].forEach(t=>Yo[t]=1);class Xo extends Oo{get bigger(){if(!this.old)return!0;const{width:t,height:e}=this.old;return this.width>=t&&this.height>=e}get smaller(){return!this.bigger}get samePixelRatio(){return!this.old||this.pixelRatio===this.old.pixelRatio}constructor(t,e){d(t)?(super(Xo.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!s(this.resizingKeys[t.innerId])}}Xo.RESIZE="resize";class Vo extends Oo{constructor(t,e){super(t),this.data=e}}Vo.REQUEST="watch.request",Vo.DATA="watch.data";class jo extends Oo{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}jo.REQUEST="layout.request",jo.START="layout.start",jo.BEFORE="layout.before",jo.LAYOUT="layout",jo.AFTER="layout.after",jo.AGAIN="layout.again",jo.END="layout.end";class Go extends Oo{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}Go.REQUEST="render.request",Go.CHILD_START="render.child_start",Go.CHILD_END="render.child_end",Go.START="render.start",Go.BEFORE="render.before",Go.RENDER="render",Go.AFTER="render.after",Go.AGAIN="render.again",Go.END="render.end",Go.NEXT="render.next";class Ko extends Oo{}Ko.START="leafer.start",Ko.BEFORE_READY="leafer.before_ready",Ko.READY="leafer.ready",Ko.AFTER_READY="leafer.after_ready",Ko.VIEW_READY="leafer.view_ready",Ko.VIEW_COMPLETED="leafer.view_completed",Ko.STOP="leafer.stop",Ko.RESTART="leafer.restart",Ko.END="leafer.end",Ko.UPDATE_MODE="leafer.update_mode",Ko.TRANSFORM="leafer.transform",Ko.MOVE="leafer.move",Ko.SCALE="leafer.scale",Ko.ROTATE="leafer.rotate",Ko.SKEW="leafer.skew";const{MOVE:Zo,SCALE:qo,ROTATE:Jo,SKEW:$o}=Ko,Qo={x:Zo,y:Zo,scaleX:qo,scaleY:qo,rotation:Jo,skewX:$o,skewY:$o},ta={};class ea{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(l(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let i in t)l(e=t[i])?this.on(i,e[0],e[1]):this.on(i,e);return}let s,n,o;i&&("once"===i?n=!0:"boolean"==typeof i?s=i:(s=i.capture,n=i.once));const a=ia(this,s,!0),h=r(t)?t.split(" "):t,d=n?{listener:e,once:n}:{listener:e};h.forEach(t=>{t&&(o=a[t],o?-1===o.findIndex(t=>t.listener===e)&&o.push(d):a[t]=[d],Yo[t]&&Fo.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=r(t)?t.split(" "):t;if(e){let t,n,r;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const o=ia(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],Yo[t]&&Fo.checkHas(this,t,"off")))})}else{const{__bubbleMap:t,__captureMap:e}=this;s.forEach(i=>{t&&delete t[i],e&&delete e[i]})}}else this.__bubbleMap=this.__captureMap=void 0}on_(t,e,i,s){return e?this.on(t,i?e=e.bind(i):e,s):l(t)&&t.forEach(t=>this.on(t[0],t[2]?t[1]=t[1].bind(t[2]):t[1],t[3])),{type:t,current:this,listener:e,options:s}}off_(t){if(!t)return;const e=l(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):l(t.type)&&t.type.forEach(e=>t.current.off(e[0],e[1],e[3])))}),e.length=0}once(t,e,i,s){if(!e)return l(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));d(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&ce.has(t)&&(e=ce.get(t,{type:t,target:this,current:this}));const s=ia(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:n}=this,r=i&&i[t],o=n&&n[t];return!!(s(e)?r||o:e?o:r)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function ia(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:ta)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:ta)}}const{on:sa,on_:na,off:ra,off_:oa,once:aa,emit:ha,emitEvent:la,hasEvent:da,destroy:ca}=ea.prototype,ua={on:sa,on_:na,off:ra,off_:oa,once:aa,emit:ha,emitEvent:la,hasEvent:da,destroyEventer:ca},pa=$t.get("setAttr"),ga={__setAttr(t,e,i){if(this.leaferIsCreated){const n=this.__.__getInput(t);if(!i||o(e)||s(e)||(pa.warn(this.innerName,t,e),e=void 0),d(e)||n!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new Io(Io.LEAFER_CHANGE,this,t,n,e));const i=Qo[t];i&&(this.emitEvent(new Ko(i,this)),this.emitEvent(new Ko(Ko.TRANSFORM,this)))}this.emitPropertyEvent(Io.CHANGE,t,n,e);const i=Ao[t];return i&&this.emitPropertyEvent(i,t,n,e),!0}return!1}return this.__realSetAttr(t,e),!0},emitPropertyEvent(t,e,i,s){const n=new Io(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||s(i.normalStyle[t])||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:_a,multiplyParent:fa,translateInner:ma,defaultWorld:ya}=$,{toPoint:va,tempPoint:xa}=bt,wa={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:n}=this;fa(this.__local||e,t?t.__scrollWorld||t.__world:ya,i,!!e.affectScaleOrRotation,n),s&&ma(Object.assign(s,i),n.scrollX,n.scrollY)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,i=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(_a(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)&&(va(i.around||i.origin,t.boxBounds,xa),ma(e,-xa.x,-xa.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:Ea,updateAllMatrix:ba}=no,{updateBounds:ka}=mo,{toOuterOf:Sa,copyAndSpread:Ba,copy:Ta}=Yt,{toBounds:Pa}=Mn,La={__updateWorldBounds(){const{__layout:t,__world:e}=this;Sa(t.renderBounds,e,e),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&Fo.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&Fo.emitWorld(this)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.resized="inner"),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=void 0,t.strokeSpread&&(t.strokeChanged=!0),t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.boxChange()),t.boxChanged=void 0,t.strokeChanged&&(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.strokeChanged=void 0,(t.renderSpread||t.strokeSpread!==t.strokeBoxSpread)&&(t.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),t.resized="inner"),t.renderChanged&&(t.renderSpread=this.__updateRenderSpread(),t.renderSpread?(t.renderBounds!==t.boxBounds&&t.renderBounds!==t.strokeBounds||t.spreadRender(),this.__updateRenderBounds(),this.__updateLocalRenderBounds()):t.spreadRenderCancel(),t.renderChanged=void 0,this.parent&&this.parent.__layout.renderChange()),t.resized||(t.resized="local"),t.boundsChanged=void 0},__updateLocalBoxBounds(){this.__hasMotionPath&&this.__updateMotionPath(),this.__hasAutoLayout&&this.__updateAutoLayout(),Sa(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Sa(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Sa(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const i=this.__layout.boxBounds,s=this.__;s.__usePathBox?Pa(s.path,i):(i.x=0,i.y=0,i.width=s.width,i.height=s.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),ba(this),ka(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(ba(this),ka(this,this))):Ea(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;Ba(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:i}=e;a(i)&&i<=0?Ta(e.renderBounds,e.strokeBounds):Ba(e.renderBounds,e.boxBounds,i)}},Ra={__render(t,e){if(e.shape)return this.__renderShape(t,e);if(this.__worldOpacity){const i=this.__;if(i.bright&&!e.topRendering)return e.topList.add(this);if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.dimOpacity&&!i.dimskip?i.opacity*e.dimOpacity:i.opacity,this.__.__single){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!0,!0);this.__draw(s,e,t),no.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);$t.showBounds&&$t.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:Ca}=po,Oa={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__nowWorld=this.__getNowWorld(e),this.__worldOpacity){const i=this.__;if(i.__useDim)if(i.dim)e.dimOpacity=!0===i.dim?.2:i.dim;else{if(i.bright&&!e.topRendering)return e.topList.add(this);i.dimskip&&e.dimOpacity&&(e.dimOpacity=0)}if(i.__single&&!this.isBranchLeaf){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!1,!0);this.__renderBranch(s,e);const n=this.__nowWorld;t.opacity=e.dimOpacity?i.opacity*e.dimOpacity:i.opacity,t.copyWorldByReset(s,n,n,i.__blendMode,!0),s.recycle(n)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:i}=this;for(let s=0,n=i.length;s<n;s++)Ca(i[s],e)||i[s].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,n=i.length;s<n;s++)Ca(i[s],e)||i[s].__clip(t,e)}}},Ma={},{LEAF:Da,create:Ia}=x,{stintSet:Aa}=p,{toInnerPoint:Wa,toOuterPoint:Fa,multiplyParent:za}=$,{toOuterOf:Ua}=Yt,{copy:Ha,move:Na}=lt,{moveLocal:Ya,zoomOfLocal:Xa,rotateOfLocal:Va,skewOfLocal:ja,moveWorld:Ga,zoomOfWorld:Ka,rotateOfWorld:Za,skewOfWorld:qa,transform:Ja,transformWorld:$a,setTransform:Qa,getFlipTransform:th,getLocalOrigin:eh,getRelativeWorld:ih,drop:sh}=no;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 _}get __LayoutProcessor(){return Co}get leaferIsCreated(){return this.leafer&&this.leafer.created}get leaferIsReady(){return this.leafer&&this.leafer.ready}get isLeafer(){return!1}get isBranch(){return!1}get isBranchLeaf(){return!1}get __localMatrix(){return this.__local||this.__layout}get __localBoxBounds(){return this.__local||this.__layout}get worldTransform(){return this.__layout.getTransform("world")}get localTransform(){return this.__layout.getTransform("local")}get scrollWorldTransform(){return this.updateLayout(),this.__scrollWorld||this.__world}get boxBounds(){return this.getBounds("box","inner")}get renderBounds(){return this.getBounds("render","inner")}get worldBoxBounds(){return this.getBounds("box")}get worldStrokeBounds(){return this.getBounds("stroke")}get worldRenderBounds(){return this.getBounds("render")}get worldOpacity(){return this.updateLayout(),this.__worldOpacity}get __worldFlipped(){return this.__world.scaleX<0||this.__world.scaleY<0}get __onlyHitMask(){return this.__hasMask&&!this.__.hitChildren}get __ignoreHitWorld(){return(this.__hasMask||this.__hasEraser)&&this.__.hitChildren}get __inLazyBounds(){return this.leaferIsCreated&&this.leafer.lazyBounds.hit(this.__world)}get pathInputed(){return this.__.__pathInputed}set event(t){this.on(t)}constructor(t){this.innerId=Ia(Da),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Mo.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(Mo.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Mo.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(Mo.MOUNTED)):this.__emitLifeEvent(Mo.UNMOUNTED),this.isBranch){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){s(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=s(e)?null:void 0,this[t]=e}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(t,e){}__updateContentBounds(){}__updateStrokeBounds(t){}__updateRenderBounds(t){}__updateAutoLayout(){}__updateFlowLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some(t=>t.__.eraser)}__renderEraser(t,e){t.save(),this.__clip(t,e);const{renderBounds:i}=this.__layout;t.clearRect(i.x,i.y,i.width,i.height),t.restore()}__updateMask(t){this.__hasMask=this.children.some(t=>t.__.mask&&t.__.visible&&t.__.opacity)}__renderMask(t,e){}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld,i=this.__world;return za(i,t.matrix,e,void 0,i),Ua(this.__layout.renderBounds,e,e),Aa(e,"half",i.half),Aa(e,"ignorePixelSnap",i.ignorePixelSnap),e}return this.__world}getClampRenderScale(){let{scaleX:t}=this.__nowWorld||this.__world;return t<0&&(t=-t),t>1?t:1}getRenderScaleData(t,e){let{scaleX:i,scaleY:s}=Qn.patternLocked?this.__world:this.__nowWorld;return t&&(i<0&&(i=-i),s<0&&(s=-s)),(!0===e||"zoom-in"===e&&i>1&&s>1)&&(i=s=1),Ma.scaleX=i,Ma.scaleY=s,Ma}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?ih(this,e):this.worldTransform,n=i?t:{};return Ua(t,s,n),n}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&Ha(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&Ha(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),Wa(this.scrollWorldTransform,t,e,i)}innerToWorld(t,e,i,s){Fa(this.scrollWorldTransform,t,e,i),s&&s.worldToInner(e||t,null,i)}getBoxPoint(t,e,i,s){return this.getBoxPointByInner(this.getInnerPoint(t,e,i,s),null,null,!0)}getBoxPointByInner(t,e,i,s){const n=s?t:Object.assign({},t),{x:r,y:o}=this.boxBounds;return Na(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 Na(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){Qa(this,t,e,i)}transform(t,e,i){Ja(this,t,e,i)}move(t,e,i){Ya(this,t,e,i)}moveInner(t,e,i){Ga(this,t,e,!0,i)}scaleOf(t,e,i,s,n){Xa(this,eh(this,t),e,i,s,n)}rotateOf(t,e,i){Va(this,eh(this,t),e,i)}skewOf(t,e,i,s,n){ja(this,eh(this,t),e,i,s,n)}transformWorld(t,e,i){$a(this,t,e,i)}moveWorld(t,e,i){Ga(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,n){Ka(this,t,e,i,s,n)}rotateOfWorld(t,e){Za(this,t,e)}skewOfWorld(t,e,i,s,n){qa(this,t,e,i,s,n)}flip(t,e){Ja(this,th(this,t),!1,e)}scaleResize(t,e=t,i){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}hit(t,e){return!0}__hitWorld(t){return!0}__hit(t){return!0}__hitFill(t){return!0}__hitStroke(t,e){return!0}__hitPixel(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e,i){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return re.need("path")}getMotionPoint(t){return re.need("path")}getMotionTotal(){return 0}__updateMotionPath(){}__runAnimation(t,e){}__updateSortChildren(){}add(t,e){}remove(t,e){this.parent&&this.parent.remove(this,e)}dropTo(t,e,i){sh(this,t,e,i)}on(t,e,i){}off(t,e,i){}on_(t,e,i,s){}off_(t){}once(t,e,i,s){}emit(t,e,i){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,i){i?this.addAttr(t,e,i):Wr(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=fr),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Mo(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Mo.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}},t.Leaf=ge([Xr(ga),Xr(wa),Xr(La),Xr(ua),Xr(Ra)],t.Leaf);const{setListWithFn:nh}=Yt,{sort:rh}=mo,{localBoxBounds:oh,localStrokeBounds:ah,localRenderBounds:hh,maskLocalBoxBounds:lh,maskLocalStrokeBounds:dh,maskLocalRenderBounds:ch}=po,uh=new $t("Branch");t.Branch=class extends t.Leaf{__updateStrokeSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(t,e){nh(e||this.__layout.boxBounds,this.children,this.__hasMask?lh:oh)}__updateStrokeBounds(t){nh(t||this.__layout.strokeBounds,this.children,this.__hasMask?dh:ah)}__updateRenderBounds(t){nh(t||this.__layout.renderBounds,this.children,this.__hasMask?ch:hh)}__updateSortChildren(){let t;const{children:e}=this;if(e.length>1){for(let i=0,s=e.length;i<s;i++)e[i].__tempNumber=i,e[i].__.zIndex&&(t=!0);e.sort(rh),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return uh.warn("add self or destroyed");const i=s(e);if(!t.__){if(l(t))return t.forEach(t=>{this.add(t,e),i||e++});t=he.get(t.tag,t)}t.parent&&t.parent.remove(t),t.parent=this,i?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const n=t.__layout;n.boxChanged||n.boxChange(),n.matrixChanged||n.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(Mo.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Mo.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){this.add(t)}remove(t,e){t?t.__?t.animationOut?t.__runAnimation("out",()=>this.__remove(t,e)):this.__remove(t,e):this.find(t).forEach(t=>this.remove(t,e)):s(t)&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach(e=>{this.__realRemoveChild(e),t&&e.destroy()}))}clear(){this.removeAll(!0)}__remove(t,e){const i=this.children.indexOf(t);i>-1&&(this.children.splice(i,1),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||1)-1),this.__preRemove(),this.__realRemoveChild(t),e&&t.destroy())}__preRemove(){this.__hasMask&&this.__updateMask(),this.__hasEraser&&this.__updateEraser(),this.__layout.boxChange(),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}__realRemoveChild(t){t.__emitLifeEvent(Mo.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Mo.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new Mo(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}},t.Branch=ge([Xr(Oa)],t.Branch);class ph{get length(){return this.list.length}constructor(t){this.reset(),t&&(l(t)?this.addList(t):this.add(t))}has(t){return t&&!s(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return s(e)?-1:e}add(t){const{list:e,keys:i}=this;s(i[t.innerId])&&(e.push(t),i[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:i}=this;if(s(i[t.innerId])){const{list:s}=this;for(let t=e,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 n=0,r=e.length;n<r;n++)s(i)?e[n].innerId===t.innerId&&(i=n,delete this.keys[t.innerId]):this.keys[e[n].innerId]=n-1;s(i)||e.splice(i,1)}sort(t){const{list:e}=this;t?e.sort((t,e)=>e.__level-t.__level):e.sort((t,e)=>t.__level-e.__level)}forEach(t){this.list.forEach(t)}clone(){const t=new 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 gh{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(l(t)?this.addList(t):this.add(t))}has(t){return!s(this.keys[t.innerId])}without(t){return s(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap:i}=this;e[t.innerId]||(e[t.innerId]=1,i[t.__level]?i[t.__level].push(t):(i[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(i=>{e=this.levelMap[i];for(let i=0,s=e.length;i<s;i++)t(e[i])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}class _h extends Le{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=y.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i),this.clientBounds=this.bounds}}Xn(OffscreenCanvasRenderingContext2D.prototype),Xn(Path2D.prototype);const{mineType:fh}=Vn;function mh(t,e){y.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise((s,n)=>{t.convertToBlob({type:fh(e),quality:i}).then(t=>{var e=new FileReader;e.onload=t=>s(t.target.result),e.onerror=t=>n(t),e.readAsDataURL(t)}).catch(t=>{n(t)})}),canvasToBolb:(t,e,i)=>t.convertToBlob({type:fh(e),quality:i}),canvasSaveAs:(t,e,i)=>new Promise(t=>t()),download(t,e){},loadImage:t=>new Promise((e,i)=>{let s=new XMLHttpRequest;s.open("GET",y.image.getRealURL(t),!0),s.responseType="blob",s.onload=()=>{createImageBitmap(s.response).then(t=>{e(t)}).catch(t=>{i(t)})},s.onerror=t=>i(t),s.send()})},y.canvas=oe.canvas(),y.conicGradientSupport=!!y.canvas.context.createConicGradient}Object.assign(oe,{canvas:(t,e)=>new _h(t,e),image:t=>new sr(t)}),y.name="web",y.isWorker=!0,y.backgrounder=!0,y.requestRender=function(t){requestAnimationFrame(t)},nr(y,"devicePixelRatio",{get:()=>1});const{userAgent:yh}=navigator;yh.indexOf("Firefox")>-1?(y.conicGradientRotate90=!0,y.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(y.fullImageShadow=!0),yh.indexOf("Windows")>-1?(y.os="Windows",y.intWheelDeltaY=!0):yh.indexOf("Mac")>-1?y.os="Mac":yh.indexOf("Linux")>-1&&(y.os="Linux");class vh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){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=p.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(Go.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===Mo.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 Vo(Vo.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_([[Io.CHANGE,this.__onAttrChange,this],[[Mo.ADD,Mo.REMOVE],this.__onChildEvent,this],[Vo.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:xh,updateBounds:wh,updateChange:Eh}=no,{pushAllChildBranch:bh,pushAllParent:kh}=mo;const{worldBounds:Sh}=po;class Bh{constructor(t){this.updatedBounds=new Gt,this.beforeBounds=new Gt,this.afterBounds=new Gt,l(t)&&(t=new ph(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Sh)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Sh),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:Th,updateAllChange:Ph}=no,Lh=$t.get("Layouter");class Rh{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new gh,this.target=t,e&&(this.config=p.default(e,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(this.layouting||!this.running)return;const{target:t}=this;this.times=0;try{t.emit(jo.START),this.layoutOnce(),t.emitEvent(new jo(jo.END,this.layoutedBlocks,this.times))}catch(t){Lh.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Lh.warn("layouting"):this.times>3?Lh.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(Vo.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=ie.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:r,AFTER:o}=jo,a=this.getBlocks(s);a.forEach(t=>t.setBefore()),i.emitEvent(new jo(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?(xh(t,!0),e.add(t),t.isBranch&&bh(t,e),kh(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),kh(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||wh(s[t])}wh(i)}})}(this.__levelList),function(t){t.list.forEach(Eh)}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),i.emitEvent(new jo(r,a,this.times)),i.emitEvent(new jo(o,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,ie.end(e)}fullLayout(){const t=ie.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=jo,r=this.getBlocks(new ph(e));e.emitEvent(new jo(i,r,this.times)),Rh.fullLayout(e),r.forEach(t=>{t.setAfter()}),e.emitEvent(new jo(s,r,this.times)),e.emitEvent(new jo(n,r,this.times)),this.addBlocks(r),ie.end(t)}static fullLayout(t){Th(t,!0),t.isBranch?mo.updateBounds(t):no.updateBounds(t),Ph(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Bh([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Bh(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){this.__eventIds=[this.target.on_([[jo.REQUEST,this.layout,this],[jo.AGAIN,this.layoutAgain,this],[Vo.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Ch=$t.get("Renderer");class Oh{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,i&&(this.config=p.default(i,this.config)),this.__listenEvents()}start(){this.running=!0,this.update(!1)}stop(){this.running=!1}update(t=!0){this.changed||(this.changed=t),this.__requestRender()}requestLayout(){this.target.emit(jo.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(Go.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(Go.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(Go.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new Gt,Ch.log(e.innerName,"---\x3e");try{this.emitRender(Go.START),this.renderOnce(t),this.emitRender(Go.END,this.totalBounds),Qn.clearRecycled()}catch(t){this.rendering=!1,Ch.error(t)}Ch.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Ch.warn("rendering");if(this.times>3)return Ch.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Gt,this.renderOptions={},t)this.emitRender(Go.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(Go.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(Go.RENDER,this.renderBounds,this.renderOptions),this.emitRender(Go.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=ie.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new Gt(s);i.save(),s.spread(Oh.clipSpread).ceil(),i.clearWorld(s),i.clipWorld(s),this.__render(s,n),i.restore(),ie.end(e)}fullRender(){const t=ie.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),ie.end(t)}__render(t,e){const{canvas:i}=this,s=t.includes(this.target.__world),n=s?{includes:s}:{bounds:t,includes:s};this.needFill&&i.fillWorld(t,this.config.fill),$t.showRepaint&&$t.drawRepaint(i,t),y.render(this.target,i,n),this.renderBounds=e=e||t,this.renderOptions=n,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new Gt;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=this.target;if(this.requestTime||!t)return;if(t.parentApp)return t.parentApp.requestRender(!1);this.requestTime=this.frameTime||Date.now();const e=()=>{const t=1e3/((this.frameTime=Date.now())-this.requestTime),{maxFPS:i}=this.config;if(i&&t>i)return y.requestRender(e);const{frames:s}=this;s.length>30&&s.shift(),s.push(t),this.FPS=Math.round(s.reduce((t,e)=>t+e,0)/s.length),this.requestTime=0,this.checkRender()};y.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new Gt(0,0,e,i).includes(this.target.__world)||this.needFill||!t.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new Gt(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;t.updatedList&&t.updatedList.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||Ch.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,e,i){this.target.emitEvent(new Go(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[Go.REQUEST,this.update,this],[jo.END,this.__onLayoutEnd,this],[Go.AGAIN,this.renderAgain,this],[Xo.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}Oh.clipSpread=10;const{hitRadiusPoint:Mh}=Yt;class Dh{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||no.worldHittable(e))&&(this.hitChild(e,o),n.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&no.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,e[t].proxy),n.length)return n.list[0];return s?null:i?t[0]:t.find(t=>no.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;const{point:n}=this;for(let r=t.length-1;r>-1;r--)if(i=t[r],i.__.visible&&(!e||i.__.mask))if(s=!!i.__.hitRadius||Mh(i.__world,n),i.isBranch){if(s||i.__ignoreHitWorld){if(i.isBranchLeaf&&i.__.__clipAfterFill&&!i.__hitWorld(n))continue;i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,n)}}else s&&this.hitChild(i,n)}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask){let i,n=[];const{children:r}=s;for(let s=0,o=r.length;s<o;s++)if(i=r[s],i.__.mask&&n.push(i),i===t){if(n&&!n.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class Ih{constructor(t,e){this.config={},e&&(this.config=p.default(e,this.config)),this.picker=new Dh(this.target=t,this),this.finder=oe.finder&&oe.finder()}getByPoint(t,e,i){const{target:s,picker:n}=this;return y.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):re.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Ah(t){return ar(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Wh(t){return ar(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function Fh(){return(t,e)=>{const i="_"+e;nr(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(oe,{watcher:(t,e)=>new vh(t,e),layouter:(t,e)=>new Rh(t,e),renderer:(t,e,i)=>new Oh(t,e,i),selector:(t,e)=>new Ih(t,e)}),y.layout=Rh.fullLayout,y.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new ph,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const zh={},Uh={hasTransparent:function(t){if(!t||7===t.length||4===t.length)return!1;if("transparent"===t)return!0;const e=t[0];if("#"===e)switch(t.length){case 5:return"f"!==t[4]&&"F"!==t[4];case 9:return"f"!==t[7]&&"F"!==t[7]||"f"!==t[8]&&"F"!==t[8]}else if(("r"===e||"h"===e)&&"a"===t[3]){const e=t.lastIndexOf(",");if(e>-1)return parseFloat(t.slice(e+1))<1}return!1}},Hh={number:(t,e)=>d(t)?"percent"===t.type?t.value*e:t.value:t},Nh={},Yh={},Xh={},Vh={},jh={},Gh={apply(){re.need("filter")}},Kh={},Zh={setStyleName:()=>re.need("state"),set:()=>re.need("state")},qh={list:{},register(t,e){qh.list[t]=e},get:t=>qh.list[t]},{parse:Jh,objectToCanvasData:$h}=Qi,{stintSet:Qh}=p,{hasTransparent:tl}=Uh,el={originPaint:{}},il=$t.get("UIData");class sl extends _{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){return this.__getRealStrokeWidth()}get __maxStrokeWidth(){const t=this;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,t.strokeWidth):t.strokeWidth}get __hasMultiPaint(){const t=this;return t.fill&&this.__useStroke||t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return!this._width}get __autoHeight(){return!this._height}get __autoSide(){return!this._width||!this._height}get __autoSize(){return!this._width&&!this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,il.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,il.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),r(t)||!t?(Qh(this,"__isTransparentFill",tl(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):d(t)&&this.__setPaint("fill",t)}setStroke(t){r(t)||!t?(Qh(this,"__isTransparentStroke",tl(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):d(t)&&this.__setPaint("stroke",t)}setPath(t){const e=r(t);e||t&&d(t[0])?(this.__setInput("path",t),this._path=e?Jh(t):$h(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){nl(this,"shadow",t)}setInnerShadow(t){nl(this,"innerShadow",t)}setFilter(t){nl(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Yh.compute("fill",this.__leaf),e&&Yh.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),s(t.strokeWidthFixed)||(i=t.strokeWidthFixed)),i){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),l(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=el)):(this.__isStrokes=!0,this._stroke||(this._stroke=el))}__removePaint(t,e){e&&this.__removeInput(t),Xh.recycleImage(t,this),"fill"===t?(Qh(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(Qh(this,"__isAlphaPixelStroke",void 0),Qh(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function nl(t,e,i){t.__setInput(e,i),l(i)?(i.some(t=>!1===t.visible)&&(i=i.filter(t=>!1!==t.visible)),i.length||(i=void 0)):i=i&&!1!==i.visible?[i]:void 0,t["_"+e]=i}class rl extends sl{}class ol extends rl{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){return this.__single||this.__clipAfterFill}get __clipAfterFill(){const t=this;return"show"!==t.overflow&&t.__leaf.children.length&&(t.__leaf.isOverflow||super.__clipAfterFill)}}class al extends rl{__getInputData(t,e){const i=super.__getInputData(t,e);return Pe.forEach(t=>delete i[t]),i}}class hl extends ol{}class ll extends sl{get __usePathBox(){return this.points||this.__pathInputed}}class dl extends sl{get __boxStroke(){return!this.__pathInputed}}class cl extends sl{get __boxStroke(){return!this.__pathInputed}}class ul extends ll{}class pl extends sl{}class gl extends sl{get __pathInputed(){return 2}}class _l extends rl{}const fl={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class ml extends sl{get __useNaturalRatio(){return!1}setFontWeight(t){r(t)?(this.__setInput("fontWeight",t),t=fl[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=he.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}}class yl extends dl{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:"image",mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return t.url&&delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url&&delete i.fill,i}}class vl extends dl{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:xl,add:wl}=T,El={__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)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:n;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*n),r&&(t=xl(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=jh.getShadowRenderSpread(this,e)),s&&(t=xl(t,s)),r&&(t=wl(t,Gh.getSpread(r))),o&&(t=wl(t,o)),a&&(t=wl(t,a));let l=t;return i&&(l=xl(l,jh.getInnerShadowSpread(this,i))),n&&(l=xl(l,n)),this.__layout.renderShapeSpread=l,h?xl(h.__updateRenderSpread(),t):t}},{stintSet:bl}=p,kl={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);bl(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),bl(t,"__fillAfterStroke",e&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill)}if(t.__useEffect){const{shadow:e,fill:i,stroke:s}=t,n=t.innerShadow||t.blur||t.backgroundBlur||t.filter;bl(t,"__isFastShadow",e&&!n&&e.length<2&&!e[0].spread&&!jh.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(l(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!n)}t.__checkSingle(),bl(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){Sl(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=Yh.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&jh.shadow(this,t,h),a&&(s.__isStrokes?Yh.strokes(r,this,t,e):Yh.stroke(r,this,t,e)),n&&(s.__isFills?Yh.fills(n,this,t,e):Yh.fill(n,this,t,e)),o&&this.__drawAfterFill(t,e),d&&jh.innerShadow(this,t,h),r&&!a&&(s.__isStrokes?Yh.strokes(r,this,t,e):Yh.stroke(r,this,t,e)),c&&Gh.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?Yh.strokes(r,this,t,e):Yh.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,Uh.string(e.color))}n&&(s.__isFills?Yh.fills(n,this,t,e):Yh.fill(n,this,t,e)),h&&t.restore(),o&&this.__drawAfterFill(t,e),r&&!a&&(s.__isStrokes?Yh.strokes(r,this,t,e):Yh.stroke(r,this,t,e))}}else s.__pathInputed?Sl(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?Yh.fills(s,this,t,e):Yh.fill("#000000",this,t,e)),i.__isCanvas&&this.__drawAfterFill(t,e),n&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?Yh.strokes(n,this,t,e):Yh.stroke("#000000",this,t,e))},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(this),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function Sl(t,e,i){const{fill:s,stroke:n,__drawAfterFill:r,__fillAfterStroke:o}=t.__;t.__drawRenderPath(e),o&&Yh.stroke(n,t,e,i),s&&Yh.fill(s,t,e,i),r&&t.__drawAfterFill(e,i),n&&!o&&Yh.stroke(n,t,e,i)}const Bl={__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 Tl,Pl;t.UI=Tl=class extends t.Leaf{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){W.assignScale(this,t)}get scale(){return this.__.scale}get isAutoWidth(){const t=this.__;return t.__autoWidth||t.autoWidth}get isAutoHeight(){const t=this.__;return t.__autoHeight||t.autoHeight}get pen(){const{path:t}=this.__;return Nn.set(this.path=t||[]),t||this.__drawPathByBox(Nn),Nn}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return r(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return re.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return re.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(Nn.set(i=[]),this.__drawPathByBox(Nn)),t?Qi.toCanvasData(i,!0):i}getPathString(t,e,i){return Qi.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||Kh.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?Un.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&Nh.addArrows(this)):t.__pathForRender&&(t.__pathForRender=void 0)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){e?tn.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:i,width:s,height:n}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:r}=this.__;t.roundRect(e,i,s,n,a(r)?[r]:r)}else t.rect(e,i,s,n)}drawImagePlaceholder(t,e,i){Yh.fill(this.__.placeholderColor,this,e,i)}animate(t,e,i,s){return this.set(t),re.need("animate")}killAnimate(t,e){}export(t,e){return re.need("export")}syncExport(t,e){return re.need("export")}clone(t){const e=p.clone(this.toJSON());return t&&Object.assign(e,t),Tl.one(e)}static one(t,e,i,s,n){return he.get(t.tag||this.prototype.__tag,t,e,i,s,n)}static registerUI(){Vr()(this)}static registerData(t){Ar(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}},ge([Ar(sl)],t.UI.prototype,"__",void 0),ge([Fh()],t.UI.prototype,"zoomLayer",void 0),ge([dr("")],t.UI.prototype,"id",void 0),ge([dr("")],t.UI.prototype,"name",void 0),ge([dr("")],t.UI.prototype,"className",void 0),ge([Sr("pass-through")],t.UI.prototype,"blendMode",void 0),ge([Tr(1)],t.UI.prototype,"opacity",void 0),ge([Pr(!0)],t.UI.prototype,"visible",void 0),ge([Sr(!1)],t.UI.prototype,"locked",void 0),ge([Br(!1)],t.UI.prototype,"dim",void 0),ge([Br(!1)],t.UI.prototype,"dimskip",void 0),ge([Cr(0)],t.UI.prototype,"zIndex",void 0),ge([Or(!1)],t.UI.prototype,"mask",void 0),ge([Mr(!1)],t.UI.prototype,"eraser",void 0),ge([cr(0,!0)],t.UI.prototype,"x",void 0),ge([cr(0,!0)],t.UI.prototype,"y",void 0),ge([fr(100,!0)],t.UI.prototype,"width",void 0),ge([fr(100,!0)],t.UI.prototype,"height",void 0),ge([gr(1,!0)],t.UI.prototype,"scaleX",void 0),ge([gr(1,!0)],t.UI.prototype,"scaleY",void 0),ge([_r(0,!0)],t.UI.prototype,"rotation",void 0),ge([_r(0,!0)],t.UI.prototype,"skewX",void 0),ge([_r(0,!0)],t.UI.prototype,"skewY",void 0),ge([cr(0,!0)],t.UI.prototype,"offsetX",void 0),ge([cr(0,!0)],t.UI.prototype,"offsetY",void 0),ge([ur(0,!0)],t.UI.prototype,"scrollX",void 0),ge([ur(0,!0)],t.UI.prototype,"scrollY",void 0),ge([pr()],t.UI.prototype,"origin",void 0),ge([pr()],t.UI.prototype,"around",void 0),ge([dr(!1)],t.UI.prototype,"lazy",void 0),ge([mr(1)],t.UI.prototype,"pixelRatio",void 0),ge([kr(0)],t.UI.prototype,"renderSpread",void 0),ge([vr()],t.UI.prototype,"path",void 0),ge([xr()],t.UI.prototype,"windingRule",void 0),ge([xr(!0)],t.UI.prototype,"closed",void 0),ge([fr(0)],t.UI.prototype,"padding",void 0),ge([fr(!1)],t.UI.prototype,"lockRatio",void 0),ge([fr()],t.UI.prototype,"widthRange",void 0),ge([fr()],t.UI.prototype,"heightRange",void 0),ge([dr(!1)],t.UI.prototype,"draggable",void 0),ge([dr()],t.UI.prototype,"dragBounds",void 0),ge([dr("auto")],t.UI.prototype,"dragBoundsType",void 0),ge([dr(!1)],t.UI.prototype,"editable",void 0),ge([Dr(!0)],t.UI.prototype,"hittable",void 0),ge([Dr("path")],t.UI.prototype,"hitFill",void 0),ge([br("path")],t.UI.prototype,"hitStroke",void 0),ge([Dr(!1)],t.UI.prototype,"hitBox",void 0),ge([Dr(!0)],t.UI.prototype,"hitChildren",void 0),ge([Dr(!0)],t.UI.prototype,"hitSelf",void 0),ge([Dr()],t.UI.prototype,"hitRadius",void 0),ge([Ir("")],t.UI.prototype,"cursor",void 0),ge([Sr()],t.UI.prototype,"fill",void 0),ge([br(void 0,!0)],t.UI.prototype,"stroke",void 0),ge([br("inside")],t.UI.prototype,"strokeAlign",void 0),ge([br(1,!0)],t.UI.prototype,"strokeWidth",void 0),ge([br(!1)],t.UI.prototype,"strokeWidthFixed",void 0),ge([br("none")],t.UI.prototype,"strokeCap",void 0),ge([br("miter")],t.UI.prototype,"strokeJoin",void 0),ge([br()],t.UI.prototype,"dashPattern",void 0),ge([br(0)],t.UI.prototype,"dashOffset",void 0),ge([br(10)],t.UI.prototype,"miterLimit",void 0),ge([xr(0)],t.UI.prototype,"cornerRadius",void 0),ge([xr()],t.UI.prototype,"cornerSmoothing",void 0),ge([Ah()],t.UI.prototype,"shadow",void 0),ge([Ah()],t.UI.prototype,"innerShadow",void 0),ge([Ah()],t.UI.prototype,"blur",void 0),ge([Ah()],t.UI.prototype,"backgroundBlur",void 0),ge([Ah()],t.UI.prototype,"grayscale",void 0),ge([Ah()],t.UI.prototype,"filter",void 0),ge([Sr()],t.UI.prototype,"placeholderColor",void 0),ge([dr(100)],t.UI.prototype,"placeholderDelay",void 0),ge([dr({})],t.UI.prototype,"data",void 0),ge([Hr(t.Leaf.prototype.reset)],t.UI.prototype,"reset",null),t.UI=Tl=ge([Xr(El),Xr(kl),Nr()],t.UI),t.Group=class extends t.UI{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return this.childlessJSON||(e.children=this.children.map(e=>e.toJSON(t))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}},ge([Ar(rl)],t.Group.prototype,"__",void 0),ge([fr(0)],t.Group.prototype,"width",void 0),ge([fr(0)],t.Group.prototype,"height",void 0),t.Group=ge([Xr(t.Branch),Vr()],t.Group);const Ll=$t.get("Leafer");t.Leafer=Pl=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&&Jn.isComplete}get layoutLocked(){return!this.layouter.running}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||{x:0,y:0,width:0,height:0}}constructor(t,e){super(e),this.config={start:!0,hittable:!0,smooth:!0,lazySpeard:100},this.leafs=0,this.__eventIds=[],this.__controllers=[],this.__readyWait=[],this.__viewReadyWait=[],this.__viewCompletedWait=[],this.__nextRenderWait=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t),Pl.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,p.assign(s,t));const n=this.canvas=oe.canvas(s);this.__controllers.push(this.renderer=oe.renderer(this,n,s),this.watcher=oe.watcher(this,s),this.layouter=oe.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),this.view=n.view,e||(this.selector=oe.selector(this),this.interaction=oe.interaction(this,n,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=oe.hitCanvasManager()),this.canvasManager=new pe,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))),wo.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(Ko.RESTART):this.emitLeafer(Ko.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(Ko.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=p.copyAttrs({},t,Pe);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new Gt(t):this.canvas.bounds),this.viewReady&&(e?i.render():i.update()))}requestRender(t=!1){this.renderer&&this.renderer.update(t)}updateCursor(t){const e=this.interaction;e&&(t?e.setCursor(t):e.updateCursor())}updateLazyBounds(){this.lazyBounds=this.canvas.bounds.clone().spread(this.config.lazySpeard)}__doResize(t){const{canvas:e}=this;if(!e||e.isSameSize(t))return;const i=p.copyAttrs({},this.canvas,Pe);e.resize(t),this.updateLazyBounds(),this.__onResize(new Xo(t,i))}__onResize(t){this.emitEvent(t),p.copyAttrs(this.__,t,Pe),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&&(Pe.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(Ko.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&Pe.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,n=p.copyAttrs({},s,Pe);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(Ko.BEFORE_READY),this.emitLeafer(Ko.READY),this.emitLeafer(Ko.AFTER_READY),wo.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(Ko.VIEW_READY),wo.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){wo.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(Ko.VIEW_COMPLETED),wo.run(this.__viewCompletedWait),this.viewCompleted=!0)})}__onWatchData(){this.watcher.childrenChanged&&this.interaction&&this.nextRender(()=>this.interaction.updateCursor())}waitInit(t,e){e&&(t=t.bind(e)),this.__initWait||(this.__initWait=[]),this.canvas?t():this.__initWait.push(t)}waitReady(t,e){e&&(t=t.bind(e)),this.ready?t():this.__readyWait.push(t)}waitViewReady(t,e){e&&(t=t.bind(e)),this.viewReady?t():this.__viewReadyWait.push(t)}waitViewCompleted(t,e){e&&(t=t.bind(e)),this.__viewCompletedWait.push(t),this.viewCompleted?this.__checkViewCompleted(!1):this.running||this.start()}nextRender(t,e,i){e&&(t=t.bind(e));const s=this.__nextRenderWait;if(i){for(let e=0;e<s.length;e++)if(s[e]===t){s.splice(e,1);break}}else s.push(t);this.requestRender()}zoom(t,e,i,s){return re.need("view")}getValidMove(t,e,i){return{x:t,y:e}}getValidScale(t){return t}getWorldPointByClient(t,e){return this.interaction&&this.interaction.getLocal(t,e)}getPagePointByClient(t,e){return this.getPagePoint(this.getWorldPointByClient(t,e))}getClientPointByWorld(t){const{x:e,y:i}=this.clientBounds;return{x:e+t.x,y:i+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(t){this.emitEvent(new Ko(t,this))}__listenEvents(){const t=ie.start("FirstCreate "+this.innerName);this.once([[Ko.START,()=>ie.end(t)],[jo.START,this.updateLazyBounds,this],[Go.START,this.__onCreated,this],[Go.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[Vo.DATA,this.__onWatchData,this],[jo.END,this.__onLayoutEnd,this],[Go.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Pl.list.remove(this);try{this.stop(),this.emitLeafer(Ko.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{Qn.clearRecycled()},100)}catch(t){Ll.error(t)}}};t?e():setTimeout(e)}},t.Leafer.list=new ph,ge([Ar(al)],t.Leafer.prototype,"__",void 0),ge([fr()],t.Leafer.prototype,"pixelRatio",void 0),ge([dr("normal")],t.Leafer.prototype,"mode",void 0),t.Leafer=Pl=ge([Vr()],t.Leafer),t.Rect=class extends t.UI{get __tag(){return"Rect"}},ge([Ar(dl)],t.Rect.prototype,"__",void 0),t.Rect=ge([Xr(Bl),Nr(),Vr()],t.Rect);const{add:Rl,includes:Cl,scroll:Ol}=Yt,Ml=t.Rect.prototype,Dl=t.Group.prototype;t.Box=class extends t.Group{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const i=this.__,s=this.__layout,{renderBounds: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"))&&(Rl(a,r),Ol(a,i)),this.__updateRectRenderBounds(),t=!Cl(r,a),t&&"show"===o&&Rl(n,a)}else this.__updateRectRenderBounds();p.stintSet(this,"isOverflow",t),this.__checkScroll(e)}__updateRectRenderBounds(){}__checkScroll(t){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e)),this.hasScroller&&this.scroller.__render(t,e)}__drawContent(t,e){this.__renderGroup(t,e),(this.__.__useStroke||this.__.__useEffect)&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}},ge([Ar(ol)],t.Box.prototype,"__",void 0),ge([fr(100)],t.Box.prototype,"width",void 0),ge([fr(100)],t.Box.prototype,"height",void 0),ge([dr(!1)],t.Box.prototype,"resizeChildren",void 0),ge([kr("show")],t.Box.prototype,"overflow",void 0),ge([Hr(Ml.__updateStrokeSpread)],t.Box.prototype,"__updateStrokeSpread",null),ge([Hr(Ml.__updateRenderSpread)],t.Box.prototype,"__updateRectRenderSpread",null),ge([Hr(Ml.__updateBoxBounds)],t.Box.prototype,"__updateRectBoxBounds",null),ge([Hr(Ml.__updateStrokeBounds)],t.Box.prototype,"__updateStrokeBounds",null),ge([Hr(Ml.__updateRenderBounds)],t.Box.prototype,"__updateRectRenderBounds",null),ge([Hr(Ml.__updateChange)],t.Box.prototype,"__updateRectChange",null),ge([Hr(Ml.__render)],t.Box.prototype,"__renderRect",null),ge([Hr(Dl.__render)],t.Box.prototype,"__renderGroup",null),t.Box=ge([Nr(),Vr()],t.Box),t.Frame=class extends t.Box{get __tag(){return"Frame"}get isFrame(){return!0}},ge([Ar(hl)],t.Frame.prototype,"__",void 0),ge([Sr("#FFFFFF")],t.Frame.prototype,"fill",void 0),ge([kr("hide")],t.Frame.prototype,"overflow",void 0),t.Frame=ge([Vr()],t.Frame);const{moveTo:Il,closePath:Al,ellipse:Wl}=Es;t.Ellipse=class extends t.UI{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:e,innerRadius:i,startAngle:s,endAngle:n}=this.__,r=t/2,o=e/2,a=this.__.path=[];i?(s||n?(i<1&&Wl(a,r,o,r*i,o*i,0,s,n,!1),Wl(a,r,o,r,o,0,n,s,!0),i<1&&Al(a)):(i<1&&(Wl(a,r,o,r*i,o*i),Il(a,t,o)),Wl(a,r,o,r,o,0,360,0,!0)),y.ellipseToCurve&&(this.__.path=this.getPath(!0))):s||n?(Il(a,r,o),Wl(a,r,o,r,o,0,s,n,!1),Al(a)):Wl(a,r,o,r,o)}},ge([Ar(cl)],t.Ellipse.prototype,"__",void 0),ge([xr(0)],t.Ellipse.prototype,"innerRadius",void 0),ge([xr(0)],t.Ellipse.prototype,"startAngle",void 0),ge([xr(0)],t.Ellipse.prototype,"endAngle",void 0),t.Ellipse=ge([Vr()],t.Ellipse);const{sin:Fl,cos:zl,PI:Ul}=Math,{moveTo:Hl,lineTo:Nl,closePath:Yl,drawPoints:Xl}=Es;t.Polygon=class extends t.UI{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)Xl(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:n}=t,r=i/2,o=s/2;Hl(e,r,0);for(let t=1;t<n;t++)Nl(e,r+r*Fl(2*t*Ul/n),o-o*zl(2*t*Ul/n));Yl(e)}}},ge([Ar(ul)],t.Polygon.prototype,"__",void 0),ge([xr(3)],t.Polygon.prototype,"sides",void 0),ge([xr()],t.Polygon.prototype,"points",void 0),ge([xr(0)],t.Polygon.prototype,"curve",void 0),t.Polygon=ge([Nr(),Vr()],t.Polygon);const{sin:Vl,cos:jl,PI:Gl}=Math,{moveTo:Kl,lineTo:Zl,closePath:ql}=Es;t.Star=class extends t.UI{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,n=t/2,r=e/2,o=this.__.path=[];Kl(o,n,0);for(let t=1;t<2*i;t++)Zl(o,n+(t%2==0?n:n*s)*Vl(t*Gl/i),r-(t%2==0?r:r*s)*jl(t*Gl/i));ql(o)}},ge([Ar(pl)],t.Star.prototype,"__",void 0),ge([xr(5)],t.Star.prototype,"corners",void 0),ge([xr(.382)],t.Star.prototype,"innerRadius",void 0),t.Star=ge([Vr()],t.Star);const{moveTo:Jl,lineTo:$l,drawPoints:Ql}=Es,{rotate:td,getAngle:ed,getDistance:id,defaultPoint:sd}=lt;t.Line=class extends t.UI{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&td(i,e),i}set toPoint(t){this.width=id(sd,t),this.rotation=ed(sd,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?Ql(e,t.points,t.curve,t.closed):(Jl(e,0,0),$l(e,this.width,0))}},ge([Ar(ll)],t.Line.prototype,"__",void 0),ge([wr("center")],t.Line.prototype,"strokeAlign",void 0),ge([fr(0)],t.Line.prototype,"height",void 0),ge([xr()],t.Line.prototype,"points",void 0),ge([xr(0)],t.Line.prototype,"curve",void 0),ge([xr(!1)],t.Line.prototype,"closed",void 0),t.Line=ge([Vr()],t.Line),t.Image=class extends t.Rect{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return l(t)&&t[0].image}},ge([Ar(yl)],t.Image.prototype,"__",void 0),ge([fr("")],t.Image.prototype,"url",void 0),t.Image=ge([Vr()],t.Image);const nd=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=oe.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new sr({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new Wo(Wo.LOADED,{image:t}))})}draw(t,e,i,s){const n=new ft(t.worldTransform).invert(),r=new ft;e&&r.translate(e.x,e.y),i&&(a(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()}},ge([Ar(vl)],t.Canvas.prototype,"__",void 0),ge([Wh(100)],t.Canvas.prototype,"width",void 0),ge([Wh(100)],t.Canvas.prototype,"height",void 0),ge([Wh(1)],t.Canvas.prototype,"pixelRatio",void 0),ge([Wh(!0)],t.Canvas.prototype,"smooth",void 0),ge([dr(!1)],t.Canvas.prototype,"safeResize",void 0),ge([Wh()],t.Canvas.prototype,"contextSettings",void 0),t.Canvas=ge([Vr()],t.Canvas);const{copyAndSpread:rd,includes:od,spread:ad,setList:hd}=Yt,{stintSet:ld}=p;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=Hh.number(e,n),t.__letterSpacing=Hh.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"}`,ld(t,"__padding",l&&W.fourNumber(l)),ld(t,"__clipText","show"!==h&&!t.__autoSize),ld(t,"__isCharMode",d||c||t.__letterSpacing||"none"!==a),t.__textDrawData=zh.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&&ad(a,i/2),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),p.stintSet(this,"isOverflow",!od(h,a)),this.isOverflow?(hd(t.__textBoxBounds={},[h,a]),e.renderChanged=!0):t.__textBoxBounds=h}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;rd(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__updateChange(){super.__updateChange();const t=this.__box;t&&(t.__onUpdateSize(),t.__updateChange())}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!e.exporting||super.__draw(t,e,i)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}},ge([Ar(ml)],t.Text.prototype,"__",void 0),ge([fr(0)],t.Text.prototype,"width",void 0),ge([fr(0)],t.Text.prototype,"height",void 0),ge([Sr()],t.Text.prototype,"boxStyle",void 0),ge([dr(!1)],t.Text.prototype,"resizeFontSize",void 0),ge([Sr("#000000")],t.Text.prototype,"fill",void 0),ge([wr("outside")],t.Text.prototype,"strokeAlign",void 0),ge([Dr("all")],t.Text.prototype,"hitFill",void 0),ge([fr("")],t.Text.prototype,"text",void 0),ge([fr("")],t.Text.prototype,"placeholder",void 0),ge([fr("caption")],t.Text.prototype,"fontFamily",void 0),ge([fr(12)],t.Text.prototype,"fontSize",void 0),ge([fr("normal")],t.Text.prototype,"fontWeight",void 0),ge([fr(!1)],t.Text.prototype,"italic",void 0),ge([fr("none")],t.Text.prototype,"textCase",void 0),ge([fr("none")],t.Text.prototype,"textDecoration",void 0),ge([fr(0)],t.Text.prototype,"letterSpacing",void 0),ge([fr({type:"percent",value:1.5})],t.Text.prototype,"lineHeight",void 0),ge([fr(0)],t.Text.prototype,"paraIndent",void 0),ge([fr(0)],t.Text.prototype,"paraSpacing",void 0),ge([fr("x")],t.Text.prototype,"writingMode",void 0),ge([fr("left")],t.Text.prototype,"textAlign",void 0),ge([fr("top")],t.Text.prototype,"verticalAlign",void 0),ge([fr(!0)],t.Text.prototype,"autoSizeAlign",void 0),ge([fr("normal")],t.Text.prototype,"textWrap",void 0),ge([fr("show")],t.Text.prototype,"textOverflow",void 0),ge([Sr(!1)],t.Text.prototype,"textEditing",void 0),t.Text=ge([Vr()],t.Text),t.Path=class extends t.UI{get __tag(){return"Path"}},ge([Ar(gl)],t.Path.prototype,"__",void 0),ge([wr("center")],t.Path.prototype,"strokeAlign",void 0),t.Path=ge([Vr()],t.Path),t.Pen=class extends t.Group{get __tag(){return"Pen"}setStyle(e){const i=this.pathElement=new t.Path(e);return this.pathStyle=e,this.__path=i.path||(i.path=[]),this.add(i),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,n,r){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,n){return this}ellipse(t,e,i,s,n,r,o,a){return this}arc(t,e,i,s,n,r){return this}arcTo(t,e,i,s,n){return this}drawEllipse(t,e,i,s,n,r,o,a){return this}drawArc(t,e,i,s,n,r){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}},ge([Ar(_l)],t.Pen.prototype,"__",void 0),ge([(t,e)=>{nr(t,e,{get(){return this.__path}})}],t.Pen.prototype,"path",void 0),t.Pen=ge([Xr(zs,["set","path","paint"]),Vr()],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&&oe.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),s(e)||(t.canvas.childIndex=e),this.__listenChildEvents(t)}forEach(t){this.children.forEach(t)}__onCreated(){this.created=this.children.every(t=>t.created)}__onReady(){this.children.every(t=>t.ready)&&super.__onReady()}__onViewReady(){this.children.every(t=>t.viewReady)&&super.__onViewReady()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){t.context&&this.forEach(i=>e.matrix?i.__render(t,e):t.copyWorld(i.canvas,e.bounds))}__onResize(t){this.forEach(e=>e.resize(t)),super.__onResize(t)}updateLayout(){this.forEach(t=>t.updateLayout())}__getChildConfig(t){const e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&p.assign(e,t),this.autoLayout&&p.copyAttrs(e,this,Pe),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[jo.END,this.__onReady,this],[Go.START,this.__onCreated,this],[Go.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(Go.END,this.__onChildRenderEnd,this))}},t.App=ge([Vr()],t.App);const dd={},cd={isHoldSpaceKey:()=>cd.isHold("Space"),isHold:t=>dd[t],isHoldKeys:(t,e)=>e?t(e):void 0,setDownCode(t){dd[t]||(dd[t]=!0)},setUpCode(t){dd[t]=!1}},ud={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 pd extends Oo{get spaceKey(){return cd.isHoldSpaceKey()}get left(){return ud.left(this)}get right(){return ud.right(this)}get middle(){return ud.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return cd.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){ce.changeName(t,e)}}const{min:gd,max:_d,abs:fd}=Math,{float:md,sign:yd}=W,{minX:vd,maxX:xd,minY:wd,maxY:Ed}=Yt,bd=new Gt,kd=new Gt,Sd={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&Bd.getValidMove(t.__localBoxBounds,Bd.getDragBounds(t),s,e,!0),Bd.axisMove(t,e)},limitScaleOf(t,e,i,s){const{dragBounds:n,dragBoundsType:r}=t;n&&Bd.getValidScaleOf(t.__localBoxBounds,Bd.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&&t[s]>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)),Bd.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),Bd.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,a){a||(n=Object.assign({},n)),kd.set(e),bd.set(t).scaleOf(s,n.x,n.y);const h=(s.x-t.x)/t.width,l=1-h,d=(s.y-t.y)/t.height,c=1-d;let u,p,g,_,f=1,m=1;return Bd.isInnerMode(t,e,i,"width")?(n.x<0&&bd.scaleOf(s,f=1/n.x,1),g=md(bd.minX-kd.minX),_=md(kd.maxX-bd.maxX),u=h&&g>0?1+g/(h*bd.width):1,p=l&&_>0?1+_/(l*bd.width):1,f*=_d(u,p)):(n.x<0&&((md(vd(t)-vd(e))<=0||md(xd(e)-xd(t))<=0)&&bd.scaleOf(s,f=1/n.x,1),bd.unsign()),g=md(kd.minX-bd.minX),_=md(bd.maxX-kd.maxX),u=h&&g>0?1-g/(h*bd.width):1,p=l&&_>0?1-_/(l*bd.width):1,f*=gd(u,p)),Bd.isInnerMode(t,e,i,"height")?(n.y<0&&bd.scaleOf(s,1,m=1/n.y),g=md(bd.minY-kd.minY),_=md(kd.maxY-bd.maxY),u=d&&g>0?1+g/(d*bd.height):1,p=c&&_>0?1+_/(c*bd.height):1,m*=_d(u,p),r&&(u=_d(fd(f),fd(m)),f=yd(f)*u,m=yd(m)*u)):(n.y<0&&((md(wd(t)-wd(e))<=0||md(Ed(e)-Ed(t))<=0)&&bd.scaleOf(s,1,m=1/n.y),bd.unsign()),g=md(kd.minY-bd.minY),_=md(bd.maxY-kd.maxY),u=d&&g>0?1-g/(d*bd.height):1,p=c&&_>0?1-_/(c*bd.height):1,m*=gd(u,p)),n.x*=o(f)?f:1,n.y*=o(m)?m:1,n}},Bd=Sd;t.PointerEvent=class extends pd{},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=ge([jr()],t.PointerEvent);const Td=t.PointerEvent,Pd={};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),Sd.axisMove(t,n),n}static limitMove(t,e){Sd.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(Pd,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(Pd,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(Pd,null,!0)}getPageTotal(){return this.getPageMove(!0)}getInnerTotal(t){return this.getInnerMove(t,!0)}getLocalTotal(t){return this.getLocalMove(t,!0)}getPageBounds(){const t=this.getPageTotal(),e=this.getPagePoint(),i={};return Yt.set(i,e.x-t.x,e.y-t.y,t.x,t.y),Yt.unsign(i),i}assignMove(t){Pd.x=t?this.totalX:this.moveX,Pd.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=ge([jr()],t.DragEvent);const Ld=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=ge([jr()],t.DropEvent),t.MoveEvent=class extends t.DragEvent{},t.MoveEvent.BEFORE_MOVE="move.before_move",t.MoveEvent.START="move.start",t.MoveEvent.MOVE="move",t.MoveEvent.END="move.end",t.MoveEvent=ge([jr()],t.MoveEvent),t.TouchEvent=class extends pd{},t.TouchEvent=ge([jr()],t.TouchEvent);const Rd=t.TouchEvent;t.RotateEvent=class extends t.PointerEvent{},t.RotateEvent.BEFORE_ROTATE="rotate.before_rotate",t.RotateEvent.START="rotate.start",t.RotateEvent.ROTATE="rotate",t.RotateEvent.END="rotate.end",t.RotateEvent=ge([jr()],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=ge([jr()],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=ge([jr()],t.ZoomEvent),t.KeyEvent=class extends pd{},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=ge([jr()],t.KeyEvent);const Cd={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:Od.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,buttons:s(t.buttons)?1:0===t.buttons?e:t.buttons,origin:t}},pathHasEventType(t,e){const{list:i}=t;for(let t=0,s=i.length;t<s;t++)if(i[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const i=new 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=>no.draggable(e)||!e.isLeafer&&e.hasEvent(t.DragEvent.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},Od=Cd,Md=new ph,{getDragEventData:Dd,getDropEventData:Id,getSwipeEventData:Ad}=Cd;class Wd{constructor(t){this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=Dd(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||Md;return this.dragging&&(n?e?Md: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&&ud.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],no.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=Dd(n,s,e),o&&(this.dragData.throughPath=o),this.dragData.path=r,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:o}=this.dragData,{dragLimitAnimate:h}=i.p,l=!h||!!e;n.forEach(i=>{if(i.draggable){const n=r(i.draggable),d=t.DragEvent.getValidMove(i,this.dragStartPoints[i.innerId],{x:s,y:o},l||n);h&&!n&&e?no.animateMove(i,d,a(h)?h:.3):i.move(d)}})}}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,e){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t,e)||this.dragEndReal(t))}dragEndReal(e){const{interaction:i,downData:s,dragData:n}=this;e||(e=n);const{path:r,throughPath:o}=s,a=Dd(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=Ad(e,i,s);this.interaction.emit(t.type,t)}}drop(e,i,s){const n=Id(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}checkDragEndAnimate(t,e){return!1}animate(t,e){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const Fd=$t.get("emit");const zd=["move","zoom","rotate","key"];function Ud(t,e,i,s,n){if(zd.some(t=>e.startsWith(t))&&t.__.hitChildren&&!Nd(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&&Hd(r,e,i,s,n)}}function Hd(t,e,i,s,n){if(t.destroyed)return!1;if(t.__.hitSelf&&!Nd(t,n)&&(Zh.updateEventStyle&&!s&&Zh.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const n=ce.get(e,i);if(t.emitEvent(n,s),n.isStop)return!0}return!1}function Nd(t,e){return e&&e.has(t)}const Yd={wheel:{zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:{x:20,y:8}},pointer:{type:"pointer",snap:!0,hitRadius:5,tapTime:120,longPressTime:800,transformTime:500,hover:!0,dragHover:!0,dragDistance:2,swipeDistance:20},touch:{preventDefault:"auto"},multiTouch:{},move:{autoDistance:2},zoom:{},cursor:!0,keyEvent:!0},{pathHasEventType:Xd,pathCanDrag:Vd,pathHasOutside:jd}=Cd;class Gd{get dragging(){return this.dragger.dragging}get transforming(){return this.transformer.transforming}get moveMode(){return!0===this.m.drag||this.isHoldSpaceKey||this.isHoldMiddleKey||this.isHoldRightKey&&this.dragger.moving||this.isDragEmpty}get canHover(){return this.p.hover&&!this.config.mobile}get isDragEmpty(){return this.m.dragEmpty&&this.isRootPath(this.hoverData)&&(!this.downData||this.isRootPath(this.downData))}get isMobileDragEmpty(){return this.m.dragEmpty&&!this.canHover&&this.downData&&this.isTreePath(this.downData)}get isHoldMiddleKey(){return this.m.holdMiddleKey&&this.downData&&ud.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&ud.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&cd.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=p.clone(Yd),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new ph(t),this.createTransformer(),this.dragger=new Wd(this),s&&(this.config=p.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(e,i){e||(e=this.hoverData),e&&(ud.defaultLeft(e),this.updateDownData(e),this.checkPath(e,i),this.downTime=Date.now(),this.emit(t.PointerEvent.BEFORE_DOWN,e),this.emit(t.PointerEvent.DOWN,e),ud.left(e)&&(this.tapWait(),this.longPressWait(e)),this.waitRightTap=ud.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&&ud.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;ud.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,cd.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,cd.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=>Xd(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;y.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&&!jd(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!Vd(t.path))&&!jd(t.path)}isDrag(t){return this.dragger.getList().has(t)}isPress(t){return this.downData&&this.downData.path.has(t)}isHover(t){return this.enterPath&&this.enterPath.has(t)}isFocus(t){return this.focusData===t}cancelHover(){const{hoverData:t}=this;t&&(t.path=this.defaultPath,this.pointerHover(t))}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(e){e||(e=this.hoverData),e&&(this.findPath(e,{exclude:this.dragger.getList(!1,!0),name:t.PointerEvent.MOVE}),this.hoverData=e)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let t=0,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&&lt.round(s),s}emitTap(e){this.emit(t.PointerEvent.TAP,e),this.emit(t.PointerEvent.CLICK,e)}emitDoubleTap(e){this.emit(t.PointerEvent.DOUBLE_TAP,e),this.emit(t.PointerEvent.DOUBLE_CLICK,e)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){this.waitTap&&(clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0)}longPressWait(e){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout(()=>{this.longPressed=!0,this.emit(t.PointerEvent.LONG_PRESS,e)},this.p.longPressTime)}longTap(e){let i;return this.longPressed&&(this.emit(t.PointerEvent.LONG_TAP,e),(Xd(e.path,t.PointerEvent.LONG_TAP)||Xd(e.path,t.PointerEvent.LONG_PRESS))&&(i=!0)),this.longPressWaitCancel(),i}longPressWaitCancel(){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressed=!1)}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new Gt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(a(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(Xo.RESIZE,this.__onResize,this)],t.once(Ko.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],Hd(n,t,e,!0,s))return;n.isApp&&Ud(n,t,e,!0,s)}for(let r=0,o=i.length;r<o;r++)if(n=i.list[r],n.isApp&&Ud(n,t,e,!1,s),Hd(n,t,e,!1,s))return}catch(t){Fd.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 Kd{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}Kd.custom={};class Zd extends pe{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new ph,this.pixelList=new ph}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),oe.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),oe.hitCanvas()}clearImageType(){this.__clearLeafList(this.pixelList)}clearPathType(){this.__clearLeafList(this.pathList)}__clearLeafList(t){t.length&&(t.forEach(t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)}),t.reset())}__autoClear(){this.pathList.length+this.pixelList.length>this.maxTotal&&this.clear()}clear(){this.clearPathType(),this.clearImageType()}}y.getSelector=function(t){return t.leafer?t.leafer.selector:y.selector||(y.selector=oe.selector())};const{toInnerRadiusPointOf:qd,copy:Jd,setRadius:$d}=lt,{hitRadiusPoint:Qd,hitPoint:tc}=Yt,ec={},ic={},sc=t.Leaf.prototype;sc.hit=function(t,e=0){this.updateLayout(),Jd(ic,t),$d(ic,e);const i=this.__world;return!!(e?Qd(i,ic):tc(i,ic))&&(this.isBranch?y.getSelector(this).hitPoint(Object.assign({},ic),e,{target:this}):this.__hitWorld(ic))},sc.__hitWorld=function(t){const e=this.__;if(!e.hitSelf)return!1;const i=this.__world,s=this.__layout,n=i.width<10&&i.height<10;if(e.hitRadius&&(Jd(ec,t),$d(t=ec,e.hitRadius)),qd(t,i,ec),e.hitBox||n){if(Yt.hitRadiusPoint(s.boxBounds,ec))return!0;if(n)return!1}return!s.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),s.boundsChanged||(s.hitCanvasChanged=!1)),this.__hit(ec)},sc.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},sc.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},sc.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},sc.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const nc=new ft,rc=t.UI.prototype;rc.__updateHitCanvas=function(){this.__box&&this.__box.__updateHitCanvas();const{hitCanvasManager:t}=this.leafer||this.parent&&this.parent.leafer||{};if(!t)return;const e=this.__,i=(e.__isAlphaPixelFill||e.__isCanvas)&&"pixel"===e.hitFill,s=e.__isAlphaPixelStroke&&"pixel"===e.hitStroke,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=y.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(),Qn.patternLocked=!0,this.__renderShape(r,{matrix:nc.setWith(this.__world).scaleWith(1/o).invertWith().translate(-a,-h),ignoreFill:!i,ignoreStroke:!s}),Qn.patternLocked=!1,r.resetTransform(),e.__isHitPixel=!0}else e.__isHitPixel&&(e.__isHitPixel=!1);this.__drawHitPath(r),r.setStrokeOptions(e)},rc.__hit=function(t){if(this.__box&&this.__box.__hit(t))return!0;const e=this.__;if(e.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:i}=e,s=(e.fill||e.__isCanvas)&&("path"===i||"pixel"===i&&!(e.__isAlphaPixelFill||e.__isCanvas))||"all"===i;if(s&&this.__hitFill(t))return!0;const{hitStroke:n,__maxStrokeWidth:r}=e,o=e.stroke&&("path"===n||"pixel"===n&&!e.__isAlphaPixelStroke)||"all"===n;if(!s&&!o)return!1;const a=2*t.radiusX;let h=a;if(o)switch(e.strokeAlign){case"inside":if(h+=2*r,!s&&this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a;break;case"center":h+=r;break;case"outside":if(h+=2*r,!s){if(!this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a}}return!!h&&this.__hitStroke(t,h)};const oc=t.UI.prototype,ac=t.Rect.prototype,hc=t.Box.prototype;ac.__updateHitCanvas=hc.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?oc.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},ac.__hitFill=hc.__hitFill=function(t){return this.__hitCanvas?oc.__hitFill.call(this,t):Yt.hitRadiusPoint(this.__layout.boxBounds,t)},t.Text.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:n,__textDrawData:r}=this.__;t.beginPath(),n<0?this.__drawPathByBox(t):r.rows.forEach(n=>t.rect(n.x,n.y-s,n.width,e<i?i:e))},t.Group.prototype.pick=function(t,e){return e||(e=i),this.updateLayout(),y.getSelector(this).getByPoint(t,e.hitRadius||0,Object.assign(Object.assign({},e),{target:this}))};const lc=Le.prototype;function dc(t,e,i){t.__.__font?Yh.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function cc(t,e,i,s,n){const r=i.__;d(t)?Yh.drawStrokesStyle(t,e,!1,i,s,n):(s.setStroke(t,r.__strokeWidth*e,r),s.stroke()),r.__useArrow&&Yh.strokeArrow(t,i,s,n)}function uc(t,e,i,s,n){const r=i.__;d(t)?Yh.drawStrokesStyle(t,e,!0,i,s,n):(s.setStroke(t,r.__strokeWidth*e,r),Yh.drawTextStroke(i,s,n))}function pc(t,e,i,s,n){const r=s.getSameCanvas(!0,!0);r.font=i.__.__font,uc(t,2,i,r,n),r.blendMode="outside"===e?"destination-out":"destination-in",Yh.fillText(i,r,n),r.blendMode="normal",no.copyCanvasByWorld(i,s,r),r.recycle(i.__nowWorld)}lc.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},lc.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},lc.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{getSpread:gc,copyAndSpread:_c,toOuterOf:fc,getOuterOf:mc,getByMove:yc,move:vc,getIntersectData:xc}=Yt,wc={};let Ec;const{stintSet:bc}=p,{hasTransparent:kc}=Uh;function Sc(t,e,i){if(!d(e)||!1===e.visible||0===e.opacity)return;let n;const{boxBounds:o}=i.__layout;switch(e.type){case"image":n=Xh.image(i,t,e,o,!Ec||!Ec[e.url]);break;case"linear":n=Vh.linearGradient(e,o);break;case"radial":n=Vh.radialGradient(e,o);break;case"angular":n=Vh.conicGradient(e,o);break;case"solid":const{type:r,color:a,opacity:h}=e;n={type:r,style:Uh.string(a,h)};break;default:s(e.r)||(n={type:"solid",style:Uh.string(e)})}if(n&&(n.originPaint=e,r(n.style)&&kc(n.style)&&(n.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;n.strokeStyle=e.style}return n}const Bc={compute:function(t,e){const i=e.__,s=[];let n,r,o,a=i.__input[t];l(a)||(a=[a]),Ec=Xh.recycleImage(t,i);for(let i,n=0,r=a.length;n<r;n++)(i=Sc(t,a[n],e))&&(s.push(i),i.strokeStyle&&(o||(o=1),i.strokeStyle.strokeWidth&&(o=Math.max(o,i.strokeStyle.strokeWidth))));i["_"+t]=s.length?s:void 0,s.length?(s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(n=!0),r=!0),"fill"===t?(bc(i,"__isAlphaPixelFill",n),bc(i,"__isTransparentFill",r)):(bc(i,"__isAlphaPixelStroke",n),bc(i,"__isTransparentStroke",r),bc(i,"__hasMultiStrokeStyle",o))):i.__removePaint(t,!1)},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,Xh.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);(!0===r.scaleFixed||"zoom-in"===r.scaleFixed&&t>1&&s>1)&&i.scale(1/t,1/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){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)Yh.strokeText(t,e,i,s);else switch(n.strokeAlign){case"center":cc(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),cc(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)cc(t,2,e,i,s);else{const{renderBounds:r}=e.__layout,o=i.getSameCanvas(!0,!0);e.__drawRenderPath(o),cc(t,2,e,o,s),o.clipUI(n),o.clearWorld(r),no.copyCanvasByWorld(e,i,o),o.recycle(e.__nowWorld)}}(t,e,i,s)}},strokes:function(t,e,i,s){Yh.stroke(t,e,i,s)},strokeText:function(t,e,i,s){switch(e.__.strokeAlign){case"center":uc(t,1,e,i,s);break;case"inside":pc(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?uc(t,2,e,i,s):pc(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||!Xh.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?Yh.drawTextStroke(s,n,r):n.stroke(),n.restoreBlendMode()):i?Yh.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;fc(o.strokeSpread?(_c(wc,o.boxBounds,o.strokeSpread),wc):o.boxBounds,r,a);let{scaleX:g,scaleY:_}=t.getRenderScaleData(!0);if(n.includes(a))p=s,h=u=a,l=r;else{let s;if(y.fullImageShadow)s=a;else{const t=o.renderShapeSpread?gc(n,T.swapAndScale(o.renderShapeSpread,g,_)):n;s=xc(t,a)}c=n.getFitMatrix(s);let{a:f,d:m}=c;c.a<1&&(p=e.getSameCanvas(),t.__renderShape(p,i),g*=f,_*=m),u=mc(a,c),h=yc(u,-c.e,-c.f),l=mc(r,c),vc(l,-c.e,-c.f);const v=i.matrix;v?(d=new ft(c),d.multiply(v),f*=v.scaleX,m*=v.scaleY):d=c,d.withScale(f,m),i=Object.assign(Object.assign({},i),{matrix:d})}return t.__renderShape(s,i),{canvas:s,matrix:d,fitMatrix:c,bounds:h,renderBounds:l,worldCanvas:p,shapeBounds:u,scaleX:g,scaleY:_}}};let Tc,Pc=new Gt;const{isSame:Lc}=Yt;function Rc(t,e,i,s,n,r){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=s.width/e.pixelRatio,e.__naturalHeight=s.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return n.data||Xh.createData(n,s,i,r),!0}function Cc(t,e){Dc(t,Wo.LOAD,e)}function Oc(t,e){Dc(t,Wo.LOADED,e)}function Mc(t,e,i){e.error=i,t.forceUpdate("surface"),Dc(t,Wo.ERROR,e)}function Dc(t,e,i){t.hasEvent(e)&&t.emitEvent(new Wo(e,i))}function Ic(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:Ac,translate:Wc}=$,Fc=new Gt,zc={},Uc={};function Hc(t,e,i,s){const n=r(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&n<0?0:n}let Nc={},Yc={a:1,b:0,c:0,d:1,e:0,f:0};const{get:Xc,set:Vc,rotateOfOuter:jc,translate:Gc,scaleOfOuter:Kc,multiplyParent:Zc,scale:qc,rotate:Jc,skew:$c}=$;function Qc(t,e,i,s,n,r,o,a){o&&Jc(t,o),a&&$c(t,a.x,a.y),n&&qc(t,n,r),Gc(t,e.x+i,e.y+s)}const{get:tu,scale:eu,copy:iu}=$,{getFloorScale:su}=W,{abs:nu}=Math;const ru={image:function(t,e,i,s,n){let r,o;const a=Qn.get(i);return Tc&&i===Tc.paint&&Lc(s,Tc.boxBounds)?r=Tc.leafPaint:(r={type:i.type,image:a},a.hasAlphaPixel&&(r.isTransparent=!0),Tc=a.use>1?{leafPaint:r,paint:i,boxBounds:Pc.set(s)}:null),(n||a.loading)&&(o={image:a,attrName:e,attrValue:i}),a.ready?(Rc(t,e,i,a,r,s),n&&(Cc(t,o),Oc(t,o))):a.error?n&&Mc(t,o,a.error):(n&&(Ic(t,!0),Cc(t,o)),r.loadId=a.load(()=>{Ic(t,!1),t.destroyed||(Rc(t,e,i,a,r,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Oc(t,o)),r.loadId=void 0},e=>{Ic(t,!1),Mc(t,o,e),r.loadId=void 0}),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}=Xh.getImageRenderScaleData(t,i,s,n),{image:a,data:h,originPaint:l}=t,{exporting:d}=n;return!(!h||t.patternId===r+"-"+o&&!d)&&(e&&(h.repeat?e=!1:l.changeful||"miniapp"===y.name&&Xo.isResizing(i)||d||(e=y.image.isLarge(a,r,o))),e?(i.__.__isFastShadow&&(s.fillStyle=t.style||"#000",s.fill()),Xh.drawImage(t,r,o,i,s,n),!0):(!t.style||l.sync||d?Xh.createPattern(t,i,s,n):Xh.createPatternTask(t,i,s,n),!1))},drawImage:function(t,e,i,s,n,r){const{data:o,image:a}=t,{blendMode:h}=t.originPaint,{opacity:l,transform:d}=o,c=a.getFull(o.filters),u=s.__;let p,{width:g,height:_}=a;(p=d&&!d.onlyScale||u.path||u.cornerRadius)||l||h?(n.save(),p&&n.clipUI(s),h&&(n.blendMode=h),l&&(n.opacity*=l),d&&n.transform(d),n.drawImage(c,0,0,g,_),n.restore()):(o.scaleX&&(g*=o.scaleX,_*=o.scaleY),n.drawImage(c,0,0,g,_))},getImageRenderScaleData:function(t,e,i,s){const n=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:r}=t;if(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(l(i)){let s,n,r,o,a;for(let h=0,d=i.length;h<d;h++)s=i[h],n=s.image,a=n&&n.url,a&&(r||(r={}),r[a]=!0,Qn.recycle(n),n.loading&&(o||(o=e.__input&&e.__input[t]||[],l(o)||(o=[o])),n.unload(i[h].loadId,!o.some(t=>t.url===a))));return r}return null},createPatternTask:function(t,e,i,s){t.patternTask||(t.patternTask=Qn.patternTasker.add(()=>_e(this,void 0,void 0,function*(){t.patternTask=null,i.bounds.hit(e.__nowWorld)&&Xh.createPattern(t,e,i,s),e.forceUpdate("surface")}),300))},createPattern:function(t,e,i,s){let{scaleX:n,scaleY:r}=Xh.getImageRenderScaleData(t,e,i,s),o=n+"-"+r;if(t.patternId!==o&&!e.destroyed&&(!y.image.isLarge(t.image,n,r)||t.data.repeat)){const{image:i,data:s}=t,{transform:a,gap:h}=s,l=Xh.getPatternFixScale(t,n,r);let d,c,u,{width:p,height:g}=i;l&&(n*=l,r*=l),p*=n,g*=r,h&&(c=h.x*n/nu(s.scaleX||1),u=h.y*r/nu(s.scaleY||1)),(a||1!==n||1!==r)&&(n*=su(p+(c||0)),r*=su(g+(u||0)),d=tu(),a&&iu(d,a),eu(d,1/n,1/r));const _=i.getCanvas(p,g,s.opacity,s.filters,c,u,e.leafer&&e.leafer.config.smooth),f=i.getPattern(_,s.repeat||y.origin.noRepeat||"no-repeat",d,t);t.style=f,t.patternId=o}},getPatternFixScale:function(t,e,i){const{image:s}=t;let n,r=y.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=Xh.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=Fc.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:s,height:n}=i,{opacity:o,mode:a,align:h,offset:l,scale:c,size:u,rotation:p,skew:g,clipSize:_,repeat:f,gap:m,filters:y}=t,v=e.width===s&&e.height===n,x={mode:a},w="center"!==h&&(p||0)%180==90;let E,b;switch(Yt.set(Uc,0,0,w?n:s,w?s:n),a&&"cover"!==a&&"fit"!==a?((c||u)&&(W.getScaleData(c,u,i,zc),E=zc.scaleX,b=zc.scaleY),(h||m||f)&&(E&&Yt.scale(Uc,E,b,!0),h&&Bt.toPoint(h,Uc,e,Uc,!0,!0))):v&&!p||(E=b=Yt.getFitScale(e,Uc,"fit"!==a),Yt.put(e,i,h,E,!1,Uc),Yt.scale(Uc,E,b,!0)),l&&lt.move(Uc,l),a){case"stretch":v?E&&(E=b=void 0):(E=e.width/s,b=e.height/n,Xh.stretchMode(x,e,E,b));break;case"normal":case"clip":if(Uc.x||Uc.y||E||_||p||g){let t,i;_&&(t=e.width/_.width,i=e.height/_.height),Xh.clipMode(x,e,Uc.x,Uc.y,E,b,p,g,t,i),t&&(E=E?E*t:t,b=b?b*i:i)}break;case"repeat":(!v||E||p||g)&&Xh.repeatMode(x,e,s,n,Uc.x,Uc.y,E,b,p,g,h,t.freeTransform),f||(x.repeat="repeat");const i=d(f);(m||i)&&(x.gap=function(t,e,i,s,n){let r,o;d(t)?(r=t.x,o=t.y):r=o=t;return{x:Hc(r,i,n.width,e&&e.x),y:Hc(o,s,n.height,e&&e.y)}}(m,i&&f,Uc.width,Uc.height,e));break;default:E&&Xh.fillOrFitMode(x,e,Uc.x,Uc.y,E,b,p)}return x.transform||(e.x||e.y)&&Wc(x.transform=Ac(),e.x,e.y),E&&(x.scaleX=E,x.scaleY=b),o&&o<1&&(x.opacity=o),y&&(x.filters=y),f&&(x.repeat=r(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),x},stretchMode:function(t,e,i,s){const n=Xc(),{x:r,y:o}=e;r||o?Gc(n,r,o):n.onlyScale=!0,qc(n,i,s),t.transform=n},fillOrFitMode:function(t,e,i,s,n,r,o){const a=Xc();Gc(a,e.x+i,e.y+s),qc(a,n,r),o&&jc(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=Xc();Qc(d,e,i,s,n,r,o,a),h&&(o||a?(Vc(Yc),Kc(Yc,e,h,l),Zc(d,Yc)):Kc(d,e,h,l)),t.transform=d},repeatMode:function(t,e,i,s,n,r,o,a,h,l,d,c){const u=Xc();if(c)Qc(u,e,n,r,o,a,h,l);else{if(h)if("center"===d)jc(u,{x:i/2,y:s/2},h);else switch(Jc(u,h),h){case 90:Gc(u,s,0);break;case 180:Gc(u,i,s);break;case 270:Gc(u,0,i)}Nc.x=e.x+n,Nc.y=e.y+r,Gc(u,Nc.x,Nc.y),o&&Kc(u,Nc,o,a)}t.transform=u}},{toPoint:ou}=bt,{hasTransparent:au}=Uh,hu={},lu={};function du(t,e,i,s){if(i){let n,o,a,h;for(let t=0,l=i.length;t<l;t++)n=i[t],r(n)?(a=t/(l-1),o=Uh.string(n,s)):(a=n.offset,o=Uh.string(n.color,s)),e.addColorStop(a,o),!h&&au(o)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:cu,getDistance:uu}=lt,{get:pu,rotateOfOuter:gu,scaleOfOuter:_u}=$,{toPoint:fu}=bt,mu={},yu={};function vu(t,e,i,s,n){let r;const{width:o,height:a}=t;if(o!==a||s){const t=cu(e,i);r=pu(),n?(_u(r,e,o/a*(s||1),1),gu(r,e,t+90)):(_u(r,e,1,o/a*(s||1)),gu(r,e,t))}return r}const{getDistance:xu}=lt,{toPoint:wu}=bt,Eu={},bu={};const ku={linearGradient:function(t,e){let{from:i,to:s,type:n,opacity:r}=t;ou(i||"top",e,hu),ou(s||"bottom",e,lu);const o=y.canvas.createLinearGradient(hu.x,hu.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;fu(i||"center",e,mu),fu(s||"bottom",e,yu);const a=y.canvas.createRadialGradient(mu.x,mu.y,0,mu.x,mu.y,uu(mu,yu)),h={type:n,style:a};du(h,a,t.stops,r);const l=vu(e,mu,yu,o,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:i,to:s,type:n,opacity:r,stretch:o}=t;wu(i||"center",e,Eu),wu(s||"bottom",e,bu);const a=y.conicGradientSupport?y.canvas.createConicGradient(0,Eu.x,Eu.y):y.canvas.createRadialGradient(Eu.x,Eu.y,0,Eu.x,Eu.y,xu(Eu,bu)),h={type:n,style:a};du(h,a,t.stops,r);const l=vu(e,Eu,bu,o||1,y.conicGradientRotate90);return l&&(h.transform=l),h},getTransform:vu},{copy:Su,move:Bu,toOffsetOutBounds:Tu}=Yt,{max:Pu,abs:Lu}=Math,Ru={},Cu=new ft,Ou={};function Mu(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=Lu(t.spread||0),o=Pu(o,n+r-s),a=Pu(a,n+r+i),h=Pu(h,n+r+s),l=Pu(l,n+r-i)}),o===a&&a===h&&h===l?o:[o,a,h,l]}function Du(t,e,i){const{shapeBounds:s}=i;let n,r;y.fullImageShadow?(Su(Ru,t.bounds),Bu(Ru,e.x-s.x,e.y-s.y),n=t.bounds,r=Ru):(n=s,r=e),t.copyWorld(i.canvas,n,r)}const{toOffsetOutBounds:Iu}=Yt,Au={};const Wu=Mu;const Fu={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(),g=o.length-1;Tu(h,Ou,l),o.forEach((o,_)=>{let f=1;if(o.scaleFixed){const t=Math.abs(r.scaleX);t>1&&(f=1/t)}p.setWorldShadow(Ou.offsetX+(o.x||0)*c*f,Ou.offsetY+(o.y||0)*u*f,(o.blur||0)*c*f,Uh.string(o.color)),n=jh.getShadowTransform(t,p,i,o,Ou,f),n&&p.setTransform(n),Du(p,Ou,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")),no.copyCanvasByWorld(t,e,p,s,o.blendMode),g&&_<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(),g=o.length-1;Iu(h,Au,l),o.forEach((o,_)=>{let f=1;if(o.scaleFixed){const t=Math.abs(r.scaleX);t>1&&(f=1/t)}p.save(),p.setWorldShadow(Au.offsetX+(o.x||0)*c*f,Au.offsetY+(o.y||0)*u*f,(o.blur||0)*c*f),n=jh.getShadowTransform(t,p,i,o,Au,f,!0),n&&p.setTransform(n),Du(p,Au,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,Uh.string(o.color),"source-in"),no.copyCanvasByWorld(t,e,p,s,o.blendMode),g&&_<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:Mu,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 Cu.set().scaleOfOuter({x:(n.x+n.width/2)*e.pixelRatio,y:(n.y+n.height/2)*e.pixelRatio},1+i/a,1+i/h),Cu}},isTransformShadow(t){},getInnerShadowSpread:Wu},{excludeRenderBounds:zu}=po;let Uu;function Hu(t,e,i,s,n,r,o,a){switch(e){case"grayscale":Uu||(Uu=!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);Yu(t,e,i,1,n,r)}(t,i,s,n,o,a);break;case"opacity-path":Yu(t,i,s,r,o,a);break;case"path":a&&i.restore()}}function Nu(t){return t.getSameCanvas(!1,!0)}function Yu(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&&(Hu(this,o,t,n,s,r,void 0,!0),s=n=null),"clipping"!==a&&"clipping-path"!==a||zu(i,e)||i.__render(t,e),r=i.__.opacity,Uu=!1,"path"===a||"clipping-path"===a?(r<1?(o="opacity-path",n||(n=Nu(t))):(o="path",t.save()),i.__clip(n||t,e)):(o="grayscale"===a?"grayscale":"alpha",s||(s=Nu(t)),n||(n=Nu(t)),i.__render(s,e));continue}const d=1===r&&i.__.__blendMode;d&&Hu(this,o,t,n,s,r,void 0,!1),zu(i,e)||i.__render(n||t,e),d&&Hu(this,o,t,n,s,r,d,!1)}Hu(this,o,t,n,s,r,void 0,!0)};const Xu=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Vu=Xu+"_#~&*+\\=|≮≯≈≠=…",ju=new RegExp([[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[196608,201551],[201552,205743],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12736,12783],[12800,13055],[13056,13311],[63744,64255],[65072,65103],[127488,127743],[194560,195103]].map(([t,e])=>`[\\u${t.toString(16)}-\\u${e.toString(16)}]`).join("|"));function Gu(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const Ku=Gu("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Zu=Gu("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),qu=Gu(Xu),Ju=Gu(Vu),$u=Gu("- —/~|┆·");var Qu;!function(t){t[t.Letter=0]="Letter",t[t.Single=1]="Single",t[t.Before=2]="Before",t[t.After=3]="After",t[t.Symbol=4]="Symbol",t[t.Break=5]="Break"}(Qu||(Qu={}));const{Letter:tp,Single:ep,Before:ip,After:sp,Symbol:np,Break:rp}=Qu;function op(t){return Ku[t]?tp:$u[t]?rp:Zu[t]?ip:qu[t]?sp:Ju[t]?np:ju.test(t)?ep:tp}const ap={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 hp(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}=ap,{Letter:dp,Single:cp,Before:up,After:pp,Symbol:gp,Break:_p}=Qu;let fp,mp,yp,vp,xp,wp,Ep,bp,kp,Sp,Bp,Tp,Pp,Lp,Rp,Cp,Op,Mp=[];function Dp(t,e){kp&&!bp&&(bp=kp),fp.data.push({char:t,width:e}),yp+=e}function Ip(){vp+=yp,fp.width=yp,mp.words.push(fp),fp={data:[]},yp=0}function Ap(){Lp&&(Rp.paraNumber++,mp.paraStart=!0,Lp=!1),kp&&(mp.startCharSize=bp,mp.endCharSize=kp,bp=0),mp.width=vp,Cp.width?lp(mp):Op&&Wp(),Mp.push(mp),mp={words:[]},vp=0}function Wp(){vp>(Rp.maxWidth||0)&&(Rp.maxWidth=vp)}const{top:Fp,right:zp,bottom:Up,left:Hp}=t.Direction4;function Np(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 Yp={getDrawData:function(t,e){r(t)||(t=String(t));let i=0,s=0,n=e.__getInput("width")||0,o=e.__getInput("height")||0;const{__padding:a}=e;a&&(n?(i=a[Hp],n-=a[zp]+a[Hp],!n&&(n=.01)):e.autoSizeAlign||(i=a[Hp]),o?(s=a[Fp],o-=a[Fp]+a[Up],!o&&(o=.01)):e.autoSizeAlign||(s=a[Fp]));const h={bounds:{x:i,y:s,width:n,height:o},rows:[],paraNumber:0,font:y.canvas.font=e.__font};return function(t,e,i){Rp=t,Mp=t.rows,Cp=t.bounds,Op=!Cp.width&&!i.autoSizeAlign;const{__letterSpacing:s,paraIndent:n,textCase:r}=i,{canvas:o}=y,{width:a}=Cp;if(i.__isCharMode){const t="none"!==i.textWrap,h="break"===i.textWrap;Lp=!0,Bp=null,bp=Ep=kp=yp=vp=0,fp={data:[]},mp={words:[]},s&&(e=[...e]);for(let i=0,l=e.length;i<l;i++)wp=e[i],"\n"===wp?(yp&&Ip(),mp.paraEnd=!0,Ap(),Lp=!0):(Sp=op(wp),Sp===dp&&"none"!==r&&(wp=hp(wp,r,!yp)),Ep=o.measureText(wp).width,s&&(s<0&&(kp=Ep),Ep+=s),Tp=Sp===cp&&(Bp===cp||Bp===dp)||Bp===cp&&Sp!==pp,Pp=!(Sp!==up&&Sp!==cp||Bp!==gp&&Bp!==pp),xp=Lp&&n?a-n:a,t&&a&&vp+yp+Ep>xp&&(h?(yp&&Ip(),vp&&Ap()):(Pp||(Pp=Sp===dp&&Bp==pp),Tp||Pp||Sp===_p||Sp===up||Sp===cp||yp+Ep>xp?(yp&&Ip(),vp&&Ap()):vp&&Ap()))," "===wp&&!0!==Lp&&vp+yp===0||(Sp===_p?(" "===wp&&yp&&Ip(),Dp(wp,Ep),Ip()):Tp||Pp?(yp&&Ip(),Dp(wp,Ep)):Dp(wp,Ep)),Bp=Sp);yp&&Ip(),vp&&Ap(),Mp.length>0&&(Mp[Mp.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{Rp.paraNumber++,vp=o.measureText(t).width,Mp.push({x:n||0,text:t,width:vp,paraStart:!0}),Op&&Wp()})}(h,t,e),a&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":Np(e,"x",t[Hp]);break;case"right":Np(e,"x",-t[zp])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":Np(e,"y",t[Fp]);break;case"bottom":Np(e,"y",-t[Up])}}(a,h,e,n,o),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:g,width:_,height:f}=s,m=r*n+(c?c*(t.paraNumber-1):0),y=o;if(h&&m>f)m=Math.max(f,r),n>1&&(t.overflow=n);else if(f||u)switch(d){case"middle":g+=(f-m)/2;break;case"bottom":g+=f-m}y+=g;let v,x,w,E=_||u?_:t.maxWidth;for(let o=0,d=n;o<d;o++){if(v=i[o],v.x=p,v.width<_||v.width>_&&!h)switch(l){case"center":v.x+=(E-v.width)/2;break;case"right":v.x+=E-v.width}v.paraStart&&c&&o>0&&(y+=c),v.y=y,y+=r,t.overflow>o&&y>m&&(v.isOverflow=!0,t.overflow=o+1),x=v.x,w=v.width,a<0&&(v.width<0?(w=-v.width+e.fontSize+a,x-=w,w+=e.fontSize):w-=a),x<s.x&&(s.x=x),w>s.width&&(s.width=w),h&&_&&_<w&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=g,s.height=m}(h,e),e.__isCharMode&&function(t,e,i){const{rows:s}=t,{textAlign:n,paraIndent:r,letterSpacing:o}=e,a=i&&n.includes("both"),h=a||i&&n.includes("justify"),l=h&&n.includes("letter");let d,c,u,p,g,_,f,m,y,v;s.forEach(t=>{t.words&&(g=r&&t.paraStart?r:0,m=t.words.length,h&&(v=!t.paraEnd||a,c=i-t.width-g,l?p=c/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=m>1?c/(m-1):0),_=o||t.isOverflow||l?0:u?1:2,t.isOverflow&&!o&&(t.textMode=!0),2===_?(t.x+=g,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=g,d=t.x,t.data=[],t.words.forEach((e,i)=>{1===_?(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&&(y=i===m-1,u?y||(d+=u,t.width+=u):p&&(t.width+=p*(e.data.length-(y?1:0))))})),t.words=null)})}(h,e,n),h.overflow&&function(t,e,i,s){if(!s)return;const{rows:n,overflow:r}=t;let{textOverflow:o}=e;if(n.splice(r),o&&"show"!==o){let t,a;"hide"===o?o="":"ellipsis"===o&&(o="...");const h=o?y.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)}})}}(h,e,i,n),"none"!==e.textDecoration&&function(t,e){let i,s=0;const{fontSize:n,textDecoration:r}=e;switch(t.decorationHeight=n/11,d(r)?(i=r.type,r.color&&(t.decorationColor=Uh.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]}}(h,e),h}};const Xp={string:function(t,e){if(!t)return"#000";const i=a(e)&&e<1;if(r(t)){if(!i||!Uh.object)return t;t=Uh.object(t)}let n=s(t.a)?1:t.a;i&&(n*=e);const o=t.r+","+t.g+","+t.b;return 1===n?"rgb("+o+")":"rgba("+o+","+n+")"}};function Vp(t){return t?l(t)?t:[t]:[]}Object.assign(zh,Yp),Object.assign(Uh,Xp),Object.assign(Yh,Bc),Object.assign(Xh,ru),Object.assign(Vh,ku),Object.assign(jh,Fu),Object.assign(oe,{interaction:(t,e,i,s)=>new Gd(t,e,i,s),hitCanvas:(t,e)=>new _h(t,e),hitCanvasManager:()=>new Zd}),mh();class jp extends Oo{get list(){return Vp(this.value)}get oldList(){return Vp(this.oldValue)}constructor(t,e){super(t),e&&Object.assign(this,e)}}function Gp(t){return(e,i)=>{const s="_"+i;nr(e,i,{get(){return this[s]},set(e){const n=this[s];if(n!==e){const r=this;if(r.config){const t="target"===i;if(t){const{beforeSelect:t}=r.config;if(t){const i=t({target:e});if(d(i))e=i;else if(!1===i)return}r.setDimOthers(!1),r.setBright(!1),l(e)&&e.length>1&&e[0].locked&&e.splice(0,1),r.single&&(delete r.element.syncEventer,delete r.element.__world.ignorePixelSnap)}const s=t?jp.BEFORE_SELECT:jp.BEFORE_HOVER;this.hasEvent(s)&&this.emitEvent(new jp(s,{editor:r,value:e,oldValue:n}))}this[s]=e,t(this,n)}}})}}jp.BEFORE_SELECT="editor.before_select",jp.SELECT="editor.select",jp.AFTER_SELECT="editor.after_select",jp.BEFORE_HOVER="editor.before_hover",jp.HOVER="editor.hover";const{abs:Kp}=Math,{copy:Zp,scale:qp}=$,{setListWithFn:Jp}=Yt,{worldBounds:$p}=po,Qp={a:1,b:0,c:0,d:1,e:0,f:0},tg={x:0,y:0,width:0,height:0};class eg extends t.UI{constructor(){super(),this.list=[],this.visible=0,this.hittable=!1,this.strokeAlign="center"}setTarget(t,e){e&&this.set(e),this.target=t,this.update()}update(t){const{list:e}=this;e.length?(Jp(tg,e,$p),t&&this.set(t),this.set(tg),this.visible=!0):this.visible=0}__draw(t,e){const{list:i}=this;if(i.length){let s;const n=this.__,{stroke:o,strokeWidth:a,fill:h}=n,{bounds:l}=e;for(let d=0;d<i.length;d++){s=i[d];const{worldTransform:c,worldRenderBounds:u}=s;if(u.width&&u.height&&(!l||l.hit(u,e.matrix))){const i=Kp(c.scaleX),l=Kp(c.scaleY);if(Zp(Qp,c),Qp.half=a%2,i!==l){qp(Qp,1/i,1/l),t.setWorld(Qp,e.matrix),t.beginPath(),n.strokeWidth=a;const{x:r,y:o,width:h,height:d}=s.__layout.boxBounds;t.rect(r*i,o*l,h*i,d*l)}else t.setWorld(Qp,e.matrix),t.beginPath(),s.__.__useArrow?s.__drawPath(t):s.__.__pathForRender?s.__drawRenderPath(t):s.__drawPathByBox(t),n.strokeWidth=a/Kp(c.scaleX);o&&(r(o)?Yh.stroke(o,this,t,e):Yh.strokes(o,this,t,e)),h&&(r(h)?Yh.fill(h,this,t,e):Yh.fills(h,this,t,e))}}n.strokeWidth=a}}destroy(){this.target=null,super.destroy()}}ge([Gp(function(t){const e=t.target;t.list=e?l(e)?e:[e]:[]})],eg.prototype,"target",void 0);class ig extends t.Group{constructor(e){super(e),this.strokeArea=new t.Rect({strokeAlign:"center"}),this.fillArea=new t.Rect,this.visible=0,this.hittable=!1,this.addMany(this.fillArea,this.strokeArea)}setStyle(t,e){const{visible:i,stroke:s,strokeWidth:n}=t;this.visible=i,this.strokeArea.reset(Object.assign({stroke:s,strokeWidth:n},e||{})),this.fillArea.reset({visible:!e,fill:s,opacity:.2})}setBounds(t){this.strokeArea.set(t),this.fillArea.set(t)}}const sg={findOne:t=>t.list.find(t=>t.editable),findByBounds(t,e){const i=[];return ng([t],i,e),i}};function ng(t,e,i){let s,n;for(let r=0,o=t.length;r<o;r++)if(s=t[r],n=s.__,n.hittable&&n.visible&&!n.locked&&i.hit(s.__world)){if(n.editable){if(s.isBranch&&!n.hitChildren){n.hitSelf&&e.push(s);continue}if(s.isFrame){if(i.includes(s.__layout.boxBounds,s.__world)){e.push(s);continue}}else i.hit(s.__layout.boxBounds,s.__world)&&n.hitSelf&&e.push(s)}s.isBranch&&ng(s.children,e,i)}}const{findOne:rg,findByBounds:og}=sg;class ag extends t.Group{get dragging(){return!!this.originList}get running(){const{editor:t,app:e}=this;return this.hittable&&t.visible&&t.hittable&&t.mergeConfig.selector&&e&&"normal"===e.mode}get isMoveMode(){const{app:t}=this;return t&&t.interaction.moveMode}constructor(t){super(),this.hoverStroker=new eg,this.targetStroker=new eg,this.bounds=new Gt,this.selectArea=new ig,this.__eventIds=[],this.editor=t,this.addMany(this.targetStroker,this.hoverStroker,this.selectArea),this.__listenEvents()}onHover(){const{editor:t}=this;if(!this.running||this.dragging||t.dragging)this.hoverStroker.target=null;else{const{hoverTarget:e,mergeConfig:i}=t,s=Object.assign({},i);e&&e.editConfig&&Object.assign(s,e.editConfig);const{stroke:n,strokeWidth:r,hover:o,hoverStyle:a}=s;this.hoverStroker.setTarget(o?e:null,Object.assign({stroke:n,strokeWidth:r},a||{}))}}onSelect(){this.running&&(this.targetStroker.setTarget(this.editor.list),this.hoverStroker.target=null)}update(){this.hoverStroker.update();const{stroke:t,strokeWidth:e,selectedStyle:i}=this.editor.mergedConfig;this.targetStroker.update(Object.assign({stroke:t,strokeWidth:e&&Math.max(1,e/2)},i||{}))}onPointerMove(t){const{app:e,editor:i}=this;if(this.running&&!this.isMoveMode&&e.interaction.canHover&&!e.interaction.dragging){const e=this.findUI(t);i.hoverTarget=i.hasItem(e)?null:e}this.isMoveMode&&(i.hoverTarget=null)}onBeforeDown(t){if(t.multiTouch)return;const{select:e}=this.editor.mergeConfig;"press"===e&&(this.app.config.mobile?this.waitSelect=()=>this.checkAndSelect(t):this.checkAndSelect(t))}onTap(t){if(t.multiTouch)return;const{editor:e}=this,{select:i,selectKeep:s}=e.mergeConfig;"tap"===i?this.checkAndSelect(t):this.waitSelect&&this.waitSelect(),this.needRemoveItem?e.removeItem(this.needRemoveItem):this.isMoveMode&&(s||(e.target=null))}checkAndSelect(t){if(this.needRemoveItem=null,this.allowSelect(t)){const{editor:e}=this,i=this.findUI(t);i?this.isMultipleSelect(t)?e.hasItem(i)?this.needRemoveItem=i:e.addItem(i):e.target=i:this.allow(t.target)&&(this.isHoldMultipleSelectKey(t)||this.editor.mergedConfig.selectKeep||(e.target=null))}}onDragStart(t){if(!t.multiTouch&&(this.waitSelect&&this.waitSelect(),this.allowDrag(t))){const{editor:e}=this,{stroke:i,area:s}=e.mergeConfig,{x:n,y:r}=t.getInnerPoint(this);this.bounds.set(n,r),this.selectArea.setStyle({visible:!0,stroke:i,x:n,y:r},s),this.selectArea.setBounds(this.bounds.get()),this.originList=e.leafList.clone()}}onDrag(t){if(!t.multiTouch){if(this.editor.dragging)return this.onDragEnd(t);if(this.dragging){const{editor:e}=this,i=t.getInnerTotal(this),s=this.bounds.clone().unsign(),n=new ph(og(e.app,s));if(this.bounds.width=i.x,this.bounds.height=i.y,this.selectArea.setBounds(s.get()),n.length){const t=[];this.originList.forEach(e=>{n.has(e)||t.push(e)}),n.forEach(e=>{this.originList.has(e)||t.push(e)}),(t.length!==e.list.length||e.list.some((e,i)=>e!==t[i]))&&(e.target=t)}else e.target=this.originList.list}}}onDragEnd(t){t.multiTouch||this.dragging&&(this.originList=null,this.selectArea.visible=0)}onAutoMove(t){if(this.dragging){const{x:e,y:i}=t.getLocalMove(this);this.bounds.x+=e,this.bounds.y+=i}}allow(t){return t.leafer!==this.editor.leafer}allowDrag(t){const{boxSelect:e,multipleSelect:i}=this.editor.mergeConfig;return!(!(this.running&&i&&e)||t.target.draggable)&&(!this.editor.editing&&this.allow(t.target)||this.isHoldMultipleSelectKey(t)&&!rg(t.path))}allowSelect(t){return this.running&&!this.isMoveMode&&!t.middle}findDeepOne(t){const e={exclude:new ph(this.editor.editBox.rect)};return rg(t.target.leafer.interaction.findPath(t,e))}findUI(t){return this.isMultipleSelect(t)?this.findDeepOne(t):rg(t.path)}isMultipleSelect(t){const{multipleSelect:e,continuousSelect:i}=this.editor.mergeConfig;return e&&(this.isHoldMultipleSelectKey(t)||i)}isHoldMultipleSelectKey(t){const{multipleSelectKey:e}=this.editor.mergedConfig;return e?t.isHoldKeys(e):t.shiftKey}__listenEvents(){const{editor:e}=this;e.waitLeafer(()=>{const{app:i}=e;i.selector.proxy=e,this.__eventIds=[e.on_([[jp.HOVER,this.onHover,this],[jp.SELECT,this.onSelect,this]]),i.on_([[t.PointerEvent.MOVE,this.onPointerMove,this],[t.PointerEvent.BEFORE_DOWN,this.onBeforeDown,this],[t.PointerEvent.TAP,this.onTap,this],[t.DragEvent.START,this.onDragStart,this,!0],[t.DragEvent.DRAG,this.onDrag,this],[t.DragEvent.END,this.onDragEnd,this],[t.MoveEvent.MOVE,this.onAutoMove,this],[[t.ZoomEvent.ZOOM,t.MoveEvent.MOVE],()=>{this.editor.hoverTarget=null}]])]})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=this.originList=this.needRemoveItem=null,this.__removeListenEvents(),super.destroy()}}const{topLeft:hg,top:lg,topRight:dg,right:cg,bottomRight:ug,bottom:pg,bottomLeft:gg,left:_g}=t.Direction9,{toPoint:fg}=bt,{within:mg,sign:yg}=W,{abs:vg}=Math,xg={getScaleData(t,e,i,s,n,r,o,h){let l,d,c={},u=1,p=1;const{boxBounds:g,widthRange:_,heightRange:f,dragBounds:m,worldBoxBounds:y}=t,{width:v,height:x}=e,w=t.scaleX/e.scaleX,E=t.scaleY/e.scaleY,b=yg(w),k=yg(E),S=h?w:b*g.width/v,B=h?E:k*g.height/x;if(a(s))u=p=Math.sqrt(s);else{r&&(s.x*=2,s.y*=2),s.x*=h?w:b,s.y*=h?E:k;const t=(-s.y+x)/x,e=(s.x+v)/v,o=(s.y+x)/x,a=(-s.x+v)/v;switch(i){case lg:p=t,l="bottom";break;case cg:u=e,l="left";break;case pg:p=o,l="top";break;case _g:u=a,l="right";break;case hg:p=t,u=a,l="bottom-right";break;case dg:p=t,u=e,l="bottom-left";break;case ug:p=o,u=e,l="top-left";break;case gg:p=o,u=a,l="top-right"}if(n)if("corner"===n&&i%2)n=!1;else switch(i){case lg:case pg:u=p;break;case _g:case cg:p=u;break;default:d=Math.sqrt(vg(u*p)),u=yg(u)*d,p=yg(p)*d}}const T=1!==u,P=1!==p;if(T&&(u/=S),P&&(p/=B),!o){const{worldTransform:e}=t;u<0&&(u=1/g.width/e.scaleX),p<0&&(p=1/g.height/e.scaleY)}if(fg(r||l,g,c,!0),m){const e={x:u,y:p};Sd.limitScaleOf(t,c,e,n),u=e.x,p=e.y}if(T&&_){const e=g.width*t.scaleX;u=mg(e*u,_)/e}if(P&&f){const e=g.height*t.scaleY;p=mg(e*p,f)/e}return T&&vg(u*y.width)<1&&(u=yg(u)/y.width),P&&vg(p*y.height)<1&&(p=yg(p)/y.height),n&&u!==p&&(d=Math.min(vg(u),vg(p)),u=yg(u)*d,p=yg(p)*d),isFinite(u)||(u=1),isFinite(p)||(p=1),{origin:c,scaleX:u,scaleY:p,direction:i,lockRatio:n,around:r}},getRotateData(t,e,i,s,n){let r,o={};switch(e){case hg:r="bottom-right";break;case dg:r="bottom-left";break;case ug:r="top-left";break;case gg:r="top-right";break;default:r="center"}return fg(n||r,t.boxBounds,o,!0),{origin:o,rotation:lt.getRotation(s,t.getWorldPointByBox(o),i)}},getSkewData(t,e,i,s){let n,r,o={},a=0,h=0;switch(e){case lg:case hg:r={x:.5,y:0},n="bottom",a=1;break;case pg:case ug:r={x:.5,y:1},n="top",a=1;break;case _g:case gg:r={x:0,y:.5},n="right",h=1;break;case cg:case dg:r={x:1,y:.5},n="left",h=1}const{width:l,height:d}=t;r.x=r.x*l,r.y=r.y*d,fg(s||n,t,o,!0);const c=lt.getRotation(r,o,{x:r.x+(a?i.x:0),y:r.y+(h?i.y:0)});return a?a=-c:h=c,{origin:o,skewX:a,skewY:h}},getAround:(t,e)=>e&&!t?"center":t,getRotateDirection:(t,e,i=8)=>((t=(t+Math.round(e/(360/i)))%i)<0&&(t+=i),t),getFlipDirection(t,e,i){if(e)switch(t){case _g:t=cg;break;case hg:t=dg;break;case gg:t=ug;break;case cg:t=_g;break;case dg:t=hg;break;case ug:t=gg}if(i)switch(t){case lg:t=pg;break;case hg:t=gg;break;case dg:t=ug;break;case pg:t=lg;break;case gg:t=hg;break;case ug:t=dg}return t}},wg={};function Eg(t,e){const{enterPoint:i,dragging:s,skewing:n,resizing:r,flippedX:o,flippedY:a}=t;if(!i||!t.editor.editing||!t.canUse)return;if("rect"===i.name)return bg(t);if("circle"===i.name)return;let{rotation:h}=t;const{pointType:l}=i,{moveCursor:d,resizeCursor:c,rotateCursor:u,skewCursor:p,moveable:g,resizeable:_,rotateable:f,skewable:m}=t.mergeConfig;if("move"===l)return i.cursor=d,void(g||(i.visible=!1));if("button"===l)return void(i.cursor||(i.cursor="pointer"));let y=l.includes("resize");y&&f&&(t.isHoldRotateKey(e)||!_)&&(y=!1);const v=m&&!y&&("resize-line"===i.name||"skew"===l),x=s?n?p:r?c:u:v?p:y?c:u;h+=45*(xg.getFlipDirection(i.direction,o,a)+1),h=2*Math.round(W.formatRotation(h,!0)/2);const{url:w,x:E,y:b}=x,k=w+h;wg[k]?i.cursor=wg[k]:wg[k]=i.cursor={url:kg(w,h),x:E,y:b}}function bg(t){const{moveCursor:e,moveable:i}=t.mergeConfig;t.canUse&&(t.rect.cursor=i?e:void 0)}function kg(t,e){return'"data:image/svg+xml,'+encodeURIComponent(t.replace("{{rotation}}",e.toString()))+'"'}class Sg extends t.Box{constructor(t){super(t),this.useFastShadow=!0}}const Bg=["top","right","bottom","left"],Tg=void 0;class Pg extends t.Group{get mergeConfig(){const{config:t}=this,{mergeConfig:e,editBox:i}=this.editor;return this.mergedConfig=t&&i!==this?Object.assign(Object.assign({},e),t):e}get target(){return this._target||this.editor.element}set target(t){this._target=t}get single(){return!!this._target||this.editor.single}get transformTool(){return this._transformTool||this.editor}set transformTool(t){this._transformTool=t}get flipped(){return this.flippedX||this.flippedY}get flippedX(){return this.scaleX<0}get flippedY(){return this.scaleY<0}get flippedOne(){return this.scaleX*this.scaleY<0}get canUse(){return this.app&&this.editor.editing}get canGesture(){if(!this.canUse)return!1;const{moveable:t,resizeable:e,rotateable:i}=this.mergeConfig;return r(t)||r(e)||r(i)}get canDragLimitAnimate(){return this.moving&&this.mergeConfig.dragLimitAnimate&&this.target.dragBounds}constructor(e){super(),this.view=new t.Group,this.rect=new Sg({name:"rect",hitFill:"all",hitStroke:"none",strokeAlign:"center",hitRadius:5}),this.circle=new Sg({name:"circle",strokeAlign:"center",around:"center",cursor:"crosshair",hitRadius:5}),this.buttons=new t.Group({around:"center",hitSelf:!1,visible:0}),this.resizePoints=[],this.rotatePoints=[],this.resizeLines=[],this.dragStartData={},this.__eventIds=[],this.editor=e,this.visible=!1,this.create(),this.__listenEvents()}create(){let t,e,i;const{view:s,resizePoints:n,rotatePoints:r,resizeLines:o,rect:a,circle:h,buttons:l}=this,d=["bottom-right","bottom","bottom-left","left","top-left","top","top-right","right"];for(let s=0;s<8;s++)t=new Sg({name:"rotate-point",around:d[s],width:15,height:15,hitFill:"all"}),r.push(t),this.listenPointEvents(t,"rotate",s),s%2&&(e=new Sg({name:"resize-line",around:"center",width:10,height:10,hitFill:"all"}),o.push(e),this.listenPointEvents(e,"resize",s)),i=new Sg({name:"resize-point",hitRadius:5}),n.push(i),this.listenPointEvents(i,"resize",s);this.listenPointEvents(h,"rotate",2),this.listenPointEvents(a,"move",8),s.addMany(...r,a,h,l,...o,...n),this.add(s)}load(){const{target:t,mergeConfig:e,single:i,rect:s,circle:r,resizePoints:o,resizeLines:a}=this,{stroke:h,strokeWidth:l,ignorePixelSnap:d}=e,c=this.getPointsStyle(),u=this.getMiddlePointsStyle(),g=this.getResizeLinesStyle();let _;this.visible=!t.locked;for(let t=0;t<8;t++)_=o[t],_.set(this.getPointStyle(t%2?u[(t-1)/2%u.length]:c[t/2%c.length])),_.rotation=(t-(t%2?1:0))/2*90,t%2&&a[(t-1)/2].set(Object.assign({pointType:"resize",rotation:(t-1)/2*90},g[(t-1)/2%g.length]||{}));r.set(this.getPointStyle(e.circle||e.rotatePoint||c[0])),s.set(Object.assign({stroke:h,strokeWidth:l,opacity:1,editConfig:Tg},e.rect||{}));const f=n(e.rectThrough)?i:e.rectThrough;s.hittable=!f,f&&(t.syncEventer=s,this.app.interaction.bottomList=[{target:s,proxy:t}]),i&&p.stintSet(t.__world,"ignorePixelSnap",d),bg(this)}update(){const{editor:t}=this,{x:e,y:i,scaleX:s,scaleY:n,rotation:r,skewX:o,skewY:a,width:h,height:l}=this.target.getLayoutBounds("box",t,!0);this.visible=!this.target.locked,this.set({x:e,y:i,scaleX:s,scaleY:n,rotation:r,skewX:o,skewY:a}),this.updateBounds({x:0,y:0,width:h,height:l})}unload(){this.visible=!1,this.app&&(this.rect.syncEventer=this.app.interaction.bottomList=null)}updateBounds(t){const{editor:e,mergeConfig:i,single:s,rect:n,circle:r,buttons:o,resizePoints:h,rotatePoints:l,resizeLines:d}=this,{editMask:c}=e,{middlePoint:u,resizeable:p,rotateable:g,hideOnSmall:_,editBox:f,mask:m,dimOthers:y,bright:v,spread:x,hideRotatePoints:w,hideResizeLines:E}=i;if(c.visible=!!m||0,e.setDimOthers(y),e.setBright(!!y||v),x&&Yt.spread(t,x),this.view.worldOpacity){const{width:e,height:c}=t,m=a(_)?_:10,y=f&&!(_&&e<m&&c<m);let v,x,b,k={};for(let i=0;i<8;i++)bt.toPoint(bt.directionData[i],t,k),x=h[i],v=l[i],x.set(k),v.set(k),x.visible=y&&!(!p&&!g),v.visible=y&&g&&p&&!w,i%2&&(b=d[(i-1)/2],b.set(k),b.visible=x.visible&&!E,x.visible=v.visible=y&&!!u,(i+1)/2%2?(b.width=e+b.height,_&&2*x.width>e&&(x.visible=!1)):(b.width=c+b.height,_&&2*x.width>c&&(x.visible=!1)));r.visible=y&&g&&!(!i.circle&&!i.rotatePoint),r.visible&&this.layoutCircle(),n.path&&(n.path=null),n.set(Object.assign(Object.assign({},t),{visible:!s||f})),o.visible=y&&o.children.length>0||0,o.visible&&this.layoutButtons()}else n.set(t)}layoutCircle(){const{circleDirection:t,circleMargin:e,buttonsMargin:i,buttonsDirection:s,middlePoint:n}=this.mergedConfig,r=Bg.indexOf(t||(this.buttons.children.length&&"bottom"===s?"top":"bottom"));this.setButtonPosition(this.circle,r,e||i,!!n)}layoutButtons(){const{buttons:t}=this,{buttonsDirection:e,buttonsFixed:i,buttonsMargin:s,middlePoint:n}=this.mergedConfig,{flippedX:r,flippedY:o}=this;let a=Bg.indexOf(e);(a%2&&r||(a+1)%2&&o)&&i&&(a=(a+2)%4);const h=i?xg.getRotateDirection(a,this.flippedOne?this.rotation:-this.rotation,4):a;this.setButtonPosition(t,h,s,!!n),i&&(t.rotation=90*(h-a)),t.scaleX=r?-1:1,t.scaleY=o?-1:1}setButtonPosition(t,e,i,s){const n=this.resizePoints[2*e+1],r=e%2,o=e&&3!==e?1:-1,a=(i+(e%2?(s?n.width:0)+t.boxBounds.width:(s?n.height:0)+t.boxBounds.height)/2)*o;r?(t.x=n.x+a,t.y=n.y):(t.x=n.x,t.y=n.y+a)}getPointStyle(t){const{stroke:e,strokeWidth:i,pointFill:s,pointSize:n,pointRadius:r}=this.mergedConfig,o={fill:s,stroke:e,strokeWidth:i,around:"center",strokeAlign:"center",opacity:1,width:n,height:n,cornerRadius:r,offsetX:0,offsetY:0,editConfig:Tg};return t?Object.assign(o,t):o}getPointsStyle(){const{point:t}=this.mergedConfig;return l(t)?t:[t]}getMiddlePointsStyle(){const{middlePoint:t}=this.mergedConfig;return l(t)?t:t?[t]:this.getPointsStyle()}getResizeLinesStyle(){const{resizeLine:t}=this.mergedConfig;return l(t)?t:[t]}onDragStart(t){this.dragging=!0;const e=this.dragPoint=t.current,{pointType:i}=e,{moveable:s,resizeable:n,rotateable:r,skewable:o}=this.mergeConfig;"move"===i?s&&(this.moving=!0):(i.includes("rotate")||this.isHoldRotateKey(t)||!n?(r&&(this.rotating=!0),"resize-rotate"===i?n&&(this.resizing=!0):"resize-line"===e.name&&(o&&(this.skewing=!0),this.rotating=!1)):"resize"===i&&n&&(this.resizing=!0),"skew"===i&&o&&(this.skewing=!0)),this.onTransformStart(t)}onDrag(t){const{transformTool:e,moving:i,resizing:s,rotating:n,skewing:r}=this;if(i)e.onMove(t);else if(s||n||r){const i=t.current;i.pointType&&(this.enterPoint=i),n&&e.onRotate(t),s&&e.onScale(t),r&&e.onSkew(t)}Eg(this,t)}onDragEnd(t){this.onTransformEnd(t),this.dragPoint=null}onTransformStart(t){(this.moving||this.gesturing)&&(this.editor.opacity=this.mergedConfig.hideOnMove?0:1),this.resizing&&(Xo.resizingKeys=this.editor.leafList.keys);const{dragStartData:e,target:i}=this;e.x=t.x,e.y=t.y,e.totalOffset={x:0,y:0},e.point={x:i.x,y:i.y},e.bounds=Object.assign({},i.getLayoutBounds("box","local")),e.rotation=i.rotation}onTransformEnd(e){this.canDragLimitAnimate&&(e instanceof t.DragEvent||e instanceof t.MoveEvent)&&this.transformTool.onMove(e),this.resizing&&(Xo.resizingKeys=null),this.dragging=this.gesturing=this.moving=this.resizing=this.rotating=this.skewing=!1,this.editor.opacity=1,this.editor.update()}onMove(e){if(this.canGesture&&"drag"!==e.moveType&&(e.stop(),r(this.mergedConfig.moveable)))switch(this.gesturing=this.moving=!0,e.type){case t.MoveEvent.START:this.onTransformStart(e);break;case t.MoveEvent.END:this.onTransformEnd(e);break;default:this.transformTool.onMove(e)}}onScale(e){if(this.canGesture&&(e.stop(),r(this.mergedConfig.resizeable)))switch(this.gesturing=this.resizing=!0,e.type){case t.ZoomEvent.START:this.onTransformStart(e);break;case t.ZoomEvent.END:this.onTransformEnd(e);break;default:this.transformTool.onScale(e)}}onRotate(e){if(this.canGesture&&(e.stop(),r(this.mergedConfig.rotateable)))switch(this.gesturing=this.rotating=!0,e.type){case t.ZoomEvent.START:this.onTransformStart(e);break;case t.ZoomEvent.END:this.onTransformEnd(e);break;default:this.transformTool.onRotate(e)}}isHoldRotateKey(t){const{rotateKey:e}=this.mergedConfig;return e?t.isHoldKeys(e):t.metaKey||t.ctrlKey}onKey(t){Eg(this,t)}onArrow(t){if(this.canUse&&this.mergeConfig.keyEvent){let e=0,i=0;const s=t.shiftKey?10:1;switch(t.code){case"ArrowDown":i=s;break;case"ArrowUp":i=-s;break;case"ArrowLeft":e=-s;break;case"ArrowRight":e=s}(e||i)&&this.transformTool.move(e,i)}}onDoubleTap(t){const{openInner:e,preventEditInner:i}=this.mergeConfig;"double"!==e||i||this.openInner(t)}onLongPress(t){const{openInner:e,preventEditInner:i}=this.mergeConfig;"long"===e&&i&&this.openInner(t)}openInner(e){const{editor:i,target:s}=this;if(this.single){if(s.locked)return;if(s.isBranch&&!s.editInner){if(s.textBox){const{children:e}=s,n=e.find(e=>e.editable&&e instanceof t.Text)||e.find(e=>e instanceof t.Text);if(n)return i.openInnerEditor(n)}i.openGroup(s),i.target=i.selector.findDeepOne(e)}else i.openInnerEditor()}}listenPointEvents(e,i,s){e.direction=s,e.pointType=i,this.__eventIds.push(e.on_([[t.DragEvent.START,this.onDragStart,this],[t.DragEvent.DRAG,this.onDrag,this],[t.DragEvent.END,this.onDragEnd,this],[t.PointerEvent.ENTER,t=>{this.enterPoint=e,Eg(this,t)}],[t.PointerEvent.LEAVE,()=>{this.enterPoint=null}]]))}__listenEvents(){const{rect:e,editor:i,__eventIds:s}=this;s.push(e.on_([[t.PointerEvent.DOUBLE_TAP,this.onDoubleTap,this],[t.PointerEvent.LONG_PRESS,this.onLongPress,this]])),this.waitLeafer(()=>{s.push(i.app.on_([[[t.KeyEvent.HOLD,t.KeyEvent.UP],this.onKey,this],[t.KeyEvent.DOWN,this.onArrow,this],[[t.MoveEvent.START,t.MoveEvent.BEFORE_MOVE,t.MoveEvent.END],this.onMove,this,!0],[[t.ZoomEvent.START,t.ZoomEvent.BEFORE_ZOOM,t.ZoomEvent.END],this.onScale,this,!0],[[t.RotateEvent.START,t.RotateEvent.BEFORE_ROTATE,t.RotateEvent.END],this.onRotate,this,!0]]))})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=null,this.__removeListenEvents(),super.destroy()}}const Lg={x:0,y:0,width:1e5,height:1e5};class Rg extends t.UI{constructor(t){super(),this.editor=t,this.hittable=!1,this.visible=0}__updateWorldBounds(){Object.assign(this.__local,Lg),Object.assign(this.__world,Lg)}__draw(t,e){const{editor:i}=this,{mask:s}=i.mergedConfig;if(s&&i.editing){if(t.fillWorld(t.bounds,!0===s?"rgba(0,0,0,0.8)":s),e.bounds&&!e.bounds.hit(i.editBox.rect.__world,e.matrix))return;t.saveBlendMode("destination-out"),e=Object.assign(Object.assign({},e),{shape:!0}),i.list.forEach(i=>{i.__render(t,e);const{parent:s}=i;s&&s.textBox&&s.__renderShape(t,e)}),t.restoreBlendMode()}}destroy(){this.editor=null,super.destroy()}}const Cg='\n<feOffset dy="1"/>\n<feGaussianBlur stdDeviation="1.5"/>\n<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.2 0"/>\n<feBlend mode="normal" in="SourceGraphic" result="shape"/>',Og={editSize:"size",keyEvent:!0,stroke:"#836DFF",strokeWidth:2,pointFill:"#FFFFFF",pointSize:10,pointRadius:16,rotateGap:45,buttonsDirection:"bottom",buttonsMargin:12,hideOnSmall:!0,moveCursor:"move",resizeCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate({{rotation}},12,12)">\n<path d="M7.5 8.0H8.5V5.9L6.8 7.2L7.5 8.0ZM3 11.4L2.3 10.6L1.3 11.4L2.3 12.2L3 11.4ZM7.5 10.4H6.5V11.4H7.5V10.4ZM16.5 10.4V11.4H17.5V10.4H16.5ZM16.5 8.0L17.1 7.2L15.5 5.9V8.0H16.5ZM21 11.4L21.6 12.2L22.6 11.4L21.6 10.6L21 11.4ZM16.5 14.9H15.5V16.9L17.1 15.7L16.5 14.9ZM16.5 12.4H17.5V11.4H16.5V12.4ZM7.5 12.4V11.4H6.5V12.4H7.5ZM7.5 14.9L6.8 15.7L8.5 16.9V14.9H7.5ZM6.8 7.2L2.3 10.6L3.6 12.2L8.1 8.7L6.8 7.2ZM8.5 10.4V8.0H6.5V10.4H8.5ZM16.5 9.4H7.5V11.4H16.5V9.4ZM17.5 10.4V8.0H15.5V10.4H17.5ZM15.8 8.7L20.3 12.2L21.6 10.6L17.1 7.2L15.8 8.7ZM20.3 10.6L15.8 14.1L17.1 15.7L21.6 12.2L20.3 10.6ZM17.5 14.9V12.4H15.5V14.9H17.5ZM7.5 13.4H16.5V11.4H7.5V13.4ZM8.5 14.9V12.4H6.5V14.9H8.5ZM2.3 12.2L6.8 15.7L8.1 14.1L3.6 10.6L2.3 12.2Z" fill="white"/>\n<path fill-rule="evenodd" d="M3 11.4L7.5 8.0V10.4H16.5V8.0L21 11.4L16.5 14.9V12.4H7.5V14.9L3 11.4Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter id="f" x="-1.6" y="3.9" width="27.2" height="16.9" filterUnits="userSpaceOnUse">\n${Cg}\n</filter>\n</defs>\n</svg>\n`,x:12,y:12},rotateCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate(135,12,12),rotate({{rotation}},12,12)">\n<path d="M20.4 8H21.4L20.8 7.1L17.3 2.6L17 2.1L16.6 2.6L13.1 7.1L12.5 8H13.5H15.4C14.9 11.8 11.8 14.9 8 15.4V13.5V12.5L7.1 13.1L2.6 16.6L2.1 17L2.6 17.3L7.1 20.8L8 21.4V20.4V18.4C13.5 17.9 17.9 13.5 18.4 8H20.4Z" stroke="white"/>\n<path fill-rule="evenodd" d="M17 3L20.4 7.5H17.9C17.7 13.1 13.1 17.7 7.5 17.9V20.4L3 17L7.5 13.5V15.9C12.0 15.7 15.7 12.0 15.9 7.5H13.5L17 3Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter id="f" x="-1.6" y="-0.6" width="27.1" height="27.1" filterUnits="userSpaceOnUse">\n${Cg}\n</filter>\n</defs>\n</svg>\n`,x:12,y:12},skewCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate(90,12,12),rotate({{rotation}},12,12)">\n<path d="M21 10.4L21 11.4L23.8 11.4L21.6 9.6L21 10.4ZM17 10.4V11.4L17 11.4L17 10.4ZM15.5 6L16.1 5.2L14.5 3.9V6H15.5ZM15.5 8.4V9.4H16.5V8.4H15.5ZM6 8.4V7.4H5V8.4H6ZM6 10.4H5V11.4H6V10.4ZM7 14.4V13.4L7 13.4L7 14.4ZM3 14.4L3 13.4L0.1 13.4L2.3 15.2L3 14.4ZM8.5 18.9L7.8 19.7L9.5 21.0V18.9H8.5ZM8.5 16.4V15.4H7.5V16.4H8.5ZM19 16.4V17.4H20V16.4H19ZM19 14.4H20V13.4H19V14.4ZM21 9.4L17 9.4L17 11.4L21 11.4L21 9.4ZM14.8 6.7L20.3 11.2L21.6 9.6L16.1 5.2L14.8 6.7ZM16.5 8.4V6H14.5V8.4H16.5ZM6 9.4H15.5V7.4H6V9.4ZM7 10.4V8.4H5V10.4H7ZM15.5 9.4H6V11.4H15.5V9.4ZM17 9.4H15.5V11.4H17V9.4ZM7 15.4H8.5V13.4H7V15.4ZM3 15.4L7 15.4L7 13.4L3 13.4L3 15.4ZM9.1 18.1L3.6 13.6L2.3 15.2L7.8 19.7L9.1 18.1ZM7.5 16.4V18.9H9.5V16.4H7.5ZM19 15.4H8.5V17.4H19V15.4ZM18 14.4V16.4H20V14.4H18ZM8.5 15.4H19V13.4H8.5V15.4Z" fill="white"/>\n<path fill-rule="evenodd" d="M17 10.4L21 10.4L15.5 6V8.4H6V10.4H15.5H17ZM8.5 14.4H7L3 14.4L8.5 18.9V16.4H19V14.4H8.5Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter x="-2.8" y="1.9" width="29.6" height="23.1" filterUnits="userSpaceOnUse" >\n${Cg}\n</filter>\n</defs>\n</svg>\n`,x:12,y:12},selector:!0,editBox:!0,hover:!0,select:"press",openInner:"double",multipleSelect:!0,boxSelect:!0,moveable:!0,resizeable:!0,flipable:!0,rotateable:!0,skewable:!0},Mg=new Gt;function Dg(t){const{simulateTarget:e,list:i}=t,{zoomLayer:s}=i[0].leafer;e.safeChange(()=>{Mg.setListWithFn(i,t=>t.getBounds("box","page")),0===Mg.width&&(Mg.width=.1),0===Mg.height&&(Mg.height=.1),e.reset(Mg.get())}),s.add(e)}const Ig=(t,e)=>t.parent.children.indexOf(t)-e.parent.children.indexOf(e),Ag=(t,e)=>e.parent.children.indexOf(e)-t.parent.children.indexOf(t),Wg={group(e,i,s){e.sort(Ag);const{app:n,parent:r}=e[0];let o;o=s&&s.add?s:new t.Group(s),r.addAt(o,r.children.indexOf(e[0])),e.sort(Ig);const a=new ft(i.worldTransform);return a.divideParent(r.scrollWorldTransform),o.setTransform(a),o.editable=!0,o.hitChildren=!1,n.lockLayout(),e.forEach(t=>t.dropTo(o)),n.unlockLayout(),o},ungroup(t){const{app:e}=t[0],i=[];return e.lockLayout(),t.forEach(t=>{if(t.isBranch){const{parent:e,children:s}=t;for(;s.length;)i.push(s[0]),s[0].dropTo(e,e.children.indexOf(t));t.isBranchLeaf?i.push(t):t.remove()}else i.push(t)}),e.unlockLayout(),i},toTop(t){t.sort(Ig),t.forEach(t=>{t.parent&&t.parent.add(t)})},toBottom(t){t.sort(Ag),t.forEach(t=>{t.parent&&t.parent.addAt(t,0)})}},Fg=$t.get("EditToolCreator");function zg(){return t=>{Hg.register(t)}}const Ug=zg,Hg={list:{},register(t){const{tag:e}=t.prototype;Ng[e]&&Fg.repeat(e),Ng[e]=t},get:(t,e)=>new Ng[t](e)},{list:Ng}=Hg;class Yg extends jp{constructor(t,e){super(t,e)}}Yg.BEFORE_OPEN="innerEditor.before_open",Yg.OPEN="innerEditor.open",Yg.BEFORE_CLOSE="innerEditor.before_close",Yg.CLOSE="innerEditor.close";class Xg extends jp{constructor(t,e){super(t,e)}}Xg.BEFORE_GROUP="editor.before_group",Xg.GROUP="editor.group",Xg.BEFORE_UNGROUP="editor.before_ungroup",Xg.UNGROUP="editor.ungroup",Xg.BEFORE_OPEN="editor.before_open_group",Xg.OPEN="editor.open_group",Xg.BEFORE_CLOSE="editor.before_close_group",Xg.CLOSE="editor.close_group";const{updateMatrix:Vg}=no,jg={x:1,y:1,scaleX:1,scaleY:1,rotation:1,skewX:1,skewY:1},Gg="top-left";class Kg extends t.Rect{get __tag(){return"SimulateElement"}constructor(t){super(),this.checkChange=!0,this.canChange=!0,this.visible=this.hittable=!1,this.on(Io.CHANGE,e=>{if(this.checkChange&&jg[e.attrName]){const{attrName:i,newValue:s,oldValue:n}=e,r="s"===i[0]?(s||1)/(n||1):(s||0)-(n||0);this.canChange=!1;const o=this.__;o[i]=n,Vg(this.parent),Vg(this);const a=new ft(this.__world);switch(o[i]=s,this.__layout.rotationChange(),Vg(this),this.changedTransform=new ft(this.__world).divide(a),i){case"x":t.move(r,0);break;case"y":t.move(0,r);break;case"rotation":t.rotateOf(Gg,r);break;case"scaleX":t.scaleOf(Gg,r,1);break;case"scaleY":t.scaleOf(Gg,1,r);break;case"skewX":t.skewOf(Gg,r,0);break;case"skewY":t.skewOf(Gg,0,r)}this.canChange=!0}})}safeChange(t){this.canChange&&(this.checkChange=!1,t(),this.checkChange=!0)}}class Zg extends jp{constructor(t,e){super(t,e)}}Zg.BEFORE_MOVE="editor.before_move",Zg.MOVE="editor.move";class qg extends jp{constructor(t,e){super(t,e)}}qg.BEFORE_SCALE="editor.before_scale",qg.SCALE="editor.scale";class Jg extends jp{constructor(t,e){super(t,e)}}Jg.BEFORE_ROTATE="editor.before_rotate",Jg.ROTATE="editor.rotate";class $g extends jp{constructor(t,e){super(t,e)}}$g.BEFORE_SKEW="editor.before_skew",$g.SKEW="editor.skew";class Qg{onMove(e){const{target:i,mergeConfig:s,dragStartData:n}=this.editBox;let o,{dragLimitAnimate:h}=s;const l=e.type===t.MoveEvent.END||e.type===t.DragEvent.END,d=r(i.draggable),c=!h||l||d,u={x:e.totalX,y:e.totalY};e instanceof t.MoveEvent&&lt.move(u,i.getWorldPointByLocal(n.totalOffset,null,!0)),e.shiftKey&&(Math.abs(u.x)>Math.abs(u.y)?u.y=0:u.x=0),o=t.DragEvent.getValidMove(i,n.point,u,c),(o.x||o.y)&&(h&&!d&&l?no.animateMove(this,o,a(h)?h:.3):this.move(o))}onScale(e){const{target:i,mergeConfig:s,single:n,dragStartData:r}=this.editBox;let o,{around:a,lockRatio:h,flipable:l,editSize:d}=s;e instanceof t.ZoomEvent?(a=i.getBoxPoint(e),o=e.totalScale):o=e.getInnerTotal(i);const{direction:c}=e.current;(e.shiftKey||i.lockRatio)&&(h=!0);const u=xg.getScaleData(i,r.bounds,c,o,h,xg.getAround(a,e.altKey),l,!n||"scale"===d),p=i.x,g=i.y;e instanceof t.DragEvent&&this.editTool&&this.editTool.onScaleWithDrag?(u.drag=e,this.scaleWithDrag(u)):this.scaleOf(u.origin,u.scaleX,u.scaleY),lt.move(r.totalOffset,i.x-p,i.y-g)}onRotate(e){const{target:i,mergeConfig:s,dragStartData:n}=this.editBox,{around:r,rotateAround:o,rotateGap:a,diagonalRotateKey:h}=s,{direction:l}=e.current;let d,c;if(e instanceof t.RotateEvent)c=e.rotation,d=o?bt.getPoint(o,i.boxBounds):i.getBoxPoint(e);else{const t=h?e.isHoldKeys(h):e.shiftKey,s=xg.getRotateData(i,l,e,n,t?null:o||i.around||i.origin||r||"center");c=n.rotation+s.rotation-i.rotation,d=s.origin}if(c=W.float(W.getGapRotation(c,a,i.rotation),2),!c)return;const u=i.x,p=i.y;this.rotateOf(d,c),lt.move(n.totalOffset,i.x-u,i.y-p)}onSkew(t){const{target:e,mergeConfig:i}=this.editBox,{around:s}=i,{origin:n,skewX:r,skewY:o}=xg.getSkewData(e.boxBounds,t.current.direction,t.getInnerMove(e),xg.getAround(s,t.altKey));(r||o)&&this.skewOf(n,r,o)}move(t,e=0){if(!this.checkTransform("moveable"))return;d(t)&&(e=t.y,t=t.x);const{target:i,mergeConfig:s,single:n,editor:r}=this.editBox,{beforeMove:o}=s;if(o){const s=o({target:i,x:t,y:e});if(d(s))t=s.x,e=s.y;else if(!1===s)return}const a=i.getWorldPointByLocal({x:t,y:e},null,!0);n||i.safeChange(()=>i.move(t,e));const h={target:i,editor:r,moveX:a.x,moveY:a.y};this.emitEvent(new Zg(Zg.BEFORE_MOVE,h));const l=new Zg(Zg.MOVE,h);this.doMove(l),this.emitEvent(l)}scaleWithDrag(t){if(!this.checkTransform("resizeable"))return;const{target:e,mergeConfig:i,editor:s}=this.editBox,{beforeScale:n}=i;if(n){const{origin:i,scaleX:s,scaleY:r,drag:o}=t;if(!1===n({target:e,drag:o,origin:i,scaleX:s,scaleY:r}))return}t=Object.assign(Object.assign({},t),{target:e,editor:s,worldOrigin:e.getWorldPoint(t.origin)}),this.emitEvent(new qg(qg.BEFORE_SCALE,t));const r=new qg(qg.SCALE,t);this.editTool.onScaleWithDrag(r),this.emitEvent(r)}scaleOf(t,e,i=e,s){if(!this.checkTransform("resizeable"))return;const{target:n,mergeConfig:r,single:o,editor:a}=this.editBox,{beforeScale:h}=r;if(h){const s=h({target:n,origin:t,scaleX:e,scaleY:i});if(d(s))e=s.scaleX,i=s.scaleY;else if(!1===s)return}const l=this.getWorldOrigin(t),c=!o&&this.getChangedTransform(()=>n.safeChange(()=>n.scaleOf(t,e,i))),u={target:n,editor:a,worldOrigin:l,scaleX:e,scaleY:i,transform:c};this.emitEvent(new qg(qg.BEFORE_SCALE,u));const p=new qg(qg.SCALE,u);this.doScale(p),this.emitEvent(p)}flip(t){if(!this.checkTransform("resizeable"))return;const{target:e,single:i,editor:s}=this.editBox,n=this.getWorldOrigin("center"),r=i?new ft(no.getFlipTransform(e,t)):this.getChangedTransform(()=>e.safeChange(()=>e.flip(t))),o={target:e,editor:s,worldOrigin:n,scaleX:"x"===t?-1:1,scaleY:"y"===t?-1:1,transform:r};this.emitEvent(new qg(qg.BEFORE_SCALE,o));const a=new qg(qg.SCALE,o);this.doScale(a),this.emitEvent(a)}rotateOf(t,e){if(!this.checkTransform("rotateable"))return;const{target:i,mergeConfig:s,single:n,editor:r}=this.editBox,{beforeRotate:o}=s;if(o){const s=o({target:i,origin:t,rotation:e});if(a(s))e=s;else if(!1===s)return}const h=this.getWorldOrigin(t),l=!n&&this.getChangedTransform(()=>i.safeChange(()=>i.rotateOf(t,e))),d={target:i,editor:r,worldOrigin:h,rotation:e,transform:l};this.emitEvent(new Jg(Jg.BEFORE_ROTATE,d));const c=new Jg(Jg.ROTATE,d);this.doRotate(c),this.emitEvent(c)}skewOf(t,e,i=0,s){if(!this.checkTransform("skewable"))return;const{target:n,mergeConfig:r,single:o,editor:a}=this.editBox,{beforeSkew:h}=r;if(h){const s=h({target:n,origin:t,skewX:e,skewY:i});if(d(s))e=s.skewX,i=s.skewY;else if(!1===s)return}const l=this.getWorldOrigin(t),c=!o&&this.getChangedTransform(()=>n.safeChange(()=>n.skewOf(t,e,i))),u={target:n,editor:a,worldOrigin:l,skewX:e,skewY:i,transform:c};this.emitEvent(new $g($g.BEFORE_SKEW,u));const p=new $g($g.SKEW,u);this.doSkew(p),this.emitEvent(p)}doMove(t){this.editTool.onMove(t)}doScale(t){this.editTool.onScale(t)}doRotate(t){this.editTool.onRotate(t)}doSkew(t){this.editTool.onSkew(t)}checkTransform(t){const{target:e,mergeConfig:i}=this.editBox;return e&&!e.locked&&i[t]}getWorldOrigin(t){const{target:e}=this.editBox;return e.getWorldPoint(no.getInnerOrigin(e,t))}getChangedTransform(t){const{target:e,single:i}=this.editBox;if(!i&&!e.canChange)return e.changedTransform;const s=new ft(e.worldTransform);return t(),new ft(e.worldTransform).divide(s)}emitEvent(t,e){this.editBox.editor.emitEvent(t,e)}}t.Editor=class extends t.Group{get list(){return this.leafList.list}get dragHoverExclude(){return[this.editBox.rect]}get editing(){return!!this.list.length}get groupOpening(){return!!this.openedGroupList.length}get multiple(){return this.list.length>1}get single(){return 1===this.list.length}get dragPoint(){return this.editBox.dragPoint}get dragging(){return this.editBox.dragging}get gesturing(){return this.editBox.gesturing}get moving(){return this.editBox.moving}get resizing(){return this.editBox.resizing}get rotating(){return this.editBox.rotating}get skewing(){return this.editBox.skewing}get element(){return this.multiple?this.simulateTarget:this.list[0]}get buttons(){return this.editBox.buttons}get targetLeafer(){const t=this.list[0];return t&&t.leafer}constructor(t,e){super(e),this.leafList=new ph,this.openedGroupList=new ph,this.simulateTarget=new Kg(this),this.editBox=new Pg(this),this.editToolList={},this.selector=new ag(this),this.editMask=new Rg(this),this.targetEventIds=[];let i=p.clone(Og);t&&(i=p.default(t,i)),this.mergedConfig=this.config=i,this.addMany(this.editMask,this.selector,this.editBox),re.has("resize")||(this.config.editSize="scale")}select(t){this.target=t}cancel(){this.target=null}hasItem(t){return this.leafList.has(t)}getItem(t){return this.list[t||0]}addItem(t){this.hasItem(t)||t.locked||(this.leafList.add(t),this.target=this.leafList.list)}removeItem(t){this.hasItem(t)&&(this.leafList.remove(t),this.target=this.leafList.list)}shiftItem(t){this.hasItem(t)?this.removeItem(t):this.addItem(t)}setDimOthers(t,e="dim",i){if(!i){const{dimTarget:t,targetLeafer:e}=this;i=t?l(t)?t:[t]:[e]}i[0]&&i[0][e]!==(t||!1)&&i.forEach(i=>p.stintSet(i,e,t))}setBright(t){this.setDimOthers(t,"bright",this.list)}update(){if(this.editing){if(!this.element.parent)return this.cancel();this.innerEditing&&this.innerEditor.update(),this.editTool.update(),this.selector.update()}}updateEditBox(){this.multiple&&Dg(this),this.update()}getEditTool(t){return this.editToolList[t]=this.editToolList[t]||Hg.get(t,this)}updateEditTool(){if(this.unloadEditTool(),this.editing){const t=this.element;let e=t.editOuter||"EditTool";const{beforeEditOuter:i}=this.mergeConfig;if(i){const s=i({target:t,name:e});if(r(s))e=s;else if(!1===s)return}if(Hg.list[e]){const t=this.editTool=this.getEditTool(e);this.editBox.load(),t.load(),this.update()}}}unloadEditTool(){let t=this.editTool;t&&(this.editBox.unload(),t.unload(),this.editTool=null)}getEditSize(t){return this.mergeConfig.editSize}onMove(t){}onScale(t){}onRotate(t){}onSkew(t){}move(t,e=0){}scaleWithDrag(t){}scaleOf(t,e,i=e,s){}flip(t){}rotateOf(t,e){}skewOf(t,e,i=0,s){}checkTransform(t){}getWorldOrigin(t){}getChangedTransform(t){}group(t){return this.multiple&&(this.emitGroupEvent(Xg.BEFORE_GROUP),this.target=Wg.group(this.list,this.element,t),this.emitGroupEvent(Xg.GROUP,this.target)),this.target}ungroup(){const{list:t}=this;return t.length&&(t.forEach(t=>t.isBranch&&this.emitGroupEvent(Xg.BEFORE_UNGROUP,t)),this.target=Wg.ungroup(t),t.forEach(t=>t.isBranch&&this.emitGroupEvent(Xg.UNGROUP,t))),this.list}openGroup(t){this.emitGroupEvent(Xg.BEFORE_OPEN,t),this.openedGroupList.add(t),t.hitChildren=!0,this.emitGroupEvent(Xg.OPEN,t)}closeGroup(t){this.emitGroupEvent(Xg.BEFORE_CLOSE,t),this.openedGroupList.remove(t),t.hitChildren=!1,this.emitGroupEvent(Xg.CLOSE,t)}checkOpenedGroups(){const t=this.openedGroupList;if(t.length){let{list:e}=t;this.editing&&(e=[],t.forEach(t=>this.list.every(e=>!no.hasParent(e,t))&&e.push(t))),e.forEach(t=>this.closeGroup(t))}this.editing&&!this.selector.dragging&&this.checkDeepSelect()}checkDeepSelect(){let t,{list:e}=this;for(let i=0;i<e.length;i++)for(t=e[i].parent;t&&!t.hitChildren;)this.openGroup(t),t=t.parent}emitGroupEvent(t,e){const i=new Xg(t,{editTarget:e});this.emitEvent(i),e&&e.emitEvent(i)}getInnerEditor(t){return this.editToolList[t]=this.editToolList[t]||Hg.get(t,this)}openInnerEditor(t,e,i){let s;if(r(e)?s=e:i||(i=e),t&&i&&(this.target=t),this.single){t||(t=this.element),s||(s=t.editInner);const{beforeEditInner:e}=this.mergeConfig;if(e){const i=e({target:t,name:s});if(r(i))s=i;else if(!1===i)return}Hg.list[s]&&(this.editTool.unload(),this.innerEditing=!0,this.innerEditor=this.getInnerEditor(s),this.innerEditor.editTarget=t,this.emitInnerEvent(Yg.BEFORE_OPEN),this.innerEditor.load(),this.emitInnerEvent(Yg.OPEN))}}closeInnerEditor(t){this.innerEditing&&(this.innerEditing=!1,this.emitInnerEvent(Yg.BEFORE_CLOSE),this.innerEditor.unload(),this.emitInnerEvent(Yg.CLOSE),t||this.updateEditTool(),this.innerEditor=null)}emitInnerEvent(t){const{innerEditor:e}=this,{editTarget:i}=e,s=new Yg(t,{editTarget:i,innerEditor:e});this.emitEvent(s),i.emitEvent(s)}lock(){this.list.forEach(t=>t.locked=!0),this.update()}unlock(){this.list.forEach(t=>t.locked=!1),this.update()}toTop(){this.list.length&&(Wg.toTop(this.list),this.leafList.update())}toBottom(){this.list.length&&(Wg.toBottom(this.list),this.leafList.update())}onAppRenderStart(t){(this.targetChanged=t.children.some(t=>t!==this.leafer&&t.renderer.changed))&&this.editBox.forceRender()}onRenderStart(){this.targetChanged&&this.update()}onChildScroll(){this.multiple&&this.updateEditBox()}listenTargetEvents(){if(!this.targetEventIds.length){const{app:t,leafer:e,targetLeafer:i,editMask:s}=this;this.targetEventIds=[e.on_(Go.START,this.onRenderStart,this),i&&i.on_(Io.SCROLL,this.onChildScroll,this),t.on_(Go.CHILD_START,this.onAppRenderStart,this),t.on_(Ko.UPDATE_MODE,t=>{t.mode&&"normal"!==t.mode&&this.cancel()})],s.visible&&s.forceRender()}}removeTargetEvents(){const{targetEventIds:t,editMask:e}=this;t.length&&(this.off_(t),e.visible&&e.forceRender())}destroy(){this.destroyed||(this.target=this.hoverTarget=null,Object.values(this.editToolList).forEach(t=>t.destroy()),this.simulateTarget.destroy(),this.editToolList={},this.simulateTarget=this.editTool=this.innerEditor=null,super.destroy())}},ge([(t,e)=>{nr(t,e,{get(){const{config:t,element:e,dragPoint:i,editBox:r,app:o}=this,a=Object.assign({},t);if(e&&e.editConfig){let{editConfig:t}=e;(t.hover||t.hoverStyle)&&(t=Object.assign({},t),delete t.hover,delete t.hoverStyle),Object.assign(a,t)}return r.config&&Object.assign(a,r.config),i&&(i.editConfig&&Object.assign(a,i.editConfig),"font-size"===a.editSize&&(a.lockRatio=!0),"resize-rotate"===i.pointType&&(a.around||(a.around="center"),n(a.lockRatio)&&(a.lockRatio=!0))),s(a.dragLimitAnimate)&&(a.dragLimitAnimate=o&&o.config.pointer.dragLimitAnimate),this.mergedConfig=a}})}],t.Editor.prototype,"mergeConfig",void 0),ge([Gp(function(t,e){const{target:i}=t;i?(t.leafList=i instanceof ph?i:new ph(i),t.multiple&&Dg(t)):(t.simulateTarget.remove(),t.leafList.reset()),t.closeInnerEditor(!0),t.unloadEditTool();const s={editor:t,value:i,oldValue:e};t.emitEvent(new jp(jp.SELECT,s)),t.checkOpenedGroups(),t.editing?t.waitLeafer(()=>{t.updateEditTool(),t.listenTargetEvents()}):(t.updateEditTool(),t.removeTargetEvents()),t.emitEvent(new jp(jp.AFTER_SELECT,s))})],t.Editor.prototype,"target",void 0),ge([Gp(function(t,e){t.emitEvent(new jp(jp.HOVER,{editor:t,value:t.hoverTarget,oldValue:e}))})],t.Editor.prototype,"hoverTarget",void 0),t.Editor=ge([Xr(Qg,["editBox","editTool","emitEvent"])],t.Editor);class t_{static registerInnerEditor(){Hg.register(this)}get tag(){return"InnerEditor"}get mode(){return"focus"}get editBox(){return this.editor.editBox}constructor(t){this.eventIds=[],this.editor=t,this.create()}onCreate(){}create(){this.view=new t.Group,this.onCreate()}onLoad(){}load(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!1),this.onLoad())}onUpdate(){}update(){this.onUpdate()}onUnload(){}unload(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!0),this.onUnload())}onDestroy(){}destroy(){this.onDestroy(),this.editor&&(this.view&&this.view.destroy(),this.eventIds&&this.editor.off_(this.eventIds),this.editor=this.view=this.eventIds=null)}}t.EditTool=class extends t_{static registerEditTool(){Hg.register(this)}get tag(){return"EditTool"}onMove(t){const{moveX:e,moveY:i,editor:s}=t,{app:n,list:r}=s;n.lockLayout(),r.forEach(t=>{t.moveWorld(e,i)}),n.unlockLayout()}onScale(t){const{scaleX:e,scaleY:i,transform:s,worldOrigin:n,editor:r}=t,{app:o,list:a}=r;o.lockLayout(),a.forEach(t=>{const o="scale"!==r.getEditSize(t);s?t.transformWorld(s,o):t.scaleOfWorld(n,e,i,o)}),o.unlockLayout()}onRotate(t){const{rotation:e,transform:i,worldOrigin:s,editor:n}=t,{app:r,list:o}=n;r.lockLayout(),o.forEach(t=>{const r="scale"!==n.getEditSize(t);i?t.transformWorld(i,r):t.rotateOfWorld(s,e)}),r.unlockLayout()}onSkew(t){const{skewX:e,skewY:i,transform:s,worldOrigin:n,editor:r}=t,{app:o,list:a}=r;o.lockLayout(),a.forEach(t=>{const o="scale"!==r.getEditSize(t);s?t.transformWorld(s,o):t.skewOfWorld(n,e,i,o)}),o.unlockLayout()}load(){this.editBox.view.visible=!0,this.onLoad()}update(){this.editBox.update(),this.onUpdate()}unload(){this.editBox.view.visible=!1,this.onUnload()}},t.EditTool=ge([zg()],t.EditTool);const{left:e_,right:i_}=t.Direction9,{move:s_,copy:n_,toNumberPoints:r_}=lt;t.LineEditTool=class extends t.EditTool{constructor(){super(...arguments),this.scaleOfEvent=!0}get tag(){return"LineEditTool"}onScaleWithDrag(t){const{drag:e,direction:i,lockRatio:s,around:n}=t,r=t.target,o=i===e_;if(r.pathInputed){const{path:t}=r.__,{from:i,to:a}=this.getFromToByPath(t);this.dragPoint(i,a,o,n,this.getInnerMove(r,e,s)),t[1]=i.x,t[2]=i.y,t[4]=a.x,t[5]=a.y,r.path=t}else if(r.points){const{points:t}=r,{from:i,to:a}=this.getFromToByPoints(t);this.dragPoint(i,a,o,n,this.getInnerMove(r,e,s)),t[0]=i.x,t[1]=i.y,t[2]=a.x,t[3]=a.y,r.points=t}else{const t={x:0,y:0},{toPoint:i}=r;r.rotation=0,this.dragPoint(t,i,o,n,this.getInnerMove(r,e,s)),r.getLocalPointByInner(t,null,null,!0),r.getLocalPointByInner(i,null,null,!0),r.x=t.x,r.y=t.y,r.getInnerPointByLocal(i,null,null,!0),r.toPoint=i}}getInnerMove(t,e,i){const s=e.getInnerMove(t);return i&&(Math.abs(s.x)>Math.abs(s.y)?s.y=0:s.x=0),s}getFromToByPath(t){return{from:{x:t[1],y:t[2]},to:{x:t[4],y:t[5]}}}getFromToByPoints(t){const e=r_(t);return{from:{x:e[0],y:e[1]},to:{x:e[2],y:e[3]}}}dragPoint(t,e,i,s,n){const{x:r,y:o}=n;i?(s_(t,r,o),s&&s_(e,-r,-o)):(s&&s_(t,-r,-o),s_(e,r,o))}onSkew(t){}onUpdate(){const{editBox:t}=this,{rotatePoints:e,resizeLines:i,resizePoints:s,rect:n}=t,r=this.editor.element;let o,a;if(r.pathInputed?o=this.getFromToByPath(r.__.path):r.points&&(o=this.getFromToByPoints(r.__.points)),o){const{from:i,to:a}=o;r.innerToWorld(i,i,!1,t),r.innerToWorld(a,a,!1,t),n.pen.clearPath().moveTo(i.x,i.y).lineTo(a.x,a.y),n_(s[7],i),n_(e[7],i),n_(s[3],a),n_(e[3],a)}for(let t=0;t<8;t++)t<4&&(i[t].visible=!1),a=t===e_||t===i_,s[t].visible=a,e[t].visible=!o&&a}},t.LineEditTool=ge([zg()],t.LineEditTool);const{M:o_,L:a_,C:h_,Q:l_,Z:d_,N:c_,D:u_,X:p_,G:g_,F:__,O:f_,P:m_,U:y_}=Oe,v_={scale(t,e,i){if(!t)return;let s,n=0,r=t.length;for(;n<r;)switch(s=t[n],s){case o_:case a_:x_(t,e,i,n,1),n+=3;break;case h_:x_(t,e,i,n,3),n+=7;break;case l_:x_(t,e,i,n,2),n+=5;break;case d_:n+=1;break;case c_:x_(t,e,i,n,2),n+=5;break;case u_:x_(t,e,i,n,2),n+=9;break;case p_:x_(t,e,i,n,2),n+=6;break;case g_:x_(t,e,i,n,2),n+=9;break;case __:x_(t,e,i,n,2),n+=5;break;case f_:t[n]=g_,t.splice(n+4,0,t[n+3],0),x_(t,e,i,n,2),n+=9,r+=2;break;case m_:t[n]=__,t.splice(n+4,0,t[n+3]),x_(t,e,i,n,2),n+=5,r+=1;break;case y_:x_(t,e,i,n,2),n+=6}},scalePoints(t,e,i,s,n){for(let r=n?s+1:0,o=n?r+2*n:t.length;r<o;r+=2)t[r]*=e,t[r+1]*=i}},{scalePoints:x_}=v_,w_=$.get(),{topLeft:E_,top:b_,topRight:k_,right:S_,bottom:B_,left:T_}=t.Direction9;function P_(t,e,i){t.pathInputed?L_(t,e,i):(1!==e&&(t.width*=e),1!==i&&(t.height*=i))}function L_(t,e,i){v_.scale(t.__.path,e,i),t.path=t.__.path}function R_(t,e,i){const{points:s}=t;d(s[0])?s.forEach(t=>{t.x*=e,t.y*=i}):v_.scalePoints(s,e,i),t.points=s}function C_(t,e,i){const{children:s}=t;for(let t=0;t<s.length;t++)w_.a=e,w_.d=i,s[t].transform(w_,!0)}const O_=t.Leaf.prototype;function M_(e,i,s){D_(e.parentApp?e.parentApp:e,i),e.isApp||s||e.__eventIds.push(e.on_(t.MoveEvent.BEFORE_MOVE,t=>{e.zoomLayer.move(e.getValidMove(t.moveX,t.moveY,!1))}),e.on_(t.MoveEvent.END,t=>{no.animateMove(e.zoomLayer,e.getValidMove(t.moveX,t.moveY))}),e.on_(t.ZoomEvent.BEFORE_ZOOM,t=>{const{zoomLayer:i}=e,s=e.getValidScale(t.scale);1!==s&&i.scaleOfWorld(t,s)}))}function D_(t,e){const i={wheel:{preventDefault:!0},touch:{preventDefault:!0},pointer:{preventDefaultMenu:!0}};e&&p.assign(i,e),p.assign(t.config,i,t.userConfig)}O_.scaleResize=function(t,e=t,i){const s=this;i||s.editConfig&&"scale"===s.editConfig.editSize?(s.scaleX*=t,s.scaleY*=e):(t<0&&(s.scaleX*=-1,t=-t),e<0&&(s.scaleY*=-1,e=-e),this.__scaleResize(t,e))},O_.__scaleResize=function(t,e){P_(this,t,e)},O_.resizeWidth=function(t){const e=t/this.getBounds("box","local").width||1;this.scaleOf(this.__layout.boxBounds,e,this.__.lockRatio?e:1,!0)},O_.resizeHeight=function(t){const e=t/this.getBounds("box","local").height||1;this.scaleOf(this.__layout.boxBounds,this.__.lockRatio?e:1,e,!0)},t.Text.prototype.__scaleResize=function(t,e){const{app:i,editConfig:n}=this,r=i&&i.editor,o=r&&r.dragPoint;if(this.__.resizeFontSize||n&&"font-size"===n.editSize||o&&"font-size"===r.mergedConfig.editSize)!function(t,e,i,n){let r=e;if(!s(n)){const s=t.__layout;let{width:o,height:a}=s.boxBounds;switch(o*=i-e,a*=e-i,n){case b_:case B_:r=i,s.affectScaleOrRotation?t.moveInner(-o/2,0):t.x-=o/2;break;case T_:case S_:s.affectScaleOrRotation?t.moveInner(0,-a/2):t.y-=a/2;break;case E_:case k_:s.affectScaleOrRotation?t.moveInner(0,-a):t.y-=a}}t.fontSize*=r;const o=t.__,{padding:a}=o;a&&(t.padding=l(a)?a.map(t=>t*r):a*r),o.__autoWidth||(t.width*=r),o.__autoHeight||(t.height*=r)}(this,t,e,o&&o.direction);else{const{__autoWidth:i,__autoHeight:s,textAlign:n,verticalAlign:r}=this.__,{boxBounds:o}=this.__layout;i&&"left"!==n&&1!==t&&(this.x+=o.x),s&&"top"!==r&&1!==e&&(this.y+=o.y),P_(this,t,e)}},t.Path.prototype.__scaleResize=function(t,e){L_(this,t,e)},t.Line.prototype.__scaleResize=function(t,e){this.pathInputed?L_(this,t,e):this.points?R_(this,t,e):this.width*=t},t.Polygon.prototype.__scaleResize=function(t,e){this.pathInputed?L_(this,t,e):this.points?R_(this,t,e):P_(this,t,e)},t.Group.prototype.__scaleResize=function(t,e){C_(this,t,e)},t.Box.prototype.__scaleResize=function(t,e){const{resizeChildren:i,__autoSize:s}=this.__;s&&i||P_(this,t,e),i&&C_(this,t,e)},re.add("resize"),re.add("editor","resize"),oe.editor=function(e,i){const s=new t.Editor(e);return i&&i.sky.add(i.editor=s),s},t.Box.addAttr("textBox",!1,dr),t.UI.addAttr("editConfig",void 0,dr),t.UI.addAttr("editOuter",t=>(t.updateLayout(),t.__.__isLinePath?"LineEditTool":"EditTool"),dr),t.UI.addAttr("editInner","PathEditor",dr),t.Group.addAttr("editInner","",dr),t.Text.addAttr("editInner","TextEditor",dr),t.UI.setEditConfig=function(t){this.changeAttr("editConfig",t)},t.UI.setEditOuter=function(t){this.changeAttr("editOuter",t)},t.UI.setEditInner=function(t){this.changeAttr("editInner",t)};const I_=$t.get("LeaferTypeCreator"),A_={list:{},register(t,e){W_[t]&&I_.repeat(t),W_[t]=e},run(t,e){const i=W_[t];i&&i(e)}},{list:W_,register:F_}=A_;F_("viewport",M_),F_("custom",function(t){M_(t,null,!0)}),F_("design",function(t){M_(t,{zoom:{min:.01,max:256},move:{holdSpaceKey:!0,holdMiddleKey:!0}})}),F_("document",function(t){M_(t,{zoom:{min:1},move:{scroll:"limit"}})});const z_={state:{type:"none",typeCount:0,startTime:0,totalData:null,center:{}},getData(t){const e=t[0],i=t[1],s=lt.getCenter(e.from,i.from),n=lt.getCenter(e.to,i.to),r={x:n.x-s.x,y:n.y-s.y},o=lt.getDistance(e.from,i.from);return{move:r,scale:lt.getDistance(e.to,i.to)/o,rotation:lt.getRotation(e.from,i.from,e.to,i.to),center:n}},getType(t,e){const i=Math.hypot(t.move.x,t.move.y)/(e.move||5),s=Math.abs(t.scale-1)/(e.scale||.03),n=Math.abs(t.rotation)/(e.rotation||2);return i<1&&s<1&&n<1?"none":i>=s&&i>=n?"move":s>=n?"zoom":"rotate"},detect(t,e){const{state:i}=U_,s=U_.getType(t,e);if(i.totalData||(i.startTime=Date.now(),i.center=t.center),U_.add(t,i.totalData),i.totalData=t,s===i.type){if(i.typeCount++,i.typeCount>=(e.count||3)&&"none"!==s)return s}else i.type=s,i.typeCount=1;return Date.now()-i.startTime>=(e.time||160)?U_.getType(i.totalData,e):"none"},add(t,e){e&&(lt.move(t.move,e.move),t.scale*=e.scale,t.rotation+=e.rotation,t.center=e.center)},reset(){const{state:t}=U_;t.type="none",t.typeCount=0,t.startTime=0,t.totalData=null}},U_=z_,{abs:H_,max:N_}=Math,{sign:Y_,within:X_}=W,V_={getMove(t,e){let{moveSpeed:i}=e,{deltaX:s,deltaY:n}=t;t.shiftKey&&!s&&(s=n,n=0);const r=H_(s),o=H_(n);return r>50&&(s=N_(50,r/3)*Y_(s)),o>50&&(n=N_(50,o/3)*Y_(n)),{x:-s*i*2,y:-n*i*2}},getScale(t,e){let i,s=1,{zoomMode:n,zoomSpeed:r}=e;const o=t.deltaY||t.deltaX;if(n?(i="mouse"===n||!t.deltaX&&(y.intWheelDeltaY?Math.abs(o)>17:Math.ceil(o)!==o),(t.shiftKey||t.metaKey||t.ctrlKey)&&(i=!0)):i=!t.shiftKey&&(t.metaKey||t.ctrlKey),i){r=X_(r,0,1);const i=t.deltaY?e.delta.y:e.delta.x,n=X_(1-H_(o)/(4*i)*r,.5,2);s=o>0?n:1/n}return s}};let j_,G_,K_,Z_;class q_{get transforming(){return this.moving||this.zooming||this.rotating}get moving(){return!!this.moveData}get zooming(){return!!this.zoomData}get rotating(){return!!this.rotateData}constructor(t){this.interaction=t}move(e){const{interaction:i}=this;e.moveType||(e.moveType="move"),this.moveData||(this.setPath(e),j_=0,G_=0,this.moveData=Object.assign(Object.assign({},e),{moveX:0,moveY:0,totalX:j_,totalY:G_}),i.emit(t.MoveEvent.START,this.moveData)),e.path=this.moveData.path,e.totalX=j_+=e.moveX,e.totalY=G_+=e.moveY,i.emit(t.MoveEvent.BEFORE_MOVE,e),i.emit(t.MoveEvent.MOVE,e),this.transformEndWait()}zoom(e){const{interaction:i}=this;this.zoomData||(this.setPath(e),K_=1,this.zoomData=Object.assign(Object.assign({},e),{scale:1,totalScale:K_}),i.emit(t.ZoomEvent.START,this.zoomData)),e.path=this.zoomData.path,e.totalScale=K_*=e.scale,i.emit(t.ZoomEvent.BEFORE_ZOOM,e),i.emit(t.ZoomEvent.ZOOM,e),this.transformEndWait()}rotate(e){const{interaction:i}=this;this.rotateData||(this.setPath(e),Z_=0,this.rotateData=Object.assign(Object.assign({},e),{rotation:0,totalRotation:Z_}),i.emit(t.RotateEvent.START,this.rotateData)),e.path=this.rotateData.path,e.totalRotation=Z_+=e.rotation,i.emit(t.RotateEvent.BEFORE_ROTATE,e),i.emit(t.RotateEvent.ROTATE,e),this.transformEndWait()}setPath(t){const{interaction:e}=this,{path:i}=e.selector.getByPoint(t,e.hitRadius);t.path=i,e.cancelHover()}transformEndWait(){clearTimeout(this.transformTimer),this.transformTimer=setTimeout(()=>{this.transformEnd()},this.interaction.p.transformTime)}transformEnd(){const{interaction:e,moveData:i,zoomData:s,rotateData:n}=this;i&&e.emit(t.MoveEvent.END,Object.assign(Object.assign({},i),{totalX:j_,totalY:G_})),s&&e.emit(t.ZoomEvent.END,Object.assign(Object.assign({},s),{totalScale:K_})),n&&e.emit(t.RotateEvent.END,Object.assign(Object.assign({},n),{totalRotation:Z_})),this.reset()}reset(){this.zoomData=this.moveData=this.rotateData=null}destroy(){this.reset()}}const J_=t.Leafer.prototype,$_=new Gt,Q_=new gt;function tf(t,e){return Object.assign(Object.assign({},e),{moveX:t.x,moveY:t.y})}function ef(t,e){return Object.assign(Object.assign({},e),{scale:t})}J_.initType=function(t){A_.run(t,this)},J_.getValidMove=function(t,e,i=!0){const{scroll:s,disabled:n}=this.app.config.move;if(Q_.set(t,e),s){const t=!0===s?"":s;t.includes("x")?Q_.y=0:t.includes("y")?Q_.x=0:Math.abs(Q_.x)>Math.abs(Q_.y)?Q_.y=0:Q_.x=0,i&&t.includes("limit")&&($_.set(this.__world).addPoint(this.zoomLayer),Sd.getValidMove($_,this.canvas.bounds,"inner",Q_,!0),t.includes("x")?Q_.y=0:t.includes("y")&&(Q_.x=0))}return{x:n?0:Q_.x,y:n?0:Q_.y}},J_.getValidScale=function(t){const{scaleX:e}=this.zoomLayer.__,{min:i,max:s,disabled:n}=this.app.config.zoom,r=Math.abs(e*t);return i&&r<i?t=i/e:s&&r>s&&(t=s/e),n?1:t};const sf=Gd.prototype;sf.createTransformer=function(){this.transformer=new q_(this)},sf.move=function(t){this.transformer.move(t)},sf.zoom=function(t){this.transformer.zoom(t)},sf.rotate=function(t){this.transformer.rotate(t)},sf.transformEnd=function(){this.transformer.transformEnd()},sf.wheel=function(t){const{wheel:e,pointer:i}=this.config,{posDeltaSpeed:s,negDeltaSpeed:n}=e;if(e.disabled)return;t.deltaX>0?s&&(t.deltaX*=s):n&&(t.deltaX*=n),t.deltaY>0?s&&(t.deltaY*=s):n&&(t.deltaY*=n);const r=e.getScale?e.getScale(t,e):V_.getScale(t,e);if(1!==r)this.zoom(ef(r,t));else{const s=e.getMove?e.getMove(t,e):V_.getMove(t,e);i.snap&&lt.round(s),this.move(tf(s,t))}},sf.multiTouch=function(t,e){const{disabled:i,singleGesture:s}=this.config.multiTouch;if(i)return;this.pointerWaitCancel();let n=z_.getData(e),{moving:r,zooming:o,rotating:a}=this.transformer;if(s){if(!this.transformer.transforming){switch(z_.detect(n,d(s)?s:{})){case"move":r=!0;break;case"zoom":o=!0;break;case"rotate":a=!0;break;default:return}z_.reset()}r||(n.center=z_.state.center)}else r=o=a=!0;var h,l;Object.assign(t,n.center),t.multiTouch=!0,a&&this.rotate((h=n.rotation,l=t,Object.assign(Object.assign({},l),{rotation:h}))),o&&this.zoom(ef(n.scale,t)),r&&this.move(tf(n.move,t))};const nf=Wd.prototype,{abs:rf}=Math;function of(t,e){let i=1;const s="out"===e,n=Math.abs(t);if(n>1){for(;s?i<n:i<=n;)i*=2;s&&(i/=2)}else{for(;s?i>=n:i>n;)i/=2;s||(i*=2)}return i/t}nf.checkDragEndAnimate=function(t,e){const{moveX:i,moveY:s}=this.dragData,n=rf(i),r=rf(s),o=e?1:.1,h=this.canAnimate&&this.moving&&(n>o||r>o)&&this.interaction.m.dragAnimate;if(h){const o="touch"===t.pointerType?3:1,l=70;n*(e=e?a(h)?h:.95:o)>l?e=l/n:r*e>l&&(e=l/r),t=Object.assign({},t),lt.move(t,i*e,s*e),this.drag(t),this.animate(()=>{this.dragEnd(t,1)})}return h},nf.animate=function(t,e){const i=t||this.animateWait;i&&this.interaction.target.nextRender(i,null,e),this.animateWait=t},nf.checkDragOut=function(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)},nf.autoMoveOnDragOut=function(t){const{interaction:e,downData:i,canDragOut:s}=this,{autoDistance:n,dragOut:r}=e.m;if(!r||!s||!n)return;const o=e.shrinkCanvasBounds,{x:a,y:h}=o,l=Yt.maxX(o),d=Yt.maxY(o),c=t.x<a?n:l<t.x?-n:0,u=t.y<h?n:d<t.y?-n:0;let p=0,g=0;this.autoMoveTimer=setInterval(()=>{p+=c,g+=u,lt.move(i,c,u),lt.move(this.dragData,c,u),e.move(Object.assign(Object.assign({},t),{moveX:c,moveY:u,totalX:p,totalY:g,moveType:"drag"})),e.pointerMoveReal(t)},10)},nf.autoMoveCancel=function(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)},re.add("viewport"),re.add("view"),t.Leafer.prototype.zoom=function(t,e,i,s){let o;this.killAnimate(),c(e)?(o=e.padding,i=e.scroll,s=e.transition):o=e;const{zoomLayer:h}=this,u=this.canvas.bounds.clone().shrink(n(o)?30:o),p=new Gt,g={x:u.x+u.width/2,y:u.y+u.height/2};let _;const{x:f,y:m,scaleX:y,scaleY:v}=h.__;if(r(t))switch(t){case"in":_=of(y,"in");break;case"out":_=of(y,"out");break;case"fit":t=this.boxBounds;break;case"fit-width":(t=new Gt(this.boxBounds)).height=0;break;case"fit-height":(t=new Gt(this.boxBounds)).width=0}else a(t)&&(_=t/y);if(_)_=this.getValidScale(_),h.scaleOfWorld(g,_,_,!1,s);else if(d(t)){const e={x:f,y:m,scaleX:y,scaleY:v},n=l(t);if(n||t.tag){const e=n?t:[t];p.setListWithFn(e,po.worldBounds)}else{const e=function(t,e){let i,{x:s,y:n,width:r,height:o}=t;return o||(o=r*(e.height/e.width),i=!0),r||(r=o*(e.width/e.height),i=!0),i?{x:s,y:n,width:r,height:o}:t}(t,u);p.set(h.getWorldBounds(e))}const{width:r,height:o}=p;let a=u.x-p.x,d=u.y-p.y;return i?(a+=Math.max((u.width-r)/2,0),d+=Math.max((u.height-o)/2,0)):(_=this.getValidScale(Math.min(u.width/r,u.height/o)),a+=(u.width-r*_)/2,d+=(u.height-o*_)/2,lt.scaleOf(e,p,_),p.scaleOf(p,_),e.scaleX*=_,e.scaleY*=_),"x"===i?d=0:"y"===i&&(a=0),lt.move(e,a,d),p.move(a,d),h.set(e,s),p}return h.worldBoxBounds};class af extends t.Group{get isOutside(){return!0}constructor(t,e){super(),this.config={theme:"light",padding:0,minSize:10},t.isApp&&(t.sky.add(this),t=t.tree),this.target=t,e&&p.assign(this.config,e),this.changeTheme(this.config.theme),this.waitLeafer(this.__listenEvents,this)}changeTheme(e){let i;r(e)?(i={fill:"black",stroke:"rgba(255,255,255,0.8)"},"dark"===e&&(i.fill="white",i.stroke="rgba(0,0,0,0.2)")):i=e,this.scrollXBar||this.addMany(this.scrollXBar=new t.Box,this.scrollYBar=new t.Box),i=Object.assign({strokeAlign:"center",opacity:.5,width:6,cornerRadius:3,hoverStyle:{opacity:.6},pressStyle:{opacity:.7}},i),i.height||(i.height=i.width),this.scrollXBar.set(Object.assign(Object.assign({},i),{visible:!1})),this.scrollYBar.set(Object.assign(Object.assign({},i),{visible:!1})),this.leafer&&this.update()}update(t){if(this.dragScrolling)return;const{minSize:e,padding:i}=this.config,{zoomLayer:s,canvas:n}=this.target.leafer,{worldRenderBounds:r}=s;if(t&&this.scrollBounds&&this.scrollBounds.isSame(r))return;this.scrollBounds=new Gt(r);const o=n.bounds.clone().shrink(i),a=o.clone().add(r),h=this.ratioX=o.width/a.width,l=this.ratioY=o.height/a.height,d=(o.x-a.x)/a.width,c=(o.y-a.y)/a.height,u=h<1,p=l<1,{scrollXBar:g,scrollYBar:_}=this,{x:f,y:m,width:y,height:v}=o.shrink([2,p?_.width+6:2,u?g.height+6:2,2]);g.set({x:f+y*d,y:m+v+2,width:Math.max(y*h,e),visible:u}),_.set({x:f+y+2,y:m+v*c,height:Math.max(v*l,e),visible:p})}onDrag(t){this.dragScrolling=!0,this.__dragOut=this.app.config.move.dragOut,this.app.config.move.dragOut=!1;const e=t.current===this.scrollXBar,i=this.target.leafer.getValidMove(e?-t.moveX/this.ratioX:0,e?0:-t.moveY/this.ratioY);this.target.moveWorld(i.x,i.y),t.current.moveWorld(i.x&&-i.x*this.ratioX,i.y&&-i.y*this.ratioY)}onDragEnd(){this.dragScrolling=!1,this.app.config.move.dragOut=this.__dragOut}__listenEvents(){const{scrollXBar:e,scrollYBar:i}=this;this.__eventIds=[e.on_(t.DragEvent.DRAG,this.onDrag,this),i.on_(t.DragEvent.DRAG,this.onDrag,this),e.on_(t.DragEvent.END,this.onDragEnd,this),i.on_(t.DragEvent.END,this.onDragEnd,this),this.target.on_(Go.BEFORE,()=>this.update(!0)),this.target.leafer.on_(Xo.RESIZE,()=>this.update())]}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.destroyed||(this.__removeListenEvents(),this.target=this.config=null,super.destroy())}}re.add("scroll");class hf extends ll{}function lf(t){return ar(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__,e="none"!==t.startArrow||"none"!==t.endArrow;t.__useArrow!==e&&yr(this),t.__useArrow=e,Er(this)}}}))}t.Arrow=class extends t.Line{get __tag(){return"Arrow"}constructor(t){super(t),this.__.__useArrow=!0}static registerArrow(t,e){Nh.register(t,e)}},ge([Ar(hf)],t.Arrow.prototype,"__",void 0),ge([lf("angle")],t.Arrow.prototype,"endArrow",void 0),t.Arrow=ge([Vr()],t.Arrow);const{M:df,L:cf,C:uf,Q:pf,O:gf}=Oe,{rotate:_f,copyFrom:ff,scale:mf}=lt,yf={},vf={layout(t,e,i,s,n,r,o){let a,h,l=0,d=t.length;for(;l<d;)switch(a=t[l],a){case df:case cf:xf(t,l+1,e,i,s,n,r,o),l+=3;break;case uf:for(h=1;h<6;h+=2)xf(t,l+h,e,i,s,n,r,o);l+=7;break;case pf:for(h=1;h<4;h+=2)xf(t,l+h,e,i,s,n,r,o);l+=5;break;case gf:t[l+1]+=e,t[l+2]+=i,s&&(t[l+3]*=s),r&&(t[l+4]+=r,t[l+5]+=r),l+=7}},rotate(t,e,i){vf.layout(t,0,0,1,1,e,i)}};function xf(t,e,i,s,n,r,o,a){ff(yf,t[e],t[e+1]),o&&_f(yf,o,a),n&&mf(yf,n,r),t[e]=i+yf.x,t[e+1]=s+yf.y}const{layout:wf,rotate:Ef}=vf,{getAngle:bf}=lt,kf={x:-.5},Sf={connect:kf,offset:{x:-.71,bevelJoin:.36,roundJoin:.22},path:[1,-3,-3,2,0,0,2,-3,3]},Bf={connect:kf,offset:{x:-1.207,bevelJoin:.854,roundJoin:.707},path:[1,-3,-3,2,0,0,2,-1,0]},Tf={connect:kf,offset:{x:-.9,bevelJoin:.624,roundJoin:.4},path:[1,-3,0,2,-3,-2,2,0,0,2,-3,2,2,-3,0,1,-2.05,1.1,2,-2.05,-1.1],dashPath:[1,-2,0,2,-.5,0]},Pf={connect:kf,offset:{x:-1.1,bevelJoin:.872,roundJoin:.6},path:[1,-3,0,2,-3.5,-1.8,2,0,0,2,-3.5,1.8,2,-3,0,1,-2.25,.95,2,-2.25,-.95],dashPath:[1,-3,0,2,-.5,0]},Lf={offset:kf,path:[...Tf.path],dashPath:[1,-2.5,0,2,-1,0]};Ef(Lf.path,180,{x:-1.5,y:0});const Rf={connect:{x:-1.3},path:[1,1.8,-.1,2,1.8,0,26,0,0,1.8,0,359,0]},Cf={connect:{x:.5},path:[...Rf.path,1,0,0,26,0,0,1,0,360,0],dashPath:[1,-.5,0,2,.5,0]},Of={connect:{x:-1.3},path:[1,-1.4,0,2,-1.4,-1.4,2,1.4,-1.4,2,1.4,1.4,2,-1.4,1.4,2,-1.4,0]},Mf={path:[...Of.path,2,-1.4,-.49,2,1,-.49,1,-1.4,.49,2,1,.49]},Df=p.clone(Of),If=p.clone(Mf);Ef(Df.path,45),Ef(If.path,45);const Af={angle:Sf,"angle-side":Bf,arrow:Pf,triangle:Tf,"triangle-flip":Lf,circle:Cf,"circle-line":Rf,square:Mf,"square-line":Of,diamond:If,"diamond-line":Df,mark:{offset:kf,path:[1,0,-2,2,0,2]}};function Wf(t,e,i,s,n,r,o){let a,h;const{strokeCap:l,strokeJoin:c}=t.__;d(e)?e.type?(h=e.scale,a=Af[e.type]):a=e:a=Af[e];const{offset:u,connect:p,path:g,dashPath:_}=a;let f=p?p.x:0,m=u?u.x:0;const y=[...g];return o&&_&&y.push(..._),"none"!==l&&(f-=.5),u&&("round"===c&&u.roundJoin?m+=u.roundJoin:"bevel"===c&&u.bevelJoin&&(m+=u.bevelJoin)),h&&wf(y,0,0,h,h),m&&wf(y,m,0),wf(y,s.x,s.y,n,n,bf(i,s)),r.x=(f+m)*n,y}const{M:Ff,L:zf,C:Uf,Q:Hf,Z:Nf,N:Yf,D:Xf,X:Vf,G:jf,F:Gf,O:Kf,P:Zf,U:qf}=Oe,{copy:Jf,copyFrom:$f,getDistancePoint:Qf}=lt,tm={},em={},im={},sm={},nm={},rm={list:Af,addArrows(t){const{startArrow:e,endArrow:i,strokeWidth:s,dashPattern:n,__pathForRender:r,cornerRadius:o}=t.__,a=!o;let h,l=0,d=r.length,c=0,u=e&&"none"!==e;for(;l<d;){switch(h=r[l],h){case Ff:case zf:(c<2||l+6>=d)&&($f(nm,r[l+1],r[l+2]),!c&&u&&Jf(em,nm)),l+=3;break;case Uf:(1===c||l+7>=d-3)&&om(r,sm,nm,l+3),l+=7;break;case Hf:(1===c||l+5>=d-3)&&om(r,sm,nm,l+1),l+=5;break;case Nf:return;case Yf:l+=5;break;case Xf:l+=9;break;case Vf:l+=6;break;case jf:l+=9;break;case Gf:l+=5;break;case Kf:l+=7;break;case Zf:l+=4;break;case qf:(1===c||l+6>=d-3)&&(om(r,sm,nm,l+1),l+6!==d&&(nm.x-=(nm.x-sm.x)/10,nm.y-=(nm.y-sm.y)/10)),l+=6}if(c++,1===c&&h!==Ff)return;if(2===c&&u&&Jf(im,h===zf?nm:sm),l===d){const o=t.__.__pathForRender=a?[...r]:r,d=t.__.__pathForArrow=[];if(u){const i=Wf(t,e,im,em,s,tm,!!n);n?d.push(...i):o.push(...i),tm.x&&(Qf(em,im,-tm.x,!0),o[1]=im.x,o[2]=im.y)}if(i&&"none"!==i){const e=Wf(t,i,sm,nm,s,tm,!!n);if(n?d.push(...e):o.push(...e),tm.x){let t;switch(Qf(nm,sm,-tm.x,!0),h){case zf:t=l-3+1;break;case Uf:t=l-7+5;break;case Hf:t=l-5+3;break;case qf:t=l-6+3}t&&am(o,sm,t)}}}else Jf(sm,nm)}},register(t,e){this.list[t]=e},get(t){return this.list[t]}};function om(t,e,i,s){$f(e,t[s],t[s+1]),$f(i,t[s+2],t[s+3])}function am(t,e,i){t[i]=e.x,t[i+1]=e.y}re.add("arrow"),t.UI.addAttr("startArrow","none",lf),t.UI.addAttr("endArrow","none",lf),Object.assign(Nh,rm),Object.assign(Yh,{strokeArrow(t,e,i,s){e.__.dashPattern&&(i.beginPath(),e.__drawPathByData(i,e.__.__pathForArrow),i.dashPattern=null,i.stroke())}});const{Yes:hm,NoAndSkip:lm,YesAndSkip:dm}=t.Answer,cm={},um={},pm={};class gm{constructor(t){this.innerIdMap={},this.idMap={},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.target=t)&&this.__listenEvents()}getBy(t,e,i,n){switch(typeof t){case"number":const r=this.getByInnerId(t,e);return i?r:r?[r]:[];case"string":switch(t[0]){case"#":cm.id=t.substring(1),t=cm;break;case".":um.className=t.substring(1),t=um;break;default:pm.tag=t,t=pm}case"object":if(s(t.id)){if(t.tag){const{tag:s}=t,n=l(s);return this.getByMethod(n?this.methods.tags:this.methods.tag,e,i,n?p.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,n)}}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&&no.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),r===hm||r===dm){if(!i)return void(this.findLeaf=n);i.push(n)}n.isBranch&&r<lm&&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_(Mo.REMOVE,this.__onRemoveChild,this),this.target.on_(Io.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 _m=t.UI.prototype;function fm(t){return t.leafer?t.leafer.selector:y.selector||(y.selector=oe.selector())}_m.find=function(t,e){return fm(this).getBy(t,this,!1,e)},_m.findOne=function(t,e){return fm(this).getBy(t,this,!0,e)},re.add("find"),oe.finder=function(t){return new gm(t)};const{setPoint:mm,addPoint:ym,toBounds:vm}=yt;const xm={syncExport(t,e,i){let n;Kh.running=!0;try{const r=Vn.fileType(e),o=e.includes(".");i=Vn.getExportOptions(i);const{toURL:a}=y,{download:h}=y.origin;if("json"===r)o&&h(a(JSON.stringify(t.toJSON(i.json)),"text"),e),n={data:!!o||t.toJSON(i.json)};else if("svg"===r)o&&h(a(t.toSVG(),"svg"),e),n={data:!!o||t.toSVG()};else{let r,o,a=1,h=1;const{worldTransform:l,isLeafer:d,leafer:c,isFrame:u}=t,{slice:p,clip:g,trim:_,screenshot:f,padding:m,onCanvas:v}=i,x=s(i.smooth)?!c||c.config.smooth:i.smooth,w=i.contextSettings||(c?c.config.contextSettings:void 0),E=d&&f&&s(i.fill)?t.fill:i.fill,b=Vn.isOpaqueImage(e)||E,k=new ft;if(f)r=!0===f?d?c.canvas.bounds:t.worldRenderBounds:f;else{let e=i.relative||(d?"inner":"local");switch(a=l.scaleX,h=l.scaleY,e){case"inner":k.set(l);break;case"local":k.set(l).divide(t.localTransform),a/=t.scaleX,h/=t.scaleY;break;case"world":a=1,h=1;break;case"page":e=c||t;default:k.set(l).divide(t.getTransform(e));const i=e.worldTransform;a/=a/i.scaleX,h/=h/i.scaleY}r=t.getBounds("render",e)}const S={scaleX:1,scaleY:1};W.getScaleData(i.scale,i.size,r,S);let B=i.pixelRatio||1,{x:T,y:P,width:L,height:R}=new Gt(r).scale(S.scaleX,S.scaleY);g&&(T+=g.x,P+=g.y,L=g.width,R=g.height);const C={exporting:!0,matrix:k.scale(1/S.scaleX,1/S.scaleY).invert().translate(-T,-P).withScale(1/a*S.scaleX,1/h*S.scaleY)};let O,M=oe.canvas({width:Math.floor(L),height:Math.floor(R),pixelRatio:B,smooth:x,contextSettings:w});p&&(O=t,O.__worldOpacity=0,t=c||t,C.bounds=M.bounds),M.save();const D=u&&!s(E),I=t.get("fill");if(D&&(t.fill=""),y.render(t,M,C),D&&(t.fill=I),M.restore(),O&&O.__updateWorldOpacity(),_){o=function(t){const{width:e,height:i}=t.view,{data:s}=t.context.getImageData(0,0,e,i);let n,r,o,a=0;for(let t=0;t<s.length;t+=4)0!==s[t+3]&&(n=a%e,r=(a-n)/e,o?ym(o,n,r):mm(o={},n,r)),a++;const h=new Gt;return o&&(vm(o,h),h.scale(1/t.pixelRatio).ceil()),h}(M);const t=M,{width:e,height:i}=o,s={x:0,y:0,width:e,height:i,pixelRatio:B};M=oe.canvas(s),M.copyWorld(t,o,s),t.destroy()}if(m){const[t,e,i,s]=W.fourNumber(m),n=M,{width:r,height:o}=n;M=oe.canvas({width:r+s+e,height:o+t+i,pixelRatio:B}),M.copyWorld(n,n.bounds,{x:s,y:t,width:r,height:o}),n.destroy()}b&&M.fillWorld(M.bounds,E||"#FFFFFF","destination-over"),v&&v(M);n={data:"canvas"===e?M:M.export(e,i),width:M.pixelWidth,height:M.pixelHeight,renderBounds:r,trimBounds:o};const A=c&&c.app;A&&A.canvasManager&&A.canvasManager.clearRecycled()}}catch(t){n={data:"",error:t}}return Kh.running=!1,n},export(t,e,i){return Kh.running=!0,function(t){wm||(wm=new Zn);return new Promise(e=>{wm.add(()=>_e(this,void 0,void 0,function*(){return yield t(e)}),{parallel:!1})})}(s=>new Promise(n=>{const r=()=>_e(this,void 0,void 0,function*(){if(!Jn.isComplete)return y.requestRender(r);const o=Kh.syncExport(t,e,i);o.data instanceof Promise&&(o.data=yield o.data),s(o),n()});t.updateLayout(),Em(t);const{leafer:o}=t;o?o.waitViewCompleted(r):r()}))}};let wm;function Em(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach(t=>Em(t))}const bm=Le.prototype,km=$t.get("@leafer-in/export");bm.export=function(t,e){const{quality:i,blob:s}=Vn.getExportOptions(e);return t.includes(".")?this.saveAs(t,i):s?this.toBlob(t,i):this.toDataURL(t,i)},bm.toBlob=function(t,e){return new Promise(i=>{y.origin.canvasToBolb(this.view,t,e).then(t=>{i(t)}).catch(t=>{km.error(t),i(null)})})},bm.toDataURL=function(t,e){return y.origin.canvasToDataURL(this.view,t,e)},bm.saveAs=function(t,e){return new Promise(i=>{y.origin.canvasSaveAs(this.view,t,e).then(()=>{i(!0)}).catch(t=>{km.error(t),i(!1)})})},re.add("export"),Object.assign(Kh,xm),t.UI.prototype.export=function(t,e){return Kh.export(this,t,e)},t.UI.prototype.syncExport=function(t,e){return Kh.syncExport(this,t,e)};const Sm={none:"none",title:"capitalize",upper:"uppercase",lower:"lowercase","small-caps":"small-caps"},Bm={top:"flex-start",middle:"center",bottom:"flex-end"},Tm={none:"none",under:"underline",delete:"line-through","under-delete":"underline line-through"};function Pm(t,e,i){const{style:n}=t,{fill:o,padding:a,textWrap:h,textOverflow:c,textDecoration:u}=e;let p;n.fontFamily=e.fontFamily,n.fontSize=e.fontSize*i+"px",function(t,e){let i="black";l(e)&&(e=e[0]);if(d(e))switch(e.type){case"solid":i=Uh.string(e.color);break;case"image":break;case"linear":case"radial":case"angular":const t=e.stops[0];i=Uh.string(r(t)?t:t.color);break;default:s(e.r)||(i=Uh.string(e))}else i=e;t.color=i}(n,o),n.fontStyle=e.italic?"italic":"normal",n.fontWeight=e.fontWeight,d(u)?(p=u.type,u.color&&(n.textDecorationColor=Uh.string(u.color))):p=u,n.textDecoration=Tm[p],n.textTransform=Sm[e.textCase],n.textAlign="both"===e.textAlign?"justify":e.textAlign,n.display="flex",n.flexDirection="column",n.justifyContent=Bm[e.verticalAlign],n.lineHeight=(e.__.__lineHeight||0)*i+"px",n.letterSpacing=(e.__.__letterSpacing||0)*i+"px",n.whiteSpace="none"===h||e.__.__autoWidth?"nowrap":"normal",n.wordBreak="break"===h?"break-all":"normal",n.textIndent=(e.paraIndent||0)*i+"px",n.padding=l(a)?a.map(t=>t*i+"px").join(" "):(a||0)*i+"px",n.textOverflow="show"===c?"":"hide"===c?"clip":c}t.TextEditor=class extends t_{constructor(){super(...arguments),this.config={selectAll:!0},this.eventIds=[]}get tag(){return"TextEditor"}onLoad(){const{editor:e}=this,{config:i}=e.app,s=this.editTarget;s.textEditing=!0,this.isHTMLText=!(s instanceof t.Text),this._keyEvent=i.keyEvent,i.keyEvent=!1;const n=this.editDom=document.createElement("div");n.classList.add("leafer-text-editor");const{style:r}=n;n.contentEditable="true",r.position="fixed",r.transformOrigin="left top",r.boxSizing="border-box",this.isHTMLText?n.innerHTML=String(s.text):n.innerText=String(s.text);const{view:o}=e.app;(this.inBody=o instanceof HTMLCanvasElement)?document.body.appendChild(n):o.appendChild(n),this.eventIds=[e.app.on_(t.PointerEvent.DOWN,t=>{let i,{target:s}=t.origin;for(;s;)s===n&&(i=!0),s=s.parentElement;i||e.closeInnerEditor()})],this.onFocus=this.onFocus.bind(this),this.onInput=this.onInput.bind(this),this.onPaste=this.onPaste.bind(this),this.onUpdate=this.onUpdate.bind(this),this.onKeydown=this.onKeydown.bind(this),n.addEventListener("focus",this.onFocus),n.addEventListener("input",this.onInput),n.addEventListener("paste",this.onPaste),window.addEventListener("keydown",this.onKeydown),window.addEventListener("scroll",this.onUpdate);const a=window.getSelection(),h=document.createRange();if(this.config.selectAll)h.selectNodeContents(n);else{const t=n.childNodes[0];t&&(h.setStartAfter(t),h.setEndAfter(t)),h.collapse(!0)}a.removeAllRanges(),a.addRange(h)}onInput(){const{editDom:t}=this;this.editTarget.text=this.isHTMLText?t.innerHTML:t.innerText}onFocus(){this.editDom.style.outline="none"}onKeydown(t){if("Escape"===t.code&&this.editor.closeInnerEditor(),"Enter"===t.key){t.preventDefault();const e=document.createElement("br"),i=document.createTextNode("​"),s=window.getSelection().getRangeAt(0);s.deleteContents(),s.insertNode(i),s.insertNode(e),s.setStartAfter(e),s.setEndAfter(e),this.onInput()}}onPaste(t){if(this.isHTMLText)return;t.preventDefault();const e=t.clipboardData;if(!e)return;let i=e.getData("text/plain").replace(/\r\n?/g,"\n");const s=window.getSelection();if(!s||!s.rangeCount)return;const n=s.getRangeAt(0);n.deleteContents();const r=i.split("\n"),o=document.createDocumentFragment();r.forEach((t,e)=>{e>0&&o.appendChild(document.createElement("br")),o.appendChild(document.createTextNode(t))}),n.insertNode(o),n.collapse(!1),s.removeAllRanges(),s.addRange(n),this.onInput()}onUpdate(){const{editTarget:t}=this;let e=1;if(!this.isHTMLText){const{scaleX:i,scaleY:s}=t.worldTransform;e=Math.max(Math.abs(i),Math.abs(s));t.fontSize*e<12&&(e*=12/t.fontSize)}this.textScale=e;let{width:i,height:s}=t,n=0,r=0;i*=e,s*=e;const o=t.__;if(o.__autoWidth)switch(i+=20,o.textAlign){case"center":n=o.autoSizeAlign?-i/2:-10;break;case"right":n=o.autoSizeAlign?-i:-20}if(o.__autoHeight)switch(s+=20,o.verticalAlign){case"middle":r=o.autoSizeAlign?-s/2:-10;break;case"bottom":r=o.autoSizeAlign?-s:-20}const{x:a,y:h}=this.inBody?t.app.clientBounds:t.app.tree.clientBounds,{a:l,b:d,c:c,d:u,e:p,f:g}=new ft(t.worldTransform).scale(1/e).translateInner(n,r),{style:_}=this.editDom;_.transform=`matrix(${l},${d},${c},${u},${p},${g})`,_.left=a+"px",_.top=h+"px",_.width=i+"px",_.height=s+"px",this.isHTMLText||Pm(this.editDom,t,e)}onUnload(){const{editTarget:t,editor:e,editDom:i}=this;t&&(this.onInput(),"\n"===t.text&&(t.text=""),t.textEditing=void 0,e.app&&(e.app.config.keyEvent=this._keyEvent),e.off_(this.eventIds),i.removeEventListener("focus",this.onFocus),i.removeEventListener("input",this.onInput),i.removeEventListener("paste",this.onPaste),window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("scroll",this.onUpdate),i.remove(),this.editDom=this.eventIds=void 0)}},t.TextEditor=ge([Ug()],t.TextEditor),re.add("text-editor","editor");class Lm extends yl{setText(t){this._text=t,this.__htmlChanged=!0}}const Rm={lt:"<",gt:">",amp:"&",quot:'"',apos:"'",nbsp:" ",ensp:" ",emsp:" ",thinsp:" ",ndash:"–",mdash:"—",hellip:"…",middot:"·",bull:"•",laquo:"«",raquo:"»",lsquo:"‘",rsquo:"’",ldquo:"“",rdquo:"”",cent:"¢",pound:"£",yen:"¥",euro:"€",times:"×",divide:"÷",plusmn:"±",minus:"−",frac12:"½",frac14:"¼",frac34:"¾",sup2:"²",sup3:"³",deg:"°",reg:"®",copy:"©",trade:"™",section:"§",para:"¶",dagger:"†",Dagger:"‡",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",alpha:"α",beta:"β",gamma:"γ",delta:"δ",pi:"π",sigma:"σ",omega:"ω",Omega:"Ω",micro:"µ",infinity:"∞",not:"¬",equiv:"≡",le:"≤",ge:"≥"};return t.HTMLText=class extends t.Image{get __tag(){return"HTMLText"}constructor(t){super(t)}__updateBoxBounds(){const t=this.__;if(t.__htmlChanged){const e=document.createElement("div"),{style:i}=e;i.all="initial",i.position="absolute",i.visibility="hidden",e.innerHTML=this.text,document.body.appendChild(e);const{width:s,height:n}=e.getBoundingClientRect(),r=s+10,o=`<svg xmlns="http://www.w3.org/2000/svg" width="${r}" height="${n}">\n <foreignObject width="${r}" height="${n}">\n <style>\n * {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n </style>\n <body xmlns="http://www.w3.org/1999/xhtml">\n ${this.decodeText(this.text)}\n </body>\n </foreignObject>\n </svg>`;t.__setImageFill("data:image/svg+xml,"+encodeURIComponent(o)),t.__naturalWidth=r/t.pixelRatio,t.__naturalHeight=n/t.pixelRatio,t.__htmlChanged=!1,e.remove()}super.__updateBoxBounds()}__draw(t,e,i){this.textEditing&&!e.exporting||super.__draw(t,e,i)}decodeText(t){if(!t.includes("&"))return t;let e,i,s="",n=0;for(;n<t.length;){if("&"===t[n]){const r=t.indexOf(";",n+1);if(r>n+1&&(e=t.slice(n+1,r),i=Rm[e],void 0!==i)){s+=i,n=r+1;continue}}s+=t[n++]}return s}static addUnicodeEntity(t,e){r(t)?Rm[t]=e:Object.assign(Rm,t)}},ge([Ar(Lm)],t.HTMLText.prototype,"__",void 0),ge([fr("")],t.HTMLText.prototype,"text",void 0),ge([dr("TextEditor")],t.HTMLText.prototype,"editInner",void 0),ge([Sr(!1)],t.HTMLText.prototype,"textEditing",void 0),t.HTMLText=ge([Vr()],t.HTMLText),re.add("html"),t.AlignHelper=Bt,t.AroundHelper=bt,t.ArrowData=hf,t.AutoBounds=Zt,t.BezierHelper=ri,t.Bounds=Gt,t.BoundsEvent=Fo,t.BoundsHelper=Yt,t.BoxData=ol,t.BranchHelper=mo,t.BranchRender=Oa,t.CanvasData=vl,t.CanvasManager=pe,t.ChildEvent=Mo,t.ColorConvert=Uh,t.Creator=oe,t.Cursor=Kd,t.DataHelper=p,t.Debug=$t,t.DragBoundsHelper=Sd,t.Dragger=Wd,t.EditBox=Pg,t.EditDataHelper=xg,t.EditPoint=Sg,t.EditSelect=ag,t.EditSelectHelper=sg,t.EditToolCreator=Hg,t.EditorEvent=jp,t.EditorGroupEvent=Xg,t.EditorHelper=Wg,t.EditorMoveEvent=Zg,t.EditorRotateEvent=Jg,t.EditorScaleEvent=qg,t.EditorSkewEvent=$g,t.Effect=jh,t.EllipseData=cl,t.EllipseHelper=gi,t.Event=Oo,t.EventCreator=ce,t.Eventer=ea,t.Export=Kh,t.FileHelper=Vn,t.Filter=Gh,t.Finder=gm,t.FourNumberHelper=T,t.FrameData=hl,t.GroupData=rl,t.HTMLTextData=Lm,t.HitCanvasManager=Zd,t.ImageData=yl,t.ImageEvent=Wo,t.ImageManager=Qn,t.IncrementId=x,t.InnerEditor=t_,t.InnerEditorEvent=Yg,t.InteractionBase=Gd,t.InteractionHelper=Cd,t.Keyboard=cd,t.LayoutEvent=jo,t.Layouter=Rh,t.LeafBounds=La,t.LeafBoundsHelper=po,t.LeafData=_,t.LeafDataProxy=ga,t.LeafEventer=ua,t.LeafHelper=no,t.LeafLayout=Co,t.LeafLevelList=gh,t.LeafList=ph,t.LeafMatrix=wa,t.LeafRender=Ra,t.LeaferCanvas=_h,t.LeaferCanvasBase=Le,t.LeaferData=al,t.LeaferEvent=Ko,t.LeaferImage=sr,t.LeaferTypeCreator=A_,t.LineData=ll,t.MathHelper=W,t.Matrix=ft,t.MatrixHelper=$,t.MultiTouchHelper=z_,t.MyDragEvent=Ld,t.MyImage=nd,t.MyPointerEvent=Td,t.MyTouchEvent=Rd,t.NeedConvertToCanvasCommandMap=De,t.OneRadian=z,t.PI2=U,t.PI_2=H,t.Paint=Yh,t.PaintGradient=Vh,t.PaintImage=Xh,t.PathArrow=Nh,t.PathArrowModule=rm,t.PathBounds=Mn,t.PathCommandDataHelper=Es,t.PathCommandMap=Oe,t.PathCommandNodeHelper=_i,t.PathConvert=Qi,t.PathCorner=Un,t.PathCreator=zs,t.PathData=gl,t.PathDrawer=tn,t.PathHelper=Re,t.PathMatrixHelper=vf,t.PathNumberCommandLengthMap=Fe,t.PathNumberCommandMap=We,t.PenData=_l,t.Picker=Dh,t.Platform=y,t.Plugin=re,t.Point=gt,t.PointHelper=lt,t.PointerButton=ud,t.PolygonData=ul,t.PropertyEvent=Io,t.RectData=dl,t.RectHelper=ze,t.RectRender=Bl,t.RenderEvent=Go,t.Renderer=Oh,t.ResizeEvent=Xo,t.Resource=Jn,t.Run=ie,t.ScrollBar=af,t.SelectArea=ig,t.Selector=Ih,t.StarData=pl,t.State=Zh,t.StringNumberMap=qt,t.Stroker=eg,t.TaskItem=Kn,t.TaskProcessor=Zn,t.TextConvert=zh,t.TextData=ml,t.TransformTool=Qg,t.Transformer=q_,t.Transition=qh,t.TwoPointBoundsHelper=yt,t.UIBounds=El,t.UICreator=he,t.UIData=sl,t.UIEvent=pd,t.UIRender=kl,t.UnitConvert=Hh,t.WaitHelper=wo,t.WatchEvent=Vo,t.Watcher=vh,t.WheelEventHelper=V_,t.addViewport=M_,t.addViewportConfig=D_,t.affectRenderBoundsType=kr,t.affectStrokeBoundsType=wr,t.arrowType=lf,t.attr=hr,t.autoLayoutType=pr,t.boundsType=fr,t.canvasPatch=Xn,t.canvasSizeAttrs=Pe,t.createAttr=function(t){return(e,i)=>{nr(e,i,or(i,t))}},t.createDescriptor=or,t.cursorType=Ir,t.dataProcessor=Ar,t.dataType=dr,t.decorateLeafAttr=ar,t.defineDataProcessor=Wr,t.defineKey=nr,t.defineLeafAttr=lr,t.dimType=Br,t.doBoundsType=yr,t.doStrokeType=Er,t.effectType=Ah,t.emptyData=i,t.eraserType=Mr,t.extraPropertyEventMap=Ao,t.getBoundsData=Y,t.getDescriptor=rr,t.getMatrixData=X,t.getPointData=N,t.hitType=Dr,t.isArray=l,t.isData=c,t.isEmptyData=u,t.isFinite=o,t.isNull=n,t.isNumber=a,t.isObject=d,t.isString=r,t.isUndefined=s,t.layoutProcessor=function(t){return(e,i)=>{nr(e,"__LayoutProcessor",{get:()=>t})}},t.leaferTransformAttrMap=Qo,t.maskType=Or,t.naturalBoundsType=mr,t.opacityType=Tr,t.path=Hn,t.pathInputType=vr,t.pathType=xr,t.pen=Nn,t.positionType=cr,t.registerEditTool=zg,t.registerInnerEditor=Ug,t.registerUI=Vr,t.registerUIEvent=jr,t.resizeType=Wh,t.rewrite=Hr,t.rewriteAble=Nr,t.rotationType=_r,t.scaleType=gr,t.scrollType=ur,t.sortType=Cr,t.strokeType=br,t.surfaceType=Sr,t.tempBounds=Kt,t.tempMatrix=mt,t.tempPoint=_t,t.tryToNumber=function(t){return"string"==typeof t&&h.test(t)?+t:t},t.useCanvas=mh,t.useModule=Xr,t.version="1.11.1",t.visibleType=Pr,t.zoomLayerType=Fh,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;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",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 s={};function n(t){return void 0===t}function r(t){return null==t}function o(t){return"string"==typeof t}const{isFinite:a}=Number;function h(t){return"number"==typeof t}const l=/^-?\d+(?:\.\d+)?$/;const{isArray:d}=Array;function c(t){return t&&"object"==typeof t}function u(t){return c(t)&&!d(t)}function p(t){return"{}"===JSON.stringify(t)}const g={default:(t,e)=>(_(e,t),_(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 _(t[n],e[n],i&&i[n]);i&&n in i?(null===(o=i[n])||void 0===o?void 0:o.constructor)===Object&&_(t[n]={},e[n],i[n]):t[n]=e[n]})},copyAttrs:(t,e,i)=>(i.forEach(i=>{n(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:_}=g;class f{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __usePathBox(){return this.__pathInputed}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(!n(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let i;for(let s in this)"_"!==s[0]&&(i=e?e[s]:void 0,t[s]=n(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(!n(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!n(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(d(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 r in this)if("_"!==r[0]&&(t=this["_"+r],!n(t))){if("path"===r&&!this.__pathInputed)continue;e=s?s[r]:void 0,i[r]=n(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}}const{floor:m,max:y}=Math,v={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||x.maxCacheSize),isSuperLarge:(t,e,i)=>x.isLarge(t,e,i,x.maxPatternSize),getRealURL(t){const{prefix:e,suffix:i}=v.image;return!i||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+i),e&&"/"===t[0]&&(t=e+t),t},resize(t,e,i,s,n,r,o,a,h){const l=v.origin.createCanvas(y(m(e+(s||0)),1),y(m(i+(n||0)),1)),d=l.getContext("2d");if(a&&(d.globalAlpha=a),d.imageSmoothingEnabled=!1!==o,r){const s=e/r.width,n=i/r.height;d.setTransform(s,0,0,n,-r.x*s,-r.y*n),d.drawImage(t,0,0,t.width,t.height)}else d.drawImage(t,0,0,e,i);return l},setPatternTransform(t,e,i){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}i&&g.stintSet(i,"transform",e)}}},{image:x}=v,w={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=E;return e[t]?e[t]++:(e[t]=1,0)}},E=w;let b,k,S;const{max:B}=Math,T=[0,0,0,0],P={zero:[...T],tempFour:T,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)=>L(T,t,e,i,s),toTempAB(t,e,i){S=i?h(t)?e:t:[],h(t)?(b=C(t),k=e):h(e)?(b=t,k=C(e)):(b=t,k=e),4!==b.length&&(b=R(b)),4!==k.length&&(k=R(k))},get(t,e){let i;if(!h(t))switch(t.length){case 4:i=n(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]),!n(e))for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},max:(t,e,i)=>h(t)&&h(e)?B(t,e):(O(t,e,i),L(S,B(b[0],k[0]),B(b[1],k[1]),B(b[2],k[2]),B(b[3],k[3]))),add:(t,e,i)=>h(t)&&h(e)?t+e:(O(t,e,i),L(S,b[0]+k[0],b[1]+k[1],b[2]+k[2],b[3]+k[3])),swapAndScale(t,e,i,s){if(h(t))return e===i?t*e:[t*i,t*e];const n=s?t:[],[r,o,a,l]=4===t.length?t:R(t);return L(n,a*i,l*e,r*i,o*e)}},{set:L,get:R,setTemp:C,toTempAB:O}=P,{round:M,pow:D,max:I,floor:A,PI:W}=Math,F={within:(t,e,i)=>(c(e)&&(i=e.max,e=e.min),!n(e)&&t<e&&(t=e),!n(i)&&t>i&&(t=i),t),fourNumber:P.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),F.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=n(e)?1e12:D(10,e);return-0===(t=M(t*i)/i)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,i,s){if(s||(s={}),e){const t=(h(e)?e:e.width||0)/i.width,n=(h(e)?e:e.height||0)/i.height;s.scaleX=t||n||1,s.scaleY=n||t||1}else t&&F.assignScale(s,t);return s},assignScale(t,e){h(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>I(A(t),e)/t,randInt:z,randColor:t=>`rgba(${z(255)},${z(255)},${z(255)},${t||1})`};function z(t){return Math.round(Math.random()*t)}const H=W/180,U=2*W,N=W/2;function Y(){return{x:0,y:0}}function X(){return{x:0,y:0,width:0,height:0}}function V(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:j,cos:G,acos:K,sqrt:Z}=Math,{float:q}=F,J={};function $(){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:$(),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:V,getWorld:$,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){tt.toInnerPoint(t,e,J),tt.scaleOfInner(t,J,i,s)},scaleOfInner(t,e,i,s=i){tt.translateInner(t,e.x,e.y),tt.scale(t,i,s),tt.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:n,d:r}=t,o=G(e*=H),a=j(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){tt.toInnerPoint(t,e,J),tt.rotateOfInner(t,J,i)},rotateOfInner(t,e,i){tt.translateInner(t,e.x,e.y),tt.rotate(t,i),tt.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:n,c:r,d:o}=t;i&&(i*=H,t.a=s+r*i,t.b=n+o*i),e&&(e*=H,t.c=r+s*e,t.d=o+n*e)},skewOfOuter(t,e,i,s){tt.toInnerPoint(t,e,J),tt.skewOfInner(t,J,i,s)},skewOfInner(t,e,i,s=0){tt.translateInner(t,e.x,e.y),tt.skew(t,i,s),tt.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,r){const{e:o,f:a}=t;if(i||(i=t),n(s)&&(s=1!==t.a||t.b||t.c||1!==t.d),s){const{a:s,b:n,c:o,d:a}=t;i.a=s*e.a+n*e.c,i.b=s*e.b+n*e.d,i.c=o*e.a+a*e.c,i.d=o*e.b+a*e.d,r&&(i.scaleX=e.scaleX*r.scaleX,i.scaleY=e.scaleY*r.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,r&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=o*e.a+a*e.c+e.e,i.f=o*e.b+a*e.d+e.f},divide(t,e){tt.multiply(t,tt.tempInvert(e))},divideParent(t,e){tt.multiplyParent(t,tt.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=tt;return tt.copy(e,t),tt.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,r){const{x:o,y:a,scaleX:h,scaleY:l}=e;if(n(r)&&(r=e.rotation||e.skewX||e.skewY),r){const{rotation:i,skewX:s,skewY:n}=e,r=i*H,o=G(r),a=j(r);if(s||n){const e=s*H,i=n*H;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=o,t.f=a,(i=i||s)&&tt.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=Z(n*n+r*r),c=t/d;const e=n/d;u=r>0?K(e):-K(e)}else{c=Z(o*o+a*a),d=t/c;const e=o/c;u=N-(a>0?K(-e):-K(e))}const e=q(G(u)),i=j(u);d=q(d),c=q(c),p=e?q((o/c+i)/e/H,9):0,g=e?q((r/d-i)/e/H,9):0,u=q(u/H)}else d=n,c=a,u=p=g=0;return(e=i||e)&&(_+=e.x*n+e.y*o,f+=e.x*r+e.y*a,i||(_-=e.x,f-=e.y)),{x:_,y:f,scaleX:d,scaleY:c,rotation:u,skewX:p,skewY:g}},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=Z(s*s+n*n)):(e=s,i=o)}return s.scaleX=e,s.scaleY=i,s},reset(t){tt.set(t)}},tt=Q,{toInnerPoint:et,toOuterPoint:it}=Q,{sin:st,cos:nt,abs:rt,sqrt:ot,atan2:at,min:ht,round:lt}=Math,dt={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=n(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?lt(t.x-.5)+.5:lt(t.x),t.y=e?lt(t.y-.5)+.5:lt(t.y)},move(t,e,i){c(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=i)},scale(t,e,i=e){t.x&&(t.x*=e),t.y&&(t.y*=i)},scaleOf(t,e,i,s=i){t.x+=(t.x-e.x)*(i-1),t.y+=(t.y-e.y)*(s-1)},rotate(t,e,i){i||(i=ct.defaultPoint);const s=nt(e*=H),n=st(e),r=t.x-i.x,o=t.y-i.y;t.x=i.x+r*s-o*n,t.y=i.y+r*n+o*s},tempToInnerOf(t,e){const{tempPoint:i}=ct;return pt(i,t),et(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=ct;return pt(i,t),it(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=ct;return pt(i,t),ct.toInnerRadiusPointOf(t,e,i),i},toInnerRadiusPointOf(t,e,i){i||(i=t),et(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){et(e,t,i)},toOuterOf(t,e,i){it(e,t,i)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getCenterX:(t,e)=>t+(e-t)/2,getCenterY:(t,e)=>t+(e-t)/2,getDistance:(t,e)=>ut(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const n=rt(i-t),r=rt(s-e);return ot(n*n+r*r)},getMinDistanceFrom:(t,e,i,s,n,r)=>ht(ut(t,e,i,s),ut(i,s,n,r)),getAngle:(t,e)=>gt(t,e)/H,getRotation:(t,e,i,s)=>(s||(s=e),ct.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/H),getRadianFrom(t,e,i,s,r,o,a,h){n(a)&&(a=i,h=s);const l=t-i,d=e-s,c=r-a,u=o-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>at(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s,n){const r=gt(t,e);return n&&(t=e),s||(e={}),e.x=t.x+nt(r)*i,e.y=t.y+st(r)*i,e},toNumberPoints(t){let e=t;return c(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},isSame:(t,e)=>t.x===e.x&&t.y===e.y,reset(t){ct.reset(t)}},ct=dt,{getDistanceFrom:ut,copy:pt,getAtan2:gt}=ct;class _t{constructor(t,e){this.set(t,e)}set(t,e){return c(t)?dt.copy(this,t):dt.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new _t(this)}move(t,e){return dt.move(this,t,e),this}scale(t,e){return dt.scale(this,t,e),this}scaleOf(t,e,i){return dt.scaleOf(this,t,e,i),this}rotate(t,e){return dt.rotate(this,t,e),this}rotateOf(t,e){return dt.rotate(this,e,t),this}getRotation(t,e,i){return dt.getRotation(this,t,e,i)}toInnerOf(t,e){return dt.toInnerOf(this,t,e),this}toOuterOf(t,e){return dt.toOuterOf(this,t,e),this}getCenter(t){return new _t(dt.getCenter(this,t))}getDistance(t){return dt.getDistance(this,t)}getDistancePoint(t,e,i,s){return new _t(dt.getDistancePoint(this,t,e,i,s))}getAngle(t){return dt.getAngle(this,t)}getAtan2(t){return dt.getAtan2(this,t)}isSame(t){return dt.isSame(this,t)}reset(){return dt.reset(this),this}}const ft=new _t;class mt{constructor(t,e,i,s,n,r){this.set(t,e,i,s,n,r)}set(t,e,i,s,n,r){return c(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 mt(this)}translate(t,e){return Q.translate(this,t,e),this}translateInner(t,e){return Q.translateInner(this,t,e),this}scale(t,e){return Q.scale(this,t,e),this}scaleWith(t,e){return Q.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return Q.pixelScale(this,t),this}scaleOfOuter(t,e,i){return Q.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return Q.scaleOfInner(this,t,e,i),this}rotate(t){return Q.rotate(this,t),this}rotateOfOuter(t,e){return Q.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return Q.rotateOfInner(this,t,e),this}skew(t,e){return Q.skew(this,t,e),this}skewOfOuter(t,e,i){return Q.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return Q.skewOfInner(this,t,e,i),this}multiply(t){return Q.multiply(this,t),this}multiplyParent(t){return Q.multiplyParent(this,t),this}divide(t){return Q.divide(this,t),this}divideParent(t){return Q.divideParent(this,t),this}invert(){return Q.invert(this),this}invertWith(){return Q.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){Q.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){Q.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return Q.setLayout(this,t,e,i),this}getLayout(t,e,i){return Q.getLayout(this,t,e,i)}withScale(t,e){return Q.withScale(this,t,e)}reset(){Q.reset(this)}}const yt=new mt,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){xt(t,e,i),xt(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:xt}=vt;var wt,Et;t.Direction4=void 0,(wt=t.Direction4||(t.Direction4={}))[wt.top=0]="top",wt[wt.right=1]="right",wt[wt.bottom=2]="bottom",wt[wt.left=3]="left",t.Direction9=void 0,(Et=t.Direction9||(t.Direction9={}))[Et.topLeft=0]="topLeft",Et[Et.top=1]="top",Et[Et.topRight=2]="topRight",Et[Et.right=3]="right",Et[Et.bottomRight=4]="bottomRight",Et[Et.bottom=5]="bottom",Et[Et.bottomLeft=6]="bottomLeft",Et[Et.left=7]="left",Et[Et.center=8]="center",Et[Et["top-left"]=0]="top-left",Et[Et["top-right"]=2]="top-right",Et[Et["bottom-right"]=4]="bottom-right",Et[Et["bottom-left"]=6]="bottom-left";const bt=[{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}];bt.forEach(t=>t.type="percent");const kt={directionData:bt,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)=>(i||(i={}),kt.toPoint(t,e,i,!0),i)};function St(e){return o(e)?bt[t.Direction9[e]]:e}const{toPoint:Bt}=kt,Tt={toPoint(t,e,i,s,n,r){Bt(t,i,s,n,e,r)}},{tempPointBounds:Pt,setPoint:Lt,addPoint:Rt,toBounds:Ct}=vt,{toOuterPoint:Ot}=Q,{float:Mt,fourNumber:Dt}=F,{floor:It,ceil:At}=Math;let Wt,Ft,zt,Ht;const Ut={},Nt={},Yt={},Xt={tempBounds:Yt,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(d(i)){const e=Dt(i);s?Vt.set(t,r+e[3],o+e[0],a-e[1]-e[3],h-e[2]-e[0]):Vt.set(t,r-e[3],o-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),Vt.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),Vt.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?Gt(e,t):e=t,i||(i=t),e.offsetX=Vt.maxX(i),e.offsetY=Vt.maxY(i),Vt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||dt.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){dt.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(Vt.copy(Yt,t),Vt.toOuterOf(Yt,e),Yt),getOuterOf:(t,e)=>(t=Object.assign({},t),Vt.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 Ut.x=t.x,Ut.y=t.y,Ot(e,Ut,Nt),Lt(Pt,Nt.x,Nt.y),Ut.x=t.x+t.width,Ot(e,Ut,Nt),Rt(Pt,Nt.x,Nt.y),Ut.y=t.y+t.height,Ot(e,Ut,Nt),Rt(Pt,Nt.x,Nt.y),Ut.x=t.x,Ot(e,Ut,Nt),Rt(Pt,Nt.x,Nt.y),Ct(Pt,i)},toInnerOf(t,e,i){i||(i=t),Vt.move(i,-e.e,-e.f),Vt.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,Vt.getFitScale(t,e));return new mt(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),o(s)&&(s=Vt.getFitScale(t,e,"cover"===s)),Yt.width=n?e.width*=s:e.width*s,Yt.height=n?e.height*=s:e.height*s,Tt.toPoint(i,Yt,t,r,!0,!0)},getSpread(t,e,i){const s={};return Vt.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){Vt.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){Vt.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?At(t.width+e-t.x):At(t.width),t.height=i>t.y?At(t.height+i-t.y):At(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=Mt(t.x,e),t.y=Mt(t.y,e),t.width=Mt(t.width,e),t.height=Mt(t.height,e)},add(t,e,i){Wt=t.x+t.width,Ft=t.y+t.height,zt=e.x,Ht=e.y,i||(zt+=e.width,Ht+=e.height),Wt=Wt>zt?Wt:zt,Ft=Ft>Ht?Ft:Ht,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=Wt-t.x,t.height=Ft-t.y},addList(t,e){Vt.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){Vt.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){Vt.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)):jt(t,n));r&&Vt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Lt(Pt,t.x,t.y):Rt(Pt,t.x,t.y)),Ct(Pt,t)},setPoint(t,e){Vt.set(t,e.x,e.y)},addPoint(t,e){jt(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}]},hitRadiusPoint:(t,e,i)=>(i&&(e=dt.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=dt.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=Vt.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=Vt.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=Vt.tempToOuterOf(e,i)),!Vt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:n,width:r,height:o}=e;return Wt=s+r,Ft=n+o,zt=t.x+t.width,Ht=t.y+t.height,s=s>t.x?s:t.x,n=n>t.y?n:t.y,Wt=Wt<zt?Wt:zt,Ft=Ft<Ht?Ft:Ht,r=Wt-s,o=Ft-n,{x:s,y:n,width:r,height:o}},intersect(t,e,i){Vt.copy(t,Vt.getIntersectData(t,e,i))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,reset(t){Vt.set(t)}},Vt=Xt,{add:jt,copy:Gt}=Vt;class Kt{get minX(){return Xt.minX(this)}get minY(){return Xt.minY(this)}get maxX(){return Xt.maxX(this)}get maxY(){return Xt.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return c(t)?Xt.copy(this,t):Xt.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 Kt(this)}move(t,e){return Xt.move(this,t,e),this}scale(t,e,i){return Xt.scale(this,t,e,i),this}scaleOf(t,e,i){return Xt.scaleOf(this,t,e,i),this}toOuterOf(t,e){return Xt.toOuterOf(this,t,e),this}toInnerOf(t,e){return Xt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Xt.getFitMatrix(this,t,e)}put(t,e,i){Xt.put(this,t,e,i)}spread(t,e){return Xt.spread(this,t,e),this}shrink(t,e){return Xt.shrink(this,t,e),this}ceil(){return Xt.ceil(this),this}unsign(){return Xt.unsign(this),this}float(t){return Xt.float(this,t),this}add(t){return Xt.add(this,t),this}addList(t){return Xt.setList(this,t,!0),this}setList(t){return Xt.setList(this,t),this}addListWithFn(t,e){return Xt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Xt.setListWithFn(this,t,e),this}setPoint(t){return Xt.setPoint(this,t),this}setPoints(t){return Xt.setPoints(this,t),this}addPoint(t){return Xt.addPoint(this,t),this}getPoints(){return Xt.getPoints(this)}hitPoint(t,e){return Xt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Xt.hitRadiusPoint(this,t,e)}hit(t,e){return Xt.hit(this,t,e)}includes(t,e){return Xt.includes(this,t,e)}intersect(t,e){return Xt.intersect(this,t,e),this}getIntersect(t,e){return new Kt(Xt.getIntersectData(this,t,e))}isSame(t){return Xt.isSame(this,t)}isEmpty(){return Xt.isEmpty(this)}reset(){Xt.reset(this)}}const Zt=new Kt;class qt{constructor(t,e,i,s,n,r){c(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 Kt(n,e,r||t.width-n-i,o||t.height-e-s)}}const Jt={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1},{randColor:$t}=F;class Qt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new Qt(t)}static set filter(t){this.filterList=te(t)}static set exclude(t){this.excludeList=te(t)}static drawRepaint(t,e){const i=$t();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===Qt.showBounds,n=t.__nowWorld,r=$t();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(ee.enable){if(ee.filterList.length&&ee.filterList.every(t=>t!==this.name))return;if(ee.excludeList.length&&ee.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){ee.enable&&this.warn(...t)}warn(...t){ee.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 te(t){return t?o(t)&&(t=[t]):t=[],t}Qt.filterList=[],Qt.excludeList=[],Qt.showWarn=!0;const ee=Qt,ie=Qt.get("RunTime"),se={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=w.create(w.RUNTIME);return ne.currentId=ne.idMap[i]=e?performance.now():Date.now(),ne.currentName=ne.nameMap[i]=t,ne.nameToIdMap[t]=i,i},end(t,e){const i=ne.idMap[t],s=ne.nameMap[t],n=e?(performance.now()-i)/1e3:Date.now()-i;ne.idMap[t]=ne.nameMap[t]=ne.nameToIdMap[s]=void 0,ie.log(s,n,"ms")},endOfName(t,e){const i=ne.nameToIdMap[t];n(i)||ne.end(i,e)}},ne=se,re=[],oe={list:{},add(t,...e){this.list[t]=!0,re.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(()=>re.forEach(t=>oe.has(t,!0)));const ae={editor:t=>oe.need("editor")},he=Qt.get("UICreator"),le={list:{},register(t){const{__tag:e}=t.prototype;de[e]&&he.repeat(e),de[e]=t},get(t,e,i,s,r,o){de[t]||he.error("not register "+t);const a=new de[t](e);return n(i)||(a.x=i,s&&(a.y=s),r&&(a.width=r),o&&(a.height=o)),a}},{list:de}=le,ce=Qt.get("EventCreator"),ue={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],o(e)&&(pe[e]&&ce.repeat(e),pe[e]=t)})},changeName(t,e){const i=pe[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,pe[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new pe[t](...e)},{nameList:pe}=ue;class ge{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=ae.canvas(t);return this.add(s),s}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let i=0,s=this.list.length;i<s;i++)t=this.list[i],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach(t=>{t.destroy()}),this.list.length=0}destroy(){this.clear()}}function _e(t,e,i,s){var 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 fe(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){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(o,a)}h((s=s.apply(t,e||[])).next())})}function me(t){return(e,i)=>{t||(t=i);const s={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===i&&(s.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,i,s)}}"function"==typeof SuppressedError&&SuppressedError;const ye=[];function ve(){return(t,e)=>{ye.push(e)}}const xe=[];class we{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||xe)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;ye.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){c(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}}_e([me("imageSmoothingEnabled")],we.prototype,"smooth",void 0),_e([me("imageSmoothingQuality")],we.prototype,"smoothLevel",void 0),_e([me("globalAlpha")],we.prototype,"opacity",void 0),_e([me()],we.prototype,"fillStyle",void 0),_e([me()],we.prototype,"strokeStyle",void 0),_e([me("lineWidth")],we.prototype,"strokeWidth",void 0),_e([me("lineCap")],we.prototype,"strokeCap",void 0),_e([me("lineJoin")],we.prototype,"strokeJoin",void 0),_e([me("lineDashOffset")],we.prototype,"dashOffset",void 0),_e([me()],we.prototype,"miterLimit",void 0),_e([me()],we.prototype,"shadowBlur",void 0),_e([me()],we.prototype,"shadowColor",void 0),_e([me()],we.prototype,"shadowOffsetX",void 0),_e([me()],we.prototype,"shadowOffsetY",void 0),_e([me()],we.prototype,"filter",void 0),_e([me()],we.prototype,"font",void 0),_e([me()],we.prototype,"fontKerning",void 0),_e([me()],we.prototype,"fontStretch",void 0),_e([me()],we.prototype,"fontVariantCaps",void 0),_e([me()],we.prototype,"textAlign",void 0),_e([me()],we.prototype,"textBaseline",void 0),_e([me()],we.prototype,"textRendering",void 0),_e([me()],we.prototype,"wordSpacing",void 0),_e([me()],we.prototype,"letterSpacing",void 0),_e([me()],we.prototype,"direction",void 0),_e([ve()],we.prototype,"setTransform",null),_e([ve()],we.prototype,"resetTransform",null),_e([ve()],we.prototype,"getTransform",null),_e([ve()],we.prototype,"save",null),_e([ve()],we.prototype,"restore",null),_e([ve()],we.prototype,"translate",null),_e([ve()],we.prototype,"scale",null),_e([ve()],we.prototype,"rotate",null),_e([ve()],we.prototype,"fill",null),_e([ve()],we.prototype,"stroke",null),_e([ve()],we.prototype,"clip",null),_e([ve()],we.prototype,"fillRect",null),_e([ve()],we.prototype,"strokeRect",null),_e([ve()],we.prototype,"clearRect",null),_e([ve()],we.prototype,"beginPath",null),_e([ve()],we.prototype,"moveTo",null),_e([ve()],we.prototype,"lineTo",null),_e([ve()],we.prototype,"bezierCurveTo",null),_e([ve()],we.prototype,"quadraticCurveTo",null),_e([ve()],we.prototype,"closePath",null),_e([ve()],we.prototype,"arc",null),_e([ve()],we.prototype,"arcTo",null),_e([ve()],we.prototype,"ellipse",null),_e([ve()],we.prototype,"rect",null),_e([ve()],we.prototype,"roundRect",null),_e([ve()],we.prototype,"createConicGradient",null),_e([ve()],we.prototype,"createLinearGradient",null),_e([ve()],we.prototype,"createPattern",null),_e([ve()],we.prototype,"createRadialGradient",null),_e([ve()],we.prototype,"fillText",null),_e([ve()],we.prototype,"measureText",null),_e([ve()],we.prototype,"strokeText",null);const{copy:Ee,multiplyParent:be,pixelScale:ke}=Q,{round:Se}=Math,Be=new Kt,Te=new Kt,Pe={width:1,height:1,pixelRatio:1},Le=["width","height","pixelRatio"];class Re extends we{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=Pe),this.manager=e,this.innerId=w.create(w.CNAVAS);const{width:i,height:s,pixelRatio:n}=t;this.autoLayout=!i||!s,this.size.pixelRatio=n||v.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,Le),Le.forEach(t=>s[t]||(s[t]=1)),this.bounds=new Kt(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&&be(t,e,n),ke(t,i,n),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(n.e=Se(n.e-.5)+.5,n.f=Se(n.f-.5)+.5):(n.e=Se(n.e),n.f=Se(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:r,dashOffset:o,miterLimit:a}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(s=e.strokeJoin),n(e.dashPattern)||(r=e.dashPattern),n(e.dashOffset)||(o=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=i,this.strokeJoin=s,this.dashPattern=r,this.dashOffset=o,this.miterLimit=a}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return!0}hitStroke(t,e){return!0}hitPixel(t,e,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=!0){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,n),i?(this.setTempPixelBounds2(i,n),i=Te):i=Be,this.drawImage(t.view,Be.x,Be.y,Be.width,Be.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=!0){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Xt.tempToOuterOf(i,e),s,n),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,n),this.drawImage(t.view,Be.x,Be.y,Be.width,Be.height,i.x,i.y,i.width,i.height),s&&(this.blendMode="source-over"))}copyWorldByReset(t,e,i,s,n,r=!0){this.resetTransform(),this.copyWorld(t,e,i,s,r),n||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempPixelBounds(t,!0,!0);const{context:s}=this,n=s.getImageData(Be.x,Be.y,Be.width,Be.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,Be.x,Be.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(Be.x,Be.y,Be.width,Be.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(Be.x,Be.y,Be.width,Be.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(Be.x,Be.y,Be.width,Be.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(Be.x,Be.y,Be.width,Be.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(Be,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(Te,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):ae.canvas(Object.assign({},i));return n.save(),t&&(Ee(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 Ce={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Oe={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},Oe),De={M:3,m:3,L:3,l:3,H:2,h:2,V:2,v:2,C:7,c:7,S:5,s:5,Q:5,q:5,T:3,t:3,A:8,a:8,Z:1,z:1,N:5,D:9,X:6,G:9,F:5,O:7,P:4,U:6},Ie={m:10,l:20,H:3,h:30,V:4,v:40,c:50,S:6,s:60,q:70,T:8,t:80,A:9,a:90},Ae=Object.assign(Object.assign({},Ie),Oe),We=Me,Fe={};for(let t in We)Fe[We[t]]=t;const ze={};for(let t in We)ze[We[t]]=De[t];const He={drawRoundRect(t,e,i,s,n,r){const o=F.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:Ue,cos:Ne,hypot:Ye,atan2:Xe,ceil:Ve,abs:je,PI:Ge,sqrt:Ke,pow:Ze}=Math,{setPoint:qe,addPoint:Je}=vt,{set:$e,toNumberPoints:Qe}=dt,{M:ti,L:ei,C:ii,Q:si,Z:ni}=Me,ri={},oi={points(t,e,i,s){let n=Qe(e);if(t.push(ti,n[0],n[1]),i&&n.length>5){let e,r,o,a,h,l,d,c,u,p,g,_,f,m=n.length;const y=!0===i?.5:i;s&&(n=[n[m-2],n[m-1],...n,n[0],n[1],n[2],n[3]],m=n.length);for(let i=2;i<m-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],g=Ke(Ze(o-e,2)+Ze(a-r,2)),_=Ke(Ze(h-o,2)+Ze(l-a,2)),(g||_)&&(f=g+_,g=y*g/f,_=y*_/f,h-=e,l-=r,d=o-g*h,c=a-g*l,2===i?s||t.push(si,d,c,o,a):t.push(ii,u,p,d,c,o,a),u=o+_*h,p=a+_*l);s||t.push(si,u,p,n[m-2],n[m-1])}else for(let e=2,i=n.length;e<i;e+=2)t.push(ei,n[e],n[e+1]);s&&t.push(ni)},rect(t,e,i,s,n){Ce.creator.path=t,Ce.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){Ce.creator.path=[],He.drawRoundRect(Ce.creator,e,i,s,n,r),t.push(...Ce.convertToCanvasData(Ce.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,g=o-n;let _=Xe(u,c),f=Xe(g,p);const m=Ye(c,u),y=Ye(p,g);let v=f-_;if(v<0&&(v+=U),m<1e-12||y<1e-12||v<1e-12||je(v-Ge)<1e-12)return t&&t.push(ei,s,n),h&&(qe(h,e,i),Je(h,s,n)),d&&$e(d,e,i),void(l&&$e(l,s,n));const x=c*g-p*u<0,w=x?-1:1,E=a/Ne(v/2),b=s+E*Ne(_+v/2+N*w),k=n+E*Ue(_+v/2+N*w);return _-=N*w,f-=N*w,li(t,b,k,a,a,0,_/H,f/H,x,h,l,d)},arc:(t,e,i,s,n,r,o,a,h,l)=>li(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*H,p=Ue(u),g=Ne(u);let _=o*H,f=a*H;_>Ge&&(_-=U),f<0&&(f+=U);let m=f-_;m<0?m+=U:m>U&&(m-=U),h&&(m-=U);const y=Ve(je(m/N)),v=m/y,x=Ue(v/4),w=8/3*x*x/Ue(v/2);f=_+v;let E,b,k,S,B,T,P,L,R=Ne(_),C=Ue(_),O=k=g*s*R-p*n*C,M=S=p*s*R+g*n*C,D=e+k,I=i+S;t&&t.push(t.length?ei:ti,D,I),l&&qe(l,D,I),c&&$e(c,D,I);for(let r=0;r<y;r++)E=Ne(f),b=Ue(f),k=g*s*E-p*n*b,S=p*s*E+g*n*b,B=e+O-w*(g*s*C+p*n*R),T=i+M-w*(p*s*C-g*n*R),P=e+k+w*(g*s*b+p*n*E),L=i+S+w*(p*s*b-g*n*E),t&&t.push(ii,B,T,P,L,e+k,i+S),l&&hi(e+O,i+M,B,T,P,L,e+k,i+S,l,!0),O=k,M=S,R=E,C=b,_=f,f+=v;d&&$e(d,e+k,i+S)},quadraticCurveTo(t,e,i,s,n,r,o){t.push(ii,(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){hi(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,m,y,v=t,x=i,w=n,E=o;for(let t=0;t<2;++t)if(1==t&&(v=e,x=s,w=r,E=a),c=-3*v+9*x-9*w+3*E,u=6*v-12*x+6*w,p=3*x-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;g=-p/u,0<g&&g<1&&d.push(g)}else m=u*u-4*p*c,y=Math.sqrt(m),m<0||(_=(-u+y)/(2*c),0<_&&_<1&&d.push(_),f=(-u-y)/(2*c),0<f&&f<1&&d.push(f));l?Je(h,t,e):qe(h,t,e),Je(h,o,a);for(let l=0,c=d.length;l<c;l++)ai(d[l],t,e,i,s,n,r,o,a,ri),Je(h,ri.x,ri.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,g=t*t*t;l.x=c*e+u*s+p*r+g*a,l.y=c*i+u*n+p*o+g*h},getPoint(t,e,i,s,n,r,o,a,h){const l={};return ai(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)}},{getPointAndSet:ai,toTwoPointBounds:hi,ellipse:li}=oi,{sin:di,cos:ci,sqrt:ui,atan2:pi}=Math,{ellipse:gi}=oi,_i={ellipticalArc(t,e,i,s,n,r,o,a,h,l,d){const c=(h-e)/2,u=(l-i)/2,p=r*H,g=di(p),_=ci(p),f=-_*c-g*u,m=-_*u+g*c,y=s*s,x=n*n,w=m*m,E=f*f,b=y*x-y*w-x*E;let k=0;if(b<0){const t=ui(1-b/(y*x));s*=t,n*=t}else k=(o===a?-1:1)*ui(b/(y*w+x*E));const S=k*s*m/n,B=-k*n*f/s,T=pi((m-B)/n,(f-S)/s),P=pi((-m-B)/n,(-f-S)/s);let L=P-T;0===a&&L>0?L-=U:1===a&&L<0&&(L+=U);const R=e+c+_*S-g*B,C=i+u+g*S+_*B,O=L<0?1:0;d||v.ellipseToCurve?gi(t,R,C,s,n,r,T/H,P/H,O):s!==n||r?t.push(Me.G,R,C,s,n,r,T/H,P/H,O):t.push(Me.O,R,C,s,T/H,P/H,O)}},fi={toCommand:t=>[],toNode:t=>[]},{M:mi,m:yi,L:vi,l:xi,H:wi,h:Ei,V:bi,v:ki,C:Si,c:Bi,S:Ti,s:Pi,Q:Li,q:Ri,T:Ci,t:Oi,A:Mi,a:Di,Z:Ii,z:Ai,N:Wi,D:Fi,X:zi,G:Hi,F:Ui,O:Ni,P:Yi,U:Xi}=Me,{rect:Vi,roundRect:ji,arcTo:Gi,arc:Ki,ellipse:Zi,quadraticCurveTo:qi}=oi,{ellipticalArc:Ji}=_i,$i=Qt.get("PathConvert"),Qi={},ts={current:{dot:0},stringify(t,e){let i,s,n,r=0,o=t.length,a="";for(;r<o;){s=t[r],i=ze[s],a+=s===n?" ":Fe[s];for(let s=1;s<i;s++)a+=F.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?Ae:Ie;for(let e=0,h=t.length;e<h;e++)s=t[e],Jt[s]?("."===s&&(es.dot&&(is(o,r),r=""),es.dot++),"0"===r&&"."!==s&&(is(o,r),r=""),r+=s):Me[s]?(r&&(is(o,r),r=""),es.name=Me[s],es.length=De[s],es.index=0,is(o,es.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===n||"E"===n?r+=s:(r&&is(o,r),r=s):r&&(is(o,r),r=""),n=s;return r&&is(o,r),i?ts.toCanvasData(o,e):o},toCanvasData(t,e){let i,s,n,r,o,a=0,h=0,l=0,d=0,c=0,u=t.length;const p=[];for(;c<u;){switch(n=t[c],n){case yi:t[c+1]+=a,t[c+2]+=h;case mi:a=t[c+1],h=t[c+2],p.push(mi,a,h),c+=3;break;case Ei:t[c+1]+=a;case wi:a=t[c+1],p.push(vi,a,h),c+=2;break;case ki:t[c+1]+=h;case bi:h=t[c+1],p.push(vi,a,h),c+=2;break;case xi:t[c+1]+=a,t[c+2]+=h;case vi:a=t[c+1],h=t[c+2],p.push(vi,a,h),c+=3;break;case Pi:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=Ti;case Ti:o=r===Si||r===Ti,l=o?2*a-i:t[c+1],d=o?2*h-s:t[c+2],i=t[c+1],s=t[c+2],a=t[c+3],h=t[c+4],p.push(Si,l,d,i,s,a,h),c+=5;break;case Bi:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,t[c+5]+=a,t[c+6]+=h,n=Si;case Si:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],p.push(Si,t[c+1],t[c+2],i,s,a,h),c+=7;break;case Oi:t[c+1]+=a,t[c+2]+=h,n=Ci;case Ci:o=r===Li||r===Ci,i=o?2*a-i:t[c+1],s=o?2*h-s:t[c+2],e?qi(p,a,h,i,s,t[c+1],t[c+2]):p.push(Li,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case Ri:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,n=Li;case Li:i=t[c+1],s=t[c+2],e?qi(p,a,h,i,s,t[c+3],t[c+4]):p.push(Li,i,s,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case Di:t[c+6]+=a,t[c+7]+=h;case Mi:Ji(p,a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],e),a=t[c+6],h=t[c+7],c+=8;break;case Ai:case Ii:p.push(Ii),c++;break;case Wi:a=t[c+1],h=t[c+2],e?Vi(p,a,h,t[c+3],t[c+4]):ss(p,t,c,5),c+=5;break;case Fi:a=t[c+1],h=t[c+2],e?ji(p,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):ss(p,t,c,9),c+=9;break;case zi:a=t[c+1],h=t[c+2],e?ji(p,a,h,t[c+3],t[c+4],t[c+5]):ss(p,t,c,6),c+=6;break;case Hi:Zi(e?p:ss(p,t,c,9),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],t[c+7],t[c+8],null,Qi),a=Qi.x,h=Qi.y,c+=9;break;case Ui:e?Zi(p,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):ss(p,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case Ni:Ki(e?p:ss(p,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Qi),a=Qi.x,h=Qi.y,c+=7;break;case Yi:e?Ki(p,t[c+1],t[c+2],t[c+3],0,360,!1):ss(p,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case Xi:Gi(e?p:ss(p,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Qi),a=Qi.x,h=Qi.y,c+=6;break;default:return $i.error(`command: ${n} [index:${c}]`,t),p}r=n}return p},objectToCanvasData(t){if(t[0].name.length>1)return fi.toCommand(t);{const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(mi,t.x,t.y);break;case"L":e.push(vi,t.x,t.y);break;case"C":e.push(Si,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Li,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Ii)}}),e}},copyData(t,e,i,s){for(let n=i,r=i+s;n<r;n++)t.push(e[n])},pushData(t,e){es.index===es.length&&(es.index=1,t.push(es.name)),t.push(Number(e)),es.index++,es.dot=0}},{current:es,pushData:is,copyData:ss}=ts,{M:ns,L:rs,C:os,Q:as,Z:hs,N:ls,D:ds,X:cs,G:us,F:ps,O:gs,P:_s,U:fs}=Me,{getMinDistanceFrom:ms,getRadianFrom:ys}=dt,{tan:vs,min:xs,abs:ws}=Math,Es={},bs={beginPath(t){t.length=0},moveTo(t,e,i){t.push(ns,e,i)},lineTo(t,e,i){t.push(rs,e,i)},bezierCurveTo(t,e,i,s,n,r,o){t.push(os,e,i,s,n,r,o)},quadraticCurveTo(t,e,i,s,n){t.push(as,e,i,s,n)},closePath(t){t.push(hs)},rect(t,e,i,s,n){t.push(ls,e,i,s,n)},roundRect(t,e,i,s,n,r){if(h(r))t.push(cs,e,i,s,n,r);else{const o=F.fourNumber(r);o?t.push(ds,e,i,s,n,...o):t.push(ls,e,i,s,n)}},ellipse(t,e,i,s,n,o,a,h,l){r(o)?t.push(ps,e,i,s,n):(r(a)&&(a=0),r(h)&&(h=360),t.push(us,e,i,s,n,o,a,h,l?1:0))},arc(t,e,i,s,n,o,a){r(n)?t.push(_s,e,i,s):(r(o)&&(o=360),t.push(gs,e,i,s,n,o,a?1:0))},arcTo(t,e,i,s,r,o,a,h){if(!n(a)){const t=ms(a,h,e,i,s,r);o=xs(o,xs(t/2,t/2*ws(vs(ys(a,h,e,i,s,r)/2))))}t.push(fs,e,i,s,r,o)},drawEllipse(t,e,i,s,n,o,a,h,l){oi.ellipse(null,e,i,s,n,r(o)?0:o,r(a)?0:a,r(h)?360:h,l,null,null,Es),t.push(ns,Es.x,Es.y),ks(t,e,i,s,n,o,a,h,l)},drawArc(t,e,i,s,n,o,a){oi.arc(null,e,i,s,r(n)?0:n,r(o)?360:o,a,null,null,Es),t.push(ns,Es.x,Es.y),Ss(t,e,i,s,n,o,a)},drawPoints(t,e,i,s){oi.points(t,e,i,s)}},{ellipse:ks,arc:Ss}=bs,{moveTo:Bs,lineTo:Ts,quadraticCurveTo:Ps,bezierCurveTo:Ls,closePath:Rs,beginPath:Cs,rect:Os,roundRect:Ms,ellipse:Ds,arc:Is,arcTo:As,drawEllipse:Ws,drawArc:Fs,drawPoints:zs}=bs;class Hs{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?o(t)?Ce.parse(t):t:[],this}beginPath(){return Cs(this.__path),this.paint(),this}moveTo(t,e){return Bs(this.__path,t,e),this.paint(),this}lineTo(t,e){return Ts(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,n,r){return Ls(this.__path,t,e,i,s,n,r),this.paint(),this}quadraticCurveTo(t,e,i,s){return Ps(this.__path,t,e,i,s),this.paint(),this}closePath(){return Rs(this.__path),this.paint(),this}rect(t,e,i,s){return Os(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,n){return Ms(this.__path,t,e,i,s,n),this.paint(),this}ellipse(t,e,i,s,n,r,o,a){return Ds(this.__path,t,e,i,s,n,r,o,a),this.paint(),this}arc(t,e,i,s,n,r){return Is(this.__path,t,e,i,s,n,r),this.paint(),this}arcTo(t,e,i,s,n){return As(this.__path,t,e,i,s,n),this.paint(),this}drawEllipse(t,e,i,s,n,r,o,a){return Ws(this.__path,t,e,i,s,n,r,o,a),this.paint(),this}drawArc(t,e,i,s,n,r){return Fs(this.__path,t,e,i,s,n,r),this.paint(),this}drawPoints(t,e,i){return zs(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Us,L:Ns,C:Ys,Q:Xs,Z:Vs,N:js,D:Gs,X:Ks,G:Zs,F:qs,O:Js,P:$s,U:Qs}=Me,tn=Qt.get("PathDrawer"),en={drawPathByData(t,e){if(!e)return;let i,s=0,n=e.length;for(;s<n;)switch(i=e[s],i){case Us:t.moveTo(e[s+1],e[s+2]),s+=3;break;case Ns:t.lineTo(e[s+1],e[s+2]),s+=3;break;case Ys:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case Xs:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Vs:t.closePath(),s+=1;break;case js:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Gs: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 Ks:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case Zs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*H,e[s+6]*H,e[s+7]*H,e[s+8]),s+=9;break;case qs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,U,!1),s+=5;break;case Js:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*H,e[s+5]*H,e[s+6]),s+=7;break;case $s:t.arc(e[s+1],e[s+2],e[s+3],0,U,!1),s+=4;break;case Qs:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void tn.error(`command: ${i} [index:${s}]`,e)}}},{M:sn,L:nn,C:rn,Q:on,Z:an,N:hn,D:ln,X:dn,G:cn,F:un,O:pn,P:gn,U:_n}=Me,{toTwoPointBounds:fn,toTwoPointBoundsByQuadraticCurve:mn,arcTo:yn,arc:vn,ellipse:xn}=oi,{addPointBounds:wn,copy:En,addPoint:bn,setPoint:kn,addBounds:Sn,toBounds:Bn}=vt,Tn=Qt.get("PathBounds");let Pn,Ln,Rn;const Cn={},On={},Mn={},Dn={toBounds(t,e){Dn.toTwoPointBounds(t,On),Bn(On,e)},toTwoPointBounds(t,e){if(!t||!t.length)return kn(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===an||o===rn||o===on?kn(e,h,l):kn(e,t[a+1],t[a+2])),o){case sn:case nn:h=t[a+1],l=t[a+2],bn(e,h,l),a+=3;break;case rn:n=t[a+5],r=t[a+6],fn(h,l,t[a+1],t[a+2],t[a+3],t[a+4],n,r,Cn),wn(e,Cn),h=n,l=r,a+=7;break;case on:i=t[a+1],s=t[a+2],n=t[a+3],r=t[a+4],mn(h,l,i,s,n,r,Cn),wn(e,Cn),h=n,l=r,a+=5;break;case an:a+=1;break;case hn:h=t[a+1],l=t[a+2],Sn(e,h,l,t[a+3],t[a+4]),a+=5;break;case ln:case dn:h=t[a+1],l=t[a+2],Sn(e,h,l,t[a+3],t[a+4]),a+=o===ln?9:6;break;case cn:xn(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],Cn,Mn),0===a?En(e,Cn):wn(e,Cn),h=Mn.x,l=Mn.y,a+=9;break;case un:h=t[a+1],l=t[a+2],Ln=t[a+3],Rn=t[a+4],Sn(e,h-Ln,l-Rn,2*Ln,2*Rn),h+=Ln,a+=5;break;case pn:vn(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Cn,Mn),0===a?En(e,Cn):wn(e,Cn),h=Mn.x,l=Mn.y,a+=7;break;case gn:h=t[a+1],l=t[a+2],Pn=t[a+3],Sn(e,h-Pn,l-Pn,2*Pn,2*Pn),h+=Pn,a+=4;break;case _n:yn(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Cn,Mn),0===a?En(e,Cn):wn(e,Cn),h=Mn.x,l=Mn.y,a+=6;break;default:return void Tn.error(`command: ${o} [index:${a}]`,t)}}},{M:In,L:An,Z:Wn}=Me,{getCenterX:Fn,getCenterY:zn}=dt,{arcTo:Hn}=bs,Un={smooth(t,e,i){let s,n,r,o=0,a=0,h=0,l=0,d=0,c=0,u=0,p=0,g=0;const _=t.length,f=[];for(;o<_;){switch(s=t[o],s){case In:l=p=t[o+1],d=g=t[o+2],o+=3,t[o]===An?(c=t[o+1],u=t[o+2],f.push(In,Fn(l,c),zn(d,u))):f.push(In,l,d);break;case An:switch(a=t[o+1],h=t[o+2],o+=3,t[o]){case An:Hn(f,a,h,t[o+1],t[o+2],e,p,g);break;case Wn:Hn(f,a,h,l,d,e,p,g);break;default:f.push(An,a,h)}p=a,g=h;break;case Wn:n!==Wn&&(Hn(f,l,d,c,u,e,p,g),f.push(Wn)),o+=1;break;default:r=ze[s];for(let e=0;e<r;e++)f.push(t[o+e]);o+=r}n=s}return s!==Wn&&(f[1]=l,f[2]=d),f}};function Nn(t){return new Hs(t)}const Yn=Nn();Ce.creator=Nn(),Ce.parse=ts.parse,Ce.convertToCanvasData=ts.toCanvasData;const{drawRoundRect:Xn}=He;function Vn(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,n){Xn(this,t,e,i,s,n)})}(t)}const jn={alphaPixelTypes:["png","webp","svg"],upperCaseTypeMap:{},mineType:t=>!t||t.startsWith("image")?t:("jpg"===t&&(t="jpeg"),"image/"+t),fileType(t){const e=t.split(".");return e[e.length-1]},isOpaqueImage(t){const e=Gn.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{}}}},Gn=jn;Gn.alphaPixelTypes.forEach(t=>Gn.upperCaseTypeMap[t]=t.toUpperCase());const Kn=Qt.get("TaskProcessor");class Zn{constructor(t){this.parallel=!0,this.time=1,this.id=w.create(w.TASK),this.task=t}run(){return fe(this,void 0,void 0,function*(){try{if(this.isComplete)return;if(this.canUse&&!this.canUse())return this.cancel();this.task&&this.parent.running&&(yield this.task())}catch(t){Kn.error(t)}})}complete(){this.isComplete=!0,this.parent=this.task=this.canUse=null}cancel(){this.isCancel=!0,this.complete()}}class qn{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,r,o,a;const l=new Zn(t);return l.parent=this,h(e)?a=e:e&&(r=e.parallel,s=e.start,o=e.time,a=e.delay,i||(i=e.canUse)),o&&(l.time=o),!1===r&&(l.parallel=!1),i&&(l.canUse=i),n(a)?this.push(l,s):(this.delayNumber++,setTimeout(()=>{this.delayNumber&&(this.delayNumber--,this.push(l,s))},a)),this.isComplete=!1,l}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout(()=>this.start()))}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[],this.delayNumber=0}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach(t=>{t.isComplete||t.cancel()}),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then(()=>{this.onTask(t),this.index++,t.isCancel?this.runTask():this.nextTask()}).catch(t=>{this.onError(t)}):this.timer=setTimeout(()=>this.nextTask())}runParallelTasks(){this.parallelList.forEach(t=>this.runParallelTask(t))}runParallelTask(t){t.run().then(()=>{this.onTask(t),this.fillParallelTask()}).catch(t=>{this.onParallelError(t)})}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=setTimeout(()=>this.run())}setParallelList(){let t;const{config:e,list:i,index:s}=this;this.parallelList=[],this.parallelSuccessNumber=0;let 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 Jn=Qt.get("Resource"),$n={tasker:new qn,map:{},get isComplete(){return Qn.tasker.isComplete},set(t,e){Qn.map[t]&&Jn.repeat(t),Qn.map[t]=e},get:t=>Qn.map[t],remove(t){const e=Qn.map[t];e&&(e.destroy&&e.destroy(),delete Qn.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 o(e)?s={url:e}:e.url||(s={url:t,view:e}),s&&(i&&(s.format=i),e=ae.image(s)),Qn.set(t,e),e},destroy(){Qn.map={}}},Qn=$n,tr={maxRecycled:10,recycledList:[],patternTasker:new qn,get(t){let e=$n.get(t.url);return e||$n.set(t.url,e=ae.image(t)),e.use++,e},recycle(t){t.use--,setTimeout(()=>{t.use||er.recycledList.push(t)})},clearRecycled(){const t=er.recycledList;t.length>er.maxRecycled&&(t.forEach(t=>!t.use&&t.url&&$n.remove(t.url)),t.length=0)},hasAlphaPixel:t=>jn.alphaPixelTypes.some(e=>er.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:"+jn.mineType(t)))return!0}else{if(i.includes("."+t)||i.includes("."+jn.upperCaseTypeMap[t]))return!0;if("png"===t&&!i.includes("."))return!0}return!1},destroy(){er.recycledList=[]}},er=tr,{IMAGE:ir,create:sr}=w;class nr{get url(){return this.config.url}get completed(){return this.ready||!!this.error}constructor(t){if(this.use=0,this.waitComplete=[],this.innerId=sr(ir),this.config=t||(t={url:""}),t.view){const{view:e}=t;this.setView(e.config?e.view:e)}tr.isFormat("svg",t)&&(this.isSVG=!0),tr.hasAlphaPixel(t)&&(this.hasAlphaPixel=!0)}load(t,e){if(!this.loading){this.loading=!0;const{crossOrigin:t}=this.config;$n.tasker.add(()=>fe(this,void 0,void 0,function*(){return yield v.origin.loadImage(this.url,n(t)?v.image.crossOrigin:t,this).then(t=>this.setView(t)).catch(t=>{this.error=t,this.onComplete(!1)})}))}return this.waitComplete.push(t,e),this.waitComplete.length-2}unload(t,e){const i=this.waitComplete;if(e){const e=i[t+1];e&&e({type:"stop"})}i[t]=i[t+1]=void 0}setView(t){this.ready=!0,this.width=t.naturalWidth||t.width,this.height=t.naturalHeight||t.height,this.view=t,this.onComplete(!0)}onComplete(t){let e;this.waitComplete.forEach((i,s)=>{e=s%2,i&&(t?e||i(this):e&&i(this.error))}),this.waitComplete.length=0,this.loading=!1}getFull(t){return this.view}getCanvas(t,e,i,s,n,r,o){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 a=v.image.resize(this.view,t,e,n,r,void 0,o,i,s);return this.cache=this.use>1?{data:a,params:arguments}:null,a}getPattern(t,e,i,s){const n=v.canvas.createPattern(t,e);return v.image.setPatternTransform(n,i,s),n}destroy(){this.config={url:""},this.cache=null,this.waitComplete.length=0}}function rr(t,e,i,s){s||(i.configurable=i.enumerable=!0),Object.defineProperty(t,e,i)}function or(t,e){return Object.getOwnPropertyDescriptor(t,e)}function ar(t,e){const i="_"+t;return{get(){const t=this[i];return null==t?e:t},set(t){this[i]=t}}}function hr(t,e){return(i,s)=>dr(i,s,t,e&&e(s))}function lr(t){return t}function dr(t,e,i,s){const n={get(){return this.__getAttr(e)},set(t){this.__setAttr(e,t)}};rr(t,e,Object.assign(n,s||{})),Fr(t,e,i)}function cr(t){return hr(t)}function ur(t,e){return hr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange())}}))}function pr(t,e){return hr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.matrixChanged||this.__layout.matrixChange(),this.__scrollWorld||(this.__scrollWorld={}))}}))}function gr(t){return hr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__hasAutoLayout=!!(this.origin||this.around||this.flow),this.__local||this.__layout.createLocal(),vr(this))}}))}function _r(t,e){return hr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.scaleChanged||this.__layout.scaleChange())}}))}function fr(t,e){return hr(t,t=>({set(i){this.__setAttr(t,i,e)&&(this.__layout.rotationChanged||this.__layout.rotationChange())}}))}function mr(t,e){return hr(t,t=>({set(i){this.__setAttr(t,i,e)&&vr(this)}}))}function yr(t){return hr(t,t=>({set(e){this.__setAttr(t,e)&&(vr(this),this.__.__removeNaturalSize())}}))}function vr(t){t.__layout.boxChanged||t.__layout.boxChange(),t.__hasAutoLayout&&(t.__layout.matrixChanged||t.__layout.matrixChange())}function xr(t){return hr(t,t=>({set(e){const i=this.__;2!==i.__pathInputed&&(i.__pathInputed=e?1:0),e||(i.__pathForRender=void 0),this.__setAttr(t,e),vr(this)}}))}const wr=mr;function Er(t,e){return hr(t,t=>({set(i){this.__setAttr(t,i)&&(br(this),e&&(this.__.__useStroke=!0))}}))}function br(t){t.__layout.strokeChanged||t.__layout.strokeChange(),t.__.__useArrow&&vr(t)}const kr=Er;function Sr(t){return hr(t,t=>({set(e){this.__setAttr(t,e),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Br(t){return hr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChanged||this.__layout.surfaceChange())}}))}function Tr(t){return hr(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__;g.stintSet(t,"__useDim",t.dim||t.bright||t.dimskip),this.__layout.surfaceChange()}}}))}function Pr(t){return hr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.opacityChanged||this.__layout.opacityChange()),this.mask&&Rr(this)}}))}function Lr(t){return hr(t,t=>({set(e){const i=this.visible;if(!0===i&&0===e){if(this.animationOut)return this.__runAnimation("out",()=>Cr(this,t,e,i))}else 0===i&&!0===e&&this.animation&&this.__runAnimation("in");Cr(this,t,e,i),this.mask&&Rr(this)}}))}function Rr(t){const{parent:e}=t;if(e){const{__hasMask:t}=e;e.__updateMask(),t!==e.__hasMask&&e.forceUpdate()}}function Cr(t,e,i,s){t.__setAttr(e,i)&&(t.__layout.opacityChanged||t.__layout.opacityChange(),0!==s&&0!==i||vr(t))}function Or(t){return hr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.surfaceChange(),this.waitParent(()=>{this.parent.__layout.childrenSortChange()}))}}))}function Mr(t){return hr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.boxChanged||this.__layout.boxChange(),this.waitParent(()=>{this.parent.__updateMask(e)}))}}))}function Dr(t){return hr(t,t=>({set(e){this.__setAttr(t,e)&&this.waitParent(()=>{this.parent.__updateEraser(e)})}}))}function Ir(t){return hr(t,t=>({set(e){this.__setAttr(t,e)&&(this.__layout.hitCanvasChanged=!0,"hit"===Qt.showBounds&&this.__layout.surfaceChange(),this.leafer&&this.leafer.updateCursor())}}))}function Ar(t){return hr(t,t=>({set(e){this.__setAttr(t,e),this.leafer&&this.leafer.updateCursor()}}))}function Wr(t){return(e,i)=>{rr(e,"__DataProcessor",{get:()=>t})}}function Fr(t,e,i){const s=t.__DataProcessor.prototype,r="_"+e,o=function(t){return"set"+t.charAt(0).toUpperCase()+t.slice(1)}(e),a=ar(e,i);if(n(i))a.get=function(){return this[r]};else if("function"==typeof i)a.get=function(){const t=this[r];return null==t?i(this.__leaf):t};else if(c(i)){const t=p(i);a.get=function(){const e=this[r];return null==e?this[r]=t?{}:g.clone(i):e}}const h=t.isBranchLeaf;"width"===e?a.get=function(){const t=this[r];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[r];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=or(d,e),d=d.__proto__;l&&l.set&&(a.set=l.set),s[o]&&(a.set=s[o],delete s[o]),rr(s,e,a)}const zr=new Qt("rewrite"),Hr=[],Ur=["destroy","constructor"];function Nr(t){return(e,i)=>{Hr.push({name:e.constructor.name+"."+i,run:()=>{e[i]=t}})}}function Yr(){return t=>{Xr()}}function Xr(t){Hr.length&&(Hr.forEach(e=>{t&&zr.error(e.name,"需在Class上装饰@rewriteAble()"),e.run()}),Hr.length=0)}function Vr(t,e){return i=>{var s;(t.prototype?(s=t.prototype,Object.getOwnPropertyNames(s)):Object.keys(t)).forEach(s=>{if(!(Ur.includes(s)||e&&e.includes(s)))if(t.prototype){or(t.prototype,s).writable&&(i.prototype[s]=t.prototype[s])}else i.prototype[s]=t[s]})}}function jr(){return t=>{le.register(t)}}function Gr(){return t=>{ue.register(t)}}setTimeout(()=>Xr(!0));const{copy:Kr,toInnerPoint:Zr,toOuterPoint:qr,scaleOfOuter:Jr,rotateOfOuter:$r,skewOfOuter:Qr,multiplyParent:to,divideParent:eo,getLayout:io}=Q,so={},{round:no}=Math,ro={updateAllMatrix(t,e,i){if(e&&t.__hasAutoLayout&&t.__layout.matrixChanged&&(i=!0),ho(t,e,i),t.isBranch){const{children:s}=t;for(let t=0,n=s.length;t<n;t++)ao(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++)lo(e[t])}},updateChange(t){const e=t.__layout;e.stateStyleChanged&&t.updateState(),e.opacityChanged&&lo(t),t.__updateChange()},updateAllChange(t){if(uo(t),t.isBranch){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)co(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||v.fullImageShadow?e.copyWorldByReset(i,s,t.__nowWorld,n,r):e.copyWorldToInner(i,s,t.__layout.renderBounds,n)},moveWorld(t,e,i=0,s,n){const r=c(e)?Object.assign({},e):{x:e,y:i};s?qr(t.localTransform,r,r,!0):t.parent&&Zr(t.parent.scrollWorldTransform,r,r,!0),oo.moveLocal(t,r.x,r.y,n)},moveLocal(t,e,i=0,s){c(e)&&(i=e.y,e=e.x),e+=t.x,i+=t.y,t.leafer&&t.leafer.config.pointSnap&&(e=no(e),i=no(i)),s?t.animate({x:e,y:i},s):(t.x=e,t.y=i)},zoomOfWorld(t,e,i,s,n,r){oo.zoomOfLocal(t,po(t,e),i,s,n,r)},zoomOfLocal(t,e,i,s=i,n,r){const o=t.__localMatrix;if(h(s)||(s&&(r=s),s=i),Kr(so,o),Jr(so,e,i,s),oo.hasHighPosition(t))oo.setTransform(t,so,n,r);else{const e=t.x+so.e-o.e,a=t.y+so.f-o.f;r&&!n?t.animate({x:e,y:a,scaleX:t.scaleX*i,scaleY:t.scaleY*s},r):(t.x=e,t.y=a,t.scaleResize(i,s,!0!==n))}},rotateOfWorld(t,e,i,s){oo.rotateOfLocal(t,po(t,e),i,s)},rotateOfLocal(t,e,i,s){const n=t.__localMatrix;Kr(so,n),$r(so,e,i),oo.hasHighPosition(t)?oo.setTransform(t,so,!1,s):t.set({x:t.x+so.e-n.e,y:t.y+so.f-n.f,rotation:F.formatRotation(t.rotation+i)},s)},skewOfWorld(t,e,i,s,n,r){oo.skewOfLocal(t,po(t,e),i,s,n,r)},skewOfLocal(t,e,i,s=0,n,r){Kr(so,t.__localMatrix),Qr(so,e,i,s),oo.setTransform(t,so,n,r)},transformWorld(t,e,i,s){Kr(so,t.worldTransform),to(so,e),t.parent&&eo(so,t.parent.scrollWorldTransform),oo.setTransform(t,so,i,s)},transform(t,e,i,s){Kr(so,t.localTransform),to(so,e),oo.setTransform(t,so,i,s)},setTransform(t,e,i,s){const n=t.__,r=n.origin&&oo.getInnerOrigin(t,n.origin),o=io(e,r,n.around&&oo.getInnerOrigin(t,n.around));if(oo.hasOffset(t)&&(o.x-=n.offsetX,o.y-=n.offsetY),i){const e=o.scaleX/t.scaleX,i=o.scaleY/t.scaleY;if(delete o.scaleX,delete o.scaleY,r){Xt.scale(t.boxBounds,Math.abs(e),Math.abs(i));const s=oo.getInnerOrigin(t,n.origin);dt.move(o,r.x-s.x,r.y-s.y)}t.set(o),t.scaleResize(e,i,!1)}else t.set(o,s)},getFlipTransform(t,e){const i={a:1,b:0,c:0,d:1,e:0,f:0},s="x"===e?1:-1;return Jr(i,oo.getLocalOrigin(t,"center"),-1*s,1*s),i},getLocalOrigin:(t,e)=>dt.tempToOuterOf(oo.getInnerOrigin(t,e),t.localTransform),getInnerOrigin(t,e){const i={};return kt.toPoint(e,t.boxBounds,i),i},getRelativeWorld:(t,e,i)=>(Kr(so,t.worldTransform),eo(so,e.scrollWorldTransform),i?so:Object.assign({},so)),drop(t,e,i,s){t.setTransform(oo.getRelativeWorld(t,e,!0),s),e.add(t,i)},hasHighPosition:t=>t.origin||t.around||oo.hasOffset(t),hasOffset:t=>t.offsetX||t.offsetY,hasParent(t,e){if(!e)return!1;for(;t;){if(e===t)return!0;t=t.parent}},animateMove(t,e,i=.3){if(e.x||e.y)if(Math.abs(e.x)<1&&Math.abs(e.y)<1)t.move(e);else{const s=e.x*i,n=e.y*i;e.x-=s,e.y-=n,t.move(s,n),v.requestRender(()=>oo.animateMove(t,e,i))}}},oo=ro,{updateAllMatrix:ao,updateMatrix:ho,updateAllWorldOpacity:lo,updateAllChange:co,updateChange:uo}=oo;function po(t,e){return t.updateLayout(),t.parent?dt.tempToInnerOf(e,t.parent.scrollWorldTransform):e}const go={worldBounds:t=>t.__world,localBoxBounds:t=>t.__.eraser||0===t.__.visible?null:t.__local||t.__layout,localStrokeBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localStrokeBounds,localRenderBounds:t=>t.__.eraser||0===t.__.visible?null:t.__layout.localRenderBounds,maskLocalBoxBounds:(t,e)=>fo(t,e)&&t.__localBoxBounds,maskLocalStrokeBounds:(t,e)=>fo(t,e)&&t.__layout.localStrokeBounds,maskLocalRenderBounds:(t,e)=>fo(t,e)&&t.__layout.localRenderBounds,excludeRenderBounds:(t,e)=>!(!e.bounds||e.bounds.hit(t.__world,e.matrix))||!(!e.hideBounds||!e.hideBounds.includes(t.__world,e.matrix))};let _o;function fo(t,e){return e||(_o=0),t.__.mask&&(_o=1),_o<0?null:(_o&&(_o=-1),!0)}const{updateBounds:mo}=ro,yo={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),vo(t,e))}},pushAllParent(t,e){const{keys:i}=e;if(i)for(;t.parent&&n(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++)xo(e[t],e)},updateBounds(t,e){const i=[t];xo(t,i),wo(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++)mo(s[t]);e&&e===i||mo(i)}}},{pushAllChildBranch:vo,pushAllBranchStack:xo,updateBoundsByBranchStack:wo}=yo,Eo={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:bo,updateBounds:ko}=ro,{toOuterOf:So,getPoints:Bo,copy:To}=Xt,Po="_localContentBounds",Lo="_worldContentBounds",Ro="_worldBoxBounds",Co="_worldStrokeBounds";class Oo{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 So(this.contentBounds,this.leaf.__localMatrix,this[Po]||(this[Po]={})),this[Po]}get localStrokeBounds(){return this._localStrokeBounds||this}get localRenderBounds(){return this._localRenderBounds||this}get worldContentBounds(){return So(this.contentBounds,this.leaf.__world,this[Lo]||(this[Lo]={})),this[Lo]}get worldBoxBounds(){return So(this.boxBounds,this.leaf.__world,this[Ro]||(this[Ro]={})),this[Ro]}get worldStrokeBounds(){return So(this.strokeBounds,this.leaf.__world,this[Co]||(this[Co]={})),this[Co]}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 ko(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,v.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 bo(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 Kt(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=bo(s,e,!0)}if(o||(o=Q.getLayout(r)),To(o,a),dt.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=Bo(this.getInnerBounds(t));let r;switch(e){case"world":r=null;break;case"local":r=i.parent;break;case"inner":break;case"page":e=i.zoomLayer;default:r=e}return n(r)||s.forEach(t=>i.innerToWorld(t,null,!1,r)),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}scaleChange(){this.scaleChanged=!0,this._scaleOrRotationChange()}rotationChange(){this.rotationChanged=!0,this.affectRotation=!0,this._scaleOrRotationChange()}_scaleOrRotationChange(){this.affectScaleOrRotation=!0,this.matrixChange(),this.leaf.__local||this.createLocal()}matrixChange(){this.matrixChanged=!0,this.localBoxChanged?this.boundsChanged||(this.boundsChanged=!0):this.localBoxChange()}surfaceChange(){this.surfaceChanged=!0}opacityChange(){this.opacityChanged=!0,this.surfaceChanged||this.surfaceChange()}childrenSortChange(){this.childrenSortChanged||(this.childrenSortChanged=this.affectChildrenSort=!0,this.leaf.forceUpdate("surface"))}destroy(){}}class Mo{constructor(t,e){this.bubbles=!1,this.type=t,e&&(this.target=e)}stopDefault(){this.isStopDefault=!0,this.origin&&v.event.stopDefault(this.origin)}stopNow(){this.isStopNow=!0,this.isStop=!0,this.origin&&v.event.stopNow(this.origin)}stop(){this.isStop=!0,this.origin&&v.event.stop(this.origin)}}class Do extends Mo{constructor(t,e,i){super(t,e),this.parent=i,this.child=e}}Do.ADD="child.add",Do.REMOVE="child.remove",Do.CREATED="created",Do.MOUNTED="mounted",Do.UNMOUNTED="unmounted",Do.DESTROY="destroy";const Io="property.scroll";class Ao extends Mo{constructor(t,e,i,s,n){super(t,e),this.attrName=i,this.oldValue=s,this.newValue=n}}Ao.CHANGE="property.change",Ao.LEAFER_CHANGE="property.leafer_change",Ao.SCROLL=Io;const Wo={scrollX:Io,scrollY:Io};class Fo extends Mo{constructor(t,e){super(t),Object.assign(this,e)}}Fo.LOAD="image.load",Fo.LOADED="image.loaded",Fo.ERROR="image.error";class zo extends Mo{static checkHas(t,e,i){"on"===i?e===Yo?t.__hasWorldEvent=!0:t.__hasLocalEvent=!0:(t.__hasLocalEvent=t.hasEvent(Ho)||t.hasEvent(Uo)||t.hasEvent(No),t.__hasWorldEvent=t.hasEvent(Yo))}static emitLocal(t){if(t.leaferIsReady){const{resized:e}=t.__layout;"local"!==e&&(t.emit(Ho,t),"inner"===e&&t.emit(Uo,t)),t.emit(No,t)}}static emitWorld(t){t.leaferIsReady&&t.emit(Yo,this)}}zo.RESIZE="bounds.resize",zo.INNER="bounds.inner",zo.LOCAL="bounds.local",zo.WORLD="bounds.world";const{RESIZE:Ho,INNER:Uo,LOCAL:No,WORLD:Yo}=zo,Xo={};[Ho,Uo,No,Yo].forEach(t=>Xo[t]=1);class Vo extends Mo{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){c(t)?(super(Vo.RESIZE),Object.assign(this,t)):super(t),this.old=e}static isResizing(t){return this.resizingKeys&&!n(this.resizingKeys[t.innerId])}}Vo.RESIZE="resize";class jo extends Mo{constructor(t,e){super(t),this.data=e}}jo.REQUEST="watch.request",jo.DATA="watch.data";class Go extends Mo{constructor(t,e,i){super(t),e&&(this.data=e,this.times=i)}}Go.REQUEST="layout.request",Go.START="layout.start",Go.BEFORE="layout.before",Go.LAYOUT="layout",Go.AFTER="layout.after",Go.AGAIN="layout.again",Go.END="layout.end";class Ko extends Mo{constructor(t,e,i,s){super(t),e&&(this.times=e),i&&(this.renderBounds=i,this.renderOptions=s)}}Ko.REQUEST="render.request",Ko.CHILD_START="render.child_start",Ko.CHILD_END="render.child_end",Ko.START="render.start",Ko.BEFORE="render.before",Ko.RENDER="render",Ko.AFTER="render.after",Ko.AGAIN="render.again",Ko.END="render.end",Ko.NEXT="render.next";class Zo extends Mo{}Zo.START="leafer.start",Zo.BEFORE_READY="leafer.before_ready",Zo.READY="leafer.ready",Zo.AFTER_READY="leafer.after_ready",Zo.VIEW_READY="leafer.view_ready",Zo.VIEW_COMPLETED="leafer.view_completed",Zo.STOP="leafer.stop",Zo.RESTART="leafer.restart",Zo.END="leafer.end",Zo.UPDATE_MODE="leafer.update_mode",Zo.TRANSFORM="leafer.transform",Zo.MOVE="leafer.move",Zo.SCALE="leafer.scale",Zo.ROTATE="leafer.rotate",Zo.SKEW="leafer.skew";const{MOVE:qo,SCALE:Jo,ROTATE:$o,SKEW:Qo}=Zo,ta={x:qo,y:qo,scaleX:Jo,scaleY:Jo,rotation:$o,skewX:Qo,skewY:Qo},ea={};class ia{set event(t){this.on(t)}on(t,e,i){if(!e){let e;if(d(t))t.forEach(t=>this.on(t[0],t[1],t[2]));else for(let i in t)d(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 a=sa(this,s,!0),h=o(t)?t.split(" "):t,l=n?{listener:e,once:n}:{listener:e};h.forEach(t=>{t&&(r=a[t],r?-1===r.findIndex(t=>t.listener===e)&&r.push(l):a[t]=[l],Xo[t]&&zo.checkHas(this,t,"on"))})}off(t,e,i){if(t){const s=o(t)?t.split(" "):t;if(e){let t,n,r;i&&(t="boolean"==typeof i?i:"once"!==i&&i.capture);const o=sa(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],Xo[t]&&zo.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):d(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=d(t)?t:[t];e.forEach(t=>{t&&(t.listener?t.current.off(t.type,t.listener,t.options):d(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 d(t)&&t.forEach(t=>this.once(t[0],t[1],t[2],t[3]));c(i)?e=e.bind(i):s=i,this.on(t,e,{once:!0,capture:s})}emit(t,e,i){!e&&ue.has(t)&&(e=ue.get(t,{type:t,target:this,current:this}));const s=sa(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,r=i&&i[t],o=s&&s[t];return!!(n(e)?r||o:e?o:r)}destroy(){this.__captureMap=this.__bubbleMap=this.syncEventer=null}}function sa(t,e,i){if(e){const{__captureMap:e}=t;return e||(i?t.__captureMap={}:ea)}{const{__bubbleMap:e}=t;return e||(i?t.__bubbleMap={}:ea)}}const{on:na,on_:ra,off:oa,off_:aa,once:ha,emit:la,emitEvent:da,hasEvent:ca,destroy:ua}=ia.prototype,pa={on:na,on_:ra,off:oa,off_:aa,once:ha,emit:la,emitEvent:da,hasEvent:ca,destroyEventer:ua},ga=Qt.get("setAttr"),_a={__setAttr(t,e,i){if(this.leaferIsCreated){const s=this.__.__getInput(t);if(!i||a(e)||n(e)||(ga.warn(this.innerName,t,e),e=void 0),c(e)||s!==e){if(this.__realSetAttr(t,e),this.isLeafer){this.emitEvent(new Ao(Ao.LEAFER_CHANGE,this,t,s,e));const i=ta[t];i&&(this.emitEvent(new Zo(i,this)),this.emitEvent(new Zo(Zo.TRANSFORM,this)))}this.emitPropertyEvent(Ao.CHANGE,t,s,e);const i=Wo[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 Ao(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||n(i.normalStyle[t])||(i.normalStyle[t]=e))},__getAttr(t){return this.__proxyData?this.getProxyAttr(t):this.__.__get(t)}},{setLayout:fa,multiplyParent:ma,translateInner:ya,defaultWorld:va}=Q,{toPoint:xa,tempPoint:wa}=kt,Ea={__updateWorldMatrix(){const{parent:t,__layout:e,__world:i,__scrollWorld:s,__:n}=this;ma(this.__local||e,t?t.__scrollWorld||t.__world:va,i,!!e.affectScaleOrRotation,n),s&&ya(Object.assign(s,i),n.scrollX,n.scrollY)},__updateLocalMatrix(){if(this.__local){const t=this.__layout,e=this.__local,i=this.__;t.affectScaleOrRotation&&(t.scaleChanged&&(t.resized||(t.resized="scale"))||t.rotationChanged)&&(fa(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)&&(xa(i.around||i.origin,t.boxBounds,wa),ya(e,-wa.x,-wa.y,!i.around))}this.__layout.matrixChanged=void 0}},{updateMatrix:ba,updateAllMatrix:ka}=ro,{updateBounds:Sa}=yo,{toOuterOf:Ba,copyAndSpread:Ta,copy:Pa}=Xt,{toBounds:La}=Dn,Ra={__updateWorldBounds(){const{__layout:t,__world:e}=this;Ba(t.renderBounds,e,e),t.resized&&("inner"===t.resized&&this.__onUpdateSize(),this.__hasLocalEvent&&zo.emitLocal(this),t.resized=void 0),this.__hasWorldEvent&&zo.emitWorld(this)},__updateLocalBounds(){const t=this.__layout;t.boxChanged&&(this.__.__pathInputed||this.__updatePath(),this.__updateRenderPath(),this.__updateBoxBounds(),t.resized="inner"),t.localBoxChanged&&(this.__local&&this.__updateLocalBoxBounds(),t.localBoxChanged=void 0,t.strokeSpread&&(t.strokeChanged=!0),t.renderSpread&&(t.renderChanged=!0),this.parent&&this.parent.__layout.boxChange()),t.boxChanged=void 0,t.strokeChanged&&(t.strokeSpread=this.__updateStrokeSpread(),t.strokeSpread?(t.strokeBounds===t.boxBounds&&t.spreadStroke(),this.__updateStrokeBounds(),this.__updateLocalStrokeBounds()):t.spreadStrokeCancel(),t.strokeChanged=void 0,(t.renderSpread||t.strokeSpread!==t.strokeBoxSpread)&&(t.renderChanged=!0),this.parent&&this.parent.__layout.strokeChange(),t.resized="inner"),t.renderChanged&&(t.renderSpread=this.__updateRenderSpread(),t.renderSpread?(t.renderBounds!==t.boxBounds&&t.renderBounds!==t.strokeBounds||t.spreadRender(),this.__updateRenderBounds(),this.__updateLocalRenderBounds()):t.spreadRenderCancel(),t.renderChanged=void 0,this.parent&&this.parent.__layout.renderChange()),t.resized||(t.resized="local"),t.boundsChanged=void 0},__updateLocalBoxBounds(){this.__hasMotionPath&&this.__updateMotionPath(),this.__hasAutoLayout&&this.__updateAutoLayout(),Ba(this.__layout.boxBounds,this.__local,this.__local)},__updateLocalStrokeBounds(){Ba(this.__layout.strokeBounds,this.__localMatrix,this.__layout.localStrokeBounds)},__updateLocalRenderBounds(){Ba(this.__layout.renderBounds,this.__localMatrix,this.__layout.localRenderBounds)},__updateBoxBounds(t,e){const i=this.__layout.boxBounds,s=this.__;s.__usePathBox?La(s.path,i):(i.x=0,i.y=0,i.width=s.width,i.height=s.height)},__updateAutoLayout(){this.__layout.matrixChanged=!0,this.isBranch?(this.__extraUpdate(),this.__.flow?(this.__layout.boxChanged&&this.__updateFlowLayout(),ka(this),Sa(this,this),this.__.__autoSide&&this.__updateBoxBounds(!0)):(ka(this),Sa(this,this))):ba(this)},__updateNaturalSize(){const{__:t,__layout:e}=this;t.__naturalWidth=e.boxBounds.width,t.__naturalHeight=e.boxBounds.height},__updateStrokeBounds(t){const e=this.__layout;Ta(e.strokeBounds,e.boxBounds,e.strokeBoxSpread)},__updateRenderBounds(t){const e=this.__layout,{renderSpread:i}=e;h(i)&&i<=0?Pa(e.renderBounds,e.strokeBounds):Ta(e.renderBounds,e.boxBounds,i)}},Ca={__render(t,e){if(e.shape)return this.__renderShape(t,e);if(this.__worldOpacity){const i=this.__;if(i.bright&&!e.topRendering)return e.topList.add(this);if(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),t.opacity=e.dimOpacity&&!i.dimskip?i.opacity*e.dimOpacity:i.opacity,this.__.__single){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!0,!0);this.__draw(s,e,t),ro.copyCanvasByWorld(this,t,s,this.__nowWorld,i.__blendMode,!0),s.recycle(this.__nowWorld)}else this.__draw(t,e);Qt.showBounds&&Qt.drawBounds(this,t,e)}},__renderShape(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawShape(t,e))},__clip(t,e){this.__worldOpacity&&(t.setWorld(this.__nowWorld=this.__getNowWorld(e)),this.__drawRenderPath(t),t.clipUI(this))},__updateWorldOpacity(){this.__worldOpacity=this.__.visible?this.parent?this.parent.__worldOpacity*this.__.opacity:this.__.opacity:0,this.__layout.opacityChanged&&(this.__layout.opacityChanged=!1)}},{excludeRenderBounds:Oa}=go,Ma={__updateChange(){const{__layout:t}=this;t.childrenSortChanged&&(this.__updateSortChildren(),t.childrenSortChanged=!1),this.__.__checkSingle()},__render(t,e){if(this.__nowWorld=this.__getNowWorld(e),this.__worldOpacity){const i=this.__;if(i.__useDim)if(i.dim)e.dimOpacity=!0===i.dim?.2:i.dim;else{if(i.bright&&!e.topRendering)return e.topList.add(this);i.dimskip&&e.dimOpacity&&(e.dimOpacity=0)}if(i.__single&&!this.isBranchLeaf){if("path"===i.eraser)return this.__renderEraser(t,e);const s=t.getSameCanvas(!1,!0);this.__renderBranch(s,e);const n=this.__nowWorld;t.opacity=e.dimOpacity?i.opacity*e.dimOpacity:i.opacity,t.copyWorldByReset(s,n,n,i.__blendMode,!0),s.recycle(n)}else this.__renderBranch(t,e)}},__renderBranch(t,e){if(this.__hasMask)this.__renderMask(t,e);else{const{children:i}=this;for(let s=0,n=i.length;s<n;s++)Oa(i[s],e)||i[s].__render(t,e)}},__clip(t,e){if(this.__worldOpacity){const{children:i}=this;for(let s=0,n=i.length;s<n;s++)Oa(i[s],e)||i[s].__clip(t,e)}}},Da={},{LEAF:Ia,create:Aa}=w,{stintSet:Wa}=g,{toInnerPoint:Fa,toOuterPoint:za,multiplyParent:Ha}=Q,{toOuterOf:Ua}=Xt,{copy:Na,move:Ya}=dt,{moveLocal:Xa,zoomOfLocal:Va,rotateOfLocal:ja,skewOfLocal:Ga,moveWorld:Ka,zoomOfWorld:Za,rotateOfWorld:qa,skewOfWorld:Ja,transform:$a,transformWorld:Qa,setTransform:th,getFlipTransform:eh,getLocalOrigin:ih,getRelativeWorld:sh,drop:nh}=ro;t.Leaf=class{get tag(){return this.__tag}set tag(t){}get __tag(){return"Leaf"}get innerName(){return this.__.name||this.tag+this.innerId}get __DataProcessor(){return f}get __LayoutProcessor(){return Oo}get leaferIsCreated(){return this.leafer&&this.leafer.created}get leaferIsReady(){return this.leafer&&this.leafer.ready}get isLeafer(){return!1}get isBranch(){return!1}get isBranchLeaf(){return!1}get __localMatrix(){return this.__local||this.__layout}get __localBoxBounds(){return this.__local||this.__layout}get worldTransform(){return this.__layout.getTransform("world")}get localTransform(){return this.__layout.getTransform("local")}get scrollWorldTransform(){return this.updateLayout(),this.__scrollWorld||this.__world}get boxBounds(){return this.getBounds("box","inner")}get renderBounds(){return this.getBounds("render","inner")}get worldBoxBounds(){return this.getBounds("box")}get worldStrokeBounds(){return this.getBounds("stroke")}get worldRenderBounds(){return this.getBounds("render")}get worldOpacity(){return this.updateLayout(),this.__worldOpacity}get __worldFlipped(){return this.__world.scaleX<0||this.__world.scaleY<0}get __onlyHitMask(){return this.__hasMask&&!this.__.hitChildren}get __ignoreHitWorld(){return(this.__hasMask||this.__hasEraser)&&this.__.hitChildren}get __inLazyBounds(){return this.leaferIsCreated&&this.leafer.lazyBounds.hit(this.__world)}get pathInputed(){return this.__.__pathInputed}set event(t){this.on(t)}constructor(t){this.innerId=Aa(Ia),this.reset(t),this.__bubbleMap&&this.__emitLifeEvent(Do.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(Do.ADD,t,"once")}waitLeafer(t,e){e&&(t=t.bind(e)),this.leafer?t():this.on(Do.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(Do.MOUNTED)):this.__emitLifeEvent(Do.UNMOUNTED),this.isBranch){const{children:e}=this;for(let i=0,s=e.length;i<s;i++)e[i].__bindLeafer(t)}}set(t,e){}get(t){}setAttr(t,e){this[t]=e}getAttr(t){return this[t]}getComputedAttr(t){return this.__[t]}toJSON(t){return t&&this.__layout.update(),this.__.__getInputData(null,t)}toString(t){return JSON.stringify(this.toJSON(t))}toSVG(){}__SVG(t){}toHTML(){}__setAttr(t,e){return!0}__getAttr(t){}setProxyAttr(t,e){}getProxyAttr(t){}find(t,e){}findTag(t){}findOne(t,e){}findId(t){}focus(t){}updateState(){}updateLayout(){this.__layout.update()}forceUpdate(t){n(t)?t="width":"surface"===t&&(t="blendMode");const e=this.__.__getInput(t);this.__[t]=n(e)?null:void 0,this[t]=e}forceRender(t,e){this.forceUpdate("surface")}__extraUpdate(){this.leaferIsReady&&this.leafer.layouter.addExtra(this)}__updateWorldMatrix(){}__updateLocalMatrix(){}__updateWorldBounds(){}__updateLocalBounds(){}__updateLocalBoxBounds(){}__updateLocalStrokeBounds(){}__updateLocalRenderBounds(){}__updateBoxBounds(t,e){}__updateContentBounds(){}__updateStrokeBounds(t){}__updateRenderBounds(t){}__updateAutoLayout(){}__updateFlowLayout(){}__updateNaturalSize(){}__updateStrokeSpread(){return 0}__updateRenderSpread(){return 0}__onUpdateSize(){}__updateEraser(t){this.__hasEraser=!!t||this.children.some(t=>t.__.eraser)}__renderEraser(t,e){t.save(),this.__clip(t,e);const{renderBounds:i}=this.__layout;t.clearRect(i.x,i.y,i.width,i.height),t.restore()}__updateMask(t){this.__hasMask=this.children.some(t=>t.__.mask&&t.__.visible&&t.__.opacity)}__renderMask(t,e){}__getNowWorld(t){if(t.matrix){this.__cameraWorld||(this.__cameraWorld={});const e=this.__cameraWorld,i=this.__world;return Ha(i,t.matrix,e,void 0,i),Ua(this.__layout.renderBounds,e,e),Wa(e,"half",i.half),Wa(e,"ignorePixelSnap",i.ignorePixelSnap),e}return this.__world}getClampRenderScale(){let{scaleX:t}=this.__nowWorld||this.__world;return t<0&&(t=-t),t>1?t:1}getRenderScaleData(t,e){let{scaleX:i,scaleY:s}=tr.patternLocked?this.__world:this.__nowWorld;return t&&(i<0&&(i=-i),s<0&&(s=-s)),(!0===e||"zoom-in"===e&&i>1&&s>1)&&(i=s=1),Da.scaleX=i,Da.scaleY=s,Da}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?sh(this,e):this.worldTransform,n=i?t:{};return Ua(t,s,n),n}worldToLocal(t,e,i,s){this.parent?this.parent.worldToInner(t,e,i,s):e&&Na(e,t)}localToWorld(t,e,i,s){this.parent?this.parent.innerToWorld(t,e,i,s):e&&Na(e,t)}worldToInner(t,e,i,s){s&&(s.innerToWorld(t,e,i),t=e||t),Fa(this.scrollWorldTransform,t,e,i)}innerToWorld(t,e,i,s){za(this.scrollWorldTransform,t,e,i),s&&s.worldToInner(e||t,null,i)}getBoxPoint(t,e,i,s){return this.getBoxPointByInner(this.getInnerPoint(t,e,i,s),null,null,!0)}getBoxPointByInner(t,e,i,s){const n=s?t:Object.assign({},t),{x:r,y:o}=this.boxBounds;return Ya(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 Ya(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){th(this,t,e,i)}transform(t,e,i){$a(this,t,e,i)}move(t,e,i){Xa(this,t,e,i)}moveInner(t,e,i){Ka(this,t,e,!0,i)}scaleOf(t,e,i,s,n){Va(this,ih(this,t),e,i,s,n)}rotateOf(t,e,i){ja(this,ih(this,t),e,i)}skewOf(t,e,i,s,n){Ga(this,ih(this,t),e,i,s,n)}transformWorld(t,e,i){Qa(this,t,e,i)}moveWorld(t,e,i){Ka(this,t,e,!1,i)}scaleOfWorld(t,e,i,s,n){Za(this,t,e,i,s,n)}rotateOfWorld(t,e){qa(this,t,e)}skewOfWorld(t,e,i,s,n){Ja(this,t,e,i,s,n)}flip(t,e){$a(this,eh(this,t),!1,e)}scaleResize(t,e=t,i){this.scaleX*=t,this.scaleY*=e}__scaleResize(t,e){}resizeWidth(t){}resizeHeight(t){}hit(t,e){return!0}__hitWorld(t){return!0}__hit(t){return!0}__hitFill(t){return!0}__hitStroke(t,e){return!0}__hitPixel(t){return!0}__drawHitPath(t){}__updateHitCanvas(){}__render(t,e){}__drawFast(t,e){}__draw(t,e,i){}__clip(t,e){}__renderShape(t,e){}__drawShape(t,e){}__updateWorldOpacity(){}__updateChange(){}__drawPath(t){}__drawRenderPath(t){}__updatePath(){}__updateRenderPath(){}getMotionPathData(){return oe.need("path")}getMotionPoint(t){return oe.need("path")}getMotionTotal(){return 0}__updateMotionPath(){}__runAnimation(t,e){}__updateSortChildren(){}add(t,e){}remove(t,e){this.parent&&this.parent.remove(this,e)}dropTo(t,e,i){nh(this,t,e,i)}on(t,e,i){}off(t,e,i){}on_(t,e,i,s){}off_(t){}once(t,e,i,s){}emit(t,e,i){}emitEvent(t,e){}hasEvent(t,e){return!1}static changeAttr(t,e,i){i?this.addAttr(t,e,i):Fr(this.prototype,t,e)}static addAttr(t,e,i,s){i||(i=mr),i(e,s)(this.prototype,t)}__emitLifeEvent(t){this.hasEvent(t)&&this.emitEvent(new Do(t,this,this.parent))}destroy(){this.destroyed||(this.parent&&this.remove(),this.children&&this.clear(),this.__emitLifeEvent(Do.DESTROY),this.__.destroy(),this.__layout.destroy(),this.destroyEventer(),this.destroyed=!0)}},t.Leaf=_e([Vr(_a),Vr(Ea),Vr(Ra),Vr(pa),Vr(Ca)],t.Leaf);const{setListWithFn:rh}=Xt,{sort:oh}=yo,{localBoxBounds:ah,localStrokeBounds:hh,localRenderBounds:lh,maskLocalBoxBounds:dh,maskLocalStrokeBounds:ch,maskLocalRenderBounds:uh}=go,ph=new Qt("Branch");t.Branch=class extends t.Leaf{__updateStrokeSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.strokeSpread)return 1;return 0}__updateRenderSpread(){const{children:t}=this;for(let e=0,i=t.length;e<i;e++)if(t[e].__layout.renderSpread)return 1;return 0}__updateBoxBounds(t,e){rh(e||this.__layout.boxBounds,this.children,this.__hasMask?dh:ah)}__updateStrokeBounds(t){rh(t||this.__layout.strokeBounds,this.children,this.__hasMask?ch:hh)}__updateRenderBounds(t){rh(t||this.__layout.renderBounds,this.children,this.__hasMask?uh:lh)}__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(oh),this.__layout.affectChildrenSort=t}}add(t,e){if(t===this||t.destroyed)return ph.warn("add self or destroyed");const i=n(e);if(!t.__){if(d(t))return t.forEach(t=>{this.add(t,e),i||e++});t=le.get(t.tag,t)}t.parent&&t.parent.remove(t),t.parent=this,i?this.children.push(t):this.children.splice(e,0,t),t.isBranch&&(this.__.__childBranchNumber=(this.__.__childBranchNumber||0)+1);const s=t.__layout;s.boxChanged||s.boxChange(),s.matrixChanged||s.matrixChange(),t.__bubbleMap&&t.__emitLifeEvent(Do.ADD),this.leafer&&(t.__bindLeafer(this.leafer),this.leafer.created&&this.__emitChildEvent(Do.ADD,t)),this.__layout.affectChildrenSort&&this.__layout.childrenSortChange()}addMany(...t){this.add(t)}remove(t,e){t?t.__?t.animationOut?t.__runAnimation("out",()=>this.__remove(t,e)):this.__remove(t,e):this.find(t).forEach(t=>this.remove(t,e)):n(t)&&super.remove(null,e)}removeAll(t){const{children:e}=this;e.length&&(this.children=[],this.__preRemove(),this.__.__childBranchNumber=0,e.forEach(e=>{this.__realRemoveChild(e),t&&e.destroy()}))}clear(){this.removeAll(!0)}__remove(t,e){const 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(Do.REMOVE),t.parent=null,this.leafer&&(t.__bindLeafer(null),this.leafer.created&&(this.__emitChildEvent(Do.REMOVE,t),this.leafer.hitCanvasManager&&this.leafer.hitCanvasManager.clear()))}__emitChildEvent(t,e){const i=new Do(t,e,this);this.hasEvent(t)&&!this.isLeafer&&this.emitEvent(i),this.leafer.emitEvent(i)}},t.Branch=_e([Vr(Ma)],t.Branch);class gh{get length(){return this.list.length}constructor(t){this.reset(),t&&(d(t)?this.addList(t):this.add(t))}has(t){return t&&!n(this.keys[t.innerId])}indexAt(t){return this.list[t]}indexOf(t){const e=this.keys[t.innerId];return n(e)?-1:e}add(t){const{list:e,keys:i}=this;n(i[t.innerId])&&(e.push(t),i[t.innerId]=e.length-1)}addAt(t,e=0){const{keys:i}=this;if(n(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,r=e.length;s<r;s++)n(i)?e[s].innerId===t.innerId&&(i=s,delete this.keys[t.innerId]):this.keys[e[s].innerId]=s-1;n(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 gh;return t.list=[...this.list],t.keys=Object.assign({},this.keys),t}update(){this.keys={};const{list:t,keys:e}=this;for(let i=0,s=t.length;i<s;i++)e[t[i].innerId]=i}reset(){this.list=[],this.keys={}}destroy(){this.reset()}}class _h{get length(){return this._length}constructor(t){this._length=0,this.reset(),t&&(d(t)?this.addList(t):this.add(t))}has(t){return!n(this.keys[t.innerId])}without(t){return n(this.keys[t.innerId])}sort(t){const{levels:e}=this;t?e.sort((t,e)=>e-t):e.sort((t,e)=>t-e)}addList(t){t.forEach(t=>{this.add(t)})}add(t){const{keys:e,levelMap:i}=this;e[t.innerId]||(e[t.innerId]=1,i[t.__level]?i[t.__level].push(t):(i[t.__level]=[t],this.levels.push(t.__level)),this._length++)}forEach(t){let e;this.levels.forEach(i=>{e=this.levelMap[i];for(let i=0,s=e.length;i<s;i++)t(e[i])})}reset(){this.levelMap={},this.keys={},this.levels=[],this._length=0}destroy(){this.levelMap=null}}class fh extends Re{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=v.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this;this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i),this.clientBounds=this.bounds}}Vn(OffscreenCanvasRenderingContext2D.prototype),Vn(Path2D.prototype);const{mineType:mh}=jn;function yh(t,e){v.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,i)=>new Promise((s,n)=>{t.convertToBlob({type:mh(e),quality:i}).then(t=>{var e=new FileReader;e.onload=t=>s(t.target.result),e.onerror=t=>n(t),e.readAsDataURL(t)}).catch(t=>{n(t)})}),canvasToBolb:(t,e,i)=>t.convertToBlob({type:mh(e),quality:i}),canvasSaveAs:(t,e,i)=>new Promise(t=>t()),download(t,e){},loadImage:t=>new Promise((e,i)=>{let s=new XMLHttpRequest;s.open("GET",v.image.getRealURL(t),!0),s.responseType="blob",s.onload=()=>{createImageBitmap(s.response).then(t=>{e(t)}).catch(t=>{i(t)})},s.onerror=t=>i(t),s.send()})},v.canvas=ae.canvas(),v.conicGradientSupport=!!v.canvas.context.createConicGradient}Object.assign(ae,{canvas:(t,e)=>new fh(t,e),image:t=>new nr(t)}),v.name="web",v.isWorker=!0,v.backgrounder=!0,v.requestRender=function(t){requestAnimationFrame(t)},rr(v,"devicePixelRatio",{get:()=>1});const{userAgent:vh}=navigator;vh.indexOf("Firefox")>-1?(v.conicGradientRotate90=!0,v.intWheelDeltaY=!0):(/iPhone|iPad|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent))&&(v.fullImageShadow=!0),vh.indexOf("Windows")>-1?(v.os="Windows",v.intWheelDeltaY=!0):vh.indexOf("Mac")>-1?v.os="Mac":vh.indexOf("Linux")>-1&&(v.os="Linux");class xh{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new gh;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 gh,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(Ko.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===Do.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 jo(jo.DATA,{updatedList:this.updatedList})),this.__updatedList=new gh,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[Ao.CHANGE,this.__onAttrChange,this],[[Do.ADD,Do.REMOVE],this.__onChildEvent,this],[jo.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:wh,updateBounds:Eh,updateChange:bh}=ro,{pushAllChildBranch:kh,pushAllParent:Sh}=yo;const{worldBounds:Bh}=go;class Th{constructor(t){this.updatedBounds=new Kt,this.beforeBounds=new Kt,this.afterBounds=new Kt,d(t)&&(t=new gh(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,Bh)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,Bh),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:Ph,updateAllChange:Lh}=ro,Rh=Qt.get("Layouter");class Ch{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new _h,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(Go.START),this.layoutOnce(),t.emitEvent(new Go(Go.END,this.layoutedBlocks,this.times))}catch(t){Rh.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?Rh.warn("layouting"):this.times>3?Rh.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(jo.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=se.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:r,AFTER:o}=Go,a=this.getBlocks(s);a.forEach(t=>t.setBefore()),i.emitEvent(new Go(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?(wh(t,!0),e.add(t),t.isBranch&&kh(t,e),Sh(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),Sh(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||Eh(s[t])}Eh(i)}})}(this.__levelList),function(t){t.list.forEach(bh)}(s),this.extraBlock&&a.push(this.extraBlock),a.forEach(t=>t.setAfter()),i.emitEvent(new Go(r,a,this.times)),i.emitEvent(new Go(o,a,this.times)),this.addBlocks(a),this.__levelList.reset(),this.__updatedList=null,se.end(e)}fullLayout(){const t=se.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=Go,r=this.getBlocks(new gh(e));e.emitEvent(new Go(i,r,this.times)),Ch.fullLayout(e),r.forEach(t=>{t.setAfter()}),e.emitEvent(new Go(s,r,this.times)),e.emitEvent(new Go(n,r,this.times)),this.addBlocks(r),se.end(t)}static fullLayout(t){Ph(t,!0),t.isBranch?yo.updateBounds(t):ro.updateBounds(t),Lh(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new Th([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new Th(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_([[Go.REQUEST,this.layout,this],[Go.AGAIN,this.layoutAgain,this],[jo.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const Oh=Qt.get("Renderer");class Mh{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,e,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:120},this.frames=[],this.target=t,this.canvas=e,i&&(this.config=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.__requestRender()}requestLayout(){this.target.emit(Go.REQUEST)}checkRender(){if(this.running){const{target:t}=this;t.isApp&&(t.emit(Ko.CHILD_START,t),t.children.forEach(t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()}),t.emit(Ko.CHILD_END,t)),this.changed&&this.canvas.view&&this.render(),this.target.emit(Ko.NEXT)}}render(t){if(!this.running||!this.canvas.view)return this.update();const{target:e}=this;this.times=0,this.totalBounds=new Kt,Oh.log(e.innerName,"---\x3e");try{this.emitRender(Ko.START),this.renderOnce(t),this.emitRender(Ko.END,this.totalBounds),tr.clearRecycled()}catch(t){this.rendering=!1,Oh.error(t)}Oh.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return Oh.warn("rendering");if(this.times>3)return Oh.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new Kt,this.renderOptions={},t)this.emitRender(Ko.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(Ko.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(Ko.RENDER,this.renderBounds,this.renderOptions),this.emitRender(Ko.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=se.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=new Kt(s);i.save(),s.spread(Mh.clipSpread).ceil(),i.clearWorld(s),i.clipWorld(s),this.__render(s,n),i.restore(),se.end(e)}fullRender(){const t=se.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds),e.restore(),se.end(t)}__render(t,e){const{canvas:i}=this,s=t.includes(this.target.__world),n=s?{includes:s}:{bounds:t,includes:s};this.needFill&&i.fillWorld(t,this.config.fill),Qt.showRepaint&&Qt.drawRepaint(i,t),v.render(this.target,i,n),this.renderBounds=e=e||t,this.renderOptions=n,this.totalBounds.isEmpty()?this.totalBounds=e:this.totalBounds.add(e),i.updateRender(e)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new Kt;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 v.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()};v.requestRender(e)}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new Kt(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 Kt(0,0,1,1)),this.update()}}__onLayoutEnd(t){t.data&&t.data.map(t=>{let e;t.updatedList&&t.updatedList.list.some(t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||Oh.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e)),this.addBlock(e?this.canvas.bounds:t.updatedBounds)})}emitRender(t,e,i){this.target.emitEvent(new Ko(t,this.times,e,i))}__listenEvents(){this.__eventIds=[this.target.on_([[Ko.REQUEST,this.update,this],[Go.END,this.__onLayoutEnd,this],[Ko.AGAIN,this.renderAgain,this],[Vo.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.config={},this.target=this.canvas=null)}}Mh.clipSpread=10;const{hitRadiusPoint:Dh}=Xt;class Ih{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,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 gh(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 gh;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||ro.worldHittable(e))&&(this.hitChild(e,o),n.length)){if(e.isBranchLeaf&&t.some(t=>t!==e&&ro.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,e[t].proxy),n.length)return n.list[0];return s?null:i?t[0]:t.find(t=>ro.worldHittable(t))}getPath(t){const e=new gh,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 gh;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 gh,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;const{point:n}=this;for(let r=t.length-1;r>-1;r--)if(i=t[r],i.__.visible&&(!e||i.__.mask))if(s=!!i.__.hitRadius||Dh(i.__world,n),i.isBranch){if(s||i.__ignoreHitWorld){if(i.isBranchLeaf&&i.__.__clipAfterFill&&!i.__hitWorld(n))continue;i.topChildren&&this.eachFind(i.topChildren,!1),this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&this.hitChild(i,n)}}else s&&this.hitChild(i,n)}hitChild(t,e,i){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:s}=t;if(s&&s.__hasMask&&!t.__.mask){let i,n=[];const{children:r}=s;for(let s=0,o=r.length;s<o;s++)if(i=r[s],i.__.mask&&n.push(i),i===t){if(n&&!n.every(t=>t.__hitWorld(e)))return;break}}this.findList.add(i||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class Ah{constructor(t,e){this.config={},e&&(this.config=g.default(e,this.config)),this.picker=new Ih(this.target=t,this),this.finder=ae.finder&&ae.finder()}getByPoint(t,e,i){const{target:s,picker:n}=this;return v.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):oe.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function Wh(t){return hr(t,t=>({set(e){this.__setAttr(t,e),e&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}}))}function Fh(t){return hr(t,t=>({set(e){this.__setAttr(t,e),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}}))}function zh(){return(t,e)=>{const i="_"+e;rr(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(ae,{watcher:(t,e)=>new xh(t,e),layouter:(t,e)=>new Ch(t,e),renderer:(t,e,i)=>new Mh(t,e,i),selector:(t,e)=>new Ah(t,e)}),v.layout=Ch.fullLayout,v.render=function(t,e,i){const s=Object.assign(Object.assign({},i),{topRendering:!0});i.topList=new gh,t.__render(e,i),i.topList.length&&i.topList.forEach(t=>t.__render(e,s))};const Hh={},Uh={hasTransparent:function(t){if(!t||7===t.length||4===t.length)return!1;if("transparent"===t)return!0;const e=t[0];if("#"===e)switch(t.length){case 5:return"f"!==t[4]&&"F"!==t[4];case 9:return"f"!==t[7]&&"F"!==t[7]||"f"!==t[8]&&"F"!==t[8]}else if(("r"===e||"h"===e)&&"a"===t[3]){const e=t.lastIndexOf(",");if(e>-1)return parseFloat(t.slice(e+1))<1}return!1}},Nh={number:(t,e)=>c(t)?"percent"===t.type?t.value*e:t.value:t},Yh={},Xh={},Vh={},jh={},Gh={},Kh={apply(){oe.need("filter")}},Zh={},qh={setStyleName:()=>oe.need("state"),set:()=>oe.need("state")},Jh={list:{},register(t,e){Jh.list[t]=e},get:t=>Jh.list[t]},{parse:$h,objectToCanvasData:Qh}=ts,{stintSet:tl}=g,{hasTransparent:el}=Uh,il={originPaint:{}},sl=Qt.get("UIData");class nl extends f{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){return this.__getRealStrokeWidth()}get __maxStrokeWidth(){const t=this;return t.__hasMultiStrokeStyle?Math.max(t.__hasMultiStrokeStyle,t.strokeWidth):t.strokeWidth}get __hasMultiPaint(){const t=this;return t.fill&&this.__useStroke||t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return!this._width}get __autoHeight(){return!this._height}get __autoSide(){return!this._width||!this._height}get __autoSize(){return!this._width&&!this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,sl.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,sl.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),o(t)||!t?(tl(this,"__isTransparentFill",el(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t):c(t)&&this.__setPaint("fill",t)}setStroke(t){o(t)||!t?(tl(this,"__isTransparentStroke",el(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t):c(t)&&this.__setPaint("stroke",t)}setPath(t){const e=o(t);e||t&&c(t[0])?(this.__setInput("path",t),this._path=e?$h(t):Qh(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){rl(this,"shadow",t)}setInnerShadow(t){rl(this,"innerShadow",t)}setFilter(t){rl(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&Xh.compute("fill",this.__leaf),e&&Xh.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__getRealStrokeWidth(t){let{strokeWidth:e,strokeWidthFixed:i}=this;if(t&&(t.strokeWidth&&(e=t.strokeWidth),n(t.strokeWidthFixed)||(i=t.strokeWidthFixed)),i){const t=this.__leaf.getClampRenderScale();return t>1?e/t:e}return e}__setPaint(t,e){this.__setInput(t,e);const i=this.__leaf.__layout;i.boxChanged||i.boxChange(),d(e)&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=il)):(this.__isStrokes=!0,this._stroke||(this._stroke=il))}__removePaint(t,e){e&&this.__removeInput(t),Vh.recycleImage(t,this),"fill"===t?(tl(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(tl(this,"__isAlphaPixelStroke",void 0),tl(this,"__hasMultiStrokeStyle",void 0),this._stroke=this.__isStrokes=void 0)}}function rl(t,e,i){t.__setInput(e,i),d(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 ol extends nl{}class al extends ol{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 hl extends ol{__getInputData(t,e){const i=super.__getInputData(t,e);return Le.forEach(t=>delete i[t]),i}}class ll extends al{}class dl extends nl{get __usePathBox(){return this.points||this.__pathInputed}}class cl extends nl{get __boxStroke(){return!this.__pathInputed}}class ul extends nl{get __boxStroke(){return!this.__pathInputed}}class pl extends dl{}class gl extends nl{}class _l extends nl{get __pathInputed(){return 2}}class fl extends ol{}const ml={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class yl extends nl{get __useNaturalRatio(){return!1}setFontWeight(t){o(t)?(this.__setInput("fontWeight",t),t=ml[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=le.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}}class vl extends cl{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:"image",mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return t.url&&delete t.fill,t}__getInputData(t,e){const i=super.__getInputData(t,e);return i.url&&delete i.fill,i}}class xl extends cl{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:wl,add:El}=P,bl={__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)){const e=i.__isLinePath?0:10*t,s="none"===i.strokeCap?0:n;t+=Math.max(e,s)}return i.__useArrow&&(t+=5*n),r&&(t=wl(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=Gh.getShadowRenderSpread(this,e)),s&&(t=wl(t,s)),r&&(t=El(t,Kh.getSpread(r))),o&&(t=El(t,o)),a&&(t=El(t,a));let l=t;return i&&(l=wl(l,Gh.getInnerShadowSpread(this,i))),n&&(l=wl(l,n)),this.__layout.renderShapeSpread=l,h?wl(h.__updateRenderSpread(),t):t}},{stintSet:kl}=g,Sl={__updateChange(){const t=this.__;if(t.__useStroke){const e=t.__useStroke=!(!t.stroke||!t.strokeWidth);kl(this.__world,"half",e&&"center"===t.strokeAlign&&t.strokeWidth%2),kl(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;kl(t,"__isFastShadow",e&&!n&&e.length<2&&!e[0].spread&&!Gh.isTransformShadow(e[0])&&i&&!t.__isTransparentFill&&!(d(i)&&i.length>1)&&(this.useFastShadow||!s||s&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!n)}t.__checkSingle(),kl(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){Bl(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=Xh.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:l,innerShadow:d,filter:c}=s;l&&Gh.shadow(this,t,h),a&&(s.__isStrokes?Xh.strokes(r,this,t,e):Xh.stroke(r,this,t,e)),n&&(s.__isFills?Xh.fills(n,this,t,e):Xh.fill(n,this,t,e)),o&&this.__drawAfterFill(t,e),d&&Gh.innerShadow(this,t,h),r&&!a&&(s.__isStrokes?Xh.strokes(r,this,t,e):Xh.stroke(r,this,t,e)),c&&Kh.apply(c,this,this.__nowWorld,t,i,h),h.worldCanvas&&h.worldCanvas.recycle(),h.canvas.recycle()}else{if(a&&(s.__isStrokes?Xh.strokes(r,this,t,e):Xh.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,Uh.string(e.color))}n&&(s.__isFills?Xh.fills(n,this,t,e):Xh.fill(n,this,t,e)),h&&t.restore(),o&&this.__drawAfterFill(t,e),r&&!a&&(s.__isStrokes?Xh.strokes(r,this,t,e):Xh.stroke(r,this,t,e))}}else s.__pathInputed?Bl(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?Xh.fills(s,this,t,e):Xh.fill("#000000",this,t,e)),i.__isCanvas&&this.__drawAfterFill(t,e),n&&!e.ignoreStroke&&(i.__isAlphaPixelStroke?Xh.strokes(n,this,t,e):Xh.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 Bl(t,e,i){const{fill:s,stroke:n,__drawAfterFill:r,__fillAfterStroke:o}=t.__;t.__drawRenderPath(e),o&&Xh.stroke(n,t,e,i),s&&Xh.fill(s,t,e,i),r&&t.__drawAfterFill(e,i),n&&!o&&Xh.stroke(n,t,e,i)}const Tl={__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 Pl,Ll;t.UI=Pl=class extends t.Leaf{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(t){F.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 Yn.set(this.path=t||[]),t||this.__drawPathByBox(Yn),Yn}reset(t){}set(t,e){t&&Object.assign(this,t)}get(t){return o(t)?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(t,e){return oe.need("find")}findTag(t){return this.find({tag:t})}findOne(t,e){return oe.need("find")}findId(t){return this.findOne({id:t})}getPath(t,e){this.__layout.update();let i=e?this.__.__pathForRender:this.__.path;return i||(Yn.set(i=[]),this.__drawPathByBox(Yn)),t?ts.toCanvasData(i,!0):i}getPathString(t,e,i){return ts.stringify(this.getPath(t,e),i)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||Zh.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){const t=this.__;t.path?(t.__pathForRender=t.cornerRadius?Un.smooth(t.path,t.cornerRadius,t.cornerSmoothing):t.path,t.__useArrow&&Yh.addArrows(this)):t.__pathForRender&&(t.__pathForRender=void 0)}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(t,e){e?en.drawPathByData(t,e):this.__drawPathByBox(t)}__drawPathByBox(t){const{x:e,y:i,width:s,height:n}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:r}=this.__;t.roundRect(e,i,s,n,h(r)?[r]:r)}else t.rect(e,i,s,n)}drawImagePlaceholder(t,e,i){Xh.fill(this.__.placeholderColor,this,e,i)}animate(t,e,i,s){return this.set(t),oe.need("animate")}killAnimate(t,e){}export(t,e){return oe.need("export")}syncExport(t,e){return oe.need("export")}clone(t){const e=g.clone(this.toJSON());return t&&Object.assign(e,t),Pl.one(e)}static one(t,e,i,s,n){return le.get(t.tag||this.prototype.__tag,t,e,i,s,n)}static registerUI(){jr()(this)}static registerData(t){Wr(t)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}},_e([Wr(nl)],t.UI.prototype,"__",void 0),_e([zh()],t.UI.prototype,"zoomLayer",void 0),_e([cr("")],t.UI.prototype,"id",void 0),_e([cr("")],t.UI.prototype,"name",void 0),_e([cr("")],t.UI.prototype,"className",void 0),_e([Br("pass-through")],t.UI.prototype,"blendMode",void 0),_e([Pr(1)],t.UI.prototype,"opacity",void 0),_e([Lr(!0)],t.UI.prototype,"visible",void 0),_e([Br(!1)],t.UI.prototype,"locked",void 0),_e([Tr(!1)],t.UI.prototype,"dim",void 0),_e([Tr(!1)],t.UI.prototype,"dimskip",void 0),_e([Or(0)],t.UI.prototype,"zIndex",void 0),_e([Mr(!1)],t.UI.prototype,"mask",void 0),_e([Dr(!1)],t.UI.prototype,"eraser",void 0),_e([ur(0,!0)],t.UI.prototype,"x",void 0),_e([ur(0,!0)],t.UI.prototype,"y",void 0),_e([mr(100,!0)],t.UI.prototype,"width",void 0),_e([mr(100,!0)],t.UI.prototype,"height",void 0),_e([_r(1,!0)],t.UI.prototype,"scaleX",void 0),_e([_r(1,!0)],t.UI.prototype,"scaleY",void 0),_e([fr(0,!0)],t.UI.prototype,"rotation",void 0),_e([fr(0,!0)],t.UI.prototype,"skewX",void 0),_e([fr(0,!0)],t.UI.prototype,"skewY",void 0),_e([ur(0,!0)],t.UI.prototype,"offsetX",void 0),_e([ur(0,!0)],t.UI.prototype,"offsetY",void 0),_e([pr(0,!0)],t.UI.prototype,"scrollX",void 0),_e([pr(0,!0)],t.UI.prototype,"scrollY",void 0),_e([gr()],t.UI.prototype,"origin",void 0),_e([gr()],t.UI.prototype,"around",void 0),_e([cr(!1)],t.UI.prototype,"lazy",void 0),_e([yr(1)],t.UI.prototype,"pixelRatio",void 0),_e([Sr(0)],t.UI.prototype,"renderSpread",void 0),_e([xr()],t.UI.prototype,"path",void 0),_e([wr()],t.UI.prototype,"windingRule",void 0),_e([wr(!0)],t.UI.prototype,"closed",void 0),_e([mr(0)],t.UI.prototype,"padding",void 0),_e([mr(!1)],t.UI.prototype,"lockRatio",void 0),_e([mr()],t.UI.prototype,"widthRange",void 0),_e([mr()],t.UI.prototype,"heightRange",void 0),_e([cr(!1)],t.UI.prototype,"draggable",void 0),_e([cr()],t.UI.prototype,"dragBounds",void 0),_e([cr("auto")],t.UI.prototype,"dragBoundsType",void 0),_e([cr(!1)],t.UI.prototype,"editable",void 0),_e([Ir(!0)],t.UI.prototype,"hittable",void 0),_e([Ir("path")],t.UI.prototype,"hitFill",void 0),_e([kr("path")],t.UI.prototype,"hitStroke",void 0),_e([Ir(!1)],t.UI.prototype,"hitBox",void 0),_e([Ir(!0)],t.UI.prototype,"hitChildren",void 0),_e([Ir(!0)],t.UI.prototype,"hitSelf",void 0),_e([Ir()],t.UI.prototype,"hitRadius",void 0),_e([Ar("")],t.UI.prototype,"cursor",void 0),_e([Br()],t.UI.prototype,"fill",void 0),_e([kr(void 0,!0)],t.UI.prototype,"stroke",void 0),_e([kr("inside")],t.UI.prototype,"strokeAlign",void 0),_e([kr(1,!0)],t.UI.prototype,"strokeWidth",void 0),_e([kr(!1)],t.UI.prototype,"strokeWidthFixed",void 0),_e([kr("none")],t.UI.prototype,"strokeCap",void 0),_e([kr("miter")],t.UI.prototype,"strokeJoin",void 0),_e([kr()],t.UI.prototype,"dashPattern",void 0),_e([kr(0)],t.UI.prototype,"dashOffset",void 0),_e([kr(10)],t.UI.prototype,"miterLimit",void 0),_e([wr(0)],t.UI.prototype,"cornerRadius",void 0),_e([wr()],t.UI.prototype,"cornerSmoothing",void 0),_e([Wh()],t.UI.prototype,"shadow",void 0),_e([Wh()],t.UI.prototype,"innerShadow",void 0),_e([Wh()],t.UI.prototype,"blur",void 0),_e([Wh()],t.UI.prototype,"backgroundBlur",void 0),_e([Wh()],t.UI.prototype,"grayscale",void 0),_e([Wh()],t.UI.prototype,"filter",void 0),_e([Br()],t.UI.prototype,"placeholderColor",void 0),_e([cr(100)],t.UI.prototype,"placeholderDelay",void 0),_e([cr({})],t.UI.prototype,"data",void 0),_e([Nr(t.Leaf.prototype.reset)],t.UI.prototype,"reset",null),t.UI=Pl=_e([Vr(bl),Vr(Sl),Yr()],t.UI),t.Group=class extends t.UI{get __tag(){return"Group"}get isBranch(){return!0}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:i}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),i.forEach(t=>this.add(t)),t.children=i}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return this.childlessJSON||(e.children=this.children.map(e=>e.toJSON(t))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}},_e([Wr(ol)],t.Group.prototype,"__",void 0),_e([mr(0)],t.Group.prototype,"width",void 0),_e([mr(0)],t.Group.prototype,"height",void 0),t.Group=_e([Vr(t.Branch),jr()],t.Group);const Rl=Qt.get("Leafer");t.Leafer=Ll=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&&$n.isComplete}get layoutLocked(){return!this.layouter.running}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||{x:0,y:0,width:0,height:0}}constructor(t,e){super(e),this.config={start:!0,hittable:!0,smooth:!0,lazySpeard:100},this.leafs=0,this.__eventIds=[],this.__controllers=[],this.__readyWait=[],this.__viewReadyWait=[],this.__viewCompletedWait=[],this.__nextRenderWait=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t),Ll.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=ae.canvas(s);this.__controllers.push(this.renderer=ae.renderer(this,n,s),this.watcher=ae.watcher(this,s),this.layouter=ae.layouter(this,s)),this.isApp&&this.__setApp(),this.__checkAutoLayout(),this.view=n.view,e||(this.selector=ae.selector(this),this.interaction=ae.interaction(this,n,this.selector,s),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=ae.hitCanvasManager()),this.canvasManager=new ge,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))),Eo.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(Zo.RESTART):this.emitLeafer(Zo.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(Zo.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(t){const e=g.copyAttrs({},t,Le);Object.keys(e).forEach(t=>this[t]=e[t])}forceRender(t,e){const{renderer:i}=this;i&&(i.addBlock(t?new Kt(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,Le);e.resize(t),this.updateLazyBounds(),this.__onResize(new Vo(t,i))}__onResize(t){this.emitEvent(t),g.copyAttrs(this.__,t,Le),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 qt(t)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(t,e){return this.canvas&&(Le.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(Zo.UPDATE_MODE,{mode:e})),super.__setAttr(t,e)}__getAttr(t){return this.canvas&&Le.includes(t)?this.canvas[t]:super.__getAttr(t)}__changeCanvasSize(t,e){const{config:i,canvas:s}=this,n=g.copyAttrs({},s,Le);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(Zo.BEFORE_READY),this.emitLeafer(Zo.READY),this.emitLeafer(Zo.AFTER_READY),Eo.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(Zo.VIEW_READY),Eo.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){Eo.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(Zo.VIEW_COMPLETED),Eo.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 oe.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 Zo(t,this))}__listenEvents(){const t=se.start("FirstCreate "+this.innerName);this.once([[Zo.START,()=>se.end(t)],[Go.START,this.updateLazyBounds,this],[Ko.START,this.__onCreated,this],[Ko.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[jo.DATA,this.__onWatchData,this],[Go.END,this.__onLayoutEnd,this],[Ko.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(t){const e=()=>{if(!this.destroyed){Ll.list.remove(this);try{this.stop(),this.emitLeafer(Zo.END),this.__removeListenEvents(),this.__controllers.forEach(t=>!(this.parent&&t===this.interaction)&&t.destroy()),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager&&this.canvasManager.destroy()),this.canvas&&this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout(()=>{tr.clearRecycled()},100)}catch(t){Rl.error(t)}}};t?e():setTimeout(e)}},t.Leafer.list=new gh,_e([Wr(hl)],t.Leafer.prototype,"__",void 0),_e([mr()],t.Leafer.prototype,"pixelRatio",void 0),_e([cr("normal")],t.Leafer.prototype,"mode",void 0),t.Leafer=Ll=_e([jr()],t.Leafer),t.Rect=class extends t.UI{get __tag(){return"Rect"}},_e([Wr(cl)],t.Rect.prototype,"__",void 0),t.Rect=_e([Vr(Tl),Yr(),jr()],t.Rect);const{add:Cl,includes:Ol,scroll:Ml}=Xt,Dl=t.Rect.prototype,Il=t.Group.prototype;t.Box=class extends t.Group{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){if(this.children.length&&!this.pathInputed){const t=this.__;if(t.__autoSide){t.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:e}=this.__layout;t.__autoSize||(t.__autoWidth?(e.width+=e.x,e.x=0,e.height=t.height,e.y=0):(e.height+=e.y,e.y=0,e.width=t.width,e.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds()}else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let t,e;if(this.children.length){const i=this.__,s=this.__layout,{renderBounds: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"))&&(Cl(a,r),Ml(a,i)),this.__updateRectRenderBounds(),t=!Ol(r,a),t&&"show"===o&&Cl(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))}},_e([Wr(al)],t.Box.prototype,"__",void 0),_e([mr(100)],t.Box.prototype,"width",void 0),_e([mr(100)],t.Box.prototype,"height",void 0),_e([cr(!1)],t.Box.prototype,"resizeChildren",void 0),_e([Sr("show")],t.Box.prototype,"overflow",void 0),_e([Nr(Dl.__updateStrokeSpread)],t.Box.prototype,"__updateStrokeSpread",null),_e([Nr(Dl.__updateRenderSpread)],t.Box.prototype,"__updateRectRenderSpread",null),_e([Nr(Dl.__updateBoxBounds)],t.Box.prototype,"__updateRectBoxBounds",null),_e([Nr(Dl.__updateStrokeBounds)],t.Box.prototype,"__updateStrokeBounds",null),_e([Nr(Dl.__updateRenderBounds)],t.Box.prototype,"__updateRectRenderBounds",null),_e([Nr(Dl.__updateChange)],t.Box.prototype,"__updateRectChange",null),_e([Nr(Dl.__render)],t.Box.prototype,"__renderRect",null),_e([Nr(Il.__render)],t.Box.prototype,"__renderGroup",null),t.Box=_e([Yr(),jr()],t.Box),t.Frame=class extends t.Box{get __tag(){return"Frame"}get isFrame(){return!0}},_e([Wr(ll)],t.Frame.prototype,"__",void 0),_e([Br("#FFFFFF")],t.Frame.prototype,"fill",void 0),_e([Sr("hide")],t.Frame.prototype,"overflow",void 0),t.Frame=_e([jr()],t.Frame);const{moveTo:Al,closePath:Wl,ellipse:Fl}=bs;t.Ellipse=class extends t.UI{get __tag(){return"Ellipse"}__updatePath(){const{width:t,height:e,innerRadius:i,startAngle:s,endAngle:n}=this.__,r=t/2,o=e/2,a=this.__.path=[];i?(s||n?(i<1&&Fl(a,r,o,r*i,o*i,0,s,n,!1),Fl(a,r,o,r,o,0,n,s,!0),i<1&&Wl(a)):(i<1&&(Fl(a,r,o,r*i,o*i),Al(a,t,o)),Fl(a,r,o,r,o,0,360,0,!0)),v.ellipseToCurve&&(this.__.path=this.getPath(!0))):s||n?(Al(a,r,o),Fl(a,r,o,r,o,0,s,n,!1),Wl(a)):Fl(a,r,o,r,o)}},_e([Wr(ul)],t.Ellipse.prototype,"__",void 0),_e([wr(0)],t.Ellipse.prototype,"innerRadius",void 0),_e([wr(0)],t.Ellipse.prototype,"startAngle",void 0),_e([wr(0)],t.Ellipse.prototype,"endAngle",void 0),t.Ellipse=_e([jr()],t.Ellipse);const{sin:zl,cos:Hl,PI:Ul}=Math,{moveTo:Nl,lineTo:Yl,closePath:Xl,drawPoints:Vl}=bs;t.Polygon=class extends t.UI{get __tag(){return"Polygon"}__updatePath(){const t=this.__,e=t.path=[];if(t.points)Vl(e,t.points,t.curve,!0);else{const{width:i,height:s,sides:n}=t,r=i/2,o=s/2;Nl(e,r,0);for(let t=1;t<n;t++)Yl(e,r+r*zl(2*t*Ul/n),o-o*Hl(2*t*Ul/n));Xl(e)}}},_e([Wr(pl)],t.Polygon.prototype,"__",void 0),_e([wr(3)],t.Polygon.prototype,"sides",void 0),_e([wr()],t.Polygon.prototype,"points",void 0),_e([wr(0)],t.Polygon.prototype,"curve",void 0),t.Polygon=_e([Yr(),jr()],t.Polygon);const{sin:jl,cos:Gl,PI:Kl}=Math,{moveTo:Zl,lineTo:ql,closePath:Jl}=bs;t.Star=class extends t.UI{get __tag(){return"Star"}__updatePath(){const{width:t,height:e,corners:i,innerRadius:s}=this.__,n=t/2,r=e/2,o=this.__.path=[];Zl(o,n,0);for(let t=1;t<2*i;t++)ql(o,n+(t%2==0?n:n*s)*jl(t*Kl/i),r-(t%2==0?r:r*s)*Gl(t*Kl/i));Jl(o)}},_e([Wr(gl)],t.Star.prototype,"__",void 0),_e([wr(5)],t.Star.prototype,"corners",void 0),_e([wr(.382)],t.Star.prototype,"innerRadius",void 0),t.Star=_e([jr()],t.Star);const{moveTo:$l,lineTo:Ql,drawPoints:td}=bs,{rotate:ed,getAngle:id,getDistance:sd,defaultPoint:nd}=dt;t.Line=class extends t.UI{get __tag(){return"Line"}get toPoint(){const{width:t,rotation:e}=this.__,i={x:0,y:0};return t&&(i.x=t),e&&ed(i,e),i}set toPoint(t){this.width=sd(nd,t),this.rotation=id(nd,t),this.height&&(this.height=0)}__updatePath(){const t=this.__,e=t.path=[];t.points?td(e,t.points,t.curve,t.closed):($l(e,0,0),Ql(e,this.width,0))}},_e([Wr(dl)],t.Line.prototype,"__",void 0),_e([Er("center")],t.Line.prototype,"strokeAlign",void 0),_e([mr(0)],t.Line.prototype,"height",void 0),_e([wr()],t.Line.prototype,"points",void 0),_e([wr(0)],t.Line.prototype,"curve",void 0),_e([wr(!1)],t.Line.prototype,"closed",void 0),t.Line=_e([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 d(t)&&t[0].image}},_e([Wr(vl)],t.Image.prototype,"__",void 0),_e([mr("")],t.Image.prototype,"url",void 0),t.Image=_e([jr()],t.Image);const rd=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=ae.canvas(this.__),t&&t.url&&this.drawImage(t.url)}drawImage(t){new nr({url:t}).load(t=>{this.context.drawImage(t.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new Fo(Fo.LOADED,{image:t}))})}draw(t,e,i,s){const n=new mt(t.worldTransform).invert(),r=new mt;e&&r.translate(e.x,e.y),i&&(h(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()}},_e([Wr(xl)],t.Canvas.prototype,"__",void 0),_e([Fh(100)],t.Canvas.prototype,"width",void 0),_e([Fh(100)],t.Canvas.prototype,"height",void 0),_e([Fh(1)],t.Canvas.prototype,"pixelRatio",void 0),_e([Fh(!0)],t.Canvas.prototype,"smooth",void 0),_e([cr(!1)],t.Canvas.prototype,"safeResize",void 0),_e([Fh()],t.Canvas.prototype,"contextSettings",void 0),t.Canvas=_e([jr()],t.Canvas);const{copyAndSpread:od,includes:ad,spread:hd,setList:ld}=Xt,{stintSet:dd}=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=Nh.number(e,n),t.__letterSpacing=Nh.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"}`,dd(t,"__padding",l&&F.fourNumber(l)),dd(t,"__clipText","show"!==h&&!t.__autoSize),dd(t,"__isCharMode",d||c||t.__letterSpacing||"none"!==a),t.__textDrawData=Hh.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&&hd(a,i/2),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",!ad(h,a)),this.isOverflow?(ld(t.__textBoxBounds={},[h,a]),e.renderChanged=!0):t.__textBoxBounds=h}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;od(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__updateChange(){super.__updateChange();const t=this.__box;t&&(t.__onUpdateSize(),t.__updateChange())}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,i){const s=this.__box;s&&(s.__nowWorld=this.__nowWorld,s.__draw(t,e,i)),this.textEditing&&!e.exporting||super.__draw(t,e,i)}__drawShape(t,e){e.shape&&this.__box&&this.__box.__drawShape(t,e),super.__drawShape(t,e)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}},_e([Wr(yl)],t.Text.prototype,"__",void 0),_e([mr(0)],t.Text.prototype,"width",void 0),_e([mr(0)],t.Text.prototype,"height",void 0),_e([Br()],t.Text.prototype,"boxStyle",void 0),_e([cr(!1)],t.Text.prototype,"resizeFontSize",void 0),_e([Br("#000000")],t.Text.prototype,"fill",void 0),_e([Er("outside")],t.Text.prototype,"strokeAlign",void 0),_e([Ir("all")],t.Text.prototype,"hitFill",void 0),_e([mr("")],t.Text.prototype,"text",void 0),_e([mr("")],t.Text.prototype,"placeholder",void 0),_e([mr("caption")],t.Text.prototype,"fontFamily",void 0),_e([mr(12)],t.Text.prototype,"fontSize",void 0),_e([mr("normal")],t.Text.prototype,"fontWeight",void 0),_e([mr(!1)],t.Text.prototype,"italic",void 0),_e([mr("none")],t.Text.prototype,"textCase",void 0),_e([mr("none")],t.Text.prototype,"textDecoration",void 0),_e([mr(0)],t.Text.prototype,"letterSpacing",void 0),_e([mr({type:"percent",value:1.5})],t.Text.prototype,"lineHeight",void 0),_e([mr(0)],t.Text.prototype,"paraIndent",void 0),_e([mr(0)],t.Text.prototype,"paraSpacing",void 0),_e([mr("x")],t.Text.prototype,"writingMode",void 0),_e([mr("left")],t.Text.prototype,"textAlign",void 0),_e([mr("top")],t.Text.prototype,"verticalAlign",void 0),_e([mr(!0)],t.Text.prototype,"autoSizeAlign",void 0),_e([mr("normal")],t.Text.prototype,"textWrap",void 0),_e([mr("show")],t.Text.prototype,"textOverflow",void 0),_e([Br(!1)],t.Text.prototype,"textEditing",void 0),t.Text=_e([jr()],t.Text),t.Path=class extends t.UI{get __tag(){return"Path"}},_e([Wr(_l)],t.Path.prototype,"__",void 0),_e([Er("center")],t.Path.prototype,"strokeAlign",void 0),t.Path=_e([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}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,i,s,n,r){return this}quadraticCurveTo(t,e,i,s){return this}closePath(){return this}rect(t,e,i,s){return this}roundRect(t,e,i,s,n){return this}ellipse(t,e,i,s,n,r,o,a){return this}arc(t,e,i,s,n,r){return this}arcTo(t,e,i,s,n){return this}drawEllipse(t,e,i,s,n,r,o,a){return this}drawArc(t,e,i,s,n,r){return this}drawPoints(t,e,i){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}},_e([Wr(fl)],t.Pen.prototype,"__",void 0),_e([(t,e)=>{rr(t,e,{get(){return this.__path}})}],t.Pen.prototype,"path",void 0),t.Pen=_e([Vr(Hs,["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&&ae.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),n(e)||(t.canvas.childIndex=e),this.__listenChildEvents(t)}forEach(t){this.children.forEach(t)}__onCreated(){this.created=this.children.every(t=>t.created)}__onReady(){this.children.every(t=>t.ready)&&super.__onReady()}__onViewReady(){this.children.every(t=>t.viewReady)&&super.__onViewReady()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){t.context&&this.forEach(i=>e.matrix?i.__render(t,e):t.copyWorld(i.canvas,e.bounds))}__onResize(t){this.forEach(e=>e.resize(t)),super.__onResize(t)}updateLayout(){this.forEach(t=>t.updateLayout())}__getChildConfig(t){const e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&g.assign(e,t),this.autoLayout&&g.copyAttrs(e,this,Le),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once([[Go.END,this.__onReady,this],[Ko.START,this.__onCreated,this],[Ko.END,this.__onViewReady,this]]),this.realCanvas&&this.__eventIds.push(t.on_(Ko.END,this.__onChildRenderEnd,this))}},t.App=_e([jr()],t.App);const cd={},ud={isHoldSpaceKey:()=>ud.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}},pd={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 gd extends Mo{get spaceKey(){return ud.isHoldSpaceKey()}get left(){return pd.left(this)}get right(){return pd.right(this)}get middle(){return pd.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}isHoldKeys(t){return ud.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){ue.changeName(t,e)}}const{min:_d,max:fd,abs:md}=Math,{float:yd,sign:vd}=F,{minX:xd,maxX:wd,minY:Ed,maxY:bd}=Xt,kd=new Kt,Sd=new Kt,Bd={limitMove(t,e){const{dragBounds:i,dragBoundsType:s}=t;i&&Td.getValidMove(t.__localBoxBounds,Td.getDragBounds(t),s,e,!0),Td.axisMove(t,e)},limitScaleOf(t,e,i,s){const{dragBounds:n,dragBoundsType:r}=t;n&&Td.getValidScaleOf(t.__localBoxBounds,Td.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&&t[s]>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)),Td.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),Td.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=yd(s.x),s.y=yd(s.y),s},getValidScaleOf(t,e,i,s,n,r,o){o||(n=Object.assign({},n)),Sd.set(e),kd.set(t).scaleOf(s,n.x,n.y);const h=(s.x-t.x)/t.width,l=1-h,d=(s.y-t.y)/t.height,c=1-d;let u,p,g,_,f=1,m=1;return Td.isInnerMode(t,e,i,"width")?(n.x<0&&kd.scaleOf(s,f=1/n.x,1),g=yd(kd.minX-Sd.minX),_=yd(Sd.maxX-kd.maxX),u=h&&g>0?1+g/(h*kd.width):1,p=l&&_>0?1+_/(l*kd.width):1,f*=fd(u,p)):(n.x<0&&((yd(xd(t)-xd(e))<=0||yd(wd(e)-wd(t))<=0)&&kd.scaleOf(s,f=1/n.x,1),kd.unsign()),g=yd(Sd.minX-kd.minX),_=yd(kd.maxX-Sd.maxX),u=h&&g>0?1-g/(h*kd.width):1,p=l&&_>0?1-_/(l*kd.width):1,f*=_d(u,p)),Td.isInnerMode(t,e,i,"height")?(n.y<0&&kd.scaleOf(s,1,m=1/n.y),g=yd(kd.minY-Sd.minY),_=yd(Sd.maxY-kd.maxY),u=d&&g>0?1+g/(d*kd.height):1,p=c&&_>0?1+_/(c*kd.height):1,m*=fd(u,p),r&&(u=fd(md(f),md(m)),f=vd(f)*u,m=vd(m)*u)):(n.y<0&&((yd(Ed(t)-Ed(e))<=0||yd(bd(e)-bd(t))<=0)&&kd.scaleOf(s,1,m=1/n.y),kd.unsign()),g=yd(Sd.minY-kd.minY),_=yd(kd.maxY-Sd.maxY),u=d&&g>0?1-g/(d*kd.height):1,p=c&&_>0?1-_/(c*kd.height):1,m*=_d(u,p)),n.x*=a(f)?f:1,n.y*=a(m)?m:1,n}},Td=Bd;t.PointerEvent=class extends gd{},t.PointerEvent.POINTER="pointer",t.PointerEvent.BEFORE_DOWN="pointer.before_down",t.PointerEvent.BEFORE_MOVE="pointer.before_move",t.PointerEvent.BEFORE_UP="pointer.before_up",t.PointerEvent.DOWN="pointer.down",t.PointerEvent.MOVE="pointer.move",t.PointerEvent.UP="pointer.up",t.PointerEvent.OVER="pointer.over",t.PointerEvent.OUT="pointer.out",t.PointerEvent.ENTER="pointer.enter",t.PointerEvent.LEAVE="pointer.leave",t.PointerEvent.TAP="tap",t.PointerEvent.DOUBLE_TAP="double_tap",t.PointerEvent.CLICK="click",t.PointerEvent.DOUBLE_CLICK="double_click",t.PointerEvent.LONG_PRESS="long_press",t.PointerEvent.LONG_TAP="long_tap",t.PointerEvent.MENU="pointer.menu",t.PointerEvent.MENU_TAP="pointer.menu_tap",t.PointerEvent=_e([Gr()],t.PointerEvent);const Pd=t.PointerEvent,Ld={};t.DragEvent=class extends t.PointerEvent{static setList(t){this.list=t instanceof gh?t:new gh(t)}static setData(t){this.data=t}static getValidMove(t,e,i,s=!0){const n=t.getLocalPoint(i,null,!0);return dt.move(n,e.x-t.x,e.y-t.y),s&&this.limitMove(t,n),Bd.axisMove(t,n),n}static limitMove(t,e){Bd.limitMove(t,e)}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(Ld,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(Ld,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(Ld,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 Xt.set(i,e.x-t.x,e.y-t.y,t.x,t.y),Xt.unsign(i),i}assignMove(t){Ld.x=t?this.totalX:this.moveX,Ld.y=t?this.totalY:this.moveY}},t.DragEvent.BEFORE_DRAG="drag.before_drag",t.DragEvent.START="drag.start",t.DragEvent.DRAG="drag",t.DragEvent.END="drag.end",t.DragEvent.OVER="drag.over",t.DragEvent.OUT="drag.out",t.DragEvent.ENTER="drag.enter",t.DragEvent.LEAVE="drag.leave",t.DragEvent=_e([Gr()],t.DragEvent);const Rd=t.DragEvent;t.DropEvent=class extends t.PointerEvent{static setList(e){t.DragEvent.setList(e)}static setData(e){t.DragEvent.setData(e)}},t.DropEvent.DROP="drop",t.DropEvent=_e([Gr()],t.DropEvent),t.MoveEvent=class extends t.DragEvent{},t.MoveEvent.BEFORE_MOVE="move.before_move",t.MoveEvent.START="move.start",t.MoveEvent.MOVE="move",t.MoveEvent.END="move.end",t.MoveEvent=_e([Gr()],t.MoveEvent),t.TouchEvent=class extends gd{},t.TouchEvent=_e([Gr()],t.TouchEvent);const Cd=t.TouchEvent;t.RotateEvent=class extends t.PointerEvent{},t.RotateEvent.BEFORE_ROTATE="rotate.before_rotate",t.RotateEvent.START="rotate.start",t.RotateEvent.ROTATE="rotate",t.RotateEvent.END="rotate.end",t.RotateEvent=_e([Gr()],t.RotateEvent),t.SwipeEvent=class extends t.DragEvent{},t.SwipeEvent.SWIPE="swipe",t.SwipeEvent.LEFT="swipe.left",t.SwipeEvent.RIGHT="swipe.right",t.SwipeEvent.UP="swipe.up",t.SwipeEvent.DOWN="swipe.down",t.SwipeEvent=_e([Gr()],t.SwipeEvent),t.ZoomEvent=class extends t.PointerEvent{},t.ZoomEvent.BEFORE_ZOOM="zoom.before_zoom",t.ZoomEvent.START="zoom.start",t.ZoomEvent.ZOOM="zoom",t.ZoomEvent.END="zoom.end",t.ZoomEvent=_e([Gr()],t.ZoomEvent),t.KeyEvent=class extends gd{},t.KeyEvent.BEFORE_DOWN="key.before_down",t.KeyEvent.BEFORE_UP="key.before_up",t.KeyEvent.DOWN="key.down",t.KeyEvent.HOLD="key.hold",t.KeyEvent.UP="key.up",t.KeyEvent=_e([Gr()],t.KeyEvent);const Od={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:Md.getSwipeDirection(dt.getAngle(t,i))}),getBase(t){const e=1===t.button?4:t.button;return{altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,buttons:n(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 gh,{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=>ro.draggable(e)||!e.isLeafer&&e.hasEvent(t.DragEvent.DRAG)),pathHasOutside:t=>t&&t.list.some(t=>t.isOutside)},Md=Od,Dd=new gh,{getDragEventData:Id,getDropEventData:Ad,getSwipeEventData:Wd}=Od;class Fd{constructor(t){this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=Id(t,t,t),this.canAnimate=this.canDragOut=!0}getList(e,i){const{proxy:s}=this.interaction.selector,n=s&&s.list.length,r=t.DragEvent.list||this.draggableList||Dd;return this.dragging&&(n?e?Dd:new gh(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&&pd.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],ro.draggable(e)){this.draggableList=new gh(e);break}}drag(e){const{interaction:i,dragData:s,downData:n}=this,{path:r,throughPath:o}=n;this.dragData=Id(n,s,e),o&&(this.dragData.throughPath=o),this.dragData.path=r,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:a}=i.p,l=!a||!!e;n.forEach(i=>{if(i.draggable){const n=o(i.draggable),d=t.DragEvent.getValidMove(i,this.dragStartPoints[i.innerId],{x:s,y:r},l||n);a&&!n&&e?ro.animateMove(i,d,h(a)?a:.3):i.move(d)}})}}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,e){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t,e)||this.dragEndReal(t))}dragEndReal(e){const{interaction:i,downData:s,dragData:n}=this;e||(e=n);const{path:r,throughPath:o}=s,a=Id(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(dt.getDistance(e,t)>n.config.pointer.swipeDistance){const t=Wd(e,i,s);this.interaction.emit(t.type,t)}}drop(e,i,s){const n=Ad(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}checkDragEndAnimate(t,e){return!1}animate(t,e){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const zd=Qt.get("emit");const Hd=["move","zoom","rotate","key"];function Ud(t,e,i,s,n){if(Hd.some(t=>e.startsWith(t))&&t.__.hitChildren&&!Yd(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&&Nd(r,e,i,s,n)}}function Nd(t,e,i,s,n){if(t.destroyed)return!1;if(t.__.hitSelf&&!Yd(t,n)&&(qh.updateEventStyle&&!s&&qh.updateEventStyle(t,e),t.hasEvent(e,s))){i.phase=s?1:t===i.target?2:3;const n=ue.get(e,i);if(t.emitEvent(n,s),n.isStop)return!0}return!1}function Yd(t,e){return e&&e.has(t)}const Xd={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:Vd,pathCanDrag:jd,pathHasOutside:Gd}=Od;class Kd{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&&pd.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&pd.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&ud.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(Xd),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new gh(t),this.createTransformer(),this.dragger=new Fd(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&&(pd.defaultLeft(e),this.updateDownData(e),this.checkPath(e,i),this.downTime=Date.now(),this.emit(t.PointerEvent.BEFORE_DOWN,e),this.emit(t.PointerEvent.DOWN,e),pd.left(e)&&(this.tapWait(),this.longPressWait(e)),this.waitRightTap=pd.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&&pd.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=dt.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;pd.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,ud.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,ud.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 gh),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=>Vd(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;v.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&&!Gd(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!jd(t.path))&&!Gd(t.path)}isDrag(t){return this.dragger.getList().has(t)}isPress(t){return this.downData&&this.downData.path.has(t)}isHover(t){return this.enterPath&&this.enterPath.has(t)}isFocus(t){return this.focusData===t}cancelHover(){const{hoverData:t}=this;t&&(t.path=this.defaultPath,this.pointerHover(t))}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(e){e||(e=this.hoverData),e&&(this.findPath(e,{exclude:this.dragger.getList(!1,!0),name:t.PointerEvent.MOVE}),this.hoverData=e)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let t=0,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&&dt.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),(Vd(e.path,t.PointerEvent.LONG_TAP)||Vd(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 Kt(this.canvas.bounds),this.shrinkCanvasBounds.spread(-(h(t)?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(Vo.RESIZE,this.__onResize,this)],t.once(Zo.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],Nd(n,t,e,!0,s))return;n.isApp&&Ud(n,t,e,!0,s)}for(let r=0,o=i.length;r<o;r++)if(n=i.list[r],n.isApp&&Ud(n,t,e,!1,s),Nd(n,t,e,!1,s))return}catch(t){zd.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 Zd{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}Zd.custom={};class qd extends ge{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new gh,this.pixelList=new gh}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),ae.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),ae.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()}}v.getSelector=function(t){return t.leafer?t.leafer.selector:v.selector||(v.selector=ae.selector())};const{toInnerRadiusPointOf:Jd,copy:$d,setRadius:Qd}=dt,{hitRadiusPoint:tc,hitPoint:ec}=Xt,ic={},sc={},nc=t.Leaf.prototype;nc.hit=function(t,e=0){this.updateLayout(),$d(sc,t),Qd(sc,e);const i=this.__world;return!!(e?tc(i,sc):ec(i,sc))&&(this.isBranch?v.getSelector(this).hitPoint(Object.assign({},sc),e,{target:this}):this.__hitWorld(sc))},nc.__hitWorld=function(t){const e=this.__;if(!e.hitSelf)return!1;const i=this.__world,s=this.__layout,n=i.width<10&&i.height<10;if(e.hitRadius&&($d(ic,t),Qd(t=ic,e.hitRadius)),Jd(t,i,ic),e.hitBox||n){if(Xt.hitRadiusPoint(s.boxBounds,ic))return!0;if(n)return!1}return!s.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),s.boundsChanged||(s.hitCanvasChanged=!1)),this.__hit(ic)},nc.__hitFill=function(t){const e=this.__hitCanvas;return e&&e.hitFill(t,this.__.windingRule)},nc.__hitStroke=function(t,e){const i=this.__hitCanvas;return i&&i.hitStroke(t,e)},nc.__hitPixel=function(t){const e=this.__hitCanvas;return e&&e.hitPixel(t,this.__layout.renderBounds,e.hitScale)},nc.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const rc=new mt,oc=t.UI.prototype;oc.__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=v.image.hitCanvasSize,o=r.hitScale=Zt.set(0,0,n,n).getFitMatrix(t).a,{x:a,y:h,width:l,height:d}=Zt.set(t).scale(o);r.resize({width:l,height:d,pixelRatio:1}),r.clear(),tr.patternLocked=!0,this.__renderShape(r,{matrix:rc.setWith(this.__world).scaleWith(1/o).invertWith().translate(-a,-h),ignoreFill:!i,ignoreStroke:!s}),tr.patternLocked=!1,r.resetTransform(),e.__isHitPixel=!0}else e.__isHitPixel&&(e.__isHitPixel=!1);this.__drawHitPath(r),r.setStrokeOptions(e)},oc.__hit=function(t){if(this.__box&&this.__box.__hit(t))return!0;const e=this.__;if(e.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:i}=e,s=(e.fill||e.__isCanvas)&&("path"===i||"pixel"===i&&!(e.__isAlphaPixelFill||e.__isCanvas))||"all"===i;if(s&&this.__hitFill(t))return!0;const{hitStroke:n,__maxStrokeWidth:r}=e,o=e.stroke&&("path"===n||"pixel"===n&&!e.__isAlphaPixelStroke)||"all"===n;if(!s&&!o)return!1;const a=2*t.radiusX;let h=a;if(o)switch(e.strokeAlign){case"inside":if(h+=2*r,!s&&this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a;break;case"center":h+=r;break;case"outside":if(h+=2*r,!s){if(!this.__hitFill(t)&&this.__hitStroke(t,h))return!0;h=a}}return!!h&&this.__hitStroke(t,h)};const ac=t.UI.prototype,hc=t.Rect.prototype,lc=t.Box.prototype;hc.__updateHitCanvas=lc.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?ac.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},hc.__hitFill=lc.__hitFill=function(t){return this.__hitCanvas?ac.__hitFill.call(this,t):Xt.hitRadiusPoint(this.__layout.boxBounds,t)},t.Text.prototype.__drawHitPath=function(t){const{__lineHeight:e,fontSize:i,__baseLine:s,__letterSpacing:n,__textDrawData:r}=this.__;t.beginPath(),n<0?this.__drawPathByBox(t):r.rows.forEach(n=>t.rect(n.x,n.y-s,n.width,e<i?i:e))},t.Group.prototype.pick=function(t,e){return e||(e=s),this.updateLayout(),v.getSelector(this).getByPoint(t,e.hitRadius||0,Object.assign(Object.assign({},e),{target:this}))};const dc=Re.prototype;function cc(t,e,i){t.__.__font?Xh.fillText(t,e,i):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function uc(t,e,i,s,n){const r=i.__;c(t)?Xh.drawStrokesStyle(t,e,!1,i,s,n):(s.setStroke(t,r.__strokeWidth*e,r),s.stroke()),r.__useArrow&&Xh.strokeArrow(t,i,s,n)}function pc(t,e,i,s,n){const r=i.__;c(t)?Xh.drawStrokesStyle(t,e,!0,i,s,n):(s.setStroke(t,r.__strokeWidth*e,r),Xh.drawTextStroke(i,s,n))}function gc(t,e,i,s,n){const r=s.getSameCanvas(!0,!0);r.font=i.__.__font,pc(t,2,i,r,n),r.blendMode="outside"===e?"destination-out":"destination-in",Xh.fillText(i,r,n),r.blendMode="normal",ro.copyCanvasByWorld(i,s,r),r.recycle(i.__nowWorld)}dc.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},dc.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},dc.hitPixel=function(t,e,i=1){let{x:s,y:n,radiusX:r,radiusY:o}=t;e&&(s-=e.x,n-=e.y),Zt.set(s-r,n-o,2*r,2*o).scale(i).ceil();const{data:a}=this.context.getImageData(Zt.x,Zt.y,Zt.width||1,Zt.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{getSpread:_c,copyAndSpread:fc,toOuterOf:mc,getOuterOf:yc,getByMove:vc,move:xc,getIntersectData:wc}=Xt,Ec={};let bc;const{stintSet:kc}=g,{hasTransparent:Sc}=Uh;function Bc(t,e,i){if(!c(e)||!1===e.visible||0===e.opacity)return;let s;const{boxBounds:r}=i.__layout;switch(e.type){case"image":s=Vh.image(i,t,e,r,!bc||!bc[e.url]);break;case"linear":s=jh.linearGradient(e,r);break;case"radial":s=jh.radialGradient(e,r);break;case"angular":s=jh.conicGradient(e,r);break;case"solid":const{type:o,color:a,opacity:h}=e;s={type:o,style:Uh.string(a,h)};break;default:n(e.r)||(s={type:"solid",style:Uh.string(e)})}if(s&&(s.originPaint=e,o(s.style)&&Sc(s.style)&&(s.isTransparent=!0),e.style)){if(0===e.style.strokeWidth)return;s.strokeStyle=e.style}return s}const Tc={compute:function(t,e){const i=e.__,s=[];let n,r,o,a=i.__input[t];d(a)||(a=[a]),bc=Vh.recycleImage(t,i);for(let i,n=0,r=a.length;n<r;n++)(i=Bc(t,a[n],e))&&(s.push(i),i.strokeStyle&&(o||(o=1),i.strokeStyle.strokeWidth&&(o=Math.max(o,i.strokeStyle.strokeWidth))));i["_"+t]=s.length?s:void 0,s.length?(s.every(t=>t.isTransparent)&&(s.some(t=>t.image)&&(n=!0),r=!0),"fill"===t?(kc(i,"__isAlphaPixelFill",n),kc(i,"__isTransparentFill",r)):(kc(i,"__isAlphaPixelStroke",n),kc(i,"__isTransparentStroke",r),kc(i,"__hasMultiStrokeStyle",o))):i.__removePaint(t,!1)},fill:function(t,e,i,s){i.fillStyle=t,cc(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,Vh.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);(!0===r.scaleFixed||"zoom-in"===r.scaleFixed&&t>1&&s>1)&&i.scale(1/t,1/s)}r.blendMode&&(i.blendMode=r.blendMode),cc(e,i,s),i.restore()}else r.blendMode?(i.saveBlendMode(r.blendMode),cc(e,i,s),i.restoreBlendMode()):cc(e,i,s)}},fillPathOrText:cc,fillText:function(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)Xh.strokeText(t,e,i,s);else switch(n.strokeAlign){case"center":uc(t,1,e,i,s);break;case"inside":!function(t,e,i,s){i.save(),i.clipUI(e),uc(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)uc(t,2,e,i,s);else{const{renderBounds:r}=e.__layout,o=i.getSameCanvas(!0,!0);e.__drawRenderPath(o),uc(t,2,e,o,s),o.clipUI(n),o.clearWorld(r),ro.copyCanvasByWorld(e,i,o),o.recycle(e.__nowWorld)}}(t,e,i,s)}},strokes:function(t,e,i,s){Xh.stroke(t,e,i,s)},strokeText:function(t,e,i,s){switch(e.__.strokeAlign){case"center":pc(t,1,e,i,s);break;case"inside":gc(t,"inside",e,i,s);break;case"outside":e.__.__fillAfterStroke?pc(t,2,e,i,s):gc(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||!Vh.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?Xh.drawTextStroke(s,n,r):n.stroke(),n.restoreBlendMode()):i?Xh.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?(fc(Ec,o.boxBounds,o.strokeSpread),Ec):o.boxBounds,r,a);let{scaleX:g,scaleY:_}=t.getRenderScaleData(!0);if(n.includes(a))p=s,h=u=a,l=r;else{let s;if(v.fullImageShadow)s=a;else{const t=o.renderShapeSpread?_c(n,P.swapAndScale(o.renderShapeSpread,g,_)):n;s=wc(t,a)}c=n.getFitMatrix(s);let{a:f,d:m}=c;c.a<1&&(p=e.getSameCanvas(),t.__renderShape(p,i),g*=f,_*=m),u=yc(a,c),h=vc(u,-c.e,-c.f),l=yc(r,c),xc(l,-c.e,-c.f);const y=i.matrix;y?(d=new mt(c),d.multiply(y),f*=y.scaleX,m*=y.scaleY):d=c,d.withScale(f,m),i=Object.assign(Object.assign({},i),{matrix:d})}return t.__renderShape(s,i),{canvas:s,matrix:d,fitMatrix:c,bounds:h,renderBounds:l,worldCanvas:p,shapeBounds:u,scaleX:g,scaleY:_}}};let Pc,Lc=new Kt;const{isSame:Rc}=Xt;function Cc(t,e,i,s,n,r){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=s.width/e.pixelRatio,e.__naturalHeight=s.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return n.data||Vh.createData(n,s,i,r),!0}function Oc(t,e){Ic(t,Fo.LOAD,e)}function Mc(t,e){Ic(t,Fo.LOADED,e)}function Dc(t,e,i){e.error=i,t.forceUpdate("surface"),Ic(t,Fo.ERROR,e)}function Ic(t,e,i){t.hasEvent(e)&&t.emitEvent(new Fo(e,i))}function Ac(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:Wc,translate:Fc}=Q,zc=new Kt,Hc={},Uc={};function Nc(t,e,i,s){const n=o(t)||s?(s?i-s*e:i%e)/((s||Math.floor(i/e))-1):t;return"auto"===t&&n<0?0:n}let Yc={},Xc={a:1,b:0,c:0,d:1,e:0,f:0};const{get:Vc,set:jc,rotateOfOuter:Gc,translate:Kc,scaleOfOuter:Zc,multiplyParent:qc,scale:Jc,rotate:$c,skew:Qc}=Q;function tu(t,e,i,s,n,r,o,a){o&&$c(t,o),a&&Qc(t,a.x,a.y),n&&Jc(t,n,r),Kc(t,e.x+i,e.y+s)}const{get:eu,scale:iu,copy:su}=Q,{getFloorScale:nu}=F,{abs:ru}=Math;const ou={image:function(t,e,i,s,n){let r,o;const a=tr.get(i);return Pc&&i===Pc.paint&&Rc(s,Pc.boxBounds)?r=Pc.leafPaint:(r={type:i.type,image:a},a.hasAlphaPixel&&(r.isTransparent=!0),Pc=a.use>1?{leafPaint:r,paint:i,boxBounds:Lc.set(s)}:null),(n||a.loading)&&(o={image:a,attrName:e,attrValue:i}),a.ready?(Cc(t,e,i,a,r,s),n&&(Oc(t,o),Mc(t,o))):a.error?n&&Dc(t,o,a.error):(n&&(Ac(t,!0),Oc(t,o)),r.loadId=a.load(()=>{Ac(t,!1),t.destroyed||(Cc(t,e,i,a,r,s)&&(a.hasAlphaPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Mc(t,o)),r.loadId=void 0},e=>{Ac(t,!1),Dc(t,o,e),r.loadId=void 0}),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}=Vh.getImageRenderScaleData(t,i,s,n),{image:a,data:h,originPaint:l}=t,{exporting:d}=n;return!(!h||t.patternId===r+"-"+o&&!d)&&(e&&(h.repeat?e=!1:l.changeful||"miniapp"===v.name&&Vo.isResizing(i)||d||(e=v.image.isLarge(a,r,o))),e?(i.__.__isFastShadow&&(s.fillStyle=t.style||"#000",s.fill()),Vh.drawImage(t,r,o,i,s,n),!0):(!t.style||l.sync||d?Vh.createPattern(t,i,s,n):Vh.createPatternTask(t,i,s,n),!1))},drawImage:function(t,e,i,s,n,r){const{data:o,image:a}=t,{blendMode:h}=t.originPaint,{opacity:l,transform:d}=o,c=a.getFull(o.filters),u=s.__;let p,{width:g,height:_}=a;(p=d&&!d.onlyScale||u.path||u.cornerRadius)||l||h?(n.save(),p&&n.clipUI(s),h&&(n.blendMode=h),l&&(n.opacity*=l),d&&n.transform(d),n.drawImage(c,0,0,g,_),n.restore()):(o.scaleX&&(g*=o.scaleX,_*=o.scaleY),n.drawImage(c,0,0,g,_))},getImageRenderScaleData:function(t,e,i,s){const n=e.getRenderScaleData(!0,t.originPaint.scaleFixed),{data:r}=t;if(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(d(i)){let s,n,r,o,a;for(let h=0,l=i.length;h<l;h++)s=i[h],n=s.image,a=n&&n.url,a&&(r||(r={}),r[a]=!0,tr.recycle(n),n.loading&&(o||(o=e.__input&&e.__input[t]||[],d(o)||(o=[o])),n.unload(i[h].loadId,!o.some(t=>t.url===a))));return r}return null},createPatternTask:function(t,e,i,s){t.patternTask||(t.patternTask=tr.patternTasker.add(()=>fe(this,void 0,void 0,function*(){t.patternTask=null,i.bounds.hit(e.__nowWorld)&&Vh.createPattern(t,e,i,s),e.forceUpdate("surface")}),300))},createPattern:function(t,e,i,s){let{scaleX:n,scaleY:r}=Vh.getImageRenderScaleData(t,e,i,s),o=n+"-"+r;if(t.patternId!==o&&!e.destroyed&&(!v.image.isLarge(t.image,n,r)||t.data.repeat)){const{image:i,data:s}=t,{transform:a,gap:h}=s,l=Vh.getPatternFixScale(t,n,r);let d,c,u,{width:p,height:g}=i;l&&(n*=l,r*=l),p*=n,g*=r,h&&(c=h.x*n/ru(s.scaleX||1),u=h.y*r/ru(s.scaleY||1)),(a||1!==n||1!==r)&&(n*=nu(p+(c||0)),r*=nu(g+(u||0)),d=eu(),a&&su(d,a),iu(d,1/n,1/r));const _=i.getCanvas(p,g,s.opacity,s.filters,c,u,e.leafer&&e.leafer.config.smooth),f=i.getPattern(_,s.repeat||v.origin.noRepeat||"no-repeat",d,t);t.style=f,t.patternId=o}},getPatternFixScale:function(t,e,i){const{image:s}=t;let n,r=v.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=Vh.getPatternData(i,s,e)},getPatternData:function(t,e,i){t.padding&&(e=zc.set(e).shrink(t.padding)),"strench"===t.mode&&(t.mode="stretch");const{width:s,height:n}=i,{opacity:r,mode:a,align:h,offset:l,scale:d,size:u,rotation:p,skew:g,clipSize:_,repeat:f,gap:m,filters:y}=t,v=e.width===s&&e.height===n,x={mode:a},w="center"!==h&&(p||0)%180==90;let E,b;switch(Xt.set(Uc,0,0,w?n:s,w?s:n),a&&"cover"!==a&&"fit"!==a?((d||u)&&(F.getScaleData(d,u,i,Hc),E=Hc.scaleX,b=Hc.scaleY),(h||m||f)&&(E&&Xt.scale(Uc,E,b,!0),h&&Tt.toPoint(h,Uc,e,Uc,!0,!0))):v&&!p||(E=b=Xt.getFitScale(e,Uc,"fit"!==a),Xt.put(e,i,h,E,!1,Uc),Xt.scale(Uc,E,b,!0)),l&&dt.move(Uc,l),a){case"stretch":v?E&&(E=b=void 0):(E=e.width/s,b=e.height/n,Vh.stretchMode(x,e,E,b));break;case"normal":case"clip":if(Uc.x||Uc.y||E||_||p||g){let t,i;_&&(t=e.width/_.width,i=e.height/_.height),Vh.clipMode(x,e,Uc.x,Uc.y,E,b,p,g,t,i),t&&(E=E?E*t:t,b=b?b*i:i)}break;case"repeat":(!v||E||p||g)&&Vh.repeatMode(x,e,s,n,Uc.x,Uc.y,E,b,p,g,h,t.freeTransform),f||(x.repeat="repeat");const i=c(f);(m||i)&&(x.gap=function(t,e,i,s,n){let r,o;c(t)?(r=t.x,o=t.y):r=o=t;return{x:Nc(r,i,n.width,e&&e.x),y:Nc(o,s,n.height,e&&e.y)}}(m,i&&f,Uc.width,Uc.height,e));break;default:E&&Vh.fillOrFitMode(x,e,Uc.x,Uc.y,E,b,p)}return x.transform||(e.x||e.y)&&Fc(x.transform=Wc(),e.x,e.y),E&&(x.scaleX=E,x.scaleY=b),r&&r<1&&(x.opacity=r),y&&(x.filters=y),f&&(x.repeat=o(f)?"x"===f?"repeat-x":"repeat-y":"repeat"),x},stretchMode:function(t,e,i,s){const n=Vc(),{x:r,y:o}=e;r||o?Kc(n,r,o):n.onlyScale=!0,Jc(n,i,s),t.transform=n},fillOrFitMode:function(t,e,i,s,n,r,o){const a=Vc();Kc(a,e.x+i,e.y+s),Jc(a,n,r),o&&Gc(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=Vc();tu(d,e,i,s,n,r,o,a),h&&(o||a?(jc(Xc),Zc(Xc,e,h,l),qc(d,Xc)):Zc(d,e,h,l)),t.transform=d},repeatMode:function(t,e,i,s,n,r,o,a,h,l,d,c){const u=Vc();if(c)tu(u,e,n,r,o,a,h,l);else{if(h)if("center"===d)Gc(u,{x:i/2,y:s/2},h);else switch($c(u,h),h){case 90:Kc(u,s,0);break;case 180:Kc(u,i,s);break;case 270:Kc(u,0,i)}Yc.x=e.x+n,Yc.y=e.y+r,Kc(u,Yc.x,Yc.y),o&&Zc(u,Yc,o,a)}t.transform=u}},{toPoint:au}=kt,{hasTransparent:hu}=Uh,lu={},du={};function cu(t,e,i,s){if(i){let n,r,a,h;for(let t=0,l=i.length;t<l;t++)n=i[t],o(n)?(a=t/(l-1),r=Uh.string(n,s)):(a=n.offset,r=Uh.string(n.color,s)),e.addColorStop(a,r),!h&&hu(r)&&(h=!0);h&&(t.isTransparent=!0)}}const{getAngle:uu,getDistance:pu}=dt,{get:gu,rotateOfOuter:_u,scaleOfOuter:fu}=Q,{toPoint:mu}=kt,yu={},vu={};function xu(t,e,i,s,n){let r;const{width:o,height:a}=t;if(o!==a||s){const t=uu(e,i);r=gu(),n?(fu(r,e,o/a*(s||1),1),_u(r,e,t+90)):(fu(r,e,1,o/a*(s||1)),_u(r,e,t))}return r}const{getDistance:wu}=dt,{toPoint:Eu}=kt,bu={},ku={};const Su={linearGradient:function(t,e){let{from:i,to:s,type:n,opacity:r}=t;au(i||"top",e,lu),au(s||"bottom",e,du);const o=v.canvas.createLinearGradient(lu.x,lu.y,du.x,du.y),a={type:n,style:o};return cu(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,yu),mu(s||"bottom",e,vu);const a=v.canvas.createRadialGradient(yu.x,yu.y,0,yu.x,yu.y,pu(yu,vu)),h={type:n,style:a};cu(h,a,t.stops,r);const l=xu(e,yu,vu,o,!0);return l&&(h.transform=l),h},conicGradient:function(t,e){let{from:i,to:s,type:n,opacity:r,stretch:o}=t;Eu(i||"center",e,bu),Eu(s||"bottom",e,ku);const a=v.conicGradientSupport?v.canvas.createConicGradient(0,bu.x,bu.y):v.canvas.createRadialGradient(bu.x,bu.y,0,bu.x,bu.y,wu(bu,ku)),h={type:n,style:a};cu(h,a,t.stops,r);const l=xu(e,bu,ku,o||1,v.conicGradientRotate90);return l&&(h.transform=l),h},getTransform:xu},{copy:Bu,move:Tu,toOffsetOutBounds:Pu}=Xt,{max:Lu,abs:Ru}=Math,Cu={},Ou=new mt,Mu={};function Du(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=Ru(t.spread||0),o=Lu(o,n+r-s),a=Lu(a,n+r+i),h=Lu(h,n+r+s),l=Lu(l,n+r-i)}),o===a&&a===h&&h===l?o:[o,a,h,l]}function Iu(t,e,i){const{shapeBounds:s}=i;let n,r;v.fullImageShadow?(Bu(Cu,t.bounds),Tu(Cu,e.x-s.x,e.y-s.y),n=t.bounds,r=Cu):(n=s,r=e),t.copyWorld(i.canvas,n,r)}const{toOffsetOutBounds:Au}=Xt,Wu={};const Fu=Du;const zu={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(),g=o.length-1;Pu(h,Mu,l),o.forEach((o,_)=>{let f=1;if(o.scaleFixed){const t=Math.abs(r.scaleX);t>1&&(f=1/t)}p.setWorldShadow(Mu.offsetX+(o.x||0)*c*f,Mu.offsetY+(o.y||0)*u*f,(o.blur||0)*c*f,Uh.string(o.color)),n=Gh.getShadowTransform(t,p,i,o,Mu,f),n&&p.setTransform(n),Iu(p,Mu,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")),ro.copyCanvasByWorld(t,e,p,s,o.blendMode),g&&_<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(),g=o.length-1;Au(h,Wu,l),o.forEach((o,_)=>{let f=1;if(o.scaleFixed){const t=Math.abs(r.scaleX);t>1&&(f=1/t)}p.save(),p.setWorldShadow(Wu.offsetX+(o.x||0)*c*f,Wu.offsetY+(o.y||0)*u*f,(o.blur||0)*c*f),n=Gh.getShadowTransform(t,p,i,o,Wu,f,!0),n&&p.setTransform(n),Iu(p,Wu,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,Uh.string(o.color),"source-in"),ro.copyCanvasByWorld(t,e,p,s,o.blendMode),g&&_<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:Du,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 Ou.set().scaleOfOuter({x:(n.x+n.width/2)*e.pixelRatio,y:(n.y+n.height/2)*e.pixelRatio},1+i/a,1+i/h),Ou}},isTransformShadow(t){},getInnerShadowSpread:Fu},{excludeRenderBounds:Hu}=go;let Uu;function Nu(t,e,i,s,n,r,o,a){switch(e){case"grayscale":Uu||(Uu=!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);Xu(t,e,i,1,n,r)}(t,i,s,n,o,a);break;case"opacity-path":Xu(t,i,s,r,o,a);break;case"path":a&&i.restore()}}function Yu(t){return t.getSameCanvas(!1,!0)}function Xu(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&&(Nu(this,o,t,n,s,r,void 0,!0),s=n=null),"clipping"!==a&&"clipping-path"!==a||Hu(i,e)||i.__render(t,e),r=i.__.opacity,Uu=!1,"path"===a||"clipping-path"===a?(r<1?(o="opacity-path",n||(n=Yu(t))):(o="path",t.save()),i.__clip(n||t,e)):(o="grayscale"===a?"grayscale":"alpha",s||(s=Yu(t)),n||(n=Yu(t)),i.__render(s,e));continue}const d=1===r&&i.__.__blendMode;d&&Nu(this,o,t,n,s,r,void 0,!1),Hu(i,e)||i.__render(n||t,e),d&&Nu(this,o,t,n,s,r,d,!1)}Nu(this,o,t,n,s,r,void 0,!0)};const Vu=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",ju=Vu+"_#~&*+\\=|≮≯≈≠=…",Gu=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 Ku(t){const e={};return t.split("").forEach(t=>e[t]=!0),e}const Zu=Ku("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),qu=Ku("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Ju=Ku(Vu),$u=Ku(ju),Qu=Ku("- —/~|┆·");var tp;!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"}(tp||(tp={}));const{Letter:ep,Single:ip,Before:sp,After:np,Symbol:rp,Break:op}=tp;function ap(t){return Zu[t]?ep:Qu[t]?op:qu[t]?sp:Ju[t]?np:$u[t]?rp:Gu.test(t)?ip:ep}const hp={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 lp(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:dp}=hp,{Letter:cp,Single:up,Before:pp,After:gp,Symbol:_p,Break:fp}=tp;let mp,yp,vp,xp,wp,Ep,bp,kp,Sp,Bp,Tp,Pp,Lp,Rp,Cp,Op,Mp,Dp=[];function Ip(t,e){Sp&&!kp&&(kp=Sp),mp.data.push({char:t,width:e}),vp+=e}function Ap(){xp+=vp,mp.width=vp,yp.words.push(mp),mp={data:[]},vp=0}function Wp(){Rp&&(Cp.paraNumber++,yp.paraStart=!0,Rp=!1),Sp&&(yp.startCharSize=kp,yp.endCharSize=Sp,kp=0),yp.width=xp,Op.width?dp(yp):Mp&&Fp(),Dp.push(yp),yp={words:[]},xp=0}function Fp(){xp>(Cp.maxWidth||0)&&(Cp.maxWidth=xp)}const{top:zp,right:Hp,bottom:Up,left:Np}=t.Direction4;function Yp(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 Xp={getDrawData:function(t,e){o(t)||(t=String(t));let i=0,s=0,n=e.__getInput("width")||0,r=e.__getInput("height")||0;const{__padding:a}=e;a&&(n?(i=a[Np],n-=a[Hp]+a[Np],!n&&(n=.01)):e.autoSizeAlign||(i=a[Np]),r?(s=a[zp],r-=a[zp]+a[Up],!r&&(r=.01)):e.autoSizeAlign||(s=a[zp]));const h={bounds:{x:i,y:s,width:n,height:r},rows:[],paraNumber:0,font:v.canvas.font=e.__font};return function(t,e,i){Cp=t,Dp=t.rows,Op=t.bounds,Mp=!Op.width&&!i.autoSizeAlign;const{__letterSpacing:s,paraIndent:n,textCase:r}=i,{canvas:o}=v,{width:a}=Op;if(i.__isCharMode){const t="none"!==i.textWrap,h="break"===i.textWrap;Rp=!0,Tp=null,kp=bp=Sp=vp=xp=0,mp={data:[]},yp={words:[]},s&&(e=[...e]);for(let i=0,l=e.length;i<l;i++)Ep=e[i],"\n"===Ep?(vp&&Ap(),yp.paraEnd=!0,Wp(),Rp=!0):(Bp=ap(Ep),Bp===cp&&"none"!==r&&(Ep=lp(Ep,r,!vp)),bp=o.measureText(Ep).width,s&&(s<0&&(Sp=bp),bp+=s),Pp=Bp===up&&(Tp===up||Tp===cp)||Tp===up&&Bp!==gp,Lp=!(Bp!==pp&&Bp!==up||Tp!==_p&&Tp!==gp),wp=Rp&&n?a-n:a,t&&a&&xp+vp+bp>wp&&(h?(vp&&Ap(),xp&&Wp()):(Lp||(Lp=Bp===cp&&Tp==gp),Pp||Lp||Bp===fp||Bp===pp||Bp===up||vp+bp>wp?(vp&&Ap(),xp&&Wp()):xp&&Wp()))," "===Ep&&!0!==Rp&&xp+vp===0||(Bp===fp?(" "===Ep&&vp&&Ap(),Ip(Ep,bp),Ap()):Pp||Lp?(vp&&Ap(),Ip(Ep,bp)):Ip(Ep,bp)),Tp=Bp);vp&&Ap(),xp&&Wp(),Dp.length>0&&(Dp[Dp.length-1].paraEnd=!0)}else e.split("\n").forEach(t=>{Cp.paraNumber++,xp=o.measureText(t).width,Dp.push({x:n||0,text:t,width:xp,paraStart:!0}),Mp&&Fp()})}(h,t,e),a&&function(t,e,i,s,n){if(!s&&i.autoSizeAlign)switch(i.textAlign){case"left":Yp(e,"x",t[Np]);break;case"right":Yp(e,"x",-t[Hp])}if(!n&&i.autoSizeAlign)switch(i.verticalAlign){case"top":Yp(e,"y",t[zp]);break;case"bottom":Yp(e,"y",-t[Up])}}(a,h,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:g,width:_,height:f}=s,m=r*n+(c?c*(t.paraNumber-1):0),y=o;if(h&&m>f)m=Math.max(f,r),n>1&&(t.overflow=n);else if(f||u)switch(d){case"middle":g+=(f-m)/2;break;case"bottom":g+=f-m}y+=g;let v,x,w,E=_||u?_:t.maxWidth;for(let o=0,d=n;o<d;o++){if(v=i[o],v.x=p,v.width<_||v.width>_&&!h)switch(l){case"center":v.x+=(E-v.width)/2;break;case"right":v.x+=E-v.width}v.paraStart&&c&&o>0&&(y+=c),v.y=y,y+=r,t.overflow>o&&y>m&&(v.isOverflow=!0,t.overflow=o+1),x=v.x,w=v.width,a<0&&(v.width<0?(w=-v.width+e.fontSize+a,x-=w,w+=e.fontSize):w-=a),x<s.x&&(s.x=x),w>s.width&&(s.width=w),h&&_&&_<w&&(v.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=g,s.height=m}(h,e),e.__isCharMode&&function(t,e,i){const{rows:s}=t,{textAlign:n,paraIndent:r,letterSpacing:o}=e,a=i&&n.includes("both"),h=a||i&&n.includes("justify"),l=h&&n.includes("letter");let d,c,u,p,g,_,f,m,y,v;s.forEach(t=>{t.words&&(g=r&&t.paraStart?r:0,m=t.words.length,h&&(v=!t.paraEnd||a,c=i-t.width-g,l?p=c/(t.words.reduce((t,e)=>t+e.data.length,0)-1):u=m>1?c/(m-1):0),_=o||t.isOverflow||l?0:u?1:2,t.isOverflow&&!o&&(t.textMode=!0),2===_?(t.x+=g,function(t){t.text="",t.words.forEach(e=>{e.data.forEach(e=>{t.text+=e.char})})}(t)):(t.x+=g,d=t.x,t.data=[],t.words.forEach((e,i)=>{1===_?(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&&(y=i===m-1,u?y||(d+=u,t.width+=u):p&&(t.width+=p*(e.data.length-(y?1:0))))})),t.words=null)})}(h,e,n),h.overflow&&function(t,e,i,s){if(!s)return;const{rows:n,overflow:r}=t;let{textOverflow:o}=e;if(n.splice(r),o&&"show"!==o){let t,a;"hide"===o?o="":"ellipsis"===o&&(o="...");const h=o?v.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)}})}}(h,e,i,n),"none"!==e.textDecoration&&function(t,e){let i,s=0;const{fontSize:n,textDecoration:r}=e;switch(t.decorationHeight=n/11,c(r)?(i=r.type,r.color&&(t.decorationColor=Uh.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]}}(h,e),h}};const Vp={string:function(t,e){if(!t)return"#000";const i=h(e)&&e<1;if(o(t)){if(!i||!Uh.object)return t;t=Uh.object(t)}let s=n(t.a)?1:t.a;i&&(s*=e);const r=t.r+","+t.g+","+t.b;return 1===s?"rgb("+r+")":"rgba("+r+","+s+")"}};function jp(t){return t?d(t)?t:[t]:[]}Object.assign(Hh,Xp),Object.assign(Uh,Vp),Object.assign(Xh,Tc),Object.assign(Vh,ou),Object.assign(jh,Su),Object.assign(Gh,zu),Object.assign(ae,{interaction:(t,e,i,s)=>new Kd(t,e,i,s),hitCanvas:(t,e)=>new fh(t,e),hitCanvasManager:()=>new qd}),yh();class Gp extends Mo{get list(){return jp(this.value)}get oldList(){return jp(this.oldValue)}constructor(t,e){super(t),e&&Object.assign(this,e)}}function Kp(t){return(e,i)=>{const s="_"+i;rr(e,i,{get(){return this[s]},set(e){const n=this[s];if(n!==e){const r=this;if(r.config){const t="target"===i;if(t){const{beforeSelect:t}=r.config;if(t){const i=t({target:e});if(c(i))e=i;else if(!1===i)return}r.setDimOthers(!1),r.setBright(!1),d(e)&&e.length>1&&e[0].locked&&e.splice(0,1),r.single&&(delete r.element.syncEventer,delete r.element.__world.ignorePixelSnap)}const s=t?Gp.BEFORE_SELECT:Gp.BEFORE_HOVER;this.hasEvent(s)&&this.emitEvent(new Gp(s,{editor:r,value:e,oldValue:n}))}this[s]=e,t(this,n)}}})}}Gp.BEFORE_SELECT="editor.before_select",Gp.SELECT="editor.select",Gp.AFTER_SELECT="editor.after_select",Gp.BEFORE_HOVER="editor.before_hover",Gp.HOVER="editor.hover";const{abs:Zp}=Math,{copy:qp,scale:Jp}=Q,{setListWithFn:$p}=Xt,{worldBounds:Qp}=go,tg={a:1,b:0,c:0,d:1,e:0,f:0},eg={x:0,y:0,width:0,height:0};class ig extends t.UI{constructor(){super(),this.list=[],this.visible=0,this.hittable=!1,this.strokeAlign="center"}setTarget(t,e){e&&this.set(e),this.target=t,this.update()}update(t){const{list:e}=this;e.length?($p(eg,e,Qp),t&&this.set(t),this.set(eg),this.visible=!0):this.visible=0}__draw(t,e){const{list:i}=this;if(i.length){let s;const n=this.__,{stroke:r,strokeWidth:a,fill:h}=n,{bounds:l}=e;for(let d=0;d<i.length;d++){s=i[d];const{worldTransform:c,worldRenderBounds:u}=s;if(u.width&&u.height&&(!l||l.hit(u,e.matrix))){const i=Zp(c.scaleX),l=Zp(c.scaleY);if(qp(tg,c),tg.half=a%2,i!==l){Jp(tg,1/i,1/l),t.setWorld(tg,e.matrix),t.beginPath(),n.strokeWidth=a;const{x:r,y:o,width:h,height:d}=s.__layout.boxBounds;t.rect(r*i,o*l,h*i,d*l)}else t.setWorld(tg,e.matrix),t.beginPath(),s.__.__useArrow?s.__drawPath(t):s.__.__pathForRender?s.__drawRenderPath(t):s.__drawPathByBox(t),n.strokeWidth=a/Zp(c.scaleX);r&&(o(r)?Xh.stroke(r,this,t,e):Xh.strokes(r,this,t,e)),h&&(o(h)?Xh.fill(h,this,t,e):Xh.fills(h,this,t,e))}}n.strokeWidth=a}}destroy(){this.target=null,super.destroy()}}_e([Kp(function(t){const e=t.target;t.list=e?d(e)?e:[e]:[]})],ig.prototype,"target",void 0);class sg extends t.Group{constructor(e){super(e),this.strokeArea=new t.Rect({strokeAlign:"center"}),this.fillArea=new t.Rect,this.visible=0,this.hittable=!1,this.addMany(this.fillArea,this.strokeArea)}setStyle(t,e){const{visible:i,stroke:s,strokeWidth:n}=t;this.visible=i,this.strokeArea.reset(Object.assign({stroke:s,strokeWidth:n},e||{})),this.fillArea.reset({visible:!e,fill:s,opacity:.2})}setBounds(t){this.strokeArea.set(t),this.fillArea.set(t)}}const ng={findOne:t=>t.list.find(t=>t.editable),findByBounds(t,e){const i=[];return rg([t],i,e),i}};function rg(t,e,i){let s,n;for(let r=0,o=t.length;r<o;r++)if(s=t[r],n=s.__,n.hittable&&n.visible&&!n.locked&&i.hit(s.__world)){if(n.editable){if(s.isBranch&&!n.hitChildren){n.hitSelf&&e.push(s);continue}if(s.isFrame){if(i.includes(s.__layout.boxBounds,s.__world)){e.push(s);continue}}else i.hit(s.__layout.boxBounds,s.__world)&&n.hitSelf&&e.push(s)}s.isBranch&&rg(s.children,e,i)}}const{findOne:og,findByBounds:ag}=ng;class hg extends t.Group{get dragging(){return!!this.originList}get running(){const{editor:t,app:e}=this;return this.hittable&&t.visible&&t.hittable&&t.mergeConfig.selector&&e&&"normal"===e.mode}get isMoveMode(){const{app:t}=this;return t&&t.interaction.moveMode}constructor(t){super(),this.hoverStroker=new ig,this.targetStroker=new ig,this.bounds=new Kt,this.selectArea=new sg,this.__eventIds=[],this.editor=t,this.addMany(this.targetStroker,this.hoverStroker,this.selectArea),this.__listenEvents()}onHover(){const{editor:t}=this;if(!this.running||this.dragging||t.dragging)this.hoverStroker.target=null;else{const{hoverTarget:e,mergeConfig:i}=t,s=Object.assign({},i);e&&e.editConfig&&Object.assign(s,e.editConfig);const{stroke:n,strokeWidth:r,hover:o,hoverStyle:a}=s;this.hoverStroker.setTarget(o?e:null,Object.assign({stroke:n,strokeWidth:r},a||{}))}}onSelect(){this.running&&(this.targetStroker.setTarget(this.editor.list),this.hoverStroker.target=null)}update(){this.hoverStroker.update();const{stroke:t,strokeWidth:e,selectedStyle:i}=this.editor.mergedConfig;this.targetStroker.update(Object.assign({stroke:t,strokeWidth:e&&Math.max(1,e/2)},i||{}))}onPointerMove(t){const{app:e,editor:i}=this;if(this.running&&!this.isMoveMode&&e.interaction.canHover&&!e.interaction.dragging){const e=this.findUI(t);i.hoverTarget=i.hasItem(e)?null:e}this.isMoveMode&&(i.hoverTarget=null)}onBeforeDown(t){if(t.multiTouch)return;const{select:e}=this.editor.mergeConfig;"press"===e&&(this.app.config.mobile?this.waitSelect=()=>this.checkAndSelect(t):this.checkAndSelect(t))}onTap(t){if(t.multiTouch)return;const{editor:e}=this,{select:i,selectKeep:s}=e.mergeConfig;"tap"===i?this.checkAndSelect(t):this.waitSelect&&this.waitSelect(),this.needRemoveItem?e.removeItem(this.needRemoveItem):this.isMoveMode&&(s||(e.target=null))}checkAndSelect(t){if(this.needRemoveItem=null,this.allowSelect(t)){const{editor:e}=this,i=this.findUI(t);i?this.isMultipleSelect(t)?e.hasItem(i)?this.needRemoveItem=i:e.addItem(i):e.target=i:this.allow(t.target)&&(this.isHoldMultipleSelectKey(t)||this.editor.mergedConfig.selectKeep||(e.target=null))}}onDragStart(t){if(!t.multiTouch&&(this.waitSelect&&this.waitSelect(),this.allowDrag(t))){const{editor:e}=this,{stroke:i,area:s}=e.mergeConfig,{x:n,y:r}=t.getInnerPoint(this);this.bounds.set(n,r),this.selectArea.setStyle({visible:!0,stroke:i,x:n,y:r},s),this.selectArea.setBounds(this.bounds.get()),this.originList=e.leafList.clone()}}onDrag(t){if(!t.multiTouch){if(this.editor.dragging)return this.onDragEnd(t);if(this.dragging){const{editor:e}=this,i=t.getInnerTotal(this),s=this.bounds.clone().unsign(),n=new gh(ag(e.app,s));if(this.bounds.width=i.x,this.bounds.height=i.y,this.selectArea.setBounds(s.get()),n.length){const t=[];this.originList.forEach(e=>{n.has(e)||t.push(e)}),n.forEach(e=>{this.originList.has(e)||t.push(e)}),(t.length!==e.list.length||e.list.some((e,i)=>e!==t[i]))&&(e.target=t)}else e.target=this.originList.list}}}onDragEnd(t){t.multiTouch||this.dragging&&(this.originList=null,this.selectArea.visible=0)}onAutoMove(t){if(this.dragging){const{x:e,y:i}=t.getLocalMove(this);this.bounds.x+=e,this.bounds.y+=i}}allow(t){return t.leafer!==this.editor.leafer}allowDrag(t){const{boxSelect:e,multipleSelect:i}=this.editor.mergeConfig;return!(!(this.running&&i&&e)||t.target.draggable)&&(!this.editor.editing&&this.allow(t.target)||this.isHoldMultipleSelectKey(t)&&!og(t.path))}allowSelect(t){return this.running&&!this.isMoveMode&&!t.middle}findDeepOne(t){const e={exclude:new gh(this.editor.editBox.rect)};return og(t.target.leafer.interaction.findPath(t,e))}findUI(t){return this.isMultipleSelect(t)?this.findDeepOne(t):og(t.path)}isMultipleSelect(t){const{multipleSelect:e,continuousSelect:i}=this.editor.mergeConfig;return e&&(this.isHoldMultipleSelectKey(t)||i)}isHoldMultipleSelectKey(t){const{multipleSelectKey:e}=this.editor.mergedConfig;return e?t.isHoldKeys(e):t.shiftKey}__listenEvents(){const{editor:e}=this;e.waitLeafer(()=>{const{app:i}=e;i.selector.proxy=e,this.__eventIds=[e.on_([[Gp.HOVER,this.onHover,this],[Gp.SELECT,this.onSelect,this]]),i.on_([[t.PointerEvent.MOVE,this.onPointerMove,this],[t.PointerEvent.BEFORE_DOWN,this.onBeforeDown,this],[t.PointerEvent.TAP,this.onTap,this],[t.DragEvent.START,this.onDragStart,this,!0],[t.DragEvent.DRAG,this.onDrag,this],[t.DragEvent.END,this.onDragEnd,this],[t.MoveEvent.MOVE,this.onAutoMove,this],[[t.ZoomEvent.ZOOM,t.MoveEvent.MOVE],()=>{this.editor.hoverTarget=null}]])]})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=this.originList=this.needRemoveItem=null,this.__removeListenEvents(),super.destroy()}}const{topLeft:lg,top:dg,topRight:cg,right:ug,bottomRight:pg,bottom:gg,bottomLeft:_g,left:fg}=t.Direction9,{toPoint:mg}=kt,{within:yg,sign:vg}=F,{abs:xg}=Math,wg={getScaleData(t,e,i,s,n,r,o,a){let l,d,c={},u=1,p=1;const{boxBounds:g,widthRange:_,heightRange:f,dragBounds:m,worldBoxBounds:y}=t,{width:v,height:x}=e,w=t.scaleX/e.scaleX,E=t.scaleY/e.scaleY,b=vg(w),k=vg(E),S=a?w:b*g.width/v,B=a?E:k*g.height/x;if(h(s))u=p=Math.sqrt(s);else{r&&(s.x*=2,s.y*=2),s.x*=a?w:b,s.y*=a?E:k;const t=(-s.y+x)/x,e=(s.x+v)/v,o=(s.y+x)/x,h=(-s.x+v)/v;switch(i){case dg:p=t,l="bottom";break;case ug:u=e,l="left";break;case gg:p=o,l="top";break;case fg:u=h,l="right";break;case lg:p=t,u=h,l="bottom-right";break;case cg:p=t,u=e,l="bottom-left";break;case pg:p=o,u=e,l="top-left";break;case _g:p=o,u=h,l="top-right"}if(n)if("corner"===n&&i%2)n=!1;else switch(i){case dg:case gg:u=p;break;case fg:case ug:p=u;break;default:d=Math.sqrt(xg(u*p)),u=vg(u)*d,p=vg(p)*d}}const T=1!==u,P=1!==p;if(T&&(u/=S),P&&(p/=B),!o){const{worldTransform:e}=t;u<0&&(u=1/g.width/e.scaleX),p<0&&(p=1/g.height/e.scaleY)}if(mg(r||l,g,c,!0),m){const e={x:u,y:p};Bd.limitScaleOf(t,c,e,n),u=e.x,p=e.y}if(T&&_){const e=g.width*t.scaleX;u=yg(e*u,_)/e}if(P&&f){const e=g.height*t.scaleY;p=yg(e*p,f)/e}return T&&xg(u*y.width)<1&&(u=vg(u)/y.width),P&&xg(p*y.height)<1&&(p=vg(p)/y.height),n&&u!==p&&(d=Math.min(xg(u),xg(p)),u=vg(u)*d,p=vg(p)*d),isFinite(u)||(u=1),isFinite(p)||(p=1),{origin:c,scaleX:u,scaleY:p,direction:i,lockRatio:n,around:r}},getRotateData(t,e,i,s,n){let r,o={};switch(e){case lg:r="bottom-right";break;case cg:r="bottom-left";break;case pg:r="top-left";break;case _g:r="top-right";break;default:r="center"}return mg(n||r,t.boxBounds,o,!0),{origin:o,rotation:dt.getRotation(s,t.getWorldPointByBox(o),i)}},getSkewData(t,e,i,s){let n,r,o={},a=0,h=0;switch(e){case dg:case lg:r={x:.5,y:0},n="bottom",a=1;break;case gg:case pg:r={x:.5,y:1},n="top",a=1;break;case fg:case _g:r={x:0,y:.5},n="right",h=1;break;case ug:case cg:r={x:1,y:.5},n="left",h=1}const{width:l,height:d}=t;r.x=r.x*l,r.y=r.y*d,mg(s||n,t,o,!0);const c=dt.getRotation(r,o,{x:r.x+(a?i.x:0),y:r.y+(h?i.y:0)});return a?a=-c:h=c,{origin:o,skewX:a,skewY:h}},getAround:(t,e)=>e&&!t?"center":t,getRotateDirection:(t,e,i=8)=>((t=(t+Math.round(e/(360/i)))%i)<0&&(t+=i),t),getFlipDirection(t,e,i){if(e)switch(t){case fg:t=ug;break;case lg:t=cg;break;case _g:t=pg;break;case ug:t=fg;break;case cg:t=lg;break;case pg:t=_g}if(i)switch(t){case dg:t=gg;break;case lg:t=_g;break;case cg:t=pg;break;case gg:t=dg;break;case _g:t=lg;break;case pg:t=cg}return t}},Eg={};function bg(t,e){const{enterPoint:i,dragging:s,skewing:n,resizing:r,flippedX:o,flippedY:a}=t;if(!i||!t.editor.editing||!t.canUse)return;if("rect"===i.name)return kg(t);if("circle"===i.name)return;let{rotation:h}=t;const{pointType:l}=i,{moveCursor:d,resizeCursor:c,rotateCursor:u,skewCursor:p,moveable:g,resizeable:_,rotateable:f,skewable:m}=t.mergeConfig;if("move"===l)return i.cursor=d,void(g||(i.visible=!1));if("button"===l)return void(i.cursor||(i.cursor="pointer"));let y=l.includes("resize");y&&f&&(t.isHoldRotateKey(e)||!_)&&(y=!1);const v=m&&!y&&("resize-line"===i.name||"skew"===l),x=s?n?p:r?c:u:v?p:y?c:u;h+=45*(wg.getFlipDirection(i.direction,o,a)+1),h=2*Math.round(F.formatRotation(h,!0)/2);const{url:w,x:E,y:b}=x,k=w+h;Eg[k]?i.cursor=Eg[k]:Eg[k]=i.cursor={url:Sg(w,h),x:E,y:b}}function kg(t){const{moveCursor:e,moveable:i}=t.mergeConfig;t.canUse&&(t.rect.cursor=i?e:void 0)}function Sg(t,e){return'"data:image/svg+xml,'+encodeURIComponent(t.replace("{{rotation}}",e.toString()))+'"'}class Bg extends t.Box{constructor(t){super(t),this.useFastShadow=!0}}const Tg=["top","right","bottom","left"],Pg=void 0;class Lg extends t.Group{get mergeConfig(){const{config:t}=this,{mergeConfig:e,editBox:i}=this.editor;return this.mergedConfig=t&&i!==this?Object.assign(Object.assign({},e),t):e}get target(){return this._target||this.editor.element}set target(t){this._target=t}get single(){return!!this._target||this.editor.single}get transformTool(){return this._transformTool||this.editor}set transformTool(t){this._transformTool=t}get flipped(){return this.flippedX||this.flippedY}get flippedX(){return this.scaleX<0}get flippedY(){return this.scaleY<0}get flippedOne(){return this.scaleX*this.scaleY<0}get canUse(){return this.app&&this.editor.editing}get canGesture(){if(!this.canUse)return!1;const{moveable:t,resizeable:e,rotateable:i}=this.mergeConfig;return o(t)||o(e)||o(i)}get canDragLimitAnimate(){return this.moving&&this.mergeConfig.dragLimitAnimate&&this.target.dragBounds}constructor(e){super(),this.view=new t.Group,this.rect=new Bg({name:"rect",hitFill:"all",hitStroke:"none",strokeAlign:"center",hitRadius:5}),this.circle=new Bg({name:"circle",strokeAlign:"center",around:"center",cursor:"crosshair",hitRadius:5}),this.buttons=new t.Group({around:"center",hitSelf:!1,visible:0}),this.resizePoints=[],this.rotatePoints=[],this.resizeLines=[],this.dragStartData={},this.__eventIds=[],this.editor=e,this.visible=!1,this.create(),this.__listenEvents()}create(){let t,e,i;const{view:s,resizePoints:n,rotatePoints:r,resizeLines:o,rect:a,circle:h,buttons:l}=this,d=["bottom-right","bottom","bottom-left","left","top-left","top","top-right","right"];for(let s=0;s<8;s++)t=new Bg({name:"rotate-point",around:d[s],width:15,height:15,hitFill:"all"}),r.push(t),this.listenPointEvents(t,"rotate",s),s%2&&(e=new Bg({name:"resize-line",around:"center",width:10,height:10,hitFill:"all"}),o.push(e),this.listenPointEvents(e,"resize",s)),i=new Bg({name:"resize-point",hitRadius:5}),n.push(i),this.listenPointEvents(i,"resize",s);this.listenPointEvents(h,"rotate",2),this.listenPointEvents(a,"move",8),s.addMany(...r,a,h,l,...o,...n),this.add(s)}load(){const{target:t,mergeConfig:e,single:i,rect:s,circle:n,resizePoints:o,resizeLines:a}=this,{stroke:h,strokeWidth:l,ignorePixelSnap:d}=e,c=this.getPointsStyle(),u=this.getMiddlePointsStyle(),p=this.getResizeLinesStyle();let _;this.visible=!t.locked;for(let t=0;t<8;t++)_=o[t],_.set(this.getPointStyle(t%2?u[(t-1)/2%u.length]:c[t/2%c.length])),_.rotation=(t-(t%2?1:0))/2*90,t%2&&a[(t-1)/2].set(Object.assign({pointType:"resize",rotation:(t-1)/2*90},p[(t-1)/2%p.length]||{}));n.set(this.getPointStyle(e.circle||e.rotatePoint||c[0])),s.set(Object.assign({stroke:h,strokeWidth:l,opacity:1,editConfig:Pg},e.rect||{}));const f=r(e.rectThrough)?i:e.rectThrough;s.hittable=!f,f&&(t.syncEventer=s,this.app.interaction.bottomList=[{target:s,proxy:t}]),i&&g.stintSet(t.__world,"ignorePixelSnap",d),kg(this)}update(){const{editor:t}=this,{x:e,y:i,scaleX:s,scaleY:n,rotation:r,skewX:o,skewY:a,width:h,height:l}=this.target.getLayoutBounds("box",t,!0);this.visible=!this.target.locked,this.set({x:e,y:i,scaleX:s,scaleY:n,rotation:r,skewX:o,skewY:a}),this.updateBounds({x:0,y:0,width:h,height:l})}unload(){this.visible=!1,this.app&&(this.rect.syncEventer=this.app.interaction.bottomList=null)}updateBounds(t){const{editor:e,mergeConfig:i,single:s,rect:n,circle:r,buttons:o,resizePoints:a,rotatePoints:l,resizeLines:d}=this,{editMask:c}=e,{middlePoint:u,resizeable:p,rotateable:g,hideOnSmall:_,editBox:f,mask:m,dimOthers:y,bright:v,spread:x,hideRotatePoints:w,hideResizeLines:E}=i;if(c.visible=!!m||0,e.setDimOthers(y),e.setBright(!!y||v),x&&Xt.spread(t,x),this.view.worldOpacity){const{width:e,height:c}=t,m=h(_)?_:10,y=f&&!(_&&e<m&&c<m);let v,x,b,k={};for(let i=0;i<8;i++)kt.toPoint(kt.directionData[i],t,k),x=a[i],v=l[i],x.set(k),v.set(k),x.visible=y&&!(!p&&!g),v.visible=y&&g&&p&&!w,i%2&&(b=d[(i-1)/2],b.set(k),b.visible=x.visible&&!E,x.visible=v.visible=y&&!!u,(i+1)/2%2?(b.width=e+b.height,_&&2*x.width>e&&(x.visible=!1)):(b.width=c+b.height,_&&2*x.width>c&&(x.visible=!1)));r.visible=y&&g&&!(!i.circle&&!i.rotatePoint),r.visible&&this.layoutCircle(),n.path&&(n.path=null),n.set(Object.assign(Object.assign({},t),{visible:!s||f})),o.visible=y&&o.children.length>0||0,o.visible&&this.layoutButtons()}else n.set(t)}layoutCircle(){const{circleDirection:t,circleMargin:e,buttonsMargin:i,buttonsDirection:s,middlePoint:n}=this.mergedConfig,r=Tg.indexOf(t||(this.buttons.children.length&&"bottom"===s?"top":"bottom"));this.setButtonPosition(this.circle,r,e||i,!!n)}layoutButtons(){const{buttons:t}=this,{buttonsDirection:e,buttonsFixed:i,buttonsMargin:s,middlePoint:n}=this.mergedConfig,{flippedX:r,flippedY:o}=this;let a=Tg.indexOf(e);(a%2&&r||(a+1)%2&&o)&&i&&(a=(a+2)%4);const h=i?wg.getRotateDirection(a,this.flippedOne?this.rotation:-this.rotation,4):a;this.setButtonPosition(t,h,s,!!n),i&&(t.rotation=90*(h-a)),t.scaleX=r?-1:1,t.scaleY=o?-1:1}setButtonPosition(t,e,i,s){const n=this.resizePoints[2*e+1],r=e%2,o=e&&3!==e?1:-1,a=(i+(e%2?(s?n.width:0)+t.boxBounds.width:(s?n.height:0)+t.boxBounds.height)/2)*o;r?(t.x=n.x+a,t.y=n.y):(t.x=n.x,t.y=n.y+a)}getPointStyle(t){const{stroke:e,strokeWidth:i,pointFill:s,pointSize:n,pointRadius:r}=this.mergedConfig,o={fill:s,stroke:e,strokeWidth:i,around:"center",strokeAlign:"center",opacity:1,width:n,height:n,cornerRadius:r,offsetX:0,offsetY:0,editConfig:Pg};return t?Object.assign(o,t):o}getPointsStyle(){const{point:t}=this.mergedConfig;return d(t)?t:[t]}getMiddlePointsStyle(){const{middlePoint:t}=this.mergedConfig;return d(t)?t:t?[t]:this.getPointsStyle()}getResizeLinesStyle(){const{resizeLine:t}=this.mergedConfig;return d(t)?t:[t]}onDragStart(t){this.dragging=!0;const e=this.dragPoint=t.current,{pointType:i}=e,{moveable:s,resizeable:n,rotateable:r,skewable:o}=this.mergeConfig;"move"===i?s&&(this.moving=!0):(i.includes("rotate")||this.isHoldRotateKey(t)||!n?(r&&(this.rotating=!0),"resize-rotate"===i?n&&(this.resizing=!0):"resize-line"===e.name&&(o&&(this.skewing=!0),this.rotating=!1)):"resize"===i&&n&&(this.resizing=!0),"skew"===i&&o&&(this.skewing=!0)),this.onTransformStart(t)}onDrag(t){const{transformTool:e,moving:i,resizing:s,rotating:n,skewing:r}=this;if(i)e.onMove(t);else if(s||n||r){const i=t.current;i.pointType&&(this.enterPoint=i),n&&e.onRotate(t),s&&e.onScale(t),r&&e.onSkew(t)}bg(this,t)}onDragEnd(t){this.onTransformEnd(t),this.dragPoint=null}onTransformStart(t){(this.moving||this.gesturing)&&(this.editor.opacity=this.mergedConfig.hideOnMove?0:1),this.resizing&&(Vo.resizingKeys=this.editor.leafList.keys);const{dragStartData:e,target:i}=this;e.x=t.x,e.y=t.y,e.totalOffset={x:0,y:0},e.point={x:i.x,y:i.y},e.bounds=Object.assign({},i.getLayoutBounds("box","local")),e.rotation=i.rotation}onTransformEnd(e){this.canDragLimitAnimate&&(e instanceof t.DragEvent||e instanceof t.MoveEvent)&&this.transformTool.onMove(e),this.resizing&&(Vo.resizingKeys=null),this.dragging=this.gesturing=this.moving=this.resizing=this.rotating=this.skewing=!1,this.editor.opacity=1,this.editor.update()}onMove(e){if(this.canGesture&&"drag"!==e.moveType&&(e.stop(),o(this.mergedConfig.moveable)))switch(this.gesturing=this.moving=!0,e.type){case t.MoveEvent.START:this.onTransformStart(e);break;case t.MoveEvent.END:this.onTransformEnd(e);break;default:this.transformTool.onMove(e)}}onScale(e){if(this.canGesture&&(e.stop(),o(this.mergedConfig.resizeable)))switch(this.gesturing=this.resizing=!0,e.type){case t.ZoomEvent.START:this.onTransformStart(e);break;case t.ZoomEvent.END:this.onTransformEnd(e);break;default:this.transformTool.onScale(e)}}onRotate(e){if(this.canGesture&&(e.stop(),o(this.mergedConfig.rotateable)))switch(this.gesturing=this.rotating=!0,e.type){case t.ZoomEvent.START:this.onTransformStart(e);break;case t.ZoomEvent.END:this.onTransformEnd(e);break;default:this.transformTool.onRotate(e)}}isHoldRotateKey(t){const{rotateKey:e}=this.mergedConfig;return e?t.isHoldKeys(e):t.metaKey||t.ctrlKey}onKey(t){bg(this,t)}onArrow(t){if(this.canUse&&this.mergeConfig.keyEvent){let e=0,i=0;const s=t.shiftKey?10:1;switch(t.code){case"ArrowDown":i=s;break;case"ArrowUp":i=-s;break;case"ArrowLeft":e=-s;break;case"ArrowRight":e=s}(e||i)&&this.transformTool.move(e,i)}}onDoubleTap(t){const{openInner:e,preventEditInner:i}=this.mergeConfig;"double"!==e||i||this.openInner(t)}onLongPress(t){const{openInner:e,preventEditInner:i}=this.mergeConfig;"long"===e&&i&&this.openInner(t)}openInner(e){const{editor:i,target:s}=this;if(this.single){if(s.locked)return;if(s.isBranch&&!s.editInner){if(s.textBox){const{children:e}=s,n=e.find(e=>e.editable&&e instanceof t.Text)||e.find(e=>e instanceof t.Text);if(n)return i.openInnerEditor(n)}i.openGroup(s),i.target=i.selector.findDeepOne(e)}else i.openInnerEditor()}}listenPointEvents(e,i,s){e.direction=s,e.pointType=i,this.__eventIds.push(e.on_([[t.DragEvent.START,this.onDragStart,this],[t.DragEvent.DRAG,this.onDrag,this],[t.DragEvent.END,this.onDragEnd,this],[t.PointerEvent.ENTER,t=>{this.enterPoint=e,bg(this,t)}],[t.PointerEvent.LEAVE,()=>{this.enterPoint=null}]]))}__listenEvents(){const{rect:e,editor:i,__eventIds:s}=this;s.push(e.on_([[t.PointerEvent.DOUBLE_TAP,this.onDoubleTap,this],[t.PointerEvent.LONG_PRESS,this.onLongPress,this]])),this.waitLeafer(()=>{s.push(i.app.on_([[[t.KeyEvent.HOLD,t.KeyEvent.UP],this.onKey,this],[t.KeyEvent.DOWN,this.onArrow,this],[[t.MoveEvent.START,t.MoveEvent.BEFORE_MOVE,t.MoveEvent.END],this.onMove,this,!0],[[t.ZoomEvent.START,t.ZoomEvent.BEFORE_ZOOM,t.ZoomEvent.END],this.onScale,this,!0],[[t.RotateEvent.START,t.RotateEvent.BEFORE_ROTATE,t.RotateEvent.END],this.onRotate,this,!0]]))})}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.editor=null,this.__removeListenEvents(),super.destroy()}}const Rg={x:0,y:0,width:1e5,height:1e5};class Cg extends t.UI{constructor(t){super(),this.editor=t,this.hittable=!1,this.visible=0}__updateWorldBounds(){Object.assign(this.__local,Rg),Object.assign(this.__world,Rg)}__draw(t,e){const{editor:i}=this,{mask:s}=i.mergedConfig;if(s&&i.editing){if(t.fillWorld(t.bounds,!0===s?"rgba(0,0,0,0.8)":s),e.bounds&&!e.bounds.hit(i.editBox.rect.__world,e.matrix))return;t.saveBlendMode("destination-out"),e=Object.assign(Object.assign({},e),{shape:!0}),i.list.forEach(i=>{i.__render(t,e);const{parent:s}=i;s&&s.textBox&&s.__renderShape(t,e)}),t.restoreBlendMode()}}destroy(){this.editor=null,super.destroy()}}const Og='\n<feOffset dy="1"/>\n<feGaussianBlur stdDeviation="1.5"/>\n<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.2 0"/>\n<feBlend mode="normal" in="SourceGraphic" result="shape"/>',Mg={editSize:"size",keyEvent:!0,stroke:"#836DFF",strokeWidth:2,pointFill:"#FFFFFF",pointSize:10,pointRadius:16,rotateGap:45,buttonsDirection:"bottom",buttonsMargin:12,hideOnSmall:!0,moveCursor:"move",resizeCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate({{rotation}},12,12)">\n<path d="M7.5 8.0H8.5V5.9L6.8 7.2L7.5 8.0ZM3 11.4L2.3 10.6L1.3 11.4L2.3 12.2L3 11.4ZM7.5 10.4H6.5V11.4H7.5V10.4ZM16.5 10.4V11.4H17.5V10.4H16.5ZM16.5 8.0L17.1 7.2L15.5 5.9V8.0H16.5ZM21 11.4L21.6 12.2L22.6 11.4L21.6 10.6L21 11.4ZM16.5 14.9H15.5V16.9L17.1 15.7L16.5 14.9ZM16.5 12.4H17.5V11.4H16.5V12.4ZM7.5 12.4V11.4H6.5V12.4H7.5ZM7.5 14.9L6.8 15.7L8.5 16.9V14.9H7.5ZM6.8 7.2L2.3 10.6L3.6 12.2L8.1 8.7L6.8 7.2ZM8.5 10.4V8.0H6.5V10.4H8.5ZM16.5 9.4H7.5V11.4H16.5V9.4ZM17.5 10.4V8.0H15.5V10.4H17.5ZM15.8 8.7L20.3 12.2L21.6 10.6L17.1 7.2L15.8 8.7ZM20.3 10.6L15.8 14.1L17.1 15.7L21.6 12.2L20.3 10.6ZM17.5 14.9V12.4H15.5V14.9H17.5ZM7.5 13.4H16.5V11.4H7.5V13.4ZM8.5 14.9V12.4H6.5V14.9H8.5ZM2.3 12.2L6.8 15.7L8.1 14.1L3.6 10.6L2.3 12.2Z" fill="white"/>\n<path fill-rule="evenodd" d="M3 11.4L7.5 8.0V10.4H16.5V8.0L21 11.4L16.5 14.9V12.4H7.5V14.9L3 11.4Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter id="f" x="-1.6" y="3.9" width="27.2" height="16.9" filterUnits="userSpaceOnUse">\n${Og}\n</filter>\n</defs>\n</svg>\n`,x:12,y:12},rotateCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate(135,12,12),rotate({{rotation}},12,12)">\n<path d="M20.4 8H21.4L20.8 7.1L17.3 2.6L17 2.1L16.6 2.6L13.1 7.1L12.5 8H13.5H15.4C14.9 11.8 11.8 14.9 8 15.4V13.5V12.5L7.1 13.1L2.6 16.6L2.1 17L2.6 17.3L7.1 20.8L8 21.4V20.4V18.4C13.5 17.9 17.9 13.5 18.4 8H20.4Z" stroke="white"/>\n<path fill-rule="evenodd" d="M17 3L20.4 7.5H17.9C17.7 13.1 13.1 17.7 7.5 17.9V20.4L3 17L7.5 13.5V15.9C12.0 15.7 15.7 12.0 15.9 7.5H13.5L17 3Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter id="f" x="-1.6" y="-0.6" width="27.1" height="27.1" filterUnits="userSpaceOnUse">\n${Og}\n</filter>\n</defs>\n</svg>\n`,x:12,y:12},skewCursor:{url:`\n<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">\n<g filter="url(#f)">\n<g transform="rotate(90,12,12),rotate({{rotation}},12,12)">\n<path d="M21 10.4L21 11.4L23.8 11.4L21.6 9.6L21 10.4ZM17 10.4V11.4L17 11.4L17 10.4ZM15.5 6L16.1 5.2L14.5 3.9V6H15.5ZM15.5 8.4V9.4H16.5V8.4H15.5ZM6 8.4V7.4H5V8.4H6ZM6 10.4H5V11.4H6V10.4ZM7 14.4V13.4L7 13.4L7 14.4ZM3 14.4L3 13.4L0.1 13.4L2.3 15.2L3 14.4ZM8.5 18.9L7.8 19.7L9.5 21.0V18.9H8.5ZM8.5 16.4V15.4H7.5V16.4H8.5ZM19 16.4V17.4H20V16.4H19ZM19 14.4H20V13.4H19V14.4ZM21 9.4L17 9.4L17 11.4L21 11.4L21 9.4ZM14.8 6.7L20.3 11.2L21.6 9.6L16.1 5.2L14.8 6.7ZM16.5 8.4V6H14.5V8.4H16.5ZM6 9.4H15.5V7.4H6V9.4ZM7 10.4V8.4H5V10.4H7ZM15.5 9.4H6V11.4H15.5V9.4ZM17 9.4H15.5V11.4H17V9.4ZM7 15.4H8.5V13.4H7V15.4ZM3 15.4L7 15.4L7 13.4L3 13.4L3 15.4ZM9.1 18.1L3.6 13.6L2.3 15.2L7.8 19.7L9.1 18.1ZM7.5 16.4V18.9H9.5V16.4H7.5ZM19 15.4H8.5V17.4H19V15.4ZM18 14.4V16.4H20V14.4H18ZM8.5 15.4H19V13.4H8.5V15.4Z" fill="white"/>\n<path fill-rule="evenodd" d="M17 10.4L21 10.4L15.5 6V8.4H6V10.4H15.5H17ZM8.5 14.4H7L3 14.4L8.5 18.9V16.4H19V14.4H8.5Z" fill="black"/>\n</g>\n</g>\n<defs>\n<filter x="-2.8" y="1.9" width="29.6" height="23.1" filterUnits="userSpaceOnUse" >\n${Og}\n</filter>\n</defs>\n</svg>\n`,x:12,y:12},selector:!0,editBox:!0,hover:!0,select:"press",openInner:"double",multipleSelect:!0,boxSelect:!0,moveable:!0,resizeable:!0,flipable:!0,rotateable:!0,skewable:!0},Dg=new Kt;function Ig(t){const{simulateTarget:e,list:i}=t,{zoomLayer:s}=i[0].leafer;e.safeChange(()=>{Dg.setListWithFn(i,t=>t.getBounds("box","page")),0===Dg.width&&(Dg.width=.1),0===Dg.height&&(Dg.height=.1),e.reset(Dg.get())}),s.add(e)}const Ag=(t,e)=>t.parent.children.indexOf(t)-e.parent.children.indexOf(e),Wg=(t,e)=>e.parent.children.indexOf(e)-t.parent.children.indexOf(t),Fg={group(e,i,s){e.sort(Wg);const{app:n,parent:r}=e[0];let o;o=s&&s.add?s:new t.Group(s),r.addAt(o,r.children.indexOf(e[0])),e.sort(Ag);const a=new mt(i.worldTransform);return a.divideParent(r.scrollWorldTransform),o.setTransform(a),o.editable=!0,o.hitChildren=!1,n.lockLayout(),e.forEach(t=>t.dropTo(o)),n.unlockLayout(),o},ungroup(t){const{app:e}=t[0],i=[];return e.lockLayout(),t.forEach(t=>{if(t.isBranch){const{parent:e,children:s}=t;for(;s.length;)i.push(s[0]),s[0].dropTo(e,e.children.indexOf(t));t.isBranchLeaf?i.push(t):t.remove()}else i.push(t)}),e.unlockLayout(),i},toTop(t){t.sort(Ag),t.forEach(t=>{t.parent&&t.parent.add(t)})},toBottom(t){t.sort(Wg),t.forEach(t=>{t.parent&&t.parent.addAt(t,0)})}},zg=Qt.get("EditToolCreator");function Hg(){return t=>{Ng.register(t)}}const Ug=Hg,Ng={list:{},register(t){const{tag:e}=t.prototype;Yg[e]&&zg.repeat(e),Yg[e]=t},get:(t,e)=>new Yg[t](e)},{list:Yg}=Ng;class Xg extends Gp{constructor(t,e){super(t,e)}}Xg.BEFORE_OPEN="innerEditor.before_open",Xg.OPEN="innerEditor.open",Xg.BEFORE_CLOSE="innerEditor.before_close",Xg.CLOSE="innerEditor.close";class Vg extends Gp{constructor(t,e){super(t,e)}}Vg.BEFORE_GROUP="editor.before_group",Vg.GROUP="editor.group",Vg.BEFORE_UNGROUP="editor.before_ungroup",Vg.UNGROUP="editor.ungroup",Vg.BEFORE_OPEN="editor.before_open_group",Vg.OPEN="editor.open_group",Vg.BEFORE_CLOSE="editor.before_close_group",Vg.CLOSE="editor.close_group";const{updateMatrix:jg}=ro,Gg={x:1,y:1,scaleX:1,scaleY:1,rotation:1,skewX:1,skewY:1},Kg="top-left";class Zg extends t.Rect{get __tag(){return"SimulateElement"}constructor(t){super(),this.checkChange=!0,this.canChange=!0,this.visible=this.hittable=!1,this.on(Ao.CHANGE,e=>{if(this.checkChange&&Gg[e.attrName]){const{attrName:i,newValue:s,oldValue:n}=e,r="s"===i[0]?(s||1)/(n||1):(s||0)-(n||0);this.canChange=!1;const o=this.__;o[i]=n,jg(this.parent),jg(this);const a=new mt(this.__world);switch(o[i]=s,this.__layout.rotationChange(),jg(this),this.changedTransform=new mt(this.__world).divide(a),i){case"x":t.move(r,0);break;case"y":t.move(0,r);break;case"rotation":t.rotateOf(Kg,r);break;case"scaleX":t.scaleOf(Kg,r,1);break;case"scaleY":t.scaleOf(Kg,1,r);break;case"skewX":t.skewOf(Kg,r,0);break;case"skewY":t.skewOf(Kg,0,r)}this.canChange=!0}})}safeChange(t){this.canChange&&(this.checkChange=!1,t(),this.checkChange=!0)}}class qg extends Gp{constructor(t,e){super(t,e)}}qg.BEFORE_MOVE="editor.before_move",qg.MOVE="editor.move";class Jg extends Gp{constructor(t,e){super(t,e)}}Jg.BEFORE_SCALE="editor.before_scale",Jg.SCALE="editor.scale";class $g extends Gp{constructor(t,e){super(t,e)}}$g.BEFORE_ROTATE="editor.before_rotate",$g.ROTATE="editor.rotate";class Qg extends Gp{constructor(t,e){super(t,e)}}Qg.BEFORE_SKEW="editor.before_skew",Qg.SKEW="editor.skew";class t_{onMove(e){const{target:i,mergeConfig:s,dragStartData:n}=this.editBox;let r,{dragLimitAnimate:a}=s;const l=e.type===t.MoveEvent.END||e.type===t.DragEvent.END,d=o(i.draggable),c=!a||l||d,u={x:e.totalX,y:e.totalY};e instanceof t.MoveEvent&&dt.move(u,i.getWorldPointByLocal(n.totalOffset,null,!0)),e.shiftKey&&(Math.abs(u.x)>Math.abs(u.y)?u.y=0:u.x=0),r=t.DragEvent.getValidMove(i,n.point,u,c),(r.x||r.y)&&(a&&!d&&l?ro.animateMove(this,r,h(a)?a:.3):this.move(r))}onScale(e){const{target:i,mergeConfig:s,single:n,dragStartData:r}=this.editBox;let o,{around:a,lockRatio:h,flipable:l,editSize:d}=s;e instanceof t.ZoomEvent?(a=i.getBoxPoint(e),o=e.totalScale):o=e.getInnerTotal(i);const{direction:c}=e.current;(e.shiftKey||i.lockRatio)&&(h=!0);const u=wg.getScaleData(i,r.bounds,c,o,h,wg.getAround(a,e.altKey),l,!n||"scale"===d),p=i.x,g=i.y;e instanceof t.DragEvent&&this.editTool&&this.editTool.onScaleWithDrag?(u.drag=e,this.scaleWithDrag(u)):this.scaleOf(u.origin,u.scaleX,u.scaleY),dt.move(r.totalOffset,i.x-p,i.y-g)}onRotate(e){const{target:i,mergeConfig:s,dragStartData:n}=this.editBox,{around:r,rotateAround:o,rotateGap:a,diagonalRotateKey:h}=s,{direction:l}=e.current;let d,c;if(e instanceof t.RotateEvent)c=e.rotation,d=o?kt.getPoint(o,i.boxBounds):i.getBoxPoint(e);else{const t=h?e.isHoldKeys(h):e.shiftKey,s=wg.getRotateData(i,l,e,n,t?null:o||i.around||i.origin||r||"center");c=n.rotation+s.rotation-i.rotation,d=s.origin}if(c=F.float(F.getGapRotation(c,a,i.rotation),2),!c)return;const u=i.x,p=i.y;this.rotateOf(d,c),dt.move(n.totalOffset,i.x-u,i.y-p)}onSkew(t){const{target:e,mergeConfig:i}=this.editBox,{around:s}=i,{origin:n,skewX:r,skewY:o}=wg.getSkewData(e.boxBounds,t.current.direction,t.getInnerMove(e),wg.getAround(s,t.altKey));(r||o)&&this.skewOf(n,r,o)}move(t,e=0){if(!this.checkTransform("moveable"))return;c(t)&&(e=t.y,t=t.x);const{target:i,mergeConfig:s,single:n,editor:r}=this.editBox,{beforeMove:o}=s;if(o){const s=o({target:i,x:t,y:e});if(c(s))t=s.x,e=s.y;else if(!1===s)return}const a=i.getWorldPointByLocal({x:t,y:e},null,!0);n||i.safeChange(()=>i.move(t,e));const h={target:i,editor:r,moveX:a.x,moveY:a.y};this.emitEvent(new qg(qg.BEFORE_MOVE,h));const l=new qg(qg.MOVE,h);this.doMove(l),this.emitEvent(l)}scaleWithDrag(t){if(!this.checkTransform("resizeable"))return;const{target:e,mergeConfig:i,editor:s}=this.editBox,{beforeScale:n}=i;if(n){const{origin:i,scaleX:s,scaleY:r,drag:o}=t;if(!1===n({target:e,drag:o,origin:i,scaleX:s,scaleY:r}))return}t=Object.assign(Object.assign({},t),{target:e,editor:s,worldOrigin:e.getWorldPoint(t.origin)}),this.emitEvent(new Jg(Jg.BEFORE_SCALE,t));const r=new Jg(Jg.SCALE,t);this.editTool.onScaleWithDrag(r),this.emitEvent(r)}scaleOf(t,e,i=e,s){if(!this.checkTransform("resizeable"))return;const{target:n,mergeConfig:r,single:o,editor:a}=this.editBox,{beforeScale:h}=r;if(h){const s=h({target:n,origin:t,scaleX:e,scaleY:i});if(c(s))e=s.scaleX,i=s.scaleY;else if(!1===s)return}const l=this.getWorldOrigin(t),d=!o&&this.getChangedTransform(()=>n.safeChange(()=>n.scaleOf(t,e,i))),u={target:n,editor:a,worldOrigin:l,scaleX:e,scaleY:i,transform:d};this.emitEvent(new Jg(Jg.BEFORE_SCALE,u));const p=new Jg(Jg.SCALE,u);this.doScale(p),this.emitEvent(p)}flip(t){if(!this.checkTransform("resizeable"))return;const{target:e,single:i,editor:s}=this.editBox,n=this.getWorldOrigin("center"),r=i?new mt(ro.getFlipTransform(e,t)):this.getChangedTransform(()=>e.safeChange(()=>e.flip(t))),o={target:e,editor:s,worldOrigin:n,scaleX:"x"===t?-1:1,scaleY:"y"===t?-1:1,transform:r};this.emitEvent(new Jg(Jg.BEFORE_SCALE,o));const a=new Jg(Jg.SCALE,o);this.doScale(a),this.emitEvent(a)}rotateOf(t,e){if(!this.checkTransform("rotateable"))return;const{target:i,mergeConfig:s,single:n,editor:r}=this.editBox,{beforeRotate:o}=s;if(o){const s=o({target:i,origin:t,rotation:e});if(h(s))e=s;else if(!1===s)return}const a=this.getWorldOrigin(t),l=!n&&this.getChangedTransform(()=>i.safeChange(()=>i.rotateOf(t,e))),d={target:i,editor:r,worldOrigin:a,rotation:e,transform:l};this.emitEvent(new $g($g.BEFORE_ROTATE,d));const c=new $g($g.ROTATE,d);this.doRotate(c),this.emitEvent(c)}skewOf(t,e,i=0,s){if(!this.checkTransform("skewable"))return;const{target:n,mergeConfig:r,single:o,editor:a}=this.editBox,{beforeSkew:h}=r;if(h){const s=h({target:n,origin:t,skewX:e,skewY:i});if(c(s))e=s.skewX,i=s.skewY;else if(!1===s)return}const l=this.getWorldOrigin(t),d=!o&&this.getChangedTransform(()=>n.safeChange(()=>n.skewOf(t,e,i))),u={target:n,editor:a,worldOrigin:l,skewX:e,skewY:i,transform:d};this.emitEvent(new Qg(Qg.BEFORE_SKEW,u));const p=new Qg(Qg.SKEW,u);this.doSkew(p),this.emitEvent(p)}doMove(t){this.editTool.onMove(t)}doScale(t){this.editTool.onScale(t)}doRotate(t){this.editTool.onRotate(t)}doSkew(t){this.editTool.onSkew(t)}checkTransform(t){const{target:e,mergeConfig:i}=this.editBox;return e&&!e.locked&&i[t]}getWorldOrigin(t){const{target:e}=this.editBox;return e.getWorldPoint(ro.getInnerOrigin(e,t))}getChangedTransform(t){const{target:e,single:i}=this.editBox;if(!i&&!e.canChange)return e.changedTransform;const s=new mt(e.worldTransform);return t(),new mt(e.worldTransform).divide(s)}emitEvent(t,e){this.editBox.editor.emitEvent(t,e)}}t.Editor=class extends t.Group{get list(){return this.leafList.list}get dragHoverExclude(){return[this.editBox.rect]}get editing(){return!!this.list.length}get groupOpening(){return!!this.openedGroupList.length}get multiple(){return this.list.length>1}get single(){return 1===this.list.length}get dragPoint(){return this.editBox.dragPoint}get dragging(){return this.editBox.dragging}get gesturing(){return this.editBox.gesturing}get moving(){return this.editBox.moving}get resizing(){return this.editBox.resizing}get rotating(){return this.editBox.rotating}get skewing(){return this.editBox.skewing}get element(){return this.multiple?this.simulateTarget:this.list[0]}get buttons(){return this.editBox.buttons}get targetLeafer(){const t=this.list[0];return t&&t.leafer}constructor(t,e){super(e),this.leafList=new gh,this.openedGroupList=new gh,this.simulateTarget=new Zg(this),this.editBox=new Lg(this),this.editToolList={},this.selector=new hg(this),this.editMask=new Cg(this),this.targetEventIds=[];let i=g.clone(Mg);t&&(i=g.default(t,i)),this.mergedConfig=this.config=i,this.addMany(this.editMask,this.selector,this.editBox),oe.has("resize")||(this.config.editSize="scale")}select(t){this.target=t}cancel(){this.target=null}hasItem(t){return this.leafList.has(t)}getItem(t){return this.list[t||0]}addItem(t){this.hasItem(t)||t.locked||(this.leafList.add(t),this.target=this.leafList.list)}removeItem(t){this.hasItem(t)&&(this.leafList.remove(t),this.target=this.leafList.list)}shiftItem(t){this.hasItem(t)?this.removeItem(t):this.addItem(t)}setDimOthers(t,e="dim",i){if(!i){const{dimTarget:t,targetLeafer:e}=this;i=t?d(t)?t:[t]:[e]}i[0]&&i[0][e]!==(t||!1)&&i.forEach(i=>g.stintSet(i,e,t))}setBright(t){this.setDimOthers(t,"bright",this.list)}update(){if(this.editing){if(!this.element.parent)return this.cancel();this.innerEditing&&this.innerEditor.update(),this.editTool.update(),this.selector.update()}}updateEditBox(){this.multiple&&Ig(this),this.update()}getEditTool(t){return this.editToolList[t]=this.editToolList[t]||Ng.get(t,this)}updateEditTool(){if(this.unloadEditTool(),this.editing){const t=this.element;let e=t.editOuter||"EditTool";const{beforeEditOuter:i}=this.mergeConfig;if(i){const s=i({target:t,name:e});if(o(s))e=s;else if(!1===s)return}if(Ng.list[e]){const t=this.editTool=this.getEditTool(e);this.editBox.load(),t.load(),this.update()}}}unloadEditTool(){let t=this.editTool;t&&(this.editBox.unload(),t.unload(),this.editTool=null)}getEditSize(t){return this.mergeConfig.editSize}onMove(t){}onScale(t){}onRotate(t){}onSkew(t){}move(t,e=0){}scaleWithDrag(t){}scaleOf(t,e,i=e,s){}flip(t){}rotateOf(t,e){}skewOf(t,e,i=0,s){}checkTransform(t){}getWorldOrigin(t){}getChangedTransform(t){}group(t){return this.multiple&&(this.emitGroupEvent(Vg.BEFORE_GROUP),this.target=Fg.group(this.list,this.element,t),this.emitGroupEvent(Vg.GROUP,this.target)),this.target}ungroup(){const{list:t}=this;return t.length&&(t.forEach(t=>t.isBranch&&this.emitGroupEvent(Vg.BEFORE_UNGROUP,t)),this.target=Fg.ungroup(t),t.forEach(t=>t.isBranch&&this.emitGroupEvent(Vg.UNGROUP,t))),this.list}openGroup(t){this.emitGroupEvent(Vg.BEFORE_OPEN,t),this.openedGroupList.add(t),t.hitChildren=!0,this.emitGroupEvent(Vg.OPEN,t)}closeGroup(t){this.emitGroupEvent(Vg.BEFORE_CLOSE,t),this.openedGroupList.remove(t),t.hitChildren=!1,this.emitGroupEvent(Vg.CLOSE,t)}checkOpenedGroups(){const t=this.openedGroupList;if(t.length){let{list:e}=t;this.editing&&(e=[],t.forEach(t=>this.list.every(e=>!ro.hasParent(e,t))&&e.push(t))),e.forEach(t=>this.closeGroup(t))}this.editing&&!this.selector.dragging&&this.checkDeepSelect()}checkDeepSelect(){let t,{list:e}=this;for(let i=0;i<e.length;i++)for(t=e[i].parent;t&&!t.hitChildren;)this.openGroup(t),t=t.parent}emitGroupEvent(t,e){const i=new Vg(t,{editTarget:e});this.emitEvent(i),e&&e.emitEvent(i)}getInnerEditor(t){return this.editToolList[t]=this.editToolList[t]||Ng.get(t,this)}openInnerEditor(t,e,i){let s;if(o(e)?s=e:i||(i=e),t&&i&&(this.target=t),this.single){t||(t=this.element),s||(s=t.editInner);const{beforeEditInner:e}=this.mergeConfig;if(e){const i=e({target:t,name:s});if(o(i))s=i;else if(!1===i)return}Ng.list[s]&&(this.editTool.unload(),this.innerEditing=!0,this.innerEditor=this.getInnerEditor(s),this.innerEditor.editTarget=t,this.emitInnerEvent(Xg.BEFORE_OPEN),this.innerEditor.load(),this.emitInnerEvent(Xg.OPEN))}}closeInnerEditor(t){this.innerEditing&&(this.innerEditing=!1,this.emitInnerEvent(Xg.BEFORE_CLOSE),this.innerEditor.unload(),this.emitInnerEvent(Xg.CLOSE),t||this.updateEditTool(),this.innerEditor=null)}emitInnerEvent(t){const{innerEditor:e}=this,{editTarget:i}=e,s=new Xg(t,{editTarget:i,innerEditor:e});this.emitEvent(s),i.emitEvent(s)}lock(){this.list.forEach(t=>t.locked=!0),this.update()}unlock(){this.list.forEach(t=>t.locked=!1),this.update()}toTop(){this.list.length&&(Fg.toTop(this.list),this.leafList.update())}toBottom(){this.list.length&&(Fg.toBottom(this.list),this.leafList.update())}onAppRenderStart(t){(this.targetChanged=t.children.some(t=>t!==this.leafer&&t.renderer.changed))&&this.editBox.forceRender()}onRenderStart(){this.targetChanged&&this.update()}onChildScroll(){this.multiple&&this.updateEditBox()}listenTargetEvents(){if(!this.targetEventIds.length){const{app:t,leafer:e,targetLeafer:i,editMask:s}=this;this.targetEventIds=[e.on_(Ko.START,this.onRenderStart,this),i&&i.on_(Ao.SCROLL,this.onChildScroll,this),t.on_(Ko.CHILD_START,this.onAppRenderStart,this),t.on_(Zo.UPDATE_MODE,t=>{t.mode&&"normal"!==t.mode&&this.cancel()})],s.visible&&s.forceRender()}}removeTargetEvents(){const{targetEventIds:t,editMask:e}=this;t.length&&(this.off_(t),e.visible&&e.forceRender())}destroy(){this.destroyed||(this.target=this.hoverTarget=null,Object.values(this.editToolList).forEach(t=>t.destroy()),this.simulateTarget.destroy(),this.editToolList={},this.simulateTarget=this.editTool=this.innerEditor=null,super.destroy())}},_e([(t,e)=>{rr(t,e,{get(){const{config:t,element:e,dragPoint:i,editBox:s,app:o}=this,a=Object.assign({},t);if(e&&e.editConfig){let{editConfig:t}=e;(t.hover||t.hoverStyle)&&(t=Object.assign({},t),delete t.hover,delete t.hoverStyle),Object.assign(a,t)}return s.config&&Object.assign(a,s.config),i&&(i.editConfig&&Object.assign(a,i.editConfig),"font-size"===a.editSize&&(a.lockRatio=!0),"resize-rotate"===i.pointType&&(a.around||(a.around="center"),r(a.lockRatio)&&(a.lockRatio=!0))),n(a.dragLimitAnimate)&&(a.dragLimitAnimate=o&&o.config.pointer.dragLimitAnimate),this.mergedConfig=a}})}],t.Editor.prototype,"mergeConfig",void 0),_e([Kp(function(t,e){const{target:i}=t;i?(t.leafList=i instanceof gh?i:new gh(i),t.multiple&&Ig(t)):(t.simulateTarget.remove(),t.leafList.reset()),t.closeInnerEditor(!0),t.unloadEditTool();const s={editor:t,value:i,oldValue:e};t.emitEvent(new Gp(Gp.SELECT,s)),t.checkOpenedGroups(),t.editing?t.waitLeafer(()=>{t.updateEditTool(),t.listenTargetEvents()}):(t.updateEditTool(),t.removeTargetEvents()),t.emitEvent(new Gp(Gp.AFTER_SELECT,s))})],t.Editor.prototype,"target",void 0),_e([Kp(function(t,e){t.emitEvent(new Gp(Gp.HOVER,{editor:t,value:t.hoverTarget,oldValue:e}))})],t.Editor.prototype,"hoverTarget",void 0),t.Editor=_e([Vr(t_,["editBox","editTool","emitEvent"])],t.Editor);class e_{static registerInnerEditor(){Ng.register(this)}get tag(){return"InnerEditor"}get mode(){return"focus"}get editBox(){return this.editor.editBox}constructor(t){this.eventIds=[],this.editor=t,this.create()}onCreate(){}create(){this.view=new t.Group,this.onCreate()}onLoad(){}load(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!1),this.onLoad())}onUpdate(){}update(){this.onUpdate()}onUnload(){}unload(){const{editor:t}=this;t&&(t.app&&"focus"===this.mode&&(t.selector.hittable=t.app.tree.hitChildren=!0),this.onUnload())}onDestroy(){}destroy(){this.onDestroy(),this.editor&&(this.view&&this.view.destroy(),this.eventIds&&this.editor.off_(this.eventIds),this.editor=this.view=this.eventIds=null)}}t.EditTool=class extends e_{static registerEditTool(){Ng.register(this)}get tag(){return"EditTool"}onMove(t){const{moveX:e,moveY:i,editor:s}=t,{app:n,list:r}=s;n.lockLayout(),r.forEach(t=>{t.moveWorld(e,i)}),n.unlockLayout()}onScale(t){const{scaleX:e,scaleY:i,transform:s,worldOrigin:n,editor:r}=t,{app:o,list:a}=r;o.lockLayout(),a.forEach(t=>{const o="scale"!==r.getEditSize(t);s?t.transformWorld(s,o):t.scaleOfWorld(n,e,i,o)}),o.unlockLayout()}onRotate(t){const{rotation:e,transform:i,worldOrigin:s,editor:n}=t,{app:r,list:o}=n;r.lockLayout(),o.forEach(t=>{const r="scale"!==n.getEditSize(t);i?t.transformWorld(i,r):t.rotateOfWorld(s,e)}),r.unlockLayout()}onSkew(t){const{skewX:e,skewY:i,transform:s,worldOrigin:n,editor:r}=t,{app:o,list:a}=r;o.lockLayout(),a.forEach(t=>{const o="scale"!==r.getEditSize(t);s?t.transformWorld(s,o):t.skewOfWorld(n,e,i,o)}),o.unlockLayout()}load(){this.editBox.view.visible=!0,this.onLoad()}update(){this.editBox.update(),this.onUpdate()}unload(){this.editBox.view.visible=!1,this.onUnload()}},t.EditTool=_e([Hg()],t.EditTool);const{left:i_,right:s_}=t.Direction9,{move:n_,copy:r_,toNumberPoints:o_}=dt;t.LineEditTool=class extends t.EditTool{constructor(){super(...arguments),this.scaleOfEvent=!0}get tag(){return"LineEditTool"}onScaleWithDrag(t){const{drag:e,direction:i,lockRatio:s,around:n}=t,r=t.target,o=i===i_;if(r.pathInputed){const{path:t}=r.__,{from:i,to:a}=this.getFromToByPath(t);this.dragPoint(i,a,o,n,this.getInnerMove(r,e,s)),t[1]=i.x,t[2]=i.y,t[4]=a.x,t[5]=a.y,r.path=t}else if(r.points){const{points:t}=r,{from:i,to:a}=this.getFromToByPoints(t);this.dragPoint(i,a,o,n,this.getInnerMove(r,e,s)),t[0]=i.x,t[1]=i.y,t[2]=a.x,t[3]=a.y,r.points=t}else{const t={x:0,y:0},{toPoint:i}=r;r.rotation=0,this.dragPoint(t,i,o,n,this.getInnerMove(r,e,s)),r.getLocalPointByInner(t,null,null,!0),r.getLocalPointByInner(i,null,null,!0),r.x=t.x,r.y=t.y,r.getInnerPointByLocal(i,null,null,!0),r.toPoint=i}}getInnerMove(t,e,i){const s=e.getInnerMove(t);return i&&(Math.abs(s.x)>Math.abs(s.y)?s.y=0:s.x=0),s}getFromToByPath(t){return{from:{x:t[1],y:t[2]},to:{x:t[4],y:t[5]}}}getFromToByPoints(t){const e=o_(t);return{from:{x:e[0],y:e[1]},to:{x:e[2],y:e[3]}}}dragPoint(t,e,i,s,n){const{x:r,y:o}=n;i?(n_(t,r,o),s&&n_(e,-r,-o)):(s&&n_(t,-r,-o),n_(e,r,o))}onSkew(t){}onUpdate(){const{editBox:t}=this,{rotatePoints:e,resizeLines:i,resizePoints:s,rect:n}=t,r=this.editor.element;let o,a;if(r.pathInputed?o=this.getFromToByPath(r.__.path):r.points&&(o=this.getFromToByPoints(r.__.points)),o){const{from:i,to:a}=o;r.innerToWorld(i,i,!1,t),r.innerToWorld(a,a,!1,t),n.pen.clearPath().moveTo(i.x,i.y).lineTo(a.x,a.y),r_(s[7],i),r_(e[7],i),r_(s[3],a),r_(e[3],a)}for(let t=0;t<8;t++)t<4&&(i[t].visible=!1),a=t===i_||t===s_,s[t].visible=a,e[t].visible=!o&&a}},t.LineEditTool=_e([Hg()],t.LineEditTool);const{M:a_,L:h_,C:l_,Q:d_,Z:c_,N:u_,D:p_,X:g_,G:__,F:f_,O:m_,P:y_,U:v_}=Me,x_={scale(t,e,i){if(!t)return;let s,n=0,r=t.length;for(;n<r;)switch(s=t[n],s){case a_:case h_:w_(t,e,i,n,1),n+=3;break;case l_:w_(t,e,i,n,3),n+=7;break;case d_:w_(t,e,i,n,2),n+=5;break;case c_:n+=1;break;case u_:w_(t,e,i,n,2),n+=5;break;case p_:w_(t,e,i,n,2),n+=9;break;case g_:w_(t,e,i,n,2),n+=6;break;case __:w_(t,e,i,n,2),n+=9;break;case f_:w_(t,e,i,n,2),n+=5;break;case m_:t[n]=__,t.splice(n+4,0,t[n+3],0),w_(t,e,i,n,2),n+=9,r+=2;break;case y_:t[n]=f_,t.splice(n+4,0,t[n+3]),w_(t,e,i,n,2),n+=5,r+=1;break;case v_:w_(t,e,i,n,2),n+=6}},scalePoints(t,e,i,s,n){for(let r=n?s+1:0,o=n?r+2*n:t.length;r<o;r+=2)t[r]*=e,t[r+1]*=i}},{scalePoints:w_}=x_,E_=Q.get(),{topLeft:b_,top:k_,topRight:S_,right:B_,bottom:T_,left:P_}=t.Direction9;function L_(t,e,i){t.pathInputed?R_(t,e,i):(1!==e&&(t.width*=e),1!==i&&(t.height*=i))}function R_(t,e,i){x_.scale(t.__.path,e,i),t.path=t.__.path}function C_(t,e,i){const{points:s}=t;c(s[0])?s.forEach(t=>{t.x*=e,t.y*=i}):x_.scalePoints(s,e,i),t.points=s}function O_(t,e,i){const{children:s}=t;for(let t=0;t<s.length;t++)E_.a=e,E_.d=i,s[t].transform(E_,!0)}const M_=t.Leaf.prototype;function D_(e,i,s){I_(e.parentApp?e.parentApp:e,i),e.isApp||s||e.__eventIds.push(e.on_(t.MoveEvent.BEFORE_MOVE,t=>{e.zoomLayer.move(e.getValidMove(t.moveX,t.moveY,!1))}),e.on_(t.MoveEvent.END,t=>{ro.animateMove(e.zoomLayer,e.getValidMove(t.moveX,t.moveY))}),e.on_(t.ZoomEvent.BEFORE_ZOOM,t=>{const{zoomLayer:i}=e,s=e.getValidScale(t.scale);1!==s&&i.scaleOfWorld(t,s)}))}function I_(t,e){const i={wheel:{preventDefault:!0},touch:{preventDefault:!0},pointer:{preventDefaultMenu:!0}};e&&g.assign(i,e),g.assign(t.config,i,t.userConfig)}M_.scaleResize=function(t,e=t,i){const s=this;i||s.editConfig&&"scale"===s.editConfig.editSize?(s.scaleX*=t,s.scaleY*=e):(t<0&&(s.scaleX*=-1,t=-t),e<0&&(s.scaleY*=-1,e=-e),this.__scaleResize(t,e))},M_.__scaleResize=function(t,e){L_(this,t,e)},M_.resizeWidth=function(t){const e=t/this.getBounds("box","local").width||1;this.scaleOf(this.__layout.boxBounds,e,this.__.lockRatio?e:1,!0)},M_.resizeHeight=function(t){const e=t/this.getBounds("box","local").height||1;this.scaleOf(this.__layout.boxBounds,this.__.lockRatio?e:1,e,!0)},t.Text.prototype.__scaleResize=function(t,e){const{app:i,editConfig:s}=this,r=i&&i.editor,o=r&&r.dragPoint;if(this.__.resizeFontSize||s&&"font-size"===s.editSize||o&&"font-size"===r.mergedConfig.editSize)!function(t,e,i,s){let r=e;if(!n(s)){const n=t.__layout;let{width:o,height:a}=n.boxBounds;switch(o*=i-e,a*=e-i,s){case k_:case T_:r=i,n.affectScaleOrRotation?t.moveInner(-o/2,0):t.x-=o/2;break;case P_:case B_:n.affectScaleOrRotation?t.moveInner(0,-a/2):t.y-=a/2;break;case b_:case S_:n.affectScaleOrRotation?t.moveInner(0,-a):t.y-=a}}t.fontSize*=r;const o=t.__,{padding:a}=o;a&&(t.padding=d(a)?a.map(t=>t*r):a*r),o.__autoWidth||(t.width*=r),o.__autoHeight||(t.height*=r)}(this,t,e,o&&o.direction);else{const{__autoWidth:i,__autoHeight:s,textAlign:n,verticalAlign:r}=this.__,{boxBounds:o}=this.__layout;i&&"left"!==n&&1!==t&&(this.x+=o.x),s&&"top"!==r&&1!==e&&(this.y+=o.y),L_(this,t,e)}},t.Path.prototype.__scaleResize=function(t,e){R_(this,t,e)},t.Line.prototype.__scaleResize=function(t,e){this.pathInputed?R_(this,t,e):this.points?C_(this,t,e):this.width*=t},t.Polygon.prototype.__scaleResize=function(t,e){this.pathInputed?R_(this,t,e):this.points?C_(this,t,e):L_(this,t,e)},t.Group.prototype.__scaleResize=function(t,e){O_(this,t,e)},t.Box.prototype.__scaleResize=function(t,e){const{resizeChildren:i,__autoSize:s}=this.__;s&&i||L_(this,t,e),i&&O_(this,t,e)},oe.add("resize"),oe.add("editor","resize"),ae.editor=function(e,i){const s=new t.Editor(e);return i&&i.sky.add(i.editor=s),s},t.Box.addAttr("textBox",!1,cr),t.UI.addAttr("editConfig",void 0,cr),t.UI.addAttr("editOuter",t=>(t.updateLayout(),t.__.__isLinePath?"LineEditTool":"EditTool"),cr),t.UI.addAttr("editInner","PathEditor",cr),t.Group.addAttr("editInner","",cr),t.Text.addAttr("editInner","TextEditor",cr),t.UI.setEditConfig=function(t){this.changeAttr("editConfig",t)},t.UI.setEditOuter=function(t){this.changeAttr("editOuter",t)},t.UI.setEditInner=function(t){this.changeAttr("editInner",t)};const A_=Qt.get("LeaferTypeCreator"),W_={list:{},register(t,e){F_[t]&&A_.repeat(t),F_[t]=e},run(t,e){const i=F_[t];i&&i(e)}},{list:F_,register:z_}=W_;z_("viewport",D_),z_("custom",function(t){D_(t,null,!0)}),z_("design",function(t){D_(t,{zoom:{min:.01,max:256},move:{holdSpaceKey:!0,holdMiddleKey:!0}})}),z_("document",function(t){D_(t,{zoom:{min:1},move:{scroll:"limit"}})});const H_={state:{type:"none",typeCount:0,startTime:0,totalData:null,center:{}},getData(t){const e=t[0],i=t[1],s=dt.getCenter(e.from,i.from),n=dt.getCenter(e.to,i.to),r={x:n.x-s.x,y:n.y-s.y},o=dt.getDistance(e.from,i.from);return{move:r,scale:dt.getDistance(e.to,i.to)/o,rotation:dt.getRotation(e.from,i.from,e.to,i.to),center:n}},getType(t,e){const i=Math.hypot(t.move.x,t.move.y)/(e.move||5),s=Math.abs(t.scale-1)/(e.scale||.03),n=Math.abs(t.rotation)/(e.rotation||2);return i<1&&s<1&&n<1?"none":i>=s&&i>=n?"move":s>=n?"zoom":"rotate"},detect(t,e){const{state:i}=U_,s=U_.getType(t,e);if(i.totalData||(i.startTime=Date.now(),i.center=t.center),U_.add(t,i.totalData),i.totalData=t,s===i.type){if(i.typeCount++,i.typeCount>=(e.count||3)&&"none"!==s)return s}else i.type=s,i.typeCount=1;return Date.now()-i.startTime>=(e.time||160)?U_.getType(i.totalData,e):"none"},add(t,e){e&&(dt.move(t.move,e.move),t.scale*=e.scale,t.rotation+=e.rotation,t.center=e.center)},reset(){const{state:t}=U_;t.type="none",t.typeCount=0,t.startTime=0,t.totalData=null}},U_=H_,{abs:N_,max:Y_}=Math,{sign:X_,within:V_}=F,j_={getMove(t,e){let{moveSpeed:i}=e,{deltaX:s,deltaY:n}=t;t.shiftKey&&!s&&(s=n,n=0);const r=N_(s),o=N_(n);return r>50&&(s=Y_(50,r/3)*X_(s)),o>50&&(n=Y_(50,o/3)*X_(n)),{x:-s*i*2,y:-n*i*2}},getScale(t,e){let i,s=1,{zoomMode:n,zoomSpeed:r}=e;const o=t.deltaY||t.deltaX;if(n?(i="mouse"===n||!t.deltaX&&(v.intWheelDeltaY?Math.abs(o)>17:Math.ceil(o)!==o),(t.shiftKey||t.metaKey||t.ctrlKey)&&(i=!0)):i=!t.shiftKey&&(t.metaKey||t.ctrlKey),i){r=V_(r,0,1);const i=t.deltaY?e.delta.y:e.delta.x,n=V_(1-N_(o)/(4*i)*r,.5,2);s=o>0?n:1/n}return s}};let G_,K_,Z_,q_;class J_{get transforming(){return this.moving||this.zooming||this.rotating}get moving(){return!!this.moveData}get zooming(){return!!this.zoomData}get rotating(){return!!this.rotateData}constructor(t){this.interaction=t}move(e){const{interaction:i}=this;e.moveType||(e.moveType="move"),this.moveData||(this.setPath(e),G_=0,K_=0,this.moveData=Object.assign(Object.assign({},e),{moveX:0,moveY:0,totalX:G_,totalY:K_}),i.emit(t.MoveEvent.START,this.moveData)),e.path=this.moveData.path,e.totalX=G_+=e.moveX,e.totalY=K_+=e.moveY,i.emit(t.MoveEvent.BEFORE_MOVE,e),i.emit(t.MoveEvent.MOVE,e),this.transformEndWait()}zoom(e){const{interaction:i}=this;this.zoomData||(this.setPath(e),Z_=1,this.zoomData=Object.assign(Object.assign({},e),{scale:1,totalScale:Z_}),i.emit(t.ZoomEvent.START,this.zoomData)),e.path=this.zoomData.path,e.totalScale=Z_*=e.scale,i.emit(t.ZoomEvent.BEFORE_ZOOM,e),i.emit(t.ZoomEvent.ZOOM,e),this.transformEndWait()}rotate(e){const{interaction:i}=this;this.rotateData||(this.setPath(e),q_=0,this.rotateData=Object.assign(Object.assign({},e),{rotation:0,totalRotation:q_}),i.emit(t.RotateEvent.START,this.rotateData)),e.path=this.rotateData.path,e.totalRotation=q_+=e.rotation,i.emit(t.RotateEvent.BEFORE_ROTATE,e),i.emit(t.RotateEvent.ROTATE,e),this.transformEndWait()}setPath(t){const{interaction:e}=this,{path:i}=e.selector.getByPoint(t,e.hitRadius);t.path=i,e.cancelHover()}transformEndWait(){clearTimeout(this.transformTimer),this.transformTimer=setTimeout(()=>{this.transformEnd()},this.interaction.p.transformTime)}transformEnd(){const{interaction:e,moveData:i,zoomData:s,rotateData:n}=this;i&&e.emit(t.MoveEvent.END,Object.assign(Object.assign({},i),{totalX:G_,totalY:K_})),s&&e.emit(t.ZoomEvent.END,Object.assign(Object.assign({},s),{totalScale:Z_})),n&&e.emit(t.RotateEvent.END,Object.assign(Object.assign({},n),{totalRotation:q_})),this.reset()}reset(){this.zoomData=this.moveData=this.rotateData=null}destroy(){this.reset()}}const $_=t.Leafer.prototype,Q_=new Kt,tf=new _t;function ef(t,e){return Object.assign(Object.assign({},e),{moveX:t.x,moveY:t.y})}function sf(t,e){return Object.assign(Object.assign({},e),{scale:t})}$_.initType=function(t){W_.run(t,this)},$_.getValidMove=function(t,e,i=!0){const{scroll:s,disabled:n}=this.app.config.move;if(tf.set(t,e),s){const t=!0===s?"":s;t.includes("x")?tf.y=0:t.includes("y")?tf.x=0:Math.abs(tf.x)>Math.abs(tf.y)?tf.y=0:tf.x=0,i&&t.includes("limit")&&(Q_.set(this.__world).addPoint(this.zoomLayer),Bd.getValidMove(Q_,this.canvas.bounds,"inner",tf,!0),t.includes("x")?tf.y=0:t.includes("y")&&(tf.x=0))}return{x:n?0:tf.x,y:n?0:tf.y}},$_.getValidScale=function(t){const{scaleX:e}=this.zoomLayer.__,{min:i,max:s,disabled:n}=this.app.config.zoom,r=Math.abs(e*t);return i&&r<i?t=i/e:s&&r>s&&(t=s/e),n?1:t};const nf=Kd.prototype;nf.createTransformer=function(){this.transformer=new J_(this)},nf.move=function(t){this.transformer.move(t)},nf.zoom=function(t){this.transformer.zoom(t)},nf.rotate=function(t){this.transformer.rotate(t)},nf.transformEnd=function(){this.transformer.transformEnd()},nf.wheel=function(t){const{wheel:e,pointer:i}=this.config,{posDeltaSpeed:s,negDeltaSpeed:n}=e;if(e.disabled)return;t.deltaX>0?s&&(t.deltaX*=s):n&&(t.deltaX*=n),t.deltaY>0?s&&(t.deltaY*=s):n&&(t.deltaY*=n);const r=e.getScale?e.getScale(t,e):j_.getScale(t,e);if(1!==r)this.zoom(sf(r,t));else{const s=e.getMove?e.getMove(t,e):j_.getMove(t,e);i.snap&&dt.round(s),this.move(ef(s,t))}},nf.multiTouch=function(t,e){const{disabled:i,singleGesture:s}=this.config.multiTouch;if(i)return;this.pointerWaitCancel();let n=H_.getData(e),{moving:r,zooming:o,rotating:a}=this.transformer;if(s){if(!this.transformer.transforming){switch(H_.detect(n,c(s)?s:{})){case"move":r=!0;break;case"zoom":o=!0;break;case"rotate":a=!0;break;default:return}H_.reset()}r||(n.center=H_.state.center)}else r=o=a=!0;var h,l;Object.assign(t,n.center),t.multiTouch=!0,a&&this.rotate((h=n.rotation,l=t,Object.assign(Object.assign({},l),{rotation:h}))),o&&this.zoom(sf(n.scale,t)),r&&this.move(ef(n.move,t))};const rf=Fd.prototype,{abs:of}=Math;function af(t,e){let i=1;const s="out"===e,n=Math.abs(t);if(n>1){for(;s?i<n:i<=n;)i*=2;s&&(i/=2)}else{for(;s?i>=n:i>n;)i/=2;s||(i*=2)}return i/t}rf.checkDragEndAnimate=function(t,e){const{moveX:i,moveY:s}=this.dragData,n=of(i),r=of(s),o=e?1:.1,a=this.canAnimate&&this.moving&&(n>o||r>o)&&this.interaction.m.dragAnimate;if(a){const o="touch"===t.pointerType?3:1,l=70;n*(e=e?h(a)?a:.95:o)>l?e=l/n:r*e>l&&(e=l/r),t=Object.assign({},t),dt.move(t,i*e,s*e),this.drag(t),this.animate(()=>{this.dragEnd(t,1)})}return a},rf.animate=function(t,e){const i=t||this.animateWait;i&&this.interaction.target.nextRender(i,null,e),this.animateWait=t},rf.checkDragOut=function(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)},rf.autoMoveOnDragOut=function(t){const{interaction:e,downData:i,canDragOut:s}=this,{autoDistance:n,dragOut:r}=e.m;if(!r||!s||!n)return;const o=e.shrinkCanvasBounds,{x:a,y:h}=o,l=Xt.maxX(o),d=Xt.maxY(o),c=t.x<a?n:l<t.x?-n:0,u=t.y<h?n:d<t.y?-n:0;let p=0,g=0;this.autoMoveTimer=setInterval(()=>{p+=c,g+=u,dt.move(i,c,u),dt.move(this.dragData,c,u),e.move(Object.assign(Object.assign({},t),{moveX:c,moveY:u,totalX:p,totalY:g,moveType:"drag"})),e.pointerMoveReal(t)},10)},rf.autoMoveCancel=function(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)},oe.add("viewport"),oe.add("view"),t.Leafer.prototype.zoom=function(t,e,i,s){let n;this.killAnimate(),u(e)?(n=e.padding,i=e.scroll,s=e.transition):n=e;const{zoomLayer:a}=this,l=this.canvas.bounds.clone().shrink(r(n)?30:n),p=new Kt,g={x:l.x+l.width/2,y:l.y+l.height/2};let _;const{x:f,y:m,scaleX:y,scaleY:v}=a.__;if(o(t))switch(t){case"in":_=af(y,"in");break;case"out":_=af(y,"out");break;case"fit":t=this.boxBounds;break;case"fit-width":(t=new Kt(this.boxBounds)).height=0;break;case"fit-height":(t=new Kt(this.boxBounds)).width=0}else h(t)&&(_=t/y);if(_)_=this.getValidScale(_),a.scaleOfWorld(g,_,_,!1,s);else if(c(t)){const e={x:f,y:m,scaleX:y,scaleY:v},n=d(t);if(n||t.tag){const e=n?t:[t];p.setListWithFn(e,go.worldBounds)}else{const e=function(t,e){let i,{x:s,y:n,width:r,height:o}=t;return o||(o=r*(e.height/e.width),i=!0),r||(r=o*(e.width/e.height),i=!0),i?{x:s,y:n,width:r,height:o}:t}(t,l);p.set(a.getWorldBounds(e))}const{width:r,height:o}=p;let h=l.x-p.x,c=l.y-p.y;return i?(h+=Math.max((l.width-r)/2,0),c+=Math.max((l.height-o)/2,0)):(_=this.getValidScale(Math.min(l.width/r,l.height/o)),h+=(l.width-r*_)/2,c+=(l.height-o*_)/2,dt.scaleOf(e,p,_),p.scaleOf(p,_),e.scaleX*=_,e.scaleY*=_),"x"===i?c=0:"y"===i&&(h=0),dt.move(e,h,c),p.move(h,c),a.set(e,s),p}return a.worldBoxBounds};class hf extends t.Group{get isOutside(){return!0}constructor(t,e){super(),this.config={theme:"light",padding:0,minSize:10},t.isApp&&(t.sky.add(this),t=t.tree),this.target=t,e&&g.assign(this.config,e),this.changeTheme(this.config.theme),this.waitLeafer(this.__listenEvents,this)}changeTheme(e){let i;o(e)?(i={fill:"black",stroke:"rgba(255,255,255,0.8)"},"dark"===e&&(i.fill="white",i.stroke="rgba(0,0,0,0.2)")):i=e,this.scrollXBar||this.addMany(this.scrollXBar=new t.Box,this.scrollYBar=new t.Box),i=Object.assign({strokeAlign:"center",opacity:.5,width:6,cornerRadius:3,hoverStyle:{opacity:.6},pressStyle:{opacity:.7}},i),i.height||(i.height=i.width),this.scrollXBar.set(Object.assign(Object.assign({},i),{visible:!1})),this.scrollYBar.set(Object.assign(Object.assign({},i),{visible:!1})),this.leafer&&this.update()}update(t){if(this.dragScrolling)return;const{minSize:e,padding:i}=this.config,{zoomLayer:s,canvas:n}=this.target.leafer,{worldRenderBounds:r}=s;if(t&&this.scrollBounds&&this.scrollBounds.isSame(r))return;this.scrollBounds=new Kt(r);const o=n.bounds.clone().shrink(i),a=o.clone().add(r),h=this.ratioX=o.width/a.width,l=this.ratioY=o.height/a.height,d=(o.x-a.x)/a.width,c=(o.y-a.y)/a.height,u=h<1,p=l<1,{scrollXBar:g,scrollYBar:_}=this,{x:f,y:m,width:y,height:v}=o.shrink([2,p?_.width+6:2,u?g.height+6:2,2]);g.set({x:f+y*d,y:m+v+2,width:Math.max(y*h,e),visible:u}),_.set({x:f+y+2,y:m+v*c,height:Math.max(v*l,e),visible:p})}onDrag(t){this.dragScrolling=!0,this.__dragOut=this.app.config.move.dragOut,this.app.config.move.dragOut=!1;const e=t.current===this.scrollXBar,i=this.target.leafer.getValidMove(e?-t.moveX/this.ratioX:0,e?0:-t.moveY/this.ratioY);this.target.moveWorld(i.x,i.y),t.current.moveWorld(i.x&&-i.x*this.ratioX,i.y&&-i.y*this.ratioY)}onDragEnd(){this.dragScrolling=!1,this.app.config.move.dragOut=this.__dragOut}__listenEvents(){const{scrollXBar:e,scrollYBar:i}=this;this.__eventIds=[e.on_(t.DragEvent.DRAG,this.onDrag,this),i.on_(t.DragEvent.DRAG,this.onDrag,this),e.on_(t.DragEvent.END,this.onDragEnd,this),i.on_(t.DragEvent.END,this.onDragEnd,this),this.target.on_(Ko.BEFORE,()=>this.update(!0)),this.target.leafer.on_(Vo.RESIZE,()=>this.update())]}__removeListenEvents(){this.off_(this.__eventIds)}destroy(){this.destroyed||(this.__removeListenEvents(),this.target=this.config=null,super.destroy())}}oe.add("scroll");class lf extends dl{}function df(t){return hr(t,t=>({set(e){if(this.__setAttr(t,e)){const t=this.__,e="none"!==t.startArrow||"none"!==t.endArrow;t.__useArrow!==e&&vr(this),t.__useArrow=e,br(this)}}}))}t.Arrow=class extends t.Line{get __tag(){return"Arrow"}constructor(t){super(t),this.__.__useArrow=!0}static registerArrow(t,e){Yh.register(t,e)}},_e([Wr(lf)],t.Arrow.prototype,"__",void 0),_e([df("angle")],t.Arrow.prototype,"endArrow",void 0),t.Arrow=_e([jr()],t.Arrow);const{M:cf,L:uf,C:pf,Q:gf,O:_f}=Me,{rotate:ff,copyFrom:mf,scale:yf}=dt,vf={},xf={layout(t,e,i,s,n,r,o){let a,h,l=0,d=t.length;for(;l<d;)switch(a=t[l],a){case cf:case uf:wf(t,l+1,e,i,s,n,r,o),l+=3;break;case pf:for(h=1;h<6;h+=2)wf(t,l+h,e,i,s,n,r,o);l+=7;break;case gf:for(h=1;h<4;h+=2)wf(t,l+h,e,i,s,n,r,o);l+=5;break;case _f:t[l+1]+=e,t[l+2]+=i,s&&(t[l+3]*=s),r&&(t[l+4]+=r,t[l+5]+=r),l+=7}},rotate(t,e,i){xf.layout(t,0,0,1,1,e,i)}};function wf(t,e,i,s,n,r,o,a){mf(vf,t[e],t[e+1]),o&&ff(vf,o,a),n&&yf(vf,n,r),t[e]=i+vf.x,t[e+1]=s+vf.y}const{layout:Ef,rotate:bf}=xf,{getAngle:kf}=dt,Sf={x:-.5},Bf={connect:Sf,offset:{x:-.71,bevelJoin:.36,roundJoin:.22},path:[1,-3,-3,2,0,0,2,-3,3]},Tf={connect:Sf,offset:{x:-1.207,bevelJoin:.854,roundJoin:.707},path:[1,-3,-3,2,0,0,2,-1,0]},Pf={connect:Sf,offset:{x:-.9,bevelJoin:.624,roundJoin:.4},path:[1,-3,0,2,-3,-2,2,0,0,2,-3,2,2,-3,0,1,-2.05,1.1,2,-2.05,-1.1],dashPath:[1,-2,0,2,-.5,0]},Lf={connect:Sf,offset:{x:-1.1,bevelJoin:.872,roundJoin:.6},path:[1,-3,0,2,-3.5,-1.8,2,0,0,2,-3.5,1.8,2,-3,0,1,-2.25,.95,2,-2.25,-.95],dashPath:[1,-3,0,2,-.5,0]},Rf={offset:Sf,path:[...Pf.path],dashPath:[1,-2.5,0,2,-1,0]};bf(Rf.path,180,{x:-1.5,y:0});const Cf={connect:{x:-1.3},path:[1,1.8,-.1,2,1.8,0,26,0,0,1.8,0,359,0]},Of={connect:{x:.5},path:[...Cf.path,1,0,0,26,0,0,1,0,360,0],dashPath:[1,-.5,0,2,.5,0]},Mf={connect:{x:-1.3},path:[1,-1.4,0,2,-1.4,-1.4,2,1.4,-1.4,2,1.4,1.4,2,-1.4,1.4,2,-1.4,0]},Df={path:[...Mf.path,2,-1.4,-.49,2,1,-.49,1,-1.4,.49,2,1,.49]},If=g.clone(Mf),Af=g.clone(Df);bf(If.path,45),bf(Af.path,45);const Wf={angle:Bf,"angle-side":Tf,arrow:Lf,triangle:Pf,"triangle-flip":Rf,circle:Of,"circle-line":Cf,square:Df,"square-line":Mf,diamond:Af,"diamond-line":If,mark:{offset:Sf,path:[1,0,-2,2,0,2]}};function Ff(t,e,i,s,n,r,o){let a,h;const{strokeCap:l,strokeJoin:d}=t.__;c(e)?e.type?(h=e.scale,a=Wf[e.type]):a=e:a=Wf[e];const{offset:u,connect:p,path:g,dashPath:_}=a;let f=p?p.x:0,m=u?u.x:0;const y=[...g];return o&&_&&y.push(..._),"none"!==l&&(f-=.5),u&&("round"===d&&u.roundJoin?m+=u.roundJoin:"bevel"===d&&u.bevelJoin&&(m+=u.bevelJoin)),h&&Ef(y,0,0,h,h),m&&Ef(y,m,0),Ef(y,s.x,s.y,n,n,kf(i,s)),r.x=(f+m)*n,y}const{M:zf,L:Hf,C:Uf,Q:Nf,Z:Yf,N:Xf,D:Vf,X:jf,G:Gf,F:Kf,O:Zf,P:qf,U:Jf}=Me,{copy:$f,copyFrom:Qf,getDistancePoint:tm}=dt,em={},im={},sm={},nm={},rm={},om={list:Wf,addArrows(t){const{startArrow:e,endArrow:i,strokeWidth:s,dashPattern:n,__pathForRender:r,cornerRadius:o}=t.__,a=!o;let h,l=0,d=r.length,c=0,u=e&&"none"!==e;for(;l<d;){switch(h=r[l],h){case zf:case Hf:(c<2||l+6>=d)&&(Qf(rm,r[l+1],r[l+2]),!c&&u&&$f(im,rm)),l+=3;break;case Uf:(1===c||l+7>=d-3)&&am(r,nm,rm,l+3),l+=7;break;case Nf:(1===c||l+5>=d-3)&&am(r,nm,rm,l+1),l+=5;break;case Yf:return;case Xf:l+=5;break;case Vf:l+=9;break;case jf:l+=6;break;case Gf:l+=9;break;case Kf:l+=5;break;case Zf:l+=7;break;case qf:l+=4;break;case Jf:(1===c||l+6>=d-3)&&(am(r,nm,rm,l+1),l+6!==d&&(rm.x-=(rm.x-nm.x)/10,rm.y-=(rm.y-nm.y)/10)),l+=6}if(c++,1===c&&h!==zf)return;if(2===c&&u&&$f(sm,h===Hf?rm:nm),l===d){const o=t.__.__pathForRender=a?[...r]:r,d=t.__.__pathForArrow=[];if(u){const i=Ff(t,e,sm,im,s,em,!!n);n?d.push(...i):o.push(...i),em.x&&(tm(im,sm,-em.x,!0),o[1]=sm.x,o[2]=sm.y)}if(i&&"none"!==i){const e=Ff(t,i,nm,rm,s,em,!!n);if(n?d.push(...e):o.push(...e),em.x){let t;switch(tm(rm,nm,-em.x,!0),h){case Hf:t=l-3+1;break;case Uf:t=l-7+5;break;case Nf:t=l-5+3;break;case Jf:t=l-6+3}t&&hm(o,nm,t)}}}else $f(nm,rm)}},register(t,e){this.list[t]=e},get(t){return this.list[t]}};function am(t,e,i,s){Qf(e,t[s],t[s+1]),Qf(i,t[s+2],t[s+3])}function hm(t,e,i){t[i]=e.x,t[i+1]=e.y}oe.add("arrow"),t.UI.addAttr("startArrow","none",df),t.UI.addAttr("endArrow","none",df),Object.assign(Yh,om),Object.assign(Xh,{strokeArrow(t,e,i,s){e.__.dashPattern&&(i.beginPath(),e.__drawPathByData(i,e.__.__pathForArrow),i.dashPattern=null,i.stroke())}});const{Yes:lm,NoAndSkip:dm,YesAndSkip:cm}=t.Answer,um={},pm={},gm={};class _m{constructor(t){this.innerIdMap={},this.idMap={},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.target=t)&&this.__listenEvents()}getBy(t,e,i,s){switch(typeof t){case"number":const r=this.getByInnerId(t,e);return i?r:r?[r]:[];case"string":switch(t[0]){case"#":um.id=t.substring(1),t=um;break;case".":pm.className=t.substring(1),t=pm;break;default:gm.tag=t,t=gm}case"object":if(n(t.id)){if(t.tag){const{tag:s}=t,n=d(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&&ro.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),r===lm||r===cm){if(!i)return void(this.findLeaf=n);i.push(n)}n.isBranch&&r<dm&&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_(Do.REMOVE,this.__onRemoveChild,this),this.target.on_(Ao.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 fm=t.UI.prototype;function mm(t){return t.leafer?t.leafer.selector:v.selector||(v.selector=ae.selector())}fm.find=function(t,e){return mm(this).getBy(t,this,!1,e)},fm.findOne=function(t,e){return mm(this).getBy(t,this,!0,e)},oe.add("find"),ae.finder=function(t){return new _m(t)};const{setPoint:ym,addPoint:vm,toBounds:xm}=vt;const wm={syncExport(t,e,i){let s;Zh.running=!0;try{const r=jn.fileType(e),o=e.includes(".");i=jn.getExportOptions(i);const{toURL:a}=v,{download:h}=v.origin;if("json"===r)o&&h(a(JSON.stringify(t.toJSON(i.json)),"text"),e),s={data:!!o||t.toJSON(i.json)};else if("svg"===r)o&&h(a(t.toSVG(),"svg"),e),s={data:!!o||t.toSVG()};else{let r,o,a=1,h=1;const{worldTransform:l,isLeafer:d,leafer:c,isFrame:u}=t,{slice:p,clip:g,trim:_,screenshot:f,padding:m,onCanvas:y}=i,x=n(i.smooth)?!c||c.config.smooth:i.smooth,w=i.contextSettings||(c?c.config.contextSettings:void 0),E=d&&f&&n(i.fill)?t.fill:i.fill,b=jn.isOpaqueImage(e)||E,k=new mt;if(f)r=!0===f?d?c.canvas.bounds:t.worldRenderBounds:f;else{let e=i.relative||(d?"inner":"local");switch(a=l.scaleX,h=l.scaleY,e){case"inner":k.set(l);break;case"local":k.set(l).divide(t.localTransform),a/=t.scaleX,h/=t.scaleY;break;case"world":a=1,h=1;break;case"page":e=c||t;default:k.set(l).divide(t.getTransform(e));const i=e.worldTransform;a/=a/i.scaleX,h/=h/i.scaleY}r=t.getBounds("render",e)}const S={scaleX:1,scaleY:1};F.getScaleData(i.scale,i.size,r,S);let B=i.pixelRatio||1,{x:T,y:P,width:L,height:R}=new Kt(r).scale(S.scaleX,S.scaleY);g&&(T+=g.x,P+=g.y,L=g.width,R=g.height);const C={exporting:!0,matrix:k.scale(1/S.scaleX,1/S.scaleY).invert().translate(-T,-P).withScale(1/a*S.scaleX,1/h*S.scaleY)};let O,M=ae.canvas({width:Math.floor(L),height:Math.floor(R),pixelRatio:B,smooth:x,contextSettings:w});p&&(O=t,O.__worldOpacity=0,t=c||t,C.bounds=M.bounds),M.save();const D=u&&!n(E),I=t.get("fill");if(D&&(t.fill=""),v.render(t,M,C),D&&(t.fill=I),M.restore(),O&&O.__updateWorldOpacity(),_){o=function(t){const{width:e,height:i}=t.view,{data:s}=t.context.getImageData(0,0,e,i);let n,r,o,a=0;for(let t=0;t<s.length;t+=4)0!==s[t+3]&&(n=a%e,r=(a-n)/e,o?vm(o,n,r):ym(o={},n,r)),a++;const h=new Kt;return o&&(xm(o,h),h.scale(1/t.pixelRatio).ceil()),h}(M);const t=M,{width:e,height:i}=o,s={x:0,y:0,width:e,height:i,pixelRatio:B};M=ae.canvas(s),M.copyWorld(t,o,s),t.destroy()}if(m){const[t,e,i,s]=F.fourNumber(m),n=M,{width:r,height:o}=n;M=ae.canvas({width:r+s+e,height:o+t+i,pixelRatio:B}),M.copyWorld(n,n.bounds,{x:s,y:t,width:r,height:o}),n.destroy()}b&&M.fillWorld(M.bounds,E||"#FFFFFF","destination-over"),y&&y(M);s={data:"canvas"===e?M:M.export(e,i),width:M.pixelWidth,height:M.pixelHeight,renderBounds:r,trimBounds:o};const A=c&&c.app;A&&A.canvasManager&&A.canvasManager.clearRecycled()}}catch(t){s={data:"",error:t}}return Zh.running=!1,s},export(t,e,i){return Zh.running=!0,function(t){Em||(Em=new qn);return new Promise(e=>{Em.add(()=>fe(this,void 0,void 0,function*(){return yield t(e)}),{parallel:!1})})}(s=>new Promise(n=>{const r=()=>fe(this,void 0,void 0,function*(){if(!$n.isComplete)return v.requestRender(r);const o=Zh.syncExport(t,e,i);o.data instanceof Promise&&(o.data=yield o.data),s(o),n()});t.updateLayout(),bm(t);const{leafer:o}=t;o?o.waitViewCompleted(r):r()}))}};let Em;function bm(t){t.__.__needComputePaint&&t.__.__computePaint(),t.isBranch&&t.children.forEach(t=>bm(t))}const km=Re.prototype,Sm=Qt.get("@leafer-in/export");km.export=function(t,e){const{quality:i,blob:s}=jn.getExportOptions(e);return t.includes(".")?this.saveAs(t,i):s?this.toBlob(t,i):this.toDataURL(t,i)},km.toBlob=function(t,e){return new Promise(i=>{v.origin.canvasToBolb(this.view,t,e).then(t=>{i(t)}).catch(t=>{Sm.error(t),i(null)})})},km.toDataURL=function(t,e){return v.origin.canvasToDataURL(this.view,t,e)},km.saveAs=function(t,e){return new Promise(i=>{v.origin.canvasSaveAs(this.view,t,e).then(()=>{i(!0)}).catch(t=>{Sm.error(t),i(!1)})})},oe.add("export"),Object.assign(Zh,wm),t.UI.prototype.export=function(t,e){return Zh.export(this,t,e)},t.UI.prototype.syncExport=function(t,e){return Zh.syncExport(this,t,e)};const Bm={none:"none",title:"capitalize",upper:"uppercase",lower:"lowercase","small-caps":"small-caps"},Tm={top:"flex-start",middle:"center",bottom:"flex-end"},Pm={none:"none",under:"underline",delete:"line-through","under-delete":"underline line-through"};function Lm(t,e,i){const{style:s}=t,{fill:r,padding:a,textWrap:h,textOverflow:l,textDecoration:u}=e;let p;s.fontFamily=e.fontFamily,s.fontSize=e.fontSize*i+"px",function(t,e){let i="black";d(e)&&(e=e[0]);if(c(e))switch(e.type){case"solid":i=Uh.string(e.color);break;case"image":break;case"linear":case"radial":case"angular":const t=e.stops[0];i=Uh.string(o(t)?t:t.color);break;default:n(e.r)||(i=Uh.string(e))}else i=e;t.color=i}(s,r),s.fontStyle=e.italic?"italic":"normal",s.fontWeight=e.fontWeight,c(u)?(p=u.type,u.color&&(s.textDecorationColor=Uh.string(u.color))):p=u,s.textDecoration=Pm[p],s.textTransform=Bm[e.textCase],s.textAlign="both"===e.textAlign?"justify":e.textAlign,s.display="flex",s.flexDirection="column",s.justifyContent=Tm[e.verticalAlign],s.lineHeight=(e.__.__lineHeight||0)*i+"px",s.letterSpacing=(e.__.__letterSpacing||0)*i+"px",s.whiteSpace="none"===h||e.__.__autoWidth?"nowrap":"normal",s.wordBreak="break"===h?"break-all":"normal",s.textIndent=(e.paraIndent||0)*i+"px",s.padding=d(a)?a.map(t=>t*i+"px").join(" "):(a||0)*i+"px",s.textOverflow="show"===l?"":"hide"===l?"clip":l}t.TextEditor=class extends e_{constructor(){super(...arguments),this.config={selectAll:!0},this.eventIds=[]}get tag(){return"TextEditor"}onLoad(){const{editor:e}=this,{config:i}=e.app,s=this.editTarget;s.textEditing=!0,this.isHTMLText=!(s instanceof t.Text),this._keyEvent=i.keyEvent,i.keyEvent=!1;const n=this.editDom=document.createElement("div");n.classList.add("leafer-text-editor");const{style:r}=n;n.contentEditable="true",r.position="fixed",r.transformOrigin="left top",r.boxSizing="border-box",this.isHTMLText?n.innerHTML=String(s.text):n.innerText=String(s.text);const{view:o}=e.app;(this.inBody=o instanceof HTMLCanvasElement)?document.body.appendChild(n):o.appendChild(n),this.eventIds=[e.app.on_(t.PointerEvent.DOWN,t=>{let i,{target:s}=t.origin;for(;s;)s===n&&(i=!0),s=s.parentElement;i||e.closeInnerEditor()})],this.onFocus=this.onFocus.bind(this),this.onInput=this.onInput.bind(this),this.onPaste=this.onPaste.bind(this),this.onUpdate=this.onUpdate.bind(this),this.onKeydown=this.onKeydown.bind(this),n.addEventListener("focus",this.onFocus),n.addEventListener("input",this.onInput),n.addEventListener("paste",this.onPaste),window.addEventListener("keydown",this.onKeydown),window.addEventListener("scroll",this.onUpdate);const a=window.getSelection(),h=document.createRange();if(this.config.selectAll)h.selectNodeContents(n);else{const t=n.childNodes[0];t&&(h.setStartAfter(t),h.setEndAfter(t)),h.collapse(!0)}a.removeAllRanges(),a.addRange(h)}onInput(){const{editDom:t}=this;this.editTarget.text=this.isHTMLText?t.innerHTML:t.innerText}onFocus(){this.editDom.style.outline="none"}onKeydown(t){if("Escape"===t.code&&this.editor.closeInnerEditor(),"Enter"===t.key){t.preventDefault();const e=document.createElement("br"),i=document.createTextNode("​"),s=window.getSelection().getRangeAt(0);s.deleteContents(),s.insertNode(i),s.insertNode(e),s.setStartAfter(e),s.setEndAfter(e),this.onInput()}}onPaste(t){if(this.isHTMLText)return;t.preventDefault();const e=t.clipboardData;if(!e)return;let i=e.getData("text/plain").replace(/\r\n?/g,"\n");const s=window.getSelection();if(!s||!s.rangeCount)return;const n=s.getRangeAt(0);n.deleteContents();const r=i.split("\n"),o=document.createDocumentFragment();r.forEach((t,e)=>{e>0&&o.appendChild(document.createElement("br")),o.appendChild(document.createTextNode(t))}),n.insertNode(o),n.collapse(!1),s.removeAllRanges(),s.addRange(n),this.onInput()}onUpdate(){const{editTarget:t}=this;let e=1;if(!this.isHTMLText){const{scaleX:i,scaleY:s}=t.worldTransform;e=Math.max(Math.abs(i),Math.abs(s));t.fontSize*e<12&&(e*=12/t.fontSize)}this.textScale=e;let{width:i,height:s}=t,n=0,r=0;i*=e,s*=e;const o=t.__;if(o.__autoWidth)switch(i+=20,o.textAlign){case"center":n=o.autoSizeAlign?-i/2:-10;break;case"right":n=o.autoSizeAlign?-i:-20}if(o.__autoHeight)switch(s+=20,o.verticalAlign){case"middle":r=o.autoSizeAlign?-s/2:-10;break;case"bottom":r=o.autoSizeAlign?-s:-20}const{x:a,y:h}=this.inBody?t.app.clientBounds:t.app.tree.clientBounds,{a:l,b:d,c:c,d:u,e:p,f:g}=new mt(t.worldTransform).scale(1/e).translateInner(n,r),{style:_}=this.editDom;_.transform=`matrix(${l},${d},${c},${u},${p},${g})`,_.left=a+"px",_.top=h+"px",_.width=i+"px",_.height=s+"px",this.isHTMLText||Lm(this.editDom,t,e)}onUnload(){const{editTarget:t,editor:e,editDom:i}=this;t&&(this.onInput(),"\n"===t.text&&(t.text=""),t.textEditing=void 0,e.app&&(e.app.config.keyEvent=this._keyEvent),e.off_(this.eventIds),i.removeEventListener("focus",this.onFocus),i.removeEventListener("input",this.onInput),i.removeEventListener("paste",this.onPaste),window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("scroll",this.onUpdate),i.remove(),this.editDom=this.eventIds=void 0)}},t.TextEditor=_e([Ug()],t.TextEditor),oe.add("text-editor","editor");class Rm extends vl{setText(t){this._text=t,this.__htmlChanged=!0}}const Cm={lt:"<",gt:">",amp:"&",quot:'"',apos:"'",nbsp:" ",ensp:" ",emsp:" ",thinsp:" ",ndash:"–",mdash:"—",hellip:"…",middot:"·",bull:"•",laquo:"«",raquo:"»",lsquo:"‘",rsquo:"’",ldquo:"“",rdquo:"”",cent:"¢",pound:"£",yen:"¥",euro:"€",times:"×",divide:"÷",plusmn:"±",minus:"−",frac12:"½",frac14:"¼",frac34:"¾",sup2:"²",sup3:"³",deg:"°",reg:"®",copy:"©",trade:"™",section:"§",para:"¶",dagger:"†",Dagger:"‡",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",alpha:"α",beta:"β",gamma:"γ",delta:"δ",pi:"π",sigma:"σ",omega:"ω",Omega:"Ω",micro:"µ",infinity:"∞",not:"¬",equiv:"≡",le:"≤",ge:"≥"};return t.HTMLText=class extends t.Image{get __tag(){return"HTMLText"}constructor(t){super(t)}__updateBoxBounds(){const t=this.__;if(t.__htmlChanged){const e=document.createElement("div"),{style:i}=e;i.all="initial",i.position="absolute",i.visibility="hidden",e.innerHTML=this.text,document.body.appendChild(e);const{width:s,height:n}=e.getBoundingClientRect(),r=s+10,o=`<svg xmlns="http://www.w3.org/2000/svg" width="${r}" height="${n}">\n <foreignObject width="${r}" height="${n}">\n <style>\n * {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n </style>\n <body xmlns="http://www.w3.org/1999/xhtml">\n ${this.decodeText(this.text)}\n </body>\n </foreignObject>\n </svg>`;t.__setImageFill("data:image/svg+xml,"+encodeURIComponent(o)),t.__naturalWidth=r/t.pixelRatio,t.__naturalHeight=n/t.pixelRatio,t.__htmlChanged=!1,e.remove()}super.__updateBoxBounds()}__draw(t,e,i){this.textEditing&&!e.exporting||super.__draw(t,e,i)}decodeText(t){if(!t.includes("&"))return t;let e,i,s="",n=0;for(;n<t.length;){if("&"===t[n]){const r=t.indexOf(";",n+1);if(r>n+1&&(e=t.slice(n+1,r),i=Cm[e],void 0!==i)){s+=i,n=r+1;continue}}s+=t[n++]}return s}static addUnicodeEntity(t,e){o(t)?Cm[t]=e:Object.assign(Cm,t)}},_e([Wr(Rm)],t.HTMLText.prototype,"__",void 0),_e([mr("")],t.HTMLText.prototype,"text",void 0),_e([cr("TextEditor")],t.HTMLText.prototype,"editInner",void 0),_e([Br(!1)],t.HTMLText.prototype,"textEditing",void 0),t.HTMLText=_e([jr()],t.HTMLText),oe.add("html"),t.AlignHelper=Tt,t.AroundHelper=kt,t.ArrowData=lf,t.AutoBounds=qt,t.BezierHelper=oi,t.Bounds=Kt,t.BoundsEvent=zo,t.BoundsHelper=Xt,t.BoxData=al,t.BranchHelper=yo,t.BranchRender=Ma,t.CanvasData=xl,t.CanvasManager=ge,t.ChildEvent=Do,t.ColorConvert=Uh,t.Creator=ae,t.Cursor=Zd,t.DataHelper=g,t.Debug=Qt,t.DragBoundsHelper=Bd,t.Dragger=Fd,t.EditBox=Lg,t.EditDataHelper=wg,t.EditPoint=Bg,t.EditSelect=hg,t.EditSelectHelper=ng,t.EditToolCreator=Ng,t.EditorEvent=Gp,t.EditorGroupEvent=Vg,t.EditorHelper=Fg,t.EditorMoveEvent=qg,t.EditorRotateEvent=$g,t.EditorScaleEvent=Jg,t.EditorSkewEvent=Qg,t.Effect=Gh,t.EllipseData=ul,t.EllipseHelper=_i,t.Event=Mo,t.EventCreator=ue,t.Eventer=ia,t.Export=Zh,t.FileHelper=jn,t.Filter=Kh,t.Finder=_m,t.FourNumberHelper=P,t.FrameData=ll,t.GroupData=ol,t.HTMLTextData=Rm,t.HitCanvasManager=qd,t.ImageData=vl,t.ImageEvent=Fo,t.ImageManager=tr,t.IncrementId=w,t.InnerEditor=e_,t.InnerEditorEvent=Xg,t.InteractionBase=Kd,t.InteractionHelper=Od,t.Keyboard=ud,t.LayoutEvent=Go,t.Layouter=Ch,t.LeafBounds=Ra,t.LeafBoundsHelper=go,t.LeafData=f,t.LeafDataProxy=_a,t.LeafEventer=pa,t.LeafHelper=ro,t.LeafLayout=Oo,t.LeafLevelList=_h,t.LeafList=gh,t.LeafMatrix=Ea,t.LeafRender=Ca,t.LeaferCanvas=fh,t.LeaferCanvasBase=Re,t.LeaferData=hl,t.LeaferEvent=Zo,t.LeaferImage=nr,t.LeaferTypeCreator=W_,t.LineData=dl,t.MathHelper=F,t.Matrix=mt,t.MatrixHelper=Q,t.MultiTouchHelper=H_,t.MyDragEvent=Rd,t.MyImage=rd,t.MyPointerEvent=Pd,t.MyTouchEvent=Cd,t.NeedConvertToCanvasCommandMap=Ie,t.OneRadian=H,t.PI2=U,t.PI_2=N,t.Paint=Xh,t.PaintGradient=jh,t.PaintImage=Vh,t.PathArrow=Yh,t.PathArrowModule=om,t.PathBounds=Dn,t.PathCommandDataHelper=bs,t.PathCommandMap=Me,t.PathCommandNodeHelper=fi,t.PathConvert=ts,t.PathCorner=Un,t.PathCreator=Hs,t.PathData=_l,t.PathDrawer=en,t.PathHelper=Ce,t.PathMatrixHelper=xf,t.PathNumberCommandLengthMap=ze,t.PathNumberCommandMap=Fe,t.PenData=fl,t.Picker=Ih,t.Platform=v,t.Plugin=oe,t.Point=_t,t.PointHelper=dt,t.PointerButton=pd,t.PolygonData=pl,t.PropertyEvent=Ao,t.RectData=cl,t.RectHelper=He,t.RectRender=Tl,t.RenderEvent=Ko,t.Renderer=Mh,t.ResizeEvent=Vo,t.Resource=$n,t.Run=se,t.ScrollBar=hf,t.SelectArea=sg,t.Selector=Ah,t.StarData=gl,t.State=qh,t.StringNumberMap=Jt,t.Stroker=ig,t.TaskItem=Zn,t.TaskProcessor=qn,t.TextConvert=Hh,t.TextData=yl,t.TransformTool=t_,t.Transformer=J_,t.Transition=Jh,t.TwoPointBoundsHelper=vt,t.UIBounds=bl,t.UICreator=le,t.UIData=nl,t.UIEvent=gd,t.UIRender=Sl,t.UnitConvert=Nh,t.WaitHelper=Eo,t.WatchEvent=jo,t.Watcher=xh,t.WheelEventHelper=j_,t.addViewport=D_,t.addViewportConfig=I_,t.affectRenderBoundsType=Sr,t.affectStrokeBoundsType=Er,t.arrowType=df,t.attr=lr,t.autoLayoutType=gr,t.boundsType=mr,t.canvasPatch=Vn,t.canvasSizeAttrs=Le,t.createAttr=function(t){return(e,i)=>{rr(e,i,ar(i,t))}},t.createDescriptor=ar,t.cursorType=Ar,t.dataProcessor=Wr,t.dataType=cr,t.decorateLeafAttr=hr,t.defineDataProcessor=Fr,t.defineKey=rr,t.defineLeafAttr=dr,t.dimType=Tr,t.doBoundsType=vr,t.doStrokeType=br,t.effectType=Wh,t.emptyData=s,t.eraserType=Dr,t.extraPropertyEventMap=Wo,t.getBoundsData=X,t.getDescriptor=or,t.getMatrixData=V,t.getPointData=Y,t.hitType=Ir,t.isArray=d,t.isData=u,t.isEmptyData=p,t.isFinite=a,t.isNull=r,t.isNumber=h,t.isObject=c,t.isString=o,t.isUndefined=n,t.layoutProcessor=function(t){return(e,i)=>{rr(e,"__LayoutProcessor",{get:()=>t})}},t.leaferTransformAttrMap=ta,t.maskType=Mr,t.naturalBoundsType=yr,t.opacityType=Pr,t.path=Nn,t.pathInputType=xr,t.pathType=wr,t.pen=Yn,t.positionType=ur,t.registerEditTool=Hg,t.registerInnerEditor=Ug,t.registerUI=jr,t.registerUIEvent=Gr,t.resizeType=Fh,t.rewrite=Nr,t.rewriteAble=Yr,t.rotationType=fr,t.scaleType=_r,t.scrollType=pr,t.sortType=Or,t.strokeType=kr,t.surfaceType=Br,t.tempBounds=Zt,t.tempMatrix=yt,t.tempPoint=ft,t.tryToNumber=function(t){return"string"==typeof t&&l.test(t)?+t:t},t.useCanvas=yh,t.useModule=Vr,t.version="1.11.2",t.visibleType=Lr,t.zoomLayerType=zh,t}({});function Leafer(t){return new LeaferUI.Leafer(t)}Object.setPrototypeOf(Leafer,LeaferUI),Leafer.prototype=LeaferUI.Leafer.prototype;
2
2
  //# sourceMappingURL=worker.min.js.map